esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • AI papersPages
  • Interview KitPages
  • Book a callContact
  • Download ResumeContact
Let’s talk

I’ll build the agent for it.

What Is an Embedding?

What an embedding is, how distance shows similarity, and where embeddings fall short, explained simply for your AI interview.

In short

An embedding is a list of numbers that stands for the meaning of a piece of text. Texts with similar meaning get lists that sit close together, so a system can search by meaning instead of exact words.

11 min readBeginnerVery common · estimateFacts checked 26 November 2026

Say it out loud

Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.

An embedding is a list of numbers that stands for the meaning of a piece of text. Similar meanings get lists that sit close together, so a search can find a burst pipe claim when someone types ceiling leak. The lists come from a trained model, and distance tells you how related two items are. Embeddings can miss exact matches. Codes and names can slip past them, so I pair them with keyword search.

What is an embedding, in plain words?

A computer cannot compare two sentences by meaning the way a person does. It can compare two lists of numbers easily. An embedding bridges that gap: a model turns each piece of text into a list of numbers, and it is trained so that texts with similar meaning get similar lists.

Google's machine learning course describes an embedding as a vector representation of data in embedding space. A vector is just an ordered list of numbers. Embedding space is the imagined map those lists live on.

Think of a claims office that shelves files by cause and room, with the claim number only on the label. Two kitchen leaks sit on the same shelf, even when the clerks wrote them differently. An embedding is that shelf position, worked out for meaning.

Here is the problem. An insurer holds two hundred thousand past claim notes. A new note says water is coming through a kitchen ceiling. Keyword search only finds notes that share those words, so it misses a note about an upstairs bathroom leak. An embedding search finds it, because the meaning is close.

Key words

Embedding
A list of numbers that stands for the meaning of a piece of data.
Vector
An ordered list of numbers. Every embedding is a vector.
Embedding space
The imagined map that all those lists live on.
Vector database
A store built to find the saved lists nearest to a new one, fast.

How does an embedding capture meaning?

An embedding model is trained on large amounts of text, so it learns which words and sentences get used in similar ways. Google's course says each item is represented by a fixed count of floating-point numbers, which are decimals such as 0.42 or -0.13. The count is chosen when the model is built, so every item from one model has the same length.

From claim note to closest match

Claim note

what the customer or adjuster wrote

Embedding model

turns text into a list of numbers

A list of numbers

one point on the map of meaning

Vector database

keeps every claim's point

Closest matches

ranked by similarity to the new note

  1. 1The claim note goes into the embedding model.
  2. 2The model returns a list of numbers for it.
  3. 3That list is saved in the database next to the claim.
  4. 4A new search returns the saved lists nearest to it.
A claim note goes into an embedding model, which returns a list of numbers. That list is saved in a vector database next to the claim. A new search becomes the same kind of list, and the database returns the nearest saved ones first.
  • “An embedding is a vector representation of data in embedding space.”

    Google, Machine Learning Crash Course

  • “The distance between two vectors measures their relatedness.”

    OpenAI

Distance is how the map measures closeness. OpenAI's guide says small distances suggest high relatedness and large distances suggest low relatedness. So two claim notes about the same kitchen leak should sit closer together than a note about a car.

How would the search rank three old claims?

Here is a small version with made-up numbers. Each claim has a vector of three numbers, which is far shorter than a real embedding, so the arithmetic is easy to read. The code scores each old claim with cosine similarity, where 1.00 means the same direction and a score near 0 means unrelated.

Old claims, closest first

New claim note

water coming through a kitchen ceiling

Saved claims

Ceiling leak, kitchen

same cause, same room

Pipe burst, upstairs

water damage, another floor

Car rear-end, no water

different cause, no overlap

  1. 1Compared first with the kitchen ceiling leak, the closest match.
  2. 2Next, the burst pipe, which is also water damage.
  3. 3Last, the car claim, which shares almost no meaning.
A new note about a water leak is compared with every saved claim. The closest claims come first, so the adjuster reads the kitchen ceiling leak before the car claim. The scores come from the code below, which uses made-up vectors.
Python
import math

# Made-up 3-number vectors for three past claims (real embeddings have far more numbers).
claims = {
    "Ceiling leak, kitchen": [0.90, 0.10, 0.20],
    "Pipe burst, upstairs": [0.55, 0.60, 0.15],
    "Car rear-end, no water": [0.10, 0.20, 0.90],
}

