Project notes · 06

MOSS on a Mac: from over eight minutes to 46 seconds

The official setup took over eight minutes per image on a Mac, too slow for daily use. With MLX and a distilled LoRA I got it to about 46 seconds, with hands and perspective as good as the official output.

Local MOSS image inference · Inference optimization · Apple Silicon

Why I did it

I wanted to run the MOSS image model on my own Mac, but with the official setup a 1024² image took 509 seconds, over eight minutes, far too slow to actually use. So I decided to optimize it myself.

Picking a framework

I compared how MLX, PyTorch MPS and stable-diffusion.cpp did on a Mac, and chose Apple’s own MLX.

Fewer steps

The official setup runs 50 steps with CFG by default. With an 8-step distilled LoRA, one image went from 509 seconds to about 46, and the hands and perspective, the parts most likely to go wrong, still match the official 50 steps.

A little faster still

Then I went one level lower and fused the LoRA into the base model’s matrix multiply by concatenating along K, which made each image about 11% faster. Prompt expansion reuses the text encoder’s weights, adding only about 1 GB of memory.

Something you can just open

Getting it to run wasn’t enough, so I packaged it as ComfyUI nodes, a web page and a Mac menu-bar app, ready to use as soon as you open it.