cs.CVApr 9, 2026

AnomalyAgent: Agentic Industrial Anomaly Synthesis via Tool-Augmented Reinforcement Learning

Authors: Jiaming Su, Tengchao Yang, Ruikang Zhang, Zhengan Yan, Haoyu Sun, Linfeng Zhang

Organizations: Shanghai Jiao Tong University Shanghai, China · Tongji University Shanghai, China · Fudan University Shanghai, China

Abstract

Industrial anomaly generation is a crucial method for alleviating the data scarcity problem in anomaly detection tasks. Most existing anomaly synthesis methods rely on single-step generation mechanisms, lacking complex reasoning and iterative optimization capabilities, making it difficult to generate anomaly samples with high semantic realism. We propose AnomalyAgent, an anomaly synthesis agent with self-reflection, knowledge retrieval, and iterative refinement capabilities, aiming to generate realistic and diverse anomalies. Specifically, AnomalyAgent is equipped with five tools: Prompt Generation (PG), Image Generation (IG), Quality Evaluation (QE), Knowledge Retrieval (KR), and Mask Generation (MG), enabling closed-loop optimization. To improve decision-making and self-reflection, we construct structured trajectories from real anomaly images and design a two-stage training framework: supervised fine-tuning followed by reinforcement learning. This process is driven by a three-part reward mechanism: (1) task rewards to supervise the quality and location rationality of generated anomalies; (2) reflection rewards to train the model's ability to improve anomaly synthesis prompt; (3) behavioral rewards to ensure adherence to the trajectory. On the MVTec-AD dataset, AnomalyAgent achieves IS/IC-L of 2.10/0.33 for anomaly generation, 57.0% classification accuracy using ResNet34, and 99.3%/74.2% AP at the image/pixel level using a simple UNet, surpassing all zero-shot SOTA methods. The code is publicly available at https://github.com/sssjmmm/AnomalyAgent.

Figures & tables

Appendix figures & tables4 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. One-to-More: High-Fidelity Training-Free Anomaly Generation with Attention Control

    Mar 18, 2026Haoxiang Rao, Zhao Wang, Chenyang Si +4Synthetic Anomaly GenerationIndustrial Anomaly Detection

  2. CORE: Contrast-and-Reflect for Self-Supervised Prompt Optimization in Anomaly Synthesis

    Oct 14, 2026Haoxiang Rao, Fang Zhao, Zhao Wang +3Synthetic Anomaly GenerationSynthetic Data Augmentation

  3. UniScale: Arbitrary-Scale Industrial Anomaly Generation

    Aug 8, 2026Shilei Zeng, Linxin Guan, Xurui Li +2Industrial Anomaly DetectionSynthetic Anomaly Generation