Deep Reinforcement Learning

Neural networks as value functions and policies: DQN, policy gradients, actor-critic methods and PPO.

Advanced · about 12 hours · difficulty 5/5

Learn first: Reinforcement Learning Fundamentals, Debugging and Running Training Experiments

Tabular methods break down when states are images or continuous vectors. Deep RL replaces the table with a neural network that generalizes across states.

Value-based: DQN

A Deep Q-Network approximates Q(s, a). Two tricks made it stable: an experience replay buffer that breaks correlation between consecutive samples, and a slowly updated target network. Extensions include Double DQN, dueling heads and prioritized replay.

Policy-based methods

  • Policy gradients (REINFORCE) directly adjust action probabilities in the direction that increases return. Simple but high variance.
  • Actor-critic methods (A2C, A3C) add a learned value function (the critic) as a baseline to reduce variance.
  • PPO clips each policy update so it cannot move too far, making training robust. It is the default algorithm in many libraries and was used in RLHF for language models.
  • SAC and TD3 handle continuous action spaces such as robot joints.

Practical realities

Deep RL is notoriously sensitive to hyperparameters, random seeds and reward design. Agents exploit poorly specified rewards in surprising ways (reward hacking). Run several seeds, log episode returns, and use tested implementations from Stable-Baselines3 or CleanRL before writing your own.

Where it is used

Games, robotics and simulation, recommendation and bidding systems, chip design, and aligning language models with human preferences.

Good enough to move on when you can train PPO and DQN on standard environments, compare them across seeds, and explain why experience replay stabilizes DQN.

Key concepts

  • Deep Q-Networks (DQN)
  • Experience replay and target networks
  • Policy gradients (REINFORCE)
  • Actor-critic methods
  • PPO
  • SAC for continuous control
  • Reward design and reward hacking
  • Stable-Baselines3

Mini project

Train DQN and PPO on CartPole and LunarLander with Stable-Baselines3 across three seeds, plot mean and spread of returns, then implement REINFORCE yourself on CartPole and compare its variance.

Check yourself

Why does subtracting a baseline (the critic) reduce the variance of policy gradient estimates without biasing them?

Free resources