← 论文海报合集← Paper Notes|
理论与优化 · Theory & OptimizationTheory & Optimization

Upside-Down Reinforcement Learning

把强化学习「翻转过来」:用奖励与时间步长作指令,纯监督学习训练智能体Turning reinforcement learning upside down: rewards and time horizons become input commands, and agents are trained by pure supervised learning
Rupesh Kumar Srivastava, Pranav Shyam, Filipe Mutz, Wojciech Jaśkowski, Jürgen Schmidhuber
IDSIA / NNAISENSE  ·  arXiv 1912.02877 (Srivastava et al.) + arXiv 1912.02875 (Schmidhuber)

传统强化学习需要预测值函数(value function)或使用策略梯度(policy gradient)。 UDRL 将问题「倒置」:不预测奖励,而是将期望奖励(desired return)和期望步长(desired horizon)作为输入命令, 通过纯监督学习训练智能体直接将命令映射到动作。 实验表明,UDRL 在多个基准任务上可与,乃至超越经历了数十年研究积累的传统 RL 算法。Traditional reinforcement learning requires predicting a value function or using policy gradients. UDRL turns the problem upside down: instead of predicting rewards, it takes the desired return and the desired horizon as input commands and trains the agent by pure supervised learning to map commands directly to actions. Experiments show that UDRL can match and even surpass traditional RL algorithms built on decades of accumulated research across several benchmark tasks.

arXiv 2019-12-05 NeurIPS 2019 Deep RL Workshop MuJoCo · VizDoom · LunarLander 📄 arXiv:1912.02877 概念论文Concept paper arXiv:1912.02875
upside-down reinforcement learning UDRL behavior function supervised learning for RL command-conditioned policy hindsight relabeling 无值函数 RLvalue-function-free RL sparse reward

01 动机Motivation

强化学习(RL)与监督学习(SL)之间有一道根本鸿沟:SL 提供误差信号(error signal), 而 RL 提供评估信号(evaluation signal)——智能体只知道动作好不好,却不知道最优动作是什么。 能否完全用 SL 来解决 RL 问题?Barto(2004)曾断言「一般情况下这是不可能的」。 UDRL 正面回应了这一挑战。There is a fundamental gap between reinforcement learning (RL) and supervised learning (SL): SL provides an error signal, whereas RL provides an evaluation signal — the agent only learns whether an action was good, not what the optimal action would have been. Can RL problems be solved entirely with SL? Barto (2004) once asserted that this is impossible in general. UDRL takes that challenge head-on.

"Is it possible to learn to act in high-dimensional environments efficiently using only SL, avoiding the issues arising from non-stationary learning objectives common in traditional RL algorithms?" — Srivastava et al., 1912.02877
UDRL vs traditional RL comparison
传统 RL vs. UDRL 的核心对比。 传统 RL 的动作-价值函数(Q)预测长期期望回报; UDRL 的行为函数(behavior function B)则以期望回报(desired return)和期望步长(desired horizon)作为输入, 直接输出当前动作的概率分布——动作与回报的角色被「倒置」了。 (来源:论文 Figure 1,arXiv:1912.02877)The core contrast between traditional RL and UDRL. The action-value function (Q) of traditional RL predicts the long-term expected return; the behavior function B of UDRL instead takes the desired return and the desired horizon as inputs and directly outputs a probability distribution over the current action — the roles of action and return are turned upside down. (Source: paper Figure 1, arXiv:1912.02877)
纯 SLPure SL无 TD 学习,无策略梯度,不使用 bootstrappingNo TD learning, no policy gradients, no bootstrapping
20 runs所有最终对比均使用 20 次独立实验,95% 置信区间All final comparisons use 20 independent runs with 95% confidence intervals
4 环境4 envsLunarLander-v2、TakeCover-v0、Swimmer-v2、InvertedDoublePendulum-v2LunarLander-v2, TakeCover-v0, Swimmer-v2, InvertedDoublePendulum-v2
R≈0.98LunarLander-v2 上 desired vs. obtained return 的相关系数Correlation coefficient between desired and obtained return on LunarLander-v2

现有大多数将 SL 引入 RL 的工作(如 target network、RUDDER)只是用 SL 来辅助 RL, 而非替代它。UDRL 则更进一步:将过去的轨迹以「事后解释」(hindsight)的方式标注, 视之为智能体成功跟随命令的示范样本,从而完全在 SL 框架内学习。 Schmidhuber(arXiv:1912.02875)给出了理论框架,Srivastava et al.(arXiv:1912.02877) 则提供了可落地的算法与实验验证。Most existing work that brings SL into RL (target networks, RUDDER and the like) only uses SL to assist RL rather than to replace it. UDRL goes further: past trajectories are relabeled in hindsight and treated as demonstrations of an agent successfully following commands, so that learning happens entirely inside the SL framework. Schmidhuber (arXiv:1912.02875) supplies the theoretical framework, while Srivastava et al. (arXiv:1912.02877) contribute a practical algorithm and experimental validation.

