pyhgf: A neural network library for predictive coding
Not on the map. Why?
Abstract (arXiv)
Bayesian models of cognition have gained considerable traction in computational neuroscience and psychiatry. Their scopes are now expected to expand rapidly to artificial intelligence, providing general inference frameworks to support embodied, adaptable, and energy-efficient autonomous agents. A central theory in this domain is predictive coding, which posits that learning and behaviour are driven by hierarchical probabilistic inferences about the causes of sensory inputs. Biological realism constrains these networks to rely on simple local computations in the form of precision-weighted predictions and prediction errors. This can make this framework highly efficient, but its implementation comes with unique challenges on the software development side. Embedding such models in standard neural network libraries often becomes limiting, as these libraries' compilation and differentiation backends can force a conceptual separation between optimization algorithms and the systems being optimized. This critically departs from other biological principles such as self-monitoring, self-organisation, cellular growth and functional plasticity. In this paper, we introduce textttpyhgf: a Python package backed by JAX and Rust for creating, manipulating and sampling dynamic networks for predictive coding. We improve over other frameworks by enclosing the network components as transparent, modular and malleable variables in the message-passing steps. The resulting graphs can implement arbitrary computational complexities as beliefs propagation. But the transparency of core variables can also translate into inference processes that leverage self-organisation principles, and express structure learning, meta-learning or causal discovery as the consequence of network structural adaptation to surprising inputs. The code, tutorials and documentation are hosted at: https://github.com/ilabcode/pyhgf.
Key facts. Cited by 2 papers in the map (data through 14 Oct 2026). Builds on 19 of its 66 references that are in the map. First posted on arXiv 11 Oct 2024.
Builds on
19 of 66 references.
References · 19
- 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,305
- 2019Fast Graph Representation Learning with PyTorch Geometriccited by 2,434
- 2017A Conceptual Introduction to Hamiltonian Monte Carlocited by 209
- 2016Deep Predictive Coding Networks for Video Prediction and Unsupervised Learningcited by 204
- 2023Efficient Guided Generation for Large Language Modelscited by 200
- 2021Equinox: neural networks in JAX via callable PyTrees and filtered transformationscited by 148
- 2020Acme: A Research Framework for Distributed Reinforcement Learningcited by 146
- 2015Practical Bayesian model evaluation using leave-one-out cross-validation and WAICcited by 110
- 2021Predictive Coding: a Theoretical and Experimental Reviewcited by 77
- 2022Predictive Coding: Towards a Future of Deep Learning beyond Backpropagation?cited by 45
- 2020The Neural Coding Framework for Learning Generative Modelscited by 44
- 2022Learning on Arbitrary Graph Topologies via Predictive Codingcited by 33
7 more
- 2024Benchmarking Predictive Coding Networks -- Made Simplecited by 30
- 2023Causal Reinforcement Learning: A Surveycited by 23
- 2021Predify: Augmenting deep neural networks with brain-inspired predictive coding dynamicscited by 19
- 2023Towards Self-Assembling Artificial Neural Networks through Neural Developmental Programscited by 17
- 2022Dendritic predictive coding: A theory of cortical computation with spiking neuronscited by 12
- 2024Predictive Coding Networks and Inference Learning: Tutorial and Surveycited by 7
- 2023The generalized Hierarchical Gaussian Filtercited by 3
Built on by
Citing papers per year: 2024: 1; 2025: 0; 2026: 1.
2 papers.