Understanding the Dynamics of Demonstration Conflict in In-Context Learning

Difan Jiao, Di Wang, Lijie Hu
3/3/2026
cs.LGcs.AI

No official code found. Best implementation: difanj0713/Understanding-ICL-Demo-Conflict (5 stars, Apache-2.0, last commit 2026-01-29).

Abstract

In-context learning enables large language models to perform novel tasks through few-shot demonstrations. However, demonstrations per se can naturally contain noise and conflicting examples, making this capability vulnerable. To understand how models process such conflicts, we study demonstration-dependent tasks requiring models to infer underlying patterns, a process we characterize as rule inference. We find that models suffer substantial performance degradation from a single demonstration with corrupted rule. This systematic misleading behavior motivates our investigation of how models process conflicting evidence internally. Using linear probes and logit lens analysis, we discover that under corruption models encode both correct and incorrect rules in intermediate layers but develop prediction confidence only in late layers, revealing a two-phase computational structure. We then identify attention heads for each phase underlying the reasoning failures: Vulnerability Heads in early-to-middle layers exhibit positional attention bias with high sensitivity to corruption, while Susceptible Heads in late layers significantly reduce support for correct predictions when exposed to the corrupted evidence. Targeted ablation validates our findings, with masking a small number of identified heads improving performance by over 10%.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

Understanding the Dynamics of Demonstration Conflict in In-Context Learning

51Shell, PythonJan 29, 20268 months agoApache-2.0

Similar Papers

Cite this paper

@article{jiao2026understanding,
  title  = {Understanding the Dynamics of Demonstration Conflict in In-Context Learning},
  author = {Difan Jiao and Di Wang and Lijie Hu},
  year   = {2026},
  eprint = {2603.04464},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2603.04464v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2603.04464.svg)](https://codeofpaper.com/paper/2603.04464)

Discussion