SlowGuess/NeurIPS_2023_OCR huggingface dataset:
RDumb allows adaptation of a variety of architectures without tuning. We evaluate RDumb and EATA across a range of popular backbone architectures. Out of the nine architectures evaluated (see Table 2,3), RDumb outperformed EATA by an average margin of  $4.5\%$  points on seven of them, and worse by an average margin of only  $0.25\%$  points on the remaining two.
6 Analysis and Ablations
Optimal reset intervals. To determine the optimal reset interval, we run ETA with reset intervals  $T \in [125, 250, 500, 1000, 1500, 2000]$  on CIN-C using the IN-C holdout noises. We concatenate the 4 holdout noises at severity 5 as our base test set. This base test set is repeated until the model sees 750k images, which is equal to the length of CIN-C. We do this for every permutation of the 4 holdout corruptions. On this holdout set, we find that the optimal  $T$  is equal to 1,000.
Table 4: Accuracy of our method for different resetting times on CIN-C-Holdout
T (steps)	125	250	500	1000	1500	2000
Acc. [%]	42.1	44.4	46.0	46.7	46.5	46.4
RDumb is less sensitive to hyperparameters. An added benefit to our method is that it is less sensitive to hyperparameters than EATA. We conduct a simple hyperparameter search of the  $E_0$  parameter—the hyperparameter that controls how many outputs get filtered out because of their high entropy. Our method consistently outperforms EATA across every hyperparameter tested (Table 5), and for the highest value, 0.7, EATA collapses to almost chance accuracy on all splits, while our method does not. In addition, RDumb's performance benefits from finetuning ( $H_0 = \{0.2, 0.3\}$ ), while EATA is not able to improve.
Table 5: Average accuracy on all of CCC splits on a variety of  $H_0$  values. For all other experiments in this paper we use  $H_0 = 0.4 \times \ln 10^3$ , as in [30].
H0× ln 103	0.1	0.2	0.3	0.4	0.5	0.6	0.7
EATA	27.8	27.9	29.9	30.8	28.7	28.0	0.33
RDumb (ours)	31.6	32.9	33.1	32.6	30.7	25.7	16.8
RDumb is effective because ETA reaches maximum adaptation performance fast. ETA is quick to adapt to new noises from scratch. On each of the holdout set noises and severities, ETA reaches its maximum accuracy after seeing only about 12,500 samples, which is about 200 adaptation steps (Figure 5a). After that, accuracy decays at a pace slower than its initial increase. Therefore, when resetting and readapting from scratch, only a few steps with substantially suboptimal predictions are encountered before performance is again close to optimal.
Comparing resetting to regularization. Previous works typically optimize two loss terms: one loss encourages adaptation on unseen data, another loss regularizes the model to prevent collapse. Having to optimize two losses should be harder than optimizing just one - we see evidence for this
Figure 5: (a) ETA's normalized accuracy over time, on the ImageNet-C holdout noises and each of their severities. For every noise in the holdout set, ETA reaches its maximum accuracy very quickly. (b) Rdumb shares ETA's property of fast adaptation, while regularization in EATA slows adaptation.
in short term adaptation on CIN-C (Figure 5b): ETA and EATA optimize the same loss, but EATA additionally optimizes an anti-collapse loss. Consequently, ETA beats EATA by  $2\%$  points on CIN-C.
Collapse Analysis. We now investigate potential causes and effects of the observed collapse behavior. We propose a theoretical model, fully specified in Appendix A, which can explain both collapsing and non-collapsing runs. The model consists of a batch norm layer followed by a linear layer trained with the Tent objective. Within this model, we can present two scenarios. In the first, the model successfully adapts and plateaus at high accuracy (Figure 7a). In the second, we see early adaptation which is then followed by collapse (Figure 6a,7a). The properties of noise in the data influence whether we observe the case of successful or unsuccessful adaptation.
Interestingly, the model predicts that the magnitude of weights increases over the course of optimization; this signature of entropy minimization can be found in both the theoretical model and a real experiment using RDumb without resetting on CCC-Medium (Figure 6). Unfortunately, weight explosion happens only after model performance is already collapsed (Figure 8b). The effect is observable across all layers (Figure 6c,8).
Domain Adaptation. In practice, the data distribution at deployment is different from training, and hence the task of domain adaptation, i.e., the task of adapting models to different target distributions has received a lot of attention [6, 14, 21, 22, 36, 42, 47]. The methods on domain adaptation split into different categories based on what information is assumed to be available during adaptation. While some methods assume access to labeled data for the target distribution [27, 53], unsupervised domain adaptation methods assume that the model has access to labeled source data and unlabeled target data at adaptation time [5, 21, 22, 41]. Most useful for practical applications is the case of test-time adaptation, where the task is to adapt to the target data on the fly, without having access to the full target distribution, or the original training distribution [29, 30, 35, 38, 42, 47, 54].
In addition to the division made above, one can further distinguish what assumptions are made about how the target domain is changing. Many academic benchmarks focus on one-time distribution shifts. However, in practical applications, the target distribution can easily change perpetually over time, e.g., due to changing weather and lightness conditions, or due to sensor corruptions. Therefore, the latter setting of continual adaptation has been receiving increasing attention recently. The earliest example of adapting a classifier to an evolving target domain that we are aware of is [15], which learn a series of transformations to keep the data representation similar over time. [5, 44, 49] use an adversarial domain adaptation approach for this. [2] pointed out that two of these approaches can be prone to catastrophic forgetting [34]. To deal with this, different solutions have been proposed [1, 2, 24, 28, 30, 48].
Test-time adaptation methods have classically been applied in the setting of one-time domain change, but can be readily applied in the setting of continual adaptation, and some recent methods have been explicitly designed and tested with continual adaptation in mind [30, 47, 48]. Because TTA methods use only test data and don't alter the training procedure, they are particularly easy to apply and have
Figure 6: Analysis of entropy minimization collapse on synthetic and real data. Learning dynamics in terms of accuracy and weight magnitude are shown in (a) for a two layer toy model consisting of batch norm and linear layer (b). Consistent with the theoretical analysis, we find that the adaptation weights in all layers increase over time continually (c), even long after the collapse as indicated by Accuracy on CCC-Medium has happened. Refer to Figure 7-8 and Appendix A for additional properties of the toy model (a-b) and a zoomed-in view on (c).
been shown to be superior to other domain adaptation approaches [6, 29, 36, 38]. Therefore, we focus only on TTA methods, which we discussed in more detail in Section 4.
Continual Adaptation Benchmarks. While continually changing datasets are used in the continual learning literature, e.g. [4, 9, 25, 39, 40, 52], they have been used in TTA benchmarks only very recently. In contrast to all previous benchmarks, we want to evaluate how continual adaptation methods change over long periods of time, when the noise changes in a continuous manner. The longest datasets for TTA were made up of hundreds of thousands of labeled images in total, while we adapt to 7.5M images per run. Other datasets are comprised of short video clips [25, 39, 40] 10-20 seconds in length. Besides maximizing its length, we set out to create a dataset that is well calibrated and closely related to the well-known ImageNet-C dataset. Additionally, with our noise synthesis, we can guarantee a wide variety of noises in each one of our evaluation runs, we can control the speed at which the noise changes, and we can control the difficulty of the generated noise. Lastly, CCC accounts for different adaptation speeds, as demonstrated by [35] and [28]. They showed that training their methods on ImageNet-C for more than one epoch leads to better performance.
TTA techniques are increasingly applied to continual adaptation settings. Yet, we show that all current TTA techniques collapse in some continual adaptation settings, eventually performing worse than even non-adapting models. And while some methods are stable in some situations, they are still outperformed by our simplistic baseline "RDumb", which avoids collapse by resetting the model to its pretrained state periodically. These observations were made possible by our new benchmark for continual adaptation (CCC), which was carefully designed for the precise assessment of long and short term adaptation behaviour of TTA methods and we envision it to be a helpful tool for the development of new, more stable adaptation methods.
We thank Evgenia Rusak, Cagatay Yildiz, Shyamgopal Karthik, and Ofir Press for helpful discussions and feedback on the manuscript.
We thank the International Max Planck Research School for Intelligent Systems (IMPRS-IS) for supporting OP and StS; StS acknowledges his membership in the European Laboratory for Learning and Intelligent Systems (ELLIS) PhD program. StS was supported by a Google Research PhD Fellowship. MB is a member of the Machine Learning Cluster of Excellence, EXC number 2064/1 - Project No 390727645 and acknowledges support by the German Research Foundation (DFG): SFB 1233, Robust Vision: Inference Principles and Neural Mechanisms, TP 4, Project No: 276693517. This work was supported by the Tübingen AI Center. The authors declare no conflicts of interests.
Author order below is determined by contribution among the respective category. Conceptualization, RDumb: OP with input from all authors; Conceptualization, CCC: StS, MB, MK; Methodology: OP, StS; Software: OP; Data Curation: OP; Investigation: OP; Formal analysis: MK, StS, OP; Visualization: StS, OP with input from all authors; Writing, Original Draft: OP, StS, MK; Writing, Review & Editing: all authors; Supervision: MB, MK, StS.
[1] Abnar, S., Berg, R. v. d., Ghiasi, G., Dehghani, M., Kalchbrenner, N., and Sedghi, H. (2021). Gradual domain adaptation in the wild: When intermediate distributions are absent. arXiv preprint arXiv:2106.06080.
[2] Bobu, A., Tzeng, E., Hoffman, J., and Darrell, T. (2018). Adapting to continuously shifting domains. Workshop Track - ICLR 2018.
[3] Dosovitskiy, A., Beyer, L., Kolesnikov, A., Weissenborn, D., Zhai, X., Unterthiner, T., Dehghani, M., Minderer, M., Heigold, G., Gelly, S., et al. (2020). An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929.
[4] Feng, F., Chan, R. H., Shi, X., Zhang, Y., and She, Q. (2019). Challenges in task incremental learning for assistive robotics. IEEE Access, 8:3434-3441.
[5] Ganin, Y., Ustinova, E., Ajakan, H., Germain, P., Larochelle, H., Laviolette, F., Marchand, M., and Lempitsky, V. (2016). Domain-adversarial training of neural networks. The journal of machine learning research, 17(1):2096-2030.
[6] Geirhos, R., Rubisch, P., Michaelis, C., Bethge, M., Wichmann, F. A., and Brendel, W. (2018). Imagenet-trained cnns are biased towards texture; increasing shape bias improves accuracy and robustness. arXiv preprint arXiv:1811.12231.
[7] Gong, T., Jeong, J., Kim, T., Kim, Y., Shin, J., and Lee, S.-J. (2022). Note: Robust continual test-time adaptation against temporal correlation. In Advances in Neural Information Processing Systems.
[8] Goyal, S., Sun, M., Raghunathan, A., and Kolter, Z. (2022). Test-time adaptation via conjugate pseudo-labels. arXiv preprint arXiv:2207.09640.
[9] Han, J., Liang, X., Xu, H., Chen, K., Lanqing, H., Mao, J., Ye, C., Zhang, W., Li, Z., Liang, X., et al. (2021). Soda10m: A large-scale 2d self/semi-supervised object detection dataset for autonomous driving. In Thirty-fifth Conference on Neural Information Processing Systems Datasets and Benchmarks Track (Round 2).
[10] He, K., Zhang, X., Ren, S., and Sun, J. (2016). Deep residual learning for image recognition. In 2016 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2016, Las Vegas, NV, USA, June 27-30, 2016, pages 770-778. IEEE Computer Society.
[44] Tzeng, E., Hoffman, J., Saenko, K., and Darrell, T. (2017). Adversarial discriminative domain adaptation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 7167-7176.
[45] Van de Ven, G. M. and Tolias, A. S. (2019). Three scenarios for continual learning. arXiv preprint arXiv:1904.07734.
[46] Wang, D., Shelhamer, E., Liu, S., Olshausen, B., and Darrell, T. (2020a). Fully test-time adaptation by entropy minimization. ArXiv preprint, abs/2006.10726.
[47] Wang, D., Shelhamer, E., Liu, S., Olshausen, B., and Darrell, T. (2020b). Tent: Fully test-time adaptation by entropy minimization. arXiv preprint arXiv:2006.10726.
[48] Wang, Q., Fink, O., Van Gool, L., and Dai, D. (2022). Continual test-time domain adaptation. arXiv preprint arXiv:2203.13591.
[49] Wulfmeier, M., Bewley, A., and Posner, I. (2018). Incremental adversarial domain adaptation for continually changing environments. In 2018 IEEE International conference on robotics and automation (ICRA), pages 4489-4495. IEEE.
[50] Xie, Q., Luong, M., Hovy, E. H., and Le, Q. V. (2020). Self-training with noisy student improves imagenet classification. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition, CVPR 2020, Seattle, WA, USA, June 13-19, 2020, pages 10684-10695. IEEE.
[51] Xie, S., Girshick, R. B., Dollár, P., Tu, Z., and He, K. (2017). Aggregated residual transformations for deep neural networks. In 2017 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2017, Honolulu, HI, USA, July 21-26, 2017, pages 5987-5995. IEEE Computer Society.
[52] Yu, F., Chen, H., Wang, X., Xian, W., Chen, Y., Liu, F., Madhavan, V., and Darrell, T. (2020). Bdd100k: A diverse driving dataset for heterogeneous multitask learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR).
[53] Yue, X., Zheng, Z., Zhang, S., Gao, Y., Darrell, T., Keutzer, K., and Vincentelli, A. S. (2021). Prototypical cross-domain self-supervised learning for few-shot unsupervised domain adaptation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 13834-13844.
[54] Zhang, M., Levine, S., and Finn, C. (2022). Memo: Test time robustness via adaptation and augmentation. Advances in Neural Information Processing Systems, 35:38629-38642.
A 2D Example Experiments and Analysis
Figure 7: Theoretical analysis of adaptation under distribution shift. Collapsing or non-collapsing behavior of entropy minimization can be reproduced with a simple 2d Gaussian binary classification example, a domain shift which slightly rotates the data and adds Gaussian noise, and a model which consists of a batch norm layer followed by logistic regression. Top: clean and corrupt data for two classes before (a) and after (b) batch norm. Middle: learning dynamics of entropy minimization in the 2d adaptation parameter space starting from initial parameters (yellow marker) over time. Bottom: accuracy, entropy, and size of adaptation weights over time.
In order to better understand collapse, we constructed a simple 2D Gaussian binary classification example.
Data. The 2D datasets are constructed as follows: the data is sampled by drawing sampled from two Gaussian blobs with identical variance corresponding to the two classes  $\mathcal{N}(\mu_i,\Sigma)$ . For the corrupted case, the data is then rotated by an angle  $\theta$  and combined with additional additive Gaussian noise  $\mathcal{N}(0,\Sigma_{\mathrm{corrupt}})$ . Finally, both in the clean and the corrupt data case, the data is rotated by an angle of  $-\frac{\pi}{4}$  (which minimizes the effect of the batch normalization in the model).
$$
Y \sim \operatorname {B e r} (0. 5) \tag {2}
$$
$$
X \sim \mathcal {N} \left(\mu_ {Y}, \Sigma\right) \tag {3}
$$
$$
X _ {\text {c l e a n}} = R _ {- \frac {\pi}{4}} X \tag {4}
$$
$$
X _ {\text {c o r r u p t}} \sim \mathcal {N} \left(R _ {\theta_ {c _ {1}}} X _ {\text {c l e a n}}, R _ {- \frac {\pi}{4}} ^ {\top} R _ {\theta_ {c _ {2}}} ^ {\top} \tilde {\Sigma} R _ {\theta_ {c _ {2}}} R _ {- \frac {\pi}{4}}\right) \tag {5}
$$
$$
\text {w i t h} \Sigma = \left( \begin{array}{c c} \sigma_ {1} & 0 \\ 0 & \sigma_ {2} \end{array} \right), \quad \sigma_ {1} \gg \sigma_ {2} \tag {6}
$$
$$
\tilde {\Sigma} = \left( \begin{array}{c c} \tilde {\sigma} _ {1} & 0 \\ 0 & \tilde {\sigma} _ {2} \end{array} \right), \quad \tilde {\sigma} _ {2} \geq \tilde {\sigma} _ {1} \tag {7}
$$
$$
R _ {\theta} = \left( \begin{array}{l l} \cos (\theta) & \sin (\theta) \\ - \sin (\theta) & \cos (\theta) \end{array} \right) \tag {8}
$$
Note that for the clean data, we allocate most of the variance to the class dimension,  $\sigma_{1}$ . On the corrupted data, we add noise primarily perpendicular to the class dimension  $(\tilde{\sigma}_{2})$ , which is the main defining factor whether or not we observe collapsing behavior.  $\theta_{c_1} \neq \theta_{c_2}$  serves to break the symmetry between signal and noise in the data, which results in Tent starting to deviate towards the noise direction.
In our example, we parametrize this model as follows: In condition 1,  $\mu_{i} = (\pm 1,0)$  and  $\Sigma^2 = \left( \begin{array}{cc}1 & 0\\ 0 & 0.03 \end{array} \right),\theta = -\frac{\pi}{9}$  and  $\Sigma_{\mathrm{corrupt}}^{2} = R_{\theta_c}^T\left( \begin{array}{cc}0.25 & 0\\ 0 & 4 \end{array} \right)R_{\theta_c}$ , where  $R_{\theta_c}$  is the rotation matrix for an angle of
Figure 8: Analysis of entropy minimization collapse on real data. (a) Consistent with the theoretical analysis in Fig. 7, we find that the adaptation weights in all layers increase over time continually, even long after the collapse as indicated by Accuracy on CCC-Medium has happened. (b) shows a zoomed-in view where this increase is not yet apparent, well after the collapse.
$\theta_{c} = -\frac{\pi}{6}$ . In condition 2, everything is the same except for  $\Sigma_{\mathrm{corr}}^{2} = R_{\theta_{c}}^{T}\left( \begin{array}{cc}0.25 & 0\\ 0 & 25 \end{array} \right)R_{\theta_{c}}$ . In both conditions, we sample 300 000 data points which are equally distributed over both classes.
Model. The classification model consumes the dataset of shape  $N \times 2$  and consists of a batchnorm layer  $(\epsilon = 0)$  followed by a fully connected layer with two input channels, one output channels, no bias term and a sigmoid nonlinearity. Because our data is always centered, we do not learn the offset parameter of the affine adaptation in the batchnorm layer, but only the scale parameter.
Model training. The model is trained to minimize the binary cross-entropy on the clean data. We use batch gradient descent on the whole 300,000 sample dataset with a learning rate of 0.1 and no momentum. We decay the learning rate by a factor of 0.1 after 1000 and 2000 steps and stop training after 3000 steps.
Model Learning and Adaptation. We adapt the model on the corrupted data using Tent. More precisely, we optimize the scale parameter of the batch norm layer to minimize the entropy of the predictions using SGD with a learning rate of 0.01 and no momentum. We process the whole dataset in one batch and adapt for 60 000 steps.
Results. In the toy model, simple cases emerge where the loss does not result in collapse, or vice versa (Fig. 7a and Fig. 7b, respectively), mainly depending on the relation of signal and noise variances and directions.
The toy example furthermore predicts that the adapted parameters of a model should grow on the long run and indeed we were able to find exactly this effect when running ETA on a ResNet50 on CCC-Medium (Fig. 8), suggesting that our minimal setup successfully reproduces the relevant aspects of the large scale case. However, the weight explosion becomes apparent only after the collapse happens, hence weight regularization is not enough to avoid the collapse (Fig. 8(b)).
In the Fig. 7(a) example, we find the direction of high target domain performance and stay there; in this case entropy minimization is stable. In the Fig. 7(b) experiment, the domain shift adds more noise nearly orthogonal to the signal direction, which entropy minimization tries to use for making high confidence predictions: we still initially find the direction of high target domain performance, but traverse this region and continue into a direction of low entropy and low accuracy. This shows that even in a linear example, entropy minimization can show initial performance improvement and then collapse.
B Path Finding Algorithm
Algorithm 1 describes the pseudo code of the algorithm used to generate CCC. The algorithm is based on a set of Calibration Matrices, similar to the one shown in Figure 2. There exists a matrix  $m$  for every  $(n_a, n_b)$  pair, such that  $m[i][j]$  is equal to accuracy of a pretrained ResNet-50 on the
comination of noises  $(n_{a}, n_{b})$ , and severities  $(i/5, j/5)$ . We will release the full set of matrices upon publication.
Additionally, Algorithm 2 uses a function MinValidPath  $(s_1,s_2)$ : this function returns the minimum path that starts at  $(s_1,s_2)$  and ends at  $(0,s_j)$  for some  $s_k$ . The cost of a path is simply the average of all entries along the path. The minimum path is defined as the path with a cost closest to  $b_{a}$  in absolute terms. Lastly, a path is only valid if it starts with  $s_2$  equal to 0, every transition either decreases  $s_1$  by 0.25, or increases  $s_2$  by 0.25, and stops once  $s_1$  is equal to 0.
Algorithm 1 Algorithm used to generate each split of CCC
Require:  $ba,k,T$ $\triangleright$  Baseline accuracy, transition speed, and total split size. 1:  $t = 0$ $\triangleright$  Initialize the total images generated counter 2:  $c_{1},c_{2}\sim$  Uniform(  $\{1\dots 15\}$  ）  $\triangleright$  Initialize the first two corruptions. 3: path  $\leftarrow$  CalculatePath  $(c_{1},c_{2},ba)$ $\triangleright$  Calculate path along the noise pair with an average accuracy closest to ba.   
4: loop   
5:  $s_1,s_2\gets$  path[p]   
6: Subset  $\sim$  Uniform(ImageNetVal)   
7: apply  $(c_{1},s_{1},c_{2},s_{2})$  to Subset   
8: save Subset   
9:  $t\gets k$    
10: if  $t > = T$  then return   
11: end if   
12: if  $p = \mathrm{len}(\mathrm{path}) - 1$  then   
13:  $c_{1}\gets c_{2}$    
14:  $c_{2}\sim$  Uniform({1...14})   
15: path  $\leftarrow$  CalculatePath  $(c_{1},c_{2},ba)$ $\triangleright$  Calculate new path along the new noise pair.   
16:  $p\gets 0$    
17: else   
18:  $p\gets p + 1$ $\triangleright$  Move to the next severity combination   
19: end if   
20: end loop
Algorithm 2 CalculatePath
Require:  $c_{1},c_{2},ba$ $\triangleright$  The 2 noises, and the baseline accuracy   
1:  $m\gets$  CalibrationMatrix  $[c_1][c_2]$    
2: MinPath, MinCost  $\leftarrow$  MinValidPath(0,0,m,ba)   
3: for  $s_1\in 0.25,0.5,0.75,\ldots ,5$  do   
4:  $m\gets$  MinValidPath(1,0,m,ba)   
5: MinPath, MinCost  $\leftarrow$  MinValidPath(s1,0,m,ba)   
6: end for   
7: return MinPath
The resulting dataset features transitions between two different noises like the ones seen in Figure 9 (a). We additionally plot the accuracy of a pretrained ResNet-50, alongside the severities of the different noises in Figure 9 (b).
(b)
Figure 9: (a) Visualization of CCC-Medium's smooth transition between Zoom Blur to Snow. Note: CCC additionally uses random flips and crops, which are not shown here. (b) As CCC transitions between noises, the severities of the first noise (red), and the second noise (blue) go up and down correspondingly, in order to keep the accuracy of a pretrained model stable.
We additionally share the following metadata about the length of traversals in CCC-Easy/Medium/Hard:
Table 6: CCC traversal length statistics, for each CCC split.
Min	Max	Mean	Median
CCC-Easy	11	36	22.8	23
CCC-Medium	21	41	33.9	34
CCC-Hard	41	41	41	41