Artificial Intelligence in Mechatronics Applications

Chapter 13
AI Engineering Lifecycle and Industrial Validation

Bachelor Program in Mechatronics Engineering
Artificial Intelligence in Mechatronics Applications   •   Bachelor

AI Engineering Lifecycle and Industrial Validation

Introduction

Artificial intelligence in mechatronics is not complete when a model achieves high accuracy in a laboratory. An industrial AI component must satisfy requirements, operate within timing and safety constraints, remain traceable after deployment, and continue to perform acceptably as machines, materials, environments, and operating policies change. The engineering problem therefore extends from problem definition to retirement.

In a mechatronic system, an AI component may classify defects, estimate a robot's state, predict bearing failure, detect collisions, or select a control action. Such functions interact with sensors, actuators, embedded processors, communication networks, human operators, and safety systems. An error may consequently cause not only an incorrect prediction but also downtime, product loss, equipment damage, or injury.

This chapter presents a lifecycle view of AI engineering, including requirements management, experiment tracking, versioning, MLOps, verification and validation, robustness, monitoring, drift, updating, documentation, and lifecycle risk management.

Learning objectives

By the end of this chapter, a student should be able to:

  1. Translate an industrial need into measurable AI and system requirements.
  2. Distinguish verification from validation and identify suitable evidence for each.
  3. Design reproducible experiments using data, code, model, and environment versioning.
  4. Explain an MLOps pipeline for deployment and controlled updating.
  5. Select performance, reliability, robustness, and operational monitoring metrics.
  6. Plan simulation, software-in-the-loop, hardware-in-the-loop, and field tests.
  7. Analyze data drift, concept drift, uncertainty, and lifecycle risk.
  8. Produce technical documentation that supports safety, maintenance, audit, and handover.

1. The lifecycle perspective

A conventional software lifecycle often assumes that requirements and rules are relatively stable. Machine-learning systems are different because behavior is partly induced from data. The effective system is determined by at least four interacting elements:

  • the learned model and its parameters;
  • the data distribution and labeling process;
  • the surrounding software, hardware, and control logic;
  • the operational context in which outputs are used.

A useful lifecycle is:

need definition → requirements → data and hazard analysis → design → training → verification → validation → release → operation and monitoring → update or retirement.

These stages are iterative rather than strictly sequential. A validation failure may reveal an inadequate requirement; a production drift event may require new data collection; and a hardware revision may invalidate previous timing tests.

AI engineering lifecycle Requirementsand hazards Data anddesign Train andexperiment Verify andvalidate Deploy andmonitor Operational evidence, incidents, drift and updates feed the next lifecycle iteration
AI engineering lifecycle with feedback from operation to requirements
Figure: AI engineering lifecycle with feedback from operation to requirements

Figure: A lifecycle model in which operational evidence provides feedback to requirements and design.

2. Requirements engineering for AI-enabled machines

2.1 From purpose to testable requirements

A statement such as “use AI to improve inspection” is not an engineering requirement. A useful requirement identifies the function, context, measurable threshold, constraints, and evidence method. For example:

During production of product family P, the vision component shall detect surface defects larger than 1 mm with recall of at least 0.98 and false-reject rate no greater than 0.03, at an inference latency below 80 ms, under the specified illumination range.

Requirements should be allocated across levels:

LevelTypical content
Business or missionReduced scrap, predictive maintenance, improved throughput
SystemSafety behavior, cycle time, availability, human override
AI componentAccuracy, recall, calibration, latency, resource use
DataCoverage, labeling quality, representativeness, privacy
InterfaceInput format, communication protocol, missing-data behavior
OperationsMonitoring, rollback, access control, update approval

AI metrics must be connected to system consequences. Accuracy alone can be misleading when classes are imbalanced. For binary classification, with true positives (TP), false positives (FP), true negatives (TN), and false negatives (FN):

Precision = TP ÷ (TP + FP)
Recall = TP ÷ (TP + FN)

Precision measures the proportion of positive predictions that are correct; recall measures the proportion of actual positive cases detected. These formulas assume a defined positive class and a fixed decision threshold. In safety-related detection, false negatives may be much more costly than false positives, so recall and the consequences of errors must be specified explicitly.

For an estimated quantity, a useful requirement may concern error. Mean absolute error is:

MAE = (1 ÷ n) ∑ᵢ₌₁ⁿ |yᵢ − ŷᵢ|

Here, yi is the measured value, \hat{y}i is the estimate, and n is the number of test cases. MAE has the same units as the estimated quantity and is often easier to interpret than squared-error measures.

