arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2607.01239cs.CLcs.AI
收藏

在Token边界打破安全:BPE分词如何在LLM对齐中制造可利用的漏洞

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

Palo Alto Networks

Tung-Ling Li, Hongliang Liu, Yuhao Wu

AI总结:

研究发现BPE分词将安全关键词拆分为子词,导致对齐数据集缺乏此类碎片化输入,通过优化碎片化可绕过80-100%的安全拒绝,并定位到模型最后约30%层。

摘要:

字符级扰动可以绕过现代大语言模型的安全对齐,同时保持提示对人类可读。我们识别并测试了一个核心结构机制:BPE分词将安全关键词拆分为子词片段,而我们调查的三个公开对齐数据集中不包含任何故意碎片化的输入。该机制是一条链,在五个模型家族(Qwen-3-4B、Qwen-2.5-7B、Gemma-3-4B、Llama-3.1-8B、Mistral-7B)上进行了端到端测试。针对安全token碎片化的优化在80-100%的被拒绝HarmBench提示上翻转了首token拒绝触发,其中48%的翻转产生了真正有害的输出(每个模型29-65%;差距与行为ROC-AUC 0.66-0.98,合并0.84)。激活修补将受干扰的信号定位到最后约30%的层;对齐数据扫描在30,000个示例中发现零个碎片化提示(攻击相关强度下阳性对照召回率≥99%);靶向突变实验将安全词隔离为干扰位点。在防御方面,一个68格网格(55个训练检查点)表明,在三个具有封闭池大小混淆的家族上,没有DPO配置实现种子和池稳定的ASR闭合。在碎片化提示上训练的SFT在3/5家族上闭合了ASR,但仅通过全局崩溃,这也提高了良性提示上的拒绝率,表明在我们测试的LoRA-16配方下,缺失的分布是必要但不充分的。为了区分选择性修复与全局崩溃,我们引入了Conv-Benign,一种候选配对诊断。所有ASR声明均经过3位评审员校准(格排名在评审员间稳定;绝对水平±18pp;见附录B.13)。

英文摘要:

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).

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

↑