Cosine similarity measures how similarly two vectors point by comparing the angle between them. For embeddings, it turns semantic or contextual relatedness into a similarity score for tokens, sentences, or documents. section 3.4.1
Embedding systems use cosine similarity to:
- Retrieve documents whose embeddings are nearest to a query embedding. section 3.4.1
- Compare model responses with queries to estimate semantic consistency or flag potential hallucinations. section 3.4.1













