What is an MLflow model 'flavor', and why is the python_function flavor particularly useful?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Flavors are how MLflow speaks multiple languages — each model is saved in its native format (sklearn, XGBoost, TensorFlow), but the python_function flavor adds a Rosetta Stone wrapper so any tool can load it the same way.
Full explanation below image
Full Explanation
MLflow models can have multiple flavors — different ways to load/use the same model. Each flavor is stored in the MLmodel file: sklearn flavor: load with mlflow.sklearn.load_model() → returns a sklearn estimator. xgboost flavor: load with mlflow.xgboost.load_model() → returns XGBoost Booster. python_function (pyfunc) flavor: load with mlflow.pyfunc.load_model() → returns a Python object with .predict(df) method, regardless of original framework. The pyfunc flavor is universal: deployment tools (Databricks Model Serving, MLflow serving CLI) only need to know about pyfunc — they don't need framework-specific code. mlflow.pyfunc.spark_udf() also uses pyfunc. When a model is logged with mlflow.sklearn.log_model(), both the sklearn flavor and pyfunc flavor are automatically created. Custom models using PythonModel only have the pyfunc flavor.