Skip to content

Serve Parquet anchors through a prepared DiskGraph index - #519

Open
nittin-murthi wants to merge 1 commit into
serving-without-in-memoryfrom
codex/501-native-serving
Open

nittin-murthi wants to merge 1 commit into
serving-without-in-memoryfrom
codex/501-native-serving

Conversation

@nittin-murthi

@nittin-murthi nittin-murthi commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #501. Stacked on #379.

Summary

Online serving now accepts the artifact, an open DiskGraph plan, and a Parquet anchor table. It uses the saved encoders and the same native batching path as offline inference. Multiple servers sharing one plan serialize requests while its sampler is bound.

Breaking change. Callers that pass fetched rows and Python requests receive an explicit refusal. The caller owns the index and controls when its source data is refreshed. The row-fetch specification remains available for inspection.

Testing

Change map

File-by-file change map

@copy-pr-bot

copy-pr-bot Bot commented Nov 24, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@nittin-murthi
nittin-murthi temporarily deployed to gha-kumo-workflow-tests November 24, 2026 00:42 — with GitHub Actions Inactive
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Explain Change →

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

Parsing warnings: 1

Validation error: Unrecognized key: "tone_instructions" at "reviews"
Configuration instructions

  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Walkthrough

Serving now uses a prepared DiskGraph plan and Parquet anchors to assemble native model-format inference batches. The assembler validates the artifact and plan, rejects row-only inputs, and does not use Python request-batching fallback. Tests and examples compare served batches with offline inference on the same index and anchors.

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant ServingAssembler
  participant Plan
  participant NativeAnchors
  Caller->>ServingAssembler: assemble(AnchorTable)
  ServingAssembler->>Plan: materialize anchors in inference mode
  Plan-->>ServingAssembler: native anchors
  ServingAssembler->>NativeAnchors: request native batches
  NativeAnchors-->>ServingAssembler: model-format batches
  ServingAssembler-->>Caller: batches
Loading

Severity of issue fixed: Medium

Merge Risk: Low · up to 02bec

Serving now takes Parquet anchors against a prepared DiskGraph plan, and legacy row inputs are refused on purpose. The only open concern is a test helper that could silently overwrite anchor columns if a request's metadata used a reserved key. No current test triggers it, so merge risk is low.

Security architecture risk: Moderate · up to 02bec

Serving now reads from a shared dataset rather than receiving only the rows selected for each request. This makes it important for callers to authorize which records can be scored and to control which input files are accepted. Serving calls are serialized with each other, but other uses of the same open dataset are not covered by that protection.

Retained concerns

  • Medium · security · inferred: The old assembler could not read rows omitted by the caller. The new assembler resolves anchor entities and prediction times against the prepared index. If an integration forwards request-selected anchors without authorization equivalent to its former row selection, scoring can reach data that the integration previously withheld. The contract fingerprint checks compatibility, not tenant or entity entitlement. This concern is bounded by the configured index and its sampling contract; no production exposure is established.
  • Medium · security · inferred: The new serving path reaches the offline materializer's automatic recognition of precomputed values in Parquet metadata. The metadata supplies both the feature-column mapping and the declared contract and dataset fingerprints. Matching those declarations and the anchor binding establishes compatibility, not who produced the values. If an integration accepts untrusted Parquet files and those checks pass, supplied scalars can enter model inputs without being recomputed from the prepared index. This path was not reachable through the former row-based serving API.
  • Medium · reliability · inferred: Serving requests now replace the prepared plan's active sampler for the duration of a task. The lock excludes other serving requests on the same plan, not direct materialization. A concurrent native task can replace the shared binding, and closing the currently bound task clears it rather than restoring another live task's binding. Source operations that consult the shared sampler can therefore use a different context from the one their task established. The old serving path used a request-local row source. Impact is confined to mixed use of the same plan; callers are already told to wait for serving calls before closing it.
Security review details

Security Blast Radius

  • inferred — At the library boundary, the selected plan bounds indexed data access and the serving process's filesystem permissions bound anchor reads. Local-only path resolution rejects URI schemes but does not constrain directory and glob resolution to a caller-specific root.

Trust Boundaries and Controls

  • observed — Serving requires complete, compatible fitted state and a matching DiskGraph contract. It disables Python request fallback on the newly allocated task; the fallback remains enabled by default for non-serving consumers, as before.

Resilience and Maintainability Implications

  • observed — Once a task is acquired, serving consumes the batch iterator and closes the task before releasing the plan lock, including when batch production raises. The returned list does not leave an active batch iterator with the caller.

