Offline Reinforcement Learning with Implicit Q-Learning
RLQ-LearningICLR 2022CCF-A加州大学伯克利分校Kostrikov I, Nair A, Levine S. Offline Reinforcement Learning with Implicit Q-Learning. ICLR, 2022.
基于隐式 Q 学习的离线强化学习
Abstract
Offline reinforcement learning requires reconciling two conflicting aims: learning a policy that improves over the behavior policy that collected the dataset, while at the same time minimizing the deviation from the behavior policy so as to avoid errors due to distributional shift. This trade-off is critical, because most current offline reinforcement learning methods need to query the value of unseen actions during training to improve the policy, and therefore need to either constrain these actions to be in-distribution, or else regularize their values. We propose a new offline RL method that never needs to evaluate actions outside of the dataset, but still enables the learned policy to improve substantially over the best behavior in the data through generalization.
离线强化学习需要协调两个相互冲突的目标:学习一个优于收集数据集的行为策略的策略,同时尽量减小其与行为策略的偏差,以避免分布偏移造成的误差。 这种权衡至关重要,因为当前大多数离线强化学习方法都需要在训练期间查询未见动作的价值以改进策略,因此必须约束这些动作处于分布内,或者对其价值进行正则化。 我们提出一种新的离线强化学习方法,它从不需要评估数据集之外的动作,却仍能通过泛化使学习到的策略显著优于数据中的最佳行为。
The main insight in our work is that, instead of evaluating unseen actions from the latest policy, we can approximate the policy improvement step implicitly by treating the state value function as a random variable, with randomness determined by the action (while still integrating over the dynamics to avoid excessive optimism), and then taking a state conditional upper expectile of this random variable to estimate the value of the best actions in that state. This leverages the generalization capacity of the function approximator to estimate the value of the best available action at a given state without ever directly querying a Q-function with this unseen action.
我们的主要见解是,不再评估最新策略产生的未见动作,而是将状态价值函数视为一个随机变量,其随机性由动作决定,同时仍对环境动态进行积分以避免过度乐观;随后取该随机变量的状态条件上侧期望分位数,以估计该状态下最佳动作的价值,从而隐式逼近策略改进步骤。 这利用了函数逼近器的泛化能力,可以估计给定状态下最佳可用动作的价值,而无需使用这个未见动作直接查询 Q 函数。
Our algorithm alternates between fitting this upper expectile value function and backing it up into a Q-function, without any explicit policy. Then, we extract the policy via advantage-weighted behavioral cloning, which also avoids querying out-of-sample actions. We dub our method implicit Q-learning (IQL). IQL is easy to implement, computationally efficient, and only requires fitting an additional critic with an asymmetric L2 loss. IQL demonstrates the state-of-the-art performance on D4RL, a standard benchmark for offline reinforcement learning. We also demonstrate that IQL achieves strong performance fine-tuning using online interaction after offline initialization.
我们的算法在拟合这种上侧期望分位价值函数与将其回传到 Q 函数之间交替进行,不需要任何显式策略。 随后,我们通过优势加权行为克隆提取策略,这同样避免查询样本外动作。 我们将该方法称为隐式 Q 学习(implicit Q-learning,IQL)。 IQL 易于实现、计算高效,并且只需额外拟合一个采用非对称 L2 损失的评论器。 IQL 在离线强化学习的标准基准 D4RL 上取得了最先进的性能。 我们还表明,IQL 在离线初始化后利用在线交互进行微调时也能取得强劲表现。
1. Introduction
Offline reinforcement learning (RL) addresses the problem of learning effective policies entirely from previously collected data, without online interaction. This is very appealing in a range of real-world domains, from robotics to logistics and operations research, where real-world exploration with untrained policies is costly or dangerous, but prior data is available. However, this also carries with it major challenges: improving the policy beyond the level of the behavior policy that collected the data requires estimating values for actions other than those that were seen in the dataset, and this, in turn, requires trading off policy improvement against distributional shift, since the values of actions that are too different from those in the data are unlikely to be estimated accurately.
离线强化学习(RL)研究完全依靠先前收集的数据、而不进行在线交互来学习有效策略的问题。 这对机器人、物流和运筹学等众多现实领域很有吸引力,因为使用未经训练的策略在现实世界中探索成本高昂或十分危险,而已有数据可供使用。 然而,这也带来了重大挑战:要将策略改进到超过收集数据的行为策略,就需要估计数据集中未见动作的价值;这又要求在策略改进与分布偏移之间进行权衡,因为与数据中的动作差异过大的动作,其价值不太可能得到准确估计。
Prior methods generally address this by either constraining the policy to limit how far it deviates from the behavior policy, or by regularizing the learned value functions to assign low values to out-of-distribution actions. Nevertheless, this imposes a trade-off between how much the policy improves and how vulnerable it is to misestimation due to distributional shift. Can we devise an offline RL method that avoids this issue by never needing to directly query or estimate values for actions that were not seen in the data?
以往方法通常通过约束策略以限制其偏离行为策略的程度,或者对学习到的价值函数进行正则化、使其为分布外动作赋予较低价值来解决这一问题。 然而,这会在策略改进幅度与其受分布偏移所致误估影响的程度之间形成权衡。 我们能否设计一种离线强化学习方法,使其永远不需要直接查询或估计数据中未见动作的价值,从而避免这一问题?
In this work, we start from an observation that in-distribution constraints widely used in prior work might not be sufficient to avoid value function extrapolation, and we ask whether it is possible to learn an optimal policy with in-sample learning, without ever querying the values of any unseen actions. The key idea in our method is to approximate an upper expectile of the distribution over values with respect to the distribution of dataset actions for each state. We alternate between fitting this value function with expectile regression, and then using it to compute Bellman backups for training the
在本文中,我们首先观察到,以往工作广泛使用的分布内约束可能不足以避免价值函数外推,并进一步探究能否通过样本内学习来学习最优策略,而永远不查询任何未见动作的价值。 我们方法的关键思想是,对每个状态,依据数据集动作分布来逼近价值分布的一个上侧期望分位数。 我们交替使用期望分位回归拟合这个价值函数,再利用它计算用于训练
Once this
当这个
Our main contribution is implicit Q-learning (IQL), a new offline RL algorithm that avoids ever querying values of unseen actions while still being able to perform multi-step dynamic programming updates. Our method is easy to implement by making a small change to the loss function in a simple SARSA-like TD update and is computationally very efficient. Furthermore, our approach demonstrates the state-of-the-art performance on D4RL, a popular benchmark for offline reinforcement learning. In particular, our approach significantly improves over the prior state-of-the-art on challenging Ant Maze tasks that require to “stitch” several sub-optimal trajectories. Finally, we demonstrate that our approach is suitable for finetuning; after initialization from offline RL, IQL is capable of improving policy performance utilizing additional interactions.
我们的主要贡献是隐式 Q 学习(IQL),这是一种新的离线强化学习算法;它从不查询未见动作的价值,同时仍能执行多步动态规划更新。 我们的方法只需对一个简单的类 SARSA 时序差分更新中的损失函数做很小改动,易于实现且计算效率很高。 此外,我们的方法在流行的离线强化学习基准 D4RL 上取得了最先进的性能。 特别是在需要“拼接”多条次优轨迹的高难度 Ant Maze 任务上,我们的方法显著超过此前最先进的方法。 最后,我们证明了该方法适合微调;经过离线强化学习初始化后,IQL 能够利用额外交互进一步提升策略性能。
2. Related Work
A significant portion of recently proposed offline RL methods are based on either constrained or regularized approximate dynamic programming (e.g., Q-learning or actor-critic methods), with the constraint or regularizer serving to limit deviation from the behavior policy. We will refer to these methods as “multi-step dynamic programming” algorithms, since they perform true dynamic programming for multiple iterations, and therefore can in principle recover the optimal policy if provided with high-coverage data. The constraints can be implemented via an explicit density model, implicit divergence constraints, or by adding a supervised learning term to the policy improvement objective. Several works have also proposed to directly regularize the Q-function to produce low values for out-of-distribution actions.
近期提出的离线强化学习方法中,有很大一部分基于受约束或正则化的近似动态规划,例如 Q 学习或演员-评论器方法,其中约束或正则项用于限制策略偏离行为策略的程度。 我们将这些方法称为“多步动态规划”算法,因为它们经过多次迭代执行真正的动态规划,因此在获得高覆盖率数据时原则上能够恢复最优策略。 这些约束可以通过显式密度模型、隐式散度约束实现,也可以通过在策略改进目标中加入监督学习项来实现。 还有一些工作提出直接正则化 Q 函数,使其为分布外动作产生较低价值。
Our method is also a multi-step dynamic programming algorithm. However, in contrast to prior works, our method completely avoids directly querying the learned Q-function with unseen actions during training, removing the need for any constraint during this stage, though the subsequent policy extraction, which is based on advantage-weighted regression, does apply an implicit constraint. However, this policy does not actually influence value function training.
我们的方法同样是一种多步动态规划算法。 但与以往工作不同,我们的方法在训练期间完全避免使用未见动作直接查询学习到的 Q 函数,从而不需要在该阶段施加任何约束;不过,后续基于优势加权回归的策略提取确实会施加隐式约束。 然而,这个策略实际上并不影响价值函数训练。
In contrast to multi-step dynamic programming methods, several recent works have proposed methods that rely either on a single step of policy iteration, fitting the value function or Q-function of the behavior policy and then extracting the corresponding greedy policy, or else avoid value functions completely and utilize behavioral cloning-style objectives. We collectively refer to these as “single-step” approaches. These methods avoid needing to query unseen actions as well, since they either use no value function at all, or learn the value function of the behavior policy. Although these methods are simple to implement and effective on the MuJoCo locomotion tasks in D4RL, we show that such single-step methods perform very poorly on more complex datasets in D4RL, which require combining parts of suboptimal trajectories (“stitching”).
与多步动态规划方法不同,近期一些工作提出的方法要么仅依赖一步策略迭代,即拟合行为策略的价值函数或 Q 函数,再提取相应的贪心策略;要么完全避开价值函数,采用行为克隆风格的目标。 我们将它们统称为“单步”方法。 这些方法同样无需查询未见动作,因为它们或者完全不使用价值函数,或者学习行为策略的价值函数。 尽管这些方法易于实现,并且在 D4RL 的 MuJoCo 运动任务上有效,但我们表明,这类单步方法在更复杂的 D4RL 数据集上表现很差,因为这些数据集需要组合次优轨迹的不同片段,即进行“拼接”。
Prior multi-step dynamic programming methods perform much better in such settings, as does our method. We discuss this distinction in more detail in Section 5.1. Our method also shares the simplicity and computational efficiency of single-step approaches, providing an appealing combination of the strengths of both types of methods.
以往的多步动态规划方法在这类环境中表现好得多,我们的方法亦是如此。 我们在第 5.1 节中更详细地讨论这一区别。 我们的方法还具备单步方法的简洁性与计算效率,将两类方法的优势有吸引力地结合起来。
Our method is based on estimating the characteristics of a random variable. Several recent works involve approximating statistical quantities of the value function distribution. In particular, quantile regression has been previously used in reinforcement learning to estimate the quantile function of a state-action value function. Although our method is related, in that we perform expectile regression, our aim is not to estimate the distribution of values that results from stochastic transitions, but rather estimate expectiles of the state value function with respect to random actions.
我们的方法以估计随机变量的特征为基础。 近期有多项工作涉及逼近价值函数分布的统计量。 特别是,分位数回归此前已用于强化学习,以估计状态-动作价值函数的分位数函数。 虽然我们的方法与之相关,因为我们采用期望分位回归,但我们的目标并非估计随机转移所产生的价值分布,而是估计状态价值函数相对于随机动作的期望分位数。
This is a very different statistic: our aim is not to determine how the
这是一个非常不同的统计量:我们的目标不是确定
3. Preliminaries
The RL problem is formulated in the context of a Markov decision process (MDP)
强化学习问题在马尔可夫决策过程(MDP)
Off-policy RL methods based on approximate dynamic programming typically utilize a state-action value function (
基于近似动态规划的离策略强化学习方法通常使用状态-动作价值函数(
Offline reinforcement learning. In contrast to online (on-policy or off-policy) RL methods, offline RL uses previously collected data without any additional data collection. Like many recent offline RL methods, our work builds on approximate dynamic programming methods that minimize temporal difference error, according to the following loss:
离线强化学习。 与在线的同策略或离策略强化学习方法不同,离线强化学习使用先前收集的数据,而不进行任何额外的数据收集。 与近期许多离线强化学习方法一样,我们的工作建立在最小化时序差分误差的近似动态规划方法之上,其损失如下:
where
其中,
4. Implicit Q-Learning
In this work, we aim to entirely avoid querying out-of-sample (unseen) actions in our TD loss. We start by considering fitted
在本文中,我们旨在完全避免在时序差分损失中查询样本外的未见动作。 我们首先考虑采用 SARSA 风格目标的拟合
This objective never queries values for out-of-sample actions, in contrast to Equation (1). One specific property of this objective that is important for this work is that it uses mean squared error (MSE) that fits
与公式(1)不同,该目标从不查询样本外动作的价值。 这个目标有一个对本文很重要的特性:它使用均方误差(MSE)拟合
Prior work has proposed directly using this objective to learn
既有工作提出直接使用该目标学习
Our method will perform a
我们的方法将执行类似公式(2)的
Our algorithm, implicit Q-Learning (IQL), aims to estimate this objective while evaluating the
4.1 Expectile Regression
Practical methods for estimating various statistics of a random variable have been thoroughly studies in applied statistics and econometrics. The
用于估计随机变量各种统计量的实用方法,已在应用统计学和计量经济学中得到深入研究。 随机变量
That is, for
也就是说,当



We can also use this formulation to predict expectiles of a conditional distribution:
我们也可以使用这一形式来预测条件分布的期望分位数:
Figure 1 (right) illustrates conditional expectile regression on a simple two-dimensional distribution. Note that we can optimize this objective with stochastic gradient descent. It provides unbiased gradients and is easy to implement with standard machine learning libraries.
图1右侧展示了一个简单二维分布上的条件期望分位回归。 请注意,我们可以使用随机梯度下降优化该目标。 它提供无偏梯度,并且易于使用标准机器学习库实现。
4.2 Learning the Value Function with Expectile Regression
Expectile regression provides us with a powerful framework to estimate statistics of a random variable beyond mean regression. We can use expectile regression to modify the policy evaluation objective in Equation (2) to predict an upper expectile of the TD targets that approximates the maximum of
期望分位回归为我们提供了一个强大的框架,可以估计均值回归之外的随机变量统计量。 我们可以使用期望分位回归修改公式(2)中的策略评估目标,以预测时序差分目标的上侧期望分位数,从而逼近公式(4)中受限于数据集动作的
However, this formulation has a significant drawback. Instead of estimating expectiles just with respect to the actions in the support of the data, it also incorporates stochasticity that comes from the environment dynamics
然而,这种形式存在一个显著缺点。 它不仅相对于数据支撑集中的动作估计期望分位数,还纳入了来自环境动态
We resolve this by introducing a separate value function that approximates an expectile only with respect to the action distribution, leading to the following loss:
我们通过引入一个单独的价值函数来解决这一问题,该函数只相对于动作分布逼近期望分位数,从而得到以下损失:
We can then use this estimate to update the
随后,我们可以使用这一估计,通过均方误差损失更新
Note that these losses do not use any explicit policy, and only utilize actions from the dataset for both objectives, similarly to SARSA-style policy evaluation. In Section 4.4, we will show that this procedure recovers the optimal Q-function under some assumptions.
请注意,这些损失不使用任何显式策略,并且两个目标都只使用数据集中的动作,与 SARSA 风格的策略评估类似。 我们将在第 4.4 节中表明,在一些假设下,该过程能够恢复最优 Q 函数。
4.3 Policy Extraction and Algorithm Summary
Algorithm 1: Implicit Q-learning
- Initialize parameters
, , , . - TD learning (IQL):
- for each gradient step do
-
-
-
- end for
- Policy extraction (AWR):
- for each gradient step do
-
- end for
While our modified TD learning procedure learns an approximation to the optimal Q-function, it does not explicitly represent the corresponding policy, and therefore requires a separate policy extraction step. In the spirit of preserving simplicity and efficiency, we aim for a simple method for policy extraction. As before, we aim to avoid using out-of-samples actions. Therefore, we extract the policy using advantage weighted regression:
虽然修改后的时序差分学习过程会学习最优 Q 函数的近似,但它没有显式表示相应策略,因此需要单独的策略提取步骤。 为了保持简洁与高效,我们希望采用一种简单的策略提取方法。 与前文一样,我们旨在避免使用样本外动作。 因此,我们使用优势加权回归提取策略:
where
其中,
Our final algorithm consists of two stages. First, we fit the value function and
我们的最终算法包含两个阶段。 首先,我们拟合价值函数和
We summarize our final method in Algorithm 1. Note that the policy does not influence the value function in any way, and therefore extraction could be performed either concurrently or after TD learning. Concurrent learning provides a way to use IQL with online finetuning, as we discuss in Section 5.3.
我们在算法1中总结了最终方法。 请注意,策略不会以任何方式影响价值函数,因此既可以并行执行策略提取,也可以在时序差分学习之后执行。 正如我们在第 5.3 节中所讨论的,并行学习提供了一种将 IQL 用于在线微调的方法。
4.4 Analysis
In this section, we will show that IQL can recover the optimal value function under the dataset support constraints. First, we prove a simple lemma that we will then use to show how our approach can enable learning the optimal value function.
在本节中,我们将表明,IQL 能够在数据集支撑集约束下恢复最优价值函数。 首先,我们证明一个简单引理,随后用它说明我们的方法如何实现最优价值函数学习。
Lemma 1. Let
引理 1。 设
One can show that expectiles of a random variable have the same supremum
可以证明,随机变量的期望分位数具有相同的上确界
In the following theorems, we show that under certain assumptions, our method indeed approximates the optimal state-action value
在下面的定理中,我们表明,在特定假设下,我们的方法确实能够逼近最优状态-动作价值
For the sake of simplicity, we introduce the following notation for our analysis. Let
为简化分析,我们引入以下记号。 令
Lemma 2. For all
引理 2。 对任意
The proof follows the policy improvement proof. See the appendix.
该证明沿用策略改进证明。 详见附录。
Corollary. For any
推论。 对任意
where
其中
The proof follows from the observation that convex combination is smaller than maximum.
该证明来自凸组合小于最大值这一观察。
Theorem.
定理。
Follows from combining Lemma 1 and the corollary. Therefore, for a larger value of
该结论由引理 1 与上述推论结合得到。 因此,当
Due to the property discussed in the theorem we dub our method implicit Q-learning (IQL). We also emphasize that our value learning method defines the entire spectrum of methods between SARSA (
由于定理中讨论的性质,我们将该方法称为隐式 Q 学习(IQL)。 我们还要强调,我们的价值学习方法定义了介于 SARSA(
5. Experimental Evaluation
Our experiments aim to evaluate our method comparatively, in contrast to prior offline RL methods, and in particular to understand how our approach compares both to single-step methods and multi-step dynamic programming approaches. We will first demonstrate the benefits of multi-step dynamic programming methods, such as ours, in contrast to single-step methods, showing that on some problems this difference can be extremely large. We will then compare IQL with state-of-the-art single-step and multi-step algorithms on the D4RL benchmark tasks, studying the degree to which we can learn effective policies using only the actions in the dataset.
我们的实验旨在将该方法与以往离线强化学习方法进行比较评估,特别是理解它与单步方法及多步动态规划方法的差异。 我们首先展示以我们的方法为代表的多步动态规划相较于单步方法的优势,并表明在一些问题上,这种差异可能极其巨大。 随后,我们在 D4RL 基准任务上将 IQL 与最先进的单步和多步算法进行比较,研究仅使用数据集中的动作能够学习到何种程度的有效策略。
We examine domains that contain near-optimal trajectories, where single-step methods perform well, as well as domains with no optimal trajectories at all, which require multi-step dynamic programming. Finally, we will study how IQL compares to prior methods when finetuning with online RL starting from an offline RL initialization.
我们既考察包含近似最优轨迹、因而单步方法表现良好的领域,也考察完全没有最优轨迹、必须使用多步动态规划的领域。 最后,我们研究从离线强化学习初始化出发、使用在线强化学习微调时,IQL 与以往方法的比较结果。
5.1 The Difference Between One-Step Policy Improvement and IQL
We first use a simple maze environment to illustrate the importance of multi-step dynamic programming for offline RL. The maze has a u-shape, a single start state, and a single goal state (see Figure 2). The agent receives a reward of 10 for entering the goal state and zero reward for all other transitions. With a probability of
我们首先使用一个简单的迷宫环境来说明多步动态规划对离线强化学习的重要性。 该迷宫呈 U 形,只有一个起始状态和一个目标状态(见图2)。 智能体进入目标状态时获得 10 的奖励,其他所有转移的奖励均为零。 智能体以
(a) toy maze MDP
(b) true optimal V*
(c) One-step Policy Eval.
(d) IQLFigure 2 (c, d) illustrates the difference between single-step methods, in this case represented by Onestep RL and IQL with
图2(c、d)展示了单步方法与
5.2 Comparisons on Offline RL Benchmarks
| Dataset | BC | 10% BC | DT | AWAC | Onestep RL | TD3+BC | CQL | IQL (Ours) |
|---|---|---|---|---|---|---|---|---|
| halfcheetah-medium-v2 | 42.6 | 42.5 | 42.6 | 43.5 | 48.4 | 48.3 | 44.0 | 47.4 |
| hopper-medium-v2 | 52.9 | 56.9 | 67.6 | 57.0 | 59.6 | 59.3 | 58.5 | 66.3 |
| walker2d-medium-v2 | 75.3 | 75.0 | 74.0 | 72.4 | 81.8 | 83.7 | 72.5 | 78.3 |
| halfcheetah-medium-replay-v2 | 36.6 | 40.6 | 36.6 | 40.5 | 38.1 | 44.6 | 45.5 | 44.2 |
| hopper-medium-replay-v2 | 18.1 | 75.9 | 82.7 | 37.2 | 97.5 | 60.9 | 95.0 | 94.7 |
| walker2d-medium-replay-v2 | 26.0 | 62.5 | 66.6 | 27.0 | 49.5 | 81.8 | 77.2 | 73.9 |
| halfcheetah-medium-expert-v2 | 55.2 | 92.9 | 86.8 | 42.8 | 93.4 | 90.7 | 91.6 | 86.7 |
| hopper-medium-expert-v2 | 52.5 | 110.9 | 107.6 | 55.8 | 103.3 | 98.0 | 105.4 | 91.5 |
| walker2d-medium-expert-v2 | 107.5 | 109.0 | 108.1 | 74.5 | 113.0 | 110.1 | 108.8 | 109.6 |
| locomotion-v2 total | 466.7 | 666.2 | 672.6 | 450.7 | 684.6 | 677.4 | 698.5 | 692.4 |
| antmaze-umaze-v0 | 54.6 | 62.8 | 59.2 | 56.7 | 64.3 | 78.6 | 74.0 | 87.5 |
| antmaze-umaze-diverse-v0 | 45.6 | 50.2 | 53.0 | 49.3 | 60.7 | 71.4 | 84.0 | 62.2 |
| antmaze-medium-play-v0 | 0.0 | 5.4 | 0.0 | 0.0 | 0.3 | 10.6 | 61.2 | 71.2 |
| antmaze-medium-diverse-v0 | 0.0 | 9.8 | 0.0 | 0.7 | 0.0 | 3.0 | 53.7 | 70.0 |
| antmaze-large-play-v0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.2 | 15.8 | 39.6 |
| antmaze-large-diverse-v0 | 0.0 | 6.0 | 0.0 | 1.0 | 0.0 | 0.0 | 14.9 | 47.5 |
| antmaze-v0 total | 100.2 | 134.2 | 112.2 | 107.7 | 125.3 | 163.8 | 303.6 | 378.0 |
| total | 566.9 | 800.4 | 784.8 | 558.4 | 809.9 | 841.2 | 1002.1 | 1070.4 |
| kitchen-v0 total | 154.5 | – | – | – | – | – | 144.6 | 159.8 |
| adroit-v0 total | 104.5 | – | – | – | – | – | 93.6 | 118.1 |
| total+kitchen+adroit | 825.9 | – | – | – | – | – | 1240.3 | 1348.3 |
| runtime | 10m | 10m | 960m | 20m | ≈ 20m* | 20m | 80m | 20m |
* 单步方法与多步方法难以直接比较;Onestep RL 原文使用了与其他方法显著不同的批大小和网络规模。表中报告原始超参数结果,以及使用可比超参数时的运行时间。
Next, we evaluate our approach on the D4RL benchmark in comparison to prior methods (see Table 1). The MuJoCo tasks in D4RL consist of the Gym locomotion tasks, the Ant Maze tasks, and the Adroit and Kitchen robotic manipulation environments. Some prior works, particularly those proposing one-step methods, focus entirely on the Gym locomotion tasks. However, these tasks include a significant fraction of near-optimal trajectories in the dataset.
接下来,我们在 D4RL 基准上将该方法与以往方法进行比较(见表1)。 D4RL 中的 MuJoCo 任务包括 Gym 运动任务、Ant Maze 任务以及 Adroit 和 Kitchen 机器人操作环境。 一些以往工作,特别是提出单步方法的工作,完全聚焦于 Gym 运动任务。 然而,这些任务的数据集中包含相当比例的近似最优轨迹。
In contrast, the Ant Maze tasks, especially the medium and large ones, contain very few or no near-optimal trajectories, making them very challenging for one-step methods. These domains require “stitching” parts of suboptimal trajectories that travel between different states to find a path from the start to the goal of the maze. As we will show, multi-step dynamic programming is essential in these domains. The Adroit and Kitchen tasks are comparatively less discriminating, and we found that most RL methods perform similarly to imitation learning in these domains. We therefore focus our analysis on the Gym locomotion and Ant Maze domains, but include full Adroit and Kitchen results in the appendix for completeness.
相比之下,Ant Maze 任务,特别是中型和大型任务,只包含很少甚至完全不包含近似最优轨迹,因此对单步方法非常具有挑战性。 这些领域需要“拼接”在不同状态之间行进的次优轨迹片段,以找到从起点到迷宫目标的路径。 正如我们将要展示的,多步动态规划在这些领域中至关重要。 Adroit 和 Kitchen 任务的区分能力相对较弱,我们发现大多数强化学习方法在这些领域中的表现与模仿学习相近。 因此,我们的分析聚焦于 Gym 运动和 Ant Maze 领域,同时在附录中给出完整的 Adroit 与 Kitchen 结果。
Comparisons and baselines. We compare to methods that are representative of both multi-step dynamic programming and one-step approaches. In the former category, we compare to CQL, TD3+BC, and AWAC. In the latter category, we compare to Onestep RL and Decision Transformers. We obtained the Decision Transformers results on Ant Maze subsets of D4RL tasks using the author-provided implementation and following authors instructions communicated over email. We obtained results for TD3+BC and Onestep RL (Exp. Weight) directly from the authors.
比较方法与基线。 我们与能够代表多步动态规划和单步方法的算法进行比较。 在前一类中,我们比较 CQL、TD3+BC 和 AWAC。 在后一类中,我们比较 Onestep RL 和 Decision Transformers。 我们使用作者提供的实现,并遵循作者通过电子邮件传达的说明,获得 Decision Transformers 在 D4RL Ant Maze 子集上的结果。 TD3+BC 和 Onestep RL(Exp. Weight)的结果则直接由相应作者提供。
Note that Chen et al. and Brandfonbrener et al. incorrectly report results for some prior methods, such as CQL, using the “-v0” environments. These generally produce lower scores than the “-v2” environments that these papers use for their own methods. We use the “-v2” environments for all methods to ensure a fair comparison, resulting in higher values for CQL. Because of this fix, our reported CQL scores are higher than all other prior methods. We obtained results for “-v2” datasets using an author-suggested implementation.
请注意,Chen 等人与 Brandfonbrener 等人错误地使用“-v0”环境报告了 CQL 等一些以往方法的结果。 这些环境通常比两篇论文为自身方法使用的“-v2”环境产生更低的分数。 为确保公平比较,我们对所有方法统一使用“-v2”环境,因此 CQL 的数值更高。 由于这一修正,我们报告的 CQL 分数高于其他既有工作中的报告值。 我们使用作者建议的实现获得“-v2”数据集上的结果。
On the Gym locomotion tasks (halfcheetah, hopper, walker2d), we find that IQL performs comparably to the best performing prior method, CQL. On the more challenging Ant Maze task, IQL outperforms CQL, and outperforms the one-step methods by a very large margin.
在 Gym 运动任务 halfcheetah、hopper 和 walker2d 上,我们发现 IQL 的表现与最佳既有方法 CQL 相当。 在更具挑战性的 Ant Maze 任务上,IQL 超过 CQL,并以很大优势超过单步方法。
Runtime. Our approach is also computationally faster than the baselines (see Table 1). For the baselines, we measure runtime for our reimplementations of the methods in JAX built on top of JAXRL, which are typically faster than the original implementations. For example, the original implementation of CQL takes more than 4 hours to perform 1M updates, while ours takes only 80 minutes.
运行时间。 我们的方法在计算上也快于基线(见表1)。 对于基线,我们测量基于 JAXRL、使用 JAX 重新实现的方法的运行时间,这些实现通常快于原始实现。 例如,CQL 的原始实现完成 100 万次更新需要超过 4 小时,而我们的重新实现只需 80 分钟。
Even so, IQL still requires about 4x less time than our reimplementation of CQL on average, and is comparable to the fastest prior one-step methods. We did not reimplement Decision Transformers due to their complexity and report runtime of the original implementation.
即便如此,IQL 平均仍比我们重新实现的 CQL 少用约 4 倍时间,并且与以往最快的单步方法相当。 由于 Decision Transformers 较为复杂,我们没有重新实现它,而是报告其原始实现的运行时间。

Effect of
5.3 Online Fine-tuning after Offline RL
| Dataset | AWAC | CQL | IQL (Ours) |
|---|---|---|---|
| antmaze-umaze-v0 | 56.7 → 59.0 | 70.1 → 99.4 | 86.7 → 96.0 |
| antmaze-umaze-diverse-v0 | 49.3 → 49.0 | 31.1 → 99.4 | 75.0 → 84.0 |
| antmaze-medium-play-v0 | 0.0 → 0.0 | 23.0 → 0.0 | 72.0 → 95.0 |
| antmaze-medium-diverse-v0 | 0.7 → 0.3 | 23.0 → 32.3 | 68.3 → 92.0 |
| antmaze-large-play-v0 | 0.0 → 0.0 | 1.0 → 0.0 | 25.5 → 46.0 |
| antmaze-large-diverse-v0 | 1.0 → 0.0 | 1.0 → 0.0 | 42.6 → 60.7 |
| antmaze-v0 total | 107.7 → 108.3 | 151.5 → 231.1 | 370.1 → 473.7 |
| pen-binary-v0 | 44.6 → 70.3 | 31.2 → 9.9 | 37.4 → 60.7 |
| door-binary-v0 | 1.3 → 30.1 | 0.2 → 0.0 | 0.7 → 32.3 |
| relocate-binary-v0 | 0.8 → 2.7 | 0.1 → 0.0 | 0.0 → 31.0 |
| hand-v0 total | 46.7 → 103.1 | 31.5 → 9.9 | 38.1 → 124.0 |
| total | 154.4 → 211.4 | 182.8 → 241.0 | 408.2 → 597.7 |
The policies obtained by offline RL can often be improved with a small amount of online interaction. IQL is well-suited for online fine-tuning for two reasons. First, IQL has strong offline performance, as shown in the previous section, which provides a good initialization. Second, IQL implements a weighted behavioral cloning policy extraction step, which has previously been shown to allow for better online policy improvement compared to other types of offline constraints.
离线强化学习得到的策略通常可以通过少量在线交互得到改进。 IQL 非常适合在线微调,原因有二。 首先,如上一节所示,IQL 具有很强的离线性能,能够提供良好的初始化。 其次,IQL 实现了一个加权行为克隆策略提取步骤;既有研究表明,与其他类型的离线约束相比,这种方式能够实现更好的在线策略改进。
To evaluate the finetuning capability of various RL algorithms, we first run offline RL on each dataset, then run 1M steps of online RL, and then report the final performance. We compare to AWAC, which has been proposed specifically for online finetuning, and CQL, which showed the best performance among prior methods in our experiments in the previous section. Exact experimental details are provided in the appendix.
为了评估不同强化学习算法的微调能力,我们首先在每个数据集上运行离线强化学习,随后进行 100 万步在线强化学习,最后报告最终性能。 我们与专门为在线微调提出的 AWAC,以及在上一节实验中表现最佳的既有方法 CQL 进行比较。 准确的实验细节见附录。
We use the challenging Ant Maze D4RL domains, as well as the high-dimensional dexterous manipulation environments from Rajeswaran et al., which Nair et al. propose to use to study online adaptation with AWAC. Results are shown in Table 2. On the Ant Maze domains, IQL significantly outperforms both prior methods after online finetuning. CQL attains the second best score, while AWAC performs comparatively worse due to much weaker offline initialization.
我们使用高难度的 D4RL Ant Maze 领域,以及 Rajeswaran 等人提出的高维灵巧操作环境;Nair 等人建议使用后者来研究 AWAC 的在线适应。 结果见表2。 在 Ant Maze 领域,在线微调后的 IQL 显著超过两种既有方法。 CQL 取得第二高分,而 AWAC 由于离线初始化弱得多,表现相对较差。
On the dexterous hand tasks, IQL performs significantly better than AWAC on relocate-binary-v0, comparably on door-binary-v0, and slightly worse on pen-binary-v0, with the best overall score.
在灵巧手任务上,IQL 在 relocate-binary-v0 上显著优于 AWAC,在 door-binary-v0 上与其相当,在 pen-binary-v0 上略逊于它,但总体分数最高。
6. Conclusion
We presented implicit Q-Learning (IQL), a general algorithm for offline RL that completely avoids any queries to values of out-of-sample actions during training while still enabling multi-step dynamic programming. To our knowledge, this is the first method that combines both of these features. This has a number of important benefits. First, our algorithm is computationally efficient: we can perform 1M updates on one GTX1080 GPU in less than 20 minutes.
我们提出了隐式 Q 学习(IQL),这是一种通用的离线强化学习算法;它在训练期间完全避免查询样本外动作的价值,同时仍能执行多步动态规划。 据我们所知,这是首个同时结合这两项特性的方法。 这带来了多项重要优势。 首先,我们的算法计算高效:在一块 GTX1080 GPU 上,不到 20 分钟即可完成 100 万次更新。
Second, it is simple to implement, requiring only minor modifications over a standard SARSA-like TD algorithm, and performing policy extraction with a simple weighted behavioral cloning procedure resembling supervised learning. Finally, despite the simplicity and efficiency of this method, we show that it attains excellent performance across all of the tasks in the D4RL benchmark, matching the best prior methods on the MuJoCo locomotion tasks, and exceeding the state-of-the-art performance on the challenging ant maze environments, where multi-step dynamic programming is essential for good performance.
其次,它易于实现,只需对标准类 SARSA 时序差分算法做少量修改,并通过类似监督学习的简单加权行为克隆过程执行策略提取。 最后,尽管该方法简洁而高效,我们仍表明它在 D4RL 基准的所有任务上都取得了出色表现:在 MuJoCo 运动任务上追平最佳既有方法,并在必须依靠多步动态规划才能取得良好表现的高难度 Ant Maze 环境中超过此前最先进的性能。