Papers
Topics
Authors
Recent
Search
2000 character limit reached

Gradient-Based Sparse Adversarial Attack

Updated 14 July 2026
  • Gradient-based sparse adversarial attacks are methods that leverage gradient signals to craft perturbations on limited input features while meeting ℓ0 and ℓ∞ constraints.
  • They employ optimization techniques like Frank–Wolfe, BFGS, and greedy selection to efficiently determine the most impactful coordinates for modification.
  • Empirical evaluations across image, text, and 3D modalities show high attack success rates and improved perceptibility control in adversarial settings.

Gradient-based sparse adversarial attacks are methods for constructing adversarial examples by using gradients, gradient surrogates, or related sensitivity information to alter only a small support of the input while inducing misclassification. In the image setting, representative formulations combine an 0\ell_0 sparsity budget with an \ell_\infty magnitude bound; later work extends the same logic to group-wise image perturbations, dynamic 3D sparse convolution networks, spiking neural networks, and transformer-based text classifiers, where sparsity is imposed on pixels, overlapping groups, temporal events, or token blocks rather than on dense perturbation fields alone (Imtiaz et al., 2022, Sadiku et al., 2023, Tao et al., 2021, Sadrizadeh et al., 2022).

1. Core optimization formulations

A canonical formulation seeks a perturbation δ\delta that maximizes task loss while remaining both sparse and bounded in magnitude. SAIF writes the untargeted problem as

maxδ  D(δ)subject toδϵ,δ0k,\max_{\delta}\; D(\delta) \quad \text{subject to} \quad \|\delta\|_\infty \le \epsilon,\quad \|\delta\|_0 \le k,

with D(δ)=L(f(x+δ),y)D(\delta)=L(f(x+\delta),y), and also gives the equivalent generic minimization form

minδ  L(f(x+δ),y)subject toδϵ,δ0k.\min_{\delta}\; L(f(x+\delta),y) \quad \text{subject to} \quad \|\delta\|_\infty \le \epsilon,\quad \|\delta\|_0 \le k.

Here δ0k\|\delta\|_0 \le k forces kk-sparsity, while δϵ\|\delta\|_\infty \le \epsilon bounds each pixel-wise change to [ϵ,ϵ][-\epsilon,\epsilon] (Imtiaz et al., 2022).

GreedyFool states the sparse objective in a complementary way:

\ell_\infty0

Its adversarial loss is a C&W-style margin loss,

\ell_\infty1

where \ell_\infty2 is the logit for class \ell_\infty3 and \ell_\infty4 is a confidence parameter (Dong et al., 2020).

In text, the same principle appears as block sparsity over token embeddings rather than coordinate sparsity over pixels. The block-sparse transformer attack optimizes

\ell_\infty5

or, in hard form, restricts the number of nonzero blocks to at most \ell_\infty6, so that only a few token substitutions are permitted (Sadrizadeh et al., 2022).

2. Support selection and gradient-driven optimization

The practical difficulty is not merely optimizing perturbation magnitude, but discovering which coordinates should be active. A recurring pattern is to use gradients to rank coordinates and then to refine the perturbation on the selected support. GreedyFool explicitly follows this route. At iteration \ell_\infty7, it computes the loss gradient \ell_\infty8, converts a learned distortion map \ell_\infty9 into a weight map δ\delta0 using thresholds δ\delta1, forms a masked weighted gradient

δ\delta2

and ranks pixels by δ\delta3. Its first stage grows the support by selecting the top-δ\delta4 unselected pixel indices and updating only those coordinates; its second stage reduces the support by removing pixels with small perturbation magnitude whenever adversariality can be preserved. The paper attributes its gains over SparseFool to fresh-gradient selection, the distortion map, and the two-stage refine procedure (Dong et al., 2020).

SAIF replaces greedy growth with a Frank–Wolfe procedure over the convex hull of δ\delta5-sparse δ\delta6 atoms. Its linear minimization oracle selects the δ\delta7 indices with largest absolute gradient magnitude and sets

δ\delta8

where δ\delta9 is the top-maxδ  D(δ)subject toδϵ,δ0k,\max_{\delta}\; D(\delta) \quad \text{subject to} \quad \|\delta\|_\infty \le \epsilon,\quad \|\delta\|_0 \le k,0 index set. The update is

