betaFeedback

WorksComputer Science

Bridging the Gap between Continual Learning and Test-Time Adaptation with Domain Preview

Abstract

Domain shift is a major problem for training machine learning models. While Continual Learning (CL) assumes distribution shift during training and Continual Test-Time Adaptation (CTTA) considers new domains at test time, setups that require explicit online adaptation to domain shift during both phases remain under-explored. We propose continual learning with domain preview (CL-P), a new combination of CL and TTA where both train and test data suffer from distribution shift. The training phase of CL-P is analogous to domain-incremental learning while the testing phase consists of a TTA phase on a future domain (which we call preview), and an evaluation phase on all seen domains. The model must then adapt to new domains at train and test time. In this paper, we evaluate mainstream CL and TTA methods that adapt only at train or test time, as well as their naive combination. Experimentally, TTA heavily damages the domain on which the CL method has just trained and increases forgetting. Notably, this damage mostly comes from the BatchNorm statistics shared by all domains. In that sense, we propose DOSE (Dosing by Online Statistics of Each domain), which allows a seamless combination of any CL and TTA methods by adaptive domain inference at test time, where the adaptation is applied to each image in proportion to the probability that it comes from the preview domain. Through extensive experiments with ResNet and ViT backbones, various combinations of CL and TTA baseline methods and datasets considering diverse domains, we show that DOSE matches or improves on CL methods alone in all 24 settings and on the naive combination in all but one. The code can be found in appendix.

Introduction

Continual learning (CL) and test-time adaptation (TTA) are well-established paradigms in machine learning. Usually studied separately, they both tackle the more generic problem of domain shift. In domain-incremental CL, a model trains on a sequence of labeled domains and is evaluated on how well it retains what it has learned. In continual TTA (CTTA), a pretrained model adapts online to a changing stream of unlabeled data [30, 31, 51]. However, in real-world applications, a model can face both kinds of shift. An image classifier, for example, may start receiving images from a new camera before anyone has labeled them, while images from earlier cameras keep coming in. Until these labels arrive, the same deployed model must classify the images of every camera, so that its accuracy on the new camera and on the earlier ones matters during this delay, and not only after the next training phase.

We introduce continual learning with domain preview (CL-P) to study how CL and TTA methods interact in this situation (Figure 1). Specifically, each task consists of three phases. During the training phase, the model is trained on a labeled domain with any CL method. During the preview phase, it receives an unlabeled stream from the domain it will train on next, and can adapt to it online with any TTA method [33, 34, 49]. Finally, during the evaluation phase, the adapted model is evaluated on all domains seen so far, including the preview one. Similarly to label delay [10], data thus arrive before their labels, except that the delay here spans a whole domain.

Figure 1. Continual learning with domain preview. Top: CL trains on labeled domains in sequence and is evaluated on all seen domains. Middle: CTTA adapts a trained model to a stream of unlabeled domains and is evaluated on this stream. Bottom: our setup consists of three phases per task, namely training on a labeled domain, preview, where the model adapts online to the unlabeled next domain, and evaluation on all domains seen so far.

On the one hand, CL methods alone have to rely on generalization when they encounter the preview domain, since they have yet to train on that domain. Naturally, their performance on the preview domain stays far below what they reach once they have trained on this domain with labels (Table 1). On the other hand, TTA methods can use the unlabeled preview immediately. While they improve accuracy on the preview domain, applying the adapted model to every image can drastically reduce performance on the domain the model has just trained on. The direct combination of CL and TTA methods (CL + TTA) therefore helps on the preview domain, at the cost of accelerated forgetting across tasks.

FT (no buffer)ER (200 images)
oldnewdmg.forg.oldnewdmg.forg.
no TTA50.630.4–34.165.943.2–11.5
+TTA39.356.4−27.536.642.355.7−25.232.9
DOSE58.655.1−0.524.665.755.1−0.211.8
Oracle64.756.7−0.610.964.755.9−2.611.1
Trained71.571.1

Table 1. CL and TTA methods do not combine well out of the box. Accuracy (%) of a ResNet trained with FT (no buffer) or ER (buffer of 200 images), averaged over the six benchmarks of § 6.1, with mixed evaluation batches. No TTA: the CL method alone. +TTA: the naive combination, where the network adapted by a TTA method during the preview predicts every image. Each +TTA and DOSE number is the median over the TTA methods run on each benchmark that keep every core component (up to 18, Supp. Sec. C.1). Old, new: accuracy on the trained and preview domains. Dmg.: latest-domain damage (§ 3.3), in points. Forg.: forgetting, the drop of a trained domain between the end of its task and the last task. Oracle: +TTA when each evaluation batch holds a single domain and is normalized with its own statistics (two TTA methods). Trained: the preview domain once trained on with labels.

Experimentally, we find that most of this damage comes from the BatchNorm statistics, which are shared by all domains and re-estimated by TTA methods on the preview.

Notably, in our setup, the training phase and the preview each contain images of a single domain, so the statistics of every domain can be recorded separately. Therefore, we propose DOSE (Dosing by Online Statistics of Each domain), which decides for each test image how much of the preview adaptation to use. Specifically, DOSE compares a few statistics of the early-layer features of the image with the statistics recorded for every domain seen so far, and weights the adaptation by the probability that the image comes from the preview. Our contributions are as follows:

  • We introduce continual learning with domain preview, a setup that brings online supervised continual learning and test-time adaptation into the same sequence of tasks.

  • We analyze the strengths and limitations of CL and TTA methods as well as their naive combination in our setup, and show that most of the damage of TTA comes from shared normalization statistics.

  • We propose DOSE, a plug-in that estimates whether each image comes from the preview domain and weights the TTA update accordingly.

  • We evaluate DOSE on six benchmarks with ResNet and ViT backbones, four CL methods and 20 TTA methods, and show that it matches or improves on the CL method alone in all 24 settings and on CL + TTA in all but one.

Related work

Continual learning. In domain-incremental learning [47], regularization [23, 27], replay [4, 6] and prompt-based methods [43, 52, 53] limit forgetting, but assume that the labels of a domain are available when it is first met. Label delay [10] relaxes this assumption in online CL, but its unlabeled data are the latest batches of the same stream, so that the effect of adapting to a new domain on the domains already learned is not measured.

Test-time data in continual learning. DoSAPP [42] interleaves supervised sessions with unsupervised ones on test data from classes already seen, while ARC [7] corrects at test time the bias of the classifier towards recent classes. Both use test-time data to retain the past, not to adapt to a domain that has not been trained on yet (Supp. Tab. 4).

(Continual) test-time adaptation. TTA adapts a source model to unlabeled target batches. It re-estimates normalization statistics [26, 41], minimizes entropy [49], filters samples [33, 34], adjusts the classifier [2, 22] or restricts the updated layers [25]. Continual TTA [3, 11, 15, 24, 30, 31, 35, 38, 51, 55] adapts to a sequence of target domains and fights error accumulation, while prompt- and adapter-based variants [14, 29, 56] add extra parameters. These methods are evaluated on the domain currently streamed, and sometimes on the source domain [33], but never on a sequence of trained domains that a CL method keeps updating. Most of them also normalize with the statistics of the test batch, so their predictions depend on how a batch is composed, as NOTE [15] shows. Reservoir TTA [48] routes each test sample to one of several adapted models by online clustering of style features, but all its domains are adapted from a fixed source model and never trained on with labels.

Per-domain normalization and experts. Keeping normalization statistics per domain is a known remedy for domain shift. DSBN [5] needs the domain of each test image, AdaBN [26] re-estimates the statistics on one target domain and UnMix-TNS [46] mixes several statistics per image within one domain. In domain-incremental learning, S-Prompts [52] infers the domain of a test image from feature centroids and other methods select a domain expert by test-time training [45], but all of them learn each domain from its labels before it is evaluated. Continual unsupervised domain adaptation [8, 40, 44] adapts to a sequence of unlabeled domains offline, with no later supervised task.

Continual learning with domain preview

In this section, we recall the CL and CTTA setups, then show how our setup, continual learning with domain preview (CL-P), combines them and why it requires its own evaluation protocol.

Setup

Preliminaries. Throughout this paper, a domain refers to a distribution of images sharing the same label space but differing in appearance or content, such as images corrupted by fog, paintings, or images taken by a specific camera. In domain-incremental learning (DIL), a learner encounters domains 0,1,…,T0, 1, \ldots, T sequentially. At each task tt, it is trained on the labeled set Dttr\mathcal{D}^{\mathrm{tr}}_t and then evaluated on held-out sets Djte\mathcal{D}^{\mathrm{te}}_j of all domains j≤tj \le t. In contrast, continual TTA (CTTA) considers a trained model that adapts online to a stream of unlabeled batches whose domain changes over time, and evaluates it on this stream. We call a batch single-domain when all its images come from the same domain, and mixed when its images come from several domains.

Continual learning with domain preview lies in between these two paradigms, where each task consists of three phases (see Figure 1).

Training phase. During the training phase, the learner is trained on Dttr\mathcal{D}^{\mathrm{tr}}_t with any CL method, as in DIL. Its batches are single-domain, unless the CL method replays images of older domains from a buffer, in which case they are mixed.

Preview phase. During the preview phase, the learner receives an unlabeled stream Dt+1u\mathcal{D}^{\mathrm{u}}_{t+1} from domain t+1t+1, which the next task will train on, and it can adapt to this stream with any TTA method. The preview thus lets the model adapt to a new domain as soon as its first images arrive, instead of waiting for their labels. Notably, all preview images come from this single new domain, so that the preview batches are single-domain, which is exactly what TTA usually assumes. However, we consider that TTA methods are only applied during the preview phase. The motivations behind this restriction are twofold: 1) TTA methods require additional computation at test time, which we consider limited in an online setup, and 2) TTA methods require test data to come from one unique domain which does not differ significantly from the training domain (see [31, 34, 46] and § 4), which cannot be guaranteed outside the preview phase.

Evaluation phase. Finally, during the evaluation phase, the learner is evaluated on all trained domains j≤tj \le t as well as on the preview images, before the labels of domain t+1t+1 arrive. Since the domain of a test image is unknown in real-world scenarios, the evaluation batches are mixed (§ 3.2).

Online data. As in online CL with label delay [10], images arrive faster than they can be labeled. Each training image is presented once in the CL stream, with replay allowed for buffer-based methods. Each preview stream is processed in one pass, and each preview batch is predicted upon arrival1. Some TTA implementations additionally revisit unlabeled source training images to initialize auxiliary statistics (Supp. Sec. C.1). Evaluation labels and the domain identities of evaluation images are unavailable. The boundaries of the training and preview phases are known, and each preview contains only the next domain.

Evaluation protocols

BatchNorm statistics. A BatchNorm layer [21] normalizes each channel of its input with a mean and a variance, then applies a learned affine map. During training, it normalizes with the statistics of the current batch and keeps a running average of them, which it stores and uses at test time. Therefore, the stored statistics of a network describe the data it was trained on, and every domain is normalized with them. On networks with BatchNorm, most TTA methods re-estimate the normalization statistics on the test data, which brings most of their gain [41, 49]. In our setup, TTA thus replaces the statistics shared by all trained domains with those of the preview. Therefore, we consider two protocols, which differ in the statistics used to normalize the evaluation images.

Test-batch protocol. In the test-batch protocol, which is common in TTA, each image is normalized with the statistics of its evaluation batch, so that its prediction depends on the other images of the batch. While each batch holds a single domain in CTTA, the domain of a test image is unknown1: Several passes over the preview or storing it would turn it into offline source-free adaptation [28]. Three training epochs per task give the same gains (Supp. Sec. H.11). in real-world scenarios. Therefore, each evaluation batch in our setup is drawn from the shuffled union of all evaluated sets (Supp. Sec. B), and its statistics mix several domains, which can make this usual TTA strategy counter-productive.

Batch-independent protocol. Moreover, normalizing with the evaluation batch is itself a form of adaptation to the test data. In contrast, our main batch-independent protocol forbids this for all methods. In particular, the naive combination of CL and TTA methods (CL + TTA), which predicts every image with the network adapted during the preview, normalizes with the statistics estimated during the preview. In that sense, no prediction depends on the rest of its batch, and mixed and single-domain batches give the same score. We report both protocols, and every method is always given the same statistics.

Metrics

The ultimate objective is to maximize performance on all seen domains, namely the training and preview domains.

Score. Therefore, as usual in CL, we average the accuracy over all domains seen so far, which here include the preview domain. In particular, all domains, including the preview one, are evaluated after the preview with the same model, unlike the online accuracy usually reported in CTTA. This score measures post-preview performance rather than prediction accuracy when each image first arrives. Online preview accuracy is reported separately in Supp. Figure 4, and held-out preview-domain evaluation is reported in Supp. Tab. 22. Let aj(t)a_j(t) be the accuracy on DjteD_j^{\mathrm{te}} after the preview of task tt, and n(t)n(t) the accuracy on Dt+1uD_{t+1}^{\mathrm{u}} after adaptation. The score of a run is then

Figure 4. Along the 14-domain streams (ER, Tent, mixed batches). (A) Accuracy on the trained domains after each preview. (B) Online accuracy on the preview domain during its stream. Each preview batch is predicted before the adaptation on that batch: Tent predicts it, normalized with its own statistics, then updates on it. DOSE and CL + TTA share these online predictions, and the CL method alone predicts with its unchanged network.

A=1T∑t=0T−11t+2(∑j≤taj(t)+n(t)).(1)A = \frac{1}{T} \sum_{t=0}^{T-1} \frac{1}{t+2} \left(\sum_{j \le t} a_j(t) + n(t)\right). \tag*{(1)}

Old and new accuracy. To disentangle stability and plasticity, we decompose the accuracy into its old part (the trained domains) and its new part (the preview domain).

Forgetting and latest-domain damage. As usual in CL, the forgetting of a trained domain is the drop of its accuracy between the end of its task and the last task, averaged over the trained domains. Finally, to measure how the preview affects freshly learned knowledge, we define the latest-domain damage as at(t)−at∗a_t(t) - a_t^*, where at∗a_t^* is the accuracy on domain tt right after its training phase. In other words, this is the immediate forgetting caused by the adaptation during the preview.

Limitations of existing approaches in CL-P

In this section, we analyze how existing CL and TTA methods, as well as their naive combination, behave in our setup. We describe the main trends here, while § 6 introduces the benchmarks and gives the detailed results. Table 1 summarizes these trends on ResNets. Since the conclusions hold for most TTA methods, each of its numbers is the median over the TTA methods we run that keep every core component, then averaged over six benchmarks, rather than the result of a single combination of CL and TTA methods.

CL methods ignore the preview domain. Naturally, CL methods are never exposed to the preview domain during training, and they keep their weights unchanged during the preview phase. In that sense, they do not adapt to the preview and rely solely on their generalization capabilities when evaluated on the preview domain. As a result, CL methods alone stay far below on the preview domain what they reach once they have trained on it with labels (Table 1). While ViTs generalize better across domains, this gap remains large (Supp. Sec. G.1).

TTA damages the trained domains. While various TTA strategies exist, the main idea is generally to adapt the normalization statistics (such as those of BatchNorm) or some model weights, using the unlabeled test data. In our setup, TTA is applied during the preview phase, where it updates the model on the fly for the preview domain. Specifically, when the adapted network is then used for every image with the statistics estimated on the preview, the accuracy on the preview domain rises sharply (Table 1). While this is especially beneficial for this domain, it comes at the cost of performance on the previously learned domains, and above all on the domain just learned, while forgetting also increases. The cause is that all domains share the BatchNorm statistics (§ 3.2). TTA methods re-estimate them on the preview, and an old image normalized with the statistics of another domain is misclassified. This is usually referred to as forgetting of the source domain in CTTA [33, 51], except that here it affects what the CL method has just learned. As a result, naively combining CL and TTA methods performs worse than the CL methods alone on average, even though it improves on the preview domain (see § 6.2 for a detailed comparison).

Test-batch statistics are not a solution. Since the damage comes from the BatchNorm statistics, a naive fix is to normalize each evaluation batch with its own statistics, as TTA methods do on their test stream [41, 49]. Old images then bring the statistics of their own domains, which reduces the damage a lot without removing it (Supp. Tab. 9). However, this adapts to the evaluation data (§ 3.2), and statistics estimated from a mixed batch fit no domain in particular, so that the same model scores clearly higher with single-domain batches (Supp. Tab. 29), whose composition cannot be chosen in practice.

Separate statistics would remove most of the damage. Interestingly, most of the damage of TTA comes from normalizing the images of every domain with the statistics of a single domain, namely those that TTA estimated on the preview. Specifically, when each evaluation batch holds a single domain and is normalized with its own statistics (Oracle), each image is normalized with the statistics of its own domain. In that case, the naive combination barely damages the domain just learned, and memory-free CL forgets about as little as a ViT, which keeps no domain statistics (Oracle in Table 1). While test images cannot be sorted by domain in practice, the training phase and the preview of our setup each contain a single domain.

Limitations. Overall, two limitations remain. On the one hand, the domain of a test image is unknown, so that the naive combination adapts every image. On the other hand, all domains share a single network, whose statistics and parameters only fit one domain at a time. Therefore, a method for our setup should infer the domain of each image without labels, and give each image the statistics and parameters of its domain, without storing images.

Dose: Dosing by Online Statistics of Each domain

In this section, we present Dosing by Online Statistics of Each domain (DOSE) which builds onto the analysis of § 4. The main motivation is to find an efficient inference policy that allows leveraging TTA methods without interfering with the CL training scheme that can easily be plugged into the pipeline. To do so, DOSE combines a domain detector, described in § 5.1, which infers the domain of each test image, and an adaptive model, described in § 5.2, which sets the statistics and parameters used for each image from those learned by CL and TTA and from the detected domain. An overview of the methodology is given in Figure 2.

DOSE overview

Figure 2. DOSE. (a) During training, the frozen first block of the initial network gives the recorded statistics of domain tt, while a bank stores the BatchNorm statistics of each domain for memory-free CL. (b) TTA adapts online, while DOSE records the statistics of the preview and builds prototypes from the predictions of TTA. (c) For any image, the posterior over the recorded statistics gives λ\lambda, which weighs the branch of the preview and the prototypes.

Domain detection

