**Why discuss Adversarial Robustness?**Machine learning models have been shown to be vulnerable to adversarial attacks, which consist of perturbations added to inputs designed to fool the model that are often imperceptible to humans. In this document, we highlight the several methods of generating adversarial examples and methods of evaluating adversarial robustness.

**History of Adversarial Attacks**Adversarial examples are inputs to machine learning models designed to intentionally fool them or to cause mispredictions. The canonical example is the one from Ian Goodfellow’s paper below.

While adversarial machine learning is still a very young field (less than 10 years old), there’s been an explosion of papers and work around attacking such models and finding their vulnerabilities, turning into a veritable arms race between defenders and attackers. Attackers essentially have the upper hand because breaking things is easier than fixing them. A great analogy to adversarial ML is cryptography in the 50s: researchers kept trying convoluted ways of securing systems, and researchers kept trying to break them, till they invented a convoluted algorithm that was probably too computationally expensive to break (DES).

To that end, let us try to define what an adversarial sample on a model looks like. Mathematically, let us assume that we have a model **f **with an input **x** that can produce a prediction **y.** Then, an adversarial example **d** for the model **f **and input **x **can be defined such that:

**f(x+d) != y**, implying that the perturbation**d**added to**x**does not produce the same prediction as**x****L(d) < T**, where**L**is some generic function that measures the*norm*of**d**, and where**T**is some upper bound on this norm.

Based on the above parameters, there is a large family of algorithms that can be used to generate such perturbations. Broadly, they can be split up as follows:

We model the threat of adversaries as follows:

**Gradient access:**Gradient access controls who has access to the model**f**and who doesn’t.**White box:**adversaries typically have full access to the model parameters, architecture, training routine and training hyperparameters, and are often the most powerful attacks used in literature. White box attacks use gradient information to find adversarial examples often.**Black box:**adversaries have little to no access to the model parameters, and the model is abstracted away as an API of some sort. Black box attacks can be launched using non-gradient based optimization methods, such as (1) genetic algorithms, (2) random search, and (3) evolution strategies. They are usually not very efficient in terms of computational resources but are the most realistic adversary class.

**Perturbation bound:**Perturbation bound determines the size of the perturbation**d**, and is usually measured with some mathematical norm such as the Lp norm.**L0 norm:**An L0 norm bounded attack typically involves modifying a certain number of features of an input signal to a model. L0-norm bounded attacks are often very realistic and can be launched on real-world systems. A common example is a sticker added to a stop-sign that can force a self-driving car to not slow down – all the background is preserved, and only a tiny fraction of the environment is modified.**L1 norm:**An L1 norm bounded attack involves upper bounding the**sum**of the total perturbation values. This attack is quite uncommon.**L2 norm:**An L2 norm bounded attack involves upper bounding the**Euclidean distance/Pythagorean distance**of the perturbation**d.**L2 norm bounded attacks are used quite commonly due to the mathematical relevance of L2 norms in linear algebra and geometry.**L_infinity norm:**An L_infinity norm bounded attack involves upper bounding the**maximum value**of the perturbation**d,**and was the first attack to be discovered. Linfinity attacks are studied the most out of all because of their simplicity and mathematical convenience in robust optimization.

At a very high-level, we can have 8 different kinds of attacks (2 x 4) highlighted below if we use the Lp norm as a robustness metric. There are several other domain-specific ways to quantify the magnitude of the perturbation **d**, but the above can be generalized across all input types. Note that the attacks cited below are strictly for images, but the general principles can be applied to any model **f.**

Norm bound? | ||||

Access to compute gradients? | L0 norm | L1 norm | L2 norm | Linfinity norm |

Y – White Box | SparseFool [1], JSMA [2] | Elastic-net attacks [3] | Carlini-Wagner [4] | PGD [5], i-FGSM [6], Carlini-Wagner |

N – Black Box | Adversarial Scratches [7], Sparse-RS [8] | – | GenAttack [9], sim [10] | GenAttack [9], SIMBA [10] |

**Conclusion:**

As machine learning models become increasingly embedded in products and services all around us, their security vulnerabilities and threats become ever more important, and monitoring becomes even more critical. We’ve highlighted different methods an adversary might launch an adversarial attach against a pre-trained model, but as we find more examples, we will make sure to write another post and share the findings. In the meantime, check out our other data science blogs.

Sources:

[1] Modas et al., ** SparseFool: A Few Pixels Make a Big Difference**, CVPR 2019

[2] Papernot et al.,

**ASIA CCS 2017**

*Practical Black-Box Attacks against Machine Learning,*[3] Sharma et al.,

**AAAI-2018**

*EAD: Elastic-Net Attacks to Deep Neural Networks.*[4] Carlini et al.,

**IEEE Security & Privacy, 2017**

*Towards Evaluating the Robustness of Neural Networks,*[5] Madry et al.,

**ICLR 2018**

*Towards Deep Learning Models Resistant to Adversarial Attacks,*[6] Goodfellow et al.,

**ICLR 2015**

*Explaining and Harnessing Adversarial Examples,*[7] Jere et al.,

**arxiv preprint: https://arxiv.org/abs/1912.02316**

*Scratch that! An Evolution-based Adversarial Attack against Neural Networks,*[8] Croce et al.,

**ECCV’20 Workshop on Adversarial Robustness in the Real World**

*Sparse-RS: a versatile framework for query-efficient sparse black-box adversarial attacks,*[9] Alzantot et al.,

**GECCO ’19**

*GenAttack: Practical Black-box Attacks with Gradient-Free Optimization,*[10] Guo et al., Simple Black-box Adversarial Attacks, ICML 2019