acceptodds
Under review as a conference paper at ICLR 2027

Task Context Shapes Component Roles in Language Models

Abstract

Large language models reuse the same attention heads across tasks, but identifying these shared heads does not explain what they do differently in each task. A natural source of inspiration is task-dependent interactions among shared brain regions, which motivate a network view of language-model computation. Here, we compare fixed model components across tasks using identical graph facts, statements specifying which directed connections are present. We measure how interventions affect attention heads and the activation state in later layers (influence), as well as the answer (importance). Task changes redistribute the influence in five open-weight models spanning four families and 1.5–14 billion parameters. In Gemma-2-9B and Qwen3-14B, an activation edit changes an early internal activation vector and switches which fact the model reads while the written instruction stays fixed. The same heads then respond to different graph facts and influence later components differently. For each prompt, we construct two linear response maps, one before the edit and one after it. Each map predicts a later head’s response from a measured change in an earlier head. For a separate factual intervention, the map for the corresponding condition reduces mean squared prediction error by 53.6% in Gemma and 5.0% in Qwen compared with the average of the two maps. These findings show that task context changes both which graph facts the shared components respond to and how their outputs affect later computation. A network account may help explain how models use shared parameters to perform different computations. Measurements of task-dependent influence could also guide interventions intended to alter one behavior while preserving others.

Primary area:
interpretability and explainable AI
Keywords:
Mechanistic interpretability, Task-dependent computation, Activation interventions

Reviews

Among:
Shape:
1234this paper, Top 30%
Figure 1. Mean review rating of the reviewed papers at ICLR 2027. This paper averages 2.67 over 3 reviews, above 70% of the others.
Reviewer_8uhoOpenReview ↗
Rating
3
Confidence
3
Informativeness
2
Presentation
3
Soundness
2
Read review
Paper summary

With an inspiration from neuroscience, this study focus on how the same attention heads in a model work differently when different tasks are being processed. They use small 3-node graphs and keep the facts fixed while they change the tasks. They investigate the effect of nudging an attention head or ablating them to mean. They claim that same heads act differently under different tasks, the task can be switched from the internal states, and task states can help predicting responses.

Critical strengths
  1. The use of opposite-answer graphs makes the claims and the experiments very clear.

  2. Controls are strong (for magnitude). Multiple models have been tested. Weak results are also well reported.

Critical weaknesses

Further details of potential experiments that would address these concerns are listed in the “Questions for Authors”

  1. When the instruction changes the influence may also change regardless of the head’s role, there is no control to check if that plays a part in the results. One example could be paraphrasing conditions and noise floors for the angles reported.
  2. In the comparison of influence and importance the two profiles do not have similar size and units which makes it an unfair comparison.
  3. In the prediction test the map is fitted to the same prompts it predicts and the baseline is also weak.
  4. Copying the other instructions internal state for another task is expected to yield the same result as reading the first task. Random edits are not the best control since they do not change the behaviour and can’t rule this out.

Less importantly: 5. Natural tasks are needed to widen the setup, the current tests are too narrow. 6. The brain link is only an analogy and not further investigated.

Questions for authors
  1. How different are the influence profiles for different paraphrasings of a task?
  2. How would the results change in influence vs. importance if the sites and number of entries are the same?
  3. Have you tried new prompts for the prediction test?
  4. Would an edit that changes the behaviour but is not related to the task, like mismatched response keys, move the influence profile meaningfully?

Less importantly: 5. Could you test a non-graph task on the same wording list? 6. Have you tried other nudge sizes?

3 comments
AuthorsOpenReview ↗

Figure 2 robustness and prediction on new prompts

Comment (1/2)

We thank the reviewer for suggesting these validation and robustness checks.

1. Paraphrases and angle reliability

We reworded the task instruction line in four ways, keeping the task name fixed. With graphs and response keys matched, we compared 12 wording pairs within tasks and 12 across tasks. Each model used 16 vocabulary groups, except Falcon-1.5B, which used eight.

The first column of results gives the mean squared distance between influence profiles within and between tasks. The gap is the between-task mean minus the within-task mean, with simultaneous 95% intervals across models. The last column gives split-half median angles for the same task and wording and for different tasks, using equally sized, disjoint vocabulary halves.

ModelSquared distance ×10³, within / betweenSquared-distance gap ×10³ [95% CI]Split-half median (°), same wording / different tasks
Gemma-9B1.21 / 9.067.85 [5.49, 10.74]2.32 / 30.39
Qwen3-14B0.0976 / 0.2220.125 [0.070, 0.212]10.60 / 18.26
Llama-8B0.112 / 0.4140.303 [0.124, 0.533]22.80 / 34.44
Falcon-7B0.0221 / 0.03750.0154 [0.00714, 0.0256]2.15 / 5.25
Falcon-1.5B0.169 / 0.5040.335 [0.270, 0.597]11.46 / 23.24

By squared distance, task changes exceed rewording in every model. With the same wording pairs in both comparisons, the squared distance between profiles for different tasks was 1.7 to 7.5 times that for one task. Every gap interval is above zero. By angle, the gap was 23.55° [18.83, 27.88] in Gemma; in the other models its interval included zero. The median split-half angle between tasks exceeded the same-wording split-half angle in every model. Repeating identical inputs gave exactly the same profiles.

2. Matching the sites and the number of entries

We restricted influence to the three links among H1–H3 and importance to the mean-replacement effects at those same heads, so both profiles have three entries from the same sites. Appendix B.4 reports this comparison for the original trios, whose pointwise 95% intervals all included zero. We repeated it for all 120 eligible Figure 2C trios. The gap is the influence angle minus the importance angle. The median intervals use paired vocabulary resampling with adjustment across the four models.

ModelTrios with a positive gapMedian gap (°) [95% CI]
Gemma20/33+0.83 [−2.54, 10.05]
Qwen36/48+42.63 [11.99, 93.18]
Llama6/6+13.25 [3.80, 32.51]
Falcon-7B21/33+126.27 [3.89, 129.66]

The median gap is positive in all four models. Its interval is above zero in Qwen, Llama, and Falcon-7B, and the gap is positive in 83 of 120 trios. A uniform positive rescaling of either profile leaves its between-task angle unchanged. The residual accounts for 97.8–99.95% of the squared norm in the original four-site importance profiles.

3. Prediction on new prompts

We fit ridge maps on 32 vocabulary groups, selected their settings on 16 validation groups, and fixed them before testing on 64 new groups per model. Each prediction used the measured H2 displacement on the test prompt. As a stronger baseline, we fit and calibrated a pooled map on the same data. The task-specific maps reduced mean squared error relative to this baseline by 21.4% in Gemma and 2.8% in Qwen.

The lowest error came from the label baseline, which lets the map vary with the task label and pre-intervention H2 state. It had the same inputs and parameter count as the task-specific map. Its error was 0.00534 in Gemma and 0.09372 in Qwen, against 0.01766 and 0.10307 for the pooled map. It also outperformed the task-specific map in both models. Both context-dependent predictors improved on the pooled map on new prompts.

The revised appendix includes the head-only comparison in B.4, the paraphrase comparison in B.6, and prediction on new prompts in E.4.

AuthorsOpenReview ↗

Response key controls, counting, and perturbation size

Comment (2/2)

4. Reversing the response key

The task edit is a fixed mean-difference displacement, estimated on separate reference groups and added before layer 12. It does not copy the other instruction's state on each prompt. It switches fact-reading behavior while the written prompt stays fixed, allowing us to measure what the same heads then respond to. For the behavior-changing control, we reversed the internal A/B mapping at layer 12 while keeping the written prompt, graph, and requested fact fixed. This key edit flipped the answer on 512/512 opposite-answer prompts per model, as did the task edit, with mean margin drops matched to within 0.05 logits. The key edit used a longer span and a larger displacement than the task edit.

The key edit produced little change in the factual-response shares. Within either written key, it changed the mean share of squared head response to the alternative fact by at most 1.9 percentage points at H2 or H3. The task-minus-key differences at H2 and H3 were 79.5 and 97.2 points in Gemma and 68.1 and 92.3 in Qwen. All four simultaneous 95% intervals exclude zero.

