通过分析注意力机制定位并缓解大模型中的偏见问题。
Attention Speaks Volumes: Localizing and Mitigating Bias in Language Models
- 用注意力分数量化模型对不同实体的偏好倾向。
- 发现偏见主要集中在模型最后三分之一层,干预后平均偏见分降0.28点。
- 仅增加0.82%困惑度,适合需保持性能的模型优化场景。
我们研究了大语言模型(LLMs)在面对模糊比较型提示时偏见产生的内部机制:这类提示要求在无明确偏好上下文的情况下比较或选择两个及以上实体。现有偏见缓解方法多为事后分析或数据增强,未能触及根本——模型自身。已有研究表明注意力模块会影响生成结果。我们认为分析注意力有助于理解模型如何分配关注,进而导致偏见。为此,我们提出一种量化模型偏好倾向的指标,并引入$ exttt{ATLAS}$(基于注意力的目标层分析与缩放)技术,通过分析注意力得分定位偏见所在层,并在这些层进行注意力缩放以降低偏见。我们在3个数据集(BBQ、Crows-Pairs、WinoGender)上使用$ exttt{GPT-2 XL}$(1.5B)、$ exttt{GPT-J}$(6B)、$ exttt{LLaMA-2}$(7B)和$ exttt{LLaMA-3}$(8B)进行实验。结果显示,偏见主要集中在后期层,通常位于最后三分之一。$ exttt{ATLAS}$通过针对性干预有效缓解偏见,且下游性能基本不受影响,平均困惑度仅上升0.82%,所有数据集平均偏见分下降0.28点。
原文摘要 · Abstract (English)
We explore the internal mechanisms of how bias emerges in large language models (LLMs) when provided with ambiguous comparative prompts: inputs that compare or enforce choosing between two or more entities without providing clear context for preference. Most approaches for bias mitigation focus on either post-hoc analysis or data augmentation. However, these are transient solutions, without addressing the root cause: the model itself. Numerous prior works show the influence of the attention module towards steering generations. We believe that analyzing attention is also crucial for understanding bias, as it provides insight into how the LLM distributes its focus across different entities and how this contributes to biased decisions. To this end, we first introduce a metric to quantify the LLM's preference for one entity over another. We then propose $\texttt{ATLAS}$ (Attention-based Targeted Layer Analysis and Scaling), a technique to localize bias to specific layers of the LLM by analyzing attention scores and then reduce bias by scaling attention in these biased layers. To evaluate our method, we conduct experiments across 3 datasets (BBQ, Crows-Pairs, and WinoGender) using $\texttt{GPT-2 XL}$ (1.5B), $\texttt{GPT-J}$ (6B), $\texttt{LLaMA-2}$ (7B) and $\texttt{LLaMA-3}$ (8B). Our experiments demonstrate that bias is concentrated in the later layers, typically around the last third. We also show how $\texttt{ATLAS}$ effectively mitigates bias through targeted interventions without compromising downstream performance and an average increase of only 0.82% in perplexity when the intervention is applied. We see an average improvement of 0.28 points in the bias score across all the datasets.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。