Improving In-Context Learning with Prediction Feedback for Sentiment Analysis

Hongling Xu, Qianlong Wang, Yice Zhang, Min Yang, Xi Zeng, Bing Qin, Ruifeng Xu

Abstract

Standard In-Context Learning (ICL) often fails to capture the subtle nuances of human emotion, leading Large Language Models (LLMs) to misclassify "neutral" statements or confuse similar emotions like "joy" and "optimism." This paper introduces a framework that incorporates prediction feedback, showing the LLM its own prior mistakes and successes on example data to refine its reasoning. By including the model's previous errors and corrective feedback directly in the prompt, the authors achieved an average F1 score improvement of 5.95% across nine sentiment analysis datasets.

Introduction

While LLMs are impressive at sentiment analysis using few-shot ICL, they struggle with "subtle" sentiments. They can easily tell a positive review from a negative one, but they frequently trip up on neutral tones or fine-grained emotions. The core issue is that traditional ICL only provides the LLM with "gold standard" pairs (Input + Correct Label). This doesn't help the model understand why its internal logic might be flawed or where its decision boundaries are misaligned with human perception. The authors argue that LLMs, much like humans, need a feedback loop—seeing a plan fail and receiving a correction—to truly grasp nuanced categories.

Methods

The authors propose a three-step framework to "rectify sentiment misinterpretation":

  1. Prior Prediction Acquisition: Before the final inference, the LLM is asked to predict labels for a pool of candidate examples using standard ICL. These "prior predictions" reveal the model's initial, uncorrected understanding.
  2. Predictive Feedback Design: Candidate examples are split into two sub-pools: Correct ($P_c$) and Wrong ($P_w$). Natural language feedback is then attached to these examples. For instance, if the model was wrong, the feedback might be: "You are wrong! Make sure your prediction is accurate."
  3. Test Sample Inference: The final prompt is constructed using a mix of examples from both sub-pools. Instead of the standard <Input, Label> format, the prompt uses a quadruple: <Input, Prior Prediction, Correct Label, Feedback>. This forces the LLM to observe its own potential pitfalls before classifying the new test input.
Overview of the prediction feedback framework, distinguishing between correct and wrong examples to refine model reasoning.

Experimental Setup

The study evaluated the framework across nine datasets covering three distinct tasks: Sentiment Classification (e.g., SST-2, Finance), Aspect Sentiment Classification (e.g., Rest, Laptop), and Emotion Detection (e.g., TwEmo). To test versatility, they also included generalization tasks like stance and irony detection.

Key Insights and Results

Learning from Failure

The most significant finding is that showing an LLM its own mistakes is more effective than just showing it more correct examples. The model uses the "Wrong" examples as cautionary tales to adjust its decision boundaries. The authors found that the ratio of "wrong" to "correct" examples in the prompt matters; performance typically peaks when there is a balance between the two.

Performance Gains

The framework outperformed standard ICL baselines across nearly all datasets, with an average F1 increase of 5.95%. Notably, on the "Poem" dataset, the correct classification rate for "neutral" sentiments jumped by 32%. This suggests the feedback loop is particularly effective for categories where the model's prior bias is strong.

Baseline confusion matrices for the Rest and TwEmo datasets, illustrating the difficulty LLMs face with neutral and fine-grained emotional categories.

Model and Retrieval Agnosticism

The method proved effective across different architectures, including Llama-2-13B, GPT-3.5 Turbo, and GPT-4. Furthermore, it is "retrieval-mode agnostic," meaning it works regardless of whether examples are selected randomly or via advanced methods like BM25.

Conclusion

By incorporating prediction feedback, this research provides a path toward more nuanced and explainable sentiment analysis in LLMs. While the initial step of acquiring "prior predictions" adds computational overhead, the resulting gains in accuracy—especially for subtle emotions—outperform standard few-shot methods and even small-scale fine-tuning. Future work will explore how this feedback loop performs in generative tasks like text summarization or complex mathematical reasoning.

Summary updated

BibTeX
@inproceedings{xu2024improving,
  author = {Hongling Xu and Qianlong Wang and Yice Zhang and Min Yang and Xi Zeng and Bing Qin and Ruifeng Xu},
  title = {{Improving In-Context Learning with Prediction Feedback for Sentiment Analysis}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.findings-acl.232},
}
Figure