SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1912.03263 · 2019

Your Classifier is Secretly an Energy Based Model and You Should Treat it Like One

arXiv · PDF · Open in the Atlas

Code that ran

11 of 13 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 6 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 4 failures of our instrument; 2 no recorded run); 1 of them was also run on the host, not in the jail, by the peer-agreement lane that set its level, measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/1912.03263.json · badge: /api/ran/1912.03263.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
wgrathwohl/JEM canonical (classifier label)
classifier basis: classifier_2025
6 ran · 1 no recorded run
divymurli/ML_Reprod_HybridEnergyModels reimplementation (classifier label)
classifier basis: classifier_2025
3 ran · 0 no recorded run
tohmae/pytorch-jem reimplementation (classifier label)
classifier basis: classifier_2025
2 ran · 1 no recorded run
FunctionStatusWhere it lives
grad_norm Ran
ran, honoured the contract we drafted
wgrathwohl/JEM/train_wrn_ebm.py
code served (permissive licence) · get_code("a28fb1100053feb0")
How it ran

Ran in Syntology's jail on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. The comparison behind this sample's level is a different run: the peer-agreement lane ran it again on the host, not in the jail (report dated 2026-09-05T01:17:04Z). If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 3)
        self.linear2 = nn.Linear(3, 2)
    
    def forward(self, x):
        x = self.linear1(x)
        x = self.linear2(x)
        return x

# Create model instance
m = SimpleModel()

# Create dummy input and target
x = torch.randn(2, 4)
y = torch.randint(0, 2, (2,))

# Forward pass
output = m(x)

# Compute loss and backward to populate gradients
loss_fn = nn.CrossEntropyLoss()
loss = loss_fn(output, y)
loss.backward()

