Qwen4-35B-A3B on an 8 GB GPU — a 1M-token hybrid MoE, and whether it beats the 35B Qwen already there
A field report on a 35B-A3B n-gram-embedding MoE, an 8 GB Turing card, and ten graded tasks
Test date: 2026-12-04 · RustingStrata 1.4.6 (e145a23a + two local fixes) · RTX 2060 SUPER 8 GB
Abstract
Qwen/Qwen4-35B-A3B is a 35B-parameter hybrid mixture-of-experts model (3B active per token) with a 1M-token window, hyper-connections and a per-layer n-gram embedding table. This report runs it on an 8 GB RTX 2060 SUPER through RustingStrata and compares it with the Qwen3.6-35B-A3B already on the machine, using the same 2-bit quantisation and ten tasks graded by code:
- It runs, after two fixes to the engine. The first is a tokenizer name. The second is a hyper-connection matrix that the GGUF stores merged. Before that second fix the model loaded at full speed and replied only with gibberish (§2.4).
- It answers better. It scored 9/10 at 128K and 10/10 at 256K against Qwen3.6’s 8/10. It also used far fewer thinking tokens: 74–5,703 per task, where Qwen3.6 ran into the 8,192-token limit twice in repeating loops.
- It is half as fast. It averages 38 tok/s at 128K and 31 tok/s at 256K, against 78 tok/s for Qwen3.6. Its weights are 27.7 GB, against about 12 GB for Qwen3.6, so far less of its expert set fits in VRAM.
- 256K costs 2.7 GB of KV and fits on the card. The hybrid stack keeps a KV cache for only 10 of its 40 layers (§3). The price is that the extra KV takes VRAM away from the expert cache.
- A MacBook is not a substitute. The same 27.7 GB file on an 18 GB M3 Pro MacBook Pro decodes at 1.9 tok/s on the CPU. The engine has no Apple GPU path, and the weights do not fit in memory (§6).
So Qwen4 is the better model on this box when an answer matters more than speed. For interactive use, Qwen3.6 is still the one to keep loaded.
1. Test environment
| Component | Detail |
|---|---|
| GPU | NVIDIA GeForce RTX 2060 SUPER, 8 GB GDDR6 (7762 MiB usable), compute capability 7.5 (Turing, sm_75) |
| CPU | Intel Core i5-14400F, 10C/16T |
| RAM | 31 GB DDR5-4000 (XMP off) |
| OS | Ubuntu 24.04 LTS, driver 580.159.04, CUDA 13.0 |
| Engine | RustingStrata 1.4.6, built from origin/main e145a23a plus the two fixes below, cargo build --release |
| Server | systemd user unit, OpenAI-compatible on :8082, --gpu --kv q8, --ctx 131072 and 262144 |
| Weights | unsloth/Qwen4-35B-A3B-GGUF, UD-Q2_K_XL, 27.7 GB across two shards (16.16 + 11.52 GB) |
The interesting question is not whether a 35B-A3B runs on this card — a Qwen3.6-35B-A3B already does, at ~78 tok/s from an expert cache — but what the new model’s architecture costs, and whether it is worth the extra ~16 GB of weights (27.7 GB against 11.7 GB at the same quantisation).
2. Three gates: the architecture, one line of tokenizer, and a merged tensor
2.1 The architecture was already implemented
Qwen4-35B-A3B’s GGUF declares general.architecture = qwen4exp. That string is not new to this engine: the 135B Qwen3.8-Flash-Next on this box uses it, and RustingStrata 1.4.6 supports the whole family — the hybrid stack (src/config.rs:80), hyper-connections as 4 residual streams of rank 256 (hc_count, hc_lowrank; src/config.rs:440), the QSA sparse-attention indexer (attention.indexer.*, src/config.rs:446), the per-layer n-gram embedding table (PLE) and the MTP draft head.
So unlike the Inkling-2-Mini exercise, where the arch had to be added to mainline llama.cpp and then patched again for a scale-sharing bug, nothing had to be ported. What stood between the download and a correct answer was a tokenizer name and a tensor layout the engine had not seen yet.
2.2 The tokenizer: one match arm
Loading died immediately:
// rusting-strata/src/tokenizer.rs:83
_ => bail!("unsupported pre-tokenizer '{pre}'"),
Qwen4 GGUFs carry tokenizer.ggml.pre = "qwen4", and the engine knew qwen35, qwen2, joyai-llm, flint, glm4, inkling2, raon — not qwen4. The fix is a mapping, not a reimplementation, because Qwen4’s tokenization_qwen4.py pat_str is the Qwen3.5 regex with the case-insensitive groups spelled out:
// rusting-strata/src/tokenizer.rs:78
// Qwen4's tokenization_qwen4.py `pat_str` is Qwen3.5's regex with the case-insensitive groups spelled out.
"qwen35" | "qwen4" => &[QWEN35_RE], "qwen2" => &[QWEN2_RE], ...
Committed as 26da889f on branch qwen4-tokenizer.
2.3 The operational trap: a rebuilt binary is not a restarted server
After the rebuild, loading still failed with the same error, because ~/strata load does not start anything — it POSTs /api/load to the server that is already running, and that process had been up since the previous day with the old binary mapped in. The tokenizer check happens inside the live process, so the patch was invisible to it.
systemctl --user restart rustingstrata then ~/strata load … — and it loads. If you patch an inference server and it keeps giving you the old error, check the process start time before you check the source.
2.4 The merged tensor: a model that loads and speaks garbage
The next load stopped on missing tensor blk.0.hc_attn_down.weight. The unsloth file has no such tensor. Instead it has blk.N.hc_attn_down_inject.weight and blk.N.hc_ffn_down_inject.weight. The obvious reading is that these are the same projection under a new name, so the first attempt mapped *_down to *_down_inject as a name alias. The model then loaded, calibrated at 56.9 tok/s decode, and scored 0 out of 10. Every reply ran 8,192 tokens of AAAAVVVVbbbbDD… from the first token on.
A calibration run cannot catch this. It times canned prose and never reads the output. The CPU reference path found it in one prompt, with an assertion in Model::mv: a matrix with 256 input columns was fed a 260-wide vector.
llama.cpp’s qwen4exp loader explains the extra 4 rows. Two hyper-connection matrices read the same normalised input: the low-rank down projection (hc_lowrank = 256 rows) and the inject projection that gates each residual stream (hc_count = 4 rows). So the converter may store them as one matrix:
// llama.cpp src/models/qwen4exp.cpp: try the merged [a | b] weight the converter writes, else the separate ones
create_merged(LLM_TENSOR_HC_ATTN_DOWN_INJECT, LLM_TENSOR_HC_ATTN_DOWN, LLM_TENSOR_HC_ATTN_INJECT,
hc_dim, hc_lr, hc, layer.hc_attn_down_inject, layer.hc_attn_down, layer.hc_attn_inject);
The alias had loaded all 260 rows as down, so the inject projection was absent. Every residual stream was then mixed with 4 rows that did not belong there, and the inject gate was never applied. The fix serves each half as a row slice of the merged matrix (src/weights.rs, Weights::merged_hc). Rows [0, 256) become hc_*_down and rows [256, 260) become hc_*_inject. It needs no copy, because GGUF rows are contiguous. After the fix, “What is the capital of Sri Lanka?” gets 170 tokens of coherent reasoning and the answer “Sri Jayawardenepura Kotte.”
What to take from this: a name alias is a claim that two tensors have the same shape. Check the row count before you write one. A wrong alias here did not crash the load. It produced a model that ran at full speed and said nothing useful.
3. Why the 1M-token window is cheap here
Qwen4-35B-A3B is hybrid: 40 layers, and full_attention_interval: 4 puts a full-attention layer only at indices 3, 7, 11 … — 10 of 40. The other 30 are linear attention (linear_num_value_heads: 32, linear_key_head_dim: 128, conv kernel 4), whose state is a fixed-size convolution ring plus a recurrent state per sequence, not per token.
So the KV cache only covers 10 layers. In this engine’s q8 layout a KV row is head_dim int8 values plus one f16 scale per 32-value block — 256 + 16 = 272 bytes per kv-head per position; with 2 kv heads and both K and V that is 1088 B per token per attention layer, ~10.9 KB/token over the 10 layers.
| ctx | KV, 10 attention layers (q8) | QSA pooled indexer keys (f32) | total |
|---|---|---|---|
| 131,072 | 1.43 GB | 164 MB | ~1.6 GB |
| 262,144 | 2.85 GB | 335 MB | ~3.2 GB |
| 524,288 | 5.70 GB | 670 MB | ~6.4 GB |
| 1,048,576 | 11.4 GB | 1.34 GB | ~12.7 GB |
Constant costs on top: ~63 MB of linear-attention state (30 layers × 32 value heads × 128 × 128 f32) and a 640 KB indexer ring. The QSA indexer keeps one pooled key per 4 positions (QSA_POOL = 4, 128 floats each), which is where the second column comes from — 128 bytes per position per attention layer.
Two consequences:
- 256K is affordable. It costs about 1.6 GB more than 128K. On a card that cannot hold the 27.7 GB of weights anyway, the context window is not the binding constraint — the weights are.
- 1M fits in host RAM, not VRAM.
STRATA_KV_HOST=<block>keeps the cache of attention layers from block N onward in pinned system memory and runs those layers’ attention on the CPU, which is how a 12.7 GB cache can exist at all here.
For contrast, the looped-MoE Inkling-2-Mini from the previous report pays 32 KiB/token at f16 — 1M tokens would be 32 GiB of KV, 4× this card. The hybrid stack is what buys the difference, and it is the single most interesting thing about this model on small hardware.
4. Speed and the ten-task eval
4.1 What fits on the card
| Qwen4 @ 128K | Qwen4 @ 256K | |
|---|---|---|
| KV cache (10 attention layers, q8) | 1,360 MB | 2,720 MB |
| weights + state + scratch (engine plan) | 4,768 MB | 6,336 MB |
| expert-cache slots in VRAM | 2,357 MB | 791 MB |
| experts resident on the GPU, of 10,240 | 1,907 | 640 |
| VRAM held by the server | 7.1 / 7.6 GiB | 7.1 / 7.6 GiB |
| calibration decode / prefill (canned prose, 128K) | 56.9 / 527 tok/s | — |
Each decoded token touches about 395 MB of expert weights over its 40 MoE layers. Whatever is not resident is streamed from host RAM. Doubling the context does not run the card out of memory. It moves 1.5 GB from the expert cache to the KV cache, and that shows up as speed.
4.2 Results
Same ten tasks, same server, temperature 0, top_p 0.95, top_k 20, max_tokens 8192. “tok” is completion tokens including thinking. Speed is completion tokens over wall time, which includes prefill. That is why the two shortest replies, the tool call (74 tokens) and the 6K needle (about 200 tokens), show 13–19 tok/s.
| Task | Qwen4 @ 128K | Qwen4 @ 256K | Qwen3.6 @ 128K |
|---|---|---|---|
Arithmetic, 4 steps, \boxed{} answer |
pass · 3,452 tok | pass · 5,703 tok | fail · 8,192 tok, no answer |
| Knights/knaves deduction | pass · 902 tok | pass · 795 tok | pass · 1,500 tok |
first_ge(), 5 hidden asserts |
pass · 360 tok | pass · 288 tok | pass · 1,207 tok |
norm_phone(), 3 inputs + a ValueError |
fail · 8,192 tok | pass · 2,452 tok | pass · 7,277 tok |
| JSON matching a schema, no prose | pass · 523 tok | pass · 571 tok | pass · 1,113 tok |
Tool call get_weather(Kandy, c) |
pass · 74 tok | pass · 74 tok | pass · 134 tok |
| 6K-token needle, exact recall | pass · 223 tok | pass · 196 tok | pass · 1,269 tok |
Letter counting (strawberry) |
pass · 109 tok | pass · 107 tok | pass · 368 tok |
| 3 bullets, ≤10 words each | pass · 656 tok | pass · 629 tok | pass · 1,301 tok |
Postgres GROUP BY … HAVING |
pass · 499 tok | pass · 503 tok | fail · 8,192 tok, loop |
| Score | 9/10 | 10/10 | 8/10 |
| Mean speed | 38.3 tok/s | 31.2 tok/s | 77.8 tok/s |
4.3 Reading the table
- Qwen4 thinks less and loops less. On the eight tasks both models passed at 128K, Qwen4 used 2–6× fewer tokens. Qwen3.6’s two failures are both runaway thinking. On the SQL task it repeated “Wait, I’ll use
COUNT(o.id)in the SELECT list…” until it hit the token cap. Qwen4 wrote the same query in 499 tokens. - Qwen4’s one failure is the same kind of failure. At 128K it spent the whole budget on
norm_phone(), arguing over whether “raiseValueErrorif there are not exactly 9 digits after any leading +94/94” also covers a leading0. That is a real ambiguity in the prompt. - The 128K vs 256K difference is noise, not context. None of these prompts comes near 128K. Both runs are greedy, but a different set of resident experts changes the floating-point order of the expert sums. That is enough to send a long chain of thought down a different path:
norm_phoneended after 2,452 tokens instead of 8,192. Count the two Qwen4 runs as 19/20 together. - A grader bug, found and fixed. The arithmetic task’s answer key added the Rs 450 delivery cost to profit (expected 6,370.92). Qwen4’s Rs 4,049.88, with tax and delivery both paid by the shop, was marked wrong in the raw run. The grader now accepts either reading of the tax sentence: 4,049.88 if the shop pays it, 4,760.40 if it is passed through. The two 128K result files were re-scored from their saved output, nothing was re-generated, and the change is noted in each file. The 256K run was graded by the fixed grader from the start. Qwen3.6 gave no answer, so its score did not change.
- Ten tasks is a small sample. It is enough to show a pattern in token efficiency and looping, and the speed gap is not in doubt. It cannot rank two models that are both near the ceiling.
5. Reproduction
Everything is scripted, because a benchmark you cannot rerun is an anecdote:
~/qwen4-eval/run.sh status # weights, binary, service, results so far
~/qwen4-eval/run.sh download # resume the 27.7 GB download (curl -C -)
~/qwen4-eval/run.sh build # rebuild the patched engine
~/qwen4-eval/run.sh load 262144 # load at 256K
~/qwen4-eval/run.sh eval qwen4-35b-a3b
~/qwen4-eval/run.sh compare qwen4-35b-a3b qwen3.6-35b-a3b-128k
~/qwen4-eval/run.sh eval qwen4-35b-a3b-256k # after the 256K load
eval.py is ten tasks graded by code, not by reading the answer: two of them execute generated Python against hidden assertions in a subprocess, the JSON task is validated against the schema, the tool-call task is scored on the emitted tool_calls structure, the needle task asks for an exact three-number string planted 6K tokens deep, and the bullets task counts lines and words. Temperature 0, top_p 0.95, top_k 20, max_tokens 8192 for both models — a 2048-token cap truncates a thinking model mid-derivation and silently scores it as wrong, which is exactly what the first run of this harness did.
6. Addendum: the same model on a MacBook Pro (M3 Pro, 18 GB)
Test date: 2026-12-04 · RustingStrata 1.5.0 (93e1647) · CPU only
The obvious follow-up question: if a 35B-A3B runs on an 8 GB gaming card, does it run on a laptop with 18 GB of unified memory? I copied the same UD-Q2_K_XL shards to the laptop, built the same engine from upstream main, and ran its built-in benchmark.
| Component | Detail |
|---|---|
| Machine | MacBook Pro (Mac15,6), Apple M3 Pro, 5 performance + 6 efficiency cores |
| Memory | 18 GB unified |
| OS | macOS 27.2 |
| Engine | RustingStrata 1.5.0, upstream main 93e1647, cargo build --release (builds cleanly) |
| Weights | the same UD-Q2_K_XL, 27.7 GB across two shards |
| Command | rustingstrata bench --model …-00001-of-00002.gguf --fast-cpu --pp 512 --tg 64 --reps 1 (ctx 4096, KV f16, all threads) |
| Machine | Prefill (512 tokens) | Decode |
|---|---|---|
MacBook Pro M3 Pro 18 GB, CPU (--fast-cpu) |
1.6 tok/s | 1.9 tok/s |
| RTX 2060 SUPER 8 GB + 31 GB RAM, GPU (§4) | — | 31–38 tok/s |
The GPU box decodes about 20× faster. Two reasons:
- No GPU path on Apple silicon. RustingStrata’s GPU backends are CUDA, HIP and Vulkan. There is no Metal backend, and its Vulkan kernels require
shaderFloat64, which Apple GPUs do not offer through MoltenVK. On macOS the engine falls back to the CPU path. The CPU path is meant for checking output, and the README calls it slow. - The weights do not fit. 27.7 GB of weights cannot sit in 18 GB of memory alongside macOS. The engine maps the file, so each token pages expert weights back in from the SSD. A 3B-active MoE is cheap per token only when its experts are already in RAM or VRAM.
The PC decodes faster on the same file for both reasons. It has a CUDA GPU, and its 8 GB VRAM plus 31 GB RAM hold all 27.7 GB, so no expert ever has to come from disk.
The 15 tok/s I set as the bar for interactive use was missed by a factor of eight, so the weights were deleted from the laptop. To use this model from a Mac, call the GPU box’s OpenAI-compatible server over the network instead of running it locally. I did not try a smaller quantisation on the Mac. It would still run on the CPU only.
References
- Qwen, Qwen4-35B-A3B model card and configuration. https://huggingface.co/Qwen/Qwen4-35B-A3B
- Unsloth, Qwen4-35B-A3B-GGUF,
UD-Q2_K_XLquantisation. https://huggingface.co/unsloth/Qwen4-35B-A3B-GGUF - RustingStudio, RustingStrata inference engine, v1.4.6. https://github.com/RustingStudio/RustingStrata
- Qwen, Qwen3.6-35B-A3B model card — the incumbent on this machine. https://huggingface.co/Qwen/Qwen3.6-35B-A3B