Manuscript Offprint
arXiv:2610.26722Copying Under Repetition: From Prefix Matching to Position Hashing
ABSTRACT
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 -bit precision and 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 , the selected primes' period product.
1 INTRODUCTION
Autoregressively copying text is a fundamental primitive for modern large language models (LLMs). LLMs copy when they reuse retrieved documents, quote code or data, or transfer a specific answer from a chain of thought into the final response. Historically, this copying task has motivated explicit pointer or copy mechanisms in sequence models (Vinyals et al., 2015; Gu et al., 2016; See et al., 2017). Meanwhile, transformers seem to learn to copy easily, often through the “induction head” mechanism (Olsson et al., 2022): they match the already-copied prefix to its earlier occurrence in the prompt and retrieve the subsequent token. For random sequences, short local contexts uniquely identify the occurrence. Jelassi et al. (2024) formalized this content-addressed mechanism, showing that a two-layer transformer (with a particular position encoding) can copy strings of length with precision—provided the input contains no repeated n-grams.
Surprisingly, however, removing this non-repetition assumption seems to change the difficulty of copying qualitatively. As shown in Figure 1, frontier LLMs that copy random strings near-perfectly sometimes fail catastrophically on strings with long repeated runs of letters, either overgenerating severely or stopping early. Repetition changes what the task demands: when many positions carry
Work partially conducted while at Toyota Technological Institute at Chicago.
the same local content, matching the already-copied prefix no longer picks out which occurrence to continue from, so the model must tell these occurrences apart by other means.
To make this problem concrete, consider one step of autoregressive copying, with current context
for some . The task is to output if , or output if . An all-identical source, with for every , isolates the termination problem: continuing requires only another , but stopping at the right point requires distinguishing progress that local content windows cannot reveal. This raises the question: Can a shallow, low-precision transformer copy reliably under arbitrary repetition and terminate correctly?
The answer is yes: for any fixed finite vocabulary and each sufficiently large design horizon N, a single two-layer transformer can copy every source of length at most N under arbitrary repetition and terminate correctly, using -bit precision and width. Our construction uses its first layer to encode each position's offset relative to delimiters—specifically, its distance to the preceding delimiter ( in the source or in the copy segment)—so that tokens can be retrieved by position rather than by matching their content. The need for a delimiter anchor arises because on an all-identical source, attention cannot extract positional signals from the source tokens themselves. RoPE's query/key rotations (Su et al., 2024) and ALiBi's logit biases (Press et al., 2022) change attention weights but leave the source value vectors identical: redistributing a fixed total attention weight among these tokens does not change their contribution to the output. Position can still affect the output through the weights assigned to special delimiters, such as the beginning-of-source token , but only by changing how much of each delimiter's fixed value enters the output. By contrast, value/output rotations (VO-RoPE; Su, 2025) let position act on the returned vector itself: even when two queries attend entirely to , the returned vectors can differ because the rotation encodes each query's distance from it.
Our first layer applies these rotations with small prime periods (e.g., 2, 3, ...) to encode delimiter-relative offsets. For each prime period, the rotation encodes the offset modulo that prime, using a few well-separated phases that remain distinguishable at very low precision. By the Chinese Remainder Theorem, the periods jointly distinguish every offset below their product, so the first layer resolves a long range of offsets with low precision and width. The second layer then uses these representations to retrieve either the next source token or the end marker, handling copying and termination with one rule.
Copying and termination with VO-rotation. For any fixed finite vocabulary and all sufficiently large design horizons N, we construct a two-layer transformer that copies every string of length and terminates correctly under arbitrary repetition. Our VO-rotation instantiates the VO-RoPE operation with a prime-number period per head, using heads in total. The construction uses -bit precision and width (Theorem 3.8). We use small periodic counters to index the rounded rotation tables.
A width-independent copying obstruction. We also prove a width-independent impossibility result for eventually-constant bias-only (ECB) transformers, whose only positional information enters
stands for “end of input” and for “end of sequence”.

