一句话:提出 TokenScope,一个面向代码生成 LLM 的交互式 Token 级可解释性分析工具,统一解码信号与 AST 结构。
理解大语言模型在代码生成中如何做出 Token 级决策,对研究者和实践者都是挑战。现有工具多关注模型内部或生成结果,缺少解码时信号、细粒度不确定性度量以及探索替代生成路径的交互机制。本文提出 TokenScope,一个面向基于解码器 LLM 的交互式可解释性与分析工具,在生成过程中展示 Token 级指标、注意力模式和结构信息,并支持交互式 Token 替换、反事实分支以及基于抽象语法树(AST)的代码感知聚合。通过统一解码时信号与结构化程序分析,TokenScope 使研究者能够系统考察 LLM 在代码生成过程中的行为。
Understanding how Large Language Models (LLMs) make token-level decisions during code generation remains a major challenge for both researchers and practitioners. While recent tools provide insights into model internals or generation outcomes, they often lack decoding-time signals, fine-grained uncertainty measures, and interactive mechanisms for exploring alternative generation paths. We present TokenScope, an interactive interpretability and analysis tool for decoder-based LLMs that exposes token-level metrics, attention patterns, and structural information during generation. TokenScope supports interactive token replacement, counterfactual branching, and code-aware aggregation via abstract syntax trees. By unifying decoding-time signals with structural program analysis, TokenScope enables systematic investigation of LLM behaviour during code generation.
DOI 原文 · arXiv · PDF(开放获取) · DBLP
@inproceedings{EsmaeiliF26,
title = {TokenScope: Token-Level Explainability and Interpretability for Code-Oriented Tasks in Large Language Models},
author = {Amirreza Esmaeili and Fatemeh Hendijani Fard},
booktitle = {FSE},
year = {2026},
doi = {10.1145/3803437.3806421}
}