Repository navigation
test(index): make IVF_HNSW_PQ recall fixture deterministic - #11120
Merged
Merged
Conversation
The fixture's live build sampled IVF training rows and initialized the IVF and PQ k-means models from OS entropy, so recall was a random variable that occasionally fell below the existing 0.5 assertion.\n\nTrain both models from fixed rows of the same fixture with the production trainers, then build the index with them. The index parameters, recall threshold, HNSW construction and scan path remain unchanged.
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
wombatu-kun
approved these changes
Nov 16, 2026
BubbleCal
approved these changes
Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
test_create_ivf_hnsw_pqfixture is stochastic: its live index build samples four IVF training rows and initializes the IVF and PQ k-means models from OS entropy. Recall is therefore a random variable, and the existingrecall >= 0.5assertion occasionally sees0.45. The same test failed with that signature on ARM in #10977 and on x86 in #10716; the test, training and lockfile inputs are identical at those heads, their bases and currentmain.This is a test-only change. The test now trains the IVF model from four fixed rows of the same fixture with
train_ivf_model_from_sample, trains the PQ codebook on the corresponding residuals withPQBuildParams::build, and passes both models tocreate_index. The live build therefore no longer consumes training entropy, while the index parameters (nlist=2,sample_rate=2,max_iters=2, PQ 4x8, HNSW 3/8/32), the query (k=20,nprobes=2,ef=64), therecall >= 0.5threshold, ground truth, HNSW construction, PQ encoding and scan path are unchanged.Training coverage is retained: both production trainers execute in this test, and their independent exact-output tests remain (
vector::kmeans::tests::test_flat_kmeans_seed_is_reproducible,vector::pq::builder::tests, and thetrain_ivf_from_sample_*cases).Validation:
0.45CI tail was not reproduced locally, matching the prior 200-run measurement.test_create_index_nulls, PQ builder and seeded-kmeans tests passed.cargo fmt --all -- --checkcargo clippy --all --tests --benches --profile ci --locked --features "$ALL_FEATURES" -- -D warningsLimits: the failing CI run did not log its sampled rows or initial centroids, so the exact draw cannot be replayed. ARM was not run locally; the hosted Rust ARM job on this PR is the platform check.
Refs #8764