Section 01 · GGF-20
Why 30 Gated-DeltaNet + 10 QSA Layers Slash 1M-Context RAM by 75%
Three out of every four layers compress history into a fixed-size state matrix rather than appending tokens forever.
In a conventional 40-layer pure Softmax Attention model storing 40 MiB/1K across 40 layers (equivalent to 160 MiB/1K total), a 1,048,576-token prompt would allocate 160.00 GiB of FP16 KV cache alone—forcing users onto dual-GPU enterprise servers or 256 GB Mac Studios. Qwen 4 35B-A3B applies a 3:1 hybrid block layout: 30 Gated-DeltaNet linear recurrence layers interleaved with 10 QSA (Grouped-Query Softmax Attention) layers.
Each Gated-DeltaNet block updates a fixed matrix recurrence state whose memory footprint (~0.25 GiB across all 30 layers) remains O(1) constant from token 1 to token 1,048,576. Only the 10 QSA layers append per-token Key/Value vectors (~40 MiB per 1,024 tokens in FP16), cutting 1M KV overhead by 4x down to 40.00 GiB FP16.
This 30:10 hybrid ratio solves the core mathematical barrier of classic 1M-token models: while Gated-DeltaNet layers maintain fixed-size associative recurrent state updates along the sequence axis (0.25 GiB fixed whether context is 1K or 1M tokens), the 10 interleaved QSA softmax attention layers provide exact token-level recall across the entire 1,048,576-token horizon.
Check the exact memory multiplier for multi-turn workflows: because 30 Gated-DeltaNet blocks store fixed recurrent tensors (~0.25 GiB) independent of history length, scaling context from 32K up to 1,048,576 tokens only expands the 10 QSA attention layers (40 MiB/1K FP16). That makes 1M context mathematically reachable on standard 48–64 GB laptops using Q8_0 or Q4_0 KV quantization.
Total_Context_GiB = 0.25 GiB (30 GDN O(1) State) + ((ctx / 1024) × 40 MiB × kv_factor) / 1024 (10 QSA Layers)