arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~

注意差距:从失败归因到代码语言模型的闭式修复

Mind the Gaps: From Failure Attribution to Closed-Form Repair of Code Language Models

Jian Gu, Hongyu Zhang, Chunyang Chen, Aldeida Aleti

arXiv 2610.05277首次发表:更新:

发表机构

Monash University; Chongqing University; Technical University of Munich(莫纳什大学; 重庆大学; 慕尼黑工业大学)

机构由 AI 辅助整理,请以论文原文为准。

AI 中文总结

针对代码语言模型修复中归因与补丁不匹配的问题,提出ASTRA方法,通过对比语义定位神经元并闭式求解线性系统定制补丁,在API演化任务上显著提升Pass@1并保持低副作用。

AI 中文摘要

代码语言模型必须像周围的软件一样得到维护:当库演化时,模型会继续编写它在训练期间看到的接口。修复模型本身可以让一次修正惠及所有下游用途。现有的修复方法将失败归因于神经元,选择排名最高的神经元,并应用通用更新。这一流程假设被归因的神经元就是需要修补的神经元,并且通用更新适用于每次失败,而这两个假设都未被检验。我们在Python和Rust中的可执行API演化任务上,使用三个代码模型对两者进行了检验,并识别出两个差距。定位差距将失败归因所针对的神经元与能够承载补丁的神经元分开:它们的前置集合的Jaccard重叠仅为0.15至0.20。定制差距将通用更新与针对失败构建的补丁分开:不同承载神经元所需的补丁几乎是正交的。为解决这两个差距,我们提出了ASTRA。它通过对比语义进行神经元定位,这是一种归因方法,根据神经元对目标令牌与生成令牌之间logit对比的贡献来对其评分。然后,它通过求解一个小型线性系统的闭式解来定制补丁,该解可联合修正样本的所有失败令牌,既不需要优化器也不需要反向传播。在6个设置中的3个中,对比语义选择的承载神经元显著优于基于梯度的归因,在其他设置中则相当。平均而言,ASTRA达到66.7%的Pass@1,而AlphaEdit、STAR和低秩适配的最佳方法为48.4%,并且修复一个样本只需2.7秒。它在所有6个设置和每种API变更类型中都是最佳方法,并且这一优势在测试提示的未见措辞下仍然保持。其对无关代码的副作用在大模型上较小,在小模型上较大。

英文摘要

Code language models must be maintained like the software around them: when a library evolves, a model keeps writing the interface that it saw during training. Repairing the model itself lets one correction reach all downstream uses. Existing repair methods attribute a failure to neurons, select the highest-ranked ones, and apply a generic update. This pipeline assumes that the attributed neurons are the ones to patch and that a generic update fits every failure, and neither assumption has been examined. We examine both on executable API evolution tasks in Python and Rust with three code models and identify two gaps. The targeting gap separates the neurons that failure attribution targets from the neurons that can carry a patch: their top sets have a Jaccard overlap of only 0.15 to 0.20. The tailoring gap separates a generic update from a patch built for the failure: the patches that different carrier neurons need are nearly orthogonal. To address both gaps, we propose ASTRA. It targets neurons by contrastive semantics, an attribution that scores a neuron by its contribution to the logit contrast between the target token and the produced token. It then tailors the patch by solving one small linear system in closed form, which corrects all failing tokens of a sample jointly and needs neither an optimizer nor a backward pass. Contrastive semantics selects significantly better carrier neurons than gradient-based attributions in 3 of 6 settings and comparable ones in the others. On average, ASTRA reaches 66.7 percent Pass@1, against 48.4 percent for the best of AlphaEdit, STAR and low-rank adaptation, and repairs a sample in 2.7 seconds. It is the best method in all 6 settings and for every type of API change, and this advantage persists under an unseen phrasing of the test prompt. Its side effects on unrelated code are small on the large models and larger on the small one.

论文原文

arXiv 摘要页 · PDF 原文 · HTML 原文

↑