Unveiling Sentiment Representations in Code-LLMs

Yongyi Ji, Fuxiang Chen, Jaegul Choo, Seung-Won Hwang, Lu Liu


Abstract
This paper examines whether Code-LLMs encode latent sentiment representations and how these influence generation behavior. Using probing methods, we show that sentiment information is linearly separable in hidden states. Through activation steering, we demonstrate that manipulating sentiment-aligned directions systematically affects both output tone and downstream task performance. Notably, negative sentiment consistently reduces correctness, while positive effects are weaker and less consistent. Ablation and error analyses indicate these changes are not due to random perturbations but reflect meaningful behavioral shifts, including reduced confidence. These findings suggest that affective latent directions act as unintended control signals in Code-LLMs, with measurable impact on downstream task performance quality. Our study highlights the need to better understand and control such latent factors when deploying Code-LLMs.
Anthology ID:
2026.findings-emnlp.443
Volume:
Findings of the Association for Computational Linguistics: EMNLP 2026
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Hung-Yi Lee, Sunipa Dev, Jessy Li, Desmond Elliott
Venue:
Findings
SIG:
SIGDAT
Publisher:
Association for Computational Linguistics
Note:
Pages:
9284–9314
Language:
URL:
https://aclanthology.org/2026.findings-emnlp.443/
DOI:
Bibkey:
Cite (ACL):
Yongyi Ji, Fuxiang Chen, Jaegul Choo, Seung-Won Hwang, and Lu Liu. 2026. Unveiling Sentiment Representations in Code-LLMs. In Findings of the Association for Computational Linguistics: EMNLP 2026, pages 9284–9314, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
Unveiling Sentiment Representations in Code-LLMs (Ji et al., Findings 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.findings-emnlp.443.pdf