正确示例也可能降低模型表现,关键在它们如何影响上下文推理。
When Correct Demonstrations Hurt: Rethinking the Role of Exemplars in In-Context Learning

- 通过任务保持扰动分析示例对上下文推理的影响
- 小模型、难任务下扰动后准确率显著下降
- 适合关注ICL鲁棒性与提示设计的研究者
上下文学习(ICL)通常假设正确示例能提升性能,但我们发现:正确不等于有用,某些正确示例反而会降低准确率。为研究这一现象,我们引入任务保持扰动——仅改变示例输入,而保持其为该任务的正确实例。具体分为标签更新型扰动(语义变化并重算目标)和目标保持型扰动(原目标仍有效)。结果表明,此类扰动会引发上下文证据偏移:改变了模型用于推理的有效证据混合,导致示例正确性与其实际效用脱钩。在情感分类、逻辑推理和数学应用题任务中,任务保持扰动均显著降低ICL性能,尤其在小模型、高难度任务和高扰动比例下更明显。研究强调,稳健的ICL需同时评估示例是否正确及其对上下文推理的影响。代码已开源:https://github.com/Chenghao-Qiu/Task-Preserving-ICL。
原文摘要 · Abstract (English)
In-context learning (ICL) is often motivated by the intuition that demonstrations help because they provide correct input-output examples. However, we reveal a counterintuitive phenomenon: correctness does not guarantee exemplar utility, and some correct demonstrations can even reduce ICL accuracy. To study this correctness-utility gap, we introduce task-preserving perturbations, where only the exemplar input is changed, while the example remains a correct instance of the same task. Concretely, each perturbed exemplar is assigned the target induced by the task mapping. This framework covers both label-updating perturbations, where task-relevant semantics change and targets are recomputed, and stricter target-preserving perturbations, where the original target remains valid. We formalize the resulting failure mode as contextual evidence shift: task-preserving perturbations can change the effective mixture of evidence used by the model for contextual inference, thereby separating exemplar correctness from exemplar utility. Across sentiment classification, logical reasoning, and math word problems, we find that task-preserving perturbed demonstrations can substantially degrade ICL performance, especially for smaller models, harder tasks, and higher perturbation ratios. Our results show that robust ICL requires evaluating not only whether demonstrations are correct, but also how they influence contextual inference. Code is available at https://github.com/Chenghao-Qiu/Task-Preserving-ICL.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。