Model & Data Versioning
Tracking code, training data, model parameters, and environment dependencies to ensure reproducible deployments.
Why Machine Learning Needs Special Versioning
In traditional software, Code Commit A always produces Binary Output A.
In machine learning, running the exact same code on different dataset versions produces completely different model outputs!
Software Versioning: Code Version
ML Versioning: Code Version + Data Version + Hyperparameters + Environment
To reproduce or audit a production prediction, you must track all four elements together.
The 4 Pillars of ML Versioning
┌──────────────────────────┬──────────────────────────┬──────────────────────────┬──────────────────────────┐
│ 1. CODE VERSION │ 2. DATA VERSION │ 3. PARAMETER VERSION │ 4. ENVIRONMENT VERSION │
├──────────────────────────┼──────────────────────────┼──────────────────────────┼──────────────────────────┤
│ Git commit hash for │ DVC / Delta Lake hash │ Hyperparameters, loss │ Docker container image, │
│ pipeline scripts. │ for training dataset. │ functions, seeds. │ library dependencies. │
└──────────────────────────┴──────────────────────────┴──────────────────────────┘
1. Code Versioning (Git)
Tracks preprocessing scripts, model definitions, and evaluation code using standard Git repositories.
2. Data Versioning (DVC / LakeFS)
Large datasets cannot fit inside Git repositories. Tools like DVC (Data Version Control) compute unique hashes of large data files stored in cloud storage (S3), storing lightweight pointer files inside Git.
3. Model Weight Versioning (Model Registry)
Trained neural network weight files (PyTorch .pt or ONNX .onnx) are assigned semantic versions (for example v1.2.0) inside a central Model Registry.
4. Environment Versioning (Docker)
Container images freeze specific library versions (Python, PyTorch, CUDA drivers) to prevent environment discrepancies.
Say this out loud
Model and data versioning tracks code, datasets, model weights, and environment dependencies together. Standard Git handles code, while data version control tools store dataset hashes to manage large files. Versioning all four components guarantees complete model reproducibility, simplifies historical debugging, and satisfies regulatory compliance audits.
Followups to expect
- How does DVC connect with Git? DVC creates small text metadata files ending in
.dvcthat store data hashes. These small text files are committed to Git while raw large datasets stay in cloud storage. - What is Semantic Versioning for models? Structuring model version numbers where major versions represent architectural changes, minor versions represent retraining on new data, and patch versions represent minor tuning fixes.
Check yourself
Why is standard Git code versioning insufficient for machine learning applications?