AI turns words and ideas into numbers by giving each piece of input an embedding: a learned list of numbers—a vector—that represents the item for a model [1, 2]. Words, sentences, images, products and users can all have embeddings.
Those numbers are not definitions. They are learned during training so that items used or interpreted in similar ways tend to end up near one another [1, 3]. Relationships between ideas become distances and directions between points, which is the form a model can compute with.
TL;DR
- An embedding is a learned numerical representation of a token, sentence, image or other item [1, 2].
- Meaning is represented through relationships: similar items can have vectors that sit close together or point in similar directions [3, 2].
- Some relationships can show up as consistent directions in the space—including unwanted ones such as gender stereotypes [4].
- Cosine similarity is a common way to compare vector direction [3].
- Static embeddings give a word one vector; contextual models can represent it differently in different sentences [1, 5].
- Inside a language model, token embeddings are the starting point that Transformer layers reshape using context.
From Token IDs to Vectors
The previous guide, How Does AI Break Your Prompt Into Pieces? Tokens Explained, showed how a prompt is split into tokens and each token receives an ID number. That ID is only a label. Two tokens with neighboring ID numbers are not closer in meaning just because their labels happen to be adjacent.
An embedding solves that problem. The model keeps a learned table that maps each token ID to a vector. Instead of a single arbitrary label, every token now has a position in a shared numerical space where nearness can carry information.
A Map Without Human-Labeled Axes
Imagine a map where cities with similar climates and industries end up near one another. The horizontal and vertical axes do not have to be labeled temperature or manufacturing. A mapping system could learn whatever combination of features best supports its task.
An embedding space works somewhat like that, but it may contain hundreds or thousands of dimensions. Each item becomes a point described by a vector.
The analogy has limits. An embedding does not contain a complete, human-readable definition. It encodes relationships that helped the model’s training objective.
What a Vector Looks Like
A tiny fictional embedding might look like:
dog = [0.21, -0.43, 0.77, 0.05]
A real embedding contains many more values. The example is illustrative; those four coordinates do not come from a real model.
One dimension is rarely “animalness” while another is “friendliness.” Information is distributed across the pattern of values and across the model that uses them.
How Relationships Become Geometry
Because embeddings are positions, a model can represent relationships without anyone writing them down.
- Nearness: puppy and dog can sit closer together than puppy and invoice.
- Clusters: words for fruit, legal terms or programming languages can form loose neighborhoods.
- Directions: the step from one item to a related item can follow a similar path across many pairs.
Research on word embeddings has found that a relationship such as gender can be captured by a direction in the space, and that the same embeddings can cluster related concepts and solve analogy tasks [4]. That is the closest an embedding comes to “meaning”: a consistent pattern of relationships, learned from data, rather than a stored explanation.
The same research shows the downside. A direction that captures gender also carried stereotypes, such as linking some occupations more strongly with one gender [4]. Geometry records patterns in the data, whether or not those patterns are fair.
How Embeddings Are Learned
Word-representation methods such as the work behind word2vec learned vectors from patterns in large text datasets [1]. Words appearing in related contexts received representations that supported similar predictions.
Sentence-BERT adapted Transformer models to produce sentence embeddings designed to be compared with cosine similarity [3]. Instead of comparing only individual words, a system could represent a question, paragraph or document as a single vector.
The training task matters. An embedding trained for product search may arrange relationships differently from one trained for legal text or images.
What “Close” Means
Cosine similarity compares the direction of two vectors rather than simply their raw distance. Vectors pointing in similar directions receive higher similarity [3, 2].
That makes it useful when the pattern of features matters more than vector magnitude. A query embedding for how to repair a leaking faucet can land near a passage about fixing a dripping tap even though the two share almost no words.
Closeness is model-defined. It means “similar according to this embedding model and objective,” not “objectively the same.”
Static and Contextual Embeddings
Early static word embeddings assign one learned vector to a word. The word bank therefore receives the same starting representation in river bank and bank account.
Contextual language models build representations using surrounding tokens. BERT was trained bidirectionally, conditioning representations on both left and right context [5]. The representation of bank can therefore differ between the two sentences.
Contextual embeddings help with ambiguity, but they do not ensure perfect interpretation.
Embeddings Inside a Language Model
In a language model, embeddings are the first step of processing, not the last:
- The prompt is split into tokens, and each token ID is looked up in the learned embedding table.
- Position information is added so the model can tell where each token sits in the sequence.
- Transformer layers repeatedly update every token’s vector using information from the other tokens.
After those layers, the vector for bank in “the river bank flooded” can differ from the vector for bank in “the bank approved the loan” [5]. Step 3 is where contextual representations come from, and the Transformers guide that follows explains how it works.
The word embedding can therefore refer to several related objects:
- the model’s learned token-embedding table;
- a contextual vector at an internal layer;
- a sentence or document vector produced for search;
- a multimodal vector representing an image or audio clip.
They share the idea of numerical representation but are not interchangeable.
Where Else Embeddings Appear
Embeddings are also used outside the generation process. Systems use them to find related documents, recommend similar items, group records without fixed labels and spot near-duplicates. How Does AI Find Similar Information When the Words Are Different? Semantic Search and Vector Databases Explained covers how those vectors are stored and searched.
What Embeddings Get Wrong
Embeddings inherit the priorities and problems of their training data and objective. Beyond the stereotype findings above [4], common weaknesses include:
- poor representation of rare language or domains;
- high similarity for text that shares style but not meaning;
- weak performance on negation or fine distinctions;
- a mismatch between what the embedding was trained for and how it is being used.
A few appealing examples do not prove an embedding works. It has to be tested on the task it will actually serve, across the languages, groups and document types involved.
Where This Leads
Embeddings give a model numbers it can work with, but a token’s starting vector does not yet reflect the sentence around it. How Does AI Process a Sequence of Words? Transformers Explained Without the Math shows how Transformer layers turn those starting vectors into contextual representations. Readers who want to compare how different model families use these representations can continue later to the AI Models + Systems chapter.
Practical Takeaways
- Think of embeddings as learned coordinates, not definitions.
- Read “meaning” in an embedding as a pattern of relationships learned from data.
- Interpret closeness as model- and task-dependent similarity.
- Distinguish static word vectors from contextual representations built inside a model.
- Expect embeddings to carry the biases and blind spots of their training data.
- Judge an embedding by task-specific testing, not by attractive visualizations.
Sources
- Efficient Estimation of Word Representations in Vector Space. arXiv, 2013-01-16, accessed 2026-11-08.
- Machine Learning Glossary. Google for Developers, accessed 2026-11-08.
- Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks. arXiv, 2019-08-27, accessed 2026-11-08.
- Man is to Computer Programmer as Woman is to Homemaker? Debiasing Word Embeddings. arXiv, 2016-07-21, accessed 2026-11-08.
- BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. arXiv, 2018-10-11, accessed 2026-11-08.
