A camera model trained on clear daytime images may meet fog, sensor noise, or a new lens after deployment. That mismatch is a distribution shift: the inputs at test time no longer look like the training inputs. Retraining would help, but the original data—and labels for the new stream—may be unavailable.
Tent adapts anyway. It updates only each normalization channel's scale and shift, using the model's own uncertainty as the loss. The bet is simple: on a coherent unlabeled batch, a better alignment should move examples away from an indecisive boundary.
Confidence supplies the gradient
For class probabilities p, entropy is H(p) = −Σ p log p. It is largest when the model is undecided and smallest at a one-hot prediction. In the binary case, differentiating through the sigmoid gives the exact logit gradient below.
def entropy_gradient(logit):
probability = sigmoid(logit)
if probability == 0 or probability == 1:
return 0
return probability * (1 - probability) * log((1 - probability) / probability)The site runs the tested TypeScript implementation; Python and C++ are faithful translations. Notice what the function never receives: a true label. It knows how to increase certainty, not how to recognize truth.
The batch gives confidence a direction
Our deterministic illustration starts with two balanced classes on a one-dimensional feature. Deployment shifts every feature two units to the right. The frozen source boundary now predicts almost everything as class 1. Re-estimating the batch mean and variance recenters the two groups; Tent's affine update then pushes their logits farther from the boundary.
The corruption results were substantial
| Paper benchmark (severity 5) | Method | Error (%) |
|---|---|---|
| CIFAR-10-C, Gaussian noise | Source only | 67.2 |
| CIFAR-10-C, Gaussian noise | Test batch norm | 25.4 |
| CIFAR-10-C, Gaussian noise | Tent | 20.2 |
| CIFAR-100-C, Gaussian noise | Source only | 89.9 |
| CIFAR-100-C, Gaussian noise | Test batch norm | 55.8 |
| CIFAR-100-C, Gaussian noise | Tent | 46.8 |
| ImageNet-C, Gaussian noise | Source only | 94.2 |
| ImageNet-C, Gaussian noise | Test batch norm | 88.1 |
| ImageNet-C, Gaussian noise | Tent | 74.3 |
The gap over test-time batch normalization matters: on severe Gaussian noise, Tent cut ImageNet-C error from 88.1% to 74.3%. Across the full corruption table it won most conditions. For SVHN-to-MNIST adaptation, the widest ResNet's error fell from 16.8% source-only to 8.7% with Tent, using target data but no target labels.
The bill is deployment compute. The paper used batches of 512, Adam at learning rate 0.001, and one target-data epoch. Its simplest schedule needs two inference passes plus one gradient pass per point, rather than ordinary single-pass inference.
One point can only applaud itself
Now remove the batch. Our single illustrative point truly belongs to class 0, but the frozen model gives class 1 probability 0.599. Entropy minimization has no counterevidence. After 12 updates, the wrong-class probability is 0.929; entropy fell while accuracy stayed zero.
What I would probe next
- Vary batch size and class balance, not only corruption severity.
- Track accuracy and calibration alongside entropy.
- Reset the adaptor when the stream changes regime.
- Measure latency and energy against the unadapted model.
Tent's update flows through an ordinary classifier. Explore those logits on the logistic-regression page, or inspect normalization and gradients on the neural-network page.
References
- Dequan Wang, Evan Shelhamer, Shaoteng Liu, Bruno Olshausen, Trevor Darrell (2021). Tent: Fully Test-time Adaptation by Entropy Minimization. ICLR 2021 (Spotlight)