Module 0 · Lesson 8 of 10

Embeddings: meaning as numbers

Search by meaning (closest 3)

  1. I was charged twice for the same order this month.closeness 0.90 out of 1, an example score
  2. My package arrived damaged and I need a refund for it.closeness 0.86 out of 1, an example score
  3. The item does not match the listing, so I'd like a reimbursement.closeness 0.84 out of 1, an example score

Search for the same words

No sentence shares a word with "I want my money back".

Closest by meaning: I was charged twice for the same order this month.; My package arrived damaged and I need a refund for it.; The item does not match the listing, so I'd like a reimbursement..

  • Signing in
  • Refunds
  • Delivery
  • Closing an account

What this simplifies. Real embeddings have hundreds of numbers, not two, and a model computes them; this map was placed by hand to show the idea. Real systems usually compare two lists of numbers by the angle between them, but the idea is the same: close means similar in meaning. "Search for the same words" is also a crude stand-in. It matches exact word forms of four or more letters, with no ranking, so "refund" does not match "refunds".

An model turns a piece of text into a list of numbers called an embedding. It does not write answers. Many apps call a separate embedding model for search, apart from the model that writes answers. The exact set-up depends on the system.

Texts with a similar meaning get embeddings that land close together, even when they share no words at all. Texts with different meanings get embeddings that land far apart.

This lets software compare meaning with plain arithmetic: measuring the distance between two lists of numbers, instead of matching exact words. It says nothing about whether either text is true. Close also means the same topic, not the same claim: "refunds are allowed" and "refunds are not allowed" can land close together.

Example. "I can't log in" and "sign-in keeps failing" share no words, but their embeddings land close together, since both describe the same problem. "Please refund me" lands far from both.

In system design: Your backend calls an embedding model once per , a short passage cut from a document. It calls it again for each question, then compares the numbers.

Check yourself

"Refunds are allowed" and "refunds are not allowed" get very close embeddings. What does that tell you?