A Mechanistic Understanding of Alignment Algorithms: A Case Study on DPO and Toxicity

2024年01月03日
虽然现在常常使用对齐算法来调整预训练的语言模型以符合用户的偏好,但我们缺乏解释模型如何变得“对齐”的基本机制,因此难以解释像越狱等现象。在这项工作中,我们研究了一种流行的算法——直接偏好优化(DPO),以及它减少毒性的机制。具体而言,我们首先研究了毒性如何在预训练语言模型GPT2-medium中被表示和引出。然后,我们使用一个精心制作的成对数据集应用DPO来减少毒性。我们研究了由此产生的模型如何避免产生有毒输出,并发现从预训练中学到的能力并未被消除,而是被绕过。我们利用这一观点演示了一种简单的方法来取消模型的对齐,将其恢复到有毒的行为。
While alignment algorithms are now commonly used to tune pre-trained language models towards a user's preferences, we lack explanations for the underlying mechanisms in which models become ``aligned'', thus making it difficult to explain phenomena like jailbreaks. In this work we study a popular algorithm, direct preference optimization (DPO), and the mechanisms by which it reduces toxicity. Namely, we first study how toxicity is represented and elicited in a pre-trained language model, GPT2-medium. We then apply DPO with a carefully crafted pairwise dataset to reduce toxicity. We examine how the resulting model averts toxic outputs, and find that capabilities learned from pre-training are not removed, but rather bypassed. We use this insight to demonstrate a simple method to un-align the model, reverting it back to its toxic behavior.
许愿