编辑即语言:教大语言模型智能体原生上下文编辑的语法
Editing as Language: Teaching LLM Agents a Grammar for Native Context Editing
AI总结:
本文提出原生上下文编辑(NCE)框架,将上下文编辑整合为大语言模型智能体的原生生成机制,在四个长程智能体基准测试中提升了任务成功率并降低了 token 使用量。
摘要:
小说的梗概将故事浓缩为寥寥数行,代码中的函数通过一次执行整合诸多步骤;上下文编辑本身就是语言的固有属性。本文提出原生上下文编辑(Native Context Editing, NCE)框架,为语言模型智能体提供原生编辑自身上下文的语法。我们通过专用特殊标记的语法对上下文编辑操作进行编码,教智能体通过语言本身调用编辑操作。我们在迭代构建的轨迹片段上训练智能体,每个教师编辑都以不断演化的上下文为条件。这将上下文编辑确立为大语言模型智能体的一种原子性固有能力,使其能在长程推理与交互过程中生成响应时动态修改上下文。与那些在特定外部框架环境中学习生成工具使用代码的上下文编辑方法相比,我们的方法将上下文编辑整合为模型原生生成过程的内部机制,能在多样化的真实工作流程中实现更好的泛化。在四个长程智能体基准测试(Terminal-Bench 2.0、SWE-bench Verified、SWE-bench Multilingual、SWE-bench Pro)上,NCE 使 LongCat-Flash-Lite-Sparse 的平均任务成功率较基础模型提升 5.6 个百分点,使 Qwen3.6-35B-A3B 的平均任务成功率提升 4.5 个百分点,同时分别将平均 token 使用量降低 36% 和 15%。
英文摘要:
A synopsis in novels folds a story into a few lines; a function in code gathers many steps with a single execution. Context editing is native to language itself. In this paper, we propose the Native Context Editing (NCE) framework, which gives language model agents a grammar for natively editing their own context. By encoding context-editing operations in a grammar of dedicated special tokens, we teach the agents to invoke edits through the language itself. We train agents on iteratively constructed trajectory segments, with each teacher edit conditioned on the evolving context. This establishes context editing as an atomic and inherent capability of LLM agents, enabling them to dynamically modify their context as they generate responses over long-horizon reasoning and interaction. Compared with context-editing methods that learn to generate tool-use code within specific external harness environments, our approach integrates context editing as an internal mechanism of the model's native generation process, enabling better generalization across diverse real-world workflows. On four long-horizon agentic benchmarks (Terminal-Bench 2.0, SWE-bench Verified, SWE-bench Multilingual, and SWE-bench Pro), NCE improves the average task success rate over the base model by 5.6 percentage points for LongCat-Flash-Lite-Sparse and by 4.5 for Qwen3.6-35B-A3B, while reducing average token usage by 36% and 15%, respectively.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。