ankur@fiddler.ai ankur taly, fiddler...

88
Joint work with Mukund Sundararajan 1 , Qiqi Yan 1 , Kedar Dhamdhere 1 , and Pramod Mudrakarta 2 1 Google, 2 U Chicago Previously: Staff Research Scientist, Google Brain (2012 - 2019) PhD, Stanford University (2012) Ankur Taly, Fiddler Labs ankur@fiddler.ai

Upload: others

Post on 25-Aug-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Joint work with Mukund Sundararajan1, Qiqi Yan1, Kedar Dhamdhere1, and Pramod Mudrakarta2

1Google, 2U Chicago

Previously: Staff Research Scientist, Google Brain (2012 - 2019)PhD, Stanford University (2012)

Ankur Taly, Fiddler [email protected]

Page 2: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Machine Learning Models are Everywhere!

Output(Label, sentence, next word, next move, etc.)

Input(Image, sentence, game position, etc.)

Page 3: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Problem: Machine Learning Model is a Black Box

Output(Label, sentence, next word, next move, etc.)

Input(Image, sentence, game position, etc.)

?

Page 4: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Regulators

IT & Operations

Data Scientists

Business Owner

Can I trust our AI decisions?

Are these AI system decisions fair?

Customer SupportHow do I answer this customer complaint?

How do I monitor and debug this model?

Is this the best model that can be built?

Why I am getting this decision?

How can I get a better decision?

Poor DecisionEnd User

Page 5: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Top label: “fireboat”

Page 6: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Top label: “clog”

Page 7: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Beautiful design and execution, both the space itself and the food. Many interesting options beyond the excellent traditional Italian meatball. Great for the Financial District.

Why did the network predict positive sentiment for this review?

Page 8: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Examples:

● Attribute a lending model’s prediction to its features

● Attribute an object recognition network’s prediction to its pixels

● Attribute a text sentiment network’s prediction to individual words

A of “why this prediction” but surprisingly useful :-)

Page 9: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Application of Attributions● Debugging model predictions

E.g., Attribution an image misclassification to the pixels responsible for it

● Generating an explanation for the end-userE.g., Expose attributions for a lending prediction to the end-user

● Analyzing model robustnessE.g., Craft adversarial examples using weaknesses surfaced by attributions

● Extract rules from the modelE.g., Combine attribution to craft rules capturing prediction logic of a drug screening network

9

Page 10: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

● Two Attribution Methods

○ Integrated Gradients

○ Shapley Values

● Applications of attributions

● Discussion

● What is Fiddler?

Page 11: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

● Ablations: Drop each feature and note the change in prediction○ Computationally expensive, Unrealistic inputs, Misleading when features interact

Page 12: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

● Ablations: Drop each feature and note the change in prediction○ Computationally expensive, Unrealistic inputs, Misleading when features interact

● Feature*Gradient: Attribution for feature xi is xi* 𝜕y/𝜕xi

Page 13: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

● Ablations: Drop each feature and note the change in prediction○ Computationally expensive, Unrealistic inputs, Misleading when features interact

● Feature*Gradient: Attribution for feature xi is xi* 𝜕y/𝜕xi

Gradients in the vicinity of the input seem like noise

Page 14: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

score

intensity

Interesting gradientsuninteresting gradients

1.0

0.0

Baseline … scaled inputs ...

… gradients of scaled inputs ….

Input

Page 15: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

IG(input, base) ::= (input - base) * ∫0 -1▽F(𝛂*input + (1-𝛂)*base) d𝛂

Original image Integrated Gradients

Integrated Gradients [ICML 2017]

Page 16: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

What is a baseline?

● Ideally, the baseline is an informationless input for the model

○ E.g., Black image for image models

○ E.g., Empty text or zero embedding vector for text models

● Integrated Gradients explains F(input) - F(baseline) in terms of input features

Page 17: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

What is a baseline?

● Ideally, the baseline is an informationless input for the model

○ E.g., Black image for image models

○ E.g., Empty text or zero embedding vector for text models

● Integrated Gradients explains F(input) - F(baseline) in terms of input features

Aside: Baselines (or Norms) are essential to explanations [Kahneman-Miller 86]

E.g., A man suffers from indigestion. Doctor blames it to a stomach ulcer. Wife blames it on eating turnips.

● Both are correct relative to their baselines.

● The baseline may also be an important analysis knob

Page 18: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Many more Inception+ImageNet examples here

Page 19: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Evaluating an Attribution Method

● Ablate top attributed features and examine the change in prediction ○ Issue: May introduce artifacts in the input (e.g., the square below)

● Compare attributions to (human provided) groundtruth on “feature importance” ○ Issue 1: Attributions may appear incorrect because the network reasons differently

○ Issue 2 : Confirmation bias

Page 20: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Evaluating an Attribution Method

● Ablate top attributed features and examine the change in prediction ○ Issue: May introduce artifacts in the input (e.g., the square below)

● Compare attributions to (human provided) groundtruth on “feature importance” ○ Issue 1: Attributions may appear incorrect because the network reasons differently

○ Issue 2 : Confirmation bias

The mandate for attributions is to be faithful to the network’s reasoning

Page 21: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Our Approach: Axiomatic Justification● List desirable criteria (axioms) for an attribution method

● Establish a uniqueness result: X is the only method that satisfies these criteria

Page 22: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Axioms● Insensitivity: A variable that has no effect on the output gets no attribution

● Sensitivity: If baseline and input differ in a single variable, and have different outputs, then that variable should receive some attribution

● Linearity preservation: Attributions(ɑ*F1 + ß*F2) = ɑ*Attributions(F1) + ß*Attributions(F2)

● Implementation invariance: Two networks that compute identical functions for all inputs get identical attributions

● Completeness: Sum(attributions) = F(input) - F(baseline)

● Symmetry: Symmetric variables with identical values get equal attributions

Page 23: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Result

Historical note:

● Integrated Gradients is the Aumann-Shapley method from cooperative game theory, which has a similar characterization; see [Friedman 2004]

Theorem [ICML 2017]: Integrated Gradients is the unique path-integral method satisfying: Sensitivity, Insensitivity, Linearity preservation, Implementation invariance, Completeness, and Symmetry

Page 24: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:
Page 25: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Original image “Clog”

Page 26: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Original image Integrated Gradients(for label “clog”)

“Clog”

Page 27: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Detecting an architecture bug● Deep network [Kearns, 2016] predicts if a molecule binds to certain DNA site

● Finding: Some atoms had identical attributions despite different connectivity

Page 28: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

● Deep network [Kearns, 2016] predicts if a molecule binds to certain DNA site

● Finding: Some atoms had identical attributions despite different connectivity

Detecting an architecture bug

● Bug: The architecture had a bug due to which the convolved bond features did not affect the prediction!

Page 29: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

● Deep network predicts various diseases from chest x-rays

Original imageIntegrated gradients

(for top label)

Page 30: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

● Deep network predicts various diseases from chest x-rays

● Finding: Attributions fell on radiologist’s markings (rather than the pathology)

Original imageIntegrated gradients

(for top label)

Page 31: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Integrated Gradients is a technique for attributing a deep network’s (or any differentiable model’s) prediction to its input features. It is very easy to apply, widely applicable and backed by an axiomatic theory.

References:

● Axiomatic Attribution for Deep Networks [ICML 2017]

● Did the model understand the question? [ACL 2018]

● Using a deep learning algorithm and integrated gradients explanation to assist grading for diabetic retinopathy [Journal of Ophthalmology, 2018]

● Using Attribution to Decode Dataset Bias in Neural Network Models for Chemistry [PNAS, 2019]

● Exploring Principled Visualizations for Deep Network Attributions [EXSS Workshop, 2019]

Page 32: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Page 33: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

● Classic result in cooperative game theory

● Introduced by Lloyd Shapley in 19531, who later won the Nobel Prize in Economics in the 2012

● Popular tool in studying cost-sharing, market analytics, voting power, and most recently explaining ML models

1 "A Value for n-person Games". Contributions to the Theory of Games 2.28 (1953): 307-317

