Write the Q-learning update. With , , , reward and , compute the new . Why is Q-learning called off-policy?
Reinforcement learning, Temporal-difference learning
Level L2 Elementary. Length Short. Nature Th+Mat Both.
What's being asked
Whether you can write the TD target correctly, plug in numbers, and explain what off-policy means.
Key idea
. The target uses the greedy action at , whatever action the behaviour policy actually takes next, so the agent learns while it explores.
Steps
- Write the update. Here is the learning rate (how big a step to take) and is the discount factor. Name the TD target , which is a one-step guess of the true value, and the TD error , which says how wrong the current estimate was.
- Target: .
- TD error: . New value: .
- Off-policy: the data can come from an -greedy (or any sufficiently exploratory) behaviour policy, while the target policy being learned is the greedy one. That is why Q-learning can reuse old transitions from a replay buffer.
- Contrast with SARSA in one line: its target uses the action actually taken next, so it is on-policy.
Common mistakes
- Reporting as the new value and forgetting the old estimate. The change is , so the new value is .
- Using at the current state instead of at the next state.
- Saying off-policy means "no policy". There are two policies: the behaviour policy that collects data and the target policy being learned.
How long your answer should be
The update rule, a two-line computation, and two sentences on off-policy.
Last checked on 4 December 2026.
Read this
- Sutton and Barto, Reinforcement Learning: An Introduction (2nd ed.), Section 6.5: Free PDF. Section 6.5, Q-learning: Off-policy TD Control (pp. 131–132): the update rule, pseudocode, and why the max target makes it off-policy.
- David Silver, UCL RL Course, Lecture 5: Model-Free Control: Slides 31–37: behaviour versus target policy, and how Q-learning’s greedy target follows from that split.
- NPTEL: Reinforcement Learning (IIT Madras, Prof. Balaraman Ravindran): Week 6, Q-Learning, which covers the update rule and why it is off-policy.
Previous in Reinforcement learning: A deterministic MDP has two states, A and B, and . In A you can "stay" (reward 1, remain in A) or "go" (reward 0, move to B). In B the only action is "stay" (reward 2, remain in B). Starting from , what are the values after three iterations of value iteration, and what are and the optimal policy?
Next in Reinforcement learning: An episode gives rewards , , , and then ends. With , compute the returns . Which recursion lets you compute them quickly?