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.

Word vs Sentence Embeddings

Word embeddings give each word one vector, sentence embeddings give a whole text one vector. Here is what each does, where averaging fails, and how to explain it for your AI interview.

In short

A word embedding gives each word one list of numbers, the same whatever sentence it sits in. A sentence embedding gives a whole question or document one list, so a search can compare what the text means.

11 min readIntermediateCommon · 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.

A word embedding gives each word one list of numbers. A sentence embedding gives a whole question or paragraph one list, so a search can match by meaning. The simple way to build a sentence vector is to average the word vectors, but that blends every word together, so a small word like 'not' barely moves the result and 'not approved' looks like 'approved'. Sentence models read the whole text instead. For a real search, I would use a sentence model and test it on refused chargebacks first.

What are word and sentence embeddings, in plain words?

An embedding is a list of numbers that stands for a piece of text, so a computer can measure how close two pieces are. OpenAI describes embeddings the same way: a vector of numbers, where a small distance suggests the texts are closely related.

A word embedding gives each word one list. A sentence embedding gives a whole sentence, question or paragraph one list. It is the same idea at two sizes.

Picture a call-centre supervisor. Each keyword in a complaint gets its own tag, but the supervisor reads the whole complaint and gives it one tag for what it is about. Word embeddings are the keyword tags. A sentence embedding is the supervisor's tag.

Key words

Vector
A list of numbers. Computers compare vectors by how closely they line up.
Word embedding
One vector per word, the same whatever sentence the word sits in.
Sentence embedding
One vector for a whole sentence, question or paragraph.
Cosine similarity
A score from -1 to 1 for how much two vectors point the same way. Higher means more alike.

How does a word embedding work, and where does it fall short?

Word2vec is a method from 2013 for learning one vector per word from a large amount of text. Its paper describes "continuous vector representations of words from very large data sets". Words that appear in similar contexts end up near each other.

Google's machine learning course calls these static embeddings. Each word gets one point, the same in every sentence, so the course warns that a single point "can be a limitation in some cases".

Newer models deal with that. BERT, from 2018, reads the words on both sides of each word, so its vectors depend on the sentence. ELMo, also from 2018, is built to model "how these uses vary across linguistic contexts".

  • “Static embeddings like word2vec represent all meanings of a word with a single point, which can be a limitation in some cases.”

    Google, Machine Learning Crash Course

  • “An inherent limitation of word representations is their indifference to word order and their inability to represent idiomatic phrases.”

    Mikolov and colleagues, 2013

  • Word

    One vector per word

    Quick to build: one lookup per word, from a large pile of text. Good for keywords, synonyms and single-word tasks.

  • Sentence

    One vector per text

    Needs a model that reads the whole text. Captures what a full question means.

Why do search tools need one vector per sentence?

A customer's question rarely uses the same words as the ticket that answers it. A word-by-word match misses the link, but a sentence vector can catch the meaning. For example, a customer asks "Why was my chargeback refused?" and the closest ticket reads "Chargeback not approved, reason 4".

Comparing sentences pair by pair does not scale. The 2019 SBERT paper shows the gap: finding the most similar pair among 10,000 sentences took about 65 hours with BERT, and about 5 seconds once each sentence had its own vector.

How a question finds its ticket

Customer question

in the customer's own words

Embedding model

one vector for the whole text

Stored ticket vectors

Ticket 4411

card blocked after fraud alert

Ticket 5027

chargeback not approved, reason 4

Closest ticket

best match by meaning, not shared words

  1. 1The question becomes one vector, from the same model.
  2. 2That vector is compared with every stored ticket vector.
  3. 3The closest ticket goes back to the agent.
The question and every stored ticket each become one vector. The closest vector wins, so the agent sees the matching ticket even though the words differ.
  • “Finding the most similar pair in a collection of 10,000 sentences requires about 50 million inference computations (~65 hours) with BERT.”

    Reimers and Gurevych, SBERT (2019)

So the pattern is: make one vector per text, store it, then compare the question's vector with the stored ones using cosine similarity. That comparison is one quick step per ticket.

How do you get one vector for a whole sentence?

There are two common routes. The first is averaging: add up the word vectors and divide by how many there are. The SBERT paper says averaging BERT's output was the most common approach, and that taking the output for the first token, a marker the model puts at the start of the input, was the other main choice.

