arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2407.08983cs.SEcs.AIcs.LG
收藏

迈向更可信、可解释的代码大语言模型:基于语法解释的方法

Towards More Trustworthy and Interpretable LLMs for Code through Syntax-Grounded Explanations

University of Central Florida(佛罗里达中央大学)

David N. Palacio, Daniel Rodriguez-Cardenas, Alejandro Velasco, Dipin Khati, Kevin Moran, Denys Poshyvanyk

AI总结:

本文提出 ASTrust,一种基于抽象语法树和模型置信度生成语法解释的代码 LLM 可解释性方法,支持局部与全局解释,并通过可视化及多项研究验证其提升可信度的效果。

摘要:

可信度与可解释性对于大语言模型(LLM)而言是密不可分的概念。LLM 越可解释,就越可信。然而,当前用于解释 LLM 在代码相关任务中行为的技术,大多侧重于准确性度量、模型对变化反应的测量或单个任务性能,而非在预测时所需的细粒度解释,而这些细粒度解释对于提升可解释性乃至可信度至关重要。为改善这一现状,本文提出了 ASTrust,一种针对代码 LLM 的可解释性方法,其生成的解释基于模型置信度与编程语言语法结构之间的关系。ASTrust 基于抽象语法树(AST)在语法类别的上下文中解释生成的代码,并帮助从业者在局部(单个代码片段)和全局(更大的代码数据集)两个层面理解模型预测。通过将模型置信度分数分配并映射到 AST 中存在的已知语法结构上,我们的方法超越了以往仅进行词元级置信度映射的技术,提供了一种直接与开发者熟悉的编程语言概念对齐的模型置信度视图。为将 ASTrust 付诸实践,我们开发了一种自动化可视化工具,将聚合的模型置信度分数叠加在基于序列、热力图和图形的 AST 语法结构可视化上。我们通过一项数据科学研究,在精心挑选的 GitHub 仓库集合上对 12 个流行的 LLM 进行了评估,检验了 ASTrust 的实际效益;同时通过一项人类研究,评估了 ASTrust 的实用性。

英文摘要:

Trustworthiness and interpretability are inextricably linked concepts for LLMs. The more interpretable an LLM is, the more trustworthy it becomes. However, current techniques for interpreting LLMs when applied to code-related tasks largely focus on accuracy measurements, measures of how models react to change, or individual task performance instead of the fine-grained explanations needed at prediction time for greater interpretability, and hence trust. To improve upon this status quo, this paper introduces ASTrust, an interpretability method for LLMs of code that generates explanations grounded in the relationship between model confidence and syntactic structures of programming languages. ASTrust explains generated code in the context of syntax categories based on Abstract Syntax Trees and aids practitioners in understanding model predictions at both local (individual code snippets) and global (larger datasets of code) levels. By distributing and assigning model confidence scores to well-known syntactic structures that exist within ASTs, our approach moves beyond prior techniques that perform token-level confidence mapping by offering a view of model confidence that directly aligns with programming language concepts with which developers are familiar. To put ASTrust into practice, we developed an automated visualization that illustrates the aggregated model confidence scores superimposed on sequence, heat-map, and graph-based visuals of syntactic structures from ASTs. We examine both the practical benefit that ASTrust can provide through a data science study on 12 popular LLMs on a curated set of GitHub repos and the usefulness of ASTrust through a human study.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