Written by David Rodgers

Quality and Operations Perspective

Written by David Rodgers, Lean Six Sigma Black Belt and ASQ-certified quality leader. This guide applies quality and process-improvement methods to AI in operations from a quality and operations perspective. The author is not a machine learning engineer, data scientist, or lawyer.

Last editorial review: September 24, 2026. Educational content only: not medical, legal, or regulatory advice. Follow your organization's policies and the requirements that apply to you, and have subject-matter experts review any change to a live process.

  • Lean Six Sigma Black Belt
  • ASQ CQE
  • ASQ CMQ/OE
  • Quality systems and process improvement

An AI inspection tool, a document checker, or an automated classifier is a measurement system. It decides whether something is good or bad, so it needs the same validation as a gauge or an inspector: does it catch the defects, how often does it raise false alarms, and does it stay that way?

This guide explains the confusion matrix and the measures from it (recall, specificity, precision, accuracy, kappa), how to design a validation with an agreed standard and enough defects, why precision falls when defects are rare (the prevalence trap), how to choose a threshold by cost, and how to keep a tool valid. A worked example validates an AI visual inspection assist against human inspectors, with exact intervals and the monthly cost of each kind of error.

All figures are illustrative. It complements the AI in Manufacturing Quality guide, which covers the use cases.

Open the Validation Calculator Get the Validation Protocol

Before You Start

Educational content. This guide applies quality and operations methods to the use of AI in organizations. It does not cover how to build or program AI systems, and it is not legal, regulatory, security, or professional advice. AI products, standards, and laws change quickly, so check current requirements and have qualified people review any use that affects safety, quality, people, or regulated data. The worked example is illustrative.

Treat the AI Like a New Inspector

An AI inspection tool, a document checker, or an automated classifier is a measurement system. It decides whether a part, a record, or a claim is good or bad. That means it needs the same validation as a gauge or an inspector: does it find the defects, how often does it raise false alarms, and does it stay that way over time? Quality engineers already know how to answer these questions. The AI in Manufacturing Quality guide covers the use cases; this guide covers how to prove a tool is good enough.

Two Kinds of Error

A miss (escape) lets a bad part through. A false alarm stops or re-inspects a good one. They cost different amounts.

Prevalence Changes Everything

A tool that looks good on a test set rich in defects can bury you in false alarms when defects are rare.

A Standard Is Needed

You cannot judge the AI without a trusted answer for each test item, and the experts may not agree.

Validation Never Ends

Products, lighting, suppliers, and models change. Keep checking.

The Confusion Matrix and Its Measures

Run the tool on a set of items whose true status is known, and count the four outcomes.

MeasureCalculationWhat it answers
Recall (sensitivity)True positives ÷ all defectsOf the defects, how many does it catch? The opposite is the escape rate
SpecificityTrue negatives ÷ all good itemsOf the good items, how many does it pass? The opposite is the false alarm rate
Precision (positive predictive value)True positives ÷ all flagged itemsWhen it flags something, how often is it really defective?
AccuracyCorrect decisions ÷ all itemsOverall agreement. Misleading when defects are rare
KappaAgreement beyond chance with the standardHow well it agrees with the standard, allowing for luck; see MSA
Accuracy hides the problem. If 1.5% of parts are defective, a tool that passes everything is 98.5% accurate and catches nothing. Always report recall and specificity, not accuracy alone.

Designing the Validation

  1. Define the standard. What counts as a defect, with photos and limit samples. Have two or more experts label every test item independently and settle disagreements.
  2. Measure the experts. Their agreement with each other (kappa) is a ceiling on what any tool can show. If the experts disagree, fix the standard first.
  3. Build a representative test set. Include every defect type and the borderline cases, and parts from different lots, shifts, suppliers, and lighting. Keep the set separate from anything used to set up the tool.
  4. Enough defects. To show a recall of at least a target with no misses at 95% confidence you need a minimum number of defects (table below). More if you expect some misses.
  5. Run it blind, as it will run in production, and record every outcome.
  6. Report intervals, not just percentages, and the cost of each kind of error.
  7. Set the acceptance criteria in advance, with a stop rule.
To show recall is at leastDefects needed with none missed (95% confidence)
90%29
95%59
98%149
99%299

These are the same zero-failure sample sizes used for reviewing AI output in the human-in-the-loop guide, applied to defects. Rare defects make this hard: if only 1% of parts are bad, finding 59 defects means inspecting about 5,900 parts, so use a defect-enriched set and say so.

Worked Example: AI-Assisted Final Inspection at Riverside Plant

Riverside Plant, an illustrative 140-employee metal fabrication and assembly plant, tested an AI visual inspection assist on 400 parts whose status two inspectors and an engineer had agreed on: 60 defective and 340 good (a deliberately enriched set with 15% defects). Figures are illustrative.

54True positivedefect, flagged 17False positivegood, flagged: false alarm 6False negativedefect, passed: escape 323True negativegood, passed AI flags itAI passes it Truly defective60 parts Truly good340 parts Recall = TP ÷ defects = 90% Specificity = TN ÷ good = 95% Precision = TP ÷ flagged = 76%
The result on the test set.
40% 50% 60% 70% 80% 90% 100% Recall (defects caught)54 of 60 defects 90.0%79.596.2 Specificity (good parts passed)323 of 340 good parts 95.0%92.197.1 Precision in the test set54 of 71 flagged 76.1%64.585.4
Measures with exact 95% intervals. Recall could be as low as about 80%, so the test does not show the 95% the plant wanted.
MeasureAI toolHuman inspectors (same parts)
Recall90%85%
Specificity95%97.9%
Kappa against the standard0.790.84

