arXiv:2606.11213cs.CL2026-06被引 4

让大模型长时任务不丢上下文,自动智能清理无用记忆

Beyond Compaction: Structured Context Eviction for Long-Horizon Agents

论文配图:Beyond Compaction: Structured Context Eviction for Long-Horizon Agents
图 1 · 摘自论文原文
  • 按任务依赖关系结构化管理记忆,优先删除已生效的操作记录
  • 单次会话处理89个任务、8000万token,准确率无下降
  • 比摘要压缩和只删旧内容更智能,适合复杂长流程任务

我们提出上下文窗口生命周期(CWL),一种上下文管理机制,使长时序大模型代理具备近乎无限的工作视野。随着会话积累历史,CWL通过渐进式、语义感知的淘汰策略,在保持令牌预算内运行:代理在执行过程中为轨迹打上类型化、依赖关联的事件标签,当超过令牌预算时,采用无需大模型的确定性策略,按结构优先级淘汰内容。CWL保留用户输入和正在推理的探索性上下文,同时主动清除已持久化到环境中的动作记录,使活跃上下文稳定在合理上限,避免因提示过长导致的性能下降。相比基于摘要的压缩,CWL规避了四个常见问题:不可预测的丢失、因果结构破坏、模型成本阻塞、压缩引发幻觉。相比仅按时间淘汰,CWL更具语义意识:根据依赖图淘汰最老且最易恢复的内容,而非简单按时间顺序删除。我们详细描述了标注协议、事件图、淘汰策略与令牌计账循环,并在长时序代理基准上评估:单次会话完成89个连续任务,跨越8000万令牌,任务准确率与独立任务会话相比无明显下降。

原文摘要 · Abstract (English)

We present Context Window Lifecycle (CWL), a context-management scheme that gives long-horizon LLM agents an effectively unbounded working horizon. As a session accumulates history, CWL keeps the context within budget through graduated, semantically-aware eviction: the agent annotates its trajectory as typed, dependency-linked episodes as work proceeds, and a deterministic, LLM-free policy evicts content in priority order within that structure when a token budget is exceeded. CWL preserves user turns and the exploratory context the agent is actively reasoning over, while aggressively shedding action episodes whose effects are already persisted in the environment, keeping active context near a stable ceiling that also avoids the performance degradation associated with very large prompts. Compared to summarization-based compaction, CWL avoids four well-known limitations: unpredictable lossiness, destruction of causal structure, blocking model cost, and compression-induced hallucination. Compared to recency truncation, CWL is semantically aware: it drops the oldest-and-most-recoverable content according to the dependency graph rather than oldest-in-time regardless of relevance. We describe the annotation protocol, the episode graph, the eviction policy, and the token-accounting loop, and evaluate CWL on long-horizon agentic benchmarks: a single agent session completing 89 sequential tasks across 80 million tokens with no measurable degradation in task accuracy relative to per-task isolated sessions

长时推理上下文管理智能淘汰

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。