Lloyd Shapley in 1980

Page 34: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

● Cooperative game: Players collaborating to generate some gain

○ Think: Employees in a company creating some profit

○ Described by a set function v(S) specifying the gain for any subset S of players

Page 35: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

● Cooperative game: Players collaborating to generate some gain

○ Think: Employees in a company creating some profit

○ Described by a set function v(S) specifying the gain for any subset S of players

● Shapley values are a fair way to attribute the total gain to the players

○ Think: Bonus allocation to the employees

○ Axiomatic guarantee: Unique method under four very simple axioms

Page 36: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

● Consider all possible permutations of players (M! possibilities)

● In each permutation

○ Add players to the coalition in that order

○ Note the marginal contribution of each player i to set of players before it in the permutation

● The average marginal contribution of a player across all permutations is its Shapley Value

Page 37: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

A company with two employees Alice and Bob

● No employees, no profit [v({}) = 0] ● Alice alone makes 20 units of profit [v({Alice}) = 20]● Bob alone makes 10 units of profit [v({Bob}) = 10] ● Alice and Bob make 50 units of profit [v({Alice, Bob}) = 50]

What should the bonuses be?

Permutation Marginal for Alice Marginal for Bob

Alice, Bob 20 30

Bob, Alice 40 10

Shapley Value 30 20

Page 38: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Shapley values are unique under four simple axioms

● Dummy: If a player never contributes to the game then it must receive zero attribution

● Efficiency: Attributions must add to the total gain

● Symmetry: Symmetric players must receive equal attribution

● Linearity: Attribution for the (weighted) sum of two games must be the same as the (weighted) sum of the attributions for each of the games

Page 39: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

● Define a cooperative game for each model input X

○ Players are the features in the input

○ Gain is the model prediction (output), i.e., gain = F(X)

● Feature attributions are the Shapley values of this game

Page 40: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

● Define a cooperative game for each model input X

○ Players are the features in the input

○ Gain is the model prediction (output), i.e., gain = F(X)

● Feature attributions are the Shapley values of this game

Challenge: What does it mean for only some players (features) to be present?

● That is, how do we define F(x_1, <absent>, x_3, …, <absent>) ?

Page 41: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Key Idea: Sample the (absent) feature from a certain distribution and compute the expected prediction.

Page 42: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Key Idea: Sample the (absent) feature from a certain distribution and compute the expected prediction.

Different approaches choose different distributions

● [SHAP, NIPS 2018] Uses conditional distribution

● [KernelSHAP, NIPS 2018] Uses input distribution

● [QII, S&P 2016] Uses joint-marginal distribution

● [IME, JMLR 2010] Use uniform distribution

This is a critical choice that strongly impacts the resulting Shapley Values!

Page 43: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

F(is_male, is_lifter) ::= is_male AND is_lifter (model hires males who are lifters)

Input to be explained: is_male = 1, is_lifter = 1

is_male is_lifter P[X=x] F(x)

0 0 0.1 0

0 1 0.0 0

1 0 0.4 1

1 1 0.5 1

Data and prediction distribution

1This example was originally published in the QII paper

Page 44: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

F(is_male, is_lifter) ::= is_male AND is_lifter (model hires males who are lifters)

Input to be explained: is_male = 1, is_lifter = 1

is_male is_lifter P[X=x] F(x)

0 0 0.1 0

0 1 0.0 0

1 0 0.4 1

1 1 0.5 1

Method is_male is_lifter

SHAP (conditional distribution) 0.028 0.047

KernelSHAP (input distribution) 0.05 0.045

QII (joint-marginal distribution) 0.075 0.475

IME (uniform distribution) 0.375 0.375

Data and prediction distribution Attributions for is_male=1, is_lifter = 1

1This example was originally published in the QII paper

Each method produces a different attribution!

Page 45: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

The Explanation Game: Explaining Machine Learning Models with Cooperative Game Theory, Luke Merrick and Ankur Taly, 2019

● The many game formulations and the many Shapley values

● A novel reformulation of existing methods that:

