Databricks-ML-Pro Model Development Practice Question
A machine learning engineer is using MLflow to log a model. They want to include custom preprocessing logic that is not part of the model's native library. Which MLflow model flavor should they use to package the model with custom code?
⚠ Common exam trap
The trap here is assuming that native flavors like sklearn or tensorflow can accommodate arbitrary custom code; they are limited to their respective libraries.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
`mlflow.pyfunc`
The `mlflow.pyfunc` flavor is designed for custom Python models. It allows you to define a class with a `predict` method that can include any preprocessing, inference, and postprocessing steps. This makes it ideal for packaging models with custom logic that is not supported by native flavors.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
`mlflow.sklearn`
Why it's wrong here
The `mlflow.sklearn` flavor is specifically for scikit-learn models. It logs the model object and its dependencies but does not support adding custom preprocessing code outside the model's pipeline. If you need custom logic, you would have to incorporate it into a scikit-learn pipeline, which may not be flexible enough.
- ✗
`mlflow.lightgbm`
Why it's wrong here
The `mlflow.lightgbm` flavor is for LightGBM models. It does not support custom preprocessing code outside the model's native prediction function. To include custom logic, you would need to use `pyfunc` or wrap the model in a custom class.
- ✓
`mlflow.pyfunc`
Why this is correct
The `mlflow.pyfunc` flavor allows you to create a custom Python function model that can include arbitrary preprocessing, postprocessing, and inference logic. You define a class that inherits from `mlflow.pyfunc.PythonModel` and implement the `predict` method. This is the correct choice for packaging custom code with the model.
- ✗
`mlflow.tensorflow`
Why it's wrong here
The `mlflow.tensorflow` flavor is designed for TensorFlow models. It does not provide a mechanism to include arbitrary custom Python code for preprocessing. While you can include preprocessing in a TensorFlow graph, it is not as flexible as `pyfunc` for custom logic.
About these practice questions
Courseiva writes every Databricks-ML-Pro question from scratch — 300 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Databricks exam blueprint
This Databricks-ML-Pro practice question is part of Courseiva's free Databricks certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the Databricks-ML-Pro exam.