Dual Debiasing for Noisy In-Context Learning for Text Generation (2025)

Abstract: In-context learning (ICL) relies heavily on high-quality demonstrations drawn from large annotated corpora. Existing approaches detect noisy annotations by ranking local perplexities, presuming that noisy samples yield higher perplexities than their clean counterparts. However, this assumption breaks down when the noise ratio is high and many demonstrations are flawed.We re-examine the perplexity-based paradigm for text generation under noisy annotations, highlighting two sources of bias in perplexity: the annotation itself and the domain-specific knowledge inherent in large language models (LLMs). To overcome these biases, we introduce a dual-debiasing framework that uses synthesized neighbors to explicitly correct perplexity estimates, yielding a robust Sample Cleanliness Score . This metric uncovers absolute sample cleanliness regardless of the overall corpus noise level.Extensive experiments demonstrate our method’s superior noise-detection capabilities and show that its final ICL performance is comparable to that of a fully clean demonstration corpus. Moreover, our approach remains robust even when noise ratios are extremely high.

## preliminaries we consider icl in text generation tasks. given the training set d @xmath0, y i )} n @xmath1, where x i is the demonstration query text and y i is the tokenized corresponding annotation with length t @xmath2, icl aims to utilize a llm to generate sequence output for test queries in the test set d @xmath3. a typical icl process contains retrieval and inference steps. given a test query x @xmath4, the retriever retrieves k demonstration examples from d train , say, d @xmath5, y i )} @xmath6, where s is the index set of retrieved samples with |s| = k. then the prompt p will be constructed using the retrieved examples d ex and the given test query x test based on the prompt template t . by feeding the constructed prompt p into llm for inference, we can obtain generated results via: however, the training set in real-world settings can easily include noised annotations @xmath7, ỹi )} n @xmath8, due to unreliable data sources or limited annotation expertise. thus, the retrieved demonstration examples @xmath9, ỹi )} @xmath10, which thus leads to degraded performance in icl @xcite . though previous work by @xcite has identified the issue of noise in icl for text generation tasks and suggested potential solutions, it presupposes that clean samples predominate in the training set. this leads to the failure of the pro-posed method when the noise ratio is high. additionally, though the authors acknowledged the limitations of naive perplexity in distinguishing between noisy and clean demonstrations due to inherent perturbation, their method only mitigates this effect implicitly. it does not thoroughly examine the underlying mechanism of the query-annotation relationship for demonstration samples. this gap in understanding motivates our further investigation into icl generation tasks with noisy annotations to develop a more generalizable solution. furthermore, it requires a deeper comprehension of the influence of llm's parametric knowledge on its detection capability of noisy matching relations in query-annotation pairs. ## method in this section, we will first introduce our metric design motivation. then, we deliver the explicit dualdebiasing method to compute the sample cleanliness score for each demonstration sample from the given training set, including the intrinsic-debiasing step and the neighbor-based extrinsic-debiasing step. finally, we introduce the complete pipeline for noisy icl utilizing proposed sample cleanliness score. ## conclusion in this paper, we have presented a robust method for handling noisy demonstrations in in-context learning (icl). our approach addresses both intrinsic and extrinsic biases in llms' perception of noisy demonstrations, enabling more reliable detection of problematic examples and improving the overall inference process. through extensive experiments across four text generation datasets, we demonstrate our method's effectiveness under various retrieval strategies and noise conditions, particularly showing strong performance even with noise ratios as high as 0.8. notably, our approach achieves competitive performance without significant computational overhead, making it practical for real-world applications. we also show that our method maintains its effectiveness even when using smaller llms for metric computation, further enhancing its practical utility. the successful results across different settings validate not only the theoretical foundations of our dual debiasing framework but also its practical applicability. through this work, we advance both the robust deployment of llms and our understanding of how these models perceive and process noisy query-annotation pairs, providing a foundation for future research in robust icl methods.