Training pipeline, registry, and lineage
A model artifact is only meaningful if you can explain where it came from and safely move it into production. The pipeline turns data snapshots into checkpoints; the registry turns checkpoints into deployable versions; lineage connects every deployed prediction back to code, data, features, labels, config, and eval. Without that graph, rollback and debugging are guesswork.
0 · Think of release, not training
Beginners often stop at "train a model." Production thinking starts with a stricter question: what would make this model safe to release and easy to roll back? The answer is linear:
- Freeze the training inputs: data snapshot, labels, feature definitions, code, config.
- Run training and produce an artifact: weights plus preprocessing, thresholds, tokenizer or schema, and serving config.
- Evaluate the artifact against offline metrics, slices, calibration, cost, and safety gates.
- Promote it through staging, canary, and production only when each prior promise is true.
- Rollback the whole bundle if a promise breaks, not just the weights.
This lesson is the release discipline that keeps ML from becoming a pile of unrepeatable experiments.
1 · The artifact graph
General ML lifecycle design is a lineage problem. The output artifact is not just weights; it is a bundle of dependencies that must travel together.
| Artifact | Why it must be versioned | Common bug if missing |
|---|---|---|
| Code commit | Training logic and preprocessing define the learned function | Metric cannot be reproduced |
| Data snapshot | Rows change, late labels arrive, deletes happen | Rollback model retrains differently |
| Feature definitions | Feature code is part of the model | Train/serve skew after a feature patch |
| Model config | Hyperparameters and seeds affect artifact | "Same" run produces incompatible output |
| Eval report | Promotion needs a gate and audit trail | Bad model ships on anecdote |
| Serving contract | Input schema, output schema, thresholds, calibration | Model scores change meaning in production |
2 · Pipeline stages and gates
A robust training pipeline is a sequence of gates. The point is not bureaucracy; it is to fail early while the blast radius is small.
- Ingest gate: schemas valid, source freshness inside SLO, required fields present.
- Feature gate: point-in-time joins pass, train/serve parity checks pass, feature distributions inside expected ranges.
- Label gate: label maturity window satisfied, label coverage and class balance within bounds.
- Training gate: run completed, no NaNs, expected loss curve shape, resource budget respected.
- Offline eval gate: task metrics improve or hold, segment regressions bounded, calibration checked.
- Release gate: shadow/canary/A/B guardrails clear, rollback path exists.
3 · Experiment tracking vs model registry
These are often conflated, but they answer different questions.
| System | Question answered | Writes many or few? | User |
|---|---|---|---|
| Experiment tracker | What did we try, and what happened? | Many runs | Researchers / MLEs |
| Model registry | Which artifact is allowed to serve traffic? | Few promoted versions | Production / release |
| Feature registry | Which feature definitions are valid and owned? | Moderate | Data + ML platform |
| Dataset registry | Which immutable snapshots can train or evaluate? | Moderate | Training + audit |
A model can be a great experiment and a bad registry candidate. Promotion requires more than a metric: lineage, serving compatibility, calibration, safety, cost, and rollback.
4 · Promotion is a state machine
Treat model lifecycle as explicit state transitions, not a folder naming convention.
| Transition | Must prove | Rollback object |
|---|---|---|
| candidate -> staging | Offline metrics, schema compatibility, lineage complete | Do not promote |
| staging -> canary | Serving p99, resource cost, output contract, shadow no-op safety | Remove canary route |
| canary -> production | Online primary metric wins; guardrails hold | Previous prod model + previous feature set |
| production -> retired | No active traffic, audit retention satisfied | Archived artifact |
5 · The reproducibility budget
Perfect bitwise reproducibility is expensive and sometimes unnecessary. But the level should be chosen deliberately:
| Level | Guarantee | Enough for |
|---|---|---|
| Audit reproducible | Can explain data/code/config/eval lineage | Most product ML |
| Metric reproducible | Retrain lands within expected metric band | Regression debugging |
| Artifact reproducible | Same weights/logits from same inputs | Regulated or safety-critical workflows |
Do not pay artifact-level complexity if audit-level is enough. But do not accept "we think this was the data" for any model that gates money, safety, or user access.
What carries forward
- Lineage is the backbone of MLOps. A model artifact without data, feature, code, config, and eval lineage cannot be safely promoted or debugged.
- Gates are ordered. Data correctness before model quality; offline before online; canary before production.
- Registries are release systems. Experiment trackers remember attempts; registries decide what is allowed to serve.
- Rollback includes dependencies. Reverting only weights while leaving a new feature definition or calibration map in place is not a rollback.