Courseiva
Serving and Scaling Models →mediumMultiple Choice

PMLE Serving and Scaling Models Practice Question

You are deploying a scikit-learn model to a Vertex AI endpoint for real-time inference. Prediction requests arrive as JSON payloads containing a single instance per request, and the model's predict method expects a pandas DataFrame with named columns. You want to avoid writing a custom container. Which approach should you take?

⚠ Common exam trap

The trap here is assuming the pre-built scikit-learn container automatically converts JSON payloads into a named-column DataFrame for every estimator.

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

✓

Upload the model artifact with a pre-built Vertex AI scikit-learn container and supply a custom prediction routine (predictor.py) that converts the decoded JSON dict into a pandas DataFrame before calling predict.

A custom prediction routine gives you a managed pre-built runtime plus a Python package that overrides preprocessing, which is the supported way to adapt request payloads to a model's expected input format. Because the estimator requires named DataFrame columns, the override must build that DataFrame explicitly; the default Predictor performs no such conversion and other pre-built containers cannot load the estimator at all.

Answer analysis

Option-by-option breakdown

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

  • ✗

    Upload the model artifact with a pre-built Vertex AI XGBoost container, because that container internally wraps every scikit-learn estimator and feeds it a DataFrame.

    Why it's wrong here

    The pre-built XGBoost container loads Booster objects, not arbitrary scikit-learn estimators, and provides no automatic DataFrame conversion for them. Deploying a scikit-learn pickle there fails at load time, so this neither avoids a custom container nor satisfies the DataFrame input contract the model requires.

  • ✓

    Upload the model artifact with a pre-built Vertex AI scikit-learn container and supply a custom prediction routine (predictor.py) that converts the decoded JSON dict into a pandas DataFrame before calling predict.

    Why this is correct

    A custom prediction routine packaged as a Python source distribution lets you subclass the pre-built scikit-learn Predictor and override preprocess to build a DataFrame from the decoded instance. This keeps the managed runtime image while satisfying the model's DataFrame input contract, so no custom container or Dockerfile is needed.

  • ✗

    Upload the model artifact with a pre-built TensorFlow container and wrap the scikit-learn estimator in a tf.function so the container's serving signature handles DataFrame creation.

    Why it's wrong here

    TensorFlow Serving containers expect a SavedModel with a serving signature, and a wrapped scikit-learn estimator does not produce one. This mixes incompatible runtimes, requires substantial custom code anyway, and would not honor the estimator's DataFrame contract, making it the wrong choice for this deployment.

  • ✗

    Upload the model artifact with a pre-built Vertex AI scikit-learn container and rely on its default Predictor, which automatically converts JSON objects into a pandas DataFrame with matching column names.

    Why it's wrong here

    The default scikit-learn Predictor decodes the request and passes the raw structure to the model without inferring column names or constructing a DataFrame. Since the estimator's predict expects named columns, the default runtime raises an error, so relying on implicit conversion does not work here.

About these practice questions

One of 775 original PMLE 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 →

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 Google Cloud exam blueprint

This PMLE practice question is part of Courseiva's free Google Cloud 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 PMLE exam.