通过动态调整解码参数,让大模型在运行时自我变化,抵御越狱攻击。
DYNASHIELD: A Black-Box Moving Target Defense for LLMs via Dynamic Decoding Customization
- 运行时动态调整解码配置和系统提示,制造行为不确定性。
- 在7个开源模型上降低越狱攻击成功率,效果优于7种基线防御。
- 无需模型内部访问或重训练,适合黑盒服务部署场景。
大型语言模型(LLMs)仍易受越狱攻击影响,攻击者通过恶意提示诱导有害输出。现有防御方法常需模型内部访问或额外训练,限制了其在黑盒API服务中的应用。本文提出DYNASHIELD,一种移动目标防御框架,通过推理时定制解码超参数和系统提示来提升鲁棒性。该框架包含两个关键步骤:(1) 识别能降低攻击成功率的解码配置;(2) 从加权配置池中概率采样,引入可控的行为变异性。我们在4种前沿越狱攻击下,对7个开源LLM进行评估,使用AdvBench中的对抗提示。结果表明,相较于7种基线防御,攻击成功率显著下降,同时保持响应质量且推理开销极低。由于DYNASHIELD仅依赖暴露的运行时控制,无需重训练或模型内部访问,表明面向安全的动态解码是黑盒部署中一种有前景且轻量级的防御机制。
原文摘要 · Abstract (English)
Large language models (LLMs) remain vulnerable to jailbreak attacks in which adversarial prompts induce harmful outputs. Existing defenses often require access to the model internals or additional training, limiting their applicability for service providers deployed through black-box APIs. In this paper, we propose DYNASHIELD, a moving target defense framework that improves robustness by customizing decoding hyperparameters and system prompts at inference time. DYNASHIELD includes two key steps: (1) it identifies decoding configurations that reduce attack success probability, and (2) it probabilistically samples from a weighted configuration pool to introduce controlled variability in model behavior. We evaluate DYNASHIELD across 7 open-source LLMs under 4 state-of-the-art jailbreak attacks, using adversarial prompts from AdvBench. Results show substantial reductions in attack success rate compared with 7 baseline defenses, while maintaining response quality and incurring minimal inference overhead. Because DYNASHIELD operates solely through exposed runtime controls, it requires no retraining or model-internal access. These results suggest that safety-aware dynamic decoding is a promising and practically lightweight defense mechanism for black-box LLM deployments.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。