maxδ  D(δ)subject toδϵ,δ0k,\max_{\delta}\; D(\delta) \quad \text{subject to} \quad \|\delta\|_\infty \le \epsilon,\quad \|\delta\|_0 \le k,1

Under standard assumptions, the Frank–Wolfe gap satisfies a sublinear stationarity rate of maxδ  D(δ)subject toδϵ,δ0k,\max_{\delta}\; D(\delta) \quad \text{subject to} \quad \|\delta\|_\infty \le \epsilon,\quad \|\delta\|_0 \le k,2 (Imtiaz et al., 2022).

LP-BFGS uses a different decomposition. Instead of discovering the support online, it first computes Integrated Gradients attributions, selects the top-maxδ  D(δ)subject toδϵ,δ0k,\max_{\delta}\; D(\delta) \quad \text{subject to} \quad \|\delta\|_\infty \le \epsilon,\quad \|\delta\|_0 \le k,3 coordinates by maxδ  D(δ)subject toδϵ,δ0k,\max_{\delta}\; D(\delta) \quad \text{subject to} \quad \|\delta\|_\infty \le \epsilon,\quad \|\delta\|_0 \le k,4, and then optimizes only those variables with BFGS. If maxδ  D(δ)subject toδϵ,δ0k,\max_{\delta}\; D(\delta) \quad \text{subject to} \quad \|\delta\|_\infty \le \epsilon,\quad \|\delta\|_0 \le k,5, the search direction is maxδ  D(δ)subject toδϵ,δ0k,\max_{\delta}\; D(\delta) \quad \text{subject to} \quad \|\delta\|_\infty \le \epsilon,\quad \|\delta\|_0 \le k,6 with inverse-Hessian approximation maxδ  D(δ)subject toδϵ,δ0k,\max_{\delta}\; D(\delta) \quad \text{subject to} \quad \|\delta\|_\infty \le \epsilon,\quad \|\delta\|_0 \le k,7, followed by a Wolfe line search and the standard BFGS update. Because maxδ  D(δ)subject toδϵ,δ0k,\max_{\delta}\; D(\delta) \quad \text{subject to} \quad \|\delta\|_\infty \le \epsilon,\quad \|\delta\|_0 \le k,8, the method treats full-matrix BFGS as tractable even though storing maxδ  D(δ)subject toδϵ,δ0k,\max_{\delta}\; D(\delta) \quad \text{subject to} \quad \|\delta\|_\infty \le \epsilon,\quad \|\delta\|_0 \le k,9 costs D(δ)=L(f(x+δ),y)D(\delta)=L(f(x+\delta),y)0 memory and updates cost D(δ)=L(f(x+δ),y)D(\delta)=L(f(x+\delta),y)1 time per iteration (Zhang et al., 2022).

Method Sparsity model Core mechanism
GreedyFool (Dong et al., 2020) Pixel-wise D(δ)=L(f(x+δ),y)D(\delta)=L(f(x+\delta),y)2 under D(δ)=L(f(x+δ),y)D(\delta)=L(f(x+\delta),y)3 budget Distortion-aware gradient ranking with grow and reduce stages
SAIF (Imtiaz et al., 2022) D(δ)=L(f(x+δ),y)D(\delta)=L(f(x+\delta),y)4-sparse under D(δ)=L(f(x+δ),y)D(\delta)=L(f(x+\delta),y)5 bound Frank–Wolfe LMO on top-D(δ)=L(f(x+δ),y)D(\delta)=L(f(x+\delta),y)6 gradient coordinates
LP-BFGS (Zhang et al., 2022) Exactly D(δ)=L(f(x+δ),y)D(\delta)=L(f(x+\delta),y)7 selected pixels BFGS on Integrated-Gradients-selected variables
GSE (Sadiku et al., 2023) Group-wise sparse patches D(δ)=L(f(x+δ),y)D(\delta)=L(f(x+\delta),y)8 proximal phase plus projected Nesterov refinement
ATOS (Heshmati et al., 18 Oct 2025) Element-, pixel-, and group-wise sparsity OSLD(δ)=L(f(x+δ),y)D(\delta)=L(f(x+\delta),y)9 regularization with smooth minδ  L(f(x+δ),y)subject toδϵ,δ0k.\min_{\delta}\; L(f(x+\delta),y) \quad \text{subject to} \quad \|\delta\|_\infty \le \epsilon,\quad \|\delta\|_0 \le k.0 control

