arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2605.13043cs.CL
收藏

自适应转向与重掩码用于扩散语言模型中的安全生成

Adaptive Steering and Remasking for Safe Generation in Diffusion Language Models

Department of Computer Science(计算机科学系);Yonsei University(延世大学)

Yejin Lee, Ungsik Kim, Yo-Sub Han

AI总结:

本文提出基于去噪过程分步干预的安全防御框架,通过对比安全方向(SGD)检测有害生成并重掩码以提高安全性,实验显示有效降低逃逸成功率至0.64%。

摘要:

扩散语言模型(DLMs)通过迭代去噪和双向细化生成文本,提供了一种有前景的替代方案。然而,这种迭代生成范式也引入了独特的安全漏洞,当有害令牌在中间去噪步骤生成并传播到后续细化过程时,最终导致不安全输出。尽管已有几种尝试解决此问题的方法,但它们要么无法生成安全输出,要么生成安全但质量低的输出。为此,我们提出了一种基于去噪过程分步干预的推理时间防御框架,从而在不牺牲输出质量的情况下提高安全性。我们框架的核心组件是对比安全方向(SGD),它捕捉了有害生成与安全生成之间的语义边界。我们利用SGD在每个去噪步骤中评估生成令牌与有害语义的一致性。当检测到有害一致性时,我们的方法会重掩码相应令牌并重新开始去噪过程,其中转向强度根据估计的有害程度进行调节。作为即插即用模块,我们的方法无需额外微调即可直接集成到现成的扩散模型中。实验结果表明,我们的方法将逃逸成功率降低至0.64%,同时保持生成质量接近原始模型性能。这证实了分步干预在安全扩散语言模型生成中的有效性。我们的代码可在https://github.com/leeyejin1231/DLM_Steering_Remasking获取。

英文摘要:

Diffusion Language Models(DLMs) provide a promising alternative to autoregressive language models through iterative denoising and bidirectional generation. However, their iterative generation process introduces distinct safety vulnerabilities because harmful content can emerge at arbitrary positions and persist across subsequent denoising steps. Existing defenses rely on fixed interventions or aggressive remasking, which limits adaptive control over denoising trajectories and can degrade generation quality. We propose an inference-time defense framework that combines adaptive safety steering with safety-aware remasking. Our method uses a gating direction to continuously adjust steering strength from the current denoising state and applies a steering direction to masked positions to guide subsequent predictions toward safer trajectories. Our method further employs a lightweight response detector after the first generation block to identify unsafe trajectories at an early stage. The detector triggers targeted remasking over generated content and part of the conditioning prompt, and the model regenerates the selected positions under adaptive safety steering. This design combines continuous trajectory control with explicit correction of unsafe content while requiring no modification of model parameters. Experiments on LLaDA and Dream demonstrate that our method improves robustness against diverse jailbreak attacks while preserving benign generation quality and general model capability. Our code is available at https://anonymous.4open.science/r/DLM_Steering-C32B/.

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

↑