2.2 Safety, security, and human requirements

The AI should not be treated as the only protective layer where failure can create unacceptable risk. Independent limits, interlocks, emergency stops, watchdogs, plausibility checks, and safe-state behavior may be required. Requirements should specify what happens when the model is uncertain, inputs are absent, communication fails, or the model is outside its validated operating domain.

Security requirements include authenticated model packages, restricted deployment privileges, protected logs, secure update mechanisms, and defense against manipulated sensor inputs or poisoned training data. Human-factors requirements should address alarm rates, explanations appropriate to the task, operator authority, training, and the possibility of automation bias.

3. Reproducible experimentation and versioning

A model result is not reproducible if only the neural-network file is saved. At minimum, an experiment record should identify:

  • raw-data source, collection time, sensor configuration, and consent or access basis;
  • data-cleaning and labeling procedures;
  • training, validation, and test partitions;
  • code revision and dependency versions;
  • model architecture, hyperparameters, random seeds, and hardware;
  • evaluation metrics, confidence intervals where appropriate, and failure examples;
  • approval status and the intended operating domain.

Version control should cover source code, configuration, datasets or immutable dataset references, labels, model artifacts, container images, and deployment manifests. Large datasets are commonly managed through content hashes, manifests, and lineage systems rather than by placing every binary file in a source-code repository.

Data splitting requires special care. Randomly splitting adjacent time samples from the same machine can leak nearly identical information into training and test sets. Time-based, machine-based, batch-based, or site-based splits may better estimate future or cross-site performance. A test set should remain untouched until final evaluation.

A disciplined experiment compares one controlled change at a time where feasible. The experiment tracker should record the question, hypothesis, changed variables, baseline, results, and decision. This turns trial-and-error into engineering evidence.

4. Verification and validation

Verification asks: “Was the system built according to its specified design?” It includes unit tests, interface tests, code review, data-schema checks, deterministic preprocessing tests, timing tests, and model packaging checks.

Validation asks: “Does the system solve the intended real-world problem in its intended context?” It includes representative field data, realistic production conditions, operator interaction, environmental variation, and end-to-end task performance.

A model may be verified as correctly implementing its software and still fail validation because the training data omitted reflective surfaces, seasonal lighting, unusual loads, or maintenance conditions.

A traceability matrix connects each requirement to hazards, design elements, tests, results, and approvals. Evidence should include both aggregate metrics and stratified results—for example by product type, temperature range, speed, sensor, machine, and operating mode. Confidence intervals or repeated trials are useful because an observed metric is an estimate rather than a guaranteed property. For a proportion such as recall, the uncertainty depends on the number and independence of tested cases; a small test set cannot support a strong general claim.

4.1 Levels of test environment

  1. Model-in-the-loop (MIL): the model is tested with simulated or recorded inputs, usually before embedded integration.
  2. Software-in-the-loop (SIL): the production software implementation runs in a simulated system environment.
  3. Hardware-in-the-loop (HIL): real controller hardware exchanges signals with a real-time simulator representing the plant, sensors, or actuators.
  4. Bench or component test: physical sensors, processors, or actuators are tested under controlled conditions.
  5. Pilot and field validation: the complete system operates in its intended environment, initially with safeguards and controlled exposure.

Each level answers different questions. Simulation gives breadth and repeatability; HIL tests timing, interfaces, and hardware constraints; field tests reveal unmodeled environmental and human effects. None automatically substitutes for the others.

5. Robustness and uncertainty analysis

Robustness concerns acceptable behavior when conditions differ from nominal assumptions. Tests may vary illumination, vibration, temperature, payload, network delay, sensor noise, occlusion, camera position, sampling rate, and component degradation. A useful test plan specifies the perturbation, its physically plausible range, the measured response, and the acceptance threshold.

For a classifier, robustness should be assessed not only by average accuracy but also by worst-group or worst-condition performance. For a controller or estimator, examine stability-related behavior, bounded error, recovery after disturbances, and interaction with actuator saturation. An AI component should never be permitted to issue an unsafe command merely because its numerical output appears confident.

Uncertainty can be represented in different ways. Aleatoric uncertainty arises from noise or ambiguity in the observation; epistemic uncertainty reflects limited knowledge and may increase for unfamiliar inputs. Practical safeguards include confidence thresholds, out-of-distribution checks, ensembles, abstention, fallback algorithms, and human review. Confidence scores are not automatically calibrated probabilities. If a system claims that 80% confidence corresponds to an event probability of 0.8, calibration must be tested on representative data.

