paperbot · PL 论文追踪

全部论文 待读 收藏

P2 An Explanation Method for Models of Code

面向代码模型的解释方法
OOPSLA 7(OOPSLA2)2023匹配度 3/10 · 该论文研究代码模型预测的可解释性,属于机器学习与程序语言的交叉,但不涉及用户核心关注的静态分析在 ML/Agentic 程序中的应用、LLM/Agent 改进静态分析/形式化验证、浮点程序分析或贝叶斯程序分析,因此匹配度有限。引用 2 inbox
Yu Wang, Ke Wang, Linzhang Wang
crossref: 2026-09-10

AI 速览

一句话:提出 WheaCha,将代码模型预测归因分解为决定性的 wheat 与其余 chaff,并实现工具 HuoYan。

本文关注代码模型预测的可解释性,提出 WheaCha 方法。与归因方法不同,WheaCha 将输入程序划分为对预测标签起决定作用的“wheat”和其余“chaff”,从而定位真正导致模型判断的定义性特征。作者实现工具 HuoYan,并在 code2vec、seq-GNN、GGNN 和 CodeBERT 四个代表性代码模型上评估。结果显示 HuoYan 端到端计算 wheat 平均少于二十秒;模型主要依赖简单句法甚至词法特征(如标识符名);现有代码可解释方法 SIVAND、反事实解释及 Integrated Gradients、SHAP 均无法精确捕捉 wheat。最后,实验表明 WheaCha 的解释能显著帮助用户识别在错误标注或偏置数据上训练的缺陷模型,准确率高于对比方法。

问题
代码模型(如 code2vec、CodeBERT)的预测难以解释,现有归因方法无法准确找出真正决定预测的输入特征。
方法
提出 WheaCha,将输入程序分解为决定预测的 wheat 和其余 chaff,并实现端到端工具 HuoYan。
评估
在四个代表性代码模型上评估效率与解释质量,并与 SIVAND、反事实解释、Integrated Gradients、SHAP 比较,还通过用户识别缺陷模型的实验验证实用性。
原文摘要(Abstract)

This paper introduces a novel method, called WheaCha, for explaining the predictions of code models. Similar to attribution methods, WheaCha seeks to identify input features that are responsible for a particular prediction that models make. On the other hand, it differs from attribution methods in crucial ways. Specifically, WheaCha separates an input program into "wheat" (i.e., defining features that are the reason for which models predict the label that they predict) and the rest "chaff" for any given prediction. We realize WheaCha in a tool, HuoYan, and use it to explain four prominent code models: code2vec, seq-GNN, GGNN, and CodeBERT. Results show that (1) HuoYan is efficient — taking on average under twenty seconds to compute wheat for an input program in an end-to-end fashion (i.e., including model prediction time); (2) the wheat that all models use to make predictions is predominantly comprised of simple syntactic or even lexical properties (i.e., identifier names); (3) neither the latest explainability methods for code models (i.e., SIVAND and CounterFactual Explanations) nor the most noteworthy attribution methods (i.e., Integrated Gradients and SHAP) can precisely capture wheat. Finally, we set out to demonstrate the usefulness of WheaCha, in particular, we assess if WheaCha’s explanations can help end users to identify defective code models (e.g., trained on mislabeled data or learned spurious correlations from biased data). We find that, with WheaCha, users achieve far higher accuracy in identifying faulty models than SIVAND, CounterFactual Explanations, Integrated Gradients and SHAP.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot1843,
  title = {An Explanation Method for Models of Code},
  author = {Yu Wang and Ke Wang and Linzhang Wang},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {7},
  number = {OOPSLA2},
  year = {2023},
  doi = {10.1145/3622826}
}