- Rating
- 3
- Confidence
- 2
- Informativeness
- 2
- Presentation
- 3
- Soundness
- 2
Read review
Paper summary
This paper provides a theoretical understanding of how attention heads in multi-head softmax Transformers develop specialized roles during training on compositional in-context learning (ICL) tasks. The authors further show how the learned model generalizes to unseen combinations of component mappings and out-of-domain pattern families.
Critical strengths
-
The paper's presentation of the task formulation, introduction and comparison of related work, and theoretical results to be very detailed and clear, making the paper highly accessible to readers.
-
The theoretical results are solid and comprehensive under the considered setting.
-
The research motivation is meaningful, and the theoretical modeling of the problem is well-grounded.
Critical weaknesses
-
The paper's formulation of compositional tasks appears somewhat restrictive. Specifically, the different latent components are completely independent of each other, and the overall output is simply obtained by concatenating the outputs of their respective mappings.
-
Following the first point, the finding that "the required context length scales only linearly in the number of patterns..." appear to be closely related to the highly separable structure of the two components in the task formulation. The authors may need to further discuss this connection and clarify to what extent these conclusions depend on the independence of the components.
-
I am particularly curious about the extent to which the initialization scheme in Eq (13) affects the theoretical conclusions and numerical experiments. Although the authors state that the strength of this initialization can be controlled, the initialization itself introduces a non-negligible prior preference for the two attention heads.
-
Specifically, each head is initialized to attend almost exclusively to information from a particular input component. This may create substantial differences in attention scores and gradient signals associated with the two components from the very beginning of training. The authors could further discuss the influence of this initialization on the emergence of head specialization.
-
Additionally, if possible, it would be helpful to clarify whether attention heads can still develop specialized roles under initialization schemes without such predefined preferences, such as random initialization or other unbiased diagonal initialization schemes.
-
-
There are several missing references in the manuscript. Specifically, some equation references appear to be missing in Proposition 1 (line 323), lines 415–416 and line 421.
Questions for authors
see Weakness.
4 comments
Response to Weakness 2
We thank the reviewer for this insightful comment.
-
We agree that the separable task structure is essential to the context-length improvement established in our analysis. In particular, the independence of the two components allows the output to be recovered through separate component-wise retrieval, rather than requiring a context example that matches the query in both components simultaneously. However, this structure alone does not guarantee the improved context-length scaling. The model must also learn from training data to exploit it.
-
Under our uniform sampling setting, a context example matches both components of the query with probability (), whereas matching either individual component occurs with probability (). Consequently, a joint-pattern matching mechanism requires a context length of order (), as established for single-head models in (Li et al, 2024a), while a component-wise retrieval mechanism can recover the two output components from different context examples with only () context length.
-
Our theoretical contribution is to establish how this more efficient retrieval mechanism emerges through training of multi-head attention. Specifically, we show that the coupled gradient dynamics of the attention and value parameters lead to complementary head specialization, where each head learns to match one input component and retrieve its corresponding output component. Thus, while the compositional structure makes the context-length improvement possible, the learned specialization enables the Transformer to realize this advantage.
We have clarified in the revision that the () context-length guarantee relies on the independent component structure and the resulting component-wise matching probabilities. For tasks with dependent or nonseparable components, these probabilities and the corresponding retrieval mechanism may change, and our current theoretical guarantee does not directly extend to such settings. Specifically, we added the following in the Conclusion of the revised version:
“ Focusing on compositional tasks, this paper shows how learned complementary head specialization enables efficient component-wise retrieval, achieving improved context-length scaling compared with joint-pattern matching in single-head models.
Our theoretical guarantees rely on the separability of the component mappings, and extending the analysis to more general, interdependent task structures remains an important direction for future work.”
Response to Weakness 3
-
This is a valid point. We agree that equation (12) introduces an initial preference for different input components. This initialization is considered to break the symmetry between attention heads so that we can investigate how their preferences are amplified during joint training. However, the theoretical guarantees do not require the exact structured initialization in Eq. (12).
-
Our result still holds when the initialization contains large Gaussian noise. We show in corollary 1 that our theoretical results still hold when the initialization contains additional large Gaussian noise. Specifically, we initialize the attention matrices as where is the same structured initialization matrix in (12) and is the Gaussian noise matrix with entries i.i.d. From . Importantly, this condition does not require the Gaussian perturbation to be small in Frobenius norm relative to the structured initialization. Specifically, we show that for a fixed noise level in the noise matrix, as long as in (12) is not too small, greater than the lower bound in (25), then our Theorem 1 still holds with minor changes in some constants that do not affect the order-wise result. For example, when \theta chooses the lower bound in (25), scales as . Thus, when for any , the Gaussian perturbation can have a substantially larger Frobenius norm than the structured initialization .
-
The initial preference is needed for theoretical analyses. Similar symmetry-breaking initializations have been considered in theoretical analyses of head specialization. For example in Chen et al. (NeurIPS 2024, Assumption 3.3), it is assumed that each attention head initially prefers a specific relative position and then the paper analyzes how training reinforces these preferences.
-
Moreover, our initialization does not assume that heads are already specialized. In fact, the initial softmax attention on context tokens with the same pattern as the query for each head is close to uniform (). For example, for and , the softmax score on -aligned tokens of head 1 is approximately while uniform attention would be . Furthermore, value parameters are initialized at zero and output of the heads are the same for both channels initially. Our analysis shows how training amplifies these weak attention preferences, achieves value specialization and drives attention towards concentration on the relevant context examples.
-
Finally, our experiments with purely Gaussian random initialization, i.e. investigate a setting beyond the assumptions of our theoretical analysis. The observed complementary specialization suggests that a prescribed initial component preference is not essential for specialization to emerge empirically. Indeed, a realization of purely Gaussian random initialization may introduce small asymmetries between attention heads, which may be amplified during training into complementary specialization. Establishing convergence from arbitrary random initialization remains outside the scope of our current theoretical guarantees.
References
Siyu Chen, Heejune Sheen, Tianhao Wang, and Zhuoran Yang. Unveiling induction heads: Provable training dynamics and feature learning in transformers. NeurIPS, 2024
Response to Weakness 4
Thank you for pointing out the missing references. They are all corrected in the new version.
Response to Weakness 1
We thank the reviewer for this comment. We would like to clarify the input representation, motivate our modeling assumptions, and present new experimental results addressing the reviewer's concern.
-
-
-
\begin{bmatrix} g_\mu^\tau(\mu)+\lambda_o g_e^\tau(e)\\\\ g_e^\tau(e)+\lambda_o g_\mu^\tau(\mu) \end{bmatrix}.$$ We evaluate $\lambda_o \in \\{0,0.1,0.2,0.3,0.4,0.5\\}$ using a two-head Transformer and report results averaged over three random seeds. The new Figure 8 (Appendix A.3) shows that complementary head specialization persists across all tested coupling strengths. Specifically, Head 1 continues to attend preferentially to matching $\mu$ patterns, while Head 2 attends preferentially to matching $e$ patterns, including on unseen tasks. [See Figure 8.](https://imglink.cc/cdn/_1hmZVpPjq.png) These findings demonstrate empirical robustness to the considered output-channel coupling, while extending the theoretical guarantees to more general feature interactions remains future work. References B. Lake, M. Baroni, Generalization without Systematicity: On the Compositional Skills of Sequence-to-Sequence Recurrent Networks, 2018The input features are not separated in the observed coordinates. Although the two latent input components are sampled independently, their representations need not occupy separate input coordinates, since the orthonormal matrix Dx in Eq. (7) can mix them.
Independent feature mappings provide a tractable model of compositional tasks. This assumption allows us to theoretically characterize how gradient descent induces complementary specialization across attention heads. It is motivated by tasks in which different latent features contribute differently to the output, such as verb stems and grammatical tense in translation or object shape and color in image classification. Similar compositional structures have been studied in prior work (Lake and Baroni, 2018). We acknowledge that our model is a simplification of real-world feature interactions.
New experiments demonstrate robustness to coupled output channels. To investigate specialization beyond independent output mappings in synthetic data, we introduce a coupling parameter λo such that each output channel depends on both input components: