# Variational Intrinsic Control

In this paper we introduce a new unsupervised reinforcement learning method for discovering the set of intrinsic options available to an agent. This set is learned by maximizing the number of different states an agent can reliably reach, as measured by the mutual information between the set of options and option termination states. To this end, we instantiate two policy gradient based algorithms, one that creates an explicit embedding space of options and one that represents options implicitly. The algorithms also provide an explicit measure of empowerment in a given state that can be used by an empowerment maximizing agent. The algorithm scales well with function approximation and we demonstrate the applicability of the algorithm on a range of tasks.

## Authors

• 21 publications
• 24 publications
• 24 publications
• ### Diverse Exploration via InfoMax Options

In this paper, we study the problem of autonomously discovering temporal...
10/06/2020 ∙ by Yuji Kanagawa, et al. ∙ 1

• ### Unsupervised Discovery of Decision States for Transfer in Reinforcement Learning

We present a hierarchical reinforcement learning (HRL) or options framew...
07/24/2019 ∙ by Nirbhay Modhe, et al. ∙ 17

• ### Variational Intrinsic Control Revisited

In this paper, we revisit variational intrinsic control (VIC), an unsupe...
10/07/2020 ∙ by Taehwan Kwon, et al. ∙ 0

• ### Variational Option Discovery Algorithms

We explore methods for option discovery based on variational inference a...
07/26/2018 ∙ by Joshua Achiam, et al. ∙ 0

• ### Options of Interest: Temporal Abstraction with Interest Functions

Temporal abstraction refers to the ability of an agent to use behaviours...
01/01/2020 ∙ by Khimya Khetarpal, et al. ∙ 14

• ### Multi-agent Hierarchical Reinforcement Learning with Dynamic Termination

In a multi-agent system, an agent's optimal policy will typically depend...
10/21/2019 ∙ by Dongge Han, et al. ∙ 17

• ### Options as responses: Grounding behavioural hierarchies in multi-agent RL

We propose a novel hierarchical agent architecture for multi-agent reinf...
06/04/2019 ∙ by Alexander Sasha Vezhnevets, et al. ∙ 0

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1 Introduction

In this paper we aim to provide an answer to the question what intrinsic options are available to an agent in a given state – that is, options that meaningfully affect the world. We define options as policies with a termination condition, and we are primarily concerned with their consequences – what states in the environment they reach upon termination. The set of all options available to an agent is independent of an agent’s intentions – it is the set of all things that are possible for an agent to achieve. The purpose of this work is to provide an algorithm that aims to discover as many intrinsic options as it can, using an information theoretic learning criterion and training procedure.

This differs from the traditional approach to option learning where the goal is to find a small number of options that are useful for a particular task (Sutton et al., 1999; McGovern & Barto, 2001; Stolle & Precup, 2002; Silver & Ciosek, 2012; Kulkarni et al., 2016; Mankowitz et al., 2014; Vezhnevets et al., 2016; Bacon & Precup, 2015). Limiting oneself to working with relatively small option spaces makes both credit assignment and planning over long time intervals easier. However, we argue that operating on the larger space of intrinsic options, as alluded to above, is in fact useful even though the space is vastly larger. First, the number of options is still much smaller than the number of all action sequences, since options are distinguished in terms of their final states, and many action sequences can reach the same state. Second, we aim to learn good representational embeddings of these options, where similar options are close in representational space and where we can rely on the power of generalization. In such embedded spaces a planner needs only choose a neighborhood of this space containing options that have sufficiently similar consequences.

The idea of goal and state embeddings, along with a universal value function for reaching these goals, was introduced in Schaul et al. (2015). This work allowed an agent to efficiently represent control over many goals and to generalize to new goals. However, the goals were assumed to be given. This paper extends that work and provides a mechanism for learning goals (options) while preserving their embedded nature.

