Skip to content

Latest commit

 

History

History
319 lines (230 loc) · 19.7 KB

File metadata and controls

319 lines (230 loc) · 19.7 KB

GOLD: The Golden Subspace

Where Efficiency Meets Generalization in Continual Test-Time Adaptation


CVPR 2026 Conference PDF arXiv GitHub stars

Guannan Lai · Da-Wei Zhou · Zhenguo Li · Han-Jia Ye

Official CVPR 2026 implementation of GOLD (Guided Online Low-rank Directional adaptation): efficient continual test-time adaptation in a low-rank classifier-sensitive subspace.

Paper · arXiv · Quick Start · Results · Citation · Issues

🎉 Introduction

Continual test-time adaptation (CTTA) aims to continuously adapt a pre-trained model to evolving target environments without accessing source data. While recent methods have shown promising gains, they often face a fundamental trade-off: stronger adaptation usually requires updating more parameters, which increases online optimization cost and may even hurt long-term robustness under continuously shifting distributions. As a result, achieving both effectiveness and efficiency in CTTA remains challenging.

In this work, we revisit CTTA from the perspective of adaptation space. Instead of updating high-dimensional features or a large number of model parameters, we ask a simple question: is there a compact subspace that is sufficient for effective test-time adaptation? Our answer is yes. As illustrated below, although target data may drift continuously over time, effective adaptation can be carried out within a small yet expressive subspace, which we call the golden subspace. Building on this insight, we propose GOLD, a lightweight and efficient CTTA framework that dynamically identifies and exploits this subspace for online adaptation, leading to strong performance with minimal trainable parameters and low computational overhead.

✨ GOLD

GOLD is built on the key observation that effective continual test-time adaptation does not require updating the full feature space. Instead, there exists a compact subspace that is sufficient for adaptation, which we term the golden subspace. Based on this insight, GOLD performs online adaptation by projecting target features into this low-dimensional subspace and learning only a lightweight scaling vector, significantly reducing the adaptation cost while preserving strong adaptation capability.

Concretely, GOLD consists of two alternating stages: adapt and update. In the adapt stage, frozen backbone features are projected onto the golden subspace and then recalibrated through a residual low-rank transformation parameterized by the scaling vector. In the update stage, GOLD dynamically estimates the golden subspace from incoming target data using the Average Gradient Outer Product (AGOP), and updates the scaling vector with self-training and prototype-based contrastive objectives. In this way, GOLD enables efficient and effective adaptation under continuously evolving test distributions.

Publication

Published at CVPR 2026, pp. 3866–3875. The CVF proceedings page provides the official paper and citation; the arXiv preprint is also available.

📚 Citation

If you find this repo useful, please consider citing:

