This note is Lenticulum’s own contribution, not the paper’s. AutoBayes has one -valued energy. We keep two, and adapt the chain rule accordingly. Requested design constraint; here is the construction and its proof obligations.
Sources: original to this vault (design and analysis; no single paper). §6 and §8 compare with Karwowski, Nielsen & Staton, Compositional Information Geometry of Probabilistic Programs, arXiv:2610.17886, 2026 (Definition 19, Theorem 2, Proposition 8, Example 1), and Perrone, Markov Categories and Entropy, IEEE Trans. Inf. Theory 70(3), 2024 (Corollary 4.7). Decision: L-ADR-0003 Pointwise energy and free energy are separate levels.
Bibliography: Karwowski et al. 2026 · Perrone 2024
Theory (CT-ML wiki): Lax Functor · Bayesian Inversion · Statistical Game · Bayesian Lens · Variational Free Energy · Lens · Fisher Information Metric · Natural Gradient · Information Geometry of Probabilistic Programs · Entropy in a Markov Category
1. What the paper does, and what it costs
Definition 20 types the energy as
and Definition 22 composes it by addition:
That composition law is precisely the statement that is a commutative monoid and is monoid-valued. Fine — but addition is a lossy projection. The moment you add, you can no longer say:
- which factor contributed how much (per-factor loss attribution);
- in which coordinates a factor is wrong (the residual direction, not just its size);
- what the Jacobian of the residual is — and therefore no Gauss–Newton step, no Fisher metric, no implicit function theorem.
The last one is fatal for us, because Definition 27 explicitly says the default semantics is gradient descent with respect to the Fisher information metric, and because implicit inference is root-finding on a vector residual. Both need the vector.
2. Energy spaces
Definition (energy space). An energy space is a pair of a real topological vector space in which barycentres of the relevant measures exist, together with a closed convex cone with . induces the partial order . Energies take values in .
The direct sum is , with unit .
is the terminal-ish example. with (no order) or (componentwise) are the ones we use. The cone exists so that “energy is non-negative” still means something and so that monotonicity of scalarisations is expressible. A residual does not fit it: it is signed, and violates . §8 says what changes for such an energy.
Definition (scalarisation). A scalarisation of is a map with , , and monotone for . It is linear if (the dual cone), and convex otherwise.
Two scalarisations do all the work:
| reading | ||
|---|---|---|
| , | any | precision / temperature weighting; -VAE; the ‘s of ImplicitREDDiff |
| least squares on a residual; a precision matrix |
3. The multivariate statistical game
Definition (multivariate statistical game). A multivariate statistical game over an energy space consists of
- a Inversions and Bayesian Lenses ,
- a vector energy ,
- a vector entropy ,
- a scalarisation ,
with vector loss and scalar loss .
Note the entropy is promoted to as well. It must be: otherwise is a type error. In practice is usually for a fixed — the entropy is scalar but has to be told which coordinate it regularises. That is not busywork: it is what lets you regularise one block of a factor and not another.
Recovering the paper: take , , .
4. The adapted chain rule
Definition (composition). For over and over , the composite is over , with
The addition of Definition 22 has become a direct sum. That is the entire change. The entropy law is unchanged in shape — still averaged under the downstream inversion, still evaluated at the pushforward prior — it just lands in a summand instead of being added in.
Theorem (multivariate chain rule).
Proof. Expand, using linearity of and that the tuple’s components are independent:
which is the claim.
Compare Theorem 23: same recursion, with replaced by a pair. It is not a weaker theorem — it is the same theorem before the projection.
Graded by the graph
Iterating, a graph of factors has
The total energy of a factor graph is a vector indexed by its factors, and within each factor by that factor’s own residual coordinates. Per-factor loss attribution is not a feature bolted on for logging; it is what the composite loss is, before you collapse it.
5. How the two are related: scalarisation is lax
Proposition. Let as above.
- If is linear, then : the scalar chain rule of Theorem 23 holds exactly, and scalarisation is a strict morphism of games.
- If is convex, then , with
Proof. by definition of and the theorem above, while Theorem 23 gives . Subtract; the terms cancel; linearity gives equality and Jensen gives the inequality.
The only place the two chain rules can disagree is versus — i.e. the expectation over the downstream inversion. Nowhere else. That is a tight and checkable statement.
The gap, computed
For on the Jensen gap is exactly a variance:
So the multivariate composite is the squared mean residual and the scalar composite is the mean squared residual; the difference is the posterior variance of the upstream factor’s loss. This is a genuine bias/variance decomposition of the composite objective, and the variance term is a first-class diagnostic: how much does the downstream posterior disagree with itself about what the upstream factor should be doing?
This mirrors Remark 26 exactly
AutoBayes measures the laxness of the tensor by mutual information. We measure the laxness of scalarisation by a variance. Both are “the amount of structure destroyed by a projection, quantified”. Report them; do not hide them.
6. The gradient, adapted
For a parameterized multivariate game the derivative of is not a gradient but a Jacobian
and the scalar gradient is obtained by pulling back along the scalarisation’s differential:
For this is the familiar .
Composite. By the multivariate chain rule, and keeping only the terms Definition 29 keeps:
- — moves the sampling distribution;
- — moves the pushforward prior.
Definition 29 is the block-diagonal part. The laxness of the gradient assignment is unchanged by going multivariate; it is orthogonal to the scalarisation question. Good — the two approximations do not interact.
Why the Jacobian is the point
Once you have rather than only , you get for free:
- Gauss–Newton / Levenberg–Marquardt. , positive semidefinite by construction, no Hessian needed. alone cannot produce it — scalarising early destroys the metric, irrecoverably.
- The Fisher metric of Definition 27. When is the vector of per-component log-density contributions, its Jacobian is the score and . The natural gradient of the Bayesian learning rule is therefore available compositionally, from data the multivariate energy already carries. This is the strongest single argument for the design. “Compositionally” needs a caveat, which Karwowski, Nielsen & Staton make precise for probabilistic programs. There the metric of a composite is (their Proposition 8): the local Fisher metric plus the downstream metric pulled back, the same shape as the chain rule of §4. The assignment is a lax monoidal functor (Theorem 2), and it depends on how a model is presented, not only on the distribution it defines (Example 1: randomness that is drawn and discarded still adds Fisher information). See the CT-ML wiki’s Information Geometry of Probabilistic Programs. None of this is implemented here yet (LP-002 The Jacobian side is not implemented).
- The implicit function theorem. For a residual factor split by polarity into , which needs the square Jacobian block of the vector residual. A scalar energy cannot even express the shape requirement .
- Post-hoc reweighting. can be changed without recomposing the graph: -annealing, precision scheduling, curriculum weights, Pareto fronts. With the scalar energy each is a different graph.
7. Interface consequences
energyspace(f[, p]) # -> AbstractEnergySpace, the E_f of the free energy 𝐅
scalarisation(f[, p]) # -> AbstractScalarisation σ_f on E_f
pointwise_energyspace(f[, p]) # -> where `energy` lands; default energyspace(f)
pointwise_scalarisation(f[, p]) # -> its σ; default scalarisation(f)
energy(f, x, a, y, ps, st) # -> the pointwise vector 𝐥
entropy(f, π, y, ps, st) # -> the vector 𝐇, in E_f
scalarise(σ, e) # -> Real
islinear(σ) # -> Bool: strict vs lax composition (Prop. §5)
scalar_energy(f, x, a, y, ps, st; polarity, σ) # σ(𝐥), σ defaulting to the factor's
scalar_free_energy(f, π, y, ps, st; polarity, σ) # σ(𝐅)p is an optional polarity; without one, or for a factor that does not distinguish them, the
answer is the polarity-free one. The two levels and the polarity argument are §8.
islinear is not decoration: it is the trait that tells the composition machinery whether
scalarise ∘ compose == compose ∘ scalarise may be assumed, and therefore whether the
scalar loss can be accumulated eagerly (cheap) or must be deferred until the vector loss is
assembled (correct). See energy for the implementation and its difficulties.
A scalarisation is not a loss functional
σ : E_c → ℝtakes an energy value. LeCun’s loss functionals take the energy function over the whole answer space, because shaping a surface requires knowing what it does away from the correct answer. Lenticulum has no slot for one, and the consequence — its free energy is LeCun’s “energy loss”, the collapsing one — is Energy-Based Learning §3.
8. Choices, and where the theory forks
The definitions above leave several choices open. Each is a parameter of the interface rather than a decision taken once, and each has consequences, listed here with what checks them.
One space or two. AutoBayes has the energy, the entropy and the free energy in one space,
and §3 keeps that: . A
residual factor (GaussianFactor, LinearConstraintFactor, NonlinearFactor) has two levels
instead:
| level | value | space | scalarisation |
|---|---|---|---|
pointwise, energy | the residual | , signed | |
| free energy | (fit, complexity, negentropy) | graded | the identity on each summand |
They meet in the fit summand,
so : the free energy is
built from the scalarised pointwise energy, not from the vector. The vector stays available
for what needs it (§6: Jacobians, Gauss–Newton, the implicit function theorem). Tested: at a
point, scalar_energy equals the fit summand for all four of Lenticulum’s residual and
likelihood factors (test/runtests.jl, “pointwise energy and free energy: one contract”); the
identity with a covariance is “the two energies differ by exactly ½·tr(Q⁻¹ Cov r)“. The
interface keeps one space as the default (pointwise_energyspace(f) = energyspace(f)), so a
factor written against the paper needs neither.
A cone, or a minimum at zero. A residual has no cone. What replaces monotonicity is a gauge: with exactly at , so minimising the energy means bringing it to 0, coordinate signs irrelevant. Proposition §5 needs only that is linear or convex, not the cone, so strictness and the Jensen gap carry over; non-negativity holds for , not for .
Which scalarisation, and its parameters. A scalarisation is chosen like the of a norm:
the factor supplies a default (for a residual factor the metric , derived from the noise
model), and scalar_energy(...; σ) and scalar_free_energy(...; σ) take another. The forks:
- linear or convex — strict or lax composition, §5;
- the metric of — every positive definite has the same zeros, so the exact solutions of a consistent system do not depend on it; when the equations cannot all hold, decides the compromise (weighted least squares), and only a multiple of makes it the maximum-likelihood one;
- the weights of on a graded energy — annealing and curricula (§6, “Post-hoc reweighting”), changed without recomposing the graph.
- the risk measure, once the energy is uncertain — every scalarisation above takes an energy value; a belief over energies adds the expectation (today’s implicit choice), the entropic risk and CVaR, which differ most for heavy-tailed energies (Unusual Wirings §4, planned in L-SPEC-003 Exposed Parameters and Energy Channels §3).
Normalised or not. is zero at a perfect fit; the
negative log-density
is not. They differ by a constant while is fixed (the default). GaussianFactor and GaussianPrior now support
opt-in covariance learning (LP-005 Learning the noise covariance). Once
is learned, the constant matters: alone decreases as grows and drives ,
and the normaliser, which the free energy keeps as the complexity summand, is what penalises
that; so only the free energy is a valid objective. (At an exact fit it does not stop ;
that needs a prior on , LP-005 Learning the noise covariance.)
Relative to which measure. The free energies of continuous beliefs contain differential entropies, finite only relative to a reference measure (Lebesgue, in each variable’s coordinates). Intrinsically, the categorical KL entropy of every continuous distribution is infinite (Perrone, Corollary 4.7; the CT-ML wiki’s Entropy in a Markov Category). So free energies compare between models over the same coordinates, and a change of variables must add its log-Jacobian (LP-006 Gaussian entropies are relative to Lebesgue measure).
Per polarity. Every function above takes an optional polarity. For the factors that exist
the energies do not depend on it: a residual is the same whichever channels are unknown. What
does depend on it is the shape condition of the implicit function theorem,
(§6, “The implicit function theorem”): a LinearConstraintFactor with one-dimensional channels and a
one-dimensional residual supports exactly the polarities with one unknown. That a learned factor
trained in one direction should carry a different energy, or a different scalarisation, per
polarity is an expectation, not yet a case in the code.
Related: Factors are Parameterized Statistical Games, Composition of Statistical Games, Composition of Gradients, Implicit Learners, energy, Energy-Based Learning