Manuscript Offprint
arXiv:2610.41199Beyond CLIP: Calibrated (Few-Shot) Defect Detection With System One Decision Models
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 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.
2.1. Defining the Visual Inspection Task
Before defining our task, note that System One models do not produce text outputs. Instead, their outputs are currently limited to three or four decision types, commonly called primitives. For example, Jev (as of jev-1.13.0) supports [10]: (a) Noul, which provides only a binary response to a question (i.e., 0 or 1); (b) Choice, which is used to select from 2 or more predefined categories while providing the probabilities associated with each choice and a confidence score; and (c) Score, for assigning a position based on a predefined, ordered categorical level. More recently, Jev introduced an experimental Box primitive to identify object or region locations within an image [11]. In any case, to use these System One models, the user provides a question, the possible responses and their descriptions, and the input to be evaluated (e.g., an image). For visual inspection tasks, we assume these primitives support applications such as identifying defective products, classifying defect types, assessing defect severity, and locating defects within an image. In this paper, we focus on binary classification using the Choice primitive. However, our framework can also support multiclass classification (e.g., nominal-, defect 1-, or defect 2-type classification).
The first stage of our framework involves defining the inspection task by providing: (a) a question asking the model to classify an image as nominal or defective; (b) preliminary plain-language descriptions of the two classes; and (c) a few reference images illustrating each class. Let x denote an inspection image, the descriptions of nominal and defective appearances, and the set of (k) labeled reference images per class. For zero-shot applications, no reference images are provided (i.e., ). Given these inputs, the decision model (M) assigns a probability to each class. We use the probability assigned to the defective class as the raw defect score:
FIGURE 2(a) shows the first stage using the 3D printing extrusion application. In this example, we use two reference images per class ( ) and 48 development images per class (D).

FIGURE 2: Overview of our k-shot learning framework for using decision models (e.g., Jev and Clef-Flash) to inspect manufactured parts.
We provide the reference images to the decision model alongside each inspection image, and we use the development images in the second stage to evaluate and improve the initial class descriptions. Together, these images constitute the learning data (). Note that our approach does not retrain the decision model. Instead, we seek to improve its classification performance by refining the text descriptions while keeping the model's parameters fixed.
2.2. Agentic Description Refinement
The second stage attempts to address the question: "How can we (automatically) improve the semantic description of the System One model (if needed) when we do not know its underlying decision-making mechanisms?" We note that a description that is informative to manufacturing quality practitioners, or even to one System One model, may be suboptimal for another model. The problem is that the decision-making process of either open-weight or closed-weight models is essentially a black box. To address this question, we use an agentic AI loop inspired by the iterative, evaluation-driven process of autoresearch [12].
Our adaptation starts with a generic description of nominal
and defective images. The agent iteratively refines these descriptions using the labeled development dataset and feedback from the System One model. Specifically, for each candidate description pair , the model estimates the probability of a defect, , for each image , using the same reference images . An external scoring program calculates the area under the receiver operating characteristic curve (AUC) and summarizes the predicted defect probabilities by defect type. The AI agent then uses its built-in vision-language model to compare image–description pairs of misclassified and reference examples, revealing limitations in the current descriptions. To ensure meaningful gains and to reduce over-correction, we set a minimum AUC increase of 0.02 relative to the best-performing candidate. Algorithm 1 summarizes the proposed procedure, while FIGURE 2(b) illustrates its application to extrusion quality inspection.
2.3. Probability Calibration
The third stage of our framework addresses the need for reliable probability estimates in inspection decisions. As shown in FIGURE 2(c), we apply Platt scaling [13] to calibrate the raw
Algorithm 1 Agentic refinement loop of semantic descriptions
Require: Development data , reference set , decision model , initial descriptions , maximum candidates , minimum improvement
Ensure: Selected descriptions , evaluation history
1: Set ,
2: , ,
3: for do
▷ Evaluate the current descriptions
4: for all do
5:
6: end for
7:
8: Summarize by defect type
9: Record , , scores, and rationale in
▷ Retain meaningful improvements
10: if then
11:
12:
13: end if
14: if then
15: break
16: end if
▷ Propose change(s) to the class descriptions
17: Inspect poorly ranked images, scores, and
18: if no promising revision is identified then
19: break
20: end if
21: Propose by making a targeted revision to the class descriptions.
22: Document the rationale for the revision
23: end for
24: return
defect scores using a separate set of labeled images (). For each model–application–reference configuration, we estimate the calibrated defect probability as
where , is the raw defect score clipped to to avoid infinite logits, and and are parameters estimated from the calibration data. To improve numerical stability, we use smoothed calibration targets when estimating the Platt scaling parameters.
Note that the calibration images are independent of the data used to refine the class descriptions and are not used to select the reference images. We evaluate the fitted calibration function on the held-out test images (), assessing classification performance with the confusion matrix and the reliability of the estimated defect probabilities with the Brier score. Finally, we use isotonic regression as a sensitivity analysis to examine whether our results depend on the choice of calibration method [14].
2.4. Inference on Unseen Images
The final stage of our framework involves using the selected model configuration to inspect previously unseen images, as illustrated in FIGURE 2(d). For each new inspection image (), we provide the decision model with the selected class descriptions () and the same reference images () used during development. The resulting raw defect score is then transformed into a calibrated probability, , using the fitted calibration function from the previous stage. We classify an image as defective if and nominal otherwise. Note that the decision model, class descriptions, reference images, and calibration function are
fixed throughout this stage. Thus, our framework can inspect new images without retraining the underlying decision model or repeating the description refinement and calibration procedures.
3. EXPERIMENTAL SETUP
3.1. Five Manufacturing Case Studies and Data Allocation
We evaluate the proposed framework using five manufacturing case studies previously examined in [7]: (a) metallic pan surface nonconformities; (b) over- and under-extrusion in 3D printing; (c) local and global disturbances in stochastic textile surfaces; (d) missing pipe staples in automotive assemblies; and (e) simulated microstructure anomalies. The pipe-staple images were sampled by [7] from the AutoVI dataset [15]. Note that the microstructure case study includes three anomaly types (band, bimodal, and single-crystal), each at three severity levels. FIGURE 3 shows the two nominal and two defective reference images used for each case study.

