Research
Scalable Energy-Based Models via Adversarial Training: Unifying Discrimination and Generation
Overview Research area: Machine learning — energy-based models, adversarial training, and joint discriminative-generative (hybrid) modeling. Technical level: Advanced. The paper assumes familiarity wi
- arXiv
- 2510.13872
- Published
- 2025-10-13
- Authors
- Xuwang Yin, Claire Zhang, Julie Steele, Nir Shavit, Tony T. Wang
AI summary
Overview
Research area: Machine learning — energy-based models, adversarial training, and joint discriminative-generative (hybrid) modeling.
Technical level: Advanced. The paper assumes familiarity with energy-based models, Stochastic Gradient Langevin Dynamics (SGLD), Projected Gradient Descent (PGD), adversarial training, and the Joint Energy-Based Model (JEM) framework.
Scope in one sentence: The paper proposes Dual Adversarial Training (DAT), which replaces the unstable SGLD-based learning in JEM with an adversarial-training-based energy objective, and uses it to scale energy-based hybrid models to ImageNet 256×256 while jointly delivering robust classification and high-fidelity generation.
What This Paper Is About
Classifiers and generative models are usually built separately: classifiers predict labels but cannot model data distributions, while generative models synthesize samples but are not optimized for classification. Joint Energy-Based Models (JEM) showed that a standard classifier's logits can be reinterpreted as an energy function, enabling both tasks in one network — but JEM trains its generative term with SGLD, which is unstable, computationally inefficient, and produces poor samples, keeping such hybrids stuck at CIFAR-scale (32×32) resolution. This paper's goal is a training framework that keeps the JEM-style unified architecture but swaps SGLD for adversarial training, so that a single model can be both adversarially robust and a competitive generator at high resolution.
Key Contributions
-
A stable adversarial-training replacement for SGLD-based JEM learning. The energy function is optimized with a Binary Cross-Entropy (BCE) loss that discriminates between real data and contrastive samples generated by PGD, replacing the unconstrained energy-based-model gradient that caused numerical instability.
-
Adversarial training for the discriminative component, which also supplies implicit regularization. Robust classification is obtained through an adversarially trained cross-entropy loss, and this same adversarial training implicitly bounds the R1 gradient penalty, eliminating the explicit R1 penalty that the prior AT-EBM framework required — simplifying training and removing a constraint on model expressiveness.
-
A two-stage training strategy. Stage 1 performs discriminative adversarial training under the architecture's original normalization configuration (and can be skipped when pretrained robust classifiers exist); Stage 2 continues with the full joint objective, disabling batch normalization for ResNet/WRN and keeping layer normalization as-is for ConvNeXt. The strategy generalizes across batch-normalized and layer-normalized architectures.
-
First EBM-based hybrid to scale to high-resolution data. The method is reported as the first EBM-based hybrid to reach ImageNet 256×256 with high training stability, and it uniquely combines state-of-the-art-level generative quality with adversarial robustness.
Main Findings
-
Robustness plus generation on CIFAR-10. DAT (T=40) reaches 91.92% clean accuracy, 75.75% robust accuracy, IS 9.92, and FID 9.12. Prior EBM hybrids were far less robust: JEM reaches 40.5% robust accuracy (FID 38.4) and SADA-JEM 31.93% (FID 9.41), versus 75.73% for standard AT. RATIO achieves 76.25% robust accuracy but FID 21.96.
-
Scaling to ImageNet 256×256. DAT with ConvNeXt-Large with ConvStem (198M parameters, T=110) achieves 75.78% clean accuracy, 56.40% robust accuracy, FID 3.29, and IS 310.2. The corresponding standard AT checkpoint reports 78.25% clean, 33.38% robust, and FID 44.46.
-
Comparison with the diffusion-based hybrid EGC. EGC reports 78.90% accuracy and 13.56% robust accuracy with FID 6.05 and IS 231.3 on ImageNet, against DAT's 56.40% robust accuracy and FID 3.29.
-
Competitive as a standalone generator. DAT's ImageNet FID 3.29 matches the autoregressive VAR-d16 (FID 3.30) while using fewer parameters (198M vs. 310M), and outperforms ADM-G (FID 4.59, 608M), LDM-4-G (FID 3.60, 400M), and BigGAN-deep (FID 6.95, 340M). DiT-XL/2-G (FID 2.27, 675M) and VAR-d30-re (FID 1.73, 2.0B) report lower FIDs.
-
Higher inference throughput than diffusion models. Sampling is reported as roughly 29× faster than ADM-G and roughly 5× faster than LDM-4-G.
-
PGD iterations control a generative-discriminative trade-off. On CIFAR-10, increasing T from 40 to 50 improves FID from 9.12 to 7.57 but lowers clean and robust accuracy. The paper shows this tension can also be tuned through loss weighting.
-
Model capacity and architecture matter. Scaling ImageNet models from ResNet-50 (26M parameters) to WRN-50-4 (223M) improves both discriminative and generative metrics, and ConvNeXt-L (198M) substantially outperforms WRN-50-4 (223M) despite fewer parameters.
-
Counterfactual generation quality. The model produces visual counterfactual explanations directly by gradient descent on the joint energy, with no external model. At ε=8, RATIO reaches 0.89 confidence in the target class with FID 43.18; DAT reaches comparable confidence at ε=4 with FID 25.53.
-
Noise initialization works. DAT can be trained without any OOD data by initializing PGD from pure random noise, retaining comparable adversarial robustness while achieving competitive generation quality.
-
Modest training overhead and high stability. Two-stage training costs about 1.05–1.56× standard adversarial training, and the paper reports zero training divergence across all runs, along with corruption robustness comparable to standard AT and generalization to ℓ∞ training.
Methodology in Plain English
The starting point is JEM: take a normal classifier, treat its logits as negative energy, and train both a classification loss and an energy-based loss over the data distribution. JEM's energy loss needs samples from the model, which it obtains with SGLD — a slow, unstable sampling procedure.
DAT makes three changes. First, it replaces the SGLD sampling with an iterative PGD optimization that pushes images downhill on the energy landscape, starting from out-of-distribution images. Second, instead of the unbounded energy-based gradient, it trains the energy function with a binary classification loss that asks the model to distinguish real images from these PGD-generated contrastive samples; this loss introduces sigmoid-based scaling factors that damp gradients when energy values become extreme, preventing numerical overflow and underflow. Third, it adversarially trains the classifier itself, generating adversarial examples with PGD inside an ε-ball and minimizing cross-entropy on them. This adversarial training turns out to also keep the energy gradients bounded, removing the R1 penalty used in earlier AT-EBM work.
The theoretical consequence, characterized in the appendix, is that the optimal solution under the joint objective learns f*(x)[y] = log p_data(y|x) on the support of the data, with constant marginal energy E*(x) = 0 — the model shapes the energy landscape of the joint distribution rather than the full density.
Because batch normalization destabilizes the generative term, training is split into two stages: first standard adversarial training under the original normalization, then joint training with the complete objective, with batch normalization frozen to eval mode for ResNet/WRN and layer normalization left unchanged for ConvNeXt. Augmentation is also decoupled — strong augmentations for the classification loss, basic transformations for the energy loss. Conditional generation is used throughout because it consistently outperforms unconditional generation. Experiments use CIFAR-10/100 with WRN-34-10 and ImageNet 256×256 with ResNet-50, WRN-50-4, and ConvNeXt-Large with ConvStem; robustness is measured with AutoAttack under ℓ2 perturbations at ε=0.5 for CIFAR-10/100 and ε=3.0 for ImageNet, and generation is measured with FID and Inception Score.
Why This Matters
Impact on research. The paper argues that the long-standing barrier to scaling EBM-based hybrid models was not fundamental to energy-based modeling but specifically to SGLD-based training, and that adversarial training offers a stable, scalable substitute. It connects several research threads — JEM, AT-EBM, RATIO, and the observation that robust classifiers serve as primitives for image synthesis — into a single conditional generative framework. It also offers a rare combination: prior scalable hybrids either traded away robustness (EGC at 13.56% robust accuracy) or traded away generative quality (RATIO at FID 21.96 on CIFAR-10).
Real-world applications (as supported by the paper's stated capabilities):
- Visual counterfactual explanations for high-stakes decisions — showing the minimal semantic change that would flip a classifier's prediction, generated from the same energy function that determines the classification itself.
- Robust image classification where inputs may be deliberately perturbed or corrupted, with corruption robustness reported as comparable to standard AT.
- Versatile image synthesis, since the paper reports applicability across diverse image synthesis tasks and uniquely supports compositional generation.
- Out-of-distribution detection and calibration, which the paper lists as motivations for joint discriminative-generative modeling and evaluates as part of its analysis.
Industry relevance. The reported throughput advantage over diffusion models (roughly 29× versus ADM-G, roughly 5× versus LDM-4-G) plus a 1.05–1.56× training overhead over standard adversarial training means the approach fits into pipelines where an adversarially robust classifier is already being trained and a generative head is added at modest extra cost. Because Stage 1 can be skipped when a pretrained robust classifier exists, existing robust models can be converted rather than retrained from scratch.
Future Directions
- Extending the framework to transformer architectures. The paper notes that its two-stage strategy should apply to modern scalable architectures such as Vision Transformers, but the reported experiments cover ResNet, WRN, and ConvNeXt.
- Reducing or eliminating the OOD dependency. Noise-initialized DAT is demonstrated, but its scaling behavior beyond CIFAR-scale and the conditions under which OOD initialization remains necessary are not fully resolved by the reported results.
- Tuning the generative-discriminative trade-off. The paper shows PGD iterations and loss weighting shift the balance between FID and accuracy; how to set these optimally for a given deployment target remains an open question.
- Establishing OOD benchmarks at ImageNet scale. The paper notes that no established OOD datasets exist for ImageNet and constructs one from 300K training and 50K evaluation samples drawn from Open Images, which highlights a gap for standardized comparison.
Target Audience
Researchers and practitioners working on energy-based models, adversarial robustness, or unified discriminative-generative architectures will benefit most, particularly those who have followed JEM and its successors and want to understand why SGLD was the bottleneck and how adversarial training removes it. It is also relevant to engineers who already deploy adversarially robust classifiers and want to add generation or explanation capability, and to readers interested in interpretability through counterfactual explanations. A strong background in deep generative modeling and adversarial attacks is required to follow the method and ablations in detail.
Authors’ abstract
Simultaneously achieving robust classification and high-fidelity generative modeling within a single framework presents a significant challenge. Hybrid approaches, such as Joint Energy-Based Models (JEM), interpret classifiers as EBMs but are often limited by the instability and poor sample quality inherent in training based on Stochastic Gradient Langevin Dynamics (SGLD). We address these limitations by proposing a novel training framework that integrates adversarial training (AT) principles for both discriminative robustness and stable generative learning. The proposed method introduces three key innovations: (1) the replacement of SGLD-based JEM learning with a stable, AT-based approach that optimizes the energy function through a Binary Cross-Entropy (BCE) loss that discriminates between real data and contrastive samples generated via Projected Gradient Descent (PGD); (2) adversarial training for the discriminative component that enhances classification robustness while implicitly providing the gradient regularization needed for stable EBM training; and (3) a two-stage training strategy that addresses normalization-related instabilities and enables leveraging pretrained robust classifiers, generalizing effectively across architectures. Experiments on CIFAR-10/100 and ImageNet demonstrate that our approach: (1) is the first EBM-based hybrid to scale to high-resolution datasets with high training stability, simultaneously achieving state-of-the-art discriminative and generative performance on ImageNet 256x256; (2) uniquely combines generative quality with adversarial robustness, enabling faithful counterfactual explanations; and (3) functions as a competitive standalone generative model, matching autoregressive models and surpassing diffusion models while offering additional versatility.