Improving In-Context Learning with Prediction Feedback for Sentiment Analysis (2024)

Abstract: Large language models (LLMs) have achieved promising results in sentiment analysis through the in-context learning (ICL) paradigm. However, their ability to distinguish subtle sentiments still remains a challenge. Inspired by the human ability to adjust understanding via feedback, this paper enhances ICL by incorporating prior predictions and feedback, aiming to rectify sentiment misinterpretation of LLMs. Specifically, the proposed framework consists of three steps: (1) acquiring prior predictions of LLMs, (2) devising predictive feedback based on correctness, and (3) leveraging a feedback-driven prompt to refine sentiment understanding. Experimental results across nine sentiment analysis datasets demonstrate the superiority of our framework over conventional ICL methods, with an average F1 improvement of 5.95%.

## introduction sentiment analysis aims to detect subjective opinions within texts automatically @xcite , covering tasks such as sentiment classification, aspect-based sentiment analysis, and emotion detection @xcite . previous studies proposed many supervised methods for sentiment analysis @xcite . to avoid their reliance on large amounts of human-annotated data, some studies attempted to use limited data to recognize sentiment yet obtained mediocre results. with the advent of large language models (llms) @xcite , studies have revealed that llms can yield promising performance on sentiment analysis via in-context learning (icl) paradigm @xcite , which utilizes only few-shot input-label pairs selected from a candidate example pool. despite achieving favorable results, the conventional icl paradigm still faces a concerning limitation. namely, through the provided examples, llms fail to differentiate subtly similar sentiments effectively. consequently, they would predict plausible yet incorrect sentiment labels. as depicted in figure 1a , although llms can clearly distinguish between positive and negative polarities, they often mistakenly categorize neutral into others. in addition, as shown in figure 1b , llms frequently mislabel fine-grained sentiments as relevant but wrong labels, such as joy and optimism, stemming from their incapacity to understand nuanced sentiments with similar contexts. inspired by the human learning process, where individuals initially make plans based on prior knowledge and adjust their understanding through actual feedback @xcite , we propose to integrate feedback on prior predictions into icl, aiming to rectify sentiment misunderstandings of llms. specifically, our framework first yields prior predictions for each candidate example using traditional icl. we then categorize examples into two sub-pools based on correctness and exploit feedback to illustrate differences between prior predictions and human annotations. finally, during inferring, we select relevant examples from each subpool and use a specific feedback-driven prompt to llm step 1: prior prediction acquisition step 2: predictive feedback design step 3: test sample inference 𝒚 𝟏 : positive (√) 𝒚 𝟐 : negative (√) 𝒚 𝟑 : positive (×) correct examples 𝒆 𝟏 : <input, label (positive), prediction (positive)> √ wrong examples … … … … feedback on correctness: you are correct! … (task instruction) recognize the sentiment of the sentence. here are some examples: (examples with feedback) < input, prediction, label, feedback on correctness (or errors) > (test input) sentence: the greatest and deadliest magic trick i've ever seen. you won't regret watching david blaine. label: neutral candidate example pool input: looking forward to celebrity juice tonight. label: positive 𝒆 𝟏 input: school on monday! i don't want!!!! :(. label: negative 𝒆 𝟐 input: the sound of sunday with katy perry -roar #webradio #internetradio label: neutral 𝒆 𝟑 prior prediction … … … … 𝒆 𝟐 : <input, label (negative), prediction (negative)> √ 𝒆 𝟑 : <input, label (neutral), prediction (positive)> × feedback on errors: you are wrong! … llm wrap input, prediction, label, and feedback. unlike conventional icl, where llms only see correct labels, our framework effectively directs llms to adjust their sentiment understanding and reasoning to align more closely with label perception through prediction and feedback. experimental results on nine sentiment analysis datasets show that our framework outperforms existing icl baselines by 5.95% in average f1. further discussions indicate its effectiveness and robustness. moreover, the framework also yields competitive results when extended to other tasks. ## preliminary sentiment analysis aims to predict the sentiment label y ′ of an input text x. here, different tasks may have different label spaces c and inputs. 2 in icl paradigm, given an input x and k-shot incontext examples {(x i , y i )} k @xmath0, a frozen llm m is used to predict y ′ . ## the proposed framework as shown in figure 2 , our framework consists of three steps: 1) prior prediction acquisition, 2) pre-2 for example, aspect sentiment classification task needs to consider the effect of aspects in inputs @xcite . 3 if a label word is split into subtokens, we use only the first subword for prediction, such as 'optim' for 'optimism'. ## conclusion in this paper, we propose a novel icl framework that utilizes prediction feedback akin to human learning. it improves icl by incorporating both prior predictions and corresponding feedback into examples, tackling the difficulties llms encounter when identifying subtle sentiments. experiments across various datasets confirm the advantages of our framework compared to conventional icl, as well as its potential for broader applications.