Figure 1: Long repeated strings reduce LLM copying accuracy. Accuracy is the fraction of all 50 trials per length and condition whose extracted answer matches the source perfectly. For a fixed switch probability , a source string is generated by concatenating latent constant-letter runs: each run chooses a letter uniformly from the 26 lowercase English letters and has length . The three plotted distributions are uniform-random strings, ; repeated strings, ; and all-identical strings, the limit . Output extraction and experimental details are in Appendix A.
through a pre-softmax additive attention bias that becomes constant beyond some distance. Under our finite-precision execution model, the analysis covers NoPE (Kazemnejad et al., 2023), a recursive implementation of ALiBi (Press et al., 2022), and bounded-window Hard-ALiBi (Jelassi et al., 2024) within this class. The proof tracks identical-token runs after an arbitrary fixed prefix, layer by layer. Beyond a certain length, appending another identical token no longer changes the next-token logits. In copying, a model that emits the required repeated letters then keeps repeating them for as long as the context remains in its domain, a failure pattern resembling the overruns observed in LLMs. Increasing width does not remove this obstruction: for the instances in Corollary 3.5, models of depth and precision fail whenever . At the -bit precision of our construction, this rules out NoPE models of any width and depth for each fixed , whereas the VO construction uses just two layers.
Learning to copy under repetition. In synthetic experiments, all evaluated standard positional baselines lose accuracy under repetition near the training limit, while a shallower, narrower VO model learns to copy across all three evaluated distributions (Section 4). VO copies perfectly at all evaluated lengths within the training range and generalizes with near-perfect accuracy up to the period product 5005. The models appear to have learned to utilize the periodic value-side positions, as accuracy on uniform-random and moderately repeated strings drops sharply just beyond 5005 (Figure 5).
2 RELATED WORK
Copying under repetition requires distinguishing occurrences with the same content. Jelassi et al. (2024) construct a two-layer transformer that copies exponentially long strings by content-based n-gram hashing, assuming no repeated n-grams; their copying error measures the first L output tokens. Our two-layer construction retrieves by anchor-relative position, allowing arbitrary repetition and including correct termination in the guarantee. Repetition also distinguishes easy and difficult copying tasks in studies of length generalization (Zhou et al., 2024). Huang et al. (2025) prove that Limit Transformers satisfying their Periodic and Local conditions cannot copy arbitrary strings. Our ECB lower bound instead quantifies layerwise saturation under finite-precision execution, independently of width.
Positional encodings differ both in where they enter the computation and in how they represent position. Value-side representations include the additive relative embeddings of Shaw et al. (2018) and the geometric transformations of GTA (Miyato et al., 2024). Su (2025) gives the VO-RoPE mechanism used here, applying opposite position-dependent rotations to values before aggregation and to outputs afterward to encode relative offsets. RoVE (García-Castellanos et al., 2026) combines the same value/output rotation with query/key RoPE and studies it through an attentive-convolution interpretation and language-modeling experiments. ConveRT (Henderson et al., 2020) uses learned absolute-position embeddings indexed by two coprime moduli. Our focus is on prime-period value rotations that encode anchor-relative offsets as modular residues, with explicit precision and head-count bounds for reliable copying (Theorem 3.8).
Expressivity results depend on which resources may grow with input length. Circuit complexity bounds characterize transformer computation (Merrill & Sabharwal, 2023; Strobl et al., 2024), but the fixed-context next-token copy map already lies in DLOGTIME-uniform (Appendix C). Temporal-logic analyses characterize fixed-precision NoPE transformers and the effect of local attention (Li & Cotterell, 2025; 2026), while length-generalization theory studies when bounded-length training suffices for unbounded-length correctness (Chen et al., 2025; Yang et al., 2026). Our horizon-uniform framework asks how positional and computational resources must scale with a finite design horizon, requiring the same parameters to work across all source lengths within it.
Sequential depth and explicit identifiers provide alternative routes to copying. Fan et al. (2025) implement copying by iterating a fixed block for n steps, and Kraus et al. (2026) use a growing signpost alphabet to address copying and retrieval barriers in chain-of-thought reasoning. Our construction uses a fixed vocabulary and two layers, without intermediate reasoning or indexing tokens.
3 THEORETICAL FRAMEWORK
Under repetition, content matching need not distinguish the occurrence to copy next. We study two ways positional information can reach the output: through attention weights over value vectors, or through position-dependent transformations of the values themselves. The results establish failure for eventually-constant bias-only models under a specified finite-precision execution model, and sufficiency of a modular value-side construction for two-layer copying. Appendix D gives the full execution model, architecture definitions, and proofs.
3.1 HORIZON-UNIFORM COPYING
Fix a design horizon . Let be the token alphabet for the copy task. For a transformer , write for its deterministic greedy next-token map, under a fixed tie-breaking rule, on contexts in its model domain, i.e., the contexts that fit within its context window. We consider transformers with context window at least . For any source length , the input prompt has the form
where and there is no restriction on repetition. After seeing , the model must autoregressively output , .
Definition 3.1 (Horizon-uniform copying). Fix a design horizon . A model solves Copy if the same parameters, execution convention, and readout satisfy the following condition for every source string with . Starting from the prompt , recursively define
Then
A family of models solves horizon-uniform copying if each solves Copy .
Finite precision. Both our results assume deterministic finite-precision floating-point execution with finite arithmetic intermediates, as detailed in Appendix D.1. Throughout this section, is a resource that may scale with the design horizon N. For the softmax numerator and denominator,
(a) Each attention head: softmax sums from left to right
| Earlier positions same fixed context | Identical contributions | Nearby positions same distances every time |
|---|---|---|
| Same states in the previous layer | Current token | |
Summation order
(b) Each layer has a long tail of identical states
| Input | a | a | a | a | a | a | a | a | a | a | a |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Layer 1 | May differ | All identical | |||||||||
| Layer 2 | May differ | All identical | |||||||||
Position in a run of the same token
Eventually, one more repeated token leaves the next-token prediction unchanged.
Figure 2: How ECB transformers lose track of repetition through rounded accumulation. Panel (a) shows the left-to-right accumulation order. In panel (b), colored tails indicate guaranteed identical states within each layer; gray states may differ (schematic).
we use the left-to-right chain of rounded binary additions from Li et al. (2024, Definition 3.1). This execution model lets us track how repeated contributions lose length information through rounding, and how value-side offsets remain usable under the same numerical arithmetic.
The proofs rely on the following two facts about finite-precision arithmetic:
-
When intermediates remain finite, repeated addition and rounding of an identical summand reaches a fixed point after at most states: the sequence is eventually constant.
-
With the max-shifted softmax convention, sufficiently large post-shift logit gaps yield one-hot attention, which is used in our VO construction.
3.2 LOWER BOUND FOR EVENTUALLY-CONSTANT BIAS-ONLY TRANSFORMERS
Definition 3.2 (Eventually-constant bias-only transformer class). A family is in if, for each horizon , is a depth- causal transformer with arbitrary number of attention heads and hidden dimensions, using deterministic -bit execution. Its only positional dependence is a distance-dependent additive bias on the attention logits. For head in layer , the attention logit from query position to key position is defined as:
where each is an eventually constant function: for some , for all . Here ECB stands for eventually-constant bias-only. The full formal definition is in Definition D.5.
Write for a fixed prefix followed by copies of . The proof tracks where the hidden states become identical within each layer. Write and define , . Once the previous layer has identical states beyond , a sufficiently late query sees a fixed past, a block of identical softmax addends, and a near window with a fixed list of relative distances (Figure 2). The bias is constant on the far positions, and at least middle-block additions make the accumulator independent of further repetitions. Allowing another positions for the near window gives the threshold at the next layer.
The following lemma is the main obstruction: after fixing an earlier prefix, the length of a long run at the end is forgotten.
Lemma 3.3 (Terminal-run saturation). Fix a horizon N and with depth . Let
For every fixed prefix , every , and every for which the contexts and are in the model domain, the next-token logits on these two contexts are identical.
It follows that, after a long enough terminal run of 's, the next-token map may still depend on the earlier prefix x, but it no longer depends on the length of that run.
Theorem 3.4 ( lower bound: correct copy implies a -loop). Assume the deterministic left-to-right finite-precision execution model of Section 3.1. Let have depth and precision at design horizon . Let be the saturation threshold from Lemma 3.3 for . If , then for all sufficiently large , every , and every fixed , fails on the all-identical prompt
More precisely, it either:
-
Makes a mistake before completing the L-token copy, or,
-
if it outputs , then for every for which the context remains in the model domain of .
Proof idea. For the all-identical copy task, take
Since , every satisfies for sufficiently large . If the -th copied token is correctly generated from , then the termination query has the same logits and hence also outputs , even though the correct token is . Repeating the same argument gives the loop.
For the recursive ALiBi case below, the eventual-constancy argument assumes that the bias recurrence does not overflow, as in Lemma D.8. This isolates stagnation from rounding rather than failure from exponent overflow.
Corollary 3.5. Consider the variants of ALiBi (Press et al., 2022) and Hard-ALiBi (Jelassi et al., 2024) as defined in Definition D.7. For depth-D(N), arbitrary-width, deterministic -bit models satisfying , Theorem 3.4 applies to:
• NoPE: no positional logit bias.
• Recursive implementation of ALiBi: the rounded slope recurrence .
• Bounded-window Hard-ALiBi: hard-masked heads whose attention windows are at most , with any remaining heads treated as NoPE heads.
In particular, this applies even when and .
Scope. Under exact accumulation, the attention mass assigned to a repeated run relative to the fixed prefix can continue to carry length information. The lower bound identifies how repeated rounding in the execution model of Section 3.1 makes this information stop changing. Beyond , we also observe copying failures on long all-identical strings within the training range for RoPE, sinusoidal embeddings, and directly computed ALiBi (Section 4.3).
3.3 UPPER BOUND VIA VO POSITION HASHING
The positive construction replaces “content hashing” in Jelassi et al. (2024) by position hashing. Layer 1 selects a delimiter rather than a repeated source token and writes the query’s distance from that delimiter into the value stream. Layer 2 uses this representation to select the next source occurrence, without matching token content.
Anchors and offsets. We call and the anchors. The active anchor at position t is
Thus is the nearest anchor at or before , and the active-anchor offset is . Source token has offset , and the source-side has offset . At a copy-region query of offset , the desired source-side offset is . All visible copy-region offsets are at most , so this target occurs only on the source side: it holds if and if . The final readout maps vocabulary tokens to themselves and the retrieved to .
Writing offsets into values. VO-rotation encodes the distance to the selected anchor modulo a head-specific period. For a period , let be the planar rotation by . In the two-dimensional case, one-hot attention to position with rotary value returns , whose coordinates are , up to rounding. Thus the returned vector records the selected offset modulo . On an even-dimensional rotary value subspace, let denote block-diagonal copies of ; powers are interpreted modulo .
Definition 3.6 (VO-rotated attention head). A VO head is an ordinary NoPE causal attention head, except that a chosen value subspace is pre-rotated by the key position and post-rotated by the query position. For with , its head-local pre-output before rounding satisfies
In exact arithmetic, one-hot attention on gives rotary block , so the selected value carries the relative offset . Lemma D.13 bounds the error from the two rounded rotations in the construction.
Although the definition allows general , each Layer-1 VO head in our construction uses one two-dimensional block, with and . With distinct prime periods, the heads' combined encodings form a unique fingerprint of the selected offset by CRT.
Definition 3.7 (VO positional transformer class ). We write for transformers equipped with such VO heads, where each position has exact access to its index modulo each chosen period to select rounded rotation-table entries; Appendix D.3 gives the formal instantiation.
Theorem 3.8 ( upper bound with CRT-chosen periods). For every fixed finite vocabulary V, there exists a family of two-layer transformers such that, for all sufficiently large design horizons N, correctly copies every string of every length :
The model uses:
• first-layer prime-period heads, each using ;
• floating-point precision ;
• dimension .
Proof sketch. Layer 1 attends one-hot to the active anchor: before and afterward. VO writes into head . Since , CRT identifies every offset in the design horizon. At a copy-region query of offset , Layer 2's fixed query projection applies a one-step rotation to each fingerprint component (so the query can attend to the next token in the input string), while the keys retain the candidate positions' fingerprints. Before scaling and rounding, their centered inner products sum to
The unique visible position at offset matches every residue and has score zero; every other position mismatches in at least one component and has a negative score. The precision bound
Preprint preserves this gap, and scaling makes the non-winning softmax weights underflow to zero. If k = L, this position is the source-side ⟨EOI⟩, and the final readout outputs ⟨EOS⟩. Appendix D gives the finite-precision gap and resource accounting. The first H = Θ(log N/ log log N) primes have product Π := Q h qh > N + 1, while the largest period is only Θ(log N). Each head therefore separates O(log N) phases; the gap analysis shows that these distinctions survive at O(log log N)-bit precision. A position generator can maintain the phase index for period qh with a cyclic counter ch,t+1 = (ch,t + 1) mod qh. Each counter uses O(log log N) bits and selects rounded sine/cosine coordinates; attention then forms the anchorrelative fingerprint. Separating phase generation from activation arithmetic also occurs in practical RoPE implementations: Hugging Face Llama computes phases and trigonometric values in float32 before casting them to the activation dtype.2 Appendix D.4.4 accounts for the phase tables and counter state. 4 EXPERIMENTS We first illustrate the repeated-content failures observed in frontier LLMs. Our synthetic experiments then examine three questions about learning to copy: how standard positional baselines respond to repetition under a shared training distribution, whether a shallow model can learn to exploit VO-rotation, and where extrapolation occurs and how it breaks down beyond the product of the supplied prime periods. 4.1 COPYING FAILURES IN FRONTIER LLMS Figure 1 shows that frontier LLMs which copy random strings accurately fail on repeated strings. This contrast provides empirical evidence that repetition-sensitive copying extends beyond the ECB setting. Table 1 gives three recorded Qwen3.5 outputs for all-identical sources of length 300: an overrun, a truncation, and an empty output. The prompt asks for the string enclosed between $ and ., with : as the copy cue. Appendix A gives the model variants, prompting, and scoring details. Table 1: Recorded Qwen3.5 copying failures on all-identical sources of length 300. String excerpts reproduce the recorded text; ellipses mark omitted characters. Failure type Target string (excerpt) Model reply (excerpt) Extended repetition bbbbbbbbbbbbbbbbbbbbbbb bbbbbbbbbbbbbbbbbbbbbbb bb. . . (Length: 300) bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb bbbb. . . (Length: 79,984) Premature truncation iiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiii ii. . . (Length: 300) iiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiii. . . (Length: 224) Empty output zzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzz zz. . . (Length: 300) Empty response (Length: 0) 4.2 SYNTHETIC SETUP Each example uses the copying task of Section 3.1 over the 26 lowercase English letters; we write n for the source length, denoted L there. The loss is applied only to the generated answer, including the end marker. Our metric is string-level exact-copy accuracy: every next-token argmax in the answer region, including the end marker, must match. During training, the source length is drawn as n ∼ Unif{1, . . . , 2000}, and each string is drawn from a three-component mixture: an i.i.d. string with probability 0.1, an all-identical string with probability 0.1, and, with probability 0.8, a 2Transformers v4.44.2, LlamaRotaryEmbedding.forward. 8