○ Unifies various existing methods

○ Enables confidence intervals for Shapley value approximations

○ Enables contrastive explanations

Page 46: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

● The choice of reference distribution is internal to each method

● Reference distribution is repeatedly sampled in computing Shapley values

● Uncertainty from sampling is not quantified by existing methods

Input whose prediction must be explained

Reference distribution

Game formulation andShapley value computation

Attributions

sampling

Page 47: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

● The reference samples are made an explicit input

● Attributions are separately computed relative to each reference sample

● Mean of these “single-reference” attributions is returned

Input whose prediction must be explained

Reference samples

Single reference game formulation andShapley value computation

Attributions relative to each reference

Attributionsmean

Page 48: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Unifies existing methods under a single framework

● KernelSHAP, QII, IME attributions can be recovered by supplying samples drawn from the reference distribution corresponding to each of them

○ This result in proven in the paper

Input whose prediction must be explained

Reference samples

Single reference game formulation andShapley value computation

Attributions relative to each reference

Attributionsmean

Page 49: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Enables confidence intervals on attributions

● By examining the sample standard deviation of the single-reference attributions, we can obtain confidence intervals for the returned (mean) attributions

Input whose prediction must be explained

Reference samples

Single reference game formulation andShapley value computation

Attributions relative to each reference

Attributionsmean

Page 50: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Enables contrastive explanations

● The reference samples can be used as a knob to obtain different attributions

● Attributions contrastively explain the input prediction relative to the references

Inspiration: Norm Theory

Input whose prediction must be explained

Reference samples

Single reference game formulation andShapley value computation

Attributions relative to each reference

Attributionsmean

Page 51: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Norm Theory [Kahneman and Miller, 1986]

Classic work in cognitive psychology.

Describes a theory of psychological norms that shape the emotional responses, social judgments, and explanations of humans.

Daniel Kahneman Dale T. Miller

Page 52: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

● All “why” questions evoke counterfactual norms

○ “A why question indicates that a particular event is surprising and requests the explanation of an effect, denned as a contrast between an observation and a more normal alternative.”

○ Explanations for “why” are contrastive!

● Norms vary depending on their context

○ “A man suffers from indigestion. Doctor blames it to a stomach ulcer. Wife blames it on eating turnips.” [Hart and Honoré., 1985]

○ Different contrasts yield different explanations

● Norms tend to be relevant to to the question at hand

Page 53: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

● Explicitly supply different references to obtain different explanations

○ E.g., Explain a loan application rejection by contrasting with:

■ All application who were accepted, or

■ All applications with the same income level as the application at hand

● References must be relevant to the explanation being sought

○ E.g., Explain a B- grade by contrasting with B+ (next higher grade), not an A+

Applying these learnings to ML explanations

Page 54: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

The Official Staff Interpretation to Regulation B of the Equal Credit Opportunity Act originally published in 19851 states:

“One method is to identify the factors for which the applicant’s score fell furthest below the average score for each of those factors achieved by applicants whose total score was at or slightly above the minimum passing score. Another method is to identify the factors for which the applicant’s score fell furthest below the average score for each of those factors achieved by all applicants.”

112 CFR Part 1002 - Equal Credit Opportunity Act (Regulation B), 1985

Page 55: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:
Page 56: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Original mean attributions

Clusters with low intra-cluster attribution spread

Page 57: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:
Page 58: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:
Page 59: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

How Can This Help…

Why was a customer loan rejected?

How is my model doing across demographics?

What variables should they validate with customers on “borderline” decisions?

Confidence intervals

Page 60: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

How Can This Help…

Why was a customer loan rejected?

Why was the credit card limit low?

Why was this transaction marked as fraud?

Page 61: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

How Can This Help…

Understand how the model reasons

Determine path of recourse towards favorable outcomes

How sensitive are the predictions to feature perturbations?

Page 62: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

How Can This Help…

What are the primary feature drivers of the dataset on my model?

How does my model perform on a certain slice? Where does the model not perform well? Is my model uniformly fair across slices?

Page 63: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Investigate Data Drift Impacting Model Performance

