← Writing & notes

FROM THE NOTEBOOK

Reinforcement Learning - Stanford CS234

Stanford CS234 I Reinforcement Learning I Spring 2024 I Emma Brunskill - YouTube
This course provides a comprehensive exploration of Reinforcement Learning (RL), the science of training agents to make optimal decisions through environmental interaction to maximize cumulative reward. The curriculum follows a structured progression, beginning with the foundational mathematical framework of Markov Decision Processes (MDPs) and the classical "planning" algorithms of Value and Policy Iteration, which solve for optimal behavior when a perfect model of the environment is known.
The course then transitions to the core "learning" problem, where the agent must learn in a model-free setting through trial and error. This introduces the fundamental exploration-exploitation dilemma. Two primary families of algorithms are developed in detail:

  1. Value-Based Methods, which focus on learning the value of states and actions. This line of inquiry culminates in Q-Learning and its deep learning extension, Deep Q-Networks (DQN), famous for mastering Atari games from pixel inputs.
  2. Policy-Based Methods, which directly learn a parameterized policy. This thread begins with the REINFORCE algorithm, introduces the Policy Gradient Theorem, and evolves into more stable and powerful Actor-Critic methods and the state-of-the-art Proximal Policy Optimization (PPO).

Building on these core online learning paradigms, the course addresses the practical challenge of learning from existing data. This includes Imitation Learning, where an agent learns from expert demonstrations through techniques like Behavior Cloning and overcomes its limitations with interactive methods like DAGGER. The more general problem of learning from a static, pre-existing dataset is tackled in Offline RL, highlighting the critical challenge of distribution shift and the principle of pessimism to ensure safe and reliable policy improvement.
A significant portion of the course is dedicated to the modern alignment techniques that power today's large language models. This begins with Inverse Reinforcement Learning (IRL), specifically Max Entropy IRL, as a method for inferring an expert's reward function. This leads directly to the contemporary framework of Reinforcement Learning from Human Feedback (RLHF), where a reward model is trained on human preferences and optimized with PPO. The course covers the latest advancements, such as Direct Preference Optimization (DPO), a more direct and efficient method that bypasses the explicit reward modeling stage.
Finally, the course synthesizes these concepts by examining advanced methods for efficient exploration and planning. It formalizes the exploration problem using Multi-Armed Bandits, introducing the concept of regret minimization and key algorithms like Upper Confidence Bounds (UCB) and Thompson Sampling. The grand finale showcases the integration of deep learning with powerful search techniques in the form of Monte Carlo Tree Search (MCTS), the engine behind the historic achievements of AlphaGo and AlphaZero. The course concludes with a critical discussion on Value Alignment, examining the normative and philosophical challenges of defining the very reward signals we ask our agents to optimize, ensuring the development of safe and beneficial AI.

L1: Introduction

The lecture begins with Professor Emma Brunskill welcoming students to CS234, a course on Reinforcement Learning. She defines reinforcement learning as an automated agent learning to make good decisions through experience. This simple statement, she explains, encompasses complex and challenging concepts that have been a focus of research for over a decade.
Why Study Reinforcement Learning?
Two primary motivations for studying reinforcement learning are presented:

  1. A Core Component of Intelligence: The ability to make decisions is fundamental to general artificial intelligence. While perceptual machine learning (e.g., image recognition) has seen enormous progress, intelligence also requires acting on perceptions. The challenge of learning to make good decisions under uncertainty has been a central question since the 1950s, pioneered by Richard Bellman.
  2. Practical Applications and Successes: Over the last decade, reinforcement learning has achieved unprecedented performance in various important domains.

Key Success Stories:

The Rise and Skepticism of Reinforcement Learning
Professor Brunskill highlights the exponential growth in reinforcement learning research, as evidenced by the increasing number of published papers, especially after successes with Atari video games and AlphaGo. However, she also introduces a skeptical viewpoint from Yann LeCun, a Turing Award winner, who in 2016 famously described machine learning as a cake. In his analogy:

Core Concepts of Reinforcement Learning
The lecture identifies four defining elements of reinforcement learning:

  1. Optimization: The goal is to find the best way to make decisions, which requires an explicit notion of utility or reward to compare different solutions.
  2. Delayed Consequences: Actions taken now can have significant effects much later. This presents challenges in both planning (figuring out the optimal sequence of actions) and learning (attributing a later outcome to a specific earlier action, known as the temporal credit assignment problem).
  3. Exploration: The agent learns about the world only through its own experiences. This means it only gets data for the actions it tries, creating a "censored information" problem. It must balance exploring new actions to gather information with exploiting known good actions.
  4. Generalization: In complex, large-scale problems (like video games with a vast number of possible screen states), it's impossible to have a pre-programmed response for every scenario. The agent must generalize from its experiences to make good decisions in new situations, often using tools like deep neural networks.

Reinforcement Learning vs. Other AI Fields
The lecture contrasts reinforcement learning with related areas:

Course Logistics and Structure
The course aims to equip students with the ability to define key RL features, formulate problems, implement common algorithms, and evaluate their quality. The main topics include:

The professor emphasizes the importance of active learning ("engage practice")—such as working on homework, problems, and the final project—over passive activities like re-watching lectures.
Formulating a Reinforcement Learning Problem: The AI Tutor
An interactive exercise challenged students to formulate an AI tutoring system as an RL problem. The agent's goal is to teach a student addition and subtraction by providing practice problems, receiving a +1 reward for a correct answer and -1 for an incorrect one.
Key discussion points from the students included:

Sequential Decision-Making Formalism
The lecture formally introduces the sequential decision-making framework:

The Markov Assumption: A core simplifying assumption is that the future is independent of the past, given the present. This means the current state is a sufficient statistic of the entire history. This allows the agent to make decisions based only on the current state, rather than needing to process everything that has ever happened.
Key Definitions:

The lecture concludes by introducing Markov Reward Processes (MRPs)—which are like MDPs but without actions—as a stepping stone to understanding policy evaluation. It also defines the return as the discounted sum of future rewards and the value function as the expected return from a given state. The discount factor (γ) is introduced as a mechanism to prioritize immediate rewards over distant future ones and to ensure that infinite sums of rewards remain bounded.

L2: Tabular MDP Planning

The second lecture focuses on methods for finding optimal decision-making policies when a complete model of the environment (a Markov Decision Process, or MDP) is known. This is often referred to as planning.
1. Refresh Your Understanding & Clarifications

2. Rationale for Starting with Simple, Tabular Models
The lecture explains that starting with small, discrete environments like the "seven-state Mars rover" is crucial. These simple cases make it easier to understand the fundamental concepts of decision processes. These core ideas are the building blocks for the advanced, state-of-the-art algorithms used to solve complex problems like controlling robots, optimizing Large Language Models (LLMs) with RLHF, and mastering games like Go.
3. From Markov Reward Processes (MRPs) to MDPs

4. Policy Evaluation: How Good is a Given Policy?
A key insight is that an MDP combined with a fixed policy (a rule for choosing actions in each state) simplifies into an MRP. This is because the policy removes the element of choice; for any given state, the dynamics and rewards become fixed averages based on the policy's action probabilities.
This allows us to use the same iterative dynamic programming approach from MRPs to solve for Vπ, the value function of a specific policy π. This process is known as policy evaluation.
5. Policy Iteration: Finding the Optimal Policy
Policy iteration is the first algorithm introduced that guarantees monotonic improvement. It's an iterative process that alternates between two steps:

  1. Policy Evaluation: Given the current policy, πᵢ, calculate its value function, Vπᵢ, until it converges.
  2. Policy Improvement: Use the calculated value function Vπᵢ to find a better policy, πᵢ₊₁. This is done by calculating the Q-function (or state-action value function), Qπᵢ(s, a), which represents the value of taking action a in state s and then following policy πᵢ forever after. The new, improved policy is then defined as the one that greedily chooses the action with the highest Q-value in each state.

This loop repeats. The Policy Improvement Theorem proves that the new policy is guaranteed to be better than or equal to the old one. Since there is a finite number of deterministic policies (|A|^|S|), and the algorithm never revisits a worse policy, policy iteration is guaranteed to converge to the optimal policy.
6. Value Iteration: An Alternative Approach
Value iteration is another fundamental dynamic programming algorithm for finding the optimal policy. It differs from policy iteration in its core philosophy:

