Actor-Critic的理解4——收敛性

文章目录

一、前言

仅供参考,未经实验验证。这篇论文有点复杂,以后再研究一下吧。

二、Actor-Critic算法

论文标题: Actor-Critic Algorithms

作者: Vijay R. Konda 和 John N. Tsitsiklis

机构: 麻省理工学院(MIT)信息与决策系统实验室

论文地址https://proceedings.neurips.cc/paper_files/paper/1999/file/6449f44a102fde848669bdd9eb6b76fa-Paper.pdf

发表: NeurIPS 1999 (Advances in Neural Information Processing Systems 12)

4 actor-critic算法的收敛性

Since our actor-critic algorithms are gradient-based, one cannot expect to prove convergence to a globally optimal policy (within the given class of RSP's). The best that one could hope for is the convergence of ∇ λ ( θ ) \nabla \lambda(\theta) ∇λ(θ) to zero; in practical terms, this will usually translate to convergence to a local minimum of λ ( θ ) \lambda(\theta) λ(θ). Actually, because the TD ( α \alpha α) critic will generally converge to an approximation of the desired projection of the value function, the corresponding convergence result is necessarily weaker, only guaranteeing that ∇ λ ( θ k ) \nabla \lambda(\theta_k) ∇λ(θk) becomes small (infinitely often). Let us now introduce some further assumptions.

由于我们的演员-评论家算法是基于梯度的,因此不能期望证明其收敛到全局最优策略(在给定的RSP类中)。我们所能期待的最好结果是 ∇ λ ( θ ) \nabla \lambda(\theta) ∇λ(θ) 收敛到零;在实际中,这通常意味着收敛到 λ ( θ ) \lambda(\theta) λ(θ) 的一个局部极小值。实际上,因为 TD ( α \alpha α) 评论家通常会收敛到期望值函数投影的一个近似,相应的收敛结果必然更弱,只能保证 ∇ λ ( θ k ) \nabla \lambda(\theta_k) ∇λ(θk) 变得很小(无限多次)。现在让我们引入一些进一步的假设。

通俗解释:

这段话告诉我们,要降低对这类算法的期望。因为是沿着梯度方向更新的,很难恰好停在全场最低点,通常只能停在某个"山谷"底部(局部最优),此时梯度基本为零。如果使用带近似的评论家(如TD(α),α<1),学习结果会带噪声,能保证的仅仅是梯度会反复变得非常小,而不是一直保持为零。

专业解释:

  • λ ( θ ) \lambda(\theta) λ(θ):策略参数 θ \theta θ 的目标函数(通常是平均奖励或折扣回报),即优化目标。
  • ∇ λ ( θ ) → 0 \nabla \lambda(\theta) \to 0 ∇λ(θ)→0:连续确定性梯度下降中收敛到驻点(可能为局部极小或鞍点)的条件。
  • TD( α \alpha α) critic 的近似投影:评论家不直接估计真实价值函数,而是将其投影到由特征向量张成的子空间,且由于 α < 1 \alpha<1 α<1 引入偏倚,只能得到近似投影,使得 actor 获得的是有偏梯度估计,故收敛结论减弱为 lim inf ⁡ k ∥ ∇ λ ( θ k ) ∥ \liminf_k \|\nabla \lambda(\theta_k)\| liminfk∥∇λ(θk)∥ 任意小。
  • "infinitely often"(无限多次): lim inf ⁡ \liminf liminf 意义下存在子序列使梯度范数趋于0,而非整个序列最终稳定在0。

(A5) For each θ ∈ R n \theta \in \mathbb{R}^n θ∈Rn, we define an m × m m \times m m×m matrix G ( θ ) G(\theta) G(θ) by

(A5) 对每个 θ ∈ R n \theta \in \mathbb{R}^n θ∈Rn,我们定义一个 m × m m \times m m×m 矩阵 G ( θ ) G(\theta) G(θ) 为

G ( θ ) = ∑ x , u η θ ( x , u ) ϕ θ ( x , u ) ϕ θ ( x , u ) T . G(\theta) = \sum_{x,u} \eta_\theta(x,u) \phi_\theta(x,u) \phi_\theta(x,u)^T. G(θ)=x,u∑ηθ(x,u)ϕθ(x,u)ϕθ(x,u)T.

We assume that G ( θ ) G(\theta) G(θ) is uniformly positive definite, that is, there exists some ϵ 1 > 0 \epsilon_1 > 0 ϵ1>0 such that for all r ∈ R m r \in \mathbb{R}^m r∈Rm and θ ∈ R n \theta \in \mathbb{R}^n θ∈Rn

我们假设 G ( θ ) G(\theta) G(θ) 是一致正定的,即存在某个 ϵ 1 > 0 \epsilon_1 > 0 ϵ1>0,使得对所有 r ∈ R m r \in \mathbb{R}^m r∈Rm 和 θ ∈ R n \theta \in \mathbb{R}^n θ∈Rn,有

r T G ( θ ) r ≥ ϵ 1 ∥ r ∥ 2 . r^T G(\theta) r \geq \epsilon_1 \|r\|^2. rTG(θ)r≥ϵ1∥r∥2.

通俗解释:

这个假设要求在学习过程中,用来描述状态和动作的特征向量不能有"死角",也就是说,从分布上看,特征向量的能量在各个方向上都要足够强。这样评论家才能稳定地从数据中学到唯一的线性价值函数参数,不会出现多个不同的参数都同样好(欠定)的情况。

专业解释:

  • η θ ( x , u ) \eta_\theta(x,u) ηθ(x,u):在策略 θ \theta θ 下,状态-动作对 ( x , u ) (x,u) (x,u) 的稳态分布(或平均访问分布)。
  • ϕ θ ( x , u ) \phi_\theta(x,u) ϕθ(x,u):维度为 m m m 的特征向量,用于线性函数逼近 Q Q Q 值。
  • G ( θ ) = E ( x , u ) ∼ η θ ϕ ϕ T G(\theta) = \mathbb{E}{(x,u)\sim\eta\theta}\\phi \\phi\^T G(θ)=E(x,u)∼ηθϕϕT:特征协方差矩阵。一致正定性意味着 λ min ⁡ ( G ( θ ) ) ≥ ϵ 1 > 0 \lambda_{\min}(G(\theta)) \ge \epsilon_1 > 0 λmin(G(θ))≥ϵ1>0 对所有 θ \theta θ 成立。这保证了在 critic 的随机逼近中,驱动 ODE 的矩阵是非奇异的,从而解唯一且稳定,避免参数漂移。

(A6) We assume that the stepsize sequences { γ k } , { β k } \{\gamma_k\}, \{\beta_k\} {γk},{βk} are positive, nonincreasing, and satisfy

(A6) 我们假设步长序列 { γ k } , { β k } \{\gamma_k\}, \{\beta_k\} {γk},{βk} 是正的、非增的,并且满足

δ k > 0 , ∀ k , ∑ k δ k = ∞ , ∑ k δ k 2 < ∞ , \delta_k > 0, \forall k, \quad \sum_k \delta_k = \infty, \quad \sum_k \delta_k^2 < \infty, δk>0,∀k,k∑δk=∞,k∑δk2<∞,

where δ k \delta_k δk stands for either β k \beta_k βk or γ k \gamma_k γk. We also assume that

其中 δ k \delta_k δk 代表 β k \beta_k βk 或 γ k \gamma_k γk。我们还假设

β k γ k → 0. \frac{\beta_k}{\gamma_k} \rightarrow 0. γkβk→0.

Note that the last assumption requires that the actor parameters be updated at a time scale slower than that of critic.

注意,最后一个假设要求演员参数的更新时间尺度慢于评论家。

通俗解释:

这是随机近似算法中标准的步长条件:步长要逐渐减小(保证最终收敛),但不能减小得太快(要能走遍所有可能的情况,总和无穷大);同时平方和有限可以压住噪声。更重要的是,评论家(critic)步长要比演员(actor)步长大很多,这意味着评论家学得快,演员学得慢。演员每动一点点,评论家已经大致追上了当前策略的真实价值,这样演员看到的梯度信息才比较靠谱。

专业解释:

  • γ k \gamma_k γk: critic 学习率, β k \beta_k βk: actor 学习率。
  • ∑ δ k = ∞ , ∑ δ k 2 < ∞ \sum \delta_k = \infty, \sum \delta_k^2 < \infty ∑δk=∞,∑δk2<∞:经典的 Robbins-Monro 条件,保证随机逼近能渐近克服噪声,收敛到对应 ODE 的稳定点。
  • β k / γ k → 0 \beta_k/\gamma_k \to 0 βk/γk→0:双时间尺度(two-timescale)条件。快时间尺度(critic)将 actor 参数 θ \theta θ 视为静态,估计 r ( θ ) r(\theta) r(θ);慢时间尺度(actor)基于 quasi-stationary 的 critic 估计进行梯度更新。这是证明中解耦两个更新过程的关键。

Theorem 2. In an actor-critic algorithm with a TD(1) critic,

定理2. 在具有 TD(1) 评论家的演员-评论家算法中,

lim inf ⁡ k ∥ ∇ λ ( θ k ) ∥ = 0 w . p . 1. \liminf_k \|\nabla \lambda(\theta_k)\| = 0 \quad w.p. \ 1. kliminf∥∇λ(θk)∥=0w.p. 1.

Furthermore, if { θ k } \{\theta_k\} {θk} is bounded w.p. 1 then

此外,如果 { θ k } \{\theta_k\} {θk} 以概率1有界,则

lim ⁡ k ∥ ∇ λ ( θ k ) ∥ = 0 w . p . 1. \lim_k \|\nabla \lambda(\theta_k)\| = 0 \quad w.p. \ 1. klim∥∇λ(θk)∥=0w.p. 1.

通俗解释:

如果使用 TD(1) 评论家(相当于不带偏差折扣的蒙特卡洛式评估),算法至少能保证梯度范数会无限多次趋近于零。如果能额外保证参数不会跑到无穷远(有界),那么梯度范数最终会一直保持为零,也就是稳稳收敛到某个局部最优。

专业解释:

  • ∇ λ ( θ k ) \nabla \lambda(\theta_k) ∇λ(θk):在参数 θ k \theta_k θk 处的策略梯度。
  • lim inf ⁡ \liminf liminf 结论只保证存在子序列 ∥ ∇ λ ( θ k i ) ∥ → 0 \|\nabla \lambda(\theta_{k_i})\| \to 0 ∥∇λ(θki)∥→0,不能排除在其它时段梯度又变大的可能。
  • 在 θ k \theta_k θk 有界假设下,借助 ODE 方法可证明整个序列收敛到梯度为零的极限集,得到 lim ⁡ \lim lim 收敛。这一强化是因为 TD(1) 评论家提供了真实值函数的无偏投影,actor 的更新更接近真实梯度下降。

Theorem 3. For every ϵ > 0 \epsilon > 0 ϵ>0, there exists α \alpha α sufficiently close to 1, such that lim inf ⁡ k ∥ ∇ λ ( θ k ) ∥ ≤ ϵ \liminf_k \|\nabla \lambda(\theta_k)\| \leq \epsilon liminfk∥∇λ(θk)∥≤ϵ w.p. 1.

定理3. 对每个 ϵ > 0 \epsilon > 0 ϵ>0,存在充分接近 1 的 α \alpha α,使得以概率1有 lim inf ⁡ k ∥ ∇ λ ( θ k ) ∥ ≤ ϵ \liminf_k \|\nabla \lambda(\theta_k)\| \leq \epsilon liminfk∥∇λ(θk)∥≤ϵ。

通俗解释:

如果不用 TD(1) 而用 TD(α)(α略小于1),虽然理论上无法保证梯度精确趋于零,但只要把α取得足够接近1,就可以保证梯度会反复变得任意小。这给了我们一个实用启示:选一个接近 1 的 α,既能减少评论家估计的方差,又几乎不牺牲收敛精度。

专业解释:

  • 当 α < 1 \alpha<1 α<1 时,TD(α) 评论家收敛到的 r ( θ ) r(\theta) r(θ) 并非真实投影 Π θ q θ \Pi_\theta q_\theta Πθqθ,而是满足固定点方程 r = Π θ ( ( 1 − α ) q θ + α T θ r ) r = \Pi_\theta ( (1-\alpha) q_\theta + \alpha T_\theta r ) r=Πθ((1−α)qθ+αTθr) 的解(此处 T θ T_\theta Tθ 为 Bellman 算子)。这引入了偏倚。
  • 定理3说明这种偏倚可通过 α → 1 \alpha \to 1 α→1 连续控制:对任意容忍度 ϵ \epsilon ϵ,存在 α ˉ < 1 \bar{\alpha} < 1 αˉ<1 使 α ∈ ( α ˉ , 1 ] \alpha \in (\bar{\alpha},1] α∈(αˉ,1] 时,actor 的极限下界梯度范数小于 ϵ \epsilon ϵ。该结论为实际中取 α < 1 \alpha < 1 α<1 提供了理论支撑。

Note that the theoretical guarantees appear to be stronger in the case of the TD(1) critic. However, we expect that TD( α \alpha α ) will perform better in practice because of much smaller variance for the parameter r k r_k rk. (Similar issues arise when considering actor-only algorithms. The experiments reported in 7 indicate that introducing a forgetting factor α < 1 \alpha < 1 α<1 can result in much faster convergence, with very little loss of performance.) We now provide an overview of the proofs of these theorems. Since β k / γ k → 0 \beta_k/\gamma_k \rightarrow 0 βk/γk→0, the size of the actor updates becomes negligible compared to the size of the critic updates. Therefore the actor looks stationary, as far as the critic is concerned. Thus, the analysis in 1 for the TD(1) critic and the analysis in 12 for the TD( α \alpha α ) critic (with α < 1 \alpha < 1 α<1 ) can be used, with appropriate modifications, to conclude that the critic's approximation of Π θ k q θ k \Pi_{\theta_k} q_{\theta_k} Πθkqθk will be "asymptotically correct". If r ( θ ) r(\theta) r(θ) denotes the value to which the critic converges when the actor parameters are fixed at θ \theta θ, then the update for the actor can be rewritten as

请注意,在 TD(1) 评论家的情况下,理论保证似乎更强。然而,我们预期 TD( α \alpha α ) 在实践中会表现得更好,因为参数 r k r_k rk 的方差要小得多。(当考虑仅含演员的算法时,也会出现类似的问题。文献7中的实验表明,引入遗忘因子 α < 1 \alpha < 1 α<1 可以带来更快的收敛速度,而性能损失极小。)我们现在对这些定理的证明做一个概述。由于 β k / γ k → 0 \beta_k/\gamma_k \rightarrow 0 βk/γk→0,演员更新的幅度相比于评论家更新的幅度变得可以忽略不计。因此,就评论家而言,演员看起来是静止的。这样,文献1中对 TD(1) 评论家的分析和文献12中对 TD( α \alpha α ) 评论家( α < 1 \alpha < 1 α<1)的分析,经过适当修改后,可用于得出评论家对 Π θ k q θ k \Pi_{\theta_k} q_{\theta_k} Πθkqθk 的近似将是"渐近正确"的结论。如果记 r ( θ ) r(\theta) r(θ) 为当演员参数固定在 θ \theta θ 时评论家收敛到的值,那么演员的更新可以重写为

θ k + 1 = θ k − β k Γ ( r ( θ k ) ) Q r ( θ k ) θ k ( X k + 1 , U k + 1 ) ψ θ k ( X k + 1 , U k + 1 ) + β k e k , \theta_{k+1} = \theta_k - \beta_k \Gamma(r(\theta_k)) Q_{r(\theta_k)}^{\theta_k}(X_{k+1}, U_{k+1}) \psi_{\theta_k}(X_{k+1}, U_{k+1}) + \beta_k e_k, θk+1=θk−βkΓ(r(θk))Qr(θk)θk(Xk+1,Uk+1)ψθk(Xk+1,Uk+1)+βkek,

where e k e_k ek is an error that becomes asymptotically negligible. At this point, standard proof techniques for stochastic approximation algorithms can be used to complete the proof.

其中 e k e_k ek 是一个渐近可忽略的误差。至此,可以使用随机近似算法的标准证明技术来完成证明。

通俗解释:

TD(1) 理论保证强,但像蒙特卡洛方法一样方差大;引入 α<1 相当于给老信息打折,虽然带来一点偏差,但能大大降低估计的波动,整体学得更快更稳。证明的关键是利用演员步长极小这一事实,把演员参数暂时冻住,先分析评论家学准了没有,再把学好的评论家当作一个靠谱的梯度指示器,套用随机近似的标准框架去证明演员最终会走到梯度接近零的地方。

专业解释:

  • β k / γ k → 0 \beta_k/\gamma_k \rightarrow 0 βk/γk→0:导致双时间尺度分离,critic 看到的 actor 近似静态,故可将 critic 的收敛结论(如固定 θ \theta θ 下 r k → r ( θ ) r_k \to r(\theta) rk→r(θ))直接引入。
  • r ( θ ) r(\theta) r(θ):给定 θ \theta θ 下 critic 参数收敛到的极限,对于 TD(1), r ( θ ) r(\theta) r(θ) 对应 Π θ q θ \Pi_\theta q_\theta Πθqθ(真实值函数的线性投影);对于 TD(α), r ( θ ) r(\theta) r(θ) 是偏倚投影方程的解。
  • Π θ k q θ k \Pi_{\theta_k} q_{\theta_k} Πθkqθk:在由特征张成的子空间上的正交投影算子作用于真实动作价值 q θ k q_{\theta_k} qθk。
  • Q r ( θ k ) θ k Q_{r(\theta_k)}^{\theta_k} Qr(θk)θk:由线性参数 r ( θ k ) r(\theta_k) r(θk) 构造的近似 Q 值,即 Q ≈ r T ϕ Q \approx r^T \phi Q≈rTϕ。
  • ψ θ k \psi_{\theta_k} ψθk:与策略参数化相关的 eligibility trace 或得分函数(通常 ψ = ∇ θ log ⁡ π θ \psi = \nabla_\theta \log \pi_\theta ψ=∇θlogπθ)。
  • Γ ( r ) \Gamma(r) Γ(r):可能为投影或增益矩阵,联系梯度 ∇ λ ( θ ) \nabla \lambda(\theta) ∇λ(θ) 与 critic 估计。
  • e k e_k ek:包含了 critic 未能完全收敛以及有限样本误差造成的残余项,在慢时间尺度上通过步长条件可证明其累积贡献趋于零。
  • 最终结构是带消失扰动项的随机梯度下降 ODE: θ ˙ = − E Γ ( r ( θ ) ) Q r ( θ ) θ ψ θ \dot{\theta} = -\mathbb{E}\\Gamma(r(\\theta)) Q_{r(\\theta)}\^\\theta \\psi_\\theta θ˙=−EΓ(r(θ))Qr(θ)θψθ,其稳定点满足梯度为零。

5 结论

The key observation in this paper is that in actor-critic methods, the actor parameterization and the critic parameterization need not, and should not be chosen independently. Rather, an appropriate approximation architecture for the critic is directly prescribed by the parameterization used in actor.

本文的关键观察是:在演员-评论家方法中,演员的参数化和评论家的参数化不必、也不应被独立地选取。相反,一个合适的评论家近似架构,直接由演员所使用的参数化所规定。

Capitalizing on the above observation, we have presented a class of actor-critic algorithms, aimed at combining the advantages of actor-only and critic-only methods. In contrast to existing actor-critic methods, our algorithms apply to high-dimensional problems (they do not rely on lookup table representations), and are mathematically sound in the sense that they possess certain convergence properties.

基于上述观察,我们提出了一类演员-评论家算法,旨在结合纯演员方法和纯评论家方法的优点。与现有的演员-评论家方法相比,我们的算法适用于高维问题(它们不依赖于查找表表示),并且在数学上是可靠的,因为它们具备一定的收敛性质。