Short answer

Manufacturing AI data leakage occurs when model development or evaluation uses information that would not be available for the intended decision, or lets dependent records cross a boundary that should represent new production. Split by the actual deployment question, including time, part and lot relationships where relevant, and fit preprocessing on training data only. This fictional image record exposes a misleading random split without inventing a performance score or claiming one split can validate every factory model.

Key takeaways

Check whether each feature exists at the decision time.

Keep images of the same part from contaminating evaluation.

Match time and grouping boundaries to the deployment task.

JSONDownload the manufacturing AI leakage audit

JSON with the fictional part/lot/image split and blank fields for feature availability, dependence, preprocessing and held-out evaluation.

Write the prediction moment in the first line of the brief

Suppose a model must decide whether to flag a part immediately after its camera image is captured. Features may include information genuinely available at that moment. A later final-inspection result can be the target label, but it cannot also be an input to that earlier decision.

Scikit-learn defines leakage through information unavailable at prediction time and warns about learning preprocessing from the test set. The factory-specific task is to trace availability and relationships, not simply remove a column whose name looks suspicious.

Candidate fieldAvailable at camera decision?Treatment in this example
Current imageYesEligible input after method validation
Earlier machine readingOnly if genuinely received and validVerify timestamp and latency
Final inspection dispositionNoLater target/reference, never an earlier input
End-of-shift yield summaryNoExclude from this decision
Lot IDKnown, but may encode shortcutsReview deployment fit and grouping

See how the image split leaks the part identity

Our illustrative record has 8 physical parts from 4 successive lots, 2 parts per lot, with 3 images per part. There are 24 images. A tempting split assigns images 1 and 2 of every part to training and image 3 to testing.

That creates 16 training images and 8 test images, but every test part was already seen in training. It may test another view of known pieces rather than performance on new parts. No score is reported because no model was trained; the failure is in what the split represents.

Use a split that matches the new-lot question

For a teaching new-lot, forward-time evaluation, assign lots L1 and L2 to training:4 parts and 12 images. Reserve L3 for tuning:2 parts and 6 images. Keep L4 as a later final test:2 parts and 6 images. No part or lot crosses those boundaries.

This tiny dataset illustrates separation, not enough evidence for a useful vision model. It also cannot establish performance at a different plant or on unseen defect types. More representative groups and periods are needed for the real deployment question.

Teaching split by chronological lotTrain L1-L2:12 images; validation L3:6; final test L4:6

All 3 images of a physical part stay together. This protects the stated grouping, but the small counts do not qualify performance.

A fictional 24 image dataset keeps 8 physical parts grouped across chronological training lots L1-L2, validationL3 and final testL4.
Protect the part and time boundary required by the deployment question. The small teaching set establishes no model score. Open the full-size diagram

Combine the right boundaries instead of choosing a split by habit

Group-based splitting can keep related records together. Time-based splitting can test a later period. A generic group splitter does not automatically enforce chronology; a generic time splitter does not automatically prevent a long-lived part or batch from crossing the boundary.

Preserve the index of actual group and time assignments and test it directly. Also check label availability: training at a historical cutoff cannot use outcomes that had not arrived by then. Fit scaling, imputation, feature selection and tuning using only the permitted development data.

  1. Define deployment and decision time

    State the unit, target, feature cutoff and future population to be predicted.

  2. Map dependence and availability

    Identify repeated parts, lots, machines, time overlap and delayed labels.

  3. Construct and test the split

    Verify the exact intended time/group exclusions rather than trusting the splitter name.

  4. Freeze final evaluation

    Keep the held-out data away from feature, model and threshold choices.

Review shortcuts that survive a clean-looking split

A lot code, camera background or operator annotation can act as a shortcut correlated with the target in development but absent or different in use. Examine representative failure examples and relevant subgroup outcomes, not just a single average.

Use attribute agreement analysis to question inconsistent reference labels and inspection thresholds for the separate decision-rule trade-off. Clean splitting cannot repair an invalid target definition.

Retain the evaluation boundary with the model version

The record should identify what was known when, which groups were excluded, what preprocessing was fitted and who could inspect the final test. If the test drives a redesign, call it development evidence and obtain a fresh final evaluation.

The download lists all 24 fictional image assignments and includes blank audit fields. Check the physical parts behind the rows before trusting a test score. A split that answers the wrong question cannot be repaired by a more impressive accuracy number.

A related example from Abolfazl

Compare a valid-looking inventory record with evidence from the shelf.

Read the companion note

In English, on founder Abolfazl’s personal blog. This is related reading, not an independent technical source.

Practical checklist

  • Write the exact prediction moment.
  • Verify feature availability and latency.
  • Keep later outcomes out of earlier inputs.
  • Identify repeated parts and shared lots.
  • Test both time and grouping boundaries.
  • Fit preprocessing on permitted training data.
  • Keep final test out of threshold tuning.
  • Report independent units and limits alongside row counts.

FAQ

FAQ

Sources and further reading

Authoritative references used to research and verify this guide.