Swift 🧨Diffusers - Fast Stable Diffusion for Mac
Diffusers for Mac 1.1, an open-source SwiftUI app that runs Core ML-converted Stable Diffusion models locally, can generate images up to twice as fast as the previous version by automatically picking the best compute unit for each machine. Benchmarks across M1, M2 and M1 Max show base M1/M2 chips run roughly twice as fast on the Neural Engine as on the GPU, while the M1 Max is much faster on the GPU because it has four times as many GPU cores. Memory size barely affects speed, and combining GPU and ANE did not beat the faster of the two alone. The release also adds guidance scale, seed reuse, cancellation and model download indicators, and asks the community for benchmark data from Pro and Max chips.
Related posts
- Using Stable Diffusion with Core ML on Apple Silicon
Hugging Face mediumAdeptStable Diffusion can run on Apple Silicon via Core ML using Apple's ml-stable-diffusion repo, with pre-converted checkpoints for v1.4, v1.5, v2 base and v2.1 base hosted on the Hugging Face Hub. Each model comes in 'original' attention (CPU/GPU only, sometimes faster) or 'split_einsum' attention (also runs on the Neural Engine), packaged either as ML Packages for Python or compiled mlmodelc bundles for Swift. The best result on an M1 Max was 18s per image, using original attention with all compute units on macOS Ventura 13.1, which is required to avoid black images. Step-by-step download and inference commands are given for Python and Swift, plus a pointer to Apple's conversion script for custom fine-tuned models.
- Faster Stable Diffusion with Core ML on iPhone, iPad, and Mac
Hugging Face mediumAdeptCore ML in iOS 17 and macOS 14 adds 6-bit weight palettization for running Stable Diffusion faster and with less memory. Weights are indices into a lookup table and are decompressed layer by layer during inference rather than at load time, which cuts memory transfer on the critical path. Apple's ml-stable-diffusion now supports a --quantize-nbits conversion flag (8/6/4/2 bits) and a SPLIT_EINSUM_V2 attention variant that chunks queries into 512-length pieces for 10–30% Neural Engine speedups. Pre-converted 6-bit models for SD 1.4–2.1 are on the Hub, alongside conversion commands for custom models and a note that training-time compression can reach 4 or 2 bits with less quality loss.
- Stable Diffusion XL on Mac with Advanced Core ML Quantization
Hugging Face mediumAdeptStable Diffusion XL base has been ported to Core ML for Apple Silicon Macs (macOS 14 beta), with end-to-end latency ranging from 46 s on an M1 Max to 20 s on an M2 Ultra using CPU+GPU and the ORIGINAL attention implementation. The main technique is mixed-bit palettization, a post-training quantization method that picks a bit depth per layer (1, 2, 4, 8 or float16) based on each layer's measured PSNR impact against the float16 model. Recipes at 6.55, 4.50 and 3.41 bits per parameter all beat naive 8-bit linear quantization on PSNR, and the 4.5-bit recipe shrinks the UNet from 4.8 GB to 1.4 GB. Aggressive compression can degrade prompt adherence in ways PSNR does not capture. Analysis and apply scripts plus precomputed recipes for SD 1.5, 2.1 and XL are published.
- Releasing Swift Transformers: Run On-Device LLMs in Apple Devices
Hugging Face mediumAdeptHugging Face released swift-transformers, an alpha Swift package with a transformers-like API for on-device text generation, along with the swift-chat demo app, updated exporters and transformers-to-coreml conversion tools, and pre-converted Llama 2 7B and Falcon 7B Core ML models. The post walks through converting Llama 2 to Core ML via three routes: the no-code Space, exporters, or raw coremltools. Lessons from those conversions include using coremltools 7.0b1, dropping softmax from outputs, and using fixed sequence lengths, because flexible shapes only run on the CPU. Planned optimizations are KV caching, discrete input shapes and palettization or mixed-bit quantization, and the library already supports Hub-configured BPE tokenizers plus greedy and top-k generation.
- Swift Transformers Reaches 1.0 – and Looks to the Future
Hugging Face easyNoviceswift-transformers, Hugging Face's Swift library for running local models on Apple Silicon, reaches 1.0. The release makes Tokenizers and Hub standalone top-level modules and adopts a rewritten swift-jinja for chat templates that is orders of magnitude faster. It also moves to modern Core ML APIs with stateful models for KV caching and MLTensor, drops the CLI targets and the swift-argument-parser dependency, and fully supports Swift 6. The release includes breaking API changes, and future work will focus on MLX integration and agentic use cases including MCP.