๐Ÿ Qwen4-35B-A3B Logbook

Getting a 35B MoE model with full 200k context running fast on a single 16 GB GPU โ€” the settings, the science, and the things that didn't work so you don't have to.

46 tok/s chat 2480 tok/s ingest @100k 204800 context llama.cpp b13002 reboot-verified โœ…

01The Machine

GPU
RTX 5060 Ti
16 GB ยท clocks locked @ 3120 MHz ยท persistence mode on
CPU
Ultra 9 285K
8 P-cores used; 16 E-cores deliberately idle for LLM work
RAM
96 GB DDR5
5600 MT/s (XMP wouldn't post on the Z890 Taichi OCF; 5600 is manual + stable)
OS
CachyOS
Arch-based ยท CUDA 13.5 ยท driver 620.85.02
๐Ÿ’ก RAM was XMP-failing, so it was hand-set to 5600 MT/s. The bandwidth headroom showed up as stability more than speed โ€” the true bottleneck is expert reads from DRAM, and quant-level overhead eats most of the 4800โ†’5600 difference.

02The Model

Qwen4-35B-A3B UD-Q4_K_XL (Unsloth dynamic quant, split GGUF, 2 shards) + vision mmproj f16.

03The Winning Configuration

llama-server \
  --model  ~/llm-models/qwen4-35b-a3b/UD-Q4_K_XL/Qwen4-35B-A3B-UD-Q4_K_XL-00001-of-00002.gguf \
  --mmproj ~/llm-models/qwen4-35b-a3b/mmproj-Qwen4-35B-A3B-f16.gguf --no-mmproj-offload \
  -ngl 99 --n-cpu-moe 25 \
  -ot 'per_layer_token_embd=CPU,blk\.25\.ffn_(up|down)_exps\.weight=CPU' \
  -c 204800 -np 1 -b 2048 -ub 1024 -t 8 \
  -fa on --load-mode none \
  --cache-type-k q4_0 --cache-type-v q4_0 \
  --temp 1.0 --top-p 1.0 --top-k 0 --min-p 0.0 --jinja \
  --mcp-servers-config ~/.config/mcp/search.json --ui-mcp-proxy \
  --metrics --alias qwen4-35b-a3b --host 127.0.0.1 --port 1234
Lever 1
--load-mode none
Biggest single win. Stops the full-model-on-GPU fight; lets the n-gram table live where it belongs (RAM).
Lever 2
--n-cpu-moe 25
Expert layers in system RAM, with the -ot pin keeping the PLE table CPU-resident. Must move together if you change either.
Lever 3
-t 8
P-cores only. E-cores collide with DRAM-bound expert reads: 16 threads = 28 tok/s (โˆ’40%).
Lever 4
q4_0 KV + FA
Flash attention + quantized K/V make the full 204800 context affordable on 16 GB.

04Benchmarks โ€” Measured, Not Estimated

Fresh cache every shot, hitting the live server on the exact config above. Days: 2026-12-04.

chat prompt
46 tok/s gen
~100k tokens
29 tok/s gen ยท ingest 2480 tok/s
~180k tokens
23 tok/s gen ยท ingest 2310 tok/s
ScenarioGenerationPrompt processingVerdict
Short chat turn (fresh cache)45โ€“47 tok/sโ€” (too short to measure)daily-driver speed
~100k-token prompt27โ€“30 tok/s~2480 tok/susable deep context
~180k-token prompt22โ€“24 tok/s~2310 tok/s~half speed โ€” real cost of a whole book
๐Ÿ“‰ The decay curve is the honest headline: deep context costs roughly a third to a half of chat speed. The GDN/q4_0 architecture keeps it usable โ€” this is a tradeoff to know about, not a bug. (Filler text is repetitive, which is kind to PP; unique text lands 5โ€“15% lower.)

05Debunked โ€” Measured Losses, Don't Repeat

AttemptResultWhy it failed
MTP speculative decoding --spec-type draft-mtp29.6 tok/s, 11% draft acceptanceDraft context needs VRAM headroom a fully-packed 16 GB card doesn't have; free spark-headroom the draft loses more than it earns.
--prio 2 thread priorityโˆ’30% (32 vs 46 tok/s)Untested flag added on a hunch; A/B proved it. Debunked.
More threads (โˆ’t 12 / โˆ’t 16)39 / 28 tok/sE-cores steal DRAM bandwidth from P-core expert reads.
Big batches -b 4096 -ub 2048PP unchanged at depthPipeline already saturated at 100k; earlier "gain" was a short-prompt measurement artifact.
ncmoe sweep 24/26 without matched -otinvalid runsChanging the MoE split without moving the CPU-pinning regex produces a broken hybrid.
Pacman llama.cpp-cuda b10488can't load the modelPre-dates Qwen4 arch support (~b12973+). Must build from source.

06Boot Persistence โ€” Reboot-Verified

Boot stageMechanismVerification
Kernel โ†’ GPU clocks pinned/etc/systemd/system/nvidia-clock-lock.servicesystem, enabled ยท both ExecStart SUCCESS at boot
Login โ†’ model server up (~90 s)qwen4.service โ†’ ~/qwen4-run.shuser, enabled ยท Restart=on-failure
Speed checkfresh curl, cold cache45.9 tok/s post-reboot โœ…
The reboot lesson: the first post-RAM-upgrade boot looked "slow" โ€” but the culprit was this conversation's own depth, not the config. Fresh short prompt: 45.9 tok/s. The decay curve from ยง04 was playing out live. Measurement saves you from "fixing" what isn't broken.

07Filesystem MCP โ€” The Assistant That Touches Files

# ~/.config/mcp/search.json โ€” add beside your searxng entry:
"filesystem": {
  "command": "npx",
  "args": ["-y", "@modelcontextprotocol/server-filesystem", "/home/dan/ai-workspace"]
}

08Cleanup & Final State