There are at least two scenarios where our algorithm can be useful. One is the classical reinforcement learning case that aims to maximize an externally provided reward, as we explained above. In this case, rather than learning options to uniformly represent control, the agent can combine extrinsic reward with an intrinsic control maximization objective, biasing learning towards high reward options.

The second scenario is that in which the long-term goal of the agent is to get to a state with a maximal set of available intrinsic options – the objective of empowerment (Salge et al., 2014). This set of options consists of those that the agent knows how to use. Note that this is not the theoretical set of all options: it is of no use to the agent that it is possible to do something if it is unable to learn how to do it. Thus, to maximize empowerment, the agent needs to simultaneously learn how to control the environment as well – it needs to discover the options available to it. The agent should in fact not aim for states where it has the most control according to its current abilities, but for states where it expects it will achieve the most control after learning. Being able to learn available options is thus fundamental to becoming empowered.

Let us compare this to the commonly used intrinsic motivation objective of maximizing the amount of model-learning progress, measured as the difference in compression of its experience before and after learning (Schmidhuber, 1991, 2010; Bellemare et al., 2016; Houthooft et al., 2016). The empowerment objective differs from this in a fundamental manner: the primary goal is not to understand or predict the observations but to control the environment. This is an important point – agents can often control an environment perfectly well without much understanding, as exemplified by canonical model-free reinforcement learning algorithms (Sutton & Barto, 1998), where agents only model action-conditioned expected returns. Focusing on such understanding might significantly distract and impair the agent, as such reducing the control it achieves.

Our algorithm can be viewed as learning to represent the intrinsic control space of an agent. Developing this space should be seen as acquiring universal knowledge useful for accomplishing a multitude of different tasks, such as maximizing extrinsic or intrinsic reward (see Oudeyer et al. (2008)

for an overview and useful references). This is analogous to unsupervised learning in data processing, where the goal is to find representations of data that are useful for other tasks. The crucial difference here, however, is that rather than simply finding representations, we learn explicit policies that an agent can choose to follow. Additionally, the algorithm explicitly estimates the amount of control it has in different states – intuitively, the total number of reliably reachable states – and can as such be used for an empowerment maximizing agent.

A most common criterion for unsupervised learning is data likelihood. For a given data set, various algorithms can be compared based on this measure. No such commonly established measure exists for the comparison of unsupervised learning performance in agents. One of the primary difficulties is that in unsupervised learning the data is known, but in control, an agent exists in an environment and needs to act in it in order to discover what states and dynamics it contains. Nevertheless, we should be able to compare agents in terms of the amount of intrinsic control and empowerment they achieve in different states. Just like there are multiple methods and objectives for unsupervised learning (Goodfellow et al., 2016), we can devise multiple methods and objectives for unsupervised control. Data likelihood and empowerment are both information measures: likelihood measures the amount of information needed to describe data and empowerment measures the mutual information between action choices and final states. Therefore we suggest that what maximum likelihood is to unsupervised learning, mutual information between options and final states is to unsupervised control.

This information measure has been introduced in the empowerment literature before (Salge et al., 2014; Klyubin et al., 2005) along with methods for measuring it (such as Blahut (1972); Arimoto (1972)). Recently, Mohamed & Rezende (2015)

proposed an algorithm that can utilize function approximation and deep learning techniques to operate in high-dimensional environments. However, this algorithm considers the mutual information between sequences of actions and final states. This corresponds to maximizing the empowerment over

open loop options, where the agent a priori decides on a sequence of actions in advance, and then follows these regardless of (potentially stochastic) environment dynamics. Obviously this often limits performance severely as the agent cannot properly react to the environment, and it tends to lead to a significant underestimation of empowerment. In this paper we provide a new perspective on this measure, and instantiate two novel algorithms that use closed loop options where actions are conditioned on state. We show, on a number of tasks, that we can use these to both significantly increase intrinsic control and improve the estimation of empowerment.

The paper is structured as follows. First we formally introduce the notion of intrinsic control and its derivation from the mutual information principle. After that, we describe our algorithm for intrinsic control with explicit options and argue for its viability in the experimental section. Last, we touch on intrinsic control with implicit options, and demonstrate that it scales up even better. We conclude with a short discussion on the merits of the approach and possible extensions.

