面向神经代码模型解释的因果理论探索
Toward a Theory of Causation for Interpreting Neural Code Models
AI总结:
本文提出面向神经代码模型的事后可解释性方法 $do_{code}$,基于因果推断并利用编程语言属性缓解虚假相关,案例研究表明其能揭示模型对语法变化的敏感性及混杂偏误。
摘要:
代码神经语言模型,即神经代码模型(NCMs),正迅速从研究原型发展为商业开发者工具。因此,理解这类模型的能力与局限正变得至关重要。然而,这些模型的能力通常通过自动化指标来衡量,而这些指标往往只能揭示其真实世界表现的一部分。尽管总体而言,NCMs 的表现看起来很有前景,但目前关于这些模型如何做出决策仍有许多未知之处。为此,本文引入了 $do_{code}$,这是一种专门针对 NCMs 的事后可解释性方法,能够解释模型预测。$do_{code}$ 基于因果推断,以支持面向编程语言的解释。虽然 $do_{code}$ 的理论基础可扩展用于探索不同的模型属性,但我们提供了一个具体实例,旨在通过将模型行为的解释建立在编程语言属性之上,来减轻虚假相关性的影响。为了展示 $do_{code}$ 的实际益处,我们通过对两种流行的深度学习架构和十个 NCMs 进行案例研究,说明了我们的框架所能提供的见解。该案例研究的结果表明,我们所研究的 NCMs 对代码语法的变化很敏感。除类 BERT 模型外,我们所有的 NCMs 在统计上都学会了预测与代码块相关的 token(例如方括号、圆括号、分号),并且与其他编程语言结构相比,其混杂偏误更少。这些见解展示了 $do_{code}$ 作为一种有用方法的潜力,可用于检测并促进消除 NCMs 中的混杂偏误。
英文摘要:
Neural Language Models of Code, or Neural Code Models (NCMs), are rapidly progressing from research prototypes to commercial developer tools. As such, understanding the capabilities and limitations of such models is becoming critical. However, the abilities of these models are typically measured using automated metrics that often only reveal a portion of their real-world performance. While, in general, the performance of NCMs appears promising, currently much is unknown about how such models arrive at decisions. To this end, this paper introduces $do_{code}$, a post hoc interpretability method specific to NCMs that is capable of explaining model predictions. $do_{code}$ is based upon causal inference to enable programming language-oriented explanations. While the theoretical underpinnings of $do_{code}$ are extensible to exploring different model properties, we provide a concrete instantiation that aims to mitigate the impact of spurious correlations by grounding explanations of model behavior in properties of programming languages. To demonstrate the practical benefit of $do_{code}$, we illustrate the insights that our framework can provide by performing a case study on two popular deep learning architectures and ten NCMs. The results of this case study illustrate that our studied NCMs are sensitive to changes in code syntax. All our NCMs, except for the BERT-like model, statistically learn to predict tokens related to blocks of code (\eg brackets, parenthesis, semicolon) with less confounding bias as compared to other programming language constructs. These insights demonstrate the potential of $do_{code}$ as a useful method to detect and facilitate the elimination of confounding bias in NCMs.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。