- Rating
- 3
- Clarity
- 3
- Confidence
- 3
- Originality
- 2
- Quality
- 2
- Significance
- 2
Read review
Summary
This paper proposes using executable code (Python programs) as an alternative to free-text explanations for understanding LLM behavior. The key idea is that code explanations are executable and can be automatically verified against model outputs, unlike free-text explanations which require perturbation-based evaluation. The authors introduce a "code explanation consistency" metric (fraction of dataset examples where the program's output matches the model's output), a best-of-100 generation procedure, and study when three open-source LLMs (Gemma3-27B, Qwen2.5-Coder-32B, Llama3.1-70B) can produce consistent code explanations across eight BBH tasks of varying linguistic complexity. Main findings: (1) high consistency is achievable in 6/24 model-task settings but is not the norm; (2) tasks with complex linguistic components are harder; (3) hard-task programs degenerate into lookup tables rather than compact algorithms; (4) model-internal representations do not predict whether code explanations will be consistent.
Strengths and weaknesses
Strengths
- The formalization in Section 3 is precise. The consistency metric (Eq. 4) is simple, interpretable, and well-motivated. The normalized version (CONSISTENCY_OVER_RANDOM, Eq. 5) enables cross-task comparison. The generation procedure (Algorithm 1) is straightforward and reproducible.
- The four-category grouping (structured logic → logic + simple language → logic + complex language → linguistic reasoning) creates a natural difficulty gradient that produces interpretable results. The finding that consistency degrades along this axis is clean and informative.
- Probing whether models "know" when they can produce consistent explanations is exactly the kind of meta-cognitive question the explainability community needs to investigate. The negative result (R² < 0 for all models) is informative, suggesting self-generated explanations lack reliable confidence signals.
- The idea of using code as an explanation medium is genuinely insightful.
Weakness
- The paper's results are almost tautological: code works as an "explanation" for tasks that are already algorithmic (Navigate = followdirection instructions), and fails for tasks that require actual language understanding. This is not a novel insight. If the code uses hardcoded linguistic patterns (which is what they observe) — it's not an explanation, it's a lookup table. It doesn't generalize and tells you nothing about how the model processes language.
- The motivation of the paper is not clear. Why we need dataset level explanation, and what is the benefit of them if we cannot gurantee consistency?
- One of the three claimed advantages of code over free-text is "potential compactness" and the ability to provide "compact, human-understandable" explanations, However this is not evaluated properly.
- The generation procedure (Algorithm 1) samples 100 candidate programs and selects the one with the highest consistency on the full dataset D. This is best-of-100 selection evaluated on the same data used for selection—there is no held-out evaluation. The reported "max consistency" numbers are optimistically biased.
- The paper argues code is better than free-text, but never directly compares. For the same tasks, how faithful are free-text CoT explanations? If free-text is equally (un)faithful, the advantage of code reduces to ease-of-evaluation only.
- The paper studies self-explanation (model explains itself). What happens if Model A generates code to explain Model B's behavior? If a different model can explain the behavior equally well (or poorly), it suggests the code explanations are behavioral imitation rather than introspective self-knowledge.
Questions
- Have you tried having Model A explain Model B's behaviour? If cross-model explanations are equally (in)consistent, it suggests the difficulty is in program synthesis from examples, not in self-knowledge.
- The generation procedure (Algorithm 1) samples 100 candidate programs and selects the one with the highest consistency on the full dataset D. This is best-of-100 selection evaluated on the same data used for selection—there is no held-out evaluation. Doesn't the "max consistency" numbers are optimistically biased?
- What happens if you explicitly instruct the model NOT to hardcode input patterns? Does consistency drop, or do models find more general solutions?
Limitations
Yes
Paper formatting concerns
No concern
We thank the reviewer for the constructive feedback and positive assessment of our formalization, consistency metric, and motivation for studying code explanations. We agree that the paper should better clarify the scope of our claims and further evaluate the practical advantages and limitations of code explanations. We address each concern below.
Code consistency across tasks may appear expected
We agree that it may be intuitive for code explanations to succeed on algorithmic tasks while struggling on complex linguistic tasks. However, because LLMs themselves are programs that can perform complex linguistic tasks, it remains an open question whether they can also generate interpretable programs that consistently capture their behavior in the same tasks. Our empirical evaluation is therefore necessary to answer this question.
We also agree that hard-coded programs are not desirable explanations. However, our main contribution is not a superior explanation generation method, but the introduction of executable explanations as a new direction with two key advantages: compact dataset-level explanations and automatic verification. A single code explanation can explain an entire dataset, while automatic verification enables both the consistency evaluation proposed in this paper and future optimization of explanations, for example, by using consistency feedback and LLM agents to iteratively refine and improve code explanations.
We will clarify this motivation in the revised paper and better position our work as an initial step toward automatically verifiable and compact dataset-level explanations.
Motivation for dataset-level explanations
We agree that consistency, or whether an explanation accurately reflects the model’s internal computation, is the primary requirement for useful explanations, whether instance-level or dataset-level. However, prior work has shown that evaluating whether an explanation reflects a model’s computation necessarily requires assessing the model’s behavior over a distribution of inputs [1], typically through input perturbations [2,3]. This motivates us to study dataset-level explanations directly, as their goal is to capture model behavior over an input distribution, which is already required to assess the explanation’s alignment with the model’s internal computations. While our paper briefly discusses the role of input distributions in evaluating instance-wise explanations, we did not clearly articulate it as the motivation for studying dataset-level explanations. We will revise the paper to make this motivation more explicit.
Comparison with free-text explanations
New experiments: Following your suggestion, we directly compare the faithfulness of code and CoT explanations to the underlying computation in the model. To quantify CoT faithfulness, we use self-consistency sufficiency (SCSuff) [1], which measures whether an explanation sufficiently captures a model’s behavior by having the model generate alternative inputs consistent with the explanation and comparing the resulting output distribution with the original one. To enable direct comparison, we construct the code explanation’s output distribution by assigning 99% probability to its predicted answer and replace the fuzzy-matching score in Eq. (4) with the expected KL divergence used in SCSuff. This allows us to preserve automatic verification for code. Additionally, we quantify the compactness of each explanation type by comparing the token and character counts of the best code explanation with the corresponding aggregate token and character counts of the collection of chains of thought, similar to Section 5.2.
We evaluate four tasks spanning different complexity levels. Table 1 shows that, on average, code explanations are 70x more compact than free-text explanations when explaining dataset-level behaviors. However, neither code nor free-text explanations consistently outperform the other in sufficiency. As we discussed above, however, our goal is not to replace free-text explanations, but to introduce code explanations as a new explanation direction with unique advantages in compactness and automatic verification. These results suggest that there is substantial room for improving code explanation while preserving its compactness advantage.
We agree that this comparison is important and will include it as a main experiment in the revised paper.
Table 1: Code vs. Free-text explanations
Evaluate consistency on held-out split
We agree with the reviewer that selecting the best code explanation and evaluating it on the same dataset could inflate the reported consistency. To verify whether this affects our conclusions, we repeat the program selection and evaluation using a held-out split. Specifically, we split each dataset in half, select the most consistent code explanation using the first half, and evaluate its consistency on the second half. Table 1 compares the held-out consistency compared with the originally reported consistency.
The held-out consistency results in only modest changes, ranging from -0.14 to 0.04. In addition, 15 of the 24 model-task settings select the same code explanation originally selected in the paper. Importantly, all of our main conclusions remain unchanged, including the overall level of code consistency, the relationship between task complexity and explanation consistency, and the decrease in the compactness of the selected program as task complexity increases.
Although the held-out evaluation does not change our conclusions, we agree that it provides a more accurate estimate of code consistency. We will update Algorithm 1 and recompute all experimental results using this held-out selection and evaluation procedure.
Table 2: Held-out consistency
Cross-model explanations
Although our framework is motivated by LLM self-explanations, it also applies to post-hoc explanations generated by another model. Following the reviewer’s suggestion, we perform cross-model explanation experiments using Gemma and Qwen to explain each other (Table 3). Cross-model explanations achieve similar consistency to self-explanations, with the largest difference being 0.06. These results suggest that automatic consistency evaluation enables selecting post-hoc explanations that are most consistent with a model’s behavior without requiring privileged access to the model’s internal computation.
We will include this experiment in the revised paper and clarify that our framework is applicable to both self-explanations and post-hoc/cross-model explanations.
Table 3: Consistency with cross-model explanations
Instruct model not to hard code
Following the reviewer’s suggestion, we add the instruction: "Infer the underlying algorithm rather than memorizing or hardcoding the examples. Your solution should generalize to unseen inputs." We evaluate this prompt across the four complex tasks (Table 4). The added instruction does not systematically improve consistency. The largest gain (+0.14 on Gemma-Translation Error) comes from additional phrase-level mappings rather than a more general algorithm, suggesting that prompt engineering alone is insufficient to reduce hard-coding. Further work is needed to optimize code consistency and reduce hard-coding in code explanations on complex tasks.
Table 4: Instruct model not to hard code
References
[1] https://arxiv.org/abs/2606.28615
[2] https://dl.acm.org/doi/10.5555/3666122.3669397
[3] https://arxiv.org/abs/2505.05410
Once again, we thank the reviewer for their constructive feedback and believe these additional analyses clarify the strengths and limitations of code explanations and strengthen the paper as an initial step towards automatically verifiable and compact dataset-level explanations.