ANN Index Algorithms
Approximate nearest-neighbour (ANN) indexes trade a little recall for large gains in speed and memory over exact brute-force search. They sit inside every vector database (turbovec is one example).
Main families (FAISS terminology)
- Flat: exact brute force,
4*dbytes per vector; the recall baseline. - IVF (inverted file): k-means partitions space into
nlistcells; onlynprobecells are scanned per query. Rule of thumb from FAISS:nlistaboutC*sqrt(n). - PQ (product quantization): splits each vector into
Msub-vectors quantized tonbits, shrinking memory and allowing compressed-domain distances. IVFPQ combines both and is described by FAISS as probably the most useful structure for large-scale search. - HNSW (Malkov and Yashunin): multi-layer proximity graph, skip-list-like, logarithmic search scaling. Parameters
M,efConstruction,efSearch. Higher memory; in FAISS vectors cannot be removed after indexing.
Tuning
Measure recall@k against a flat index, then sweep efSearch or nprobe for the latency you can afford. Keep the distance metric (cosine, dot, L2) consistent with how the embedding model was trained (embedding-models).
Newer direction
Data-oblivious quantization such as TurboQuant (used by turbovec) avoids a training phase and supports online ingestion.
Related
Artificial Neural Network (a different “ANN”: neural networks, not nearest-neighbour search) · hybrid-search-and-rank-fusion · _rag-relevance-moc
Sources
- FAISS index wiki: https://github.com/facebookresearch/faiss/wiki/Faiss-indexes (accessed 2026-09-30)
- HNSW paper: https://arxiv.org/abs/1603.09320 (accessed 2026-09-30)
- turbovec repo: https://github.com/RyanCodrai/turbovec (accessed 2026-09-30)