By definition of our setup (§ 3.1), the training phase and the preview each hold a single domain, so that the statistics measured during each of them describe one domain. We consider two kinds of domain shift. On the one hand, low-level shifts, such as a new camera or a change of weather, change the statistics of the pixels. On the other hand, semantic shifts, such as paintings instead of photos, change the content of the images, which appears in the statistics of their features. Therefore, for each image xx, DOSE computes a vector s(x)s(x) that captures both, namely the channel means and log-variances of the network input, for the pixels, and of the output of the first block (ResNet first stage, ViT patch embedding) of a frozen copy of the initial network, for the features. The recorded statistics of a domain are the mean and variance of s(x)s(x) over its training images, or over the preview stream, which form a diagonal Gaussian of a few kilobytes. The copy is frozen because the trained network changes at every task, so that statistics recorded at one task would no longer describe its features at a later task.

For a test image xx, DOSE then infers the domain from the recorded statistics. Under a uniform prior over the recorded domains (the preview, the latest domain tt and every older one), the posterior is

P(d∣x)=exp⁡ℓd(x)∑d′exp⁡ℓd′(x),λ(x)=P(preview∣x),(2)P(d \mid x) = \frac{\exp\ell_d(x)}{\sum_{d'} \exp\ell_{d'}(x)}, \qquad\lambda(x) = P(\mathrm{preview} \mid x), \tag*{(2)}

where ℓd\ell_d is the log-likelihood of s(x)s(x) under the recorded statistics of domain dd. Nothing is calibrated and no label is read. Every domain keeps its recorded statistics, since an old image that resembles neither the latest domain nor the preview must still be recognized as old.

Dosing the adaptation

Since all domains share a single network (§ 4), DOSE assembles for each test image the network of its domain from what CL and TTA have learned. While the TTA method adapts online on the preview, DOSE keeps the BatchNorm statistics (μP,σP2)(\mu_{\mathrm{P}}, \sigma_{\mathrm{P}}^{2}) that it estimates on the stream and the affine parameters (γad,βad)(\gamma_{\mathrm{ad}}, \beta_{\mathrm{ad}}) that it fits under them. For an activation hh of xx, each BatchNorm layer then returns

λBN⁡(h;μP,σP2,γad,βad)+(1−λ)BN⁡(h;∑kqk(μk,σk2),γtr,βtr),(3)\lambda\operatorname{BN}(h; \mu_{\mathrm{P}}, \sigma_{\mathrm{P}}^{2}, \gamma_{\mathrm{ad}}, \beta_{\mathrm{ad}}) + (1-\lambda) \operatorname{BN}\left(h; \sum_k q_k(\mu_k, \sigma_k^{2}), \gamma_{\mathrm{tr}}, \beta_{\mathrm{tr}}\right), \tag*{(3)}

where (γtr,βtr)(\gamma_{\mathrm{tr}}, \beta_{\mathrm{tr}}) are the affine parameters of θtr\theta_{\mathrm{tr}}, (μk,σk2)(\mu_k, \sigma_k^{2}) are the statistics of the trained domain kk, and the weights qk=P(k∣x)/(1−λ)q_k = P(k \mid x)/(1-\lambda) mix them by moment matching, because old domains also differ from each other. In Eq. (3), λ=0\lambda= 0 selects the trained-domain BatchNorm branch, whereas λ=1\lambda= 1 selects the preview-domain branch. These endpoints do not generally reproduce CL alone or CL + TTA for the complete system because of the statistics bank, shared parameter changes, and prototype correction. Statistics and affine parameters are dosed together, because TTA fitted γad,βad\gamma_{\mathrm{ad}}, \beta_{\mathrm{ad}} under the statistics of the preview. The dose is soft, so that no threshold is needed. Since DOSE keeps θtr\theta_{\mathrm{tr}} for this branch, the next task starts from θtr\theta_{\mathrm{tr}}, so that TTA changes the predictions of DOSE but never the network that the CL method keeps training (Supp. Sec. H.2).

Statistics of the trained domains. The second branch of Eq. (3) needs the statistics of each trained domain. The latest domain uses the statistics stored in θtr\theta_{\mathrm{tr}} during its training phase. With a replay buffer, the training batches are mixed, so that these statistics remain a mixture of all trained domains and also serve the older ones. Without a buffer, they follow the latest domain only, while normalizing the older domains with the statistics of the preview instead, as CL + TTA does, makes their accuracy collapse (Supp. Tab. 21). Therefore, without a buffer, DOSE keeps a bank, namely a copy of the mean and variance of every BatchNorm channel of θtr\theta_{\mathrm{tr}} at the end of each training phase. It stores no image, only these two numbers per channel and per trained domain. However, the bank can become outdated. Unlike the recorded statistics, which come from a frozen network, it describes the activations of the trained network, which the CL method keeps updating after task kk. The images of domain kk then no longer match the statistics stored for them, and where the recorded statistics cannot separate the domains, always keeping the bank can score below the CL method alone. Therefore, a bank check decides at each task whether to keep the bank. Since storing labeled images would break memory-free CL, it follows the test-then-train scheme of online CL, where each of the last 200 training images of the task is first predicted with and without the bank, then trained on. The bank is dropped only if it is significantly less accurate, under an exact one-sided sign test at 5% on the images that exactly one of the two classifiers correctly. No image is kept, and 200 is the size of the replay buffer of our experiments (§ 6.1).

Parameters outside BatchNorm. TTA methods also change parameters outside BatchNorm, such as the LayerNorm layers [1] of a ViT or the convolution weights [3, 51], which can damage the old domains. With a replay buffer, a shared-parameter check predicts the buffer images after each preview with these changes either shared by every image or dosed like the statistics, and doses them only if this is significantly more accurate under the same test. Without a buffer, the changes are shared as in CL + TTA.

Classifier of the preview domain. The preview domain has no classifier of its own yet, so DOSE builds class prototypes μc\mu_c online from the stream, as the class sums of the features of the preview images weighted by their prior-corrected soft labels [39]. They get the weight of the branch of the preview in the head, log⁡p+λcos⁡(z,μc)/τ\log p + \lambda\cos(z,\mu_c)/\tau with τ=0.05\tau= 0.05, and matter most on ViTs (Table 3).

variantTF/InetDNC20ViT-B/16 TF/Inet/C20ViT-B/16 DN
DOSE (score)73.147.666.383.964.2
Domain detection
only the latest domain’s recorded statistics−8.3+1.7+0.2+0.1+0.2
statistics recorded on θt\theta_{\mathrm{t}}, every layer−1.1+0.1−0.1+0.3+0.3
statistics recorded on the frozen last block−2.0+0.70.0+0.4+0.3
true domain given (oracle)−0.3−0.7+0.2+0.5+0.4
Adaptive model
hard dose (per-domain BatchNorm)0.00.0−0.10.00.0
no bank−6.4−1.30.00.00.0
bank always, without bank check+0.3−1.2−2.50.00.0
no prototype−0.2−0.2−0.3−0.6−0.6

Table 3. Ablations. Score of DOSE, then the difference of each variant to it in points (Tent and ROID, ER and FT averaged, paired by seed). Gray: within 0.5 points. TF/Inet: C100-TF and Inet-TF. Further ablations are reported in Supp. Tab. 20.

Experiments

Experimental setup

Benchmarks. Since no existing benchmark provides the three disjoint sets of each domain (§ 3.1), we build six benchmarks (Supp. Tab. 8 and Sec. F) that cover the two kinds of shift of § 5.1. Low-level shifts change the statistics of the pixels, which is what TTA was designed for. C100-C and IN-C follow the 15 corruptions of CTTA [17, 51] on CIFAR-100 and ImageNet (14 tasks), while C100-TF and Inet-TF (on Imagenette) start from clean images, followed by five strong corruptions (5 tasks). Semantic shifts change the content of the images, as in domain-incremental CL. C20 changes the sub-class of each of the 20 super-classes of CIFAR-100 at every task, while DomainNet [36] changes the style across six domains. On ViTs, we also use ImageNet-R [19] and ImageNet-A [20].

Backbones and CL methods. As backbones, we use ResNets (a ResNeXt-29 and a ResNet-50), whose BatchNorm layers are the source of the damage of § 4, and a ViT-B/16, which uses LayerNorm. The main CL methods are experience replay with a buffer of 200 images (ER) [6], a strong baseline of online CL, and fine-tuning without any buffer (FT, memory-free), for applications that cannot store images (Supp. Sec. E). We select one CL learning rate per backbone on validation streams of other benchmarks, which share neither the images nor the kind of shift of the evaluated one, and keep it fixed during evaluation (Supp. Sec. D), unlike online CL that adapts it [32]. TTA settings and implementations changes are detailed in Supp. Sec. C.

TTA methods. We run 20 TTA methods using implementations adapted to CL-P, with method-specific changes documented in Supp. Sec. C.1. Tables 1 and 2 report the median over the 18 implementations (13 on ViTs) that keep every core component of the original method, and the other analyses average Tent [49] and ROID [31], which are typical (Supp. Sec. G).

Baselines. We compare DOSE with two baselines that use the same CL and TTA methods. The CL method alone (no TTA in the tables) ignores the preview and predicts every image with the network θtr\theta_{\mathrm{tr}} that it has trained. The naive combination CL + TTA (+TTA in the tables) runs the TTA method during the preview, predicts every image with the adapted network, as TTA methods are usually deployed, and starts the next task from this network, while DOSE starts it from θtr\theta_{\mathrm{tr}} (§ 5.2).

Protocol. Unless stated otherwise, we use the batch-independent protocol, and every evaluation batch mixes all evaluated domains (§ 3.2). All numbers are averaged over 5 seeds, and gains are tested with a paired tt-test (Supp. Tab. 10).

Main results

The naive combination is worse than ignoring the preview. Table 2 gives the scores, and Supp. Sec. G.1 gives the numbers behind the trends of § 4. On ResNets, CL + TTA is below the CL method alone by 1.8 points without memory and by 14.3 points with a buffer (Table 2), and it is below in 11 of the 24 settings, although TTA raises the preview domain by up to 26 points (Table 1). In contrast, DOSE is at least as good as the CL method alone in 24 of 24 settings, by 7.7 points on ResNets and 0.9 points on ViTs on average, and above CL + TTA in 23 settings, by 15.7 and 0.6 points. Method by method, it is at least as good as CL + TTA in 280 of 304 pairs of method and setting, and the medians over TTA methods in Table 2 are never more than 0.1 points below the CL method alone. Individual combinations can perform substantially worse: on C100-C with ViT and CoTTA, DOSE is 62.6 points below CL alone with FT and 9.7 points below with ER (Supp. Tab. 15). Taking the median over methods for each seed, the gain is significant (p<0.05p < 0.05, paired tt-test) in 21 of 24 settings against the CL method alone and in 23 against CL + TTA (Supp. Tab. 10). The appendix also gives the test-batch protocol, held-out and balanced scores, other CL methods and segmentation (Supp. Tabs. 22, 23 and 29 and Secs. H.4 and H.5).

ResNet, FTResNet, ERViT-B/16, FTViT-B/16, ER
no TTA+TTAOursno TTA+TTAOursno TTA+TTAOursno TTA+TTAOurs
C100-C48.644.060.764.746.365.965.666.567.069.069.169.5
C100-TF49.748.566.463.151.668.973.473.874.675.275.776.4
C2063.764.163.968.168.168.676.977.077.979.179.279.9
DomainNet39.137.243.551.139.351.162.862.763.463.964.064.7
Inet-TF42.140.776.770.842.780.095.795.896.196.095.996.3
IN-C17.115.322.331.815.934.350.752.652.856.456.757.3
Mean43.441.655.658.344.061.470.871.472.073.373.474.0

Table 2. Score A (Eq. (1), %) of the CL method alone (no TTA), CL + TTA and DOSE. +TTA and Ours: medians over the TTA implementations that keep every core component of the original method (18 on ResNets and 13 on ViTs, 8 and 6 on C100-C and IN-C, Supp. Sec. C.1, every method and the strict single-pass ones in Supp. Tab. 11). +TTA uses the statistics estimated during the preview, and no method reads the evaluation batch. Bold: best method.

Where the gain comes from. DOSE without a TTA method (Supp. Tab. 19) applies the recorded statistics, the bank and the prototypes to the network that TTA never adapted, which amounts on ResNets to per-domain Batch-Norm with the inferred domain. It gives 3.7 of the 7.7 points that DOSE gains over the CL method alone on ResNets (up to 20.4 on Inet-TF without memory), and TTA adds the other 4.0 (up to 14.2), while on ViTs the two parts give 0.4 and 0.5 points. TTA provides an additional gain on average, although the benefit depends on the method and setting. Hard dosing with the inferred domain performs within 0.1 points of soft dosing in our ablation (Table 3). These results support domain-specific statistics and routing as important components, but do not establish a substantial advantage of soft over hard dosing. TTA lowers DOSE in two settings, by at most 0.4 points. Notably, Continual Normalization [37], a BatchNorm-aware CL method, does not replace the recorded statistics (Supp. Tab. 36).

Memory-free CL gains the most. Without storing any image, FT with DOSE reaches 76.7 on Inet-TF and 66.4 on C100-TF, above ER alone with its replay buffer (70.8 and 63.1), since the recorded statistics and the bank give each domain its own statistics. More generally, the gain follows what TTA can learn, with 10.9 points on corruptions and 2.2 on the style shift of DomainNet on ResNets. On C20, whose sub-class domains the recorded statistics cannot separate, the bank check drops the bank, and DOSE achieves accuracy close to the CL method alone (63.9 against 63.7 without memory).

ViTs show smaller aggregate gains in our setting. On ViTs, TTA barely changes the score of the CL method alone (+0.6 and +0.1 points), while DOSE gains 0.7 to 1.0 points on every type of shift and ties it on ImageNet-R and ImageNet-A (Supp. Tab. 24). Although TTA gains up to 15 points on corrupted previews, the preview only weighs 0.17 to 0.29 of the score (Supp. Sec. H.9). DOSE runs at 840 to 2,900 images/s on ResNets (CL + TTA: 1,250 to 4,300) and 260 to 269 on ViTs (265 to 275, Supp. Tab. 25).

Ablations

In Table 3, we present an ablation of our proposed approach by changing one part of DOSE at a time.

Domain detection. Without knowing the domain, DOSE matches per-domain BatchNorm given the true domain within 0.7 points, while keeping only the recorded statistics of the latest domain costs 8.3 points on C100-TF and Inet-TF, since old images are then taken for the preview.

Adaptive model. Without a buffer, removing the bank costs 5.9 points on C100-TF and 19.6 on Inet-TF, while always keeping it, without the bank check, costs 4.9 points on C20, which then falls below the CL method alone.

Limitations and conclusion

Limitations. This work presents an attempt at combining CL and TTA. However, the proposed setup could be expanded further. Namely, we only studied the online case, with one epoch of training and one pass over a preview of a few thousand images per task. This limitation is even more apparent with ViTs, as TTA gains increase with preview length (Supp. Fig. 3), or the number of adaptation updates. Moreover, while the bank stores no image, the bank check that decides whether to use it relies on the last 200 training images of each task, which are not selected and only come from the latest domain. It can therefore drop a bank that would help the older domains, and it cannot see damage that appears on older domains only, as in memory-free segmentation. In addition, DOSE assumes that the preview only holds the new domain. This allows us to isolate domain-specific statistics, but future setups should consider multi-domain previews. Fortunately, DOSE remains competitive even in such scenarios as we briefly explored in appendix Supp. Sec. H.8. Where domains differ by content rather than appearance, the recorded statistics cannot separate them, and DOSE may offer little benefit over the CL method alone. Finally, DOSE only fixes how TTA is combined with CL, and it does not change how the CL method itself targets. Future work should investigate how to provide an end-to-end method that does both TTA and CL.

Conclusion. In this work, we introduced CL-P, a new setup that aims to combine CL and TTA. In real-world applications, a model can see the next domain before its labels arrive. TTA methods can use this preview, but on backbones where every domain shares the BatchNorm statistics it costs the domains the CL method has just learned. DOSE controls adaptation using estimated domain membership and improves aggregate performance in most evaluated settings. Longer previews, sample selection for mixed previews and recorded statistics that see content shifts are the next steps.

LLM Usage Statement

We used an LLM to produce part of the code that was fully reviewed. In the paper, the LLM was used to write a placeholder text in order to organize the sections but was fully rewritten. Finally, an LLM was used to format the result tables.

Supplementary material

This appendix compares our setup with the closest ones (Sec. A), lists every component of DOSE with its settings and cost (Sec. B), how the baselines are run (Sec. C), the selection of the CL learning rates (Sec. D), the datasets (Sec. F) and complete results (Sec. G). All numbers are percentages unless stated otherwise; “score” is AA of Eq. (1). The tables are generated from the runs by the released scripts.

Comparison with related setups

Table 4 compares CL-P with the setups that are the closest to ours. On the one hand, CTTA, continual unsupervised domain adaptation and initially labeled streams adapt to new domains without labels, but they never receive the labels of these domains, so that no CL method trains on them afterwards. On the other hand, label delay, DoSAPP and ARC combine supervised training with unlabeled data. However, in label delay, the unlabeled data are the latest batches of the same stream, and the model is evaluated on these batches only. In DoSAPP and ARC, the unlabeled data come from classes already seen, and they serve to retain the past. Therefore, CL-P is the only setup where the unlabeled data come from a whole domain that the model will train on next, and where the adapted model is evaluated on every trained domain as well as on this domain.

SetupLabeledUnlabeledLabels laterAdaptationEvaluation
Domain-incremental CL [47]sequence of domainsnonen/an/aall seen domains
CTTA [31, 51]source domain onlystream of new domainsneveronlinecurrent stream
Continual UDA [8, 40, 44]source domain onlysequence of new domainsneveroffline, several epochsseen domains
Initially labeled streams [13]first batch onlydrifting streamneveronlinecurrent stream
Label delay [10]same stream, dd steps latelatest batches of the streamafter dd stepsonlinelatest batch
DoSAPP [42]sequence of tasks (class-inc.)test data of current and seen tasksneverunsupervised phase after each taskall seen tasks
ARC [7]sequence of tasks (class-inc.)test data of seen classesneverat test timeall seen classes
CL-P (ours)sequence of domainsnext domain, before its labelsat the next taskonline, before training on itall seen domains, including the preview one

Table 4. Setups close to ours. Labeled: data used for supervised training. Unlabeled: data the model adapts to without labels. Labels later: whether these data are labeled afterwards. Evaluation: data on which the reported accuracy is measured. Class-inc.: class-incremental.

Components, settings and costs of Dose

CL training. ER with a reservoir buffer of 200 images (FT: none), one epoch per task, training batch 10, replay batch 64, Adam without weight decay; learning rate 3⋅10−53 \cdot10^{-5} (ResNet), 10−510^{-5} (ViT), selected on validation (Sec. D), CODA-Prompt 10−310^{-3} (official); ViT: gradient checkpointing, inputs resized to 224. DER++: α=0.1\alpha= 0.1, β=0.5\beta= 0.5. TTA stream batch size 100 (ResNet; DomainNet 64) or 64 (ViT); evaluation batch 100 / 64 / 32.

Hardware. The experiments ran on NVIDIA A4500, RTX 2080 SUPER, RTX 3080, RTX 5070, RTX A1000 and RTX PRO 6000 GPUs with PyTorch 2.6 to 2.8. Systems that are compared share the configuration and the seeds of their runs.

Preview pass. The TTA method is re-initialized from θtr(t)\theta_{\mathrm{tr}}(t) and run online, one pass over the shuffled preview, with its official optimizer (Sec. C).

Recorded statistics (domain posterior). Frozen copy of the initial network, pruned to its first block (ResNet first stage, ViT patch embedding). Per image, the moment vector s(x)s(x): channel means and log-variances of the network input and of the output of this block. The recorded statistics of a domain are the running mean and variance of s(x)s(x) (parallel update of Chan et al.) over its images: a trained domain’s over its last 1000 training images, accumulated during its training stream with a no-gradient forward; the preview’s over the preview stream, on the forward the prototype step already runs, prequentially. Posterior: diagonal Gaussians, uniform prior over the preview, the latest domain and every older domain (--dose-rule posterior --dose-sensors stem0 --dose-domains all).

Dosing (BatchNorm). Equation (3) in every BatchNorm layer, per image: the preview’s statistics (exponential average during the preview, momentum 0.1) with the adapted affine parameters, against the trained domains’ statistics mixed by moment matching (mixture mean and variance) with θtr\theta_{\mathrm{tr}}’s affine parameters. Trained domains’ statistics: latest domain, θtr\theta_{\mathrm{tr}}’s stored statistics; older domains with a buffer, the current stored statistics; without a buffer, the bank: θtr\theta_{\mathrm{tr}}’s stored statistics at the end of each domain’s task, two numbers per channel (0.2 MB per domain on a ResNet-50) (--dose-split bn --dose-bank verify).

Dosing (head and other changes). Class prototypes built online during the preview (C×(d+1)C \times(d+1) numbers, prior-corrected soft labels), added as log⁡p+λcos⁡(z,μc)/τ\log p + \lambda\cos(z,\mu_c)/\tau, τ=0.05\tau= 0.05, on every network. Changes of the TTA method outside BatchNorm: shared, or dosed per image after the shared-parameter check (module by module: convolutions and linear layers by their output interpolation, LayerNorm and GroupNorm by the interpolation of the two affine maps; otherwise the log-probabilities of θtr\theta_{\mathrm{tr}} and of the dosed network mixed with λ\lambda) (--dose-shared verify).

Bank check and shared-parameter check (online). No image outlives its stream; both checks use 200 images, the size of ER’s buffer (--dose-check online --dose-check-images 200). Bank (memory-free CL, tasks t≥1t \ge1): during the last 200 images of domain tt’s training stream, each batch is scored before the optimizer step that trains on it, in eval mode, by the current network with every BatchNorm normalizing with the posterior mixture of the trained domains’ statistics (the recorded statistics of the latest domain, built on this stream, against those of the older domains; the latest domain’s statistics are the stored ones, an older domain’s come from the bank) and with the stored statistics alone; two hit counts are kept, and the decision applies to the task’s deployment. Shared changes (when the TTA method changed tensors outside BatchNorm): after the preview, the deployed network with those changes shared or dosed scores the replay buffer (its images in storage order, at most 200); without a buffer the changes are shared. An option is dropped (the bank) or switched (dosed) only if the alternative is significantly more accurate: exact one-sided sign test on the discordant images, level 5%. The decisions hold for the task.

Test-batch protocol. Single-domain batches: every BatchNorm layer on the batch’s statistics with the adapted affine parameters (--route-adapted-bn batch --route-trained-bn full). Mixed batches, memory-free: θtr\theta_{\mathrm{tr}}’s branch normalizes each old image with a flat-top kernel average of its batch neighbours’ moments (bandwidth: median distance to the B/8B/8-th nearest neighbour), shrunk towards the pooled old images with a pseudo-count of one batch, and with the latest domain’s stored statistics in proportion of its posterior (--dose-protocol official).

θtr\theta_{\mathrm{tr}}. Stored as a diff of the tensors the TTA method changed (exact; tested), including the BatchNorm statistics that Tent, EATA, SAR and ROID strip; a full copy when the structure changes (RoTTA, NOTE, ViDA, DePT, DPCore, DAS) or a container owns a changed tensor (CoTTA’s ViT position embedding).

Next task. Training resumes from θtr\theta_{\mathrm{tr}}, the network before TTA, which DoSE keeps for its trained branch (--train-from snapshot). From the adapted network, as in CL+TTA, is an ablation, which changes the score by at most 0.4 points on the benchmarks of Table 3, but costs up to 14.1 points on C100-C without memory (Sec. H.2). Conversely, giving CL+TTA the same start does not close the gap. We also scored CL+TTA reset to θtr\theta_{\mathrm{tr}} after each preview, so that the CL method trains exactly as alone and CL+TTA only changes the network it deploys. Over the 950 runs behind Table 2 in which this variant was logged (525 on ResNets and 425 on ViTs, not logged for Norm, ReservoirTTA and some methods with a buffer), it scores 45.2 on ResNets and 67.2 on ViTs, against 45.4 and 69.0 for CL+TTA from its adapted network and 58.3 and 70.1 for DoSE, which is above it in 90% of these runs. In the test-batch protocol, DoSE uses the same test-batch statistics as the baseline (item above).

Overhead at test time. One pass through the frozen first block per image, the per-image mixing of every BatchNorm layer, and, when the shared changes are dosed and cannot be split by module, a second forward pass of θtr\theta_{\mathrm{tr}}. During the preview: one extra forward pass per batch (recorded statistics, BatchNorm statistics and prototypes on the same forward).

How the baselines are run

We implement the TTA methods using their official code where available and their published descriptions otherwise. Optimizer settings are listed in Table 5, and implementation changes are detailed in Sec. C.1. The 20 methods are Tent, EATA, SAR, ROID, CoTTA, RDumb, RoTTA, PETAL, NOTE, LAW, CMF, Surgical, PALM, LCoTTA, POEM, DePT, DPCore, ViDA, DAS, and Norm, and we also run ReservoirTTA around Tent, EATA, SAR, and ROID. The main tables report the median over the implementations that keep every core component of the original method, namely all of them except PETAL, ViDA, DePT, DPCore, DAS and POEM (see Sec. C.1), and Table 11 gives it over every method. The adapted network is deployed as in the official code, so Tent, EATA, SAR, ROID, and CoTTA normalize with the statistics of the test batch, and no method gets recalibrated statistics. DER++ replays logits as in the original paper. CODA-Prompt uses the official prefix-tuning prompts without a buffer, with a frozen pretrained ViT and prompt components learned per domain.

MethodCIFAR datasetsImageNet-scale datasets
TentAdam 10−310^{-3}SGD 2.5⋅10−42.5 \cdot10^{-4}
EATA, SAR, ROID, CMFAdam 10−310^{-3}SGD 2.5⋅10−42.5 \cdot10^{-4}
CoTTAAdam 10−310^{-3}SGD 10−210^{-2}
RoTTA, PETALAdam 10−310^{-3}Adam 10−310^{-3}
LAW, PALM, NOTEAdam 5⋅10−55 \cdot10^{-5}, 5⋅10−45 \cdot10^{-4}, 10−410^{-4}same
LCoTTASGD 1.5⋅10−41.5 \cdot10^{-4} (ViT 5⋅10−45 \cdot10^{-4})same
ViDAAdam 3⋅10−43 \cdot10^{-4} (adapters 10−610^{-6})SGD 5⋅10−75 \cdot10^{-7} (2⋅10−72 \cdot10^{-7})
DPCore, DePT, DAS10−210^{-2}, 10−310^{-3}, Adam 10−510^{-5}same
Tent, EATA, SAR on ViTSGD 0.0010.001 b/64 for every dataset

Table 5. Optimizers (SGD: momentum 0.9; bb = batch size). ImageNet-scale: Imagenette, DomainNet, ImageNet-R/A. The other hyperparameters (margins, thresholds, augmentations: 32 views, 8 on 224-pixel datasets) are the official ones; src/tta/factory.py cites the source of each value. Tent on CIFAR: 10−310^{-3}, as in the CoTTA code [51], while the PALM benchmark configuration [30] uses 2⋅10−52 \cdot10^{-5}.

ResNet, FTResNet, ERViT-B/16, FTViT-B/16, ER
no TTA+TTAOursno TTA+TTAOursno TTA+TTAOursno TTA+TTAOurs
Every TTA method
C100-C48.644.260.764.745.265.865.666.066.569.068.869.3
C100-TF49.748.566.463.151.668.973.473.874.375.275.676.3
C2063.764.163.968.168.168.676.977.077.879.179.279.9
DomainNet39.137.243.551.139.351.162.862.763.363.964.064.6
Inet-TF42.140.776.770.842.780.095.795.896.196.095.996.2
IN-C17.115.322.431.815.734.350.751.451.356.456.457.1
Mean43.441.755.658.343.861.470.871.171.673.373.373.9
Strict single pass: no method reads training or buffer images again
C100-C48.643.760.764.745.265.865.666.066.369.068.969.2
C100-TF49.748.066.263.151.468.973.473.774.175.275.576.2
C2063.764.163.868.168.068.576.976.877.879.179.279.9
DomainNet39.137.343.851.139.551.162.862.763.463.963.964.6
Inet-TF42.140.876.870.842.779.995.795.796.096.095.996.1
IN-C17.115.322.331.815.734.350.752.051.356.456.557.1
Mean43.441.555.658.343.761.470.871.271.573.373.373.9

Table 11. Table 2 over other sets of TTA methods (score, %, medians over the methods of each set, same runs and seeds). Top: every method (9 to 20 per setting). Bottom: strict single pass, without EATA, POEM, DPCore, DAS and ReservoirTTA, which read training or buffer images again during the preview (6 to 14 per setting). Table 2 itself uses the implementations that keep every core component (6 to 18 per setting). Bold: best method.

Implementation details of the TTA methods

Each implementation is integrated into one module of our framework and checked against available official code or the published equations. The algorithmic code is unchanged, except for the changes below. SAR, Tent, Norm, LAW, and PALM need none of the method-specific ones.

The official code assumes a single adaptation phase on a fixed source model. Four changes are therefore common to all methods.

Reset. At each preview, the method restarts from the network that the CL method has just trained, θtr(t)\theta_{\mathrm{tr}}(t). Its source, anchor, and teacher copies, its optimizer state, and its memories are re-initialized from this network.

Source data. Some methods read source data: EATA for its Fisher information, POEM for its protector, and ReservoirTTA for its style statistics. They read, without labels, the training images of the domain the network was just trained on, at the start of each preview. These additional source-data accesses are exceptions to a strict single-pass protocol.

Next task. When the next task keeps the adaptation (CL + TTA, and DOSE in the ablation of Table 31), it starts from the network that the method deploys. For CoTTA, PETAL, RoTTA and ViDA, this is the teacher and not the internal student. On a ViT, CoTTA’s student collapses during a preview while its teacher does not, and starting from the student would train the collapse into the CL model.

ResNet, FTResNet, ERViT-B/16, FTViT-B/16, ER
adaptedθtr\theta_{\mathrm{tr}}adaptedθtr\theta_{\mathrm{tr}}adaptedθtr\theta_{\mathrm{tr}}adaptedθtr\theta_{\mathrm{tr}}
C100-C48.360.764.565.966.767.069.569.5
IN-C21.422.333.534.352.552.856.757.3
methods, θtr≥\theta_{\mathrm{tr}} \geq adapted13 / 1613 / 169 / 1210 / 12

Table 31. Next task from the adapted network or from θtr\theta_{\mathrm{tr}} (score of DOSE, %, medians over the TTA methods of Table 2, mixed batches). Adapted: the next task starts from the adapted network, as in CL + TTA. θtr\theta_{\mathrm{tr}}: as in Table 2. Tent at 10−310^{-3} on both sides, 5 seeds per method (3 for Norm). Last row: methods for which θtr\theta_{\mathrm{tr}} is at least as good, over both benchmarks.

Class count. Some entropy margins are hard-coded for the 1000 classes of ImageNet (0.4ln⁡10000.4 \ln1000). This is above the maximum entropy of 10 to 100 classes and would disable the filter, so we set them to 0.4ln⁡C0.4 \ln C (EATA, RDumb, LCoTTA and POEM). The redundancy margins of EATA and RDumb use the official value for the class count (0.4 for 10 classes, 0.1 for 100 and 0.05 for 1000), log-interpolated to 0.264 for the 20 classes of C20.

Method-specific changes:

RDumb. The official code is ResNet-only. On a ViT, our port adapts the LayerNorm affine parameters, as Tent and EATA do. Its reset target is the network at the start of each preview.

ROID, CMF. Our ROID normalizes by the actual batch size instead of the configured one, and builds its augmentations at the true input resolution. CMF shares the same port and loss code, and its DomainNet WeightNorm branch is not used.

PETAL. No SWAG checkpoint exists for our backbones. Its mean model is therefore the network before the preview and its covariance is one, so its penalty becomes 12λ∥θ−θanchor∥2\frac{1}{2}\lambda\lVert\theta-\theta_{\mathrm{anchor}}\rVert^2, which is negligible at the official λ=10−8\lambda= 10^{-8}. We also clamp a quantile index where the official code reads past the end of an array when the percentile is 1.

RoTTA. Its robust BatchNorm replaces BatchNorm at the first adaptation step, because doing it at construction would erase the pretrained statistics before CL training. It is converted back to standard BatchNorm before the next task, with the adapted statistics and affine parameters.

NOTE. The source model is trained with instance-aware BatchNorm from the start, as NOTE requires. The official code predicts one image at a time. We predict a batch at once in evaluation mode, which gives the same predictions, and insert its images in the memory in order.

Surgical. It adapts the first block, the choice of its paper for input-level shifts.

LCoTTA. The subspace is updated at every batch. The official 50 or 100 batches assume domains of about 780 batches, while ours have 8 to 20, so the subspace would never be built.

ViDA. No ViDA checkpoint pre-trained on the source exists for our backbones, so the adapters start from zero. Its numbers are therefore not directly comparable to those of its paper.

DPCore. The prompt is added to the first patch tokens instead of prepended, so that it is the identity at zero. Its source statistics come from the training images of the latest domain.

DePT. No official code is released. Our port follows the paper: prompt tuning on a frozen ViT, pseudo-labels from memory-bank prototypes, and a filter on agreement and confidence. An L2 pull of the prompt stands in for its hierarchical regularizer.

DAS. It is run on ViTs only, as in the official configurations. Its labeled source batch is drawn from the replay buffer of the CL method, the only labeled data the setup holds, so it runs with ER only. The official method draws it instead from a knowledge base of class images generated beforehand with Stable Diffusion, which our setup does not have. We use fp32 instead of mixed precision.

ReservoirTTA. It wraps Tent, EATA, SAR and ROID as in the official variants. Its style threshold comes from at least 1,000 batch styles of the training images of the latest domain, and the reservoir is rebuilt at each preview.

POEM. Its protector uses the entropies of the unadapted network on 2,000 unlabeled training images of the latest domain, while the official code holds out 25% of a source validation set.

For DOSE, the hooks that record the statistics are re-attached to the network a method deploys before each recorded forward pass, because PETAL and RoTTA create their teacher at their first adaptation step.

Selection of the CL learning rates

No test image is used. For every domain, 10% of its training images are held out and never trained on; those of domain tt play the role of Dtte\mathcal{D}^{\mathrm{te}}_t and those of domain t+1t+1 of the preview. The last task is dropped. Learning rates can also be tuned online during the stream, for instance with hypergradients [32], which we do not use. We run the CL method alone for each rate with seed 0 (Table 6). The rate of each benchmark is the best average validation score over other benchmarks, which share neither its images nor its kind of shift (Table 7), so that its own domains take no part in the choice, and it is then fixed during evaluation. Every benchmark gets 3⋅10−53 \cdot10^{-5} on ResNets and 10−510^{-5} on ViTs, which is also the best average over all five benchmarks.

ResNet, validation10−510^{-5}3⋅10−53 \cdot10^{-5}10−410^{-4}3⋅10−43 \cdot10^{-4}ViT, validation3⋅10−63 \cdot10^{-6}10−510^{-5}3⋅10−53 \cdot10^{-5}10−410^{-4}
CIFAR-100-C89.488.377.250.0CIFAR-100-C52.465.963.546.7
CIFAR-100-TF93.091.382.558.6CIFAR-100-TF75.580.875.260.3
CIFAR-2068.472.770.158.3CIFAR-2079.278.673.160.1
Imagenette-TF92.193.091.382.0DomainNet53.361.559.242.6
DomainNet41.448.642.929.3Imagenette-TF100.099.598.491.8
average76.978.872.855.6average72.177.373.960.3

Table 6. CL learning rate, the CL method alone, seed 0, validation score. Selected: 3⋅10−53 \cdot10^{-5} (ResNet), 10−510^{-5} (ViT). Validation accuracies on the CIFAR benchmarks are inflated because the RobustBench ResNet was trained on the CIFAR-100 training images from which the held-out images come.

EvaluatedDevelopment benchmarksResNet separateResNet leave one outViT-B/16 separateViT-B/16 leave one out
C100-C, C100-TFDomainNet3⋅10−53 \cdot10^{-5}3⋅10−53 \cdot10^{-5}10−510^{-5}10−510^{-5}
C20Imagenette-TF, DomainNet3⋅10−53 \cdot10^{-5}3⋅10−53 \cdot10^{-5}10−510^{-5}10−510^{-5}
Inet-TF, IN-CCIFAR-20, DomainNet3⋅10−53 \cdot10^{-5}3⋅10−53 \cdot10^{-5}10−510^{-5}10−510^{-5}
DomainNetthe four others3⋅10−53 \cdot10^{-5}3⋅10−53 \cdot10^{-5}10−510^{-5}10−510^{-5}

