Large Language Models without QK-Normalization
Yongding Tao, Yitong Qiao, Tianqi Shao, Tian Wang, Zhixuan Chu, Xiaoming Wu, Yihong Dong, Ge Li
Abstract
Query-Key Normalization (QK-Norm) is widely adopted in modern large language models to control the growth of attention logits and improve training stability. However, query and key norms are not merely sources of instability. The query norm controls the sharpness of the attention distribution, while the key norm determines how strongly a token attracts different queries. These norms therefore carry token-specific information about attention selectivity and token importance. By normalizing both, QK-Norm suppresses this information. This raises a natural question: can we control query-key representations without discarding their sensitivity to magnitude? To address this question, we propose QK-MAP, a Magnitude-Aware Projection for constructing queries and keys. Rather than removing magnitude through normalization, QK-MAP transforms the input representation using multiple learnable frequencies, so that changes in magnitude are encoded as bounded phase patterns. This allows magnitude to be represented through phase and direction rather than vector length alone. Its periodic features have a fixed norm while remaining sensitive to magnitude changes, separating magnitude encoding from norm growth. Multiple frequencies further help distinguish magnitudes and reduce periodic ambiguity. Experiments across model scales from 190M to 7B parameters show that QK-MAP achieves lower training and validation loss than both Standard attention and QK-Norm. Further analyses show that QK-MAP preserves sensitivity to input scale, assigns less attention to the first token, and produces stronger attention contrast for relevant evidence in synthetic long-context tests. These results demonstrate that query-key scale can be effectively controlled without sacrificing token-specific magnitude information.
Create a lesson
Metadata
- Categories
- cs.CL, cs.AI, cs.LG
- Comments
- Code is available at https://github.com/yongding-tao/QK-MAP
Related papers
Exploring Multi-Player Social Games as Verifiable Training Grounds for Large Language Models
Shared title terminologycs.CLKeyu He, Michael Li, Jiarui Liu et al.
PazaBench: Large-Scale ASR Benchmark for Low-Resource Languages in Africa
Shared title terminologycs.CLMercy Muchai, Nick Mumero Mwangi, Kevin Chege et al.
Rethinking the Evaluation of Contrastive Decoding for Hallucination Mitigation in Multimodal Large Language Models
Shared title terminologycs.CLTing Chen, Geng Li, Guohao Chen et al.
PCC: Pivotal Channel Compensation for Layer Pruning of Large Language Models
Shared title terminologycs.CLXiangqian Wang, Yucheng Zhang, Zhaohong Jia et al.
Reading the Tea Leaves, Again: Can Large Language Models Predict Language Model Training Runs?
Shared title terminologycs.CLXinran Zhao, Xiang Li, Tong Chen et al.
When 1+1 ≠ 2: Benchmarking Civil-Time Reasoning in Large Language Models
Shared title terminologycs.CLMelika Shirian, Kianoosh Vadaei, Arshia Hemmat et al.