Controlling changes to attention logits
Ben Anson, Laurence Aitchison
TL;DR
This work targets stability during transformer pretraining by constraining changes in attention logits rather than their magnitudes. It introduces QuacK, a method that assigns parameter-dependent learning rates $\\eta_Q \\propto \\|\\mathbf{W}_K\\|^{-1}$ and $\\eta_K \\propto \\|\\mathbf{W}_Q\\|^{-1}$ to bound logit updates, supported by a lemma showing the worst-case logit change is bounded independently of weight size. Empirically, QuacK enables higher base learning rates, matches QK norm stability in standard MHA, and outperforms alternatives like QK clip in the MLA setting, while being cheaper and more widely applicable. This offers a practical, normalization-free path to stable, scalable transformer pretraining, especially for architectures that use MLA.
Abstract
Stability of neural network weights is critical when training transformer models. The query and key weights are particularly problematic, as they tend to grow large without any intervention. Applying normalization to queries and keys, known as `QK norm', fixes stability issues in practice, but is not always applicable. For example, QK norm is not compatible with Multi Latent Attention (MLA) because QK norm requires full materialization of queries and keys during inference, which is not done in MLA. In this paper we suggest that controlling the changes to logits is important for stability. We show that these changes are controllable by assigning parameter-dependent learning rates to the query and key weights. We find that our cheap intervention allows us to increase the base learning rate of the network, outperform other methods in the MLA setting, and achieve performance competitive with QK norm when using Multi-head Attention.