The task edit moved the influence profile further toward the alternative-task profile. The key edit moved the six-link profile by 0.03734 in Gemma and 0.00577 in Qwen (L2 distance). On the opposite-answer prompts, the task edit reduced the squared distance to the unedited alternative-task profile by 92.4% in Gemma and 78.6% in Qwen. The key edit increased that distance to 27.7 times baseline in Gemma and reduced it by 51.5% in Qwen. The simultaneous 95% intervals for the task-minus-key difference were above zero in both models.

5. Counting with the same vocabulary

The counting task used the same names, presence terms, and A/B keys, and asked whether at least two of three listed items were present. Its paired control supplied the result while keeping the list, key, and required answer fixed. In Qwen, replacing each original head individually with its graph-calibrated mean left counting accuracy at 100% on 512 held-out pairs. The nudge effect on the True-minus-False logit gap was 0.1163 logits larger when the corresponding item could change the counting answer. The same split in the control gave 0.0148 logits (paired difference 0.1015, exploratory 95% CI [0.0784, 0.1237]).

6. Other nudge sizes

The Figure 2 test was repeated at 0.5, 1, 2, and 4 reference SD using the original prompts and sites. The task contrast is the difference between the two task influence profiles. The table gives its cosine with the 2 SD contrast from the same run. Each cell lists the results at 0.5, 1, and 4 SD, in that order.

ModelCosine to 2 SD
Gemma-9B0.999 / 1.000 / 1.000
Qwen3-14B0.815 / 0.903 / 0.971
Llama-8B−0.401 / 0.416 / 0.249
Falcon-7B0.463 / 0.899 / 0.962
Falcon-1.5B0.889 / 0.879 / 0.997

Bold cosines have simultaneous 95% intervals above zero. In Gemma, Qwen, and both Falcon models, the point-estimate cosines at 1 and 4 SD ranged from 0.879 to 1.000. All 432 repeated blocks gave identical profiles.

The link to brain networks. Brain networks motivate the network view and the choice of measurements. Our empirical conclusions concern the language models tested here.

The revised Figure 4 results include the key-edit control, with details in Appendix D.5. Appendices H and B.7 describe the counting and nudge-size tests.

Thank you for running the requested analyses. The response-key control in particular is convincing for the factual-response shares.

  1. Prediction (E.4, Table S12). On new prompts, the transferred response map (the method described in Section 2.5) has higher error than a pooled map that ignores the task (0.0269 vs. 0.0177 in Gemma), and the label baseline is best in both models. The 21.4% / 2.8% figures come from ridge maps fitted directly to the factual interventions, not from the influence maps. The abstract and Section 3.4 still report only the within-prompt 53.6% / 5.0%.
  2. Influence vs. importance (B.4, Table S1). With matched sites the gap disappears in Gemma, and only 83/120 trios are positive. The main text cites the 749/749 result, which uses the unmatched profiles where the residual site makes up ~98–99.95% of importance.
  3. Paraphrases (B.6). By angle, task changes exceed rewording only in Gemma, which matters for the "redistribution" claim.
  4. Key edit and influence (Table S8). In Gemma the key edit moves the influence profile about 6× more than the task edit, and in Qwen it covers about half the distance to the target. Only the factual-share result appears in the main text.

The new experiments strengthen the factual-response findings, but they also show that the influence and prediction claims are weaker than currently stated, so I'm not increasing my score. For the paper to be sound as presented, the abstract, Figure 2C/Section 3.1, and Section 3.4 should be updated to reflect these results rather than leaving them only in the appendix.

Reviewer_JHWVOpenReview ↗
Rating
2
Confidence
3
Informativeness
2
Presentation
2
Soundness
2
Read review
Paper summary