6. MLOps and controlled deployment

MLOps integrates machine learning with software, data, infrastructure, and operations. A production pipeline commonly contains:

  1. data ingestion and validation;
  2. labeling and quality review;
  3. feature or preprocessing pipeline;
  4. training and evaluation;
  5. security and compliance checks;
  6. artifact registration;
  7. deployment to a test environment;
  8. staged release, shadow mode, canary, or A/B evaluation where appropriate;
  9. monitoring and incident response;
  10. approval, rollback, or retirement.

A model registry should distinguish experimental, candidate, approved, deployed, retired, and rejected artifacts. Deployment should be reproducible from an immutable package that includes the model, preprocessing, dependencies, configuration, and compatibility information.

A safe update process defines who can approve an update, what evidence is required, how the previous version is restored, and how affected operators are informed. Automatic retraining may be suitable for low-risk applications, but high-consequence systems require controlled review and release gates. Online learning is particularly risky when feedback is delayed, labels are unreliable, or the system can influence the data it later learns from.

7. Monitoring, drift, and maintenance

Monitoring has at least four dimensions:

  • service monitoring: latency, throughput, availability, memory, processor load, and communication errors;
  • data monitoring: missing values, ranges, sensor health, feature distributions, and input schema;
  • model monitoring: prediction distribution, confidence, error metrics when labels arrive, subgroup performance, and abstention rate;
  • system monitoring: alarms, overrides, rejects, downtime, near misses, maintenance events, and economic outcomes.

Data drift is a change in the distribution of inputs. Concept drift is a change in the relationship between inputs and the target or required action. A new sensor calibration may cause data drift; a changed cutting tool may alter the relationship between vibration and failure, producing concept drift.

One distribution comparison measure is the population stability index (PSI), commonly used as a screening indicator:

PSI = ∑ᵢ (pᵢ − qᵢ) ln(pᵢ ÷ qᵢ)

Here, pi is the reference proportion in bin i, qi is the current proportion, and both must be positive and use the same bins. PSI is not a universal statistical test or proof of harmful drift; thresholds are context-dependent and should be supported by engineering impact analysis. Monitoring must avoid confusing a change in operating mix with model failure.

When labels become available, compare current performance with the validated baseline. Trigger conditions may include sustained error above a limit, severe degradation in a critical subgroup, abnormal sensor distributions, repeated abstentions, or a safety incident. Responses may include investigation, recalibration, data collection, rollback, temporary human approval, retraining, or retirement.

8. Documentation and governance

A professional AI record should make the system understandable to someone who did not build it. Useful documents include:

  • system and AI requirements specification;
  • data sheet or dataset register;
  • model card describing purpose, limitations, evaluation data, and unsuitable uses;
  • architecture and interface description;
  • hazard and risk analysis;
  • experiment and decision log;
  • verification and validation plan and report;
  • deployment, monitoring, rollback, and incident procedures;
  • cybersecurity, privacy, access-control, and change records;
  • operator and maintainer instructions.

Documentation should state known limitations rather than presenting a single accuracy number. It should identify the responsible owner, version, approval date, validated operating domain, assumptions, and outstanding risks. Regulatory obligations vary by application and jurisdiction, but traceability, accountability, human oversight, data governance, and evidence of risk control are recurring expectations in safety-critical and high-impact systems.

9. Lifecycle risk management

Risk management is continuous. A simple qualitative framework identifies hazards, initiating causes, consequences, existing controls, detectability, and residual risk. More formal methods may combine failure modes and effects analysis, fault-tree analysis, hazard analysis, attack modeling, and reliability testing.

Risk priority should not be reduced to a numerical score without engineering judgment. A rare event with catastrophic consequences may demand stronger controls than a frequent but minor event. Controls should follow a hierarchy: eliminate the hazard where possible, use inherently safer design, add independent protective mechanisms, then rely on procedural or informational controls.

AI-specific failure modes include biased or incomplete data, label errors, distribution shift, spurious correlations, silent preprocessing changes, model extraction, adversarial inputs, non-deterministic behavior, and feedback loops. The risk file should specify detection and recovery, not merely prevention.

10. Illustrative case: vision inspection on a robotic assembly cell

Background and problem

An illustrative manufacturing company uses a camera and classifier to detect missing fasteners on a robotic assembly cell. The initial laboratory dataset contains 12,000 images collected under clean lighting from one cell. The business goal is to reduce customer escapes without increasing manual inspection substantially.

