atlas

Research map / Architectures and efficiency / Attention and transformers

What Algorithms can Transformers Learn? A Study in Length Generalization

ICLR 2024 · Architectures and efficiency › Attention and transformers · approach: Transformer expressivity and learnability · 8 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 the RASP-Generalization Conjecture, that Transformers trained to completion length-generalize on algorithmic tasks when the task has a short RASP-L program, and uses it to design scratchpads and data sampling that enable length generalization on parity and addition.

Problem

Understanding when and why decoder-only Transformers trained from scratch length-generalize on algorithmic tasks such as arithmetic and parity, which typically fail to generalize.

Approach

Predict length generalization from the minimum length of a RASP-L program (a learnable, uniform, restricted subset of RASP) that solves the task on all input lengths; use this to design scratchpads (index hints, running-parity scratchpad) and balanced carry sampling that make tasks easier to generalize on.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Train count examples across a range of lengths instead of using sequences all of the same length (ablation)Count · Length generalizationexact matchHelped
Add index hints to the prompt and answer (ablation)Addition · Easy-carry additionlength generalizationHelped
Format the answer in reverse order (ablation)Addition with index hints · Hard-carry addition with carry chains longer than traininglength generalizationHelped
Use balanced carry sampling instead of independently sampled summands (ablation)Forward addition with index hints · Hard-carry additionlength generalizationHelped
Add index hints and a running-parity scratchpad (ablation)Parity · Parity, length 50exact matchHelped
Use a sum-mod-10 scratchpad instead of the running-parity scratchpad (ablation)Parity · Length generalizationexact matchHurt
Add a frequency-count scratchpad that orders counts by frequency (ablation)Mode · Length generalizationexact matchHurt
Add a frequency-count scratchpad with tokens in order of appearance (ablation)Mode · Length generalizationexact matchHurt
Use rotary positional embeddings instead of learned positional embeddings (ablation)Count, mode, addition, and parity · Length generalizationlength generalization performanceHurt

Surprising findings

Limitations

Experimental setup

Datasets: synthetic algorithmic tasks (count, mode, copy, sort, addition, parity, boolean-AND)

Benchmarks: count mode copy sort addition parity boolean-AND

Metrics: exact match accuracy

Baselines: min-degree-interpolator no scratchpad forward addition naive addition

Builds on: RASP min-degree-interpolator induction heads scratchpads

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