Example: tourism industry

Understanding Black-box Predictions via Influence Functions

Understanding Black-box Predictions via Influence Functions Pang Wei Koh 1 Percy Liang 1. Abstract point (Ribeiro et al., 2016) or by perturbing the test point to How can we explain the Predictions of a black - see how the prediction changes (Simonyan et al., 2013; Li box model? In this paper, we use Influence func- et al., 2016b; Datta et al., 2016; Adler et al., 2016). These tions a classic technique from robust statis- works explain the Predictions in terms of the model, but how can we explain where the model came from? [ ] 10 Jul 2017. tics to trace a model's prediction through the learning algorithm and back to its training data, In this paper, we tackle this question by tracing a model's thereby identifying training points most respon- Predictions through its learning algorithm and back to the sible for a given prediction. To scale up Influence training data, where the model parameters ultimately de- Functions to modern machine learning settings, rive from. To formalize the impact of a training point on a we develop a simple, efficient implementation prediction, we ask the counterfactual: what would happen that requires only oracle access to gradients and if we did not have this training point, or if the values of this Hessian-vector products.

box models whose predictions seem hard to explain. Work on interpreting these black-box models has focused on un-derstanding how a fixed model leads to particular predic-tions, e.g., by locally fitting a simpler model around the test 1Stanford University, Stanford, CA. Correspondence to: Pang Wei Koh <pangwei@cs.stanford.edu>, Percy Liang <pli-

Tags:

  Understanding, Black, Understanding black box

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of Understanding Black-box Predictions via Influence Functions

1 Understanding Black-box Predictions via Influence Functions Pang Wei Koh 1 Percy Liang 1. Abstract point (Ribeiro et al., 2016) or by perturbing the test point to How can we explain the Predictions of a black - see how the prediction changes (Simonyan et al., 2013; Li box model? In this paper, we use Influence func- et al., 2016b; Datta et al., 2016; Adler et al., 2016). These tions a classic technique from robust statis- works explain the Predictions in terms of the model, but how can we explain where the model came from? [ ] 10 Jul 2017. tics to trace a model's prediction through the learning algorithm and back to its training data, In this paper, we tackle this question by tracing a model's thereby identifying training points most respon- Predictions through its learning algorithm and back to the sible for a given prediction. To scale up Influence training data, where the model parameters ultimately de- Functions to modern machine learning settings, rive from. To formalize the impact of a training point on a we develop a simple, efficient implementation prediction, we ask the counterfactual: what would happen that requires only oracle access to gradients and if we did not have this training point, or if the values of this Hessian-vector products.

2 We show that even on training point were changed slightly? non-convex and non-differentiable models where the theory breaks down, approximations to influ- Answering this question by perturbing the data and retrain- ence Functions can still provide valuable infor- ing the model can be prohibitively expensive. To overcome mation. On linear models and convolutional neu- this problem, we use Influence Functions , a classic tech- ral networks, we demonstrate that Influence func- nique from robust statistics (Cook & Weisberg, 1980) that tions are useful for multiple purposes: under- tells us how the model parameters change as we upweight standing model behavior, debugging models, de- a training point by an infinitesimal amount. This allows us tecting dataset errors, and even creating visually- to differentiate through the training to estimate in closed- indistinguishable training-set attacks. form the effect of a variety of training perturbations. Despite their rich history in statistics, Influence Functions 1.

3 Introduction have not seen widespread use in machine learning; to the best of our knowledge, the work closest to ours is Wo- A key question often asked of machine learning systems jnowicz et al. (2016), which introduced a method for ap- is Why did the system make this prediction? We want proximating a quantity related to Influence in generalized models that are not just high-performing but also explain- linear models. One obstacle to adoption is that influ- able. By Understanding why a model does what it does, we ence Functions require expensive second derivative calcu- can hope to improve the model (Amershi et al., 2015), dis- lations and assume model differentiability and convexity, cover new science (Shrikumar et al., 2016), and provide which limits their applicability in modern contexts where end-users with explanations of actions that impact them models are often non-differentiable, non-convex, and high- (Goodman & Flaxman, 2016). dimensional. We address these challenges by showing that However, the best-performing models in many domains we can efficiently approximate Influence Functions using , deep neural networks for image and speech recogni- second-order optimization techniques (Pearlmutter, 1994.)

4 Tion (Krizhevsky et al., 2012) are complicated, black - Martens, 2010; Agarwal et al., 2016), and that they remain box models whose Predictions seem hard to explain. Work accurate even as the underlying assumptions of differentia- on interpreting these Black-box models has focused on un- bility and convexity degrade. derstanding how a fixed model leads to particular predic- Influence Functions capture the core idea of studying mod- tions, , by locally fitting a simpler model around the test els through the lens of their training data. We show that 1. Stanford University, Stanford, CA. Correspondence to: they are a versatile tool that can be applied to a wide variety Pang Wei Koh Percy Liang <pli- of seemingly disparate tasks: Understanding model behav- ior, debugging models, detecting dataset errors, and cre- ating visually-indistinguishable adversarial training exam- Proceedings of the 34 th International Conference on Machine ples that can flip neural network test Predictions , the train- Learning, Sydney, Australia, PMLR 70, 2017.