Table 7. CL learning rate selected for each benchmark on separate development benchmarks only (best average validation score of Table 6). Development benchmarks share neither the images nor the kind of shift of the evaluated one. Leave one out: every other benchmark.

Separate development domains. A selection that only leaves the evaluated benchmark out gives the same rates (Table 7). The development benchmarks are the other benchmarks of this paper, scored on their held-out validation images, and no benchmark outside the paper was used. On ResNets, the rate is shared by the ResNet-29 of the CIFAR benchmarks and the ResNet-50 of the others, so that C100-C and C100-TF get the rate selected with a ResNet-50 on DomainNet.

Backbones and CL methods

On C100-TF and C100-C we use the AugMix ResNeXt-29 [18] from RobustBench [9]. On Inet-TF, DomainNet, IN-C and C20 we use the torchvision ImageNet ResNet-50 [16], with CIFAR images upsampled to 112 pixels. C20 needs a backbone that has never seen the fine classes of CIFAR-100. The ViT is a ViT-B/16 [12] from timm. The CL methods are experience replay with a buffer of 200 images (ER), fine-tuning without any buffer (FT, memory-free), DER++ [4] and CODA-Prompt [43]. Each task is trained for one epoch with Adam. The learning rates, 3⋅10−53 \cdot10^{-5} for ResNets and 10−510^{-5} for ViTs, are selected on validation, and CODA-Prompt keeps its own 10−310^{-3}.

Datasets

We use six domain-incremental benchmarks with a fixed label space. C100-TF and Inet-TF (Imagenette) have 5 tasks each: a clean domain followed by corrupted ones, generated once per image with the official code for Cifar100-C and ImageNet-C [17] at severity 5. C100-C (14 tasks) uses the 15 corruptions of CIFAR-100-C. Each domain has its own fifteenth of the CIFAR-100 training images, corrupted with the official generator. Its preview and evaluation images are disjoint halves of the released test images, which every corruption reuses as in all CIFAR-100-C benchmarks. C20 (4 tasks) uses the 20 super-classes of CIFAR-100. Each task uses a different fine class of every super-class, so the shift is semantic rather than statistical. DomainNet [36] (5 tasks) uses the 100 most frequent classes over clipart, infograph, painting, quickdraw, real and sketch, a shift of style. IN-C (14 tasks) uses the 15 corruptions of ImageNet-C at severity 5. On ViTs we also use ImageNet-R [19] and ImageNet-A [20] (200 classes), whose test sets are about ten times smaller. Table 8 gives the number of images per task. The training images of a task are labeled and seen once. The preview is the unlabeled stream that TTA adapts to, and the evaluation set holds the held-out images of a domain. Training, preview and evaluation images never overlap, under any corruption.

shifttasksclassestraining imagestraining per classprevieweval.
C100-TFcorruption510010,0001001,0001,000
Inet-TFcorruption510≈1,900\approx1,900≈190\approx190≈390\approx390≈390\approx390
C100-Ccorruption141003,333335,0002,000
IN-Ccorruption141,00025,0002520,0005,000
C20sub-class42010,0005001,0001,000
DomainNetstyle5100≤10,000\le10,000≤100\le100≤2,000\le2,000≤1,000\le1,000
ImageNet-Rrendition52004,80024600600
ImageNet-Aadversarial52001,2006150150

Table 8. Images per task. Training images are labeled, preview images are not, and the evaluation set of a domain is scored at every later task. ImageNet-R and ImageNet-A (ViT only) also add a corruption at each task. DomainNet caps each class, and some classes have fewer images in some domains.

Data splits. For each domain, training, preview and evaluation images form three separate sets. In particular, the preview stream of task t+1t+1 and the labeled training set of task t+1t+1 are two disjoint sets of images of the same domain. The next task thus trains on the preview domain, but never on the preview images themselves, so that their evaluation does not depend on what the next task learns.

C100-TF, Inet-TF: the clean data followed by corrupted copies (gaussian noise, defocus blur, snow, brightness and contrast for C100-TF, and gaussian noise, defocus blur, brightness, contrast and shot noise for Inet-TF); each image of a domain is corrupted once with the official CIFAR-C / ImageNet-C generator at severity 5 and cached; the images of a domain are a fixed per-class chunk of the data, disjoint across domains and across training, preview and evaluation. C100-C: 14 tasks; domain dd of the training set is the CIFAR-100 training images whose position in their class is dmod15d \mathop{\mathrm{mod}} 15 (≈ 3,333 images), corrupted by the official generator; evaluation: even indices of the released CIFAR-100-C test set of corruption tt; preview: odd indices of corruption t+1t+1 (the same 5,000 images under every corruption, as in every CIFAR-C CTTA benchmark; an evaluated image is never in a stream). C20: task ii trains on fine-class slot ii of every super-class and the preview shows slot i+1i+1. DomainNet: the 100 classes with most images over the six domains, official train/test splits, 100 training, 10 evaluation and 20 preview images per class and domain. ImageNet-R / ImageNet-A (ViT only): 200 classes, every fifth image per class held out for evaluation and preview, the rest for training, cut into 5 consecutive chunks, each chunk corrupted (domain 0 clean) as for Inet-TF; we report them on ViTs only, since the ResNet at 112 pixels reaches only 2 to 19% on them.

Complete results

Standard deviations and seeds. All numbers are means over 5 seeds. For the entries of DOSE in Table 2, the standard deviation over seeds (of the per-seed median over TTA methods) has a median of 0.3 and a maximum of 1.7 points (ViT FT, C100-C).

Why the baselines fall short

This subsection gives the numbers behind the trends of § 4, from Table 1 and Table 9. On ResNets, the CL methods alone only reach 30.4% on the preview domain without memory and 43.2% with a buffer, while the same domain reaches 71 to 72% once it has been trained on with labels (Table 1). While ViTs generalize better across corruptions, the gap still remains 18 points (63 to 65% against 82%, Table 9). With TTA, the accuracy on the preview domain rises to 56% (+26.0 and +12.5 points), but the old domains drop by 11 and 24 points, and the domain just learned by 25 to 28 points (up to 65 on Inet-TF). Forgetting also rises, from 34.1 to 36.6 points without memory and from 11.5 to 32.9 with a buffer. This forgetting is measured on the deployed network at the last task, so that it includes the damage of the adapted network on the old domains. Before TTA, the network forgets 32.9 points without memory and 9.0 with a buffer, against 33.5 and 12.2 for the CL method alone (seed 0 of Tent, SAR, EATA and RWalk on the six benchmarks). With test-batch statistics, the damage falls to about 8 points without memory and 4 with a buffer, and what is above the old domains remain below the CL method alone (62.6 against 65.9). In contrast, on single-domain test batches (Oracle), CL + TTA only loses 0.6 points on the domain just learned without memory and 2.6 with a buffer, and the forgetting of memory-free CL drops from 34 to 10.9 points, close to that of a ViT (11.6).

Table 9. Old domains, preview domain and latest-domain damage, every benchmark (accuracy and points, mixed batches, median over the TTA methods of Table 2, per column; “–”: the two protocols coincide on ViTs). +TTA: CL + TTA with its own statistics (batch-independent); +TTAbatch^{\mathrm{batch}}: with the test batch’s (test-batch protocol; on ViTs both coincide). Table 1 averages the ResNet rows.

ModelBenchmarkOld domains: no TTAOld domains: +TTAOld domains: +TTAbatch^{\mathrm{batch}}Old domains: OursPreview domain: no TTAPreview domain: +TTAPreview domain: +TTAbatch^{\mathrm{batch}}Preview domain: OursLatest-domain damage: no TTALatest-domain damage: +TTALatest-domain damage: +TTAbatch^{\mathrm{batch}}Latest-domain damage: Ours
ResNet, FTC100-C49.140.057.860.145.868.763.366.50−22.0−9.4−0.6
C100-TF59.641.564.967.532.769.261.267.90−31.7−6.1−0.2
C2075.976.076.275.743.844.744.644.7000−0.3
DomainNet47.439.651.348.724.439.738.637.50−20.5−5.3−1.3
Inet-TF53.726.975.179.419.375.162.874.80−64.7−9.1−0.1
IN-C18.211.721.020.516.240.732.639.20−26.4−17.5−0.8
ResNet, ERC100-C65.842.762.165.657.467.563.865.10−16.5−3.1−0.1
C100-TF71.146.168.670.749.268.060.866.90−26.5−2.60
C2081.180.880.681.346.045.945.647.10−0.8−0.9−0.1
DomainNet59.542.155.758.638.140.340.240.60−21.4−4.8−0.8
Inet-TF83.529.380.683.548.175.165.475.50−62.6−4.40
IN-C34.412.827.734.320.437.331.235.20−23.4−6.5−0.2
ViT-B/16, FTC100-C65.966.3–66.764.268.2–68.50−0.6–−0.2
C100-TF78.478.4–78.467.068.2–69.90−0.1–0
C2089.689.6–89.454.154.6–56.800–0
DomainNet69.869.8–69.553.753.6–56.100–−0.3
Inet-TF97.597.4–97.393.093.2–94.300–0
IN-C51.651.9–52.048.758.3–56.00−2.2–−1.5
ViT-B/16, ERC100-C69.569.3–69.566.169.0–69.50−0.3–−0.1
C100-TF80.580.5–80.568.069.1–71.40−0.1–0
C2091.992.1–91.855.956.1–60.400–0
DomainNet71.271.3–71.153.754.2–57.000–−0.2
Inet-TF97.697.7–97.793.793.1–94.100–0
IN-C57.956.5–57.250.258.7–56.90−1.9–−1.4

Table 9.

Every benchmark

Table 9 splits the score of every benchmark into its old part, its new part and the latest-domain damage, and Table 10 tests the gains of Table 2 over seeds. Both take the median over the TTA methods of Table 2, as Table 2 and Table 1 do.

Table 10. Paired differences over seeds (batch-independent protocol, mixed batches). For each seed, the median over the TTA methods of Table 2 of the gain of DOSE over the CL method alone and over CL + TTA, then its mean over seeds and, in brackets, the 95% confidence interval of this mean (Student tt with n−1n - 1 degrees of freedom). Each mean is over n=5n = 5 seeds. *: p<0.05p < 0.05, one-sided paired tt-test.

BenchmarkResNet, FT −no TTAResNet, FT −+TTAResNet, ER −no TTAResNet, ER −+TTAViT-B/16, FT −no TTAViT-B/16, FT −+TTAViT-B/16, ER −no TTAViT-B/16, ER −+TTA
C100-C+12.2 [+11.5, +12.9]*+16.5 [+16.1, +16.8]*+1.1 [+1.0, +1.2]*+19.5 [+19.3, +19.6]*+1.4 [+0.9, +1.9]*+0.7 [+0.5, +0.9]*+0.5 [+0.1, +0.9]*+0.5 [+0.2, +0.8]*
C100-TF+16.7 [+16.4, +17.0]*+17.9 [+17.3, +18.5]*+5.8 [+5.3, +6.3]*+17.4 [+16.6, +18.1]*+1.2 [+0.6, +1.7]*+0.6 [+0.3, +0.8]*+1.2 [+0.8, +1.6]*+0.7 [+0.5, +1.0]*
C20+0.1 [−0.3, +0.5]−0.2 [−0.5, +0.1]+0.4 [+0.0, +0.8]*+0.5 [−0.1, +1.0]*+1.0 [+0.4, +1.6]*+1.0 [+0.5, +1.5]*+0.8 [+0.4, +1.2]*+0.7 [+0.1, +1.3]*
DomainNet+4.4 [+3.3, +5.4]*+6.0 [+5.5, +6.6]*±0.0 [−0.4, +0.3]+11.8 [+11.3, +12.3]*+0.6 [+0.4, +0.9]*+0.7 [+0.6, +0.8]*+0.8 [+0.7, +1.0]*+0.7 [+0.6, +0.8]*
Inet-TF+34.2 [+32.9, +35.6]*+35.8 [+35.4, +36.1]*+9.1 [+8.2, +10.0]*+37.2 [+36.5, +38.0]*+0.4 [−0.1, +0.9]*+0.3 [+0.1, +0.5]*+0.2 [−0.1, +0.5]+0.3 [+0.1, +0.4]*
IN-C+5.2 [+5.0, +5.4]*+6.8 [+6.5, +7.1]*+2.4 [+2.2, +2.7]*+18.3 [+18.1, +18.4]*+2.0 [+1.8, +2.1]*+0.5 [+0.4, +0.7]*+0.9 [+0.7, +1.1]*+0.5 [+0.2, +0.7]*

Table 10.

Every TTA method

Subsets of TTA methods. Some implementations miss or replace a core component of the original method, and some read training images again at the start of each preview, which a strict single-pass protocol excludes (Sec. C.1). Table 2 therefore takes the median over the implementations that keep every core component, namely all except PETAL (no SWAG posterior), ViDA (no source-pretrained adapters), DePT (no official code, and L2 pull instead of its regularizer), DPCore (prompt added instead of prepended), DAS (images of the replay buffer instead of a knowledge base of generated images) and POEM (projector on training images). Table 11 gives the same medians over every method and over the strict single-pass methods, on the same runs and seeds. Over every method, DOSE is at least as good as the CL method alone in 24 of the 24 settings and above CL + TTA in 22. Without the methods that read training or buffer images again (EATA, POEM, DPCore, DAS and ReservoirTTA), it is at least as good in 24 and above in 22. Every mean stays within 0.5 points of Table 2.

Every method. Table 12 gives the gain of DOSE over CL + TTA for every TTA method in our protocol, and Table 2 reports its medians over the methods that keep every core component. Tent and ROID, which the analyses average, are typical of the other methods. Over the settings of Table 2, the gain of DOSE over CL + TTA is 0.1 points above the median over every method with Tent and 0.2 points below it with ROID. Table 13 to Table 15 compare DOSE with CL + TTA in the test-batch protocol, with ER, with FT and on the corruption benchmarks. Of the 20 TTA methods, DAS, DePT, DPCore and ViDA only run on ViTs, while Norm, NOTE, PALM, RoTTA and Surgical only run on ResNets, so that 16 methods run on ResNets and 15 on ViTs. Every method was also run in the test-batch protocol, on every benchmark where it runs in ours (Table 12, “–”: not run). Notably, a ViT has no BatchNorm statistics, so that its two protocols coincide, and its test-batch columns repeat those of Table 12. The comparison is split over four tables. Table 13 gives ER on C100-TF, Inet-TF and DomainNet for ResNets, and on C100-TF, C20, Inet-TF and DomainNet for ViTs. Table 14 gives FT, as well as ER on ResNet C20. Table 15 gives C100-C and IN-C, where nine methods run, except Tent and ROID. Tent and ROID are given on every benchmark in Table 9 and 29. Over these tables, with ER, DOSE is at least as good as CL + TTA in the test-batch protocol in 165 of 168 pairs of method and benchmark, including ReservoirTTA [48] around Tent, EATA, SAR and ROID, with a median gain of +3.2 points on ResNets and +0.6 on ViTs in Table 13. Its three losses are PALM [30] on ResNet DomainNet and C20 (−0.3 and −0.8) and EATA on ViT IN-C (−0.1). Without a buffer, DOSE is at least as good in 104 of 148 pairs. On ResNets, it is at least as good on C100-TF and Inet-TF with every method, but it falls below on DomainNet with every method, on C20 with 16 of 18 methods, and on C100-C and IN-C with about half of them, where test-batch statistics recover what memory-free CL has lost. Table 16 gives what each method gains on the preview of a ViT, and Table 17 the scores at ten times the official TTA learning rate. With ER, DOSE is above the CL method alone in 103 of the 122 pairs of Table 13. In 12 others, the TTA method itself damages the network (CL + TTA loses up to 12 points), and DOSE recovers part of the loss.

Table 12. DOSE − CL + TTA for every TTA method, in our batch-independent protocol (score, points; mixed batches; top: ResNets, bottom: ViT-B/16; “–”: not run on this benchmark). Table 2 gives the medians of these columns.

FT C100-CFT C100-TFFT C20FT DNFT Inet-TFFT IN-CER C100-CER C100-TFER C20ER DNER Inet-TFER IN-C
CMF+16.0+17.6−0.4+4.8+35.5+9.7+16.2+16.7+0.4+10.5+37.8+21.2
CoTTA+16.7+19.0−0.2+7.0+36.2+6.4+21.0+18.4+0.5+12.1+37.2+16.9
EATA+16.4+18.6−0.2+6.3+36.1+7.4+17.3+17.7+0.4+11.6+37.6+18.5
LAW–+19.1−1.1+5.7+36.3––+18.1+0.5+11.1+37.6–
LCoTTA–+19.0−0.1+6.9+36.3––+18.3+0.6+11.9+37.2–
Norm+17.5+19.2−0.3+7.0+36.1+6.6+23.2+18.4+0.6+12.2+37.3+18.0
NOTE–+0.3+0.2−0.1+0.8––+0.2±0.0+0.1+0.6–
PALM–+17.7−0.9+1.7+35.6––+16.9−0.6+9.0+36.2–
PETAL–+3.3−0.2−1.3+6.5––+3.3+0.8+1.8+4.9–
POEM+15.2+19.0−0.2+6.3+35.9+8.9+20.7+18.5+0.6+12.0+37.5+20.6
RDumb–+18.9−0.2+6.6+36.0––+18.1+0.4+11.5+37.6–
ROID+15.6+17.4−0.1+4.7+35.9+8.7+15.8+16.9+0.4+10.4+37.5+19.8
RoTTA−0.7−0.1+0.5+0.3−0.3+0.4+23.0+21.2±0.0+10.5+27.0+18.7
SAR+16.9+17.8−0.2+6.8+36.2+6.6+18.5+16.8+0.5+12.1+37.2+17.6
Surgical–+17.4−3.8−6.4+37.6––+18.9+2.6+14.0+39.7–
Tent+18.7+17.2−0.2+6.9+35.4+7.0+20.6+17.0+0.6+11.9+37.6+18.0
Reservoir+EATA–+17.9−0.8+5.9+35.4––+17.4+0.7+12.0+36.8–
Reservoir+ROID–+17.7−1.2+5.8+35.5––+16.6+0.2+11.8+37.2–
Reservoir+SAR–+17.8−0.1+6.2+35.9––+16.7+0.5+12.1+37.2–
Reservoir+Tent–+17.5±0.0+6.4+35.8––+17.1+0.5+12.2+37.0–
CMF+1.5+0.6+0.8+0.5+0.1+1.1+0.4+0.8+0.7+0.9+0.6+0.8
CoTTA−0.4±0.0+1.0+0.7+0.3−9.0+56.5+0.6+0.9+0.9+0.2−1.6
DAS–––––––+0.3±0.0+0.1+0.2–
DePT–+0.7+1.0+0.6+0.4––+0.6+0.6+0.6±0.0–
DPCore+0.3+0.7+0.9+0.6+0.3±0.0+0.5+0.6+0.7+0.7+0.2+0.1
EATA+0.6+0.5+1.2+0.7+0.3+0.9+0.3+0.8+0.7+0.7+0.2+0.9
LAW–+0.9+0.5+1.2+0.7––+0.7+1.0+1.8+0.5–
LCoTTA–+0.4+1.0+0.6+0.2––+0.4+0.6+0.9+0.1–
PETAL–+0.8+1.5−0.3+0.2––+2.1+2.0+5.2±0.0–
POEM+0.5+0.5+1.3+2.2+0.4+1.1+0.3+0.8+0.7+1.0+0.4+8.7
RDumb–+0.4+1.0+0.7+0.3––+0.8+0.7+0.7+0.1–
ROID+1.8+0.8+1.1+0.6+0.1+0.6+0.5+0.6+0.7+0.6+0.6+0.4
SAR+0.3+0.3+0.7+0.7+0.4+0.5+0.5+0.8+0.9+0.8+0.2+0.2
Tent+0.2+0.5+0.9+0.6+0.3±0.0+0.2+0.6+0.9+0.7+0.2+1.1
ViDA−2.4+1.2+1.0+0.5+0.3±0.0+6.2+0.8+0.8+0.6+0.2+0.1
Reservoir+EATA–+0.8+0.8+0.9+0.1––+0.7+0.4+0.7+0.5–
Reservoir+ROID–+0.6+1.0+0.6+0.7––+0.7+0.6+0.6+0.1–
Reservoir+SAR–+1.0+1.0+0.6+0.3––+0.9+0.7+0.6+0.4–
Reservoir+Tent–+0.9+0.8+0.6+0.5––+0.6+0.6+0.7+0.2–
Table 12.

