FP16 Compute Acceleration vs BF16 Default
Controlled side-by-side measurements on an Apple M1 (16 GB unified memory) comparing DiffusionBear's default bfloat16 precision against optional float16 compute across 13 warm MLX runs — including wall-clock speed, RSS memory delta, SSIM, PSNR, and full-size contact sheets.
Why FP16 Accelerates Apple M1 (While BF16 Remains Default)
Modern diffusion models are trained and published in bfloat16 (Brain Float 16). On Apple M2 and newer chips, Metal includes native hardware bfloat16 ALU instructions. On the original Apple M1, however, hardware bfloat16 ALUs are absent — MLX and Metal must emulate bfloat16 operations via float32 promotion and conversion, adding latency and temporary buffer pressure.
BF16 Default · Exact Native Render
Uses an 8-bit exponent (same dynamic range as FP32) and 7-bit mantissa. Matches upstream PyTorch and mflux reference weights without exponent clipping, making it the safest default for maximum fidelity across every model and prompt.
FP16 Fast Compute · M1 Native ALU
Executes natively on M1's hardware FP16 ALUs with a 5-bit exponent and 10-bit mantissa. Across 12 of 13 tested configurations it cuts generation time by 10.4% to 67.9% and reduces peak RSS on heavy models, with high structural parity (SSIM 0.96–0.999 on FLUX/FIBO/MOSS 4s) and minor seed-sensitivity drift on a few sensitive schedules.
Measured BF16 vs FP16 Benchmark Results (M1 16 GB)
All 13 runs below come directly from controlled A/B benchmark sweeps on an Apple M1 (16 GB unified memory), matching seed, prompt, steps, and resolution between BF16 and FP16. Memory cells marked — were not recorded in that sweep.
| Model & Mode | Steps | BF16 (s) | FP16 (s) | Speed Delta | BF16 RAM | FP16 RAM | RAM Delta | SSIM | PSNR |
|---|---|---|---|---|---|---|---|---|---|
| Qwen-Image 2.1 Turbotxt2img (DMD2) | 2 | 108.59 s | 34.88 s | -67.9% | — | — | — | 0.8942 | 23.73 dB |
| MOSS-Image SFT 5Btxt2img (4s DMD) | 4 | 78.76 s | 48.03 s | -39.0% | — | — | — | 0.9885 | 35.95 dB |
| Kromoss 5Btxt2img (8s DMD2) | 8 | 139.76 s | 94.82 s | -32.2% | — | — | — | 0.8945 | 23.16 dB |
| FLUX.2-klein 4Btxt2img | 4 | 49.85 s | 34.91 s | -30.0% | 5,113.5 MB | 3,444.5 MB | -1,669.0 MB | 0.9613 | 27.99 dB |
| FLUX.2-klein 9Breference image | 4 | 351.90 s | 255.98 s | -27.3% | 2,844.6 MB | 1,623.8 MB | -1,220.8 MB | 0.9604 | 31.29 dB |
| FLUX.3-klein 5.6Breference image | 4 | 206.52 s | 155.17 s | -24.9% | 2,082.5 MB | 2,043.9 MB | -38.6 MB | 0.9802 | 34.66 dB |
| Bria FIBO 2.0 Edit Turboreference image | 4 | 202.28 s | 152.50 s | -24.6% | — | — | — | 0.9991 | 48.32 dB |
| FLUX.3-klein 5.6Btxt2img | 4 | 55.00 s | 42.54 s | -22.7% | 5,472.2 MB | 5,637.8 MB | +165.6 MB | 0.9154 | 26.56 dB |
| Krea 2 Turbo 13Btxt2img | 4 | 248.71 s | 202.36 s | -18.6% | 2,259.3 MB | 1,407.5 MB | -851.8 MB | 0.7247 | 18.96 dB |
| FLUX.2-klein 9Btxt2img | 4 | 101.34 s | 83.60 s | -17.5% | 1,418.8 MB | 1,435.4 MB | +16.6 MB | 0.9234 | 25.11 dB |
| FLUX.2-klein 9B (Pruned 5.1B Q4 TE)reference image · HF repo | 4 | 377.48 s | 282.61 s | -25.1% | 2,580.2 MB | 1,611.1 MB | -969.1 MB | 0.9696 | 31.87 dB |
| FLUX.2-klein 9B (Pruned 5.1B Q4 TE)txt2img · -15.4% TE peak RAM | 4 | 108.77 s | 87.63 s | -19.4% | 1,245.4 MB | 1,318.1 MB | +72.7 MB | 0.8649 | 22.07 dB |
| MOSS-Image SFT 5Btxt2img (8s DMD) | 8 | 118.78 s | 102.00 s | -14.1% | — | — | — | 0.7076 | 18.02 dB |
| Bria FIBO 2.0 Edit Turbotxt2img | 4 | 95.22 s | 85.30 s | -10.4% | — | — | — | 0.9986 | 45.27 dB |
| FLUX.2-klein 4Breference image | 4 | 152.88 s | 171.70 s | +12.3% | 2,622.0 MB | 2,636.2 MB | +14.2 MB | 0.9896 | 37.26 dB |
Interactive Visual Comparison Sliders (BF16 vs FP16)
Drag the divider across any pair below — generated locally on Apple M1 (16 GB) with identical seed and prompt: BF16 (Default) on the left, FP16 (Fast) on the right (and Full 8B vs Pruned 5.1B Q4 TE on the two FLUX.2-9B encoder comparisons).
v0.5.2 Engine Toggles & Memory Optimizations
Alongside FP16 compute precision, DiffusionBear v0.5.2 adds three user-facing switches in Parameters → Engine plus two automatic pipeline optimizations. Here are the measured effects and exact limitations on Apple M1 (16 GB):
| Control (Parameters → Engine) | Default | Measured Effect | Target & Limitations |
|---|---|---|---|
| Compute PrecisionBF16 / FP16 ⚡ switch + API override | BF16 | -10% to -67.9% latency on M1; up to -1,669 MB RSS. | Best on M1/M2. 13B Krea 2 Turbo shows composition drift in FP16 (SSIM 0.7247); FLUX.2-4B + ref is +12.3% slower. |
| SSD StreamRAM / SSD ⚡ switch | RAM (Off) | -64.1% peak footprint on Qwen 2.1 (11,639.8 → 4,181.5 MB), SSIM 1.0000. |
Recommended for 8 GB Macs. Applies to Qwen-Image 2.1 non-edit txt2img only (disabled on qwen-image-edit). |
| FLUX.2-9B Light Text EncoderOpt-in 5.1B Q4-G64 (HF) | Off (opt-in) | 2.57 GiB disk (-73%), -14.4% to -15.4% TE peak MLX RAM. | Zero forced downloads. Adds ~3.4–3.8 s on cold prompt-cache misses; minor secondary object shift vs 8B. |
Row-Strip VAE DecodeAutomatic (LOW_MEMORY) |
On | -79.0% to -82.3% VAE MLX peak at 1024×1024, SSIM ≥ 0.9978. |
Active on FLUX.2, FLUX.3, Z-Image, MOSS, FIBO/RMBG & Qwen 2.1. Negligible (~2%) overhead at 512×768. |
Qwen StepCache (0.25)Automatic (steps ≥ 16) |
On (≥16s) | -31.6% to -34.4% latency at 25–40 steps, SSIM ≥ 0.981. | Disabled below 16 steps (0 steps skipped at 8s) and disabled on Qwen-Edit / ControlNet runs. |
Memory Footprint & Apple M1 8 GB / 16 GB Takeaways
- Big RSS wins on heavy models: Switching compute to FP16 cut process RSS by 1,669.0 MB on
FLUX.2-klein 4B (txt2img), 1,220.8 MB onFLUX.2-klein 9B (reference), and 851.8 MB onKrea 2 Turbo 13B. Avoiding BF16→FP32 promotion on M1 keeps intermediate Metal buffers tighter. - 16 GB Apple M1 sweet spot: DiffusionBear requires 16 GB unified memory as its supported floor (with an auto-derived 68% Metal wired limit, ~10.88 GB on 16 GB). Enabling FP16 on M1 gives extra headroom during 9B reference-image runs and multi-model sessions, while cutting wait times by 25–68% on most engines.
- 8 GB Macs (Qwen 2.1 qualified via SSD Stream): Heavy 9B/13B pipelines still require 16 GB unified memory, but enabling SSD Stream cuts
Qwen-Image 2.1peak footprint from 11,639.8 MB to 4,181.5 MB (-64.1%) with bit-exact parity (SSIM = 1.0000), fitting safely inside 8 GB. - When to stick with BF16: Keep BF16 when you want exact reference-weight parity on
Krea 2 Turbo 13B(SSIM 0.7247 in FP16) orMOSS-Image 8-step(SSIM 0.7076 in FP16), or when usingFLUX.2-klein 4Bwith a reference image (the one case measured slower in FP16 at +12.3%).
bfloat16 ALUs. Apple M2 and newer chips already accelerate bfloat16 in hardware, so BF16 vs FP16 deltas on M2/M3/M4 are smaller.