Source-linked AI summary

Shield: Fast, Practical Defense and Vaccination for Deep Learning using JPEG Compression

Nilaksh Das, Madhuri Shanbhogue, Shang-Tse Chen, Fred Hohman, Siwei Li, Li Chen, Michael E. Kounavis, Duen Horng Chau

arXiv:1802.06816v1cs.CVcs.AIcs.CR

TL;DR

DNNs are vulnerable to adversarial images, creating a need for practical, scalable defenses. Shield uses JPEG compression with vaccination, ensembling, and randomized local compression, eliminating up to 94% of black-box and 98% of gray-box attacks in ImageNet experiments.

  • Problem

    DNNs can be misled by visually imperceptible adversarial perturbations, while existing defenses often lack practicality and scalability for real-world deployment.

  • Method

    Shield applies JPEG compression to remove adversarial pixel manipulation, retrains models on compressed images, ensembles different compression levels, and randomizes compression across image regions.

  • Results

    Shield eliminated up to 94% of black-box attacks and 98% of gray-box attacks from strong attacks including Carlini-Wagner’s L2 and DeepFool on ImageNet.

  • Takeaways & Limitations

    Shield provides fast, scalable protection that can be integrated into defense pipelines without requiring knowledge about the defended model.

  • Takeaways & Limitations

    The authors state that Shield is not a panacea for all future attacks and should be combined with other defense techniques rather than used in isolation.

Abstract

from arXiv · show

The rapidly growing body of research in adversarial machine learning has demonstrated that deep neural networks (DNNs) are highly vulnerable to adversarially generated images. This underscores the urgent need for practical defense that can be readily deployed to combat attacks in real-time. Observing that many attack strategies aim to perturb image pixels in ways that are visually imperceptible, we place JPEG compression at the core of our proposed Shield defense framework, utilizing its capability to effectively "compress away" such pixel manipulation. To immunize a DNN model from artifacts introduced by compression, Shield "vaccinates" a model by re-training it with compressed images, where different compression levels are applied to generate multiple vaccinated models that are ultimately used together in an ensemble defense. On top of that, Shield adds an additional layer of protection by employing randomization at test time that compresses different regions of an image using random compression levels, making it harder for an adversary to estimate the transformation performed. This novel combination of vaccination, ensembling, and randomization makes Shield a fortified multi-pronged protection. We conducted extensive, large-scale experiments using the ImageNet dataset, and show that our approaches eliminate up to 94% of black-box attacks and 98% of gray-box attacks delivered by the recent, strongest attacks, such as Carlini-Wagner's L2 and DeepFool. Our approaches are fast and work without requiring knowledge about the model.

1 INTRODUCTION

Shield addresses the practical difficulty of defending DNNs against adversarial images by using JPEG compression, model vaccination, ensembling, and randomized local compression. The framework targets fast, scalable deployment while reporting strong attack elimination rates.

  • Motivation: DNNs remain vulnerable to visually imperceptible adversarial perturbations, including transferable attacks crafted without access to the target architecture.These vulnerabilities complicate deployment in security- and safety-critical applications.
  • Compression as Defense: JPEG compression can provide fast, practical protection by compressing away pixel-level perturbations that are visually imperceptible.The approach adapts a widely available image-processing technique for real-time defense.
  • Shield Framework: Shield combines randomization, vaccination, and ensembling into a multifaceted defense framework.Vaccinated models are trained on compressed images, while randomized compression varies across image regions and compression levels.
  • Shield Framework: Shield requires no model-architecture changes and can recover accuracy lost on adversarial instances with little effect on benign-image accuracy.The framework is designed to operate as a preprocessing-based defense.
  • Evaluation: 94% of black-box attacks and 98% of gray-box attacks were eliminated in extensive ImageNet experiments against attacks including Carlini-Wagner’s L2 and DeepFool.The evaluation used the full ImageNet benchmark dataset with 50K images.

