SGM Exploits Skip Connections to Boost Black-Box AI Attacks by 30 Points
A single decay factor on residual gradients turns any gradient-based attack into a more transferable one across CNNs, ViTs, and even LLMs.
ProTakeaways
- SGM biases backprop toward skip-connection gradients, decaying residual gradients by a factor gamma in (0, 1].
- Published in IEEE TPAMI, extending an earlier ICLR spotlight from ResNets to ViTs, Inception, NAS models, and LLMs.
- Boosts PGD transferability from ResNet-50 to ResNet-152 from 54.5% to 99.98% at gamma equals 0.6.
- Stacks with ensemble, targeted, and defense-aware attacks including Fast-AT, CFA, HGD, and NRP.
- Extends to GCG jailbreak attacks on LLMs, raising Stable-Vicuna-13B transfer from 10.5% to 48.5%.
- Open-source PyTorch implementation available at github.com/mo666666/SGM under MIT license.
Skip connections are the reason modern deep networks can go deep at all. They preserve low-level features, stabilize training, and show up in nearly every dominant architecture from ResNets to Vision Transformers. A new IEEE TPAMI paper argues they also have a less flattering side effect: they make it much easier to build adversarial examples that transfer between unrelated models. The authors formalize this observation into a technique called the Skip Gradient Method (SGM), and extend it well beyond the ResNet setting where the idea first appeared.
The setup is the standard black-box transfer scenario. An attacker cannot see the target model, so they craft adversarial perturbations on a surrogate model and hope those perturbations still fool the target. White-box methods such as FGSM, BIM, PGD, and Carlini and Wagner often suffer from low transferability in a black-box setting, so they pose only limited threats to models that are usually kept secret in practice while only APIs are accessible. Prior work tried to fix this with momentum, input diversity, or feature-level losses, but almost all of them treated the surrogate as a monolithic function.
The gradient leak hiding inside residual blocks
SGM starts from a small but telling experiment on ImageNet. Using ResNet-18 as the surrogate and VGG19 as the target, the authors selectively zero out gradients from either the skip connection or the residual convolutions at each junction. If they remove more gradients that go through the residual modules while keeping the gradients through skip connections, the black-box attack success rate increases significantly, jumping from 52.52% to 62.10% when the last two residual modules are skipped. In other words, the gradient flowing through the identity shortcut carries a more transferable signal than the gradient flowing through the parametric block sitting next to it.
The intuition, which the paper backs up with a theoretical analysis based on alignment with the data distribution, is that residual modules capture model-specific features. Attacks that lean too heavily on those features overfit to the surrogate and fail on architectures with different inductive biases.
One line of code, applied everywhere
SGM turns this observation into a knob. During backpropagation, whenever the gradient passes through a residual module, it is multiplied by a decay factor gamma between 0 and 1. Skip-connection gradients are left untouched. For a network with L residual blocks, the modified gradient is:
# Standard chain rule through a residual block: z_{i+1} = z_i + f_{i+1}(z_i)
# grad = prod_i (1 + df_{i+1}/dz_i)
# SGM: decay the residual branch by gamma in (0, 1]
# grad_sgm = prod_i (1 + gamma * df_{i+1}/dz_i)
gamma = 0.6 # paper default across architectures
for block in reversed(residual_blocks):
grad = grad @ (I + gamma * block.jacobian(z))Because it only touches the backward pass, SGM adds essentially no compute overhead and plugs into any existing gradient-based attack.
The real contribution of this journal version is showing that the same trick generalizes. For Vision Transformers, the basic block consists of a self-attention layer, an MLP layer, and skip connections, so SGM applies naturally by decaying gradients through both the attention and MLP branches. For architectures without explicit skip connections but with varying-length parallel paths, such as Inception or models produced by Neural Architecture Search, the authors apply gamma once per parametric module along each path. The result: gradients from the shorter path dominate those from the longer path, mirroring the ResNet behavior.
How much does it actually help
The paper runs an unusually broad evaluation: 35 state-of-the-art attacks across six surrogate architectures, targeting ten diverse models including VGG, ResNet-152, DenseNet-201, SENet-154, ConViT, TNT, Visformer, Inception V4, and Inception-ResNetV2, using 5000 correctly classified ImageNet validation images under L-infinity perturbation of 16 with 10 iterations.
A few representative numbers with ResNet-50 as the surrogate and gamma set to 0.6:
- Plain PGD on ResNet-152: 54.54% attack success rate. PGD plus SGM: 99.98%.
- SMI-FRSM on SENet-154: 47.96% up to 62.09%, roughly a 14-point gain.
- MFAA on Inception V4: 57.13% up to 69.46%.
- RFA on ConViT-B: 36.82% up to 51.37%.
The gains hold under harder conditions too. Against CFA adversarial training, SGM improves the RFA attack success rate from 9.40% to 13.13%, a 3.73 point gain, and it also lifts attacks against certified randomized smoothing, HGD denoisers, and NRP purifiers. It stacks with ensemble attacks and helps targeted attacks as well, where the perturbation must steer the prediction to a specific class.
Jumping to large language models
The most surprising extension is to jailbreak attacks on aligned LLMs. Since transformer blocks are the building units, SGM can be dropped into the GCG suffix-optimization framework. Using Vicuna-7B as the surrogate and evaluating transfer to unseen prompts on MPT-7B, Pythia-12B, Vicuna-13B, and Stable-Vicuna-13B, adding SGM to GCG in the multiple-prompt setting raises the attack success rate on Stable-Vicuna-13B from 10.5% to 48.5%, and on MPT-7B from 8.5% to 15.0%, with gamma set to 0.8. The universal adversarial suffix generalizes noticeably better when the surrogate's residual gradients are attenuated.
What to actually tune
The hyperparameter behavior is more predictable than the raw numbers suggest. The optimal gamma is primarily determined by the source model, not the target, which means the attacker can calibrate gamma solely based on the surrogate architecture without needing to know the target. As a practical guide:
- Skip-heavy CNNs like ResNet-50: gamma around 0.2 is aggressive but effective.
- Vision Transformers and mixed-workload use: gamma around 0.6 is the paper's default.
- Inception and NAS-generated models without explicit skips: use a larger gamma like 0.6 to avoid vanishing gradients along short paths.
- Large language models with GCG: gamma around 0.8 to preserve useful signal in the multi-prompt universal-suffix setting.
Limits and honest caveats
SGM is not a free ride. Pushing gamma too low kills the attack because the residual modules do carry classification-relevant signal, just less transferable signal. Gains are smaller on ViT-specific attacks that already exploit transformer structure, such as TGR and VDC, where SGM adds only 1 to 3 points. And while transferability improves against several defenses, adversarial training methods like Fast-AT and RA remain the toughest targets, with absolute attack success rates staying in the single digits or low teens.
Finally, this is a work about attack strength, and the authors are explicit that the point is architectural: skip connections are a systemic transferability leak, and future secure architectures need to account for it.
Getting it running
The full implementation is available on GitHub under an MIT license, with scripts for ViT, MLP-Mixer, Inception-V3, and P-DARTS surrogates, plus an ImageNet subset for evaluation. The ResNet and DenseNet code lives in the original skip-connections-matter repository from the earlier ICLR spotlight paper. Both use standard PyTorch and integrate with timm and pretrainedmodels for loading target networks.
If you already have a gradient-based attack pipeline, adopting SGM is a matter of registering a backward hook on residual blocks and multiplying by gamma. That is a very cheap change for what tends to be a 10 to 30 point jump in black-box attack success.