Qwen 4 35B Keeps 20B of Itself Off Your GPU

Qwen 4 35B matches Qwen 3.8 Flash Next at about a third of the size, and it runs on a gaming GPU. Flash Next is a 180B model with 6B active per token that needs a workstation card or a 128 GB machine. Qwen 4 35B is a mixture of experts with 3B active per token, open weights under Apache 2.0, announced by Qwen at 02:06 UTC on 4 December, with a native 1M-token context.

I tested it the same day. A 16 GB card runs it at 128K of context, and up to 512K. A 12 GB card reaches 256K, and one RTX 5090 holds a 1M-token window.

Qwen 4 35B Qwen 3.8 Flash Next
Total parameters 56.82B (35B network, 20B n-gram table, 2B MTP) 180B
Active per token 3B 6B
On the card, Q4_K_M, 32K, table in RAM (my calculator) 23.3 GB 79.1 GB
Artificial Analysis Intelligence Index 25 28

Which card runs it

Two ways to run it. Everything on the GPU is the fastest, and my calculator sizes it. Experts in system RAM uses llama.cpp's --n-cpu-moe N, which keeps the experts of the first N of the 40 layers in RAM. That is how smaller cards run it, and I measured it.

12 GB and 16 GB cards: experts in system RAM (my runs: UD-Q4_K_M, llama.cpp v1.1.1, q8_0 cache, -ub 256)

Card 32K 128K Longest window
12 GB (RTX 3060 12 GB, 4070, 5070) 32 of 40 layers in RAM 34 in RAM 256K
16 GB (RTX 5060 Ti 16 GB, 4060 Ti 16 GB, 5080) 22 in RAM 26 in RAM 512K

24 GB and up: everything on the GPU (my calculator, llama.cpp, f16 cache)

Card Short context Longest context
24 GB (RTX 3090, 4090) Q4_K_M at 8K Q3_K_M at 128K
32 GB (RTX 5090) Q6_K at 64K Q4_K_M at 256K, and 1M with 28 layers in RAM (my run)
48 GB (RTX 6000 Ada, RTX A6000) Q8_0 at 256K Q4_K_M at 512K, Q2_K at 1M
96 GB (RTX PRO 6000 Blackwell) every quant at 1M
Longest context window that loaded, thousands of tokens (Q4_K_M, experts in RAM)
12 GB card256
16 GB card512
RTX 5090 32 GB1024

My runs, 4 December, q8_0 cache, -ub 256. Each window loaded and answered a prompt.

Layers of experts kept in system RAM at 128K, out of 40 (fewer is faster)
12 GB card34
16 GB card26
RTX 5090 32 GB0

My runs, 4 December, UD-Q4_K_M, q8_0 cache, -ub 256. The RTX 5090 holds 128K fully on the card.

The command for a 16 GB card at 128K

llama-server -m Qwen4-35B-A3B-UD-Q4_K_M-00001-of-00002.gguf -c 131072 -fa on -ngl 999 -ot per_layer_token_embd=CPU --n-cpu-moe 26 --cache-type-k q8_0 --cache-type-v q8_0 -ub 256 -b 256
Flag What it does
-ot per_layer_token_embd=CPU keeps the 11 GB n-gram table in system RAM
--n-cpu-moe 26 keeps the experts of 26 layers in system RAM
--cache-type-k q8_0 --cache-type-v q8_0 halves the attention cache and the indexer cache
-ub 256 -b 256 shrinks the compute buffer, which is what fails first at long windows

If it runs out of memory on load, raise --n-cpu-moe by 2. My test machine gave programs 28.4 GiB of the 5090's 32 GB, and every layer count was measured against the free memory the model saw, so a card at home should need the same number or fewer.

What each tweak bought on the 16 GB card:

Setting at 32K Layers of experts in RAM
f16 cache, default batch 24
q8_0 cache, -ub 256 22
Window, q8_0 cache, -ub 256 Layers of experts in RAM
32K 22
128K 26
512K 40 (all)

