Statistical Foundations
Energy in Statistics and Machine Learning
A disambiguation guide to energy-based models, free energy, energy distance, distance covariance, energy scores, Langevin potentials, and computational energy use.
Learning position
Read this page in the graph.
statistical-foundations | layer 2 | tier 2. This page has 2 direct prerequisites and 2 published dependents.
What next
Energy-Based ModelsThis is the first curated or graph-derived continuation from the current page.
Evidence badge
Claim statusThis page has no public Lean mapping yet. Use the evidence page to inspect how claim status labels work.
Why This Matters
The word energy names several different mathematical objects in statistics and machine learning. They share useful analogies, but they are not one method:
- an energy-based model assigns a scalar score to a configuration and turns that score into a probability density;
- free energy may mean a log-partition quantity or a variational objective;
- energy distance compares two probability distributions through expected pairwise distances;
- distance covariance measures dependence through centered distances;
- the energy score evaluates a univariate or multivariate probabilistic forecast;
- Langevin methods use a potential energy whose gradient drives a stochastic process;
- computational energy is literal electricity consumed by training or inference.
Confusing these meanings causes real errors. An energy-distance two-sample test does not train an energy-based model. A VAE's variational free energy is not the same object as an EBM's log partition function. A classifier's OOD energy score is not the proper energy score used in probabilistic forecasting.
This page is the map. Follow the links for the full mathematics.
Quick Disambiguation
| Phrase | Mathematical object | Typical job | Go next |
|---|---|---|---|
| Energy-based model | represent or learn an unnormalized density | Energy-Based Models | |
| Log-partition free energy | summarize normalization and thermodynamic scale | Energy-Based Models | |
| Variational free energy | approximate Bayesian inference; negative ELBO | Variational Autoencoders | |
| Energy distance | compare distributions or run a two-sample test | Energy Distance and Distance Covariance | |
| Distance covariance | expected product of double-centered distance kernels; estimated with double-centered matrices | test independence, including nonlinear dependence | Energy Distance and Distance Covariance |
| Proper energy score, | evaluate a univariate or multivariate probabilistic forecast | Proper Scoring Rules | |
| OOD energy score | rank classifier inputs for out-of-distribution detection | Out-of-Distribution Detection | |
| Langevin potential | drift proportional to | sample from a target or model noisy dynamics | Langevin Dynamics |
| Compute energy | joules or kilowatt-hours | estimate electrical energy use and environmental cost | Energy Efficiency and Green AI |
The common thread is weaker than the shared word suggests. Several meanings involve a scalar cost, distances, or a probability normalization. The formulas, assumptions, and inferential claims remain different.
1. Energy as an Unnormalized Probability Model
Energy-Based Model
An energy-based model (EBM) specifies a scalar function and defines
Lower energy gives larger density relative to other points. The partition function makes the density integrate to one.
Positive Densities Admit an Energy Representation
Statement
For any constant , define
Then with . Conversely, any finite energy with finite positive partition function defines a density that is strictly positive almost everywhere on the support of the base measure.
Intuition
Taking a negative logarithm converts relative probability into an additive cost. Adding the same constant to every energy changes but leaves the normalized density unchanged.
Proof Sketch
Substitute : . Integrating gives , so division by returns .
Why It Matters
The representation is algebraically broad, but training methods are not. Writing a density in energy form does not make a GAN objective, VAE objective, or flow likelihood into the same learning algorithm as an unnormalized EBM.
Failure Mode
If on part of the space, the corresponding energy is there. If diverges, the proposed energy does not define a probability density.
For a differentiable continuous EBM,
because the partition function does not depend on . This relation connects EBMs to score matching, diffusion models, and Langevin sampling. It is a relation between gradients, not a claim that all those methods use one objective.
2. Two Meanings of Free Energy
Log-partition or Helmholtz free energy
With inverse temperature ,
At , many ML treatments use . This is a property of the unnormalized energy function together with its base measure: is the normalizer required to obtain the probability model. Sign and temperature conventions vary, so check the definition before comparing papers. In equilibrium thermodynamics, Helmholtz free energy is also a macroscopic state function with a work interpretation; this page uses the probabilistic identity.
Variational free energy
For observed , latent , joint model , and a trial distribution , define
Therefore
with equality exactly when almost everywhere. Under the usual maximization convention, is the negative ELBO.
These free energies are related by variational identities, but they should not be substituted for one another without specifying the model, temperature, and optimization variable.
Free energy is not one universal loss
The VAE variational free energy is exactly a negative ELBO. An EBM's log-partition free energy is a normalization quantity. Normalizing flows use change-of-variables likelihoods, flow matching uses vector-field regression, and Schrödinger bridges use path-space KL control. Thermodynamic language can compare their tradeoffs, but it does not turn them into one objective.
3. Energy as a Distance Between Distributions
Let and be independent, and let be a semimetric of strong negative type with finite first moments. Define
Then , and under the stated condition, exactly when .
This is energy distance. It compares cross-sample distances with within-sample distances. There is no energy function , no partition function, and no Boltzmann density.
Energy distance can still be used as an objective for fitting a parameterized generator. That use does not by itself make the generator an energy-based model: the fitted model need not assign a scalar energy to each configuration or define a density through a partition function.
The name comes from generalized potential-energy constructions in the energy-statistics literature. The displayed formula is not Newtonian potential energy and should be interpreted by its statistical definition. The full page develops its sample estimators, permutation test, connection to maximum mean discrepancy, and dependence analogue.
Energy distance is not Wasserstein distance
Wasserstein distance minimizes expected transport cost over couplings between and . Energy distance combines independent cross-distances and within-distribution distances. Both compare probability laws through a ground metric, but their geometry and estimators are different.
4. Energy Score Versus Classifier Energy
Two ML quantities called an energy score are unrelated.
For a predictive distribution on , observation , and independent , the standard energy score in loss orientation is
Lower is better. If the true distribution is , the expected excess score from reporting rather than is
This identity connects a proper forecast score to energy distance. The broader energy-score family replaces each norm by its power for . In one dimension, the member equals the continuous ranked probability score.
For classifier logits , an OOD method instead defines
That scalar is useful for ranking inputs, but it is not the multivariate proper energy score above.
5. Potential Energy in Langevin Methods
Overdamped Langevin dynamics often appears as
Under suitable regularity and integrability conditions, its stationary density is proportional to . Here is a potential, so the connection to the Section 1 EBM target is exact when up to an additive constant. In particular, when . The stochastic differential equation is still a sampling or dynamics method, not a two-sample statistic. This stationary-law statement is about the continuous-time process. An unadjusted finite-step discretization generally introduces bias unless an appropriate limit or correction is used.
6. Literal Energy Use
In systems work, energy means physical energy consumed. For computing systems, this is usually estimated from electrical energy input and reported in joules or kilowatt-hours. That estimate needs hardware power, utilization, duration, datacenter overhead, and regional generation data. A parameter count or floating-point-operation estimate alone does not determine electrical energy use.
This meaning has no mathematical dependence on energy distance or an EBM energy function. The shared word is historical and analogical. See Energy Efficiency and Green AI for measurement, carbon accounting, and efficiency methods.
A Reliable Reading Rule
When a paper uses energy, ask four questions:
- What are the inputs? A configuration, a probability distribution, two samples, a forecast and outcome, a stochastic path, or a hardware meter?
- What is the output? A scalar score, normalized density, discrepancy, test statistic, objective, or physical quantity?
- What makes zero or a minimum meaningful? Equality of distributions, independence, a posterior match, a likely configuration, or lower power draw?
- What assumptions carry the claim? Finite partition function, finite moments, strong negative type, exchangeability, stationarity, or calibrated measurement?
Those questions disambiguate the term faster than relying on the surrounding thermodynamic vocabulary.
Common Confusions
Any density can be written as an energy, but not every training method is EBM training
The negative-log representation is an algebraic fact about positive densities. EBM training usually means learning an unnormalized scalar energy while handling or avoiding an intractable partition function. GANs, VAEs, flows, and diffusion models have distinct objectives and computational problems.
A zero sample statistic is not a population theorem
The statement concerns the population distance under its assumptions. A finite-sample estimator can equal zero by chance, and an unbiased estimator can even be negative. Inference requires a null calibration such as a permutation test.
Thermodynamic terminology does not supply missing assumptions
Words such as energy, entropy, temperature, and free energy can expose useful mathematical structure. They do not by themselves prove normalization, convergence, calibration, or equality of objectives.
Exercises
Problem
Classify each object: (a) , (b) , and (c) .
Problem
Let be a strictly positive normalized density and define . Show that every gives the same normalized density, and compute the corresponding partition function.
References
Energy-based models and score matching:
- LeCun, Chopra, Hadsell, Ranzato, and Huang, "A Tutorial on Energy-Based Learning" (2006), Sections 2 and 3.
- Hyvärinen, "Estimation of Non-Normalized Statistical Models by Score Matching" (Journal of Machine Learning Research, 2005), Sections 2 and 3.
- Song and Ermon, "Generative Modeling by Estimating Gradients of the Data Distribution" (NeurIPS, 2019), Sections 2 and 3.
Energy statistics and scoring rules:
- Székely and Rizzo, "Energy Statistics: A Class of Statistics Based on Distances" (Journal of Statistical Planning and Inference, 2013), Sections 2 through 4. DOI: 10.1016/j.jspi.2013.03.018.
- Sejdinovic, Sriperumbudur, Gretton, and Fukumizu, "Equivalence of Distance- Based and RKHS-Based Statistics in Hypothesis Testing" (Annals of Statistics, 2013), Theorem 22.
- Gneiting and Raftery, "Strictly Proper Scoring Rules, Prediction, and Estimation" (Journal of the American Statistical Association, 2007), Section 4.3.
- Liu, Wang, Owens, and Li, "Energy-Based Out-of-Distribution Detection" (NeurIPS, 2020), Sections 2 and 3.
Free energy and stochastic dynamics:
- Pathria and Beale, Statistical Mechanics (3rd ed., 2011), Chapter 3.
- Jordan, Ghahramani, Jaakkola, and Saul, "An Introduction to Variational Methods for Graphical Models" (Machine Learning, 1999), Sections 2 and 3.
- Risken, The Fokker-Planck Equation (2nd ed., 1989), Chapters 4 and 5.
Next Topics
- Energy-Based Models: energy functions, partition functions, score matching, and sampling.
- Energy Distance and Distance Covariance: distribution comparison and nonlinear dependence from pairwise distances.
Last reviewed: July 26, 2026
Canonical graph
Required before and derived from this topic
These links come from prerequisite edges in the curriculum graph. Editorial suggestions are shown here only when the target page also cites this page as a prerequisite.
Required prerequisites
2- Common Probability Distributionslayer 0A · tier 1
- Distance Metrics Comparedlayer 1 · tier 2
Derived topics
2- Energy Distance and Distance Covariancelayer 3 · tier 2
- Energy-Based Modelslayer 3 · tier 3
Graph-backed continuations