As Large Language Models for Code (LM4Code) become integral to software engineering, establishing trust in their output becomes critical. However, standard accuracy metrics obscure the underlying reasoning of generative models, offering little insight into how decisions are made. Although post-hoc interpretability methods attempt to fill this gap, they often restrict explanations to local, token-level insights, which fail to provide a developer-understandable global analysis. Our work highlights the urgent need for \textbf{global, code-based} explanations that reveal how models reason across code. To support this vision, we introduce \textit{code rationales} (CodeQ), a framework that enables global interpretability by mapping token-level rationales to high-level programming categories. Aggregating thousands of these token-level explanations allows us to perform statistical analyses that expose systemic reasoning behaviors. We validate this aggregation by showing it distills a clear signal from noisy token data, reducing explanation uncertainty (Shannon entropy) by over 50%. Additionally, we find that a code generation model (\textit{codeparrot-small}) consistently favors shallow syntactic cues (e.g., \textbf{indentation}) over deeper semantic logic. Furthermore, in a user study with 37 participants, we find its reasoning is significantly misaligned with that of human developers. These findings, hidden from traditional metrics, demonstrate the importance of global interpretability techniques to foster trust in LM4Code.


翻译:随着代码大语言模型(LM4Code)日益成为软件工程不可或缺的组成部分,建立对其输出的信任变得至关重要。然而,传统的准确性指标掩盖了生成模型的底层推理过程,几乎无法揭示其决策机制。尽管事后可解释性方法试图填补这一空白,但它们通常将解释局限于局部、词元层面的分析,难以提供开发者可理解的全局视角。本研究强调了对能够揭示模型在代码层面推理方式的**全局、基于代码的**解释的迫切需求。为支持这一愿景,我们提出了**代码理据**(CodeQ)框架,该框架通过将词元层面的理据映射到高级编程类别,实现了全局可解释性。通过聚合数千个此类词元层面的解释,我们得以进行统计分析,从而揭示系统性的推理行为。我们验证了这种聚合方法的有效性,证明其能够从嘈杂的词元数据中提取出清晰的信号,将解释的不确定性(香农熵)降低超过50%。此外,我们发现一个代码生成模型(*codeparrot-small*)持续倾向于依赖浅层的语法线索(例如**缩进**),而非更深层的语义逻辑。进一步地,在一项涉及37名参与者的用户研究中,我们发现该模型的推理与人类开发者的推理存在显著偏差。这些被传统指标所掩盖的发现,凸显了全局可解释性技术对于促进对LM4Code信任的重要性。

0
下载
关闭预览

相关内容

代码(Code)是专知网的一个重要知识资料文档板块,旨在整理收录论文源代码、复现代码,经典工程代码等,便于用户查阅下载使用。
迈向透明人工智能(AI):可解释性语言模型综述
专知会员服务
15+阅读 · 2025年9月29日
可解释人工智能中的大语言模型:全面综述
专知会员服务
53+阅读 · 2025年4月2日
《以人为中心的大型语言模型(LLM)研究综述》
专知会员服务
41+阅读 · 2024年11月25日
大型语言模型(LLMs),附Slides与视频
专知会员服务
70+阅读 · 2024年6月30日
《大型语言模型代码生成》综述
专知会员服务
68+阅读 · 2024年6月4日
最新《可解释人工智能》概述,50页ppt
专知
12+阅读 · 2021年3月17日
NLP通用模型诞生?一个模型搞定十大自然语言常见任务
人工智能头条
10+阅读 · 2018年6月29日
【学界】机器学习模型的“可解释性”到底有多重要?
GAN生成式对抗网络
12+阅读 · 2018年3月3日
国家自然科学基金
18+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
7+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
相关VIP内容
迈向透明人工智能(AI):可解释性语言模型综述
专知会员服务
15+阅读 · 2025年9月29日
可解释人工智能中的大语言模型:全面综述
专知会员服务
53+阅读 · 2025年4月2日
《以人为中心的大型语言模型(LLM)研究综述》
专知会员服务
41+阅读 · 2024年11月25日
大型语言模型(LLMs),附Slides与视频
专知会员服务
70+阅读 · 2024年6月30日
《大型语言模型代码生成》综述
专知会员服务
68+阅读 · 2024年6月4日
相关基金
国家自然科学基金
18+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
7+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员