GraphIndexBuilder: search with NEGATIVE_INFINITY, not 0.0f #814
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 366 lines diff across 4 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.353
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #814"
general
weight: 0.35
MarkWolters
Fixes #813.
What
GraphIndexBuildernow searches withFloat.NEGATIVE_INFINITYinstead of0.0finaddGraphNode(searchOneLayerfor the upper layers and the layer-0resume) and inimproveConnections: five constants.GraphSearcher.internalSearchalready does this for the same reason.For
COSINEandEUCLIDEANnothing changes, since their scores are never negative (andNaNfails>= 0.0fand>= -Infinityalike). ForDOT_PRODUCTthe scores are(1 + dot) / 2, negative for non-normalized vectors, and a0.0ffloor discarded every candidate of a node that is dissimilar to everything else.git diff mainshows only those five arguments and the comments that explain them.Results
200 x 2-d vectors around (10, 0) plus one (-10, 0),
DOT_PRODUCT, M=8, beam=40, flat, measured right after insertion (nocleanup()); the entry node is node 0 in every run:| odd vector inserted at |
main: its out-degree / mean out-degree / results of a 10-result query | this branch ||---|---|---|
| 0 (it is the entry node) | 0 / 0.00 / 1 | 5 / 4.52 / 10 |
| 25 | 0 / 3.84 / 10 | 2 / 4.42 / 10 |
| 50 | 0 / 3.84 / 10 | 5 / 4.39 / 10 |
| 100 | 0 / 3.84 / 10 | 2 / 4.21 / 10 |
The reproducer in #813 prints exactly these. When the dissimilar vector is not the entry node only that vector is affected. When it is the entry node,
mainbuilds an index with no edges at all and a search returns one result.I make no claim about reachability from the entry node: this data set is poorly connected with or without the odd vector (18 of 200 nodes reachable from the entry before
cleanup(), identically on both), which is a separate matter.Recall is unchanged on ordinary non-unit data (20,000 x 128-d clustered Gaussian, DOT_PRODUCT, M=32, beam=100, data scaled by 1.0 / 0.3 / 0.1 / 0.03): 1.0000 / 0.9997 / 0.9997 / 0.9993 on
main, 1.0000 / 1.0000 / 0.9997 / 0.9993 here.Tests
GraphIndexBuilderTest.testNodeWithOnlyNegativeSimilaritiesGetsNeighborsinserts the odd vector at positions 0, 25, 50 and 100 and asserts it has at least one neighbor right after insertion. It fails onmain("node 0 has no neighbors") and passes with this change.Also run on this branch, all passing (108 tests, 2 skipped as before):
GraphIndexBuilderTest,TestVectorGraph,TestDeletions,OnHeapGraphIndexTest,Test2DThreshold,TestHierarchyDotProductSearch,TestLowCardinalityFiltering,TestConcurrentReadWriteDeletes,TestConcurrentBufferedGraphConstruction,TestOnDiskGraphIndex,TestOnDiskGraphIndexCompactor,TestBufferedGraphCompatibility,TestGraphIndexBuilderConfig,TestNeighbors,TestPruningCompatibility,TestFusedGraphIndex. I did not run the full suite or the native module.Notes
This is independent of #805 (different lines in
GraphIndexBuilder). Callers that pass a threshold of 0 toGraphSearcher.searchthemselves are not affected by this change.