arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2505.14536cs.CL
收藏

打破不良令牌:使用稀疏自编码器对大型语言模型进行去毒化

Breaking Bad Tokens: Detoxification of LLMs Using Sparse Autoencoders

Siebel School of Computing and Data Science(计算机与数据科学学院)

Agam Goyal, Vedant Rathi, William Yeh, Yian Wang, Yuen Chen, Hari Sundaram

AI总结:

本文利用稀疏自编码器识别并引导LLM残差流中的毒性方向,在GPT-2 Small和Gemma-2-2B上实现最多20%的毒性降低,同时保持基准性能,并揭示特征分裂对安全干预的阻碍。

摘要:

大型语言模型(LLMs)如今在面向用户的应用程序中无处不在,但它们仍会生成不良的有毒输出,包括脏话、粗俗语言和贬损性言论。尽管存在许多去毒化方法,但大多数方法应用的是宽泛的、表面层面的修复,因此容易被越狱攻击轻易绕过。在本文中,我们利用稀疏自编码器(SAEs)识别模型残差流中与毒性相关的方向,并使用相应的解码器向量进行有针对性的激活引导。我们引入了三个级别的引导强度,并在GPT-2 Small和Gemma-2-2B上进行了评估,揭示了毒性降低与语言流畅性之间的权衡。在更强的引导强度下,这些因果干预在降低毒性方面超越了竞争性基线,最多可降低20%,但根据攻击性的不同,GPT-2 Small上的流畅性可能会明显下降。至关重要的是,引导后的标准NLP基准分数保持稳定,表明模型的知识和通用能力得以保留。我们进一步表明,更宽的SAE中的特征分裂会阻碍安全干预,强调了去纠缠特征学习的重要性。我们的研究结果突显了基于SAE的因果干预在LLM去毒化中的前景和当前局限性,并进一步为更安全的语言模型部署提供了实用指南。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