Sub topic 6
Promotion gates in a model registry
This chapter assumes you know what a model registry does (it stores versioned models and their metadata). It also assumes you have read the earlier chapters on audit events and on approvals with separation of duties. Here you will combine them. The registry becomes the place where a release rule is enforced, not only documented.
What a promotion gate is
A model registry tracks each model version through stages. A stage is a named state that says how far a version may be used. A promotion gate is a set of checks that must pass before a version can move from one stage to the next.
A gate matters for governance because it turns a policy such as "a risk reviewer signs off before production" into something the system enforces. A wiki page asking people to follow the policy does not do that. It also leaves evidence: every attempt, passed or failed, can be written to the audit trail.
A stage model
Most teams use four stages. The names differ by tool, but the pattern is stable.
| Stage | Meaning | Who may use it |
|---|---|---|
| registered | Version exists and has lineage recorded | Developers only |
| staging | Passed automated checks, under evaluation | Test and shadow traffic |
| production | Approved for real decisions | Live traffic |
| archived | Retired, kept for audit | Nobody, read-only |
Transitions are restricted. A version should not jump from registered to production, and an archived version should not come back to life silently.
Two kinds of checks
Separate the checks into two groups, because they fail in different ways.
Automated checks are cheap and run on every attempt:
- Lineage is complete: data snapshot reference, code commit, and training configuration are all present.
- An evaluation report exists and its metrics meet the agreed thresholds.
- Required documentation fields are filled in, such as intended purpose and risk tier.
Human checks are slower and apply to the transition into production:
- One approval for each required role, for example model owner and risk reviewer.
- No approval from the person who requested the release (separation of duties).
- A recorded oversight measure for high-risk systems, which later chapters cover.
Put the automated checks on the move into staging and the human checks on the move into production. Reviewers then spend time only on versions that already passed the mechanical tests.
Implementing a gate
The following example is self-contained. It reuses the role-and-requester rule from the approvals chapter and adds a stage table, metric thresholds, and an audit event for every attempt.
from datetime import datetime, timezone
ALLOWED = {
"registered": {"staging", "archived"},
"staging": {"production", "archived"},
"production": {"archived"},
"archived": set(),
}
REQUIRED_ROLES = {"model_owner", "risk_reviewer"}
MIN_AUC = 0.80
LINEAGE_FIELDS = ("training_data_ref", "code_commit", "evaluation_report")
def check_gate(version: dict, target: str, requested_by: str) -> list:
"""Return a list of failure reasons. An empty list means the gate passes."""
failures = []
if target not in ALLOWED[version["stage"]]:
failures.append(f"transition {version['stage']} -> {target} is not allowed")
return failures
if target in ("staging", "production"):
for field in LINEAGE_FIELDS:
if not version.get(field):
failures.append(f"missing lineage field: {field}")
if version.get("metrics", {}).get("auc", 0.0) < MIN_AUC:
failures.append(f"auc below {MIN_AUC}")
if target == "production":
approved_roles = {
a["role"]
for a in version.get("approvals", [])
if a["decision"] == "approved" and a["approver"] != requested_by
}
for role in sorted(REQUIRED_ROLES - approved_roles):
failures.append(f"missing approval from role: {role}")
return failures
def promote(version: dict, target: str, requested_by: str, log: list) -> bool:
failures = check_gate(version, target, requested_by)
log.append({
"ts": datetime.now(timezone.utc).isoformat(),
"actor": requested_by,
"action": "promote_attempt",
"model": version["model"],
"version": version["version"],
"details": {
"from": version["stage"],
"to": target,
"result": "denied" if failures else "allowed",
"failures": failures,
},
})
if failures:
return False
version["stage"] = target
return True
version = {
"model": "credit-scoring",
"version": "2.4.0",
"stage": "staging",
"training_data_ref": "dataset-snapshot-2026-03-01",
"code_commit": "abc1234",
"evaluation_report": "reports/eval-2.4.0.json",
"metrics": {"auc": 0.86},
"approvals": [
{"approver": "alice", "role": "model_owner", "decision": "approved"},
],
}
log = []
print(promote(version, "production", "carol", log)) # False: no risk reviewer
version["approvals"].append(
{"approver": "bob", "role": "risk_reviewer", "decision": "approved"}
)
print(promote(version, "production", "carol", log)) # True
print(version["stage"], len(log)) # production 2Two design choices deserve attention. First, check_gate returns every failure, not only the first, so the requester can fix all problems in one pass. Second, promote logs denied attempts as well as allowed ones. A pattern of repeated denials, or of one person retrying with different approvers, is exactly what an auditor wants to see.
In production, send the events through the hash-chained append_event function from the tamper-evidence chapter. A plain list is used here only to keep the example short.
Common errors
- Gates that can be bypassed. If anyone with write access to the registry can change a stage by calling its API directly, the gate is advisory. Make the gate service the only identity allowed to change stages, and give humans no direct permission.
- Approvals that go stale. An approval applies to one specific version and one set of artifacts. If the model file or evaluation report changes after approval, the approval must be invalidated. Store the artifact checksum inside each approval and compare it at promotion time.
- Thresholds that live in code nobody reviews.
MIN_AUCis a policy decision. Keep thresholds in a versioned configuration file with its own review, and record the configuration version in the audit event. - Rollback outside the process. Redeploying an old model by hand during an incident leaves no record. Treat rollback as a transition with its own, faster gate, for example one approver on call, and log it.
- Stage and deployment drifting apart. The registry may say production while the serving system runs a different file. Have the serving layer report which version and checksum it loaded, and alert on mismatch.
Why this matters for the EU AI Act
Later chapters show that a high-risk system needs documented risk management, human oversight, and automatic logging. A promotion gate is one concrete engineering control that supports all three. The approvals show oversight at release time. The recorded metrics and lineage feed the technical documentation. The audit events of each attempt contribute to the record of what happened. The control mapping chapter returns to this and treats it as one row in a table of controls and obligations.
Exercise
A teammate asks for the final approval on version 3.1.0 and also submits the promotion request. The model owner has approved, and the risk reviewer role has approved, but the risk reviewer approval was given by the same teammate who made the request. Using the check_gate rule above, does the promotion pass, and what should the system log?
Show answer
It does not pass. The rule ignores any approval whose approver equals the requester, so the riskreviewer role counts as missing. `checkgate returns "missing approval from role: risk_reviewer". The system should still write a promote_attempt` audit event with result "denied" and that failure reason, which preserves evidence that the separation-of-duties control worked.
Exercise
Name two checks you would run before allowing registered -> staging, and one check you would add only for staging -> production. Give a reason for the split.
Show answer
Before staging: lineage fields are all present, and evaluation metrics meet the threshold (documentation completeness is also acceptable). Only for production: approvals from each required role, none from the requester. Automated checks are cheap and run on every attempt, so they filter out bad versions early. Human approvals take time and should be spent only on versions that already passed the mechanical tests.