latent-space -- the compression that makes image generation affordable, and its ceiling

Generating a picture would be unaffordable if the model worked on the actual pixels, because each of the dozens of clean-up passes would have to touch every one of them. So it does not. A separate compressor turns the image into a much smaller sketch first, the whole generating loop runs on that sketch, and only at the very end is it expanded back into pixels. The price is a ceiling nobody talks about: anything the compressor cannot hold — small text, one-pixel patterns, the finest texture — is gone before the first pass, and no amount of extra generating effort brings it back. Squeeze harder and you compute less and lose more; the saving and the loss are the same act.

Interactive page: why a diffusion model can afford to generate an image at all, and the hard ceiling that affordability buys. The whole sampling loop runs inside a compressed space produced by an autoencoder -- and whatever that autoencoder cannot represent is gone before the first denoising step, with no sampler able to recover it.

What it shows

A diffusion loop run on pixels touches every pixel on every step, and a transformer denoiser's attention costs the square of the token count. Latent diffusion pays the pixel-resolution price exactly twice -- encode once at the start, decode once at the end -- and runs the tens of intermediate steps in a latent instead. The page walks that pipeline on a transport:

stepwhat appears
0x -- the source image at full resolution
1encode -- one strided transform per f×f block
2truncate -- everything past channel C is discarded, permanently
3z -- the arena the sampling loop runs in
4diffuse -- every step, in here
5decode -- one pass back to pixels
6the reconstruction floor -- the residual with no diffusion at all

Everything numeric is computed in-page from the reader's own settings -- element counts, the compression ratio, the attention-work ratio, the discarded energy, and a real reconstruction error from an actual encode/decode of the in-page image. Nothing is quoted.

The part worth staying for

Step 6 encodes and decodes with no diffusion at all and draws |x̂ − x|. Set the sampling error to zero -- a perfect loop -- and the residual panel does not go blank. The ceiling bar splits the total error into the irreducible part (the encoder threw it away) and the reducible part (the sampling loop), and only the second one responds to a better sampler.

Small text and fine high-frequency texture are the classic casualties, so the default source image contains both: a 3×5-pixel word, a 1-pixel grating, a smooth ramp and some hard edges, side by side. At the standard 8× / 4-channel setting the text and the grating are the parts that vanish, and they are exactly what lights up in the residual.

The trade, under your hand

Dragging the downsample factor f or the channel count C moves the compute saving and the reconstruction error in opposite directions, live. The trade panel plots every (f, C) the reader can reach as one dot -- x axis compression, y axis floor -- and you can drag along the cloud to jump between operating points. The degenerate corner is instructive: keep every channel of a block and the transform is lossless, the floor is zero, and the compression is 1×. The saving is the loss.

The toy encoder -- stated plainly

There is no trained VAE here and the page does not claim one. The encoder is an orthonormal block DCT-II over f×f blocks, keeping the C lowest-frequency coefficients per block in zig-zag order; the decoder is the inverse transform with the discarded coefficients set to zero. Because the transform is orthonormal, the discarded energy is the squared reconstruction error -- the floor is a sum you can point at, not an estimate, and hovering a basis cell tells you the exact share of the image it carries.

A trained autoencoder differs in every way that matters for the numbers: it learns its basis rather than fixing it, it is not orthonormal, and its adversarial and perceptual objectives deliberately trade measured error for perceived quality -- buying back detail this toy cannot. Read the shape of the trade here, never the exact numbers.

Error is reported against a named baseline

The floor is given as RMSE and as a percent of the 8×/4-channel reference floor, recomputed in-page on the same source image (lower is better; 100% = parity). At f = 8, C = 8 on the default scene that reads 84.2% of the reference; at f = 16, C = 2 it reads 121%.

This recipe is contested -- and the page says so

8× down with 4 channels came from the original latent-diffusion paper stuck for years, but it is not settled, and the page puts the disagreement on screen rather than picking a side:

positionargument
🟡 the latent is too thinThe rectified-flow scaling work raised the autoencoder's channel count and reported better reconstruction and better samples.
🟡 the latent is the wrong kindRepresentation-autoencoder work replaces the VAE with a pretrained representation encoder plus a trained decoder, arguing a purely reconstruction-trained, low-dimensional latent limits generative quality; related alignment work argues representation quality is the training bottleneck.
🟡 the latent is not compressed enoughDeep-compression autoencoders push spatial compression far past 8× and still generate well, trading the other way.
⚪ the metric is not perceptionA trained autoencoder spends adversarial and perceptual loss precisely on what RMSE does not measure, so a floor like this one over- and under-states different failures.

Nobody has settled where the knee is. That is the honest state of it.

Sources

Not this page

The noising/denoising objective itself is diffusion-noise; step counts and sampler choice are diffusion-sampler; conditioning strength is guidance. None of them runs here -- this page is the arena those loops run inside, and the price of the door. The error-versus-compression trade in weights rather than activations is quantization.

Interactions

interactionhow
🟢 transportencode → diffuse → decode as 7 steps, autoplay + loop, ?step=N
🟢 direct manipulationdrag f and C and watch saving and error split; drag the trade cloud to jump to any (f, C)
🟢 paintdrag on x with a brush (fine 1-px checker / bright dot / erase) and watch what survives the round trip
🟢 hoverany latent cell reports its channel, its value, and the exact source block it covers; any basis cell reports its energy share and whether it is kept
🟢 A/B compareC = 4 against C = 16 at the same downsample
🟢 challengesmake the floor vanish; turn the sampler off and watch the residual survive; find a setting past 64×

Render tier

T1 (Canvas2D): five heatmap panels, the ceiling bar, and the trade scatter.

Wiring

layout.mount + controls (scene, down, chan, noise, brush, seed) + animate (the loop shimmer on z) + onPointer for painting and for dragging the trade cloud + hover. URL hooks: ?step ?scene ?down ?chan ?noise ?seed ?brush ?stamp=r,c;r,c ?paint=i,v;i,v ?cell=panel,r,c ?hover=x,y ?ch=N ?compare=1 ?play=1. Source: page.js.