Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

Reinforcement Learning

31 missions · 9 completed

Missions

Open22Completed9All31
Machine LearningProbability·Captain: mikedeng1

Minimax Regret Bounds for Reinforcement Learning II: High-Probability Regret Bound for UCBVI with a Bernstein–Freedman BonusResearch Paper

Why finite-horizon reinforcement learning needs a variance-sensitive bound

An agent can learn to act in an unknown environment by repeatedly running a finite episode, observing the states reached after its actions, and updating its model of the environment. The agent must trade off rewards in the current episode against information that may improve later decisions. A regret bound measures the cumulative value lost relative to an optimal policy that knows the true transition probabilities. Its dependence on the number of states, actions, episode steps, and interactions says how much exploration that uncertainty can force.

Azar, Osband, and Munos study this question for a finite-horizon Markov decision process with known, bounded rewards and an unknown, stationary transition kernel. Their UCBVI algorithm estimates action values from observed transitions and adds an exploration bonus. Their second version, UCBVI-BF, uses the empirical variance of the next-state value in that bonus. Their Theorem 2 gives an explicit high-probability regret bound whose leading dependence on the horizon is smaller than the bound they give for the simpler UCBVI-CH bonus. The paper states that, in a sufficiently long-run regime, its leading order matches the cited lower-bound scale up to logarithmic factors. This mission targets the explicit theorem, including its lower-order terms, rather than only that asymptotic comparison.

The MDP, interaction, and algorithm

Let S\mathcal SS and A\mathcal AA be nonempty finite state and action sets with cardinalities SSS and AAA. A stationary transition kernel P(y∣x,a)P(y\mid x,a)P(y∣x,a) is a probability distribution on next states yyy for every current state xxx and action aaa. The reward R(x,a)R(x,a)R(x,a) is deterministic, known to the learner, and lies in [0,1][0,1][0,1]. These are the conditions of Assumption 1 and §2. Episodes have H≥1H\ge1H≥1 steps; KKK episodes comprise T=KHT=KHT=KH interactions.

A policy π\piπ chooses an action for each state and step. Its value Vhπ(x)V_h^\pi(x)Vhπ​(x) is the expected reward from step hhh through the final step when the state at hhh is xxx; the terminal value is VH+1π=0V_{H+1}^\pi=0VH+1π​=0. The optimal value Vh∗(x)=sup⁡πVhπ(x)V_h^*(x)=\sup_\pi V_h^\pi(x)Vh∗​(x)=supπ​Vhπ​(x) ranges over all deterministic policies of this form. At the start of episode kkk, the environment may choose the initial state using the completed episodes. The learner then fixes a policy πk\pi_kπk​, observes transitions during the episode, and updates counts for the next episode. Its regret is

Regret⁡(K)=∑k=1K(V1∗(xk,1)−V1πk(xk,1)).\operatorname{Regret}(K)=\sum_{k=1}^{K}\bigl(V_1^*(x_{k,1})-V_1^{\pi_k}(x_{k,1})\bigr).Regret(K)=k=1∑K​(V1∗​(xk,1​)−V1πk​​(xk,1​)).

For each state-action pair, Nk(x,a,y)N_k(x,a,y)Nk​(x,a,y) counts transitions to yyy in episodes before kkk, and Nk(x,a)=∑yNk(x,a,y)N_k(x,a)=\sum_yN_k(x,a,y)Nk​(x,a)=∑y​Nk​(x,a,y). When the latter is positive, P^k(y∣x,a)=Nk(x,a,y)/Nk(x,a)\widehat P_k(y\mid x,a)=N_k(x,a,y)/N_k(x,a)Pk​(y∣x,a)=Nk​(x,a,y)/Nk​(x,a). The count Nk,h′(y)N'_{k,h}(y)Nk,h′​(y) records previous episodes whose state at step hhh was yyy. Algorithms 2 and 4 compute optimistic Qk,hQ_{k,h}Qk,h​ backward from zero terminal value, take a minimum with the previous episode's QQQ estimate and with HHH, and choose a maximizing action at every state. Previously unseen pairs receive Qk,h=HQ_{k,h}=HQk,h​=H. The Bernstein–Freedman bonus uses the empirical variance of Vk,h+1V_{k,h+1}Vk,h+1​ under P^k\widehat P_kPk​ and an additional term based on Nk,h+1′N'_{k,h+1}Nk,h+1′​; the algorithm uses Lalg=ln⁡(5SAT/δ)L_{\rm alg}=\ln(5SAT/\delta)Lalg​=ln(5SAT/δ).

Formalization targets

The goal is Theorem 2 on p. 5. For any MDP and interaction described above and every δ>0\delta>0δ>0, write L=ln⁡(5HSAT/δ)L=\ln(5HSAT/\delta)L=ln(5HSAT/δ). The target is the exact bad-event form of the printed high-probability bound:

Pr⁡ ⁣{Regret⁡(K)>30HLSAK+2500H2S2AL2+4H3/2KL}≤δ.\Pr\!\left\{\operatorname{Regret}(K)>30HL\sqrt{SAK}+2500H^2S^2AL^2+4H^{3/2}\sqrt{KL}\right\}\le\delta.Pr{Regret(K)>30HLSAK​+2500H2S2AL2+4H3/2KL​}≤δ.

The milestone list contains three empirical-transition deviations from the proof of Lemma 1: Eq. (9) for a value-weighted transition error, the displayed count bound before Eq. (11), and Eq. (12) for the full transition row's ℓ1\ell_1ℓ1​ error. It also contains Lemma 2's variance comparison and Eq. (26), which relates cumulative conditional next-value variance to the variance of an episode return. These are source-indexed targets, with their printed constants retained.

What the result and its formalization supply

The theorem gives a quantitative guarantee for a particular executable decision rule: its regret grows sublinearly in KKK in the leading term, with explicit dependence on SSS, AAA, and HHH. The result lets one compare the horizon dependence of a variance-sensitive bonus with a value-agnostic bonus under the same finite-horizon model. It also fixes which logarithm belongs in the algorithm and which appears in the reported bound; replacing either changes the claim.

A formal proof would connect a fully specified adaptive interaction to its finite probability law, empirical counts, backward value iteration, and the stated high-probability conclusion. The local prior-art search found reusable transition-kernel vocabulary and general concentration tools, but no published formal statement of this exact UCBVI-BF algorithm or theorem. The mission's finite path and variance definitions can also support other episodic reinforcement-learning bounds that use conditional variance.

Where the difficulty lies

The bonus is computed using a value function that itself depends on earlier observations and the same episode's backward recursion. A concentration inequality for a fixed transition row and a fixed test function therefore does not directly control every value estimate encountered by the algorithm. The number of samples in a row is also random and changes with the learner's past actions. The regret compares a policy's value at an environment-chosen initial state with a supremum over all policies, while the learner's greedy action must be defined at states it never visits. These dependencies are the central obstacle to turning local concentration statements into the episode-level bound.

Formalization scope and conventions

The Lean model uses finite sums rather than measure theory. A published predicate supplies the stationary, real-valued transition kernel; a local MDP adds the known deterministic reward. State and action types are finite and nonempty. Policies are deterministic and depend on the step. The supremum defining V∗V^*V∗ ranges over their finite function type. A theorem quantifies over every maximizing tie-breaking rule and every initial-state rule that reads only completed episodes. The probability of an event is constructed as a sum over finite outcome sequences, each weighted by the product of true transition probabilities. Counts use all past transitions and no current or future outcomes. These choices rule out a trivialization that assumes the desired law or optimizes over an unbounded class of arbitrary functions.

Lean indexes the HHH steps from zero, while the paper indexes them from one. The last observed next state is kept because Algorithm 4 counts states at the terminal index H+1H+1H+1. At Nk,h+1′(y)=0N'_{k,h+1}(y)=0Nk,h+1′​(y)=0, Algorithm 4's quotient is interpreted as infinite and the capped term is H2H^2H2; Lean's ordinary division by zero would incorrectly produce zero. The algorithm uses Lalg=ln⁡(5SAT/δ)L_{\rm alg}=\ln(5SAT/\delta)Lalg​=ln(5SAT/δ), while Theorem 2's bound uses L=ln⁡(5HSAT/δ)L=\ln(5HSAT/\delta)L=ln(5HSAT/δ). For Eq. (26), the appendix ends its sums at H−1H-1H−1 under a shifted terminal convention; the local statement includes all HHH reward steps and the terminal value VH+1=0V_{H+1}=0VH+1​=0 used by Algorithm 2. The milestone text remains the printed text. The count milestone is the display before Eq. (11), since Eq. (11) drops a factor of 222 under the square root present in that display.

Theorem 2 retains its printed 2500H2S2AL22500H^2S^2AL^22500H2S2AL2 term. The appendix's displayed Lemma 13 calculation does not reproduce that second-order constant when propagated to Lemma 14; this is a source proof gap, not a hypothesis of the theorem. Work on the probability normalization, random-count concentration, adaptive value estimates, variance identity, and a valid route to the printed explicit constants is welcome. A proof with altered constants or an asymptotic-only conclusion would be a different target.

Selected references

  • M. G. Azar, I. Osband, and R. Munos, Minimax Regret Bounds for Reinforcement Learning, arXiv:1703.05449v2, 2017. Preprint.
13 thms2 active usersReviewed
Convex OptimizationOperations ResearchOptimization·Captain: mikedeng1

Twice Regularized MDPs and the Equivalence Between Robustness and Regularization 1: The Robust Value Function Is the Optimum of a Policy- and Value-Regularized Convex ProgramResearch Paper

Motivation

A Markov decision process (MDP) is solved for one model of its dynamics and rewards, but in practice that model is estimated from data, and a policy that is optimal for the estimate can perform poorly on the true system (Mannor et al., 2007). Robust MDPs address this by evaluating a policy against the worst model in an uncertainty set U\mathcal UU (Iyengar, 2005; Nilim and El Ghaoui, 2005; Wiesemann, Kuhn and Rustem, 2013). Robust planning, however, solves an inner optimization over U\mathcal UU at every Bellman update, which is expensive and does not scale to learning settings.

A separate line of work regularizes the policy (entropy, KL, Tsallis penalties) and observes empirically that regularized policies are robust to perturbations (Geist, Scherrer and Pietquin, 2019). Derman, Geist and Mannor (arXiv:2110.06267, NeurIPS 2021) make this precise: for uncertainty sets centred at a nominal model, the robust value function is the solution of a regularized problem posed on the nominal model alone, with a regularizer that is the support function of the uncertainty set. This mission formalizes that equivalence: Proposition 3.1, Theorem 3.1 and Theorem 4.1 of the paper.

Setting

Let S\mathcal SS and A\mathcal AA be finite sets of states and actions, A\mathcal AA nonempty, and X:=S×A\mathcal X := \mathcal S\times\mathcal AX:=S×A. Fix a discount factor γ∈(0,1)\gamma\in(0,1)γ∈(0,1) and a strictly positive initial distribution μ0∈ΔS\mu_0\in\Delta_{\mathcal S}μ0​∈ΔS​. A transition kernel PPP assigns to every pair (s,a)(s,a)(s,a) a probability distribution P(⋅∣s,a)P(\cdot\mid s,a)P(⋅∣s,a) on S\mathcal SS; a reward is r∈RXr\in\mathbb R^{\mathcal X}r∈RX. A policy π∈ΔAS\pi\in\Delta_{\mathcal A}^{\mathcal S}π∈ΔAS​ assigns to every state an action distribution πs\pi_sπs​.

For v∈RSv\in\mathbb R^{\mathcal S}v∈RS write rπ(s)=∑aπs(a)r(s,a)r^\pi(s) = \sum_a\pi_s(a)r(s,a)rπ(s)=∑a​πs​(a)r(s,a), Pπ(s′∣s)=∑aπs(a)P(s′∣s,a)P^\pi(s'\mid s) = \sum_a\pi_s(a)P(s'\mid s,a)Pπ(s′∣s)=∑a​πs​(a)P(s′∣s,a), and define the evaluation Bellman operator

T(P,r)πv:=rπ+γPπv.T^\pi_{(P,r)}v := r^\pi + \gamma P^\pi v .T(P,r)π​v:=rπ+γPπv.

The inner product on RS\mathbb R^{\mathcal S}RS is ⟨v,μ⟩=∑sv(s)μ(s)\langle v,\mu\rangle = \sum_s v(s)\mu(s)⟨v,μ⟩=∑s​v(s)μ(s), and the support function of a set C⊆RιC\subseteq\mathbb R^{\iota}C⊆Rι is σC(y)=max⁡a∈C⟨a,y⟩\sigma_C(y) = \max_{a\in C}\langle a,y\rangleσC​(y)=maxa∈C​⟨a,y⟩.

Given a set U\mathcal UU of models (P,r)(P,r)(P,r), the robust Bellman operator is

[Tπ,Uv](s):=min⁡(P,r)∈UT(P,r)πv(s),[T^{\pi,\mathcal U}v](s) := \min_{(P,r)\in\mathcal U}T^\pi_{(P,r)}v(s),[Tπ,Uv](s):=(P,r)∈Umin​T(P,r)π​v(s),

