arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2410.03818cs.LGcs.AIcs.CL
收藏

大语言模型可成为强大的自我解毒器

Large Language Models can be Strong Self-Detoxifiers

IBM Research(IBM研究院);MIT(麻省理工学院)

Ching-Yun Ko, Pin-Yu Chen, Payel Das, Youssef Mroueh, Soham Dan, Georgios Kollias, Subhajit Chaudhury, Tejaswini Pedapati, Luca Daniel

AI总结:

该研究提出轻量级受控解码算法SASA,无需额外奖励模型或重训练,仅利用大语言模型内部表示即可引导生成远离有毒子空间,在多模型多基准上实现了与现有最优技术相当的解毒效果。

摘要:

降低生成有害有毒输出的概率是大语言模型(LLM)对齐中的一项关键任务。现有方法主要依赖训练外部奖励模型(即另一个语言模型),或使用自生成数据微调LLM来影响生成结果。本文中我们证明,无需额外奖励模型或重新训练,LLM本身就具备自我解毒能力。我们提出了Self-disciplined Autoregressive Sampling(SASA,自律自回归采样),这是一种用于降低LLM毒性的轻量级受控解码算法。SASA利用LLM的上下文表示,以解析形式学习表征有毒与无毒输出的线性子空间。在逐token自动补全响应时,SASA通过调整自回归采样策略,动态跟踪当前输出的边界,引导生成过程远离有毒子空间。我们在不同规模和类型的LLM上开展评估,包括Llama-3.1-Instruct(8B)、Llama-2(7B)和GPT2-L模型,采用RealToxicityPrompts、BOLD和AttaQ基准测试。结果显示,相较于原始模型,SASA显著提升了生成句子的质量,性能与最先进的解毒技术相当,仅利用LLM的内部表示就大幅降低了毒性水平。

英文摘要:

Reducing the likelihood of generating harmful and toxic output is an essential task when aligning large language models (LLMs). Existing methods mainly rely on training an external reward model (i.e., another language model) or fine-tuning the LLM using self-generated data to influence the outcome. In this paper, we show that LLMs have the capability of self-detoxification without the use of an additional reward model or re-training. We propose \textit{Self-disciplined Autoregressive Sampling (SASA)}, a lightweight controlled decoding algorithm for toxicity reduction of LLMs. SASA leverages the contextual representations from an LLM to learn linear subspaces characterizing toxic v.s. non-toxic output in analytical forms. When auto-completing a response token-by-token, SASA dynamically tracks the margin of the current output to steer the generation away from the toxic subspace, by adjusting the autoregressive sampling strategy. Evaluated on LLMs of different scale and nature, namely Llama-3.1-Instruct (8B), Llama-2 (7B), and GPT2-L models with the RealToxicityPrompts, BOLD, and AttaQ benchmarks, SASA markedly enhances the quality of the generated sentences relative to the original models and attains comparable performance to state-of-the-art detoxification techniques, significantly reducing the toxicity level by only using the LLM's internal representations.

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

↑