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

Implicit Quantile Networks for Distributional Reinforcement Learning

IQN:用隐式量化网络实现分布强化学习的完整回报分布表示IQN: representing the full return distribution in distributional reinforcement learning with implicit quantile networks
Will Dabney · Georg Ostrovski · David Silver · Rémi Munos  |  DeepMind, London, UK

IQN 将 QR-DQN 的"固定 N 个分位点"推广为"连续量化函数":网络以状态、动作和随机采样的分位数水平 τ 为输入,输出对应的回报分位值,从而隐式地表示完整的回报分布。这一改变消除了分位点数量对近似误差的上限约束,并天然地支持基于 distortion risk measure 的风险敏感策略。IQN generalizes QR-DQN's fixed set of N quantile locations into a continuous quantile function: the network takes the state, the action and a randomly sampled quantile level τ as input and outputs the corresponding return quantile, thereby representing the full return distribution implicitly. This change removes the ceiling that the number of quantile locations imposes on the approximation error, and naturally supports risk-sensitive policies based on distortion risk measures.

ICML 2018 Atari-57 Benchmark DeepMind 📄 arXiv:1806.06923 PDF 全文Full PDF
distributional RL quantile regression implicit quantile network risk-sensitive policy distortion risk measure Atari benchmark 分布强化学习distributional reinforcement learning 分位数回归quantile regression

01 动机 MotivationMotivation

分布强化学习(Distributional RL)将关注点从标量值函数 Q(x,a) 转向完整的回报分布 Z(x,a),已被证明能显著提升数据效率、最终性能和稳定性。然而,现有算法在参数化方式上存在根本限制:Distributional RL shifts attention from the scalar value function Q(x,a) to the full return distribution Z(x,a), and has been shown to markedly improve data efficiency, final performance and stability. Existing algorithms, however, are fundamentally limited by the way they parameterize that distribution:

C51 的局限Limitations of C51

将回报分布参数化为固定区间上的 categorical 分布,要求预先知道回报的上下界,且固定离散点集牺牲了均值保持性。Parameterizes the return distribution as a categorical distribution over a fixed support, which requires the return bounds to be known in advance, and its fixed set of discrete atoms sacrifices mean preservation.

QR-DQN 的局限Limitations of QR-DQN

通过 quantile regression 将分布参数化为 N 个固定分位点处的 Dirac 混合。尽管无需指定回报范围,但近似误差的上限仍受 N 控制,且分位点为静态固定集合,无法表示完整连续分布。Uses quantile regression to parameterize the distribution as a mixture of Diracs at N fixed quantile locations. Although no return range needs to be specified, the bound on the approximation error is still governed by N, and the quantile locations form a static fixed set that cannot represent the full continuous distribution.

"In this paper, we extend the approach of [QR-DQN], from learning a discrete set of quantiles to learning the full quantile function, a continuous map from probabilities to returns."

IQN 的核心思路是用神经网络 隐式 地表示量化函数(quantile function):网络接受任意 τ ∈ [0,1] 作为输入并输出对应分位值,从而一举解决"固定分位点数量限制近似精度"和"无法支持任意风险偏好策略"两个问题。The core idea of IQN is to represent the quantile function implicitly with a neural network: the network accepts any τ ∈ [0,1] as input and outputs the corresponding quantile value, thereby resolving at once both the limit that a fixed number of quantile locations places on approximation accuracy and the inability to support policies with arbitrary risk preferences.

1019%IQN 在 Atari-57 人类归一化均值(no-op starts)IQN human-normalized mean on Atari-57 (no-op starts)
218%IQN 在 Atari-57 人类归一化中位数(no-op starts)IQN human-normalized median on Atari-57 (no-op starts)
162%IQN human-starts 中位数,优于 Rainbow 的 153%IQN human-starts median, above Rainbow's 153%
0.141IQN human-gap(所有算法中最低,含 Rainbow)IQN human-gap (lowest of all algorithms, Rainbow included)

