arXiv:2501.02018cs.CLcs.AI2025-01被引 6

用实时干预提升大模型安全,30%降低越狱攻击成功率。

Safeguarding Large Language Models in Real-time with Tunable Safety-Performance Trade-offs

  • 通过文本干预在生成时动态引导模型转向安全输出
  • 减少30%越狱攻击成功,推理延迟几乎为零
  • 支持灵活调节安全与性能平衡,适合部署场景

大型语言模型易受越狱攻击,即利用对抗性提示诱导模型产生高风险行为。此类攻击已被网络犯罪分子用于造成严重危害,凸显了保护广泛部署模型的紧迫性。现有防护方法如微调或自反思机制会增加推理延迟、降低输出语义流畅性并限制正常行为,但安全-性能权衡(SPT)问题尚未被充分研究。本文提出一种新防护机制 SafeNudge,结合可控文本生成与“助推”策略,在文本生成过程中检测越狱攻击并即时干预,可将成功攻击率降低30%,且对推理延迟影响极小,输出语义流畅性基本不受影响。此外,该方法支持可调的安全-性能权衡。SafeNudge 已开源,可通过 PyPI 获取,兼容 Hugging Face Transformers 库加载的模型。

原文摘要 · Abstract (English)

Large Language Models (LLMs) have been shown to be susceptible to jailbreak attacks, or adversarial attacks used to illicit high risk behavior from a model. Jailbreaks have been exploited by cybercriminals and blackhat actors to cause significant harm, highlighting the critical need to safeguard widely-deployed models. Safeguarding approaches, which include fine-tuning models or having LLMs "self-reflect", may lengthen the inference time of a model, incur a computational penalty, reduce the semantic fluency of an output, and restrict ``normal'' model behavior. Importantly, these Safety-Performance Trade-offs (SPTs) remain an understudied area. In this work, we introduce a novel safeguard, called SafeNudge, that combines Controlled Text Generation with "nudging", or using text interventions to change the behavior of a model. SafeNudge triggers during text-generation while a jailbreak attack is being executed, and can reduce successful jailbreak attempts by 30% by guiding the LLM towards a safe responses. It adds minimal latency to inference and has a negligible impact on the semantic fluency of outputs. Further, we allow for tunable SPTs. SafeNudge is open-source and available through https://pypi.org/, and is compatible with models loaded with the Hugging Face "transformers" library.

大模型安全越狱防御实时防护可控生成

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。