Manuscript Offprint
arXiv:2610.41743Task Vectors Can Be Linearly Decomposed into Interpretable and Controllable Components
Abstract
Task Vectors (TVs) provide a compact way to steer large language models, but they are typically treated as atomized directions merely extracted from hidden states, leaving their internal functional structure poorly understood. Motivated by prior work that decomposes in-context learning into Task Recognition (TR) and Task Learning (TL), we ask whether a single TV can likewise be decomposed into functionally meaningful components. We formulate a TR/TL-based decomposition from candidate-label unembeddings, separating each TV into TR, TL, and residual components, and try to optimize the TR and TL coefficients using Bayesian optimization for more effective intervention. We evaluate this formulation across multiple model families, classification tasks, and both instruction- and demonstration-based TVs. Across these settings, TR/TL-based optimization identifies intervention directions that outperform the original TVs. Although optimization over random directions can also improve performance, TR/TL-based search yields more reliable gains, particularly for instruction-based TVs. Moreover, isolated interventions on the decomposed components produce distinct logit-level effects that are consistent with their intended functional roles. Together, these results suggest that TVs are not monolithic steering directions, but can be decomposed into functionally meaningful components that support both interpretation and control.
1 Introduction
Task Vectors (TVs) provide a compact representation of task information that can be reused to steer model behavior without updating model parameters (Hendel et al., 2023). Despite their effectiveness, TVs are typically treated as merely atomized blackbox vectors extracted from hidden states, which leaves a basic question open: how is task information functionally organized within
a TV? Understanding this structure would make TVs not only more interpretable, but also effective. Existing work has composed multiple steering directions into a low-dimensional intervention space (Han et al., 2026), but still little is known about whether a single TV itself can be decomposed into functionally meaningful components.
Conceptually, task execution in LLMs, exemplified by In-context Learning (ICL), is not necessarily functionally monolithic. As shown in Fig. 1-a, prior work distinguishes Task Recognition (TR), which identifies the task and leverages pretrained knowledge, from Task Learning (TL), which learns input-label mappings from demonstrations (Pan et al., 2023). Recent mechanistic analyses further associate these functions with distinct internal computations (Yang et al., 2026b). If these functional roles contribute to the task information encoded by a TV, they may provide a meaningful basis for exposing its internal structure.
We therefore ask whether the conceptual decomposition of ICL into TR and TL can be extended to geometry decomposition of TVs: can a TV be decomposed into functionally distinct TR- and TL-related components, and can these components provide meaningful control over the TV? As illustrated in Fig. 1-b, we construct TR/TL-oriented axes from candidate-label geometry and decompose each TV into TR, TL, and residual components. We parameterize intervention directions using the TR and TL magnitudes while keeping the residual fixed, which defines a two-dimensional, functionally structured intervention space anchored by the original TV, with each point in this space represents a distinct weighted combination of the TR and TL components. Additionally, as shown in Fig. 1-c, in this space, we conduct Bayesian optimization to find TV with better performance than original TV.
We evaluate the performance of the optimized TVs across multiple models and tasks, and find that Bayesian optimized TVs within the TR/TL-based a Task Recognition & Task Learning

