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

使用突变注入框架评估LLM在Java代码片段适配上的表现

Evaluating LLMs on Java Code Snippet Adaptation Using a Mutation-Injection Framework

University of Windsor(温莎大学);University of Manitoba(曼尼托巴大学);University of Saskatchewan(萨斯喀彻温大学)

Ali Aman, Muhammad Asaduzzaman, Shaowei Wang, Chanchal K. Roy

AI总结:

通过突变注入框架构建Java代码片段数据集,研究无指令条件下LLM对代码片段的适配能力,分析适配类型难度、复杂度影响及所需上下文范围。

摘要:

背景:开发者经常通过复制代码片段并适配到新上下文来重用代码。现有的用于评估大语言模型(LLM)代码适配能力的基准要么依赖显式的逐步指令,要么只涵盖狭窄的变更类型(如变量连接),或者仅在函数级别粒度上操作。当所需变更多样且受控时,LLM在无显式编辑指导的情况下如何适配代码片段尚不清楚。\n目标:我们研究无指令的代码片段适配,即LLM必须在没有任何显式编辑指导的情况下将代码片段适配到其目标上下文。我们研究三个维度:哪些适配类型最难(RQ1),性能如何随适配复杂度扩展(RQ2),以及模型需要多少周围上下文(RQ3)。\n方法:我们将从具有强测试覆盖的开源仓库中构建一个Java代码片段数据集,并应用一个从开发者如何适配复制代码的实证发现中推导出的适配操作符分类法,使用突变注入框架。在代码片段级别工作并控制注入的变更,使我们能够确切知道模型必须执行哪些适配。未突变的片段作为模型需要进行的变更的合理参考。LLM将在三个上下文粒度级别上评估无指令适配任务。正确性主要通过测试套件重新插入来衡量,并辅以突变级别检查。

英文摘要:

Background: Developers frequently reuse code by copying fragments and adapting them to fit new contexts. Existing benchmarks for evaluating large language models (LLMs) on code adaptation either rely on explicit step-by-step instructions, cover only narrow change types such as variable wiring, or operate exclusively at function-level granularity. It remains unknown how well LLMs can adapt code fragments without explicit edit guidance when the required changes are varied and controlled. Objective: We investigate instruction-free code snippet adaptation in which an LLM must adapt a code fragment to fit its target context without any explicit edit guidance. We study three dimensions: which adaptation types are hardest (RQ1), how performance scales with adaptation complexity (RQ2), and how much surrounding context the model needs (RQ3). Method: We will construct a dataset of Java code fragments from open-source repositories with strong test coverage and apply a taxonomy of adaptation operators, derived from empirical findings on how developers adapt copied code, using a mutation-injection framework. Working at the code fragment level and controlling the injected changes lets us know exactly what adaptations the model must perform. The unmutated fragment serves as a plausible reference for the changes the model needs to make. LLMs will be evaluated on instruction-free adaptation tasks across three context granularity levels. Correctness will be measured primarily via test-suite re-insertion, complemented by mutation-level inspection.

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

↑