Table 38.

ResNet (ER)ViT-B/16 (ER)
C100-TFInet-TFDomainNetC100-TFC20Inet-TFDomainNet
CMF+2.7+2.7+4.9+4.9+1.7+1.7+0.9+0.9+0.8+0.8+0.6+0.6+0.7+0.7
CoTTA+3.2+3.2+5.0+5.0+1.9+1.9+0.6+0.6+0.9+0.9+0.2+0.2+0.9+0.9
DAS–––+0.3+0.3±0.0\pm0.0+0.2+0.2+0.1+0.1
DePT–––+0.6+0.6+0.6+0.6±0.0\pm0.0+0.6+0.6
DPCore–––+0.6+0.6+0.7+0.7+0.2+0.2+0.7+0.7
EATA+3.1+3.1+4.8+4.8+1.9+1.9+0.8+0.8+0.7+0.7+0.2+0.2+0.7+0.7
LAW+3.3+3.3+5.2+5.2+1.6+1.6+0.7+0.7+1.0+1.0+0.5+0.5+1.8+1.8
LCoTTA+3.3+3.3+4.9+4.9+1.9+1.9+0.4+0.4+0.6+0.6+0.1+0.1+0.9+0.9
Norm+3.4+3.4+4.8+4.8+1.9+1.9––––
NOTE+0.1+0.1+0.7+0.7+0.1+0.1––––
PALM+2.9+2.9+3.4+3.4−0.4-0.4––––
PETAL+3.2+3.2+4.9+4.9+1.8+1.8+2.1+2.1+2.0+2.0±0.0\pm0.0+5.2+5.2
POEM+3.3+3.3+5.1+5.1+2.0+2.0+0.6+0.6+1.0+1.0+0.4+0.4+0.9+0.9
RDumb+3.3+3.3+4.8+4.8+1.8+1.8+0.8+0.8+0.7+0.7+0.1+0.1+0.7+0.7
RoTTA+20.9+20.9+27.5+27.5+10.5+10.5––––
SAR+2.8+2.8+4.8+4.8+1.9+1.9+0.8+0.8+0.9+0.9+0.2+0.2+0.8+0.8
Surgical+3.9+3.9+6.7+6.7+8.3+8.3––––
ViDA–––+0.8+0.8+0.8+0.8+0.2+0.2+0.6+0.6
Reservoir+EATA+2.7+2.7+5.0+5.0+1.9+1.9+0.7+0.7+0.4+0.4+0.5+0.5+0.7+0.7
Reservoir+ROID+3.0+3.0+4.3+4.3+1.3+1.3+0.7+0.7+0.6+0.6+0.1+0.1+0.6+0.6
Reservoir+SAR+2.9+2.9+5.0+5.0+1.9+1.9+0.9+0.9+0.7+0.7+0.4+0.4+0.6+0.6
Reservoir+Tent+3.0+3.0+5.0+5.0+1.9+1.9+0.6+0.6+0.6+0.6+0.2+0.2+0.7+0.7

Table 13. DOSE−CL+TTADOSE - CL + TTA for every TTA method (score, points; ER, mixed batches; DOSE in the batch-independent protocol, CL + TTA in the test-batch one; “–”: not applicable). For CoTTA, PETAL, RoTTA and ViDA, both systems start each task from the deployed teacher. DOSE is at least as good in 121 of 122 entries.

ResNet (FT)ResNet (ER)ViT-B/16 (FT)
MethodC100-TFInet-TFDomainNetC20C20C100-TFC20Inet-TF
CMF+3.1+6.2−3.1−0.2+0.6+0.6+0.8+0.1
CoTTA+3.3+6.4−1.6±0.0+0.8±0.0+1.0+0.3
DePT–––––+0.7+1.0+0.4
DPCore–––––+0.7+0.9+0.3
EATA+3.4+6.7−2.0−0.2+0.7+0.5+1.2+0.3
LAW+3.4+6.2−2.6−1.1+0.6+0.9+0.5+0.7
LCoTTA+3.6+6.5−1.6−0.3+0.7+0.4+1.0+0.2
Norm+3.7+6.5−1.6−0.4+0.8–––
NOTE+0.3+0.8−0.1+0.2±0.0–––
PALM+3.1+4.0−6.0−2.3−0.7–––
PETAL+3.2+6.5−1.4−0.1+0.8+0.8+1.5+0.2
POEM+3.5+6.4−2.2−1.6+0.7+0.4+0.7+0.3
RDumb+3.6+6.4−1.8−0.3+0.6+0.4+1.0+0.3
RoTTA−0.1−0.3+0.3+0.4+0.3–––
SAR+3.1+6.4−1.7−0.3+0.8+0.3+0.7+0.4
Surgical+6.1+10.4−11.3−5.6+0.9–––
ViDA–––––+1.2+1.0+0.3
Reservoir+EATA+3.2+6.3−2.4−0.8+0.9+0.8+0.8+0.1
Reservoir+ROID+3.8+5.7−2.8−1.2+0.7+0.6+1.0+0.7
Reservoir+SAR+3.3+6.2−2.4−0.3+0.7+1.0+1.0+0.3
Reservoir+Tent+3.2+6.2−2.3−0.2+0.7+0.9+0.8+0.5

Table 14. DOSE − CL + TTA for every TTA method, with FT (and ER on C20; score, points; mixed batches; DOSE in the batch-independent protocol, CL + TTA in the test-batch one; “–”: not applicable). Gray: DOSE below the CL method alone. DOSE is at least as good as CL + TTA in 103 of 138 entries and as the CL method alone in 111. Without a buffer on DomainNet, the test-batch protocol gives CL + TTA about 2 points.

ResNetViT-B/16
C100-CIN-CC100-CIN-C
FTERFTERFTERFTER
DOSE – CL + TTA
CMF+2.3+2.3+3.3+3.3+5.0+5.0+14.0+14.0+1.5+1.5+0.4+0.4+1.1+1.1+0.8+0.8
CoTTA+0.2+0.2+1.2+1.2−1.7-1.7+2.8+2.8−0.4-0.4+56.5+56.5−9.0-9.0−1.6-1.6
DPCore––––+0.3+0.3+0.5+0.5±0.0\pm0.0+0.1+0.1
EATA+2.4+2.4+3.6+3.6+0.7+0.7+6.9+6.9+0.6+0.6+0.3+0.3+0.9+0.9+0.9+0.9
Norm+0.7+0.7+1.9+1.9−1.1-1.1+4.1+4.1––––
POEM−1.2-1.2+1.5+1.5+1.1+1.1+8.9+8.9+0.2+0.2+0.4+0.4±0.0\pm0.0+4.9+4.9
RoTTA−1.0-1.0+23.6+23.6+0.4+0.4+18.7+18.7––––
SAR+3.9+3.9+5.7+5.7−0.9-0.9+5.2+5.2+0.3+0.3+0.5+0.5+0.5+0.5+0.2+0.2
ViDA––––−2.4-2.4+6.2+6.2+0.2+0.2+0.1+0.1
DOSE – no TTA
CMF+12.6+12.6+1.3+1.3+4.9+4.9+2.3+2.3+3.0+3.0+1.4+1.4+3.2+3.2+1.1+1.1
CoTTA+12.4+12.4+1.0+1.0+5.8+5.8+2.5+2.5−62.6-62.6−9.7-9.7−7.2-7.2−1.5-1.5
DPCore––––−0.1-0.1+0.3+0.3−0.6-0.6−0.6-0.6
EATA+12.2+12.2+1.2+1.2+5.7+5.7+2.9+2.9+1.8+1.8+0.6+0.6+3.2+3.2+1.2+1.2
Norm+12.0+12.0+0.6+0.6+4.8+4.8+1.9+1.9––––
POEM+11.2+11.2+1.0+1.0+1.9+1.9−2.2-2.2+0.7+0.7+0.2+0.2−0.5-0.5−3.7-3.7
RoTTA−7.6-7.6±0.0\pm0.0−1.7-1.7+2.0+2.0––––
SAR+12.1+12.1+1.2+1.2+5.3+5.3+2.6+2.6+1.0+1.0+0.3+0.3+1.2+1.2+0.7+0.7
ViDA––––−9.6-9.6−3.1-3.1±0.0\pm0.0+0.1+0.1

Table 15. Seven TTA methods per backbone on the corruption benchmarks (score, points; mixed batches; DOSE in the batch-independent protocol, CL + TTA in the test-batch one; Tent and ROID in Table 9 and Table 29). Without a buffer on C100-C, CL + TTA with test-batch statistics is 9 to 11 points above DOSE with EATA, SAR and CMF, as for Tent and ROID in Table 2.

C100-CC100-TFIN-CC20DomainNetInet-TF
Tent+1.6+1.6+0.8+0.8+5.2+5.2±0.0\pm0.0−0.2-0.2+0.1+0.1
EATA–+2.1+2.1+13.9+13.9+0.1+0.1+0.8+0.8+0.1+0.1
SAR–+0.9+0.9+7.2+7.2±0.0\pm0.0−0.2-0.2±0.0\pm0.0
ROID+6.2+6.2+5.9+5.9+9.8+9.8+1.1+1.1+1.0+1.0−0.3-0.3
CMF–+6.0+6.0+12.8+12.8+1.1+1.1+1.1+1.1−0.7-0.7
DAS–+6.2+6.2–+2.5+2.5+1.4+1.4+2.2+2.2
DPCore–+0.6+0.6–−0.5-0.5−0.2-0.2−0.1-0.1
DePT–±0.0\pm0.0–±0.0\pm0.0±0.0\pm0.0±0.0\pm0.0
ViDA–+0.2+0.2–−0.6-0.6±0.0\pm0.0±0.0\pm0.0

Table 16. Gain of each TTA method on the preview of a ViT (ER, CL + TTA, mixed batches, 5 seeds): accuracy of the adapted network on the preview stream after the pass minus the accuracy before adaptation, in points; “–”: not run. Bottom: the methods built for ViTs that learn new parameters (prompts, adapters).

ResNetViT-B/16
C100-TFInet-TFC100-TFC20Inet-TF
no TTA63.170.875.279.196.0
CoTTA65.4 / 68.074.9 / 80.01.6 / 56.15.9 / 59.291.4 / 93.4
EATA44.0 / 59.175.5 / 80.276.5 / 77.079.4 / 79.496.3 / 96.4
ROID42.4 / 59.873.1 / 78.473.1 / 75.674.5 / 76.593.3 / 92.8
SAR30.7 / 57.675.3 / 80.075.8 / 76.678.8 / 79.995.7 / 96.2
Tent28.3 / 57.475.2 / 79.975.9 / 76.478.6 / 79.396.2 / 96.4

Table 17. TTA learning rate ×10: score of CL + TTA/ DOSE (ER, mixed batches). CL + TTA: test-batch protocol, next task from the network it deploys (its teacher for CoTTA), 5 seeds; DOSE: batch-independent protocol, next task from θtr\theta_{\mathrm{tr}}, 5 seeds. DOSE is above CL + TTA in 23 of 25 pairs and at least as good as the CL method alone in 16.

ResNetViT-B/16
C100-TFInet-TFC100-TFC20Inet-TF
no TTA63.170.875.279.196.0
CoTTA65.4 / 68.875.0 / 79.975.1 / 75.879.4 / 80.195.9 / 96.2
EATA65.6 / 68.975.0 / 80.175.4 / 76.179.4 / 80.095.9 / 96.5
ROID65.7 / 68.875.0 / 79.975.7 / 76.779.3 / 80.795.8 / 96.3
SAR65.5 / 68.974.9 / 79.975.3 / 76.279.1 / 80.096.0 / 96.1
Tent65.5 / 68.975.1 / 79.975.2 / 76.079.1 / 80.195.9 / 96.2

Table 18. TTA learning rate ÷10: same setting as Table 17 with the official rate divided by ten, score of CL + TTA/ DOSE (ER, mixed batches, 5 seeds). DOSE is above CL + TTA in 25 of 25 pairs and at least as good as the CL method alone in 25.

Ablations and stored statistics

Table 20 gives every variant of DOSE on every benchmark, of which Table 3 keeps the most informative ones. Table 21 shows why CL + TTA cannot simply keep the statistics it estimated during TTA: applying the statistics of the preview to every image collapses the old domains, whichever way they are recorded.

ResNetViT-B/16
C100-TFInet-TFC20DomainNetC100-TFInet-TFC20DomainNet
FTERFTERFTERFTERFTERFTERFTERFTER
Records and posterior
only the latest domain’s recorded statistics−5.6−4.1−13.1−10.4+0.3+0.1+3.6−0.3+0.20.0+0.10.0+0.1+0.1+0.30.0
statistics recorded on θtr\theta_{tr}, first layer−4.4−0.7−0.2−0.1−0.3+0.2+0.4−0.6−0.10.0+0.10.0+0.4+0.8+0.2+0.1
statistics recorded on θtr\theta_{tr}, first quarter−2.4−1.7−1.0−0.3−0.5−0.1+0.2−1.2+0.1+0.1+0.10.0+0.7+0.9+0.3+0.1
statistics recorded on θtr\theta_{tr}, every layer−2.0−1.6−0.7−0.2−0.1−0.1+1.2−1.0+0.1+0.1+0.10.0+0.8+1.0+0.4+0.2
typicality rule, not the posterior−7.0−2.2−3.9−1.1+0.5−0.1+2.8−0.7−0.1+0.10.00.0+1.0+1.1+0.6+0.4
true domain given (oracle)−0.9−0.6+0.10.0+0.1+0.2−0.5−0.8+0.1−0.1+0.10.0+1.3+1.4+0.4+0.4
Dose
statistics only, affine shared−0.5−1.1+0.20.0+0.4+0.1−0.1−1.5+0.4+0.3−0.1−0.1+1.1+0.9+0.1+0.1
every tensor that TTA changed+1.40.0+0.10.0+0.10.0+3.40.0−0.4−0.10.00.0−0.3−0.1−0.2−0.1
Bank and bank check
no bank−5.90.0−19.60.00.00.0−2.5−0.1−0.10.0+0.10.0−0.10.00.0−0.1
bank always, without bank check+1.00.00.0+0.1−4.90.0−2.3−0.10.00.0+0.10.0−0.3+0.10.0−0.1
Prototype head
no prototype head−0.4−0.1−0.2−0.1−0.5−0.1−0.1−0.2−0.6−0.7−0.1−0.2−1.1−0.8−0.6−0.7
Next task
next task from the adapted network (as CL + TTA)−0.30.0+0.10.0−0.40.0−0.1−0.10.0−0.1+0.10.0−0.3−0.10.0−0.1

Table 20. Ablations, every cell (score difference to DOSE, points, mixed batches, Tent/ROID, paired by seed).

+TTA (test batch)+TTA, stored statsrecorded, EMArecorded, exactrecorded, all previewsOurs
FTC100-TF63.149.947.648.357.068.4
C2064.463.9–64.362.364.6
Inet-TF70.442.541.041.353.277.7
DomainNet46.238.637.937.943.347.0
ERC100-TF65.962.851.251.662.268.8
C2067.968.2–68.365.568.7
Inet-TF75.170.742.242.657.580.1
DomainNet49.649.440.240.245.551.5

Table 21. CL + TTA with statistics recorded during TTA instead of those of the evaluation batch (ResNet, mixed): applying the statistics of the preview to every image collapses the old domains.

Notably, a hard dose, namely per-domain BatchNorm with the inferred domain, scores the same as the soft dose within 0.1 points. The posterior finds the domain of 97% of the Inet-TF images, but only 27% for the sub-class domains of C20, where chance is 25% (Figure 5). At the last task, the bank check keeps the bank on Inet-TF and drops it on C20. The shared-parameter check doses the changes of RoTTA [55], Surgical [25] and PETAL [3] in 86, 62 and 10% of the runs, while it shares those of every other method.

Figure 5. The domains as seen by the recorded statistics. t-SNE of the vectors s(x)s(x) (channel means and log-variances of the input and of the frozen first block) for 300 training images per domain. In parentheses is the domain accuracy of the posterior on held-out images.

Table 19 gives DOSE without a TTA method on every benchmark of Table 2. The preview is then only used for the recorded statistics of the new domain and for the prototypes, which the unadapted network builds from its own predictions, while the images of the new domain keep the BatchNorm statistics of θtr\theta_{\mathrm{tr}}.

