mlsanityData to 14 Oct 2026

Universal Length Generalization with Turing Programs

arXiv 2407.03310 ↗First posted 3 Jul 2024cs.LGcited by 25

Not on the map. Why?

Abstract (arXiv)

Length generalization refers to the ability to extrapolate from short training sequences to long test sequences and is a challenge for current large language models. While prior work has proposed some architecture or data format changes to achieve length generalization, these proposals typically apply to a limited set of tasks. Building on prior scratchpad and Chain-of-Thought (CoT) techniques, we propose Turing Programs, a novel CoT strategy that decomposes an algorithmic task into steps mimicking the computation of a Turing Machine. This framework is both universal, as it can accommodate any algorithmic task, and simple, requiring only copying text from the context with small modifications. We show that by using Turing Programs, we obtain robust length generalization on a range of algorithmic tasks: addition, multiplication and in-context SGD. We then demonstrate that transformers achieve length generalization on random Turing Programs, suggesting that length generalization is possible for any algorithmic task. Finally, we theoretically prove that transformers can implement Turing Programs, constructing a simple RASP (Weiss et al.) program that simulates an arbitrary Turing machine.

Key facts. Cited by 25 papers in the map (data through 14 Oct 2026). Builds on 48 of its 59 references that are in the map. First posted on arXiv 3 Jul 2024.

Builds on

48 of 59 references.

References · 48

  1. 2017Attention Is All You Needcited by 60,361
  2. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
  3. 2020Language Models are Few-Shot Learnerscited by 32,419
  4. 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,599
  5. 2023LLaMA: Open and Efficient Foundation Language Modelscited by 14,132
  6. 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,459
  7. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  8. 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,326
  9. 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,703
  10. 2019Transformer-XL: Attentive Language Models Beyond a Fixed-Length Contextcited by 1,850
  11. 2022Solving Quantitative Reasoning Problems with Language Modelscited by 1,392
  12. 2018Self-Attention with Relative Position Representationscited by 1,120
36 more
  1. 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,103
  2. 2022In-context Learning and Induction Headscited by 964
  3. 2021Show Your Work: Scratchpads for Intermediate Computation with Language Modelscited by 886
  4. 2022GPT-NeoX-20B: An Open-Source Autoregressive Language Modelcited by 713
  5. 2014Neural Turing Machinescited by 644
  6. 2023Textbooks Are All You Needcited by 569
  7. 2023Faith and Fate: Limits of Transformers on Compositionalitycited by 503
  8. 2023The Impact of Positional Encoding on Length Generalization in Transformerscited by 327
  9. 2022Transformers Learn Shortcuts to Automatacited by 268
  10. 2019Compositionality decomposed: how do neural networks generalise?cited by 265
  11. 2023Looped Transformers as Programmable Computerscited by 237
  12. 2022Neural Networks and the Chomsky Hierarchycited by 217
  13. 2024Repeat After Me: Transformers are Better than State Space Models at Copyingcited by 216
  14. 2022Exploring Length Generalization in Large Language Modelscited by 206
  15. 2023What Algorithms can Transformers Learn? A Study in Length Generalizationcited by 199
  16. 2021Thinking Like Transformerscited by 184
  17. 2022Transformer Language Models without Positional Encodings Still Learn Positional Informationcited by 150
  18. 2019On the Turing Completeness of Modern Neural Network Architecturescited by 129
  19. 2023Teaching Arithmetic to Small Transformerscited by 123
  20. 2015Neural GPUs Learn Algorithmscited by 121
  21. 2021Can You Learn an Algorithm? Generalizing from Easy to Hard Problems with Recurrent Networkscited by 117
  22. 2023Randomized Positional Encodings Boost Length Generalization of Transformerscited by 117
  23. 2022Unveiling Transformers with LEGO: a synthetic reasoning taskcited by 106
  24. 2023Tracr: Compiled Transformers as a Laboratory for Interpretabilitycited by 104
  25. 2021Statistically Meaningful Approximation: a Case Study on Approximating Turing Machines with Transformerscited by 102
  26. 2022KERPLE: Kernelized Relative Positional Embedding for Length Extrapolationcited by 86
  27. 2024Transformers Can Achieve Length Generalization But Not Robustlycited by 86
  28. 2020On the Computational Power of Transformers and its Implications in Sequence Modelingcited by 85
  29. 2023Generalization on the Unseen, Logic Reasoning and Degree Curriculumcited by 73
  30. 2023Auto-Regressive Next-Token Predictors are Universal Learnerscited by 67
  31. 2023Length Generalization in Arithmetic Transformerscited by 66
  32. 2023Positional Description Matters for Transformers Arithmeticcited by 56
  33. 2017Recurrent Neural Networks as Weighted Language Recognizerscited by 30
  34. 2023Learning to Reason and Memorize with Self-Notescited by 30
  35. 2024Case-Based or Rule-Based: How Do Transformers Do the Math?cited by 26
  36. 2023GPT is becoming a Turing machine: Here are some ways to program itcited by 16

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2024: 4; 2025: 14; 2026: 7.

