Efficient and Robust Classification for Sparse Attacks

Mark Beliaev, Payam Delgosha, Hamed Hassani, Ramtin Pedarsani

Abstract

Adversarial robustness research often focuses on $\ell_\infty$ or $\ell_2$ perturbations, yet sparse $\ell_0$ attacks—where an adversary modifies a small number of pixels by an arbitrary magnitude—pose a distinct threat. This paper introduces a novel defense mechanism based on a truncation operation within neural network layers. By combining this $k$-truncated inner product with adversarial training, we achieve state-of-the-art robustness on MNIST and CIFAR-10. The method is computationally efficient, theoretically optimal in Gaussian settings, and maintains high clean accuracy.

Introduction

Most adversarial defenses are designed for $\ell_\infty$ or $\ell_2$ constraints, where perturbations are small and distributed across all input features. In contrast, $\ell_0$ attacks (sparse attacks) allow an adversary to modify a limited number of pixels (a budget $k$) by an arbitrary amount. This makes the attack space non-convex and non-smooth. Existing defenses often fail when the implicit $\ell_\infty$ constraint is removed, as attackers can use extreme pixel values to flip classifications. This paper addresses the fragility of prior $\ell_0$ defenses by introducing a robust estimator directly into the network architecture.

The Truncation Defense

The core of the proposed defense is the $k$-truncated inner product. In a standard neural network layer, the output is computed as $w \cdot x$. The truncated layer instead calculates the element-wise product $u = w \odot x$, sorts these values, and removes the $k$ largest and $k$ smallest elements before summation. This operation acts as a robust estimator, effectively filtering out adversarial "outliers" regardless of their magnitude.

Robust accuracy under $\ell_0$ attacks for truncation alone (a) and truncation combined with adversarial training (b).

While truncation provides a baseline defense, its effectiveness is significantly enhanced when coupled with adversarial training. By training the model on examples generated by the sparse-rs attack, the network learns weights that are optimized for the truncation operation. The authors demonstrate that applying this truncation to the first layer of a network is particularly effective, as it prevents adversarial noise from being amplified by subsequent non-linearities like ReLUs.

Empirical Results

The defense was evaluated on MNIST and CIFAR-10 datasets. A key finding is that truncation remains robust even when the range of pixel values ($\beta$) is increased, a scenario where prior state-of-the-art defenses like Analysis by Synthesis (ABS) collapse to 0% accuracy. Truncation remains robust because it ignores the magnitude of the change entirely, focusing only on the number of modified features.

Comparison of clean and robust accuracy across different architectures and $\ell_0$ budgets.

As shown in the results, the truncated VGG-19 model ($VGG^{(10)}$) achieved 67.7% robust accuracy against a 3-pixel attack on CIFAR-10, a substantial improvement over the 39.6% achieved by standard adversarial training ($VGG^{(0)}$). Crucially, this robustness does not come at the cost of clean accuracy; the truncated models maintain performance nearly identical to standard architectures (e.g., 98.7% on MNIST). Furthermore, the median number of pixels needed to fool the model increased significantly, for instance, from 13 to 21 pixels on MNIST.

Conclusion

This work provides a theoretically grounded and computationally efficient approach to $\ell_0$ robustness. By treating adversarial perturbations as outliers and employing robust statistical estimators like truncation, neural networks can be made resilient to sparse attacks without the heavy computational overhead of optimization-based defenses. Future work includes extending the theoretical framework to multi-layer truncation and formalizing truncated convolutional operations for broader computer vision applications.

Summary updated

BibTeX
@article{beliaev2022efficient,
  author = {Mark Beliaev and Payam Delgosha and Hamed Hassani and Ramtin Pedarsani},
  title = {{Efficient and Robust Classification for Sparse Attacks}},
  journal = {IEEE J. Sel. Areas Inf. Theory},
  year = {2022},
  doi = {10.1109/jsait.2024.3397187},
}
Figure