3. Structured sparsity and explainable perturbations

Sparse attacks need not be element-wise. GSE formulates group-wise sparse attacks through a two-phase algorithm. In Phase I it optimizes a quasinorm adversarial loss,

minδ  L(f(x+δ),y)subject toδϵ,δ0k.\min_{\delta}\; L(f(x+\delta),y) \quad \text{subject to} \quad \|\delta\|_\infty \le \epsilon,\quad \|\delta\|_0 \le k.1

using the minδ  L(f(x+δ),y)subject toδϵ,δ0k.\min_{\delta}\; L(f(x+\delta),y) \quad \text{subject to} \quad \|\delta\|_\infty \le \epsilon,\quad \|\delta\|_0 \le k.2-quasinorm proximal operator tailored for non-convex programming. In Phase II it freezes the discovered support subspace minδ  L(f(x+δ),y)subject toδϵ,δ0k.\min_{\delta}\; L(f(x+\delta),y) \quad \text{subject to} \quad \|\delta\|_\infty \le \epsilon,\quad \|\delta\|_0 \le k.3 and solves

minδ  L(f(x+δ),y)subject toδϵ,δ0k.\min_{\delta}\; L(f(x+\delta),y) \quad \text{subject to} \quad \|\delta\|_\infty \le \epsilon,\quad \|\delta\|_0 \le k.4

with projected Nesterov’s accelerated gradient descent. The paper reports a remarkable increase in group-wise sparsity, namely minδ  L(f(x+δ),y)subject toδϵ,δ0k.\min_{\delta}\; L(f(x+\delta),y) \quad \text{subject to} \quad \|\delta\|_\infty \le \epsilon,\quad \|\delta\|_0 \le k.5 on CIFAR-10 and minδ  L(f(x+δ),y)subject toδϵ,δ0k.\min_{\delta}\; L(f(x+\delta),y) \quad \text{subject to} \quad \|\delta\|_\infty \le \epsilon,\quad \|\delta\|_0 \le k.6 on ImageNet in the average-case targeted setting, while also reporting a minδ  L(f(x+δ),y)subject toδϵ,δ0k.\min_{\delta}\; L(f(x+\delta),y) \quad \text{subject to} \quad \|\delta\|_\infty \le \epsilon,\quad \|\delta\|_0 \le k.7 attack success rate, faster computation times, and improved explainability (Sadiku et al., 2023).

ATOS generalizes the same theme into a single differentiable framework for element-wise, pixel-wise, and group-wise perturbations. Its objective is

minδ  L(f(x+δ),y)subject toδϵ,δ0k.\min_{\delta}\; L(f(x+\delta),y) \quad \text{subject to} \quad \|\delta\|_\infty \le \epsilon,\quad \|\delta\|_0 \le k.8

The key regularizer is the Overlapping Smoothed minδ  L(f(x+δ),y)subject toδϵ,δ0k.\min_{\delta}\; L(f(x+\delta),y) \quad \text{subject to} \quad \|\delta\|_\infty \le \epsilon,\quad \|\delta\|_0 \le k.9 function,

δ0k\|\delta\|_0 \le k0

which approaches the true count of nonzero groups as δ0k\|\delta\|_0 \le k1 and behaves like a weighted δ0k\|\delta\|_0 \le k2 penalty for large δ0k\|\delta\|_0 \le k3. ATOS couples this with a log-sum-exp approximation to the δ0k\|\delta\|_0 \le k4 norm and states that, under mild assumptions including the Kurdyka–Łojasiewicz property and bounded iterates, the algorithm converges to a critical point of the nonconvex composite objective. On CIFAR-10 and ImageNet, it reports a δ0k\|\delta\|_0 \le k5 attack success rate together with significantly sparser and more structurally coherent perturbations than prior methods (Heshmati et al., 18 Oct 2025).

The explainability claim in these structured attacks is operational rather than rhetorical. GSE measures overlap with Adversarial Saliency Maps through an Interpretability Score and reports that, for the top δ0k\|\delta\|_0 \le k6 percentile of ASM pixels, GSE’s score exceeds δ0k\|\delta\|_0 \le k7. ATOS states that group-wise attacks produce contiguous perturbations, distinguish robust from non-robust features, and can generate counterfactual images whose modified regions correspond to robust features of the target class (Sadiku et al., 2023, Heshmati et al., 18 Oct 2025).

