Evaluation, approvals and the champion
A trained model is a candidate until it passes its gates and, under a manual policy, a person approves it. The approved version becomes the default version in Model Registry: the champion that scoring and serving use. Pipewright re-checks every gate itself from the evaluation record before a version becomes the default or is served, against the rules of the release that trained it.
Metric gates and the champion
evaluation:
primary_metric: auc # tuning and the champion comparison use it
decision_threshold: 0.5
gates:
- { metric: auc, min: 0.75 }
- { metric: calibration_error, max: 0.05 }
champion: { enabled: true, min_improvement: 0.0 } # must beat the current default on the same test rows
- A model that fails a gate is not registered as a candidate; the run records
training.evaluatedwith the reason. - The champion comparison scores the current default on the same test rows, so the comparison is fair even when the data moved.
- Errors (rmse, mae, log_loss and so on) are lower-is-better: gate them with
max. For forecasts,per_series: truemakes every series pass, not only the total. - The platform can require gates in every use case, with floors (
policies.evaluation.min_gates);validaterefuses a use case below them.
Slices
evaluation:
slices: [contract_length_months, region]
slice_gates:
- { metric: auc, max_gap: 0.05, min_rows: 100 } # no slice more than 0.05 worse than overall
A model can look good overall and fail a group. Slice gates catch it; slices with too few test rows are listed but not judged.
Fairness
evaluation:
fairness:
attributes: [gender, age_band] # contract columns; need not be features
gates:
- { metric: demographic_parity_difference, max: 0.1 }
- { metric: equalized_odds_difference, max: 0.15 }
For a binary classifier, each group’s selection rate and true and false positive rates are taken at the decision threshold; the measures are the largest gaps between groups. Groups with fewer than min_rows test rows (default 30) are listed but not measured. A measure that could not be taken fails its gate. BigQuery ML use cases get the same from configuration.
Explainability and the model card
explainability (method and top_k) records the features that matter most in the evaluation record. model_card holds what a reviewer needs in words: intended use, out-of-scope uses, limitations and ethical considerations, published with the metrics, slices and fairness measures.
Approvals
| Key | Values |
|---|---|
approvals.promote_model | manual (the default): a passing model is a candidate until pipewright model approve; auto: training makes it the default |
approvals.deploy_model | manual: deploy-model asks for --approve; auto; ci: a GitHub-approved gate deploys it; on_register: the decisions workflow deploys a passing new default without a person |
approvals.approvers | Who may approve, as user:<email> or group:<email> |
The platform can make an environment stricter than a use case asks: policies.deploy_model: manual refuses automatic deploys there, and ci requires the GitHub gate.
pipewright model list --env dev --usecase churn # versions, gates, DEFAULT = the champion
pipewright model check --env dev --usecase churn --version 7 # today's gates against a version; exit 1 on failure
pipewright model approve --env dev --usecase churn --version 7 --approve
What an approval records
Since 1.4.0 an approval is judged by the released gates and approvers, not your working copy (approve from the release’s commit if they differ), and records what it approved: the evaluation record, every model file and the serving image by fingerprint, a BigQuery ML model by its etag, and the release whose rules judged it. deploy-model and promote refuse a version that is no longer that. See Integrity.
Decisions approved in GitHub
Every decision a person makes (a model approval, a deploy, a retrain case, the closed loop’s production approval) can wait in GitHub instead of on someone’s laptop. pipewright decisions pending --env prod lists what waits, with the GitHub environment that gates each item. pipewright ci init writes two workflows:
pipewright-decisions, hourly in working hours (--decisions-cronsets your own): advances closed retrain loops and starts one gate run per pending decision.pipewright-gate: waits for the required reviewers of the decision’s GitHub environment, then runs that decision’s ownpipewrightcommand. Turn on "Prevent self-review".
The decision’s event records the reviewers, their comment and the workflow run next to the CI identity that acted. Decisions made with the CLI by hand still work and are recorded as approved outside CI.
Serving the champion
pipewright deploy-model --env dev --usecase churn --dry-run
pipewright deploy-model --env dev --usecase churn --approve # all traffic
pipewright deploy-model --env dev --usecase churn --canary --approve # model.serving.canary_percent
pipewright deploy-model --env dev --usecase churn --promote # the canary takes all traffic
pipewright deploy-model --env dev --usecase churn --undeploy-canary
pipewright deploy-model --env dev --usecase churn --undeploy # stops the cost
Before the previous version is undeployed, Pipewright waits model.serving.drain_seconds (240 by default, 1.4.2) so calls in flight finish. Since 1.4.2 --undeploy also asks the launcher to remove the use case’s lookup service, if it has one (--keep-lookup-service keeps it). pipewright model endpoint prints how to call it; pipewright model predict sends instances. Endpoints, KServe, the lookup gateway, private endpoints and shared pools: Serving and Tutorial 3.