and the robust value function vπ,Uv^{\pi,\mathcal U}vπ,U is its fixed point. Around a nominal model (P0,r0)(P_0,r_0)(P0​,r0​), an s-rectangular uncertainty set U=(P0+P)×(r0+R)\mathcal U = (P_0+\mathcal P)\times(r_0+\mathcal R)U=(P0​+P)×(r0​+R) is given by sets Ps⊆RX\mathcal P_s\subseteq\mathbb R^{\mathcal X}Ps​⊆RX and Rs⊆RA\mathcal R_s\subseteq\mathbb R^{\mathcal A}Rs​⊆RA, one per state: its models are P(s′∣s,a)=P0(s′∣s,a)+Ps(s′,a)P(s'\mid s,a) = P_0(s'\mid s,a)+P_s(s',a)P(s′∣s,a)=P0​(s′∣s,a)+Ps​(s′,a) and r(s,a)=r0(s,a)+rs(a)r(s,a) = r_0(s,a)+r_s(a)r(s,a)=r0​(s,a)+rs​(a), with Ps∈PsP_s\in\mathcal P_sPs​∈Ps​ and rs∈Rsr_s\in\mathcal R_srs​∈Rs​ chosen independently for each sss. Finally [v⋅πs](s′,a):=v(s′)πs(a)[v\cdot\pi_s](s',a) := v(s')\pi_s(a)[v⋅πs​](s′,a):=v(s′)πs​(a).

Formalization targets

Goal: Theorem 4.1 (general robust MDP)

For U=(P0+P)×(r0+R)\mathcal U = (P_0+\mathcal P)\times(r_0+\mathcal R)U=(P0​+P)×(r0​+R) and every policy π\piπ, Tπ,UT^{\pi,\mathcal U}Tπ,U has a unique fixed point vπ,Uv^{\pi,\mathcal U}vπ,U, and it is the optimal solution of

max⁡v∈RS⟨v,μ0⟩s.t.v(s)≤T(P0,r0)πv(s)−σRs(−πs)−σPs(−γv⋅πs)∀s∈S.(2)\max_{v\in\mathbb R^{\mathcal S}}\langle v,\mu_0\rangle\quad\text{s.t.}\quad v(s)\le T^\pi_{(P_0,r_0)}v(s)-\sigma_{\mathcal R_s}(-\pi_s)-\sigma_{\mathcal P_s}(-\gamma v\cdot\pi_s)\quad\forall s\in\mathcal S. \tag{2}v∈RSmax​⟨v,μ0​⟩s.t.v(s)≤T(P0​,r0​)π​v(s)−σRs​​(−πs​)−σPs​​(−γv⋅πs​)∀s∈S.(2)

Milestones

  1. Proposition 3.1. For any uncertainty set U=P×R\mathcal U = \mathcal P\times\mathcal RU=P×R with P\mathcal PP a nonempty compact set of kernels and R\mathcal RR a nonempty compact set of rewards, vπ,Uv^{\pi,\mathcal U}vπ,U is the optimal solution of the robust program \max_{v}\langle v,\mu_0\rangle\quad\text{s.t.}\quad v\le T^\pi_{(P,r)}v\ \ \forall(P,r)\in\mathcal U. \tag{$P_{\mathcal U}$}
  2. Theorem 3.1. For U={P0}×(r0+R)\mathcal U=\{P_0\}\times(r_0+\mathcal R)U={P0​}×(r0​+R), vπ,Uv^{\pi,\mathcal U}vπ,U is the optimal solution of max⁡v⟨v,μ0⟩\max_v\langle v,\mu_0\ranglemaxv​⟨v,μ0​⟩ s.t. v(s)≤T(P0,r0)πv(s)−σRs(−πs)v(s)\le T^\pi_{(P_0,r_0)}v(s)-\sigma_{\mathcal R_s}(-\pi_s)v(s)≤T(P0​,r0​)π​v(s)−σRs​​(−πs​) for all sss.
  3. Robust counterpart (proof of Theorem 4.1, App. B.1). For every vvv and sss,
max⁡(P,r)∈U{v(s)−rπ(s)−γPπv(s)}=σPs(−γv⋅πs)+σRs(−πs)+v(s)−T(P0,r0)πv(s).\max_{(P,r)\in\mathcal U}\{v(s)-r^\pi(s)-\gamma P^\pi v(s)\} = \sigma_{\mathcal P_s}(-\gamma v\cdot\pi_s)+\sigma_{\mathcal R_s}(-\pi_s)+v(s)-T^\pi_{(P_0,r_0)}v(s).(P,r)∈Umax​{v(s)−rπ(s)−γPπv(s)}=σPs​​(−γv⋅πs​)+σRs​​(−πs​)+v(s)−T(P0​,r0​)π​v(s).

Theorem 3.1 is the special case Ps={0}\mathcal P_s=\{0\}Ps​={0} of the goal; it is listed separately because it is the paper's statement that policy regularization is equivalent to reward uncertainty.

Significance

The goal says that a robust MDP with s-rectangular uncertainty in both reward and transitions is a regularized MDP on the nominal model, with two regularizers: a policy regularizer σRs(−πs)\sigma_{\mathcal R_s}(-\pi_s)σRs​​(−πs​) coming from reward uncertainty, and a regularizer σPs(−γv⋅πs)\sigma_{\mathcal P_s}(-\gamma v\cdot\pi_s)σPs​​(−γv⋅πs​) coming from transition uncertainty that depends on both the policy and the value. For ball-shaped sets these support functions are explicit (αsr∥πs∥\alpha^r_s\|\pi_s\|αsr​∥πs​∥ and αsPγ∥v∥∥πs∥\alpha^P_s\gamma\|v\|\|\pi_s\|αsP​γ∥v∥∥πs​∥, Corollary 4.1 of the paper), which leads to the twice regularized (R²) Bellman operators of Section 5 and to robust planning at the cost of non-robust planning. Theorem 3.1 also explains why standard policy regularizers (negative entropy, KL, Tsallis) yield robustness: each is the support function of a reward uncertainty set.

The results are proved in the paper (appendices A.1, A.2, B.1); none has a machine-checked proof. The mission produces formal statements and proofs of the equivalence, the robust Bellman operator's fixed-point theory for stochastic policies and general compact uncertainty sets, and a closed-form robust counterpart that later R² results can import. The paper's printed proof of Proposition 3.1 treats Tπ,UT^{\pi,\mathcal U}Tπ,U as linear in one step; a formal proof settles the statement independently of that step.

Difficulty

The obvious argument reads Proposition 3.1 as linear-programming duality, as for a single MDP. That fails: Tπ,UT^{\pi,\mathcal U}Tπ,U is a minimum of affine maps, hence concave and not affine, and the feasible set of (PU)(P_{\mathcal U})(PU​) is an intersection of infinitely many half-space systems; the argument has to go through monotonicity and contraction of Tπ,UT^{\pi,\mathcal U}Tπ,U, which in turn requires every model in U\mathcal UU to be a genuine transition kernel. For the goal, the paper invokes Fenchel–Rockafellar duality to evaluate the inner maximum; the work in Lean is to separate the maximum over the product set U\mathcal UU into per-state maxima, which needs the s-rectangular structure and attainment of every maximum (compactness), and to track the index order of the perturbation Ps(s′,a)P_s(s',a)Ps​(s′,a) against the kernel P(s′∣s,a)P(s'\mid s,a)P(s′∣s,a).

Formalization scope

  • States and actions are finite types, A nonempty; values are S → ℝ ordered pointwise; a transition array is P : S → A → S → ℝ with P s a s' =P(s′∣s,a)=P(s'\mid s,a)=P(s′∣s,a), and the kernel property is the published IsTransitionKernel; Pπ(s′∣s)P^\pi(s'\mid s)Pπ(s′∣s) is the published InducedTransition. A policy has π s ∈ stdSimplex ℝ A for every s.
  • Perturbations PsP_sPs​ are functions S × A → ℝ indexed (s′,a)(s',a)(s′,a), as in the paper's RX\mathbb R^{\mathcal X}RX; rewards perturbations are A → ℝ.
  • Minima and maxima (in Tπ,UT^{\pi,\mathcal U}Tπ,U and in σ\sigmaσ) are real sInf/sSup. Every theorem assumes the sets nonempty and compact, so these are attained; nothing is quantified over an unbounded set.
  • The robust value function is encoded as the fixed point of Tπ,UT^{\pi,\mathcal U}Tπ,U, and each theorem asserts its existence and uniqueness. The paper's definition vπ,U(s)=min⁡(P,r)∈Uv(P,r)π(s)v^{\pi,\mathcal U}(s)=\min_{(P,r)\in\mathcal U}v^\pi_{(P,r)}(s)vπ,U(s)=min(P,r)∈U​v(P,r)π​(s) (p. 4) coincides with it for rectangular sets by a cited result; the proofs use only the fixed-point property. For the non-rectangular sets of Proposition 3.1 the pointwise minimum can be strictly larger than the fixed point and is then not the optimum of (PU)(P_{\mathcal U})(PU​), so the fixed point is the object the proposition is true for.
  • "The optimal solution" means: feasible, objective-maximal, and the unique maximizer (uniqueness uses μ0>0\mu_0>0μ0​>0).
  • Disclosed hypotheses: U=P×R\mathcal U=\mathcal P\times\mathcal RU=P×R with P\mathcal PP, R\mathcal RR nonempty and compact and every transition in P\mathcal PP a kernel (Prop. 3.1); Ps\mathcal P_sPs​, Rs\mathcal R_sRs​ nonempty and compact and every perturbed row P0(⋅∣s,a)+Ps(⋅,a)P_0(\cdot\mid s,a)+P_s(\cdot,a)P0​(⋅∣s,a)+Ps​(⋅,a) in ΔS\Delta_{\mathcal S}ΔS​ (Thm 4.1); reward sets rectangular in Thm 3.1, as its proof uses. These are the robust-MDP standing assumptions of p. 4 (P⊆ΔSX\mathcal P\subseteq\Delta^{\mathcal X}_{\mathcal S}P⊆ΔSX​) and what makes "min" and "max" well defined.
  • Not drafted: Corollary 4.1, whose ℓ²-ball Ps\mathcal P_sPs​ contains perturbations that leave the simplex, so P0+PP_0+\mathcal PP0​+P is not a set of kernels; Corollary 3.1 and Proposition 3.2 (consequences after the goal; Prop. 3.2 depends on an unspecified policy parametrization).
  • A formalization that asserts only that the feasible sets of (PU)(P_{\mathcal U})(PU​) and (2) coincide, or that drops the kernel condition or the existence of the fixed point, does not count: the goal names the robust value function and its optimality.
  • "Convex" in the statement of Theorem 4.1 is descriptive and is not part of the formal goal.

Contributions welcome: the monotone-contraction fixed-point lemma for Tπ,UT^{\pi,\mathcal U}Tπ,U and the per-state separation of maxima over rectangular sets are reusable for any robust MDP mission.

Selected references

  • E. Derman, M. Geist, S. Mannor, Twice regularized MDPs and the equivalence between robustness and regularization, NeurIPS 2021. arXiv:2110.06267v1
  • G. N. Iyengar, Robust dynamic programming, Mathematics of Operations Research 30(2), 2005. doi:10.1287/moor.1040.0129
  • A. Nilim, L. El Ghaoui, Robust control of Markov decision processes with uncertain transition matrices, Operations Research 53(5), 2005. doi:10.1287/opre.1050.0216
  • W. Wiesemann, D. Kuhn, B. Rustem, Robust Markov decision processes, Mathematics of Operations Research 38(1), 2013. doi:10.1287/moor.1120.0566
  • M. Geist, B. Scherrer, O. Pietquin, A theory of regularized Markov decision processes, ICML 2019. PMLR 97
  • S. Mannor, D. Simester, P. Sun, J. N. Tsitsiklis, Bias and variance approximation in value function estimates, Management Science 53(2), 2007. doi:10.1287/mnsc.1060.0614
8 thms2 active usersReviewed
Dynamical SystemsProbabilityStochastic Systems·Captain: mikedeng1

The O.D.E. Method for Convergence of Stochastic Approximation and Reinforcement Learning I: Stability and Almost-Sure Convergence under Tapering StepsizesResearch Paper

Motivation

Stochastic approximation is the family of recursive algorithms that locate a zero of a function observed only through noisy evaluations. It goes back to Robbins and Monro (1951) and today underlies stochastic gradient descent, temporal-difference learning, Q-learning and actor–critic methods in reinforcement learning, and models of learning by boundedly rational agents.

The standard analysis is the O.D.E. method (Ljung 1977; see Kushner and Yin 1997): the interpolated iterates are compared with the solutions of an ordinary differential equation, and convergence of the algorithm follows from the stability of that ODE. The method has one well-known gap. It assumes, rather than proves, that the iterates remain bounded with probability one. In applications this stability hypothesis is often the hardest part: for asynchronous Q-learning and adaptive critic algorithms, almost sure boundedness had been proved only for discounted cost or after adding a projection step (Borkar and Meyn, p. 460).

Borkar and Meyn (SIAM J. Control Optim. 38 (2000)) close this gap with a scaling argument borrowed from the fluid-model approach to the stability of queueing networks (Dai 1995; Dai and Meyn 1995). They show that boundedness itself follows from the asymptotic stability of the origin for a second, "fluid-limit" ODE obtained by rescaling the drift. This mission formalizes that stability theorem for tapering step sizes, and the convergence theorem that follows from it.

Setting

Fix d≥0d\ge 0d≥0 and work in Rd\mathbb R^dRd with the Euclidean norm. Let h:Rd→Rdh:\mathbb R^d\to\mathbb R^dh:Rd→Rd and let {a(n)}n≥0\{a(n)\}_{n\ge0}{a(n)}n≥0​ be a deterministic sequence of positive step sizes. On a probability space (Ω,F,P)(\Omega,\mathcal F,\mathsf P)(Ω,F,P), random vectors X(n)X(n)X(n) and M(n)M(n)M(n) satisfy the stochastic approximation recursion

X(n+1)=X(n)+a(n)[h(X(n))+M(n+1)],n≥0.(1.1)X(n+1) = X(n) + a(n)\big[h(X(n)) + M(n+1)\big], \qquad n\ge0. \tag{1.1}X(n+1)=X(n)+a(n)[h(X(n))+M(n+1)],n≥0.(1.1)

Its mean ODE is x˙=h(x)\dot x = h(x)x˙=h(x) (1.2). For r>0r>0r>0 the scaled field is hr(x)=h(rx)/rh_r(x)=h(rx)/rhr​(x)=h(rx)/r, with the scaled ODE x˙=hr(x)\dot x = h_r(x)x˙=hr​(x) (1.4).

  • (A1) hhh is Lipschitz; hr(x)→h∞(x)h_r(x)\to h_\infty(x)hr​(x)→h∞​(x) as r→∞r\to\inftyr→∞ for every xxx; and the origin is an asymptotically stable equilibrium of the fluid-limit ODE x˙=h∞(x)\dot x = h_\infty(x)x˙=h∞​(x) (1.5).
  • (A2) With Fn\mathcal F_nFn​ the history of the iterates up to time nnn, {M(n)}\{M(n)\}{M(n)} is a martingale difference sequence, E[M(n+1)∣Fn]=0\mathsf E[M(n+1)\mid\mathcal F_n]=0E[M(n+1)∣Fn​]=0, and for some constant C0<∞C_0<\inftyC0​<∞, E[∥M(n+1)∥2∣Fn]≤C0(1+∥X(n)∥2)\mathsf E[\|M(n+1)\|^2\mid\mathcal F_n]\le C_0(1+\|X(n)\|^2)E[∥M(n+1)∥2∣Fn​]≤C0​(1+∥X(n)∥2).
  • (TS) Tapering step sizes: 0<a(n)≤10<a(n)\le10<a(n)≤1, ∑na(n)=∞\sum_n a(n)=\infty∑n​a(n)=∞, ∑na(n)2<∞\sum_n a(n)^2<\infty∑n​a(n)2<∞.

A point x∗x^*x∗ is globally asymptotically stable for x˙=h(x)\dot x = h(x)x˙=h(x) if it is a Lyapunov-stable equilibrium and every solution converges to it.

Formalization targets

Goal: Theorem 2.2 (almost sure convergence)

Under (A1), (A2) and (TS), if x˙=h(x)\dot x=h(x)x˙=h(x) has a unique globally asymptotically stable equilibrium x∗x^*x∗, then for every initial condition X(0)∈RdX(0)\in\mathbb R^dX(0)∈Rd,

X(n)⟶x∗almost surely.X(n)\longrightarrow x^* \qquad \text{almost surely.}X(n)⟶x∗almost surely.

The goal contains no constants and no rates, only the qualitative conclusion.

Milestone: Theorem 2.1 (i) (almost sure boundedness)

Under (A1), (A2) and (TS), for every initial condition,

sup⁡n∥X(n)∥<∞almost surely.\sup_n \|X(n)\| < \infty \qquad \text{almost surely.}nsup​∥X(n)∥<∞almost surely.

Milestones: the lemmas of Section 4.1

  • Lemma 4.1: the fluid-limit ODE is globally exponentially asymptotically stable.
  • Lemma 4.2: the piecewise ODE solutions ϕ^\hat\phiϕ^​, ϕ∞\phi^\inftyϕ∞ used for comparison are bounded by a constant independent of the initial condition.
  • Lemma 4.3 (i), (ii): two discrete Bellman–Gronwall inequalities.
  • Lemma 4.4: for large scale rrr, every solution of x˙=hr(x)\dot x = h_r(x)x˙=hr​(x) from the unit ball is ϵ\epsilonϵ-small on a window [T,T+1][T,T+1][T,T+1].
  • Lemma 4.5: the rescaled iterates have uniformly bounded second moments, and the rescaled noise sum ξ\xiξ is an L2L^2L2-bounded martingale.
  • Lemma 4.6: almost surely the rescaled interpolated iterates ϕ\phiϕ track ϕ^\hat\phiϕ^​ and stay bounded.

Significance

The result. Theorem 2.1 (i) turns the stability hypothesis of the O.D.E. method into a checkable condition on a deterministic ODE. Theorem 2.2 then gives convergence to x∗x^*x∗ with no a priori boundedness assumption. The paper applies this to reinforcement learning, obtaining the first convergence proof for asynchronous Q-learning and adaptive critic algorithms for average-cost Markov decision processes (the asynchronous extension, Theorem 2.5, is sketched in the paper and is not part of this mission). The same fluid-limit criterion is now a textbook tool; see Borkar, Stochastic Approximation: A Dynamical Systems Viewpoint (2008), Chapter 3.

Formalizing it. The theorems are proved in the paper, and the proofs are short but rely on several standard facts stated informally: uniform convergence of hrh_rhr​ to h∞h_\inftyh∞​ on compact sets, continuous dependence of ODE solutions on initial data and on the vector field, and the martingale convergence theorem. No machine-checked version of the O.D.E. method or of this stability criterion is known to exist. A formal development would give a verified link between discrete-time stochastic recursions, martingale convergence in Mathlib, and the stability theory of Lipschitz ODEs.

Difficulty

The obvious approach is to compare the iterates with solutions of x˙=h(x)\dot x = h(x)x˙=h(x) over windows of fixed ODE time and to control the accumulated noise by martingale convergence. This fails without boundedness: the noise bound in (A2) grows with ∥X(n)∥\|X(n)\|∥X(n)∥, so the deviation from the ODE can only be controlled relative to the current size of the iterate, and nothing prevents the iterates from escaping to infinity.

A second difficulty is that the hypothesis (A1) concerns only the fluid limit h∞h_\inftyh∞​, which describes the drift at infinite scale. It says nothing directly about hhh at any finite state, and nothing about the noise. Any argument therefore has to transfer information from the limit r→∞r\to\inftyr→∞ to the recursion at random, path-dependent scales, uniformly over those scales, while the noise is controlled only relative to the current size of the iterate. In Lean this involves ODE comparison and Gronwall estimates on a random partition of the time axis, conditional second-moment estimates for a rescaled recursion, and a vector-valued L2L^2L2 martingale convergence argument, none of which is available off the shelf for this setting.

Formalization scope

The state space is EuclideanSpace ℝ (Fin d). An ODE solution is a forward solution on [0,∞)[0,\infty)[0,∞): the derivative is taken within [0,∞)[0,\infty)[0,∞) at each t≥0t\ge0t≥0, which makes solutions continuous there. Stability notions are the standard ones (Lyapunov stability; asymptotic, global asymptotic and global exponential stability, the last in the form ∥x(t)−x∗∥≤be−δt∥x(0)−x∗∥\|x(t)-x^*\|\le b e^{-\delta t}\|x(0)-x^*\|∥x(t)−x∗∥≤be−δt∥x(0)−x∗∥). All vector fields in the mission are Lipschitz, so forward solutions exist and are unique, and quantifying over "every solution" is meaningful.

The filtration in (A2) is the natural filtration of the iterates. Because a(n)>0a(n)>0a(n)>0, it carries the same information as the paper's σ(X(i),M(i),i≤n)\sigma(X(i),M(i),i\le n)σ(X(i),M(i),i≤n). (A2) includes integrability of M(n+1)M(n+1)M(n+1) and ∥M(n+1)∥2\|M(n+1)\|^2∥M(n+1)∥2, so that the conditional expectations are meaningful. The theorems quantify over every probability space and every noise process satisfying (A2); the goal and Theorem 2.1 (i) take a deterministic initial condition, as the paper does. Stating the goal for a particular noise model (no noise, or i.i.d. noise) would be a different and much weaker theorem, and is ruled out. "sup⁡n∥X(n)∥<∞\sup_n\|X(n)\|<\inftysupn​∥X(n)∥<∞" is boundedness above of the set of norms, not a real supremum, which Lean sets to 000 on unbounded sets. Second-moment suprema in Lemma 4.5 are taken in [0,∞][0,\infty][0,∞].

The proof objects of Section 4.1 (time grid t(n)t(n)t(n), blocks m(j)m(j)m(j) and T(j)T(j)T(j), scales r(j)r(j)r(j), the interpolation ϕ\phiϕ, the rescaled iterates and noise sum) are separate definitions built from the step sizes and the sample path, as on the page. The piecewise ODE solutions ϕ^\hat\phiϕ^​ and ϕ∞\phi^\inftyϕ∞ are characterized by a predicate, and the lemmas hold for every function satisfying it.

Useful infrastructure, reusable beyond this mission: Lipschitz ODE comparison and continuous-dependence estimates in Mathlib's ODE library, uniform convergence of hrh_rhr​ on compact sets, the discrete Gronwall lemmas, and L2L^2L2-bounded vector-valued martingale convergence. Contributions are welcome on any milestone. The two Gronwall lemmas and Lemma 4.1 are self-contained entry points.

Selected references

  • V. S. Borkar and S. P. Meyn, The O.D.E. Method for Convergence of Stochastic Approximation and Reinforcement Learning, SIAM J. Control Optim. 38(2):447–469, 2000. https://doi.org/10.1137/S0363012997331639
  • H. Robbins and S. Monro, A Stochastic Approximation Method, Ann. Math. Statist. 22(3):400–407, 1951. https://doi.org/10.1214/aoms/1177729586
  • L. Ljung, Analysis of Recursive Stochastic Algorithms, IEEE Trans. Automat. Control 22(4):551–575, 1977. https://doi.org/10.1109/TAC.1977.1101561
  • H. J. Kushner and G. G. Yin, Stochastic Approximation Algorithms and Applications, Springer, 1997. https://doi.org/10.1007/978-1-4899-2696-8
  • J. G. Dai, On Positive Harris Recurrence of Multiclass Queueing Networks: A Unified Approach via Fluid Limit Models, Ann. Appl. Probab. 5(1):49–77, 1995. https://doi.org/10.1214/aoap/1177004828
  • J. G. Dai and S. P. Meyn, Stability and Convergence of Moments for Multiclass Queueing Networks via Fluid Limit Models, IEEE Trans. Automat. Control 40(11):1889–1904, 1995. https://doi.org/10.1109/9.471210
  • V. S. Borkar, Stochastic Approximation: A Dynamical Systems Viewpoint, Cambridge University Press / Hindustan Book Agency, 2008. https://doi.org/10.1007/978-93-86279-38-5
17 thms2 active usersReviewed
Machine LearningProbability·Captain: mikedeng1

Minimax Regret Bounds for Reinforcement Learning I: High-Probability Regret Bound for UCBVI with a Chernoff–Hoeffding BonusResearch Paper

Motivation

An agent learning to control an unknown environment must balance rewards it can collect now against information that improves later decisions. In a finite Markov decision process (MDP), every action changes the distribution of the next state, so a mistaken transition estimate can affect decisions many steps later. Regret measures this loss against a policy that already knows the transition probabilities. The paper of Azar, Osband and Munos gives high-probability regret bounds for two variants of upper confidence bound value iteration (UCBVI) in finite-horizon reinforcement learning. This mission targets its Chernoff–Hoeffding variant, UCBVI-CH, whose bonus depends only on the horizon and the visit count. Theorem 1 improves the paper's cited earlier dependence on the number of states from SSS to S\sqrt SS​ in the leading term for sufficiently many interactions. Azar, Osband and Munos, 2017, pp. 2, 4–5.

The paper was released in 2017 alongside work on the attainable dependence of episodic regret on the horizon HHH, state count SSS, action count AAA, and total interaction time TTT. Its second algorithm, UCBVI-BF, uses a variance-dependent bonus and is the subject of the next mission in this series. UCBVI-CH has a simpler bonus and its own explicit bound, making it a distinct mathematical target. Azar, Osband and Munos, 2017, pp. 1–5.

Setting

The state set S\mathcal SS and action set A\mathcal AA are finite and nonempty, with cardinalities SSS and AAA. A stationary transition kernel P(y∣x,a)P(y\mid x,a)P(y∣x,a) gives the probability of moving to state yyy after action aaa in state xxx; each row is nonnegative and sums to one. The known, deterministic reward R(x,a)R(x,a)R(x,a) lies in [0,1][0,1][0,1]. An episode lasts H≥1H\ge1H≥1 steps. The environment chooses its starting state xk,1x_{k,1}xk,1​ before episode kkk and may base that choice on earlier episodes. It cannot see the current episode's future random draws. Azar, Osband and Munos, 2017, §2 and Assumption 1, pp. 2–3.

A policy π\piπ selects an action from the current state and the step number. Its value Vhπ(x)V_h^\pi(x)Vhπ​(x) is the expected sum of rewards from step hhh through step HHH when starting in state xxx. The terminal value is VH+1π=0V_{H+1}^\pi=0VH+1π​=0, and Vh∗(x)V_h^*(x)Vh∗​(x) is the maximum of Vhπ(x)V_h^\pi(x)Vhπ​(x) over all such policies. Since the state, action and step sets are finite, this maximum is over a finite nonempty policy class. The paper's sentence describing H−hH-hH−h rewards uses a shifted terminal convention; this series follows the HHH reward steps of Algorithms 1–2. Azar, Osband and Munos, 2017, pp. 3–4.

At the start of episode kkk, UCBVI-CH forms visit counts Nk(x,a,y)N_k(x,a,y)Nk​(x,a,y) and Nk(x,a)N_k(x,a)Nk​(x,a) from earlier completed transitions. On a visited pair it uses the empirical row P^k(y∣x,a)=Nk(x,a,y)/Nk(x,a)\widehat P_k(y\mid x,a)=N_k(x,a,y)/N_k(x,a)Pk​(y∣x,a)=Nk​(x,a,y)/Nk​(x,a). Algorithm 2 computes values backward from zero at the terminal step. For a visited pair, Qk,h(x,a)Q_{k,h}(x,a)Qk,h​(x,a) is the minimum of the preceding episode's Qk−1,h(x,a)Q_{k-1,h}(x,a)Qk−1,h​(x,a), HHH, and the empirical Bellman value plus Algorithm 3's bonus. For an unvisited pair, Qk,h(x,a)=HQ_{k,h}(x,a)=HQk,h​(x,a)=H. A maximizing action is chosen at every state, including states outside the realized path. Azar, Osband and Munos, 2017, Algorithms 1–3, pp. 3–4.

Formalization targets

Theorem 1: UCBVI-CH regret

For KKK episodes and T=KHT=KHT=KH, regret sums the gap V1∗(xk,1)−V1πk(xk,1)V_1^*(x_{k,1})-V_1^{\pi_k}(x_{k,1})V1∗​(xk,1​)−V1πk​​(xk,1​). The goal is the paper's printed bound, with its constants:

Pr⁡ ⁣{Regret⁡(K)>20H3/2LSAK+250H2S2AL2}≤δ,L=ln⁡(5HSAT/δ),δ>0.\Pr\!\left\{\operatorname{Regret}(K)>20H^{3/2}L\sqrt{SAK}+250H^2S^2AL^2\right\}\le\delta, \qquad L=\ln(5HSAT/\delta),\quad \delta>0.Pr{Regret(K)>20H3/2LSAK​+250H2S2AL2}≤δ,L=ln(5HSAT/δ),δ>0.

Algorithm 3 itself uses Lalg=ln⁡(5SAT/δ)L_{\rm alg}=\ln(5SAT/\delta)Lalg​=ln(5SAT/δ) in its bonus 7HLalg/Nk(x,a)7HL_{\rm alg}/\sqrt{N_k(x,a)}7HLalg​/Nk​(x,a)​. Both logarithms remain as printed. The probability is over the MDP's next-state draws, for every admissible starting-state rule and every way of breaking ties between maximizing actions. Azar, Osband and Munos, 2017, Algorithm 3, p. 4; Theorem 1, p. 5.

Supporting results

Four milestones retain the source's indexed attack path: the Bernstein bound (9) for the empirical value error, the count-deviation display before (11), Lemma 18 on optimism, and the weighted recursion displayed in the proof of Lemma 3. The last milestone preserves the signed weights that appear before the paper's final simplification. Azar, Osband and Munos, 2017, pp. 17, 20–21, 28.

Significance

Theorem 1 gives a finite-sample failure probability with explicit dependence on H,S,A,KH,S,A,KH,S,A,K and δ\deltaδ. It covers a learner whose initial state can change between episodes, a feature that matters in episodic learning where the experimenter does not fix a single starting distribution. For the regime stated after Theorem 1, the leading rate is O~(HSAT)\widetilde O(H\sqrt{SAT})O(HSAT​). This is a result claimed by the paper; the present Lean declarations are open proof targets, not machine-checked proofs of that claim. Azar, Osband and Munos, 2017, p. 5.

Formalizing the result creates reusable finite objects for adaptive interaction: a constructed probability law on complete paths, empirical transition counts pooled across steps, a policy value defined by its expected reward, and confidence events with their domains stated explicitly. The concentration and optimism milestones can then be investigated independently of the final regret bound. The later UCBVI-BF mission uses the same paper's model with a different bonus. Azar, Osband and Munos, 2017, pp. 3–5, 14–17.

Difficulty

The visit count Nk(x,a)N_k(x,a)Nk​(x,a) is random and depends on earlier observations and decisions. A concentration inequality for a predetermined number of samples therefore does not immediately give a statement that holds at every episode start. The algorithm also reuses the previous episode's QQQ estimate through a minimum. Any optimism claim must account for this dependence across episodes as well as the backward dependence across steps. In the regret analysis, the terms called martingale differences can have either sign, so replacing a positive weight by a larger common bound can reverse an inequality. These are concrete obstacles to the printed chain of estimates. Azar, Osband and Munos, 2017, pp. 4, 17, 20–21, 28.

Formalization scope

States, actions, steps, episodes and complete outcome arrays are finite. Probabilities are finite sums of products of transition rows. The transition-row predicate is a published general definition; this mission defines the paper-specific reward-bounded MDP, policies, UCBVI-CH recursion, and path law on top of it. The starting-state rule can inspect only earlier episodes. Greedy tie-breaking is universally quantified. V∗V^*V∗ is a maximum over policies, and the bonus is read only at positive counts. A model that assigns an arbitrary probability law, fixes one starting state, or omits Algorithm 2's minimum does not represent this target. Azar, Osband and Munos, 2017, pp. 2–4.

Lean uses steps 0,…,H−10,\dots,H-10,…,H−1 and terminal index HHH in place of the paper's algorithmic 1,…,H+11,\dots,H+11,…,H+1. The appendix sometimes puts the terminal value at HHH. The weighted recursion therefore runs through the final reward step, rather than ending one step early. Its typical-state threshold is 4H2L4H^2L4H2L, as required by (34)–(36), whereas Appendix B.1 prints 2H2L2H^2L2H2L. The proof's correction term c4c_4c4​ dominates its other terms under A≥2A\ge2A≥2, which is made explicit in that milestone. The printed (11) loses a factor of two from the count display before it; only the preceding display is a milestone. Lemma 18 is stated under the empirical-model part of the confidence event and δ≤1\delta\le1δ≤1, the domain on which its bonus comparison holds. The weighted milestone retains its coefficients because the bracketed martingale terms can be negative. Azar, Osband and Munos, 2017, pp. 14–17, 20–21, 28.

The goal retains Theorem 1's constant 202020. Appendix C.1 cites Lemmas 15 and 18, but the sketch of Lemma 15 does not track that constant explicitly. Formalizing the printed bound may therefore expose a gap in its proof; the mission records the claim without weakening its constants. Contributions establishing or repairing the explicit bound, as well as the four stated milestones and reusable finite concentration results, are within scope. Azar, Osband and Munos, 2017, pp. 5, 27, 29.

Selected references

  • M. G. Azar, I. Osband and R. Munos, Minimax Regret Bounds for Reinforcement Learning, arXiv:1703.05449v2, 2017. Pinned preprint.
9 thms1 active userReviewed
Dynamical SystemsProbabilityStochastic Systems·Captain: mikedeng1

The O.D.E. Method for Convergence of Stochastic Approximation and Reinforcement Learning II: Mean-Square Error under Bounded StepsizesResearch Paper

Motivation

Stochastic approximation is the family of recursive algorithms that locate a zero of a vector field hhh from noisy evaluations of it. Temporal-difference learning, Q-learning, actor–critic methods and stochastic gradient descent are all instances. In practice these algorithms are often run with a constant or bounded, non-vanishing stepsize: the iterate keeps adapting to new data and never freezes, at the price of never converging exactly. The natural question for such a scheme is quantitative: how far from the target does the iterate stay in the long run, and how does that distance scale with the stepsize?

Borkar and Meyn (SIAM J. Control Optim. 38(2), 2000) answer both halves of the question under one set of hypotheses. First, stability of a "fluid" ODE obtained by scaling hhh at infinity implies that the iterates have bounded second moments, with no a priori boundedness or projection assumption. Second, if the ODE x˙=h(x)\dot x = h(x)x˙=h(x) has a globally exponentially stable equilibrium x∗x^*x∗, the asymptotic mean-square error is of the order of the largest stepsize. The first result replaced the usual stochastic-Lyapunov-function verification in reinforcement-learning applications (Section 3 of the paper). This mission formalizes the bounded-stepsize branch of the paper. A companion mission (… I: Stability and Almost-Sure Convergence under Tapering Stepsizes) covers the vanishing-stepsize branch.

Setting

Fix d≥1d \ge 1d≥1 and a Lipschitz vector field h:Rd→Rdh : \mathbb{R}^d \to \mathbb{R}^dh:Rd→Rd. The stochastic approximation recursion (1.1) is

X(n+1)=X(n)+a(n)[h(X(n))+M(n+1)],n≥0,X(n+1) = X(n) + a(n)\big[h(X(n)) + M(n+1)\big], \qquad n \ge 0,X(n+1)=X(n)+a(n)[h(X(n))+M(n+1)],n≥0,

with a deterministic step sequence {a(n)}\{a(n)\}{a(n)} and a noise sequence {M(n)}\{M(n)\}{M(n)} on a probability space (Ω,F,P)(\Omega, \mathcal F, \mathsf P)(Ω,F,P). The associated ODE (1.2) is x˙=h(x)\dot x = h(x)x˙=h(x).

  • The scaled fields are hr(x)=r−1h(rx)h_r(x) = r^{-1} h(rx)hr​(x)=r−1h(rx). Assumption (A1) asks that hhh be Lipschitz, that hr(x)→h∞(x)h_r(x) \to h_\infty(x)hr​(x)→h∞​(x) for every xxx as r→∞r \to \inftyr→∞, and that the origin be an asymptotically stable equilibrium of the fluid ODE x˙=h∞(x)\dot x = h_\infty(x)x˙=h∞​(x).
  • Let Fn=σ(X(0),…,X(n))\mathcal F_n = \sigma(X(0), \dots, X(n))Fn​=σ(X(0),…,X(n)). Assumption (A2) asks that {M(n)}\{M(n)\}{M(n)} be a martingale difference sequence, E[M(n+1)∣Fn]=0\mathsf E[M(n+1) \mid \mathcal F_n] = 0E[M(n+1)∣Fn​]=0, with conditional second moments E[∥M(n+1)∥2∣Fn]≤C0(1+∥X(n)∥2)\mathsf E[\|M(n+1)\|^2 \mid \mathcal F_n] \le C_0(1 + \|X(n)\|^2)E[∥M(n+1)∥2∣Fn​]≤C0​(1+∥X(n)∥2) for a constant C0C_0C0​.
  • Assumption (BS), bounded stepsizes: 0<α‾≤a(n)≤αˉ<10 < \underline\alpha \le a(n) \le \bar\alpha < 10<α​≤a(n)≤αˉ<1 for all nnn, with α‾<αˉ\underline\alpha < \bar\alphaα​<αˉ.
  • The error (2.2) is e(n)=∥X(n)−x∗∥e(n) = \|X(n) - x^*\|e(n)=∥X(n)−x∗∥.

An equilibrium x∗x^*x∗ of (1.2) is globally asymptotically stable if it is Lyapunov stable and attracts every solution. It is globally exponentially asymptotically stable if there are bbb and δ>0\delta > 0δ>0 with ∥x(t)−x∗∥≤b e−δt∥x(0)−x∗∥\|x(t) - x^*\| \le b\,e^{-\delta t}\|x(0) - x^*\|∥x(t)−x∗∥≤be−δt∥x(0)−x∗∥ for every solution.

The proofs compare the iterates with ODE solutions on a time grid: t(n)=∑i<na(i)t(n) = \sum_{i<n} a(i)t(n)=∑i<n​a(i), blocks T(j)=t(m(j))T(j) = t(m(j))T(j)=t(m(j)) of length about TTT, the interpolated path ψ\psiψ of the iterates, its rescaled version ϕj=ψ/r(j)\phi_j = \psi/r(j)ϕj​=ψ/r(j) with r(j)=max⁡(1,∥X(m(j))∥)r(j) = \max(1, \|X(m(j))\|)r(j)=max(1,∥X(m(j))∥), and the ODE solutions ψ^\hat\psiψ^​, ϕ^j\hat\phi_jϕ^​j​ restarted at each block.

Formalization targets

Goal: Theorem 2.3(ii)

Under (A1), (A2) and (BS), if x∗x^*x∗ is a globally asymptotically and globally exponentially asymptotically stable equilibrium of (1.2), there are α∗>0\alpha^* > 0α∗>0 and b2<∞b_2 < \inftyb2​<∞ such that for all 0<αˉ≤α∗0 < \bar\alpha \le \alpha^*0<αˉ≤α∗ and every initial condition X(0)X(0)X(0),

lim sup⁡n→∞E[e(n)2]≤b2 αˉ.\limsup_{n \to \infty} \mathsf E\big[e(n)^2\big] \le b_2\, \bar\alpha .n→∞limsup​E[e(n)2]≤b2​αˉ.

The constant b2b_2b2​ is uniform in the stepsizes and in X(0)X(0)X(0). No rate constant is fixed: only the linear dependence on αˉ\bar\alphaαˉ is asserted.

Milestones

  1. Lemma 4.7. For fixed T>0T > 0T>0 there is C2C_2C2​, independent of the stepsizes, with E[∥ϕj(t)−ϕ^j(t)∥2∣Fm(j)]≤C2αˉ\mathsf E[\|\phi_j(t) - \hat\phi_j(t)\|^2 \mid \mathcal F_{m(j)}] \le C_2\bar\alphaE[∥ϕj​(t)−ϕ^​j​(t)∥2∣Fm(j)​]≤C2​αˉ and E[∥ϕj(t)∥2∣Fm(j)]≤C2\mathsf E[\|\phi_j(t)\|^2 \mid \mathcal F_{m(j)}] \le C_2E[∥ϕj​(t)∥2∣Fm(j)​]≤C2​ on every block.
  2. Theorem 2.1(ii). There are α∗>0\alpha^* > 0α∗>0 and C1C_1C1​ with lim sup⁡nE∥X(n)∥2≤C1\limsup_n \mathsf E\|X(n)\|^2 \le C_1limsupn​E∥X(n)∥2≤C1​ whenever αˉ<α∗\bar\alpha < \alpha^*αˉ<α∗.
  3. Lemma 4.8. For αˉ≤α∗\bar\alpha \le \alpha^*αˉ≤α∗, sup⁡t≥0E∥ψ^(t)−ψ(t)∥2≤C3αˉ\sup_{t \ge 0} \mathsf E\|\hat\psi(t) - \psi(t)\|^2 \le C_3 \bar\alphasupt≥0​E∥ψ^​(t)−ψ(t)∥2≤C3​αˉ.

Significance

The result. Theorem 2.1(ii) says that a stability property of a deterministic ODE at infinity controls a stochastic recursion in mean square, uniformly over initial conditions. Theorem 2.3(ii) turns this into an error bound: with a non-vanishing stepsize the iterate does not converge, but its mean-square distance from x∗x^*x∗ is eventually O(αˉ)O(\bar\alpha)O(αˉ). This is the quantitative justification for constant-stepsize stochastic approximation in reinforcement learning and adaptive control, and it is the starting point of the trade-off between bias (small stepsize) and speed (large stepsize) discussed in Section 2.2 of the paper.

Formalizing it. The results are proved in the paper, partly by sketch: Lemma 4.8's proof refers to "familiar arguments using the Bellman–Gronwall lemma", and the paper writes several bounds as O(αˉ)O(\bar\alpha)O(αˉ). A formal proof makes every constant and its dependence explicit, which the paper's quantifier order leaves partly implicit (see the scope section). No machine-checked proof of these results, or of any stochastic-approximation stability theorem in this generality, is known to exist.

Difficulty

The natural first argument, that the iterates track the ODE and the ODE converges, needs the iterates to be bounded. Bounded iterates are exactly what is being proved, so the argument is circular. The paper breaks the circularity by rescaling: on each block the iterate is divided by r(j)r(j)r(j), so that on large scales it tracks the fluid ODE, whose stability contracts the norm by a fixed factor per block. Making this work in mean square requires conditional second-moment estimates that are uniform in the stepsize and the scale (Lemma 4.7). A second difficulty is that the stepsize does not vanish: the tracking error per block does not go to zero, and the goal's content is precisely that it is of order αˉ\bar\alphaαˉ with a constant that does not depend on αˉ\bar\alphaαˉ.

Formalization scope

  • The state space is EuclideanSpace ℝ (Fin d). ODE solutions are forward solutions: continuous on [0,∞)[0,\infty)[0,∞) with right derivatives. Stability notions are the standard ones, with exponential stability in the form the proof of Theorem 2.3(ii) uses.
  • The filtration is the natural filtration of the iterates. (A2) includes integrability of M(n+1)M(n+1)M(n+1) and ∥M(n+1)∥2\|M(n+1)\|^2∥M(n+1)∥2 so that the conditional expectations are meaningful. Each theorem quantifies over every probability space, every measurable process satisfying (1.1) and (A2), and every deterministic X(0)X(0)X(0).
  • Second moments, suprema and lim sup⁡\limsuplimsup are computed in [0,∞][0,\infty][0,∞], so a bound is a genuine finiteness claim.
  • Constant placement. α∗\alpha^*α∗, C1C_1C1​ and b2b_2b2​ depend only on hhh, h∞h_\inftyh∞​, C0C_0C0​ (and x∗x^*x∗). C2C_2C2​ depends in addition on TTT, and C3C_3C3​ on TTT and X(0)X(0)X(0). None depends on the stepsizes. Theorem 2.3's page text puts b2b_2b2​ after α\alphaα. Read literally, that would allow b2=C1/αˉb_2 = C_1/\bar\alphab2​=C1​/αˉ and make the goal a restatement of Theorem 2.1(ii). The formal goal fixes b2b_2b2​ before the stepsizes and the initial condition, as the proof (16C3αˉ16C_3\bar\alpha16C3​αˉ) gives. α∗\alpha^*α∗ is existential in Theorem 2.3(ii) and Lemma 4.8 rather than tied to Theorem 2.1(ii)'s witness.
  • The proof objects ψ^\hat\psiψ^​, ϕ^j\hat\phi_jϕ^​j​ are characterized by predicates (initial value, continuity, ODE on the block). Lemmas 4.7 and 4.8 hold for every function satisfying them.
  • Not included: Theorem 2.3(i) (its proof chooses a radius depending on αˉ\bar\alphaαˉ), Theorem 2.4 and the Markov-chain results of Section 4.3, and the asynchronous extension (Theorem 2.5). The deterministic ODE lemmas 4.1–4.4 belong to the companion mission.

Useful infrastructure, reusable beyond this mission: Bellman–Gronwall inequalities in discrete time (Lemma 4.3 of the paper), stability of scaled ODEs, and conditional second-moment estimates for martingale-difference-driven recursions. Contributions of any of these as separate lemmas are welcome.

Selected references

  • V. S. Borkar and S. P. Meyn, The O.D.E. Method for Convergence of Stochastic Approximation and Reinforcement Learning, SIAM J. Control Optim. 38(2):447–469, 2000. https://doi.org/10.1137/S0363012997331639
  • M. Benaïm, Dynamics of stochastic approximation algorithms, Séminaire de Probabilités XXXIII, Lecture Notes in Math. 1709, Springer, 1999. https://doi.org/10.1007/BFb0096509
  • H. J. Kushner and G. G. Yin, Stochastic Approximation and Recursive Algorithms and Applications, 2nd ed., Springer, 2003. https://doi.org/10.1007/b97441
7 thms1 active userReviewed
Machine LearningOptimization·Captain: mikedeng1

On the Theory of Policy Gradient Methods: Optimality, Approximation, and Distribution Shift 1: Projected Gradient Ascent on the Simplex Is ε-Optimal After 64γ|S||A|D∞²/((1−γ)⁶ε²) IterationsResearch Paper

Motivation

Policy gradient methods optimize a parameterized policy of a Markov decision process by gradient ascent on its expected discounted return. They are among the most widely used methods in reinforcement learning, from REINFORCE (Williams 1992) and the policy gradient theorem to natural policy gradient and trust-region methods. The objective is not concave in the policy, even when the policy is a raw table of action probabilities, so standard optimization theory guarantees at best convergence to a stationary point, and it was long unclear whether or how fast these methods find an optimal policy.

Agarwal, Kakade, Lee and Mahajan (JMLR 2021) give a systematic answer for the tabular and function-approximation settings. This mission formalizes their warm-up result, Theorem 4.1: projected gradient ascent over the simplex of stochastic policies reaches an ϵ\epsilonϵ-optimal policy after a number of iterations polynomial in the sizes of the MDP, the effective horizon 1/(1−γ)1/(1-\gamma)1/(1−γ), 1/ϵ1/\epsilon1/ϵ, and a distribution mismatch coefficient. The gradient domination idea it rests on goes back to the analysis of conservative policy iteration by Kakade and Langford (2002) and to Scherrer and Geist (2014).

Setting

A finite discounted MDP consists of finite sets S\mathcal SS of states and A\mathcal AA of actions, a transition kernel P(s′∣s,a)P(s'\mid s,a)P(s′∣s,a), rewards r(s,a)∈[0,1]r(s,a)\in[0,1]r(s,a)∈[0,1] and a discount factor γ∈[0,1)\gamma\in[0,1)γ∈[0,1). A policy π\piπ assigns to each state a probability distribution π(⋅∣s)\pi(\cdot\mid s)π(⋅∣s) over actions. Its value from a start state s0s_0s0​ is

Vπ(s0)=E[∑t=0∞γtr(st,at) ∣ s0],at∼π(⋅∣st), st+1∼P(⋅∣st,at),V^\pi(s_0)=\mathbb E\Big[\sum_{t=0}^\infty\gamma^t r(s_t,a_t)\,\Big|\,s_0\Big],\qquad a_t\sim\pi(\cdot\mid s_t),\ s_{t+1}\sim P(\cdot\mid s_t,a_t),Vπ(s0​)=E[t=0∑∞​γtr(st​,at​)​s0​],at​∼π(⋅∣st​), st+1​∼P(⋅∣st​,at​),

and for a start distribution ρ\rhoρ, Vπ(ρ)=∑sρ(s)Vπ(s)V^\pi(\rho)=\sum_s\rho(s)V^\pi(s)Vπ(ρ)=∑s​ρ(s)Vπ(s). The action value is Qπ(s,a)=r(s,a)+γ∑s′P(s′∣s,a)Vπ(s′)Q^\pi(s,a)=r(s,a)+\gamma\sum_{s'}P(s'\mid s,a)V^\pi(s')Qπ(s,a)=r(s,a)+γ∑s′​P(s′∣s,a)Vπ(s′) and the advantage is Aπ(s,a)=Qπ(s,a)−Vπ(s)A^\pi(s,a)=Q^\pi(s,a)-V^\pi(s)Aπ(s,a)=Qπ(s,a)−Vπ(s). The discounted state visitation distribution is dρπ(s)=(1−γ)∑t≥0γtPr⁡π(st=s∣s0∼ρ)d^\pi_\rho(s)=(1-\gamma)\sum_{t\ge0}\gamma^t\Pr^\pi(s_t=s\mid s_0\sim\rho)dρπ​(s)=(1−γ)∑t≥0​γtPrπ(st​=s∣s0​∼ρ). An optimal policy π⋆\pi^\starπ⋆ maximizes Vπ(s)V^\pi(s)Vπ(s) at every state simultaneously; V⋆=Vπ⋆V^\star=V^{\pi^\star}V⋆=Vπ⋆.

In the direct parameterization the parameter is the table itself, πs,a=π(a∣s)\pi_{s,a}=\pi(a\mid s)πs,a​=π(a∣s), a point of the product simplex Δ(A)∣S∣⊆RS×A\Delta(\mathcal A)^{|\mathcal S|}\subseteq\mathbb R^{\mathcal S\times\mathcal A}Δ(A)∣S∣⊆RS×A. The algorithm optimizes Vπ(μ)V^\pi(\mu)Vπ(μ) for a chosen start distribution μ\muμ by projected gradient ascent

π(t+1)=PΔ(A)∣S∣(π(t)+η∇πV(t)(μ)),\pi^{(t+1)}=P_{\Delta(\mathcal A)^{|\mathcal S|}}\big(\pi^{(t)}+\eta\nabla_\pi V^{(t)}(\mu)\big),π(t+1)=PΔ(A)∣S∣​(π(t)+η∇π​V(t)(μ)),

where PΔ(A)∣S∣P_{\Delta(\mathcal A)^{|\mathcal S|}}PΔ(A)∣S∣​ is the Euclidean projection and V(t)=Vπ(t)V^{(t)}=V^{\pi^{(t)}}V(t)=Vπ(t). Performance is measured under a possibly different distribution ρ\rhoρ, and the distribution mismatch coefficient ∥dρπ⋆/μ∥∞\|d^{\pi^\star}_\rho/\mu\|_\infty∥dρπ⋆​/μ∥∞​ (componentwise ratio) measures how well μ\muμ covers the states an optimal policy visits from ρ\rhoρ.

Formalization targets

Goal: Theorem 4.1

With step size η=(1−γ)3/(2γ∣A∣)\eta=(1-\gamma)^3/(2\gamma|\mathcal A|)η=(1−γ)3/(2γ∣A∣), from any initial policy, for every ρ∈Δ(S)\rho\in\Delta(\mathcal S)ρ∈Δ(S) and ϵ>0\epsilon>0ϵ>0,

min⁡t≤T{V⋆(ρ)−V(t)(ρ)}≤ϵwheneverT>64γ∣S∣∣A∣(1−γ)6ϵ2∥dρπ⋆μ∥∞2.\min_{t\le T}\big\{V^\star(\rho)-V^{(t)}(\rho)\big\}\le\epsilon\qquad\text{whenever}\qquad T>\frac{64\gamma|\mathcal S||\mathcal A|}{(1-\gamma)^6\epsilon^2}\Big\|\frac{d^{\pi^\star}_\rho}{\mu}\Big\|_\infty^2 .t≤Tmin​{V⋆(ρ)−V(t)(ρ)}≤ϵwheneverT>(1−γ)6ϵ264γ∣S∣∣A∣​​μdρπ⋆​​​∞2​.

Milestones, in the order of the proof

  1. Lemma 3.2 (performance difference): Vπ(s0)−Vπ′(s0)=11−γEs∼ds0πEa∼π(⋅∣s)[Aπ′(s,a)]V^\pi(s_0)-V^{\pi'}(s_0)=\frac1{1-\gamma}\mathbb E_{s\sim d^\pi_{s_0}}\mathbb E_{a\sim\pi(\cdot\mid s)}[A^{\pi'}(s,a)]Vπ(s0​)−Vπ′(s0​)=1−γ1​Es∼ds0​π​​Ea∼π(⋅∣s)​[Aπ′(s,a)].
  2. (7), the gradient of the direct parameterization: ∂Vπ(μ)/∂π(a∣s)=11−γdμπ(s)Qπ(s,a)\partial V^\pi(\mu)/\partial\pi(a\mid s)=\frac1{1-\gamma}d^\pi_\mu(s)Q^\pi(s,a)∂Vπ(μ)/∂π(a∣s)=1−γ1​dμπ​(s)Qπ(s,a).
  3. Lemma 4.1 (gradient domination): V⋆(ρ)−Vπ(ρ)≤11−γ∥dρπ⋆/μ∥∞max⁡πˉ(πˉ−π)⊤∇πVπ(μ)V^\star(\rho)-V^\pi(\rho)\le\frac1{1-\gamma}\|d^{\pi^\star}_\rho/\mu\|_\infty\max_{\bar\pi}(\bar\pi-\pi)^\top\nabla_\pi V^\pi(\mu)V⋆(ρ)−Vπ(ρ)≤1−γ1​∥dρπ⋆​/μ∥∞​maxπˉ​(πˉ−π)⊤∇π​Vπ(μ), together with the sharper form with dμπd^\pi_\mudμπ​ in place of (1−γ)μ(1-\gamma)\mu(1−γ)μ.
  4. Lemma D.3 (smoothness): ∥∇πVπ(s0)−∇πVπ′(s0)∥2≤2γ∣A∣(1−γ)3∥π−π′∥2\|\nabla_\pi V^\pi(s_0)-\nabla_\pi V^{\pi'}(s_0)\|_2\le\frac{2\gamma|\mathcal A|}{(1-\gamma)^3}\|\pi-\pi'\|_2∥∇π​Vπ(s0​)−∇π​Vπ′(s0​)∥2​≤(1−γ)32γ∣A∣​∥π−π′∥2​.
  5. Theorem E.1(3) (Beck 2017, Theorem 10.15): projected gradient descent with step 1/β1/\beta1/β on a β\betaβ-smooth function over a closed convex set has min⁡t<T∥Gη(xt)∥≤2β(f(x0)−f(x∗))/T\min_{t<T}\|G^\eta(x_t)\|\le\sqrt{2\beta(f(x_0)-f(x^*))}/\sqrt Tmint<T​∥Gη(xt​)∥≤2β(f(x0​)−f(x∗))​/T​, with GηG^\etaGη the gradient mapping.
  6. Proposition B.1: a gradient mapping of norm at most ϵ\epsilonϵ at π\piπ makes the next iterate π+\pi^+π+ ϵ(ηβ+1)\epsilon(\eta\beta+1)ϵ(ηβ+1)-stationary over feasible unit directions.

Significance

The theorem shows that, for the simplest constrained parameterization, a first-order method finds a globally optimal policy at a polynomial rate in spite of non-concavity. The guarantee holds for every performance distribution ρ\rhoρ at once, and it isolates the role of exploration in a single quantity, the mismatch coefficient; Section 4.3 of the paper shows that without a well-covering μ\muμ gradient methods can need exponentially many steps. Lemma 4.1 and the smoothness bound are reused across the rest of the paper, and the performance difference lemma underlies essentially all of its analyses.

All results here are proved in the paper, with Theorem E.1 and Theorem E.2 cited from Beck (2017) and Ghadimi–Lan (2016). None of them has a machine-checked proof on the platform. A formal development provides a verified link between the policy gradient expression of the direct parameterization and a standard nonconvex projected-gradient rate, and a reusable formal library of discounted visitation distributions, the performance difference identity, and projected gradient methods on Euclidean spaces.

Difficulty

The obvious argument, "projected gradient ascent converges to a stationary point, and stationary points are optimal", fails on both counts as stated. Stationary points of Vπ(μ)V^\pi(\mu)Vπ(μ) need not be optimal when μ\muμ does not cover the relevant states; the quantitative replacement is gradient domination, which only controls suboptimality through the mismatch coefficient. The convergence rate itself requires smoothness of the value as a function of the policy table, which is a bound on second derivatives of a matrix inverse (I−γPπ)−1(I-\gamma P_\pi)^{-1}(I−γPπ​)−1 with the dependence (1−γ)−3(1-\gamma)^{-3}(1−γ)−3 and the factor ∣A∣|\mathcal A|∣A∣ made explicit. Finally, the near-stationarity delivered by the gradient-mapping rate is at the next iterate, not the current one, which is why the conclusion is over t∈{0,…,T}t\in\{0,\dots,T\}t∈{0,…,T}. On the Lean side, the value is an infinite series in the policy entries, so its differentiability and the exact gradient formula have to be established for a function defined on the whole parameter space.

Formalization scope

Policies are parameter vectors in EuclideanSpace ℝ (S × A), so norms are ℓ2\ell_2ℓ2​ and Mathlib's gradient is ∇π\nabla_\pi∇π​; the objective π↦Vπ(μ)\pi\mapsto V^\pi(\mu)π↦Vπ(μ) is defined on the whole space and is only ever evaluated, with its gradient, at policies. The MDP layer (transition kernels, policies, VπV^\piVπ, QπQ^\piQπ, occupation distributions, optimal policies) is the published FoundationsML.ReinforcementLearning library; VπV^\piVπ is the unnormalized discounted sum. The projection is any map satisfying the nearest-point property. The optimal policy is a hypothesis IsOptimalPolicy (optimal from every state), not a supremum over all functions.

Conventions committed to:

  • The mismatch coefficient is any constant DDD with dρπ⋆(s)≤Dμ(s)d^{\pi^\star}_\rho(s)\le D\mu(s)dρπ⋆​(s)≤Dμ(s) for all sss; this avoids Lean's x/0=0x/0=0x/0=0 and is equivalent to the page's statement when the coefficient is finite.
  • γ>0\gamma>0γ>0 and ϵ>0\epsilon>0ϵ>0 are explicit hypotheses of the goal (the step size divides by γ\gammaγ, the threshold by ϵ\epsilonϵ).
  • The goal concludes ∃ t≤T\exists\,t\le T∃t≤T. The printed min⁡t<T\min_{t<T}mint<T​ fails at T=1T=1T=1 (one state, two actions with rewards 111 and 000, γ=0.001\gamma=0.001γ=0.001, ϵ=1/2\epsilon=1/2ϵ=1/2, initial policy on the bad action); the proof on p. 50 establishes the range 0≤t≤T0\le t\le T0≤t≤T.
  • Proposition B.1 bounds the directions feasible at π+\pi^+π+, as its proof does; Theorem E.1 assumes smoothness on CCC only and uses the radicand 2β(f(x0)−f(x∗))2\beta(f(x_0)-f(x^*))2β(f(x0​)−f(x∗)) of Beck and of p. 49.

A formalization that defines the update through formula (7), that assumes gradient domination or smoothness as hypotheses of the goal, or that takes the gradient off the simplex where the value series may diverge, would trivialize the goal; the goal mentions none of these, and (7) is a milestone theorem.

A complete development needs: summability and differentiability of the value series near the simplex; the performance difference lemma; the Euclidean projection inequality on a closed convex set; the descent lemma for functions smooth on a convex set; and the gradient-mapping argument. The projection and gradient-mapping results are independent of reinforcement learning and reusable. Contributions to any milestone are welcome, as are proofs of Theorem E.2 (Ghadimi–Lan) as a stepping stone to Proposition B.1.

Selected references

  • A. Agarwal, S. M. Kakade, J. D. Lee, G. Mahajan, On the Theory of Policy Gradient Methods: Optimality, Approximation, and Distribution Shift, JMLR 22(98), 2021; arXiv:1908.00261v5. https://arxiv.org/abs/1908.00261
  • A. Beck, First-Order Methods in Optimization, MOS-SIAM Series on Optimization, SIAM, 2017. https://doi.org/10.1137/1.9781611974997
  • S. Ghadimi, G. Lan, Accelerated gradient methods for nonconvex nonlinear and stochastic programming, Mathematical Programming 156, 2016. https://doi.org/10.1007/s10107-015-0871-8
  • S. Kakade, J. Langford, Approximately optimal approximate reinforcement learning, ICML 2002. https://dl.acm.org/doi/10.5555/645531.656005
  • B. Scherrer, M. Geist, Local Policy Search in a Convex Space and Conservative Policy Iteration as Boosted Policy Search, ECML PKDD 2014, pp. 35–50 (arXiv version: https://arxiv.org/abs/1306.1520)
  • R. J. Williams, Simple statistical gradient-following algorithms for connectionist reinforcement learning, Machine Learning 8, 1992. https://doi.org/10.1007/BF00992696
18 thms0 active usersReviewed
Operations ResearchProbabilityStochastic Systems·Captain: mikedeng1

Learning in Structured MDPs with Convex Cost Functions: Improved Regret Bounds for Inventory Management: Base-Stock Values from Any Two Starting States Differ by at Most 36 max(h,p)LxResearch Paper

Motivation

The lost-sales inventory problem with lead times is a basic model of operations management. A retailer reviews one product's stock each period and places an order that arrives LLL periods later. Demand that cannot be met from stock on hand is lost, and the retailer pays a holding cost hhh per unit left on the shelf and a penalty ppp per unit of lost demand. The optimal policy depends on the whole pipeline of outstanding orders, so the state space grows with LLL, and the problem is computationally hard for long lead times. Simple base-stock (order-up-to) policies are therefore the standard heuristic, and Huh, Janakiraman, Muckstadt and Rusmevichientong (Management Science 2009) showed they are asymptotically optimal as the lost-sales penalty grows.

Agrawal and Jia (arXiv:1905.04337) study the learning version, in which the demand distribution is unknown and only sales, not demands, are observed. They give an algorithm whose regret against the best base-stock policy is O~(LT)\tilde O(L\sqrt T)O~(LT​), improving the earlier bound of Zhang, Chao and Shi, which grows exponentially in LLL. The improvement rests on one structural fact: started from two different states, the base-stock system accumulates expected costs that differ by an amount linear in LLL and independent of the horizon. That fact, Lemma 2.5 of the paper, is the goal of this mission.

Setting

Fix a lead time L≥0L\ge 0L≥0 and a base-stock level xxx. A state is a vector s=(s(0),s(1),…,s(L))\mathbf s=(s(0),s(1),\dots,s(L))s=(s(0),s(1),…,s(L)) of real numbers. Its entry s(0)s(0)s(0) is the on-hand inventory after the current period's arrival, and s(1),…,s(L)s(1),\dots,s(L)s(1),…,s(L) are the outstanding orders, s(L)s(L)s(L) the most recent. Under a base-stock policy with level xxx the states lie in

Sx={s:s(i)≥0 for all i, ∑i=0Ls(i)=x}.\mathcal S^x=\Big\{\mathbf s : s(i)\ge 0\ \text{for all } i,\ \sum_{i=0}^{L}s(i)=x\Big\}.Sx={s:s(i)≥0 for all i, i=0∑L​s(i)=x}.

In each period ttt a demand dt≥0d_t\ge 0dt​≥0 is drawn, independently across periods, from a distribution FFF on [0,∞)[0,\infty)[0,∞). The sales are yt=min⁡{st(0),dt}y_t=\min\{s_t(0),d_t\}yt​=min{st​(0),dt​} and the on-hand inventory is It=st(0)I_t=s_t(0)It​=st​(0). The policy reorders exactly what was sold, so for L≥1L\ge 1L≥1 the next state is

st+1=(st(0)−yt+st(1), st(2), …, st(L), yt),\mathbf s_{t+1}=\big(s_t(0)-y_t+s_t(1),\ s_t(2),\ \dots,\ s_t(L),\ y_t\big),st+1​=(st​(0)−yt​+st​(1), st​(2), …, st​(L), yt​),

and for L=0L=0L=0 the state (x)(x)(x) never changes. The pseudo-cost of period ttt is Ctx=h(st(0)−yt)−p ytC^x_t=h(s_t(0)-y_t)-p\,y_tCtx​=h(st​(0)−yt​)−pyt​, and the value over horizon TTT from the start state s\mathbf ss is

VTx(s)=E[∑t=1TCtx ∣ s1=s].V^x_T(\mathbf s)=\mathbb E\Big[\sum_{t=1}^{T}C^x_t\ \Big|\ \mathbf s_1=\mathbf s\Big].VTx​(s)=E[t=1∑T​Ctx​ ​ s1​=s].

Along a demand path, nTx(s)=∑t=1Tytn^x_T(\mathbf s)=\sum_{t=1}^T y_tnTx​(s)=∑t=1T​yt​ is the total sales and mTx(s)=∑t=1TItm^x_T(\mathbf s)=\sum_{t=1}^T I_tmTx​(s)=∑t=1T​It​ the total on-hand inventory.

States are compared by the order of Definition B.1: s′⪰s\mathbf s'\succeq\mathbf ss′⪰s if s′−s=δ\mathbf s'-\mathbf s=\deltas′−s=δ with ∑iδi=0\sum_i\delta_i=0∑i​δi​=0 and some 0≤k≤L−10\le k\le L-10≤k≤L−1 such that δi≥0\delta_i\ge 0δi​≥0 for i≤ki\le ki≤k and δi≤0\delta_i\le 0δi​≤0 for i>ki>ki>k. Thus s′\mathbf s's′ holds the same total, shifted toward the shelf. The state s^=(x,0,…,0)\hat{\mathbf s}=(x,0,\dots,0)s^=(x,0,…,0) dominates every state of Sx\mathcal S^xSx.

Formalization targets

Goal: Lemma 2.5 (p. 8)

For every xxx, every horizon TTT, all costs h,p≥0h,p\ge 0h,p≥0, every demand law FFF and all s,s′∈Sx\mathbf s,\mathbf s'\in\mathcal S^xs,s′∈Sx,

VTx(s)−VTx(s′)≤36max⁡(h,p) L x.V^x_T(\mathbf s)-V^x_T(\mathbf s')\le 36\max(h,p)\,L\,x .VTx​(s)−VTx​(s′)≤36max(h,p)Lx.

The constant is the paper's printed one. The proof's last display gives 18(h+p)Lx18(h+p)Lx18(h+p)Lx, a stronger bound, which is deliberately not the goal.

Milestones (Appendix B and the proof of Lemma 2.5)

All of the following hold for L≥1L\ge 1L≥1, along any single demand path that drives both chains:

  1. Lemma B.2 (p. 20). If s1′⪰s1\mathbf s'_1\succeq\mathbf s_1s1′​⪰s1​ then for t≤L+1t\le L+1t≤L+1 the cumulative sales satisfy Yt′−Yt≤max⁡0≤k≤t−1(δ0+⋯+δk)Y'_t-Y_t\le\max_{0\le k\le t-1}(\delta_0+\dots+\delta_k)Yt′​−Yt​≤max0≤k≤t−1​(δ0​+⋯+δk​).
  2. Lemma B.3 (p. 20). If moreover It′≥ItI'_t\ge I_tIt′​≥It​ for t=1,…,L+1t=1,\dots,L+1t=1,…,L+1, then nT(sL+1′)=nT(sL+1)n_T(\mathbf s'_{L+1})=n_T(\mathbf s_{L+1})nT​(sL+1′​)=nT​(sL+1​) for every TTT.
  3. Lemma B.5 (p. 21). At the successive first crossing times σi,τi\sigma_i,\tau_iσi​,τi​ of Definition B.4, the state order alternates: sσi′⪰sσi\mathbf s'_{\sigma_i}\succeq\mathbf s_{\sigma_i}sσi​′​⪰sσi​​ and sτi′⪯sτi\mathbf s'_{\tau_i}\preceq\mathbf s_{\tau_i}sτi​′​⪯sτi​​ whenever these times exist.
  4. Lemma B.6 (p. 21). If s′⪰s\mathbf s'\succeq\mathbf ss′⪰s in Sx\mathcal S^xSx then ∣nTx(s′)−nTx(s)∣≤3x|n^x_T(\mathbf s')-n^x_T(\mathbf s)|\le 3x∣nTx​(s′)−nTx​(s)∣≤3x.
  5. Lemma B.7 (p. 23). If s′⪰s\mathbf s'\succeq\mathbf ss′⪰s in Sx\mathcal S^xSx then ∣mTx(s)−mTx(s′)∣≤6Lx|m^x_T(\mathbf s)-m^x_T(\mathbf s')|\le 6Lx∣mTx​(s)−mTx​(s′)∣≤6Lx.
  6. Proof of Lemma 2.5 (p. 9). s^⪰s\hat{\mathbf s}\succeq\mathbf ss^⪰s for every s∈Sx\mathbf s\in\mathcal S^xs∈Sx.
  7. Proof of Lemma 2.5 (p. 9). ∣VTx(s)−VTx(s^)∣≤9(h+p)Lx|V^x_T(\mathbf s)-V^x_T(\hat{\mathbf s})|\le 9(h+p)Lx∣VTx​(s)−VTx​(s^)∣≤9(h+p)Lx.

Significance

Lemma 2.5 bounds the dependence of the base-stock chain's finite-horizon cost on its starting state, uniformly in the horizon. In the paper it yields three consequences: the long-run average cost (the loss) of a base-stock policy does not depend on the initial state (Lemma 2.6), the bias of the chain is bounded by 36max⁡(h,p)Lx36\max(h,p)Lx36max(h,p)Lx (Lemma 2.8), and finite-horizon average costs concentrate around the loss (Lemma 2.10). These feed the regret bound of Theorem 1.3. The lemma is also a statement about the base-stock lost-sales system alone, without any learning, so it is of independent interest for coupling arguments on lost-sales chains.

The paper's proof is complete on paper, but nothing in it has a machine-checked proof. Neither the lost-sales base-stock chain with lead times started from an arbitrary pipeline state nor any of the coupling lemmas of Appendix B is formalized elsewhere. This mission produces a checked proof of the goal and of the pathwise comparison lemmas. Theorem 1.3 is not posed: its supporting lemmas rely on limits whose existence the paper settles only by an informal discretization (Remark 4).

Difficulty

The obvious argument couples the two chains on a common demand path and waits until they coalesce. Coalescence is guaranteed only after LLL consecutive periods of zero demand, an event of probability exponentially small in LLL, so this argument gives a bound exponential in LLL. That is the bound of earlier work.

The linear bound needs a finer pathwise accounting. The two coupled chains do not stay ordered: the one that starts with more inventory on the shelf sells more at first, then runs short and sells less. The order ⪰\succeq⪰ between the two states alternates along a sequence of times, and the sales gained in one phase must be shown to be lost again in the next, so that the cumulative difference stays bounded by a constant multiple of xxx for every horizon. Turning this alternation into a bound requires tracking how the pipeline vectors evolve between alternation times, including the boundary cases in which the chains coalesce or the horizon ends inside a phase.

Formalization scope

All declarations live in the namespace LostSalesLearning.ValueGap. A state is a function Fin (L + 1) → ℝ, a demand path is a function ℕ → ℝ≥0, and time is 0-based: traj s d 0 is the paper's s1\mathbf s_1s1​, traj s d t is st+1\mathbf s_{t+1}st+1​, and ∑t=1T\sum_{t=1}^T∑t=1T​ is a sum over Finset.range T. The demand law FFF is a probability measure on ℝ≥0, and the demand path has the product law Measure.infinitePi (fun _ => F). The value is the expectation of the summed pseudo-costs, which equals Definition 2.4 by the tower property and is the form used in the paper's proof.

Committed conventions:

  • The costs satisfy h≥0h\ge 0h≥0 and p≥0p\ge 0p≥0, the reading of "per unit holding cost and per unit lost sales penalty".
  • No assumption is placed on FFF. The paper's assumptions F(0)>0F(0)>0F(0)>0 and bounded demand belong to other results.
  • The goal holds for every L≥0L\ge 0L≥0; the Appendix B milestones carry L≥1L\ge 1L≥1, as Appendix B does.
  • The order ⪰\succeq⪰ is Definition B.1 verbatim, with the equal-sum clause and the split index k≤L−1k\le L-1k≤L−1.
  • The pathwise milestones quantify over every demand path and drive both chains with the same path.
  • The first crossing times of Definition B.4 are represented by alternationTimes; an absent next crossing is none.

Two trivializing formalizations are ruled out. A comparison of the two values on different or fixed demand paths would be a different statement: the goal compares two expectations under the same law, and each pathwise milestone uses one common path. A Bochner integral of a non-integrable function would be 000. The integrand here is measurable and bounded by T(h+p)xT(h+p)xT(h+p)x on Sx\mathcal S^xSx, so the values are genuine expectations.

A complete development needs the elementary dynamics of the chain, including invariance of Sx\mathcal S^xSx and the shift of trajectories, which is reusable for other lost-sales models. It also needs the alternation times of Definition B.4, and measurability of the trajectory in the demand path. Proofs of individual milestones, alternative proofs of the goal, and sharper constants as separate statements are all welcome.

Selected references

  • S. Agrawal and R. Jia, Learning in Structured MDPs with Convex Cost Functions: Improved Regret Bounds for Inventory Management, arXiv:1905.04337v1, 2019. https://arxiv.org/abs/1905.04337
  • W. T. Huh, G. Janakiraman, J. A. Muckstadt and P. Rusmevichientong, Asymptotic Optimality of Order-Up-To Policies in Lost Sales Inventory Systems, Management Science 55(3), 2009. https://doi.org/10.1287/mnsc.1080.0945
  • H. Zhang, X. Chao and C. Shi, Closing the Gap: A Learning Algorithm for Lost-Sales Inventory Systems with Lead Times, Management Science 66(5), 2020. https://doi.org/10.1287/mnsc.2019.3288
  • M. L. Puterman, Markov Decision Processes: Discrete Stochastic Dynamic Programming, Wiley, 1994. https://doi.org/10.1002/9780470316887
9 thms0 active usersReviewed
Machine LearningOperations ResearchOptimization·Captain: mikedeng1

Twice Regularized MDPs and the Equivalence Between Robustness and Regularization 2: The Greedy Policy of the R2 Optimal Value Is the Unique Optimal R2 PolicyResearch Paper

Motivation

A robust Markov decision process (robust MDP) evaluates a policy against the worst transition kernel and reward in an uncertainty set around a nominal model (P0,r0)(P_0, r_0)(P0​,r0​). It is the standard model for planning when the dynamics are estimated from data (Iyengar 2005; Nilim and El Ghaoui 2005; Wiesemann, Kuhn and Rustem 2013). Its Bellman update contains an inner optimization over the uncertainty set at every state, which makes robust planning costly when the sets are not (s,a)(s,a)(s,a)-rectangular.

Derman, Geist and Mannor (arXiv:2110.06267, NeurIPS 2021) show that, for sss-rectangular ball uncertainty sets, this inner optimization can be replaced by an explicit penalty that depends both on the policy and on the value function. The resulting twice regularized (R²) MDPs have Bellman operators with no inner optimization over models. The first mission of this series formalizes the robust–regularized equivalence (Theorem 4.1 of the paper). This mission formalizes Section 5: the R² Bellman operators are monotone and contracting under a bound on the transition radius, and the greedy policy of the R² optimal value is optimal.

Setting

Let S\mathcal SS and A\mathcal AA be finite nonempty sets of states and actions, γ∈(0,1)\gamma\in(0,1)γ∈(0,1) a discount factor, P0(s′∣s,a)P_0(s'\mid s,a)P0​(s′∣s,a) a transition kernel and r0(s,a)r_0(s,a)r0​(s,a) a reward. A policy π∈ΔAS\pi\in\Delta_{\mathcal A}^{\mathcal S}π∈ΔAS​ assigns to each state a probability distribution πs\pi_sπs​ on A\mathcal AA. For v∈RSv\in\mathbb R^{\mathcal S}v∈RS write qs(a)=r0(s,a)+γ∑s′P0(s′∣s,a)v(s′)q_s(a)=r_0(s,a)+\gamma\sum_{s'}P_0(s'\mid s,a)v(s')qs​(a)=r0​(s,a)+γ∑s′​P0​(s′∣s,a)v(s′) and

[T(P0,r0)πv](s)=∑aπs(a) qs(a).[T^\pi_{(P_0,r_0)}v](s)=\sum_a\pi_s(a)\,q_s(a).[T(P0​,r0​)π​v](s)=a∑​πs​(a)qs​(a).

All norms ∥⋅∥\|\cdot\|∥⋅∥ below are ℓ2\ell_2ℓ2​-norms, ∥a∥=(∑za(z)2)1/2\|a\|=\big(\sum_z a(z)^2\big)^{1/2}∥a∥=(∑z​a(z)2)1/2; ∥⋅∥∞\|\cdot\|_\infty∥⋅∥∞​ is the sup norm.

Fix nonnegative radii αsr,αsP\alpha^r_s,\alpha^P_sαsr​,αsP​ for each state. The R² regularizer is Ωv,R2(πs)=∥πs∥ (αsr+αsPγ∥v∥)\Omega_{v,\mathrm R^2}(\pi_s)=\|\pi_s\|\,(\alpha^r_s+\alpha^P_s\gamma\|v\|)Ωv,R2​(πs​)=∥πs​∥(αsr​+αsP​γ∥v∥), and the R² Bellman operators are

[Tπ,R2v](s)=[T(P0,r0)πv](s)−Ωv,R2(πs),[T∗,R2v](s)=max⁡π∈ΔAS[Tπ,R2v](s).[T^{\pi,\mathrm R^2}v](s)=[T^\pi_{(P_0,r_0)}v](s)-\Omega_{v,\mathrm R^2}(\pi_s),\qquad [T^{*,\mathrm R^2}v](s)=\max_{\pi\in\Delta^{\mathcal S}_{\mathcal A}}[T^{\pi,\mathrm R^2}v](s).[Tπ,R2v](s)=[T(P0​,r0​)π​v](s)−Ωv,R2​(πs​),[T∗,R2v](s)=π∈ΔAS​max​[Tπ,R2v](s).

A policy π\piπ is greedy for vvv when Tπ,R2v=T∗,R2vT^{\pi,\mathrm R^2}v=T^{*,\mathrm R^2}vTπ,R2v=T∗,R2v.

Assumption 5.1 (bounded radius). For each sss there is ϵs>0\epsilon_s>0ϵs​>0 with

αsP≤min⁡(1−γ−ϵsγ∣S∣ ; min⁡u∈R+A,∥u∥=1, w∈R+S,∥w∥=1 ∑a,s′u(a)P0(s′∣s,a)w(s′)),\alpha^P_s\le\min\Big(\frac{1-\gamma-\epsilon_s}{\gamma\sqrt{|\mathcal S|}}\ ;\ \min_{u\in\mathbb R^{\mathcal A}_+,\|u\|=1,\ w\in\mathbb R^{\mathcal S}_+,\|w\|=1}\ \sum_{a,s'}u(a)P_0(s'\mid s,a)w(s')\Big),αsP​≤min(γ∣S∣​1−γ−ϵs​​ ; u∈R+A​,∥u∥=1, w∈R+S​,∥w∥=1min​ a,s′∑​u(a)P0​(s′∣s,a)w(s′)),

and ϵ∗=min⁡sϵs\epsilon_*=\min_s\epsilon_sϵ∗​=mins​ϵs​. The R² value function vπ,R2v^{\pi,\mathrm R^2}vπ,R2 of a policy and the R² optimal value v∗,R2v^{*,\mathrm R^2}v∗,R2 are the fixed points of Tπ,R2T^{\pi,\mathrm R^2}Tπ,R2 and T∗,R2T^{*,\mathrm R^2}T∗,R2.

Formalization targets

Goal: Theorem 5.1 (p. 8)

Under Assumption 5.1, T∗,R2T^{*,\mathrm R^2}T∗,R2 and every Tπ,R2T^{\pi,\mathrm R^2}Tπ,R2 have unique fixed points; a greedy policy π∗,R2\pi^{*,\mathrm R^2}π∗,R2 for v∗,R2v^{*,\mathrm R^2}v∗,R2 exists, and every such policy satisfies

vπ∗,R2,R2=v∗,R2 ≥ vπ,R2for all π∈ΔAS;v^{\pi^{*,\mathrm R^2},\mathrm R^2}=v^{*,\mathrm R^2}\ \ge\ v^{\pi,\mathrm R^2}\qquad\text{for all }\pi\in\Delta^{\mathcal S}_{\mathcal A};vπ∗,R2,R2=v∗,R2 ≥ vπ,R2for all π∈ΔAS​;

every optimal policy is greedy; and when αsr>0\alpha^r_s>0αsr​>0 for all sss the greedy policy is unique, hence the unique optimal R² policy.

Milestones

  1. Proposition 2.1 (p. 3): for Ω\OmegaΩ strongly convex on the simplex, Ω∗(y)=max⁡a∈Δ⟨a,y⟩−Ω(a)\Omega^*(y)=\max_{a\in\Delta}\langle a,y\rangle-\Omega(a)Ω∗(y)=maxa∈Δ​⟨a,y⟩−Ω(a) is differentiable with Lipschitz gradient equal to the unique maximizer, satisfies Ω∗(y+c1)=Ω∗(y)+c\Omega^*(y+c\mathbb 1)=\Omega^*(y)+cΩ∗(y+c1)=Ω∗(y)+c, and is non-decreasing.
  2. Proposition 5.1 (i) (p. 8): v1≤v2v_1\le v_2v1​≤v2​ implies Tπ,R2v1≤Tπ,R2v2T^{\pi,\mathrm R^2}v_1\le T^{\pi,\mathrm R^2}v_2Tπ,R2v1​≤Tπ,R2v2​ and T∗,R2v1≤T∗,R2v2T^{*,\mathrm R^2}v_1\le T^{*,\mathrm R^2}v_2T∗,R2v1​≤T∗,R2v2​.
  3. Proposition 5.1 (iii) (p. 8):
∥Tπ,R2v1−Tπ,R2v2∥∞≤(1−ϵ∗)∥v1−v2∥∞,∥T∗,R2v1−T∗,R2v2∥∞≤(1−ϵ∗)∥v1−v2∥∞.\|T^{\pi,\mathrm R^2}v_1-T^{\pi,\mathrm R^2}v_2\|_\infty\le(1-\epsilon_*)\|v_1-v_2\|_\infty,\qquad \|T^{*,\mathrm R^2}v_1-T^{*,\mathrm R^2}v_2\|_\infty\le(1-\epsilon_*)\|v_1-v_2\|_\infty.∥Tπ,R2v1​−Tπ,R2v2​∥∞​≤(1−ϵ∗​)∥v1​−v2​∥∞​,∥T∗,R2v1​−T∗,R2v2​∥∞​≤(1−ϵ∗​)∥v1​−v2​∥∞​.

Significance

Theorem 5.1 is the R² counterpart of the fundamental theorem of discounted dynamic programming: optimal R² values are achieved by stationary policies obtained by a single greedy step. Together with the contraction of Proposition 5.1 (iii) it justifies the R² modified policy iteration algorithm of the paper, whose greedy step is a projection onto the simplex rather than a robust max–min problem. Combined with the first mission of the series, which identifies the robust value of an sss-rectangular ball-constrained MDP with the optimum of an R²-regularized program, it gives a route to robust planning at the cost of regularized planning.

The results are proved in the paper (App. C), partly by reference to Geist, Scherrer and Pietquin (2019) for the optimality operator. No machine-checked proof of any of them exists; this mission produces the first. Prop. 2.1 is a general fact of convex analysis (Danskin-type smoothness of a conjugate on the simplex) that is reusable for any regularized MDP or entropy-regularized game.

Difficulty

The R² evaluation operator is not affine: the value regularizer −αsPγ∥πs∥ ∥v∥-\alpha^P_s\gamma\|\pi_s\|\,\|v\|−αsP​γ∥πs​∥∥v∥ is concave in vvv and decreases as ∥v∥\|v\|∥v∥ grows. Monotonicity therefore does not follow from the positivity of P0P_0P0​ as in the standard case; it requires the second bound of Assumption 5.1, which compares the ℓ2\ell_2ℓ2​ variation of ∥v∥\|v\|∥v∥ with the minimal nonnegative bilinear form of P0(⋅∣s,⋅)P_0(\cdot\mid s,\cdot)P0​(⋅∣s,⋅). Likewise the contraction modulus is not γ\gammaγ but 1−ϵ∗1-\epsilon_*1−ϵ∗​, because the regularizer is ∣S∣\sqrt{|\mathcal S|}∣S∣​-Lipschitz between the ℓ2\ell_2ℓ2​ and sup norms. The optimality step of the classical proof uses linearity of TπT^\piTπ when comparing values of policies; here only monotonicity and contraction are available. Uniqueness of the greedy policy rests on strict concavity on the simplex, which holds only when the regularization weight is positive.

Formalization scope

States and actions are finite nonempty types; transitions are arrays P₀ : S → A → S → ℝ with the published predicate IsTransitionKernel; value functions are S → ℝ with the pointwise order. The ℓ2\ell_2ℓ2​-norm is an explicit l2norm (Mathlib's norm on S → ℝ is the sup norm, used only for ∥⋅∥∞\|\cdot\|_\infty∥⋅∥∞​). T∗,R2v(s)T^{*,\mathrm R^2}v(s)T∗,R2v(s) is the real supremum over the simplex ΔA\Delta_{\mathcal A}ΔA​ (attained), and the inner minimum of Assumption 5.1 is the real infimum over nonnegative ℓ2\ell_2ℓ2​-unit vectors; the witnesses ϵs\epsilon_sϵs​ are explicit. Greedy policies are a predicate, never a function, and the R² value functions are not defined by choice: the goal asserts their existence and uniqueness and speaks about the fixed points.

Disclosed deviations from the page. Assumption 5.1 is a hypothesis of Theorem 5.1 (its proof assumes it). The uniqueness clause of Theorem 5.1 additionally assumes αsr>0\alpha^r_s>0αsr​>0 for all sss: with one state, two actions, zero reward and zero radii every policy is greedy and optimal. Proposition 2.1 assumes Ω\OmegaΩ continuous on the simplex, without which the maximum need not be attained, and strong convexity is Mathlib's StrongConvexOn for some modulus (norm-independent in finite dimension). Proposition 5.1 (ii) is false as printed and is not drafted: with one state, one action, P0=1P_0=1P0​=1, r0=0r_0=0r0​=0, γ=1/2\gamma=1/2γ=1/2, αr=0\alpha^r=0αr=0, αP=1/2\alpha^P=1/2αP=1/2, ϵ=1/4\epsilon=1/4ϵ=1/4, one has Tv=v/2−∣v∣/4Tv=v/2-|v|/4Tv=v/2−∣v∣/4, and v1=−1v_1=-1v1​=−1, c=1c=1c=1 give T(v1+c)=0>−1/4=Tv1+γcT(v_1+c)=0>-1/4=Tv_1+\gamma cT(v1​+c)=0>−1/4=Tv1​+γc. Remark 5.1, Algorithm 1 and the ℓp\ell_pℓp​ variant of App. C.1 are out of scope. The inner minimum of Assumption 5.1 is 000 whenever some P0(s′∣s,a)=0P_0(s'\mid s,a)=0P0​(s′∣s,a)=0, forcing αsP=0\alpha^P_s=0αsP​=0; this is the assumption as printed.

A formalization in which ∥⋅∥\|\cdot\|∥⋅∥ is the sup norm, the inner minimum ranges over all unit vectors (making the assumption unsatisfiable), or the value functions are postulated rather than shown to exist would be trivial or wrong; the drafted statements avoid all three. Contributions welcome: Prop. 2.1 as a general convex-analysis lemma, Banach fixed-point plumbing for S → ℝ with the sup norm, and the strict concavity of p↦⟨p,q⟩−c∥p∥p\mapsto\langle p,q\rangle-c\|p\|p↦⟨p,q⟩−c∥p∥ on the simplex.

Selected references

  • E. Derman, M. Geist, S. Mannor, Twice regularized MDPs and the equivalence between robustness and regularization, NeurIPS 2021. arXiv:2110.06267v1
  • M. Geist, B. Scherrer, O. Pietquin, A theory of regularized Markov decision processes, ICML 2019. arXiv:1901.11275
  • A. Nilim, L. El Ghaoui, Robust control of Markov decision processes with uncertain transition matrices, Operations Research 53(5), 2005. doi:10.1287/opre.1050.0216
  • G. N. Iyengar, Robust dynamic programming, Mathematics of Operations Research 30(2), 2005. doi:10.1287/moor.1040.0129
  • W. Wiesemann, D. Kuhn, B. Rustem, Robust Markov decision processes, Mathematics of Operations Research 38(1), 2013. doi:10.1287/moor.1120.0566
  • A. Mensch, M. Blondel, Differentiable dynamic programming for structured prediction and attention, ICML 2018. arXiv:1802.03676
9 thms0 active usersReviewed
Markov ChainProbability·Captain: mikedeng1

Linear Least-Squares Algorithms for Temporal Difference Learning II: Probability-One Convergence of LS TD on Ergodic Markov ChainsResearch Paper

Motivation

Temporal-difference (TD) learning estimates the value function of a Markov chain — the expected discounted sum of future rewards from each state — from a single stream of observed transitions, without knowing the transition probabilities. With a linear function approximator the value of state xxx is represented as ϕx′θ\phi_x'\thetaϕx′​θ for a feature vector ϕx\phi_xϕx​ and a parameter θ\thetaθ. Classical TD(λ\lambdaλ) updates θ\thetaθ by stochastic approximation, and its behaviour depends on a step-size schedule that must be tuned.

Bradtke and Barto (Machine Learning 22, 1996) replaced the stochastic-approximation update by a least-squares solve: LS TD (Eq. (11)) recomputes θt\theta_tθt​ at every step as the instrumental-variable least-squares solution of the empirical consistency condition. The method, later generalized as LSTD(λ\lambdaλ) by Boyan (Machine Learning 49, 2002), is the basis of least-squares policy iteration and of the "LSTD" methods in standard reinforcement-learning texts (Sutton and Barto, Reinforcement Learning, 2nd ed., 2018, §9.8). Its appeal is that it has no step size; the question this mission formalizes is whether it nonetheless converges, with probability one, to the true parameter.

Timeline. Sutton (1988) introduced TD(λ\lambdaλ). Watkins and Dayan (1992) and Tsitsiklis (1994) proved probability-one convergence of tabular TD(0) and Q-learning. Bradtke and Barto (1996) proved probability-one convergence of LS TD on absorbing chains (Theorem 1) and on ergodic chains (Theorem 2). Tsitsiklis and Van Roy (IEEE TAC 42, 1997) proved convergence of linear TD(λ\lambdaλ) with general features on ergodic chains.

Setting

A finite Markov chain on a finite nonempty set XXX is a matrix PPP with P(x,y)≥0P(x,y)\ge0P(x,y)≥0 and ∑yP(x,y)=1\sum_yP(x,y)=1∑y​P(x,y)=1. A transition x→yx\to yx→y earns reward R(x,y)R(x,y)R(x,y); the expected reward out of xxx is rˉx=∑yP(x,y)R(x,y)\bar r_x=\sum_yP(x,y)R(x,y)rˉx​=∑y​P(x,y)R(x,y). For a discount factor γ\gammaγ the value function is

V(x)=E{∑k=0∞γkrk ∣ x0=x}=∑k=0∞γk(Pkrˉ)(x).V(x)=E\Big\{\sum_{k=0}^\infty\gamma^kr_k\ \Big|\ x_0=x\Big\}=\sum_{k=0}^\infty\gamma^k(P^k\bar r)(x).V(x)=E{k=0∑∞​γkrk​ ​ x0​=x}=k=0∑∞​γk(Pkrˉ)(x).

The chain is ergodic (Kemeny and Snell) if every state can be reached from every state: for all x,yx,yx,y there is nnn with Pn(x,y)>0P^n(x,y)>0Pn(x,y)>0. An invariant distribution is a probability vector π\piπ with πP=π\pi P=\piπP=π; write Π=diag⁡(π)\Pi=\operatorname{diag}(\pi)Π=diag(π).

Each state has a feature vector ϕx∈Rm\phi_x\in\mathbb R^mϕx​∈Rm; Φ\PhiΦ is the matrix with rows ϕx\phi_xϕx​. The true parameter θ∗\theta^*θ∗ is a vector with V(x)=ϕx′θ∗V(x)=\phi_x'\theta^*V(x)=ϕx′​θ∗ for all xxx.

The algorithm (Figure 3) starts at an arbitrary state x0x_0x0​, lets the chain move x0→x1→⋯x_0\to x_1\to\cdotsx0​→x1​→⋯, and after ttt transitions computes

θt=[1t∑kϕxk(ϕxk−γϕxk+1)′]−1[1t∑kϕxkR(xk,xk+1)],(11)\theta_t=\Big[\frac1t\sum_{k}\phi_{x_k}(\phi_{x_k}-\gamma\phi_{x_{k+1}})'\Big]^{-1}\Big[\frac1t\sum_k\phi_{x_k}R(x_k,x_{k+1})\Big],\tag{11}θt​=[t1​k∑​ϕxk​​(ϕxk​​−γϕxk+1​​)′]−1[t1​k∑​ϕxk​​R(xk​,xk+1​)],(11)

the sums running over the ttt transitions observed so far.

Formalization targets

Goal: Theorem 2 (p. 44)

If PPP is ergodic, (1) {ϕx}\{\phi_x\}{ϕx​} is linearly independent, (2) each ϕx\phi_xϕx​ has dimension ∣X∣|X|∣X∣, and (3) 0<γ<10<\gamma<10<γ<1, then θ∗\theta^*θ∗ is finite and, from any initial law,

θt⟶θ∗with probability 1.\theta_t\longrightarrow\theta^*\qquad\text{with probability }1 .θt​⟶θ∗with probability 1.

The goal leaves the chain, the rewards, the features and the initial law arbitrary.

Milestones, in the order of the proof

  1. Visit frequencies (Proof of Theorem 2, p. 45): an ergodic chain visits every state infinitely often and #{k<t:xk=x}/t→πx\#\{k<t:x_k=x\}/t\to\pi_x#{k<t:xk​=x}/t→πx​ almost surely.
  2. Invertibility (Proof of Theorem 2, p. 45): πx>0\pi_x>0πx​>0 for all xxx, and Φ′Π(I−γP)Φ\Phi'\Pi(I-\gamma P)\PhiΦ′Π(I−γP)Φ is invertible.
  3. The pathwise limit (Proof of Lemma 5, pp. 54–55): along any path whose transition frequencies converge to πxP(x,y)\pi_xP(x,y)πx​P(x,y), θt→[Φ′Π(I−γP)Φ]−1[Φ′Πrˉ]\theta_t\to[\Phi'\Pi(I-\gamma P)\Phi]^{-1}[\Phi'\Pi\bar r]θt​→[Φ′Π(I−γP)Φ]−1[Φ′Πrˉ].
  4. Lemma 5 (p. 43): for any chain, if almost surely every state is visited infinitely often and in proportion π\piπ, and Φ′Π(I−γP)Φ\Phi'\Pi(I-\gamma P)\PhiΦ′Π(I−γP)Φ is invertible, then θt→[Φ′Π(I−γP)Φ]−1[Φ′Πrˉ]\theta_t\to[\Phi'\Pi(I-\gamma P)\Phi]^{-1}[\Phi'\Pi\bar r]θt​→[Φ′Π(I−γP)Φ]−1[Φ′Πrˉ] almost surely.
  5. Eq. (12) (p. 44): the value series converges and rˉ=(I−γP)Φθ∗\bar r=(I-\gamma P)\Phi\theta^*rˉ=(I−γP)Φθ∗.

Significance

The result. Theorem 2 shows that an LS TD learner running on one long trajectory recovers the exact value function whenever the features can represent every function on the states, with no step-size schedule. It is the step-size-free counterpart of the tabular TD(0) convergence theorems and the starting point for the later analysis of LSTD with fewer features than states, where the limit is the TD fixed point [Φ′Π(I−γP)Φ]−1Φ′Πrˉ[\Phi'\Pi(I-\gamma P)\Phi]^{-1}\Phi'\Pi\bar r[Φ′Π(I−γP)Φ]−1Φ′Πrˉ rather than θ∗\theta^*θ∗. Lemma 5 is the general identification of that fixed point as the almost-sure limit of LSTD.

Formalizing it. The result is proved in the paper; it has not been machine-checked. A formalization adds three things the paper delegates: the strong law of large numbers for occupation times of a finite irreducible Markov chain, which the paper cites to Kemeny and Snell and which is not in Mathlib; the per-state transition frequencies used in the first sentence of the proof of Lemma 5; and the linear algebra of the limit. The first is reusable well beyond reinforcement learning.

Difficulty

The algebra is short once the empirical averages in (11) are known to converge. The difficulty is probabilistic: the averages are over a dependent sequence, so the ordinary strong law of large numbers does not apply. Two facts are needed: that the fraction of time in each state converges to πx\pi_xπx​ almost surely for any starting law, including periodic chains, where PnP^nPn itself does not converge; and that, among the visits to xxx, the fraction followed by a move to yyy converges to P(x,y)P(x,y)P(x,y), which needs the strong Markov property at successive visit times. Neither follows from convergence of the chain's distribution, and neither holds for a chain started at a fixed state without an argument that every state is reached.

Formalization scope

  • The model is a finite state type X with Fintype, DecidableEq, Nonempty, a row-stochastic matrix P : Matrix X X ℝ (structure Chain), rewards R : X → X → ℝ, features φ : X → Fin m → ℝ. Condition (2) is m = Fintype.card X; condition (1) is LinearIndependent ℝ φ.
  • "Ergodic" is read as irreducible, periodic chains allowed (Kemeny–Snell's aperiodic case is "regular"). "Arbitrary initial state" is read as every initial law ν\nuν, which contains every point mass.
  • The path is any process ZZZ on any probability space whose finite-dimensional distributions are ν(x0)P(x0,x1)⋯P(xn−1,xn)\nu(x_0)P(x_0,x_1)\cdots P(x_{n-1},x_n)ν(x0​)P(x0​,x1​)⋯P(xn−1​,xn​), with measurable events {Zt=x}\{Z_t=x\}{Zt​=x}.
  • VVV is the discounted series, never (I−γP)−1rˉ(I-\gamma P)^{-1}\bar r(I−γP)−1rˉ; Lean's tsum is 000 on a divergent series, so "θ* is finite" is stated as convergence of the series together with existence of θ∗\theta^*θ∗ with V=Φθ∗V=\Phi\theta^*V=Φθ∗. θ∗\theta^*θ∗ is existential, never defined as Lemma 5's limit.
  • (11) uses the transitions k=0,…,t−1k=0,\dots,t-1k=0,…,t−1 (the paper prints k=1,…,tk=1,\dots,tk=1,…,t with ϕt+1\phi_{t+1}ϕt+1​; an index shift), keeps the factors 1/t1/t1/t, and uses Lean's matrix inverse, which is 000 on a singular matrix: the paper notes θt\theta_tθt​ is undefined for small ttt, and finitely many junk values do not affect convergence. No εI\varepsilon IεI regularization, no pseudo-inverse.
  • θLSTD=lim⁡tθt\theta_{\rm LSTD}=\lim_t\theta_tθLSTD​=limt​θt​ is formalized as convergence of θt\theta_tθt​ (existence of the limit is part of the claim).
  • The convergence is almost sure. A formalization that assumes the visit frequencies converge in the goal, starts the chain from π\piπ, or weakens the conclusion to convergence in probability or along a subsequence is a different theorem.

Needed infrastructure: the strong law for occupation times of a finite irreducible chain under an arbitrary initial law (milestone 1), the strong Markov property at visit times, positivity of the invariant distribution of an irreducible chain, and the invertibility of I−γPI-\gamma PI−γP for ∣γ∣<1|\gamma|<1∣γ∣<1. Contributions to any of these, as standalone lemmas, are welcome.

Selected references

  • S. J. Bradtke and A. G. Barto, Linear Least-Squares Algorithms for Temporal Difference Learning, Machine Learning 22, 33–57, 1996. https://doi.org/10.1023/A:1018056104778
  • J. G. Kemeny and J. L. Snell, Finite Markov Chains, Springer, 1976.
  • J. A. Boyan, Technical Update: Least-Squares Temporal Difference Learning, Machine Learning 49, 233–246, 2002. https://doi.org/10.1023/A:1017936530646
  • J. N. Tsitsiklis and B. Van Roy, An Analysis of Temporal-Difference Learning with Function Approximation, IEEE Transactions on Automatic Control 42(5), 674–690, 1997. https://doi.org/10.1109/9.580874
  • R. S. Sutton and A. G. Barto, Reinforcement Learning: An Introduction, 2nd ed., MIT Press, 2018. http://incompleteideas.net/book/the-book-2nd.html
8 thms0 active usersReviewed
Markov ChainProbability·Captain: mikedeng1

Linear Least-Squares Algorithms for Temporal Difference Learning I: Probability-One Convergence of Trial-Based LS TD on Absorbing Markov ChainsResearch Paper

Motivation

Temporal-difference learning estimates the value of a policy from observed state transitions and rewards. In a finite Markov decision process, fixing a policy produces a Markov chain, so policy evaluation becomes the task of estimating the expected return from each state. Bradtke and Barto's 1996 paper introduced a least-squares temporal-difference method, LS TD, that uses each observed transition in a linear system instead of selecting a learning-rate schedule. Their Theorem 1 states probability-one convergence for trials that end at absorbing states under explicit conditions on state access, rewards, and features. This mission formalizes that result and the statements the authors use to reach it. Bradtke and Barto, 1996.

The result matters for episodic policy evaluation: a learner may collect many short trajectories, each begun from a prescribed start distribution, and update the same estimate as data accumulate. The theorem identifies conditions under which the limit is the true value parameter even when the discount factor is one. That endpoint is useful for undiscounted tasks ending in an absorbing goal state; it also makes the convergence claim more delicate than the standard discounted case. The paper proves the result mathematically. The Lean statements in this mission are targets for machine-checked proofs, not claims of proofs already present in Mathlib. Bradtke and Barto, Theorem 1, pp. 43–44.

Setting

Let XXX be a finite, nonempty set of states. After a policy is fixed, P(x,y)P(x,y)P(x,y) is the probability of a transition from xxx to yyy, so each row of PPP is nonnegative and sums to one. A transition earns a deterministic real reward R(x,y)R(x,y)R(x,y). A state is absorbing when P(x,x)=1P(x,x)=1P(x,x)=1; let T\mathcal TT be the absorbing states and N=X∖T\mathcal N=X\setminus\mathcal TN=X∖T the others. The chain is absorbing when some absorbing state can be reached with positive probability from every state. A start distribution SSS gives the state at the beginning of each trial. No state is inaccessible when every state can be reached from the positive support of SSS.

For a discount γ\gammaγ, the expected immediate reward is rˉ(x)=∑yP(x,y)R(x,y)\bar r(x)=\sum_yP(x,y)R(x,y)rˉ(x)=∑y​P(x,y)R(x,y). The true value function is defined by the expected return

V(x)=∑k=0∞γk(Pkrˉ)(x).V(x)=\sum_{k=0}^{\infty}\gamma^k(P^k\bar r)(x).V(x)=k=0∑∞​γk(Pkrˉ)(x).

A feature vector ϕx∈Rm\phi_x\in\mathbb R^mϕx​∈Rm represents state xxx. The matrix Φ\PhiΦ has row xxx equal to ϕx⊤\phi_x^\topϕx⊤​. The target parameter θ∗\theta^*θ∗ is a vector for which V(x)=ϕx⊤θ∗V(x)=\phi_x^\top\theta^*V(x)=ϕx⊤​θ∗ at every state; it is something the theorem must establish, not an input chosen by a formula. Equation (11) forms an LS TD estimate θn\theta_nθn​ from the observed feature differences and rewards. Bradtke and Barto, §2, Table 1, Eq. (11).

Figure 2 collects trials. Each starts from SSS, follows PPP while the current state is non-absorbing, and ends upon entry into T\mathcal TT. The next trial starts with a fresh draw from SSS. The estimator includes transitions taken within trials; a draw that starts the next trial is not an observed transition for Eq. (11). Bradtke and Barto, Figure 2, p. 42.

Formalization targets

Theorem 1: convergence of trial-based LS TD

If every state is accessible from SSS, rewards between absorbing states vanish, the feature vectors on N\mathcal NN are linearly independent, features on T\mathcal TT are zero, m=∣N∣m=|\mathcal N|m=∣N∣, and 0≤γ≤10\le\gamma\le10≤γ≤1, then the expected-return series converges and there is a parameter θ∗\theta^*θ∗ satisfying

V(x)=ϕx⊤θ∗(x∈X),θn⟶θ∗with probability one.V(x)=\phi_x^\top\theta^*\quad(x\in X),\qquad \theta_n\longrightarrow\theta^*\quad\text{with probability one}.V(x)=ϕx⊤​θ∗(x∈X),θn​⟶θ∗with probability one.

The theorem keeps the paper's endpoint γ=1\gamma=1γ=1. The return series' convergence is explicit because a real infinite sum in Lean has a default value when it diverges. Bradtke and Barto, Theorem 1, p. 43.

Supporting targets

The milestone list follows the statements used in the paper: almost-sure visits and departure proportions for the trials; invertibility of the non-absorbing block of I−γPI-\gamma PI−γP; invertibility of Φ⊤Π(I−γP)Φ\Phi^\top\Pi(I-\gamma P)\PhiΦ⊤Π(I−γP)Φ for positive non-absorbing weights; Lemma 5's probability-one limit [Φ⊤Π(I−γP)Φ]−1Φ⊤Πrˉ[\Phi^\top\Pi(I-\gamma P)\Phi]^{-1}\Phi^\top\Pi\bar r[Φ⊤Π(I−γP)Φ]−1Φ⊤Πrˉ; and Eq. (12), rˉ=(I−γP)Φθ∗\bar r=(I-\gamma P)\Phi\theta^*rˉ=(I−γP)Φθ∗, together with finiteness of the true parameter. Here Π=diag⁡(π)\Pi=\operatorname{diag}(\pi)Π=diag(π). Bradtke and Barto, Lemma 5, p. 43; Proof of Theorem 1, p. 44.

Significance

Theorem 1 identifies the target of the asymptotic LS TD estimate: the value function defined from rewards, rather than merely a vector satisfying a sampled linear system. It covers an undiscounted absorbing chain, where a general fixed-point equation for values would fail to determine the values of absorbing states. The zero-reward and zero-feature conditions determine that boundary correctly. The result also explains the dimension condition: one independent feature vector for each non-absorbing state permits exact representation of the return. Bradtke and Barto, pp. 43–44.

A complete formal development would connect finite-state stochastic-process laws, visit frequencies, matrix limits, and the return-defined value function in one checked statement. The reusable parts include a finite row-stochastic chain model, a path-law description of restarts, a filtered least-squares estimator, and results about transient blocks of stochastic matrices. The paper's mathematical proof exists; this mission asks for formal proofs of its Lean targets. It also leaves room for alternative proofs and sharper, separately stated variants without weakening Theorem 1.

Difficulty

Ordinary matrix convergence cannot be applied until the observed transition frequencies are known to converge and the limiting matrix is invertible. A trial has random length, and the process resets after absorption, so a sequence indexed by all restart-process steps does not have the same raw state proportions as a count indexed by trials. The proof must account for both clocks while retaining the in-trial data of Eq. (11). At γ=1\gamma=1γ=1, a direct geometric-series argument for the value function is unavailable; its finiteness depends on absorption and the reward convention. The matrix I−γPI-\gamma PI−γP itself is singular at the undiscounted endpoint because of absorbing states, while its non-absorbing block is the relevant invertible matrix. Bradtke and Barto, Proof of Theorem 1, p. 44.

Formalization scope

The Lean state type is finite and nonempty. The paper evaluates one fixed policy, so PPP is a real row-stochastic matrix and RRR is a deterministic real reward on transitions; there is no action type in the formal statement. Absorbing states are exactly those with P(x,x)=1P(x,x)=1P(x,x)=1, and “absorbing chain” means that an absorbing state is reachable from every state. The paper does not define “inaccessible”; the formalization reads it as unreachable from the positive support of SSS. The state space carries the discrete measurable structure. Theorem 1's restart process and Lemma 5's ordinary Markov chain are each constrained by their finite-dimensional cylinder probabilities, not by assumed transition frequencies.

The feature space is Rm\mathbb R^mRm, and mmm equals the cardinality of the subtype N\mathcal NN. LS TD uses only departures from N\mathcal NN. Index nnn counts restart-process steps, so the estimate repeats at a restart draw; the paper counts in-trial transitions. These indices have the same asymptotic estimate when transitions continue. The 1/t1/t1/t factors in Eq. (11) cancel, and early singular inverses take Lean's total-inverse default. The value function is the return series, and the goal explicitly asserts its summability. The true parameter is existential, never defined by the formula whose convergence the theorem is meant to prove.

The paper defines πx\pi_xπx​ for absorbing chains as expected departures from xxx per trial. The Theorem 1 visit-frequency milestone normalizes by restart-process steps, which rescales all weights by one positive common factor; Lemma 5's matrix expression is invariant under that rescaling. Lemma 5 itself counts every ordinary-chain transition and carries the paper's “any Markov chain” scope. The milestone on invertibility allows arbitrary weights at absorbing states because their feature rows are zero. These conventions are recorded with each Lean item. Contributions toward the path-law frequency theorem, transient-matrix invertibility, return-series summability, and the matrix limit are all within scope. A vacuous path law or a value function defined from the desired linear equation would not establish the stated goal.

Selected references

  • S. J. Bradtke and A. G. Barto, Linear Least-Squares Algorithms for Temporal Difference Learning, Machine Learning 22, 33–57 (1996). DOI: 10.1023/A:1018056104778.
8 thms0 active usersReviewed
Linear algebraMachine LearningOptimization·Captain: mikedeng1

Reinforcement Learning: An Introduction X: Off-policy Divergence and the Gradient of the Projected Bellman ErrorTextbook

Motivation

Off-policy learning estimates the value function of a target policy π\piπ from data generated by a different behavior policy bbb. It is how an agent learns about a greedy policy while exploring, and how many policies can be evaluated from one stream of experience. Combined with linear function approximation and bootstrapping (updating an estimate toward other estimates, as temporal-difference methods do), off-policy learning can be unstable: the weights can diverge even when every quantity involved is well defined. Sutton and Barto call this combination the deadly triad (Chapter 11 of Reinforcement Learning: An Introduction, 2nd ed., 2018).

Chapter 11 does two things. It exhibits the instability with small, fully computable examples, and it identifies an objective that can be minimized stably from off-policy data: the mean square projected Bellman error (PBE), whose gradient the Gradient-TD methods (GTD2, TDC) follow in expectation. This mission formalizes the chapter's exact, finite-dimensional claims.

A short history, following the book's bibliographical remarks (pp. 285–286): Baird (1995) gave the seven-state counterexample for off-policy semi-gradient TD; Tsitsiklis and Van Roy (1996) gave the earliest w-to-2w example and the counterexample of Example 11.1, showing that even a least-squares fit at every step can diverge; Gradient-TD methods, which follow the gradient of the PBE, were introduced by Sutton, Szepesvári and Maei and by Sutton et al. (2009); Sutton, Mahmood and White (2016) introduced Emphatic-TD. The learnability discussion of §11.6 is the book's own.

Setting

A finite Markov decision process has states S\mathcal SS, actions A\mathcal AA, a finite reward set R\mathcal RR and dynamics p(s′,r∣s,a)p(s',r\mid s,a)p(s′,r∣s,a). A policy π(a∣s)\pi(a\mid s)π(a∣s) induces the transition matrix Pπ(s,s′)=∑aπ(a∣s) p(s′∣s,a)P_\pi(s,s') = \sum_a \pi(a\mid s)\,p(s'\mid s,a)Pπ​(s,s′)=∑a​π(a∣s)p(s′∣s,a) and expected reward rπ(s)r_\pi(s)rπ​(s). For 0≤γ<10\le\gamma<10≤γ<1 the true value function is the expected discounted return vπ(s)=∑k≥0γk(Pπkrπ)(s)v_\pi(s) = \sum_{k\ge0}\gamma^k (P_\pi^k r_\pi)(s)vπ​(s)=∑k≥0​γk(Pπk​rπ​)(s).

A state weighting μ\muμ is a probability distribution on S\mathcal SS, with D=diag⁡(μ)\mathbf D = \operatorname{diag}(\mu)D=diag(μ) and norm ∥v∥μ2=∑sμ(s)v(s)2\|v\|_\mu^2 = \sum_s \mu(s)v(s)^2∥v∥μ2​=∑s​μ(s)v(s)2. The ∣S∣×d|\mathcal S|\times d∣S∣×d matrix X\mathbf XX has the feature vectors x(s)⊤\mathbf x(s)^\topx(s)⊤ as rows, and a weight vector w∈Rd\mathbf w\in\mathbb R^dw∈Rd gives the linear value function vw=Xwv_{\mathbf w} = \mathbf X\mathbf wvw​=Xw. The Bellman operator is

(Bπv)(s)=∑aπ(a∣s)∑s′,rp(s′,r∣s,a) [r+γv(s′)].(B_\pi v)(s) = \sum_a \pi(a\mid s)\sum_{s',r} p(s',r\mid s,a)\,[r+\gamma v(s')].(Bπ​v)(s)=a∑​π(a∣s)s′,r∑​p(s′,r∣s,a)[r+γv(s′)].

The Bellman error vector is δˉw=Bπvw−vw\bar\delta_{\mathbf w} = B_\pi v_{\mathbf w} - v_{\mathbf w}δˉw​=Bπ​vw​−vw​, the projection is Π=X(X⊤DX)−1X⊤D\Pi = \mathbf X(\mathbf X^\top\mathbf D\mathbf X)^{-1}\mathbf X^\top\mathbf DΠ=X(X⊤DX)−1X⊤D, and the two objectives are

BE(w)=∥δˉw∥μ2,PBE(w)=∥Πδˉw∥μ2.\mathrm{BE}(\mathbf w) = \|\bar\delta_{\mathbf w}\|_\mu^2,\qquad \mathrm{PBE}(\mathbf w) = \|\Pi\bar\delta_{\mathbf w}\|_\mu^2 .BE(w)=∥δˉw​∥μ2​,PBE(w)=∥Πδˉw​∥μ2​.

Off-policy samples are reweighted by the importance-sampling ratio ρt=π(At∣St)/b(At∣St)\rho_t = \pi(A_t\mid S_t)/b(A_t\mid S_t)ρt​=π(At​∣St​)/b(At​∣St​).

Formalization targets

Goal: the gradient of the PBE

If X⊤DX\mathbf X^\top\mathbf D\mathbf XX⊤DX is invertible, then for every w\mathbf ww

PBE(w)=(X⊤Dδˉw)⊤(X⊤DX)−1(X⊤Dδˉw),\mathrm{PBE}(\mathbf w) = (\mathbf X^\top\mathbf D\bar\delta_{\mathbf w})^\top(\mathbf X^\top\mathbf D\mathbf X)^{-1}(\mathbf X^\top\mathbf D\bar\delta_{\mathbf w}),PBE(w)=(X⊤Dδˉw​)⊤(X⊤DX)−1(X⊤Dδˉw​), ∇PBE(w)=2 (γPπX−X)⊤DX (X⊤DX)−1 X⊤Dδˉw.\nabla\mathrm{PBE}(\mathbf w) = 2\,(\gamma P_\pi\mathbf X-\mathbf X)^\top\mathbf D\mathbf X\,(\mathbf X^\top\mathbf D\mathbf X)^{-1}\,\mathbf X^\top\mathbf D\bar\delta_{\mathbf w}.∇PBE(w)=2(γPπ​X−X)⊤DX(X⊤DX)−1X⊤Dδˉw​.

With μ\muμ the state distribution under bbb this is (11.27), ∇PBE(w)=2 E[ρt(γxt+1−xt)xt⊤] E[xtxt⊤]−1 E[ρtδtxt]\nabla\mathrm{PBE}(\mathbf w) = 2\,\mathbb E[\rho_t(\gamma\mathbf x_{t+1}-\mathbf x_t)\mathbf x_t^\top]\,\mathbb E[\mathbf x_t\mathbf x_t^\top]^{-1}\,\mathbb E[\rho_t\delta_t\mathbf x_t]∇PBE(w)=2E[ρt​(γxt+1​−xt​)xt⊤​]E[xt​xt⊤​]−1E[ρt​δt​xt​].

Milestones, in attack order

  1. The w-to-2w example (p. 260): repeated off-policy semi-gradient TD(0) on one transition multiplies www by 1+α(2γ−1)1+\alpha(2\gamma-1)1+α(2γ−1), so wt→±∞w_t\to\pm\inftywt​→±∞ for every α>0\alpha>0α>0 once γ>12\gamma>\tfrac12γ>21​.
  2. Example 11.1, (11.10) (p. 263): the least-squares iteration wk+1=6−4ε5γwkw_{k+1} = \tfrac{6-4\varepsilon}{5}\gamma w_kwk+1​=56−4ε​γwk​ diverges when γ>5/(6−4ε)\gamma>5/(6-4\varepsilon)γ>5/(6−4ε) and w0≠0w_0\ne0w0​=0.
  3. (11.12)–(11.13): Πv\Pi vΠv is the unique μ\muμ-closest representable function, and Π⊤DΠ=DX(X⊤DX)−1X⊤D\Pi^\top\mathbf D\Pi = \mathbf D\mathbf X(\mathbf X^\top\mathbf D\mathbf X)^{-1}\mathbf X^\top\mathbf DΠ⊤DΠ=DX(X⊤DX)−1X⊤D.
  4. (11.21): vπv_\pivπ​ is the unique fixed point of BπB_\piBπ​ (γ<1\gamma<1γ<1).
  5. (11.24), Exercise 11.4: RE(w)=VE(w)+E[(Gt−vπ(St))2]\mathrm{RE}(\mathbf w) = \mathrm{VE}(\mathbf w) + \mathbb E[(G_t - v_\pi(S_t))^2]RE(w)=VE(w)+E[(Gt​−vπ​(St​))2] in the on-policy case.
  6. Example 11.4 (p. 276): two Markov reward processes that generate the same observable data distribution (every finite prefix of the stream of feature vectors and rewards has the same probability, each process started from its stationary distribution) have BE(0)=0\mathrm{BE}(\mathbf 0) = 0BE(0)=0 and BE(0)=23\mathrm{BE}(\mathbf 0) = \tfrac23BE(0)=32​.
  7. (11.25)–(11.26): the PBE in matrix terms.
  8. The three factors (p. 278): X⊤Dδˉw=E[ρtδtxt]\mathbf X^\top\mathbf D\bar\delta_{\mathbf w} = \mathbb E[\rho_t\delta_t\mathbf x_t]X⊤Dδˉw​=E[ρt​δt​xt​], (γPπX−X)⊤DX=E[ρt(γxt+1−xt)xt⊤](\gamma P_\pi\mathbf X-\mathbf X)^\top\mathbf D\mathbf X = \mathbb E[\rho_t(\gamma\mathbf x_{t+1}-\mathbf x_t)\mathbf x_t^\top](γPπ​X−X)⊤DX=E[ρt​(γxt+1​−xt​)xt⊤​], X⊤DX=E[xtxt⊤]\mathbf X^\top\mathbf D\mathbf X = \mathbb E[\mathbf x_t\mathbf x_t^\top]X⊤DX=E[xt​xt⊤​], under coverage.

Significance

The results. The divergence examples show that no step-size choice rescues semi-gradient TD off-policy, and that exact least-squares fitting does not either. The learnability results separate objectives that can be estimated from observed features and rewards (RE, PBE) from one that cannot (BE), and (11.24) shows that the unobservable VE has the same minimizer as the observable RE. The gradient formula (11.27) is the expected update of the Gradient-TD family; its factorization into three expectations is what makes an O(d)O(d)O(d) stochastic-gradient method possible.

Formalizing them. All of these are proved or computed in the book, in informal notation that leaves hypotheses implicit (invertibility, coverage, the distribution μ\muμ, the domain of γ\gammaγ). A machine-checked version fixes them, and gives a reusable layer of linear value-function geometry (Bellman operator, μ\muμ-norm, projection, BE, PBE, behavior-policy expectations) for later work on Gradient-TD convergence and on the TD fixed point. No formalization of this chapter is known to exist.

Difficulty

The individual steps are finite linear algebra, but they are easy to get wrong. The gradient of a quadratic form h⊤C−1h\mathbf h^\top\mathbf C^{-1}\mathbf hh⊤C−1h in an affine h(w)\mathbf h(\mathbf w)h(w) produces C−1+C−⊤\mathbf C^{-1}+\mathbf C^{-\top}C−1+C−⊤, and collapsing it to 2C−12\mathbf C^{-1}2C−1 uses the symmetry of X⊤DX\mathbf X^\top\mathbf D\mathbf XX⊤DX. The Jacobian of w↦X⊤Dδˉw\mathbf w\mapsto\mathbf X^\top\mathbf D\bar\delta_{\mathbf w}w↦X⊤Dδˉw​ has to be identified through the Bellman operator's affine form rπ+γPπvr_\pi+\gamma P_\pi vrπ​+γPπ​v, which is a theorem about the four-argument dynamics, not a definition. Passing from matrix to expectation form needs coverage, since otherwise b(a∣s)ρ=π(a∣s)b(a\mid s)\rho = \pi(a\mid s)b(a∣s)ρ=π(a∣s) fails. The divergence examples need the conclusion ∣wk∣→∞|w_k|\to\infty∣wk​∣→∞, not merely "the multiplier exceeds one".

Formalization scope

States are a finite type; values are functions S→R\mathcal S\to\mathbb RS→R; weights are Rd\mathbb R^dRd as Fin d → ℝ; matrices are Mathlib Matrix. The dynamics are the book's p(s′,r∣s,a)p(s',r\mid s,a)p(s′,r∣s,a) with a finite reward set, and one action type serves all states. μ\muμ is a probability distribution (nonnegative, summing to one). vπv_\pivπ​ is defined from expected returns, not as a Bellman solution. The gradient is a Fréchet derivative whose linear map is u↦g⊤u\mathbf u\mapsto\mathbf g^\top\mathbf uu↦g⊤u.

Explicit hypotheses the book leaves implicit:

  • X⊤DX\mathbf X^\top\mathbf D\mathbf XX⊤DX invertible. The book substitutes a pseudoinverse otherwise; that case is not formalized, and without the hypothesis Lean's matrix inverse is zero and the PBE is trivially 000.
  • Coverage (π(a∣s)>0⇒b(a∣s)>0\pi(a\mid s)>0\Rightarrow b(a\mid s)>0π(a∣s)>0⇒b(a∣s)>0) for the expectation identities.
  • 0≤γ<10\le\gamma<10≤γ<1 for (11.21); the episodic γ=1\gamma=1γ=1 case is not stated.
  • In (11.24) the return enters through conditional distributions νs\nu_sνs​ with finite second moment and mean vπ(s)v_\pi(s)vπ​(s).

Readings and corrections:

  • (11.10) is introduced as minimizing "the VE", but its displayed objective is an unweighted sum over the two states. The displayed sum is formalized.
  • The sentence on p. 269, "there always exists an approximate value function with zero PBE", needs X⊤D(I−γPπ)X\mathbf X^\top\mathbf D(I-\gamma P_\pi)\mathbf XX⊤D(I−γPπ​)X invertible, which can fail off-policy. Counterexample: two states with features x=1,2x = 1, 2x=1,2, both moving to the second state under π\piπ, rewards rπ=(1,0)r_\pi = (1, 0)rπ​=(1,0), γ=34\gamma = \tfrac34γ=43​ and μ=(23,13)\mu = (\tfrac23, \tfrac13)μ=(32​,31​). Then X⊤Dδˉw=23\mathbf X^\top\mathbf D\bar\delta_{\mathbf w} = \tfrac23X⊤Dδˉw​=32​ for every w\mathbf ww, so PBE(w)=(23)2/2>0\mathrm{PBE}(\mathbf w) = (\tfrac23)^2/2 > 0PBE(w)=(32​)2/2>0 everywhere. The sentence is not formalized.
  • The Example 11.4 MRPs are transcribed from the figure on p. 276. Their equal data distributions are stated through all finite prefixes of the observed stream (feature vectors and rewards) from the stationary distributions; the BE minimizer of the second MRP as γ→1\gamma\to1γ→1 is not formalized.
  • Baird's counterexample (divergence shown by simulation), Gradient-TD and Emphatic-TD convergence (asserted with references) are out of scope.

A trivializing formalization is ruled out: vπv_\pivπ​ is not defined as a fixed point of BπB_\piBπ​, the PBE is not stated without the invertibility hypothesis, and the gradient is a derivative of the defined PBE, not a restated formula.

Welcome contributions: proofs of the milestones, and a general lemma on the gradient of h⊤C−1h\mathbf h^\top\mathbf C^{-1}\mathbf hh⊤C−1h for affine h\mathbf hh and symmetric invertible C\mathbf CC, which is reusable well beyond this mission.

Selected references

  • R. S. Sutton and A. G. Barto, Reinforcement Learning: An Introduction, 2nd ed., MIT Press, 2018, ISBN 9780262039246, Chapter 11. http://incompleteideas.net/book/the-book-2nd.html
  • L. Baird, Residual algorithms: Reinforcement learning with function approximation, ICML 1995. https://doi.org/10.1016/B978-1-55860-377-6.50013-X
  • J. N. Tsitsiklis and B. Van Roy, Feature-based methods for large scale dynamic programming, Machine Learning 22, 1996. https://doi.org/10.1007/BF00114724
  • R. S. Sutton, H. R. Maei, D. Precup, S. Bhatnagar, D. Silver, Cs. Szepesvári, E. Wiewiora, Fast gradient-descent methods for temporal-difference learning with linear function approximation, ICML 2009. https://doi.org/10.1145/1553374.1553501
  • R. S. Sutton, A. R. Mahmood, M. White, An emphatic approach to the problem of off-policy temporal-difference learning, JMLR 17, 2016. https://jmlr.org/papers/v17/14-488.html
14 thms0 active usersReviewed
Dynamic ProgrammingMachine LearningMarkov Chain·Captain: mikedeng1

Reinforcement Learning: An Introduction IX: Average Reward and the Futility of Discounting in Continuing ProblemsTextbook

Motivation

Reinforcement learning formulates control as maximizing reward accumulated over time. For continuing tasks, where interaction never terminates, the standard textbook objective is the discounted return with a discount rate γ<1\gamma < 1γ<1. Chapter 10 of Sutton and Barto, Reinforcement Learning: An Introduction (2nd ed., MIT Press, 2018), argues that once values are approximated by a function of features rather than stored per state, this objective is the wrong one, and it proposes the average-reward setting, long standard in dynamic programming (Puterman, Markov Decision Processes, 1994), as its replacement.

The central piece of evidence is a short calculation printed in the box The Futility of Discounting in Continuing Problems (p. 254). If one tries to rescue discounting by averaging discounted values over the states the policy actually visits, the resulting objective is a constant multiple of the average reward, so the discount rate has no effect on which policy is preferred. This mission formalizes that calculation together with the definitions of §10.3 that it rests on, and the two exercises of §10.3 that illustrate the differential value (10.13).

Setting

A finite MDP has finite state set S\mathcal SS, finite action set A\mathcal AA, finite reward set R⊂R\mathcal R \subset \mathbb RR⊂R and dynamics p(s′,r∣s,a)p(s', r \mid s, a)p(s′,r∣s,a), a probability distribution over next state and reward for each state–action pair (3.2)–(3.3). Write p(s′∣s,a)=∑rp(s′,r∣s,a)p(s' \mid s, a) = \sum_r p(s', r\mid s,a)p(s′∣s,a)=∑r​p(s′,r∣s,a). A policy π(a∣s)\pi(a \mid s)π(a∣s) is a distribution over actions for each state. It turns the MDP into a Markov chain with transition matrix Pπ(s,s′)=∑aπ(a∣s) p(s′∣s,a)P_\pi(s, s') = \sum_a \pi(a\mid s)\, p(s'\mid s,a)Pπ​(s,s′)=∑a​π(a∣s)p(s′∣s,a) and expected one-step reward rπ(s)=∑aπ(a∣s)∑s′,rp(s′,r∣s,a) rr_\pi(s) = \sum_a \pi(a\mid s)\sum_{s',r} p(s',r\mid s,a)\, rrπ​(s)=∑a​π(a∣s)∑s′,r​p(s′,r∣s,a)r, so that Pr⁡{St=s∣S0=s0}=Pπt(s0,s)\Pr\{S_t = s\mid S_0=s_0\} = P_\pi^t(s_0,s)Pr{St​=s∣S0​=s0​}=Pπt​(s0​,s) and E[Rt+1∣S0=s0]=(Pπtrπ)(s0)\mathbb E[R_{t+1}\mid S_0 = s_0] = (P_\pi^t r_\pi)(s_0)E[Rt+1​∣S0​=s0​]=(Pπt​rπ​)(s0​).

A stationary distribution of π\piπ is a probability vector μ\muμ on S\mathcal SS with

∑sμ(s)∑aπ(a∣s) p(s′∣s,a)=μ(s′)for all s′(10.8).\sum_s \mu(s)\sum_a \pi(a\mid s)\,p(s'\mid s,a) = \mu(s') \quad\text{for all } s' \qquad (10.8).s∑​μ(s)a∑​π(a∣s)p(s′∣s,a)=μ(s′)for all s′(10.8).

The average reward of π\piπ is

r(π)=lim⁡h→∞1h∑t=1hE[Rt∣S0,A0:t−1∼π](10.6),r(π)=∑sμπ(s)∑aπ(a∣s)∑s′,rp(s′,r∣s,a) r(10.7),r(\pi) = \lim_{h\to\infty}\frac1h\sum_{t=1}^h \mathbb E[R_t\mid S_0, A_{0:t-1}\sim\pi] \quad (10.6), \qquad r(\pi) = \sum_s \mu_\pi(s)\sum_a\pi(a\mid s)\sum_{s',r}p(s',r\mid s,a)\,r \quad (10.7),r(π)=h→∞lim​h1​t=1∑h​E[Rt​∣S0​,A0:t−1​∼π](10.6),r(π)=s∑​μπ​(s)a∑​π(a∣s)s′,r∑​p(s′,r∣s,a)r(10.7),

the second form holding when the steady-state distribution μπ(s)=lim⁡t→∞Pr⁡{St=s}\mu_\pi(s) = \lim_{t\to\infty}\Pr\{S_t = s\}μπ​(s)=limt→∞​Pr{St​=s} exists and does not depend on S0S_0S0​ (an ergodic MDP).

The discounted value function is vπγ(s)=Eπ[∑k≥0γkRt+k+1∣St=s]v^\gamma_\pi(s) = \mathbb E_\pi\big[\sum_{k\ge0}\gamma^k R_{t+k+1}\mid S_t = s\big]vπγ​(s)=Eπ​[∑k≥0​γkRt+k+1​∣St​=s], and the objective of the box is

J(π)=∑sμπ(s) vπγ(s).J(\pi) = \sum_s \mu_\pi(s)\, v^\gamma_\pi(s).J(π)=s∑​μπ​(s)vπγ​(s).

Finally, the differential value of a state (10.13) is vπ(s)=lim⁡γ→1lim⁡h→∞∑t=0hγt(Eπ[Rt+1∣S0=s]−r(π))v_\pi(s) = \lim_{\gamma\to1}\lim_{h\to\infty}\sum_{t=0}^h\gamma^t\big(\mathbb E_\pi[R_{t+1}\mid S_0 = s] - r(\pi)\big)vπ​(s)=limγ→1​limh→∞​∑t=0h​γt(Eπ​[Rt+1​∣S0​=s]−r(π)).

Formalization targets

Goal: the futility of discounting

For 0≤γ<10 \le \gamma < 10≤γ<1, every policy π\piπ and every stationary distribution μπ\mu_\piμπ​ of π\piπ,

J(π)=∑sμπ(s) vπγ(s)=11−γ r(π),J(\pi) = \sum_s \mu_\pi(s)\, v^\gamma_\pi(s) = \frac{1}{1-\gamma}\, r(\pi),J(π)=s∑​μπ​(s)vπγ​(s)=1−γ1​r(π),

and therefore, for a fixed γ\gammaγ and policies π,π′\pi, \pi'π,π′ with their own stationary distributions,

J(π)≤J(π′)  ⟺  r(π)≤r(π′).J(\pi) \le J(\pi') \iff r(\pi) \le r(\pi').J(π)≤J(π′)⟺r(π)≤r(π′).

Milestones

  1. (10.6)–(10.7): if Pr⁡{St=s∣S0=s0}→μ(s)\Pr\{S_t = s\mid S_0 = s_0\}\to\mu(s)Pr{St​=s∣S0​=s0​}→μ(s) for all s0,ss_0, ss0​,s, then from every start both lim⁡tE[Rt]\lim_t \mathbb E[R_t]limt​E[Rt​] and the Cesàro limit (10.6) exist and equal the μ\muμ-sum.
  2. (10.8): such a limit μ\muμ is a stationary distribution.
  3. (3.14): vπγv^\gamma_\pivπγ​ satisfies the Bellman equation, the step "(Bellman Eq.)" of the box.
  4. Offset invariance (p. 250): the differential Bellman equations for vπ,qπ,v∗,q∗v_\pi, q_\pi, v_*, q_*vπ​,qπ​,v∗​,q∗​ and the differential TD errors (10.10)–(10.11) are unchanged when all values are shifted by a constant.
  5. Exercise 10.6: for expected rewards 1,0,1,0,…1,0,1,0,\dots1,0,1,0,… from A\mathsf AA and 0,1,0,1,…0,1,0,1,\dots0,1,0,1,… from B\mathsf BB, the average reward is 12\tfrac1221​, the limit (10.7) and a steady-state distribution do not exist, and vπ(A)=14v_\pi(\mathsf A) = \tfrac14vπ​(A)=41​, vπ(B)=−14v_\pi(\mathsf B) = -\tfrac14vπ​(B)=−41​.
  6. Exercise 10.7: in the three-state ring with reward +1+1+1 on arrival in A\mathsf AA, the average reward is 13\tfrac1331​ and the differential values are v(A)=−13v(\mathsf A) = -\tfrac13v(A)=−31​, v(B)=0v(\mathsf B) = 0v(B)=0, v(C)=13v(\mathsf C) = \tfrac13v(C)=31​.

The book prints no answers to Exercises 10.6 and 10.7; the values above were computed for this mission.

Significance

The result itself. The identity shows that the discount rate cannot enter the ranking of policies once performance is measured over the on-policy state distribution: any objective of the form "discounted value averaged over where the policy goes" is the average reward up to a positive factor. The book draws from it the conclusion (p. 253) that γ\gammaγ changes from a problem parameter to a solution-method parameter, and that discounting algorithms with function approximation, which do not optimize this averaged objective, are not guaranteed to optimize average reward either. Milestones 1–2 connect the closed form of r(π)r(\pi)r(π) to its definition as a long-run rate; milestone 4 explains why differential methods determine values only up to an offset; the exercises show that (10.13) gives finite differential values in periodic chains where the differential return (10.9) has no limit.

Formalizing it. The results are classical and elementary, but the book's derivation is informal: it takes the Bellman equation for granted, sums a geometric series of equalities, and leaves implicit which distribution μπ\mu_\piμπ​ is meant and when (10.6) and (10.7) agree. This mission fixes each of those points: vπγv^\gamma_\pivπγ​ is defined from returns, the identity is proved for every stationary distribution, and the ergodicity hypothesis is made the exact limit condition the text states. No machine-checked version of these statements is known to exist; the platform's Markov-chain and average-reward libraries (Puterman's unichain optimality equation, Doeblin convergence) state different results.

Difficulty

The box reads as a chain of equalities, and each individual step is short. The one step that is not algebra is "(Bellman Eq.)": with vπγv^\gamma_\pivπγ​ defined as an expected discounted return, the Bellman equation requires exchanging an infinite sum with a finite expectation and shifting the index of a convergent series, which needs absolute convergence for γ<1\gamma < 1γ<1 and bounded rewards. The final line, which unrolls J=r+γJJ = r + \gamma JJ=r+γJ into a geometric series, is only valid because JJJ is finite. For milestone 1, the book's hypothesis is the existence of an S0S_0S0​-independent limiting distribution, not irreducibility or aperiodicity; replacing it by either would change the statement. The exercises require the iterated limit in (10.13) to be computed explicitly: the inner limit is a periodic series summed in closed form, and the outer limit is a removable singularity at γ=1\gamma = 1γ=1.

Formalization scope

The Lean development lives in the namespace SuttonBartoRL.AverageReward. States, actions and rewards are finite; one action set serves every state; the dynamics are the four-argument p(s′,r∣s,a)p(s', r\mid s,a)p(s′,r∣s,a). Probabilities Pr⁡{St=s∣S0=s0}\Pr\{S_t = s\mid S_0 = s_0\}Pr{St​=s∣S0​=s0​} and E[Rt+1∣S0=s0]\mathbb E[R_{t+1}\mid S_0=s_0]E[Rt+1​∣S0​=s0​] are computed from the matrix powers PπtP_\pi^tPπt​. The discounted value vπγv^\gamma_\pivπγ​ is a real series ∑kγk(Pπkrπ)(s)\sum_k \gamma^k (P_\pi^k r_\pi)(s)∑k​γk(Pπk​rπ​)(s); it is not defined as the solution of the Bellman equation, since that definition would reduce the goal to three lines of algebra. The average reward and JJJ take the state distribution μ\muμ as an explicit argument; the goal holds for every stationary distribution of π\piπ and assumes no ergodicity, which is all the box uses (under ergodicity μπ\mu_\piμπ​ is the unique one). γ=0\gamma = 0γ=0 is allowed. The differential value (10.13) is stated as the existence of both limits with the given value, with γ→1\gamma \to 1γ→1 from below, so no default value of a nonexistent limit can make a statement true. The optimality equations use a nonempty action set. The sum ∑t=1hE[Rt]\sum_{t=1}^h \mathbb E[R_t]∑t=1h​E[Rt​] of (10.6) is written with the index shifted to t=0,…,h−1t = 0,\dots,h-1t=0,…,h−1.

The Lean does not formalize a trajectory probability space: expectations and probabilities are the matrix expressions above, which is what they equal for a Markov chain. The Exercise 10.6 hypothesis constrains expected rewards of one policy, which is all the exercise uses.

Reusable parts: the finite-MDP layer duplicates the one drafted for the other missions of this series and is expected to be merged with it; the Cesàro and stationary-distribution lemmas of milestones 1–2 are general facts about finite Markov chains. Contributions welcome: proofs of any milestone, and a proof of the goal from milestone 3.

Selected references

  • R. S. Sutton, A. G. Barto, Reinforcement Learning: An Introduction, 2nd ed., MIT Press, 2018, ISBN 9780262039246, §§10.3–10.4, pp. 249–254. http://incompleteideas.net/book/the-book-2nd.html
  • M. L. Puterman, Markov Decision Processes: Discrete Stochastic Dynamic Programming, Wiley, 1994. https://doi.org/10.1002/9780470316887
  • S. Mahadevan, "Average reward reinforcement learning: foundations, algorithms, and empirical results", Machine Learning 22, 159–195, 1996. https://doi.org/10.1007/BF00114727
11 thms0 active usersReviewed
Linear algebraMachine LearningMarkov Chain·Captain: mikedeng1

Reinforcement Learning: An Introduction VIII: The TD Fixed Point of Linear Semi-gradient TD(0) and Its Error BoundTextbook

Motivation

Reinforcement learning methods estimate the value function vπv_\pivπ​ of a policy π\piπ: the expected discounted sum of future rewards from each state. When the state space is large, vπv_\pivπ​ cannot be stored as a table and is approximated by a parametrized function. The most studied case is linear function approximation, where each state sss carries a feature vector x(s)∈Rd\mathbf x(s) \in \mathbb R^dx(s)∈Rd and the estimate is v^(s,w)=w⊤x(s)\hat v(s, \mathbf w) = \mathbf w^\top \mathbf x(s)v^(s,w)=w⊤x(s). Temporal-difference learning with this approximation, linear semi-gradient TD(0), is one of the basic algorithms of the field, and Chapter 9 of Sutton and Barto's Reinforcement Learning: An Introduction (2nd ed., MIT Press, 2018) presents its analysis: where the algorithm can converge, why that point exists, and how good it is.

The history is short. Sutton (1988, doi:10.1007/BF00115009) introduced TD learning and showed positive definiteness of the matrix governing its expected update. Dayan (1992, doi:10.1007/BF00992701) extended convergence to TD(λ). Tsitsiklis and Van Roy (1997, doi:10.1109/9.580874) proved convergence with probability one for linear TD(λ) under on-policy sampling and bounded the error of the limit. Bradtke and Barto (1996) introduced least-squares TD (LSTD), which computes the same limit directly.

Setting

A finite Markov decision process has finite sets of states S\mathcal SS, actions A\mathcal AA and rewards R⊂R\mathcal R \subset \mathbb RR⊂R, and dynamics p(s′,r∣s,a)p(s', r \mid s, a)p(s′,r∣s,a), the probability of next state s′s's′ and reward rrr after action aaa in state sss. A policy π(a∣s)\pi(a \mid s)π(a∣s) is a probability distribution over actions for each state. It induces a Markov chain on states with transition matrix P\mathbf PP, P(s,s′)=p(s′∣s)=∑aπ(a∣s)∑rp(s′,r∣s,a)\mathbf P(s, s') = p(s' \mid s) = \sum_a \pi(a \mid s) \sum_r p(s', r \mid s, a)P(s,s′)=p(s′∣s)=∑a​π(a∣s)∑r​p(s′,r∣s,a), and expected one-step reward rπ(s)r_\pi(s)rπ​(s). For a discount rate 0≤γ<10 \le \gamma < 10≤γ<1, the true value is vπ(s)=∑k≥0γk(Pkrπ)(s)v_\pi(s) = \sum_{k \ge 0} \gamma^k (\mathbf P^k r_\pi)(s)vπ​(s)=∑k≥0​γk(Pkrπ​)(s), the expected discounted return.

A state distribution μ\muμ is stationary if μ⊤P=μ⊤\mu^\top \mathbf P = \mu^\topμ⊤P=μ⊤; write D=diag(μ)\mathbf D = \mathrm{diag}(\mu)D=diag(μ). The feature matrix X\mathbf XX is the ∣S∣×d|\mathcal S| \times d∣S∣×d matrix with rows x(s)\mathbf x(s)x(s). The mean square value error of a weight vector is

VE‾(w)=∑sμ(s) [vπ(s)−w⊤x(s)]2.\overline{\mathrm{VE}}(\mathbf w) = \sum_{s} \mu(s)\,[v_\pi(s) - \mathbf w^\top \mathbf x(s)]^2 .VE(w)=s∑​μ(s)[vπ​(s)−w⊤x(s)]2.

Linear semi-gradient TD(0) updates wt+1=wt+α(Rt+1+γwt⊤xt+1−wt⊤xt)xt\mathbf w_{t+1} = \mathbf w_t + \alpha(R_{t+1} + \gamma \mathbf w_t^\top \mathbf x_{t+1} - \mathbf w_t^\top \mathbf x_t)\mathbf x_twt+1​=wt​+α(Rt+1​+γwt⊤​xt+1​−wt⊤​xt​)xt​. In steady state its expected update involves

b=E[Rt+1xt],A=E[xt(xt−γxt+1)⊤],\mathbf b = \mathbb E[R_{t+1}\mathbf x_t], \qquad \mathbf A = \mathbb E[\mathbf x_t(\mathbf x_t - \gamma \mathbf x_{t+1})^\top],b=E[Rt+1​xt​],A=E[xt​(xt​−γxt+1​)⊤],

and the TD fixed point is wTD=A−1b\mathbf w_{\mathrm{TD}} = \mathbf A^{-1}\mathbf bwTD​=A−1b. A real square matrix MMM, not necessarily symmetric, is positive definite if y⊤My>0y^\top M y > 0y⊤My>0 for every y≠0y \ne 0y=0. The key matrix is D(I−γP)\mathbf D(\mathbf I - \gamma\mathbf P)D(I−γP).

Formalization targets

Goal: the TD fixed point exists and its error bound (9.12), (9.14)

Under the hypotheses above, with every μ(s)>0\mu(s) > 0μ(s)>0 and linearly independent feature columns, A\mathbf AA is invertible, b=AwTD\mathbf b = \mathbf A \mathbf w_{\mathrm{TD}}b=AwTD​, and

VE‾(wTD)≤11−γmin⁡wVE‾(w).\overline{\mathrm{VE}}(\mathbf w_{\mathrm{TD}}) \le \frac{1}{1-\gamma}\min_{\mathbf w} \overline{\mathrm{VE}}(\mathbf w).VE(wTD​)≤1−γ1​wmin​VE(w).

Milestones

  1. The expected update (9.13): E[wt+1∣wt]=(I−αA)wt+αb\mathbb E[\mathbf w_{t+1} \mid \mathbf w_t] = (\mathbf I - \alpha \mathbf A)\mathbf w_t + \alpha \mathbf bE[wt+1​∣wt​]=(I−αA)wt​+αb.
  2. The matrix form A=X⊤D(I−γP)X\mathbf A = \mathbf X^\top \mathbf D(\mathbf I - \gamma \mathbf P)\mathbf XA=X⊤D(I−γP)X.
  3. The criterion of Sutton (1988): positive diagonal, nonpositive off-diagonal entries, positive row sums and nonnegative column sums give positive definiteness.
  4. The column sums of the key matrix, 1⊤D(I−γP)=(1−γ)μ⊤\mathbf 1^\top \mathbf D(\mathbf I - \gamma \mathbf P) = (1-\gamma)\mu^\top1⊤D(I−γP)=(1−γ)μ⊤.
  5. The key matrix and A\mathbf AA are positive definite.
  6. A positive definite A\mathbf AA is invertible and A−1b\mathbf A^{-1}\mathbf bA−1b is the unique solution of b=Aw\mathbf b = \mathbf A \mathbf wb=Aw (9.12).
  7. The Sherman–Morrison update (9.22) of the LSTD inverse A^t−1\hat{\mathbf A}_t^{-1}A^t−1​.

Significance

Positive definiteness of A\mathbf AA is the reason on-policy linear TD(0) is stable: it makes the expected iteration contract toward the fixed point for small step sizes, and it guarantees that the fixed point exists and is unique. The error bound (9.14) quantifies the price of bootstrapping: the limit of TD can be worse than the best linear approximation, but by at most the factor 1/(1−γ)1/(1-\gamma)1/(1−γ). The same objects A\mathbf AA, b\mathbf bb and the key matrix reappear in LSTD, in the analysis of off-policy divergence (Chapter 11 of the book, where D\mathbf DD is no longer the stationary distribution of P\mathbf PP and positive definiteness fails), and in gradient-TD methods.

All results here are known. The book gives the positive definiteness argument in a box and cites (9.14) without proof. None of them has a machine-checked proof on the platform; the general Woodbury identity (FamousTheorems.woodbury_identity) is available, and (9.22) is its rank-one case written for the LSTD recursion. The mission produces a formal account of the finite-state theory of linear TD(0), with every hypothesis the book leaves implicit stated.

Difficulty

The key matrix D(I−γP)\mathbf D(\mathbf I - \gamma \mathbf P)D(I−γP) is not symmetric, so the usual tools for symmetric positive definite matrices do not apply directly, and A\mathbf AA is positive definite only because of the specific interplay between D\mathbf DD and P\mathbf PP: if μ\muμ is replaced by a non-stationary distribution the claim is false (this is the off-policy counterexample of Chapter 11). The error bound (9.14) is not a consequence of positive definiteness alone. The TD fixed point is not the minimizer of VE‾\overline{\mathrm{VE}}VE, and VE‾(wTD)\overline{\mathrm{VE}}(\mathbf w_{\mathrm{TD}})VE(wTD​) has to be compared with the error of the μ\muμ-weighted projection of vπv_\pivπ​, which requires controlling P\mathbf PP in the μ\muμ-weighted norm. The book gives no argument for this step.

Formalization scope

The Lean development lives in the namespace SuttonBartoRL.LinearTD. The MDP has four-argument dynamics p(s′,r∣s,a)p(s', r \mid s, a)p(s′,r∣s,a) with a finite reward set and one action set for all states; policies are stochastic. vπv_\pivπ​ is defined from expected discounted returns as the series ∑kγkPkrπ\sum_k \gamma^k \mathbf P^k r_\pi∑k​γkPkrπ​, never from a Bellman equation or from wTD\mathbf w_{\mathrm{TD}}wTD​. A\mathbf AA and b\mathbf bb are defined as the book's steady-state expectations (9.11), as finite sums over μ\muμ, π\piπ and ppp; the matrix form is a milestone, not a definition. Features are a matrix Matrix S (Fin d) ℝ with rows x(s)\mathbf x(s)x(s); linear independence of its columns is LinearIndependent ℝ Xᵀ. Positive definiteness is a custom predicate ∀y≠0, 0<y⊤My\forall y \ne 0,\ 0 < y^\top M y∀y=0, 0<y⊤My, not Mathlib's Matrix.PosDef, which requires symmetry. The minimum in (9.14) is expressed by quantifying over every w\mathbf ww. The matrix inverse is Mathlib's, which is zero on singular matrices; the goal therefore asserts invertibility of A\mathbf AA explicitly.

Hypotheses the book leaves implicit and the statements make explicit: 0≤γ<10 \le \gamma < 10≤γ<1 (the continuing case); μ\muμ a stationary distribution of the chain induced by π\piπ with μ(s)>0\mu(s) > 0μ(s)>0 for every sss (otherwise the key matrix is only positive semidefinite); linearly independent feature columns (the book's "degenerate cases", p. 205). The box calls the off-diagonal entries of the key matrix "negative"; they are zero wherever p(s′∣s)=0p(s' \mid s) = 0p(s′∣s)=0, so the criterion is stated with nonpositive entries. The book's sentence that εI\varepsilon\mathbf IεI "ensures that A^t\hat{\mathbf A}_tA^t​ is always invertible" (p. 229) is false in general, because the summands xk(xk−γxk+1)⊤\mathbf x_k(\mathbf x_k - \gamma \mathbf x_{k+1})^\topxk​(xk​−γxk+1​)⊤ are not positive semidefinite: with d=1d = 1d=1, ε=1/10\varepsilon = 1/10ε=1/10, γ=1/2\gamma = 1/2γ=1/2, x0=1\mathbf x_0 = 1x0​=1, x1=11/5\mathbf x_1 = 11/5x1​=11/5 one gets A^1=0\hat{\mathbf A}_1 = 0A^1​=0. It is not stated; (9.22) carries invertibility of A^t−1\hat{\mathbf A}_{t-1}A^t−1​ and a nonzero denominator as hypotheses.

A statement in which vπv_\pivπ​ is defined as the solution of the projected equation, or in which A\mathbf AA is assumed invertible or positive definite, would make the goal trivial or empty; neither is done. Convergence of the stochastic algorithm with probability one is not stated, since the book says it needs conditions and a step-size schedule it does not give. The bound for the episodic case and for other bootstrapping methods (p. 208) is stated only by reference in the book and is not a target.

Useful infrastructure: the μ\muμ-weighted inner product and orthogonal projection onto the column space of X\mathbf XX, the non-expansiveness of a stochastic matrix in the norm of its stationary distribution, and the positive definiteness criterion for non-symmetric matrices. All of these are reusable in the off-policy and average-reward chapters of the book. Contributions of these lemmas, and of alternative proofs of the milestones, are welcome.

Selected references

  • Richard S. Sutton and Andrew G. Barto, Reinforcement Learning: An Introduction, 2nd ed., MIT Press, 2018, ISBN 9780262039246, §§9.2, 9.4, 9.8.
  • Richard S. Sutton, Learning to predict by the methods of temporal differences, Machine Learning 3, 1988. doi:10.1007/BF00115009
  • John N. Tsitsiklis and Benjamin Van Roy, An analysis of temporal-difference learning with function approximation, IEEE Transactions on Automatic Control 42(5), 1997. doi:10.1109/9.580874
  • Steven J. Bradtke and Andrew G. Barto, Linear least-squares algorithms for temporal difference learning, Machine Learning 22, 1996. doi:10.1007/BF00114723
  • Richard S. Varga, Matrix Iterative Analysis, Prentice-Hall, 1962.
11 thms0 active usersReviewed
Machine LearningProbabilityStatistics·Captain: mikedeng1

Reinforcement Learning: An Introduction V: Off-policy Prediction by Importance SamplingTextbook

Motivation

Reinforcement learning methods must explore in order to find good behaviour, yet the quantity they usually want to evaluate is the value of a different, often deterministic, policy. Off-policy prediction separates the two roles: episodes are generated by a behaviour policy bbb, and the goal is the value function vπv_\pivπ​ of a target policy π\piπ. Almost every off-policy method in Sutton and Barto's Reinforcement Learning: An Introduction (2nd ed., MIT Press, 2018), and in the literature that follows it, rests on importance sampling: a return observed under bbb is reweighted by the relative probability of its trajectory under π\piπ and bbb. Section 5.5 of the book introduces the idea for Monte Carlo prediction, §5.6 gives the incremental form of the weighted estimator, and §§5.8–5.9 refine the weights using the internal structure of the return: discounting-aware importance sampling, after Sutton, Mahmood, Precup and van Hasselt (2014), and per-decision importance sampling, introduced by Precup, Sutton and Singh (2000). The book's remarks on the variance of the two estimators (p. 105) cite Precup, Sutton and Dasgupta (2001). Later chapters (7, 11, 12) reuse the same ratios for nnn-step, gradient-TD and eligibility-trace methods.

This mission is the fifth in a series formalizing the book's central mathematical claims. It covers §§5.5–5.9 (pp. 103–115).

Setting

A finite Markov decision process has finite sets of states S\mathcal SS (terminal states included), actions A\mathcal AA and rewards R⊂R\mathcal R \subset \mathbb RR⊂R, and dynamics p(s′,r∣s,a)p(s', r \mid s, a)p(s′,r∣s,a): for each (s,a)(s, a)(s,a) a probability distribution over next state and reward. The state-transition probability is p(s′∣s,a)=∑rp(s′,r∣s,a)p(s' \mid s, a) = \sum_r p(s', r \mid s, a)p(s′∣s,a)=∑r​p(s′,r∣s,a). A policy μ\muμ gives a distribution μ(⋅∣s)\mu(\cdot \mid s)μ(⋅∣s) over actions in every state.

An episode from a start state sss is a sequence S0=s,A0,R1,S1,…,AT−1,RT,STS_0 = s, A_0, R_1, S_1, \dots, A_{T-1}, R_T, S_TS0​=s,A0​,R1​,S1​,…,AT−1​,RT​,ST​ in which S0,…,ST−1S_0, \dots, S_{T-1}S0​,…,ST−1​ are nonterminal and STS_TST​ is terminal. Under μ\muμ it has probability ∏k=0T−1μ(Ak∣Sk) p(Sk+1,Rk+1∣Sk,Ak)\prod_{k=0}^{T-1} \mu(A_k \mid S_k)\, p(S_{k+1}, R_{k+1} \mid S_k, A_k)∏k=0T−1​μ(Ak​∣Sk​)p(Sk+1​,Rk+1​∣Sk​,Ak​). The return is G0=∑k=0T−1γkRk+1G_0 = \sum_{k=0}^{T-1} \gamma^k R_{k+1}G0​=∑k=0T−1​γkRk+1​ with discount rate γ∈[0,1]\gamma \in [0, 1]γ∈[0,1], and the value vπ(s)v_\pi(s)vπ​(s) is the expected return of an episode generated by π\piπ from sss.

The behaviour policy covers the target policy if π(a∣s)>0\pi(a \mid s) > 0π(a∣s)>0 implies b(a∣s)>0b(a \mid s) > 0b(a∣s)>0. The importance-sampling ratio of decisions 0,…,j0, \dots, j0,…,j is

ρ0:j=∏k=0jπ(Ak∣Sk)b(Ak∣Sk),\rho_{0:j} = \prod_{k=0}^{j} \frac{\pi(A_k \mid S_k)}{b(A_k \mid S_k)},ρ0:j​=k=0∏j​b(Ak​∣Sk​)π(Ak​∣Sk​)​,

and the per-decision return weights each reward only by the ratio of the decisions that precede it:

G~0=ρ0:0R1+γρ0:1R2+⋯+γT−1ρ0:T−1RT.\tilde G_0 = \rho_{0:0} R_1 + \gamma \rho_{0:1} R_2 + \dots + \gamma^{T-1} \rho_{0:T-1} R_T .G~0​=ρ0:0​R1​+γρ0:1​R2​+⋯+γT−1ρ0:T−1​RT​.

The book writes these objects at a general time ttt and conditions on St=sS_t = sSt​=s; by the Markov property this is the same as starting the episode at sss, which is what the formal statements do.

Formalization targets

Goal: unbiasedness of ordinary and per-decision importance sampling

For episodes generated by bbb from sss,

Eb[ρ0:T−1G0∣S0=s]=vπ(s)=Eb[G~0∣S0=s].\mathbb E_b\bigl[\rho_{0:T-1} G_0 \mid S_0 = s\bigr] = v_\pi(s) = \mathbb E_b\bigl[\tilde G_0 \mid S_0 = s\bigr].Eb​[ρ0:T−1​G0​∣S0​=s]=vπ​(s)=Eb​[G~0​∣S0​=s].

The first equality is Eq. (5.4) (p. 104); the second is the statement E[ρt:T−1Gt]=E[G~t]\mathbb E[\rho_{t:T-1}G_t] = \mathbb E[\tilde G_t]E[ρt:T−1​Gt​]=E[G~t​] of §5.9 (p. 114).

Milestones

  1. (5.3): the trajectory probability is a product, and the ratio of trajectory probabilities under π\piπ and bbb is ρ0:T−1\rho_{0:T-1}ρ0:T−1​, independent of the dynamics.
  2. (5.4) alone.
  3. (5.13): ∑ab(a∣x) π(a∣x)/b(a∣x)=∑aπ(a∣x)=1\sum_a b(a \mid x)\, \pi(a \mid x)/b(a \mid x) = \sum_a \pi(a \mid x) = 1∑a​b(a∣x)π(a∣x)/b(a∣x)=∑a​π(a∣x)=1 under coverage.
  4. (5.14) and its kkk-th form: Eb[ρ0:T−1Rk]=Eb[ρ0:k−1Rk]\mathbb E_b[\rho_{0:T-1} R_k] = \mathbb E_b[\rho_{0:k-1} R_k]Eb​[ρ0:T−1​Rk​]=Eb​[ρ0:k−1​Rk​] for every k≥1k \ge 1k≥1 (Exercise 5.13).
  5. Example 5.5: in a one-state MDP with a loop, vπ(s)=1v_\pi(s) = 1vπ​(s)=1 and Eb[ρ0:T−1G0]=1\mathbb E_b[\rho_{0:T-1}G_0] = 1Eb​[ρ0:T−1​G0​]=1, yet Eb[(ρ0:T−1G0)2]=∞\mathbb E_b[(\rho_{0:T-1}G_0)^2] = \inftyEb​[(ρ0:T−1​G0​)2]=∞.
  6. (5.7)–(5.8): the incremental rule Vn+1=Vn+(Wn/Cn)(Gn−Vn)V_{n+1} = V_n + (W_n/C_n)(G_n - V_n)Vn+1​=Vn​+(Wn​/Cn​)(Gn​−Vn​) computes the weighted average ∑k<nWkGk/∑k<nWk\sum_{k<n} W_k G_k / \sum_{k<n} W_k∑k<n​Wk​Gk​/∑k<n​Wk​ (Exercise 5.10).
  7. §5.8: Gt=(1−γ)∑h=t+1T−1γh−t−1Gˉt:h+γT−t−1Gˉt:TG_t = (1-\gamma)\sum_{h=t+1}^{T-1}\gamma^{h-t-1}\bar G_{t:h} + \gamma^{T-t-1}\bar G_{t:T}Gt​=(1−γ)∑h=t+1T−1​γh−t−1Gˉt:h​+γT−t−1Gˉt:T​ with flat partial returns Gˉt:h=Rt+1+⋯+Rh\bar G_{t:h} = R_{t+1} + \dots + R_hGˉt:h​=Rt+1​+⋯+Rh​.

Significance

Eq. (5.4) is the reason the first-visit ordinary importance-sampling estimator (5.5) is unbiased, and it is the template for every importance-sampling correction in the rest of the book. The per-decision identity shows that an estimator with fewer ratio factors per reward, (5.15), has the same expectation, which is the starting point for per-decision and control-variate methods for multi-step off-policy learning (Precup, Sutton and Singh 2000). Example 5.5 shows that unbiasedness says nothing about variance: the ordinary estimator can have infinite variance on a two-action problem, which motivates weighted importance sampling and the incremental weighted update of §5.6.

The results of these sections are classical and proved informally in the book, partly as exercises (5.10, 5.13) left without solution. No machine-checked version exists on the platform: a search for importance sampling, off-policy and per-decision returned no statements. The mission produces a formal trajectory model of an episodic MDP under two policies, which later missions on nnn-step off-policy returns and off-policy traces can reuse.

Difficulty

Eq. (5.4) itself is a termwise identity: for every episode, Pr⁡b(episode) ρ0:T−1=Pr⁡π(episode)\Pr_b(\text{episode})\,\rho_{0:T-1} = \Pr_\pi(\text{episode})Prb​(episode)ρ0:T−1​=Prπ​(episode) under coverage. The per-decision identity is not termwise. The later factors of ρ0:T−1\rho_{0:T-1}ρ0:T−1​ multiply a reward that was received before the corresponding decisions, and removing them requires summing over all continuations of an episode prefix, of every remaining length, and using that each factor has conditional expectation one (5.13) and that the continuation terminates with probability one. The obvious attempt, cancelling the factors episode by episode, fails: on a single episode ρ0:T−1R1\rho_{0:T-1}R_1ρ0:T−1​R1​ and ρ0:0R1\rho_{0:0}R_1ρ0:0​R1​ differ.

In Example 5.5 the episodes have no length bound, so the expected square is an infinite series over episode lengths whose divergence must be shown directly.

Formalization scope

  • States, actions and rewards are finite types; the terminal states are a finite subset of the state type. Policies are stochastic, one action set is used in every state, and vπv_\pivπ​ is defined as an expected return, never as the solution of a Bellman equation.
  • Expectations are series over episode lengths of finite sums over episodes. Lean assigns 000 to a divergent series, so the goal and milestones 2 and 4 assume that under bbb every episode from sss terminates within a fixed number HHH of steps with probability one. The book leaves termination implicit; this bounded-horizon hypothesis is a restriction relative to the book's episodic setting and is stated as such. Example 5.5, whose episodes are unbounded, is stated without it, with the expected square in [0,∞][0, \infty][0,∞].
  • The discount rate is kept general in [0,1][0, 1][0,1].
  • The importance-sampling ratio uses real division; a factor with b(Ak∣Sk)=0b(A_k \mid S_k) = 0b(Ak​∣Sk​)=0 evaluates to 000 in Lean, but such episodes have probability 000 under bbb.
  • The flat-partial-return decomposition is an algebraic identity and is stated for every real γ\gammaγ, which is more general than the book's "for any γ∈[0,1)\gamma \in [0,1)γ∈[0,1)".
  • The incremental weighted update is stated with nonnegative weights and W1>0W_1 > 0W1​>0. The book's C0=0C_0 = 0C0​=0 makes (5.8) divide by zero at n=1n = 1n=1 when W1=0W_1 = 0W1​=0; the hypothesis excludes that case.
  • A trivializing formalization is ruled out: vπv_\pivπ​ is the expected return of π\piπ's own episodes, the ratio is computed from the episode, and the per-decision identity, which carries the chapter's content beyond (5.4), is part of the goal.
  • Not stated: the bias and variance comparisons of ordinary and weighted importance sampling (p. 105) and the discounting-aware estimators (5.9)–(5.10) as estimators; these are statistical claims about estimators over a random number of visits that the book does not make precise.

Contributions welcome: proofs of the milestones, a general measure-theoretic version of the trajectory model without the bounded-horizon hypothesis, and variants for action values qπq_\piqπ​ (Exercise 5.6).

Selected references

  • R. S. Sutton and A. G. Barto, Reinforcement Learning: An Introduction, 2nd ed., MIT Press, 2018, ISBN 9780262039246, §§5.5–5.9, pp. 103–115. http://incompleteideas.net/book/the-book-2nd.html
  • D. Precup, R. S. Sutton and S. Singh, Eligibility Traces for Off-Policy Policy Evaluation, Proceedings of the 17th International Conference on Machine Learning (ICML), 2000, pp. 759–766 (cited in the book's bibliography).
  • D. Precup, R. S. Sutton and S. Dasgupta, Off-Policy Temporal-Difference Learning with Function Approximation, Proceedings of the 18th International Conference on Machine Learning (ICML), 2001, pp. 417–424 (cited in the book, p. 105).
14 thms0 active usersReviewed
Dynamic ProgrammingMachine Learning·Captain: mikedeng1

Reinforcement Learning: An Introduction IV: Policy Iteration for ε-Soft PoliciesTextbook

Motivation

Policy iteration alternates two steps: evaluate the current policy, then replace it by a policy that is greedy with respect to the evaluated action values. The policy improvement theorem guarantees that each greedy step does not make the policy worse, and that the process stops only at an optimal policy. When the action values are estimated from experience rather than computed from a model, as in Monte Carlo control, a greedy policy is a problem: it never tries the actions it does not currently prefer, so their values are never re-estimated. Sutton and Barto, Reinforcement Learning: An Introduction (2nd ed., 2018), §5.4, resolve this without the unrealistic assumption of exploring starts by moving the policy only toward a greedy one, to an ε-greedy policy that keeps every action's probability at least ε/|A|.

The question this mission formalizes is whether policy iteration still works under that restriction. The book's answer (pp. 101–102) is yes, in a precise sense: an ε-greedy step never makes an ε-soft policy worse, and it fails to make it strictly better only when the policy is already the best among all ε-soft policies. This is the dynamic-programming fact that justifies on-policy first-visit Monte Carlo control for ε-soft policies, and more broadly every ε-greedy on-policy control scheme that is analysed with exact action values.

Setting

A finite Markov decision process has a finite state set S, a finite nonempty action set A used in every state, a finite reward set R ⊂ ℝ and dynamics p(s′, r | s, a) ≥ 0 with ∑s′,rp(s′,r∣s,a)=1\sum_{s', r} p(s', r \mid s, a) = 1∑s′,r​p(s′,r∣s,a)=1. A policy π gives, for each state s, a probability distribution π(· | s) on A. With a discount rate 0≤γ<10 \le \gamma < 10≤γ<1, the state value vπ(s)v_\pi(s)vπ​(s) is the expected discounted return Eπ[∑k≥0γkRt+k+1∣St=s]\mathbb E_\pi[\sum_{k \ge 0} \gamma^k R_{t+k+1} \mid S_t = s]Eπ​[∑k≥0​γkRt+k+1​∣St​=s], and the action value is

qπ(s,a)=∑s′,rp(s′,r∣s,a) [r+γvπ(s′)].q_\pi(s, a) = \sum_{s', r} p(s', r \mid s, a)\,[r + \gamma v_\pi(s')].qπ​(s,a)=s′,r∑​p(s′,r∣s,a)[r+γvπ​(s′)].

For ε > 0, a policy is ε-soft if π(a∣s)≥ε/∣A∣\pi(a \mid s) \ge \varepsilon/|A|π(a∣s)≥ε/∣A∣ for all s and a. A policy π′ is ε-greedy with respect to qπq_\piqπ​ if at each state some maximizer A∗(s)A^*(s)A∗(s) of qπ(s,⋅)q_\pi(s, \cdot)qπ​(s,⋅) receives probability 1−ε+ε/∣A∣1 - \varepsilon + \varepsilon/|A|1−ε+ε/∣A∣ and every other action receives ε/∣A∣\varepsilon/|A|ε/∣A∣; ties among maximizers are broken arbitrarily. A policy π is optimal among the ε-soft policies if it is ε-soft and vπ′′(s)≤vπ(s)v_{\pi''}(s) \le v_\pi(s)vπ′′​(s)≤vπ​(s) for every ε-soft π″ and every state s.

The book's analysis uses a new environment with the same states, actions and rewards, in which with probability 1 − ε the chosen action is executed and with probability ε a uniformly random action replaces it:

p~(s′,r∣s,a)=(1−ε) p(s′,r∣s,a)+∑a′ε∣A∣ p(s′,r∣s,a′).\tilde p(s', r \mid s, a) = (1 - \varepsilon)\, p(s', r \mid s, a) + \sum_{a'} \frac{\varepsilon}{|A|}\, p(s', r \mid s, a').p~​(s′,r∣s,a)=(1−ε)p(s′,r∣s,a)+a′∑​∣A∣ε​p(s′,r∣s,a′).

Its optimal value function is written v~∗\tilde v_*v~∗​.

Formalization targets

Goal: ε-greedy improvement with the equality case

For 0≤γ<10 \le \gamma < 10≤γ<1, 0<ε≤10 < \varepsilon \le 10<ε≤1, an ε-soft policy π and any ε-greedy policy π′ with respect to qπq_\piqπ​,

vπ′(s)≥vπ(s)for all s,andvπ′=vπ  ⟹  π,π′ are optimal among the ε-soft policies.v_{\pi'}(s) \ge v_\pi(s) \quad \text{for all } s, \qquad \text{and} \qquad v_{\pi'} = v_\pi \;\Longrightarrow\; \pi, \pi' \text{ are optimal among the ε-soft policies}.vπ′​(s)≥vπ​(s)for all s,andvπ′​=vπ​⟹π,π′ are optimal among the ε-soft policies.

The goal is stated in terms of the original MDP and ε-soft policies only; the new environment appears only in the milestones.

Milestones

  1. Policy improvement theorem for stochastic policies (4.7)–(4.8), p. 78: ∑aπ′(a∣s)qπ(s,a)≥vπ(s)\sum_a \pi'(a \mid s) q_\pi(s, a) \ge v_\pi(s)∑a​π′(a∣s)qπ​(s,a)≥vπ​(s) for all s implies vπ′≥vπv_{\pi'} \ge v_\pivπ′​≥vπ​, strictly at every state where the hypothesis is strict.
  2. Eq. (5.2), pp. 101–102: ∑aπ′(a∣s)qπ(s,a)=ε∣A∣∑aqπ(s,a)+(1−ε)max⁡aqπ(s,a)≥vπ(s)\sum_a \pi'(a \mid s) q_\pi(s, a) = \frac{\varepsilon}{|A|}\sum_a q_\pi(s, a) + (1-\varepsilon)\max_a q_\pi(s, a) \ge v_\pi(s)∑a​π′(a∣s)qπ​(s,a)=∣A∣ε​∑a​qπ​(s,a)+(1−ε)maxa​qπ​(s,a)≥vπ​(s).
  3. Characterization, p. 102: an ε-soft π is optimal among ε-soft policies if and only if vπ=v~∗v_\pi = \tilde v_*vπ​=v~∗​.
  4. Uniqueness, p. 102: v~∗\tilde v_*v~∗​ is the unique solution of the Bellman optimality equation with the altered transition probabilities p~\tilde pp~​, and that equation splits as (1−ε)max⁡a(⋅)+ε∣A∣∑a(⋅)(1-\varepsilon)\max_a(\cdot) + \frac{\varepsilon}{|A|}\sum_a(\cdot)(1−ε)maxa​(⋅)+∣A∣ε​∑a​(⋅).
  5. Fixed-point equation, p. 102: if vπ′=vπv_{\pi'} = v_\pivπ′​=vπ​, then vπ(s)=(1−ε)max⁡aqπ(s,a)+ε∣A∣∑aqπ(s,a)v_\pi(s) = (1-\varepsilon)\max_a q_\pi(s, a) + \frac{\varepsilon}{|A|}\sum_a q_\pi(s, a)vπ​(s)=(1−ε)maxa​qπ​(s,a)+∣A∣ε​∑a​qπ​(s,a).

Significance

The result is what makes ε-greedy on-policy control a form of generalized policy iteration: monotone improvement at every step, and a characterization of where the process can stop. It also locates precisely what is lost by exploring, namely that the fixed point is optimal among ε-soft policies, not among all policies. The value v~∗\tilde v_*v~∗​ of the new environment is the benchmark against which ε-greedy methods converge when action values are exact.

The book presents the argument informally and states the stochastic policy improvement theorem without proof ("we will not go through the details", p. 79). A formalization supplies the missing proof of the stochastic case, the identification of the best ε-soft policy value with the optimal value of a modified MDP, and the uniqueness of that value. As far as a search of the platform shows, no statement about ε-soft or ε-greedy policies has been formalized there; existing finite-MDP results (Bellman optimality in the Foundations of Machine Learning and Bertsekas series) use different reward models and do not cover the modified environment.

Difficulty

The improvement half follows from (5.2) and the policy improvement theorem, but both need work in the return-based model: the theorem requires comparing infinite discounted sums under two different Markov chains, and (5.2) uses the identity vπ(s)=∑aπ(a∣s)qπ(s,a)v_\pi(s) = \sum_a \pi(a \mid s) q_\pi(s, a)vπ​(s)=∑a​π(a∣s)qπ​(s,a), which is a theorem about returns, not a definition. The equality half is where the obvious argument fails. The deterministic-policy argument of Chapter 4 shows that an unimproved greedy policy satisfies the ordinary Bellman optimality equation; here the unimproved policy satisfies a different equation, and nothing in the original MDP identifies its solution with the best ε-soft value. That identification needs two further facts: every policy of the new environment corresponds to an ε-soft policy of the original one with the same values, and conversely (at ε = 1 only the uniform policy is ε-soft); and the altered optimality equation has exactly one solution.

Formalization scope

Everything is stated in the namespace SuttonBartoRL.EpsSoft on a finite MDP with four-argument dynamics, one finite nonempty action set for all states (so ∣A(s)∣=∣A∣|A(s)| = |A|∣A(s)∣=∣A∣, the book's footnote 3, p. 48), and a finite reward set. The conventions are:

  • vπv_\pivπ​ is defined from expected discounted returns as ∑kγk(Pπkrπ)(s)\sum_k \gamma^k (P_\pi^k r_\pi)(s)∑k​γk(Pπk​rπ​)(s) with 0≤γ<10 \le \gamma < 10≤γ<1; Bellman equations are theorems, never definitions. qπq_\piqπ​ is the one-step lookahead (4.6) on this vπv_\pivπ​.
  • v~∗\tilde v_*v~∗​ is the supremum of the new environment's policy values over all stochastic policies, a bounded family for γ<1\gamma < 1γ<1.
  • ε ranges over (0, 1]: the book requires ε > 0, and for ε > 1 no ε-soft policy exists. The equality in (5.2) is stated without the book's intermediate division by 1 − ε, so the case ε = 1 is included.
  • "Any ε-greedy policy" is encoded by quantifying over every choice of maximizer at every state.
  • "Optimal among ε-soft policies" means ε-soft and pointwise at least as good as every ε-soft policy.

Defining vπv_\pivπ​ as the solution of the Bellman expectation equation, or v~∗\tilde v_*v~∗​ as the solution of the altered optimality equation, would make milestones 3–5 and the goal's equality half hold by definition; the formalization does neither. The goal is not the statement "vπ′≥vπv_{\pi'} \ge v_\pivπ′​≥vπ​" alone: the equality case is part of the book's claim and part of the goal.

The finite-MDP definitions duplicate those of other missions in this series and are expected to be merged later. Useful contributions include the Neumann-series identity vπ=(I−γPπ)−1rπv_\pi = (I - \gamma P_\pi)^{-1} r_\pivπ​=(I−γPπ​)−1rπ​, the Bellman expectation equation, the contraction property of Bellman operators, and the correspondence between policies of the new environment and ε-soft policies of the original one; these are reusable for the other finite-MDP missions of the series.

Selected references

  • R. S. Sutton and A. G. Barto, Reinforcement Learning: An Introduction, 2nd ed., MIT Press, 2018, ISBN 9780262039246, §4.2 (pp. 76–79) and §5.4 (pp. 100–103). http://incompleteideas.net/book/the-book-2nd.html
  • R. A. Howard, Dynamic Programming and Markov Processes, MIT Press, 1960 (policy iteration).
  • M. L. Puterman, Markov Decision Processes: Discrete Stochastic Dynamic Programming, Wiley, 1994, doi:10.1002/9780470316887.
11 thms0 active usersReviewed
Machine LearningMarkov ChainOptimization·Captain: mikedeng1

Reinforcement Learning: An Introduction XII: The Policy Gradient TheoremTextbook

Motivation

Policy gradient methods learn a parameterized policy π(a∣s,θ)\pi(a \mid s, \theta)π(a∣s,θ) directly, by stochastic gradient ascent on a scalar performance measure J(θ)J(\theta)J(θ), instead of deriving the policy from learned action values. They are how reinforcement learning handles continuous action spaces, stochastic optimal policies and prior knowledge built into the policy's form, and they underlie REINFORCE (Williams, 1992) and the actor–critic family. Every such method needs an estimate of ∇J(θ)\nabla J(\theta)∇J(θ). The difficulty is that JJJ depends on θ\thetaθ in two ways: through the action choices in each state, and through the distribution of states those choices produce. The second effect depends on the unknown environment dynamics.

The policy gradient theorem (Sutton, McAllester, Singh and Mansour, 2000; Marbach and Tsitsiklis, 2001) gives ∇J(θ)\nabla J(\theta)∇J(θ) as an expectation over the on-policy state distribution that involves no derivative of that distribution. Chapter 13 of Sutton and Barto's Reinforcement Learning: An Introduction (2nd ed., 2018) states it as Eq. (13.5), proves it in a box for the episodic case (p. 325) and in a second box for the continuing case (pp. 334–335), and builds REINFORCE, REINFORCE with baseline and actor–critic methods on it. This mission formalizes that chapter's theorem and the identities around it, in the book's own model.

Setting

A finite episodic MDP has a finite set S\mathcal SS of nonterminal states, a terminal state, a finite action set A\mathcal AA, a finite reward set R⊂R\mathcal R \subset \mathbb RR⊂R and dynamics p(s′,r∣s,a)p(s', r \mid s, a)p(s′,r∣s,a): for each nonterminal sss and action aaa, a probability distribution over next state s′∈S+=S∪{terminal}s' \in \mathcal S^+ = \mathcal S \cup \{\text{terminal}\}s′∈S+=S∪{terminal} and reward rrr. The terminal state is absorbing and pays nothing. Write p(s′∣s,a)=∑rp(s′,r∣s,a)p(s' \mid s, a) = \sum_r p(s', r \mid s, a)p(s′∣s,a)=∑r​p(s′,r∣s,a) and r(s,a)r(s, a)r(s,a) for the expected reward.

A differentiable policy parameterization assigns to every θ∈Rd′\theta \in \mathbb R^{d'}θ∈Rd′ and state sss a distribution π(⋅∣s,θ)\pi(\cdot \mid s, \theta)π(⋅∣s,θ) over actions, with θ↦π(a∣s,θ)\theta \mapsto \pi(a \mid s, \theta)θ↦π(a∣s,θ) differentiable. Under πθ\pi_\thetaπθ​ the nonterminal states form a substochastic chain with matrix Pθ(s,s′)=∑aπ(a∣s,θ)p(s′∣s,a)P_\theta(s, s') = \sum_a \pi(a \mid s, \theta) p(s' \mid s, a)Pθ​(s,s′)=∑a​π(a∣s,θ)p(s′∣s,a); Pr⁡(s→x,k,π)=Pθk(s,x)\Pr(s \to x, k, \pi) = P_\theta^k(s, x)Pr(s→x,k,π)=Pθk​(s,x). Episodes terminate when ∑kPθk(s,s′)<∞\sum_{k} P_\theta^k(s, s') < \infty∑k​Pθk​(s,s′)<∞ for all s,s′s, s's,s′.

There is no discounting (γ=1\gamma = 1γ=1, p. 324). The state value vπ(s)=∑k≥0(Pθkrθ)(s)v_{\pi}(s) = \sum_{k \ge 0} (P_\theta^k r_\theta)(s)vπ​(s)=∑k≥0​(Pθk​rθ​)(s) is the expected total reward from sss, with rθ(s)=∑aπ(a∣s,θ)r(s,a)r_\theta(s) = \sum_a \pi(a\mid s,\theta) r(s,a)rθ​(s)=∑a​π(a∣s,θ)r(s,a); the action value qπ(s,a)q_\pi(s,a)qπ​(s,a) is the expected total reward after taking aaa in sss. The episode starts in a fixed state s0s_0s0​, and the performance is J(θ)=vπθ(s0)J(\theta) = v_{\pi_\theta}(s_0)J(θ)=vπθ​​(s0​) (13.4). The expected number of visits to sss in an episode is η(s)=∑k≥0Pr⁡(s0→s,k,π)\eta(s) = \sum_{k \ge 0} \Pr(s_0 \to s, k, \pi)η(s)=∑k≥0​Pr(s0​→s,k,π), and the on-policy distribution is μ(s)=η(s)/∑s′η(s′)\mu(s) = \eta(s) / \sum_{s'} \eta(s')μ(s)=η(s)/∑s′​η(s′) (9.3).

In the continuing case there is no terminal state, J(θ)=r(π)J(\theta) = r(\pi)J(θ)=r(π) is the average reward per step (13.15), μ\muμ is the steady-state distribution, and vπv_\pivπ​, qπq_\piqπ​ are differential values, defined from the return ∑k(Rt+k+1−r(π))\sum_k (R_{t+k+1} - r(\pi))∑k​(Rt+k+1​−r(π)) (13.17).

Formalization targets

Goal: the policy gradient theorem, episodic case (13.5)

If episodes terminate under πθ0\pi_{\theta_0}πθ0​​, then JJJ is differentiable at θ0\theta_0θ0​ and

∇J(θ0)=∑sη(s)∑aqπ(s,a) ∇π(a∣s,θ0)=(∑s′η(s′))∑sμ(s)∑aqπ(s,a) ∇π(a∣s,θ0),\nabla J(\theta_0) = \sum_s \eta(s) \sum_a q_\pi(s,a)\, \nabla \pi(a \mid s, \theta_0) = \Big(\sum_{s'} \eta(s')\Big) \sum_s \mu(s) \sum_a q_\pi(s,a)\, \nabla \pi(a \mid s, \theta_0),∇J(θ0​)=s∑​η(s)a∑​qπ​(s,a)∇π(a∣s,θ0​)=(s′∑​η(s′))s∑​μ(s)a∑​qπ​(s,a)∇π(a∣s,θ0​),

with ∑s′η(s′)≥1\sum_{s'} \eta(s') \ge 1∑s′​η(s′)≥1. The book writes ∇J(θ)∝∑sμ(s)∑aqπ(s,a)∇π(a∣s,θ)\nabla J(\theta) \propto \sum_s \mu(s) \sum_a q_\pi(s,a) \nabla \pi(a \mid s,\theta)∇J(θ)∝∑s​μ(s)∑a​qπ​(s,a)∇π(a∣s,θ) and names the constant, the average length of an episode, in words (p. 326). The goal states it.

Milestones

  1. Exercises 3.18–3.19 with γ=1\gamma = 1γ=1: vπ(s)=∑aπ(a∣s)qπ(s,a)v_\pi(s) = \sum_a \pi(a\mid s) q_\pi(s,a)vπ​(s)=∑a​π(a∣s)qπ​(s,a) and qπ(s,a)=∑s′,rp(s′,r∣s,a)(r+vπ(s′))q_\pi(s,a) = \sum_{s',r} p(s',r\mid s,a)(r + v_\pi(s'))qπ​(s,a)=∑s′,r​p(s′,r∣s,a)(r+vπ​(s′)).
  2. The recursion ∇vπ(s)=∑a[∇π(a∣s)qπ(s,a)+π(a∣s)∑s′p(s′∣s,a)∇vπ(s′)]\nabla v_\pi(s) = \sum_a [\nabla\pi(a\mid s) q_\pi(s,a) + \pi(a\mid s) \sum_{s'} p(s'\mid s,a) \nabla v_\pi(s')]∇vπ​(s)=∑a​[∇π(a∣s)qπ​(s,a)+π(a∣s)∑s′​p(s′∣s,a)∇vπ​(s′)], including the differentiability of vπv_\pivπ​.
  3. The unrolled gradient ∇vπ(s)=∑x∑k=0∞Pr⁡(s→x,k,π)∑a∇π(a∣x)qπ(x,a)\nabla v_\pi(s) = \sum_{x} \sum_{k=0}^\infty \Pr(s \to x, k, \pi) \sum_a \nabla\pi(a\mid x) q_\pi(x,a)∇vπ​(s)=∑x​∑k=0∞​Pr(s→x,k,π)∑a​∇π(a∣x)qπ​(x,a) for every sss.
  4. The theorem with a baseline (13.10): ∑ab(s)∇π(a∣s,θ)=0\sum_a b(s) \nabla \pi(a\mid s,\theta) = 0∑a​b(s)∇π(a∣s,θ)=0, hence qπq_\piqπ​ may be replaced by qπ−bq_\pi - bqπ​−b.
  5. The log form behind REINFORCE: where π(⋅∣s,θ)>0\pi(\cdot\mid s,\theta) > 0π(⋅∣s,θ)>0, ∑aqπ(s,a)∇π(a∣s,θ)=∑aπ(a∣s,θ)qπ(s,a)∇ln⁡π(a∣s,θ)\sum_a q_\pi(s,a) \nabla\pi(a\mid s,\theta) = \sum_a \pi(a\mid s,\theta) q_\pi(s,a) \nabla \ln \pi(a\mid s,\theta)∑a​qπ​(s,a)∇π(a∣s,θ)=∑a​π(a∣s,θ)qπ​(s,a)∇lnπ(a∣s,θ), and hence ∇J(θ)=(∑s′η(s′))∑sμ(s)∑aπ(a∣s,θ)qπ(s,a)∇ln⁡π(a∣s,θ)\nabla J(\theta) = (\sum_{s'}\eta(s')) \sum_s \mu(s) \sum_a \pi(a\mid s,\theta) q_\pi(s,a) \nabla \ln \pi(a\mid s,\theta)∇J(θ)=(∑s′​η(s′))∑s​μ(s)∑a​π(a∣s,θ)qπ​(s,a)∇lnπ(a∣s,θ), the exact form of ∇J∝Eπ[qπ(St,At)∇π(At∣St,θ)/π(At∣St,θ)]\nabla J \propto \mathbb E_\pi[q_\pi(S_t,A_t) \nabla\pi(A_t\mid S_t,\theta)/\pi(A_t\mid S_t,\theta)]∇J∝Eπ​[qπ​(St​,At​)∇π(At​∣St​,θ)/π(At​∣St​,θ)].
  6. Exercise 13.3, (13.9): for the linear soft-max, ∇ln⁡π(a∣s,θ)=x(s,a)−∑bπ(b∣s,θ)x(s,b)\nabla \ln \pi(a\mid s,\theta) = x(s,a) - \sum_b \pi(b\mid s,\theta) x(s,b)∇lnπ(a∣s,θ)=x(s,a)−∑b​π(b∣s,θ)x(s,b).
  7. Exercise 13.4: the eligibility vectors of the Gaussian policy (13.19)–(13.20).
  8. The continuing case: under ergodicity, ∇r(πθ)=∑sμ(s)∑a∇π(a∣s,θ)qπ(s,a)\nabla r(\pi_\theta) = \sum_s \mu(s) \sum_a \nabla\pi(a\mid s,\theta) q_\pi(s,a)∇r(πθ​)=∑s​μ(s)∑a​∇π(a∣s,θ)qπ​(s,a) with differential qπq_\piqπ​.

Significance

The theorem turns ∇J\nabla J∇J into a quantity that can be sampled by following the policy: weighting states by μ\muμ is what visiting them under π\piπ does, and the log form makes the action sum an expectation over At∼πA_t \sim \piAt​∼π. REINFORCE (13.8), REINFORCE with baseline (13.11) and one-step and eligibility-trace actor–critic methods all rest on it, and so does their claim that the expected update is in the direction of the performance gradient (p. 329). The baseline identity is why a learned state value can reduce variance without introducing bias.

The results are proved, in the book and in the literature. What this mission adds is a machine-checked version in the book's model: random episode lengths with γ=1\gamma = 1γ=1, vector parameters θ∈Rd′\theta \in \mathbb R^{d'}θ∈Rd′, four-argument dynamics, and values defined from expected returns. The platform already has a proved finite-horizon policy gradient theorem (policy_gradient_finite_horizon, with a baseline and log-form companion) for a fixed horizon TTT, a scalar parameter θ∈R\theta \in \mathbb Rθ∈R and an expected-reward kernel; it does not cover the book's statement. The mission also makes explicit two points the text leaves informal: that episodes terminate, and what exact constant hides behind "∝\propto∝".

Difficulty

The book's proof is a formal manipulation: differentiate the Bellman equation, substitute it into itself, and "unroll" infinitely often. Two steps are not justified on the page. First, it presupposes that ∇vπ(s)\nabla v_\pi(s)∇vπ​(s) exists; with γ=1\gamma = 1γ=1 the value is an infinite series whose convergence depends on θ\thetaθ through termination, so differentiability of vπv_\pivπ​ at θ0\theta_0θ0​ has to be established, and termination is assumed only at θ0\theta_0θ0​. Second, "repeated unrolling" is a limit: after nnn unrollings a remainder ∑xPθn(s,x)∇vπ(x)\sum_x P_\theta^{n}(s,x) \nabla v_\pi(x)∑x​Pθn​(s,x)∇vπ​(x) is left over, and it vanishes only because Pθn→0P_\theta^n \to 0Pθn​→0. Differentiating the series for vπv_\pivπ​ term by term is not an alternative shortcut without a uniform bound on the derivatives of PθkP_\theta^kPθk​.

In the continuing case the corresponding obstacle is the differentiability of the steady-state distribution and of the differential values, which the book's proof uses without comment; here they are part of what is to be proved, from ergodicity at θ0\theta_0θ0​ alone.

Formalization scope

  • Model. S+\mathcal S^+S+ is Option S, with none the single terminal state (several terminal states can be merged, all having value 0). One action type for all states. θ\thetaθ lives in EuclideanSpace ℝ (Fin d), and ∇\nabla∇ is Mathlib's gradient; conclusions are HasGradientAt, so differentiability is asserted, not assumed.
  • Values from returns. vπv_\pivπ​, qπq_\piqπ​, η\etaη are series in powers of PθP_\thetaPθ​; Bellman equations are theorems (milestone 1). The continuing-case average reward and steady-state distribution are the limits of (13.15), and the differential values are the series of (13.17).
  • Implicit hypotheses made explicit. Termination under πθ0\pi_{\theta_0}πθ0​​ is a hypothesis of every episodic result that involves values; the continuing case assumes the book's ergodicity (the limit of Pr⁡{St=s′}\Pr\{S_t = s'\}Pr{St​=s′} exists and does not depend on S0S_0S0​) at θ0\theta_0θ0​. The positivity of π(a∣s,θ0)\pi(a \mid s,\theta_0)π(a∣s,θ0​) is assumed where a logarithm is differentiated.
  • "∝". The episodic goal states the exact equality with the constant ∑s′η(s′)\sum_{s'} \eta(s')∑s′​η(s′) and proves it is at least 1. A formalization of the form "∃c, ∇J=c⋅…\exists c,\ \nabla J = c \cdot \ldots∃c, ∇J=c⋅…" is ruled out: it holds with c=0c = 0c=0 and loses the book's constant.
  • Fixed start state. s0s_0s0​ is a fixed state, as in the book (p. 324); no start distribution.
  • Not included. Convergence of REINFORCE or actor–critic under stochastic-approximation conditions (p. 329) rests on unstated conditions and is not an item. The baseline is a deterministic function of the state, not the random variable the book also allows.

Reusable infrastructure: the episodic value layer (substochastic chains, expected visits, termination) is needed by any undiscounted episodic RL result; the soft-max and Gaussian eligibility computations are needed by every policy-gradient algorithm. Proofs of any milestone, and general lemmas on the differentiability of values and stationary distributions of parameterized finite Markov chains, are welcome.

Selected references

  • R. S. Sutton and A. G. Barto, Reinforcement Learning: An Introduction, 2nd ed., MIT Press, 2018, ISBN 9780262039246, Chapter 13. http://incompleteideas.net/book/the-book-2nd.html
  • R. S. Sutton, D. McAllester, S. Singh and Y. Mansour, Policy Gradient Methods for Reinforcement Learning with Function Approximation, NeurIPS 12, 2000. https://proceedings.neurips.cc/paper/1999/hash/464d828b85b0bed98e80ade0a5c43b0f-Abstract.html
  • P. Marbach and J. N. Tsitsiklis, Simulation-Based Optimization of Markov Reward Processes, IEEE Transactions on Automatic Control 46(2), 2001. https://doi.org/10.1109/9.905687
  • R. J. Williams, Simple Statistical Gradient-Following Algorithms for Connectionist Reinforcement Learning, Machine Learning 8, 1992. https://doi.org/10.1007/BF00992696
14 thms0 active usersReviewed
Linear algebraMachine Learning·Captain: mikedeng1

Reinforcement Learning: An Introduction XI: Dutch Traces and the Equivalence of Forward and Backward Views in Monte Carlo LearningTextbook

Motivation

Eligibility traces are one of the basic mechanisms of reinforcement learning. A trace is a short-term memory vector ztz_tzt​ with one component per weight. It records which components contributed to recent value estimates, so that an error observed now can be credited to the right components without storing the past. Chapter 12 of Sutton and Barto's Reinforcement Learning: An Introduction (2nd ed., 2018) organizes the topic around two ways of describing an algorithm. A forward view updates each state toward a target built from rewards that arrive later. A backward view makes an update at every step from the current error and the trace.

The chapter proves one exact equivalence between the two views itself, in §12.6: "This is the only equivalence of forward- and backward-views that we explicitly demonstrate in this book" (p. 301). The setting is linear Monte Carlo prediction, and the backward view uses a dutch trace. The same trace appears in true online TD(λ\lambdaλ), whose exact equivalence to the online λ\lambdaλ-return algorithm (van Seijen and Sutton, 2014; van Seijen et al., 2016) the book cites without proof. Of that proof, §12.6 "gives some of the flavor ... but is much simpler" (p. 301).

The older equivalence of §§12.1–12.2 goes back to Sutton (1988). If the weights are held fixed during an episode, the summed updates of TD(λ\lambdaλ) with accumulating traces equal the summed updates of the off-line λ\lambdaλ-return algorithm. The book leaves it as Exercises 12.3–12.4.

Setting

Fix a dimension ddd, a step size α\alphaα and an episode of length T≥1T \ge 1T≥1 with feature vectors x0,…,xT−1∈Rdx_0, \dots, x_{T-1} \in \mathbb R^dx0​,…,xT−1​∈Rd. The episode ends with a single return G∈RG \in \mathbb RG∈R ("a single reward received at the end of the episode ... and ... no discounting", p. 301). The forward view is the linear gradient Monte Carlo, or LMS, rule (12.13): from an initial w0w_0w0​,

wt+1=wt+α [G−wt⊤xt] xt,0≤t<T.w_{t+1} = w_t + \alpha\,[G - w_t^\top x_t]\,x_t, \qquad 0 \le t < T .wt+1​=wt​+α[G−wt⊤​xt​]xt​,0≤t<T.

Let Ft=I−αxtxt⊤F_t = I - \alpha x_t x_t^\topFt​=I−αxt​xt⊤​ be the fading matrix. The backward view keeps two vectors that are updated at each step in O(d)O(d)O(d) time without knowledge of GGG. The dutch trace is z0=x0z_0 = x_0z0​=x0​, zt=zt−1+(1−αzt−1⊤xt) xtz_t = z_{t-1} + (1 - \alpha z_{t-1}^\top x_t)\,x_tzt​=zt−1​+(1−αzt−1⊤​xt​)xt​. The auxiliary vector is at=at−1−αxtxt⊤at−1a_t = a_{t-1} - \alpha x_t x_t^\top a_{t-1}at​=at−1​−αxt​xt⊤​at−1​, with a0=F0w0a_0 = F_0 w_0a0​=F0​w0​.

For the second part, an episode S0,R1,S1,…,RT,STS_0, R_1, S_1, \dots, R_T, S_TS0​,R1​,S1​,…,RT​,ST​ carries states and rewards, and v^(s,w)\hat v(s, w)v^(s,w) is a differentiable value function with v^(terminal,⋅)=0\hat v(\text{terminal}, \cdot) = 0v^(terminal,⋅)=0. For one fixed weight vector www, define the following, with γ∈[0,1]\gamma \in [0,1]γ∈[0,1] and λ∈[0,1)\lambda \in [0,1)λ∈[0,1):

  • the return GtG_tGt​;
  • the nnn-step return Gt:t+nG_{t:t+n}Gt:t+n​ (12.1), with Gt:t+n=GtG_{t:t+n} = G_tGt:t+n​=Gt​ once t+n≥Tt + n \ge Tt+n≥T;
  • the λ\lambdaλ-return Gtλ=(1−λ)∑n≥1λn−1Gt:t+nG^\lambda_t = (1-\lambda)\sum_{n \ge 1}\lambda^{n-1} G_{t:t+n}Gtλ​=(1−λ)∑n≥1​λn−1Gt:t+n​ (12.2);
  • the TD error δt=Rt+1+γv^(St+1,w)−v^(St,w)\delta_t = R_{t+1} + \gamma\hat v(S_{t+1}, w) - \hat v(S_t, w)δt​=Rt+1​+γv^(St+1​,w)−v^(St​,w) (12.6);
  • the accumulating trace z−1=0z_{-1} = 0z−1​=0, zt=γλzt−1+∇v^(St,w)z_t = \gamma\lambda z_{t-1} + \nabla\hat v(S_t, w)zt​=γλzt−1​+∇v^(St​,w) (12.5).

Formalization targets

Goal: the dutch-trace equivalence (12.14), corrected

wT=aT−1+αG zT−1.w_T = a_{T-1} + \alpha G\, z_{T-1}.wT​=aT−1​+αGzT−1​.

The left side is the forward view after TTT LMS updates. On the right, aT−1a_{T-1}aT−1​ and zT−1z_{T-1}zT−1​ are produced by the incremental recursions above. The goal is about the two algorithms, not only about the closed-form product identity.

Milestones on the goal's path (§12.6, p. 302)

  1. wt+1=Ftwt+αGxtw_{t+1} = F_t w_t + \alpha G x_twt+1​=Ft​wt​+αGxt​.
  2. wT=FT−1⋯F0w0+αG∑k=0T−1FT−1⋯Fk+1xkw_T = F_{T-1}\cdots F_0 w_0 + \alpha G \sum_{k=0}^{T-1} F_{T-1}\cdots F_{k+1} x_kwT​=FT−1​⋯F0​w0​+αG∑k=0T−1​FT−1​⋯Fk+1​xk​, the first line of (12.14).
  3. zt=∑k=0tFt⋯Fk+1xkz_t = \sum_{k=0}^{t} F_t \cdots F_{k+1} x_kzt​=∑k=0t​Ft​⋯Fk+1​xk​ for the dutch-trace recursion.
  4. at=Ft⋯F0w0a_t = F_t \cdots F_0 w_0at​=Ft​⋯F0​w0​ for the auxiliary-vector recursion (corrected initialization).

Milestones on the λ\lambdaλ-return (§§12.1–12.2)

  1. (12.3): Gtλ=(1−λ)∑n=1T−t−1λn−1Gt:t+n+λT−t−1GtG^\lambda_t = (1-\lambda)\sum_{n=1}^{T-t-1}\lambda^{n-1}G_{t:t+n} + \lambda^{T-t-1}G_tGtλ​=(1−λ)∑n=1T−t−1​λn−1Gt:t+n​+λT−t−1Gt​ for t<Tt < Tt<T.
  2. Exercise 12.1: Gtλ=Rt+1+γ[(1−λ)v^(St+1,w)+λGt+1λ]G^\lambda_t = R_{t+1} + \gamma[(1-\lambda)\hat v(S_{t+1}, w) + \lambda G^\lambda_{t+1}]Gtλ​=Rt+1​+γ[(1−λ)v^(St+1​,w)+λGt+1λ​].
  3. Exercise 12.3: Gtλ−v^(St,w)=∑k=tT−1(γλ)k−tδkG^\lambda_t - \hat v(S_t, w) = \sum_{k=t}^{T-1}(\gamma\lambda)^{k-t}\delta_kGtλ​−v^(St​,w)=∑k=tT−1​(γλ)k−tδk​.
  4. Exercise 12.4: ∑t<Tαδtzt=∑t<Tα[Gtλ−v^(St,w)]∇v^(St,w)\sum_{t<T}\alpha\delta_t z_t = \sum_{t<T}\alpha[G^\lambda_t - \hat v(S_t, w)]\nabla\hat v(S_t, w)∑t<T​αδt​zt​=∑t<T​α[Gtλ​−v^(St​,w)]∇v^(St​,w).

Significance

The goal says that an O(d)O(d)O(d)-per-step algorithm reproduces the Monte Carlo/LMS result exactly. That algorithm never stores the feature vectors or the TTT intermediate weight vectors. The book draws the conclusion that eligibility traces "are not specific to TD learning at all" (p. 303). The dutch trace in the case γλ=1\gamma\lambda = 1γλ=1 is the same object that true online TD(λ\lambdaλ) (12.11) uses for general γλ\gamma\lambdaγλ. The fading-matrix products and their incremental forms are therefore the vocabulary of any later formalization of true online TD(λ\lambdaλ) and of the online λ\lambdaλ-return algorithm.

Exercises 12.3–12.4 are the fixed-weight equivalence of TD(λ\lambdaλ) and the off-line λ\lambdaλ-return algorithm. They are the standard justification for calling TD(λ\lambdaλ) an approximation of the λ\lambdaλ-return algorithm. Exercise 12.1 and (12.3) are the identities the rest of the chapter uses to manipulate λ\lambdaλ-returns.

On status: all of these results are known and elementary on paper, and the book prints the derivation of (12.14). To our knowledge none of them has a machine-checked proof, and the platform has no statement about λ\lambdaλ-returns, eligibility traces or TD(λ\lambdaλ). What this mission adds is formal statements with every convention fixed, including one correction to the printed text. It also adds reusable definitions of nnn-step returns, λ\lambdaλ-returns and traces.

Difficulty

The algebra is elementary. The difficulty lies in the conventions, and a careless reading of the page produces a false statement. The book initializes a0=w0a_0 = w_0a0​=w0​, and taken literally that makes the goal false. The λ\lambdaλ-return is an infinite series, whose tail collapses only because every nnn-step return that reaches past termination equals the full return. That convention has to be built into the definition of Gt:t+nG_{t:t+n}Gt:t+n​, together with the terminal value v^(terminal,⋅)=0\hat v(\text{terminal}, \cdot) = 0v^(terminal,⋅)=0. Exercises 12.3 and 12.4 are true only when the weights stay fixed. With the algorithms' changing weights wtw_twt​ the nnn-step returns (12.1) use wt+n−1w_{t+n-1}wt+n−1​, and neither identity holds. The boundary indices (t=T−1t = T-1t=T−1, the empty product at k=T−1k = T-1k=T−1, GTλ=0G^\lambda_T = 0GTλ​=0) must come out right.

Formalization scope

Namespace SuttonBartoRL.Traces. Vectors of §12.6 are Fin d → ℝ, matrices Matrix (Fin d) (Fin d) ℝ, and xx⊤x x^\topxx⊤ is Matrix.vecMulVec x x. The ordered product fadeProd α x j t is Ft⋯FjF_t \cdots F_jFt​⋯Fj​, the identity when t<jt < jt<j. Feature sequences are indexed by N\mathbb NN; only x0,…,xT−1x_0, \dots, x_{T-1}x0​,…,xT−1​ enter. T≥1T \ge 1T≥1 is a hypothesis wherever T−1T - 1T−1 appears. The identities of §12.6 are stated for every real α\alphaα and GGG, a harmless strengthening of the book's positive step size.

For §§12.1–12.2, weights are EuclideanSpace ℝ (Fin d), ∇\nabla∇ is Mathlib's gradient, and each v^(s,⋅)\hat v(s,\cdot)v^(s,⋅) is assumed differentiable in Exercise 12.4. An episode is a length TTT, states and rewards. The value at time t≥Tt \ge Tt≥T is 000. (12.2) is a tsum over n≥0n \ge 0n≥0 of λnGt:t+n+1\lambda^n G_{t:t+n+1}λnGt:t+n+1​, and λ∈[0,1)\lambda \in [0,1)λ∈[0,1), the range the book gives with (12.2). Milestone 5 concludes summability, so the junk value of a divergent tsum cannot make it trivial. Exercises 12.3–12.4 take one weight binder w, used in every return, TD error and gradient. That is the book's fixed-www assumption, stated in the binders.

Correction. The printed initialization a0=w0a_0 = w_0a0​=w0​ (p. 302) contradicts the printed definition at≐Ft⋯F0w0a_t \doteq F_t\cdots F_0 w_0at​≐Ft​⋯F0​w0​ and (12.14). The counterexample is d=1d = 1d=1, T=1T = 1T=1, x0=1x_0 = 1x0​=1, α=1/2\alpha = 1/2α=1/2, w0=1w_0 = 1w0​=1, G=0G = 0G=0: the forward view gives w1=1/2w_1 = 1/2w1​=1/2, while a0+αGz0=1a_0 + \alpha G z_0 = 1a0​+αGz0​=1. The mission states the corrected result with a0=F0w0a_0 = F_0 w_0a0​=F0​w0​, equivalently the same recursion started from a−1=w0a_{-1} = w_0a−1​=w0​. The printed text is kept verbatim in the milestone.

A trivializing formalization is ruled out: the goal is not the closed-form identity with aT−1a_{T-1}aT−1​ and zT−1z_{T-1}zT−1​ defined as the products and sums. Those vectors are defined by their GGG-free incremental recursions, and the closed forms are separate milestones.

Out of scope: the equivalence of true online TD(λ\lambdaλ) and the online λ\lambdaλ-return algorithm (cited, p. 300), the truncated-return identity (12.10), the error bound (12.8), and all convergence claims. Proofs of the milestones, and reuse of the definitions in later missions on true online TD(λ\lambdaλ), are welcome.

Selected references

  • R. S. Sutton and A. G. Barto, Reinforcement Learning: An Introduction, 2nd ed., MIT Press, 2018, ISBN 9780262039246, Chapter 12, pp. 287–320. http://incompleteideas.net/book/the-book-2nd.html
  • R. S. Sutton, "Learning to predict by the methods of temporal differences", Machine Learning 3 (1988), 9–44. https://doi.org/10.1007/BF00115009
  • H. van Seijen and R. S. Sutton, "True online TD(λ)", Proceedings of ICML 2014, PMLR 32, 692–700. https://proceedings.mlr.press/v32/seijen14.html
  • H. van Seijen, A. R. Mahmood, P. M. Pilarski, M. C. Machado and R. S. Sutton, "True online temporal-difference learning", Journal of Machine Learning Research 17 (2016), 1–40. https://jmlr.org/papers/v17/15-599.html
11 thms0 active usersReviewed
Machine LearningMarkov Chain·Captain: mikedeng1

Reinforcement Learning: An Introduction VII: The Error Reduction Property of n-step ReturnsTextbook

Motivation

Temporal-difference (TD) learning estimates the value of a policy by moving a current estimate toward a target built from observed rewards and from the estimate itself. Chapter 7 of Sutton and Barto's Reinforcement Learning: An Introduction (2nd ed., MIT Press, 2018) interpolates between the two extreme targets of the preceding chapters: the one-step TD target, which uses one reward and then bootstraps, and the Monte Carlo target, which uses every reward until the end of the episode. The intermediate target, the nnn-step return, uses nnn rewards and then bootstraps from the current estimate. The family underlies nnn-step TD, nnn-step Sarsa, the off-policy per-decision methods and the tree-backup algorithm, and it is the introduction to eligibility traces (Chapter 12).

The book justifies the whole family with one inequality, the error reduction property (7.3), p. 144: the expected nnn-step return is closer to the true value than the estimate it bootstraps from, by a factor γn\gamma^nγn in the worst state. It is the reason given for calling nnn-step TD methods "sound". The same chapter states, mostly as exercises without solutions, a series of exact identities that rewrite each kind of nnn-step return as a sum of one-step TD errors.

Setting

A finite Markov decision process has finite state and action sets S\mathcal SS, A\mathcal AA, a finite reward set R⊂R\mathcal R \subset \mathbb RR⊂R, and dynamics p(s′,r∣s,a)p(s', r \mid s, a)p(s′,r∣s,a), the probability of next state s′s's′ and reward rrr after action aaa in state sss (Eqs. (3.2)–(3.3)). A policy π(a∣s)\pi(a \mid s)π(a∣s) is a probability distribution over actions for each state. Following π\piπ from St=sS_t = sSt​=s produces a random trajectory At,Rt+1,St+1,At+1,Rt+2,…A_t, R_{t+1}, S_{t+1}, A_{t+1}, R_{t+2}, \dotsAt​,Rt+1​,St+1​,At+1​,Rt+2​,… For a discount factor 0≤γ<10 \le \gamma < 10≤γ<1 the state-value function is the expected discounted return (3.12),

vπ(s)=Eπ[∑k=0∞γkRt+k+1 ∣ St=s].v_\pi(s) = \mathbb E_\pi\Big[\sum_{k=0}^{\infty} \gamma^k R_{t+k+1} \,\Big|\, S_t = s\Big].vπ​(s)=Eπ​[k=0∑∞​γkRt+k+1​​St​=s].

Given any function V:S→RV : \mathcal S \to \mathbb RV:S→R (an estimate of vπv_\pivπ​), the nnn-step return (7.1) is

Gt:t+n=Rt+1+γRt+2+⋯+γn−1Rt+n+γnV(St+n).G_{t:t+n} = R_{t+1} + \gamma R_{t+2} + \cdots + \gamma^{n-1} R_{t+n} + \gamma^n V(S_{t+n}).Gt:t+n​=Rt+1​+γRt+2​+⋯+γn−1Rt+n​+γnV(St+n​).

In an episode that terminates at time TTT it is replaced by the complete return GtG_tGt​ when t+n≥Tt + n \ge Tt+n≥T. The TD error (6.5) is δk=Rk+1+γV(Sk+1)−V(Sk)\delta_k = R_{k+1} + \gamma V(S_{k+1}) - V(S_k)δk​=Rk+1​+γV(Sk+1​)−V(Sk​). Off-policy variants use a behavior policy bbb that generates the data, the per-decision ratio ρt=π(At∣St)/b(At∣St)\rho_t = \pi(A_t \mid S_t)/b(A_t \mid S_t)ρt​=π(At​∣St​)/b(At​∣St​), and the return with control variate (7.13), Gt:h=ρt(Rt+1+γGt+1:h)+(1−ρt)V(St)G_{t:h} = \rho_t(R_{t+1} + \gamma G_{t+1:h}) + (1-\rho_t) V(S_t)Gt:h​=ρt​(Rt+1​+γGt+1:h​)+(1−ρt​)V(St​), Gh:h=V(Sh)G_{h:h} = V(S_h)Gh:h​=V(Sh​). The tree-backup return (7.15)–(7.16) uses action values QQQ and the expected approximate value Vˉ(s)=∑aπ(a∣s)Q(s,a)\bar V(s) = \sum_a \pi(a \mid s) Q(s, a)Vˉ(s)=∑a​π(a∣s)Q(s,a) (7.8).

Formalization targets

Goal: the error reduction property (7.3)

For a finite MDP, a policy π\piπ, 0≤γ<10 \le \gamma < 10≤γ<1, any V:S→RV : \mathcal S \to \mathbb RV:S→R and every n≥1n \ge 1n≥1,

max⁡s∣Eπ[Gt:t+n∣St=s]−vπ(s)∣≤γnmax⁡s∣V(s)−vπ(s)∣.\max_s \big|\mathbb E_\pi[G_{t:t+n} \mid S_t = s] - v_\pi(s)\big| \le \gamma^n \max_s \big|V(s) - v_\pi(s)\big|.smax​​Eπ​[Gt:t+n​∣St​=s]−vπ​(s)​≤γnsmax​​V(s)−vπ​(s)​.

Milestones, in the book's order

  1. Exercise 7.1, p. 143: with VVV fixed and V(ST)=0V(S_T) = 0V(ST​)=0, Gt:t+n−V(St)=∑k=tmin⁡(t+n,T)−1γk−tδkG_{t:t+n} - V(S_t) = \sum_{k=t}^{\min(t+n,T)-1} \gamma^{k-t}\delta_kGt:t+n​−V(St​)=∑k=tmin(t+n,T)−1​γk−tδk​.
  2. Exercise 7.4, Eq. (7.6), p. 148: the nnn-step Sarsa return equals Qt−1(St,At)+∑k=tmin⁡(t+n,T)−1γk−t[Rk+1+γQk(Sk+1,Ak+1)−Qk−1(Sk,Ak)]Q_{t-1}(S_t, A_t) + \sum_{k=t}^{\min(t+n,T)-1} \gamma^{k-t}[R_{k+1} + \gamma Q_k(S_{k+1}, A_{k+1}) - Q_{k-1}(S_k, A_k)]Qt−1​(St​,At​)+∑k=tmin(t+n,T)−1​γk−t[Rk+1​+γQk​(Sk+1​,Ak+1​)−Qk−1​(Sk​,Ak​)], with estimates changing from step to step.
  3. Eq. (7.12), p. 150: Gt:h=Rt+1+γGt+1:hG_{t:h} = R_{t+1} + \gamma G_{t+1:h}Gt:h​=Rt+1​+γGt+1:h​ for t<h<Tt < h < Tt<h<T, Gh:h=V(Sh)G_{h:h} = V(S_h)Gh:h​=V(Sh​).
  4. Exercise 7.6, p. 151, for (7.13): under coverage, Eb\mathbb E_bEb​ of the control-variate return equals Eb\mathbb E_bEb​ of the same return without the control variate, and both equal Eπ[Gt:t+n∣St=s]\mathbb E_\pi[G_{t:t+n} \mid S_t = s]Eπ​[Gt:t+n​∣St​=s].
  5. Exercise 7.8, p. 151: Gt:h−V(St)=∑k=th−1γk−t(∏i=tkρi)δkG_{t:h} - V(S_t) = \sum_{k=t}^{h-1} \gamma^{k-t} \big(\prod_{i=t}^{k}\rho_i\big) \delta_kGt:h​−V(St​)=∑k=th−1​γk−t(∏i=tk​ρi​)δk​ for the return (7.13).
  6. Exercise 7.11, p. 153: the tree-backup return equals Q(St,At)+∑k=tmin⁡(t+n−1,T−1)δk∏i=t+1kγπ(Ai∣Si)Q(S_t, A_t) + \sum_{k=t}^{\min(t+n-1,T-1)} \delta_k \prod_{i=t+1}^{k} \gamma\pi(A_i \mid S_i)Q(St​,At​)+∑k=tmin(t+n−1,T−1)​δk​∏i=t+1k​γπ(Ai​∣Si​) with the expectation-based TD error δk=Rk+1+γVˉ(Sk+1)−Q(Sk,Ak)\delta_k = R_{k+1} + \gamma\bar V(S_{k+1}) - Q(S_k, A_k)δk​=Rk+1​+γVˉ(Sk+1​)−Q(Sk​,Ak​).

Significance

The result. The error reduction property makes the expected nnn-step target a γn\gamma^nγn-contraction toward vπv_\pivπ​ in the sup norm, uniformly over the estimate it starts from. It is the one-line reason the book offers for the soundness of every nnn-step TD method, and the same contraction is what the λ\lambdaλ-return of Chapter 12 averages over nnn. The TD-error identities are the algebra behind implementations that accumulate TD errors instead of storing returns, and behind the forward/backward-view equivalences of Chapter 12. Exercise 7.6 is the unbiasedness of the control-variate return, which is what allows (7.13) to replace plain importance weighting without changing the expected update.

Formalizing it. All results are elementary and well known, but the book gives no proofs: (7.3) is asserted, and the identities are exercises without published solutions. None is formalized on Prove2Me. The mission produces machine-checked versions with every hypothesis explicit (discounting, the fixed estimate, terminal values, coverage), and a trajectory-level expectation for finite MDPs that other chapters of the series can reuse.

Difficulty

The obvious proof of (7.3) is a matrix computation: Eπ[Gt:t+n∣St=s]−vπ(s)=γn(Pπn(V−vπ))(s)\mathbb E_\pi[G_{t:t+n} \mid S_t = s] - v_\pi(s) = \gamma^n (P_\pi^n (V - v_\pi))(s)Eπ​[Gt:t+n​∣St​=s]−vπ​(s)=γn(Pπn​(V−vπ​))(s), and a stochastic matrix does not increase the sup norm. The difficulty lies in the step before it. The left side is an expectation over trajectories, and vπv_\pivπ​ is an infinite discounted series; neither is a matrix power by definition. Connecting them requires a Chapman–Kolmogorov identity for the finite-trajectory distribution induced by π\piπ and p(s′,r∣s,a)p(s', r \mid s, a)p(s′,r∣s,a), the splitting of vπv_\pivπ​ at time nnn, and summability of the discounted series. Defining the expected nnn-step return as the matrix expression would reduce the goal to the last line and remove its content; that shortcut is ruled out below.

The TD-error identities are telescoping sums, but each has its own boundary: termination inside the nnn steps, the convention that terminal states have value zero, the index Q−1Q_{-1}Q−1​ at t=0t = 0t=0 in (7.6), the special case GT−1:t+n=RTG_{T-1:t+n} = R_TGT−1:t+n​=RT​ of the tree backup, and ratios with vanishing denominators in (7.13).

Formalization scope

  • Model. The finite MDP, policies and vπv_\pivπ​ follow the series conventions: dynamics p(s′,r∣s,a)p(s', r \mid s, a)p(s′,r∣s,a) over a finite reward set, one action set for all states, vπ(s)=∑kγk(Pπkrπ)(s)v_\pi(s) = \sum_k \gamma^k (P_\pi^k r_\pi)(s)vπ​(s)=∑k​γk(Pπk​rπ​)(s) computed from expected rewards and never defined as a Bellman solution.
  • Expectations are over trajectories. Eπ[ ⋅∣St=s]\mathbb E_\pi[\,\cdot \mid S_t = s]Eπ​[⋅∣St​=s] is the finite sum over nnn-step segments (At+k,St+k+1,Rt+k+1)k<n(A_{t+k}, S_{t+k+1}, R_{t+k+1})_{k<n}(At+k​,St+k+1​,Rt+k+1​)k<n​ weighted by ∏kπ(At+k∣St+k) p(St+k+1,Rt+k+1∣St+k,At+k)\prod_k \pi(A_{t+k}\mid S_{t+k})\,p(S_{t+k+1}, R_{t+k+1}\mid S_{t+k}, A_{t+k})∏k​π(At+k​∣St+k​)p(St+k+1​,Rt+k+1​∣St+k​,At+k​). The expected nnn-step return is not defined as ∑k<nγkPπkrπ+γnPπnV\sum_{k<n}\gamma^k P_\pi^k r_\pi + \gamma^n P_\pi^n V∑k<n​γkPπk​rπ​+γnPπn​V, which would make the goal a two-line matrix inequality.
  • The estimate is fixed. In the algorithm, Vt+n−1V_{t+n-1}Vt+n−1​ is the current random estimate. Every statement takes a fixed function VVV (or QQQ), which is the book's own reading ("if the value estimates don't change"). The only exception is Exercise 7.4, whose estimates QkQ_kQk​ are indexed by time k∈Zk \in \mathbb Zk∈Z exactly as in (7.6).
  • Discounting. The goal assumes 0≤γ<10 \le \gamma < 10≤γ<1 and takes the maximum over all states. Episodic tasks enter through absorbing zero-reward terminal states. The undiscounted episodic case γ=1\gamma = 1γ=1 is not stated.
  • Episodes. Sample-path identities use sequences Sk,Ak,RkS_k, A_k, R_kSk​,Ak​,Rk​ and a termination time TTT. The book's convention that terminal states have value 000 is a hypothesis (V(ST)=0V(S_T) = 0V(ST​)=0, Q(ST,⋅)=0Q(S_T, \cdot) = 0Q(ST​,⋅)=0).
  • Exercise 7.6 is stated for the state-value return (7.13) of p. 150, although the exercise follows the action-value return (7.14). Its conclusion includes, besides the literal "does not change the expected value", equality with the on-policy expected return, the property the book states on p. 150. Coverage (π(a∣s)>0⇒b(a∣s)>0\pi(a\mid s) > 0 \Rightarrow b(a\mid s) > 0π(a∣s)>0⇒b(a∣s)>0) is assumed.
  • Not stated. The convergence of nnn-step TD methods "under appropriate technical conditions" (p. 144), and the programming exercises.

Needed infrastructure: finite sums over function types, Chapman–Kolmogorov for the segment distribution, summability of ∑kγkPπkrπ\sum_k \gamma^k P_\pi^k r_\pi∑k​γkPπk​rπ​. The trajectory layer is reusable for the importance-sampling and eligibility-trace chapters. Alternative proofs of the goal, and proofs of the undiscounted episodic version as a separate theorem, are welcome.

Selected references

  • R. S. Sutton and A. G. Barto, Reinforcement Learning: An Introduction, 2nd ed., MIT Press, 2018, ISBN 9780262039246, Chapter 7, pp. 141–158. http://incompleteideas.net/book/the-book-2nd.html
  • C. J. C. H. Watkins, Learning from Delayed Rewards, PhD thesis, University of Cambridge, 1989 (the nnn-step return and its error reduction property, as credited on p. 158 of the book). https://www.cs.rhul.ac.uk/~chrisw/new_thesis.pdf
  • D. Precup, R. S. Sutton and S. Singh, Eligibility traces for off-policy policy evaluation, Proceedings of the 17th International Conference on Machine Learning (ICML), 2000, pp. 759–766 (the tree-backup algorithm, as credited on p. 158 of the book; no DOI).
10 thms0 active usersReviewed
Machine LearningMarkov ChainStatistics·Captain: mikedeng1

Reinforcement Learning: An Introduction VI: Batch TD(0) Converges to the Certainty-Equivalence EstimateTextbook

Why batch TD(0) and batch Monte Carlo disagree

Temporal-difference (TD) learning estimates the value of each state of a Markov reward process from observed experience, updating an estimate toward a target built from the next reward and the current estimate of the next state. Monte Carlo (MC) methods instead update toward the full observed return. Both are standard prediction methods in reinforcement learning, and their relationship is a recurring question of the field (Sutton 1988).

When only a finite amount of experience is available, a common practice is to present the same data repeatedly until the estimates stop changing. Chapter 6 of Sutton and Barto's Reinforcement Learning: An Introduction (2nd ed., MIT Press, 2018) uses this setting to explain why TD(0) is often faster: under such batch updating, both methods converge deterministically, but to different answers. Batch MC finds the least-squares fit to the observed returns; batch TD(0) finds the value function of the maximum-likelihood Markov model of the data, the certainty-equivalence estimate. The comparison appears in §6.3, Optimality of TD(0) (pp. 126–128), and is illustrated by Example 6.4, You are the Predictor. The book states these conclusions without proof. This mission formalizes them.

Setting

Let S\mathcal SS be a finite set of nonterminal states and S+=S∪{terminal}\mathcal S^+ = \mathcal S \cup \{\text{terminal}\}S+=S∪{terminal}. An episode is a finite sequence S0,R1,S1,…,ST−1,RT,STS_0, R_1, S_1, \dots, S_{T-1}, R_T, S_TS0​,R1​,S1​,…,ST−1​,RT​,ST​ with S0,…,ST−1∈SS_0, \dots, S_{T-1} \in \mathcal SS0​,…,ST−1​∈S, real rewards R1,…,RTR_1, \dots, R_TR1​,…,RT​, and STS_TST​ terminal. A batch is a finite list of episodes. A visit of sss is an (episode, time t<Tt < Tt<T) pair with St=sS_t = sSt​=s, and n(s)n(s)n(s) counts all visits (every-visit counting).

A value array V:S→RV : \mathcal S \to \mathbb RV:S→R is extended by V(terminal)=0V(\text{terminal}) = 0V(terminal)=0. For a discount rate γ∈[0,1]\gamma \in [0,1]γ∈[0,1], the return is Gt=∑k=t+1Tγk−t−1RkG_t = \sum_{k=t+1}^{T}\gamma^{k-t-1}R_kGt​=∑k=t+1T​γk−t−1Rk​ and the TD error is δt=Rt+1+γV(St+1)−V(St)\delta_t = R_{t+1} + \gamma V(S_{t+1}) - V(S_t)δt​=Rt+1​+γV(St+1​)−V(St​).

Batch TD(0) with step size α\alphaα computes the TD(0) increment for every visit in the batch and changes VVV once, by their sum:

Vm+1(s)=Vm(s)+α∑visits t of s[Rt+1+γVm(St+1)−Vm(St)].V_{m+1}(s) = V_m(s) + \alpha\sum_{\text{visits } t \text{ of } s}\big[R_{t+1} + \gamma V_m(S_{t+1}) - V_m(S_t)\big].Vm+1​(s)=Vm​(s)+αvisits t of s∑​[Rt+1​+γVm​(St+1​)−Vm​(St​)].

Batch constant-α\alphaα MC is the same iteration with the increment Gt−Vm(St)G_t - V_m(S_t)Gt​−Vm​(St​).

The maximum-likelihood model of the batch has transition probabilities p^(j∣i)=N(i,j)/n(i)\hat p(j \mid i) = N(i,j)/n(i)p^​(j∣i)=N(i,j)/n(i), where N(i,j)N(i,j)N(i,j) counts the observed transitions from iii to j∈S+j \in \mathcal S^+j∈S+, and expected rewards r^(i,j)\hat r(i,j)r^(i,j) equal to the average reward observed on those transitions. With P^=(p^(s′∣s))s,s′∈S\hat P = (\hat p(s'\mid s))_{s,s'\in\mathcal S}P^=(p^​(s′∣s))s,s′∈S​ and r^(s)=∑jp^(j∣s)r^(s,j)\hat r(s) = \sum_j \hat p(j\mid s)\hat r(s,j)r^(s)=∑j​p^​(j∣s)r^(s,j), the certainty-equivalence estimate is the value function of this Markov reward process,

v^(s)=∑k≥0γk(P^kr^)(s).\hat v(s) = \sum_{k\ge0}\gamma^k\big(\hat P^k\hat r\big)(s).v^(s)=k≥0∑​γk(P^kr^)(s).

Formalization targets

Goal: batch TD(0) converges to the certainty-equivalence estimate

For every finite batch and every γ∈[0,1]\gamma \in [0,1]γ∈[0,1], the series defining v^\hat vv^ converges, and there is αˉ>0\bar\alpha > 0αˉ>0 such that for all α∈(0,αˉ)\alpha \in (0,\bar\alpha)α∈(0,αˉ) and all initial arrays V0V_0V0​,

lim⁡m→∞Vm(s)=v^(s)for every visited s,Vm(s)=V0(s) otherwise.\lim_{m\to\infty} V_m(s) = \hat v(s)\quad\text{for every visited } s, \qquad V_m(s) = V_0(s)\ \text{otherwise}.m→∞lim​Vm​(s)=v^(s)for every visited s,Vm​(s)=V0​(s) otherwise.

The limit depends neither on α\alphaα nor on V0V_0V0​ at visited states.

Milestones

  1. (6.6): with VVV held fixed, Gt−V(St)=∑k=tT−1γk−tδkG_t - V(S_t) = \sum_{k=t}^{T-1}\gamma^{k-t}\delta_kGt​−V(St​)=∑k=tT−1​γk−tδk​.
  2. Exercise 6.8: the same identity for action values, δt=Rt+1+γQ(St+1,At+1)−Q(St,At)\delta_t = R_{t+1} + \gamma Q(S_{t+1},A_{t+1}) - Q(S_t,A_t)δt​=Rt+1​+γQ(St+1​,At+1​)−Q(St​,At​).
  3. Least squares: the sample averages Gˉ(s)\bar G(s)Gˉ(s) of the returns after the visits to sss minimize ∑visits(Gt−V(St))2\sum_{\text{visits}}(G_t - V(S_t))^2∑visits​(Gt​−V(St​))2 over all arrays VVV.
  4. Batch MC: for small α\alphaα, batch constant-α\alphaα MC converges to Gˉ(s)\bar G(s)Gˉ(s) at every visited sss.
  5. Fixed points: the batch TD(0) increments vanish everywhere if and only if V=v^V = \hat vV=v^ on visited states.
  6. Example 6.4: on the eight episodes A,0,B,0A,0,B,0A,0,B,0; B,1B,1B,1 (six times); B,0B,0B,0 with γ=1\gamma = 1γ=1, the certainty-equivalence estimate is v^(A)=v^(B)=3/4\hat v(A) = \hat v(B) = 3/4v^(A)=v^(B)=3/4 and batch TD(0) converges to it, while batch MC converges to V(A)=0V(A) = 0V(A)=0, V(B)=3/4V(B) = 3/4V(B)=3/4.

Significance

The result explains the empirical observation of Figure 6.2 in the book: batch TD(0) has lower error than batch MC on Markov data, because it computes the certainty-equivalence estimate, while batch MC fits the training returns. It also gives a precise meaning to the claim that TD methods approximate the certainty-equivalence solution with memory linear in the number of states, where computing it directly needs a model of quadratic size and cubic time (p. 128). Identity (6.6) is the starting point of the nnn-step and eligibility-trace methods of later chapters.

The comparison under repeated presentation of a finite training set goes back to Sutton 1988, but the textbook states the conclusions without proof, and no machine-checked version is known to exist. The formalization pins down every hypothesis the text leaves implicit: the step-size threshold, the treatment of unvisited states, every-visit counting, and the undiscounted case.

Difficulty

The fixed-point equation of batch TD(0) is D(r^+γP^V−V)=0D(\hat r + \gamma\hat PV - V) = 0D(r^+γP^V−V)=0 on visited states, with DDD the diagonal of visit counts, and convergence of the iteration V↦V+αD(r^+γP^V−V)V \mapsto V + \alpha D(\hat r + \gamma\hat P V - V)V↦V+αD(r^+γP^V−V) requires every eigenvalue of D(I−γP^)D(I - \gamma\hat P)D(I−γP^) to have positive real part. For γ<1\gamma < 1γ<1 this follows from P^\hat PP^ being substochastic. For γ=1\gamma = 1γ=1, the case of Example 6.4, P^\hat PP^ is only substochastic and the naive contraction argument fails: invertibility of I−P^I - \hat PI−P^ must be derived from the structure of the data, since every episode ends in the terminal state. The matrix D(I−γP^)D(I - \gamma\hat P)D(I−γP^) is not symmetric, so symmetric positive-definiteness arguments do not apply. The same issue makes convergence of the series defining v^\hat vv^ nontrivial at γ=1\gamma = 1γ=1.

Formalization scope

An episode is a Lean List (X × ℝ) of transitions (St,Rt+1)(S_t, R_{t+1})(St​,Rt+1​), with the terminal state represented by none : Option X; a batch is a list of episodes; states form a Fintype. Values at the terminal state are 000 by definition. The certainty-equivalence estimate is defined from returns as the series ∑kγkP^kr^\sum_k\gamma^k\hat P^k\hat r∑k​γkP^kr^, not as the solution of a Bellman equation, and its convergence is part of the goal, not assumed. "Sufficiently small α\alphaα" is an existential threshold αˉ>0\bar\alpha > 0αˉ>0 quantified before α\alphaα and V0V_0V0​; a statement for one fixed α\alphaα, or for some α\alphaα, would be weaker than the book's and is ruled out. Unvisited states receive no increment and keep their initial value; the goal records this rather than claiming convergence to v^\hat vv^ there. The standing assumption γ∈[0,1]\gamma \in [0,1]γ∈[0,1] includes γ=1\gamma = 1γ=1. Every visit is counted in both the TD increments and the model; mixing first-visit and every-visit counts would make the goal false.

The mission needs only finite sums, matrix powers and limits of real sequences; Mathlib's Matrix and Filter.Tendsto suffice. A lemma that a nonnegative matrix whose rows reach an absorbing mass has spectral radius below one would be reusable beyond this mission, as would a convergence criterion for V↦V+α(b−MV)V \mapsto V + \alpha(b - MV)V↦V+α(b−MV) when MMM is a nonsingular M-matrix. Contributions of either kind, and of the elementary milestones 1–3, are welcome.

Selected references

  • Richard S. Sutton and Andrew G. Barto, Reinforcement Learning: An Introduction, 2nd ed., MIT Press, 2018, ISBN 9780262039246, §6.1 and §6.3, pp. 119–129. http://incompleteideas.net/book/the-book-2nd.html
  • Richard S. Sutton, Learning to predict by the methods of temporal differences, Machine Learning 3, 9–44, 1988. https://doi.org/10.1007/BF00115009
9 thms0 active usersReviewed
Dynamic ProgrammingMachine LearningOptimization·Captain: mikedeng1

Reinforcement Learning: An Introduction III: The Policy Improvement Theorem and Policy IterationTextbook

Why policy improvement matters

Reinforcement learning methods search for good behaviour by alternating two activities: estimating how good the current behaviour is, and changing the behaviour in the direction those estimates suggest. Sutton and Barto call this pattern generalized policy iteration and use it as the organizing idea of their textbook (Sutton & Barto 2018, §4.6). Its mathematical justification is a single result of Chapter 4, the policy improvement theorem (p. 78): a comparison made one step ahead, at each state separately, certifies that a changed policy is at least as good everywhere. Policy iteration, value iteration, Monte Carlo control with ε-greedy policies (Chapter 5), Sarsa and Q-learning are all motivated by it.

The chapter's results go back to the foundations of dynamic programming: the Bellman optimality equation (Bellman 1957), and policy iteration with its finite termination for discounted finite Markov decision processes (Howard 1960). Standard modern treatments are Puterman 1994, Ch. 6, and Bertsekas 2012, Vol. II, Ch. 1.

Setting

A finite Markov decision process has a finite state set S\mathcal SS, a finite nonempty action set A\mathcal AA, a finite reward set R⊂R\mathcal R\subset\mathbb RR⊂R and dynamics p(s′,r∣s,a)p(s', r\mid s, a)p(s′,r∣s,a): for each state sss and action aaa, a probability distribution over the next state s′s's′ and reward rrr (Eqs. (3.2)–(3.3)). A policy π\piπ gives probabilities π(a∣s)\pi(a\mid s)π(a∣s) of choosing each action in each state; a deterministic policy is a map π:S→A\pi:\mathcal S\to\mathcal Aπ:S→A.

Fix a discount rate 0≤γ<10\le\gamma<10≤γ<1. The state-value function of π\piπ is the expected discounted return

vπ(s)=Eπ[∑k=0∞γkRt+k+1 ∣ St=s],v_\pi(s) = E_\pi\Big[\sum_{k=0}^\infty \gamma^k R_{t+k+1}\ \Big|\ S_t=s\Big],vπ​(s)=Eπ​[k=0∑∞​γkRt+k+1​ ​ St​=s],

and the action-value function is defined from it by (4.6):

qπ(s,a)=∑s′,rp(s′,r∣s,a) [r+γvπ(s′)],q_\pi(s,a) = \sum_{s',r} p(s',r\mid s,a)\,\big[r+\gamma v_\pi(s')\big],qπ​(s,a)=s′,r∑​p(s′,r∣s,a)[r+γvπ​(s′)],

the value of taking aaa once in sss and following π\piπ afterwards. A policy is optimal if its value is at least that of every policy at every state, and the optimal value function is v∗(s)=max⁡πvπ(s)v_*(s)=\max_\pi v_\pi(s)v∗​(s)=maxπ​vπ​(s). A deterministic policy π′\pi'π′ is greedy with respect to qπq_\piqπ​ if π′(s)∈argmax⁡aqπ(s,a)\pi'(s)\in\operatorname{argmax}_a q_\pi(s,a)π′(s)∈argmaxa​qπ​(s,a) for all sss (4.9).

Formalization targets

Goal: the policy improvement theorem, (4.7)–(4.8), p. 78

For deterministic policies π,π′\pi,\pi'π,π′,

(∀s, qπ(s,π′(s))≥vπ(s)) ⟹ (∀s, vπ′(s)≥vπ(s)),\big(\forall s,\ q_\pi(s,\pi'(s))\ge v_\pi(s)\big)\ \Longrightarrow\ \big(\forall s,\ v_{\pi'}(s)\ge v_\pi(s)\big),(∀s, qπ​(s,π′(s))≥vπ​(s)) ⟹ (∀s, vπ′​(s)≥vπ​(s)),

and at every state where the hypothesis is strict, the conclusion is strict at that same state.

Milestones

  1. Iterative policy evaluation (4.5), p. 74. From any v0v_0v0​, the iterates vk+1(s)=∑aπ(a∣s)∑s′,rp(s′,r∣s,a)[r+γvk(s′)]v_{k+1}(s)=\sum_a\pi(a\mid s)\sum_{s',r}p(s',r\mid s,a)[r+\gamma v_k(s')]vk+1​(s)=∑a​π(a∣s)∑s′,r​p(s′,r∣s,a)[r+γvk​(s′)] converge to vπv_\pivπ​.
  2. Greedy improvement (4.9), p. 79. A greedy π′\pi'π′ with respect to qπq_\piqπ​ satisfies (4.7), hence vπ′≥vπv_{\pi'}\ge v_\pivπ′​≥vπ​.
  3. The stochastic case, p. 79. For stochastic π,π′\pi,\pi'π,π′, with qπ(s,π′(s))=∑aπ′(a∣s)qπ(s,a)q_\pi(s,\pi'(s))=\sum_a\pi'(a\mid s)q_\pi(s,a)qπ​(s,π′(s))=∑a​π′(a∣s)qπ​(s,a) as in (5.2), the theorem holds as stated, strictness included.
  4. Equality forces optimality, p. 79. If a greedy π′\pi'π′ has vπ′=vπv_{\pi'}=v_\pivπ′​=vπ​, then vπ′v_{\pi'}vπ′​ solves the Bellman optimality equation (4.1), vπ′=v∗v_{\pi'}=v_*vπ′​=v∗​, and π\piπ and π′\pi'π′ are optimal.
  5. Policy iteration, p. 80. For every sequence of deterministic policies with πk+1\pi_{k+1}πk+1​ greedy with respect to qπkq_{\pi_k}qπk​​: each step is a strict improvement unless πk\pi_kπk​ is optimal, and from some KKK on every πk\pi_kπk​ is optimal with vπk=v∗v_{\pi_k}=v_*vπk​​=v∗​.
  6. Value iteration (4.10), p. 83. v∗v_*v∗​ is attained by one policy at all states, and from any v0v_0v0​ the iterates vk+1(s)=max⁡a∑s′,rp(s′,r∣s,a)[r+γvk(s′)]v_{k+1}(s)=\max_a\sum_{s',r}p(s',r\mid s,a)[r+\gamma v_k(s')]vk+1​(s)=maxa​∑s′,r​p(s′,r∣s,a)[r+γvk​(s′)] converge to v∗v_*v∗​.

Significance

The results. The policy improvement theorem turns a local test into a global guarantee: it is enough to check, state by state, that one step of the new policy followed by the old one does no worse than the old one. Combined with the finiteness of the set of deterministic policies, it yields the finite termination of policy iteration and, with the equality case, the existence of a deterministic optimal policy. The stochastic form is what Chapter 5 invokes for ε-greedy control. Value iteration is the other classical way to compute v∗v_*v∗​.

Formalizing them. All of these results are classical and proved in the literature cited above; they are not open. The textbook presents them informally ("we chose not to produce a rigorous formal treatment", p. xiii): the improvement theorem is argued by an unbounded chain of expansions, and the policy evaluation and value iteration convergence claims are stated without proof. The mission makes each claim precise with explicit hypotheses and asks for machine-checked proofs against the book's own model with four-argument dynamics and stochastic policies. Related platform results use different models (cost minimization with deterministic policies in Bertsekas's Dynamic Programming; an expected-reward kernel and an assumed fixed point in Foundations of Machine Learning), and none states the policy improvement theorem itself.

Difficulty

The book's proof expands qπq_\piqπ​ with (4.6) and reapplies (4.7) indefinitely, ending with "≤⋯=vπ′(s)\le\cdots=v_{\pi'}(s)≤⋯=vπ′​(s)". Made rigorous, the chain is an inequality between truncated returns plus a remainder γnEπ′[vπ(St+n)]\gamma^n E_{\pi'}[v_\pi(S_{t+n})]γnEπ′​[vπ​(St+n​)], and the passage to the limit needs the remainder to vanish and the truncated returns to converge to vπ′v_{\pi'}vπ′​. Since vπv_\pivπ​ is defined here as a series of expected rewards under the induced Markov chain, connecting it to the one-step quantities requires first establishing the Bellman equation for vπv_\pivπ​ from that series. The strictness part does not follow from the weak inequality alone: strictness at one state must be shown to survive the averaging over later states, which requires tracking the contribution of the first step exactly. The policy iteration statement additionally requires handling ties: a greedy step taken from an optimal policy can move to a different optimal policy, so the sequence need not become constant.

Formalization scope

All objects live in the namespace SuttonBartoRL.DP. States and actions are finite types, actions nonempty where a maximum is taken; one action set serves all states (footnote 3, p. 48). Rewards form a finite set R⊂R\mathcal R\subset\mathbb RR⊂R, and the dynamics are a function p(s′,r∣s,a)p(s',r\mid s,a)p(s′,r∣s,a) whose values off R\mathcal RR are never used. Policies are stochastic; deterministic policies are embedded as policies that choose one action with probability one.

Committed conventions:

  • Discount 0≤γ<10\le\gamma<10≤γ<1 throughout. The book also allows γ=1\gamma=1γ=1 when "eventual termination is guaranteed" (p. 74) but never states that hypothesis precisely; the episodic case with a terminal state is out of scope. This is the only restriction relative to the text.
  • vπv_\pivπ​ from returns. vπ(s)=∑kγk(Pπkrπ)(s)v_\pi(s)=\sum_k\gamma^k(P_\pi^k r_\pi)(s)vπ​(s)=∑k​γk(Pπk​rπ​)(s), with PπP_\piPπ​ the state transition matrix of π\piπ and rπr_\pirπ​ its expected one-step reward. qπq_\piqπ​ is defined by (4.6), as the book does. The Bellman equation (4.4) is not assumed. Defining vπv_\pivπ​ as the fixed point of a Bellman operator would make the goal an order property of that operator and is excluded.
  • v∗v_*v∗​ is the real supremum over all stochastic policies; the value iteration item also asserts it is attained. Optimality of a policy means dominance over all stochastic policies.
  • Greedy means π′(s)\pi'(s)π′(s) is any maximizer of qπ(s,⋅)q_\pi(s,\cdot)qπ​(s,⋅); tie-breaking is arbitrary and may differ between iterations.
  • Stochastic case. The book only says the theorem "carries through as stated"; the meaning qπ(s,π′(s))=∑aπ′(a∣s)qπ(s,a)q_\pi(s,\pi'(s))=\sum_a\pi'(a\mid s)q_\pi(s,a)qπ​(s,π′(s))=∑a​π′(a∣s)qπ​(s,a) is taken from the book's (5.2), p. 101.
  • Policy iteration is the idealized sequence with exact evaluation. The item does not claim that the boxed pseudocode on p. 80 stops, which it may fail to do under ties (Exercise 4.4, p. 82).
  • Convergence of iterates is in the product topology on RS\mathbb R^{\mathcal S}RS, equivalent to the sup norm for finite S\mathcal SS.

In-place (asynchronous) sweeps (§4.5) and truncated policy iteration are not formalized.

Needed infrastructure: summability of discounted series of bounded expected rewards, the Bellman equation for vπv_\pivπ​ derived from the return definition, contraction arguments in the sup norm on RS\mathbb R^{\mathcal S}RS, and finiteness of the set of deterministic policies. The definitions here duplicate those of the series' Chapter 3 mission and are intended to be merged with them; lemmas about vπv_\pivπ​, the Bellman equation and contraction are reusable by every later mission of the series, and contributions of such lemmas are welcome.

Selected references

  • R. S. Sutton and A. G. Barto, Reinforcement Learning: An Introduction, 2nd ed., MIT Press, 2018, ISBN 9780262039246, Chapter 4. http://incompleteideas.net/book/the-book-2nd.html
  • R. Bellman, Dynamic Programming, Princeton University Press, 1957. https://press.princeton.edu/books/paperback/9780691146683/dynamic-programming
  • R. A. Howard, Dynamic Programming and Markov Processes, MIT Press, 1960. https://mitpress.mit.edu/9780262080095/dynamic-programming-and-markov-processes/
  • M. L. Puterman, Markov Decision Processes: Discrete Stochastic Dynamic Programming, Wiley, 1994. https://doi.org/10.1002/9780470316887
  • D. P. Bertsekas, Dynamic Programming and Optimal Control, Vol. II, 4th ed., Athena Scientific, 2012. http://www.athenasc.com/dpbook.html
9 thms0 active usersReviewed
Dynamic ProgrammingMachine LearningMarkov Chain·Captain: mikedeng1

Reinforcement Learning: An Introduction II: The Bellman Optimality Equation and the Existence of an Optimal PolicyTextbook

Motivation

Sutton and Barto's Reinforcement Learning: An Introduction (2nd ed., MIT Press, 2018) is the standard introductory text of the field. Its Chapter 3 sets up the model that the rest of Part I works in: the finite Markov decision process (MDP), the value functions of a policy, and the Bellman equations that relate the value of a state to the values of its successors. Section 3.6 then states the fact every planning and control method of the book relies on: in a finite MDP there is an optimal policy, its value is the unique solution of a system of nonlinear equations, and a policy that acts greedily with respect to that solution is optimal. Dynamic programming (Chapter 4), Monte Carlo control (Chapter 5), Sarsa and Q-learning (Chapter 6) are all methods for solving the Bellman optimality equation; their correctness statements presuppose that it has exactly one solution and that it identifies optimal behaviour.

The book is deliberately informal ("we chose not to produce a rigorous formal treatment", p. xiii): §3.6 asserts these facts without proof. The results themselves are classical, going back to Bellman (1957), Howard (1960) and Blackwell (1965); a textbook proof for discounted finite MDPs is in Puterman, Markov Decision Processes (Wiley, 1994), Chapter 6.

Setting

A finite MDP has a finite set of states S\mathcal SS, a finite nonempty set of actions A\mathcal AA, a finite set of rewards R⊂R\mathcal R \subset \mathbb RR⊂R, and dynamics

p(s′,r∣s,a)=Pr⁡{St=s′,Rt=r∣St−1=s,At−1=a},∑s′∈S∑r∈Rp(s′,r∣s,a)=1,p(s', r \mid s, a) = \Pr\{S_t = s', R_t = r \mid S_{t-1} = s, A_{t-1} = a\}, \qquad \sum_{s' \in \mathcal S}\sum_{r \in \mathcal R} p(s', r \mid s, a) = 1,p(s′,r∣s,a)=Pr{St​=s′,Rt​=r∣St−1​=s,At−1​=a},s′∈S∑​r∈R∑​p(s′,r∣s,a)=1,

Eqs. (3.2)–(3.3). From ppp one derives p(s′∣s,a)=∑rp(s′,r∣s,a)p(s' \mid s, a) = \sum_r p(s', r \mid s, a)p(s′∣s,a)=∑r​p(s′,r∣s,a) and r(s,a)=∑rr∑s′p(s′,r∣s,a)r(s, a) = \sum_r r \sum_{s'} p(s', r \mid s, a)r(s,a)=∑r​r∑s′​p(s′,r∣s,a), Eqs. (3.4)–(3.5).

A policy π\piπ gives a probability π(a∣s)\pi(a \mid s)π(a∣s) of each action in each state. Fix a discount rate 0≤γ<10 \le \gamma < 10≤γ<1. The return of a reward sequence is Gt=∑k≥0γkRt+k+1G_t = \sum_{k \ge 0} \gamma^k R_{t+k+1}Gt​=∑k≥0​γkRt+k+1​ (3.8). The state-value function and action-value function of π\piπ are the expected returns

vπ(s)=Eπ[Gt∣St=s],qπ(s,a)=Eπ[Gt∣St=s,At=a](3.12)–(3.13).v_\pi(s) = \mathbb E_\pi[G_t \mid S_t = s], \qquad q_\pi(s, a) = \mathbb E_\pi[G_t \mid S_t = s, A_t = a] \qquad (3.12)\text{–}(3.13).vπ​(s)=Eπ​[Gt​∣St​=s],qπ​(s,a)=Eπ​[Gt​∣St​=s,At​=a](3.12)–(3.13).

In the Lean development these are stateValue M γ π s and actionValue M γ π s a, computed as ∑kγk(Pπkrπ)(s)\sum_k \gamma^k (P_\pi^k r_\pi)(s)∑k​γk(Pπk​rπ​)(s) from the transition matrix Pπ(s,s′)=∑aπ(a∣s) p(s′∣s,a)P_\pi(s, s') = \sum_a \pi(a \mid s)\,p(s' \mid s, a)Pπ​(s,s′)=∑a​π(a∣s)p(s′∣s,a) and the expected reward rπ(s)=∑aπ(a∣s) r(s,a)r_\pi(s) = \sum_a \pi(a \mid s)\,r(s, a)rπ​(s)=∑a​π(a∣s)r(s,a) of the Markov chain the policy induces. A policy π\piπ is optimal (IsOptimalPolicy) if vπ(s)≥vπ′(s)v_\pi(s) \ge v_{\pi'}(s)vπ​(s)≥vπ′​(s) for every policy π′\pi'π′ and every state sss. The optimal value functions are

v∗(s)=max⁡πvπ(s)(3.15),q∗(s,a)=max⁡πqπ(s,a)(3.16),v_*(s) = \max_\pi v_\pi(s) \quad (3.15), \qquad q_*(s, a) = \max_\pi q_\pi(s, a) \quad (3.16),v∗​(s)=πmax​vπ​(s)(3.15),q∗​(s,a)=πmax​qπ​(s,a)(3.16),

optimalValue and optimalActionValue, with the maximum over all stochastic policies.

Formalization targets

Goal: the Bellman optimality equation and optimal policies (§3.6, pp. 62–64)

For every finite MDP and 0≤γ<10 \le \gamma < 10≤γ<1:

  1. the maximum in (3.15) is attained at every state;
  2. an optimal policy exists;
  3. v∗v_*v∗​ satisfies the Bellman optimality equation
v∗(s)=max⁡a∑s′,rp(s′,r∣s,a)[r+γv∗(s′)]for all s;(3.19)v_*(s) = \max_{a} \sum_{s', r} p(s', r \mid s, a)\big[r + \gamma v_*(s')\big] \quad \text{for all } s; \qquad (3.19)v∗​(s)=amax​s′,r∑​p(s′,r∣s,a)[r+γv∗​(s′)]for all s;(3.19)
  1. v∗v_*v∗​ is the only function on S\mathcal SS satisfying (3.19);
  2. every policy that assigns positive probability only to actions attaining the maximum in (3.19) is optimal.

Milestones

  • (3.9) Gt=Rt+1+γGt+1G_t = R_{t+1} + \gamma G_{t+1}Gt​=Rt+1​+γGt+1​ for bounded rewards, with the series convergent.
  • (3.14) the Bellman equation vπ(s)=∑aπ(a∣s)∑s′,rp(s′,r∣s,a)[r+γvπ(s′)]v_\pi(s) = \sum_a \pi(a \mid s) \sum_{s', r} p(s', r \mid s, a)[r + \gamma v_\pi(s')]vπ​(s)=∑a​π(a∣s)∑s′,r​p(s′,r∣s,a)[r+γvπ​(s′)], and (p. 60) its uniqueness: vπv_\pivπ​ is its only solution.
  • Exercise 3.15 adding a constant ccc to all rewards adds vc=c/(1−γ)v_c = c/(1-\gamma)vc​=c/(1−γ) to every value.
  • Exercises 3.18 and 3.19 vπ(s)=∑aπ(a∣s) qπ(s,a)v_\pi(s) = \sum_a \pi(a \mid s)\,q_\pi(s, a)vπ​(s)=∑a​π(a∣s)qπ​(s,a) and qπ(s,a)=∑s′,rp(s′,r∣s,a)[r+γvπ(s′)]q_\pi(s, a) = \sum_{s', r} p(s', r \mid s, a)[r + \gamma v_\pi(s')]qπ​(s,a)=∑s′,r​p(s′,r∣s,a)[r+γvπ​(s′)].
  • (3.16)–(3.17) the maximum defining q∗q_*q∗​ is attained and q∗(s,a)=∑s′,rp(s′,r∣s,a)[r+γv∗(s′)]q_*(s, a) = \sum_{s', r} p(s', r \mid s, a)[r + \gamma v_*(s')]q∗​(s,a)=∑s′,r​p(s′,r∣s,a)[r+γv∗​(s′)].
  • (3.20) the Bellman optimality equation for action values, q∗(s,a)=∑s′,rp(s′,r∣s,a)[r+γmax⁡a′q∗(s′,a′)]q_*(s, a) = \sum_{s', r} p(s', r \mid s, a)[r + \gamma \max_{a'} q_*(s', a')]q∗​(s,a)=∑s′,r​p(s′,r∣s,a)[r+γmaxa′​q∗​(s′,a′)].

Significance

The goal is what turns "find a good policy" into "solve a system of equations". Parts 3 and 4 identify v∗v_*v∗​ with the unique solution of (3.19), so any procedure that finds a solution of (3.19) has found v∗v_*v∗​; part 5 converts v∗v_*v∗​ into an optimal policy by a one-step search. Parts 1 and 2 say that the book's definition (3.15) makes sense: a single policy is simultaneously best at every state, so "the optimal value function" is well defined and shared by all optimal policies. Chapter 4's policy iteration and value iteration, and the fixed points of Q-learning, are statements about this equation. Exercises 3.18 and 3.19 are used, by number, in the proof of the policy gradient theorem (p. 325).

The mathematics is classical and proved in many texts; what is missing is a machine-checked version in the book's own model. Platform relatives exist in different models: FoundationsML.ReinforcementLearning.bellman_equations_unique_solution (uniqueness for a fixed policy, with an expected-reward kernel instead of p(s′,r∣s,a)p(s', r \mid s, a)p(s′,r∣s,a)), BertsekasDP.discounted_main_theorem (cost minimization over deterministic stationary policies), BanditAlgorithm.mdp_discounted_bellman_solution (existence of a solution with a greedy deterministic policy, rewards in [0,1][0,1][0,1]) and FoundationsRL.RLBasics.bellman_optimality (finite horizon). None of them states the book's result: the four-argument dynamics, stochastic policies, the maximum over all of them, uniqueness of the solution of (3.19), and optimality of every policy supported on greedy actions. This mission produces that statement and, with it, a vocabulary of finite-MDP definitions that the later missions of the series reuse.

Difficulty

The book's derivation of (3.19) (p. 63) starts from v∗(s)=max⁡aqπ∗(s,a)v_*(s) = \max_a q_{\pi_*}(s, a)v∗​(s)=maxa​qπ∗​​(s,a) with a policy π∗\pi_*π∗​ that is optimal at every state at once. The existence of such a policy is the substance of the goal, and it does not follow from the definition: (3.15) takes a separate maximum at each state, and a priori the maximizing policy could depend on the state. Uniqueness for (3.19) is likewise not a consequence of linear algebra, as it is for (3.14): the equation is nonlinear because of the maximum. The fixed point must be related to the value of an actual policy, and every policy's value must be bounded above by it.

Formalization scope

  • Model. S and A are finite types with A nonempty (without an action, max⁡a\max_amaxa​ is undefined). One action set serves every state, as the book's footnote 3 (p. 48) allows. Rewards form a finite set M.R : Finset ℝ and the dynamics are the four-argument M.p s a s' r with the normalization (3.3).
  • Discounting. All statements assume 0≤γ<10 \le \gamma < 10≤γ<1 (the continuing discounted case of §3.3). The episodic case with γ=1\gamma = 1γ=1 is not covered: the book's uniqueness claims then need every episode to terminate under every policy, which the chapter never states, and without it (3.19) can have many solutions (a state that loops to itself with reward 000 satisfies v(s)=v(s)v(s) = v(s)v(s)=v(s) for any value).
  • Value functions from returns. vπv_\pivπ​ and qπq_\piqπ​ are expected discounted returns, computed from the Markov chain the policy induces. They are not defined as solutions of the Bellman equations, and v∗v_*v∗​ is not defined as a solution of (3.19): either would make the goal true by definition. The Bellman equations are theorems.
  • Maxima. v∗v_*v∗​ and q∗q_*q∗​ are real suprema over the type of stochastic policies (Lean gives a supremum that does not exist the value 000); the goal and milestone (3.17) assert that these suprema are attained, so they are the book's maxima.
  • Conditional expectations. (3.17), (3.18) and (3.20) are stated in their finite-sum form over (s′,r)(s', r)(s′,r).
  • Exercises. Exercises 3.15, 3.18 and 3.19 have no printed solutions; the statements give the formalization's answers (vc=c/(1−γ)v_c = c/(1-\gamma)vc​=c/(1−γ) and the two displayed identities).
  • Reusable infrastructure. The definitions (MDP, Policy, trans, expReward, policyTrans, policyReward, stateValue, actionValue, optimalValue, optimalActionValue, IsOptimalPolicy) follow the conventions shared by the whole series and are meant to be merged with the finite-MDP layers of the later chapters. Lemmas on summability of the value series, the Bellman operator as a γ\gammaγ-contraction in the sup norm, and the Markov-chain identities for PπkP_\pi^kPπk​ are welcome as separate contributions.

Selected references

  • R. S. Sutton, A. G. Barto, Reinforcement Learning: An Introduction, 2nd ed., MIT Press, 2018, ISBN 9780262039246, Chapter 3. http://incompleteideas.net/book/the-book-2nd.html
  • R. Bellman, Dynamic Programming, Princeton University Press, 1957. https://doi.org/10.2307/j.ctv1nxcw0f
  • R. A. Howard, Dynamic Programming and Markov Processes, MIT Press, 1960.
  • D. Blackwell, "Discounted dynamic programming", Annals of Mathematical Statistics 36(1), 1965, 226–235. https://doi.org/10.1214/aoms/1177700285
  • M. L. Puterman, Markov Decision Processes: Discrete Stochastic Dynamic Programming, Wiley, 1994. https://doi.org/10.1002/9780470316887
11 thms0 active usersReviewed
Bandit AlgorithmsMachine LearningOptimization·Captain: mikedeng1

Reinforcement Learning: An Introduction I: The Gradient Bandit Algorithm Is Stochastic Gradient AscentTextbook

Motivation

The multi-armed bandit is the simplest setting in which a learner must trade off exploiting what it knows against exploring what it does not: one situation, kkk actions, and a reward drawn from an unknown distribution each time an action is taken. Chapter 2 of Sutton and Barto's Reinforcement Learning: An Introduction (2nd ed., MIT Press, 2018) uses it to introduce, in the smallest possible setting, ideas that run through the rest of the book: incremental estimation with a step size, the bias introduced by the initial estimate, soft-max policies over learned preferences, and learning by following the gradient of expected reward.

The chapter ends with the gradient bandit algorithm (§2.8), which learns a numerical preference for each action instead of a value estimate. A shaded box on pp. 38–40 shows that its expected update is exactly a gradient-ascent step on the expected reward, so the algorithm is an instance of stochastic gradient ascent. The same argument, a score-function (likelihood-ratio) identity with a baseline, reappears in Chapter 13 as the REINFORCE algorithm and the policy gradient theorem. The bandit case is where the book first carries it out in full.

Setting

Actions are 1,…,k1, \dots, k1,…,k. Each action xxx has a reward distribution νx\nu_xνx​ on R\mathbb RR with finite mean q∗(x)q_*(x)q∗​(x), the true action value. At each step the learner holds a vector of action preferences H=(H(1),…,H(k))∈RkH = (H(1), \dots, H(k)) \in \mathbb R^kH=(H(1),…,H(k))∈Rk and selects action AAA with the soft-max probability

π(a)=eH(a)∑b=1keH(b)(2.11).\pi(a) = \frac{e^{H(a)}}{\sum_{b=1}^k e^{H(b)}} \qquad (2.11).π(a)=∑b=1k​eH(b)eH(a)​(2.11).

Given A=xA = xA=x, a reward R∼νxR \sim \nu_xR∼νx​ is received. The expected reward is E[R]=∑xπ(x) q∗(x)\mathbb E[R] = \sum_x \pi(x)\, q_*(x)E[R]=∑x​π(x)q∗​(x), a smooth function of HHH. With a step size α>0\alpha > 0α>0 and a baseline B∈RB \in \mathbb RB∈R, the gradient bandit update (2.12) is

H′(A)=H(A)+α(R−B)(1−π(A)),H′(a)=H(a)−α(R−B) π(a)  (a≠A).H'(A) = H(A) + \alpha (R - B)(1 - \pi(A)), \qquad H'(a) = H(a) - \alpha (R - B)\,\pi(a) \ \ (a \ne A).H′(A)=H(A)+α(R−B)(1−π(A)),H′(a)=H(a)−α(R−B)π(a)  (a=A).

The chapter's estimation sections use a single action's rewards R1,R2,…R_1, R_2, \dotsR1​,R2​,…. The sample average after n−1n-1n−1 selections is Qn=(R1+⋯+Rn−1)/(n−1)Q_n = (R_1 + \cdots + R_{n-1})/(n-1)Qn​=(R1​+⋯+Rn−1​)/(n−1), with an arbitrary initial value Q1Q_1Q1​. A constant step size α∈(0,1]\alpha \in (0,1]α∈(0,1] updates Qn+1=Qn+α[Rn−Qn]Q_{n+1} = Q_n + \alpha [R_n - Q_n]Qn+1​=Qn​+α[Rn​−Qn​] (2.5). The trace of one oˉ0=0\bar o_0 = 0oˉ0​=0, oˉn=oˉn−1+α(1−oˉn−1)\bar o_n = \bar o_{n-1} + \alpha (1 - \bar o_{n-1})oˉn​=oˉn−1​+α(1−oˉn−1​) defines the step size βn=α/oˉn\beta_n = \alpha / \bar o_nβn​=α/oˉn​ (2.8)–(2.9).

Formalization targets

Goal: the expected update is the gradient step

For every action aaa, with A∼πA \sim \piA∼π and R∣A=x∼νxR \mid A = x \sim \nu_xR∣A=x∼νx​,

E[H′(a)]=H(a)+α ∂ E[R]∂H(a),\mathbb E\bigl[H'(a)\bigr] = H(a) + \alpha\, \frac{\partial\, \mathbb E[R]}{\partial H(a)} ,E[H′(a)]=H(a)+α∂H(a)∂E[R]​,

that is, the update (2.12) equals the exact gradient-ascent step (2.13) in expected value, for every baseline BBB that does not depend on the selected action.

Milestones

  1. (2.3): Qn+1=Qn+1n[Rn−Qn]Q_{n+1} = Q_n + \tfrac1n [R_n - Q_n]Qn+1​=Qn​+n1​[Rn​−Qn​] for n≥1n \ge 1n≥1, including Q2=R1Q_2 = R_1Q2​=R1​ for arbitrary Q1Q_1Q1​.
  2. (2.6): Qn+1=(1−α)nQ1+∑i=1nα(1−α)n−iRiQ_{n+1} = (1-\alpha)^n Q_1 + \sum_{i=1}^n \alpha(1-\alpha)^{n-i} R_iQn+1​=(1−α)nQ1​+∑i=1n​α(1−α)n−iRi​, with weights summing to one.
  3. Exercise 2.7: with βn=α/oˉn\beta_n = \alpha/\bar o_nβn​=α/oˉn​, Qn+1=∑i=1nα(1−α)n−ioˉnRiQ_{n+1} = \sum_{i=1}^n \frac{\alpha(1-\alpha)^{n-i}}{\bar o_n} R_iQn+1​=∑i=1n​oˉn​α(1−α)n−i​Ri​ for n≥1n \ge 1n≥1, weights summing to one, and no dependence on Q1Q_1Q1​.
  4. Shift invariance (p. 37): adding a constant ccc to every preference leaves π\piπ unchanged.
  5. Exercise 2.9: for k=2k = 2k=2, π(1)=σ(H(1)−H(2))\pi(1) = \sigma(H(1) - H(2))π(1)=σ(H(1)−H(2)) with σ(x)=1/(1+e−x)\sigma(x) = 1/(1+e^{-x})σ(x)=1/(1+e−x).
  6. Soft-max derivative (p. 40): ∂π(x)/∂H(a)=π(x)(1a=x−π(a))\partial \pi(x)/\partial H(a) = \pi(x)(\mathbb 1_{a=x} - \pi(a))∂π(x)/∂H(a)=π(x)(1a=x​−π(a)).
  7. Zero-sum gradient (p. 39): ∑x∂π(x)/∂H(a)=0\sum_x \partial \pi(x)/\partial H(a) = 0∑x​∂π(x)/∂H(a)=0.
  8. Performance gradient as an expectation (p. 39): ∂E[R]/∂H(a)=E[(R−B)(1a=A−π(a))]\partial \mathbb E[R]/\partial H(a) = \mathbb E[(R - B)(\mathbb 1_{a=A} - \pi(a))]∂E[R]/∂H(a)=E[(R−B)(1a=A​−π(a))].

Significance

The result. The identity makes a model-free algorithm, which uses only the sampled action and reward, an unbiased estimator of the gradient of a quantity that depends on the unknown q∗q_*q∗​. It therefore places the gradient bandit algorithm within stochastic approximation, where convergence theory for stochastic gradient methods applies. It also explains the role of the baseline: any baseline independent of the action leaves the expected update unchanged, so the choice of baseline can only affect the variance of the update, as Figure 2.5 shows empirically. The estimation milestones make precise two claims the chapter uses repeatedly: sample averages can be maintained incrementally, and constant step sizes produce an exponentially recency-weighted average biased by Q1Q_1Q1​. Exercise 2.7 removes that bias.

Formalizing it. All of these results are elementary and proved (or left as routine exercises) in the book. None of them is formalized on Prove2Me or, as far as is known, in Mathlib. What this mission adds is a machine-checked version of the book's argument with the reward model and baseline condition stated precisely, and a reusable soft-max layer (definition, partial derivatives, shift invariance) for later missions of this series, in particular the policy gradient theorem of Chapter 13.

Difficulty

The mathematics is beginning calculus, as the book says. The formal difficulty lies elsewhere. The goal is an identity between an expectation over a two-stage random experiment (an action from π\piπ, then a reward from νA\nu_AνA​) and a partial derivative in one coordinate of a vector-valued parameter. A proof has to justify exchanging the finite sum with the derivative and splitting the reward integral, and it has to use integrability of each νx\nu_xνx​. It also needs the fact that the baseline term vanishes because ∑x∂π(x)/∂H(a)=0\sum_x \partial\pi(x)/\partial H(a) = 0∑x​∂π(x)/∂H(a)=0. A scalar-parameter version of the log-sum-exp derivative does not suffice: the book differentiates in one coordinate H(a)H(a)H(a) while all other preferences are held fixed. For Exercise 2.7 the obvious unrolling of (2.6) does not apply directly, because the step size βn\beta_nβn​ varies with nnn and the book states neither the weights nor the range of α\alphaα.

Formalization scope

  • Actions are Fin k. Every statement quantifies over some action, so k≥1k \ge 1k≥1 whenever it has content. Preferences are vectors Fin k → ℝ. The partial derivative in coordinate aaa is the derivative of h↦f(update H a h)h \mapsto f(\text{update } H\ a\ h)h↦f(update H a h) at H(a)H(a)H(a). The soft-max derivative milestone is stated with HasDerivAt, so it also asserts differentiability.
  • Rewards: each νx\nu_xνx​ is a probability measure on R\mathbb RR with Integrable identity and mean q∗(x)q_*(x)q∗​(x). The expectation of a function of (A,R)(A, R)(A,R) is ∑xπ(x)∫⋅ dνx\sum_x \pi(x) \int \cdot \, d\nu_x∑x​π(x)∫⋅dνx​. The book's normal-distribution testbed is only an example.
  • The baseline is a fixed real BBB, the book's "any scalar that does not depend on" the action (pp. 39–40). The book's Bt=RˉtB_t = \bar R_tBt​=Rˉt​, the average of past rewards, is covered once one conditions on the past. Footnote 1 on p. 37 states that the chapter's experiments used a Rˉt\bar R_tRˉt​ that also included RtR_tRt​. That baseline depends on AtA_tAt​, and the identity does not cover it.
  • Rewards of one action are a sequence indexed from 111. Q1Q_1Q1​ is arbitrary, and 00=10^0 = 100=1 as in the book (p. 33), so α=1\alpha = 1α=1 is included in (2.6).
  • Exercise 2.7 speaks of "a conventional constant step size α>0\alpha > 0α>0". The formalization takes α∈(0,1]\alpha \in (0,1]α∈(0,1], the range of the constant step size in (2.5). For α=2\alpha = 2α=2 the trace oˉn\bar o_noˉn​ vanishes at every even nnn and βn\beta_nβn​ is undefined. "Without initial bias" is read as "for n≥1n \ge 1n≥1, Qn+1Q_{n+1}Qn+1​ is the displayed weighted average of R1,…,RnR_1, \dots, R_nR1​,…,Rn​ with weights summing to one", which in particular does not involve Q1Q_1Q1​.
  • Exercise 2.9 is read as the two equalities π(1)=σ(H(1)−H(2))\pi(1) = \sigma(H(1)-H(2))π(1)=σ(H(1)−H(2)) and π(2)=σ(H(2)−H(1))\pi(2) = \sigma(H(2)-H(1))π(2)=σ(H(2)−H(1)).
  • A trivializing formalization is ruled out: the goal is about the expected value of the algorithm's update (2.12) under the joint law of action and reward, not the soft-max derivative alone and not a version in which the reward is replaced by its mean or the expectation is taken over AAA only.
  • Not formalized: the UCB rule (2.10) and the 10-armed testbed, which carry no provable claim in the chapter, and the stochastic-approximation conditions (2.7), which the book cites without proof.
  • Welcome contributions: a general soft-max library (derivatives, Jacobian, log-sum-exp) over a finite type, reusable for Chapter 13, and proofs of the milestones in the listed order.

Selected references

  • R. S. Sutton, A. G. Barto, Reinforcement Learning: An Introduction, 2nd ed., MIT Press, 2018, ISBN 9780262039246, Chapter 2, pp. 25–46. http://incompleteideas.net/book/the-book-2nd.html
  • R. J. Williams, Simple statistical gradient-following algorithms for connectionist reinforcement learning, Machine Learning 8 (1992) 229–256. https://doi.org/10.1007/BF00992696
  • H. Robbins, S. Monro, A stochastic approximation method, Annals of Mathematical Statistics 22 (1951) 400–407. https://doi.org/10.1214/aoms/1177729586
11 thms0 active usersReviewed

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me