---
title: "Faster Stable Diffusion with Core ML on iPhone, iPad, and Mac"
description: "Core ML in iOS 17 and macOS 14 adds 6-bit weight palettization for running Stable Diffusion faster and with less memory."
url: "https://swe.quest/articles/faster-stable-diffusion-with-core-ml-on-iphone-ipad-and-mac-5c3ad0b6711e28d5"
canonical: "https://huggingface.co/blog/fast-diffusers-coreml"
source: "Hugging Face"
published: "2023-06-15"
difficulty: "medium"
kind: "How-to"
reading_minutes: 9
tags: ["inference","mobile","computer-vision","hardware"]
---

# Faster Stable Diffusion with Core ML on iPhone, iPad, and Mac

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2023-06-15, 9 min read, How-to. Original: [https://huggingface.co/blog/fast-diffusers-coreml](https://huggingface.co/blog/fast-diffusers-coreml)

## Summary

Core 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.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Inference & serving](https://swe.quest/tags/inference.md) (AI & ML)
- [Mobile](https://swe.quest/tags/mobile.md) (Web & mobile)
- [Computer vision](https://swe.quest/tags/computer-vision.md) (AI & ML)
- [Hardware](https://swe.quest/tags/hardware.md) (Infrastructure)

## Prerequisites

- Stable Diffusion basics
- model quantization ([easy posts on Inference & serving](https://swe.quest/tags/inference.md?difficulty=easy))
- Core ML ([easy posts on Machine learning](https://swe.quest/tags/machine-learning.md?difficulty=easy))

## Keywords

Core ML, coremltools, Stable Diffusion, ml-stable-diffusion, palettization, Apple Neural Engine, SPLIT\_EINSUM\_V2, Hugging Face Hub

## Related posts

- [Stable Diffusion XL on Mac with Advanced Core ML Quantization](https://swe.quest/articles/stable-diffusion-xl-on-mac-with-advanced-core-ml-quantization-eb7e4e62c0405a93.md): Hugging Face · 2023-07-27 · Medium · 8 min read · Inference & serving, Computer vision, Mobile, Swift
  Stable 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.
- [Using Stable Diffusion with Core ML on Apple Silicon](https://swe.quest/articles/using-stable-diffusion-with-core-ml-on-apple-silicon-ec28c0373922e17b.md): Hugging Face · 2022-12-01 · Medium · 6 min read · Inference & serving, Computer vision, Swift, Python
  Stable 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.
- [Swift 🧨Diffusers - Fast Stable Diffusion for Mac](https://swe.quest/articles/swift-diffusers-fast-stable-diffusion-for-mac-9aed97f099aa5274.md): Hugging Face · 2023-02-24 · Medium · 5 min read · Inference & serving, Performance engineering, Hardware, Swift, Machine learning
  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.
- [WWDC 24: Running Mistral 7B with Core ML](https://swe.quest/articles/wwdc-24-running-mistral-7b-with-core-ml-8ff5ba3b889a9bf2.md): Hugging Face · 2024-07-22 · Medium · 13 min read · Inference & serving, LLMs, Swift, Mobile
  Mistral 7B Instruct can run on a Mac with Core ML using features new in iOS 18 and macOS Sequoia: the MLTensor Swift type for tensor pre- and post-processing, stateful buffers that keep the kv-cache on the GPU instead of passing it in and out on every call, and block-wise 4-bit quantization.
- [Releasing Swift Transformers: Run On-Device LLMs in Apple Devices](https://swe.quest/articles/releasing-swift-transformers-run-on-device-llms-in-apple-devices-ee6106831bf892fd.md): Hugging Face · 2023-08-08 · Medium · 15 min read · Swift, Inference & serving, LLMs, Mobile
  Hugging 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.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
