Semantic Similarity

Meaning Beyond Words

Semantic similarity is the property of two pieces of text having the same or similar meaning, regardless of the words used. "The car broke down" and "My vehicle stopped working" are semantically similar — same meaning, no shared words.

Key insight

Embedding-based systems measure semantic similarity mathematically: similar meanings produce vectors that are close together in vector space. This is what makes meaning-based search possible.

Why Keyword Matching Fails

Keyword search requires exact word overlap. This fails in many common situations:

1

Synonyms — Searching "automobile" misses documents about "cars."

2

Paraphrasing — "Reduce expenses" misses "cut costs."

3

Abbreviations — "ML" misses "machine learning."

4

Cross-language — An English query misses a French document about the same topic.

Embeddings solve these by placing all these variations close together in vector space.

Measuring Semantic Similarity

Cosine Similarity

Measures the angle between two vectors. Returns a value from -1 to 1. A score above 0.8 typically indicates strong semantic relatedness.

Most common metric for semantic search — ignores vector magnitude, focuses on direction.

Euclidean Distance

Measures the straight-line distance between two points in vector space. Smaller distance = more similar.

Sensitive to vector magnitude. Used in some clustering algorithms and certain vector databases.

Limitations to Know

Important limitation

Semantic similarity captures topic and meaning — not factual correctness. "The Earth orbits the Sun" and "The Sun orbits the Earth" score as highly similar because they discuss the same topic in the same structure, even though one is false.

Similarity scores also depend heavily on the embedding model. A model trained on general web text may rate pairs differently than one fine-tuned on scientific papers or legal documents.

Need Help?

Ask the AI assistant about semantic similarity, cosine similarity, or how embedding-based search works.