Is Cosine Similarity Dead? - by Rafael Pierre
Lighthouse AI
SubscribeSign in
Cosine Similarity is Dead. Long Live Cosine Similarity.<br>It’s all normal
Rafael Pierre<br>Oct 27, 2025
Share
Cosine similarity ranks embeddings by the angle between them — but the metric quietly breaks down without proper normalisation.<br>Back in college, I sat through endless lectures about eigenvectors, matrix decompositions, and vector spaces. I dutifully memorized formulas for exams, promptly forgot them, and thought: “When will I ever use this?”<br>Fast forward to 2025. That useless linear algebra is now the foundation of how we search through billions of documents, understand meaning, and make AI systems actually useful.<br>Why Everyone Suddenly Cares About Vectors
If you’ve built anything with RAG (Retrieval-Augmented Generation) in the last two years, you’ve heard the pitch: “Turn your text into embeddings, then search semantically!”<br>But what ARE embeddings, really?<br>Think of embeddings as coordinates in meaning-space. Every word, sentence, or document gets converted into a list of numbers (a vector) that captures its semantic essence.<br>“cat” = [0.2, 0.8, 0.1, 0.4, ...] (hundreds or thousands of numbers)<br>“kitten” = [0.19, 0.79, 0.09, 0.41, ...] (very close!)<br>“car” = [0.7, 0.1, 0.9, 0.2, ...] (far away)Words with similar meanings get similar coordinates. It’s like GPS, but for concepts.<br>Why this matters for RAG
Traditional keyword search is dumb - at least that’s what you’ve probably heard many times. If you search for “automobile” and the document says “car,” you get nothing.<br>Embeddings allow us to be smart. Our search pipeline can suddenly match “automobile” with “car”, given that both sit in the same spot in meaning-space. So when you search, you find what you meant, not just what you said.<br>This is why every RAG system worth its salt uses embeddings. They’re the difference between “404 Not Found” and “Here’s exactly what you need.”
Subscribe and get weekly insights on building AI, with AI
Subscribe
The Tale of Two Similarity Metrics
So you’ve got your vectors. Now you need to answer: “How similar are these two things?”<br>If you remember high school math class, the dot product is that thing where you multiply corresponding elements and add them up. Simple enough. Cosine similarity measures the angle between two vectors. If they point in the same direction, similarity = 1. Opposite directions = -1. Perpendicular = 0.<br>cosine_similarity(A, B) = (A · B) / (||A|| × ||B||)It’s called “cosine” because this formula literally computes the cosine of the angle between vectors. It ignores magnitude and focuses purely on direction . A short document and a long document about the same topic get the same similarity score. Fair and intuitive.<br>The dot product is simpler: just multiply corresponding elements and sum them up.<br>dot_product(A, B) = (a₁ × b₁) + (a₂ × b₂) + ... + (aₙ × bₙ)No division. No square roots. Just multiply and add.<br>The catch: It cares about magnitude. Bigger vectors naturally get bigger scores, which can be... problematic.<br>Know anyone who blindly goes for Cosine Similarity, even with normalized embeddings? Share this post with them!
Share
The Key Difference (And Why It Matters)
Cosine similarity normalizes by magnitude. Think of it like this:<br>A · B = ||A|| × ||B|| × cos(θ)The dot product equals: (magnitude of A) × (magnitude of B) × (cosine of angle).<br>Cosine similarity divides this by both magnitudes, isolating just the angle:<br>cos(θ) = (A · B) / (||A|| × ||B||)In plain English
Dot product = “How much do these vectors point in the same direction, weighted by their size?”
Cosine similarity = “Do these vectors point in the same direction, period?”
Still not clear? Imagine two documents:<br>Doc 1: “Cats are cute”<br>embedding magnitude = 0.8
Doc 2: “Cats are cute and fluffy and wonderful and purr and have whiskers...”<br>embedding magnitude = 2.3Both are about cute cats. They should be considered similar.<br>Using dot product (unnormalized): Doc 2 gets a way higher score just because it’s longer. Unfair.<br>Using cosine similarity: Both get the same score (≈ 1.0) because they point in the same direction. Fair.<br>This is why cosine similarity became the gold standard for semantic search. It’s magnitude-invariant – it doesn’t penalize short documents or favor long ones.<br>In 2025, cosine similarity is probably overkill
Most modern embedding APIs – OpenAI’s text-embedding-3, Cohere, Voyage AI – return normalized embeddings by default. (Always check your model’s documentation, but chances are, they’re normalized.)<br>What does “normalized” mean? Every vector has a magnitude of exactly 1. And when both vectors have magnitude = 1:<br>cosine_similarity(A, B) = (A · B) / (1 × 1) = A · B<br>The dot product and cosine similarity are IDENTICAL.<br>So all that careful normalization we’ve been doing? That division by magnitudes? Concretely, we’re dividing by 1.<br>Impacts
The main one is speed: Dot product is faster. No square roots, no division. Just multiply and...