# Now m has gradients populated
ARGS = {
    "m": m
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
LogSumExp Ran
ran; our contract draft was wrong, not the code
tohmae/pytorch-jem/jem.py
pointer only (licence: NONE) · get_code("474dd5d796ad2a88")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, tohmae/pytorch-jem when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

calibration_buckets Ran
ran; our contract draft was wrong, not the code
divymurli/ML_Reprod_HybridEnergyModels/calibration.py
pointer only (licence: NONE) · get_code("c5699286991b3f6a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, divymurli/ML_Reprod_HybridEnergyModels when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

correct_and_confidence Ran
ran, honoured the contract we drafted
divymurli/ML_Reprod_HybridEnergyModels/calibration.py
pointer only (licence: NONE) · get_code("3a340a600f735188")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, divymurli/ML_Reprod_HybridEnergyModels when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

expected_calibration_error Ran
ran, violated the contract we drafted
divymurli/ML_Reprod_HybridEnergyModels/calibration.py
pointer only (licence: NONE) · get_code("f58aff46d12bb096")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, divymurli/ML_Reprod_HybridEnergyModels when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

grad_vals Ran
ran, honoured the contract we drafted
wgrathwohl/JEM/train_wrn_ebm.py
code served (permissive licence) · get_code("8ee251be6654f2cb")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch as t
import torch.nn as nn

t.manual_seed(0)

# Create a simple model with parameters that have gradients
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 3)
        self.linear2 = nn.Linear(3, 2)
    
    def forward(self, x):
        x = self.linear1(x)
        x = self.linear2(x)
        return x

# Instantiate the model
model = SimpleModel()

# Create some dummy data and compute gradients
x = t.randn(2, 4)
y = t.randn(2, 2)

# Forward pass
output = model(x)
loss = nn.MSELoss()(output, y)

# Backward pass to populate gradients
loss.backward()

# Now the model has gradients in its parameters
ARGS = {
    'm': model
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
init_random Ran
ran, honoured the contract we drafted
wgrathwohl/JEM/train_wrn_ebm.py
code served (permissive licence) · get_code("77d3d7b7c1ab83ce")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 4, dtype family float, shape (2, 3, 32, 32) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch as t
import torch.nn as nn

t.manual_seed(0)

im_sz = 32
n_ch = 3

ARGS = {
    "args": {},
    "bs": 2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (2, 3, 32, 32) — shape (2, 3, 32, 32) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
init_random Ran
ran, honoured the contract we drafted
wgrathwohl/JEM/eval_wrn_ebm.py
code served (permissive licence) · get_code("d9a9c0f7abb58719")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 4, dtype family float, shape (2, 3, 32, 32) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch as t
import torch.nn as nn

t.manual_seed(0)

ARGS = {
    "bs": 2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (2, 3, 32, 32) — shape (2, 3, 32, 32) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
jacobian Ran
ran; our contract draft was wrong, not the code
tohmae/pytorch-jem/jem.py
pointer only (licence: NONE) · get_code("b689087804867dc7")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, tohmae/pytorch-jem when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

remove_module_state_dict Ran
ran; our contract draft was wrong, not the code
wgrathwohl/JEM/attack_model.py
code served (permissive licence) · get_code("cd015a30f1e9cb2f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned OrderedDict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from collections import OrderedDict

torch.manual_seed(0)

# The function takes a state_dict (dictionary with string keys and tensor values)
# and removes the first component of each key (before the first dot)
# This is typically used to remove "module." prefix from DataParallel models

state_dict = OrderedDict()
state_dict['module.layer1.weight'] = torch.randn(4, 3)
state_dict['module.layer1.bias'] = torch.randn(4)
state_dict['module.layer2.weight'] = torch.randn(5, 4)
state_dict['module.layer2.bias'] = torch.randn(5)

ARGS = {
    'state_dict': state_dict
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type OrderedDict — a OrderedDict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a OrderedDict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
sample_q Ran
ran, honoured the contract we drafted
wgrathwohl/JEM/eval_wrn_ebm.py
code served (permissive licence) · get_code("3152c073d34050ea")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 4, dtype family float, shape (2, 3, 32, 32) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch as t
import torch.nn as nn

t.manual_seed(0)

# Build a minimal model that satisfies how f is used in sample_q
class MinimalEBM(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(3 * 32 * 32, 1)
    
    def forward(self, x, y=None):
        # x shape: (bs, 3, 32, 32)
        # Returns a scalar energy for each sample
        batch_size = x.shape[0]
        flattened = x.view(batch_size, -1)
        energy = self.linear(flattened)
        return energy

# Create the model
f = MinimalEBM()

# Create a minimal replay buffer (list of tensors)
replay_buffer = []

# Create args object with all required attributes
class Args:
    def __init__(self):
        self.batch_size = 2
        self.n_steps = 3
        self.sgld_lr = 0.1
        self.sgld_std = 0.01
        self.reinit_freq = 0.5
        self.uncond = False

args = Args()

# Device
device = 'cpu'

# Optional y (labels) - can be None or a tensor
y = None

ARGS = {
    'args': args,
    'device': device,
    'f': f,
    'replay_buffer': replay_buffer,
    'y': y
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (2, 3, 32, 32) — shape (2, 3, 32, 32) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
sample_p_0 Not yet run
unverified (harvested, no recorded run)
wgrathwohl/JEM/eval_wrn_ebm.py
code served (permissive licence) · get_code("302a4bc5f78a346c")
How it ran

no invocation recorded.

sampler Not yet run
unverified (harvested, no recorded run)
tohmae/pytorch-jem/jem.py
pointer only (licence: NONE) · get_code("d9c152564c59b4f6")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, tohmae/pytorch-jem when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Also present in other papers' code

Of 13 samples lifted from this paper's linked repositories, 13 carry a function identity and 0 do not. Of the 13 distinct functions with an identity, 2 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 2 later) and 11 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
init_random 1 other paper
1 later
2209.07959 (2022-09)
Towards Bridging the Performance Gaps of Joint Energy-based Models
init_random 1 other paper
1 later
2111.02434 (2021-11)
Hamiltonian Dynamics with Non-Newtonian Momentum for Rapid Sampling

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

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.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("1912.03263")
get_code_for_paper("1912.03263")
have("1912.03263")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/1912.03263.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/1912.03263.svg)](https://syntology.ai/paper/1912.03263)

Connect an agent — have() is free.