atlas

Research map / Architectures and efficiency / Attention and transformers

Transformers Struggle to Learn to Search

ICLR 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 small GPT-2-style transformers on DAG graph-connectivity search with a carefully balanced lookahead distribution, reverse-engineers the learned path-merging algorithm, and shows learning becomes harder with larger graphs and does not improve with model scale or chain-of-thought-style intermediate steps.

Problem

Whether transformers can learn to perform search (graph connectivity / next-step path finding in DAGs) robustly, and whether failures stem from data, parameter count, or architectural limits.

Approach

Uses a balanced DAG generator that makes lookahead uniformly distributed and removes shortcut heuristics, enabling small transformers to learn search; introduces a computation-graph reconstruction method via attention perturbation and activation patching to reveal a parallel exponential path-merging algorithm.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Train on the balanced distribution instead of the naïve distributionTransformer graph search · Naïve, star, and balanced graph distributionsaccuracyHelped
Train on the naïve distributionTransformer graph search · Graphs with larger lookaheadsaccuracyHurt
Train on the star distribution rather than the balanced distributionTransformer graph search · Balanced and naïve graph distributionsaccuracyMixed
Train on the balanced distribution with lookahead ≤12Transformer graph search · Lookaheads 13, 14, and largeraccuracyMixed
Increase maximum input graph size8-layer transformer, hidden size 16 · Balanced training; naïve-distribution testtest lossHurt
Increase maximum input graph size8-layer transformer, hidden size 16 · Balanced trainingconvergence rateHurt
Increase model dimensionTransformer graph search on 31-vertex graphs · Balanced training; naïve-distribution testtraining examples to global minimumNo clear effect
Use learned token embeddings and rotary positional embeddings (ablation)Decoder-only transformer graph search · Larger input graphstest lossNo clear effect
Allow depth-first search intermediate stepsTransformer DFS · Larger graphstest lossHurt
Increase model scaleTransformer DFS · Fixed maximum graph size of 35 verticestraining FLOPs to learn the taskHurt
Increase model scaleTransformer selection-inference · Fixed maximum graph size of 45 verticestest lossNo clear effect
Add random padding between vertices in the DFS trace (ablation)Transformer DFS · Larger backtrack distancesaccuracyHelped

Surprising findings

Limitations

Experimental setup

Datasets: synthetic DAG search examples (naive, star, balanced distributions) synthetic DFS traces synthetic selection-inference examples natural-language implicational propositional logic proof search (synthetic)

Benchmarks: held-out synthetic naive and balanced graph search test sets

Metrics: accuracy test cross-entropy loss fraction of seeds converging (training accuracy >= 0.995) proportion of explained examples for path-merging algorithm proportion of maximal path-merge operations

Baselines: naive Erdős–Rényi DAG distribution star distribution selection-inference prompting depth-first search

Builds on: GPT-2 Sophia activation patching RoPE selection-inference prompting

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