Using Sagemaker clarify shap value for token level explanation

Is it possible to use Sagemaker clarify to generate shap explanations like in this example or this

I can’t find any examples specific to huggingface transformers, but from the documentation it looks like it may just be a matter of passing text_config with granularity = “token”?

Let me check with the AWS Team. I haven’t used SageMaker Clarify yet.

1 Like

@MaximusDecimusMeridi the AWS team shared with me this example:

i haven’t looked at it. So would be nice if you could report back on this and the experience

1 Like

Great thanks

@philschmid It looks great, haven’t gone through in detail yet but this is the output from running it

Are there any native HF tools for explainability? I know there’s exBERT but it looks more like a UI tool for now. Is there anything for getting token level explanation programatically? I’ve found a few independently made tools:

But is there anything directly in HF to do this?


1 Like


And no we currently have nothing from HF directly.