2 BACKGROUND: ADVERSARIAL ATTACKS

This section introduces adversarial attacks as constrained input perturbations that alter classifier predictions, covering white-box and black-box settings. It describes transferability and representative attacks including CW-L2, DeepFool, FGSM, and I-FGSM.

  • Attack Formulation: An untargeted adversarial attack seeks a perturbed instance that changes the classifier prediction while remaining within a distance bound.Common distance measures include Euclidean L2 and Chebychev L∞ distance.
  • Threat Models: White-box attacks use model knowledge and gradients, whereas black-box attacks can transfer perturbations from a substitute model.Black-box attacks are harder because the attacker has less information about the target model.
  • Attack Background: Adversarial perturbations can be visually indistinguishable from clean images, motivating extensive research into attacks across multiple application domains.The cited domains include malware detection, sentiment analysis, and reinforcement learning.
  • Representative Attacks: CW-L2 minimizes an L2 perturbation objective with a relaxation term based on a differentiable surrogate of the model.Its confidence parameter κ controls the confidence of the resulting misclassification.
  • Representative Attacks: DeepFool constructs a minimal L2 perturbation by approximating the decision boundary as hyperplanar and iterating until an adversarial instance is found.DeepFool is an untargeted attack.
  • Representative Attacks: FGSM computes an L∞-constrained perturbation from the sign of the loss gradient, while I-FGSM applies FGSM iteratively with clipping.The perturbation magnitude is controlled by ϵ.

3 PROPOSED METHOD: COMPRESSION AS DEFENSE

Shield uses JPEG compression to remove adversarial perturbations, then adapts models to compression through vaccination, stochastic local quantization, and an ensemble of vaccinated models. This combination targets both robustness to attacks and preservation of benign-image accuracy.

  • 3.1 Preprocessing Images using Compression: JPEG quantization suppresses high-frequency components, where adversarial attacks tend to introduce noise, while making preprocessing non-differentiable.The compression step suppresses frequencies that contribute less to human perception.
  • 3.2 Vaccinating the Model: Vaccination retrains models on compressed images, increasing robustness to compression and enabling more aggressive compression against adversarial perturbations.The paper reports a lift of more than 7 absolute percentage points from vaccination in its evaluation.
  • 3.3 Shield: Multifaceted Defense Framework: Stochastic Local Quantization varies JPEG quality independently across 8 × 8 image blocks, using randomly selected quality factors to make the transformation harder to estimate.The selected qualities are {20, 40, 60, 80}, spanning a range from stronger to weaker compression.
  • 3.3 Shield: Multifaceted Defense Framework: Localized stochastic compression preserves semantics in higher-quality blocks while applying stronger denoising in lower-quality blocks, unlike a simple average over compressed images.The method is designed to address perturbations across a wide spectrum of attack strengths.

4 EVALUATION

The evaluation uses ImageNet attacks and compares JPEG, Shield, and other denoising defenses across gray-box, black-box, runtime, vaccination, and transferability settings. Shield combines compression, vaccination, ensembling, and stochastic local quantization to improve robustness while preserving practical speed and scalability.

  • Experiment setup: Experiments use the full 50,000-image ImageNet validation set, ResNet-v2 50, and attacks including CW-L2, DeepFool, FGSM, and I-FGSM.FGSM and I-FGSM perturbation strength varies from ϵ=0 to 8 in steps of 2.
  • Defense effectiveness: Shield trades compression strength against benign-image accuracy, retaining accuracy comparable to original models while performing better than individual JPEG settings under severe perturbation.More compression generally recovers more adversarial accuracy but can reduce benign accuracy; less compression has the opposite trade-off.
  • Defense effectiveness: JPEG compression recovers accuracy against CW-L2, DeepFool, I-FGSM, and FGSM, while Shield performs best under high perturbation from I-FGSM and FGSM.For CW-L2 and DeepFool, the best-performing settings are JPEG; Shield benefits from stochastic local quantization, vaccination, and ensembling against larger perturbations.
  • Runtime and scalability: JPEG compresses 50,000 images in no more than 107 seconds, making it at least 22x faster than TVD and 14x faster than median filtering.The TensorFlow implementation of Shield processes the same images in 150 seconds.
  • Transferability: In transferability experiments, JPEG preprocessing does not significantly reduce accuracy on low-perturbation DeepFool and CW-L2 attacks, while Inception-v4 accuracy drops by at most 10% for higher-perturbation attacks.Attacks are generated on ResNet-v2 50 and transferred to ResNet-v2 101 and Inception-v4.

