Machine learning (ML) models play an increasingly prevalent role in many software engineering tasks. However, because most models are now powered by opaque deep neural networks, it can be difficult for developers to understand why the model came to a certain conclusion and how to act upon the model's prediction. Motivated by this problem, this paper explores counterfactual explanations for models of source code. Such counterfactual explanations constitute minimal changes to the source code under which the model "changes its mind". We integrate counterfactual explanation generation to models of source code in a real-world setting. We describe considerations that impact both the ability to find realistic and plausible counterfactual explanations, as well as the usefulness of such explanation to the user of the model. In a series of experiments we investigate the efficacy of our approach on three different models, each based on a BERT-like architecture operating over source code.
翻译:机器学习模型在许多软件工程任务中日益普遍。然而,由于大多数模型现在都由不透明的深层神经网络驱动,开发者可能难以理解为什么模型得出某种结论,以及如何根据模型的预测采取行动。由于这一问题,本文件探讨了源代码模型的反事实解释。这种反事实解释对模型“改变其思维”所依据的源代码的修改很小。我们将反事实解释生成与源代码模型在现实世界环境中的生成结合起来。我们描述了既影响找到现实和可信的反事实解释的能力,也影响这种解释对模型用户的有用性的各种考虑因素。在一系列实验中,我们根据三种不同的模型来调查我们方法的功效,每一种模型都基于一种类似于BERT的源代码操作结构。