Introduction
In modern machine learning, discriminative models (classifiers) and generative models (which learn data distributions) are typically treated as distinct entities. However, recent research presented at Ital-IA 2023 suggests a deep, hidden connection between the two. Robust image classifiers—specifically those trained with adversarial defense—secretly function as generative models. By reinterpreting these classifiers through the lens of Energy-Based Models (EBMs), researchers have found that adversarial examples are not just "off-manifold" noise, but are actually perceived as "more likely" than real data by the model's internal distribution.
Reinterpreting Classifiers as Energy-Based Models
The core methodology involves bridging classification and generation using EBMs. The authors demonstrate that any standard softmax classifier can be mathematically reinterpreted as an EBM. In this framework, the "Energy" $E(x)$ of an input $x$ is derived from the sum of the model's output logits. Lower energy corresponds to a higher probability density in the model's learned distribution.
This perspective reveals a startling phenomenon: untargeted adversarial attacks, such as Projected Gradient Descent (PGD), tend to push inputs into extremely low-energy states. Essentially, the model views these perturbed images as "hyper-real" versions of the data, rather than nonsensical outliers.
Energy-Based Detection and the HE-PGD Attack
Leveraging this insight, the authors proposed a simple 1D detector that flags inputs with energy levels significantly lower than the natural data distribution. This detector is highly effective against standard attacks because it identifies the "hyper-real" signature of adversarial noise.
However, this creates a new vulnerability. To test the robustness of this detector, the researchers developed High-Energy PGD (HE-PGD). This novel attack includes a regularization term that forces adversarial perturbations to maintain energy levels similar to natural data, effectively "cloaking" the attack from the energy-based monitor.
Key Results and Visual Evidence
The study, conducted on benchmarks like CIFAR-10, CIFAR-100, and Imagenette, yielded several critical findings:
- High Detection Accuracy: Against standard PGD attacks, the energy-based detector achieved a Detection Rate (DR) exceeding 98% with a false-positive rate of only ~1.4%.
- Bypassing the Guard: The HE-PGD attack successfully reduced model accuracy to 0% while maintaining a "natural" energy profile, rendering the detector ineffective against an aware adversary.
- Semantic Gradients: Robust models exhibit "human-meaningful" gradients. Unlike standard models that produce noisy, sparse gradients, the gradients of robust models align with semantic features (e.g., bird feathers or beaks), further confirming their generative nature.
Conclusion
The discovery that adversarial training "bends" the energy function of a classifier suggests that robustness is intrinsically linked to a model's generative capabilities. While the energy detector is highly effective against standard attacks, the success of HE-PGD highlights an ongoing "arms race" in AI security. Future research may leverage these robust classifiers for high-quality image synthesis or solving inverse problems without the need for dedicated GANs or diffusion models.
Summary updated