使大语言模型具备全球、以人为本的解释能力:从token到可解释的代码和测试生成
Enabling Global, Human-Centered Explanations for LLMs:From Tokens to Interpretable Code and Test Generation
AI总结:
本文提出code rationales框架,通过将token级解释映射到高层编程类别,实现大语言模型代码生成的全局可解释性,验证了其在减少解释不确定性方面的有效性。
摘要:
随着大语言模型用于代码(LM4Code)在软件工程中的重要性日益增加,建立对其输出的信任变得至关重要。然而,标准准确性度量标准掩盖了生成模型的底层推理过程,难以揭示决策是如何做出的。尽管事后可解释性方法试图填补这一差距,但它们通常将解释限制在局部、token级的见解,无法提供开发者可理解的全局分析。我们的工作强调了对全球、基于代码的解释的迫切需求,这些解释揭示了模型在代码层面的推理过程。为了支持这一愿景,我们引入了code rationales(CodeQ)框架,该框架通过将token级解释映射到高层编程类别,实现全局可解释性。通过汇总数千个token级解释,我们能够进行统计分析,揭示系统性的推理行为。我们通过展示其从嘈杂的token数据中提炼出清晰信号,减少了解释不确定性(香农熵)超过50%来验证这种汇总。此外,我们发现一个代码生成模型(codeparrot-small)倾向于浅层语法线索(如缩进)而非深层语义逻辑。在37名参与者的用户研究中,我们发现其推理与人类开发者的推理显著不一致。这些发现隐藏在传统度量标准之下,展示了全球可解释性技术对建立LM4Code信任的重要性。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。