TL;DR
Qwen released Qwen4-35B-A3B on December 3, 2026 under Apache 2.0: 35B parameters, about 3B active per token, 256 experts, 40 layers, and a native 1,048,576-token window. Community GGUF builds appeared within hours. We read the model config and parsed a real GGUF header (the Q4_K_M file of Chungulus/Qwen4-35B-A3B-GGUF) to answer the on-device question: what does it cost in memory?
- The KV cache is small. Only 10 of 40 layers use attention with a cache. At BF16 that is 20 KiB per token (computed from the config): 0.63 GiB at 32K, 5 GiB at 256K, 20 GiB at the full 1M window.
- The recurrent layers add a fixed 60 MiB, no matter how long the prompt is.
- A 20B-parameter n-gram embedding table ships inside or beside the weights: 13.11 GiB in the Q4_K_M file (Q5_0), 10.73 to 20.27 GiB as a separate file in the other builds. Count it separately from the core.
- Core weights run from 12.25 GiB (Q2_K) to 34.75 GiB (Q8_0) across the 12 builds we sized. Q4_K_M has 19.96 GiB of core plus the 13.11 GiB table.
All sizes below come from the Hugging Face file listings and the parsed header. Fit tables are plans, not measurements: run your own prompt before you rely on them.
Sources: Qwen/Qwen4-35B-A3B, Chungulus/Qwen4-35B-A3B-GGUF, tomngdev/Qwen4-35B-A3B-GGUF.
What is inside Qwen4-35B-A3B?
The model card describes a hybrid layout: ten repeats of three Gated DeltaNet layers (linear attention) followed by one Qwen Sparse Attention layer, with a mixture-of-experts feed-forward after each. From config.json:
| Field | Value |
|---|---|
| Layers | 40 (30 linear attention, 10 full attention) |
| Hidden size | 2048 |
| Experts | 256 routed, 8 active per token, plus 1 shared, intermediate size 512 |
| Attention heads | 16 query, 2 KV, head dimension 256 |
| Linear attention heads | 32 value, 16 query/key, head dimension 128 |
| Sparse attention budget | 2048 tokens per query (indexer with 4 heads, 1 shared key head, dimension 128) |
| Vocabulary | 248,320 |
| Context | 1,048,576 native |
| Extras | multi-token prediction layer, vision encoder (27 layers), 4-branch gated residual |
| License | Apache 2.0 |
The card also lists a "20B n-gram embedding" on top of the 35B, and says the architecture "improves model quality without extra compute or accelerator memory overhead". That sentence is the key to the file sizes below: the n-gram table is a lookup, not a layer that every token multiplies through.
How big is the KV cache, really?
Only layers with full_attention keep a per-token key and value cache. We counted them in the config: 10 of 40, with 2 KV heads of dimension 256.
full_layers, kv_heads, head_dim = 10, 2, 256 bf16 = 2 # bytes per_token = full_layers * 2 * kv_heads * head_dim * bf16 # K and V print(per_token, per_token / 1024) # 20480 bytes -> 20.0 KiB for ctx in (32_768, 131_072, 262_144, 1_048_576): print(ctx, round(per_token * ctx / 2**30, 3), "GiB") # 32K 0.625, 128K 2.5, 256K 5.0, 1M 20.0 If all 40 layers were ordinary GQA layers with the same shape, the figure would be 80 KiB per token, four times larger. This is a counterfactual we computed to show the effect of the hybrid design, not a model that exists.
Two caveats. First, the sparse attention indexer keeps its own key (1 head, dimension 128). If a runtime caches it in BF16 that could add up to 2.5 KiB per token across the 10 layers; we did not measure what each runtime allocates. Second, the 2048-token budget limits how much the model reads per step, not how much you store. The cache still grows with the prompt.
With an 8-bit KV cache type the per-token figure drops to about 10.6 KiB (Q8_0 stores 34 bytes per 32 values, computed). Whether your build supports a quantized cache for this architecture is something to test, not assume.
What about the 30 linear-attention layers?
Gated DeltaNet layers carry a fixed-size recurrent state instead of a growing cache. From the config, the state per layer is value heads times key dimension times value dimension: 32 x 128 x 128 = 524,288 values. In FP32 (mamba_ssm_dtype is float32) that is 2 MiB per layer, 60 MiB for all 30 layers. A short convolution state (kernel size 4) adds a small amount on top. The point for edge deployment: this part does not grow when you go from 8K to 800K tokens.
What does a Qwen4 GGUF actually contain?
We downloaded the first 24 MiB of the Q4_K_M file (the GGUF header with all tensor descriptors) and summed tensor sizes by role. The header reports architecture qwen4exp, 40 blocks, 256 experts, 8 used, and 882 tensors.
| Group | Size in the Q4_K_M file |
|---|---|
| Routed expert tensors (gate, up, down) | 18.16 GiB |
| Everything else (attention, linear attention, shared expert, routers, output, embeddings, gated residual) | 1.79 GiB |
per_layer_token_embd.weight, shape 128 x 160,003,584, Q5_0 | 13.11 GiB |
| File total | 33.07 GiB |
The n-gram table holds 128 x 160,003,584 = 20.48 billion values, which matches the "20B n-gram embedding" in the card. One row is 128 values, 88 bytes in Q5_0. Each token needs a few such rows, not the whole table. That is why other builders ship it as a separate file (engram-*.gguf or ple-*.gguf) and tell you to add it with --shard.
The consequence for planning: the number to compare against your VRAM is the core, not the file total. Whether your runtime keeps the table in system memory or maps it from disk depends on the build and flags, so read the load log.
Which builds exist and how big are they?
From the file listing of Chungulus/Qwen4-35B-A3B-GGUF (shards summed, GiB):
| Build | Core | Embedding file | Total |
|---|---|---|---|
| Q2_K | 12.25 | 10.73 (Q4_0) | 22.98 |
| Q3_K_S | 14.31 | 10.73 (Q4_0) | 25.04 |
| Q3_K_M | 15.83 | 10.73 (Q4_0) | 26.56 |
| Q3_K_L | 17.12 | 10.73 (Q4_0) | 27.85 |
| IQ4_XS | 17.88 | 10.73 (IQ4_NL) | 28.61 |
| IQ4_NL | 18.83 | 10.73 (IQ4_NL) | 29.56 |
| Q4_K_S | 18.74 | 13.11 (Q5_0) | 31.85 |
| Q4_K_M | 19.96 (computed) | 13.11 bundled | 33.08 |
| Q5_K_S | 22.59 | 14.31 (Q5_1) | 36.90 |
| Q5_K_M | 23.31 | 14.31 (Q5_1) | 37.62 |
| Q6_K | 26.86 | 20.27 (Q8_0) | 47.13 |
| Q8_0 | 34.75 | 20.27 (Q8_0) | 55.02 |
A separate release by tomngdev uses llama-quantize --target-bpw and offers Q4_K_XL (23.15 GiB core, target 5.5366 bits per weight) and Q6_K_XL (32.13 GiB, 7.6860), with the embedding as engram-Q8_0.gguf (20.27 GiB) or engram-IQ4_NL.gguf (10.73 GiB). Its card includes a multi-token-prediction head quantized to Q8_0 and a llama.cpp command using --spec-type draft-mtp. The Chungulus bundle also lists an F16 vision projector of 0.84 GiB.
The embedding precision is a separate choice from the core precision. Q4_K_S pairs an 18.74 GiB core with a Q5_0 table, while IQ4_NL pairs an 18.83 GiB core with an IQ4_NL table that is 2.4 GiB smaller. We have no quality numbers for these combinations, so we do not rank them.
Which build fits a 16, 24, 32 or 48 GB GPU?
Plan = core + cache at BF16 + 60 MiB recurrent state + about 1.5 GiB for compute buffers (our assumption; it varies with batch size and runtime).
| GPU | Build (core) | Cache bound | Plan total |
|---|---|---|---|
| 16 GB | Q2_K (12.25 GiB) | 0.63 GiB at 32K | about 14.4 GiB |
| 24 GB | IQ4_XS (17.88 GiB) | 2.5 GiB at 128K | about 21.9 GiB |
| 24 GB | Q4_K_M (19.96 GiB) | 0.63 GiB at 32K | about 22.1 GiB |
| 32 GB | Q6_K (26.86 GiB) | 2.5 GiB at 128K | about 30.9 GiB |
| 48 GB | Q8_0 (34.75 GiB) | 5.0 GiB at 256K | about 41.3 GiB |
The n-gram table is not in these totals. Budget 10.7 to 20.3 GiB of system RAM or fast SSD for it (13.11 GiB for Q4_K_M), and 0.84 GiB more for the vision projector if you want images. The MoE structure also makes partial expert offload to system RAM an option for smaller cards, but we have not measured its speed and we give no number.
Quality is the open column. The official card links a benchmark image, and we have not rerun any of it on the quantized files, so we make no claim about how much each build keeps. Test on your own task.
How do I run one?
The Chungulus card points to a pinned llama.cpp commit for Qwen4 support (59b7165). Build that, start from the first shard, and add the embedding file with --shard:
hf download Chungulus/Qwen4-35B-A3B-GGUF \ --include "Qwen4-35B-A3B-IQ4_XS-*.gguf" "ple-Qwen4-35B-A3B-IQ4_NL.gguf" \ --local-dir . llama-server -m Qwen4-35B-A3B-IQ4_XS-00001-of-00003.gguf \ --shard ple-Qwen4-35B-A3B-IQ4_NL.gguf \ -ngl 99 -c 131072 Add --mmproj mmproj-Qwen4-35B-A3B-F16.gguf for images. Official sampling advice from the card: thinking mode temperature=1.0, top_p=0.95, top_k=20; non-thinking temperature=0.7, top_p=0.80, top_k=20, presence_penalty=1.5. Thinking is controlled with reasoning_effort (xhigh, high, low, off).
A quick audit you can repeat: fetch the first 24 MiB of your file, list the tensors, and sum the bytes of per_layer_token_embd.weight versus the rest. It takes a minute and tells you what you are about to place in memory.
FAQ
Is Qwen4-35B-A3B open? The weights are on Hugging Face under Apache 2.0, in Transformers format, and the card names vLLM, SGLang, llama.cpp, ollama, MLX and LiteRT-LM as supported.
Why does a 35B model need only about 20 GiB of core weights at 4 bits? The card's 35B figure covers the transformer and experts, while the separate 20B n-gram embedding is a lookup table. In the Q4_K_M file, experts take 18.16 GiB and everything else 1.79 GiB.
How much memory does a 1M-token prompt need? Cache: 20 GiB at BF16 by our computation (plus possible indexer keys), plus 60 MiB of recurrent state. That is on top of the weights, so it is a workstation figure, not a phone figure.
Does the cache really stop growing in the linear layers? Yes: their state is fixed at 60 MiB in FP32 for all 30 layers, independent of prompt length.
Which quant should I start with? For 24 GB, IQ4_XS with a 128K context is the plan with the most headroom in our table. For 16 GB, Q2_K at 32K. Run your own evaluation before you ship either.


