Vector search / approximate nearest neighbors — main algorithms.
mediumAnswer
- (1) HNSW (Hierarchical Navigable Small World): graph-based, dominant in industry (Qdrant, Weaviate, pgvector).
- (2) IVF-PQ (inverted file + product quantization): FAISS default for very large indexes.
- (3) ScaNN (Google): partition + reranking.
- (4) LSH (locality-sensitive hashing): older, still used for near-duplicate detection.
- Trade-off: recall vs latency vs memory.
- HNSW default for < 10M vectors; IVF-PQ for > 100M.
Check yourself — multiple choice
- Just brute force
- HNSW (graph, default < 10M) / IVF-PQ (FAISS large-scale > 100M) / ScaNN (Google) / LSH (near-duplicate); recall vs latency vs memory tradeoff
- Random
- Only tree
ANN: HNSW / IVF-PQ / ScaNN / LSH; HNSW default, IVF-PQ at scale.
#nlp#applications
Practise Unsupervised Learning
214 interview questions in this topic.
Related questions
- BM25 — why is it still competitive with modern retrievers?
- How is RAG retrieval an unsupervised problem?
- Applications of clustering in NLP.
- How do you cluster / retrieve code snippets?
- Interview: users complain search returns irrelevant results — how do you fix?
- Interview: choose a sentence embedding model for a startup RAG.