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

理解大语言模型在自动偿还自承认技术债务中的有效性

Understanding the Effectiveness of LLMs in Automated Self-Admitted Technical Debt Repayment

Mohammad Sadegh Sheikhaei, Yuan Tian, Shaowei Wang, Bowen Xu

AI总结:

针对大语言模型在自动偿还自承认技术债务领域研究不足的问题,构建了大规模多语言数据集与新型评估指标,对比评估了微调和提示工程两类方法的效果,为该领域研究提供了基准与参考。

摘要:

自承认技术债务(Self-Admitted Technical Debt,SATD)指开发者通过注释在代码中主动确认的次优解决方案,这类问题对软件可维护性构成重大挑战。若长期未解决,SATD会降低代码质量并提升维护成本。尽管大语言模型(Large Language Models,LLMs)已在代码生成、程序修复等任务中展现出潜力,但其在自动SATD偿还领域的应用潜力仍未得到充分探索。\n 本文明确了训练与评估用于SATD偿还的LLMs时存在的三大核心挑战:(1)数据集的代表性与可扩展性问题;(2)无关SATD偿还样本的剔除问题;(3)现有评估指标的局限性问题。为解决前两项与数据集相关的挑战,我们采用了一种语言无关的SATD追踪工具,并设计了一套10步过滤流水线从代码仓库中提取SATD偿还样本,最终构建了两个大规模数据集:Python数据集包含58722条样本,Java数据集包含97347条样本。为优化评估效果,我们提出了两种基于代码差异的指标——BLEU-diff和CrystalBLEU-diff,这两类指标针对代码变更内容而非完整代码进行度量。此外,我们还提出了另一种兼具可解释性与信息丰富性的新指标LEMOD。基于我们构建的新基准与评估指标,我们评估了两类自动SATD偿还方法:对小型模型进行微调的方法,以及结合五款大规模模型的提示工程方法。实验结果显示,微调后的小型模型在精确匹配(Exact Match,EM)得分上与基于提示的方法相当,但在基于BLEU的指标和LEMOD指标上表现欠佳。值得注意的是,Gemma-2-9B的EM得分领先,可解决10.1%的Python SATD和8.1%的Java SATD;而Llama-3.1-70B-Instruct和GPT-4o-mini在BLEU-diff、CrystalBLEU-diff和LEMOD指标上表现更优。本研究提供了可靠的基准、改进的评估指标以及对LLMs的全面评估,推动了自动SATD偿还领域的研究发展。

英文摘要:

Self-Admitted Technical Debt (SATD), cases where developers intentionally acknowledge suboptimal solutions in code through comments, poses a significant challenge to software maintainability. Left unresolved, SATD can degrade code quality and increase maintenance costs. While Large Language Models (LLMs) have shown promise in tasks like code generation and program repair, their potential in automated SATD repayment remains underexplored. In this paper, we identify three key challenges in training and evaluating LLMs for SATD repayment: (1) dataset representativeness and scalability, (2) removal of irrelevant SATD repayments, and (3) limitations of existing evaluation metrics. To address the first two dataset-related challenges, we adopt a language-independent SATD tracing tool and design a 10-step filtering pipeline to extract SATD repayments from repositories, resulting two large-scale datasets: 58,722 items for Python and 97,347 items for Java. To improve evaluation, we introduce two diff-based metrics, BLEU-diff and CrystalBLEU-diff, which measure code changes rather than whole code. Additionally, we propose another new metric, LEMOD, which is both interpretable and informative. Using our new benchmarks and evaluation metrics, we evaluate two types of automated SATD repayment methods: fine-tuning smaller models, and prompt engineering with five large-scale models. Our results reveal that fine-tuned small models achieve comparable Exact Match (EM) scores to prompt-based approaches but underperform on BLEU-based metrics and LEMOD. Notably, Gemma-2-9B leads in EM, addressing 10.1% of Python and 8.1% of Java SATDs, while Llama-3.1-70B-Instruct and GPT-4o-mini excel on BLEU-diff, CrystalBLEU-diff, and LEMOD metrics. Our work contributes a robust benchmark, improved evaluation metrics, and a comprehensive evaluation of LLMs, advancing research on automated SATD repayment.

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

↑