S ELECTIVE E NSEMBLES FOR C ONSISTENT P REDICTIONS
Anonymous authors
Paper under double-blind review
A BSTRACT
Recent work has shown that models trained to the same objective, and which achieve similar measures of accuracy on consistent test data, may nonetheless behave very differently on individual predictions.
This inconsistency is undesirable in high-stakes contexts, such as medical diagnosis and finance.
We show that this inconsistentbehavior extends beyond predictions to feature attributions, which may likewise have negative implications for the intelligibility of a model, and one’s ability to find recourse for subjects.
We then introduce selective ensembles to mitigate such inconsistencies by applying hypothesis testing to the predictions of a set of models trained using randomly-selected starting conditions; importantly, selective ensembles can abstain in cases where a consistent outcome cannot be achieved up to a specified confidence level.
We prove that that prediction disagreement between selective ensembles is bounded, and empirically demonstrate that selective ensembles achieve consistent predictions and feature attributions while maintaining low abstention rates.
On several benchmark datasets, selective ensembles reach zero inconsistently predicted points, with abstention rates as low 1.5%.
I NTRODUCTION
Recent work has drawn attention to the fact that models that appear similar from aggregate quality measures, such as accuracy, often have markedly different behavior at the level of individual predictions (Black and
Fredrikson, 2021; Marx et al., 2019).
Further, in deep models, this inconsistency can arise even between closely-related models, such as those arising from different initializations, or from leave-one-out differences in the training data (Black and Fredrikson, 2021; D’Amour et al., 2020; Mehrer et al., 2020).
This behavior is undesirable in many high-stakes contexts, such as medical applications and credit-approving scenarios, as it may cast doubt on the justifiability of the model’s outcome and pose difficulties for reproducibility and comparison.
We begin by demonstrating that not only are the predictions of related deep models often dissimilar, but their feature attributions (Simonyan et al., 2014; Sundararajan et al., 2017; Leino et al., 2018) are as well (Section 3).
In particular, we show that there is little connection between a model’s gradients, which are the basis for many deep attribution methods, and the labels that it predicts—models with identical predictions can have arbitrarily different gradients almost everywhere (Theorem 3.1).
In practice, we show that this result occurs often on common datasets across closely-related models, leading to significant variation in attributions.
This may be undesirable, as feature attributions are commonly used to provide explanations (Simonyan et al., 2014; Sundararajan et al., 2017; Leino et al., 2018), debug model behavior (Adebayo et al., 2020), and diagnose problems related to privacy and fairness (Leino and Fredrikson, 2020; Datta et al., 2016).
Beyond these pragmatic concerns, this suggests that the salient factors behind these models’ predictions on many points may have little in common, even when models appear to do comparably well on test data.
To address inconsistency in both prediction and attribution, we then turn to ensembling, a well-known approach for reducing predictive variance (Meir et al., 1995; Naftaly et al., 1997; Lincoln and Skrzypek, 1990; Fumera et al., 2005; Hansen and Salamon, 1990; Krogh and Vedelsby, 1995).
We introduce selective ensembles , which leverage a recent result on multinomial rank verification (Hung et al.
, 2019)—which has also been used recently for making certifiably-robust predictions (Cohen et al., 2019)—to efficiently mitigate the problem of inconsistency with a probabilistic guarantee.
Given a point to classify, a selective ensemble returns the mode of the class labels predicted on that point, where the mode is sampled over models that vary according to a specified source of randomness in the training process.
Importantly, if the mode cannot be inferred with sufficient confidence, then the selective ensemble abstains from prediction.
This allows us to bound the probability that these ensembles do not return the true mode prediction (Theorem
1), and by extension, the rate of disagreement between selective ensembles (Corollary A.4).
In addition
, we show that this also bounds the variance component in the ensembles’ bias-variance error decomposition (Domingos, 2000)
(Corollary A.3), providing guidance on how to effectively use of them in practice.
Our experiments show that on seven benchmark datasets, selective ensembles of just ten models either agree on the entire test data across random differences in how their constituent models are trained, or abstain at reasonably low rates (1-5% in most cases; Section 5.1).
Additionally, we show that simple ensembling doubles the agreement of attributions on key metrics on average, and when the variance of the constituent models is high that selective ensembling further enhances this effect (Section 5.2).
In summary, our contributions are: (1) we show that beyond predictions, feature attributions are not consistent across seemingly inconsequential random choices during learning (Section 3); (2) we introduce selective ensembling , a learning method that guarantees bounded inconsistency in predictions, (Section 4); and (3) we demonstrate the effectiveness of this approach on seven datasets, showing that selective ensembles consistently predict all points across models trained with different random seeds or leave-one-out differences in their training data, while also achieving low abstention rates and higher feature attribution consistency.
N OTATION AND P RELIMINARIES
We assume a supervised classification setting, with data points ( x,y ) ∈
X × Y , drawn from data distribution,
D , where x represents a vector of features and y a response.
In order to capture the effects of arbitrary random events on a learned model—ranging from randomness during training to randomness in the data selection process—we generalize the standard concept of a learning rule to that of a learning pipeline .
Specifically, a learning pipeline, P , is a procedure that outputs a model, h : X → Y , taking as input a random state, S ∼S , containing all the information necessary for P to produce a model (including the architecture, training set, random coin flips used by the learning rule, etc.).
Intuitively, S represents a distribution over random events that might impact the learned model.
For example, S might capture randomness in sampling of the training set, or nondeterminism in the optimization process, e.g., the initialization of parameters, the order in which batches are processed, or the effects of dropout.
In our experiments, we model S to capture two specific types of random choices, namely (1) the initial parameters of the model, and (2) leave-one-out changes to the training data.
As the initial parameters of the model tend to be determined by a random seed, we will interchangeably refer to this as the selection of random seed.
More generally, both of these types of choices instantiate a broader class of choices that could be considered arbitrary , despite the fact that they may impact the predictions (Black and Fredrikson, 2021;
Marx et al., 2019; Mehrer et al., 2020)
(Section 5.1) and explanations (Section 5.2) of the resulting model.
I NSTABILITY OF F EATURE A TTRIBUTIONS IN D EEP M ODELS
Before we consider mitigating predictive inconsistency with ensembling, we first demonstrate that models’ inconsistency across random choices in training is exhibited not only through its predictions, but through its feature attributions as well.
Feature attributions refer to numeric scores generated for some set of a model’s features—most commonly the model’s input features—which are meant to connote how important each feature is in generating the model’s prediction.
Feature attributions are commonly used as a tool for explaining model behavior (Simonyan et al., 2014; Leino et al., 2018; Sundararajan et al., 2017; Adebayo et al., 2020) localized to given set of inputs.
Thus, inconsistent feature attributions between models suggest the models differ in the process by which they arrive at their predictions, even if the predictions are the same.
In deep models, many of the most popular attribution methods are based on the model’s gradients at or around a given point (Simonyan et al., 2014; Sundararajan et al., 2017).
Accordingly, we will focus on the stability of gradients, and show via analysis and experiment that they are not stable in conventional deep models.
First, we motivate our results by showing that even two deep models that predict the same labels on all points may have arbitrarily different gradients almost everywhere.
Later, in our empirical evaluation (Section 5.2), we demonstrate the extent of the differences between Saliency Maps (Simonyan et al., 2014) (i.e., input gradients) of deep networks even when the randomness of the learning pipeline is controlled to allow only one-point differences in the training set or differences in the random seed.
Predictions with Arbitrary Gradients.
We show that even deep models that predict the exact same labels on all points cannot necessarily be expected to have the same, or even similar, gradients; in fact, given a binary classification model h , we can construct a model ˆ h which predicts the same labels as h ,
H(x) =
H(x) =
ϵ g(x) h(x)
( h ( x ) >0)
( h ( x ) <0)
H(x) = ĥ(x)=g(x) – sup (g) – d ĥ(x)=g(x) – inf (g) + d Ĥ(x) = Ĥ(x) =
H(x)
=
( h ( x ) >0)
( ĥ ( x ) >0)
( h ( x ) <0)
( ĥ ( x ) <0) but has arbitrarily different gradients everywhere except an arbitrarily small region around the boundary of h (Theorem 3.1).
Theorem 3.1.
Let H : X → {− 1 , 1 } = sign( h ) be a binary classifier and g : R n → R be an unrelated function that is bounded from above and below, continuous, and piecewise differentiable.
Then there exists another binary classifier ˆ H =sign(ˆ h ) such that for any (cid:15)> 0 , ∀
[Equation]
The proof of Theorem 3.1 is given in Appendix A.1 in the supplementary material.
The proof is by construction of ˆ h ; a sketch giving the intuition behind the construction is provided in Figure 1.
In short, we first partition the domain into contiguous regions that are given the same label by H .
We then construct ˆ h from g by adjusting g to lie above or below the origin to match the prediction behavior of h in each region.
As these transformations merely shift g by a constant in each region, they do not change ∇ g except near decision boundaries, where it is necessary to move across the origin.
Observations.
The intuition stemming from Theorem 3.1 is that a model’s gradients at each point are largely disconnected from the labels it predicts on a distribution.
As models that make identical predictions are likely to have similar loss on a given dataset, this theorem points to the possibility that models of similar objective quality may still have arbitrarily different gradients.
In Section 5.2, we demonstrate that this outcome is not only possible , but that it occurs in real models—for example, on the German Credit dataset predicting credit risk, on average, individual models with similar accuracy agree on less than two out of the five most important features influencing their decision.
S ELECTIVE E NSEMBLING
The results of Section 3 suggests that models that are retrained and redeployed, may exhibit substantially different behavior from their previous iterations.
We build on the approach of ensembling for variance reduction by showing how these differences in behavior can be bounded via selective ensembling .
However, whereas prior work which finds that more diversity among the constituent networks is beneficial for reducing overall error (Krogh and Vedelsby, 1995; Hansen and Salamon, 1990; Maclin et al., 1995; Opitz and Shavlik, 1996), our goal is to minimize, or at least place strict bounds on, the variance component.
We show that ideas from robust classification, and in particular randomized smoothing (Cohen et al., 2019), which stem from recent results on multinomial hypothesis testing (Hung et al., 2019), can be used to enforce such a bound.
Mode Predictor.
We may view the image of the learning pipeline, P , as a distribution over possible models induced by applying P to the random state, S ∼S .
The mode prediction on an input x , with respect to S , is the expected label that would be predicted on x by models drawn from this distribution.
More formally, we define the mode predictor , g P , S for a pipeline, P , and random state distribution, S , as given by Equation
[Equation]
def train_ensemble( P , S ∼S n , n ) : return {P ( S i ) for i ∈ [ n ] } def sample_ensemble( P , S , n ) :
S ← sample _ iid ( S n ) return train_ensemble ( P , S, n )
def ensemble_predict
( ˆ g n ( P ,S ) , α, x ) :
Y ← (cid:80) h ∈
ˆ g n ( P ,S ) one _ hot ( h ( x ))
n A , n B ← top _ 2 ( Y ) if binom _ p _ value ( n A , n A + n B , 0 . 5) ≤ α thenreturn argmax ( Y ) else return ABSTAIN
Note that while g P , S is deterministic, and is therefore not sensitive to a specific state drawn from S , it does not necessarily produce the ground truth label on all inputs—some learning pipelines may converge to a stable loss minimum that misclassifies certain points.
Approximation via Ensembling.
An explicit representation of the true mode predictor is, of course, unattainable—the non-convex loss surface of deep models and the complex interactions between the learning pipeline and the distribution of random states makes the expectation in Equation 1 infeasible to compute analytically.
However, we can approximate g P , S ( x ) by computing the empirical mode prediction on x over a random sample of models produced by i.i.d.
draws from P ( S ) .
But although ensembles with sufficiently many constituent models will more reliably output the mode prediction, for any fixed-size ensemble there will remain points on which the margin of the plurality vote is small enough to “flip” to runner-up in some set of nearby ensembles that differ on a subset of their constituents; in other words, these ensembles will not predict the mode prediction.
To rigorously bound the rate at which the ensemble will differ from the mode prediction, we allow the ensemble to abstain on points where the constituent predictions indicate a statistical toss-up between the two most likely classes.
We call ensembles that may abstain in this way selective ensembles , borrowing the terminology from selective classification (El-Yaniv et al., 2010).
We can think of of abstention as a means of flagging unstable points on which the selective ensemble cannot accurately determine the mode prediction; whether this should be interpreted as a failed attempt at classification is an application-specific consideration.
Selective ensembles of n models predict according to the following procedure.
First, the predictions of each of the n models in the ensemble are collected.
The constituent models are derived from n i.i.d.
samples of P ( S ) from S , as described in Algorithm 1.
From these predictions, we perform a two-sided statistical test to determine if the mode prediction was selected by a statistically significant majority of the constituent models.
If the statistical test succeeds, we return the empirical mode prediction; otherwise we abstain from predicting.
Pseudocode for this prediction procedure is given in Algorithm 2.
We will denote by ˆ g n ( P ,S ) (for S ∼S n ) the output of train_ensemble in Algorithm 1, and by ˆ g n ( P ,S ; α,x ) prediction produced by ensemble_predict in Algorithm 2 on ˆ g n ( P ,S ) .
Because of their ability to abstain from prediction, we can prove that with probability at least 1 − α , a selective ensemble will either return the true mode prediction or abstain, where α is a chosen threshold for the statistical test to prevent prediction in the case of a toss-up.
In other words, on any point on which it does not abstain, a selective ensemble will disagree with the mode predictor, g P , S , with probability at most α , as stated formally in Theorem 4.1.
The statement of Theorem 4.1 make use of the relation, ABS (cid:54)
= , where y 1 ABS (cid:54) =
y
if and only if y 1 (cid:54) =
ABSTAIN and y 2 (cid:54) =
ABSTAIN and y 1 (cid:54) =
y 2 .
That is, ABS (cid:54) = captures disagreement between non-rejected predictions.
Theorem 4.1.
Let P be a learning pipeline, and let S be a distribution over random states.
Further, let g P , S be the mode predictor, let ˆ g n ( P ,S ) for S ∼S n be a selective ensemble, and let α ≥ 0 .
Then,
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
The proof (Appendix A) relies on a result from Hung and Fithian (Hung et al., 2019) which bounds the probability that a set of votes does not return the true plurality outcome, and we apply it in a similar fashion to how it is used for making robust predictions in Randomized Smoothing (Cohen et al., 2019).
Theorem 4.1 states that the probability that a selective ensemble makes a prediction that does not match the mode prediction is small.
However, one possible means of ensuring this is by not providing a prediction a b s t e n ti on ( ) =0.
=0.
1.0 c on s i s t e n c y ( 12 ) =0.
=0.
n
[Figure]
p ) in the first place, i.e., if the selective ensemble abstains.
Thus, the abstention rate is necessary to quantify the fraction of points on which the mode prediction will actually be produced.
In the 0-1 loss bias-variance decomposition of Domingos (2000), the variance component of a classifier’s loss is defined as the expected loss relative to the mode prediction (in our case, taken over the randomness in S ).
Thus, Theorem 4.1 leads to a direct bound on this component, assuming a bound, β , on the abstention rate.
This is formalized in Corollary A.3.
Corollary 4.2.
Let P be a learning pipeline, and let S be a distribution over random states.
Further, let g P , S be the mode predictor, let ˆ g n ( P ,S ) for S ∼S n be a selective ensemble.
Finally, let α ≥ 0 , and let β ≥ 0 be an upper bound on the expected abstention rate of ˆ g n ( P ,S ) .
Then, the expected loss variance ,
V ( x ) , over inputs, x , is bounded by α + β .
That is,
[Equation]
Consistency of Selective Ensembles.
Using the result from Theorem 4.1, we can also address the original problem raised: that deep models often disagree on their predictions due to arbitrary random events over the training pipeline.
We show that, given a bound, β , on the abstention rate, the probability that two selective ensembles disagree in their predictions is bounded by 2( α + β ) (Corollary A.4).
Intuitively, this suggests that the predictions of selective ensembles are more stable over different instantiations of the random decisions captured by S compared to individual models.
Corollary 4.3.
Let P be a learning pipeline, and let S be a distribution over random states.
Further, let ˆ g n ( P ,S ) for S ∼S n be a selective ensemble.
Finally, let α ≥ 0 , and let β ≥ 0 be an upper bound on the expected abstention rate of ˆ g n ( P ,S ) .
Then,
[Equation]
Corollary A.4 tells us that the agreement between any two selective ensembles is at least 1 − 2( α + β ) .
For a fixed n , decreasing α will lead to a higher abstention rate.
Thus in order for α and β to both be small, as would be necessary for a high fraction of consistently-predicted points, we may require a large number of constituent models, n .
Figure 2 illustrates the trade-off between α , β , and n , depending on the base level of agreement of the constituent models.
In Section 5, we show empirically that even with small values of n , abstention rates of selective ensembles are reasonably low in practice.
In summary, selective ensembles accomplish three primary things: (1) they identify points on which the mode prediction cannot be determined, (2) they bound the fraction of points that can be inconsistently predicted, and (3) they provide a means of reliably inferring the mode prediction when the abstention rate can be kept sufficiently low.
E VALUATION
In this section, we demonstrate empirically that selective ensembles reduce instability in deep model predictions far below their theoretical bounds—to zero inconsistent predictions in the test set over
[Table]
[Table] [Table]
[Figure]
pairwise comparisons of model predictions for each of tabular datasets, and 40 for image datasets.
Additionally, following Theorem 3.1, we show that feature attributions of individual deep models are frequently inconsistent, and that ensembling effectively mitigates this problem.
Setup.
To evaluate selective ensembling, we focus on two sources of randomness in the learning rule: (1) random initialization, and (2) leave-one-out changes to the training set.
Our experiments consider seven datasets: UCI German Credit, Adult, Taiwanese Credit Default, Seizure, all from Dua and Karra Taniskidou (2017); the IWPC Warfarin Dosing Recommendation (International Warfarin Pharmacogenetic Consortium, 2009), Fashion MNIST (Xiao et al., 2017), and Colorectal Histology (Kather et al., 2016a).
All of these datasets are either related to finance, credit approval, or medical diagnosis, except for FMNIST, which we include as it is a common benchmark for image classification.
Further details are in Appendix B.
All experiments are implemented in TensorFlow 2.3.
For each tabular, we train 500 models from independent samples of the relevant source of randomness (e.g. leave-one-out data variations or random seeds), and for each image dataset, we train 200 models from independent samples of each source of randomness.
Details about the model architecture and hyperparameters used are given in Appendix C.
Table 1 reports the mean accuracy for each dataset, along with the standard deviation.
For each non-image dataset we generate 24 random ensembles of size n ∈ { 5 , 10 , 15 , 20 } by selecting uniformly without replacement among the 500 pre-trained models, as well 24 “singleton” models drawn uniformly from the 500 to use as a point of comparison when measuring the stability of each ensemble.
For image datasets, we generate 10 random ensembles of each size among 200 pre-trained models.
We report ensemble predictions in the main paper using α =0 .
5. S ELECTIVE E NSEMBLES : P REDICTION S TABILITY AND A CCURACY
To measure prediction instability over either selective ensembles or singleton models, we compare the predictions of each pair of models on each point in the test set, amounting to 276 comparisons for tabular datasets, and 40 comparisons for image datasets, in total for each point, and record the rate of disagreement, p flip , across these comparisons.
We report mean and variance of this disagreement over 10 random re-samplings of constituent models to create ensemble models.
The results in Table 2 and Figure 3a show the percentage of points with disagreement rate greater than zero.
We see that for singleton models, as many as 57% of test points have p flip > 0 , indicating that disagreement in prediction is in some cases the norm rather than the exception, although more commonly this occurs on 5-10% of the data.
Notably, selective ensembles completely mitigate this effect: even when as few as ten models are included in the ensemble, no points experienced p flip > 0 .
Combined with the fact that abstention rates remain low (1-5%) in all cases except where p flip was originally very high (e.g., German
Credit), this shows that selective ensembling can be a practical method for mitigating prediction instability.
Table 3 shows the accuracy of selective ensembles, with abstention counted towards error, as well as accuracy of non-selective ensembles for comparison.
Notably, in all six models, with the exception of
German Credit, the abstention rate drops to below 4% with 20 models in the ensemble.
Accordingly, the accuracy of the selective ensembles in these cases is comparable—typically within a few points—to that of the traditional ensemble.
However, with just five models in the ensemble, the abstention rate is 100%; to achieve reasonable predictions with very few models, the threshold α needs to be increased accordingly.
Disagreement of non-selective ensembles are pictured in Figure 3a (with exact numbers in Appendix F): while they do lower prediction inconsistency, they are unable to eliminate it as selective ensembles do.
5. A TTRIBUTION S TABILITY
Following up on the theoretical result given in Theorem 3.1, we demonstrate that feature attributions, which are usually computed for deep models using gradients (Simonyan et al., 2014; Sundararajan et al., 2017;
Leino et al., 2018), are often inconsistent between similar models.
We then show that, just as ensembling increases prediction stability, it also mitigates gradient instability, leading to more consistent attributions across models.
For these experiments, we computed attributions using saliency maps (Simonyan et al., 2014), which are simply the gradient of the model’s prediction with respect to its input, as a simple and widely-used representative of gradient-based attribution methods.
[Table]
The baseline numbers are presented as similarity baseline we also report the Structural Similarity Index (SSIM).
Standard deviations are included in Appendix
Metrics.
Following previous work (Dombrowski et al., 2019; Ghorbani et al., 2019), we measure the similarity between attributions using Spearman’s Ranking Correlation ( ρ ) and the top- k intersection, with k =5 .
For image datasets, we also display the Structural similarity metric (SSIM), discussed further in Appendix D.1.
Spearman’s ρ is a natural choice of metric as attributions induce an order of importance among features.
We note that the top- k intersection is especially interesting in tabular datasets, as often only the most important features are of explanatory interest.
To stay consistent with prior work, we also include Pearson’s
Correlation Coefficient ( r ).
Note that r and ρ vary from -1 to 1, denoting negative, zero, and positive correlation.
We compute these metrics over 276 pairwise comparisons of attributions for each size of ensemble (1, 5, 10, 15, and 20) for tabular datasets, and 40 pairwise comparisons for image datasets.
For the top- k metric, we report the mean size of the intersection between each pair of attributions.
More details are in Appendix D.
Baselines.
To contextualize the difference of attributions across models trained from distinct randomness, we also include the attribution similarity between 24 randomly chosen points in the same model (Table 4).
We also present a visual comparison of model attributions, for which we simply plot the attribution for the predicted class for a given point from nine randomly selected models out of the 24, and present the feature attributions in order of their magnitude according to another randomly selected model (Figure 4).
Singleton Models
The left image in Figure 4 demonstrates the inconsistency of model attributions of individual German Credit models on a random point in the test set.
Each bar on the x-axis represents the attributions for a feature, and each different-colored bar represents a different randomly selected model.
Thus, the disagreement between the sizes of the bars of different colors shows the disagreement between models on which features should be deemed important.
Notably, some of the bars on the graph depicting individual models even have different signs, which means that models disagree on whether that feature counts towards or against the same prediction.
Similar graphs for all other datasets are included in Appendix H.1.
We demonstrate this inconsistency further in Table 4.
We see that German Credit and Seizure models have particularly unstable attributions, as the top- k (and to a lesser extent, ρ and r ) scores of attributions of varying points in both the same model, and varying models on the same point , are quite similar.
Feature attributions of individual models are inconsistent even on highly weighted features: e.g., German Credit dataset has a top- k intersection of just over one attribute on average—suggesting that attributions generated through saliency maps on these sets of models may vary substantially over benign retrainings.
Even on models where the metrics are higher, e.g. Taiwanese Credit, the baseline similarity between attributions is higher as well—thus, we see that attributions between models of the same point are usually only 2-3 × more related than those of random points within the same model .
This instability suggests that salient variables used to inform predictions across models are sensitive to random choices made during training.
As previous work has argued in similar contexts (D’Amour et al., 2020), this may be a result of a deep model’s under-constrained search space with many local optima equivalent with respect to loss, with several minima corresponding to distinct rationales for making predictions.
Ensemble Models.
We demonstrate that the similarity between saliency maps of ensembled models is greater than that of individual models, and that this similarity increases linearly with the number of models in the ensemble.
For these experiments, we average each model’s attributions toward the majority predicted class of the ensemble.
On the right side of Figure 4, we see the feature attributions of various ensemble models of size 15 over the German Credit dataset.
Note how the attributions of ensemble models are much more consistent than on the individual model.
We show this phenomenon more broadly in Figure 3b, where we display graphs of average Spearman’s
Rank Coefficient ( ρ ) (y-axis) between saliency maps on a point in the test set.
We see ρ increase as we increase the number of models in the ensemble (x-axis), for models generated over different random initializations and one-point differences in the training set.
Selective ensembles can further increase stability of explanations by abstaining from unstable points, and this has a marked effect when the abstention rate is high (e.g. German Credit).
Similar graphs for the rest of metrics calculated are presented in Appendix H.
R ELATED W ORK
Prior work has shown that deep models are inconsistent in their predictions across arbitrary random changes in their training pipeline, such as initialization parameters and makeup of the training set (Black and Fredrikson, 2021;
Mehrer et al., 2020; D’Amour et al., 2020; Kolen and Pollack, 1991; Feldman, 2019).
The problem of model sensitivity, particularly to variability in the training set, can lead to an increase generalization error (Elisseeff et al., 2003) as well as to leaking training set information (Dwork, 2006;
Yeom et al., 2018).
Thus, stability-enhancing learning rules have received significant attention in order to bolster desirable properties, such as privacy (Liu et al., 2020;
Papernot et al., 2018; Wang et al., 2016).
One such approach is model ensembling, which has been used as a variance reduction method since the advent of statistical learning (Zhou et al., 2002;
Valentini et al., 2004; Opitz and Maclin, 1999; Tumer and
Ghosh, 1996; Dvornik et al., 2019; Hasan et al., 2020; Freund and Schapire, 1997; Sagi and Rokach, 2018;
Polikar, 2012; Che et al., 2011; Perrone and Cooper, 1992; Hansen and Salamon, 1990).
However, to our knowledge, there is little work on providing guarantees about model disagreement using ensemble models that may abstain from prediction.
We relate our approach to the classic bias-variance decomposition of error (Domingos, 2000), showing that it certifiably bounds the variance component.
Selective ensembles can be seen as a way to flag points that prone to inconsistency.
Under this view, calibration and uncertainty estimation of deep model predictions (Lakshminarayanan et al., 2016; Ovadia et al., 2019) is a related stream of work, and one could potentially use these techniques to determine when to abstain from prediction.
However, preventing inconsistent predictions and abstaining from uncertain predictions are different goals: in our setting, the aim is to predict the mode across models drawn from a certain distribution, whereas calibration is measured against predicting the true label.
Moreover, prior work has shown that confidence scores may not be correlated with prediction consistency across models with different random initializations (Black and Fredrikson, 2021).
Finally, while abstaining on points with low confidence scores may lead to greater consistency, it may not yield a guarantee, which this work provides.
Conformal inference (Linusson et al., 2020; Gupta et al., 2019; Löfström et al., 2013), which rigorously assigns confidence to predictions in settings where the data may differ from training, is similarly related in that such a measure could be useful in identifying inconsistently predicted points.
However, in this work, we aim to achieve consistent predictions across a known distribution of models, as prior work, as well as our results, suggest, even points conforming to past observations may still be predicted differently by different models.
In addition to inconsistent predictions, this work demonstrates how feature attributions can differ substantially between individual deep models with inconsequential differences.
Prior works investigating instability of gradient-based explanation techniques focus on an adversarial context (Dombrowski et al., 2019; Ghorbani et al., 2019; Heo et al., 2019; Wang et al., 2020).
For example, Anders et al.
(2020) develop attacks to create similar models that have differing gradient-based explanations.
Contrastingly, this work focuses on the instability of counterfactual explanations between similar models that may occur naturally.
As we demonstrate in Section 5.2, model gradients can be quite dissimilar without any adversary.
C ONCLUSION
We show that similar deep models can have not only inconsistent predictions, but substantially different gradients as well.
We introduce selective ensembles to mitigate this problem by bounding a model’s inconsistency over random choices made during training.
Empirically, we show that selective ensembles predict all points consistently over all datasets we studied.
Selective ensembling may present a more reliable way of using deep models in settings where high model complexity and stability are required.
A P ROOFS A. P ROOF OF T HEOREM 3.
Theorem 3.1.
Let H : X → {− 1 , 1 } = sign( h ) be a binary classifier and g :
X → R be an unrelated function that is bounded from above and below, continuous, and piecewise differentiable.
Then there exists another binary classifier ˆ H =sign(ˆ h ) such that for any (cid:15)> 0 , ∀
[Equation]
Proof.
We partition X into regions { I 1 ....
I k } determined by the decision boundaries of H .
That is, each
I i represents a maximal contiguous region for which each x ∈
I i receives the same label from H .
Recall we are given a function g : X → R which is bounded from above and below.
We create a set of functions
ˆ g I i : I i
→ R such that
[Equation]
where c is some small constant greater than zero.
Additionally, let d ( x ) be the (cid:96) 2 distance from x to the nearest decision boundary of h , i.e. d ( x )=
inf x (cid:48) : H ( x (cid:48) )
(cid:54) =
H ( x ) (cid:110) ||
x − x (cid:48)
|| (cid:111) .
Then, we define ˆ h to be:
[Equation]
And, as described above, we define ˆ H = sign (ˆ h ) .
First, we show that
ˆ H ( x )=
H ( x ) ∀ x ∈ X .
Without loss of generality, consider some I i where H ( x )=1 , for any x ∈ I i .
We first consider the case where d ( x ) > (cid:15) 2 .
By construction, for x ∈ I i , ˆ H ( x )= sign (ˆ h ( x ))
=
sign (ˆ g I i ( x ))
=
sign ( g ( x ) − inf x g ( x )+ c ) .
By definition of the infimum, g ( x ) − inf x g ( x ) ≥ 0 , and thus sign ( g ( x ) − inf x g ( x )+ c )=1 , so ˆ H ( x )=
1= H ( x ) .
Note that in the case where d ( x ) ≤ (cid:15) 2 , we can follow the same argument as multiplication by a positive constant does not affect the sign.
A symmetric argument follows for the case where for x ∈
I
i , H ( x )= − 1 ; thus, ˆ H ( x )=
H ( x ) ∀ x ∈ X .
Secondly, we show that ∇ ˆ h ( x )=
∇ g ( x ) ∀ x where d ( x ) > (cid:15) 2 .
Consider the case where H ( x )=1 .
By construction, ˆ h ( x )
=
ˆ g
I i ( x )=
g ( x ) − inf x g ( x )+ c .
Note that this means the infimum and c are constants, so their gradients are zero.
Thus, ∇ ˆ h ( x ) = ∇ g ( x ) .
A symmetric argument holds for the case where
H ( x )= − 1 .
It remains to prove that ˆ h is continuous and piecewise differentiable, in order to be a realizable as a ReLU-network.
By assumption, g is piecewise differentiable, which means that ˆ g i are piecewise differentiable as well, as is ˆ g i ( x ) · d ( x ) (cid:15) .
Thus, ˆ h is piecewise-differentiable.
To see that ˆ h is continuous, consider the case where d ( x )=
(cid:15) / 2 for some x .
Then ˆ g i ( x ) · d ( x ) (cid:15) =
ˆ g i ( x ) · (cid:15)(cid:15)
=
ˆ g i ( x ) .
Additionally, consider the case where d ( x ) = 0 , i.e. x is on a decision boundary of h ( x ) , between two regions
I i ,I j .
Then ˆ h ( x )=
ˆ g i ( x ) · d ( x ) (cid:15) =
ˆ g i ( x ) · 0=0= ˆ g j ( x ) · 0=
ˆ g j ( x ) .
This shows that the piecewise components of ˆ h come to the same value at their intersection.
Further, each piecewise component of ˆ h is equal to some continuous function, as g ( x ) is continuous by assumption.
Thus, ˆ h is continuous, and we conclude our proof.
We include a visual intuition of the proof in Figure 5.
A. P ROOF OF T HEOREM 4.
Theorem 4.1.
Let P be a learning pipeline, and let S be a distribution over random states.
Further, let g P , S be the mode predictor, let ˆ g n ( P ,S ) for S ∼S n be a selective ensemble, and let α ≥ 0 .
Then,
[Equation]
Proof.
ˆ g n ( P ,S ) is an ensemble of n models.
By the definition of Algorithm 2, ˆ g n ( P ,S ) gathers a vector of class counts of the prediction for x from each model in the ensemble.
Let the class with the highest count be c A , with counts n A , and the class with the second highest count be called c B , with counts n B .
ˆ g n ( P ,S ) runs a two-sided hypothesis test to ensure that Pr[ n A ∼ Binomial ( n A + n B , 0 . 5)] <
α , i
[Equation]
e. that c
A is the true mode prediction over S .
See that
[Equation]
By Hung et al.
[Equation] [Equation]
Thus,
[Equation]
A. P ROOF OF C OROLLARY 4.
Corollary 4.2.
Let P be a learning pipeline, and let S be a distribution over random states.
Further, let g P , S be the mode predictor, let ˆ g n ( P ,S ) for S ∼S n be a selective ensemble.
Finally, let α ≥ 0 , and let β ≥ 0 be an upper bound on the expected abstention rate of ˆ g n ( P ,S ) .
Then, the expected loss variance ,
V ( x ) , over inputs, x , is bounded by α + β .
That is,
[Equation]
Proof.
Since g P , S never abstains
[Equation]
we have by the law of total probability that
Pr S ∼S n
[Equation]
By Theorem 4.1, we have that Pr S ∼S n (cid:2) ˆ g n ( P ,S ; α,x ) ABS (cid:54) =
g P , S ( x ) (cid:3) ≤ α , thus
[Equation]
Finally, since β is an upper bound on the expected abstention rate of ˆ g n ( P ,S ) , we conclude that
[Equation]
A. P ROOF OF C OROLLARY 4.
Corollary 4.3.
Let P be a learning pipeline, and let S be a distribution over random states.
Further, let ˆ g n ( P ,S ) for S ∼S n be a selective ensemble.
Finally, let α ≥ 0 , and let β ≥ 0 be an upper bound on the expected abstention rate of ˆ g n ( P ,S ) .
Then,
[Equation]
Proof.
For i ∈ { 1 , 2 } , let A i be the event that ˆ g n ( P ,S i ; α,x ) =
ABSTAIN , and let N i be the event that ˆ g n ( P ,S i ; α,x ) ABS (cid:54) =
g P , S .
In the worst case, A 1 and A 2 , and N 1 and N 2 are disjoint, that is, e.g., if ˆ g n ( P ,S i ) abstains on x , then ˆ g n ( P ,S 1 ; α,x ) (cid:54) =
ˆ g n ( P ,S 2 ; α,x ) .
In other words, we have that
Pr
[Equation]
1 ,S 2 ∼S n
[Equation]
which, by union bound implies that
[Equation]
By Theorem 4.1 Pr (cid:2) N i (cid:3) ≤ α .
Thus we have
[Equation]
Finally, since β is an upper bound on the expected abstention rate of ˆ g n ( P ,S ) , we conclude that
[Equation]
B D ATASETS
The German Credit and Taiwanese data sets consist of individuals financial data, with a binary response indicating their creditworthiness.
For the German Credit dataset, there are 1000 points, and 20 attributes.
We one-hot encode the data to get 61 features, and standardize the data to zero mean and unit variance using SKLearn Standard scaler.
We partitioned the data intro a training set of 700 and a test set of 200.
The Taiwanese credit dataset has 30,000 instances with 24 attributes.
We one-hot encode the data to get 32 features and normalize the data to be between zero and one.
We partitioned the data intro a training set of 22500 and a test set of 7500.
The Adult dataset consists of a subset of publicly-available US Census data, binary response indicating annual income of > 50 k. There are 14 attributes, which we one-hot encode to get 96 features.
We normalize the numerical features to have values between 0 and 1 .
After removing instances with missing values, there are 30 , 162 examples which we split into a training set of 14891, a leave one out set of 100, and a test set of 1501 examples.
The Seizure dataset comprises time-series EEG recordings for 500 individuals, with a binary response indicating the occurrence of a seizure.
This is represented as 11500 rows with 178 features each.
We split this into 7,950 train points and 3,550 test points.
We standardize the numeric features to zero mean and unit variance.
The Warfain dataset is collected by the International Warfarin Pharmacogenetics Consortium (International
Warfarin Pharmacogenetic Consortium, 2009) about patients who were prescribed warfarin.
We removed rows with missing values, 4819 patients remained in the dataset.
The inputs to the model are demographic (age, height, weight, race), medical (use of amiodarone, use of enzyme inducer), and genetic (VKORC1,
CYP2C9) attributes.
Age, height, and weight are real-valued and were scaled to zero mean and unit variance.
The medical attributes take binary values, and the remaining attributes were one-hot encoded.
The output is the weekly dose of warfarin in milligrams, which we encode as "low", "medium", or "high", following the recommendations set by International Warfarin Pharmacogenetic Consortium (2009).
Fashion MNIST contains images of clothing items, with a multilabel response of 10 classes.
There are 60000 training examples and 10000 test examples.
We pre-process the data by normalizing the numerical values in the image array to be between 0 and 1 .
The colorectal histology dataset contains images of human colorectal cancer, with a multilabel response of 8 classes.
There are 5,000 images, which we divide into a training set of 3750 and a validation set of 1250.
We pre-process the data by normalizing the numerical values in the image array to be between 0 and 1 .
The UCI datasets as well as FMNIST are under an MIT license, the colorectal histology and Warfarin datasets are under a Creative Commons License.
(Dua and Karra Taniskidou, 2017; Kather et al., 2016b;
International Warfarin Pharmacogenetic Consortium, 2009).
C M ODEL A RCHITECTURE AND H YPER -P ARAMETERS
The German Credit and Seizure models have three hidden layers, of size 128, 64, and 16.
Models on the Adult dataset have one hidden layer of 200 neurons.
Models on the Taiwanese dataset have two hidden layers of 32 and 16.
The Warfarin models have one hidden layer of 100.
The FMNIST model is a modified LeNet architecture (LeCun et al., 1995).
This model is trained with dropout.
The Colon models are trained with a modified, ResNet50 (He et al., 2016), pre-trained on ImageNet (Deng et al., 2009), available from Keras.
German Credit, Adult, Seizure, Taiwanese, and Warfarin models are trained for 100 epochs; FMNIST for 50, and Colon models are trained for 20 epochs.
German Credit models are trained with a batch size of 32; FMNIST 64; Adult, Seizure, and Warfarin models with batch sizes of 128; and Colon and Taiwanese Credit models with batch sizes of 512.
German Credit, Adult, Seizure,
Taiwanese Credit, Warfarin, and Colon are trained with keras’ Adam optimizer with the default parameters.
FMNIST models are trained with keras’ SGD optimizer with the default parameters.
Note that we discuss train-test splits and data preprocessing above in Section B.
We prepare different models for the same dataset using Tensorflow 2.3.0 and all computations are done using a Titan RTX accelerator on a machine with 64 gigabytes of memory.
D M ETRICS
We report similarity between feature attributions with Spearman’s Ranking Correlation ( ρ ), Pearson’s
Correlation Coefficient ( r ), top- k intersection, (cid:96) 2 distance, and SSIM for image datasets.
We use standard implementations for Spearman’s Ranking Correlation ( ρ ) and Pearson’s Correlation Coefficient ( r ) from scipy, and implement (cid:96) 2 distance as well as the top- k using numpy functions.
Note that r and ρ vary from -1 to 1, denoting negative, zero, and positive correlation.
We display top-
k for k =5, and compute this by taking the number of features in the intersection of the top 5 between two models, and then diving this by 5 .
Thus top- k is between 0 and 1, indicating low and high correlation respectively.
The (cid:96) 2 distance has a minimum of 0 , but is unbounded from above, and SSIM varies from -1 to 1, indicating no correlation to exact correlation respectively.
[Table]
Note that we compute these metrics between two different models on the same point, for every point in the test set, over 276 different pairs of models for tabular datasets and over 40 pairs of models for image datasets.
We average this result over the points in the test set and over the comparisons to get the numbers displayed in the tables and graphs throughout the paper.
D. SSIM
Explanations for image models can be interpreted as an image (as there is an attribution for each pixel), and are often evaluated visually (Leino et al., 2018; Simonyan et al., 2014; Sundararajan et al., 2017).
However, pixel-wise indicators for similarity between images (such as top-k similarity between pixel values, Spearman’s ranking coefficient, or mean squared error) often do not capture how similar images are visually, in aggregate.
In order to give an indication if the entire explanation for an image model, i.e. the explanatory image produced, is similar, we use the structural similarity index (SSIM)
(Wang et al., 2004).
We use the implementation from scikit − image (str).
SSIM varies from -1 to 1, indicating no correlation to exact correlation respectively.
E E XPERIMENTAL R ESULTS FOR α =0 .
We include results on the prediction of selective ensemble models for α =0 .
01 as well.
We include the percentage of points with disagreement between at least one pair of models ( p flip > 0 ) trained with different random seeds (RS) or leave-one-out differences in training data, for singleton models ( n =1 ) and selective ensembles ( n> 1 ) in Table 5.
Notice the number of points with p flip > 0 is again zero.
We also include the mean and standard deviation of accuracy and abstention rate for α =0 .
01 in Table 6.
F S ELECTIVE E NSEMBLING F ULL R ESULTS
We include the full results from the evaluation section, including error bars on the disagreement, accuracy, abstention rates of selective ensembles, in Table 7 and Table 8 respectively.
We also include the results for all datasets on the accuracy of non-selective ensembling and their ability to mitigate disagreement, in Table 7 and Table 6 respectively.
G S ELECTIVE E NSEMBLES AND D ISPARITY IN S ELECTIVE P REDICTION
In light of the fact that prior work has brought to light the possibility of selective prediction exacerbating model accuracy disparity between demographic groups Jones et al.
(2020), we present the selective ensemble accuracy and abstention rate group-by-group for several different demographic groups across four datasets: Adult, German Credit, Taiwanese Credit, and Warfarin Dosing.
Results are in Table 9.
H
E XPLANATION
C ONSISTENCY F ULL R ESULTS
We give full results for selective and non-selective ensembling’s mitigation of inconsistency in feature attributions.
[Table] [Table]
[Table] [Table]
LOO
[Table]
LOO
[Table]
LOO
[Table]
[Table]
[Table]
[Table] [Table] [Table]
[Table] [Table]
[Table]
[Table]
LOO
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
LOO .
[Table]
[Table] [Table]
[Figure]
[Table]
H. A TTRIBUTIONS
We pictorially show the inconsistency of individual model feature attributions versus the consistency of attributions ensembles of 15 for each tabular dataset in Figure 8 and Figure 9.
The former shows inconsistency over differences in random initialization, the latter shows inconsistency over one-point changes to the training set.
H. S IMILARITY M ETRICS OF A TTRIBUTIONS
We display how Spearman’s ranking coefficient ( ρ ), Pearson’s Correlation Coefficient ( r ), top-5 intersection and (cid:96) 2 distance between feature attributions over the same point become more and more similar with increasing numbers of ensemble models.
While the comparisons to generate the similarity score is between two models on the same point, the result is averaged over this comparison for the entire test set.
We average this over 276 comparisons between different models.
In cases were abstention is high, indicating inconsistency on the dataset for the training pipeline, selective ensembling can further improve stability of attributions by not considering unstable points (see e.g. German Credit).
We present the expanded results from the main paper, for all datasets, on all four metrics (as SSIM is only computed for image datasets, and ρ is not computed for image datasets).
We display error bars indicating standard deviation over the 276 comparisons between two models for tabular datasets, and 40 comparisons for image datasets.
I
I NTUITION
B EHIND E NSEMBLE G RADIENT C ONSISTENCY
In section 4, we demonstrated how prediction inconsistency can be provably bounded in selective ensembles.
Section 5.2 showed that ensembling also improves the consistency of the gradients ; we now provide some theoretical insight as to why this is the case.
[Table]
At a high level we argue that by taking the average gradient (of the mode prediction, w.r.t.
the input) we reduce the variance in the ensemble gradient, stabilizing it towards the expected gradient over the distribution S .
While it is difficult to exactly characterize the distribution over gradients, we provide a formalized intuition by making some simplifying assumptions about this distribution.
We model the variations in gradients from model to model as a Gaussian (i.e., the gradient of each model deviates from the expected gradient by some Gaussian noise).
Formally, let f = P ( S ) be a model produced by the pipeline on some random state, S , and let ˆ ∇ f ( x )=
E S ∼S [ ∇ f ( x )] be the expected gradient over
S .
We will assume that ∇ f ( x ) , the gradient of a particular model produced by the pipeline, is given by ˆ ∇ f ( x )+ η , where η ∼N (0 ,σ 2 ) .
Under this assumption, the fact that the gradient is stabilized by ensembling follows from the fact that the variance of the sample mean is smaller than the population variance.
Specifically, the variance of the sample mean of the gradient with n samples is σ 2 / n , which tends towards 0 as n increases (Equation 6).
[Equation]
The metrics we measure for gradient consistency are not based on variance of the gradient (which
Equation 6 shows is reduced by ensembling), but rather ranking of features according to their gradients.
To relate this to variance we can argue the following: first, let us take, for example, the top-ranked feature (the feature with the largest positive gradient).
Assuming the expected gradient is not degenerate (in our case this means there is a unique top-ranked feature), we can consider the gap between the average gradient of the top-ranked feature, i , and the second-ranked feature, j .
When the variance in the ensemble gradient is reduced sufficiently relative to this gap, it will be unlikely that this order will be switched.
Specifically, let ˆ δ =
ˆ ∇ i f ( x ) − ˆ ∇ j f ( x ) be the gap between the average gradient of the top-ranked feature and the second-ranked feature, and let δ ( n )= 1 n (cid:80) ni
=1 ∇ i f ( x ) −∇ j f ( x ) be the gap between the gradient of the same features on an ensemble of n models produced by the pipeline.
Note that the ordering between features i and j is preserved provided that δ ( S ) > 0 .
We can quantify the probability that this ordering is preserved according to Equation 7.
Pr
[Equation]
where η i ∼N (cid:18) [Equation] i
[Equation]
( x
[Equation]
2 n (cid:19) and η j ∼N (cid:18) ˆ ∇ j f ( x ) ,σ 2 n (cid:19) =
Pr [ δ ( n ) >η ij ] where η ij ∼N (cid:18) 0 , 2 σn (cid:19)
[Equation]
The same argument holds for other pairs of features.
[Figure]
Credit Dataset
Figure b depicts Adult
Figure
J A CCURACY R EJECTION C URVES
Figure 11 shows plots of accuracy-rejection curves Nadeem et al.
(2009) for selective ensembles of sizes 5, 10, and 20.
Rejection rates were controlled by varying α from 1 to 0.
In accordance with the convention of Nadeem et al.
, we count the accuracy as 1.0 when the model abstains on all points.
The plots indicate that accuracy remained relatively high even with low abstention rates and did not increase substantially when more points were rejected, signifying that there was not a strong trade-off between accuracy and rejection.
This is desirable because we clearly prefer to have a low rejection rate; meanwhile,
[Figure]
Figure a depicts the German Credit Dataset, Figure b depicts Adult, Figure c
Seizure, Figure d Taiwanese, and Figure e Warfarin.
We do not include feature attribution for image datasets as the individual pixels are less meaningful than the feature attributions in a tabular dataset.
the purpose of abstention is to guarantee consistency, so we do not expect abstention to have a strong effect on accuracy.
Furthermore, low rejection rates correspond to more consistent predictions.
Finally, we note that rejection rates are kept low even for small values of α by increasing the size of the ensemble.
[Figure]
w a r a f i n
[Figure]
t a i w a n e s
[Figure]