5 Copyright 2017. by the author(s). ing set analogue of Goodfellow et al. (2015). Understanding Black-box Predictions via Influence Functions 2. Approach Perturbing a training input Consider a prediction problem from some input space X Let us develop a finer-grained notion of Influence by study- ( , images) to an output space Y ( , labels). We are ing a different counterfactual: how would the model's pre- given training points z1 , .. , zn , where zi = (xi , yi ) dictions change if a training input were modified? X Y. For a point z and P parameters , let def n L(z, ) be the loss, and let n1 i=1 L(zi , ) be the em- For a training point z = (x, y), define z = (x + , y). pirical risk. The empirical risk minimizer is given by Consider the perturbation z 7 z , and let z , z be the def Pn empirical risk minimizer on the training points with z in = arg min n1 i=1 L(zi , ).1 Assume that the em- place of z. To approximate its effects, define the parameters pirical risk is twice-differentiable and strictly convex in ; def in Section 4 we explore relaxing these assumptions.

6 Resulting from P moving mass from z onto z : ,z , z =. 1 n arg min n i=1 L(zi , ) + L(z , ) L(z, ). An Upweighting a training point analogous calculation to (1) yields: Our goal is to understand the effect of training points on a d ,z , z = Iup,params (z ) Iup,params (z). d . model's Predictions . We formalize this goal by asking the =0. = H 1 L(z , ) L(z, ) . (3).. counterfactual: how would the model's Predictions change if we did not have this training point? As before, we can make the linear approximation z , z . Let us begin by studying the change in model pa- n1 (Iup,params (z ) Iup,params (z)), giving us a closed- rameters due to removing a point z from the train- form estimate of the effect of z 7 z on the model. Anal- ing set. Formally, this change is z , where def ogous equations also apply for changes in y. While in- z = arg min zi 6=z L(zi , ). However, retraining P. fluence Functions might appear to only work for infinitesi- the model for each removed z is prohibitively slow.

7 Mal (therefore continuous) perturbations, it is important to Fortunately, Influence Functions give us an efficient approx- note that this approximation holds for arbitrary : the - imation. The idea is to compute the parameter change if z upweighting scheme allows us to smoothly interpolate be- were upweighted by some small , giving us new param- tween z and z . This is particularly useful for working with def Pn discrete data ( , in NLP) or with discrete label changes. eters ,z = arg min n1 i=1 L(zi , ) + L(z, ). A. classic result (Cook & Weisberg, 1982) tells us that the in- If x is continuous and is small, we can further approxi- fluence of upweighting z on the parameters is given by mate (3). Assume that the input domain X Rd , the pa- rameter space Rp , and L is differentiable in and x. d ,z def L(z, ). As k k 0, L(z , ) [ x L(z, )] , . Iup,params (z) = = H 1 L(z, ), (1). d =0 . p d where x L(z, ) R . Substituting into (3), def d ,z , z Pn is the Hessian and is where H = n1 i=1 2 L(zi , ).

8 H 1 [ x L(z, )] . (4). positive definite (PD) by assumption. In essence, we form d . =0. a quadratic approximation to the empirical risk around . and take a single Newton step; see appendix A for a deriva- We thus have z , z n1 H 1 [ x L(z, )] . Dif- tion. Since removing a point z is the same as upweighting ferentiating and applying the chain rule gives us it by = n1 , we can linearly approximate the parame- def Ipert,loss (z, ztest )> = L(ztest , z , z )> (5). ter change due to removing z by computing z =0. n1 Iup,params (z), without retraining the model. > H 1 x L(z, ). = L(ztest , ) .. Next, we apply the chain rule to measure how upweighting Ipert,loss (z, ztest )> tells us the approximate effect that z 7 . In particular, the Influence of z changes Functions of . z + has on the loss at ztest . By setting in the direction of upweighting z on the loss at a test point ztest again has a Ipert,loss (z, ztest ), we can construct local perturbations of z closed-form expression: that maximally increase the loss at ztest.

9 In Section , we will use this to construct training-set attacks. Finally, we defdL(ztest , ,z ) note that Ipert,loss (z, ztest ) can help us identify the features Iup,loss (z, ztest ) = (2). d . =0 of z that are most responsible for the prediction on ztest . > d ,z = L(ztest , ). d =0 Relation to Euclidean distance = L(ztest , ) > H 1 L(z, ).. To find the training points most relevant to a test point, it 1. We fold in any regularization terms into L. is common to look at its nearest neighbors in Euclidean Understanding Black-box Predictions via Influence Functions Figure 1. Components of Influence . (a) What is the effect of the training loss and H 1 terms in Iup,loss ? Here, we plot Iup,loss against variants that are missing these terms and show that they are necessary for picking up the truly influential training points. For these calculations, we use logistic regression to distinguish 1's from 7's in MNIST (LeCun et al., 1998), picking an arbitrary test point ztest ;. similar trends hold across other test points.

10 Green dots are train images of the same label as the test image (7) while red dots are 1's. Left: Without the train loss term, we overestimate the Influence of many training points: the points near the y=0 line should have Iup,loss close to 0, but instead have high Influence when we remove the train loss term. Mid: Without H 1 , all green training points are helpful (removing each point increases test loss) and all red points are harmful (removing each point decreases test loss). This is because x, x 0 (all pixel values are positive), so x xtest 0, but it is incorrect: many harmful training points actually share the same label as ztest . See panel (b). Right: Without training loss or H 1 , what is left is the scaled Euclidean inner product ytest y ( ytest > xtest ) x>. test x, which fails to accurately capture Influence ; the scatter plot deviates quite far from the diagonal. (b) The test image and a harmful training image with the same label. To the model, they look very different, so the presence of the training image makes the model think that the test image is less likely to be a 7.


Related search queries