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

TL;DR
This paper investigates how LLaMA models internally encode sentiment and emotion, revealing that mid-layers are most informative for sentiment detection and that probing can outperform prompting with reduced memory use.
Contribution
It introduces a layer-specific probing method to analyze sentiment encoding in LLaMA models, improving understanding and performance over prompting techniques.
Findings
Sentiment is most concentrated in mid-layers.
Probing improves sentiment detection accuracy by up to 14%.
Memory requirements for sentiment tasks are reduced by 57%.
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…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
Taxonomy
TopicsSentiment Analysis and Opinion Mining · Topic Modeling · Mental Health via Writing
MethodsLLaMA
