SecOPD: Mitigating Adaptive Prompt Injections by On-Policy Distillation

Yibo Peng, Long Lian, David Wagner, Sizhe Chen

arXiv:2608.21500 · 2026-08-26 공개 · arXiv · PDF

on-policy-distillation prompt-injection llm-security qwen3-6-27b llm-defense asr-reduction token-level-feedback adaptive-prompt

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.

한국어 요약

한 줄 요약

SecOPD는 토큰 수준 피드백을 통해 적응형 프롬프트 주입 공격에 대응하는 방식으로 Qwen3.6-27B 모델의 공격 성공률을 94.0%에서 9.0%로 낮춘다.

핵심 기여도

핵심 아이디어

기존 방어 학습 방법(DPO, GRPO)은 시퀀스 수준 피드백만 제공하여, 어떤 토큰이 안전한지 구분하지 못해 적응형 프롬프트 주입 공격에 취약하다는 점을 지적한다. SecOPD는 On-Policy Distillation(OPD)을 활용해 토큰 수준 피드백을 제공함으로써, 모델이 주입된 프롬프트에 따라 생성된 해로운 토큰을 구체적으로 학습하도록 유도한다. 이는 토큰별로 신뢰도를 평가하는 방식으로, 기존 강화 학습 방법(PPO 등)이 전체 응답을 단일 단위로 평가하는 것과 대조된다. SecOPD는 훈련 시점에서 주입되지 않은 '클린' 입력에 기반한 기초 모델을 교사 모델로 사용하여, 각 토큰에 대한 안전성 신호를 생성한다.

기술적 접근법

주요 결과

의의 및 한계

SecOPD는 기존 방어 학습 방법이 토큰 수준 피드백을 제공하지 못함으로써 발생한 보안 취약점을 해결한다. 토큰별 학습 신호를 통해 모델이 프롬프트 주입에 대한 정확한 반응을 학습할 수 있도록 유도함으로써, 기존 방식 대비 10배 이상의 보안 향상을 달성했다는 점에서 학술적·실용적 의의가 크다. 다만, SecOPD는 훈련 시점에만 클린 입력을 기반으로 교사 모델을 사용할 수 있으며, 추론 시에는 이를 활용할 수 없다는 한계가 있다. 또한, 하이퍼파라미터나 모델 구조에 대한 세부 설명이 부재로, 재현성 측면에서 추가 연구가 필요할 수 있다.

실용적 활용

SecOPD는 AI 에이전트가 외부 데이터(웹사이트, 이메일, 문서 등)를 처리할 때 발생할 수 있는 프롬프트 주입 공격을 방어하는 데 적합하다. 특히, 코드 생성, 웹 네비게이션, 도구 호출 등 민감한 작업을 수행하는 에이전트에 적용할 수 있으며, 기존 보안 방식 대비 훨씬 낮은 공격 성공률을 보이는 만큼, 산업 현장에서의 실용적 가치가 높다.