SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Hitesh Sapkota Dingrong Wang Zhiqiang Tao Qi Yu\*
{hxs1943, dw7445, zhiqiang.tao, qi.yu}@rit.edu
The recently developed sparse network training methods, such as Lottery Ticket Hypothesis (LTH) and its variants, have shown impressive learning capacity by finding sparse sub-networks from a dense one. While these methods could largely sparsify deep networks, they generally focus more on realizing comparable accuracy to dense counterparts yet neglect network calibration. However, how to achieve calibrated network predictions lies at the core of improving model reliability, especially when it comes to addressing the overconfident issue and out-of-distribution cases. In this study, we propose a novel Distributionally Robust Optimization (DRO) framework to achieve an ensemble of lottery tickets towards calibrated network sparsification. Specifically, the proposed DRO ensemble aims to learn multiple diverse and complementary sparse sub-networks (tickets) with the guidance of uncertainty sets, which encourage tickets to gradually capture different data distributions from easy to hard and naturally complement each other. We theoretically justify the strong calibration performance by showing how the proposed robust training process guarantees to lower the confidence of incorrect predictions. Extensive experimental results on several benchmarks show that our proposed lottery ticket ensemble leads to a clear calibration improvement without sacrificing accuracy and burdening inference costs. Furthermore, experiments on OOD datasets demonstrate the robustness of our approach in the open-set environment.
While there is remarkable progress in developing deep neural networks with densely connected layers, most of these dense networks have poor calibration performance [9], limiting their applicability in safety-critical domains like self-driving cars [4] and medical diagnosis [11]. The poor calibration is mainly due to the fact that there exists a good number of wrongly classified data samples (i.e., low accuracy) with high confidence resulting from the memorization effect introduced by an overparameterized architecture [27]. Recent sparse network training methods, such as Lottery Ticket Hypothesis (LTH) [6] and its variants [3, 2, 38, 18, 16, 35] generally assume that there exists a sparse sub-network (i.e., lottery ticket) in a randomly initialized dense network, which could be trained in isolation and also match the performance of its dense counterpart network in terms of accuracy. While these methods may, to some extent, alleviate the overconfident issue, most of them require pre-training of a dense network followed by multi-step iterative pruning, making the overall training process highly costly, especially for large dense networks. Even for techniques that do not rely on pre-training and iterative pruning (e.g., Edge Popup or EP [25]), their learning goal focuses on pushing the accuracy up to the original dense networks and hence may still exhibit a severely over-fitting behavior, leading to a poor calibration performance as demonstrated in Figure 1 (b).
Inspired by the recent success of using ensembles to estimate uncertainties [13, 34], a potential solution to realize well-calibrated predictions would be training multiple sparse sub-networks and
(a) Dense network
(b) EP sparse sub-network
(c) EP Sparse sub-network
(d) EP network ensemble
(e) Sparse sub-network 1
(f) Sparse sub-network 2
(g) Sparse sub-network 3
Figure 1: Calibration performance by expected calibration error (ECE) on Cifar100 dataset with ResNet101 architecture with density  $\mathcal{K} = 15\%$ . EP refers to the Edge Popup algorithm [25].
(h) DRO ensemble of (e-g)
building an ensemble from them. As such, by leveraging accurate uncertainty quantification, the ensemble is expected to achieve better calibration. However, existing ensemble models of sparse networks rely on pre-training and iterative fine-tuning for learning each sub-network [18, 35], leading to a significant overhead for building the entire ensemble. Furthermore, an ensemble of independently trained sparse sub-networks does not necessarily improve the calibration performance. Since these networks are trained in a similar fashion from the same training data distribution, they could be strongly correlated such that the ensemble model will potentially inherit the overfitting behavior of each sub-network as shown in Figure 1(c). Therefore, the calibration capacity of sparse sub-network ensemble can be compromised as shown empirically in Figure 1 (d).
To further enhance the calibration of the ensemble, it is critical to ensure sufficient diversity among sparse sub-networks so that they are able to complement each other. One natural way to achieve diversity is to allow each sparse sub-network (ticket) to primarily focus on a specific part of training data distribution. This inspires us to leverage the AdaBoost [28] framework that sequentially finds tickets by manipulating training data distribution based on errors. By this means, the AdaBoost facilitates the training for a sequence of complementary sparse sub-networks. However, the empirical analysis (see Table 1) reveals that in the AdaBoost ensemble, most sub-networks (except for the first one) severely under-fit data leading to poor generalization ability. This is mainly because of the overfitting behavior of the first sub-network, which assigns very low training losses to the majority of data samples, making the subsequent sub-networks concentrate on very rare difficult samples that are likely to be outliers or noises. Hence, directly learning from these difficult samples without having global knowledge of the entire training distribution will result in the failure of subsequent training tickets and also hurt the overall calibration.
To this end, we need a more robust learning process for proper training of complementary sparse subnetworks, each of which can be learned in an efficient way to ensure the cost-effective construction of the entire ensemble. We propose a Distributionally Robust Optimization (DRO) framework to schedule learning an ensemble of lottery tickets (sparse sub-networks) with complimentary calibration behaviors that contribute to an overall well-calibrated ensemble as shown in Figure 1 (e-h). Our technique directly searches sparse sub-networks in a randomly initialized dense network without pre-training or iterative pruning. Unlike the AdaBoost ensemble, the proposed ensemble ticket method starts from the original training distribution and eventually allows learning each sub-network from different parts of the training distribution to enrich diversity. This is also fundamentally different from existing sparse ensemble models [18, 35], which attempt to obtain diverse sub-networks in a heuristic way by relying on different learning rates. As a result, these models offer no guaranteed complementary behavior among sparse sub-networks to cover a different part of training data, which is essential to alleviate the overfitting behavior of the learned sparse sub-networks. In contrast, we realize a principled scheduling process by changing the uncertainty set of DRO, where a small set pushes sub-networks learning with easy data samples and a large set focuses on the difficult ones (see Figure 2). By this means, the ticket ensemble governed by our DRO framework could work complementary and lead to much better calibration ability as demonstrated in Figure 1(h). On the one hand, we hypothesize that the ticket found with easy data samples will tend to be learned and
overfitted easily, resulting in overconfident predictions (Figure 1(e)). On the other hand, the ticket focused on more difficult data samples will be less likely to overfit and may become conservative and give under-confident predictions. Thus, it is natural to form an ensemble of such lottery tickets to complement each other in making calibrated predictions. As demonstrated in Figure 1 (h), owing to the diversity in the sparse sub-networks (e-g), the DRO ensemble exhibits better calibration ability. It is also worth noting that under the DRO framework, our sparse sub-networks already improve the calibration ability as shown in Figure 1 (f-g), which is further confirmed by our theoretical results.
Experiments conducted on three benchmark datasets demonstrate the effectiveness of our proposed technique compared to sparse counterparts and dense networks. Furthermore, we show through the experimentation that because of the better calibration, our model is being able to perform well on the distributionally shifted datasets [6] (CIFAR10-C and CIFAR100-C). The experiments also demonstrate that our proposed DRO ensemble framework can better detect open-set samples on varying confidence thresholds. The contribution of this work can be summarized as follows:
- a new sparse ensemble framework that combines multiple sparse sub-networks to achieve better calibration performance without dense network training and iterative pruning.
- a distributionally robust optimization framework that schedules the learning of an ensemble complementary sub-networks (tickets),
- theoretical justification of the strong calibration performance by showing how the proposed robust training process guarantees to lower the confidence of incorrect predictions in Theorem 2.
- extensive empirical evidence on the effectiveness of the proposed lottery ticket ensemble in terms of competitive classification accuracy and improved open-set detection performance.
Sparse networks training. Sparse network training has received increasing attention in recent years. Representative techniques include lottery ticket hypothesis (LTH) [6] and its variants [5, 32]. To avoid training a dense network, supermasks have been used to find the winning ticket in the dense network without training network weights [38]. Edge-Popup (EP) extends this idea by leveraging training scores associated with the neural network weights and only weights with top scores are used for predictions. There are two key limitations to most existing LTH techniques. First, most of them require pre-training of a dense network followed by multi-step iterative pruning making the overall training process expensive. Second, their learning objective remains as improving the accuracy up to the original dense networks and may still suffer from over-fitting (as shown in Figure 1).
Sparse network ensemble. There are recent advancements in building ensembles from sparse networks. A pruning and regrowing strategy has been developed in a model, called CigL [16], where dropout serves as an implicit ensemble to improve the calibration performance. CigL requires weight updates and performs pruning and growing for multiple rounds, leading to a high training cost. Additionally, dropping many weights may lead to a performance decrease, which prevents building highly sparse networks. This idea has been further extended by using different learning rates to generate different typologies of the network structure for each sparse network [18, 35]. While diversity among sparse networks can be achieved, there is no guarantee that this can improve the calibration performance of the final ensemble. In fact, different networks may still learn from the training data in a similar way. Hence, the learned networks may exhibit similar overfitting behavior with a high correlation, making it difficult to generate a well-calibrated ensemble. In contrast, the proposed DRO ensemble schedules different sparse networks to learn from complementary parts of the training distribution, leading to improved calibration with theoretical guarantees.
Model calibration. Various attempts have been proposed to make the deep models more reliable either through calibration [9, 24, 32] or uncertainty quantification [7, 30]. Post-calibration techniques have been commonly used, including temperature scaling [24, 9], using regularization to penalize overconfident predictions [23]. Recent studies show that post-hoc calibration falls short of providing reliable predictions [22]. Most existing techniques require additional post-processing steps and an additional validation dataset. In our setting, we aim to improve the calibration ability of sparse networks without introducing additional post-calibration steps or validation dataset.
Let  $\mathcal{D}_{\mathcal{N}} = \{\mathbf{X},\mathbf{Y}\} = \{(\mathbf{x}_1,y_1),..,(\mathbf{x}_N,y_N)\}$  be a set of training samples where each  $\mathbf{x}_n\in \mathbb{R}^D$  is a D-dimensional feature vector and  $y_{n}\in [1,C]$  be associated label with  $C$  total classes. Let  $M$  be
Figure 2: Robust ensemble where  $\eta$  defines the size of an uncertainty set with  $\eta_1 \leq \eta_2 \leq \eta_3$ .
the total number of base learners used in the given ensemble technique. Further, consider  $\mathcal{K}$  to be the density ratio in the given network, which denotes the percentage of weights we keep during the training process. The major notations are summarized in the Appendix.
Edge-Popup (EP) [25]. EP finds a lottery ticket (sparse sub-network) from a randomly initialized dense network based on the score values learned from training data. Specifically, to find the subnetwork with density  $\mathcal{K}$ , the algorithm optimizes the scores associated with each weight in the dense network. During the forward pass, the top- $\mathcal{K}$  weights in each layer are selected based on their scores. During the backward pass, scores associated with all weights are updated, which allows potentially useful weights that are ignored in previous forward passes to be re-considered.
Expected calibration error. Expected Calibration Error (ECE) measures the correspondence between predicted probability and empirical accuracy [20]. Specifically, mis-calibration is computed based on the difference in expectation between confidence and accuracy:  $\mathbb{E}_{\hat{p}}[|\mathbb{P}(\hat{y} = y|\hat{p} = p) - p|]$ . In practice, we approximate the expectation by partitioning confidences into  $T$  bins (equally spaced) and take the weighted average on the absolute difference between each bins' accuracy and confidence. Let  $B_{t}$  denote the  $t$ -th beam and we have  $\mathrm{ECE} = \sum_{t=1}^{T} \frac{|B_t|}{N} |acc(B_t) - conf(B_t)|$ .
3.2 Distributionally Robust Ensemble (DRE)
As motivated in the introduction, to further enhance the calibration of a deep ensemble, it is instrumental to introduce sufficient diversity among the component sparse sub-networks so that they can complement each other when forming the ensemble. One way to achieve diversity is to allow each sparse sub-network to primarily focus on a specific part of the training data distribution. Figure 2 provides an illustration of this idea, where the training data can be imagined to follow a multivariate Gaussian distribution with the red dot representing its mean. In this case, the first sub-network will learn the most common patterns by focusing on the training data close to the mean. The subsequent sub-networks will then learn relatively rare patterns by focusing on other parts of the training data (e.g., two or three standard deviations from the mean).
AdaBoost ensemble. The above idea inspires us to leverage the AdaBoost framework [28] to manipulate the training distribution that allows us to train a sequence of complementary sparse subnetworks. In particular, we train the first sparse sub-network from the original training distribution, where each data sample has an equal probability to be sampled. In this way, the first sparse subnetwork can learn the common patterns from the most representative training samples. Starting from the second sub-network, the training distribution is changed according to the losses suffered from the previous sub-network during the last round of training. This allows the later sub-networks to focus on the difficult data samples by following the spirit of AdaBoost.
However, our empirical results reveal that in the AdaBoost ensemble, most sub-networks (except for the first one) severely underfit the training data, leading to a rather poor generalization capability. This is caused by the overfitting behavior of the first sparse sub-network, which assigns very small training losses to a majority of data samples. As a result, the subsequent sub-networks can only focus on a limited number of training samples that correspond to relatively rare patterns (or even outliers and noises) in the training data. Directly learning from these difficult data samples without a general knowledge of the entire training distribution will result in the failure of training the sub-networks.
Distributionally robust ensemble (DRE). To tackle the challenge as outlined above, we need a more robust learning process to ensure proper training of complementary sparse sub-networks. Different from the AdaBoost ensemble, the training of all sub-networks starts from the original training distribution in the DRO framework. Meanwhile, it also allows each sub-network to eventually focus on learning from different parts of the training distribution to ensure the desired diverse and complementary behavior. Let  $l(\mathbf{x}_n,\Theta)$  denote the loss associated with the  $n^{th}$  data sample with  $\Theta$  being the parameters in the sparse sub-network. Then, the total loss is given by
$$
\mathcal {L} ^ {\text {R o b u s t}} (\Theta) = \max  _ {\mathbf {z} \in \mathcal {U} ^ {\text {R o b u s t}}} \sum_ {n = 1} ^ {N} z _ {n} l \left(\mathbf {x} _ {n}, \Theta\right) \tag {1}
$$
The uncertainty set defined to assign weights  $\mathbf{z}$  is given as
$$
\mathcal {U} ^ {\text {R o b u s t}} := \left\{\mathbf {z} \in \mathbb {R} ^ {N}: \mathbf {z} ^ {\top} \mathbf {1} = 1, \mathbf {z} \geq 0, D _ {f} (\mathbf {z} \| \frac {\mathbf {1}}{N}) \leq \eta \right\} \tag {2}
$$
where  $D_{f}(\mathbf{z}\| \mathbf{q})$  is  $f$ -divergence between two distributions  $\mathbf{z}$  and  $\mathbf{q}$  and  $\eta$  controls the size of the uncertainty set and  $\mathbf{1} \in 1^{N}$  is  $N$ -dimensional unit vector. Depending on the  $\eta$  value, the above robust framework instantiates different sub-networks. For example, by making  $\eta \to \infty$ , we have  $\mathcal{U}^{\mathrm{Robust}} = \left\{\mathbf{z} \in \mathbb{R}^{N} : \mathbf{z}^{\top} \mathbf{1} = 1, \mathbf{z} \geq 0, D_{f}(\mathbf{z}\| \frac{1}{N}) \leq \infty\right\}$ . In this case, we train a sub-network by only using the most difficult sample in the training set. On the other extreme with  $\eta \to 0$ , we have  $\mathcal{U}^{\mathrm{Robust}} = \left\{\mathbf{z} \in \mathbb{R}^{N} : \mathbf{z}^{\top} \mathbf{1} = 1, \mathbf{z} \geq 0, D_{f}(\mathbf{z}\| \frac{1}{N}) \leq 0\right\}$ , which assigns equal weights to all data samples. So, the sub-network learns from the original training distribution.
To fully leverage the key properties of the robust loss function as described above, we propose to perform distributionally robust ensembling learning to generate a diverse set of sparse subnetworks with well-controlled overfitting behavior that can collectively achieve superior calibration performance. The training process starts with a relatively small  $\eta$  value to ensure that the initially generated sub-networks can adequately capture the general patterns from the most representative data samples in the original training distribution. The training proceeds by gradually increasing the  $\eta$  value, which allows the subsequent sub-networks to focus on relatively rare and more difficult data samples. As a result, the later generated sub-networks tend to produce less confident predictions that complement the sub-networks generated in the earlier phase of the training process. This diverse and complementary behavior among different sparse sub-networks is clearly illustrated in Figure 1 (e)-(g). During the ensemble phase, we combine the predictions of different sub-networks in the logit space by taking the mean and then performing the softmax. In this way, the sparse sub-networks with high  $\eta$  values help to lower the overall confidence score, especially those wrongly predicted data samples. Furthermore, the sub-networks with lower  $\eta$  values help to bring up the confidence score of correctly predicted data samples. Thus, the overall confidence score will be well compensated, resulting in a better calibrated ensemble.
3.3 Theoretical Analysis
In this section, we theoretically justify why the proposed DRE framework improves the calibration performance by extending the recently developed theoretical framework on multi-view learning [1]. In particular, we will show how it can effectively lower the model's false confidence on its wrong predictions resulting from spurious correlations. To this end, we first define the problem setup that includes some key concepts used in our theoretical analysis. We then formally show that DRO helps to tackle the spurious correlations by learning from less frequent features that characterize difficult data samples in a training dataset. This important property further guarantees better calibration performance of DRO as we show in the main theorem. It is worth to note that our theoretical analysis is primarily from the spurious correlation perspective. This is only one of the potential sources that can lead to over-confidence, resulting in poor-calibration in neural networks. The goal is offer deeper insights on why the proposed approach is able to improve the calibration performance resulting from spurious correlations by effectively lowering the model's false confidence on its wrong predictions.
Problem setup. Assume that each data sample  $\mathbf{x}_n\in \mathbb{R}^D$  is divided into  $P$  total patches, where each patch is a  $d$ -dimensional vector. For the sake of simplicity, let us assume each class  $c\in [1,C]$  has two characterizing (major) features  $\mathbf{v}_c = \{\mathbf{v}_{c,l}\}_{l = 1}^L$  with  $L = 2$ . For example, the features for Cars could be Headlights and Tires. Let  $\mathcal{D}_N^S$  and  $\mathcal{D}_N^M$  denote the set of single-view and multi-view data
samples, respectively, which are formally defined as
$$
\left\{ \begin{array}{l} \left\{\mathbf {x} _ {n}, y _ {n} \right\} \in \mathcal {D} _ {N} ^ {S} \text {i f o n e o f v} _ {c, 1} \text {o r v} _ {c, 2} \text {a p p a r s a l o n g w i t h s o m e n o i s e f e a t u r e s} \\ \left\{\mathbf {x} _ {n}, y _ {n} \right\} \in \mathcal {D} _ {N} ^ {M} \text {i f b o t h v} _ {c, 1} \text {a n d v} _ {c, 2} \text {a p p a r s a l o n g w i t h s o m e n o i s e f e a t u r e s} \end{array} \right. \tag {3}
$$
The noise features (also called minor features) refer to those that do not characterize (or differentiate) a given class  $c$  (e.g., being part of the background). In important applications like computer vision, images supporting such a "multi-view" structure is very common [1]. For example, for most car images, we can observe all main features, such as Wheels, Tires, and Headlights so they belong to  $\mathcal{D}_N^M$ . Meanwhile, there may also be images, where multiple features are missing. For example, if the car image is taken from the front, the tire and wheel features may not be captured. In most real-world datasets, such single-view data samples are usually much limited as compared to their multi-view counterparts. The Appendix provides concrete examples of both single and multi-view images. Let us consider  $(\mathbf{x}, y) \in \mathcal{D}_N^S$  with the major feature  $\mathbf{v}_{c,l}$  where  $y = c$ . Then each patch  $\mathbf{x}^p \in \mathbb{R}^d$  can be expressed as
$$
\mathbf {x} ^ {p} = a ^ {p} \mathbf {v} _ {c, l} + \sum_ {\mathbf {v} ^ {\prime} \in \cup \backslash \mathbf {v} _ {c}} \alpha^ {p, \mathbf {v} ^ {\prime}} \mathbf {v} ^ {\prime} + \epsilon^ {p} \tag {4}
$$