arXiv:2610.30630cs.LGOct 2026

Manuscript Offprint

arXiv:2610.30630

Interpreting Model Reasoning through Behavioral Counterfactuals

Shawn Im, James Oldfield, Adel Bibi, Sharon Li

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Faithfully understanding the internal process that occurs as models form their chain of thought is an important problem with the rise in model capabilities. However, this remains challenging due to the variance in sampled responses, making it difficult to isolate the effects of interventions and compare model reasoning systematically. We propose a method for localizing and analyzing how a given intervention affects the model's reasoning through behavioral counterfactuals: given a fixed response, how does introducing an intervention to the prompt change the next-token distributions? We train a module to edit the residual stream such that it minimizes the KL divergence between the output distributions for a fixed response under a source prompt and its counterfactual target prompt. We find that matching the output distributions recovers the counterfactual behavior more effectively than standard activation reconstruction objectives and validate that attribution of the trained module outputs is effective for identifying causally important locations for counterfactual recovery. The attribution maps and visualizations of the downstream effects of model edits provide an interface for generating hypotheses about the original model's computation, which can then be tested with activation patching. In a case study on Gemma-4-E4B-it and DeepSeek-R1-0528-Qwen3-8B, we investigate how a suggestion influences model reasoning even when it is not verbally acknowledged. Our analysis identifies representations at the question statement and filler tokens that mediate a substantial part of the suggestion's influence, with downstream effects such as changing the framing of the justification or even the final answer.

1 INTRODUCTION

With the rise in model capabilities and the risks that come with it, understanding how language models reason is a crucial problem to solve. However, recent works have shown that the generated chain-of-thought may become less monitorable and can be unreliable for understanding the decision making and behavior of these models (Chen et al., 2025; Baherwani et al., 2026; Brauer et al., 2026; OpenAI, 2026). As a result, an increasingly important question is how do we develop a better understanding of the internal computations driving model reasoning.

A central challenge for interpreting model reasoning is connecting internal computation to changes in behavior across long, open-ended responses. Even for the same prompt, sampled responses can vary substantially in wording and reasoning structure, making it difficult to compare their activations, identify downstream effects, and extract consistent patterns across examples. Recent work has approached this problem by organizing analysis around reasoning behaviors such as backtracking and uncertainty (Venhoff et al., 2025) or by identifying influential sentences and their effects on subsequent reasoning (Bogdan et al., 2025). While these approaches provide ways to study structure within and across reasoning traces, an intervention, such as a suggestion added to the prompt, may affect the model computation in ways that are not captured by predefined reasoning behaviors or sentence-level descriptions. We therefore aim to develop a method to isolate the effect of a given intervention on model computation throughout the response and identify key locations through which that effect is mediated and understand their role in downstream behavior.

*Email: shawnim@cs.wisc.edu

Code is available at https://github.com/shawn-im/behavioral-counterfactuals

Figure

Figure 1: We extract causal structures for a given text intervention by (1) Passing a control prompt and a modified intervention prompt through a language model with a fixed response. (2) Training an interface edit module that edits the residual stream at a given layer of the model to minimize the KL divergence between the edited output distribution of one instance and the output distribution of the counterfactual. (3) We then extract attribution maps and perform edit-level ablations used for generating hypotheses about the original model, which we test with activation patching.

Towards this, we approach analyzing model reasoning through behavioral counterfactuals: how would the model's next-token distributions change under an intervention while holding the generated response fixed? The approach is illustrated in Figure 1. For example, if we want to understand how a change in the system prompt affects a model, we can evaluate a fixed response under the two prompts, comparing their next-token distributions at each response position. Holding the response prefix fixed isolates the effect of the prompt change on these conditional distributions, allowing us to examine shifts that may not be apparent from sampled text.

While the counterfactual setup isolates the change due to the intervention, understanding how internal computation produces these changes remains difficult. Building on end-to-end training objectives such as Braun et al. (2024), we train an edit module that modifies the residual stream at an intermediate layer across the source prompt and response to match the counterfactual next-token distributions over the fixed response. This provides dense behavioral supervision without requiring tokenwise alignment between source and target prompt activations, allowing the edit module to handle natural interventions such as insertions, deletions, or paraphrases. The module provides an interface through which we can attribute distributional recovery to individual per-token edits, which we call edit events, and ablate selected edits to examine their downstream effects. Analysis based on the edit events can then be used to generate hypotheses about the original model's representations, which we then test through activation patching.

We apply this framework to Gemma-4-E4B-it (Team, 2026) and DeepSeek-R1-0528-Qwen3-8B (DeepSeek-AI, 2025) in a setting where the user provides a suggestion that the author is in the wrong for a given complex ethical situation. Our analysis identifies that surprisingly, a substantial fraction of the intervention's influence is mediated by the representations at the question statement and filler tokens such as whitespace and punctuation rather than at tokens with semantic content more relevant to the verbalized reasoning. Analyzing the downstream effects of the question and filler token representations, we find that they can significantly change the model's framing of situations and its final answer. Our results demonstrate that analyzing the activations using this counterfactual setup can reveal the effects of interventions that are not directly verbalized and otherwise could be difficult to detect.