LLaMAs Have Feelings Too: Unveiling Sentiment and Emotion Representations in LLaMA Models Through Probing

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Di Palma, Dario, De Bellis, Alessandro, Servedio, Giovanni, Anelli, Vito Walter, Narducci, Fedelucio, Di Noia, Tommaso
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866909628921544704
author Di Palma, Dario
De Bellis, Alessandro
Servedio, Giovanni
Anelli, Vito Walter
Narducci, Fedelucio
Di Noia, Tommaso
author_facet Di Palma, Dario
De Bellis, Alessandro
Servedio, Giovanni
Anelli, Vito Walter
Narducci, Fedelucio
Di Noia, Tommaso
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2505_16491
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle LLaMAs Have Feelings Too: Unveiling Sentiment and Emotion Representations in LLaMA Models Through Probing
Di Palma, Dario
De Bellis, Alessandro
Servedio, Giovanni
Anelli, Vito Walter
Narducci, Fedelucio
Di Noia, Tommaso
Computation and Language
Artificial Intelligence
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.
title LLaMAs Have Feelings Too: Unveiling Sentiment and Emotion Representations in LLaMA Models Through Probing
topic Computation and Language
Artificial Intelligence
url https://arxiv.org/abs/2505.16491