IA3 › The IA3 Formulation
Language AI HandbookAll chapters IA3 › The IA3 FormulationOne section · Sections in this chapter2 / 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
To understand IA3 precisely, we need to first establish where in the transformer architecture it intervenes and why those specific locations were chosen. The choice of intervention points is not arbitrary: the IA3 authors made deliberate decisions based on where learned rescaling would have the most impact on downstream task performance, and understanding their reasoning deepens your intuition for the method as a whole.
A transformer block processes input through two major computational streams. The first is multi-head self-attention, which mixes information across positions. The second is the position-wise feed-forward network, which applies learned nonlinear transformations to each position independently. IA3 intervenes at three points: the key projections of attention, the value projections of attention, and the intermediate activations of the feed-forward network. Each intervention point controls a different aspect of how information flows through the model.
Skipping the query projection is a deliberate choice. Queries encode what a position is searching for, and modifying them would change the pattern of what information each position attends to. But keys and values play complementary roles that are arguably more important for task adaptation. Keys determine which other positions appear needed to each query. Values determine what information gets retrieved when attention weights are high. By rescaling keys, IA3 can change the effective relevance of token positions without changing the queries themselves. By rescaling values, IA3 can change the magnitude of information retrieved from different positions. Together, these two interventions give IA3 fine-grained control over what information each position collects from the context. The decision to include feed-forward intermediate activations reflects the fact that feed-forward networks in transformers function as key-value memories that store factual knowledge; rescaling their intermediate activations allows IA3 to selectively activate or suppress learned knowledge pathways.
Transformer Layer Computations
In multi-head attention, the model begins by computing queries, keys, and values through linear projections of the input:
where:
- : the query matrix, shape
- : the key matrix, shape
- : the value matrix, shape
- : the input sequence matrix, shape
- : the query projection weight, shape
- : the key projection weight, shape
- : the value projection weight, shape
- : the number of tokens in the sequence
- : the model hidden dimension
These projections then participate in scaled dot-product attention, where the query-key dot product determines attention weights and those weights are used to aggregate the values. The feed-forward network applies to each position independently after the attention output is combined and normalized, transforming the representation through a higher-dimensional space before projecting back down.
IA3 Rescaling Vectors
IA3 introduces three learned vectors per transformer layer:
- for rescaling the key projections
- for rescaling the value projections
- for rescaling feed-forward intermediate activations
The modified key and value computations become:
where:
- : the rescaled key matrix, shape
- : the rescaled value matrix, shape
- : the learned rescaling vector for keys, shape
- : the learned rescaling vector for values, shape
- : the standard key projection of the input
- : the standard value projection of the input
- : element-wise multiplication, broadcast across the sequence length dimension
To see exactly how the broadcasting works, think about the shapes involved. The standard key projection has shape : one -dimensional key vector per token. The rescaling vector has shape . When you broadcast this multiplication, multiplies the -th dimension of every token's key vector simultaneously. If , the -th coordinate of every key in the sequence gets doubled. If , the -th coordinate of every key gets compressed to 30% of its original value. Every token in the sequence experiences the same rescaling, which is both a strength and a limitation: the rescaling is consistent and interpretable, but it cannot adapt differently to different positions.
The Hadamard product, denoted , performs element-wise multiplication between vectors or matrices of the same shape. For two vectors , the Hadamard product gives for each index . For matrices, the operation applies to corresponding elements. This differs from the standard matrix product, which sums over the inner dimension. In IA3, the Hadamard product is applied with broadcasting: the scalar rescaling vector of shape is broadcast across the sequence dimension to multiply a matrix of shape .
Feed-Forward Rescaling
For the feed-forward network, recall the standard two-layer structure. The input first passes through a linear projection to a higher-dimensional intermediate space, then through a nonlinearity, and finally through a second projection back to the original dimension:
where is the activation function (typically GELU in modern transformers), maps from to , and maps from back to . The intermediate representation lives in the larger -dimensional space, which is where the model stores much of its factual and contextual knowledge.
IA3 applies its rescaling to this intermediate representation:
where:
- : the rescaled intermediate activation, shape
- : the learned rescaling vector for feed-forward, shape
- : the original intermediate activation , shape
- : element-wise multiplication, broadcast across sequence positions
- : the activation function, such as GELU
- : the first feed-forward projection, shape
The full modified feed-forward computation then becomes:
The choice to rescale after the activation function rather than before is real. Before the activation, the values are linear projections with no sparsity structure. After the activation, especially with GELU or ReLU-like functions, many dimensions are near zero and a few are strongly activated. Rescaling after the activation means IA3 is working with the already-processed, nonlinearly transformed intermediate representations. It can amplify dimensions that are already highly activated (meaning the model found them relevant) or further suppress dimensions that are already near zero.
The key insight is that these rescaling operations work entirely in activation space. No weight matrix is ever modified. The model's learned linear transformations, its attention patterns in the absence of rescaling, and its feed-forward computations all remain perfectly intact. IA3's vectors form a thin layer of per-dimension "volume controls" that sit on top of the existing computations, redirecting information flow without changing the underlying computational primitives.
Initialization Strategy
IA3 initializes all rescaling vectors to all-ones: . This is not a minor implementation detail; it is the key to why IA3 starts training from a stable, interpretable baseline.
When all rescaling values equal 1, the operation simplifies to . Every activation passes through unchanged. The adapted model at initialization is therefore identical in behavior to the original pretrained model. There are no random perturbations, no scaling factors that might shift training dynamics, no initial distortion of the representations the model has learned over many billions of pretraining tokens. The first gradient step moves the rescaling vectors slightly away from the all-ones vector in whatever directions the task loss indicates are beneficial, and training proceeds from there.
This initialization strategy contrasts thoughtfully with LoRA's approach. In LoRA, matrix is initialized to all zeros and matrix is initialized with small random Gaussian values. The initial adaptation , so the LoRA-adapted model is also identical to the pretrained model at initialization. But LoRA reaches this through cancellation (zero times anything is zero), while IA3 reaches it through identity scaling (one times anything is itself). Both approaches reach the same goal of starting from the pretrained model, but through philosophically different mechanisms. The IA3 approach is arguably more direct: the adaptation starts as a no-op because every individual scaling value is exactly one, not because two matrices happen to multiply to zero.


Reformulation as Diagonal Matrix Multiplication
The element-wise multiplication in IA3 has an elegant matrix-algebraic interpretation that reveals its basic constraints and expressivity. If we define as the diagonal matrix with the rescaling vector on its main diagonal and zeros everywhere else, then the element-wise multiplication is equivalent to right-multiplying the projected representation by this diagonal matrix:
where:
- : the rescaled key matrix
- : the rescaling vector, shape
- : the input sequence, shape
- : the pretrained key projection, shape
- : the diagonal matrix formed from , shape
This reformulation exposes a key algebraic fact: we could equivalently think of IA3 as right-multiplying the weight matrix by the diagonal matrix . The effective weight matrix after IA3 adaptation would be . Each column of gets scaled by the corresponding entry of . This observation is what lets inference-time merging of IA3 into the base model, which we will cover later.
More importantly, this reformulation reveals the expressivity class that IA3 belongs to. A diagonal matrix can only stretch or compress coordinates independently along the existing axes. It cannot rotate the coordinate system. It cannot mix information between dimensions. It cannot create new directions in the representation space. Compare this to LoRA's update , where and are general and matrices respectively. The product can express any linear transformation of rank at most : rotations, reflections, projections onto arbitrary subspaces, and more. IA3's diagonal update is strictly less expressive than LoRA's rank-1 update for any . Yet IA3 often performs comparably in practice, which tells us something deep about the nature of fine-tuning.