Context as Low-Rank Weights: Bounded Parametric Dynamic Memory for Long-Context Modeling

Xiangyu Zhang, Yu Zhou, Taolue ChenNeurIPS 2026

TL;DR

Transformers suffer from an ever-growing memory footprint because they store every past word in a linear key-value (KV) cache—like keeping a transcript of your entire life on your desk just to remember a conversation from Tuesday. This paper discovers that the effect of long-range context on a model actually lives inside a surprisingly tiny, stable mathematical subspace. Armed with this insight, the authors build PARADE, a plug-in framework that compiles old context directly into fixed-size, temporary weight updates, allowing models to read arbitrarily long documents with constant memory.

What Problem Does This Paper Address?

Transformers split memory into two worlds. Long-term "world knowledge" is compressed tightly into the model’s permanent weights (especially its MLP layers) during training. Meanwhile, short-term "contextual information" (the prompt you feed it) is stored token-by-token in an external KV cache accessed via attention.

While effective, keeping an explicit, token-level ledger creates two massive bottlenecks: memory and compute scale linearly with sequence length, and models break down when asked to read past the maximum context length they saw during training. Recent theoretical work showed that attending to context is mathematically equivalent to making temporary, rank-1 updates to a model's MLP weights—but those formulations still required tracking a separate update per token, solving nothing practically. The authors ask: As context grows to tens of thousands of tokens, can we compress it into a fixed budget of model parameters instead?

Key Insights and Ideas

Before building anything, the authors ran an empirical investigation on how long-range context perturbs a Transformer's MLP layers, uncovering two major "aha moments":

Figure 1: Empirical geometry of context’s implicit weight updates in Qwen2.5-0.5B. (a)–(c) Ef- fective rank rq versus context length L at energy thresholds q = 50, 90, 95. Solid colored curves: representative layers (mean ± std over 100 contexts). Dashed gray: random Gaussian footprints (architectural reference, dmid =4,864). Dotted gray: hypothetical r=L scaling. (d) Energy retention η of footprints at positions 4K−32K when projected onto the rank-R =300 subspace fitted to the first 4K tokens. Solid bars: empirical η. Hatched bars: oracle upper bound (subspace fitted to the late footprints). Gray: random R-dimensional subspace.
  • Contextual influence is shockingly low-dimensional: Even as a document grows to 32,000 tokens, the induced changes in weight space don't expand infinitely. Over 90% of the contextual variation fits comfortably inside a ~300-dimensional subspace (far smaller than both the 32K token count and the 4,864-dimensional MLP layer).
  • The subspace forms early and stays stable: If you identify the top 300 weight-update directions from just the first 4,000 tokens of a document, that exact subspace captures 78% of the contextual energy for tokens 4,000 through 32,000 (compared to 6% for a random subspace). Subsequent tokens aren't inventing wild new directions; they are mostly refining a thematic structure established early on.

Methods

Motivated by this geometry, the authors propose PARADE (PARAmetric Dynamic mEmory), a plug-in module injected into 8 evenly spaced layers of a frozen pretrained Transformer. Instead of letting the KV cache grow forever, PARADE keeps a small sliding attention window ($N = 4096$ tokens) and compiles older tokens into $R = 128$ reusable "memory slots" in weight space.

Figure 2: Overview of PARADE.
  1. Chunk-Level Memory Update (Writing): When the local window fills up, the oldest chunk ($L = 2048$ tokens) is evicted. Because neighboring tokens are redundant, a standard Perceiver-style cross-attention block squeezes the chunk into a compact summary. Next—and here is the novel gating trick—each memory slot queries this summary. To prevent "catastrophic forgetting" of earlier chapters, only the top-$k$ ($k=16$) most relevant memory slots are updated via a learned gate; the rest remain untouched.
  2. Query-Conditioned Memory Read (Reading): Each memory slot projects into a rank-1 weight matrix update ($\Delta W$). During generation, rather than applying all 128 updates uniformly to every token (like a static LoRA adapter), each incoming token dynamically routes itself to the top-16 most relevant slots. Those specific rank-1 updates are summed and added on-the-fly to the frozen MLP up-projection.

Datasets

No new benchmarks were introduced.

  • Empirical Analysis & Training: A 3-billion-token corpus (sequences from 4K to 128K tokens) sampled from PG19 (books), ArXiv (scientific papers), and The Stack (source code).
  • Evaluation: Held-out 128K-token sequences from the same three datasets for perplexity testing, plus LongBench, a standard multi-task suite testing long-context QA, summarization, and code reasoning.

Key Results

The authors tested PARADE on a long-context base model (Qwen-2.5-0.5B) and a short-context base model (LLaMA-2-7B, 4K native window), comparing against Full Attention and matched-memory baselines (StreamingLLM, $\text{H}_2\text{O}$, and Infini-Attention).

  • Approaching Full Attention with 30x Less Memory: On Qwen-2.5-0.5B, PARADE tracks Full Attention perplexity closely all the way to 128K tokens while using roughly 30$\times$ less KV memory. On LongBench, PARADE scores 25.77, beating Infini-Attention (23.63) and StreamingLLM (22.82), landing just shy of Full Attention's upper bound (26.11).
  • True Length Extrapolation: On LLaMA-2-7B, Full Attention breaks down past its 4K native window due to positional encoding limits. Because PARADE restricts local attention to 4K and offloads history into weights, its perplexity continues to drop all the way to 128K tokens. On LongBench, PARADE-7B (30.03) outperforms truncated 4K Full Attention (28.78) and all streaming baselines, shining brightest when evidence is buried deep in long documents (e.g., NarrativeQA and MuSiQue).

Limitations and Future Work

  • Not training-free: Unlike drop-in cache eviction methods (StreamingLLM, $\text{H}_2\text{O}$), PARADE requires end-to-end training of its plug-in parameters on 3B tokens, though keeping the base model frozen softens the blow.
  • Model scale: Experiments cap out at 7B parameters (with LLaMA-2-7B quantized to 4-bit). Scaling and validating this parametric memory behavior in 70B+ frontier models remains open future work.
  • Slight compression loss: A tiny gap persists between PARADE-0.5B and Full Attention on LongBench (25.77 vs. 26.11), showing that compressing thousands of tokens into bounded memory still drops a sliver of granular detail.

Summary updated

Abstract

Transformers rely on a growing key–value (KV) cache to store context, causing linear memory growth and limited generalization beyond the training window. We show that contextual influence can instead be viewed as updates to a low-dimensional subspace in the model’s weight space, meaning context can be represented as a bounded, low-rank parameter update rather than token-level storage. Motivated by this, we propose PARADE, which internalizes context as parametric memory. It compresses past inputs into a fixed set of weight-space basis vectors and composes them via query-dependent routing into per-query weight updates, enabling streaming inference with constant memory usage independent of sequence length. Experiments show that PARADE matches full attention on long-context tasks and outperforms efficient baselines, especially when relevant information lies far beyond the attention window, while improving as context exceeds the model’s training length.
BibTeX
@inproceedings{zhang2026context,
  author = {Xiangyu Zhang and Yu Zhou and Taolue Chen},
  title = {{Context as Low-Rank Weights: Bounded Parametric Dynamic Memory for Long-Context Modeling}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=ndegfU6uMP},
}
Figure