Diffusion Models and Image Generation
A diffusion model creates images by learning to remove noise: it trains on images progressively degraded into static, then generates by running that destruction backward, from random noise to finished picture, guided by a text prompt. This is the technique behind Stable Diffusion, FLUX, DALL-E, and Midjourney.
itArtificial intelligence and machine learning | OpenSkills.info
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Don't Panic
Don't Panic — Diffusion Models and Image Generation
The honest sentence first: an image generator of the modern kind is a neural network that spent its education learning to destroy pictures, and now earns a living doing the reverse. You hand it static, it hands you back a photo of a cat in a spacesuit. Nobody fully agrees on why it works as well as it does, which is either alarming or delightful depending on your relationship with contingency.
Before these models, text-to-image meant GANs, systems that trained a forger and a detective against each other until the forgeries got good. GANs were temperamental and collapsed if you looked at them wrong. Diffusion arrived, quietly beat them on image quality in 2021, and became the architecture everything else is built on.
Three ideas carry the whole field.
Denoising. Training adds noise to images in small steps until nothing but static remains. The model learns to remove that noise one step at a time. Generating an image means starting from static and walking backward along the path destruction would have taken. That is genuinely the whole invention. Everything else is plumbing around it.
Latent space. Doing this on raw pixels needs serious hardware. The trick that put it on ordinary GPUs: compress the image first, do all the denoising in the compressed version, then expand it back. Nearly every open model you will meet is this trick wearing different clothes.
Guidance. Left alone, the model produces plausible but unsteered images.
The prompt biases each denoising step toward your description, and
guidance_scale controls how hard it pushes. Higher values obey you more
and get more repetitive; push far enough and colors saturate into
something a sunburn would envy. The lesson, which holds for almost every
control in this field: it is a tradeoff dial, not a quality dial.
What will surprise you? Two things. First, the model does not draw. There is no sketch, no composition step, no little artist in the machine. It corrects noise, thirty to fifty times, and a picture falls out. Second, "open weights" does not mean free to use however you like. One popular model ships in a variant whose outputs you may sell while the model itself is non-commercial, and another open family terminates your license if your employer's revenue crosses a line. The weights are open. The fine print is not.
If the door looks worth walking through: the Cheatsheet tab holds the parameters and model families in table form, the Reference tab starts with the library (diffusers) that runs all of this in a few lines of Python, and the Timeline tab is the short version of how GANs lost their job. The quiz will not ask you to generate anything. It will ask you why your seed stopped working, and you will know.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://arxiv.org/abs/2006.11239
Supports
- DDPM forward/reverse process and denoising objective
- June 2020 submission; state-of-the-art CIFAR-10 FID
- Diffusion as latent variable model inspired by nonequilibrium thermodynamics
- https://arxiv.org/abs/1406.2661
Supports
- GAN generator/discriminator minimax training, June 2014
- https://arxiv.org/abs/1312.6114
Supports
- Variational autoencoders, December 2013
- Latent-representation foundation for latent diffusion
- https://arxiv.org/abs/2011.13456
Supports
- Score-based SDE framework, November 2020, ICLR 2021 Oral
- Predictor-corrector sampler; first 1024x1024 score-based generation
- https://arxiv.org/abs/2105.05233
Supports
- Classifier guidance; FID 2.97 on ImageNet 128x128; May 2021
- Diffusion surpassing GAN image quality
- https://arxiv.org/abs/2112.10752
Supports
- Latent diffusion motivation: pixel-space diffusion consumes hundreds of GPU days
- Latent space near-optimal between complexity reduction and detail preservation
- Cross-attention conditioning
- https://arxiv.org/abs/2112.10741
Supports
- Text-conditional diffusion; CFG preferred over CLIP guidance by evaluators
- https://arxiv.org/abs/2204.06125
Supports
- unCLIP two-stage generation from CLIP embeddings, April 2022
- https://openai.com/blog/dall-e-2
Supports
- 4x greater resolution than DALL-E 1; beta July 2022
- https://arxiv.org/abs/2205.11487
Supports
- Imagen, May 2022; large language models as text encoders
- State-of-the-art COCO FID 7.27; DrawBench
- https://imagen.research.google/
Supports
- Decision not to release code or public demo
- https://arxiv.org/abs/2207.12598
Supports
- Classifier-free guidance, July 2022; conditional/unconditional score combination
- https://stability.ai/news/stable-diffusion-announcement
Supports
- Stable Diffusion announcement; consumer GPUs; under 10GB VRAM at 512x512
- https://stability.ai/news/stable-diffusion-public-release
Supports
- Public release under CreativeML OpenRAIL-M license
- https://github.com/CompVis/stable-diffusion
Supports
- v1 architecture: 860M UNet, CLIP ViT-L/14 text encoder, factor-8 autoencoder
- https://arxiv.org/abs/2302.05543
Supports
- ControlNet zero convolutions, locked pretrained model, conditioning types
- https://github.com/lllyasviel/ControlNet
Supports
- Training on personal devices; composability
- https://arxiv.org/abs/2307.01952
Supports
- SDXL: 3x larger UNet, second text encoder, multiple aspect ratios, refiner
- https://huggingface.co/docs/diffusers/en/api/pipelines/stable_diffusion/stable_diffusion_xl
Supports
- SDXL defaults 1024x1024; dual text encoders; ensemble-of-expert-denoisers refiner
- guidance_scale defined per Classifier-Free Diffusion Guidance
- https://stability.ai/news/stable-diffusion-3-research-paper
Supports
- MMDiT separate image/language weights; three text embedders; 8B fits 24GB
- https://arxiv.org/abs/2403.03206
Supports
- Scaling rectified flow transformers for image synthesis, March 2024
- https://blackforestlabs.ai/announcing-black-forest-labs/
Supports
- FLUX.1 pro/dev/schnell variants and their licenses; 12B hybrid transformer; August 2024
- https://bfl.ai/legal/non-commercial-license-terms
Supports
- FLUX dev non-commercial terms; derivatives inherit restrictions; outputs commercial
- https://civitai.com/articles/6625/can-i-use-flux-for-commercial-use
Supports
- Practitioner summary: schnell Apache 2.0 allows commercial use
- https://stability.ai/community-license-agreement
Supports
- Community license: free under $1M annual revenue including affiliates; automatic termination
- Commercial-use registration requirement
- https://huggingface.co/docs/diffusers/index
Supports
- DiffusionPipeline design; pipelines, schedulers, pretrained models
- https://huggingface.co/docs/diffusers/en/using-diffusers/conditional_image_generation
Supports
- AutoPipelineForText2Image pattern; guidance_scale, negative_prompt, generator seed
- Diffusion mental model (prompt plus noise, iterative removal)
- https://huggingface.co/docs/diffusers/en/using-diffusers/schedulers
Supports
- Scheduler definitions; named schedulers; steps/quality tradeoff
- https://huggingface.co/docs/diffusers/en/using-diffusers/img2img
Supports
- img2img strength semantics
- https://huggingface.co/docs/diffusers/en/using-diffusers/inpaint
Supports
- Mask semantics (white filled, black kept); inpaint checkpoints
- https://huggingface.co/docs/diffusers/en/using-diffusers/controlnet
Supports
- controlnet_conditioning_scale; MultiControlNet; guess mode
- https://huggingface.co/docs/diffusers/en/training/lora
Supports
- LoraConfig parameters; adapter weight saving/loading; trigger word pathway
- https://stable-diffusion-art.com/cfg-scale/
Supports
- Field Notes: CFG saturation mechanism; negative prompt as CFG hack; distilled model CFG ranges
- https://stable-diffusion-art.com/samplers/
Supports
- Field Notes: ancestral samplers never converge; seed non-reproducibility
- https://stable-diffusion-art.com/train-lora/
Supports
- Field Notes: LoRA overcooking signatures; trigger word load-bearing
- https://stable-diffusion-art.com/controlnet/
Supports
- Field Notes: ControlNet weight artifacts; composition in early steps
- https://stable-diffusion-art.com/comfyui/
Supports
- Field Notes: ComfyUI workflow-file tradeoffs
- https://stable-diffusion-art.com/how-to-use-negative-prompts/
Supports
- Field Notes: negative prompt style steering; model-specific effects
- https://github.com/steven2358/awesome-generative-ai
Supports
- Discovery source for ecosystem entries (ComfyUI, Civitai, model families) in Landscape and Awesome Links
