feat: allow training results to create multiple writers #87
All Vouch review confidence checks passed
Residual risk 0.28 = Change Risk (0.50) × (1 − Review Confidence (0.45)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 369 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 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.354
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #87"
general
weight: 0.35
wangzhigang1999
Summary
Allow one completed
VectorIndexTrainingto create multiple independent writers. Callers building several segment or file indexes from the same data distribution can train once and reuse the trained centroids, quantizers, and rotations instead of repeating training for every writer.The existing consuming APIs remain unchanged for one-shot callers. Reusable writer creation is explicit and opt-in.
Closes #86.
Changes
VectorIndexTraining::create_writer()for IVF-Flat, IVF-SQ, IVF-PQ, IVF-RQ, and DiskANN.Benchmark
Release-mode synthetic benchmark on an Intel Xeon Platinum 8575C host with 32 logical CPUs and 60 GiB RAM. The workload used 128-dimensional vectors, 64 IVF lists, 8,192 training rows, eight segments, and 2,048 vectors per segment.
retraintrains separately for every segment;reusetrains once and creates eight writers. The table reports the median of three alternating process runs.| Index | Prepare: retrain -> reuse | Speedup | Full build: retrain -> reuse | Speedup |
| --- | ---: | ---: | ---: | ---: |
| IVF-Flat | 112 -> 18 ms | 6.2x | 138 -> 33 ms | 4.2x |
| IVF-SQ | 123 -> 20 ms | 6.2x | 140 -> 27 ms | 5.2x |
| IVF-PQ | 1,355 -> 173 ms | 7.8x | 1,384 -> 194 ms | 7.1x |
| IVF-RQ | 109 -> 16 ms | 6.8x | 132 -> 28 ms | 4.7x |
| DiskANN | 1,240 -> 161 ms | 7.7x | 1,485 -> 407 ms | 3.6x |
The preparation measurement isolates training and writer creation. The full-build measurement also adds and serializes all segment vectors. Serialized output sizes were unchanged for each index type. This benchmark measures the removal of repeated training work; it does not claim an index-algorithm speedup.
Testing
cargo fmt --all -- --checkcargo test --workspace --locked(487 passed, 2 ignored)cargo clippy --all-targets --workspace --locked -- -D warnings -A clippy::chunks-exact-to-as-chunksThe Clippy allow is limited to the
chunks_exact_to_as_chunkslint newly enabled by Rust 1.98; strict Clippy currently reports it at 28 unchanged locations onmain. No call site introduced by this PR requires the allow.Compatibility