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

仅用少量上下文示例即可越狱和对齐语言模型

Jailbreak and Guard Aligned Language Models with Only Few In-Context Demonstrations

Peking University(北京大学);MIT(麻省理工学院)

Zeming Wei, Yifei Wang, Ang Li, Yichuan Mo, Yisen Wang

AI总结:

本文提出上下文攻击(ICA)和上下文防御(ICD),利用少量上下文示例分别提升和降低越狱提示成功率,并给出理论见解,揭示ICL对LLM安全对齐的深远影响。

摘要:

大型语言模型(LLMs)在各种任务中表现出显著成功,但其安全性和生成有害内容的风险仍然是紧迫的问题。在本文中,我们深入探讨了上下文学习(ICL)在调节LLMs对齐方面的潜力。具体来说,我们提出了上下文攻击(ICA),它利用有害示例来颠覆LLMs,以及上下文防御(ICD),它通过展示拒绝生成有害响应的示例来增强模型的韧性。我们提供了理论见解,以阐明有限的上下文示例如何关键性地影响LLMs的安全对齐。通过大量实验,我们证明了ICA和ICD在分别提升和降低越狱提示成功率方面的有效性。我们的发现阐明了ICL对LLM行为的深远影响,为改进LLMs的安全性开辟了新途径。

英文摘要:

Large Language Models (LLMs) have shown remarkable success in various tasks, yet their safety and the risk of generating harmful content remain pressing concerns. In this paper, we delve into the potential of In-Context Learning (ICL) to modulate the alignment of LLMs. Specifically, we propose the In-Context Attack (ICA) which employs harmful demonstrations to subvert LLMs, and the In-Context Defense (ICD) which bolsters model resilience through examples that demonstrate refusal to produce harmful responses. We offer theoretical insights to elucidate how a limited set of in-context demonstrations can pivotally influence the safety alignment of LLMs. Through extensive experiments, we demonstrate the efficacy of ICA and ICD in respectively elevating and mitigating the success rates of jailbreaking prompts. Our findings illuminate the profound influence of ICL on LLM behavior, opening new avenues for improving the safety of LLMs.

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

↑