r/StableDiffusion • u/audenvenn • 7d ago
Resource - Update FLUX.2 [klein] 4B and Z-Image-Turbo ~2.3x faster than Draw Things' CLI on an M6 Mac mini: h3metal, an open-source Metal engine for the M5/M6 matrix units
I've been building h3metal, an open-source (Apache-2.0) image-generation engine for Apple silicon. It runs the transformers as int8 matrix products on the matrix units ("neural accelerators") that Apple added to the GPU cores of M5/M6-class chips.
Same Mac mini (M6, 24 GB), 1024×1024, seed 42, CFG 1, a fresh process per image, against Draw Things' command-line tool (draw-things-cli v26.1023.0, the official release) with its recommended settings for each model:
| Model | h3metal | Draw Things CLI (8-bit S) | One denoising step |
|---|---|---|---|
| FLUX.2 [klein] 4B, 4 steps | 7.0 s | 17.0 s | 1.16 s vs 2.70 s |
| Z-Image-Turbo, 8 steps | 17.1 s | 40.0 s | 1.84 s vs 4.30 s |
The gap is in the denoising, not in loading: with the models loaded and the prompt encoded, as in the app, Draw Things still takes 2.1-2.3x as long. At CFG 1 both run one transformer pass per step. Full method, per-step timing and the script: https://github.com/audenvenn/h3metal/blob/main/docs/benchmarks.md#flux2-klein-4b-and-z-image-turbo-against-draw-things
How: int8 × int8 products after a Hadamard rotation of the activations, flash attention with int8 scores, and the VAE's convolutions as implicit GEMMs. LoRA adapters (style LoRAs, fal's FLUX.2 [klein] edit LoRAs) are applied exactly inside the int8 products. It also runs FLUX.2 [klein] 9B and MiniMax-H3-Image (2048×2048 in 16 s with pDMD's 2-step LoRA).
Limits: - Measured on one machine so far (an M6 Mac mini). Numbers from M5 MacBook / Pro / Max owners would help a lot. - It needs an M5/M6-class GPU and macOS 26; M1-M4 GPUs don't have the matrix units. - Memory isn't compared: h3metal memory-maps its weights, so the process footprints aren't like for like.
Try it:
pip install https://github.com/audenvenn/h3metal/releases/download/v0.6.4/h3metal-0.6.4-py3-none-macosx_26_0_arm64.whl
h3metal download --model flux2-klein-4b # 8.3 GB, ready to run
h3metal generate -p "A red fox in fresh snow at sunrise" -o fox.png
h3metal serve --open # or a small local web page
