Semantic similarity asks how close two pieces of text are in meaning.
Comparing the words themselves fails immediately on synonyms.
How do I reset my password and I forgot my login share almost no words.
They should score as nearly the same thing, and to a person they obviously are.
The route is to embed both into vectors and compare the vectors instead.
An embedding model puts text with the same meaning at nearby points.
Cosine similarity then measures the angle between them and returns a single number.
Sentence embedding models are trained for this specifically, unlike raw word vectors.
Averaging word vectors gives a weak sentence vector, which is why those models exist.
This is the engine under semantic search, deduplication and recommendation.
It is the retrieval step of every RAG system.
The scores are relative, so 0.8 means little on its own and only ranks against other scores.
It also has no notion of truth, since a sentence and its negation embed very close together.
The dog is friendly and the dog is not friendly are near neighbours.
That is why retrieval finds relevant text and cannot be trusted to find correct text.