Skip to main content

Fixed: "FutureWarning: mlflow.models.utils.validate_serving_input is deprecated since 3.13.0"

· 5 min read
Jagdish Kumawat
Founder @ Dewiride

I checked a logged model's serving input with mlflow.models.validate_serving_input, and MLflow answered with the predictions and a FutureWarning: ``mlflow.models.utils.validate_serving_input`` is deprecated since 3.13.0. This method will be removed in a future release. Use ``mlflow.models.predict`` instead. The warning names its replacement, and mlflow.models.predict does a stronger check: it predicts in a fresh environment built from the model's own requirements.

What I Was Doing​

Before deploying a model, I wanted to make sure it accepts a request in the format MLflow's REST API uses. On MLflow 3.18.0, I turned three rows of input into a serving request with convert_input_example_to_serving_input and passed it to validate_serving_input, for a linear regression trained on scikit-learn's diabetes data:

validate_old.py
import sys

import mlflow
from mlflow.models import convert_input_example_to_serving_input, validate_serving_input
from sklearn.datasets import load_diabetes

mlflow.set_tracking_uri("http://127.0.0.1:8080")

X, _ = load_diabetes(return_X_y=True, as_frame=True)
serving_input = convert_input_example_to_serving_input(X.head(3))
print(validate_serving_input(sys.argv[1], serving_input))
Terminal
uv run python validate_old.py models:/m-4bc61ef4ed934f89b2764c65df636f69

What I Expected​

The three predictions, with no warnings.

What I Got​

The predictions, after a warning:

Output
/Users/you/source/mlflow-demo/validate_old.py:11: FutureWarning: ``mlflow.models.utils.validate_serving_input`` is deprecated since 3.13.0. This method will be removed in a future release. Use ``mlflow.models.predict`` instead.
print(validate_serving_input(sys.argv[1], serving_input))
[206.11667725 68.07103297 176.88279035]

The output of validate_old.py in a terminal: a FutureWarning saying mlflow.models.utils.validate_serving_input is deprecated since 3.13.0 and will be removed, use mlflow.models.predict instead, then the predictions 206.12, 68.07 and 176.88.

What I Checked​

MLflow's reference for mlflow.models carries the same warning on validate_serving_input, and adds: "This API is deprecated. Use mlflow.models.predict() instead, which validates the input example by running prediction in an isolated environment (e.g. with env_manager="uv") that closely mirrors the serving environment."

MLflow's guide to validating models before deployment uses mlflow.models.predict and doesn't mention validate_serving_input.

Why It Happens​

MLflow 3.13.0 deprecated validate_serving_input in favor of mlflow.models.predict. The old function still works in 3.18.0, which is why it printed the predictions, but every call warns, and a future release removes it.

The Fix​

Call mlflow.models.predict instead. It takes the input as it is, so the conversion to a serving request goes too, and it predicts in a new environment built by uv:

fresh_env.py
import sys

import mlflow
from sklearn.datasets import load_diabetes

mlflow.set_tracking_uri("http://127.0.0.1:8080")

X, _ = load_diabetes(return_X_y=True, as_frame=True)
mlflow.models.predict(model_uri=sys.argv[1], input_data=X.head(3), env_manager="uv")

After the Fix​

Terminal
uv run python fresh_env.py models:/m-4bc61ef4ed934f89b2764c65df636f69
Output (excerpt)
2026/11/21 14:31:30 INFO mlflow.models.flavor_backend_registry: Selected backend for flavor 'python_function'
2026/11/21 14:31:31 INFO mlflow.utils.virtualenv: Creating a new environment in /var/folders/…/T/tmpqupj33l7/envs/virtualenv_envs/mlflow-7ce281718f4d3c0008005aff97ca470a54f7fb7a with python version 3.15.2 using uv
...
{"predictions": [206.11667724510568, 68.07103297306874, 176.882790351053]}

The output of fresh_env.py in a terminal: MLflow selects the python_function backend, creates a new environment with uv, and prints the same three predictions as JSON, with no FutureWarning.

No warning, and the same three predictions, this time from an environment that holds only the model's recorded requirements. The ... stands for the environment's setup and the list of installed packages. How to Test an MLflow Model in a Fresh Environment walks through that output, and why the first call takes a minute.

Common Mistakes​

MistakeWhat happensDo this instead
Silencing the FutureWarningThe code breaks when a release removes the functionMove to mlflow.models.predict now
env_manager="local" to make it fasterThe test uses your environment, not the model'senv_manager="uv"

Troubleshooting​

SymptomLikely causeFix
mlflow.models.predict waits a minute after installingPython compiles the new environment's packages on first importExpected for a fresh environment

FAQ​

Can I still pass a serving request to predict?​

Yes: input_path= takes a JSON file, such as the model's own serving_input_example.json, with content_type="json".

Why is the new check better?​

validate_serving_input predicted in your current environment; mlflow.models.predict with env_manager="uv" predicts in one built from the model's requirements, so it also catches a missing package.

Conclusion​

validate_serving_input still returned predictions in MLflow 3.18.0, but warned that it's deprecated since 3.13.0. mlflow.models.predict(..., env_manager="uv") returned the same predictions without the warning, and checked the model's environment too.

Additional Resources​