Papers
Topics
Authors
Recent
Search
2000 character limit reached

Sampling-Based Fast Gradient Rescaling (S-FGRM)

Updated 5 March 2026
  • The paper introduces S-FGRM, which replaces sign-based gradient updates with a log-magnitude rescaling method to preserve detailed gradient information.
  • It employs depth-first sampling to average gradients, effectively reducing numerical instability and capturing more accurate perturbation directions.
  • Empirical results on benchmarks like ImageNet show that S-FGRM significantly improves transferability and black-box attack success compared to traditional methods.

The Sampling-based Fast Gradient Rescaling Method (S-FGRM) is an algorithmic framework for the generation of highly transferable adversarial examples with improved stability in gradient-based attacks. By directly addressing quantization and instability limitations inherent in the sign-based update rule—ubiquitous in methods such as FGSM and I-FGSM—S-FGRM introduces a log-magnitude rescaling of the gradient vector, augmented with a depth-first sampling technique, to more faithfully preserve gradient structure and enhance adversarial transferability across neural networks. This approach yields significant improvements in black-box attack efficacy, notably on standard benchmarks such as ImageNet, and remains compatible with diverse attack pipelines and auxiliary input transformations (Han et al., 2023).

1. Shortcomings of Sign-Based Gradient Updates

Conventional adversarial attacks like FGSM and its iterative variants (I-FGSM, MI-FGSM, NI-FGSM) employ the signsign function on the gradient of the loss xJ(x,y)\nabla_x J(x, y) to determine the perturbation direction: xt+1=xt+αsign(xJ(xt,y))x_{t+1} = x_t + \alpha \cdot sign(\nabla_x J(x_t, y)) This approach enforces an \ell_\infty constraint and guarantees uniformly maximal updates per-feature. However, sign()sign(\cdot) discards all within-vector magnitude information, collapsing every nonzero coordinate to ±1\pm1. This induces several drawbacks:

  • Loss of directional precision: Gradients differing by orders of magnitude in certain dimensions are quantized identically, e.g., [0.8,108][1,1][0.8, 10^{-8}] \rightarrow [1, 1].
  • Suboptimal update directions: The restriction to 2D2^D possible update directions, where DD is the input dimension, neglects richer gradient information and biases trajectories away from optimal adversarial paths.
  • Empirical transferability gap: While sign-based updates may converge rapidly on the source/white-box model, they produce perturbations with poor cross-model transfer in black-box scenarios (Han et al., 2023).

2. Fast Gradient Rescaling Mechanism (FGRM)

FGRM replaces the sign function with a smooth, log-magnitude-based rescaling operation that retains gradient directionality while recapturing relative per-coordinate strength. For a gradient vector g=xJ(x,y)g = \nabla_x J(x, y), rescaling is performed in four steps:

  1. For each coordinate ii, compute ai=log2gia_i = \log_2|g_i|.
  2. Calculate mean μ\mu and standard deviation σ\sigma of {ai}\{a_i\}.
  3. Apply a sigmoid normalization: s^i=σ(aiμσ)=11+e(aiμ)/σ\hat{s}_i = \sigma\left(\frac{a_i - \mu}{\sigma}\right) = \frac{1}{1 + e^{-(a_i - \mu)/\sigma}}, mapping to (0,1)(0, 1).
  4. Rescale:

rescale(g)i=csign(gi)s^i\mathrm{rescale}(g)_i = c \cdot sign(g_i) \cdot \hat{s}_i

where cc is a tunable cap (e.g., c=2c=2). In vector notation:

rescale(g)=c[sign(g)σ((log2gμ1)/σ)]\mathrm{rescale}(g) = c \cdot [ sign(g) \odot \sigma((\log_2|g|-\mu\mathbf{1})/\sigma) ]

Advantages of this transformation include preservation of coordinate ordering and a parametrizable interpolation between full sign quantization (c=1c=1, σ0\sigma\rightarrow 0) and finer-grained magnitude differentiation. The rescaled update allows for more accurate modeling of input space traversal, thus improving adversarial transferability (Han et al., 2023).

3. Depth-First Sampling for Gradient Stabilization (DFSM)

To mitigate instability in rescaled gradients induced by numerical fluctuations in log, normalization, and sigmoid computations, S-FGRM introduces a depth-first sampling strategy. At each iteration tt:

  • Construct a sequence xt0=xt,xti+1=xti+ξix_t^0 = x_t, x_t^{i+1} = x_t^i + \xi_i for i=0,,N1i=0,\dots,N-1, with ξiUniform([βϵ,βϵ]D)\xi_i \sim \text{Uniform}([-\beta \epsilon, \beta \epsilon]^D).
  • Compute the average gradient across the walk:

