PreprintCited by 0semigroups and automata theoryComputability, Logic, AI AlgorithmsNeural Networks and Applications

Length Generalization Bounds for Transformers

Open access
Yang, Andy, Bergsträßer, Pascal, Zetzsche, Georg, Chiang, David, Lin, Anthony Widjaja·2026·Zenodo

Abstract

Abstract: Length generalization is a key property of a learning algorithm that enables it to make correct predictions on inputs of any length, given finite training data. To provide such a guarantee, one needs to be able to compute a length generalization bound, beyond which the model is guaranteed to generalize. This paper concerns the open problem of the computability of such generalization bounds for C-RASP, a class of languages which is closely linked to transformers. A positive partial result was recently shown by Chen et al. (2025) for C-RASP with only one layer and, under some restrictions, also with two layers. We provide complete answers to the above open problem. Our main result is the non-existence of computable length generalization bounds for C-RASP (already with two layers) and hence for transformers. To complement this, we provide a computable bound for concepts representable in the positive fragment of C-RASP, which we show equivalent to fixed-precision transformers. For both positive C-RASP and fixed-precision transformers, we show that the length complexity is exponential, and prove optimality of the bounds.

AI snapshot

Written from the paper’s full text.

TL;DR

The paper proves that C-RASP, and hence transformers, do not admit computable non-asymptotic length generalization bounds even at depth two, while the positive fragment C-RASP+ and fixed-precision transformers have tight exponential length complexity. It establishes undecidability of C-RASP emptiness via Hilbert’s 10th problem and derives matching exponential upper/lower bounds for C-RASP+ and fixed-precision transformers.