FIGURE 3: An example of the two nominal and two defective reference images per manufacturing case study, used by the decision models and reference-matched CLIP.
TABLE 1 summarizes the image allocation across the five case studies. For four applications, we use 50 training images per class from [7]. For each application, we select two reference images per class () and use the remaining 48 images per class as the development set () for agentic description refinement. We also use a separate calibration set () containing 25 images per class for extrusion, textiles, and microstructure. For pipe staples, the calibration set contains 17 images per class since the defective images were limited. The held-out test sets contain 1,028 images across the five case studies. Although these test images were used in the earlier study of [7], the agents had no access to them or their results during description refinement.
TABLE 1: Image allocation across the five case studies. Counts are per class, except for the test set, which includes both classes.
| Case Study | Learning Set | Partition of | Evaluation | ||
|---|---|---|---|---|---|
| Test | |||||
| Pans | 10 | 2 | – | – | 78 |
| Extrusion | 50 | 2 | 48 | 25 | 200 |
| Textiles | 50 | 2 | 48 | 25 | 200 |
| Pipe staples | 50 | 2 | 48 | 17 | 100 |
| Microstructure | 50 | 2 | 48 | 25 | 450 |
In our experiment, we randomly selected the nominal reference images. When applicable, we also chose defective references to capture different defect types. The reference sets for are nested and shared across models to ensure consistent comparisons. The pan case study is an exception because only 10 non-test images per class are available. Consequently, we did not perform agentic description refinement and instead used the generic class descriptions. For each configuration with references per class, we used the remaining images for calibration. Reference-matched CLIP followed the same allocation, while baseline CLIP used leave-one-out scores on , and zero-shot CLIP used all of for calibration. Thus, unlike the other case studies, the pan application has no independent calibration set.
3.2. Models and Experimental Controls
For our experiments, we used the API-based TypeSafe Jev (1.13.0) and the open-weight Cloudflare Clef-Flash model, which we ran locally using SGLang on an NVIDIA RTX 5000 Ada Generation GPU. We also ran CLIP ViT-L/14 [6] locally on the same GPU for comparison. For the two decision models, we preprocessed the input images by center-cropping them to a square, limiting their dimensions to 768 pixels per side without upscaling, and padding smaller images to at least pixels before encoding them as JPEG. CLIP used its standard preprocessing procedure, which included resizing and center-cropping to pixels.
We compared the decision models against the reference-based CLIP approach in [7], which we refer to as the CLIP baseline. In this approach, CLIP computed the maximum cosine similarity between the inspection image and the reference images for each class, then applied softmax to estimate the defect probability. To ensure comparability, we used the same total number of labeled images across the three models: 75 per class for extrusion, textiles, and microstructure; 67 for pipe staples; and 10 for pans. However, these images served different purposes. Specifically, the CLIP baseline used the entire learning set () as its reference library, whereas the decision models used two reference images per class () and the remaining images to refine their class descriptions. For a given application, all three models applied Platt scaling using the same calibration image set.
In addition to the CLIP baseline, we considered three alternative configurations: (a) reference-matched CLIP, which used
the same reference images per class as the decision models; (b) zero-shot CLIP, which used the original text descriptions without reference images; and (c) zero-shot CLIP with refined descriptions, which replaced the original text descriptions with those selected by Jev. For the two zero-shot configurations, we multiplied the cosine similarity scores by 100 before applying softmax. For conciseness, we report only the results for option (b), which performed better than option (c). Hereafter, we refer to this configuration as zero-shot CLIP. We also retained the original, uncalibrated CLIP baseline with a classification threshold of 0.5 for comparison. Note that all alternative configurations used Platt scaling with the calibration set (), including zero-shot CLIP, which did not require reference images at inference. Reference-matched CLIP required fewer labeled images than the primary baseline because it did not involve description refinement.
For the four applications involving agentic description refinement, we conducted eight independent searches, one for each model–application combination. Each search was performed using a separate Claude Code agent (claude-opus-5-5, Xhigh effort), which was provided with the labeled development images, four reference images, the initial class descriptions, and the scoring program. To prevent information leakage, we restricted each agent to its development images, reference images, and scoring program. We also prevented the agents from modifying the scoring program or experimental instructions.
For each decision model, we evaluated the selected descriptions using reference images per class and the generic descriptions using . We used for the selected descriptions and did not modify them when we evaluated different numbers of reference images. For the pan application, we used the generic descriptions for all four reference configurations because we did not perform agentic refinement. In total, we evaluated 28 configurations per decision model, each using a separate calibration function and a single evaluation on the held-out test set. We also used file-hash checks to ensure that the descriptions remained unchanged between calibration and testing.
In addition to classification performance, we evaluated the time required to inspect each image. Specifically, we recorded the wall-clock time for Jev and Clef-Flash, including image preparation and model inference. For Jev, the recorded times captured both inference and networking. For CLIP, we measured the time required to (a) load and preprocess each image and extract its features using ViT-L/14, and (b) compare these features with those of the reference images or text descriptions to obtain the classification scores. We timed CLIP after a GPU warm-up run and excluded the one-time encoding of reference images, but included text-prompt encoding for zero-shot classification.
3.3. Questions and Evaluation Measures
To evaluate the proposed framework, we examined four questions: (P1) How does the classification performance of the two decision models using two reference images per class () compare to the CLIP baseline? (P2) Does the agentic refinement of class descriptions improve classification performance? (P3) To what extent do the reference images improve classification performance compared to zero-shot classification? (P4) How does probability calibration affect the reliability of defect probability estimates? For P2, we compared the generic and agentically refined descriptions using k = 2 reference images per class. For P3, we compared k = 0 and k = 2 using the same refined descriptions. We excluded the pan example from P2 because we did not perform agentic refinement, while P3 used the generic descriptions. For P4, we compared the Brier scores and ECEs before and after Platt scaling on the same held-out test images. We also examined isotonic regression to assess how sensitive the calibration results are to the choice of method. For P1–P3, we used calibrated defect probabilities, with a separate calibration function estimated for each experimental configuration.
We evaluated the classification performance using accuracy, sensitivity, specificity, and AUC. To assess the reliability of the estimated defect probabilities, we used the Brier score and expected calibration error (ECE) [16], calculated using ten equally spaced probability intervals. In our experiments, accuracy and balanced accuracy are equivalent since the test sets contain equal numbers of nominal and defective images. To assess the statistical significance of the observed differences, we used a paired bootstrap approach with 2,000 class-stratified resamples to estimate 95% confidence intervals for the differences in accuracy and AUC. We also performed exact McNemar tests to compare classification accuracy between methods using the same test images, with Holm adjustments [17] to account for multiple comparisons.
4. RESULTS
4.1. Main Classification Performance Results
Table 2 summarizes the performance of Jev, Clef-Flash, and three CLIP configurations across the five applications. Using two reference images per class, Jev achieved accuracies ranging from 0.750 to 1.000, while Clef-Flash ranged from 0.710 to 0.990. Both models outperformed reference-matched CLIP across all five applications, although their performance relative to the CLIP baseline using the full reference set varied.
The results are encouraging for metallic pans and pipe staples. For pans, Jev correctly classified all 78 test images, while Clef-Flash achieved an accuracy of 0.885. Interestingly, while the CLIP baseline achieved an accuracy of only 0.641, its AUC was 0.999. This suggests that CLIP could distinguish between nominal and defective images, but calibration and the resulting decision threshold affected its classification accuracy. For pipe staples, Jev and Clef-Flash achieved accuracies of 0.940 and 0.990, respectively, compared with 0.570 for CLIP. More importantly, their sensitivities were 0.920 and 1.000, compared with 0.320 for CLIP, indicating substantially fewer missed defects.
For the remaining applications, the differences were generally smaller. Jev had the highest accuracy on extrusion (0.750), while CLIP performed slightly better on textiles (0.975) and microstructure (0.933). Note that the models also differed in their sensitivity and specificity. For example, on extrusion, Jev had higher specificity than CLIP (0.900 versus 0.610), but lower sensitivity (0.600 versus 0.820). Thus, while the decision models performed well across the five applications, their relative performance depended on the application and the considered metrics.
4.2. Comparison with CLIP
FIGURE 4(a) compares the classification accuracy of Jev and Clef-Flash against the CLIP baseline from our previous study, which used 50 reference images per class (10 for metallic pans). Overall, the results for Jev are particularly encouraging. Using only two reference images per class at inference, Jev achieved comparable or better classification accuracy than CLIP across the five applications. We observed statistically significant improvements for metallic pans and pipe staples, while the Holm-adjusted McNemar tests did not identify significant differences for the remaining applications. Clef-Flash also outperformed CLIP on metallic pans and pipe staples, but achieved lower accuracy on textiles and microstructure.
The results are less favorable on textiles and microstructure. Jev performs similarly to CLIP on textiles, with an accuracy difference of -0.010 (95% bootstrap CI: -0.040-0.020). On microstructure, its difference is -0.031 (95% bootstrap CI: -0.058-0.004), while the Holm-adjusted McNemar test is not significant (p = 0.168). Clef-Flash performs significantly worse than CLIP on both applications, with accuracy differences of -0.135 and -0.067, respectively (adjusted p < 0.001 for both).
For extrusion, neither decision model shows a statistically significant accuracy improvement over CLIP. However, as discussed earlier, similar classification accuracies do not necessarily imply similar sensitivity and specificity. This distinction is particularly important in manufacturing inspection, where the consequences of missing a defective product may be different from those of rejecting a conforming product.
4.3. Description Refinement and Reference Images
FIGURE 4(b) summarizes the effects of using agentic AI to refine the semantic descriptions. Overall, we observed statistically significant improvements in classification accuracy for six of the eight model-application combinations, as indicated by the paired 95% bootstrap confidence intervals. The largest improvement was for Clef-Flash on pipe staples, where accuracy increased by 0.53 (95% CI: 0.43–0.62). Except for Jev on pipe staples and Clef-Flash on extrusion, moving from generic descriptions to more precise, application-specific descriptions yielded statistically significant accuracy improvements.
To illustrate the refinement process, TABLE 3 provides an example for Jev on extrusion. We started with generic descriptions that distinguished between parts with and without visible manufacturing defects, yielding a development AUC of 0.59. In the first iteration, the agent rewrote both descriptions to include extrusion-specific characteristics, such as material width, continuity, gaps, and excess plastic. These changes to both the nominal and defective descriptions increased the AUC to 0.74. With this increase in the AUC trajectory, the AI agent made only small changes to specific words in the third iteration (as evidenced by our bolded words for new additions and strikethrough words for removal), which further improved the AUC to 0.78. In our opinion, this dichotomy (making substantial changes when classification performance is subpar and targeted changes as the AI agent accumulates more information) is an interesting result, as it mimics how some experts would refine their descriptions.
FIGURE 4(c) compares zero-shot classification (K = 0) with
TABLE 2: Classification performance, inference time, and computational requirements across the five manufacturing case studies. Results are reported after Platt calibration. Bold values indicate the best performance for each case study.
| Method | Predictive Performance | Inference Time (ms) | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Acc. | Sens. | Spec. | AUC | ECE | Brier | 10 | 100 | 1000 | |||
| Metallic Pans | |||||||||||
| Jev, k = 2 | 1.000 | 1.000 | 1.000 | 1.000 | 0.205 | 0.056 | ⊕ | 970 | 0.346 | API | |
| Clef-Flash, k = 2 | 0.885 | 0.769 | 1.000 | 1.000 | 0.249 | 0.096 | ⊕ | 1,212 | 0 | 18.8 | |
| CLIP baseline | 0.641 | 0.282 | 1.000 | 0.999 | 0.290 | 0.183 | ⊕ | 98 | 0 | 0.9 | |
| Reference-matched CLIP, k = 2 | 0.744 | 0.487 | 1.000 | 0.988 | 0.255 | 0.146 | ⊕ | 113 | 0 | 0.9 | |
| Zero-shot CLIP | 0.615 | 0.385 | 0.846 | 0.565 | 0.240 | 0.270 | ⊕ | 124 | 0 | 0.9 | |
| Extrusion | |||||||||||
| Jev, k = 2 | 0.750 | 0.600 | 0.900 | 0.826 | 0.134 | 0.193 | ⊕ | 175 | 0.062 | API | |
| Clef-Flash, k = 2 | 0.710 | 0.580 | 0.840 | 0.799 | 0.091 | 0.191 | ⊕ | 173 | 0 | 18.8 | |
| CLIP baseline | 0.715 | 0.820 | 0.610 | 0.775 | 0.180 | 0.232 | ⊕ | 10 | 0 | 0.9 | |
| Reference-matched CLIP, k = 2 | 0.670 | 0.600 | 0.740 | 0.743 | 0.090 | 0.216 | ⊕ | 13 | 0 | 0.9 | |
| Zero-shot CLIP | 0.655 | 0.610 | 0.700 | 0.706 | 0.069 | 0.223 | ⊕ | 16 | 0 | 0.9 | |
| Textiles | |||||||||||
| Jev, k = 2 | 0.965 | 0.930 | 1.000 | 0.995 | 0.080 | 0.034 | ⊕ | 290 | 0.062 | API | |
| Clef-Flash, k = 2 | 0.840 | 0.810 | 0.870 | 0.911 | 0.064 | 0.116 | ⊕ | 194 | 0 | 18.8 | |
| CLIP baseline | 0.975 | 0.970 | 0.980 | 0.998 | 0.080 | 0.029 | ⊕ | 11 | 0 | 0.9 | |
| Reference-matched CLIP, k = 2 | 0.685 | 0.640 | 0.730 | 0.753 | 0.066 | 0.196 | ⊕ | 10 | 0 | 0.9 | |
| Zero-shot CLIP | 0.645 | 0.650 | 0.640 | 0.718 | 0.059 | 0.214 | ⊕ | 16 | 0 | 0.9 | |
| Pipe Staples | |||||||||||
| Jev, k = 2 | 0.940 | 0.920 | 0.960 | 0.994 | 0.108 | 0.043 | ⊕ | 269 | 0.111 | API | |
| Clef-Flash, k = 2 | 0.990 | 1.000 | 0.980 | 1.000 | 0.108 | 0.027 | ⊕ | 257 | 0 | 18.8 | |
| CLIP baseline | 0.570 | 0.320 | 0.820 | 0.631 | 0.118 | 0.249 | ⊕ | 13 | 0 | 0.9 | |
| Reference-matched CLIP, k = 2 | 0.670 | 0.680 | 0.660 | 0.686 | 0.085 | 0.227 | ⊕ | 13 | 0 | 0.9 | |
| Zero-shot CLIP | 0.640 | 0.580 | 0.700 | 0.709 | 0.087 | 0.228 | ⊕ | 18 | 0 | 0.9 | |
| Microstructure | |||||||||||
| Jev, k = 2 | 0.902 | 0.822 | 0.982 | 0.959 | 0.059 | 0.075 | ⊕ | 260 | 0.114 | API | |
| Clef-Flash, k = 2 | 0.867 | 0.751 | 0.982 | 0.924 | 0.078 | 0.106 | ⊕ | 257 | 0 | 18.8 | |
| CLIP baseline | 0.933 | 0.889 | 0.978 | 0.990 | 0.119 | 0.061 | ⊕ | 13 | 0 | 0.9 | |
| Reference-matched CLIP, k = 2 | 0.842 | 0.742 | 0.942 | 0.939 | 0.057 | 0.106 | ⊕ | 10 | 0 | 0.9 | |
| Zero-shot CLIP | 0.640 | 0.667 | 0.613 | 0.688 | 0.101 | 0.235 | ⊕ | 16 | 0 | 0.9 | |
Difference and paired 95% bootstrap interval for JEV and Clef-Flash.

