Counting is a simple task on which transformers can nevertheless fail at long sequence lengths. We study the cost of counting in a single attention layer, up to a maximum length $L$, focusing on how softmax attention and layer normalization shape the representation from which the count is recovered. We mainly focus on regression read-out but also consider classification read-out. For regression, we show unnormalized linear attention counts exactly at parameter norms independent of $L$. For softmax attention, regression cannot count exactly with finite parameters; it recovers the count after rounding, but only when the vector parameter norms grow with $L$. We measure this cost by $B_{\min}$, the smallest bound that can be placed on every trainable vector to ensure exact counting after rounding, and derive tight rates. At fixed model dimension, $B_{\min}$ grows as $L$ without normalization, as $L^{3/2}$ under bare post-normalization, and as $L^{3/4}$ with learned post-normalization. The last rate is unexpected: post-normalization discards the magnitude that carries the count and might be expected to make counting harder, yet with a learnable gain it counts at a smaller norm than softmax without normalization. Bare pre-normalization is different: it bounds the attention scores, so beyond a finite length no parameter norm suffices. A classification read-out keeps every norm bounded under every placement, but a dense head stores one output vector per count and costs more in storage. Experiments on the post-normalized model reproduce this split between the two read-outs. Together, our theoretical and empirical findings characterize how self-attention, layer-normalization placement, and read-out choice shape the representation geometry and parameter cost of counting in the minimal single-head architecture studied here.
FedLNS: Leverage LayerNorm Signature Modeling to Mitigate Adversarial Manipulation in Federated LLMs
Interdisciplinary Centre for Security, Reliability and Trust (SnT), University of Luxembourg(卢森堡大学安全、可靠性与跨学科研究中心(SnT));Carnegie Mellon University(卡内基梅隆大学);Edith Cowan University(埃迪斯科文大学);TU Berlin(柏林工业大学)
Exploiting Layer Normalization Fine-tuning in Visual Transformer Foundation Models for Classification
Shanghai Academy of Artificial Intelligence for Science(上海人工智能科学研究院);Xi’an Jiaotong-Liverpool University(西安交通大学利物浦大学);University of Liverpool(利物浦大学);AI 3 Fudan University(复旦大学);Duke Kunshan University(杜克-昆山大学);BII, A ∗ STAR;Zhejiang University(浙江大学)
Where You Place the Norm Matters: From Prejudiced to Neutral Initializations
Physics Department EPFL(洛桑联邦理工学院物理系);Department of Statistics Sapienza, University of Rome(罗马大学统计系);Department of Mathematics and Computer Science University of Basel(巴塞尔大学数学与计算机科学系);SIAM Department Eawag (ETH)(瑞士联邦水科学与技术研究所SIAM部门(苏黎世联邦理工学院))