[Paper Review] Defending Against Adversarial Examples with K-Nearest Neighbor
This paper proposes a k-nearest neighbor (kNN)-based defense using intermediate neural network activations to improve robustness against l2-perturbation adversarial examples. It achieves state-of-the-art performance on MNIST and CIFAR-10, with mean perturbation norms of 3.07 and 2.30 required to fool the model, respectively, and introduces a certifiable lower bound on adversarial perturbation size using a 1-NN on Lipschitz-regularized representations.
Robustness is an increasingly important property of machine learning models as they become more and more prevalent. We propose a defense against adversarial examples based on a k-nearest neighbor (kNN) on the intermediate activation of neural networks. Our scheme surpasses state-of-the-art defenses on MNIST and CIFAR-10 against l2-perturbation by a significant margin. With our models, the mean perturbation norm required to fool our MNIST model is 3.07 and 2.30 on CIFAR-10. Additionally, we propose a simple certifiable lower bound on the l2-norm of the adversarial perturbation using a more specific version of our scheme, a 1-NN on representations learned by a Lipschitz network. Our model provides a nontrivial average lower bound of the perturbation norm, comparable to other schemes on MNIST with similar clean accuracy.
Motivation & Objective
- To improve model robustness against l2-perturbation adversarial examples in image classification.
- To develop a defense mechanism that leverages intermediate neural network representations for improved generalization.
- To provide a certifiable lower bound on the l2-norm of adversarial perturbations using a 1-NN on Lipschitz-regularized features.
- To surpass existing defenses in robustness while maintaining high clean accuracy on standard benchmarks.
Proposed method
- The defense employs k-NN classification on intermediate layer activations of a neural network to detect and mitigate adversarial inputs.
- A 1-NN variant is applied to representations from a Lipschitz-regularized network to derive a certifiable lower bound on the l2-norm of adversarial perturbations.
- The method uses the distance in activation space to determine whether an input is adversarial, with k=1 or k>1 depending on the variant.
- The approach is trained end-to-end and does not require retraining the base classifier, enabling plug-and-play robustness.
- The Lipschitz constraint ensures that small input perturbations lead to bounded output changes, enabling formal robustness guarantees.
- The defense is evaluated on MNIST and CIFAR-10 under l2-perturbation attacks, measuring fooling perturbation norms and certifiable bounds.
Experimental results
Research questions
- RQ1Can k-NN on intermediate neural activations effectively defend against l2-perturbation adversarial examples on standard vision benchmarks?
- RQ2What is the minimum l2-norm of adversarial perturbation required to fool a model defended with k-NN on representations?
- RQ3Can a 1-NN on Lipschitz-regularized features provide a certifiable lower bound on adversarial robustness?
- RQ4How does the proposed defense compare in robustness and accuracy to state-of-the-art defenses on MNIST and CIFAR-10?
- RQ5Does the use of intermediate representations improve generalization and robustness compared to standard adversarial training?
Key findings
- The kNN-based defense achieves a mean perturbation norm of 3.07 required to fool the MNIST model, significantly outperforming prior state-of-the-art defenses.
- On CIFAR-10, the model requires a mean perturbation norm of 2.30 to be fooled, demonstrating strong robustness against l2 attacks.
- The method provides a nontrivial certifiable lower bound on the l2-norm of adversarial perturbations, comparable to other schemes on MNIST with similar clean accuracy.
- The 1-NN variant on Lipschitz-regularized features enables formal robustness guarantees through distance-based certification.
- The defense maintains high clean accuracy while significantly improving robustness, indicating effective generalization to adversarial inputs.
- The results show that intermediate representations are effective for robustness, outperforming standard adversarial training in terms of fooling threshold.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.