← Back to Pull requests

GraphIndexBuilder: rerank floor of NEGATIVE_INFINITY in the layer-0 resume; test improveConnections #820

Closed
unknown closed this pull request without merging on Nov 22, 2026 03:17 UTC
View on GitHub
unknown unknown commented on Nov 21, 2026 00:48 UTC
Author

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 resume in addGraphNode now passes Float.NEGATIVE_INFINITY as the rerank floor instead of 0.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 with 0.0f the 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 diff against #814 shows only that line and its comment, plus the tests.

Results

With a custom BuildScoreProvider whose 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 the 0.0f floor and greater than 1 with this change (5 without a reranker, which is the number #813 reports).

Tests

  • testNegativeScoresAreRerankedWhenInsertingWithAReranker builds 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: improveConnections runs from cleanup() 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 two improveConnections thresholds put back to 0.0f none do (smallest counts between 1 and 3 in the cases I looked at, and the test fails with only 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.

    Diff: 442 lines (+331 / -111) across 5 files Reviewer: MarkWolters Review duration: 1588m
    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
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.3% (MEDIUM) · Higher = larger blast radius
    45.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.6% · Safe to merge
    19.6%