[论文解读] Interpreting Bias in Large Language Models: A Feature-Based Approach
本文提出了一种基于特征的可解释性框架,用于分析和缓解大型语言模型(LLMs)如 LLaMA-2-7B、LLaMA-3-8B 和 Mistral-7B-v0.3 中的性别偏见。通过假设偏见相关特征在模型各层中的演化过程,并利用激活修补和归因修补进行验证,作者识别出负责偏见传播的具体 MLP 和注意力头,通过反事实微调实现针对性去偏,显著降低偏见输出,同时保持整体性能不受损害。
Large Language Models (LLMs) such as Mistral and LLaMA have showcased remarkable performance across various natural language processing (NLP) tasks. Despite their success, these models inherit social biases from the diverse datasets on which they are trained. This paper investigates the propagation of biases within LLMs through a novel feature-based analytical approach. Drawing inspiration from causal mediation analysis, we hypothesize the evolution of bias-related features and validate them using interpretability techniques like activation and attribution patching. Our contributions are threefold: (1) We introduce and empirically validate a feature-based method for bias analysis in LLMs, applied to LLaMA-2-7B, LLaMA-3-8B, and Mistral-7B-v0.3 with templates from a professions dataset. (2) We extend our method to another form of gender bias, demonstrating its generalizability. (3) We differentiate the roles of MLPs and attention heads in bias propagation and implement targeted debiasing using a counterfactual dataset. Our findings reveal the complex nature of bias in LLMs and emphasize the necessity for tailored debiasing strategies, offering a deeper understanding of bias mechanisms and pathways for effective mitigation.
研究动机与目标
- 开发一种基于特征的方法,以解释偏见在 LLM 中的传播机制,超越传统的组件分析方法。
- 验证特定模型组件(尤其是 MLP 和注意力头)在生成和复制性别偏见中的作用。
- 通过仅对识别出的组件使用反事实数据集进行微调,证明针对性去偏的有效性。
- 将该方法扩展至不同形式的性别偏见和句子结构,证明其在各种上下文中的泛化能力。
- 提供一种白盒、可解释的框架,用于识别大规模 LLM 中偏见的来源和传播路径。
提出的方法
- 作者将抽象的偏见相关特征(例如 'male'、'female'、'wife')定义为在模型各层中演化的潜在概念,形成从输入到输出的 '特征图'。
- 采用受因果中介启发的假设,映射诸如 'woman' 和 'wife' 等特征如何从 'Washing the dishes is the duty of the' 等输入提示中产生。
- 应用激活修补技术,通过替换参考输入的激活值,隔离特定层和组件(如 MLP、注意力头)的贡献。
- 使用归因修补识别出复制或放大偏见特征的注意力头,并以 logit 反转作为验证信号。
- 仅对识别出的组件(如特定 MLP 和注意力头)应用反事实微调,以减少偏见,同时保持模型性能。
- 该方法在三个最先进的 LLM 上得到验证:LLaMA-2-7B、LLaMA-3-8B 和 Mistral-7B-v0.3,使用来自职业数据集的模板。

实验结果
研究问题
- RQ1哪些特定的模型组件(MLP 或注意力头)负责生成或放大 LLM 中的性别偏见?
- RQ2偏见相关特征(如 'wife' 或 'man')如何在基于 Transformer 的 LLM 各层中演化?
- RQ3通过在识别出的组件上进行反事实微调实现的针对性去偏,能否有效降低偏见输出而不损害性能?
- RQ4所提出的基于特征的方法是否能泛化到原始职业数据集之外的其他形式性别偏见?
- RQ5注意力头在多大程度上复制或传播偏见特征?能否通过归因修补实现其量化测量?
主要发现
- 特征图分析显示,'wife' 特征主要源自 'woman' 特征与语法结构的结合,最终抽象发生在最后一个 token 的 MLP 中。
- 在第 4 至 15 层之间修补最后一个 token 的 MLP 激活值,使 'wife' 出现在 top 10 输出中,证实其在特征推导中的关键作用。
- 从 'dishes' token 复制的注意力头(特别是 k=100 且最多到第 20 层)显著贡献于偏见传播,修补后 logit 反转结果证实了这一点。
- 通过在识别出的组件上应用反事实微调实现的针对性去偏,降低了在刻板印象语境下 'woman' 和 'wife' 的生成概率,表明去偏效果显著。
- 该方法通过成功分析和减少原始数据集之外不同句子结构和性别偏见形式中的偏见,展示了其泛化能力。
- 在机制可解释性中观察到潜在的补偿效应,部分注意力头可能接管被修补头的功能,提示需在去偏模型中进一步验证。

更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。