TL;DR
When deployed in the wild, machine learning models inevitably stumble over unfamiliar data—and if that model is locked behind a commercial API, you can't tune its weights or see its gradients to fix it. BETA (Black-box Efficient Test-time Adaptation) solves this by pairing the massive, blindfolded API model with a tiny, local "steering" model on your own machine. By optimizing a thin border of pixels around each input image using local gradients and fused predictions, BETA boosts the black-box model's accuracy on the fly—requiring zero extra API calls and cutting adaptation costs by 250× compared to existing query-based methods.
What Problem Does This Paper Address?
Even the best vision models degrade when real-world test data looks different from their training data—think sudden fog, sensor noise, or unfamiliar medical imaging equipment. Test-Time Adaptation (TTA) fixes this by updating a model on the fly using the unlabeled data streaming in during deployment.
Traditionally, TTA assumes "white-box" access: you have the model's weights and can backpropagate gradients through it. Yet today’s frontier models are increasingly deployed as strict black-box APIs: you send raw pixels, pay a fraction of a cent, wait for network latency, and get back a list of class probabilities.
Adapting in the dark is brutal. You have no ground-truth labels and no gradients. Existing workarounds try to nudge the input image using Zeroth-Order Optimization (ZOO)—essentially guessing gradients by blasting the API with dozens of slightly perturbed versions of every single image. Not only does this multiply your API bill and latency, but without true labels to guide it, ZOO frequently suffers catastrophic collapse, tanking accuracy instead of helping.
Methods
Instead of trying to guess the black-box target model's gradients, BETA introduces a local, lightweight, open-source steering model (like a tiny Vision Transformer) where gradients flow freely. Rather than modifying the API model, BETA learns a visual prompt—a 16-pixel-wide trainable frame padded around the input image—that gets fed to both models in parallel.
Here is how BETA makes a weak local model steer a giant API without crashing:
- Prediction Harmonization (New): You can't just optimize the prompt for the local model and hope the API agrees; gradient similarity between different architectures is basically zero ($\approx 0.0006$). Instead, BETA takes a weighted average of the local probability output and the API's probability output, and minimizes the Shannon entropy (uncertainty) of that blended prediction. Gradients only flow backward through the local steering model, mathematically creating a Jensen–Shannon alignment force that pulls the prompt toward classes the giant API already favors.
- Stabilization Mechanisms (New adaptation): Optimizing a randomly initialized pixel border without labels is notoriously volatile. BETA prevents the prompt from learning degenerate, image-ruining noise using two guardrails: prompt-oriented data filtering (ignoring high-uncertainty samples while keeping reliable ones) and consistency regularization (penalizing the local model via KL-divergence if its predictions on the prompted image drift too far from the clean image).
- Local Normalization Tuning (Standard): Alongside updating the pixel frame, BETA lightly updates the steering model's own normalization layers using standard entropy minimization on reliable, non-redundant samples.
Datasets
No new datasets are introduced. Because TTA happens strictly during inference on unlabeled streams, there is no training dataset; BETA is evaluated across established distribution-shift benchmarks:
- ImageNet-C (natural images corrupted with 15 types of severe noise, blur, weather, and digital artifacts), ImageNet-S (sketches), and ImageNet-R (artistic renditions).
- EuroSAT (satellite remote sensing) and Derm7pt (7-class dermatology skin lesions) to test specialized domains where no pre-trained steering model naturally fits.
Key Insights and Ideas
- A "seeing-eye dog" doesn't need to be smarter than the person it guides: In experiments, the tiny local steering model (ViT-Small) maxed out at 41.0% accuracy even when fully adapted on its own—well below the unadapted black-box baseline (48.8%). Yet using it to steer BETA pushed the black-box system to 54.3%. The local model doesn't need superior knowledge; it just needs to supply a usable gradient pathway.
- Cross-architecture and zero-shot steering works: A Convolutional Neural Network (ResNet-50) can effectively steer a Transformer (ViT or CLIP). Even better, in niche domains like medical dermatology, an off-the-shelf natural-image CLIP model can successfully steer a specialized
BiomedCLIPblack-box API without any task-specific training. - The sweet spot between relevance and tractability: By tuning the blending weight $\alpha$ between the two models, BETA navigates a neat geometric trade-off—balancing how much the objective cares about the black-box target against how effectively the local gradients can actually optimize it.
Key Results
- Outperforming White-Box Methods: Using only 1 API call per image, BETA boosts a black-box ViT-B/16 on ImageNet-C by +7.1 percentage points (reaching 62.6%), beating popular white-box methods that have full internal access like TENT (59.6%) and CoTTA (61.6%). Meanwhile, ZOO baselines collapsed on hard corruptions like Contrast (dropping from 32.6% to 4.1%).
- Vision-Language & Niche Domains: On CLIP (ImageNet-S/R), BETA gains +3.4 points (63.4%), beating white-box TPT. On EuroSAT, it jumps +11.3 points over the source model at 120× lower query cost than gray-box alternatives.
- 250× Cheaper on Real Commercial APIs: Tested on the live Clarifai API ($0.0032/query), BETA achieved a **+5.2-point accuracy gain for just $0.40. Reaching similar performance with ZOO cost over $100**. Given that same $100 budget, BETA delivered a +17.1-point gain. Local GPU overhead added just 3 milliseconds per image.
Limitations and Future Work
- Closed-Vocabulary Assumption: BETA requires knowing the API's closed set of class labels so it can align them with the steering model's outputs (though it still retains most gains if the API only returns top-10 probabilities instead of the full vector).
- Overconfident Errors: If the black-box target is confidently wrong, harmonization can be misled into reinforcing bad predictions. Similarly, gains depend on the local model having at least basic task-relevant visual representations.
- Future Directions: The authors suggest developing adaptive harmonization weights based on model disagreement to catch confident API blunders, and extending BETA beyond image classification to open-vocabulary recognition, object detection, and segmentation.
Summary updated