5 SIGNIFICANCE AND IMPACT

The work emphasizes practical deployment of JPEG-based defense, including hardware acceleration for real-time applications. It also frames compression as one layer within broader, multi-technique protection rather than a universal solution.

  • JPEG compression is described as much faster than other popular preprocessing techniques, supporting practical defense deployment.The passage notes that even commodity Pillow implementations are fast.
  • Intel QSV JPEG compression was up to 24 times faster than Pillow and TensorFlow implementations on 50,000 ImageNet validation images.The reported efficiency is presented as desirable for real-time defense applications such as autonomous vehicles.
  • The authors identify tighter software and hardware integration as necessary for evaluating JPEG compression in a real defense pipeline.They point to optimized, widely available JPEG software and hardware as enabling further testing.
  • The research prompted discussion with Intel teams about adversarial-machine-learning defenses and related deep-learning software and hardware development.The passage connects these discussions to computational overhead incurred by almost all defenses.
  • The approach is not intended as a panacea or to be used in isolation against all possible future attacks.The authors recommend combining it with other defense techniques and note that preprocessing makes integration into many pipelines easy.

6 RELATED WORK

Prior defenses address adversarial examples through detection, architecture or primitive changes, training modifications, and preprocessing. Preprocessing examples include spatial smoothing, total-variation denoising, and methods that account for non-differentiable JPEG operations during attacks.

  • Existing countermeasures include adversarial-example detection, architecture or primitive modifications, training changes, and preprocessing techniques.These categories organize the prior defense literature discussed by the paper.
  • Median Filter: Median filtering spatially smooths images by replacing each pixel with the median of neighboring pixels.Window size controls smoothness, with larger windows producing blurrier images.
  • Total Variation Denoising: Total-variation denoising reduces adjacent-pixel variation while keeping the output close to the original image.A weighting parameter trades off total variation against distance from the original image.
  • JPEG quantization is non-differentiable, which restricts the feasibility of gradient-based attacks through the preprocessing step.The paper identifies frequency-domain quantization as the relevant non-differentiable operation.
  • A differentiable JPEG approximation was evaluated preliminarily on 1,000 images, while its effectiveness against Shield remained unclear.The cited approach also optimized perturbations across multiple compression qualities.
  • Backward Pass Differentiable Approximation attacks JPEG by propagating forward through compression and the DNN while ignoring compression during backpropagation.This approximation treats compression as the identity function during the backward pass.

7 CONCLUSION

Shield addresses the need for deployable adversarial-image defenses by combining JPEG compression with vaccination, ensembling, and randomized regional compression. Large-scale ImageNet experiments report substantial attack elimination while retaining speed and model-agnostic operation.

  • Shield uses JPEG compression to remove visually imperceptible pixel manipulation and vaccinates models with compressed images.Different compression levels produce vaccinated models that are combined in an ensemble, while test-time randomization compresses image regions at random levels.
  • 94% of black-box attacks and 98% of gray-box attacks were eliminated in large-scale ImageNet experiments.The reported attacks included recent strong methods such as Carlini-Wagner’s L2 and DeepFool.
  • Shield is presented as fast and successful without requiring knowledge about the model.The paper also states that its code was open-sourced for reproducibility.
Loading 1802.06816v1…