Skip to content
XTechStacks TECHNOLOGY · AI · STRATEGY · IMPACT
Menu

MLOps & LLMOps

Data Versioning with DVC: Building Reproducible MLOps Pipelines

Connect Git revisions, DVC artifacts and pipeline dependencies to reproduce experiments and recover approved releases.

Updated

Conceptual illustration for Data Versioning with DVC: Building Reproducible MLOps Pipelines

Reader outcome: track two dataset revisions with DVC, recover the earlier one in a clean workspace and observe why Git history cannot replace missing artifact storage. The existing downloadable lab is the execution path for this article. It uses synthetic ticket-duration data and a deterministic summary, not model training.

What Git and DVC each retain

Git records the code, small DVC references and pipeline metadata. The dataset and generated outputs live in the DVC cache and configured remote. A commit alone does not prove that objects were uploaded or retained. The lab uses a local filesystem remote for an isolated exercise; it is not an offsite backup or a cloud-authorization test.

Git and DVC: references versus artifacts. Git repository: Code, .dvc pointers, dvc.yaml and dvc.lock; DVC cache: Local data and model objects; Authorized remote: Retained objects for sharing and recovery; Pipeline dependencies: Declared inputs, stages and outputs; Run record: Code revision, parameters and metrics; Release record: Approved references and retained artifacts. Git tracks small references; DVC retains the corresponding large objects. Recovery needs both.
Git and DVC: references versus artifacts Git tracks small references; DVC retains the corresponding large objects. Recovery needs both. View full-size diagram

Start with the verified lab and its prerequisites

Use Git and Python 3.12 in a fresh workspace. The original package pins DVC 3.67.1; the recorded and repeat runs used Python 3.12.8 and Git 2.50.1 on macOS ARM64. Read the included README before execution. Installation needs network access, while the exercise uses only its own local files and disables DVC telemetry for the lab commands. Windows activation and other platforms have not been verified here.

The runner initializes its own repositories, configures a local remote, creates both revisions and stops if its output directory already exists. Do not run a second hand-written initialization sequence over those generated repositories. The original lab, instructions, expected results and download below are preserved unchanged.

Try it: recover two dataset revisions from a clean workspace

Hands-on lab · added October 22, 2026. A recovery claim needs evidence from a workspace that does not already contain the data. This XTechStacks example creates a tiny, synthetic ticket-duration dataset, versions it twice, and verifies what a different workspace can actually recover.

The example deliberately uses a deterministic summary instead of model training: it separates artifact recovery from training randomness. No customer records, paid cloud services or API keys are involved.

Download the DVC recovery lab · ZIP, 6 KB

The download contains readable Python source, setup instructions, the tested package versions and the expected verification results. It runs on your computer; the website does not execute it or receive the generated dataset.

1. Run in a new, disposable workspace

Unzip the package, open a terminal in its folder, and use Git plus Python 3.12. The following setup installs DVC in an isolated Python environment. The lab requires a new output-directory name and stops if that directory already exists.

python3.12 -m venv .venv
. .venv/bin/activate
python -m pip install -r requirements.txt
python recovery_lab.py ./recovery-evidence

These activation commands are for macOS/Linux shells. The recorded run used macOS ARM64, Python 3.12.8, Git 2.50.1 and DVC 3.67.1. Other platforms have not been verified here. Dependency installation needs internet access; the lab itself uses a local filesystem remote and disables DVC telemetry for its commands.

2. Follow the evidence, not just the Git commit

The script creates a producer repository and a separate consumer clone. The producer tracks tickets.csv with DVC, declares a summary stage, and pushes the dataset and generated output to the local remote. Git stores the script, pointers, configuration and lockfile. It does not store either data artifact.

dvc add tickets.csv
dvc stage add -n summarize -d tickets.csv -d summarize.py \
  -o summary.json python summarize.py
dvc repro
dvc push

The consumer starts without dataset files or cached objects. After checking out lab-v1, dvc pull restores the approved input and output. A forced dvc repro --force then executes the summary again; its result must match the restored summary, including the input SHA-256. Switching to lab-v2 retrieves the second revision.

Expected results from synthetic inputs, not business benchmarks
RevisionInput durationsRowsTotalMean
lab-v110, 20, 30 minutes360 minutes20.0 minutes
lab-v210, 20, 30, 40 minutes4100 minutes25.0 minutes

The arithmetic is intentionally simple. What matters is that the old Git revision selects the old artifact reference, that the artifact still exists, and that a clean consumer can retrieve and reproduce it.

3. Verify the failure boundary

A third, independent clone is pointed at an intentionally empty local remote. Its Git revision remains readable, but dvc pull must return a nonzero exit code and the dataset must remain absent. No retained remote objects are deleted to create this test.

4. Inspect the verification record

A successful run writes status: PASS and eleven completed checks to recovery-evidence/results.json. The full command transcript is in commands.json. The ZIP includes verified-results.json from the recorded October 22 run so you can compare the deterministic dataset hashes and summaries. Git commit hashes and local paths will differ between runs.

  • The baseline input SHA-256 begins 36d786170d84e9dd; the complete hash is in the results file.
  • Restored and freshly recomputed summaries match exactly.
  • The second revision changes the row count and mean as shown above.
  • The empty-remote clone retains its Git history but cannot retrieve the missing dataset.

