arXiv:2607.12713cs.SEcs.AI2026-07

用行锚定反馈减少代码编辑的生成成本并提升准确率

Line-Anchored Feedback Cuts Token Costs and Improves Correctness in AI Code Editing

  • 用行锚定方式传递修改反馈,替代整体提示
  • 生成令牌量下降22%~58%,正确率提升2~7分
  • 适合关注效率与准确率的开发者和模型优化研究者

生成令牌是生成式AI代码编辑成本、延迟和能耗的直接驱动因素。我们发现反馈格式是影响三者的关键杠杆。对比同一修改请求的两种交付方式:整体提示(对照组)与结构化的行锚定反馈(实验组,基于FileMark)。FileMark是VSCodium插件,支持在任意文件中插入内联注释。在配对实验中,行锚定使生成令牌量减少22%(Claude Opus)至58%(Claude Sonnet),在100行及以上文件中降幅达24%~80%,七种模型中有四种在多重检验校正后生成令牌显著减少。正确率在有提升空间的模型上上升:综合提升2.0分,五种本地模型中有三种提升5~7分。探索性实验显示,当编辑应用负担由工具而非GAI模型承担时,正确率提升更明显:本地模型在100+行文件上的正确率约提升至三倍。行锚定反馈既降低强模型的消耗,也提升弱模型的准确率。

原文摘要 · Abstract (English)

Generated tokens are a direct driver of the cost, latency, and energy of generative AI (GAI) code editing. We show the format of feedback is a lever on all three. We compare two deliveries of the same requested changes: a holistic prompt (control) versus the structured, line-anchored export of FileMark (treatment). FileMark is a VSCodium extension for inline comments on any file. In a paired experiment line anchoring cut generated tokens by 22% (Claude Opus) and 58% (Claude Sonnet), reaching 24%-80% on files of 100 lines or more, with four of seven models generating significantly fewer tokens after multiple-testing correction. Correctness rose where models had headroom: +2.0 points pooled and +5 to +7 points for three of five local models. An exploratory experiment in which the harness, not the GAI model, applies function-level patches shows the correctness benefit grows further when the edit-application burden is lifted: local-model correctness on 100+ line files roughly triples under anchoring. Line-anchored feedback reduces what stronger models spend and improves what weaker models get right.

代码生成效率优化提示工程

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