Databricks Machine Learning Associate · Section 4 · 12% of the exam
Deploy and query a model for realtime inference
One of the objectives of the Databricks Certified Machine Learning Associate exam, in the section “Model Deployment”. Here is what it covers, the points to remember and a question to try.
What it covers
Package a custom model in MLflow format, register it in Unity Catalog, deploy it to a Mosaic AI Model Serving endpoint from the UI or code, query it over REST, with the MLflow Deployments SDK and with ai_query, and split traffic between two served models for A/B testing and gradual rollouts.
Points to remember
- Custom model = any Python model in MLflow format (built-in flavor or pyfunc), registered in Unity Catalog, served on a Model Serving endpoint as a REST API.
- Unity Catalog model versions need a signature: log an
input_exampleorsignature. Pinmlflow(notmlflow-skinny) in pyfunc requirements. - Create endpoints in the Serving UI, with
POST /api/2.0/serving-endpoints,get_deploy_client('databricks').create_endpoint(...)or the Databricks SDK. - Served entities reference a model name and a version; scale-out sizes are Small (0-4), Medium (8-16) and Large (16-64) concurrent requests.
- Scale to zero after 30 idle minutes saves cost but adds cold starts; not recommended for production.
Try a question
On Databricks Runtime ML, a data scientist logs a custom mlflow.pyfunc.PythonModel without pip_requirements, registers it in Unity Catalog and creates a serving endpoint. The container build fails, and the build logs show that the environment contains mlflow-skinny but not mlflow. What is the best fix?
- ALog a new version whose
pip_requirementspinmlflow==<version>and the model libraries - BEnable scale to zero so that the container is rebuilt on the first request
- CSwitch the endpoint's workload type to GPU_SMALL, whose base image always includes the full MLflow package
- DAdd
mlflowas an environment variable in the served entity's advanced configuration so the build installs it
Show the answer
A. Databricks Runtime ML ships mlflow-skinny, and a pyfunc model logged there without explicit requirements captures mlflow-skinny. Model Serving needs the full mlflow package in the model's environment, so Databricks recommends always pinning mlflow==<version> in pip_requirements for pyfunc models, then registering and serving the new version.
Written for practice in the style of the exam: never a question from the real exam.
In the course
The lesson Real-Time Inference with Model Serving: Deploy, Query and Split Traffic teaches this objective (about 45 minutes), and 15 practice questions test it. The course has lessons, exam-style questions, timed practice exams and an AI tutor for every objective, and a pass prediction that tells you when you're ready to book.