Databricks-ML-Pro Model Deployment Practice Question
A machine learning engineer needs to deploy a custom PyTorch model to a Databricks Model Serving endpoint. The model requires a custom pre-processing step that is not part of the standard MLflow transformers or pyfunc flavor. Which deployment approach ensures the custom logic executes reliably within the serverless serving container?
⚠ Common exam trap
Candidates rely on default MLflow model flavors for custom architectures, forgetting that non-standard pre-processing steps require custom wrapper logic to execute inside serverless endpoints.
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
✓
Implement a custom MLflow pyfunc PythonModel subclass that encapsulates both the PyTorch model and the custom pre-processing transformations, then log it with MLflow.
Packaging the custom pre-processing logic directly into the MLflow pyfunc model artifact by overriding the predict context ensures that all required transformations travel with the model weights. This guarantees identical execution behavior between local testing and production serverless endpoints without relying on external pipeline code.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Register the vanilla PyTorch state dict and apply pre-processing transformations inside the client application before sending HTTP payloads.
Why it's wrong here
Offloading pre-processing logic to the client application introduces deployment drift risks and tightly couples client implementations to the specific model version requirements. Serverless endpoints expect self-contained artifacts that handle raw input payloads natively to maintain strict API contracts.
- ✗
Define a separate Spark UDF inside the serving endpoint configuration file to intercept incoming JSON batches.
Why it's wrong here
Databricks Model Serving endpoints execute using optimized serving runtimes rather than traditional Spark clusters. Spark UDFs are designed for distributed batch processing workflows and cannot be natively injected into real-time model serving endpoint configurations.
- ✓
Implement a custom MLflow pyfunc PythonModel subclass that encapsulates both the PyTorch model and the custom pre-processing transformations, then log it with MLflow.
Why this is correct
Subclassing MLflow PythonModel allows developers to bundle custom inference logic, tokenizers, or scalers directly into the logged artifact. Databricks Model Serving natively understands the pyfunc flavor, executing the overridden predict method securely within the managed container environment.
- ✗
Store the pre-processing code in a separate volume and reference its absolute file path in the model serving endpoint environment variables.
Why it's wrong here
Relying on external file paths or Unity Catalog volumes for runtime code execution breaks dependency isolation and can lead to runtime import errors if underlying storage mounts refresh or if the file paths change across different worker nodes.
Quick reference
Cloud Service Model Comparison
| Model | You Manage | Provider Manages | Examples |
|---|---|---|---|
| IaaS | OS, runtime, apps, data | Hardware, hypervisor, networking | EC2, Azure VMs, GCP Compute Engine |
| PaaS | Apps and data | OS, runtime, middleware, hardware | Elastic Beanstalk, Azure App Service |
| SaaS | Data and settings only | Everything else | Microsoft 365, Salesforce, Workday |
| FaaS / Serverless | Function code only | Infra, scaling, runtime | Lambda, Azure Functions, Cloud Run |
| CaaS | Containers and apps | Kubernetes, OS, hardware | EKS, AKS, GKE |
About these practice questions
One of 300 original Databricks-ML-Pro practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.