Papers
Topics
Authors
Recent
Search
2000 character limit reached

When Context Sticks: Studying Interference in In-Context Learning

Published 25 Apr 2026 in cs.LG | (2604.23371v1)

Abstract: This paper investigates context stickiness in in-context learning (ICL), a phenomenon where earlier examples in a prompt interfere with a transformer's ability to adapt to later tasks. Using synthetic regression tasks over linear and quadratic functions, we examine how models trained under sequential, mixed, and random curricula handle abrupt task switches during inference. By sweeping over structured combinations of misleading linear examples followed by recovery quadratic examples, we quantify how prior context biases prediction error and how quickly models realign. Our results show strong evidence of persistent interference: more preceding linear examples reliably degrade quadratic predictions, while additional quadratic examples reduce error but with diminishing returns. We further find that training curricula significantly modulate resilience, with sequential training on the target function class yielding the fastest recovery, and surprisingly, random training producing the least robust behavior.

Summary

  • The paper demonstrates that misleading in-context examples cause persistent prediction errors that are not fully recovered by corrective quadratic examples.
  • Empirical findings reveal that a sequential training curriculum significantly enhances transformer recovery from interference compared to random training.
  • Practical implications call for refined curriculum design and architectural improvements to better manage task switches in in-context learning.

Analysis of Context Stickiness and Interference in In-Context Learning

Background and Motivation

The paper "When Context Sticks: Studying Interference in In-Context Learning" (2604.23371) presents a systematic investigation into context stickiness, a behavioral pattern in transformer-based models where prior in-context examples interfere with adaptation to subsequent tasks. The phenomenon has profound implications for In-Context Learning (ICL) benchmarks and the generalizability of transformer architecture capabilities. Instead of relying on real-world datasets, the study leverages synthetic regression tasks on linear and quadratic functions, intentionally constructing controlled settings to expose the nuances of context interference.

Experimental Design

The authors employ synthetic regression tasks, using structured prompts composed of two distinct function classes: misleading linear examples followed by recovery quadratic examples. In this setup, transformer models are tested for their ability to shift responses in the face of abrupt changes in function class within the context window. The curriculum used for training—sequential, mixed, or random—serves as an independent variable to probe curriculum effects on resilience to interference. Structured sweeps are performed to vary the number and placement of linear and quadratic examples within the prompt, enabling controlled quantification of prediction error and recovery dynamics.

Key Findings

Persistent Interference and Recovery Dynamics

Empirical results demonstrate strong evidence of context stickiness. When more linear examples precede the quadratic target, transformers show consistently elevated prediction error, indicating persistent interference. Recovery is possible by adding quadratic examples, yet the error reduction exhibits diminishing returns: the negative impact of prior linear context is not fully erased even with substantial quadratic recovery examples.

Influence of Training Curriculum

A major finding is that training curriculum profoundly affects recovery and resilience:

  • Sequential Training: Models trained in a sequential manner on the target function class exhibit best adaptation, showing rapid recovery from context stickiness when switching from linear to quadratic examples.
  • Random Training: Contrary to common expectations, models subjected to random curricula perform worse in robust adaptation. Random curricula yield less resistance to context interference, exposing limitations in generalist training paradigms for ICL resilience.

These results suggest that the order and structure of training experiences substantially modulate transformer performance in prompt-based task switches.

Numerical Results and Contradictory Claims

The paper provides strong quantitative evidence that increasing misleading linear context monotonically increases prediction error on subsequent quadratic tasks, and that recovery curves—error reduction as quadratic examples accumulate—are sublinear. The claim that random curricula yield the least robust adaptation directly contradicts the assumption that curriculum randomness enhances generalization in transformer-based models.

Theoretical and Practical Implications

The study advances understanding of context sensitivity and task interference in transformer models, suggesting that both architectural design and training curriculum deserve close scrutiny for applications where prompt-compositionality and task switching are critical. Practically, model developers should be cautious about curriculum design; sequential exposure to target tasks can improve adaptation, while excessive reliance on randomization may undermine robustness. These findings motivate future research into architectures or training regimes that minimize context stickiness and interference, which are essential for reliable deployment of transformer models in prompt-driven user scenarios.

From a theoretical perspective, the results reinforce the notion that transformers do not inherently distinguish context boundaries—a limitation of the architecture. Addressing this through explicit segmentation mechanisms or memory management remains an open challenge.

Speculation on Future Directions

The findings suggest avenues for curriculum optimization and architectural enhancements. Further work could explore advanced curricula (e.g., adaptive or hierarchical) or augment transformers with mechanisms for context separation, such as gating or explicit boundary tokens. Deepening analysis on real-world tasks and more complex function classes may yield additional insights into persistent interference and mitigation strategies.

Conclusion

This paper provides rigorous evidence for context stickiness in in-context learning, demonstrating that prior prompt examples can interfere with transformer adaptation to abrupt task switches. Recovery from interference is quantitatively limited and strongly modulated by training curriculum. These findings prompt practitioners and theorists to consider curriculum structure and prompt design as central to robust ICL, with future work aimed at minimizing persistent context bias in transformer-based AI systems.

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.

Collections

Sign up for free to add this paper to one or more collections.

Tweets

Sign up for free to view the 1 tweet with 0 likes about this paper.