Logit Margin Matters: Improving Transferable Targeted Adversarial Attack by Logit Calibration

Juanjuan Weng, Zhiming Luo, Shaozi Li, Nicu Sebe, Zhun Zhong · DOI

Introduction

Adversarial attacks involve the introduction of imperceptible perturbations to input data, such as images, to mislead neural networks. While untargeted attacks—where the goal is simply to cause any misclassification—transfer relatively easily from a known surrogate model to an unknown black-box model, targeted attacks remain a significant challenge. In a targeted attack, the adversary aims to force the model to predict a specific, incorrect label. This paper identifies a fundamental limitation in the standard optimization objective for these attacks and proposes "logit calibration" as a robust solution.

The Gradient Saturation Problem

The standard approach for generating adversarial examples relies on the Cross-Entropy (CE) loss function. However, the authors observe that CE loss is ill-suited for targeted transferability. CE loss is designed to stop optimizing once the model becomes sufficiently confident in the target class (i.e., when the probability of the target class approaches 1).

In an adversarial context, this leads to "vanishing gradients." Once the surrogate model is fooled, the optimization process effectively plateaus. While the adversarial image might succeed against the surrogate, it hasn't been pushed deep enough into the target class's decision region to overcome the slightly different boundaries of a black-box model. This "saturation trap" prevents the creation of high-margin adversarial examples that are necessary for cross-model transfer.

Logit Calibration Techniques

To address gradient saturation, the researchers propose three "Logit Calibration" methods designed to keep the optimization process active by preventing the target class probability from saturating prematurely.

1. Temperature-based Calibration

Drawing inspiration from knowledge distillation, the authors introduce a temperature factor $T > 1$ to divide the logits: $$ \mathcal{L}_{temp} = -\log \frac{\exp(z_t / T)}{\sum_j \exp(z_j / T)} $$ By "softening" the probability distribution, this method prevents the target class probability from hitting 1 too quickly, thereby maintaining useful gradients for more iterations and allowing the logit margin to grow.

2. Margin-based Calibration

To eliminate the need for manual tuning of the temperature $T$, the authors developed an adaptive scaling factor. This factor is based on the gap between the Top-1 and Top-2 logits, dynamically downscaling the logits throughout the attack to ensure continuous optimization.

3. Angle-based Calibration

This method involves L2-normalizing both the feature vectors and the classifier weights. By doing so, the optimization objective shifts from maximizing raw logit values to minimizing the cosine distance (the angle) between the adversarial image's features and the target class's weight vector. This geometric alignment proves more robust for transfer than simple magnitude maximization.

Experimental Evaluation

The study utilized the ImageNet-Compatible Dataset, consisting of 1,000 images with unique labels. The researchers evaluated the attacks across four diverse architectures: ResNet-50, DenseNet-121, VGG-16, and Inception-v3.

Key Results

The proposed calibration methods consistently outperformed existing state-of-the-art (SOTA) methods, such as Po+Trip and standard Logit loss.

  • Single-Model Transfer: In a transfer attack from a ResNet-50 surrogate to a black-box DenseNet-121, the success rate increased from 42.7% (using CE) to 77.8% (using $T=5$).
  • Ensemble Attacks: In scenarios using multiple surrogate models, logit calibration achieved significantly higher success rates across all hold-out target models compared to traditional methods.
  • Real-World Application: The effectiveness of these attacks was validated against the Google Cloud Vision API, where they achieved a targeted transfer success rate of 15-16%, highlighting a tangible vulnerability in commercial AI systems.

Discussion and Limitations

The success of these methods suggests that for an adversarial attack to transfer well, the adversarial feature vector must be geometrically aligned with the target class's weight vector. The authors also proved theoretically that the previously proposed "Logit Loss" is a special case of temperature-based calibration where $T$ is extremely large.

However, some limitations remain. Angle-based calibration showed lower performance on VGG-16, potentially due to the model's lack of Batch Normalization or other architectural specifics. Additionally, while the margin-based approach is adaptive, the temperature-based approach still requires hyperparameter tuning.

Conclusion

By identifying and addressing the "saturation trap" in standard loss functions, this work demonstrates that logit margin is a critical factor in the transferability of targeted adversarial attacks. Logit calibration offers a simple, "plug-and-play" enhancement that significantly boosts attack success rates without requiring additional training data or complex generative models.

Summary updated

BibTeX
@article{weng2023logit,
  author = {Juanjuan Weng and Zhiming Luo and Shaozi Li and Nicu Sebe and Zhun Zhong},
  title = {{Logit Margin Matters: Improving Transferable Targeted Adversarial Attack by Logit Calibration}},
  journal = {IEEE Trans. Inf. Forensics Secur.},
  year = {2023},
  doi = {10.1109/tifs.2023.3284649},
}
Figure