## 2 Intrinsic Control and the Mutual Information Principle

In this section we explain how we represent intrinsic options and the corresponding objective we optimize.

We define an option as an element of a space and an associated policy that chooses an action in a state when following . The policy has a special termination action that terminates the option and yields a final state . Now let us consider the following example spaces for . 1) takes a finite number of values . This is the simplest case in which for each a separate policy is followed. 2)

is a binary vector of length

. This captures a combinatorial number of possibilities. 3) is a d-dimensional real vector. Here the space of options is infinite. It is expected that policies for nearby s will be similar in practice.

We need to express the knowledge about which regions of option space to consider. Imagine we start in a state and follow an option

. As environments and policies are typically stochastic, we might terminate at different final states at different times. The policy thus defines a probability distribution

. Now consider two different options. If they lead to very similar states, they should inherently, intrinsically, not be seen as different from one another. So how do we express our knowledge regarding the effective intrinsic option set in a given state?

To help answer this question, consider an example of a discrete option case with three options . Assume that always leads to a state while both and always lead to a state . Then we would like to say that we really have two intrinsic options: and . If we were to sample these options in order to maximize behavior diversity we would half of the time choose and half of the time any one of . The relative choice frequencies of and do not matter in this example. We express these choices by a probability distribution which we call the controllability distribution.

Intuitively, to maximize intrinsic control we should choose s that maximize the diversity of final states while, for given , controlling as precisely as possible what the ensuing final states are. The former can be expressed mathematically as entropy where . The latter, for a given , can be expressed as the negative log probability (the number of bits needed to specify the final state given ) which then needs to be averaged over and . Subtracting these two quantities yields the objective we wish to optimize – the mutual information between options and final states under probability distribution :

 I(Ω,sf|s0) = −∑sfp(sf|s0)logp(sf|s0)+∑Ω,sfpJ(sf|s0,Ω)pC(Ω|s0)logpJ(sf|s0,Ω), (1) = −∑ΩpC(Ω|s0)logpC(Ω|s0)+∑Ω,sfpJ(sf|s0,Ω)pC(Ω|s0)logp(Ω|s0,sf). (2)

The mutual information is symmetric and the second line contains its reverse expression. This expression has a very intuitive interpretation associated with it: we should be able to tell options apart if we can infer them from final states. That is, if for two options and , upon reaching state , we can infer it was option that was executed rather than , and when reaching a state we can infer it was option rather than , then and can be said to be intrinsically different options. We would like to maximize the set of options – achieve a large entropy of (the first term of (2)). At the same time we wish to make sure these options achieve intrinsically different goals – that is, that they can be inferred from their final states. This entails maximizing , the average of which is the second term of (2).

The advantage of this formulation is the absence of the term in the formulation, which is difficult to obtain as we would have to integrate over . In rewriting the derivation, however, the term was introduced, which we arrived at from using Bayes’ rule. The quantity is inherent to the environment, but obtaining Bayes’ reverse is difficult. However, it has an interpretation as a prediction of from final state . It would be fortuitous if we could train a separate function approximator to infer this quantity. Fortunately this is exactly what the variational bound (Mohamed & Rezende, 2015) provides (see Appendix 1 for derivation):

 IVB(Ω,sf|s0)=−∑ΩpC(Ω|s0)logpC(Ω|s0)+∑Ω,sfpJ(sf|s0,Ω)pC(Ω|s0)logq(Ω|s0,sf) (3)

where is an option inference function which can be an arbitrary distribution, and we have . In this paper we train both the parameters of , and the parameters of policy (which determines ) to maximize .

## 3 Intrinsic Control with Explicit Options

In this section we provide a simple algorithm to maximize the variational bound introduced above. Throughout we assume we have distributions, policies, and other possible functions parameterized using recent function approximation techniques such as neural networks, and state representations are formed from observations using recurrent neural networks. However, we only calculate the mutual information between options and final observations instead of final states, and leave the latter for future work. Algorithm