Figure 3: Exact-copy accuracy by source length and distribution, averaged over the three training seeds for every model. Standard-deviation bands are omitted for readability; Table 2 reports cross-seed variation near the training limit. The dashed black line marks the maximum training source length, ; lengths to its right test extrapolation.
Table 2: String-level accuracy near the training limit: mean sample standard deviation across the three training seeds. Baselines are evaluated at and VO at .
| Model | Layers | Width | |||
|---|---|---|---|---|---|
| NoPE | 6 | 512 | |||
| RoPE | 6 | 512 | |||
| ALiBi | 6 | 512 | |||
| Hard-ALiBi | 6 | 512 | |||
| Sinusoidal | 6 | 512 | |||
| VO-Rotation | 2 | 256 |
string of same-character blocks, whose repetition level is randomized by drawing and setting . We train each model with seeds 42, 43, and 44, using a shared configuration within each model family. Architectures and training budgets differ across model families. Appendix B records the configurations, block sampler, literal delimiter encoding, and evaluation details.
Evaluation uses i.i.d. uniform strings (), repeated strings (), and all-identical strings ().
4.3 STANDARD POSITIONAL BASELINES
We first compare NoPE, RoPE, ALiBi, Hard-ALiBi, and Sinusoidal (Vaswani et al., 2017) using the same 6-layer, width-512, 8-head bf16 backbone. We compute the ALiBi bias directly as , not by the rounded recurrence in Corollary 3.5. Figure 3 shows how these baselines respond to the three repetition conditions. The contrast is sharpest near the training limit: every standard positional baseline has mean accuracy below 0.26 on the all-identical diagnostic, while the two-layer VO model reaches 1.000 in all three seeds (Table 2). Cross-seed variation is substantial for some baselines: RoPE's all-identical accuracy is (mean sample standard deviation).
4.4 VO-ROTATION
We next test whether training can exploit the value-side positional encoding. The VO-Rotation models use a 2-layer, width-256, 4-head backbone with no score-side positional term. Following the construction's layout, the first layer applies value/output rotation with one prime period per head (5, 7, 11, 13), and the second layer uses ordinary NoPE attention. The joint residue vector repeats every 5005 offsets. We simulate FP8 by rounding linear-layer inputs and weights; other operations use native PyTorch mixed precision (Appendix B).

Figure 4: Training loss of VO-Rotation with seed 42, with both axes logarithmic. The loss stays on a plateau for roughly the first 40k optimizer updates and then drops sharply.

