【论文笔记】 Exploration With Task Information for Meta Reinforcement Learning

文章目录

  • 【论文笔记】 Exploration With Task Information for Meta Reinforcement Learning
    • Abstract
      • Keywords
    • I. INTRODUCTION
    • II. RELATED WORK
      • A. Meta Reinforcement Learning
      • B. Exploration in Meta-RL
      • C. Mutual Information
    • III. PRELIMINARIES
      • A. Meta Reinforcement Learning
      • B. Context-Based Meta-RL
    • IV. FORMULATION
      • A. Exploration and Execution Problem for Meta-RL
        • 1. The existing context-based meta-RL lacks effective and efficient exploration in task inference.
        • 2. The joint optimization for task inference and policy networks in context-based meta-RL establishes a chicken-egg optimization problem, resulting in a local optimum.
      • B. Entropy Regularized Meta-RL Objective
        • Exploration Terms in Action Space
        • Exploration Term in Task Embedding Space
      • C. Exploration Mechanism in Task Inference
        • Experience Coverage
        • Task-Relevant Experience
    • V. METHODOLOGY
      • A. Task Inference in Context-Based Meta-RL Framework
      • B. Task Execution in Context-Based Meta-RL Framework
      • C. Implementation of Context-Based Meta-RL
    • VI. EXPERIMENTS
      • A. Experiment Setup
        • (1) Environments
        • (2) Evaluation Details
        • (3) Training Details
      • B. Performance
        • 1. 密集奖励函数
        • 2. 稀疏奖励函数
        • 3. Meta-world 环境
      • C. Understanding of E-CMRL
        • 1. 有效探索
        • 2. 有效执行
      • D. Ablation Studies
        • 1. 动作信息的有效性
        • 2. 探索奖励 r z r_{z} rz
        • 3. N β N_{\beta} Nβ 的有效性
    • VII. CONCLUSION

【论文笔记】 Exploration With Task Information for Meta Reinforcement Learning

Abstract

Recently, context-based meta-RL has been proposed to improve data efficiency by applying a principled framework, dividing the learning procedure into task inference and task execution. However, the task information is not adequately leveraged in this approach, thus leading to inefficient exploration.

基于上下文的元RL通过应用一个原则性的框架来提升数据的有效性,将训练过程分解成任务推断任务执行。这种方法下任务信息不能被足够地利用,导致了不充分的探索。

To address this problem, we propose a novel context-based meta-RL framework with an improved exploration mechanism.

为了解决这个问题,我们提出了一个新的基于上下文的元RL框架,它具有改进的探索机制。

  1. For the existing exploration and execution problem in context-based meta-RL, we propose a novel objective that employs two exploration terms to encourage better exploration in action and task embedding space, respectively.

    针对现有的基于上下文的元RL中的探索和执行问题,我们提出了一个新的目标,即分别使用两个探索“术语”来鼓励在动作(空间)和任务嵌入空间中进行更好的探索。

    The first term pushes for improving the diversity of task inference, while the second term, named action information, works as sharing or hiding task information in different exploration stages.

    第一项推动提高任务推理的多样性;而第二项被称为动作信息,在不同的探索阶段起着共享或隐藏任务信息的作用。

  2. We divide the meta-training procedure into task-independent exploration and task-relevant exploration stages according to the utilization of action information.

    根据动作信息的使用,将元训练阶段划分为任务独立性探索和任务无关性探索

  3. By decoupling task inference and task execution and proposing the respective optimization objectives in the two exploration stages, we can efficiently learn policy and task inference networks.

    通过解耦任务推断和任务执行,并在两个探索阶段提出相应的优化目标,我们可以有效地学习策略和任务推断网络(可能的意思是:任务推断——优化目标——学习任务推断网路;任务执行——优化目标——学习策略)

实验:Mujoco,密集奖励和稀疏奖励。

Keywords

Exploration, meta reinforcement learning (meta-RL), mutual information, task information.

I. INTRODUCTION

**背景:**在实践中,当执行类似的任务时,智能体甚至需要从头开始(learning from scratch)接受训练。因此,通过像人类学习者一样,有效地利用历史经验,提高RL的适应性成为一个有价值的课题。

元强化学习提出:处理上述挑战的有效技术之一是元强化学习(meta-RL),它捕获跨任务的共享知识,并使用很少的交互数据处理新任务。

**分类:**基于梯度(下降)、基于循环网络、基于上下文。

**评价:**前两种方法主要适用于元策略(on-policy)的策略更新,因此在元训练过程中数据效率低。


**基于上下文方法引出:**为了缓解这一问题,一种基于上下文的元RL策略,如"概率嵌入式演员评论家RL"(PEARL),提出了一种异策略(off-policy)形式的元RL,并优于以前的策略方法。

基于上下文方法介绍:在 PEARL 中,学习过程分为两个阶段,即对潜在任务上下文的在线任务推理基于任务特征条件策略的任务执行。

