An embedding model turns text into a list of numbers, a vector, so that texts with similar meanings get vectors pointing in similar directions. Cosine similarity measures the angle between two such vectors. Pointing the same way scores 1, at right angles scores 0, and opposite scores -1. Length does not matter, only direction, so a short question and a long help article can still score as close.
Everyday example. A customer types “how do I get my money back?” A help center using semantic search embeds the question and compares it with every article’s embedding. The refund-policy article scores 0.86 and the shipping article 0.31, so the refund article comes first even though it never uses the words “money back”. Retrieval-augmented generation uses the same step to choose which chunks to show a model.
How it is computed. scikit-learn’s documentation defines it as the dot product of the two vectors divided by the product of their lengths. Some tools report cosine distance instead, which scikit-learn defines as 1 minus the cosine similarity, so lower means more similar. When vectors are normalized to length 1, cosine similarity equals the plain dot product, which is why vector databases often offer both and treat them as interchangeable for normalized embeddings.
On the show. In episode 53, at 27:33, Oracle’s Richmond Alake explains that agent memory retrieval relies on vector search, where “you can use mathematical operations like cosine and Euclidean distance to measure the distance between two vectors.” The episode’s sponsor read names Galileo.
Why it matters. A similarity score says two vectors are close, not that one document answers the other. Editorial synthesis: scores depend on the embedding model, so a “good” threshold for one model can be wrong for another, and retrieval quality still needs testing with real queries, as covered in AI evaluation.
Hear it from the guest
“You can use mathematical operations like cosine and Euclidean distance to measure the distance between two vectors.”
Quotes lightly edited to remove filler words.
Sources
- scikit-learn documentation: Pairwise metrics, Cosine similarity — Reference definition of cosine similarity as the L2-normalized dot product of two vectors; checked October 24, 2026