Simple Algorithm
Reinforcement Learning · Fixed Point · 28 min

Fitted Q-Iteration & Its Guarantees

Batch RL as repeated regression: concentrability and error propagation.

Freeze the bootstrap target, fit a regression, repeat: fitted Q-iteration turns value learning into a sequence of supervised problems, and DQN's target network runs the same loop online. Its guarantees say exactly what such a loop needs: regression errors are amplified by up to 2γ/(1−γ)22\gamma/(1-\gamma)^2 and by a concentrability coefficient that measures how well the data cover the states any policy could reach, and the function class must be closed under the Bellman operator, not merely contain Q⋆Q^\star. This lesson derives the error propagation, states the sample complexity under realizability, completeness and coverage, and the lower bounds showing that none of the three can be dropped.

What you’ll learn

  • State fitted Q-iteration, explain why each iteration is a consistent regression toward T⋆fk\mathcal T^\star f_k, and view DQN as a stochastic, online version of it.
  • Derive how per-iteration regression errors propagate to the final policy's loss, and define the concentrability coefficient that appears.
  • State the sample complexity of FQI under concentrability, realizability and completeness, and the lower bounds that make each assumption necessary.
  • Explain how completeness can fail even when Q⋆Q^\star is representable, and how these results lead to pessimism in offline RL.

Batch RL as repeated regression

