Counting with Attention and LayerNorm: Norm Scaling and Representation Geometry
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.
ProofPaper ↗
Key points
- Counting is a simple task on which transformers can nevertheless fail at long sequence lengths.
- 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$.
- 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.
Sources (1)
- [1]Counting with Attention and LayerNorm: Norm Scaling and Representation GeometryarXiv (AI, ML, NLP, CV, robotics, multi-agent) · Oct 12, 12:09 PM
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.
Counting is a simple task on which transformers can nevertheless fail at long sequence lengths.
Extractive summary: sentences quoted from the sources.
Before this
- Oct 12, 2026AReA: Adaptive Receptive-Field Attention for Efficient High-Resolution Diffusion Transformers
- Oct 11, 2026autotrust/JEV-35B-NVFP4
- Oct 11, 2026History Replays Itself: Unleashing Long-Context Capability in Linear Attention
- Oct 10, 2026vllm-sr/d3
- Oct 10, 2026BridgeWAM: Bridging Video and Action Experts via Latent Bridge Queries
- Oct 9, 2026LiquidAI/LFM2.5-24B-A2B