Versioning data and models

ExplainedMLOpsDevOps, Hands OnBy Cloud Hands On

Why a model's version is code plus data plus settings, and simple ways to record all three.

In ordinary software, the same code gives the same program. In machine learning, the same code on different data gives a different model. So to explain or rebuild a model you need three versions: the code (a Git commit), the data (a fingerprint or stored copy) and the settings (parameters).

The simplest data version is a hash of the training file, recorded with the run. It proves which data was used but doesn't keep a copy. Tools such as DVC keep every version of the data in storage, with a small pointer in Git, so you can get any version back. Large teams use versioned tables in a data lake.

Models get versions in a registry, each linked to the run that made it. Together these give lineage: from any prediction back to the model, the run, the code, the data and the settings.

Cost. Free: hashes and tags cost nothing; tools such as DVC are free and open source.

Use it when

How it works

Code
A Git commit for the training code.
Data
A hash, a DVC pointer or a table version.
Settings
Parameters logged with the run.
Model
A registry version linked to its run.
Lineage
Prediction to model to run to code, data and settings.

Options

Hash only
Proves what was used; you store the data yourself.
DVC
Versions files in storage with pointers in Git.
Versioned tables
Delta Lake and similar keep table history in a data lake.

Example. An auditor asked Ironbridge Payments why a customer was declined. The prediction log gave the model version; the registry gave its run; the run gave the commit, the settings and the data hash, which matched the archived training file.

Don't confuse it with

Code version
Says how the model was trained.
Data version
Says what it learnt from.

Words to know

Lineage
The chain from a prediction back to its model, run, code and data.
Hash
A short fingerprint of a file's contents.
DVC
Data Version Control: versions data files alongside Git.

Where to look

  1. MLflow UI
  2. Run
  3. Tags
  4. data_sha256

Practise it

Read it in the guide, next to the tasks and labs.

Open in DevOps, Hands On

Keep going