Make the tryClosestCentroid assertion cheap #834
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 185 lines diff across 2 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.313
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #834"
general
weight: 0.35
MarkWolters
Some users run JVector with
-eain production, so hot-path assertions must be cheap. With-ea,VectorUtil.tryClosestCentroidrescanned every centroid through the vector provider on each call. With the native provider that is billions of extra calls during PQ encoding and k-means.Now each call checks only the selected distance, in plain Java, which also catches a non-finite point. Centroids are checked once when they are built: k-means checks them in its constructor and once per iteration. Codebooks come only from k-means or from a saved index, so the PQ constructor adds no check of its own.
TestPQClosestCentroidnow tests the k-means check and the per-call check.One difference: if finite inputs overflow to an infinite distance for a centroid that isn't chosen, native no longer fails under
-ea, while the fallback loops still do. This can't change the chosen centroid.A scan of every assertion in
jvector-base,jvector-twentyandjvector-nativefound no other hot-path assertion that repeats its work.CONTRIBUTIONS.mdnow states the rule.Testing (Ice Lake, 8 cores,
-ea):TestMutableASHVectorsfailures that also occur on main.