Databricks Machine Learning Professional Question 211
Single answerYou are a data scientist working on a model deployment pipeline in Databricks. A model has been registered in the Model Registry and transitioned to both the Staging and Production stages. Model Serving is enabled for both stages. You want to programmatically query the model in the Staging stage to test its performance before promoting it to Production. Which of the following steps is required to ensure you query the correct stage of the model?
- A
Specify the 'stage' parameter as 'Staging' in the REST API request when querying the model
- B
Use the unique model version ID to query the model directly, bypassing the stage
- C
Set the 'X-Databricks-Stage' header to 'Staging' in the REST API request
- D
Only the Production stage can be queried with Model Serving, so querying Staging is not possible
Show answer and explanation
Correct answer: C
Explanation
To query a Model Serving-enabled model in a specific stage, such as 'Staging,' you need to set the 'X-Databricks-Stage' header in the REST API request. This header ensures that the correct stage of the model is used for inference. Without this header, the request will default to querying the Production stage.
- A. Incorrect.
Incorrect: While it's important to specify the stage, Databricks Model Serving requires the stage to be set through a specific header, not as a parameter in the request body.
- B. Incorrect.
Incorrect: The model version ID identifies the specific version of the model but does not allow you to specify the stage directly.
- C. Correct.
Correct: To query a specific stage, such as 'Staging' or 'Production,' you need to set the 'X-Databricks-Stage' header in the REST API request. This ensures the serving endpoint looks at the correct stage.
- D. Incorrect.
Incorrect: Model Serving supports querying models in both Staging and Production stages, provided the correct configuration is used.