SecOPD: Mitigating Adaptive Prompt Injections by On-Policy Distillation

πŸ“… 2026-08-21
πŸ“ˆ Citations: 0
✨ Influential: 0
πŸ“„ PDF
πŸ€– AI Summary
ζœ¬ζ–‡ζε‡ΊSecOPDζ–Ήζ³•οΌŒι€šθΏ‡ζδΎ›δ»€η‰ŒηΊ§ει¦ˆδΏ‘ε·ζ₯防徑θ‡ͺ适应提瀺注ε…₯ζ”»ε‡»οΌŒζ˜Ύθ‘—ι™δ½Žζ”»ε‡»ζˆεŠŸηŽ‡γ€‚
πŸ“ Abstract
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.
Problem

Research questions and friction points this paper is trying to address.

Prompt Injection
Adaptive Attacks
Defensive Fine-tuning
Security of AI Agents
Innovation

Methods, ideas, or system contributions that make the work stand out.

On-Policy Distillation
Token-Level Feedback
Adaptive Prompt Injection Defense
Defensive Fine-Tuning