g^t=1N+1i=0NxJ(xti,y;θ)\hat{g}_t = \frac{1}{N+1}\sum_{i=0}^{N} \nabla_x J(x_t^i, y; \theta)

This "depth-first" walk, as opposed to single-point or independent sampling, smooths out high-frequency gradient noise and yields a more stable gradient estimate for downstream rescaling. Empirically, optimal performance is usually achieved with N12N \approx 12 and a range β1.5\beta \approx 1.5 (Han et al., 2023).

4. Algorithmic Structure and Computational Complexity

An example instantiation of S-FGRM atop MI-FGSM (momentum iterative FGSM) comprises the following pipeline:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
x_0 = x
g_0 = 0
for t in range(T):
    # 1) Depth-First Sampling
    x_t^0 = x_t
    for i in range(N):
        xi_i = Uniform(-beta*epsilon, beta*epsilon, size=D)
        x_t^{i+1} = x_t^i + xi_i
    g_avg = (1/(N+1)) * sum(gradient(x_t^i, y) for i in range(N+1))

    # 2) Momentum Update
    g_{t+1} = mu * g_t + g_avg / l1_norm(g_avg)

    # 3) Fast Gradient Rescale
    delta_{t+1} = rescale(g_{t+1})

    # 4) Step & Clip
    x_{t+1} = clip(x_t + alpha * delta_{t+1}, x - epsilon, x + epsilon)

return x_T
Standard MI-FGSM costs one evaluation per iteration, while S-FGRM requires (N+1)(N+1) forward/backward passes per step, incurring a modest computational overhead. Element-wise log, normalization, and sigmoid operations are O(S)O(S) in input size SS. Unlike percentile-based (staircase) rescaling, which needs O(SlogS)O(S \log S) sorts, S-FGRM avoids such costs (Han et al., 2023).

5. Extension to Input Transformations and Ensemble Attacks

S-FGRM is compatible with both input transformation pipelines and ensemble-based attack methodologies:

  • Input transformations: For each sampled xtix_t^i in DFSM, apply a randomized transformation T()T(\cdot) prior to gradient computation (e.g., resize+padding as in DIM).
  • Ensembles: When using MM surrogate models, the average loss Jens(x,y)=1MmJm(x,y)\mathcal{J}_\text{ens}(x, y) = \frac{1}{M}\sum_m \mathcal{J}_m(x, y) is computed, and gradients from each model are averaged at every depth-first sampled input. All other steps—FGRM rescaling and projection—are left unaltered. This extensibility allows S-FGRM to serve as a modular component in state-of-the-art black-box attack pipelines (Han et al., 2023).

6. Empirical Evaluation and Performance

Evaluation on ImageNet (with ϵ=16/255\epsilon=16/255, T=10T=10, μ=1.0\mu=1.0, α=1.6\alpha=1.6) demonstrates substantial gains in adversarial transferability, as outlined below.

Attack Variant Inc-v3* Inc-v4 IncRes-v2 Res-101 Inc-v3_ens3 Inc-v3_ens4
MI-FGSM 100.0 44.3 42.4 36.2 13.8 13.0
SMI-FGRM 100.0 82.0 81.1 73.6 44.8 41.3
NI-FGSM 100.0 51.3 49.9 40.6 12.8 12.9
SNI-FGRM 100.0 85.4 83.5 75.9 44.2 42.5

In combination with composite input transforms (DIM, TIM, SIM), S-FGRM enhances non-targeted transfer rates up to 94% on black-box models. Ablations indicate that both FGRM and DFSM contribute to the gains, with FGRM outperforming staircased approaches and DFSM providing further stabilization, especially in the presence of transformations.

Additional findings:

  • Optimal gradient rescale cap is c2c \approx 2.
  • S-FGRM yields absolute black-box transfer gains of 30–40% over MI-FGSM, with only a modest increase in gradient computation (Han et al., 2023).

7. Context and Implications

S-FGRM systematically addresses a critical bottleneck in transfer-based adversarial attack research—the quantization loss of the signsign function and the instability of gradient signals. By preserving magnitude information and introducing robust local averaging, the method advances the reliability and generalization of adversarial perturbations, with relevance for both benchmark evaluation and security analysis of large-scale vision models. Its modular design allows integration with diverse input manipulations and model ensembles, thereby facilitating exploration of new attack and defense spectra in adversarial machine learning (Han et al., 2023).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

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 Sampling-based Fast Gradient Rescaling (S-FGRM).