Explaining LLM Behavior with Executable Code: Consistency Metric and Verification Feedback
ORIGINAL / Code as Explanations: Executable and Verifiable LLM Explanations
The study proposes using program code to explain LLM behavior across a dataset and defines a consistency metric measuring the fraction of inputs on which the program reproduces model outputs. The novelty is shifting explanations from per-instance free text to programs verifiable across inputs, useful for automatically assessing explanation faithfulness and selecting candidate programs.
01 ABSTRACT
The paper proposes 'code explanations': programs that explain LLM behavior over a set of inputs and can be automatically verified by execution. The authors define a consistency metric (fraction of inputs where the program reproduces LLM outputs) and evaluate it on three open-source code-capable LLMs and eight tasks. Facts are that in some settings code explanations are highly consistent and 6x to 100x shorter than chain-of-thought; the authors' view is that this establishes executable code as a novel, verifiable, and compact approach to explaining LLM behavior.
02 KEY FINDINGS
- Code explanations can achieve high consistency in several settings and are 6x to 100x shorter than chain-of-thought.
- In 9 out of 24 settings, code explanations better align with model behavior than chain-of-thought.
- Consistency drops significantly on tasks with complex linguistic components, where programs often rely on longer hard-coded patterns; providing consistency feedback and code execution improves consistency, but it remains lower on complex tasks.
AI GENERATED SUMMARY / DISCOVERED BY ARXIV CS.CL · ARXIV CS.LG