Q-Learning
Off-policy model-free temporal difference control for learning optimal action values.
Q-Learning Mechanics
Q-Learning maintains a table (or function approximator) storing expected cumulative return for taking action in state .
Q-LEARNING ITERATION LOOP
1. Observe State s
2. Select Action a using ε-Greedy (Exploration vs Exploitation)
3. Execute Action a ──► Observe Reward r and Next State s'
4. Compute TD Target: Target = r + γ max_{a'} Q(s', a')
5. Compute TD Error: δ = Target - Q(s, a)
6. Update Q Table: Q(s, a) ← Q(s, a) + α · δ
The Single-Step Update Formula
- : Learning rate.
- : Discount factor.
- : Greedy Off-Policy Target (Assumes optimal action will be chosen in ).
Exploration vs Exploitation (-Greedy Policy)
To avoid getting trapped in local sub-optimal actions, actions are selected via -greedy:
Typically, decay over training iterations.
Convergence Proof
Watkins & Dayan (1992) proved that Tabular Q-Learning converges to optimal action-values with probability 1 if:
- All state-action pairs are visited infinitely often.
- Learning rate satisfies Robbins-Monro conditions: and .
Say this out loud
"Q-Learning is a model-free, off-policy TD control algorithm. It updates action values using Q(s,a) ← Q(s,a) + α [r + γ max_{a'} Q(s',a') - Q(s,a)]. It is off-policy because it uses a greedy max target max_{a'} Q(s',a') to evaluate optimal behavior while executing an ε-greedy behavior policy for exploration."
Follow-ups to expect
- What is Overestimation Bias in Q-Learning? The operator uses noisy Q estimates, systematically overestimating action values. Solved by Double Q-Learning (Double DQN).
- What happens when state space S is continuous? Tabular Q-tables crash due to infinite states. Replace the lookup table with a Deep Neural Network , deriving Deep Q-Networks (DQN).
Check yourself
What is the single-step Q-Learning update rule for updating Q(s, a) given sample experience (s, a, r, s')?