TL;DR
Test-Time Adaptation (TTA) is crucial for deploying deep learning models on edge devices, but standard backpropagation-based methods consume too much memory. This paper introduces CAZO, a forward-only, zeroth-order optimization method that leverages the low-rank and slowly varying curvature of the loss landscape to dramatically reduce gradient variance. CAZO cuts memory usage by over 70% compared to backpropagation methods while achieving state-of-the-art accuracy across major domain-shift benchmarks.
What Problem Does This Paper Address?
Deep neural networks frequently suffer from performance drops when deployed in the real world due to domain shifts (e.g., changes in weather, lighting, or sensor noise). Test-Time Adaptation (TTA) mitigates this by adapting a pre-trained model to unlabeled test data on the fly during inference.
However, standard TTA methods rely on backpropagation (BP) to update model weights. Storing intermediate activations during BP creates a massive memory footprint, making it impractical for resource-constrained edge devices like smartphones or embedded sensors.
Zeroth-Order (ZO) optimization is a promising alternative because it estimates gradients using only forward passes—by applying random perturbations to the weights and measuring the resulting change in loss. Unfortunately, vanilla ZO methods suffer from high variance in high-dimensional parameter spaces, leading to slow convergence and poor adaptation performance.
Methods
The authors propose CAZO (Curvature-Aware Zeroth-Order) optimization to make forward-only TTA both fast and accurate.
Instead of standard isotropic (uniform) random perturbations, CAZO introduces anisotropic perturbation sampling. It dynamically scales down perturbations along sharp (high-curvature) directions of the loss landscape and scales them up along flat (low-curvature) directions.
To implement this efficiently without computing a massive, computationally intractable Hessian matrix, CAZO tracks a diagonal approximation of the Hessian using a sliding Exponential Moving Average (EMA) of the squared ZO gradient estimates. Furthermore, CAZO keeps the pre-trained model frozen and only updates a lightweight adapter module inserted into the network, drastically minimizing the number of trainable parameters.
Datasets
The method was evaluated on several widely used computer vision domain-shift benchmarks:
- ImageNet-C: Features 15 different corruption types (e.g., blur, noise, weather effects) applied at 5 levels of severity to ImageNet images.
- ImageNet-R (Renditions), ImageNet-V2, and ImageNet-Sketch: Benchmarks assessing model robustness against real-world style, artistic rendition, and distribution shifts.
Key Insights and Ideas
-
The Hessian is persistently low-rank during TTA: The authors empirically demonstrated that the top 20 eigenvalues account for over 96% of the total variance in the loss landscape curvature. This means only a tiny fraction of parameter directions dominate the loss behavior.
Low-rank structure of the Hessian during adaptation -
Curvature directions change slowly: The principal curvature subspace remains highly consistent across adjacent optimization steps (with a projection ratio hovering around 0.9). This slow drift justifies using an online EMA tracking mechanism rather than expensive step-by-step re-computation.
- Early layers matter most for TTA adapters: Ablation studies revealed that inserting adapters into early layers (specifically layer 3 of a 12-layer ViT) yields the highest accuracy, indicating that correcting low-level feature alignment is critical for rapid domain adaptation.
Key Results
- State-of-the-Art Performance: On ImageNet-C (severity 5), CAZO achieved an average accuracy of 69.0%, outperforming both BP-free competitors (like FOA at 65.8% and ZOA at 67.5%) and traditional BP-based methods (like TENT at 59.8%).
- Massive Memory Savings: CAZO reduced runtime CUDA memory usage by over 70% compared to standard BP-based methods, requiring only 1,695 MB compared to TENT's 6,404 MB.
- Continual TTA Robustness: In the challenging continual setting where the model encounters shifting corruptions sequentially without resetting, CAZO achieved a top-performing 65.3% average accuracy.
- Quantization Friendly: CAZO maintained its performance edge even under aggressive model quantization, retaining 67.8% accuracy at 8-bit and 61.2% at 6-bit, making it highly suitable for low-power hardware.
Limitations and Future Work
- Hyperparameter Sensitivity: The method's success relies heavily on finding the optimal adapter layer position and down-sampling reduction factor, which may vary across different model architectures (e.g., CNNs vs. Transformers).
- Runtime Trade-off: While highly memory-efficient, multi-point perturbation ($k=20$) requires 40 forward passes per optimization step. This results in a longer wall-clock runtime compared to single-pass first-order methods. Future work could focus on reducing the number of required forward passes without sacrificing gradient accuracy.
Summary updated