A user asked Codex to optimize the oMLX runtime for the 302GB DeepSeek V4 Flash 8-bit affine model, resulting in significant performance gains on a Mac Studio M3 Ultra. The changes enable native DeepSeek MoE Metal kernels and replace generic route sorting with bucket/counting paths.
- Prefill speed increased from ~300 tok/s to ~533 tok/s for a 12K prompt.
- Decode speed improved from ~7.31 tok/s to ~20-22 tok/s in controlled benchmarks.
- Real-world Hermes runs with 80K-120K context maintained decode speeds around 19.5-20.7 tok/s.
- The optimization adds 8-bit affine Metal kernel instantiations and route-indexed decode kernels to reduce overhead.
The author seeks community verification that the changes do not cause meaningful accuracy loss, noting that weights and quantization formats remain unchanged.