Not the same trick as the chatbot
A chatbot commonly writes one token at a time. Images can also be generated sequentially: PixelRNN demonstrated pixel-by-pixel prediction with dependencies on earlier pixels. This lesson follows a different approach, diffusion, which became widely used for image generation in 2022. Rather than choosing an arbitrary first pixel, it begins with noise and repeatedly refines an image.
Learn to reverse added noise
In one illustrative forward-noising schedule, take a photograph and repeatedly add random noise over a thousand steps. At the end, the distribution is made close to pure noise. The exact schedule and endpoint depend on the method; a thousand is an example, not a requirement of every image generator.
Now train a network on the reverse: show it a noisy picture and ask it to predict a useful denoising target, such as the noise that was added. Across many pictures and noise levels, it learns patterns that help turn noisy inputs into plausible images. This does not mean that memorising individual training pictures is impossible.
Generation starts with noise and applies that learned denoising skill repeatedly. After the chosen sampling steps, an image emerges; the number of steps depends on the model and sampler. The result can be new, but some diffusion models can reproduce training examples. The technical name comes from diffusion, and influential papers developed the approach in 2015 and 2020.
Why it works at all
The picture comes from a learned generative process. Training on many noise levels teaches the network patterns that guide reverse steps toward the training distribution. Starting from noise and sampling those steps can produce a plausible image. It is a helpful simplification to call this finding structure in static, but the model is not recovering a hidden original photograph, and each step need not merely sharpen a fixed earlier interpretation.
The trick that made it cheap
Stable Diffusion became publicly available in August 2022 using latent diffusion. An autoencoder maps a picture to a smaller representation: in a familiar 512-pixel-square setup, that representation has 64-by-64 spatial locations. Denoising happens there, and a decoder returns it to pixels. That grid has one sixty-fourth as many spatial locations; compute and memory savings also depend on channels, architecture and the sampling pipeline. Running the software still requires suitable hardware or a hosted service; no particular image price follows from the grid ratio.
How words come in
The description above draws a random picture. To draw your picture, the noise-removal network is given the text as well, at every step, and steers toward an interpretation of the static that matches it. How the text is turned into something the network can use, and why the prompt works the way it does, is the next lesson.
Where to try it
Image products include Midjourney, Adobe Firefly and image generation inside chatbots. Their capabilities and underlying designs vary by version. Diffusion is one important approach, not the architecture of every named tool: OpenAI describes its 2025 native 4o image generator as autoregressive. Check a product’s documentation instead of inferring its architecture from the interface.
An open-weights path can provide more control over a particular model. Stable Diffusion and some Flux releases provide downloadable weights, with different licences. Fooocus documents SDXL support; ComfyUI and Krita integrations have their own supported models and requirements. Selected small or optimised setups may work with four gigabytes of graphics memory, while CPU-only generation can be much slower. Verify the exact model, hardware, licence and hosted-notebook limits; no fixed couple-of-minutes runtime or free hosting is guaranteed.
What the mechanism cannot do
Learning image patterns does not guarantee exact object counts or arrangements. Ask for three cats and inspect the result: two or four cats is still a failure, however convincing the fur looks. Changing a prompt can also change details you wanted to keep. Masks let editing tools restrict an edit to a chosen region, but the result still needs checking. Diffusion models are not ordinary photo-retrieval systems, yet researchers have extracted reproductions of training pictures from some of them; do not assume that generation rules out memorisation.
Check your understanding
In the diffusion setup described in this lesson, a model produces a convincing photograph from pure random noise. Where does the picture come from?
Pick the one you would defend. Your answer stays private.
Your place and first choices stay on this browser. Classroom credit is recorded separately.
Stuck on something?Ask Meenal, your AI tutor