02 方法Method

UDRL 的核心是行为函数(behavior function)B:在给定当前状态 s 和命令 c = (dr, dh) 的情况下,输出动作概率分布。 这里 dr 是期望回报(desired return),dh 是期望步长(desired horizon)。 整个学习过程无需预测值函数,无需策略梯度,用 SL 在历史轨迹上直接优化 B。The core of UDRL is the behavior function B: given the current state s and a command c = (dr, dh), it outputs a probability distribution over actions. Here dr is the desired return and dh is the desired horizon. The whole learning process needs no value-function prediction and no policy gradient; B is optimized directly by SL on past trajectories.

行为函数(Behavior Function)Behavior Function

形式上,给定状态 s、期望回报 dr、期望步长 dh,行为函数定义为:Formally, given a state s, a desired return dr and a desired horizon dh, the behavior function is defined as:

B(a, s, dr, dh) = P(A = a | Rdh = dr, S = s; π)

即:在状态 s 下,若希望未来 dh 步内获得总回报 dr,应选哪个动作? 训练时,从 replay buffer 中随机采样片段 [t1, t2], 以 (st1, dr=∑r, dh=t2−t1) 为输入, at1 为目标,用交叉熵损失做监督训练——这正是「事后标注」的精髓。That is: in state s, if one wants a total return of dr over the next dh steps, which action should be taken? At training time a segment [t1, t2] is sampled at random from the replay buffer; (st1, dr=∑r, dh=t2−t1) is the input and at1 the target, trained with a cross-entropy loss — this is the essence of hindsight relabeling.

实践中,神经网络直接拼接命令与状态容易导致学习不稳定; 论文发现采用fast weights(gating 或 bilinear 形式)在第一层融合命令输入, 可显著提升可靠性——这使得网络在任何状态下都必须依赖命令输入来决定动作。In practice, simply concatenating command and state in the network easily makes learning unstable; the paper finds that fusing the command input in the first layer with fast weights (a gating or bilinear form) markedly improves reliability — this forces the network to rely on the command input to decide the action in any state.

高层算法流程High-Level Algorithm

架构细节Architecture Details

所有实验使用全连接前馈网络(TakeCover-v0 使用卷积网络)。 离散动作环境(LunarLander-v2、TakeCover-v0)与基线 DQN、A2C 对比; 连续动作环境(Swimmer-v2、InvertedDoublePendulum-v2)与 TRPO、PPO、DDPG 对比。 所有智能体均训练 10M 步(LunarLander/TakeCover)或 5M 步(MuJoCo), 分别使用独立的训练和评估随机种子。All experiments use fully connected feed-forward networks (TakeCover-v0 uses a convolutional network). The discrete-action environments (LunarLander-v2, TakeCover-v0) are compared against the DQN and A2C baselines; the continuous-action environments (Swimmer-v2, InvertedDoublePendulum-v2) against TRPO, PPO and DDPG. All agents are trained for 10M steps (LunarLander/TakeCover) or 5M steps (MuJoCo), using separate random seeds for training and for evaluation.

03 实验Experiments

四个经典基准任务,涵盖离散和连续动作空间、低维和高维(视觉)观测。 每个任务均进行超参数搜索,并以 20 次独立实验 + 1000 bootstrap 样本的 95% 置信区间进行汇报。Four classic benchmark tasks, covering discrete and continuous action spaces and both low-dimensional and high-dimensional (visual) observations. Every task goes through a hyperparameter search, and results are reported as 95% confidence intervals over 20 independent runs with 1000 bootstrap samples.

