Abstract: We propose a retrieval-augmented convolutional network (RaCNN) and propose to train it with local mixup, a novel variant of the recently proposed mixup algorithm. The proposed hybrid architecture combining a convolutional network and an off-the-shelf retrieval engine was designed to mitigate the adverse effect of off-manifold adversarial examples, while the proposed local mixup addresses on-manifold ones by explicitly encouraging the classifier to locally behave linearly on the data manifold. Our evaluation of the proposed approach against seven readily-available adversarial attacks on three datasets—CIFAR-10, SVHN and ImageNet—demonstrate the improved robustness compared to a vanilla convolutional network, and comparable performance with the state-of-the-art reactive defense approaches.
Introduction
Deep neural networks, despite their success, remain notoriously brittle. Small, imperceptible perturbations, known as adversarial examples, can easily trick a model into misclassifying an image with high confidence. This paper introduces a novel architectural defense that rethink how a convolutional neural network (CNN) processes its input. Instead of allowing a model to directly interact with potentially malicious noise, the authors propose anchoring every input to a neighborhood of known, "safe" training examples.
Adversarial attacks are categorized based on their relationship to the data manifold—the low-dimensional surface where real-world data resides:
- Off-manifold attacks: These push inputs into "empty" regions of the feature space where the model lacks training data and behaves unpredictably.
- On-manifold attacks: These exploit the non-smooth, non-linear decision boundaries within the manifold itself.
While most existing defenses are "reactive" (detecting or denoising attacks), RaCNN is a "proactive" defense that inherently resists these perturbations through its architecture.
Methodology
The RaCNN architecture integrates two primary components: a Retrieval Engine and a Classifier trained with a novel Local Mixup strategy.
Retrieval-Augmented Inference
During inference, an input image $x$ undergoes a multi-step "cleaning" process:
- Retrieval: An off-the-shelf engine identifies the $K$ nearest neighbors from a candidate set (typically the training data) in a pre-defined feature space.
- Convex Hull Projection: These $K$ neighbors define a "convex hull," serving as a local approximation of the data manifold.
- Trainable Projection: Using an attention mechanism, the system calculates a weighted average of these neighbors to project the input $x$ onto this hull. Consequently, the classifier never processes the raw input; it only sees a version reconstructed from real training examples.
Local Mixup Training
To address on-manifold attacks, the authors introduce Local Mixup. Unlike standard "Global Mixup," which blends random pairs of images from the entire dataset, Local Mixup only blends an image with its actual neighbors. This forces the model to behave linearly in the specific regions where data exists, smoothing out the "pockets" typically exploited by adversarial attacks.
Experimental Evaluation
The authors evaluated RaCNN on three standard benchmarks: CIFAR-10, SVHN (using a large retrieval set of 531,000 examples), and ImageNet (1.3 million images) to demonstrate scalability and effectiveness in high-complexity environments.
Key Results and Robustness
RaCNN was tested against seven major attacks, including strong white-box attacks like Projected Gradient Descent (PGD) and Carlini-Wagner (CW), and black-box attacks like Boundary.
As shown in the figure above, RaCNN demonstrates significant robustness gains. On CIFAR-10, under a strong iterative attack (iFGSM), the baseline CNN's accuracy plummeted to 2.59%, while the RaCNN (with $K=10$ and local mixup) maintained 54.36%. The model also showed exceptional resilience against the Boundary attack, which often thwarts traditional defenses. Qualitatively, on ImageNet, even when attacks were strong enough to fool a vanilla CNN, the retrieval engine consistently returned images semantically similar to the original query.
Discussion and Future Work
While RaCNN offers substantial security benefits, it introduces a "clean accuracy tax." For instance, on CIFAR-10, clean accuracy might drop from ~85% to ~80%. Additionally, the $K$-nearest neighbor search adds computational latency, though this can be mitigated using fast similarity search libraries like FAISS.
Future work could explore more sophisticated manifold estimation techniques beyond simple convex hulls, such as kernel estimators or generative models, to further refine the definition of "safe" regions in the feature space. By decoupling representation and classification, RaCNN allows for leveraging massive datasets for retrieval without necessitating full model retraining, providing a flexible path toward more robust deep learning systems.
Summary updated