You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On the native DiskGraph batch path, entity value Field columns that are already materialized into the enriched anchors are no longer added to the entity table's projections. Batches read those values from the anchor columns, and _direct_entity_arrays already skips them, so decoding them for every seed was unused work.
NativeAnchors.batches computes the list of non-materialized entity Field columns once and reuses it for the graph projections and for the typed-batch projections.
Entity value columns that are not materialized are still projected. Graph node_fields on the entity table are unchanged.
No output changes: on the benchmark below, a hash of every batch's output matched with and without this change.
Change map: see the kumo-pr-change-map comment on this PR.
Testing Done
Environment: Linux x86_64, Python 3.12, diskgraph built from this tree, kumo-pytorch installed editable from this tree.
New regression test: pytest packages/experimental/kumo-pytorch/tests/test_native_anchor_handoff.py -k test_materialized_entity_fields_skip_projection_and_keep_graph_reuse. It checks that a materialized entity Field is absent from every projection passed to the native iterator, and that graph topology is reused rather than sampled again. It fails on main and passes here.
Broader native/materialization run across 12 kumo-pytorch test files: 380 passed, 1 skipped.
ruff check and ruff format --check (0.17.3) on the touched files: clean.
Benchmark (synthetic 200k-entity table with 8 static columns, native model batches):
Per batch
Per epoch
main
~5.3–5.5 ms
baseline
This PR
~4.5 ms
~15% faster
Output hash was identical across both runs.
Not tested: GPU training, multi-process (world_size > 1) runs on real hardware, and the kumo-engine wheel smoke suite. The change only removes columns that no consumer reads, and the unchanged _feature_arrays path falls back to a direct fetch if a projected column is ever missing.
Checklist
I listed all the breaking changes introduced by the PR (none)
I made sure to update examples and documentation with my changes (if necessary) (not needed)
I have added and modified unit tests required to cover changes made by this PR.
Native batches read materialized entity values from the enriched anchor
columns, so decoding the same entity-table columns for every seed was
unused work. Project an entity value column only when it is not
materialized.
Co-Authored-By: Claude <[email protected]>
Computes the non-materialized entity Field columns once (entity_columns) and extends the entity table projections with that list in both the graph-projection and typed-batch branches, instead of appending every entity Field column.
Columns already in _materialized_values.features are read from the enriched anchors, so projecting them decoded unused data for every batch.
New test: one materialized entity Field with a graph input, spies on the native iterator projections and forbids graph resampling.
Checks the materialized column is never projected and that native graph reuse (_anchor_neighborhood) still holds.
Problem: with materialized entity values, every native batch decoded entity-table columns that no consumer reads (~15% of epoch time on a synthetic 200k-entity, 8-column table).
Existing behavior:_direct_entity_arrays and the temporal plan already skip materialized entity values, but NativeAnchors.batches still added their columns to the projections.
Smallest change: filter the projected entity columns by the same materialized-feature keys. Non-materialized entity values and graph node_fields are projected as before.
Focused check: the new test fails on main and passes here. test_native_anchor_handoff.py and test_materialized_native_batches.py pass, and the benchmark output hash is unchanged.
Stop: projection selection only. Batch assembly, sampling plans and the fallback request path are unchanged.
Native batching now excludes direct entity fields from entity-table projections when those fields are already present in materialized features. A test checks this behavior for the score field and verifies batching across train and valid.
Merge Risk: Minimal · up to 6709c
This is a narrow performance optimization that skips projecting entity columns already supplied by materialized features. No concrete correctness risk was found. A test could additionally assert the returned score values.
Security architecture risk: Minimal · up to 6709c
The change avoids reading entity columns whose values already come from materialized anchors. Other entity fields, graph features, and graph identity projections remain available. The inspected change establishes no introduced or worsened security or failure-containment risk.
Pre-merge checks: 2 · 1
Failed checks: 1 inconclusive
Check name
Status
Explanation
Resolution
Change Map Design Review
The check reviews the PR conversation comment that starts with <!-- kumo-pr-change-map -->. That comment is not in the supplied context. The review comments section lists no CodeRabbit threads. The …
To complete this check, supply the text of the PR conversation comment that begins with <!-- kumo-pr-change-map --> (PR #381). Then re-run the check. The review will test the table's rows against the diff in `native_anch…
Passed checks: 2 passed
Check name
Status
Explanation
Pr Size
The PR changes 2 files, below the threshold of 40. git diff --name-status between the review base and head lists two modified files: `packages/experimental/kumo-pytorch/src/kumo/pytorch/engines/nati…
Public Resource Access
The check applies only to external resource references (URLs, repository locations, package source locations) that this PR adds or modifies. The PR changes two files: `packages/experimental/kumo-pytor…
Full details: Pr Size
Explanation
The PR changes 2 files, below the threshold of 40. git diff --name-status between the review base and head lists two modified files: packages/experimental/kumo-pytorch/src/kumo/pytorch/engines/native_anchors.py and packages/experimental/kumo-pytorch/tests/test_native_anchor_handoff.py. No renames or additions appear. Per the check, line counts are ignored, and the file count does not exceed 40, so the check passes.
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. The PR changes two files: packages/experimental/kumo-pytorch/src/kumo/pytorch/engines/native_anchors.py (+8/-6) and packages/experimental/kumo-pytorch/tests/test_native_anchor_handoff.py (+47). I read every added line of the diff against the pre-merge-check base. None contains an http(s):// URL, a git+/git@ source, a GitHub/PyPI reference, an index URL, or a find-links location. The added code consists of Python identifiers, a filtered column list in NativeAnchors.batches, and a regression test that writes a local parquet fixture under tmp_path. Local fixtures are excluded by the check. The PR description contains a reference to a kumo-pr-change-map comment, but that text is in the PR body, not in the changed files, so it is not a changed repository reference. With no added or modified external reference, the check passes.
Full details: Change Map Design Review
Explanation
The check reviews the PR conversation comment that starts with <!-- kumo-pr-change-map -->. That comment is not in the supplied context. The review comments section lists no CodeRabbit threads. The PR description only refers to it as "the kumo-pr-change-map comment on this PR". A search of the checkout found the marker only in docs/development/review.md, which describes the convention and does not contain the comment. Without the comment text, I cannot check its Change map rows, its stated failure or observed problem, its verification, or its stopping condition. Code evidence from the PR diff (context only, not a verdict on the table): - native_anchors.py computes entity_columns once. It keeps direct Field entity values with no path whose key is not in _materialized_values.features. Both projection paths then extend with that list. - diskgraph.py:1037 (_direct_entity_arrays) already skips the same materialized feature names. This supports the PR's claim that the projection was unused work. - The diff does not change the _feature_arrays fallback. Whether a missing projected column is handled safely was not verified here. - The PR adds one regression test, test_native_anchor_handoff.py. I did not read it. I did not confirm any design defect in the code.
Resolution
To complete this check, supply the text of the PR conversation comment that begins with <!-- kumo-pr-change-map --> (PR #381). Then re-run the check. The review will test the table's rows against the diff in native_anchors.py and the test in test_native_anchor_handoff.py. It will also check that diskgraph.py:_direct_entity_arrays and the _feature_arrays fallback match the stated behavior.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
These assertions check sample count and projection omission, but they do not check the returned score values. The test can pass if batching assigns incorrect scores.
Compare scores by sample ID. Samples a, b, and f must have 0.5; samples c, d, and g must have 1.5. This directly checks that removing the projection preserves entity values.
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On the native DiskGraph batch path, entity value
Fieldcolumns that are already materialized into the enriched anchors are no longer added to the entity table's projections. Batches read those values from the anchor columns, and_direct_entity_arraysalready skips them, so decoding them for every seed was unused work.NativeAnchors.batchescomputes the list of non-materialized entityFieldcolumns once and reuses it for the graph projections and for the typed-batch projections.node_fieldson the entity table are unchanged.Change map: see the
kumo-pr-change-mapcomment on this PR.Testing Done
Environment: Linux x86_64, Python 3.12,
diskgraphbuilt from this tree,kumo-pytorchinstalled editable from this tree.pytest packages/experimental/kumo-pytorch/tests/test_native_anchor_handoff.py -k test_materialized_entity_fields_skip_projection_and_keep_graph_reuse. It checks that a materialized entityFieldis absent from every projection passed to the native iterator, and that graph topology is reused rather than sampled again. It fails onmainand passes here.pytest packages/experimental/kumo-pytorch/tests/test_native_anchor_handoff.py packages/experimental/kumo-pytorch/tests/test_materialized_native_batches.py: 48 passed.ruff checkandruff format --check(0.17.3) on the touched files: clean.Benchmark (synthetic 200k-entity table with 8 static columns, native model batches):
mainOutput hash was identical across both runs.
Not tested: GPU training, multi-process (
world_size > 1) runs on real hardware, and the kumo-engine wheel smoke suite. The change only removes columns that no consumer reads, and the unchanged_feature_arrayspath falls back to a direct fetch if a projected column is ever missing.Checklist
🤖 Generated with Claude Code