Embeddings
Turning words, images or documents into lists of numbers that capture meaning.
An embedding is a list of numbers (a vector) that represents a piece of content: a word, a sentence, a whole document, an image. A neural network produces it so that things with similar meaning get similar numbers. 'Dog' and 'puppy' end up close together; 'dog' and 'invoice' end up far apart. A typical embedding has a few hundred to a few thousand numbers.
Computers cannot compare meanings, but they can compare numbers very fast. Once everything is an embedding, 'find documents like this one' becomes 'find the nearest points', a geometry problem. That powers semantic search (results that match the idea, not the exact words), recommendations, duplicate detection and clustering.
Inside an LLM, every token becomes an embedding first; that is how text enters the math. Outside, embeddings are the backbone of RAG: documents are embedded once and stored in a vector database, the question is embedded at query time, and the closest chunks are retrieved.
Example: a help desk that gets 'my screen went black' should find the article titled 'Display not turning on' even though no word matches. With embeddings, the two sentences sit close together, so the search works.
Keep in mind
- An embedding is a vector; distance between vectors approximates distance in meaning.
- The same model must embed both the documents and the query, or the numbers are not comparable.
- Vector databases are built to find nearest neighbors among millions of embeddings.
- Embeddings exist for text, images, audio and code, sometimes in one shared space.
Go deeper
- 3Blue1Brown: But what is a GPT? (embeddings explained visually)
- Word embedding on Wikipedia
- OpenAI: embeddings guide