acceptodds
Under review as a conference paper at ICLR 2027

Pay for the Reasoning Once: Compiling Agent-Written Programs for Visual Anomaly Detection

Abstract

Agentic anomaly detectors invoke a vision-language model on every image they inspect, using tools that a human author must write in advance. We ask whether normal examples can instead support the construction and verification of reusable inspection code. ANP (Anchored Normality Programs) lets an agent compose visual primitives into executable checks, tests the candidates on held-out normal examples and controlled violations, and freezes the accepted checks with their fusion rule and calibration. On MVTec LOCO, the complementary ensemble ANP-E2 achieves 96.00% mean image-level AUROC, 8.50 percentage points above AnomalyMoE's reported result. The efficient ANP configuration achieves 94.34% mean AUROC. On the breakfast category, it requires 191.13 ms per image under our shared timing protocol with precomputed masks, corresponding to 8.78× and 47.32× speedups over our LogSAD and UniVAD executions. Neither configuration invokes a language model during inference. Controlled ablations of the efficient configuration attribute a gain of 2.87 AUROC percentage points to the verified program layer (95% CI [1.93, 3.84]); additional component ablations examine its role in the ensemble. Experiments across six benchmarks assess the scope of normal-only compilation, while acceptance and calibration audits characterise the evidence available before labelled defects are observed.

Primary area:
applications to computer vision, audio, language, and other modalities
Keywords:
visual anomaly detection, logical anomaly detection, program synthesis, agentic AI, normal-only learning, efficient inference

Reviews

Among:
Shape:
1234this paper, Top 15%
Figure 1. Mean review rating of the reviewed papers at ICLR 2027. This paper averages 3.00 over 2 reviews, above 85% of the others.
Reviewer_svHcOpenReview ↗
Rating
3
Confidence
4
Informativeness
2
Presentation
3
Soundness
2
Read review
Paper summary

This paper proposes Anchored Normality Programs (ANP), a framework that generates reusable executable inspection programs for visual anomaly detection through offline agent reasoning. Using only normal images, ANP generates class-specific checks, verifies them with validity-preserving and constraint-violating synthetic transformations, and refines them through execution feedback. Accepted programs are combined with existing visual anomaly detectors and calibrated for inference without online language model calls. Experiments on MVTec LOCO report 94.34% mean AUROC for ANP and 96.00% for its enhanced ensemble, with additional evaluations of verification, efficiency, and cross-domain applicability.

Critical strengths
  1. Well-motivated problem formulation and a distinctive verification framework. The paper clearly motivates the need to transform repeated per-image reasoning into reusable executable inspection programs, particularly when only normal training images are available. The proposed label-free acceptance mechanism provides a systematic way to verify generated programs using validity-preserving and constraint-violating transformations, integrating discriminative evaluation and execution feedback without requiring real anomaly labels.

  2. Comprehensive experimental evaluation and inference efficiency. The paper presents extensive experiments across multiple benchmarks and reports competitive anomaly detection performance. It also demonstrates reduced inference latency compared with several existing methods under the reported evaluation settings. Furthermore, detailed ablation studies examine program contributions, verification effectiveness, autonomous synthesis, and calibration, providing useful insights into the behavior and limitations of the framework.

Critical weaknesses
  1. Limited contribution of agent-generated programs to the headline performance. Although agent-written inspection programs are emphasized as a central contribution, the strong overall performance appears to be largely driven by existing visual detectors. On MVTec LOCO, ANP-E2 achieves 95.45% AUROC without any program branches, compared with 96.00% for the complete system. More importantly, removing only the agent-conditioned program reduces AUROC from 96.00% to 95.80%, indicating a marginal contribution of just 0.20 percentage points (Appendix B.4.1). Similarly, in the original ANP configuration, the agent-conditioned program contributes 0.77 points, whereas the expert-written reference accounts for 2.10 points of the total 2.87-point improvement. These results raise concerns about whether the reported performance sufficiently demonstrates the effectiveness of the proposed autonomous program generation framework, rather than the strength of the underlying detector composition.
Questions for authors
  1. Section 4.3 states that the final ANP configuration does not use program branches for breakfast box, juice bottle, and splicing connectors. Could the authors clarify why these three classes were excluded from program-based inspection?

  2. The proposed agent-written inspection programs appear particularly suitable for logical anomalies involving component counts, configurations, and spatial relationships. However, for structural or appearance anomalies, such as those in MVTec-AD and VisA, what additional benefits can these programs provide beyond existing visual anomaly detectors? Could the authors clarify the intended role and applicability of autonomous program generation in these settings?

Reviewer_ryc3OpenReview ↗
Rating
3
Confidence
2
Informativeness
2
Presentation
3
Soundness
2
Read review
Paper summary

This paper proposes Anchored Normality Programs (ANP), which compiles agent reasoning into reusable executable programs for visual anomaly detection. Programs are generated from normal examples, verified using controlled synthetic violations, and then frozen for deployment without online LLM calls. Experiments across six benchmarks demonstrate strong performance and improved inference efficiency.

Critical strengths
  1. The idea of compiling agent reasoning into reusable executable inspection programs is interesting and practically meaningful.
  2. The normal-only verification and execution-feedback mechanism provides a reasonable way to validate generated programs without labeled anomalies.
  3. The experiments are comprehensive, including extensive ablations, cross-domain evaluations, failure analysis, and efficiency comparisons.
  4. The method achieves strong anomaly detection performance while eliminating online LLM inference.
Critical weaknesses
  1. The normal-only verification relies heavily on the assumption that the predefined corruption grammar is representative of real anomalies. However, the paper itself reports cases where programs pass the proxy verification task but exhibit weak downstream discrimination, suggesting that success on synthetic violations does not necessarily translate to real anomalies.

  2. Although the paper emphasizes agent-written inspection programs, the agent still composes programs from a human-supplied library of visual primitives. This predefined library constrains the space of anomalies that the agent can discover and inspect, making the degree of autonomous tool creation somewhat limited. The authors also acknowledge this limitation.

  3. The headline 96.00% AUROC is achieved by ANP-E2, which incorporates additional detector components beyond the verified program layer. In contrast, the controlled no-program ablation attributes a +2.87 pp improvement to the program layer itself. The paper should more clearly distinguish the gain from program compilation from that obtained through additional ensembling.

Questions for authors

Refer to Weaknesses

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.