Context Language Models: Letting the Model Rewrite Its Own Context

Rulin Shao, Shannon Zejiang Shen, Junjie Oscar Yin, … Luke Zettlemoyer, Pang Wei Koh · 2026
arXiv 2609.37725 Interactive Visualization

Three tiers of context control

Who gets to decide when and how the live context changes?

Files as contexts

The live context is mirrored to a file; Bash/Python edits sync back. A subagent is another context file.
Create a context file to spawn an agent. Delete it and the agent is gone.

The serving catch: edits break the shared prefix

Illustrative token strip (cell counts are schematic). Cached KV is reused only up to the first mismatching token.

Reported prefill+decode FLOPs for one turn (paper's illustration)

Suffix Cache Reuse (SCR), step by step

Illustrative schematic of the described procedure: context A, B, C; an edit turns B into B′.

Hybrid model: Qwen3.6 layer split (48 linear / 16 full of 64)

Linear-attention layers hold a fixed-size recurrent state: SCR snapshots it before the edit. B′ is recomputed only in the 16 full-attention layers.

Results

Accuracy (%)

Compute

Where SCR's extra reuse comes from (share of prompt tokens)

Re-prefilled share falls 27.1% → 18.3%; 7.8% is reused beyond prefix hits: 5.3 points from stripped reasoning tokens, 2.5 from model edits.

Steering with one sentence

Emergent behaviors

Each cell is one call. Left: orchestrator scoreboard updated in place (context held at 6–8K tokens). Right: model-defined compact_turns.
Hover a cell. Others: a new "notes" role for scratch state; loops that strip old search results to "searched this, nothing relevant".

Evolved skills: held-out KV Store accuracy (authors' synthetic task)

Is the six-point gap editing, or help?

Hover a cell. What the CLM harness gets vs what the paper states for baselines.

Timing is lopsided (32K budget as in captions)

Summary compacts at 75% of budget; CLM is reminded 2,048 tokens before it (~94%). Appendix cites 23,560 tokens and 64 turns on terminal tasks.

Question-sampling noise

Host's back-of-envelope, not from the paper One proportion; ignores run-to-run variance, free turns and judge noise.

Other caveats

References

  1. Context Language Models — Shao et al., 2026 (arXiv 2609.37725)
  2. MemGPT — Packer et al., 2023
  3. Lost in the Middle — Liu et al., 2023
  4. Recursive Language Models — Zhang, Kraska, Khattab, 2025
  5. ACE — Zhang et al., 2025
  6. PagedAttention — Kwon et al., 2023
  7. SGLang / RadixAttention — Zheng et al., 2023
  8. CacheBlend — Yao et al., 2024
  9. Prompt Cache — Gim et al., 2023
  10. EPIC — Hu et al., 2025
  11. PIE — He et al., 2025
  12. Memento — Kontonis et al., 2026
  13. Context-Folding — Sun et al., 2025
  14. MEM1 — Zhou et al., 2026
  15. Meta-Harness — Lee et al., 2026
  16. GEPA — Agrawal et al., 2026
  17. Self-Generated Prompt Injections in Compaction Summaries — OpenAI, 2026
  18. Reason Efficiently / Think Dense, Not Long — Arora & Zanette; Peng et al., 2026
  19. Titans / Mamba / Gated DeltaNet — 2024–2025