atlas

Research map / Architectures and efficiency / Attention and transformers

Provable In-Context Vector Arithmetic via Retrieving Task Concepts

ICML 2025 · Architectures and efficiency › Attention and transformers · approach: Training dynamics of in-context learning

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 an optimization theory showing that a nonlinear residual transformer trained by gradient descent on QA data learns task-vector arithmetic for single-token factual-recall ICL, while ICL-style training fails to retrieve clean task vectors.

Problem

How a nonlinear residual transformer trained with gradient descent and cross-entropy on QA data can perform factual-recall in-context learning via task-vector arithmetic (akin to Word2Vec), and why word-label ICL training fails to do so.

Approach

Models hierarchical concepts (orthogonal high-level task vectors plus low-level label features) and a one-layer softmax attention + MLP with residual and layer normalization; proves that QA-style training makes the value/key-query projections retrieve the task vector, yielding vanishing 0-1 test loss, whereas word-label ICL training memorizes low-level features and keeps constant test error.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Train on QA sentences instead of Word-Label ICL promptsNonlinear residual transformer · Word-Label ICL test promptstest error: 0.2 -> zeroHelped
Train on QA sentences instead of QA-ICL promptsNonlinear residual transformer · QA-ICL test promptstest error: 0.2 -> zeroHelped
Train on Word-Label ICL prompts rather than QA sentencesNonlinear residual transformer · Word-Label ICL test promptstest error: zero -> 0.2Hurt
Train on QA-ICL prompts rather than QA sentencesNonlinear residual transformer · QA-ICL test promptstest error: zero -> 0.2Hurt

Surprising findings

Limitations

Experimental setup

Datasets: synthetic hierarchical concept word-label ICL data synthetic QA sentence data

Benchmarks: synthetic ICL test distributions synthetic QA-ICL test distributions

Metrics: 0-1 test loss cosine similarity of hidden vector with task vector training/test loss curves

Baselines: Word-label ICL-trained transformer Word2Vec

Builds on: Merullo et al. 2024 (vector arithmetic in LLMs) Hierarchical linear concept geometry (Park et al.) Trained transformer ICL theory (Li et al.)

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