arXiv:2611.06084cs.LGNov 2026

Manuscript Offprint

arXiv:2611.06084

Shallow Encoding Emits Deep Memories

Mingyuan Ma, Yangmin Li, Harris Nover, Zheyu Fu, Po-Han Huang, Alex Settle, Ashwin Nanjappa

Mingyuan Ma*, Yangmin Li*, Harris Nover, Zheyu Fu, Po-Han Huang, Alex Settle, Ashwin Nanjappa†

NVIDIA

Project page

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 (HBM) on these memories than the output requires. The prefill runs every layer for every prompt token, although only the last token's prediction is used, 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 (Shallow Encoding Emits Deep Memories) 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.4×. Neither property was designed into these models.

Keywords: LLM inference, hybrid models, linear attention, recurrent state, prefill, algorithm-system co-design

1. Introduction

Hybrid language models keep a few softmax-attention layers and make the other token-mixing layers recurrent (Dao & Gu, 2024; Yang et al., 2025b; Kimi Team et al., 2025), and production models now take this form (Qwen Team, 2025; NVIDIA et al., 2025b; MiniMax et al., 2025). Every layer keeps a memory of earlier tokens. An attention layer keeps a key-value (KV) cache, one key and one value per token. A linear-attention or state-space layer folds each token into a fixed-size recurrent state, one dk×dvd_k \times d_v matrix per head. Serving runs in two phases with different bottlenecks (Patel et al., 2024; Zhong et al., 2024; Qin et al., 2025). The prefill processes all NN prompt tokens together and is compute-bound. The decode generates one token per request per step; each step reads the weights and the memories of every resident request, so it is bound by high-bandwidth memory (HBM) bandwidth and by how many requests fit next to the weights (§2).

Both phases spend more compute and HBM on these memories than the output requires. In the prefill, only the last prompt token predicts the first reply token; the other N−1N-1 run all LL layers of the model only to write their memories, and agentic workloads make these prompts long (DeepSeek-AI et al., 2026). In the decode, every recurrent head loads its whole state from HBM and stores it back at every step, and fixed-size does not mean small: on Qwen3.8-Flash-Next, the states of one request

Correspondence: Ashwin Nanjappa†. *Equal contribution: Mingyuan Ma and Yangmin Li co-led the project, and their order was decided at random. © 2026 NVIDIA. All rights reserved.

original model

SEED

(a) Prefill — shallow in depth

Figure

Figure

(b) Decode — shallow in representation

Figure

Figure 1 | SEED keeps a shallow encoding of a hybrid model's memories in each phase. Left: original model; right: SEED; layer stacks as in Qwen3.8-Flash-Next, with three recurrent layers per attention layer. (a) Prefill, shallow in depth: x1...xN−1x_1...x_{N-1} run layers 0..k-1 only. Emitters, trained copies of the deep layers' write paths, write every deeper memory from h(k)h^{(k)}, the output of anchor layer k−1k-1, directly or through an optional prompt code. At the end of the prefill, the states left by x1...xN−1x_1...x_{N-1} are compressed to the shallow form of (b); xNx_N runs all LL layers. (b) Decode, shallow in representation: each stored recurrent state is its sink avˉ⊤a\bar{v}^\top plus rank-RR factors UV⊤UV^\top. A step updates the sink's coefficient aa, decays UU and appends one column to each factor, which keeps the update exact; every WW steps, the factors are compressed back to rank RR. Every generated token runs all LL layers, and no attention cache is compressed.

take 113.2 MB, as much as the attention cache of about 4.5K tokens (Table 2).

We show that this excess is structural. Trained hybrids have two properties, one per phase, that make their memories far simpler than the computation and storage that serve them. We find both in all five production models we study, Qwen3.8-Flash-Next (Qiu et al., 2026b), Nemotron-3.5-Lightning (NVIDIA, 2026c), Kimi-Linear (Kimi Team et al., 2025), GLM-5.3-Flash (Z.ai, 2026; GLM-5-Team et al., 2026) and Nemotron-3.5-Super (NVIDIA, 2026b), whose recurrent layers are Gated DeltaNet, Kimi Delta Attention and Mamba-2.

Writes are easier than reads. A layer writes its memory of a token through its write path, which reads only the residual stream that enters the layer. Predicting the next token, a read, needs the attention and feed-forward blocks of every deep layer. This write-read asymmetry is large. We call kk the anchor depth and layer k−1k-1, at 63–89% of the depth, the anchor layer; its output is the residual stream h(k)h^{(k)} (Elhage et al., 2021). Fed into the deep layers' own write paths without any training, h(k)h^{(k)} moves the next-token distribution by a Kullback–Leibler (KL) divergence below 0.1 nats per token. An untrained early exit at the same depth, the output head applied to h(k)h^{(k)} (the logit lens; nostalgebraist, 2020), is off by 6.8–11.1 nats per token (Figure 2). We trace the gap to the two roles of a deep layer. At a prompt token, its only lasting output is the memory it writes; the rest of its computation reaches the reply only through the inputs of later writes (§3).

Table 1 | SEED in the two serving phases. In each phase, a property of trained hybrids lets SEED keep an encoding of the memories that is shallow along the phase's bottleneck, compute in the prefill and HBM in the decode, and emit from it what the model reads.

