Rectifying Adversarial Sample With Low Entropy Prior for Test-Time Defense

Lina Ma, Xiaowei Fu, Fuxiang Huang, Xinbo Gao, Lei Zhang

TL;DR

This paper introduces REAL (Rectified Adversarial Sample based on LE prior), a test-time defense mechanism that exploits the "Low Entropy (LE) Prior"—the tendency of adversarial attacks to force models into confident but incorrect predictions. By employing a two-stage Max-Min entropy optimization, REAL first disrupts the adversarial nature of a sample and then guides it back toward a correct, high-confidence classification, significantly improving robustness against unseen attacks.

What Problem Does This Paper Address?

Deep neural networks are notoriously vulnerable to adversarial attacks—subtle perturbations that trigger misclassification. While Adversarial Training (AT) is a common defense, it suffers from a "generalization gap": a model trained to resist one type of attack (e.g., PGD) often remains defenseless against others (e.g., CW or DeepFool).

The authors target Test-Time Defense, where the goal is to "purify" or rectify a sample during inference before the model classifies it. Existing purification methods often rely on auxiliary tasks (like image reconstruction) but fail to fully leverage the statistical differences between how models perceive clean versus adversarial data. Specifically, they address the challenge of defending against unseen/agnostic attacks without needing to retrain the entire model.

Methods

The core of the paper is the Low Entropy (LE) Prior, which consists of two properties:

  1. Low-entropy misclassification: Adversarial samples are often misclassified with high confidence (low entropy), unlike natural samples where low confidence usually signals an error.
  2. Intensity Correlation: Stronger attacks typically result in even lower prediction entropy.

To exploit this, the authors propose the REAL framework, a two-stage optimization process:

  • Stage 1: Reverse Rectification (Entropy Maximization): Instead of trying to fix the image immediately, the algorithm first maximizes the prediction entropy. This "masks" the adversarial effect by pulling the sample away from the confident-but-wrong decision boundary.
  • Stage 2: Forward Rectification (Entropy Minimization): Once the adversarial "trap" is disrupted, the algorithm minimizes entropy to "enlighten" the sample, pushing it toward a high-confidence region that aligns with the distribution of clean data.
  • Attack-Aware Weighting: The strengths of these stages ($\beta$ parameters) are dynamically adjusted based on the initial entropy of the sample.
  • Detection Strategy: To save compute and prevent "over-purifying" clean images, REAL includes a detection step using auxiliary loss and entropy thresholds to decide if a sample actually needs rectification.

Datasets

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

  • MNIST: Handwritten digits.
  • CIFAR-10 & CIFAR-100: Small-scale natural images with 10 and 100 classes, respectively.
  • TinyImageNet: A subset of ImageNet with 200 classes at 64x64 resolution.

They tested against a battery of attacks, including FGSM, PGD, CW, DeepFool (DF), and AutoAttack (AA).

Key Insights and Ideas

  • The Entropy Paradox: In natural domain adaptation, we usually minimize entropy to make a model more certain. However, the authors realized that for adversarial samples, certainty is the enemy. You must first break the model's false certainty (Maximize) before you can find the true certainty (Minimize).
  • Plug-and-Play Robustness: REAL is designed as a module that can be added to existing purification methods (like SOAP). It doesn't require retraining the backbone classifier, making it highly flexible for existing pipelines.
  • Self-Adversarial Nature: The two-stage process acts like a mini-competitive game during inference, where the sample is pushed and pulled until it settles into a stable, "benign-looking" state.

Key Results

  • Superior Generalization: On MNIST, adding REAL to the SOAP defense improved the "worst-case" accuracy across all attacks from 55.62% to 91.63%.
  • Defense Against Unseen Attacks: In scenarios where the model was only trained against PGD but attacked with CW, REAL provided a significant boost (e.g., on CIFAR-10, improving accuracy by ~12-15% over baseline purifiers).
  • Integration with Diffusion: The authors showed that REAL could even improve state-of-the-art diffusion-based purifiers (like ADP), increasing performance under FGSM attacks by approximately 16%.
  • Efficiency: While slower than a single forward pass, REAL is significantly faster than older purification methods like Pixel-Defend, making it more practical for real-time applications.

Limitations and Future Work

  • Detection Thresholds: On complex datasets like CIFAR-100, the entropy distributions of clean samples and certain attacks (like CW/DF) overlap. This makes it difficult to set a perfect threshold for when to trigger the defense, sometimes leading to unnecessary optimization.
  • Physical Patch Attacks: The authors admit that REAL struggles with physical "patch" attacks. These attacks are designed to be robust across many images and don't necessarily trigger the "low entropy misclassification" prior that REAL relies on.
  • Computational Overhead: Although more efficient than some predecessors, the multi-step iterative optimization still adds latency to inference, which might be a hurdle for ultra-low-latency edge devices.

The authors suggest that future work should explore other "priors" beyond entropy to further distinguish adversarial noise from natural image features.

Summary updated

BibTeX
@article{ma2026rectifying,
  author = {Lina Ma and Xiaowei Fu and Fuxiang Huang and Xinbo Gao and Lei Zhang},
  title = {{Rectifying Adversarial Sample With Low Entropy Prior for Test-Time Defense}},
  journal = {IEEE Trans. Multimedia},
  year = {2026},
  doi = {10.1109/tmm.2025.3632635},
}
Figure