Training limit (2000)
Period product (5005)
Figure 5: VO-Rotation length generalization on the complete evaluation grid. The curve shows the mean across three seeds, and the band spans sample standard deviation clipped to [0, 1]. Dashed black: maximum training source length 2000; dash-dotted red: period product 5005. See Appendix B.1 for individual curves.
The models learn their weights while using the periodic value-side encoding of Theorem 3.8. These results show that training finds successful copying solutions in this shallow architecture. The training loss shown in Figure 4 stays on a long plateau before dropping sharply.
Generalization and the period product. Every seed achieves perfect accuracy at all evaluated lengths through 2000 in all three conditions (Figure 5). Over extrapolation lengths 2008–5000, mean accuracy across lengths and seeds is 0.980 for uniform-random, 0.996 for moderately repeated, and 0.998 for all-identical strings.
Uniform-random and moderately repeated accuracy drops sharply just beyond the period product in every seed. At 5008, the first evaluated length past the period product, mean accuracy falls to 0.0035 (uniform random) and 0.2500 (moderately repeated). Over the 625 lengths 5008–10,000, their means are below 0.00001 and 0.001, respectively. Offsets separated by 5005 share residues, so residue-only retrieval cannot distinguish them. We conclude that the models have likely learned to utilize the periodic value-side positions for copying.
All-identical behavior varies substantially (Figure 6 in Appendix B.1): seeds 42, 43, and 44 score 0.7292, 0.9063, and 0.0313 at 5008, with respective post-product means 0.4196, 0.1242, and 0.0162. All-identical strings can still be copied after residue collisions: confusing two letter positions preserves the copied character, whereas confusing a letter with the end delimiter can cause a termination error.
5 CONCLUSION
Repetition makes content-based occurrence matching ambiguous and motivates representing positions relative to delimiters. VO-rotation writes anchor-relative offsets into the value stream. With prime-period phases and CRT, a two-layer model copies arbitrary strings throughout its design horizon, using the same retrieval rule for copying and termination at -bit precision. The lower bound identifies a width-independent finite-precision obstruction: under the stated saturation condition, a model cannot both finish a sufficiently long identical copy and terminate correctly. In the synthetic experiments, two-layer VO models learn to copy with near-perfect accuracy up to length 5000, 2.5 times the maximum training length. On random and moderately repeated strings, their accuracy collapses just beyond the period product 5005, as expected when offset residues collide.
The broader design question is how positional information should reach later layers under repetition. Hybrid VO/RoPE training and the effect of value-side rotations on tasks that rely on value semantics remain to be tested. On the theory side, it remains open whether the saturation argument extends to other accumulation rules, and whether a score-side mechanism given the same residues can copy with comparable precision and depth.
AI DISCLOSURE
We used GPT and Claude to assist with proof development, implementation, experimental analysis, figure preparation, and writing. The authors checked the proofs and references, ran the code, reviewed the results and final text, and take responsibility for the final manuscript.
ACKNOWLEDGMENTS
Anxin Guo is supported by NSF grants ECCS-2216970 and CCF2154100 through Aravindan Vijayaraghavan. Zhiyuan Li is supported by DARPA AIQ Program and OpenAI superalignment award.
REFERENCES
Thomas Chen, Tengyu Ma, and Zhiyuan Li. Non-asymptotic length generalization. In Forty-second International Conference on Machine Learning, ICML 2025, Vancouver, Canada, July 13-19, 2025, volume 267 of Proceedings of Machine Learning Research, pp. 8621–8682. PMLR, 2025. URL https://proceedings.mlr.press/v267/chen25ar.html.
Ying Fan, Yilun Du, Kannan Ramchandran, and Kangwook Lee. Looped transformers for length generalization. In The Thirteenth International Conference on Learning Representations, ICLR 2025, Singapore, April 24-28, 2025. OpenReview.net, 2025. URL https://openreview.net/forum?id=2edigk8yoU.
Alejandro García-Castellanos, Maurice Weiler, and Erik J. Bekkers. RoVE: Rotary value embeddings attention for relative position-dependent value pathways. arXiv preprint arXiv:2606.11275, 2026. URL https://arxiv.org/abs/2606.11275.
Jiatao Gu, Zhengdong Lu, Hang Li, and Victor O. K. Li. Incorporating copying mechanism in sequence-to-sequence learning. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics, ACL 2016, August 7-12, 2016, Berlin, Germany, Volume 1: Long Papers, pp. 1631–1640. Association for Computational Linguistics, 2016. doi: 10.18653/V1/P16-1154. URL https://doi.org/10.18653/v1/p16-1154.
Matthew Henderson, Iñigo Casanueva, Nikola Mrkšić, Pei-Hao Su, Tsung-Hsien Wen, and Ivan Vulić. ConveRT: Efficient and accurate conversational representations from transformers. In Findings of the Association for Computational Linguistics: EMNLP 2020, pp. 2161–2174. Association for Computational Linguistics, 2020. doi: 10.18653/v1/2020.findings-emnlp.196. URL https://aclanthology.org/2020.findings-emnlp.196/.
Shengding Hu, Yuge Tu, Xu Han, Chaoqun He, Ganqu Cui, Xiang Long, Zhi Zheng, Yewei Fang, Yuxiang Huang, Weilin Zhao, Xinrong Zhang, Zheng Leng Thai, Kaihuo Zhang, Chongyi Wang, Yuan Yao, Chenyang Zhao, Jie Zhou, Jie Cai, Zhongwu Zhai, Ning Ding, Chao Jia, Guoyang Zeng, Dahai Li, Zhiyuan Liu, and Maosong Sun. MiniCPM: Unveiling the potential of small language models with scalable training strategies. In First Conference on Language Modeling, 2024. URL https://openreview.net/forum?id=3X2L2TFr0f.
Xinting Huang, Andy Yang, Satwik Bhattamishra, Yash Sarrof, Andreas Krebs, Hattie Zhou, Preetum Nakkiran, and Michael Hahn. A formal framework for understanding length generalization in transformers. In The Thirteenth International Conference on Learning Representations, ICLR 2025, Singapore, April 24-28, 2025. OpenReview.net, 2025. URL https://openreview.net/forum?id=U49N5V51rU.
Samy Jelassi, David Brandfonbrener, Sham M. Kakade, and Eran Malach. Repeat after me: Transformers are better than state space models at copying. In Ruslan Salakhutdinov, Zico Kolter, Katherine A. Heller, Adrian Weller, Nuria Oliver, Jonathan Scarlett, and Felix Berkenkamp (eds.), Forty-first International Conference on Machine Learning, ICML 2024, Vienna, Austria, July 21-27, 2024, volume 235 of Proceedings of Machine Learning Research, pp. 21502–21521. PMLR, 2024. URL https://proceedings.mlr.press/v235/jelassi24a.html.
Amirhossein Kazemnejad, Inkit Padhi, Karthikeyan Natesan Ramamurthy, Payel Das, and Siva Reddy. The impact of positional encoding on length generalization in transformers. In Alice Oh, Tristan Naumann, Amir Globerson, Kate Saenko, Moritz Hardt, and Sergey Levine (eds.), Advances in Neural Information Processing Systems 36: Annual Conference on Neural Information Processing Systems 2023, NeurIPS 2023, New Orleans, LA, USA, December 10 - 16, 2023, 2023. URL https://proceedings.neurips.cc/paper_files/paper/2023/hash/4e85362c02172c0c6567ce593122d31c-Abstract-Conference.html.
Oliver Kraus, Yash Sarrof, Yuekun Yao, Alexander Koller, and Michael Hahn. Barriers to universal reasoning with transformers (and how to overcome them). In Third Conference on Language Modeling, 2026. URL https://openreview.net/forum?id=PEC7ezuPEa.
Jiaoda Li and Ryan Cotterell. Characterizing the expressivity of fixed-precision transformer language models. In Advances in Neural Information Processing Systems, volume 38, pp. 159510–159554. Curran Associates, Inc., 2025. doi: 10.52202/085713-5329. URL https://proceedings.neurips.cc/paper_files/paper/2025/hash/e9e250537b0345111d50a5f8f392cffc-Abstract-Conference.html.
Jiaoda Li and Ryan Cotterell. Characterizing the expressivity of local attention in transformers. In Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 37485–37507, 2026. doi: 10.18653/v1/2026.acl-long.1739. URL https://aclanthology.org/2026.acl-long.1739/.
Zhiyuan Li, Hong Liu, Denny Zhou, and Tengyu Ma. Chain of thought empowers transformers to solve inherently serial problems. In The Twelfth International Conference on Learning Representations, ICLR 2024, Vienna, Austria, May 7-11, 2024. OpenReview.net, 2024. URL https://openreview.net/forum?id=3EWTEy9MTM.
William Merrill and Ashish Sabharwal. The parallelism tradeoff: Limitations of log-precision transformers. Trans. Assoc. Comput. Linguistics, 11:531–545, 2023. doi: 10.1162/TACL_A_00562. URL https://doi.org/10.1162/tacl_a_00562.
Takeru Miyato, Bernhard Jaeger, Max Welling, and Andreas Geiger. GTA: A geometry-aware attention mechanism for multi-view transformers. In International Conference on Learning Representations, 2024. URL https://openreview.net/forum?id=uJVHygNeSZ.
Catherine Olsson, Nelson Elhage, Neel Nanda, Nicholas Joseph, Nova DasSarma, Tom Henighan, Ben Mann, Amanda Askell, Yuntao Bai, Anna Chen, Tom Conerly, Dawn Drain, Deep Ganguli, Zac Hatfield-Dodds, Danny Hernandez, Scott Johnston, Andy Jones, Jackson Kernion, Liane Lovitt, Kamal Ndousse, Dario Amodei, Tom Brown, Jack Clark, Jared Kaplan, Sam McCandlish, and Chris Olah. In-context learning and induction heads. CoRR, abs/2209.11895, 2022. doi: 10.48550/ARXIV.2209.11895. URL https://doi.org/10.48550/arXiv.2209.11895.
Ofir Press, Noah A. Smith, and Mike Lewis. Train short, test long: Attention with linear biases enables input length extrapolation. In The Tenth International Conference on Learning Representations, ICLR 2022, Virtual Event, April 25-29, 2022. OpenReview.net, 2022. URL https://openreview.net/forum?id=R8sQPpGCv0.
Abigail See, Peter J. Liu, and Christopher D. Manning. Get to the point: Summarization with pointer-generator networks. In Regina Barzilay and Min-Yen Kan (eds.), Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, ACL 2017, Vancouver, Canada, July 30 - August 4, Volume 1: Long Papers, pp. 1073–1083. Association for Computational Linguistics, 2017. doi: 10.18653/V1/P17-1099. URL https://doi.org/10.18653/v1/P17-1099.
Peter Shaw, Jakob Uszkoreit, and Ashish Vaswani. Self-attention with relative position representations. In Marilyn A. Walker, Heng Ji, and Amanda Stent (eds.), Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, NAACL-HLT, New Orleans, Louisiana, USA, June 1-6, 2018, Volume 2 (Short Papers), pp. 464–468. Association for Computational Linguistics, 2018. doi: 10.18653/V1/N18-2074. URL https://doi.org/10.18653/v1/n18-2074.
Lena Strobl, William Merrill, Gail Weiss, David Chiang, and Dana Angluin. What formal languages can transformers express? A survey. Trans. Assoc. Comput. Linguistics, 12:543–561, 2024. doi:10.1162/TACL_A_00663. URL https://doi.org/10.1162/tacl_a_00663.
Jianlin Su. The road to transformer upgrades: 19. the second type of rotary position encoding. Scientific Spaces blog, April 2025. URL https://www.spaces.ac.cn/archives/10862. April 18, 2025. In Chinese; title translated.
Jianlin Su, Murtadha H. M. Ahmed, Yu Lu, Shengfeng Pan, Wen Bo, and Yunfeng Liu. Roformer: Enhanced transformer with rotary position embedding. Neurocomputing, 568:127063, 2024. doi:10.1016/J.NEUCOM.2023.127063. URL https://doi.org/10.1016/j.neucom.2023.127063.
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Isabelle Guyon, Ulrike von Luxburg, Samy Bengio, Hanna M. Wallach, Rob Fergus, S. V. N. Vishwanathan, and Roman Garnett (eds.), Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, December 4-9, 2017, Long Beach, CA, USA, pp. 5998–6008, 2017. URL https://proceedings.neurips.cc/paper/2017/hash/3f5ee243547dee91fbd053c1c4a845aa-Abstract.html.
Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. Pointer networks. In Corinna Cortes, Neil D. Lawrence, Daniel D. Lee, Masashi Sugiyama, and Roman Garnett (eds.), Advances in Neural Information Processing Systems 28: Annual Conference on Neural Information Processing Systems 2015, December 7-12, 2015, Montreal, Quebec, Canada, pp. 2692–2700, 2015. URL https://proceedings.neurips.cc/paper/2015/hash/29921001f2f04bd3baee84a12e98098f-Abstract.html.
Andy Yang, Michaël Cadilhac, and David Chiang. Knee-deep in C-RASP: A transformer depth hierarchy. In Advances in Neural Information Processing Systems, volume 38, pp. 37184–37225. Curran Associates, Inc., 2025. doi: 10.52202/085713-1249. URL https://proceedings.neurips.cc/paper_files/paper/2025/hash/354a6e7be4f1a35127746b8147a31bfe-Abstract-Conference.html.
Andy Yang, Pascal Bergsträßer, Georg Zetzsche, David Chiang, and Anthony Widjaja Lin. Length generalization bounds for transformers. In Proceedings of the 43rd International Conference on Machine Learning, volume 306 of Proceedings of Machine Learning Research, pp. 144227–144248. PMLR, 2026. URL https://proceedings.mlr.press/v306/yang26c.html.
Hattie Zhou, Arwen Bradley, Etai Littwin, Noam Razin, Omid Saremi, Joshua M. Susskind, Samy Bengio, and Preetum Nakkiran. What algorithms can transformers learn? A study in length generalization. In The Twelfth International Conference on Learning Representations, ICLR 2024, Vienna, Austria, May 7-11, 2024. OpenReview.net, 2024. URL https://openreview.net/forum?id=AssIuHnmHX.
A DETAILS OF THE LLM COPYING EXPERIMENT
A.1 PROMPT AND EXPERIMENTAL SETUP
Each model is instructed via the following system prompt:
"You are a precise string-copying assistant. You will see a string enclosed between '$' and '.', followed by ':'. Output ONLY the enclosed string, character by character, with absolutely nothing else – no spaces before or after, no explanation, no newline."
The user prompt has the format
where . is the prompt end delimiter and : is the copy cue. The model is tasked to output exactly the enclosed string, not the delimiters.
Output extraction and scoring. Accuracy is the fraction of all 50 trials per length and condition whose extracted prediction exactly matches the target. The extraction routine removes <think> blocks, splits the remaining response into nonempty lines, and removes answer prefixes, delimiter symbols, quotes, backticks, and spaces. Among cleaned lines containing only lowercase letters, it selects the one whose length is closest to the target length; if none exists, it uses the cleaned last line.
Copying failures. Empty outputs count as copying failures. Qwen3.5 returns 112 empty outputs: 43 on geometric-block strings and 69 on all-identical strings, with none on i.i.d. strings.
Model variants. Table 3 identifies the model IDs and reasoning settings for each evaluated variant.
Qwen uses Ollama's chat API, GPT-5.5 uses the OpenAI Responses API, Gemini uses the Gemini API, and DeepSeek uses the DeepSeek API. The Qwen, Gemini, and DeepSeek requests set temperature to 0 and top-p to 1; Qwen additionally sets top-k to 1 and the repetition penalty to 1. OpenAI requests specify the reasoning effort and output budget but leave temperature and top-p unset.
Table 3: Frontier-model variants plotted in Figure 1. Each row uses 50 trials for each length and condition, a maximum generation budget of 20,000 output tokens, and the extraction policy described above.
| Model | Model ID | Reasoning/thinking |
|---|---|---|
| Qwen3.5 | qwen3.5:397b-cloud | thinking disabled |
| DeepSeek V4 Pro | deepseek-v4-pro | thinking disabled |
| Gemini 3.1 Pro | gemini-3.1-pro-preview | low thinking |
| Gemini 3.1 Pro | gemini-3.1-pro-preview | medium thinking |
| GPT-5.5 | gpt-5.5 | none |
| GPT-5.5 | gpt-5.5 | medium reasoning |
Lengths and repetition conditions. We evaluate source strings of 30, 100, 300, 1000, and 3000 characters under three conditions: i.i.d. uniform lowercase strings, geometric same-character blocks, and all-identical strings. For each block, we independently sample a lowercase letter uniformly and a length from a geometric distribution on the positive integers with success probability . We truncate the final block at the requested source length. Adjacent sampled blocks may share a character. The Qwen3.5 examples in Table 1 use the same thinking-disabled setting.
A.2 REPETITION AS A POSITIONAL STRESS TEST
Frontier LLMs copy random strings accurately but fail on repeated strings, where local content no longer distinguishes occurrences. This contrast motivates horizon-uniform copying and makes repetition a positional stress test beyond the ECB class.
Subword tokenization connects these character-level prompts to repeated-token contexts. Identical-character runs can yield repeated block tokens together with length-dependent boundary tokens. For example, under o200k_base, a run of 300 b's becomes 75 copies of the four-character token bbbb.
B ADDITIONAL SYNTHETIC EXPERIMENT DETAILS
Task encoding and string generation. The synthetic implementation uses the literal tokens §, ;, :, and . for , , , and , respectively:
The loss and exact-copy metric cover the generated answer after :, including the final period token. Training draws and uses i.i.d., all-identical, and block-generated strings with probabilities 0.1, 0.1, and 0.8, respectively. For the block component, we draw and set . For each block, we independently draw a character uniformly from the alphabet and a length from on the positive integers, truncating the last block to reach source length . Adjacent blocks share the same character with probability 1/26, so a maximal same-character run may span several sampled blocks. For repeated-string evaluation, we set , giving .
Training configurations. Tables 4 and 5 summarize the training configurations and optimizer updates used in Section 4. Every model uses training seeds 42, 43, and 44 with a shared configuration within its family. Optimization uses AdamW with , , learning rate , and no weight decay.
All models use effective batch size 32 (microbatch 4 with gradient accumulation 8 for the bf16 baselines, microbatch 8 with gradient accumulation 4 for VO-Rotation), GELU MLPs, layer normalization, and warmup-stable-decay (WSD) learning-rate scheduling (Hu et al., 2024) with 2000 warmup optimizer updates, followed by a constant-learning-rate phase and a final linear decay to zero (cooldown). The standard positional baselines use 8 attention heads of dimension 64. The ALiBi baseline computes the distance bias directly, with slopes from the MPT-7B implementation: for 8 heads, the slopes are , , so up to row-wise softmax constants the bias for query position and key position is . Hard-ALiBi masks four heads: for head , only keys with backward offset remain visible, while heads 5–8 keep the ordinary causal mask. The fp8 models use a simulated FP8 forward pass implemented by rounding linear-layer inputs and weights. Each VO model uses one modified VO layer with four prime-period heads, one head per prime; the periods are the first four primes starting at 5, namely 5, 7, 11, 13. This follows the one-period-per-head structure of Theorem 3.8, but the rotary value subspace is wider than the the theorem uses (32 of the 64 coordinates per head, forming 16 two-dimensional blocks), and the vector written into it is learned rather than fixed to . All rotary blocks within a head share the single frequency , so the extra width provides learned value components at that frequency rather than additional periods. All training budgets and completed step counts below are in optimizer updates, as in the optimization plots. We monitor training loss every 200 updates using an exponential moving average with decay 0.98. For VO, the average is applied to the loss, and cooldown starts when it falls below . For the standard baselines, it is applied to the base-10 log loss; from update 50,000 onward, cooldown starts if this average has not improved by at least 0.05 over 12,500 updates. If cooldown starts at update , the learning rate decays linearly to zero over updates, after which training stops. Cooldown also starts when reaches the configured update budget.
Precision simulation. We simulate FP8 forward passes by quantizing each linear layer's input and weight, then returning both to their incoming storage dtypes before the linear operation. Quantization uses PyTorch's float8_e4m3fn cast without tensor-wise or channel-wise scaling or extra clipping, with fraction-bit truncation when the cast is unavailable. We use straight-through gradients and retain master parameters, linear biases, and optimizer states at their original precision. Accelerate selects CUDA autocast in bf16 when supported and fp16 otherwise. Attention matrix products,
The fallback retains the incoming exponent range and keeps three fraction bits for float32/bfloat16 operands and one for float16 operands.
Table 4: Training configurations shared by seeds 42, 43, and 44. Budgets are maximum optimizer updates. FP8 sim. denotes the linear-operand simulation described above. All models use learning rate and no weight decay.
| Model | Layers | Width | Heads | Precision | Update budget |
|---|---|---|---|---|---|
| NoPE | 6 | 512 | 8 | bf16 | 320,000 |
| RoPE | 6 | 512 | 8 | bf16 | 320,000 |
| ALiBi | 6 | 512 | 8 | bf16 | 320,000 |
| Hard-ALiBi | 6 | 512 | 8 | bf16 | 320,000 |
| Sinusoidal | 6 | 512 | 8 | bf16 | 320,000 |
| VO-Rotation | 2 | 256 | 4 | FP8 sim. | 400,000 |
Table 5: Completed optimizer updates for each model and training seed, using the shared configurations in Table 4.
| Model | Seed 42 | Seed 43 | Seed 44 |
|---|---|---|---|
| NoPE | 102,800 | 115,440 | 110,760 |
| RoPE | 144,800 | 112,580 | 119,080 |
| ALiBi | 81,200 | 81,120 | 118,560 |
| Hard-ALiBi | 110,200 | 96,980 | 114,140 |
| Sinusoidal | 113,800 | 119,080 | 104,520 |
| VO-Rotation | 158,200 | 150,020 | 148,200 |
softmax, residual updates, and layer normalization use native PyTorch mixed-precision arithmetic. Position indices are integers, while phase multiplication and sine/cosine evaluation use float32.
Evaluation metrics. Section 4 reports string-level exact-copy accuracy using the final checkpoint, averaged over 96 examples per length and training seed. The baseline evaluations use source lengths 1, 9, 17, ..., 2993; the VO length-generalization evaluation uses 8, 16, ..., 10,000. Figure 3 uses a sparse subset of baseline lengths. At each displayed length, it plots the accuracy at the nearest evaluated VO length, at most four tokens away, using the baseline length as the horizontal coordinate. The plotted accuracies are three-seed means for every model; overlapping standard-deviation bands are omitted for readability. Table 2 reports the means and sample standard deviations near the training limit. The VO length-generalization curves and shaded bands show the mean and pointwise sample standard deviation across the three training seeds, with bands clipped to [0, 1].
Compute. Each model was trained on one GPU. The standard positional-encoding baselines used NVIDIA RTX A6000 GPUs; all three VO-Rotation training runs used NVIDIA RTX A4000 GPUs.
B.1 VO-ROTATION LENGTH GENERALIZATION UP TO 10,000 AND THE PERIOD PRODUCT
Each final VO checkpoint is evaluated at , with 96 examples per length and condition. Figure 6 shows the individual seed curves. All three seeds score 1.000 at every evaluated in every condition. Over the 375 extrapolation lengths 2008–5000, per-seed length averages have across-seed mean and sample standard deviation (uniform random), (), and (all-identical). Table 6 gives individual means and minima.
Table 6: VO exact-copy accuracy by training seed and distribution. Mean and minimum are over the 375 evaluated lengths 2008–5000; the final column gives accuracy at 5000.
| Seed | Distribution | Mean | Minimum | n = 5000 |
|---|---|---|---|---|
| 42 | Uniform random | 0.9834 | 0.4375 | 0.9688 |
| 43 | Uniform random | 0.9591 | 0.4688 | 0.8854 |
| 44 | Uniform random | 0.9964 | 0.9583 | 1.0000 |
| 42 | 0.9993 | 0.9167 | 1.0000 | |
| 43 | 0.9896 | 0.7188 | 0.9896 | |
| 44 | 0.99997 | 0.9896 | 1.0000 | |
| 42 | All-identical | 0.9962 | 0.9063 | 1.0000 |
| 43 | All-identical | 0.9973 | 0.8542 | 1.0000 |
| 44 | All-identical | 1.0000 | 1.0000 | 1.0000 |