Going from 32K to 128K costs only 4 more layers in RAM, because just 10 of the 40 layers keep a cache that grows. At 1M on the 5090, the compute buffer was the allocation that failed: 4,097 MiB at the default batch, 3,178 MiB at -ub 256.

Skip --n-cpu-moe and a small card falls over. @AolZori ran llama.cpp b12971 on an RTX 3080 Ti 12 GB with 64 GB of RAM under Windows 11, without it:

@AolZori, RTX 3080 Ti 12 GB, llama.cpp b12971 Decode
UD-IQ4_XS 1.7 tok/s
UD-IQ4_XS, --load-mode none 3.11 tok/s
UD-Q4_K_M 0.38 tok/s

How much system RAM

Setup RAM high-water
16 GB card, 32K, f16 cache 23.5 GB
16 GB card, 128K 22.7 GB
16 GB card, 512K, every expert in RAM 22.8 GB
12 GB card, 128K 22.7 GB
12 GB card, 256K, every expert in RAM 22.8 GB
RTX 5090, 1M window 27.3 GB

32 GB of system RAM covers every setup. It stays near 23 GB even with all experts in RAM because llama.cpp reads the n-gram table lazily: its log says "lazy read enabled", and most of the 11 GB table never sits in RAM. Adding --lazy-mode on saved nothing more (22.7 against 23.0 GB) and doubled the load time.

What it needs, everything on the card

My calculator, llama.cpp, f16 cache, n-gram table in system RAM. Totals on the card, cache and overhead included:

Quant 8K 32K 128K 256K 1M
Q2_K 15.6 GB 16.3 GB 19.1 GB 22.9 GB 45.7 GB
Q3_K_M 18.6 GB 19.3 GB 22.1 GB 25.9 GB 48.6 GB
Q4_K_M 22.6 GB 23.3 GB 26.1 GB 29.9 GB 52.7 GB
Q5_K_M 25.7 GB 26.4 GB 29.3 GB 33.0 GB 55.8 GB
Q6_K 27.7 GB 28.4 GB 31.2 GB 35.0 GB 57.7 GB
Q8_0 36.1 GB 36.8 GB 39.7 GB 43.4 GB 66.2 GB
Quant n-gram table in system RAM
Q2_K to Q4_K_M 10.7 GB
Q5_K_M 14.3 GB
Q6_K and Q8_0 20.3 GB

Put the table back on the card and Q4_K_M needs 33.4 GB at 8K instead of 22.6.

I checked the calculator against the RTX 5090 with UD-Q4_K_M fully on the card:

Q4_K_M, f16 cache Measured on the card My calculator
32K window 22.2 GB 23.3 GB
128K window 24.7 GB 26.1 GB

It reads about a gigabyte high, on the safe side, mostly because it counts the MTP head, which llama.cpp only loads when MTP is switched on.

Why it is 57B and still a 35B

Qwen 4 uses the architecture Qwen first shipped in Qwen 3.8 Flash Next: 3 Gated DeltaNet layers, then 1 sparse attention layer, repeated 10 times for 40 layers. The 20B is an n-gram table, 10,000,000 bigram and trigram entries at layer 2. It is a lookup, not a network: the model hashes the last two or three tokens into an address, reads that row and adds it in. A token reads a few rows, never the whole 20.5B, which is why the table can live in system RAM, or on the SSD, without costing much.

Unsloth ships every quant as two files, and the second file is only the table:

Quant Total download Table file
UD-IQ1_S 21.27 GB 11.52 GB (IQ4_NL)
UD-Q2_K_XL 27.68 GB 11.52 GB (IQ4_NL)
UD-Q3_K_XL 30.88 GB 11.52 GB (IQ4_NL)
UD-IQ4_XS 32.04 GB 11.52 GB (IQ4_NL)
UD-Q4_K_XL 36.24 GB 11.52 GB (IQ4_NL)
UD-Q5_K_M 42.38 GB 15.36 GB (Q5_1)
UD-Q6_K 50.95 GB 21.76 GB (Q8_0)
Q8_0 59.99 GB 21.76 GB (Q8_0)
BF16 112.81 GB 40.96 GB (BF16)

