K-Diffusion is an open-source PyTorch library implementing the diffusion-model design space from Karras et al. (2022), the paper behind the “Karras” samplers used across image generation. It has around 2,600 GitHub stars and is maintained by Katherine Crowson.
The library packages the Elucidating the Design Space of Diffusion-Based Generative Models (EDM) framework into reusable pieces: noise schedules, preconditioning, a collection of samplers and model architectures. On top of the paper’s reference design it adds improved sampling algorithms and transformer-based diffusion models, including an hourglass diffusion transformer that borrows ideas from the Hourglass Transformer and DiT. The codebase favours clarity and hackability, so individual pieces โ a sampler, a schedule, a wrapper โ can be lifted into other projects. Many popular text-to-image tools expose K-Diffusion’s samplers under the hood, which makes this repository the canonical source for the algorithms rather than an end-user app. Documentation in the README walks through installation, the custom CUDA kernels needed for the transformer model, and basic usage. It remains actively maintained, with updates in 2026.
K-Diffusion is free and open source under the MIT license, including for commercial projects. There is no paid tier; you run it on your own hardware.
Diffusion-model researchers and image-generation developers who want the reference implementation of the Karras design space and its samplers, and students reproducing the EDM paper’s results.