# Deep Reinforcement Learning

> Neural networks as value functions and policies: DQN, policy gradients, actor-critic methods and PPO. Free notes, key concepts, resources and a mini project.

Canonical: https://www.internhack.in/roadmaps/tracks/machine-learning/deep-reinforcement-learning
Last updated: 2026-11-28

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](https://www.internhack.in/roadmaps/tracks/machine-learning/reinforcement-learning-basics), [Debugging and Running Training Experiments](https://www.internhack.in/roadmaps/tracks/machine-learning/training-debugging)

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

- [OpenAI Spinning Up in Deep RL](https://spinningup.openai.com/) (OpenAI)
- [Stable-Baselines3 documentation](https://stable-baselines3.readthedocs.io/) (Stable-Baselines3)
- [Hugging Face Learn](https://huggingface.co/learn) (Hugging Face)

Previous: [Reinforcement Learning Fundamentals](https://www.internhack.in/roadmaps/tracks/machine-learning/reinforcement-learning-basics) · Next: [From Notebook to Production Code](https://www.internhack.in/roadmaps/tracks/machine-learning/notebook-to-production-code)

## More in Recommenders, Time Series and Reinforcement Learning

- [Recommender Systems](https://www.internhack.in/roadmaps/tracks/machine-learning/recommender-systems)
- [Time Series Forecasting](https://www.internhack.in/roadmaps/tracks/machine-learning/time-series-forecasting)
- [Reinforcement Learning Fundamentals](https://www.internhack.in/roadmaps/tracks/machine-learning/reinforcement-learning-basics)
- [Deep Reinforcement Learning](https://www.internhack.in/roadmaps/tracks/machine-learning/deep-reinforcement-learning)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Machine Learning Engineer Roadmap](https://www.internhack.in/roadmaps/tracks/machine-learning)
