← All books
Book · Intermediate · 40+ hours

Denoising Diffusion Models from Scratch

From Mathematical Foundations to Image Generation

Master diffusion models from mathematical foundations to image generation. Learn the theory, implement DDPM in PyTorch, and understand modern systems like Stable Diffusion.

18Chapters
76Sections
19hReading
7Parts
Part I·2 chapters · 9 sections

Math FoundationsProbability, Gaussians, and variational inference.

Part II·3 chapters · 14 sections

TheoryForward and reverse diffusion processes.

Part III·3 chapters · 15 sections

ArchitectureU-Net, DDPM implementation, and samplers.

Part IV·2 chapters · 9 sections

ConditioningGuidance and text-to-image foundations.

Part V·3 chapters · 11 sections

ProjectEnd-to-end image generation system.

Dataset Preparation

Setting up data for training a diffusion model

3 sections37 min read
Start chapter
  1. 01Dataset Selection10m
  2. 02Data Preprocessing15m
  3. 03Building the Training Pipeline12m

Generation and Evaluation

Using the trained model and measuring quality

4 sections57 min read
Start chapter
  1. 01Generating Images12m
  2. 02Evaluation Metrics18m
  3. 03Qualitative Analysis12m
  4. 04Interactive Demo15m
Part VI·3 chapters · 11 sections

AdvancedLatent diffusion and modern techniques.

Latent Diffusion Models

Understanding the architecture behind Stable Diffusion

4 sections68 min read
Start chapter
  1. 01The Latent Diffusion Idea15m
  2. 02The VAE Component18m
  3. 03Diffusion in Latent Space15m
  4. 04Stable Diffusion Architecture Overview20m

Advanced Conditioning Techniques

ControlNet, IP-Adapter, and beyond

4 sections54 min read
Start chapter
  1. 01ControlNet Concept15m
  2. 02Image-to-Image Generation15m
  3. 03IP-Adapter and Image Prompts12m
  4. 04Multi-Modal Conditioning12m

Score-Based and SDE Perspective

The unified mathematical framework

3 sections53 min read
Start chapter
  1. 01Score-Based Generative Models18m
  2. 02Diffusion as SDEs20m
  3. 03Unified Framework15m
Part VII·2 chapters · 7 sections

ProductionOptimization and future directions.

Optimization and Deployment

Making models practical

3 sections39 min read
Start chapter
  1. 01Model Acceleration15m
  2. 02Quantization and Efficiency12m
  3. 03Serving Diffusion Models12m

The Future of Diffusion Models

Current research directions

4 sections44 min read
Start chapter
  1. 01Video Generation12m
  2. 023D Generation12m
  3. 03Beyond Images10m
  4. 04Open Problems and Research Directions10m
The capstone

Where the book lands in practice.

Chapter 10·3 sections

Dataset Preparation

Setting up data for training a diffusion model

Open chapter
Chapter 11·4 sections

Training the Model

Complete training setup and execution

Open chapter
Chapter 12·4 sections

Generation and Evaluation

Using the trained model and measuring quality

Open chapter

76 sections. Begin with one.

Chapter 0 — Prerequisites — is where every reader starts.