Project Overview
Implemented DDPM from scratch to validate diffusion fundamentals at code level and optimize MNIST generation quality with quantitative metrics.
Problem Definition & Goals
- Problem: Understanding diffusion models deeply requires direct implementation of paper equations instead of relying on black-box libraries.
- Goal 1: Translate Ho et al. (2020) equations into working code with faithful forward/reverse diffusion behavior.
- Goal 2: Add DDIM and classifier-free guidance to improve both sampling speed and fidelity.
- Goal 3: Build a reproducible quantitative evaluation loop with FID and IS.
Key Features & Contributions
- Noise Scheduling: Implemented linear/cosine schedulers and full forward-reverse diffusion routines.
- Custom U-Net: Designed residual down/up blocks with attention-based conditioning for stable training.
- Advanced Sampling: Added DDIM and CFG for faster and controllable conditional generation.
- Metric-driven Validation: Evaluated model behavior with FID/IS across guidance scales.
- Best Score: Achieved FID 0.2514 at CFG scale w=0.1.
Technical Challenges & Solutions
- Signal Interference: Simple addition of time and class embeddings caused mode collapse for some digits.
- Root Cause: Heterogeneous conditioning signals interfered when injected through the same feature path.
- Fix: Separated conditioning routes and inserted cross-attention at the U-Net bottleneck.
- Outcome: Restored stable class-conditional generation for digits 0-9.
Results & Learnings
- Result: Completed an end-to-end DDPM/DDIM/CFG generation pipeline.
- Result: Verified quality gains with FID 0.2514 and guidance-scale ablations.
- Growth: Improved architecture-engineering skill beyond baseline reimplementation.
- Learning: Established disciplined experiment tracking and configuration management practices.