Vector search explained: encode, normalize, compare, rank—and why ANN wins at scale
techNmak · x · 2026-10-02
A clear walkthrough of embedding-based vector search, broken into four operations: encode, normalize, compare, rank.
- Documents pass through an embedding model (all-MiniLM-L6-v2, 384-dim in the example); token reps are mean-pooled excluding padding, L2-normalized, and stored alongside passage IDs.
- Queries go through the same pipeline, so queries and docs share one embedding space.
- With unit-norm vectors, cosine similarity reduces to a dot product: score, sort, return top-k.
- At scale, exact scan cost grows linearly—one query over 1M×384 vectors means 384M coordinate multiplications—so systems use approximate nearest-neighbor indexes (HNSW, IVF) that trade some exactness for speed.
- Key caveat: vector similarity measures embedding-space closeness; it doesn't prove a retrieved passage is correct, complete, or relevant.
More from Research
- Whole-human-kidney blood flow imaging achieved with multi-lens ultrasound arrays + 3D ULM — Promptmethus · 2026-11-29
- GPU Power-Current Sensor Spots Hidden AI Training in 3 Seconds — bigdata · 2026-11-29
- Agentic GraphRAG unifies enterprise knowledge and agent memory in one traversable graph — vm324234 · 2026-11-29
- Same 80% accuracy, Brier scores 0.1961 vs 0.1600: a tiny demo of probability quality — Heavy-Confidence1826 · 2026-11-29
- Riemann Hypothesis proof condensed to 117 pages in paper rebuilt with Claude's help — birchlse · 2026-11-29
- AI agents solve 909 open math problems in 2 days on 18-year-old's Left to Solve site — julianibarz · 2026-11-29