arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2502.16366cs.CLcs.AIcs.CRcs.LG
收藏

一种利用红旗令牌缓解LLM危害性的生成式方法

A Generative Approach to LLM Harmfulness Mitigation with Red Flag Tokens

Université de Montréal(蒙特利尔大学);Mila(Mila研究所);Technical University of Munich(慕尼黑技术大学);Canada CIFAR AI Chair(加拿大CIFAR人工智能主席)

David Dobre, Mehrnaz Mofakhami, Sophie Xhonneux, Leo Schwinn, Gauthier Gidel

AI总结:

提出在LLM词汇表中添加红旗令牌并在生成有害内容时插入,使模型学习有害性概念,通过上下文学习实现反思性推理和自我纠正,与现有安全方法正交互补。

摘要:

许多针对大型语言模型(LLM)的安全后训练方法旨在将模型的行为从产生不安全答案转变为发出拒绝。然而,这种分布偏移往往很脆弱,并且会降低在理想任务上的性能。为了解决这些问题,我们提出在模型的词汇表中增加一个特殊的红旗令牌,并训练模型在生成有害内容或即将生成有害内容时插入该令牌。这种方法使模型能够在其表示中显式学习有害性的概念,同时由于自然语言生成分布的边际变化极小,对实用性的影响也最小。此外,由于该令牌嵌入在模型的词汇表中,我们可以自然地利用LLM的泛化能力,例如上下文学习(ICL)和对于未正式支持的语言(例如Llama3的日语)的分布外泛化。特别地,我们证明仅通过ICL,模型就能学会在推理时生成红旗令牌后启动反思性推理,这会将响应从有害延续中引导开,或在令牌被错误触发时实现自我纠正。这种方法与现有的安全技术(如安全分类器或标准安全训练)正交且互补,并且与自然语言拒绝相比更容易评估,因为它不需要人工或自动评判者来评估答案的无害性。

英文摘要:

Many safety post-training methods for large language models (LLMs) are designed to modify the model's behaviour from producing unsafe answers to issuing refusals. However, such distribution shifts are often brittle and degrade performance on desirable tasks. To address these pitfalls, we propose augmenting the model's vocabulary with a special red flag token, and training the model to insert this token whenever harmful content is generated or imminent. This approach enables the model to explicitly learn the concept of harmfulness in its representations, with minimal impact on utility due to the marginal change in the generated distribution of natural language. Moreover, because the token is embedded in the model's vocabulary, we can naturally leverage the LLMs' generalization capabilities, such as in-context learning (ICL) and out-of-distribution generalization to languages that are not formally supported (e.g., Japanese for Llama3). In particular, we demonstrate that through ICL alone, the model can learn to initiate reflective reasoning upon generating the red flag token at inference, which steers the response away from harmful continuations or enables self-correction when the flag is raised falsely. This approach is orthogonal and complementary to existing safety technique (such as safety classifiers or standard safety training) and easier to evaluate in comparison to natural language refusals, as it does not require a human or automated judge to assess the harmlessness of the answers.

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

↑