Which measure is most commonly used to compare two embedding vectors for meaning?
- Exam domain
- RAG with embeddings, rerank and vector search
- Difficulty
- Medium
- In this mock
- 6 questions on this domainPractise this domain
Why D is the answer
Cosine similarity
Cosine similarity compares the angle between vectors, so it measures how alike their directions, and therefore their meanings, are.
Remember: Compare embeddings by cosine similarity.
In detail
- Cosine: angle between vectors.
- Higher means more similar.
Every option, checked
Knowing why each wrong option fails is how you rule it out on exam day.
A. String edit distanceWrong
Edit distance compares characters, not meaning.
B. Word count differenceWrong
Word counts say nothing about meaning.
C. Alphabetical order of the source documents, which keeps related files next to each otherWrong
Alphabetical order is unrelated to similarity.
D. Cosine similarityRight
Compare embeddings by cosine similarity.
Use case
An illustrative scenario, not a real incident.
Illustrative: a duplicate-ticket detector flags pairs with cosine similarity above a tuned threshold.
See it in different ways
flowchart TD
Q{"What are you comparing?"}
Q -->|"Meaning"| A0["Cosine similarity of embeddings"]
Q -->|"Spelling"| A1["Edit distance"]How to read this chart
- At "What are you comparing?": if "Meaning", go to "Cosine similarity of embeddings"; if "Spelling", go to "Edit distance".
flowchart LR S0["Embed both"] --> S1["Compute cosine similarity"] --> S2["Apply a threshold"]
How to read this chart
- Read it in order: Embed both, then Compute cosine similarity, then Apply a threshold.