Batch (offline) RL starts from a fixed dataset D={(si,ai,ri,si′)}i=1n\data=\{(s_i,a_i,r_i,s_i')\}_{i=1}^n, with state–action pairs drawn from a data distribution μ\mu and si′∼P(⋅∣si,ai)s_i'\sim P(\cdot\mid s_i,a_i), and a function class F\mathcal F of candidate action-value functions with values in [0,Vmax⁡][0,V_{\max}]. Fitted Q-iteration (FQI) alternates a frozen backup with a regression:

fk+1=arg min⁡f∈F ∑i=1n(f(si,ai)−ri−γmax⁡a′fk(si′,a′))2,πK(s)=arg max⁡afK(s,a).f_{k+1}=\argmin_{f\in\mathcal F}\ \sum_{i=1}^n\Big(f(s_i,a_i)-r_i-\gamma\max_{a'}f_k(s_i',a')\Big)^2,\qquad\pi_K(s)=\argmax_af_K(s,a).

Because fkf_k is fixed during the fit, the target yi=ri+γmax⁡a′fk(si′,a′)y_i=r_i+\gamma\max_{a'}f_k(s_i',a') has conditional mean (T⋆fk)(si,ai)(\mathcal T^\star f_k)(s_i,a_i), and the least-squares minimizer over all functions is that conditional mean. Each iteration is therefore a consistent regression toward the Bellman backup, an approximate step of value iteration. The noise in s′s' only adds variance; this is why FQI escapes the double-sampling bias that afflicts minimizing a squared TD error, whose target moves with the function being fitted.

python
import numpy as np
from sklearn.ensemble import ExtraTreesRegressor

def fitted_q_iteration(S, A, R, S2, done, n_actions, gamma=0.99, iters=50):
    """Batch of n transitions: S, S2 are (n, k) arrays, A (n,) ints, R and done (n,) floats."""
    X = np.column_stack([S, A])                          # regress on (state, action)
    y = R.copy()                                         # first target: the immediate reward
    for _ in range(iters):
        q = ExtraTreesRegressor(n_estimators=50, min_samples_leaf=5).fit(X, y)
        q_next = np.column_stack([q.predict(np.column_stack([S2, np.full(len(S2), a)]))
                                  for a in range(n_actions)])
        y = R + gamma * (1.0 - done) * q_next.max(axis=1)  # backed-up targets for the next fit
    return q                                             # act greedily on q.predict([s, a])

FQI with extremely randomized trees, the regressor Ernst, Geurts & Wehenkel (2005) found most effective. On a five-state chain with reward 1 for reaching the right end and γ=0.9\gamma=0.9, it recovers Q(s,right)=0.94−sQ(s,\text{right})=0.9^{4-s} to three decimals. Riedmiller's (2005) neural fitted Q-iteration (NFQ) instead retrained a multilayer perceptron on each iteration's targets with full-batch updates.

DQN is stochastic FQI. Its target network is fkf_k, frozen for thousands of updates; minibatch SGD on replayed transitions approximately solves the regression; refreshing the target network is k←k+1k\leftarrow k+1. The differences matter: the regression is never solved to convergence, the replay buffer, and hence μ\mu, changes as the agent collects data, and the network class is not chosen to satisfy any of the conditions below. Fan, Wang, Xie & Yang (2020) analyze FQI with deep ReLU networks along these lines, deriving statistical rates under smoothness assumptions on the Bellman backups.

How regression errors propagate

Write the error of iteration kk as εk=Tfk−fk+1\varepsilon_k=\mathcal Tf_k-f_{k+1}, and suppose each regression is accurate on average under the data distribution, ∥εk∥p,μ≤ε\norm{\varepsilon_k}_{p,\mu}\le\varepsilon. How good is the greedy policy πK\pi_K, measured under some distribution ρ\rho of interest (say, initial states)? Sup-norm analyses give 2γε/(1−γ)22\gamma\varepsilon/(1-\gamma)^2 but need ∥εk∥∞≤ε\norm{\varepsilon_k}_\infty\le\varepsilon, which no regression on finite data controls. Munos (2003, 2007) and Munos & Szepesvári (2008) carry weighted LpL_p errors through instead, at the price of a coefficient comparing the distributions the errors will be evaluated under to the distribution they were controlled under.

DerivationError propagation, from pointwise to Lp
  1. V⋆−VπK≤(I−γPπK)−1{∑k=0K−1γK−k[(Pπ⋆)K−k+PπKPπK−1⋯Pπk+1]∣εk∣+γK+1[(Pπ⋆)K+1+PπK⋯Pπ0]∣V⋆−V0∣}V^\star-V^{\pi_K}\le(\mathbf I-\gamma P^{\pi_K})^{-1}\Big\{\sum_{k=0}^{K-1}\gamma^{K-k}\Big[(P^{\pi^\star})^{K-k}+P^{\pi_K}P^{\pi_{K-1}}\cdots P^{\pi_{k+1}}\Big]\abs{\varepsilon_k}+\gamma^{K+1}\Big[(P^{\pi^\star})^{K+1}+P^{\pi_K}\cdots P^{\pi_0}\Big]\abs{V^\star-V_0}\Big\}

    Pointwise bound (Munos & Szepesvári, 2008, Lemma 3; stated for state values with greedy policies πk\pi_k). The per-iteration errors are carried forward by products of transition matrices, once along the optimal policy and once along the sequence of greedy policies:

  2. ρ Pπ1⋯Pπm∣εk∣p≤c(m) μ∣εk∣p=c(m) ∥εk∥p,μp\rho\,P^{\pi_1}\cdots P^{\pi_m}\abs{\varepsilon_k}^p\le c(m)\,\mu\abs{\varepsilon_k}^p=c(m)\,\norm{\varepsilon_k}_{p,\mu}^p

    Future-state distributions. Expand (I−γPπK)−1=∑j≥0γj(PπK)j(\mathbf I-\gamma P^{\pi_K})^{-1}=\sum_{j\ge0}\gamma^j(P^{\pi_K})^j. Every term is now γm\gamma^m times a product of mm transition matrices applied to some ∣εk∣\abs{\varepsilon_k}, and ρ\rho times such a product is the distribution of the state reached after mm steps of some policy sequence, whose density with respect to μ\mu is at most c(m)c(m). After normalizing the positive coefficients into a probability mixture (total weight 2γ/(1−γ)22\gamma/(1-\gamma)^2 for the error terms), Jensen's inequality moves the pp-th power inside, and each expectation obeys

  3. ∥V⋆−VπK∥p,ρ≤2γ(1−γ)2 Cρ,μ1/p max⁡0≤k<K∥εk∥p,μ+η\norm{V^\star-V^{\pi_K}}_{p,\rho}\le\frac{2\gamma}{(1-\gamma)^2}\,C_{\rho,\mu}^{1/p}\,\max_{0\le k<K}\norm{\varepsilon_k}_{p,\mu}+\eta

    Summing with the discount weights, the c(m)c(m) combine exactly into Cρ,μC_{\rho,\mu} (Lemma 4). The initial-error term decays like γK\gamma^K, so KK logarithmic in 1/η1/\eta suffices:

As p→∞p\to\infty this recovers the classical 2γε/(1−γ)22\gamma\varepsilon/(1-\gamma)^2. With a finite-sample analysis of each regression, Munos & Szepesvári turn it into: with enough samples, ∥V⋆−VπK∥p,ρ≤2γ(1−γ)2Cρ,μ1/p dp,μ(TF,F)+ε\norm{V^\star-V^{\pi_K}}_{p,\rho}\le\frac{2\gamma}{(1-\gamma)^2}C_{\rho,\mu}^{1/p}\,d_{p,\mu}(\mathcal T\mathcal F,\mathcal F)+\varepsilon with high probability, where dp,μ(TF,F)=sup⁡f∈Finf⁡g∈F∥g−Tf∥p,μd_{p,\mu}(\mathcal T\mathcal F,\mathcal F)=\sup_{f\in\mathcal F}\inf_{g\in\mathcal F}\norm{g-\mathcal Tf}_{p,\mu} is the inherent Bellman error of the class: how far backups can leave it. Their analysis is for fitted value iteration with a generative model; the same structure holds for action values, with concentrability over state–action distributions. Farahmand, Munos & Szepesvári (2010) sharpened the propagation: errors of late iterations weigh more than early ones, and the concentrability coefficients involve the expected squared density ratio rather than its supremum.

Predict before you look

Ignore concentrability (Cρ,μ=1C_{\rho,\mu}=1). By what factor 2γ/(1−γ)22\gamma/(1-\gamma)^2 can a per-iteration regression error be amplified in the final policy's loss when γ=0.9\gamma=0.9?

Show the answer

180

2⋅0.9/(0.1)2=1802\cdot0.9/(0.1)^2=180; at γ=0.99\gamma=0.99 it is 19,80019{,}800. The first 1/(1−γ)1/(1-\gamma) comes from summing the errors of past iterations, each discounted once more per iteration; the second from turning a value error into lost return when the policy acts greedily on it. The bound is a worst case, attained only when errors line up adversarially with the dynamics, but it explains why long horizons make fitted methods fragile.

Realizability, completeness, coverage

Chen & Jiang (2019) isolate three assumptions and ask which are necessary. Concentrability: for every distribution ν\nu over state–action pairs reachable at some step by some policy, ν(s,a)/μ(s,a)≤C\nu(s,a)/\mu(s,a)\le C. Realizability: Q⋆∈FQ^\star\in\mathcal F. Completeness: T⋆f∈F\mathcal T^\star f\in\mathcal F for every f∈Ff\in\mathcal F (for a finite class, completeness implies realizability, since iterating T⋆\mathcal T^\star from any ff approaches Q⋆Q^\star).

Coverage is necessary. Chen & Jiang also construct MDP families in which realizability and completeness both hold, the learner may choose any data distribution, and still no algorithm achieves sample complexity polynomial in ∣A∣|\mathcal A|, 1/(1−γ)1/(1-\gamma), ln⁡∣F∣\ln|\mathcal F|, ln⁡∣G∣\ln|\mathcal G|, 1/ε1/\varepsilon and ln⁡(1/δ)\ln(1/\delta): every data distribution has concentrability exponential in the horizon. Realizability alone was conjectured insufficient, and Chen & Jiang showed that two general proof strategies cannot establish that. Foster, Krishnamurthy, Simchi-Levi & Xu (2022) proved the conjecture: with realizability and concentrability but without completeness, any algorithm can need a number of samples polynomial in the number of states, so no bound in terms of ln⁡∣F∣\ln|\mathcal F| is possible. On the positive side, Xie & Jiang (2021) learn Q⋆Q^\star with realizability alone under a stronger notion of exploratory data.

Check your understanding

You add more functions to a complete, finite class F\mathcal F. Which assumption can this break?

  1. Realizability
  2. Completeness
  3. Concentrability
  4. None: larger classes satisfy every assumption that smaller ones do
Show the answer

B. Completeness

Realizability is monotone: if Q⋆∈FQ^\star\in\mathcal F it stays in any larger class. Completeness is not: a new function ff brings the obligation that T⋆f\mathcal T^\star f be in the class too, and it may not be. This non-monotonicity is one reason completeness is considered the less natural assumption, and why Chen & Jiang asked whether it could be dropped. For piecewise-constant classes on an abstraction, completeness holds exactly when the abstraction is a bisimulation (Representation Learning for RL).

From fitted iteration to offline RL

The concentrability assumption asks the data to cover everything any policy can reach. In offline RL that is rarely true: logged data come from one behavior policy and cover a narrow region. Without coverage, FQI's maximization queries fk(s′,a′)f_k(s',a') at actions the data never contain, the regression has no information there, and the greedy step selects whichever unseen action happens to be overestimated: the extrapolation error that wrecks naive offline deep RL (Offline RL).

The theoretical response is pessimism: replace the greedy step by one that is greedy with respect to a lower confidence bound, so that unsupported actions look bad rather than good. Pessimistic algorithms need coverage only of a single good comparator policy instead of all policies, which turns the all-policy concentrability above into a much weaker single-policy condition (Pessimism: The Theory of Offline RL).

AssumptionsWhat is known
Concentrability + completeness (hence realizability)FQI: O(Cln⁡(∣F∣/δ)/(ε2(1−γ)4))\order{C\ln(|\mathcal F|/\delta)/(\varepsilon^2(1-\gamma)^4)} samples (Chen & Jiang, 2019)
Realizability + completeness, no coverage restrictionNo polynomial sample complexity, whatever the data distribution (Chen & Jiang, 2019)
Realizability + concentrability, no completenessLower bound polynomial in ∣S∣|\mathcal S| (Foster et al., 2022)
Realizability + a stronger exploratory-data conditionPolynomial (Xie & Jiang, 2021)
Linear features, every QπQ^\pi realizable, well-conditioned dataOffline evaluation exponential in the horizon (Wang, Foster & Kakade, 2021)
Batch value-function approximation in one table: what the data must cover and what the class must contain.

Key takeaways

  • Fitted Q-iteration regresses frozen backed-up targets, fk+1≈T⋆fkf_{k+1}\approx\mathcal T^\star f_k; DQN's target network makes it an online, stochastic version of the same loop.
  • Per-iteration errors ∥εk∥p,μ≤ε\norm{\varepsilon_k}_{p,\mu}\le\varepsilon yield ∥V⋆−VπK∥p,ρ≤2γ(1−γ)2Cρ,μ1/pε+η\norm{V^\star-V^{\pi_K}}_{p,\rho}\le\frac{2\gamma}{(1-\gamma)^2}C_{\rho,\mu}^{1/p}\varepsilon+\eta, where Cρ,μC_{\rho,\mu} measures how well μ\mu covers every policy's future states.
  • Under concentrability and completeness, FQI needs O(Cln⁡(∣F∣/δ)/(ε2(1−γ)4))\order{C\ln(|\mathcal F|/\delta)/(\varepsilon^2(1-\gamma)^4)} samples; coverage is provably necessary, and realizability without completeness is provably insufficient.
  • Completeness can fail while Q⋆Q^\star is representable, as in Tsitsiklis and Van Roy's divergent example; without coverage, pessimism replaces greediness in offline RL.

Check yourself

In the interactive lesson these are scored with your confidence, and what you miss comes back for review.

Question 1

Why is each FQI regression a consistent estimate of T⋆fk\mathcal T^\star f_k, while minimizing the mean squared TD error is biased?

  1. Because FQI uses trees instead of linear features
  2. Because FQI sees each transition twice
  3. Because FQI uses importance sampling
  4. Because FQI's target uses the frozen fkf_k, so it does not depend on the function being fitted, and its conditional mean is (T⋆fk)(s,a)(\mathcal T^\star f_k)(s,a)
Show the answer

D. Because FQI's target uses the frozen fkf_k, so it does not depend on the function being fitted, and its conditional mean is (T⋆fk)(s,a)(\mathcal T^\star f_k)(s,a)

With fixed targets, least squares estimates the conditional mean, and the noise of s′s' only adds variance. In the squared TD error, the target r+γv^(s′)r+\gamma\hat v(s') depends on the same parameters being fitted, so its variance becomes part of the objective and biases the minimizer.

Question 2

What does a large concentrability coefficient Cρ,μC_{\rho,\mu} indicate?

  1. That some policy sequences can reach states where the data distribution μ\mu puts little mass, so errors controlled under μ\mu say little about errors where those policies go
  2. That the function class is too small
  3. That the discount factor is too small
  4. That the rewards are very noisy
Show the answer

A. That some policy sequences can reach states where the data distribution μ\mu puts little mass, so errors controlled under μ\mu say little about errors where those policies go

c(m)c(m) bounds the density, with respect to μ\mu, of the state distribution after mm steps of any policy sequence. If some policies concentrate where μ\mu is thin, a small Lp(μ)L_p(\mu) regression error can hide large errors exactly where the learned policy will go.

Question 3

Which statement about Chen & Jiang (2019) is correct?

  1. They proved that realizability alone suffices for batch RL with polynomial sample complexity
  2. They proved that coverage (bounded concentrability) is necessary even with realizability and completeness, and conjectured that realizability without completeness is insufficient, later proved by Foster et al. (2022)
  3. They proved that completeness is unnecessary
  4. They showed that FQI diverges whenever the class is complete
Show the answer

B. They proved that coverage (bounded concentrability) is necessary even with realizability and completeness, and conjectured that realizability without completeness is insufficient, later proved by Foster et al. (2022)

Their lower bound shows that without restricting the MDP's dynamics, even favorable data cannot give polynomial sample complexity, so some coverage condition is needed. The insufficiency of realizability was left as a conjecture, with evidence that standard proof techniques fail, and resolved by Foster, Krishnamurthy, Simchi-Levi and Xu.

Further reading

  • D. Ernst, P. Geurts & L. Wehenkel, "Tree-based batch mode reinforcement learning", Journal of Machine Learning Research 6 (2005).
  • M. Riedmiller, "Neural fitted Q iteration – first experiences with a data efficient neural reinforcement learning method", ECML (2005).
  • R. Munos & C. Szepesvári, "Finite-time bounds for fitted value iteration", Journal of Machine Learning Research 9 (2008).
  • J. Chen & N. Jiang, "Information-theoretic considerations in batch reinforcement learning", ICML (2019).
  • D. J. Foster, A. Krishnamurthy, D. Simchi-Levi & Y. Xu, "Offline reinforcement learning: Fundamental barriers for value function approximation", COLT (2022).