4. Architecture-aware and modality-specific extensions

A central assumption in many sparse attacks is that the attacked network architecture remains fixed during optimization. The dynamics-aware attack on 3D sparse convolution networks shows that this assumption can fail when the model uses input-dependent execution. In that setting, architecture changes induce a lagged gradient: the attack learned at the current step becomes ineffective because the architecture changes afterward. The proposed Leaded Gradient Method reformulates gradients so that they are aware of potential dynamic changes of network architectures and better “lead” the next step. On semantic segmentation and classification, it achieves about δ0k\|\delta\|_0 \le k8 lower mIoU averagely on the ScanNet and S3DIS datasets than dynamic-unaware methods and also outperforms recent point cloud attacks (Tao et al., 2021).

In spiking neural networks, the problem is different but closely related. Standard white-box attacks depend on spatio-temporal back-propagation and surrogate gradients, yet those surrogate gradients may be invisible for an inference-only model because they do not influence inference results. The PDSG method derives a potential-dependent surrogate gradient from a two-point zeroth-order approximation and arrives at a Gaussian surrogate,

δ0k\|\delta\|_0 \le k9

with kk0 in experiments. For binary DVS inputs, the Sparse Dynamic Attack uses a generation–reduction paradigm: it first flips top-kk1 contributing entries identified by STBP+PDSG and finite differences, then prunes the set with binary search. Reported results include kk2 attack success rate on ImageNet for PDSG and kk3 attack success rate for SDA on CIFAR10-DVS by modifying only kk4 of the pixels (Lun et al., 5 Mar 2025).

Text attacks expose a third modality-specific difficulty: the feasible set is discrete. The block-sparse attack against transformer-based text classifiers handles this by alternating a gradient step in embedding space, a projection onto the set of at most kk5 nonzero blocks, and a nearest-neighbor projection back to the vocabulary using cosine similarity. Because each block corresponds to one token embedding, block-sparsity means at most kk6 token substitutions. On AG News, MNLI, and Yelp Reviews, the method reduces GPT-2 accuracy to less than kk7 while maintaining semantic similarity above kk8 (Sadrizadeh et al., 2022).

5. Empirical behavior and evaluation protocols

The evaluation of sparse attacks is multidimensional because sparsity, attack success, invisibility, structure, and runtime do not collapse into a single metric. GreedyFool distinguishes dynamic evaluation, namely mean and median kk9 pixels needed to reach δϵ\|\delta\|_\infty \le \epsilon0 fooling, from static evaluation, namely the “δϵ\|\delta\|_\infty \le \epsilon1-pixel fooling rate” when allowed at most δϵ\|\delta\|_\infty \le \epsilon2 modified pixels. It also reports target attack success under a pixel budget and machine invisibility using SRM detection rate and binary CNN classifier accuracy. On ImageNet with δϵ\|\delta\|_\infty \le \epsilon3, GreedyFool reduces the median number of modified pixels from δϵ\|\delta\|_\infty \le \epsilon4 for SparseFool to δϵ\|\delta\|_\infty \le \epsilon5, raises the “100 pixels fooling rate” from δϵ\|\delta\|_\infty \le \epsilon6 to δϵ\|\delta\|_\infty \le \epsilon7, and improves targeted success at budget δϵ\|\delta\|_\infty \le \epsilon8 pixels from δϵ\|\delta\|_\infty \le \epsilon9 for PGD[ϵ,ϵ][-\epsilon,\epsilon]0 to [ϵ,ϵ][-\epsilon,\epsilon]1. It also lowers SRM detection from [ϵ,ϵ][-\epsilon,\epsilon]2 to [ϵ,ϵ][-\epsilon,\epsilon]3, and on CIFAR-10 runs in [ϵ,ϵ][-\epsilon,\epsilon]4 s per image versus [ϵ,ϵ][-\epsilon,\epsilon]5 s for SparseFool (Dong et al., 2020).

