Linear Representations of Sentiment in Large Language Models
作者: Curt Tigges, Oskar John Hollinsworth, Atticus Geiger, Neel Nanda
分类: cs.LG, cs.AI, cs.CL
发布日期: 2023-10-23
💡 一句话要点
揭示大型语言模型中情感的线性表示机制
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 情感分析 大型语言模型 线性表示 因果干预 斯坦福情感树库 注意力机制 文本生成
📋 核心要点
- 现有研究对大型语言模型中情感的表示机制缺乏深入理解,尤其是如何在不同任务中捕捉情感特征。
- 本研究提出通过线性方向来表示情感,并通过因果干预方法验证其在多种任务中的有效性。
- 实验结果表明,去除情感方向会显著降低模型在情感分类任务中的性能,尤其是在特定位置的情感总结上。
📝 摘要(中文)
情感是自然语言文本中的一个普遍特征,但在大型语言模型(LLMs)中情感是如何表示的仍然是一个未解之谜。本研究揭示了情感在多种模型中以线性方式表示:在激活空间中,一个单一方向主要捕捉了情感特征,正向和负向分别位于两端。通过因果干预,我们隔离了这一方向,并证明其在玩具任务和真实数据集(如斯坦福情感树库)中具有因果相关性。我们还发现情感不仅仅体现在情感强烈的词汇上,还在中间位置(如标点符号和名称)进行总结。我们展示了在斯坦福情感树库的零样本分类中,去除情感方向会导致76%的分类准确率损失,其中近一半(36%)是由于仅在逗号位置去除总结情感方向造成的。
🔬 方法详解
问题定义:本研究旨在探讨大型语言模型中情感的表示方式,现有方法未能有效揭示情感在激活空间中的具体表现及其因果关系。
核心思路:研究通过线性方向捕捉情感特征,利用因果干预方法隔离这一方向,分析其在不同任务中的表现及重要性。
技术框架:整体架构包括情感方向的识别、因果干预的实施以及在斯坦福情感树库等数据集上的验证,主要模块包括模型激活分析和任务性能评估。
关键创新:本研究的创新点在于首次系统性地揭示了情感在大型语言模型中的线性表示,并提出了“总结动机”这一新现象,强调情感不仅存在于情感词汇中。
关键设计:在实验中,采用特定的因果干预方法,重点关注注意力头和神经元的选择,设置了不同的参数以评估情感方向的影响,特别是在逗号等中间位置的情感总结。
🖼️ 关键图片
📊 实验亮点
实验结果显示,在斯坦福情感树库的零样本分类中,去除情感方向导致76%的分类准确率损失,其中36%是由于去除逗号位置的情感总结方向。这一发现强调了情感表示的复杂性及其在模型性能中的关键作用。
🎯 应用场景
该研究的发现对情感分析、文本生成和人机交互等领域具有重要应用价值。通过理解情感在语言模型中的表示,可以提升模型在情感理解和生成任务中的性能,推动更智能的对话系统和情感计算的发展。
📄 摘要(原文)
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.