Plan First, Judge Later, Run Better: A DMAIC-Inspired Agentic System for Industrial Anomaly Detection

arXiv cs.AI Papers

Summary

DMAIC-IAD is a multi-agent LLM system inspired by the DMAIC quality-management framework for industrial anomaly detection, using a 'Plan First, Judge Later' approach that formulates strategies via standardized operating procedures and ranks them with an execution-free judge model, achieving 37.76% improvement over agentic baselines across four data modalities.

arXiv:2606.04599v1 Announce Type: new Abstract: Large language model (LLM) agents have shown promise in automating complex data-analysis workflows, but their reliable deployment remains challenging in high-stakes industrial scenarios. Industrial anomaly detection (IAD) is essential for manufacturing quality, safety, and efficiency, yet existing LLM-based IAD agents mainly focus on execution while under-exploiting strategy formulation. Consequently, they struggle to handle heterogeneous modalities in a unified and cost-effective manner. Inspired by the DMAIC quality-management framework, we propose DMAIC-IAD (DMAIC-inspired Agentic Industrial Anomaly Detection), a "Plan First, Judge Later" multi-agent system that aligns LLM agents with structured industrial problem-solving. DMAIC-IAD distills heterogeneous references into standardized operating procedures (SOPs) before strategy generation, and introduces a pre-trained execution-free judge model to rank candidate strategies without costly runtime trials. Extensive experiments across four modalities show that DMAIC-IAD improves average detection performance over applicable agentic baselines by 37.76%.
Original Article
View Cached Full Text

Cached at: 06/05/26, 02:08 AM

