Foundation Lab

Energy-Based Models & Score Functions

Unifies discriminative and generative modeling: classifier logits ARE energy differences

Concept 53 of 100Generative ModelsPhase 10
#53EBMsGenerative Models
key equation
pθ(x)=exp⁡(−Eθ(x))Zθp_\theta(x) = \frac{\exp(-E_\theta(x))}{Z_\theta}
Reading map and next steps

Selected Foundation Object

Keep the equation fixed; move through the evidence.

Concept 53 of 100EBMsGenerative Models / Phase 10: Mathematical foundations & information geometry
Current question

The partition function Z is intractable—all EBM training tricks avoid computing it

pθ(x)=exp⁡(−Eθ(x))Zθp_\theta(x) = \frac{\exp(-E_\theta(x))}{Z_\theta}
PredictionCommit before tracing the equation.

Ask what should change under a concrete input, then trace that expectation through the equation.

EvidenceCompare the equation and source.

Use the key equation and canonical papers as the available witnesses, without implying that a runnable panel exists.

InvariantName what survives notation changes.

The useful learning product is the reusable mechanism you can carry into another model, paper, or engineering tradeoff.

Next moveContinue through the atlas.

Use prerequisites, dependents, and semantic links to repair the next gap without leaving the object behind.

Why It Matters for Modern Models

  • Unifies discriminative and generative modeling: classifier logits ARE energy differences
  • GAN discriminators can be viewed as learning energy functions
  • Score-based diffusion models are EBMs trained via denoising score matching

What Tutorials Skip

What is still poorly explained in textbooks and papers:

  • The partition function Z is intractable—all EBM training tricks avoid computing it
  • Energy = "how wrong this input looks"—low energy = high probability
  • MCMC sampling from EBMs is slow; diffusion sidesteps this by learning the denoising path directly

Visualization Status

Core Math (Optional Deep Dive)

If you want intuition first, start with the key equation and cited sources. Come back here for the full walkthrough.

Key Equation
pθ(x)=exp⁡(−Eθ(x))Zθp_\theta(x) = \frac{\exp(-E_\theta(x))}{Z_\theta}

Energy-based models define probability via unnormalized energy:

pθ(x)=exp⁡(−Eθ(x))Zθ,Zθ=∫exp⁡(−Eθ(x))dxp_\theta(x) = \frac{\exp(-E_\theta(x))}{Z_\theta}, \quad Z_\theta = \int \exp(-E_\theta(x)) dx

The score function is the gradient of log-probability:

sθ(x)=∇xlog⁡pθ(x)=−∇xEθ(x)s_\theta(x) = \nabla_x \log p_\theta(x) = -\nabla_x E_\theta(x)

Contrastive divergence training:

∇θL=Epdata[∇θEθ(x)]−Epθ[∇θEθ(x)]\nabla_\theta \mathcal{L} = \mathbb{E}_{p_{data}}[\nabla_\theta E_\theta(x)] - \mathbb{E}_{p_\theta}[\nabla_\theta E_\theta(x)]

Canonical Papers

A Tutorial on Energy-Based Learning

LeCun et al.2006MIT Press
Read paper →

Connections

Next Moves

Choose the next question to carry this object forward.