What this means. The AI catches more defects than the inspectors do (90% against 85%) but raises more false alarms (5% against about 2%), so its overall agreement with the standard is slightly lower. It is a different trade-off, not simply a better one.

The Prevalence Trap

The test set had 15% defective parts. Production has about 1.5%. Precision depends on how common defects are, so a tool that looks good on the test set behaves very differently on the line.

0% 25% 50% 75% 100% 0% 5% 10% 15% 20% 25% 30% Production: 1.5% defective: 22% of flags are real Validation set: 15% defective: 76% of flags are real Share of parts that are truly defective (prevalence)Precision: flagged parts that are defective
Precision falls sharply as defects become rarer, even though recall and specificity are unchanged. At 1.5% defective, only about 22% of the AI’s flags are real.
Per month at 10,000 parts and 1.5% defectiveAI toolHuman inspectors
Defects150150
Escapes (defects passed)1522.5
False alarms to re-inspect493203
Flags that are real (precision)22%39%
Cost at $400 per escape and $3 per false alarm$7,478$9,608

The decision. On cost alone the AI saves about $2,131 a month, and it finds 7.5 more defects. But the line would re-inspect about 493 good parts a month, and four in five flags would be false. The plant used the tool as an assistant: its flags go to an inspector for a second look, with a goal to tune the threshold and re-test before it is allowed to reject parts on its own. Use the AI Classifier Validation Calculator to run these figures for your own tool.

Thresholds and Costs

  • Most tools give a score, and a threshold turns it into flag or pass. Moving the threshold trades escapes for false alarms.
  • Choose the threshold by cost, not by the vendor default: the cost of an escape against the cost of a false alarm, at your real defect rate.
  • Set the threshold on one data set and test it on another. A threshold tuned on the test set overstates performance.
  • For safety-critical defects, set the threshold to protect recall, and add a second check.

Keeping It Valid

ControlHowWhy
Master samplesInsert known good and known bad parts at intervalsA direct check, as with any gauge; see the seeded-error idea in the human-in-the-loop guide
Audit sampleHave inspectors re-check a random sample of passed and flagged itemsShows the true escape and false alarm rates
Control chartChart the share flagged, and the audit error rate, over time; see SPC Control ChartsA shift can mean drift in the tool or in the process
Change controlRe-run the test set after any change to the tool, camera, lighting, or productSilent change is a main risk; see Management of Change
Periodic re-validationRepeat the study at a set interval and after incidentsConditions change

Common Mistakes

Reporting Accuracy Only

A high accuracy that hides missed defects.

A Test Set Unlike Production

Too few defects, or only the easy ones.

Forgetting Prevalence

Not working out how many flags will be false at the real defect rate.

No Agreed Standard

Judging the tool against inspectors who disagree.

Tuning on the Test Set

A threshold that looks great on the data it was set on.

Validating Once

No checks after the process or the tool changes.

Self-Assessment Questions

  • Do we have an agreed standard, and how well do our experts agree with each other?
  • Do we report recall, specificity, and precision with intervals, and not accuracy alone?
  • Have we worked out the false alarms and escapes per month at our real defect rate?
  • Did we choose the threshold by cost, and test it on separate data?
  • How will we know if the tool drifts?

AI for Quality and Inspection: Frequently Asked Questions

How do I validate an AI inspection system?

Agree a standard for what is defective, have experts label a representative test set independently, run the tool blind on it, and count true and false positives and negatives. Report recall, specificity, and precision with exact confidence intervals, check the experts agree with each other, and work out what the results mean at your real defect rate.

What is the difference between recall and precision?

Recall is the share of real defects the tool catches. Precision is the share of the tool’s flags that are real defects. A tool can have high recall and low precision, which means it catches most defects but raises many false alarms, especially when defects are rare.

Why is accuracy a poor measure for inspection?

When defects are rare, a tool that passes everything is almost always right, so accuracy looks high while recall is zero. Always report recall and specificity, and the cost of each kind of error.

How many defective samples do I need?

To show a recall of at least 90%, 95%, 98%, or 99% with no misses at 95% confidence you need at least 29, 59, 149, or 299 defects respectively. If you expect some misses you need more, or you should use an exact interval on what you observe.

How do I keep an AI inspection tool valid over time?

Insert known good and bad samples regularly, re-inspect a random audit sample, chart the share flagged and the audit error rate on a control chart, re-run the test set after any change to the tool, camera, lighting, or product, and re-validate on a schedule.

Sources and Further Reading

  • AIAG, Measurement Systems Analysis Reference Manual (4th ed., 2010), on attribute agreement analysis and kappa.
  • Cohen, J., “A coefficient of agreement for nominal scales,” Educational and Psychological Measurement 20(1), 1960.
  • Clopper, C. J. and Pearson, E. S., “The use of confidence or fiducial limits illustrated in the case of the binomial,” Biometrika 26, 1934.
  • Altman, D. G. and Bland, J. M., “Diagnostic tests 1: sensitivity and specificity” and “Diagnostic tests 2: predictive values,” BMJ 308, 1994.
  • National Institute of Standards and Technology, AI RMF 1.0 (NIST AI 100-1), the Measure function on testing and evaluation.
  • Montgomery, D. C., Introduction to Statistical Quality Control (Wiley), on acceptance sampling and control charts.