arXiv:2610.41199cs.CVOct 2026

Manuscript Offprint

arXiv:2610.41199

Beyond CLIP: Calibrated (Few-Shot) Defect Detection With System One Decision Models

Fadel M. Megahed, Ying-Ju Chen

ABSTRACT

Cameras and vision sensors are widely used for product and process inspection in manufacturing environments. Traditionally, this process required thousands of images of both nominal and defective products to train such models. Recent research shows that vision transformer (ViT) models, such as CLIP, can reduce this requirement to 50–100 images per nominal and defective class. However, collecting even 50 defective images can be difficult in high-yield or low-volume manufacturing processes.

In this paper, we examine the utility of two recently proposed structured decision models (Jev and Clef-Flash) in applications using as few as k = 2 reference images per class at inference. In the process, we provide three main contributions: (a) a framework for k-shot learning of these models for image classification/inspection applications; (b) an agentic approach for automatically refining the text descriptions that guide image classification in these decision models; and (c) an approach to calibrate the resulting defect probabilities to improve their reliability for inspection decisions. We test these contributions in five manufacturing case studies. Using two reference images per class, both Jev and Clef-Flash outperform CLIP's test accuracies with the same references (0.75–1.00 [Jev] and 0.71–0.99 [Clef-Flash] vs 0.67–0.84 [CLIP]). Furthermore, we show that our agentic refinement of text descriptions significantly improves accuracy across 6 of 8 model-application combinations, and our calibration approach reduces the Brier score in 13 of the 15 model-application configurations. To support the reproducibility of our work, we provide our replication code and have created the “decisions” package for evaluating additional models. We also provide a publicly available web app that allows practitioners to inspect their own images with no code.

Keywords: Clef-Flash, CLIP, computer vision, few-shot classification, industrial image inspection, Jev, System One models

1. INTRODUCTION

Computer vision has become an integral component of quality assurance in modern manufacturing environments [1], enabling 100% inspection of parts at high production speeds [2]. The standard approach is to train a custom model for each inspection task, which requires task-specific images and possibly annotations [3]. However, in Industry 4.0/5.0 environments, obtaining sufficiently large training image sets has become increasingly difficult since: (a) smart manufacturing systems tend to produce very few defective parts [4], which limits the availability of images of defective parts; and (b) the shift from mass production to mass customization and personalization [5] means that many product variants undergo too few production cycles to generate sufficiently large training datasets.

Large pretrained vision transformers offer a potential solution to this data bottleneck. Vision-language models, such as CLIP, pair a vision transformer image encoder with a text encoder and are pretrained on 400 million image-text pairs [6]. This enables zero-shot classification from text descriptions alone, without task-specific training images [3]. However, CLIP often fails as a zero-shot classifier in manufacturing applications since representative defect images are rare in its web-scale training data [7].

Using a few labeled reference images, Megahed et al. [7] improved CLIP's classification accuracy across several manufacturing case studies. For metallic pan surfaces, accuracy increased from 0.615 to 0.910 using 10 reference images per class. For stochastic textured surfaces (textiles), accuracy increased from 0.500 to 0.975 using 50 reference images per class. Smaller improvements were observed for 3D printing extrusion profiles (0.620 to 0.700) and automotive pipe staple assemblies (0.500 to 0.580), both using 50 reference images per class. Despite these gains, defect probabilities obtained by applying softmax to CLIP's similarity scores clustered near 0.5 for both nominal and defective images (FIGURE 1). This clustering suggests substantial uncertainty despite the observed high classification accuracies, raising questions about their reliability for decision-making.

Recently proposed structured decision models (also known

∗^{*}Corresponding author: fmegahed@miamioh.edu Draft of November 2, 2026.

Figure

FIGURE 1: Compression of CLIP-predicted defect probabilities across the manufacturing case studies of [7].

as System One models, such as Jev [8] and Clef-Flash [9] may address these limitations. These models can use input images and user-provided text descriptions to answer predefined questions by assigning probabilities to user-specified answer choices. We hypothesize that these properties can make them appealing for manufacturing inspection applications, where users can define their inspection criteria through text descriptions and specify a set of possible outcomes (e.g., nominal or defective). However, it is unclear whether these properties translate well to manufacturing applications that require limited reference images. It is also important to evaluate the reliability of their probability estimates under these conditions, where such estimates can inform decisions to accept, reject, or further inspect a product.

In this paper, we investigate the utility of two structured decision models, Jev and Clef-Flash, for image-based quality inspection using as few as k = 2 reference images per class. Specifically, we make three contributions:

(1) We develop a framework for k-shot learning with structured decision models for image classification and inspection applications. Our approach uses reference images at inference without requiring application-specific model training or fine-tuning.

(2) We introduce an agentic AI approach to automatically refine the text descriptions that guide image classification. This approach aims to improve classification accuracy while reducing the need to manually develop descriptions for different inspection tasks.

(3) We propose an approach to calibrate the obtained classification probabilities so they better reflect the uncertainty in the model's predictions.

We evaluate these contributions using five manufacturing case studies previously investigated in [7]. These cases cover metallic surfaces, 3D printing extrusion profiles, stochastic textured surfaces, automotive assemblies, and microstructure images. We compare Jev and Clef-Flash with CLIP in two main settings: (a) matched labeled-image budgets and (b) matched reference-image configurations. We also examine whether agentically refined text descriptions improve classification accuracy

and whether probability calibration reduces the Brier score.