Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Reinforcement Learning

This section covers Reinforcement Learning (RL) from fundamentals to cutting-edge techniques used in training Large Language Models (LLMs).

Topics Covered

TopicDescriptionRelevance
FundamentalsCore RL concepts: MDP, rewards, policiesFoundation
Q-LearningValue-based RL with Q-tables and DQNClassic algorithms
Policy GradientDirectly optimize the policyREINFORCE, actor-critic
PPOProximal Policy OptimizationStable policy updates
RLHFRL from Human FeedbackLLM alignment
DPODirect Preference OptimizationSimpler alignment
GRPOGroup Relative Policy OptimizationLLM reasoning (DeepSeek-R1)

The RL Landscape for LLMs

graph TD
    A[RL for LLMs] --> B[Alignment Phase]
    A --> C[Reasoning Phase]
    
    B --> D[RLHF - PPO + Reward Model]
    B --> E[DPO - No RL, Direct Optimization]
    B --> F[Other: KTO, IPO, ORPO]
    
    C --> G[RLVR - Verifiable Rewards]
    G --> H[GRPO - No Critic, Group Comparison]
    G --> I[PPO - With Critic Network]

Evolution of RL in LLMs

YearMethodKey InnovationUsed By
2017PPOStable policy optimizationInstructGPT, ChatGPT
2022RLHFHuman preferences as reward signalChatGPT, Claude
2023DPOEliminate reward model entirelyLlama 2, Zephyr
2024GRPONo critic, group-relative rewardsDeepSeek-R1
2024RLVRVerifiable rewards for reasoningDeepSeek-R1, Qwen

Why RL Matters for LLMs

  1. Alignment: Make models helpful, harmless, and honest
  2. Reasoning: Train models to think step-by-step (chain-of-thought)
  3. Tool Use: Learn when and how to use external tools
  4. Safety: Reduce harmful outputs and hallucinations

Understanding RL is essential for anyone working on modern LLM training pipelines.

Cross-References