Architecture · Generative media
How AI Image Generation Works: Diffusion, Latent Space And Transformers
The short answer
Most AI image models are diffusion models: they learn to turn random noise into an image step by step, guided by a text prompt. Modern systems do this in a compressed latent space with a transformer backbone, then decode the result into pixels. Newer models such as GPT Image generate images natively inside a multimodal language model, which improves text rendering and instruction-following.
By Maitreya Kulkarni · Updated · 12 min read
01 · The architecture
How Does A Latent Diffusion Model Turn A Prompt Into An Image?
The prompt is encoded into vectors, a random latent is created, and a denoising transformer refines that latent over a number of steps, steered by the prompt and any control signals. A decoder then turns the finished latent into pixels, which pass through safety checks and optional upscaling.
NX-AR-09 · Architecture
A latent diffusion image model
- Outside world
- Data & integration
- AI agent
- System of record
- Your people
- L1
Inputs
(Outside world)Text prompt
. Hands work to: Text encoder.Reference image
Optional
. Hands work to: Image encoder.Control signal
Pose, depth, edges
. Hands work to: ControlNet and LoRA.
Passes down: prompt and references - L2
Encode
(Data & integration)Text encoder
CLIP, T5 or an LLM
. Hands work to: Denoising transformer.Image encoder
VAE: pixels → latents
. Hands work to: Denoising transformer.ControlNet and LoRA
Structure and style
. Hands work to: Denoising transformer.Noise
A random latent
. Hands work to: Denoising transformer.
Passes down: conditioning - L3
Denoise
(AI agent)Denoising transformer
Predicts noise or velocity, N steps
. Hands work to: VAE decoder.
Passes down: a clean latent - L4
Decode
(Data & integration)VAE decoder
Latents → image
. Hands work to: Safety checks, Upscaler.
Passes down: pixels - L5
Finish
(System of record)Safety checks
Policy classifiers
Upscaler
Higher resolution
Final image
With provenance metadata
02 · Diffusion
How Does Diffusion Turn Noise Into An Image?
During training, images are progressively corrupted with noise and the model learns to undo one step of that corruption. At generation time it starts from pure noise and applies what it learned repeatedly, guided by the prompt, until an image emerges. Flow-matching models learn a straighter path from noise to image, so they need fewer steps.
Forward process
Noise is added to training images in many small steps until nothing of the image is left.
Learned reverse process
A network learns to predict and remove the noise at each step, conditioned on the text.
Flow matching
Models such as Stable Diffusion 3 and FLUX learn a direct, straight-line flow from noise to data, enabling fewer steps.
Classifier-free guidance
The model is run with and without the prompt and the difference amplified, trading variety for prompt adherence.
03 · Latent space
Why Do Image Models Work In A Latent Space?
Because pixels are expensive. A variational autoencoder compresses an image into a latent grid many times smaller while keeping what matters visually; diffusion runs on that grid, and the decoder restores full resolution at the end. This idea, latent diffusion, is what made models like Stable Diffusion practical.
Compression
A typical autoencoder reduces each side of the image about eight times before diffusion begins.
Cheaper steps
Every denoising step works on far fewer values, so steps are fast and resolution can be high.
Decoder quality
Fine detail like text and faces depends heavily on the autoencoder, which is why newer models invest in better ones.
04 · Backbones
U-Net Or Diffusion Transformer?
Early models used a convolutional U-Net as the denoiser. Diffusion transformers (DiT) replace it with a transformer over patches of the latent, which scales more predictably with compute and data. Most leading image and video models now use transformer backbones, often with joint attention between text and image tokens.
Patches as tokens
The latent is cut into patches that a transformer treats like words in a sentence.
Joint attention
Multimodal DiT designs let text and image tokens attend to each other in the same layers, improving prompt adherence.
Scaling
Bigger transformers trained on more data improve quality in a predictable way, as language models do.
05 · Control
How Do You Control And Customise Generated Images?
With extra conditioning and light fine-tuning. Control networks steer structure from a pose, depth map or sketch; small adapters teach a style, product or person from a few images; and editing models change only the region or attribute you ask for.
ControlNet
A trainable copy of the encoder injects structure such as edges, depth or pose into generation.
LoRA and DreamBooth
Small adapters learn a style, product or character from a handful of images.
Inpainting and editing
Masks or instructions change part of an image and keep the rest, the basis of most commercial workflows.
Reference images
Image prompts and character references keep products and people consistent across shots.
06 · The landscape
Which Image Models Matter In 2026?
Several, each with a different strength, and the order changes month to month. As of October 2026, the leading families include OpenAI's GPT Image, Google's Gemini image models (Nano Banana), Black Forest Labs' FLUX, ByteDance's Seedream and Midjourney.
| Family | Maker | Known for |
|---|---|---|
| GPT Image | MakerOpenAI | Known forNative multimodal generation; text and instruction-following |
| Nano Banana (Gemini image) | MakerGoogle | Known forFast generation and consistent editing |
| FLUX | MakerBlack Forest Labs | Known forFlow-matching transformer; open-weight variants |
| Seedream | MakerByteDance Seed | Known forHigh-resolution, photoreal output |
| Midjourney | MakerMidjourney | Known forStylised, art-directed images |
| Stable Diffusion 3.5 | MakerStability AI | Known forOpen MMDiT models for self-hosting |
The ecosystem
GPT Image
Gemini
Seedream
Hugging Face
PyTorch
NVIDIA
Sources and further reading
- [1]Ho et al., Denoising Diffusion Probabilistic Models (2020)
- [2]Rombach et al., High-Resolution Image Synthesis with Latent Diffusion Models (2022)
- [3]Peebles and Xie, Scalable Diffusion Models with Transformers (DiT, 2023)
- [4]Esser et al., Scaling Rectified Flow Transformers for High-Resolution Image Synthesis (SD3, 2024)
- [5]Zhang et al., Adding Conditional Control to Text-to-Image Diffusion Models (ControlNet, 2023)
- [6]Ho and Salimans, Classifier-Free Diffusion Guidance (2022)
- [7]Black Forest Labs
- [8]ByteDance Seed


