arXiv:2610.19610cs.CVOct 2026

Manuscript Offprint

arXiv:2610.19610

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

Haoxiang Rao, Fang Zhao, Zhao Wang, Weijia Li, Chenyang Si, Caifeng Shan

Abstract

Industrial anomaly detection (AD) is bottlenecked by the scarcity of anomalous samples, making high-fidelity anomaly synthesis crucial for improving downstream performance. However, existing methods either rely on scarce real anomaly references or auxiliary data, while lacking complex reasoning and iterative optimization capabilities for generating realistic defects in open-set scenarios. To address these challenges, we propose CORE, a cost-efficient and training-free prompt optimization framework based on Large Multimodal Models (LMMs), which unifies zero-shot and one-shot anomaly synthesis. CORE first introduces an Anomaly Context Grounding module to transform sparse user context into defect-aware generation context, which is subsequently instantiated as structured anomaly prompts that disentangle normal-region preservation from anomaly-specific variation, enabling controllable and faithful defect generation. Furthermore, CORE autonomously refines prompts through a self-supervised contrast-and-reflect mechanism. This design empowers general-purpose LMMs to synthesize realistic anomalies under both zero-shot and one-shot settings without task-specific training. Extensive experiments on MVTec-AD and VisA demonstrate that CORE synthesizes realistic and diverse anomalies, yielding superior improvements in downstream AD performance. Furthermore, its model-agnostic and plug-and-play paradigm enables effortless integration with diverse LMMs, facilitating adaptation to unseen open-set scenarios.

Introduction

Industrial anomaly detection (AD) plays a crucial role in inspection and quality control by identifying, localizing, and categorizing visual defects (Liu et al. 2024; Huang et al. 2025). However, industrial data suffer from severe data imbalance, where normal samples are abundant while anomalous samples are scarce. Although models trained (Li et al. 2024; Guo et al. 2025) solely on normal data can detect distributional deviations, their ability to localize and classify anomalies in complex scenarios remains limited due to insufficient modeling of real defect patterns. This motivates anomaly synthesis as an effective means to enrich defect distributions and improve supervised AD. Therefore, synthesizing realistic and diverse anomalies has emerged as a key strategy to enhance supervised AD.

Anomaly synthesis methods can be broadly categorized into zero-shot and few-shot settings according to the availability of real anomalous samples. Zero-shot methods are attractive for defect-scarce industrial scenarios (Zhang, Xu, and Zhou 2024; Sun et al. 2025), but early cut-paste strategies (Li et al. 2021; Zavrtanik, Kristan, and Skočaj 2021) often lack structural consistency and contextual realism. Recent diffusion-based approaches improve visual quality by leveraging pretrained generative priors, e.g., anomaly-related attention strengthen (Sun et al. 2025) or text-guided style transfer (So and Kang 2026). However, such internal guidance provides limited anomaly-specific knowledge, while Anomagic (Jiang et al. 2026) retrieves relevant anomalous pairs from purpose-built auxiliary data, as shown in Fig. 1(i), making its performance highly dependent on data quality and retrieval accuracy. These dependencies introduce substantial computational and data-preparation overhead, hindering efficient adaptation to open-set scenarios.

Few-shot methods leverage real anomalies to improve synthesis fidelity, yet training-based approaches are prone to overfitting when anomalies are extremely scarce (Hu et al. 2024; Dai et al. 2025). More practical one-shot training-free methods (Xu et al. 2025; Rao et al. 2026), as illustrated in Fig. 1(ii), use a single anomaly reference to guide generation, yet rely on anomaly masks for defect placement and remain sensitive to spatially implausible locations. Moreover, their limited ability to model logical and abstract anomalies restricts coverage of complex defects. These limitations motivate a unified framework capable of synthesizing realistic and diverse anomalies across zero-shot and one-shot settings.

Recent advances in Large Multimodal Models (LMMs) have demonstrated strong open-world visual understanding, reasoning, and generation capabilities (Wu et al. 2025; Deng et al. 2025; Seedream et al. 2025). Although LMMs have been explored for anomaly detection (Li et al. 2023; Gu et al. 2024), their potential for industrial anomaly synthesis remains underexplored. Due to limited domain-specific knowledge and weak sensitivity to fine-grained local defects, directly using general-purpose LMMs often fails to stably generate realistic, localized, and semantically accurate anomalies. To address these limitations, we propose CORE, a cost-efficient and training-free LMM-based framework that achieves high-fidelity anomaly synthesis via self-supervised prompt optimization.

As illustrated in Fig. 1(iii), CORE provides a unified training-free framework for both zero-shot and one-shot anomaly synthesis. In industrial inspection, anomalies typically manifest as local deviations from otherwise normal products. Accordingly, we formulate anomaly synthesis as an

†^{\dagger}Corresponding Authors.

Figure

Figure 1: Comparison of representative anomaly synthesis paradigms, where existing (i) zero-shot and (ii) one-shot methods are limited by their reliance on auxiliary datasets and scarce anomaly references, respectively, while (iii) CORE unifies both settings through self-supervised closed-loop optimization for realistic and generalizable anomaly synthesis.

image editing task to introduce plausible defect patterns into a given normal image without modifying its non-anomalous content. To enable controllable anomaly editing, CORE first grounds available visual and semantic contexts into defect-aware generation context, which is then instantiated as structured prompts. Following the normal-anomaly separability principle (Duan et al. 2025; Rao et al. 2026), CORE decomposes the generation prompt into three complementary parts: BASE to preserve normal content, VARIANT to specify anomaly-related variations, and NEGATIVE to suppress undesired artifacts and irrelevant modifications. To further improve generation quality, CORE introduces a contrasting-and-reflecting mechanism inspired by LLM-as-a-judge studies (Zheng et al. 2023; Wang et al. 2024; Yuksekgonul et al. 2025), forming a closed-loop optimization process.

In the zero-shot setting, the key challenge is optimizing anomaly prompts without access to real anomalous references. CORE addresses this challenge by observing that prompt quality can be reflected through the generated results: a well-designed anomaly prompt should simultaneously achieve semantic consistency, local defect realism, and faithful preservation of non-anomalous regions. Instead of relying on human annotations or real anomaly references, CORE derives self-supervised optimization signals by contrasting candidates generated from different prompts. The comparison results expose prompt-level weaknesses in semantic consistency, local realism, and preservation of normal regions, and the resulting reflective feedback is used to revise weaker prompts. In the one-shot setting, CORE incorporates a single real anomaly reference as a weak visual anchor for category-level realism rather than a template for direct replication. This enables the model to capture defect appearance and material interaction while avoiding overfitting to the reference's specific shape, location, or extent. In this way, CORE treats both generated outputs and limited anomaly references as feedback sources for prompt refinement, enabling realistic and diverse anomaly synthesis without task-specific training.

Our main contributions are summarized as follows:

• We propose CORE, a cost-efficient and training-free unified framework for both zero-shot and one-shot industrial anomaly synthesis, reducing reliance on real anomalies, finetuning, and auxiliary datasets.

• We introduce a contrasting-and-reflecting mechanism that converts generated results and limited references into self-supervised feedback for prompt optimization.

• Experiments on MVTec-AD and VisA demonstrate that CORE achieves superior generation quality and downstream AD performance, while enabling plug-and-play transfer across LMM backends and strong generalization to unseen objects in open-world scenarios.

References (40)