The update rule
- : the learning rate.
- : the target, what the value should have been.
- The bracket: the temporal difference error.
The estimate moves a fraction of the way towards a better estimate built from one real reward and the current guess about the future.
Nothing waits for the episode to end. Each transition updates immediately, which is what bootstrapping means and why it is sample efficient.
Why it is off-policy
The target uses the best action from the next state, regardless of what the agent actually did there.
So the agent can behave exploratorily, even randomly, and still learn the value of the optimal policy, which is the property that makes replay buffers and learning from logged data possible.
SARSA uses the action actually taken instead, which makes it on-policy and gives it different, more cautious behaviour near cliffs.
One episode, in order
- Observe the state.
- Choose an action by epsilon-greedy on the current .
- Execute it, and receive the reward and the next state.
- Compute the temporal difference error and update that one entry.
- Move to the next state, and repeat until the episode ends.
converges to if every pair is visited infinitely often and decays.
The convergence guarantee is real and its conditions are demanding, and it holds only for a lookup table.
Deep Q-learning, and the two fixes it needed
Replacing the table with a network makes the target depend on the same weights being updated, so the target moves as fast as the estimate and training oscillates.
A target network holds a frozen copy of the weights for a few thousand steps, which stabilises the regression by holding still.
The second fix, a replay buffer, stores past transitions and samples them at random.
That breaks the correlation between consecutive samples, which would otherwise violate every assumption in stochastic gradient descent.
The bias nobody removes for free
Taking a maximum over noisy estimates is biased upward, so Q-learning systematically overestimates values, and the error compounds through bootstrapping.
Double Q-learning selects the action with one network and evaluates it with the other, which decorrelates the two roles and removes most of the bias for almost no cost.
That fix, the target network and the replay buffer are the three things that turned a tabular algorithm from 1989 into something that plays Atari.