Code as Explanations: Executable and Verifiable LLM Explanations
Researchers propose code explanations: programs intended to reproduce a language model’s outputs across multiple inputs, with execution enabling automatic checks. In tests across three open-source models and eight tasks, the programs were shorter than chain-of-thought explanations and performed unevenly, with lower consistency on linguistically complex tasks.
AI-generated summary based on the headline and feed excerpt.
arXiv cs.LG reports a method for explaining language-model behavior with programs that aim to reproduce the model’s outputs across a dataset. The researchers define a consistency metric based on the share of inputs for which a program matches those outputs, using it to assess and select candidate explanations.
Across three open-source code-capable models and eight tasks, code explanations were 6 to 100 times shorter than chain-of-thought explanations and aligned better with model behavior in 9 of 24 settings. Performance declined on tasks with more complex linguistic components; there, programs matched outputs no more often than an uninformative baseline and often used longer hard-coded patterns. Experiments with Claude Opus 5.5 found that consistency feedback and code execution improved explanation consistency, though complex tasks remained more difficult. Why it matters: Executable explanations offer a way to test whether an account of model behavior holds across multiple inputs.
Written by SINN with AI assistance from arXiv cs.LG's reporting.
Originally reported by arXiv cs.LG
Read the full story at arXiv cs.LG