01

Numbers for meaning

Computers work with numbers, not words or pictures. To process language, AI needs a way to represent words numerically that captures what they mean. Simply assigning each word an ID number does not help, because the numbers say nothing about meaning. Embeddings solve this by representing each word, or other item, as a list of many numbers, called a vector, positioned so that related items sit close together in a mathematical space.

02

A map of meaning

Imagine a map where every word has a location. Words with similar meanings, such as cat and kitten, or happy and joyful, are placed near each other, while unrelated words, such as cat and volcano, are far apart. Real embeddings have hundreds or thousands of dimensions rather than two, which allows them to capture many different aspects of meaning at once, such as topic, tone, grammar and associations.

03

Learning from context

Embeddings are learned from data, based on the idea that words appearing in similar contexts have similar meanings, summed up by the linguist J. R. Firth's phrase that you shall know a word by the company it keeps. A model reads huge amounts of text and adjusts each word's numbers so that it can predict the words around it. Words used in similar ways end up with similar embeddings.

04

Word2vec

A famous breakthrough came in 2013, when researchers at Google led by Tomas Mikolov released word2vec, an efficient method for learning word embeddings. It revealed surprising patterns: the direction from man to woman was similar to the direction from king to queen, so a simple calculation of king minus man plus woman produced a vector close to queen. Similar relations captured countries and capitals and verb tenses.

05

Context-aware embeddings

Early word embeddings gave each word a single vector, but many words have several meanings. The word bank means different things in river bank and bank account. Modern transformer models create contextual embeddings, adjusting each word's representation based on the surrounding words. Inside large language models, every token is represented by an embedding that is refined layer by layer as the model processes the text.

06

Beyond words

Embeddings can represent whole sentences, documents, images, songs, products or users. Models such as OpenAI's CLIP, released in 2021, learned embeddings that place images and text descriptions in the same space, so a photo of a dog lands near the phrase a dog playing in the park. This allows searching images with words, and is a key ingredient in AI image generators.

07

Semantic search

Traditional search engines match keywords, so a search for cheap flights might miss a page that says low-cost airfares. Semantic search converts both the query and documents into embeddings and finds those with the closest meaning, even if they use different words. Many search engines, shopping sites and company knowledge systems now combine keyword and semantic search to find better results.

08

Powering chatbots

Embeddings are central to retrieval-augmented generation, in which a chatbot searches a collection of documents for relevant information before answering. Documents are split into chunks and converted into embeddings, stored in special vector databases. When a user asks a question, it is converted into an embedding, and the closest chunks are retrieved and given to the language model, helping it answer accurately using up-to-date information.

09

Recommendations and more

Streaming services, online shops and social media use embeddings to represent users and items, recommending products, songs or videos whose embeddings are close to those a user has enjoyed. Banks use embeddings to detect unusual transactions, and scientists use them to represent molecules and proteins, helping to search for new medicines and materials. Embeddings can also reflect biases in training data, for example associating certain jobs more strongly with one gender, which researchers work to measure and reduce.

010

Why it matters

Embeddings are one of the most important ideas in modern AI, the bridge between human concepts and computer calculations. They explain how AI can understand that two different phrases mean the same thing, recommend things we might like and connect words with images. Understanding embeddings helps make sense of how search, recommendations and chatbots really work, and why they sometimes connect ideas in surprising ways.

FOLLOW THE EVIDENCE

Sources & further reading

A simplified explanation of a technical concept. Photograph: original AI-generated illustration (Adobe Firefly). Reference organisations do not endorse this website.