Analysis

The engineering team identifies two asymmetric costs: a missed fastener can cause a field failure, while a false rejection causes reinspection and downtime. Requirements are therefore allocated to recall, false-reject rate, latency, availability, and safe behavior when image quality is inadequate. Hazard analysis shows that a camera obstruction must not be interpreted as a good product.

The team discovers that a random image split overestimates performance because consecutive images of the same assembly appear in both training and test sets. The dataset is reorganized by production batch and includes different shifts, illumination levels, fastener finishes, camera alignments, and known fault cases.

Approach and solution

The system is designed with an image-quality gate before classification. If quality is insufficient or model confidence is below the approved threshold, the cell routes the part to human inspection. A conventional presence sensor remains as an independent interlock for a critical fastening station. The model, preprocessing code, image-quality gate, and runtime are packaged together.

Testing proceeds from recorded-image evaluation to SIL, then HIL with the production controller and simulated line timing. Pilot operation begins in shadow mode, where predictions are logged but do not control disposition. After review of false negatives and operator workload, a controlled release is approved. Monitoring records latency, image-quality failures, prediction rates, manual overrides, and later inspection outcomes.

Outcome and learning points

The most important improvement is not simply a higher test score. It is the evidence chain connecting requirements, diverse data, independent safeguards, realistic timing tests, operator procedures, and a rollback plan. After a lighting retrofit, input distributions shift and the image-quality alarm rate rises. The model is not immediately retrained. Instead, the change is investigated, a new validation set is collected, and deployment is reconsidered only after performance and safety evidence are re-established.

The case demonstrates that industrial validation evaluates the complete sociotechnical system, not an isolated algorithm.

11. Best-practice checklist

Before release, an engineering team should be able to answer “yes” to the following questions:

  • Are purpose, operating domain, failure consequences, and acceptance criteria explicit?
  • Are data provenance, labels, partitions, and known gaps recorded?
  • Can the exact released artifact be rebuilt and identified?
  • Are requirements traced to verification and validation evidence?
  • Have timing, interfaces, abnormal inputs, and fallback behavior been tested?
  • Have realistic environmental and subgroup conditions been evaluated?
  • Are monitoring signals, thresholds, ownership, and escalation procedures defined?
  • Is there a tested rollback and incident-response procedure?
  • Are security, privacy, human oversight, and regulatory obligations addressed?
  • Is retirement defined if the system can no longer be trusted or supported?

Chapter Summary

AI engineering in mechatronics is a lifecycle discipline rather than a one-time model-building exercise. Requirements must connect AI metrics to physical, operational, safety, and human consequences. Reproducibility requires versioning data, labels, code, dependencies, configurations, and artifacts. Verification confirms conformity to specified design, whereas validation establishes fitness for the intended real-world use.

Simulation, SIL, HIL, bench testing, pilot operation, and field validation provide complementary evidence. Robustness analysis explores plausible disturbances, while uncertainty handling supports abstention and safe fallback. MLOps provides controlled pipelines for registration, deployment, monitoring, updates, and rollback. Monitoring must cover service, data, model, and system behavior; drift detection is an indicator for investigation, not proof of failure. Finally, traceable documentation, security, human oversight, and continuous risk management are essential for trustworthy industrial AI.

Key Terms

Requirements engineering: Converting stakeholder needs into measurable, testable, and traceable specifications.

Operating domain: The conditions and uses for which an AI component has been designed and validated.

Verification: Evidence that a system conforms to specified design and implementation requirements.

Validation: Evidence that a system solves its intended problem in its intended context.

MLOps: Practices integrating machine learning development, deployment, operations, and governance.

Data lineage: A record of data origin, transformations, versions, and uses.

Experiment tracking: Systematic recording of hypotheses, configurations, results, and decisions.

Model registry: A controlled repository of model artifacts and their lifecycle states.

Software-in-the-loop: Testing production software with a simulated plant or environment.

Hardware-in-the-loop: Testing real hardware connected to a real-time simulated environment.

Robustness: Ability to maintain acceptable behavior under specified disturbances or variation.

Aleatoric uncertainty: Uncertainty caused by inherent observation noise or ambiguity.

Epistemic uncertainty: Uncertainty caused by limited knowledge or insufficient training coverage.

Data drift: Change in the distribution of input data.

Concept drift: Change in the relationship between inputs and targets or required actions.

Rollback: Restoration of a previously approved system version.

Traceability: Ability to relate requirements, artifacts, tests, decisions, and releases.

