Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Cosine similarity is the cosine of the angle between two vectors, a geometric quantity. It is not a calibrated probability of relevance; that interpretation has to be derived per model.
Picture two arrows pointing out from the same spot. If both point in roughly the same direction, the cosine of the angle between them is close to 1. If one points up and the other points sideways, the cosine is close to 0. That is all cosine is: a way of asking how parallel two arrows are. It does not know whether the two arrows mean similar things in the real world. That extra meaning is something we attach by checking many examples, not something the number tells us on its own. So a high cosine often hints at relatedness, but it is not a built-in promise.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
2 min: cosine as geometry + formula and unit-norm equivalence with dot product + why it is not a probability + per-model thresholding + top-K plus reranker pattern.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Treating cosine as a probability of semantic equivalence and reading 0.8 as 'definitely relevant' on any embedding model.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.