Embedding space
An embedding space is the many-dimensional space in which a model places its embeddings, arranged so that the distance between two points reflects how related the things they stand for are.
When a model turns a word, image or document into a list of numbers, each list can be treated as the coordinates of a point. The embedding space is the space those points live in. Google's Machine Learning Crash Course explains it with food. Put dishes on one axis for how much they resemble a sandwich, add a second for how much they resemble a dessert and a third for how liquid they are, and similar dishes gather together: shawarma lands near a hot dog and farther from apple strudel.
Real embedding spaces have far more dimensions. Google's course says word embeddings often use 256, 512 or 1,024. The axes are also learned rather than chosen, so they rarely mean anything as tidy as dessertness, and the course notes that they are often hard for people to interpret. What carries meaning is the geometry: which points are near each other, and in which direction one lies from another.
The idea became widely known through word2vec, published by Tomas Mikolov and colleagues at Google in 2013. Their paper reported learning high-quality word vectors from a 1.6 billion word dataset in less than a day. Words used in similar contexts ended up close together, and directions in the space captured relationships: in one well known example, the vector for brother minus man plus woman lands closest to sister.
One space can hold different kinds of data. OpenAI's CLIP, released in January 2021, trained one encoder for images and another for text so that matching images and captions end up close together in a shared space. That is what lets a system search photos with a sentence, and the original Stable Diffusion used CLIP's text encoder to turn written prompts into embeddings.
Two practical points follow. An embedding space belongs to the model that produced it, so points from two different models cannot be compared. And closeness reflects what the model was trained to notice. Google's course gives the example of cereal and breakfast sausage, which sit close together in a model about mealtimes but far apart in one about vegetarian food. Nearness in the space means related in the model's eyes, not identical or equivalent.
An embedding is one item's vector, the list of numbers representing a single word, image or document. The embedding space is the whole space those vectors sit in, with its distances and directions. Comparing embeddings only makes sense within one space. Usually nothing a person can name. The dimensions are learned during training, and Google's course notes that they are rarely as clear as a label like dessertness. Meaning comes from the positions of items relative to each other, not from any single coordinate. By distance or angle between vectors. Cosine similarity, which compares the direction of two vectors, is common in search systems, and straight-line distance is also used. Smaller distances or higher similarity scores mean the model treats the items as more closely related. The ideas overlap. Both are learned spaces of numbers that represent data. Embedding space is the usual term for vectors produced to compare or retrieve items, while latent space is more often used for the internal representations a generative model works in.Common questions
What is the difference between an embedding and an embedding space?
What do the dimensions of an embedding space mean?
How is similarity measured in an embedding space?
Is an embedding space the same as a latent space?
Search for "embedding space", "vector space semantics" or "word2vec analogies" to see how the geometry works, and try an interactive embedding projector to explore one visually. Reliable sources include machine learning courses from Google and universities, the original papers on arXiv and providers' documentation for their embedding models. Be careful with striking analogy examples, since they are picked to illustrate the idea and do not always hold across other words.Finding more
Working out what this means for your business?
Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.