[Paper Review] Evaluating the Robustness of Nearest Neighbor Classifiers: A Primal-Dual Perspective
This paper proposes the first exact algorithm to compute the minimum adversarial perturbation for k-Nearest Neighbor (k-NN) classifiers by formulating the problem as convex quadratic programs (QPs), enabling provably optimal attacks and robustness verification via primal-dual solutions. The method achieves polynomial-time computation for 1-NN and efficient bounds for larger K, outperforming prior heuristic or approximation-based approaches in both attack effectiveness and verification tightness.
We study the problem of computing the minimum adversarial perturbation of the Nearest Neighbor (NN) classifiers. Previous attempts either conduct attacks on continuous approximations of NN models or search for the perturbation by some heuristic methods. In this paper, we propose the first algorithm that is able to compute the minimum adversarial perturbation. The main idea is to formulate the problem as a list of convex quadratic programming (QP) problems that can be efficiently solved by the proposed algorithms for 1-NN models. Furthermore, we show that dual solutions for these QP problems could give us a valid lower bound of the adversarial perturbation that can be used for formal robustness verification, giving us a nice view of attack/verification for NN models. For $K$-NN models with larger $K$, we show that the same formulation can help us efficiently compute the upper and lower bounds of the minimum adversarial perturbation, which can be used for attack and verification.
Motivation & Objective
- To address the lack of exact methods for computing the minimum adversarial perturbation in k-NN classifiers, which are non-differentiable and non-convex.
- To develop a provably optimal attack algorithm that computes the exact minimum perturbation for 1-NN models.
- To provide the first formal robustness verification method for k-NN classifiers using dual solutions of QP formulations.
- To extend the framework to K-NN with larger K, enabling efficient upper and lower bounds for attack and verification.
- To demonstrate that 1-NN can achieve better verifiable robustness than deep neural networks on simple datasets like MNIST and Fashion-MNIST.
Proposed method
- Formulate the minimum adversarial perturbation problem for 1-NN as a set of convex quadratic programs (QPs), solvable in polynomial time.
- Use greedy coordinate ascent to efficiently solve each QP, leveraging sparsity in the problem structure.
- Derive dual solutions of the QPs to obtain valid lower bounds on the minimum perturbation, enabling formal robustness verification.
- Introduce screening rules to reduce the number of QPs solved per test instance, significantly improving computational efficiency.
- For K-NN with K > 1, approximate primal solutions for attack and construct dual feasible solutions for tight verification bounds independent of K.
- Use the primal-dual framework to simultaneously achieve optimal attacks (primal) and formal verification (dual) for k-NN models.
Experimental results
Research questions
- RQ1Can the minimum adversarial perturbation for 1-NN classifiers be computed exactly, rather than approximated?
- RQ2Can the primal-dual QP formulation provide both optimal attacks and formal robustness verification for k-NN models?
- RQ3How can the computational complexity of K-NN robustness evaluation be managed when K > 1?
- RQ4Is the robustness of 1-NN models provably better than that of deep neural networks under the same perturbation constraints?
- RQ5Can dual solutions of QP problems yield tight, efficient lower bounds on adversarial perturbations for K-NN models?
Key findings
- The proposed algorithm computes the exact minimum adversarial perturbation for 1-NN models, achieving significantly smaller perturbations than prior attack methods.
- For 1-NN, the method is provably optimal and up to 60 times faster than standard QP solvers like SCS, CVXOPT, and ECOS.
- The algorithm is the first to provide formal robustness verification for k-NN, with dual solutions yielding tight lower bounds on adversarial perturbations.
- On MNIST and Fashion-MNIST, 1-NN achieves lower verifiable robust error (27.06% and 78.25%) than a CNN (100% verifiable error), despite higher clean error.
- For K-NN with K > 1, the verifier computes lower bounds with time complexity independent of K, and the upper bounds from QP-greedy are tighter than naive baselines.
- Screening rules reduce the average number of QPs per instance from ~54,000 to 2.53, demonstrating substantial efficiency gains.
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.