mlsanityData to 14 Oct 2026

Counting with Attention and LayerNorm: Norm Scaling and Representation Geometry

arXiv 2610.16653 ↗First posted 12 Oct 2026cs.LGcited by 0

Not on the map. Why?

Abstract (arXiv)

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 Bmin, 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, Bmin grows as L without normalization, as L3/2 under bare post-normalization, and as L3/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.

Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 16 of its 21 references that are in the map. First posted on arXiv 12 Oct 2026.

Builds on

16 of 21 references.

References · 16

  1. 2022LLM.int8(): 8-bit Matrix Multiplication for Transformers at Scalecited by 906
  2. 2019Theoretical Limitations of Self-Attention in Neural Sequence Modelscited by 288
  3. 2022Transformers Learn Shortcuts to Automatacited by 268
  4. 2022The Parallelism Tradeoff: Limitations of Log-Precision Transformerscited by 193
  5. 2021Thinking Like Transformerscited by 184
  6. 2021Saturated Transformers are Constant-Depth Threshold Circuitscited by 139
  7. 2023Teaching Arithmetic to Small Transformerscited by 123
  8. 2022Overcoming a Theoretical Limitation of Self-Attentioncited by 113
  9. 2024Transformers Can Achieve Length Generalization But Not Robustlycited by 86
  10. 2024Transformers Can Do Arithmetic with the Right Embeddingscited by 78
  11. 2024When Can Transformers Count to n?cited by 24
  12. 2024Position Coupling: Improving Length Generalization of Arithmetic Transformers Using Task Structurecited by 23
4 more
  1. 2023Counting and Algorithmic Generalization with Transformerscited by 12
  2. 2025The Counting Power of Transformerscited by 9
  3. 2024Counting in Small Transformers: The Delicate Interplay between Attention and Feed-Forward Layerscited by 6
  4. 2026Mechanistic Interpretability of Large-Scale Counting in LLMs through a System-2 Strategycited by 3

Built on by

Not cited yet.