How to deploy XGBoost with preprocessing on Vertex AI?
You recently trained a XGBoost model that you plan to deploy to production for online inference. Before sending a predict request to your model’s binary, you need to perform a simple data preprocessing step. This step exposes a REST API that accepts requests in your internal VPC Service Controls and returns predictions. You want to configure this preprocessing step while minimizing cost and effort. What should you do?
Community Votes
71% of anonymous learners picked answer D. Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
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.
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.
Community Discussion (4 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
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
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.
Related Analysis
Practice All PMLE Questions
Access 65 questions with complete answers and detailed explanations.
View Full PMLE Practice Test →