
What is Latent Space?
Latent space is the internal representation space that a neural network learns β a compressed, abstract mathematical space where data points are mapped to coordinates (vectors) that capture their essential features and relationships. It's where a model's "understanding" lives.
Why It Matters
Latent space is the key to how AI models represent and reason about the world. Embeddings, which power semantic search and RAG, are points in latent space. Diffusion models generate images by navigating latent space. Understanding latent space explains why similar concepts cluster together in LLMs and why models can generalize to new inputs.
How It Works
When a neural network processes data, it transforms raw inputs (pixels, words, audio) through successive layers into increasingly abstract representations. The intermediate representation β often the output of an encoder or hidden layer β lives in latent space.
Properties of latent space:
- Dimensionality β typically has hundreds or thousands of dimensions (e.g., 768 or 1536 for text embeddings)
- Semantic structure β similar concepts are close together. "King" and "queen" are near each other; both are far from "banana."
- Arithmetic β meaningful operations are possible: king β man + woman β queen (the famous Word2Vec example)
- Continuity β small movements in latent space produce small changes in the output, enabling smooth interpolation
Applications: