Introduction {#s1}
============

The balance between *exploitation*, that is choosing the most valuable option given current beliefs about the world, and *exploration*, that is choosing options that allow us to forage and learn about our environment, lies at the heart of decision-making and adaptive behaviour ([@bib19]; [@bib35]). The trade-off between choosing to exploit or explore is a key focus of computational theories of behaviour in both artificial intelligence and neuroscience, such as in reinforcement learning and Bayesian models of behaviour ([@bib27]; [@bib29]; [@bib84]; [@bib85]; [@bib39]; [@bib38]). Importantly, recent behavioural evidence suggests that humans perform a mixture of both *random* and *goal-directed* exploration ([@bib32]; [@bib98]). Random exploration has been introduced in early accounts of exploratory behaviour ([@bib20]; [@bib85]). This behaviour is defined as a deviation from the currently most valuable policy by randomly sampling any other option. A classical way of formalising random exploration is via $\epsilon$-greedy or softmax choice rules, where in the latter the tendency towards randomness is governed by an inverse temperature parameter ([@bib85]). A more refined account of random exploration has been introduced via Thompson sampling ([@bib91]), where an agent samples from a posterior over reward statistics and chooses the most valuable option with respect to this sample, thus taking its uncertainty over reward statistics into account ([@bib2]; [@bib80]).

In contrast to random exploration, goal-directed, information-seeking exploration is guided by the uncertainty in an agent's model of the structure of the world. This implies that agents will selectively sample options that are informative, that is that are associated with the highest uncertainty. A prominent example of uncertainty-sensitive exploration is the upper confidence bound algorithm ([@bib1]; [@bib3]; [@bib45]; [@bib85]), which adds an uncertainty bonus ([@bib46]) to options that have not been sampled for a long time or that are associated with high uncertainty. See ([@bib32]; [@bib33]) for a discussion of these two types of exploration and specific predictions arising from these formulations.

It is challenging to provide a formal account of the trade-off between behaviour that aims at maximising reward and fulfils an agent's preferences over states on the one hand, and acquiring information about the world on the other. Furthermore, an important challenge lies in moving beyond descriptive accounts of behaviour towards understanding the generative mechanisms of information gain that could be implemented by a biological system. A particularly challenging aspect lies in providing a formal account of goal-directed exploration, where agents are 'intrinsically motivated' to minimise uncertainty and actively learn about the world, closely linked to the concept of curiosity ([@bib49]; [@bib64]). This is particularly delicate because one can dissociate different types of uncertainties. For example, if an agent is offered an option that may have a positive or a negative outcome, she will be in a state of uncertainty at two levels. First, she has no idea about the probabilities of winning or losing. For example, there could be a 50% or 99% chance of winning. Second, even if she knew the probability of winning exactly (e.g. 50%), there will still be some uncertainty about the outcome if she chose the option (whether she wins or not). These types of uncertainties have been termed unexpected and expected uncertainty ([@bib101]) or, in economics, ambiguity and risk. The key point is that it is necessary to resolve ambiguity first before agents can assess the value of options and their associated risk.

We discuss these different aspects of uncertainty-reduction in terms of Bayesian inference, by casting choice behaviour and planning as variational probabilistic inference ([@bib25]; [@bib29]). Here, agents are assumed to form expectations over observable states (outcomes) and infer policies that minimise the expected information-theoretic surprise about these observations. These expectations reflect an agent's preferences over observations, such that undesired outcomes will be (a priori) unexpected and surprising. Thus, by minimising surprise, agents find policies that make visiting preferred states more likely. This information-theoretic quantity can be approximated by the expected free energy, which is a function of (approximate posterior) beliefs about the states of the world, formed under a generative model based on a Markov decision process, as will be described below.

Under this approach, different types of exploitative and exploratory behaviour emerge. The key aspect that motivates goal-directed uncertainty reduction is the mapping from (hidden) states to observations. This form of uncertainty reduction becomes relevant in partially observable problems, where in addition to inferring the best policy; agents also have to infer the current (hidden) state that caused an observation. In order to minimise uncertainty about the current state, agents can try to navigate to (observable) outcomes, where the mapping to the underlying hidden state is unambiguous. A simple example is a bird that is searching for prey: in the case of high uncertainty about the prey's location, a bird might go to a vantage point first to minimise uncertainty about the prey's location (i.e. the underlying hidden state), before predation. Another example is contextual inference, where an agent needs to disclose the current context (i.e. the hidden state), in order to infer what to do (e.g. is there milk in the fridge?). In case of contextual uncertainty, agents will prefer to sample outcomes that allow for precise inference about the current context (e.g. sample the fridge), before making a choice about whether to look for reward (e.g. whether or not to make tea). Formally, this means that agents will try to actively sample outcomes that have an unambiguous (low conditional entropy) mapping to hidden states -- hence *active inference* allowing for 'hidden state exploration'.

Importantly, the exact same imperatives apply to beliefs about model parameters that describe a subject's knowledge about state transitions or the probability of various outcomes given the underlying (hidden) states. In other words, uncertainty about states of the world is accompanied by uncertainties about the contingencies that underwrite state transitions and the relationship between hidden states and observable outcomes. In contrast to the examples above, which reflect uncertainty about the underlying hidden state, given an agent's model of the task this form of uncertainty reflects an agent's ignorance about the causal structure of the model per se. For example, agents can be uncertain about the current context that determines the value of options (*uncertainty about a hidden state*, \'is there milk in my tea?\') or uncertain about the value of options given a current context (*uncertainty about model parameters*, \'what does milky tea taste like?\'). To reduce the latter type of uncertainty, agents can expose themselves to observations that complete 'knowledge gaps' and thereby learn the probabilistic structure of unknown and unexplored (novel) contingencies -- hence *active learning* allowing for 'model parameter exploration'.

In the following, we introduce the theoretical framework underlying active inference and active learning and use simulations to illustrate the emergence of these particular types of exploratory behaviour. We consider the resolution of uncertainty about *states* and *parameters* in terms of *salience* and *novelty* respectively; where 'salience is to inference' as 'novelty is to learning'. We use a simple two-armed bandit problem in which a subject has to choose between a risky high reward and a safe low reward, where the probabilities of the risky option are unknown. Minimising expected free energy leads to curiosity-driven *active learning* that initially favours the novel risky option, because this option provides uncertainty reduction about an agent's parameterisation of the task. We show how the same computational framework motivates *active inference* in situations where certain actions disclose salient information about hidden states, such as whether there is currently a high or low reward probability in the risky option. Based on this paradigm, we illustrate different sorts of explorative behaviour, contrast them with random exploration or purely exploitative choices, and consider how different tendencies emerge under different priors over beliefs about outcomes and the precision of those beliefs.

Results {#s2}
=======

A generative model of a Markov decision process {#s2-1}
-----------------------------------------------

Our theoretical approach assumes that agents, such as brains or economists, minimise the expected free energy of future outcomes and hidden states. This premise allows us to derive generic update rules for action (i.e. policy selection), perception, and learning based on variational Bayes, which is described in more detail in the Materials and methods section and previous work ([@bib25]; [@bib29]). In the following, we provide a brief conceptual outline of this computational architecture to frame the discussion of active inference and active learning in the remainder of the paper.

Active inference and active learning rest upon a generative model of observed outcomes as illustrated in [Figure 1](#fig1){ref-type="fig"}. This generative model is used to infer the most likely causes of outcomes, that is what is the most likely true (hidden) state of the world (e.g. a current context) that caused a given observation (e.g. a win or a loss). These states are called *hidden* because they are usually not or only partially observable and can only be inferred through observations. Inferring beliefs about hidden states (i.e. state estimation) is cast as an optimisation problem based on minimising variational free energy, which finds the most likely (posterior) expectations about states of the world, given current observations. This is the same optimisation found in machine learning, where (negative) free energy is known as an evidence lower bound (ELBO). Importantly, agents can also infer different policies, defined as sequences of actions, that determine the most likely observations they will make. This means that observations depend upon policies, which requires the generative model to infer expectations about future outcomes under different policies. Thus, in addition to forming posterior beliefs about hidden states, active inference and learning rest on posterior expectations about the best policy to pursue in a given context. In other words, agents are assumed to infer 'what is the current state of the world' and 'what are the best actions to pursue' based on the same generative model of the environment.

![Generative model.\
A generative model specifies the joint probability of observations and their hidden causes. The model is expressed in terms of an *observation model* (*likelihood function*, that is the probability of observations given true states) and priors over causes. Here, this likelihood is specified by a matrix (**A**) whose rows are the probability of an outcome under all possible hidden states, $P(o_{t}|s_{t})$. The (empirical) priors in this model pertain to transitions among hidden states (**B**) that depend upon policies (i.e. sequences of actions), $P(s_{t + 1}|s_{t},\pi)$ and beliefs about policies contingent on an agent's precision or inverse randomness, $P(\pi|\gamma)$, as well as (full) priors on precision (specified by a Gamma distribution) and an agent's observation model (specified by a Dirichlet distribution). The key aspect of this generative model is that policies are more probable a priori if they minimise the (sum or path integral of) expected free energy $\mathbf{G}\left( \mathbf{\pi} \right)$. This implies that policies become valuable if they maximise information gain by learning about model parameters (first term) or hidden states (second term) and realise an agent's preferences. Approximate inference on the hidden causes (i.e. the current state, policy, precision and observation model) proceeds using variational Bayes (see Materials and methods). Right side depicts the dependency graph of the generative model, with blue circles denoting hidden causes that can be inferred. $\sigma$=Softmax function, Dir = Dirichlet distribution, $\Gamma$= Gamma distribution, Q = (approximate) posterior. See Materials and methods for details.](elife-41703-fig1){#fig1}

Variational free energy is a function of observations and probabilistic beliefs about hidden states (see Materials and methods), and can be understood as a statistical quantity that measures the mismatch (i.e. 'surprise') between true observations and predictions about those observations under the generative model. Minimising this mismatch ensures that these beliefs approximate the true states, given observations and maximises the (negative log) evidence of an agent's generative model. The key assumption of active inference and active learning is that we can apply the same logic to inference about hidden states *and policies*. In the context of inference about policies ('what am I going to do now?\"), valuable policies are those that minimise variational free energy expected under that policy, that is the mismatch between preferred and predicted outcomes, under a given policy. Effectively, this compels agents to select policies that avoid surprising outcomes. This (expected) free energy is a proxy for surprise or model evidence, and thus allows one to cast choice behaviour as minimising expected surprise or, equivalently, maximising expected model evidence ([@bib27]). This provides a formal grounding for the notion of the 'value' of a policy: the value is defined with respect to an agent's generative model of the world, and valuable policies maximise the expected log-evidence of that model.

Importantly, as illustrated in [Figure 1](#fig1){ref-type="fig"} (see Materials and methods section, [Equation 7](#equ8){ref-type="disp-formula"} for details), the value (goodness) of a policy $G$ is determined by both *extrinsic* reward and *intrinsic* information gain. Depending on an agent's prior uncertainty about the world, gaining information can refer to exploring hidden states underlying observations, that is 'active inference', or exploring the correct parameterisation of the agent's world model, that is 'active learning'. Interestingly, these two tendencies can make opposing predictions about behaviour. Active learning allows for 'model parameter exploration' and compels agents to actively seek novel combinations of hidden states and outcomes to learn about the way in which outcomes are generated. Active inference allows for 'hidden state exploration' and compels agents to actively seek (known) salient observations that enable them to infer the underlying hidden states unambiguously. For example, if an agent is certain that a risky option has a 0.5 probability of being rewarded, this 'certain ambiguity' will be aversive (depending on her risk preferences, see appendix I). However, if she is uncertain about a 0.5 probability, however, this 'uncertain ambiguity' means there is an opportunity to resolve uncertainty and motivate active learning. In the following, we will explore this dialectic between 'active learning' and 'active inference' and speculate about their behavioural and neuronal underpinnings.

We will restrict our discussion of active inference and active learning to the context of discrete-time Markov Decision Processes ([@bib25]; [@bib27]). In this setting, agents are assumed to perform approximate inference based on variational Bayes, which casts a difficult and usually intractable inference problem as a bound optimisation problem ([@bib7]; [@bib11]; [@bib34]). This implies that expectations about hidden states are updated to minimise variational free energy under a generative model. [Figure 1](#fig1){ref-type="fig"} provides an illustration of the Markovian generative model used in the simulations below. Observable outcomes $o_{t}$ at a particular discrete time-step depend upon true hidden states $s_{t}$ in the world, while hidden states evolve according to Markovian transition probabilities contingent upon actions emitted by an agent. The generative model is specified by two sets of arrays. The first, $\mathbf{A}$, maps from hidden states to outcomes. That means that $\mathbf{A}$ models an agent's observation model or the emission function in a hidden Markov model, specifying the likelihood of an observation under a given hidden state. The second, $\mathbf{B}$, prescribe the transitions among hidden states, contingent on a policy $\pi$. These transitions are Markovian, such that the probability of the subsequent state is fully determined by the current state and action. The arrays **c** and **d** encode prior expectations about observations, and initial states, respectively. The former specifies an agent's preferences or utilities over outcomes and determines the 'extrinsic' reward component of a policy's value, whereas the latter specifies an agent's prior beliefs about the starting point in a task. We refer to the Appendix I for a more detailed discussion of the role of **c** and **d** in exploitative and exploratory behaviour. Finally, the precision $\gamma$ reflects an agent's stochasticity or randomness in behaviour. This precision term is parameterised by a rate parameter $\beta$, such that the expected value of $\gamma$ is $\frac{1}{\beta}$. Note that under this generative model, $\gamma$ is a hidden state that can be inferred. In the following simulations, however, we will focus on the role of $\beta$ in determining an agent's overall level of stochasticity (i.e. '*random exploration'*) in behaviour, but we discuss time-dependent updates of precision in the section on potential neuronal correlates of active inference and active learning (section 'Behavioural and neural predictions').

In the following simulations of active learning and active inference (available online, cf. [@bib76]), we focus on the two kinds of information gain, namely, foraging for information about the correct parameterisation of the observation model (active learning or 'model parameter exploration') and using the observation model to accurately infer hidden states (active inference or 'hidden state exploration'). We will assume that state transitions as well as the number and type of observations and initial states are already learned. How the state space and the dimensions of the different matrices that determine the mapping between these states are themselves learned is an important and interesting question but goes beyond the scope of this paper (see [@bib53] for a discussion of curiosity-driven learning of goal states, for instance).

Model parameter exploration via active learning {#s2-2}
-----------------------------------------------

In this section, we simulate the effects of active learning or 'model parameter exploration' on behaviour (first term in [Equation 7](#equ8){ref-type="disp-formula"}, Materials and methods section and [Figure 1](#fig1){ref-type="fig"}). The aim of this section is to characterise the behavioural phenotype of active learning in different task settings, and contrast this type of goal-directed exploration with random exploration. We simulate a simple experiment, where an agent has to choose between a safe and a risky option, such as a rat in a T-shaped maze seeking reward in one of two goal arms. . We assume that the agent knows that it can only sample one of the two arms and that one arm (left arm in [Figure 2](#fig2){ref-type="fig"}) contains a certain small reward whereas the other arm (right arm in [Figure 2](#fig2){ref-type="fig"}) contains an uncertain, high reward. Importantly, however, the agent does not know about the reward probabilities in the uncertain arm in the beginning of the experiment, but can learn about these contingencies by updating its observation model via experience-dependent learning. Learning the observation model (i.e. building the A-matrix) is cast as updating the concentration parameters of a Dirichlet distribution that specifies the mapping from hidden states to observations (see Materials and methods for details). These updates effectively reflect normalised counts of experienced particular state-outcome mappings, as will be illustrated below.

![Generative Model of a T-maze task, in which an agent (e.g. a rat) has to choose between a safe option (left arm) and an ambiguous risky option (right arm).\
There are three different states in this task reflecting the rat's location in the maze; namely, being located at the starting position or sampling the safe or risky arm. Further, there are four possible observations, namely being located at the starting position, obtaining a small reward in the safe option, obtaining a high reward in the risky option and obtaining no reward in the risky option. (**A**) The A-matrix (*observation* or *emission* model) maps from hidden states (columns) to observable outcome states (rows, resulting in a 4x3 matrix). There is a deterministic mapping when the agent is in the starting position or samples the safe reward. When the agent samples the risky option, there is a probabilistic mapping to receiving a high reward or no reward. The A-matrix depends on concentration parameters $a$ that are updated due to observing transitions between states and observations (in this example: receiving a high or no reward in the risky option), where $a_{0}$ reflects the prior concentration parameters without having made any observation yet (prior to normalisation over columns). (**B**) The B-matrix encodes the transition probabilities, that is the mapping from the current hidden state (columns) to the next hidden state (rows) contingent on the action taken by the agent. Thus, one needs as many B-matrices as there are different policies available to the agent (shown here: choose safe or choose risky). Here, the action simply changes the location of the agent. (**C**) The c-vector specifies the preferences over outcome states. In this example, the agent prefers (expects) to end up in a reward state and dislikes to end up in a no reward state, whereas it is somewhat indifferent about the 'intermediate' states. Note that these preferences are represented as log-probabilities (to which a softmax function is applied). For example, these preferences imply that visiting the high reward state is $exp\left( 4 \right) \approx 55$ times more likely than the starting point (${\exp\left( 0 \right)} = 1$) at the end of a trial. The d-vector specifies beliefs about the initial state of a trial. Here, the agent knows that its initial state is the starting point of the maze.](elife-41703-fig2){#fig2}

### Model structure {#s2-2-1}

To simulate behaviour, one needs to specify the parameterisation of the generative model, which has been described in detail in previous work ([@bib28]). In this task, we need to define a hyperprior on the precision of policy (choice) selection ($\beta$ in [Figure 1](#fig1){ref-type="fig"}), which reflects the randomness in policy selection. Unless otherwise specified, we have set $\beta$ to a (standard rate parameter) value of 1. As shown in [Figure 2](#fig2){ref-type="fig"}, we define three different states in this task -- as determined by the rat's location in the maze; namely, being located at the starting position or sampling the safe or risky arm. Further, we define four possible observations; namely, being located at the starting position, obtaining a small reward in the safe option, obtaining a high reward in the risky option and obtaining no reward in the risky option. The ***A***-matrix (observation model) then determines the mapping from states to observations, while the ***B***-matrix (transition probabilities) specifies the mapping between hidden states given an action (which we assume to be learned). Further, we need to specify an agent's expectations over observations that reflect its preferences. These expectations are encoded in a **c**-vector, which we have set to $c = \begin{bmatrix}
{0} & 2 & 4 & {- 2} \\
\end{bmatrix}$ in the following simulations, reflecting an agent's preference for being in the starting position, obtaining a safe reward, obtaining a high reward and obtaining no reward in a risky option, respectively. Note that here and below these preferences are defined as an agent's *log-expectations* over outcomes, which means that preferences are passed through a softmax function and correspond to log probabilities (giving $c = \begin{bmatrix}
{- 4.15} & {- 2.15} & {- 0.15} & {- 6.15} \\
\end{bmatrix}$). For example, the definition of these preferences implies that the agent believes that visiting the high reward state is $exp\left( 4 \right) \approx 55$ times more likely than visiting the starting point (${\exp\left( 0 \right)} = 1$) at the end of a trial. The **d**-vector encodes an agent's expectations about the initial state, which was defined to reflect full certainty about starting each trial in the starting position of the maze. In simulations that include learning, we set the initial concentration parameters for obtaining a high reward (or not) to 0.25 (i.e. position (3,3) and (4,3) in the A-matrix in [Figure 2](#fig2){ref-type="fig"}), and these concentration parameters are updated according to a learning rate $\eta$, which was set to 0.5. [Figure 2](#fig2){ref-type="fig"} illustrates the architecture of the generative model of this task.

### Active learning {#s2-2-2}

[Figure 3A](#fig3){ref-type="fig"} illustrates an experiment that was simulated under active learning with an underlying high-reward probability of 50% in the risky option. The bottom panel illustrates the evolution of beliefs (concentration parameters) about the underlying emission probabilities of the task for every trial of the experiment, which in turn determine policy selection as illustrated in the first panel. Note that at the start of the experiment, the agent assigns equal probability to receiving a high reward and no reward at the risky option, but these beliefs have very low certainty (i.e. very small concentration parameters). This leads the agent to explore and gather information in the beginning of the experiment by choosing the risky option, that is to *learn actively*. After trial 10, the agent (correctly) assigns a probability of 50% to a high reward in the risky option, but now with higher confidence (i.e. larger concentration parameters). Consequently, the agent now prefers to exploit and sample the safe option, driven by both the expected value of this option and a preference for visiting unambiguous states. Note that this result also depends on the agent's risk preferences, as discussed in Appendix I.

![Simulated responses during active learning.\
This figure illustrates responses and belief updates during a simulated experiment with 32 trials. The first panel illustrates whether the agent sampled the safe or risky option as indicated by the blue dots, as well as the agent's beliefs about which action to select. Darker background implies higher certainty about selecting a particular action. The second panel illustrates the outcomes at each trial and the utility of each outcome. Outcomes are represented as coloured dots, where purple refers to a small and safe reward, green to a high reward and red to no reward in the risky option. Black bars reflect the utilities of the outcome. Note that these utilities are defined as log-probabilities over outcomes (see main text and [Figure 2](#fig2){ref-type="fig"}), thus a value closer to zero reflects higher utility of an outcome. The third panel illustrates the evolution of beliefs about the reward probabilities in the risky option (red = belief about no reward, green = belief about high reward). The fourth panel illustrates the evolution of the corresponding concentration parameters of the observation model over time (red = concentration parameter for the mapping from risky option to no reward, green = concentration parameter for the mapping from risky option to high reward, cf. [Figure 2A](#fig2){ref-type="fig"}). (**A**) In this example, the simulated agent makes predominantly curious and novelty-seeking choices in the beginning of the experiment. After the tenth trial, the agent is confident that the risky option provides a probability of 0.5 for receiving a high reward, which compels it to choose the safe option afterwards. (**B**) Same setup as in (**A**), but now the true reward probability of the risky option is set to 0.75. After sampling the risky option in the beginning of the experiment and learning about the high reward probability of that option, the agent becomes increasingly certain that the risky option has a high probability of a reward. This compels the agent to continue sampling the risky option and only rarely visiting the safe option with low certainty, as illustrated in panel one.](elife-41703-fig3){#fig3}

[Figure 3B](#fig3){ref-type="fig"} illustrates the same task but with a reward probability of 0.75 for the risky option. Here, after a similar number of exploration trials as in [Figure 3A](#fig3){ref-type="fig"}, the agent becomes confident that it should select the risky option, given its higher expected value. This can be seen by the fact that the agent continues to select the risky option (blue dots) with high confidence (shaded area behind blue dots, first panel) because the risky option is mostly rewarded (green dots, second panel).

### The role of stochasticity in active learning {#s2-2-3}

The above simulations highlight an important aspect of exploratory behaviour, namely behaviour that is goal-directed and aims at reducing uncertainty about a specific part of an agent's model, in this example the part of the A-matrix (i.e. the observation or emission function) that specifies the mapping from sampling the risky option to obtaining a high or low reward. This means that the agent tries to gain insight into a particular part of the structure of world that it is unsure about. Importantly, this predicts that this sort of exploratory behaviour will be most prevalent if there is high uncertainty about the structure of a task, such as in the beginning of a game. This also suggests an important confound when investigating the influence of reward and uncertainty on behaviour; namely, the fact that the rewarding options will often be associated with the lowest uncertainty because they are sampled most frequently ([@bib98]). This confound highlights the importance of analysing behaviour at the beginning of an experiment when there is high uncertainty about all available options ([@bib33]; [@bib32]).

As illustrated earlier, goal-directed information-gain can be contrasted with random exploration, such as in $\epsilon$-greedy or softmax choice rules where the degree of randomness is governed by an inverse temperature parameter ([@bib85]). In its simplest form, random exploration implies that exploratory behaviour will not be informed by an agent's uncertainty about different options or its uncertainty about different parts of the world. This implies that such behaviour will not decrease uncertainty per se but may cause 'accidental' belief-updating due to random or stochastic selection of different policies. Here, this sort of behaviour is controlled by the precision of policy selection (see [Equation 4](#equ5){ref-type="disp-formula"} in Materials and methods). This means that random exploration can be understood as imprecise behaviour. Importantly, the precision of behaviour does not depend on an agent's uncertainty about the world, such that there is no predicted relationship between 'random exploration' and the time-course of an experiment (see below). [Figure 4](#fig4){ref-type="fig"} illustrates the effects of highly imprecise ($\beta = 2^{3}$, [Figure 4A](#fig4){ref-type="fig"}) and highly precise ($\beta = 2^{- 3}$, [Figure 4B](#fig4){ref-type="fig"}) types of behaviour. Note that the expected value of precision is the inverse of $\beta$, that is $\mathbb{E}\left( \gamma \right) = \frac{1}{\beta}$ ([Figure 1](#fig1){ref-type="fig"}).

![Effects of precision on behaviour.\
Same setup as in [Figure 3](#fig3){ref-type="fig"}, but now with varying levels of stochasticity. (**A**) A high degree of *random* exploration results from very imprecise behaviour ($\beta = 2^{3}$), whereas (**B**) highly precise behaviour ($\beta = 2^{- 3}$) results in very low randomness in behaviour.](elife-41703-fig4){#fig4}

### Broken 'active learning' {#s2-2-4}

Active learning predicts that the ability to learn about the environment and minimise uncertainty is a determining factor of the value of policies. This can be illustrated by disabling the influence of active learning on policy evaluation, as shown in [Figure 5](#fig5){ref-type="fig"}. In this case, policies cannot be distinguished in terms of their uncertainty reduction about model parameters. Consequently, the value of policies is determined by visiting preferred and unambiguous outcomes. This means that agents will not exhibit active learning, and the only way to learn about the environment is by accidently (randomly) sampling a non-preferred option. [Figure 5](#fig5){ref-type="fig"} illustrates this problem: here, the true reward probability of the risky option is 0.75, but in the absence of any active learning, the agent can only find out about the value of the risky option by randomly sampling this alternative. Thus, if the agent shows very precise (non-random) behaviour ([Figure 5A](#fig5){ref-type="fig"}), it is very unlikely to discover that the risky option is better than the safe option, and only by showing very imprecise behaviour ([Figure 5B](#fig5){ref-type="fig"}) the agent will be able to develop a (weak) preference for the risky option. This illustrates an intriguing point, namely that random exploration may serve an adaptive function in the absence of goal-directed exploratory behaviour, for example due to an agent's inability to evaluate its uncertainty about the world.

!['Broken' active learning (parameter exploration).\
Same setup as in [Figure 3](#fig3){ref-type="fig"}, but now with a true reward probability of 0.75 and no active learning as a determinant of the value of policies (first term of [Equation 7](#equ8){ref-type="disp-formula"}, Materials and methods section). (**A**) If behaviour is very precise ($\beta = 2^{- 3}$), the agent will never find out that the risky option is more preferable than the safe option, because there is no active sampling of its environment. (**B**) In contrast, if the agent's behaviour has a higher degree of randomness (low precision, $\beta = 2^{3}$), then it will eventually learn about the reward statistics in the risky option from randomly sampling this alternative, and infer that it is preferable over the safe option.](elife-41703-fig5){#fig5}

### Time courses of exploratory behaviour {#s2-2-5}

A general problem when investigating the role of exploration in value-based decision-making is that if an agent is allowed to move around freely, there will be a relationship between the reward statistics of an option and its associated uncertainty. Rewarding arms will be associated with a lower level of uncertainty simply because they are sampled more often ([@bib32]; [@bib33]; [@bib98]). To compare different computational architectures that might underlie exploratory behaviour and information-gain, it is therefore important to investigate the time-course of behaviour, as illustrated in [Figure 6](#fig6){ref-type="fig"} based on a true reward probability of 0.5 in many simulations of the active learning task. [Figure 6A](#fig6){ref-type="fig"} illustrates the time-course of behaviour under active learning conditioned on the concentration parameters of the A-matrix (observation model,)

![Time-course of active learning and random exploration.\
Simulations of 1000 experiments with 32 trials each under a true reward probability of 0.5. (**A**) Probability to choose the risky option as a function of the concentration parameters for high reward and no reward in the risky option under active learning. The probability to choose the risky (uncertain) option is high if there is high uncertainty about this option at the beginning of a task. Note how the probability of choosing the risky option decreases as the agent becomes more certain that the true reward probability of the risky option is 0.5 (gradient along the diagonal). (**B**) When there is no active learning but high randomness (low prior precision, $\beta = 2^{3}$), there is no uncertainty-bonus for the risky option if the agent is uncertain about the reward mapping (lower left corner). The probability to sample the risky option increases only gradually with increasing certainty about a high reward probability (gradient along x-axis). (**C**) Average probability to choose the risky option as a function of time for active learning (as in **A**), random exploration (as in **B**) and in the absence of any learning. Active learning induces a clear preference for sampling the informative (risky) option at early trials. In contrast, random exploration without active learning does not induce a preference for uncertainty-reduction at early trials, and the probability to choose the risky option quickly converges as the estimate of the true reward probability converges to 0.5 due to random sampling of the risky option. In the absence of any learning, the probability to choose the risky option is constant and reflects the precision or randomness in an agent's generative model (simulated with, $\beta = 2^{1}$).](elife-41703-fig6){#fig6}

Unsurprisingly, the agent strongly prefers to choose the risky option when she believes that the reward probability is high (right bottom corner in [Figure 6A](#fig6){ref-type="fig"}) and strongly prefers to choose the safe option if the probability of a high reward is low (left upper corner in [Figure 6A](#fig6){ref-type="fig"}). Importantly, we also observe a gradient across the diagonal, such that agents have a strong preference to choose the risky option if there is high uncertainty about its reward contingencies (i.e. both concentration parameters of the ***A***-matrix are low, lower left corner in [Figure 6A](#fig6){ref-type="fig"}). In contrast, the probability to choose the risky option is very low if the agent is very certain that the probability to receive a high reward is 0.5 (i.e. both concentration parameters of the ***A***-matrix are high, upper right corner in [Figure 6A](#fig6){ref-type="fig"}). In line with this, the probability of choosing the risky option over time under active learning shows that there is a very high preference for sampling the risky (uncertain) option in the beginning of a trial, which then monotonically decreases over time ([Figure 6C](#fig6){ref-type="fig"}).

[Figure 6B](#fig6){ref-type="fig"} illustrates the time-course of behaviour without active learning but with a high degree of random exploration (low prior precision), where the only way to learn about the true reward probabilities is by randomly sampling the risky option. The pattern of [Figure 6B](#fig6){ref-type="fig"} reflects a noisier version of [Figure 6A](#fig6){ref-type="fig"}. Aside from the larger randomness in behaviour, there is also an important difference when uncertainty about the true reward statistics is high (lower left corner): in the absence of active learning, there is no preference for the risky option when the relevant concentration parameters of the A-matrix are both low (lower left corner of [Figure 6B](#fig6){ref-type="fig"}). This also becomes apparent when looking at the time course of choosing the risky option, such that there is no initial preference for the risky option reflecting uncertainty reduction in the beginning of a trial ([Figure 6C](#fig6){ref-type="fig"}). Rather, the probability to select the risky option remains relatively stable across trials and reflects the overall level of randomness in behaviour. If there is no learning at all (i.e. the concentration parameters of the A-matrix do not change), the probability to choose the risky option is constant and simply reflects the stochasticity of individual behaviour ([Figure 6C](#fig6){ref-type="fig"}).

Hidden state exploration via active inference {#s2-3}
---------------------------------------------

In this section, we illustrate a second type of behaviour that aims at gaining information about the world, namely exploring about hidden states of a task, as reflected by the second term of [Equation 7](#equ8){ref-type="disp-formula"} (Materials and methods section). In contrast to 'model parameter exploration', which motivates *active learning* to reduce uncertainty about an agent's model of the world, 'hidden state exploration' motivates *active inference* to form accurate beliefs about the current state of the world, based on an agent's model of the task. One example of this behaviour is inferring the current context, which we illustrate in the following simulations, using a slightly adjusted version of the previous task. We now assume that the agent has learned that she could be in two possible (hidden) states in this task, namely either in a context where the risky option provides high or low probability for obtaining a reward, but this contextual information is hidden from her. However, in this version of the task, she can also choose to sample a cue before choosing the safe or risky option, which tells her about the reward probabilities (i.e. context) of the current trial.

### Model structure {#s2-3-1}

The generative model of the 'hidden state exploration' task is illustrated in [Figure 7](#fig7){ref-type="fig"}. We have used the same formalisation as in the previous model, except that the agent now performs inference about sampling the safe or risky option directly, or sampling a cue first that signifies the current context, namely a high (75%) or a low (25%) probability to obtain a reward in the risky option. In comparison to the previous generative model illustrated in [Figure 2](#fig2){ref-type="fig"}, this increases the size of the state space by the additional cue location and the (hidden) context factor, resulting in eight different (hidden) states (columns of A-matrix in [Figure 7](#fig7){ref-type="fig"}). The B-matrix encodes the transitions between different locations from the starting position of the maze; namely, sampling the cue, the safe option, or the risky option. The c- and d-vectors are defined analogously to the previous example, except that the d-vector now reflects a uniform prior about starting the maze in one of the two contexts. We did not include any curiosity-driven learning in these simulations, except that we allowed for experience-based updates of the d-vector in one simulation ([Figure 8B](#fig8){ref-type="fig"}), which describe a task in which the true state of the task can be learned gradually. Updates of the (concentration parameters of the) d-vector are implemented analogously to the updates of the A-matrix in the 'parameter exploration' example above. Note that, in principle, such updates would also allow the agent to continuously learn about the current reward probabilities of the risky option without sampling the cue first, analogously to the 'model parameter exploration' example. Importantly, however, parameter exploration will not work if the context changes rapidly, such as on a trial-by-trial basis. This provides an important illustration of the different time-courses of inference and learning (see 'comparing model parameter and hidden state exploration' section below). In the following, we will illustrate active inference in a task with a volatile and a stable context, and show how an agent fails to perform goal-directed exploration of hidden states if active inference is compromised.

![Generative model of a T-maze task, in which an agent (e.g. a rat) has to choose between a safe option (left arm) and a risky option (right arm).\
In contrast to the previous task, the rat can now be in two different contexts that define the reward probability of the risky option, which can be high (75%) or low (25%). Besides sampling the safe or risky option, it can now also sample a cue that signifies the current context. This results in a state space of eight possible states, defined by the factors location (starting point, cue location, safe option, risky option) and context (high or low reward probability in risky option). Further, there are seven possible observations the agent could make, namely being at the starting position, sampling the safe option, obtaining a/no reward in the risky option, and sampling the cue that indicates a high/low reward probability. (**A**) The A-matrix (*observation* or *emission* model) maps from hidden states (columns) to observable outcome states (rows, resulting in an 8 × 7 matrix). There is a deterministic mapping when the agent is in the starting position, samples the safe reward or samples the cue. When the agent samples the risky option, there is a probabilistic mapping to receiving a high reward or no reward that depends on the current context. In contrast to the previous example, no updates of the A-matrix take place in this task. (**B**) The B-matrix encodes the transition probabilities, that is the mapping from the current hidden state (columns) to the next hidden state (rows) contingent on the action taken by the agent, which simply changes the location of the agent. For simplicity, only the transition probabilities for the factor location are shown, which replicate across the two contexts (resulting in an 8 × 8 transition matrix). (**C**) The c-vector specifies the preferences over outcome states. In this example, the agent prefers (expects) to end up in a reward state and dislikes to end up in a no reward state, whereas it is indifferent about the 'intermediate' states (starting position or cue location). The d-vector specifies beliefs about the initial state of a trial. Here, the agent knows that its initial state is the starting point of the maze, but has a uniform prior over the two contexts. In experiments where the context is stable, this uniform prior can be updated to reflect experience-dependent expectations about the current context.](elife-41703-fig7){#fig7}

![Simulated responses during inference.\
In this experiment, the current context indicates either a high (75%) or low (25%) reward probability in the risky option. The agent can gain information about the current context of a trial by sampling a cue, which signifies the current context. (**A**) Simulated experiment with 32 trials and a random context that changes on a trial-by-trial basis: the first panel illustrates the choice of the agent at the beginning of a trial and the agent's beliefs about action selection (darker means more likely). Note that the agent always chooses to sample the cue first before choosing the safe or risky option. The second panel illustrates the outcomes of every trial (purple = safe option, green = high reward in risky option, red = no reward in risky option) and their utilities (black bars, closer to zero indicates higher utility). Note that a green or red outcome indicates that the agent has chosen the risky option after sampling the cue. Dark red and green dots indicate the current context as signified by the cue (dark red = low reward probability in risky option, dark green = high reward probability in risky option). Note that the agent only samples the risky option if the cue indicates a high reward context. The third panel shows the evolution of beliefs concerning the current state (i.e. high or low reward context). (**B**) Same setup as before, but now with a constant context that indicates a high reward probability in the risky option. Here, the agent becomes increasingly confident that it is in a high reward context, which compels it to sample the risky option directly after about one third of the experiment, whilst gathering information in the cue location in the first third of the experiment. (**C**) Time-course of the probability to sample the cue first as a function of trial number in an experiment (in 1000 simulated experiments). If the context is random, there is a nearly 100% probability to sample the cue first at every trial. In a stable context, the probability to sample the cue shows a sharp decrease once the agent has gathered enough information about the current (hidden) state.](elife-41703-fig8){#fig8}

### Active inference {#s2-3-2}

[Figure 8A](#fig8){ref-type="fig"} illustrates 'hidden state exploration' in an experiment, where the current context cannot be learned, that is changes randomly on a trial by trial basis. *Active inference* predicts that the agent will always sample the cue at the beginning of every trial to reduce ambiguity about the current hidden state (context) (first and third panel of [Figure 8A](#fig8){ref-type="fig"} and blue line in [Figure 8C](#fig8){ref-type="fig"}). The subsequent behaviour in a trial depends on the information obtained at the cue. If the cue signifies a context with high reward probability (dark green dots in second panel of [Figure 8A](#fig8){ref-type="fig"}), the agent will choose the risky option. In contrast, if the cue indicates a context with a small reward probability, she will choose the safe option.

This simulation illustrates an important difference to the active learning simulations above: in these simulations, there is nothing to be learned about the state of the world, because the current state changes randomly on a trial by trial basis. Thus, this task could not be solved by learning the reward-mapping of the risky option, because there is no knowledge about the reward statistics that could be carried over from one trial to the next. This highlights the necessity to perform trial-by-trial inference about the current state of the world, as opposed to continuous parameter learning.

[Figure 8B](#fig8){ref-type="fig"} illustrates simulations of the same task, but now with a stable context of a high reward probability in the risky option, allowing for experience-dependent updates of the agent's prior over initial contexts (parameters in the d-vector, cf. [Figure 7](#fig7){ref-type="fig"}) based on information obtained from the cue. In the first third of the experiment, we observe the same choice bias as in [Figure 8A](#fig8){ref-type="fig"}, namely a preference to sample the cue first before choosing the safe or risky option. In this experiment, however, the agent always obtains the same information from the cue location, indicating a stable environment with a high reward probability in the risky option. Once the agent becomes confident enough in its beliefs about the current context, it starts to sample the risky option without sampling the cue first (cf. red line in [Figure 8C](#fig8){ref-type="fig"}, see Appendix I for a more detailed discussion of the 'cost' of sampling the cue). Note that in contrast to the 'parameter exploration' simulations above, the agent updates its beliefs based on the (hidden state) information provided by the cue, not the actual outcome (i.e. obtaining a reward). This can be seen in the belief-updating after trial five, for instance: the agent samples the cue, which indicates a high reward probability context, and obtains no reward from the risky option. Despite the negative outcome, it increases its belief about being in the high reward context (third panel of [Figure 8B](#fig8){ref-type="fig"}), due to the information obtained from the cue.

### Broken 'active inference' {#s2-3-3}

What happens if an agent fails to perform 'hidden state exploration'? [Figure 9](#fig9){ref-type="fig"} shows simulations of behaviour when information-gain about the hidden state is not considered during policy selection. This implies that the cue location has no informative value, and is equally preferable to the starting location of the maze (because they have the same utility, cf. c-vector of [Figure 8](#fig8){ref-type="fig"}). This results in a constant preference for the safe option, because this agent is insensitive to the informative value of the cue. In the example illustrated in [Figure 9](#fig9){ref-type="fig"}, the agent fails to acknowledge that there is a high reward probability in the risky option and continues to prefer the safe option. Analogously to [Figure 6](#fig6){ref-type="fig"}, the only way to sample the cue (and other options) more frequently would be by increasing the randomness in behaviour.

!['Broken' active inference.\
Same setup as in [Figure 8](#fig8){ref-type="fig"}, but now without a 'hidden state exploration' bias in policy selection (second term of [Equation 7](#equ8){ref-type="disp-formula"}, Materials and methods section). The agent fails to learn that there is a constant high reward probability for the risky option because it does not gain information about the current hidden state (context). Consequently, it continues to prefer the safe option. The probabilities to sample different options (first panel) now simply reflect the agent's prior preferences as encoded in the c-vector (cf., [Figure 7](#fig7){ref-type="fig"}).](elife-41703-fig9){#fig9}

Comparing model parameter and hidden state exploration {#s2-4}
------------------------------------------------------

We have shown that distinct response profiles for exploratory behaviour arise from different types of uncertainties, namely uncertainty about model parameters and uncertainty about hidden states. Active learning arises when agents choose options that decrease their uncertainty about the correct parameterisation of the world, such as the reward probability in a risky option. Active inference, on the other hand, aims at gathering information about the current (hidden) state of the world, for example the current context. These behavioural tendencies can align or result in opposing predictions for behaviour in different tasks. In this section, we provide direct comparisons of *active learning* (parameter exploration) and *active inference* (hidden state exploration) in different variants of the tasks introduced above. In these simulations, we use an identical parameterisation for these two types of behaviour except that active learning is only governed by the first and third terms of [Equation 7](#equ8){ref-type="disp-formula"} (model updating and realising preferences) and active inference is only governed by the last two terms of [Equation 7](#equ8){ref-type="disp-formula"} (realising preferences and minimising ambiguity). We contrast these types of goal-directed exploration with a 'random exploration' agent with a higher degree of stochasticity in its behaviour (see Materials and methods for details), but no bias for (goal-directed) parameter or hidden state exploration, which serves as a baseline for the other two types of exploratory behaviour. Thus, this agent will be solely governed by the (third) realising preferences term in [Equation 7](#equ8){ref-type="disp-formula"}, but can still update its model of the task due to randomly sampling different options. We compare these agents in situations where the risky option is either advantageous (reward probability of 85%) or disadvantageous (reward probability of 15%). We use the average cumulative reward in 100 simulated experiments with 32 trials each as a measure of performance for these three agents, where we define a low reward as one food pellet and a high reward as four food pellets that could be obtained by the agent.

[Figure 10](#fig10){ref-type="fig"} depicts the behaviour of these three agents in the task illustrated at the top of [Figure 2](#fig2){ref-type="fig"}, where a rat has to choose between a certain safe and an uncertain risky option. In line with the previous simulations, we observe that the 'parameter exploration' agent quickly learns to prefer the risky option if there is a high reward probability (left upper panel of [Figure 10](#fig10){ref-type="fig"}) and to avoid the risky option if there is a low reward probability (right upper panel). The 'random exploration' agent also converges on these estimates, but much slower. Interestingly, we observe that the 'hidden state exploration' agent fails to adjust to the reward statistics of this task. This is because, from the perspective of this agent, there is no hidden state to explore that could be informative about the current reward statistics. The only way to learn about the statistics of the task would be by sampling observations that are a priori associated with high ambiguity. Such observations, however, are aversive for a pure *active inference* agent, because they are associated with a high entropy (ambiguity) in their mapping to underlying hidden states, which an *active inference* agent is compelled to *minimise*. Consequently, it will always sample the safe option in this task. This induces a performance pattern in which the 'parameter exploration' agent is superior to the other two agents if the reward probability in the risky option is high, but not if the reward probability is low and the best course of action is to sample the safe option (left and right lower panel of [Figure 10](#fig10){ref-type="fig"}).

![Response profiles of a 'state exploration', 'parameter exploration' and 'random exploration' agent in a task that requires learning.\
In the task described at the top of [Figure 2](#fig2){ref-type="fig"}, only the 'parameter exploration' agent (no state exploration) flexibly adapts to the current reward statistics, whilst the 'state exploration' (no parameter learning) agent fails to form a representation of the task statistics. Upper panel: probability for each of the three agents to choose the risky option if it is associated with a high (left, 85%) or low (right, 15%) reward probability. Lower panel: average cumulative reward (measured in pellets, where low reward = one pellet and high reward = four pellets) in 100 simulated experiments in a high (left) and low (right) reward probability setting, indicating an advantage for the 'parameter exploration' agent when the risky option is associated with a high reward probability.](elife-41703-fig10){#fig10}

In situations where state exploration is a necessary means for good performance, we should expect a state exploration agent to outperform the other two. [Figure 11](#fig11){ref-type="fig"} compares the three agents in the task introduced in [Figure 8](#fig8){ref-type="fig"}, where the current context (high or low reward probability in the risky option) changes unpredictably on a trial-by-trial basis but can be inferred from sampling a cue that signifies the current context. This illustrates the opposite situation to [Figure 10](#fig10){ref-type="fig"}: here, the 'state exploration' agent clearly outperforms the 'parameter exploration' and 'random exploration' agent. Importantly, this illustrates that when the context changes randomly, there is no knowledge that could be carried over from one trial to the next. Thus, *active learning*, which focuses on making observations that allow to transfer insights from one trial to the next, will be ineffective. In contrast, *active inference*, which focuses on making observations that allow for precise inference about the current hidden state (context) at a trial, provides an effective solution to this problem (cf. [Figure 7](#fig7){ref-type="fig"}), such that this agent always correctly infers the current context of a trial and, in consequence, whether to sample the safe or risky option.

![Response profiles of a 'state exploration', 'parameter exploration' and 'random exploration' agent in a task that requires inference.\
In the problem introduced in [Figure 7](#fig7){ref-type="fig"}, where an agent can infer the randomly changing context from a cue, 'parameter exploration' will be ineffective, because there is no insight that could be transferred from one trial to the next. 'State exploration', in contrast, provides an effective solution to this task, because it allows an agent to infer the current context on a trial-by-trial basis. Left panel: probability to choose the informative cue at the beginning of a trial. This shows that only the 'state exploration' agent correctly infers that it has to sample the cue at the beginning of every trial to adjust its behaviour to the current context (defined as a high or low reward probability in the risky option). Consequently, it outperforms the 'parameter exploration' and 'random exploration' agent in its cumulative earnings in this task (right panel).](elife-41703-fig11){#fig11}

[Figure 12](#fig12){ref-type="fig"} compares the three agents in the task introduced in [Figure 8](#fig8){ref-type="fig"}, which has the same design as the previous example but now with a stable (high or low) reward context across the entire experiment. This task can be solved with both active learning and active inference. The active learning agent has a high bias for sampling the risky option in the beginning of the experiment, and will thus learn whether it is associated with a high or low reward probability. The active inference agent has a strong preference for sampling the cue in the beginning of the experiment, but can adjust its prior over the current context due to stable (high or low reward) feedback from the cue (as illustrated in [Figure 8](#fig8){ref-type="fig"}). Thus, both the 'state exploration' and 'parameter exploration' agent will clearly outperform the 'random exploration' agent.

![Response profiles of a 'state exploration', 'parameter exploration' and 'random exploration' agent in a task that requires learning or inference.\
Same problem as in [Figure 11](#fig11){ref-type="fig"}, but now with a stable high or low reward context (as in [Figure 8B](#fig8){ref-type="fig"}). This task can be solved by either sampling the risky option to learn about its reward statistics ('parameter exploration'), or sampling the cue to learn about the current context and adjusting the prior over contexts due to constant feedback from the cue ('state estimation'). This can be seen in the response profiles in the upper panel, such that the 'parameter exploration' agent has a strong preference for sampling the uncertain risky option in the beginning of the trial (left and right), while the 'state exploration' agent only starts sampling the risky option at the beginning of the trial if it has sampled the cue several times before, which always indicates a high reward context (left, cf. [Figure 8](#fig8){ref-type="fig"}﻿). This leads to a similar performance level of these two agents as measured by the cumulative reward, which exceeds the performance of the 'random exploration' agent (lower panel).](elife-41703-fig12){#fig12}

In sum, we have outlined different types of goal-directed exploratory behaviour that emerge under a probabilistic account of behaviour. In tasks where there is no hidden state that can inform an agent about current reward contingencies, an active learning agent performing parameter exploration will outperform an active inference agent performing hidden state exploration. In contrast, if there is an informative hidden state that changes unpredictably, active inference outperforms active learning. Only if there is a stable hidden state for a longer period in a task, both active learning (by learning from observations) and active inference (by gathering information about the hidden state) will lead to adaptive behaviour. This illustrates an important difference between active learning and active inference. Active learning is most efficient over longer timescales if information remains relevant over trials, whereas active inference is most efficient over shorter timescales, when contingencies can change on a trial-by-trial basis.

This concludes our investigation of the different response profiles of parameter exploration and hidden state estimation in different tasks (but see appendix for further simulations on the effect of other parameters on these behaviours). Next, we explore how these types of goal-directed exploration relate to empirical results on information gain in animals. We refer to Appendix 2 for a discussion of other computational frameworks of curiosity and exploration and their relation to the computational architecture we have presented here.

Behavioural and neuronal predictions {#s2-5}
------------------------------------

In this section, we will discuss key behavioural and neuronal predictions of active inference and active learning, serving two purposes. First, we present testable predictions for behaviour and the neuronal mechanisms of active learning and active inference. Second, we discuss empirical evidence in relation to these predictions. Despite using a 'rat' as an exemplar agent above, the model-based predictions reported here are not restricted to rodents. Consequently, we will discuss various predictions by drawing from the entire animal literature.

### Active inference and active learning in behaviour {#s2-5-1}

While active inference and active learning provide a general and flexible architecture for inferring individual differences in behaviour (see appendix), it nevertheless makes specific predictions about the interplay of exploitative and exploratory behaviour. A key prediction is that information should have an *additive* effect in relation to reward (cf., [Figure 1](#fig1){ref-type="fig"} and [Equation 7](#equ8){ref-type="disp-formula"}, Materials and methods section). This means that an agent's reward- and information-sensitivity can be manipulated separately. Importantly, there is an *implicit* weighting for the tendency towards exploitation and (goal-directed) exploration. This weighing is determined by two factors: the precision of prior preferences and the degree of uncertainty about the world. If there is a high degree of uncertainty in an agent's observation model or beliefs about the current state, there will be a strong motivation for (intrinsic) active learning or active inference, respectively. If an agent's preferences over outcomes are very precise, on the other hand, then the (extrinsic) 'realising preferences' component will have a stronger impact on policy selection. These precision and uncertainty effects are distinct from the precision of policy selection that determine an agent's randomness -- akin to an inverse temperature parameter in softmax response rules.

The implicit weighting between (intrinsic) information and (extrinsic) reward predicts that an agent's information-seeking behaviour will not be directly informed by the agent's utilities (cf., [@bib100], Box 2); for example, by being more sensitive to information about highly rewarding options. This implies that states can become 'interesting' that are entirely 'uninteresting' from an extrinsic reward perspective. However, empirical evidence shows that highly rewarding options may be more *salient* than options that are associated with a low reward, which is an important interaction that we will discuss in more detail below ([Figure 13](#fig13){ref-type="fig"}).

![Dynamic relationship between reward and information.\
(**A**) Empirical findings from [@bib9] suggest a modulatory effect of reward on the value of information. The higher the expected reward of the options, the more do monkeys prefer the option with the additional information about the reward identity during the delay period. For example, the preference for the informative option will be stronger if both options offer 315μL of water compared to both options offering 75μL of water. (**B**) Assuming a constant salience of different offer amounts (i.e. a constant precision of policy selection), active learning (and inference) predicts a preference for the informative option that is constant across different reward amounts (simulated from 0 to 10 pellets). That means that the preference for the informative option is the same when both options offer 1 or 10 pellets, for instance. (**C**) When taking a dynamic change of the precision of policy selection for different offer amounts into account (ranging parametrically between $\beta = 2$ for zero pellets in both offers and $\beta = 2^{- 1}$ for 10 pellets in both offers), the simulated preferences match the empirical results from [@bib9]. This highlights the importance of the interplay between the (extrinsic and intrinsic) values of options in active learning and active inference.](elife-41703-fig13){#fig13}

Another prediction for behaviour concerns the interplay of exploration and exploitation over time. In the simulations above, an agent's preference distribution is assumed to be stable, whereas her uncertainty about the world changes. Consequently, goal-directed information-gain will be prevalent at the beginning of a trial, whereas exploitative behaviour and stochastic action selection remain constant throughout a task. Note that we have focused on a simple one-shot active learning or two-shot active inference task; however, the present framework also accommodates exploration-exploitation trade-offs for larger policy depths, based on the sum of the expected free energies over time ([Equation 4](#equ5){ref-type="disp-formula"}, Materials and methods section). This will make an agent sensitive to large information (or reward) gains at later time-steps and not just the subsequent step (i.e., the agent will not be myopic).

Several lines of experimental work suggest that animals are sensitive to information gain, and assign a value to information that competes with a reward-based (extrinsic) value of an option. Often, these behavioural tests are based on 'cue signalling tasks'. In these tasks, an animal chooses between two options followed by a reward after a delay. Crucially, in one of these options the outcome is signalled to the animal during the delay; such that the animal can resolve its uncertainty about the upcoming reward. This additional signal -- during the delay -- has no instrumental value and does not shorten the delay period. It is debatable to what extend this task truly reflects an explicit value of information in exploratory (curious) behaviour as simulated above ([@bib95]); rather than just a change in the anticipation of rewards that may itself be attractive ([@bib42]). Either way, however, this paradigm assesses an animal's preference for non-instrumental information, as opposed to pure exploitative behaviour. In the following, we use empirical paradigms inspired by the 'cue signalling task' to discuss behavioural and neuronal evidence for the encoding of 'information' implicit in active inference and learning.

Past work has shown that animals assign a value to gaining information about the outcome in such 'cue signalling tasks'. Pigeons appear to prefer (on average) a two pellet option over a 'safe' three pellet option, if the two pellet option includes an additional signal about the reward size during the delay period ([@bib103]; [@bib102]). Analogously, starlings show a preference for an option with a lower reward probability, if there is an informative cue in the delay period ([@bib93]). This effect is stronger if the cue is shown shortly after the animal's choice, as opposed to close to the outcome delivery. The same -- from an economic perspective 'suboptimal' or \'bounded rational\' behaviour -- has been found in rats ([@bib18]), monkeys ([@bib9]; [@bib13]; [@bib78]), and humans ([@bib42]).

These empirical results suggest that non-instrumental information provides an additional value to an option, in addition to its external reward. Importantly, this additional informative value can render an option more valuable even though its objective (economic or extrinsic) value is lower than alternative options. As previously noted, one central prediction from the computational framework presented here is that information provides an additive value to an option, which is evaluated alongside its extrinsic value. This resonates closely with the above results, where the signalling cue provides an additional value to an option and makes it more likely than alternative options that have higher extrinsic (economic) value.

However, the assumption that the value of an option reflects the linear sum of its extrinsic and intrinsic value may not always be true. Importantly, [@bib9] have found that monkeys are *more* sensitive to information if the option has higher extrinsic value (see [Figure 13A](#fig13){ref-type="fig"}). Using water as reward, they report that "the value of information may have a multiplicative effect on the value of water amount, just as probability does in a conventional gambling task, time does in a discounting task, or effort does in an effort task''. That means that the more water was at stake for a given gamble, the more monkeys preferred to choose the option that included a signal during the delay period before receiving the outcome.

[Figure 13](#fig13){ref-type="fig"} reproduces the effects reported by Blanchard et al., based on an active learning agent (assuming that now there are two options with a 0.5 probability for obtaining a reward, but with an information bonus for one of the two options). We find a strong behavioural bias towards the informative option, confirming the experimentally observed information bias in monkeys. This is in line with the additive effect of information on the value of a policy as predicted by active learning. [Figure 13B](#fig13){ref-type="fig"} shows that this additive effect results in a constant preference for sampling the option that is associated with higher uncertainty, irrespective of the reward magnitude of the two options (simulated for 0 to 10 pellets). In other words, the agent will consistently prefer the uncertain option if the objective values are the same (diagonal of [Figure 13b](#fig13){ref-type="fig"}). This agent, however, is insensitive to the total amount of reward, such that it will exhibit the same preference for the informative option if both options offer 1 or 10 units of reward, for instance, which is in contradiction with Blanchard et al.'s empirical findings. Importantly, active learning and active inference can also account for an interaction between reward and information, as reported in the original results (shown in [Figure 13A](#fig13){ref-type="fig"}). A supra-additive effect (as seen by Blanchard et al.) is expressed when taking a dynamic nature of the precision of policy selection into account. Previous studies have shown that reward or information modulate attention (by acting as a salience signal), which in active learning and active inference is reflected by a change in the level of the precision in policy selection ([@bib24]; [@bib21]; [@bib58]; [@bib75]). This is in line with previous work on curiosity and exploration, where attention and salience have been identified as mechanisms that modulate curiosity. For example, Kidd et al. have found that infants direct less attention towards information about overly simple or overly complex stimuli ([@bib47]; [@bib48]), suggesting that they 'implicitly decide to direct attention to maintain intermediate rates of information absorption' ([@bib49]). Further, it has been shown that a neuronal effect for novelty critically depends on attention towards the reward-predicting feature of a stimulus, as opposed to when subjects had to make reward-unrelated judgements about stimuli ([@bib52]). Importantly, these results suggest that attention towards the rewarding properties of a stimulus modulate the effects of its informative value.

[Figure 13C](#fig13){ref-type="fig"} illustrates this point by assuming a change in the precision of policy selection as a function of the value of options (precision ranging parametrically from $\beta = 2^{1}$ for zero pellets in both options to $\beta = 2^{- 1}$ for 10 pellets in both options). Assuming policy precision is itself optimised, our model expresses a remarkably similar pattern to that observed in Blanchard et al., confirming the supra-additive effect of information. Thus, from the perspective of active learning (and inference), the empirical observation of a modulatory effect of reward on information speaks to an interplay between the value of different options, which provide empirically testable behavioural and neuronal predictions (see open questions below). Note that in the simulations of [Figure 13C](#fig13){ref-type="fig"} we varied the (hyper-)prior ($\beta$ in [Figure 1](#fig1){ref-type="fig"}) on precision in analogy to our simulations above. An extensive body of work, however, investigates the time-sensitive updating of precision ($\gamma$ in [Figure 1](#fig1){ref-type="fig"}) itself by treating it as a hidden state that can be inferred ([@bib23]; [@bib26]; [@bib29]), to which we will return below.

### Neuronal mechanisms of active inference and active learning {#s2-5-2}

While the focus of this work is on the computational mechanisms of exploratory and curiosity-driven behaviour, the theoretical framework of active learning and inference also makes predictions about the neuronal encoding of information and ensuing curiosity. It is thereby crucial to understand how (i) (expected) intrinsic and extrinsic value are represented neuronally, and (ii) how their neuronal encoding allows the processing and *updating* of information during active sampling. In particular, we will focus on two key results about the neuronal basis of information-gain and curiosity that have been reported across different species; namely, the encoding of information in subcortical dopaminergic structures and the orbitofrontal cortex (OFC).

The OFC has been reported to encode relevant task variables (predictions) during reward-guided decision-making in an orthogonal manner, such as the expected reward and the reward probability of different options ([@bib65]; [@bib69]; [@bib70]; [@bib82]; [@bib99]). Most importantly, [@bib9] have detected different populations of neurons in OFC that encode expected reward (water) and expected information. This implies that OFC neurons signal reward and information in an independent and not integrated way, such that ﻿OFC may serve as a kind of workshop that represents elements of reward that can guide choice but not a single domain general value signal\" ([@bib49]). This is an important observation, because exactly this form of neuronal representation is predicted by the construction of an additive value signal based on active inference and learning, and thus makes OFC a key candidate for the encoding of extrinsic and intrinsic value of different options as predicted under this framework ([Equation 7](#equ8){ref-type="disp-formula"} in Materials and methods).

A second key candidate for the neuronal implementation of active inference and learning is the dopaminergic midbrain. Dopamine is known to play a key role in orchestrating the cost-benefit trade-off implicated in the active inference examples above ([@bib37], see Appendix 1 for a more detailed discussion). In addition, dopamine neurons have been shown to encode 'information prediction errors' analogously to 'reward prediction errors' ([@bib57]; [@bib72]). [@bib13] found that dopaminergic neurons signal the information content conveyed by an informative cue in a cue signalling task, just as they signal unexpected (omissions of) reward. Importantly, this suggests that these neurons did not differentiate between (extrinsic) reward and (intrinsic) information. Second, a more recent study has shown that dopamine neurons signal prediction errors in reward as well as sensory prediction errors about reward identity that are orthogonal to the reward magnitude ([@bib89]). These results suggest that the sum firing of dopamine neurons may reflect a 'common currency' for prediction errors about task information and extrinsic reward. Similar signals in dopamine-rich midbrain regions have been implicated in recent studies in humans ([@bib12]; [@bib41]; [@bib61]; [@bib75]).

These empirical observations above are closely aligned with the formalism of active inference and learning as illustrated here. In the setting of active inference and learning, the function of dopamine has been linked to the role of the precision of policy selection ([@bib26]; [@bib24]). The role of this precision is twofold: as illustrated above, the (hyper-)prior on precision ($\beta$ in [Figure 1](#fig1){ref-type="fig"}) reflects the overall level of randomness (goal directedness) in behaviour. Additionally, precision is updated on a trial-by-trial basis based on variational (approximate) inference (not discussed or simulated above). These variational precision updates have the form of a prediction error between the prior and posterior expected free energy of policies (as described in [Figure 1](#fig1){ref-type="fig"} or [Equation 7](#equ8){ref-type="disp-formula"} in Materials and methods, see [@bib29] for a detailed treatment and derivation of these variational updates). In other words, the predicted dopamine responses will reflect the difference between the expected (prior) and actual (posterior) reward, model update and knowledge about hidden states (i.e. the difference between prior and posterior beliefs about the value of a policy). These predictions for dopaminergic signals correspond closely with empirical results reported in ([@bib13]; [@bib89]), since an 'information' or 'identity' prediction error results from the difference between prior and posterior beliefs about model parameters and hidden states.

Dopaminergic neurons are a key target area of OFC, and it has been hypothesised that the prediction error signal in dopamine neurons may critically rely on OFC input ([@bib49]; [@bib88]), and that error-driven learning critically depends on the interplay between those two regions ([@bib44]; [@bib87]). Intriguingly, these speculations resonate with the fact that it required both the (intrinsic and extrinsic) value of options as well as the precision of policy selection in [Figure 13C](#fig13){ref-type="fig"} to reproduce the behavioural effect reported by Blanchard et al. ([Figure 13A](#fig13){ref-type="fig"}). Taken together, these simulations and empirical results suggest that active inference and active learning may critically depend on a factorised (intrinsic and extrinsic) value representation in OFC and a unified update signal in dopaminergic nuclei.

It is important to note that, besides the encoding of information in the OFC and dopaminergic nuclei, the physiological basis of exploration and active sampling has also been associated with other neuronal mechanisms. There has been much recent interest in the neuronal basis of active sensing in animals, such as whisking ([@bib16]; [@bib17]; [@bib36]; [@bib68]; [@bib100]). Further, in humans exploratory choices and information gain have been correlated with activity in the insula and dorsal anterior cingulate cortex ([@bib10]; [@bib51]; [@bib60]; [@bib92]) as well as the rostrolateral prefrontal cortex ([@bib5]; [@bib20]; [@bib54]).

### Outstanding questions {#s2-5-3}

While some of the key predictions from active learning and inference are closely aligned with empirical results, open questions remain, which we briefly outline below.

-   It remains to be established to what extent active learning and active inference are mechanisms dissociable in behaviour and brain function, and to what degree these mechanisms make use of different cognitive and physiological resources. For instance, it is unclear whether the preference for advance information in the 'cue signalling task' can be attributed to active learning or active inference. One possible way to dissociate these processes is by investigating the time-course of information-seeking behaviour. Active learning predicts a decrease of exploratory behaviour over time, because the agent's uncertainty over its observation model decreases with accumulated sensory experience. Active inference does not necessarily predict a decrease in information seeking in tasks where there is no enduring context that could be learned ([Figure 7](#fig7){ref-type="fig"}). Under such circumstances, active inference predicts a constant preference for sampling a cue (which appears more in line with empirical results from the 'cue signalling task').

-   Timing effects have been shown to modulate information gain behaviour in the 'cue signalling task', such as a stronger effect of an informative cue right after a choice -- as opposed to closer in time to the presentation of the outcome ([@bib93]). Our framework currently makes no predictions about such temporal effects but could well be extended to accommodate such timing effects.

-   Similarly, in the framework presented here one would not expect to see horizon effects in behaviour, such that information about the task becomes more valuable with an extended temporal horizon. This contrasts with empirical results on exploration ([@bib98]). It will be important for future work to accommodate such effects, for example, in terms of an (inverse) discounting parameter for information.

-   Active inference and active learning predict a factorised value representation in its neuronal encoding, such as in OFC neurons. Importantly, in a task where animals can gain information about models and states, 'value' neurons should exhibit a factorised representation for the expected information about model parameters, states and reward. This is in line with but goes beyond a factorised representation of information and value as reported elsewhere ([@bib9]).

-   If the value of a policy is constituted by potential information about models, states and reward, then we would expect to see a prediction error for these three quantities. For example, dopamine neurons should signal the difference between expected and actual reward, but also between the expected and actual information about model parameters and hidden states (in line with [@bib89]), for instance). Further, given that information about models and states as well as reward are measured in a common currency (i.e., expected free energy), one would expect to see trade-offs between those quantities. For example, one would expect a positive dopaminergic response for a mildly aversive but highly informative outcome.

-   Our simulations predict that the supra-additive effect found by Blanchard et al., depends on the interplay between dopaminergic neurons and neurons in the OFC. This implies that if one disrupts dopaminergic input after extensively training an animal on the task, OFC neurons should reflect an additive ([Figure 13B](#fig13){ref-type="fig"}) but not supra-additive ([Figure 13C](#fig13){ref-type="fig"}) effect of reward and information.

Learning about the structure of a task, besides maximising extrinsic reward, likely depends on a yet unknown integrated circuit of neuronal systems. For example, it has been shown that representations of task structure in OFC critically depend on input from the ventral subiculum ([@bib97]), but the neuronal encoding that underlies structure learning in the hippocampal formation, OFC and neuromodulatory systems (and their interaction) is largely unknown.

Discussion {#s3}
==========

We have illustrated the emergence of active inference and active learning when casting choice behaviour as probabilistic inference. Under the assumption that behaviour maximises model evidence or (equivalently) minimises surprise over future outcomes, this implies that choice behaviour will reflect a tendency to fulfil preferences and maximise utility, but also to minimise uncertainty about the current state of the environment and the relevant task contingencies. Whilst the tendency to fulfil ones preferences reflects exploitative behaviour, uncertainty reduction induces exploratory behaviour. We have contrasted such 'goal-directed' exploratory behaviour with 'random' exploration caused by imprecise and stochastic behaviour that is unrelated to an agent's uncertainty about the world.

This perspective makes specific predictions for behaviour. In particular, it introduces a distinction between the uncertainty about current states, which can be resolved by active inference, and uncertainty about model parameters, which can be resolved via active learning. Both uncertainties motivate goal-directed exploration but make different predictions for actual decision-making. Minimising the uncertainty over hidden states predicts that agents will seek observations from which there is a clear and precise mapping to the underlying hidden state, such as moving to a vantage point to infer the location of prey or sampling a cue that allows to infer the current context. Importantly, this sort of uncertainty reduction depends on a particular representation of the structure of the task and a particular parameterisation of that representation, which allows an agent to assess the mapping from observations to hidden states. We argue that agents are also driven by minimising the uncertainty about this parameterisation itself, as illustrated in the first simulations on 'parameter exploration'. Minimising the uncertainty over model parameters can even result in behaviour that conflicts with minimising the uncertainty over hidden states -- in situations where agents try to sample options that are associated with high ambiguity but also with high novelty or information gain. Consequently, a key prediction for behaviour is that the uncertainty about contingencies will modulate the effect of uncertainty about hidden states on behaviour. An option will be very interesting (i.e. informative) if its outcomes are ambiguous due to high uncertainty about the mapping from this option to possible outcomes, but the same option will be highly aversive if the agent is very certain that it leads to ambiguous outcomes.

In other instances, 'model parameter exploration' and 'hidden state exploration' can motivate similar types of behaviour. Our simulations, however, highlight an important conceptual distinction between active learning and active inference in their respective time courses. As mentioned above, it is possible to cast our 'hidden state exploration' example as an active learning problem, if we assume that the current context is stable enough to be learned over time. A key requirement for *learning* the context, however, is that it is possible to carry information from one trial to the next. If this continuity is broken, for example by changing the context randomly on every trial, the agent has to rely on active inference in order to gain information about the task. Thus, our framework predicts that active learning will be particularly useful if there are stable regularities or rules in the world that can be learned. Active inference, on the other hand, will be useful if behaviour has to adapt to trial-by-trial changes. In other tasks, active inference and active learning may interact, such as by learning about specific contingencies within a particular context. For example, imagine your favourite craft beer brewery introduces a novel beer based on the flavour of coffee and oranges. This might present a suitable instance for actively learning about the parameterisation of your preferences for coffee and orange flavoured beer, resulting in a large curiosity-bonus for this choice. However, you might be aware that you have a strong preference for Lager over Stout. Consequently, it might be useful to actively infer the hidden state of the novel beverage by asking the bartender what sort of beer you will obtain before placing your curiosity-driven order.

These considerations highlight the distinction between 'goal-directed' exploratory behaviour in the form of minimising uncertainty about hidden states or model parameters, 'random' exploratory (i.e., imprecise) behaviour and exploitative decision-making. The trade-off between these behavioural tendencies is governed by their relative precision. For example, if an agent strongly prefers one particular outcome over all other outcomes, she will display predominantly exploitative behaviour with the aim of attaining this outcome. In contrast, if there is one option that is associated with very high uncertainty about its mappings to outcomes, behaviour will be dominated by sampling that option until its associated uncertainty is resolved. Our simulations also illustrate that random exploration becomes adaptive if active learning or active inference is broken (or impossible). If the uncertainty about model parameters and hidden states fails to inform behaviour, the only way to learn about the world is through a higher degree of random sampling of different options. Our simulations have shown that this is the only way to (slowly and inefficiently) learn about the advantage of novel options in the absence of goal-directed exploratory behaviour. Further, it is important to note that these types of exploration themselves depend on a model of the task, such as an observation model or a model of the transitions between states. It will be a key challenge for future work to understand how agents build and compare these models in the first place, which provide the basis for inference and learning.

The distinction between active learning and active inference resonates with previous accounts of minimising different types of uncertainty, for example, the difference between unexpected and expected uncertainty ([@bib101]). However, the distinction between active learning and active inference emphasises the difference between uncertainty about model parameters and uncertainty about (hidden) states. This distinction can also be thought of as different *modes* of addressing different types of uncertainties. For example, an agent could reduce her unexpected uncertainty ('is the reward probability 50% or 99%?') via actively learning the 'reward parameterisation' of an option or via actively inferring the 'reward state'. Whilst active inference can often be a faster and more efficient way of reducing uncertainty, it also requires additional (structural) knowledge about the task, for example, that there is either a 50% or 99% 'reward probability state' but nothing in-between. Likewise, an agent can arrive at an accurate estimate of the expected uncertainty of an option ('there is a 50% chance that there will be a reward') via active learning and accumulating evidence that the true 'reward parameter' is 0.5, or via active inference and forming a precise belief that the current 'reward state' is 0.5.

This framework also promises a refined understanding of goal-directed cognitive deficits within the spectrum of neuropsychiatric disorders and accompanying animal models. For example, individuals diagnosed with Schizophrenia and schizoaffective disorders are reported to suffer from cognitive deficits associated with both active inference and active learning ([@bib50]; [@bib59]; [@bib94]; [@bib96]). However, a specific characterisation of how diagnosed individuals differ in their information gain during adaptive behaviour has remained elusive. In a scenario where an individual suffers predominantly from working memory deficits or contextual integration failures, active inference may become impaired, resulting in reduced adaption to task contingencies. On the other hand, reduced efficiency in trial and error learning and attentional outcome deficits may speak to impairments predominantly in active learning. Whilst active inference and active learning may not always be entirely independent, this framework proposes the translation of individual performance into measurable parameters that reflect these different strategies in behaviour. A successful empirical dissociation of these behavioural phenotypes promises a refined assessment of cognitive deficits due to a more accurate understanding of the underlying neuropathological mechanisms, resulting in improved differentiability and predictability of cognitive dysfunction in individual subjects.

In summary, we have highlighted the distinction between learning about the world as a consequence of random or imprecise behaviour ('random exploration') and goal-directed uncertainty reduction. Further, we have shown how these types of behaviour arise when casting behaviour as probabilistic inference. We have identified two types of goal-directed exploratory behaviour, namely *active learning* that reduces the uncertainty that relates to the parameterisation of an agent's generative model of the world, and *active inference* that reduces uncertainty about hidden states in the world given an agent's generative model. This former type of uncertainty-reduction will compel an agent to sample novel contingencies that enable learning about the true mappings and thus induce 'model parameter exploration'. The latter type of uncertainty-reduction about hidden states motivates agents to sample salient observations that allow for precise, unambiguous inference about the current state, thus performing 'hidden state exploration'. We have shown that this distinction makes relevant predictions for the predominance of different types of exploration in different tasks depending on whether active learning or active inference is more adaptive. This will be critical for understanding the different motives underlying curiosity and information-seeking in animals and artificial intelligence, and provides mechanistic insight into suboptimal choice behaviour arising from broken *active inference* or *active learning*.

Materials and methods {#s4}
=====================

The generative model illustrated in [Figure 1](#fig1){ref-type="fig"} implies that outcomes (observations) are generated in the following way: first, a policy is selected using a softmax function of expected free energy for each policy (see below), which also depends on the agent's degree of randomness (precision) in behaviour. Sequences of hidden states are then generated based on the probability transitions specified by the selected policy. These hidden states then generate outcomes. State inference corresponds to inverting the generative model given a sequence of outcomes, while (parameter) learning corresponds to updating the mapping between hidden states and outcomes. Consequently, 'perception' corresponds to inferring (optimising) expectations about hidden causes with respect to variational free energy, while learning corresponds to accumulating concentration parameters. These variables constitute the sufficient statistics of the approximate posterior beliefs, denoted by the probability distribution $Q(s,\pi,A)$, where $s,\pi,A$ are the hidden or unknown variables (see below).

Variational free energy and inference {#s4-1}
-------------------------------------

In variational Bayesian inference (*model inversion*), one has to specify the form of an approximate posterior distribution. This form uses a mean field approximation, in which posterior beliefs are approximated by the product of marginal distributions over hidden causes. Here, this approximate posterior takes the following form:$$\begin{matrix}
{Q(\overset{\sim}{s},\pi,A)} & {= Q(s_{1}|\pi)...Q(s_{t}|\pi)Q(\pi)Q(A)} \\
{Q(s_{t}|\pi)} & {= Cat(s_{t})} \\
{Q(\pi)} & {= Cat(\pi)} \\
{Q(A)} & {= Dir(A)} \\
\end{matrix}$$where Cat refers to a categorical distribution and Dir to a Dirichlet distribution. Note that we do not address belief updating about precision ($Q(\gamma)$) in our simulations, which have been discussed in detail in previous work ([@bib23]; [@bib30]).

Having specified a Markovian generative model and the approximate posterior, one can define the variational free energy and resulting update equations that are used to infer hidden causes, as well as the expected free energy over future states under policies, which defines the value of a policy.

Variational Bayesian inference implies that by minimising variational free energy with respect to the specified posterior $Q(x)$ over hidden causes $x$ (where $x = \{ s,\pi,A\}$ in our example) we approximate the true posterior $P(x|\overset{\sim}{o})$:$$$$

There are several equivalent expressions for variational free energy: one is in terms of the entropy minus energy:$$\begin{matrix}
F & {= \mathbb{E}_{Q(x)}\lbrack\ln Q(x) - \ln P(x,\overset{\sim}{o})\rbrack} & \\
 & {= \mathbb{E}_{Q(x)}\lbrack\ln Q(x) - \ln P(x|\overset{\sim}{o}) - \ln P(\overset{\sim}{o})\rbrack} & \\
 & {= D_{KL}\lbrack Q(x)||P(x|\overset{\sim}{o})\rbrack - \ln P(\overset{\sim}{o})} & \\
\end{matrix}$$where $\overset{\sim}{o} = (o_{1},\ldots,o_{t})$ denotes observations up until the current time $t$. Because the (KL) divergence cannot be less than zero, the last equality means that free energy is minimised when the approximate posterior $Q(x)$ becomes the true posterior $P(x|\overset{\sim}{o})$. In this case, the variational free energy becomes the negative log evidence for the generative model.

Rewriting [Equation (2)](#equ3){ref-type="disp-formula"} shows that variational free energy can also be written as$$$$

This implies that minimising variational free energy maximises the expected likelihood of observations under the approximate posterior ('accuracy') whilst minimising the divergence between the approximate and true distribution over hidden causes ('complexity'). Having defined the objective function, the sufficient statistics encoding posterior beliefs can be updated by minimising variational free energy, as discussed in detail in ([@bib29]; see also appendix of [@bib66] for the derivation of these updates). Given the focus of this paper, we will discuss inference on valuable policies in detail below.

As we have shown above, minimising free energy ensures that expectations about hidden causes are close to the true posterior over hidden causes, given observed outcomes. However, if we want to apply this notion to define the value of actions and policies, we need to consider potential *future* outcomes and states under a given policy. This can be achieved by making the log prior probability of a policy the (negative) free energy expected under that policy ([@bib30]):$$\begin{matrix}
{P(\pi)} & {= \sigma( - \gamma \cdot G(\pi)))} & \\
{G(\pi)} & {= \sum\limits_{\tau}G(\pi,\tau)} & \\
\end{matrix}$$where $\tau$ refers to a time-step in the future, $\tau \in \{ t + 1,\ldots,T\}$ with $t$ reflecting the current time step. Note that the expected free energy over future states that determines the value of a policy resembles the expected value of future reward in reinforcement learning ([@bib85]), although there is no discount parameter over future states. $\gamma$ reflects a precision parameter that governs an agent's goal-directedness and randomness in behaviour, parameterised by a gamma function with rate parameter $\beta$ (see [Figure 1](#fig1){ref-type="fig"}). Based on these beliefs about policies, agents sample an action, where the randomness of this sampling is governed by a precision parameter $\alpha$ (see below). Here, we simulate 'one-shot' experiments, in which there is no time-sensitive updating of precision, but we illustrate the role of the hyper-prior on precision ($\beta$) to simulate stochasticity or 'random exploration' in behaviour.

Using the same definition of free energy as in [Equation 1](#equ2){ref-type="disp-formula"}), we can now define the expected free energy that defines the value of a policy. To do so, we need to make two changes to the definition of the free energy in [Equation 1](#equ2){ref-type="disp-formula"}). First, we need to define an approximate posterior conditioned on a policy. Second, given that we evaluate policies with respect to future observations that have not yet occurred, the expectation in [Equation 1](#equ2){ref-type="disp-formula"}) needs to incorporate those future states ([@bib66]). Consequently, we obtain $\overset{\sim}{Q} = Q(o_{\tau},s_{\tau},A|\pi)$, and by defining $\overset{\sim}{Q} = Q(s_{\tau},A|\pi)P(o_{\tau}|s_{\tau},A)$, we can write the free energy as (see [@bib79] for a step-by-step tutorial of this derivation):$$$$$$\begin{matrix}
{G(\pi,\tau)} & {= \mathbb{E}_{\overset{\sim}{Q}}\lbrack\ln Q(s_{\tau},A|\pi) - \ln P(o_{\tau},s_{\tau},A|\pi)\rbrack} & \\
 & {= \mathbb{E}_{\overset{\sim}{Q}}\lbrack\ln Q(A) + \ln Q(s_{\tau}|\pi) - \ln P(A|s_{\tau},o_{\tau},\pi) - \ln P(s_{\tau}|o_{\tau},\pi) - \ln P(o_{\tau})\rbrack} & \\
 & {\approx \mathbb{E}_{\overset{\sim}{Q}}\lbrack\ln Q(A) + \ln Q(s_{\tau}|\pi) - \ln Q(A|s_{\tau},o_{\tau},\pi) - \ln Q(s_{\tau}|o_{\tau},\pi) - \ln P(o_{\tau})\rbrack} & \\
\end{matrix}$$

And eventually (cf. [@bib29]; Equation 2.2):$$$$

This formulation of behaviour predicts that choices will be governed by three principles; namely, minimising uncertainty about model parameters (*parameter exploration* or *active learning*), minimising uncertainty about hidden states (*hidden state exploration* or *active inference*) and obtaining preferred outcomes (*realising preferences* or *goals*).

Preferences over outcomes are defined as prior (log-) expectations over outcomes (**c** in [Figure 1](#fig1){ref-type="fig"} and [Figure 2C](#fig2){ref-type="fig"}). Thus, policies become valuable if they minimise the deviation between expected and actual outcomes, which introduces the concept of surprise minimisation to choice behaviour. The focus of the present paper, however, is on the first two terms of the value of a policy.

The first term in the equation above reflects the mutual information between beliefs about *model parameters* before and after making a new observation and reflects *active learning* (cf., [@bib100]). The notion of finding policies that maximise mutual information is equivalent to maximising (expected) Bayesian surprise ([@bib43]), where Bayesian surprise is the divergence between posterior and prior beliefs about hidden causes. Because mutual information cannot be less than zero, it disappears when the (predictive) posterior ceases to be informed by new observations. This means that 'active learning' will search out observations that resolve uncertainty about the world (e.g. foraging to resolve uncertainty about the reward probability of a risky option). However, when there is no posterior uncertainty -- and the agent is confident about the structure of the world -- there can be no further information gain and preferences over outcomes (i.e. rewards or utility) will dominate policy selection. This resolution of uncertainty is closely related to satisfying artificial curiosity ([@bib71]; [@bib83]) and the 'value of information' ([@bib40]). The second term of the value of a policy, on the other hand, reflects the mutual information of believes about *states* before and after making an observation and reflects *active inference*. This term quantifies how well agents can infer the underlying cause of an observation, and motivates agents to seek observations that decrease uncertainty about the current hidden state with respect to this mapping. Taken together, these two terms predict that policies will be preferred if they allow agents to optimise the parameterisation of their observation model and at the same time make observations that enable precise inference about the state of the world, given their observation model.

The posterior mapping from hidden states to outcomes (***A***) is parameterised as Dirichlet distribution, whose sufficient statistics are concentration parameters ([@bib28]). These concentration parameters effectively reflect the (normalised) number of times a particular combination of states and outcomes has been encountered.

Actual updates of an agent's observation model (A-matrix) at time-point $t$ take place via updating these concentration parameters with respect to current observations and an individual learning rate $\eta$ ([@bib28]):$$$$where $a_{t}$ reflects the update of the concentration parameters depending on the observed state-outcome mapping at trial $t$, $a_{t} = a_{t - 1} + \eta \cdot \sum\limits_{t}o_{t} \otimes s_{t}$ ($\otimes$ is the cross-product), and $a_{0}$ reflects the (prior) concentration parameters at the beginning of the experiment, with $\psi$ referring to a psi- or digamma-function (i.e. a column-wise normalisation of concentration parameters). Note that $a$ refer to the concentration parameters specifying an agent's observation model via $P(A) = Dir(a)$. Effectively, [Equation (8)](#equ9){ref-type="disp-formula"} implies that learning of the observation model takes place by counting the number of transitions from one particular hidden state to a particular outcome, modulated by an individual learning rate.

From the perspective of this paper, the two key terms that define the value of a policy are the opportunities for information gain pertaining to the mapping between hidden states and outcomes (first term), and about hidden states (second term). The former reflects an agent's reduction in uncertainty about model parameters, whilst the latter reflects an agent's reduction in uncertainty about hidden states. These two terms imply that policies will be preferred if they resolve uncertainty about the way in which hidden states generate outcomes ('model parameter exploration') and about the hidden states underlying observations ('hidden state exploration').

In addition to the precision (stochasticity) of policy selection, one can define a precision of action selection under inferred policies, $\alpha$: $P(a_{t}|\alpha) = \sigma(\alpha \cdot \ln P(a_{t}|Q(\pi)))$, where $Q\left( \pi \right)$ reflects the approximate posterior beliefs about policies $\pi$. In the above simulations, we have set $\alpha$ to 4 in the active learning simulations and to 16 in the active inference examples. Note that we have defined different values for $\alpha$ based on the difference in the number of available policies in these two examples, but the results of our simulations do not depend on particular values of $\alpha$. In the section on 'Comparing model parameter and hidden state exploration', we have set $\alpha$ to 8 for both the active learning and active inference agent to ensure comparability of the two agents, and we have set $\alpha$ to 1 to create a random exploration agent (to ensure consistency across the different simulated tasks).

Code availability {#s4-2}
-----------------

The above simulations are based on routines available that are available as Matlab code in the SPM academic software: <http://www.fil.ion.ucl.ac.uk/spm/> based on the epistemic learning demo in the DEM toolbox of SPM.

The exact simulations and figures of this paper can be reproduced based on code at the following github repository: <https://github.com/schwartenbeckph/Mechanisms_Exploration_Paper> using the Curiosity_Paper_Figures.m File ([@bib76]; copy archived at <https://github.com/elifesciences-publications/Mechanisms_Exploration_Paper>).

These simulations are based on a broader tutorial on active inference and active learning that can be found at <https://github.com/schwartenbeckph/CPC_ActiveInference2018> ([@bib77]; copy archived at <https://github.com/elifesciences-publications/CPC_ActiveInference2018>). This tutorial includes important procedures for fitting such models to real behaviour -- and evaluating parameter recovery (i.e. identifiability). This application goes beyond the scope of this paper but represents a crucial step in applying active inference and learning models to empirical data.

Funding Information
===================

This paper was supported by the following grants:

-   http://dx.doi.org/10.13039/100004440Wellcome 088130/Z/09/Z to Karl J Friston.

-   http://dx.doi.org/10.13039/501100003986Jacobs Foundation to Tobias U Hauser.

-   http://dx.doi.org/10.13039/100004440Wellcome 211155/Z/18/Z to Tobias U Hauser.

-   http://dx.doi.org/10.13039/501100000781European Research Council Starting Grant 804701 to Thomas HB FitzGerald.

We thank Rani Moran and Timothy Müller for very helpful comments on an earlier version of this manuscript. KJF is funded by the Wellcome Trust (Ref: 088130/Z/09/Z). TUH is supported by a Wellcome Sir Henry Dale Fellowship (211155/Z/18/Z), a grant from the Jacobs Foundation (2017-1261-04), the Medical Research Foundation, and a 2018 NARSAD Young Investigator grant (27023) from the Brain and Behavior Research Foundation. THBF is supported by a European Research Council (ERC) Starting Grant under the Horizon 2020 program (Grant Agreement 804701). The Max Planck UCL Centre is a joint initiative supported by UCL and the Max Planck Society. The Wellcome Centre for Human Neuroimaging is supported by core funding from the Wellcome Trust (203147/Z/16/Z).

Additional information {#s5}
======================

No competing interests declared.

Conceptualization, Formal analysis, Investigation, Writing---original draft.

Conceptualization, Writing---original draft.

Formal analysis, Investigation, Writing---original draft.

Conceptualization, Investigation, Writing---original draft.

Conceptualization, Supervision, Investigation, Writing---original draft.

Conceptualization, Resources, Formal analysis, Supervision, Investigation, Methodology, Writing---original draft.

Additional files {#s6}
================

10.7554/eLife.41703.015

Data availability {#s7}
=================

Our submission only contains theoretical and simulation work, there are no datasets that could be made available. All the routines that are used for these simulations are available in the academic software SPM (<https://www.fil.ion.ucl.ac.uk/spm/>, DEM toolbox, \'epistemic value\' routine), as indicated and described in the main text of our manuscript. Further, all code and data to reproduce the specific simulations of this manuscript are publicly available on github (<https://github.com/schwartenbeckph/Mechanisms_Exploration_Paper>; copy archived at <https://github.com/elifesciences-publications/Mechanisms_Exploration_Paper>).

The following datasets were generated:

10.7554/eLife.41703.016

Effects of other model parameters {#s8}
=================================

While our focus is on comparing 'state exploration' and 'model parameter exploration', that is *active inference* and *active learning*, respectively, it is important to note that the behaviour illustrated in our simulations also depends on other key parameters, which we consider in the following. In particular, we will address the role of an agent's (prior) parameterisation of its observation model, an agent's preferences over outcomes and the parameterisation of beliefs about hidden states. We will refer to the task with no cue and an uncertain reward probability in the risky option as the *learning task*, and to the task with a cue and an unknown hidden state that determines the reward statistics as the *inference task*.

Active inference and active learning provide a general and flexible framework for understanding individual variation in exploitative and exploratory behaviour. Animals can differ markedly in their risk preferences, learning speed or sensitivity to uncertainty. As we will show in this appendix, different risk preferences result from an agents' preference distribution over outcomes. A predominance of risk-averse or risk-seeking behaviour arises from highly precise prior preferences that either emphasize not forgoing a small reward or obtaining a large reward, respectively. Further, a flat preference distribution induces a diminished prevalence of reward-based, extrinsically motivated behaviour and renders the animal more sensitive to information gain. The tendency towards epistemic foraging is also determined by an agent's learning rate, which affects the time-course of intrinsically motivated behaviour, and prior confidence, which (in analogy with prior preferences), determines overall sensitivity to information. Inferring such individual differences in an animal's 'world model' requires careful fitting of choice behaviour and model comparisons given a particular task of interest (see 'code availability' section).

Prior uncertainty over the observation model determines the value of information {#s8-1}
--------------------------------------------------------------------------------

In active learning, the key prior that determines an agent's sensitivity to information is specified by the concentration parameters of the agent's observation model (in [Figure 2](#fig2){ref-type="fig"}). The effects of these concentration parameters are illustrated in [Figure 6A](#fig6){ref-type="fig"}, which affords two key insights. First, an agent prefers the risky option if it beliefs that receiving a reward is likely (lower right corner of [Figure 6A](#fig6){ref-type="fig"}) but prefers the safe option if it beliefs that receiving a reward is unlikely (upper left corner of [Figure 6A](#fig6){ref-type="fig"}). Second, and more importantly from the perspective of active learning, the agent will prefer to sample the risky option if it has an *uncertain* uniform prior about the reward statistics (lower left corner of [Figure 6A](#fig6){ref-type="fig"}) but prefer the safe option if it has a *certain* uniform prior about receiving a reward (upper right corner of [Figure 6A](#fig6){ref-type="fig"}).

The agent's prior over its observation model, however, incorporates additional knowledge about the task structure, such as the mapping from the safe location to a small reward or the observations in the starting position. The role of this parameterisation is illustrated in [Appendix 1---figure 1](#app1fig1){ref-type="fig"}. [Appendix 1---figure 1A](#app1fig1){ref-type="fig"} illustrates an experiment where an agent has a very imprecise prior over the observation model, by specifying $a_{0}$ as$$a_{0} = \begin{bmatrix}
{1/4} & {1/4} & {1/4} \\
{1/4} & {1/4} & {1/4} \\
{1/4} & {1/4} & {1/4} \\
{1/4} & {1/4} & {1/4} \\
\end{bmatrix}$$

![The agent's prior on the observation model determines the value of information of the risky option.\
Same setup as in [Figures 3](#fig3){ref-type="fig"}--[5](#fig5){ref-type="fig"}, but with different priors over the observation model. (**A**) Full uncertainty over an agent's observation model induces the same information value for all three options, whereas uncertainty over the mapping from the starting point or safe option induce a specific epistemic value for these options (**B and C**). These priors can also induce optimistic (**D**) or pessimistic (**E**) behaviour, based on a high (prior) reward expectation in a low reward probability (0.25) task or a low (prior) reward expectation in a high reward task (0.75), respectively. (**F**) A lower learning rate leads to slower learning about a low reward probability (0.25) in the risky option or, equivalently, to a longer dominance of information-seeking behaviour.](elife-41703-app1-fig1){#app1fig1}

This leads to a uniform probability for choosing to stay at the starting position, or choosing the safe or risky option at the first time-step. In this example, once the agent has sampled the starting position at the first time-step, it will then choose the safe or risky option at the second time-step, because now these two options have the highest information gain. Only after choosing the safe and risky option at time-step two and three, respectively, the agent starts to explore -- and exploit in a more goal-directed manner. How long this pure information gain period lasts also depends on an agent's learning rate (see description of [Appendix 1---figure 1F](#app1fig1){ref-type="fig"} below). [Appendix 1---figure 1B and 1C](#app1fig1){ref-type="fig"} illustrate the same type of behaviour, but now with an imprecise mapping -- from the starting position or the safe option -- to different outcomes. Note that the information gain period lasts longer if there is uncertainty about the safe option compared to the starting position, because there is an additional exploitative motivation for choosing the safe option that delivers a small reward.

Figure [Appendix 1---figure 1D and 1E](#app1fig1){ref-type="fig"} illustrate the effects of non-uniform priors over reward statistics on active learning. [Appendix 1---figure 1D](#app1fig1){ref-type="fig"} corresponds to prior concentration parameters that reflect the upper right corner of [Figure 6](#fig6){ref-type="fig"} by specifying $a_{0}$ as$$a_{0} = \begin{bmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 8 \\
0 & 0 & {1/4} \\
\end{bmatrix}$$

This induces a highly optimistic prior belief about obtaining a reward in the risky option. Simulating task performance under a low reward probability (p(reward)=0.25) shows that the agent samples the risky option several times before the observations overcome the (pathologic) optimism induced by the agent's prior. In contrast, [Appendix 1---figure 1E](#app1fig1){ref-type="fig"} illustrates the opposite pattern (with the prior concentration parameter for receiving no reward in the risky option set to 2). This induces pessimistic behaviour -- that results in a persistent preference for choosing the safe option. In this example, the agent never learns that it lives in an environment with a high reward probability (p(reward)=0.75), because it never samples the risky option, which would allow it to overcome its pessimistic prior beliefs.

Finally, [Appendix 1---figure 1F](#app1fig1){ref-type="fig"} illustrates a task where the agent learns only slowly from observations ($\eta = 0.05$ instead of 0.5 as in the simulations above, see [Equation 8](#equ9){ref-type="disp-formula"}). Here, it takes the agent about the first third of the experiment to learn about the low reward probability (0.25) in the risky option. In other words, the value of information of the risky option dominates behaviour for a longer period than in the simulations illustrated in [Figures 3](#fig3){ref-type="fig"}--[5](#fig5){ref-type="fig"}.

Prior preferences over outcomes determine risk preferences and the cost of information {#s8-2}
--------------------------------------------------------------------------------------

Besides an agent's prior beliefs about the likelihood of outcomes, another key determinant of active learning and inference is an agent's prior preference over different outcomes. In the simulations above, we defined an agent's preferences as c = \[0 2 4 -2\], which reflect its preferences for the starting position, a small reward, a high reward, and no reward, respectively (see [Figure 2](#fig2){ref-type="fig"}). Note that in active learning and inference, these preferences are defined as log-probabilities over outcomes. For example, the above specification implies that the agent expects to end up in a high reward state $exp\left( 4 \right) \approx 55$ times more than in the starting position (${\exp\left( 0 \right)} = 1$). Consequently, the agent tries to infer behaviour that maximises these log-probabilities over observations, and thus minimises surprise.

Importantly, these preferences over outcomes determine an agent's risk preferences. [Appendix 1---figure 2](#app1fig2){ref-type="fig"} illustrates these effects in the active learning task, with a true underlying reward probability of 0.5 for the risky option. The ensuing behaviour shows that different risk preferences change the response profile for choosing the risky option over time.

![Prior preferences over outcomes determine an agent's risk preferences.\
Same setup as in [Figure 6A](#fig6){ref-type="fig"} but with varying preferences over outcomes, compared to the reference specification of c = \[0 2 4 --2\] in log-space used above (bright blue line), which reflects an agent's preference for the starting position, the small safe reward, the high reward and no reward, respectively. Dark blue line reflects the same information seeking behaviour in the beginning of an experiment but less risk aversion in later trials by equating an agent's preference for obtaining no reward to staying in the safe position (c = \[0 2 4 0\]). Purple line reflects a risk seeking agent (c = \[0 2 8 --2\]) whereas red line reflects a risk averse agent (c = \[0 2 4 --4\]). Yellow line reflects an agent that has an equal preference for the high and low reward (c = \[0 4 4 --2\]), and consequently never chooses the risky option. Green line reflects an agent with flat preferences (c = \[0 0 0 0\]), which is purely driven by information gain until it converges on a stable probability for choosing the risky option. Time-course averaged over 1000 experiments.](elife-41703-app1-fig2){#app1fig2}

The above preference specification implies that -- in log-space -- obtaining no reward in the risky option is equivalent to losing the low reward of the safe option. [Appendix 1---figure 2](#app1fig2){ref-type="fig"} shows that a prior of c = \[0 2 4 0\] (dark blue line), which equates the preference for no reward with the starting position, makes the agent less risk averse compared to a prior of c = \[0 2 4 --2\] (bright blue line). In both parameterisations, behaviour is dominated initially by information gain, but converges to a higher probability for choosing the risky option over time, if the agent is less risk averse. Alternatively, a preference for no reward of −4 (red line) makes the agent much more risk (i.e., no reward) averse -- with a zero probability of choosing the risky option, after the true reward probability is learned. This contrasts with a risk seeking agent that has a strong preference for obtaining a high reward (c = \[0 2 8 --2\], purple line). If the agent has the same preference for the small reward as for the high reward (c = \[0 4 4 0\], yellow line), the agent will never sample the risky option, because the extrinsic reward dominates policy selection. In contrast, if the agent has flat preferences over observations (c = \[0 0 0 0\], green line), behaviour will be dominated by information gain (in the risky option) in early trials and slowly converges towards a uniform preference for any of the three options (stay at starting point, safe or risky option).

Note that in the above parameterisation of an agent's preferences one would not necessarily distinguish between rewards (or their omission) and punishments, even though one could also introduce these as separate factors over outcomes ([@bib67]).

A central aspect of these simulations is that these preferences not only control an agent's risk preferences in active learning tasks, but also the cost of information as illustrated in the active inference task. This follows because log-preferences can be thought of in terms of cost (or, formally, counter-evidence to an agent's model). By navigating to preferred (expected) outcomes, the agent minimises cost (i.e., surprise).

This is illustrated in [Figure 8B](#fig8){ref-type="fig"}, where the agent infers a stable high reward context and shifts from sampling the cue at the beginning of a trial towards sampling the risky option immediately. There is no actual need to switch to sampling the risky option immediately, because there still are two time-steps available. However, given it has formed precise beliefs about the current task state, there is no additional value of information for sampling the cue. Sampling the cue is costly, because it is less preferred (expected) than obtaining a reward in the safe or risky option. This results from specifying an agent's preferences as c = \[0 2 4 --2 0 0\], reflecting its preferences for the starting location, the safe reward, the high reward, no reward and visiting the cue (signalling a high or low reward), respectively. This specification induces a cost for visiting the cue location as opposed to sampling the preferred option immediately. This cost for sampling the cue has to be matched by the information gain imparted by the cue, hence the shift from sampling the cue to sampling the risky option immediately at the beginning of a trial in [Figure 8B](#fig8){ref-type="fig"}.

[Appendix 1---figure 3](#app1fig3){ref-type="fig"} illustrates this point further. Compared to a neutral agent illustrated in [Appendix 1---figure 3B](#app1fig3){ref-type="fig"} (equivalent to [Figure 8B](#fig8){ref-type="fig"}), an agent that has a preference for sampling the cue (c = \[0 2 4 --2 0.5 0.5\], [Appendix 1---figure 3A](#app1fig3){ref-type="fig"}) will always go to the cue at the beginning of a trial, no matter how certain it is about the current context. In contrast, if the cue is even more costly (c = \[0 2 4 --2 −0.5 --0.5\], [Appendix 1---figure 3C](#app1fig3){ref-type="fig"}), the agent has a preference for leaving it as early as possible, but may have to return several times because it has not fully resolved its uncertainty. Figure [Appendix 1---figure 4](#app1fig4){ref-type="fig"} illustrates these time-sensitive behaviours over multiple simulated experiments.

![Prior preferences over outcomes determine the cost of sampling information in the active inference task -- single experiment simulations.\
(**A**) An agent that prefers sampling the cue will continue to sample the cue at the beginning of a trial, even if its uncertainty about the hidden state has been resolved. (**B**) An agent with neutral preferences for the cue will switch to sampling the preferred (risky) option immediately once its uncertainty about the (high reward) hidden state is sufficiently resolved (equivalent to [Figure 8B](#fig8){ref-type="fig"}). (**C**) An agent with a negative preference for the cue will try to switch to the preferred option as quickly as possible, but may go back to sample the cue more often because its uncertainty has not been resolved sufficiently.](elife-41703-app1-fig3){#app1fig3}

![Prior preferences over outcomes determine the cost of information sampling in the active inference task -- simulations over multiple experiments -- simulations over 1000 experiments..\
The yellow line reflects the agent introduced in [Figure 8B](#fig8){ref-type="fig"} with neutral preferences for the cue location, specified as c = \[0 2 4 --2 0 0\], which reflects its preferences for the starting location, safe reward, high reward, no reward and the cue location (signalling a high or low reward state), respectively. Agents with a slight preference for visiting the cue only slowly decrease their preference for sampling the cue at the beginning of a trial (purple: c = \[0 2 4 --2 0.25 0.25\]; green: c = \[0 2 4 --2 0.5 0.5\]). Agents with a negative preference for the cue location move away from sampling the cue quicker (red: c = \[0 2 4 --2 −0.25 --0.25\]; blue: c = \[0 2 4 --2 −0.5 --0.5\]). Time-course averaged over 1000 experiments.](elife-41703-app1-fig4){#app1fig4}

Beliefs about hidden states in dynamic environments {#s8-3}
---------------------------------------------------

Importantly, all simulations above are based on environments with a static structure, which allows agents to converge on one stable representation of the task over time. In reality, however, environments are volatile and change over time, such that new statistics have to be learned or novel hidden states have to be inferred. The simplest example of a dynamic environment is a reversal task, in which the true hidden state changes over time.

A detailed treatment of this issue goes beyond the scope of this paper. However, an important quality check for the present formulation is whether behaviour adapts to a changing environment. [Appendix 1---figure 5](#app1fig5){ref-type="fig"} and [6](#app1fig6){ref-type="fig"} illustrate adaptive behaviour in the active inference task. Here, we introduced a reversal of the hidden state after half of the experimental trials, such that the agent is in a high reward context in the first 16 trials followed by a low reward context in the next 16 trials (as indicated by a change from 'green' context to 'red' context in the second panel of [Appendix 1---figure 5A](#app1fig5){ref-type="fig"} and [Appendix 1---figure 5B](#app1fig5){ref-type="fig"}). [Appendix 1---figure 5A](#app1fig5){ref-type="fig"} shows that an active inference agent correctly infers the high reward context and moves slowly towards choosing the risky option immediately at the beginning of the trial (first time-step). After the switch to a low reward context in trial 16, however, the agent starts sampling the cue again. This behaviour is induced by a negative feedback in the risky option in trial 17 and is then reinforced by feedback from the cue, which now signals a low reward context. Thus, the active inference agent correctly infers whether the current context has changed, and whether a recent increase in its uncertainty about the current context increases the value of information at the cue location again.

![An active inference agent correctly infers a change in the environment -- single experiment simulations.\
(**A**) An active inference agent correctly learns that it starts in a high reward environment, and slowly begins to sample the risky option at the beginning of a trial once it has inferred a high reward context. After a switch of context to a low reward environment in trial 16, however, the agent starts sampling the cue again. This is induced by a negative outcome at trial 17 and then further reinforced by a different context signalled by the cue. Thus, the active inference agent correctly infers when to start sampling information again as a function of its uncertainty about the world. (**B**) If an agent has optimistic prior expectations about being in a high reward context, it starts sampling the risky option immediately even at the beginning of the experiment, and it will take the agent longer to infer a switch of context in the second half of the experiment.](elife-41703-app1-fig5){#app1fig5}

![An active inference agent correctly infers a change in the environment -- simulations over multiple experiments.\
Same agents as in [Appendix 1---figure 5](#app1fig5){ref-type="fig"} (**A** and **B**) simulated over 1000 experiments. The neutral active inference agent correctly infers a switch after the first half of the experiment and starts sampling the cue again. The optimistic active inference agent does not sample the cue in the first half of the experiment, but starts visiting the cue location once it has inferred that the context has changed.](elife-41703-app1-fig6){#app1fig6}

As introduced above, a central aspect of these simulations are an agent's beliefs about the current context, which can be parameterised with concentration parameters akin to an agent's observation model. These priors over beliefs about the context are specified in an agent's d-vector (see [Figure 7](#fig7){ref-type="fig"}). In [Appendix 1---figure 5A](#app1fig5){ref-type="fig"}, the d-vector reflects an uncertain uniform prior over being in one of the two contexts (d = \[0.25 0.25 0 0 0 0 0 0\]). [Appendix 1---figure 5B](#app1fig5){ref-type="fig"} illustrates an example where the agent has a strong prior expectation about starting in a high reward context (d = \[8 0.25 0 0 0 0 0 0\]). This motivates the agent to sample the risky option immediately without sampling the cue first, and only when it has sampled enough evidence in favour of a change of context (several trials after the actual change) it starts sampling the cue at the beginning of a trial again. [Appendix 1---figure 6](#app1fig6){ref-type="fig"} illustrates the time-course of behaviour for these two agents over multiple experiments.

10.7554/eLife.41703.023

Relationship to other computational approaches to exploration {#s9}
=============================================================

There has been much recent interest in understanding the mechanisms of exploration and curiosity. As mentioned in the introduction, the simplest account of exploration has been cast in terms of $\epsilon$-greedy and softmax choice rules with an inverse temperature parameter ([@bib86]), which governs the randomness in behaviour and thus the deviation from rational, exploitative choices. However, this account of exploration can be problematic because often it is unclear whether this truly captures (random) exploratory tendencies or just different forms of noise (e.g., Findling, Skvortsova, Dromnelle, Palminteri, & Wyart, 2018). In active inference and learning, the tendency towards randomness is captured by the (prior) precision of policy selection ($\beta$) as shown in the simulations in the main text. In the one-shot and two-shot tasks simulated here, this (prior) precision plays a very similar role to an inverse temperature parameter. In more sophisticated tasks with larger policy depths, precision itself will be updated (inferred) over time, implying that an agent's 'inverse temperature' has a time-sensitive Bayes optimal solution and the agent infers the 'best' level of randomness based on task events.

Two prominent examples of more sophisticated routines for goal-directed and random exploration are upper confidence bounds (UCB) and Thompson sampling, respectively. These computational frameworks have been discussed in much detail in previous work ([@bib32]; [@bib33]; [@bib73]). The central idea of UCB is to add an additional value to an option that reflects its informative value. Similar to a novelty bonus ([@bib46]), this additional value can reflect the number of times this option has been sampled previously ([@bib4]; [@bib3]) or the variance in an agent's beliefs about the value of this option ([@bib81]). Thompson sampling, on the other hand, is a more sophisticated algorithm for random exploration. Here, the key idea is that agent's sample from beliefs about the reward statistics of different options, and then exploit (i.e., take the most valuable option) with respect to this sample. Thus, the uncertainty about the reward statistics guides the degree of randomness in behaviour, and consequently controls the degree of random exploration.

As shown in [@bib32] and [@bib33], these two classes of algorithms have different effects on the exploitation-exploration trade-off. Uncertainty bonuses such as UCB add a value to sampling an option in addition to its expected value. This induces an intercept shift in the probability for sampling this option, as shown in [Appendix 2---figure 1](#app2fig1){ref-type="fig"} (left panel). The higher the uncertainty bonus, the higher is the agent's preference for sampling this option, even if its expected value is smaller than other options (in line with the additive aspects of Blanchard et al.'s findings). In contrast, random exploration, such as Thompson sampling, induces a change of the slope in the choice function, such that more randomness induces a flatter choice function ([Appendix 2---figure 1](#app2fig1){ref-type="fig"} right panel). [Appendix 2---figure 1B](#app2fig1){ref-type="fig"} illustrates that these effects closely correspond to the effects of active learning or active inference and precision on behaviour. 'Model parameter exploration' or 'hidden state exploration' is defined as an additive term in the agent's value function ([Equation 7](#equ8){ref-type="disp-formula"}, Materials and methods section) and can thus be seen as aspects of information-directed exploration. Thus, it induces an intercept shift analogously to UCB (displayed in [Appendix 2---figure 1B](#app2fig1){ref-type="fig"} left panel for 'model parameter exploration' in active learning, effects for active inference are analogous). Precision, or randomness, on the other hand, affects the slope of the agent's preference function ([Appendix 2---figure 1B](#app2fig1){ref-type="fig"}, right panel) and plays a very similar role to an inverse temperature parameter.

![Effects of different algorithms for exploration on choice probabilities.\
(**A**) *Left panel:* Algorithms based on an uncertainty bonus, such as UCB, change the intercept in the probability for choosing the uncertain option, plotted as a function of the difference in expected value between the uncertain option and an alternative option. *Right panel:* Algorithms based on randomness, such as Thompson sampling, change the slope of the choice probability, where an increase in randomness decreases the steepness of the choice curve. Reproduced from ([@bib32]) (**B**) *Left panel:* 'model parameter exploration' in active inference acts as an uncertainty bonus and, analogously to UCB, changes the intercept of the probability to sample an uncertain option as a function of the prior uncertainty over this option. Different lines reflect different concentration parameters for the mapping to high or no reward in the risky option (cf., [Figure 2](#fig2){ref-type="fig"}, CP = concentration parameter). 'Hidden state exploration' in active inference has analogous effects. *Right panel:* prior precision of policy selection ($\beta$) affects the randomness of choice behaviour, and consequently the slope of the choice function.](elife-41703-app2-fig1){#app2fig1}

The recent interest in deep neural networks their application to more realistic tasks has led to an increased focus on algorithms for exploration. This is motivated by a characteristic failure of 'deep reinforcement learning' models in tasks that require goal-directed exploratory behaviour, such as the Atari game Montezuma's revenge ([@bib15]; [@bib56]). These tasks are difficult because reward is sparse and many states are only visited once, if at all, and thus motivate a more flexible definition of an intrinsic reward that guides behaviour.

Much progress in this field is based on defining intrinsic motivation as the expected learning progress in a given problem, such that agents 'plan to be surprised' ([@bib6]; [@bib14]; [@bib55]; [@bib63]; [@bib64]; [@bib71]; [@bib84]; [@bib43]). This is conceptually similar to defining an uncertainty bonus for a given option. Given that these methods are often difficult to apply to large-scale problems, other algorithms for novelty detection have been proposed. Count-based methods use previous visits of a state as a measure for their novelty, with a recent extension of pseudo-count methods to generalise these methods to more complicated (non-tabular) problems ([@bib8]; [@bib62]; [@bib90]). Other forms of novelty detection are based on (exemplar) classification methods ([@bib31]) or 'network distillation', where the difference between a trained and a random network is used as a measure for novelty, based on how much an observation deviates from the training set ([@bib15]).

Perhaps closest to the framework presented here is the Variational Information Maximising Exploration algorithm ([@bib39]), which is based on the idea of finding future trajectories (policies) that maximise the sum of entropy reduction in beliefs about environment dynamics. This means that agents should visit states that maximise the mutual information of prior and posterior beliefs about transition probabilities in the environment. Note that this follows a very similar logic to our treatment of active inference, except that it is applied to the agent's transition probabilities (B-matrix in [Figure 2](#fig2){ref-type="fig"}) rather than its observation model (A-matrix in [Figure 2](#fig2){ref-type="fig"}).

Note that, while many of the above algorithms have successfully introduced the notion of exploration and novelty to large-scale problems, a key motivation behind our proposed framework is understanding the generative mechanisms that underlie information gain and its trade-off with reward maximisation. How inference based on these generative mechanisms proceeds in more complicated tasks -- where a representation of the feature or state space needs to be learned in the first place to build the A, B, c, and d-matrices of [Figure 2](#fig2){ref-type="fig"} and [7](#fig7){ref-type="fig"} -- is an important question for future work.

10.7554/eLife.41703.026

Decision letter

Frank

Michael J

Reviewing Editor

Brown University

United States

In the interests of transparency, eLife includes the editorial decision letter and accompanying author responses. A lightly edited version of the letter sent to the authors after peer review is shown, indicating the most substantive concerns; minor comments are not usually included.

Thank you for sending your article entitled \"Computational mechanisms of curiosity and goal-directed exploration\" for peer review at *eLife*. Your article is being evaluated by Michael Frank as the Senior Editor and Reviewing Editor, and two reviewers.

Summary:

The authors explore the computational mechanisms of curiosity/information-seeking, focusing particularly on the distinction between two forms of goal-directed exploration. In particular they clarify through theoretical analysis and simulations the distinction between active inference (to reduce uncertainty about which world model is valid) and active learning (reducing uncertainty about the parameters of that model; e.g., outcome distributions or state transition probabilities), both within a framework of free energy reduction. The authors also outline circumstances in which active learning and/or active inference may be exposed as a function of the environment\'s structure and parameterization. Overall this is original work and the topics are timely.

Essential revisions:

Despite the strengths of the manuscript, the reviewers both had substantial reservations that would need to be addressed in a revision. The two reviewer points are consolidated below.

1\) The reviewers were both concerned about the lack of connection of the analysis to empirical data that could be used to constrain or falsify it. They felt that the simulations are simple enough that there should be some data out there that could corroborate their model\'s predictions, and that for a life sciences (instead of purely computational) journal this is important.

\- For example, the authors outline clear behavioral patterns that should be observed when an animal begins a simple t-maze task with risky options, or an experiment with a disambiguating cue. Are there existing data that could help support the model\'s claims here? Some evidence showing that rats preferentially sample from a risky option early, but switch to the low-risk option over time would certainly seem to be available in the corpus of animal behavior literature. In so doing, the reviewers also agreed that it would be important to compare your model to some alternatives, even if not doing formal model comparison with quantitative fitting, but at least qualitatively.

2\) They also both agreed that there was very little connection to neural mechanisms despite various work that has been conducted in this domain. One reviewer noted \"The decision to sample a cue to infer a hidden state involves cost-benefit tradeoffs relying on specific neural substrates but these are not mentioned at all. It also involves active sensing behaviors -- such as whisking, about which a lot is known -- but there is no real mention of any active sensing literature. The simulations in Figure 3 predict clear-cut risk aversion but there is no discussion of the fact that animals show mixtures of risk seeking and risk aversion when tested in these conditions. Active learning and active inference are associated with different neural substrates and behaviors but this is never mentioned when discussing the two mechanisms.\"

3\) Technically, there were also a few important concerns that would have to be addressed:

\- One concern was the flexibility of the free-energy framework, and how sensitive/robust it might be with respect to initial conditions and priors. For example, the agent in the first simulation takes an initialization as specified in Figure 2. Given that the agent is tasked with updating A, how dependent are these results on the initialization of A (a0 in this case). In particular, how robust are these results to variation in the a0 prior. From the prior used here, it appears as though the agent already has some knowledge of what to expect when it samples the risky option.

\- Further to the issue of the prior -- how robust are these results to the reward prior specified in matrix c? Can the authors justify the use of zero reward in all non rewarding states, but a -2 reward for a state that omits a reward? Do results depend on this initialization? More traditional models would encode the omission of a reward as zero -- would punishment be encoded any differently (e.g. small foot shock instead of reward omission)?

\- If the model is to be used for quantification of real datasets (i.e., fitting), then it would be necessary to verify that its parameters are recoverable / identifiable.

4\) Other scenarios regarding the generality of the conclusions:

\- The results outlined in Figure 10 show that the agent adapts to the consistent structure found in the environment, opting not to sample the informative cue once it has determined that the risky outcome will in fact be found reliably. If the environment were switched to offer a high reward 25% of the time once the agent was confident that it would get a reward 75% of the time would it resample the cue? That is, can the agent adapt its active inference to accommodate environments with low volatility periods?

\- Behavior is often associated with some cost, which complicates the decision as to whether a cue should be sampled prior to reward pursuit. Does the model behave reasonably if there\'s a cost associated with sampling the cue?

\[Editors\' note: further revisions were requested prior to acceptance, as described below.\]

Thank you for resubmitting your work entitled \"Computational mechanisms of curiosity and goal-directed exploration\" for further consideration at *eLife*. Your revised article has been favorably evaluated by Michael Frank (Senior Editor), a Reviewing Editor, and two reviewers.

As you will see the two reviewers had polarized views on the merits of the paper. The main concern is that some of the connections to empirical data are misleading, and that the paper is difficult to read. After discussion with them, and reading it myself, I think the latter concern partially reflects the fact that you thoroughly responded to original concerns during the triage process and those in the reviews, which may have made the case more compelling but also the paper became a little unwieldy (and part of that is to be expected for technical papers). Thus, I am asking that you again revise the paper, but this time mostly for clarity.

Essential revisions:

My first suggestion is thus that you take a full editing pass through the paper again (perhaps offering to an arms-length colleague for comments) to try to streamline the readability -- I will leave it up to you how to do this. My second suggestion is to also try to tighten up the language in reference to the empirical data that reviewer 2 found to be \'vague\'. Finally, it is great that you made all code accessible so that anyone can test the properties of the model themselves, but if there are additional ways you can expose key falsifiable predictions of the theory (beyond those that are postdictions of existing data) that would be useful.

*Reviewer \#1:*

I feel that the authors sufficiently addressed most issues that we raised with the initial manuscript. They don\'t offer a demonstration that model parameters are recoverable, but I agree with their argument that perhaps this isn\'t necessary here. My only remaining issue is that, as a paper, it feels a bit long winded and somewhat fragmented -- but this is more a matter of taste than it is of publishability.

*Reviewer \#2:*

This is a revision of a paper that tries to explain the free energy framework and its significance for exploration and exploitation. The authors responded to the requests from the previous round of reviews to include a discussion of how their data can capture empirical observations by adding 7 (!) new figures, bringing the total to 21 (!) figures in the main text.

I am afraid that, although I do appreciate their effort, this revision does little to address my concerns. This, in my view, remains an engineering paper, concerned primarily on how to make a system that generates exploration and exploitation. It is not a paper that carefully considers -- or even understands -- empirical work, or that provides a model that makes \*falsifiable\* predictions or can be tested against \*competing\* models of empirical results.

The discussion of empirical results that the authors added is riddled with vague and meaningless -- and often entirely wrong statements. Let me give just one example from subsection "Active inference and active learning in behavior": \"This is in line with previous work on curiosity and exploration, where attention and salience have been identified as central mechanisms that modulate curiosity....\" I am quite familiar with the papers that are cited and I am positive that they said very little about how \"attention\" and \"salience\" \"modulate\" curiosity. I wonder what the authors mean by this. Do they mean that the papers manipulated attention and tested if people were more curious when attention was diverted one way or another? (This was not the case). Did they mean that those papers manipulate salience and test how this produces curiosity? (Again, not the case.) And so on.

This is but one example -- but the paper is \*full\* of such statements, to the extent that I find it, quite frankly, unreadable. I am very sorry to be so negative, especially since I appreciate the work the authors put in. I return to my original opinion -- this time with even more conviction after this review -- that this paper is simply not suitable for an empirical journal -- it is a paper about computer science and engineering.

10.7554/eLife.41703.027

Author response

> Essential revisions:
>
> Despite the strengths of the manuscript, the reviewers both had substantial reservations that would need to be addressed in a revision. The two reviewer points are consolidated below.
>
> 1\) The reviewers were both concerned about the lack of connection of the analysis to empirical data that could be used to constrain or falsify it. They felt that the simulations are simple enough that there should be some data out there that could corroborate their model\'s predictions, and that for a life sciences (instead of purely computational) journal this is important.
>
> \- For example, the authors outline clear behavioral patterns that should be observed when an animal begins a simple t-maze task with risky options, or an experiment with a disambiguating cue. Are there existing data that could help support the model\'s claims here? Some evidence showing that rats preferentially sample from a risky option early, but switch to the low-risk option over time would certainly seem to be available in the corpus of animal behavior literature.

We agree with the referees that this analysis would substantially improve our manuscript. We now discuss specific behavioural (and neuronal, see below) predictions from our computational perspective in an additional subsection called "Behavioural and neuronal predictions". The contribution of this section is twofold. First, we outline key behavioural and neuronal predictions that can be used to validate or falsify certain aspects of the model, such as the relationship between the (extrinsic) value of an option and its (intrinsic) informativeness. Second, we discuss these predictions in the light of existing behavioural and neuronal results in the animal literature (similar to Yu and Dayan, 2005, for instance). For example, we discuss behavioural evidence for an additive value of information in addition to reward (e.g., Vasconcelos, Monteiro and Kacelnik, 2015 in starlings) or a preference for sampling a risky option motivated by information gain, even if the safe option has higher expected utility (Smith, Beran and Young, 2017 in macaques). In particular, we discuss and simulate results from Blanchard, Hayden and Bromberg-Martin, (2015), showing evidence for a supra-additive effect of 'information' on the value of an option as a function of its (extrinsic) reward. Importantly, despite using a 'rat' as an example agent, the model-based predictions reported here are not restricted to rodents. Consequently, we discuss these predictions based on different examples from the entire animal literature.

We would be happy to include and discuss any additional results or references that we might have missed during our literature review.

> In so doing, the reviewers also agreed that it would be important to compare your model to some alternatives, even if not doing formal model comparison with quantitative fitting, but at least qualitatively.

We agree that this is a useful extension to our manuscript. To address this, we have included an additional subsection called "Relationship to other computational models of exploration", where we discuss some of the most prominent existing computational frameworks for exploration in reinforcement learning and deep neural networks, such as Thompson sampling or upper confidence bounds (similar to Gershman, 2018).

> 2\) They also both agreed that there was very little connection to neural mechanisms despite various work that has been conducted in this domain. One reviewer noted \"The decision to sample a cue to infer a hidden state involves cost-benefit tradeoffs relying on specific neural substrates but these are not mentioned at all. It also involves active sensing behaviors -- such as whisking, about which a lot is known -- but there is no real mention of any active sensing literature. The simulations in Figure 3 predict clear-cut risk aversion but there is no discussion of the fact that animals show mixtures of risk seeking and risk aversion when tested in these conditions. Active learning and active inference are associated with different neural substrates and behaviors but this is never mentioned when discussing the two mechanisms.\"

We agree that this discussion provides an important and useful addition to our manuscript. We now outline specific neuronal predictions based on active inference and active learning in the subsection "Behavioural and neuronal predictions" alongside key behavioural implications. We also assess the evidence for these predictions in relation to reported results on the neuronal implementation of active inference and active learning (e.g. Blanchard, Hayden and Bromberg-Martin, 2015 in monkeys; Ligneul, Mermillod and Morisseau, 2018 in humans and as discussed in Gottlieb, Oudeyer, Lopes and Baranes, 2013; Kidd and Hayden, 2015) and their relation to the active sensing literature (e.g., Yang, Lengyel and Wolpert, 2016; Yang, Wolpert and Lengyel, 2018). The model-based predictions described in our paper are also strongly aligned with identity (information) prediction errors that have recently been reported in rodents (Takahashi et al., 2017), which we now discuss in more detail. As above, given that our computational predictions are not limited to rodents, we discuss different examples from the animal literature that illustrate the neuronal implementation of active inference and active learning.

The issue of risk seeking and risk avoiding behaviour and its relation to ambiguity reduction is a very important one. We now discuss this in more detail in the subsection "Effects of other model parameters'", please see below). Risk preferences are determined by an agent's preferences over outcomes (c-vector), which can induce risk seeking or risk avoiding behaviour in agents.

> 3\) Technically, there were also a few important concerns that would have to be addressed:
>
> \- One concern was the flexibility of the free-energy framework, and how sensitive/robust it might be with respect to initial conditions and priors. For example, the agent in the first simulation takes an initialization as specified in Figure 2. Given that the agent is tasked with updating A, how dependent are these results on the initialization of A (a0 in this case). In particular, how robust are these results to variation in the a0 prior. From the prior used here, it appears as though the agent already has some knowledge of what to expect when it samples the risky option.
>
> \- Further to the issue of the prior -- how robust are these results to the reward prior specified in matrix c? Can the authors justify the use of zero reward in all non rewarding states, but a -2 reward for a state that omits a reward? Do results depend on this initialization? More traditional models would encode the omission of a reward as zero -- would punishment be encoded any differently (e.g. small foot shock instead of reward omission)?

We agree that these are important issues to discuss. As we briefly mention in the manuscript, predicted behaviour also depends on other parameters in the model, including an agent's prior on the observation model (a0) and preferences over outcomes (cost/utility function, c-vector). In the subsection "Effects of other model parameters" we now discuss the effects of these parameters (all available at https://github.com/schwartenbeckph/Mechanisms_Exploration_Paper).

We illustrate that the current specification of the prior on an agent's observation model as reported in the manuscript implies high uncertainty about obtaining a reward in the risky option, by assigning an imprecise (i.e., low concentration parameters) uniform prior over the reward statistics in the risky option. Changing these priors affects an agent's expectations about obtaining a reward in the risky option, either by inducing more optimistic or pessimistic expectations about the reward statistics, or by making the uniform prior more precise. We will illustrate the effects of such priors on resultant behaviour. The only other knowledge that this prior reflects is basic task-specific information, such as the fact that there will be no high reward in the safe option or no reward at all in the starting position. It is possible to assign prior uncertainty to the mappings in the safe option and starting position as well, which would associate these states with information gain, as we briefly illustrate in the manuscript ().

Second, we now illustrate the effects of an agent's prior preferences on behaviour, including simulations where the omission of a reward is parameterised with a value of zero (as in Friston et al., 2015 or Schwartenbeck and Friston, 2016, for instance, see subsection "Prior preferences over outcomes determine risk preferences and the cost of information"). This does not affect the general behaviour or claims of the paper. Further, we also discuss the role of these priors in terms of their role as a cost or (negative) utility function. In the simulations presented in this manuscript, both rewards and punishments are accounted for in the same preference function (c-vector) and 'punishment' would simply have a more negative value than the omission of a reward (see subsection "Prior preferences over outcomes determine risk preferences and the cost of information"). Because prior preferences can also be understood as (negative) costs, visiting the cue before sampling the most valuable option is costly and needs to be justified by the information gain imparted by the cue (please see below).

> \- If the model is to be used for quantification of real datasets (i.e., fitting), then it would be necessary to verify that its parameters are recoverable / identifiable.

We feel that the point of our paper is a more theoretical and general one similar to recent discussions of theoretical accounts of exploration (e.g., Gershman, 2017; 2018), which also do not mention the specifics of model fitting procedures or parameter recovery. We believe that an additional subsection on model fitting and parameter recovery would be beyond the scope of this manuscript. Model fitting procedures and tests for parameter recovery are illustrated in detail in a recent tutorial on active inference and active learning ('practical_II.m' at https://github.com/schwartenbeckph/CPC_ActiveInference20182, also discussed in Schwartenbeck and Friston, 2016, for instance, which we now mention in subsection "Behavioural and neuronal predictions" and in our 'code availability' statement).

However, if the reviewers believe that including a subsection on model fitting and parameter recovery would be necessary, then we would be happy to add this to the manuscript or a supplement.

> 4\) Other scenarios regarding the generality of the conclusions:
>
> \- The results outlined in figure 10 show that the agent adapts to the consistent structure found in the environment, opting not to sample the informative cue once it has determined that the risky outcome will in fact be found reliably. If the environment were switched to offer a high reward 25% of the time once the agent was confident that it would get a reward 75% of the time would it resample the cue? That is, can the agent adapt its active inference to accommodate environments with low volatility periods?

This is an important observation that speaks to the implementation of active inference and learning in problems like reversal learning paradigms. We now discuss this in the final part of the subsection "Effects of other model parameters". We show that active inference can accommodate reversals and dynamic changes in the environment. Active inference predicts that an agent will start to sample the cue again if its uncertainty about the current context increases following observations that indicate a change in task structure. We also show that this behaviour depends on prior expectations about the (stability of the) task structure.

> \- Behavior is often associated with some cost, which complicates the decision as to whether a cue should be sampled prior to reward pursuit. Does the model behave reasonably if there\'s a cost associated with sampling the cue?

This point speaks to the definition of the c-vector as the agent's cost function or (negative) expected utilities. In fact, in the simulations that we present in this manuscript there is a cost for sampling the cue, because the cue is less valuable than sampling the safe (or high reward risky) option. That is the reason why the agent chooses to sample the safe or risky option right away once the ambiguity about the risk probabilities is resolved -- even though it could still sample the cue first, because every trial consists of two time-steps. This is because sampling the cue has higher cost compared to the safe option (or risky option if it is associated with a reward probability of more than 0.5). One could also make the cue costlier by assigning it with a lower value in the c-vector, which would allocate a higher cost for visiting the cue compared to staying at the starting position, for instance. In general, in any situation where the safe (and high reward risky) option has lower cost (higher utility) than the cue, the value of information has to exceed the cost of visiting the cue to motivate the agent to explore the cue first at the beginning of a trial.

We now illustrate this sort of behaviour (subsection "Prior preferences over outcomes determine risk preferences and the cost of information").

\[Editors\' note: further revisions were requested prior to acceptance, as described below.\]

As suggested, we have thoroughly revised our manuscript with the aim of making it more readable and improving its clarity.

In particular, we have made the following changes:

We have now moved two subsections of the main manuscript to an appendix, namely the subsection "Effects of other model parameters" and subsection "'Relationship to other computational approaches to exploration'". While we believe that these are important sections, they are less critical for conveying the general claims of the paper, and we hope that the main manuscript has become more coherent that way.

Consequently, we have also reduced the number of figures from 21 to 13 in the main text.

We have tried to clarify the language throughout the paper (changes are marked in yellow), with particular emphasis on the issues raised by referee 2.

As suggested, we have re-written and clarified our subsection on open questions and empirical predictions, following our discussion of empirical evidence for active inference and active learning. In behaviour, it is often possible to find a prior parameterisation that explains individual behaviour that seems suboptimal or deviant from model predictions. Nevertheless, we discuss specific predictions from our model that arise from the (supra) additivity assumption of information and reward and the discounting of future information. Neuronally, we discuss predictions and open questions about the neuronal encoding of information as predicted by our framework, in particular (empirically testable) predictions about dopaminergic responses to information and the interplay of a factorised (prefrontal cortex) and a conjunctive (dopamine neurons) value code.

We have now split up our description of the model into a more conceptual description in our Results section and a more technical description in our Materials and methodsmethods section at the end of the manuscript.

We have also tried to make the manuscript less "fragmented" (pointed out by referee 1) by describing how the different sections connect to each other at the beginning and end of the individual sections.

We hope that this is what you had in mind and that the manuscript has become more readable now. We would be happy to treat any of these aspects in more detail if you feel that our treatment of any of the raised issues was not sufficient.
