Hierarchical Gaussian Filters
- Hierarchical Gaussian Filters are hierarchical Bayesian models that employ recursive inference and message passing to quantify hidden states, volatility, and uncertainty.
- They use variational Bayes and nonlinear coupling techniques to update predictions and compute precision-weighted errors in discrete trial steps.
- Their modular architecture supports flexible implementations and computational phenotyping by dissociating value and volatility updates.
A Hierarchical Gaussian Filter (HGF) is a class of hierarchical Bayesian models used to describe the inference and learning processes underlying perception and adaptation. Originally developed in cognitive neuroscience, the HGF formalizes how agents recursively infer hidden states, their volatility, and uncertainty in generative environments. The generalized HGF expands the classical formulation to allow for nonlinear coupling between levels, enabling both volatility-driven and mean-driven learning, and supporting fully modular and flexible computational architectures for empirical data analysis (Weber et al., 2023).
1. Hierarchical Generative Structure
The generative model in the generalized HGF defines a hierarchy of hidden states, indexed by level and discrete trial :
- : first-level hidden state
- : second-level hidden state
- : top-level hidden state
Each state evolves according to a Gaussian random walk, whose drift (mean increment) and volatility (variance) are conditional on the previous states and parent nodes. For a child node at time , with value parents and volatility parents , the transition is:
where (tonic drift) and (tonic log-volatility) are node parameters, and control the influence of value or volatility coupling, and is a twice-differentiable, possibly nonlinear coupling function.
This structure accommodates a spectrum of models:
- Pure volatility-coupling (classical HGF):
- Pure value-coupling (predictive coding): constant, no volatility parents
- Arbitrary additive parent combinations
2. Variational Inference and Update Equations
Inference in the HGF proceeds via variational Bayes, employing a mean-field Gaussian approximation for each hidden node: , with and denoting mean and precision, respectively. Each node executes three generic steps on each trial:
- Prediction using priors and parents
- Update based on current evidence
- Computation of prediction error (PE) for propagation
For a child with parent (value coupling), the PE is
Parent updates via: where is the derivative of the coupling function.
For volatility parents, and
Updating level gives:
These analytic one-step updates encode hierarchical precision-weighted prediction error processing, critical both for computational modeling and interpretation of agent learning.
3. Nonlinear Coupling Extensions
The generalized HGF incorporates arbitrary twice-differentiable coupling functions for node-to-node interactions beyond standard linear forms.
- Value coupling: shifts the mean of child nodes (e.g., , a ReLU; thus gates learning such that updates occur only above threshold),
- Rate–state (volatility) coupling: directly modulates log-volatility of descendants.
For nonlinear coupling, the derivatives and enter into the update equations, adapting learning rates and message passing architecture accordingly. For instance, nonlinear gating introduces context-dependent “switching,” so that learning is active only under specific parental state conditions.
4. Relation to Predictive Coding and Message Passing
Both HGF and predictive coding instantiate hierarchical Bayesian belief updating with precision-weighted prediction errors; however, architectural and inferential differences exist:
| Predictive Coding | Hierarchical Gaussian Filter | |
|---|---|---|
| Temporal Mode | Continuous-time | Discrete one-step trial updates |
| PEs | Value prediction errors | Both value () and volatility () PEs |
| Dynamics | Means only or with gain | Means and precisions explicitly tracked at all levels |
| Hierarchy of Errors | Single, upward | Dual (value and volatility), modular message passing |
| Nonlinearity | Rare, implicit | Explicit through , , |
The generalized HGF extends predictive coding frameworks by introducing explicit volatility/precision updates, parallel error signals, and modular node-based architectures. Neurobiologically, this predicts an additional ascending information stream dedicated to transmitting dynamically updated precision estimates (Weber et al., 2023).
5. Unique Model Properties and Behavioral Implications
The generalized HGF posits several distinct predictions about learning and behavior:
- Agents concurrently infer hidden state, its volatility, and possibly observation noise, supporting three-way arbitration not accessible in single-level learning models.
- Nonlinear gating through implements context-sensitive switches in learning (e.g., blocking updates below state-dependent thresholds).
- Shared parents for multiple lower-level nodes facilitate the imposition of global versus local volatility estimates, which predicts cross-modal or cross-channel learning rate correlations.
- The architecture dissociates value PEs from volatility PEs, predicting separable EEG/MEG/fMRI observables for each error type.
- Individual variability in coupling parameters predicts subject-specific learning profiles, providing a basis for computational phenotyping in clinical populations, including autism and schizophrenia.
6. Modular Implementation and Practical Computation
The generalized HGF is organized as a node-based architecture:
- Node: Encapsulates one hidden state with its posterior , parenthood structure, and coupling type (value, volatility, or noise).
- Architecture construction: Define the directed graph of nodes, assign parameters , and specify initial priors.
- Run loop: Iterates over trials, with nodes updating their predictions, posteriors, and sending PE messages according to incoming and outgoing edges.
- Fitting: Parameters are typically estimated by either variational Bayes or MCMC, maximizing model evidence over the full agent and response model.
This modular, message-passing structure supports dynamic addition/removal of levels, flexible switching of nonlinear couplings, and easy introduction of noise-learning nodes without re-derivation of update rules. Example open-source implementations include pyhgf (Python), HierarchicalGaussianFiltering.jl (Julia), and prospective inclusion in the TAPAS toolbox (Weber et al., 2023).
7. References and Historical Development
The conceptual foundations of the HGF trace to Mathys et al. (2011, 2014). The generalized HGF and its formal message-passing architecture were established in Weber et al. (2023) (Weber et al., 2023). Related computational frameworks include predictive coding (Friston, 2005; Rao & Ballard, 1999). The generalized HGF unifies and extends both volatility-driven (classical HGF) and mean-driven (predictive coding) approaches, while providing a parameterized, modular, and computationally tractable framework for hierarchical Bayesian inference in complex environments.