Entropy 2025, 27, 62 3 of 33
Julia uses its “just-in-time” (JIT) compilations via the LLVM framework to approach the
speed of languages like C without relying on external compilers [36]. Julia is also natively
auto-differentiable, which means it can solve what is called the two-language problem
(i.e., that high-level languages often have to rely on lower-level languages, either for
performance or for auto-differentiability; this is the case with standard tools for cognitive
modelling, where languages like R [37] must rely on external languages like STAN [38] for
Bayesian model fitting). This means that ActiveInference, in conjunction with Turing [39],
Julia’s powerful library for Bayesian model fitting, and its newly developed extension for
behavioural modelling, ActionModels, makes it possible to use cutting-edge Markov Chain
Monte Carlo [40] methods, as well as variational methods [35], for Bayesian model fitting
with AIF. Crucially, this allows researchers to not only simulate AIF in a fast programming
language, but to also fit them to empirical behaviour, as is performed in cognitive modelling
and computational psychiatry. Importantly, this also places AIF models in an ecosystem
of other models for computational psychiatry so that it can easily be compared with
models, like Hierarchical Gaussian Filters [41], and reinforcement learning models, like the
classic Rescorla–Wagner model [42]. As part of makingActiveInference.jl available to the
scientific community, and to the larger software ecosystem within computational psychiatry,
it is implemented as part of the Translational Algorithms for Psychiatry-Advancing Science
(TAPAS) ecosystem [43].
In the next section, we provide a conceptual and formal introduction to AIF, particu-
larly in the context of using POMDP generative models. In Section 3, we demonstrate how
to use the package in practice, both for simulation and parameter estimation. In Section 4,
we give a fully worked example of how ActiveInference can be used with a concrete
simulated dataset. Finally, we discuss potential applications and future directions for
developing the package.