ai /Practical AI0 / 55 lessons complete

LEVEL 02 · LESSON 17

Similarity search

Similarity finds plausible candidates, not guaranteed answers.

What it is

Similarity search ranks items by how close their representations are to a query. In semantic search, that closeness is intended to capture useful relationships in meaning.

Why it matters

It can bridge vocabulary gaps, but relevance is broader than similarity. The most similar passage may not contain the answer.

A business example

A query about ‘ending my subscription’ finds cancellation guidance. However, an exact contract number is better handled by exact matching than by semantic resemblance alone.

How it actually works

Create a query embedding and compare it with document embeddings using a measure such as cosine similarity. Return a selected number of candidates, often combined with keyword results and metadata filters. Test both whether the needed source is found and how much irrelevant material is returned. The best search strategy depends on the collection: identifiers, dates, and uncommon product names can favor keyword or hybrid search.

A common misconception

A similarity score of 0.9 is not a 90% probability that the answer is correct. Scores depend on the model, metric, and dataset.

ONE SENTENCE TO REMEMBER

Similarity finds plausible candidates, not guaranteed answers.

CHECK YOUR UNDERSTANDING

A search result has a similarity score of 0.9 for the user’s question. How should this score be interpreted?

Show the answer

Answer: A.

Similarity finds plausible candidates, not guaranteed answers. Scores depend on the model, metric, and dataset, and the most similar passage may not contain the answer. Identifiers, dates, and uncommon product names often benefit from keyword or hybrid search.

Take it into your next meeting

Which queries in your business require exact matches rather than approximate meaning?

One more concept, understood.

Mark this lesson complete to keep your place.