START HERE

What you will learn

  • Explain what an embedding represents without treating it as a fact database.
  • Understand the steps from a search question to a ranked document list.
  • Know why a similarity score is not a probability that an answer is correct.

Before you start: No mathematics beyond the idea of comparing two lists of numbers is needed.

A useful analogy: a map of relationships

On a map, nearby points share a location. In an embedding system, nearby representations often share aspects of meaning learned by the model. The analogy helps explain comparison, but the numbers are not literal map coordinates and each dimension does not necessarily have a simple human-readable meaning.

A model might place “ending a contract” near “termination notice” despite the different words. This can help when a keyword search misses the vocabulary used in a document. It can also retrieve passages that are related but do not answer the question. Relatedness is useful evidence for where to look, not a final answer.

What happens to the text?

A document is often divided into smaller passages so that a relevant section can be found without returning the whole file. Each passage is converted into an embedding and stored alongside its original text, source and version.

The question is converted using a compatible embedding model. The system compares it with the stored representations and ranks candidates. Different models can produce different representation spaces, so an index and its questions must use a compatible setup. If the model or document format changes, check the search results again rather than assuming the old ranking will hold.

Step-by-step process

  1. Collect questions that matter

    Write the questions a person is likely to ask. For each, identify the document or passage that should be found. Include a question for which no document is relevant.

  2. Prepare passages with their context

    Split documents at sensible boundaries. Retain headings, source identifiers and dates so that a retrieved sentence can be understood and checked.

  3. Create and store the representations

    Generate an embedding for each passage using the chosen model. Keep access permissions connected to the stored content.

  4. Rank candidates for a question

    Create the question’s embedding, compare it with permitted passages and return a short ranked list. A keyword search may also help with exact product names or reference numbers.

  5. Inspect relevance, not just the score

    Ask whether the results contain the evidence needed to answer the question. A high similarity score is not a percentage confidence in the document’s truth or usefulness.

FOLLOW ONE EXAMPLE

Worked scenario

Finding the right clause without knowing its wording

A stakeholder searches an approved contract collection for “How much notice do we need to end the agreement?” The relevant heading is “Termination”.

  1. A keyword search using only “end the agreement” may miss the heading. A semantic search may find the termination passage because its meaning is related.
  2. The search also returns a passage about ending an employee contract. It is related language but the wrong kind of agreement.
  3. The stakeholder checks the document title, contract party and version before using the notice clause.

What this shows: The system helps find candidate evidence. Source identity and the actual clause determine whether the result is usable.

The process at a glance

Embeddings help rank possible matches. The reader still needs the original passage and source details to decide whether a match answers the question.
ProcessDecisionHuman checkpoint
Read Mermaid diagram source
flowchart LR
 A[Document passages] --> B[Stored embeddings and source details]
 C[Search question] --> D[Question embedding]
 B --> E[Compare and rank permitted passages]
 D --> E
 E --> F[Inspect original text and source]

What you should have at the end

  • A search process tested against realistic questions.
  • Results with enough source context for someone to judge relevance.
  • A list of questions where semantic, keyword or combined search works best.

Common mistakes and how to avoid them

Reading 0.82 similarity as 82% certainty

The number describes a comparison under a chosen model and metric. It does not establish truth.

Removing the source context

An isolated sentence may refer to a different customer, policy version or exception.

Using only convenient test questions

Try synonyms, exact identifiers, ambiguous wording and questions with no answer.

APPLY THE IDEA

Try it yourself

Your task: Take one short document and write three differently worded questions about the same passage. Add one unrelated question.

What to produce: A relevance checklist showing which passage each question should retrieve and why.

Check your understanding: Can you distinguish a passage that shares the topic from one that actually contains the answer?

Key terms in plain English

Embedding
A numerical representation of an item produced by a model.
Vector
An ordered list of numbers; the form an embedding takes.
Similarity metric
A rule for comparing representations, such as cosine similarity.
Semantic search
Search that uses representations of meaning to help rank results.

Sources and further reading