Abstract: Entropy minimization (EM) is frequently used to increase the accuracy of classification models when they're faced with new data at test time. EM is a self-supervised learning method that optimizes classifiers to assign even higher probabilities to their top predicted classes. In this paper, we analyze why EM works when adapting a model for a few steps and why it eventually fails after adapting for many steps. We show that, at first, EM causes the model to embed test images close to training images, thereby increasing model accuracy. After many steps of optimization, EM makes the model embed test images far away from the embeddings of training images, which results in a degradation of accuracy. Building upon our insights, we present a method for solving a practical problem: estimating a model's accuracy on a given arbitrary dataset without having access to its labels. Our method estimates accuracy by looking at how the embeddings of input images change as the model is optimized to minimize entropy. Experiments on 23 challenging datasets show that our method sets the SoTA with a mean absolute error of $5.75\%$, an improvement of $29.62\%$ over the previous SoTA on this task. Our code is available at https://github.com/oripress/EntropyEnigma
Introduction
Machine learning models often struggle when deployed on "out-of-distribution" (OOD) data—scenarios where the test environment differs significantly from the training environment, such as a self-driving system trained in sunny weather encountering a blizzard. Test Time Adaptation (TTA) attempts to mitigate this performance gap by updating the model using the unlabeled data it encounters during deployment.
The most popular TTA method is Entropy Minimization (EM), which encourages the model to be more confident in its predictions. However, EM presents a paradox: while it initially improves performance, running it for too many steps eventually causes accuracy to collapse. Furthermore, in real-world deployment, the lack of ground-truth labels makes it impossible to know if the model is actually improving or degrading. This paper investigates the underlying dynamics of EM and leverages these insights to predict model accuracy on unlabeled datasets.
The Dynamics of Entropy Minimization
To understand why EM initially succeeds and eventually fails, the authors analyzed the embedding space using metrics such as Silhouette scores (measuring cluster tightness) and Shift distance (measuring the distance between test clusters and the original training data). Their analysis revealed a distinct biphasic process:
- Phase 1 (Success): EM forces test images into tight clusters that align closely with the original training data's embedding space. This alignment allows the model to correctly classify OOD samples by mapping them to known categories.
- Phase 2 (Failure): While the clusters remain tight, they begin to drift away from the training distribution—a phenomenon related to "neural collapse." The model prioritizes minimizing entropy over maintaining semantic alignment, leading to a total loss of predictive utility.
Debunking the "Correctness" Myth
A common intuition in TTA is that EM works by reinforcing the model's existing correct predictions. The authors challenged this by testing EM on a dataset where every single image was initially misclassified. Surprisingly, EM still improved accuracy significantly. This suggests that EM’s power lies in its ability to restructure the embedding space and improve alignment, rather than simply bolstering the confidence of already-correct labels.
Weighted Flips: A New Proxy for Accuracy
Based on the observation that accuracy gain is tied to how well test data clusters align with training data, the authors introduced Weighted Flips (WF), a novel method for accuracy estimation.
The core idea is that the number of times a model "changes its mind" (label flips) during a short burst of EM adaptation is a highly reliable proxy for its initial error rate. If a model is already well-aligned (high accuracy), EM will not change its predictions significantly. If it is poorly aligned, EM will cause a cascade of flips as it attempts to force data into new clusters.
The WF method weights these flips by the model's initial confidence: a flip occurring on a high-confidence prediction is a stronger signal of poor initial alignment than a flip on a low-confidence one. These weighted flips are then mapped to an estimated accuracy using a simple quadratic function.
Experimental Results
The study evaluated WF across 23 challenging ImageNet-scale datasets (comprising 326 individual splits), including ImageNet-C (corruptions), ImageNet-R (renditions), and ObjectNet (unusual contexts).
Performance and Efficiency
- State-of-the-Art Estimation: WF achieved a Mean Absolute Error (MAE) of 5.75%, representing a 29.62% improvement over the previous state-of-the-art method (COT).
- Cross-Architecture Versatility: A mapping function trained on a ResNet-50 architecture was found to be effective on other architectures like ViT or MaxViT without retraining.
- Practicality: WF is highly efficient, running concurrently with the adaptation process. It requires only 20 additional forward passes for every 1,000 iterations and remains effective even with limited data (as few as 100 samples).
Conclusion and Limitations
While Weighted Flips provides a robust solution for ImageNet-scale data, the authors noted that its effectiveness is reduced on smaller datasets like CIFAR-10/100. In these smaller-scale environments, EM does not cause the same characteristic degradation in accuracy, suggesting the "enigma" of entropy minimization behaves differently depending on the complexity of the data. Future research into the mechanics of neural collapse during EM may lead to even more stable adaptation strategies that avoid Phase 2 failure entirely.
Summary updated