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:
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 4Run in Temporary Directory
Run experiments without affecting your workspace:Viewing Experiments
Show All Experiments
Display a table of all experiments:Filter and Sort
- Sort by metric
- Show only changed values
- Filter columns
- All branches
Export to CSV or JSON
Comparing Experiments
Compare Two Experiments
See the differences between two experiments: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:Create a Branch from an Experiment
Promote a successful experiment to a Git branch:Remove Experiments
Push and Pull Experiments
Share experiments with your team:- Push experiments
- Pull experiments
- List remote experiments
Advanced Workflows
Grid Search
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
dvc.yaml.
Precision Control
Hide Columns
Best Practices
Name your experiments
Use descriptive names like
-n "baseline-model" instead of auto-generated IDsTrack all parameters
Declare all hyperparameters in
params.yaml for complete experiment trackingUse queues for batches
Queue multiple experiments and run them in parallel with
--run-all -j NBranch successful experiments
Promote winning experiments to branches:
dvc exp branch exp-name feature-branchCompare systematically
Use
dvc exp diff to understand what changed between experimentsClean 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