Model card: Documentation describing a model’s purpose, performance, limitations, and appropriate use.

Residual risk: Risk remaining after controls have been applied.

Review Questions

Short Answer Questions

  1. Why is accuracy alone usually insufficient as an industrial AI requirement?
  2. Distinguish verification from validation.
  3. What information should be recorded in an experiment-tracking system?
  4. Define data drift and concept drift.
  5. Why is rollback important in an AI deployment process?

Long Answer Questions

  1. Explain how requirements should be allocated from business objectives to an AI component and its surrounding mechatronic system.
  2. Compare MIL, SIL, HIL, bench, pilot, and field testing, including the evidence each level provides.
  3. Describe a complete MLOps pipeline for a predictive-maintenance application.
  4. Discuss how robustness, uncertainty, fallback behavior, and independent safeguards contribute to safe deployment.
  5. Explain how documentation and traceability support maintenance, governance, incident investigation, and regulatory accountability.

Analytical / Application Questions

  1. Design a validation plan for an AI collision-warning system on a mobile robot. Specify requirements, test environments, disturbances, monitoring signals, and release criteria.
  2. A production camera is replaced with a different model and the rate of low-confidence predictions doubles. Analyze possible causes and propose a controlled engineering response.
  3. Develop a lifecycle risk-control strategy for an AI bearing-failure predictor whose false negatives can cause costly machine damage but whose false positives interrupt production.

Multiple Choice Questions with Answers

Question 1

Which statement best distinguishes verification from validation?

A. Verification tests whether the system meets specified design requirements; validation tests whether it solves the intended real-world problem.

B. Verification is performed only after deployment; validation is performed only during training.

C. Verification measures business profit; validation measures processor speed.

D. Verification concerns operators; validation concerns only source code.

Correct Answer: A. Verification tests whether the system meets specified design requirements; validation tests whether it solves the intended real-world problem.

Question 2

For a binary classifier, which metric is defined as TP ÷ (TP + FN)?

A. Precision

B. Recall

C. Specificity

D. False-positive rate

Correct Answer: B. Recall

Question 3

Which practice most directly prevents leakage from nearly identical production images into both training and test sets?

A. Increasing the learning rate

B. Using a larger neural network

C. Splitting data by batch, machine, or time period

D. Removing the validation set

Correct Answer: C. Splitting data by batch, machine, or time period

Question 4

What is the principal purpose of hardware-in-the-loop testing?

A. To replace all field testing with random data

B. To test real hardware interfaces and timing against a simulated plant or environment

C. To eliminate the need for requirements

D. To measure only model parameter count

Correct Answer: B. To test real hardware interfaces and timing against a simulated plant or environment

Question 5

Which is an example of concept drift?

A. A sensor produces values in a new file format

B. The proportion of products made on night shift increases

C. The relationship between vibration patterns and bearing failure changes after a machine modification

D. A model file is compressed before deployment

Correct Answer: C. The relationship between vibration patterns and bearing failure changes after a machine modification

Question 6

Which item is essential for a reproducible released AI artifact?

A. Only the final model weights

B. Model weights together with preprocessing, dependencies, configuration, and identifying version information

C. A verbal description from the developer

D. Only the training accuracy

Correct Answer: B. Model weights together with preprocessing, dependencies, configuration, and identifying version information

Question 7

A safety-related AI component receives an unfamiliar or poor-quality input. Which response is generally most appropriate?

A. Increase the output command automatically

B. Treat the prediction as certainly correct

C. Use a defined abstention, fallback, or safe-state procedure

D. Delete the input from all logs

Correct Answer: C. Use a defined abstention, fallback, or safe-state procedure

Question 8

What does service monitoring primarily measure?

A. Latency, availability, throughput, and resource use

B. Whether labels are ethically selected

C. Only the confusion matrix on historical data

D. The mechanical hardness of a workpiece

Correct Answer: A. Latency, availability, throughput, and resource use

Question 9

Why should PSI not be treated as proof that a model has failed?

A. It cannot compare distributions

B. It is a screening indicator whose interpretation depends on bins, context, and engineering impact

C. It is calculated only from labels

D. It always equals zero for drifted data

Correct Answer: B. It is a screening indicator whose interpretation depends on bins, context, and engineering impact

Question 10

Which deployment practice provides a controlled way to restore a previously approved model after an incident?

A. Rollback

B. Random retraining

C. Removing experiment records

D. Disabling monitoring

Correct Answer: A. Rollback

Artificial Intelligence in Mechatronics Applications
Chapter 13 of 15