A diffusion model that fits in a single file
An educational repo that distills DDPM into under 200 lines of readable, self-contained PyTorch.

What it does
minDiffusion is a bare-bones educational implementation of Denoising Diffusion Probabilistic Models built entirely in PyTorch. It trains a simple U-Net with time embeddings to reverse noise into images, supporting MNIST, CIFAR-10, and CelebA datasets. The entire core algorithm lives in superminddpm.py, a single file that clocks in at under 200 lines.
The interesting bit The project treats brevity as a feature, not a bug. By refusing to bury the sampling loop or noise schedule behind abstraction layers, it forces you to confront exactly how diffusion ticks—something that is often obscured in heavier frameworks.
Key highlights
- Core DDPM implementation in under 200 lines of self-contained Python
- Trains on standard benchmarks: MNIST, CIFAR-10, and CelebA
- Generates recognizable CIFAR-10 samples in roughly two hours on a single RTX 3090
- No exotic dependencies—just PyTorch and torchvision
- Refactored training script (
train_cifar10.py) included for longer runs
Caveats
- Advanced techniques like DDIM and classifier guidance are listed as TODOs, not yet implemented
- The U-Net and time embeddings are intentionally simple; output quality is educational-grade, not production-grade
- README showcases CIFAR-10 and MNIST results, but does not display CelebA samples
Verdict This is for students or practitioners who want to see the diffusion loop without navigating a monolithic framework. Look elsewhere if you need pretrained weights, advanced samplers, or state-of-the-art fidelity.
Frequently asked
- What is cloneofsimo/minDiffusion?
- An educational repo that distills DDPM into under 200 lines of readable, self-contained PyTorch.
- Is minDiffusion open source?
- Yes — cloneofsimo/minDiffusion is an open-source project tracked on heatdrop.
- What language is minDiffusion written in?
- cloneofsimo/minDiffusion is primarily written in Python.
- How popular is minDiffusion?
- cloneofsimo/minDiffusion has 1.2k stars on GitHub.
- Where can I find minDiffusion?
- cloneofsimo/minDiffusion is on GitHub at https://github.com/cloneofsimo/minDiffusion.