Score neighbors in bulk: search expansion and diversity pruning #819
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
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 #819"
general
weight: 0.35
tlwillke
Fixes #818.
What
VectorUtilSupportgains bulkdotProduct,cosineandsquareDistance(q, targets[], count, results[]), defaulting to loops over the pairwise methods.VectorUtilwraps them with the same dimension check, andVectorSimilarityFunctionaddscompare(q, targets, count, results).count % 4targets, are scored one pair at a time.DefaultSearchScoreProvider.exact,BuildScoreProvider.randomAccessScoreProvider) score a node's unvisited neighbors with one bulk call, through main's existingScoreFunction.similarityTo(int[], count, results)hook.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.jvector-testssuite passes on JDK 22 and 25.