1 provides an outline of the basic training loop.

This algorithm is derived from (3) in Appendix 2. Note again that appears in (3) by determining the distribution of terminal states . Here we give an intuitive explanation of the algorithm. In a state an agent tries an option from its available options . Its goal is to choose actions that lead to a state from which this can be inferred as well as possible using option inference function . If it can infer this option well, then it means that other options don’t lead to this state very often, and therefore this option is intrinsically different from others. This goal is expressed as the intrinsic reward (discussed in the next paragraph). The agent can use any reinforcement learning algorithm (Sutton & Barto, 1998), such as policy gradients (Williams, 1992) or -learning (Watkins, 1989; Werbos, 1977), to train a policy to maximize this reward. In the final state, it updates its option inference function towards the actual chosen (by taking the gradient of ). It also reinforces the prior based on this reward – if the reward were high, it should choose this option more often. Note that we can also keep prior

fixed, for example to the uniform Gaussian distribution. Then, different values of

will result in different behavior through learning.

The intrinsic reward equals, on average, the logarithm of the number of different options an agent has in a given state – that is, the empowerment in that state. This follows from the definition of mutual information (3) – it is the expression we get when we take a sample of and . However, we also provide an intuitive explanation. The is essentially the negative logarithm of the number of different s we can choose (for the continuous case, imagine finely discretizing). However, not all s do different things. The region where is large defines a region of similar options. The empowerment essentially equals the number of such regions in the total region given by . Taking the logarithm of the ratio of the total number of options to the number of options within a region gives us .

We train using policy gradients (Williams, 1992)

. During training we estimate a baseline to lower the variance of weight updates (see Appendix 2). This baseline tracks the expected return in a given state – intrinsic reward in this case, which equals the empowerment. As such, the algorithm actually yields an explicit empowerment estimate.

### 3.1 Experiments

#### 3.1.1 Grid World

We demonstrate the behavior of the algorithm on a simple example of a two-dimensional grid world. The agent lives on a grid and has five actions – it can move up, down, right, left and stay put. The environment is noisy in the following manner: after an agent takes a step, with probability the agent is pushed in a random direction. We follow Algorithm 1. We choose to be a discrete space of options. We fix the option prior to be uniform (over values). The goal is therefore to learn a policy that would make the options end at as different states as possible. This is measured by the function which, from the state reached, tries to infer which option was followed. At the end of an episode we get an intrinsic reward ( because is fixed). If a particular option is inferred correctly and with confidence, then will be close to zero and negative, and the reward will be large (). If it is wrong, however, then will be very negative and the reward small. As we are choosing options at random (from the uniform ), in order to get a large reward on average, different options need to reach substantially different states in order for the to be able to infer the chosen option. In a grid world we can plot at which locations a given option is inferred by , which are the locations to which the option navigates. This is shown in the Figure 1 top, with each rectangle corresponding to a different option, and the intensity denoting the probability of predicting a given option. Thus, we see that indeed, different options learn to navigate to different, localized places in the environment.

In this example, we use Q-learning to learn the policy. In general we can express the Q function for a set of different options by running the corresponding input states through a neural network and outputting values, one for each option and action. This way, we can update of all the options at the same time efficiently, on a triplet of experience . In this experiment we use a linear function approximator, and terminate options with fixed probability . We could also use a universal value function approximation (Schaul et al., 2015). For continuous option spaces we can still calculate the by passing an input through a neural network, but then update the result on several, randomly sampled options at the same time. Such an option space is then an option embedding in itself.

#### 3.1.2 ’Dangerous’ Grid World

