Skip to content
Inside AI

Embeddings: How AI Stores Meaning as Numbers

What embeddings are, why similar words sit close together on a map of numbers, and how that lets you search by meaning instead of exact words.

Rodrigo Faustino ·

Call number
DEN-002
Level
Intermediate
Reading
7 min
Published
Labs
Embedding map, Quiz

An embedding is a list of numbers that represents the meaning of a piece of text. Texts with similar meanings get similar lists. That lets a computer measure how much two sentences “mean the same thing,” even when they share no words at all.

From Words to Coordinates

Think of a city map. Every place has two coordinates, and places that are close together have similar coordinates. An embedding does the same thing with meaning: every word or phrase gets coordinates, except that instead of two, there are hundreds or thousands.

None of these coordinates was chosen by a person. They’re learned from a huge amount of text, following an old idea from linguistics called the distributional hypothesis: words that show up in the same contexts tend to have similar meanings. “Cat” and “dog” appear near “pet food,” “vet,” and “play,” so they end up with similar numbers.

Three words, cat, dog, and banana, each linked to a list of numbers; the lists for cat and dog are similar and the one for banana is different
Similar numbers mean similar meanings.

A Map of Meanings

You can’t draw a thousand dimensions, but you can squeeze the numbers down to two and look at the result. When you do that with everyday words, neighborhoods appear: animals in one spot, fruits in another, vehicles farther along. Words that bridge two topics, like “robot,” land between the neighborhoods.

A map with three clusters of points: animals, fruits, and vehicles, each cluster with four words close to one another and far from the other clusters
An illustration of how embeddings group words by meaning.

In the lab below, search for a word and see which ones sit closest to it. Then switch on 3D and rotate the map: clusters that looked stuck together in 2D can be far apart in depth.

LabEmbeddings MapTry it

Illustrative data A map built by hand to show the idea. A real map comes from an embeddings model (see scripts/gerar-embeddings.mjs).

dogcathorsecowliontigerwolffoxapplebananaorangegrapemangopearstrawberrypineapplecarbusmotorcyclebicycletrucktrainairplaneboatdoctornurseteacherstudentengineercookdriverprogrammerjoysadnessangerfearlovelongingcalmsurprisecomputerphoneinternetkeyboardscreensoftwarerobotalgorithmrainsuncloudwindsnowstormthunderheat
  • Animals
  • Fruit
  • Vehicles
  • Jobs
  • Feelings
  • Technology
  • Weather
Open this lab on its own page →
What to notice: Bridge words, like robot and driver, sit between two groups. That's what happens with terms that belong to more than one topic.

This map was built by hand to illustrate the idea. A map generated by a real model is messier, but the neighborhoods show up the same way.

A 2013 paper from Google that introduced the method known as word2vec revealed an intriguing effect in these maps. Doing arithmetic with the coordinates, “king” minus “man” plus “woman” landed near “queen.” The directions on the map captured relationships, not just closeness. Today’s models are far more sophisticated, but the intuition still holds.

What It’s Good for in Everyday Life

Search by meaning. Instead of looking for the exact word, the system turns your question into an embedding and looks for the texts whose numbers are most similar. “My phone won’t hold a charge” finds an article about batteries, even without the word “battery.”

Assistants that work with your documents. When an AI tool answers based on your files, there are almost always embeddings behind it. The documents are cut into chunks, each chunk becomes an embedding, and your question looks up the closest chunks to hand to the model. This technique is called RAG, short for retrieval-augmented generation.

Recommendations and clustering. Similar products, songs, and news stories sit close together on the map. That helps with suggesting “you might also like” items and with organizing large volumes of text.

Search flow: the question my phone won't hold a charge becomes an embedding and finds, in order, Battery drains fast, How to save power, and Replace the phone case
Search compares meanings, not letters.

Limits and Cautions

Close doesn’t mean equal. “I accept” and “I don’t accept” can end up close together because they’re about the same subject. For important decisions, an embedding finds candidates, but someone still has to read them.

The map inherits its source text. If the training material ties certain professions to a particular gender, the map reproduces that association. Researchers measure and correct for these biases, but they don’t go away on their own.

Every model has its own map. Embeddings from different models can’t be mixed. If a system switches models, all the texts have to be converted again.

Test What Stuck

LabQuiz: EmbeddingsTry it

Do you understand embeddings?

  1. Question 1 of 5

    What is an embedding?

    • A summary of the text in a few words
    • A list of numbers that represents the meaning of a text
    • A translation of the text into English
    • An image file
    Show answer

    Right answer: B. Each text becomes a list of numbers. Texts with similar meanings get similar lists.

  2. Question 2 of 5

    If two texts have very similar embeddings, that suggests they:

    • Have the same number of letters
    • Were written by the same person
    • Have similar meanings
    • Are necessarily in the same language
    Show answer

    Right answer: C. Closeness on the map of numbers means closeness in meaning, even without words in common.

  3. Question 3 of 5

    Why can the search "my phone won't hold a charge" find an article about batteries?

    • Because the search compares meanings, not just identical words
    • Because the article copied the question
    • Because every search shows articles about batteries
    • Because the word battery was hidden in the question
    Show answer

    Right answer: A. The question becomes an embedding, and the system looks for the texts with the most similar numbers.

  4. Question 4 of 5

    Why can "I accept" and "I don't accept" end up close together on the embedding map?

    • Because they have the same number of letters
    • Because they're about the same subject, even with opposite meanings
    • Because the model always ignores the word "not"
    • Because they're in alphabetical order
    Show answer

    Right answer: B. Embeddings capture a lot about the subject. That's why, for important decisions, they're used to find candidates, and someone has to read.

  5. Question 5 of 5

    If a system switches embedding models, what has to happen to the texts already stored?

    • Nothing, the numbers are still valid
    • They have to be converted again with the new model
    • They have to be translated
    • They have to be deleted forever
    Show answer

    Right answer: B. Each model has its own map. Numbers from different models can't be compared with each other.

Open this lab on its own page →

Keep Reading

References

  1. Mikolov, Tomas; Chen, Kai; Corrado, Greg; Dean, Jeffrey. Efficient Estimation of Word Representations in Vector Space (2013).
  2. Jurafsky, Daniel; Martin, James H.. Speech and Language Processing (3rd ed., draft), Chapter 6: Vector Semantics and Embeddings.

On the same shelf2 books