Hardening Proposals

  • proposed — Have the trusted integration authorize anchor entities and write anchor files under a service-owned root. Reject precomputed value metadata on that input path unless the file comes from a separately trusted producer.
Pre-merge checks: Passed 2 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Change Map Design Review Warning (previously flagged, unaddressed) Details from the previous assessment are unavailable.
Passed Passed checks: 2 passed

Check name Status Explanation
Pr Size Passed The PR size check fails only when the changed-file count exceeds 40. git diff --name-status refs/coderabbit/pre-merge-check/base refs/coderabbit/pre-merge-check/head lists 28 changed files, all with…
Public Resource Access Passed The check applies only to external resource references (URLs, repository locations, package source locations) that this PR adds or modifies. I diffed the reviewed range (refs/coderabbit/pre-merge-chec…
Full details: Pr Size

Explanation

The PR size check fails only when the changed-file count exceeds 40. git diff --name-status refs/coderabbit/pre-merge-check/base refs/coderabbit/pre-merge-check/head lists 28 changed files, all with status M (modified). There are no renames or additions to add to that count. Because 28 does not exceed 40, the check passes. Line counts were ignored, as the check requires.

Full details: Public Resource Access

Explanation

The check applies only to external resource references (URLs, repository locations, package source locations) that this PR adds or modifies. I diffed the reviewed range (refs/coderabbit/pre-merge-check/base to head; 31 modified files, 2,162 diff lines) and searched every added line for http(s) URLs, www. hosts, GitHub/GitLab/PyPI references, pip or git+ install sources, wheel or tarball links, S3 or artifactory locations, and index URLs. No added line matched. The removed-line search also found no URL references. The PR description's links (PR #519 comment, issue #501, CI run links) are not in the diff, so they are outside this check's scope. Because the PR adds or changes no external resource reference, the check passes.

Latest assessment: Change Map Design Review

Latest assessment: The latest assessment was inconclusive; the previous failure remains unresolved.

Latest explanation: The check assesses the PR conversation comment that starts with <!-- kumo-pr-change-map -->. I could not read that comment. The sandbox holds only the git checkout and the refs/coderabbit/pre-merge-check/{base,head} refs. The marker string appears only in docs/development/review.md, which describes the expected comment. The PR description links to the comment at issuecomment-7118350670, but no file in the checkout contains its body. The checkout also holds no comment export. The commit range is available. It changes 28 files under packages/experimental/kumo-pytorch. The commit message is Use prepared DiskGraph indexes and Parquet anchors for serving. The primary PR is NVIDIA/kumo-engine #519, with base serving-without-in-memory, head codex/501-native-serving, and author nittin-murthi. The PR objectives summarize the comment at a high level. They do not give the Change map table, the per-change rationale, the stopping condition, or the verification mapping. I cannot assess each change against the failure, the necessity, the abstraction layer, the behavior preservation, or the omitted behavior. Agreement with the summary would not prove the table's correctness. The standing previous FAIL has no details. I cannot confirm or refute it without the comment body.

Latest resolution: Provide the body of the PR conversation comment that starts with <!-- kumo-pr-change-map --> (comment ID 7118350670, linked from the PR description), or enable retrieval of PR comments for this check. Then re-run the check. Also supply the details of the previous FAIL, so that its claims can be checked against the comment and the code.

Finishing Touches

Fix failing CI checks

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@nittin-murthi

Copy link
Copy Markdown
Contributor Author

Change map

On #379, the #501 requests reached the Python request batcher. This change routes serving through the existing native Parquet path. The regression checks the emitted batches and prevents reopening the index or entering the Python batcher.

File Function / scope What changed Why
packages/experimental/kumo-pytorch/src/kumo/pytorch/serving.py ServingAssembler Accept a prepared DiskGraph plan and Parquet anchors. Remove row-based assembly. Use the native offline batching path for each online request.
packages/experimental/kumo-pytorch/src/kumo/pytorch/engines/native_anchors.py, packages/experimental/kumo-pytorch/src/kumo/pytorch/preparation.py NativeAnchors.batches and Plan Disable Python request fallback on serving tasks and serialize serving calls sharing a plan. A serving call must not silently fall back or replace another request’s sampler binding.
packages/experimental/kumo-pytorch/tests/test_serving.py, packages/experimental/kumo-pytorch/tests/test_serving_rows_drift.py, packages/experimental/kumo-pytorch/tests/helpers.py Serving regressions Compare guarded native output to offline inference and exercise legacy refusal. Retain the row-fetch specification oracle. Catch both incorrect output and correct-looking output from the wrong batcher.
packages/experimental/kumo-pytorch/tests/test_inference_lifecycle.py, packages/experimental/kumo-pytorch/tests/test_keyless_tables.py Artifact and keyless tests Exercise native serving for saved models, ties, keyless rows and empty histories. Keep serving coverage for real model inputs and index ordering.
packages/experimental/kumo-pytorch/e2e/flows/common.py, packages/experimental/kumo-pytorch/e2e/flows/hm_gnn.py, packages/experimental/kumo-pytorch/e2e/flows/hm_pragma.py, packages/experimental/kumo-pytorch/tests/e2e/test_lifecycle.py, packages/experimental/kumo-pytorch/e2e/README.md H&M flows Use per-request Parquet anchors and compare scores and batches to offline inference on the flow index. Migrate both existing model-serving callers and their lifecycle checks.
packages/experimental/kumo-pytorch/tests/lifecycle_app.py, packages/experimental/kumo-pytorch/examples/churn/README.md, packages/experimental/kumo-pytorch/examples/churn/walkthrough.ipynb, packages/experimental/kumo-pytorch/examples/churn/serving_request.json Churn example Score a request on the prepared index in the script and notebook. Give callers a runnable migration example.
packages/experimental/kumo-pytorch/docs/06-inference-and-serving.md, packages/experimental/kumo-pytorch/docs/limitations.md, packages/experimental/kumo-pytorch/conformance/spec/guarantees/G-SERVING-001/guarantee.md, packages/experimental/kumo-pytorch/conformance/spec/guarantees/G-KEYLESS-001/guarantee.md, packages/experimental/kumo-pytorch/conformance/spec/guarantees/G-TYPE-001/guarantee.md Serving guarantees Document the index, anchor requirements, and native guarantees for keyless events and typed values. Replace guarantees that depended on passing fresh rows to the server.
packages/experimental/kumo-pytorch/src/kumo/pytorch/serving_rows.py, packages/experimental/kumo-pytorch/src/kumo/pytorch/rows/__init__.py, packages/experimental/kumo-pytorch/src/kumo/pytorch/rows/samples.py Row specifications and utilities Clarify the role of row specifications and row utilities. The specification can still be inspected independently of serving.
packages/experimental/kumo-pytorch/tests/api_reference.py, packages/experimental/kumo-pytorch/docs/api/README.md, packages/experimental/kumo-pytorch/docs/api/artifacts-and-serving.md API reference Update the serving section and regenerate its signatures and descriptions. Keep the reference aligned with the callable API.

task._anchors.allow_request_fallback = False
if batch_size is None:
batch_size = self.contract.batch.batching.max_samples or max(1, task.count())
return list(task.batches(batch_size=batch_size, seed=seed, output_format="model"))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Serving no longer rejects an anchor whose time is before the entity's available_from. The old path raised "entity did not exist before the requested sample time" (rows/samples.py).

The native model path (_typed_batches -> build_model_batch) never calls _validate_root_availability. Offline model-format batches skip it too, so the gap is older than this PR, but serving now depends on it.

Can you add the check to the native batch path, plus a serving test with a too-early anchor?

raise ValueError("serving requires a prepared DiskGraph plan")
if batch_size is not None and batch_size <= 0:
raise ValueError("batch_size must be positive")
with (

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every assemble() call runs Plan.materialize. For one request, that means check(), fit_plan(), a Parquet write, an ingest into an extension index, and a new runtime index and sampler. The old code ran check() and fit_plan() once, at startup.

The serving lock also makes calls on one plan run one at a time.

Can you add the latency of a one-row assemble() call (p50 and p95) to the PR description?

| Point-in-time selection and leakage boundaries | Implemented |
| Encodings, fitting, layouts, targets, previews | Implemented |
| Artifacts, inference mode, serving from caller-supplied rows | Implemented. Serving builds batches in Python, the same way the in-memory engine does, with times in the DiskGraph engine's clock |
| Artifacts, inference mode, serving | Implemented. Serving uses a prepared DiskGraph index and Parquet anchors |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Serving now refuses contracts that the old serving path accepted:

  • A token budget (max_tokens or bucket_by_length) with a graph neighborhood raises NotImplementedError, as test_serving_refuses_mixed_graph_and_token_budget_before_python_batching shows. Offline inference still handles it through the Python fallback.
  • Candidate sets, which the old G-SERVING-001 covered, are now refused through DG-CANDIDATE-SETS.

This row says "Implemented". Please name both cases here.

@@ -72,6 +72,7 @@ def __init__(self, source: Any, sample: Any, table: AnchorTable, *, directory=No
if issues := check_parquet_anchors(table):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old serving path rejected repeated sample IDs ("sample IDs must be unique", rows/samples.py). The native path copies sample_id values into the batch without a check (line 407), so two anchors with the same ID now return two samples with the same ID.

Please add the check, or say why it is not needed, and add a test.

try:
return list(
request_batches(
self._plan.with_source(source),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PreparedBatchPlan.with_source (assembly.py line 2026) has no callers after this PR. The old ServingAssembler.assemble was the only one. It is public through kumo.pytorch.api, so please remove it with its API reference entry, or say why it stays.

:param required: the table must be supplied, even as an empty list. An optional
table is never read under inference and may be left out.
:param required: whether inference reads this table.
:param routes: each way the table is reached, usually one; fetch their union.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This text still describes the removed flow ("fetch their union"). The same wording about supplying or omitting rows is at lines 150, 238, 1098 ("Rows to supply per request"), and 1146. Please update it to describe inspection only.

@nittin-murthi
nittin-murthi added this pull request to stack #529 November 25, 2026 19:53

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.

Other comments: 1

packages/experimental/kumo-pytorch/tests/helpers.py: 1

54-54: Minor · Data Integrity & Integration · Quick win

Metadata keys that match structural columns overwrite them in serving_anchors.

serving_anchors merges request metadata into the same column dictionary that holds sample, entity, and the optional time and split columns. Because SampleRequest accepts any metadata key, a key such as "entity" replaces the entity values written to Parquet. The returned AnchorTable then reads the replaced values as the entity key, so anchors can silently bind to the wrong entity.

Either reject metadata keys that collide with the structural column names before writing, or write metadata under separate physical column names and bind them through AnchorTable.metadata.

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between d3b8963 and 02becc5.

Files selected for processing: 28

  • packages/experimental/kumo-pytorch/conformance/spec/guarantees/G-KEYLESS-001/guarantee.md
  • packages/experimental/kumo-pytorch/conformance/spec/guarantees/G-SERVING-001/guarantee.md
  • packages/experimental/kumo-pytorch/conformance/spec/guarantees/G-TYPE-001/guarantee.md
  • packages/experimental/kumo-pytorch/docs/06-inference-and-serving.md
  • packages/experimental/kumo-pytorch/docs/api/README.md
  • packages/experimental/kumo-pytorch/docs/api/artifacts-and-serving.md
  • packages/experimental/kumo-pytorch/docs/limitations.md
  • packages/experimental/kumo-pytorch/e2e/README.md
  • packages/experimental/kumo-pytorch/e2e/flows/common.py
  • packages/experimental/kumo-pytorch/e2e/flows/hm_gnn.py
  • packages/experimental/kumo-pytorch/e2e/flows/hm_pragma.py
  • packages/experimental/kumo-pytorch/examples/churn/README.md
  • packages/experimental/kumo-pytorch/examples/churn/serving_request.json
  • packages/experimental/kumo-pytorch/examples/churn/walkthrough.ipynb
  • packages/experimental/kumo-pytorch/src/kumo/pytorch/engines/native_anchors.py
  • packages/experimental/kumo-pytorch/src/kumo/pytorch/preparation.py
  • packages/experimental/kumo-pytorch/src/kumo/pytorch/rows/__init__.py
  • packages/experimental/kumo-pytorch/src/kumo/pytorch/rows/samples.py
  • packages/experimental/kumo-pytorch/src/kumo/pytorch/serving.py
  • packages/experimental/kumo-pytorch/src/kumo/pytorch/serving_rows.py
  • packages/experimental/kumo-pytorch/tests/api_reference.py
  • packages/experimental/kumo-pytorch/tests/e2e/test_lifecycle.py
  • packages/experimental/kumo-pytorch/tests/helpers.py
  • packages/experimental/kumo-pytorch/tests/lifecycle_app.py
  • packages/experimental/kumo-pytorch/tests/test_inference_lifecycle.py
  • packages/experimental/kumo-pytorch/tests/test_keyless_tables.py
  • packages/experimental/kumo-pytorch/tests/test_serving.py
  • packages/experimental/kumo-pytorch/tests/test_serving_rows_drift.py
Files with no reviewable changes: 1

  • packages/experimental/kumo-pytorch/examples/churn/serving_request.json

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

This branch was previously deployed

1 inactive deployment
gha-kumo-workflow-tests — 02becc56 Deployed Nov 24, 2026 by nittin-murthi via import #3165
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Serving a DiskGraph-backed request tries to open an in-memory source

2 participants