The course's one theory lecture. Levine shows what RL theory actually delivers — qualitative guidance about how error scales with samples, horizon, and state-space size under strong assumptions — then works two analyses end to end: a tabular model-based method whose Q-function error follows from concentration inequalities plus the simulation lemma, and an idealized fitted Q-iteration whose sampling and approximation errors both compound with the effective horizon.
This is “the only theory lecture in this course,” and Levine’s goal is not depth but
flavor: what kinds of analysis can we do, and what kinds of conclusions do they
support? The typical questions are sample-complexity statements. If an algorithm gets
N samples per iteration for k iterations, how good is the result — can we show
∥Q^k−Q⋆∥≤ϵ with probability at least 1−δ whenever
N≥f(ϵ,δ), for some well-behaved f? A subtly different question:
how good is the policy the Q-function induces — is
∥Qπk−Q⋆∥≤ϵ, where Qπk is the true expected
reward of the greedy policy under Q^k? Not the same thing: Q^k can
overestimate wildly while its argmax policy is fine. A third family asks about
exploration, e.g. the upper-confidence-bound regret bound
Reg(T)≤O(T⋅N⋅logδNT)+δT.
Before any analysis, Levine is blunt about the payoff. Proving that deep RL algorithms
“work perfectly every time” is off the table — with all the tricks of the trade, they
aren’t even guaranteed to converge. The real purpose is to understand how error
responds to problem parameters: do larger discounts make problems easier or harder? If
you want half the error, do you need 2× the samples, or 4×?
Abstracting away exploration
Effective analysis in RL is “very hard without strong assumptions,” and the trick is
choosing assumptions that admit interesting conclusions without divorcing us too much
from reality. The big structural choice is to separate exploration from learning.
Worst-case exploration — the thing guarantees must address — is extremely pessimistic
and tends to dominate any joint analysis, while typical exploration (say, with a
well-shaped reward) is nowhere near that bad. Exploration analysis has its own goal:
show a method finds an ϵ-good policy in time polynomial in ∣S∣, ∣A∣, and
the horizon. To study learning on its own, we delete exploration entirely:
The first algorithm analyzed is deliberately naive and tabular: estimate
P^(s′∣s,a)=#(s,a,s′)/N by counting, then, given a policy π,
compute Q^πexactly under P^ — exact solution of an inexact model,
so all the error comes from P^=P. The questions, all in the infinity norm
because it bounds the worst-case state–action pair: how close is Q^π to
Qπ? How close is Q^⋆ to Q⋆? And how suboptimal is the
resulting greedy policy — ∥Q⋆−Qπ^⋆∥∞, the number that
actually quantifies RL performance? The first question turns out to be the tool that
answers the other two.
Concentration inequalities: the supervised-learning toolkit
Whenever we ask how close a learned quantity is to the truth as a function of sample
count, the tool is a concentration inequality. The most basic is Hoeffding’s:
Hoeffding covers real-valued means, but P^(s′∣s,a) is a categorical
distribution. The analogue for discrete distributions bounds the ℓ1 error —
total variation divergence, the norm we’ll use: with N i.i.d. samples of a
d-valued variable,
Pr(∥q^−q∥1≥d(1/N+ϵ))≤e−Nϵ2.
Substituting the model estimate (d=∣S∣) and absorbing constants,
∥P^(⋅∣s,a)−P(⋅∣s,a)∥1≤cN∣S∣log1/δwith probability 1−δ.
Same shape as Hoeffding: error falls as 1/N, grows as ∣S∣.
From model error to Q-function error: the simulation lemma
Now the RL-specific part: pass this supervised-learning bound through the Bellman
machinery. Writing the Bellman equation in matrix form — Qπ and r as vectors of
length ∣S∣∣A∣, P as an ∣S∣∣A∣×∣S∣ matrix, Vπ=ΠQπ with Π
the policy matrix, and Pπ=PΠ — gives Qπ=r+γPπQπ, and
since I−γPπ is (non-trivially) always invertible,
Qπ=(I−γPπ)−1r.
Policy evaluation is a linear operation, and the same identity holds under P^:
Q^π=(I−γP^π)−1r. Two lemmas do the rest.
The second lemma controls the evaluation operator: for any vector v,
∥(I−γPπ)−1v∥∞≤∥v∥∞/(1−γ) — the
“Q-function” of a pseudo-reward v is at most 1/(1−γ) times larger. The proof
sets w=(I−γPπ)−1v and uses the triangle inequality plus the fact
that a stochastic matrix cannot increase an infinity norm:
∥v∥∞≥∥w∥∞−γ∥Pπw∥∞≥(1−γ)∥w∥∞.
Whenever you see 1/(1−γ), think horizon: discounted sums are geometric series,
∑tγtc=c/(1−γ), so 1/(1−γ) is the effective horizon of an
infinite-horizon problem.
Chaining the lemmas, bounding the matrix–vector product crudely by the max-row
ℓ1 norm times ∥Vπ∥∞, using ∥Vπ∥∞≤Rmax/(1−γ)
with the standard normalization Rmax=1, and applying the concentration bound
(with a union bound over all (s,a), which only changes constants):
∥Qπ−Q^π∥∞≤(1−γ)2γc2N∣S∣log1/δ
The qualitative content: error still concentrates at the supervised rate 1/N,
but it grows quadratically in the effective horizon 1/(1−γ) — each Bellman
backup accumulates error over the horizon. (Not every scheme is quadratic, but this
naive one is.)
Two corollaries follow almost for free. For the optimal Q-functions, use
∣supxf−supxg∣≤supx∣f−g∣ with Q⋆=supπQπ: since the
per-policy bound holds for all π, ∥Q⋆−Q^⋆∥∞≤ϵ.
For the policy π^⋆ greedy under Q^⋆, subtract and add
Q^π^⋆ and apply the triangle inequality: one term is the
optimal-Q gap (≤ϵ, noting Q^π^⋆=Q^⋆),
the other compares true and learned Q for the same policy (≤ϵ), so
∥Q⋆−Qπ^⋆∥∞≤2ϵ.
Analyzing fitted Q-iteration
Part two analyzes something closer to an algorithm we’d actually run — model-free
fitted Q-iteration — though still idealized, since the real thing isn’t guaranteed to
converge at all. Exact Q-iteration applies the Bellman optimality operator
TQ=r+γPmaxaQ (a block-wise max over actions per state); the
approximate version fits
Q^k+1←argminQ^∥Q^−T^Q^k∥
with two error sources. First, T^=T: the approximate operator
T^Q=r^+γP^maxaQ uses the empirical averages
r^(s,a) and P^(s′∣s,a) over the data. Levine stresses these “are
not models” — they’re exactly the effect of averaging together the regression targets
for each state–action tuple. That mismatch is sampling error. Second, the
minimization itself is inexact — function approximation never fits the targets
perfectly. That’s approximation error, and since squared-error fitting breaks even
convergence proofs, the analysis assumes the fit is controlled in the infinity norm:
∥Q^k+1−TQ^k∥∞≤ϵk — “a strong assumption,” since
real supervised learning bounds a weighted expectation, not the worst case.
Sampling error reduces to the earlier toolkit. Splitting
∣T^Q(s,a)−TQ(s,a)∣ into a reward term and a next-value term, Hoeffding bounds
the first by 2Rmaxlog(1/δ)/2N, and the categorical concentration
bound handles the second, giving (after a union bound over (s,a))
For approximation error, subtract and add TQ^k−1 inside
∥Q^k−Q⋆∥∞, use Q⋆=TQ⋆ (the fixed point), and
invoke the fact that T is a γ-contraction in the infinity norm:
∥Q^k−Q⋆∥∞≤ϵk−1+γ∥Q^k−1−Q⋆∥∞.
Unrolling the recursion gives
∑i=0k−1γiϵk−i−1+γk∥Q^0−Q⋆∥∞:
the initialization is forgotten as k→∞, and bounding every ϵi
by the worst one turns the sum into a geometric series:
limk→∞∥Q^k−Q⋆∥∞≤1−γ1maxkϵk.
Every backup incurs fresh fitting error, and you make a horizon’s worth of backups.
Finally, put the two together by letting ϵk absorb both errors —
∥Q^k−TQ^k−1∥∞≤∥Q^k−T^Q^k−1∥∞+∥T^Q^k−1−TQ^k−1∥∞
— and note that the sampling term carries ∥Q∥∞=O(Rmax/(1−γ))
inside the outer 1/(1−γ): the total error is again quadratic in the effective
horizon, just as in part one. Infinity-norm assumptions aren’t realistic for practical
learners; more advanced results use p-norms weighted by a distribution μ — at
p=2 that’s exactly the familiar quadratic Bellman error — but those need their own
assumptions to dodge non-convergence, and the RL theory book by Agarwal, Jiang,
Kakade, and Sun (the source this lecture follows) develops them properly.
Check yourself
Derivation-style exercises in the lecture’s spirit — work them on paper.
Problem 17.1Hoeffding sample complexity
Rewards for a fixed (s,a) lie in [0,1], and you estimate r(s,a) by averaging
n samples. Using Hoeffding’s inequality, how many samples guarantee error at most
ϵ with probability at least 1−δ (two-sided)? If you then decide you
want half the error at the same confidence, by what factor must n grow? What if
you instead want failure probability δ/10 at the same ϵ?
Show solution
Two-sided failure probability: δ≤2e−2nϵ2/(b+−b−)2 with
b+−b−=1. Solving: log(δ/2)≤−2nϵ2, so
n≥2ϵ21logδ2. Halving ϵ multiplies the
1/ϵ2 factor by 4 — you need 4× the samples, which answers Levine’s
“if we want half the error, do we need 2× or 4×?” question for this
estimator. Dropping δ to δ/10 only changes log(2/δ) to
log(20/δ) — an additivelog10 inside the logarithm — so confidence is
cheap: sample cost grows logarithmically in 1/δ but quadratically in
1/ϵ.
Problem 17.2evaluation-operator lemma
Prove that for any vector v∈R∣S∣∣A∣,
∥(I−γPπ)−1v∥∞≤∥v∥∞/(1−γ). State exactly
where you use (a) the triangle inequality and (b) the fact that Pπ is a
stochastic matrix. Then explain in one sentence why this is the algebraic shadow of
the geometric series ∑tγtc=c/(1−γ).
Show solution
Let w=(I−γPπ)−1v, so v=(I−γPπ)w. Then
∥v∥∞=∥w−γPπw∥∞≥∥w∥∞−γ∥Pπw∥∞
— this is (a), the reverse triangle inequality ∥a−b∥≥∥a∥−∥b∥. Next,
each entry of Pπw is a convex combination of entries of w (rows of a
stochastic matrix are nonnegative and sum to 1), so
∥Pπw∥∞≤∥w∥∞ — this is (b). Combining:
∥v∥∞≥(1−γ)∥w∥∞, and dividing by 1−γ gives the
claim. The connection to the geometric series: (I−γPπ)−1is the
discounted sum ∑t=0∞(γPπ)t, each term of which shrinks v‘s
infinity norm by at most a factor γt; summing the worst case gives
∥v∥∞∑tγt=∥v∥∞/(1−γ) — the effective horizon.
Problem 17.3from evaluation to policy suboptimality
Suppose you have already proven ∥Qπ−Q^π∥∞≤ϵ for
every policy π. Using only the identity
∣supxf(x)−supxg(x)∣≤supx∣f(x)−g(x)∣ and the triangle inequality,
derive (a) ∥Q⋆−Q^⋆∥∞≤ϵ and (b)
∥Q⋆−Qπ^⋆∥∞≤2ϵ, where π^⋆ is
the greedy policy under Q^⋆. Identify the step where it matters that both
Q-functions in one of your terms belong to the same policy.
Show solution
(a) Q⋆=supπQπ and Q^⋆=supπQ^π, so
∥Q⋆−Q^⋆∥∞=∥supπQπ−supπQ^π∥∞≤supπ∥Qπ−Q^π∥∞≤ϵ,
since the per-policy bound holds uniformly. (b) Insert
−Q^π^⋆+Q^π^⋆ and apply the triangle
inequality:
∥Q⋆−Qπ^⋆∥∞≤∥Q⋆−Q^π^⋆∥∞+∥Q^π^⋆−Qπ^⋆∥∞.
For the first term, note Q^π^⋆=Q^⋆ because
π^⋆ is optimal in the learned MDP; by (a) this term is ≤ϵ.
The second term compares the learned and true Q-functions of the same policy
π^⋆ — this is exactly where the same-policy structure matters, because
only then does the part-one evaluation bound apply directly, giving ≤ϵ.
Total: 2ϵ. The greedy policy’s true return is within 2ϵ of optimal.
Problem 17.4horizon scaling
The main model-based bound is
∥Qπ−Q^π∥∞≤(1−γ)2γc2∣S∣log(1/δ)/N.
(a) Trace where each of the two factors of 1/(1−γ) enters the derivation.
(b) You move from γ=0.99 to γ=0.995, doubling the effective horizon.
By what factor must N grow to keep the bound unchanged? (c) Why does the bound carry
a factor ∣S∣ but only log(1/δ)?
Show solution
(a) One factor comes from the evaluation operator: the simulation lemma passes
(P−P^)Vπ through (I−γP^π)−1, which inflates the
infinity norm by at most 1/(1−γ). The second comes from bounding
∥Vπ∥∞ itself: values are discounted reward sums, so with Rmax=1,
∥Vπ∥∞≤1/(1−γ). Model error weighted by values, then backed up
over a horizon — error per backup, accumulated over a horizon’s worth of backups.
(b) Doubling 1/(1−γ) multiplies the bound by 4 through the quadratic term. To
cancel a factor of 4 you need N to grow by 4, i.e. N must grow by
16×. Long horizons are punishingly expensive under this scheme. (c) The
∣S∣ enters through the categorical concentration inequality — estimating an
∣S∣-outcome distribution in total variation costs d with d=∣S∣ — while
δ enters through the exponential tail e−Nϵ2, so solving for
ϵ pulls it inside a logarithm: confidence is exponentially cheap, state-space
coverage is polynomially expensive.