Toy Diffusion Playground is a compact diffusion sandbox for exploring score-based sampling, stochastic differential equations, and a small MNIST DDPM workflow. It packages three runnable demos:
- 2D Gaussian-mixture score fields and Langevin sampling variants
- Euler-Maruyama simulations for simple stochastic differential equations
- An optional toy DDPM on a single MNIST digit
This repo is intentionally modest. It is not a production diffusion library, not a benchmark suite, and not a claim of state-of-the-art generation. The DDPM path is a small-scale reference implementation that trains on one MNIST digit class to keep iteration fast.
Generate the gallery images:
PYTHONPATH=src python -m toy_diffusion_playground gallery --output-dir docsRun the demos individually:
PYTHONPATH=src python -m toy_diffusion_playground gmm-demo --output docs/gmm_langevin_overview.png
PYTHONPATH=src python -m toy_diffusion_playground sde-demo --output docs/euler_maruyama_overview.pngTrain the optional MNIST DDPM:
PYTHONPATH=src python -m toy_diffusion_playground ddpm-train --output-dir outputs/ddpm --digit 3 --epochs 5If you want the DDPM workflow, install torchvision first.
Base install:
pip install -e .Base dependencies are numpy, scipy, matplotlib, and torch.
The MNIST DDPM path additionally needs torchvision.
src/toy_diffusion_playground/
cli.py command-line entry points
gmm_langevin.py Gaussian-mixture score field and Langevin demos
sde.py Euler-Maruyama simulator and plots
ddpm.py toy MNIST DDPM training and sampling helpers
unet.py small UNet used by the DDPM example
- The repo focuses on small, inspectable experiments with clear entry points.
- The implementation covers sampling dynamics and simple generative modeling rather than a full training platform.
- The DDPM example is included as a compact experiment, not as a polished image generation product.

