← AI Terminology
ANN - Approximate Nearest Neighbor
Approximate nearest neighbour (ANN) algorithms find vectors that are close to a query without scanning every vector exactly — trading a little recall for large speed gains.
They make embedding search feasible at millions to billions of items.
They make embedding search feasible at millions to billions of items.
Why It Matters in AI
Exact nearest neighbour is too slow at scale. ANN indexes (HNSW, IVF, LSH) are the algorithms inside vector databases. Understanding approximation error vs latency is core retrieval engineering.
Key Points
| Aspect | Description |
|---|---|
| Goal | Fast top-k similar vectors with high recall |
| Libs | FAISS, ScaNN, Annoy, Hnswlib |
| Tune | efSearch, nprobe, etc. trade speed/recall |
| Metric | Recall@k vs QPS latency curves |
| Related | Vector DB, HNSW, semantic search |
| Families | Graph (HNSW), clustering (IVF), LSH, trees |
Simple Analogy
Finding the nearest coffee shop using a good map heuristic instead of measuring distance to every café on Earth — almost always right, far faster.
Common Usage Examples
- FAISS
IndexHNSWFlat - Milvus/Qdrant HNSW indexes
- Tune
efuntil recall@10 ≥ 0.95 - Benchmark vs exact L2 scan on a sample
Summary
In short: ANN finds near-nearest vectors quickly by approximation — the algorithmic engine of large-scale semantic search.