You can pair any quant with any table through llama.cpp's --ple. Unsloth measured what a better table buys: a Q8_0 table cut mean KLD by about 6% on UD-Q4_K_XL, and BF16 was no better than Q8_0. If you have the RAM, a Q8_0 table on a 4-bit quant is the cheap upgrade.

Only the 10 sparse attention layers keep a cache that grows, with 2 KV heads each. The 30 DeltaNet layers hold a fixed state.

Context Cache in my calculator (f16)
8K 0.30 GB
128K 3.81 GB
1M 30.06 GB

That is the attention cache, the sparse-attention indexer's own cache, and a compute buffer that grows with the window. The indexer cache shrinks with a q8_0 or q4_0 cache like the rest, which my test logs showed and the calculator now counts.

Strata 0.2.26 runs it

Strata added Qwen 4 35B on 4 December, in version 0.2.26, with its own engine:

Strata 0.2.26
Engine strata-q4-lite 0.1.74, beside the existing engines
Files Strata's own .strata tiers (Compact, Balanced, Ultra) and Unsloth's Q4 and Q3 GGUF files
Longest context 512K on the .strata tiers, 1M on the Unsloth GGUF files
Extras an MTP draft file for faster answers; a Loop add-on that goes over the reasoning a second time, slower, off by default
Smaller cards keeps what fits on the card and reads the rest from RAM or the drive
Quality check passed on RTX 3060, 3090, 4090, 5070, 5090, RTX A6000, RTX PRO 6000, Tesla P100, DGX Spark, Radeon AI PRO R9700, M5 Max

PolyStrata, the MoE engine from Linger (SimplexAI), runs Qwen 4 too: its v0.2.20 day-0 chart goes from an 8 GB laptop to a 96 GB workstation, with numbers in the speed table below.

My Strata calculator now plans Qwen 4 the way Strata 0.2.26 does: pick your card, RAM and context, and it shows every build (Compact, Balanced, Ultra and the three Unsloth files), how much sits on the card, in RAM and on the drive, and Strata's own pick.

Speed, from the people who ran it

Who Hardware Engine and build Speed
@cobrax91310 RTX 5080 16 GB Basalt, qwen4-35b branch, RadixArk NVFP4, int8 cache, 64K, MTP 191 tok/s chat, 291 code and JSON, 183 prose; 9,992 tok/s prefill at 16K
@AbemelechM RTX 4080 Super 16 GB, 32 GB RAM Strata, pull request #7774 109.5 to 123.3 tok/s decode; 4,446 tok/s prefill at 44.5K
@AolZori RTX 3080 Ti 12 GB, 64 GB RAM Strata, pull request #7774 build, UD-Q4_K_M 359 tok/s
@Tech2Wild 2x RTX 3090 vLLM, their W4A16 quant 173 tok/s solo, 495 with 4 users; 330 on code with DFlash patched in (187 without)
@Tech2Wild DGX Spark vLLM, FP8 42 tok/s solo, about 104 with 4 users
@Dataphil3 RTX PRO 6000, one and four cards 4-bit, 256 streams 3,848 tok/s on one card, 10,939 on four, all streams together
@superalesha RTX 3090 24 GB Strata 0.2.25 with pull request #7774 (his qwen4-opt fork), UD-IQ4_XS, int8 cache, 256K, MTP 319.6 tok/s code, 288.8 prose; 181.4 without MTP; 3,006.4 tok/s prefill at 8K
PolyStrata (@HeyLingerAI) RTX 4090 D 24 GB PolyStrata v0.2.20, UD-IQ2_XS, DFlash2 399.1 tok/s; 147.8 at 256K
PolyStrata (@HeyLingerAI) RTX 5060 Laptop 8 GB, 32 GB RAM PolyStrata v0.2.20, UD-IQ2_XS 84.9 tok/s at 6.1 GiB VRAM; 33.6 at 256K
@sorek_UK RTX 5080 16 GB his NVFP4 patch for Strata, 1M allocation, 32,802-token prompt NVFP4 124.1 tok/s and 2,860.1 prefill; Q4_K_M 68.6 and 1,424.7
Decode on one 16 GB card, tok/s (higher is faster)
RTX 4080 Super, Strata pull request #7774123.3
RTX 5080, Basalt NVFP4 with MTP, code291
RTX 5080, Basalt NVFP4 with MTP, chat191

