Introduction
Standard deep learning models typically operate in an "open-loop" fashion, where a single forward pass generates a prediction. While efficient, this approach often fails on "hard" samples—images characterized by blur, occlusion, or fine-grained similarities between classes. In contrast, human perception often involves a "second look" or a closed-loop process to resolve ambiguity. This paper introduces Closed-Loop Inference (CLI), a method that mimics this human cognitive process by identifying low-confidence samples and performing targeted, local fine-tuning at test time.
The CLI Framework
The CLI method transforms the inference process from a static mapping to a dynamic, adaptive loop. It consists of three primary stages:
- Detection of Low-Confidence Samples: The system monitors the "Maximum Class Probability" (softmax output). Samples falling below a predefined threshold $\epsilon$ are flagged as "hard" and diverted to the closed-loop path.
- Cluster-Level Auxiliary Task Construction: To maintain computational efficiency, similar hard samples are grouped using K-means clustering. For each cluster, the model identifies the top-$K$ predicted classes. An auxiliary dataset ($D_{aux}$) is then constructed by sampling images from the original training set belonging to these specific $K$ classes.
- Auxiliary Learning: The model's deeper layers undergo a brief retraining phase on $D_{aux}$. This process employs both standard Cross-Entropy loss and Supervised Contrastive Loss (SCL) to refine local decision boundaries, making the model more adept at distinguishing between the specific candidate classes.
Experimental Results
The researchers evaluated CLI on ImageNet and ImageNet-C across various architectures, including ResNet, DenseNet, and EfficientNet.
Performance Gains
CLI consistently improves top-1 accuracy. For instance, it provides a +2.44% boost for ResNet-18 and a +1.96% boost for DenseNet-121. Remarkably, CLI allows smaller models to achieve performance levels previously reserved for much larger architectures. As shown in the figure below, a ResNet-50 with CLI outperforms a standard ResNet-101 despite having significantly fewer parameters and FLOPs.
Robustness to Corruptions
On the ImageNet-C benchmark, which tests models against 15 types of image corruptions, CLI demonstrates strong robustness. It proves to be complementary to existing test-time adaptation methods like Test-Time Training (TTT), setting new performance benchmarks for out-of-distribution data.
Discussion and Key Insights
The success of CLI stems from its ability to simplify the classification task at test time. By narrowing the focus to the top-$K$ candidate classes (the "Top-K Goldmine"), the model transitions from solving a 1,000-class problem to a much simpler $K$-class problem. This allows for the temporary warping of local decision boundaries to resolve specific ambiguities without needing to maintain a perfect global boundary for all classes simultaneously.
However, CLI introduces a trade-off in terms of inference latency. While clustering mitigates the cost, the retraining phase makes CLI slower than standard inference, currently averaging around 1.69 seconds per image for ResNet-18. This suggests that CLI is currently best suited for high-stakes applications where accuracy is prioritized over real-time throughput.
Conclusion
Closed-Loop Inference provides a powerful mechanism for enhancing the reliability of pre-trained models. By integrating a "second thought" process into the inference pipeline, CLI effectively handles edge cases and distribution shifts, pushing the boundaries of what can be achieved with existing neural architectures.
Summary updated