Detecting Adversarial Samples Using Density Ratio Estimates

Lovedeep GondaraarXiv 2017

TL;DR

This paper introduces a novel, model-agnostic method for detecting adversarial machine learning samples by leveraging density ratio estimation. The authors demonstrate that adversarial perturbations systematically alter the underlying data distribution, causing a detectable shift in density ratios between real and adversarial samples, which can be exploited for robust detection.

What Problem Does This Paper Address?

Machine learning models, particularly deep neural networks, are increasingly deployed in critical applications like self-driving cars and medical diagnostics. A significant vulnerability of these models is their susceptibility to "adversarial samples" – inputs that are subtly modified to be imperceptible to humans but cause the model to misclassify them with high confidence. Detecting these adversarial samples is a crucial but challenging open problem. Existing detection methods are often model-specific or computationally intensive. This paper aims to provide an efficient, model-agnostic approach to identify adversarial samples by analyzing their impact on the data's underlying probability distribution.

Methods

The core of the proposed method is direct density ratio estimation. The authors hypothesize that adversarial perturbations, while visually subtle, systematically alter the probability density of the data. They propose to estimate the ratio of the probability density of a real sample ($p(x)$) to the probability density of a potentially adversarial sample ($p(y)$), or vice-versa.

  • Density Ratio Estimation: The paper utilizes an unconstrained least squares importance fitting method for estimating these ratios. The key insight is that if two samples are drawn from the same underlying distribution (e.g., two real samples), their density ratio will be close to 1. Conversely, if one sample is real and the other is adversarial, the density ratio will deviate significantly from 1.
  • Model Agnosticism: This approach is model-agnostic because it does not require access to the internal workings or gradients of the target machine learning model. It only relies on the model's input and output (or rather, the data distribution itself).
  • Multi-channel Data: For colored images, the density ratio is estimated per color channel (Red, Green, Blue) and then combined, or a combined estimate is used directly.
  • Adversarial Sample Generation (for evaluation and novel contribution): The paper uses standard methods like FGSM (Fast Gradient Sign Method), JSMA (Jacobian Based Saliency Map Approach), and TGSM (Target Gradient Sign Methods) to generate adversarial samples for evaluation. Additionally, they propose a novel method to craft adversarial samples by incorporating density ratio estimates as a constraint, aiming to preserve both perceptual similarity and probability density.

Datasets

The authors evaluate their method on the following standard datasets:

  • MNIST: A dataset of handwritten digits.
  • CIFAR-10: A dataset of small color images in 10 classes.
  • Evaluated in its original colored form.
  • Evaluated in a grayscaled version.

The test partitions of these datasets were used to generate adversarial samples.

Key Insights and Ideas

  • Adversarial Perturbations Alter Density: The fundamental insight is that adversarial attacks, despite their visual subtlety, cause a discernible shift in the underlying probability density of the data. This shift is what density ratio estimation can capture.
  • Density Ratio as a Universal Detector: The proposed density ratio estimation method is effective across different adversarial sample generation techniques (FGSM, JSMA, TGSM) and for both grayscale and color images, highlighting its transferability and robustness.
  • Sample Size Matters, But Not Excessively: The method remains effective even with very small sample sizes for estimating density ratios, suggesting its practicality in real-world scenarios where adversarial samples might be scarce. Even with as few as 10 samples (or even a single adversarial sample in one experiment), detection is possible with high confidence.
  • Crafting "Better" Adversarial Samples: By using density ratio estimates as a constraint during generation, the authors can create adversarial samples that are not only visually similar to original samples but also preserve their underlying probability density more closely. This is a novel contribution to the adversarial generation side.

Key Results

  • High Detection Accuracy: The density ratio estimates for real-adversarial pairs were consistently much higher (or lower, depending on the ratio direction) than real-real pairs across all tested datasets and adversarial generation methods. For instance, on MNIST with FGSM, real-adversarial ratios ranged from ~1.8 to ~34, while real-real ratios stayed close to 1.3.
  • Transferability Demonstrated: Table 2 shows that the method successfully detects adversarial samples generated by JSMA and TGSM, not just FGSM, with density ratios significantly deviating from 1.
  • Robustness to Sample Size: Figure 3 illustrates that even when the sample size for density estimation is reduced to as low as 10, the density ratio difference between real and adversarial samples persists, allowing for detection.
  • Single Adversarial Sample Detection: Table 3 shows that even with only one adversarial sample in the estimation set, the density ratio can be significantly different from real-real comparisons, indicating a strong detection capability.

Limitations and Future Work

  • Computational Cost: While model-agnostic, density ratio estimation itself can be computationally intensive, especially for very large datasets or high-dimensional data. The paper mentions using an "efficient unconstrained least squares importance fitting" method, but further optimization might be needed for real-time applications.
  • Choice of Epsilon: The paper explores the trade-off between tolerance (density similarity) and epsilon (perturbation magnitude) in adversarial sample generation. While lower epsilon leads to higher model accuracy, it was found that even small epsilons could still fool the model if the tolerance was not sufficiently strict. Future work could explore more sophisticated epsilon selection strategies.
  • Real-Life Scenario Nuances: The paper briefly touches on a "real life scenario" where real samples are abundant, but adversarial samples are scarce. While the method shows promise even with few adversarial samples, further investigation into optimal strategies for such imbalanced scenarios could be beneficial.
  • Generalization to Other Data Types: The current evaluation focuses on image datasets. Extending the method to other data modalities like text or audio could be a valuable future direction.

Summary updated

Abstract

Machine learning models, especially based on deep architectures are used in everyday applications ranging from self driving cars to medical diagnostics. It has been shown that such models are dangerously susceptible to adversarial samples, indistinguishable from real samples to human eye, adversarial samples lead to incorrect classifications with high confidence. Impact of adversarial samples is far-reaching and their efficient detection remains an open problem. We propose to use direct density ratio estimation as an efficient model agnostic measure to detect adversarial samples. Our proposed method works equally well with single and multi-channel samples, and with different adversarial sample generation methods. We also propose a method to use density ratio estimates for generating adversarial samples with an added constraint of preserving density ratio.
BibTeX
@misc{gondara2017detecting,
  author = {Lovedeep Gondara},
  title = {{Detecting Adversarial Samples Using Density Ratio Estimates}},
  year = {2017},
  eprint = {1705.02224},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1705.02224},
}
Figure