The algorithm works by repeatedly applying the Bellman backup operator for the optimal value function. This update rule finds the value of a state by taking the maximum over all possible actions of the expected value from taking that action.
Vₖ₊₁(s) = maxₐ [ R(s,a) + γ Σ P(s'|s,a) Vₖ(s') ]
Each iteration k can be interpreted as finding the optimal value for a k-step decision problem.
7. Convergence of Value Iteration
The convergence of value iteration is guaranteed by the Contraction Mapping Theorem. The lecture provided a proof showing that the Bellman backup operator is a γ-contraction. This means that with each application of the operator, the maximum difference (L-infinity norm) between any two value function vectors is guaranteed to shrink by a factor of γ. Since γ < 1, repeated application of the operator will cause the value function to converge to a unique fixed point, which is the optimal value function, V*. Once V* is found, the optimal policy can be extracted by choosing the action that maximizes the expected future value from each state.
8. Concluding Concepts

L3: Policy Evaluation

The lecture transitions from "planning," where the agent has a perfect model of the world (an MDP), to "model-free learning," where the agent must learn the value of its actions through direct experience and interaction with the environment.
1. Refresh Your Understanding Poll
The lecture began with a poll reviewing concepts from the previous session on value iteration and policy iteration in the tabular (discrete state/action) setting.

2. Introduction to Model-Free Learning
The core of the lecture is model-free policy evaluation: determining the value of a fixed policy (Vπ) without knowing the environment's dynamics or reward models. The agent learns solely from episodes of experience, which are sequences of (state, action, reward, next_state) tuples.
3. Monte Carlo (MC) Policy Evaluation
Monte Carlo is the simplest approach to model-free evaluation.

4. Temporal Difference (TD) Learning
TD learning is presented as a central and novel idea in reinforcement learning, combining the sampling of Monte Carlo with the bootstrapping of Dynamic Programming.

5. Certainty Equivalence (Model-Based) Approaches
This method serves as a bridge between model-free and model-based techniques.

6. Batch Policy Evaluation: MC vs. TD
A key example was used to illustrate the fundamental difference between how MC and TD learn from a finite, fixed "batch" of data.

L4: Q Learning and Function Approximation

The lecture transitions from evaluating a known policy to actively learning the optimal policy without a model of the environment. It builds from simple, tabular (discrete state/action) methods up to the seminal Deep Q-Network (DQN) algorithm that learned to play Atari games from pixel inputs.
1. Introduction & "Check Your Understanding" Poll

2. The Challenge of Exploration vs. Exploitation
To learn an optimal policy, an agent faces a fundamental trade-off:

A simple yet effective strategy to balance this is epsilon-greedy (ε-greedy):

3. On-Policy Monte Carlo Control
This is the first model-free control algorithm discussed. It follows the pattern of generalized policy iteration (alternating evaluation and improvement).

4. Temporal Difference (TD) Control
TD methods update the Q-function after every single step, rather than waiting for the end of an episode like Monte Carlo. This makes them more suitable for continuous, non-episodic tasks.