Prefill (compute-bound)Decode (HBM-bound)
Propertywrites 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 readscaches and states of layers k..L−1k..L-1 for each prompt tokenread-out and update of each dk×dvd_k \times d_v recurrent state
Shallow encodingin depth: prompt tokens x1...xN−1x_1...x_{N-1} run only layers 0..k−10..k-1; their output h(k)h^{(k)} stands in for layers k..L−1k..L-1in representation: the shallow state, the sink avˉ⊤a\bar{v}^{\top} plus rank-RR factors U,VU, V
Emitted byemitters, trained copies of the deep layers' write paths, write every deep cache and state from h(k)h^{(k)}the factors, which give the read-out and the exact update; compressed to rank RR every WW steps
Savesprompt tokens but the last run as few as 63% of the layers and 71% of the parameter FLOPsthe state is 2.0−3.9×2.0-3.9\times smaller after a compression, 1.3−2.6×1.3-2.6\times on average
Statesevery stored recurrent state is shallow: the states that x1...xN−1x_1...x_{N-1} leave are compressed to the sink plus rank-RR factors at the end of the prefill, and the decode keeps this form
Unchangedthe weights; no attention cache is compressed or quantized; the last prompt token and every generated token run all LL layers

Recurrent states have a sink. In the median Gated DeltaNet head of Qwen3.8-Flash-Next, one direction holds 85% of the state's energy, its squared Frobenius norm. This direction is close to the head's mean value vˉ\bar{v}. The values' component along vˉ\bar{v} carries most of their energy, and the linear recurrence accumulates it into a rank-one term avˉ⊤a\bar{v}^{\top}, the state sink, whose coefficient follows the head's own recurrence (Lemma 1). Pooled over heads, the sink holds 69–99.7% of the state energy on all five models. Like the attention sink of softmax layers (Xiao et al., 2024), it forms regardless of the prompt, on Qwen3.8-Flash-Next even on random tokens; unlike it, it lies along a direction of the state, not at a position in the sequence. The sink holds the energy but not the prompt. After the head's normalization, it acts as a bias and as the gain of the rest, and replacing it by its mean over other prompts costs only 0.002 nats per token. What the head has read lies in the orthogonal content, a short working memory: on Qwen3.8-Flash-Next, a median of 6 directions hold 90% of its energy (§4).

The model's own update preserves the form. A compact state is useful only if it survives every update without growing back to dk×dvd_k \times d_v. A sink plus low-rank factors does: the form avˉ⊤+UV⊤a\bar{v}^{\top} + UV^{\top} is closed under the Gated DeltaNet, Kimi Delta Attention and Mamba-2 updates, each step updating the sink's coefficient and appending one column to each factor, an exact rank-one update of the content (Lemma 2). The only approximation is a compression of the factors back to rank RR, once at the end of the prefill and then every WW steps; it never touches the sink. In the open loop, where the compressed and the exact recurrence see the same inputs, its errors do not compound: the accumulated error stays within the largest single compression error times the head's decay horizon, however many compressions occur (Corollary 4). In the closed loop, where errors also change later inputs, the measured drift grows only 1.2−1.4×1.2-1.4\times from the first to the last 4K of 16K decode steps while the number of compressions grows 4×4\times, on the four models followed this long (§6.1).

SEED. SEED, Shallow Encoding Emits Deep Memories, builds one part on each property (Figure 1, Table 1). In the prefill, its encoding is shallow in depth. The first N−1N-1 prompt tokens run only layers 0..k−10..k-1, and emitters, trained copies of the deep layers' write paths, write every deep attention cache and recurrent state from h(k)h^{(k)}. An optional compact prompt code of h(k)h^{(k)}, read by the emitters, can stand in for the deep memories in a prefix cache. In the decode, its encoding is shallow in representation. From the end of the prefill on, every recurrent state is stored as its sink plus rank-RR factors instead of a dense dk×dvd_k \times d_v matrix, and every step computes its read-out and its exact update from them. Each encoding is shallow along the bottleneck of its phase: the prefill's saves FLOPs, and the decode's saves HBM bytes. All prompt tokens but the last run as few as 63% of the layers and 71% of the parameter FLOPs, and the state is 2.0−3.9×2.0-3.9\times smaller after each compression. The original weights stay frozen, no attention cache is compressed, and the last prompt token and every generated token run all LL layers. Every setting follows from one set of criteria, applied to inexpensive measurements of the original model (§3.1).

Evidence. We apply SEED to six checkpoints of five production hybrids of 30B to over 300B parameters: Qwen3.8-Flash-Next in bf16 and NVFP4, Nemotron-3.5-Lightning, Kimi-Linear, GLM-5.3-Flash and Nemotron-3.5-Super. Each is compared with its original model question by question, with the same sampling seeds. Under the official graders, SEED is nearly lossless: 63 of the 66 checkpoint-exam cells of eleven exams lie within two standard errors of the original model or above it, and the repetitions on which no design choice rested agree with them (§6). Its answers change about as often as those of a second sample of the original model. The next-token distributions stay close. With the exact prefill, the shallow state drifts 0.002–0.007 nats per token; NVIDIA's official NVFP4 checkpoints drift 1.9–3.5× as much on the three models that have one (§6.1). Served with SGLang on NVIDIA GB300 GPUs on an agentic-coding trace, Qwen3.8-Flash-Next with SEED delivers 1.2–1.4× the original model's throughput per GPU, both peak to peak and at an equal per-user rate of 40 tokens/s: shallow prefill relieves the prefill instance in disaggregated serving, and shallow states relieve the recurrent-state pool that limits the batch in aggregated serving (§7).

Neither property was designed into these models.