AI Glossary

Latent Space

A latent space is the space of internal codes or variables a model uses to represent data. Its dimensions and geometry depend on the model and training objective; it need not be smaller than the input or neatly organized by human meaning.

· Updated · Chain of Thought

Model Architecture

An autoencoder can map a handwritten digit image to a code, then use a decoder to reconstruct an image from that code. In Keras’s variational autoencoder example, the code has two dimensions, so points can be plotted and decoded into a grid of generated digits.

The code’s coordinates are not necessarily labels such as “roundness” and “slant.” Training shapes the representation to serve its objective. Moving between points can produce changing outputs, but arbitrary points are not guaranteed to decode into meaningful examples. A two-dimensional teaching example is also not evidence that all latent spaces have two dimensions.

This matters when interpreting similarity. An embedding is a representation of an item; the space describes the possible representations and their relationships. Nearby points may be useful for retrieval, but distance only reflects the learned representation and chosen comparison. Test whether that neighborhood captures the distinctions your task needs.

An image becomes a code, then an imageAn illustrative autoencoder maps a handwritten digit image through an encoder into a two-dimensional latent code and a decoder reconstructs an image. A dot is one code, and the axes are coordinates without predefined human meanings. Latent spaces can have many more dimensions. An image becomes a code, then an image A two-dimensional teaching example, not a universal shapeInput image7EncodercodeCoordinate 1Coordinate 2DecoderOutput7Training shapes the code to serve the model’s objective.A coordinate need not mean “slant” or “roundness.”
Inspired by Keras’s two-dimensional variational autoencoder example. The point and digit are illustrative; other latent spaces can have many more dimensions. Download the image

Sources

Go deeper

From the conversation