Manuscript Offprint

arXiv:2611.01858

Learning-to-Memorize: Dynamic Context Management for Long-Horizon Autoregressive Video Generation

Haowei Zhu, Qijie Wang, Jia Li, Xing Wang, Tianyu Zhao, Jiexi Wang, Xurui Peng, Xinglong Wu, Junhai Yong, Bin Wan

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Autoregressive video generation has achieved impressive results on short clips, yet generating long videos remains challenging due to error accumulation over extended horizons, where each predicted frame depends on potentially imperfect previous frames. Existing approaches typically rely on static context management strategies, such as sliding-window caches that discard early frames or fixed sink frames that permanently preserve initial content. These designs either lose critical long-range context or anchor generation to outdated information, which can lead to degraded fidelity, motion stagnation, and reduced diversity. In this paper, we propose Learning to Memorize (L2M), a learned context memory management framework that dynamically retains, evicts, and evolves historical frames according to predicted importance. The framework consists of an importance prediction router that estimates the relevance of each historical frame, degradation-aware training that improves robustness to noisy or corrupted context, and a dynamic memory initialization and evolution mechanism that updates long-term memory using exponential moving average (EMA) importance scores. This allows high-quality frames to replace stale anchors and enables memory to adapt naturally to scene evolution. Trained with a teacher-student distillation objective and sparsity regularization, L2M makes efficient use of a fixed KV-cache budget while preserving the most informative contextual information. Extensive experiments demonstrate that L2M improves long-horizon video generation quality and temporal consistency over existing baselines, providing a learned strategy for context memory management in long autoregressive video generation.

1 Introduction

Recent advances in video diffusion models Yang et al. [2024], Wan et al. [2025], HaCohen et al. [2024], Ho et al. [2022], Blattmann et al. [2023], Polyak et al. [2024] have demonstrated remarkable capabilities in synthesizing short video clips (e.g., 5–10 seconds) with both high visual fidelity and coherent motion dynamics. Building upon this progress, emerging interactive applications such as world models Parker-Holder and Fruchter [2025], Ye et al. [2025] and real-time content creation Shin et al. [2025] increasingly demand long-horizon autoregressive video generation, where frames are streamed sequentially over extended durations (e.g., 1–2 minutes).

Self Forcing Huang et al. [2025] and its variants Yang et al. [2025b], Liu et al. [2025], Cui et al. [2025] have become standard paradigms in autoregressive video generation, leveraging causal attention masks and Key-Value (KV) caches from previously generated frames. However, this autoregressive formulation is inherently susceptible to error accumulation over long horizons Yin et al. [2025],

*Corresponding author: wangbins@tsinghua.edu.cn

40th Conference on Neural Information Processing Systems (NeurIPS 2026).

Huang et al. [2025], Wang et al. [2025], depends on previously generated frames that may contain errors, leading to progressive fidelity degradation, color drift, and texture blurring.

To mitigate error accumulation, recent methods have explored two principal directions. The first direction introduces history corruption during training Chen et al. [2024], Song et al. [2025], adding noise to previous frames to improve robustness. While effective to some degree, a discrepancy remains between artificially injected noise and the actual distribution of generated errors, leaving models vulnerable to long-horizon drift. The second direction, inspired by the attention sink mechanism from large language models (LLMs) Xiao et al. [2023], retains a small set of initial tokens as permanent anchors to stabilize the attention distribution Yesiltepe et al. [2025]. Deep Forcing Yi et al. [2025] extends this idea with deep sinks and participative compression, while LongLive Yang et al. [2025b] and Rolling Forcing Liu et al. [2025] incorporate sink-aware training. PackForcing Mao et al. [2026] introduces a three-partition KV cache with token compression for bounded memory.

Despite these advances, we identify a fundamental limitation shared by existing methods: their context management strategies are static and rule-based. Specifically, (1) FIFO policies discard frames solely based on recency, without considering their semantic importance; (2) fixed sink strategies permanently retain initial frames, regardless of whether they contain useful information, such as during transitions or occlusions; and (3) in long-horizon dynamic scenes, early sink frames often become outdated as subsequent content diverges significantly, reducing their relevance as anchors. Recent methods Yi et al. [2025], Mao et al. [2026], Zhang et al. [2026] that select tokens based on similarity are also suboptimal, as they tend to prioritize recently generated frames, which are naturally more similar to each other, rather than identifying truly informative historical content.

In this paper, we propose Learning-to-Memorize (L2M), a learned context management framework that dynamically determines which historical frames should be retained, evicted, or promoted during long-horizon autoregressive video generation. Our key insight is that context management should be content-adaptive rather than governed by fixed rules: the model learns to predict which historical frames are most valuable for future generation and manages the limited KV-cache budget accordingly.

The framework consists of three main components. First, an importance prediction router evaluates the relevance of each historical frame relative to the current frame through cross-frame feature interactions, predicting an importance score of each context frame. Second, a degradation-aware training scheme augments historical context with simulated degradations such as noise, blur, or occlusion, teaching the router to assign lower importance to unreliable frames and improving inference-time robustness. Third, a dynamic memory evolving mechanism maintains exponential moving average (EMA) importance scores and promotes high-quality newly generated frames into the long-term memory sink set while replacing stale anchors during sampling, allowing the memory to evolve naturally with the video content. The entire framework is trained with a teacher-student distillation objective, where a teacher operating on full context provides supervision for a student operating on router-pruned context, combined with sparsity regularization to encourage efficient cache utilization. Our contributions are summarized as follows:

We identify a fundamental limitation of static context management in autoregressive video generation and propose a learned context management framework, L2M, which dynamically retains, evicts, and updates historical frames based on predicted importance.

  • We introduce a lightweight importance prediction router together with degradation-aware training via context perturbation and a dynamic memory mechanism that initializes and continuously evolves long-term context. These components jointly enable content-adaptive memory management in long video generation.

  • Extensive experiments demonstrate that L2M consistently outperforms existing baselines on long-horizon video generation, improving temporal consistency and visual fidelity, and establishing a new learned context management method in autoregressive video generation.

References (87)