Running 30B–120B MoE Models on a 12 GB Laptop GPU
Before buying parts for a local AI server, I wanted to know how far a laptop with a 12 GB GPU could go using llama.cpp's MoE expert offloading.
Hardware and software
| Part | Spec |
|---|---|
| CPU | Intel Core Ultra 9 275HX (8 P-cores, 16 E-cores) |
| RAM | 96 GB DDR5-5600 (2×48 GB SODIMM) |
| GPU | NVIDIA RTX 5070 Ti laptop, 12 GB GDDR7 |
| OS | Pop!_OS |
| llama.cpp | build 11fe02151 (11382), CUDA |
Why offloading works for MoE
A mixture-of-experts model only uses a few of its experts for each token. --n-cpu-moe N keeps the expert weights of the first N layers in system RAM and puts everything else, including attention and the KV cache, on the GPU. The large expert weights stay in RAM, and the GPU handles the work that runs on every token.
Results
All runs:
-ngl 99 -t 8 -fa on --cache-type-k q8_0 --cache-type-v q8_0, prompt processing measured on 2048 tokens and generation on 128 tokens, at each context depth. For each model, I used the fewest expert layers on the CPU that still fit 131k tokens of context in VRAM.
Qwen3.6-35B-A3B (UD-Q4_K_M, 21.1 GiB, --n-cpu-moe 24)
| Tokens already in context | Prompt processing (t/s) | Generation (t/s) |
|---|---|---|
| 0 | 719.51 ± 8.77 | 65.90 ± 5.36 |
| 16384 | 670.17 ± 8.62 | 60.86 ± 1.85 |
| 65536 | 613.86 ± 2.68 | 47.64 ± 2.36 |
| 131072 | 542.16 ± 0.78 | 35.26 ± 0.58 |
gpt-oss-120b (Q8_0, 59.0 GiB, --n-cpu-moe 32)
| Tokens already in context | Prompt processing (t/s) | Generation (t/s) |
|---|---|---|
| 0 | 268.74 ± 6.33 | 21.13 ± 0.44 |
| 16384 | 261.10 ± 1.90 | 20.14 ± 0.29 |
| 65536 | 236.86 ± 4.56 | 17.87 ± 0.18 |
| 131072 | 211.60 ± 1.09 | 15.06 ± 0.16 |
A 117B-parameter model generating at about 21 tok/s on a laptop, and still at 15 tok/s with 131k tokens in context.
Qwen3-Coder-30B-A3B-Instruct (Q4_K_M, 17.3 GiB, --n-cpu-moe 38)
| Tokens already in context | Prompt processing (t/s) | Generation (t/s) |
|---|---|---|
| 0 | 645.78 ± 7.41 | 44.37 ± 0.87 |
| 16384 | 572.01 ± 7.11 | 35.04 ± 0.52 |
| 65536 | 333.38 ± 0.96 | 17.10 ± 0.78 |
| 131072 | 211.63 ± 0.37 | 10.15 ± 0.36 |
Finding the expert layer count for Coder at 131k context, by hand:
| --n-cpu-moe | VRAM used |
|---|---|
| 50 | 7.9 GB |
| 40 | 10.9 GB |
| 38 | 11.6 GB |
| 37 | failed |
Why the models slow down differently
| Model | Generation, empty → 131k | Prompt processing, empty → 131k |
|---|---|---|
| gpt-oss-120b | −29% | −21% |
| Qwen3.6-35B-A3B | −46% | −25% |
| Qwen3-Coder-30B-A3B | −77% | −67% |
The smallest model slows down the most. My best explanation is how each model handles attention:
- gpt-oss-120b alternates between full attention and layers that only look at the last 128 tokens, so only half its layers read the whole context.
- Qwen3.6-35B-A3B uses linear attention in most layers, and only some layers keep a KV cache that grows with the context.
- Qwen3-Coder-30B-A3B uses full attention in every layer, so every layer reads the whole context for every token.
The same design also decides how much VRAM the context takes, which is why Coder needed the most expert layers on the CPU to fit 131k tokens.
KV cache in RAM vs. on the GPU
My earlier Qwen3.6 setup kept the KV cache in system RAM (-nkvo 1) with 33 expert layers on the CPU. The current setup keeps the cache on the GPU with 24 expert layers on the CPU. Same model file, same build, same q8_0 cache.
| Context | Generation, old → new | Prompt processing, old → new |
|---|---|---|
| 0 | 53.29 → 65.90 (+24%) | 562 → 720 (+28%) |
| 16384 | 51.37 → 60.86 (+18%) | 517 → 670 (+30%) |
| 65536 | 47.45 → 47.64 (+0%) | 498 → 614 (+23%) |
| 131072 | 44.09 → 35.26 (−20%) | 437 → 542 (+24%) |
Prompt processing improved at every depth. Generation improved up to 16k, broke even at 64k, and fell behind at 131k: the old setup lost 17% between an empty context and 131k, while the new one lost 46%. Two settings changed at once, so I can't yet say which one causes the long-context slowdown.
Thread count
gpt-oss-120b, 126-token generation at an empty context, --n-cpu-moe 32, cache on the GPU:
| Threads | Generation (t/s) |
|---|---|
| 8 | 19.48 ± 1.64 |
| 12 | 18.99 ± 0.92 |
| 16 | 18.93 ± 0.77 |
| 17 | 8.27 ± 0.37 |
| 18 | 7.46 ± 0.34 |
| 20 | 6.61 ± 0.15 |
| 22 | 6.04 ± 0.06 |
| 24 | 5.58 ± 0.11 |
8 to 16 threads were within noise of each other. Adding a 17th thread cut generation by more than half. I don't know why yet; details in a separate write-up.
Notes
- All runs use a q8_0 KV cache.
- The Qwen3.6 GGUF includes MTP (multi-token prediction) layers. llama-bench doesn't use them, so these are plain generation speeds.