@AbemelechM and @cobrax91310, 4 December, their own cards and settings, not one benchmark.

The fastest numbers come from engines that place experts on their own (Strata, PolyStrata, Basalt), not from stock llama.cpp. @superalesha's 3090 run is worth a second look: UD-IQ4_XS with an int8 cache holds 256K fully on a 24 GB card, where my calculator's llama.cpp column, with an f16 cache and Q4_K_M, stops at 8K.

Unsloth ran UD-Q4_K_XL on mainline llama.cpp, greedy, thinking off, with and without the MTP head:

Device No draft MTP, draft depth 1
RTX 5090 32 GB, code 174.9 tok/s 224.0 tok/s (1.28x)
M5 Max 128 GB 91.2 tok/s 118.5 tok/s (1.30x)
RTX Spark 128 GB 62.8 tok/s 81.3 tok/s (1.29x)

The MTP head is inside every GGUF, 0.59 GB in the 4-bit quants, so there is no separate draft file. Unsloth measured acceptance at about 0.89 at depth 1 and 0.68 at depth 2. In llama.cpp it takes --spec-type draft-mtp to switch it on: --spec-draft-n-max alone drafts nothing, which I found in my own logs.

Moving the n-gram table off the GPU, or off RAM:

Who Hardware Result
@Tech2Wild DGX Spark table on SSD: 1.5% slower, 5.3x the context
@vanchYe M3 Max 128 GB, MLX oQ6e 45.56 GiB with the table in RAM, 28.86 GiB with it on SSD
@lasse_ai RTX 5060 Ti 16 GB, NVFP4 128K at 13.7 GB peak VRAM

On a Mac, Unsloth's MLX 4-bit build is 34.0 GB and text only:

M5 Max 128 GB, MLX 4-bit Prefill Decode Peak memory
512-token prompt 2,711 tok/s 75 tok/s 35.0 GB
4,096-token prompt 3,977 tok/s 69 tok/s 36.2 GB

Benchmarks

Benchmark Qwen 4 35B Qwen 3.8 Flash Next Qwen 3.8 27B Inkling 2 Mini
DeepSWE v1.1 61.8 58.7 42.2 48.2
Terminal Bench 4.1 21.2 24.2 5.6 5.6
NL2Repo 51.7 48.1 42.3 41.8
GPQA 86.9 91.7 89.2 86.9
AA-Briefcase v1.1 (Elo) 1486 1567 1391 1263
Artificial Analysis Intelligence Index (higher is better)
Qwen 3.8 Flash Next28
Qwen 4 35B25
Inkling 2 Mini20

Artificial Analysis, 4 December. Qwen 4 35B at its xhigh setting.

Figures in the table are from Qwen's launch chart. Qwen 4 35B beats Flash Next on DeepSWE and NL2Repo, and beats the dense Qwen 3.8 27B on every row but GPQA, while reading 3B per token instead of all 27B.

8 GB cards: measured

PolyStrata v0.2.20 ran UD-IQ2_XS on an RTX 5060 Laptop with 8 GB of VRAM and 32 GB of RAM at 84.9 tok/s, using 6.1 GiB of VRAM, and 33.6 tok/s at 256K.

On stock llama.cpp (Vulkan, b12974) I ran it on my own desktop: an RX 580 8 GB, a Core i5-6600 and 16 GB of RAM. The n-gram table stays on the SSD and is read on demand. Medians of three runs:

Quant Window Decode, 1K to 32K prompt 32K prompt, first word Next turn
UD-IQ1_S 128K 18.2 to 15.1 tok/s 151 s 3.0 to 4.4 s
UD-Q2_K_XL 64K 13.7 to 11.3 tok/s 166 s 3.9 to 5.3 s