FIGURE 4: Paired accuracy differences (95% bootstrap confidence intervals) for Jev and Clef-Flash: (a) versus CLIP, (b) refined versus generic descriptions, and (c) two versus zero reference images per class.
TABLE 3: The descriptions that the Jev description loop kept for extrusion, with Git-style track changes.
| Candidate | 1. development AUC 0.59 |
|---|---|
| Nominal | No visible manufacturing defects; the part appears conforming. |
| Defective | At least one visible manufacturing defect or anomaly. |
| Candidate | 2. development AUC 0.74 |
| Nominal | A close-up of a 3D printing nozzle and freshly extruded plastic; the extruded material forms a smooth, even layer of steady width that lies flat on the print surface. |
| Defective | A close-up of a 3D printing nozzle and extruded plastic where the amount of material is wrong: either a thin, stringy or broken strand with dark gaps showing through, or a bulging, blobby, overly wide mass of plastic. |
| Candidate | 3. development AUC 0.78 |
| Nominal | A close-up of a 3D printing nozzle and freshly extruded plastic; the extruded material forms a smooth, even layer or strand of steady width that lies flat on the print surface, with straight, clean edges. The background around it may be dark or light. |
| Defective | A close-up of a 3D printing nozzle and extruded plastic where the amount of material is wrong: either a thin, stringy or broken strand with dark gaps showing through, strand with breaks or gaps within the plastic itself, or a bulging, blobby, overly wide mass of plastic. |
using two reference images per class (K = 2). For Jev, adding reference images improved accuracy in four of the five applications, with paired 95% bootstrap confidence intervals excluding zero; microstructure was the only exception. For Clef-Flash, the confidence intervals excluded zero in three applications, while pipe staples and microstructure showed no clear improvement. These results are consistent with what we would expect from the genAI literature, where improving the context helps models make more informed decisions.
4.4. Probability Calibration and Computational Time
Figure 5 shows the reliability diagrams before and after Platt calibration for three representative applications. Overall, calibration improved the quality of the estimated defect probabilities, reducing the Brier score in 13 of the 15 model-application combinations. For ECE, we observed improvements for Jev and Clef-Flash across all six configurations shown in the figure. For CLIP, ECE decreased for textiles and microstructure but increased slightly for pipe staples.
The metallic pan application illustrates why we need to distinguish between classification accuracy, AUC, and calibration. While the CLIP baseline achieved an AUC of 0.999, its classification accuracy decreased from 0.910 using the raw 0.5 threshold to 0.641 after calibration. This application lacked an independent calibration set. As such, the results illustrate how calibration can be sensitive to the amount of data available, even when a model can distinguish between nominal and defective images.
We also considered isotonic regression as an alternative to Platt scaling. The results, provided in Table 14 under the “Analysis notebook” tab in the Replication Materials, show that isotonic regression achieved lower ECE in eight of the ten decision-model