基于上下文方法问题:

  • First, existing works lack efficient exploration during task inference. The exploration in PEARL only originates from the policy entropy term and the posterior distribution of task belief, lacking the task information guideline. 首先,现有的工作在任务推理过程中缺乏有效的探索。PEARL 的探索仅源于策略熵项和任务信念的后验分布,缺乏任务信息指导。Although we have no access to task labels or descriptions, task inference should involve more task-relevant information for low inference bias.虽然我们无法访问任务标签或描述,但任务推理应该涉及更多的任务相关信息,以实现低推理偏差。
  1. PEARL则是用一个额外的神经网络训练得到一个可用于描述context的隐层变量中;
  2. on-policy算法是基于policy gradient的算法,它们直接控制策略中动作的分布,从而能够根据当前数据所反映出来的任务分布对策略进行调整,符合meta-RL的要求;
  3. 给一个用于训练的任务集合,元训练的过程就是学习得到一个策略,这个策略能够通过对历史transition经验的推理迅速适应新的任务。我们将这种历史信息称为 context, c c c。具体来说, c n T = { s n , a n , r n , s n ′ } c_{n}^{\Tau}=\{s_{n},a_{n},r_{n},s_{n}^{\prime}\} cnT={sn,an,rn,sn} 表示任务 T \Tau T 中的一个transition, 则包含了至今为止所有的经验。在测试阶段,智能体的策略必须能够迅速适应从 p ( T ) p(\Tau) p(T) 所采样得到的新任务。
  • Second, the optimization processes for task inference and task execution are coupled, impeding policy optimization. In context-based meta-RL, an exploration policy and an execution policy are presented but keep the same in many works.

    任务推断和任务执行的过程被耦合了,阻碍了策略的优化。在基于上下文的meta-RL中,提出了一个探索策略和一个执行策略,但在许多工作中保持不变。

    In other words, the policy shall play the roles of exploration and execution simultaneously. In the early stage of meta-training, the collected experience from the non-optimal policy limits task inference, thus limiting task execution. Hence, the framework of task inference and task execution should be adjusted for effective policy optimization.

    策略必须同时具有探索和执行。在早期的元训练阶段,从非最优的策略中收集到的策略限制了任务的推理,因此限制了任务的执行(与我们的想法类似)。任务推断和执行框架应有效地调整来应对高效的策略优化。


In this article, we propose a novel context-based meta-RL framework with an improved exploration mechanism based on task information. Built on the framework of PEARL, meta-RL is formulated as a partially observable Markov decision process (POMDP) while the task representation is approximated by Gaussian distribution. Our aim is to enhance exploration in task inference as well as decouple task inference and task execution for improving policy optimization.

提出基于任务信息的改进探索策略的新的元强化学习框架。在PEARL的框架上,元RL表示为部分可观察的马尔可夫决策过程(POMDP),而任务特征近似于高斯分布。我们的目标是增强任务推理的探索,以及解耦任务推理和任务执行,以改进策略优化。

为此,通过提出一个新的目标,积极鼓励策略探索,并推导出分别作用于行动空间和任务嵌入空间的两个探索术语

任务嵌入空间中的探索项称为任务熵,它起源于任务推理网络的熵,增强任务推理的多样性(目标是熵增,任务推理的结果变得更多)。此外,动作空间中探索术语:动作信息,建立在动作潜在任务表征之间的互信息基础上,对任务相关信息进行评价。

In our setting, the derived action information works as sharing or hiding task information in different stages of meta-training. In the early stage of meta-training, action information encourages uniform exploration by restraining task-relevant information because the collected experience from the initial policy provide less task-relevant information. When the policy gets improved and fulfills tasks effectively, this term is leveraged to encourage collecting task-relevant information to fulfill the specific task with better performance. In the end, we reconstruct the optimization objectives of task inference and policy network in different stages and propose our novel context-based meta-RL algorithm.

在我们的设置中,衍生出的动作信息在元训练的不同阶段共享隐藏任务信息。在元训练的早期阶段,行动信息通过限制任务相关信息来鼓励统一的探索,因为从初始策略中收集到的经验提供了较少的任务相关信息(既然任务特征较少,所以就干脆抑制他,抑制同时提供机会训练推理网络)。当策略得到改进并有效地完成任务时,这个术语被用来鼓励收集与任务相关的信息,以更好的性能完成特定的任务(有任务特征信息就尽量放大)。最后,我们在不同阶段重构了任务推理和策略网络的优化目标,并提出了基于上下文的元RL算法。


“Then, we propose a novel objective that encourages more extensive exploration.” 更激进的探索。

II. RELATED WORK

A. Meta Reinforcement Learning

The recurrent or recursive model directly meta-learns a function that takes historical experience as input and distills task-conditional policy in the follow-up time steps. RL^2 structures the agent as a recurrent neural network, extracting the past experience as the internal state for the subsequent task fulfillment. The subsequent related works focus on the network structure for distilling task information efficiently.

循环或递归模型直接元学习一个函数,以历史经验作为输入,并在后续时间步骤中提取任务条件策略。RL^2 将智能体构建为一个递归神经网络,提取过去的经验作为后续任务完成的内部状态。后续的相关工作关注于有效地提取任务信息的网络结构。

