atlas

Research map / Architectures and efficiency / Attention and transformers

How Do Nonlinear Transformers Learn and Generalize in In-Context Learning?

ICML 2024 · Architectures and efficiency › Attention and transformers · approach: Training dynamics of in-context learning · 1 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.

Provides the first theoretical analysis of training dynamics of a one-layer single-head Transformer with softmax attention and ReLU MLP for in-context learning on binary classification tasks, with in-domain and out-of-domain generalization and magnitude-based pruning guarantees.

Problem

How a Transformer with nonlinear self-attention and nonlinear MLP can be trained to perform in-context learning and generalize to unseen tasks and out-of-domain data, and how magnitude pruning affects ICL.

Approach

Analyzes SGD training of a one-layer softmax-attention + ReLU-MLP Transformer on structured binary classification prompts; shows attention concentrates on contexts sharing the query's relevant pattern, the MLP encodes label embeddings, and ICL generalizes to unseen and linearly-combined out-of-domain patterns, with magnitude pruning of small MLP neurons being harmless.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Increase the fraction α of training contexts containing decisive patternsOne-layer Transformer training · In-domain generalization and trainingrequired training samples: proportional to α^{-2/3}Helped
Increase the fraction α of training contexts containing decisive patternsOne-layer Transformer training · In-domain generalization and trainingrequired iterations: proportional to α^{-2/3}Helped
Increase the fraction α' of testing contexts sharing the query's relevant patternOne-layer Transformer · In- and out-of-domain generalizationrequired testing context length: linear in α'^{-1}Helped
Increase α' for the pruned modelMagnitude-pruned one-layer Transformer · Out-of-domain generalizationgeneralization errorHelped
Prune small-magnitude neurons rather than large-magnitude neuronsOne-layer Transformer · In- and out-of-domain generalizationgeneralization error: O(ε+M_1^{-1/2}); Ω( R+ (α' M_1)^{-1})Mixed
Prune small-magnitude neurons at a rate below around 15%One-layer Transformer · Out-of-domain generalizationgeneralization error: around 15%No clear effect
Increase the pruning rate when removing large-weight neuronsOne-layer Transformer · Out-of-domain generalizationgeneralization errorHurt
Set the OOD relevant-pattern coefficient sum S_1 to at least 1One-layer Transformer · Out-of-domain classificationclassification error: <0.01 when S_1≥1Helped
Reduce the fraction α' of testing contexts sharing the query's relevant patternOne-layer Transformer · In- and out-of-domain generalizationrequired testing context lengthHurt
Use ICL instead of the compared classification algorithmsICL · Classification with α'=0.6sample efficiencyHelped
Use ICL instead of the compared classification algorithmsICL · Classification with α'=0.8generalization performanceNo clear effect
Train on fewer than M_1 tasksOne-layer Transformer · In-domain unseen-task generalizationgeneralization error: M_1Hurt

Surprising findings

Limitations

Experimental setup

Datasets: synthetic binary classification prompts from structured in-domain and out-of-domain patterns

Benchmarks: synthetic in-domain and out-of-domain binary classification tasks

Metrics: in-context classification error generalization error

Baselines: linear-attention ICL theory GPT-2 (3-layer, 2-head) experiments

Builds on: Garg et al. ICL framework feature learning theory for two-layer ReLU networks max-margin / attention training dynamics analyses

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