FeUdal Networks for Hierarchical Reinforcement Learning
FeUdal Networks for Hierarchical Reinforcement Learning
¹DeepMind, London, United Kingdom. Correspondence to: Alexander Sasha Vezhnevets vezhnick@google.com.
Proceedings of the 34th International Conference on Machine Learning, Sydney, Australia, PMLR 70, 2017. Copyright 2017 by the author(s).
Abstract
摘要
We introduce FeUdal Networks (FuNs): a novel architecture for hierarchical reinforcement learning. Our approach is inspired by the feudal reinforcement learning proposal of Dayan and Hinton, and gains power and efficacy by decoupling end-to-end learning across multiple levels – allowing it to utilise different resolutions of time. Our framework employs a Manager module and a Worker module. The Manager operates at a lower temporal resolution and sets abstract goals which are conveyed to and enacted by the Worker. The Worker generates primitive actions at every tick of the environment. The decoupled structure of FuN conveys several benefits – in addition to facilitating very long timescale credit assignment it also encourages the emergence of sub-policies associated with different goals set by the Manager. These properties allow FuN to dramatically outperform a strong baseline agent on tasks that involve long-term credit assignment or memorisation.
我们提出 FeUdal Networks(FuN):一种用于分层强化学习的新架构。该方法受到 Dayan 和 Hinton 提出的封建强化学习的启发,并通过把端到端学习在多个层级上解耦而获得能力与效果,从而能够利用不同的时间分辨率。我们的框架包含一个 Manager 模块和一个 Worker 模块。Manager 以更低的时间分辨率运行,设定抽象目标,再交给 Worker 去执行。Worker 在环境的每一个时间步上产生原始动作。FuN 这种解耦结构带来若干好处:除了便于进行非常长时程的信用分配之外,它也促使与 Manager 所设不同目标相对应的子策略涌现出来。这些性质使 FuN 在涉及长期信用分配或记忆的任务上,能够显著超过一个较强的基线智能体。
1. Introduction
1. 引言
Deep reinforcement learning has recently enjoyed successes in many domains (Mnih et al., 2015; Schulman et al., 2015; Levine et al., 2015; Mnih et al., 2016; Lillicrap et al., 2015). Nevertheless, long-term credit assignment remains a major challenge for these methods, especially in environments with sparse reward signals, such as the infamous Montezuma's Revenge ATARI game. It is symptomatic that the standard approach on the ATARI benchmark suite (Bellemare et al., 2012) is to use an action-repeat heuristic, where each action translates into several (usually 4) consecutive actions in the environment. Yet another dimension of complexity is seen in non-Markovian environments that require memory – these are particularly challenging, since the agent has to learn which parts of experience to store for later, using only a sparse reward signal.
深度强化学习近来已在许多领域取得成功(Mnih et al., 2015; Schulman et al., 2015; Levine et al., 2015; Mnih et al., 2016; Lillicrap et al., 2015)。尽管如此,长期信用分配仍是这些方法的主要挑战,尤其是在奖励信号稀疏的环境中,例如臭名昭著的 ATARI 游戏 Montezuma's Revenge。一个很能说明问题的现象是,ATARI 基准套件(Bellemare et al., 2012)上的标准做法是使用动作重复启发式:每个动作会被转换成环境中连续若干次(通常是 4 次)动作。还有一层复杂性来自需要记忆的非马尔可夫环境——这类环境特别困难,因为智能体必须只凭稀疏的奖励信号,学会把经验中的哪些部分留下来供日后使用。
The framework we propose takes inspiration from feudal reinforcement learning (FRL) introduced by Dayan & Hinton (1993), where levels of hierarchy within an agent communicate via explicit goals. Some key insights from FRL are that goals can be generated in a top-down fashion, and that goal setting can be decoupled from goal achievement; a level in the hierarchy communicates to the level below it what must be achieved, but does not specify how to do so. Making higher levels reason at a lower temporal resolution naturally structures the agents behaviour into temporally extended sub-policies.
我们提出的框架受到 Dayan & Hinton (1993) 引入的封建强化学习(feudal reinforcement learning,FRL)的启发,其中智能体内部各层级通过显式目标来通信。FRL 的若干要点是:目标可以自上而下生成,以及设定目标可以与完成目标解耦;层级中的上一层只向下层通报必须达成什么,并不规定如何去做。让更高层以更低的时间分辨率进行推理,会自然地把智能体的行为组织成在时间上延伸的子策略。
The architecture explored in this work is a fully-differentiable neural network with two levels of hierarchy (though there are obvious generalisations to deeper hierarchies). The top level, the Manager, sets goals at a lower temporal resolution in a latent state-space that is itself learnt by the Manager. The lower level, the Worker, operates at a higher temporal resolution and produces primitive actions, conditioned on the goals it receives from the Manager. The Worker is motivated to follow the goals by an intrinsic reward. However, significantly, no gradients are propagated between Worker and Manager; the Manager receives its learning signal from the environment alone. In other words, the Manager learns to select latent goals that maximise extrinsic reward.
本文探讨的架构是一个完全可微的神经网络,具有两层层级(当然也可以明显地推广到更深的层级)。顶层是 Manager,它在自身所学的潜状态空间里,以更低的时间分辨率设定目标。下层是 Worker,以更高的时间分辨率运行,并在接收到的 Manager 目标条件下产生原始动作。Worker 由内在奖励驱动去追随这些目标。不过,重要的是,梯度并不在 Worker 与 Manager 之间传播;Manager 只从环境接收学习信号。换句话说,Manager 学习选择能够最大化外部奖励的潜在目标。
The key contributions of our proposal are: (1) A consistent, end-to-end differentiable model that embodies and generalizes the principles of FRL. (2) A novel, approximate transition policy gradient update for training the Manager, which exploits the semantic meaning of the goals it produces. (3) The use of goals that are directional rather than absolute in nature. (4) A novel RNN design for the Manager – a dilated LSTM – which extends the longevity of the recurrent state memories and allows gradients to flow through large hops in time, enabling effective back-propagation through hundreds of steps.
我们这一方案的主要贡献是:(1)一个一致的、端到端可微的模型,体现并推广了 FRL 的原则。(2)一种新颖的、近似的转移策略梯度更新,用于训练 Manager,并利用它所产生目标的语义。(3)采用方向性而非绝对性的目标。(4)为 Manager 设计了一种新的 RNN——扩张 LSTM(dilated LSTM)——它延长了循环状态记忆的保持时间,并允许梯度跨过很大的时间跳跃流动,从而能够有效地反向传播数百步。
Our ablative analysis (Section 5.4) confirms that transitional policy gradient and directional goals are crucial for best performance. Our experiments on a selection of ATARI games (including the infamous Montezuma's revenge) and on several memory tasks in the 3D DeepMind Lab environment (Beattie et al., 2016) show that FuN significantly improves long-term credit assignment and memorisation.
我们的消融分析(第 5.4 节)证实,转移策略梯度和方向性目标对取得最佳性能至关重要。我们在一组 ATARI 游戏(包括臭名昭著的 Montezuma's Revenge)以及 3D DeepMind Lab 环境(Beattie et al., 2016)中若干记忆任务上的实验表明,FuN 显著改善了长期信用分配和记忆。
2. Related Work
2. 相关工作
Building hierarchical agents is a long standing topic in reinforcement learning (Sutton et al., 1999; Precup, 2000; Dayan & Hinton, 1993; Dietterich, 2000; Boutilier et al., 1997; Dayan, 1993; Kaelbling, 2014; Parr & Russell, 1998; Precup et al., 1997; 1998; Schmidhuber, 1991; Sutton, 1995; Wiering & Schmidhuber, 1997; Vezhnevets et al., 2016; Bacon et al., 2017). The options framework (Sutton et al., 1999; Precup, 2000) is a popular formulation for considering the problem with a two level hierarchy. The bottom level – an option – is a sub-policy with a termination condition, which takes in environment observations and outputs actions until the termination condition is met. An agent picks an option using its policy-over-options (the top level) and subsequently follows it until termination, at which point the policy-over-options is queried again and the process continues. Options are typically learned using sub-goals and 'pseudo-rewards' that are provided explicitly (Sutton et al., 1999; Dietterich, 2000; Dayan & Hinton, 1993). For a simple, tabular case (Wiering & Schmidhuber, 1997; Schaul et al., 2015), each state can be used as a sub-goal. Given the options, a policy-over-options can be learned using standard techniques by treating options as actions. Recently (Tessler et al., 2016; Kulkarni et al., 2016) have demonstrated that combining deep learning with predefined sub-goals delivers promising results in challenging environments like Minecraft and Atari, however sub-goal discovery was not addressed.
构建分层智能体是强化学习中一个长期存在的课题(Sutton et al., 1999; Precup, 2000; Dayan & Hinton, 1993; Dietterich, 2000; Boutilier et al., 1997; Dayan, 1993; Kaelbling, 2014; Parr & Russell, 1998; Precup et al., 1997; 1998; Schmidhuber, 1991; Sutton, 1995; Wiering & Schmidhuber, 1997; Vezhnevets et al., 2016; Bacon et al., 2017)。选项框架(options framework)(Sutton et al., 1999; Precup, 2000)是用两层层级来考虑这一问题的流行表述。底层——一个选项(option)——是带有终止条件的子策略,它接收环境观察并输出动作,直到终止条件满足。智能体用其选项上的策略(policy-over-options,即顶层)选出一个选项,随后一直执行到终止;此时再次查询选项上的策略,过程继续。选项通常是用显式给出的子目标和“伪奖励”来学习的(Sutton et al., 1999; Dietterich, 2000; Dayan & Hinton, 1993)。在简单的表格情形下(Wiering & Schmidhuber, 1997; Schaul et al., 2015),每个状态都可以作为一个子目标。给定选项之后,可以把选项当作动作,用标准方法学习选项上的策略。最近,(Tessler et al., 2016; Kulkarni et al., 2016)已经表明,把深度学习与预先定义的子目标结合起来,能在 Minecraft 和 Atari 这类有挑战性的环境中取得有希望的结果,不过子目标的发现并未被讨论。
A recent work of (Bacon et al., 2017) shows the possibility of learning options jointly with a policy-over-options in an end-to-end fashion by extending the policy gradient theorem to options. When options are learnt end-to-end, they tend to degenerate to one of two trivial solutions: (i) only one active option that solves the whole task; (ii) a policy-over-options that changes options at every step, micro-managing the behaviour. Consequently, regularisers (Bacon et al., 2017; Vezhnevets et al., 2016) are usually introduced to steer the solution towards multiple options of extended length. This is believed to provide an inductive bias towards re-usable temporal abstractions and to help generalisation.
(Bacon et al., 2017)的近期工作表明,通过把策略梯度定理推广到选项,可以端到端地联合学习选项以及选项上的策略。当选项被端到端学习时,它们往往退化到两种平凡解之一:(i)只有一个活跃选项,独自解决整个任务;(ii)选项上的策略在每一步都更换选项,对行为做微观管理。因此,通常会引入正则项(Bacon et al., 2017; Vezhnevets et al., 2016),把解推向多个持续时间更长的选项。一般认为,这会提供朝向可复用时间抽象的归纳偏置,并有助于泛化。
A key difference between our approach and the options framework is that in our proposal the top level produces a meaningful and explicit goal for the bottom level to achieve. Sub-goals emerge as directions in the latent state-space and are naturally diverse. We also achieve significantly better scores on ATARI than Option-Critic (section 5).
我们的方法与选项框架的一个关键差别在于:在我们的方案里,顶层会为底层产出一个有意义且显式的、需要达成的目标。子目标作为潜状态空间中的方向涌现出来,并且自然地具有多样性。我们在 ATARI 上的得分也显著高于 Option-Critic(第 5 节)。
图 1. FuN 的示意图(第 3 节)
There has also been a significant progress in non-hierarchical deep RL methods by using auxiliary losses and rewards. (Bellemare et al., 2016a) have significantly advanced the state-of-the-art on Montezuma's Revenge by using pseudo-count based auxiliary rewards for exploration, which stimulate agents to explore new parts of the state space. The recently proposed UNREAL agent (Jaderberg et al., 2016) also demonstrates a strong improvement by using unsupervised auxiliary tasks to help refine its internal representations. We note that these benefits are orthogonal to those provided by FuN, and that both approaches could be combined with FuN for even greater effect.
在非分层的深度强化学习方法中,通过使用辅助损失和辅助奖励,也取得了显著进展。(Bellemare et al., 2016a)使用基于伪计数的辅助奖励来做探索,促使智能体探索状态空间中的新区域,从而显著推进了 Montezuma's Revenge 上的当时最好结果。最近提出的 UNREAL 智能体(Jaderberg et al., 2016)也表明,用无监督辅助任务来帮助改进其内部表示,可以带来很强的改进。我们指出,这些好处与 FuN 所提供的好处是正交的,两类方法都可以与 FuN 结合,以取得更大效果。
3. The model
3. 模型
What is FuN? FuN is a modular neural-network consisting of two modules – the Worker and the Manager. The Manager internally computes a latent state representation and outputs a goal vector . The Worker produces actions conditioned on external observation, its own state, and the Managers goal. The Manager and the Worker share a perceptual module which takes an observation from the environment and computes a shared intermediate representation . The Manager's goals are trained using an approximate transition policy gradient. This is a particularly efficient form of policy gradient training that exploits the knowledge that the Worker's behaviour will ultimately align with the goal directions it has been set. The Worker is then trained via intrinsic reward to produce actions that cause these goal directions to be achieved. Figure 1a illustrates the overall design and the following equations describe the forward dynamics of our network:
What is FuN? FuN 是一个模块化神经网络,由两个模块组成——Worker 和 Manager。Manager 在内部计算潜状态表示 ,并输出目标向量 。Worker 在外部观察、自身状态以及 Manager 目标的条件下产生动作。Manager 与 Worker 共享一个感知模块,该模块接收来自环境的观察 ,并计算共享的中间表示 。Manager 的目标 用近似的转移策略梯度来训练。这是一种特别高效的策略梯度训练形式,它利用了如下知识:Worker 的行为最终会与分派给它的目标方向对齐。然后,再用内在奖励训练 Worker,使其产生能够实现这些目标方向的动作。图 1a 展示了整体设计,下列方程描述了我们网络的前向动态:
where both the Manager and the Worker are recurrent. Here and correspond to the internal states of the Manager and the Worker respectively. A linear transform maps a goal into an embedding vector , which is then combined via product with matrix (Workers output) to produce policy – vector of probabilities over primitive actions. The next section provides the details on goal embedding and the following sections 3.2,3.3 describes how FuN is trained.
其中 Manager 与 Worker 都是循环的。这里 和 分别对应 Manager 与 Worker 的内部状态。线性变换 把目标 映射成嵌入向量 ,再与矩阵 (Worker 的输出)做乘积,得到策略 ——在原始动作上的概率向量。下一节给出目标嵌入的细节,随后的第 3.2、3.3 节描述 FuN 如何训练。
3.1. Goal embedding
3.1. 目标嵌入
The goal modulates the policy via a multiplicative interaction in a low dimensional goal-embedding space , . The Worker first produces an embedding vector for every action, represented by rows of matrix (eq. 4). To incorporate goals from the Manager, the last goals are first pooled by summation and then embedded into a vector using a linear projection (eq. 3). The projection is linear, with no biases, and is learnt with gradients coming from the Worker's actions. The embedding matrix is then combined with the goal embedding via a matrix-vector product (eq. 4). Since has no biases it can never produce a constant non-zero vector – which is the only way the setup could ignore the Manager's input. This makes sure that the goal output by the Manager always influences the final policy. Notice how, due to pooling of goals over several time-steps, the conditioning from the Manager varies smoothly.
目标 通过在低维目标嵌入空间 ()中的乘法交互来调节策略。Worker 首先为每个动作产生一个嵌入向量,由矩阵 的各行表示(式 4)。为了纳入来自 Manager 的目标,先把最近 个目标求和汇聚,再用线性投影 嵌入成向量 (式 3)。投影 是线性的,没有偏置,并用 Worker 动作传来的梯度来学习。嵌入矩阵 再通过矩阵-向量乘积与目标嵌入 结合(式 4)。由于 没有偏置,它永远无法产生一个恒定的非零向量——而这是该设置能够忽略 Manager 输入的唯一方式。这就保证了 Manager 输出的目标总会影响最终策略。还请注意,由于目标在若干时间步上做了汇聚,来自 Manager 的条件会平滑地变化。
3.2. Learning
3.2. 学习
We consider a standard reinforcement learning setup. At each step , the agent receives an observation from the environment and selects an action from a finite set of possible actions. The environment responds with a new observation and a scalar reward . The process continues until the terminal state is reached, after which it restarts. The goal of the agent is to maximise the discounted return with . The agent's behaviour is defined by its action-selection policy . FuN produces a distribution over possible actions (a stochastic policy) as defined in eq. 4.
我们考虑标准的强化学习设定。在每一步 ,智能体从环境接收观察 ,并从有限的可能动作集合中选择动作 。环境以新的观察 和标量奖励 作为回应。该过程持续到到达终止状态,然后重新开始。智能体的目标是最大化折扣回报 ,其中 。智能体的行为由其动作选择策略 定义。FuN 按式 4 产生一个在可能动作上的分布(随机策略)。
The conventional wisdom would be to train the whole architecture monolithically through gradient descent on either the policy directly or via TD-learning. Notice, that since FuN is fully differentiable we could train it end-to-end using a policy gradient algorithm operating on the actions taken by the Worker. The outputs of the Manager would be trained by gradients coming from the Worker. This, however would deprive Manager's goals of any semantic meaning, making them just internal latent variables of the model. We propose instead to independently train Manager to predict advantageous directions (transitions) in state space and to intrinsically reward the Worker to follow these directions. If the Worker can fulfil the goal of moving in these directions (as it is rewarded for doing), then we ought to end up taking advantageous trajectories through state-space. We formalise this in the following update rule for the Manager:
按常规思路,会把整个架构当作一个整体,直接对策略做梯度下降,或通过时序差分学习来训练。请注意,由于 FuN 是完全可微的,我们本可以用作用在 Worker 所采取动作上的策略梯度算法,对它做端到端训练。Manager 的输出 将由从 Worker 传来的梯度来训练。不过,这会剥夺 Manager 目标 的任何语义,使它们只成为模型内部的潜变量。我们转而提出:独立训练 Manager,去预测状态空间中有利的方向(转移),并用内在奖励促使 Worker 追随这些方向。如果 Worker 能够完成沿这些方向移动的目标(它也因此获得奖励),我们就应当会沿着状态空间中有利的轨迹前进。我们把这一点形式化为 Manager 的如下更新规则:
where is the Manager's advantage function, computed using a value function estimate from the internal critic; is the cosine similarity between two vectors.
其中 是 Manager 的优势函数,用内部评论家给出的价值函数估计 计算; 是两个向量之间的余弦相似度。
Note: the dependence of on is ignored when computing – this avoids trivial solutions. Notice that now acquires a semantic meaning as an advantageous direction in the latent state space at a horizon , which defines the temporal resolution of the Manager.
注意:在计算 时,忽略 对 的依赖——这是为了避免平凡解。请注意,现在 获得了语义:它表示潜状态空间中、在时间范围 上的有利方向,而 定义了 Manager 的时间分辨率。
The intrinsic reward that encourages the Worker to follow the goals is defined as:
用来鼓励 Worker 追随目标的内在奖励定义为:
We use directions because it is more feasible for the Worker to be able to reliably cause directional shifts in the latent state than it is to assume that the Worker can take us to (potentially) arbitrary new absolute locations. It also gives a degree of invariance to the goals and allows for structural generalisation – the same directional sub-goal can invoke a sub-policy that is valid and useful in a large part of the latent state space; e.g. evade an enemy, swim up for air, etc. We compare absolute against directional goals empirically in section 5.4.
我们使用方向,是因为让 Worker 可靠地在潜状态中造成方向性偏移,比假定 Worker 能够把我们带到(可能任意的)新的绝对位置更为可行。这也给目标带来一定程度的不变性,并允许结构性泛化——同一个方向性子目标 可以在潜状态空间的很大一部分中调用仍然有效且有用的子策略;例如躲避敌人、上浮换气,等等。我们在第 5.4 节对绝对目标与方向性目标做了经验比较。
The original feudal reinforcement learning formulation of Dayan & Hinton (1993) advocated completely concealing the reward from the environment from lower levels of hierarchy. In practice we take a softer approach by adding an intrinsic reward for following the goals, but retaining the environment reward as well. The Worker is then trained to maximise a weighted sum , where is a hyper-parameter that regulates the influence of the intrinsic reward. The Workers policy can be trained to maximise intrinsic reward by using any off-the shelf deep reinforcement learning algorithm. Here we use an advantage actor critic (Mnih et al., 2016):
Dayan & Hinton (1993) 最初的封建强化学习表述主张,完全对下层层级隐瞒来自环境的奖励。实践中我们采取更温和的做法:为追随目标增加内在奖励,但同时保留环境奖励。然后训练 Worker 去最大化加权和 ,其中 是调节内在奖励影响的超参数。Worker 的策略 可以用任何现成的深度强化学习算法来训练,以最大化内在奖励。这里我们使用优势演员-评论家(advantage actor critic)(Mnih et al., 2016):
The advantage function estimator is calculated using an internal critic, which estimates the value functions for both rewards.
优势函数估计器 由内部评论家计算,该评论家估计两种奖励各自的价值函数。
Note that the Worker and Manager can potentially have different discount factors for computing the return. This allows, for instance, the Worker to be more greedy and focus on immediate rewards while the Manager can consider a long-term perspective.
注意,Worker 与 Manager 在计算回报时可以使用不同的折扣因子 。这例如可以让 Worker 更贪心、更关注即时奖励,而 Manager 则可以考虑长期视角。
3.3. Transition Policy Gradients
3.3. 转移策略梯度
We now motivate our proposed update rule for the Manager as a novel form of policy gradient with respect to a model of the Worker's behaviour. Consider a high-level policy that selects among sub-policies (possibly from a continuous set), where we assume for now that these sub-policies are fixed duration behaviours (lasting for steps); corresponding to each sub-policy is a transition distribution, , that describes the distribution of states that we end up at the end of the sub-policy, given the start state and the sub-policy enacted. The high-level policy can be composed with the transition distribution to give a 'transition policy' describing the distribution over end states given start states. It is valid to refer to this as a policy because the original MDP is isomorphic to a new MDP with policy and transition function (i.e. the state always transitions to the end state picked by the transition policy). As a result, we can apply the policy gradient theorem to the transition policy , so as to find the performance gradient with respect to the policy parameters,
我们现在把为 Manager 提出的更新规则,解释成相对于 Worker 行为模型的一种新形式的策略梯度。考虑一个在子策略(可能来自连续集合)中进行选择的高层策略 ,这里暂且假定这些子策略是固定时长的行为(持续 步)。对应于每个子策略,有一个转移分布 ,它描述在给定起始状态和所执行子策略的情况下,子策略结束时所到达状态的分布。高层策略可以与该转移分布复合,得到“转移策略” ,用来描述在给定起始状态下结束状态的分布。把它称作策略是妥当的,因为原来的 MDP 同构于一个以 为策略、以 为转移函数的新 MDP(也就是说,状态总是转移到转移策略所选的结束状态)。因此,我们可以把策略梯度定理应用于转移策略 ,从而求出性能相对于策略参数的梯度,
In general, the Worker may follow a complex trajectory. A naive application of policy gradients requires the agent to learn from samples of these trajectories. But if we know where these trajectories are likely to end up, by modelling the transitions, then we can skip directly over the Worker's behaviour and instead follow the policy gradient of the predicted transition. FuN assumes a particular form for the transition model: that the direction in state-space, , follows a von Mises-Fisher distribution. Specifically, if the mean direction of the von Mises-Fisher distribution is given by (which for compactness we write as ) we would have . If this functional form were indeed correct, then we see that our proposed update heuristic for the Manager, eqn.5, is in fact the proper form for the transition policy gradient arrived at in eqn.8.
一般而言,Worker 可能走出复杂的轨迹。若朴素地应用策略梯度,智能体需要从这些轨迹的样本中学习。但如果我们通过为转移建模,已经知道这些轨迹很可能结束在何处,就可以直接跳过 Worker 的行为,转而跟随预测转移的策略梯度。FuN 为转移模型假定了一种特定形式:状态空间中的方向 服从 von Mises-Fisher 分布。具体地说,若 von Mises-Fisher 分布的平均方向由 给出(为简洁起见我们写成 ),则有 。如果这一函数形式确实正确,那么可以看到,我们为 Manager 提出的更新启发式(式 5)实际上正是式 8 中得到的转移策略梯度的正当形式。
Note that the Worker's intrinsic reward (eqn. 6) is based on the log-likelihood of state trajectory. Through that the FuN architecture actively encourages the functional form of the transition model to hold true. Because the Worker is learning to achieve the Manager's direction, its transitions should, over time, closely follow a distribution around this direction, and hence our approximation for transition policy gradients should hold reasonably well.
注意,Worker 的内在奖励(式 6)是基于状态轨迹的对数似然。由此,FuN 架构会主动促使转移模型的这一函数形式成立。因为 Worker 正在学习实现 Manager 的方向,它的转移随着时间应当会紧密地围绕该方向的分布,因而我们对转移策略梯度的近似应当能够相当好地成立。
4. Architecture details
4. 架构细节
This section provides the particular details of the model as described in section 3. The perceptual module is a convolutional network (CNN) followed by a fully connected layer. The CNN has a first layer with 16 filters of stride 4, followed by a layer with with 32 filters of stride 2. The fully connected layer has 256 hidden units. Each convolutional and fully-connected layer is followed by a rectifier non-linearity¹. The state space which the Manager implicitly models in formulating its goals is computed via , which is another fully connected layer followed by a rectifier non-linearity. The dimensionality of the embedding vectors, , is set as . To encourage exploration in transition policy, at every step with a small probability we emit a random goal sampled from a uni-variate Gaussian.
本节给出第 3 节所述模型的具体细节。感知模块 是一个卷积网络(CNN),后面接一个全连接层。CNN 的第一层有 16 个步长为 4 的 滤波器,随后一层有 32 个步长为 2 的 滤波器。全连接层有 256 个隐单元。每个卷积层和全连接层之后都接一个整流非线性¹。Manager 在构造目标时所隐式建模的状态空间,由 计算,它是另一个全连接层,后面再接整流非线性。嵌入向量 的维数取为 。为了在转移策略中鼓励探索,每一步都以一个小概率 发出一个从一元高斯分布中采样的随机目标。
The Worker's recurrent network is a standard LSTM (Hochreiter & Schmidhuber, 1997). For the Manager's recurrent network, , we propose a novel design – the dilated LSTM, which is introduced in the next section. Both and have 256 hidden units.
Worker 的循环网络 是标准 LSTM(Hochreiter & Schmidhuber, 1997)。对于 Manager 的循环网络 ,我们提出一种新设计——扩张 LSTM,将在下一节介绍。 与 都有 256 个隐单元。
¹This is substantially the same CNN as in (Mnih et al., 2016; 2015), the only difference is that in the pre-processing stage we retain all colour channels.
¹这与(Mnih et al., 2016; 2015)中的 CNN 基本相同,唯一的差别是我们在预处理阶段保留了全部颜色通道。
4.1. Dilated LSTM
4.1. 扩张 LSTM
We propose a novel RNN architecture for the Manager, which operates at lower temporal resolution than the data stream. The main contribution here is the inductive bias towards slowly varying outputs, which have very long-term temporal dependencies. We define a dilated LSTM analogously to dilated convolutional networks (Yu & Koltun, 2016). For a dilation radius let the full state of the network be , i.e. it is composed of separate groups of sub-states or 'cores'. At time the network is governed by the following equations: , where denotes the modulo operation and allows us to indicate which group of cores is currently being updated. We make the parameters of the LSTM network explicit to stress that the same set of parameters governs the update for each of the groups within the dLSTM.
我们为 Manager 提出一种新的 RNN 架构,它以低于数据流的时间分辨率运行。这里的主要贡献是对缓慢变化、且具有非常长期时间依赖的输出给出归纳偏置。我们类比于扩张卷积网络(Yu & Koltun, 2016)来定义扩张 LSTM。对于扩张半径 ,令网络的完整状态为 ,也就是说,它由 组分离的子状态或“核心”组成。在时刻 ,网络由下列方程支配:,其中 表示取模运算,用来标明当前正在更新哪一组核心。我们把 LSTM 网络的参数 显式写出来,是为了强调:同一组参数支配着 dLSTM 内部全部 组的更新。
At each time step only the corresponding part of the state is updated and the output is pooled across the previous outputs. This allows the groups of cores inside the dLSTM to preserve the memories for long periods, yet the dLSTM as a whole is still able to process and learn from every input experience, and is also able to update its output at every step. This idea is similar to clockwork RNNs (Koutník et al., 2014), however there the top level “ticks” at a fixed, slow pace, whereas the dLSTM observes all the available training data instead. In the experiments we set , and this was also used as the predictions horizon, .
在每个时间步,只有状态中相应的那一部分被更新,输出则在此前 个输出上汇聚。这使得 dLSTM 内部的 组核心能够长时间保存记忆,而 dLSTM 作为整体仍然能够处理并从每一次输入经验中学习,也能够在每一步更新其输出。这一想法类似于 clockwork RNN(Koutník et al., 2014),不过在那里顶层以固定的慢节拍“滴答”前进,而 dLSTM 则会观察到全部可用的训练数据。实验中我们取 ,并且把同样的值用作预测范围 。
5. Experiments
5. 实验
The goal of our experiments is to demonstrate that FuN learns non-trivial, helpful, and interpretable sub-policies and sub-goals, and also to validate components of the architecture. We start by describing technical details of the experimental setup and then present results on Montezuma's revenge – an infamously hard ATARI game – in section 5.1. Section 5.2 presents results on more ATARI games and extensively compares FuN to LSTM baseline with different discount factors and BPTT lengths. In section 5.3 we present results on a set of visual memorisation tasks in 3D environment. Section 5.4 presents an ablation study of FuN, validating our design choices.
我们实验的目标是表明,FuN 能够学到非平凡、有帮助且可解释的子策略和子目标,并验证架构中的各个组成部分。我们先说明实验设置的技术细节,然后在第 5.1 节给出 Montezuma's Revenge——一款出名难的 ATARI 游戏——上的结果。第 5.2 节给出更多 ATARI 游戏上的结果,并在不同折扣因子和 BPTT 长度下,把 FuN 与 LSTM 基线做了广泛比较。第 5.3 节给出一组三维环境中视觉记忆任务上的结果。第 5.4 节给出 FuN 的消融研究,用以验证我们的设计选择。
Baseline. Our main baseline is a recurrent LSTM network on top of a representation learned by a CNN. The LSTM (Hochreiter & Schmidhuber, 1997) architecture is a widely used recurrent network and it was demonstrated to perform very well on a suite of reinforcement learning problems (Mnih et al., 2016). LSTM uses 316 hidden units² and its inputs are the feature representation of an observation and the previous action of the agent. Action probabilities and the value function estimate are regressed from its hidden state. All the methods the same CNN architecture, input pre-processing, and an action repeat of 4.
Baseline. 我们的主要基线是在 CNN 所学表示之上的循环 LSTM 网络。LSTM(Hochreiter & Schmidhuber, 1997)架构是一种广泛使用的循环网络,并已被证明在一系列强化学习问题上表现很好(Mnih et al., 2016)。LSTM 使用 316 个隐单元²,其输入是观察的特征表示以及智能体的上一个动作。动作概率和价值函数估计从其隐状态回归得到。所有方法都使用相同的 CNN 架构、输入预处理,以及 4 的动作重复。
²This choice means that FuN and the LSTM baseline to have roughly the same number of total parameters.
²这一选择意味着 FuN 与 LSTM 基线大致具有相同的总参数量。
Optimisation. We use the A3C method (Mnih et al., 2016) for all reinforcement learning experiments. It was shown to achieve state-of-the-art results on several challenging benchmarks (Mnih et al., 2016). We cut the trajectory and run backpropagation through time (BPTT) (Mozer, 1989) after forward passes of a network or if a terminal signal is received. For FuN , for LSTM, unless otherwise stated, . We discuss different choice of for LSTM in section 5.2. The optimization process runs 32 asynchronous threads using shared RMSProp. There are 3 hyper-parameters in FuN and 2 in the LSTM baselines. For each method, we ran 100 experiments, each using randomly sampled hyper-parameters. Learning rate and entropy penalty were sampled from a interval for LSTM. For FuN the learning rate was sampled from , to account for higher gradients due to longer BPTT unrolls. The learning rate was linearly annealed from a sampled value to half the initial rate for all agents. To explore intrinsic motivation in FuN, we sample its weight . We define a training epoch as one million observations. When reporting learning curves, we plot the average episode score of the top 5 agents (according to the final score) against the training epochs. For all ATARI experiments we clip the reward to interval
Optimisation. 全部强化学习实验都使用 A3C 方法(Mnih et al., 2016)。它已被表明能在若干有挑战性的基准上取得当时最好的结果(Mnih et al., 2016)。我们在网络前向传播 步之后,或在收到终止信号时,切断轨迹并运行通过时间的反向传播(BPTT)(Mozer, 1989)。对 FuN,;对 LSTM,除非另有说明,。我们在第 5.2 节讨论 LSTM 的不同 选择。优化过程使用共享的 RMSProp,在 32 个异步线程上运行。FuN 有 3 个超参数,LSTM 基线有 2 个。对每种方法,我们运行了 100 次实验,每次使用随机采样的超参数。对 LSTM,学习率和熵惩罚从 区间采样。对 FuN,学习率从 采样,以照顾因更长的 BPTT 展开而产生的更大梯度。对所有智能体,学习率都从采样值线性退火到初始值的一半。为了探索 FuN 中的内在动机,我们对其权重采样 。我们把一个训练 epoch 定义为一百万次观察。报告学习曲线时,我们按最终得分选出最好的 5 个智能体,绘制其平均每局得分随训练 epoch 的变化。对所有 ATARI 实验,我们把奖励裁剪到 区间。
5.1. Montezuma's revenge
5.1. Montezuma's Revenge
Montezuma's revenge is one of the hardest games available through the ALE (Bellemare et al., 2012). The game is infamous for challenging agents with lethal traps and sparse rewards. We had to broaden and intensify our hyper-parameter search for the LSTM baseline to see any progress at all for that model. We have experimented with many different hyper-parameter configurations for LSTM baseline, for instance expanding learning rate search to , and we report on the configuration that worked best. We use a small discount 0.99 for LSTM; for FuN we use 0.99 in Worker and 0.999 in Manager. Figure 2b analyses the sub-goals learnt by FuN in the first room. They turn out to be meaningful milestones, which bridge the agents progress to its first extrinsic reward – picking up the key. Interestingly, two of the learnt sub-goals correspond to roughly the same locations as the ones hand-crafted in (Kulkarni et al., 2016) (ladder and key), but here they are learnt by the agent itself. Figure 2a plots the learning curves. Notice how FuN starts learning much earlier and achieves much higher scores. It takes epochs for LSTM to reach the score 400, which corresponds to solving the first room (take the key, open a door); it stagnates at that score until about 900 epochs, when it starts exploring further. FuN solves the first room in less than 200 epochs and immediately moves on to explore further, eventually visiting several other rooms and scoring up to 2600 points.
Montezuma's Revenge 是 ALE(Bellemare et al., 2012)中最难的游戏之一。该游戏以用致命陷阱和稀疏奖励来为难智能体而闻名。为了让 LSTM 基线显现出任何进展,我们不得不拓宽并加强对该模型的超参数搜索。我们尝试过 LSTM 基线的许多不同超参数配置,例如把学习率搜索扩大到 ,并报告效果最好的配置。对 LSTM 我们使用较小的折扣 0.99;对 FuN,Worker 使用 0.99,Manager 使用 0.999。图 2b 分析了 FuN 在第一间房间里学到的子目标。它们原来是有意义的里程碑,把智能体的进展桥接到它的第一个外部奖励——拿起钥匙。有意思的是,学到的子目标中有两个与(Kulkarni et al., 2016)中手工设计的位置大致相同(梯子和钥匙),但这里是智能体自己学出来的。图 2a 画出了学习曲线。可以看到 FuN 开始学习得早得多,达到的分数也高得多。LSTM 需要 个 epoch 才能达到 400 分,这对应于解决第一间房间(拿到钥匙、打开一扇门);它在该分数上停滞到大约 900 个 epoch,才开始进一步探索。FuN 在不到 200 个 epoch 内解决第一间房间,并立即继续探索,最终走访了若干其他房间,得分可高达 2600 分。
Figure 2. a) Learning curve on Montezuma's Revenge b) This is a visualisation of sub-goals learnt by FuN in the first room. For each time step we compute the latent state and the corresponding goal . We then find a future state for which is maximized. The plot corresponds to the number of past states for which a frame maximizes the goal – i.e. the taller the bar, the more frequently that state was a maximizer of the goal for some previous state. Notice that FuN has learnt a semantically meaningful sub-goals – the tall bars in the plot (i.e. consistent goals) correspond to interpretably useful waypoints in Montezuma.
图 2. a) 在 Montezuma's Revenge 上的学习曲线 b) 这是 FuN 在第一间房间里学到的子目标的可视化。对每个时间步,我们计算潜状态 和相应的目标 。然后我们寻找一个未来状态,使 最大化。该图对应的是:对多少个过去状态而言,某一帧最大化了该目标——也就是说,柱子越高,该状态越经常成为某个先前状态的目标最大化者。请注意,FuN 已经学到了在语义上有意义的子目标——图中较高的柱子(也就是一致的目标)对应于 Montezuma 中可解释的有用路标。
5.2. ATARI
Experiments in this section validate that the capabilities of FuN go beyond what standard tools for long-term credit assignment – discount factors and BPTT unroll length – can provide for a baseline LSTM agent. We use two discounts 0.99 and 0.95 for both FuN and LSTM agents. (For the experiments on FuN only the discount for the Manager changes, while the Worker's discount is fixed at 0.95.) For the LSTM we explore BPTT of 40 and 100, while for FuN we use a BPTT unroll of 400. For LSTM with BPTT 100 we search for learning rate in the interval , as for FuN. We use a diverse set of ATARI games, some of which involve long-term credit assignment and some which are more reactive.
本节实验要验证的是:FuN 的能力超出了标准的长期信用分配工具——折扣因子和 BPTT 展开长度——能为基线 LSTM 智能体提供的范围。对 FuN 和 LSTM 智能体,我们都使用 0.99 和 0.95 两种折扣。(在 FuN 的实验中,只改变 Manager 的折扣,Worker 的折扣固定为 0.95。)对 LSTM,我们探索 BPTT 为 40 和 100;对 FuN,我们使用长度为 400 的 BPTT 展开。对 BPTT 为 100 的 LSTM,学习率的搜索区间是 ,与 FuN 相同。我们使用一组多样的 ATARI 游戏,其中一些涉及长期信用分配,另一些则更偏反应式。
图 3. ATARI 训练曲线。一个 epoch 对应智能体的一百万步训练。数值是按最终得分选出的最好 5 个智能体的平均每局得分。我们使用了 0.95 和 0.99 两种折扣因子。
Figure 3 plots the learning curves. A few categories emerge. On Ms. Pacman, Amidar, and Gravitar FuN with a low Manager discount of 0.99 strongly outperforms all other methods. All of these games are known to require long-term reasoning to play well. Enduro stands out as all the LSTM agents completely fail at it. In this game the agent controls a racing car and scores points for overtaking other racers; this requires accelerating and steering for significant amount of time before the first reward is experienced. Frostbite is a hard game (Vezhnevets et al., 2016; Lake et al., 2016) that requires both long-term credit assignment and good exploration. The best-performing frostbite agent is FuN with 0.95 Manager discount, which outperforms the rest by a factor of 7. On Hero and Space Invaders all agents perform equally well. On Seaquest and Breakout, the baseline LSTM with a more aggressive discount of 0.95 is the best. This suggests that in these games long-term credit assignment is not important and the agent is better off optimising more immediate rewards in a greedy fashion. Alien is the only game where using different discounts doesn't meaningfully influence the agents performance; here we see the baseline LSTM outperforms our FuN model, although both still achieve a satisfactory scores. We provide qualitative analysis of sub-policies learnt on Seaquest in supplementary material.
图 3 画出了学习曲线。可以从中看出几类情况。在 Ms. Pacman、Amidar 和 Gravitar 上,Manager 折扣较低、取 0.99 的 FuN 明显超过所有其他方法。这些游戏都以需要长期推理才能打好而著称。Enduro 很突出:所有 LSTM 智能体在其上完全失败。在这个游戏里,智能体控制一辆赛车,靠超车得分;这需要在体验到第一个奖励之前,先加速和转向相当长一段时间。Frostbite 是一款很难的游戏(Vezhnevets et al., 2016; Lake et al., 2016),既需要长期信用分配,也需要良好的探索。表现最好的 Frostbite 智能体是 Manager 折扣为 0.95 的 FuN,它比其余方法高出 7 倍。在 Hero 和 Space Invaders 上,所有智能体表现相当。在 Seaquest 和 Breakout 上,折扣更激进、取 0.95 的基线 LSTM 最好。这表明,在这些游戏里长期信用分配并不重要,智能体更适合用贪心的方式去优化更即时的奖励。Alien 是唯一一款使用不同折扣并不会实质影响智能体表现的游戏;在这里可以看到基线 LSTM 超过了我们的 FuN 模型,不过两者都仍取得了令人满意的分数。我们在补充材料中提供了 Seaquest 上学到的子策略的定性分析。
Note how using an unroll for BPTT=100 in the baseline LSTM significantly hurts its performance (hence we do not explore longer unrolls), while FuN performs very well with BPTT of 400 thanks to its ability to leverage the dLSTM. Being able to train a recurrent network over very long sequences could be an enabling tool for many memory related task, as we demonstrate in section 5.3.
还请注意,在基线 LSTM 上使用 BPTT=100 的展开会显著损害其性能(因此我们不再探索更长的展开),而 FuN 凭借利用 dLSTM 的能力,在 BPTT 为 400 时仍然表现很好。能够在非常长的序列上训练循环网络,可能成为许多与记忆有关的任务的使能工具,正如我们在第 5.3 节所展示的。
Option-critic architecture (Bacon et al., 2017) is, to the best of our knowledge, the only other end-to-end trainable system with sub-policies. The experimental results for Option-Critic on 4 ATARI (Bacon et al., 2017) games show scores similar those from a flat DQN (Mnih et al., 2015) baseline agent. Notice that our baseline (Mnih et al., 2016) is much stronger than DQN. We also ran FuN on the same games as Option-Critic (Asterix, Ms. Pacman, Seaquest and Zaxxon) and after 200 epochs it achieves a similar score on Seaquest, doubles it on Ms. Pacman, more than triples it on Zaxxon and gets more than 20x improvement on Asterix (see supplementary material for plots).
据我们所知,Option-Critic 架构(Bacon et al., 2017)是唯一另一种带有子策略、且可端到端训练的系统。Option-Critic 在 4 款 ATARI 游戏(Bacon et al., 2017)上的实验结果显示,其得分与扁平 DQN(Mnih et al., 2015)基线智能体相近。请注意,我们的基线(Mnih et al., 2016)比 DQN 强得多。我们也在与 Option-Critic 相同的游戏(Asterix、Ms. Pacman、Seaquest 和 Zaxxon)上运行了 FuN:在 200 个 epoch 之后,它在 Seaquest 上达到相近的分数,在 Ms. Pacman 上把分数提高了一倍,在 Zaxxon 上提高了三倍以上,在 Asterix 上获得了超过 20 倍的改进(曲线见补充材料)。
5.3. Memory in Labyrinth
5.3. Labyrinth 中的记忆
DeepMind Lab (Beattie et al., 2016) is a first-person 3D game platform extended from OpenArena. It's a visually complex 3D environment with agent actions corresponding to movement and orientation. We use 4 different levels that test long-term credit assignment and visual memory:
DeepMind Lab(Beattie et al., 2016)是一个从 OpenArena 扩展而来的第一人称三维游戏平台。它是一个视觉上复杂的三维环境,智能体的动作对应于移动和朝向。我们使用 4 个不同的关卡来测试长期信用分配和视觉记忆:
Water maze is a reproduction of the Morris water maze experiment (Morris, 1981) from the behavioural science literature. An agent is dropped into a circular pool of water with a concealed platform at unknown random location. The agent can move around and upon stepping on the platform it receives a reward and the trial restarts. The platform remains in the same location for the rest of the episode, while agent starts each trial at a random location. The walls of the pool are decorated with visual cues to assist localisation.
Water maze 是行为科学文献中 Morris 水迷宫实验(Morris, 1981)的复现。智能体被放入一个圆形水池,水池中有一个位置未知、随机放置的隐藏平台。智能体可以四处移动,一旦踏上平台就会得到奖励,该次试次重新开始。在该回合剩下的时间里,平台位置保持不变,而智能体每次试次都从随机位置出发。水池的池壁装饰有视觉线索,以帮助定位。
Figure 4. FuN in water maze, top down view. The left plot visualises FuN trajectories during one episode. The first trajectory (green) performs a search for the target in different locations, while subsequent ones (other colours) perform searches along a circle of a fixed radius matched to that of the target, always finding the target. The right plot visualises different learnt sub-policies, produced by sampling a random and fixing it for 200 steps. Each colour corresponds to a different , the black circle represents the starting location.
图 4. 水迷宫中的 FuN,俯视图。左图可视化了 FuN 在一个回合中的轨迹。第一条轨迹(绿色)在不同位置搜索目标,随后的轨迹(其他颜色)则沿着与目标半径相匹配的固定半径圆进行搜索,并且总能找到目标。右图可视化了不同的已学子策略,其做法是采样一个随机的 并固定 200 步。每种颜色对应一个不同的 ,黑色圆圈表示起始位置。
T-maze is another classic animal cognition test. The agent spawns in a small T-shaped maze. Two objects with randomly chosen shape and colour are spawned at the left and right “baiting” locations. One of them is assigned a reward of +1 and the other a reward of -1. When the agent collects one of the objects, it receives the reward and is re-spawned at the beginning of the T-maze. The objects are also re-instantiated in the same locations and with the same rewards on the re-spawn event. The agent should remember which object gives the positive reward across re-spawns and collect it as many times as possible within the fixed time given for the episode. T-maze+ is a modification of T-maze, where at each trial the length of corridors can vary, adding additional dimension of complexity.
T-maze 是另一项经典的动物认知测验。智能体出生在一个小型的 T 形迷宫里。两个形状和颜色随机选定的物体,出现在左右两个“投饵”位置。其中一个被赋予 +1 的奖励,另一个被赋予 -1 的奖励。当智能体收集到其中一个物体时,它获得该奖励,并在 T 迷宫的起点重新出生。物体也会在重新出生事件中,在相同位置、以相同奖励被重新实例化。智能体应当在多次重新出生之间记住哪个物体给出正奖励,并在该回合给定的固定时间内尽可能多次收集它。T-maze+ 是 T-maze 的一个改动:在每次试次中走廊长度可以变化,从而增加了额外的复杂度维度。
Non-match is a visual memorisation task. Each trial begins in small room with an out of reach object being displayed in one of two display pods. There is a pad in the middle, which upon touching, the agent is rewarded with 1 point, and is teleported to a second room which has two objects in it, one of which matches the object in the previous room. Collecting the matching object gives a reward of -10 points, collecting the non matching object gives a reward of 10 points. Once either is collected, the agent is teleported back to the first room, with the same object being shown.
Non-match 是一项视觉记忆任务。每次试次开始于一个小房间,其中有一个够不着的物体显示在两个展示台之一上。中间有一块垫子,智能体一触碰它就会得到 1 分奖励,并被传送到第二个房间;该房间里有两个物体,其中一个与前一房间中的物体匹配。收集匹配的物体得到 -10 分奖励,收集不匹配的物体得到 10 分奖励。一旦收集到其中任一物体,智能体就被传送回第一个房间,并再次展示同一个物体。
图 5. Labyrinth 上记忆任务的训练曲线。
For all agents we include reward as a part of the observation. Figure 5 plots the learning curves. FuN consitently outperforms the LSTM baseline – it learns faster and also reaches a higher final reward. We analyse the FuN agent's behaviour in more detail in Figure 4b. It demonstrates that FuN learns meaningful sub-policies, which are then efficiently integrated with memory to produce rewarding behaviour. Interestingly, the LSTM agent doesn't appear to use its memory for water maze task at all, always circling the maze at the roughly the same radius.
对所有智能体,我们把奖励作为观察的一部分。图 5 画出了学习曲线。FuN 始终优于 LSTM 基线——它学得更快,达到的最终奖励也更高。我们在图 4b 中更细致地分析了 FuN 智能体的行为。它表明 FuN 学到了有意义的子策略,这些子策略随后与记忆有效结合,产生带来奖励的行为。有意思的是,LSTM 智能体在水迷宫任务上似乎完全没有使用记忆,总是以大致相同的半径绕着迷宫转圈。
5.4. Ablative analysis
5.4. 消融分析
This section empirically validates the main innovations of this paper: transition policy gradient for training the Manager; relative rather than absolute goals; intrinsic motivation for the Worker. First we consider a 'non-Feudal' FuN – it has exactly the same network architecture as FuN, but the Managers output is trained with gradients coming directly from the Worker and no intrinsic reward is used, much like in Option-Critic architecture (Bacon et al., 2017). Second, is learnt using a standard policy gradient approach with the Manager emitting the mean of a Gaussian distribution from which goals are sampled (as if the Manager were solving a continuous control problem (Schulman et al., 2016; Mnih et al., 2016; Lillicrap et al., 2015)). Third, we explore a variant of FuN in which specifies absolute, rather than relative/directional, goals (and the Worker's intrinsic reward is adjusted accordingly) but otherwise everything is the same. The experiments (Figure 6) reveal that, although alternatives do work to some degree their performance is significantly inferior. We also evaluate a purely feudal version of FuN – in which the Worker is trained from the intrinsic reward alone. This ablation performs better than other, but still inferior to the full FuN approach. It shows that allowing the Worker to experience the external reward is beneficial.
本节从经验上验证本文的主要创新:用转移策略梯度训练 Manager;使用相对目标而不是绝对目标;以及给予 Worker 内在动机。首先我们考虑一种“非封建”的 FuN——它与 FuN 具有完全相同的网络架构,但 Manager 的输出 用直接来自 Worker 的梯度来训练,并且不使用内在奖励,这很像 Option-Critic 架构(Bacon et al., 2017)。其次, 用标准的策略梯度方法来学习,由 Manager 输出一个高斯分布的均值,再从中采样目标(就好像 Manager 在求解一个连续控制问题(Schulman et al., 2016; Mnih et al., 2016; Lillicrap et al., 2015))。第三,我们探索 FuN 的一个变体:其中 指定的是绝对目标,而不是相对/方向性目标(并相应调整 Worker 的内在奖励),其余则完全相同。实验(图 6)表明,尽管这些替代方案在某种程度上也能工作,但其性能显著更差。我们还评估了 FuN 的一个纯封建版本——其中 Worker 只从内在奖励训练。这一消融比其他方案更好,但仍然不如完整的 FuN 方法。这表明,让 Worker 体验到外部奖励是有益的。
图 6. 消融分析
5.5. ATARI action repeat transfer
5.5. ATARI 动作重复迁移
One of the advantages of FuN is the clear separation of duties between Manager and Worker. The Manager learns a transition policy, while the Worker learns to operate primitive actions to enact these transitions. This transition policy is invariant to the underlying embodiment of the agent – the way its primitive actions translate into state space transitions. Potentially, the transition policy can be transferred between agents with different embodiment – e.g. robot models with different bodies or different operational frequency. We provide evidence towards that possibility by transferring policies across agents with different action repeat on ATARI. Action repeat is a heuristic used in all successful agents (Mnih et al., 2015; 2016; Bellemare et al., 2016b; Vezhnevets et al., 2016). It enables better exploration, eases credit assignment, and saves computation by repeating an action chosen by the agent several () times.
FuN 的一个优点是 Manager 与 Worker 之间职责分明。Manager 学习转移策略,而 Worker 学习操作原始动作来实现这些转移。这一转移策略对智能体的底层身体——也就是其原始动作如何转换成状态空间转移——是不变的。潜在地,转移策略可以在具有不同身体的智能体之间迁移,例如身体不同或运行频率不同的机器人模型。我们通过在 ATARI 上、在具有不同动作重复的智能体之间迁移策略,为这种可能性提供了证据。动作重复是所有成功智能体都使用的启发式(Mnih et al., 2015; 2016; Bellemare et al., 2016b; Vezhnevets et al., 2016)。它通过把智能体选定的动作重复若干()次,从而带来更好的探索、减轻信用分配,并节省计算。
图 7. 动作重复迁移
To perform transfer, we initialise the FuN system with parameters extracted from an agent trained with action repeat of 4 and then make the following adjustments: (i) we accordingly adjust the discounts for all rewards; (ii) we increase the dilation of the dLSTM by a factor of 4; (iii) we increase the Manager's goal horizon by a factor of 4. (These modifications adapt all the “hard-wired” but explicitly temporally sensitive aspects of the agent.) We then train this agent without action repeat. As a baseline we use an LSTM agent transferred in a similar way (with adjusted discounts) as well as FuN and LSTM agents trained without action repeat from scratch. Figure 7 shows the corresponding learning curves. The transferred FuN agent (green curve) significantly outperforms every other method. Furthermore it shows positive transfer on each environment, whereas LSTM only shows positive transfer on Ms. Pacman.
为了进行迁移,我们用一个在动作重复为 4 的设定下训练的智能体中提取的参数来初始化 FuN 系统,然后做如下调整:(i)相应地调整所有奖励的折扣;(ii)把 dLSTM 的扩张增大 4 倍;(iii)把 Manager 的目标范围 增大 4 倍。(这些修改适配了智能体所有“硬接线”但明确具有时间敏感性的方面。)然后我们在没有动作重复的情况下训练该智能体。作为基线,我们使用以类似方式迁移的 LSTM 智能体(调整了折扣),以及从零开始、在没有动作重复的情况下训练的 FuN 和 LSTM 智能体。图 7 给出了相应的学习曲线。迁移后的 FuN 智能体(绿色曲线)显著超过其他每一种方法。此外,它在每个环境上都表现出正迁移,而 LSTM 只在 Ms. Pacman 上表现出正迁移。
6. Discussion and future work
6. 讨论与未来工作
How to create agents that can learn to decompose their behaviour into meaningful primitives and then reuse them to more efficiently acquire new behaviours is a long standing research question. The solution to this question may be an important stepping stone towards agents with general intelligence and competence. This paper introduced FeUdal Networks, a novel architecture that formulates sub-goals as directions in latent state space, which, if followed, translate into a meaningful behavioural primitives. FuN clearly separates the module that discovers and sets sub-goals from the module that generates the behaviour through primitive actions. This creates a natural hierarchy that is stable and allows both modules to learn in complementary ways. Our experiments clearly demonstrate that this makes long-term credit assignment and memorisation more tractable. This also opens many avenues for further research, for instance: deeper hierarchies can be constructed by setting goals at multiple time scales, scaling agents to truly large environments with sparse rewards and partial observability. The modular structure of FuN is also lends itself to transfer and multitask learning – learnt behavioural primitives can be re-used to acquire new complex skills, or alternatively the transitional policies of the Manager can be transferred to agents with different embodiment.
如何创造出能够学会把自身行为分解成有意义的原语、再复用这些原语以更高效地获得新行为的智能体,是一个长期存在的研究问题。对这一问题的解答,可能是通向具有普遍智能与能力的智能体的一块重要垫脚石。本文提出了 FeUdal Networks,这是一种把子目标表述为潜状态空间中的方向的新架构;如果追随这些方向,它们就会转化成有意义的行为原语。FuN 把发现并设定子目标的模块,与通过原始动作生成行为的模块清楚地分开。这形成了一种自然的层级,它是稳定的,并允许两个模块以互补的方式学习。我们的实验清楚地表明,这使得长期信用分配和记忆变得更容易处理。这也为进一步研究打开了许多途径,例如:可以通过在多个时间尺度上设定目标来构造更深的层级,从而把智能体扩展到具有稀疏奖励和部分可观测性的真正大规模环境。FuN 的模块化结构也适合于迁移和多任务学习——已学到的行为原语可以被复用来获得新的复杂技能,或者,也可以把 Manager 的转移策略迁移到具有不同身体的智能体上。
Acknowledgements
致谢
We thank Daan Wierstra, Olivier Pietquin, Tejas Kulkarni, Alex Graves, Oriol Vinyals, Joseph Modayil and Vlad Mnih for many helpful discussions, suggestions and comments on the paper.
我们感谢 Daan Wierstra、Olivier Pietquin、Tejas Kulkarni、Alex Graves、Oriol Vinyals、Joseph Modayil 和 Vlad Mnih 对本文提出的许多有益讨论、建议和意见。
References
参考文献
Bacon, Pierre-Luc, Precup, Doina, and Harb, Jean. The option-critic architecture. In AAAI, 2017.
Beattie, Charles, Leibo, Joel Z., Teplyashin, Denis, Ward, Tom, Wainwright, Marcus, Küttler, Heinrich, Lefrancq, Andrew, Green, Simon, Valdés, Víctor, Sadik, Amir, Schrittwieser, Julian, Anderson, Keith, York, Sarah, Cant, Max, Cain, Adam, Bolton, Adrian, Gaffney, Stephen, King, Helen, Hassabis, Demis, Legg, Shane, and Petersen, Stig. Deepmind lab. arXiv preprint arXiv:1612.03801, 2016.
Bellemare, Marc, Srinivasan, Sriram, Ostrovski, Georg, Schaul, Tom, Saxton, David, and Munos, Remi. Unifying count-based exploration and intrinsic motivation. In NIPS, 2016a.
Bellemare, Marc G, Naddaf, Yavar, Veness, Joel, and Bowling, Michael. The arcade learning environment: An evaluation platform for general agents. Journal of Artificial Intelligence Research, 2012.
Bellemare, Marc G., Ostrovski, Georg, Guez, Arthur, Thomas, Philip S., and Munos, Rémi. Increasing the action gap: New operators for reinforcement learning. In Proceedings of the AAAI Conference on Artificial Intelligence, 2016b.
Boutilier, Craig, Brafman, Ronen I, and Geib, Christopher. Prioritized goal decomposition of markov decision processes: Toward a synthesis of classical and decision theoretic planning. In IJCAI, 1997.
Dayan, Peter. Improving generalization for temporal difference learning: The successor representation. Neural Computation, 1993.
Dayan, Peter and Hinton, Geoffrey E. Feudal reinforcement learning. In NIPS. Morgan Kaufmann Publishers, 1993.
Dietterich, Thomas G. Hierarchical reinforcement learning with the maxq value function decomposition. J. Artif. Intell. Res.(JAIR), 2000.
Hochreiter, Sepp and Schmidhuber, Jürgen. Long short-term memory. Neural computation, 1997.
Jaderberg, Max, Mnih, Volodymyr, Czarnecki, Wojciech Marian, Schaul, Tom, Leibo, Joel Z, Silver, David, and Kavukcuoglu, Koray. Reinforcement learning with unsupervised auxiliary tasks. arXiv preprint arXiv:1611.05397, 2016.
Kaelbling, Leslie Pack. Hierarchical learning in stochastic domains: Preliminary results. In ICML, 2014.
Koutník, Jan, Greff, Klaus, Gomez, Faustino, and Schmidhuber, Jürgen. A clockwork rnn. In ICML, 2014.
Kulkarni, Tejas D., Narasimhan, Karthik R., Saeedi, Ardavan, and Tenenbaum, Joshua B. Hierarchical deep reinforcement learning: Integrating temporal abstraction and intrinsic motivation. arXiv preprint arXiv:1604.06057, 2016.
Lake, Brenden M, Ullman, Tomer D, Tenenbaum, Joshua B, and Gershman, Samuel J. Building machines that learn and think like people. arXiv preprint arXiv:1604.00289, 2016.
Levine, Sergey, Finn, Chelsea, Darrell, Trevor, and Abbeel, Pieter. End-to-end training of deep visuomotor policies. arXiv preprint arXiv:1504.00702, 2015.
Lillicrap, Timothy P, Hunt, Jonathan J, Pritzel, Alexander, Heess, Nicolas, Erez, Tom, Tassa, Yuval, Silver, David, and Wierstra, Daan. Continuous control with deep reinforcement learning. arXiv preprint arXiv:1509.02971, 2015.
Mnih, Volodymyr, Kavukcuoglu, Koray, Silver, David, Rusu, Andrei A., Veness, Joel, Bellemare, Marc G., Graves, Alex, Riedmiller, Martin, Fidjeland, Andreas K., Ostrovski, Georg, Petersen, Stig, Beattie, Charles, Sadik, Amir, Antonoglou, Ioannis, King, Helen, Kumaran, Dharshan, Wierstra, Daan, Legg, Shane, and Hassabis, Demis. Human-level control through deep reinforcement learning. Nature, 518(7540):529–533, 02 2015.
Mnih, Volodymyr, Badia, Adria Puigdomenech, Mirza, Mehdi, Graves, Alex, Lillicrap, Timothy P, Harley, Tim, Silver, David, and Kavukcuoglu, Koray. Asynchronous methods for deep reinforcement learning. ICML, 2016.
Morris, Richard GM. Spatial localization does not require the presence of local cues. Learning and motivation, 12 (2):239–260, 1981.
Mozer, Michael C. A focused back-propagation algorithm for temporal pattern recognition. Complex systems, 1989.
Parr, Ronald and Russell, Stuart. Reinforcement learning with hierarchies of machines. NIPS, 1998.
Precup, Doina. Temporal abstraction in reinforcement learning. PhD thesis, University of Massachusetts, 2000.
Precup, Doina, Sutton, Richard S, and Singh, Satinder P. Planning with closed-loop macro actions. Technical report, 1997.
Precup, Doina, Sutton, Richard S, and Singh, Satinder. Theoretical results on reinforcement learning with temporally abstract options. In European Conference on Machine Learning (ECML). Springer, 1998.
Schaul, Tom, Horgan, Dan, Gregor, Karol, and Silver, David. Universal value function approximators. ICML, 2015.
Schmidhuber, Jürgen. Neural sequence chunkers. Technical report, 1991.
Schulman, John, Levine, Sergey, Moritz, Philipp, Jordan, Michael I, and Abbeel, Pieter. Trust region policy optimization. In ICML, 2015.
Schulman, John, Moritz, Philipp, Levine, Sergey, Jordan, Michael, and Abbeel, Pieter. High-dimensional continuous control using generalized advantage estimation. ICLR, 2016.
Sutton, Richard S. Td models: Modeling the world at a mixture of time scales. In ICML, 1995.
Sutton, Richard S, Precup, Doina, and Singh, Satinder. Between mdps and semi-mdps: A framework for temporal abstraction in reinforcement learning. Artificial intelligence, 1999.
Tessler, Chen, Givony, Shahar, Zahavy, Tom, Mankowitz, Daniel J, and Mannor, Shie. A deep hierarchical approach to lifelong learning in minecraft. arXiv preprint arXiv:1604.07255, 2016.
Vezhnevets, Alexander, Mnih, Volodymyr, Osindero, Simon, Graves, Alex, Vinyals, Oriol, Agapiou, John, and kavukcuoglu, koray. Strategic attentive writer for learning macro-actions. In NIPS, 2016.
Wiering, Marco and Schmidhuber, Jürgen. Hq-learning. Adaptive Behavior, 1997.
Yu, Fisher and Koltun, Vladlen. Multi-scale context aggregation by dilated convolutions. ICLR, 2016.






