arXiv 论文提出用可执行代码解释并验证 LLM 行为
Code as Explanations: Executable and Verifiable LLM Explanations
AI 导读
NeurIPS 2026 论文提出用代码作为 LLM 行为解释,程序在数据集层面复现模型输出并可自动验证,作者定义 Consistency 指标来评估与筛选候选程序。
正文 · 原文
Abstract:As large language models (LLMs) increasingly make consequential decisions and solve problems alongside humans, we must understand how models arrive at their conclusions. Understanding how an LLM behaves requires observing it across multiple inputs, yet free-text explanations such as chain-of-thought (CoT) are generated per instance and cannot be easily verified on new inputs. We propose {code explanations to address the mismatch in how LLM explanations are generated versus how they are evaluated: a program explains LLM behavior across a dataset of inputs, and its execution enables automatic verification. We define Consistency metric that measures the fraction of inputs on which the program reproduces the LLM's outputs, and use it to evaluate and select candidate programs. Across three open-source code-capable LLMs and eight tasks, we find that LLMs can produce highly consistent code explanations in several settings. Code explanations are also 6$\times$ to 100$\times$ shorter than CoT, and better align with model behavior in 9 out of 24 settings. However, consistency is significantly lower on tasks with more complex linguistic components, where generated programs reproduce model outputs no more frequently than an uninformative explanation baseline, and these programs often rely on longer hard-coded patterns. In experiments with Claude Opus 5.5, providing the model with consistency feedback and code execution improves explanation consistency across tasks, but consistency remains significantly lower on more complex tasks. Our findings establish executable code as a novel, verifiable, and compact approach to explaining LLM behavior and highlight verification feedback as a promising direction for improving explanation consistency. The code for this paper is at this https URL.
| Comments: | 30 pages, 11 figures, 3 tables, The Fortieth Annual Conference on Neural Information Processing Systems (NeurIPS 2026) |
| Subjects: | Machine Learning (cs.LG); Artificial Intelligence (cs.AI); Computation and Language (cs.CL); Machine Learning (stat.ML) |
| Cite as: | arXiv:2611.14704 [cs.LG] |
| (or arXiv:2611.14704v1 [cs.LG] for this version) | |
| https://doi.org/10.48550/arXiv.2611.14704 arXiv-issued DOI via DataCite (pending registration) |
|
| Journal reference: | The Fortieth Annual Conference on Neural Information Processing Systems (NeurIPS 2026) |
Submission history
From: Nhi Nguyen [view email]
[v1]
Tue, 10 Nov 2026 20:13:21 UTC (2,973 KB)
来源:arXiv cs.AI · arxiv.org