FIGURE 5: Reliability diagrams comparing raw (gray) and Platt-calibrated (purple) defect probabilities for Jev, Clef-Flash, and CLIP across three sample case studies (see supplementary materials for full results). Values indicate test ECE before and after calibration.
configurations with two reference images per class. However, we also observed substantially higher log loss in some configurations. Thus, while isotonic regression may provide better ECE, it does not necessarily improve all measures of probability reliability.
Finally, Table 2 summarizes the inference times and computational requirements. Excluding metallic pans, the median inference times ranged from 175 to 290 ms for Jev and 173 to 257 ms for Clef-Flash, compared to approximately 10–13 ms for CLIP. All three models required more time for metallic pans. We accessed Jev through a remote API, with estimated charges ranging from 0.346 per 1,000 images. In contrast, we ran Clef-Flash and CLIP locally on a GPU, requiring about 18.8 GB and 0.9 GB of memory, respectively. The costs reported for Clef-Flash and CLIP exclude the initial investment in GPU hardware and the increased electricity consumption from the resulting computations.
5. DISCUSSION AND CONCLUDING REMARKS
5.1. Summary of Main Contributions
Our findings suggest that System One models offer a promising approach to 100% product inspection, particularly for low-volume and high-yield applications where collecting large amounts of labeled data may not be practical. Across five case studies, we found that Jev and Clef-Flash can achieve competitive classification performance with as few as k = 2 reference images per class during inference. Our use of a separate development set to refine semantic descriptions allowed us to assess a relatively rare, practical worst-case scenario when practitioners cannot provide precise descriptions of the classes they inspect. From our analyses, we identified two factors that can improve classification performance: (a) more informative, application-specific class descriptions, and (b) increasing the number of reference images, especially when compared to zero-shot System One implementations.
Another important finding relates to calibrating the models' output probabilities. We show that Platt scaling reduced the Brier score in 13 of the 15 model-application combinations. This is an important result for applications when the reliability of the reported probabilities is used in decision-making, e.g., if low-confidence decisions should warrant additional inspection.
To facilitate the replication of our experiments and the evaluation of System One models in other applications, we developed the “decisions” R package. We hope this encourages further research into using such models in manufacturing applications.
5.2. Advice to Practitioners
Our proposed framework is particularly useful in manufacturing applications where collecting enough images to train traditional computer vision models is impractical. In these settings, practitioners can potentially achieve good classification performance with as few as two reference images per class and a meaningful description of the defects they are trying to identify. This makes our approach relatively easy to implement.
Another point to consider is that we intentionally started with generic text descriptions and used ~50 images to improve them through our agentic AI approach. However, in many cases, practitioners may have a much better understanding of their processes and the types of defects they may encounter. As such, they may be able to provide sufficiently informative descriptions from the beginning, without needing our agentic loop approach. To help practitioners evaluate the proposed approach on their own applications, we have made a free, web-based app available where they can experiment with their own images (see https://huggingface.co/spaces/fmegahed/decisions).
5.3. Limitations and Future Research Directions
Our study has several limitations. First, although we considered five manufacturing applications, the images were collected under relatively stable conditions. It is unclear how well the proposed models would perform over longer periods in production environments where lighting, equipment, and other operating conditions may change. Future research should examine the robustness of these models under such conditions. However, given the relatively small number of reference images required, it may be possible to adapt these models to changing conditions without collecting large amounts of new data.
Second, our experiments focused on binary defect classification. We have not examined how well the proposed approach would perform in multi-class settings or whether it can identify where a defect occurs within an image. For multi-class problems, one potential challenge is the number of reference images that can be passed to the TypeSafe/Jev API or stored in context for other System One models. This may require dividing the classes into smaller groups or developing a hierarchical classification approach. Combining the “Choice” or “Noul” primitives with the recently introduced “Box” primitive [10, 11] could extend our framework to defect localization. Finally, these models remain largely black boxes. While we have shown that changes to semantic text descriptions can improve classification performance, we do not fully understand why some descriptions work better than others. Our agentic AI approach provides one way to automate this process, but it does not explain the underlying model behavior. We also plan to investigate how to incorporate conformal prediction into our framework to better characterize the uncertainty associated with the resulting classifications [18].
5.4. Concluding Remarks
In this study, we show how System One decision models, such as Jev and Clef-Flash, can enable 100% inspection in low-volume, customized, and/or high-yield manufacturing applications by combining semantic text descriptions with as few as k = 2 reference images. We apply our proposed framework to five manufacturing case studies and compare its performance against three CLIP-based baselines. Our results show that Jev (and often Clef-flash) can achieve comparable or better classification accuracies across these applications. We also demonstrate that the text/class descriptions can be improved automatically with an agentic AI loop, and that increasing the number of reference images can further improve classification performance. To support research and practical adoption, we provide the R “decisions” package and an accompanying no-code web app.
ACKNOWLEDGMENTS
The authors acknowledge the Farmer School of Business and the Raymond E. Glos Professorship in Business for providing the computational resources and monetary support for this research.
DISCLOSURE OF AI USE
We used Claude Code (Anthropic; versions 2.1.304–2.1.312, using Claude Opus 5.5, Sonnet 5.5, and Haiku 5.5) through a command-line interface on a Windows 11 computer between October 20 and 28, 2026. Under the supervision of Dr. Megahed, Claude Code generated the project's computational code, including the R scripts used for FIGURES 3–5, and translated our R results into LATEX tables (TABLES 1–3). Claude Opus 5.5 was also used in the automated description-generation experiments, as described in Sections 2.2 and 3.2.
Additional AI tools included OpenAI Codex (GPT-6 Astra, xhigh reasoning effort, v 0.163.0) for refining the LATEX code used to generate FIGURE 2 on October 24–25. Finally, ChatGPT.com (OpenAI; Sol 5.6, medium effort) and the Grammarly Chrome Extension (Superhuman Platform Inc., v. 14.1342.0) were both used for language editing and readability improvements from October 20 to 29, 2026.
The authors were responsible for the research design, methodological decisions, code review/tests, interpretation of results, and final manuscript content. Dr. Megahed created a Claude “replication-materials” skill, which documented the ~300 decisions made when interacting with Claude Code. See https://github.com/fmegahed/claude-skills for the Claude Skill and the next subsection for the detailed record of AI involvement.
REPLICATION MATERIALS
While GenAI has the potential to accelerate scientific research, there are growing concerns about its broader implications for scientific discovery and research integrity [e.g., see 19, 20]. We believe AI-augmented approaches can be impactful in manufacturing applications; however, they must be implemented transparently so that the research can be replicated. Therefore, our supplementary website (https://fmegahed.github.io/decision-models-for-industrial-image-qc/, generated by our Claude skill) serves as an AI-augmented laboratory notebook, documenting (a) the ~300 research decisions made throughout this study, including who proposed and approved each decision, when it was made, and the extent of AI involvement; (b) GitHub code repository, with a full commit history; and (c) our Quarto ('.qmd') notebook, capturing our code, results, and artifacts included in this paper (as well as additional supplementary figures that we could not include due to space considerations).
REFERENCES
[1] Colosimo, Bianca M, Jones-Farmer, L Allison, Megahed, Fadel M, Paynabar, Kamran, Ranjan, Chitta and Woodall, William H. "Statistical process monitoring from industry 2.0 to industry 4.0: Insights into research and practice." Technometrics Vol. 66 No. 4 (2024): pp. 507–530. DOI 10.1080/00401706.2024.2327341.
[2] Megahed, Fadel M., Woodall, William H. and Camelio, Jaime A. "A Review and Perspective on Control Charting with Image Data." Journal of Quality Technology Vol. 43 No. 2 (2011): pp. 83–98. DOI 10.1080/00224065.2011.11917848.
[3] Jeong, Jongheon, Zou, Yang, Kim, Taewan, Zhang, Dongqing, Ravichandran, Avinash and Dabeer, Onkar. "WinCLIP: Zero-/Few-Shot Anomaly Classification and Segmentation." 2023 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR): pp. 19606–19616. 2023. DOI 10.1109/CVPR52729.2023.01878.
[4] Psarommatis, Foivos, Azamfirei, Victor, Solina, Vittorio, May, Gokan and Jun, Hongbae. "Zero Defect Manufacturing – from vision to integrated industrial reality." International Journal of Production Research Vol. 64 No. 17 (2026): pp. 7261–7268. DOI 10.1080/00207543.2026.2707319.
[5] Hu, S. Jack. "Evolving Paradigms of Manufacturing: From Mass Production to Mass Customization and Personalization." Procedia CIRP Vol. 7 (2013): pp. 3–8. DOI 10.1016/j.procir.2013.05.002.
[6] Radford, Alec, Kim, Jong Wook, Hallacy, Chris, Ramesh, Aditya et al. "Learning Transferable Visual Models From Natural Language Supervision." Meila, Marina and Zhang, Tong (eds.). Proceedings of the 38th International Conference on Machine Learning, Vol. 139: pp. 8748–8763. 2021. PMLR. URL https://proceedings.mlr.press/v139/radford21a.html.
[7] Megahed, Fadel Mounir, Chen, Ying-Ju, Colosimo, Bianca Maria, Grasso, Marco, Jones-Farmer, L. Allison, Knoth, Sven, Sun, Hongyue and Zwetsloot, Inez M. "Adapting OpenAI's CLIP Model for Few-Shot Image Inspection in
Manufacturing Quality Control: An Expository Case Study With Multiple Application Examples." Journal of Quality Technology Vol. 58 No. 4 (2026): pp. 415–441. DOI 10.1080/00224065.2026.2640171.
[8] TypeSafe AI. "Introducing System One Models & Jev." https://typesafe.ai/blog/introducing-system-one-models-and-jev (2026). Last accessed on October 25, 2026.
[9] Cloudflare. "Cloudflare/clef-flash." https://huggingface.co/Cloudflare/clef-flash (2026). Last accessed on October 25, 2026.
[10] TypeSafe AI. "Primitives (Questions)." https://docs.typesafe.ai/primitives (2026). Last accessed on October 26, 2026.
[11] TypeSafe AI. "Box - TypeSafe." https://docs.typesafe.ai/primitives/box (2026). Last accessed on October 26, 2026.
[12] Karpathy, Andrej. "Autoresearch." https://github.com/karpathy/autoresearch (2026). Software repository. Accessed October 22, 2026.
[13] Platt, John C. "Probabilistic Outputs for Support Vector Machines and Comparisons to Regularized Likelihood Methods." Smola, Alexander J., Bartlett, Peter L., Schölkopf, Bernhard and Schuurmans, Dale (eds.). Advances in Large Margin Classifiers. MIT Press, Cambridge, MA (1999): pp. 61–74.
[14] Zadrozny, Bianca and Elkan, Charles. "Transforming Classifier Scores Into Accurate Multiclass Probability Estimates." Proceedings of the Eighth ACM SIGKDD International Conference on Knowledge Discovery and Data Mining: pp. 694–699. 2002. DOI 10.1145/775047.775151.
[15] Carvalho, Philippe, Lafou, Meriem, Durupt, Alexandre, Leblanc, Antoine and Grandvalet, Yves. "The Automotive Visual Inspection Dataset (AutoVI): A Genuine Industrial Production Dataset for Unsupervised Anomaly Detection." (2024). DOI 10.5281/zenodo.10459003.
[16] Guo, Chuan, Pleiss, Geoff, Sun, Yu and Weinberger, Kilian Q. "On Calibration of Modern Neural Networks." Proceedings of the 34th International Conference on Machine Learning, Vol. 70: pp. 1321–1330. 2017. URL https://proceedings.mlr.press/v70/guo17a.html.
[17] Japkowicz, N. and Shah, M. Evaluating Learning Algorithms: A Classification Perspective. Cambridge University Press (2011).
[18] Angelopoulos, Anastasios N and Bates, Stephen. "Conformal prediction: A gentle introduction." Foundations and Trends in Machine Learning Vol. 16 No. 4 (2023): pp. 494–591. DOI 10.1561/2200000101.
[19] Hao, Qianyue, Xu, Fengli, Li, Yong and Evans, James. "Artificial intelligence tools expand scientists' impact but contract science's focus." Nature Vol. 649 No. 8099 (2026): pp. 1237–1243. DOI 10.1038/s41586-025-09922-y.
[20] Hochberg, Michael E and Thrall, Peter H. "AI will reorganize science. Will research remain a human enterprise?" Proceedings of the National Academy of Sciences Vol. 123 No. 31 (2026): p. e2610088123. DOI 10.1073/pnas.2610088123.