You are on page 1of 9

Concise Explanations of Neural Networks using Adversarial Training

Prasad Chalasani 1 Jiefeng Chen 2 Amrita Roy Chowdhury 2 Somesh Jha 1 2 Xi Wu 3

Abstract 1. Introduction
We show new connections between adversarial Despite the recent dramatic success of deep learning models
learning and explainability for deep neural net- in a variety of domains, two serious concerns have surfaced
works (DNNs). One form of explanation of the about these models.
output of a neural network model in terms of its
input features, is a vector of feature-attributions. Vulnerability to Adversarial Attacks: We can abstractly
Two desirable characteristics of an attribution- think of a neural network model as a function F (x x) of a
based explanation are: (1) sparseness: the at- d-dimensional input vector x 2 Rd , and the range of F
tributions of irrelevant or weakly relevant fea- is either a discrete set of class-labels, or a continuous set
tures should be negligible, thus resulting in con- of class probabilities. Many of these models can be foiled
cise explanations in terms of the significant fea- by an adversary who imperceptibly (to humans) alters the
tures, and (2) stability: it should not vary sig- input x by adding a perturbation 2 Rd so that F (x x+ )
nificantly within a small local neighborhood of is very different from F (x
x) (Szegedy et al., 2013; Goodfel-
the input. Our first contribution is a theoretical low et al., 2014; Papernot et al., 2015; Biggio et al., 2013).
exploration of how these two properties (when Adversarial training (or adversarial learning) has recently
using attributions based on Integrated Gradients, been proposed as a method for training models that are ro-
or IG) are related to adversarial training, for a bust to such attacks, by applying techniques from the area
class of 1-layer networks (which includes logis- of Robust Optimization (Madry et al., 2017; Sinha et al.,
tic regression models for binary and multi-class 2018). The core idea of adversarial training is simple: we
classification); for these networks we show that define a set S of allowed perturbations 2 Rd that we want
(a) adversarial training using an `1 -bounded ad- to “robustify” against (e.g. S could be the set of where
versary produces models with sparse attribution || ||1  "), and perform model-training using Stochas-
vectors, and (b) natural model-training while en- tic Gradient Descent (SGD) exactly as in natural training,
couraging stable explanations (via an extra term except that each training example x is perturbed adversari-
in the loss function), is equivalent to adversarial ally, i.e. replaced by x + ⇤ where ⇤ 2 S maximizes the
training. Our second contribution is an empir- example’s loss-contribution.
ical verification of phenomenon (a), which we
show, somewhat surprisingly, occurs not only
Explainability: One way to address the well-known lack
in 1-layer networks, but also DNNs trained on
of explainability of deep learning models is feature attribu-
standard image datasets, and extends beyond IG-
tion, which aims to explain the output of a model F (x x) as
based attributions, to those based on DeepSHAP:
an attribution vector AF (xx) of the contributions from the
adversarial training with `1 -bounded perturba-
features x . There are several feature-attribution techniques
tions yields significantly sparser attribution vec-
in the literature, such as Integrated Gradients (IG) (Sun-
tors, with little degradation in performance on
dararajan et al., 2017), DeepSHAP (Lundberg & Lee, 2017),
natural test data, compared to natural training.
and LIME (Ribeiro et al., 2016). For such an explanation
Moreover, the sparseness of the attribution vec-
to be human-friendly, it is highly desirable (Molnar, 2019)
tors is significantly better than that achievable via
that the attribution-vector is sparse, i.e., only the features
`1 -regularized natural training.
that are truly predictive of the output F (x x) should have
significant contributions, and irrelevant or weakly-relevant
1
XaiPient 2 University of Wisconsin (Madison) 3 Google. Corre- features should have negligible contributions. A sparse attri-
spondence to: Prasad Chalasani <pchalasani@gmail.com>. bution makes it possible to produce a concise explanation,
Proceedings of the 37 th International Conference on Machine where only the input features with significant contributions
Learning, Online, PMLR 119, 2020. Copyright 2020 by the au- are included. For instance, if the model F is used for a loan
thor(s). approval decision, then various stakeholders (like customers,
Concise Explanations of Neural Networks using Adversarial Training

data-scientists and regulators) would like to know the reason MNIST (Xiao et al., 2017), and (b) logistic regression
for a specific decision in simple terms. In practice however, models on the Mushroom and Spambase tabular datasets
due to artifacts in the training data or process, the attribution from the UCI Data Repository (Dheeru & Karra Taniskidou,
vector is often not sparse and irrelevant or weakly-relevant 2017). In all of our experiments, we find that it is possible
features end up having significant contributions (Tan et al., to choose an `1 bound " so that adversarial learning under
2013). Another desirable property of a good explanation is this bound produces attribution vectors that are sparse on
stability: the attribution vector should not vary significantly average, with little or no drop in performance on natural test
within a small local neighborhood of the input x. Similar data. A visually striking example of this effect is shown in
to the lack of concise explainability, natural training often Figure 1 (the Gini Index, introduced in Section 6, measures
results in explanations that lack stability (Alvarez-Melis & the sparseness of the map).
Jaakkola, 2018).
It is natural to wonder whether a traditional weight-
Our paper shows new connections between adversarial ro- regularization technique such as `1 -regularization can pro-
bustness and the above-mentioned desirable properties of duce models with sparse attribution vectors. In fact, our
explanations, namely conciseness and stability. Specifically, experiments show that for logistic regression models, `1 -
let F̃ be an adversarially trained version of a classifier F , regularized training does yield attribution vectors that are
and for a given input vector x and attribution method A, on average significantly sparser compared to attribution vec-
let AF (x
x) and AF̃ (x
x) denote the corresponding attribution tors from natural (un-regularized) model-training, and the
vectors. The central research question this paper addresses sparseness improvement is almost as good as that obtained
is: with `1 (")-adversarial training. This is not too surprising
given our result (Lemma 4.1) that implies a direct link be-
Is AF̃ (x
x) sparser and more stable than AF (x
x)? tween sparseness of weights and sparseness of IG vectors,
for 1-layer models. Intriguingly, this does not carry over to
The main contributions of our paper are as follows: DNNs: for multi-layer models (such as the ConvNets we
Theoretical Analysis of Adversarial Training: Our first trained for the image datasets mentioned above) we find that
set of results show via a theoretical analysis that `1 (")- with `1 -regularization, the sparseness improvement is sig-
adversarial training 1-layer networks tends to produce sparse nificantly inferior to that obtainable from `1 (")-adversarial
attribution vectors for IG, which in turn leads to concise ex- training (when controlling for model accuracy on natural test
planations. In particular, under some assumptions, we show data), as we show in Table 1, Figure 2 and Figure 3. Thus
(Theorems 3.1 and E.1) that for a general class of convex it appears that for DNNs, the attribution-sparseness that
loss functions (which includes popular loss functions used results from adversarial training is not necessarily related to
in 1-layer networks, such as logistic and hinge loss, used sparseness of weights.
for binary or multi-class classification), and adversarial per- Connection between Adversarial Training and Attribution
turbations satisfying || ||1  ", the weights of “weak” Stability: We also show theoretically (Section 5) that train-
features are on average more aggressively shrunk toward ing 1-layer networks naturally, while encouraging stability
zero than during natural training, and the rate of shrinkage of explanations (via a suitable term added to the loss func-
is proportional to the amount by which " exceeds a certain tion), is in fact equivalent to adversarial training.
measure of the “strength” of the feature. This shows that
`1 (")-adversarial training tends to produce sparse weight
vectors in popular 1-layer models. In Section 4 we show
Natural Training Adversarial Training
(Lemma 4.1) a closed form formula for the IG vector of
1-layer models, that makes it clear that in these models,
sparseness of the weight vector directly implies sparseness
of the IG vector.
Empirically Demonstrate Attribution Sparseness: In Sec-
tion 6 we empirically demonstrate that this “sparsification”
effect of `1 (")-adversarial training holds not only for 1-
Gini: 0.6150 Gini: 0.7084
layer networks (e.g. logistic regression models), but also for
Deep Convolutional Networks used for image classification, Figure 1: Both models correctly predict “Bird”, but the
and extends beyond IG-based attributions, to those based IG-based saliency map of the adversarially trained model is
on DeepSHAP. Specifically, we show this phenomenon via much sparser than that of the naturally trained model.
experiments applying `1 (")-adversarial training to (a) Con-
volutional Neural Networks on public benchmark image
datasets MNIST (LeCun & Cortes, 2010) and Fashion-
Concise Explanations of Neural Networks using Adversarial Training

2. Setup and Assumptions Assumption LOSS-INC. The loss function is of the form
L(x w , x i) where g is a non-decreasing
x, y; w ) = g( yhw
For ease of understanding, we consider the case of binary function.
classification for the rest of our discussion in the main paper.
We assume there is a distribution D of data points (x x, y) Assumption LOSS-CVX. The loss function is of the form
where x 2 Rd is an input feature vector, and y 2 {±1} is x, y; w ) = g( yhw
L(x w , x i) where g is non-decreasing,
its true label1 . For each i 2 [d], the i’th component of x almost-everywhere differentiable, and convex.
represents an input feature, and is denoted by xi . The model
Section B.1 in the Supplement shows that these Assump-
is assumed to have learnable parameters (“weights”) w 2
tions are satisfied by popular loss functions such as logistic
Rd , and for a given data point (x x, y), the loss is given by
and hinge loss. Incidentally, note that for any differentiable
some function L(x , y; ). Natural model training 2 consists
x w
function g, g is convex if and only if its first-derivative g 0
of minimizing the expected loss, known as empirical risk:
is non-decreasing, and we will use this property in some of
E(xx,y)⇠D [L(x
x, y; w )]. (1) the proofs.

We sometimes assume the existence of an `1 (")-adversary Assumption FEAT-TRANS. For each i 2 [d], if x0i is the
who may perturb the input example x by adding a vector 2 feature in the original dataset, xi is the translated version of
Rd whose `1 -norm is bounded by "; such a perturbation is x0i defined by xi = x0i [E(x0i |y = 1) + E(x0i |y = 1)]/2.
referred to as an `1 (")-perturbation. For a given data point
In Section B.2 (Supplement) we show that this mild assump-
x, y) and a given loss function L(.), an `1 (")-adversarial
(x
tion implies that for each feature xi there is a constant ai
perturbation is a ⇤ that maximizes the adversarial loss
such that
L(xx + ⇤ , y; w ).
Given a function F : Rd ! [0, 1] representing a neural E(xi |y) = ai y (3)
network, an input vector x 2 Rd , and a suitable baseline 2
E(yxi ) = E[E(yxi |y)] = E[y ai ] = ai (4)
vector u 2 Rd , an attribution of the prediction of F at in- 2
E(yxi |y) = yE[xi |y] = y ai = ai (5)
put x relative to u is a vector AF (xx, u) 2 Rd whose i’th
component AF x, u) represents the “contribution” of xi
i (x For any i 2 [d], we can think of E(yxi ) as the degree of asso-
to the prediction F (xx). A variety of attribution methods ciation3 between feature xi and label y. Since E(yxi ) = ai
have been proposed in the literature (see (Arya et al., 2019) (Eq. 4), we refer to ai as the directed strength4 of feature xi ,
for a survey), but in this paper we will focus on two of and |ai | is referred to as the absolute strength of xi . In par-
the most popular ones: Integrated Gradients (Sundarara- ticular when |ai | is large (small) we say that xi is a strong
jan et al., 2017), and DeepSHAP (Lundberg & Lee, 2017). (weak) feature.
When discussing a specific attribution method, we will de-
note the IG-based attribution vector as IGF (xx, u ), and the
2.1. Averaging over a group of features
DeepSHAP-based attribution vector as SHF (x x, u ). In all
cases we will drop the superscript F and/or the baseline For our main theoretical result (Theorem 3.1), we need a
vector u when those are clear from the context. notion of weighted average defined as follows:
The aim of adversarial training(Madry et al., 2017) is to Definition WTD-AV. Given a quantity qi defined for each
train a model that is robust to an `1 (")-adversary (i.e. per- feature-index i 2 [d], a subset S ⇢ [d] (where |S| 1) of
forms well in the presence of such an adversary), and con- feature-indices, and a feature weight-vector w with wi 6= 0
sists of minimizing the expected `1 (")-adversarial loss: for at least one i 2 S, the w-weighted average of q over S
is defined as P
E(xx,y)⇠D [ max L(x
x + , y; w )]. (2) w i qi
|| ||1 " qS := Pi2S
w
(6)
i2S |wi |
In the expectations (1) and (2) we often drop the subscript
under E when it is clear that the expectation is over (x
x, y) ⇠ Note that the quantity wi qi can be written as |wi | sgn(wi )qi ,
D. so qSw is essentially a |wi |-weighted average of sgn(wi )qi
Some of our theoretical results make assumptions regarding over i 2 S.
the form and properties of the loss function L, the properties For our result we will use the above w-weighted average
of its first derivative. For the sake of clarify, we highlight definition for two particular quantities qi . The first one is
these assumptions (with mnemonic names) here for ease of
3
future reference. When the features are standardized to have mean 0, E(yxi ) is
in fact the covariance of y and xi .
1 4
It is trivial to convert -1/1 labels to 0/1 labels and vice versa This is related to the feature “robustness” notion introduced
2
Also referred to as standard training by (Madry et al., 2017) in (Ilyas et al., 2019)
Concise Explanations of Neural Networks using Adversarial Training

qi := ai , the directed strength of feature xi (Eq. 4). Intu- Our experiments (Sec. 6) show that indeed for logistic re-
itively, the quantity sgn(wi )E(yxi ) = ai sgn(wi ) captures gression models (which satisfy the conditions of Theorem
the aligned strength of feature xi in the following sense: if 3.1), adversarial training leads to sparse IG vectors. Interest-
this quantity is large and positive (large and negative), it ingly, our extensive experiments with Deep Convolutional
indicates both that the current weight wi of xi is aligned Neural Networks on public image datasets demonstrate that
(misaligned) with the directed strength of xi , and that this this phenomenon extends to DNNs as well, and to attri-
directed strength is large. Thus aw
S represents an average of butions based on DeepSHAP, even though our theoretical
the aligned strength over the feature-group S. results only apply to 1-layer networks and IG-based attribu-
tions.
The second quantity for which we define the above w-
weighted average is qi := i , where i := E[@L/@wi ] As a preliminary, it is easy to show the following expres-
represents the expected SGD update (over random draws sions related to the `1 (")-adversarial perturbation ⇤ (See
from the data distribution) of the weight wi , given the loss Lemmas 2 and 3 in Section C of the Supplement): For
function L, for a unit learning rate (details are in the next loss functions satisfying Assumption LOSS-INC, the `1 (")-
Section). The quantity sgn(wi ) i has a natural interpreta- adversarial perturbation ⇤ is given by:
tion, analogous to the above interpretation of ai sgn(wi ):

a large positive (large negative) value of sgn(wi ) i corre- = w )",
y sgn(w (7)
sponds to an large expansion (large shrinkage), in expecta-
tion, of the weight wi away from zero magnitude (toward the corresponding `1 (")-adversarial loss is
w
zero magnitude). Thus the w-weighted average S rep- x + ⇤ , y; w ) = g("|| w ||1
L(x w , x i),
yhw (8)
resents the |wi |-weighted average of this effect over the
feature-group S. and the gradient of this loss w.r.t. a weight wi is

3. Analysis of SGD Updates in Adversarial x + ⇤ , y; w )


@L(x
=
Training @wi
g 0 ("|| w ||1 yhw
w , x i) (yxi sgn(wi )"). (9)
One way to understand the characteristics of the weights in
an adversarially-trained neural network model, is to analyze In our main result, the expectation of the g 0 term in (9) plays
how the weights evolve during adversarial training under an important role, so we will use the following notation:
Stochastic Gradient Descent (SGD) optimization. One of ⇥ ⇤
the main results of this work is a theoretical characteriza- g 0 := E g 0 ("|| w ||1 yhww , x i) , (10)
tion of the weight updates during a single SGD step, when
applied to a randomly drawn data point (x x, y) ⇠ D that is and by Assumption LOSS-INC, g 0 is non-negative.
subjected to an `1 (")-adversarial perturbation. Ideally, we would like to understand the nature of the weight-
Although the holy grail would be to do this for general vector w ⇤ that minimizes the expected adversarial loss (2).
DNNs (and we expect this will be quite difficult) we take a This is quite challenging, so rather than analyzing the final
first step in this direction by analyzing single-layer networks optimum of (2), we instead analyze how an SGD-based
for binary or multi-class classification, where each weight optimizer for (2) updates the model weights w . We assume
is associated with an input feature. Intriguingly, our results an idealized SGD process: (a) a data point (x x, y) is drawn
(Theorem 3.1 for binary classification and E.1 for multi- from distribution D, (b) x is replaced by x 0 = x + ⇤ where
class classification in the Supplement) show that for these

is an `1 (")-adversarial perturbation with respect to the
models, `1 (")-adversarial training tends to selectively re- loss function L, (c) each weight wi is updated by an amount
duce the weight-magnitude of weakly relevant or irrelevant wi = @L(x x0 , y; w )/@wi (assuming a unit learning rate
features, and does so much more aggressively than natu- to avoid notational clutter). We are interested in the expec-
ral training. In other words, natural training can result in tation i := E wi = E[@L(x x0 , y; w)/@wi ], in order to
models where many weak features have significant weights, understand how a weight wi evolves on average during a
whereas adversarial training would tend to push most of single SGD step. Where there is a conditionally independent
these weights close to zero. The resulting model weights feature subset S 2 [d] (i.e. the features in S are condition-
would thus be more sparse, and the corresponding IG-based ally independent of the rest given the label y), our main
attribution vectors would on average be more sparse as well theoretical result characterizes the behavior of i for i 2 S,
w
(since in linear models, sparse weights imply sparse IG and the corresponding w-weighted average S :
vectors; this is a consequence of Lemma 4.1) compared to Theorem 3.1 (Expected SGD Update in Adversarial Train-
naturally-trained models. ing). For any loss function L satisfying Assumption LOSS-
CVX, a dataset D satisfying Assumption FEAT-TRANS, a
Concise Explanations of Neural Networks using Adversarial Training

subset S of features that are conditionally independent of (Sundararajan et al., 2017), which is defined as follows:
the rest given the label y, if a data point (xx, y) is randomly Suppose F : Rd ! R is a real-valued function of an input
drawn from D, and x is perturbed to x 0 = x + ⇤ , where vector. For example F could represent the output of a neural

is an `1 (")-adversarial perturbation, then during SGD network, or even a loss function L(x x, y; w ) when the label
using the `1 (")-adversarial loss L(x x0 , y; w ), the expected y and weights w are held fixed. Let x 2 Rd be a specific
weight-updates i := E wi for i 2 S and the correspond- input, and u 2 Rd be a baseline input. The IG is defined
w
ing w-weighted average S satisfy the following proper- as the path integral of the gradients along the straight-line
ties: path from the baseline u to the input x . The IG along the
i’th dimension for an input x and baseline u is defined as:
1. If wi = 0 8i 2 S, then for each i 2 S,
Z 1

i = g0 ai , (11) IGF x, u )
i (x := (xi ui ) ⇥ u +↵(x
@i F (u x u ))d↵,
↵=0
(13)
2. and otherwise, where @i F (zz ) denotes the gradient of F (vv ) along the i’th
w dimension, at v = z . The vector of all IG components
 g 0 (aw "), (12)
S S
IGF x, u ) is denoted as IGF (x
i (x x, u ). Although we do not
and equality holds in the limit as wi ! 0 8i 2 S, show w explicitly as an argument in the notation IGF (x x, u ),
it should be understood that the IG depends on the model
where g 0 is the expectation in (10), ai = E(xi y) is the weights w since the function F depends on w .
directed strength of feature xi from Eq. (4), and aw
S is the The following Lemma (proved in Sec. F of the Supplement)
corresponding w-weighted average over S. shows a closed form exact expression for the IGF (xx, u )
when F (xx) is of the form
For space reasons, a detailed discussion of the implications
of this result is presented in Sec. D.2 of the Supplement, but
x) = A(hw
F (x w , x i), (14)
here we note the following. Recalling the interpretation of
w
the w-weighted averages aw S and S in Section 2.1, we can
interpret the above result as follows. For any conditionally where w 2 Rd is a vector of weights, A is a differen-
independent feature subset S, if the weights of all features tiable scalar-valued function, and hw w , x i denotes the dot
in S are zero, then by Eq. (11), an SGD update causes, product of w and x. Note that this form of F could
on average, each of these weights wi to grow (from 0) in represent a single-layer neural network with any differ-
a direction consistent with the directed feature-strength ai entiable activation function (e.g., logistic (sigmoid) acti-
(since g 0 0 as noted above). If at least one of the features vation A(zz ) = 1/[1 + exp( z )] or Poisson activation
w
in S has a non-zero weight, (12) implies S < 0, i.e., A(zz ) = exp(zz )), or a differentiable loss function, such
an aggregate shrinkage of the weights of features in S, if as those that satisfy Assumption LOSS-INC for a fixed label
either of the following hold: (a) aw y and weight-vector w . For brevity, we will refer to a func-
S < 0, i.e., the weights of
features in S are mis-aligned on average, or (b) the weights tion of the form (14) as representing a “1-Layer Network”,
of features in S are aligned on average, i.e., aw with the understanding that it could equally well represent a
S is positive,
but dominated by ", i.e. the features S are weakly correlated suitable loss function.
with the label. In the latter case the weights of features in S Lemma 4.1 (IG Attribution for 1-layer Networks). If F (x
x)
are (in aggregate and in expectation) aggressively pushed is computed by a 1-layer network (14) with weights vector
toward zero, and this aggressiveness is proportional to the w , then the Integrated Gradients for all dimensions of x
extent to which " dominates aw S . A partial generalization relative to a baseline u are given by:
of the above result for the multi-class setting (for a single
conditionally-independent feature) is presented in Section E x u) w
(x
(Theorem E.1) of the Supplement. IGF (x
x, u ) = [F (x
x) u)]
F (u , (15)
x u, w i
hx

4. FEATURE ATTRIBUTION USING where the operator denotes the entry-wise product of
INTEGRATED GRADIENTS vectors.

Theorem 3.1 showed that `1 (")-adversarial training tends Thus for 1-layer networks, the IG of each feature is essen-
to shrink the weights of features that are “weak” (relative to tially proportional to the feature’s fractional contribution
"). We now show a link between weights and explanations, to the logit-change hxx u , w i. This makes it clear that in
specifically explanations in the form of a vector of feature- such models, if the weight-vector w is sparse, then the IG
attributions given by the Integrated Gradients (IG) method vector will also be correspondingly sparse.
Concise Explanations of Neural Networks using Adversarial Training

5. Training with Explanation Stability is 6. Experiments


equivalent to Adversarial Training 6.1. Hypotheses
Suppose we use the IG method described in Sec. 4 as an Recall that one implication of Theorem 3.1 is the following:
explanation for the output of a model F (x x) on a specific For 1-layer networks where the loss function satisfies As-
input x . A desirable property of an explainable model is sumption LOSS-CVX, `1 (")-adversarial training tends to
that the explanation for the value of F (x
x) is stable(Alvarez- more-aggressively prune the weight-magnitudes of “weak”
Melis & Jaakkola, 2018), i.e., does not change much under features compared to natural training. In Sec. 4 we observed
small perturbations of the input x . One way to formalize that a consequence of Lemma 4.1 is that for 1-layer models
this is to say the following worst-case `1 -norm of the change the sparseness of the weight vector implies sparseness of
in IG should be small: the IG vector. Thus a reasonable conjecture is that, for 1-
max || IGF (x
x0 , u ) IGF (x
x, u )||1 , (16) layer networks, `1 (")-adversarial training leads to models
x 0 2N (x
x,")
with sparse attribution vectors in general (whether using
where N (x x, ") denotes a suitable "-neighborhood of x , and IG or a different method, such as DeepSHAP). We further
u is an appropriate baseline input vector. If the model F is a conjecture that this sparsification phenomenon extends to
single-layer neural network, it would be a function of hw w, xi practical multi-layer Deep Neural Networks, not just 1-layer
for some weights w , and typically when training such net- networks, and that this benefit can be realized without sig-
works the loss is a function of hw w , x i as well, so we would nificantly impacting accuracy on natural test data. Finally,
not change the essence of (16) much if instead of F in each we hypothesize that the resulting sparseness of attribution
IG, we use L(x x, y; w ) for a fixed y; let us denote this func- vectors is better than what can be achieved by a traditional
tion by Ly . Also intuitively, || IGLy (x x0 , u ) IGLy (x x, u )||1 weight regularization technique such as L1-regularization,
Ly
is not too different from || IG (x x , x )||1 . These observa-
0 for a comparable level of natural test accuracy.
tions motivate the following definition of Stable-IG Empiri-
cal Risk, which is a modification of the usual empirical risk 6.2. Measuring Sparseness of an Attribution Vector
(1), with a regularizer to encourage stable IG explanations:
h For an attribution method A, we quantify the sparseness of
E(xx,y)⇠D L(x x, y; w ) + the attribution vector AF (x
x, u ) using the Gini Index applied
i to the vector of absolute values AF (x x, u ). For a vector
max || IG Ly
x, x 0 )||1 . (17)
(x v of non-negative values, the Gini Index, denoted G(vv )
0
|| x x ||1 "
(defined formally in Sec. I in the Supplement), is a metric
for sparseness of v that is known (Hurley & Rickard, 2009)
The following somewhat surprising result is proved in Sec-
to satisfy a number of desirable properties, and has been
tion G of the Supplement.
used to quantify sparseness of weights in a neural network
Theorem 5.1 (Equivalence of Stable IG and Adversarial (Guest & Love, 2017). The Gini Index by definition lies in
Robustness). For loss functions L(xx, y; w ) satisfying As- [0,1], and a higher value indicates more sparseness.
sumption LOSS-CVX, the augmented loss inside the expec-
tation (17) equals the `1 (")-adversarial loss inside the Since the model F is clear from the context, and the base-
expectation (2), i.e. line vector u are fixed for a given dataset, we will denote
the attribution vector on input x simply as A(x x), and our
x, y; w ) +
L(x max || IGLy (x
x, x 0 )||1 = measure of sparseness is G(|A(x x)|), which we denote for
|| x0 x ||1 "
brevity as G[A](xx), and refer to informally as the Gini of A,
x + , y; w )
max L(x (18) where A can stand for IG (when using IG-based attributions)
|| ||1 "
or SH (when using DeepSHAP for attribution). As men-
This implies that for loss functions satisfying Assumption tioned above, one of our hypotheses is that the sparseness
LOSS-CVX, minimizing the Stable-IG Empirical Risk (17) of attributions of models produced by `1 (")-adversarial
is equivalent to minimizing the expected `1 (")-adversarial training is much better than what can be achieved by natu-
loss. In other words, for this class of loss functions, natural ral training using `1 -regularization, for a comparable level
model training while encouraging IG stability is equivalent of accuracy. To verify this hypothesis we will compare
to `1 (")-adversarial training! Combined with Theorem the sparseness of attribution vectors resulting from three
3.1 and the corresponding experimental results in Sec 6, this types of models: (a) n-model: naturally-trained model
equivalence implies that, for this class of loss functions, and with no adversarial perturbations and no `1 -regularization,
data distributions satisfying Assumption FEAT-TRANS, the (b) a-model: `1 (")-adversarially trained model, and (c)
explanations for the models produced by `1 (")-adversarial l-model: naturally trained model with `1 -regularization
training are both concise (due to the sparseness of the mod- strength > 0. For an attribution method A, we denote the
els), and stable. Gini indices G[A](x x) resulting from these models respec-
Concise Explanations of Neural Networks using Adversarial Training

tively as Gn [A](x x; ") and Gl [A](x


x), Ga [A](x x; ). on the tabular datasets. Table 1 shows a summary of some
results on the above 5 datasets, and Fig. 2 and 3 display
In several of our datasets, individual feature vectors are
results graphically 5
already quite sparse: for example in the MNIST dataset,
most of the area consists of black pixels, and in the Mush-
room dataset, after 1-hot encoding the 22 categorical fea-
tures, the resulting 120-dimensional feature-vector is sparse. Table 1: Results on 5 datasets. For each dataset, “a” indi-
On such datasets, even an n-model can achieve a “good” cates an `1 (")-adversarially trained model with the indi-
level of sparseness of attributions in the absolute sense, i.e. cated ", and “l” indicates a naturally trained model with
Gn [A](x x) can be quite high. Therefore for all datasets we the indicated `1 -regularization strength . The attr column
compare the sparseness improvement resulting from an a- indicates the feature attribution method (IG or DeepSHAP).
model relative to an n-model, with that from an l-model Column dG shows the average sparseness improvements of
relative to a n-model. Or more precisely, we will compare the models relative to the baseline naturally trained model,
the two quantities defined below, for a given attribution as measured by the dGa [A](") and dGl [A]( ) defined in
method A: Eqs. (21, 22). Column AcDrop indicates the drop in accu-
racy relative to the baseline model.
dGa [A](x
x; ") := Ga [A](x
x; ") Gn [A](x
x), (19)
l l n
x;
dG [A](x x;
) := G [A](x ) x).
G [A](x (20) dataset attr model dG AcDrop

The above quantities define the IG sparseness improvements MNIST IG a (" = 0.3) 0.06 0.8%
for a single example x . It will be convenient to define the IG l ( = 0.01) 0.004 0.4%
overall sparseness improvement from a model, as measured SHAP a (" = 0.3) 0.06 0.8%
on a test dataset, by averaging over all examples x in that SHAP l ( = 0.01) 0.007 0.4%
dataset. We denote the corresponding average sparseness Fashion IG a (" = 0.1) 0.06 4.7%
metrics by Ga [A]("), Gl [A]( ) and Gn [A] respectively. We -MNIST IG l ( = 0.01) 0.008 3.4%
then define the average sparseness improvement of an a- SHAP a (" = 0.1) 0.08 4.7%
model and l-model as: SHAP l ( = 0.01) 0.003 3.4%
dGa [A](") := Ga [A](") Gn [A], (21) CIFAR-10 IG a (" = 1.0) 0.081 0.57%
IG l ( = 10 5 ) 0.022 1.51%
dGl [A]( ) := Gl [A]( ) Gn [A]. (22)
Mushroom IG a (" = 0.1) 0.06 2.5%
We can thus re-state our hypotheses in terms of this notation: IG l ( = 0.02) 0.06 2.6%
For each of the attribution methods A 2 {IG, SH}, the
Spambase IG a (" = 0.1) 0.17 0.9%
average sparseness improvement dGa [A](") resulting from
IG l ( = 0.02) 0.15 0.1%
type-a models is high, and is significantly higher than the
average sparseness improvement dGl [A]( ) resulting from
type-l models.
These results make it clear that for comparable levels of
6.3. Results
accuracy, the sparseness of attribution vectors from `1 (")-
We ran experiments on five standard public benchmark adversarially trained models is much better than the sparse-
datasets: three image datasets MNIST, Fashion-MNIST, ness from natural training with `1 -regularization. The effect
and CIFAR-10, and two tabular datasets from the UCI is especially pronounced in the two image datasets. The
Data Repository: Mushroom and Spambase. Details of effect is less dramatic in the two tabular datasets, for which
the datasets and training methodology are in Sec. J.1 of we train logistic regression models. Our discussion at the
the Supplement. The code for all experiments is at this end of Sec. 4 suggests a possible explanation.
repository: https://github.com/jfc43/advex. In the Introduction we gave an example of a saliency map
For each of the two tabular datasets (where we train logistic (Simonyan et al., 2013; Baehrens et al., 2010) (Fig. 1) to
regression models), for a given model-type (a, l or n), we dramatically highlight the sparseness induced by adversarial
found the average Gini index of the attribution vectors is training. We show several more examples of saliency maps
virtually identical when using IG or DeepSHAP. This is in the supplement (Section J.4).
not surprising: as pointed out in (Ancona et al., 2017), 5
The official implementation of DeepSHAP (https://
DeepSHAP is a variant of DeepLIFT, and for simple linear github.com/slundberg/shap) doesn’t support the net-
models, DeepLIFT gives a very close approximation of IG. work we use for CIFAR-10 well, so we do not show results for this
To avoid clutter, we therefore omit DeepSHAP-based results combination.
Concise Explanations of Neural Networks using Adversarial Training

Figure 2: Boxplot of pointwise sparseness-improvements from adversarially trained models (dGa [A](x
x, ")) and naturally
trained models with `1 -regularization (dGl [A](x
x, )), for attribution methods A 2 {IG, SH}.

7. Related Work 8. Conclusion


In contrast to the growing body of work on defenses against We presented theoretical and experimental results that show
adversarial attacks (Yuan et al., 2017; Madry et al., 2017; a strong connection between adversarial robustness (under
Biggio et al., 2013) or explaining adversarial examples `1 -bounded perturbations) and two desirable properties
(Goodfellow et al., 2014; Tsipras et al., 2018), the focus of model explanations: conciseness and stability. Specif-
of our paper is the connection between adversarial robust- ically, we considered model explanations in the form of
ness and explainability. We view the process of adversarial feature-attributions based on the Integrated Gradients (IG)
training as a tool to produce more explainable models. A re- and DeepSHAP techniques. For 1-layer models using a
cent series of papers (Tsipras et al., 2018; Ilyas et al., 2019) popular family of loss functions, we theoretically showed
essentially argues that adversarial examples exist because that `1 (")-adversarial training tends to produce sparse and
standard training produces models are heavily reliant on stable IG-based attribution vectors. With extensive experi-
highly predictive but non-robust features (which is simi- ments on benchmark tabular and image datasets, we demon-
lar to our notion of “weak” features in Sec 3) which are strated that the “attribution sparsification” effect extends to
vulnerable to an adversary who can “flip” them and cause Deep Neural Networks, when using two popular attribution
performance to degrade. Indeed the authors of (Ilyas et al., methods. Intriguingly, especially in DNN models for image
2019) touch upon some connections between explainability classification, the attribution sparseness from natural train-
and robustness, and conclude, “As such, producing human- ing with `1 -regularization is much inferior to that achievable
meaningful explanations that remain faithful to underlying via `1 (")-adversarial training. Our theoretical results are a
models cannot be pursued independently from the training first step in explaining some of these phenomena.
of the models themselves”, by which they are implying that
good explainability may require intervening in the model-
training procedure itself; this is consistent with our findings.
We discuss other related work in the Supplement Section A.
Concise Explanations of Neural Networks using Adversarial Training

Figure 3: For four benchmark datasets, each line-plot labeled M [A] shows the tradeoff between Accuracy and Attribution
Sparseness achievable by various combinations of models M and attribution methods A. M = A denotes `1 (")-adversarial
training, and the plot shows the accuracy/sparseness for various choices of ". M = L denotes `1 -regularized natural
training, and the plot shows accuracy/sparseness for various choices of `1 -regularization parameter . A = IG denotes
the IG attribution method, whereas A = SH denotes DeepSHAP. Attribution sparseness is measured by the Average Gini
Index over the dataset (Ga [A](") and Gl [A]( ), for adversarial training and `1 -regularized natural training respectively). In
all cases, and especially in the image datasets, adversarial training achieves a significantly better accuracy vs attribution
sparseness tradeoff.

You might also like