Compute cosine similarity between a query vector and document vectors and rank the hits. Handy for RAG pipelines, semantic search and embedding debugging.
RAG 检索中常用余弦相似度。
| Item | Formula / Note | Source / Standard |
|---|---|---|
| Cosine similarity | similarity = dot product over the product of magnitudes | Vector space retrieval |
| Normalised retrieval | unit vectors make the dot product the cosine and allow ANN search | Approximate nearest neighbour literature |
| Dimensionality | high dimensions concentrate distances and constrain index choice | Vector search practice |