Two vectors can point in the same direction while having very different lengths. Whether that difference should affect a search score depends on the representation and the metric. Cosine similarity and the dot product answer related questions, but they are not interchangeable by default.
The scikit-learn documentation defines cosine similarity as the dot product divided by the product of the vectors’ norms. For non-zero vectors, this normalisation removes the effect of their overall lengths.
Work through two short vectors
Take an illustrative query vector q = (1, 0). Candidate a = (1, 0) has a dot product of 1 with q. Candidate b = (5, 0) has a dot product of 5. Yet both candidates point in exactly the same direction as q, so both have cosine similarity 1.
Now consider c = (0, 1). Its dot product and cosine similarity with q are both 0 because the directions are perpendicular. These deliberately simple coordinates show the arithmetic; they do not represent a real language model’s understanding of any words.
Check what the embedding model expects
If all vectors are normalised to unit length, the dot product and cosine similarity coincide. If they are not, vector magnitude can affect the ranking. Read the embedding model and vector database guidance together rather than changing the metric because one example returned a plausible answer.
Also define how zero vectors are handled. The mathematical cosine expression has a zero denominator for a zero-length vector, so a library’s behaviour needs checking rather than assuming the ordinary formula applies.
Evaluate the retrieved material
A high similarity score does not prove that a document answers the user’s question or that its facts are correct. Build a small review set with relevant and misleading candidates, inspect the ranking and record the normalisation settings. A metric choice is part of the retrieval design, not a substitute for checking the actual results.

