Sub topic 1
Why ML needs its own governance
Prerequisites
This chapter assumes you already know the following:
- The basic ML lifecycle: training, evaluation, deployment, and monitoring.
- Git and CI/CD pipelines, including what a pull request review and a pipeline gate do.
- Basic Python reading ability. The short examples are plain Python.
- What a model registry or experiment tracker does, at the level of "it stores model versions and metadata".
You do not need any legal background. This tutorial is practical engineering guidance and not legal advice.
What governance means here
ML governance is the set of controls that let you answer four questions about any model in production, at any later date:
- What exactly is running? This covers the model version, the code, the data, and the configuration.
- Who changed it, and who allowed the change?
- Why was it considered fit for its purpose at the time?
- What did it do, and who or what acted on its output?
A control is a mechanism that makes one of these answers reliable. Examples are an audit event written on every action, an approval required before a release, and a registry stage that blocks untested models. The rest of this tutorial builds those controls one by one and then maps them to the EU AI Act (Regulation (EU) 2024/1689).
Why software change control is not enough
Most teams already have change control for software: code in Git, reviews on pull requests, a CI pipeline, and a deployment log. That covers a lot, but it assumes something that ML breaks. In ordinary software, the code determines the behavior. If you know the commit, you know what the system does.
In ML, behavior comes from code, data, and training run together. The same commit trained on a different data snapshot gives a different model. The same data with a different random seed can give a different model. So the Git history alone cannot tell you why a model behaves as it does.
| Aspect | Ordinary software | ML system |
|---|---|---|
| What determines behavior | Source code and configuration | Code, training data, hyperparameters, random seeds, and the training environment |
| Artifact that ships | Build from a commit | A trained model file, produced by a run that may not be exactly reproducible |
| What a review can check | Read the diff and reason about it | A diff of weights is unreadable, so review relies on evaluation results |
| How it fails | Mostly visible errors and crashes | Silent degradation: the system runs but gets worse |
| Change after release | Only when someone deploys | Also through drift, because the world and the input data change |
| Evidence of correctness | Tests that pass or fail | Metrics on a dataset, which depend on which dataset and which slices |
Three consequences follow from this table.
The unit of change is larger than a commit
A model release is a bundle: code commit, dataset snapshot, training configuration, evaluation report, and the resulting model artifact. If any one piece is missing from your records, you cannot reconstruct or explain the release. Governance therefore tracks lineage, the chain from raw data to deployed model. Chapter material on lineage follows later in this tutorial.
Review depends on evidence, not on reading
A reviewer cannot inspect a model the way they inspect a diff. They have to decide based on evaluation reports, fairness checks, and documented limits. This makes the approval record only as good as the evidence attached to it. An approval that says "looks good" with no linked evaluation report is nearly worthless in an audit.
Behavior can change without any release
A deployed model can degrade because the input distribution shifts, even when nobody touched it. Governance has to cover ongoing operation, with monitoring and a record of what was observed and what was done about it. A release-time approval does not cover this.
Where the risk comes from
Several failure modes show up repeatedly, and each one corresponds to a missing control.
- Unknown model in production. A team cannot say which version served a given prediction. The control is a version identifier on every prediction or batch.
- Unreviewed promotion. One engineer trains a model and pushes it to production alone. The control is an approval workflow with separation of duties.
- Untraceable data. A training set is later found to contain data that should not have been used, but nobody knows which models used it. The control is lineage records.
- Edited history. After an incident, someone adjusts the log to look better. The control is a tamper-evident log.
- Evidence that exists only in people's heads. The person who ran the evaluation left the company. The control is a release record stored with the model version.
Regulation makes these controls more than good practice. For some systems, the EU AI Act requires logging, documentation, human oversight, and quality management. Those requirements are the reason this tutorial pairs engineering controls with the Act.
The shape of a governed release
The following diagram shows the flow this tutorial builds toward. Each step leaves a record, and the records link together.
Notice two things. The audit log receives an event from every stage, so it is the shared backbone. The loop from monitoring back to training means governance does not end at release.
A first look at an audit event
Later chapters design audit events in detail. For now, a minimal event shows the idea. This example records one promotion decision as a plain dictionary. It contains the actor, the action, the model and version, a timestamp, and a pointer to the data lineage.
import json
from datetime import datetime, timezone
event = {
"ts": datetime.now(timezone.utc).isoformat(),
"actor": "alice",
"action": "promote_to_production",
"model": "credit-scoring",
"version": "2.4.0",
"details": {
"training_data_ref": "dataset-snapshot-2026-03-01",
"evaluation_report": "reports/eval-2.4.0.json",
},
}
print(json.dumps(event, indent=2))This record already answers who, what, which version, and when. It does not yet resist tampering, and nothing yet requires a second person to agree. Both gaps are addressed in the chapters that follow.
Common errors
- Treating the Git log as the audit trail. Git records code changes. It does not record dataset versions, evaluation results, or who approved a model for production.
- Logging only successes. Rejected approvals and failed gates are evidence too. They show that the controls actually blocked something.
- Approvals without evidence. A signature with no linked report cannot be checked later.
- Mutable records. If the log can be edited by the same people it audits, it proves little.
- Governing only at release. Drift and incidents happen in operation, so monitoring events belong in the same record.
Summary of the working model
ML behavior comes from code plus data plus training, so a commit does not fully describe a release. Governance fills the gap with four things: lineage that ties a model to its inputs, audit events that record every action, approvals that require independent people with evidence, and monitoring that continues after release. The rest of the tutorial implements these and then shows which obligations of the EU AI Act they support.
Exercise
A team keeps all code in Git with required pull request reviews, and deploys models through CI. A regulator asks which training data produced the model that served a decision six months ago. Why might the team be unable to answer, and which two controls from this chapter would fix it?
Show answer
Git history records code changes only. It does not record which dataset snapshot a training run used or which model version served a given prediction. Without that, the team cannot link the decision to a data snapshot. Lineage records (dataset snapshot reference, code commit, and training configuration stored with each model version) and an audit event or version identifier on each prediction or batch would let the team trace the decision back to the data.
Exercise
Name two reasons why an approval that says only "looks good" is weak evidence for an ML release, and state what should be attached to it.
Show answer
First, a reviewer cannot read a trained model like a code diff, so the decision depends on evaluation evidence that the record does not show. Second, a later reviewer cannot check what the approver actually saw. The approval should link the evaluation report, the dataset snapshot reference, and the code commit for that model version.