Sub topic 1
Why ML needs its own governance
Prerequisites
This chapter assumes you know the ML lifecycle (training, evaluation, deployment, monitoring). You should be able to read basic Python and have used Git and a CI/CD pipeline. Familiarity with a model registry helps.
Why ML differs from software change control
Software change control records which code changed and who reviewed it. An ML model also depends on training data, hyperparameters, and evaluation results. A model can change behavior without any code change, because new data produces new weights. Governance must therefore track the data and the model, not only the commit.
Designing audit trails for ML systems
An audit trail is an ordered record of actions. Each event should capture the actor, the action, the model version, the data lineage, and a timestamp.
from datetime import datetime, timezone
event = {
"ts": datetime.now(timezone.utc).isoformat(),
"actor": "alice",
"action": "model_promoted",
"model": "credit-scoring",
"version": "2.4.0",
"data_ref": "dataset-snapshot-2026-03-01",
}
print(event["action"]) # model_promotedTracking data, code, and model lineage
Lineage links an artifact to its inputs. For each model version, record the dataset snapshot, the code commit, and the evaluation report. When an auditor asks where a score came from, the lineage answers the question.
Making logs tamper-evident and retaining them
A plain log can be edited after the fact. Hash chaining fixes this. Each event stores a hash of the previous event, so changing an earlier entry breaks every later hash. Keep logs for the retention period your obligations require.
Approval workflows and separation of duties
An approval workflow requires named people to sign off before a release. Separation of duties means the person who requests a release cannot also approve it. Require one approval per role, such as a model owner and a risk reviewer.
Promotion gates in a model registry
A promotion gate is a check that blocks a model from moving to the next stage, for example from staging to production, until its approvals and evaluation results are present. The registry enforces the gate, so no one can skip it by editing a config file.
Exercise
Why is a log without hash chaining unreliable as audit evidence?
Show answer
Anyone with write access can edit an earlier event, and nothing in the log reveals the change. With hash chaining, each event's hash depends on the previous one, so any edit breaks every later hash and can be detected.