arXiv:2506.07452cs.LGcs.AI2025-06中稿 · ICLR被引 8

风格伪装会削弱大模型安全,新方法可有效防御。

When Style Breaks Safety: Defending LLMs Against Superficial Style Alignment

  • 发现风格模式会无意识提升越狱成功率,与注意力机制相关。
  • 用特定风格微调模型后,越狱攻击成功率平均上升40%以上。
  • 提出SafeStyle防御策略,兼容多种风格微调场景。

大型语言模型(LLMs)可能被诱导以特定风格(如列表格式)响应,包括恶意查询。现有越狱研究主要通过字符串变换增强攻击成功率(ASR),但原始查询中的风格模式是否影响安全性尚不明确。本文定义了‘ASR膨胀’——由风格模式引起的攻击成功率上升。在7个基准上评估36个模型,发现几乎所有模型均出现ASR膨胀,且其程度与模型对风格模式的关注度相关,且该关注点与指令微调数据重叠度更高。进一步研究发现,使用特定风格进行微调会使模型对同风格越狱更脆弱。为此提出SafeStyle防御策略:在少量安全训练数据中引入与微调数据分布一致的风格模式。在3个模型、6种风格微调设置及2个真实指令微调数据集上,SafeStyle均显著优于基线。

原文摘要 · Abstract (English)

Large language models (LLMs) can be prompted with specific styles (e.g., formatting responses as lists), including in malicious queries. Prior jailbreak research mainly augments these queries with additional string transformations to maximize attack success rate (ASR). However, the impact of style patterns in the original queries that are semantically irrelevant to the malicious intent remains unclear. In this work, we seek to understand whether style patterns compromise LLM safety, how superficial style alignment increases model vulnerability, and how best to mitigate these risks during alignment. We first define ASR inflation as the increase in ASR due to style patterns in existing jailbreak benchmark queries. By evaluating 36 LLMs across seven benchmarks, we find that nearly all models exhibit ASR inflation. Notably, the inflation correlates with an LLM's relative attention to style patterns, which also overlap more with its instruction-tuning data when inflation occurs. We then investigate superficial style alignment, and find that fine-tuning with specific styles makes LLMs more vulnerable to jailbreaks of those same styles. Finally, we propose SafeStyle, a defense strategy that incorporates a small amount of safety training data augmented to match the distribution of style patterns in the fine-tuning data. Across three LLMs, six fine-tuning style settings, and two real-world instruction-tuning datasets, SafeStyle consistently outperforms baselines in maintaining LLM safety.

大模型安全越狱攻击风格对齐防御策略

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