Flint on an M3 Max: what I measured
Generated Computers wrote the Locals kernels that make Flint fast in this post. I did not. I ran their code at commit b35c46c and measured it: Generated-Computers/Locals. Everything else here is a benchmark I ran, plus what I could and could not conclude from it.
Flint is a mixture-of-experts model with about 2.5B active parameters. I wanted to know how fast it decodes on a Mac I own, and whether a smaller build costs quality. The Mac is an Apple M3 Max with 128 GB: a MacBook Pro, 16-core CPU, 40-core GPU, and 400 GB/s of memory bandwidth per Apple's spec. I also looked on an Apple M1 Max with 64 GB for earlier Flint runs and found none, so no Flint benches ran on it. Speed numbers are means ± sample sd of 5 trials after 1 warmup (llama.cpp used llama-bench's default warmup, which its output does not log); the quality results are one run per build.
Update: the first version of this post compared Locals on short English chat prompts against mlx-lm and llama.cpp on 4K-token prompts. Those are different workloads, so the speed ratios from that version are retracted and replaced by a same-prompt rerun. The change log at the end lists what changed.
The short answer
- Fused kernels help 1.25×–1.68× against the same Locals build with them turned off (mixed build). In the mlx-lm loop: 135.25 / 102.21 = 1.32× at depth 4096 and 152.33 / 98.97 = 1.54× at depth 0. Through the Locals server: 101.70 / 81.22 = 1.25× at depth 4096 and 113.07 / 67.23 = 1.68× at depth 0.
On byte-identical prompts, Locals fused is 135.25 / 99.43 = 1.36× stock mlx-lm on the mixed build inside the mlx-lm loop, but only 101.70 / 99.43 = 1.02× through the Locals server at depth 4096.
- The int4 build is slower through Locals. Through the server, fused, 51.79 / 99.26 = 0.522, and 1 − 0.522 = 0.478, so it is 48% slower than stock mlx-lm on the same build at depth 4096.
- The mixed build costs little quality on the two tests I ran, and the difference is not statistically significant. Code might lose a few points. I did not prove it.
- Flint is not my Home Base default. Details near the end.
llama-bench draws its own ids. 128 new tokens, greedy. The Locals kernels are by Generated Computers.How I measured
- Prompts: every MLX arm decoded from the same token ids, drawn by
mlx_lm.benchmarkwith a fixed seed. They are byte-identical, checked by sha256 of the id list:ccd5b148c2…at depth 4096 anda246929893…at depth 0, the same across every MLX arm. llama.cpp cannot take external ids:llama-benchdraws its own random tokens, so it matches on length and depth only. - Depth: depth 4096 means prefill 4096 tokens, then decode 128. Depth 0 means a 1-token prompt for MLX and
-p 0 -n 128for llama.cpp. - Generation: 128 new tokens, greedy, end-of-sequence disabled. 1 warmup, then 5 timed trials (llama.cpp used
llama-bench's default warmup, which its JSON does not log). I report the mean ± sample sd (n − 1), and the median in the table, never one swapped for the other. - Stock mlx-lm:
python -m mlx_lm benchmark -p 4096 -g 128 -n 5(and-p 1for depth 0). mlx-lm 0.32.3.dev18, mlx 0.32.4. - Locals loop: the same
mlx_lm.benchmarkmain(), with only itsloadswapped for Locals' loader, so it times the Locals kernels inside mlx-lm's own generate loop. Locals commitb35c46c, running in Locals' environment with mlx-lm 0.32.2. - Locals server: Locals' own server, fed the identical ids on
/v1/completions. Prefill speed is the prompt length divided by time to first token; decode speed is 128 divided by the time from first to last token. The prompt cache is made ineffective and checked on every trial:cached_tokens == 0andcompletion_tokens == 128, 0 violations in all 8 server trial sets. - llama.cpp: Homebrew llama.cpp 0.8.0,
llama-bench -ngl 99 -fa 1 -p 4096 -n 128 -r 5, plus-p 0 -n 128 -d 4096for decode at depth 4096, on unsloth'sflint-UD-Q5_K_XL.gguf. - Fused and unfused: fused is every Locals kernel switch at its default. Unfused is
LOCALS_SOLO=0 LOCALS_EXPERT_KERNELS=0 LOCALS_MOE_KERNEL=0 LOCALS_FLINT_ADD_RMS=0 LOCALS_QK_KERNEL=0. - Peak memory: the loop and stock rows report
mx.get_peak_memory(); the server rows report the server process's peak footprint. These are different metrics.
All 22 rows. Prefill is only measured at depth 4096.
| Backend | Arm | Build | Depth | Decode tok/s, mean ± sd | Decode median | Prefill tok/s, mean ± sd |
|---|---|---|---|---|---|---|
| mlx-lm | stock | int4 | 4096 | 99.26 ± 2.61 | 99.64 | 1459.34 ± 106.18 |
| mlx-lm | stock | int4 | 0 | 106.78 ± 0.78 | 106.82 | n/a |
| mlx-lm | stock | mixed | 4096 | 99.43 ± 1.84 | 98.90 | 1280.43 ± 113.75 |
| mlx-lm | stock | mixed | 0 | 108.21 ± 0.60 | 107.96 | n/a |
| Locals loop | fused | int4 | 4096 | 61.84 ± 1.61 | 61.86 | 1207.30 ± 331.30 |
| Locals loop | fused | int4 | 0 | 47.97 ± 2.31 | 48.73 | n/a |
| Locals loop | fused | mixed | 4096 | 135.25 ± 8.11 | 139.42 | 1580.50 ± 156.65 |
| Locals loop | fused | mixed | 0 | 152.33 ± 6.57 | 150.64 | n/a |
| Locals loop | unfused | int4 | 4096 | 63.30 ± 1.83 | 63.59 | 1388.14 ± 153.13 |
| Locals loop | unfused | int4 | 0 | 50.93 ± 2.99 | 52.03 | n/a |
| Locals loop | unfused | mixed | 4096 | 102.21 ± 1.62 | 102.08 | 1370.88 ± 143.71 |
| Locals loop | unfused | mixed | 0 | 98.97 ± 4.90 | 99.85 | n/a |
| Locals server | fused | int4 | 4096 | 51.79 ± 0.59 | 51.67 | 1530.29 ± 54.81 |
| Locals server | fused | int4 | 0 | 47.58 ± 1.57 | 48.30 | n/a |
| Locals server | fused | mixed | 4096 | 101.70 ± 6.37 | 105.18 | 1564.96 ± 118.55 |
| Locals server | fused | mixed | 0 | 113.07 ± 3.38 | 112.76 | n/a |
| Locals server | unfused | int4 | 4096 | 53.45 ± 0.93 | 53.51 | 1491.27 ± 85.59 |
| Locals server | unfused | int4 | 0 | 45.10 ± 1.08 | 44.64 | n/a |
| Locals server | unfused | mixed | 4096 | 81.22 ± 3.27 | 81.39 | 1307.16 ± 107.22 |
| Locals server | unfused | mixed | 0 | 67.23 ± 1.46 | 67.02 | n/a |
| llama.cpp | stock | Q5_K_XL | 4096 | 65.23 ± 1.49 | 64.82 | 1045.18 ± 97.91 |
| llama.cpp | stock | Q5_K_XL | 0 | 72.27 ± 1.44 | 72.05 | n/a |
PROMPT_IDS n=4096 sha256=ccd5b148c2d3230cd4403d80d6bb73fe684a9b45467638b3b560a3cfc6a2bf8c
Running warmup..
Timing with prompt_tokens=4096, generation_tokens=128, batch_size=1.
Trial 1: prompt_tps=1448.483, generation_tps=101.137, peak_memory=19.051, total_time=4.096
Trial 2: prompt_tps=1345.319, generation_tps=101.417, peak_memory=19.052, total_time=4.310
Trial 3: prompt_tps=1223.629, generation_tps=98.898, peak_memory=19.052, total_time=4.645
Trial 4: prompt_tps=1209.204, generation_tps=98.689, peak_memory=19.052, total_time=4.687
Trial 5: prompt_tps=1175.510, generation_tps=97.014, peak_memory=19.053, total_time=4.807
Averages: prompt_tps=1280.429, generation_tps=99.431, peak_memory=19.052
SUMMARY prompt_tps n=5 median=1223.629 min=1175.510 max=1448.483
SUMMARY generation_tps n=5 median=98.898 min=97.014 max=101.417
PROMPT_IDS n=4096 sha256=ccd5b148c2d3230cd4403d80d6bb73fe684a9b45467638b3b560a3cfc6a2bf8c
Running warmup..
Timing with prompt_tokens=4096, generation_tokens=128, batch_size=1.
Trial 1: prompt_tps=1731.588, generation_tps=142.859, peak_memory=20.518, total_time=3.267
Trial 2: prompt_tps=1730.802, generation_tps=139.420, peak_memory=20.518, total_time=3.290
Trial 3: prompt_tps=1600.421, generation_tps=139.993, peak_memory=20.518, total_time=3.479
Trial 4: prompt_tps=1438.964, generation_tps=130.770, peak_memory=20.518, total_time=3.832
Trial 5: prompt_tps=1400.738, generation_tps=123.204, peak_memory=20.518, total_time=3.968
Averages: prompt_tps=1580.502, generation_tps=135.249, peak_memory=20.518
SUMMARY prompt_tps n=5 median=1600.421 min=1400.738 max=1731.588
SUMMARY generation_tps n=5 median=139.420 min=123.204 max=142.859
PROMPT_IDS n=4096 sha256=ccd5b148c2d3230cd4403d80d6bb73fe684a9b45467638b3b560a3cfc6a2bf8c
Warmup: completion_tokens=128 cached_tokens=0
Trial 1: prompt_tps=1656.840, generation_tps=105.333, completion_tokens=128, cached_tokens=0, total_time=3.687
Trial 2: prompt_tps=1658.189, generation_tps=105.177, completion_tokens=128, cached_tokens=0, total_time=3.687
Trial 3: prompt_tps=1634.231, generation_tps=108.040, completion_tokens=128, cached_tokens=0, total_time=3.691
Trial 4: prompt_tps=1468.896, generation_tps=96.844, completion_tokens=128, cached_tokens=0, total_time=4.110
Trial 5: prompt_tps=1406.654, generation_tps=93.130, completion_tokens=128, cached_tokens=0, total_time=4.286
PEAK_FOOTPRINT_GB=19.0 (phys_footprint_peak of the server pid, after the trials)
VIOLATIONS=0
Locals against stock mlx-lm
Fused against unfused, same model, same path (mixed build, means):
- In the mlx-lm loop: 135.25 / 102.21 = 1.32× at depth 4096, and 152.33 / 98.97 = 1.54× at depth 0.
- Locals server: 101.70 / 81.22 = 1.25× at depth 4096, and 113.07 / 67.23 = 1.68× at depth 0.
Fused against stock mlx-lm on the mixed build:
- In the mlx-lm loop: 135.25 / 99.43 = 1.36× at depth 4096, and 152.33 / 108.21 = 1.41× at depth 0.
- Locals server: 101.70 / 99.43 = 1.02× at depth 4096, and 113.07 / 108.21 = 1.04× at depth 0.
So the Locals build speeds up the mlx-lm generate loop by roughly 1.4× (135.25 / 99.43 = 1.36× against stock at depth 4096; the stock and Locals arms ran different mlx-lm versions, see the caveat under the bias list below), and Locals' own server gives most of that back on these prompts. The server keeps 101.70 / 135.25 = 0.75 of the loop speed at depth 4096 and 113.07 / 152.33 = 0.74 at depth 0. The cause is not isolated, so treat any explanation as unverified. The prompts are random token ids, not English; the server uses /v1/completions, not chat; end-of-sequence is ignored; and my speed formula differs from the first run's. All of those changed together with the loop-to-server switch. The unfused server rows are also slower than the unfused loop rows, so the gap shows up without fusion too.
Things that could bias these ratios:
- Fused always ran before unfused, and decode drifted down across the trials within a row (fused mixed in the loop: 142.86 in trial 1, 123.20 in trial 5). The raw server rows for unfused mixed at depth 4096 went from 78.13 in trial 1 to 83.67 in trial 5 while fused went from 105.33 to 93.13, so a session-wide slowdown could favour fused. The direction of the bias is unclear, and the true error is larger than the sd of 5.
- The stock arm runs mlx-lm 0.32.3.dev18 and the Locals arm 0.32.2, so "Locals against stock" includes any generate-loop difference between those versions, not only the kernels.
Quality for the fused kernels: it is the same weights with greedy decoding, but I did not re-run quality through Locals. I have no Locals quality number and I am not implying one.
The mixed build against int4
Both are stock mlx-lm. At depth 4096, mixed decodes at 99.43 tok/s and int4 at 99.26: 99.43 / 99.26 = 1.002, about +0.2%. At depth 0 it is 108.21 / 106.78 = 1.013, about +1.3%. Those are within the spread of 5 trials (sd 1.84 and 2.61 at depth 4096), so I would call the two level on speed. Peak memory is 23.78 GB for int4 and 19.05 GB for mixed: 23.78 − 19.05 = 4.73 GB less for mixed. Prefill is lower for mixed: 1280.43 against 1459.34 tok/s, and 1280.43 / 1459.34 − 1 = −0.123, about −12%.
llama.cpp, and the number I could not check
On the Q5_K_XL GGUF, llama.cpp decodes at 65.23 ± 1.49 tok/s at depth 4096 and 72.27 ± 1.44 at depth 0, with prefill at 1045.18 tok/s for a 4096-token prompt.
A TeksEdge post about an RTX 3060 with 12 GB (using RustingStrata) reported 64.6 tok/s. I tried to read it and the page returned HTTP 402, so 64.6 is unverified. I am only using it as a rough reference, and I would not build on it:
- My own llama.cpp run on the same GGUF at depth 4096: 65.23 / 64.60 = 1.01×, about level.
- 101.70 / 64.60 = 1.57× vs an unverified 64.6. That is Locals fused mixed through the server at depth 4096, against a number I could not check.
The int4 build through Locals
Locals fused on RecursiveSI/flint-int4 is slower than stock mlx-lm on the same build. Through the server at depth 4096: 51.79 / 99.26 = 0.522, and 1 − 0.522 = 0.478, so about 48% slower. At depth 0: 47.58 / 106.78 = 0.446, and 1 − 0.446 = 0.554, about 55% slower. In the mlx-lm loop at depth 4096 it is 61.84 / 99.26 = 0.62×. Unfused is no better (server 53.45, loop 63.30 at depth 4096). I do not recommend it.
I have a partial explanation, and it is a correlation. Locals loads this int4 build through its streamed model class, while stock mlx-lm uses the resident one, and the slowdown tracks that loader path. Which part dominates (reads from disk, or the indirection into expert slots) I did not measure: the expert cache may hold most experts on 128 GB. I have not verified that, so it is a guess.
How close to the bandwidth limit
Using my 2.5B × 0.5625 B/param estimate (4.5 bits per parameter, applied to the stock int4 speed at depth 4096, not a measured footprint):
- 2.5e9 × 0.5625 = 1.406 GB per token.
- 1.406 × 99.26 = 139.6 GB/s.
- 139.6 / 400 = 0.35, so about 35% of Apple's 400 GB/s.
At a flat 4 bits per parameter it would be 1.25 GB per token, 1.25 × 99.26 = 124.1 GB/s, 31%. Either way decode is far from the bandwidth limit. That is consistent with per-step dispatch overhead being the bottleneck, which is what the fused kernels attack. It is consistent with that, not proof of it.
Quality
Both builds ran greedy at temperature 0. Flint's chat template always opens a <think> block, so thinking is on for both. Counts below are passes out of the total.
- ToolAlpaca (97 items, exact match, 1024-token budget): int4 18/97 = 18.6%, mixed 22/97 = 22.7%. That is +4.1 points for mixed ((22 − 18) / 97 = 4/97). Paired by item: 9 both right, 9 int4-only, 13 mixed-only. A two-sided sign test on the 22 discordant items gives p = 0.52.
- HumanEval+ (164 problems): int4 142/164 = 86.6%, mixed 136/164 = 82.9%. That is −3.7 points for mixed ((142 − 136) / 164 = 6/164). Paired: 132 both pass, 10 int4-only, 4 mixed-only. The sign test on the 14 discordant problems gives p = 0.18.
- HumanEval (base): int4 148/164 = 90.2%, mixed 146/164 = 89.0%.
Neither difference is statistically significant. My reading is that the mixed build possibly loses a few points on code, not proven, and may not lose anything on tool use.
Caveats on these tests:
- HumanEval+ used evalplus 0.3.1 with
max_new_tokensraised to 4096. Empty replies, where the budget ran out inside<think>, are scored as fails: 13 for int4 and 15 for mixed. - Scoring ran with
EVALPLUS_MAX_MEMORY_BYTES=-1, because evalplus' memory limit call is not supported on macOS and failed every test. My first scoring pass gave a bogus 0.0 for that reason, and I do not count it. - On ToolAlpaca, 10 of 97 replies were empty for each build because they hit the 1024-token budget inside
<think>. All scored as wrong. - These are small test sets. A sign test on 14 or 22 discordant items cannot see a small difference.
Is Flint my Home Base default? No.
I cut Home Base (the assistant I run on this Mac) over to Flint and reverted the same morning. Tool calls passed: correct structured tool calls in 1.7–3.3 s. Plain chat failed. Tool-free turns carry the assistant's working-list checklist instruction, and Flint over-thinks it. With a 2048-token budget it returned empty content. With the real budget it answers, slowly.
Measured through the assistant, temperature 0:
- "What is 17*23? Reply with just the number." Flint took 38.6 s and 5,023 tokens. Flash, the model that stays the default, took 14.5 s and 3 tokens.
- "Name three primary colors, comma-separated." Flint took 24.2 s and 2,868 tokens. Flash took 2.4 s in total.
- "Explain in two sentences what a mutex is." Flint took 10.9 s and 1,207 tokens. I did not measure Flash on this one.
Flint's chat template has no thinking switch, so I could not turn its reasoning off or budget it. Its raw decode was higher than Flash's in a quick probe (107.5 against 41.9 tok/s, medians of 3, not a benchmark), but on the chat path latency is set by how long it reasons, and there Flint was several times slower.
What I would run
- Simplest: stock mlx-lm on
mlx-community/flint-mixed-3-4bit, 99.43 tok/s at depth 4096 and 19.05 GB. Through the Locals server the same build measured 101.70, 1.02× that. - If you run your own generate loop and want the kernels: Locals' loader inside mlx-lm's loop measured 135.25 tok/s at depth 4096, 1.36× stock. I only ran that through the benchmark harness.
- If the HumanEval+ gap matters more than speed: stock mlx-lm on
RecursiveSI/flint-int4, 99.26 tok/s at 23.78 GB. - Not int4 through Locals.
What this does not tell you
- One machine, one session, means of 5 trials after 1 warmup; quality is one run per build. The sd is in the table, and fused rows drifted down within a row, so the real error is larger than the sd.
- Pageouts were not flat. The largest jump (+1,499) came during the fused mixed loop row at depth 4096, when free memory fell from 43% to 31%. Swap was high (34 to 60 GB used) from other jobs. The GPU read 0% before every step. That is probably not decisive, but it is not clean.
- The mixed loop rows and the mixed server rows ran about 10 minutes apart, with swap at 13 GB used for one and 55 GB for the other, so compare loop against server cautiously.
- llama.cpp is length-and-depth matched only, not the same ids. The 64.6 is unverified.
- These prompts are random token ids. The first run's Locals figure came from short English chat prompts and does not reproduce on random-token prompts through the server. I did not isolate why: prompt content, endpoint, ignore-eos and the speed formula all changed together, and prompt-lookup is not it, since the first run's arm with it off was as fast. Real chat may behave differently, so do not extrapolate the server result either way.
- No quality number through Locals.
- I did not try speculative decoding with a draft model, because I could not find a usable draft for MLX: Flint has no MTP layers, and the one draft I know of targets CUDA only.
Thanks again to Generated Computers for Locals. The speedup is theirs.
Change log
- Hardware: Apple M3 Max, 16-core CPU, 40-core GPU, 128 GB (MacBook Pro).
- Model:
mlx-community/flint-mixed-3-4bit, RecursiveSIflint-int4, unslothflint-UD-Q5_K_XLGGUF; Locals commitb35c46c; stock mlx-lm 0.32.3.dev18 with mlx 0.32.4, Locals' environment mlx-lm 0.32.2, llama.cpp 0.8.0 (Homebrew). - Prompts: the Locals runs in the first version used shorter prompts (short English chat prompts from
locals bench) than the baselines (4096-token prompts). This rerun replaces that comparison with byte-identical seeded random token ids, sha256-checked, for every MLX arm; llama.cpp is length-and-depth matched only. - Settings: 128 new tokens, greedy, end-of-sequence disabled, 1 warmup + 5 trials, mean ± sample sd; the first version used medians of 5.
Problem: The first speed comparison measured Locals and the baselines on different prompts
Change: First speed run (retracted)
- Status: reverted
- Rationale: Measure the Locals fused kernels against stock mlx-lm and llama.cpp. I used
locals benchbecause the first brief said no custom bench, and it has no prompt-length option. - Predicted: A fair speed comparison of fused Locals against unfused Locals, stock mlx-lm and llama.cpp.
- Observed: Medians from the first run: 144.8 tok/s fused mixed; 144.8 / 104.8 = 1.38× against unfused; 144.8 / 64.6 = 2.24× against an unverified 64.6; a ~1.29× estimate (109.5 / 102.7 = 1.066, 105.1 × 1.066 ≈ 112, 144.8 / 112 ≈ 1.29); and 102.7 / 54.0 = 1.90× for the int4 build. The Locals arms ran short prompts and the baselines ran 4096-token prompts. All of these are retracted.
- Settings: (override)
locals benchon short chat prompts againstmlx_lm benchmarkandllama-benchat 4096; medians of 5 after warmup.
Change: Same-prompt rerun
- Status: kept
- Rationale: Make every MLX arm use byte-identical prompt ids and replace the mixed-workload ratios.
- Predicted: The fused-against-unfused direction would hold, and the first run's Locals figure and 2.24× would shrink once the prompts matched.
- Observed: Direction held and the size shrank. Fused against unfused: 1.25×–1.68× (135.25 / 102.21 = 1.32×, 152.33 / 98.97 = 1.54×, 101.70 / 81.22 = 1.25×, 113.07 / 67.23 = 1.68×). Fused against stock mlx-lm mixed: 135.25 / 99.43 = 1.36× in the loop, 101.70 / 99.43 = 1.02× through the server at depth 4096. The first run's Locals figure did not reproduce through the server (101.70 at depth 4096, 113.07 at depth 0). Disclosed: fused ran before unfused and decode drifted down within rows; stock mlx-lm 0.32.3.dev18 against Locals' 0.32.2; pageouts not flat (+1,499 in the fused mixed loop row at depth 4096); loop and server mixed rows ran in different lock windows; llama.cpp is length-matched only.
Change: Server arms on the first pass
- Status: failed
- Rationale: Measure Locals as Home Base would run it, through its server, on the same ids.
- Predicted: The 4 server arms would run alongside the loop arms in the same session.
- Observed: The server arms failed at start, because the environment-variable flag order I used is invalid on macOS. I fixed the order and reran only the server arms; the 8 server trial sets in the table all come from the rerun, with 0 violations.
Change: int4 prompt ids on the Locals arm
- Status: failed
- Rationale: Run the int4 build through Locals on the same ids as stock.
- Predicted: Seeding the generator the same way would give the same ids.
- Observed: Locals' streamed int4 load consumed the global random generator, so Locals int4 drew different ids twice (hash prefixes
f13ac91621, then2da784d7b1). Both attempts are superseded and kept; I reran with the ids pinned to the stock run, and all hashes now match. The superseded decode numbers were within about 2–8 tok/s of the pinned runs.
Change: Stock int4 measured twice
- Status: kept
- Rationale: The stock int4 row was run in the first window and again later in the session.
- Predicted: The two runs would agree.
- Observed: 100.20 / 107.53 tok/s (depth 4096 / depth 0), then 99.26 / 106.78. They agree; the table uses the second.
Problem: Whether Flint should be my Home Base default
Change: Flint as the default model
- Status: reverted
- Rationale: Higher raw decode than Flash.
- Predicted: Faster chat at equal answers.
- Observed: "What is 17*23?" took 38.6 s and 5,023 tokens on Flint against 14.5 s and 3 tokens on Flash. At a 2048-token budget Flint returned empty content. Tool calls passed in 1.7–3.3 s. Reverted the same morning.
- Prompts: (override) Home Base assistant prompts, temperature 0.
Project: Flint/Locals · Tags: Benchmarks Local inference MLX Quantization