Query Expansion and Key Specialization in Transformer Attention Geometry
Vidit Gupta, Siddhesh Nadkarni, Mihik Chaudhari, Vinaya Sawant, Prachi Tawde
Abstract
The projection of queries and keys are central to the attention mechanism in Transformer architectures. While they are mathematically symmetric, they play different roles in attention mechanisms. The question of whether there is an effect from their functional distinction on their geometric development in training remains unanswered. We investigate the problem through the training of small GPT-like Transformers on character-level WikiText-103 for three different depths (4, 6, and 8 layers), three types of initialization for queries and keys, and four random seeds, resulting in 36 runs and 54 trajectories of average layers across seeds. We track the effective dimensionality of those layers using participation ratios and discover that effective dimension of queries expand while keys shrink, and that is positive in all trajectories studied. In connection to attention, the shrinking of keys leads to a narrower spectrum of and more peaked attention weights. In order to determine if this connection is causal or coincidental, we directly control the spectrum of keys during training across five seeds: restricting it to make it shrink sharpens the attention with high directional confidence, while keeping it constant to the level of initial dispersion makes attention softer. Additional token-level checkpoint analyses show that the monotonic paired-contrast trend is not universal across pretrained families, but survives as an early-training regime that later decays over a full pretraining run, and the link between interaction-rank geometry and attention entropy remains visible in several models.
Create a lesson
Metadata
- Categories
- cs.AI, cs.LG
- Comments
- Accepted at Asian Conference on Machine Learning 2026
Related papers
Orthogonally Mixed Sign Coding with Progressive Residual Refinement for Transformer Weight Compression
Shared title terminologycs.AIAnindya Roy Chowdhury, Atanu Barai, Nandakishore Santhi
CLIP-FMoE: Scalable CLIP via Fused Mixture-of-Experts with Enforced Specialization
Shared title terminologycs.AILuong Tran, Lan-Cuong Nguyen, Huynh Dang Nguyen et al.
Information Bottleneck-Guided Adaptive Hypergraph Transformer for Brain Disease Diagnosis
Shared title terminologycs.AIJingxi Feng, Xudong Chen, Yifan Zhang et al.
Geometry-Conditioned Fixed-Scaffold Encoders for Time-Warp Robust Sequence Retrieval
Shared title terminologycs.AICassandra Yang, Yufan Tang
CANTO: CAD-Native Transformer Operators for AI-Aided Engineering
Shared title terminologycs.AIDaniel Leibovici, Nikola Borislavov Kovachki, Dawon Ahn et al.
Emergent Specialization in Populations of Self-Supervised Collaborative Vision Experts Without a Shared Gate or Cross-Agent Gradients
Shared title terminologycs.AIAram Davtyan, Pablo Acuaviva, Sebastian Stapf et al.