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

代码鲁棒模型的能量有界学习

Energy-bounded Learning for Robust Models of Code

Nghi D. Q. Bui, Yijun Yu

摘要:

在程序设计中,学习代码表示有着广泛的应用,包括代码分类、代码搜索、注释生成、错误预测等。已经提出了各种代码表示,如标记、语法树、依赖图、代码导航路径或它们的变体的组合,然而,现有的香草学习技术在鲁棒性方面有很大的局限性,即,当输入以微妙的方式改变时,模型很容易做出不正确的预测。为了增强鲁棒性,现有方法专注于识别对抗样本,而不是落在给定分布之外的有效样本,我们称之为分布外(OOD)样本。识别这样的OOD样本是本文研究的新问题。为此,我们建议首先用分布外的样本来增强分布内的数据集,这样,当一起训练时,它们将增强模型的鲁棒性。我们建议使用一个能量有界的学习目标函数分配一个较高的分数分布样本和一个较低的分数分布外的样本,以便将这样的分布外的样本到源代码模型的训练过程中。在OOD检测和对抗样本检测方面,我们的评估结果表明,现有的源代码模型在识别OOD数据时变得更准确,同时更能抵抗对抗攻击。此外,所提出的能量有界分数优于所有现有的OOD检测分数,包括softmax置信度分数,Mahalanobis分数和ODIN。

英文摘要:

In programming, learning code representations has a variety of applications, including code classification, code search, comment generation, bug prediction, and so on. Various representations of code in terms of tokens, syntax trees, dependency graphs, code navigation paths, or a combination of their variants have been proposed, however, existing vanilla learning techniques have a major limitation in robustness, i.e., it is easy for the models to make incorrect predictions when the inputs are altered in a subtle way. To enhance the robustness, existing approaches focus on recognizing adversarial samples rather than on the valid samples that fall outside a given distribution, which we refer to as out-of-distribution (OOD) samples. Recognizing such OOD samples is the novel problem investigated in this paper. To this end, we propose to first augment the in=distribution datasets with out-of-distribution samples such that, when trained together, they will enhance the model's robustness. We propose the use of an energy-bounded learning objective function to assign a higher score to in-distribution samples and a lower score to out-of-distribution samples in order to incorporate such out-of-distribution samples into the training process of source code models. In terms of OOD detection and adversarial samples detection, our evaluation results demonstrate a greater robustness for existing source code models to become more accurate at recognizing OOD data while being more resistant to adversarial attacks at the same time. Furthermore, the proposed energy-bounded score outperforms all existing OOD detection scores by a large margin, including the softmax confidence score, the Mahalanobis score, and ODIN.

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

↑