This paper studies whether the same attention heads play different roles across tasks. It uses a controlled graph setting in which the facts stay fixed while the instruction asks either about a two-edge path or a direct edge. Across five open-weight models, the authors perturb selected heads and find that their effects on later components change with the task. In Gemma-2-9B and Qwen3-14B, an early activation edit changes which fact the model answers about while the written instruction remains fixed, the selected heads’ factual responses and downstream effects shift as well. A response map matched to the current task state predicts a later head’s response better than an average of the two task-state maps, though the gain differs substantially between models. The experiments support task-dependent influence in this controlled setting, while leaving the specific mechanism of interaction unresolved.

Critical strengths
  1. The experimental design is careful and fairly thorough. The authors compare tasks on the same graph facts, use paired prompts and intervention controls, and repeat the main influence analysis across five models. This makes the reported task-dependent changes more convincing.
  2. The measurements and intervention procedures are clearly defined mathematically. This gives the empirical results a solid basis.
Critical weaknesses
  1. I am not convinced that the paper shows the selected heads changing their function. The heads are partly selected for distinguishing True from False and affecting the answer, so they could be general answer-related heads. A change in measured influence could also come from a fixed-function head being read differently by the rest of the network. The experiments do not identify what information passes between the heads or the path it takes, and restoring H2 or H3 accounts for only a small part of the task-switch effect. This limits the mechanistic conclusion.

  2. It is unclear how far the result extends beyond this toy graph setting. The paper does not test what happens when these heads are removed in unrelated tasks, and its response maps are estimated and tested on different interventions of the same prompt. Some results, such as a weaker effect after restoring later activations, also seem expected. Without broader tests, I find it hard to judge whether the measured changes provide a useful insight into model behavior beyond this setup.

Questions for authors
  1. You selected these heads partly because they distinguish True from False and affect the answer. How do we know they are doing something specific to the graph task, rather than just helping produce the final answer? Did you test what happens when you remove them/steer them on unrelated tasks?

  2. I’m still not sure what changes about the heads themselves across tasks. Could they be doing the same thing in both cases, while later layers use their outputs differently? Is there a result that separates these explanations? The small effects from restoring H2 or H3 make me unsure how much of the task switch these heads explain.

  3. What would you use these measurements for in practice? The paper suggests they might help change one behavior while preserving others, but is there any result here showing that they can actually guide such an intervention?

  4. How were H1–H3 chosen in Falcon-H1-1.5B? Appendix B.1 gives a selection procedure for the other four models, but this model is the main example in Figure 2A. Were its heads selected before examining the task-dependent influence results?

2 comments
AuthorsOpenReview ↗

Factual responses, downstream restoration, and prediction on new prompts

We thank the reviewer for the questions.

1. Factual responses and the answer token

Our claim concerns how shared heads respond to facts across tasks. To control for the answer token, we reversed the internal A/B mapping at layer 12 while keeping the graph and requested fact fixed. This edit and the Figure 4 task edit both flipped the predicted token on all 512 opposite-answer prompts per model, with similar drops in the original-answer margin.

The key edit had about three times the displacement norm of the task edit. Within either written key, it changed the mean share of squared head response to the alternative fact by at most 1.9 percentage points at H2 or H3. The task-minus-key differences at H2 and H3 were 79.5 and 97.2 points in Gemma and 68.1 and 92.3 in Qwen. All four simultaneous 95% intervals exclude zero. The key edit produced little change in these factual-response shares.

We also replaced and perturbed the outputs of the same three Qwen heads in a counting task asking whether at least two of three listed items were present. A paired control supplied the result with the same list, key, and answer. Replacing each head with its graph-calibrated mean left counting accuracy at 100% on 512 held-out pairs. The nudge effect on the True-minus-False logit gap was 0.1163 logits larger when the corresponding item could change the counting answer. The same split in the control gave 0.0148 logits (paired difference 0.1015, exploratory 95% CI [0.0784, 0.1237]).

2. The heads' outputs change, and later use also changes in Qwen

Table S6 reports the change in the heads' absolute factual responses. Under the written Read fact 1 instruction, the task edit increased the squared response to Fact 2 and reduced the response to Fact 1 at both H2 and H3 in both models. The shift is present at the head outputs before they are read by later layers.

