CodeImprove: 面向深度代码模型的程序适配
CodeImprove: Program Adaptation for Deep Code Models
AI总结:
针对代码模型因数据偏移等性能下降、重训练成本高的问题,提出CodeImprove框架,通过有效性分数识别超范围输入,结合遗传算法的语义保持程序转换实现输入适配,有效提升模型准确率与超范围输入检测效果。
摘要:
利用基于深度学习(DL)的代码分析工具解决软件工程任务正日益普及。代码模型常因多种原因(如代码数据偏移)出现性能下降。解决这类问题通常需要重新训练,但频繁的模型更新在标注和部署层面成本高昂。本文探索了一种替代方案:让程序输入适配代码模型。该方案可通过两个步骤实现:1)输入验证,重点识别输入是否为超出模型处理能力的超范围输入程序;2)输入适配,将超范围输入调整为范围内输入。程序输入验证颇具挑战,因为现有技术主要针对图像等连续输入,无法应对代码这类离散输入——代码具有独特特性,且深度学习模型对其的处理方式也不同。超范围程序的适配也因搜索空间过大而充满挑战。因此,本文提出CodeImprove框架,该框架可区分超范围输入与正常输入,并通过程序转换将超范围输入转回范围内输入。具体而言,我们提出了一种有效性分数指标来识别超范围输入,并利用遗传算法执行语义保持的程序转换,将超范围输入转换为范围内输入。实验结果表明,在两项软件工程任务的三个代码模型上,CodeImprove最高可提升8.78%的准确率,相对提升幅度达51.28%。此外,我们的输入验证方法在检测超范围输入方面表现出色(AUC得分为0.924)。
英文摘要:
Leveraging deep learning (DL)-based code analysis tools to solve software engineering tasks is becoming increasingly popular. Code models often suffer performance degradation due to various reasons (e.g., code data shifts). Retraining is often required to address these issues, but frequent model updates are costly in labeling and deployment. In this paper, we explore an alternative solution: Adapting the program inputs to the code models. This can be achieved by two steps: 1) input validation that focuses on identifying whether an input is an out-of-scope input program that are beyond a model's handling capability, and 2) input adaptation that adapts out-of-scope inputs to become in-scope inputs. Validating program input is challenging, as current techniques focus on continuous inputs such as image data and fail with discrete inputs like code data, which have unique characteristics and are processed differently by deep learning models. Adapting out-of-scope programs is also challenging due to their vast search spaces. Therefore, in this paper, we propose CodeImprove, which distinguishes out-of-scope from normal inputs and converts such out-of-scope inputs back to in-scope inputs through program transformation. In particular, we propose a validity score metric to identify out-of-scope inputs and leverage genetic algorithms to apply semantic preserving program transformation to convert out-of-scope inputs to in-scope inputs. Our experimental results show CodeImprove can enhance up to 8.78% of accuracy, and 51.28% of relative improvements in three code models on two SE tasks. Additionally, our input validation is promising in detecting out-of-scope inputs (AUC score of 0.924).
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。