How to Deploy an XGBoost Model with Custom Pre/Postprocessing on Vertex AI?
You recently used XGBoost to train a model in Python that will be used for online serving. Your model prediction service will be called by a backend service implemented in Golang running on a Google Kubernetes Engine (GKE) cluster. Your model requires pre and postprocessing steps. You need to implement the processing steps so that they run at serving time. You want to minimize code changes and infrastructure maintenance, and deploy your model into production as quickly as possible. What should you do?
Community Votes
58% of anonymous learners picked answer C. Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
Tests understanding of Vertex AI custom prediction routines while highlighting the trap of separating model logic from transformation steps across different services.
This question evaluates deploying machine learning workloads on Google Cloud using Vertex AI custom containers to reduce infrastructure overhead. Community consensus confirms that leveraging the Predictor interface to bundle preprocessing, inference, and postprocessing together is the most efficient approach.
Option D is often selected due to familiarity with managed prebuilt containers, but it fails because offloading preprocessing to a separate Golang backend breaks the requirement for tightly integrated serving-time processing and increases operational complexity.
Community Discussion (9 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Why the Answer Is Correct
Option C correctly implements Vertex AI Custom Prediction Routines (CPR), allowing developers to extend the base Predictor class to handle custom load and predict workflows. Packaging the XGBoost model with Python-based preprocessing and postprocessing into a single custom container ensures all transformations execute within the same deployment unit. This strategy aligns with Google Cloud best practices for maintaining version consistency between data transformations and model weights while leveraging Vertex AI's managed endpoints for automatic scaling.Why the Other Options Are Wrong
Options A and B propose building a generic FastAPI HTTP server, which introduces unnecessary boilerplate code and shifts infrastructure management responsibilities away from Vertex AI's optimized serving runtime. Option D suggests using the prebuilt XGBoost container but recommends moving critical data transformations to the Golang microservice, which creates inter-service latency, complicates dependency tracking, and directly contradicts the prompt's requirement to keep processing steps integrated at serving time.Community Comment Notes
Multiple high-voted comments emphasize that custom containers provide full control over execution flow while simplifying deployment through a unified package. Comment [4] explicitly references the official Vertex AI documentation on custom prediction routines, validating that CPR natively supports embedding preprocessing and postprocessing logic. Although several users initially favored the managed prebuilt container for its simplicity, the discussion converged on Option C once the necessity of co-locating model and transformation code was clarified.Official Reference
Exam Strategy
When scenarios emphasize bundled preprocessing or postprocessing alongside a trained model, immediately prioritize Vertex AI Custom Prediction Routines over custom web frameworks or external microservices. Familiarize yourself with how Vertex AI manages custom containers versus prebuilt images to quickly identify solutions that minimize both code complexity and ongoing infrastructure maintenance.
Related Analysis
Practice All PMLE Questions
Access 65 questions with complete answers and detailed explanations.
View Full PMLE Practice Test →