The paper proposes Self-Reflection Fine-Tuning (SRFT), a training framework where LLM agents improve their resistance to by learning from their own mistakes. SRFT exposes agents to adversarial attack scenarios, uses an expert model to generate structured self-reflection reasoning that contrasts safe and unsafe actions, then fine-tunes the agent on these reflections.
On the AgentDojo benchmark, SRFT reduced attack success rate from 7.59% to 1.26% on Llama-3.1-8B-Instruct and from 16.97% to 1.05% on Qwen3-8B, while preserving task performance. Under a strong adaptive attack (RL-Hammer), SR-Agent achieved an attack success rate below 20%, significantly outperforming the prior state-of-the-art Meta SecAlign (>60%).
This is interesting because prior defenses rely on static expert datasets and pattern matching, limiting generalization. SRFT enables agents to dynamically learn from failures and reason about consequences, making them more robust to novel and adaptive attacks, a practical step toward secure deployment of LLM agents.