Standard Transformer models face a fundamental "memory wall": the computational cost of self-attention grows quadratically with the length of the input. To handle long documents or extended dialogues, many systems resort to a sliding window approach, where only the most recent tokens are kept in the Key-Value (KV) cache.
However, this creates a "forgetting" problem. As Zhuowei Huang and colleagues point out in their work on CORM, discarding older tokens permanently removes critical historical information needed for future reasoning. This leads to hallucinations, logical breaks in long-form video, and a loss of global coherence. A new wave of research suggests that we don't need to store everything to remember enough; instead, we can selectively retain, compress, or re-encode history to maintain an "infinite" context within a finite memory footprint.
The Power of Attention Sinks and Anchors
One of the most surprising findings in long-context research is that not all tokens contribute equally to the model's focus. Certain tokens—often the very first ones in a sequence—act as "attention sinks." Even if they aren't semantically relevant to the current word, the model uses them to "park" attention scores.
In StreamingDialogue, Jia-Nan Li and team exploit this by treating "End-of-Utterance" (EoU) tokens as conversational anchors. By compressing dialogue history into these specific tokens, they achieve massive memory reductions without losing the thread of the conversation. Similarly, in the realm of generative media, Kunhao Liu introduced Rolling Forcing, which combines a sliding local window with a global "attention sink" to prevent visual drift in multi-minute videos. These "anchors" provide a stable reference point that prevents the model from drifting into incoherence as the sequence grows.
Identifying Heavy Hitters for Selective Eviction
If we cannot keep every token, which ones should we throw away? The "sliding window" assumes the oldest tokens are the least useful, but this is rarely true in complex reasoning or multi-document QA.
Researchers like Junqi Zhao have proposed more intelligent eviction policies. Their system, BUZZ, organizes the KV cache into "beehive" segments and identifies "heavy hitter" tokens—those that receive the most attention from recent queries. By keeping these high-impact tokens regardless of their age, the model avoids the "lost in the middle" problem. Zhuowei Huang follows a similar intuition with CORM, observing that adjacent queries are often similar. This allows the model to use the current query's attention pattern as a proxy to decide which historical tokens will likely be needed for the next step.
Compressive and Cascading Memory
Rather than a binary choice between "keep" and "delete," some researchers propose a hierarchy of memory. This mirrors the human brain's transition from short-term to long-term memory.
- Cascading Buffers: Jeffrey Willette and Heejun Lee developed the Cascading KV Cache, which moves tokens through a series of buffers. As tokens age, they are subjected to stricter importance-based filtering, allowing the model to maintain a million-token context in a tiny memory footprint.
- Residual Linear Attention: Apple researchers Ruoming Pang and Bailin Wang introduced RATTENTION, which uses a secondary, lightweight "Residual Linear Attention" module to compress and recall tokens that have fallen out of the primary sliding window.
- Infini-attention: Manaal Faruqui and the Google team took this further with Infini-attention, which integrates a compressive memory directly into the attention layer. This allows the model to process sequences of theoretically infinite length by summarizing old segments into a fixed-size state.
Re-encoding History into Model Weights
The most radical approach to long context is to stop treating history as "data" to be stored and start treating it as "knowledge" to be learned.
In Progressive Thought Encoding (PTE), Zeliang Zhang and Jianfeng Gao propose encoding evicted KV cache tokens into lightweight LoRA adapters on-the-fly. Instead of the model "looking back" at its previous thoughts, the history is literally folded into the model's weights. This prevents the model from forgetting the initial steps of a complex "Chain-of-Thought" reasoning process. Similarly, Fangzhou Xiong frames long-context generation as a Continual Learning problem, using techniques like Orthogonal Gradient Descent to ensure that new tokens don't "overwrite" the internal representations of earlier ones.
By moving from static sliding windows to dynamic, selective, and compressive memory structures, these researchers are enabling AI to maintain coherence over hours of video, thousands of dialogue turns, and million-word documents.