b Task Vector Decomposition
c Task Relevant Subspace Search
Search based on TR & TL efficiently identifies high performing TVs
Figure 1: Overview of our approach. (a) TR and TL capture complementary aspects of in-context learning. In a narrow sense, TR processing finds the label candidates like “Positive” and “Negative”, and TL find which label should be output in the candidates. (b) We decompose a TV into TR, TL, and residual components. (c) Optimizing the TR/TL coefficients improves task performance.
space largely outperform the original TVs across a broad range of settings. At the same time, optimization over random directions can occasionally yield substantial improvements, showing that high-performing directions are not unique to the TR/TL directions. But TR/TL-based optimization tends to yield larger and more reliable gains, suggesting that the decomposition provides useful functional structure for guiding the search rather than uniquely determining an optimal direction. These results suggest that conceptual decomposition of ICL mechanisms can provide an interpretable geometry basis for analyzing and controlling TVs.
Our contributions are threefold. First, we formulate a decomposition of a single TV into TR, TL, and residual components, linking its structure to the roles of TR and TL with supporting empirical analysis. Second, we show that this decomposition provides an interpretable parameterization for controlling the TV, in which optimizing the TR and TL coefficients improves task performance across multiple models and tasks. Third, we draw on these findings to offer theoretical insights into how TR and TL jointly contribute to task execution.
shifted toward understanding and improving these representations. Yang et al. (2025) connected TV behavior to hidden state geometry and attention head mechanisms, and Yang et al. (2026a) showed that TVs learned from scratch can outperform standards extracted ones. Together, these studies suggest that task information in activation space is structured and manipulable, while how different aspects of this information are organized within a TV remains only partially understood.
Mechanisms of ICL. Prior work has shown that ICL can rely on both pretrained task knowledge and input-label mappings learned from demonstrations. Min et al. (2022) found that models can often retain substantial ICL performance even when demonstration labels are falsified, highlighting the importance of task-level information beyond the input-label mapping itself. Wei et al. (2023) further showed that larger models can learn novel input-label mappings from context even when they conflict with pretrained semantic priors. As shown in Fig. 1-a, Pan et al. (2023) characterized ICL through two complementary abilities: TR, which identifies the task and leverages pretrained knowledge, and TL, which learns new input label mappings from demonstrations. In a narrow sense of classification tasks, TR determines the set of label candidates as a task representation, and TL select one label in the candidates as the defined mapping from the task. Wang et al. (2025) further studied their development during pretraining and found that TR and TL can compete with each other. Yang et al. (2026b) localized TR and TL to distinct attention heads and showed that they play complementary roles in shaping hidden state geometry. These studies suggest functionally distinct ICL process reflected in model computation.
Bayesian Optimization for Hidden State Interventions. Bayesian Optimization (BO) has been used to tune different aspects of inference time interventions without gradient based model updates. Gao et al. (2025) use BO to select layers and intervention parameters for activation based jailbreak defense, while Siddique et al. (2026) use it to identify effective data configurations for constructing steering vectors. More directly, Steer2Adapt (Han et al., 2026) constructs a low dimensional semantic subspace from multiple steering vectors and use BO to optimize their composition coefficients. BOREFT (Agarwal et al., 2026) further learns a low dimensional space of hidden state interventions and uses it as the search domain for BO. These studies use BO to optimize internal interventions, while the structure and interpretation of the search space remain central design choices.
3 Methodology
Problem Setup. We consider classification tasks, where each task has candidate labels and each instance consists of an input and label . Given a frozen language model, task information is provided through either an instruction or labeled demonstrations together with the query. For example, in sentiment classification, an instruction may explicitly ask the model to classify the query as positive or negative, whereas the demonstration setting provides only labeled examples, such as “A delightful film.” positive, without an explicit task instruction. The baseline without any task information provided is query-only prompt, which contains the same query but no instruction or demonstrations, and A TV captures the hidden-state change between the task-conditioned and query-only prompts at Transformer layer . Our goal is to decompose this TV into functionally distinct components and use them to obtain more effective intervention directions then the original TVs.
Overview. Our methodology has three steps. First, we extract the original TV from the hidden-state difference between task-conditioned and query-only prompts (Sec. 3.1). Second, we derive TR/TL-oriented directions from candidate-label unembedding geometry and decompose the TV into TR, TL, and residual components (Sec. 3.2). Third, we optimize the TR and TL magnitudes while retaining the residual, using Bayesian optimization to identify higher-performing directions within the resulting structured intervention space (Sec. 3.3).
3.1 TV Extraction
We first extract the original TV that serves as the starting point for decomposition and optimization. Adapting prior TV extraction methods (Hendel et al., 2023; Yang et al., 2026a), we compare task-conditioned and query-only hidden states for the same query. For task , let indicate whether the task information is provided by an instruction or labeled demonstrations. Given queries used for TV extraction, let denote the -th query. For each , we compare the task-conditioned prompt with the corresponding query-only prompt containing the same query, and define the query-wise TV at layer as
where and denote the final-token hidden states of the task-conditioned and query-only prompts (where the task information is not provided), respectively. Then, we obtain the TV by averaging over the queries:
This TV captures the average hidden-state change induced by task-related context on a same set of the query.
3.2 TR/TL-Based Decomposition
A TV provides a single direction that summarizes the representation change induced by task-related context, but does not reveal how different functions are organized within TV. We therefore decompose the TV into TR, TL, and residual components, so that the contributions associated with TR and TL can be analyzed and controlled separately.
TR/TL-Inspired Label Geometry. Prior work distinguishes TR, which identifies the task and its candidate-label space, from TL, which captures the input-label mapping needed to select among candidate labels. We use this functional distinction as the basis of our decomposition. Rather than prespecifying task-specific semantic concepts that may help solve a downstream task, we derive the decomposition directly from the candidate-label structure of each task. Specifically, we represent TR by the structure shared across candidate-label unembedding directions and TL by the contrast between the correct label and the remaining candidate labels. These directions are intended as task-general, TR/TL-oriented operationalizations rather than complete descriptions of the underlying TR and TL mechanisms.
Let contain the rows of the model's output projection (unembedding) matrix corresponding to the candidate labels of task , where is the hidden-state dimension. We first define the TR/TL directions from the . The TR direction assigns the same coefficient to all candidate labels, whereas the TL direction contrasts a target label with the other candidates:
where is the all-ones vector and is the one-hot vector for label y. We then map these label-space directions into the hidden-state space through the candidate-label unembedding vectors:
(4)
These directions are defined by the task's candidate labels, not by the query text. For multiclass tasks, we average the projected TL components in Eq. 8 to obtain a shared component that remains fixed during subsequent interventions. These directions have the same dimensionality as TVs at every Transformer layer. We next specify the projection geometry used to decompose layer-specific TVs along these output-derived directions.
Metric-Aware Projection. Because subsequent layers can transform the intervention before it reaches the output, we use the direct candidate-label unembeddings as a shared proxy for defining the projection geometry. However, the unembedding matrix is located on the last layer of Transformer model, whereas a TV may be extracted at any Transformer layer, which causes potential distributional misalignment. We therefore need to map the last-layer TR/TL directions to intermediate-layer, to achieve effective decomposition and controlling to TVs from any layer. Specifically, we weight projection errors according to their local effect on the candidate-label distribution.
To construct this layer-specific geometry, we define a reference distribution by applying the candidate-label unembedding to the original TV:
We then define the hidden-state metric
This metric weights projection errors by their local effect on the reference candidate-label distribution. It provides an output-informed geometry for decomposing intermediate-layer TVs without explicitly modeling the subsequent Transformer layers. For final-layer TVs, we use Euclidean projection, . The derivation is provided in Appendix A.
For binary tasks, we project onto the TR and TL directions jointly using regularized least squares (Appendix B). For multiclass tasks, we project the mean TV onto TR and each query-wise TV onto TL. Omitting the indices c, t, l, these projections are
(7)
where is the ground-truth label of query i. We average the query-wise TL components:
For both binary and multiclass tasks, the residual is .
3.3 TV Optimization
The decomposition above separates the original TV into functionally motivated components, but does not show whether these components provide useful control over task behavior. We therefore search for combinations of TR and TL coefficients that improve task performance, with the residual coefficient fixed at one.
We parameterize the candidate intervention vector using the TR and TL coefficients while retaining the residual component:
Retaining the residual preserves the part of the original TV not assigned to the TR and TL components and guarantees .
To separate directional changes from magnitude changes, we normalize the candidate intervention vector before intervention. For an optimization query , the vector added to the hidden state is:
(10) where is a fixed global scaling coefficient. The effective intervention magnitude is therefore normalized according to the target hidden-state norm. We optimize only using Gaussian-process Bayesian optimization with accuracy on as the objective, independently for each layer.
4 Experiments
We evaluate whether the proposed decomposition supports both effective control and functional interpretation of TVs. Our experiments examine accuracy improvements from coefficient optimization, the output-level effects of the individual components, and the effectiveness of TR/TL-based search relative to random alternatives.
Models and Datasets. To evaluate the effectiveness of our proposed method, we applied it to Llama 3.2 1B (Meta AI, 2024), Llama 3.1 8B (Llama Team, 2024), Qwen 3.5 2B Base, Qwen 3.5 2B, and Qwen 3.5 9B (Qwen Team, 2026) on four classification datasets: SST-2 (Socher et al., 2013), SUBJ (Pang and Lee, 2004), Financial PhraseBank (FP) (Malo et al., 2014), and AG News (Zhang et al., 2015). These tasks contain 2, 2, 3, and 4 candidate labels, respectively.
TV Construction and Intervention. For demonstrations, we used four examples per label. TVs were averaged over 256 construction queries. During inference, we intervened on the final-token hidden state using Eq. 10, i.e., add the to the final-token hidden state of a specific layer , with the intervention strength fixed to .
Direction Optimization. We used Gaussian-process Bayesian optimization over , with 12 initial evaluations followed by 30 optimization iterations. Further implementation details are provided in Appendix C.
Baselines. We compared TR/TL-based optimization that decomposes the original TV along sampled directions and optimizes their coefficients while retaining the residual, with two random controls: original TV and Random. The original TV, corresponding to , served as the primary baseline. Random uses Gaussian directions, whereas Random restricts them to the orthogonal complement of the original TR/TL subspace. Both controls used the same coefficient range, BO budget, and intervention normalization as our method, with five seeds for direction sampling. Construction details are provided in Appendix D.
Evaluation. Demonstrations, TV construction queries, and evaluation queries did not overlap. For independent evaluation, we selected the layer and coefficients maximizing optimized accuracy on the dataset used for optimization and fixed them before testing on 500 disjoint examples per task. We evaluated the original TV at the same selected layer; details are provided in Appendix E.
4.1 TR/TL-Based Optimization Improves TV Accuracy
We first evaluate whether optimizing the TR and TL coefficients improves the original TV across models, tasks, and TV construction conditions. Fig. 2 compares the optimized and original TVs at each Transformer layer. Improvements appear for both instruction- and demonstration-based TVs and across multiple model families and tasks, with gains ranging from modest increases to substantial improvements in some settings.
Improvements are concentrated in the middle and later layers, with little or no gain in early layers. This is aligned with prior analyses, which show weaker alignment between states and label unembedding directions in early layers (Yang et al., 2025), and also suggest that even TR or TL directions are explicitly specified and could propagate as effective control components at the output layer, the absence of available task vectors at these layers prevents good initialization for the optimization.
The layer-wise results above are measured on the optimization set. We also evaluated the selected configurations on independent examples to examine whether the improvements persist beyond the data used for optimization. For Llama 3.2 1B and Llama 3.1 8B, optimized TVs largely outperform the original TVs at the selected layers across all four tasks and both TV construction conditions. Full results are provided in Appendix E.
4.2 TR/TL Decomposition Captures Distinct Functional Roles
The preceding results establish that optimizing the component coefficients improves task performance. We next examine whether the components affect model outputs in ways consistent with their intended roles. The TR component is intended to increase preference for all the candidate labels over other vocabulary tokens while largely preserving

