Most teams do not lose a model because the training failed. They lose it because nobody can say which version is running, what data trained it, or how to get the previous one back. If you want to version machine learning models without chaos, you need one naming scheme, one place where versions live, and one rule for promoting a version to production. The rest is discipline.
A model version is not just a file with a number on it. It is a snapshot of the code, the training data, the hyperparameters, and the environment that produced a specific set of weights. Change any one of those and you have a different model, even if the accuracy looks the same. Teams that treat the weights file as the whole model end up debugging ghosts: a model that works in a notebook and fails in production, with no way to reproduce it.
Version machine learning models the same way every time
The first fix costs nothing. Agree on what counts as a new version and write it down where the whole team can see it. A new version should be created whenever the training data changes, the code changes, the hyperparameters change, or the model is retrained on fresh data. If you retrain nightly and overwrite the same file each time, you have no versions at all. You have a moving target.
Keep the rule simple enough that nobody has to ask permission to follow it. One training run equals one version. If the run fails, keep the record anyway and mark it failed, because a failed run is still information. If two runs use the same data and code but different random seeds, they are two versions.
Decide what a version means before you pick a tool
Tools will not save a team that has not agreed on semantics. Before you install anything, answer three questions. First, what triggers a major version change: a new architecture, a new feature set, or a new training dataset? Second, what triggers a minor change: retraining on new data with the same setup? Third, how long do you keep old versions, and who can delete them?
A common pattern borrows from semantic versioning: bump the major number when the model interface or behaviour changes in a way that breaks existing callers, bump the minor number when you retrain or improve the model without breaking the interface, and use a patch number for fixes such as a corrected preprocessing step. The exact scheme matters less than the fact that everyone on the team reads it the same way.
Pick a naming scheme and stick to it
Names should carry enough information to identify a version without opening a dashboard. A useful pattern is model-name-v<major>.<minor>.<patch>-<date>-<short-hash>, for example churn-v2.3.0-20261120-a1b2c3. The date tells you when it was trained, the hash ties it to a specific code commit, and the version numbers tell you how it relates to the versions around it.
| Part | What it tells you | Example |
|---|---|---|
| Model name | Which problem the model solves | churn |
| Major.minor.patch | How this version relates to the last one | 2.3.0 |
| Date | When the model was trained | 20261120 |
| Short hash | Which code commit produced it | a1b2c3 |
| Stage label | Where the version is allowed to run | staging, production |
Avoid names that encode opinions, such as final, final-v2, or best-model. Those names lie within a week. A version number never claims to be the best. It only claims to be one specific build, and that is exactly what you need when something breaks at 2 a.m.
Use an ML model registry as the single source of truth
An ML model registry is the place where versions live, with their metadata, stage, and lineage attached. Instead of model files scattered across laptops, shared drives, and cloud buckets, every trained model is registered in one place with a version number, a link to the training run, and a stage such as staging or production. When someone asks which model is live, the registry answers. When you need to roll back, you point production at the previous registered version instead of hunting for a file.
MLflow is the most common starting point, and mlflow model versioning covers the basics well: versioned models, stage transitions, and annotations. If your team already tracks experiments in one platform, check whether its registry fits before adding a second system. A comparison of the main options can help you weigh the trade-offs, and our guide to MLflow vs Weights and Biases vs Neptune walks through how each one handles experiment tracking and model storage. The right choice is usually the one your team will actually keep using, not the one with the longest feature list.
Whatever registry you pick, enforce two rules. First, no model reaches production unless it is registered. A file copied by hand into a deployment folder is not a version, it is a shortcut that will cost you later. Second, only the registry changes a version stage. If someone can flip production to an unregistered model by editing a config file, the registry is decoration.
Tie each version to data, code, and config
A version number is useless if you cannot rebuild the model it points to. Every registered version should record four things: the code commit, the dataset version or snapshot identifier, the hyperparameters and config file, and the environment, such as the container image or dependency lock file. Store the dataset identifier, not a copy of the whole dataset, unless your data is small enough that copying it is cheap. For large datasets, a snapshot ID or a hash of the data manifest is enough, as long as that snapshot is still retrievable.
This is where model versioning best practices overlap with ordinary software habits. Version your training code in Git, version your data with a tool such as DVC or your data platform snapshot feature, and store the training config alongside the code. When a model misbehaves in production, you should be able to check out the commit, pull the data snapshot, rerun training, and get the same weights.
Keep evaluation results with the version too. Accuracy, precision, recall, latency, and whatever business metric matters should be stored as part of the version metadata, measured on the same held-out set for every version.
Automate promotion, deployment, and rollback
Manual promotion is where versioning falls apart. A person copies a file, updates a config, and forgets to record which version they deployed. Automate the path instead: when a version passes its checks, a pipeline promotes it in the registry, and the deployment pulls the model by version number from the registry. Nothing is deployed by filename or by a path typed from memory.
A practical pipeline has three gates. First, automated tests run on the registered version: the model loads, it answers sample inputs, and its metrics clear a threshold on the held-out set. Second, a human or an automated rule approves the stage change from staging to production. Third, the deployment records the version it installed, so the serving logs show the version behind every prediction. Our walkthrough on how to set up CI/CD for machine learning models with GitHub Actions shows how to wire these gates into a pipeline your team already knows.
Rollback deserves the same automation. A rollback should be one action: point production at the previous registered version and redeploy. Practice it before you need it. Teams that have never rolled back a model discover, during an incident, that their rollback path needs a file nobody can find.
Common mistakes that bring the chaos back
- Overwriting in place. Saving each retrain over the same file destroys history. Always write a new version, even for a small retrain.
- Versioning weights but not data. If the data changes and the version does not, two models with the same number can behave differently.
- Two registries. A team registry plus a personal folder of “good” models guarantees disagreement about which version is live.
- Stages as folders. Moving files between a staging folder and a production folder is not staging. Use the registry stage, and let the deployment read it.
- No retention policy. Keeping every version forever fills storage and slows the registry. Decide how long staging versions live, archive old production versions, and delete only with a recorded decision.
- Skipping evaluation on retrains. A retrain on fresh data can get worse. Every version needs its metrics measured on the same held-out set before promotion.
Machine learning model deployment gets easier once versioning is boring. The goal is not a clever system. It is a system so plain that a new teammate can find the live version, read its lineage, and roll it back without asking anyone. Start with the naming scheme and the registry, tie each version to its data and code, and automate the promotion path.