Most of the experts stay in RAM (--n-cpu-moe 23 for IQ1_S, 27 for Q2_K_XL). The full commands, what helped and what did nothing are in Qwen 4 35B on an RX 580.

Launch-day log

  • 4 December, launch morning. Weights public, Unsloth's GGUF ladder up, llama.cpp support merged on 3 December at 18:18 UTC (PR #33626, "model: qwen4"). Qwen 4 35B is in my calculator and the GPU checker, sized from Unsloth's files.
  • 4 December, later. Artificial Analysis Intelligence Index added: 25 for Qwen 4 35B, 28 for Flash Next, 20 for Inkling 2 Mini.
  • 4 December, midday. Measured: 12 GB and 16 GB cards with the experts in RAM, and a 1M window on one RTX 5090. My calculator now counts the sparse-attention indexer as a cache that shrinks with q8_0 and q4_0, from the test logs. Speeds from people running it added.
  • 4 December, afternoon. Page reorganised: one card table that merges the calculator and the measured runs, plus charts.
  • 4 December, evening. My Strata calculator plans Qwen 4 at Strata 0.2.26.
  • 4 December, late afternoon. Strata 0.2.26 supports Qwen 4 35B. New speeds: an RTX 3090 holding 256K on the card (Strata fork), PolyStrata on an 8 GB laptop and an RTX 4090 D, NVFP4 at 1M on an RTX 5080.
  • 4 December, evening. Measured on 8 GB: an RX 580 with 16 GB of RAM runs UD-IQ1_S at 128K and UD-Q2_K_XL at 64K on stock llama.cpp. Full test.

FAQ

Is Qwen 4 35B as good as Qwen 3.8 Flash Next?

Close to it, at about a third of the size. It beats Flash Next on DeepSWE and NL2Repo, and scores 25 on the Artificial Analysis Intelligence Index against Flash Next's 28. Flash Next is 180B and needs a workstation or a 128 GB machine.

How much VRAM does Qwen 4 35B need?

With everything on the card, 22.6 GB at Q4_K_M and 8K context, 18.6 GB at Q3_K_M, and 15.6 GB at Q2_K, plus 10.7 GB of system RAM for the n-gram table. With the experts in system RAM it runs on 12 GB and 16 GB cards.

Does Qwen 4 35B run on a 16 GB GPU?

Yes, with the experts in system RAM. I measured 128K with 26 of 40 layers' experts in RAM and a 512K window with every expert in RAM, within 32 GB of system RAM. @cobrax91310 ran 191 tok/s on an RTX 5080 16 GB with Basalt and MTP.

Does Qwen 4 35B run on a 12 GB GPU?

Yes. I measured 128K with 34 layers' experts in RAM and a 256K window with every expert in RAM. Without --n-cpu-moe, @AolZori saw 0.38 to 3.11 tok/s on an RTX 3080 Ti 12 GB in llama.cpp.

Can an 8 GB card run Qwen 4 35B?

Yes. PolyStrata v0.2.20 ran UD-IQ2_XS on an RTX 5060 Laptop with 8 GB of VRAM and 32 GB of RAM at 84.9 tok/s, using 6.1 GiB of VRAM. On stock llama.cpp my RX 580 8 GB with 16 GB of RAM ran UD-IQ1_S at 15.1 to 18.2 tok/s with a 128K window.

How much system RAM do I need?

32 GB covered every 12 GB and 16 GB setup I ran, with the RAM high-water near 23 GB, because llama.cpp reads the n-gram table lazily.

Why is the download bigger than 35B?

Qwen counts 35B of network, plus 20B of n-gram embedding and 2B of MTP, 56.82B in all. The n-gram table is a lookup that llama.cpp keeps in system RAM, so it costs RAM rather than VRAM.

Which file should I download?

UD-Q4_K_M is what I tested on 12 GB and 16 GB cards. Unsloth's guide starts 24 GB cards on UD-IQ4_XS (32.04 GB with its table). Every quant is two files, and you need both unless you swap the table with --ple.

Does it need a new llama.cpp?

Yes. Support landed in PR #33626 on 3 December; llama.cpp v1.1.1 carries it.

Leave a Comment