Introduction
Deep learning models often exhibit significant performance degradation when deployed in real-world environments that differ from their training data. These "domain shifts"—ranging from varying weather conditions and sensor noise to different medical imaging protocols—render static models brittle. While adapting models to new domains typically requires original training data, privacy concerns and bandwidth constraints often make this impossible.
Test-Time Adaptation (TTA) has emerged as a solution, allowing models to learn from a stream of unlabeled data during deployment. However, existing TTA methods frequently suffer from poor calibration (becoming "confidently wrong") or are restricted to specific network architectures. To address these challenges, we present TeSLA (Test-Time Self-Learning with Automatic Adversarial Augmentation), a robust framework that treats TTA as a teacher-student knowledge distillation problem, enhancing both accuracy and reliability.
Methodology
TeSLA is built upon three primary technical pillars designed to refine model predictions and decision boundaries on-the-fly.
1. Flipped Cross-Entropy ($f$-CE)
Traditional self-learning often employs standard cross-entropy to align predictions with "hard" one-hot labels. TeSLA introduces a "flipped" cross-entropy loss between student predictions and soft pseudo-labels generated by a teacher model. This formulation is mathematically equivalent to maximizing the Mutual Information between the input images and the model's predictions, which encourages the model to cluster new data points more effectively in the feature space.
2. Soft Pseudo-Label Refinement (PLR)
To ensure the student model learns from high-quality signals, TeSLA refines teacher labels by averaging predictions across multiple weak augmentations. Furthermore, it utilizes an online memory queue to incorporate information from the $n$-nearest neighbors in the feature space, stabilizing the pseudo-labeling process against temporal noise in the data stream.
3. Automatic Adversarial Augmentation (TeAA)
The core innovation of TeSLA is its learnable augmentation policy. TeAA generates "hard" versions of images by pushing them toward the model's decision boundary, specifically into the "uncertainty region."
As illustrated in the figure above, the student model is trained to match the teacher’s confident labels even when presented with these high-entropy, augmented views. This process forces the model to establish clearer separations between classes in the target domain, effectively "stress-testing" the decision boundaries during the adaptation process.
Experimental Evaluation
TeSLA was evaluated across a diverse set of benchmarks to demonstrate its versatility:
- Common Corruptions: CIFAR-10-C, CIFAR-100-C, and ImageNet-C, simulating real-world noise and environmental factors.
- Synthetic-to-Real: VisDA-C (classification) and VisDA-S (segmentation) for adapting CAD-based training to photographic data.
- Medical Imaging: Histology patches (Kather-19/16) and multi-site MRI datasets (Prostate and Spinal Cord), where scanner variability creates significant measurement shifts.
Key Results and Insights
TeSLA achieves state-of-the-art performance while maintaining high model reliability:
- Superior Accuracy: On the Kather-16 medical dataset, TeSLA reduced the error rate to 3.3%, a significant improvement over the 12.0% achieved by the next best TTA method. In segmentation tasks (VisDA-S), it improved Mean Intersection over Union (mIoU) by over 6%.
- Improved Calibration: Unlike entropy-minimization methods that often lead to overconfidence, TeSLA significantly improves the Expected Calibration Error (ECE). On prostate MRI data, TeSLA achieved an ECE of 1.80%, compared to over 20% for methods like TENT.
- Efficiency and Flexibility: The TeAA module is highly efficient, adding minimal computational overhead (approx. 0.10 GPU hours per epoch). Additionally, TeSLA is architecture-agnostic, performing well with both standard CNNs (ResNet) and Vision Transformers (ViT).
Conclusion
TeSLA provides a powerful framework for test-time adaptation by combining mutual information maximization with automated adversarial stress-testing. While the current formulation assumes a degree of class balance in the test data, its ability to improve both performance and calibration makes it a significant step forward for deploying reliable AI in dynamic, real-world environments.
Summary updated