From 5c92c5c1ee744545a77f6be9f14d4fdccaad7869 Mon Sep 17 00:00:00 2001 From: Alibek Zhakubayev Date: Mon, 18 May 2026 15:44:59 -0700 Subject: [PATCH] Fix flaky test_hnsw smoke test by increasing efSearch (#5222) Summary: Pull Request resolved: https://github.com/facebookresearch/faiss/pull/5222 test_wheel_smoke::TestIndexFactory::test_hnsw assumes HNSW returns the query vector itself as the nearest neighbor, but the default efSearch (16) is too low to guarantee self-retrieval on 2000 random vectors in d=64. This caused intermittent failures on macOS CI. Set efSearch=64 so the search explores enough of the graph to find exact matches reliably. ___ overriding_review_checks_triggers_an_audit_and_retroactive_review Oncall Short Name: faiss Differential Revision: D105621052 fbshipit-source-id: 80ccd2ec5aecfb88d2fad780449bfb49d5d18db5 --- tests/test_wheel_smoke.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_wheel_smoke.py b/tests/test_wheel_smoke.py index 5697fe236..2faca2f0f 100644 --- a/tests/test_wheel_smoke.py +++ b/tests/test_wheel_smoke.py @@ -101,6 +101,7 @@ class TestIndexFactory(unittest.TestCase): np.random.seed(42) xb = np.random.random((n, d)).astype("float32") index = faiss.IndexHNSWFlat(d, 16) + index.hnsw.efSearch = 64 index.add(xb) assert index.ntotal == n D, I = index.search(xb[:5], 10)