ResNet, FTResNet, ERViT-B/16, FTViT-B/16, ER
no TTAw/o TTA methodOursno TTAw/o TTA methodOursno TTAw/o TTA methodOursno TTAw/o TTA methodOurs
C100-C48.658.260.764.764.865.965.666.067.069.069.369.5
C100-TF49.756.066.463.163.468.973.473.874.675.275.976.4
C2063.763.963.968.168.568.676.977.577.979.180.079.9
DomainNet39.142.343.551.151.551.162.863.363.463.964.764.7
Inet-TF42.162.576.770.871.780.095.796.196.196.096.196.3
IN-C17.119.222.331.831.834.350.750.852.856.456.457.3
Mean43.450.455.658.358.661.470.871.372.073.373.774.0

Table 19. DOSE without a TTA method (score AA, %, 5 seeds): the recorded statistics, the bank and the prototypes on the network that TTA never adapted. No TTA and Ours: as in Table 2. Bold: best.

Held-out images, other CL methods and other benchmarks

Table 22 scores the preview domain on held-out images that were never in the stream. Table 23 replaces ER and FT by DER++ and CODA-Prompt, and Table 24 gives ImageNet-R and ImageNet-A on ViTs. With DER++ [4], which adds to replay a distillation of the logits stored with the buffer images, DOSE scores highest among the configurations in Table 23. The reference comes from the same run of DOSE, where the next task starts from θtr\theta_{tr}, so that TTA never changes what DER++ keeps training. DER++ alone is an independent DER++ run that never uses TTA during the sequence, and it agrees with the reference within 0.3 points. With CODA-Prompt [43], which learns prompts on a frozen ViT without any buffer, DOSE is above CODA-Prompt with TTA on all four benchmarks (+0.3 to +0.9), and above CODA-Prompt alone on three (−0.4 on DomainNet). Notably, Continual Normalization [37], which adapts BatchNorm to online CL by adding a per-image GroupNorm before every BatchNorm layer, remains below DOSE (53.5 against 58.7, Sec. H.12).

Table 22. Held-out preview domain: score with the preview domain scored on held-out images never in the stream, and the accuracy of DOSE on the preview domain on the stream and on held-out images. Bold: best of the systems without test-batch statistics; DOSE is best or tied in 23 of 24 settings.

Score, preview domain held outPreview domain, DOSE
no TTA+TTA+TTAbatch^{\mathrm{batch}}Oursstreamheld-out
ResNet, FTC100-C49.443.557.862.167.968.8
C100-TF49.151.663.868.568.766.8
C2063.764.564.664.144.942.9
DomainNet36.234.744.742.037.933.3
Inet-TF43.643.570.576.674.973.9
IN-C17.615.122.823.140.340.4
ResNet, ERC100-C65.047.362.666.167.968.6
C100-TF62.955.166.669.168.166.3
C2067.867.767.668.246.944.6
DomainNet49.336.948.449.541.538.0
Inet-TF67.445.773.478.676.073.6
IN-C32.215.628.234.838.038.1
ViT-B/16, FTC100-C65.666.267.170.470.8
C100-TF72.774.474.972.570.7
C2075.576.077.257.155.7
DomainNet61.561.862.356.452.8
Inet-TF95.795.795.994.293.9
IN-C51.252.352.556.155.4
ViT-B/16, ERC100-C68.869.469.771.772.2
C100-TF74.676.176.673.371.8
C2077.677.878.958.556.6
DomainNet62.262.463.056.752.8
Inet-TF95.895.796.094.193.8
IN-C56.857.057.757.857.4

Table 22.

Table 23. Other CL methods (score, mixed batches, Tent/ROID, 5 seeds). Reference: for DER++, the network immediately before each preview within a run of DOSE, which may retain effects of TTA from earlier tasks; for CODA-Prompt, the standalone run without TTA. DER++ alone: an independent run of DER++ that never uses TTA during the whole sequence, within 0.3 points of the reference. +TTA: CL + TTA with its own statistics (batch-independent); +TTAbatch^{\mathrm{batch}} (gray): with the evaluation batch’s statistics (test-batch protocol; on ViTs both coincide).

CL methodBenchmarkReferenceDER++ alone+TTA+TTAbatch^{\mathrm{batch}}Ours
DER++ (ResNet)C100-TF62.262.252.166.769.1
Inet-TF68.067.742.774.677.8
DomainNet50.150.141.650.150.7
DER++ (ViT-B/16)C100-TF76.576.477.577.578.0
C2080.280.280.480.481.1
Inet-TF96.496.496.696.696.9
DomainNet66.266.366.366.366.9
CODA-Prompt (ViT-B/16)C100-TF75.3–75.375.376.2
C2076.2–76.476.477.0
Inet-TF95.6–96.196.196.4
DomainNet62.9–61.961.962.6

Table 23.

Table 24. ImageNet-R / ImageNet-A (ViT, Tent/ROID, 5 seeds). With 1 to 3 preview images per class, the prototypes are weak, and TTA has little to give.

no TTA+TTADOSEDOSE without TTA
FTIN-A28.027.927.927.9
FTIN-R66.366.366.566.2
ERIN-A28.728.728.528.8
ERIN-R66.266.166.366.2

Table 24.

Preview length and cost

From 500 to 5000 preview images on C100-C, the TTA gain on the preview grows from 7.5 to 10.5 points on ResNets and from 2.2 to 5.8 points on ViTs (Figure 3). The official SAR code [34] shows the same effect on ImageNet-C with a ViT-B/16 and batches of 64. Averaged over four blur corruptions, its online accuracy is 38.2% after 5,000 images and 51.1% after the 50,000 images of the usual protocol (Tent: 38.1 and 51.0). After 5,000 images, our implementations give the same accuracy (38.3 and 38.0). Table 25 gives the test-time cost of DOSE.

Preview length plot

Figure 3. Preview length (C100-C, ER, DOSE with Tent/ROID, 5 seeds). Solid: accuracy of the adapted network on the preview domain after the pass minus before it. Dashed: score of DOSE minus the score of the same network before the preview.

Test-time cost: forward time of the deployed system per image (ms), measured on one RTX A4500 with nothing else running, after the preview of the last task without a buffer, the costliest point of a run (every trained domain has its recorded statistics and a bank entry; domains: number of trained domains). Each row uses the architecture, input size, evaluation batch size (mixed) and number of classes of its benchmark. No TTA: θtr\theta_{\mathrm{tr}} with its stored statistics. +TTA: CL + TTA with the statistics estimated during the preview. DOSE includes the frozen first block, the posterior, the dosed BatchNorm layers and the prototype head. Per-domain BatchNorm with the inferred domain costs the same as DOSE (1.46 and 1.60 times CL + TTA on ResNet-50 and ResNeXt-29). The last two columns give the throughput in images per second (1000 divided by the time per image). Times are measured with the released implementation, separately from the runs.

inputdomainsno TTA+TTAOursOurs / +TTA+TTA (img/s)Ours (img/s)
ResNetC100-C32 px140.240.240.401.67×4 1672 500
ResNetC100-TF32 px50.240.240.391.62×4 1672 564
ResNetC20112 px40.230.230.341.46×4 3482 941
ResNetDomainNet224 px50.800.801.171.46×1 250855
ResNetInet-TF112 px50.230.230.341.46×4 3482 941
ResNetIN-C224 px140.800.801.191.48×1 250840
ViT-B/16C100-C224 px143.623.633.721.02×275269
ViT-B/16C100-TF224 px53.673.683.741.02×272267
ViT-B/16C20224 px43.703.713.771.01×270265
ViT-B/16DomainNet224 px53.733.743.801.01×267263
ViT-B/16Inet-TF224 px53.763.763.811.01×266262
ViT-B/16IN-C224 px143.773.773.851.02×265260

Table 25.

Per-task results

As is usual in continual TTA, Table 26 and Table 27 give the accuracy at every task of C100-C and IN-C, and Table 28 the mIoU at every task of Cityscapes →\to ACDC. Task tt trains on domain tt and previews domain t+1t+1, whose name heads the column.

task tt (previewed domain)012345678910111213mean
shotimpuldefocglassmotnzoomsnowfrostfogbritcontrelastpixeljpeg
FT, previewed domain n(t)
CL alone65.962.355.28.955.671.623.863.142.251.735.133.427.544.845.8
+TTA67.967.574.063.571.774.069.069.767.974.872.766.271.463.369.6
+TTAbatch^{\mathrm{batch}}67.267.267.760.166.068.763.165.159.171.449.262.062.761.463.6
DOSE66.467.874.362.871.774.268.968.467.967.673.558.870.258.067.9
FT, trained domains, mean of aj(t)a_j(t)
CL alone65.867.464.128.150.746.240.051.352.847.650.735.648.838.249.1
+TTA65.762.86.243.931.831.637.038.839.640.429.543.439.145.239.6
+TTAbatch^{\mathrm{batch}}65.464.259.458.655.355.155.356.455.053.454.853.051.952.356.4
DOSE65.766.161.163.462.063.862.863.262.761.051.760.350.046.760.0
ER, previewed domain n(t)
CL alone66.562.357.452.565.971.750.763.849.163.651.156.437.855.157.4
+TTA67.867.173.061.770.772.767.668.766.573.671.263.769.862.368.3
+TTAbatch^{\mathrm{batch}}66.665.268.558.168.571.461.366.157.970.055.660.859.261.163.6
DOSE66.767.573.862.371.073.368.168.566.569.072.760.669.861.367.9
ER, trained domains, mean of aj(t)a_j(t)
CL alone65.867.066.567.466.066.666.865.865.864.265.564.664.963.465.8
+TTA65.462.06.151.437.831.943.447.243.845.635.450.547.051.444.2
+TTAbatch^{\mathrm{batch}}64.964.162.064.862.362.963.262.761.160.660.961.059.959.462.1
DOSE66.067.166.467.265.866.666.565.565.364.265.264.564.863.265.6

Table 26. C100-C per task (ResNeXt-29, accuracy, mixed batches, Tent and ROID averaged). +TTA: CL + TTA with the statistics estimated during the preview. +TTAbatch^{\mathrm{batch}} (gray): with the statistics of each test batch, the usual protocol of continual TTA.

Table 27. IN-C per task (ResNet-50, severity 5, accuracy, mixed batches, Tent and ROID averaged). Rows as in Table 26. With 1,000 classes, 0.1% is chance. It is a collapse of the predictions, not of the evaluation: at task 2 of the run of seed 0 without memory, one class receives 19% of all predictions of the CL method alone, against 1% at task 0, because the stored statistics of impulse noise do not fit defocused images. Re-estimating the statistics on the same images, as TTA does, brings them back to 28.5%.

task tt (previewed domain)012345678910111213mean
shotimpuldefocglassmotnzoomsnowfrostfogbritcontrelastpixeljpeg
FT, previewed domain n(t)n(t)
CL alone35.735.40.13.714.131.82.125.38.47.40.60.428.633.016.2
+TTA44.743.228.535.038.344.137.336.444.953.929.844.048.045.441.0
+TTA{sub}batch`43.742.320.326.827.133.623.828.227.046.610.031.140.438.531.4
DOSE42.839.428.632.735.742.539.037.346.151.032.841.948.446.240.3
FT, trained domains, mean of aj(t)a_j(t)
CL alone43.544.042.511.011.215.818.78.511.89.711.45.011.011.118.2
+TTA40.443.00.13.29.412.91.95.74.96.81.96.07.311.711.1
+TTA{sub}batch`40.543.723.518.217.317.015.216.715.113.316.314.416.217.020.3
DOSE43.343.342.616.915.215.318.814.613.815.311.413.911.011.320.5
ER, previewed domain n(t)n(t)
CL alone34.537.60.15.615.928.43.522.917.231.13.714.934.535.220.4
+TTA44.142.327.632.434.939.033.331.640.349.724.839.944.740.937.5
+TTA{sub}batch`42.941.219.826.529.435.821.528.327.940.47.929.539.837.730.6
DOSE42.340.227.931.134.438.535.933.942.850.027.240.046.042.538.0
ER, trained domains, mean of aj(t)a_j(t)
CL alone43.344.344.040.536.234.233.532.332.029.128.029.527.527.634.4
+TTA39.142.80.15.29.713.83.29.75.18.91.79.39.016.012.4
+TTA{sub}batch`39.142.723.130.526.226.824.526.319.821.320.321.721.821.426.1
DOSE43.344.344.040.436.134.033.632.331.928.927.829.427.427.234.3

Table 27.

Table 28. Cityscapes →\to ACDC per task (DeepLabV3+ R50, mIoU, 5 seeds). Left: the preview condition. Right: the mean over the trained domains (Cityscapes and the conditions trained so far). +TTA: CL + TTA with the statistics estimated during the preview.

previewed condition, task tttrained domains (mean), task tt
0 fog1 night2 rain3 snowmean0123mean
FTCL alone61.017.239.250.041.874.557.449.952.958.7
BN adapt, +TTA54.225.947.753.145.262.832.549.449.248.5
BN adapt, DOSE53.926.346.651.444.574.558.540.152.656.4
Tent, +TTA56.227.048.251.945.862.130.848.547.147.1
Tent, DOSE55.827.847.152.545.874.553.547.048.856.0
CoTTA, +TTA64.019.141.952.544.474.659.451.055.760.2
CoTTA, DOSE64.017.941.951.343.874.658.044.954.758.1
ERCL alone62.420.847.654.446.375.771.459.561.266.9
BN adapt, +TTA55.731.754.055.949.363.557.555.856.558.3
BN adapt, DOSE55.531.752.756.149.075.771.059.861.066.9
Tent, +TTA56.531.054.354.749.162.254.353.454.556.1
Tent, DOSE56.331.453.555.049.075.771.659.461.267.0
CoTTA, +TTA64.623.550.955.548.675.771.861.261.667.6
CoTTA, DOSE64.623.350.455.448.475.771.859.661.767.2

Table 28.

On IN-C, the CL method alone often falls to chance on the preview corruption, for instance on defocus blur after impulse noise or on contrast after brightness: the stored statistics of one corruption do not fit the next. TTA recovers 17 to 25 points on the preview, and DOSE keeps this gain (38.0 against 37.5 with ER, 40.3 against 41.0 with FT). On the trained domains, CL + TTA collapses as soon as a noise is followed by a blur, while DOSE stays within 0.1 points of the CL method alone with ER and 2.3 points above it with FT. IN-C is also hard for the CL method alone itself. Each task gives 25 labeled images per class, trained for one epoch, and without a buffer the stored statistics follow the latest corruption, so the older ones fall to about 11%. On C100-C, TTA gains 10 to 23 points on the preview, and DOSE keeps all but 1 to 3 of them while matching or beating the CL method alone on the trained domains. In segmentation, TTA gains little on the preview conditions except at night, and BN Stats Adapt and Tent lose 5 to 7 points on fog. With ER, DOSE keeps the trained conditions at the level of the CL method alone. Without a buffer, it loses on them in the tasks where its bank check keeps an outdated bank.

Additional analyses

Same statistics for every method

Since TTA methods are usually evaluated with the statistics of the test batch, which our main protocol forbids, we check that the gain of DOSE does not come from the protocol. In Table 29, every method gets the same statistics. With the statistics of each evaluation batch, which mixes all evaluated domains (§ 3.2), DOSE is above CL + TTA by 4.4 points without memory and 3.6 with a buffer. On single-domain batches (Oracle), CL + TTA scores 7.0 points more without memory and 2.7 with a buffer than on mixed ones, with the same model. In that case, DOSE reduces to CL + TTA with the prototype head and is at most 0.6 points below it in all 12 settings, and up to 1.4 above. Without memory, DOSE with its own statistics stays below the Oracle, by up to 13.7 points on IN-C, because single-domain batches hand CL + TTA fresh statistics of every old domain, which memory-free CL cannot keep. With a buffer, DOSE is at most 0.5 points below it. UnMix-TNS [46], built for correlated labels within one domain, is below CL + TTA with batch statistics in all 12 settings, and below DOSE in all 12.

statisticsbatchesFT CL + TTAFT DOSEER CL + TTAER DOSE
evaluation batchmixed53.958.358.061.6
evaluation batchsingle-domain60.961.260.761.3
preview (ours)either41.955.844.461.6
UnMix-TNS around ROID, components frozen41.743.4
UnMix-TNS around ROID, components adapting (test batch)47.149.2
no TTA (CL method alone)43.458.3

Table 29. Protocols (ResNet, score averaged over the six benchmarks, Tent and ROID). Each row says where the statistics come from and how batches are formed, and both methods get the same statistics. UnMix-TNS runs around ROID. On the same ROID runs, CL + TTA scores 42.9/45.4 (batch-independent) and 54.4/58.0 (test-batch), and DOSE 55.8/61.6 (FT/ER).

Why the next task starts from θtr\theta_{\mathrm{tr}}

With the next task from the adapted network, as in CL + TTA, DOSE on C100-C without memory reaches 60 to 61 points with Norm, CoTTA and POEM, but 41 to 50 with Tent, RoTTA, SAR, CMF, ROID and EATA (Table 31). RoTTA changes the structure of the network, so that without a buffer its changes are shared and DOSE equals CL + TTA. With the five other methods, the older domains collapse right after the preview, from the second task on. With ROID, domains 0 and 1 fall to 14.9% after the preview of task 2, against 56.1% with Tent at the rate of the PALM benchmark (2⋅10−52 \cdot10^{-5}), while their posterior weight on the preview is about 3% with every method and the latest domain is unaffected. The damage therefore comes from the statistics that the bank gives the older domains. These five methods adapt with a learning rate of 10−310^{-3} on CIFAR, and C100-C has the longest preview of the CIFAR benchmarks (5,000 images, against 1,000 for C100-TF). The next task then carries their larger change, and the statistics stored in the bank for the older domains no longer match their activations. The bank check cannot see it, since it scores images of the latest domain only, which the bank barely affects. Therefore, DOSE starts the next task from θtr\theta_{\mathrm{tr}} (§ 5.2). Table 30 changes one choice at a time, at the official rates. Starting the next task from θtr\theta_{\mathrm{tr}} removes the collapse, and the three methods then score 60.3 to 60.9, above DOSE without a TTA method (58.2). A preview of 1,000 images removes more than half of it (54.8 to 56.5). Without the bank, the older domains no longer collapse at task 2, but memory-free CL then forgets them over the following tasks, as without DOSE.

