Skip to main content
QUICK REVIEW

[论文解读] Linear Representations of Sentiment in Large Language Models

Curt Tigges, Oskar John Hollinsworth|arXiv (Cornell University)|Oct 23, 2023
Topic Modeling被引用 5
一句话总结

本文揭示了大型语言模型中的情感在激活空间中沿单一方向线性表示,该方向对情感预测具有因果重要性。通过因果干预和电路分析,作者识别出一种“摘要模式”,即情感在诸如逗号等中性标记处汇聚,当该模式被移除时,导致零样本SST准确率损失的36%。

ABSTRACT

Sentiment is a pervasive feature in natural language text, yet it is an open question how sentiment is represented within Large Language Models (LLMs). In this study, we reveal that across a range of models, sentiment is represented linearly: a single direction in activation space mostly captures the feature across a range of tasks with one extreme for positive and the other for negative. Through causal interventions, we isolate this direction and show it is causally relevant in both toy tasks and real world datasets such as Stanford Sentiment Treebank. Through this case study we model a thorough investigation of what a single direction means on a broad data distribution. We further uncover the mechanisms that involve this direction, highlighting the roles of a small subset of attention heads and neurons. Finally, we discover a phenomenon which we term the summarization motif: sentiment is not solely represented on emotionally charged words, but is additionally summarized at intermediate positions without inherent sentiment, such as punctuation and names. We show that in Stanford Sentiment Treebank zero-shot classification, 76% of above-chance classification accuracy is lost when ablating the sentiment direction, nearly half of which (36%) is due to ablating the summarized sentiment direction exclusively at comma positions.

研究动机与目标

  • 研究情感在大型语言模型(LLMs)内部的表现场景,特别是其是否以线性方式编码。
  • 确定激活空间中的单一方向是否在合成任务和真实世界任务中均对情感预测具有因果影响。
  • 识别负责情感表征和摘要的神经机制——具体为注意力头和神经元。
  • 探索中间非情感性标记(如逗号、人名)在跨层汇总情感信息方面是否存在及其作用。
  • 评估情感表征在包括SST和OpenWebText在内的多种模型和数据集中的鲁棒性和泛化能力。

提出的方法

  • 采用因果中介分析框架,隔离并测试激活空间中情感方向的影响。
  • 应用激活修补和方向性消融,测量情感方向对模型预测的因果贡献。
  • 通过在小样本数据集(ToyMovieReview)上对激活嵌入进行K-means聚类来训练情感方向,并在真实世界数据(SST)上进行验证。
  • 使用transformer-lens库进行详细的电路分析,识别参与情感表征的关键注意力头和神经元。
  • 实施方向性修补,测试在特定标记处注入或移除情感信息是否会影响最终预测。
  • 在多个模型(GPT-2, Pythia)和层之间进行比较,以评估情感方向的一致性和泛化能力。

实验结果

研究问题

  • RQ1在多种模型和任务中,情感是否在LLM的激活空间中以单一线性方向表示?
  • RQ2该情感方向是否通过干预技术证明对最终情感预测具有因果相关性?
  • RQ3中间非情感性标记(如逗号、英文句号、专有名词)是否作为汇总情感信息的枢纽?
  • RQ4哪些特定注意力头和神经元最负责编码和传播情感表征?
  • RQ5当在摘要标记处进行消融时,模型情感分类性能中有多少可归因于情感方向?

主要发现

  • 激活空间中的单一线性方向在包括英语和法语文本在内的多种语境中捕捉了情感,与情感标签具有高度相关性。
  • 对情感方向进行因果消融后,零样本SST准确率较随机水平下降76%,证明其具有因果显著性。
  • 特别在逗号位置对情感方向进行消融,导致总准确率损失的36%,揭示了‘摘要模式’的存在。
  • 该情感方向在多个模型(GPT-2, Pythia)和层中均表现稳健,表明其具有可泛化的内部表征特性。
  • 一小部分注意力头和神经元主要负责编码和传播情感,表明存在一个紧凑且可解释的神经电路。
  • 情感方向并非简单地作为情感词的代理,而是捕捉了更高阶的抽象信息,情感信息通过诸如标点符号和人名等中性标记被汇聚。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。