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

INSPECT:代码 Transformer 的内在与系统性探测评估

INSPECT: Intrinsic and Systematic Probing Evaluation for Code Transformers

Free University of Bozen-Bolzano(博尔扎诺自由大学);University of Bordeaux(波尔多大学);CNRS(法国国家科学研究中心);Bordeaux INP(波尔多国立理工学院)

Anjan Karmakar, Romain Robbes

AI总结:

本文提出 INSPECT 探测框架,通过 15 个涵盖表层、句法、结构和语义特征的任务评估 8 个代码预训练模型及 BERT,揭示结构信息的作用与代码专用预训练的改进空间。

摘要:

源代码预训练模型近来已成功应用于种类广泛的软件工程任务;它们也在实践中获得了一些实际采用,例如用于代码补全。然而,我们对这些预训练模型究竟学到了哪些关于源代码的知识仍知之甚少。在本文中,我们使用探测——即不会对模型作进一步训练的简单诊断任务——来揭示预训练模型在多大程度上学到了源代码的特定方面。我们使用一个可扩展框架定义了 15 个探测任务,这些任务考察源代码的表层、句法、结构和语义特征。我们探测了 8 个预训练源代码模型,并以一个自然语言模型(BERT)作为基线。我们发现,纳入了某些结构信息的模型(例如 GraphCodeBERT)对源代码特征具有更好的表示。令人惊讶的是,我们发现在某些探测任务上,BERT 与源代码模型具有竞争力,这表明在相应代码特征上改进面向源代码的预训练仍有充分机会。我们鼓励其他研究人员使用我们的探测任务套件评估其模型,以便他们能够审视模型的隐藏层,并识别其中编码了哪些内在代码特征。

英文摘要:

Pre-trained models of source code have recently been successfully applied to a wide variety of Software Engineering tasks; they have also seen some practical adoption in practice, e.g. for code completion. Yet, we still know very little about what these pre-trained models learn about source code. In this article, we use probing--simple diagnostic tasks that do not further train the models--to discover to what extent pre-trained models learn about specific aspects of source code. We use an extensible framework to define 15 probing tasks that exercise surface, syntactic, structural and semantic characteristics of source code. We probe 8 pre-trained source code models, as well as a natural language model (BERT) as our baseline. We find that models that incorporate some structural information (such as GraphCodeBERT) have a better representation of source code characteristics. Surprisingly, we find that for some probing tasks, BERT is competitive with the source code models, indicating that there are ample opportunities to improve source-code specific pre-training on the respective code characteristics. We encourage other researchers to evaluate their models with our probing task suite, so that they may peer into the hidden layers of the models and identify what intrinsic code characteristics are encoded.

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

↑