arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2407.08890cs.SEcs.AIcs.LG
收藏

DeepCodeProbe:旨在理解基于代码训练的模型学到了什么

DeepCodeProbe: Towards Understanding What Models Trained on Code Learn

Polytechnique Montreal(蒙特利尔理工学院)

Vahid Majdinasab, Amin Nikanjam, Foutse Khomh

AI总结:

针对代码训练的机器学习模型可解释性不足的问题,提出探测方法DeepCodeProbe,检验软件维护任务模型的句法与表示学习能力,揭示模型容量与学习效果的权衡,并给出训练最佳实践与开源复现包。

摘要:

基于代码及相关制品训练的机器学习模型为软件维护提供了宝贵支持,但由于其内部变量复杂,存在可解释性问题。这些担忧在安全关键型应用中尤为突出,此类场景下模型的决策过程必须可靠。这类模型学到的具体特征和表示仍不明确,进一步加剧了广泛应用它们的顾虑。为应对这些挑战,我们提出DeepCodeProbe,这是一种探测方法,用于检验面向软件维护任务的机器学习模型的句法与表示学习能力。本研究将DeepCodeProbe应用于代码克隆检测、代码摘要生成和注释生成领域的前沿模型。研究结果表明,尽管小型模型能捕捉抽象句法表示,但它们完全掌握编程语言句法的能力有限。提升模型容量可改善句法学习效果,但会带来训练时间增加、过拟合等权衡问题。DeepCodeProbe还识别出了模型从训练数据中学到的特定代码模式。此外,我们还给出了在代码上训练模型以提升性能和可解释性的最佳实践,并配套了开源复现包,以支持DeepCodeProbe更广泛地应用于解释其他代码相关模型。

英文摘要:

Machine learning models trained on code and related artifacts offer valuable support for software maintenance but suffer from interpretability issues due to their complex internal variables. These concerns are particularly significant in safety-critical applications where the models' decision-making processes must be reliable. The specific features and representations learned by these models remain unclear, adding to the hesitancy in adopting them widely. To address these challenges, we introduce DeepCodeProbe, a probing approach that examines the syntax and representation learning abilities of ML models designed for software maintenance tasks. Our study applies DeepCodeProbe to state-of-the-art models for code clone detection, code summarization, and comment generation. Findings reveal that while small models capture abstract syntactic representations, their ability to fully grasp programming language syntax is limited. Increasing model capacity improves syntax learning but introduces trade-offs such as increased training time and overfitting. DeepCodeProbe also identifies specific code patterns the models learn from their training data. Additionally, we provide best practices for training models on code to enhance performance and interpretability, supported by an open-source replication package for broader application of DeepCodeProbe in interpreting other code-related models.

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

↑