Figure 6: VO-Rotation accuracy by seed, with seeds 42, 43, and 44 in rows and distributions in columns. Dashed black and dash-dotted red lines mark the maximum training source length 2000 and the period product 5005.
C NEXT-TOKEN COPYING AT FIXED CONTEXT LENGTH IS IN DLOGTIME-UNIFORM AC
At fixed context length n, the next-token copy map is a delimiter-indexed multiplexer. This is the circuit fact used in Section 2; the input size fixes the current context length, not the source length.
Fix a finite source vocabulary and let . Encode tokens by one-hot indicators , where means that the token at position is . For a fixed context length , consider reachable copy prefixes, i.e., contexts that arise during correct autoregressive copying (where every token generated after matches the corresponding source token):
with total length . If the token is at position , then and the correct next token is obtained from the source-side position . This position is when and is when . The output map sends vocabulary tokens to themselves and sends to .
For each candidate delimiter position , define . The term gate tests both this delimiter boundary and the selected source token:
For every output token , define
The delimiter range is equivalently , which keeps the selected cell on the source side.
Proposition C.1 (Autoregressive copying at fixed context length is in DLOGTIME-uniform AC ). The family of next-token maps on reachable copy prefixes, indexed by context length n, is computable by a DLOGTIME-uniform AC circuit family of depth and size .
Proof. On this reachable-prefix domain, exactly one delimiter gate is active, at the true , boundary. Therefore, for each output token , the OR defining reduces to the source-side indicator selected by and then passed through the fixed output map . At the final copying step this selected position is the source-side , so termination is handled by the same multiplexer and the fixed map .
Each is a constant fan-in AND, each term is a constant fan-in AND, and the final OR has fan-in . Thus the circuit has constant depth and size . If tokens are represented by any fixed binary encoding rather than one-hot indicators, the predicates are constant-size equality tests because is fixed, which changes only constant factors and constant depth. The direct-connection language is decidable in time. Gate indices specify one of four types: input gates , delimiter gates , term gates , and output gates . Given two gate indices, adjacency is determined by a constant number of comparisons and the affine relation . Since these operations on -bit indices are decidable in time, the family is DLOGTIME-uniform .
Remark C.2 (Fixed-context circuits and horizon-uniform models). If the source length and generation offset are fixed as well, the map degenerates to a single wire from the corresponding source coordinate. The next-token map above instead selects among source positions using the delimiter-indexed table compiled into the wiring. Theorem 3.4 concerns a different constraint: one transformer must copy throughout its design horizon under the specified ECB restrictions and finite-precision execution, with saturation threshold .
D PROOFS FOR SECTION 3
We use the copying task of Section 3.1 and the anchor-relative offsets of Section 3.3.
Proof dependencies.
| ECB | Repeated-addition eventual constancy constant-block invariance terminal-run saturation Theorem 3.4. |
| VO with CRT periods | Underflow threshold Layer-1 anchor CRT fingerprint Layer-2 margin/logit gap Layer-2 one-hot Theorem 3.8. |
Notation. We retain the main text's notation for hidden states, anchors, offsets, and saturation thresholds. The additional symbols below distinguish exact phases, rounded fingerprints, and score errors.
| Symbol | Meaning | Definition or convention |
|---|---|---|
| Arithmetic and lower bound | ||
| upper bound on the number of scalar -bit encodings | Section D.1 | |
| logit magnitude at which rounds to zero | Definition D.1 | |
| largest eventual-constancy index in layer | Definition D.5 | |
| terminal-run saturation threshold after layer | Lemma D.6 | |
| VO construction | ||
| active anchor at position | Section 3.3 | |
| active-anchor offset | Section 3.3 | |
| prime period of head | Definition D.10 | |
| product of prime periods | Definition D.11 | |
| largest prime period | Definition D.11 | |
| ideal unit vector for residue modulo | Section D.3 | |
| rounded period- rotation table | Section D.3 | |
| computed CRT fingerprint at position | Section D.3 | |
| score-error bound in units of | Equation (5) | |
| remaining mismatch penalty in units of | Equation (5) | |
| rotary-vector scale; logits are scaled by | Equation (5) | |
D.1 FINITE-PRECISION PRIMITIVES
Fix a -bit floating-point format with 1 sign bit, exponent bits, and mantissa bits (). Write for round-to-nearest-even. Let be the finite set of representable floats, including signed zero. There are at most possible -bit encodings, and we write . For lower-bound executions, we assume all arithmetic intermediates remain finite and representable. In particular, the recursive ALiBi case uses a bias recurrence without overflow (Lemma D.8).
Definition D.1 (Underflow threshold). When the set below is nonempty, define
Thus is itself representable.
Floating-point format for the VO construction. We use a binary format with gradual underflow and normal exponents from through . Its smallest positive subnormal is . Under round-to-nearest-even, rounds to zero exactly when . The threshold is the least representable number at or above this value. For the bit allocations in Definition D.11(B4) below, , so this number exists for all sufficiently large and . Rounding the real threshold upward to a representable number changes it by at most a constant factor; the exponent range also contains , and .
Fact D.2 (Repeated-addition eventual constancy). Let be a -bit float, an arbitrary -bit float, and . If every remains finite, then for all for some .
Proof. For the claim is immediate. For , round-to-nearest-even satisfies for every finite representable , so is non-decreasing. A non-decreasing sequence in the finite set becomes constant after at most distinct -bit states. The case follows by applying the positive-increment case to .
Corollary D.3 (Componentwise eventual constancy). Let be fixed and . Then is eventually constant, with eventual-constancy index .
Proof. Apply Fact D.2 to each coordinate and take the maximum of the coordinatewise eventual-constancy indices.
Attention execution model. Each head at layer computes, for query position , logits for , maximum logit , shifted weights , and a left-to-right accumulation of the softmax denominator and numerator :
The head-local pre-output is . Write for the projected attention output. The layer update is
Here is a fixed deterministic position-wise feed-forward map of the incoming state and local attention output; this notation includes an MLP applied to their sum. All operations are deterministic in p-bit arithmetic.
Lemma D.4 (Constant-block invariance). Consider a left-to-right softmax accumulation that processes a contiguous block of at least positions, each contributing the same shifted weight w and weighted value . After the first positions in this block, the accumulator state is fixed. Inserting or removing additional copies of the same addend inside this constant repeated block does not change the state upon exit from the block.
Proof. Apply Fact D.2 to the scalar denominator Z. For the numerator, apply Corollary D.3 coordinatewise to the fixed vector addend . After at most identical addends, both the denominator and every numerator coordinate have reached a fixed point for this repeated addition. Any additional copies of the same addend therefore leave the accumulator unchanged.
How these primitives are used. The state bound is used only to guarantee eventual constancy after repeated identical addends. The underflow threshold is used only to force exact one-hot attention when all non-winners have shifted logits at most . The machine precision is used only to bound rounding errors in the CRT fingerprint and Layer-2 logit-gap argument.
D.2 LOWER BOUND
Throughout this subsection, fix the horizon N and write for the precision at that horizon. All contexts considered below lie in the model domain of .
Terminal-run contexts. For a fixed prefix , token , and , consider the context . We write for its last-token hidden state. By causality, is also the state of the -th terminal-run token inside for any .
Definition D.5 (Formal model). Fix a horizon N and write D for the depth of . The class consists of models satisfying:
(A0) Initial hidden states are position-independent token embeddings: , with no absolute positional embeddings, index features, counters, or other access to i. The only positional dependence in the model is the distance-bias term in (A4).
(A1) The model is a depth-D causal transformer-style model with arbitrary width and skip connections as in (1).
(A2) Execution is deterministic p-bit execution as in Appendix D, including the left-to-right softmax accumulation described above.
(A3) At layer and head h, queries, keys, and values are functions only of layer- hidden states.
(A4) Positional information enters only through a distance-dependent bias. For visible keys, the numerical logit is
A hard-mask value means that the key is removed before numerical evaluation, with shifted weight exactly zero; it is not an infinite arithmetic intermediate. Visible-key biases and all numerical arithmetic intermediates are finite.
(A5) Each is eventually constant: there is such that for all . We write .
(A6) The readout is deterministic and position-free from the final hidden state.
D.2.1 TERMINAL-RUN SATURATION AND THE COPYING LOWER BOUND
Throughout the lower-bound proof, fix a prefix and a token . We compare and : once the terminal run is sufficiently long, another copy of no longer changes the next-token logits. The threshold at each layer allows positions for the distance biases to become constant and identical contributions for the softmax accumulators to stop changing. The following layerwise statement proves the terminal-run saturation lemma in the main text (Lemma 3.3).
Lemma D.6 (Layerwise terminal-run saturation). Fix and . Define
For every layer , the state is independent of for . Consequently, for ,
bit-for-bit. Hence
Proof. We induct on . The case follows from position-independent token embeddings, since every terminal-run token is . Assume the claim at layer , and consider the query at index within the terminal run, with
By the induction hypothesis and causality, all terminal-run tokens with index at least have the same previous-layer state, hence the same query, key, and value. For any head , split its causal scan into the following blocks, with indices measured from the start of the terminal run:
prefix and early run tokens
The last part is empty if . The first part is independent of : its hidden states are fixed by causality, and its distances from the query are already beyond the eventual-constancy threshold. The middle part contains at least positions with equal hidden states, all at distances at least from the query, so the constant distance bias gives identical softmax contributions, or zero contributions if this block is masked. The last part always has positions, at distances from the query. The max-shift is therefore independent of . By constant-block invariance, changing the length of the middle block does not change the accumulator state after leaving it. Thus every head output, and hence the layer- hidden state after the deterministic layer update, is independent of . This proves the induction. The final hidden-state equality follows by taking , and the logit equality follows from the position-free deterministic readout (A6).
Proof of Theorem 3.4. We show that a correct all-identical copy cannot be followed by correct termination once . Since , for all sufficiently large and every we have . Let
If the first generated tokens are not all , the model has already failed. Otherwise, the -th token was generated from . By Lemma D.6, all contexts with have identical logits. Deterministic greedy decoding therefore outputs at , where the correct token is , and then continues outputting for as long as the context remains in the model domain.
Definition D.7 (ALiBi and Hard-ALiBi distance biases). For a query position and key position , write . In our sign convention, the attention logit is .
Following Press et al. (2022), an ALiBi head with slope uses the distance penalty
This exact-real bias is not eventually constant when ; the same is true if one computes directly and rounds each value independently. The recursive implementation of ALiBi mentioned in Corollary 3.5 is computed by the rounded recurrence
Following Jelassi et al. (2024), an ideal Hard-ALiBi head with window length masks all positions outside the window:
Thus the head has an unpenalized causal window of length . In finite-precision execution, hard-masked keys are removed before the softmax and receive shifted weight zero. Replacing the mask by a representable constant penalty also gives an eventually constant bias (Lemma D.9), so both versions satisfy the bias condition. Unmasked Hard-ALiBi heads are NoPE heads, .
Bias thresholds for the corollary. To apply the lower bound to the three cases in Corollary 3.5, it remains to bound their eventual-constancy indices.
Lemma D.8 (Recursive implementation of ALiBi is eventually constant). Let be a p-bit float and define , . Assuming finite intermediates do not overflow, there exists such that for all .
Proof. If and is finite and representable, then and round-to-nearest-even cannot round the result to a representable value below . Hence . can make at most strict increases among -bit states, so it becomes constant after at most distinct representable values. Thus there exists such that for all .
Lemma D.9 (Hard-ALiBi is eventually constant). A finite-window Hard-ALiBi head with window length as in Definition D.7 is constant outside the window: either the masked contribution is zero in the ideal hard-mask implementation, or for all in the finite-penalty implementation. Thus its eventual-constancy index is at most .
Proof. For every , both and fall outside the unpenalized window. In the ideal hard-mask version, both positions are removed from the softmax, equivalently both shifted weights are fixed at 0. In a finite-penalty version, both distances receive the same outside-window penalty , so .
General Hard-ALiBi window condition. For a Hard-ALiBi family, let over the hard-masked heads in layer , treating unmasked NoPE heads as having index 0. Theorem 3.4 applies whenever
The main-text corollary uses the simpler sufficient condition for every layer.
Proof of Corollary 3.5. We bound by in each of the three cases, under the stated no-overflow assumption for recursive ALiBi. For NoPE, for every layer and head, so and . For the recursive implementation of ALiBi with finite intermediates, Lemma D.8 gives for every head, so and . For bounded-window Hard-ALiBi with all windows at most , Lemma D.9 gives for every hard-masked head; unmasked heads have . Hence again and . Since ,
Theorem 3.4 applies in all cases. In particular, and give . If , then the same sufficient condition requires .
D.3 FORMAL VO CONSTRUCTION WITH CRT PERIODS
This subsection gives the fully formal instantiation of the main-body VO-rotated head in Definition 3.6 and the class in Definition 3.7. Recall that is the position until appears, and the position thereafter; is the offset from that anchor. The source tokens have offsets , the source-side has offset , and the copy region starts at offset 0. Throughout this subsection, denotes the fixed two-dimensional period-q rotation
with powers interpreted modulo . The ideal unit vector for residue is . We store rounded rotations as , indexed by the exact residue and rounded entrywise. Let denote a matrix-vector product with each multiplication and addition rounded to bits. Layer 1 stores one computed rotary vector per prime period. Together they form the fingerprint . The ideal counterpart of is ; Lemma D.13 bounds the error between them.
The construction below specifies the positional encoding and both layers before verifying their routing and precision guarantees.
VO-rotated attention heads. We use the VO head of Definition 3.6, with integer period and even rotary value dimension . Its attention weights use ordinary unrotated query/key logits; only the rotary value subspace undergoes the position-indexed pre- and post-rotations. In p-bit execution, these rotations use exact table indices and rounded arithmetic as specified below.
Definition D.10 (Prime- VO head). A prime- VO head is a NoPE causal attention head with one-dimensional query/key coordinates, ordinary logits , a two-dimensional rotary value subspace, and prime period . Before rounding, its rotary head-local pre-output is
where powers of the fixed two-dimensional rotation are interpreted modulo . If this head attends one-hot to position and , its ideal rotary output is ; the computed output uses the rounded rotation tables.
Definition D.11 (Formal instantiation with CRT periods). For the construction theorem, is instantiated with prime periods as follows. The modular position indices in (B5) select the rotation tables; the remaining conditions specify the two layers, resource parameters, and token readout.
(B1) Layer 1 has H prime- VO heads for the first H primes, each with . The output projection writes their 2H head-local pre-output coordinates into a fingerprint subspace and leaves the token-embedding subspace untouched; .
(B2) Layer 2 is a single readout attention head whose query and key vectors are partitioned into H prime blocks. The index h in and denotes a block within this head. Its logit is the sequential p-bit sum
Here denotes left-to-right rounded summation, and denotes an inner product evaluated in p-bit arithmetic. Its value vector is the preserved token embedding at position j, and its output projection writes only to the token-readout block used by the final decoder; .
(B3) , so the largest prime period is and the product of the periods is .
(B4) with and with a sufficiently large absolute constant.
(B5) Each position has exact access to its index modulo , which selects the corresponding rounded rotation-table entry. The construction uses , so its value rotations apply using . Implementation and storage costs are given in Section D.4.4.
(B6) For any fixed finite vocabulary V, choose large enough for disjoint token-embedding and token-readout blocks. Token embeddings for occupy the first block; the fingerprint and token-readout blocks are initialized to zero. The final linear readout reads only the token-readout block. The greedy argmax recovers vocabulary tokens from the returned token vector and maps the returned embedding to . One may take one-hot token embeddings with identity rows for V, an row that scores the coordinate, and zero readout weights on the other coordinates.
Layer-1 instantiation. For each prime head h,
where is the token at position , with value vector in the two-dimensional rotary subspace. The resulting computed component approximates through two rounded rotations, as shown in Lemma D.13.
Layer-2 instantiation. At a copy-region query t, the next source-side position has offset . Layer 2 rotates the query fingerprint by one step and compares it with each stored key fingerprint. For each prime block h, choose
where is the rounded one-step rotation and A is a power-of-two scale chosen below. With ideal fingerprints and exact arithmetic, the centered dot product is
A key with offset gives ideal centered inner product 0. Any wrong position mismatches in at least one prime coordinate, producing a negative cosine gap. Scaling by , with rounding error controlled by the choice of precision, pushes all wrong logits below the softmax underflow threshold. Let be a universal error constant for one prime block, including the stored fingerprints, the one-step query rotation, and the rounded inner product. Choose large enough to cover both the aggregate block errors and the left-to-right summation error from Lemma D.16. These constants depend only on the fixed arithmetic format and constant-dimensional block operations, not on , , , or the input length. Define the score-error budget , the remaining mismatch penalty , and the scale by
The target logit will lie within of zero, while every wrong logit will be at most . Their separation is therefore at least , which must exceed the underflow threshold . With and , we have , so for all sufficiently large . Since is a power of two, both and are exactly representable binary floating-point numbers whenever the exponent range contains their exponents. Throughout the Layer-2 proof, take large enough that . Then and .
D.4 PROOFS FOR THE VO CONSTRUCTION WITH CRT PERIODS
We first verify anchor selection, then bound the error in the stored fingerprints and the Layer-2 logits.
D.4.1 LAYER-1 ANCHOR SELECTION AND FINGERPRINTS
Lemma D.12 (Layer-1 exact one-hot). Under (3), Layer 1 satisfies bit-for-bit for every non- position.
Proof. For every non- query position, , so the ordinary attention logit to candidate is simply .
If has not appeared in the causal prefix up to , the visible key is , while every other visible key is . Hence the position is the unique maximizer. After max-shift, the weight is , and every other shifted logit is at most , so its exponential rounds to 0 by Definition D.1.
If has appeared, the unique position has key 0, has key , and all other visible positions have key . Thus the position is the unique maximizer. Again the winner contributes weight 1 and every non-winner is at least below the maximum after max-shift, so all non-winner weights round to 0. In both cases the denominator is exactly 1 and the attention is bit-for-bit one-hot on .
With this one-hot attention, the denominator is 1 and all non-anchor numerator contributions are zero. Pre-rotation of selects the first column of the rounded table exactly, and accumulation preserves that column. The computed rotary output is therefore
The same expression holds at , whose causal attention contains only itself.
Lemma D.13 (Fingerprint). For all sufficiently large N, the computed Layer-1 outputs satisfy:
(i) depends only on the pair .
(ii)
(iii) uniquely identifies for .
Proof. Part (i) follows from (6) and exact table indexing. For part (ii), fix a head, abbreviate and , and put and . Every rounded table entry has magnitude at most 1 and absolute error at most . Thus and . Using the matrix row-sum norm and , we obtain
Each coordinate of requires two products of magnitude at most 1 and one sum of magnitude at most 2. For sufficiently large , rounding these operations introduces at most per product and for the sum, including underflow; the exponent range in (B4) contains these bounded intermediates without overflow. The arithmetic error is therefore at most per coordinate. Since in exact arithmetic, the total error is at most , independently of , , and .
For part (iii), two distinct offsets differ modulo some prime by CRT, since . For their distinct residues in this head,
by Fact D.14. Hence the separation is at least . The two computation errors subtract at most , which is smaller for sufficiently large , since and . Thus computed fingerprints belonging to distinct offsets remain distinct, even when their absolute positions and anchors differ.
The Layer-2 margin argument needs only that different residues are separated by a cosine gap. The closest two different residues are one step apart on a period-q circle.
Fact D.14 (Cosine gap). For integer , .
Proof. For , and on . Thus . Substituting gives .
D.4.2 LAYER-2 MATCHING AND FINITE PRECISION
For one prime block, the centered inner product is near zero when the shifted query residue matches the key residue. A mismatch costs at least the cosine gap, up to rounding error.
Lemma D.15 (Per-prime-block logit bounds). Let be the residue sought by the query and the residue stored at the candidate key. For all sufficiently large N, we have
In particular, matching residues give an absolute value at most , while mismatched residues give
Proof. Write and for the unscaled rotary query and key components. Lemma D.13 gives a uniform error for each stored component. The additional one-step query rotation has bounded entries and a fixed number of rounded operations, so it adds only error. Consequently,
The exact inner product of the unrounded unit vectors is
Scaling by , multiplying coordinates, summing the two coordinates, and adding the centering term introduce only error. The universal constant absorbs the Layer-1 errors from Lemma D.13, the rounded one-step query rotation, scaling by the representable power of two , the two rounded products, and the rounded addition and centering by . If , the exact centered value is 0. If , Fact D.14 gives , which gives the stated upper bound after rounding.
To combine the per-block bounds, we must also control rounding in the sum over prime blocks.
Lemma D.16 (Left-to-right summation error). Let be finite p-bit numbers with . Assume no overflow occurs during the deterministic left-to-right p-bit summation and is sufficiently small. Then, for a constant depending only on and fixed arithmetic-format constants,
Proof. Let be the rounded left-to-right partial sum and the exact real partial sum. Inductively, as long as is small, , with constants depending only on and the fixed arithmetic format. Thus the -th rounded addition has absolute rounding error . Summing this bound over the additions gives
after increasing by a fixed constant factor.
At a copy-region query of offset k, all visible copy-region offsets are at most k. The source side contains exactly one position of offset for , so the target is unique among visible positions. The next lemma compares its logit with those of all other visible positions.
Lemma D.17 (Layer-2 logit bounds). Let copy position have offset , and let be the unique position with . For all sufficiently large , provided :
(i)
(ii) for every with .
Proof. For the correct match , every prime block has , so the residues match at every prime. Lemma D.15 bounds the exact sum of the rounded block contributions by in absolute value. Lemma D.16, with chosen large enough to absorb both errors, then gives part (i).
For a wrong position , CRT uniqueness implies that at least one prime has
For this mismatched block, Lemma D.15 gives
Every matched block can contribute at most , and every other mismatched block can only decrease the upper bound for all sufficiently large . The score-error budget satisfies , so and a mismatch remains negative after rounding. Summing over all prime blocks and applying Lemma D.16, with absorbing the aggregate per-block errors,
Once the wrong logits are at least below the maximum, their exponentials underflow to zero. The softmax is therefore exactly one-hot on the matching offset.
Lemma D.18 (Layer-2 exact one-hot). Let copy position have offset , and let be the unique visible position with . Provided , Layer 2 satisfies bit-for-bit.
Proof. Lemma D.17 shows that achieves the maximum logit. After max-shift, its shifted logit is 0 and its weight is . For every wrong position,
using the standing Layer-2 condition and the power-of-two choice . Thus every wrong exponential underflows to 0, the softmax denominator is 1, and bit-for-bit.
D.4.3 Copying and Resource Bounds
Lemma D.19 (VO copying lemma with CRT periods). For the formal instantiation in Definition D.11:
(i) Layer 1 attends bit-for-bit one-hot to the active anchor .
(ii) The H VO outputs form a CRT fingerprint that uniquely determines whenever .
(iii) At any copy-region query of offset k, Layer 2 attends bit-for-bit one-hot to the unique visible position with offset .
Proof of Lemma D.19. Part (i) is Lemma D.12. Part (ii) is Lemma D.13. For part (iii), at a copy-region query of offset k, the visible position with offset is unique whenever ; Lemma D.18 then gives exact one-hot attention to that position.
Proof of Theorem 3.8. We use the copying lemma to obtain the required outputs, then account for precision and dimension. Fix a sufficiently large design horizon , a finite vocabulary , arbitrary , and arbitrary source tokens . At a copy-region query of offset , Lemma D.19(iii) gives bit-for-bit one-hot attention to the unique visible position of offset . This position holds if and if . Since writes only to the fingerprint subspace and , the Layer-1 skip connection preserves the token embedding at position . The token-readout block remains zero through Layer 1. Layer 2 writes its returned value into that block; its zero MLP and the residual connection therefore leave exactly the retrieved token vector there. The fixed linear readout from (B6) and greedy argmax output the correct vocabulary token, or output when the returned token is .
It remains to account for resources. The first primes satisfy and for , by the prime number theorem. Hence . With and ,
so , , and the cosine gap survives rounding. The exponent in is because and . Hence a sufficiently large constant in gives enough exponent range to represent and exactly. Since by construction, the underflow inequalities above remain valid. Thus all calculations above use bits. The added fingerprint subspace has dimension . The total residual dimension can be taken as . As in (B5), exact residues select the rounded rotation tables; Lemma D.13 and the Layer-2 bounds account for all subsequent rotation errors.
D.4.4 IMPLEMENTATION AND RESOURCE CONVENTIONS
Modular phase tables and counters. We use a sequential position generator to maintain each head's rotation-table index with a cyclic counter , . Since , each counter uses bits, within the construction's precision scale; total counter state is bits across heads. The counter supplies the exact residue for phase selection, as required by Definition 3.7. The phase values and rotation arithmetic are rounded to bits: Lemma D.13 bounds the total Layer-1 error by , and the Layer-2 gap analysis in (5) carries it through to the logits. Head needs sine/cosine pairs, giving stored scalars across heads, each rounded to bits. The counters index these tables and depend only on position, while the attention computation selects the active anchor and forms its relative-offset fingerprint. Table storage and counter state are accounted for separately from the precision of each stored coordinate.
In exact arithmetic, both RoPE and VO use the composition identity , but in different computations: RoPE uses rotations in query/key inner products, whereas this construction returns offset representations for the next layer to match. The VO guarantee requires distinct residues to remain distinguishable after rounding. Small periods keep the cosine gap in Fact D.14 at least , which the Layer-2 precision analysis controls.
Remark on head-wise periods. Definition D.10 assigns one period per head, but distributing the residues across heads is a presentational choice, not a resource requirement. Allowing different periods in different two-dimensional blocks of a single head implements the same computation: every prime head attends one-hot to the same active anchor, so a single head with the block-diagonal rotation reproduces all rotary outputs under the shared attention pattern, and Layer 2 already combines all prime blocks inside a single head via (2). The resources can therefore equivalently be counted as a total rotary dimension of rather than a head count.