Latent space

A latent space is a compressed space of numbers learned by a model, in which each input becomes a point and similar inputs sit close together.

Inside a model, a word, an image or a sound is not stored as itself. It is turned into a list of numbers, which can be read as the coordinates of a point. The space those points live in is a latent space, latent meaning hidden: the coordinates are not measured directly but learned from the data. Training arranges the space so that similar items end up near each other. Google's machine learning glossary treats latent space as another name for embedding space.

A latent space usually has far fewer dimensions than the raw data, so it works as a form of compression. Stable Diffusion, for example, turns a 512 by 512 colour image of 786,432 numbers into a latent of 4 by 64 by 64, or 16,384 numbers, and does its image generation there before decoding back to pixels.

Word embeddings give the clearest example. Word2vec, released by Tomáš Mikolov and colleagues at Google in 2013, places words in a space where relationships show up as directions. Take the vector for brother, subtract man, add woman, and the nearest word is sister. Variational autoencoders learn latent spaces that can be sampled from directly, so picking a new point and decoding it produces a new example that resembles the training data.

What the individual dimensions mean is usually not obvious. Interpreting latent spaces is an active research area; the axes rarely line up with human concepts, and distances have no physical units. Tools such as t-SNE flatten a space into a two-dimensional picture for people to look at, but the picture distorts the real geometry.

When a company says a model reasons, searches or generates in latent space, it means the work happens on these internal number representations rather than on visible words or pixels. That can be efficient, but it is also harder for people to inspect.

Common questions

What is latent space in simple terms?

It is the internal map a model builds, where each input is a point and similar inputs are placed close together. The model does much of its work on these points instead of on the raw words, pixels or sounds.

Is latent space the same as embedding space?

In everyday machine learning use, yes. Google's glossary lists latent space as a synonym of embedding space. People tend to say latent space when talking about generative models and embedding space when talking about search and retrieval.

Why is it called latent?

Latent means hidden. The coordinates are not features anyone measured directly; the model learns them from patterns in the data during training.

Can humans understand a latent space?

Only partly. Some directions turn out to match recognisable properties, but most dimensions do not correspond to simple human concepts. Visualisation tools help, though they distort the space when they flatten it to two dimensions.

Finding more

Search for "latent space", "embedding space" or "latent space interpolation" together with a model type such as autoencoder or diffusion. Reliable sources include machine learning course material from universities and providers such as Google, the original papers on arXiv, and encyclopedia articles that cite them. Be cautious with claims that a model's latent space proves it understands concepts; that is an interpretation, not a measurement.

  • Latent spaceReferenceDefinition, examples such as Word2vec and variational autoencoders, and the limits of interpretation.
  • Machine Learning Glossary: latent spaceReferenceGoogle's entry treating latent space as a synonym of embedding space.
  • Word2vecReferenceHow word2vec places words in a vector space where analogies appear as arithmetic.
  • Latent diffusion modelReferenceA worked example of an image compressed into a latent representation for generation.

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.