The second environment is also a grid world, but with special properties. It consists of two parts: a narrow corridor connected to an open square (see figure 2, top-left), blue denoting the walls. However the square is not just a simple grid world, but is somewhat dangerous. There are two types of cells arranged as a checkerboard lattice (as on a chess board). On one sub-lattice, only the left and right actions actually move the agent to the adjacent states and on the other sub-lattice only the up and down actions do. If the agent picks an action that is not one of these, it falls into a state where it is stuck for a long time. Furthermore, the move to an adjacent state only happens with some probability. Because of this, if the agent doesn’t observe the environment, it quickly loses the information about which sub lattice it is on, and thus inevitably falls to the low empowerment state. To show this we computed the exact empowerment values at each location for an open-loop policy using the Blahut-Arimoto algorithm for horizons to , the result is shown in figure 2(bottom). On the other hand, if the agent observes the environment, it knows which sub-lattice it is on and can always choose an action that doesn’t let it fall. Thus it can safely navigate the square. In our experiments, the agent indeed accomplishes this, and it learns options inside the square (see figure 2, top-right).

### 3.2 The Importance of Closed Loop Policies

Classical empowerment (Salge et al., 2014; Mohamed & Rezende, 2015) maximizes mutual information between sequences of actions and final states. That is, it maximizes the same objective function (3), but where . This corresponds to maximizing empowerment over the space of open loop options. That is, options where an agent first commits to a sequence of actions and then blindly follows this sequence regardless of what the environment does. In contrast, in a closed-loop option every action is conditioned on the current state. We show that using open-loop options can lead to severe underestimation of empowerment in stochastic environments, resulting in agents that aim to reach low-empowerment states.

We demonstrate this effect in the ’dangerous grid world’ environment, section 3.1.2. When using open loop options of length , an agent at the center of the environment would have exponentially growing probability of being reset as a function of the option length , resulting in an estimation of empowerment that quickly decreases with the option length, having its highest value inside the corridor at the top-left corner as shown in Figure 1 (bottom). A consequence of this is that such an agent would prefer being inside the corridor at the top-left corner, away from the center of the grid world.

In great contrast to the open loop case, when using closed loop options the empowerment will grow quadratically with the option length, resulting in agents that prefer staying at the center of the grid world.

While this example might seem contrived, it is actually quite ubiquitous in the real world. For example, we can navigate around a city, whether walking or driving, quite safely. If we instead committed to a sequence of actions ahead, we would almost certainly be run over by a car, or if driving, crash into another car. The importance of the closed loop nature of policies is indeed well understood. What we have demonstrated here is that one should not use open loop policies even to measure empowerment.

The advantages of Algorithm 1 are: 1) It is relatively simple, 2) it uses closed loop policies, 3) it can use general function approximation, 4) it is naturally formulated with combinatorial options spaces, both discrete and continuous and 5) it is model-free.

The primary problem we found with this algorithm is that it is difficult to make it work in practice with function approximation. We suggest there might be two reasons for this. First, the intrinsic reward is noisy and changing as the agent learns. This makes it difficult for the policy to learn. The algorithm worked as specified in those simple environments above when we used linear function approximation and a small, finite number of options. However, it failed when neural networks were substituted. We still succeeded by fixing the intrinsic reward for a period of time while learning the policy and vice versa. However, replacing the small option space by a continuous one made training even more difficult and only some runs succeeded. These problems are related to those in deep reinforcement learning (Mnih et al., 2015), where in order to make learning work well with function approximation, one needs to store a large number of experiences in memory and replay them. It is possible that more work in this direction would find good practices for training this algorithm with general function and distribution approximations.

The second problem is exploration. If the agent encounters a new state, it should like to go there, because it might correspond to some new option it hasn’t considered before and therefore increase its control. However, when it gets there, the option inference function has not learned it yet. It is likely inferring the incorrect option, therefore giving a low reward and therefore discouraging the agent from going there. While the overall objective is maximized when the agent has the most control, the algorithm has difficulty maximizing this objective because two functions – the intrinsic reward and the policy – have to match up. It does a good job of expressing what the options are in a region it is familiar with, but it seems to fail to push into new state regions. Hence, we introduce a new algorithm formulation in section 4 to address these issues.

