Skip to content

test: hnsw recall@10 test flakes on CI (0.58-0.65 vs ~0.98) — parallel_insert makes the graph nondeterministic #302

Closed

Description

@jsam

hnsw_index::tests::test_hnsw_recall_at_10_on_3000_random_vectors (src/hnsw_index_tests.rs:82) sometimes fails on CI with recall far below its 0.95 bar. Each run's recall varies even though the data seeds are fixed.

Evidence

The data uses seed 42 (3000 rows, dim 32) and the queries use seed 4242 (100 queries). m=16, ef_construction=200, ef_search=64, cosine distance.

CI failures:

Local runs (debug, dev box), 20 runs isolated and 20 runs with 5 copies at once:

commit failures recall range
origin/main 0a0fdaf 0/40 0.978-0.994
fm/fix-parser-depth 54f5173 0/40 0.976-0.995

Likely cause

HnswIndex::build inserts with hnsw_rs parallel_insert (src/hnsw_index.rs:107). That makes the graph depend on thread scheduling, so recall varies even with fixed data. On a loaded CI runner, an occasional build produces a much worse graph. Usual recall is about 0.98; the bad builds dropped to 0.58-0.65.

Options

  • Build the test index deterministically (serial insert) and keep the 0.95 bar.
  • Find out why some parallel builds come out degenerate. A 0.58 recall at ef_search=64 may point to a real build-quality problem under contention, not just test noise.

The test was not weakened in PR 295.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions