EP 04 · How AI Actually Works
Every Clock Says 10:10? How AI Actually Generates Images — Diffusion, Latent Space & Flow Matching (Every Number Measured)
Diffusion, latent space and flow matching on FLUX.2 and SDXL, and why a 7:25 clock comes out as 10:10.
TL;DR
Image models start from random static and follow a learned velocity field back to a photo, fixing composition first and fine detail last, inside a compressed latent space that makes attention 65,536× cheaper. Text steers the process through a text encoder and classifier-free guidance. Clocks come out at 10:10 because the training photos are full of them, and fast 4-step distilled models snap to that most common mode.
- 3,145,728numbers per image
- 65,536×cheaper attention
- 98.54%path straightness
- 396 ms4-step render
- 19.97×faster than 50 steps
Summary
Part 4 turns from text to pictures, running Black Forest Labs' open FLUX.2 models and Stable Diffusion XL on a 96 GB Blackwell GPU. It starts with three oddities: asked for a clock showing 7:25, the 4-step model drew 10:10 on all 4 seeds; a wine glass “filled to the brim” always stopped about half full; and an empty prompt still produced a portrait, a dining room or a landscape.
To a GPU, a 1024 × 1024 photo is 3,145,728 numbers, and almost every random point in that space is static. Training mixes an image with Gaussian noise along a straight line, and fine detail dies first: at σ = 0.30 only 11.8% of the fur frequencies survive, while 96.8% of the pose and horizon remain. Generation therefore runs the other way, composition first and whiskers last; in the 50-step run the fox even turns its head between Step 4 and Step 8.
The model works in a compressed latent space: 4,096 patch tokens instead of a million pixels, a 65,536× cut in attention cost. FLUX.2's 32-channel VAE keeps small text legible where SDXL's 4-channel one melts it (37.55 dB against 33.24 dB on a text chart). CLIP's 77-token limit silently dropped the last 19 tokens of a long prompt, while FLUX.2 reads prompts with Qwen3-4B. Classifier-free guidance pushes away from the empty-prompt prediction, with w = 4.0 as the sweet spot. Rectified-flow paths measured 98.54% straight, which is why a distilled 4-step model renders in 396 ms, 19.97× faster than 50 steps, and also why it snaps to the most common answer: 10:10.
This page is a short summary written for this site. Every figure, table, code sample and reference is in the original article on Towards AI.
Questions this article answers
Why do AI image generators always draw clocks at 10:10?
Because most clock photos in the training data show 10:10, the time catalogues and stock photographers favour because it frames the logo. In latent space that makes 10:10 a strong attractor for “clock”. Asked for 7:25, the 4-step distilled FLUX.2 model drew 10:10 on 4 of 4 seeds, and even the 50-step base model with guidance 4.0 did so on 3 of 4. Few-step distillation strengthens the pull toward the most common mode.
Why can't AI draw a wine glass filled to the brim?
The training prior wins. Almost every wine glass in photos is poured about half full, so the unconditional prediction pulls hard toward that level. Classifier-free guidance only extrapolates from the empty-prompt prediction toward your prompt, and “filled to the absolute brim” points into a region with almost no training examples. In the article's test, all 4 seeds stopped at roughly 50% full.
How does diffusion turn noise into an image?
Training blends a clean image with Gaussian noise along a straight line and teaches the network to predict the way back. Noise destroys fine detail first: at σ = 0.30, 88.2% of the fox photo's fur and whisker frequencies were gone while 96.8% of the global structure survived. Generation runs this in reverse, fixing composition early, then shape, then texture. A 50-step FLUX.2 run produced the 1024 × 1024 image in 7.91 seconds.
What is latent space in Stable Diffusion and FLUX?
A compressed version of the image made by a variational autoencoder. A 1024 × 1024 picture is downsampled 8× per side and patchified into 4,096 latent tokens, so attention handles 16,777,216 pairs instead of about 1.10 trillion for raw pixels, a 65,536× reduction. How much the VAE keeps matters: SDXL's 4-channel latent melted 12pt text, while FLUX.2's 32-channel latent stayed sharp, scoring 37.55 dB against 33.24 dB.
What does the CFG scale do in AI image generation?
Classifier-free guidance runs the model twice per step, once with your prompt and once with an empty prompt, then pushes the result further in the direction that separates them. In the article's sweep, w = 1.0 looked hazy and muted, w = 4.0 was the sweet spot with 36% more colour saturation, and w = 15.0 produced “deep-fried” neon fur and crushed shadows, because the extrapolation overshoots the space of natural images.
Why does the seed control the layout of an AI image?
The seed fixes the starting grid of random noise, and rectified flow follows a deterministic path from it. Low-frequency bright and dark patches in that noise act like a map for the composition. Holding Seed 42 fixed and changing only “red fox” to “red cat” kept the same horizon, tree and sun, giving a 21.02 dB pixel match and a 0.903 correlation with the fox image.