Fixed: dvc status Says a Model Is "modified" After Retraining with the Same Data
After I retrained a model with the same data and the same settings, dvc status reported modified: models/model.skops, although every metric came out exactly the same. The model was the same; the file wasn't, because skops writes a new file every time it saves. Comparing the two models' predictions proved it, and dvc checkout --force put the committed file back.
What I Was Doing
A machine learning project that predicts hourly bike rentals saves its trained model with skops, a library that saves scikit-learn models safely, as models/model.skops. DVC (Data Version Control) tracks that file. I was working in a fresh clone of the project, with its data and model downloaded by dvc pull. DVC and the project's commands are installed in the project, so they run through uv run.
The model's .dvc file, committed in Git, records the MD5 hash of the committed model:
cat models/model.skops.dvc
outs:
- md5: 0d54c8f60b3f6c40bce5e52814297c28
size: 2177170
hash: md5
path: model.skops
The model file in the project folder had that same hash:
md5 models/model.skops
MD5 (models/model.skops) = 0d54c8f60b3f6c40bce5e52814297c28
Then I trained the model again, with the same data, the same settings and the same code, to check that training gives the same result:
uv run train
INFO bike_demand_forecast.train: Training on 7185 hours, testing on 1460 hours
INFO bike_demand_forecast.train: Saved models/model.skops and metrics.json
INFO bike_demand_forecast.train: Test MAE 32.56, RMSE 51.77, R2 0.8011
The test scores were the ones the committed model has.
What I Expected
dvc status to report no changes, Data and pipelines are up to date., as it did before the retrain. Nothing that goes into the model had changed.
What I Got
uv run dvc status
models/model.skops.dvc:
changed outs:
modified: models/model.skops

DVC saw a different model file.
What I Checked
First, whether the scores really were the same. Training writes them to metrics.json, which Git tracks:
git status --short
Git printed nothing: metrics.json came out byte for byte the same as the committed one, so the new model scored exactly the same, to four decimal places. Git doesn't see the model file itself, because DVC keeps it out of Git.
Then the model file's hash:
md5 models/model.skops
MD5 (models/model.skops) = d834c51550dd208bb55ebb1a732dca28
A different hash from the one in the .dvc file, 0d54c8f6…. dvc diff, which compares the project folder with the last commit, agreed:
uv run dvc diff
Modified:
models/model.skops
files summary: 1 modified

Why It Happens
DVC decides whether a file changed by its hash. The dvc status reference defines modified as: "An output or dependency is found in the workspace, but the corresponding file hash in the dvc.lock or .dvc file is not up to date." The retrained file's MD5 hash, d834c515…, wasn't the 0d54c8f6… in models/model.skops.dvc, so DVC reported it, correctly.
The file changed because skops 0.16.0 never writes the same file twice. Every save stores Python object ids in the file's schema.json and the time of saving in each of its zip entries, and both differ from one save to the next. Why a skops File Changes Every Time You Save the Same Model opens two such files and shows both differences.
So the hash tells you the file is new, not that the model is. I reported this to the skops project as skops-dev/skops#574.
The Fix
First decide which model you want:
- You retrained on purpose, to make a new model: save it as a new version with
dvc add models/model.skops, and commit the.dvcfile. How to Save a New Version of a DVC-Tracked File shows each step. - The model should stay the committed one, as here: check that the retrained model really is the same, then put the committed file back. These steps do that.
1. Keep a Copy of the Retrained Model
- bash / zsh
- PowerShell
cp models/model.skops retrained.skops
Copy-Item models/model.skops retrained.skops
The next step deletes the retrained file in models, and DVC has no copy of it. This copy keeps it, in case the models turn out to differ.
2. Put the Committed Model Back
uv run dvc checkout --force models/model.skops
Building workspace index |2.00 [00:00, 312entry/s]
Comparing indexes |3.00 [00:00, 3.04kentry/s]
Applying changes |1.00 [00:00, 769file/s]
M models/model.skops

