This lecture covers Q-learning fundamentals from tabular dynamic programming to deep Q-learning, including the bias-variance tradeoff, stabilization techniques, and solutions to Q-value overestimation.
Define and distinguish between value functions, Q-functions, and advantage functions in the context of MDPs
Derive the Bellman equation for optimal Q-values and implement iterative dynamic programming updates for tabular environments
Explain the fundamental bias-variance tradeoff between Monte Carlo rollouts and TD learning
Design parametric Q-function architectures for both discrete and continuous action spaces
Implement core stabilization techniques for deep Q-learning including target networks, gradient clipping, and Huber loss
Describe the Q-value overestimation problem caused by the max operation and explain how double Q-learning and critic ensembling solve it
Design and use replay buffers to break temporal correlations and improve sample efficiency in Q-learning
"A Q value function allows you to trade-off that variance for bias and is another way to deal with specific environment configurations."
"The main distinction between Monte Carlo and TD is that Monte Carlo has no bias but high variance, while TD introduces bias from the value function but significantly reduces variance."
"One of the most powerful properties of dynamic programming is stitching: you can combine partial trajectories to find the optimal path even if you never saw the full trajectory during training."
"Even zero-mean noise in Q-value estimates becomes positively biased after the max operation, leading to systematic overestimation that compounds through iterative updates."
"Replay buffers break temporal correlations in your data and prevent recency bias, allowing the agent to reuse past experience and dramatically improve sample efficiency."
A set of states S
A set of actions A
Transition dynamics \(P(s' | s, a)\) that define the probability of moving to state \(s'\) after taking action a in state s
A reward function \(R(s, a)\) that provides immediate feedback
A discount factor \(\gamma \in [0, 1]\) that prioritizes immediate rewards over distant future rewards
Value function \(V^\pi(s)\): The expected total discounted reward starting from state s and following policy \(\pi\)
Q-function \(Q^\pi(s, a)\): The expected total discounted reward starting from state s, taking action a, and then following policy \(\pi\)
Advantage function \(A^\pi(s, a)\): The relative advantage of taking action a compared to the average action under policy \(\pi\), defined as \(A^\pi(s, a) = Q^\pi(s, a) - V^\pi(s)\)
\(V^\pi(s) = \mathbb{E}_{a \sim \pi(\cdot|s)} [Q^\pi(s, a)]\)
For the optimal policy \(\pi^*\), the advantage of the optimal action is zero, and all other actions have non-positive advantage
Initialize \(Q_0(s, a) = 0\) for all state-action pairs
For terminal states, set \(Q(s, a) = R(s, a)\) for all actions
Iteratively apply the Bellman update to propagate value backward from terminal states to all other states
Continue until the Q-function converges to within a small threshold
Discrete action spaces: The network takes a state as input and outputs a vector of Q-values, one for each possible action. This allows exact maximization over actions.
Continuous action spaces: The network takes both a state and an action as input and outputs a single scalar Q-value. Maximization requires sampling actions from the policy.
Advantages: Unbiased estimate of the true return
Disadvantages: Very high variance due to the long horizon of random transitions and rewards
Advantages: Extremely low variance because it only depends on one step of experience
Disadvantages: Biased because the value function \(V(s_{t+1})\) is itself an estimate and may be inaccurate
Online network: The network being actively trained, used to predict \(Q(s_t, a_t)\)
Target network: A delayed copy of the online network, used to predict the target \(Q(s_{t+1}, a_{t+1})\)
Hard update: Copy the online network weights to the target network every N steps
Soft update (Polyak averaging): Slowly interpolate the target network weights toward the online network weights at every step: \(\theta' \leftarrow \tau \theta + (1-\tau) \theta'\), typically with \(\tau \approx 0.001\)
Gradient clipping: Limit the maximum norm of the gradient vector to prevent catastrophic parameter updates
Huber loss: A combination of L1 and L2 loss that behaves like L2 loss near the optimum (for fine-grained adjustments) and like L1 loss for large errors (to reduce sensitivity to outliers)
Breaks temporal correlations in the training data, which is essential for training neural networks
Prevents recency bias by ensuring the agent learns from both recent and distant past experience
Dramatically improves sample efficiency by reusing experience multiple times
Double Q-learning: Use two separate Q-networks. One network selects the action, and the other network evaluates the value of that action. This decorrelates the selection and evaluation steps, eliminating the overestimation bias.
Critic ensembling: Train an ensemble of Q-networks and use the minimum value across the ensemble as the target. This produces a conservative underestimate of the true Q-value, which is particularly effective in offline RL settings where distribution shift is a major concern.
These are my structured study notes and in-depth interpretations compiled by watching the open course. I hope this knowledge framework helps you thoroughly master the content of this subject. Wish you continuous academic progress and great achievements in your studies.

