Q-Learning

Learning Action Values from Experience

Q-Learning learns Q(s, a) — the expected cumulative reward of taking action a in state s. Once learned, the optimal policy is trivial: always take the action with the highest Q-value. It is the foundational value-based RL algorithm.

The Q-Learning Update

Bellman-based iterative improvement

After each (s, a, r, s') transition:
Q(s, a) ← Q(s, a) + α · [r + γ · max Q(s', a') − Q(s, a)]

The bracketed term is the TD error — how far the current estimate is from the Bellman target. Each update moves Q(s, a) slightly toward what it should be. Repeat over millions of transitions → converges to optimal Q-function.

From Tabular to DQN

Tabular Q-Learning

Stores one Q-value per (state, action) pair in a table. Provably converges. Works only for small discrete state spaces. Doesn't scale — Atari has far too many possible states to enumerate.

DQN (Deep Q-Network)

Replaces the table with a neural network Q(s, a; θ). Two key innovations: experience replay (random mini-batches from a replay buffer — breaks temporal correlation) and a target network (separate slowly-updated copy for computing Bellman targets — prevents instability).

Need Help?

Ask the AI assistant about Q-learning, the Bellman equation, TD error, or how DQN extended tabular Q-learning to large state spaces.