For the fixed-H2 test, the early edit changed the receiving context while the written prompt, full H2 output at the final input token, and signed factual perturbations stayed fixed. All 512 same-answer prompts per model kept the correct answer. H3's normalized signed selectivity for Fact 1 over Fact 2 was higher in the Fact 1 context by 0.082 [0.034, 0.128] in Qwen. In Gemma, the contrast was −0.002 [−0.031, 0.024] (simultaneous 95% intervals). In Qwen, the same imposed H2 output had different effects at H3 across receiving contexts.

Restoring the attention band recovers most of the answer shift. With the early edit active, we restored unedited final-token outputs at H2, H3, or both on 64 new vocabulary groups per model. We also restored the attention outputs in layers 23–32 of Gemma and 22–30 of Qwen. The table gives the percentage of the edit-induced margin shift recovered before control subtraction.

ModelH2H3H2 + H3Attention band
Gemma1.41%1.53%2.94%84.20%
Qwen0.83%1.31%2.15%97.20%

With matched early-edit and restoration controls subtracted, the band recovered 14.863 [14.815, 14.909] logits in Gemma and 46.698 [46.497, 46.889] in Qwen. Adding H2 to H3 increased recovery by 0.202 [0.198, 0.207] logits in Gemma and 0.285 [0.266, 0.303] in Qwen (simultaneous 95% intervals). The band restored the original answer on 2,048/2,048 opposite-answer prompts per model, compared with 0/2,048 for H2 and H3 together. Figure 4B also shows positive median factual reassignment in all three post-edit depth bands of both models. Figure 3B separately shows a reduction in task selectivity beyond matched restoration controls for all three facts in both models.

3. Prediction on new prompts and practical use

We fit ridge maps on 32 vocabulary groups, selected settings on 16 validation groups, and fixed the maps before testing on 64 new groups per model. Each prediction used the measured H2 displacement. The task-specific maps reduced mean squared error by 21.4% in Gemma and 2.8% in Qwen relative to a fitted, calibrated pooled map. A label baseline with the same inputs and parameter count had lower error in both models. The demonstrated use is predicting H3's response to an H2 perturbation on a new prompt. Selective behavior editing remains a proposed application.

4. Falcon-H1-1.5B head selection

An earlier answer-related screen supplied H40.04 and H48.04 as H2 and H3. We selected H26.00 as H1 from 12 candidates for its added contribution to the Read direct edge answer. Development also included a task-dependent influence test of this trio on same-answer prompts. The trio was fixed before we collected the 64 opposite-answer measurements shown in Figure 2A. The Figure 2C result held across all 120 eligible trios in the other four models (see our reply to DaZF).

The response-key, restoration, and fixed-H2 controls are in Appendices D.5–D.7. Appendix E.4 reports prediction on new prompts, H gives the counting comparison, and B.1 explains the Falcon head selection.

Thank you for the additional experiments. They address some of my concerns, but I still have reservations about the significance of the contribution. The mechanistic analysis explains a fairly narrow phenomenon in a simple toy setting. The finding that components’ responses and downstream effects change with task context is also somehow expected, so I still see the overall contribution as incremental. The new experiments strengthen the evidence, but do not substantially change my assessment. I will therefore maintain my score.

Reviewer_DaZFOpenReview ↗
Rating
3
Confidence
2
Informativeness
2
Presentation
3
Soundness
2
Read review
Paper summary

The paper investigates how task context alters the behavior of shared attention heads when the underlying graph facts are held fixed. Across five language models, the authors measure downstream influence separately from functional importance for the final answer. In Gemma and Qwen, an internal activation edit modifies which fact the model retrieves without altering the written instruction. Under this intervention, the same heads respond to different facts and exhibit distinct downstream influence patterns. Finally, the authors show that context-specific response maps improve the prediction of downstream activation changes within the evaluated prompt.

