Skip to main content

Description

DVC metrics commands help you track, display, and compare machine learning metrics across different experiments, commits, branches, and tags. Metrics are numerical values that measure model performance (e.g., accuracy, loss, precision).

Subcommands

metrics show

Print metrics with optional formatting.
dvc metrics show

Arguments

targets
list
Limit command scope to these metrics files. Using -R, directories to search metrics files in can also be given.

Options

-a, --all-branches
flag
Show metrics for all branches.
-T, --all-tags
flag
Show metrics for all tags.
-A, --all-commits
flag
Show metrics for all commits.
--json
flag
Show output in JSON format.
--md
flag
Show tabulated output in the Markdown format (GFM).
-R, --recursive
flag
If any target is a directory, recursively search and process metrics files.
--precision
integer
Round metrics to n digits precision after the decimal point. Rounds to 5 digits by default.

Example Output

$ dvc metrics show
Path              auc      loss
metrics.json      0.95678  0.21344
Use --json flag when you need to programmatically parse metrics output.

metrics diff

Show changes in metrics between commits in the DVC repository, or between a commit and the workspace.
dvc metrics diff

Arguments

a_rev
string
default:"HEAD"
Old Git commit to compare (defaults to HEAD).
b_rev
string
default:"workspace"
New Git commit to compare (defaults to the current workspace).

Options

--targets
list
Specific metrics file(s) to compare (even if not found as metrics in dvc.yaml). Using -R, directories to search metrics files in can also be given. Shows all tracked metrics by default.
-R, --recursive
flag
If any target is a directory, recursively search and process metrics files.
--all
flag
Show unchanged metrics as well.
--json
flag
Show output in JSON format.
--md
flag
Show tabulated output in the Markdown format (GFM).
--no-path
flag
Don’t show metric path.
--precision
integer
Round metrics to n digits precision after the decimal point. Rounds to 5 digits by default.

Example Output

$ dvc metrics diff
Path              Metric    HEAD     workspace  Change
metrics.json      auc       0.95234  0.95678    0.00444
metrics.json      loss      0.23456  0.21344    -0.02112
By default, only changed metrics are shown. Use --all to see unchanged metrics.
Metrics diff requires Git commits. Make sure your changes are committed before comparing.

Use Cases

Track Model Performance

Monitor how your model metrics change across experiments and iterations.

Compare Branches

Evaluate metric differences between feature branches and main branch.

A/B Testing

Compare different model architectures or hyperparameter configurations.

CI/CD Integration

Automate metric reporting in continuous integration pipelines with --json output.
  • dvc params - Compare parameters across experiments
  • dvc plots - Visualize metrics as plots
  • dvc exp show - Show metrics for experiments

Build docs developers (and LLMs) love