Skip to content

Embeddings, Visually Explained

Cheatsheet of embedding fundamentals: what the vector means, the distance metrics (cosine vs dot vs euclidean), dimension tradeoffs, and the geometry everyone should see once.

An embedding is a list of numbers that places a text on a map where meaning is distance: similar texts land close together. Everything downstream — search, clustering, RAG, classification — is geometry on that map.

Reference table · 12 entries
12 of 12 rows
The mental model
vectorOne point in a high-dimensional space; typically 256–3072 dims.[0.021, -0.113, …]
similarityNearness in that space ≈ relatedness in meaning.cos(cat, dog) > cos(cat, carburetor)
context dependenceThe same word embeds differently in different sentences.'bank' ≠ 'bank'
anisotropyRaw vectors cluster in a cone — normalize before comparing.cosine instead of dot
Distance metrics
cosineAngle between vectors — the default for text; length-independent.cos = A·B / (|A||B|)
dot productCosine × lengths — equals cosine when vectors are normalized.A·B (fastest)
euclidean (L2)Straight-line distance; fine within one model, misleading across scales.√Σ(aᵢ−bᵢ)²
manhattan (L1)Sum of absolute differences; robust to outlier dims.Σ|aᵢ−bᵢ|
Practical geometry
dimensionsMore dims = more nuance, more storage, slower search.384 (small) → 3072 (large)
Matryoshka (MRL)Truncate trained embeddings to a shorter prefix, keep most quality.1536 → 256 dims
hybrid searchEmbedding similarity + keyword (BM25) beats either alone.0.6·dense + 0.4·sparse
cross-encoder rerankEmbeddings shortlist; a reranker scores pairs for the final order.top-50 → rerank → top-5