Introduction to n-Step TD Methods
For a five-step method, the relevant update is delayed by five time steps when five future steps are available.
A Deliberate Middle Ground
When a learner estimates the value of a state, it must decide how much future experience to use. A one-step TD method uses the next event quickly. A Monte Carlo method waits for the return through the end of the episode. An n-step TD method chooses an intermediate amount of lookahead: it uses the next n rewards, states, and actions, then estimates what comes after them. This makes n-step methods a middle ground based on intermediate bootstrapping.
The central design choice is n. Increasing n means using more observed future rewards before relying on a value estimate for the remaining future.
Building the n-Step Return
The full return for a state at time t is the complete discounted reward sequence from time t through the end of the episode. An n-step return truncates that sequence after n steps. The first n rewards are included explicitly because the learner has observed them. The value estimate for the state reached after those n steps represents the missing later terms. That estimate is discounted by γ^n, so the later portion contributes less according to the same discounting position it would have in the return.
Separating observed and estimated parts
A learner is evaluating the state at time t with a three-step return.
- 1Observe three rewards
The learner follows the experience through the next three time steps and records the rewards encountered at t+1, t+2, and t+3.
- 2Stop the explicit sequence
The n-step return stops adding directly observed rewards after the third step.
- 3Use the boundary estimate
The value estimate for the state reached at t+3 represents the later reward terms that have not been included explicitly. Its contribution is discounted by γ^3.
The three-step return is an approximation to the full return: it contains three explicit rewards followed by a discounted estimate of the remaining future.
Following One State Forward
Consider the state occupied at time t. An n-step method must follow the experience far enough to collect the next n rewards, states, and actions. Only when those required future events are available can the estimate for the earlier state be updated. The result is a delay of n time steps between the earlier state and its update, except when the episode terminates sooner.
State at time t is reached. No future sequence is available yet.
The update is pending.
The next n rewards, states, and actions are available. The estimate for the state at time t can now be updated.
The n-step return can be formed.
Near episode termination, the learner may not have n future steps available. In that case, the episode ends before the planned lookahead is complete, so the available reward sequence reaches termination sooner. The n-step return then contains the complete remaining sequence rather than waiting for nonexistent future steps.
The Full-Return Boundary
An n-step return equals the ordinary full return when the episode terminates within the chosen n-step lookahead. There are no later terms left to estimate beyond the point of termination. The return therefore includes the entire remaining discounted reward sequence, making the bootstrapped replacement unnecessary.
Termination before the lookahead limit
Suppose the selected n is larger than the number of remaining steps in the episode.
- 1Start at time t
The learner begins forming an n-step return for the state at time t.
- 2Reach termination early
The episode ends before n future steps have passed.
- 3Use every remaining reward
Because the episode has ended, the return contains the complete remaining discounted reward sequence. There are no later terms requiring a value estimate.
The n-step return is equal to the ordinary full return whenever termination occurs within the chosen lookahead.
Choosing the Amount of Lookahead
The position of an n-step method can be understood by comparing how much it observes with how much it bootstraps. A one-step method uses the next event and therefore updates with a short lookahead. A Monte Carlo method uses the full return through episode termination and does not need the same intermediate cutoff. An n-step method uses more than one immediate event but stops before the full return when the episode continues beyond n steps.
| Approach | Future information used | Bootstrapping position | Update timing |
|---|---|---|---|
| One-step TD | The next event | Uses a short-step value estimate | Can use the next event quickly |
| n-step TD | The next n rewards, states, and actions | Uses a value estimate after those n steps | Waits n future steps, unless termination occurs sooner |
| Monte Carlo | The complete return through episode termination | Does not stop at an intermediate n-step boundary | Waits for the longer return |
The table shows the conceptual position of n-step methods between short-lookahead TD methods and full-return methods.
Resource Costs of Waiting
Looking farther ahead has practical costs. Updates are delayed because the method must wait for n future time steps. Each time step requires more computation than the earlier methods discussed in the chapter because the method handles a longer sequence. An implementation also needs more memory than a one-step method to retain states, actions, rewards, and sometimes other variables from the last n time steps.
- Update delay: the estimate for an earlier state waits for the required future steps.
- Computation: each time step involves more work than the earlier one-step methods discussed in the chapter.
- Memory: recent states, actions, rewards, and sometimes other variables must be retained for the last n time steps.
Eligibility Traces Later
Eligibility traces are presented as a later way to implement multi-step TD methods. Their role is to connect recent states to later rewards so that multiple prior states can be updated. This addresses the storage and computation challenge created by explicitly retaining a recent sequence for multi-step learning. The source also notes that eligibility traces do not remove every cost: some additional computation beyond one-step methods remains. The detailed treatment belongs to a later chapter, so the key connection here is that eligibility traces offer a more resource-efficient implementation approach.
Check Your Understanding
A learner uses a four-step TD method to evaluate a state at time t. The episode continues beyond t+4. Identify which part of the return is observed directly, which part is represented by a value estimate, when the update can occur, and why the method is neither a one-step TD method nor a full-return Monte Carlo method.
Hints
- Count the four future rewards beginning after time t.
- The value estimate is associated with the state reached after the fourth step.
- The update waits until the required future experience is available.
- Compare the four-step boundary with the immediate boundary of one-step TD and the episode-ending boundary of Monte Carlo.
Common mistake Treating the n-step return as a completely different target from the full return.
What it looks likeAssuming that an n-step method ignores the later reward sequence.
Why it failsThe n-step return approximates the full return. It includes the first n observed rewards and uses a value estimate to represent the missing later terms.
Do this insteadThink of the n-step return as a truncated full return completed by bootstrapping.
Common mistake Assuming that every n-step return always uses exactly n rewards.
What it looks likeExpecting four explicit rewards even when the episode ends after two remaining steps.
Why it failsNear termination, the episode may end before n future steps are available.
Do this insteadUse the complete remaining reward sequence when termination occurs within the selected lookahead.
Common mistake Forgetting the update delay.
What it looks likeTrying to update the state at time t immediately when a four-step method has only observed the next event.
Why it failsThe method needs the required future rewards, states, and actions before forming the four-step return.
Do this insteadExpect the update after four future steps when those steps exist, with earlier termination handled separately.
Common mistake Calling n-step TD a Monte Carlo method because it uses several rewards.
What it looks likeConcluding that any method using more than one reward must wait for episode termination.
Why it failsn-step TD stops after n steps and uses a value estimate for the remaining future when the episode continues.
Do this insteadClassify the method by its intermediate bootstrapping boundary, not merely by the number of observed rewards.
Key Takeaways
- 1The full return contains the complete discounted reward sequence through episode termination.
- 2An n-step return includes the next n observed rewards and uses a value estimate at the n-step boundary for the missing later terms, discounted by γ^n.
- 3If the episode terminates within n steps, the n-step return includes the entire remaining sequence and equals the ordinary full return.
- 4N-step methods sit between one-step TD and Monte Carlo methods because they use intermediate bootstrapping.
- 5Looking ahead n steps delays updates and increases computation and memory requirements; eligibility traces are a later, more resource-efficient implementation approach for multi-step TD methods.
At a glance
- The full return follows discounted rewards all the way to episode termination.
- The n-step return explicitly observes n rewards, then bootstraps from a value estimate for the later terms.
- Termination before n steps makes the n-step return equal to the full return.
- N-step TD methods trade additional lookahead, computation, memory, and update delay for a position between one-step TD and Monte Carlo methods.
- Eligibility traces later provide a more resource-efficient way to implement multi-step TD learning.