← Back to Pull requests

Score neighbors in bulk: search expansion and diversity pruning #819

Closed
unknown closed this pull request without merging on Nov 25, 2026 22:34 UTC
View on GitHub
unknown unknown commented on Nov 21, 2026 00:42 UTC
Author

Fixes #818.

What

  • Bulk kernels. VectorUtilSupport gains bulk dotProduct, cosine and squareDistance(q, targets[], count, results[]), defaulting to loops over the pairwise methods. VectorUtil wraps them with the same dimension check, and VectorSimilarityFunction adds compare(q, targets, count, results).

  • Panama scores four targets per pass, which overlaps their memory loads. Each target accumulates exactly as its pairwise method does. Lengths the pairwise methods route elsewhere, and the last count % 4 targets, are scored one pair at a time.

  • Native keeps its own pairwise kernels for the bulk methods, so native scores don't change.

  • Exact search and builds (DefaultSearchScoreProvider.exact, BuildScoreProvider.randomAccessScoreProvider) score a node's unvisited neighbors with one bulk call, through main's existing ScoreFunction.similarityTo(int[], count, results) hook.

  • Vector sources. RandomAccessVectorValues.similarityTo(query, vsf, nodes, count, results) scores any source in bulk by default; shared sources are first copied into reused vectors. Custom sources gain without changes. The on-disk view reads neighbors into vectors it reuses instead of allocating one per read, the idea from #800.
  • Search results and built graphs are unchanged. Scores can differ from pairwise scoring only in their last bits, as pairwise scores already can between JIT tiers.

    Results

    At 1M vectors, warm index, never-seen queries, with identical recall throughout:

    | Dataset | Machine, JDK | Path | QPS vs main |
    |---|---|---|---|
    | glove-100 | Ice Lake (32 cores), JDK 25, Panama | in memory (list, held, copying, remapped sources) | +27% to +58% |
    | glove-100 | Ice Lake (32 cores), JDK 25, Panama | on disk | +13%; allocation 576 KB → 2.9 KB per query |
    | mpnet-1m (768 dims) | GNR (48 cores), JDK 25 | in memory | +50% Panama, +10% native |
    | mpnet-1m (768 dims) | GNR (48 cores), JDK 25 | on disk | +40% Panama, +42% native |
    | ada002-1M (1,536 dims) | Ice Lake (8 cores), JDK 22 | in memory | +48% Panama, +25% native |
    | ada002-1M (1,536 dims) | Ice Lake (8 cores), JDK 22 | on disk | +41% Panama, +59% native |

    The mpnet-1m rows and the ada002-1M in-memory row compare against main with #810; the others against main just before it.

    Builds are 14–21% faster. The broad check covered 17 datasets (25–3,072 dims), DOT/COSINE/EUCLIDEAN, JDK 22 and 25, Panama and native, and no path ran slower than main.

    Tests

  • TestBulkExactScoring: bulk scores match single scores for held, shared, copying, remapped and on-disk sources, across dimensions and similarities.

  • TestVectorizationProvider: bulk vs pairwise within summation-order rounding, on every platform. Exact equality fails on ARM and on x86 under JDK 25, because lane-reduction order depends on the JIT tier.

  • The full jvector-tests suite passes on JDK 22 and 25.
  • Diff: 362 lines (+271 / -91) across 4 files Reviewer: tlwillke Review duration: 7072m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.43) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 362 lines diff across 4 files
    0.43
    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.353
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #819"
    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: 42.6% (MEDIUM) · Higher = larger blast radius
    42.6%
    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: 18.4% · Safe to merge
    18.4%