Theory on Attention Dynamics for Out-of-Distribution In-Context Learning
Junze Deng, Daouda Sow, Sen Lin, Yingbin Liang
NeurIPS page · Open on the map
Category: Interpretability & Model Adaptation › Transformer In-Context Learning · Type: theory · Keywords: out-of-distribution in-context learning, attention dynamics, transformer generalization, theoretical analysis, distribution shift
Areas: Continual Learning & Adaptation › Non-Stationarity Adaptation › Generalization and Memorization
Summary
We develop a theoretical analysis of out-of-distribution in-context learning by characterizing OOD error through the dynamics of α-type and β-type attention weights and study how finetuning with OOD data affects source domain performance.
Explained to a 5-year-old
Some computer programs can learn new tricks just by reading lots of examples. But when they see something completely new, they sometimes make mistakes. Scientists looked at how the program pays attention to the right and wrong parts of the examples. They found that the mistakes depend on how the new things compare to the old ones, and sometimes the program is as good as guessing. They also studied what happens if we teach the program a little more with the new things, and it can sometimes keep being good on the old tasks.
Explained to a 5-year-old, longer
A computer brain can learn to do new things just by looking at many examples. It does this without changing its own rules, which is called in-context learning. However, when the new examples are very different from what it has seen before, it often gets things wrong. Researchers wanted to understand why this happens and how to make it better. They studied how the computer decides which parts of the examples are important. They looked at two kinds of importance: one for the right parts and one for the wrong parts. By comparing these two kinds, they could calculate how likely the computer is to make a mistake on new data. They discovered that each mistake depends on how the new data interacts with all the old data. In some cases, the computer’s answers are no better than flipping a coin. To help, they tried teaching the computer a little bit with the new data. This extra teaching sometimes kept the computer good at the original tasks and sometimes made it worse. They tested their ideas on made-up data and real data, and the results matched what they predicted.
For a technical reader
The paper provides a theoretical analysis of how transformers degrade on out-of-distribution inputs during in-context learning. It models the error as a function of two attention weight dynamics-α-type (confidence in correct features) and β-type (confidence in incorrect features)-and shows that pairwise interactions between training and OOD features determine the error. Under certain conditions the model’s predictions collapse to random guessing, and fine-tuning with OOD data can either preserve or harm source-domain performance depending on the nature of the feature shift. The authors validate these insights with experiments on synthetic and real datasets, confirming the predicted behavior. This work offers designers a framework for diagnosing and improving ICL robustness without requiring extensive empirical trial-and-error.
Problem
Transformers exhibit strong in-context learning but their performance degrades on out-of-distribution inputs, and the theoretical understanding of this degradation is lacking.
Method
We analyze the interplay between α-type and β-type attention weight dynamics to characterize OOD error, and we study the impact of finetuning with OOD data on source domain performance, examining feature confidence and interference.
Contributions
We provide a theoretical characterization of OOD error in ICL via attention weight dynamics and analyze how finetuning on OOD data affects source domain performance.
Research questions this paper is counted under
This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. Suggest a correction