arXiv:2608.21500cs.CRcs.AI2026-08

通过逐标记反馈提升模型抗自适应提示注入能力

SecOPD: Mitigating Adaptive Prompt Injections by On-Policy Distillation

  • 采用令牌级反馈替代序列级信号,精准定位不安全输出
  • 在顶级攻击下将成功率从94%降至9%,工具调用场景也显著提升
  • 适用于需要高安全性智能体的生产环境,尤其关注防御鲁棒性

提示注入被列为对智能体的首要威胁。当智能体访问网页、文件或邮件等外部数据时,攻击者可能在其中注入指令,如‘忽略所有先前指令并执行<攻击任务>’。现有防御方法虽尝试训练安全大模型,但面对自适应提示注入仍面临接近100%的攻击成功率(ASR)。我们发现,这是因为现有微调方法依赖于序列级反馈信号(如DPO或GRPO),无法精确识别不安全的输出令牌。本文提出安全在线策略蒸馏(SecOPD),提供令牌级反馈以指导防御微调。模型接收注入样本并生成输出序列,由初始模型基于对应干净输入对每个令牌进行评分。借助更细粒度的训练信号,所防御的Qwen3.6-27B在面对最先进攻击PISmith时,攻击成功率为9.0%,远低于此前最先进方法Meta-SecAlign的94.0%。该安全性能在训练未见的领域中依然有效:在代理工具调用场景下,SecOPD达到4.7%的ASR,优于Meta-SecAlign的5.5%。代码与模型已开源。

原文摘要 · Abstract (English)

Prompt injection is listed as the \#1 threat to AI agents. When an agent accesses external data from websites, files, or emails, an attacker may inject a prompt into the data, saying, "Ignore all prior instructions and perform <an attacker's task>." To prevent arbitrary manipulation of agents, defenders try to train secure LLMs, which, however, still suffer from near 100% attack success rates (ASRs) against adaptive prompt injections. We note that this is because existing defensive finetuning recipes rely on sequence-level feedback signals (in DPO or GRPO). Treating an entire output equally prevents the model from learning precisely which output tokens are insecure. In this paper, we propose Secure On-Policy Distillation (SecOPD) that provides token-level feedback to guide defensive fine-tuning. The LLM receives an injected sample and produces a rollout, whose tokens are scored by the initialization model given the corresponding clean input. With more fine-grained training signals, our defended Qwen3.6-27B achieves a 9.0% ASR against the SoTA PISmith adaptive prompt injections, compared to 94.0% for the prior SoTA, Meta-SecAlign. The obtained security generalizes to domains completely unseen in training: in agentic tool calling, SecOPD achieves a 4.7% ASR compared to 5.5% for Meta-SecAlign. Code and the model are available at https://github.com/pppyb/SecOPD and https://huggingface.co/pybbb/Qwen3.6-27B-SecOPD.

提示注入安全防御大模型细粒度训练

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