﻿# DVC dvc.lock: what a pipeline state records and what it does not

Read DVC stage definitions, dependency hashes and parameters alongside data retrieval to make model-preparation runs reproducible.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/data-guide-dvc-data-pipeline-lock/
Language: en

## Definitions and recorded state have different jobs

In DVC, dvc.yaml defines pipeline stages, commands, dependencies and outputs. The generated dvc.lock records stage state, including hashes and parameter values. Keeping both with the code explains which declared inputs produced a tracked artifact.

For a tokenizer-preparation pipeline, that record might connect source files, a vocabulary-building script and its selected parameters to an output artifact. The lockfile is not the dataset itself. A repository can contain a perfectly readable state description while the required large files are absent locally.

## Declare the inputs that actually matter

Reproduction decisions rely on the pipeline's declared dependencies and configuration. If a stage reads an undeclared file or a mutable external endpoint, a recorded state can omit a meaningful input. Add relevant scripts, files and parameters to the dependency model instead of assuming the command text captures everything it reads.

A practical inspection follows the command and asks which resources influence the output. Environment variables and installed library versions can matter even when they are not visible in a data hash. Record the execution environment alongside the pipeline state.

## Understand what reproduction proves

The repro command works from the declared pipeline and determines which stages need updating. A skipped stage can indicate that DVC sees no relevant declared change. It is not an independent scientific finding that the resulting model remains suitable for a new task.

Distinguish reusing a tracked result from executing the stage again. Both can be legitimate, but they answer different questions when investigating nondeterminism. Keep the command outcome and resulting artifact hashes available rather than relying on a statement that the pipeline ran.

## Retrieve data separately from repository changes

DVC pull obtains tracked data from remote storage and materializes it in the workspace through the cache. Its documentation distinguishes this from obtaining code and metadata with Git. A new checkout therefore needs both the intended repository revision and access to the referenced data.

If a pull cannot retrieve a required object, do not quietly substitute a newer dataset with the same filename. That can preserve a familiar directory layout while changing the actual training input. Resolve the missing artifact or explicitly create a new experiment state.

## Keep a coherent release record

DVC generates and updates the lockfile; manual changes are discouraged by its documentation. Review state changes together with the stage definition and outputs. A changed hash can be expected after a filter update, but the reason should be visible in the accompanying code or parameter change.

This workflow makes data preparation inspectable. It does not guarantee deterministic GPU kernels or preserve every external service automatically. Reproducibility comes from the recorded dependency boundary, retained artifacts and execution conditions working together.

## Primary references

[DVC pipeline and lockfile structure](https://doc.dvc.org/user-guide/project-structure/dvcyaml-files).

[DVC repro](https://doc.dvc.org/command-reference/repro).

[DVC pull](https://doc.dvc.org/command-reference/pull).

Related explanations: [Document provenance](/journal/document-markdown-json-provenance/); [Document-level splits](/journal/document-level-data-split-leakage/).
