Generative Models · 5 Interactives

A Whole Face, Compressed to Two Numbers

Every image a generative model makes starts as a short list of numbers — a point in latent space. Move the point, and the image changes. Below, a hand-built decoder turns two coordinates into a face, live, so you can feel what "generation = picking a point" really means — and wander into the regions where it falls apart.

The latent pad Walking = morphing Neighborhoods Holes & dead zones Entangled knobs
EP 01

Two numbers are a whole face — drag the point, meet the decoder

The square on the left is a 2D latent space. Every point in it is a compressed description of an image: here, the x-axis means roundness and the y-axis means size. The decoder on the right expands those two numbers back into a full picture. Drag the gold point anywhere — the face is redrawn from scratch on every frame, purely from (x, y).

The decoder here is hand-coded (two numbers → drawing rules) so you can see the idea clearly. In a real model, a neural network learns this mapping from millions of images — and its latent space has hundreds of dimensions, not two.

Why it matters: Stable Diffusion never paints pixels directly — it works on a latent code roughly 48× smaller than the image, and a decoder expands it at the end. Compression into a few meaningful numbers is what makes generation cheap enough to run at all.
EP 02

Walking through latent space — morphing is just moving

Pick two points, A and B, and slide between them. There is no "morph algorithm" anywhere — the smooth transformation you see is nothing but the decoder being fed points along a straight line. If the space is well organized, every step of the walk is itself a valid image.

Every in-between face is decoded live from the interpolated coordinates — nothing is blended in pixel space.

Why it matters: those viral "face A morphs into face B" videos from GANs are exactly this — a straight line walked through latent space, decoded frame by frame. Smooth interpolation is the classic test that a model learned structure, not just memorized examples.
EP 03

Good neighborhoods — nearby points, nearby faces

A healthy latent space has two properties you can check by eye: neighbors look alike, and every direction means something (right = rounder, up = bigger — everywhere, consistently). Below is a 5×5 grid of decoded points around a center. Widen the neighborhood and watch variety grow smoothly instead of jumping randomly. Drag on the mini-map to move the whole neighborhood.

Similarity is computed live: the average difference in decoded properties (roundness, size) between each neighbor and the center. Points beyond the edge of the space are clamped.

Why it matters: "neighbors look alike" is what makes latent search possible — recommendation engines, face editing tools and image variations all work by taking a known point and exploring around it. If small moves caused wild jumps, none of that would work.
EP 04

The holes — wander into the regions that decode to garbage

Nobody promises the whole space is meaningful. If the encoder only ever placed training images in some regions, the decoder never learned what the gaps mean — sample a point there and you get junk. The hatched red zones below are such dead zones. Drag the point around: inside them, the decoder produces noise instead of a face.

Dead-zone shapes are illustrative, but the coverage percentage is measured live by probing a 40×40 grid of latent points against the zones.

Why it matters: this is the classic failure of plain autoencoders — great reconstructions, useless as generators, because random points land in holes. VAEs fix it by forcing every training image to claim a fuzzy region instead of a single point, which is exactly the "regularize" button you just pressed.
EP 05

Entangled knobs — when one dial secretly moves two things

Ideally each latent dimension controls one property. But nothing forces a model to learn axes that line up with human concepts — often a direction changes several things at once. Same two knobs, two decoders: in the entangled one the axes are rotated, so knob 1 drags roundness and size together. Move a knob in each mode and read the measured change.

move a knob to measure its effect

The "entangled" decoder is the same decoder with its latent axes rotated 38° — a faithful stand-in for how real models mix concepts across dimensions.

Why it matters: entanglement is why naive latent editing gives you "make her smile" that also changes hair color. StyleGAN's celebrated W space and disentanglement research (β-VAE and friends) exist precisely to make one knob mean one thing.
Keep playing
Generative Models
Diffusion Models
Painting by un-destroying
Generative Models
VAE & the Reparameterization Trick
Backprop through a dice roll — with one line of algebra