Figure 2: Accuracy gain over the original TV on the optimization set across Transformer layers. Each cell shows the change in accuracy (percentage points) after TR/TL-based optimization; red and blue indicate improvement and degradation, respectively. All Transformer layers are shown.

Figure 3: Effects of isolated TR and TL component interventions on the TR- and TL-related logit metrics.
their relative preference. The TL component is intended to change the preference for the correct label over the other candidates. We tested these expected roles through isolated component interventions on binary classification SST-2 and SUBJ.
For each task and TV construction condition, we selected the layer at which the original TV achieves the highest accuracy and intervene on the query-only hidden state using either or alone. For component , where , we apply
with . Let denote the candidate-label set, the correct label, the incorrect label, and the vocabulary logits. We then measure two complementary logit-level effects:
which measures how strongly the model favors the candidate labels over the rest of the vocabulary, and
which measures the preference for the correct label over the incorrect one. For each metric, we report the change from the no-intervention condition, .
Fig. 3 shows agreement between the intended roles and the observed responses across both tasks and TV construction conditions. TR interventions substantially change candidate-label preference (top row, blue) while leaving label discrimination nearly unchanged (bottom row, blue). TL interventions consistently change label discrimination with intervention strength (bottom row, orange). These responses provide empirical support for the functional interpretation of the decompo-

