用稀疏自编码器精准识别并抑制大模型中的毒性特征。
Breaking Bad Tokens: Detoxification of LLMs Using Sparse Autoencoders
- 通过稀疏自编码器定位模型残差流中的毒性方向,定向调节激活。
- 毒性降低最高达20%,且在标准评测中语言能力保持稳定。
- 适合关注模型安全、需精细化干预的AI研发人员参考。
大语言模型在实际应用中仍会产生不当内容,如脏话、冒犯性言论等。现有方法多为粗粒度修复,易被越狱攻击绕过。本文利用稀疏自编码器(SAEs)识别模型残差流中的毒性相关方向,并通过对应解码器向量实施针对性激活调控。提出三种不同强度的调控策略,在GPT-2 Small和Gemma-2-2B上评估,发现强调控下毒性可降低最多20%,但可能影响语言流畅性,尤其在GPT-2 Small上明显。值得注意的是,标准NLP基准分数在调控后保持稳定,表明模型知识与通用能力未受损。此外,更宽的SAE中特征分裂会削弱安全干预效果,凸显解耦特征学习的重要性。研究揭示了基于SAE因果干预在模型去毒上的潜力与局限,为更安全的模型部署提供实践指导。
原文摘要 · Abstract (English)
Large language models (LLMs) are now ubiquitous in user-facing applications, yet they still generate undesirable toxic outputs, including profanity, vulgarity, and derogatory remarks. Although numerous detoxification methods exist, most apply broad, surface-level fixes and can therefore easily be circumvented by jailbreak attacks. In this paper we leverage sparse autoencoders (SAEs) to identify toxicity-related directions in the residual stream of models and perform targeted activation steering using the corresponding decoder vectors. We introduce three tiers of steering aggressiveness and evaluate them on GPT-2 Small and Gemma-2-2B, revealing trade-offs between toxicity reduction and language fluency. At stronger steering strengths, these causal interventions surpass competitive baselines in reducing toxicity by up to 20%, though fluency can degrade noticeably on GPT-2 Small depending on the aggressiveness. Crucially, standard NLP benchmark scores upon steering remain stable, indicating that the model's knowledge and general abilities are preserved. We further show that feature-splitting in wider SAEs hampers safety interventions, underscoring the importance of disentangled feature learning. Our findings highlight both the promise and the current limitations of SAE-based causal interventions for LLM detoxification, further suggesting practical guidelines for safer language-model deployment.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。