LLaMAs Have Feelings Too: Unveiling Sentiment and Emotion Representations in LLaMA Models Through Probing
Dario Di Palma, Alessandro De Bellis, Giovanni Servedio, Vito Walter Anelli, Fedelucio Narducci, Tommaso Di Noia · 2025
Read LLaMAs Have Feelings Too: Unveiling Sentiment and Emotion Representations in LLaMA Models Through Probing by Dario Di Palma, Alessandro De Bellis, Giovanni Servedio, Vito Walter Anelli, Fedelucio Narducci, Tommaso Di Noia (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2505-16491.txt.
Introduction
Dario Di Palma and co-authors probe the layers of a Llama model for where mood lives, in a study from 2025. Chat models grade text mood well when asked, but where in their depths that mood sense sits was foggy. The team reads it with small probe sorts fed on layer states.
For plain for-or-against mood, mid layers held the mark most thick; probes there beat ask-based grades by up to four in ten more right. The last word's state was not the best seat in this tail-read kind of model, a twist on lore. Probes also slash the bulk a mood task needs, by more than half. Layer-wise probes, they pitch, are a lean, sharp way to run mood work.
Catalog record
| CREATOR | Dario Di Palma, Alessandro De Bellis, Giovanni Servedio, Vito Walter Anelli, Fedelucio Narducci, Tommaso Di Noia |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 48 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2505-16491
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
LLaMAs Have Feelings Too: Unveiling Sentiment and Emotion Representations in LLaMA Models Through Probing Thanks: This is the authors’ version of the work. The final, published version will appear in the Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (ACL ‘25) . This work is licensed under a Creative Commons Attribution 4.0 International License (CC BY 4.0) . Please cite the official published version when available. Dario Di Palma, Alessandro De Bellis, Giovanni Servedio, Vito Walter Anelli, Fedelucio Narducci, Tommaso Di Noia Abstract Large Language Models (LLMs) have rapidly become central to NLP, demonstrating their ability to adapt to various tasks through prompting techniques, including sentiment analysis. However, we still have a limited understanding of how these models capture sentiment-related information. This study probes the hidden layers of Llama models to pinpoint where sentiment features are most represented and to assess how this affects sentiment analysis. Using probe classifiers, we analyze sentiment encoding across layers and scales, identifying the layers and pooling methods that best capture sentiment signals. Our results show that sentiment information is most concentrated in mid-layers for binary polarity tasks, with detection accuracy increasing up to 14% over prompting techniques. Additionally, we find that in decoder-only models, the last token is not consistently the most informative for sentiment encoding. Finally, this approach enables sentiment tasks to be performed with memory requirements reduced by an average of 57%. These insights contribute to a broader understanding of sentiment in LLMs, suggesting layer-specific probing as an effective approach for sentiment tasks beyond prompting, with potential to enhance model utility and reduce memory requirements. 1 Introduction Sentiment analysis (SA), which classifies opinions, emotions, and attitudes in text, is a cornerstone of Natural Language Processing (NLP). SA has enabled the development of several applications, including social media monitoring Camacho-Collados et al. (2022) , customer feedback analysis Lin et al. (2017) , and opinion mining Xia et al. (2021) . It comprises various tasks, such as polarity detection (classifying text as positive, negative, or neutral), emotion classification, and subjectivity detection Khan et al. (2014) . Earlier approaches for the sentiment classification task relied on supervised learning algorithms and extensive feature engineering Al-Mannai et al. (2014) , requiring large annotated datasets and domain expertise to model sentiment effectively Bordoloi and Biswas (2023) . However, the advent of pre-trained models such as GPT-2 Radford et al. (2019) has transformed NLP by enabling downstream tasks through prompting techniques Brown et al. (2020) ; Di Palma (2023) , significantly reducing reliance on extensive labeled data. While prompting has enhanced the applicability of LLMs for sentiment analysis Deng et al. (2023) ; Xing (2024) ; Ahmed et al. (2024) ; Biancofiore et al. (2025) , these techniques have often lacked fine-grained control of semantic features, such as context-dependent sentiments or subtle emotional tones. Moreover, the encoding of such features within model representations has not been well understood, limiting efforts to optimize and interpret sentiment analysis performance. Efforts to interpret neural model representations have advanced significantly over time. Building on the linear representations hypothesis ( Mikolov et al., 2013 ) , which suggests that high-level features can be represented as linear directions, researchers have explored where human-interpretable concepts are encoded within LLMs. While previous studies have examined concepts such as truthfulness ( Burns et al., 2023 ) , honesty ( Azaria and Mitchell, 2023 ) , and factual knowledge ( Li et al., 2023 ) , sentiment encoding remains relatively underexplored, despite its importance in NLP applications. This study aims to fill this gap by investigating where sentiment information is encoded within Llama models Touvron et al. (2023) . We focus on both binary polarity (positive or negative sentiment) and fine-grained emotion detection (joy, sadness, anger, fear, love, and surprise), identifying the model layers that most effectively capture these sentiment concepts. Specifically, we trained classifiers to identify subspaces corresponding to specific concepts, such as positive sentiment, within model representations. We refer to these classifiers as probes Alain and Bengio (2017) . Furthermore, unlike previous studies that rely solely on the last token’s representation (as a sentence summary) for probe training Burns et al. (2023) ; Azaria and Mitchell (2023) ; Li et al. (2023) , we evaluate alternative pooling methods for sentence-level sentiment detection. Our extensive experiments reveal several key insights into how sentiment and emotion are represented in LLMs. We find that (1) sentiment concepts are most detectable in mid-layer representations, while (2) emotions are more discoverable in early layers; (3) selecting the last token does not consistently yield the best results for probe training; (4) representation quality improves with model size; and (5) probe classifiers generally outperform prompting techniques for accurate sentiment and emotion classification. In summary, our work makes the following contributions: • We perform a layer-wise analysis of sentiment encoding in Llama models, identifying the layers that most effectively capture sentiment information. • We evaluate six pooling methods to identify the most effective approach for sentence representation in sentiment analysis. • We investigate the impact of model size on sentiment representation by analyzing Llama-3 models of 1B, 3B, and 8B parameters. • We show that Llama-based classifiers outperform Llama in zero-shot, few-shot, and Chain-of-Thought settings while requiring fewer parameters. • We propose SentriLlama , a task-specific adaptation of Llama that identifies and utilizes the most representative layer for sentiment analysis, replacing the language modeling head with a lightweight classification head to significantly reduce inference costs while maintaining state-of-the-art performance. 2 Related Work In this section, we outline the evolution of sentiment analysis, trace the development of probing research in neural models, focusing on LLMs, and conclude by comparing our work to recent studies. 2.1 Sentiment Analysis Meets LLMs Sentiment analysis, the task of classifying and extracting subjective information from text, has evolved from lexicon-based approaches using dictionaries of positive and negative words Hatzivassiloglou and McKeown (1997) ; Wiebe (2000) to supervised learning methods employing n-gram models and machine learning Pang et al. (2002) ; Chaovalit and Zhou (2005) . These early methods, limited by their reliance on handcrafted features, paved the way for feature engineering techniques and eventually the deep learning revolution that reshaped sentiment classification. To improve feature identification, researchers incorporated advanced techniques such as syntactic dependencies Yao et al. (2010) , part-of-speech tagging Søgaard (2011) , and negation handling Morante and Blanco (2012) . The advent of deep learning further transformed sentiment analysis, with models such as Recurrent Neural Networks (RNNs) Socher et al. (2013) and Convolutional Neural Networks (CNNs) Kim (2014) , achieving significant advancements by learning representations directly from raw text. However, the introduction of Transformer architectures Vaswani et al. (2017) marked a paradigm shift. Models like BERT Devlin et al. (2019) leverage pretraining on vast datasets to extract contextualized representations, and they have been widely used as encoding backbones for downstream tasks. Conversely, GPT Radford et al. (2019) employs the Transformer-decoder block and frames language modeling as an autoregressive task. Finally, inspired by the transfer learning paradigm, Raffel et al. (2020) introduced T5, an encoder-decoder model for text-to-text tasks, trained on vast amounts of data to capture general language patterns and fine-tuned for a wide range of specific applications. The introduction of GPT-3 Brown et al.