Skip to main content

Description

Remove experiments from your DVC project. This command deletes experiment references and associated data, helping you clean up unsuccessful experiments or maintain a tidy experiment history. You can remove individual experiments, all experiments from specific commits, or queued experiments.
This operation is irreversible. Removed experiments cannot be recovered. Review your selection carefully before removing experiments.

Usage

Aliases: dvc exp rm

Arguments

string[]
One or more experiment names to remove. Can specify multiple experiments separated by spaces.

Options

Selection Options

string[]
Remove all experiments from the specified Git revisions. Can be used multiple times.
boolean
default:"false"
Remove experiments from all Git commits.
integer
default:"1"
Remove experiments from the last N commits. Used with --rev or --all-commits.
boolean
default:"false"
Remove all queued experiments (experiments staged with dvc exp run --queue but not yet executed).
integer
Keep the N most recent experiments and remove the rest. Must be used with --rev or --all-commits.
string
Name or URL of the Git remote to remove the experiment from. This removes experiments from a remote repository.

Examples

Remove a single experiment

Output:
Removing an experiment deletes its reference and cached data, but doesn’t affect any Git branches created from it.

Remove multiple experiments

Output:

Remove all experiments from current commit

Output:
This is useful for cleaning up after a hyperparameter sweep on the current commit.

Remove all queued experiments

Output:
This only removes queued experiments that haven’t been executed yet.

Remove experiments from multiple branches

Output:

Keep only recent experiments

Output:
Use --keep to maintain a fixed number of experiments for reference while cleaning up older ones.

Remove from last N commits

Output:

Remove all experiments

Output:
This removes ALL experiments from your project. Use with extreme caution!

Remove from remote repository

Output:
This removes the experiment from the remote Git repository, not just your local copy.

Common Workflows

Clean up failed experiments

Maintain experiment history limit

Cancel queued experiments

Clean up before archiving

Remove experiments after promotion

Removing an experiment doesn’t affect Git branches created from it using dvc exp branch.

Understanding Removal Scope

What Gets Removed

  1. Experiment references: Entries in DVC’s experiment database
  2. Cached data: Model outputs and artifacts unique to the experiment
  3. Metrics history: Historical metrics recorded for the experiment
  4. Parameter snapshots: Parameter values used in the experiment

What Doesn’t Get Removed

  1. Git branches: Branches created via dvc exp branch remain intact
  2. Shared cache: Data shared with other experiments or commits
  3. Git commits: Regular Git commits are unaffected
  4. Current workspace: Your working directory remains unchanged
DVC uses reference counting for cached data. Removing an experiment only deletes data that’s not referenced by other experiments or commits.

Validation and Safety

Confirm before removal

Remove with filtering

Backup before bulk removal

Troubleshooting

No experiments to remove

Output:
This means there are no experiments associated with the specified revision.

Experiment not found

Output:
Solution:

Cannot remove from remote

Output:
Removing experiments from a remote requires write access to the remote repository.
  • dvc exp show - View experiments before removing
  • dvc exp run - Create new experiments
  • dvc exp branch - Convert experiment to permanent branch before removing
  • dvc gc - Clean up unused cache data (after removing experiments)