02 方法 MethodMethod

IQN 将 DQN 的标量 Q 网络替换为一个接受 (状态 x, 动作 a, 分位数水平 τ) 三元输入的量化函数近似器,输出分位值 Z_τ(x,a)。结合任意基础分布(如 U([0,1]))即可在推断时对回报分布进行任意粒度的采样。IQN replaces DQN's scalar Q network with a quantile-function approximator that takes a triple (state x, action a, quantile level τ) as input and outputs the quantile value Z_τ(x,a). Combined with any base distribution (e.g. U([0,1])), the return distribution can be sampled at arbitrary granularity at inference time.

IQN 网络架构对比图
图1:DQN 及近期分布 RL 算法的网络架构对比。 左起:DQN(输出标量 Q 值)、C51(输出固定离散概率向量)、QR-DQN(输出 N 个固定分位点处的值)、IQN(输出以 τ 为条件的分位值,τ 在训练时随机采样)。IQN 只在 DQN 基础上增加了一个 τ embedding 分支,参数量增加极少。Figure 1: Network architectures of DQN and recent distributional RL algorithms. From left to right: DQN (outputs a scalar Q value), C51 (outputs a fixed discrete probability vector), QR-DQN (outputs values at N fixed quantile locations), IQN (outputs quantile values conditioned on τ, with τ sampled randomly during training). IQN only adds a τ embedding branch on top of DQN, at a very small increase in parameter count.

核心公式:隐式量化函数Core formulation: the implicit quantile function

设 Z_τ(x,a) := F⁻¹_{Z(x,a)}(τ) 为回报分布在分位数 τ 处的逆 CDF 值。IQN 通过以下网络结构近似该量化函数:Let Z_τ(x,a) := F⁻¹_{Z(x,a)}(τ) denote the inverse-CDF value of the return distribution at quantile τ. IQN approximates this quantile function with the following network structure:

Z_τ(x, a) ≈ f(ψ(x) ⊙ φ(τ))_a

其中:where:

作者最终采用的 τ 嵌入公式(embedding dimension n = 64)为:The τ embedding finally adopted by the authors (embedding dimension n = 64) is:

φ_j(τ) := ReLU(Σ_{i=0}^{n-1} cos(πiτ) · w_{ij} + b_j)

即对 τ 计算余弦基函数特征后经线性变换和 ReLU 激活。消融实验表明,多种架构变体(MLP embedding、concatenation、residual fusion 等)均能稳定超过 QR-DQN 基线,整体对超参数选择鲁棒。That is, cosine basis features of τ are computed and then passed through a linear transformation and a ReLU activation. Ablations show that a range of architectural variants (MLP embedding, concatenation, residual fusion and others) all consistently surpass the QR-DQN baseline, so the design is broadly robust to hyperparameter choice.

损失函数Loss function

训练时从 U([0,1]) 中分别采样 N 个 τ 和 N' 个 τ',对所有 N×N' 对 TD 误差计算 Huber quantile regression loss:During training, N samples τ and N' samples τ' are drawn independently from U([0,1]), and the Huber quantile regression loss is computed over all N×N' pairwise TD errors:

