Manuscript Offprint
arXiv:2610.30899Parameter Learning in Active Inference via Variational Message Passing
Benedikt Waldeck [0009-0001-5225-9933]
University of Modena and Reggio Emilia, Italy
Abstract. Active inference casts perception, learning and planning as variational inference, where the Expected Free Energy (EFE) defines the planning objective. Recent work showed that EFE minimization can be written as Variational Free Energy (VFE) minimization on a generative model augmented with epistemic priors, and that the resulting entropy-corrected objective is minimized by sum-product message passing (SP-MP) on modified factor functions. These formulations treat model uncertainty as inference over a finite set of known models. We extend them to planning during learning, where beliefs over the observation and transition parameters , are Dirichlet priors. Closed-form Dirichlet updates are usually obtained by a structured mean-field factorization between parameters and states, but under exactly that factorization the information-gain corrections vanish. We resolve this by giving every factor its own parameter prior, frozen during a rollout. Conjugacy then makes each factor belief a product of a marginal over the categorical variables and a one-step Bayes posterior of the parameters. This reintroduces the datum-dependent parameter posteriors that mean-field factorization destroys. We show that evaluating the epistemic priors under the resulting Bethe joint recovers the information gains. Stationarity of this single closed-form objective yields SP-MP whose factor functions are augmented by the information-gain weight. Experiments on two grid POMDPs, in which only a planner that learns the model finds the safe route, show that the method plans to efficiently learn and . It reaches the goal on every episode, whereas SP-MP planners with the same inference update plateau or take the risky route.
Keywords: Active Inference · Parameter Learning · Planning as Inference · Factor Graphs · Variational Inference
1 Introduction
Active inference casts perception, planning and learning as variational inference on a single generative model [3]. Its planning objective, the Expected Free Energy (EFE), decomposes into risk, ambiguity and novelty and thereby balances goal pursuit against epistemic exploration, but evaluating it by enumerating policies scales exponentially with the horizon [5]. De Vries et al. [14] showed that EFE
B. Waldeck
minimization can be reformulated as Variational Free Energy (VFE) minimization on a generative model augmented with epistemic priors. Nuijten et al. [13] showed that the augmented VFE equals the predictive VFE plus explicit entropy corrections, including the planning correction of Lázaro-Gredilla et al. [10]. They derived a message passing scheme in which each correction becomes a channel reparameterization of a factor function, so that EFE-based planning runs as sum-product message passing (SP-MP) on the original factor graph.
These formulations treat the model parameter as a single enumerable latent variable: they plan under uncertainty over a finite set of known models, not under uncertainty about the models themselves. Planning during Learning the observation model and the transition model conjugately, an agent that knows neither its sensors nor its actuators, is left open and poses a structural problem. Closed-form Dirichlet updates require a mean-field factorization between the parameter beliefs and the state-observation blocks, but under exactly that factorization every parameter-posterior contrast collapses, , and the novelty term that motivates parameter learning vanishes from the objective.
This paper resolves this problem within a single variational objective. We split into an observation block , a transition block , and an enumerable context , and extend the entropy-corrected formulation to conjugate learning of and . Our contributions are:
– We show that the channels of the entropy corrections need not be free variational parameters. Substituting them at their closed-form optima, the conditionals of q, and giving each factor a step-wise parameter prior frozen at the current belief, keeps every sum-product factor belief conjugate and preserves the local parameter–outcome joints that mean-field destroys. Under the resulting Bethe joint the objective is a single scalar over the discrete coordinates.
– We derive the resulting message passing scheme. Four epistemic priors recover the EFE with separate novelty terms for and and a salience term for . Stationarity yields belief propagation on the discrete graph with factor functions augmented with per-entry information-gain weights . The fixed-parameter scheme of [12, 13] is recovered in the point-mass limit.
– We validate the method on two grid POMDPs, in which only a planner that explores the model, finds the safe route. The EFE-planner learns and and reaches the goal on every episode, whereas SP-MP baselines plateau on parameter learning or take the risky routes. Enumerated EFE reproduces its behaviour, and ablations isolate the novelty terms as the drive.
Section 2 reviews the EFE and the Bethe free energy. Section 3 discusses related work. Section 4 derives the objective and the message passing scheme. Section 5 reports the experiments and Section 6 concludes.
2.1 Active Inference and the Expected Free Energy
We consider an agent that maintains a generative model predicting future observations, states and the consequences of actions over a planning horizon . For a discrete partially observable Markov decision process (POMDP) with hidden states , observations , actions and model parameters . We write this as a rollout model . To encode goals, the model is augmented with preference priors , over desired states and observations, which can be understood as exponentiated rewards [3].
Active inference selects actions by minimizing the Expected Free Energy (EFE), which scores a policy by the cost of its predicted trajectory and decomposes into three interpretable terms [3]. Per time step,
(1)
Risk penalizes deviation of the predicted states from the preferences, ambiguity penalizes states whose observations are uncertain, and novelty rewards states and observations that are informative about . In discrete active inference, policies (sequences of actions) are typically scored with (1) and selected in proportion to [5].
2.2 Variational Free Energy and Message Passing on Factor Graphs
Given a generative model , variational inference approximates its posterior by minimizing the Variational Free Energy (VFE) over a family of tractable distributions :
The generative model factorizes into local terms and can be represented as a Forney-style factor graph (FFG) [18], in which nodes represent factors , edges represent variables, and is the degree of edge . The Bethe approximation constrains to respect this structure: each node maintains a belief over its adjacent variables and each edge a singleton belief , with
so that the joint entropy is approximated by and the VFE reduces to the Bethe free energy
B. Waldeck
The beliefs must be normalized and locally consistent, so minimizing (4) is a constrained problem whose Lagrangian stationarity conditions yield message passing: sum-product message passing (belief propagation) under the consistency constraints alone, and Variational Message Passing (VMP) when node beliefs are further mean-field factorized [18].
3 Related Work
Planning-as-inference and active inference. Active inference inherits the planning-as-inference framework [1, 17, 9] and extends it by treating information gain as an intrinsic objective, so that the EFE combines pragmatic and epistemic value [6, 3]. Existing EFE planners employ specialized procedures: policy tree search [4], branching-time recursion [2], dynamic programming [16], or message passing on a generalized free energy [15] with a mutual-information term over future graph segments [8]; none minimizes a single variational objective over the whole graph.
EFE minimization as VFE minimization. Control-as-inference [7, 9] augments with preference priors and, where used, , giving a preference-biased model and the VFE . De Vries et al. [14] (Proposition 1) showed that further augmenting with epistemic priors makes this VFE equal to up to a complexity term. Nuijten et al. [13] showed that the augmented VFE can equivalently be written as plus explicit entropy corrections, one conditional-entropy term per prior: contributes and the observation-side priors contribute terms. Proper planning over policies requires one further planning correction , introduced by Lázaro-Gredilla et al. [10] as the correction that turns marginal inference into policy optimization [13].
Message passing realizations. The conditional entropies above are ratios of region beliefs and therefore not independent coordinates of the Bethe free energy. Nuijten et al. [12] attached the epistemic priors to a parameter-free model as extra factor nodes and resolved their circular dependence on q by alternating posterior and prior updates. Nuijten et al. [11] introduced region-extended coordinates and a single observation-side channel for , without the planning correction. Nuijten et al. [13] finally absorbed every correction, including the planning correction, into modified factor functions through channel reparameterization, recovering belief propagation, cross-entropy planning and full EFE-based planning as one family. The key identity of that construction is the variational characterization of conditional entropy (Gibbs' inequality),
with equality at the normalized channel . Treating each channel as a free variational parameter turns a single factor into a modified factor function, and the corrected Bethe objective is minimized by sum-product updates on those functions, jointly over beliefs and channels.
This paper. Every realization above assumes a single, enumerable , and carries the channels of (5) as free variational parameters. We instead let carry Dirichlet beliefs over the model parameters themselves, and substitute the channels at their closed-form optima, where conjugate factor beliefs supply the parameter–datum coupling that the channels would otherwise have to represent.
4 Methodology
4.1 Generative Model and Planning Problem
We consider a discrete-time POMDP with hidden states , actions , observations and an episode-level parameter in three blocks,
(6)
The context is Categorical and selects which of observation and transition matrices apply; represent those matrices, and , with one Dirichlet prior per column, and . Unknown means unlearned matrices; unknown means known matrices but an unknown context, the enumerable model variable of [13]. One draw of is shared by all factors. Goals enter as preference priors, giving the preference-biased model (Figure 1) with VFE ( unnormalized, so a divergence up to a constant).
The agent scores an action by the per-step EFE,
(7)
where abbreviates . The first term is risk plus ambiguity . The remaining terms contrast each block's cavity, the belief before the imagined datum, with its posterior, and are information gains. By the chain rule they split into the salience , which rewards resolving the context, and the novelties and , which reward learning the matrices. The planning problem is to find the policy that minimizes .
Two obstacles separate (7) from a message-passing algorithm. First, G contains the agent's own conditionals inside the logarithm, so it is not a VFE against any fixed model. Second, the novelties are mutual informations of local joints such as ; a family that factorizes the Dirichlet block away from the imagined datum, , has , yet this is exactly the factorization that structured mean-field uses to obtain Dirichlet conjugacy. Section 4.2 fixes the first, Section 4.3 the second.
B. Waldeck

Fig. 1. Frozen-parameter factor graph (Section 4.3). Squares: factors; edges: variables; =: equality nodes; filled squares: clamped data; : preferences. Left: the real slice carries the shared , and turns , , into the planning prior . Right: over the horizon each factor (factor functions (17)–(18)) owns a copy , with its own degree-two prior node (open, gray) frozen at resp. ; only is shared, through equality nodes.
4.2 From Expected to Variational Free Energy
Following [14, 13], we keep the objective and change the model: is augmented with epistemic priors, one for every factor of (7) that is not already part of ,
where denotes the entropy of a conditional as a function of and the conditional entropy. Each prior is the exponential of a local functional of , so is closed-form.
Corollary 1 (Epistemic priors for three parameter blocks; cf. [14], Prop. 1). Let be augmented with the priors (8)–(11) for . Then , where is the complexity of relative to (6).
Proof. See Appendix A.1.
The prior (11) is the transition-novelty prior, new relative to [13]. Proper planning over policies further requires the planning correction [10, 13], which cancels the reward that the VFE pays for action entropy. Evaluating for each prior (Appendix A.2) writes the EFE-based planning objective as the base VFE plus a per-step entropy correction,
(the subscript is the horizon) with
The factor two is no double count: the ambiguity prior (9) pays one unit of each observation-side gain through its -coupling and the novelty prior (10) a second, while the transition side has no ambiguity term (Appendix A.2). Message passing on now applies, provided that q retains the local joints that make the information gains in (12) nonzero.
4.3 Variational Family: Sum-Product Beliefs on the Frozen-Parameter Graph
Frozen-parameter graph. The agent plans with its current parameter posterior, so imagined observations in the rollout must not update it. On the graph of (6) this fails: the sum-product message from to a shared node, with the messages into the factor, is a mixture of monomials rather than a Dirichlet, so conjugacy is lost and imagined observations mix across the horizon. Both problems are resolved by a step-wise copy per observation factor with its own prior node carrying the current real-data belief, and likewise per (Figure 1; denote these beliefs, as opposed to the copy marginals). Setting a prior node to a belief makes a planning-time model, rebuilt each environment step, so the objective is single per planning call. Each copy has degree two, so the message into its factor is exactly and the return message reaches no other factor; the price is that novelty does not decay along the horizon, which replanning bounds (Appendix B.4). The finite is not copied: it is conjugate to any factor, and sharing it lets an early cue inform a distant step.
Factor beliefs are conjugate in closed form. A Bethe factor belief is the factor times its incoming messages, . For each context the likelihood is a monomial in one column of . Thus conjugacy applies entrywise, , with one count on entry of column and the posterior predictive likelihood (Appendix A.3). Hence, exactly,
with discrete marginal , and with the predictive likelihood of .
Coordinates and constraints. The free coordinates are the Bethe beliefs of the discrete graph over : the block beliefs and the singletons , subject to normalization and factor-to-singleton
B. Waldeck
consistency, with and , held fixed during planning. The - and -conditionals of the factor beliefs are not coordinates: any other choice raises the free energy of the region, so they are substituted out at the closed-form optima of (13) (Appendix A.3, Lemma 3). There are no channel constraints either: the channels of (5) are not coordinates but definitions .
Cavities and per-entry information gains. Novelty contrasts the posterior with the cavity , the same belief before the outcome is known,
a finite Dirichlet mixture, the only non-conjugate object in the construction. We project it onto with the expected fractional counts . It matches the mixture mean, is exact for one-hot , and is overconfident by (Appendix A.4). The per-entry gains are then closed-form Dirichlet–Dirichlet divergences,
with , and symmetrically with cavity and . Salience needs neither: is a stored axis, so is a mutual information of the finite array.
4.4 The Planning Objective in Closed Form
Combining the factor beliefs along their separators gives the Bethe joint of the frozen graph, , with exponents from the variable degrees (Appendix A.5). Its -free conditionals are the block conditionals and its , -conditionals the posteriors and cavities of (13)–(14), so every object in (8)–(11) is well-defined under .
Proposition 1 (Closed-form planning objective). Under the Bethe joint q: (i) in the base free energy the parameter entropy of each factor belief cancels per entry against its parameter energy, leaving the Bethe free energy of the discrete graph with predictive energies , (eq. (29)); (ii) the corrections (12) hold unchanged, with as in (15) and ; (iii) hence the planning objective is the closed-form functional
over the discrete coordinates alone, where collects the Bethe counting terms and the priors.
Algorithm 1 Conjugate planning and learning. Inputs: counts , beliefs , horizon , damping , tolerance , sweep budget .
1: repeat 2: and one-count posteriors from 3: 4: for do 5: factor functions ; forward-backward pass 6: refresh , and the weights , damped by 7: evaluate ; break if 8: end for 9: execute ; observe ; filter ; by exact Bayes 10: under ; 11: until episode ends
Proof. See Appendix A.5.
4.5 Stationarity Conditions and Message Passing
Since has Bethe form over the discrete coordinates, its stationarity conditions under the normalization and consistency multipliers (Appendix B.1) yield sum-product message updates. Two facts make the variation local and term-by-term (Appendix B.2): entropies of conditionals of a normalized joint differentiate as if the logarithm were frozen (Lemma 4), and the dependence of the cavity on contributes nothing, (Lemma 5).
Proposition 2 (Modified factor functions). At stationarity and , up to the singleton multipliers fixed in Appendix B.2, with the factor functions
evaluated at the self-consistent conditionals of the block beliefs.
Proof. See Appendix B.2, which also fixes the multipliers from the singleton stationarity conditions.
The factor functions (17)–(18) are the pair (13a)–(13b) of [13] with the point likelihood replaced by the predictive likelihood and an information-gain weight , appended. The weights are not imposed, but emerge from the variation of the information gains.
Algorithm, learning and the fixed-parameter limit. With lagged by one sweep, as for the channels of [13], Proposition 2 is a standard Bethe belief propagation problem on the discrete graph over with factor functions (17)–(18). Algorithm 1 solves it with closed-form updates (Appendix B.3–B.4); the
B. Waldeck
copies exchange no messages, so the cost is independent of the size of the Dirichlet parameter space. Because depends on and the lagged is self-consistent only at convergence, is monitored rather than assumed to descend. The count update is the plain conjugate one: exact stationarity of in adds only a centered score that shifts no count mass (Remark 2). As the weights vanish, , and (17)–(18) reduce to the fixed-parameter EFE factor functions of [12, 13] with their enumerable read as ; removes the context (Section 5).
5 Experiments
We test whether the information-gain corrections of (16) produce exploration that a preference-driven planner does not, on two grid POMDPs where knowing the model changes the route and exploration is survivable. Everything outside the objective is shared: the conjugate graph of Section 4 with K = 1, the exact filter and count update of Algorithm 1, a terminal preference on the goal, and identical horizons, sweeps and flat Dirichlet priors on the unknown block (details in Appendix C).
Methods. SP-EFE is the full scheme with the factor functions (17)–(18). SP-Pref-Plan keeps only the planning correction (uniform channels, ). SP-Pref drops the planning correction too. Both are blind to in planning, since their observation-to-state message is , and reach an unknown transition only through posterior-mean optimism. Four ablations drop terms of (16) from SP-EFE: SP-EFE (no dynamics channel), SP-EFE , and SP-EFE with and without the channel (ambiguity, no novelty). Random acts uniformly while learning; EFE enumerates the policies under the exact (7).
Learning the observation model (fog-walls). In the fog-walls maze (Figure 2a) the direct 4-step route crosses a drift cell and an ambiguous fog block, whereas the 8-step top row identifies every state; walls make mislocalization cost bumps rather than the episode. The top row pays off only for a planner that knows it is unambiguous: with A, B known, SP-EFE takes it on 30/30 seeds, whereas SP-Pref-Plan, whose route is A-independent, enters the fog and scores 18/30 (Appendix C.2). When learning A (Figure 2b–c, Table 1), SP-EFE reaches a goal rate of 1.00 from episode ≈30 on every seed, while SP-Pref-Plan plateaus at 0.81 and SP-Pref at 0.48 with 1.4–1.9× the matrix error: by construction, learning cannot change their route. The curve of SP-EFE is a novelty phase followed by a switch: under the flat prior every cell is equally novel, so the agent enters the fog. Once is maximal in the fog and near zero elsewhere, ambiguity reroutes the plan along a deterministic row and the diminished no longer pulls it back.
Code: https://github.com/skoghoern/sp-efe-parameter-learning
(a) fog-walls: learn

(b) goal rate
(c) matrix error
(d) detour: learn
(e) goal rate
(f) route taken
SP-EFE SP-EFE-dyn SP-EFE- SP-Pref-Plan SP-Pref … Random
fog: uniform A (a) noisy A (a) ice: G w.p. p = 0.5 (d) wall safe/informative route
drift cell (a) unknown B columns (d) dead end w.p. 1-p (d) goal G -- short risky route
Fig. 2. Top (a–c): learning on fog-walls (B known, , 5 seeds); bottom (d–f): learning on the unmapped detour (identity , , , 3 seeds). Curves are trailing means with a std band over seeds; the glyph legend gives the cell and route vocabulary of (a) and (d).
Learning the transition model (unmapped detour). The unmapped detour (Figure 2d) caps a planner that never learns at p = 0.5, and optimism is priced out by design: a flat column spreads the successor over all N = 20 cells, which reaches the goal within the horizon with probability , so under its own objective SP-Pref-Plan should gamble. Table 1 reports three scenarios. With B known, every SP-EFE variant and SP-Pref-Plan take the detour on 300/300 episodes, so learning is sufficient; SP-Pref gambles even with a perfect model (Appendix C.2). With B frozen at the prior, SP-Pref-Plan sits at and never opens a door, so learning is necessary. When learning B, SP-EFE takes the detour from episode 1 and never leaves it, whereas SP-Pref-Plan gambles on all 300 episodes and ends equal to its prior. SP-Pref walks the detour only while the smeared doors still pay its action-entropy bonus, then gambles for the remaining 275 episodes: a better model removes the only term that steered it to the safe route. Enumerated EFE takes the detour on 100/100 episodes, so the exploration is a property of the objective, not of the message passing.
Ablation. The lower block of Table 1 removes terms of (16). Novelty is the drive. Without , the channels-only planner keeps the ambiguity penalty but has nothing that rewards resolving it; from a flat prior every unvisited cell is maximally ambiguous (log 25 nats per step against a preference of 4), and the agent bumps into the wall beside the start on all 500 episodes. Without , the learned-B score is carried by the dynamics channel, which the frozen column exposes as entropy-following. The dynamics channel is dispensable. Removing it changes nothing on fog-walls and costs two episodes on the detour; at its fixed
B. Waldeck
Table 1. Results and ablation. Fog-walls, learning (100 episodes, 5 seeds): goals, goals in the last 20, final matrix error. Unmapped detour, learning (300 episodes, 3 seeds): goals with known, frozen at the prior, or learned, and learned- goals via the detour. Lower block: ablations of (16). Entropy-following: with frozen flat doors, the most uncertain column and the detour coincide.
| Planner | fog-walls, learn | unmapped detour, learn | |||||
|---|---|---|---|---|---|---|---|
| goals/100 | last 20 | known | frozen | learned | detour | ||
| SP-EFE | 95.8 ± 0.7 | 20.0 | 0.026 | 300 | 300 | 300 | |
| SP-Pref-Plan | 81.4 ± 4.8 | 16.2 | 0.037 | 300 | 146 | 146 ± 7 | 0 |
| SP-Pref | 47.4 ± 3.1 | 9.6 | 0.049 | 146 | 158 ± 8 | 25 | |
| Random | 1.0 ± 0.9 | 0.2 | 0.038 | 1 | 1 | 1.3 ± 0.5 | 0 |
| SP-EFE | 94.4 ± 2.0 | 20.0 | 0.026 | 300 | 0 | 298 | 298 |
| SP-EFE | 94.4 ± 2.2 | 20.0 | 0.025 | 300 | 300 | 300 | |
| SP-EFE | 0.0 ± 0.0 | 0.0 | 0.071 | 300 | 300 | 300 | |
| SP-EFE | 0.0 ± 0.0 | 0.0 | 0.071 | 300 | 146 | 146 ± 7 | 0 |
point the channel cancels on its support, so a smeared learned loses the exploitation signal.
6 Conclusion
This paper extended entropy-corrected EFE-based planning [13] from inference over a finite set of known models to conjugate learning of the observation and transition matrices, as the minimization of a single variational objective. Frozen per-factor priors keep every factor belief conjugate and preserve the parameter–datum joint that mean-field destroys. Thus the parameter side collapses into predictive likelihoods, while the information gains survive as weights on the factor functions. On two grid POMDPs those weights are the drive: the scheme learns or and settles on the safe route where SP-MP with the same inference update plateaus or gambles.
Limitations and future work. The empirical advantage has conditions, all visible in the designs of Section 5: exploration must be survivable, the unknown region small enough for novelty to satiate, and model knowledge must change the route, since greedy optimism already wins on a unique-path task with a hard deadline. The objective is non-convex and the factor functions are built from lagged factors, so damped descent need not be monotone and measures deviations without certifying convergence. Future work includes score-corrected learning, and sophisticated planning beyond the frozen parameter priors.
Disclosure of Interests. The authors have no competing interests to declare that are relevant to the content of this article.
Bibliography
[1] Attias, H.: Planning by probabilistic inference. In: International Workshop on Artificial Intelligence and Statistics (AISTATS). pp. 9–16. PMLR (2003)
[2] Champion, T., Da Costa, L., Bowman, H., Grzes, M.: Branching time active inference: The theory and its generality. Neural Networks 151, 295–316 (2022). https://doi.org/10.1016/j.neunet.2022.03.036
[3] Da Costa, L., Parr, T., Sajid, N., Veselic, S., Neacsu, V., Friston, K.: Active inference on discrete state-spaces: A synthesis. Journal of Mathematical Psychology 99, 102447 (Dec 2020). https://doi.org/10.1016/j.jmp.2020.102447, http://dx.doi.org/10.1016/j.jmp.2020.102447
[4] Friston, K., Da Costa, L., Hafner, D., Hesp, C., Parr, T.: Sophisticated inference. Neural Computation 33(3), 713–763 (2021). https://doi.org/10.1162/neco_a_01351
[5] Friston, K., FitzGerald, T., Rigoli, F., Schwartenbeck, P., O'Doherty, J., Pezzulo, G.: Active inference and learning. Neuroscience & Biobehavioral Reviews 68, 862–879 (2016). https://doi.org/10.1016/j.neubiorev.2016.06.022
[6] Friston, K., Rigoli, F., Ognibene, D., Mathys, C., Fitzgerald, T., Pezzulo, G.: Active inference and epistemic value. Cognitive Neuroscience 6(4), 187–214 (2015). https://doi.org/10.1080/17588928.2015.1020053
[7] Kappen, H.J., Gómez, V., Opper, M.: Optimal control as a graphical model inference problem. Machine Learning 87(2), 159–182 (2012). https://doi.org/10.1007/s10994-012-5278-7
[8] van de Laar, T., Koudahl, M., de Vries, B.: Realizing synthetic active inference agents, part ii: Variational message updates. Neural Computation 37(1), 38–75 (2024)
[9] Levine, S.: Reinforcement learning and control as probabilistic inference: Tutorial and review. arXiv preprint arXiv:1805.00909 (2018)
[10] Lázaro-Gredilla, M., Ku, L.Y., Murphy, K.P., George, D.: What type of inference is planning? In: Advances in Neural Information Processing Systems 37 (NeurIPS 2024) (2024)
[11] Nuijten, W.W.L., Lukashchuk, M.: Active inference is a subtype of variational inference. In: EurIPS Workshop on Epistemic Intelligence in Machine Learning (nov 2025)
[12] Nuijten, W.W.L., Lukashchuk, M., van de Laar, T., de Vries, B.: A message passing realization of expected free energy minimization. In: International Workshop on Active Inference (IWAI) (oct 2025)
[13] Nuijten, W.W.L., Lukashchuk, M., van de Laar, T., de Vries, B.: What type of inference is active inference? In: Perković, E., Malinsky, D. (eds.) Proceedings of the 42nd Conference on Uncertainty in Artificial Intelligence. Proceedings of Machine Learning Research, vol. 337, pp. 5003–5039. PMLR (17–21 Aug 2026), https://proceedings.mlr.press/v337/nuijten26a.html
B. Waldeck
[14] Nuijten, W.W.L., van de Laar, T., de Vries, B.: Expected Free Energy-based Planning as Variational Inference. Transactions on Machine Learning Research (2026), https://openreview.net/forum?id=Kzm8I1oS1s
[15] Parr, T., Friston, K.J.: Generalised free energy and active inference. Biological Cybernetics 113(5), 495–513 (2019). https://doi.org/10.1007/s00422-019-00805-w
[16] Paul, A., Sajid, N., Da Costa, L., Razi, A.: On efficient computation in active inference. Expert Systems with Applications 253, 124315 (2024). https://doi.org/10.1016/j.eswa.2024.124315
[17] Toussaint, M.: Robot trajectory optimization using approximate inference. In: Proceedings of the 26th Annual International Conference on Machine Learning (ICML). pp. 1049–1056 (2009). https://doi.org/10.1145/1553374.1553508
[18] Şenöz, I., van de Laar, T., Bagaev, D., de Vries, B.: Variational message passing and local constraint manipulation in factor graphs. Entropy 23(7), 807 (jun 2021). https://doi.org/10.3390/e23070807, https://doi.org/10.3390/e23070807
A The Objective: Proofs and Constructions
Notation: , , ; is the entropy of a conditional as a function of and the conditional-entropy scalar; with has density . Time indices are suppressed where no confusion arises.
A.1 Epistemic Priors Recover the EFE
Lemma 1 (Prior contributions). For the priors (8)–(11) and any joint q possessing the conditionals they refer to,
up to the normalizing constants of the priors.
Proof. Each prior is the exponential of a functional of the variables it is indexed by; taking –log and the outer expectation over those variables gives the stated quantity by definition. For (19), ; for (20), ; for (21), is the conditional mutual information written as an expected divergence between posterior and cavity, and the chain rule gives the split into salience and novelty of Section 4.1; likewise (22) with as the datum and as the conditioning variables.
Proof (of Corollary 1). Split into the unbiased model, the goals and the epistemic priors,
By Lemma 1,
(24)
Expanding (7) and taking ,
(25)
B. Waldeck
which coincides with the -th summand above whenever . For the factor beliefs of Section 4.3, , so the identity is exact for uniform (the setting of Section 5); in general the ambiguity term of is to be read as , the entropy of the agent's own predictive observation channel, as in [13]. Summing over gives the Corollary.
A.2 Entropy Corrections
Adding the planning correction [10] to the sum of (19)–(22) gives the raw per-step correction
The identity turns (26) into (12): the ambiguity prior contributes one unit of each observation-side gain through its -coupling, the novelty prior a second. Under any family with the Dirichlet gain vanishes identically and prior (10) retains only its salience part; the same holds for and (11).
A.3 The Conjugate Factor Belief
Lemma 2 (Entrywise conjugacy). For one column and any entry , .
Proof.
and . Other columns are untouched.
Applied, for each value of , to the factor belief of Section 4.3,
this gives (13). The identity needs two things: the message into the copy must be free of —true because the copy has degree two and its other neighbor is the prior node—and the factor function must be a monomial in for each value of . A -conditioned channel inside the factor function, such as with the shared parameter of [13] read as , has a normalizer that is not polynomial in and would destroy the identity; this is why the -epistemic content enters the factor function as a scalar weight per discrete entry, while the finite retains the channel form (Proposition 2).
Lemma 3 (Elimination of the -conditional). Let the observation region carry the belief for an arbitrary normalized , and let the copy’s prior region carry the induced marginal . Their joint contribution to the Bethe free energy of the frozen graph is
minimized uniquely at .
Proof. The copy has degree two, so its region term and its counting term combine to . Adding the observation region and using ,
and Lemma 2 rewrites the denominator as .
A coordinate whose optimum is a closed-form function of the others is substituted out; it is also not storable, being continuous. Two consequences. First, the parameter energy and entropy of the region collapse jointly into the predictive energy ; nothing -dependent survives in the base free energy (used in Appendix A.5). Second, the corrections (12) are evaluated at and not re-minimized over : read as a functional of a free , would reward arbitrary coupling up to its ceiling . The dynamics side is identical with columns indexed by . The finite is treated differently: a free -axis on the discrete beliefs costs a factor and is kept, so its conditionals are exact and no projection is needed.
The step-wise copies are what make this consistent. A single shared would impose the calibration constraint for every , but equals only when , i.e. when planning leaves the block conditionals at their predictive values; enforcing it would write imagined counts into per sweep and eliminate novelty inside the planning loop. With step-wise copies the constraint holds trivially and the approximation moves out of the constraint set into the planning-time model.
A.4 The Cavity and Its Projection
Fix a column , write , , and let be the exact cavity (14). The projection has the following properties.
(i) Mean matching.
(ii) Geometric mixture. : the projection averages the branches' natural parameters. Equivalently , whereas .
B. Waldeck
(iii) Structured VMP. is what variational message passing returns on the -edge under : prior times [18]; the sum-product message gives the arithmetic mixture instead.
(iv) Not the M-projection. would match . The mixture carries between-branch variance that a single Dirichlet drops, , so is slightly overconfident and slightly overstated, with relative error that vanishes as counts grow.
(v) Exactness and closure. whenever is one-hot; stays Dirichlet under linear damping of ; and is closed-form in digamma and log-gamma functions.
The projection is used for the weight arrays only; the discrete messages close through without it. Its one side effect on the stationarity conditions is quantified in Lemma 5.
A.5 Proof of Proposition 1
Degrees and Bethe free energy. On the frozen graph, , , and every copy , have one non-singleton neighbor besides their prior or goal node; for has three , two, and all 2T. For a variable with non-singleton neighbors and singleton factor , the singleton region and the counting term combine to . Hence
(28)
and the same degree count gives the exponents of the Bethe joint of Section 4.4. Under the planning convention that is the current context belief, the terms are constants during planning.
(i) Base. Substitute (13), i.e. , into Lemma 3: the divergence term vanishes and the first two terms of (28) equal ;
likewise on the dynamics side with . Hence
(29)
Per entry the cancellation reads
(30)
which is Bayes’ rule integrated against itself. Because the copy’s prior node carries the current belief , there is no prior-mismatch residual to dispose of.
(ii) Corrections. Each copy lies in exactly one region of the Bethe joint, so the marginal of over is and over is ; on the chain the Bethe joint is a proper distribution with these marginals. Its -free conditionals are the block conditionals, , , , ; its -conditionals are and the cavity (14). Therefore , , likewise for , and (12) holds with every term read off and . Nothing is double-counted with (i): the information-gain mass in the -coupled energy is cancelled by (30) and never reaches .
(iii) Assembly. Adding (i) and (ii) gives (16), a functional of the discrete coordinates of Section 4.3 and the fixed counts only.
Remark 1 (Limits). At every Dirichlet posterior and cavity is , , , and (16) is the fixed-parameter EFE-planning objective of [13] with their read as . Deleting the correction line leaves belief propagation on the posterior predictive likelihoods. Both limits are approached continuously in the concentrations.
B Message-Passing Derivation
We derive the stationarity conditions of the planning objective (16) and solve them as message passing, following Appendix D of [13] with two structural differences: the Dirichlet copies are integrated out in closed form, so there are no , -messages, and the channels are conditionals of , so there are no channel variables or constraints. The context is a discrete variable of the graph and is treated exactly as the shared of [13].
B. Waldeck
B.1 Lagrangian
At the coordinates are , and the singletons ; the parameter beliefs , are fixed. With multipliers for normalization of the two blocks and for the seven factor-to-singleton consistency constraints,
where each consistency multiplier is a function of its variable, etc. Relative to [13] (their (D.3)–(D.7)), the four channel multipliers are absent and the -consistency multipliers refer to only. The corrections in are functionals of the coordinates through (13)–(14), cavities included.
B.2 Stationarity Conditions
Two lemmas make the variation of the corrections local.
Lemma 4 (Score lemma). For a normalized joint depending on a coordinate q, and any of its conditionals,
i.e. entropies of conditionals—and hence conditional mutual informations—differentiate as if the logarithm were frozen.
Proof. . The product-rule remainder is , since for every .
Lemma 5 (Cavity back-reaction vanishes). With independent of and the exact cavity ,
with no contribution from the dependence of on . Likewise .
Proof. Write
The explicit derivative is . Since equals , the implicit derivative through is
because is normalized for every q.
Under the cavity projection of Section 4.3 the weight in the integral is the exact mixture while the logarithm is that of , whose -derivative is ; the residual is therefore proportional to by concavity of , and is dropped. Only explicit appearances of survive, which is why the updates stay local and the mixture structure of the cavity never enters the messages.
Proposition 3 (Observation block). Varying (31) in : the base (29) gives ; gives and gives (Lemma 4); gives (Lemma 5); the multipliers give . Using , at stationarity
with .
Proposition 4 (Dynamics block). Varying in : the base gives ; gives ; gives ; gives . At stationarity,
with .
Propositions 3–4 are Proposition 2: the factor functions (13a)–(13b) of [13] with the point likelihood replaced by the posterior predictive likelihood and the
B. Waldeck
information-gain weights appended. Their observation factor function carries the ratio for the full ; with it factorizes as
(36)
since the second ratio equals by Bayes' rule. The finite factor is stored on the -axis and retains its channel form; the -dependent factor, not polynomial in , is replaced by its posterior expectation, a scalar per entry, as conjugacy requires (Appendix A.3). Because each correction is differentiated under the measure it is defined on, the weights have the form .
Singleton beliefs. has no singleton dependence, so as in [13] (D.4.6): for the degree-two variables the singleton entropy cancels against the counting term, and for the shared variables only the sum of multipliers is fixed,
(37)
Remark 2 (Parameter beliefs and the frozen-parameter update). During planning are frozen, so , the one-count posteriors and the weights depend on them only through the fixed concentrations, whereas is an ordinary singleton belief and moves within the sweep. Exact functional stationarity of in a free has two parts: the conjugate statistic (a Dirichlet count update) and a centered score under the reweighted block measure , which integrates to zero against and vanishes at point mass and as counts grow. The score would reshape toward parameter values of above-average posterior distinguishability without shifting count mass. Between environment steps we drop it and update the concentrations by the plain conjugate count update from the realized transition and observation,
(38)
with , now the (soft) realized data, the count distributed over contexts according to , which is itself updated by exact Bayes. This is a partial-gradient step of that preserves exact conjugacy, with the dropped terms exhibited; the score is worth including only if monitoring shows the plain step increasing .
B.3 Solving the Stationarity Equations as Message Passing
Given the factor functions (17)–(18) with lagged conditionals , Propositions 3–4 are an exact Bethe belief-propagation problem on the discrete graph over
[18], and the standard factor-to-variable rule applies,
Observation factor, writing for the messages into (with ):
(40)
Dynamics factor: analogously to , , , , each summing against the other three incoming messages, with and boundary . There are no messages to or from , . Block and singleton beliefs are
(41)
(42)
which at a fixed point recover (34)–(35) with (37). The full factor beliefs follow from (13), , and are never stored. The block-layer cost is independent of the size of the Dirichlet parameter space and linear in K.
Refresh. After each sweep, from the new block beliefs,
(43)
and likewise with fractional counts spread over the columns, so that the divergence carries cross-column terms. The factor functions are rebuilt immediately. Damping is applied linearly in , which keeps the cavity Dirichlet. Since no conditional is built from messages and the one-count posteriors never feed back into themselves, the divergent channel recursion of [13] is structurally absent.
Closed forms. With : ; ; the projected cavity is ; and for two Dirichlets on one column,
B. Waldeck
The salience is a finite sum over the stored array. (16) is assembled from quantities the sweep already computes and gives a stopping criterion on .
Schedule. Algorithm 1 of the main text, with the objects of this appendix in place: the predictive likelihoods and the one-count posteriors , are built once per planning call from the current counts; each sweep rebuilds the factor functions (17)–(18), runs one forward–backward pass of (39)–(42) over the chain, applies the refresh (43)–(44) and evaluates ; the policy is read from at convergence. is a monitoring quantity, not a certificate: block-coordinate descent on a non-convex functional with lagged factors is not guaranteed monotone, and period-two orbits appear as non-monotone , which is the criterion by which damping is selected. Uniform , zero weights and flat parameter beliefs recover plain belief propagation.
B.4 Generic Scheme for Arbitrary T
The corrections (12) are additive in t and every object of Section 4.3 is per-factor, so the family carries one block belief per factor, one shared context belief, and two global, frozen Dirichlet beliefs,
The one-count posteriors and , are time-independent; the cavities, lagged conditionals and weights are time-indexed. Lemmas 4–5 apply per step and give the factor functions (17)–(18) at every . The graph is the temporal chain of [13] with attached to every factor, so the sweep is loopy belief propagation as there: with state potential and context messages ,
with , , ; then , the block beliefs follow from (41) with , , , and from (42). At this reduces to (40)–(42). Because every copy is drawn i.i.d. from the same frozen , novelty is scored per factor against the same belief, with no within-horizon diminishing returns; replanning after every real step bounds this to one horizon, and the causal alternative (assumed-density filtering along the horizon) retains conjugacy but makes the posteriors and per-sweep objects. Salience has no such issue: is shared, so a cue at step updates for every step.
B.5 Limits
All Dirichlet-dependent quantities are available in closed form, so conjugacy is exact and the block-layer cost is independent of the Dirichlet parameter-space size. As , posterior and cavity coincide, both weights vanish pointwise, , and (17)–(18) become the EFE factor functions (13a)–(13b) of [12, 13] with their enumerable read as : inference over known models is the point-mass limit of learning matrix pairs. The approach is continuous, as counts grow. At the salience ratio is identically one and the scheme reduces to Dirichlet learning alone, the setting of Section 5. The two epistemic drives differ in scale: novelty is and vanishes as counts grow, salience is scale-free and vanishes only when is resolved; novelty couples no columns, salience couples all of them through the single shared .
C Experimental Details
C.1 Environments and Protocol
Shared protocol. Four cardinal moves (N, E, S, W; walls and grid edges bump), , one unknown block initialized as a flat Dirichlet with mass 0.1 per entry, the known block clamped by counts of times the true matrix. Every planner runs the same exact filter under the posterior-mean matrices and the count update of Algorithm 1, line 10. Planning: 100 sweeps at damping 0.5, uniform , horizon at step of a T-step episode as in [12], argmax of ; counts persist across episodes, pose and belief reset, seeds are shared across planners. EFE enumerates the open-loop policies under and takes the argmax of , being the per-policy sum of (7).
Fog-walls maze. cells , upwards; start , goal . is the identity except on the fog block , , , , , whose columns are uniform over the block, and the noisy cell (mass 0.2 on itself, 0.8 over its neighbours). is deterministic except at the drift cell : intended move w.p. 0.4, north or south w.p. 0.3 each. Cells , , , are walls: the direct 4-step route crosses drift and fog, the 8-step top and bottom rows do not (the latter passes the noisy cell). ; episodes end at the goal. Learn-A: all 25 columns of flat, known; the matrix error is the mean of over all entries. This is the fog maze of [12] with its four sinks replaced by walls.
Unmapped detour, doors variant. grid ( ), start (0,1), goal (4,2), identity A, walls (1,2), (2,2), (3,2). The shortcut ends at the ice (4,1), whence NORTH reaches the goal w.p. and otherwise slips into the absorbing dead end (4,0). The detour is deterministic through (0,2), (0,3), (1,3), (2,3), (3,3), (4,3); exactly its six (cell, action) columns start
B. Waldeck
flat, the other actions at those cells (bumps or the step back) are known. , ; episodes end at the goal or the dead end, the last transition folded into the counts. Detour = goal reached with every visited cell on the detour; over the six door columns (prior value 0.095). Frozen keeps the door columns flat and never updates them; the cells variant flattens all four actions of the six cells.
C.2 Controls and Robustness
Fog-walls, A, B known (30 seeds). At every SP-EFE variant puts entirely on NORTH and takes the top row on 30/30 seeds; SP-Pref-Plan and SP-Pref (0.32) go into the fog and score 18/30 and 17/30: they plan as if they will know where they land, and the planning correction sharpens that commitment. At bumping after a wrong landing still reaches the goal and the ceiling closes to 29/30 (SP-Pref 22/30). The learn-A policies of SP-Pref(-Plan) equal their known-A policies: their goal rate is the luck of the drift, not a function of .
Unmapped detour. Known B: SP-Pref (q(EAST) = 0.30) takes the ice because the uncorrected Bethe term rewards states in which all actions look alike, which absorbing cells do: a sink costs nats per step instead of 4. Frozen B: SP-Pref-Plan gambles ( , zero door visits); SP-EFE farms the first door (0 goals: never decays); SP-EFE, SP-EFE and SP-Pref reach the goal via the detour on 300/300 episodes without learning: with frozen flat doors “most uncertain column” and “detour” are the same action at every cell, so any entropy follower is walked along the route ( in Table 1).
Robustness. Action indices permuted (W, S, E, N; 200 episodes): SP-EFE 198, SP-Pref 101 (25 detours, then the ice), SP-Pref-Plan 89. Mirrored layout, 7 doors, (300 episodes 3 seeds): SP-EFE 300, SP-EFE 299, SP-Pref , SP-Pref-Plan , EFE 100/100. Cells variant (200 episodes 5 seeds): SP-EFE 159, SP-Pref-Plan with bit-identical to its prior, SP-Pref 185 (off-path flat columns pay its bonus forever), SP-EFE 35.