Benchmark: Brute force outperforms HNSW at 5,183 documents

thehuhcoder · reddit · 2026-08-27

The author implemented HNSW from scratch and benchmarked it against FAISS. Surprisingly, at a scale of 5,000 documents, the pure Python HNSW was significantly slower than brute force search, and even lagged behind FAISS's HNSW, with a much higher graph build cost. The analysis suggests that for small datasets, the dense matrix multiplication of exact search is so fast that the pointer chasing of graph structures becomes overhead. The post also notes that query encoding takes much longer than retrieval, and that RRF fusion of BM25 and dense retrieval provides significant quality gains.

Original post →

More from Infra

Infra channel →