SAIF evaluates on Inception-v3 and ResNet-50 with attack success rate as the primary outcome. On untargeted Inception-v3 at [ϵ,ϵ][-\epsilon,\epsilon]6, [ϵ,ϵ][-\epsilon,\epsilon]7, it reports GreedyFool ASR [ϵ,ϵ][-\epsilon,\epsilon]8, Homotopy-Attack ASR [ϵ,ϵ][-\epsilon,\epsilon]9, and SAIF ASR \ell_\infty00; at \ell_\infty01, \ell_\infty02, it reports GreedyFool ASR \ell_\infty03, Homotopy-Attack ASR \ell_\infty04, and SAIF ASR \ell_\infty05. For targeted Inception-v3 at \ell_\infty06, \ell_\infty07, it reports GreedyFool ASR \ell_\infty08, Homotopy-Attack ASR \ell_\infty09, and SAIF ASR \ell_\infty10. The same paper also states that \ell_\infty11 and that the perturbation is almost invisible even at \ell_\infty12 because only \ell_\infty13 pixels are modified (Imtiaz et al., 2022).

LP-BFGS evaluates both attack ability and computation under different pixel budgets. On CIFAR-10 with ResNet-20 and untargeted \ell_\infty14, LP-BFGS+CW reaches ASR \ell_\infty15 at \ell_\infty16, \ell_\infty17 at \ell_\infty18, and \ell_\infty19 at \ell_\infty20. On ImageNet with ResNet-34 and \ell_\infty21, LP-BFGS+CE reaches ASR \ell_\infty22, while LP-BFGS+CW reaches ASR \ell_\infty23. The authors present the method as having comparable attack ability with reasonable computation compared with existing solutions (Zhang et al., 2022).

Group-wise methods report additional structure-sensitive metrics. GSE uses ACP, ANC, \ell_\infty24, and \ell_\infty25, and for untargeted attacks reports ASR \ell_\infty26 on ResNet20 for CIFAR-10 and on VGG19 and ResNet50 for ImageNet, with ACP \ell_\infty27 and time \ell_\infty28 s / \ell_\infty29 s / \ell_\infty30 s, respectively. In targeted settings it also reports ASR \ell_\infty31 across the same backbones, with competing methods requiring \ell_\infty32–\ell_\infty33 more pixels and \ell_\infty34–\ell_\infty35 the runtime. Text attacks, by contrast, use semantic similarity and token error rate; SNN attacks use sparsity ratio, mean and median \ell_\infty36, and event-level budgets such as \ell_\infty37 flips (Sadiku et al., 2023, Sadrizadeh et al., 2022, Lun et al., 5 Mar 2025).

6. Limitations, misconceptions, and open technical issues

A persistent technical issue is that exact \ell_\infty38 optimization is difficult. LP-BFGS states directly that direct optimization of an \ell_\infty39 constraint is combinatorial, while SAIF states that projection onto \ell_\infty40 is NP-hard and therefore replaces projection with a linear minimization oracle over a convex hull. GSE and ATOS instead introduce nonconvex surrogates—respectively a \ell_\infty41-quasinorm regularizer and the OSL\ell_\infty42 function—and therefore emphasize stationarity, critical points, or convergence of a reduced subproblem rather than global optimality (Zhang et al., 2022, Imtiaz et al., 2022, Sadiku et al., 2023, Heshmati et al., 18 Oct 2025).

Another misconception is that sparsity alone guarantees imperceptibility. The literature does not support that conclusion. GreedyFool introduces a learned per-pixel distortion map specifically so that high-distortion pixels receive lower priority; SAIF emphasizes low-magnitude perturbations at a small number of pixels; text attacks preserve semantics through discrete nearest-neighbor projection and a semantic-similarity threshold of approximately \ell_\infty43. In other words, support size and perceptual quality are related but distinct design targets (Dong et al., 2020, Imtiaz et al., 2022, Sadrizadeh et al., 2022).

A further limitation is gradient fidelity. The dynamics-aware 3D sparse convolution paper shows that gradients can become lagged when the network architecture changes with the input, and the SNN paper shows that surrogate gradients may be invisible in inference-only settings. These cases indicate that sparse attack performance depends not only on the sparsity model or optimizer, but also on whether the backward signal accurately reflects the victim model’s effective forward behavior. This suggests that architecture-aware and modality-aware gradient design is as important as support selection itself (Tao et al., 2021, Lun et al., 5 Mar 2025).

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Gradient-Based Sparse Adversarial Attack.