What this lab does—and does not—prove

It demonstrates data-pointer versioning, deterministic pipeline execution, recovery without an existing object cache, and the consequence of unavailable artifact storage. A filesystem remote on the same machine is not an off-site backup. The example does not test cloud authorization, retention enforcement, disaster recovery, model quality or a live service rollback.

For an enterprise pipeline, repeat this exercise against your approved remote with a separate authorized identity, retained release objects and an environment you can recreate. Treat a failed artifact retrieval as a failed recovery check, even when Git checkout succeeds. Record the decision and fix the missing storage or access dependency before approving the release.

Command references: DVC remote add and DVC pull.

Inspect initialization, commits and revision transitions

The runner’s command transcript contains the exact arguments and exit codes. The sequence below is a readable extract from the tested lab, not a second standalone script: run it only by inspecting the matching producer/consumer directories created by the runner. The relative remote path resolves to that exercise’s remote directory. Switching Git tags selects the corresponding DVC metadata; dvc pull then retrieves the referenced objects.

# Producer steps performed by recovery_lab.py:
git init -b main
dvc init
dvc remote add -d labstore ../remote
dvc add tickets.csv
dvc stage add -n summarize -d tickets.csv -d summarize.py \
  -o summary.json python summarize.py
dvc repro
dvc push
git add .
git commit -m "Synthetic baseline"
git tag lab-v1
# The runner adds the fourth row, updates DVC metadata, reproduces,
# pushes and commits the second revision before tagging lab-v2.
# Consumer steps performed in a separate, empty-cache clone:
git checkout lab-v1
dvc pull
dvc repro --force
git checkout lab-v2
dvc pull

The original lab was rerun from the live production ZIP in a new disposable directory during this revision. All eleven checks passed again: baseline recovery produced three rows and a 20-minute mean; revision two produced four rows and a 25-minute mean; the deliberately empty remote failed as expected. These are synthetic summaries, not model-quality scores.

Recover the approved references and artifacts. Select approved revision: Checkout code and DVC metadata; Retrieve retained objects: dvc pull from an authorized remote; Recreate dependencies: Pin the compatible runtime; Run and verify: Reproduce and test the expected output; Approve recovery: Check compatibility before serving; Investigate missing objects: Stop if required artifacts were not retained. The last card is a failure boundary: a Git reference cannot recreate a deleted remote object.
Recover the approved references and artifacts The last card is a failure boundary: a Git reference cannot recreate a deleted remote object. View full-size diagram

Common failures and bounded remedies

Observed problemCheck firstBounded remedy
Runner says output directory existsWas the same output path reused?Choose a new empty output-directory name. Do not delete an existing repository to force the exercise through.
dvc command not foundIs the intended virtual environment active?Activate the environment and install the package’s pinned requirements; verify the DVC version.
Pull cannot find the datasetDid the producer push objects, is the expected Git tag selected, and does the local remote path resolve?Correct the reference/path or restore authorized retained objects. Do not rewrite tracking metadata merely to silence a missing-object error.
The empty-remote pull failsIs this the lab’s intentional unavailable-storage case?Expected: the command fails but the complete lab reports PASS. Other unexpected failures stop the run.
Summary differs after recoveryDo input hash, tag, code and environment match the recorded evidence?Compare results.json and commands.json. Keep the mismatch visible; investigate before claiming reproduction.
A real cloud remote denies accessIs the identity authorized and is the required object retained?Use the approved access/recovery process. The local lab does not validate cloud credentials or retention.

Connect dataset recovery to an ML release

DVC metadata identifies file-based artifacts; an operating model release also needs its feature logic, parameters, environment, evaluation and deployment decision. Use the tool-independent release-manifest guide for those relationships instead of treating a data revision as the entire release. For where recovery fits among pipeline stages, return to the implementation roadmap and artifact gates.

Keep the original download and recorded results together. Successful local retrieval does not certify disaster recovery, storage permissions, privacy retention or live service rollback.

Editorial transparency

The recovery walkthrough added October 22, 2026 was prepared with AI assistance for drafting and example code. Its 11 recorded local checks cover the synthetic DVC lab described above. They do not establish a customer deployment outcome or replace testing your own remote storage, credentials and retention policy.

The download includes the runnable source and verification details. To report a reproducibility problem, cite the command, software version and relevant output through our contact form. Please remove credentials and confidential data before sharing.

References

Atul Yadav

Technology architect and founder of XTechStacks, writing about AI, data, cloud, platform engineering and enterprise architecture.

CONTINUE EXPLORING

More engineering insights.

XTECHSTACKS WEEKLY

Stay ahead with practical technical insights.

AI, data, cloud and platform engineering—delivered without the noise.

Working on a similar architecture?
XTechStacks helps teams design, build and operate practical technology solutions.

Talk to Us
A LITTLE CLARITY FOR YOUR INBOX

Make room for useful insight.

Join XTechStacks Weekly for engineering lessons, architecture patterns and thoughtful technology perspectives.

Confirm your subscription by email. Unsubscribe anytime.
We respect your inbox. Privacy policy