arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2210.03003cs.SEcs.AI
收藏

MIXCODE:通过基于混淆的数据增强增强代码分类

MIXCODE: Enhancing Code Classification by Mixup-Based Data Augmentation

Kyushu University(九州大学);University of Luxembourg(卢森堡大学);Luxembourg Institute of Science and Technology(卢森堡科学技术研究院)

Zeming Dong, Qiang Hu, Yuejun Guo, Maxime Cordy, Mike Papadakis, Zhenya Zhang, Yves Le Traon, Jianjun Zhao

摘要:

受深度神经网络(DNN)在自然语言处理(NLP)中的巨大成功的启发,DNN越来越多地应用于源代码分析,并引起了软件工程社区的极大关注。由于其数据驱动的性质,DNN模型需要大量高质量的标记训练数据来实现专家级性能。收集这些数据通常并不难,但标记过程是出了名的费力。基于DNN的代码分析任务甚至会破坏这种情况,因为源代码标签也需要复杂的专业知识。数据增强已经成为计算机视觉和NLP等领域中补充训练数据的流行方法。然而,现有的代码分析中的数据增强方法采用简单的方法,如数据转换和对抗性示例生成,从而带来有限的性能优势。在本文中,我们提出了一种数据增强方法MIXCODE,旨在有效地补充有效的训练数据,灵感来自计算机视觉的最新进展Mixup。具体来说,我们首先利用多种代码重构方法来生成转换后的代码,这些代码与原始数据保持一致的标签。然后,我们采用Mixup技术将原始代码与转换后的代码混合,以增加训练数据。我们在两种程序设计语言(Java和Python)、两个代码任务(问题分类和bug检测)、四个基准数据集(JAVA250、Python800、CodRep1和Refactory)和七个模型架构(包括两个预训练模型CodeBERT和GraphCodeBERT)上评估了MIXCODE。实验结果表明,MIXCODE优于基线数据增强方法高达6.24%的准确性和26.06%的鲁棒性。

英文摘要:

Inspired by the great success of Deep Neural Networks (DNNs) in natural language processing (NLP), DNNs have been increasingly applied in source code analysis and attracted significant attention from the software engineering community. Due to its data-driven nature, a DNN model requires massive and high-quality labeled training data to achieve expert-level performance. Collecting such data is often not hard, but the labeling process is notoriously laborious. The task of DNN-based code analysis even worsens the situation because source code labeling also demands sophisticated expertise. Data augmentation has been a popular approach to supplement training data in domains such as computer vision and NLP. However, existing data augmentation approaches in code analysis adopt simple methods, such as data transformation and adversarial example generation, thus bringing limited performance superiority. In this paper, we propose a data augmentation approach MIXCODE that aims to effectively supplement valid training data, inspired by the recent advance named Mixup in computer vision. Specifically, we first utilize multiple code refactoring methods to generate transformed code that holds consistent labels with the original data. Then, we adapt the Mixup technique to mix the original code with the transformed code to augment the training data. We evaluate MIXCODE on two programming languages (Java and Python), two code tasks (problem classification and bug detection), four benchmark datasets (JAVA250, Python800, CodRep1, and Refactory), and seven model architectures (including two pre-trained models CodeBERT and GraphCodeBERT). Experimental results demonstrate that MIXCODE outperforms the baseline data augmentation approach by up to 6.24% in accuracy and 26.06% in robustness.

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

↑