Text embeddings represent sentences as vectors; cosine similarity compares their directions to find related candidates. A high score still needs checking against the task. For example, "I forgot my password" and "How can I reset my login?" use different words to ask about a similar problem.
Give each sentence a list of numbers
An embedding is a vector: an ordered list of numbers that represents an item. For text, a trained model produces that list from a word, sentence, or passage. The geometry of these vectors can capture useful relationships for a task. Google's introduction to embedding spaces .
Picture a map of help articles. Password-reset instructions and login troubleshooting might sit near one another. A recipe for banana bread should be somewhere else. The map is an analogy for comparing those representations.
The model learns its representation during training. You do not usually assign one coordinate to "password" and another to "bread." Real embeddings have many dimensions.…