Metadata and Lineage
Connect every version to its origins
A model's metadata connects it to its data, code, environment and evaluation evidence; lineage shrinks the graph so any incident traces back to a root cause. Metadata is what makes versions audit-friendly.
What you will learn
- List the metadata a versioned model should carry
- Explain forward and backward lineage queries
- Use lineage to trace incidents to their root cause
What is this?
Model metadata is the structured record that pins a version: source run, data version, code commit, environment, config, metrics and owner. Lineage is the graph connecting those references so you can query what fed a model, and what a dataset fed. Metadata makes each version explainable; lineage makes the whole estate traceable.
Why do you need it?
- Regulators and reviewers ask 'what produced this model' — metadata is the answer.
- Incidents trace backward: model → features → dataset → source change.
- Impact analysis queries forward: if this dataset changes, which models must be retrained?
- Metadata standards (MLflow, catalog lineage) make the same model portable across teams.
Mental model
A food's nutrition label and its farm's organic certificate
Model metadata and lineage
The label (metadata) tells you what's inside; the certificate chain (lineage) tells you where the ingredients came from. One informs; the other proves.
How it works
- At training, an SDK writes metadata: run ID, commit, data refs, config, metrics, owner.
- The registry persists metadata with the version, indexed for search.
- Lineage edges link datasets → features → model → deployments.
- Queries walk edges: backward (what made this) and forward (what uses this).
- Governance reads lineage for audits, incidents and impact analysis.
The model lineage graph in both directions.
In production
- An audit pulls ten rows of metadata for 'which models used dataset v83' — answered in seconds.
- A data corruption incident computes the blast radius: every model on the lineage of the bad dataset.
- A quarterly review surfaces models with no owner or stale data lineage for cleanup.
Best practices
- Insert metadata at generation time — retrofitting lineage never works.
- Use stable identifiers (hashes, artifact URIs) as graph nodes, not human names.
- Automate lineage capture with SDK wrappers rather than manual entry.
- Keep metadata and artifact retention in sync.
Common mistakes
- Storing metadata in a wiki or spreadsheet, detached from the artifact.
- Identifier drift: 'churn_model' meant three different actual artifacts.
- Capturing lineage for models but not datasets, so backward queries dead-end.
- No forward queries, so a data change's blast radius is unreachable.
Debugging tips
- Trace an incident: pick the model, walk lineage backward to the changed edge.
- Blast-radius question: query forward from the changed dataset to every consumer.
- Metadata missing for a version? Everything before that version is unrepairable — fix generation, then log.
Interview checkpoint
Hands-on lab
- Generate lineage records linking dataset → model
- Answer a backward query (what fed this model)
- Answer a forward query (which models use this dataset)
Capture and Query Model Lineage
25 min · advanced
Quick quiz
A backward lineage query answers which question?
A model in production without metadata about its source data is incomplete.