arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2312.11889cs.SEcs.AI
收藏

通过分层Transformer捕捉代码上下文预测行级缺陷

Predicting Line-Level Defects by Capturing Code Contexts with Hierarchical Transformers

Dalhousie University(达尔豪斯大学)

Parvez Mahbub, Mohammad Masudur Rahman

AI总结:

针对行级缺陷预测难度大、现有方法利用率不足的问题,提出基于分层Transformer的Bugsplorer技术,针对行级目标优化,准确率较最优方法提升26%-72%,可显著降低SQA成本。

摘要:

软件缺陷消耗了软件开发总预算的40%,每年给全球经济造成数十亿美元的损失。遗憾的是,尽管软件开发过程中采用了许多软件质量保证(SQA)实践(如代码审查、持续集成),软件产品的正式版本中仍可能存在缺陷。因此,针对代码库的脆弱区域优先安排SQA工作,对于确保软件发布的高质量至关重要。在行级别预测软件缺陷有助于优先安排SQA工作,但由于代码库中仅约3%的代码行可能存在缺陷,这是一项极具挑战性的任务。现有的行级缺陷预测研究往往存在不足,无法充分利用行级缺陷信息。本文提出了Bugsplorer,一种用于行级缺陷预测的新型深度学习技术。它利用Transformer模型的分层结构来表示两类代码元素:代码令牌(token)和代码行。与针对文件级缺陷预测优化的现有技术不同,Bugsplorer针对行级缺陷预测目标进行了优化。我们通过五项性能指标进行评估,结果表明Bugsplorer在预测缺陷行方面表现出色,其准确率比当前最优技术高出26%-72%。它能将前20%的缺陷行排在前1%-3%的可疑行范围内。因此,Bugsplorer通过将缺陷行排在更靠前的位置,有望显著降低SQA成本。

英文摘要:

Software defects consume 40% of the total budget in software development and cost the global economy billions of dollars every year. Unfortunately, despite the use of many software quality assurance (SQA) practices in software development (e.g., code review, continuous integration), defects may still exist in the official release of a software product. Therefore, prioritizing SQA efforts for the vulnerable areas of the codebase is essential to ensure the high quality of a software release. Predicting software defects at the line level could help prioritize the SQA effort but is a highly challenging task given that only ~3% of lines of a codebase could be defective. Existing works on line-level defect prediction often fall short and cannot fully leverage the line-level defect information. In this paper, we propose Bugsplorer, a novel deep-learning technique for line-level defect prediction. It leverages a hierarchical structure of transformer models to represent two types of code elements: code tokens and code lines. Unlike the existing techniques that are optimized for file-level defect prediction, Bugsplorer is optimized for a line-level defect prediction objective. Our evaluation with five performance metrics shows that Bugsplorer has a promising capability of predicting defective lines with 26-72% better accuracy than that of the state-of-the-art technique. It can rank the first 20% defective lines within the top 1-3% suspicious lines. Thus, Bugsplorer has the potential to significantly reduce SQA costs by ranking defective lines higher.

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

↑