def cosine(a, b):
    # 1.00 means the same direction (very alike); near 0 means unrelated.
    dot = sum(x * y for x, y in zip(a, b))
    return dot / (math.hypot(*a) * math.hypot(*b))

# The new claim note, already turned into numbers by the same model.
query = [0.85, 0.20, 0.15]
ranked = sorted(claims.items(), key=lambda item: cosine(query, item[1]), reverse=True)
for name, vector in ranked:
    print(f"{cosine(query, vector):.2f}  {name}")

Output

0.99  Ceiling leak, kitchen
0.83  Pipe burst, upstairs
0.32  Car rear-end, no water

The pipe claim scores high too. It shares water damage with the kitchen leak, even though the room and floor are different. The map groups by meaning, so the same water damage lands close together across rooms.

Tip

In an interview, call the score a similarity measure. It shows closeness, and a high score can still be a poor match, so check results against real cases.

Where do the numbers come from?

Google's course gives two main routes. One is a dimensionality reduction technique such as PCA, which squeezes many features into fewer numbers. The other is to train the embedding as part of a neural network (a model that learns patterns from many examples), so the layer's numbers are learned for the task.

In that second route, the weights of the embedding layer are tuned during training so that similar examples land near each other. That is why an embedding made for support tickets can differ from one made for legal contracts.

Word2vec is the classic teaching example, though it is an older method that newer models have largely superseded. A 2013 paper titled Efficient Estimation of Word Representations in Vector Space, posted to arXiv on 16 January 2013, showed how to learn word vectors from very large text sets at much lower computational cost.

Word2vec gives each word one point, so the word bank gets the same spot whether it means a river edge or a bank account. Google's course calls this a limitation in some cases. Newer contextual models give a word a different vector depending on the words around it.

How would you search 40,000 contracts by meaning?

A legal team wants every contract that limits liability for a data breach. Keyword search misses clauses that describe a breach in other words, so the team uses embeddings with a safety net.

  1. 1

    Split each contract into clauses

    Long contracts are cut into clause-sized pieces, so one clause can be matched on its own.

  2. 2

    Embed each piece once

    Store each vector with its contract ID, clause number and page, so every hit can be opened.

  3. 3

    Add keyword search for exact terms

    Clause numbers, party names and defined terms are matched by keyword, because embeddings can miss exact codes.

  4. 4

    Filter by access first

    Each lawyer only sees contracts they are allowed to read, so the access filter runs before ranking.

  5. 5

    Measure with real questions

    A list of questions from the team shows what the search misses. Switch models only after re-running that list.

What does the interviewer want to hear?

A strong answer covers

  • A plain definition: a list of numbers that stands for meaning.
  • How closeness is measured: distance or cosine similarity, and what a high score means.
  • Where the numbers come from: a trained model that learns from data.
  • The limits: exact codes, model changes and data quality.
  • Hybrid search: embeddings plus keywords, with access rules applied first.
  • A test plan with real questions from the team, not a guess.

Common traps

  • Trap"Embeddings are a kind of exact search."

    BetterThey match meaning. Keep keyword search for codes and names.

  • Trap"A bigger embedding always gives better search."

    BetterQuality depends on the model, the text and your test questions. Measure before you pay for size.

  • Trap"Vectors from two models can be compared."

    BetterEach model draws its own map. Switch models and run the whole collection through the new one again (re-embed it).

Can you pick the right search setup?

Spot the setup

Claims staff must find claim CL-88213 exactly, and also find similar water claims. Which setup fits?

Quick check

The team switches to a newer embedding model. What must happen to the stored vectors?

Can you answer these from memory?

Flash cards · tap a card to flip it

1 / 6

What will they ask next?

  1. Q007Word embeddings vs sentence embeddings?11 min
  2. Q113What is chunking, and why does size matter?13 min
  3. Q116How do you choose an embedding model?12 min
  4. Q117What is a vector database?12 min
  5. Q123What is hybrid search (BM25 + vectors)?11 min
  6. Q147When must you re-embed everything?Coming soon

Learn it in depth

Last updated on 26 November 2026

Building search over your own documents or claims?

I design and build AI search and agents, including the interface and the system behind them. Book a short call and tell me what you need to find, and how costly a wrong answer would be.