Skip to content

Start here · a guided experiment · about 5 minutes

How does AI make an image?

Watch random noise become a lighthouse. Then discover why the same words can produce different pictures. All you need is a slider and your curiosity—no background in AI required.

Learn three ideas: prompts, noise, and denoising

Your first experiment: from noise to a lighthouse

no math or coding needed

01 · Give it a description

We asked an AI image model—a program trained on examples—to make this:

“A lighthouse on a rocky cliff at dusk, dramatic golden clouds, crashing waves, oil painting.”

That written request is called a prompt.

Before you try: will the picture appear all at once? Move the slider or choose a stage to find out.

Starting noise A, step 0 of 20. A field of colored static. There is no recognizable lighthouse yet.
Starting noise AStep 0 of 20

Drag the slider, use its arrow keys, or choose a stage above.

Compare finished images

A field of colored static. There is no recognizable lighthouse yet.

02 · Watch it take shape

Move from Start to Finished image. The model begins with random static, called noise, and removes it over several steps, guided by the prompt. This process is called denoising.

03 · Change the starting point

Keep the same prompt and model, but start with different noise. Predict what will change, then compare these two finished images.

You’re replaying images recorded from real Stable Diffusion 1.5 runs. Moving the slider reveals saved steps; it doesn’t generate a new image on your device.

Quick check: does the same prompt always produce the same image?

Choose an answer to check your intuition. You can change it or revisit the images at any time.

You’ve met three ideas: a prompt describes the image, noise is the starting point, and denoising turns it into a picture over several steps.

Curious how the model learned to do that? Keep reading below. For a different experiment, try finding patterns in pixels.

Next experiment: how computers find edges →

How did it learn to remove noise?

During training, an image model practices on examples: add noise to an image, then learn to estimate the noise that was added. Across many examples, it learns patterns that help it do this for new inputs.

When making a new picture, it starts with random noise and uses those learned patterns, guided by your words, to remove noise step by step. There is no finished lighthouse hidden in the starting static.

This demonstration uses a model called Stable Diffusion 1.5. Other image models can use different methods; the experiment shows this particular process.

Open the full lab and technical explanationsThe Denoising Deck · compare model views, explore the math, and try more experiments

Research behind this lesson: Denoising Diffusion Probabilistic Models (Ho et al., 2020) and Latent Diffusion Models (Rombach et al., 2022). These papers are technical; the guided experiment above is the starting point.

fig. 01 — one ddim run, 21 states, three ways to look at each

§1

Forward diffusion: noise is the curriculum

Diffusion training never shows the model how to paint — it shows it ruined paintings. Take an image, mix in gaussian noise at a randomly chosen severity t, and ask one question: “what noise was added?” The schedule ᾱ controls severity: near t=0 the image is barely touched, near t=1000 nothing of it survives. One network learns the whole range — denoising a nearly-clean image teaches texture, denoising near-static teaches composition.

The figure runs the real corruption formula on a toy scene. Notice the curve: destruction is scheduled, not linear — ᾱ falls slowly at first, then dives. And because the closed form jumps straight to any t, training never has to walk there step by step. That convenience is the whole reason the math works at scale.

§2

Reverse diffusion: sampling runs the film backwards

Generation is the inverse loop: start from pure noise, and twenty-odd times in a row, predict the noise and remove a scheduled slice of it. That’s the loop your ComfyUI KSamplerThe recipe deciding how big each denoising step is and how many to take (DDIM, Euler, and friends). runs, and it’s what the deck’s canvas view shows: the actual state, still snowy until surprisingly late.

The deck’s guess view is the revealing one. Because the model predicts the noise, you can algebraically peek at what it currently believes the finished image is — by state 5 of 20 it has already committed to a lighthouse, a cliff, and a dusk sky, and the remaining steps only sharpen the verdict. Composition is decided early at high noise; detail is negotiated late at low noise. That’s also why so many ComfyUI tricks — refiners, hi-res passes, prompt scheduling — split the run into an early “layout” phase and a late “rendering” phase.

§3

CFG scale: the prompt's volume knob

Station 04 showed where the prompt enters: cross-attention, the denoiser reading your words through CLIP. Classifier-free guidanceClassifier-free guidance: the knob deciding how hard each denoising step is pulled toward your prompt. decides how loudly. Each step the model predicts twice — once with your prompt, once with an empty one — and CFG extrapolates past the unconditioned guess in the direction your prompt pulls: output = uncond + cfg·(cond − uncond).

The strip is the same starting noise at four volumes. At 1 the prompt is a whisper and the model paints whatever the noise suggested. At 12 every step is yanked so hard toward “lighthouse, dramatic, golden” that contrast clips and sameness sets in. The 7–8 default is a truce, not a law — knowing what the knob actually does is what lets you break it on purpose.

§4

Latent space is a place

None of this happens on pixels. A VAEThe encoder/decoder pair that squeezes images into the compact working format and inflates results back to pixels. compresses each 512×512 image into the 64×64×4 tensorJust a grid of numbers — possibly with more than two dimensions. you saw in the deck’s raw latent view — 48× smaller — and the U-NetThe network shape doing the denoising work in Stable Diffusion — it sees the image at several zoom levels at once. denoises there; only the final latentA compressed stand-in for an image: a much smaller grid of numbers the model works on instead of raw pixels. gets decoded back to pixels. That compression is why this runs on a desktop GPU at all, and it’s the “latent” in latent diffusion.

The walk shows the deeper property: interpolate between two seeds’The number that picks the starting static — same seed, same prompt, same settings → the exact same image. starting noise and sample each point fully, and every stop along the path is a coherent scene — the lighthouse relocates, the clouds renegotiate, nothing ever tears. Generative latent spaces aren’t lookup tables of memorized images; they’re smooth maps where neighborhoods mean something. Station 01’s nearest-neighbor lab had no such geometry — this is what eighty pages of gradient descent buys.

§5

LoRA: fine-tuning on a budget

Teaching a checkpoint a new style shouldn’t require rewriting all 860 million weights, and LoRAA small add-on file that nudges a big model's weights toward a new style — learned cheaply by betting the change is simple.’s bet is that it doesn’t: the change a fine-tune needs is low-rankHow many independent directions a grid of numbers really uses — low rank means a few patterns explain almost everything. — a coordinated nudge along a few directions, not 860M independent edits. So instead of learning ΔW directly, a LoRA learns two skinny matrices A and B whose product is the update, at a tiny fraction of the parameters.

The lab makes that bet visceral with a 16×16 “update”: slide the rank and watch the bolt survive at r=3 — 96 numbers doing the work of 256. Scale the same ratio to a U-Net’s attention layers and you get the 10–200 MB LoRA files in your ComfyUI folder standing in for multi-gigabyte checkpoints. Every slider you’ve dragged on this site — k, learning rate, heads, rank — has been the same lesson: capacity is a dial, and knowing where it lives is the skill.

all five instruments live

That’s the journey: a line through a cloud of points, bent by activations, composed into vision, bound by attention, and finally run in reverse until static becomes a lighthouse. The best next instrument is a real one — open ComfyUI and watch these ideas operate at full scale.

Track II · The Operator’s Manual

Everything above opened the machines. There’s a second track for what comes after: driving them — prompting, sampling, feedback loops, and wiring agents into systems. It starts with one question the whole discipline hangs on: who closes the loop?

Next track · O1

Prompt · Loop · AgentThe Feedback Bench

One question separates them: who closes the loop?