Constraining Logits by Bounded Function for Adversarial Robustness

Sekitoshi Kanai, Masanori Yamada, Shin'ya Yamaguchi, Hiroshi Takahashi, Yasutoshi Ida

TL;DR

Researchers have developed a new "Bounded Logit Function" (BLF) that acts as a simple drop-in activation layer just before the softmax in a neural network. By ensuring that both the network's outputs (logits) and their immediate inputs (pre-logits) remain small and finite, this method significantly improves adversarial robustness against both gradient-based and gradient-free attacks, often outperforming or matching state-of-the-art defenses like TRADES.

What Problem Does This Paper Address?

Deep Neural Networks (DNNs) are notoriously fragile; adding a tiny, invisible amount of noise to an image can trick a world-class model into misclassifying a "pig" as an "airliner." This vulnerability is often linked to the Lipschitz constant of the model—essentially a measure of how much the output can change in response to a small change in the input.

Standard training using cross-entropy loss encourages the model to be "overconfident," pushing the values before the final decision layer (the logits) toward infinity. When logits are allowed to explode, the model becomes hypersensitive to tiny input perturbations. While existing methods like "logit squeezing" or "label smoothing" try to keep these values small, the authors argue they don't go far enough in constraining the internal dynamics of the network.

Methods

The authors first provide a theoretical analysis showing that standard cross-entropy leads to infinite optimal logits, which is bad for stability. They then examine common bounded functions like tanh or sigmoid. Surprisingly, they find that while tanh bounds the output, it allows the input to that function (the pre-logits) to become infinitely large, which still leaves the model vulnerable.

To fix this, they propose the Bounded Logit Function (BLF): $$g(z) = 2 \{ z\sigma(z) + \sigma(z) - z\sigma^2(z) \} - 1$$ (where $\sigma$ is the sigmoid function)

What makes BLF special? 1. Finite Outputs: Like tanh, its output is strictly bounded between -1 and 1. 2. Finite Inputs: Unlike tanh, the "optimal" points for the model to reach its maximum confidence occur at finite input values. 3. Simple Integration: It is a parameter-free activation function that can be added to any existing architecture without changing the loss function or the training loop.

Datasets

The authors evaluated their method on two standard computer vision benchmarks:

  • MNIST: A dataset of handwritten digits.
  • CIFAR-10: A dataset of 60,000 small color images across 10 classes (e.g., birds, planes, cars).

They tested these datasets using various architectures, including simple CNNs (2C2F, 4C3F) and deeper models like ResNet-18 and WideResNet-34-10.

Key Insights and Ideas

  • The "Pre-Logit" Trap: Simply bounding the final output isn't enough. If the values entering the final activation can still explode, the model's sensitivity to noise remains high. BLF ensures that the entire "tail end" of the network stays within a stable range.
  • Beyond Gradient Masking: Some defenses work by "confusing" the attacker's gradient (making it hard to find the direction of an attack). The authors prove BLF isn't just masking gradients by testing it against gradient-free attacks (SPSA and Square Attack), where it still performs exceptionally well.
  • Theoretical Grounding: The paper bridges the gap between the "Universal Approximation Theorem" and practical robustness, proving that finite logit values are a necessary condition for a stable Lipschitz constant.

Key Results

  • Standard Training: On CIFAR-10 (without adversarial training), BLF achieved significantly higher robust accuracy against PGD attacks compared to logit squeezing and label smoothing.
  • Adversarial Training: When combined with adversarial training, BLF-equipped models outperformed or matched TRADES, one of the most robust defense frameworks currently available. For example, on WideResNet-34-10 (CIFAR-10), BLF achieved a robust accuracy of ~55.9%, comparable to TRADES.
  • Operator Norms: The authors measured the $L_\infty$ operator norms of the convolution layers and found that BLF naturally encourages the model to learn "flatter," more stable functions compared to baseline models.

Limitations and Future Work

  • The "Why" remains open: While the paper proves that small logits are necessary for robustness, the authors acknowledge that it is still an open research question exactly why constraining them to such small values works so effectively in practice.
  • Hyperparameter Sensitivity: The method introduces a scaling hyperparameter ($\gamma$). While the paper provides guidance, finding the optimal $\gamma$ for a new architecture might require some tuning.
  • Scaling to ImageNet: The experiments were limited to MNIST and CIFAR-10. Testing the BLF on massive, high-resolution datasets like ImageNet would be a logical next step to prove its scalability.

Summary updated

BibTeX
@inproceedings{kanai2021constraining,
  author = {Sekitoshi Kanai and Masanori Yamada and Shin'ya Yamaguchi and Hiroshi Takahashi and Yasutoshi Ida},
  title = {{Constraining Logits by Bounded Function for Adversarial Robustness}},
  booktitle = {IJCNN},
  year = {2021},
  doi = {10.1109/ijcnn52387.2021.9533777},
}
Figure