Sentiment Analysis in the Era of Large Language Models: A Reality Check
Sentiment analysis (SA) has been a longstanding research area in natural language processing. It can offer rich insights into human sentiments and opinions and has thus seen considerable interest from both academia and industry. With the advent of large language models (LLMs) such as ChatGPT, there is a great potential for their employment on SA problems. However, the extent to which existing LLMs can be leveraged for different sentiment analysis tasks remains unclear. This paper aims to provide a comprehensive investigation into the capabilities of LLMs in performing various sentiment analysis tasks, from conventional sentiment classification to aspect-based sentiment analysis and multifaceted analysis of subjective texts. We evaluate performance across 13 tasks on 26 datasets and compare the results against small language models (SLMs) trained on domain-specific datasets. Our study reveals that while LLMs demonstrate satisfactory performance in simpler tasks, they lag behind in more complex tasks requiring deeper understanding or structured sentiment information. However, LLMs significantly outperform SLMs in few-shot learning settings, suggesting their potential when annotation resources are limited. We also highlight the limitations of current evaluation practices in assessing LLMs’ SA abilities and propose a novel benchmark, SENTIEVAL, for a more comprehensive and realistic evaluation. Data and code during our investigations are available at https://github. com/DAMO-NLP-SG/LLM-Sentiment.
Introduction. Sentiment analysis1 (SA) has been a long established area of research in natural language processing (NLP), which aims to systematically study people’s opinions, sentiments, emotions, etc, through computational methods (Liu, 2015; Poria et al., 2020). Since its inception (Turney, 2002; Hu and Liu, 2004), this field has attracted significant interest from both academia and industry due to its wide range of applications, such as product review analysis and gaining insights from social media posts (Barbieri et al., 2020; Zhang et al., 2022). Furthermore, achieving a deep understanding of human subjective feeling through sentiment analysis is undoubtedly an important step toward developing artificial general intelligence (Bubeck et al., 2023). In recent years, large language models (LLMs) such as GPT-3 (Brown et al., 2020), PaLM (Chowdhery et al., 2022), and GPT-4 (OpenAI, 2023) have demonstrated impressive performance on a wide range of NLP tasks. They can directly perform tasks in zero-shot or few-shot in-context learning manner and achieve strong performance without the need for any supervised training (Bang et al., 2023; Ye et al., 2023; Zhong et al., 2023; Yang et al., 2023). Although there have been some initial attempts to apply LLMs to sentiment analysis (Deng et al., 2023; Zhong et al., 2023; Wang et al., 2023), these are often limited to some specific tasks within the field and consider different models, datasets, and settings in experiments. As such, the extent to which existing large language models can be leveraged for sentiment analysis remains unclear. In this work, we aim to conduct a reality check on the current state of sentiment analysis in the era of large language models. Specifically, we seek to answer the following research questions: 1) How well do LLMs perform on various sentiment analysis tasks? 2) Compared to small specialized models trained on domain-specific datasets, how do large models fare in both zero-shot and few-shot settings? 3) Are current SA evaluation practices still suitable to assess models in the era of LLMs? To this end, we first conduct a systematic review of various sentiment analysis related tasks, from conventional sentiment classification (SC, classifying the sentiment orientation of a given text) (Socher et al., 2013) to aspect-based sentiment analysis (ABSA, analyzing sentiment and opinion information in a more fine-grained aspect-level manner) (Zhang et al., 2022) and the multifaceted analysis of subjective texts (MAST, focusing on specific sentiment or opinion phenomenon such as hate speech detection and comparative opinion mining) (Barbieri et al., 2020). In total, we consider 13 sentiment analysis tasks across 26 datasets. These tasks were often studied in isolation due to their unique characteristics in the past. This fragmentation, while necessary in the previous phases, offered a somewhat incomplete understanding of how well models could comprehend human subjective information. With the advent of LLMs, we now have the tools to conduct a more holistic and integrated examination. For LLMs, we consider both open-source language models such as Flan-T5 (Chung et al., 2022) and Flan-UL2 (Tay et al., 2022), along with GPT-3.5 model series from OpenAI, namely Chat- GPT (gpt-3.5-turbo) and text-davinci-003 (Brown et al., 2020; Ouyang et al., 2022). We also establish comparison baselines using smaller language models2 (SLMs) such as T5 (Raffel et al., 2020), which allows us to measure the performance of LLMs against these specialized baselines trained with in-domain labeled data. We employ both zeroshot and few-shot settings to evaluate these models across various sentiment analysis tasks, which helps us answer the first two research questions. Our investigation yields several insights: Firstly, LLMs already demonstrate satisfactory performance in zero-shot settings for simple SA tasks, such as binary sentiment classification. However, when it comes to more complex tasks, e.g., those requiring a deep understanding of specific sentiment phenomena, or ABSA tasks that necessitate structured sentiment information, LLMs still lag behind SLMs trained with in-domain data. Despite an increased performance can be observed with a larger number of parameters (e.g., from Flan-T5 to ChatGPT), a performance gap remains. Secondly, in the context of few-shot learning, with a limited quantity of annotated data, LLMs consistently outperform SLMs. This suggests that the application of LLMs is advantageous when annotation resources are scarce. Nevertheless, LLMs are constrained by the limited context length for few-shot examples, which needs to be addressed for effective utilization. During the investigation, we also identify several limitations of current practice in evaluating a model’s SA capability. For example, the evaluations often only involve specific tasks or datasets; and inconsistent prompts are utilized across different studies.
Related work. Sentiment analysis has received lots of attention since its early appearance (Turney, 2002; Yu and Hatzivassiloglou, 2003; Hu and Liu, 2004) and remained an active research area in the field of NLP nowadays (Liu, 2015; Poria et al., 2020; Yadav and Vishwakarma, 2020). This enduring interest mainly stems from two aspects. Firstly, the ability to comprehend the subjective sentiments and opinions within textual data is a critical step toward achieving human-level intelligence (Bubeck et al., 2023). For example, understanding human emotions, recognizing their dynamic changes, and providing emotional responses are key elements in creating human-like chatbots (Rashkin et al., 2019; Liu et al., 2021). Secondly, the practical applications of sentiment analysis span a broad spectrum, especially with the explosive growth of user-generated content in the past decades. SA has found extensive applications such as analyzing customer reviews (Keung et al., 2020; Zhang et al., 2022), monitoring social media opinions (Yue et al., 2019; Barbieri et al., 2020), etc. Given its importance, sentiment analysis comprises a broad spectrum of tasks for understanding and analyzing human sentiment, emotion, and subjective feeling in the text. One of the earliest and most fundamental tasks is the sentiment classification (Turney, 2002), which aims at determining the overall sentiment polarity of a given text, typically in a binary (positive, negative) or multi-class (positive, neutral, negative) format (Keung et al., 2020). In recent years, with the more powerful deep learning models, two directions have appeared which either go “deep” or go “wide”. The deep direction moves towards more granular tasks, namely aspectbased sentiment analysis (ABSA). ABSA aims to extract detailed sentiment information about specific aspects or features of an opinion target (Zhang et al., 2022). Another direction extends SA to the multifaceted analysis of subjective texts (MAST), which encompasses various specialized tasks focusing on specific sentiment or opinion phenomena (Liu, 2015). For example, hate speech detection aims to identify aggressive or derogatory sentiments targeted toward specific groups (Schmidt and Wiegand, 2017). Other tasks include irony detection (Zeng and Li, 2022), comparative opinion mining (Varathan et al., 2017), emotion detection (Sailunaz et al., 2018) etc, each addressing different dimensions of sentiment in text. All these tasks collectively contribute to a holistic understanding of sentiment in language and demonstrate the wide range of tasks falling under the umbrella of sentiment analysis.
Method. We conduct an extensive survey of a wide range of SA tasks and categorize different tasks into three types: sentiment classification (SC), aspect-based sentiment analysis (ABSA), and multifaceted analysis of subjective texts (MAST). We describe investigated tasks of each type, along with the datasets and evaluation metrics. To ensure balance across various tasks and datasets, we limit our evaluation by sampling a maximum of 500 examples from the test set of each dataset. Detailed statistics on each task and dataset are summarized in Table 1.
Sentiment classification (SC) aims at assigning predefined sentiment classes (e.g., positive, negative, or neutral) to given texts (Liu, 2015). It serves as a fundamental measure of sentiment orientation and is commonly used to analyze customer reviews, social media posts and etc. It can involve a varying number of sentiment classes, ranging from binary classification, where sentiments are categorized as either positive or negative, to more nuanced fiveclass classification, which grades sentiments on a scale from very negative to very positive. There are also different levels of granularity at which sentiment can be analyzed, including document-level, sentence-level, and aspect-level SC.
Document-Level Sentiment classification at the document level aims to determine the overall sentiment expressed in a text corpus, providing a highlevel understanding of the expressed sentiment orientation. We evaluate on three widely used datasets, including IMDb (Maas et al., 2011), Yelp-2, and Yelp-5 (Zhang et al., 2015). The IMDb dataset contains movie reviews, whereas the Yelp-2 dataset includes customer reviews for businesses. Reviews Sentence-Level Sentence-level classification allows for sentiment analysis on a sentence-bysentence basis. It is particularly useful in analyzing social media posts, customer feedback, or any text where sentiments may change rapidly from sentence to sentence. We select multiple datasets for evaluation, including MR (Pang and Lee, 2005), SST2, SST5 (Socher et al., 2013), and Twitter (Rosenthal et al., 2017). The MR, SST2, and SST5 Aspect-Level Since sentiment expressed towards different targets might be different even within a single sentence, aspect sentiment classification dives even deeper into the analysis by focusing on identifying sentiment towards specific aspects or entities mentioned. This level of analysis is particularly valuable when the sentiment towards different aspects or entities needs to be assessed individually. There are two widely used datasets including Lap14 and Rest14. These datasets were introduced in the SemEval ABSA challenge 2014 (Pontiki et al., 2014) and consist of laptop and restaurant reviews, respectively. The goal is to determine the sentiment towards a specific aspect mentioned in a review sentence, classifying it as either positive, negative, or neutral. Performance assessment is based on the metric of accuracy.
Aspect-based sentiment analysis (ABSA) refers to the process of analyzing people’s sentiments at a more fine-grained aspect level. It encompasses the analysis of various sentiment elements, such as aspects, opinions, and sentiment polarities (Zhang et al., 2022). ABSA has gained significant attention in recent years, resulting in the emergence of a wide range of tasks. We focus on three compound ABSA tasks here for investigation, which aim to jointly extract multiple sentiment elements.
Unified Aspect-based Sentiment Analysis (UABSA) UABSA is the task of extracting both the aspect and its corresponding sentiment polarity simultaneously. We evaluate UABSA on four datasets originally from SemEval-2014 (Pontiki et al., 2014), SemEval-2015 (Pontiki et al., 2015), and SemEval-2016 (Pontiki et al., 2016) shared tasks, which consist of reviews from Laptops and Restaurants domains. Following previous studies, we use Micro-F1 score as the metric for evaluation. A predicted pair would be counted as correct only if both the aspect term and sentiment polarity match exactly with the gold labels.
Discussion. Call for more comprehensive evaluation Most of the current evaluations tend to focus narrowly on specific SA tasks or datasets (Zhong et al., 2023; Wang et al., 2023). While these assessments can provide useful insights into certain aspects of an LLM’s sentiment analysis competence, they inherently fall short of capturing the full breadth and depth of the model’s capabilities. Such limitation not only reduces the overall reliability of the assessment results but also limits the scope of understanding the model’s adaptability to diverse SA scenarios. For example, a model with satisfactory sentiment classification ability does not guarantee its performance in detecting hateful speech. Therefore, we attempt to provide a holistic evaluation across a wide range of SA tasks in this work and call for a more comprehensive evaluation on a wider range of SA tasks in the future.
Appeal for more natural ways to interact with the models Conventional sentiment analysis tasks are often structured as a single sentence paired with its corresponding sentiment label. This format, while facilitating the learning of the mapping relationship between the text and its sentiment label, may not optimally suit LLMs, which are typically text generation models. In practice, users exhibit varied writing styles, leading to diverse ways of communicating their requirements to LLMs to solve their SA tasks. It is thus critical to account for these diverse expressions in the evaluation process to reflect more realistic use cases. This ensures the evaluation results mirror real-world interactions, offering more reliable and applicable insights.
Sensitivity on Prompt Design As shown in Sec 4.4, variations in prompt design can substantially influence the performance of ChatGPT, even on some seemingly simple sentiment classification tasks. Such nuanced sensitivity associated with prompt design introduces challenges when attempting to fairly and stably test the SA capabilities of LLMs. This challenge is further amplified when various studies employ distinct prompts for different SA tasks across a range of LLMs. The inherent bias associated with prompt design complicates the fair comparison of different models using the same prompt, as a single prompt may not be universally appropriate to reflect all models’ capabilities.
In this study, we carry out a comprehensive evaluation of various large language models across a range of sentiment analysis tasks. The experimental results lead us to several primary findings and recommendations for practical SA application:
• For simple SA tasks such as binary or trinary sentiment classification, LLMs can already serve as effective solutions. Even in a zeroshot setting, their performance can match or surpass fine-tuned smaller language models, and with little sensitivity to different prompt designs (as shown in Sec 4.4).
• When annotation resources are scarce, LLMs remain a good choice due to their superior fewshot in-context learning performance compared to SLMs trained on the same limited data. However, the restricted context length of LLMs can limit their use case, particularly in document-level tasks where SLMs might be more suitable.
• For tasks requiring structured sentiment output, like aspect-based sentiment analysis tasks, LLMs might not be the best option. They tend to lag behind SLMs in both automatic and human evaluations, and performance can vary significantly with different prompt designs.
• Larger models do not always guarantee superior performance, for instance, Flan-UL2 often performs comparably to the GPT-3.5 series of models, despite being much smaller in size. This suggests that employing instructiontuning to attain a reasonably sized model may suffice for practical SA applications.
Conclusion. In this study, we conduct a systematic evaluation of various sentiment analysis tasks using LLMs, which helps better understand their capabilities in sentiment analysis problems. Experimental results reveal that while LLMs perform quite well on simpler tasks in a zero-shot setting, they struggle with more complex tasks. In a few-shot learning context, LLMs consistently outperform SLMs, suggesting their potential in scenarios where annotation resources are scarce. This work also highlights the limitations of current evaluation practices and then introduces the SENTIEVAL benchmark as a more comprehensive and realistic evaluation tool. Overall, large language models have opened new avenues for sentiment analysis. While some traditional SA tasks have achieved near-human performance, a comprehensive understanding of human sentiment, opinion, and other subjective feelings remains a long way to pursue. The powerful text comprehension capabilities of LLMs offer effective tools and exciting research directions for the exploration of sentiment analysis in the LLM era.
Lines of inquiry this paper opens 24
Research framings built by reading the notes related to this paper — the questions it feeds into.
Do language models learn genuine linguistic structure or just surface patterns?- Why do LLMs fail at aspect-based sentiment extraction despite strong classification performance?
- Will newer instruction-tuned LLMs close the structured sentiment analysis gap?
- Do LLMs fail in low-resource domains where knowledge is scarce instead of labels?
- Can language models understand the implicit emotional intent behind questions?
- How does training data distribution determine what models can learn?
- What training data do modern commercial ASR systems actually contain?
- How much do LLMs rely on recent training data when events are days old?
- How much of synthetic training data can come from prompting general LLMs alone?
- How does AI assistance affect perceived emotional tone in writing?
- How do demographic and emotional compression relate to writing quality?
- What prompt types best extract different aspects of item content?
- What makes the prompt a fundamentally new kind of speech act?
- Can prompting unlock compositional skills that pretraining already learned?