On the Noise Robustness of In-Context Learning for Text Generation

Hongfu Gao, Feipeng Zhang, Wenyu Jiang, Jun Shu, Feng Zheng, Hongxin Wei

TL;DR

This paper reveals that unlike text classification, In-Context Learning (ICL) for text generation is highly sensitive to noisy demonstrations, significantly degrading performance. To combat this, they introduce Local Perplexity Ranking (LPR), a novel method that identifies and replaces noisy examples with cleaner, semantically similar ones, leading to substantial performance improvements.

What Problem Does This Paper Address?

Large Language Models (LLMs) have shown remarkable capabilities through In-Context Learning (ICL), where they learn to perform tasks by observing a few examples (demonstrations) provided in the prompt. The effectiveness of ICL heavily relies on the quality of these demonstrations. While prior research suggested ICL is robust to noisy labels in text classification tasks, this paper highlights a critical issue: for text generation tasks, noisy demonstrations (i.e., incorrect input-output pairs) severely degrade LLM performance. This is problematic because real-world datasets, often created through crowdsourcing or LLM generation, are prone to such noise. The paper aims to address this gap by developing a method to make ICL more robust to these noisy demonstrations in text generation.

Methods

The core of the paper's contribution is the Local Perplexity Ranking (LPR) method. The authors first analyze how noisy labels affect LLM predictions, observing that incorrect input-output pairs tend to result in higher perplexity. They decompose perplexity into "inherent perplexity" (task complexity) and "matching perplexity" (deviation due to noise).

LPR leverages two key assumptions:

  1. Clean annotations are the majority: Most examples in a dataset are correctly labeled.
  2. Semantic similarity implies similar inherent perplexity: Examples that are semantically close share similar task complexity.

Based on these assumptions, LPR works as follows:

  1. Candidate Selection: A set of candidate demonstrations is initially selected using existing methods (e.g., Random, TopK, DPP).
  2. Local Neighbor Identification: For each candidate, its "local neighbors" (semantically similar examples) are identified using k-Nearest Neighbors (k-NN) based on embedding similarity.
  3. Perplexity Ranking: The perplexity of the candidate and its neighbors is calculated. The idea is that if a candidate's perplexity is significantly higher than its neighbors (which are assumed to have similar inherent perplexity), it's likely due to a noisy label (high matching perplexity).
  4. Replacement: If a candidate is deemed noisy (based on its perplexity relative to its neighbors and a threshold), it's replaced by its nearest neighbor that is more likely to be clean.

This approach aims to decouple matching perplexity and ensure the selected demonstrations are more accurate and relevant.

Datasets

The authors evaluate their method on six text generation datasets:

  • Open-Domain Question Answering: NQ [22], WebQ [5]
  • Reading Comprehension: SQUAD [46], SCIQ [56]
  • Code Generation: GeoQuery [39], NL2Bash [27]

They also validate the method on text classification tasks (SST2 [48] and AGNews [67]) and long-form QA tasks (MT-bench [70], Arena-Hard [24]).

Key Insights and Ideas

  • ICL is NOT robust to noise in generation: Contrary to findings in text classification, noisy demonstrations severely degrade ICL performance in text generation. This is a crucial distinction.
  • Noise amplifies with more demonstrations: Counter-intuitively, increasing the number of demonstrations (K) can worsen performance under noisy conditions, unlike in clean settings.
  • Perplexity as a noise indicator: Noisy input-output pairs lead to higher perplexity in LLMs, suggesting a deviation from expected patterns.
  • Local context is key: Focusing on the perplexity of a candidate relative to its semantically similar neighbors is more effective than global perplexity ranking for identifying noise. This leverages the assumption that similar examples should have similar inherent perplexity.
  • LPR is a general enhancement: LPR can be easily integrated with existing demonstration selection methods (Random, TopK, DPP) to universally improve their noise robustness.

Key Results

  • LPR significantly improves the Exact Match (EM) score, with improvements of up to 18.75 on benchmarks like SCIQ with 60% irrelevant label noise when used with the TopK method.
  • On NQ with 60% irrelevant noise, LPR boosted the EM score of the naive random selection method from 28.21 to 42.00, a 13.79 improvement.
  • The method demonstrates robustness across different LLMs (Llama2-7B, Llama2-13B, Mistral-7B, OPT-6.7B) and various noise types (irrelevant and relevant).
  • LPR is relatively insensitive to hyperparameters like the threshold ($\gamma$) and the number of neighbors ($k$), making it easy to use.
  • The method also shows effectiveness in text classification tasks.

Limitations and Future Work

  • Suboptimal at extremely high noise rates: LPR's assumption that clean annotations are the majority might not hold when noise levels are very high (e.g., >60-70%), potentially leading to incorrect replacements.
  • Lack of theoretical analysis: The paper does not provide a theoretical analysis of why noisy annotations affect ICL in generation tasks, which is suggested as an interesting future research direction.
  • Model dependency: The effectiveness of LPR decreases with smaller LLM parameter sizes, suggesting that the LLM's ability to accurately measure semantic similarity and perplexity is crucial.
  • Future work: The authors suggest exploring theoretical underpinnings and investigating scenarios with extremely high noise ratios.

Summary updated

BibTeX
@inproceedings{gao2024noise,
  author = {Hongfu Gao and Feipeng Zhang and Wenyu Jiang and Jun Shu and Feng Zheng and Hongxin Wei},
  title = {{On the Noise Robustness of In-Context Learning for Text Generation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=00uVk06eVK},
}
Figure