TL;DR
ComMem introduces a brain-inspired test-time adaptation (TTA) framework that significantly improves how vision-language models (VLMs) handle real-world distribution shifts. By mimicking the complementary roles of the hippocampus (fast, detailed visual caching) and the neocortex (slow, abstract textual consolidation), ComMem achieves state-of-the-art accuracy across 15 benchmark datasets. Crucially, it delivers these performance gains with high computational efficiency, running up to 10x faster than prominent prompt-tuning alternatives.
What Problem Does This Paper Address?
Vision-language models (VLMs) like CLIP excel at zero-shot classification, but their performance degrades sharply when deployed under real-world distribution shifts (e.g., encountering sketches, adversarial examples, or entirely new target domains).
To fix this on the fly, researchers use Test-Time Adaptation (TTA), which updates the model using an unlabeled stream of test data. However, existing VLM TTA methods suffer from two main flaws:
- Amnesia: Early methods adapt to each test sample or mini-batch in complete isolation, failing to accumulate domain knowledge over time.
- Single-Modality Bottlenecks: Newer memory-based methods maintain caches but restrict updates to a single modality—either tuning text prompts or caching visual features. Because they treat memory updates symmetrically or ignore cross-modal interactions, they struggle to balance plasticity (rapidly learning new domain cues) with stability (preserving robust pre-trained knowledge).
Methods
ComMem solves this by implementing a dual-memory architecture inspired by the Complementary Learning Systems (CLS) theory in neuroscience, which explains how the human brain balances fast and slow learning.
The framework consists of two primary components:
- HPC Detailed Memory (Hippocampus-like): A high-plasticity episodic visual cache ($M$) that rapidly stores and updates visual features from high-confidence test samples. It uses an instance-level evolution rule to continuously refresh visual prototypes ($P^v$).
- NC Abstract Memory (Neocortex-like): A stable, slow-integrating abstract memory composed of global textual prototypes ($P^t$). It evolves gradually through a process analogous to biological memory consolidation, updating only when test predictions cross a high-confidence threshold.
Test-Time Optimization
For each incoming test sample, ComMem simulates memory reconsolidation. It retrieves information from both memory systems and jointly optimizes them via a single gradient step using three distinct, neuro-computationally inspired losses:
- Entropy Minimization ($L_{ent}$): Reduces prediction uncertainty on the final integrated logits.
- Inter-Memory Consistency ($L_{align}$): A symmetric InfoNCE loss that forces the visual and textual prototypes to align, ensuring cross-modal coherence.
- Intra-Memory Sparse Coding ($L_{sparse}$): Inspired by sparse neural coding, this term penalizes prototype redundancy within each memory system to minimize representational overlap.
During this single-step optimization, the model learns lightweight visual and textual residuals ($\delta_v, \delta_t$) and fine-tunes the visual encoder's normalization layers ($\theta_n$).
Datasets
The authors evaluated ComMem across 15 benchmark datasets split into two main evaluation paradigms:
- Natural Distribution Shifts (ImageNet OOD): Evaluated on the standard ImageNet dataset alongside four out-of-distribution variants: ImageNet-A (adversarial), ImageNet-R (renditions), ImageNet-V2, and ImageNet-Sketch.
- Cross-Dataset Generalization: Evaluated on 10 diverse image recognition datasets spanning various domains: FGVCAircraft, Caltech101, StanfordCars, DTD (textures), EuroSAT (satellite), Flowers102, Food101, OxfordPets, SUN397 (scenes), and UCF101 (actions).
Key Insights and Ideas
- Asymmetric Dynamics are Essential: Visual details change rapidly across domains, requiring a fast, high-plasticity cache. Textual concepts (semantics) are inherently more stable and must be updated slowly to prevent catastrophic forgetting. Forcing symmetric updates across both modalities degrades performance.
- Cross-Modal Alignment Anchors TTA: Rather than just minimizing entropy (which can lead to confirmation bias and error accumulation), explicitly optimizing for cross-modal consistency ($L_{align}$) keeps the visual cache and textual prototypes bound to a shared semantic space.
- Smarter Caching Beats Brute-Force Backpropagation: Instead of backpropagating through massive text encoders for every single test frame (like TPT), optimizing lightweight residuals and normalization layers achieves superior adaptation at a fraction of the compute cost.
Key Results
ComMem consistently outperformed state-of-the-art TTA methods across both visual backbones tested (ResNet-50 and ViT-B/16):
- Robustness to Distribution Shifts: On the ImageNet OOD variants, ComMem achieved a new state-of-the-art average accuracy of 48.84% (ResNet-50) and 65.36% (ViT-B/16), outperforming the closest dual-prototype competitor, DPE.
- Cross-Dataset Generalization: ComMem led the pack with an average accuracy of 64.60% (ResNet-50) and 70.74% (ViT-B/16) across the 10 diverse downstream datasets.
- High Efficiency: Processing 50,000 test samples on ImageNet took ComMem 1 hour and 32 minutes. In comparison, prompt-tuning methods like TPT and DiffTPT required 7.5 hours and >15 hours respectively, making ComMem highly practical for real-world deployment.
Limitations and Future Work
Despite its strong performance and speedups over prompt-tuning methods, ComMem still introduces a slight computational and memory overhead compared to simple zero-shot inference due to its per-sample optimization step and dynamic cache maintenance.
The authors note that future work will focus on exploring more efficient memory implementations—such as using sparse or quantized representations—and incorporating brain-inspired forgetting mechanisms to automatically prune irrelevant or noisy information from the visual cache.
Summary updated