## 4 Intrinsic Control with Implicit Options

To address the learning difficulties of Algorithm 1 we use the action space itself as the option space. This gives the inference function grounded targets which makes it easier to train. Having a sensible makes the policy easier to train. The elements of the algorithm are as follows. The controllability prior and policy in Algorithm 1 simply become a policy, which we denote by . The is an internal state that is calculated from . In our implementation it is the state of a recurrent network. The function in Algorithm 1 should infer the action choices made by knowing the final observation and thus becomes where is its internal state calculated from . The logarithm of the number of action choices at that are effectively different from each other – that can be distinguished based on the observation of the final state – is given by . We now introduce an algorithm that will maximize the expected cumulative number of distinct actions by maximizing the intrinsic return in algorithm 2.

In this setting, maximization of control is substantially simplified. Consider an experience generated by some policy. The learning of

is a supervised learning problem of inferring the action choices that led to

. Even the random action policy terminates at different states, and thus is able to train on such experiences, mimicking decisions that happen to lead to . The can be thought of as choosing among those that lead to diverse states, which in turn makes learn from experiences generated by those policies. The ability of to train on any experience motivated us to add an exploratory update in Algorithm 2.

In the experiments that follow, we use the following functions for policies (see Appendix 3 for the equations). Every input is passed through a fully connected, one layer neural network with a standard rectifier non-linearity, resulting in an embedding . This is passed to an LSTM recurrent net (Hochreiter & Schmidhuber, 1997) which outputs the policy probabilities over actions. For , we concatenate the embedding and and pass through another one layer neural net to obtain a state . This, together with hidden state of the LSTM net, is passed to another LSTM network, which outputs the probabilities over actions.

Two facts are worth highlighting here. First, Algorithm 2 applies to general, partially observable environments since the policies and build their own internal states. However, more generally, we should use final states of the environment instead of observations as the set of states an agent can reach. We leave this aspect to future work. Second, the policy can be thought of as an implicit option. However, the embedding of the final observation (or state more generally) can be thought of as an explicit option and the policy as the policy implementing this option.

### 4.1 Experiments

We test this algorithm on several environments. The first one is a grid world of size with four rooms (see Figure 3 left (no action noise)). A random action policy of length leads to final states whose distance from the initial state is distributed approximately according to a Gaussian distribution of width within a room. For on the order of the environment size, such an agent rarely crosses to a different room, because of the narrow doors between the rooms. Figure 3 shows trajectories learned by Algorithm 2. We see that indeed they are extended, spanning large parts of the environment. Furthermore many trajectories cross to different rooms passing straight through the narrow doors without difficulty. This is interesting, because while the policy is conditioned on the final state, the policy that is actually followed was not given any notion of the final state explicitly. It implicitly learns to navigate through the doors to different parts of the environment.

To maximize intrinsic control, the distribution of final points that reaches should be uniform among the points that are reachable from a given state. This is because we can tell every point from any other point equally well. Figure 3 (center) shows the distribution of the end points reached by the algorithm for trajectories of length , starting at different points in the environment. For example, the top left square shows the end point distribution for starting at the top left corner. We see that the distribution is indeed roughly uniform among the reachable points. The average empowerment after learning reaches nats which corresponds to different reachable states.

In the second experiment we use a three dimensional simulated environment (Figure 3, right). At a given time the agent sees a particular view of its environment which is a color image. The figure shows example trajectories that the agent follows (moving downwards in the figure) using policy . We see that the trajectories seem intuitively much more ‘consistent’ than those a random action policy would produce. The average empowerment achieved for trajectories of length was nats which corresponds to reaching different states.

The third environment is again a grid world, but it contains blocks that the agent can push. The blocks cannot pass through each other or through the boundary, and the agent cannot push two blocks at the same time. In this case, the visual space is small, but there are combinatorially many possibilities. Figure 4 shows a typical trajectory. We see that the agent pushes the first block down, then it goes around the second block and pushes it up, then goes to the third one and pushes it down, and then arrives at its final position. The average empowerment is nats which corresponds to being able to reach different states.