5. Function Approximation
Tabular methods, which store a separate value for every state-action pair, are infeasible for problems with large or continuous state spaces (like Atari's pixel inputs). Function approximation (e.g., linear functions, deep neural networks) is used to generalize from seen states to unseen states.

6. Deep Q-Networks (DQN)
DQN successfully applied Q-learning with a deep convolutional neural network as the function approximator to play Atari games. This was challenging because combining Q-learning (which is off-policy and uses bootstrapping) with function approximation can be highly unstable. This instability is sometimes called The Deadly Triad.
DQN introduced two key innovations to achieve stability:

  1. Experience Replay: Instead of using transitions immediately for training, they are stored in a large buffer (e.g., the last million transitions). For each training step, a random mini-batch of transitions is sampled from this buffer. This has two benefits:
    • It breaks the strong temporal correlations between consecutive samples, making the data more like the independent and identically distributed (IID) data that SGD works best with.
    • It greatly improves sample efficiency by allowing each piece of experience to be reused multiple times.
  2. Fixed Q-Targets: The TD target (r + γ *max*ₐ' Q(s', a'; w)) creates a "moving target" problem because the weights w are updated at every step, which changes the target value itself. DQN solves this by using a separate target network with weights w⁻ to compute the target.
    • The main network (w) is updated via SGD at every step.
    • The target network (w⁻) is held fixed for many steps and is only periodically updated by copying the weights from the main network. This makes the training target much more stable.

An ablation study showed that while both techniques helped, Experience Replay provided the most significant performance boost, highlighting the critical importance of sample efficiency and breaking data correlations.

L5: Policy Search 1

The lecture shifts focus from value-based methods (like Q-learning), which learn a value function and derive a policy from it, to policy-based methods, which directly parameterize and optimize the policy itself.
1. "Refresh Your Understanding" Poll & Key Concepts
The lecture began by reviewing key concepts from the previous lectures on Q-learning and DQN.

2. Introduction to Policy Search
Instead of learning a value function, policy search methods define the policy as a parameterized function π(a|s; θ) (e.g., a neural network with weights θ) and search for the parameters θ that maximize a performance objective, J(θ) (e.g., the expected total reward).

3. Advantages of Policy-Based Methods
Policy-based methods offer several advantages over purely value-based approaches:

  1. Learning Stochastic Policies:
    • In some environments, the optimal policy is inherently stochastic. In the game of rock-paper-scissors, any deterministic policy is predictable and can be exploited. The optimal policy is a uniform random one.
    • In environments with partial observability or state aliasing (where different world states look identical to the agent), a stochastic policy can be superior. For example, if a robot cannot distinguish between two identical-looking junctions, the optimal strategy might be to randomly choose to go left or right to avoid getting stuck in a loop.
  2. Better Convergence Properties: Policy gradient methods often have smoother updates and are more likely to converge to a good (though potentially local) optimum, whereas value-based methods with function approximation can sometimes suffer from instabilities and oscillations.
  3. Effectiveness in High-Dimensional/Continuous Action Spaces: It is often easier to parameterize a policy that outputs actions in a continuous space (e.g., the torque for a robot joint) than it is to find the max over a continuous action space as required by Q-learning.

4. The Policy Gradient Theorem: Derivation
The core of the lecture was deriving a computable expression for the policy gradient, ∇_θ J(θ), which tells us how to change the policy parameters θ to improve performance.

  1. The Objective: The objective J(θ) is defined as the expected reward over all possible trajectories τ that can be generated by policy π_θ.
    J(θ) = E_τ[R(τ)] = Σ_τ P(τ; θ) R(τ)
  2. The Log-Derivative Trick: The key mathematical insight is the likelihood ratio or log-derivative trick. It allows the gradient to be rewritten as an expectation that can be estimated via sampling.
    ∇_θ J(θ) = E_τ[R(τ) * ∇_θ log P(τ; θ)]
  3. Simplification: The log probability of a trajectory, log P(τ; θ), is expanded. Crucially, the term related to the environment's dynamics P(s'|s, a) does not depend on the policy parameters θ, so it drops out of the gradient. This is a profound result: the policy gradient does not depend on the dynamics model of the environment, making it truly model-free. The final expression depends only on the policy itself:
    ∇_θ log P(τ; θ) = Σ_{t=0}^T ∇_θ log π_θ(a_t|s_t)

5. The REINFORCE Algorithm (Monte Carlo Policy Gradient)
The derived gradient leads to the REINFORCE algorithm, a foundational Monte Carlo policy gradient method.

6. Variance Reduction: Baselines
While REINFORCE is an unbiased estimator of the policy gradient, it suffers from very high variance because the Monte Carlo returns G_t can be noisy. A powerful technique to reduce this variance is to introduce a baseline.

L6: Policy Search 2

The lecture continues the exploration of policy gradient methods, moving from the foundational REINFORCE algorithm to more advanced, practical, and state-of-the-art techniques, culminating in Proximal Policy Optimization (PPO).
1. "Refresh Your Understanding" Poll & Review
The lecture started by reviewing key concepts about policy gradients from the previous session.

2. Proving the Baseline is Unbiased
The lecture provided a formal proof for why subtracting a state-dependent baseline b(s_t) does not introduce bias into the policy gradient estimate.

This elegant proof demonstrates that any function of the state can be used as a baseline without biasing the gradient, opening the door for effective variance reduction.
3. Actor-Critic Methods
A natural and effective choice for a baseline is the state-value function, V(s). This leads to actor-critic methods, which learn both a policy (the "actor") and a value function (the "critic") simultaneously.

4. Challenges with Vanilla Policy Gradients
Despite these improvements, vanilla policy gradient methods face significant challenges that limit their practical effectiveness:

  1. Poor Sample Efficiency: These methods are typically on-policy, meaning they can only use data generated from the current policy to compute the gradient. After taking a single gradient step, all the old data must be discarded, and new samples must be collected. This is extremely inefficient.
  2. Destructive Step Sizes: The choice of learning rate (step size) is critical and difficult.
    • Too large: A large step in parameter space (θ) can lead to a massive, destructive change in the policy distribution, causing performance to collapse. The agent might find itself in a region of the state space from which it cannot recover.
    • Too small: The agent learns too slowly.
    • The core issue is that distance in parameter space does not correspond well to distance in policy space. A small change in θ can cause a huge change in the action probabilities.

5. Towards Advanced Methods: Monotonic Improvement
The goal of advanced policy gradient methods is to address these challenges. The ideal algorithm would:

  1. Use each batch of data more efficiently, allowing for multiple update steps.
  2. Take the largest possible step that is guaranteed to improve the policy, preventing catastrophic performance collapse.

This led to the derivation of the Performance Difference Lemma, a key theoretical result that relates the performance of a new policy (π') to an old one (π). It shows that the improvement in performance is equal to the expected advantage of the new policy's actions, evaluated using the old policy's Q-function, and averaged over the state distribution of the new policy.
A local approximation allows this to be estimated using data from the old policy, but the quality of this approximation degrades as the new and old policies diverge. The divergence is measured by the KL Divergence, a measure of the difference between two probability distributions.
6. Proximal Policy Optimization (PPO)
PPO is a state-of-the-art algorithm that operationalizes these theoretical insights in a simple and effective way. It aims to maximize the policy improvement objective while constraining how much the policy is allowed to change. The most common variant of PPO uses a clipped objective function.

In essence, the clipping removes the incentive for the policy to change too drastically from the old policy, creating a "trust region" where the updates are more stable. This simplicity and robustness have made PPO one of the most widely used reinforcement learning algorithms.

L7: Policy Search 3

This lecture concludes the discussion on advanced policy gradient methods, focusing on the theoretical underpinnings of Proximal Policy Optimization (PPO), and then introduces a new paradigm: Imitation Learning.
1. "Refresh Your Understanding" Poll & Review
The lecture started with a poll reviewing key concepts of policy gradient methods:

2. Generalized Advantage Estimation (GAE)
The lecture introduced Generalized Advantage Estimation (GAE) as a sophisticated technique for estimating the advantage function, which is critical for the performance of actor-critic and policy gradient algorithms.

3. Monotonic Improvement Theory for PPO
The lecture revisited the core theoretical motivation for PPO. The goal is to take the largest possible step that is guaranteed to improve the policy.

4. Introduction to Imitation Learning
The lecture then shifted to a new topic: Imitation Learning, which attempts to reduce reinforcement learning to a simpler supervised learning problem.

L8: Offline RL 1

This lecture transitions from traditional reinforcement learning paradigms to methods that leverage human expertise and feedback, a critical component in training modern AI systems like large language models.
1. "Refresh Your Understanding" Poll & Review of Imitation Learning
The lecture began with a poll reviewing key concepts from imitation learning:

2. Motivation for RLHF and The Shift to Human Feedback
The lecture motivated the shift towards more direct forms of human feedback by highlighting the success of systems like ChatGPT. The ability of such models to generate complex, useful outputs (like runnable code for RLHF itself) is a recent breakthrough, largely enabled by techniques that go beyond simple imitation.

3. Max Entropy Inverse Reinforcement Learning (IRL)
This section provided a deep dive into a foundational IRL algorithm.

4. From IRL to Reinforcement Learning from Human Feedback (RLHF)
The lecture then transitioned from inferring rewards from full demonstrations to learning from a more direct and often simpler form of human feedback: pairwise preferences.

5. RLHF in Practice: Training LLMs
The lecture concluded by connecting this framework to the training of models like ChatGPT.

L9: Offline RL 2: DPO

This lecture, featuring guest speakers from the team that developed DPO, delves into the methods used to align Large Language Models (LLMs) with human preferences, moving from the complex RLHF pipeline to the more direct DPO approach.
1. Introduction & Motivation

2. Deep Dive into Reward Modeling

3. The Problem with the RLHF Pipeline

4. Direct Preference Optimization (DPO) - The Core Idea
The key insight of DPO is that the entire RLHF pipeline can be simplified into a single-stage, direct optimization problem on the preference data itself, bypassing the need for an explicit reward model and complex RL loops.

This loss can be optimized directly with SGD, just like supervised fine-tuning. It implicitly maximizes the reward while satisfying the KL constraint, all in one step.
5. DPO in Practice & The "Reward Hacking" Problem

6. The Future of Alignment
The lecture concluded by looking at the exciting future directions for alignment research:

L10: Offline RL 3

This lecture pivots from learning with online interaction (like in PPO) or from expert demonstrations (imitation learning) to the more general and practical problem of learning from a fixed, static dataset of past experience. This is known as offline reinforcement learning, batch RL, or counterfactual policy learning.
1. "Refresh Your Understanding" Poll & Review
The lecture started with a review of Reinforcement Learning from Human Feedback (RLHF) and Direct Preference Optimization (DPO).

2. Motivation: Can We Do Better Than Imitation?
The lecture motivated the need for offline RL by posing the question: "Can we learn a policy that is better than the one that generated the data?"

3. The Challenge of Offline RL: Distribution Mismatch
Offline RL is fundamentally challenging due to distribution mismatch. The policy we want to evaluate or learn (π_e, the evaluation policy) will induce a different distribution of states and actions than the policy that generated the data (π_b, the behavior policy).

4. Offline Policy Evaluation: How Good is a New Policy?
Before learning a new policy, a crucial first step is being able to evaluate a candidate policy using only the offline data.

5. Offline Policy Learning: Finding the Best New Policy
The ultimate goal is to learn a new, optimal policy from the offline data.

L11: Exploration 1

This lecture marks a shift in focus from learning from offline/past data to online learning, where the agent actively gathers data to learn as quickly and efficiently as possible. The central theme is sample efficiency, which is critical in real-world applications where data collection is expensive or risky (e.g., healthcare, education, robotics), in contrast to simulated environments where data is cheap.
1. "Refresh Your Understanding" Poll & Review
The lecture started with a review of concepts from offline RL and policy gradients:

2. Introduction to Data-Efficient RL
The lecture framed the problem of data-efficient or "fast" RL by distinguishing between computational efficiency and sample efficiency.

The goal is to design algorithms that learn good policies with the minimum number of real-world samples. This requires a formal way to measure an algorithm's performance over time.
3. Introduction to Multi-Armed Bandits
To build the foundations for data-efficient RL, the lecture introduces the multi-armed bandit problem, a simplified RL setting.

4. The Concept of Regret
To formally evaluate bandit algorithms, the concept of regret is introduced.

5. Optimism in the Face of Uncertainty (OFU)
A powerful and elegant principle for designing data-efficient algorithms is Optimism in the Face of Uncertainty (OFU).

6. The UCB1 Algorithm and its Analysis

This result is a landmark in learning theory, showing that a simple, optimistic algorithm can be provably data-efficient and achieve near-optimal performance.

L12: Exploration 2

This lecture marks a shift in focus from learning from offline/past data to online learning, where the agent actively gathers data to learn as quickly and efficiently as possible. The central theme is sample efficiency, which is critical in real-world applications where data collection is expensive or risky (e.g., healthcare, education, robotics), in contrast to simulated environments where data is cheap.
1. "Refresh Your Understanding" Poll & Review
The lecture started with a review of concepts from offline RL and policy gradients:

2. Introduction to Data-Efficient RL
The lecture framed the problem of data-efficient or "fast" RL by distinguishing between computational efficiency and sample efficiency.

The goal is to design algorithms that learn good policies with the minimum number of real-world samples. This requires a formal way to measure an algorithm's performance over time.
3. Introduction to Multi-Armed Bandits
To build the foundations for data-efficient RL, the lecture introduces the multi-armed bandit problem, a simplified RL setting.

4. The Concept of Regret
To formally evaluate bandit algorithms, the concept of regret is introduced.

5. Optimism in the Face of Uncertainty (OFU)
A powerful and elegant principle for designing data-efficient algorithms is Optimism in the Face of Uncertainty (OFU).

6. The UCB1 Algorithm and its Analysis

This result is a landmark in learning theory, showing that a simple, optimistic algorithm can be provably data-efficient and achieve near-optimal performance.

L13: Exploration 3

This lecture marks a shift in focus from learning from offline/past data to online learning, where the agent actively gathers data to learn as quickly and efficiently as possible. The central theme is sample efficiency, which is critical in real-world applications where data collection is expensive or risky (e.g., healthcare, education, robotics), in contrast to simulated environments where data is cheap.
1. "Refresh Your Understanding" Poll & Review
The lecture started with a review of concepts from offline RL and policy gradients:

2. Introduction to Data-Efficient RL
The lecture framed the problem of data-efficient or "fast" RL by distinguishing between computational efficiency and sample efficiency.

The goal is to design algorithms that learn good policies with the minimum number of real-world samples. This requires a formal way to measure an algorithm's performance over time.
3. Introduction to Multi-Armed Bandits
To build the foundations for data-efficient RL, the lecture introduces the multi-armed bandit problem, a simplified RL setting.

4. The Concept of Regret
To formally evaluate bandit algorithms, the concept of regret is introduced.

5. Optimism in the Face of Uncertainty (OFU)
A powerful and elegant principle for designing data-efficient algorithms is Optimism in the Face of Uncertainty (OFU).

6. The UCB1 Algorithm and its Analysis

This result is a landmark in learning theory, showing that a simple, optimistic algorithm can be provably data-efficient and achieve near-optimal performance.

L14: Multi-Agent Game Playing

This lecture delves into a different paradigm of reinforcement learning, focusing on simulation-based search and online planning to make high-quality decisions in a single, specific state. This contrasts with previous methods that aimed to learn a global policy for all states. The culmination of these ideas is AlphaGo and AlphaZero, the AI systems that mastered the game of Go.
1. "Refresh Your Understanding" Poll & Review
The lecture started with a poll reviewing concepts from data-efficient exploration.

2. Simulation-Based Search: Focusing Computation
The core idea of this lecture is to move away from learning a global policy and instead use all available computation to find the single best action to take from the current state.

3. Monte Carlo Tree Search (MCTS)
MCTS is a powerful algorithm that makes expectimax search tractable by using sampling to approximate the search tree.

4. Upper Confidence Trees (UCT)
UCT enhances MCTS by applying the Upper Confidence Bound principle from bandits to the action selection problem within the search tree.

5. AlphaGo and AlphaZero
The culmination of these ideas is AlphaGo and AlphaZero, which combined deep neural networks with a sophisticated MCTS algorithm.

L15: Value Alignment

This lecture, led by a guest speaker with a background in philosophy and ethics, shifted the focus from the technical "how" of reinforcement learning to the normative "what": What objectives should we be training our AI agents to pursue? This is the problem of value alignment.
1. Introduction: The Paperclip Maximizer
The lecture began with the classic thought experiment of the Paperclip AI, an agent tasked with the simple goal of maximizing paperclip production.

2. Three Interpretations of "What We Really Want"
The lecture broke down the ambiguous phrase "what we really want" into three distinct, and potentially conflicting, interpretations.

3. Case Study: A Personalized News Chatbot
The lecture applied these abstract concepts to a concrete example: designing an LLM chatbot to provide news.

4. Expanding the "We": Aligning to Morality
The final part of the lecture argued that focusing only on the user is too narrow. A truly aligned agent must consider the interests of all affected parties.

L16: Review

This final lecture served as a comprehensive review of the course, revisiting key concepts through the lens of the final quiz and challenging application domains, and concluded with a forward-looking perspective on the open challenges and future of the reinforcement learning field.
1. Quiz Recap and Concept Clarification
The lecture began by reviewing several questions from the final quiz, using them as a springboard to reinforce core concepts from the latter half of the course.

2. Revisiting Applications: A Test of Understanding
The professor challenged the class to apply their knowledge by formulating three real-world problems discussed at the start of the course.

3. Synthesizing the Core Ideas of Reinforcement Learning
The lecture concluded by synthesizing the overarching themes and open challenges in the field.

All writing