Approximate Nearest Neighbor (ANN)
Approximate nearest neighbor is a family of algorithms that quickly find the embeddings most similar to a query without checking every item, making large-scale semantic search fast enough to be practical.
Also known as: ANN
ANN is how semantic search stays fast at scale. Comparing a query against every one of billions of embeddings would be far too slow, so approximate nearest neighbor algorithms cleverly narrow the search to the most promising candidates — trading a tiny bit of exactness for enormous speed. It's the core trick inside every vector database.
It's deep infrastructure with one indirect AEO consequence: because retrieval is approximate, being a clear, strong semantic match matters even more. A passage that's an obvious, high-similarity match is reliably found, while a borderline one can be missed by the approximation. Decisive, focused, extractable writing keeps you safely inside the shortlist.
Example. A search across a billion passages uses ANN to consider only a few thousand likely candidates rather than all billion — returning results instantly. A clearly on-topic passage is almost certain to make that shortlist; a marginal one might not.
Relevant pillar
Related terms
- Vector DatabaseA vector database stores content as embeddings and is optimized to quickly find the items whose vectors are most similar to a query, powering semantic retrieval at scale.
- Cosine SimilarityCosine similarity is a math measure of how alike two embeddings are based on the angle between them, and is the common way retrieval systems score how relevant a passage is to a query.
- Vector SearchVector search is a retrieval method that finds passages by meaning rather than keywords, comparing the numeric embedding of a query against the embeddings of indexed content to surface the closest matches.