atlas

Research map / Architectures and efficiency / Attention and transformers

How Do Transformers Learn Variable Binding in Symbolic Programs?

ICML 2025 · Architectures and efficiency › Attention and transformers · approach: Transformer expressivity and learnability · 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.

Trains a small 37.8M-parameter GPT-2-style Transformer from scratch on synthetic Python-like variable-assignment programs and uses causal interventions and training checkpoints to show how it learns variable dereferencing.

Problem

How neural networks without built-in binding operations acquire variable binding (dereferencing queried variables through assignment chains) during training, and what mechanisms implement it.

Approach

Track the developmental trajectory of a from-scratch Transformer on a variable dereferencing task with distractor chains, and use counterfactual interchange interventions on the residual stream and attention heads to show the model uses the residual stream as addressable memory while layering a systematic mechanism on top of early line-position heuristics.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Train a Transformer from scratch on synthetic variable-assignment programsTransformer trained from scratch · Variable dereferencing test setaccuracyHelped
Progress from early-line heuristics to systematic variable dereferencingTransformer trained from scratch · Variable dereferencing test setaccuracy: 12% to 56%; 56% to 99%Helped
Swap the numerical-constant residual stream subspace with its counterfactualTransformer trained from scratch · Variable dereferencing test programspatching success rate: 92.17%Helped
Swap the variable-name residual stream subspace with its counterfactualTransformer trained from scratch · Variable dereferencing test programspatching success rate: 87.08%Helped
Use the line-1 heuristic on programs with answers on line 1Transformer trained from scratch · Programs with answer on line 1accuracy: over 90%Helped
Use the line-2 heuristic on programs with answers on line 2Transformer trained from scratch · Programs with answer on line 2accuracy: approximately 65%Helped
Apply the line-1 heuristic to programs with lengths substantially different from trainingTransformer trained from scratch · Programs with 2–25 lines, answer on line 1accuracyHurt
Use the systematic variable-binding mechanism on programs with more than four hopsTransformer trained from scratch · Programs with up to 13 hops, answer not on lines 1 or 2accuracyHelped
Rely on the line-1 heuristic as hop count increasesTransformer trained from scratch · Programs with up to 13 hops, answer on line 1accuracyHurt

Surprising findings

Limitations

Experimental setup

Datasets: synthetic variable-assignment programs (500,000 generated)

Benchmarks: synthetic program test set (49,000 programs)

Metrics: accuracy patching success rate logit difference linear probe accuracy

Baselines: line-1 heuristic line-2 heuristic

Builds on: GPT-2 interchange intervention causal tracing UMAP

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