Variational Free Energy
Variational free energy is the central quantity in variational Bayesian inference — and, by extension, in the Free Energy Principle's account of biological self-organization. It is a measure of the discrepancy between an approximate probability distribution and the true posterior distribution over hidden variables, given observed data. Minimizing variational free energy produces the best tractable approximation to exact Bayesian inference, while simultaneously placing a lower bound on the log-evidence of the model.
Formally, for a generative model p(x,z) with observed data x and latent variables z, the variational free energy F[q] with respect to an approximate posterior q(z) is:
F[q] = E_q[log q(z)] - E_q[log p(x,z)]
where E_q denotes expectation under q(z). The first term is the negative entropy of the approximate posterior — a measure of its spread. The second term is the expected log-joint under the approximation — a measure of how well the model explains the data averaged over the approximate posterior. This decomposition makes visible the two forces that variational inference balances: the drive to match the true posterior (accuracy) and the drive to keep the approximation simple (compression).
The Free Energy Decomposition
The variational free energy can be rewritten in a more revealing form using the Kullback-Leibler divergence:
F[q] = D_KL(q(z) || p(z|x)) - log p(x)
This shows that variational free energy is the sum of two non-negative terms: the KL divergence between the approximate and true posteriors (always non-negative, zero only when q = p), and the negative log-evidence (or surprisal) of the data. Since log p(x) is fixed, minimizing F[q] is equivalent to minimizing the KL divergence between q and the true posterior.
The second term, -log p(x), is the surprisal of the observed data under the model. A model that assigns low probability to the data it actually sees has high surprisal. The variational free energy is therefore an upper bound on surprisal: F[q] >= -log p(x), with equality only when the approximation is exact. This is why the FEP treats variational free energy minimization as a proxy for surprisal minimization — the organism cannot compute the true surprisal, but it can minimize a bound on it.
From Inference to Thermodynamics
The term "free energy" is not arbitrary. The mathematical structure of variational free energy is formally identical to the Helmholtz free energy of statistical mechanics:
F = U - TS
where U is the internal energy, T is temperature, and S is entropy. In the variational formulation, the expected log-joint E_q[log p(x,z)] plays the role of internal energy (the expected energy of the system under the distribution), and the entropy E_q[-log q(z)] plays the role of thermodynamic entropy. The "temperature" is absorbed into the units.
This parallel is not metaphorical. It is a formal identity that arises because both variational inference and statistical mechanics are instances of the same mathematical structure: constrained optimization over probability distributions. The Jensen's inequality that underlies the variational bound is the same inequality that underlies the convexity of thermodynamic free energy. The mean-field approximation in variational inference is the same mathematical move as the mean-field approximation in the Ising model. When the FEP claims that biological systems minimize variational free energy, it is claiming that they are performing a computation that is formally identical to the computation that maintains a ferromagnet's organization.
The Evidence Lower Bound
Because F[q] = -log p(x) + D_KL(q||p), and the KL divergence is non-negative, we have:
log p(x) >= E_q[log p(x,z)] - E_q[log q(z)]
The right-hand side is the evidence lower bound (ELBO), also called the negative variational free energy. Maximizing the ELBO is equivalent to minimizing the variational free energy. In machine learning, this is the standard optimization objective for variational Bayes methods.
The ELBO decomposes into two terms with intuitive meanings:
- Reconstruction term: E_q[log p(x|z)] — how well the model can reconstruct the data from the latent variables.
- Regularization term: D_KL(q(z) || p(z)) — how much the approximate posterior differs from the prior.
This decomposition makes explicit the trade-off that every inference system faces: explain the data well (high reconstruction) while staying close to prior expectations (low KL divergence). A system that overfits the data minimizes the reconstruction term but pays a penalty in the KL term. A system that ignores the data entirely minimizes the KL term but fails to explain anything. The variational free energy is the cost function that enforces this balance.
Variational Free Energy and the Brain
In the Free Energy Principle, the brain is treated as an inference engine that minimizes variational free energy by maintaining a generative model of its sensory environment. The approximate posterior q(z) is the brain's belief about the hidden causes of its sensations. The generative model p(x,z) encodes the brain's prior expectations about how causes generate sensory data.
This reframes perception as inference: the brain does not passively receive sensory data but actively constructs the most probable explanation for that data, subject to the constraint that the explanation must be consistent with prior expectations. The variational free energy is the cost of this construction — the price, in information-theoretic terms, of maintaining a coherent world-model.
The precision-weighting of prediction errors, discussed in precision-weighted prediction error, is the mechanism by which the brain adjusts the relative weight of the reconstruction term and the regularization term in the ELBO. High precision means the brain trusts its sensory data and downweights the prior; low precision means the brain trusts its prior and downweights the data. This is not an add-on to the variational framework; it is a direct consequence of the mathematics.
The active inference extension adds a second kind of minimization: the brain does not just minimize variational free energy given fixed observations, but also selects actions that minimize the expected variational free energy of future observations. This turns the inference engine into an agent: it does not just model the world; it acts on it in ways that keep its model accurate.
The Synthesizer's Claim
The variational free energy is not merely a technical device for approximate inference. It is the bridge between Bayesian statistics and thermodynamics, between information theory and biological self-organization, between what a system believes and what a system is. Every time a system minimizes variational free energy, it is doing two things at once: it is refining its model of the world, and it is performing a computation that is formally identical to the thermodynamic work that maintains a dissipative structure against entropy.
The critics of the FEP are right that the framework is general. But they are wrong that this generality makes it empty. The variational free energy is general because it captures a structure that is genuinely universal: the structure of any system that maintains its organization by modeling its environment. The question is not whether this structure is "real" — it is a mathematical theorem, not an empirical claim. The question is whether biological brains implement it. And the evidence that they do, while incomplete, is accumulating across neuroscience, psychiatry, and machine learning in ways that a merely descriptive framework could not predict.
Any theory of mind that ignores the variational structure of inference is not a theory of mind. It is a theory of behavior that has not yet noticed what behavior is optimizing.