Fixed: MLflow Signature Says long for a predict_proba Model
I logged a classifier that returns probabilities, with pyfunc_predict_fn="predict_proba" and an input example, and MLflow gave it a signature whose output is [long (required)]: one whole number per row, a class label. The model returns three probabilities per row. MLflow infers a scikit-learn model's signature from predict, whatever pyfunc_predict_fn says. Inferring the signature myself, from predict_proba, and passing it to log_model fixed it.
What I Was Doing
The shopper model of the MLflow series returns the chance that a session ends in a purchase, so it's logged with pyfunc_predict_fn="predict_proba". Here's the same setup with a smaller model: a logistic regression on scikit-learn's iris flowers, three classes, on MLflow 3.18.0 and scikit-learn 1.9.1. I passed an input example and let MLflow infer the signature from it, as How to Add an Input Example to an MLflow Model does:
import mlflow
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("proba-signature-demo")
X, y = load_iris(return_X_y=True, as_frame=True)
model = LogisticRegression(max_iter=500).fit(X, y)
with mlflow.start_run():
model_info = mlflow.sklearn.log_model(
model, name="iris-model", input_example=X.head(3), pyfunc_predict_fn="predict_proba"
)
print("Signature outputs:", model_info.signature.outputs)
print("Prediction:", mlflow.pyfunc.load_model(model_info.model_uri).predict(X.head(1)).round(3))
uv run python proba_example.py
What I Expected
A signature whose output is the three probabilities, the same thing the model returns.
What I Got
2026/11/21 14:27:36 INFO mlflow.tracking.fluent: Experiment with name 'proba-signature-demo' does not exist. Creating a new experiment.
2026/11/21 14:27:36 INFO mlflow.utils.uv_utils: Detected uv project: found uv.lock and pyproject.toml in /Users/you/source/mlflow-demo
/Users/you/source/mlflow-demo/.venv/lib/python3.15/site-packages/mlflow/types/utils.py:440: UserWarning: Hint: Inferred schema contains integer column(s). Integer columns in Python cannot represent missing values. If your input data contains missing values at inference time, it will be encoded as floats and will cause a schema enforcement error. The best way to avoid this problem is to infer the model schema based on a realistic data sample (training dataset) that includes missing values. Alternatively, you can declare integer columns as doubles (float64) whenever these columns may have missing values. See `Handling Integers With Missing Values <https://www.mlflow.org/docs/latest/models.html#handling-integers-with-missing-values>`_ for more details.
warnings.warn(
2026/11/21 14:27:37 INFO mlflow.utils.uv_utils: Detected uv project: found uv.lock and pyproject.toml in /Users/you/source/mlflow-demo
2026/11/21 14:27:37 INFO mlflow.utils.environment: Detected uv project at /Users/you/source/mlflow-demo. Attempting to export requirements via 'uv export'.
2026/11/21 14:27:37 INFO mlflow.utils.uv_utils: Exported 91 dependencies via uv
2026/11/21 14:27:37 INFO mlflow.utils.environment: Successfully exported 91 requirements from uv project. Skipping package capture based inference.
🏃 View run skillful-moose-990 at: http://127.0.0.1:8080/#/experiments/23/runs/06666399468e4387be60bd5e55b52cc6
🧪 View experiment at: http://127.0.0.1:8080/#/experiments/23
Signature outputs: [long (required)]
Prediction: [[0.982 0.018 0. ]]

Two things disagree. The signature says the model returns one long per row, and the prediction underneath it is three probabilities. And there's a warning about integer columns, though all four inputs are decimals. The model's MLmodel file shows the same signature, predict_fn: predict_proba with outputs: '[{"type": "long", "required": true}]':

What I Checked
MLflow's reference for mlflow.sklearn.log_model says of input_example: "When the signature parameter is None, the input example is used to infer a model signature." It doesn't say which method makes the predictions.
MLflow's code. In save_model in mlflow/sklearn/__init__.py, with no signature and an input example, MLflow wraps the model in _SklearnModelWrapper(sk_model) and infers the signature from that wrapper's prediction. The wrapper's predict calls the scikit-learn model's predict; pyfunc_predict_fn isn't passed in at that point.
What predict returns. For a classifier, the class labels, as whole numbers: 0, 1 or 2 here. That's the long in the signature, and the integer column the warning is about: the warning comes from the output, not the inputs.
Why It Happens
MLflow infers the signature by running the input example through predict, even when the model is logged to answer with predict_proba. So a probability model gets the signature of a label model. Loading it works, and so does predicting: MLflow's signatures guide lists the checks it makes on a signature's inputs and parameters, none on its outputs. But the signature describes something the model never returns.
The Fix
Infer the signature yourself from what the model returns, predict_proba, and pass it to log_model:

import mlflow
from mlflow.models import infer_signature
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("proba-signature-demo")
X, y = load_iris(return_X_y=True, as_frame=True)
model = LogisticRegression(max_iter=500).fit(X, y)
# Infer the signature from what the model will return: the probabilities.
signature = infer_signature(X, model.predict_proba(X))
with mlflow.start_run():
model_info = mlflow.sklearn.log_model(
model,
name="iris-model",
input_example=X.head(3),
signature=signature,
pyfunc_predict_fn="predict_proba",
)
print("Signature outputs:", model_info.signature.outputs)
print("Prediction:", mlflow.pyfunc.load_model(model_info.model_uri).predict(X.head(1)).round(3))
The input example stays: it's still saved with the model. Only the signature now comes from infer_signature, which How to Add a Signature to an MLflow Model covers.
After the Fix
uv run python proba_signature.py
2026/11/21 14:27:41 INFO mlflow.utils.uv_utils: Detected uv project: found uv.lock and pyproject.toml in /Users/you/source/mlflow-demo
2026/11/21 14:27:41 INFO mlflow.utils.uv_utils: Detected uv project: found uv.lock and pyproject.toml in /Users/you/source/mlflow-demo
2026/11/21 14:27:41 INFO mlflow.utils.environment: Detected uv project at /Users/you/source/mlflow-demo. Attempting to export requirements via 'uv export'.
2026/11/21 14:27:41 INFO mlflow.utils.uv_utils: Exported 91 dependencies via uv
2026/11/21 14:27:41 INFO mlflow.utils.environment: Successfully exported 91 requirements from uv project. Skipping package capture based inference.
🏃 View run industrious-cub-546 at: http://127.0.0.1:8080/#/experiments/23/runs/85a5dc77aa674e3594dc9f585c84970e
🧪 View experiment at: http://127.0.0.1:8080/#/experiments/23
Signature outputs: [Tensor('float64', (-1, 3))]
Prediction: [[0.982 0.018 0. ]]

The output is now a tensor of decimals, float64, with any number of rows (-1) and three columns, one probability per class: exactly what the prediction shows. The integer warning is gone too. In MLmodel:

Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
Trusting the inferred signature of a predict_proba model | It describes labels, long | Pass infer_signature(X, model.predict_proba(X)) |
Inferring the output from model.predict(X) by hand | A signature of labels again, a tensor of int64 | Use the method the model is logged with |
| Dropping the input example to avoid the warning | No example, and no signature at all | Keep the example and pass the signature |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
UserWarning: Hint: Inferred schema contains integer column(s) though every input is a decimal | The output was inferred from a classifier's predict, labels | Pass a signature inferred from predict_proba |
The signature's output is long, the predictions are decimals | Same | Same |
FAQ
Does the wrong signature break predictions?
Not here: loading the model and predicting returned the probabilities either way. The signature is what the model tells everyone else about itself, and with long it said the wrong thing.
Why a tensor instead of named columns?
predict_proba returns a NumPy array without column names, so infer_signature describes it as a tensor: a type and a shape.
Conclusion
MLflow inferred the probability model's signature with predict, so its output said long, one label per row, while the model returned three probabilities. infer_signature(X, model.predict_proba(X)), passed to log_model, gave it a float64 tensor of shape (-1, 3), matching what the model really returns.
Additional Resources
- mlflow.sklearn —
log_model'ssignature,input_exampleandpyfunc_predict_fn. - Model Signatures and Input Examples — tensor and column signatures.