25 papers.

Sort:

By area:

  1. 2025Lower Bounds for Chain-of-Thought Reasoning in Hard-Attention Transformerscited by 28
  2. 2024Mixture of Parrots: Experts improve memorization more than reasoningcited by 21
  3. 2025Transformers Provably Learn Chain-of-Thought Reasoning with Length Generalizationcited by 14
  4. 2024Ask, and it shall be given: On the Turing completeness of promptingcited by 10
  5. 2025Softmax Transformers are Turing-Completecited by 9
  6. 2025The Role of Sparsity for Length Generalization in Transformerscited by 8
  7. 2025Beyond Single-Task: Robust Multi-Task Length Generalization for LLMscited by 7
  8. 2025Born a Transformer -- Always a Transformer? On the Effect of Pretraining on Architectural Abilitiescited by 6
  9. 2025Beyond Statistical Learning: Exact Learning Is Essential for General Intelligencecited by 6
  10. 2025Self-Verifying Reflection Helps Transformers with CoT Reasoningcited by 4
  11. 2025To Infinity and Beyond: Tool-Use Unlocks Length Generalization in State Space Modelscited by 4
  12. 2024Provable Length Generalization in Sequence Prediction via Spectral Filteringcited by 3
13 more
  1. 2025The Imitation Game: Turing Machine Imitator is Length Generalizable Reasonercited by 3
  2. 2025Probability Distributions Computed by Autoregressive Transformerscited by 2
  3. 2026On the Ability of Transformers to Verify Planscited by 2
  4. 2024Representing Rule-based Chatbots with Transformerscited by 1
  5. 2025Exact Learning of Arithmetic with Differentiable Agentscited by 1
  6. 2026Universal computation is intrinsic to language model decodingcited by 1
  7. 2026Barriers to Universal Reasoning With Transformers (And How to Overcome Them)cited by 1
  8. 2025Learning Model Successorscited by 0
  9. 2025Position as Probability: Self-Supervised Transformers that Think Past Their Training for Length Extrapolationcited by 0
  10. 2026Loom: A Scalable Analytical Neural Computer Architecturecited by 0
  11. 2026Position: The Turing-Completeness of Autoregressive Transformers Relies Heavily on Context Managementcited by 0
  12. 2026Planning with Transformers: Chain of Computation and Structured Context Windowscited by 0
  13. 2026Universal Transformers for Circuit Computations: Perfect Length Generalization in Tiny Transformerscited by 0

Similar, not cited

Close in wording, no citation either way

  1. 2024On Provable Length and Compositional Generalization
  2. 2026Position Encoding with Random Float Sampling Enhances Length Generalization of Transformers
  3. 2024Explicitly Encoding Structural Symmetry is Key to Length Generalization in Arithmetic Tasks
  4. 2024Language Models Need Inductive Biases to Count Inductively
  5. 2026Where Induction Runs Out: Description-Length Difficulty and the Memorisation Gap in Integer-Sequence Benchmarks
  6. 2024Principled Understanding of Generalization for Generative Transformer Models in Arithmetic Reasoning Tasks
  7. 2026The Expressive Power of Low Precision Softmax Transformers with (Summarized) Chain-of-Thought
  8. 2026Algorithmic Scratchpads and Curriculum Staging for Arithmetic Reasoning in Tiny Transformers