任务Task动作类型Action type主要对比算法Main baselinesUDRL 表现UDRL performance
LunarLander-v2离散DiscreteDQN, A2C 与 DQN 相近,均超过 200(solved);A2C 样本效率更高Close to DQN, both above 200 (solved); A2C is more sample-efficient
TakeCover-v0离散(视觉)Discrete (visual)A2C, DQN 明显优于 A2C 和 DQN;基线波动大,UDRL 更稳定Clearly better than A2C and DQN; the baselines fluctuate strongly while UDRL is more stable
Swimmer-v2连续ContinuousTRPO, PPO, DDPG 优于 TRPO 和 PPO;与 DDPG 相当,但 DDPG 更不稳定Better than TRPO and PPO; on par with DDPG, though DDPG is less stable
InvertedDoublePendulum-v2连续ContinuousTRPO, PPO, DDPG 比其他算法慢得多才达到最大回报(≈9300);部分 run 未能在步数限内收敛Reaches the maximum return (≈9300) far more slowly than the other algorithms; some runs fail to converge within the step budget
LunarLander-v2 results
LunarLander-v2 训练曲线(左上)与 TakeCover-v0(右上)。 实线为 20 次运行的均值,阴影为 95% 置信区间(1000 bootstrap 样本)。 UDRL 在 TakeCover-v0 上表现尤为突出,而传统算法评分波动明显。 (来源:论文 Figure 3,arXiv:1912.02877)LunarLander-v2 training curves (top left) and TakeCover-v0 (top right). Solid lines are the mean over 20 runs, shaded areas the 95% confidence interval (1000 bootstrap samples). UDRL is particularly strong on TakeCover-v0, whereas the traditional algorithms show markedly fluctuating scores. (Source: paper Figure 3, arXiv:1912.02877)

稀疏延迟奖励实验(Sparse Delayed Reward)Sparse Delayed Reward Experiments

将所有环境奖励延迟至 episode 最后一步才发放(中间步骤奖励为 0), 测试各算法对极端信用分配(credit assignment)的鲁棒性。All environment rewards are delayed until the final step of the episode (intermediate steps receive reward 0), testing how robust each algorithm is to extreme credit assignment.

结果:DQN(包括 LSTM 版本)、A2C(50/100-step returns)等基线均不稳定、极慢或完全失败。 唯一表现尚可的基线是 A2C with 20-step returns(但对超参数非常敏感)。 UDRL 则「未作任何修改,保留了大部分密集奖励下的性能」——因为它天然地跨长时间步分配信用, 无需时序差分(temporal difference)。Result: the baselines — DQN (including the LSTM variant) and A2C (50/100-step returns) — are unstable, extremely slow, or fail outright. The only baseline that does reasonably well is A2C with 20-step returns (but it is very sensitive to hyperparameters). UDRL, in contrast, retained most of its dense-reward performance without any modification, because it naturally assigns credit across long time spans and needs no temporal difference.

Sparse reward results
稀疏奖励版本(LunarLanderSparse-v2 左、SwimmerSparse-v2 中)。 传统算法普遍失效,而 UDRL 表现接近密集奖励设置——展示了其对长时间步信用分配的固有优势。 (来源:论文 Figure 4,arXiv:1912.02877)The sparse-reward versions (LunarLanderSparse-v2 left, SwimmerSparse-v2 middle). Traditional algorithms generally fail, while UDRL performs close to the dense-reward setting — showing its inherent advantage for credit assignment across long time spans. (Source: paper Figure 4, arXiv:1912.02877)

命令跟随能力(Different Returns with a Single Agent)Command-Following Ability (Different Returns with a Single Agent)

训练结束后,对同一 LunarLander-v2 智能体设置不同的 dr0(期望回报), 统计实际获得的平均 episode 回报(100 episodes)。 结果显示 desired vs. obtained return 相关系数 R ≈ 0.98, 说明智能体确实记住了如何按命令执行,而非退化为单一最大回报策略。After training, the same LunarLander-v2 agent is given different values of dr0 (the desired return) and the average episode return actually obtained is measured over 100 episodes. The result is a correlation coefficient of R ≈ 0.98 between desired and obtained return, showing that the agent really did learn how to act on command instead of degenerating into a single maximum-return policy.

Desired vs obtained return
期望回报 vs. 实际获得回报(LunarLander-v2)。 训练后智能体可按命令动态调整行为,desired 与 obtained 回报高度相关(R ≈ 0.98)。 这证明 UDRL 学到的是通用命令跟随能力,而非单一最优策略。 (来源:论文 Figure 4 右图,arXiv:1912.02877)Desired return vs. obtained return (LunarLander-v2). After training the agent can adjust its behavior dynamically according to the command, and desired and obtained returns are highly correlated (R ≈ 0.98). This proves that what UDRL learns is a general command-following ability, not a single optimal policy. (Source: paper Figure 4, right, arXiv:1912.02877)

04 局限性Limitations

