Active Inference, Julia, Active Inference Julia
Peter Thestrup Waade: Next step is that @AndriusKulikauskas (Math4Wisdom) finishes a first draft of the application. Then I think we should meet online and discuss next steps, but otherwise my team and @Daniel Friedman can finish the application
Andrius: I am preparing the proposal below to get European Union funding for ActiveInference.jl
NGI Zero Commons Fund Guide for Applicants
Deadline August 1, 2025.
Vision The enduring success of the Internet lies in permission-free innovation, openness and interoperability. The Next Generation Internet is set up to empower, to unlimit our choices. It fosters diversity and decentralisation, and grows the potential for disruptive innovation. This extends far beyond the technical realm. The Next Generation Internet will achieve a sustainably open environment for our cultures and economies, celebrating our values and promoting creativity and well-being. Let's re-invent Internet to reach the full human potential, for all generations.
- Projects should be in line with the NGI vision and the sub-granting call applied for.
- Projects should have research and development as their primary objective.
- Projects should satisfy any other hard eligibility criteria specific to the sub-granting call, such as having a clear European Dimension.
Projects receive an initial rating on three criteria:
- 30% Technical excellence/feasibility
- 40% Relevance/Impact/Strategic potential
- 30% Cost effectiveness/Value for money
The second stage is used to select strategic projects which not only satisfy the minimal criteria, but also have potentially a lasting impact on society. Projects are to be selected based on their potential contribution to the Next Generation Internet and its key drivers for change. In the second stage, the reviewers are able to ask additional clarifying questions and make (minor) suggestions to improve the quality and impact of the project.
- Project examples: Verticals + Search
- Project examples: Services + Applications
- Project examples: Data + AI
Application form Please be short and to the point in your answers; focus primarily on the what and how, not so much on the why. Add longer descriptions as attachments (see below). ... On the up side, you can be as technical as you need to be (but you don't have to). Do stay concrete.
Total length | 5 pages {$\leq 17,700$} characters |
Overview | 1/3 page {$\leq 1200$} characters |
Your relationship to the project | 2/3 page {$\leq 2500$} characters |
Budget | 2/3 page {$\leq 2500$} characters |
Compare your project with others | 1 1/3 page {$\leq 4000$} characters |
Technical challenges | 1 2/3 page {$\leq 5000$} characters |
Ecosystem | 2/3 page {$\leq 2500$} characters |
Proposal
Applicant Peter Thestrup Waade (Denmark)
My only concern is that my time is very limited in the next few months (handing in my dissertation in August), so I have pretty limited time resources for grant writing. In other words, I'd say this would only be possible if Andrius and/or others can lead the application writing - but then I would be very happy to contribute as much as I can! The same is true for the rest of my team 🙂
Proposal name
Modeling the Modelers and Computing the Computations with ActiveInference.jl
Website
Can you explain the whole project and its expected outcome(s). (1200 characters ~ 200 words)
The Active Inference community appreciates the significance of ActiveInference.jl for formulating, prototyping and computing Active Inference models in neuroscience, AI, robotics, psychiatry, psychology, biology and sociology. Adoption of our Julia library depends on clearly separating the modeling layer (what users need to know) from the computational layer (what they should not need to know). For our library to be trustworthy, the modeling layer must guide users through the step-by-step procedure worked out by Active Inference founder Karl Friston. For it to be resilient, key steps need to be recoded to unleash Julia's speed. For it to be sustainable, users, modelers, coders, both volunteers and professionals, need to discover each other, as we do through the Active Inference Institute, our home on the Internet, the hub of our ecosystem.
We will seed an online archive of projects, with 12 from users we help and 12 from authors of exemplary research papers. We will create a tutorial to walk users through model-based analysis. We will reorganize our code accordingly, rework key routines for speed, and add requested functionality.
Have you been involved with projects or organisations relevant to this project before? And if so, can you tell us a bit about your contributions? (2500 characters ~ 430 words)
@Samuel William Nehrer @Jonathan Ehrenreich Laursen welcome Sam and Jonathan are members of my team and have done most of the implementation of the package under my supervision. They are students, and will be doing their master's at ETH, Zürich @John Boik has recently joined the team and alreayd made invaluable contributions. He is part of the currently ongoing update also welcome to Aleks @sashapustota, who has worked on active inference and related Bayesian mind models, and who has agreed to help out with this application. It would be great to be able to hire him while he applies for his PhD - I trust his competence and his kindness too
Finally, Chris Mathys is the PI in our lab and has supervised the software development, and Dominik Firisz has recently joined the team too, and will aim at contributing to the package in the fall
Endorsed by
- Active Inference Institute
- Karl Friston
Requested Amount (between 5,000 and 50,000 EUR)
Explain what the requested budget will be used for?
- Does the project have other funding sources, both past and present?
- Explain costs for hardware, human labor (including rates used), travel cost to technical meetings, etc.
- (max 2500 characters, be concise)
- (If you want, you can in addition attach a budget at the bottom of the form).
The total possible is 50,000 euros and I am thinking that we ask for 40,000 euros. For myself, I would ask for 12,000 euros at a rate of 25 euros per hour. Which would equal 20 hours per week, 4 weeks per month, for 6 months.
Personally, I want to earn 25 euros per hour, work 20 hours per week, 4 weeks per month, for 6 months, for a total of 12,000 euros. I think that is sensible based on what I would be contributing and the required skills (scientific, organizing, writing, modeling, coding, interacting, marketing).
I think that we could ask for 36 euros per hour for Aleks. And assign him 18,000 euros for 500 hours of work. Whereas I would get 12,000 euros for 480 hours per work. And then ask for 12,000 euros = 12 x 1,000 euros (on average) for custom assistance for 12 users. Custom assistance would mean extra help, beyond what Aleks and I are doing, to help these users with modeling or with coding special functionality in ActiveInference.jl or with connecting to particular databases or with presenting results on the web and so on. We would work in 3 stages, two months each. In the first stage, Aleks would be improving the ActiveInference.jl codebase as you deem needed. I would be working with users at the Symposium and around that time to document their needs. In the second stage, Aleks would improve ActiveInference.jl further based on the documented needs of the users, and I would organize assistants to help and we would start work helping the users. In the third state, Aleks would be done. I and the assistants would complete helping the users and also we would create presentations of how to use the library, referencing these examples, creating tutorials and sharing the results. We get paid after each stage, that is, after presenting our deliverables.
I think we start with these amounts and they seem reasonable. The total is 42,000 euros unless you need to add something more. If you get selected, then they may question the amounts and you could possibly lower them. But I think the key point to frugality is that we are focused on doing what is most important and effective. And money is being spent on things that won't happen otherwise.
Also, a very important point is that you and your team are working without this extra support, and this is something you are asking for that you think is important and valuable.
People for whom we prioritise appling for money is: @AndriusKulikauskas (Math4Wisdom) as coordinator, tester, and person who will get feedback from the community. Aleks @sashapustota who will be software developer and work with us on extending and improving the package
But depending on the budget, on time availability on their end, and on what makes sense for the project, we might also be able to do a small hire, either for @Moller, for Dominik, or for someone else (where I do have a brilliant software engineer in mind that I know I work well with, too) Hi everyone
learn about user needs (like you were doing today) and start trying to serve them (as part of the process of building your package). So if you like, I could ask for funding for myself as an organizer and interviewer, and for one or two software developers to program custom solutions, and for an Active Inference expert to do the modeling, perhaps paying the Active Inference Institute for that or just to support it in general as the locus for this activity.
I could be the organizer. I think there are two roles for adoption - we need one or more software developers, we need one or more modelers to work with users. I think (and hope) that I could learn to do such modeling. But, in general, there is a question of whether it would be good to have fewer people earning more money, or more people earnling less money. I imagine the latter can help grow a vibrant community of modelers and developers.
Also, I suggest reaching out to people who are using your library or might like to. In particular, neurosurgeon Dirk de Ridder presented a theoretical model based on his experience and he is now looking for collaborators to implement this model with a demonstration I think with the help of the Institute we can gather together an impressive group of researchers and learn their needs and desires.
Compare your own project with existing or historical efforts. E.g. what is new, more thorough or otherwise different. (max 4000 characters ~ 690 words, be concise)
Other softwares is the original implemention in MATLAB, the DEM software; pymdp; ActiveInference.jl; RxInfer.jl (which does parts of but all of active inference); and cpp-aif in C++ After you've drafted, we can write a little bit on their relative strengths and weaknesses. In our paper there is also an overview The thing that makes ActiveInfernce.jl unique is that is is invertiable, so it can be used computationla phenotying / cognitive modeling It can also use RxInfer under the hood (when we've updated it), so it can benefit from their speed and ecosystem Another thing that ActiveInference.jl has is that we are going to mkae it generative model-general, so that other types of models than discrete POMDP's can be used Finally, we can rely on Turing.jl and RxInfer.jl to implement these generative models, which is necessary for continuous state space models And then Julia makes it very easy to write performant code that is also easy to read, extend and develop - so it should make it much easier for the community help develop the package I will reach out to RxInfer soon. I am in contact with the developers of pymdp (Verses). And the aif-cpp I don't know how much is used, but it would be nice to talk to them Happy to (perhaps in the future) extend to applying for money for AIF development in general, across packages, although ym focus is of course on ActiveInference.jl
We are building on the Active Inference ontology work. https://coda.io/@active-inference-institute/active-inference-ontology-website
The world needs an open source ecosystem regarding AI and that Active Inference is an important contribution to that, and the priority is to strengthen the open source spirit among Active Inference researchers, centered around the Active Inference Institute. So the idea would be for you and me and others to build on the Active Inference Institute's existing work.
Compare with
- https://coda.io/d/AII_do5M5iYau8H/RxInfer-jl_suPL5aLk RxInfer
- https://github.com/infer-actively/pymdp PyMDP
Part of TAPAS https://github.com/ComputationalPsychiatry
What are significant technical challenges you expect to solve during the project, if any? (optional but recommended, max 5000 characters ~ 860 words)
Vision
- computational modeling of active inference
- a gateway interface for researchers to make modeling Active Inference as straightforward as possible
- presenting the code so that it follows Karl's thinking and serves
Uses
- make Active Inference available to
- computational psychiatry
- AI
- interface between AI/machine learning and psychiatry/psychology/neuroscience
Challenges
- the principal challenge is adoption given that
- this field requires a high level of collaboration by researchers contributing different skills and expertise
- the Active Inference framework itself is conceptually advanced, mathematically sophisticated, computationally robust
- taps deeply into the empirical data being modeled by the relevant science.
Problems
- we are in the process of updating it
- efficiency, it isn't optimized yet, so it can be slow
- not all parameters can be estimated meta-bayesian style yet
- Dr.Karl Friston is inclusive but his insight risks being muddled by senseless deviations
- usability, declutter the software so that it does not include or tucks away unhelpful, confusing, self-defeating options
- completeness of features
Tasks
- Work closely with researchers so that the software meets their needs. (understand user requirements and improving usability/inclusive design) And also to learn to present the framework, especially for model-based data analysis as in Chapter 9 of the textbook, in a way that helps users think clearly about the framework, the models they are constructing or discovering, and the code that implements that. (an improved type of documentation)
- present ActiveInference.jl so that there is an obvious paralellism in the library's tutorial for modeling, the structure of the modeling process, the organization of its code, the accompanying comments, the illustrative example code and projects, and the links to reading materials and videos. (documentation for researchers, developers and end users, including educational materials) Thus it
- is hosted on the Internet by the Active Inference Institute and connects with its social venues, knowledge base and activities
- (Make it Trustworthy) authoritatively represents Active Inference founder Karl Friston's personal approach for designing computational models of Active Inference, reflecting his best understanding and accumulated wisdom
- (Make it Resilient) streamlines the most profound scientific application, model-based data analysis, as in Chapter 9 of the textbook, where objective models are constructed, and plausible subjective models are hypothesized and then evaluated from empirical results
- clearly and consistently expresses his approach as a step-by-step procedure for defining matrices A, B, C, D, E, H
- implements Karl Friston's 3rd generation XXX framework as being implemented by PyMDP
- can be the user's entrance point to modeling
- explains these steps with text, diagrams, equations and sample code
- an online-hosted guide to doing active inference modeling, including questions, and perhaps video tutorials or links to them, an introduction from-scratch to Active Inference for newcomers
- step-by-step tutorial on modeling, showing in parallel how the mathematics develops, and the ontology unfolds, and the code implements that, and the examples illustrate that. Andrius would author this and Peter and Daniel and Karl could be coauthors. And then this could be highly citable, a way for people to find projects that use ActiveInference.jl and a way to promote it.
- illustrates this with an archive of Active Inference projects, past and present
- including noteworthy published results for which actual or similar data is provided and the model has been recoded with our package
- and current projects that may be works-in-progress
- allows for a simple choice amongst basic generative models
- allows for a wide variety of objective models
- shows how the Active Inference framework becomes equivalent to simpler frameworks (reinforcement learning, KL divergence, expected utility) when the corresponding terms in free energy are set to zero.
- allows for exceptional variations of this basic procedure through swapping out functionality under the hood
- allows for not only discrete POMDP but also continuous models
- allows for a variety of objective models
- its procedure is presented as an interactive tutorial at the Active Inference Institute website on the Internet
- this presentation affords itself to Dr.Karl Friston and his colleagues for reference in the presentations they make over the Internet
- links prolifically to the Active Inference Institute ontology and knowledge base on the Internet
- its functionality, sample code, archive of projects on the Internet are likewise linked to by the Active Inference Institute
- rewrite parts of ActiveInference.jl so that (design and development of free and open source software and open hardware)
- aligns with Dr.Karl Friston's procedure
- high quality of the code base: efficient, readable and editable
- optimized to make good use of Julia's speed
- it allows for a variety of generative models, not simply POMDP
- be able to observe the observer
- perhaps recursively
- model collaboration of individual agents
- allows for continuous state space models
- there are other competing frameworks that use continuous models and this encourages migration
- there are situations where the computational cost of discretizing everything is large
- can confirm Karl's suggestion that you don't need it since the discrete state space in principle can cover all interesting situations
- be able to observe the observer
- be able to make good use of other packages under the hood
- (Make it Sustainable) cultivate our ecosystem
- community based testing of the software to make sure it is as intuitive and useful as possible
- through the Internet, coders or modelers could discover, connect with and work for users as volunteers and/or for pay
- well situated with the other projects.
Users to engage
- Dirk de Ridder
Questions
- Who are the possible programmers and what do they need to use your tools in helping others?
We need to think what would be most helpful to fund. And then break it down into milestones. They pay after each milestone is completed.
Accelerate the adoption cycle, the research and development cycle for faster feedback and custom service.
Andrius could lead a small team to work with your team to learn about user needs (like you were doing today) and start trying to serve them (as part of the process of building your package). So if you like, I could ask for funding for myself as an organizer and interviewer, and for one or two software developers to program custom solutions, and for an Active Inference expert to do the modeling,
I will need to understand your core needs. I also had a thought for giving this an online component and relate it to their vision of the next generation Internet. It would be good if there was a simple online website where researchers could find and share examples of how they break down their projects in the way that Karl talked about yesterday. 1) Specifying subjective generative models 2) Specifying the objective generative model 3) Inverting all of these generative models. 4) Finding the prior beliefs that fit best. I think this is the subject of Chapter 9 Model-Based Analysis in the Active Inference textbook. Also, he talked about A-tensor (likelihoods), B-tensor (priors), C-tensor (goals), D-tensor (initialization), E-tensor (habits), F Free Energy, G I didn't hear, H-tensor (new goals required for inductive inference) if I wrote this down correctly.
If there was such a template available online, and also alongside the code, that would help researchers structure their thinking, then this would facilitate adoption, sharing, collaboration, use case collection, development of relevant software, interplay with compatible theoretical frameworks, sharing of data, integration with AI tools. It would facilitate the Active Inference Institute's role as a hub and catalyst. It would contribute to the human relationships which make the Internet a healthy forum.
Determining priorities. I think that your argument for a continuous state space model is fine if you position it as an alternative. There is a principle in software development of serving a client's needs even if they don't make sense because that can be the quickest way to communicate why. But I would first find at least one user who actually wants the continuous state space model. If you don't have such a user then I would wait until you get a request, personally thinking. For this grant, I would focus on actual users and connecting with them and their needs.
Yes, good idea to gather researchers - I imagine that would be very useful for the application, and also for the software development itself.
I think one primary bottleneck in the field is the time resources of the (somewhat limited amount of) computational modellers; I am sure Dirk's project is valuable, but I, for example, coulnt currently take on a whole new modeling project right now. But of course, the aim is to address this - exactly by making these tools as easy to use and understand as possible. And regarding continuous state space models, good point. I actually know quite a few people who would like to do this I think - the problem is, they often end up using other modeling approaches than active inference, sometimes relates ones sometimes not. Many people also simply do not do the projects because there aren't modeling tools for it. But in any case, I don't think there should be much focus on this in the application, except perhaps to say that we want to the software to be flexible enough that it can be extended to meet various needs that might arise in the future, and to connect it with the rest of Julias open-source ecosystem
warranties become relevant if used for many engineering purposes.
Describe the ecosystem of the project, and how you will engage with relevant actors and promote the outcomes? (E.g. which actors will you involve? Who should run or deploy your solution to make it a success? (max 2500 characters ~ 430 words, be concise)
The Applied Active Inference Symposium will take place on November 12-14 https://coda.io/d/AII_do5M5iYau8H/Call-for-Presenters_suPBkWXn and the focus will be on industry and one major topic will be: Open Science & Tool Development: Increasing the function and accessibility of Active Inference software across languages. Focused tracks and workshops on practical aspects of Active Inference.
So we should talk to @DanielFriedman when he gets back and think about presenting ActiveInference.jl and other software and our overall plan for our ecosystem. Then we can note in our proposal that we will be coordinating ourselves within that ecosystem, presenting and finding users, making connections, etc. This can be our "measurement" of where things stand as we start. If we go for 6 months, then we would start in November / December and finish in May / June. That kind of matches the Institute's cycle.
It's important to think how all of the software might fit nicely within our ecosystem. So it could be good to connect with the leaders for those packages, especially since we're working through the Active Inference Institute. For example, having a community of modelers working for free and/or pay can be meaningful for all of the packages. I think it would be good to distinguish the niches that the packages are serving.
I think we should keep ActiveInference.jl a fully open-source tool that people can use to develop and test machine learning algorithms, to do theoretical modelling, and to do applied cognitive modelling. Currently, it is under an MIT license, which means that companies can use it in commercial products if they want, etc. Then, if someone wants to have a special version of the package fine-tuned for some specific commercial or engineering use case, that's a different thing, which I think we can tackle if that arises. That's down the road, I'd say. Packages like pymdp and RxInfer walk this same balance, where I think RxInfer, for example offers counseling services or to make special versions for customers - if I remember correctly
s regards Large Language Models and also Deep Learning, Julia is simply not competitive, it is underresourced, there is no way it can catch up to Mojo and other work by the big companies https://youtu.be/O6CF-UHArMs?t=2487 There is scientific deep learning but classical machne learning is not well supported, according to him. It is usable for neural network modeling. The go to for Julia is scientific machine learning, where you want to enrich a differential equation solver with a neural network.
Attachments: add any additional information about the project that may help us to gain more insight into the proposed effort, for instance a more detailed task description, a justification of costs or relevant endorsements. Attachments should only contain background information, please make sure that the proposal without attachments is self-contained and concise. Don't waste too much time on this. Really.
Endorsements
- Active Inference Institute (can coordinate a team, can position with regard to other software projects, can position within the Applied Active Inference Symposium).
- Karl Friston
- Theoretical Neurobiology Meeting
Sources
- Presentation and slides: Peter Thestrup Waade. The Future of ActiveInference.jl
- GitHub. Computational Psychiatry. ActiveInference.jl
- https://www.mdpi.com/1099-4300/27/1/62 Samuel William Nehrer 1,Jonathan Ehrenreich Laursen,Conor Heins, Karl Friston, Christoph Mathys, Peter Thestrup Waade. Introducing ActiveInference.jl: A Julia Library for Simulation and Parameter Estimation with Active Inference Models.
- Active Inference textbook Chapter 9. Model-ÂBased Data AnalyÂsis.
- Active Inference Ontology
Other somewhat similar projects
- related to science: An OpenScience flavour of Bonfire on NixOS for preprints — Discuss preprints based on W3C
- PyCM — Machine learning post-processing and analysis. PyCM is an open-source Python library designed to systematically evaluate, quantify, and report the performance of machine learning algorithms. It offers an extensive range of metrics to assess algorithm performance comprehensively, enabling users to compare different models and identify the optimal one based on their specific requirements and priorities. Additionally, PyCM supports generating evaluation reports in various formats. Widely recognized as a standard and reliable post-processing tool, PyCM has been adopted by leading open-source AI projects, including TensorFlow, Google’s scaaml, Torchbearer, and CLaF. In this grant, the team will implement several new features, such as data distribution analysis, dissimilarity / distance matrices and curve analysis. In addition the project will improve benchmarking and confidence, and introduce an API and GUI for wider adoption.
Secondary
We have also discussed making like a GUI-like tool which runs Julia under the hood, to reduce the coding complexity for users. Developing that would be great, but it strikes me as a secondary thing after the software itself has grown up properly