dvc checkout copies the committed version from DVC's cache into the project folder, and M means it replaced the file. It needs --force here, because the file it replaces isn't in the cache: without it, the command stops with Fixed: "Can't remove the following unsaved files without confirmation" in dvc checkout.
3. Compare What the Two Models Predict
This script loads both models and compares their predictions for every hour of the test set. Save it in the project folder as compare_models.py:
import skops.io as sio
from bike_demand_forecast.data import FEATURES, TEST_FILE, load_rentals
# Reviewed: the trees a HistGradientBoosting model is made of. This project made both files.
TRUSTED_TYPES = ["sklearn.ensemble._hist_gradient_boosting.predictor.TreePredictor"]
test = load_rentals(TEST_FILE)
committed = sio.load("models/model.skops", trusted=TRUSTED_TYPES)
retrained = sio.load("retrained.skops", trusted=TRUSTED_TYPES)
same = (committed.predict(test[FEATURES]) == retrained.predict(test[FEATURES])).all()
print(f"Same predictions for all {len(test)} test hours: {same}")

load_rentals,TEST_FILEandFEATUREScome from the project's own code: the test set and the columns the model learns from.sio.loadloads each file. skops won't load theTreePredictortype unless you list it intrusted, and the list is written out because a person reviewed it. How to Find the Untrusted Types in a scikit-learn Model with skops explains why.==compares the two arrays of predictions value by value, and.all()isTrueonly when every value matches.
Run it:
uv run python compare_models.py
Same predictions for all 1460 test hours: True
The two files still have different hashes:
md5 models/model.skops retrained.skops
MD5 (models/model.skops) = 0d54c8f60b3f6c40bce5e52814297c28
MD5 (retrained.skops) = d834c51550dd208bb55ebb1a732dca28

Two different files, one model: it predicts the same for every one of the 1,460 test hours. The file in models is the committed one again.
4. Delete the Copy and the Script
Neither is needed any more:
- bash / zsh
- PowerShell
rm retrained.skops compare_models.py
Remove-Item retrained.skops, compare_models.py
Had the predictions differed, the retrained model would be a different model. To keep it, move retrained.skops back to models/model.skops and save it as a new version, as in the first choice above.
After the Fix
git status --short
uv run dvc status
Data and pipelines are up to date.

Git has nothing to commit, and DVC reports no changes: the project matches its last commit again.
Until skops Writes the Same File for the Same Model
With skops 0.16.0, every retrain writes a new file, so dvc status will report the model as modified after every retrain, even when nothing about the model changed. Until skops-dev/skops#574 is fixed:
- Judge a retrained model by its scores and predictions, never by
dvc statusalone. - Save a new version only when you mean to keep it, with
dvc add. - Put the committed model back when it should stay, with
dvc checkout --force, after keeping a copy.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
Running dvc add after every retrain, to clear modified | Every retrain becomes a new version, another 2.2 MB copy in the cache and, after dvc push, in the remote, of the same model | Compare first, and dvc add only a model you mean to keep |
Running dvc checkout --force without a copy | The retrained file is deleted, with no copy anywhere | Copy it first, as in step 1 |
| Comparing the files' hashes to compare the models | They always differ, even for the same model | Compare predictions |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
modified: models/model.skops after a retrain, and metrics.json unchanged | skops stores object ids and the save time in every new file | Compare predictions, then dvc checkout --force or dvc add |
Can't remove the following unsaved files without confirmation | dvc checkout without --force | Add --force once the copy is kept |
UntrustedTypesFoundException from compare_models.py | Your model holds a type skops doesn't trust by default | Review the types the error names and list them in TRUSTED_TYPES |
FAQ
Why didn't Git show the change?
Git doesn't see models/model.skops at all: when DVC started tracking it, it added the file to a .gitignore in models. And metrics.json, which Git does track, came out byte for byte the same.
Is the retrained model really the same?
Here, yes: it predicted exactly the same for all 1,460 test hours, and its scores matched the committed ones to four decimal places.
Will DVC stop flagging the model once skops is fixed?
If a skops release writes the same bytes for the same model, a retrain like this one gives the same hash, and dvc status stays quiet. skops-dev/skops#574 tracks it.
Conclusion
dvc status reported modified: models/model.skops after a retrain with the same data, because skops 0.16.0 writes a new file, with a new hash, on every save. The scores were identical, and the retrained model predicted exactly the same for all 1,460 test hours, so it was the same model. dvc checkout --force put the committed file back, and DVC reported no changes.
Additional Resources
- dvc status — what
modifiedand the other states mean. - skops-dev/skops#574 — the report on skops writing a new file on every save.
- Secure persistence with skops —
loadand trusted types.
