Courseiva
Model Deployment →mediumMultiple Choice

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 custom post-processing logic and loading auxiliary tokenizer files alongside the serialized weights. Which approach provides the correct mechanism to package and serve this custom artifact?

⚠ Common exam trap

Candidates mistakenly try to log raw PyTorch weight files directly without a pyfunc wrapper, failing to provide the required custom tokenization and post-processing logic inside the serving container.

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

✓

Subclass mlflow.pyfunc.PythonModel, implement the load_context and predict methods, bundle the tokenizer files in artifacts, and log via mlflow.pyfunc.log_model.

Custom PyTorch models requiring custom code and auxiliary files must be logged using MLflow's pyfunc flavor with custom artifact dependencies. This allows packaging artifacts and arbitrary Python code safely so that the serving infrastructure can instantiate the pyfunc wrapper, execute custom tokenization, and perform required post-processing cleanly during real-time inference.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Log the model as a standard torch.jit artifact without metadata and point the serving endpoint directly to the raw .pt file in Unity Catalog.

    Why it's wrong here

    A bare torch.jit artefact carries no custom post-processing code or tokenizer files, so the endpoint cannot execute the required logic. TorchScript suits plain traced models with no auxiliary dependencies. The correct approach logs a pyfunc model whose predict method wraps the PyTorch model and loads tokenizer artefacts.

  • ✗

    Create an external FastAPI application outside Databricks, wrap the model, and route requests via a custom reverse proxy.

    Why it's wrong here

    An external FastAPI service bypasses Databricks Model Serving entirely, so it cannot satisfy the requirement to deploy to a serving endpoint. It suits hosting models where Databricks serving is unavailable. The correct approach logs the model with custom pyfunc code and artefacts, letting the endpoint load them.

  • ✓

    Subclass mlflow.pyfunc.PythonModel, implement the load_context and predict methods, bundle the tokenizer files in artifacts, and log via mlflow.pyfunc.log_model.

    Why this is correct

    Subclassing mlflow.pyfunc.PythonModel satisfies the custom post-processing and auxiliary file constraints: load_context loads the bundled tokenizer artifacts at initialisation, while predict applies the bespoke logic around the PyTorch weights. Logging via mlflow.pyfunc.log_model registers the whole bundle, which Model Serving then deploys as a single custom artifact.

  • ✗

    Store the tokenizer files in a Delta table and configure the serving endpoint to query the table on every incoming inference request.

    Why it's wrong here

    Querying a Delta table on every inference request adds latency and does not package tokenizer files with the model artefact. Delta tables suit feature storage and retrieval, not bundling serving dependencies. Logging the model with the tokenizer files as artefacts lets the endpoint load them locally.

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 →

How Courseiva writes practice questions · Editorial policy

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.