Skip to main content

How to Delete an Alias in MLflow

· 4 min read
Jagdish Kumawat
Founder @ Dewiride

An alias that no longer means anything, such as a challenger whose trial is over, is worth removing, so nobody loads it by mistake. MlflowClient.delete_registered_model_alias removes the alias and leaves the version it pointed to untouched. Real output from MLflow 3.18.0.

Syntax​

Syntax
MlflowClient().delete_registered_model_alias(name, alias)
PartWhat it means
nameThe registered model
aliasThe alias to remove, such as challenger

The reference for delete_registered_model_alias: "Delete an alias associated with a registered model." It takes no version, because an alias points to one version at a time.

Prerequisites​

  • An MLflow tracking server with a database backend at http://127.0.0.1:8080, such as mlflow server --port 8080 with its default SQLite database. The registry needs one.
  • mlflow and scikit-learn in your project, for example with uv add mlflow scikit-learn pandas.

Step 1: Delete the Alias​

The example registers an iris classifier as iris-trial, points challenger at its version 1, and prints the registered model's aliases before and after deleting it:

The delete_alias.py script in a macOS-style code window: a logistic regression registered as iris-trial, challenger set to version 1, the aliases printed, then delete_registered_model_alias and the aliases printed again.

delete_alias.py
import mlflow
from mlflow import MlflowClient
from sklearn.datasets import load_iris
from sklearn.linear_model import LogisticRegression

mlflow.set_tracking_uri("http://127.0.0.1:8080")
mlflow.set_experiment("delete-alias-example")
client = MlflowClient()
name = "iris-trial"

iris = load_iris(as_frame=True)
X, y = iris.data, iris.target_names[iris.target]
with mlflow.start_run():
mlflow.sklearn.log_model(
LogisticRegression(max_iter=1000).fit(X, y), name="model", registered_model_name=name, input_example=X.head(3)
)
client.set_registered_model_alias(name, "challenger", "1")
print("Before:", client.get_registered_model(name).aliases)

client.delete_registered_model_alias(name, "challenger")
print("After: ", client.get_registered_model(name).aliases)
Terminal
uv run python delete_alias.py
Output (last lines)
Before: {'challenger': '1'}
After: {}

The end of the output in a terminal: Before shows challenger pointing to version 1, After shows an empty dictionary.

The registered model has no aliases left. Version 1 is still there, ready to load as models:/iris-trial/1: deleting an alias removes only the name.

Common Mistakes​

MistakeWhat happensDo this instead
Deleting an alias that code still loadsEvery load of models:/<name>@<alias> failsPoint that code at another alias or a version number first
Deleting the alias to get rid of a versionThe version stays in the registryDelete the version itself

Troubleshooting​

SymptomLikely causeFix
INVALID_PARAMETER_VALUE: Registered model alias challenger not found. when loadingThe alias was deletedSet it again on the version you want
The delete runs without an error, but the alias is still listedThe name of the alias or of the registered model is misspelled; deleting an alias that doesn't exist raises no errorPrint get_registered_model(name).aliases and copy the name from it

FAQ​

Do I have to delete an alias before moving it?​

No. Setting it on another version moves it in one call: How to Set an Alias on a Model Version in MLflow with Python.

Does deleting a version delete its aliases?​

Yes: How to Delete a Model Version in MLflow shows the alias disappearing with the version.

Conclusion​

client.delete_registered_model_alias("iris-trial", "challenger") emptied the registered model's aliases, from {'challenger': '1'} to {}, and left version 1 in place.

Additional Resources​