arXiv:2503.16851cs.CRcs.CL2025-03被引 4

通过稀疏表示分解,实现对大模型行为的精准可解释控制。

Interpretable LLM Guardrails via Sparse Representation Steering

  • 用预训练稀疏自编码器将激活向量解耦为语义清晰的稀疏特征空间。
  • 通过双向KL散度定位与目标属性相关的特征维度,实现细粒度控制。
  • 在安全、公平、真实三方面表现优于现有方法,且保持语言质量。

大型语言模型在生成任务中表现出色,但容易产生有害、误导或偏见内容,带来重大伦理与安全风险。为缓解此类问题,表示工程通过在推理时注入精心设计的引导向量来调整模型行为,成为微调之外的有前景方案。然而,由于大模型内部表示具有语义纠缠性,现有方法仍存在控制粒度不足、内容质量下降及多属性冲突等问题。为此,本文提出稀疏表示引导(SRS)框架,通过预训练稀疏自编码器(SAE)将密集纠缠的激活模式转换为稀疏且语义明确的特征空间,并基于正负提示对的稀疏激活对比,利用双向KL散度识别与目标属性最相关的特征维度。我们在Gemma-2系列模型上针对安全性、公平性和真实性三个对齐维度进行了全面实验。结果表明,SRS在单属性与多属性设置下均显著优于现有引导方法,实现更精细可控的同时,保持高语言质量和通用能力。

原文摘要 · Abstract (English)

Large language models (LLMs) exhibit impressive capabilities in generation tasks but are prone to producing harmful, misleading, or biased content, posing significant ethical and safety concerns. To mitigate such risks, representation engineering, which steer model behavior toward desired attributes by injecting carefully designed steering vectors into LLM's representations at inference time, has emerged as a promising alternative to fine-tuning approaches. However, due to the semantically entangled nature of LLM's representation, existing representation engineering methods still suffer from several limitations: limited fine-grained controllability, content quality degradation, and conflict in multi-attribute control. To overcome these challenges, we propose Sparse Representation Steering (SRS), a novel framework that achieves fine-grained and interpretable control over LLM behavior by first disentangling internal activations into a sparse, semantically meaningful representation space, and then selectively steering relevant dimensions. Specifically, SRS leverages a pretrained Sparse Autoencoder (SAE) to transform dense, entangled activation patterns into a sparse monosemantic feature space. To identify relevant features, SRS contrasts sparse activations from positive and negative prompt pairs and measures their bidirectional KL divergence to locate dimensions most associated with the target attribute. We conduct comprehensive experiments on Gemma-2 series model across three alignment dimensions, i.e., safety, fairness, and truthfulness, to evaluate the effectiveness of SRS. Results show that SRS consistently outperforms existing steering methods, which achieves significantly improved controllability across both single and multiple attribute settings, while preserving high linguistic quality and general ability.

大模型安全表示工程稀疏编码

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。