Humans have evolved to live in societies and a major benefit of that is the ability to leverage the knowledge of parents, ancestries or peers to aid their understanding of the world and more rapidly develop skills deem crucial for survival. Most of this learning is done by observing the behaviour of the other agents; from this emerges role modeling, imitation or observational learning. We are particularly interested by observational learning in this paper and we define it as the ability for an agent to modify its behavior or to acquire information as an effect of observing another agent sharing its environment.
. In the recent years, combining RL with the increased representational power of deep learninglecun2015deep and the memory capabilities of recurrent models (LSTMs/GRUs) hochreiter1997long ; chung2015gated has lead to a string of impressive successes ranging from video-game playing mnih2015human to 3D navigation tasks mnih2016asynchronous ; mirowski2016learning and robotics levine2016end . Motivated in part by these, we here want to study if observational learning can naturally emerge in DeepRL agents empowered with memory. The main questions we would want to answer are then: is (deep) RL coupled with memory enough to successfully tackle observational learning? Will the RL agent learn to ignore or leverage the teacher? Is the RL signal enough for the emergence of more complex behaviour like imitation, goal emulation or information seeking? In other words, we want to understand to whether other agents have to explicitly be modeled as such by learning agents or if the combination of perception (deep nets), memory (recurrent nets) and motivation (RL) is enough to learn from the sole observation of other agents’ effects on a shared environment.
It is worth noting that similar questions have been investigated in the cognitive and behaviour science community. In his work in 1977, Bandura proposed and coined the term ’observational learning’ or social learning bandura1977social ; bandura1963social
. According to him, observational learning differs from imitative learning in that it does not strictly require a duplication of the behavior exhibited by the teacher/expert. Heyes (1993) distinguished imitation and non-imitative social learning in the following way: imitation occurs when animals learn about behavior from observing conspecifics (sometimes other species), whereas non-imitative social learning occurs when animals learn about the environment from observing others (conspecifics or not)heyes1993imitation , meaning that one can learn about the dynamics of its environment only by observing other agents evolving in this environment.
Learning with the help of a teacher (or expert) is by no means a new idea in machine learning neither. Imitation learning has a long standing in the machine learning literature schaal1999imitation ; argall2009survey . In this body of work, one can distinguish two major ideas: i) behaviour cloning, where we are regressing directly onto the policy of another agent/expert pomerleau1989alvinn ; ratliff2007imitation , or ii) inverse RL, where we are trying to infer a reward function from the behaviour of other agents russell1998learning ; ng2000algorithms and then use this, in conjunction with RL techniques, to optimize this inferred function. While these methods have been successfully applied to a variety of tasks pomerleau1989alvinn ; atkeson1997robot ; ziebart2008maximum ; kolter2008hierarchical ; ross2011reduction ; ho2016showing ; ho2016generative ; piot2014predicting ; neu2009training , one problematic aspect of both these scenarios is that they almost always need to provide the learning agent with the expert trajectories in the same state-action space as the learner. Otherwise, some explicit mapping between the learner and the teacher state space has to be discovered stadie2017third . As previously argued/recognized in stadie2017third , these can be somewhat restrictive and unrealistic requirements. Furthermore, in inverse RL one has to explicitly model the behaviour/trajectories coming from another agent and infer the reward signal. In order for this problem to become tractable, most of the time we need to make some structural assumptions about this reward – like linearity in a given feature space, or smoothness abbeel2004apprenticeship ; piot2014boosted . These assumptions might not model closely to the true reward signal and minor approximation errors can be easily amplified when planning onto this faulty signal piotECML .
Given these increased complexities, we propose to study the simpler yet more natural alternative of observational learning, moving away from the traditional setup of learning from experts. This is not to say that we can address all of the problems tackled by the imitation learning literature. We are merely arguing that there might be scenarios where this level of modelling is not required and the RL agent can learn more directly through pure observations. In this context, our main contribution is to exhibit scenarios where observational learning is emerging from a standard DeepRL algorithm (A3C mnih2016asynchronous ) when combined or not with memory. In all our scenarios, the A3C agent (learner or student) shares its environment with another agent (expert or teacher) that has a better knowledge of the task to solve. The learner observes the expert through its sole perception of the environment. It is only rewarded for performing the task and doesn’t receive any incentive to follow, imitate or interact with the expert. The expert is not aware that it is watched by the learner and is not meant to teach or provide extra information to the learner neither. By building tasks of increasing difficulty, we show that complex behaviours such as imitative and non-imitative learning emerge without explicit modeling of the expert. In addition, we provide some theoretical insights to explain why these behaviours are possible.
2 Experimental design
As explained in the introduction, we are primarily interested to see if an RL agent can learn to leverage the behaviour of an expert, based solely on 1) external reward (from the environment), ii) its ability to observe the consequences of the expert’s actions in the environment. The learner does not have a notion of the agency of the teacher. This additional agent is simply part of the learner’s environment and it can choose to ignore the presence of the expert if it deems this signal unimportant. It is worth noting that in all our case studies, the presence of the teacher does not impact the dynamics nor rewards of the RL agent. This is a necessarily assumption that will be formalized in Section 3.
The first question we want to answer is whether the teacher’s presence has any impact on the learner. For this we look at two scenarios: 1) the learner has perfect information and can learn an optimal behaviour on its own, 2) the learner has only partial information about the environment/task, but the expert’s behaviour can provide additional information by providing a demonstration of the desired behaviour. In the first case, we do not expect a difference between the learnt policies with or without the expert. Nevertheless, when adding the teacher in the same environment, we are effectively expanding the state space of the learning agent. Thus, on top of the RL policy, now the student also needs to learn to ignore this extra signal in its state space. In the second scenario however, the expert’s behaviour contains crucial information for improving the student’s policy. In this case, by ignoring the expert, the student can still complete the task at hand, but can only do so, sub-optimally. Now, there is a real incentive for the learning agent to pay attention to the teacher. Nevertheless, the student’s own reward signal is still the one coming directly from the environment (which it would experience even without the other agent), but now our agent needs to somehow correlate this (potentially sparse) reward signal with the behaviour exhibited by the teacher. This is a highly non-trivial association the learning agent needs to make. And then learn to exploit it, in order to improve its policy.
If the two agents have the same reward structure, a good strategy for the learning agent would be to imitate, if possible, the expert’s behaviour. This, in principle, is a much easier and safer policy than attempting to randomly explore the environment on its own. The student would only need to solve the local problem of following the expert, but would not need to worry about the global task - the global planning that is now done by the expert. Although this might not be optimal, this kind of behaviour is transferable between tasks and/or environments and could potentially provide the student with a better initial policy of exploring an unfamiliar environment. This could lead to a more principled/guided way to explore an unknown environment and have a major impact on the speed at which the agent discovers areas of interest, especially in a sparse reward setting.
Finally, we are interested in showing that the student can become autonomous and still perform the task optimally in the absence of the expert after learning from observations. Indeed, the final goal of a learning agent is to solve tasks on its own and it should still be able to reach that goal after having learned optimal policies from a teacher.
3 Learning by observing an expert
A Markov Decison Process (MDP) is a a tuple where is a set of states, is the set of actions available to the agent, is the transitional kernel giving a probabily over next states given our current state and action, is a reward function and is a discount factor.
We define a (stochastic) policy
that maps states into a probability over the set of actions. Given such a policywe can define the value function as the expected cumulative discounted reward associated with following this policy:
In RL, we are interested in finding an optimal policy that results in the maximum value function , where .
3.2 MDP with another agent
By introducing the expert (following policy ) in the learner’s environment and making it visible in the observational state of the learner, we change the learner’s MDP. The resulting MDP can be parameterized as follows: , where now the state space consists of: i) a part of the state space that can be directly influenced by the learner, we will refer to this part of the state space as the controllable part of the state space and ii) a part of state space that the learner does not have any direct control over, but this is still part of its observational state and includes useful information, . In our case, will include observations corresponding to the presence of the teacher. Given this factorization, and the transition dynamics naturally factorizes over these dimensions:
Thus, if the policy of the expert (other agent) is stationary, introducing the extra agent results in another valid MDP. On the other hand, if the policy of the other agent in not stationary, the induced transition kernel will change every time there is a switch in the expert’s policy.
3.3 Formal setup
We consider a set of MDPs that share states, actions, transition dynamics and discount factor, but differ in the reward function . Now, let us consider uniformly sampling one of these MDPs and unrolling one episode given this sampled choice. Once the episode has terminated, we re-sample from and repeat this process at the start of each episode. This procedure defines another MDP
In the following we will distinguish the MDPs with the teacher as and the one including the expert in the same environment and the respective optimal policies and .
Introducing an expert into the environment. The question we would like to answer is whether it is possible to do better than the above stationary policy, when placing the student in the augmented MDP . Now our agent has access to another agent’s behaviour, but only through its own observational state. Another consequence of moving to is an augmentation in the state space, which results also in an expansion of the policy space under consideration. Since the set of possible policies in is a superset of the policies in , it is easy to see that the optimal policy in the augmented space is at least as good as the optimal policy in the original MDP :
The agent can leverage the behaviour of the teacher in order to learn a policy that is better than defined in eq. 1. Given this setup, let us take a closer look at two particular case studies, where this might occur:
i) Imitation. Let us consider the case where , where is the action-space of the expert. Let us assume the teacher’s policy is better than the stationary policy defined in eq. 1, – otherwise there is no incentive to deviate from if the behaviour proposed for cloning is inferior. If includes the actions taken by the expert, then imitation can trivially take place, by just reading off the desired action from : 222We assume the two agents have the same starting position, but this is can relaxed, by first employing a policy that gets the learning agent close enough to the teacher, after which the mimicking behaviour can occur. We assume the learner to always be one step behind the teacher, but longer time difference can be negotiated via a memory component.. It is actually a known result that observing experts’ actions is mandatory to achieve actual imitation ho2016generative . In a purely observational setting though, the student would not have typically access directly to the actions performed by the expert. Nevertheless, we also know that in a deterministic environment, observing the effects of one’s actions in the environment is enough to infer/encode the action that was performed. To learn this mapping we need to ’remember’ or keep track of at least two consecutive observations of the teacher’s state. Thus, if imitation is to emerge, it can only do so in a system able to distill this information from the observational state. For this our agents will need memory or augmentation of the state space to include several time steps.
ii) Information seeking behaviour. If the MDP () is identified, then the learner’s policy can become independent of the teacher as the task can be optimally performed by the learning agent, without any input from the teacher. We denote the optimal policy in . We will make the additional assumption that given the optimal policy in the MDP with or without the expert is the same. Formally, . Thus, if the identity of the task is known, the optimal behaviour of the agent would be to just switch between these optimal policies given the context : . This policy is optimal for each of the sampled MDPs and results in an optimal behaviour in , provided the context is known. If this information can be distilled from the observation of the other expert, the learner can improve over the stationary policy defined in eq. 1. Thus if s.t. , then a stationary policy in the augmented state space that (can) outperfom :
Note that can, in principle, take into account in its computation, a series of observations of the expert (several steps of its trajectory). This can be practically implemented by stacking several recent observations in our current state space, or relying on a memory/recurrent model to distill this temporal information as part of its hidden state and infer the current context.
For our experiments, we choose a widely used DeepRL algorithm: the Asynchronous Advantage Actor-Critic (A3C) algorithm mnih2016asynchronous . This learns both a policy (the actor), and value function (the critic) given a state observation . The two approximations share the intermediate representation and only diverge in the final fully-connected layer. The policy is given by a softmax over actions. The setup closely follows mnih2016asynchronous including the entropy regularization and the addition of an LSTM layer to incorporate memory. We use both a simple feed-forward and a recurrent version in our experiments. For further details, we refer the reader to the original paper.
As a set of scenarios, we consider a series of simple navigation tasks. We first start with a two-room layout (Figure (a)a) and place the two agents in this environment. Possible goal locations considered are the corners of each of the two rooms (8 in total). At the start of each episode, we sample uniformly the location of the goal and make this information available to the teacher at all times. For the learning agent, we consider both including and occluding the goal in its observational space. In the second version of this task, the student does not know which goal is activated at this point in time. It can only learn that the possible positions of the reward are the eight corners. If it ignores the expert’s behaviour the optimal stationary policy would be to visit all of these locations in the minimum time possible. On the other hand, the teacher has access to the goal and can seek it directly. By observing its behaviour, the learner could potentially disentangle which corner is active, or at least narrow down the correct room, and use this information to improve its performance.
4.1 Global view: task identity occluded, but perfect information otherwise.
We provide the student with a top-view representation of the environment. We use a one-hot encoding for each element present in the environment: one channel for the layout (L), one for the position of the agent (A), one for the position of the teacher (T), one for the position of the goal (G). We implement four variations of this observational space: LA, LAG, LAT, LAGT.
We run this experiment with an A3C agent with two small convolutional layers, followed by a fully connected layer. The results are displayed in Figures (a)a (Feed-forward network), (b)b (LSTM with 32 units). The first thing to notice is that, with perfect information, the learned policies with or without the teacher have the same asymptotic performance. Moreover the speed at which this is reached is not negatively impacted by the expansion of the state space. Thus, for this experiment we conclude that the presence or absence of the teacher does not have an impact on the learning process – this is observed across multiple experiments (Appendix A).
In the second case, when the student has impoverished knowledge of the environment, we can clearly spot a difference between the performance of the student when sharing in the same environment with the teacher and acting on its own. For the first part of the training, the agent achieves similar performance, but at some point, the agent sharing the same environment with the teacher manages to leverage this extra signal to significantly improve its policy.
As we observed that the student is able to exploit the expert’s behaviour for its own benefit, we now want to know if it is a transferable knowledge across different environments. To test this out, we constructed two other “levels”, by adding an additional room each time and thus smoothly increasing the difficulty of the task. A depiction of these levels can be found in Figure (b)b, (c)c. When extending the environment, we also naturally extend the number of possible goal locations. The average number of steps to the goal increases and when the goal location is occluded the ’blind’ stationary policy will be quite expensive, thus it becomes more and more crucial for the agent to leverage the expert.
We train on these new levels in a curriculum fashion: first we train on level 1, then continue training on level 2, and finally on level 3. This is mainly done to speed up training time, but also we expect the agent to learn the importance of the expert in level 1 and continue to employ this knowledge in its learning process in the next levels. The specification of the observational state of the learner is maintained throughout the curriculum: with/without the teacher, with/without the goal visible. The results are compiled in Figure (a)a, (b)b. For reference, we included the baseline of learning in these levels starting from a random initialization, with the curriculum. The curriculum helps the learning process both when the goal is visible and when it is occluded: the performance is slightly better to begin with and then convergence is achieved considerably faster. Most importantly, the presence of the expert consistently improves the policy of the ’blind’ agent across all levels. It is worth noting also, that for the last level when the goal is occluded, both the baseline and the lone agent are not always able to complete the task, whereas the agent leveraging the teacher can almost instantaneously complete the task at each episode (the transfer to level 3 is almost zero-shot).
4.2 Local view: agent needs to actively keep track of the expert, if useful
We have seen in the previous section that by just using RL on the same reward signal, we can obtain different policies when environment is augmented with the presence of an expert. Although occluding the goal might seem like a somewhat artificial task, this is just a proxy for impoverished or imperfect information. Yet we aknowledge that a more natural example of this is partial observability – when the agent has only a local view of the environment. We thus simulate this in our environment by taking a local window of observation centered around the agent. The rest of the setup remains the same, but note that we are changing the nature of the problem quite drastically. This is especially true if one thinks about the setting in which the teacher is in the picture. In this new scenario, the learner will have to actively pursue the expert if it has any hope of benefiting from its presence. If it cannot see the expert, the learner cannot learn from it.
Because of the increased complexity, we now start with only one of the two rooms in level 1 and we basically treat this as pre-training of simple navigation skills with local view. In this level, the learner can learn to navigate to the goal and visit the potential locations where the goal is hidden, but we do not observe any benefit from having the expert present. The size of the local window of observation is the size of the room – if the agent is in the middle of the room it can see the whole room. This always means that the problem of keeping track of the other agent is not very difficult in this first setting. The size of the window ensures that the expert is seen in a good proportion of the observations. The learning curves can be found in Figure 4. Nevertheless, a different story emerges when we look at the training in level 1. First, we observe that when the goal is hidden, but the teacher is present, we get an improvement in policy over the scenario where the agent is alone in the environment. This is consistent with what we have seen before in the global view. When the potential benefit over the ’blind’ stationary policy is big enough, the student begins to ’pay’ attention to the teacher and uses these observations to improve its own policy. This carries on to levels 2 and 3. Furthermore, at these last levels, we can see that in the cases where the teacher is present, the asymptotic performance of the agent matches or slightly outperforms that of the lone agent with the goal visible. This is remarkable as we are now seeing an improvement in policy even when the goal is (locally) visible. This is because in partial observability the trajectory of the expert still contains valuable information about where the goal might be. At each step, the teacher narrows down the possible locations.
4.3 Breaking away from the teacher
The fact that the final performance is independent of the goal’s presence or absence in the state space suggests that the only information the agent learns to exploit is the behaviour of the teacher. Visual inspection of the final policies fully supports this intuition. The behaviour that emerges is the following: the agent seeks the teacher and tries to get as close as possible to it, after which it simply follows it to the goal.333 Videos of these behaviours can be found in the Supplementary Material and further illustrations here. This is potentially a very useful, transferable strategy to a different environment. To test this idea, we expand further our environment to 9 rooms and without any further learning, the previously trained agent can successfully negotiate this new environment with the help of the teacher and succeeds in finding goals it has never seen before. Nevertheless, relying always on the teacher is somewhat unsatisfactory. In fact, if we do eliminate the teacher, the learning agent is quite lost. It will only reach for the goals currently visible if any, and otherwise will continue waiting for the other agent to appear, not even attempting to leave the spawning room. Yet, this is an agent that has previously negotiated this environment with the help of the agent, but has not retained the particularities of this environment because it did not need to. In order to break this dependence, we propose a simple (curriculum) strategy: we mask the presence of the teacher with some probability that increases over time. When this probability reaches 1 and the agent becomes completely independent of the teacher. We start with a masking probability of , then after 250k steps ( of our normal training period for each level) we decrease it to , then and finally . At the end of this process we successfully achieved an agent that can tackle the environment on its own, without the teacher.
5 Conclusion and further work
This paper illustrates a new case of meta learning through reinforcement learning. It demonstrates that observational learning can emerge from reinforcement learning, combined with memory. We argued that observational learning is an important learning mechanism that can be a ’cheaper’ alternative than some of the current approaches to learning from experts. In particular, this approach does not require any explicit modelling of the expert, nor mapping their experience in our agent’s state and action space. We have shown in our experiments, that relying only of the (sparse) reward signal given by the environment coupled with only the sheer presence of another agent, can lead to a variety of behaviours, ranging smoothly between imitation and information seeking. We also demonstrated that, via a curriculum, we could end up with an autonomous agent that solves tasks without the presence of the teacher although it learned through observations of a teacher.
This is an initial work which should be extended further, in other settings. Especially, we want to test scenarios where the goal of the teacher and of the learner are not strictly aligned. We performed a preliminary study where there is a negative correlation (e.g. they are in opposite directions in the room). Results are provided in Appendix. In the same way, we should study how optimal the teacher has to be, how much its motivation should be correlated to the one of the student.
-  Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction. Cambridge Univ Press, 1998.
-  Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529–533, 2015.
-  Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. Nature, 521(7553):436–444, 2015.
-  Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8):1735–1780, 1997.
Junyoung Chung, Caglar Gulcehre, Kyunghyun Cho, and Yoshua Bengio.
Gated feedback recurrent neural networks.In International Conference on Machine Learning (ICML), 2015.
-  Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International Conference on Machine Learning (ICML), 2016.
-  Piotr Mirowski, Razvan Pascanu, Fabio Viola, Hubert Soyer, Andy Ballard, Andrea Banino, Misha Denil, Ross Goroshin, Laurent Sifre, Koray Kavukcuoglu, et al. Learning to navigate in complex environments. In Proceedings of the International Conference on Learning Representations (ICLR), 2017.
-  Sergey Levine, Chelsea Finn, Trevor Darrell, and Pieter Abbeel. End-to-end training of deep visuomotor policies. The Journal of Machine Learning Research, 17(1):1334–1373, 2016.
-  Albert Bandura and Richard H Walters. Social learning theory. Prentice-Hall Englewood Cliffs, NJ, 1977.
-  Albert Bandura and Richard H Walters. Social learning and personality development, volume 14. JSTOR, 1963.
-  Cecilia M Heyes. Imitation, culture and cognition. Animal Behaviour, 46(5):999–1010, 1993.
-  Stefan Schaal. Is imitation learning the route to humanoid robots? Trends in cognitive sciences, 3(6):233–242, 1999.
-  Brenna. Argall, Sonnia Chernova, Manuella Veloso, and Brett Browning. A survey of robot learning from demonstration. Robotics and autonomous systems, 57(5):469–483, 2009.
-  Dean A. Pomerleau. Alvinn: An autonomous land vehicle in a neural network. Technical report, DTIC Document, 1989.
-  Nathan Ratliff, J.Andrew Bagnell, and Siddhartha S. Srinivasa. Imitation learning for locomotion and manipulation. In Proceedings of the IEEE-RAS International Conference on Humanoid Robots, 2007.
-  S. Russell. Learning agents for uncertain environments. In Proceedings of the Conference on Learning Theory (COLT), 1998.
-  Andrew Ng and Stuart Russell. Algorithms for inverse reinforcement learning. In Proceedings of the International Conference on Machine Learning (ICML), 2000.
-  C.G. Atkeson and S. Schaal. Robot learning from demonstration. In Proceedings of the International Conference on Machine Learning (ICML), 1997.
-  Brian D Ziebart, Andrew L Maas, J Andrew Bagnell, and Anind K Dey. Maximum entropy inverse reinforcement learning. In Proceedings of the Annual Meeting or AAAI, 2008.
-  J Zico Kolter, Pieter Abbeel, and Andrew Y Ng. Hierarchical apprenticeship learning with application to quadruped locomotion. In Advances in Neural Information Processing Systems (NIPS), 2008.
-  Stéphane Ross, Geoffrey J. Gordon, and J. Andrew Bagnell. A reduction of imitation learning and structured prediction to no-regret online learning. In Proceedings of the International Conference on AI and Statistics (AISTATS), 2011.
-  Mark K Ho, Michael Littman, James MacGlashan, Fiery Cushman, and Joseph L Austerweil. Showing versus doing: Teaching by demonstration. In Advances in Neural Information Processing Systems (NIPS), 2016.
-  Jonathan Ho and Stefano Ermon. Generative adversarial imitation learning. In Advances in Neural Information Processing Systems (NIPS), 2016.
-  Bilal Piot, Olivier Pietquin, and Matthieu Geist. Predicting when to laugh with structured classification. In Proceedings of INTERSPEECH, 2014.
-  Gergely Neu and Csaba Szepesvári. Training parsers by inverse reinforcement learning. Machine learning, 77(2), 2009.
-  Bradly C Stadie, Pieter Abbeel, and Ilya Sutskever. Third-person imitation learning. In Proceedings of the International Conference on Learning Representations (ICLR), 2017.
-  Peter Abbeel and Andrew Y. Ng. Apprenticeship learning via inverse reinforcement learning. In Proceedings of the International Conference on Machine Learning (ICML), 2004.
-  Bilal Piot, Matthieu Geist, and Olivier Pietquin. Boosted and reward-regularized classification for apprenticeship learning. In Proceedings of the 2014 international conference on Autonomous agents and multi-agent systems (AAMAS), 2014.
Bilal Piot, Matthieu Geist, and Olivier Pietquin.
Learning from demonstrations: is it worth estimating a reward function?In Proceedings of the European Conference on Machine Learning (ECML), 2013.