You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Test TestCagraToHnswSerializationAndSearch fails intermittently in CI #3082
Describe the bug
The test TestCagraToHnswSerializationAndSearch fails intermittently its recall assertion with a fixed seed AE135E2A8E29E166:B76BE3D67B11916A:
5 results were not among the closest 15, at most 4 allowed:
query 1: ids [42, 723, 1730, 1500, 866] at ranks [17, 21, 23, 27, 28]
Steps/Code to reproduce bug
To produce this bug on an isolated environment,
Check out 7a3f538c and prepare the Lucene test environment as CI does.
Install the plain cuvs-java JAR into the local Maven repository, restore the lucene-10.5/target directory from the CI artifact, and add the directory containing the matching libcuvs_c.so to LD_LIBRARY_PATH. CI setup, build artifacts
I was able to reproduce it. I ran a few experiments and I am pretty sure it was introduced by #2031. One way to fix it would be by recalibrating the check, but the test might be indicating recall drop that this test was actually trying to verify, so I am not sure that's the right approach here. @achirkin, any thoughts on this?
The variable degree logic removes a lot of nodes from the graph. In the build heuristics, we set it to an aggressive value 0.35 and compensate it by increasing the maximum number of nodes in the final graph. So what we see here looks like a flaky test: pre-variable-degree we may have set a bit too optimistic parameters; once we changed the logic, the graph quality decreased naturally, but the tests remained to keep the high bar.
I think it makes sense to reduce the quality threshold or, perhaps, set this threshold dynamically by running CPU hnsw and comparing its results against brute force (i.e. CAGRA-built graph should be no worse than 95% of the quality of HNSW-built graph)?
In perspective of test, let's keep the current quality bar for 1.0 or some high fraction numbers, which help validate future changes.
For more aggressive lower value, we should recalibrate the number and add respective thresholds into the test case list.
I ran the test with different fraction values and here is the result:
Setup
Commit: 9606988
Software: CUDA 12.9, Lucene 10.5.2, and Java 22
Hardware: RTX PRO 6000 Blackwell Server Edition on Linux x86-64
Test: sweep from 0.35 to 1.00 with 50 fresh graph builds per fraction and a graph capacity of 64 neighbors per node. All 450 runs used the same 2,000 32-dimensional vectors and ten top-5 Euclidean queries, generated with seed AE135E2A8E29E166:B76BE3D67B11916A.
Metrics:
Exact recall@5 measures how many of the 50 returned neighbors were in their query’s brute-force top five.
Top-15 misses count returned neighbors outside their query’s brute-force top 15. The sweep’s assertion passed with at most four misses across all 50 results.
Mean outgoing degree measures the actual directed edges per node in the reopened graph.
Result:
Recall increases as the fraction increases
Number of misses decreases as the fraction increases
Activity
mc8max commentedon Nov 17, 2026
Hi @imotov, the Lucence test fails in current CI into main branch. Have you seen this issue before?
imotov commentedon Nov 17, 2026
I was able to reproduce it. I ran a few experiments and I am pretty sure it was introduced by #2031. One way to fix it would be by recalibrating the check, but the test might be indicating recall drop that this test was actually trying to verify, so I am not sure that's the right approach here. @achirkin, any thoughts on this?
mc8max commentedon Nov 19, 2026
Hi @imotov, @achirkin, I double checked when setting variable_graph_degree_fraction=1.0:
Then the fraction is 0.35, this recall is around 65-70% on passing repetitions, and 0% on some failed runs.
The original #2031 mentioned default faction is 1.00 as default value, which is no-longer the case here.
So I guess, in short-term, we either do:
and in long-term:
Currently, I think any new PRs to main branch fails the same test.
achirkin commentedon Nov 19, 2026
The variable degree logic removes a lot of nodes from the graph. In the build heuristics, we set it to an aggressive value 0.35 and compensate it by increasing the maximum number of nodes in the final graph. So what we see here looks like a flaky test: pre-variable-degree we may have set a bit too optimistic parameters; once we changed the logic, the graph quality decreased naturally, but the tests remained to keep the high bar.
I think it makes sense to reduce the quality threshold or, perhaps, set this threshold dynamically by running CPU hnsw and comparing its results against brute force (i.e. CAGRA-built graph should be no worse than 95% of the quality of HNSW-built graph)?
achirkin commentedon Nov 19, 2026
Also worth mentioning #3046 and #3067 may improve the situation here
mc8max commentedon Nov 19, 2026
In perspective of test, let's keep the current quality bar for 1.0 or some high fraction numbers, which help validate future changes.
For more aggressive lower value, we should recalibrate the number and add respective thresholds into the test case list.
mc8max commentedon Nov 20, 2026
I ran the test with different fraction values and here is the result:
Setup
Commit: 9606988
Software: CUDA 12.9, Lucene 10.5.2, and Java 22
Hardware: RTX PRO 6000 Blackwell Server Edition on Linux x86-64
Test: sweep from
0.35to1.00with 50 fresh graph builds per fraction and a graph capacity of 64 neighbors per node. All 450 runs used the same 2,000 32-dimensional vectors and ten top-5 Euclidean queries, generated with seed AE135E2A8E29E166:B76BE3D67B11916A.Metrics:
Result:

Recall increases as the fraction increases
Number of misses decreases as the fraction increases
