Bootstrapping and the Bias-Variance Tradeoff
Imagine two students estimating tomorrow's exam grade. One waits until the final grade is posted. Then she reasons backward about how each study session contributed. The other updates her guess after every practice quiz. She uses her current belief about the final grade to adjust it. She never sees the true outcome. The second student learns faster but risks anchoring on early, wrong beliefs. This is exactly the tension between Monte Carlo Prediction and Temporal-Difference Learning in reinforcement learning. Should you wait for a real, complete outcome? Or update an estimate using another estimate? This tension is not a minor implementation detail. It is one of the deepest design axes in reinforcement learning. Nearly every practical algorithm must decide how much to bootstrap. This includes tabular SARSA and deep actor-critic methods like Deep Q-Networks and PPO. Get it wrong, and an agent suffers one of two fates. Either it learns unbearably slowly (high variance, requiring huge amounts of data to average out noise). Or it converges confidently to the wrong answer (high bias, propagating error through its own estimates). Systems that train on billions of environment steps, like game-playing agents or robotic control policies, live or die by this tradeoff. The big picture is a spectrum, not a binary choice. Monte Carlo (MC) methods use complete, real returns. They are unbiased but noisy. Temporal-Difference (TD) methods bootstrap instead. They use one step of real experience plus an estimate of everything after. They are biased (in general) but far lower variance. Between these extremes lie n-step methods and TD(λ), which blend the two continuously. This article dissects bootstrapping precisely. It explains what it means mathematically, why it introduces bias, and why it also crushes variance. It shows how to reason about the tradeoff using update equations, backup diagrams, and a worked numerical trace. It sets up the machinery needed for n-Step Bootstrapping Methods and TD(lambda) and Eligibility Traces.
- Bootstrapping means updating a value estimate using other estimates, not just real observed rewards.
- Monte Carlo (MC) uses full returns : unbiased but high variance, since depends on an entire trajectory of randomness.
- TD(0) bootstraps with : much lower variance, but biased whenever is not yet correct.
- Bias comes from using an imperfect estimate as ground truth; variance comes from summing many random rewards.
- The tradeoff is continuous: n-step returns and TD(λ) interpolate smoothly between MC and TD(0).
- Bootstrapping enables online, incremental learning from incomplete episodes — essential for continuing tasks.
Bootstrapping trades statistical bias for a large reduction in variance by replacing the unknown future with a current estimate of it.
The idea
In reinforcement learning, prediction means estimating the value function , the expected return from a state under policy . Every prediction method must decide what target to regress toward. Monte Carlo prediction uses the actual sampled return
as the target, where is the terminal time step. This target is a genuine sample of the true random variable whose expectation defines , so it is unbiased: exactly.
Bootstrapping, by contrast, means constructing an update target that includes an existing estimate rather than waiting for the process to finish. The canonical example is TD(0), whose target is
called the TD target. Instead of summing rewards all the way to termination, TD(0) takes one real reward and then substitutes the current estimate for everything that would happen afterward. The word "bootstrap" captures this self-referential structure: the value function is used to update itself, one step removed. Dynamic programming methods (value iteration, policy evaluation) are the purest form of bootstrapping — they use only estimates, no sampled experience at all. MC is the opposite pole — it uses only sampled experience, no bootstrapping at all. TD(0) sits in between: one real transition, then bootstrap. This single design choice determines two statistical properties of the update:
- Bias: a systematic tendency for the expected update target to differ from the true value , arising because is itself imperfect during learning.
- Variance: the spread of the target around its own mean, arising from the randomness of the trajectory (stochastic policy, stochastic transitions, stochastic rewards) that the target depends on.
MC targets are unbiased but depend on an entire random trajectory — every reward and every action choice from to termination injects noise, so variance can be large, especially for long episodes. TD targets depend on only one random reward and one random next state, so their variance is small, but because is generally wrong during learning, the target is biased toward whatever error currently exists in . This bias vanishes only in the limit as , which is why TD methods are still guaranteed to converge under standard stochastic approximation conditions — but at any finite point in training, the update target is not a sample of the true return.
How it works
Consider one-step TD prediction, TD(0), operating alongside Monte Carlo prediction for comparison. Both estimate from experience generated by following .
Monte Carlo update (every-visit, incremental form): ``` Initialize V(s) arbitrarily for all s, V(terminal) = 0 Repeat for each episode: Generate an episode S_0, A_0, R_1, S_1, A_1, R_2, ..., S_{T-1}, A_{T-1}, R_T G <- 0 For t = T-1 down to 0: G <- R_{t+1} + gamma G # accumulate the actual return V(S_t) <- V(S_t) + alpha (G - V(S_t)) ```
TD(0) update: ``` Initialize V(s) arbitrarily for all s, V(terminal) = 0 Repeat for each episode: Initialize S Repeat for each step of episode, until S is terminal: A <- action given by pi for S Take action A, observe reward R and next state S' V(S) <- V(S) + alpha (R + gamma V(S') - V(S)) # bootstrap target S <- S' ``` The critical difference is visible line-by-line: MC must run the loop `for t = T-1 down to 0` after the episode ends, requiring a full trajectory in memory and forcing the agent to wait for termination. TD(0) updates `V(S)` immediately, using the just-observed reward `R` plus the current guess `V(S')`, and can therefore run in continuing (non-terminating) tasks and update online, one step at a time. A useful way to see the whole spectrum is the n-step return, which foreshadows n-Step Bootstrapping Methods:
- recovers the TD(0) target.
- (or ) recovers the Monte Carlo return, since the bootstrap term vanishes at a terminal state.
TD(λ), covered in TD(lambda) and Eligibility Traces, is a weighted average of all for , controlled by a single parameter , giving a continuously tunable dial between the low-variance, high-bias end (TD(0), ) and the unbiased, high-variance end (MC, ).
Complexity & correctness
Time and space, per update. TD(0) performs work per environment step: one lookup of , one arithmetic update. Its memory footprint is beyond the value table itself, since it needs no trajectory history — the update at time only needs . This is what makes TD(0) usable in continuing tasks with no terminal state at all. Monte Carlo requires space to store (or replay) the full episode before any update can be made, where is the episode length, and total time per episode to compute all returns via the backward accumulation `G <- R + gammaG`. Per-state-visit this is still amortized work, but the latency* before the first update is — MC cannot update online mid-episode, and cannot be used at all if .
Bias — why TD(0) is biased and MC is not. Fix a state visited at time . The MC target is , a random variable whose expectation, by definition of , satisfies
So : no bias, regardless of the current value table (MC targets don't even reference the value table). The TD target is . Taking expectation over the one-step transition,
If exactly, the right-hand side equals by the Bellman equation — so the TD target is unbiased only at the fixed point. During learning, , so
which is exactly the (discounted, expected) error currently present in the successor state's estimate. This is why bootstrapped bias is often called "cascading" — early errors in propagate into targets for other states, and only shrink as improves.
Variance — why TD(0) has less. Write the MC return as a sum of (possibly random-length) reward terms:
If the per-step reward noise terms have roughly comparable variance and are not perfectly negatively correlated, the variance of a sum of such terms scales roughly linearly in the number of terms (exactly so if independent):
which grows with episode length (bounded by as but still large for long or highly stochastic episodes, and additionally inflated by variance in the policy's action choices along the way). The TD target's variance,
depends on only one reward and one next-state draw — it does not compound over a trajectory. This is the structural reason bootstrapped targets have dramatically lower variance: they truncate the random sum after one term and replace the remainder with a (fixed, non-random-given-) point estimate.
Convergence. Both tabular MC and tabular TD(0), with step sizes satisfying the Robbins–Monro conditions , converge to with probability 1, under standard assumptions (finite MDP, all states visited infinitely often). TD(0)'s convergence proof relies on the Bellman operator being a -contraction in the max norm, so successive bootstrapped applications shrink error geometrically in expectation, even though any single update is biased. MC's convergence is the standard law-of-large-numbers argument for sample averages of i.i.d.-ish returns per state. Empirically, and provably in tabular linear settings (the classic "A–B example" in Sutton & Barto), TD methods often converge faster in terms of data efficiency, because bootstrapping lets information propagate through the whole Markov chain's structure rather than requiring long trajectories to be resampled repeatedly — this is TD's implicit exploitation of the Markov property, something MC targets ignore entirely.
Honest tradeoff summary.
| Property | Monte Carlo | TD(0) |
|---|---|---|
| Bias | none (unbiased) | present during learning, vanishes at fixed point |
| Variance | high (grows with trajectory length/stochasticity) | low (one-step) |
| Needs terminal episode? | yes | no |
| Update latency | end of episode, | every step, |
| Exploits Markov property | no | yes |
| Sensitive to initial | no | yes (bootstrap target depends on it) |
Worked example
Consider a tiny 4-state chain: , undiscounted (), with deterministic transitions but a stochastic reward at the step: reward is with probability 0.5 and with probability 0.5. All other rewards are . Suppose is already known exactly (it's one step from termination with reward 0), and the true value (expectation of the stochastic reward), . Suppose the current estimates, before any update this episode, are miscalibrated:
One episode is sampled: (reward 0), (reward , the high-reward outcome), (reward 0).
Monte Carlo, using every-visit returns computed backward ():
| (accumulated) | Update , | |||
|---|---|---|---|---|
| 2 | C | 0 | ||
| 1 | B | 2 | ||
| 0 | A | 0 |
Note the return used to update is a real sample of the true trajectory-sum — unbiased, but it's a "lucky" high-reward sample (the other possible outcome, reward 0, would have given , a big swing). This is the variance in action: the MC target for can be or depending on a coin flip three steps away, even though exactly in between.
TD(0), updating online as the episode unfolds ():
| Step | Transition | TD target | Update |
|---|---|---|---|
| 1 | , | ||
| 2 | , | ||
| 3 | , |
The update to used target , which is biased — it doesn't reflect the reward that will actually arrive at , only 's current (also wrong) estimate. But notice the update to moved only from : a small, low-variance nudge, because it depended only on at the time, not on the downstream coin flip. Over many episodes, as itself gets corrected toward by the second row's updates, 's bootstrapped targets automatically improve too — this is the "propagation" that makes TD data-efficient, while MC would keep swinging between roughly and every episode until enough samples average out.
Common pitfalls & traps
| Pitfall | Why it happens | Fix |
|---|---|---|
| Treating TD bias as permanent | Confusing "biased target at this iteration" with "biased fixed point" | Bias vanishes as ; TD(0) still converges to the correct value under standard conditions |
| Running MC on a non-terminating (continuing) task | MC needs , which requires a finite | Use TD or truncate with n-step / discounted infinite-horizon returns |
| Using MC and expecting fast learning in noisy environments | Ignoring that variance scales with trajectory randomness | Prefer TD or moderate- n-step returns; consider variance reduction (baselines, averaging) |
| Bootstrapping with a badly-initialized and few visits | Early bootstrapped targets can be wildly wrong and self-reinforcing before enough data arrives | Use optimistic/neutral initialization, smaller early, or eligibility traces to spread credit |
| Assuming TD(0) always beats MC in sample efficiency | True often in Markov environments, false if the state representation is non-Markov (violates the assumption the Bellman backup relies on) | Check the Markov property; under function approximation with poor features TD's bootstrapping bias can actually hurt more than MC's variance |
| Off-by-one in the update target | Using instead of , or forgetting the discount on the bootstrap term | Double-check indices: target is , evaluated with the pre-update value table |
Pioneers & history
Origins · 1 minRichard S. Sutton and how this was discovered
Richard Sutton, working first at the University of Massachusetts Amherst and later at the University of Alberta and DeepMind, introduced temporal-difference learning as a distinct class of prediction methods in the early 1980s. His work with Andrew Barto systematically connected TD methods to dynamic programming's bootstrapping and to Monte Carlo's sampling, framing reinforcement learning as a unifying spectrum rather than disparate techniques. Sutton's TD(λ) algorithm, and later analyses of its bias and variance properties, became foundational to how the field understands the cost and benefit of using estimates to update estimates.
Where this matters
Bootstrapping is not a niche academic distinction — it governs the design of nearly every scalable RL system. Temporal-difference methods underlie Q-learning and SARSA, the workhorses of tabular control, and their function-approximation descendants such as Deep Q-Networks (DQN), which bootstrap Q-value targets using a separately maintained target network specifically to tame the bias-variance and stability tradeoffs discussed here. Actor-critic methods (A3C, PPO, SAC) use a bootstrapped critic to estimate value and reduce the variance of policy-gradient updates — the critic is, in essence, an industrial application of the TD idea to make policy learning tractable at scale. AlphaGo and AlphaZero blend Monte Carlo tree search rollouts (variance-heavy but unbiased local estimates) with a learned bootstrapped value network (low-variance but approximate), a direct architectural embodiment of the MC/TD tradeoff. In robotics and continuous-control research, n-step returns and TD(λ)-style eligibility traces are routinely tuned as a hyperparameter precisely because the "right" amount of bootstrapping depends on reward sparsity, episode length, and how trustworthy the current value estimates are — the exact tradeoff this article formalizes, and the exact motivation for n-Step Bootstrapping Methods and TD(lambda) and Eligibility Traces.
Ask the tutor: How does the eligibility-trace mechanism in TD(λ) let you compute a weighted blend of all n-step returns without storing every one of them explicitly?
Is bootstrapping the same thing as using a bootstrap sample in statistics?
No — the terms are historically unrelated despite the shared word. Statistical bootstrapping refers to resampling a dataset with replacement to estimate a sampling distribution. RL bootstrapping refers to using one estimate to update another estimate, as in the TD target . The RL usage draws on the idiom "pulling yourself up by your bootstraps" — building an estimate partly out of itself — and is closer in spirit to fixed-point iteration in dynamic programming than to any resampling procedure.
Does TD(0) ever have zero bias?
Yes, in two cases. First, at convergence: once exactly, the Bellman equation guarantees , so the target becomes unbiased. Second, trivially, if the environment happens to start with already equal to (e.g., correctly initialized). In general, during the learning process with an arbitrary initialization, expect nonzero bias proportional to the current error in , which shrinks as learning proceeds.
Why does Monte Carlo variance grow with episode length?
Because the return is a sum of (discounted) rewards over every remaining step of the episode, and each of those rewards carries its own randomness from stochastic transitions, stochastic rewards, or a stochastic policy. Summing more independent (or weakly correlated) random terms increases the total variance, roughly linearly in the number of terms if variances are comparable. A TD target truncates this sum after a single term, which is why its variance does not grow with episode length.
Can I combine Monte Carlo and TD ideas instead of choosing one?
Yes — this is exactly the motivation for n-step returns and TD(λ). An n-step return uses real rewards before bootstrapping, interpolating between TD(0)'s low variance () and MC's zero bias ( large). TD(λ) goes further, computing a weighted average over all possible simultaneously via eligibility traces, with a single tunable parameter . In practice, intermediate values often outperform either extreme, since they trade a small, controlled amount of bias for a substantial variance reduction.
Does bootstrapping ever cause instability, not just bias?
Yes, particularly when combined with function approximation and off-policy learning — the "deadly triad." With a tabular representation, TD(0) is provably convergent under standard step-size schedules. But bootstrapped updates through a parametric approximator can, in specific off-policy constructions (e.g., Baird's counterexample), cause value estimates to diverge to infinity rather than merely being biased. This is why deep RL systems use techniques like target networks, gradient corrections, or on-policy sampling to keep bootstrapped updates stable.
Which should a beginner default to: MC or TD?
For episodic, reasonably short, low-variance-reward tasks with tabular states, either works, but TD(0) is usually preferred for its lower variance and its ability to update online. For continuing tasks, or tasks with long episodes, TD (or n-step/TD(λ)) is close to mandatory, since MC requires full episodes and its variance grows with length. MC remains valuable as a conceptually simple, unbiased baseline, and is still used in specific contexts like Monte Carlo tree search rollouts.
How does this bias-variance tradeoff connect to control algorithms like Q-learning?
Q-learning's update, , is a bootstrapped TD-style target applied to action values instead of state values. It inherits exactly the same tradeoff: low variance per update because it depends on only one transition, and bias during learning because is an imperfect estimate (compounded further by the maximization introducing an optimistic bias of its own, addressed by Double Q-learning). Understanding TD(0)'s bias-variance behavior is a direct prerequisite to understanding why control algorithms behave the way they do.