@inproceedings{lai2026golden,
  title     = {The Golden Subspace: Where Efficiency Meets Generalization in Continual Test-Time Adaptation},
  author    = {Lai, Guannan and Zhou, Da-Wei and Li, Zhenguo and Ye, Han-Jia},
  booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
  pages     = {3866--3875},
  month     = jun,
  year      = {2026},
  url       = {https://openaccess.thecvf.com/content/CVPR2026/html/Lai_The_Golden_Subspace_Where_Efficiency_Meets_Generalization_in_Continual_Test-Time_CVPR_2026_paper.html}
}

☄️ How to Use

To use the repository, we provide a conda environment.

git clone https://github.com/AIGNLAI/GOLD.git
cd GOLD
conda env create -f environment.yml
conda activate tta

Quick Start

The released environment is a Linux/CUDA conda environment named tta. Prepare the datasets and, for segmentation, the source checkpoints using the instructions below. Paths in each conf.py are relative to the corresponding task directory.

For continual classification, run from the repository root:

cd classification
python test_time.py --cfg cfgs/cifar10_c/gold.yaml SETTING continual

Other released GOLD configurations are cfgs/cifar100_c/gold.yaml and cfgs/imagenet_c/gold.yaml. For segmentation, start from the repository root in a separate shell with the tta environment active:

cd segmentation
python test_time.py --cfg cfgs/gold.yaml
Task GOLD implementation Configuration
Classification classification/methods/gold.py CIFAR-10-C, CIFAR-100-C, ImageNet-C
Segmentation segmentation/methods/gold.py CarlaTTA

Logs and saved configurations are written under the task directory's output/ by default. Override DATA_DIR, CKPT_DIR, and SAVE_DIR as needed. The commands below describe additional methods available in the underlying toolbox; select gold.yaml for GOLD experiments.

Classification

Run all classification commands below from GOLD/classification/.

Features

This repository contains an extensive collection of different methods, datasets, models, and settings, which we evaluate in a comprehensive benchmark (see below). We also provide a tutorial on how to use this repository in combination with CLIP-like models here. A brief overview of the repository's main features is provided below:

  • Datasets

  • Models

    • For adapting to ImageNet variations, all pre-trained models available in Torchvision or timm can be used.
    • For the corruption benchmarks, pre-trained models from RobustBench can be used.
    • For the DomainNet-126 benchmark, there is a pre-trained model for each domain.
    • Further models include ResNet-26 GN.
    • It is also possible to use the models provided by OpenCLIP.
  • Settings

    • reset_each_shift Reset the model state after the adaptation to a domain.
    • continual Train the model on a sequence of domains without knowing when a domain shift occurs.
    • gradual Train the model on a sequence of gradually increasing/decreasing domain shifts without knowing when a domain shift occurs.
    • mixed_domains Train the model on one long test sequence where consecutive test samples are likely to originate from different domains.
    • correlated Same as the continual setting but the samples of each domain are further sorted by class label.
    • mixed_domains_correlated Mixed domains and sorted by class label.
    • Combinations like gradual_correlated or reset_each_shift_correlated are also possible.
  • Mixed Precision Training

    • Almost all of the aforementioned methods (except SAR and GTTA) can be trained with mixed precision. This greatly speeds up your experiments and requires less memory. However, all benchmark results are generated with fp32.
  • Modular Design

    • Adding new methods should be rather simple, thanks to the modular design.
Get Started

To run one of the following benchmarks, the corresponding datasets need to be downloaded.

  • CIFAR10-to-CIFAR10-C: the data is automatically downloaded.
  • CIFAR100-to-CIFAR100-C: the data is automatically downloaded.
  • ImageNet-to-ImageNet-C: download ImageNet-C. Methods that access source data also need ImageNet.
  • ImageNet-to-ImageNet-A: for non source-free methods, download ImageNet and ImageNet-A.
  • ImageNet-to-ImageNet-R: for non source-free methods, download ImageNet and ImageNet-R.
  • ImageNet-to-ImageNet-V2: for non source-free methods, download ImageNet and ImageNet-V2.
  • ImageNet-to-ImageNet-Sketch: for non source-free methods, download ImageNet and ImageNet-Sketch.
  • ImageNet-to-ImageNet-D: for non source-free methods, download ImageNet. For ImageNet-D, see the download instructions for DomainNet-126 below. ImageNet-D is created by symlinks, which are set up at the first use.
  • ImageNet-to-ImageNet-D109: see instructions for DomainNet-126 below.
  • DomainNet-126: download the 6 splits of the cleaned version. Following MME, DomainNet-126 only uses a subset that contains 126 classes from 4 domains.
  • ImageNet-to-CCC: for non source-free methods, download ImageNet. CCC is integrated as a webdataset and does not need to be downloaded! Please note that it cannot be combined with settings such as correlated.

After downloading the missing datasets, you may need to adapt the path to the root directory _C.DATA_DIR = "./data" located in the file conf.py. For the individual datasets, the directory names are specified in conf.py as a dictionary (see function complete_data_dir_path). In case your directory names deviate from the ones specified in the mapping dictionary, you can simply modify them.

Run Experiments

We provide config files for all experiments and methods. Simply run the following Python file with the corresponding config file.

python test_time.py --cfg cfgs/[ccc/cifar10_c/cifar100_c/imagenet_c/imagenet_others/domainnet126]/[source/norm_test/norm_alpha/tent/memo/rpl/eta/eata/rdumb/sar/cotta/rotta/adacontrast/lame/gtta/rmt/roid/tpt/tca].yaml

For imagenet_others, the argument CORRUPTION.DATASET has to be passed:

python test_time.py --cfg cfgs/imagenet_others/[source/norm_test/norm_alpha/tent/memo/rpl/eta/eata/rdumb/sar/cotta/rotta/adacontrast/lame/gtta/rmt/roid/tpt].yaml CORRUPTION.DATASET [imagenet_a/imagenet_r/imagenet_k/imagenet_v2/imagenet_d109]

E.g., to run ROID for the ImageNet-to-ImageNet-R benchmark, run the following command.

python test_time.py --cfg cfgs/imagenet_others/roid.yaml CORRUPTION.DATASET imagenet_r

For batch experiments, adapt classification/scripts/run.sh and run it from classification/. Its default method is roid; use method=gold and restrict the dataset loops to the released GOLD configurations listed above. Set the desired setting, architectures, and seeds to match the paper's experiment.

To run the different continual DomainNet-126 sequences, you have to pass the MODEL.CKPT_PATH argument. When not specifying a CKPT_PATH, the sequence using the real domain as the source domain will be used. The checkpoints are provided by AdaContrast and can be downloaded here. Structurally, it is best to download them into the directory ./ckpt/domainnet126.

python test_time.py --cfg cfgs/domainnet126/rmt.yaml MODEL.CKPT_PATH ./ckpt/domainnet126/best_clipart_2020.pth

For GTTA, we provide checkpoint files for the style transfer network. The checkpoints are provided on Google-Drive (download); extract the zip-file within the classification subdirectory.

Changing Configurations

Changing the evaluation configuration is extremely easy. For example, to run TENT on ImageNet-to-ImageNet-C in the reset_each_shift setting with a ResNet-50 and the IMAGENET1K_V1 initialization, the arguments below have to be passed. Further models and initializations can be found here (torchvision) or here (timm).

python test_time.py --cfg cfgs/imagenet_c/tent.yaml MODEL.ARCH resnet50 MODEL.WEIGHTS IMAGENET1K_V1 SETTING reset_each_shift

For ImageNet-C, the default image list provided by robustbench considers 5000 samples per domain (see here). If you are interested in running experiments on the full 50,000 test samples, simply set CORRUPTION.NUM_EX 50000, i.e.

python test_time.py --cfg cfgs/imagenet_c/roid.yaml CORRUPTION.NUM_EX 50000 

Segmentation

Run all segmentation commands below from GOLD/segmentation/.

For running the experiments based on CarlaTTA, you first have to download the dataset splits as provided below.

Again, you probably have to change the data directory _C.DATA_DIR = "./data" in conf.py. Further, you have to download the pre-trained source checkpoints (download) and extract the zip-file within the segmentation subdirectory.

To run GOLD, use the released configuration in cfgs:

python test_time.py --cfg cfgs/gold.yaml

You can also change the test sequences by setting LIST_NAME_TEST to:

  • day2night: day_night_1200.txt
  • clear2fog: clear_fog_1200.txt
  • clear2rain: clear_rain_1200.txt
  • dynamic: dynamic_1200.txt
  • highway: town04_dynamic_1200.txt

If you choose highway as the test sequence, you have to change the source list and the corresponding checkpoint paths.

python test_time.py --cfg cfgs/gold.yaml LIST_NAME_SRC clear_highway_train.txt LIST_NAME_TEST town04_dynamic_1200.txt CKPT_PATH_SEG ./ckpt/clear_highway/ckpt_seg.pth CKPT_PATH_ADAIN_DEC ./ckpt/clear_highway/ckpt_adain.pth

📊 Results

GOLD achieves strong performance across both continual test-time classification and segmentation benchmarks. On image classification, GOLD consistently outperforms prior CTTA methods under continuously evolving corruptions, achieving the best average error on CIFAR10-C, CIFAR100-C, and ImageNet-C. These results show that restricting adaptation to the golden subspace is not only highly parameter-efficient, but also remarkably effective in maintaining robustness under long-term distribution shifts.

GOLD also generalizes well to dense prediction tasks. On continual test-time semantic segmentation, it delivers superior or highly competitive performance across multiple dynamic scenarios, including challenging transitions such as day-to-night, clear-to-fog, and highway environments. Together, these results demonstrate that GOLD provides a unified and efficient solution for continual adaptation across diverse vision tasks.

👨‍🏫 Acknowledgments

We thank the following repos/projects for helpful components:

🤗 Contact

For questions and feedback, please open an issue or contact:


Star History Chart