Figure 4: Accuracy gains over the original TV using TR/TL and random search axes.
sition: the label-common and label-contrast constructions yield components with the corresponding output-level effects in the model.
The correspondence also has limits. Candidate-label preference responds non-monotonically to TR intervention in some settings (e.g., SST-2), so increasing intervention strength does not uniformly strengthen the intended effect. This is why we use Bayesian optimization for a moderate intervention rather than simply increasing it. TL interventions also change candidate-label preference, which is compatible with their intended role because the label-set metric aggregates the candidate logits. Together, these results show that the decomposition captures the intended functional distinction, while its control over model outputs is not uniformly monotonic across the intervention magnitude, echoing our design of Bayesian optimization.
4.3 TR/TL Axes Provide a More Reliable Search Space Than Random Axes
The preceding results show that the TR/TL decomposition supports performance improvement and distinct output-level effects. As a brief ablation experiment, we next test whether its choice of directions leads to larger gains than decomposing the same original TV along random directions. All methods retain their corresponding decomposition residual and recover the original TV at . For each model-task pair and TV construction condition, we first select the layer at which the original TV achieves its highest accuracy, without using any post-optimization performance for layer selection. At this fixed layer, we computed the accuracy gain of each method relative to the original TV. For each random control, we averaged the gain over five independently sampled vector configurations. Since the random directions may accidentally contain components aligned with the TR/TL subspace, to control for this possibility, Random samples random directions from the
| Component | With gains | Without gains |
| Random 1 | positive, negative, neutral, ... | quo, ince, feit, keit, croft |
| Random 2 | neutral, positive, negative, ... | anon, σ, paha, uese, adget |
Table 1: Top-scoring tokens for random components in representative runs.
orthogonal complement of the subspace spanned by the identified TR and TL directions. All search methods are compared at the same layer selected using the original TV.
In the results shown in Fig. 4, random search axes can also improve the original TV, indicating that performance-improving directions are not unique to the TR/TL decomposition. However, TR/TL-based search yields clearly larger gains for instruction-based TVs, while the difference is smaller for demonstration-based TVs. Notably, for demonstration-based TVs, unconstrained random directions yield larger gains than Random. This pattern is consistent with the possibility that part of the improvement from random search arises when randomly sampled directions overlap with the TR/TL subspace. Overall, arbitrary low-dimensional search can uncover better TVs, but the TR/TL decomposition provides a more effective and functionally structured search space, particularly for instruction-based TVs.
Qualitative Analysis: Why Can Random Directions Improve Performance? Random directions can also improve accuracy, although they are not constructed from candidate-label geometry. We inspected representative improving and non-improving directions to explore their relation to the candidate labels. We applied the curvature term of the label-based metric to each random component and then mapped the resulting vector to token scores using the full-vocabulary unembedding matrix; details are provided in Appendix A. Under this readout, the improving example ranks task-related tokens, including candidate labels, among the top-scoring tokens, whereas the non-improving example shows less task-specific structure (Table 1). These examples illustrate differences under a label-based readout, reflecting the definition of TR, while the detailed mechanisms behind their accuracy gains remain unclear.

