English

Beyond Linearity in Attention Projections: The Case for Nonlinear Queries

Machine Learning 2026-05-27 v3 Artificial Intelligence

Abstract

Recent algebraic analysis shows that in decoder-only and encoder-only transformers, the Query projection WQW_Q may be set to identity without noticeable performance deterioration. This is possible because attention depends on XX only through the products XWQ,XWK,XWVXW_Q, XW_K, XW_V, allowing basis transformations to be absorbed by adjacent layers and propagated through the network. We replace WQRd×dW_Q \in \R^{d \times d} with a nonlinear residual of the form Q(X)=X+fθ(X)Q(X) = X + f_\theta(X), where fθf_\theta is a bottleneck MLP with d2+O(d)d^2 + O(d) parameters. The identity term anchors the nonlinearity to a known-good prior. Experiments on GPT-3 small style models show consistent improvement over the baseline (2.40%2.40\% lower validation log-loss, 6.81%6.81\% lower perplexity), comfortably outperforming a model with 12.5\% more non-embedding parameters. These results motivate investigation at larger scales and across modalities.

Keywords

Cite

@article{arxiv.2603.13381,
  title  = {Beyond Linearity in Attention Projections: The Case for Nonlinear Queries},
  author = {Marko Karbevski},
  journal= {arXiv preprint arXiv:2603.13381},
  year   = {2026}
}

Comments

Accepted at the ICLR 2026 GRaM workshop: https://openreview.net/forum?id=pwdnneFiNZ#discussion

R2 v1 2026-07-01T11:19:07.498Z