Copying Under Repetition: From Prefix Matching to Position Hashing
Not on the map. Why?
Abstract (arXiv)
Frontier LLMs can copy random text almost flawlessly, yet they often overrun or truncate long blocks of repeated characters. In repeated strings, matching local content no longer reliably identifies where copying should continue or when it should stop. Nevertheless, we show that a two-layer transformer with O(loglog N)-bit precision and O(log N/loglog N) width can copy every string up to a chosen design horizon N and terminate correctly under arbitrary repetition. We use RoPE-style rotations of attention values and outputs (VO-rotations) with small prime periods to encode distances from delimiter anchors modulo those primes. By the Chinese Remainder Theorem, these periodic encodings jointly distinguish all required distances, allowing one retrieval rule to select either the next source token or the end marker. In contrast, we prove a width-independent impossibility result for copying under sequential finite-precision softmax accumulation. It applies to transformers whose only positional input is an additive attention bias that eventually becomes constant, including NoPE and a recursive implementation of ALiBi. Once an identical-token run exceeds the resulting saturation threshold, further repetitions leave the logits unchanged. If this threshold grows sublinearly with N, these models cannot both complete a long all-identical copy and stop correctly, a pattern resembling the termination errors of frontier LLMs. In synthetic copying experiments, baseline transformer models fail on long repeated strings even within the training range. Trained VO models, by contrast, generalize beyond the training lengths with near-perfect accuracy up to length ≈5005, the selected primes' period product.
Key facts. Cited by 2 papers in the map (data through 24 Nov 2026). Builds on 26 of its 31 references that are in the map. Submitted 19 Oct 2026.
Builds on
26 of 31 references.
References · 26
- 2017Attention Is All You Needcited by 62,125
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 5,132
- 2017Get To The Point: Summarization with Pointer-Generator Networkscited by 1,319
- 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,166
- 2018Self-Attention with Relative Position Representationscited by 1,163
- 2022In-context Learning and Induction Headscited by 1,085
- 2015Pointer Networkscited by 923
- 2024MiniCPM: Unveiling the Potential of Small Language Models with Scalable Training Strategiescited by 788
- 2023The Impact of Positional Encoding on Length Generalization in Transformerscited by 348
- 2024Chain of Thought Empowers Transformers to Solve Inherently Serial Problemscited by 278
- 2024Repeat After Me: Transformers are Better than State Space Models at Copyingcited by 245
- 2016Incorporating Copying Mechanism in Sequence-to-Sequence Learningcited by 224
14 more
- 2023What Algorithms can Transformers Learn? A Study in Length Generalizationcited by 219
- 2022The Parallelism Tradeoff: Limitations of Log-Precision Transformerscited by 214
- 2023What Formal Languages Can Transformers Express? A Surveycited by 131
- 2024Looped Transformers for Length Generalizationcited by 119
- 2019ConveRT: Efficient and Accurate Conversational Representations from Transformerscited by 97
- 2023GTA: A Geometry-Aware Attention Mechanism for Multi-View Transformerscited by 93
- 2024A Formal Framework for Understanding Length Generalization in Transformerscited by 53
- 2025Characterizing the Expressivity of Fixed-Precision Transformer Language Modelscited by 17
- 2025Knee-Deep in C-RASP: A Transformer Depth Hierarchycited by 15
- 2025Non-Asymptotic Length Generalizationcited by 8
- 2026Length Generalization Bounds for Transformerscited by 6
- 2026Characterizing the Expressivity of Local Attention in Transformerscited by 4
- 2026RoVE: Rotary Value Embeddings Attention for Relative Position-dependent Value Pathwayscited by 3
- 2026Barriers to Universal Reasoning With Transformers (And How to Overcome Them)cited by 2
Built on by
Citing papers per year: 2026: 2.
2 papers.