### 4.2 Elements Beyond an Agent’s Control

One prevalent feature of the real world is that there are many elements beyond our control such as falling leaves or traffic. One of the important features of these algorithms is that intrinsic options represent things that an agent can actually control and as such does not have to model all the complexities of the real world – these algorithms are model-free. To demonstrate this property we introduce environments with elements beyond an agent’s control.

The first environment is the same four room grid world used above, but with two distractors moving around at random, that live on different input feature planes. These distractors do not affect the agent, but the agent does observe them. The agent needs to learn to ignore them. We find that the agent reaches the same amount of empowerment with and without the distractors (see Figure 6 in Appendix 4).

The second environment consists of pairs of MNIST digits forming a image. There are five actions that affect classes of the digits. The first action doesn’t change the classes, the next two increase/decrease the class of the first digit and the next two increase/decrease the class of the second digit (wrapping around). When a class is chosen, a random digit from that class is selected. Thus the environment is visually complex, but has a small control space. Example trajectories followed by the agent are shown in Figure 5, left. The empowerment obtained by the agent with policies of length actions is , which corresponds to states. As there are 100 controllable states in the environment (but total states), we see that agent achieves nearly maximum possible intrinsic control.

### 4.3 Open vs Closed Loop Options

Next we compare agents utilizing open and closed loop options. We use the grid world environment but add noise as follows. After an agent takes a step, the environment pushes the agent in a random direction. While the closed loop policy can correct for the environment noise, for example by following a strategy of always going towards the goal, an open loop policy agent has less and less information on where it is in the environment as time goes by and it cannot navigate reliably towards the actual target location. We implement the open loop agent using the Algorithm 2 but we only feed the starting and the end states to the recurrent network. Table 1 shows the comparison. We see that the closed loop agent indeed performs much better.

### 4.4 Maximizing Extrinsic Reward

Finally, while the primary focus of the paper is unsupervised control, we provide a proof-of-principle experiment that shows that learned policies can help in learning extrinsic reward. We consider the following situation. An agent is placed in an environment without being told what the objective is. The agent has an opportunity to explore and learn how to control the environment. After some amount of time, the agent is told the objective as an extrinsic reward , and has a limited amount of time to collect as much reward as possible. There could be a number of ways to use the learned policies and to maximize the extrinsic reward. In our case we simply combine the intrinsic and extrinsic rewards, and reinforce the policy in Algorithm 2 with where is a large constant ( in our experiment). We use the four room grid world and, after different periods of time, we place a reward at location . Figure 5 (right) shows the reward collected per episode after different amounts of unsupervised pre-training or using pure reinforce without the maximum control objective (red curve). We see that, indeed, the agent learns to collect reward significantly faster after having an opportunity to interact with the environment.

## 5 Conclusion

In this paper we introduce a formalism of intrinsic control maximization for unsupervised option learning. We presented two algorithms in this framework and analyzed them in a diverse range of experiments. We demonstrated the importance of closed loop policies for estimating empowerment. Additionally, we also demonstrated the usefulness of unsupervised learning and intrinsic control for extrinsic reward maximization.

#### Acknowledgments

We thank Shakir Mohamed, Frederic Besse, David Siver, Ivo Danihelka, Remi Munos, Ali Eslami, Tom Schaul, Nicolas Heess and Daniel Polani for useful discussions and comments.

## Appendix 1: Derivation of the Variational Bound on Mutual Information

Here we derive the variational bound (3). We drop the indices from variables and drop :

 I(Ω,s) = −∑Ωp(Ω)logp(Ω)+∑Ω,sp(Ω,s)logp(Ω|s) (4) = −∑Ωp(Ω)logp(Ω)+∑Ω,sp(Ω,s)logq(Ω|s)+∑sp(s|Ω)KL(p|q) (5) ≥ −∑Ωp(Ω)logp(Ω)+∑Ω,sp(Ω,s)logq(Ω|s)=IVB(Ω,s). (6)