# Plan First, Judge Later, Run Better: A DMAIC-Inspired Agentic System for Industrial Anomaly Detection
Source: [https://arxiv.org/html/2606.04599](https://arxiv.org/html/2606.04599)
Yongzi Yu1,Ao Li2,Le Wang3,Ziyue Li4, Fugee Tsung2,Yuxuan Liang1,Man Li†5 1The Hong Kong University of Science and Technology \(Guangzhou\), 2The Hong Kong University of Science and Technology,3Shanghai University of Finance and Economics, 4Technische Universität München,5Southwestern University of Finance and Economics yyu322@connect\.hkust\-gz\.edu\.cn†Corresponding Author

###### Abstract

Large language model \(LLM\) agents have shown promise in automating complex data\-analysis workflows, but their reliable deployment remains challenging in high\-stakes industrial scenarios\. Industrial anomaly detection \(IAD\) is essential for manufacturing quality, safety, and efficiency, yet existing LLM\-based IAD agents mainly focus on execution while under\-exploiting strategy formulation\. Consequently, they struggle to handle heterogeneous modalities in a unified and cost\-effective manner\. Inspired by the DMAIC quality\-management framework, we proposeDMAIC\-IAD\(DMAIC\-inspired Agentic Industrial Anomaly Detection\), a"Plan First, Judge Later"multi\-agent system that aligns LLM agents with structured industrial problem\-solving\. DMAIC\-IAD distills heterogeneous references into standardized operating procedures \(SOPs\) before strategy generation, and introduces a pre\-trained execution\-free judge model to rank candidate strategies without costly runtime trials\. Extensive experiments across four modalities show that DMAIC\-IAD improves average detection performance over applicable agentic baselines by37\.76%\.

Plan First, Judge Later, Run Better: A DMAIC\-Inspired Agentic System for Industrial Anomaly Detection

Yongzi Yu1, Ao Li2, Le Wang3, Ziyue Li4,Fugee Tsung2,Yuxuan Liang1,Man Li†51The Hong Kong University of Science and Technology \(Guangzhou\),2The Hong Kong University of Science and Technology,3Shanghai University of Finance and Economics,4Technische Universität München,5Southwestern University of Finance and Economicsyyu322@connect\.hkust\-gz\.edu\.cn†Corresponding Author

## 1Introduction

Anomaly detection is the process of identifying deviations from the expected behaviors of normal dataChandolaet al\.\([2009](https://arxiv.org/html/2606.04599#bib.bib1)\)\. In complex industrial systems, it is widely used to detect faults on the visual surfaceCuiet al\.\([2023](https://arxiv.org/html/2606.04599#bib.bib4)\); Bergmannet al\.\([2019](https://arxiv.org/html/2606.04599#bib.bib33)\), time\-series telemetryHundmanet al\.\([2018](https://arxiv.org/html/2606.04599#bib.bib15)\); Wanget al\.\([2026](https://arxiv.org/html/2606.04599#bib.bib48)\), tabular processWanget al\.\([2022](https://arxiv.org/html/2606.04599#bib.bib5)\); Hanet al\.\([2022](https://arxiv.org/html/2606.04599#bib.bib32)\)and graph signalsDinget al\.\([2019](https://arxiv.org/html/2606.04599#bib.bib6)\); Liuet al\.\([2022](https://arxiv.org/html/2606.04599#bib.bib31)\)\. However, the difficulties of Industrial Anomaly Detection \(IAD\) lie in the diversity of industrial scenariosLiuet al\.\([2024](https://arxiv.org/html/2606.04599#bib.bib3)\), where heterogeneous data modalities may occur concurrently within the same scene\. For example, a single steel\-plate manufacturing line may simultaneously require visual inspection of surface defects, time\-series monitoring for equipment health, and detection of communication networks\.

![Refer to caption](https://arxiv.org/html/2606.04599v1/x1.png)Figure 1:IAD Multi\-agent Architecture Comparison: \(a\) Prior LLM\-Generated Strategy Framework vs\. \(b\) DMAIC\-Inspired Design Workflow\.Despite extensive research on modality\-specific IAD methodsLiuet al\.\([2024](https://arxiv.org/html/2606.04599#bib.bib3)\), they remain ill\-suited for unified handling of heterogeneous multimodal data\. Consequently, practical deployment for IAD task still relies on scenario\-specific pipeline engineering, and cold\-start deployment for novel datasets remains labor\-intensive, often requiring manual tuning or costly trial\-and\-error from scratch due to reliability requirements\.

The advent of LLMs has prompted research into agentic systemsLiet al\.\([2024](https://arxiv.org/html/2606.04599#bib.bib46)\); Guoet al\.\([2024](https://arxiv.org/html/2606.04599#bib.bib47)\)for automated anomaly detectionYanget al\.\([2025a](https://arxiv.org/html/2606.04599#bib.bib17)\); Jiet al\.\([2025a](https://arxiv.org/html/2606.04599#bib.bib18)\)\. Summarized in Fig\.[1](https://arxiv.org/html/2606.04599#S1.F1), existing pipelines primarily couple heuristic data processing with direct code generation\. Critically, these methods disproportionately emphasize the execution stage while under\-exploiting high\-level strategy formalization\. This imbalance leads to significant reliability risks, as generated strategies cannot be assessed without incurring actual deployment costs\. While iterative refinement via RLHachaj and Piekarczyk \([2025](https://arxiv.org/html/2606.04599#bib.bib40)\); Lianget al\.\([2025](https://arxiv.org/html/2606.04599#bib.bib41)\)or self\-evaluationFanget al\.\([2025](https://arxiv.org/html/2606.04599#bib.bib42)\)offers a potential remedy, the associated computational burden renders it impractical for real\-time industrial needs\. Consequently, a gap remains in buildingreliable LLM\-based agentsthat can achieve truly dependable and autonomous IAD workflows\.

To introduce discipline and process rigor to IAD automation, we draw inspiration from DMAIC \(Define\-Measure\-Analyze\-Improve\-Control\), which is a data\-driven process improvement framework with deep industrial roots in manufacturing, supply chain management, and service industriesDe Mast and Lokkerbol \([2012](https://arxiv.org/html/2606.04599#bib.bib2)\)\. It provides a logical, staged roadmap that systematically defines problems, measures current states, analyzes data, improves strategies, and implements controls to sustain resultsIshaket al\.\([2019](https://arxiv.org/html/2606.04599#bib.bib43)\); Smętkowska and Mrugalska \([2018](https://arxiv.org/html/2606.04599#bib.bib44)\), which closely parallel our industrial anomaly detection task\. Therefore, we adopt DMAIC as an explicit organizational framework \(Fig\.[1](https://arxiv.org/html/2606.04599#S1.F1)\) to impose discipline, auditability, and stagewise agent responsibilities forstrategy formulation,pre\-execution evaluation, anddeployment\.

Building upon this DMAIC\-inspired perspective, we proposeDMAIC\-IAD\(DMAIC\-inspired Agentic Industrial Anomaly Detection\), a multi\-agent system designed for the practical constraints of IAD\. This system first distills domain references into scenario\-specific standardized operating procedures \(SOPs\) to support unified handling of diverse scenarios and address cold\-start circumstances\. Besides, we construct dataset\-specific profiles from dataset samples or descriptions\. These artifacts ground downstream strategy generation and evaluation\. Then we build a pre\-trained execution\-free judge model to automatically score candidate strategies generated from LLMs without running them, thereby avoiding costly trials\. Finally, an executor compiles the selected strategy into runnable workflows and produces auditable anomaly reports\. By decoupling planning from execution, our system enables efficient, pre\-execution assessment of strategy quality, and thereby realizes the principle "plan first, judge later, run better"\.

The main contributions of this work are summarized as follows:

- •We propose aDMAIC\-inspired agentic frameworkfor automated IAD to impose discipline, auditability, and stagewise agent responsibilities, which integrates domain knowledge, dataset profiling, and strategy evaluation into a structured pipeline\.
- •We introduce theknowledge distillation mechanismthat standardizes SOP construction from heterogeneous references, improving cold\-start strategy quality for new scenarios\.
- •We further design anexecution\-free judge modelto predict plan–task compatibility from structural and contextual signals, enabling reliable prioritization of candidate strategies without costly runtime trials\.
- •Systematic experiment demonstrate that in the majority of cases, the performance of our DMAIC\-inspired framework is superior to current state\-of\-the\-art methods with average improvement of\+37\.76%\.

## 2Related Work

##### Industrial Anomaly Detection\.

Industrial anomaly detection has been extensively studied under unsupervised settings, where only normal data are used for trainingChalapathy and Chawla \([2019](https://arxiv.org/html/2606.04599#bib.bib7)\); Ruffet al\.\([2021](https://arxiv.org/html/2606.04599#bib.bib8)\)\. Existing methods mainly include reconstruction\-based models, feature embedding\-based methodsRothet al\.\([2022](https://arxiv.org/html/2606.04599#bib.bib13)\); Kirichenkoet al\.\([2020](https://arxiv.org/html/2606.04599#bib.bib14)\); Xuet al\.\([2022](https://arxiv.org/html/2606.04599#bib.bib49)\); Suet al\.\([2019](https://arxiv.org/html/2606.04599#bib.bib50)\);xu2018unsupervised, as well as forecasting\- and graph\-based approaches for modeling temporal and relational dependenciesSakurada and Yairi \([2014](https://arxiv.org/html/2606.04599#bib.bib10)\); Parket al\.\([2018](https://arxiv.org/html/2606.04599#bib.bib11)\); Wyattet al\.\([2022](https://arxiv.org/html/2606.04599#bib.bib12)\); Hundmanet al\.\([2018](https://arxiv.org/html/2606.04599#bib.bib15)\); Lvet al\.\([2023](https://arxiv.org/html/2606.04599#bib.bib16)\)\. Most deep learning\-based methods remain model\-centric and scenario\-dependent, requiring task\-specific design or retraining and thus limiting scalability and generalization across heterogeneous industrial environmentsChalapathy and Chawla \([2019](https://arxiv.org/html/2606.04599#bib.bib7)\); Liet al\.\([2025](https://arxiv.org/html/2606.04599#bib.bib9)\)\.

![Refer to caption](https://arxiv.org/html/2606.04599v1/x2.png)Figure 2:Overall Framework of DMAIC\-IAD: Given scenario descriptions and data samples, it distills domain references intoscenario\-specific SOPs, and constructsdataset\-specific profiles\(Define\-Measure\)\. Using these priors, it generates candidate strategies, followed by apre\-trained execution\-free judge modelto score without runtime trials \(Analyze–Improve\)\. The selected strategy is compiled into a runnable workflow and produces auditable anomaly reports during Control, closing the DMAIC loop\.
##### Agentic Anomaly Detection System\.

Early agent\-based anomaly detection methods focused on distributed monitoring and were later extended to collaborative multi\-agent systems for improved robustness and scalabilityMcArthuret al\.\([2005](https://arxiv.org/html/2606.04599#bib.bib29)\); García \([2019](https://arxiv.org/html/2606.04599#bib.bib28)\)\. Recent large model\-empowered agents have been explored for industrial anomaly detection across time\-seriesGuet al\.\([2025](https://arxiv.org/html/2606.04599#bib.bib22)\); Yanget al\.\([2025b](https://arxiv.org/html/2606.04599#bib.bib20)\); Qinet al\.\([2025](https://arxiv.org/html/2606.04599#bib.bib21)\), visualMiaoet al\.\([2025](https://arxiv.org/html/2606.04599#bib.bib19)\), and log\-based scenariosJiet al\.\([2025b](https://arxiv.org/html/2606.04599#bib.bib23)\); Harbola and Purwar \([2025](https://arxiv.org/html/2606.04599#bib.bib24)\)\. However, most of these methods use large models as fixed processors rather than adaptive decision\-makers for heterogeneous industrial scenarios\. Recent frameworks such as AD\-AGENTYanget al\.\([2025a](https://arxiv.org/html/2606.04599#bib.bib17)\)and AutoIADJiet al\.\([2025a](https://arxiv.org/html/2606.04599#bib.bib18)\)automate executable pipeline construction but mainly focus on implementation\-level optimization, with limited attention to high\-level decision\-making over model selection and scenario adaptation\. More detailed related work is provided in Appendix[B](https://arxiv.org/html/2606.04599#A2)\.

## 3Methodology

### 3\.1Architecture of DMAIC\-IAD

Our DMAIC\-IAD framework adopts a process\-oriented formalization to explicitly encode agent roles, primary artifacts, and operational mappings onto DMAIC phases, as presented in Fig\.[2](https://arxiv.org/html/2606.04599#S2.F2)\. Concretely, the system is expressed by the tupleΩ=⟨ℛ,𝒟,𝒫,𝒦,Π⟩\\Omega=\\langle\\mathcal\{R\},\\mathcal\{D\},\\mathcal\{P\},\\mathcal\{K\},\\Pi\\rangle, whereℛ\\mathcal\{R\}denotes the domain of task and scenario descriptions,𝒟\\mathcal\{D\}represents the dataset space,𝒫=\{Define, Measure, Analyze, Improve, Control\}\\mathcal\{P\}=\\\{\\text\{Define, Measure, Analyze, Improve, Control\}\\\}encompasses the ordered DMAIC phases and the artifacts they produce,𝒦\\mathcal\{K\}signifies the external knowledge base \(integrating both static literature and real\-time web search\), andΠ\\Piis the set of executable strategies\. The framework maps inputs\(r,d\)∈ℛ×𝒟\(r,d\)\\in\\mathcal\{R\}\\times\\mathcal\{D\}through the ordered DMAIC phases𝒫\\mathcal\{P\}to select and execute a strategyπ∈Π\\pi\\in\\Pi, guided by𝒦\\mathcal\{K\}\. There is acase studyin Appendix[G](https://arxiv.org/html/2606.04599#A7), and a notation summary of this work is in Appendix[C](https://arxiv.org/html/2606.04599#A3)\.

The workflow is operationalized by specialized agents that act as transformation operators within the DMAIC cycle:

- •Define:TheIAD Consultant Agentinitiates the process by interpreting the industry scenario \(ℛ\\mathcal\{R\}\) and distilling domain\-specific knowledge from𝒦\\mathcal\{K\}into a canonical SOP schema\. The resulting*scenario\-specific SOP*defines the problem scope and operational constraints for downstream phases\.
- •Measure:TheData Inspector Agentconducts rigorous data analysis on𝒟\\mathcal\{D\}, identifying distribution shifts and structural requirements to ensure data readiness\.
- •Analyze:Synthesizing outputs from the previous phases, theIAD Strategist Agentformulates a set of candidate strategiesΠ\\Pi, mapping the problem space to potential algorithmic solutions\.
- •Improve:To optimize the strategy selection, aJudge Modelevaluates the proposals from the Strategist, scoring them to identify the optimal plan for execution\.
- •Control:Finally, theIAD Executor Agentimplements the strategy through code generation, validation, and execution, and gives a final report\.

### 3\.2Define: Understanding and Knowledge Distillation

The initializedDefinephase constitutes the cognitive anchor of the system, executed by theConsultant Agent\. This agent orchestrates a dual\-channel retrieval mechanism comprising a Research Assistant for academic literature and an AI Web Searcher for real\-time online resources\. We formalize this retrieval\-and\-distillation process asΨc​o​n​s:ℛ×𝒦→𝒲\\Psi\_\{cons\}:\\mathcal\{R\}\\times\\mathcal\{K\}\\to\\mathcal\{W\}\. Given an unstructured scenario descriptionr∈ℛr\\in\\mathcal\{R\}, the agent first extracts semantic keywords to query the external knowledge base𝒦\\mathcal\{K\}\. Subsequently, the LLMs synthesizes the aggregated multi\-source context into a structured SOP, denoted asww\.

w=Ψc​o​n​s​\(r,𝒦\)=\{ds​c​e​n,o→s​t​e​p​s,ℳr​e​c\},w=\\Psi\_\{cons\}\(r,\\mathcal\{K\}\)=\\\{d\_\{scen\},\\vec\{o\}\_\{steps\},\\mathcal\{M\}\_\{rec\}\\\},whereds​c​e​nd\_\{scen\}provides a refined definition of the anomaly detection scenario,o→s​t​e​p​s\\vec\{o\}\_\{steps\}represents the ordered sequence of methodological steps, andℳr​e​c\\mathcal\{M\}\_\{rec\}denotes the set of recommended models derived from the retrieval results\. A specific SOP case is provided in Appendix Fig\.[6](https://arxiv.org/html/2606.04599#A7.F6)\.

### 3\.3Measure: Dataset Profiling

TheMeasurephase is governed by theData Inspector Agent, which grounds the abstract SOP in the empirical reality of the input data\. We formalize this process as a structured diagnostic functionΨi​n​s​p:𝒟→ℳ\\Psi\_\{insp\}:\\mathcal\{D\}\\to\\mathcal\{M\}\. To maintain computational efficiency while ensuring context awareness, the agent operates on a representative subset of samples extracted from the raw datasetDD, augmented by pre\-computed metadata such as label cardinality\. The LLM processes these inputs to generate a comprehensive data profile𝐦∈ℳ\\mathbf\{m\}\\in\\mathcal\{M\}:

𝐦=Ψi​n​s​p​\(\{xi\}i=1k,\|Y\|\)=⟨ϕf​e​a​t,τt​a​s​k,δm​i​s​s⟩,\\mathbf\{m\}=\\Psi\_\{insp\}\(\\\{x\_\{i\}\\\}\_\{i=1\}^\{k\},\|Y\|\)=\\langle\\phi\_\{feat\},\\tau\_\{task\},\\delta\_\{miss\}\\rangle,where\{xi\}i=1k\\\{x\_\{i\}\\\}\_\{i=1\}^\{k\}denotes the few\-shot data samples and\|Y\|\|Y\|represents the label count\. The resulting output tuple encodes the intrinsic data characteristics \(ϕf​e​a​t\\phi\_\{feat\}\), the inferred task category \(τt​a​s​k\\tau\_\{task\}\), and a data integrity assessment \(δm​i​s​s\\delta\_\{miss\}\), specifically highlighting issues such as missing values\. This structured analysis combines with the SOP to form the context state, ensuring that subsequent planning is not only theoretically sound but also strictly compatible with the dataset’s physical constraints\. The demo of one dataset profile is in Appendix Fig\.[7](https://arxiv.org/html/2606.04599#A7.F7)\.

### 3\.4Analyze: Strategy Generation

In theAnalyzephase, theStrategist Agenttransitions the system from passive observation to active architectural planning\. We model this transformation via the generative functionΨs​t​r​a​t:𝒲×ℳ→ΠK\\Psi\_\{strat\}:\\mathcal\{W\}\\times\\mathcal\{M\}\\to\\Pi^\{K\}\.

Conditioned on the semantic constraints of the SOPwwand the empirical characteristics from the data profile𝐦\\mathbf\{m\}, the LLM synthesizes a diverse set ofKKcandidate strategies\. We formalize this generation process as:

ΠK=Ψs​t​r​a​t​\(w,𝐦\)=\{πk\}k=1K,\\Pi^\{K\}=\\Psi\_\{strat\}\(w,\\mathbf\{m\}\)=\\\{\\pi\_\{k\}\\\}\_\{k=1\}^\{K\},whereπk=\{τj\(k\)\}j=1Lk\\pi\_\{k\}=\\\{\\tau\_\{j\}^\{\(k\)\}\\\}\_\{j=1\}^\{L\_\{k\}\}\.

Crucially, each strategyπk\\pi\_\{k\}extends beyond a high\-level DAG topology, and it is instantiated as a granular, structured execution sequence of lengthLkL\_\{k\}\. There are three kinds of steps in each strategy: data preprocessing, feature extraction, and anomaly detection method\. Each step is defined by a tupleτj=⟨i,αa​c​t,μa​l​g​o,θp​a​r​a​m⟩\\tau\_\{j\}=\\langle i,\\alpha\_\{act\},\\mu\_\{algo\},\\theta\_\{param\}\\rangle, which explicitly mandates the step index \(ii\), the required action type \(αa​c​t\\alpha\_\{act\}\), the specific algorithmic method \(μa​l​g​o\\mu\_\{algo\}\), and its corresponding hyperparameters \(θp​a​r​a​m\\theta\_\{param\}\)\. There is a strategy case in Appendix Fig\.[8](https://arxiv.org/html/2606.04599#A7.F8)\. This rigorous specification ensures the system explores the solution space with executable precision rather than converging on ambiguous abstract workflows\.

### 3\.5Improve: Execution\-Free Judge Model

TheImprovephase addresses the critical "Plan Selection Problem" by identifying the optimal strategyπ∗\\pi^\{\*\}from the candidate setΠK\\Pi^\{K\}\. A naive approach might employ LLMs for self\-evaluationSahaet al\.\([2025](https://arxiv.org/html/2606.04599#bib.bib34)\); however, the candidate strategies are natively generated by an LLM \(the Strategist\), and a general LLM lacks the empirical grounding required to distinguish between linguistically plausible and practically executable plans\. Furthermore, while RL offers a theoretical pathway for policy optimizationEstornellet al\.\([2025](https://arxiv.org/html/2606.04599#bib.bib35)\), the computational overhead of iterative gradient updates on large\-scale models proves prohibitive for agile industrial deployment\. Consequently, we propose a cost\-effective, lightweightJudge Modelthat acts as a surrogate for physical execution, distilling historical experience into a predictive scoring mechanism\.

We formalize the Judge as a learnable utility functionΦj​u​d​g​e:Π×ℛ→ℝ\\Phi\_\{judge\}:\\Pi\\times\\mathcal\{R\}\\to\\mathbb\{R\}, parameterized byθ\\theta\. The architecture leverages a semantic alignment framework: for each candidate strategyπk\\pi\_\{k\}and the scenario contextrr, we employ apre\-trained Sentence TransformerE​\(⋅\)E\(\\cdot\)to map the textual constraints into a dense latent space\. These embeddings are concatenated and fed into a Multilayer Perceptron \(MLP\) regressor\. Crucially, the model is trained via supervised learning to predict a composite utility scorey^k\\hat\{y\}\_\{k\}, which approximates the weighted performance metrics observed in historical execution logs:

y^k=ℱm​l​p​\(E​\(πk\)⊕E​\(r\);θ\)≈∑j=1Mλj⋅μj\(h​i​s​t\),\\hat\{y\}\_\{k\}=\\mathcal\{F\}\_\{mlp\}\\left\(E\(\\pi\_\{k\}\)\\oplus E\(r\);\\theta\\right\)\\approx\\sum\_\{j=1\}^\{M\}\\lambda\_\{j\}\\cdot\\mu\_\{j\}^\{\(hist\)\},whereμj\(h​i​s​t\)\\mu\_\{j\}^\{\(hist\)\}represents the ground\-truth historical metrics associated with similar strategy\-scenario pairs, andλj\\lambda\_\{j\}denotes the importance weight of thejj\-th metric\. By freezing the encoder and training only the lightweight MLP head, this design decouples high\-cost reasoning from high\-frequency evaluation\. The system finally performs deterministic maximization,π∗=arg​maxπk⁡y^k\\pi^\{\*\}=\\operatorname\*\{arg\\,max\}\_\{\\pi\_\{k\}\}\\hat\{y\}\_\{k\}, ensuring the selected plan is grounded in data\-driven empirical evidence rather than hallucinated confidence\.

### 3\.6Control: IAD Execution

The finalControlphase operationalizes the theoretically optimal planπ∗\\pi^\{\*\}into a concrete, verifiable software artifact\. This process is orchestrated by theExecutor Agentvia a streamlined code generation architecture\. We model this as a state\-refinement loop governed by a generative coding functionΨc​o​d​e:Π→𝒞\\Psi\_\{code\}:\\Pi\\to\\mathcal\{C\}and a runtime validation oracleVV\.

The agent initiates the process by instantiating the plan into a raw scriptc\(0\)=Ψc​o​d​e​\(π∗\)c^\{\(0\)\}=\\Psi\_\{code\}\(\\pi^\{\*\}\)\. The oracleVVsubsequently attempts execution, checking for syntax compliance, API alignment, and runtime integrity\. If faults are detected, a diagnostic feedback traceϵ\(t\)\\epsilon^\{\(t\)\}triggers a self\-correction step:

c\(t\+1\)=Ψr​e​f​i​n​e​\(c\(t\),ϵ\(t\)\)fort<Tm​a​xc^\{\(t\+1\)\}=\\Psi\_\{refine\}\(c^\{\(t\)\},\\epsilon^\{\(t\)\}\)\\quad\\text\{for\}\\quad t<T\_\{max\}This iterative cycle continues until validation success or the iteration capTm​a​xT\_\{max\}is exhausted\. Upon successful deployment, the system computes the final performance metrics and synthesizes a human\-readableIAD Report, encapsulating both the quantitative detection results and the qualitative methodological justification\.

### 3\.7Efficient Experience Reuse

To obviate redundant computation for recurring scenarios, the framework integrates a lightweight, hash\-basedmemory mechanism\. We operationalize this as a dual\-key lookup table mapping input fingerprints to intermediate artifacts:ℳ=\{H​\(r\)↦w,H​\(D\)↦𝐦\}\\mathcal\{M\}=\\\{H\(r\)\\mapsto w,\\;H\(D\)\\mapsto\\mathbf\{m\}\\\}\. Here,H​\(⋅\)H\(\\cdot\)represents a deterministic hashing function applied to the raw task descriptionrror the dataset schemaDD\.

Upon initialization, the system executes a lookup\-first strategy\. If a fingerprint match is detected for the task fingerprintH​\(r\)H\(r\), the system retrieves the proven SOPww, bypassing the Consultant Agent’s synthesis overhead\. Similarly, a match forH​\(D\)H\(D\)allows the immediate reuse of the data profile𝐦\\mathbf\{m\}\. This modular design supports partial caching, which could effectively apply established workflows to novel data instances \(rm​a​t​c​h,Dn​e​wr\_\{match\},D\_\{new\}\)\. Under experience reuse, the lookup operation achieves average\-caseO​\(1\)O\(1\)complexity\. Detailed description is provided in Appendix[A](https://arxiv.org/html/2606.04599#A1)\.

## 4Experiment

In the experimental section, we compare the anomaly detection performance of DMAIC\-IAD with baseline methods and assess its computational cost relative to previous approaches\. Besides, we also perform the ablation study examining the system’s performance in the absence of the judge model or the SOP in[4\.2](https://arxiv.org/html/2606.04599#S4.SS2)and[4\.3](https://arxiv.org/html/2606.04599#S4.SS3)\. In[4\.4](https://arxiv.org/html/2606.04599#S4.SS4), we visualize the selection performance of the judge model\. And we investigate the impact of utilizing different LLMs as the strategist in[4\.5](https://arxiv.org/html/2606.04599#S4.SS5)\. Furthermore, we conduct the comparison with specific\-modality models in Appendix[E](https://arxiv.org/html/2606.04599#A5), a parameter experiment in Appendix[F](https://arxiv.org/html/2606.04599#A6), and a case study in Appendix[G](https://arxiv.org/html/2606.04599#A7)\.

### 4\.1Experiment Setting

##### Data Description\.

In our experiment, we utilize datasets across four distinct modalities: numeric, time series, graph, and image\. We select two representative datasets for each modality\. Specifically, the numeric category includes vertebral and arrhythmia datasets from the ADBenchHanet al\.\([2022](https://arxiv.org/html/2606.04599#bib.bib32)\)classical collection\. For time series analysis, we utilize PSM and SWaT datasets from Time Series LibraryWanget al\.\([2026](https://arxiv.org/html/2606.04599#bib.bib48)\)to validate\. The graph datasets are books and enron from BONDLiuet al\.\([2022](https://arxiv.org/html/2606.04599#bib.bib31)\), and the image modality comprises metalnut and tile datasets in Benchmark MVTecADBergmannet al\.\([2019](https://arxiv.org/html/2606.04599#bib.bib33)\)\.

Table 1:IAD Performance Comparison: We compare our proposed method with three baselines and key ablations\.\+ wo Judge Modelmeans our framework without judge model and\+ wo SOPmeans our framework without Consultant Agent\. "↑\\uparrow" means the larger the better and "/" means this method can not solve the task\. The evaluation is conducted on eight benchmark datasets using AUROC and AUPRC as the primary metrics\. All the results are the average value of 5 repeated experiments\. The best results are highlighted in bold\.
##### Evaluation Metrics\.

Given the severe label imbalance prevalent in individual datasets, we primarily employ AUROC \(Area Under the Receiver Operating Characteristic Curve\) and AUPRC \(Area Under the Precision\-Recall Curve\) to evaluate the performance of the generated codeAlzarooniet al\.\([2025](https://arxiv.org/html/2606.04599#bib.bib45)\)\. The specific description of AUROC and AUPRC is in Appendix[D](https://arxiv.org/html/2606.04599#A4)\. To provide a comprehensive system evaluation, we also incorporate Success Rate \(SR\), execution time, Prompt Token \(PT\), and Completion Token \(CT\)\. SR defines the proportion of code instances that execute successfully\. Execution time measures the latency from system initialization to the final code generation\. PT refers to the volume of inputs processed by the LLMs, and CT aggregates the sum of both input and output tokens across all interactions\.

##### Agent Model Setting\.

The agents within our system utilize distinct backend models selected according to their functional requirements\. Specifically, the Consultant and Data Inspector employ GPT\-4oAchiamet al\.\([2023](https://arxiv.org/html/2606.04599#bib.bib36)\)\. The Strategist Agent operates on GPT\-5\-MiniSinghet al\.\([2025](https://arxiv.org/html/2606.04599#bib.bib38)\), while the Code Generator leverages Claude\-Sonnet\-4\.5\. In Exp\.[4\.5](https://arxiv.org/html/2606.04599#S4.SS5), we further investigate the impact of model capability on system performance by comparing GPT\-3\.5\-TurboBrownet al\.\([2020](https://arxiv.org/html/2606.04599#bib.bib37)\), GPT\-4o\-MiniAchiamet al\.\([2023](https://arxiv.org/html/2606.04599#bib.bib36)\), and GPT\-5\-Mini as alternative backends for the Strategist Agent\. Detailed configuration is provided in Appendix[H](https://arxiv.org/html/2606.04599#A8)\.

##### Judge Model Setting\.

For training of the Judge Model, we selected a representative dataset for each modality to form the training set\. This included the optdigits dataset for tabular data, the MSL dataset for time series data, the weibo dataset for graph data, and the screw dataset for image data\. For each of these datasets, we utilized the Strategist to generate and execute 50 strategies, resulting in 200 strategy\-metrics pairs\. The final Judge Model was trained on these 200 strategy\-metrics pairs aggregated from the four datasets\. The training datasets are independent of the datasets in the experiment\. More details are in AppendixLABEL:Judge\_Model\_Detail\.

##### Baseline Methods\.

In our comparative analysis, we evaluate the proposed system against three baseline methods: AD\-AGENT, AutoIAD, and a "Strategist only" variant\. Specifically, AD\-AGENT employs LLMs to select algorithms from established repositories for time series, tabular, and graph modalities, whereas AutoIAD is tailored to the image domain for model selection and design, shown in the modality part of Tab\.[3](https://arxiv.org/html/2606.04599#A2.T3)\. The "Strategist only" baseline serves as an ablation study of our framework\. It retains only the Analyze and Control \(AC\) components while omitting the Define, Measure, and Improve \(DMI\) stages\.

### 4\.2IAD Performance Comparison

To validate the effectiveness of our method in practical IAD scenarios, we compare different frameworks using AUROC and AUPRC across eight datasets, as shown in Tab\.[1](https://arxiv.org/html/2606.04599#S4.T1)\.

DMAIC\-IAD Achieves Strong Overall Performance Across Modalities\.As shown in Tab\.[1](https://arxiv.org/html/2606.04599#S4.T1)and Tab\.[5](https://arxiv.org/html/2606.04599#A5.T5), our method achieves superior performance on most datasets\. It improves AUROC over AD\-AGENT by\+37\.0%on vertebral,\+44\.8%on SWaT, and\+86\.4%on enron\. For image data, it also surpasses AutoIAD by\+9\.1%on metalnut\. Overall, our method outperforms AD\-AGENT and AutoIAD by37\.76%on average, demonstrating strong robustness across heterogeneous modalities\.

Strategist Only is not Enough\.TheStrategist onlybaseline shows unstable performance and is clearly inferior to the full DMAIC framework, indicating that the simple AC architecture is insufficient\. For example, its AUROC is only 0\.6190 on vertebral, compared with 0\.9617 for our method, yielding a\+55\.4%improvement\. The gap is larger on SWaT, where our method improves AUROC by 118\.7%, and on enron, where AUROC increases from 0\.1160 to 0\.9320\. These results validate the necessity of the full DMAIC design\.

The Judge Model Effectively Selects High\-Performing Strategies\.The Judge Model further improves strategy selection by filtering suboptimal candidates, as later analyzed in Section[4\.4](https://arxiv.org/html/2606.04599#S4.SS4)\.

SOPs Substantially Enhance System Performance\.The ablation results in Tab\.[1](https://arxiv.org/html/2606.04599#S4.T1)show that removing SOPs causes consistent performance degradation\. Without SOPs, AUROC drops by17\.2%on vertebral, AUPRC also drops sharply on SWaT and enron, although the absolute AUPRC on enron remains small\. These results indicate that SOPs are not merely auxiliary guidance, but a foundational component for stable and high\-performing IAD\.

### 4\.3Efficiency Analysis

This experiment investigates the performance of various methods in terms of success rate, system execution time, and token consumption\. The results in Tab\.[2](https://arxiv.org/html/2606.04599#S4.T2)show that our method achieves the highest success rate, and a deeper analysis reveals the following insights into the trade\-offs between cost and performance\.

Our Method Balances Performance and Cost\.As shown in Tab\.[2](https://arxiv.org/html/2606.04599#S4.T2), our method achieves the highest success rate of78\.19%, outperforming AutoIAD by3\.83%\. Although it takes the longest execution time, its token consumption is only 20,467, which is78\.89%lower than AutoIAD’s 96,906\. This shows that our framework achieves strong performance with much lower token cost, making it attractive when detection quality and token cost are prioritized over latency\.

Latency Comes from Reliability\-Oriented Design\.The longer execution time of our method mainly results from two reliability\-oriented components\. First, our framework generates multiple candidate strategies before Judge Model selection\. Comparing DMAIC\-IAD with wo Judge Model in Tab\.[2](https://arxiv.org/html/2606.04599#S4.T2), the execution time decreases by about 144\.60s, which is mainly introduced by repeated strategy generation for constructing the candidate pool\. Second, the Control phase adopts an execution\-validation\-refinement loop\. This process improves execution robustness but increases wall\-clock time\. Therefore, the latency of our method is mainly the cost of more reliable strategy selection and code execution, while its token consumption remains much lower than AutoIAD\.

Table 2:Comparison of Task Completion and Cost: This table assesses the success rate \(SR\) \(%\), execution time, Completion Token \(CT\) and Prompt Token \(PT\) of our proposed method against three baselines and two ablation variants,\+ wo Judge Modeland\+ wo SOP\.↑\\uparrowmeans the higher the better and↓\\downarrowmeans the lower the better\. The highest success rate is highlighted\.SOPs are Essential for Reliable Performance\.Removing SOPs causes substantial degradation across metrics\. The success rate drops from78\.19%to69\.33%, and the AUROC/AUPRC scores also decline notably, as shown in Tab\.[1](https://arxiv.org/html/2606.04599#S4.T1)\. For example, on SWaT, the AUPRC drops by over91%\. Although SOPs increase execution time, their removal severely harms both task success and detection quality, confirming their foundational role in the framework\.

### 4\.4Judge Model Discussion

![Refer to caption](https://arxiv.org/html/2606.04599v1/x3.png)Figure 3:Performance Distribution Box Plot of Strategies without Judge Model: \(a\) shows the AUROC distribution and \(b\) shows the AUPRC distribution\.![Refer to caption](https://arxiv.org/html/2606.04599v1/x4.png)Figure 4:Comparison of Performance between Ours and Strategies: Average means the average performance without judge model and Best\_performance means the best performance without judge model\. \(a\) shows the AUROC comparison on eight datasets and \(b\) shows the AUPRC metric\.The Judge Model is crucial for selecting superior strategies from a highly variable candidate pool\. As shown in Fig\.[4](https://arxiv.org/html/2606.04599#S4.F4), candidate strategies represented byOurs wo Judge Modeloften contain many suboptimal solutions, making robust pre\-execution selection necessary\.

The Judge Model Consistently Improves Strategy Selection\.Guided by the Judge Model, our method consistently outperforms the average candidate strategy\. As shown in Fig\.[3](https://arxiv.org/html/2606.04599#S4.F3), candidate AUROC ranges from 0\.4998 to 0\.9128 on arrhythmia, while our Judge\-guided method achieves 0\.8799,22\.5%above the average\. And from 0\.5790 to 0\.9320 on enron, yielding a61\.0%improvement, as shown in Tab\.[1](https://arxiv.org/html/2606.04599#S4.T1)and Fig\.[4](https://arxiv.org/html/2606.04599#S4.F4)\. It also improves AUPRC by30\.7%on PSM and reaches the best observed performance on several datasets, such as arrhythmia, SWaT, and metalnut\. These results show that the Judge Model effectively filters suboptimal strategies and pushes performance toward the upper bound of the candidate pool\.

Limitations of the Judge Model\.The Judge Model can still fail on out\-of\-distribution scenarios within a known modality\. As shown in Fig\.[4](https://arxiv.org/html/2606.04599#S4.F4), on the tile dataset, an out\-of\-distribution texture\-based image category, it selects a strategy with an AUROC of 0\.7043\. This is likely because we conjecture that weak and strong strategy combinations may become similar in the learned feature space, misleading the model’s selection\. This limitation suggests that the Judge Model requires stronger scenario\- and dataset\-aware generalization\.

### 4\.5Analysis of Different LLM\-based Strategist

![Refer to caption](https://arxiv.org/html/2606.04599v1/x5.png)Figure 5:Average Performance of Strategists Utilizing Different LLMs: \(a\) shows the average values of AUROC on eight datasets and \(b\) shows the average AUPRC values\.To evaluate how different language models affect the initial strategy pool, we compare the mean AUROC and AUPRC of strategies generated by the Strategist using gpt 5 mini, gpt 4o mini, and gpt 3\.5\-turbo across datasets, as shown in Fig\.[5](https://arxiv.org/html/2606.04599#S4.F5)\.

Strategy Quality Depends on Both Model Capability and Data Modality\.Based on AUROC, gpt 5 mini outperforms gpt 4o mini and gpt 3\.5 on most datasets in Fig\.[5](https://arxiv.org/html/2606.04599#S4.F5), including PSM, SWaT, enron, and metalnut\. However, this advantage is not universal: on the tabular datasets vertebral and arrhythmia, gpt 3\.5 achieves higher average AUROC than gpt 5 mini\. Strategy quality also varies significantly across modalities\. All models produce strong AUPRC on image datasets, with gpt 5 mini reaching 0\.9594 on tile, while the average AUPRC remains very low on the graph datasets, indicating that graph anomaly detection remains challenging\. Moreover, AUROC and AUPRC can be inconsistent: gpt 3\.5 achieves high AUROC but relatively low AUPRC on arrhythmia, suggesting good ranking ability but weak anomaly precision\.

## 5Conclusion and Future Work

In conclusion, we propose a DMAIC\-inspired multi\-agent framework for reliable automated IAD across heterogeneous modalities\. Following the "Plan First, Judge Later" paradigm, the framework combines SOP distillation with a lightweight execution\-free Judge Model for structured planning and pre\-execution validation\. Experiments show that our method achieves state\-of\-the\-art performance and the highest success rate\. Future work will focus on improving reliability and generalization for safety\-critical industrial deployment\.

## 6Limitation

Despite its overall effectiveness, the execution\-free Judge Model may still face challenges in out\-of\-distribution cases within a known modality\. This indicates that stronger dataset\-aware generalization remains necessary\. Besides, this system currently operates as a static framework and does not yet possess continuous self\-evolving capabilities\. In practical industrial environments, anomaly patterns and data distributions may evolve over time, requiring the system to continuously absorb new feedback, refine its strategy pool, and adapt its decision\-making process\. Developing such a lifelong self\-evolution mechanism constitutes an important direction for future work\.

## 7Ethical Considerations

This work targets agentic industrial anomaly detection, where system outputs may affect quality inspection, maintenance decisions, and operational safety\. False negatives may leave faults undetected, while false positives may cause unnecessary production interruptions or maintenance costs\. Moreover, LLM\-generated strategies and code may still contain incorrect assumptions or implementation errors, particularly under out\-of\-distribution data\. Therefore, generated workflows should be audited and validated by domain experts before deployment\. Since industrial data may contain proprietary or sensitive operational information, practitioners should also ensure proper anonymization, access control, and data governance when applying LLM\-based agents or external retrieval tools\. Our experiments are conducted on public benchmark datasets and do not involve personally identifiable information\.

In this paper, AI\-assisted technologies were used solely to assist with language polishing and grammar checking\. We explicitly state that no AI was utilized to generate research ideas, write the core manuscript, generate citations, or create any images and data\. The authors rigorously cross\-checked all AI\-assisted modifications and take responsibility for the scientific integrity of this manuscript, explicitly ensuring the validity of the empirical findings and the precise accuracy of all references\.

## References

- J\. Achiam, S\. Adler, S\. Agarwal, L\. Ahmad, I\. Akkaya, F\. L\. Aleman, D\. Almeida, J\. Altenschmidt, S\. Altman, S\. Anadkat,et al\.\(2023\)Gpt\-4 technical report\.arXiv preprint arXiv:2303\.08774\.Cited by:[§4\.1](https://arxiv.org/html/2606.04599#S4.SS1.SSS0.Px3.p1.1)\.
- Anomaly detection for industrial applications, its challenges, solutions, and future directions: a review\.arXiv preprint arXiv:2501\.11310\.Cited by:[§4\.1](https://arxiv.org/html/2606.04599#S4.SS1.SSS0.Px2.p1.1)\.
- P\. Bergmann, M\. Fauser, D\. Sattlegger, and C\. Steger \(2019\)MVTec ad–a comprehensive real\-world dataset for unsupervised anomaly detection\.InProceedings of the IEEE/CVF conference on computer vision and pattern recognition,pp\. 9592–9600\.Cited by:[§1](https://arxiv.org/html/2606.04599#S1.p1.1),[§4\.1](https://arxiv.org/html/2606.04599#S4.SS1.SSS0.Px1.p1.1)\.
- T\. Brown, B\. Mann, N\. Ryder, M\. Subbiah, J\. D\. Kaplan, P\. Dhariwal, A\. Neelakantan, P\. Shyam, G\. Sastry, A\. Askell,et al\.\(2020\)Language models are few\-shot learners\.Advances in neural information processing systems33,pp\. 1877–1901\.Cited by:[§4\.1](https://arxiv.org/html/2606.04599#S4.SS1.SSS0.Px3.p1.1)\.
- R\. Chalapathy and S\. Chawla \(2019\)Deep learning for anomaly detection: a survey\.arXiv preprint arXiv:1901\.03407\.Cited by:[§B\.1](https://arxiv.org/html/2606.04599#A2.SS1.p1.1),[§B\.1](https://arxiv.org/html/2606.04599#A2.SS1.p2.1),[§2](https://arxiv.org/html/2606.04599#S2.SS0.SSS0.Px1.p1.1)\.
- V\. Chandola, A\. Banerjee, and V\. Kumar \(2009\)Anomaly detection: a survey\.ACM computing surveys \(CSUR\)41\(3\),pp\. 1–58\.Cited by:[§1](https://arxiv.org/html/2606.04599#S1.p1.1)\.
- Y\. Cui, Z\. Liu, and S\. Lian \(2023\)A survey on unsupervised anomaly detection algorithms for industrial images\.IEEE Access11,pp\. 55297–55315\.Cited by:[§1](https://arxiv.org/html/2606.04599#S1.p1.1)\.
- J\. De Mast and J\. Lokkerbol \(2012\)An analysis of the six sigma dmaic method from the perspective of problem solving\.International Journal of Production Economics139\(2\),pp\. 604–614\.Cited by:[§1](https://arxiv.org/html/2606.04599#S1.p4.1)\.
- K\. Ding, J\. Li, R\. Bhanushali, and H\. Liu \(2019\)Deep anomaly detection on attributed networks\.InProceedings of the 2019 SIAM international conference on data mining,pp\. 594–602\.Cited by:[§1](https://arxiv.org/html/2606.04599#S1.p1.1)\.
- A\. Estornell, J\. Ton, M\. F\. Taufiq, and H\. Li \(2025\)How to train a leader: hierarchical reasoning in multi\-agent llms\.arXiv preprint arXiv:2507\.08960\.Cited by:[§3\.5](https://arxiv.org/html/2606.04599#S3.SS5.p1.2)\.
- J\. Fang, Y\. Peng, X\. Zhang, Y\. Wang, X\. Yi, G\. Zhang, Y\. Xu, B\. Wu, S\. Liu, Z\. Li,et al\.\(2025\)A comprehensive survey of self\-evolving ai agents: a new paradigm bridging foundation models and lifelong agentic systems\.arXiv preprint arXiv:2508\.07407\.Cited by:[§1](https://arxiv.org/html/2606.04599#S1.p3.1)\.
- N\. M\. García \(2019\)Multi\-agent system for anomaly detection in industry 4\.0 using machine learning techniques\.ADCAIJ: Advances in Distributed Computing and Artificial Intelligence Journal8\(4\),pp\. 33\.Cited by:[§B\.2](https://arxiv.org/html/2606.04599#A2.SS2.p1.1),[§2](https://arxiv.org/html/2606.04599#S2.SS0.SSS0.Px2.p1.1)\.
- Y\. Gu, Y\. Xiong, J\. Mace, Y\. Jiang, Y\. Hu, B\. Kasikci, and P\. Cheng \(2025\)Argos: agentic time\-series anomaly detection with autonomous rule generation via large language models\.arXiv preprint arXiv:2501\.14170\.Cited by:[§B\.2](https://arxiv.org/html/2606.04599#A2.SS2.p2.1),[§2](https://arxiv.org/html/2606.04599#S2.SS0.SSS0.Px2.p1.1)\.
- T\. Guo, X\. Chen, Y\. Wang, R\. Chang, S\. Pei, N\. V\. Chawla, O\. Wiest, and X\. Zhang \(2024\)Large language model based multi\-agents: a survey of progress and challenges\.arXiv preprint arXiv:2402\.01680\.Cited by:[§1](https://arxiv.org/html/2606.04599#S1.p3.1)\.
- T\. Hachaj and M\. Piekarczyk \(2025\)On explainability of reinforcement learning\-based machine learning agents trained with proximal policy optimization that utilizes visual sensor data\.Applied Sciences15\(2\),pp\. 538\.Cited by:[§1](https://arxiv.org/html/2606.04599#S1.p3.1)\.
- S\. Han, X\. Hu, H\. Huang, M\. Jiang, and Y\. Zhao \(2022\)Adbench: anomaly detection benchmark\.Advances in neural information processing systems35,pp\. 32142–32159\.Cited by:[§1](https://arxiv.org/html/2606.04599#S1.p1.1),[§4\.1](https://arxiv.org/html/2606.04599#S4.SS1.SSS0.Px1.p1.1)\.
- C\. Harbola and A\. Purwar \(2025\)Prescriptive agents based on rag for automated maintenance \(param\)\.arXiv preprint arXiv:2508\.04714\.Cited by:[§B\.2](https://arxiv.org/html/2606.04599#A2.SS2.p2.1),[§2](https://arxiv.org/html/2606.04599#S2.SS0.SSS0.Px2.p1.1)\.
- K\. Hundman, V\. Constantinou, C\. Laporte, I\. Colwell, and T\. Soderstrom \(2018\)Detecting spacecraft anomalies using lstms and nonparametric dynamic thresholding\.InProceedings of the 24th ACM SIGKDD international conference on knowledge discovery & data mining,pp\. 387–395\.Cited by:[§B\.1](https://arxiv.org/html/2606.04599#A2.SS1.p1.1),[§1](https://arxiv.org/html/2606.04599#S1.p1.1),[§2](https://arxiv.org/html/2606.04599#S2.SS0.SSS0.Px1.p1.1)\.
- A\. Ishak, K\. Siregar, Asfriyati, and H\. Naibaho \(2019\)Quality control with six sigma dmaic and grey failure mode effect anaysis \(fmea\): a review\.InIOP Conference Series: Materials Science and Engineering,Vol\.505,pp\. 012057\.Cited by:[§1](https://arxiv.org/html/2606.04599#S1.p4.1)\.
- D\. Ji, B\. Hu, and Y\. Zhou \(2025a\)AutoIAD: manager\-driven multi\-agent collaboration for automated industrial anomaly detection\.arXiv preprint arXiv:2508\.05503\.Cited by:[§B\.2](https://arxiv.org/html/2606.04599#A2.SS2.p3.1),[Table 3](https://arxiv.org/html/2606.04599#A2.T3.1.1.1.1.4),[§1](https://arxiv.org/html/2606.04599#S1.p3.1),[§2](https://arxiv.org/html/2606.04599#S2.SS0.SSS0.Px2.p1.1)\.
- X\. Ji, L\. Zhang, W\. Zhang, F\. Peng, Y\. Mao, X\. Liao, and K\. Zhang \(2025b\)Lemad: llm\-empowered multi\-agent system for anomaly detection in power grid services\.Electronics14\(15\),pp\. 3008\.Cited by:[§B\.2](https://arxiv.org/html/2606.04599#A2.SS2.p2.1),[§2](https://arxiv.org/html/2606.04599#S2.SS0.SSS0.Px2.p1.1)\.
- P\. Kirichenko, P\. Izmailov, and A\. G\. Wilson \(2020\)Why normalizing flows fail to detect out\-of\-distribution data\.Advances in neural information processing systems33,pp\. 20578–20589\.Cited by:[§B\.1](https://arxiv.org/html/2606.04599#A2.SS1.p1.1),[§2](https://arxiv.org/html/2606.04599#S2.SS0.SSS0.Px1.p1.1)\.
- X\. Li, S\. Wang, S\. Zeng, Y\. Wu, and Y\. Yang \(2024\)A survey on llm\-based multi\-agent systems: workflow, infrastructure, and challenges\.Vicinagearth1\(1\),pp\. 9\.Cited by:[§1](https://arxiv.org/html/2606.04599#S1.p3.1)\.
- Z\. Li, Y\. Yan, X\. Wang, Y\. Ge, and L\. Meng \(2025\)A survey of deep learning for industrial visual anomaly detection\.Artificial Intelligence Review58\(9\),pp\. 279\.Cited by:[§B\.1](https://arxiv.org/html/2606.04599#A2.SS1.p2.1),[§2](https://arxiv.org/html/2606.04599#S2.SS0.SSS0.Px1.p1.1)\.
- J\. Liang, H\. Miao, K\. Li, J\. Tan, X\. Wang, R\. Luo, and Y\. Jiang \(2025\)A review of multi\-agent reinforcement learning algorithms\.Electronics14\(4\),pp\. 820\.Cited by:[§1](https://arxiv.org/html/2606.04599#S1.p3.1)\.
- J\. Liu, G\. Xie, J\. Wang, S\. Li, C\. Wang, F\. Zheng, and Y\. Jin \(2024\)Deep industrial image anomaly detection: a survey\.Machine Intelligence Research21\(1\),pp\. 104–135\.Cited by:[§1](https://arxiv.org/html/2606.04599#S1.p1.1),[§1](https://arxiv.org/html/2606.04599#S1.p2.1)\.
- K\. Liu, Y\. Dou, Y\. Zhao, X\. Ding, X\. Hu, R\. Zhang, K\. Ding, C\. Chen, H\. Peng, K\. Shu, L\. Sun, J\. Li, G\. H\. Chen, Z\. Jia, and P\. S\. Yu \(2022\)Bond: benchmarking unsupervised outlier node detection on static attributed graphs\.Advances in Neural Information Processing Systems35,pp\. 27021–27035\.Cited by:[§1](https://arxiv.org/html/2606.04599#S1.p1.1),[§4\.1](https://arxiv.org/html/2606.04599#S4.SS1.SSS0.Px1.p1.1)\.
- J\. Lv, Y\. Wang, and S\. Chen \(2023\)Adaptive multivariate time\-series anomaly detection\.Information Processing & Management60\(4\),pp\. 103383\.Cited by:[§B\.1](https://arxiv.org/html/2606.04599#A2.SS1.p1.1),[§2](https://arxiv.org/html/2606.04599#S2.SS0.SSS0.Px1.p1.1)\.
- S\. D\. McArthur, C\. D\. Booth, J\. McDonald, and I\. T\. McFadyen \(2005\)An agent\-based anomaly detection architecture for condition monitoring\.IEEE Transactions on Power Systems20\(4\),pp\. 1675–1682\.Cited by:[§B\.2](https://arxiv.org/html/2606.04599#A2.SS2.p1.1),[§2](https://arxiv.org/html/2606.04599#S2.SS0.SSS0.Px2.p1.1)\.
- J\. Miao, P\. Du, Y\. Liu, Y\. Wang, and Y\. Wang \(2025\)AgentIAD: tool\-augmented single\-agent for industrial anomaly detection\.arXiv preprint arXiv:2512\.13671\.Cited by:[§B\.2](https://arxiv.org/html/2606.04599#A2.SS2.p2.1),[§2](https://arxiv.org/html/2606.04599#S2.SS0.SSS0.Px2.p1.1)\.
- D\. Park, Y\. Hoshi, and C\. C\. Kemp \(2018\)A multimodal anomaly detector for robot\-assisted feeding using an lstm\-based variational autoencoder\.IEEE Robotics and Automation Letters3\(3\),pp\. 1544–1551\.Cited by:[§B\.1](https://arxiv.org/html/2606.04599#A2.SS1.p1.1),[§2](https://arxiv.org/html/2606.04599#S2.SS0.SSS0.Px1.p1.1)\.
- Z\. Qin, Q\. Luo, X\. Nong, X\. Chen, H\. Zhang, and C\. U\. I\. Wong \(2025\)MAS\-lstm: a multi\-agent lstm\-based approach for scalable anomaly detection in iiot networks\.Processes13\(3\),pp\. 753\.Cited by:[§B\.2](https://arxiv.org/html/2606.04599#A2.SS2.p2.1),[§2](https://arxiv.org/html/2606.04599#S2.SS0.SSS0.Px2.p1.1)\.
- K\. Roth, L\. Pemula, J\. Zepeda, B\. Schölkopf, T\. Brox, and P\. Gehler \(2022\)Towards total recall in industrial anomaly detection\.InProceedings of the IEEE/CVF conference on computer vision and pattern recognition,pp\. 14318–14328\.Cited by:[§B\.1](https://arxiv.org/html/2606.04599#A2.SS1.p1.1),[§2](https://arxiv.org/html/2606.04599#S2.SS0.SSS0.Px1.p1.1)\.
- L\. Ruff, J\. R\. Kauffmann, R\. A\. Vandermeulen, G\. Montavon, W\. Samek, M\. Kloft, T\. G\. Dietterich, and K\. Müller \(2021\)A unifying review of deep and shallow anomaly detection\.Proceedings of the IEEE109\(5\),pp\. 756–795\.Cited by:[§B\.1](https://arxiv.org/html/2606.04599#A2.SS1.p1.1),[§2](https://arxiv.org/html/2606.04599#S2.SS0.SSS0.Px1.p1.1)\.
- S\. Saha, X\. Li, M\. Ghazvininejad, J\. Weston, and T\. Wang \(2025\)Learning to plan & reason for evaluation with thinking\-llm\-as\-a\-judge\.arXiv preprint arXiv:2501\.18099\.Cited by:[§3\.5](https://arxiv.org/html/2606.04599#S3.SS5.p1.2)\.
- M\. Sakurada and T\. Yairi \(2014\)Anomaly detection using autoencoders with nonlinear dimensionality reduction\.InProceedings of the MLSDA 2014 2nd workshop on machine learning for sensory data analysis,pp\. 4–11\.Cited by:[§B\.1](https://arxiv.org/html/2606.04599#A2.SS1.p1.1),[§2](https://arxiv.org/html/2606.04599#S2.SS0.SSS0.Px1.p1.1)\.
- A\. Singh, A\. Fry, A\. Perelman, A\. Tart, A\. Ganesh, A\. El\-Kishky, A\. McLaughlin, A\. Low, A\. Ostrow, A\. Ananthram,et al\.\(2025\)Openai gpt\-5 system card\.arXiv preprint arXiv:2601\.03267\.Cited by:[§4\.1](https://arxiv.org/html/2606.04599#S4.SS1.SSS0.Px3.p1.1)\.
- M\. Smętkowska and B\. Mrugalska \(2018\)Using six sigma dmaic to improve the quality of the production process: a case study\.Procedia\-Social and Behavioral Sciences238,pp\. 590–596\.Cited by:[§1](https://arxiv.org/html/2606.04599#S1.p4.1)\.
- H\. Su, R\. Chen, S\. Tang, Z\. Yin, X\. Zheng, J\. Li, B\. Qi, Q\. Wu, H\. Li, W\. Ouyang,et al\.\(2025\)Many heads are better than one: improved scientific idea generation by a llm\-based multi\-agent system\.InProceedings of the 63rd Annual Meeting of the Association for Computational Linguistics \(Volume 1: Long Papers\),pp\. 28201–28240\.Cited by:[§B\.2](https://arxiv.org/html/2606.04599#A2.SS2.p2.1)\.
- Y\. Su, Y\. Zhao, C\. Niu, R\. Liu, W\. Sun, and D\. Pei \(2019\)Robust anomaly detection for multivariate time series through stochastic recurrent neural network\.InProceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining,Cited by:[§2](https://arxiv.org/html/2606.04599#S2.SS0.SSS0.Px1.p1.1)\.
- M\. Wang, D\. Zhou, and M\. Chen \(2022\)Hybrid variable monitoring mixture model for anomaly detection in industrial processes\.IEEE Transactions on Cybernetics54\(1\),pp\. 319–331\.Cited by:[§1](https://arxiv.org/html/2606.04599#S1.p1.1)\.
- Y\. Wang, H\. Wu, J\. Dong, Y\. Liu, C\. Wang, M\. Long, and J\. Wang \(2026\)Deep time series models: a comprehensive survey and benchmark\.IEEE Transactions on Pattern Analysis and Machine Intelligence\.Cited by:[§1](https://arxiv.org/html/2606.04599#S1.p1.1),[§4\.1](https://arxiv.org/html/2606.04599#S4.SS1.SSS0.Px1.p1.1)\.
- J\. Wyatt, A\. Leach, S\. M\. Schmon, and C\. G\. Willcocks \(2022\)Anoddpm: anomaly detection with denoising diffusion probabilistic models using simplex noise\.InProceedings of the IEEE/CVF conference on computer vision and pattern recognition,pp\. 650–656\.Cited by:[§B\.1](https://arxiv.org/html/2606.04599#A2.SS1.p1.1),[§2](https://arxiv.org/html/2606.04599#S2.SS0.SSS0.Px1.p1.1)\.
- J\. Xu, H\. Wu, J\. Wang, and M\. Long \(2022\)Anomaly transformer: time series anomaly detection with association discrepancy\.InInternational Conference on Learning Representations,Cited by:[§2](https://arxiv.org/html/2606.04599#S2.SS0.SSS0.Px1.p1.1)\.
- T\. Yang, J\. Liu, M\. Siu, J\. Wang, Z\. Qian, C\. Song, C\. Cheng, X\. Hu, and Y\. Zhao \(2025a\)AD\-agent: a multi\-agent framework for end\-to\-end anomaly detection\.InProceedings of the 14th International Joint Conference on Natural Language Processing and the 4th Conference of the Asia\-Pacific Chapter of the Association for Computational Linguistics,pp\. 191–205\.Cited by:[§B\.2](https://arxiv.org/html/2606.04599#A2.SS2.p3.1),[Table 3](https://arxiv.org/html/2606.04599#A2.T3.1.1.1.1.3),[§1](https://arxiv.org/html/2606.04599#S1.p3.1),[§2](https://arxiv.org/html/2606.04599#S2.SS0.SSS0.Px2.p1.1)\.
- X\. Yang, E\. Howley, and M\. Schukat \(2025b\)Agent\-based dynamic thresholding for adaptive anomaly detection using reinforcement learning\.Neural Computing and Applications37\(23\),pp\. 18775–18791\.Cited by:[§B\.2](https://arxiv.org/html/2606.04599#A2.SS2.p2.1),[§2](https://arxiv.org/html/2606.04599#S2.SS0.SSS0.Px2.p1.1)\.

## Appendices

#### Appendices Content

## Appendix AImplementation Details of Efficient Experience Reuse

This section further clarifies the scope and implementation of the experience reuse mechanism introduced in Section[3\.2](https://arxiv.org/html/2606.04599#S3.SS2)\. The memory module is implemented as an exact\-match hash table rather than a vector database\. Given a normalized task descriptionrrand dataset schemaDD, the system computes deterministic fingerprintsH​\(r\)H\(r\)andH​\(D\)H\(D\)and uses them as lookup keys for previously generated SOPs and data profiles, respectively\.

The reuse mechanism follows a lookup\-first protocol\. IfH​\(r\)H\(r\)yields a cache hit, the corresponding SOPwwis directly loaded, and the Consultant Agent is skipped\. IfH​\(D\)H\(D\)yields a cache hit, the stored data profile𝐦\\mathbf\{m\}is reused, and the Data Inspector Agent is skipped\. If either key is not found, the corresponding artifact is regenerated through the standard DMAIC workflow and then inserted into memory for future reuse\. This design also supports partial reuse: for example, an existing SOP can be reused for a recurring industrial scenario even when the dataset schema is new, while a data profile can be reused when the same dataset schema appears under a slightly different task description\.

The claimedO​\(1\)O\(1\)complexity specifically refers to the average\-case retrieval complexity of the proposed hash\-based experience reuse mechanism, rather than the runtime complexity of the entire pipeline\. In our lightweight mode, each recurring task is represented by deterministic fingerprints of the task description and dataset schema, denoted asH​\(r\)H\(r\)andH​\(D\)H\(D\), respectively\. These fingerprints are used as keys in a hash\-table memory:

ℳ=\{H​\(r\)↦w\}∪\{H​\(D\)↦𝐦\},\\mathcal\{M\}=\\\{H\(r\)\\mapsto w\\\}\\cup\\\{H\(D\)\\mapsto\\mathbf\{m\}\\\},wherewwdenotes the previously generated SOP and𝐦\\mathbf\{m\}denotes the corresponding data profile\. Given a new task, our system first computes its fingerprints and directly queries the hash table\. Under the standard average\-case assumption of hash\-table access, checking whetherH​\(r\)H\(r\)orH​\(D\)H\(D\)exists in memory and retrieving the associated SOP or data profile requires constant time, i\.e\.,O​\(1\)O\(1\), independent of the number of previously stored experiences\.

## Appendix BRelated Work

Table 3:Comparison of anomaly detection agents across modalities and modulars\. ✓: explicitly supported and evaluated; ✗: not supported or not considered\.AD\-AGENTYanget al\.\([2025a](https://arxiv.org/html/2606.04599#bib.bib17)\)AutoIADJiet al\.\([2025a](https://arxiv.org/html/2606.04599#bib.bib18)\)OursTime Series✓✗✓Tabular✓✗✓Graph✓✗✓ModalityImage✗✓✓Knowledge✗✗✓Data Profile✗✓✓Strategy Generation✓✓✓Strategy Evaluation✗✗✓ModularCode Generator✓✓✓

### B\.1Conventional Industrial Anomaly Detection

Industrial anomaly detection has been extensively studied, particularly under unsupervised settings where only normal data are available for trainingChalapathy and Chawla \([2019](https://arxiv.org/html/2606.04599#bib.bib7)\); Ruffet al\.\([2021](https://arxiv.org/html/2606.04599#bib.bib8)\)\.Existing methods can be broadly categorized into reconstruction\-based and feature embedding\-based approaches\. Reconstruction\-based methods detect anomalies through reconstruction or prediction errors using autoencoders, recurrent models, or, more recently, diffusion modelsSakurada and Yairi \([2014](https://arxiv.org/html/2606.04599#bib.bib10)\); Parket al\.\([2018](https://arxiv.org/html/2606.04599#bib.bib11)\); Wyattet al\.\([2022](https://arxiv.org/html/2606.04599#bib.bib12)\)\. Feature embedding\-based methods identify anomalies by measuring deviations in learned representation spaces, such as memory bank approaches and normalizing flow\-based density estimationRothet al\.\([2022](https://arxiv.org/html/2606.04599#bib.bib13)\); Kirichenkoet al\.\([2020](https://arxiv.org/html/2606.04599#bib.bib14)\)\. Beyond these paradigms, forecasting\-based and graph\-based models have also been explored to capture temporal dynamics and relational dependencies in industrial systemsHundmanet al\.\([2018](https://arxiv.org/html/2606.04599#bib.bib15)\); Lvet al\.\([2023](https://arxiv.org/html/2606.04599#bib.bib16)\)\.

Despite strong performance in constrained environments, most deep learning\-based industrial anomaly detection methods remain model\-centric and scenario\-dependent, often requiring careful model design and retraining for each specific setting\. This limits their scalability, adaptability, and generalization across heterogeneous industrial scenariosChalapathy and Chawla \([2019](https://arxiv.org/html/2606.04599#bib.bib7)\); Liet al\.\([2025](https://arxiv.org/html/2606.04599#bib.bib9)\)\.

### B\.2Agentic System for Anomaly Detection

Early agent\-based methods for anomaly detection focused on distributed monitoring, where agents observe system states and trigger alarms upon detecting abnormal behaviorsMcArthuret al\.\([2005](https://arxiv.org/html/2606.04599#bib.bib29)\)\. Subsequent works extended this paradigm to multi\-agent systems, enabling collaboration among specialized agents to improve robustness and scalability in complex industrial environmentsGarcía \([2019](https://arxiv.org/html/2606.04599#bib.bib28)\)\.

More recently, large model empowered agentic systems have emerged as a promising paradigm, enabling agents to reason, plan, and collaborateSuet al\.\([2025](https://arxiv.org/html/2606.04599#bib.bib39)\)\. There are some works that leverage LLMs or LVMs for IAD\. In the time series area, ArgosGuet al\.\([2025](https://arxiv.org/html/2606.04599#bib.bib22)\)utilizes LLMs for autonomous rule generation, ADTYanget al\.\([2025b](https://arxiv.org/html/2606.04599#bib.bib20)\)uses reinforcement learning to realize thresholding control, and MAS\-LSTMQinet al\.\([2025](https://arxiv.org/html/2606.04599#bib.bib21)\)proposes a LSTM\-based multi\-agent system for IoT datasets\. As for the vision scenario, AgentIADMiaoet al\.\([2025](https://arxiv.org/html/2606.04599#bib.bib19)\)uses LVM for multi\-stage visual inspection\. Besides, LEMADJiet al\.\([2025b](https://arxiv.org/html/2606.04599#bib.bib23)\)proposes a multi\-agent system for Power Grid Services to process log anomaly detection\. PARAMHarbola and Purwar \([2025](https://arxiv.org/html/2606.04599#bib.bib24)\)uses rag for data knowledge retrieval and utilizes a pretrained LLM to realize anomaly detection\. These works use LLM as a specific processor without considering using a specific model for different scenarios\.

Representative frameworks such as AD\-AGENTYanget al\.\([2025a](https://arxiv.org/html/2606.04599#bib.bib17)\)and AutoIADJiet al\.\([2025a](https://arxiv.org/html/2606.04599#bib.bib18)\)construct end\-to\-end pipelines that autonomously generate executable code for diverse industrial scenarios\. As shown in Table\.[3](https://arxiv.org/html/2606.04599#A2.T3), AD\-AGENT proposes a selection model, then code generation and optimizing parameters\. It focuses on the optimization step to get better parameters\. AutoIAD decomposes the data analysis process into its work, augmenting data preparation, data loading, model design, and the training process\. They put their attention on the realization process, instead of decision\-making\.

## Appendix CNotation

Table 4:Summary of Notation in the DMAIC\-Agentic Framework
## Appendix DEvaluation Metrics

### D\.1Area Under the Receiver Operating Characteristic Curve \(AUROC\)

The Receiver Operating Characteristic \(ROC\) curve is a graphical representation used to illustrate the diagnostic ability of a binary classifier system as its discrimination threshold is varied\. The curve is created by plotting the True Positive Rate \(TPR\), also known as recall or sensitivity, against the False Positive Rate \(FPR\) at various threshold settings\. The TPR is the ratio of correctly predicted positive observations to all actual positives, while the FPR is the ratio of incorrectly predicted positive observations to all actual negatives\. The Area Under the ROC Curve \(AUROC\) quantifies the overall performance of the classifier\. It represents the probability that the classifier will rank a randomly chosen positive instance higher than a randomly chosen negative one\. An AUROC of 1\.0 indicates a perfect classifier, while an AUROC of 0\.5 suggests a classifier with no discriminative ability, equivalent to random guessing\. The AUROC is defined by the integral of the ROC curve:

AUROC=∫01TPR​\(FPR−1​\(t\)\)​𝑑t\\text\{AUROC\}=\\int\_\{0\}^\{1\}\\text\{TPR\}\(\\text\{FPR\}^\{\-1\}\(t\)\)\\,dt
WhereTPR​\(FPR−1​\(t\)\)\\text\{TPR\}\(\\text\{FPR\}^\{\-1\}\(t\)\)represents the ROC curve\.

### D\.2Area Under the Precision\-Recall Curve \(AUPRC\)

The Precision\-Recall \(PR\) curve is another critical evaluation metric for binary classification, which plots precision against recall \(or TPR\) for different thresholds\. Precision is the ratio of correctly predicted positive observations to the total predicted positives, and recall is the same as TPR\. The Area Under the PR Curve \(AUPRC\) summarizes this plot into a single value\. Unlike AUROC, AUPRC is particularly informative when dealing with imbalanced datasets, where the number of negative samples significantly outweighs the number of positive samples\. This is because the calculation of precision does not take into account the number of true negatives, focusing instead on the model’s performance on the positive class\. A higher AUPRC value indicates a better\-performing classifier, with 1\.0 being the ideal score\. The AUPRC is calculated as the area under the PR curve:

AUPRC=∫01P​\(r\)​𝑑r\\text\{AUPRC\}=\\int\_\{0\}^\{1\}P\(r\)\\,dr
WhereP​\(r\)P\(r\)is the precision as a function of recallrr\.

## Appendix EExperiment: Comparison with Modality\-Specific Baselines

To further evaluate the effectiveness of our framework across different data modalities, we compare our method with representative modality\-specific anomaly detection baselines\. Specifically, we use SVC \(One Class SVM\) for tabular data, GNN\-based models for graph data, LSTM\-based models for time\-series data, and AutoEncoder\-based models for image data\. Table[5](https://arxiv.org/html/2606.04599#A5.T5)summarizes the comparison between these modality\-specific baselines and our full framework\.

As shown in Table[5](https://arxiv.org/html/2606.04599#A5.T5), our method achieves better performance than modality\-specific baselines on most datasets, especially on graph, time\-series, and image anomaly detection tasks\. Although the SVC baseline slightly outperforms our method on the vertebral dataset, our framework demonstrates more consistent adaptability across heterogeneous modalities without manually selecting a fixed algorithm for each task\.

Table 5:Comparison with modality\-specific baselines across different modalities\. All results are reported in percentage \(%\)\. The better result between the modality\-specific baseline and our method is highlighted in bold\.
## Appendix FExperiment: Parameters and Prompt

In order to further analyze the influence of key design choices, we conduct a parameter experiment on the MetalNut dataset\. Specifically, we evaluate the effects of prompt design, the number of generated candidate strategies, and the hidden dimensiondmodeld\_\{\\text\{model\}\}of the Judge Model\. The default setting of our framework uses 10 candidate strategies and setsdmodel=128d\_\{\\text\{model\}\}=128\.

As shown in Table[6](https://arxiv.org/html/2606.04599#A6.T6), the default configuration achieves the best performance, indicating that both sufficient strategy diversity and an appropriately sized Judge Model are important for effective strategy selection\. Compared with the simple prompt, the structured prompt used in our framework brings clear improvements, demonstrating the benefit of explicitly guiding the agent with task\-specific reasoning procedures\. Increasing the number of strategies from 1 to 5 improves performance, while using 10 strategies further enhances the results by providing a richer candidate pool for the Judge Model\. For the Judge Model architecture,dmodel=128d\_\{\\text\{model\}\}=128performs better than both smaller and larger dimensions, suggesting that an overly small model may lack sufficient representation capacity, while an overly large model may introduce unnecessary complexity\.

Table 6:Parameter experiment on the MetalNut dataset\. We evaluate the effects of prompt design, the number of generated strategies, and the hidden dimensiondmodeld\_\{\\text\{model\}\}of the Judge Model\.
## Appendix GCase Study

Literature\-Based SOP for MVTec Tile DatasetRequirement Summary:Analyze the MVTec Tile dataset for texture\-based anomaly detection\.•Type:Building materials / Surface texture\.•Anomalies:Cracks, bubbles or pits, color differences, edge chipping\.•Characteristics:Normal samples have repetitive patterns; anomalies are structural damage\. Suited for feature matching or reconstruction methods\.Generated Standard Operating Procedure \(SOP\):•Scenario:Anomaly detection for tile surface texture dataset\.•Data Description:Image dataset of tile surfaces with repetitive patterns\. Normal samples exhibit consistent textures, while anomalies include structural damages\.Operation Steps:Step 1:Data Preprocessing and Tiling:Segment the input images into smaller tiles to enhance the detection of local anomalies, as described in\.Step 2:Texture Feature Extraction:Extract texture features using procedural texturing workflows and stochastic texturing methods to capture repetitive patterns\.Step 3:Reconstruction\-Based Anomaly Detection:Implement reconstruction\-based methods, training a model on normal samples\. Techniques like tiled diffusion can be adapted\.Step 4:Feature Matching for Anomaly Detection:Apply feature matching to compare test sample features against a memory bank of normal features, potentially using tools like Bitmap2Material\.Step 5:Calibration and Evaluation:Calibrate the detection system, drawing inspiration from methods like the ATLAS Tile Calorimeter calibration \[Paper Search Results\], and evaluate using statistical metrics\.Recommendations:•Preprocessing:Use tiling to segment images for texture\-based models\.•Feature Extraction:Leverage procedural and stochastic texturing methods\.•Modeling:Adopt a hybrid approach combining reconstruction\-based \(e\.g\., tiled diffusion\) and feature\-matching methods\.•Evaluation:Calibrate the system and evaluate using reconstruction error and feature matching accuracy\.Figure 6:An example of a SOP generated for the Tile dataset\.Data Profile for MVTec Tile DatasetRequirement Summary:Analyze the MVTec Tile dataset for texture\-based anomaly detection\.•Type:Building materials / Surface texture\.•Anomalies:Cracks, bubbles or pits, color differences, edge chipping\.•Characteristics:Normal samples exhibit repetitive patterns, while anomalies are mainly structural damage\. Suited for feature matching or reconstruction methods\.Generated Data Profile:•Task Type:classification\(Binary\)•Data Type:Image•Supervision:Supervised \(due to presence of labels\)\.•Label Information:–Training Set:Contains 230 samples, all are normal \(label 0\)\.–Test Set:Contains 117 samples, composed of 33 normal \(label 0\) and 84 anomalous \(label 1\) samples\.•Keywords:tile,surface,anomaly,texture,detection•Insights Summary:The dataset is structured for a binary classification task where the training set contains only normal samples, and the test set is imbalanced with both normal and anomalous samples\. This setup is typical for evaluating supervised anomaly detection methods that learn a model of normalcy from a "clean" training distribution\. Although the domain is texture anomaly detection, the availability of explicit labels defines the technical task as classification\.Figure 7:The data profile automatically generated by our Data Inspector agent for the MVTec Tile dataset\. It correctly identifies the task structure, label distribution, and key characteristics, providing a foundation for subsequent strategy generation\.Example of an LLM\-Generated Execution Strategy \(for Tile Dataset\)User Requirement:Analyze the Tile image anomaly detection dataset from MVTec AD\.•Dataset Type:Texture category \(building materials\)\.•Image Resolution:Approx\. 640×\\times640 pixels\.•Common Anomaly Types:Cracks, bubbles or pits, color differences, edge chipping\.•Characteristics:Normal samples have repetitive patterns; anomalies are mostly structural\. Suitable for reconstruction\-based or feature matching methods\.Generated Execution Steps:Step 1:Data Preprocessing•Method:Tiling\_128x128\_stride64•Parameters:–Tile Size: \[128, 128\], Stride: \[64, 64\] \(50% overlap\)\.–Notes:Segment image into overlapping tiles to capture anomalies spanning boundaries\. Tile coordinates are kept for later score aggregation\.Step 2:Feature Extraction•Method:WideResNet50\_patch\_features•Parameters:–Backbone: WideResNet50 \(pretrained on ImageNet\)\.–Output Layer: layer3 \(1024\-dim\)\.–Pooling: Spatial\-average pooling\.–Notes:Extract per\-tile deep patch descriptors to capture local texture patterns, leveraging pretrained feature priors\.Step 3:Anomaly Algorithm•Method:PatchCore•Parameters:–Memory Bank: Built via coreset sampling \(1% ratio\) from normal tiles\.–Distance Metric: Cosine distance with k=1 neighbor\.–Thresholding: Calibrated on a validation set of normal tiles \(99th percentile\)\.–Aggregation: Per\-tile scores aggregated to image\-level via max\-pooling\.–Notes:Use Faiss for fast nearest neighbor search\. Train the memory bank on features from normal tiles only\.Figure 8:A detailed execution strategy generated by our framework for the MVTec Tile dataset\. The plan specifies a concrete sequence of methods, from tiling and feature extraction with WideResNet50 to anomaly detection using PatchCore, including key hyperparameters\.In the Define phase, the IAD Consultant identifies the MVTec Tile dataset as a texture\-based surface inspection task by retrieving domain\-specific knowledge\. As illustrated in the SOP Display \(Fig\.[6](https://arxiv.org/html/2606.04599#A7.F6)\), the generated Standard Operating Procedure \(SOP\) formalizes essential workflows tailored to tile surfaces, prioritizing structural damage detection \(e\.g\., cracks, pits\) through a combination of procedural tiling and hybrid reconstruction\-feature matching strategies\.

During the Measure phase, the Data Inspector profiles the dataset, confirming its status as an unsupervised learning problem characterized by a "clean" training set composed entirely of normal samples \(as detailed in Fig\.[7](https://arxiv.org/html/2606.04599#A7.F7)\)\. This profiling clarifies the task structure, confirming that despite the presence of labels, the dataset is optimized for learning normalcy from a distribution of anomaly\-free samples\.

Based on these constraints, the Analyze phase involves the Strategist formulating a concrete execution plan\. As shown in Fig\.[8](https://arxiv.org/html/2606.04599#A7.F8), the strategy leverages a PatchCore framework, specifically configured with a WideResNet50 backbone to balance spatial resolution and high\-level semantics\. Key hyperparameters, such as128×128128\\times 128overlapping tiling and the utilization of Layer 3 features, are explicitly defined to optimize local texture analysis\.

The Improve phase then features an execution\-free Judge Model that evaluates these candidate plans, validating the PatchCore framework for its computational efficiency and suitability for this specific texture profile without requiring costly runtime trials\. Finally, the Control phase concludes with the IAD Executor generating the corresponding executable code and a comprehensive, auditable detection report\.

## Appendix HLarge Language Model Configuration

The pipeline delegates four language\-model stages: pre\-analysis, SOP synthesis, meta\-planning, and code generation \(including per\-step agents that share the code\-generation backend\)\. Table[7](https://arxiv.org/html/2606.04599#A8.T7)summarizes the deployed model identifiers, API vendors, completion budgets, and stage responsibilities\. Pre\-analysis and SOP generation usegpt\-4ovia the OpenAI API with a maximum output length of 4,096 tokens\. The default meta\-planner isgpt\-5\-mini\(8,192 tokens\), which emits structured JSON plans covering preprocessing, feature extraction, the anomaly\-detection algorithm, and evaluation metrics\. All executable Python—full pipelines and step\-level modules—is produced byclaude\-sonnet\-4\-5through the Anthropic API \(8,192 tokens\)\. For each dataset run we generateK=10K\{=\}10alternative plans; inter\-plan diversity is enforced by prompt\-level variant constraints and by conditioning each new plan on methods already chosen in previous variants, rather than by varying decoding hyperparameters at the planner\.

Sampling controls differ across API generations\. Stages implemented with Anthropic Claude and with OpenAI GPT\-4o for pre\-analysis and SOP use deterministic decoding with temperatureτ=0\\tau\{=\}0\. For planner ablations on OpenAI GPT\-3\.5 and GPT\-4–family models \(gpt\-3\.5\-turbo,gpt\-4o\-mini\), the provider exposes a temperature parameter; in our experiments we setτ=1\\tau\{=\}1\(the value supported for these endpoints in our deployment\)\. In contrast, newer OpenAI planner backbones in the GPT\-5 family \(gpt\-5\-mini,gpt\-5\.2\) do not accept user\-specified temperature in our integration: the client omits the field and the service applies its fixed default decoding policy\. We therefore mark planner temperature as not applicable \(“–”\) in Table[7](https://arxiv.org/html/2606.04599#A8.T7)and report planner comparisons primarily in terms of model identity and completion budget \(Table[8](https://arxiv.org/html/2606.04599#A8.T8)\), holding non\-planner stages fixed\.

Table 7:Large language model settings for the multi\-agent anomaly\-detection pipeline\.Pipeline stageModel IDAPIMax\. output tokensTemp\. \(τ\\tau\)RoleData Inspectorgpt\-4oOpenAI4,0960\.0Infer task type, schema, and data\-quality summary from user requirement and sample statistics\.IAD Consultantgpt\-4oOpenAI4,0960\.0Produce method\-level SOP guidance conditioned on pre\-analysis\.Strategist \(default\)gpt\-5\-miniOpenAI8,192\-Emit JSON execution plans \(preprocessing, features, algorithm, metrics\)\.Code generation agentclaude\-sonnet\-4\-5Anthropic API8,1920\.0Generate standalone Python implementing each plan; step agents share this backend\.Multi\-plan setting:K=10K=10plans per run\.

Table 8:Planner\-only LLM variants for ablation \(other stages fixed as in Table[7](https://arxiv.org/html/2606.04599#A8.T7)\)\.
## Appendix IAgent Prompt

### I\.1IAD Data Inspector

SystemPrompt:

Youareadataanalysisexpert\.Infertask\_typefromuserrequirement\+datasamples\.

RULE:Datastructurefirst\.Tasktypebylabelstructure:

\-train\_label\_unique=1classANDtest\_label\_unique=2classes\-\>anomaly\_detection\(one\-class:trainonlynormal,testhasnormal\+anomaly\)

\-Onelabelcolumn,\>2classes\-\>multi\_class\_classification

\-Multiplebinarylabelcolumns\-\>multi\_label\_classification

\-Onebinarylabelcolumn\(bothtrain&testhave2classes\)\-\>classification

\-Continuoustarget\-\>regression

\-Nolabelcolumn/unlabeled\-\>anomaly\_detection

OutputJSONonly:\{"task\_type":"\.\.\.","scenario\_keywords":\["kw1",\.\.\.\],"additional\_info":"\.\.\."\}

scenario\_keywords:3\-5domainkeywordsforpapersearch\.Noextrakeys,notextoutsideJSON\.

\[System\]

\{self\.\_system\_prompt\}

\[User\]

Userrequirementdescription:

\{requirement\}

Datainformation:

\{data\_infoifdata\_infoelse"Nodataprovided"\}

Important:PleasedeterminethetasktypebasedontheDATASTRUCTUREfirst\(especiallywhethertherearelabelcolumnsandhowmanydistinctlabelvalues\),thenconsidertherequirementdescription\.

OutputJSON:task\_type,is\_supervised,scenario\_keywords\(3\-5domainkeywords\),additional\_info\.OutputonlyJSON\.

### I\.2IAD Consultant Agent Prompt

YouareanSOP\(StandardOperatingProcedure\)generatorforanindustrialanomalydetectionsystem\.

Task:Generatestandardizedoperatingguidelines\(SOPguide\)basedonsearchresults\(websearchandpapersearch\)andinputinformation\.

Outputformat:JSONformatcontainingstructuredoperationstepsandrecommendations\.

CRITICALREQUIREMENTS:

\-YouMUSTbasetheSOPguidePRIMARILYontheprovidedsearchresults\(websearchandpapersearchresults\)

\-Theoperationstepsshouldreflectmethods,workflows,andapproachesfoundinthesearchresults

\-Stepscanbearrangedflexiblybasedonthesearchresults\-youdoNOTneedtofollowafixedorder\(preprocessing\-\>featureextraction\-\>anomalydetection\)

\-Youcanincludespecificmethodsortechniquesmentionedinthesearchresults

\-DONOToutputgenericorirrelevantinformationlike’precautions’or’best\_practices’thatarenotdirectlyrelatedtothesearchresults

\-Focusonactionable,specificstepsthatreflecttheknowledgefromsearchresults

OutputJSONstructure:

\{

"scenario":"briefscenariodescription",

"data\_description":"briefdatadescription",

"operation\_steps":\[

\{

"step\_id":"step\_1",

"step\_name":"stepname\(shouldreflectmethodsfromsearchresults\)",

"description":"detaileddescriptionbasedonsearchresults",

"order":1

\}

\],

"recommendations":\{

"data\_preprocessing":"recommendationsbasedonsearchresults\(ifapplicable\)",

"feature\_extraction":"recommendationsbasedonsearchresults\(ifapplicable\)",

"modeling":"recommendationsbasedonsearchresults\(ifapplicable\)",

"evaluation":"recommendationsbasedonsearchresults\(ifapplicable\)"

\}

\}

IMPORTANT:DoNOTinclude’precautions’or’best\_practices’fieldsintheoutput\.Onlyoutputthefieldsspecifiedabove\.

CONSTRAINTSforone\-class/MVTec\-styleimageanomaly:

\-scenario:Use’One\-classanomalydetection’or’Unsupervisedimageanomalydetection’,NOT’Classificationanomalydetection’

\-data\_description:Iftrainhas1classandtesthas2classes,state:train=normalonly,test=normal\+anomaly

\-feature\_extraction:PreferPatchCore\-style,pretrainedCNNpatchfeatures\.DoNOTrecommend’multi\-scaleself\-referencingtemplates’

\-modeling:PreferPatchCore,kNNonpatchfeatures,OneClassSVM\.DoNOTrecommendYOLOv5,YOLOv8orobjectdetectionmodels

\-Whentrain1classandtest2classes:forceanomaly\_detectiontask,avoidclassification/detectionmodels

### I\.3IAD Strategist Prompt

Thelistsbelowaresuggestions/references\.Youarefreetouseanymethodthatfitsthetaskanddata\(fromanylibrary:sklearn,pyod,xgboost,tslib,darts,etc\.\)\.SomeplansmayalreadyfollowSOP;youcanalsochooseothermethodsasyouseefit\.Theonlyhardrule:forgraphdatadoNOTusePyGOD\(pygod\);usegraph\_statistical\_features\+PyOD/sklearnoralternatives\.

Reference:FeatureExtractionMethods\(bydatatype\)

\-Imagedatasets\(MVTecAD,hazelnut,screw,metal\_nut,tile,transistor,etc\.\):PatchCore,CNN\_backbone,pretrainedCNNpatchfeatures\.DoNOTuseYOLOv5/YOLOv8orobjectdetectionmodels\.MVTecADisone\-class:train=normalonly,test=normal\+anomaly\.

\-Tabular/high\-dim:PCA,statistical\_features:usewhendimensionalityreductionorstatisticalaggregationisbeneficial\.

\-Graphdata:graph\_statistical\_features:extractnode/graph\-levelfeatures\(degree,clusteringcoefficient,centralityviaNetworkX\)andtreatastabular;thenuseanyanomalydetectionlibrary\(PyOD,sklearn,etc\.\)\.DONOTusePyGOD\(pygod\)package\.

\-Timeseries:PREFER"none"forfeature\_extraction\.TSLibmodels\(TimesNet,FEDformer,Autoformer,etc\.\)havebuilt\-infeaturelearninganddoNOTrequireexternalfeatureextractionorwindow\-basedstatisticalfeatures\.Onlyusetime\_series\_features/window\-basedfeaturesifNOTusingTSLibmodels\.

\-Generic:none:passthroughrawfeatureswhennospecialextractionisneeded\.

Reference:MethodsbyTaskType

ForAnomalyDetectionTasks\(task\_type:anomaly\_detection\)

\-Image\(MVTecADstyle\):PatchCore,kNNonpatchfeatures,OneClassSVM\.DoNOTuseYOLOv5/YOLOv8orobjectdetection\.

1\.PyOD\(Library:pyod\)

ApplicableDataType:MultivariateTabularData,GraphData\(afterfeatureextraction\)

Description:PythonOutlierDetection:acomprehensivelibrarywith40\+anomalydetectionalgorithms

Fortabular/numericdatapreferclassic,well\-establishedmethods:IsolationForest,LOF,OneClassSVM,COPOD,ECOD,ABOD,CBLOF,HBOS\(fastandrobust\)\.Deepmethods\(AutoEncoder,VAE,DeepSVDD\)areavailableforspecialcaseswhereclassicmethodsareinsufficient\.

AvailableModels:IsolationForest,LOF,OneClassSVM,COPOD,ECOD,ABOD,AutoEncoder,VAE,DeepSVDD,IForest,CBLOF,HBOS,FeatureBagging,LSCP,SUOD

ForGraphData:Usegraph\_statistical\_features\(NetworkX:degree,clustering,PageRank,etc\.\)toconvertgraphtotabular,thenapplyPyOD,sklearn,orotheranomalydetectionmodels\.AVOIDPyGOD\(pygod\):donotusepygodpackage\.

2\.TSLib\(Library:tslib\)\-PREFERREDFORTIMESERIESDATA

ApplicableDataType:TimeSeriesData\(msl,yahoo,psm,smap,smd,swat,etc\.\)

Description:DeeplearninglibraryfortimeseriesdevelopedbyTHUML\.Thesemodelshavebuilt\-infeaturelearninganddoNOTrequirepreprocessingorfeatureextractionsteps\.

PRIORITYMODELS\(usethesefirst\):

\-TimesNet\-Defaultchoiceforgeneral\-purposetimeseriesmodeling,stronggeneralizationacrossalltasks

\-FEDformer\-Frequency\-domaindecompositionwithTransformer,capturesglobalseasonalpatternsefficiently

\-Autoformer\-Auto\-correlationmechanism,competitiveinanomalydetection

OtherModels:Informer,iTransformer,TimeMixer,PatchTST,DLinear,TimeXer

IMPORTANTforTimeSeries:WhenusingTSLibmodels,setdata\_preprocessing=\["none"\]andfeature\_extraction=\["none"\]sincethesemodelslearnfeaturesinternally\.

3\.Scikit\-learn\(Library:sklearn\)

ApplicableDataType:TabularData

Description:General\-purposemachinelearninglibrary

AnomalyDetectionModels:IsolationForest,LocalOutlierFactor,OneClassSVM,EllipticEnvelope

ForClassificationTasks\(task\_type:classification,multi\_class\_classification,multi\_label\_classification\)

Scikit\-learn\(Library:sklearn\)

ApplicableDataType:TabularData

Description:Supervisedlearninglibrarywithawiderangeofclassifiers

AvailableModels:

LinearModels:LogisticRegression,SGDClassifier,Perceptron,PassiveAggressiveClassifier

Tree\-BasedModels:DecisionTreeClassifier,RandomForestClassifier,ExtraTreesClassifier

EnsembleMethods:GradientBoostingClassifier,AdaBoostClassifier,VotingClassifier,StackingClassifier

Others:SVC,KNeighborsClassifier,GaussianNB,MLPClassifier

ForRegressionTasks\(task\_type:regression\)

Scikit\-learn\(Library:sklearn\)

ApplicableDataType:TabularData

Description:Supervisedlearninglibrarywithregressionalgorithms

AvailableModels:

LinearModels:LinearRegression,Ridge,Lasso,ElasticNet,BayesianRidge

Tree\-BasedModels:DecisionTreeRegressor,RandomForestRegressor,ExtraTreesRegressor

EnsembleMethods:GradientBoostingRegressor,AdaBoostRegressor,HistGradientBoostingRegressor

Others:SVR,KNeighborsRegressor,MLPRegressor,GaussianProcessRegressor

ForForecasting/PredictionTasks\(task\_type:forecasting\)

TSLib\(Library:tslib\)

ApplicableDataType:TimeSeriesData

Description:Deeplearninglibraryspecializedfortimeseriesforecasting

AvailableModels:Autoformer,Informer,TimesNet,iTransformer,TimeMixer,PatchTST,DLinear,FEDformer,TimeXer

Scikit\-learn\(Library:sklearn\)

ApplicableDataType:TimeSeriesData\(simplecases\)

Description:Canbeusedforbasictimeseriesforecastingviasupervisedregressionmodels

AvailableModels:LinearRegression,Ridge,andotherstandardregressors

VARIANT\{variant\_index\}/\{total\_variants\}REQUIREMENTS

Rules:

1\.Eachcategory\(data\_preprocessing,feature\_extraction,anomaly\_algorithm\)mustuseEXACTLYONEmethod

2\.AtleastONEcategorymustuseaDIFFERENTmethodfrompreviousvariants

3\.Parameter\-onlychangesareNOTallowed\-mustchangemethodnames

4\.Diversityinpreprocessing/feature\_extraction:SomevariantsMAYusealternatives\(e\.g\.ResNet/WideResNetpatchfeatures,PatchCore\-stylebackbone\)\.DoNOTuseYOLOv5/YOLOv8orobjectdetectionmodelsforimageanomalydetection\.

Youareaplannerforamachinelearningsystem\.\{intro\}

\{context\}

\{variant\_guidance\}

\{sop\_middle\_block\}

\{efficiency\_block\}

PLANSTEPS

1\.data\_preprocessing:EXACTLYONEmethod\.Youmayuseanypreprocessingyoudeemappropriate\(e\.g\.none,MinMaxScaler,StandardScaler,fill\_median,orothers\)\."none"isoftenenoughwhentherearenospecialrequirements\.FortimeserieswithTSLibmodels:USE\["none"\]\.

2\.feature\_extraction:EXACTLYONEmethod\.Image:PatchCore,CNN\_backbone,pretrainedCNNpatchfeatures\(noYOLOv/objectdetection\)\.Graph:graph\_statistical\_features\.Tabular:PCA,statistical\_features\.DoNOTusePyGOD\(pygod\)forgraphs\.TSLib:USE\["none"\]\.

3\.anomaly\_algorithm:EXACTLYONEalgorithm\(matchtask\_type:supervised/unsupervised/time\_series\)\.Useanyalgorithmyouthinksuitable\(e\.g\.fromPyOD,sklearn,xgboost,tslib,darts,etc\.\)\.

Stepformat:step\_id,agent\_type,order,dependencies,methods\(EXACTLYONEpercategory\),method\_params

OutputJSON\(examplewithsimplepreprocessing/extraction\):

\{

"metrics":\["accuracy","precision","recall","f1\_score"\],

"steps":\[

\{"step\_id":"step\_1","agent\_type":"data\_preprocessing","order":1,"dependencies":\[\],"methods":\["none"\],"method\_params":\{"none":\{"notes":"Skippreprocessing\-userawdata"\}\}\},

\{"step\_id":"step\_2","agent\_type":"feature\_extraction","order":2,"dependencies":\["step\_1"\],"methods":\["none"\],"method\_params":\{"none":\{"notes":"Passthrough"\}\}\},

\{"step\_id":"step\_3","agent\_type":"anomaly\_algorithm","order":3,"dependencies":\["step\_2"\],"methods":\["RandomForestClassifier"\],"method\_params":\{"RandomForestClassifier":\{"n\_estimators":100,"max\_depth":10\}\}\}

\]

\}

METRICS

Include"metrics"field:classification/regression\-\>\["accuracy","f1\_score"\],anomaly\_detection\-\>\["precision","recall","f1\_score"\],forecasting\-\>\["mse","rmse","mae"\]

NOTES

\-methods:EXACTLYONEpercategory\(data\_preprocessing,feature\_extraction,anomaly\_algorithm\)\.Youarefreetochooseanymethod;referencelistsareforinspirationonly\.

\-DONOTusePyGOD\(pygod\)forgraphdata\.Usegraph\_statistical\_features\+PyOD/sklearnorotheralternatives\.

\-method\_params:\{"MethodName":\{"param":value\}\}or\{"none":\{"notes":"\.\.\."\}\}forskipsteps\.

\-Ifdata\_rows\>4,000andusingwindow\-basedfeatures,setwindow\_step\_seconds\>=5\.

\-Keepmodelsizemoderate:avoidextremelyhigh\-dimensionalhiddenlayers,featurevectorsortoolargen\_estimators;prefersmall/mediumconfigurationsforspeed\.

OutputonlyJSON\.

### I\.4IAD Code Generator Prompt

Youareacodegenerationexpert\.Generateacomplete,executablePythonscriptstrictlyfollowingtheplan,DONOTmodify,change,orusedifferentvaluesfortheseparameters\.

IMPORTANTOUTPUTRULE:

OutputONLYPythoncode\.

NOmarkdown,NOexplanationsoutsidecode\.

Startwithimportstatements,endwiththelastlineofcode\.

CRITICAL:TheoutputmustberawPythonsourcecodeonly\.DoNOTwrapitinMarkdowncodefences\.DoNOToutputlineslike‘‘‘pythonor‘‘‘anywhere\.

Thecontext\_infois:\{context\_info\}

Theerror\_hintis:\{error\_hint\}

======REQUIREMENTS\(MANDATORY\)

A\)SCRIPTMUSTBECOMPLETE&STANDALONE

IncludeALLnecessaryimportsandhelperfunctions\.

AttheVERYBEGINNINGofthescript,includeautomaticpackageinstallationlogicforuncommonpackages\.

Usetry\-exceptimportsforuncommonpackages;onImportError,auto\-installwithpipthenre\-import\.

Commonpackages\(e\.g\.,pandas,numpy,scikit\-learn,scipy\)maybeimporteddirectlywithoutinstallationlogic\.Onlyaddtry\-except\+installforpackagesNOTinthestandardscientificPythonstack\.

CRITICAL:Scikit\-learnVersionCompatibility

\-ForOneHotEncoder:Use’sparse\_output=False’\(NOT’sparse=False’\)\.The’sparse’parameterwasdeprecatedandreplacedwith’sparse\_output’inscikit\-learn\>=1\.2\.

\-Example:OneHotEncoder\(sparse\_output=False,handle\_unknown=’ignore’,drop=None\)

\-Alwaysuse’sparse\_output’insteadof’sparse’toensurecompatibilitywithmodernscikit\-learnversions\.

B\)PACKAGEINSTALLATION\(CRITICAL\)

Mustimplementinstall\_package\(\)andusesubprocess\+pip:subprocess\.check\_call\(\[sys\.executable,"\-m","pip","install",package\_name\]\)

Uncommonpackages\(examples\):skmultilearn,pyod,pygod,darts,imbalanced\-learn,etc\.

Pipnamemaydifferfromimportname\(e\.g\.,scikit\-multilearnvsskmultilearn\)\.

PyGODIMPORTRULE\(CRITICAL\)

Ifusepygod,importdetectorsONLYfrom’pygod\.detector’\(NOT’pygod\.models’\)\.Example:frompygod\.detectorimportDOMINANT

CRITICAL:NumPyVersionCompatibility

IfusingPyTorch/ultralytics,checkNumPyversionatscriptstartanddowngradeifNumPy\>=2\.0:

importnumpyasnp

ifint\(np\.\_\_version\_\_\.split\(’\.’\)\[0\]\)\>=2:

importsubprocess,sys,importlib

subprocess\.check\_call\(\[sys\.executable,"\-m","pip","install","numpy<2\.0","\-\-quiet"\]\)

importlib\.reload\(np\)

DothisBEFOREimportingPyTorch/ultralytics\.

C\)REQUIREDFUNCTIONS

Implementthesefunctions\(basedonplanstepsandmethods/params\):

DataPreprocessing:defpreprocess\_data\(df:pd\.DataFrame\)\-\>pd\.DataFrame

FeatureExtraction:defextract\_features\(df:pd\.DataFrame\)\-\>pd\.DataFrame

CRITICAL:Whencomputingstatisticalfeatures\(mean,std,median,min,max,quantiles,etc\.\),MUSTconvertDataFrametonumpyarrayfirst\(e\.g\.,feature\_matrix=df\[columns\]\.values\)thenusebatch/vectorizedoperations\(e\.g\.,np\.mean\(feature\_matrix,axis=1\)\)\.NEVERuserow\-by\-rowiteration\(iterrows\(\),apply\(\)withlambda\)forstatisticalcalculations\.

Forslidingwindowfeatureextraction:MUSTcreateallwindowindicesatonce\(e\.g\.,start\_indices=np\.arange\(0,n\_samples\-window\_size\+1,window\_step\);end\_indices=start\_indices\+window\_size\)thenbatchslicethefeaturematrix\.NEVERloopthroughwindowsonebyonetocreateslices\.Stackallwindowsinto3Darray\[n\_windows,window\_size,n\_features\]thencomputestatisticsalongaxis=1usingvectorizedoperations\.Forskew/kurtosisanddeltafeatures,computeacrossallfeaturesatonceusingvectorizednumpyoperations\.

Modeling:

Ifanomaly\_detection:defdetect\_anomalies\(X\)\-\>Tuple\[np\.ndarray,np\.ndarray\]returns\(anomaly\_labels,anomaly\_scores\)

Else\(supervisedtasks\):deftrain\_model\(X,y\)\-\>Any

CRITICALAPI&DATATYPERULES:

1\.PyGODvsPyODAPIDifference:

\-PyGODmodels\(e\.g\.,DOMINANT\):Use’decision\_score\_’\(singular\),returnstorch\.Tensor

\-PyODmodels:Use’decision\_scores\_’\(plural\),returnsnumpy\.ndarray

\-Example:anomaly\_scores=model\.decision\_score\_\#forPyGOD

\-Example:anomaly\_scores=model\.decision\_scores\_\#forPyOD

2\.PyODAutoEncoderParameterNames\(CRITICAL\):

\-PyODAutoEncoderuses’hidden\_neuron\_list’\(NOT’hidden\_neurons’\)

\-PyODAutoEncoderuses’epoch\_num’\(NOT’epochs’\)

\-PyODAutoEncoderuses’lr’\(NOT’learning\_rate’\)

\-PyODAutoEncoderuses’optimizer\_name’\(NOT’optimizer’\)

\-PyODAutoEncoderuses’hidden\_activation\_name’\(NOT’activation’or’hidden\_activation’\)

\-Correctexample:

frompyod\.models\.auto\_encoderimportAutoEncoder

model=AutoEncoder\(

hidden\_neuron\_list=\[64,32\],\#NOThidden\_neurons

epoch\_num=100,\#NOTepochs

lr=0\.001,\#NOTlearning\_rate

optimizer\_name=’adam’,\#NOToptimizer

hidden\_activation\_name=’relu’,\#NOTactivation

batch\_size=32,

contamination=0\.1,

preprocessing=True,

device=None,

random\_state=42

\)

\-WRONG:AutoEncoder\(hidden\_neurons=\[64,32\],epochs=100\)\#TheseparameternamesdoNOTexist

\-AlwayscheckPyODdocumentationforcorrectparameternamesbeforeusing

3\.PyODVAEParameterNames\(CRITICAL\):

\-PyODVAEuses’encoder\_neuron\_list’\(NOT’encoder\_neurons’\)

\-PyODVAEuses’decoder\_neuron\_list’\(NOT’decoder\_neurons’\)

\-PyODVAEuses’lr’\(NOT’learning\_rate’\)

\-Correctexample:VAE\(encoder\_neuron\_list=\[32,16\],decoder\_neuron\_list=\[16,32\],lr=0\.001,epoch\_num=100,contamination=0\.05\)

\-WRONG:VAE\(encoder\_neurons=\[32,16\],decoder\_neurons=\[16,32\],learning\_rate=0\.001\)

4\.PyODModelsWITHOUTrandom\_state\(CRITICAL\):

\-COPOD,HBOS,ECODdoNOTsupport’random\_state’parameter\-doNOTpassit

\-WRONG:COPOD\(contamination=0\.05,random\_state=42\)\#TypeError

\-CORRECT:COPOD\(contamination=0\.05,n\_jobs=\-1\)

\-CORRECT:HBOS\(n\_bins=10,contamination=0\.05\)

\-CORRECT:ECOD\(contamination=0\.1\)

4b\.PyODCBLOFbetaparameter\(CRITICAL\):

\-CBLOFrequiresbetainrange\[1,2147483647\]\.DoNOTusebeta=0\.1oranyvalue<1\.

\-WRONG:CBLOF\(alpha=0\.9,beta=0\.1,\.\.\.\)\#ValueError:betaissetto0\.1\.Notintherangeof\(1,2147483647\)

\-CORRECT:CBLOF\(alpha=0\.9,beta=5,\.\.\.\)orbeta=1

5\.PyODECODcontamination\(CRITICAL\):

\-ECOD’contamination’MUSTbeafloat\(e\.g\.,0\.1\),NOTthestring’auto’

\-WRONG:ECOD\(contamination=’auto’\)\#AttributeError:’str’objecthasnoattribute’eval’

\-CORRECT:ECOD\(contamination=0\.1\)

6\.PyTorchTensortoNumPyConversion\(MANDATORY\):

\-PyGOD/PyTorchmodelsreturntorch\.Tensor,butnumpyfunctions\(np\.sum,np\.mean,etc\.\)requirenumpyarrays

\-ALWAYSconverttensorsbeforeusingnumpyfunctions:

iftorch\.is\_tensor\(anomaly\_labels\):

anomaly\_labels=anomaly\_labels\.cpu\(\)\.numpy\(\)

iftorch\.is\_tensor\(anomaly\_scores\):

anomaly\_scores=anomaly\_scores\.cpu\(\)\.numpy\(\)

\#Oruse:anomaly\_labels=np\.asarray\(anomaly\_labels\)

\-Example:np\.sum\(anomaly\_labels\)requiresanomaly\_labelstobenumpyarray,nottensor

7\.DataTypeConsistency:

\-Ensureallarrayspassedtosklearnfunctionshaveconsistentdtypes\(float32orfloat64\)

\-ConvertPyTorchtensorstonumpybeforesklearnoperations

\-Use\.astype\(np\.float32\)or\.astype\(np\.float64\)ifdtypemismatchesoccur

\{DATASET\_SPECIFIC\_SECTION\}

E\)TRAIN\-TESTSPLITRULES

CRITICAL:Thedataloaderalreadyreturnsseparatedtrain\_x,train\_y,test\_x,test\_y\.DONOTre\-splitthedata\.

IMPORTANTRULES:

1\.NEVERmergetrainandtestdatathenre\-split:Thedataloaderhasalreadyseparatedthedata\.Mergingandre\-splittingwould:

\-Causedataleakage\(testdatamaycontaintrainingsamples\)

\-Breaktheoriginaltrain/testdistribution

\-Leadtoincorrectevaluationresults

2\.Usetrainandtestdataseparately:

\-Forpreprocessing:Fitscalers/preprocessorsontrain\_df,thentransformtest\_df

\-Forfeatureextraction:Fitextractorsontrain\_df,thentransformtest\_df

\-Fortraining:Useprocessedtraindataonly

\-Forevaluation:Useprocessedtestdataonly

3\.Theis\_supervisedflagdetermineshowtohandlelabels:

\-is\_supervised=True:Extractlabelsfromtrain\_dfandtest\_df,useforsupervisedtraining/evaluation

\-is\_supervised=FalseorNone:Ignorelabels\(forunsupervisedanomalydetection\)

4\.Labelcolumnidentification:

\-Alldataloadersreturnlabelcolumnas’anomaly\_label’\(checkfor’anomaly\_label’,then’Normal/Attack’,then’label’,elseuselastcolumn\)

\-Extractlabelsfromtrain\_dfandtest\_dfseparately:train\_y=train\_df\[’anomaly\_label’\],test\_y=test\_df\[’anomaly\_label’\]

F\)EVALUATIONMETRICS\+JSONSAVE\(MANDATORY\)

Metricscomputationandtheexactevaluation\_metricsdictformataredefinedintheDATA\-MODALITY\-SPECIFICsectionbelow\(graph/image/numeric/time\_series\)\.Followthatsectionfor:

\-Howtocomputemetricsfor\{task\_type\}\(per\-classthenmacrofornumeric;binaryorforecastingforothers\)

\-Therequiredkeysandtypesforevaluation\_metrics

\-Savepath:result/metrics;filename:\{metrics\_timestamp\}\_\{dataset\_name\}\{plan\_suffix\}\.json\(useexact"\{metrics\_timestamp\}"and"\{plan\_suffix\}"fromplan\);json\.dump\(\.\.\.,indent=2,ensure\_ascii=False\);printthesavedfilepath\.

G\)RESULTSRETURN

main\_pipelinemustreturn:results\_dict\(singledictcontainingintermediateoutputsandfinalevaluation\_metrics\)\.

\{gpu\_instructions\}

=====TASKTYPE\+PLAN\(MUSTFOLLOW\)

TaskType:\{task\_type\}

IsSupervised:\{is\_supervised\}

Metricstocompute:\{metrics\}

PLANSTEPS\(implementeachstep’smethod\+method\_paramsinorder\):

\{plan\_steps\_json\}

GeneratethecompletePythoncodenow\.

Similar Articles