B. Exploration in Meta-RL

There exist various exploration techniques for three types of methods.

  1. Stadie et al. asserted MAML and RL^2 pay less attention to exploration and propose E-MAML that applies stochastic gradient descent for good rewards in eventual meta-updates. Model agnostic exploration with structured noise (MASEN) introduces good exploration strategies for MAML by acquiring latent exploration space that injects structured stochasticity into a policy.
  2. E-RL2 extracts task information from the first few rollouts without reward and fulfills tasks in the later rollouts based on the explored task information.
  3. Context-based meta-RL proposes posterior sampling in task embedding space to enable exploration for better task inference.
  4. Gurumurthy et al. use separate policies for pre-update and post-update sampling, and apply a self-supervised objective in the inner loop update for stable task-specific information. Context-aware task encoder with self-supervised task exploration for efficient meta-RL (CASTER) enhances task inference procedure via active task exploration and applies more efficient task information to task execution. In addition to two separate policies, Kamienny et al. and Liu et al. seek a new exploration objective based on privileged information of task ID and learn task inference procedure in a supervised manner.

C. Mutual Information

互信息或信息增益起源于一种流行的度量函数,在RL和元RL中得到了广泛的应用。

  1. Houthooft 等人将状态-动作对和环境动力学特性之间的互信息,表示为智能体对环境或动力学的置信度的贝叶斯不确定性。
  2. Strouse 等人和 Goyal 等人、将这种类型的信息正则化应用于多任务学习中,有助于提炼跨任务共享的知识。
  3. Ratzlaff 等人提出了一种基于高维观测互信息的实用探索方法,在一个紧凑的表示空间内提取预测探测信号。
  4. Teh 等人和 Galashov 等人旨在提炼基于多目标环境中新任务的一般策略。
  5. Sharma等人通过将内在重塑的奖励,定义为状态和生成的技能之间的相互信息,从而实现了对技能的动态感知发现。

III. PRELIMINARIES

A. Meta Reinforcement Learning

Meta-RL aims to address the fast adaptation problem in RL, allowing the agent to adapt to new tasks quickly. We adapt the meta-learning framework to enable fast learning, incorporating a prior of past experience in structurally similar tasks.

元强化学习本身是用来提升泛化的,这篇论文用结合结构化的相似任务的先验知识的元强化学习

通常,meta-RL考虑一个MDPs家族 ( S , A , R T , P T ) (S,A,R_{\Tau},P_{\Tau}) (S,A,RT,PT),其中状态空间 S S S、动作空间 A A A、奖励函数 R T R_{\Tau} RT 和转移概率 P T P_{\Tau} PT,后两项由任务 T T T 参数化。不同的任务共享相似的结构(例如,在具有不同布局的迷宫中搜索),并从相同的任务分布 ρ ( T ) ρ(\Tau) ρ(T) 中采样。更准确地说,任务具有相同的状态、行动空间,而过渡概率或奖励功能可能因任务而不同。

元强化学习的训练过程可以分解为元训练和元测试阶段。两个阶段的任务都从一个分布中采样,但是任务之间不会重叠。对于每个任务,智能体都通过参数化的策略 π θ \pi_{\theta} πθ 重复与环境交互若干次,生成 episodes,终止条件是智能体的交互达到了终点以及达到了最大的交互步长。给定折扣因子 γ γ γ,智能体的目标是通过优化执行策略 π θ π_{θ} πθ 来最大化每个任务 T i T_{i} Ti 的总折扣回报。
E π θ , T i ∈ p ( T ) [ Σ t = 0 H − 1 γ t r t i ] E_{\pi_{\theta},\mathscr{\Tau_{i}}\in p(\Tau)}[\Sigma_{t=0}^{H-1}\gamma_{t}r_{t}^{i}] Eπθ,Tip(T)[Σt=0H1γtrti]

B. Context-Based Meta-RL

基本上,我们在元测试阶段通过任务性能和样本效率来评估元RL。为此,其核心见解是从训练任务的历史经验中提取与任务相关的信息,以加速测试任务中的学习。基于上下文的元RL提供了一种很有前途的技术。

基于上下文的元RL的元训练过程分为任务推理和任务执行,主要目标是学习一种适应手头任务的策略,调节过去过渡的转换历史,称为上下文 c ⃗ \vec{c} c c 1 : N T i c^{T_{i}}_{1:N} c1:NTi 包括迄今为止收集到的经验,稍后简化为 c ⃗ \vec{c} c 。然后提出了由 φ φ φ 参数化的推理网络 q φ ( z ∣ c ) q_{φ}(z|c) qφ(zc) 来对给定上下文 c ⃗ \vec{c} c 条件下的潜在概率任务上下文变量 z z z 进行编码。在任务执行过程中,智能体目标是优化任务条件策略 π θ ( a ∣ s , z ) π_{θ}(a|s,z) πθ(as,z),以解决从 z z z 上给定的任务样本。

