Data-Efficient Adaptation of LLMs via
Attention Head Reweighting
July 15, 2026
Learning effectively from limited data is critical in domains like security where labeled examples are scarce. Large language models (LLMs) have demonstrated some capabilities for data-efficient learning, especially through parameter-efficient adaptation methods, but continue to struggle when faced with few samples for difficult tasks. To meet this challenge, we propose Attention Head Reweighting(AHR), a data-efficient method that adapts LLMs to new text-classification tasks by learning only a single scalar per attention head. This drastically reduces the number of parameters that need to be learned by making use of the functional specialization of individual attention heads. Experiments on diverse open-source text classification datasets show that AHR can outperform standard baselines like LoRA when learning from limited samples, despite having \(200-1000\times\) fewer trainable parameters, as our AHR only modifies \(\sim 0.0001\%\) of the model’s parameters. In addition, our learned weights are easy to interpret and can be analyzed to better understand the mechanisms and attention heads responsible for in-context learning abilities in LLMs.1
Learning effectively from limited labeled data remains a central challenge in high-stakes domains such as AI security, where annotations are often scarce because attacks and threat vectors are constantly evolving and need to be defended against quickly [1]. In this setting, data-efficient text classification is critical for flagging large language model (LLM) inputs [2]–[5] and LLM outputs [6] that can be dangerous.
While LLMs exhibit some data-efficient behavior through in-context learning (ICL) [7], [8] and parameter-efficient fine-tuning (PEFT) [9], [10], their performance often degrades sharply when only a small number of task-specific examples are available. One issue with these methods is that they generally optimize in a large, unconstrained parameter space, which can lead to overfitting.
To tackle this issue, we propose Attention Head Reweighting (AHR), an intuitive data-efficient method to adapt LLMs to new text-classification tasks by learning only a single scalar per attention head. This drastically reduces the number of parameters that need to be adapted (see 1). We hypothesize our method is effective and avoids overfitting by leveraging the functional specialization of attention heads noted in recent works [11]–[14]. For example, if a particular security-related behavior is isolated to a few attention heads, AHR can easily learn to change the weighting for these heads rather than seeking to alter the internal weights of each head.
In our experiments we focus on text classification tasks, as these can often be effectively learned from a few examples, and many important security tasks such as detecting phishing attempts or model jailbreaks are text classification tasks. Classifiers are a critical bottleneck in AI security, which is constantly faced with data scarcity as new threats emerge, for filtering and guarding LLM responses that are interacting with real-world users and attackers.
In our experiments, AHR outperforms baselines across a variety of settings and models, improving by an average of around \(3\%\) points over standard baselines like LoRA [9] when training data is very limited i.e. \(\leq 100\) examples. AHR shows particularly large gains in the security relevant tasks of Webpage Phishing Detection (Web) and Jailbreak detection, achieving 6-7% accuracy improvement over best baseline methods with just 10 training samples, while using \(200-1000 \times\) fewer trainable parameters. We can analyze the changes our method makes to the model, and see that these gains are largely fueled by a combination of upweighting a few task specific heads as well as a couple general in-context learning heads. Finally, to maximally learn from just a few examples, we utilize in-context finetuning (IC-FT), where we update model parameters to maximize the probability of correct answers within a few-shot prompt, which we show improves accuracy by \(\sim 10\%\) points over finetuning on just one sample at a time.
A variety of parameter-efficient finetuning methods have been proposed to adapt large models while updating only a small subset of parameters [15]–[17]. Prominent examples include LoRA [9], AdaLoRA [10], (IA)3 [18], and related approaches [19]–[21]. These methods substantially reduce adaptation cost, but still introduce thousands to millions of trainable parameters, which can lead to overfitting in data-scarce settings.
Simultaneously, there has been a spectrum of increasingly constrained prompting approaches, ranging from continuous prompt tuning [22], [23] to discrete prompt tuning [24], prompt ensemble construction [25]–[27], and generating a single natural-language prompt [28], [29]. While effective in some settings, prompt-based methods are often very sensitive to minor variations and may struggle with under-specified tasks under severe data scarcity.
ICL obviates the need for task-specific parameter adaptation altogether, but can be highly sensitive to minor variations in the provided examples [30] and sometimes unfaithful to those examples [31], [32]. ICL can be improved through directed instruction tuning [33] or by including explanations along with examples [34]. A growing body of work has studied ICL, showing that it can implement linear models [35], [36], discrete functions [37], and more general algorithms [38], [39]. Some works have further argued that ICL implicitly performs optimization steps analogous to gradient descent [40]–[42] and higher-order optimization methods [36], [43].
| Model | GPT2-XL | Llama-3.2-1B | Llama-3.2-3B | QWEN3-8B |
|---|---|---|---|---|
| Full FT | 1,558,148,000 | 1,235,920,896 | 3,212,750,496 | 8,190,736,512 |
| LoRA | 307,200 | 106,496 | 286,720 | 479,232 |
| AdaLoRA | 614,496 | 213,056 | 573,552 | 958,608 |
| IA3 | 537,600 | 147,456 | 286,720 | 626,688 |
| AHR (Ours) | 1,200 | 512 | 672 | 1,152 |
Attention heads have been a primary focus for analysis [44], [45], with evidence that attention heads often latch onto task-specific patterns that are useful for ICL, e.g. induction heads [11], n-gram heads [12], and more easily explainable patterns [46]–[48]. This growing evidence of functional specialization has motivated methods that explicitly manipulate attention. Prior works have shown that modifying attention scores can be useful for post-hoc steering [13], [49], attention steering for transfer learning [50], attention-guided retrieval [51], interpretable modeling [52], boosting attention for instruction following [53], and improving long-context LLM inference [54].
Our paper aims to improve the efficiency of how models can learn from a very small number of training examples by modifying an extremely small number of parameters. We do this via Attention Head Reweighting (AHR), which introduces a single learnable scalar parameter per attention head that multiplies that head’s contributions to the residual stream (see 1). By finetuning these parameters on a small amount of data, we can amplify attention heads that are helpful for the current task, while downweighting heads that harm performance. By not modifying the weights inside individual heads we can avoid overfitting to the small amount of training data.
Notation: We follow the notation of [55], where we divide the \(W_O\) matrix into its components within each attention head. Let \(z_r^l \in \mathbb{R}^{s \times d}\) be the model’s residual stream after layer \(l\), where \(s\) is the number of tokens in the sequence and \(d\) is the model’s representation dimension. A typical transformer block consists of a Multihead-Attention (MHA) layer followed by a multi-layer perceptron (MLP) layer. We can write the update of a layer as: \[z^{l+1}_{Att} = z_r^l + \sum_{h \in H^{l+1}}h(z^l_r) \label{eq:orig95attn}\tag{1}\] \[z_r^{l+1} = z_{Att}^{l+1} + MLP^{l+1}(z_{Att}^{l+1})\]
Here \(h(z) = AzW_VW_O\), \(A = \text{softmax}(\frac{(zW_Q)(zW_K)^T}{\sqrt{d_k}})\). \(W_V \in \mathbb{R}^{d \times d_k}\), \(W_Q \in \mathbb{R}^{d \times d_k}\), \(W_K \in \mathbb{R}^{d \times d_k}\) and \(W_O \in \mathbb{R}^{d_k \times d}\) are the parameters of the attention head, and \(d_k = d/n_h\) where \(n_h = |\mathcal{H}|\) is the number of attention heads per layer.
Our method simply edits the update rule of the multi-head attention layer (Eq. 1 ) to:
\[z^{l+1}_{Att} = z_r^l + \sum_{h \in H^{l+1}}(1 + \beta_h) h(z^l_r), \label{eq:modified95attn}\tag{2}\]
where \(\beta_h\) is a head-specific parameter that is initialized at zero. During training, we only train the \(\beta_h\) parameters while keeping all other parameters, including the MLP layers unchanged. At test time, the parameters \(\beta\) can be merged into \(W_O\) for no additional inference cost. During training, we utilize supervised fine-tuning (SFT) on few-shot examples, by minimizing the cross-entropy loss on the answer tokens, as well as a regularization objective to minimize changes to the model:
\[\min_{\beta} \sum_{(x, y) \in \mathcal{D}_{train}} -\log P(y |x; \theta, \beta) + \lambda (\sum_{h} |\beta_h|^p)^{1/p}\]
where \(\mathcal{D}_{train}\) is the few-shot training dataset, \(\lambda\) is a hyperparameter controlling regularization and \(\theta\) are the (frozen) model parameters and \(p \in \{1, 2\}\).
Recently, In-Context Learning (ICL) has risen as an alternative to finetuning as a way for models to learn from few-shot examples [7]. While powerful, in-context learning is limited in how many samples it can learn from by the model’s context window, as well as GPU-memory. Additionally, using many in-context samples incurs a large additional cost at inference time.
To get the best of both worlds, we utilize In-Context finetuning (IC-FT) similar to [56]. Different from [56], we finetune separately on each dataset while their goal is to improve general in-context learning ability. In in-context finetuning, we construct an input string with \(k\) few-shot examples, and do supervised finetuning to maximize the probability of all answer tokens within the context. For each input with \(k\) in-context examples, we minimize the following:
\[\min_{\beta} \sum_{i=1}^k -\log P(y_i | X_i; \theta, \beta) + \lambda (\sum_{h} |\beta_h|^p)^{1/p} \label{eq:ic95ft}\tag{3}\]
where \(X_i = \{x_1, y_1, ..., y_{i-1}, x_i\}\) is the concatenated input with few-shot examples. As this technique is independent of the finetuning method, we utilize it for both our method and the baselines in our experiments (with their trainable parameters instead of \(\beta\) in Eq. 3 ). For text classification, we only maximize the probability of the first token in the answer, as predicting subsequent tokens of the answer is trivial given the first one.
Figure 2: Accuracy after finetuning, averaged across our 4 models. We can see our AHR significantly outperforms baselines when data is limited, while performance starts to equalize at around 100 samples.. a — Averaged across 6 datasets, b — Web - Phishing URL classification
We consider four LLMs across a range of sizes in our experiments: GPT-2 XL ([57] [57]; gpt2-xl), LLaMa-3.2 1B and 3B ([58] [58]; meta-llama/Llama-3.2-1B and meta-llama/Llama-3.2-3B), and Qwen3 8B ([59] [59]; Qwen/Qwen3-8B).
See Table 1 for more details, such as the number of parameters in each model and how many of these are trainable.
We test our method on a set of six text-classification datasets, including standard tasks as well as cybersecurity relevant applications:
SST2 [60]. This dataset contains sentences from movie reviews, and the task is to classify their sentiment into one of {Positive, Negative}.
AG-News [61]. A collection of text excerpts from news articles, where the goal is to classify the excerpt into one of the following categories: {World, Sports, Business, Sci/Tech}
Emotion [62]. A dataset of tweets, with labels based on the emotion expressed in the tweet. This dataset contains 6 classes {Sadness, Joy, Love, Anger, Fear, Surprise}
Webpage Phishing Detection (Web) [63], a dataset of web URLs where the goal is to differentiate between Phishing and Legitimate URLs.
Toxigen [64]. This is a dataset of potentially toxic/hateful comments for detecting hateful speech. We treated an input as toxic if the average human assessed toxicity score was \(>3\) (on a 1-5 scale) and as benign otherwise.
Jailbreak Detection [65], a dataset of LLM prompts containing Jailbreak attempts as well as standard prompts. The goal is to classify whether a given prompt is a jailbreak attempt. We use the balanced version from https://huggingface.co/datasets/jackhhao/jailbreak-classification.
Most of these datasets have thousands of examples, but in order to study few-shot learning capabilities of our models, we randomly sample a subset of the training data to be used in few-shot learning. We evaluate performance on the full test set. See an example for each dataset in 4.
As our main baseline, we compare against LoRA [9]. For LoRA we use \(r=1\) and \(\alpha=1\), which we found to increase training stability and reduce overfitting on small datasets. We additionally compare against (IA)3 [18] and AdaLoRA [10]. For AdaLoRA we use Initial \(r=4\) and target \(r=2\), with \(\alpha=1\). As regularization, we employ L2 weight regularization for all the baselines. For training the baselines, we utilize PEFT package [66]. We also ran full-finetuning for some datasets but found that it performed considerably worse than these baselines and was significantly more computationally intensive, so we omit these results.
In our experiments, we discovered that the particular few-shot examples used can have a very large effect on the final accuracy. To reduce variance, we report the average accuracy across 10 different random seeds for choosing the set of training examples. We utilize In-Context Finetuning (Sec 3.1) for training all the baseline as well as our AHR. We use \(k=10\) for In-Context Finetuning, and randomly select a set of 10 examples to form each input during training time. If \(|\mathcal{D}_{train}| = 10\), training inputs are random permutations of the training set. We train all models using the AdamW optimizer [67].
To stay true to a real data-limited setting, we do not utilize any additional data for selecting hyperparameters. Instead, we select hyperparameters including learning rate from \(\{0.03, 0.003, 0.0003\}\), number of training steps from \(\{0, 5, 10, 20, 50, 100, 200\}\) and regularization strength from \(\{0, 0.1, 0.3, 1.0, 3.0, 10.0, 30.0, 100.0\}\) via 5-fold cross-validation, where for each dataset we split it into 80% training data and 20% validation data, and select the hyperparameters that minimize the average validation loss across the folds. We select hyperparameters separately for each random seed. Finally, we train a model using the combined training and validation split and report performance on the test set.
Our prompts consists of a short instruction describing the task and the class names, as well as the few-shot examples, see exact prompt in Appendix Table 5.
| Dataset | \(|\mathcal{D}_{train}|\) | 10 | 15 | 20 | 30 | 50 | 100 |
|---|---|---|---|---|---|---|---|
| SST2 | LoRA | 88.32% | 90.24% | 88.75% | 92.09% | 91.44% | 92.20% |
| AdaLoRA | 87.43% | 90.40% | 89.54% | 91.00% | 92.18% | 92.70% | |
| IA3 | 88.75% | 89.15% | 89.01% | 92.08% | 92.54% | 92.60% | |
| AHR (Ours) | 91.01% | 91.25% | 91.62% | 92.07% | 92.49% | 92.99% | |
| AG News | LoRA | 78.18% | 77.35% | 81.24% | 81.45% | 84.20% | 84.90% |
| AdaLoRA | 76.58% | 77.33% | 80.06% | 81.76% | 82.18% | 84.00% | |
| IA3 | 75.68% | 79.36% | 80.64% | 82.50% | 83.96% | 86.62% | |
| AHR (Ours) | 76.48% | 79.19% | 81.60% | 83.06% | 84.51% | 85.65% | |
| Emotion | LoRA | 49.81% | 53.01% | 50.65% | 56.25% | 57.94% | 63.05% |
| AdaLoRA | 52.54% | 53.26% | 52.10% | 57.18% | 58.88% | 64.94% | |
| IA3 | 49.83% | 52.90% | 51.69% | 56.18% | 58.33% | 61.03% | |
| AHR (Ours) | 50.32% | 53.74% | 54.48% | 56.67% | 58.78% | 62.57% | |
| Web | LoRA | 66.81% | 72.34% | 74.91% | 78.99% | 85.63% | 88.00% |
| AdaLoRA | 73.60% | 79.86% | 78.98% | 81.44% | 85.37% | 87.94% | |
| IA3 | 60.47% | 68.15% | 76.56% | 80.48% | 84.32% | 87.48% | |
| AHR (Ours) | 79.44% | 81.04% | 82.08% | 84.16% | 85.81% | 87.35% | |
| Toxigen | LoRA | 56.94% | 60.60% | 64.10% | 70.25% | 73.83% | 75.86% |
| AdaLoRA | 64.84% | 69.69% | 72.00% | 73.94% | 74.92% | 76.79% | |
| IA3 | 59.64% | 64.10% | 63.86% | 71.13% | 74.21% | 75.56% | |
| AHR (Ours) | 72.78% | 72.52% | 72.71% | 73.76% | 75.32% | 74.69% | |
| Jailbreak | LoRA | 69.59% | 74.76% | 82.05% | 84.92% | 91.16% | 94.26% |
| AdaLoRA | 72.33% | 77.59% | 80.60% | 79.53% | 86.63% | 89.82% | |
| IA3 | 72.94% | 75.86% | 77.10% | 84.61% | 85.50% | 84.32% | |
| AHR (Ours) | 79.68% | 82.16% | 83.63% | 89.26% | 91.16% | 92.83% | |
| Average | LoRA | 68.27% | 71.38% | 73.62% | 77.32% | 80.70% | 83.05% |
| AdaLoRA | 71.22% | 74.69% | 75.55% | 77.47% | 80.03% | 82.70% | |
| IA3 | 67.88% | 71.58% | 73.14% | 77.83% | 79.81% | 81.27% | |
| AHR (Ours) | 74.95% | 76.65% | 77.69% | 79.83% | 81.34% | 82.68% | |
2 and Table 2 show the average accuracy after finetuning as a function of training data size \(|\mathcal{D}_{train}|\). We can see that our AHR consistently outperforms existing parameter efficient finetuning methods when training data is limited. On average, our AHR improves over the best baseline by 2-4%(absolute) in low data regimes (\(|\mathcal{D}_{train}| \leq 30\)), which corresponds to around 10% relative error reduction, despite having over \(200\times\) fewer trainable parameters. This shows our AHR can significantly improve the few-shot learning ability of the models.
AHR performs particularly well on the web URL phishing classification task, substantially outperforming LoRA and other baselines. This may be caused by the nature of the input: URLs are short, highly structured strings with strong lexical and positional cues (e.g., protocol tokens, domain patterns, special characters) that are likely already well captured by pretrained attention heads. In this setting, effective adaptation primarily requires emphasizing a subset of existing attention heads that are sensitive to these patterns, rather than learning new task‑specific transformations. In addition, this task is less typical to the training distribution of the models, which means there is more to gain by finetuning.
In contrast, most PEFT methods such as LoRA actually harm performance compared to the In-Context Learning baseline when \(|\mathcal{D}_{train}|\) is small as shown in Fig 2 (b). This highlights the importance of avoiding overfitting when finetuning on limited data, in particular on short and atypical inputs, and shows our method can help important real world tasks such as detecting phishing links. While this particular task has a decent amount of training data available, the ability to learn from few examples shows promise for other cybersecurity tasks like detecting specialized attacks where training data is much more limited.
IC-FT: 3 (a) compares test accuracy while using In-Context Finetuning described in Section 3.1 against standard finetuning without in-context samples. Results are averaged across 4 models and the SST2 and Web datasets (with 10 random seeds). We can see utilizing IC-FT significantly improves performance of all methods, with around a \(10\%\) point increase in average accuracy for all methods. Importantly, standard FT fails to outperform the in-context learning baseline in all settings.
Regularization Comparison: In Table 3 we compare different regularization strategies for AHR on SST2 LLama-3.2-3B. We can see this makes very little difference in performance. As a result, we use L2-norm for our results unless otherwise specified, though we use L1-norm for our analysis in 5.
Figure 3: a) IC-FT ablation. b) Web Accuracy with L1 regularization.. a — Effect of IC-FT (solid lines) vs direct finetuning with only one sample in context(dashed)., b — Web Test accuracy as a function of number of heads modified.
In this section, we take a deeper look at finetuning one model on one particular task to better understand AHR and how it differs from other PEFT methods.
First, to understand whether AHR needs to modify many attention heads, we train models with varying L1 regularization penalties {0, 0.005, 0.01, 0.02, 0.03, 0.04, 0.05} and see how the number of attention heads modified affects test accuracy. The results with Llama-3.2-1B trained on the Web dataset, average of 10 random seeds are shown in 3 (b). We can see that modifying the weight of just 1 attention head (out of 512) can improve accuracy by \(\sim2\%\) when we have 100 training samples, while modifying 5 heads can improve accuracy by around 4%. Overall, more training data improves performance and modifying more heads leads to more accuracy, though settings with low data require some regularization.
To study how much our finetuning affects model behavior on other tasks, we measured model performance on 3 other datasets (SST2, AGNews, Emotion) after finetuning on the Web dataset. In 4 we measure the performance on the Web dataset (blue) as well as average over our other datasets (red). We report the average accuracy change (averaged over 10 seeds) compared to the model with no finetuning using 10 ICL examples. We can see that with only 10 examples, all methods except AHR overfit to the training samples and end up significantly harming performance on the original task as well as other datasets. When we increase the training set size to 30, we see most methods improve task performance on the Web task, but at the cost of losing some accuracy on other tasks. Interestingly, with AHR, finetuning on this task actually slightly improves performance on other tasks. This suggests that AHR helps avoid destructive changes to the model, and in some cases can even find generalizable edits that improve ICL abilities across many tasks.
Inspired by previous results, we wanted to see whether the modified attention heads are specific to a particular task, or generally useful for many text classification tasks. To study this, we trained AHR models with varying L1 penalties \(\{0.01, 0.02, 0.03, 0.04, 0.05\}\) on 4 of our tasks (SST2, AGNews, Emotion and Web). We average across 10 random seeds and focused on \(|\mathcal{D}_{train}|=100\) case for less variance. We then measured which heads had the largest average change across different settings, and plot a heatmap of most changed heads in 5.
This reveals a few interesting things. First, some heads such as Layer 15 Head 14 (L15H14) and L15H3 receive large positive weights on every dataset. This suggests these heads are important to general in-context learning mechanisms instead of particular datasets, and upweighting them may make the model better at in-context learning in general. This could happen if, for example, they play a role similar to induction heads [11]. To test this theory we conducted an experiment where we manually modify the weights \(\beta\) for these two heads only, leaving all other heads unchanged (\(\beta=0\)). The results are shown in Appendix 7.2 and 8, and support our hypothesis. Completely disabling these two heads (\(\beta=-1\)) drops average accuracy across these 4 datasets from 70.68% to 66.81%, while doubling their impact (\(\beta=1\)) increases average accuracy to 71.67%, highlighting that these heads play a significant role in in-context learning.
On the other hand, most heads are not like this and are only modified for one particular dataset. To better understand the function of these specialized heads, we take a look at the Layer 14 Head 11. This is the only head that is significantly upweighted for the Web Phishing URL dataset, but not on the other datasets. 6 shows the attention pattern of this head when processing the final token of the input on the Web dataset. We can see that on all inputs this head only pays attention to the Phishing tokens. In comparison, in 7 we plot its attention pattern on the other datasets and find it very noisy with no clear pattern. This makes us believe this L14H11 is more specialized to detecting Phishing related inputs.
We have presented Attention Head Reweighting (AHR), a highly data-efficient adaptation method designed to address the challenges of learning from limited labeled examples. By introducing a single learnable scalar per attention head, AHR enables LLMs to adapt to new tasks while updating fewer than one-millionth of the model parameters—a 200x to 1,000x reduction compared to standard PEFT baselines like LoRA. Our experimental results on diverse text-classification benchmarks demonstrate the efficacy of this approach:
Few-shot Learning Performance: AHR consistently outperforms existing methods in extremely data-scarce settings (\(|\mathcal{D}_{train}|\le30\)), achieving a 2-4% average absolute improvement over baseline methods like LoRA, with large improvements in security relevant tasks like detecting Phishing URLs and Jailbreak attempts.
Preventing Overfitting: By freezing internal head weights and only modifying the contribution of the head to the residual stream, AHR mitigates the risk of overfitting that hampers methods with larger parameter spaces and is overall less destructive to model behavior.
Furthermore, AHR offers distinct advantages regarding interpretability. Unlike traditional fine-tuning, which obscures the function of weight updates, AHR leverages the existing functional specialization of attention heads, and analyzing AHR weights allows us to better understand the mechanisms behind in-context learning. Ultimately, AHR provides a resource-efficient, more transparent, and effective solution for deploying LLMs in high-stakes, data-limited text classification settings.
The focus of our paper is on text classification datasets, and while many important tasks such as detecting phishing links or jailbreak attempts are text classification, the applicability of our method on tasks beyond classification requires further investigation. In our initial investigations we found AHR more effective at tasks with simple outputs such as classification, while tasks that require very fine-grained control over model outputs might be less suitable for AHR, particularly if there are no attention heads focused on this type of task originally.
Our analysis understanding the function of attention heads is limited to analyzing their behavior in the context of text classification tasks, and it is likely that they also have other roles when processing different types of inputs.
Larger training datasets: Overall we find that if you have sufficient training data (e.g. \(\geq 300\) examples) other finetuning methods outperform AHR. This makes sense as our method is limited in the types of updates it can make, so if overfitting is not a concern it is often beneficial to use a more powerful model edit.
T. Oikarinen and T.-W. Weng are partially supported by National Science Foundation under Grant No. 2313105, 2430539, Hellman Fellowship, Intel Rising Star Faculty Award. The authors would like to thank anonymous reviewers for valuable feedback to improve the manuscript.
Figure 8 shows the effect of manually changing the weighting of just 2 ICL relevant heads of Llama-3.2-1B in terms of average accuracy across our 4 datasets. We can see that completely disabling them (\(\beta=-1\)) drops average accuracy from 70.68% to 66.81%, while doubling their impact (\(\beta=1\)) increases average accuracy to 71.67%.
| \(\mathcal{D}_{train}\) | 10 | 15 | 20 | 30 | 50 | 100 |
|---|---|---|---|---|---|---|
| AHR-L1 | 92.05% | 92.60% | 92.64% | 92.92% | 93.60% | 93.97% |
| \(\pm\) 0.54% | \(\pm\) 0.41% | \(\pm\) 0.89% | \(\pm\) 0.82% | \(\pm\) 0.25% | \(\pm\) 0.23% | |
| AHR-L2 | 92.60% | 92.56% | 92.88% | 93.19% | 93.59% | 93.92% |
| \(\pm\) 0.35% | \(\pm\) 0.56% | \(\pm\) 0.38% | \(\pm\) 0.30% | \(\pm\) 0.20% | \(\pm\) 0.15% |
As the extra parameter count required to store the AHR change is very small compared to the original model, attempts to create a library of fitted AHR-models and select from them at inference time may be successful, as has been done with LoRA [68].
Interpretability guided finetuning: A possible extension of our method is to apply the same general approach to reweighting different model subcomponents beyond attention heads, like interpretable circuits [69] or Sparse Autoencoder (SAE) latents [70]. This could improve performance by increasing the number of components and learnable parameters we can up- or downweight, as well as improve interpretability of our finetuning as each component would be inherently more interpretable. Models could even be trained with this kind of steering in mind, like weight-sparse transforms with interpretable circuits [71]. By focusing on interpretable components/circuits, sparse edits might become more effective as more relevant skills/features are localized within the model.
Using our finetuning method to upweight particular SAE latents could also function as an automated way to find steering vectors from SAEs for particular tasks similar to [72].
Future work could even connect with a line of work on natural-language explanations [73], [74] to adapt parameters on the fly based on task specifications (similar to approaches that have been tried for LoRA [75]) or to involve a human-in-the-loop when specifying and adapting to a new task [76], [77].
| Dataset | Text | Label |
|---|---|---|
| SST2 | that loves its characters and communicates something rather beautiful about human nature | Positive |
| AGNews | Wall St. Bears Claw Back Into the Black (Reuters). “Reuters - Short-sellers, Wall Street’s dwindling band of ultra-cynics, are seeing green again.” | Business |
| Emotion | i can go from feeling so hopeless to so damned hopeful just from being around someone who cares and is awake | Sadness |
| Web | http://www.slideserve.com/zizi/firewalls | Legitimate |
| Jailbreak | You are Joseph Seed from Far Cry 5. Sermonize to a group of followers about the importance of faith and obedience during the collapse of civilization. | Benign |
| Toxigen | asians are trying to take over the world with their karate skills | Toxic |
| Dataset | Prompt | |
|---|---|---|
| SST2 | Classify the sentiment expressed in the following text excerpt into one of: Negative, Positive | |
| AGNews | Classify the following sentences from news articles into one of the following categories: World, Sports, Business, Sci/Tech | |
| Emotion | Classify the emotion expressed in the following sentence into one of the following categories: Sadness, Joy, Love, Anger, Fear, Surprise | |
| Web | Classify the following web url into one of the following categories: Legitimate, Phishing | |
| Jailbreak | Classify whether the following LLM prompt is benign or attempting to jailbreak the model by outputting one of: Benign, Jailbreak | |
| Toxigen | Classify whether the following text is toxic towards a group of people by outputting one of: Benign, Toxic |
| \(|\mathcal{D}_{train}|\) | \(10\) | \(15\) | \(20\) | \(30\) | \(50\) | \(100\) |
|---|---|---|---|---|---|---|
| AHR (Ours) | ||||||
| \(\pm\)1.22% | ||||||
| \(\pm\)1.04% | ||||||
| \(\pm\)1.17% | ||||||
| \(\pm\)0.51% | ||||||
| \(\pm\)0.34% | ||||||
| \(\pm\)0.35% | ||||||
| LoRA | ||||||
| \(\pm\)1.60% | ||||||
| \(\pm\)1.08% | ||||||
| \(\pm\)0.92% | ||||||
| \(\pm\)1.22% | ||||||
| \(\pm\)1.90% | ||||||
| \(\pm\)3.84% | ||||||
| AdaLoRA | ||||||
| \(\pm\)2.45% | ||||||
| \(\pm\)1.07% | ||||||
| \(\pm\)1.59% | ||||||
| \(\pm\)1.85% | ||||||
| \(\pm\)0.58% | ||||||
| \(\pm\)0.21% | ||||||
| IA3 | ||||||
| \(\pm\)2.13% | ||||||
| \(\pm\)1.36% | ||||||
| \(\pm\)1.26% | ||||||
| \(\pm\)0.75% | ||||||
| \(\pm\)0.89% | ||||||
| \(\pm\)0.69% | ||||||
| ICL | ||||||
| \(\pm\)2.91% | ||||||
| \(\pm\)3.14% | ||||||
| \(\pm\)3.06% | ||||||
| \(\pm\)3.16% | – | – |
| \(|\mathcal{D}_{train}|\) | \(10\) | \(15\) | \(20\) | \(30\) | \(50\) | \(100\) |
|---|---|---|---|---|---|---|
| AHR (Ours) | ||||||
| \(\pm\)0.87% | ||||||
| \(\pm\)1.20% | ||||||
| \(\pm\)0.71% | ||||||
| \(\pm\)0.54% | ||||||
| \(\pm\)0.37% | ||||||
| \(\pm\)0.28% | ||||||
| LoRA | ||||||
| \(\pm\)2.08% | ||||||
| \(\pm\)0.96% | ||||||
| \(\pm\)3.37% | ||||||
| \(\pm\)0.77% | ||||||
| \(\pm\)0.32% | ||||||
| \(\pm\)0.30% | ||||||
| AdaLoRA | ||||||
| \(\pm\)0.95% | ||||||
| \(\pm\)2.07% | ||||||
| \(\pm\)0.97% | ||||||
| \(\pm\)0.82% | ||||||
| \(\pm\)1.00% | ||||||
| \(\pm\)0.76% | ||||||
| IA3 | ||||||
| \(\pm\)1.14% | ||||||
| \(\pm\)2.69% | ||||||
| \(\pm\)1.08% | ||||||
| \(\pm\)0.67% | ||||||
| \(\pm\)0.38% | ||||||
| \(\pm\)1.03% | ||||||
| ICL | ||||||
| \(\pm\)1.95% | ||||||
| \(\pm\)1.93% | ||||||
| \(\pm\)1.53% | ||||||
| \(\pm\)0.82% | ||||||
| \(\pm\)0.54% | ||||||
| \(\pm\)0.36% |
| \(|\mathcal{D}_{train}|\) | \(10\) | \(15\) | \(20\) | \(30\) | \(50\) | \(100\) |
|---|---|---|---|---|---|---|
| AHR (Ours) | ||||||
| \(\pm\)0.35% | ||||||
| \(\pm\)0.56% | ||||||
| \(\pm\)0.38% | ||||||
| \(\pm\)0.30% | ||||||
| \(\pm\)0.20% | ||||||
| \(\pm\)0.15% | ||||||
| LoRA | ||||||
| \(\pm\)0.91% | ||||||
| \(\pm\)0.75% | ||||||
| \(\pm\)4.02% | ||||||
| \(\pm\)0.49% | ||||||
| \(\pm\)0.38% | ||||||
| \(\pm\)0.57% | ||||||
| AdaLoRA | ||||||
| \(\pm\)3.56% | ||||||
| \(\pm\)1.45% | ||||||
| \(\pm\)0.83% | ||||||
| \(\pm\)0.32% | ||||||
| \(\pm\)0.86% | ||||||
| \(\pm\)0.14% | ||||||
| IA3 | ||||||
| \(\pm\)2.05% | ||||||
| \(\pm\)1.47% | ||||||
| \(\pm\)1.75% | ||||||
| \(\pm\)0.79% | ||||||
| \(\pm\)0.14% | ||||||
| \(\pm\)0.19% | ||||||
| ICL | ||||||
| \(\pm\)0.24% | ||||||
| \(\pm\)0.41% | ||||||
| \(\pm\)0.44% | ||||||
| \(\pm\)0.38% | ||||||
| \(\pm\)0.13% | ||||||
| \(\pm\)0.14% |
| \(|\mathcal{D}_{train}|\) | \(10\) | \(15\) | \(20\) | \(30\) | \(50\) | \(100\) |
|---|---|---|---|---|---|---|
| AHR (Ours) | ||||||
| \(\pm\)0.32% | ||||||
| \(\pm\)0.27% | ||||||
| \(\pm\)0.29% | ||||||
| \(\pm\)0.23% | ||||||
| \(\pm\)0.26% | ||||||
| \(\pm\)0.15% | ||||||
| LoRA | ||||||
| \(\pm\)4.07% | ||||||
| \(\pm\)3.72% | ||||||
| \(\pm\)4.26% | ||||||
| \(\pm\)0.35% | ||||||
| \(\pm\)4.16% | ||||||
| \(\pm\)0.15% | ||||||
| AdaLoRA | ||||||
| \(\pm\)4.18% | ||||||
| \(\pm\)0.62% | ||||||
| \(\pm\)2.17% | ||||||
| \(\pm\)2.24% | ||||||
| \(\pm\)0.37% | ||||||
| \(\pm\)0.34% | ||||||
| IA3 | ||||||
| \(\pm\)2.19% | ||||||
| \(\pm\)1.63% | ||||||
| \(\pm\)1.46% | ||||||
| \(\pm\)0.48% | ||||||
| \(\pm\)0.62% | ||||||
| \(\pm\)0.23% | ||||||
| ICL | ||||||
| \(\pm\)0.40% | ||||||
| \(\pm\)0.31% | ||||||
| \(\pm\)0.25% | ||||||
| \(\pm\)0.20% | ||||||
| \(\pm\)0.33% | ||||||
| \(\pm\)0.08% |
| \(|\mathcal{D}_{train}|\) | \(10\) | \(15\) | \(20\) | \(30\) | \(50\) | \(100\) |
|---|---|---|---|---|---|---|
| AHR (Ours) | ||||||
| \(\pm\)4.52% | ||||||
| \(\pm\)3.27% | ||||||
| \(\pm\)2.10% | ||||||
| \(\pm\)1.45% | ||||||
| \(\pm\)0.83% | ||||||
| \(\pm\)0.60% | ||||||
| LoRA | ||||||
| \(\pm\)4.22% | ||||||
| \(\pm\)4.38% | ||||||
| \(\pm\)1.85% | ||||||
| \(\pm\)5.27% | ||||||
| \(\pm\)0.45% | ||||||
| \(\pm\)1.61% | ||||||
| AdaLoRA | ||||||
| \(\pm\)4.14% | ||||||
| \(\pm\)5.18% | ||||||
| \(\pm\)2.74% | ||||||
| \(\pm\)1.69% | ||||||
| \(\pm\)1.93% | ||||||
| \(\pm\)1.45% | ||||||
| IA3 | ||||||
| \(\pm\)4.06% | ||||||
| \(\pm\)3.13% | ||||||
| \(\pm\)2.51% | ||||||
| \(\pm\)3.09% | ||||||
| \(\pm\)1.25% | ||||||
| \(\pm\)0.38% | ||||||
| ICL | ||||||
| \(\pm\)4.95% | – | – | – | – | – |
| \(|\mathcal{D}_{train}|\) | \(10\) | \(15\) | \(20\) | \(30\) | \(50\) | \(100\) |
|---|---|---|---|---|---|---|
| AHR (Ours) | ||||||
| \(\pm\)2.12% | ||||||
| \(\pm\)1.32% | ||||||
| \(\pm\)1.48% | ||||||
| \(\pm\)1.04% | ||||||
| \(\pm\)0.67% | ||||||
| \(\pm\)0.57% | ||||||
| LoRA | ||||||
| \(\pm\)1.38% | ||||||
| \(\pm\)2.10% | ||||||
| \(\pm\)1.27% | ||||||
| \(\pm\)1.22% | ||||||
| \(\pm\)2.35% | ||||||
| \(\pm\)0.66% | ||||||
| AdaLoRA | ||||||
| \(\pm\)2.85% | ||||||
| \(\pm\)1.75% | ||||||
| \(\pm\)1.15% | ||||||
| \(\pm\)1.44% | ||||||
| \(\pm\)2.41% | ||||||
| \(\pm\)5.80% | ||||||
| IA3 | ||||||
| \(\pm\)1.68% | ||||||
| \(\pm\)1.30% | ||||||
| \(\pm\)1.46% | ||||||
| \(\pm\)0.63% | ||||||
| \(\pm\)1.95% | ||||||
| \(\pm\)0.35% | ||||||
| ICL | ||||||
| \(\pm\)3.58% | ||||||
| \(\pm\)1.79% | ||||||
| \(\pm\)1.10% | ||||||
| \(\pm\)1.66% | ||||||
| \(\pm\)1.00% | ||||||
| \(\pm\)0.85% |
| \(|\mathcal{D}_{train}|\) | \(10\) | \(15\) | \(20\) | \(30\) | \(50\) | \(100\) |
|---|---|---|---|---|---|---|
| AHR (Ours) | ||||||
| \(\pm\)0.79% | ||||||
| \(\pm\)0.40% | ||||||
| \(\pm\)0.45% | ||||||
| \(\pm\)0.80% | ||||||
| \(\pm\)0.43% | ||||||
| \(\pm\)0.41% | ||||||
| LoRA | ||||||
| \(\pm\)0.44% | ||||||
| \(\pm\)1.02% | ||||||
| \(\pm\)0.86% | ||||||
| \(\pm\)1.56% | ||||||
| \(\pm\)0.58% | ||||||
| \(\pm\)0.56% | ||||||
| AdaLoRA | ||||||
| \(\pm\)0.34% | ||||||
| \(\pm\)0.75% | ||||||
| \(\pm\)1.54% | ||||||
| \(\pm\)1.38% | ||||||
| \(\pm\)0.43% | ||||||
| \(\pm\)0.51% | ||||||
| IA3 | ||||||
| \(\pm\)2.17% | ||||||
| \(\pm\)0.62% | ||||||
| \(\pm\)1.82% | ||||||
| \(\pm\)0.68% | ||||||
| \(\pm\)0.71% | ||||||
| \(\pm\)0.59% | ||||||
| ICL | ||||||
| \(\pm\)0.37% | ||||||
| \(\pm\)0.62% | ||||||
| \(\pm\)0.85% | ||||||
| \(\pm\)1.21% | ||||||
| \(\pm\)0.38% | ||||||
| \(\pm\)0.24% |
| \(|\mathcal{D}_{train}|\) | \(10\) | \(15\) | \(20\) | \(30\) | \(50\) | \(100\) |
|---|---|---|---|---|---|---|
| AHR (Ours) | ||||||
| \(\pm\)0.71% | ||||||
| \(\pm\)0.99% | ||||||
| \(\pm\)1.03% | ||||||
| \(\pm\)0.68% | ||||||
| \(\pm\)0.88% | ||||||
| \(\pm\)0.32% | ||||||
| LoRA | ||||||
| \(\pm\)1.70% | ||||||
| \(\pm\)6.00% | ||||||
| \(\pm\)1.19% | ||||||
| \(\pm\)0.62% | ||||||
| \(\pm\)0.99% | ||||||
| \(\pm\)1.80% | ||||||
| AdaLoRA | ||||||
| \(\pm\)1.54% | ||||||
| \(\pm\)1.90% | ||||||
| \(\pm\)1.87% | ||||||
| \(\pm\)1.60% | ||||||
| \(\pm\)1.63% | ||||||
| \(\pm\)0.25% | ||||||
| IA3 | ||||||
| \(\pm\)2.89% | ||||||
| \(\pm\)1.12% | ||||||
| \(\pm\)1.75% | ||||||
| \(\pm\)0.97% | ||||||
| \(\pm\)1.00% | ||||||
| \(\pm\)0.41% | ||||||
| ICL | ||||||
| \(\pm\)0.40% | ||||||
| \(\pm\)0.40% | ||||||
| \(\pm\)0.36% | ||||||
| \(\pm\)0.43% | ||||||
| \(\pm\)0.21% | ||||||
| \(\pm\)0.19% |
| \(|\mathcal{D}_{train}|\) | \(10\) | \(15\) | \(20\) | \(30\) | \(50\) | \(100\) |
|---|---|---|---|---|---|---|
| AHR (Ours) | ||||||
| \(\pm\)1.77% | ||||||
| \(\pm\)1.71% | ||||||
| \(\pm\)1.54% | ||||||
| \(\pm\)0.78% | ||||||
| \(\pm\)0.82% | ||||||
| \(\pm\)0.76% | ||||||
| LoRA | ||||||
| \(\pm\)4.83% | ||||||
| \(\pm\)1.48% | ||||||
| \(\pm\)2.28% | ||||||
| \(\pm\)1.65% | ||||||
| \(\pm\)1.25% | ||||||
| \(\pm\)0.76% | ||||||
| AdaLoRA | ||||||
| \(\pm\)2.13% | ||||||
| \(\pm\)2.41% | ||||||
| \(\pm\)2.34% | ||||||
| \(\pm\)2.06% | ||||||
| \(\pm\)2.74% | ||||||
| \(\pm\)1.26% | ||||||
| IA3 | ||||||
| \(\pm\)1.49% | ||||||
| \(\pm\)2.10% | ||||||
| \(\pm\)1.91% | ||||||
| \(\pm\)2.12% | ||||||
| \(\pm\)1.35% | ||||||
| \(\pm\)1.40% | ||||||
| ICL | ||||||
| \(\pm\)1.18% | ||||||
| \(\pm\)1.07% | ||||||
| \(\pm\)1.21% | – | – | – |
| \(|\mathcal{D}_{train}|\) | \(10\) | \(15\) | \(20\) | \(30\) | \(50\) | \(100\) |
|---|---|---|---|---|---|---|
| AHR (Ours) | ||||||
| \(\pm\)0.82% | ||||||
| \(\pm\)0.76% | ||||||
| \(\pm\)0.27% | ||||||
| \(\pm\)0.33% | ||||||
| \(\pm\)0.55% | ||||||
| \(\pm\)0.92% | ||||||
| LoRA | ||||||
| \(\pm\)0.58% | ||||||
| \(\pm\)0.94% | ||||||
| \(\pm\)0.44% | ||||||
| \(\pm\)0.48% | ||||||
| \(\pm\)0.66% | ||||||
| \(\pm\)1.32% | ||||||
| AdaLoRA | ||||||
| \(\pm\)0.31% | ||||||
| \(\pm\)0.49% | ||||||
| \(\pm\)0.61% | ||||||
| \(\pm\)0.39% | ||||||
| \(\pm\)1.18% | ||||||
| \(\pm\)1.31% | ||||||
| IA3 | ||||||
| \(\pm\)1.11% | ||||||
| \(\pm\)0.82% | ||||||
| \(\pm\)0.87% | ||||||
| \(\pm\)0.44% | ||||||
| \(\pm\)0.59% | ||||||
| \(\pm\)0.97% | ||||||
| ICL | ||||||
| \(\pm\)0.80% | ||||||
| \(\pm\)0.42% | ||||||
| \(\pm\)0.49% | ||||||
| \(\pm\)0.45% | ||||||
| \(\pm\)0.44% | ||||||
| \(\pm\)0.24% |
| \(|\mathcal{D}_{train}|\) | \(10\) | \(15\) | \(20\) | \(30\) | \(50\) | \(100\) |
|---|---|---|---|---|---|---|
| AHR (Ours) | ||||||
| \(\pm\)1.35% | ||||||
| \(\pm\)1.29% | ||||||
| \(\pm\)1.32% | ||||||
| \(\pm\)1.22% | ||||||
| \(\pm\)0.84% | ||||||
| \(\pm\)0.88% | ||||||
| LoRA | ||||||
| \(\pm\)0.84% | ||||||
| \(\pm\)1.42% | ||||||
| \(\pm\)1.22% | ||||||
| \(\pm\)0.89% | ||||||
| \(\pm\)1.21% | ||||||
| \(\pm\)0.89% | ||||||
| AdaLoRA | ||||||
| \(\pm\)1.06% | ||||||
| \(\pm\)0.98% | ||||||
| \(\pm\)1.52% | ||||||
| \(\pm\)0.72% | ||||||
| \(\pm\)1.01% | ||||||
| \(\pm\)0.91% | ||||||
| IA3 | ||||||
| \(\pm\)0.96% | ||||||
| \(\pm\)1.27% | ||||||
| \(\pm\)1.80% | ||||||
| \(\pm\)1.53% | ||||||
| \(\pm\)0.67% | ||||||
| \(\pm\)2.50% | ||||||
| ICL | ||||||
| \(\pm\)0.76% | ||||||
| \(\pm\)1.07% | ||||||
| \(\pm\)0.96% | ||||||
| \(\pm\)0.65% | ||||||
| \(\pm\)1.07% | ||||||
| \(\pm\)0.41% |
| \(|\mathcal{D}_{train}|\) | \(10\) | \(15\) | \(20\) | \(30\) | \(50\) | \(100\) |
|---|---|---|---|---|---|---|
| AHR (Ours) | ||||||
| \(\pm\)2.23% | ||||||
| \(\pm\)1.29% | ||||||
| \(\pm\)0.82% | ||||||
| \(\pm\)1.07% | ||||||
| \(\pm\)1.11% | ||||||
| \(\pm\)0.87% | ||||||
| LoRA | ||||||
| \(\pm\)2.52% | ||||||
| \(\pm\)3.68% | ||||||
| \(\pm\)4.63% | ||||||
| \(\pm\)2.50% | ||||||
| \(\pm\)5.99% | ||||||
| \(\pm\)2.74% | ||||||
| AdaLoRA | ||||||
| \(\pm\)2.14% | ||||||
| \(\pm\)1.31% | ||||||
| \(\pm\)4.09% | ||||||
| \(\pm\)1.04% | ||||||
| \(\pm\)1.47% | ||||||
| \(\pm\)1.47% | ||||||
| IA3 | ||||||
| \(\pm\)1.71% | ||||||
| \(\pm\)2.09% | ||||||
| \(\pm\)5.19% | ||||||
| \(\pm\)1.19% | ||||||
| \(\pm\)1.60% | ||||||
| \(\pm\)0.99% | ||||||
| ICL | ||||||
| \(\pm\)0.41% | ||||||
| \(\pm\)0.59% | ||||||
| \(\pm\)0.36% | ||||||
| \(\pm\)0.44% | ||||||
| \(\pm\)0.34% | ||||||
| \(\pm\)0.36% |
| \(|\mathcal{D}_{train}|\) | \(10\) | \(15\) | \(20\) | \(30\) | \(50\) | \(100\) |
|---|---|---|---|---|---|---|
| AHR (Ours) | ||||||
| \(\pm\)3.46% | ||||||
| \(\pm\)1.69% | ||||||
| \(\pm\)1.49% | ||||||
| \(\pm\)1.21% | ||||||
| \(\pm\)1.03% | ||||||
| \(\pm\)0.73% | ||||||
| LoRA | ||||||
| \(\pm\)10.90% | ||||||
| \(\pm\)9.12% | ||||||
| \(\pm\)2.32% | ||||||
| \(\pm\)3.65% | ||||||
| \(\pm\)2.67% | ||||||
| \(\pm\)0.79% | ||||||
| AdaLoRA | ||||||
| \(\pm\)6.92% | ||||||
| \(\pm\)2.56% | ||||||
| \(\pm\)3.44% | ||||||
| \(\pm\)2.25% | ||||||
| \(\pm\)1.26% | ||||||
| \(\pm\)1.74% | ||||||
| IA3 | ||||||
| \(\pm\)6.87% | ||||||
| \(\pm\)10.27% | ||||||
| \(\pm\)11.17% | ||||||
| \(\pm\)7.57% | ||||||
| \(\pm\)4.33% | ||||||
| \(\pm\)1.15% | ||||||
| ICL | ||||||
| \(\pm\)0.58% | ||||||
| \(\pm\)1.67% | – | – | – | – |
| \(|\mathcal{D}_{train}|\) | \(10\) | \(15\) | \(20\) | \(30\) | \(50\) | \(100\) |
|---|---|---|---|---|---|---|
| AHR (Ours) | ||||||
| \(\pm\)2.92% | ||||||
| \(\pm\)2.70% | ||||||
| \(\pm\)2.82% | ||||||
| \(\pm\)1.26% | ||||||
| \(\pm\)1.33% | ||||||
| \(\pm\)1.05% | ||||||
| LoRA | ||||||
| \(\pm\)10.01% | ||||||
| \(\pm\)7.54% | ||||||
| \(\pm\)9.74% | ||||||
| \(\pm\)7.68% | ||||||
| \(\pm\)1.40% | ||||||
| \(\pm\)0.99% | ||||||
| AdaLoRA | ||||||
| \(\pm\)7.96% | ||||||
| \(\pm\)2.77% | ||||||
| \(\pm\)2.81% | ||||||
| \(\pm\)1.78% | ||||||
| \(\pm\)1.56% | ||||||
| \(\pm\)1.39% | ||||||
| IA3 | ||||||
| \(\pm\)7.65% | ||||||
| \(\pm\)9.42% | ||||||
| \(\pm\)3.26% | ||||||
| \(\pm\)0.96% | ||||||
| \(\pm\)0.97% | ||||||
| \(\pm\)1.08% | ||||||
| ICL | ||||||
| \(\pm\)3.13% | ||||||
| \(\pm\)3.27% | ||||||
| \(\pm\)2.07% | ||||||
| \(\pm\)1.54% | ||||||
| \(\pm\)1.11% | ||||||
| \(\pm\)0.45% |
| \(|\mathcal{D}_{train}|\) | \(10\) | \(15\) | \(20\) | \(30\) | \(50\) | \(100\) |
|---|---|---|---|---|---|---|
| AHR (Ours) | ||||||
| \(\pm\)1.05% | ||||||
| \(\pm\)1.10% | ||||||
| \(\pm\)1.33% | ||||||
| \(\pm\)1.29% | ||||||
| \(\pm\)0.96% | ||||||
| \(\pm\)0.66% | ||||||
| LoRA | ||||||
| \(\pm\)1.83% | ||||||
| \(\pm\)1.75% | ||||||
| \(\pm\)0.96% | ||||||
| \(\pm\)6.29% | ||||||
| \(\pm\)0.53% | ||||||
| \(\pm\)0.60% | ||||||
| AdaLoRA | ||||||
| \(\pm\)1.32% | ||||||
| \(\pm\)2.09% | ||||||
| \(\pm\)1.19% | ||||||
| \(\pm\)2.65% | ||||||
| \(\pm\)1.21% | ||||||
| \(\pm\)0.80% | ||||||
| IA3 | ||||||
| \(\pm\)13.72% | ||||||
| \(\pm\)3.68% | ||||||
| \(\pm\)1.74% | ||||||
| \(\pm\)1.40% | ||||||
| \(\pm\)0.50% | ||||||
| \(\pm\)1.01% | ||||||
| ICL | ||||||
| \(\pm\)1.04% | ||||||
| \(\pm\)0.96% | ||||||
| \(\pm\)0.87% | ||||||
| \(\pm\)0.38% | ||||||
| \(\pm\)0.68% | ||||||
| \(\pm\)0.27% |
| \(|\mathcal{D}_{train}|\) | \(10\) | \(15\) | \(20\) | \(30\) | \(50\) | \(100\) |
|---|---|---|---|---|---|---|
| AHR (Ours) | ||||||
| \(\pm\)0.88% | ||||||
| \(\pm\)0.95% | ||||||
| \(\pm\)1.18% | ||||||
| \(\pm\)0.91% | ||||||
| \(\pm\)0.82% | ||||||
| \(\pm\)0.42% | ||||||
| LoRA | ||||||
| \(\pm\)8.40% | ||||||
| \(\pm\)8.64% | ||||||
| \(\pm\)8.57% | ||||||
| \(\pm\)0.93% | ||||||
| \(\pm\)0.71% | ||||||
| \(\pm\)0.39% | ||||||
| AdaLoRA | ||||||
| \(\pm\)1.96% | ||||||
| \(\pm\)0.95% | ||||||
| \(\pm\)5.88% | ||||||
| \(\pm\)7.82% | ||||||
| \(\pm\)0.93% | ||||||
| \(\pm\)0.48% | ||||||
| IA3 | ||||||
| \(\pm\)12.54% | ||||||
| \(\pm\)8.45% | ||||||
| \(\pm\)0.71% | ||||||
| \(\pm\)2.34% | ||||||
| \(\pm\)0.66% | ||||||
| \(\pm\)0.59% | ||||||
| ICL | ||||||
| \(\pm\)0.82% | ||||||
| \(\pm\)0.63% | ||||||
| \(\pm\)0.45% | ||||||
| \(\pm\)0.35% | ||||||
| \(\pm\)0.34% | ||||||
| \(\pm\)0.30% |
| \(|\mathcal{D}_{train}|\) | \(10\) | \(15\) | \(20\) | \(30\) | \(50\) | \(100\) |
|---|---|---|---|---|---|---|
| AHR (Ours) | ||||||
| \(\pm\)1.08% | ||||||
| \(\pm\)1.56% | ||||||
| \(\pm\)1.67% | ||||||
| \(\pm\)2.16% | ||||||
| \(\pm\)0.54% | ||||||
| \(\pm\)1.60% | ||||||
| LoRA | ||||||
| \(\pm\)5.78% | ||||||
| \(\pm\)8.28% | ||||||
| \(\pm\)9.05% | ||||||
| \(\pm\)5.72% | ||||||
| \(\pm\)5.83% | ||||||
| \(\pm\)1.95% | ||||||
| AdaLoRA | ||||||
| \(\pm\)2.58% | ||||||
| \(\pm\)2.38% | ||||||
| \(\pm\)1.73% | ||||||
| \(\pm\)2.09% | ||||||
| \(\pm\)0.59% | ||||||
| \(\pm\)1.29% | ||||||
| IA3 | ||||||
| \(\pm\)7.20% | ||||||
| \(\pm\)5.83% | ||||||
| \(\pm\)8.47% | ||||||
| \(\pm\)2.18% | ||||||
| \(\pm\)2.23% | ||||||
| \(\pm\)1.58% | ||||||
| ICL | ||||||
| \(\pm\)0.11% | ||||||
| \(\pm\)0.04% | ||||||
| \(\pm\)0.04% | – | – | – |
| \(|\mathcal{D}_{train}|\) | \(10\) | \(15\) | \(20\) | \(30\) | \(50\) | \(100\) |
|---|---|---|---|---|---|---|
| AHR (Ours) | ||||||
| \(\pm\)0.95% | ||||||
| \(\pm\)2.05% | ||||||
| \(\pm\)1.36% | ||||||
| \(\pm\)1.12% | ||||||
| \(\pm\)0.98% | ||||||
| \(\pm\)0.61% | ||||||
| LoRA | ||||||
| \(\pm\)1.85% | ||||||
| \(\pm\)7.72% | ||||||
| \(\pm\)1.76% | ||||||
| \(\pm\)7.14% | ||||||
| \(\pm\)1.00% | ||||||
| \(\pm\)0.77% | ||||||
| AdaLoRA | ||||||
| \(\pm\)6.66% | ||||||
| \(\pm\)1.97% | ||||||
| \(\pm\)1.59% | ||||||
| \(\pm\)2.13% | ||||||
| \(\pm\)1.16% | ||||||
| \(\pm\)0.81% | ||||||
| IA3 | ||||||
| \(\pm\)8.18% | ||||||
| \(\pm\)7.27% | ||||||
| \(\pm\)6.65% | ||||||
| \(\pm\)1.39% | ||||||
| \(\pm\)1.15% | ||||||
| \(\pm\)0.84% | ||||||
| ICL | ||||||
| \(\pm\)1.45% | ||||||
| \(\pm\)1.63% | ||||||
| \(\pm\)1.47% | ||||||
| \(\pm\)1.56% | ||||||
| \(\pm\)0.57% | ||||||
| \(\pm\)1.23% |
| \(|\mathcal{D}_{train}|\) | \(10\) | \(15\) | \(20\) | \(30\) | \(50\) | \(100\) |
|---|---|---|---|---|---|---|
| AHR (Ours) | ||||||
| \(\pm\)1.62% | ||||||
| \(\pm\)1.55% | ||||||
| \(\pm\)1.88% | ||||||
| \(\pm\)1.26% | ||||||
| \(\pm\)0.65% | ||||||
| \(\pm\)0.49% | ||||||
| LoRA | ||||||
| \(\pm\)7.59% | ||||||
| \(\pm\)0.65% | ||||||
| \(\pm\)1.92% | ||||||
| \(\pm\)2.06% | ||||||
| \(\pm\)0.75% | ||||||
| \(\pm\)0.67% | ||||||
| AdaLoRA | ||||||
| \(\pm\)3.93% | ||||||
| \(\pm\)5.78% | ||||||
| \(\pm\)1.95% | ||||||
| \(\pm\)0.79% | ||||||
| \(\pm\)0.77% | ||||||
| \(\pm\)0.53% | ||||||
| IA3 | ||||||
| \(\pm\)4.59% | ||||||
| \(\pm\)2.95% | ||||||
| \(\pm\)7.57% | ||||||
| \(\pm\)7.65% | ||||||
| \(\pm\)0.66% | ||||||
| \(\pm\)0.73% | ||||||
| ICL | ||||||
| \(\pm\)1.82% | ||||||
| \(\pm\)0.88% | ||||||
| \(\pm\)1.06% | ||||||
| \(\pm\)1.02% | ||||||
| \(\pm\)0.43% | ||||||
| \(\pm\)0.47% |
| \(|\mathcal{D}_{train}|\) | \(10\) | \(15\) | \(20\) | \(30\) | \(50\) | \(100\) |
|---|---|---|---|---|---|---|
| AHR (Ours) | ||||||
| \(\pm\)0.70% | ||||||
| \(\pm\)0.73% | ||||||
| \(\pm\)0.65% | ||||||
| \(\pm\)0.61% | ||||||
| \(\pm\)0.24% | ||||||
| \(\pm\)0.35% | ||||||
| LoRA | ||||||
| \(\pm\)12.16% | ||||||
| \(\pm\)8.19% | ||||||
| \(\pm\)7.90% | ||||||
| \(\pm\)0.95% | ||||||
| \(\pm\)0.38% | ||||||
| \(\pm\)0.29% | ||||||
| AdaLoRA | ||||||
| \(\pm\)5.78% | ||||||
| \(\pm\)2.07% | ||||||
| \(\pm\)1.12% | ||||||
| \(\pm\)0.42% | ||||||
| \(\pm\)1.48% | ||||||
| \(\pm\)0.31% | ||||||
| IA3 | ||||||
| \(\pm\)8.64% | ||||||
| \(\pm\)4.14% | ||||||
| \(\pm\)0.78% | ||||||
| \(\pm\)2.29% | ||||||
| \(\pm\)1.17% | ||||||
| \(\pm\)0.40% | ||||||
| ICL | ||||||
| \(\pm\)0.64% | ||||||
| \(\pm\)0.56% | ||||||
| \(\pm\)0.49% | ||||||
| \(\pm\)0.36% | ||||||
| \(\pm\)0.27% | ||||||
| \(\pm\)0.26% |
| \(|\mathcal{D}_{train}|\) | \(10\) | \(15\) | \(20\) | \(30\) | \(50\) | \(100\) |
|---|---|---|---|---|---|---|
| AHR (Ours) | ||||||
| \(\pm\)3.82% | ||||||
| \(\pm\)4.01% | ||||||
| \(\pm\)3.94% | ||||||
| \(\pm\)2.01% | ||||||
| \(\pm\)1.30% | ||||||
| \(\pm\)1.37% | ||||||
| LoRA | ||||||
| \(\pm\)10.18% | ||||||
| \(\pm\)6.00% | ||||||
| \(\pm\)2.79% | ||||||
| \(\pm\)2.48% | ||||||
| \(\pm\)1.61% | ||||||
| \(\pm\)0.56% | ||||||
| AdaLoRA | ||||||
| \(\pm\)6.62% | ||||||
| \(\pm\)3.51% | ||||||
| \(\pm\)3.71% | ||||||
| \(\pm\)8.84% | ||||||
| \(\pm\)11.20% | ||||||
| \(\pm\)5.35% | ||||||
| IA3 | ||||||
| \(\pm\)10.03% | ||||||
| \(\pm\)4.89% | ||||||
| \(\pm\)11.76% | ||||||
| \(\pm\)4.85% | ||||||
| \(\pm\)9.33% | ||||||
| \(\pm\)11.19% | ||||||
| ICL | ||||||
| \(\pm\)1.97% | ||||||
| \(\pm\)2.34% | – | – | – | – |
| \(|\mathcal{D}_{train}|\) | \(10\) | \(15\) | \(20\) | \(30\) | \(50\) | \(100\) |
|---|---|---|---|---|---|---|
| AHR (Ours) | ||||||
| \(\pm\)2.25% | ||||||
| \(\pm\)3.55% | ||||||
| \(\pm\)2.03% | ||||||
| \(\pm\)1.27% | ||||||
| \(\pm\)0.99% | ||||||
| \(\pm\)1.12% | ||||||
| LoRA | ||||||
| \(\pm\)10.45% | ||||||
| \(\pm\)9.96% | ||||||
| \(\pm\)2.21% | ||||||
| \(\pm\)1.62% | ||||||
| \(\pm\)1.19% | ||||||
| \(\pm\)0.66% | ||||||
| AdaLoRA | ||||||
| \(\pm\)8.25% | ||||||
| \(\pm\)11.32% | ||||||
| \(\pm\)1.39% | ||||||
| \(\pm\)12.91% | ||||||
| \(\pm\)1.06% | ||||||
| \(\pm\)1.12% | ||||||
| IA3 | ||||||
| \(\pm\)3.18% | ||||||
| \(\pm\)8.10% | ||||||
| \(\pm\)3.28% | ||||||
| \(\pm\)1.50% | ||||||
| \(\pm\)0.72% | ||||||
| \(\pm\)3.70% | ||||||
| ICL | ||||||
| \(\pm\)3.09% | ||||||
| \(\pm\)2.96% | ||||||
| \(\pm\)2.52% | ||||||
| \(\pm\)1.19% | ||||||
| \(\pm\)0.33% | ||||||
| \(\pm\)0.28% |
| \(|\mathcal{D}_{train}|\) | \(10\) | \(15\) | \(20\) | \(30\) | \(50\) | \(100\) |
|---|---|---|---|---|---|---|
| AHR (Ours) | ||||||
| \(\pm\)3.14% | ||||||
| \(\pm\)1.56% | ||||||
| \(\pm\)1.33% | ||||||
| \(\pm\)0.62% | ||||||
| \(\pm\)0.64% | ||||||
| \(\pm\)0.55% | ||||||
| LoRA | ||||||
| \(\pm\)3.55% | ||||||
| \(\pm\)1.26% | ||||||
| \(\pm\)1.08% | ||||||
| \(\pm\)9.76% | ||||||
| \(\pm\)0.94% | ||||||
| \(\pm\)0.77% | ||||||
| AdaLoRA | ||||||
| \(\pm\)7.65% | ||||||
| \(\pm\)1.97% | ||||||
| \(\pm\)8.66% | ||||||
| \(\pm\)1.85% | ||||||
| \(\pm\)0.93% | ||||||
| \(\pm\)9.00% | ||||||
| IA3 | ||||||
| \(\pm\)2.28% | ||||||
| \(\pm\)2.12% | ||||||
| \(\pm\)1.45% | ||||||
| \(\pm\)0.99% | ||||||
| \(\pm\)0.87% | ||||||
| \(\pm\)6.16% | ||||||
| ICL | ||||||
| \(\pm\)1.86% | ||||||
| \(\pm\)1.05% | ||||||
| \(\pm\)0.80% | ||||||
| \(\pm\)1.10% | ||||||
| \(\pm\)0.40% | ||||||
| \(\pm\)0.27% |
| \(|\mathcal{D}_{train}|\) | \(10\) | \(15\) | \(20\) | \(30\) | \(50\) | \(100\) |
|---|---|---|---|---|---|---|
| AHR (Ours) | ||||||
| \(\pm\)2.61% | ||||||
| \(\pm\)2.05% | ||||||
| \(\pm\)1.43% | ||||||
| \(\pm\)0.55% | ||||||
| \(\pm\)0.39% | ||||||
| \(\pm\)0.53% | ||||||
| LoRA | ||||||
| \(\pm\)8.80% | ||||||
| \(\pm\)11.45% | ||||||
| \(\pm\)9.45% | ||||||
| \(\pm\)2.07% | ||||||
| \(\pm\)3.91% | ||||||
| \(\pm\)0.57% | ||||||
| AdaLoRA | ||||||
| \(\pm\)3.45% | ||||||
| \(\pm\)0.81% | ||||||
| \(\pm\)8.73% | ||||||
| \(\pm\)0.98% | ||||||
| \(\pm\)0.60% | ||||||
| \(\pm\)1.17% | ||||||
| IA3 | ||||||
| \(\pm\)5.08% | ||||||
| \(\pm\)8.71% | ||||||
| \(\pm\)4.32% | ||||||
| \(\pm\)5.19% | ||||||
| \(\pm\)6.49% | ||||||
| \(\pm\)5.59% | ||||||
| ICL | ||||||
| \(\pm\)0.78% | ||||||
| \(\pm\)1.01% | ||||||
| \(\pm\)0.75% | ||||||
| \(\pm\)0.71% | ||||||
| \(\pm\)0.29% | ||||||
| \(\pm\)0.32% |
Code to use AHR(fully compatible with the peft package) and to reproduce our experiments will be available on Github at github.com/tuomaso/attention-head-reweighting↩︎