ROIDEATATent
AAold 0-1AAold 0-1AAold 0-1
adapted47.514.948.321.743.410.2
from θtr\theta_{\mathrm{tr}}60.956.960.456.060.357.3
preview 1,00055.141.756.548.654.845.3
no bank48.055.048.254.446.654.2

Table 30. C100-C without memory (ResNeXt-29, 5 seeds, official rates: 10−310^{-3} for Tent, ROID and EATA). AA: score. Old 0-1: accuracy on domains 0 and 1 right after the preview of task 2. Adapted: the next task starts from the adapted network, as in CL + TTA. From θtr\theta_{\mathrm{tr}}: the setting of Table 2. Preview 1,000: 1,000 random images of each preview, next task from the adapted network. No bank: --dose-bank off, next task from the adapted network.

Both starts on C100-C and IN-C. Table 31 compares the two starts with every TTA method of Table 2, with and without memory, with Tent at 10−310^{-3} on both sides, on the same runs and seeds. Starting from θtr\theta_{\mathrm{tr}} needs no additional storage, since DOSE already keeps what TTA changed as a difference to θtr\theta_{\mathrm{tr}}. On ResNets without memory, it brings the median on C100-C from 48.3 to 60.7, above DOSE without a TTA method (58.2), and on IN-C from 21.4 to 22.3. The other cells change by 0.0 to +1.4 points. Method by method, it is at least as good in 45 of the 56 pairs of method and setting, while CoTTA on ViTs loses 8.6 points on IN-C without memory. CL + TTA keeps the adapted start, as TTA methods are usually deployed.

TTA learning rate and cost

Every TTA method keeps its official learning rate, which its authors tuned on their own benchmarks and backbones (for Tent on CIFAR, the value of the CoTTA code, Table 5). In our setup, the preview domain has no labels before its task, so that this rate cannot be tuned, and it may be too large for a new backbone, benchmark or CL method. Notably, a too large learning rate can make the TTA method collapse on the preview, and CL + TTA then predicts every image with the collapsed network. Therefore, we test how each method copes with a wrong learning rate by multiplying the official one by ten (Table 17). In that case, several methods collapse under CL + TTA, such as CoTTA on ViT-C100-TF (1.6), while DOSE stays above CL + TTA in 23 of 25 pairs and above the CL method alone in 16. A smaller rate does not protect CL + TTA either, since its damage on ResNets comes from the statistics of the preview and not from the size of the update: on C100-C, Tent at 2⋅10−52\mathord{\cdot}10^{-5} instead of 10−310^{-3} gives 43.8 against 42.0 without memory and 43.0 against 45.2 with a buffer. It only helps the adapted start of DOSE, which scores 60.3 against 45.0 without memory, whereas the start from θtr\theta_{\mathrm{tr}} scores 60.7 at 10−310^{-3} (Sec. H.2). Regarding cost, DOSE adds one pass through the frozen first block per image. At the last task, an image costs 1.46 to 1.67 times the forward time of CL + TTA on ResNets and 1.01 to 1.02 times on ViTs (Table 25).

Stability against plasticity

The score AA averages the accuracy over all domains seen so far. Wang et al. [50] note that the average accuracy of continual learning mostly rewards stability, and that plasticity needs its own measure. The same holds for AA, where the preview domain weighs only 1/(t+2)1/(t+2) at task tt. Table 32 therefore reports a balanced score B=12(old+new)B = \frac{1}{2}(\text{old} + \text{new}), which gives the preview domain the same weight as all trained domains together. Under BB, the gains of DOSE grow. On average over the six benchmarks, DOSE is above the CL method alone by 15.8 and 5.7 points on ResNets (FT and ER) and by 1.7 points on ViTs with both, against 10.0, 2.8, 0.8 and 0.5 points under AA. DOSE is at least as good as the CL method alone in all 24 settings and as CL + TTA in 22 of them. CL + TTA with test-batch statistics is above DOSE only on three memory-free ResNet benchmarks (C100-C, DomainNet and C20).

C100-CC100-TFC20DomainNetInet-TFIN-CMean
ResNet, FTno TTA47.446.259.835.936.517.240.5
+TTA54.455.360.339.551.026.147.8
+TTA{batch}60.363.060.444.969.026.654.0
Ours63.767.860.143.377.130.657.1
ResNet, ERno TTA61.660.163.648.865.827.454.5
+TTA55.057.263.441.252.424.849.0
+TTA{batch}62.564.663.148.072.929.456.8
Ours65.468.964.249.679.534.860.4
ViT-B/16, FTno TTA65.172.771.861.795.250.169.4
+TTA67.373.272.161.695.355.370.8
Ours67.574.273.362.895.853.971.2
ViT-B/16, ERno TTA67.874.273.962.595.654.071.3
+TTA69.174.874.062.795.457.772.3
Ours69.676.076.164.096.057.373.2

Table 32. Balanced score B=12(old+new)B = \frac{1}{2}(\text{old}+\text{new}) (%, mixed batches, median over the TTA methods of Table 2). Old is the mean accuracy on the trained domains and new the accuracy on the preview domain, both averaged over tasks. Columns and systems are those of Table 2, and bold marks the best system that uses no statistic of the evaluation batch.

Semantic segmentation: Cityscapes to ACDC

From Cityscapes to the ACDC conditions (Table 33), DeepLabV3+ shows the BatchNorm problem of ResNets. With ER, DOSE keeps the score of the CL method alone with every TTA method, while BN Stats Adapt and Tent cost CL + TTA 5 to 7 points. With FT, DOSE gains 3 to 5 points over CL + TTA with these two but stays below the CL method alone, and loses 1.8 points with CoTTA, as its bank restores outdated statistics (Sec. G.7). On SegFormer-B5, which uses LayerNorm, TTA barely harms the trained conditions, as on ViTs, and DOSE keeps the gain of SVDP (+0.6 points over the CL method alone).

DeepLabV3+ (BatchNorm)SegFormer-B5 (LayerNorm)
FTERFTER
no TTA52.860.065.866.1
TTA+TTADOSE+TTADOSE+TTADOSE+TTADOSE
BN adapt46.950.255.160.365.765.965.766.0
Tent46.351.753.560.565.765.866.066.0
CoTTA54.853.061.260.9––––
SVDP––––66.766.467.066.7

Table 33. Cityscapes → ACDC (score, mIoU %, DeepLabV3+ with a ResNet-50 and SegFormer-B5). +TTA uses the statistics estimated during the preview. Tent is the original method on DeepLabV3+, and on SegFormer, whose only BatchNorm layers are in its head, the version released with the official CoTTA code [51] for this benchmark, which adapts the affine parameters of every normalization layer. DOSE without prototypes (see text). –: not run.

We apply the same protocol to dense prediction. The network is DeepLabV3+ with a ResNet-50 backbone, which uses BatchNorm, initialized from the official mmpsegmentation Cityscapes weights. It is trained task after task on Cityscapes and then on the ACDC conditions fog, night and rain, for one epoch each with SGD on crops of 512 × 512 pixels, and ER keeps 200 images. Each task previews the next condition on its test split, whose 500 images per condition have no public labels. The score is the mIoU over 19 classes on the validation split of every trained domain and of the preview one, averaged over domains and tasks. Images are used at half resolution. BN Stats Adapt, Tent and CoTTA, the three baselines of the Cityscapes-to-ACDC experiment of CoTTA, follow its official code, with one image per step. Its Tent keeps the network in evaluation mode, adapts the affine parameters of every normalization layer and minimizes the cross-entropy of its own predictions. CoTTA averages its teacher over 7 scales and their flips. This Tent was written for SegFormer, whose BatchNorm layers are only in its head. On DeepLabV3+ we therefore also run the original Tent, which normalizes each test image with its own statistics and minimizes the entropy, as in our classification experiments. CoTTA keeps the stored statistics, so its two protocols coincide. We also run SegFormer-B5, the network of the Cityscapes-to-ACDC benchmark of CoTTA, with the official mmsegmentation Cityscapes weights. Its encoder uses LayerNorm, and its only BatchNorm layers are the five of its head. It is trained with AdamW at a tenth of its official rate, as DeepLabV3+ with SGD. On SegFormer we run BN Stats Adapt, Tent and SVDP [54], a recent method with official code for this benchmark. SVDP adds sparse learnable prompts to the most uncertain pixels of the input. We use the settings of its official run (prompts on 0.1% of the pixels, learning rate 10−410^{-4}), and each image is predicted with prompts placed on its own uncertainty, as in the official code. Its prompt map is defined for the size of the ACDC images, so we resize it for Cityscapes images. DOSE is unchanged, except that it has no prototype head and that its two checks compare images by pixel accuracy. The prototype head would keep one prototype per class, the mean feature of the preview pixels weighted by their predicted probability of that class, and score every pixel against these prototypes. We tested it, and it lowers the score in 13 of the 14 settings of Table 33, by 1.0 point on average and mostly on the preview condition. We therefore leave it out. We use 5 seeds. With the Tent of CoTTA’s code on DeepLabV3+, CL + TTA scores 51.2 with FT and 58.5 with ER, and DOSE 50.8 and 59.9. This Tent leaves the statistics untouched, so there is little for DOSE to dose. On SegFormer, with BN Stats Adapt and Tent, CL + TTA and DOSE stay within 0.4 points of the CL method alone in our protocol (Table 33). With the statistics of each test image instead, BN Stats Adapt costs 0.7 points without a buffer and 1.4 with one. The five BatchNorm layers of the head are all that DOSE can dose. SVDP changes every weight and adds prompts. It raises the preview condition by 2.8 points over the CL method alone without hurting the trained ones, with and without a buffer, and DOSE stays within 0.3 points of CL + TTA (66.4 and 66.7 against 66.7 and 67.0).

Along a long stream

Figure 4 follows the two sequences of 14 domains task by task, with ER and Tent. On the trained domains (A), DOSE follows the CL method alone, which itself declines on ImageNet-C as CL forgets. CL + TTA falls about 20 points below it at the third domain with the statistics of the test batch, and it collapses with its own statistics. On the preview domain (B), DOSE keeps the online accuracy of TTA during the preview, far above the CL method alone. It thus uses the adaptation without paying for it on the trained domains. With NOTE on C100-C (5 seeds), DOSE ties CL + TTA (54.8 against 54.8), and both are 10 points below the CL method alone (64.7). NOTE replaces every BatchNorm layer by its own instance-aware normalization, and DOSE changes little around it, as for NOTE in Table 13. On IN-C, DOSE is 1.1 points above CL + TTA (24.1 against 23.0), and both stay far below the CL method alone (31.8).

What the recorded statistics see

Figure 5 projects the vectors s(x)s(x) of the training images of each domain, computed on the network input and the frozen first block. Corruptions and styles form separate clusters. The sub-class domains of C20 overlap, which is why the bank check drops the bank and DOSE performs similarly to the CL method alone there (§ 5). We fit the posterior of § 5 on half of the images of each domain. It finds the domain of the other half for 97% of the images on Inet-TF, 79% on C100-TF and 66% on DomainNet, but only 27% on C20, where chance is 25%.

Stress test: a preview mixed with trained domains

Our protocol spends the preview on the next domain, as in a targeted rollout where the data of the next task is collected. Adapting to an uncurated stream in which recurring and new domains mix is the problem of general continual TTA, such as NOTE [15], RoTTA [55] or ReservoirTTA [48], which DOSE can wrap (Table 13). We nevertheless evaluate this harder case. We add to each preview as many images of the trained domains as it holds, in equal shares per domain, so that half of the stream is old. They come from the halves of the held-out sets that the task does not score. The preview domain is still scored on its own images. Such a stream changes what TTA learns. CL + TTA gains up to 24 points, but not from the new domain: its statistics now also describe the trained domains, which it sees again. The recorded statistics and the BatchNorm statistics of the preview, in turn, describe a mixture. DOSE can however use its recorded statistics during the preview. With the filter, an image that the recorded statistics of a trained domain explain better than those of the preview so far is left out of the TTA update, the preview’s record and its statistics. This is the posterior of § 5 with the images seen so far, so it needs no threshold. The filter starts after 100 images. Table 34 gives the scores (Tent and ROID, ER and FT, 5 seeds). With half old images, DOSE stays the best system on TF/Inet and on C100-TF (62.6 against 54.4 for CL + TTA). On DomainNet and C20, it falls 1.4 and 0.6 points below CL + TTA, which profits from seeing old images again, and the filter does not help there. The filter drops 83% of the old images but also 33% of the new ones (5 seeds). On the pure preview, it drops 26% of the images (6% on Inet-TF, 59% on C20) and costs at most 0.5 points. A ViT keeps no domain statistics that old images could pull toward a mixture. With half old images, CL + TTA and DOSE move by at most 0.6 points on ViTs, and DOSE stays above CL + TTA. Mixed previews on ResNets thus call for a sample-selection or stream-clustering step in front of DOSE, which we leave to future work.

previewsystemResNet TF/InetResNet C100-CResNet DNResNet C20ViT-B/16 TF/InetViT-B/16 C20
pureno TTA56.456.745.165.985.178.0
+TTA46.345.839.166.285.878.3
+TTAbatch{\text{batch}}68.859.947.966.1––
DOSE73.163.547.666.386.379.2
DOSE + filter73.163.347.265.886.279.0
half old+TTA69.354.448.967.086.078.9
+TTAbatch{\text{batch}}69.954.748.166.4––
DOSE71.562.647.566.486.479.5
DOSE + filter72.663.146.965.986.279.4

Table 34. A preview that is half old images (score A, Tent and ROID, ER and FT, 5 seeds; a ViT has no BatchNorm statistics, so its two CL + TTA protocols coincide). Pure: the protocol of the paper. Half old: each preview also holds as many images of the trained domains. The filter leaves out of the TTA update the images that the recorded statistics of a trained domain explain better than those of the preview.

ViT gains and preview length

On ViTs, the prompt and adapter methods built for them (DPCore, DePT and ViDA) move the preview by less than 1 point in 6 to 78 updates. The methods that adapt LayerNorm with stronger losses (ROID, CMF, DAS and EATA) gain 6 to 14 points on corrupted previews (Table 16) and lose at most 1.8 points on the trained domains. Yet the score rises by at most 3.7 points, because the preview weighs only 0.17 (IN-C) to 0.29 (C100-TF) of it. The gain of TTA follows the amount of preview data. Over every TTA method and without memory, its median on the preview is 7.9 points on IN-C (20,000 preview images), 2.8 on C100-C (5,000), 0.9 on C100-TF (1,000) and 0.3 on Inet-TF (about 400). On C100-C, the gain grows from 2.2 to 5.8 points between 500 and 5,000 images (Figure 3), and the official SAR code on ImageNet-C reaches 51% after the 50,000 images of the usual protocol, against 38% after 5,000 (Sec. G.6). Longer previews provide both more images and more adaptation updates; these experiments do not isolate their respective effects. Labeled data is scarce too. IN-C and C100-C give 25 and 33 labeled images per class and task (Table 8), and the CL method alone scores lowest on them.

Dosing what TTA changes on a ViT

A ViT has no domain statistics, and TTA methods change its LayerNorm parameters, prompts or adapters. DOSE shares these changes unless the shared-parameter check doses them (§ 5). On ViTs, dosing every changed tensor by λ\lambda changes the score by −0.1 and −0.2 points (Table 3). The reason is that these changes barely hurt the trained domains of a ViT, by at most 2.4 points on the domain just learned (Table 9), so there is little to protect. On C100-C and IN-C, where TTA gains most on ViTs, dosing every changed tensor costs 0.9 and 0.7 points (1.3 without a buffer), so sharing remains the better default.

The prototypes, in contrast, need their weight only on ViTs. We gave them a weight of one on every image (Tent/ROID, 5 seeds). They then gain up to 1.4 points on C20 and C100-C, where the trained and preview domains look alike. On ImageNet-R and ImageNet-A they lose 0.3 to 1.6 points in each setting (37 of 40 runs), mostly on the trained domains, and on ImageNet-A they fall below the CL method alone. Averaged over the seven benchmarks, the gain is only 0.2 points. The weight λ\lambda keeps the prototypes off the images of the trained domains, and this is what makes them safe.

Three training epochs per task

Table 35 trains every task for three epochs instead of one, with everything else unchanged (ER, Tent/ROID, 5 seeds). On average, the CL method alone gains at most 0.7 points. DOSE stays above the CL method alone by 4.2 points on ResNets and 0.9 on ViTs, against 4.0 and 1.1 with one epoch. It stays above CL + TTA by 17.1 and 0.7 points, against 16.5 and 0.6. The single epoch of our protocol therefore does not create the gain of DOSE.

1 epoch3 epochs
no TTA+TTADOSEno TTA+TTADOSE
ResNetC100-TF63.152.169.161.750.368.6
ResNetC2068.168.168.667.066.967.1
ResNetDomainNet51.140.251.352.942.153.3
ResNetInet-TF70.842.580.171.442.380.8
ResNetMean63.350.767.363.350.467.4
ViT-B/16C100-TF75.276.677.275.776.677.4
ViT-B/16C2079.179.480.278.778.879.5
ViT-B/16DomainNet63.964.264.866.066.166.9
ViT-B/16Inet-TF96.095.896.296.495.896.4
ViT-B/16Mean78.579.079.679.279.380.1

Table 35. One against three CL epochs per task (score, ER, mixed batches, mean of Tent and ROID, 5 seeds). +TTA: CL + TTA with its own statistics.

BatchNorm-aware CL

On ResNets, the damage of TTA comes from the BatchNorm statistics that all domains share (§ 4). Therefore, we also run two CL variants that change how BatchNorm is used, with everything else unchanged (ER and FT, Tent/ROID, 5 seeds). Continual Normalization (CN) [37] applies a GroupNorm without affine parameters (32 groups) before every BatchNorm layer of the pretrained network. Cumulative statistics (Cum.) replace the running average of BatchNorm by the average over every training batch so far. Since Cum. only changes how the CL training estimates the statistics, we run it as the CL method alone.

Without memory, CN raises the CL method alone from 43.4 to 50.2 points, while with a buffer it is 1.5 points below BatchNorm (56.8 against 58.3, see Table 36). Cum. is below CN in both cases. Notably, CN makes CL + TTA less harmful, but it does not remove the damage. With a buffer, TTA still lowers the accuracy on the trained domains from 57.9 to 47.9 points on DomainNet and from 31.8 to 21.2 on IN-C, and DOSE brings it back to 56.9 and 31.7. On CN, DOSE is at least as good as CN alone in 21 of 24 pairs of TTA method and setting, and as CN with TTA in 20. Overall, DOSE on BatchNorm remains the best system. It is at least as good as the better of CN and Cum. alone in 24 of 24 pairs, and scores 58.7 against 53.5 for CN alone on average.

