NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Unsupervised Adversarial Detection without Extra Model: Training Loss Should Change

Chien Cheng Chyou, Hung-Ting Su, Winston H. Hsu

TL;DR

Standard cross-entropy loss encourages neural networks to learn non-essential features that explain why an input does not belong to incorrect classes, inadvertently creating attack surfaces for adversarial perturbations. By replacing cross-entropy with a novel dual-objective loss—forcing non-target logits into a uniform distribution and balancing true class gradients—the authors make non-target outputs virtually un-attackable. This allows robust, unsupervised adversarial detection using two simple logit thresholds on the model itself, requiring zero auxiliary models or inference overhead.

What Problem Does This Paper Address?

Adversarial attacks introduce imperceptible perturbations to fool deep learning models. Defenses fall into two broad buckets:

  1. Adversarial Training: Extremely slow, hurts clean accuracy, and rarely generalizes to unseen attack types.
  2. Adversarial Detection (AD):
  3. Supervised AD flags known attacks accurately but requires auxiliary models and fails against unfamiliar attack strategies.
  4. Unsupervised AD aims to detect attacks without prior knowledge, but existing approaches rely on heavy feature-distribution checks, reconstruction networks (e.g., autoencoders), or fragile hyperparameter tuning.

The root cause of this brittleness lies in standard cross-entropy loss: it actively suppresses false classes, prompting the model to learn features for "why an image is not class $X$" rather than solely "why it is class $Y$". Attackers exploit these redundant "negative" features to manipulate model logits.

Methods

Instead of bolting on an external detector, the authors modify how the classification network trains so that attacks directly manifest as detectable anomalies in the raw logits (pre-softmax outputs):

  • Loss for False Outputs ($Loss_{false\_output}$): The network applies KL divergence across all non-target logits in a mini-batch to match a uniform distribution. This strips away features associated with false classes, packing their values into a tight, hard-to-perturb band.
  • Balanced Loss for True Outputs ($Losstrue\_output$): Standard cross-entropy gives similar softmax probabilities—and thus similar gradients—to easy and hard classes, leaving hard classes with depressed true logits. The authors formulate a multi-hot KL divergence loss with an explicit bias term $b = \log(n'/n)$ that normalizes gradient scales across varying true/false sample ratios.
  • Suppressing the "One-Hot" Bias: Left unchecked, models instinctively force at least one logit high. To counteract this, the authors generate a small fraction (10%) of weak adversarial samples per batch (PGD with $\epsilon=8$, 5 iterations) purely to suppress the true logit, penalizing elevated outputs when no distinct ground-truth class is identifiable.
  • Dual-Threshold Detection: At test time, normal samples exhibit a single elevated true logit while false logits cluster tightly. Adversarial attacks depress the true output or push it below the false-class floor. The detector simply flags an input as adversarial if: $$\max(\mathbf{y}) < \tau_{\max} \quad \text{or} \quad \min(\mathbf{y}) < \tau_{\min}$$ where thresholds $\tau_{\max}$ and $\tau_{\min}$ are calibrated directly from the distribution of false logits on clean validation data.
       [ Clean Input ]                      [ Adversarial Input ]
   Logits:                               Logits:
     5 |  ■ (Dog - True)                   5 |
     4 |                                   4 |
     3 |  -- τ_max threshold --            3 |  -- τ_max threshold --
     2 |                                   2 |
     1 |  ■  ■  ■ (False classes)          1 |  ■  ■  ■  ■ (All stay low /
     0 |                                   0 |               true output suppressed)
       +----------------------               +----------------------
             Normal Sample                         Flagged as Attack!

Datasets

  • CIFAR-10: Evaluated with a customized ResNet-18 architecture.
  • Attacks Evaluated: White-box attacks including Fast Gradient Sign Method (FGSM; $\epsilon=8, 16$), Basic Iterative Method (BIM; $\epsilon=8, 16$), Projected Gradient Descent (PGD; $\epsilon=8, 16$), DeepFool (DF; $\infty, 8, 16$), and AutoAttack ($\epsilon=8, 16$).
  • No new benchmarks were introduced; tests relied on standard implementations from the Adversarial Robustness Toolbox.

Key Insights and Ideas

  • Negative features are adversarial vulnerabilities: Humans identify an object by affirmative traits, not an exhaustive checklist of what it isn't. Eliminating negative-class features removes the primary gradient pathways attackers exploit to inflate incorrect classes.
  • True logits act as self-contained canary signals: Because the false outputs are constrained to be largely unmovable under optimization, adversarial perturbations can only depress the true logit. As a result, anomalous output magnitude directly signals an attack.
  • Zero inference tax: Detection requires checking whether the minimum or maximum logit falls outside two scalar bounds—no auxiliary neural nets, Bayesian ensembles, or image transformations needed.

Key Results

  • Detection Performance vs. Baselines: On CIFAR-10, the method achieves $\ge 93.9\%$ True Positive Rate (TPR) against FGSM, BIM, PGD, and AutoAttack, maintaining an exceptionally low False Positive Rate (FPR) of 2.5%.
  • Competing unsupervised detectors (FS, MagNet, DNR, SFAD) struggle significantly on iterative attacks (e.g., MagNet achieves $<1\%$ TPR on PGD).
  • While Neural-network Invariant Checking (NIC) reaches 100% TPR on PGD, its FPR sits much higher at $10.08\%$.
  • AutoAttack Resilience: Achieves 100% TPR against AutoAttack ($\epsilon=8$ and $\epsilon=16$) at 2.5% FPR.
  • Preserved Clean Accuracy: The target ResNet-18 preserves a clean classification accuracy of roughly 86%, avoiding the severe accuracy drop typical of full adversarial training.

Limitations and Future Work

  • Unbounded Perturbations: Detection drops to 78.8% TPR against unbounded DeepFool attacks ($\text{DF}(\infty)$), where large pixel swings ($L_\infty \approx 255$) override logit separation.
  • Heuristic Adversarial Regularization: The method still injects 10% adversarial samples during training to eliminate the model’s default one-hot bias, and the authors note an incomplete theoretical understanding of why this occasionally depresses true logits.
  • Potential Adaptive Attacks: If an attacker knows the dual-threshold mechanism, they might optimize perturbations to suppress the true logit without dropping below $\tau_{\max}$ or triggering $\tau_{\min}$. Future research must focus on mathematically hardening false-output invariance.
  • Narrow Benchmark Scope: Empirical verification is currently limited to CIFAR-10 with ResNet-18; scaling to larger datasets (e.g., ImageNet) remains unverified.

Summary updated

BibTeX
@inproceedings{chyou2023unsupervised,
  author = {Chien Cheng Chyou and Hung-Ting Su and Winston H. Hsu},
  title = {{Unsupervised Adversarial Detection without Extra Model: Training Loss Should Change}},
  booktitle = {AdvML-Frontiers @ ICML},
  year = {2023},
  url = {https://openreview.net/forum?id=1Ec5QRTfXQ},
}
Figure