N-step bootstrapping is a family of value-estimation methods in reinforcement learning that builds each learning target from n actual rewards followed by a value estimate of the state reached after those n steps. The resulting quantity, called the n-step return or n-step TD target, sits on a continuum between one-step temporal difference learning, where n equals 1, and Monte Carlo methods, where n extends to the end of the episode.
By choosing n, a practitioner controls how much the agent relies on observed experience versus its own current predictions. This single parameter shapes the bias, variance and speed of learning, and n-step targets appear in many widely used deep reinforcement learning algorithms in artificial intelligence, from asynchronous actor-critic agents to Rainbow-style value networks.
How the n-step return is constructed
The n-step return at time t adds the discounted rewards of the next n transitions and then appends the discounted value estimate of the state reached at step t plus n. Written compactly, G(t:t+n) = R(t+1) + γR(t+2) + ... + γ^(n-1)R(t+n) + γ^n V(S(t+n)), where γ is the discount factor between 0 and 1.
The value estimate at the end is the bootstrap term: instead of waiting for the true remaining return, the method substitutes a prediction. If the episode terminates before n steps, the bootstrap term is dropped and the target equals the ordinary Monte Carlo return for the remaining steps. The update then moves the estimate toward this target with a step size α, exactly as in one-step TD learning.
The following table shows how the composition of the target changes with n.
| Value of n | Real rewards used | Bootstrap term | Equivalent method |
|---|---|---|---|
| n = 1 | One reward | γ V(S(t+1)) | One-step TD, TD(0) |
| n = 3 | Three rewards | γ³ V(S(t+3)) | Three-step TD |
| n = 10 | Ten rewards | γ¹⁰ V(S(t+10)) | Ten-step TD |
| n ≥ episode length | All remaining rewards | None | Monte Carlo |
The bias and variance trade-off controlled by n
The choice of n is fundamentally a bias-variance trade-off. A one-step target depends on a single random reward and transition, so its variance is low, but it inherits any error in the current value estimate almost undiminished. A long target relies mostly on sampled rewards, so it is nearly unbiased with respect to the policy, yet it accumulates the randomness of many transitions.
Because the bootstrap term is multiplied by γ to the power n, the influence of an inaccurate estimate shrinks geometrically as n grows. This property, called the error reduction property of n-step returns, explains why intermediate values often learn faster than either extreme.
| Property | Small n | Large n |
|---|---|---|
| Bias from value errors | High | Low |
| Target variance | Low | High |
| Speed of reward propagation | One state per update | Up to n states per update |
| Update delay | One step | n steps |
| Sensitivity to off-policy data | Low | High |
Empirically, intermediate n values between 3 and 20 frequently outperform both TD(0) and Monte Carlo on benchmark tasks, but the best setting depends on reward density, discount factor and the quality of the function approximator. There is no universally optimal n, which is why the parameter is usually tuned.
Variants for control and off-policy learning
N-step targets extend naturally from state values to action values, producing control algorithms that learn a policy rather than only evaluating one. The variants differ mainly in how they treat the last bootstrap term and how they handle data collected by a different behavior policy.
| Variant | Bootstrap term | Off-policy handling |
|---|---|---|
| N-step SARSA | Q of the action actually taken | On-policy only |
| N-step Expected SARSA | Expected Q under the target policy | On-policy, lower variance |
| Importance-sampled n-step | Q or V with ratio weights | Corrects with product of probability ratios |
| Tree backup | Expected values at every step | No importance sampling required |
| Uncorrected n-step Q-learning | Max over actions of Q | Ignores policy mismatch, introduces bias |
Off-policy correction is the hardest part. Importance sampling ratios multiply across the n steps, so their variance can explode when the behavior and target policies differ. Many practical deep reinforcement learning systems with experience replay therefore use uncorrected n-step returns with small n, accepting a modest bias in exchange for faster credit assignment.
Relationship to eligibility traces and TD(λ)
N-step bootstrapping is the conceptual building block of TD(λ). The λ-return is a weighted average of all n-step returns, with weights proportional to λ raised to the power n minus 1, so it blends short and long horizons instead of committing to one.
Eligibility traces implement this average incrementally and online, without storing the last n transitions. The n-step forward view is easier to reason about and to implement with replay buffers, while the trace-based backward view is more memory-efficient for linear function approximation. Generalized advantage estimation applies the same λ-weighting to advantage estimates in policy gradient methods.
Practical use in deep reinforcement learning
Modern agents use n-step targets mainly to speed up credit assignment when rewards arrive several steps after the responsible actions. Implementations keep a rolling buffer of the last n transitions, compute the target when the buffer fills, and flush shorter returns at episode end.
- Actor-critic agents such as A3C and A2C typically roll out 5 to 20 steps before each update.
- Rainbow DQN and related value-based agents commonly use n equal to 3.
- Recurrent distributed agents often pair n-step returns with longer replay sequences.
- Discount compounding requires using γ to the power n on the bootstrap term, a frequent implementation bug when omitted.
Common errors include bootstrapping across episode boundaries, forgetting to stop at terminal states, and mixing truncation by a time limit with true termination. A time-limit cutoff should still bootstrap from the final state, while a genuine terminal state should not.
The short version
Think of guessing your arrival time on a road trip. You can trust only your map from the start. Or you can drive the whole way and then know for sure. N-step bootstrapping is the middle path: drive a few miles, see how it went, then use the map for the rest.
A learning agent does the same. It looks at a few real rewards and then trusts its own estimate for what comes after. Choosing how many real steps to use is the key decision. Fewer steps give steadier but more biased guesses. More steps give more accurate but noisier ones.
Where it makes a difference
A robotics team trains a simulated arm to stack blocks. The agent receives a reward only when a block lands securely, usually eight to twelve actions after the grasp that made success possible. With one-step Q-learning, that reward creeps backward one state per update, and early training shows almost no progress for many thousands of episodes.
The team switches the value network to five-step returns with a discount factor of 0.99, while keeping the replay buffer and network unchanged. Each successful placement now updates values five states back in one step, so the grasping actions receive credit much sooner. In their runs, the success rate passes 50 percent in roughly a third of the earlier training time. Raising n to 20 makes learning noisier, so the team settles on n equal to 5 as the best balance.