Averaging is simple, and it has a clear flaw. It treats the sentence as a pile of words, so the order is lost. The chart shows both routes side by side, and the demo puts numbers on the problem.

Averaging words vs reading the sentence

Average the word vectors

chargeback not approved

small 'not' gets blended in

Read the whole sentence

Sentence model

order and 'not' both count

Looks like approved

a refusal gets matched wrongly

Sees the refusal

the right meaning is kept

  1. 1Averaging makes a refusal look like an approval.
  2. 2Reading the whole sentence keeps the refusal's meaning.
Averaging gives a refusal a nearly identical vector to an approval. A model that reads the whole sentence keeps the difference, so the refusal is found.

Here it is in plain Python. The vectors are made up, and I set "not" close to zero on purpose, so this shows the mechanism, not a measured result. Real averaged vectors can show the same pattern, so test them.

Python
import math

# Made-up 2-number word vectors. A small, simplified space, not a real model.
WORD_VECTORS = {
    "chargeback": (0.9, 0.2),
    "approved": (0.8, 0.1),
    "rejected": (0.1, 0.9),
    "not": (0.05, 0.05),
}

def sentence_vector(text):
    # The simple way: average the word vectors. Word order is lost.
    vectors = [WORD_VECTORS[word] for word in text.split()]
    return tuple(sum(v[i] for v in vectors) / len(vectors) for i in range(2))

def cosine(a, b):
    # 1.0 means the same direction; lower means less alike.
    dot = sum(x * y for x, y in zip(a, b))
    return dot / (math.hypot(*a) * math.hypot(*b))

approved = sentence_vector("chargeback approved")
not_approved = sentence_vector("chargeback not approved")
rejected = sentence_vector("chargeback rejected")
print("approved vs not approved:", round(cosine(approved, not_approved), 4))
print("approved vs rejected:", round(cosine(approved, rejected), 4))

Output

approved vs not approved: 0.9997
approved vs rejected: 0.791

A sentence model avoids that by reading the whole text. SBERT, a sentence version of BERT, adds a pooling step (it squeezes BERT's many per-word outputs into one fixed-size list). It is then trained so that semantically similar sentences are close in vector space.

Once you use a sentence model, keep the same one for questions and tickets. Vectors from different models are not in the same space, so the distances between them cannot be compared.

  • Word vectors

    Quick, cheap and good for keywords and synonyms.

  • Sentence vectors

    Capture what a whole question means, so they suit search.

  • Averaged word vectors

    Easy to build, but they blur small words like "not", so negation is easy to miss.

  • Your own tickets

    Test on real refusals and negations before you trust the search.

What does the interviewer want to hear?

A strong answer covers

  • A plain definition: a word embedding is one vector per word, a sentence embedding is one vector per text.
  • Why it matters: word order and negation get lost when you average word vectors.
  • Sentence embeddings are what semantic search compares, usually with cosine similarity.
  • The same embedding model for questions and documents, or the distances mean nothing.
  • The cost trade-off: one model call per text, then fast comparisons.
  • Honest limits: a vector can still miss a detail, so test on real examples.

Common traps

  • Trap"Word and sentence embeddings are the same thing."

    BetterSame idea at two sizes. A word vector is for one word, a sentence vector is for a whole text.

  • Trap"Just average the word vectors, it's good enough."

    BetterIt blends every word, so a small word like 'not' barely moves the result, and 'not approved' lands next to 'approved'. Test refusals first.

  • Trap"Cosine similarity counts shared words."

    BetterIt compares the direction of two vectors. Shared words only matter if the model maps them that way.

Can you spot the problem?

Spot the problem

Your bank's ticket search turns each ticket into one vector. Which line makes refusals look like approvals?

Quick check

A customer question and each stored ticket get sentence vectors. What must match so the distances mean something?

Can you answer these from memory?

Flash cards · tap a card to flip it

1 / 6

What will they ask next?

  1. Q006What is an embedding?11 min
  2. Q113What is chunking, and why does size matter?13 min
  3. Q116How do you choose an embedding model?12 min
  4. Q118Cosine vs dot product vs Euclidean distance?11 min
  5. Q123What is hybrid search (BM25 + vectors)?11 min
  6. Q154Sparse vs dense embeddings?Coming soon

Learn it in depth

Last updated on 26 November 2026

Building a search over your own tickets or documents?

I design and build AI products and agents, with the screens and the system behind them. Book a short call and tell me what your search needs to find.