How to deploy XGBoost with preprocessing on Vertex AI?
Short answer
D Build a custom predictor class based on XGBoost Predictor from the Vertex AI SDK, and package the handler in a custom container image based on a Vertex built-in container image. Store a pickled model in Cloud Storage, and deploy the model to Vertex AI Endpoints.
Question
Key Takeaways
The exam tests the ability to decouple model artifacts from container code using Vertex AI's custom predictor pattern, where the common trap is bundling the model inside the container image which increases size and deployment complexity.
To deploy an XGBoost model with a preprocessing step while minimizing cost and effort, you should use a custom predictor class based on the Vertex AI SDK's XGBoost Predictor. The community consensus is to store the model artifact in Cloud Storage and use a Vertex built-in container image for the handler to optimize deployment and updates.
Common mistake: Choosing Option C or B because they seem straightforward, but they incorrectly package the model inside the container, leading to larger images and the need to rebuild containers for every model update.
Expert Analysis
Why the Answer Is Correct
Option D is the correct choice because it leverages the Vertex AI SDK to create a custom predictor class, which handles the specific preprocessing logic required by the scenario. By storing the pickled model in Cloud Storage and using a container based on a Vertex built-in image, you minimize the container size and reduce the effort needed for updates. This architecture allows you to update the model by simply replacing the file in Cloud Storage without rebuilding or redeploying the container image.
Why the Other Options Are Wrong
Options A and B suggest building a Flask-based app, which requires more development effort than using the pre-built predictor classes provided by the Vertex AI SDK. Options B and C are incorrect because they package the pickled model directly into the container image. This increases the image size and necessitates a full container rebuild and redeployment whenever the model is retrained, which contradicts the requirement to minimize effort.
Community Comment Notes
The community strongly supports Option D (71 votes), highlighting that separating the model storage from the container prevents the need for redeploying the container for model updates (Comment 1). Commenters also noted that utilizing the Vertex built-in container image ensures compatibility and reduces the amount of custom code required, optimizing for both cost and development time (Comment 4).
Official Reference
- https://cloud.google.com/vertex-ai/docs/predictions/custom-container-requirements
- https://cloud.google.com/vertex-ai/docs/predictions/use-custom-container
These links open the official vendor documentation in a new tab.
Exam Strategy
When deploying models on Vertex AI, always prefer storing model artifacts in Cloud Storage rather than baking them into the container image to facilitate faster iterations and reduce deployment overhead.
Community Votes
71% of anonymous learners picked answer D. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 4 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 4
-
fitri001 👍 3 Answered Dwhy not c? While it utilizes the XGBoost Predictor, packaging the pickled model in the container increases image size and requires redeploying the container for model updates.
-
lunalongo 👍 2 Answered BOption B is simpler (Flask app handles preproc directly) and less costly (Storage within the container)
-
guilhermebutzke 👍 1 Answered DMy Answer: D This option involves using the Vertex AI SDK to build a custom predictor class, which allows for easy integration with the XGBoost model. Packaging the handler in a custom container image based on a Vertex built-in container image ensures compatibility and smooth deployment. Storing the pickled model in Cloud Storage provides a scalable and reliable way to access the model. Deploying the model to Vertex AI Endpoints allows for easy management and scaling of inference requests, while minimizing cost and effort. The main difference between C and D is where the model is saved. So, is a good practice to save models in GCS because Separation of Concerns, Flexibility, and Reduced Image Size
-
pikachu007 👍 1 Answered DMinimal Custom Code: Leverages the pre-built XGBoost Predictor class for core model prediction, reducing development effort and potential errors. Optimized Container Image: Utilizes a Vertex built-in container image, pre-configured for efficient model serving and compatibility with Vertex AI Endpoints. Separated Model Storage: Stores the model in Cloud Storage, reducing container image size and simplifying model updates independently of the container. VPC Service Controls: Vertex AI Endpoints support VPC Service Controls, ensuring adherence to internal traffic restrictions.
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All PMLE Questions
Access 65 questions with complete answers and detailed explanations.
View Full PMLE Practice Test →