Key findings

  • No computable length generalization bound for C-RASP: language emptiness is undecidable (Theorem 3.1), so length complexity is not computably bounded (Corollary 3.6); this holds already for depth-2 C-RASP, and by depth-preserving equivalence applies to transformers at depth 2 and beyond (Theorem 5.1). The required lengths grow faster than any computable function, including the Ackermann function.
  • The positive fragment C-RASP+ has exponential length complexity in program size (Theorem 4.7); the bound is tight in the worst case, e.g., the family \(P_n := (\overleftarrow{\#}[a] = n)\) has only the string of length \(n\), exponential in the binary encoding of \(n\) (Proposition 4.6).
  • Fixed-precision transformers admit length generalization with exponential length complexity: lower bound \(\Omega(2^{\mathrm{poly}(p,d,L)})\) (Proposition 5.3) and upper bound \(O(2^{\mathrm{poly}(p,d,L)})\) (Proposition 5.5) in precision \(p\), dimension \(d\), and depth \(L\).
  • The restricted class C-RASP\(_{2,K,T}\) from Chen et al. is strictly weaker than full depth-2 C-RASP: bounded-depth Dyck languages are not expressible in C-RASP\(_{2,K,T}\) for any \(K,T\) (Theorem 3.7 / Theorem B.4), explaining why prior polynomial/exponential bounds are not contradictory.

Methods

  • Formal-language and computational-complexity proofs; no empirical data or experiments are reported. The analysis uses C-RASP, C-RASP+, TL[-3], and two finite-precision transformer definitions.
  • Undecidability is shown by reducing Hilbert’s 10th problem / Diophantine equations to emptiness of regulated C-RASP-definable languages (Lemmas 3.4–3.5, Theorem 3.1), using Chen et al.’s equivalence between computable length complexity and decidable language equivalence (Proposition 2.6).
  • Positive bounds are obtained by translating C-RASP+ to a decomposed form and then to TL[-3] with exponential blow-up (Lemma 4.2, Proposition 4.4); a polynomial witness-length property for TL[-3] (Lemma 4.5) yields the exponential bound and tightness. Transformer results use known equivalences between C-RASP/transformers and C-RASP+/fixed-precision transformers, with size bounds derived in Appendix C.

Limitations

  • Stated: the paper leaves open whether there exists a polynomial-size translation from fixed-precision transformers into C-RASP+ (Section 5). It also states that its explanation for empirical length-generalization difficulty is speculative (“We speculate… may provide a plausible explanation”).
  • Evident: the results are theoretical and concern specific formalisms and variants—C-RASP, C-RASP+, TL[-3], and two finite-precision transformer rounding schemes—not empirical training of standard transformers; no experiments are reported.
  • Evident: the negative result concerns perfect learning / exact length generalization, not practical partial generalization; the paper notes transformers may generalize from lengths \(N\) to \(3N\) or even \(N\) to \(10N\), but performance degrades at long enough lengths.

Model-written summary. Check it against the paper before relying on it.

Integrity signals

Registry

DataCite · 10.5281/zenodo.18800699

Cites

0 citation errors · 0 not checkable

Statistics

Nothing to recompute.

Claims the paper makes

7 of 20 cited sources checked · 4 supported · 0 flagged · accuracy not yet measured

  • Premisecitation

    Transformers and C-RASP programs define the exact same class of languages.

    “because transformers and C-RASP programs define the exact same class of languages (cf.Yang et al., 2025, Theorem 3.1)”
    Quote in the paperSubstantial claim1 of 1 sources checked
    • cites Yang et al., 2025, Theorem 3.1 source

      Theorem 3.1 (Section 3, p. 5) establishes an exact, depth-preserving correspondence between the languages defined by TL[↼#]—which the introduction (p. 1) identifies as equivalent to C-RASP—and those recognized by a specified fixed-precision transformer. The claim omits that restriction: Section 2.1 (p. 3) specifies rounding except inside attention, future masking, and no positional encodings. The theorem also states the correspondence with a <BOS> prefix. (LLM, conf=0.90)

      Experimental — accuracy not yet measured
  • Premisecitation

    Chen et al. consider a restricted subset of programs, notated C-RASP 2,K,T.

    “However, this is because they consider a restricted subset of programs, which they notate as C-RASP 2,K,T .”
    Quote in the paperSubstantial claim1 of 1 sources checked
    • cites Chen et al. (2025) source
  • Premisecitation

    Non-asymptotic length generalization is equivalent to the decidability of the language equivalence problem for any finite class of languages.

    “we use the fact that non-asymptotic length generalization is equivalent to the decidability of the language equivalence problem for any finite class of languages (Chen et al., 2025, Lemma 3.4,Theorem 3.2).”
    Quote in the paperSubstantial claim1 of 1 sources checked
    • cites Chen et al., 2025, Lemma 3.4,Theorem 3.2 source

      Section 4.2 (Lemma 4.5; page unavailable) states that decidability of language equivalence is equivalent to non-asymptotic length generalization for the full class represented by an encoding system, provided the complexity measure satisfies Assumption 3.7. It does not state this equivalence for any arbitrary finite class of languages; the cited lemma and theorem numbers also do not match those in our copy. (LLM, conf=0.87)

      Experimental — accuracy not yet measured
  • Premisecitation

    There are finitely many positions where the weighted average of values by attention scores can be nonzero.

    “As observed by Li & Cotterell (2025) and Merrill & Sabharwal (2023), there are finitely many positions where this can be nonzero.”
    Quote in the paperSubstantial claim1 of 2 sources checked
    • cites Li & Cotterell (2025)

      Couldn’t be matched to a paper in Crossref, so it can’t be checked.

    • cites Merrill & Sabharwal (2023) source

      Proposition 1 (Section 3, p. 5) bounds the number of nonzero entries in a rounded p-precision attention-weight vector by 2^(2p). This supports a bound on positions contributing through nonzero attention weights, but only under the stated finite-precision condition; the cited sentence leaves that condition unstated. (LLM, conf=0.86)

      Experimental — accuracy not yet measured
  • Findingreasoning

    Dyck languages of bounded depth are not expressible in C-RASP 2,K,T, for any K and T.

    “Dyck languages of bounded depth are not expressible in C-RASP 2,K,T , for any K and T .”
    Quote in the paperSubstantial claim
  • Classified as probably not a substantial claim. 15
  • May combine two claims. 12
  • Classified as probably not a substantial claim.

    Premisecitation

    C-RASP_{2,K,T} has length complexity O(T^{O(K)}).

    “While Chen et al. (2025) C-RASP 2,K,T has a length complexity of O(T O (K)), we show that C-RASP 2 has uncomputable length complexity.”
    Quote in the paperSubstantial claim1 of 1 sources checked
    • cites Chen et al. (2025) source
  • Probably not a substantial claim: may not pass S3 (load-bearing).

    Premisecitation

    The depth 1 C-RASP fragment studied by Chen et al. (2025) has quadratic length complexity.

    “This accounts for why it is non-contradictory that the depth 1 C-RASP fragment they study has quadratic length complexity, while we show an exponential lower bound for C-RASP of depth 1.”
    Quote in the paperNot a substantial claim1 of 1 sources checked
    • cites Chen et al. (2025) source
  • May combine two claims.

    Premisecitation

    Chen et al. (2025) use the absolute size of the constants T as precision, while this paper uses the bit-precision p of the constants, which is exponentially smaller than the absolute size.

    “As a final note, we observe that Chen et al. (2025) use the absolute size of the constants T as precision, while we use the bit-precision p of the constants (exponentially smaller than the absolute size).”
    Quote in the paperSubstantial claim1 of 1 sources checked
    • cites Chen et al. (2025) source
  • Probably not a substantial claim: may not pass S4 (based).

    Findingnone given

    Language equivalence is reducible to nonemptiness for C-RASP-definable languages.

    “We note that language equivalence is reducible to nonemptiness for C-RASPdefinable languages.”
    Quote in the paperNot a substantial claim
  • May combine two claims.

    Findingreasoning

    A 1-layer fixed-precision transformer with precision p can recognize the language of all strings with at least 2^p a's, and this transformer only accepts strings of exponential length at least 2^p.

    “Consider the witnessing language ↼ #[a] ≥ 2 p (all strings with at least 2 p a's).A 1-layer fixed-precision transformer with precision p can recognize this language, and this transformer only accepts strings of exponential length ≥ 2 p .”
    Quote in the paperSubstantial claim
  • Probably not a substantial claim: may not pass S3 (load-bearing).

    Findingnone given

    The result of Lemma C.9 can be generalized to multi-ary functions with still an exponential bound.

    “We note this can be generalized to multi-ary functions with still an exponential bound.”
    Quote in the paperNot a substantial claim
  • May combine two claims.

    Findingcitation

    This paper derives precise size bounds in converting between C-RASP+ and fixed-precision transformers, which are singly exponential and polynomial, in the same way.

    “Our contribution is to derive precise size bounds in converting between C-RASP + and fixed-precision transformers, which also turn out to be singly exponential and polynomial, in the same way.”
    Quote in the paperSubstantial claim
    • The authors state this as an assumption: The constants in all defining functions of a transformer are given in binary and the precision is given in unary.
  • Probably not a substantial claim: may not pass S3 (load-bearing). May combine two claims.

    Findingcitation

    The ? operator in C-RASP does not increase expressive power or affect the depth of formulas.

    “We will often make use of the following operator in C-RASP, which does not increase its expressive power or affect the depth of formulas, but saves space when writing.”
    Quote in the paperNot a substantial claim0 of 1 sources checked
    • cites Yang & Chiang 2024

      Couldn’t be matched to a paper in Crossref, so it can’t be checked.

  • Probably not a substantial claim: may not pass S3 (load-bearing). May combine two claims.

    Findingnone given

    The depth of the TL[-3] formula is exponential in the size of the transformer, while the depth of the C-RASP+ formula is linear in the depth of the transformer.

    “However, an additional point we note is that the depth of the TL[-3] formula turns out to be exponential in the size of the transformer, while the depth of the C-RASP + formula is linear in the depth of the transformer.”
    Quote in the paperNot a substantial claim
    • The authors state this as an assumption: The constants in all defining functions of a transformer are given in binary and the precision is given in unary.
  • May combine two claims.

    Findingreasoning

    In the proof of Theorem C.11, c(L)_i ≥ 0 iff w,i |= ...; c(L)_i rounds to -2^{-s} or below if φ is false, and rounds to 0 or above if φ is true.

    “We observe that c (L) i ≥ 0 ⇐⇒ w, i |= t∈T α t t ≥ k. Thus, c (L) i rounds to -2 -s or below if ϕ is false, and rounds to 0 or above if ϕ is true.”
    Quote in the paperSubstantial claim
  • Probably not a substantial claim: may not pass S3 (load-bearing). May combine two claims.

    Findingreasoning

    The construction in Theorem C.11 adds one layer, some constant number of hidden dimensions, and uses the same precision p.

    “This adds one layer, some constant number of hidden dimensions, and uses the same precision p.”
    Quote in the paperNot a substantial claim
  • Probably not a substantial claim: may not pass S3 (load-bearing). May combine two claims.

    Premisecitation

    A positive partial result was recently shown by Chen et al. for C-RASP with only one layer and, under some restrictions, also with two layers.

    “A positive partial result was recently shown by Chen et al. for C-RASP with only one layer and, under some restrictions, also with two layers.”
    Quote in the paperNot a substantial claim0 of 1 sources checked
    • cites Chen et al.

      Couldn’t be matched to a paper in Crossref, so it can’t be checked.

  • Classified as probably not a substantial claim. May combine two claims.

    Premisecitation

    The decidability of Diophantine equations was Hilbert's Tenth Problem and was answered negatively by Matiyasevich (1993).

    “The decidability of Diophantine equations was Hilbert's Tenth Problem and answered negatively by Matiyasevich (1993).”
    Quote in the paperSubstantial claim0 of 1 sources checked
    • cites Matiyasevich (1993)

      Couldn’t be matched to a paper in Crossref, so it can’t be checked.

  • Probably not a substantial claim: may not pass S3 (load-bearing).

    Premisecitation

    The exact value of C_{q,M(L)} must range from 0 to 2^s.

    “The exact value of C q,M (L) must range from 0 to 2 s (Li & Cotterell, 2025, Proposition B.6).”
    Quote in the paperNot a substantial claim0 of 1 sources checked
    • cites Li & Cotterell, 2025, Proposition B.6

      Couldn’t be matched to a paper in Crossref, so it can’t be checked.

  • Probably not a substantial claim: may not pass S3 (load-bearing).

    Premisecitation

    Theorem C.6: Every TL[-3] formula can be simulated by a fixed-precision transformer.

    “Theorem C.6 (Li & Cotterell, 2025, Thm. 3.3).Every TL[-3] formula can be simulated by a fixed-precision transformer .”
    Quote in the paperNot a substantial claim0 of 1 sources checked
    • cites Li & Cotterell, 2025

      Couldn’t be matched to a paper in Crossref, so it can’t be checked.

  • May combine two claims.

    Premisereasoning

    In Li & Cotterell's construction, a singly exponential blowup occurs when simulating fixed-precision transformers in TL[-3], and a polynomial blowup occurs the other way around.

    “Their construction did not explicitly compute the size bounds, but a careful reading shows that a singly exponential blowup occurs when simulating fixed-precision transformers in TL[-3], and a polynomial blowup occurs the other way around.”
    Quote in the paperNot a substantial claim0 of 1 sources checked
    • cites Li & Cotterell (2025)

      Couldn’t be matched to a paper in Crossref, so it can’t be checked.

  • Probably not a substantial claim: may not pass S3 (load-bearing). May combine two claims.

    Premisecitation

    Previous work by Li & Cotterell (2025) characterized the expressivity of fixed-precision transformers in terms of temporal logic, and provided empirical evidence that transformers length-generalized very well on this class of languages.

    “Previous work by Li & Cotterell (2025) characterized the expressivity of fixed-precision transformers in terms of temporal logic, and furthermore provided empirical evidence that transformers length-generalized very well on this class of languages.”
    Quote in the paperNot a substantial claim0 of 1 sources checked
    • cites Li & Cotterell (2025)

      Couldn’t be matched to a paper in Crossref, so it can’t be checked.

  • Probably not a substantial claim: may not pass S3 (load-bearing).

    Premisecitation

    Theorem C.5: Every fixed-precision transformer can be simulated by a TL[-3] formula.

    “Theorem C.5 (Li & Cotterell, 2025, Thm. 3.2).Every fixed-precision transformer can be simulated by a TL[-3] formula.”
    Quote in the paperNot a substantial claim0 of 1 sources checked
    • cites Li & Cotterell, 2025

      Couldn’t be matched to a paper in Crossref, so it can’t be checked.

  • Probably not a substantial claim: may not pass S4 (based). May combine two claims.

    Interpretationnone given

    Transformers in principle have enough depth, width, and precision to express the ground truth solution, so any deficiencies must be as a result of learning dynamics.

    “These transformers in-principle have enough depth, width, and precision to express the ground truth solution, so any deficiencies must be as a result of learning dynamics.”
    Quote in the paperNot a substantial claim
  • Probably not a substantial claim: may not pass S3 (load-bearing).

    Premisecitation

    Lemma C.4: Any formula φ of C-RASP that uses the ? operator can be converted into a formula that does not use the ? operator, defines the same language as φ, and has the same depth as φ.

    “Lemma C.4 (Yang & Chiang 2024).Any formula ϕ of C-RASP that uses the ?operator can be converted into a formula that does not use the ?operator, defines the same language as ϕ, and has the same depth as ϕ.”
    Quote in the paperNot a substantial claim0 of 1 sources checked
    • cites Yang & Chiang 2024

      Couldn’t be matched to a paper in Crossref, so it can’t be checked.

20 of 20
  • The authors state this as an assumption.

    The constants in all defining functions of a transformer are given in binary and the precision is given in unary.

    “To measure the size of a transformer, we assume that the constants in all of its defining functions are given in binary and the precision is given in unary.”
  • The paper relies on this without support.

    There exists a fixed-precision representation F containing 1/k, k, and a value x such that round(exp(x))=0.

    “We pick a fixed-precision representation F which contains 1 k as well as k, and also contains a value x such that round(exp(x)) = 0.This is always possible.”
  • The paper relies on this without support.

    D_k is a proper subset of D_{k+1}.

    “This contradicts the fact that D k ⊊ D k+1 .”
3 of 3

Self-check

Percentages, sums and reported differences re-computed from the paper’s own numbers.

Each contradiction between two passages listed here was confirmed by an independent check.

  • Transformer construction drops counting coefficients

    Major

    The displayed attention computation sums unweighted truth indicators, but the claimed equivalence concerns a weighted sum with coefficients α_t. For example, one occurrence with coefficient 3 satisfies a threshold of 3 but contributes only 1 to the displayed sum.

  • Concatenation formula requires one separator too many

    Minor

    The stated concatenation of n languages has n−1 dollar-sign separators, whereas the constructed formula requires n. Consequently, the formula cannot define the stated concatenation.

2 of 2

Cites

The publisher hasn’t deposited this paper’s reference list.

Research works printed but not linked: 5

  1. Bueno, M. C., Gemmell, C., Dalton, J., Lotufo, R., and Nogueira, R. Induced natural language rationales and interleaved markup tokens enable extrapolation in large language models. In Proceedings of the 1st Workshop on Mathematical Natural Language Processing (MathNLP), pp. 17-24, 2022. doi:10.18653/v1/2022.mathnlp- 1. · DOI
  2. URL https://aclanthology.org/2022. mathnlp-1. · DOI
  3. Hoffmann, J., Borgeaud, S., Mensch, A., Buchatskaya, E., Cai, T., Rutherford, E., de las Casas, D., Hendricks, L. A., Welbl, J., Clark, A., Hennigan, T., Noland, E., Millican, K., van den Driessche, G., Damoc, B., Guy, A., Osindero, S., Simonyan, K., Elsen, E., Vinyals, O., Rae, J. W., and Sifre, L. An empirical analysis of compute-optimal large language model training. In Advances in Neural Information Processing Systems, 2022. URL https: //openreview.net/forum?id=iBBcRUlOAPR.
  4. Li, J. and Cotterell, R. Characterizing the expressivity of fixed-precision transformer language models. In The Thirty-ninth Annual Conference on Neural Infor- mation Processing Systems, 2025. URL https:// openreview.net/forum?id=29LwAgLFpj. · DOI
  5. Yang, A., Chiang, D., and Angluin, D. Masked hard- attention transformers recognize exactly the star-free languages. In Globersons, A., Mackey, L., Belgrave, D., Fan, A., Paquet, U., Tomczak, J. M., and Zhang, C. (eds.), Advances in Neural Information Processing Systems 38: Annual Conference on Neural Information Processing Systems 2024, NeurIPS 2024, Vancouver, BC, Canada, December 10 -15, 2024, 2024. URL http://papers. nips.cc/paper_files/paper/2024/hash/ 13d7f172259b11b230cc5da8768abc5f-Abstract-Conference. html.

Authors
Yang, A., Bergsträßer, P., Zetzsche, G., Chiang, D., & Lin, A. W.
Affiliations
  • University of Notre Dame (US)
  • University of Kaiserslautern (DE)
  • Max Planck Institute for Software Systems (DE)
Venue
Zenodo
Publisher
Zenodo
Published
2026-02-27
OpenAlex
W7131834010
Cited by
0
References
0
Type
posted content
Language
en
Open access
Locations
  • HAL (Le Centre pour la Communication Scientifique Directe) (submittedVersion, cc-by)
  • Zenodo (CERN European Organization for Nuclear Research) (cc-by)
Topics
  • Physical Sciences › Computer Science › Computational Theory and Mathematics › semigroups and automata theory
  • Physical Sciences › Computer Science › Computational Theory and Mathematics › Computability, Logic, AI Algorithms
  • Physical Sciences › Computer Science › Artificial Intelligence › Neural Networks and Applications
Keywords
length generalization, generalization bounds, transformer models, computability, computational learning theory

About these checks

Registry, retraction, Cites and statistics results are computed, not judged, with one exception: a printed reference that no index lists is read once by a model before it counts as a citation error. Claims are extracted by a model and kept only when their quote appears verbatim in the text; each cited source is then checked, with a model’s help, for whether it says what the claim relies on. Those verdicts can be wrong — read the claim’s quote and the cited source before relying on one.

Claims read by deepseek-v4.1-flash under definition version 3 (extract-v3) on 2026-10-23.

Classified by jev-1.13-20260917 (gold-guideline-v0.2) on 2026-10-23.

Cited sources are checked by gpt-6-sol.

Statistics and arithmetic are recomputed, not judged.

Confidence bands are shown only for fields calibrated on our annotated test set. None is calibrated yet, so no band is shown.

What counts as a claim ›How we measure confidence ›How we check this ›

Are you an author, or do you see a problem with this page? Request a review