Skip to the page
Tecyfy

What is an embedding in AI?

A list of numbers that stands for the meaning of a piece of text, an image or other data. Things with similar meaning get similar numbers, so a computer can find them.

beginner · Also called Vector Embedding, Vector Representation

Computers are good at comparing numbers and bad at comparing meaning. "How do I reset my password?" and "I'm locked out of my account" share almost no words, yet they ask the same thing. An embedding is how a computer sees that.

An embedding model reads a piece of text and returns a long list of numbers. OpenAI's smaller embedding model returns 1,536 of them for each piece of text. Each list is a point in a space with that many directions. You cannot picture it, but the rule is simple: texts with similar meaning land close together.

A map of meaning

Think of a map where every sentence is a pin. Questions about passwords cluster in one corner, questions about refunds in another. "Locked out of my account" lands near "reset my password", far from "refund my order". Nobody drew that map by hand. The embedding model learned where to put things from the text it was trained on.

How close is close? Usually it is measured with cosine similarity, which compares the direction 2 lists point in. OpenAI recommends it, and notes that the choice of measure rarely matters much.

What people use them for

  • Search by meaning. Find the help article that answers a question, even when the words differ.
  • RAGRAGA way to answer from your own documents. A search finds the passages that match the question, and they are added to the prompt before the model writes.. Find the passages from your documents that a model should read before it answers.
  • Grouping. Sort a large pile of support tickets or reviews into themes.
  • Recommendations. "People who read this also read" by similarity of content.
  • Odd ones out. Spot an entry that sits far from all the others.

Where they fall short

Embeddings capture what something is about, not its exact letters. A search for an error code such as "TS-999" may come back with other error codes that are "about" the same thing and miss the exact one. That is why good search systems combine embeddings with ordinary keyword search, as Anthropic does in its own retrieval setup.

Where they are kept

Once you have millions of these lists, you need somewhere to store them that can find the nearest ones fast. That is a vector databaseVector DatabaseA database built to store embeddings and quickly find the ones closest to a query, which is how AI apps search by meaning..

Which model makes the lists matters as much as where they are kept: how to choose an embedding model compares the current ones and shows how to test them on your own questions.

Sources

Where each fact comes from

  1. 1Vector embeddings
  2. 2Introducing Contextual Retrieval