Inkling 2 Mini at 94.91 tok/s on an M3 Max
Last time I ported Inkling 2 Mini to my Mac: 45.60 to 47.60 tok/s plain decode, 63.45 with a DSpark speculative script. That was Inkling on Mac. I wanted 100. I built something new, and I did not get 100.
I built the kernels and the DFlash2 work with the Gemini 4 Neon coding agent. The build is mine, and so are the numbers below.
Every "my" number is from one machine: an M3 Max with 128 GB, MLX 0.32.4, model mlx-4bit-g32, greedy decode, 1024-token cap. The stock baseline is plain unfused MLX in the same harness: 48.41 tok/s, the mean of 5 prompts, median of 3 trials.
On code (prompt code:0), Austin's new build (fused + adaptive DFlash2) decodes at 94.91 tok/s over a full 1024 tokens. 94.91 / 48.41 − 1 = +96.1%. Against stock on that same prompt, 50.42 tok/s, it is 94.91 / 50.42 − 1 = +88.2%.
Code is the best case. Take the best setting per domain (adaptive on code, live gate on chat, plain fused on prose) and the mean of the three is 76.95 tok/s. 76.95 / 48.41 − 1 = +59.0%.
It did not hold 100 tok/s over a full run. 100 − 94.91 = 5.09 short. Short windows did pass it: 106.00 tok/s on code:0 at tokens 128–256, 104.77 on code:0 at tokens 256–384, and 103.48 on code:1 at tokens 256–384. A window is not a run.
The output is lossless. Every arm matches the reference by SHA-256: 20/20 on the identity gate, 114/114 benchmark generations, 0 divergent tokens.
Get it
The kernels and DFlash2 are source, so go read them: austindixson/Inkling-2-Mini-Neon-Kernels. It is commit b75cc5e of my local tree. No weights in the repo. It loads Inkling-2-Mini-MLX-4bit.
I also made a tool-calling cartridge for the same model: austindixson/Inkling-2-Mini-ToolCall-Cartridge. It is a 27,989,502-byte deletion mask (step400) with apply and eject code. On the card's held-out 97-item ToolAlpaca test, a 4-bit MLX build goes from 32/97 to 66/97. Those scores are the card's, not part of this post's benchmarks.
The numbers by domain
Stock per prompt is the median of 3 from the earlier 5-prompt official run. My numbers are the later 3-prompt run, mean of 2.
| Domain | Stock | Austin's new build (plain fused) | Austin's new build (fused + adaptive DFlash2) | Austin's new build (fused + DFlash2 live gate) | Best vs same-prompt stock |
|---|---|---|---|---|---|
| code:0 | 50.42 | 66.25 | 94.91 | 90.96 | adaptive: 94.91 / 50.42 − 1 = +88.2% |
| chat:0 | 48.48 | 66.81 | 69.06 | 69.16 | live gate: 69.16 / 48.48 − 1 = +42.7% |
| prose:0 | 47.46 | 66.78 | 65.18 | 66.39 | plain fused: 66.78 / 47.46 − 1 = +40.7% |
| mean of 3 | 48.78 | 66.61 | 76.38 | 75.50 | best per domain 76.95: 76.95 / 48.78 − 1 = +57.7% |
DFlash2 does not pay everywhere. On code it is a large win. On chat the live gate is a hair ahead. On prose, plain fused is best and the adaptive arm is a little behind it. That is why the best setting changes by domain.
What moved the code number
My first full 1024-token bench came in well under the 512-token probes. The 5-prompt official run finished before the fixes below. The adaptive DFlash2 code number then was 65.90 tok/s. After the fixes it is 94.91. 94.91 / 65.90 − 1 = +44.0%.
Four things were wrong. The adaptive draft policy got stuck at draft length 1 after one hard span. Attention was slower than MLX's own at context of 1024 and up on single-token steps, so I use MLX's native SDPA there. A lazy .item() on the target token stalled the GPU queue on every token. And the machine itself: thermal soak and GPU contention cost 14% to 22% after about five minutes of sustained load. I now keep benches under about five minutes.
Against the baseline and the published ports
Not a controlled race. The third-party rows and my Nov 21 rows used different harnesses: different context length, token count and prompts. A percentage against 48.41 for a 4k-context row is indicative only.
| Build / port | tok/s | vs stock 48.41 | Source |
|---|---|---|---|
| Stock MLX unfused, my harness (5 prompts, 1024 tok, median of 3) | 48.41 | baseline | this post |
| mlx-community Inkling-2-Mini-4bit via oMLX v0.8.4, M3 Max 40c / 64 GB, 4k ctx | 43.6 | 43.6 / 48.41 − 1 = −9.9% | omlx.ai |
| same, 1k ctx | 41.3 | 41.3 / 48.41 − 1 = −14.7% | omlx.ai |
| lmstudio-community Inkling-2-Mini-MLX-4bit | no published Mac tok/s | n/a | model card |
| unsloth Inkling-2-Mini-GGUF | no published M3 Max tok/s | n/a | unsloth docs |
| ggml-org Inkling-2-Mini-GGUF | no published M3 Max tok/s | n/a | ondeviceworks |
Austin's Nov 21 port, IQ4_NL GGUF, llama.cpp llama-bench, 4k ctx |
29.30 ± 0.18 | 29.30 / 48.41 − 1 = −39.5% | HF card |
| Austin's Nov 21 port, MLX-4bit, patched decode, 4k ctx | 45.60 ± 0.15 | 45.60 / 48.41 − 1 = −5.8% | HF card |
| Austin's Nov 21 port, MLX-4bit, patched decode, ctx 0 | 47.60 ± 0.41 | 47.60 / 48.41 − 1 = −1.7% | HF card |
| Austin's Nov 21 port, DSpark k=3 script, quiet machine (plain 48.0) | 63.45 | 63.45 / 48.0 − 1 = +32.2% vs plain 48.0; 63.45 / 48.41 − 1 = +31.1% | HF card, Inkling on Mac |
| Austin's new build (plain fused), 5-prompt official, before the fixes | 58.70 | 58.70 / 48.41 − 1 = +21.2% | this post |
| Austin's new build (fused + adaptive DFlash2), 5-prompt official, before the fixes | 64.88 | 64.88 / 48.41 − 1 = +34.0% | this post |
| Austin's new build (plain fused), 3 prompts, mean of 2 | 66.61 | 66.61 / 48.41 − 1 = +37.6% | this post |
| Austin's new build (fused + adaptive DFlash2), 3 prompts, mean of 2 | 76.38 | 76.38 / 48.41 − 1 = +57.8% | this post |
| Austin's new build (fused + DFlash2 live gate), 3 prompts, mean of 2 | 75.50 | 75.50 / 48.41 − 1 = +56.0% | this post |
| Austin's new build, best per domain, 3 prompts | 76.95 | 76.95 / 48.41 − 1 = +59.0% | this post |
I did not run anyone else's port. The third-party figures are quoted as published. Only one of them is an M3 Max number, the oMLX community result. For lmstudio-community, unsloth and ggml-org there is none, so I left those cells empty instead of guessing. Other chips (M3 Ultra, M4 Max, M5 Pro) have published figures too, but a different chip says nothing about this one, so there is no percentage for them.
The new build's 5-prompt official adaptive figure is 64.88 / 43.60 = 1.49x, +48.8% over the oMLX 4k number, and 64.88 / 45.60 = 1.42x, +42.3% over my own patched 4-bit at 4k. On code, 94.91 / 63.45 = 1.50x, +49.6% over my earlier speculative script. Those gaps include harness differences. My stock 48.41 sits within about 1 to 2% of my own ctx-0 figures from Nov 21 (47.60 patched, 48.0 plain), so at zero context the harnesses look close. That is a hint, not proof.
The quant recipes also differ. My Nov 21 build is 4-bit g64 (4.668 bpw). The new build runs mlx-4bit-g32. mlx-community keeps NVFP4 and MXFP8 experts (17.3 GB). Some of every gap is the files, not the engine.
What I would not quote
The post-fix numbers come from a 3-prompt, 2-trial bench, mean of 2 (6:32 PM PT). I did not run a full median-of-3 confirm of the post-fix build. So 94.91 is the best verified post-fix number, not a re-confirmed median. The stock 48.41 is from the earlier 5-prompt official run, median of 3 (5:54 PM PT).
Code is one prompt in the final bench, and chat and prose are one prompt each. Three prompts is not a distribution. A later 5 chat plus 5 prose sweep ran warmer and came in lower than the 3-prompt bench for the same kind of prompt. Absolute tok/s moves by 15 to 20% with machine state.
chat:0 ends at 411 tokens and prose:0 ends at 604 (natural end of reply), so those two never hit the 1024 cap.
100 tok/s is still 5.09 short over a full run.
Change log
- Hardware: Apple M3 Max MacBook Pro, 128 GB. MLX 0.32.4.
- Model: Inkling 2 Mini,
mlx-4bit-g32. - Prompts: the 5-prompt official bench (
code:0,code:1,code:4,chat:0,prose:0), 1024-token cap, median of 3 trials; the 3-prompt fast bench (code:0,chat:0,prose:0), mean of 2 trials; short probes of 64 and 512 tokens. - Settings: greedy decoding, stock MLX unfused as the baseline, outputs checked by SHA-256 against the reference.
Problem: decode ran at stock MLX speed, 48.49 tok/s on a 64-token probe
Change: Nine fused Metal kernels (message gates, rms_norm + depth attention + down/up projections, QKV prep, router GEMV, MoE sum + conv + residual)
- Status: kept
- Rationale: Three gate weights lose nothing as bf16 (0 nonzero lower-16 bits), which halves their reads. The kernels match MLX's exact reduction order.
- Predicted: No prediction was recorded before this change. The aim was fewer reads and fewer launches per token at unchanged output.
- Observed: Unfused 48.49 tok/s went to fused 65.49 tok/s on a 64-token probe (1.35x). Logits are bit-exact (max_abs_diff 0.00000000). Verify cost per step at S=8 went from 64.53 ms unfused to 55.72 ms fused (1.16x). A fused chain microbench went from 7.54 ms to 4.37 ms at L=1 (1.73x).
Problem: the earlier DFlash2 code had five performance gaps
Change: Audit and fix all five, built with the Gemini 4 Neon coding agent
- Status: kept
- Rationale: The audit found no fabricated numbers but five gaps. Weights were read S times per verify step, attention ran L separate SDPA calls, and the drafter was uncompiled and copied the whole 2047-token KV on each step.
- Predicted: No prediction was recorded before this change. The aim was a cheaper draft and verify step.
- Observed: The DFlash2 draft step went from 6.94 ms to 3.18 ms (2.18x).
Problem: 1-ULP differences against MLX across the 48 layer visits
Change: Match the rms_norm tree, disable FMA contraction where MLX does not use it, sum r_l2_clip sequentially
- Status: kept
- Rationale: The goal was output identical to MLX at every layer, not just close.
- Predicted: No prediction was recorded before this change. The aim was zero logit difference.
- Observed: Every 1-ULP difference across all 48 layer visits is closed. Later gates passed: 20/20 prompts SHA-identical (fused and speculative against the reference) and 114/114 benchmark generations identical.
Problem: the 5:54 PM official 1024-token bench came in well under the 512-token probes (adaptive DFlash2 on code:0 at 65.90 tok/s)
Change: Relax unobserved acceptance estimates in AdaptivePolicy and probe longer drafts after 2 full accepts
- Status: kept
- Rationale: AdaptivePolicy got stuck at draft length 1 after one hard span.
- Predicted: No prediction was recorded before this change. The aim was to close the gap between the 1024-token bench and the 512-token probes.
- Observed: code:0 went from 65.90 tok/s to 94.91 tok/s (+44.0%, 94.91 / 65.90 − 1).
Change: Use MLX native SDPA at context of 1024 or more for single-token steps
- Status: kept
- Rationale: My attention kernel was slower than MLX's own there, by 1.36 ms at depth 1536.
- Predicted: No prediction was recorded before this change. The aim was to remove the 1.36 ms penalty at depth 1536.
- Observed: Not measured on its own. It shipped with the other fixes that took code:0 from 65.90 to 94.91 tok/s, so its share is unknown.
Change: Replace the lazy tgt[0].item() with tgt.item()
- Status: kept
- Rationale: The lazy form stalled the GPU queue on every token.
- Predicted: No prediction was recorded before this change. The aim was higher decode speed on the gated arms.
- Observed: Live gate on chat went from 62.67 tok/s to 69.16 tok/s, and on prose from 62.95 tok/s to 66.39 tok/s.
Change: Keep benches under about five minutes
- Status: kept
- Rationale: Thermal soak and GPU contention cost 14% to 22% after about five minutes of sustained load.
- Predicted: No prediction was recorded before this change. The aim was comparable numbers between runs.
- Observed: The post-fix bench ran in 171.6 s of wall time. Absolute tok/s still moves by 15 to 20% with machine state.
Problem: the DSpark drafter alone hurt prose and chat in the 5:54 PM official run (prose 38.39 tok/s and chat 41.05 tok/s with DSpark + fused, against 56.12 and 58.31 plain fused)
Change: Add a live 32-token accept-rate gate that falls back to plain fused when drafting does not pay, and sweep k=1, 2, 3
- Status: kept
- Rationale: Drafting does not always pay, so the gate falls back to plain fused when it is not paying.
- Predicted: No prediction was recorded before this change. The aim was to keep the code gain and stop losing on chat and prose.
- Observed: 60/60 generations lossless. The gate is best or tied-best on chat and prose, and fixed k lost on chat and tied on prose. In the 5+5 prompt sweep, prose with the live gate is 57.40 tok/s against 55.33 tok/s plain fused. That sweep ran warmer, so it sits below the 3-prompt bench.
Tags: Local inference MLX macOS Benchmarks Speculative decoding