NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Memory Classifiers: Two-stage Classification for Robustness in Machine Learning

Souradeep Dutta, Yahan Yang, Elena Bernardis, Edgar Dobriban, Insup LeearXiv 2022 · DOI

Abstract

Deep neural networks often rely on brittle, low-level textures rather than robust high-level features, leading to significant performance degradation under distribution shifts. We present Memory Classifiers, a two-stage architecture that integrates expert domain knowledge with deep learning. By partitioning data into clusters centered around prototypical "memories" using robust similarity metrics and training local expert classifiers for each cluster, we achieve superior robustness against corruptions such as noise and blur. Our approach demonstrates substantial improvements over state-of-the-art data augmentation on both toy and real-world medical and agricultural datasets.

Introduction

Modern deep learning models, despite their high performance on clean datasets, are notoriously brittle. A state-of-the-art ResNet can achieve near-perfect accuracy on standard benchmarks but fail when faced with "benign" corruptions like Gaussian noise, pixelation, or motion blur—distortions that a human observer would easily ignore.

The standard industry response is data augmentation (e.g., AugMix), which exposes the model to corrupted data during training. However, these techniques often fail to force the model to learn the "obvious" high-level features that define a class. Instead, models continue to rely on brittle textures. This research explores how to bake expert domain knowledge into a classifier's architecture to ensure robustness without sacrificing clean-data performance.

Methodology: The Memory Classifier Framework

The proposed Memory Classifier architecture utilizes a "divide and conquer" strategy consisting of two distinct stages:

  1. Stage 1: Memory Selection & Clustering: The system identifies "memories"—prototypical data points representing different clusters. Unlike standard black-box clustering, this stage uses a similarity metric designed with expert guidance. For instance, in medical imaging, this might involve classical digital image processing to extract features like lesion size or color histograms.
  2. Stage 2: Local Classification: Once the data is partitioned into clusters based on these robust features, a standard classifier (e.g., a CNN) is trained specifically for each cluster.
The two-stage Memory Classifier architecture: Step 1 selects a memory based on robust features, and Step 2 uses a local classifier for final prediction.

At inference, a test image is first matched to the most similar "memory" (Stage 1), and the corresponding local classifier makes the final prediction (Stage 2). This ensures the deep learning component only handles fine-grained discrimination within a logically consistent, robustly-defined group.

Experimental Evaluation

The researchers evaluated Memory Classifiers across several benchmarks:

  • Toy Color Dataset: Designed to test if CNNs learn basic color features under noise.
  • Acne Lesion Classification: A dermatology dataset where experts defined features like lesion size and skin redness.
  • Leaf Disease Severity: Images of coffee leaves where features included the fraction of discolored areas.
  • Robustness Benchmark: Models were tested against the Hendrycks and Dietterich (2019) benchmark, featuring 15-18 types of corruptions across five severity levels.

Key Results and Insights

The Memory Classifier consistently outperformed "Baseline + Augmentation" strategies across various architectures, including ResNet18, ResNet50, and VGG16.

Robustness on Toy Data

In the toy experiment, a standard ResNet trained with AugMix dropped to 33% accuracy (equivalent to random guessing) under Gaussian noise. In contrast, the Memory Classifier, anchored by a simple color-matching similarity metric, maintained 94% accuracy. This highlights that DNNs often ignore obvious robust features unless explicitly guided by the architecture.

Comparison of model performance on a toy color dataset. Under Gaussian noise, the Memory Classifier maintains 94% accuracy, significantly outperforming Baseline and AugMix models (33%).

Real-World Performance

  • Acne Lesion Study: The memory-based approach showed an average 9% improvement in accuracy across varying corruption severities compared to state-of-the-art data augmentation.
  • Leaf Disease Study: The system demonstrated significantly higher stability; while baseline models saw sharp performance drops as noise increased, the Memory Classifier's accuracy decayed gracefully.
  • Clean Performance: Importantly, the two-stage approach matched or slightly exceeded baseline performance on uncorrupted data, proving that robustness does not have to come at the cost of standard accuracy.

Discussion and Limitations

The primary limitation of Memory Classifiers is the "expert bottleneck"—the requirement for human-in-the-loop definition of similarity metrics or high-level features. This can make the system more difficult to deploy "out of the box" for entirely new domains. Additionally, training and storing multiple local classifiers increases the computational footprint, though this remains manageable for many practical applications.

Future work aims to explore methods for automatically discovering these robust high-level features, potentially combining the interpretability of classical image processing with the automation of modern representation learning.

Reference: Dutta, S., Yang, Y., Bernardis, E., Dobriban, E., & Lee, I. (2022). Memory Classifiers: Two-stage Classification for Robustness in Machine Learning. arXiv:2206.05323v2 [cs.LG].

Summary updated

BibTeX
@misc{dutta2022memory,
  author = {Souradeep Dutta and Yahan Yang and Elena Bernardis and Edgar Dobriban and Insup Lee},
  title = {{Memory Classifiers: Two-stage Classification for Robustness in Machine Learning}},
  year = {2022},
  eprint = {2206.05323},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2206.05323},
}
Figure