What is an embedding, and why does cosine similarity work for search?
#A user searches "reset my password" and the right article is titled "Recovering account access".
Show answer
An embedding model turns text into a vector of numbers, trained so that texts with similar meaning get vectors pointing in similar directions. Cosine similarity measures the angle between two vectors, so it scores how close two meanings are regardless of vector length.
That is why "reset my password" can match "recovering account access" without sharing words. Embeddings are specific to the model that made them, so queries and documents must use the same model, and quality depends on how well the model fits your domain and language.
Trade-offs
Semantic matching handles paraphrases but can miss exact terms such as error codes.
Common mistake
Comparing vectors from two different embedding models.
Follow-up
When would dot product give different rankings from cosine similarity?