Critical strengths
  • The controlled task comparisons represent the paper's strongest contribution. Holding graph facts constant effectively isolates how the requested computation modulates component-level behavior.
  • The internal task-edit experiment provides valuable causal evidence. The intervention consistently switches answers when tasks disagree while preserving predictions when they agree, a pattern that random edits fail to replicate. The resulting shifts in factual sensitivity among the same heads strongly support the claim that the intervention redirects information flow.
Critical weaknesses
  • Limited Scope of Key Component Analyses (Figure 2): Figure 2 relies on a single selected H1-H2-H3 trio and a single downstream residual site per model. Although the selection criteria are clearly detailed, the robustness of these findings across alternative component selections remains unclear. It is uncertain whether other task-relevant trios exhibit comparable shifts in downstream influence or maintain the same relationship between influence and importance.
  • Gap Between Factual Sensitivity and Influence Robustness: While the all-head analysis evaluates factual sensitivity across the network, it does not directly validate the structural robustness of the specific interactions showcased in Figure 2. Consequently, it remains ambiguous whether the highlighted sub-networks are truly representative of the overall architecture's behavior.
Questions for authors

Could you repeat the analysis in Figure 2 across several alternative trios that satisfy the same selection criteria? Reporting the distributions of task-dependent influence shifts and influence-versus-importance angle differences would clarify whether these dynamics consistently recur across task-relevant components or depend heavily on the specific trio selected.

1 comment
AuthorsOpenReview ↗

Figure 2C validation across alternative trios and residual sites

We thank the reviewer for suggesting that we repeat the Figure 2C comparison with other trios. Across the same four models, we tested 116 alternative trios and the four original trios. The estimated angle between tasks was larger for influence than for importance in all 749 valid trio–residual pairs. This ordering held across all eligible trios and residual sites tested in the sweep.

We followed the eligibility criteria in Appendix B.1 and tested each trio at every valid residual site downstream of H3. Each model used the original 128 opposite-answer prompts from 16 vocabulary groups. Influence was measured with the original 2 SD perturbations and importance with mean replacement. Including the residual site gave six influence links and four importance effects.

Each trio contributes a single residual site to these summaries. We kept the Figure 2C sites for the original trios. For the alternatives, we chose the valid site with the largest standardized separation between task instructions, evaluated by leaving out one reference vocabulary group at a time as in Appendix B.1.

Influence change is the L2 distance between the two task influence profiles. The angle difference is the influence angle minus the importance angle. The table gives medians with 95% confidence intervals. Influence changes are in units of 10-3. The last column gives the percentile of the original trio's angle difference among its model's trios.

ModelTrios / trio–residual pairsInfluence change [95% CI]Angle difference (°) [95% CI]Original trio percentile
Gemma-2-9B33 / 20317.8 [11.7, 30.4]30.1 [16.3, 34.9]60.6%
Qwen3-14B48 / 28814.8 [12.6, 18.5]18.4 [15.1, 32.4]50.0%
Llama-3.1-8B6 / 369.86 [4.71, 19.8]16.8 [9.87, 36.4]66.7%
Falcon-H1-7B33 / 2229.60 [8.25, 14.6]22.9 [11.9, 35.1]6.1%

The median angle difference is positive in all four models. The median angle difference ranged from 16.8° to 30.1°, and its simultaneous 95% interval excluded zero in all four models. We obtained the intervals by resampling whole vocabulary groups, keeping the task measurements paired.

The original trios are typical or conservative within this sweep. The selection rule in Appendix B.1 uses the heads' contributions to the correct-answer margin and does not use this angle difference. The original trios fall near the middle of the distribution in Gemma, Qwen, and Llama, and near the bottom in Falcon-7B. The median Falcon-7B trio has an angle difference of 22.9°, so Figure 2C is conservative for that model.

The ordering holds across residual sites. For each trio, we also calculated the largest minus the smallest angle difference across its valid residual sites. The median range was 6.47° in Gemma, 5.24° in Qwen, 1.42° in Llama, and 2.12° in Falcon-7B.

The revised Figure 2 results include this validation. Appendix B.5 and Table S2 report the median influence changes and angle differences with 95% confidence intervals and the original trios' percentiles.

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.