IA3 › Understanding Learned Rescaling Vectors

Michael BrenndoerferDecember 6, 20257 min read
Language AI HandbookAll chapters
Part 35 of 67Parameter-Efficient Fine-tuning
Chapter 261IA3 › Understanding Learned Rescaling Vectors
Reading section 3 of 11 · Understanding Learned Rescaling Vectors · 7 minSection 3 of 11 · 7 min

Book contents

Section 3 of 11 · 7 min read

IA3 › Understanding Learned Rescaling VectorsOne section · Sections in this chapter3 / 11 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

Why does rescaling activations work for task adaptation? The answer requires understanding what pretrained models have learned and what information is encoded in the dimensions of key, value, and feed-forward representations.

During pretraining, a language model develops representations that encode a large variety of information simultaneously. Individual dimensions of a representation do not correspond to neat, interpretable concepts in general. However, research on mechanistic interpretability has shown that groups of dimensions consistently activate for related inputs, and that the model uses these distributed representations in organized ways. Some dimensions are more sensitive to syntactic structure; others to semantic content; still others to discourse-level phenomena like topic or sentiment. These patterns emerge from the pretraining objective, where the model must learn to predict tokens from context across billions of diverse text examples.

When you fine-tune for a specific downstream task, you often do not need the model to learn entirely new patterns. If you are fine-tuning for sentiment analysis, the model already understands positive and negative words, understands intensifiers like "very" and "absolutely," understands negation. What you need is for the model to prioritize these existing capabilities in its attention and processing. IA3's rescaling vectors learn exactly this prioritization. Think of it as a spotlight: the pretrained model has developed a wide-angle view of language, and IA3 learns to focus that view on the dimensions most needed to your task.

Consider the attention mechanism more concretely. When a token queries the context, it computes dot products with every key in the sequence. These dot products determine attention weights. By rescaling keys, IA3 can change which tokens appear most "relevant" to any given query without changing what the tokens are querying for. Suppose a dimension of the key representation reliably encodes "this is a sentiment-bearing word." Before IA3 adaptation, this dimension contributes equally to attention scores alongside dozens of other dimensions. After IA3 adaptation on a sentiment task, this dimension might be amplified by a factor of 3, making sentiment-bearing words more salient to every query in the sequence. The pretrained model already had this information; IA3 simply turned up the volume on it.

The Role of Feature Specialization

Research on large language models has found that the dimensions of their internal representations exhibit a property sometimes called "feature specialization." This means that certain groups of dimensions, while not individually interpretable, collectively encode specific types of information. When you apply IA3, you are learning to modulate these feature groups. A rescaling value far above 1 on a set of dimensions increases the contribution of whatever those dimensions collectively stand for to the model's downstream computations. A rescaling value near 0 effectively silences those dimensions, as if they were never computed at all.

This view helps explain why IA3 works well in few-shot scenarios. With only a handful of training examples, a model needs to make inferences about which existing capabilities are relevant, not learn new capabilities from scratch. If you have 50 examples of medical question answering, IA3 can learn which dimensions of the pretrained representations are most associated with accurate medical reasoning. But IA3 cannot learn new medical facts from 50 examples; it can only make the medical knowledge already present in the pretrained model easier to access. This is a feature in few-shot settings, where the risk of overfitting to scarce data is high, and a limitation when the downstream task requires knowledge absent from the pretrained model.

In[5]:
Code
import numpy as np

# Simulate learned IA3 vectors (in practice these would come from training)
np.random.seed(42)

# Simulate l_k: some dimensions amplified, others suppressed
l_k_learned = np.ones(128)
# Amplify certain "sentiment-related" dimensions
l_k_learned[10:20] = np.random.uniform(1.5, 2.5, 10)
# Suppress "syntactic" dimensions
l_k_learned[50:70] = np.random.uniform(0.3, 0.7, 20)
# Add some noise to others
l_k_learned += np.random.normal(0, 0.1, 128)

# Simulate l_ff: stronger adaptation in feed-forward
l_ff_learned = np.ones(512)
l_ff_learned[100:150] = np.random.uniform(2.0, 3.0, 50)  # Strongly amplified
l_ff_learned[300:400] = np.random.uniform(0.1, 0.5, 100)  # Strongly suppressed
l_ff_learned += np.random.normal(0, 0.15, 512)
Out[6]:
Visualization
Histogram of key rescaling values across 128 dimensions showing a blue distribution centered near 1.0 with tails extending to 0.5 and 2.5, with a red dashed vertical line at 1.0 marking the initial value.
Key rescaling factors across 128 dimensions cluster tightly around 1.0, showing modest reweighting during adaptation. Most dimensions remain between 0.8 and 1.2, showing that key representation adaptation relies on subtle adjustments rather than large amplification or suppression. A subset of dimensions is amplified toward 2.0 and another cluster is suppressed below 0.7, corresponding to the learned task-specific emphasis.
Histogram of feed-forward rescaling values across 512 dimensions showing a coral distribution with three visible clusters at 0.1-0.5, around 1.0, and at 2.0-3.0, with a red dashed vertical line at 1.0.
Feed-forward rescaling factors across 512 dimensions show a wide spread from 0.1 to 3.0, with three distinct clusters: amplified dimensions (2.0 to 3.0), near-identity dimensions (around 1.0), and suppressed dimensions (0.1 to 0.5). The broader distribution compared to the key vector shows that task adaptation relies more heavily on selectively activating and suppressing feed-forward pathways, which encode factual knowledge and semantic reasoning.

The histograms show how learned rescaling vectors deviate from their initial uniform value of 1.0 after task-specific training. The key rescaling vectors tend to be modestly perturbed: most dimensions remain near their initial values, and only a small subset is substantially amplified or suppressed. The feed-forward rescaling vectors often show more large deviations. This pattern is consistent with the hypothesis that feed-forward networks in transformers encode factual and semantic knowledge that may need substantial emphasis or de-emphasis for specific tasks, while attention keys primarily need fine-grained relevance adjustments.

Out[7]:
Visualization
Bar chart of IA3 feed-forward rescaling deviations from 1.0 across 512 dimension indices. Coral bars rise above zero for amplified dimensions and blue bars dip below zero for suppressed dimensions, with contiguous color clusters visible across the index range.
Per-dimension rescaling factors for 512 feed-forward dimensions shown as deviations from the initial value of 1.0. Coral bars indicate amplified dimensions (values above 1.0) and blue bars indicate suppressed dimensions (values below 1.0). Contiguous clusters of similar colors suggest the model learns to activate or suppress groups of related features together, exploiting the organized feature structure that emerged during pretraining.

This dimension-wise view of the feed-forward rescaling reveals that IA3 learns structured patterns rather than random noise. Consecutive dimensions often share the same sign of deviation, suggesting the model discovers real groups of features to amplify or suppress together. This structure is not enforced by the IA3 formulation; it emerges organically from gradient descent on the task loss. The emergence of such structure is additional evidence that the pretrained model's internal representations have organized geometry that IA3 learns to exploit.