L(x_t, a_t, r_t, x_{t+1}) = (1/N') Σ_{i=1}^{N} Σ_{j=1}^{N'} ρ^κ_{τ_i}(δ_t^{τ_i, τ_j'})

其中 δ_t^{τ,τ'} = r_t + γ Z_{τ'}(x_{t+1}, π_β(x_{t+1})) − Z_τ(x_t, a_t) 为采样 TD 误差,ρ^κ_τ 为 Huber 分位数损失。Here δ_t^{τ,τ'} = r_t + γ Z_{τ'}(x_{t+1}, π_β(x_{t+1})) − Z_τ(x_t, a_t) is the sampled TD error and ρ^κ_τ is the Huber quantile loss.

风险敏感策略(Risk-Sensitive Policies)Risk-Sensitive Policies

IQN 的隐式分布表示天然支持 distortion risk measure:给定连续单调函数 β:[0,1]→[0,1](称为 distortion risk measure),只需将策略中 τ 的采样分布从 U([0,1]) 替换为 β 变换后的分布即可实现风险偏好调整:IQN's implicit distributional representation naturally supports distortion risk measures: given a continuous monotone function β:[0,1]→[0,1] (called a distortion risk measure), the risk preference can be adjusted simply by replacing the sampling distribution of τ in the policy, from U([0,1]) to its β-transformed counterpart:

π_β(x) = argmax_{a} E_{τ~U([0,1])} [Z_{β(τ)}(x, a)]

论文考察了四种 distortion risk measure:CPW(cumulative prospect theory 中的概率权重函数,η=0.71 最接近人类行为)、Wang、Pow 和 CVaR,涵盖风险厌恶和风险追求两类策略。The paper examines four distortion risk measures: CPW (the probability weighting function from cumulative prospect theory, with η=0.71 closest to human behaviour), Wang, Pow and CVaR, covering both risk-averse and risk-seeking policies.

样本数量 N 和 N' 对性能的影响
图2:N 和 N' 的消融实验(六款 Atari 游戏平均,人类归一化分数)。 左图为训练前 10M 帧,右图为训练最后 10M 帧(190M–200M)。基线参照:DQN (32, 253),QR-DQN (144, 1243)。N 对早期性能影响显著,N' 对长期性能影响在 N'≥8 后趋于平稳。即便 N=N'=1(损失项数量与 DQN 相当),长期性能仍约为 DQN 的 3 倍。Figure 2: Ablation over N and N' (averaged over six Atari games, human-normalized score). Left: the first 10M training frames; right: the last 10M training frames (190M–200M). Baseline references: DQN (32, 253), QR-DQN (144, 1243). N has a pronounced effect on early performance, while the effect of N' on long-run performance levels off beyond N'≥8. Even with N=N'=1 (a number of loss terms comparable to DQN), long-run performance is still about 3 times that of DQN.

03 实验 ExperimentsExperiments

主实验在 Atari-57 基准(ALE,57 款 Atari 2600 游戏)上进行,采用 30 no-op starts 和 human-starts 两种评估协议,报告人类归一化均值和中位数。IQN 均值平均 5 个随机种子。The main experiments are run on the Atari-57 benchmark (ALE, 57 Atari 2600 games) under both the 30 no-op starts and the human-starts evaluation protocols, reporting human-normalized mean and median. IQN results are averaged over 5 random seeds.

Atari-57 整体结果(no-op starts)Overall Atari-57 results (no-op starts)

算法Algorithm Mean (%) Median (%) Human-Gap Seeds
DQN228%79%0.3341
Prioritized DQN434%124%0.1781
C51701%178%0.1521
QR-DQN864%193%0.1653
Rainbow1189%230%0.1442
IQN(本文)IQN (ours)1019%218%0.1415

IQN 在均值和中位数上均大幅超过 QR-DQN,在 100M 帧处即达到 QR-DQN 200M 帧的性能水平。Rainbow 综合了 C51、prioritized replay、Double DQN、Dueling、Noisy Nets 和 n-step 等多项改进,IQN 在不引入任何额外技术的情况下,将 QR-DQN 与 Rainbow 之间差距缩小约一半。在 human-gap 指标(智能体在仍不如人类的游戏上平均差距)上,IQN 以 0.141 超过所有算法(含 Rainbow 的 0.144)。IQN surpasses QR-DQN by a wide margin in both mean and median, reaching at 100M frames the performance level QR-DQN attains at 200M frames. Rainbow combines C51, prioritized replay, Double DQN, Dueling, Noisy Nets, n-step returns and further improvements; without introducing any additional technique, IQN closes about half of the gap between QR-DQN and Rainbow. On the human-gap metric (the average shortfall on those games where the agent is still below human level), IQN beats every algorithm with 0.141, including the 0.144 of Rainbow.

Human-starts 中位数Human-starts median

DQNPrioritizedA3CC51RainbowIQN
68%128%116%125%153%162%

在 human-starts 协议下,IQN 中位数人类归一化分数为 162%,而 Rainbow 为 153%,IQN 在这一最难条件下(最接近真实人类起点)取得更好表现。Under the human-starts protocol the median human-normalized score of IQN is 162% against 153% for Rainbow, so IQN performs better under this hardest condition, the one closest to genuine human starting states.

Atari-57 训练曲线
图3:Atari-57 基准训练过程中的人类归一化均值(左)和中位数(右)。 IQN(5个随机种子)、QR-DQN(3个种子)、Rainbow(2个种子)。IQN 在约 100M 帧时即赶上 QR-DQN 的最终性能,全程大幅领先 QR-DQN,并接近仅略低于 Rainbow(后者叠加了多项正交改进)。Figure 3: Human-normalized mean (left) and median (right) over the course of training on the Atari-57 benchmark. IQN (5 random seeds), QR-DQN (3 seeds), Rainbow (2 seeds). IQN catches up with the final performance of QR-DQN at around 100M frames, leads QR-DQN by a wide margin throughout, and comes close to Rainbow, remaining only slightly below it (Rainbow stacks several orthogonal improvements).

风险敏感策略实验Risk-sensitive policy experiments

风险敏感策略实验结果
图4:不同 distortion risk measure 对六款 Atari 游戏的影响(左:各游戏得分;右:不同采样分布对应的隐式回报分布形状)。 风险厌恶策略(CVaR、Wang 负参数)在 Asterix 和 Assault 游戏中有显著收益;CPW(0.71) 整体接近风险中性;风险追求策略在多数游戏中表现更差。Figure 4: Effect of different distortion risk measures on six Atari games (left: per-game scores; right: the shape of the implicit return distribution induced by each sampling distribution). Risk-averse policies (CVaR, Wang with negative parameter) bring clear gains on Asterix and Assault; CPW(0.71) is close to risk-neutral overall; risk-seeking policies do worse on most games.

部分游戏逐项对比(精选)Per-game comparison (selected)

下表摘自原文 Table 3(30 no-op starts,单种子原始分数),IQN 与 QR-DQN 的典型差距:The table below is taken from Table 3 of the paper (30 no-op starts, single-seed raw scores) and shows the typical gap between IQN and QR-DQN:

GameDQNQR-DQNIQN
James Bond768.54,70335,108
Seaquest5,860.68,26830,140
Venture163.043.91,318
Assault4,280.422,01229,091
Q*Bert13,117.3572,51025,750
Asteroids1,364.54,2262,898

IQN 在绝大多数游戏上领先或持平 QR-DQN,少数游戏(如 Q*Bert、Asteroids)QR-DQN 更优——论文未隐藏这些不利数字,原文完整 57 游戏数据均已公开。IQN leads or matches QR-DQN on the vast majority of games, and QR-DQN is better on a few (such as Q*Bert and Asteroids); the paper does not hide these unfavourable numbers, and the complete 57-game results are published in the original text.

样本数量消融(N 和 N')Sample-count ablation (N and N')

对 N, N' ∈ {1, 8, 32, 64} 共 16 种配置在六款游戏上评估:N 对前期性能影响显著,持续增大可加速学习;N' 对长期性能影响在超过 8 后趋于饱和。论文建议:"N = N' = 8 appears to be sufficient to achieve the majority of improvements offered by IQN for long-term performance."All 16 configurations with N, N' ∈ {1, 8, 32, 64} were evaluated on six games: N has a pronounced effect on early performance and increasing it keeps accelerating learning, whereas the effect of N' on long-run performance saturates beyond 8. The paper recommends: “N = N' = 8 appears to be sufficient to achieve the majority of improvements offered by IQN for long-term performance.”

04 局限性 LimitationsLimitations

说明:论文在 Discussion & Conclusions 部分明确提出若干理论开放问题(标注为 作者明示);此外还有若干由设计本身推断出的实践局限(标注为 设计推断)。Note: in its Discussion & Conclusions section the paper explicitly raises a number of open theoretical questions (marked stated by the authors); beyond those, several practical limitations are inferred from the design itself (marked inferred from the design).
缺乏收敛理论保证(作者明示)No theoretical convergence guarantees (stated by the authors)

论文明确指出三个未解决的理论问题:(1)QR-DQN 的固定分位网格下已有收缩映射结果,能否推广到 IQN 的近似量化函数类?(2)分类分布算法已有基于样本的收敛证明,能否推广到基于分位回归的算法?(3)风险敏感策略下分布 Bellman 算子的收敛性能否建立?作者原文:"Despite the significant empirical successes in this paper there are many areas in need of additional theoretical analysis."The paper explicitly names three unresolved theoretical questions: (1) contraction-mapping results exist for the fixed quantile grid of QR-DQN, but can they be extended to the class of approximate quantile functions used by IQN? (2) sample-based convergence proofs exist for categorical distributional algorithms, but do they carry over to quantile-regression-based ones? (3) can convergence of the distributional Bellman operator be established under risk-sensitive policies? In the authors' own words: “Despite the significant empirical successes in this paper there are many areas in need of additional theoretical analysis.”

与 Rainbow 的差距:未叠加正交改进(设计推断)Gap to Rainbow: no orthogonal improvements stacked (inferred from the design)

IQN 仅是对 DQN 的分布扩展,未引入 prioritized replay、n-step updates、Dueling 架构、Noisy Nets 等 Rainbow 中的正交增强。作者明确指出 IQN 与 Rainbow 的差距完全来自这些缺失组件,并预期 "Creating a Rainbow-IQN agent could yield even greater improvements on Atari-57",但该组合在本文中未被评估。IQN is merely a distributional extension of DQN and does not adopt the orthogonal enhancements found in Rainbow, such as prioritized replay, n-step updates, the Dueling architecture or Noisy Nets. The authors state that the gap between IQN and Rainbow comes entirely from these missing components, and expect that “Creating a Rainbow-IQN agent could yield even greater improvements on Atari-57”, but that combination is not evaluated in this paper.

风险敏感策略的行为不符合预期(作者明示)Risk-sensitive policies do not behave as expected (stated by the authors)

在六款 Atari 游戏的风险敏感实验中,作者坦承:"Intuitively, we expected to see a qualitative effect from risk-sensitive training, e.g. strengthened exploration from a risk-seeking objective. Although we did see qualitative differences, these did not always match our expectations." 风险追求策略在多数游戏上表现更差,而风险厌恶策略在部分游戏中意外提升性能——背后机制仍是开放问题。In the risk-sensitive experiments on six Atari games the authors concede: “Intuitively, we expected to see a qualitative effect from risk-sensitive training, e.g. strengthened exploration from a risk-seeking objective. Although we did see qualitative differences, these did not always match our expectations.” Risk-seeking policies perform worse on most games, while risk-averse policies unexpectedly improve performance on some of them; the mechanism behind this remains an open question.

计算开销略高于 QR-DQN(设计推断)Slightly higher computational cost than QR-DQN (inferred from the design)

IQN 每次更新需对 N×N' 对 TD 误差计算损失,且需为每个 τ 单独计算 embedding 并前向传播,单样本计算量高于 QR-DQN。论文提到 "IQN will generally be more computationally expensive per-sample than QR-DQN",但指出 IQN 所需每次更新的样本数更少,实际运行时间相当。在资源受限环境下,这一权衡仍需考量。Every IQN update computes the loss over N×N' pairwise TD errors and requires a separate embedding and forward pass for each τ, so its per-sample computation exceeds that of QR-DQN. The paper notes that “IQN will generally be more computationally expensive per-sample than QR-DQN”, but points out that IQN needs fewer samples per update, so actual running time is comparable. In resource-constrained settings this trade-off still deserves consideration.