In state the agent takes action with , gets reward and lands in , where and . The -greedy policy then picks the exploratory action . With and , compute the new under SARSA and under Q-learning. Why do they differ?
Reinforcement learning, Temporal-difference learning
Level L2 Elementary. Length Short. Nature Mat Mathematical.
What's being asked
Whether you know that SARSA's target uses the next action actually taken, while Q-learning's uses the best next action.
Key idea
SARSA is on-policy: , with the action actually chosen. Q-learning replaces by .
Steps
- SARSA target: , because was the action chosen.
- SARSA update: .
- Q-learning target: .
- Q-learning update: .
- Explain the difference. SARSA evaluates the exploring policy it is following, so exploratory slips lower its values. Q-learning evaluates the greedy policy, ignoring what the behaviour policy does next.
Common mistakes
- Using in SARSA, or the taken action in Q-learning. This is the main exam trap.
- Concluding that one is always better. Q-learning finds the optimal greedy policy, while SARSA finds the best -greedy policy, which is safer when exploration is costly.
- Expecting the two updates to differ on every transition. They coincide whenever the sampled next action is the greedy one, which would be here.
How long your answer should be
5–6 lines.
Last checked on 4 December 2026.
Read this
Previous in Reinforcement learning: In TD(0), the current estimate is . The agent moves from to with reward , and . With and , what are the TD target, the TD error and the updated ?
Next in Reinforcement learning: A corridor has three non-terminal cells 1, 2, 3 in a row, with a terminal cell L to the left of cell 1 and a terminal cell R to the right of cell 3. The policy moves left or right with probability each. Moving into R gives reward , and every other move gives reward . With and , compute (synchronous sweeps) for cells 1, 2, 3. What do the values converge to?