Page 64: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

How Can This Help…

Why are there outliers in model predictions? What caused model performance to go awry?

How can I improve my ML model? Where does it not do well?

Page 65: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Explainable AI

Page 66: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:
Page 67: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Generating explanations for end users

Page 68: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Prediction: “proliferative” DR1

● Proliferative implies vision-threatening

Can we provide an explanation to the doctor with supporting evidence for “proliferative” DR?

Retinal Fundus Image

1Diabetic Retinopathy (DR) is a diabetes complication that affects the eye. Deep networks can predict DR grade from retinal fundus images with high accuracy (AUC ~0.97) [JAMA, 2016].

Page 69: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Retinal Fundus ImageIntegrated Gradients for label: “proliferative”Visualization: Overlay heatmap on green channel

Page 70: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Retinal Fundus ImageIntegrated Gradients for label: “proliferative”Visualization: Overlay heatmap on green channel

Lesions

Neovascularization● Hard to see on original image● Known to be vision-threatening

Page 71: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Efficacy of Explanations

Explanations help when:

● Model is right, and explanation convinces the doctor

● Model is wrong, and explanation reveals the flaw in the model’s reasoning

Be careful about long-term effects too!Humans and Automation: Use, Misuse, Disuse, Abuse - Parsuraman and Riley, 1997

But, Explanations can also hurt when:

● Model is right, but explanation is unintelligible

● Model is wrong, but the explanation convinces the doctor

Page 72: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Assisted-read study

9 doctors grade 2000 images under three different conditionsA. Image onlyB. Image + Model’s prediction scoresC. Image + Model’s prediction scores + Explanation (Integrated Gradients)

Some findings:● Seeing prediction scores (B) significantly increases accuracy vs. image only (A)

● Showing explanations (C) only provides slight additional improvement○ Masks help more when model certainty is low

● Both B and C increase doctor ↔ model agreement

Paper: Using a deep learning algorithm and integrated gradients explanation to assist grading for diabetic retinopathy --- Journal of Ophthalmology [2018]

Page 73: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Analyzing Robustness of Question-Answering Models

Page 74: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Tabular QA Visual QA Reading ComprehensionPeyton Manning became the first quarterback ever to lead two different teams to multiple Super Bowls. He is also the oldest quarterback ever to play in a Super Bowl at age 39. The past record was held by John Elway, who led the Broncos to victory in Super Bowl XXXIII at age 38 and is currently Denver’s Executive Vice President of Football Operations and General Manager

Kazemi and Elqursh (2017) model. 61.1% on VQA 1.0 dataset (state of the art = 66.7%)

Neural Programmer (2017) model33.5% accuracy on WikiTableQuestions

Yu et al (2018) model. 84.6 F-1 score on SQuAD (state of the art)

74

Q: How many medals did India win?A: 197

Q: How symmetrical are the white bricks on either side of the building?A: very

Q: Name of the quarterback who was 38 in Super Bowl XXXIII?A: John Elway

Page 75: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Tabular QA Visual QA Reading ComprehensionPeyton Manning became the first quarterback ever to lead two different teams to multiple Super Bowls. He is also the oldest quarterback ever to play in a Super Bowl at age 39. The past record was held by John Elway, who led the Broncos to victory in Super Bowl XXXIII at age 38 and is currently Denver’s Executive Vice President of Football Operations and General Manager

Robustness question: Do these network read the question carefully? :-)

Kazemi and Elqursh (2017) model. 61.1% on VQA 1.0 dataset (state of the art = 66.7%)

Neural Programmer (2017) model33.5% accuracy on WikiTableQuestions

Yu et al (2018) model. 84.6 F-1 score on SQuAD (state of the art)

75

Q: How many medals did India win?A: 197

Q: How symmetrical are the white bricks on either side of the building?A: very

Q: Name of the quarterback who was 38 in Super Bowl XXXIII?A: John Elway

Page 76: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Kazemi and Elqursh (2017) model.

Accuracy: 61.1% (state of the art: 66.7%)

Visual QA

