# Data and Model Versioning with DVC

> Version large datasets and model files alongside code, and define reproducible pipelines that rerun only what changed. Free notes, key concepts, resources and...

Canonical: https://www.internhack.in/roadmaps/tracks/machine-learning/data-versioning
Last updated: 2026-11-28

Version large datasets and model files alongside code, and define reproducible pipelines that rerun only what changed.

Intermediate · about 5 hours · difficulty 2/5

Learn first: [Experiment Tracking with MLflow and Weights and Biases](https://www.internhack.in/roadmaps/tracks/machine-learning/experiment-tracking)

Git is built for text files, not 20 GB of images. Yet a model is a function of code **and** data, so both need versions. **DVC** (Data Version Control) extends Git to handle this.

### How DVC works

- `dvc add data/raw` replaces the data in Git with a small `.dvc` pointer file holding a content hash.
- The actual files live in a **remote** (S3, GCS, Azure, SSH or a local folder) and are fetched with `dvc pull`.
- Checking out an old commit plus `dvc checkout` restores the exact data used then.

### Pipelines

A `dvc.yaml` file describes stages (prepare, featurize, train, evaluate) with their dependencies and outputs. `dvc repro` reruns only stages whose inputs changed, like `make` for ML. `dvc metrics diff` and `dvc plots` compare results across branches.

### Alternatives and complements

- **Lake formats** such as Delta Lake or Apache Iceberg offer time travel on tables.
- **LakeFS** gives Git-like branches over object storage.
- **Hugging Face Hub** datasets have versioned repos.
- Model files usually live in the **model registry** from experiment tracking, linked to the data version that produced them.

### Lineage

The goal is lineage: for any prediction in production you can answer which model, trained on which data, by which code. That matters for debugging, audits and regulated industries.

**Good enough to move on** when you can clone a repo, run `dvc pull` and `dvc repro`, and get the same model and metrics as the original author.

## Key concepts

- **Why data needs versions**
- **dvc add and remotes**
- **dvc.yaml pipelines and repro**
- **Metrics and plots diff**
- **Lineage and audit trails**
- **Delta Lake, Iceberg and LakeFS**

## Mini project

Put your project's raw data under DVC with a cloud or local remote, define a three-stage dvc.yaml pipeline, change one feature, and use dvc metrics diff to show the effect between two branches.

## Check yourself

What is actually committed to Git when you run dvc add on a folder, and how does dvc repro decide which stages to rerun?

## Free resources

- [DVC documentation](https://dvc.org/doc) (Iterative)
- [Made With ML](https://madewithml.com/) (Made With ML)

Previous: [Experiment Tracking with MLflow and Weights and Biases](https://www.internhack.in/roadmaps/tracks/machine-learning/experiment-tracking) · Next: [Docker for ML](https://www.internhack.in/roadmaps/tracks/machine-learning/docker-for-ml)

## More in MLOps: Shipping and Operating Models

- [From Notebook to Production Code](https://www.internhack.in/roadmaps/tracks/machine-learning/notebook-to-production-code)
- [Experiment Tracking with MLflow and Weights and Biases](https://www.internhack.in/roadmaps/tracks/machine-learning/experiment-tracking)
- [Data and Model Versioning with DVC](https://www.internhack.in/roadmaps/tracks/machine-learning/data-versioning)
- [Docker for ML](https://www.internhack.in/roadmaps/tracks/machine-learning/docker-for-ml)
- [Serving Models with FastAPI and BentoML](https://www.internhack.in/roadmaps/tracks/machine-learning/model-serving)
- [ML Pipelines, Orchestration and CI/CD](https://www.internhack.in/roadmaps/tracks/machine-learning/ml-pipelines-cicd)
- [Monitoring, Drift and Model Maintenance](https://www.internhack.in/roadmaps/tracks/machine-learning/model-monitoring)
- [Feature Stores](https://www.internhack.in/roadmaps/tracks/machine-learning/feature-stores)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Machine Learning Engineer Roadmap](https://www.internhack.in/roadmaps/tracks/machine-learning)
