← Lab /AI/ML

Routing-based on-policy distillation keeps LLM safety robust to unseen prompt templates

ROPD mitigates template-mismatch risks and preserves downstream capabilities better than existing defenses

AI/ML arXiv 29 Jul 2026 Defense Simulation evidence

Published as “On-Policy Distillation for LLM Safety: A Routing Approach to Template-Robust Realignment”

Why it matters

ROPD offers a more reliable way to repair misaligned fine-tuned LLMs without sacrificing their specialized abilities, which is valuable for deploying safe models in real-world pipelines.

Summary

ROPD markedly lowers the template-mismatch risk of safety realignment while keeping downstream task performance, outperforming four prior defenses across three models and three tasks. The authors fine-tuned Llama-2, Qwen2.5 and Gemma2 on harmful data, then applied ROPD and four baselines, measuring task accuracy and attack success rate on 700 harmful prompts. Results show baseline defenses lose >30% effectiveness and often destroy task ability when templates differ, whereas ROPD stays robust, though it still suffers some template-mismatch degradation and remains vulnerable to prompt rewriting.

What they found 1

  1. ROPD substantially reduces template-mismatch risk and preserves downstream capability compared to prior defenses

    “In contrast, ROPD substantially reduces this template-mismatch risk, remaining far more robust in both defense effectiveness and preservation of downstream capabilities-though, as our analysis shows, it too is affected by template mismatch, only to a much smaller degree.”

Caveats 3

  • ROPD is still affected by template mismatch, albeit to a smaller degree.
  • All realignment methods, ROPD included, remain conditionally vulnerable to prompt rewriting.
  • It substantially reduces, but does not fully eliminate, the template-mismatch risk.

What’s new here 4

  • Introduces a dual-teacher routing mechanism that separates safety and task knowledge during distillation.
  • Uses a top-K KL divergence objective to match the student to the appropriate teacher per token.
  • Distills a template-independent refusal prior from the original aligned model’s output distribution.
  • Provides an evaluation protocol that measures attack success across attacker, defender, and cross-templates.