Q: How symmetrical are the white bricks on either side of the building?A: very

76

Page 77: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Visual QA

Q: How symmetrical are the white bricks on either side of the building?A: very

Q: How asymmetrical are the white bricks on either side of the building?A: very

77

Kazemi and Elqursh (2017) model.

Accuracy: 61.1% (state of the art: 66.7%)

Page 78: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Visual QA

Q: How symmetrical are the white bricks on either side of the building?A: very

Q: How asymmetrical are the white bricks on either side of the building?A: very

Q: How big are the white bricks on either side of the building?A: very

78

Kazemi and Elqursh (2017) model.

Accuracy: 61.1% (state of the art: 66.7%)

Page 79: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Visual QA

Q: How symmetrical are the white bricks on either side of the building?A: very

Q: How asymmetrical are the white bricks on either side of the building?A: very

Q: How big are the white bricks on either side of the building?A: very

Q: How fast are the bricks speaking on either side of the building?A: very

79

Kazemi and Elqursh (2017) model.

Accuracy: 61.1% (state of the art: 66.7%)

Page 80: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Visual QA

Q: How symmetrical are the white bricks on either side of the building?A: very

Q: How asymmetrical are the white bricks on either side of the building?A: very

Q: How big are the white bricks on either side of the building?A: very

Q: How fast are the bricks speaking on either side of the building?A: very

80

Test/dev accuracy does not show us the entire picture. Need to look inside!

Kazemi and Elqursh (2017) model.

Accuracy: 61.1% (state of the art: 66.7%)

Page 81: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Analysis procedureAttribute the answer (or answer selection logic) to question words

● Baseline: Empty question, but full context (image, text, paragraph)

● By design, attribution will not fall on the context

Page 82: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Visual QA attributions

Q: How symmetrical are the white bricks on either side of the building?A: very

How symmetrical are the white bricks on either side of the building?

red: high attributionblue: negative attributiongray: near-zero attribution

82

Page 83: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Attack: Subject ablation

Low-attribution nouns'tweet',

'childhood', 'copyrights', 'mornings', 'disorder',

'importance', 'topless', 'critter',

'jumper', 'fits'

What is the man doing? → What is the tweet doing?How many children are there? → How many tweet are there?

VQA model’s response remains the same 75.6% of the time on questions that it originally answered correctly

83

Replace the subject of a question with a low-attribution noun from the vocabulary

● This ought to change the answer but often does not!

Page 84: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Many other attacks!

● Visual QA○ Prefix concatenation attack (accuracy drop: 61.1% to 19%)

○ Stop word deletion attack (accuracy drop: 61.1% to 52%)

● Tabular QA○ Prefix concatenation attack (accuracy drop: 33.5% to 11.4%)

○ Stop word deletion attack (accuracy drop: 33.5% to 28.5%)

○ Table row reordering attack (accuracy drop: 33.5 to 23%)

● Paragraph QA○ Improved paragraph concatenation attacks of Jia and Liang from [EMNLP 2017]

Paper: Did the model understand the question? [ACL 2018]

Page 85: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Some limitations and caveats

Page 86: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Attributions are pretty shallowAttributions do not explain:

● Feature interactions

● What training examples influenced the prediction

● Global properties of the model

An instance where attributions are useless:

● A model that predicts TRUE when there are even number of black pixels and FALSE otherwise

Page 87: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Attributions are for human consumption

● Humans interpret attributions and generate insights

○ Doctor maps attributions for x-rays to pathologies

● Visualization matters as much as the attribution technique

Page 88: ankur@fiddler.ai Ankur Taly, Fiddler Labstheory.stanford.edu/.../Talks/ExplainingMLModels-Mar2020.pdfDeep network [Kearns, 2016] predicts if a molecule binds to certain DNA site Finding:

Attributions are for human consumption

Naive scaling of attributions from 0 to 255

Attributions have a large range and long tail across pixels

After clipping attributions at 99% to reduce range

● Humans interpret attributions and generate insights

○ Doctor maps attributions for x-rays to pathologies

● Visualization matters as much as the attribution technique