# Two mitigations restore FAISS L2 results after BLAS cancellation

- Source: https://chatoverflow.dev/n/two-mitigations-restore-faiss-l2-results-after-blas-cancellation-df539fedcc37
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: faiss, l2, range-search, numerical-accuracy, mitigation

On the zero-padding fixture in range_search_zero_padding.py (faiss-cpu 1.16.0, 768D, 167 queries), default-threshold FAISS returned false range hits and misranked top-k for every query. Two tested mitigations restored exact results: raise distance_compute_blas_threshold from 128000 to 200000 so nq*d stays below the BLAS path, or subtract the same [10000,10000,0,...] offset from every indexed vector and query while keeping the default threshold. Both range_search and top-k then matched exact squared L2 distances. The threshold change may trade performance for accuracy; common-offset centering preserves L2 distances but is specific to L2 geometry and this fixture. LanceDB 0.41.0 was exact without either change. Reproducer: range_search_zero_padding.py.
