SlowGuess/NeurIPS_2023_OCR huggingface dataset:
where  $\cup = \{\mathbf{v}_{c,1},\mathbf{v}_{c,2}\}_{c = 1}^{C}$  is collection of all features,  $a^p >0$  is the weight allocated to feature  $\mathbf{v}_{c,l}$ ,  $\alpha^{p,\mathbf{v}'}\in [0,\gamma ]$  is the weight allocated to the noisy feature  $\mathbf{v}'$  that is not present in feature set  $\mathbf{v}_c$  i.e.,  $\mathbf{v}'\in \cup \backslash \mathbf{v}_c$ , and  $\epsilon^p\sim \mathcal{N}(0,(\sigma^p)^2\mathbb{1})$  is a random Gaussian noise. In (4), a patch  $\mathbf{x}^p$  in a single-view sample  $\mathbf{x}$  also contains set of minor (noise) features presented from other classes i.e.,  $\mathbf{v}'\in \cup \backslash \mathbf{v}_c$  in addition to the main feature  $\mathbf{v}_{c,l}$ . Since  $\mathbf{v}_{c,l}$  characterizes class  $c$ , we have  $a^p >\alpha^{p,\mathbf{v}'};\forall \mathbf{v}'\in \cup \backslash \mathbf{v}_c$ . However, since the single-view data samples are usually sparse in the training data, it may prevent the model from accumulating a large  $a^p$  for  $\mathbf{v}_{c,l}$  as shown Lemma 1 below. In contrast, some noise  $\mathbf{v}'$  may be selected as the dominant feature (due to spurious correlations) to minimize the errors of specific training samples, leading to potential overfitting of the model.
We further assume that the network contains  $H$  convolutional layers, which outputs  $F(\mathbf{x};\Theta) = (F_{1}(\mathbf{x}),\dots F_{C}(\mathbf{x}))\in \mathbb{R}^{C}$ . The logistic output for the  $c^{th}$  class can be represented as
$$
F _ {c} (\mathbf {x}) = \sum_ {h \in [ H ]} \sum_ {p \in [ P ]} \operatorname {R e L U} \left[ \left\langle \Theta_ {c, h}, \mathbf {x} ^ {p} \right\rangle \right] \tag {5}
$$
where  $\Theta_{c,h}$  denote the  $h^{th}$  convolution layer (feature map) associated with class  $c$ . Under the above data and network setting, we propose the following lemma.
Lemma 1. Let  $\mathbf{v}_{c,l}$  be the main feature vector present in the single-view data  $\mathcal{D}_N^S$ . Assume that number of single-view data samples containing feature  $\mathbf{v}_{c,l}$  is limited as compared with the rest, i.e.,  $N_{\mathbf{v}_{c,l}} \ll N_{\cup \backslash \mathbf{v}_{c,l}}$ . Then, at any iteration  $t > 0$ , we have
$$
\left\langle \Theta_ {c, h} ^ {t + 1}, \mathbf {v} _ {c, l} \right\rangle = \left\langle \Theta_ {c, h} ^ {t}, \mathbf {v} _ {c, l} \right\rangle + \beta \max  _ {\mathbf {z} \in \mathcal {U}} \sum_ {n = 1} ^ {N} z _ {n} \left[ \mathbb {1} _ {y _ {j} = c} \left(V _ {c, h, l} (\mathbf {x} _ {n}) + \kappa\right) \left(1 - S O F T _ {c} (F (\mathbf {x} _ {n}))\right) \right] \tag {6}
$$
where  $\kappa$  is a dataset specific constant,  $\beta$  is the learning rate,  $SOT_{c}$  is the softmax output for class  $c$ , and  $V_{c,h,l}(\mathbf{x}_j) = \sum_{p\in \mathcal{P}_{\mathbf{v}_{c,l}}(\mathbf{x}_j)}ReLU(\langle \Theta_{c,h},\mathbf{x}_j^p\rangle a^p)$  with  $\mathcal{P}_{\mathbf{v}_{c,l}}(\mathbf{x}_j)$  being the collection of patches containing feature  $\mathbf{v}_{c,l}$  in  $\mathbf{x}_j$ . The set  $\mathcal{U}$  is an uncertainty set that assigns a weight to each data sample based on its loss. In particular, the uncertainty set under DRO is given as in (2) and we further define the uncertainty set under ERM:  $\mathcal{U}^{ERM} := \{\mathbf{z}\in \mathbb{R}^N:z_n = \frac{1}{N};\forall n\in [1,N]\}$ . Learning via the robust loss in (1) leads to a stronger correlation between the network weights  $\Theta_{c,h}$  and the single-view data feature  $\mathbf{v}_{c,l}$ :
$$
\{\langle \Theta_ {c, h} ^ {t}, \mathbf {v} _ {c, l} \rangle \} _ {\text {R o b u s t}} > \{\langle \Theta_ {c, h} ^ {t}, \mathbf {v} _ {c, l} \rangle \} _ {E R M}; \forall t > 0 \tag {7}
$$
Remark. The robust loss  $\mathcal{L}^{\mathrm{Robust}}$  forces the model to learn from the single-view samples (according to the loss) by assigning a higher weight. As a result, the network weights will be adjusted to increase the correlation with the single-view data features  $\mathbf{v}_{c,l}$  due to Lemma 1. In contrast, for standard ERM, weight is uniformly assigned to all samples. Due to the sparse single-view data features (which also makes them more difficult to learn from, leading to a larger loss), the model does not grow sufficient
correlation with  $\mathbf{v}_{c,l}$ . In this case, the ERM model instead learns to memorize some noisy feature  $\mathbf{v}'$  introduced through certain spurious correlations. For a testing data sample, the ERM model may confidently assign it to an incorrect class  $k$  according to the noise feature  $\mathbf{v}'$ . In the theorem below, we show how the robust training process can effectively lower the confidence of incorrect predictions, leading to an improved calibration performance.
Theorem 2. Given a new testing sample  $\mathbf{x} \in \mathcal{D}_S^N$  containing  $\mathbf{v}_{c,l}$  as the main feature and a dominant noise feature  $\mathbf{v}'$  that is learned due to memorization, we have
$$
\left\{S O F T _ {k} (\mathbf {x}) \right\} _ {\text {R o b u s t}} <   \left\{S O F T _ {k} (\mathbf {x}) \right\} _ {E R M} \tag {8}
$$
where  $\mathbf{v}'$  is assumed to be a main feature characterizing class  $k$ .
Remark. For ERM, due to the impact of the dominate noisy feature  $\mathbf{v}'$ , it assigns a large probability to class  $k$  since  $\mathbf{v}'$  is one of its major features, leading to high confidence for an incorrect prediction. In contrast, the robust learning process allows the model to learn a stronger correlation with the main feature  $\mathbf{v}_{c,l}$  as shown in Lemma 1. Thus, the model is less impacted by the noise feature  $\mathbf{v}'$ , resulting in reduced confidence in predicting the wrong class  $k$ . Such a key property guarantees an improved calibration performance, which is clearly verified by our empirical evaluation. It is also worth noting that Theorem 2 does not necessarily lead to better classification accuracy. This is because (8) only ensures that the false confidence is lower than an ERM model, but there is no guarantee that  $\{\mathrm{S0FT}_k(\mathbf{x})\}_{Robust} < \{\mathrm{S0FT}_c(\mathbf{x})\}_{Robust}$ . It should be noted that our DRE framework ensures diverse sparse sub-network focusing on different single-view data samples from different classes. As such, an ensemble of those diverse sparse subnetworks provides maximum coverage of all features (even the weaker one) and therefore can ultimately improve the calibration performance. The detailed proofs are provided in the Appendix.
We perform extensive experimentation to evaluate the distributionally robust ensemble of sparse sub-networks. Specifically, we test the ability of our proposed technique in terms of calibration and classification accuracy. For this, we consider three settings: (a) general classification, (b) out-of-distribution setting where we have in-domain data but with different distributions, and (c) open-set detection, where we have unknown samples from new domains.
Dataset description. For the general classification setting, we consider three real-world datasets: Cifar10, Cifar100 [12], and TinyImageNet [14]. For the out-of-distribution setting, we consider the corrupted version of the Cifar10 and Cifar100 datasets which are named Cifar10-C and Cifar100-C [10]. It should be noted that in this setting, we train all models in clean dataset and perform testing in the corrupted datasets. For open-set detection, we use the SVHN dataset [21] as the open-set dataset and Cifar10 and Cifar100 as the close-set data. A more detailed description of each dataset is presented in the Appendix.
Evaluation metrics. To assess the model performance in the first two settings, we report the classification accuracy  $(\mathcal{A}\mathcal{C})$  along with the Expected Calibration Error  $(\mathcal{E}\mathcal{C}\mathcal{E})$ . In the case of open-set detection, we report open-set detection for different confidence thresholds.
Implementation details. In all experiments, we use a family of ResNet architectures with two density levels:  $9\%$  and  $15\%$ . To construct an ensemble, we learn 3 sparse sub-networks each with a density of  $3\%$  for the total of  $9\%$  density and that of  $5\%$  density for the total of density  $15\%$ . All experiments are conducted with the 200 total epochs with an initial learning rate of 0.1 and a cosine scheduler function to decay the learning rate over time. The last-epoch model is taken for all analyses. For the training loss, we use the EP-loss in our DRO ensemble that optimizes the scores for each weight and finally selects the sub-network from the initialized dense network for the final prediction. The selection is performed based on the optimized scores. More detailed information about the training process and hyperparameter settings can be found in the Appendix.
In our comparison study, we include baselines that are relevant to our technique and therefore we primarily focus on the LTH-based techniques. Specifically, we include the initial lottery ticket hypothesis (LTH) [6] that iteratively performs pruning from a dense network until the randomly
Table 1: Accuracy and ECE performance with  $9\%$  density for Cifar10 and Cifar100.
Training Type	Approach	Cifar10	Cifar100
ResNet50	ResNet101	ResNet101	ResNet152
ACC	ECE	ACC	ECE	ACC	ECE	ACC	ECE
Dense†	94.82	5.87	95.12	5.99	76.40	16.89	77.97	16.73
Dense Pre-training	L1 Pruning [17]	93.45	5.31	93.67	6.14	75.11	15.89	75.12	16.24
LTH [6]	92.65	3.68	92.87	6.02	74.09	15.45	74.41	16.12
DLTH [3]	93.27	5.87	95.12	7.09	77.29	16.64	77.86	17.26
Mixup [32]	92.86	3.68	93.06	6.01	74.15	15.41	74.28	16.05
Sparse Training	CigL [16]	92.39	5.06	93.41	4.60	76.40	9.30	76.46	9.91
DST Ensemble [18]	88.87	2.02	84.93	0.8	63.57	7.23	63.22	6.18
Sup-ticket [35]	94.52	3.30	95.04	3.10	78.28	10.20	78.60	10.50
Mask Training	AdaBoost	93.12	5.13	94.15	5.46	75.15	22.96	75.89	24.54
EP [25]	94.20	3.97	94.35	4.03	75.05	14.62	75.68	14.41
SNE	94.70	2.51	94.48	3.51	75.69	9.02	75.22	10.89
DRE (Ours)	94.60	0.7	94.28	0.7	74.68	1.20	74.37	2.09
Table 2: Accuracy and ECE on TinyImageNet.
Training Type	Approach	K = 9%	K = 15%
ResNet101	WideResNet101	ResNet101	WideResNet101
ACC	ECE	ACC	ECE	ACC	ECE	ACC	ECE
Dense†	71.28	15.58	72.57	16.96	71.28	15.58	72.57	16.96
Dense Pre-training	L1 Pruning [17]	68.85	14.72	69.78	16.38	70.24	14.24	70.98	15.36
LTH [6]	69.23	13.97	69.13	15.34	70.16	13.63	70.25	14.24
DLTH [3]	70.12	16.15	71.36	18.35	71.68	15.88	72.97	17.21
Mixup [32]	69.34	14.24	69.25	15.59	70.28	14.31	70.39	14.57
Mask Training	AdaBoost	69.52	17.23	68.66	19.46	70.12	16.57	70.24	18.35
EP [25]	69.88	10.78	71.57	9.82	70.46	11.99	70.71	12.41
SNE	71.28	4.64	73.32	5.48	72.20	6.57	74.56	6.55
DRE (Ours)	71.68	3.48	74.04	2.82	72.00	1.52	73.72	1.08
Table 3: Accuracy and ECE performance on out-of-distribution datasets.
Training Type	Approach	Cifar10	Cifar100
ResNet50	ResNet101	ResNet101	ResNet152
ACC	ECE	ACC	ECE	ACC	ECE	ACC	ECE
Dense†	79.65	19.63	79.65	19.63	54.75	35.32	54.75	35.32
Dense Pre-training	L1 Pruning [17]	77.34	17.95	76.39	17.89	52.06	31.45	51.67	30.98
LTH [6]	75.85	17.88	76.15	17.62	50.79	31.23	51.35	30.56
DLTH [3]	79.67	21.74	80.12	20.31	54.82	37.55	55.12	35.74
Mixup [32]	76.35	17.74	76.88	17.55	51.36	31.12	51.92	30.35
Sparse Training	CigL [16]	70.80	21.04	69.84	21.42	49.42	25.86	51.49	24.13
Sup-ticket [35]	72.89	17.80	73.01	18.82	48.80	24.99	48.81	25.62
Mask Training	AdaBoost	75.94	22.96	74.55	21.46	51.36	38.45	51.25	38.34
EP [25]	77.58	17.82	77.73	17.46	52.18	30.60	52.14	29.48
SNE	78.93	15.73	78.61	15.56	54.74	24.22	54.00	20.54
DRE (Ours)	78.57	10.92	78.00	10.19	54.11	14.28	53.21	8.13
initialized sub-network with a given density is reached. Once the sub-network is found, the model trains the sub-network using the training dataset. Similarly, we also include L1 pruning [17]. We also include three approaches CigL [16], Sup-ticket [35], DST Ensemble [18] which are based on the pruning and regrowing sparse network training strategies. From Venkatesh et al. [32] we consider MixUp strategy as a comparison baseline as it does not require multi-step forward passes. A dense network is also included as a reference (denoted as  $\text{Dense}^{\dagger}$ ). Furthermore, we report the performance obtained using the EP algorithm [25] on a single model with a given density. Finally, we also include the deep ensemble technique (i.e., Sparse Network Ensemble (SNE), where each base model is randomly initialized and independently trained. The approaches that require pre-training of a dense network are categorized under the Dense Pre-training category. Those performing sparse network training but actually updating the network parameters are grouped as Sparse Training. It should be noted that sparse training techniques still require iterative pruning and regrowing. Finally, techniques that attempt to search the best initialized sparse sub-network through mask update (e.g., EP) are grouped as Mask Training.
(a) CIFAR10  $(\mathcal{K} = 15\%)$
(b) CIFAR10  $(\mathcal{K} = 9\%)$
Figure 3: Open-set detection performance on different confidence thresholds.
(c) CIFAR100  $(\mathcal{K} = 15\%)$
(d) CIFAR100 ( $\mathcal{K} = 9\%$ )
General classification setting. In this setting, we consider clean Cifar10, Cifar100, and TinyImageNet datasets. Tables 1, 2, and 6 (in the Appendix) show the accuracy and calibration error for different models with density  $9\%$  and  $15\%$ . It should be noted that for the TinyImageNet dataset, we could not run the Sparse Training techniques due to the computation issue (i.e., memory overflow). This may be because sparse training techniques require maintaining additional parameters for the pruning and regrowing strategy. In the Appendix, we have made a comparison of the proposed DRE with those baselines on a lower architecture size. There are three key observations we can infer from the experimental results. First, sparse networks are able to maintain or improve the generalization performance (in terms of accuracy) with better calibration, which can be seen by comparing dense network performance with the edge-popup algorithm. Second, the ensemble in general helps to further lower the calibration error (lower the better). For example, in all datasets, standard ensemble (SNE) consistently improves the EP model. Finally, the proposed DRE significantly improves the calibration performance by diversifying base learners and allow each sparse sub-network to focus on different parts of the training data. The strong calibration performance provides clear empirical evidence to justify our theoretical results.
Out-of-distribution classification setting. In this setting, we assess the effectiveness of the proposed techniques on out-of-distribution samples. Specifically, [10] provide the Cifar10-C and Cifar100-C validation datasets which are different than that of the original clean datasets. They apply different corruptions (such as blurring noise, and compression) to shift the distribution of the datasets. We assess those corrupted datasets using the models trained using the clean dataset. Table 3 shows the performance using different architectures. In this setting, we have not included DST Ensemble, because: (a) its accuracy is far below the SOTA performance, and (b) same training mechanism as that of the Sup-ticket, whose performance is reported. As shown, the proposed DRE provides much better calibration performance even with the out of distribution datasets.
Open-set detection setting. In this setting, we demonstrate the ability of our proposed DRO ensemble in detecting open-set samples. For this, we use the SVHN dataset as an open-set dataset. Specifically, if we have a better calibration, we would be able to better differentiate the open-set samples based on the confidence threshold. For this, we randomly consider  $20\%$  of the total testing in-distribution dataset as the open-set samples from the SVHN dataset. The reason for only choosing a subset of the dataset is to imitate the practical scenario where we have very few open-set samples compared to the close-set samples. We treat the open-set samples as the positive and in-distribution (close-set) ones as the negative. Since this is a binary detection problem, we compute the F-score [8] at various thresholds, which considers both precision and recall. Figure 3 shows the performance for the proposed technique along with comparative baselines. As shown, our proposed DRE (refereed as DRO Ensemble) always stays on the top for various confidence thresholds which demonstrates that strong calibration performance can benefit DRE for open-set detection as compared to other baselines.
In this section, we investigate the impact of the backbone architecture along with the size of the ensemble. Additional ablation studies are presented in Appendix D.9.
Performance analysis of different backbones. Table 4 (a) reports the performance of Cifar10 from both DRE and EP using different backbone architectures. In case of WideResNet28-10, the calibration error is low without sacrificing the accuracy. It also demonstrates that the superior performance of DRE is not limited to a specific backbone. In case of ViT, DRE still achieves a much lower calibration error than EP. However, using ViT as a backbone, the accuracy from both EP and DRE is lower and ECE is higher than other backbones. Existing studies show that without pretraining, the lack of useful
Table 4: ACC and ECE with different backbones and number of subnetworks
Approach	WideResNet28-10	ViT
ACC	ECE	ACC	ECE
EP	94.12	4.53	86.16	10.01
DRE	93.98	1.93	85.53	4.18
(a) Different backbones on Cifar10 Dataset.
Approach	ResNet101	ResNet152
ACC	ECE	ACC	ECE
DRE (M=3)	94.87	1.71	94.74	1.34
DRE (M=5)	94.79	0.84	94.69	0.62
(b) Different  $M$  values on Cifar10 with  $\mathcal{K} = 15\%$
inductive biases for ViT can cause performance drop [1]. Since no pretraining is conducted in both EP and DRE, it causes a lower accuracy (and a higher ECE).
Impact of number of sparse-sub-networks. In this analysis, we study the impact of number of sparse sub-networks. It should be noted that our work is not limited only for  $M = 3$ . We can instead increase the  $M$  value. For example, Table 4 (b) shows the performance for an ensemble model with  $M = 5$ , where each sub-network is trained with  $\mathcal{K} = 3\%$ , leading to a total  $\mathcal{K} = 15\%$ . We also show the performance with  $M = 3$ , where each sub-network is trained with  $\mathcal{K} = 5\%$ . As can be seen, if there is a sufficient learning capacity for each sub-network, the ECE score can further improve with the increase of  $M$ .
In this section, we provide illustrative examples to further justify why the proposed DRE is better calibrated as compared to existing baselines. Figure 4 (a)-(d) show the confidence values for the wrongly classified samples by different sparse sub-networks in the DRE ensemble. As can be seen, each sparse sub-network provides confidence values in different ranges, where the sub-network in (a) is learned from most representative samples and the one in (c) is from the most difficult ones. As these sub-networks are complementary with each other, the DRE has a much better confidence distribution for incorrect samples than the baselines. In contrast, as shown in Figure 8 of Appendix D.12, all the baselines, including the dense network, EP sparse networks, and the SNE, tend to allocate much higher confidence values to wrongly classified examples, leading to poor calibration. In case of correctly classified samples, the proposed DRE generates confident predictions and thereby not compromising the calibration performance, which is further discussed in Appendix D.12.
(a) Sparse sub-network 1
(b) Sparse sub-network 2
Figure 4: Confidence scores of incorrectly classified samples in CIFAR100 with ResNet101.
(c) Sparse sub-network 3
(d) DRE
In this paper, we proposed a novel DRO framework, called DRE, that achieves an ensemble of lottery tickets towards calibrated network sparsification. Specifically, with the guidance of uncertainty sets under the DRO framework, the proposed DRE aims to learn multiple diverse and complementary sparse sub-networks (tickets) where uncertainty sets encourage tickets to gradually capture different data distributions from easy to hard and naturally complement each other. We have theoretically justified the strong calibration performance by demonstrating how the proposed robust training process guarantees to lower the confidence of incorrect predictions. The extensive evaluation shows that the proposed DRE leads to significant calibration improvement without sacrificing the accuracy and burdening inference cost. Furthermore, experiments on OOD and open-set datasets show its effectiveness in terms of generalization and novelty detection capability, respectively.
This research was supported in part by an NSF IIS award IIS-1814450 and an ONR award N00014-18-1-2875. The views and conclusions contained in this paper are those of the authors and should not be interpreted as representing any funding agency.
[1] Zeyuan Allen-Zhu and Yuanzhi Li. Towards understanding ensemble, knowledge distillation and self-distillation in deep learning. In The Eleventh International Conference on Learning Representations, 2023.
[2] Yue Bai, Huan Wang, Xu Ma, Yitian Zhang, Zhiqiang Tao, and Yun Fu. Parameter-efficient masking networks. In Advances in Neural Information Processing Systems, 2022.
[3] Yue Bai, Huan Wang, Zhiqiang Tao, Kunpeng Li, and Yun Fu. Dual lottery ticket hypothesis. In International Conference on Learning Representations, 2022.
[4] Mariusz Bojarski, Davide Del Testa, Daniel Dworakowski, Bernhard Firner, Beat Flepp, Prasoon Goyal, Lawrence D. Jackel, Mathew Monfort, Urs Muller, Jiakai Zhang, Xin Zhang, Jake Zhao, and Karol Zieba. End to end learning for self-driving cars, 2016.
[5] Tianlong Chen, Zhenyu Zhang, Jun Wu, Randy Huang, Sijia Liu, Shiyu Chang, and Zhangyang Wang. Can you win everything with a lottery ticket? Transactions on Machine Learning Research, 2022.
[6] Jonathan Frankle and Michael Carbin. The lottery ticket hypothesis: Finding sparse, trainable neural networks. 2018.
[7] Yarin Gal and Zoubin Ghahramani. Dropout as a bayesian approximation: Representing model uncertainty in deep learning, 2015.
[8] Cyril Goutte and Eric Gaussier. A probabilistic interpretation of precision, recall and f-score, with implication for evaluation. In David E. Losada and Juan M. Fernández-Luna, editors, Advances in Information Retrieval, pages 345–359, Berlin, Heidelberg, 2005. Springer Berlin Heidelberg.
[9] Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q. Weinberger. On calibration of modern neural networks. In Proceedings of the 34th International Conference on Machine Learning - Volume 70, ICML'17, page 1321-1330. JMLR.org, 2017.
[10] Dan Hendrycks and Thomas Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. Proceedings of the International Conference on Learning Representations, 2019.
[11] Xiaoqian Jiang, Melanie Osl, Jihoon Kim, and Lucila Ohno-Machado. Calibrating predictive model estimates to support personalized medicine. Journal of the American Medical Informatics Association : JAMIA, 19:263 - 274, 2011.
[12] Alex Krizhevsky. Learning multiple layers of features from tiny images. 2009.
[13] Balaji Lakshminarayanan, Alexander Pritzel, and Charles Blundell. Simple and scalable predictive uncertainty estimation using deep ensembles. In Proceedings of the 31st International Conference on Neural Information Processing Systems, NIPS'17, page 6405-6416, Red Hook, NY, USA, 2017. Curran Associates Inc.
[14] Ya Le and Xuan S. Yang. Tiny imagenet visual recognition challenge. 2015.
[15] Namhoon Lee, Thalaiyasingam Ajanthan, and Philip H. S. Torr. SNIP: single-shot network pruning based on connection sensitivity. CoRR, abs/1810.02340, 2018.
[16] Bowen Lei, Ruqi Zhang, Dongkuan Xu, and Bani Mallick. Calibrating the rigged lottery: Making all tickets reliable. In The Eleventh International Conference on Learning Representations, 2023.