atlas

Research map / Architectures and efficiency / Attention and transformers

In-Context Learning as Conditioned Associative Memory Retrieval

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.

Interprets in-context learning in one-layer attention as conditional memory retrieval in a modern Hopfield model, showing prompts reshape key/value matrices, linking this to Bayesian model averaging ICL theory and recovering an epsilon-stability generalization bound, with GPT-2 and GPT-J experiments.

Problem

Understanding the mechanism by which in-context examples modulate a transformer's predictions without parameter updates, and connecting it to existing Bayesian and stability-based theories of ICL.

Approach

Treats in-context examples as queries to a modern Hopfield model so that the prompt induces an effective linear reshaping of the pre-trained key and value matrices (via ghost examples and pseudoinverses), and embeds this into the Bayesian model averaging view of ICL.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Use prompts drawn from a more shifted query distributionGPT-2 ICL · Linear regression, 30 in-context examplesR-squared: 0.9998 -> 0.6613Hurt
Reduce prompt response accuracy from 100% to 80%GPT-2 ICL · Linear regression, 30 in-context examplesR-squared: 0.9998 -> 0.8607Hurt
Use prompts with lower similarity to the test queryGPT-2 ICL · Linear regression, 15 in-context examplesR-squared: 0.9563 -> 0.7704Hurt

Surprising findings

Limitations

Experimental setup

Datasets: synthetic Gaussian mixture linear regression data TweetEval hate speech detection

Benchmarks: synthetic linear regression decision tree 2-layer neural network TweetEval hate speech detection

Metrics: R-squared mean squared error

Baselines: Least Squares Decision Tree 2-Layer NN

Builds on: Zhang et al. 2025 Bayesian model averaging ICL Ramsauer et al. 2020 modern Hopfield networks Li et al. 2023 ICL algorithm learning stability Garg et al. 2022 ICL of function classes

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