How AI models work

Embedding

In short

An embedding is a list of numbers that an AI system uses to represent a piece of text, an image or another item, arranged so that things with similar meanings end up close together. Embeddings power meaning-based search and recommendations.

Also called
Embeddings, Vector embedding, Word embedding, Text embedding
Topic
How AI models work
Level
Some background helps
First described
Bengio and colleagues proposed learning a distributed representation for each word in a 2003 paper on neural language models2. Mikolov and colleagues' 2013 word2vec paper made word vectors fast to train at scale3.

Computers cannot work with words directly, so AI systems turn them into numbers. An embedding is that numerical form. OpenAI's documentation defines it as "a vector (list) of floating point numbers" and says the distance between two embeddings measures how related they are: small distances suggest high relatedness1.

The idea of learning a "distributed representation" for each word was set out by Yoshua Bengio and colleagues in 2003. Their model could handle sentences it had never seen, because words with nearby representations were treated as similar2. In 2013 Tomas Mikolov and colleagues at Google showed that good word vectors could be learned from a 1.6 billion word data set in less than a day3. Their paper notes that vector("King") minus vector("Man") plus vector("Woman") lands closest to the vector for "Queen"3.

Modern embedding models work on whole sentences and documents, not just single words. OpenAI's text-embedding-3-small produces 1,536 numbers per input by default, and text-embedding-3-large produces 3,0721. OpenAI lists search, clustering, recommendations, anomaly detection and classification as typical uses1.

Embeddings also sit inside every language model. The transformer begins by using learned embeddings to convert each input token into a vector4.

An embedding is not the text itself, and you cannot read it like a sentence. It only tells a system how close one item is to another.

Example

Search "rain coat" on a shop site that uses embedding search and it can still find a "waterproof jacket". The phrases share no words, but their embeddings sit close together, so the system treats them as related1.

Why it matters

Embeddings are how AI tools find information by meaning rather than exact keywords. They sit behind retrieval-augmented generation, where a chatbot looks things up in your documents before answering.

Questions people ask

Is an embedding the same as a vector?

Every embedding is a vector, meaning a list of numbers1. But not every vector is an embedding. The word embedding means the numbers were learned so that similar items sit close together.

What are embeddings used for?

Mainly search and retrieval by meaning. OpenAI also lists clustering, recommendations, anomaly detection, diversity measurement and classification1. Chatbots that answer from your own files usually use embeddings to find the relevant passages first.

Who invented word embeddings?

Bengio and colleagues described learning a distributed representation for words in 20032. Mikolov and colleagues at Google popularised fast word vectors with word2vec in 20133.

Related terms

Tools that use it

Sources

  1. OpenAI API documentation, Vector embeddings guide
  2. Bengio, Ducharme, Vincent and Jauvin (2003), A Neural Probabilistic Language Model, Journal of Machine Learning Research 3
  3. Mikolov, Chen, Corrado and Dean (2013), Efficient Estimation of Word Representations in Vector Space, arXiv:1301.3781
  4. Vaswani et al. (2017), Attention Is All You Need, arXiv:1706.03762

Back to the glossary