AnswerManiac

Getting things ready

AnswerManiac

Getting things ready

Retrieval & ranking

Cosine Similarity

Written by Faizan Babar·COO, AnswerManiac·Updated November 2026

The -1-to-1 score most systems use to rate how closely two vectors align.

Cosine similarity is the specific calculation most retrieval systems use to score how alike two embeddings are. It measures the angle between the vectors, returning a value from -1 to 1, where 1 means they point the same way (very similar meaning) and 0 means they are unrelated. It is the number behind 'this passage matches this query'.

You will not compute it yourself for third-party engines, but it is worth knowing because it demystifies retrieval: relevance is a geometric score, not a human judgement. Content that clearly expresses one idea produces a vector that scores high against the queries about that idea and low against everything else.

The lesson is precision — a passage that tries to cover five ideas at once has a muddier vector and a lower cosine match to any single query than five focused passages would.

Key takeaways

  • Cosine similarity scores how closely two vectors point in the same direction, on a scale from -1 to 1.
  • It is the most common way engines rank passages against a query during retrieval.
  • A higher cosine score for your passage versus a query means a better shot at being retrieved and cited.

The math, without the pain

Cosine similarity measures the angle between two vectors rather than the distance between their endpoints. If two vector embeddings point in nearly the same direction, the cosine of the angle between them is close to 1 and they are judged very similar. Point in opposite directions and the score drops toward -1. Perpendicular means unrelated, near 0.

Because it looks at direction, not magnitude, cosine similarity does not get thrown off by how long a passage is. A short answer and a long one about the same thing can still score as highly similar, which is exactly what you want when comparing a brief query to passages of varying length. Pinecone tutorials, for instance, commonly build indexes that score with cosine similarity.

In a retrieval system, the engine computes the cosine similarity between the query embedding and every passage embedding, then keeps the top scorers. That ranking is the gate your content has to clear to enter an answer.

Example

Imagine two arrows drawn from the center of a room. One is the query "best CRM for small law firms." The other is your passage about CRM software built for small legal practices.

The two arrows point in almost the same direction, so their cosine similarity is near 1, and the engine retrieves your passage. A passage about enterprise manufacturing CRMs points off at a wide angle, scores low, and stays out of the answer.

Frequently asked questions

Why cosine instead of plain distance?

Because cosine ignores vector length and focuses on direction, it compares meaning fairly across passages of very different sizes. That makes it a natural fit for matching short queries to varied content.

What is a good cosine similarity score?

It depends on the model and corpus, so there is no universal threshold. What matters practically is scoring higher than competing passages for the same query, since retrieval keeps the top results.

Can I see my cosine scores?

Not in public AI engines, which keep this internal. You influence the score indirectly by writing passages whose meaning tightly matches the questions you want to win.

Want to know where you stand in AI answers?

We’ll show you which engines cite you, and which don’t.

Get a free AI citation audit