GraphIndexBuilder: rerank floor of NEGATIVE_INFINITY in the layer-0 resume; test improveConnections #820
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.45) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 442 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.365
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #820"
general
weight: 0.35
MarkWolters
Fixes #817. Stacked on #814 (approved, not yet merged): the first three commits here are #814's and drop out once it lands, when I will rebase. I did not push to #814's branch, since that would invalidate its approval.
What
1. The layer-0
resumeinaddGraphNodenow passesFloat.NEGATIVE_INFINITYas the rerank floor instead of0.0f(the fourth argument; the threshold was already fixed in #814). A score provider with a reranker only reranks candidates at or above the floor, so with0.0fthe candidates with a negative approximate score were not reranked: if none were above the floor only the single best candidate was reranked and kept. No built-in build score provider has a reranker, as the issue says; a custom one does. One line plus a comment.2. Two tests (below).
git diffagainst #814 shows only that line and its comment, plus the tests.Results
With a custom
BuildScoreProviderwhose search providers carry a reranker, 200 x 2-d vectors around (10, 0) plus one (-10, 0) at position 50,DOT_PRODUCT, M=8, beam=40: the odd vector's out-degree right after insertion is 1 with the0.0ffloor and greater than 1 with this change (5 without a reranker, which is the number #813 reports).Tests
testNegativeScoresAreRerankedWhenInsertingWithARerankerbuilds that graph and asserts the odd vector gets more than one neighbor. It fails on #814's code (node 50 has 1 neighbors) and passes with this change.testImproveConnectionsRefinesUpperLayerNodeWithOnlyNegativeSimilarities:improveConnectionsruns fromcleanup()on the upper-layer nodes of a hierarchical graph. The same dissimilar vector is inserted at five positions where it lands in layer 1 or above (layers depend only on the builder's seeded generator and the insertion order, and the test asserts the layer), with single-thread pools so the build is deterministic. Refinement is judged by the smallest neighbor count the vector ends up with in any of its layers; the test requires at least 4 of the 5 builds to reach 4 or more, so it does not hinge on one graph. With #814's fix all five do (smallest counts 8, 7, 6, 5, 5 at positions 71, 72, 85, 87 and 138 in my runs); with only the twoimproveConnectionsthresholds put back to0.0fnone do (smallest counts between 1 and 3 in the cases I looked at, and the test fails withonly 0 of 5 builds refined the node). Repeated builds on this machine give identical graphs.I could not find an assertion that is both absolute and independent of the exact graph: totals shift in the expected direction (more edges with the fix in 169 of 201 insertion positions, none empty either way) but are not a threshold. The test depends on the dot-product decisions the builder makes, so on very different hardware the margin could shrink; the 4-of-5 rule and the margin above (5 of 5 against 0 of 5) are meant to absorb that.
Also run on this branch, all passing (116 tests, 2 skipped as before):
GraphIndexBuilderTest,TestVectorGraph,TestDeletions,OnHeapGraphIndexTest,Test2DThreshold,TestHierarchyDotProductSearch,TestLowCardinalityFiltering,TestConcurrentReadWriteDeletes,TestConcurrentBufferedGraphConstruction,TestOnDiskGraphIndex,TestOnDiskGraphIndexCompactor,TestBufferedGraphCompatibility,TestGraphIndexBuilderConfig,TestNeighbors,TestPruningCompatibility,TestFusedGraphIndex,TestBuildScoreProviderAnchorReads,TestBuildScoreProviderBorrowedVectors. I did not run the full suite, the native module, or other JDKs.