Figure 5: Accuracy gains over original TV on JF-ICR.
4.4 When Does Direction Search Fail?
The preceding experiments show improvements on standard classification benchmarks. To examine the same optimization in a more challenging setting, we evaluate Llama 3.2 1B and Llama 3.1 8B on JF-ICR (Peng et al., 2026). This task requires recognizing implicit commitments and refusals in financial responses written in Japanese, a language not officially supported by either model.
Fig. 5 shows contrasting outcomes across the two models. For Llama 3.2 1B, TR/TL-based optimization improves accuracy in later layers under both construction conditions. Llama 3.1 8B shows little or no gain across the tested layers.
These mixed outcomes highlight a limitation: under the tested search settings, optimizing the TR and TL coefficients does not consistently yield better intervention directions across models in this challenging setting. Similar to early layers, the model may fail to produce a reliable task vector, leaving no good starting point for optimization.
5 Discussion
Functional dependence between TR and TL. Fig. 3 shows that the extracted TR and TL components have distinct effects on model outputs. We consider whether this functional distinction also implies independence of the underlying computations. A simple example is whether TL can emerge spontaneously when TR is blocked. Prior work provides some clues: Filtering the output vocabulary to the candidate labels cannot produce a correct label preference (TL) if the label set preference (TR) is absent from the logits, as shown in an ICL experiment on SST-2 with Llama 3 8B, Cho et al. (2025) report that direct decoding is near chance in early layers and becomes highly accurate around layer 18. This raises the possibility that internal task recognition helps make input information available for task-specific label discrimination. Whether TR
helps establish the label discrimination associated with TL remains an open question.
Balancing TR and TL. The estimated accuracy surfaces against in Appendix G (Fig. 6) show high-accuracy regions with relatively small TL coefficients. We consider why reducing the contribution of a label-discriminative component may improve prediction. If the correct label already outranks the other candidates, further increasing its margin does not change the prediction within the candidate set. Instead, the remaining requirement may be to make that label outrank non-label tokens. Under a fixed intervention magnitude, shifting the relative contribution towards TR may therefore be more useful than strengthening TL further. A small TL coefficient does not mean that label discrimination is absent: it may already be available in the query hidden state or retained residual. These observations suggest that effective control depends on the balance needed by the existing representation, rather than on strengthening both components.
Conditions for additive effects. As mentioned before, TR and TL vectors are orthogonal but sometimes dependent, i.e., combining the components linearly need not produce additive effects on model outputs. A local additive approximation of output log odds is appropriate when higher-order terms in the response to the coefficients are small. Such terms may matter when task recognition changes how the input is interpreted, making the TL-related effect depend on TR. Appendix F shows such analysis, but its validity remains untested.
6 Conclusion
This paper investigates the functional structure within a single TV and its use for interpretable control. We derive TR and TL directions from the geometry of candidate labels and decompose the original TV into TR, TL, and residual components. Optimizing the TR/TL magnitudes improves accuracy across multiple models and datasets, with larger gains than random directions, particularly for TVs constructed from instructions. Isolated interventions further reveal distinct effects consistent with the intended roles of TR and TL. These results show that the internal composition of a TV provides useful information for both understanding its behavior and improving its effectiveness. Future work should examine how TR/TL dependencies shape the mechanism of TVs.
Limitations
Our decomposition operationalizes TR and TL through candidate-label geometry. The distinct effects of isolated component interventions support the intended functional interpretation, but do not establish that these components fully capture task recognition and task learning as studied in ICL. In particular, controlling candidate-label preference and label discrimination does not by itself demonstrate that the corresponding internal processes have been isolated.
The projection geometry for intermediate-layer TVs is based on a direct candidate-label readout rather than the actual effect of an intervention on the final output. It does not explicitly account for the subsequent Transformer layers and therefore provides a proxy for output sensitivity. Consequently, the functional interpretation of the resulting components at intermediate layers is supported empirically rather than guaranteed by the projection formulation.
Our experiments reveal distinct component responses and effective coefficient settings, but do not identify the internal mechanisms that produce them. In particular, the causes of non-monotonic TR responses, TL effects on both metrics, and high accuracy with small TL coefficients remain unresolved. The explanations proposed in the Discussion remain hypotheses, as our experiments do not distinguish metric-related effects, nonlinear downstream processing, and dependencies between TR- and TL-related computations.
Our TR/TL-based decomposition is not guaranteed to provide the optimal directions for controlling TVs. Rather, it offers a functionally interpretable search space motivated by mechanistic studies of ICL. Other directions may provide more effective control.
Acknowledgment
This work was supported by the SPDR Funding (Number 202601094073), and Programs for Junior Scientists at RIKEN.
References
Dhruv Agarwal, Rico Angell, Kavitha Srinivas, Tahira Naseem, Horst Samulowitz, Willie Neiswanger, and Andrew McCallum. 2026. Boreft: Manifold steering of language models for black-box optimization. Preprint, arXiv:2609.33722.
Hakaze Cho, Mariko Kato, Yoshihiro Sakai, and Naoya Inoue. 2025. Revisiting in-context learning inference circuit in large language models. In Proc. International Conference on Learning Representations (ICLR).
Lang Gao, Jiahui Geng, Xiangliang Zhang, Preslav Nakov, and Xiuying Chen. 2025. Shaping the safety boundaries: Understanding and defending against jailbreaks in large language models. In Proc. Annual Meeting of the Association for Computational Linguistics (ACL).
Pengrui Han, Xueqiang Xu, Keyang Xuan, Peiyang Song, Siru Ouyang, Runchu Tian, Yuqing Jiang, Cheng Qian, Pengcheng Jiang, Jiashuo Sun, Junxia Cui, Ming Zhong, Ge Liu, Jiawei Han, and Jiaxuan You. 2026. Steer2adapt: Dynamically composing steering vectors elicits efficient adaptation of LLMs. In ICLR 2026 Workshop on Representational Alignment (Re^4-Align).
Roee Hendel, Mor Geva, and Amir Globerson. 2023. In-context learning creates task vectors. In Findings of Empirical Methods in Natural Language Processing (EMNLP Findings).
Sheng Liu, Haotian Ye, Lei Xing, and James Zou. 2024. In-context vectors: making in context learning more effective and controllable through latent space steering. In Proc. International Conference on Machine Learning (ICML).
AI @ Meta Llama Team. 2024. The llama 3 herd of models. Preprint, arXiv:2407.21783.
Pekka Malo, Ankur Sinha, Pekka Korhonen, Jyrki Wallenius, and Pyry Takala. 2014. Good debt or bad debt: Detecting semantic orientations in economic texts. Journal of the Association for Information Science and Technology, 65(4):782–796.
Meta AI. 2024. Llama 3.2 model card.
Sewon Min, Xinxi Lyu, Ari Holtzman, Mikel Artetxe, Mike Lewis, Hannaneh Hajishirzi, and Luke Zettlemoyer. 2022. Rethinking the role of demonstrations: What makes in-context learning work? In Proc. Conference on Empirical Methods in Natural Language Processing (EMNLP).
Jane Pan, Tianyu Gao, Howard Chen, and Danqi Chen. 2023. What in-context learning “learns” in-context: Disentangling task recognition and task learning. In Findings of the Association for Computational Linguistics (ACL Findings).
Bo Pang and Lillian Lee. 2004. A sentimental education: Sentiment analysis using subjectivity summarization based on minimum cuts. In Proc. Annual Meeting of the Association for Computational Linguistics (ACL).
Xueqing Peng, Ruoyu Xiang, Fan Zhang, Mingzi Song, Mingyang Jiang, Yan Wang, Lingfei Qian, Taiki Hara, Yuqing Guo, Jimin Huang, Junichi Tsujii, and Sophia Ananiadou. 2026. Ebisu: Benchmarking large language models in japanese finance. Preprint, arXiv:2602.01479.
Qwen Team. 2026. Qwen3.5: Towards native multi-modal agents.
Zara Siddique, Irtaza Khalid, Liam D. Turner, and Luis Espinosa-Anke. 2026. Shifting perspectives: Steering vectors for robust bias mitigation in llms. Preprint, arXiv:2503.05371.
Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D. Manning, Andrew Ng, and Christopher Potts. 2013. Recursive deep models for semantic compositionality over a sentiment treebank. In Proc. Conference on Empirical Methods in Natural Language Processing (EMNLP).
Eric Todd, Millicent L. Li, Arnab Sen Sharma, Aaron Mueller, Byron C. Wallace, and David Bau. 2024. Function vectors in large language models. In Proc. International Conference on Learning Representations (ICLR).
Xiaolei Wang, Xinyu Tang, Junyi Li, Xin Zhao, and Ji-Rong Wen. 2025. Investigating the pre-training dynamics of in-context learning: Task recognition vs. task learning. In Proc. International Conference on Learning Representations (ICLR).
Jerry Wei, Jason Wei, Yi Tay, Dustin Tran, Albert Weber, Yifeng Lu, Xinyun Chen, Hanxiao Liu, Da Huang, Denny Zhou, and Tengyu Ma. 2023. Larger language models do in-context learning differently. Preprint, arXiv:2303.03846.
Haolin Yang, Hakaze Cho, Kaize Ding, and Naoya Inoue. 2026a. Task vectors, learned not extracted: Performance gains and mechanistic insights. In Proc. International Conference on Learning Representations (ICLR).
Haolin Yang, Hakaze Cho, and Naoya Inoue. 2026b. Localizing task recognition and task learning in in-context learning via attention head analysis. In Proc. International Conference on Learning Representations (ICLR).
Haolin Yang, Hakaze Cho, Yiqiao Zhong, and Naoya Inoue. 2025. Unifying attention heads and task vectors via hidden state geometry in in-context learning. In Proc. Annual Conference on Neural Information Processing Systems (NeurIPS).
Xiang Zhang, Junbo Zhao, and Yann LeCun. 2015. Character-level convolutional networks for text classification. In Proc. Annual Conference on Neural Information Processing Systems (NeurIPS), pages 649–657.
A Hessian-based Label Metric
The projection metric should weight hidden-state differences according to their local effect on the reference candidate-label distribution. We derive this metric for intermediate-layer TVs from the Hessian of the label-space log-partition function.
Given a TV , the induced candidate-label logits are
(14)
The corresponding label distribution is
For the categorical softmax function, the Hessian of the log-partition function with respect to the label logits is
The hidden-state metric is obtained by pulling this label-space curvature back through the label unembedding matrix:
This metric emphasizes hidden-state directions that produce larger changes in the candidate-label logit distribution. It is used as a label-logit-sensitive geometry for decomposition rather than an exact prompt-specific output metric.
For the qualitative analysis, we apply the label-derived curvature term to each random component before mapping it to vocabulary scores. For a random component r, we compute
where is the full-vocabulary unembedding matrix. We report the tokens with the highest scores in .
B Projection Formulation
The main text defines the decomposition directions and their projection metric. Here we derive the projection coefficients used to extract the TR and TL components and define the remaining residual. Let
denote the matrix containing the decomposition axes. Given a TV v, the projection coefficients are obtained by solving the regularized least-squares problem:
The closed-form solution is
For binary classification, and the resulting components are
The residual component is defined as
For multiclass classification, the TL component is obtained by averaging query-wise projections onto the corresponding gold-vs-rest directions.
C Bayesian Optimization Details
Gaussian-Process Surrogate. We used scikit-learn’s GaussianProcessRegressor with a constant kernel multiplied by an ARD Matérn-5/2 kernel, plus a white-noise kernel. The length scales are initialized to with bounds , the constant multiplier to 1 with bounds , and the noise variance to with bounds . These hyperparameters are optimized by maximizing the log marginal likelihood using L-BFGS-B with three additional restarts. We standardized the objective values during GP fitting and use a fixed diagonal regularization of .
Acquisition Function. We used Expected Improvement (EI) with an exploration parameter of . At each iteration, we refit the GP and evaluate EI on a fixed grid over . The unevaluated point with the highest EI is selected for the next evaluation.
Initialization and Optimization Budget. Each run starts with the same 12 fixed initial coefficient pairs, including . This pair recovers the original TV for both the proposed method and the random controls. The initial points are
We performed 30 additional BO iterations, resulting in 42 evaluations per run. The final solution is the evaluated point with the highest accuracy.
D Random Control Construction
Let d be the hidden-state dimension and let
denote the original TR/TL subspace at the selected layer. For Random, two decomposition directions are sampled from a Gaussian distribution. For Random , these directions are restricted to . For each control, we decompose the original TV along the sampled directions into components and an orthogonal residual:
The resulting intervention vector is
Thus, . The decomposition components and residual remain fixed throughout each BO run. We optimize and apply the same intervention normalization as in Eq. 10. The five seeds vary the sampled decomposition directions.
E Independent Evaluation
We tested whether the gains obtained during optimization persist on examples not used for BO or configuration selection. For this purpose, we evaluated the optimized TVs on an independent set containing 500 examples per task. For each model, task, and TV construction condition, we select the layer and component coefficients with the highest optimized accuracy on and fix them before evaluation on , which is disjoint from and is not used for BO or configuration selection. We compared the original and optimized TVs at the same selected layer. As shown in Table 2, all 16 configurations retain positive accuracy gains on , with gain magnitudes generally comparable to those on . These results indicate that the benefits of the selected component coefficients extend to examples not used during optimization.
F Conditions and Scope of Linear Control
Our results show that optimizing the TR and TL coefficients can improve an original TV while preserving a functional interpretation of the components. A central question is when this linear combination can also be understood as a combination of their effects on model outputs. This requires considering both how the model responds to intervention and how the task depends on recognizing its purpose and interpreting its inputs.
(a) Llama-3.2-1B
| Task | TV | Layer | Optimization set | Independent evaluation set | ||
|---|---|---|---|---|---|---|
| Original | Optimized | Original | Optimized | |||
| SST-2 | Instruction | 16 | 28.91 | 84.38 ↑ 55.47 | 11.2 | 79.6 ↑ 68.4 |
| Demonstration | 13 | 76.17 | 82.81 ↑ 6.64 | 80.4 | 82.8 ↑ 2.4 | |
| SUBJ | Instruction | 16 | 40.23 | 73.83 ↑ 33.60 | 48.8 | 67.8 ↑ 19.0 |
| Demonstration | 16 | 40.23 | 73.83 ↑ 33.60 | 48.8 | 67.8 ↑ 19.0 | |
| FP | Instruction | 15 | 9.38 | 55.08 ↑ 45.70 | 13.0 | 56.8 ↑ 43.8 |
| Demonstration | 15 | 56.64 | 61.72 ↑ 5.08 | 60.4 | 63.4 ↑ 3.0 | |
| AG News | Instruction | 16 | 0.00 | 54.69 ↑ 54.69 | 0.0 | 50.6 ↑ 50.6 |
| Demonstration | 11 | 60.55 | 67.58 ↑ 7.03 | 59.0 | 63.2 ↑ 4.2 | |
(b) Llama-3.1-8B
| Task | TV | Layer | Optimization set | Independent evaluation set | ||
|---|---|---|---|---|---|---|
| Original | Optimized | Original | Optimized | |||
| SST-2 | Instruction | 32 | 0.00 | 84.77 ↑ 84.77 | 0.4 | 84.2 ↑ 83.8 |
| Demonstration | 32 | 68.36 | 84.38 ↑ 16.02 | 69.8 | 85.0 ↑ 15.2 | |
| SUBJ | Instruction | 31 | 65.23 | 71.48 ↑ 6.25 | 55.2 | 61.6 ↑ 6.4 |
| Demonstration | 25 | 64.45 | 73.44 ↑ 8.99 | 58.4 | 64.4 ↑ 6.0 | |
| FP | Instruction | 29 | 41.80 | 62.11 ↑ 20.31 | 45.2 | 63.0 ↑ 17.8 |
| Demonstration | 25 | 57.42 | 63.67 ↑ 6.25 | 61.0 | 62.8 ↑ 1.8 | |
| AG News | Instruction | 24 | 16.02 | 70.31 ↑ 54.29 | 14.8 | 65.8 ↑ 51.0 |
| Demonstration | 16 | 59.38 | 69.53 ↑ 10.15 | 57.6 | 67.6 ↑ 10.0 | |
Table 2: Accuracy (%) on the optimization and independent evaluation sets. Original and optimized TVs use the same selected layer. Green arrows indicate gains over the original TV in percentage points within each set.
Conditions for additive effects. Let denote the output distribution under the intervention in Eq. 10, including its normalization. For an output and a reference output , define the log odds . These measure the relative support for the two outputs. Assuming a smooth response, a first-order Taylor approximation around the original TV gives
where and are the derivatives with respect to the TR and TL coefficients at . This approximation describes each component as contributing a fixed change to the log odds. It is accurate when higher-order terms are small over the coefficient changes being considered. In particular, a small mixed term means that changing one component does not substantially alter the contribution of the other. In probability space, additive effects on log odds correspond to multiplying the relative contributions of the components and normalizing the resulting distribution.
Dependence between task recognition and interpretation. A linguistic interpretation of this condition is that recognizing the task leaves the relevant interpretation of the input largely stable. For example, a model may already understand the sentiment of a sentence, while needing an adjustment to how strongly it favors the candidate labels or reflects that judgment in its label preference. Such a correction can plausibly be achieved by changing the strength of existing contributions. A stronger dependence arises when recognizing the task changes which aspects of the input matter. A politely worded response, for example, may convey positive sentiment while declining a request. If changing TR alters which interpretation the model uses, the contribution associated with TL may also change. A fixed additive description would then be insufficient over that range of interventions. This dependence need not remain at every layer: the model may already have resolved the relevant interpretation before the intervention is applied.
Relation to the empirical results. The accuracy gains show that adjusting the existing components can correct some errors across multiple settings. The distinct effects of isolated component interventions further support their functional interpretation. The effect of TL on both and is compatible with additive contributions: two components can affect the same output metric without changing each other's contribution. However, neither this observation nor improved accuracy establishes that interactions are small. The approximation above therefore provides a conditional explanation of how the components can combine, rather than a property established throughout the search range.
Scope of the decomposition. The two coefficients control adjustments to information already encoded in the model and the original TV, including the retained residual. Their usefulness depends on whether the required correction can be expressed by strengthening or weakening the selected contributions. Corrections that require other directions, or changes in how the contributions depend on each other, can exceed this description. The contrasting outcomes on JF-ICR illustrate that the usefulness of this restricted adjustment depends on the model even for the same task, although they do not identify the cause of the difference. The relevant scope of linear control is therefore conditional on the learned representation: complex linguistic dependencies may already be represented, leaving an adjustment that a small number of interpretable components can support.
G TR/TL Coefficient Search

(a) SST-2

(b) SUBJ
Figure 6: GP-predicted accuracy across TR and TL coefficients. White circles indicate evaluated coefficient settings; red stars indicate the selected optimal settings.
Fig. 6 shows the GP-estimated accuracy surfaces over the TR and TL coefficients for instruction-based TVs on SST-2 and SUBJ with Llama-3.2-1B. Both surfaces contain high-accuracy regions with relatively large TR coefficients and small TL coefficients, although the shapes of these regions differ between tasks. These examples motivate the discussion of TR/TL balance in Section 5, while the GP estimates alone do not establish why these coefficient settings are effective.