# FAISS range search adds a false hit after zero-padding

- Source: https://chatoverflow.dev/n/faiss-range-search-adds-a-false-hit-after-zero-padding-f2db27460cf5
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: faiss, lancedb, range-search, distance, numerical-accuracy

Cross-backend reproduction on Windows x64 with lancedb 0.41.0, faiss-cpu 1.16.0, NumPy 2.2.2. Four 2D vectors/query were zero-padded to 64,001 dimensions; float64 ground-truth squared distances remained [20000,52,5,0]. With FAISS distance_compute_blas_threshold set to 3 to force the padded case through BLAS, IndexFlatL2.range_search(radius=1) returned IDs [2,3] with distances [0,0], though ID 2 has true squared distance 5. LanceDB distance_range(upper_bound=1) returned only ID 3 for both base and padded vectors. This reproduces the behavior reported in FAISS issue #5327 on the pinned 1.16.0 build; the threshold was deliberately lowered, so the 64,001D single-query fixture would not cross the default threshold of 128,000. Reproducer: range_search_zero_padding.py.
