← All posts
AI

AI Images Aren't Painted, They're Un-Noised — Here's How Diffusion Models Actually Work

AI Images Aren't Painted, They're Un-Noised — Here's How Diffusion Models Actually Work

AI Images Aren't Painted, They're Un-Noised — Here's How Diffusion Models Actually Work

Type a prompt into Midjourney, DALL-E, or Google's Gemini app and a few seconds later you have a photorealistic image that never existed before. It feels like magic, or at least like some digital painter working behind the curtain. It isn't. The model isn't painting anything. It's doing the opposite: starting with a canvas of pure random static and slowly, mathematically, scrubbing the noise away until a picture is left behind.

That technique is called diffusion, and it quietly became the backbone of almost every major AI image and video generator released in the last four years — Stable Diffusion, DALL-E 2 and 3, Midjourney, Google's Imagen and Veo, and OpenAI's now-discontinued Sora. Understanding how it works also explains something that just happened in the industry: why OpenAI pulled the plug on Sora this year, only months after launching it.

Learning by Destroying, Then Rebuilding

Diffusion models are trained backwards. Researchers take a real photo and add a little random noise to it, then a little more, then more again, in hundreds of small steps, until the original image is indistinguishable from TV static. The model's only job during training is to learn how to undo one of those steps — to look at a slightly-too-noisy image and predict what the slightly-less-noisy version looked like.

Do that enough times, across millions of images, and the model becomes very good at denoising. The breakthrough insight, formalized in a widely cited 2020 paper on "denoising diffusion probabilistic models," was that if a network can reliably remove noise step by step, you can run the whole process in reverse starting from nothing but noise. Feed it pure static, ask it to denoise, repeat the process a few dozen or a few hundred times, and a coherent image gradually resolves out of the chaos. No sketch, no brushstrokes — just incremental statistical cleanup.

The Shortcut That Made It Affordable

Early diffusion models were accurate but painfully slow and expensive, since each of those hundreds of denoising steps meant running a full neural network pass over a full-resolution image. The fix that made consumer-grade tools like Stable Diffusion possible, introduced by researchers at LMU Munich and Stability AI in 2022, was to stop diffusing in pixel space altogether. Instead, images are first compressed into a much smaller mathematical representation — a "latent space" — and the noise-and-denoise dance happens there instead, before a separate step decodes the result back into a full image. That single change cut the computing cost dramatically, which is the main reason image generation went from something only well-funded labs could run to something that works on a gaming laptop.

How a Prompt Actually Steers the Noise

None of this explains how typing "a cat wearing a spacesuit on Mars" produces that specific image rather than random noise forever. The answer is cross-attention: alongside the image data, the model also processes your text prompt through a language model, turning it into a set of embeddings. At every denoising step, the image-generation network checks those embeddings and nudges its guess in their direction, repeatedly, until the final image reflects the prompt rather than nothing in particular. A related technique called classifier-free guidance lets the model compare what it would generate with and without the prompt, then exaggerate the difference, which is largely why increasing the "guidance scale" slider in these tools makes outputs look more literal and more saturated.

From Stills to Moving Pictures — and Why That Got So Expensive

Video is just diffusion with an extra dimension: instead of denoising a 2D grid of pixels, the model denoises a block of space and time, frame after frame, while keeping it consistent. Google's Veo 3, unveiled at I/O 2025, extended this further by generating synchronized audio alongside the visuals, and this year it rolled out inside the Gemini app across the Middle East, as Gulf News reported when covering the regional launch. OpenAI took a similar approach with Sora, which it described as a diffusion transformer that denoised compressed "spacetime patches" to produce up to a minute of video.

But video diffusion multiplies the cost problem that latent diffusion was invented to solve for images. More frames, more denoising steps, more compute, at a much larger scale than a single picture. That cost appears to be exactly why OpenAI shut Sora down this past March — barely six months after its splashy launch — reportedly reallocating the GPU capacity it had been burning on video generation toward coding and reasoning models instead. It's a reminder that the "magic" behind these tools is really a very literal trade of electricity and silicon for denoising steps, and that trade doesn't always pencil out, even for a company flush with cash.

Where This Leaves Things

Diffusion isn't going anywhere — it remains the dominant approach behind nearly every serious image and video model on the market, and Google continues to iterate on Veo rather than retreat from video generation. But Sora's shutdown is a useful data point for anyone assuming these capabilities only ever get cheaper and more available by default. The underlying math is well understood and unlikely to change soon; what's still being worked out is who can afford to run it at scale, and for how long. Faster sampling methods that need far fewer denoising steps than the original hundreds, along with smaller "fast" model variants, are the current answer to that cost problem — and probably the next thing to watch as the technology matures beyond its current, electricity-hungry adolescence.

Read next