A compressed, learned representation where similar data points cluster geometrically.
A latent space is a lower-dimensional mathematical space in which a machine learning model encodes high-dimensional input data into compact, structured representations called latent vectors. Rather than working directly with raw pixels, words, or sensor readings, models learn to map inputs into this abstract space where the coordinates capture meaningful underlying factors — such as shape, style, or semantic content — that govern the data's variation. The geometry of this space is not predefined but emerges from training: similar inputs end up near each other, and smooth paths between points often correspond to meaningful interpolations in the original data domain.
Latent spaces arise naturally in architectures designed around an encoding bottleneck. Autoencoders compress inputs through a narrow hidden layer and then reconstruct them, forcing the network to distill only the most informative structure. Variational autoencoders (VAEs) impose a probabilistic structure on this space, encouraging it to be continuous and well-organized so that random samples from it decode into plausible outputs. Generative adversarial networks (GANs) learn a mapping from a simple prior distribution — typically Gaussian noise — into a latent space whose decoded outputs are indistinguishable from real data. In all these cases, the latent space acts as the model's internal "world model" of the data.
The practical power of latent spaces lies in their manipulability. Arithmetic on latent vectors can produce semantically meaningful results: the classic word embedding example of king − man + woman ≈ queen demonstrates that directions in latent space can encode abstract relationships. In image generation, interpolating between two latent vectors smoothly morphs one face into another. In drug discovery, navigating a molecular latent space allows researchers to explore chemical structures with desired properties without exhaustive enumeration.
Latent spaces have become a unifying concept across modern deep learning, underpinning representation learning, transfer learning, and foundation models. Large language models and diffusion models both operate by learning rich latent representations that generalize across tasks. Understanding and controlling the structure of latent space — ensuring it is disentangled, interpretable, or aligned with human concepts — remains an active and consequential research frontier.