Introduction
In real-world scenarios, visual data often follows a "long-tail" distribution where a few "head" categories possess abundant examples, while the majority of "tail" categories have very few. Standard deep learning models typically struggle with this imbalance, often overfitting to common classes while failing to recognize rare ones. While large-scale models can store significant world knowledge, this information is implicit and difficult to update. This paper introduces Retrieval Augmented Classification (RAC), a framework that enhances standard image classifiers with an external, non-parametric memory to address the challenges of long-tail recognition.
Methods: The RAC Architecture
The core of the proposed Retrieval Augmented Classification (RAC) system is a dual-branch architecture that processes input images in parallel.
- Base Branch: A standard parametric image encoder (e.g., ViT-B-16) that generates class logits $\mathbf{f}^{\text{base}}(x^q)$.
- Retrieval Branch: This branch acts as a non-parametric memory. It uses a frozen pretrained encoder to convert the input image into a query for a $k$-Nearest Neighbor ($k$-NN) search against an external database of images and their associated text labels. The retrieved text from the top $k$ neighbors is flattened, tokenized, and processed by a BERT-like text encoder to produce retrieval-based logits $\mathbf{f}^{\text{ret}}(x^q)$.
The final classification $\mathbf{f}(x^q)$ is obtained by normalizing and fusing the outputs from both branches. To effectively handle class imbalance during training, the authors employ Logit Adjusted Cross-Entropy (LACE), which encourages a larger margin for rare classes based on their frequency in the training set.
Key Insights: Implicit Division of Labor
A significant finding of this work is the "implicit division of labor" between the two branches. Analysis reveals that the retrieval module naturally specializes in recognizing "tail" (rare) classes, while the base encoder focuses on "head" (common) classes.
This specialization allows the overall model to achieve high accuracy across the entire distribution. Furthermore, the use of a text encoder allows the model to leverage semantic relationships between labels, effectively filtering noise from the $k$-NN search and improving robustness.
Experimental Results
The RAC framework was evaluated on two major benchmarks: Places365-LT and iNaturalist 2018 (iNat). In both cases, the training set itself served as the external memory, ensuring no additional data was used compared to baselines.
- Places365-LT: RAC achieved a top-1 accuracy of 47.17%, a substantial improvement over the previous state-of-the-art of 41.2%.
- iNaturalist 2018: The model reached 80.24% top-1 accuracy, significantly outperforming the prior best of 75.2%.
- Tail Performance: The most dramatic improvements were observed in "few-shot" categories. On Places365-LT, accuracy for rare classes improved by over 30% compared to standard balanced softmax baselines.
Conclusion
Retrieval Augmented Classification demonstrates that augmenting parametric models with non-parametric memory is a highly effective strategy for long-tail visual recognition. By "outsourcing" rare class recognition to a retrieval module, the system achieves state-of-the-art performance and offers greater flexibility, as the memory can be updated without retraining the entire model. Future research may explore the use of richer external data, such as image captions or encyclopedic snippets, and the application of RAC to open-world scenarios.
Summary updated