## Appendix 2: Derivation of Algorithm 1

Here we show the variational bound (3) again, with parameters of and parameters of made explicit:

 IVB(Ω,sf|s0)=−∑ΩpCθ(Ω|s0)logpCθ(Ω|s0)+∑Ω,sfpJ(sf|s0,Ω)pCθ(Ω|s0)logqϕ(Ω|s0,sf) (7)

Taking the gradient with respect to is straightforward. We obtain a sample and a sample of by following the policy till termination. Then we can directly take the gradient of which is the gradient of the standard likelihood maximization.

Taking the gradient with respect to results in the following:

 ∇θIVB = −∑ΩpCθ(Ω|s0)(−1−logpCθ(Ω|s0)+∑sfpJ(sf|s0,Ω)logqϕ(Ω|s0,sf))∇θlogpCθ(Ω|s0) (8) = −∑Ω,sfpJ(sf|s0,Ω)pCθ(Ω|s0)(−1−logpCθ(Ω|s0)+logqϕ(Ω|s0,sf))∇θlogpCθ(Ω|s0).

Now, we can add any number inside the central bracket because the resulting sum is zero:

 ∑Ω,sfpJ(sf|s0,Ω)pCθ(Ω|s0)b(s0)∇θlogpCθ(Ω|s0) (9) = b(s0)∑Ω,sfpJ(sf|s0,Ω)∇θpCθ(Ω|s0) (10) = b(s0)∇θ∑ΩpCθ(Ω|s0) (11) = b(s0)∇θ1=0. (12)

Thus we obtain

 ∇θIVB = −∑Ω,sfpJ(sf|s0,Ω)pCθ(Ω|s0)(rI−b(s0))∇θlogpCθ(Ω|s0) (13) rI = logqϕ(Ω|s0,sf)−logpCθ(Ω|s0). (14)

This is the standard policy gradient update (along with its typical derivation): we sample , then pretend as we were training generative model on observed by maximum likelihood (taking the gradient of ), but we multiply (reinforce) the resulting gradient by the corrected reward (return) . The baseline aims to predict and is trained by regressing the values of towards observed . Thus if in a given episode we obtain a larger then expected reward, the likelihood of generating the same is increased, and vice versa. In this particular case, because is a sampled empowerment at the state , tends towards the expected empowerment at that state.

Finally we would like to update the policy. Keeping and fixed we would like to know how to change the policy to increase the . In a given sampled experience the value of becomes . We can use any reinforcement learning algorithm to maximize this reward.

## Appendix 3: Functional Forms for Intrinsic Control with Implicit Options

We show the functional forms used in the Algorithm 2 for the policies and . Let be a sequence of observations and actions. We assume we have computed embedding of the final observation . The computations at time step are the following:

 ut = RWxt, (15) hpt,cpt = LSTM([hpt−1,ut,at−1],cpt−1), (16) πpt = softmax(Whpt), (17) vt = RW[ut,uf], (18) hqt,cqt = LSTM([hqt−1,hpt,vt,at−1],cqt−1), (19) πqt = softmax(Whqt), (20)

where is a linear operation (including biases that are suppressed from equations for clarity), is the rectifier nonlinearity, LSTM equations are below, denotes concatenation of vectors and and are states of LSTM. The LSTM equations are

 h,c = LSTM(y,c): (21) bi,bf,bo,bu = split(Wy), (22) gi = σ(bi), (23) gf = σ(bf), (24) go = σ(bo), (25) u = tanh(bu), (26) c = gfc+giu, (27) h = tanh(c). (28)

## Appendix 4: The Effect of Distractors on Intrinsic Control

Figure 6 displays a graph showing that the agent learns to ignore distractors that do not affect its intrinsic control. The environment is a grid world with two points that move on a different feature plane and do not affect the agent, except as a visual distractor. We tested several environment sizes and option lengths.