# In-context Learning in Presence of Spurious Correlations

*Hrayr Harutyunyan, Rafayel Darbinyan, Samvel Karapetyan, Hrant Khachatrian*

[NeurIPS page](https://neurips.cc/virtual/2026/poster/156780) · [Open on the map](../papers.html#p156780)

Category: [Interpretability & Model Adaptation](../pcat/15.md) › [Transformer In-Context Learning](../pgroup/655.md) · Type: new method · Keywords: in-context learning, spurious correlations, classification, meta-training, synthetic data

## Summary
The paper proposes a novel technique to train in-context learners for classification tasks with spurious features, achieving performance comparable to ERM and GroupDRO while enabling generalization to unseen tasks when trained on diverse synthetic instances.

## Explained to a 5-year-old
Big computer programs called language models can learn new tricks by looking at a few examples. Sometimes they get confused by extra clues that aren't important. When you only show the program one kind of task, it doesn't use the examples well. They created a new way to teach the program to ignore those clues and use the examples correctly. This helps the program do better on tasks like sorting words into categories.

## Explained to a 5-year-old, longer
Language models are computer programs that can understand and generate text. They have a special ability called in-context learning, which means they can solve new problems after seeing just a few examples. Sometimes these examples include extra information that doesn't really matter, called spurious features. If the program pays attention to those irrelevant clues, it can make mistakes. The researchers looked at how well these models work when such misleading clues are present. They discovered that when the program is only trained on one type of problem, it tends to rely on its own internal weights instead of the examples. This means it doesn't really learn to use the context. To fix this, the researchers designed a new training method that uses many different made-up examples. This helps the program learn to ignore the irrelevant clues and actually use the examples. As a result, the program performs as well as or better than other popular methods on the target task. However, the new method does not work well on tasks it hasn't seen before. The study shows that careful training can improve how models use context, but more work is needed for broad adaptability.

## For a technical reader
The paper examines why large language models, when used for classification, can be misled by irrelevant patterns in the training examples. It shows that training these models in-context on a single task often causes them to rely on fixed internal weights rather than the provided examples. The authors propose a training recipe that uses a diverse set of synthetic in-context examples to teach the model to ignore spurious cues and actually leverage the context. On the target task, this approach matches or exceeds the performance of standard methods such as ERM and GroupDRO. The trade-off is that the model does not generalize well to unseen tasks, highlighting a limitation of the proposed solution.

## Problem
In-context learning for classification tasks is vulnerable to spurious features, and training on a single task leads to in-weight learning rather than leveraging context for predictions.

## Method
The approach trains an in-context learner on a diverse dataset of synthetic in-context learning instances, addressing spurious correlations and enabling generalization across tasks.

## Contributions
The paper identifies the susceptibility of conventional in-context learning to spurious features and the issue of in-weight learning when meta-training on a single task. It proposes a technique to train in-context learners that achieve competitive performance on the target task and can generalize to unseen tasks when trained on diverse synthetic instances.

## Limitations and assumptions
The approach does not generalize well to other tasks, and its performance depends on the diversity of the synthetic training data.

## Research questions this paper is counted under

- [How can we design learning systems that avoid over-reliance on narrow patterns and instead develop robust, flexible representations?](../q/248.md)

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](../feedback/?on=p/156780)