把基于上下文的方法用在了 SAC 方法上,相当于在 z z z 条件下额外增加了熵的目标,beta是超参数限制幅度的
E π θ , T i ∈ p ( T ) [ Σ t = 0 H − 1 γ t ( r t i + β H π θ ( ⋅ ∣ s t i , z ) ] (3) E_{\pi_{\theta},\mathscr{\Tau_{i}}\in p(\Tau)}[\Sigma_{t=0}^{H-1}\gamma_{t}(r_{t}^{i}+\beta H^{\pi_{\theta}}(\cdot|s_{t}^{i},z)]\tag{3} Eπθ,Tip(T)[Σt=0H1γt(rti+βHπθ(sti,z)](3)
(3)中的目标是基于奖励的目标的探索形式,在行动空间任务嵌入空间中引入了一种新的探索机制。

In essence, context-based meta-RL is formulated as a POMDP in which latent context z serves as the unobserved part in state space. As a result, the main procedure is converted to optimizing inference network q φ ( z ∣ c ) q_{φ}(z|c) qφ(zc) in the task inference phase and optimizing policy network π θ ( a ∣ s , z ) π_{θ}(a|s,z) πθ(as,z) in the task execution phase, and both of them are interdependent. Therefore, the resulted policy adapts to test tasks quickly.

本质上,基于上下文的元RL被表述为一个POMDP,其中潜在的上下文 z z z 作为状态空间中未被观察到的部分。因此,主要过程在任务推理阶段转换为优化推理网络 q φ ( z ∣ c ) q_{φ}(z|c) qφ(zc) ,在任务执行阶段转换为优化策略网络 π θ ( a ∣ s , z ) π_{θ}(a|s,z) πθ(as,z) ,两者都是相互依赖的。因此,结果得到的策略可以快速地适应测试任务。

IV. FORMULATION

A. Exploration and Execution Problem for Meta-RL

1. The existing context-based meta-RL lacks effective and efficient exploration in task inference.

探索对于适应新任务至关重要,因为它负责收集信息经验来推断任务。尽管 PEARL 对潜在上下文 z z z 建模了一个推理分布,并鼓励通过后验抽样进行探索,但这种纯粹的探索对任务相关信息的贡献很小。除此之外,现有工作中的推理和策略网络的优化都是在整个元训练过程中建立在相同的目标之上的,这限制了探索。

2. The joint optimization for task inference and policy networks in context-based meta-RL establishes a chicken-egg optimization problem, resulting in a local optimum.

基于上下文的元RL中的任务推理和策略网络的联合优化,建立了一个鸡蛋优化问题,得到了一个局部最优。

chicken-egg optimization problem:二者互生共存问题,以彼此的存在为前提和依赖基础。要求解A,需依赖于B,而B又以A的条件为基础。

具体来说,学习任务推理需要策略收集解决任务的必要经验,而解决特定任务的学习策略需要通过任务推理提供信息丰富的潜在任务上下文。

B. Entropy Regularized Meta-RL Objective

解决探索和执行问题的直观方案是增强对任务推理解耦任务推理和执行的探索。具体来说,我们提出了一种新的探索机制,其中我们将元训练阶段,划分为与任务独立的探索阶段和与任务相关的探索阶段。我们非常鼓励在任务依赖的早期探索阶段完成任务,并鼓励收集与任务相关的经验,在与任务相关的探索阶段提取有效的任务情境。

正如在基于上下文的meta-RL中所述,任务 T i T_{i} Ti 的上下文 c i c^{i} ci 不会直接应用于策略 π π π 和释放的熵项。为了方便地应用这种熵正则化(entropy regulation),我们将推理网络 q φ ( z ∣ c i ) q_{φ}(z|c^{i}) qφ(zci) 和任务条件策略 π θ ( a ∣ s , z ) π_{θ}(a|s,z) πθ(as,z) 引入到原始熵项的估计中。const 表示独立于策略和任务推理网络的常数。
H π ( a ∣ s , c i ) ≥ ∫ ∫ π ( a , z ∣ s , c i ) log ⁡ ( q ( z ∣ s , c i ) π ( a , z ∣ s , c i ) ) d a d z = − I ( a , z ∣ s , c i ) + E [ H π θ ( ⋅ ∣ s , z ) ] + H q ϕ ( ⋅ ∣ c i ) + const H^{\pi}(a|s,c^{i})\ge \int\int\pi(a,z|s,c^{i})\log\big( \frac{q(z|s,c^{i})}{\pi(a,z|s,c^{i})} \big)\mathbf{d}a\mathbf{d}z\\=-I(a,z|s,c^{i})+E[H^{\pi_{\theta}}(\cdot|s,z)]+H^{q_{\phi}}(\cdot|c^{i})+\text{const} Hπ(as,ci)∫∫π(a,zs,ci)log(π(a,zs,ci)q(zs,ci))dadz=I(a,zs,ci)+E[Hπθ(s,z)]+Hqϕ(ci)+const

Exploration Terms in Action Space

  1. One is the policy entropy term H π θ ( ⋅ ∣ s , z ) H^{\pi_{\theta}}(\cdot|s,z) Hπθ(s,z) that works like SAC. More precisely, the actor network π θ ( a ∣ s , z ) \pi_{\theta}(a|s,z) πθ(as,z) is modeled as Gaussian distribution, and the entropy term H π θ ( ⋅ ∣ s , z ) H^{π_{θ}} (·|s,z) Hπθ(s,z) encourages the agent to succeed at the task while act as randomly as possible.

    H π θ ( ⋅ ∣ s , z ) H^{\pi_{\theta}}(\cdot|s,z) Hπθ(s,z) 的作用跟在 SAC 算法上的很像。演员的网络 π θ ( a ∣ s , z ) \pi_{\theta}(a|s,z) πθ(as,z) 被建模成了高斯分布, H π θ ( ⋅ ∣ s , z ) H^{π_{θ}} (·|s,z) Hπθ(s,z) 的术语表示鼓励智能体在采取尽可能随机的动作中成功执行任务。

  2. The other is an information regularizer I ( a , z ∣ s , c ) I(a,z|s, c) I(a,zs,c) called action information, which denotes the conditional mutual information between the inferred task context z z z and action a given state s s s and context c c c. The derived term − I ( a , z ∣ s , c ) -I(a,z|s, c) I(a,zs,c) encourages the agent to hide task-relevant information and devote policy to explore action space like H π θ ( ⋅ ∣ s , z ) H^{π_{θ}}(·|s,z) Hπθ(s,z), that is to say, this term is committed to uniform exploration while fulfilling tasks. The function of action information is expounded later.

    另一个是被称为动作信息的信息正则化器 I ( a , z ∣ s , c ) I(a,z|s, c) I(a,zs,c),它表示推断的任务上下文 z z z 与给定状态 s s s 和上下文 c c c 之间的条件互信息。负项 − I ( a , z ∣ s , c ) -I(a,z|s, c) I(a,zs,c) 鼓励智能体去隐藏任务相关的信息并致力于使策略像 H π θ ( ⋅ ∣ s , z ) H^{π_{θ}}(·|s,z) Hπθ(s,z) 一样探索动作空间。这个术语致力于在完成任务的同时统一探索。

Exploration Term in Task Embedding Space

The entropy of the task inference network H q φ ( ⋅ ∣ c i ) H^{q_{φ}}(·|c^{i}) Hqφ(ci) called task entropy encourages covering the task embedding space. Even though existing works formulate the latent context as probabilistic not deterministic for more active exploration in task embedding space, it only covers the local limited task space for the current task.

任务推断网络输出结果的熵,叫做任务熵,鼓励覆盖任务的嵌入空间。尽管现存的工作,出于有效的探索,将潜在上下文表达成概率信息而非确定信息,但是这种概率信息需要抽象才能用于策略中,只是用到了局部的限制信息而非当前策略的全部信息。(而要想用全部信息,就必须经过多次迭代,才能将潜在变量的分布清晰刻画出来)

H π θ ( ⋅ ∣ s , z ) H^{π_{θ}}(·|s,z) Hπθ(s,z) improves action exploration by acquiring diverse behaviors in action space while H q ϕ ( ⋅ ∣ c i ) H^{q_{\phi}}(\cdot|c^{i}) Hqϕ(ci) improves task context exploration by acquiring diverse latent context in task embedding space.

H π θ ( ⋅ ∣ s , z ) H^{π_{θ}}(·|s,z) Hπθ(s,z) 通过获得在动作空间中获得多样的行为提升动作上的探索, H q ϕ ( ⋅ ∣ c i ) H^{q_{\phi}}(\cdot|c^{i}) Hqϕ(ci) 通过在任务嵌入空间中获得多样的潜在上下文来鼓励探索。

【论文笔记】 Exploration With Task Information for Meta Reinforcement Learning_第1张图片

任务相关信息 z z z 是不明确的,特别是在元训练的早期阶段。由于 z z z 的无监督学习是建立在最初不成熟策略的基础上收集到的经验上的,因此最初的任务推理很难集中有效。在这一阶段,第三项推动策略在不考虑足够的任务信息的情况下去完成任务。

2

C. Exploration Mechanism in Task Inference

Experience Coverage

首先,策略外缓冲区存储来自以前不同策略的样本轨迹,而策略上的更新仅利用来自当前策略的样本轨迹。这种机制意味着非策略重放缓冲区可以覆盖更宽的状态空间。其次,策略熵项 H π θ ( ⋅ ∣ s , z ) H^{π_{θ}}(·|s,z) Hπθ(s,z) 添加到奖励项中,鼓励智能体同时成功地完成任务和探索行动空间。该随机策略在训练阶段进行探索,并在测试阶段确定以成功完成任务。

在我们的工作中,经验覆盖的创新探索项是任务熵项的部署:
H q ϕ ( ⋅ ∣ c i ) = E q ϕ ( z ∣ c i ) [ − log ⁡ ( q ϕ ( z ∣ c i ) ) ] H^{q_{\phi}}(\cdot|c^{i})=E_{q_{\phi}(z|c^{i})}[-\log(q_{\phi}(z|c^{i}))] Hqϕ(ci)=Eqϕ(zci)[log(qϕ(zci))]
然而,任务熵鼓励对任务嵌入空间的探索,并通过将潜在情境尽可能随机化,激励潜在任务情境尽可能多样化。沿着这条线,最大化这个术语意味着为一个任务推理学习多个可用的解决方案。这样,这样的任务推理模块在转向一个看不见的测试任务时是健壮的,并快速适应它。然而,直接优化 H q ϕ ( ⋅ ∣ c i ) H^{q_{\phi}}(\cdot|c^{i}) Hqϕ(ci) 会导致 z z z 在任务嵌入空间中均匀分布,从而忽略了与任务相关的信息。我们将这个术语转换为 r z = − log ⁡ ( q φ ( z ∣ c i ) ) r_z =−\log(q_φ(z|c^{i})) rz=log(qφ(zci)),对每个任务保持不变。这样,当 r t i r_{t}^{i} rti 在早期元训练阶段不够具有指导意义时, r z r_z rz 有助于任务空间的探索。

Task-Relevant Experience

除了上述经验覆盖外,任务推理的探索基础还包括收集任务信息经验。
I a = H ( z ∣ s , c ) − H ( z ∣ a , s , c ) = H ( a ∣ s , c ) − H ( a ∣ z , s , c ) I_a = H(z|s, c) − H(z|a,s, c)\\=H(a|s, c) − H(a|z,s, c) Ia=H(zs,c)H(za,s,c)=H(as,c)H(az,s,c)
互信息量化了给定策略部署 s , c → a s,c→a s,ca z z z 的了解程度。最大化这个项对应于通过最大化熵 H ( a ∣ s , c ) H(a|s,c) H(as,c) 来提高动作的随机性,同时通过最小化 H ( a ∣ z , s , c ) H(a|z,s,c) H(az,s,c) 来使 z z z 提供关于当前状态下动作执行的信息。因此, I a I_a Ia 作为一种内在的奖励,鼓励收集轨迹来区分当前的任务,即任务信息经验。

【论文笔记】 Exploration With Task Information for Meta Reinforcement Learning_第2张图片

q φ ( z ∣ c ) q_{φ}(z|c) qφzc 表示对预先推断的潜在任务上下文z的期望, E π θ E_{π_{θ}} Eπθ 表示对 π θ π_{θ} πθ 轨迹的期望,KL表示KL散度, π 0 ( a ∣ s ) π_{0}(a|s) π0(as) 表示独立于任务上下文 z z z 的默认策略。 π 0 ( a ∣ s ) = ∫ p ( z ) π ( a ∣ s , z ) d z π_{0}(a|s) = \int p(z)π(a|s,z)dz π0(as)=p(z)π(as,z)dz 指导智能体在缺少任何附加任务信息的情况下应遵循的默认行为。从另一个角度来看,默认策略也可以被解释为所有任务上下文 z z z 下的综合统一行为。

V. METHODOLOGY

A. Task Inference in Context-Based Meta-RL Framework

在任务推理阶段,我们专注于优化推理网络。我们在任务嵌入空间中构建探索奖励,这有助于任务推理。
r ′ = r + β 1 r z r^{\prime}=r+\beta_{1}r_z r=r+β1rz
此外, r z r_z rz 在每一 episode 开始时都被确定,其他的在每一步都被采样。所有的奖励都是通过一个截断的梯度来产生的。

在任务独立的探索阶段,我们利用贝尔曼更新损失 Q θ i ( s , a , z ) Q^{i}_{θ}(s,a,z) Qθi(s,a,z) 的探索奖励,策略熵和行动信息来训练推理网络。
L c r i t i c = E z ∼ q ϕ ( z ∣ c ) ( s , a , r , s ′ ) [ Q θ i ( s , a , z ) − ( r ′ + γ V ^ θ i ( s ′ , z ) ) ] 2 \mathscr{L}_{critic}=E^{(s,a,r,s^{\prime})}_{z\sim q_{\phi}(z|c)}[Q_{\theta}^{i}(s,a,z)-(r^{\prime}+\gamma\hat{V}_{\theta}^{i}(s^{\prime},z))]^{2} Lcritic=Ezqϕ(zc)(s,a,r,s)[Qθi(s,a,z)(r+γV^θi(s,z))]2

V θ i ( s , z ) = E a ∼ π [ Q θ i ( s , a , z ) − β 2 log ⁡ π θ ( a ∣ s , z ) − β 3 K L ( π θ ( a ∣ s , z ) ∣ ∣ π 0 ( a ∣ s , z ) ) ] V_{θ}^{i}(s,z) = E_{a\sim\pi}[Q_{\theta}^{i}(s,a,z)-\beta_{2}\log\pi_{\theta}(a|s,z)-\beta_{3}KL(\pi_{\theta}(a|s,z)||\pi_{0}(a|s,z))] Vθi(s,z)=Eaπ[Qθi(s,a,z)β2logπθ(as,z)β3KL(πθ(as,z)∣∣π0(as,z))]

在与任务相关的探索阶段,我们利用贝尔曼更新损失来训练推理网络。
L c r i t i c = E z ∼ q ϕ ( z ∣ c ) ( s , a , r , s ′ ) [ Q θ r ( s , a , z ) − ( r ′ + γ V ^ θ r ( s ′ , z ) ) ] 2 \mathscr{L}_{critic}=E^{(s,a,r,s^{\prime})}_{z\sim q_{\phi}(z|c)}[Q_{\theta}^{r}(s,a,z)-(r^{\prime}+\gamma\hat{V}_{\theta}^{r}(s^{\prime},z))]^{2} Lcritic=Ezqϕ(zc)(s,a,r,s)[Qθr(s,a,z)(r+γV^θr(s,z))]2

V θ r ( s , z ) = E a ∼ π [ Q θ r ( s , a , z ) − β 2 log ⁡ π θ ( a ∣ s , z ) − β 3 K L ( π θ ( a ∣ s , z ) ∣ ∣ π 0 ( a ∣ s , z ) ) ] V_{θ}^{r}(s,z) = E_{a\sim\pi}[Q_{\theta}^{r}(s,a,z)-\beta_{2}\log\pi_{\theta}(a|s,z)-\beta_{3}KL(\pi_{\theta}(a|s,z)||\pi_{0}(a|s,z))] Vθr(s,z)=Eaπ[Qθr(s,a,z)β2logπθ(as,z)β3KL(πθ(as,z)∣∣π0(as,z))]

综上所述, q φ ( z ∣ c ) q_{φ}(z|c) qφ(zc) 的更新在很大程度上取决于以下自由能的梯度:
J φ = L c r i t i c + α E c [ K L ( q φ ( z ∣ c ) ∣ ∣ r ( z ) ) ] J_φ = \mathscr{L}_{critic} + αE_{c}[KL(q_{φ}(z|c)||r(z))] Jφ=Lcritic+αEc[KL(qφ(zc)∣∣r(z))]

B. Task Execution in Context-Based Meta-RL Framework

在任务独立的探索阶段,我们试图忽略与任务相关的信息,并训练智能体来最大化新的目标如下:

4

因为是要最大化 J ( π θ ) J(\pi_{\theta}) J(πθ) 这个公式的,那么就要扣除掉 I a I_a Ia 这个项目,削弱与任务相关的信息,对应于前文的 “hide”,隐藏信息。

在与任务相关的探索阶段,我们利用与任务相关的信息,训练智能体来最大化新的目标如下:

5

最大化原有的累计奖励和探索熵,再额外增加 I a I_a Ia 这个项目,增加与任务相关的信息,对应于前文的“share”,共享信息。

在任务推理过程中推断的 z z z 下,任务 T i T_{i} Ti 的新目标如下:

6

也就是对前面两个式子的整合。

优化关于策略参数 θ θ θ 的KL项似乎有点困难,因为上述期望是相对于采样轨迹的。然而,梯度可以通过使用所谓的 对数导数技巧 来重写该项作为对轨迹的期望来估计。

7

在实际实现中,我们应用了自动微分和重新参数化的技巧,而不是一个低方差估计量。
π 0 ∗ = min ⁡ π 0 J ( π 0 ) = min ⁡ π 0 E z [ K L ( π θ ( a ∣ s , z ) ∣ ∣ π 0 ( a ∣ s , z ) ) ] π_{0}^{\ast}=\min_{π_{0}}J(π_{0})=\min_{π_{0}}E_{z}\big[KL(\pi_{\theta}(a|s,z)||\pi_{0}(a|s,z))\big] π0=π0minJ(π0)=π0minEz[KL(πθ(as,z)∣∣π0(as,z))]
因此,学习 π 0 π_{0} π0 可以被看作是监督学习,其中 π 0 π_{0} π0 被训练来匹配由 π θ π_{θ} πθ 产生的任务条件动作序列。事实上,最优的 π 0 π_{0} π0 对整个任务都有足够的信息和能力。

C. Implementation of Context-Based Meta-RL

一些研究者试图利用两种策略来完成任务:探索策略和执行策略,其中探索策略负责探索和收集信息经验来推断任务,而执行策略的目标是基于推断的任务成功地完成任务。但是作者也没有很反驳出来,只是说复杂的,没有同时性的。

对于上面提到的探索和执行问题,我们提出了两个探索阶段来促进探索,并在每个阶段将任务推理和任务执行解耦。算法2揭示了该解耦过程,其中推理和策略网络的优化在训练步骤中被解耦。更准确地说,在每次样本迭代中,我们部署 L i L_{i} Li 优化步骤进行任务推理,即只优化 q φ ( z ∣ c ) q_{φ}(z|c) qφ(zc),然后在优化的后续步骤中训练策略和价值网络,同时保持 q φ ( z ∣ c ) q_{φ}(z|c) qφ(zc)不变。这样,通过经验证据,稳定的推断 z z z 对任务的完成有很大的贡献。

策略 π θ π_{θ} πθ 有望利用收集到的经验并执行积极的行动。建议的默认策略 π 0 π_{0} π0 π θ π_{θ} πθ 设计相同的结构,只将状态 s s s 作为输入,并将操作 a a a 作为输出。此外,在 N β + 1 N_{β}+1 Nβ+1 迭代时, Q θ r ( s , a , z ) Q^{r}_{θ}(s,a,z) Qθr(s,a,z) 的值继承了 Q θ i ( s , a , z ) Q^{i}_{θ}(s,a,z) Qθi(s,a,z) 的值,因为随机初始化它的值将浪费更多的时间。因此,在算法图中,我们只使用一个Q来表示Qi,Qr。我们的算法被命名为E-CMRL(基于上下文的元rl的缩写),算法1的元训练过程在算法1中进行了总结。

【论文笔记】 Exploration With Task Information for Meta Reinforcement Learning_第3张图片

VI. EXPERIMENTS

A. Experiment Setup

(1) Environments

name detail
Half-Cheetah-Dir Require HalfCheetah-v2 to move forward or backward (two tasks for train and test)
Half-Cheetah-Vel Require HalfCheetah-v2 to reach different target velocities while keep running forward (100 train tasks, 30 test tasks).
其他类似,都是在数值语义上做不同的任务。

(2) Evaluation Details

我们采用以下评估方案:每个环境的所有估计的每集性能和每个算法在至少三次使用不同随机种子的试验中被平均。

(3) Training Details

所有的参与者网络和评论家网络都是具有300个单元和重新激活函数的三层网络。

策略网络的输出是策略分布的均值和方差向量。

B. Performance

We compare E-CMRL with existing policy gradient meta-RL methods such as MAML-TRPO, Promp, and context-based meta-RL methods PEARL.

1. 密集奖励函数

测试任务的性能通过所有元测试任务的最后一个适应集平均返回来评估。训练效率是通过收集的元训练经验来衡量的。更值得注意的是,元测试任务与元训练任务没有交集。

【论文笔记】 Exploration With Task Information for Meta Reinforcement Learning_第4张图片

【论文笔记】 Exploration With Task Information for Meta Reinforcement Learning_第5张图片

First, task inference involves task-relevant information from the same experience. In addition, the adjustment of I a I_a Ia reaches the balance of exploration and execution for task relevant information, avoiding the utilization of inaccurate task information. Beyond that, the decoupling of the optimization procedure is benefificial for more stable learning.

首先,任务推理涉及到来自同一经验的任务相关信息。此外, I a I_a Ia的调整达到了对任务相关信息的探索和执行的平衡,避免了使用不准确的任务信息。除此之外,优化过程的解耦还有利于更稳定的学习。

2. 稀疏奖励函数

【论文笔记】 Exploration With Task Information for Meta Reinforcement Learning_第6张图片

Meta-World is a recently proposed challenging evaluation benchmark for meta-RL, in which another assessment criteria: success rate, is proposed. The average success rate over multiple repeated experiments is a valuable measurement for task fulfifillment in addition to cumulative reward.

3. Meta-world 环境

【论文笔记】 Exploration With Task Information for Meta Reinforcement Learning_第7张图片

C. Understanding of E-CMRL

1. 有效探索

这一结果告诉我们,E-CMRL的探索推动了代理以更高或更低的奖励覆盖更宽的状态空间,从而促进了任务推理。相比之下,PEARL专注于有限的状态空间,奖励间隔较短,这与任务探索和相关的任务推理相悖。在随后的情节中,潜在变量 z z z 促进了平均奖励,但不能扩大覆盖范围。有了更准确的任务信息,这两种方法都能将代理推向更有目的性的区域。

2. 有效执行

Although E-CMRL does not propose two policies for sample trajectory and task execution, respectively, our trained policy can make effective exploration and task execution simultaneously.

D. Ablation Studies

1. 动作信息的有效性

【论文笔记】 Exploration With Task Information for Meta Reinforcement Learning_第8张图片

2. 探索奖励 r z r_{z} rz

3. N β N_{\beta} Nβ 的有效性

N β = 0 N_{β} = 0 Nβ=0 时,这意味着策略在开始时利用推断的任务相关信息,缓慢的收敛趋势意味着从低质量的经验推断的 z z z 对策略优化有害。随着 N β N_{β} Nβ 的增加,收敛速度和渐近性能得到提高,这意味着从高质量经验推断出的 z z z 对策略优化有很大贡献。此外, N β = 50 , 100 , 200 N_{β} = 50,100,200 Nβ=50,100,200 N β = 300 , 1000 N_{β} = 300,1000 Nβ=300,1000 之间的比较表明,对于过度的漫无目的的探索,应该限制任务独立的探索阶段。这一现象也说明了 N β N_{β} Nβ 的调整是一件困难的工作。

VII. CONCLUSION

  1. we built a novel objective with an improved exploration mechanism that employs two additional exploration terms in task embedding and action space, respectively.
  2. The main contribution is formulating meta-RL framework, which utilizes a novel context-based meta-RL framework, which utilizes task-relevant information effificiently and decouples optimizing inference and policy network.

你可能感兴趣的:(论文笔记,MetaRL_Notes,论文阅读,元强化学习)