Online Explainability with SageMaker Clarify - Amazon SageMaker

Online Explainability with SageMaker Clarify

This guide shows how to configure online explainability with SageMaker Clarify. With SageMaker real-time inference endpoints, you can analyze explainability in real time, continuously. The online explainability function fits into the Deploy to production part of the Amazon SageMaker Machine Learning workflow.

How Clarify Online Explainability Works

The following graphic depicts SageMaker architecture for hosting an endpoint that serves explainability requests. It depicts interactions between an endpoint, the model container, and the SageMaker Clarify explainer.

                SageMaker architecture: Graphic depicts hosting an endpoint that serves on-demand
                    explainability requests.

Here's how Clarify online explainability works. The application sends a REST-style InvokeEndpoint request to the SageMaker Runtime Service. The service routes this request to a SageMaker endpoint to obtain predictions and explanations. Then, the service receives the response from the endpoint. Lastly, the service sends the response back to the application.

To increase the endpoint availability, SageMaker automatically attempts to distribute endpoint instances in multiple Availability Zones, according to the instance count in the endpoint configuration. On an endpoint instance, upon a new explainability request, the SageMaker Clarify explainer calls the model container for predictions. Then it computes and returns the feature attributions.

Here are the four steps to create an endpoint that uses SageMaker Clarify online explainability:

  1. Check if your pre-trained SageMaker model is compatible with online explainability by following the pre-check steps.

  2. Create an endpoint configuration with the SageMaker Clarify explainer configuration using the CreateEndpointConfig API.

  3. Create an endpoint and provide the endpoint configuration to SageMaker using the CreateEndpoint API. The service launches the ML compute instance and deploys the model as specified in the configuration.

  4. Invoke the endpoint: After the endpoint is in service, call the SageMaker Runtime API InvokeEndpoint to send requests to the endpoint. The endpoint then returns explanations and predictions.