Skip to main content
QUICK REVIEW

[Paper Review] Your Classifier is Secretly an Energy Based Model and You Should Treat it Like One

Will Grathwohl, Kuan-Chieh Wang|arXiv (Cornell University)|Dec 6, 2019
Anomaly Detection Techniques and ApplicationsComputer Science119 citations
TL;DR

The paper reinterprets standard discriminative classifiers as joint energy-based models (EBMs) and trains them to model p(x, y) and p(x), achieving competitive discriminative and generative performance with improved calibration, OOD detection, and robustness.

ABSTRACT

We propose to reinterpret a standard discriminative classifier of p(y|x) as an energy based model for the joint distribution p(x,y). In this setting, the standard class probabilities can be easily computed as well as unnormalized values of p(x) and p(x|y). Within this framework, standard discriminative architectures may beused and the model can also be trained on unlabeled data. We demonstrate that energy based training of the joint distribution improves calibration, robustness, andout-of-distribution detection while also enabling our models to generate samplesrivaling the quality of recent GAN approaches. We improve upon recently proposed techniques for scaling up the training of energy based models and presentan approach which adds little overhead compared to standard classification training. Our approach is the first to achieve performance rivaling the state-of-the-artin both generative and discriminative learning within one hybrid model.

Motivation & Objective

  • Reframe a standard classifier as a joint energy-based model to model p(x, y) and p(x).
  • Enable training on unlabeled data while preserving discriminative performance.
  • Improve calibration, robustness, and out-of-distribution detection through energy-based training.
  • Demonstrate competitive generative capability alongside discriminative accuracy within a single model.

Proposed method

  • Define p(x, y) from classifier logits via pθ(x,y) = exp(fθ(x)[y]) / Z(θ) with energy Eθ(x,y) = -fθ(x)[y].
  • Obtain unnormalized p(x) by marginalizing over y: pθ(x) = sum_y exp(fθ(x)[y]) / Z(θ).
  • Use LogSumExp(fθ(x)) as the energy proxy for p(x) and train p(y|x) via standard cross-entropy.
  • Train log p(x) with an unbiased gradient estimate using SGLD to sample from the model distribution.
  • Employ persistent contrastive divergence to estimate the expectation in the gradient for log p(x).
  • Base architectures on Wide Residual Networks and train on CIFAR10, SVHN, and CIFAR100.

Experimental results

Research questions

  • RQ1Can a standard classifier be interpreted as a joint energy-based model for p(x, y) and p(x)?
  • RQ2Does EBMs-based training improve calibration, OOD detection, and adversarial robustness while maintaining discriminative performance?
  • RQ3Do joint EBMs offer competitive generative quality alongside discriminative accuracy in large-scale image datasets?
  • RQ4How scales of SGLD-based sampling affect training stability and performance?

Key findings

  • JEM achieves competitive accuracy on CIFAR10/SVHN/CIFAR100 while also delivering generative capabilities comparable to state-of-the-art hybrid models.
  • JEM improves calibration on CIFAR100, achieving near-perfect calibration as measured by expected calibration error (ECE).
  • JEM enhances out-of-distribution detection using multiple scoring methods, including log p(x) and a gradient-based mass score, outperforming several baselines.
  • The model demonstrates robustness to adversarial perturbations, with increased resilience over a standard classifier, approaching specialized robust methods.
  • On CIFAR10, JEM attains 92.9% accuracy with IS 8.76 and FID 38.4, surpassing several hybrid baselines while remaining competitive with discriminative-only models.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.