{"id":171236,"date":"2023-09-25T13:55:01","date_gmt":"2023-09-25T12:55:01","guid":{"rendered":"https:\/\/liora.io\/en\/?p=171236"},"modified":"2026-02-06T08:57:42","modified_gmt":"2026-02-06T07:57:42","slug":"adversarial-examples-definition-and-importance-in-machine-learning","status":"publish","type":"post","link":"https:\/\/liora.io\/en\/adversarial-examples-definition-and-importance-in-machine-learning","title":{"rendered":"Adversarial Examples: Definition and importance in machine learning"},"content":{"rendered":"<p><strong>Nowadays, we are witnessing a resurgence of interest and progress in new technologies related to artificial intelligence, especially in the use of neural networks. We can observe their power in image classification and object recognition. At first glance, we might think that these neural networks are very powerful and infallible. This article aims to understand the challenges and impacts that adversarial examples can have.\n<\/strong><\/p>\nHowever, with the rapid<a href=\"https:\/\/liora.io\/en\/learn-ai-everything-you-need-to-know\"> developments in artificial intelligence (AI)<\/a> and <a href=\"https:\/\/liora.io\/en\/all-about-deep-learning\">deep learning (DL) techniques,<\/a> it is essential to ensure the security and robustness of deployed algorithms. It would be legitimate to question and investigate the potential limitations and performance issues associated with their use.\n<h2>What is an &#8220;adversarial example&#8221;?<\/h2>\nAn &#8220;adversarial example&#8221; is an example of an object capable of deceiving and<a href=\"https:\/\/liora.io\/en\/convolutional-neural-network-everything-you-need-to-know\"> fooling a neural network algorithm<\/a> into believing it should be classified as a certain object when it is not.\n\nAn &#8220;adversarial example&#8221; is a set of correctly initialized data to which an imperceptible perturbation has been added by the neural network to<a href=\"https:\/\/liora.io\/en\/management-of-unbalanced-classification-problems-i\"> induce incorrect classification.<\/a>\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex is-content-justification-center\"><div class=\"wp-block-button \"><a class=\"wp-block-button__link wp-element-button \" href=\"\/en\/courses\/data-ai\/machine-learning-engineer\">Machine Learning Course<\/a><\/div><\/div>\n\n<h2>What are the risks?<\/h2>\nWhen you ask a human to describe how they detect a panda in an image, they may look for physical features such as round ears, black eye patches, the snout, furry skin, and provide other information like the type of habitat where they expect to see a panda and the kind of poses it takes.\n\n<a href=\"https:\/\/liora.io\/en\/deep-neural-network-what-is-it-and-how-is-it-working\">For an artificial neural network, as long as applying pixel values<\/a> to the equation yields the correct answer, it is convinced that what it sees is indeed a panda. In other words, by altering the pixel values of the image in the right way, you can deceive the AI into thinking it doesn&#8217;t see a panda.\n\nIn the case of the adversarial example we will see in the rest of the article, AI researchers added a layer of noise to the image. This noise is barely perceptible to the human eye. However, when the new pixel values pass through the <a href=\"https:\/\/liora.io\/en\/recurrent-neural-network-what-is-it\">neural network,<\/a> they produce the result of a gibbon, even though it&#8217;s actually a panda.\n\nAdversarial examples make machine learning models vulnerable to attacks, as in the following scenarios:\n\n1. A self-driving car collides with another car because it fails to recognize a stop sign.\n&#8211; Someone placed an image on the stop sign that looks like a stop sign to humans but was designed to resemble a no-parking sign for the car&#8217;s sign recognition software.\n\n2. A spam detector fails to classify an email as spam.\n&#8211; The spam email was designed to look like a normal email, but with the intent to deceive the recipient.\n\n3. An AI-powered scanner at the airport scans luggage for weapons.\n&#8211; A knife was designed to evade detection by making the system believe it&#8217;s an umbrella.\n\n4. An<a href=\"https:\/\/liora.io\/en\/ai-watermarking-all-you-need-to-know\"> automated AI<\/a> that doesn&#8217;t detect a disease (e.g., in radiology) when it actually corresponds to a serious illness.\n\nLet&#8217;s now look at some concrete examples that have fooled neural networks.\n\nIn the example below, we can see that with a slight perturbation invisible to the naked eye, it was possible to deceive the neural network, which classified a picture of a dog as an ostrich.\n<figure>\n\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"700\" height=\"280\" src=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2023\/09\/dog.jpeg\" alt=\"\" loading=\"lazy\" srcset=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2023\/09\/dog.jpeg 700w, https:\/\/liora.io\/app\/uploads\/sites\/9\/2023\/09\/dog-300x120.jpeg 300w\" sizes=\"(max-width: 700px) 100vw, 700px\"><figcaption>Source: ICHI.PRO<\/figcaption><\/figure>\nLet&#8217;s take <a href=\"https:\/\/liora.io\/en\/management-of-unbalanced-classification-problems-ii\">another example of image classification<\/a> with pandas that a neural network correctly recognizes as a panda with a confidence rate of 57.7%.\n\nIf we add a carefully constructed perturbation, the same neural network now classifies the image as a gibbon with a confidence of 99.3%!\n\nIt&#8217;s clearly an optical illusion, but only for the neural network. We can confidently say that both of these images are indeed pandas. In fact, we can&#8217;t even perceive that a slight perturbation was added to the original image on the left to create the adversarial example on the right!\n<figure>\n\t\t\t\t\t\t\t\t\t\t\t<a href=\"https:\/\/arxiv.org\/abs\/1412.6572\">\n<img decoding=\"async\" width=\"800\" height=\"317\" src=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2023\/09\/pandas.png\" alt=\"\" loading=\"lazy\" srcset=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2023\/09\/pandas.png 875w, https:\/\/liora.io\/app\/uploads\/sites\/9\/2023\/09\/pandas-300x119.png 300w, https:\/\/liora.io\/app\/uploads\/sites\/9\/2023\/09\/pandas-768x305.png 768w\" sizes=\"(max-width: 800px) 100vw, 800px\">\t\t\t\t\t\t\t\t<\/a>\n\n<figcaption>Source: arxiv<\/figcaption><\/figure>\nIn the following example, you can see the impact this can have in everyday life on self-driving cars that misinterpret a traffic sign.\n<figure>\n\t\t\t\t\t\t\t\t\t\t\t<a href=\"https:\/\/arxiv.org\/pdf\/1707.08945.pdf\">\n<img decoding=\"async\" width=\"800\" height=\"439\" src=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2023\/09\/speed-limit.png\" alt=\"\" loading=\"lazy\" srcset=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2023\/09\/speed-limit.png 875w, https:\/\/liora.io\/app\/uploads\/sites\/9\/2023\/09\/speed-limit-300x165.png 300w, https:\/\/liora.io\/app\/uploads\/sites\/9\/2023\/09\/speed-limit-768x421.png 768w\" sizes=\"(max-width: 800px) 100vw, 800px\">\t\t\t\t\t\t\t\t<\/a>\n\n<figcaption>Source: arxiv<\/figcaption><\/figure>\nIn the case above, the perturbation perceptible to the human eye was not detected by the neural network. The stop sign on the right above was classified as a 45 km\/h speed limit sign. We can still see the challenges and limitations that neural networks can face in image classification.\n\n<a href=\"\/en\/courses\/data-ai\/machine-learning-engineer\">\nMachine Learning Training\n<\/a>\n<h2>How are adversarial examples created?<\/h2>\nIt is crucial to understand the distinction between targeted and non-targeted attacks.\n\nA non-targeted attack simply aims to induce misclassification, regardless of the specific category. The goal is solely to achieve an incorrect classification of the object by the neural network.\n\nIn contrast, a targeted attack intends to trigger a misclassification in a particular category. For example, a non-targeted attack on an image of a dog would seek to get a classification other than &#8220;dog&#8221; by the neural network. Conversely, a targeted attack on the same dog image would aim to classify the dog as an ostrich, but not as a cat, for example.\n\nThere are several methods to create adversarial examples, including those used in cyberattacks, such as data poisoning, <a href=\"https:\/\/liora.io\/en\/gan-machine-learning-putting-fictitious-faces-into-practice\">Generative Adversarial Networks (GANs), and robot manipulation.<\/a>\n<h2>How can I protect myself against adversarial examples?<\/h2>\nThere are <strong>several ways to defend against adversarial examples,<\/strong> but it&#8217;s important to note that the fight against these attacks remains a rapidly evolving research area.\n\nAdversarial training is one of the simplest and most natural defense methods. It involves putting oneself in the attacker&#8217;s shoes by generating adversarial examples against one&#8217;s own neural network and then training the model on these generated data. While this can help improve the model&#8217;s robustness, attackers can still find subtle perturbations to deceive the network.\n\n<strong>Another defensive approach<\/strong> is defensive distillation. It entails creating a second model whose decision boundary is smoothed in directions susceptible to attack. This model acts as an additional filter to detect anomalies in inputs, making it more challenging for attackers to spot modifications that would lead to misclassification.\n\nHowever, it&#8217;s important to note that research in this field is <strong>continually evolving<\/strong>. New attacks are regularly developed to circumvent new defenses, making the security of neural networks an ongoing challenge.\n<h2>Conclusion<\/h2>\nAdversarial examples highlight surprising vulnerabilities in many modern machine learning algorithms. These failures demonstrate that even simple algorithms can behave unexpectedly compared to the intentions of their designers. This is why Data Scientists are encouraged to engage in research and design methods to prevent adversarial examples, reducing the gap between designers&#8217; intentions and the actual behavior of algorithms.\n\nIf you want to<strong> master the Deep Learning techniques discussed in this article<\/strong>, we invite you to inquire about our Data Scientist training program.\n\n<a href=\"\/en\/courses\/data-ai\/data-scientist\">\nBecome a  Data Scientist\n<\/a>","protected":false},"excerpt":{"rendered":"<p>Nowadays, we are witnessing a resurgence of interest and progress in new technologies related to artificial intelligence, especially in the use of neural networks. We can observe their power in image classification and object recognition. At first glance, we might think that these neural networks are very powerful and infallible. This article aims to understand [&hellip;]<\/p>\n","protected":false},"author":76,"featured_media":171238,"comment_status":"open","ping_status":"open","sticky":false,"template":"elementor_theme","format":"standard","meta":{"_acf_changed":false,"editor_notices":[],"footnotes":""},"categories":[2433],"class_list":["post-171236","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-ai"],"acf":[],"_links":{"self":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/171236","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/users\/76"}],"replies":[{"embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/comments?post=171236"}],"version-history":[{"count":1,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/171236\/revisions"}],"predecessor-version":[{"id":206351,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/171236\/revisions\/206351"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/media\/171238"}],"wp:attachment":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/media?parent=171236"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/categories?post=171236"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}