atlas

Research map / Architectures and efficiency / Attention and transformers

When can transformers reason with abstract symbols?

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

Proves that transformers trained by gradient descent learn abstract relational templates and generalize to unseen symbols (regression), while MLPs fail, and proposes adding one trainable scalar per attention head that improves data efficiency.

Problem

Whether and when transformers can perform relational reasoning with abstract symbols, generalizing out-of-distribution to symbols never seen during training, and how to improve their data efficiency for this.

Approach

Formalizes relational reasoning as template tasks; shows via a random-features kernel analysis that one-layer transformers generalize to unseen symbols given enough data while MLPs cannot; proposes adding a trainable identity term (a·I to W_K W_Q^T, and b·I to W_V W_O^T) per head, adding only two parameters per head, to fix copying failures and improve data efficiency.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Add a trainable identity scaling to each attention head's key-query matrixTransformer · Template tasksdata efficiency: by an order of magnitudeHelped
Add trainable identity scalings to both key-query and value-output matricesTransformer · Length-k majority tasktest loss: by at least an order of magnitudeHelped
Add the proposed transformer modificationsGPT-2 · WikitextperplexityHelped
Use pretrained rather than random initializationGPT-2 · αβα vs. αββ template tasktest lossHelped
Increase the number of attention heads (ablation)Transformer · αβα vs. αββ template tasktest lossHelped
Increase transformer depth (ablation)Transformer · αβα vs. αββ template task, n = 512generalizationNo clear effect
Increase transformer depth (ablation)Transformer · αβα vs. αββ template task, n = 1024generalizationHelped
Increase embedding dimension (ablation)Transformer · αβα vs. αββ template task, n = 1024generalizationHurt
Reduce batch size (ablation)Transformer · αβα vs. αββ template taskgeneralizationHelped
Train only the final unembedding layer instead of all parameters (ablation)Transformer · αβα vs. αββ template taskdata efficiencyHurt
Increase attention-weight initialization magnitude (ablation)Transformer · αβα vs. αββ template taskgeneralizationHelped
Increase random-template length (ablation)Transformer · Random template tasktest lossHurt

Surprising findings

Limitations

Experimental setup

Datasets: Wikitext synthetic template task data

Benchmarks: Wikitext perplexity synthetic template tasks (alpha beta alpha vs alpha beta beta, majority task)

Metrics: test loss on unseen symbols perplexity

Baselines: MLP vanilla transformer GPT-2 random initialization MLP with XX^T augmentation

Builds on: neural tangent kernel GPT-2 kernel ridge regression

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