ann (approximate nearest neighbors)
ANN (Approximate Nearest Neighbors) algorithms trade exact accuracy for dramatically faster search in high-dimensional spaces. **The problem**: Exact k-NN requires comparing query to all vectors - O(N) per query. Infeasible at scale. **Approximation**: Accept that returned neighbors might not be the true k closest, but are very close. Much faster. **Quality measure**: Recall@k - fraction of true k nearest neighbors found by approximate method. 95%+ common target. **Major approaches**: **Graph-based (HNSW)**: Navigate proximity graph. Best accuracy/speed. **Tree-based (Annoy)**: Random projection trees. Simple, efficient. **Hashing (LSH)**: Locality-sensitive hashing. Probabilistic. **Clustering (IVF)**: Partition space, search relevant clusters. **Quantization (PQ)**: Compress vectors, approximate distances. **Speed gains**: Milliseconds instead of seconds for million-vector search. Orders of magnitude improvement. **Trade-offs**: Each method has different accuracy/speed/memory characteristics. Index building time varies. **Tuning**: Parameters control accuracy vs speed. More compute at query time = higher recall. **Choice depends on**: Dataset size, dimensionality, memory constraints, latency requirements, update frequency. Foundation for modern vector search systems.