Defending Adversarial Attacks by Correcting logits

Yifeng Li, Lingxi Xie, Ya Zhang, Rui Zhang, Yanfeng Wang, Qi TianarXiv 2019

Introduction

Adversarial attacks pose a significant threat to deep learning systems by introducing imperceptible perturbations that lead to catastrophic classification failures. While traditional defenses operate in the "low-level" image space—utilizing denoising or specialized training—these approaches often incur high computational costs and require access to raw input data. This research explores a novel alternative: Adversarial Logits Correction. By analyzing the high-level semantic information contained in the model's logits (pre-softmax scores), the authors demonstrate that adversarial attacks leave detectable "fingerprints" that can be corrected to recover original predictions.

Methodology

The proposed defense mechanism employs a simple two-layer fully-connected neural network with 10,000 hidden neurons. Unlike complex image-processing pipelines, this "defender" takes only the 1,000-dimensional logit vector from a pre-trained classifier (e.g., ResNet-50) as input.

The defender is trained on a dataset comprising both "clean" and "adversarial" logits generated by common attack methods like Projected Gradient Descent (PGD). The objective is to map these perturbed vectors back to a corrected logit vector that aligns with the original, ground-truth label. This approach is highly efficient and preserves data privacy, as it does not require access to the original images.

Adversarial Fingerprints and Supporting Classes

A key discovery of this work is that adversarial attacks do not merely shift the top prediction; they alter the statistical distribution of all class scores. For instance, PGD attacks tend to increase the mean value of logits across all categories.

By analyzing the partial derivatives of the defender's output with respect to its input, the researchers identified "supporting classes"—specific categories that serve as indicators of an attack. Surprisingly, certain classes act as universal fingerprints. For example, in PGD attacks on ImageNet, the class "manhole cover" (index 640) consistently shows a high response regardless of the input image's actual content.

Frequency of occurrence for supporting classes, highlighting the "manhole cover" phenomenon.

Experimental Results

The defense was evaluated on the ILSVRC2012 (ImageNet) dataset using VGG-16, ResNet-50, and DenseNet-121 architectures against four major attacks: PGD, MIM, DeepFool, and C&W.

The results demonstrate significant recovery capabilities. For a ResNet-50 model under a strong PGD attack—which initially reduced accuracy to 0%—the defender successfully recovered the correct classification in 75.4% of cases. Interestingly, the defender also exhibited a "super-accuracy" effect on DenseNet-121, improving clean accuracy from 74.47% to 88.29%, suggesting it extracts more signal from the logits than the standard softmax layer.

Performance of the defender across various attack types and its transferability when trained on different attacks.

The study also explored transferability. Defenders trained on $\ell_\infty$ attacks (like PGD) transfer effectively to other $\ell_\infty$ attacks (like MIM) due to similar logit fingerprints. However, transferring to $\ell_2$ attacks (like DeepFool) is more challenging, as these attacks trigger different supporting classes.

Conclusion and Future Work

Adversarial Logits Correction provides a computationally efficient and interpretable defense against adversarial perturbations. By operating at the semantic level, it bypasses the need for image-space processing and offers insights into how models fail.

Current limitations include a degree of attack specificity; a defender trained on one attack type may struggle against novel methods that produce different fingerprints. Future research will focus on identifying more universal logit signatures to develop broader, more robust defenses that can function even in "black-box" scenarios where only limited probability information is available.

Summary updated

Abstract

Generating and eliminating adversarial examples has been an intriguing topic in the field of deep learning. While previous research verified that adversarial attacks are often fragile and can be defended via image-level processing, it remains unclear how high-level features are perturbed by such attacks. We investigate this issue from a new perspective, which purely relies on logits, the class scores before softmax, to detect and defend adversarial attacks. Our defender is a two-layer network trained on a mixed set of clean and perturbed logits, with the goal being recovering the original prediction. Upon a wide range of adversarial attacks, our simple approach shows promising results with relatively high accuracy in defense, and the defender can transfer across attackers with similar properties. More importantly, our defender can work in the scenarios that image data are unavailable, and enjoys high interpretability especially at the semantic level.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
ImageNet-1K · ILSVRC2012 selected test set, ResNet-50Logits correction network (PGD-trained defender)classification accuracy96.5%split: test · subset=1,000 images correctly classified before attack · defense=PGD-trained logits correction · backbone=ResNet-50 · condition=clean images
Source quote
L148: No defense │ Corrected │ No defense │ Corrected PGD │ 100.0% │ 96.5% │ 0.0% │ 75.4%
ImageNet-1K · ILSVRC2012 selected test set, ResNet-50Logits correction network (PGD-trained defender)classification accuracy75.4%split: test · attack=PGD · subset=1,000 images correctly classified before attack · defense=PGD-trained logits correction · backbone=ResNet-50
Source quote
L148: No defense │ Corrected │ No defense │ Corrected PGD │ 100.0% │ 96.5% │ 0.0% │ 75.4%
ImageNet-1K · ILSVRC2012 selected test set, ResNet-50Logits correction network (MIM-trained defender)classification accuracy87.8%split: test · attack=MIM · subset=1,000 images correctly classified before attack · defense=MIM-trained logits correction · backbone=ResNet-50
Source quote
L149: MIM │ 100.0% │ 96.3% │ 0.1% │ 87.8%
ImageNet-1K · ILSVRC2012 selected test set, ResNet-50Logits correction network (DeepFool-trained defender)classification accuracy76.1%split: test · attack=DeepFool · subset=1,000 images correctly classified before attack · defense=DeepFool-trained logits correction · backbone=ResNet-50
Source quote
L150: DeepFool │ 100.0% │ 97.0% │ 0.0% │ 76.1%
ImageNet-1K · ILSVRC2012 selected test set, ResNet-50Logits correction network (C&W-trained defender)classification accuracy66.8%split: test · attack=C&W · subset=1,000 images correctly classified before attack · defense=C&W-trained logits correction · backbone=ResNet-50
Source quote
L151: C\ │ W │ 100.0% │ 82.8% │ 0.0% │ 66.8%
ImageNet-1K · ILSVRC2012 selected test set, ResNet-50Logits correction network trained on MIMclassification accuracy70.3%split: test · attack=PGD · subset=1,000 images correctly classified before attack · defense=MIM-trained logits correction · backbone=ResNet-50
Source quote
L160: PGD │ MIM │ DeepFool │ C\ │ W PGD │ 75.4% │ 70.3% │ 0.0% │ 4.4%
BibTeX
@misc{li2019defending,
  author = {Yifeng Li and Lingxi Xie and Ya Zhang and Rui Zhang and Yanfeng Wang and Qi Tian},
  title = {{Defending Adversarial Attacks by Correcting logits}},
  year = {2019},
  eprint = {1906.10973},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1906.10973},
}
Figure