All models

JEM_WideResNet

A CIFAR10 wide residual classifier reread as an energy-based model of images and labels.

Diffusion and generative · 116 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (15 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
36.5M
Operations
116
Framework
PyTorch
Recurrent
No
Published
ICLR 2020
Cited by
209 (as of 17 October 2026)
Authors
Will Grathwohl, Kuan-Chieh Wang, Jörn-Henrik Jacobsen and others
License
Apache-2.0
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m1455
Graph hash
12b11ca7d1e42111072cabbed6d3f7afd57d2dc2a41ea11005531e360b9a5eb2
Skeleton hash
a298cff15aa240f68c8a1e8c99356203089442501d1a405b82f54e1b005247c2
Architecture hash
178a0f843584bcec210638c03d62e28dcf9a16e0c919e7459db400d5a93d6c12
Diagram SHA-256
532c7dc9a028738536e241e82b0e616157bc1a50acc07d83199d5d08fd34cb6e
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

JEM, the Joint Energy-based Model, starts from a plain image classifier and reads it as an energy-based model of the joint distribution over images and labels. The same network then yields the usual class probabilities and also unnormalized values of the input density. Trained this way, the authors report better calibration, robustness and out-of-distribution detection, along with samples rivaling recent GANs.

The trick is that the LogSumExp of any classifier's logits can be reused to define an energy function at each input. Training optimizes the class-conditional term with ordinary cross-entropy and the marginal likelihood with Stochastic Gradient Langevin Dynamics sampling. The networks are Wide Residual Networks with batch normalization removed so that outputs are deterministic functions of the input. Removing it costs accuracy: a WRN-28-10 goes from 4.2% to 6.4% error on CIFAR10.

The traced member is the official code's CIFAR10 model, configured as in the paper with width 10 and depth 28.

Key idea. Reinterpreting a standard classifier as an energy-based model of the joint distribution, so that one hybrid model rivals the state of the art in both generative and discriminative learning.

  • jem
  • joint energy-based model
  • joint energy model
  • energy based model
  • ebm
  • your classifier is secretly an energy based model
  • wrn-28-10
  • wide resnet
  • hybrid classifier generator

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{grathwohl2020classifiersecretlyenergybased,
      title={Your Classifier is Secretly an Energy Based Model and You Should Treat it Like One}, 
      author={Will Grathwohl and Kuan-Chieh Wang and Jörn-Henrik Jacobsen and David Duvenaud and Mohammad Norouzi and Kevin Swersky},
      year={2020},
      eprint={1912.03263},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/1912.03263}, 
}