Aditya Sridhar

Explainer 5 of 6 · Generative · interactive

Latent space

What does a model need so that every point between two digits makes sense?

Watch

The idea

An autoencoder squeezes an image through a narrow middle, here just two numbers, and learns to rebuild it. The two numbers become coordinates on a map of digits.

A plain autoencoder leaves gaps: points between the training codes decode to nonsense. A variational autoencoder encodes each image as a small cloud, not a point, and is penalised for spreading the clouds out, which fills the map in.

The result is a continuous space: move a point a little and the digit changes a little, which is what lets the decoder generate digits it has never seen.

Try it

Latent space
  1. 0
  2. 1
  3. 2
  4. 3
  5. 4
  6. 5
  7. 6
  8. 7
  9. 8
  10. 9
Decoded from z = (0.00, 0.00)

Or draw a digit

The encoder places your drawing on the map, and the decoder redraws it from those two numbers.

See it trained