Databricks-ML-Pro Model Deployment Practice Question
A data scientist is deploying a model to Databricks Model Serving. The model was trained using a scikit-learn pipeline that includes a custom transformer. The custom transformer is defined in a Python module that is not part of the model artifact. What should the data scientist do to ensure the model can be served successfully?
⚠ Common exam trap
The trap here is thinking that custom code must be installed as a separate package; instead, it can be bundled directly with the model artifact using MLflow's code_path.
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
✓
Log the model with the custom transformer code included in the model's artifacts using MLflow's custom logging.
To deploy a model with custom code, you must include that code in the model's artifacts when logging with MLflow. Using the `code_path` parameter in `mlflow.pyfunc.log_model` allows you to specify additional code files that will be packaged with the model. Databricks Model Serving then loads this code, ensuring the custom transformer is available during inference. This is the standard method for handling custom logic in served models.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Include the custom transformer code in the model's conda environment as a pip dependency.
Why it's wrong here
While you can package the custom transformer as a pip-installable package, it is not the simplest method. The conda environment is for dependencies, but the custom transformer code itself must be available at inference time. If it's not included in the model artifact, simply listing it as a dependency won't work unless you also publish it to a repository. This approach adds unnecessary complexity.
- ✓
Log the model with the custom transformer code included in the model's artifacts using MLflow's custom logging.
Why this is correct
MLflow allows you to log custom code along with the model by including it in the model's artifacts and specifying it in the model's Python function or by using the `code_path` parameter in `mlflow.pyfunc.log_model`. This ensures the custom transformer is available at inference time. Databricks Model Serving will then load the code from the model artifact, making it the correct and straightforward solution.
- ✗
Re-train the model without the custom transformer, as Model Serving does not support custom code.
Why it's wrong here
Databricks Model Serving fully supports custom code when properly packaged with the model. Re-training without the custom transformer would change the model's behavior and likely degrade performance. It is not necessary and would waste effort. The issue is not lack of support but incorrect packaging of the custom code.
- ✗
Convert the custom transformer to a built-in scikit-learn transformer before logging.
Why it's wrong here
Converting a custom transformer to a built-in one may not be possible if the logic is specific. Even if possible, it would require rewriting the code, which is time-consuming and error-prone. The better approach is to include the custom code with the model, as Model Serving supports it. This option is a workaround that may not preserve functionality.
About these practice questions
This Databricks-ML-Pro question is part of Courseiva's 300-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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.