Maple Diffusion runs Stable Diffusion models locally on iOS and macOS devices, natively in Swift using Apple’s MPSGraph framework — no Python involved. Published on GitHub under the MIT license with about 824 stars, it was one of the earliest demonstrations that a phone could generate AI images entirely on-device. The project was last updated in late 2022 and is a compact, readable reference implementation of diffusion inference on Apple silicon.
Getting Stable Diffusion to run inside an iPhone’s 4 GB memory limit took real engineering: Maple Diffusion uses FP16 arithmetic with NHWC tensor layouts, aggressive operator fusion through MPSGraph, and swaps model weights to device storage to stay within budget. The results were striking for the time — roughly 2.3 seconds per step on an iPhone 13 Pro, producing a reasonable image in a minute or two, and under a second per step on macOS with its larger memory allowance. The author also documents how Apple’s own Core ML Stable Diffusion compared, making the repository a useful study in performance trade-offs between MPSGraph and Core ML approaches.
The repository also rewards reading as a performance case study. The author explains the memory tricks in plain language — why tensors are stored the way they are, where operator fusion wins time, and how close the implementation gets to the hardware’s limits. Engineers porting diffusion models to other accelerators will find the same lessons apply. Maple Diffusion helped kick off the wave of on-device generative AI on Apple platforms that has since become a standard feature category.
Maple Diffusion is completely free and open source under the MIT license.
iOS and macOS developers who want to embed on-device image generation in their apps, and engineers studying how to squeeze large neural networks into tight mobile memory budgets.