atlas

Research map / Architectures and efficiency / Attention and transformers

Universal Length Generalization with Turing Programs

ICML 2025 · Architectures and efficiency › Attention and transformers · approach: Attention head mechanisms · 0 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Proposes Turing Programs, a universal scratchpad (CoT) strategy decomposing algorithmic tasks into modified-copy steps mimicking Turing Machine execution, combined with Hard-ALiBi, to achieve length generalization on addition, multiplication, SGD, and random Turing machines.

Problem

Transformers struggle to length-generalize (train on short sequences, test on long ones) on algorithmic tasks; prior fixes are task-specific data formats for addition.

Approach

Decompose any algorithmic task into a sequence of modified-copy steps mimicking a Turing Machine tape, and pair this scratchpad with Hard-ALiBi positional encoding so the model can exploit its copying ability; also show a RASP program that implements Turing Program execution.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Use Turing Program scratchpads with Hard-ALiBiTransformer · Addition (length 100; trained on lengths up to 50)accuracyHelped
Use Turing Program scratchpads with Hard-ALiBiTransformer · Multiplication (n × 1; length 100)accuracyHelped
Use Turing Program scratchpads with Hard-ALiBiTransformer · Multiplication (n × 3; length 100)accuracyHelped
Use Turing Program scratchpads with Hard-ALiBiTransformer · SGD on linear regression (80 examples; trained on n ≤ 50)accuracyHelped
Replace the Turing Program scratchpad with direct final-answer prediction (ablation)Transformer on SGD · SGD on linear regressionaccuracyHurt

Surprising findings

Limitations

Experimental setup

Datasets: synthetic addition examples synthetic multiplication examples synthetic linear-regression SGD examples random Turing machine simulations

Benchmarks: multi-digit addition (50->100 digits) multiplication by 1-digit and 3-digit operands (50->100) in-context SGD on linear regression (50->80 examples) random Turing machine 1-step prediction

Metrics: exact-match accuracy accuracy within 2 quantization units for SGD

Baselines: vanilla scratchpad direct answer training Zhou et al. addition formats ALiBi NoPE

Builds on: Hard-ALiBi scratchpad RASP GPT-NeoX

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy