Buffer layers for Test-Time Adaptation

Hyeongyu Kim, GeonHui Han, Dosik Hwang

Abstract

Test-Time Adaptation (TTA) is a critical paradigm for deploying deep learning models in dynamic environments where the test distribution deviates from the training data. However, conventional TTA methods often suffer from instability in low-batch scenarios and catastrophic forgetting of the source domain. This paper introduces Buffer layers, a lightweight, plug-and-play architectural modification that decouples adaptation from the pre-trained backbone. By updating only these parallel auxiliary units while keeping the backbone frozen, the proposed method achieves state-of-the-art performance in small-batch settings and maintains high accuracy on the original source domain.

1. Introduction

Deep learning models typically operate under the assumption that training and testing data are independent and identically distributed (i.i.d.). In real-world applications, this assumption is frequently violated by domain shift—environmental changes such as varying weather conditions, sensor noise, or lighting shifts that degrade model performance.

Test-Time Adaptation (TTA) has emerged as a solution to update models "on the fly" using unlabeled streaming data. Despite their promise, existing TTA approaches face two primary hurdles. First, most methods rely on updating Batch Normalization (BN) statistics, which become highly unstable when the batch size is small (e.g., $N=2$), a common constraint in edge computing. Second, the continuous updating of model weights often leads to catastrophic forgetting, where the model loses its ability to perform on the original source domain after adapting to a new one.

2. The Buffer Layer Framework

To address these challenges, we propose a structural shift in how adaptation is performed. Rather than modifying the core parameters of a pre-trained backbone, we introduce Buffer layers—modular convolutional units inserted in parallel to the early stages of the network.

2.1 Architecture and Integration

Each Buffer layer consists of simple $1 \times 1$ and $3 \times 3$ convolutional filters. The adaptation process follows a residual logic: the output of the Buffer layer is scaled by a learnable coefficient ($\alpha$) and added to the activations of the frozen backbone.

Crucially, the entire pre-trained backbone, including its original BN layers, remains frozen during the adaptation process. Only the parameters within the Buffer layers are updated. This design ensures that the foundational features learned during training are preserved, while the Buffer layers learn the "delta" required to align those features with the new test distribution.

2.2 Method-Agnostic Nature

The Buffer layer is designed as a "drop-in" enhancement. It is compatible with various existing TTA frameworks, such as TENT, EATA, or SAR. Instead of these frameworks optimizing the backbone's normalization layers, they are redirected to optimize the Buffer layers, making the approach highly versatile across different optimization objectives.

3. Experimental Evaluation

3.1 Datasets and Benchmarks

The effectiveness of Buffer layers was evaluated across several rigorous benchmarks:

  • CIFAR10-C & CIFAR100-C: Synthetic corruptions including blur, noise, and weather effects.
  • CIFAR10-W: Real-world distribution shifts.
  • ImageNet-C: Large-scale corrupted image classification.
  • Continuous Adaptation: Scenarios where the domain shifts gradually over time to test long-term stability.

3.2 Performance in Low-Batch Scenarios

One of the most significant findings is the method's robustness to small batch sizes. In a batch size of 2 (BS=2) on CIFAR10-C, standard BN-based adaptation (TENT) results in an error rate of 82.56% due to unstable statistics. By integrating Buffer layers, the error rate is slashed to 37.05%, representing a 45.51% absolute improvement.

3.3 Stability and Forgetting

Because the backbone remains frozen, the model exhibits near-zero catastrophic forgetting. Even after extensive adaptation to multiple corrupted domains, the model's performance on the original source data remains intact. Furthermore, in continuously changing environments, Buffer layers prevent the performance collapse often seen in traditional methods as the domain drift accumulates.

4. Discussion and Insights

  • Early-Stage Importance: Empirical results suggest that placing Buffer layers in the early stages of the network is most effective. This indicates that domain shifts primarily affect low-level feature distributions, which can be corrected before they propagate into deeper semantic layers.
  • Normalization Independence: The method proved effective regardless of the underlying normalization technique, showing consistent gains with both Batch Normalization and Group Normalization (GN).
  • Decoupling Strategy: The success of Buffer layers highlights that decoupling the adaptation mechanism from the feature extractor is key to maintaining stability and foundational knowledge.

5. Conclusion and Future Work

Buffer layers provide a robust, efficient, and stable solution for Test-Time Adaptation. By isolating adaptation into parallel modules, the method overcomes the historical weaknesses of TTA, specifically batch size sensitivity and catastrophic forgetting. Future research may explore automated architectural searches to optimize Buffer layer configurations for specific tasks and the development of optimization targets specifically tailored for residual adaptation modules.

Summary updated

BibTeX
@inproceedings{kim2025buffer,
  author = {Hyeongyu Kim and GeonHui Han and Dosik Hwang},
  title = {{Buffer layers for Test-Time Adaptation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=sSZ9OM08KT},
}
Figure