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

揭示神经代码模型中的项目特定偏差

Unveiling Project-Specific Bias in Neural Code Models

Nanyang Technological University(南洋理工大学);New Jersey Institute of Technology(新泽西理工学院);Hong Kong Polytechnic University(香港理工大学)

Zhiming Li, Yanzhou Li, Tianlin Li, Mengnan Du, Bozhi Wu, Yushi Cao, Junzhe Jiang, Yang Liu

AI总结:

本研究揭示神经代码模型因依赖项目特定捷径导致跨项目泛化差的问题,提出Cond-Idf度量解释该行为,并设计基于样本潜在逻辑关系的偏差缓解机制,可提升跨项目泛化与对抗鲁棒性且不降低项目内准确率。

摘要:

深度学习已在诸多软件分析任务中带来显著提升。尽管基于大语言模型(LLMs)的神经代码模型在项目内独立同分布(IID)设置下训练和测试时表现出色,但它们往往难以有效泛化到现实世界的项目间分布外(OOD)数据。本研究表明,这一现象源于模型严重依赖项目特定的捷径进行预测,而非依据真实证据。我们提出一种Cond-Idf度量方法来解释这一行为,该方法量化了一个词元与标签的相关性及其项目特定性。模型行为与所提度量之间的强相关性表明,若缺乏适当正则化,模型倾向于利用虚假统计线索进行预测。基于这些观察,我们提出一种新颖的偏差缓解机制,通过利用样本间的潜在逻辑关系来规范模型的学习行为。在两项代表性程序分析任务上的实验结果表明,我们的缓解框架既能提升项目间OOD泛化能力和对抗鲁棒性,又不会牺牲项目内IID数据上的准确率。

英文摘要:

Deep learning has introduced significant improvements in many software analysis tasks. Although the Large Language Models (LLMs) based neural code models demonstrate commendable performance when trained and tested within the intra-project independent and identically distributed (IID) setting, they often struggle to generalize effectively to real-world inter-project out-of-distribution (OOD) data. In this work, we show that this phenomenon is caused by the heavy reliance on project-specific shortcuts for prediction instead of ground-truth evidence. We propose a Cond-Idf measurement to interpret this behavior, which quantifies the relatedness of a token with a label and its project-specificness. The strong correlation between model behavior and the proposed measurement indicates that without proper regularization, models tend to leverage spurious statistical cues for prediction. Equipped with these observations, we propose a novel bias mitigation mechanism that regularizes the model's learning behavior by leveraging latent logic relations among samples. Experimental results on two representative program analysis tasks indicate that our mitigation framework can improve both inter-project OOD generalization and adversarial robustness, while not sacrificing accuracy on intra-project IID data.

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

↑