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

用于代码理解的时间自适应微调

Temporal Adaptive Fine-Tuning for Code Comprehension

University of Zurich(苏黎世大学);University of Mannheim(曼海姆大学)

Alex Wolf, Pooja Rani, Harald C. Gall

AI总结:

针对代码随仓库演变导致LLM对齐偏差的问题,提出TAFT方法,在SWE-bench数据集上显著提升代码理解QA的更新、保留等核心指标,实现与仓库演变的有效对齐。

摘要:

仓库级代码理解问答(QA)支持开发者对代码库中分布的功能与用法进行推理,但针对仓库专门优化的大语言模型(LLM)会随着代码演变出现对齐偏差。我们将这一挑战视为时间维度的仓库适应问题:获取新知识、抑制过时内容、保留仍有效的知识、维护语义相邻知识。现有的检索、微调及模型编辑方法仅能解决该问题的部分环节。我们提出时间自适应微调(TAFT),一种将仓库演变视为监督信号的新型适应方法:TAFT从仓库演变中生成时间锚定的QA数据,通过偏好优化将新有效知识与过时知识配对,并重放演变条件下的保留样例以维持仍有效的知识。我们在增强的时间SWE-bench数据集上评估TAFT,该数据集包含10个时间片段的255295个QA条目,我们从更新知识、过时答案抑制、保留能力、相邻稳定性四个维度,将TAFT与延迟(Baseline)、按片段重新训练(Baseline-Batched)及带知识锚点的变体进行对比。TAFT在所有维度上均持续优于延迟和批量基线,在更新/抑制知识准确率上平均相对提升18%,保留准确率翻倍,相邻准确率约为1.5倍。在直接提供知识锚点的情况下,TAFT-KANT相比TAFT,更新/抑制、保留及相邻准确率分别进一步提升3.55%、8.35%和13.00%。总体而言,TAFT在所有评估领域均展现出有效性,可使代码理解QA与仓库演变实现有效对齐。

英文摘要:

Repository-level code comprehension question answering (QA) supports developer reasoning over functionality and usage distributed across codebases. However, repository-specialized large language models (LLMs) can become misaligned as code evolves. We study this challenge as temporal repository adaptation: acquiring new knowledge, suppressing obsolete, retaining still-valid, and preserving semantically neighboring knowledge. Existing retrieval, fine-tuning, and model-editing methods address only parts of this problem. We propose Temporal Adaptive Fine-Tuning (TAFT), a novel adaptation approach that treats repository transitions as supervision. TAFT derives temporally grounded QA data from repository transitions, pairs newly valid with obsolete knowledge through preference optimization, and replays transition-conditioned retention examples to preserve still-valid knowledge. We evaluate TAFT on an augmented temporal SWE-bench dataset comprising 255,295 QA entries across ten temporal slices, comparing deferred (Baseline), per-slice retrained (Baseline-Batched), and variants with knowledge anchors along four dimensions: updated knowledge, obsolete-answer suppression, retention, and neighbor stability. TAFT consistently outperforms both the deferred and batched baselines, with an average relative improvement of 18% in updated/suppressed knowledge accuracy, doubled retention accuracy, and roughly 1.5 times the neighbor accuracy. With directly supplied knowledge anchors, TAFT-KANT further improves mean updated/suppressed, retention, and neighbor accuracy over TAFT by 3.55%, 8.35%, and 13.00%, respectively. Overall, TAFT demonstrates its effectiveness across all evaluated areas, effectively enabling code comprehension QA alignment with repository evolution.

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

↑