32GB of files on a 24GB Mac, at 51 tokens a second.
Qwen4-35B-A3B is a mixture-of-experts model with an unusual extra part. The main network has 35 billion parameters across 40 layers. Each layer has 256 experts, and eight of them plus one shared expert handle any given token, so about 3 billion parameters do the work each time. Alongside it sits a 20-billion-parameter n-gram embedding table (Unsloth's files call it the engram), which works as a lookup: the model fetches the rows it needs instead of multiplying through the whole thing. There is also a small multi-token prediction head for drafting ahead, the model reads images as well as text, and the context window is 1,048,576 tokens. That is the model card's description; we did not test images, or anything close to a million tokens.
The table is why a 24GB Mac is worth trying. Unsloth's 4-bit files come to 32GB, more than the machine's memory, but 11.5GB of that is the table, and llama.cpp leaves it on the SSD and reads only what each token needs. What has to fit in memory is the main network, and with about 3 billion parameters in play per token it is quick once it is there.
Stock llama.cpp works. The suggested flags do not, on 24GB.
Qwen 4 support was merged into llama.cpp on 3 December (pull request 33626), so the ordinary release build runs it. We used b13005 from 5 December and Unsloth's UD-IQ4_XS quant, their pick for a 24GB machine: a 20.5GB main file and an 11.5GB file that holds the embedding table.
# llama.cpp b13005, the ordinary Apple silicon build curl -sSL -o llama.tgz https://github.com/ggml-org/llama.cpp/releases/download/b13005/llama-b13005-bin-macos-arm64.tar.gz mkdir -p llama && tar -xzf llama.tgz -C llama --strip-components=1 # Unsloth's pick for 24GB: two files, 20.5GB and 11.5GB, kept in the same folder R=https://huggingface.co/unsloth/Qwen4-35B-A3B-GGUF/resolve/main/UD-IQ4_XS curl -sSLO $R/Qwen4-35B-A3B-UD-IQ4_XS-00001-of-00002.gguf curl -sSLO $R/Qwen4-35B-A3B-UD-IQ4_XS-00002-of-00002.gguf # serve it: reasoning off, one slot, 32K context, everything else left alone ./llama/llama-server -m Qwen4-35B-A3B-UD-IQ4_XS-00001-of-00002.gguf \ --reasoning off -np 1 -c 32768 --port 8080
Two things to know. First, the model reasons before it answers unless you tell it not to: the effort settings are xhigh, high (the default), low and off. We ran everything here with --reasoning off, so these are direct-answer numbers.
Second, do not copy the suggested flags onto a 24GB Mac. Unsloth's notes recommend --load-mode mmap --lazy-mode on -ot per_layer_token_embd=CPU. With those, the server started, reported itself healthy, and then failed every request with Metal's Insufficient Memory error. The log says why: placing a tensor by hand switches off llama.cpp's automatic fitting (failed to fit params to free device memory: tensor_buft_overrides already set by user), so nothing was trimmed to suit a GPU that macOS allows about 16GB on this Mac. Leave the flags off. By default this build already reads the large table from disk as it needs it and fits everything else to the memory it finds: it held 16.8GB on the GPU and kept the remainder on the CPU side, with nothing for us to tune.
51 tokens a second, and prompts read at 400 or more.
Reasoning off, one request at a time, 32K context. Generation is measured from the first token to the last of a streamed 384-token reply; prompt processing is the prompt's length divided by the wait for the first token.
| UD-IQ4_XS at 32K, llama.cpp b13005 | Result | Runs |
|---|---|---|
| Generation, code | 51.5 tok/s | 51.9 and 51.1; the first run after loading was 45.4 |
| Generation, prose | 51.0 tok/s | 51.4 and 50.7; the first was 49.3 |
| Reading a 2,753-token prompt | about 400 tok/s | 7.3 s and 6.5 s to the first token |
| Reading a 10,974-token prompt | about 480 tok/s | 22.7 s and 22.9 s to the first token |
| Load time, files already read once | 5 s | every start |
That is quick for a model of this size on a Mac mini. The reason is the shape of the model: speed on Apple silicon is set by how many bytes of weights the chip reads per token, and a mixture of experts reads a small slice of itself each time. For comparison, the dense Qwen3.8-27B managed 11.4 tokens a second on a 24GB M4 Pro when we tested it. That was a slower chip, so it is not a like-for-like figure, but a model that puts 3 billion parameters to work per token will always be quicker than one that uses all 27.
A bigger context window costs speed, not memory. llama.cpp fits a larger window by moving more of the model off the GPU, so the GPU stays at about 16.8GB whatever you ask for and generation slows instead:
| Context window | Generation, code | Generation, prose |
|---|---|---|
| 8K | 45.5 tok/s | 50.0 tok/s |
| 32K | 45.4 tok/s | 49.3 tok/s |
| 65K | 34.7 tok/s | 45.5 tok/s |
| 131K | 25.1 tok/s | 34.8 tok/s |
| 262K | 8.6 tok/s | 10.4 tok/s |
One short request each, straight after loading, so the figures in this table sit a little under the settled 51. These are the sizes of the window the server was started with, not prompts of that length: we did not fill them. There is no speed to gain below 32K, and 32K is the size we would run.
Drafting ahead helps code, not prose. Qwen 4 ships a multi-token prediction head that guesses the next couple of tokens for the main model to check. The drafters we tried with earlier models did nothing for us on a Mac mini; this one does, on code:
| 32K context | Generation, code | Generation, prose |
|---|---|---|
| Without drafting | 51.5 tok/s | 51.0 tok/s |
| With the prediction head, depth 2 | 63.8 tok/s | 48.1 tok/s |
The flags are --spec-type draft-mtp --spec-draft-n-max 2. Code went up by about 1.24 times, with half the drafted tokens accepted (49 to 56%); prose did not improve. Unsloth report 1.3 to 1.4 times on code on an M5 Max. If most of what you generate is code, switch it on.
38 of 41 on code, 49 of 50 on maths, without reasoning.
The same two checks as our earlier posts, on this Mac, through llama-server's chat endpoint with greedy decoding (temperature 0) so every run is repeatable, reasoning off, a cap of 2,048 tokens per answer, 32K context:
- HumanEval: 41 Python problems (every fourth of the 164), scored by running the official unit tests against the model's code. Pass or fail, no judging.
- GSM8K: the first 50 grade-school maths word problems from the test set, scored on the final number.
| Model (4-bit, reasoning off, greedy) | HumanEval (41) | GSM8K (50) | Average per problem |
|---|---|---|---|
| Qwen4-35B-A3B, UD-IQ4_XS, this Mac | 38 (93%) | 49 (98%) | 210 tokens, 5.6s (code); 158 tokens, 4.8s (maths) |
| Qwen3.8-27B, on a 48GB Mac in October | 37 (90%) | 48 (96%) | see that post |
The second row is from our Nanbeige post, where we ran the same two checks on Qwen3.8-27B, also at 4-bit with thinking off. One answer better on each is a tie at this sample size. What changed is the time it takes: the whole coding set ran in under four minutes here.
We read every miss. No answer ran out of tokens; all four were finished and wrong in small ways. One returned the largest numbers in descending order when the tests wanted ascending. One put the minus sign on a negative number's whole digit sum when only its first digit should be negative. One failed a single case of a bracket-nesting problem. The maths miss is a wording trap that has caught a model here before: asked when a lemon tree starts earning money, it gave the year it breaks even (12) and not the year after (13).
Is there room to code with it loaded? Yes, for one thing at a time.
A model that fits is one thing. A Mac you can still use is another. Here is what macOS reported on this Mac before the model was loaded, with it loaded at 32K, and after it had worked through the quality checks:
| Nothing loaded | Model loaded | After the quality run | |
|---|---|---|---|
| GPU memory held | none | 16.8GB | 16.8GB |
| Memory macOS cannot move (wired) | 1.5GB | 18.3GB | 18.2GB |
| Memory free, as macOS reports it | 87 to 90% | 12% | 8% |
| Swap in use | none | none | 7.2GB |
Then the test that answers the question. We took Vapor, the Swift web framework, and timed a clean swift build with the Mac to itself, and then twice more with the model generating text continuously the whole time, 256 tokens after 256 tokens, straight after its quality run.
| Clean build of Vapor | Build time | Generation during the build | Swap at the end |
|---|---|---|---|
| Mac to itself | 49.5 s | model not loaded | none |
| Model generating, first build | 75.9 s | 12 to 51 tok/s, 29 on average | 8.4GB |
| Model generating, second build | 73.2 s | 8.5GB |
The build took half as long again, and the model's speed swung between a quarter of normal and normal as the compiler came and went. The moment the build finished it was back at 50 tokens a second. Nothing failed and nothing was killed. Both jobs got done on the same Mac at the same time, which is more than we expected from 24GB.
So is there room to code and work on 24GB with Qwen 4 loaded? For one thing at a time, yes: an editor, a terminal, a command-line build, with the model answering alongside. You pay as you go, with a slower build and a model that stutters while the compiler runs. But 8.5GB of swap says the machine is at its limit, and we would not expect it to leave room for the heavy end of Mac development at the same moment: Xcode with a simulator, a browser full of tabs and a model holding 17GB is a job for 48GB. We did not test that combination, so take it as our reading of the memory figures, not a measurement. We also did not try a smaller quant such as UD-IQ3_XXS, whose main file is 3GB smaller; it is the obvious next thing to try if you want more room left over.
Quick, level with Qwen3.8-27B on our checks, and the Mac stays usable.
- Qwen4-35B-A3B runs on a 24GB Mac mini. The day after release, on the ordinary llama.cpp build, with no system setting changed. The files are bigger than the memory because the embedding table stays on the SSD.
- It is fast. 51 tokens a second, prompts read at 400 or more, and a five-second load.
- Leave the suggested flags off on 24GB.
-ot per_layer_token_embd=CPUswitches off automatic fitting, and every request then fails with an out-of-memory error. The defaults are right. - It holds up without reasoning. 38 of 41 on HumanEval and 49 of 50 on GSM8K at 4-bit, level with Qwen3.8-27B on the same checks.
- Draft ahead if you write code. The model's own prediction head took code from 51 to 64 tokens a second and did nothing for prose.
- Keep the context window at 32K unless you need more. 65K cost a quarter of the speed on code, and 262K cost four fifths.
- There is room to code, within reason. A clean Vapor build took 50 seconds alone and about 75 with the model generating throughout. macOS ended up with 8.5GB in swap, so treat it as a model and a build, not a model and a full desktop.
If you want the model with reasoning on, a longer context at full speed, or Xcode and a simulator beside it, that is a job for 48GB. On 24GB it is the fastest model of this quality we have tested, and the Mac still builds code while it runs.
How we ran these benchmarks.
One machine for every number: a Max plan Mac mini, Apple M5 Pro with a 15-core CPU and 16-core GPU, 24GB unified memory, 512GB SSD, macOS 27.0, headless, default GPU memory limit throughout; we did not change any system setting. Runtime: llama.cpp release b13005 (the prebuilt Apple silicon archive), Metal backend, default settings apart from --reasoning off, -np 1 and the context size. Model: Unsloth's Qwen4-35B-A3B-GGUF UD-IQ4_XS (20.5GB and 11.5GB), downloaded on 5 December. File sizes are as Hugging Face lists them; memory figures are as macOS reports them. Speed: streamed chat requests at temperature 0, one at a time. Generation is the tokens after the first divided by the time from the first token to the last, on a short coding prompt and a short prose prompt, three runs of 384 tokens each; the headline figure is the average of the second and third. Prompt processing is prompt tokens divided by the time to the first token, on prompts built from HumanEval problem statements with a unique first line so that nothing is cached, two runs each. Context sizes: one 128-token request of each kind per size. Memory: GPU memory in use from ioreg, wired memory from vm_stat, the free percentage from memory_pressure, swap from sysctl vm.swapusage. Quality: HumanEval (41 problems, every fourth) and GSM8K (first 50 test problems), reasoning off, temperature 0, a 2,048-token cap per answer, 32K context, scored automatically by running tests and comparing final numbers, every miss read by hand. Room to work: a clean debug swift build of Vapor at its 4 December commit, three runs with the Mac to itself and two with the model generating 256-token replies back to back. Drafting: --spec-type draft-mtp --spec-draft-n-max 2 at 32K, three runs each of code and prose, the second and third averaged. Not tested: images, reasoning, other quants, more than one request at a time, and prompts longer than 11,000 tokens.
Run it yourself. 24GB from £129 a month.
Every number in this article came from a Max plan Mac mini with 24GB of unified memory, the same kind of machine you rent, ready-provisioned in the UK. The one we tested has an M5 Pro; some Max plan Macs have an M4 Pro, which will be slower than the figures here. Dedicated hardware, full admin access, and an OpenAI-compatible endpoint on your own tailnet with the commands above. Want the model and a full day's work on the same Mac? Our Max Plus plan has 48GB. Pay by card, cancel any time.