发现并利用注意力头实现可解释的个性化生成
Preference Heads in Large Language Models: A Mechanistic Framework for Interpretable Personalization

- 通过因果掩码分析定位编码用户偏好的稀疏注意力头
- 推理时仅用少量计算即可提升个性化程度,保持内容连贯
- 适合想理解或控制大模型个性化的研究人员和开发者
大型语言模型具备强大的隐式个性化能力,但现有方法多将其视为黑箱,依赖提示工程或用户数据微调。本文从机制可解释性视角出发,假设存在一组稀疏的偏好注意力头(Preference Heads),它们编码用户的风格与主题偏好,并对生成结果产生因果影响。我们提出无需训练的差分偏好引导(DPS)框架:首先通过因果掩码分析识别偏好头,再在推理阶段对比启用与禁用这些头时的输出差异,放大个性化与通用性之间的逻辑差异,从而选择性强化符合用户偏好的延续。DPS为每个注意力头计算偏好贡献度(PCS),直接衡量其对用户对齐输出的因果影响。在多个主流个性化基准上,不同模型均显示个性化保真度显著提升,同时保持内容连贯性和低计算开销。DPS不仅带来性能提升,还揭示了个性化在变压器架构中的具体位置与作用机制。代码已公开。
原文摘要 · Abstract (English)
Large Language Models (LLMs) exhibit strong implicit personalization ability, yet most existing approaches treat this behavior as a black box, relying on prompt engineering or fine tuning on user data. In this work, we adopt a mechanistic interpretability perspective and hypothesize the existence of a sparse set of Preference Heads, attention heads that encode user specific stylistic and topical preferences and exert a causal influence on generation. We introduce Differential Preference Steering (DPS), a training free framework that (1) identifies Preference Heads through causal masking analysis and (2) leverages them for controllable and interpretable personalization at inference time. DPS computes a Preference Contribution Score (PCS) for each attention head, directly measuring its causal impact on user aligned outputs. During decoding, we contrast model predictions with and without Preference Heads, amplifying the difference between personalized and generic logits to selectively strengthen preference aligned continuations. Experiments on widely used personalization benchmarks across multiple LLMs demonstrate consistent gains in personalization fidelity while preserving content coherence and low computational overhead. Beyond empirical improvements, DPS provides a mechanistic explanation of where and how personalization emerges within transformer architectures. Our implementation is publicly available.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。