arXiv:2607.01239cs.CLcs.AI2026-07

BPE分词漏洞让大模型安全机制失效,微小字符扰动即可绕过审查

Breaking Safety at the Token Boundary: How BPE Tokenization Creates Exploitable Gaps in LLM Alignment

  • 利用BPE分词断裂安全词,制造可被攻击的语义空隙
  • 80%-100%拒绝提示被反转,48%生成真实有害内容
  • 适合研究模型安全、对抗攻击或对齐机制的读者

字符级扰动可在保持提示人类可读的前提下绕过现代大模型的安全对齐。我们识别并验证了一个核心结构性机制:BPE分词将安全关键词汇拆分为子词片段,而三个公开对齐数据集均未包含有意碎片化的输入。该机制经端到端测试,覆盖五个模型家族(Qwen-3-4B、Qwen-2.5-7B、Gemma-3-4B、Llama-3.1-8B、Mistral-7B)。针对安全词碎片化的优化,使HarmBench中80%-100%的拒绝提示首次触发成功,其中48%产生真正有害输出(各模型29%-65%;差距与行为的ROC-AUC为0.66-0.98,合并为0.84)。激活修补定位破坏信号集中在最后约30%层;对齐数据扫描发现3万样本中无碎片化提示(正控召回率≥99%于攻击强度);定向突变实验确定安全词为干扰焦点。防御方面,68单元网格(55个训练检查点)显示,无DPO配置能在封闭池大小混淆下稳定关闭攻击成功率(ASR)。SFT在碎片化提示上训练可关闭3/5家族的ASR,但仅通过全局崩溃实现,同时提升良性提示拒绝率,表明缺失分布是必要但非充分条件(基于我们测试的LoRA-16方案)。为区分选择性修复与全局崩溃,引入Conv-Benign作为候选配对诊断。所有ASR结果经三评委校准(单元排名跨评委稳定;绝对水平±18个百分点;见附录B.13)。

原文摘要 · Abstract (English)

Character-level perturbations bypass safety alignment in modern LLMs despite leaving prompts human-readable. We identify and test a central structural mechanism: BPE tokenization fragments safety-critical words into sub-word pieces, and the three public alignment datasets we surveyed contain no intentionally fragmented inputs. The mechanism is a chain, tested end-to-end on five model families (Qwen-3-4B, Qwen-2.5-7B, Gemma-3-4B, Llama-3.1-8B, Mistral-7B). An optimization targeting safety-token fragmentation flips the first-token refusal trigger on 80-100% of refused HarmBench prompts, with 48% of those flips producing genuinely harmful outputs (per-model 29-65%; gap-vs-behavior ROC-AUC 0.66-0.98, pooled 0.84). Activation patching localizes the disrupted signal to the last ${\sim}30\%$ of layers; an alignment-data scan finds zero fragmented prompts among 30,000 examples (positive-control recall $\geq 99\%$ at attack-relevant intensities); and targeted-mutation experiments isolate safety words as the disruption locus. On the defense side, a 68-cell grid (55 trained checkpoints) shows that no DPO configuration achieves seed- and pool-stable ASR closure on the three families with closed pool-size confounds. SFT trained on fragmented prompts closes ASR on 3/5 families but only via global collapse that raises refusal on benign prompts as well, indicating the missing distribution is necessary but not sufficient under the LoRA-16 recipe we tested. To distinguish selective repair from global collapse, we introduce Conv-Benign, a candidate paired diagnostic. All ASR claims are 3-judge-calibrated (cell rankings stable across judges; absolute levels $\pm$18pp; see App.~B.13).

模型安全对抗攻击BPE分词对齐漏洞

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