FTER
BatchNormCum.CNBatchNormCum.CN
no TTA+TTAOursno TTAno TTA+TTAOursno TTA+TTAOursno TTAno TTA+TTAOurs
C100-C48.643.861.055.054.853.154.864.747.765.960.661.056.061.7
C100-TF49.749.366.654.558.360.862.763.152.169.161.362.963.166.0
C2063.764.364.158.961.261.760.668.168.168.661.364.865.165.2
DomainNet39.138.043.841.839.940.242.151.140.251.346.949.643.549.9
Inet-TF42.141.276.855.065.568.274.470.842.580.166.972.370.875.8
IN-C17.114.522.310.421.619.923.031.815.434.314.230.522.931.8
Mean43.441.855.845.950.250.652.958.344.361.651.956.853.658.4

Table 36. BatchNorm-aware CL (ResNet, score, mixed batches, mean of Tent and ROID, 5 seeds). BatchNorm: the runs of Table 2 with these two TTA methods, which therefore differ from its medians. Cum.: cumulative BatchNorm statistics. CN: Continual Normalization. +TTA: CL + TTA with its own statistics. Bold marks the best system.

Online against offline adaptation

One could also use the preview offline, with several passes of self-supervised learning over the stored images. Our setup excludes this because it keeps the images, and it also costs far more. For each preview domain, Table 37 gives the FLOPs, time and energy of one online pass of TTA over the preview, of what DOSE adds to it, and of SimCLRR and DINO over the stored preview.

C100-C (ResNeXt-29, 5,000 images)IN-C (ResNet-50, 20,000 images)stores the preview
TFLOPstime (s)energy (kJ)TFLOPstime (s)energy (kJ)
CL + TTA: one online pass over the preview (Tent)42.35.81.17486.051.49.89no
DOSE: the same pass + frozen first block and moments, no gradient45.56.31.23518.457.611.0no
SimCLR, 10 epochs847.7115.322.69,725.51,031.6203.1yes
SimCLR, 100 epochs8,477.31,153.1225.797,254.510,316.02,031.1yes
DINO, 10 epochs1,756.6256.648.418,604.62,316.5458.9yes
DINO, 100 epochs17,565.92,566.2483.7186,046.123,165.24,589.0yes

Table 37. Compute per preview domain. FLOPs of the forward and backward passes, counted with the FLOP counter of PyTorch on convolutions and matrix products. Time and energy (NVML counter) on one RTX A4500 with nothing else running, measured over 10 steps and scaled to the whole preview. SimCLR uses two views, batches of 256 (C100-C) and 64 (IN-C, to fit in memory) and a projection head 2048-2048-128. DINO uses 2 global and 6 local crops, a teacher forward pass and a head to 65 536 outputs. DOSE adds 6.7 to 7.5% of FLOPs and 5 to 12% of time and energy to TTA during the preview, while the offline methods cost 18 to 416 times as much and keep the preview. Peak memory: 1.8 and 5.8 GB for CL + TTA and DOSE, 14.0 and 11.5 GB for SimCLR, 6.9 and 9.7 GB for DINO (C100-C and IN-C).

Why CODA-Prompt is not above DER++

CODA-Prompt learns each new domain as well as FT. However, it has no buffer and a single shared classifier head, so it forgets across domains like FT. Its published gains are for class-incremental learning, with logit masking and many more epochs per task, which our single-epoch domain-incremental protocol does not use.

References

  1. [1]Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E. Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.arxiv.org/abs/1607.06450
  2. [2]Malik Boudiaf, Romain Mueller, Ismail Ben Ayed, and Luca Bertinetto. Parameter-free online test-time adaptation. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 8334–8343, 2022.arxiv.org/abs/2201.05718
  3. [3]Dhanajit Brahma and Piyush Rai. A probabilistic framework for lifelong test-time adaptation. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 3582–3591, 2023.
  4. [4]Pietro Buzzega, Matteo Boschini, Angelo Porrello, Davide Abati, and Simone Calderara. Dark experience for general continual learning: A strong, simple baseline. In Advances in Neural Information Processing Systems (NeurIPS), vol. 33, pages 15920–15930, 2020.
  5. [5]Woong-Gi Chang, Tackgeun You, Seonguk Seo, Suha Kwak, and Bohyung Han. Domain-specific batch normalization for unsupervised domain adaptation. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 7346–7354, 2019.
  6. [6]Arsalan Chaudhry, Marcus Rohrbach, Mohamed Elhoseiny, Thalaiyasingam Ajanthan, Puneet K. Dokania, Philip H. S. Torr, and Marc’Aurelio Ranzato. On tiny episodic memories in continual learning. arXiv preprint arXiv:1902.10486, 2019.
  7. [7]Haoran Chen, Micah Goldblum, Zuxuan Wu, and Yu-Gang Jiang. Adaptive retention & correction: Test-time training for continual learning. In International Conference on Learning Representations (ICLR), 2025.arxiv.org/abs/2405.14318
  8. [8]Wonguk Cho, Jinha Park, and Taesup Kim. Complementary domain adaptation and generalization for unsupervised continual domain shift learning. In IEEE/CVF International Conference on Computer Vision (ICCV), pages 11408–11418, 2023.
  9. [9]Francesco Croce, Maksym Andriushchenko, Vikash Sehwag, Edoardo Debenedetti, Nicolas Flammarion, Mung Chiang, Prateek Mittal, and Matthias Hein. RobustBench: A standardized adversarial robustness benchmark. In Proceedings of the Neural Information Processing Systems Track on Datasets and Benchmarks, vol. 1, 2021.arxiv.org/abs/2010.09670
  10. [10]Botos Csaba, Wenxuan Zhang, Matthias Müller, Ser-Nam Lim, Mohamed Elhoseiny, Philip Torr, and Adel Bibi. Label delay in online continual learning. In Advances in Neural Information Processing Systems (NeurIPS), vol. 37, pages 119976–120012, 2024.arxiv.org/abs/2312.00923
  11. [11]Mario Döbler, Robert A. Marsden, and Bin Yang. Robust mean teacher for continual and gradual test-time adaptation. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 7704–7714, 2023.
  12. [12]Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In International Conference on Learning Representations (ICLR), 2021.
  13. [13]Karl B. Dyer, Robert Capo, and Robi Polikar. COMPOSE: A semisupervised learning framework for initially labeled non-stationary streaming data. IEEE Transactions on Neural Networks and Learning Systems (TNNLS), 25(1):12–26, 2014.
  14. [14]Yunhe Gao, Xingjian Shi, Yi Zhu, Hao Wang, Zhiqiang Tang, Xiong Zhou, Mu Li, and Dimitris N. Metaxas. Visual prompt tuning for test-time domain adaptation. arXiv preprint arXiv:2210.04831, 2022.
  15. [15]Taesik Gong, Jongheon Jeong, Taewon Kim, Yewon Kim, Jinwoo Shin, and Sung-Ju Lee. NOTE: Robust continual test-time adaptation against temporal correlation. In Advances in Neural Information Processing Systems (NeurIPS), vol. 35, pages 27253–27266, 2022.
  16. [16]Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 770–778, 2016.arxiv.org/abs/1512.03385
  17. [17]Dan Hendrycks and Thomas Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. In International Conference on Learning Representations (ICLR), 2019.
  18. [18]Dan Hendrycks, Norman Mu, Ekin D. Cubuk, Barret Zoph, Justin Gilmer, and Balaji Lakshminarayanan. AugMix: A simple data processing method to improve robustness and uncertainty. In International Conference on Learning Representations (ICLR), 2020.
  19. [19]Dan Hendrycks, Steven Basart, Norman Mu, Saurav Kadavath, Frank Wang, Evan D. Dourado, Rahul Desai, Tyler Zhu, Samyak Parajuli, Mike Guo, Dawn Song, Jacob Steinhardt, and Justin Gilmer. The many faces of robustness: A critical analysis of out-of-distribution generalization. In IEEE/CVF International Conference on Computer Vision (ICCV), pages 8320–8329, 2021.
  20. [20]Dan Hendrycks, Kevin Zhao, Steven Basart, Jacob Steinhardt, and Dawn Song. Natural adversarial examples. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 15257–15266, 2021.
  21. [21]Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In International Conference on Machine Learning (ICML), PMLR, vol. 37, pages 448–456, 2015.
  22. [22]Yusuke Iwasawa and Yutaka Matsuo. Test-time classifier adjustment module for model-agnostic domain generalization. In Advances in Neural Information Processing Systems (NeurIPS), vol. 34, pages 2427–2440, 2021.
  23. [23]James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A. Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, Demis Hassabis, Claudia Clopath, Dharshan Kumaran, and Raia Hadsell. Overcoming catastrophic forgetting in neural networks. Proceedings of the National Academy of Sciences (PNAS), 114(13):3521–3526, 2017.DOI
  24. [24]Jae-Hong Lee and Joon-Hyuk Chang. Continual momentum filtering on parameter space for online test-time adaptation. In International Conference on Learning Representations (ICLR), 2024.
  25. [25]Yoonho Lee, Annie S. Chen, Fahim Tajwar, Ananya Kumar, Huaxiu Yao, Percy Liang, and Chelsea Finn. Surgical fine-tuning improves adaptation to distribution shifts. In International Conference on Learning Representations (ICLR), 2023.arxiv.org/abs/2210.11466
  26. [26]Yanghao Li, Naiyan Wang, Jianping Shi, Xiaodi Hou, and Jiaying Liu. Adaptive batch normalization for practical domain adaptation. Pattern Recognition, 80:109–117, 2018.DOI
  27. [27]Zhizhong Li and Derek Hoiem. Learning without forgetting. IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI), 40(12):2935–2947, 2018.
  28. [28]Jian Liang, Dapeng Hu, and Jiashi Feng. Do we really need to access the source data? Source hypothesis transfer for unsupervised domain adaptation. In International Conference on Machine Learning (ICML), PMLR, vol. 119, pages 6028–6039, 2020.arxiv.org/abs/2002.08546
  29. [29]Jiaming Liu, Senqiao Yang, Peidong Jia, Renrui Zhang, Ming Lu, Yandong Guo, Wei Xue, and Shanghang Zhang. ViDA: Homeostatic visual domain adapter for continual test time adaptation. In International Conference on Learning Representations (ICLR), 2024.arxiv.org/abs/2306.04344
  30. [30]Sarthak Kumar Maharana, Baoming Zhang, and Yunhui Guo. PALM: Pushing adaptive learning rate mechanisms for continual test-time adaptation. In AAAI Conference on Artificial Intelligence (AAAI), vol. 39, no. 18, pages 19378–19386, 2025.arxiv.org/abs/2403.10650
  31. [31]Robert A. Marsden, Mario Döbler, and Bin Yang. Universal test-time adaptation through weight ensembling, diversity weighting, and prior correction. In IEEE/CVF Winter Conference on Applications of Computer Vision (WACV), pages 2543–2553, 2024.arxiv.org/abs/2306.00650
  32. [32]Nicolas Michel, Maorong Wang, Jiangpeng He, and Toshihiko Yamasaki. From offline to online memory-free and task-free continual learning via fine-grained hypergradients. Transactions on Machine Learning Research (TMLR), 2026.arxiv.org/abs/2502.18762
  33. [33]Shuaicheng Niu, Jiaxiang Wu, Yifan Zhang, Yaofo Chen, Shijian Zheng, Peilin Zhao, and Mingkui Tan. Efficient test-time model adaptation without forgetting. In International Conference on Machine Learning (ICML), PMLR, vol. 162, pages 16888–16905, 2022.arxiv.org/abs/2204.02610
  34. [34]Shuaicheng Niu, Jiaxiang Wu, Yifan Zhang, Zhiquan Wen, Yaofo Chen, Peilin Zhao, and Mingkui Tan. Towards stable test-time adaptation in dynamic wild world. In International Conference on Learning Representations (ICLR), 2023.arxiv.org/abs/2302.12400
  35. [35]Junyoung Park, Jin Kim, Hyeongjun Kwon, Ilhoon Yoon, and Kwanghoon Sohn. Layer-wise auto-weighting for non-stationary test-time adaptation. In IEEE/CVF Winter Conference on Applications of Computer Vision (WACV), pages 1403–1412, 2024.arxiv.org/abs/2311.05858
  36. [36]Xingchao Peng, Qinxun Bai, Xide Xia, Zijun Huang, Kate Saenko, and Bo Wang. Moment matching for multi-source domain adaptation. In IEEE/CVF International Conference on Computer Vision (ICCV), pages 1406–1415, 2019.arxiv.org/abs/1812.01754
  37. [37]Quang Pham, Chenghao Liu, and Steven C. H. Hoi. Continual normalization: Rethinking batch normalization for online continual learning. In International Conference on Learning Representations (ICLR), 2022.arxiv.org/abs/2203.16102
  38. [38]Ori Press, Steffen Schneider, Matthias Kümmmerer, and Matthias Bethge. RDumb: A simple approach that questions our progress in continual test-time adaptation. In Advances in Neural Information Processing Systems (NeurIPS), vol. 36, pages 39915–39935, 2023.arxiv.org/abs/2306.05401
  39. [39]Marco Saerens, Patrice Latinne, and Christine Decaestecker. Adjusting the outputs of a classifier to new a priori probabilities: A simple procedure. Neural Computation, 14(1):21–41, 2002.
  40. [40]Antoine Saporta, Arthur Douillard, Tuan-Hung Vu, Patrick Pérez, and Matthieu Cord. Multi-head distillation for continual unsupervised domain adaptation in semantic segmentation. In IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW), pages 3750–3759, 2022.arxiv.org/abs/2204.11667
  41. [41]Steffen Schneider, Evgenia Rusak, Luisa Eck, Oliver Bringmann, Wieland Brendel, and Matthias Bethge. Improving robustness against common corruptions by covariate shift adaptation. In Advances in Neural Information Processing Systems (NeurIPS), vol. 33, pages 11539–11551, 2020.arxiv.org/abs/2006.16971
  42. [42]Vaibhav Singh, Rahaf Aljundi, and Eugene Belilovsky. Dual-phase continual learning: Supervised adaptation meets unsupervised retention. Transactions on Machine Learning Research (TMLR), 2026.arxiv.org/abs/2406.13653
  43. [43]James Seale Smith, Leonid Karlinsky, Vyshnavi Gutta, Paola Cascante-Bonilla, Donghyun Kim, Assaf Arbelle, Rameswar Panda, Rogerio Feris, and Zsolt Kira. CODA-Prompt: Continual decomposed attention-based prompting for rehearsal-free continual learning. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 11909–11919, 2023.arxiv.org/abs/2211.13218
  44. [44]Haopeng Sun, Yingwei Zhang, Lumin Xu, Sheng Jin, Ping Luo, Chen Qian, Wentao Liu, and Yiqiang Chen. Unsupervised continual domain shift learning with multi-prototype modeling. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 10131–10141, 2025.DOI
  45. [45]Jonathan Swinnen and Tinne Tuytelaars. Remembering by reconstructing: Domain incremental learning with test-time training on video streams. arXiv preprint arXiv:2605.31108, 2026.
  46. [46]Devavrat Tomar, Guillaume Vray, Jean-Philippe Thiran, and Behzad Bozorgtabar. Un-mixing test-time normalization statistics: Combatting label temporal correlation. In International Conference on Learning Representations (ICLR), 2024.arxiv.org/abs/2401.08328
  47. [47]Gido M. van de Ven, Tinne Tuytelaars, and Andreas S. Tolias. Three types of incremental learning. Nature Machine Intelligence, 4(12):1185–1197, 2022.DOI
  48. [48]Guillaume Vray, Devavrat Tomar, Xufeng Gao, Jean-Philippe Thiran, Evan Shelhamer, and Behzad Bozorgtabar. ReservoirTTA: Prolonged test-time adaptation for evolving and recurring domains. In Advances in Neural Information Processing Systems (NeurIPS), vol. 38, pages 70718–70764, 2025.arxiv.org/abs/2505.14511
  49. [49]Dequan Wang, Evan Shelhamer, Shaoteng Liu, Bruno Olshausen, and Trevor Darrell. Tent: Fully test-time adaptation by entropy minimization. In International Conference on Learning Representations (ICLR), 2021.arxiv.org/abs/2006.10726
  50. [50]Maorong Wang, Nicolas Michel, Ling Xiao, and Toshihiko Yamasaki. Improving plasticity in online continual learning via collaborative learning. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 23460–23469, 2024.arxiv.org/abs/2312.00600
  51. [51]Qin Wang, Olga Fink, Luc Van Gool, and Dengxin Dai. Continual test-time domain adaptation. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 7191–7202, 2022.arxiv.org/abs/2203.13591
  52. [52]Yabin Wang, Zhiwu Huang, and Xiaopeng Hong. S-Prompts learning with pre-trained transformers: An Occam’s razor for domain incremental learning. In Advances in Neural Information Processing Systems (NeurIPS), vol. 35, pages 5682–5695, 2022.
  53. [53]Zifeng Wang, Zizhao Zhang, Chen-Yu Lee, Han Zhang, Ruoxi Sun, Xiaoqi Ren, Guolong Su, Vincent Perot, Jennifer Dy, and Tomas Pfister. Learning to prompt for continual learning. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 139–149, 2022.arxiv.org/abs/2112.08654
  54. [54]Senqiao Yao, Jiarui Wu, Jiangming Liu, Xiaoqi Li, Qizhe Zhang, Mingjie Pan, Yulu Gan, Zehui Chen, and Shanghang Zhang. Exploring sparse visual prompt for domain adaptive dense prediction. In AAAI Conference on Artificial Intelligence (AAAI), vol. 38, no. 15, pages 16334–16342, 2024.
  55. [55]Longhui Yuan, Binhui Xie, and Shuang Li. Robust test-time adaptation in dynamic scenarios. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 15922–15932, 2023.arxiv.org/abs/2303.13899
  56. [56]Yunbei Zhang, Akshay Mehra, Shuaicheng Niu, and Jihun Hamm. DPCore: Dynamic prompt coreset for continual test-time adaptation. In International Conference on Machine Learning (ICML), PMLR, vol. 267, pages 75757–75778, 2025.arxiv.org/abs/2406.10737

Paper details

vlnc:W_w9x8xec7
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 2

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

an LLM

View statement
Looking for related papers…
Contents