Shallow Encoding Emits Deep Memories
Organizations: NVIDIA
Abstract
Hybrid language models interleave a few softmax-attention layers with many linear-attention or state-space layers, so every layer keeps a memory of earlier tokens: a key-value cache or a fixed-size recurrent state. Serving them spends more compute and high-bandwidth memory on these memories than the output requires. The prefill runs every layer for every prompt token, and every decode step loads and stores whole recurrent states, which on Qwen3.8-Flash-Next take as many bytes per request as the attention cache of thousands of tokens. We find two properties of trained hybrids that locate this excess. First, writes are easier than reads: writing a deep layer's memory of a token needs little of the deep computation that predicting the next token needs. Trained copies of the deep layers' write paths, which we call emitters, therefore write a prompt's deep memories from the residual stream of a shallower anchor layer, and all prompt tokens but the last run as few as 63% of the layers. Second, recurrent states have a state sink: most of their energy lies in a rank-one term along a fixed direction of each head, and the rest is a low-rank working memory. SEED builds on both: it makes the prefill shallow in depth and the decode state shallow in representation. Each recurrent state is stored as its sink plus low-rank factors, which the Gated DeltaNet, Kimi Delta Attention and Mamba-2 updates extend exactly; we prove that the open-loop error of the periodic compressions back to low rank is bounded independently of their number. SEED keeps the original weights frozen, compresses no attention cache, and runs all layers for every generated token. On six checkpoints of five production hybrids of 30B to over 300B parameters, it is nearly lossless on eleven official exams. Served with SGLang on NVIDIA GB300 GPUs on an agentic-coding trace, it raises the per-GPU throughput of Qwen3.8-Flash-Next 1.2-1.4x.
Figures & tables
| Prefill (compute-bound) | Decode (HBM-bound) | |
| Property | writes are easier than reads: a deep layer’s write needs little of the deep computation (§ 3 ) | the state sink: a rank-one term along a fixed direction of each head holds most of the states’ energy; the rest is low-rank (§ 4 ) |
| Model reads | caches and states of layers for each prompt token | read-out and update of each recurrent state |
| Shallow encoding | in depth : prompt tokens run only layers ; their output stands in for layers | in representation : the shallow state, the sink plus rank- factors , |
| Emitted by | emitters, trained copies of the deep layers’ write paths, write every deep cache and state from | the factors, which give the read-out and the exact update; compressed to rank every steps |
| Saves | prompt tokens but the last run as few as 63% of the layers and 71% of the parameter FLOPs | the state is 2.0–3.9 smaller after a compression, 1.3–2.6 on average |
| States | every stored recurrent state is shallow: the states that leave are compressed to the sink plus rank- factors at the end of the prefill, and the decode keeps this form | |
| Qwen3.8- Flash-Next | Nemotron-3.5- Lightning | Kimi- Linear | GLM-5.3- Flash | Nemotron-3.5- Super | ||||||
| Orig. | SEED | Orig. | SEED | Orig. | SEED | Orig. | SEED | Orig. | SEED | |
| State at (MB) | 113.2 | 29.2 | 48.2 | 18.8 | 41.9 | 21.3 | 142.6 | 72.4 | 167.8 | 65.5 |
| mean, (MB) | 113.2 | 43.4 | 48.2 | 27.9 | 41.9 | 31.8 | 142.6 | 108.1 | 167.8 | 97.0 |
| peak, (MB) | 113.2 | 57.5 | 48.2 | 36.9 | 41.9 | 42.3 | 142.6 | 143.7 | 167.8 | 128.5 |
| Attn. cache / token (B) | 25,344 | 25,344 | 6,144 | 6,144 | 8,064 | 8,064 | 11,627 | 11,627 | 8,192 | 8,192 |
| Resident, 4K 4K (MB) | 321 | 251 | 99 | 78 | 108 | 98 | 238 | 203 | 235 | 164 |
| RULER | |||||||||||
| GPQA Diamond | AIME 2024+25 | MATH-500 | MMLU | IFEval | LiveCode Bench v6 | HumanEval+ | LongBench v2 | 32K | 64K | 128K | |
| Qwen3.8-Flash-Next (bf16) | |||||||||||
| original | 91.9 | 99.4 | 99.3 | 92.5 | 91.7 | 88.5 | 93.9 | 64.3 | 93.2 | 94.2 | 95.5 |
| SEED | 91.5 | 98.8 | 98.8 | 92.6 | 91.1 | 88.9 | 94.8 | 65.3 | 96.4 | 95.5 | 95.0 |
| difference | |||||||||||
| Qwen3.8-Flash-Next-NVFP4 | |||||||||||
| Qwen3.8- Flash-Next | Nemotron-3.5- Lightning | Kimi- Linear | GLM-5.3- Flash | Nemotron-3.5- Super | |
| original model, dense state | |||||
| fp32 (exams) | 0 100% | 0 100% | 0 100% | 0 100% | 0 100% |
| fp16 | 0.0006 50% | 0.0004 s 50% | 0.0002 50% | 0.0006 50% | 0.0002 s 50% |
| fp8 | 0.0073 s 25% | 0.0487 25% | 0.0048 s 25% | 0.0055 s 25% | 0.0745 25% |
| SEED, shallow state | |||||
| fp32 (exams) | 0.0056 26% | 0.0060 39% | 0.0017 51% | 0.0027 51% | 0.0070 39% |
| peak | at | at 40 tok/s | |||
|---|---|---|---|---|---|
| Configuration | sessions | tok/s/GPU | ratio | ratio | ratio |
| aggregated, NVFP4 TP1 | |||||
| original | 28 | 80,219 | – | – | – |
| shallow states | 32 | 92,343 | |||
| shallow prefill | 28 | 86,385 | |||
| SEED (both) | 36 | 95,989 | |||
Appendix figures & tables18 assets
Supplementary material from the paper’s appendix.
Appendix
| KL above the floor | cache error (%) | |||||
|---|---|---|---|---|---|---|
| Set | floor | as served | states exact | code bypassed | first emitted layer | beyond |
| Qwen3.8-Flash-Next bf16 | 0.0033 | 0.0359 | 0.0216 | 0.0411 | 1.4–2.2 | 9.0–66.9 |
| Qwen3.8-Flash-Next-NVFP4 | 0.0206 | 0.0393 | 0.0224 | 0.0445 | 1.7–2.6 | 10.0–73.5 |
| Nemotron-3.5-Lightning | 0.0018 | 0.0145 | 0.0100 | 0.0269 | 0.5–4.0 | 11.6–28.6 |
| Kimi-Linear | 0.0016 | 0.0063 | 0.0038 | 0.0119 | 1.2 | 11.5–67.7 |
| GLM-5.3-Flash | 0.0000 | 0.0330 | 0.0318 | – | 0.0–0.8 | 2.2–79.5 |
| Qwen3.8- Flash-Next | Nemotron-3.5- Lightning | Kimi- Linear | GLM-5.3- Flash | Nemotron-3.5- Super | |
| depth | |||||
| gap at boundary | 23: 0.102 27: 0.100 31: 0.074 | 19: 0.182 26: 0.127 33: 0.075 | 11: 0.174 15: 0.078 19: 0.031 | 19: 0.172 23: 0.115 27: 0.045 31: 0.035 | 58: 0.216 69: 0.091 78: 0.065 |
| copies | 31: 290 / 297 | 33: 1,498 / 1,500 | 19: 1,500 / 1,497 | 27: 269 / 595 31: 530 / 595 | 78: 1,494 / 1,496 |
| code | |||||
| closed form | 4096: 227 / 2 ( ) 6144: 102 / 7 ( ) 8192: 15 / 7 ( ) 10240: 4 / 4 ( ) | 1024: 17 / 1 ( ) 1536: 12 / 1 ( ) 2048: 5 / 1 ( ) 2688: 2 / 0 ( ) | 1024: 0 / 0 1536: 0 / 0 2048: 0 / 0 2304: 0 / 0 | 2048–4608: at least 528 / 0 ( ) 8192: 144 / 11 ( ) | 256: 5 / 0 ( ) 512: 3 / 0 ( ) |
| bytes | : 5,380 (0.509 / 1.019) | : 1,540 (0.752 / 1.504) | : 1,684 (0.487 / 0.975) | none; would take 5,380 (1.272 / 2.468) | : 676 (0.660 / 1.320) |
| Set | Code | 32K | 64K | 128K | |||
|---|---|---|---|---|---|---|---|
| NVFP4, released | 1 / | 0 | 1 / | 1 | 4 / | 5 | |
| bf16, unreleased, stage 1 | 21 / | 4 | 18 / | 4 | 19 / | 11 | |
| bf16, unreleased, stage 2 | 22 / | 3 | 12 / | 5 | 16 / | 15 | |
| bf16, released | 1 / | 0 | 1 / | 2 | 1 / | 5 | |
| Qwen3.8- Flash-Next | Nemotron-3.5- Lightning | Kimi- Linear | GLM-5.3- Flash | Nemotron-3.5- Super | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| format | rounding | dense | shallow | dense | shallow | dense | shallow | dense | shallow | dense | shallow |
| fp32 | – | 0 | 0.0056 | 0 | 0.0060 | 0 | 0.0017 | 0 | 0.0027 | 0 | 0.0070 |
| fp16 | nearest | 0.0006 | 0.0056 | 0.0011 | 0.0062 | 0.0002 | 0.0017 | 0.0006 | 0.0021 | 0.0012 | 0.0069 |
| fp16 | stochastic | 0.0006 | 0.0056 | 0.0004 | 0.0059 | 0.0002 | 0.0016 | 0.0010 | 0.0025 | 0.0002 | 0.0070 |
| bf16 | nearest | 0.0008 | 0.0056 | 0.0057 | 0.0061 | 0.0008 | 0.0017 | 0.0008 | 0.0030 | 0.0066 | 0.0072 |
| bf16 | stochastic | 0.0007 | 0.0056 | 0.0044 | 0.0065 | 0.0004 | 0.0017 | 0.0010 | 0.0024 | 0.0048 | 0.0073 |
| answer-start (%) | |||||||
|---|---|---|---|---|---|---|---|
| Set | Component parameters (M) | Peak LR | 16K-window steps (%) | stage 1 | stage 2 | Auxiliary alignment | |
| Qwen3.8-Flash-Next bf16 | 619.0 | / | 30 | 50/30 | 70/60 | – | |
| Qwen3.8-Flash-Next-NVFP4 | 619.0 | / | 30 | 50/30 | 70/60 | – | |
| Nemotron-3.5-Lightning | 235.8 | / | 40 | 50/40 | 70/60 | states | |
| Kimi-Linear | 113.8 | / | 30 | 50/30 | 70/60 | – | |
| GLM-5.3-Flash | 708.7 | / | 30 | 50/30 | 70/60 | states, index keys | |
| Stage | Stream | Sources |
|---|---|---|
| 1 | public text | FineWeb-Edu Penedo et al. (2024) , FineMath Ben Allal et al. (2025) ; synthetic retrieval facts in web documents; long web documents |
| 1 | reasoning/chat † | OpenMathReasoning Moshkov et al. (2025) , OpenScienceReasoning-2 NVIDIA (2025) , OpenCodeReasoning Ahmad et al. (2025) , OpenR1-Math Hugging Face (2025) , OpenThoughts3 Guha et al. (2026) and tulu-3-sft-mixture Lambert et al. (2025) |
| 1 | teacher replies † | Frozen-model responses to public code, mathematics, science and chat prompts; long Nemotron-3.5-Lightning and Nemotron-3.5-Super responses |
| 2 | paired generation † | Public prompts (code and science reused from stage 1) answered by the teacher and the current components; forward KL on both, reverse KL on the components’ replies |
| 2 | retained streams | Stage-1 web, retrieval and public-corpus text † and stage-1 teacher replies |
| Qwen3.8- Flash-Next bf16 | Qwen3.8- Flash-Next NVFP4 | Nemotron-3.5- Lightning | Kimi- Linear | GLM-5.3- Flash | Nemotron-3.5- Super | |
| stage 1, share of tokens (%) | ||||||
| web text and retrieval documents | 14.1 | 14.1 | 9.9 | 15.6 | 15.6 | 9.9 |
| long web documents | 5.5 | 5.5 | 4.2 | 7.8 | 7.8 | 4.2 |
| reasoning and chat corpora † | 21.9 | 21.9 | 17.6 | 39.3 | 19.0 | 17.6 |
| frozen model’s replies † | 58.5 | 58.5 | 43.3 | 37.2 | 57.6 | 43.3 |
| frozen model’s long replies † | – | – | 25.0 | – | – | 25.0 |
| held-out KL | ||||||
| Run | steps | tokens | nodes min | step 0 | final | |
| Qwen3.8-Flash-Next bf16 | ||||||
| stage 1 | 881 | 600M | 16 | 159.7 | 0.0315 | 0.0176 |
| stage 2, round 1 | 221 | 151M | 16 | 58.2 | 0.0174 | 0.0172 |
| stage 2, round 2 | 221 | 151M | 16 | 52.5 | 0.0173 | 0.0171 |
| Qwen3.8-Flash-Next-NVFP4 | ||||||
| error | floor | |||
| Set | state term | Frobenius, pooled | read-out, 64 tokens | pooled / read-out |
| Qwen3.8-Flash-Next bf16 | ||||
| untrained shallow prefill | – | 0.615 | 0.076 | 0.021 / 0.001 |
| released set | no | 0.492 | 0.047 | |
| Qwen3.8-Flash-Next-NVFP4 | ||||
| untrained shallow prefill | – | 0.616 | 0.075 | 0.021 / 0.001 |
| Task | Items | Repetitions | Grading and configuration |
|---|---|---|---|
| GPQA-Diamond | 198 | 8 | simple-evals OpenAI (2024) prompt, extraction and option permutation |
| AIME 2024+25 | 60 | 8 | prompt asks for a boxed answer; integer gold answers |
| MATH-500 | 500 | 8 | prompt asks for a boxed answer; last boxed answer, Math-Verify Kydlíček (2025) |
| MMLU | 14,042 | 1 | test split, simple-evals prompt and extraction |
| IFEval | 541 | 8 | prompt-level strict |
| LiveCodeBench v6 | 454 | 8 | problems of 2024-08 to 2025-04; official prompt, extraction and public/private tests |
| Qwen3.8-Flash-Next-NVFP4 | Nemotron-3.5-Lightning | Kimi-Linear | |||||||
|---|---|---|---|---|---|---|---|---|---|
| stage-1 set | released | stage-1 set | released | stage-1 set | released | ||||
| Exam (questions) | score | paired | stage 1 | score | paired | stage 1 | score | paired | stage 1 |
| GPQA-Diamond (198) | 91.5 | 75.1 | 67.4 | ||||||
| AIME 2024+25 (60) | 99.6 | 87.1 | 66.0 | ||||||
| MATH-500 (500) | 99.1 | 98.4 | 92.5 | ||||||
| MMLU (14,042) | 92.4 | 88.0 | 77.9 | ||||||
| Quantity | Account |
|---|---|
| Dense state per head | |
| Shallow state | at steps after a compression, : the sink’s coefficient and the factors; the mean direction is shared by all requests and not counted |
| Resident request | (§ 2 ): the state bytes plus times the attention-cache bytes per token, plus the short-convolution windows (which Table 2 leaves out) |
| Decode traffic | cache reads, state reads/writes and the weights touched by the batch; sparse attention reads selected tokens and indexer keys |
| Expected routed experts | per layer for the tokens of a step, with routed experts of which each token activates : exact for independent tokens under uniform routing, an upper bound when independent tokens share a skewed routing distribution |
| Prompt computation | two FLOPs per parameter used in layers , code and emitters; no per-token output-head term |
| Orig. | (i) | (ii) | ||
|---|---|---|---|---|
| Qwen3.8-Flash-Next | bf16 caches (B) | 26,753 | 25,727 | 20,420 † |
| fp8 caches (B) | 14,081 | 13,055 | 13,028 † | |
| reuse (GFLOP) | 0 | 0 | 1.07 | |
| Nemotron-3.5-Lightning | bf16 caches (B) | 6,743 | 6,384 | 5,793 † |
| fp8 caches (B) | 3,671 | 3,312 † | 3,745 | |
| reuse (GFLOP) | 0 | 0 | 0.46 |
LLM Inference Acceleration
LLM inference acceleration develops algorithms and systems that reduce language-model latency, memory use, and serving cost while preserving output quality.
See all 1,188 papers