Skip to main content

Description

Compare the metrics and parameters between two experiments or revisions. This command provides a focused comparison showing what changed between two specific runs, making it easy to understand the impact of parameter changes on model performance.
Use dvc exp diff after running an experiment to quickly see how it compares to your baseline.

Usage

Arguments

string
default:"HEAD"
Old experiment or Git revision to compare. Defaults to HEAD if not specified.Can be:
  • Experiment name (e.g., exp-a1b2c)
  • Git commit SHA
  • Git branch name
  • Git tag
string
default:"workspace"
New experiment or Git revision to compare. Defaults to the current workspace.

Options

boolean
default:"false"
Show unchanged metrics and parameters as well. By default, only changed values are displayed.
boolean
default:"false"
Show only parameters that are stage dependencies (defined in dvc.yaml).
boolean
default:"false"
Show output in JSON format for programmatic processing.
boolean
default:"false"
Show output in Markdown table format (GitHub Flavored Markdown).
boolean
default:"false"
Don’t show the metric/parameter file path in output.
integer
default:"5"
Round metrics to N digits after the decimal point.

Examples

Compare workspace with HEAD

Output:
Positive diff values indicate improvement in metrics (when higher is better).

Compare two specific experiments

Output:
Experiment names support tab completion for easier command-line usage.

Show all metrics including unchanged

Output:
Unchanged values have a diff of 0 or show the same value in both columns.

Hide file paths

Output:

Export to JSON

Output:
JSON format is perfect for integrating with CI/CD pipelines or custom analysis scripts.

Format as Markdown table

Output:

Compare with custom precision

Output:

Compare branches

Both revisions must exist in your Git history or be valid experiment names.

Understanding the Output

Metrics Table

The metrics table shows:
  • Path: File containing the metric (e.g., metrics.json)
  • Metric: Metric name within the file
  • Old value: Metric value in first revision
  • New value: Metric value in second revision
  • Diff: Numerical difference (new - old)

Parameters Table

The parameters table shows:
  • Path: File containing the parameter (e.g., params.yaml)
  • Param: Parameter name within the file
  • Old value: Parameter value in first revision
  • New value: Parameter value in second revision
Parameters don’t show a diff because they’re often non-numeric values.

Common Workflows

Quick experiment validation

A/B testing

CI/CD integration

Documentation generation

  • dvc exp show - View all experiments in a table
  • dvc exp run - Create new experiments to compare
  • dvc metrics diff - Compare metrics without experiment context
  • dvc params diff - Compare parameters without experiment context