loading
loading
A score from -1 to 1 that measures how close two embedding vectors point in the same direction — the default way to rank semantic matches.
Embeddings are vectors, and cosine similarity measures the angle between them, ignoring length: 1 means identical direction (very similar meaning), 0 means unrelated, negative means opposite. It's the math under most vector search — your query embedding is compared against every stored chunk and the top-k highest scores come back. People reach for it over plain Euclidean distance because it's scale-invariant, so a long document and a short query still compare fairly. Example: 'how do I cancel my plan' scores ~0.85 against a refund-policy chunk and ~0.1 against a chunk about API rate limits.
Plainly
Think of Cosine Similarity as a simple recipe for doing the work better. A score from -1 to 1 that measures how close two embedding vectors point in the same direction — the default way to rank semantic matches.
In practice
Use it when you need a repeatable method instead of guessing from vibes. In practice, define the owner, input, output, and failure mode before you rely on it.