Token Highlighter:检查和缓解大型语言模型的越狱提示
Token Highlighter: Inspecting and Mitigating Jailbreak Prompts for Large Language Models
AI总结:
本文提出Token Highlighter方法,通过Affirmation Loss梯度定位越狱关键token并利用Soft Removal技术缩小其嵌入,有效防御LLM越狱攻击同时保持良性性能,且仅需一次查询即可提供可解释防御。
摘要:
大型语言模型(LLM)正越来越多地被集成到ChatGPT等服务中,以响应用户查询。为了减轻潜在危害并防止滥用,人们通过在LLM训练中引入人类反馈强化学习(RLHF)等各种技术,致力于使LLM与人类价值观和法律合规保持一致。然而,最近的研究表明,即使是经过对齐的LLM也容易受到被称为越狱攻击的对抗性操纵。为了应对这一挑战,本文提出了一种名为Token Highlighter的方法,用于检查和缓解用户查询中潜在的越狱威胁。Token Highlighter引入了一个称为Affirmation Loss的概念,以衡量LLM回答用户查询的意愿。然后,它利用用户查询中每个token的Affirmation Loss梯度来定位越狱关键token。此外,Token Highlighter利用我们提出的Soft Removal技术,通过缩小关键token的token嵌入来缓解其越狱效应。在两个对齐的LLM(LLaMA-2和Vicuna-V1.5)上的实验结果表明,所提方法能有效防御多种越狱攻击,同时在AlpacaEval基准的良性问题上保持良好性能。此外,Token Highlighter是一种经济高效且可解释的防御方法,因为它只需查询受保护的LLM一次即可计算Affirmation Loss,并能在拒绝时高亮显示关键token。
英文摘要:
Large Language Models (LLMs) are increasingly being integrated into services such as ChatGPT to provide responses to user queries. To mitigate potential harm and prevent misuse, there have been concerted efforts to align the LLMs with human values and legal compliance by incorporating various techniques, such as Reinforcement Learning from Human Feedback (RLHF), into the training of the LLMs. However, recent research has exposed that even aligned LLMs are susceptible to adversarial manipulations known as Jailbreak Attacks. To address this challenge, this paper proposes a method called Token Highlighter to inspect and mitigate the potential jailbreak threats in the user query. Token Highlighter introduced a concept called Affirmation Loss to measure the LLM's willingness to answer the user query. It then uses the gradient of Affirmation Loss for each token in the user query to locate the jailbreak-critical tokens. Further, Token Highlighter exploits our proposed Soft Removal technique to mitigate the jailbreak effects of critical tokens via shrinking their token embeddings. Experimental results on two aligned LLMs (LLaMA-2 and Vicuna-V1.5) demonstrate that the proposed method can effectively defend against a variety of Jailbreak Attacks while maintaining competent performance on benign questions of the AlpacaEval benchmark. In addition, Token Highlighter is a cost-effective and interpretable defense because it only needs to query the protected LLM once to compute the Affirmation Loss and can highlight the critical tokens upon refusal.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。