说明:Note: 以下局限性大部分由论文作者在 Discussion 节(Section 6)中明确陈述; 少数条目标注为「推断」(inferred)。Most of the limitations below are explicitly stated by the authors in the Discussion (Section 6); a few entries are marked as inferred.
随机环境中无最优性保证(已陈述)No optimality guarantee in stochastic environments (stated)

UDRL 依赖「事后回顾」(hindsight)生成训练数据:将已实现的轨迹视为成功跟随命令的示范。 但在随机环境中,这些轨迹并非「最优」——它们只提供「能达成某命令」的示例,无法保证命令的最大期望回报。 论文原文:「UDRL relies on retrospectively generating training data based on achieved commands, but it is important to remember this scheme does not yield optimal trajectories for the fulfilled commands in stochastic environments.」UDRL relies on hindsight to generate training data: a realized trajectory is treated as a demonstration of successfully following a command. In stochastic environments, however, such trajectories are not optimal — they only give an example of achieving some command and cannot guarantee the maximum expected return for it. From the paper: "UDRL relies on retrospectively generating training data based on achieved commands, but it is important to remember this scheme does not yield optimal trajectories for the fulfilled commands in stochastic environments."

评估命令采样策略在高随机性环境下失效(已陈述)The evaluation-command sampling strategy fails in highly stochastic environments (stated)

论文的评估命令策略假设「观测到的回报/步长可以以高概率复现」。 对于任意随机性强的环境,这一假设不成立,需要额外建模命令可行性。 论文原文:「This can work well in many environments with low stochasticity, but in general additional algorithmic ingredients are needed to evaluate the feasibility of commands.」The evaluation-command strategy of the paper assumes that observed returns/horizons can be reproduced with high probability. For environments with arbitrary stochasticity this assumption does not hold, and the feasibility of commands has to be modeled explicitly. From the paper: "This can work well in many environments with low stochasticity, but in general additional algorithmic ingredients are needed to evaluate the feasibility of commands."

部分任务(InvertedDoublePendulum-v2)收敛明显更慢(已陈述)Markedly slower convergence on some tasks (InvertedDoublePendulum-v2) (stated)

在 InvertedDoublePendulum-v2 上,UDRL 达到最大回报(≈9300)的速度远慢于 TRPO/PPO/DDPG。 部分 run 在允许的步数内未能解决任务,有一次 run 在训练初期就停滞不前。 这说明当前 UDRL 算法在某些任务上样本效率仍有明显差距。On InvertedDoublePendulum-v2, UDRL reaches the maximum return (≈9300) far more slowly than TRPO/PPO/DDPG. Some runs fail to solve the task within the permitted number of steps, and one run stalled early in training. This shows that the current UDRL algorithm still has a clear sample-efficiency gap on certain tasks.

架构设计对命令融合至关重要(已陈述)Architecture design is critical for fusing the command (stated)

实验发现直接将命令与状态拼接输入网络非常难以训练。 必须使用 fast weights(gating 或 bilinear)才能让网络真正依赖命令输入。 论文原文:「it is crucial that the model class for the behavior function is chosen such that in any state, the appropriate action to take depends strongly on the command input.」Experiments found that feeding the command and the state into the network by plain concatenation is very hard to train. Fast weights (gating or bilinear) are required before the network genuinely depends on the command input. From the paper: "it is crucial that the model class for the behavior function is chosen such that in any state, the appropriate action to take depends strongly on the command input."

理论性质尚未建立(已陈述)Theoretical properties not yet established (stated)

论文明确承认 UDRL 目前没有类似传统 RL(如策略梯度、值迭代)的收敛性或最优性理论保证。 「UDRL does not have similar useful theoretical properties yet.」 在任意随机 MDP 中分析其性能是一个开放问题。The paper explicitly concedes that UDRL currently has no convergence or optimality guarantees comparable to those of traditional RL (policy gradients, value iteration). "UDRL does not have similar useful theoretical properties yet." Analyzing its performance in arbitrary stochastic MDPs is an open problem.

探索策略简单,可能在高维动作空间失效(推断)Simple exploration strategy that may fail in high-dimensional action spaces (inferred)

当前探索仅靠从 replay buffer 中最佳轨迹的回报分布采样命令,依赖环境自身随机性来发现新行为。 论文承认这在「动作维度多、随机性不足」的环境中可能不够。 (此条为从设计推断,论文在 Further Research Directions 节中有所涉及。)Exploration currently rests only on sampling commands from the return distribution of the best trajectories in the replay buffer, relying on the environment's own stochasticity to discover new behavior. The paper concedes that this may be insufficient in environments with many action dimensions and too little stochasticity. (This entry is inferred from the design; the paper touches on it in the Further Research Directions section.)