Generative Models · 5 Interactives

The Space Between Two Faces

Crossfade two photos and you get a ghost. Ask a generative model to go between them and you get a third face that never existed. The difference is where you take the walk: not through pixels, but through latent space — the model's compressed map of everything it knows. Drag the sliders below and feel the difference in your hands.

Pixel vs latent The map is real Lerp vs slerp Off the manifold Latent arithmetic
EP 01

Two ways to morph — blend the pixels, or walk the space

Both panels go from face A to face B as you drag. The left panel does it the naive way: crossfade the pixels — image A fades out while image B fades in. The right panel interpolates the latent parameters that generated the faces (eye size, mouth curve, face width…) and redraws one face from the blended parameters. Park the slider at the middle and count the eyes on each side.

The "latent space" here is 6 hand-made face parameters. A real generator (StyleGAN, a VAE) learns hundreds of such dials from data instead of being given them — but interpolation works the same way.

The core idea: pixels are the wrong coordinates for meaning. At t = 0.5 the pixel blend shows four eyes and two mouths — a double exposure, not a face. The latent walk shows one valid face at every step, because every latent point decodes to a whole image. This is exactly why face-morph videos are made with StyleGAN, not with Photoshop opacity.
EP 02

The map is real — every point in latent space is a picture

Here is a whole 2-D latent space, decoded: each thumbnail on the grid is what the decoder produces at that coordinate. One axis controls spikiness, the other controls ripple. Drag the A and B handles anywhere, then slide t — the big shape on the right is the decode of the point walking the straight line between them. Notice there are no gaps: the line never crosses a "broken" region.

This decoder is a smooth hand-built function of (u, v), so the whole square is well-behaved — the ideal case a well-trained generative model tries to approach. EP 04 shows what happens when it isn't.

Why this matters: when a latent space is smooth and densely covered by training data, any straight line through it is a valid animation — that's the good case interpolation relies on. Every "AI morphing" video you've seen is literally this: pick two points, decode the line between them, one frame per step.
EP 03

Don't tunnel through the sphere — lerp vs slerp

Real latent vectors are high-dimensional Gaussians, and those concentrate on a thin shell of radius √N — almost no training sample ever lives near the center. A straight line (lerp) between two shell points cuts through the hollow middle, where the decoder has seen nothing. Spherical interpolation (slerp) walks along the shell instead. Drag t to the middle and compare the two decoded textures — the lerp one goes washed-out and grey, live, with its actual norm printed below.

The vectors are genuine 48-dimensional Gaussian samples and all norms are computed live. The decoder is a toy (texture contrast follows ‖z‖, cubed so your eye can see it), but the norm collapse at the lerp midpoint is the real mathematical effect.

Rule of thumb the pros use: when interpolating Gaussian latents or diffusion noise seeds, use slerp. In Stable Diffusion seed-morphing scripts, lerp gives dim, low-contrast middle frames for exactly the reason you just measured: the midpoint's norm drops to ~71% of the shell, into territory the model was never trained on.
EP 04

Falling off the manifold — when the midpoint is garbage

Interpolation is only as good as the space. Compare two decoders trained on the same two shape families (flowers and gears). The well-trained one saw examples between the clusters, so its space is smooth. The badly structured one has a hole in the middle of its latent space — no training data ever landed there. Slide through the midpoint in both modes and watch the decode.

Both decoders are hand-made stand-ins. The "broken" one adds decode noise proportional to distance from the two training clusters — a caricature of what early VAEs and GANs really do between poorly-connected modes ("holes" in the latent space).

The honest failure: interpolation assumes every point on the line decodes to something sensible. When the latent space has holes — disconnected clusters, dead zones — the midpoint is off-manifold junk: not flower, not gear, just noise with an outline. This is why papers obsess over latent space structure (KL terms in VAEs, mapping networks in StyleGAN): they're buying smooth in-between points.
EP 05

Latent arithmetic — add a smile, subtract a frown

Interpolation's famous cousin: directions in latent space are attributes. Subtract a neutral face's latent from a smiling face's latent and you get a "smile vector". Add k copies of it to any face. At k ≈ 1 it works beautifully. Now drag k to 3, or to −2: the parameter dials get pushed past every value the decoder was trained on — watch the dials on the right leave their valid bands and the face break.

Each dial's grey band is the range seen in "training". The face is drawn from the raw arithmetic result with no clamping — what you see at k = 3 is genuinely what the equation produces.

Same lesson, third costume: walking latent space works while you stay near the data manifold — interpolation stays between known points, so it's safe; extrapolation (big k) marches straight off the edge. The classic "king − man + woman ≈ queen" and GAN "add glasses" demos live in the safe zone; every over-cranked attribute slider you've seen produce a melted face fell off it.
Keep playing
Generative Models
Mode Collapse
The forger learns one trick and makes only that
Generative Models
The U-Net Denoiser
Why diffusion's denoiser is shaped like a U