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*d bytes per vector; the recall baseline.
  • IVF (inverted file): k-means partitions space into nlist cells; only nprobe cells are scanned per query. Rule of thumb from FAISS: nlist about C*sqrt(n).
  • PQ (product quantization): splits each vector into M sub-vectors quantized to nbits, 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.

Artificial Neural Network (a different “ANN”: neural networks, not nearest-neighbour search) · hybrid-search-and-rank-fusion · _rag-relevance-moc

Sources