Skip to main content

Overview

DVC experiments let you iterate on your ML models by running your pipeline with different parameters, code changes, or data. Each experiment is tracked automatically, allowing you to compare results and reproduce your best models.
Experiments are Git-based but don’t clutter your repository. They’re stored as lightweight references that you can review, compare, and promote to branches.

Quick Start

1

Set up your pipeline

First, ensure you have a pipeline with parameters:
dvc.yaml
params.yaml
2

Run your first experiment

Run an experiment with different parameter values:
This:
  • Runs your pipeline with lr=0.01
  • Names the experiment high-lr
  • Tracks all results automatically
3

View experiment results

See all experiments and their metrics:
You’ll see a table comparing all experiments, their parameters, and metrics.

Running Experiments

With Parameter Changes

Modify parameters on the fly using -S or --set-param:
Use -n or --name to give experiments meaningful names. Otherwise, DVC auto-generates names like exp-a1b2c.

With Code Changes

Make code changes and run experiments without committing:
DVC tracks uncommitted code changes in experiments. You can experiment freely without affecting your main branch.

Queue and Run Multiple Experiments

Queue experiments for batch processing:
Use -j or --jobs to run experiments in parallel: dvc exp run --run-all -j 4

Run in Temporary Directory

Run experiments without affecting your workspace:
This creates a temporary directory, runs the experiment, and cleans up automatically.

Viewing Experiments

Show All Experiments

Display a table of all experiments:
Example output:

Filter and Sort

Export to CSV or JSON

Comparing Experiments

Compare Two Experiments

See the differences between two experiments:
Example output:

Compare with Workspace

Compare an experiment to your current workspace:

Include All Metrics and Params

Managing Experiments

Apply an Experiment

Restore an experiment to your workspace:
This replaces your workspace with the experiment’s code, parameters, and data. Commit or stash changes first.

Create a Branch from an Experiment

Promote a successful experiment to a Git branch:
Now you can:

Remove Experiments

Push and Pull Experiments

Share experiments with your team:

Advanced Workflows

Run experiments with multiple parameter combinations:

Hyperparameter Tuning

Integrate with your tuning framework:
train.py

Custom Commit Messages

Add context to experiments:

Experiment Table Customization

Show Only Stage Dependencies

This shows only parameters that are declared as stage dependencies in dvc.yaml.

Precision Control

Round metrics to 4 decimal places.

Hide Columns

Best Practices

Name your experiments

Use descriptive names like -n "baseline-model" instead of auto-generated IDs

Track all parameters

Declare all hyperparameters in params.yaml for complete experiment tracking

Use queues for batches

Queue multiple experiments and run them in parallel with --run-all -j N

Branch successful experiments

Promote winning experiments to branches: dvc exp branch exp-name feature-branch

Compare systematically

Use dvc exp diff to understand what changed between experiments

Clean up regularly

Remove failed experiments to keep your experiment list manageable

Complete Example

Here’s a full workflow:
1

Baseline experiment

2

Try different learning rates

3

Compare results

4

Test best configuration

5

Promote to production

Next Steps

Remote Storage

Store experiment results and models in remote storage

Collaboration

Share experiments and pipelines with your team