Qwen4-35B-A3B analysis identifies a roughly 20B-parameter n-gram table
Analysis of Qwen4-35B-A3B identifies a roughly 20B-parameter n-gram table. Sebastian Raschka reports little penalty from SSD offloading, but visible posts omit hardware and benchmark details.

TL;DR
- Qwen4’s “35B” name understates its storage bill: Artificial Analysis reports another 20B n-gram parameters and 2B for multi-token prediction, roughly 57B overall.
- SSD offloading saved 10.9 GiB of peak RAM with 3.5–5% slower generation in the DGX Spark tests summarized by TheTuringPost.
- Table precision has a measurable tradeoff: Q8 reduced mean output-distribution divergence about 6% versus the four-bit table on one Q4 configuration in the quantization tests.
The Hugging Face architecture walkthrough puts that enormous table in decoder layer two, where each token reads just 16 rows. The Unsloth guide packages it separately, allowing table precision to change independently of the main weights.
35B core and 20B table
Qwen released Qwen4-35B-A3B under Apache 2.0 with text, image and video inputs and a native 1,048,576-token context window.
Its model card separates the rounded parameter counts:
- 35B main model, with 3B activated per token.
- 20B n-gram embeddings, a separate learned lookup table.
- 2B multi-token prediction module, used for speculative decoding.
The card’s efficiency claim specifically concerns compute and accelerator memory overhead. Host RAM and checkpoint storage still have to accommodate the table unless it is offloaded.
Sixteen lookups per token
Hugging Face calls the component a per-layer embedding table, or PLE, and gives its size as approximately 20.5B parameters. Each token reads:
- Eight rows encoding the current token and its predecessor.
- Eight rows encoding the current token and its two predecessors.
The layer concatenates those embeddings, gates their contribution into four residual streams, and applies a short convolution to mix nearby patterns.
Qwen4’s architecture, including layer-two n-gram lookups and gated residual streams
SSD offload on DGX Spark
Sebastian Raschka, who benchmarked the model on his DGX Spark, published the offload measurements and workload details. He used llama.cpp with four-bit Q4_K_M weights and an 8K context setting.
Enabling --lazy-mode on left the n-gram table on SSD and loaded rows as needed:
| Measurement | Resident table | SSD offload | Change |
| --- | ---: | ---: | ---: |
| Peak unified RAM above idle | 32.7 GiB | 21.8 GiB | −10.9 GiB |
| Prefill, 512-token input | 1,867 tok/s | 1,814 tok/s | −2.9% |
| Generation, 512-token input | 57.5 tok/s | 54.7 tok/s | −5.0% |
| Prefill, 4,096-token input | 2,432 tok/s | 2,413 tok/s | −0.8% |
| Generation, 4,096-token input | 56.8 tok/s | 54.8 tok/s | −3.5% |
Speeds are medians of six warm runs per configuration and prompt length, generating 256 tokens each. The peak-memory figure came from a separate Python prompt; the writeup does not name the SSD model or report cold-cache timings.
Unsloth’s documented GGUF configuration uses --load-mode mmap --lazy-mode on -ot per_layer_token_embd=CPU. The company also advertises 18GB local runs, which its guide specifies as three-bit UD-IQ3_XXS with short context and the table offloaded.
Engram precision
Unsloth allows the table, often called an engram, to be swapped with --ple. Its precision comparison holds the main UD-Q4_K_XL weights fixed:
| Table precision | Table file size | Mean KLD versus BF16 |
| --- | ---: | ---: |
| IQ4_NL | 11.52 GB | 0.0375 |
| Q5_1 | 15.36 GB | 0.0358 |
| Q8_0 | 21.76 GB | 0.0352 |
| BF16 | 40.96 GB | 0.0352 |
These are whole-model output-distribution comparisons across 11 evaluation sets, including Wikipedia, code, multilingual text, tool use and 32K-token documents. The BF16-table configuration still has quantized main weights.
Moving from IQ4_NL to Q8_0 nearly doubles table storage while reducing mean KLD about 6%; BF16 produced no further improvement at the reported precision. Commenter teortaxesTex raised a separate concern: reasoning scores could miss compression damage to long-tail knowledge.
mmap and page-cache growth
llama.cpp’s lazy mode uses memory mapping, so accessed table pages can occupy reclaimable RAM. In a lookup-access replay, ImportStatic computed row accesses for 189,075 tokens of English and Go source without running model inference or cross-checking its row IDs against Transformers.
For the 11.52 GB IQ4_NL table, the replay touched:
- 97.4 MB of distinct row data.
- 4.41 GB of file pages with 4 KiB pages, 38% of the table.
- 9.67 GB with 16 KiB pages, 84% of the table.
Those figures describe an estimated page-access footprint. Clean file-backed pages can be evicted under memory pressure, with subsequent accesses requiring reads again.