Abstract
Traditional deep learning models typically conflate task-specific reasoning with world knowledge within a single set of weights, leading to rigidity and high retraining costs when new categories emerge. We present the Memory-Modular Learner (MML), a framework that decouples reasoning from knowledge by utilizing an external, replaceable memory. By freezing a pre-trained encoder and training only the attention-based integration layers, MML can generalize to new classes instantly through simple memory swapping. Our evaluations across diverse datasets, including ImageNet-S and CUB, demonstrate that MML significantly outperforms standard zero-shot and few-shot baselines while remaining robust to label noise.
Introduction: The Monolithic Model Problem
Conventional deep learning models are "monolithic," baking both reasoning skills and factual knowledge into their parameters during training. This architecture presents two primary challenges: lack of interpretability regarding specific training data influences and rapid obsolescence in dynamic environments. While retrieval-augmented models exist, they often assume a static memory tied to a specific task.
Memory-modular generalization addresses these issues by treating the model as a "reasoning engine" that can be plugged into different "knowledge bases" (memories) on the fly. This allows for instant adaptation to new domains without the expensive process of fine-tuning.
The Memory-Modular Learner (MML)
The MML architecture is designed for flexibility and efficiency. It consists of several key components:
- Frozen Backbone: MML utilizes a frozen, pre-trained image-text encoder (e.g., CLIP). This prevents catastrophic forgetting and ensures computational efficiency during the reasoning phase.
- External Memory: Instead of fixed class weights, the model populates an external memory with images and text crawled from web sources like Google, Flickr, and Wikipedia based on target class names.
- Cross-Modal Prototypes: To mitigate the noise inherent in web-crawled data, MML employs cross-modal consensus. It filters image memory by selecting samples with the highest similarity to text descriptions, creating "clean" class prototypes.
- Attentive Knowledge Integration: Upon receiving a query, the model retrieves the $k$-nearest neighbors from both image and text memories. A cross-attention mechanism then fuses these features into the query representation.
Key Insights: Reasoning vs. Memorization
By freezing the encoder and training only the attention layers, MML learns how to utilize external evidence rather than simply memorizing visual features. This "meta-learning" approach allows the model to ignore irrelevant neighbors retrieved from messy web data. Furthermore, because the classifier relies on similarity to memory items (metric learning) rather than fixed output neurons, adding or removing classes is as simple as editing a file directory.
Experimental Results
The authors evaluated MML across several challenging scenarios, yielding significant performance gains:
- Zero-Shot Superiority: On the CUB bird dataset, MML achieved 76.7% accuracy, outperforming standard zero-shot CLIP (70.3%).
- Cross-Dataset Transfer: When trained on ImageNet and tested on 10 diverse datasets (e.g., OxfordPets, EuroSAT), MML averaged 66.2% accuracy, a massive jump from CLIP’s 55.2%.
- Few-Shot Efficiency: With just 4 shots, MML outperformed specialized learners like ProtoNet by over 6%.
- Noise Tolerance: MML proved remarkably resilient to "poisoned" labels because its decision-making relies on neighborhood embeddings rather than direct label-to-weight mapping.
Limitations and Future Work
Despite its strengths, MML is heavily dependent on the quality of its pre-trained backbone; training from scratch results in poor performance. Additionally, while the model is lightweight, $k$NN retrieval across massive memories can introduce latency. Future research may focus on integrating more efficient vector databases and bridging domain gaps for low-resolution data like CIFAR-100, where web-crawled prototypes differ significantly from test samples.
Summary updated