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

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

Abstract

Deep neural networks are notoriously vulnerable to adversarial attacks—subtle perturbations that trigger high-confidence misclassifications. This paper introduces REAL (Rectified Adversarial Sample based on LE prior), a test-time defense mechanism that exploits the "Low Entropy (LE) Prior." 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. This approach significantly improves robustness against unseen attacks without requiring model retraining.

Introduction

While Adversarial Training (AT) is a common defense, it often suffers from a "generalization gap," where models remain defenseless against attack types not seen during training. Test-time defense offers a more flexible alternative by "purifying" samples during inference. The authors identify a critical statistical signature of adversarial samples: they often force models into confident but incorrect predictions, a phenomenon termed the Low Entropy (LE) Prior.

The Low Entropy Prior

The LE prior consists of two key properties:

  1. Low-entropy misclassification: Adversarial samples are typically 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.
Figure 2: Error rates vs. prediction entropy for clean and adversarial samples across MNIST, CIFAR-10, and CIFAR-100.

As illustrated in Figure 2, for clean data (blue), error rates increase as entropy increases. Conversely, for adversarial data (orange), the highest error rates often occur at the lowest entropy levels, representing the "adversarial trap" where the model is confidently wrong.

The REAL Framework

To exploit the LE prior, the authors propose the REAL framework, a two-stage optimization process that acts as a "plug-and-play" module for existing classifiers.

Figure 6: The two-stage REAL framework: Reverse Rectification (entropy maximization) followed by Forward Rectification (entropy minimization).

Stage 1: Reverse Rectification (Entropy Maximization)

Instead of attempting to fix the image immediately, the algorithm first maximizes the prediction entropy. This "masks" the adversarial effect by pulling the sample away from the sharp, confident-but-wrong decision boundary created by the attacker.

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. This two-stage process effectively resets the model's false certainty before finding the true certainty.

Detection and Weighting

To maintain efficiency, REAL includes a detection step using auxiliary loss and entropy thresholds to decide if a sample requires rectification. Furthermore, the strengths of the optimization stages are dynamically adjusted based on the initial entropy of the sample.

Key Results

The authors evaluated REAL on benchmarks including MNIST, CIFAR-10, and CIFAR-100 against a battery of attacks like PGD, CW, and AutoAttack.

  • 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., improving accuracy by ~12-15% over baseline purifiers on CIFAR-10).
  • Integration with Diffusion: REAL improved state-of-the-art diffusion-based purifiers, increasing performance under FGSM attacks by approximately 16%.

Conclusion

REAL provides a robust, test-time defense by breaking the false confidence induced by adversarial perturbations. While it adds some computational overhead during inference, its ability to handle agnostic attacks and integrate with existing pipelines makes it a powerful tool for securing deep learning models in the wild.

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