How to Add a Signature to an MLflow Model
A model's signature is its contract: the columns it expects, their types, and what it returns. MLflow saves it with the model and checks every prediction's input against it, so wrong data is refused with a clear message instead of a wrong answer. mlflow.models.infer_signature builds one from your data. This guide adds one to a scikit-learn model, with real output from MLflow 3.18.0.
Syntax
signature = infer_signature(model_input, model_output)
mlflow.sklearn.log_model(sk_model, name="...", signature=signature)
| Part | What it means |
|---|---|
infer_signature | mlflow.models.infer_signature: reads the column names and types of the input, and the type and shape of the output |
model_input | Data the model takes, such as the training features |
model_output | What the model returns for that data, such as model.predict(model_input) |
signature=signature | Saves the signature with the model, in its MLmodel file |
Prerequisites
- An MLflow tracking server at
http://127.0.0.1:8080. MLflow's tracking server guide shows how to start one. mlflowandscikit-learnin your project, for example withuv add mlflow scikit-learn pandas.
Step 1: Infer the Signature and Log It
The example fits a linear regression to scikit-learn's diabetes data, infers the signature from the training features and the model's predictions, prints it and logs it with the model:

import mlflow
from mlflow.models import infer_signature
from sklearn.datasets import load_diabetes
from sklearn.linear_model import LinearRegression
mlflow.set_tracking_uri("http://127.0.0.1:8080")
mlflow.set_experiment("signature-demo")
X, y = load_diabetes(return_X_y=True, as_frame=True)
model = LinearRegression().fit(X, y)
signature = infer_signature(X, model.predict(X))
print(signature)
with mlflow.start_run():
mlflow.sklearn.log_model(model, name="diabetes-model", signature=signature)
uv run python signature.py
2026/11/21 14:12:05 INFO mlflow.tracking.fluent: Experiment with name 'signature-demo' does not exist. Creating a new experiment.
inputs:
['age': double (required), 'sex': double (required), 'bmi': double (required), 'bp': double (required), 's1': double (required), 's2': double (required), 's3': double (required), 's4': double (required), 's5': double (required), 's6': double (required)]
outputs:
[Tensor('float64', (-1,))]
params:
None
2026/11/21 14:12:05 INFO mlflow.utils.uv_utils: Detected uv project: found uv.lock and pyproject.toml in /Users/you/source/mlflow-demo
2026/11/21 14:12:05 INFO mlflow.utils.uv_utils: Detected uv project: found uv.lock and pyproject.toml in /Users/you/source/mlflow-demo
2026/11/21 14:12:05 INFO mlflow.utils.environment: Detected uv project at /Users/you/source/mlflow-demo. Attempting to export requirements via 'uv export'.
2026/11/21 14:12:05 INFO mlflow.utils.uv_utils: Exported 91 dependencies via uv
2026/11/21 14:12:05 INFO mlflow.utils.environment: Successfully exported 91 requirements from uv project. Skipping package capture based inference.
🏃 View run redolent-kit-275 at: http://127.0.0.1:8080/#/experiments/5/runs/3494174d9b6c429a9a424335ac0f6eea
🧪 View experiment at: http://127.0.0.1:8080/#/experiments/5

The signature has three parts:
inputs: one entry per column, with its name and type. All ten diabetes columns are decimals, so all aredouble, andrequired, because none has a missing value.outputs:Tensor('float64', (-1,)).predictreturns a NumPy array, so the output is described as a tensor of decimals;-1means any number of rows.params: settings passed at prediction time. This model takes none.
Step 2: See It in the MLmodel File
The signature lives in the model's MLmodel file. Open the model from the experiment's Models tab, then its Artifacts tab:

signature:
inputs: '[{"type": "double", "name": "age", "required": true}, {"type": "double",
"name": "sex", "required": true}, {"type": "double", "name": "bmi", "required":
true}, {"type": "double", "name": "bp", "required": true}, {"type": "double",
"name": "s1", "required": true}, {"type": "double", "name": "s2", "required":
true}, {"type": "double", "name": "s3", "required": true}, {"type": "double",
"name": "s4", "required": true}, {"type": "double", "name": "s5", "required":
true}, {"type": "double", "name": "s6", "required": true}]'
outputs: '[{"type": "tensor", "tensor-spec": {"dtype": "float64", "shape": [-1]}}]'
params: null
Whenever the model is loaded as a Python function, MLflow checks the input against these lines first: How to Check Data Against an MLflow Model's Signature shows what it accepts and refuses.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
| Inferring from data with whole-number columns | MLflow warns about integer columns, and a missing value later is refused | Fixed: Hint: Inferred schema contains integer column(s) |
Inferring the output from predict when the model returns probabilities | The signature describes labels the model never returns | Fixed: MLflow Signature Says long for a predict_proba Model |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
UserWarning: Hint: Inferred schema contains integer column(s)... | Whole-number columns in model_input | Read them as decimals before inferring |
A model has no signature section in MLmodel | It was logged without a signature or input example | Log it again with signature= |
FAQ
Can MLflow infer the signature for me?
Yes: give log_model an input example instead, as in How to Add an Input Example to an MLflow Model. MLflow then infers the signature from it.
What does required mean?
That the column must be present in every prediction's input. MLflow's guide: "Required fields: Must be present or validation fails".
Conclusion
infer_signature(X, model.predict(X)) described the model's ten double input columns and its float64 output, and log_model(signature=...) saved that contract in the model's MLmodel file, where every future prediction is checked against it.
Additional Resources
- Model Signatures and Input Examples — MLflow's guide to signatures.
- mlflow.models —
infer_signature.
