arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2610.34967cs.SE
收藏

Rivet:面向仓库级编码智能体的效用保留型上下文控制

Rivet: Utility-Preserving Context Control for Repository-Level Coding Agents

Peking University(北京大学);Harbin Institute of Technology (Shenzhen)(哈尔滨工业大学(深圳));Chongqing University(重庆大学)

Ruwei Pan, Linhao Wu, Yakun Zhang, Zixiong Yang, Lu Zhang, Hongyu Zhang

AI总结:

本文提出Rivet框架,通过信号 grounding、效用链接、预算塑形三步在固定上下文预算下为仓库级编码智能体保留关键证据,在DevEval、RepoExec基准上较基线显著提升代码生成性能并降低推理成本。

摘要:

仓库级代码生成要求智能体在现有仓库内部实现任务需求。为生成能在该仓库中运行的代码,智能体需要仓库证据,例如目标位置、辅助函数定义、调用方使用方式及配置约束,这些证据决定了代码应如何定位、集成与执行。由于上下文预算无法容纳整个仓库,现有检索、压缩及结构感知方法会基于任务相似度、上下文长度或结构邻近性选择上下文,但这些标准无法直接衡量所选上下文是否包含所需证据。因此,所选上下文可能看似与任务相关,却缺失实现所依赖的证据,我们将这种失败模式称为上下文效用稀释。本文提出Rivet,一种在固定上下文预算下为编码智能体保留仓库证据的上下文控制框架。Rivet首先通过信号 grounding融合词汇、语义及结构信号,选择与任务相关的代码锚点;随后通过依赖、使用及配置关系扩展这些锚点,收集仓库证据;最后通过优先级打包证据,当预算紧张时,将代码片段缩减为签名或摘要后再舍弃。我们在两个可执行的仓库级基准DevEval和RepoExec上,使用四个主干模型、两个上下文预算(4K和8K token)及八个基线对Rivet进行评估。Rivet在所有16种设置中均取得最高Pass@1指标,较最强基线平均提升3.73至5.15个百分点。此外,搭载Rivet的GPT-5-mini在两个基准上均优于未搭载Rivet的GPT-5,同时推理成本降低73.3%至84.5%。

英文摘要:

Repository-level code generation asks an agent to implement a task requirement inside an existing repository. To produce code that works in the repository, the agent needs repository evidence, such as target locations, helper definitions, caller usages, and configuration constraints, which determine how the code should be located, integrated, and executed. Because the context budget cannot hold the entire repository, existing retrieval, compression, and structure-aware methods select context by task similarity, context length, or structural proximity, but these criteria do not directly measure whether the selected context contains this evidence. As a result, the selected context can appear relevant to the task yet miss the evidence that the implementation depends on. We call this failure mode context utility dilution. In this paper, we propose Rivet, a context control framework that preserves repository evidence for coding agents under a fixed context budget. Rivet, first uses Signal Grounding to select task-related code anchors by fusing lexical, semantic, and structural signals. Utility Linking then expands these anchors through dependency, usage, and configuration relations to collect repository evidence. Finally, Budget Shaping packs the evidence by priority and, when the budget is tight, reduces snippets to signatures or summaries before dropping them. We evaluate Rivet, on two executable repository-level benchmarks, DevEval and RepoExec, with four backbone models, two context budgets (4K and 8K tokens), and eight baselines. Rivet, achieves the highest Pass@1 in all 16 settings and improves over the strongest baseline by 3.73--5.15 percentage points on average. Moreover, GPT-5-mini with Rivet, outperforms GPT-5 without Rivet,on both benchmarks while reducing inference cost by 73.3%--84.5%.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