Reinforcement Learning and Autonomous Agents
CSC_52081_EP · Year 1 · Period 2
Contents
- Introduction and overview
- 0. Refresher and probabilistic reasoning: Markov chains, Bayesian networks, dynamic programming
- 1. Markov decision processes
- 2. Dynamic programming (known model)
- 3. Learning: TD, SARSA, Q-learning (unknown model)
- 4. Bandits, exploration and Monte-Carlo tree search
- 5. Policy gradients, actor-critic and gradient-free policy search
- 6. Deep RL and advanced methods: DQN, continuous control, offline, distributional, model-based, imitation
- 7. Autonomous agents in the era of LLMs
- 8. Course research notes (Jesse Read)
- Exercises
- Projects and assessment
- References
Introduction and overview
| Module | Reinforcement Learning and Autonomous Agents |
| Code | CSC_52081_EP |
| Team and workload | Head (“responsable” on the 2026–2027 sheet): Jesse Read (École Polytechnique) · teaching team listed on the sheet: Inès Benito, Jérémie Decock, Clément Elliker, Patrick Loiseau, Hossein Nick Zinat Matin, Lucas-Andreï Thil, Sonia Vanier · 36 h of in-person classes (no lecture/tutorial split displayed) · 4.5 ECTS · MDPs, dynamic programming, TD-learning, Q-learning, policy gradients, deep RL — and modern autonomous agents (tool use, LLM agents, multi-agent). |
| Period | Autumn semester · period 2 (from 04/01/2027 to 19/03/2027) · X3A session “Reinforcement Learning and Autonomous Agents”; course taught in English |
| Assessment | The LLGA section of the 2026–2027 sheet displays no assessment modality. The course description announces a course project (50%) and practical work (50%); for the other programs the sheet lists homework (50% in total) and a project (50%, oral assessment), resit allowed (final grade = max of the two grades), unit earned if the final grade ≥ 10 |
| Status in the program | Mandatory |
Audience: an engineer who has trained a classifier / network and wants to move from predicting to deciding (recommendation, pricing, agents). Empirical first: Q-learning on a gridworld that stalls because ε-greedy is too low; DQN that diverges when the replay buffer leaks the distribution; then we name MDP, TD, policy gradient, RLHF.
From MDPs to dynamic programming, deep RL and LLM agents. Mandatory P2 module: the glue between supervision and LLM alignment (LLMs in M2).
RLHF in three lines Reinforcement learning from human feedback (Ouyang et al., 2022) aligns a language model \pi_\theta in three steps.
- Supervised fine-tuning on demonstrations gives the reference policy \pi_{\mathrm{ref}}.
- A reward model r_\phi(x, y) is fitted to human comparisons y_w \succ y_l by the Bradley–Terry likelihood (section 6.5).
- The policy maximizes r_\phi minus the penalty \beta\,\mathrm{KL}(\pi_\theta \| \pi_{\mathrm{ref}}) with PPO (Theorem 5.5); the optimum of this objective is given by the lemma that opens chapter 6.
The derivations, DPO and GRPO are in Large Language Models, ch. 5.
What you will be able to do
- Formalize a sequential problem as a Markov decision process: states, actions, transitions, rewards, policy.
- Solve a known MDP by dynamic programming (value iteration, policy iteration).
- Implement model-free learning methods: TD, SARSA, Q-learning.
- Write policy gradient algorithms and actor-critic variants.
- Carry out deep RL: DQN, Rainbow, DDPG/SAC, and offline learning (offline RL).
- Master the exploration/exploitation trade-off, in particular in the bandit setting, and plan with Monte-Carlo tree search.
- Represent uncertain knowledge with a Bayesian network and take a single-step decision by maximum expected utility.
- Optimize policies without gradients (CEM, evolution strategies) and place a problem among the stochastic, multi-objective and constrained settings.
- Explain and compare distributional, model-based, imitation/inverse and sequence-modeling (decision transformer) approaches.
- Analyze autonomous agents in the era of LLMs: tool use, LLM agents, multi-agent systems, read as POMDPs and Markov games.
Official objectives and syllabus (2026-2027 catalog)
The official 2026–2027 sheet (X3A session “Reinforcement Learning and Autonomous Agents”, period X-3A-P2, from 04/01/2027 to 19/03/2027, taught in English) presents a course on the development of autonomous agents: systems that perceive, learn and act independently to achieve goals in uncertain and dynamic environments, drawing on probabilistic decision-making, inference and planning.
It develops Markov decision processes and their key concepts, deep Q-learning and its variants, the policy gradient and actor-critic architectures, then model-based learning, gradient-free optimization, imitation learning and other routes to sequential decision-making such as model-based control and decision transformers, and the specialized topics of offline RL, distributional RL, imitation and inverse reinforcement learning — with an emphasis on modern deep architectures that scale, on the practical consequences of architectural and algorithmic choices, and on formulating decision problems well. Students implement, study and compare algorithms in several settings.
Official prerequisites: a course such as Machine Learning and/or Deep Learning and the associated concepts, plus Python and its scientific libraries.
Assessment: the LLGA section of the sheet displays none; the description announces a course project (50%) and practical work (50%), and the other programs list homework (50%) and a project (50%, oral).
Team project (proposal) We propose to run the course project (50%) as the RL work package of the Year 1 team project: one repository, three graded work packages. The graph package is graded as the Graph ML team project, the RL package as this course’s project, and the NLP package as the Text Mining and NLP capstone. The RL package of each Year 1 subject of the end-of-year projects page:
- Y1.1 GraphRAG with a learned retrieval router: LinUCB (Algorithm 4.5) chooses the retrieval mode per question.
- Y1.2 fleet dispatch: a constrained MDP (Definition 6.5) solved by tabular Q-learning, then DQN or PPO.
- Y1.3 cold-start news recommendation: Thompson sampling and LinUCB (chapter 4) under drift.
- Y1.4 molecules from words: REINFORCE or PPO fine-tuning with a KL anchor (chapters 5–6) and a reward-hacking check.
- Y1.5 scene-graph question answering: a REINFORCE walker in a POMDP (Definition 7.1).
Solo and group variants, an exam proposal and a rubric are in Projects and assessment.
The sheet publishes a nine-block programme, matched below.
| Official programme block (2026–2027 sheet) | Course section |
|---|---|
| 1. Probabilistic reasoning and decision-making: graphical models, Bayesian networks, MDP solving as inference | Section 0.4 (Definitions 0.6–0.7, Example 0.8, control-as-inference note); tutorial “Bayesian network for a single-step decision” = Example 0.8 |
| 1. (cont.) Importance sampling, sequential Monte-Carlo | Proposition 0.9; particle beliefs reused in Definition 7.1 |
| 2. Learning, representation and planning: representations for sequential modeling, planning | Sections 6.4 (MPC, Dyna, latent world models) and 6.6; chapter 7 (memory as learned state) |
| 2. (cont.) Architecture search; decision transformers | Section 5.4 (architecture search as policy search); section 6.6 (Definition 6.15, Example 6.16) |
| 3. Bandits, exploration/exploitation | Chapter 4 (Definition 4.1 to Algorithm 4.5, section 4.1) |
| 3. (cont.) Monte-Carlo tree search | Section 4.2 (Definition 4.6, UCT Algorithm 4.7, Example 4.8) |
| 4. RL fundamentals, MDPs, dynamic programming (value and policy iteration), Monte-Carlo methods | Chapters 1 and 2; Monte-Carlo returns in Definition 3.3 (\lambda = 1) and REINFORCE (Theorem 5.1) |
| 5. Temporal differences, Q-learning, SARSA, deep Q-learning and variants | Chapter 3 (Algorithm 3.1 to 3.6); chapter 6 (DQN Algorithm 6.1) |
| 6. Deep Q-learning architectures (prioritized replay), actor-critic, DDPG | Rainbow Algorithm 6.2 and the prioritized-replay definition; section 5.2 (actor-critic); section 6.1 (DDPG, SAC) |
| 7. Optimization topics: stochastic, multi-objective, multimodal, constrained, dynamic; evolutionary direct policy search | Section 5.4 (CEM Algorithm 5.6, ES Proposition 5.7, Example 5.8, optimization-settings note); constrained MDPs in Definition 6.5 |
| 8–9. Advanced architectures: safety and transferability | Definition 6.5 (constrained MDPs), sim-to-real note (section 6.2), agent safety (chapter 7) |
| 8–9. (cont.) Imitation learning, inverse RL | Section 6.5 (Definitions 6.11, 6.13, Theorem 6.12, Example 6.14) |
| 8–9. (cont.) Offline RL, model-based RL, distributional RL | Section 6.2 (offline RL, CQL); section 6.4 (Proposition 6.10); section 6.3 (Theorem 6.7, Example 6.8) |
Every block of the official programme now has a section in these notes. Our extensions, beyond the official syllabus: the refresher sections 0.1–0.3 (Markov chains, martingales, dynamic programming), section 5.5 (neural combinatorial optimisation, for logistics), chapter 7 (autonomous agents in the era of LLMs: tool use, LLM agents, multi-agent systems and Markov games) and chapter 8 (the research work of Jesse Read, self-study).
Where this course fits in the program
Mandatory module of period 2 of M1 (36 h, 4.5 ECTS), of which Jesse Read is the official head. Official prerequisites: a course such as Machine Learning and/or Deep Learning and the concepts associated with these courses, as well as knowledge of Python and its scientific libraries. It constitutes the third pillar of machine learning alongside supervised and unsupervised learning, and directly feeds the second year.
- Prerequisites — Machine Learning for models, losses and generalization, and one Deep Learning course for networks: Deep Learning P1, or Deep Learning P2 taken in parallel (read its ch. 0 first).
- Markov chains — the finite-Markov-chain section of Refresher Statistics (section 2.7) and the refresher chapter 0 of this page, which also covers martingales and dynamic programming. Probability Theory for ML is an optional deepening (notes kept for reference: it is not in the 2026–27 LLGA lists).
- Downstream modules — RL directly prepares the RLHF chapter of the Large Language Models module (M2): PPO, DPO and GRPO are used there without detour; it also sheds light on the autonomous agents of Real-time AI in Video Games: decisive & collaborative actions (same period, real-time decision; the Markov games of section 7.1 frame its multi-agent chapter).
Course outline
- Refresher and probabilistic reasoning — Markov chains, martingales, dynamic programming, then Bayesian networks and single-step decisions by inference (official block 1).
- Markov decision processes — the formal framework: agent, environment, policy, value function.
- Dynamic programming — solving a known MDP: value and policy iterations.
- Learning: TD, SARSA, Q-learning — learning without a model of the environment, by interaction.
- Bandits, exploration and Monte-Carlo tree search — the exploration/exploitation trade-off in the simplest setting, then MCTS, where every tree node is a bandit.
- Policy gradients, actor-critic and gradient-free search — differentiating the policy to optimize it directly, or optimizing it as a black box (CEM, evolution strategies, multi-objective settings, architecture search).
- Deep RL and advanced methods — DQN, Rainbow and prioritized replay, DDPG/SAC, offline and safe RL, distributional RL, model-based RL and MPC, imitation and inverse RL, decision transformers.
- Autonomous agents in the era of LLMs — tool use, LLM agents, Markov games and multi-agent learning: where RL meets language models.
- Course research notes (Jesse Read) — a tour of the instructor’s research work (self-study).
- Exercises, Projects and assessment and References — systematic training, project subjects with an exam proposal, and sources to go further.
Session plan
36 h in class = 12 sessions of 3 h. The volume is the one of the SynapseS 2026–2027 sheet (36 h of in-person classes, no split between lectures and tutorials displayed).
The sheet publishes a nine-block programme; the plan below follows its order (probabilistic reasoning → MDPs and dynamic programming → TD and deep Q-learning → actor-critic → optimization → advanced architectures) with two changes, both made so that no session relies on a notion taught later.
Block 3 (bandits and MCTS) comes right after TD learning (sessions 5–6) rather than before the MDP chapters, because MCTS backs up values in an MDP; and block 2 (sequence models, planning, architecture search) is distributed over sessions 8 and 11, because architecture search is taught as an instance of policy search and decision transformers and model-predictive control are offline and model-based RL methods.
Level 1 = foundations (reviews, definitions, first worked examples), 2 = core algorithms and their convergence proofs, 3 = advanced methods and current practice; the level never goes down from one session to the next.
| Session | Hours | Level | Content | Practice |
|---|---|---|---|---|
| 1 | 3 h | 1 | ch. 0 Refresher (0.1–0.3), then official block 1: Bayesian networks, maximum expected utility, importance sampling and particle filters (0.4) | tutorial: Bayesian network for a single-step decision (Example 0.8) |
| 2 | 3 h | 1 | ch. 1 MDPs, policies, value functions, occupancy measures, Bellman evaluation equations (1.1–1.5) | Ex. 1 |
| 3 | 3 h | 2 | ch. 1 Optimality by contraction, LP formulation (1.6–1.7); ch. 2 Value and policy iteration, modified DP, error propagation (2.1–2.4) | Ex. 2, 10 |
| 4 | 3 h | 2 | ch. 3 TD(0), SARSA, Q-learning and their convergence; n-step returns, TD(\lambda) (3.1–3.3) | Ex. 3, 11 |
| 5 | 3 h | 2 | ch. 3 GAE, overestimation, double Q-learning (3.4–3.6); ch. 4 Bandits: regret, UCB1, the Lai-Robbins bound (Definition 4.1 to Theorem 4.3) | Ex. 4, 7 |
| 6 | 3 h | 2 | ch. 4 Thompson sampling, LinUCB (Algorithms 4.4–4.5), section 4.1 Exploring beyond bandits, section 4.2 Monte-Carlo tree search and UCT | Ex. 8, 13, 14 |
| 7 | 3 h | 2 | ch. 5.1–5.2 REINFORCE, baselines, actor-critic; ch. 5.3 Natural gradient, TRPO, PPO | Ex. 5, 6 |
| 8 | 3 h | 2 | ch. 5.4 CEM, evolution strategies, multi-objective and constrained settings, architecture search; ch. 5.5 Neural combinatorial optimisation | Ex. 15, 17 |
| 9 | 3 h | 3 | ch. 6 KL-regularised policy improvement, DQN, Rainbow, prioritized replay; DDPG and SAC (6.1) | Ex. 12 |
| 10 | 3 h | 3 | ch. 6.2 Offline RL, sim-to-real, constrained MDPs; ch. 6.3 Distributional RL | lab sheet in 6.3: C51 vs DQN on a risky toy MDP; team project: RL work package framed |
| 11 | 3 h | 3 | ch. 6.4 Model-based RL, MPC, world models; ch. 6.5 Imitation and inverse RL, Bradley–Terry; ch. 6.6 Decision transformers | lab sheet in 6.5: behavioural cloning vs DAgger; team project: baselines |
| 12 | 3 h | 3 | ch. 7 POMDPs and LLM agents: tools, memory, multi-agent systems, safety; Markov games and multi-agent learning (7.1) | Ex. 9, 16, 18 (project); team project: RL work package review |
Self-study, outside the 36 h (about 3 h in total): ch. 8 Course research notes — classifier chains, extreme classification, stream learning and concept drift (≈ 3 h).
Read ahead for the team project (it starts before the last sessions): chapter 7 and its section 7.1, and Algorithm 4.5 with the router note that follows it, by project week 4.
How to study this module
- Assimilate the refresher section before anything else: without Markov chains or dynamic programming, MDPs and TD-learning remain opaque recipes.
- Implement each algorithm on a small environment (gridworld, bandits): in RL, one only truly understands by coding the agent-environment loop.
- Always plot learning curves over several random seeds: the variance of runs is in itself a lesson of the module.
- Classify the algorithms by their assumptions — on-policy or off-policy, online or offline, value or policy: this mental table is worth more than any mnemonic device.
- Read the section on LLM agents early, even though it comes at the end of the course: it gives a concrete and modern motivation for everything that precedes it.
- Redo the exercises of each section before moving on to the next; the classic pitfalls (insufficient exploration, divergence of the critic) are encountered there first.
Notation Site-wide conventions for RL and RLHF, followed on this page:
- MDP (\mathcal{S}, \mathcal{A}, P, r, \gamma); returns G_t and G(\tau); values V^\pi, Q^\pi and advantage A^\pi.
- Discounted occupancy d^\pi (Definition 1.4); importance ratio \rho_t(\theta); Fisher matrix F(\theta).
- RLHF: policy \pi_\theta, reference \pi_{\mathrm{ref}}, reward model r_\phi(x, y), preferences y_w \succ y_l, KL coefficient \beta.
- Bandit index \mathrm{UCB}_a(t), with UCT written in the same form.
Deviations on this page:
- TD, Q-learning and actor-critic steps are written \alpha, as in Sutton & Barto; the generic learning rate \eta is kept for Robbins–Monro (Theorem 0.5).
- \alpha is also the temperature of SAC and the width of the LinUCB bonus (Algorithm 4.5).
- \pi is a stationary distribution in the Markov-chain recap of chapter 0, and a tour in section 5.5, as in Kool et al. (2019).
Independent note Reinforcement learning is the glue between the two axes of the master’s program: it is through it that LLMs get aligned (RLHF) and that agents are deployed on graph-structured environments. Careers in sequential decision-making — recommendation, pricing, robotics, games — and research on the alignment of generative models all mobilize these methods, and the Large Language Models module (M2) makes immediate use of them.
0. Refresher and probabilistic reasoning: Markov chains, Bayesian networks, dynamic programming
Reinforcement learning algorithms are random processes that try to reach the fixed point of an equation. Proving that they work takes three tools, recalled in this chapter: Markov chains (the trajectory of an agent with a fixed policy is one), stochastic approximation (learning from noisy updates), and dynamic programming (the recursive structure of optimal decisions). Section 0.4 then adds the first block of the official programme: representing uncertain knowledge with a Bayesian network and taking a single decision by inference.
L3 prerequisites — Markov chains
- Markov chain: X_{t+1} \sim P(\cdot \mid X_t) — the future depends only on the present. Stochastic transition matrix (rows summing to 1).
- Stationary distribution: \pi = \pi P; exists and is unique for an irreducible aperiodic chain (Perron-Frobenius theorem).
- Random walks on graphs: P = D^{-1}A — the random walker; \pi(v) \propto \deg(v); to be connected to PageRank and node embeddings (Graph ML module).
- Conditional expectation: \mathbb{E}[X \mid Y] (cf. Refresher Statistics module) — the value function is one.
0.1. Classification of states, ergodicity
Definition 0.1 — Irreducibility, aperiodicity, recurrence A chain on \mathcal{S} is irreducible if for all i, j there exists t with P^t(i, j) > 0 (every state is reachable from every state). It is aperiodic if the gcd of the return times to each state equals 1. A state is positive recurrent if the expected return time \mathbb{E}[T_{i \to i}] is finite. An irreducible, aperiodic, positive recurrent chain is called ergodic.
Theorem 0.2 — Ergodic theorem for Markov chains Let (X_t) be an ergodic chain with stationary distribution \pi. Then, for every bounded function f : \mathcal{S} \to \mathbb{R}, \frac{1}{n} \sum_{t=1}^{n} f(X_t) \;\xrightarrow{\text{a.s.}}\; \sum_{s \in \mathcal{S}} \pi(s)\, f(s), and moreover \|P^t(i, \cdot) - \pi\|_{\mathrm{TV}} \to 0 for every initial state i.
On a finite \mathcal{S} the speed is geometric: for every \rho < 1 larger than the modulus of all the eigenvalues of P other than 1, there is a constant C such that \|P^t(i, \cdot) - \pi\|_{\mathrm{TV}} \leq C \rho^t . On a countable \mathcal{S}, an ergodic chain can converge more slowly than any geometric rate.
RL reading: in the long run, the visit frequency of a state does not depend on the initial state — this is what justifies learning “over the course of episodes”.
0.2. Martingales and stochastic approximation
Definition 0.3 — Martingale (M_t) is a martingale adapted to the filtration (\mathcal{F}_t) if \mathbb{E}[M_{t+1} \mid \mathcal{F}_t] = M_t. Martingales model “fair noise”; the TD error of chapter 3 will be almost one.
Theorem 0.4 — Robbins-Siegmund (quasi-martingale convergence) Let V_t \geq 0 be adapted, with \mathbb{E}[V_{t+1} \mid \mathcal{F}_t] \leq V_t + a_t where \sum_t a_t < \infty. Then V_t converges a.s. to a finite random variable.
This is the central tool of the convergence proofs of this course’s algorithms: one shows that the distance to the fixed point decreases “on average”, and one concludes.
Theorem 0.5 — Robbins-Monro (precise statement) Consider the recursion x_{t+1} = x_t + \eta_{t+1}\big(h(x_t) + \xi_{t+1}\big), where h : \mathbb{R}^d \to \mathbb{R}^d is continuous, x^\star the unique zero of h, and:
- (i) steps \sum_t \eta_t = \infty, \sum_t \eta_t^2 < \infty;
- (ii) unbiased noise \mathbb{E}[\xi_{t+1} \mid \mathcal{F}_t] = 0;
- (iii) (x_t - x^\star)^\top\big(h(x_t)\big) < 0 as soon as x_t \neq x^\star (monotonicity);
- (iv) at most linear growth of the drift and of the noise: for a constant C, \|h(x_t)\|^2 + \mathbb{E}\big[\|\xi_{t+1}\|^2 \mid \mathcal{F}_t\big] \leq C\big(1 + \|x_t\|^2\big).
Then x_t \to x^\star \quad \text{a.s.}
Condition (iv) cannot be dropped. With h(x) = -x^3, which satisfies (iii), a start x_0 = 10 and \eta_1 = 1, the first step lands at x_1 = -990, and the following steps overshoot further and further: the iterates diverge.
This is exactly the regime of TD-learning: h will be the Bellman operator minus the identity, and Theorem 0.4 will provide the decrease.
0.3. Deterministic dynamic programming
Principle of optimality (Bellman, 1957) “An optimal policy has the property that, whatever the initial state and the first decision, the remaining decisions must constitute an optimal policy with regard to the state resulting from the first decision.” Formally, for a sequential additive cost, the optimal value satisfies a fixed-point equation: V^\star(x) = \min_u\{c(x, u) + V^\star(\mathrm{succ}(x, u))\}.
Usage reminders: shortest paths (Bellman-Ford), memoization (Refresher CS), temporal decomposition. The MDP of chapter 1 adds: random transitions (hence expectations) and a maximization (hence \max operators).
0.4. Probabilistic reasoning: Bayesian networks and decisions as inference
This section is the first block of the official programme: before any sequence of decisions, an agent must represent what it knows about an uncertain world and choose one action well. A Bayesian network is the standard way to write that knowledge down, and the single-step decision rule it supports — maximize expected utility under the posterior — is exactly what the Bellman equations of chapter 1 will repeat over time.
Definition 0.6 — Bayesian network A Bayesian network over random variables X_1, \dots, X_n is a directed acyclic graph G together with one conditional distribution per node given its parents \mathrm{pa}(i). The joint distribution factorizes along the graph: p(x_1, \dots, x_n) = \prod_{i=1}^{n} p\big(x_i \mid x_{\mathrm{pa}(i)}\big).
The graph encodes conditional independences: each variable is independent of its non-descendants given its parents (local Markov property).
The gain is compactness: n binary variables with at most k parents each need n\,2^k numbers instead of the 2^n - 1 of an unstructured table.
A Markov chain is the simplest Bayesian network (a path X_0 \to X_1 \to \dots), and an MDP trajectory is one too, with the actions as extra nodes.
Definition 0.7 — Single-step decision: maximum expected utility Add to the network a decision node A, chosen by the agent, and a utility U(x, a). Given observed evidence e, the rational action is a^\star \in \arg\max_a\ \mathbb{E}[U(X, a) \mid e, a] = \arg\max_a \sum_x p(x \mid e, a)\, U(x, a).
Reasoning splits into two steps: inference (compute the posterior of the hidden variables given the evidence) and decision (maximize an expectation under that posterior).
With U = r and a single time step, this is the bandit of chapter 4 with a known model; repeated over time with a state that evolves, it becomes the MDP of chapter 1.
Example 0.8 — The umbrella decision, computed Let R = “it will rain” with prior p(R) = 0.3, and a forecast F with p(F = \text{rain} \mid R) = 0.8, p(F = \text{rain} \mid \neg R) = 0.1 (network R \to F).
Utilities: take the umbrella and it rains, 0; take it and it stays dry, -1; leave it and it rains, -10; leave it and it stays dry, 0.
- Forecast “rain”. Bayes: p(R \mid F) = \frac{0.3 \cdot 0.8}{0.3 \cdot 0.8 + 0.7 \cdot 0.1} = \frac{0.24}{0.31} \approx 0.774 . Then \mathbb{E}U(\text{take}) = -1 \cdot 0.226 = -0.226 and \mathbb{E}U(\text{leave}) = -10 \cdot 0.774 = -7.74: take it.
- Forecast “dry”. p(R \mid \neg F) = \frac{0.3 \cdot 0.2}{0.3 \cdot 0.2 + 0.7 \cdot 0.9} = \frac{0.06}{0.69} \approx 0.087 , so \mathbb{E}U(\text{take}) \approx -0.913 and \mathbb{E}U(\text{leave}) \approx -0.87: leave it, by a narrow margin.
The same network gives opposite actions depending on the evidence — the policy is a function of the observation, as it will be in every later chapter.
Proposition 0.9 — Approximate inference: importance sampling and sequential Monte-Carlo When the posterior cannot be summed exactly, it is sampled.
Importance sampling: for a proposal q that covers the support of p, \mathbb{E}_p[f(X)] = \mathbb{E}_q\Big[f(X)\,\frac{p(X)}{q(X)}\Big] \approx \frac{\sum_i w_i\, f(x_i)}{\sum_i w_i}, \qquad x_i \sim q,\ \ w_i = \frac{p(x_i)}{q(x_i)}, the self-normalized form being usable when p is known only up to a constant (a posterior). Its reliability is measured by the effective sample size \mathrm{ESS} = (\sum_i w_i)^2 / \sum_i w_i^2, which collapses toward 1 when a few weights dominate.
Sequential Monte-Carlo (particle filter): to track a hidden state S_t from observations O_t, keep N particles; at each step
- move each particle with the transition model, s_t^i \sim P(\cdot \mid s_{t-1}^i, a_{t-1}),
- weight it by the observation likelihood w_t^i \propto \Omega(o_t \mid s_t^i, a_{t-1}),
- then resample in proportion to the weights.
The particle cloud approximates the belief of a POMDP (Definition 7.1). The same importance ratio p/q reappears as \pi_\theta / \pi_{\theta_\text{old}} in off-policy learning and in PPO (Theorem 5.5).
Control as inference The two steps can be merged: attach to each time step a binary “optimality” variable O_t with p(O_t = 1 \mid s_t, a_t) \propto \exp(r(s_t, a_t)) and condition the trajectory network on O_t = 1 for all t. The posterior over actions is then a softmax of soft Q-values — exactly the maximum-entropy policy of SAC (Algorithm 6.4; Levine, 2018). Planning becomes a probabilistic inference task, which is the viewpoint announced by the official programme for this first week.
1. Markov decision processes
Concrete scene: a pricing agent updates its estimates Q(s,a) online. After 10,000 episodes its learning curve rises; with another random seed the same code collapses, and the variance of the return is three times larger from one run to the next. Before any deep-learning trick, one must state precisely what is being optimized: this chapter sets up the Markov decision process.
What breaks Misspecified reward (the agent maximises the wrong thing); too little exploration (frozen policy); off-policy training without replay / target network (divergence). All three sabotage RLHF as much as a toy FrozenLake.
Definition 1.1 — MDP An MDP is a tuple (\mathcal{S}, \mathcal{A}, P, r, \gamma) : states \mathcal{S}, actions \mathcal{A}, transition kernel P(s' \mid s, a), reward r(s, a, s') (we write r(s,a) for its expectation), discount factor \gamma \in [0, 1).
A policy \pi(a \mid s) governs the choice of actions; the objective is the discounted expected return J(\pi) = \mathbb{E}_\pi\Big[\sum_{t=0}^{\infty} \gamma^t R_t\Big].
Fixing a policy \pi in an MDP induces a Markov chain with kernel P^\pi(s' \mid s) = \sum_a \pi(a \mid s) P(s' \mid s, a) — chapter 0 applies literally; \gamma < 1 guarantees that all the sums converge.
Proposition 1.2 — Stationary deterministic policies It suffices to search among deterministic policies \pi : \mathcal{S} \to \mathcal{A} and stationary ones (not depending on t): for every mixed non-stationary policy, there exists a stationary deterministic policy with at least equal value in every state.
(Proof: backward induction on the horizon then \gamma-discounted limiting passage; see Puterman, 2005.) The search space is finite: |\mathcal{A}|^{|\mathcal{S}|} candidates — too large for enumeration, hence chapters 2 and following.
Definition 1.3 — Value functions V^\pi(s) = \mathbb{E}_\pi\Big[\sum_t \gamma^t R_t \,\Big|\, S_0 = s\Big], \qquad Q^\pi(s, a) = \mathbb{E}_\pi\Big[\sum_t \gamma^t R_t \,\Big|\, S_0 = s, A_0 = a\Big]. V^\pi = “how much the state is worth”; Q^\pi = “how much the state-action pair is worth”. We have V^\pi(s) = \sum_a \pi(a\mid s)\, Q^\pi(s,a) \quad\text{and}\quad Q^\pi(s, a) = r(s, a) + \gamma \sum_{s'} P(s' \mid s, a)\, V^\pi(s').
Definition 1.4 — Occupancy measures The (normalized, discounted) occupancy measure of \pi (from \mu_0) is d^\pi(s, a) = (1 - \gamma)\sum_{t=0}^{\infty} \gamma^t\, \mathbb{P}_\pi[S_t = s, A_t = a], \qquad \text{so that} \qquad J(\pi) = \frac{1}{1-\gamma}\sum_{s,a} d^\pi(s,a)\, r(s,a).
d^\pi is a probability distribution over \mathcal{S} \times \mathcal{A}; it describes “where the policy lives”. Its state marginal d^\pi(s) = \sum_a d^\pi(s, a) = (1-\gamma)\sum_{t=0}^{\infty} \gamma^t\, \mathbb{P}_\pi[S_t = s] is the discounted state-visitation distribution, and d^\pi(s,a) = d^\pi(s)\,\pi(a \mid s). It is the natural bridge toward the LP formulation below and toward the importance ratios of chapter 5 (sampling under \pi, evaluating under \pi').
Theorem 1.5 — Bellman equations (evaluation) Q^\pi(s, a) = r(s,a) + \gamma \sum_{s'} P(s' \mid s, a)\, V^\pi(s'), \qquad V^\pi(s) = \sum_a \pi(a \mid s)\Big[r(s,a) + \gamma \sum_{s'} P(s'\mid s,a) V^\pi(s')\Big]. This is dynamic programming applied to time: today’s value = immediate gain + discounted value of tomorrow.
Writing T_\pi for the operator (T_\pi V)(s) = \sum_a \pi(a\mid s)\big[r(s,a) + \gamma \sum_{s'} P(s'\mid s,a) V(s')\big], the equation rewrites as V^\pi = T_\pi V^\pi — a linear system of |\mathcal{S}| equations ((I - \gamma P^\pi) V = r^\pi, invertible since \gamma < 1).
Theorem 1.6 — Optimality: existence, uniqueness (complete proof) Consider the optimal Bellman operator (\mathcal{T}V)(s) = \max_a \Big\{ r(s, a) + \gamma \sum_{s'} P(s' \mid s, a)\, V(s') \Big\}. (1) \mathcal{T} is a contraction of modulus \gamma on (\mathbb{R}^{|\mathcal{S}|}, \|\cdot\|_\infty) (a complete space). Proof in two lemmas:
Proof. Lemma (max-Lipschitz). For all bounded families of reals (u_a)_a, (v_a)_a: |\max_a u_a - \max_a v_a| \leq \max_a |u_a - v_a| . Indeed, for every a, u_a \leq v_a + \max_b |u_b - v_b|, so \max_a u_a \leq \max_a v_a + \max_b |u_b - v_b|; exchanging the roles, |\max_a u_a - \max_a v_a| \leq \max_b |u_b - v_b|.
Contraction. For each s, setting u_a = r(s,a) + \gamma \sum_{s'} P(s'\mid s,a) V(s') and v_a the analogue for V': \big|(\mathcal{T}V)(s) - (\mathcal{T}V')(s)\big| \leq \max_a \gamma \Big|\sum_{s'} P(s'\mid s,a)\big(V(s') - V'(s')\big)\Big| \leq \gamma\, \|V - V'\|_\infty, since P(\cdot\mid s,a) is a probability distribution. Taking the max over s: \|\mathcal{T}V - \mathcal{T}V'\|_\infty \leq \gamma \|V - V'\|_\infty .
(2) Fixed point. By Banach’s fixed-point theorem (L3 reminder: contraction on a complete space), \mathcal{T} admits a unique fixed point V^\star, and \mathcal{T}^k V \to V^\star for every starting V, at geometric speed \gamma^k. We set Q^\star = r + \gamma P V^\star, which satisfies
Key result — Bellman optimality equation Q^\star(s, a) = r(s, a) + \gamma \sum_{s'} P(s' \mid s, a)\, \max_{a'} Q^\star(s', a').
(3) Optimal policy. Let \pi^\star be greedy for V^\star: \pi^\star(s) \in \arg\max_a Q^\star(s,a). Then T_{\pi^\star} V^\star = \mathcal{T}V^\star = V^\star, so \|T_{\pi^\star}^k V^\star - V^\star\|_\infty \leq \gamma^k \|T_{\pi^\star} V^\star - V^\star\|_\infty = 0 for every k; in the limit V^{\pi^\star} = V^\star.
Hence \pi^\star attains the supremum \sup_\pi V^\pi in every state: it is an optimal stationary deterministic policy. ∎
Proposition 1.7 — Linear (LP) formulation of MDPs Solving an MDP amounts to solving the (dual) linear program: \max_{\mu \geq 0}\ \sum_{s,a} \mu(s,a)\, r(s,a) \quad \text{s.t.} \quad \sum_a \mu(s', a) \;=\; \nu(s') + \gamma \sum_{s,a} P(s' \mid s, a)\, \mu(s,a) \ \ \forall s', where \nu is the initial distribution.
The variables \mu are the occupancy measures = d^\pi/(1-\gamma); the constraints are “flow equations” (what enters a state = initial distribution + what leaves it, discounted). An extreme optimal solution of the polytope is attained at a deterministic policy, and \pi^\star(s) = \arg\max_a \mu^\star(s, a). Interest: LPs are solved in polynomial time (but polynomial in |\mathcal{S}|\, |\mathcal{A}|, quickly enormous); the dual viewpoint also sheds light on the linear approximation methods for the value.
The primal writes \min_V \sum_s \nu(s) V(s) \quad \text{s.t.} \quad V(s) \geq r(s,a) + \gamma \sum_{s'} P V \quad \text{for all } (s, a) — the constraints are the Bellman inequalities.
Role of \gamma \gamma discounts the future but also conditions the whole theory: contraction of modulus \gamma, error bounds in 1/(1-\gamma) (chapter 2), variance of the returns. When \gamma \to 1, one tends toward the average criterion \lim_T \frac{1}{T}\sum_t R_t — related to the ergodic theorem 0.2 — but all the rates degrade: RL lives with this tension.
2. Dynamic programming (known model)
When the transition kernel P and the reward r are known, the Bellman equations of ch. 1 can be solved by computation alone, without any interaction. This chapter gives the two classical algorithms, value iteration and policy iteration, with their convergence proofs: everything that follows is a sampled or approximated version of them.
Theorem 2.1 — Value iteration: convergence demonstrated Repeat until convergence: V_{k+1}(s) = \max_a \Big\{ r(s, a) + \gamma \sum_{s'} P(s' \mid s, a)\, V_k(s')\Big\} \qquad \text{i.e.} \qquad V_{k+1} = \mathcal{T}V_k.
Proof. For every k (writing V^\star = \mathcal{T}V^\star): \|V_{k+1} - V^\star\|_\infty = \|\mathcal{T}V_k - \mathcal{T}V^\star\|_\infty \leq \gamma\, \|V_k - V^\star\|_\infty \ \Rightarrow\ \|V_k - V^\star\|_\infty \leq \gamma^k \|V_0 - V^\star\|_\infty.
The convergence is geometric with ratio \gamma: each iteration removes a factor \gamma from the error.
Exploitable stopping criterion. \|V_{k+1} - V_k\|_\infty \leq \varepsilon \quad \text{implies} \quad \|V_{k+1} - V^\star\|_\infty \leq \frac{\gamma\,\varepsilon}{1-\gamma} . Indeed, by contraction and the triangle inequality, \|V_{k+1} - V^\star\|_\infty \leq \gamma\|V_k - V^\star\|_\infty \leq \gamma\big(\varepsilon + \|V_{k+1} - V^\star\|_\infty\big). The previous iterate only gets \|V_k - V^\star\|_\infty \leq \varepsilon/(1-\gamma), so the algorithm returns V_{k+1}.
To guarantee an error \delta on the returned value, a residual \varepsilon = \delta(1-\gamma)/\gamma is needed — the factor 1/(1-\gamma) “amplifies” any approximation error. ∎
Theorem 2.2 — Policy iteration: monotone improvement demonstrated Alternate:
- (i) exact evaluation V^{\pi_k} = T_{\pi_k} V^{\pi_k} (linear system);
- (ii) greedy improvement \pi_{k+1}(s) \in \arg\max_a r(s,a) + \gamma \sum_{s'} P(s'\mid s,a) V^{\pi_k}(s'), that is, \pi_{k+1} greedy for V^{\pi_k}.
Proof. Monotonicity. First T_{\pi_{k+1}} V^{\pi_k} = \mathcal{T}V^{\pi_k} \geq V^{\pi_k} component by component (the max over the actions dominates the action played by \pi_k).
Next, T_{\pi_{k+1}} is monotone (U \geq V \Rightarrow T_{\pi} U \geq T_\pi V, by positive linearity of the expectation), so by induction T_{\pi_{k+1}}^{j+1} V^{\pi_k} \geq T_{\pi_{k+1}}^{j} V^{\pi_k} \geq V^{\pi_k} ; in the limit V^{\pi_{k+1}} = \lim_j T_{\pi_{k+1}}^j V^{\pi_k} \geq V^{\pi_k} .
Finite termination. If V^{\pi_{k+1}} = V^{\pi_k}, then \mathcal{T}V^{\pi_k} = T_{\pi_{k+1}} V^{\pi_k} = V^{\pi_k} : V^{\pi_k} is a fixed point of \mathcal{T}, hence equal to V^\star (uniqueness, Th. 1.6).
Since the value increases strictly at every non-terminal iteration and there is a finite number (|\mathcal{A}|^{|\mathcal{S}|}) of deterministic policies, the algorithm stops after a finite number of iterations on an optimal policy. ∎
Value vs policy iteration — costs and trade-offs Value iteration: cheap iterations (O(|\mathcal{S}|^2 |\mathcal{A}|)) but very many; policy iteration: few iterations (often < 20) but each one requires solving a linear system (O(|\mathcal{S}|^3)). In practice on large \mathcal{S}: neither is exactly tractable — but all of modern RL is a “noisy and approximated” version of these two schemes.
Proposition 2.3 — Modified policy iteration and asynchronous dynamic programming
Modified PI (Puterman & Shin, 1978): replace the exact evaluation of \pi_k by m applications of T_{\pi_k} (with m small). m = \infty gives back PI, small m gets closer to VI; one interpolates the cost per iteration and the number of iterations — often the best compromise in practice.
Asynchronous DP (Bertsekas & Tsitsiklis): update a freely chosen state s (Gauss-Seidel, partial sweeps, priority to relevant states). Theorem: if every state is visited infinitely often, asynchronous DP converges to V^\star.
This is the gateway to RL: the algorithms of chapters 3, 5 and 6 are “sampled” asynchronous DPs, where the update is made on the state actually visited.
Proposition 2.4 — Propagation of approximation errors Suppose that at every iteration a bounded error sneaks in: \tilde V_{k+1} = \mathcal{T}\tilde V_k + \varepsilon_k, with \|\varepsilon_k\|_\infty \leq \varepsilon. Then \|\tilde V_k - V^\star\|_\infty \;\leq\; \gamma^k \|\tilde V_0 - V^\star\|_\infty \;+\; \frac{\varepsilon}{1-\gamma}.
Proof. By recursion and contraction: \|\tilde V_{k+1} - V^\star\| \leq \gamma \|\tilde V_k - V^\star\| + \varepsilon, then by telescoping \|\tilde V_k - V^\star\| \leq \sum_{i<k} \gamma^i \varepsilon + \gamma^k \|\tilde V_0 - V^\star\| and geometric sum. ∎
Major consequence for deep RL: any approximation error (network, sampling) is multiplied by \frac{1}{1-\gamma}. With \gamma = 0.99, a factor of 100: this is why approximating V or Q is difficult, and why the choice of \gamma is a genuine design choice.
import numpy as np
# 4x4 gridworld: states 0..15, actions 0..3 (up, down, left, right)
S, A, gamma = 16, 4, 0.95
goal = 15
P = np.zeros((S, A, S)); r = -np.ones((S, A))
def step(s, a):
i, j = divmod(s, 4)
di, dj = [(-1,0),(1,0),(0,-1),(0,1)][a]
return 4*min(max(i+di,0),3) + min(max(j+dj,0),3)
for s in range(S):
for a in range(A):
s2 = step(s, a)
P[s, a, s2] = 1.0
if s2 == goal or s == goal: r[s, a] = 0.0
r[goal] = 0.0
def T_op(V): # optimal Bellman operator
return (r + gamma * (P @ V)).max(axis=1)
# --- Value iteration (th. 2.1) ---
V = np.zeros(S)
for _ in range(200):
V_new = T_op(V)
gap = np.abs(V_new - V).max()
V = V_new # keep V_{k+1}: the iterate the bound covers
if gap < 1e-10: break # stopping criterion th. 2.1
Q = r + gamma * (P @ V)
print("VI :", V.reshape(4,4).round(2))
# --- Policy iteration (th. 2.2) ---
pi = np.zeros(S, dtype=int); V = np.zeros(S)
while True:
# (i) exact evaluation: (I - gamma P^pi) V = r^pi
R = r[np.arange(S), pi]
Ppi = P[np.arange(S), pi]
V = np.linalg.solve(np.eye(S) - gamma * Ppi, R)
# (ii) greedy improvement
Q = r + gamma * (P @ V)
pi_new = Q.argmax(axis=1)
if (pi_new == pi).all(): break # stable policy: optimal
pi = pi_new
print("PI :", V.reshape(4,4).round(2))3. Learning: TD, SARSA, Q-learning (unknown model)
In practice we know neither P nor r: we interact. Temporal-difference learning learns by correcting each prediction toward the observation:
Algorithm 3.1 — TD(0), SARSA, Q-learning
- TD(0) (evaluation): V(S_t) \leftarrow V(S_t) + \alpha\big[R_{t+1} + \gamma V(S_{t+1}) - V(S_t)\big] ; the bracket is the TD error \delta_t.
- SARSA (on-policy): Q(S_t, A_t) \leftarrow Q(S_t,A_t) + \alpha\big[R_{t+1} + \gamma Q(S_{t+1}, A_{t+1}) - Q(S_t,A_t)\big].
- Q-learning (off-policy): Q(S_t, A_t) \leftarrow Q(S_t, A_t) + \alpha\Big[R_{t+1} + \gamma \max_{a'} Q(S_{t+1}, a') - Q(S_t, A_t)\Big].
Theorem 3.2 — Convergence of TD(0) and Q-learning (sketch via Robbins-Monro) Under sufficient exploration (every pair (s,a) visited infinitely often) and steps \alpha_t(s,a) \in (0,1) with \sum_t \alpha_t = \infty, \sum_t \alpha_t^2 < \infty, almost surely V_t \to V^\pi \quad \text{and} \quad Q_t \to Q^\star (TD(0), Tsitsiklis 1994; Q-learning, Watkins & Dayan 1992).
Proof. TD(0) is a Robbins-Monro recursion. The update writes V(s) \leftarrow V(s) + \alpha\,\delta_t with \delta_t = r + \gamma V(S') - V(s). With S_t and V fixed, the expectation of \delta_t over the action, the reward and S_{t+1} equals r^\pi(S_t) + \gamma \sum_{s'} P^\pi(s'\mid S_t) V(s') - V(S_t) = (T_\pi V - V)(S_t) — the TD error is unbiased noise around the Bellman residual.
The target equation is therefore h(V) = T_\pi V - V = 0, whose unique zero is V^\pi (Theorem 1.5). The remainder satisfies the hypotheses of Theorem 0.5.
When the states are visited according to the stationary distribution \mu_\pi of the chain P^\pi (Theorem 0.2; not the discounted occupancy d^\pi of Definition 1.4), the mean update is D_\pi(T_\pi V - V) with D_\pi = \mathrm{diag}(\mu_\pi). The drift and the TD error are affine in V and the rewards are bounded, so the growth condition (iv) holds.
Moreover T_\pi is a \gamma-contraction for the weighted norm \|x\|_{D_\pi} = \sqrt{x^\top D_\pi x}; this gives the monotonicity condition (iii): (V - V^\pi)^\top D_\pi (T_\pi V - V) \leq -(1-\gamma)\|V - V^\pi\|^2_{D_\pi} . Theorem 0.4 (Robbins-Siegmund) then concludes.
Q-learning: same scheme with two extra ingredients.
- (i) the operator \mathcal{T} (with max) remains a contraction of modulus \gamma (Theorem 1.6);
- (ii) the max introduces a bias conditional on the sample, but not asymptotically: in the limit, the argmax is stable and the iteration converges to the unique fixed point Q^\star.
Hence the result: Q-learning converges whatever the exploration policy (as long as it visits everything) — this is the off-policy property. ∎
Definition 3.3 — n-step returns and eligibility traces The n-step return mixes bootstrapping and Monte-Carlo: G_t^{(n)} = R_{t+1} + \gamma R_{t+2} + \dots + \gamma^{n-1} R_{t+n} + \gamma^{n} V(S_{t+n}).
TD(\lambda), “forward” view: geometrically average the n-step returns: G_t^\lambda = (1-\lambda) \sum_{n=1}^{\infty} \lambda^{n-1} G_t^{(n)}.
“Backward” view, implementable online with one eligibility trace per state: e_t(s) = \gamma \lambda\, e_{t-1}(s) + \mathbb{1}[S_t = s], \qquad V_{t+1}(s) = V_t(s) + \alpha\, \delta_t\, e_t(s) \quad \forall s.
The trace accumulates the states “responsible” for the current reward and fades as (\gamma\lambda)^k. Equivalence theorem (Sutton & Barto, ch. 12): for tabular evaluation with fixed steps, the two views realize the same cumulative update over an episode — equivalence stated here without proof.
Proposition 3.4 — GAE: derivation of the generalized advantage estimator Set the TD error for the critic V: \delta_t = R_{t+1} + \gamma V(S_{t+1}) - V(S_t). Then:
Proof. Step 1 (telescoping). By immediate recursion, G_t^{(n)} - V(S_t) = \sum_{l=0}^{n-1} \gamma^l\, \delta_{t+l} \qquad (\text{n-step advantage, } A_t^{(n)}).
Step 2 (geometric mixing). The GAE estimator is the combination (1-\lambda)\sum_n \lambda^{n-1} A_t^{(n)} — the same as TD(\lambda) — and the telescoping propagates to the sum: \hat A_t^{\mathrm{GAE}(\gamma,\lambda)} = \sum_{l=0}^{\infty} (\gamma\lambda)^l\, \delta_{t+l}.
Bias-variance reading.
- \lambda = 0 gives \hat A_t = \delta_t: one bootstrap step, strong bias (if V is poor), low variance.
- \lambda = 1 gives \hat A_t = G_t - V(S_t): Monte-Carlo, no bootstrap bias, maximal variance.
GAE allows positioning oneself between the two — it is the standard estimator of the algorithms of chapters 5 and 6 (Schulman et al., 2016). ∎
Theorem 3.5 — Q-learning overestimation: the bias of the max, demonstrated For all real random variables X, Y with finite expectations: \mathbb{E}[\max(X, Y)] \;\geq\; \max\big(\mathbb{E}[X], \mathbb{E}[Y]\big), with strict inequality if and only if X - Y changes sign with positive probability: \mathbb{P}(X > Y) > 0 and \mathbb{P}(Y > X) > 0.
X \neq Y almost surely is not enough: with X = 2 and Y uniform on [0, 1], \mathbb{E}[\max(X, Y)] = 2 = \max(\mathbb{E}X, \mathbb{E}Y).
Proof. We write \max(x,y) = \tfrac12\big(x + y + |x - y|\big). The function (x,y) \mapsto |x - y| is convex, so by Jensen \mathbb{E}|X - Y| \geq |\mathbb{E}X - \mathbb{E}Y|.
Hence: \mathbb{E}[\max(X,Y)] = \tfrac12\big(\mathbb{E}X + \mathbb{E}Y + \mathbb{E}|X-Y|\big) \geq \tfrac12\big(\mathbb{E}X + \mathbb{E}Y + |\mathbb{E}X - \mathbb{E}Y|\big) = \max(\mathbb{E}X, \mathbb{E}Y), strict if and only if \mathbb{E}|X-Y| > |\mathbb{E}X - \mathbb{E}Y|.
Write Z = X - Y = Z^+ - Z^- with Z^\pm \geq 0. Then \mathbb{E}|Z| - \mathbb{E}Z = 2\,\mathbb{E}[Z^-] and \mathbb{E}|Z| + \mathbb{E}Z = 2\,\mathbb{E}[Z^+].
So \mathbb{E}|Z| = |\mathbb{E}Z| exactly when Z^- = 0 a.s. or Z^+ = 0 a.s., that is, when Z keeps one sign: the inequality is strict if and only if X - Y takes both signs with positive probability.
Moreover \mathbb{E}[\max(X,Y)] \leq \max(\mathbb{E}X, \mathbb{E}Y) + \tfrac12\sqrt{\mathbb{E}[(X - Y)^2]} : the bias grows with the noise. ∎
Application: the Q-learning target, y = r + \gamma \max_{a'} Q(s', a'), takes the expectation of a max of noisy Q-values (network, sampling): the max preferentially selects overestimates, and the bootstrap propagates the bias — hence systematically optimistic values and overexcited policies.
Algorithm 3.6 — Double Q-learning: the correction Maintain two independent estimators Q_A, Q_B (each updated on half of the transitions, or randomly swapped), and decouple selection and evaluation: a^\star = \arg\max_a Q_A(s', a), \qquad y = r + \gamma\, Q_B(s', a^\star), \qquad Q_A(s,a) \leftarrow Q_A(s,a) + \alpha\big[y - Q_A(s,a)\big] (and symmetrically by swapping A \leftrightarrow B).
Since \mathbb{E}[Q_B(s', a^\star)] is taken without a max over the noise of Q_B, the positive bias of Theorem 3.5 disappears (the argmax is still computed on Q_A, but the evaluation no longer “picks the noise that suits it”).
This is the tabular version of van Hasselt (2010); the deep version (Double DQN, chapter 6) uses the current network and the target network as the two estimators.
Exploration: \varepsilon-greedy policy With probability \varepsilon: random action; otherwise \arg\max_a Q(s, a). Without exploration, the learning signal dies out; decreasing \varepsilon is the standard setting — chapter 4 systematizes this choice.
The deadly triad Function approximation (networks) + bootstrapping (TD targets) + off-policy (Q-learning): combining the three can make the iteration diverge (Baird’s counterexample, 1995). The convergence proof of Theorem 3.2 collapses as soon as the operator is no longer a contraction within the approximation class. The whole of chapter 6 is an art of living with this triad: replay, target networks, clipping, double Q.
Q-learning ≠ SARSA in one sentence Q-learning learns the optimal policy whatever the exploration policy (off-policy); SARSA evaluates the policy actually followed (including exploration) — more cautious near cliffs! (Classic lab: Cliff Walking, exercise 3.)
4. Bandits, exploration and Monte-Carlo tree search
Before learning in a world with many states, consider the simplest decision problem in which exploration matters: a single situation, several actions whose mean rewards are unknown, and a budget of T trials. Every trial spent on a poor action is lost, yet without trying the actions one never learns which is best; this chapter measures that trade-off by the regret and gives the algorithms that handle it optimally.
Definition 4.1 — K-armed bandit An MDP with a single state: at each step choose an arm a and receive r \sim \nu_a (independent of the past). Objective: minimize the cumulative regret R_T = T\,\mu^\star - \mathbb{E}\Big[\sum_{t=1}^T \mu_{A_t}\Big] = \sum_{a : \Delta_a > 0} \Delta_a\, \mathbb{E}[N_a(T)], \qquad \Delta_a = \mu^\star - \mu_a, where N_a(T) counts the pulls of arm a.
The bandit isolates the exploration/exploitation trade-off without state generalization cost — and it is already a hard sequential problem: every datum received depends on the past action.
Theorem 4.2 — UCB1: logarithmic regret, proof sketch UCB1 (Auer, Cesa-Bianchi & Fischer, 2002): play each arm once, then at each step play A_t = \arg\max_a \mathrm{UCB}_a(t) with the index \mathrm{UCB}_a(t) = \hat\mu_a(t) + c\sqrt{\frac{\ln t}{N_a(t)}}, \qquad c = \sqrt 2 \ \text{for UCB1} (“optimism in the face of uncertainty”: the bonus decreases in 1/\sqrt{N_a}).
For rewards in [0,1]:
Key result — UCB1 regret R_T \;\leq\; \sum_{a \neq a^\star} \frac{8 \log T}{\Delta_a} + \Big(1 + \frac{\pi^2}{3}\Big) \sum_a \Delta_a.
Proof.
Concentration (Hoeffding). For an arm a pulled n times, \mathbb{P}\big(\hat\mu_a \leq \mu_a - u\big) \leq e^{-2 n u^2} — the empirical means concentrate around the true mean.
Optimism is reliable. With u = \sqrt{2\log t / N_a}, the event “\hat\mu_a + u < \mu_a” (pessimistic index) has probability \leq t^{-4} for each value of the pull count. The two bad events (optimal arm underestimated, arm a overestimated) are union-bounded over the pull counts s, s' \leq t, then over t: \sum_{t \geq 1} 2\, t^2\, t^{-4} = 2 \sum_{t \geq 1} t^{-2} = \frac{\pi^2}{3}, which is the \pi^2/3 term.
Outside rare events, the index always upper-bounds the true mean, so the optimal arm has an index \geq \mu^\star and a suboptimal arm can only be chosen if its estimate is too high.
Counting bad choices. If a \neq a^\star is chosen at time t, then (indices compared) \hat\mu_a + \sqrt{2\log t / N_a} \geq \hat\mu_{a^\star} + \sqrt{2\log t/N_{a^\star}} \geq \mu^\star, hence \hat\mu_a \geq \mu^\star - \sqrt{2\log t/N_a} — but \hat\mu_a \leq \mu_a + \sqrt{2\log t/N_a} outside rare events. Combining, N_a(t) \leq 8 \log T / \Delta_a^2 before the arm is definitively dominated.
Regret. Inject into R_T = \sum_a \Delta_a \mathbb{E}[N_a(T)]. ∎
Theorem 4.3 — Lai-Robbins lower bound (1985) For every consistent strategy (regret sub-polynomial in T on all instances): \liminf_{T \to \infty} \frac{R_T}{\log T} \;\geq\; \sum_{a : \Delta_a > 0} \frac{\Delta_a}{\mathrm{KL}(\nu_a \,\|\, \nu_{a^\star})}.
Interpretation: distinguishing \nu_a from \nu_{a^\star} requires \Omega(\mathrm{KL}^{-1} \log T) samples — information-theoretically. UCB1 loses at most a constant factor against this bound; optimized indices (KL-UCB) and Thompson sampling attain it asymptotically. Regret in \Theta(\log T) is therefore the law of the problem.
Algorithm 4.4 — Thompson sampling: derived posteriors Maintain a posterior over each \mu_a; at each step, sample \tilde\mu_a from each posterior and play \arg\max_a \tilde\mu_a. Pulls of a dominated arm naturally become rare: exploration emerges from the algorithm.
Proof. Bernoulli case: Beta conjugation. Prior \mathrm{Beta}(\alpha, \beta) of density \propto \theta^{\alpha-1}(1-\theta)^{\beta-1}, likelihood \theta^{S}(1-\theta)^{F} (S successes, F failures).
The posterior is \propto \theta^{\alpha + S - 1}(1-\theta)^{\beta + F - 1}, that is, \mu_a \mid \text{data} \sim \mathrm{Beta}(\alpha + S_a,\ \beta + F_a) — the update is a simple counting (uniform prior: \alpha = \beta = 1).
Gaussian case: completing the square. Rewards \mathcal{N}(\mu_a, \sigma^2), prior \mu_a \sim \mathcal{N}(0, \tau^2). The posterior is Gaussian: v_n = \Big(\frac{1}{\tau^2} + \frac{n}{\sigma^2}\Big)^{-1}, \qquad m_n = v_n\, \frac{n\, \bar r}{\sigma^2}, \qquad \mu_a \mid \text{data} \sim \mathcal{N}(m_n, v_n)\,: precisions (inverses of the variances) add up — one recovers the empirical estimator in the limit n \to \infty. ∎
Thompson sampling attains the Lai-Robbins bound (asymptotically, exponential families) and empirically dominates UCB — it is the industrial choice (recommendation, A/B tests). Chapelle & Li (2011) for the reference empirical study.
Algorithm 4.5 — Linear contextual bandits: LinUCB Context x_t \in \mathbb{R}^d (user, article), expected reward linear per action: \mathbb{E}[r \mid x, a] = x_{t,a}^\top \theta^\star.
Ridge estimation: A_t = \lambda I + \sum_{\tau < t} x_{\tau} x_{\tau}^\top, \qquad b_t = \sum_{\tau < t} x_\tau\, r_\tau, \qquad \hat\theta_t = A_t^{-1} b_t, and index rule (confidence ellipsoid): a_t = \arg\max_a\ x_{t,a}^\top \hat\theta_t + \alpha \sqrt{x_{t,a}^\top A_t^{-1} x_{t,a}}.
The bonus \sqrt{x^\top A^{-1} x} is the directional uncertainty (small in often-observed directions); regret \tilde{\mathcal{O}}(d\sqrt{T}) (Abbasi-Yadkori et al., 2011).
LinUCB (Li et al., 2010) deployed this idea at scale for news article recommendation — the context = user/article features, exactly the schema of modern recommender systems (network variants: NeuralTS, etc.).
LinUCB in the team project The same algorithm serves two Year 1 subjects. As a retrieval router (Y1.1), the context is a feature vector of the question, the arms are the retrieval modes (none, vector, GraphRAG, agentic) and the reward is answer correctness minus a token cost. As a cold-start recommender (Y1.3), the context joins user and article embeddings and the reward is a click.
4.1. Exploring beyond bandits
Three families of exploration: \varepsilon-greedy (blind, learns nothing from the structure); optimism (UCB, count-based: bonus \beta/\sqrt{N(s,a)} — explore what is uncertain); posterior (Thompson: explore what is plausible). In MDPs, optimism yields the UCT/Monte-Carlo Tree Search algorithms (the heart of AlphaGo).
Intrinsic exploration in high dimension: when the count N(s,a) is empty (states almost all distinct — images), replace novelty by a prediction error.
RND (Burda et al., 2019, sketch): a random frozen target network f and a predictor g trained to imitate f on visited states; the intrinsic reward r_{\mathrm{int}}(s) = \|f(s) - g(s)\|_2^2 is large on new states (never seen by g) and fades with familiarity — a similarity-based generalization of count-based exploration;
Exploration in LLMs: RLHF and LLM evaluation (best-of-n, jury voting) are bandit problems (arms = answers, context = prompt).
RLVR (RL from verifiable rewards) uses exploration for reasoning-chain search (verifiable reward = binomial oracle); policy entropy and sampling temperature play the role of the temperature \alpha of SAC (ch. 6) — a topic taken up again in the M2 Large Language Models module.
4.2. Monte-Carlo tree search
The official programme moves from bandits to Monte-Carlo tree search (MCTS), and the link is direct: MCTS treats every node of a search tree as a bandit. It is a planning method — it needs a simulator of the environment (a game engine, a learned model as in section 6.4) — that spends a budget of simulations from the current state and concentrates them on the promising branches.
Definition 4.6 — MCTS: four phases per simulation The tree stores, for each node s and action a, a visit count N(s,a) and a mean return Q(s,a); write N(s) = \sum_a N(s,a). Each simulation runs:
- selection — from the root, descend by choosing in each node the action given by a bandit rule;
- expansion — on reaching a node with an untried action, add the child;
- evaluation — estimate the value of the new leaf by a random rollout to the end of the game, or by a value network;
- backup — propagate the obtained return G along the path: N(s,a) \leftarrow N(s,a) + 1, \qquad Q(s,a) \leftarrow Q(s,a) + \frac{G - Q(s,a)}{N(s,a)}.
After the budget is spent, play the most visited root action (more robust than the highest mean).
Algorithm 4.7 — UCT (Kocsis & Szepesvári, 2006) UCT uses the UCB index of Theorem 4.2 as the selection rule, with the node visit count N(s) in place of t: a = \arg\max_a\ Q(s,a) + c\,\sqrt{\frac{\ln N(s)}{N(s,a)}}.
For a finite-horizon problem and a suitable constant c, the probability of recommending a suboptimal action at the root tends to zero as the number of simulations grows (consistency), and the bias of the root estimate decreases as O(\log n / n).
The difficulty compared with a bandit: the returns observed at an inner node are non-stationary, because the policy below it keeps improving — the analysis handles this drift by induction from the leaves.
AlphaZero’s PUCT replaces the rollout by a value network v_\phi and biases exploration with a policy network p_\phi: a = \arg\max_a Q(s,a) + c\, p_\phi(a\mid s)\,\frac{\sqrt{N(s)}}{1 + N(s,a)} ; the visit distribution at the root then serves as the training target of p_\phi (self-play, section 7.1).
Example 4.8 — One UCT selection step, computed At the root, after N(s) = 8 simulations:
- action a_1 has N = 6, Q = 0.5;
- action a_2 has N = 2, Q = 0.75.
Take c = \sqrt 2, so the bonus is \sqrt{2 \ln N(s) / N(s,a)} with 2\ln 8 \approx 4.159.
- Index of a_1: 0.5 + \sqrt{4.159/6} \approx 0.5 + 0.833 = 1.333.
- Index of a_2: 0.75 + \sqrt{4.159/2} \approx 0.75 + 1.442 = 2.192.
UCT selects a_2 — both because its mean is higher and because it is less explored.
Suppose this simulation returns G = 0: now N(a_2) = 3, Q(a_2) = 0.5, N(s) = 9 and 2\ln 9 \approx 4.394. New indices:
- a_1: 0.5 + \sqrt{4.394/6} \approx 1.356;
- a_2: 0.5 + \sqrt{4.394/3} \approx 1.710.
Equal means, so the less visited a_2 is still preferred; as counts grow the bonuses shrink like 1/\sqrt{N} and the means decide.
5. Policy gradients, actor-critic and gradient-free policy search
Value-based methods learn Q and act greedily, which requires a maximization over the actions — awkward for continuous actions, and unable to represent a deliberately random policy. Policy gradient methods parameterize the policy \pi_\theta directly and climb the gradient of the expected return J(\theta).
5.1. REINFORCE: the proof step by step
Theorem 5.1 — REINFORCE (Williams, 1992), complete proof Let \pi_\theta be differentiable, \tau = (S_0, A_0, \dots, S_{T}) a trajectory of return G(\tau) = \sum_{t=0}^T \gamma^t R_t, and J(\theta) = \mathbb{E}_{\tau \sim \pi_\theta}[G(\tau)]. Then \nabla_\theta J(\theta) = \mathbb{E}_{\tau \sim \pi_\theta}\Big[\Big(\sum_{t=0}^{T} \nabla_\theta \log \pi_\theta(A_t \mid S_t)\Big) G(\tau)\Big].
Proof. Step 1 (law of the trajectory). By the chain rule of probabilities (each transition depends only on (S_t, A_t) — Markov): p_\theta(\tau) = \mu(S_0) \prod_{t=0}^{T-1} \pi_\theta(A_t \mid S_t)\, P(S_{t+1} \mid S_t, A_t).
Step 2 (log-derivative). We differentiate J = \int p_\theta(\tau) G(\tau)\, d\tau permuting derivative and integral (domination): \nabla_\theta J = \int G(\tau)\, \nabla_\theta p_\theta(\tau)\, d\tau = \int p_\theta(\tau)\, G(\tau)\, \nabla_\theta \log p_\theta(\tau)\, d\tau, using the identity \nabla p = p\, \nabla \log p — the log-derivative trick. This is an expectation under \pi_\theta: it can be estimated by Monte-Carlo with trajectories sampled by the current policy.
Step 3 (the dynamics vanish). \log p_\theta(\tau) = \log \mu(S_0) + \sum_t \log \pi_\theta(A_t \mid S_t) + \sum_t \log P(S_{t+1} \mid S_t, A_t), and the first and last terms do not depend on \theta: their gradient is zero. Only the action scores remain: \nabla_\theta J = \mathbb{E}\Big[G(\tau) \sum_t \nabla_\theta \log \pi_\theta(A_t \mid S_t)\Big]. \qquad \blacksquare
Reading: raise the probability of rich trajectories (large G), lower the poor ones — the world model is useless, only the actions are accountable.
Proposition 5.2 — Unbiased baseline: demonstration For every function b : \mathcal{S} \to \mathbb{R} (not depending on the action): \mathbb{E}_{\tau \sim \pi_\theta}\Big[b(S_t)\, \nabla_\theta \log \pi_\theta(A_t \mid S_t)\Big] = 0 \qquad \text{for each } t, so subtracting b does not change \nabla_\theta J.
Proof. Condition on S_t = s (with law d_t(s) under \pi_\theta): \mathbb{E}\big[b(S_t)\, \nabla \log \pi_\theta(A_t \mid S_t)\big] = \sum_s d_t(s)\, b(s) \sum_a \pi_\theta(a \mid s)\, \nabla_\theta \log \pi_\theta(a \mid s).
Now \pi_\theta(a\mid s)\, \nabla_\theta \log \pi_\theta(a\mid s) = \nabla_\theta \pi_\theta(a\mid s) (same identity as in step 2), so the inner sum equals \nabla_\theta \sum_a \pi_\theta(a \mid s) = \nabla_\theta 1 = 0. ∎
Variance analysis. The empirical gradient (G - b)\nabla\log\pi has variance \mathrm{Var}[G \nabla\log\pi] + \mathrm{Var}[b\nabla\log\pi] - 2\,\mathrm{Cov} : choosing b(s) close to \mathbb{E}[G \mid S_t = s] makes the covariance maximal and almost cancels the first order.
The optimal constant baseline (minimizing the variance of the estimator for a given state) equals b^\star = \mathbb{E}\big[G \|\nabla \log \pi\|^2\big] / \mathbb{E}\big[\|\nabla \log \pi\|^2\big] (set to zero the derivative in b of \mathbb{E}\big[(G - b)^2 \|\nabla \log \pi\|^2\big]) — and the natural choice b(s) = V^\pi(s) turns G - b into the advantage A^\pi(s,a) = Q^\pi(s,a) - V^\pi(s): same expectation, drastically reduced variance.
The policy gradient theorem (Sutton et al. 1999) states the result for the discounted objective J(\theta) of Definition 1.1 with \pi = \pi_\theta. It uses the discounted state-visitation distribution of Definition 1.4, d^\pi(s) = (1-\gamma)\sum_{t \geq 0} \gamma^t\, \mathbb{P}_\pi[S_t = s].
Key result — policy gradient theorem \nabla_\theta J(\theta) = \frac{1}{1-\gamma}\, \mathbb{E}_{s \sim d^\pi,\, a \sim \pi}\big[\nabla_\theta\log\pi_\theta(a\mid s)\, Q^\pi(s,a)\big].
The factor 1/(1-\gamma) undoes the normalization of d^\pi; Q^\pi replaces the return G, and A^\pi can replace Q^\pi (Proposition 5.2).
Implementations usually absorb the factor into the step size and sample states along trajectories without the \gamma^t weights, a small bias accepted in practice.
5.2. Actor-critic
Algorithm 5.3 — A2C: semi-gradients Two networks: the actor \pi_\theta and the critic V_w. At each transition: \delta_t = R_{t+1} + \gamma V_w(S_{t+1}) - V_w(S_t) \quad (\text{TD error, chapter 3}), w \leftarrow w + \alpha_w\, \delta_t\, \nabla_w V_w(S_t) \quad (\text{critic: TD(0) semi-gradient}), \theta \leftarrow \theta + \alpha_\theta\, \delta_t\, \nabla_\theta \log \pi_\theta(A_t \mid S_t) \quad (\text{actor: REINFORCE with } \delta_t \text{ as advantage}). We say semi-gradient because the target V_w(S_{t+1}) depends on w but is not differentiated (the true gradient of the TD loss would bring the unstable “double sampling” — cf. deadly triad, ch. 3). Two step scales \alpha_w \gg \alpha_\theta (the critic must keep up); the estimated advantage \hat A_t = \delta_t is replaced in practice by GAE (Proposition 3.4). A3C (Mnih et al., 2016): parallel actors explore independent environments and push their gradients to a shared parameter — asynchronous hence without replay; A2C is its synchronized (batched) variant, simpler and equivalent in performance.
5.3. From trust region to PPO
Proposition 5.4 — Natural gradient and TRPO (sketch) The relevant geometry on policies is the KL divergence, not the Euclidean distance on \theta (a reparameterization changes the algorithm).
The natural gradient corrects this: \tilde\nabla J = F(\theta)^{-1} \nabla_\theta J, where F(\theta) = \mathbb{E}_{s \sim d^\pi,\, a \sim \pi_\theta}\big[\nabla_\theta\log\pi_\theta(a \mid s)\, \nabla_\theta\log\pi_\theta(a \mid s)^\top\big] is the Fisher matrix.
Kakade & Langford (2002) prove a monotone improvement, extended to arbitrary policies by Schulman et al. (2015). The gain J(\pi') - J(\pi) of any new policy \pi' is lower-bounded by the one-step surrogate gain \frac{1}{1-\gamma}\,\mathbb{E}_{s \sim d^\pi, a \sim \pi}\Big[ \frac{\pi'(a\mid s)}{\pi(a\mid s)}\, A^\pi(s,a)\Big] minus a penalty term in \max_s \mathrm{KL}(\pi(\cdot\mid s) \,\|\, \pi'(\cdot\mid s)). The surrogate uses the old distribution d^\pi in place of d^{\pi'}, which is why it is faithful only near \pi.
TRPO (Schulman et al., 2015) maximizes this surrogate over \pi_\theta, with \pi = \pi_{\theta_\text{old}}, under a trust-region constraint \mathbb{E}_{s \sim d^{\pi_{\theta_\text{old}}}}\big[\mathrm{KL}\big(\pi_{\theta_\text{old}}(\cdot \mid s) \,\|\, \pi_\theta(\cdot \mid s)\big)\big] \leq \delta . It is solved approximately by a conjugate-gradient computation of the natural-gradient direction followed by a line search — effective but heavy.
Theorem 5.5 — PPO-clip (Schulman et al., 2017): a pessimistic bound of the surrogate With the importance ratio \rho_t(\theta) = \frac{\pi_\theta(a_t \mid s_t)}{\pi_{\theta_\text{old}}(a_t \mid s_t)} and the advantage \hat A_t (GAE): L^{\mathrm{CLIP}}(\theta) = \mathbb{E}_t\big[\min\big(\rho_t(\theta)\, \hat A_t,\ \ \mathrm{clip}(\rho_t(\theta), 1{-}\epsilon, 1{+}\epsilon)\, \hat A_t\big)\big].
Proof. PPO-clip lower-bounds the importance surrogate L^{\mathrm{IS}} = \mathbb{E}[\rho_t \hat A_t], point by point:
- if \hat A_t > 0 (good action): the minimum is at most \rho_t \hat A_t trivially, and the clip caps the incentive at 1 + \epsilon: no motivation to blow up the probability of an already rewarded action;
- if \hat A_t < 0 (bad action):
- if \rho_t \geq 1 - \epsilon, the min equals \rho_t \hat A_t (equality);
- if \rho_t < 1 - \epsilon, the min equals (1-\epsilon)\hat A_t \leq \rho_t \hat A_t (since \hat A_t < 0 and 1 - \epsilon > \rho_t): the gradient vanishes — one does not “over-punish” beyond the region.
So L^{\mathrm{CLIP}} \leq L^{\mathrm{IS}}: maximizing the pessimistic bound of a valid approximation of the true gain (Proposition 5.4) — an improvement of the lower bound cannot destroy the policy, hence the monotone improvement intuition without explicit KL constraint or second derivative; the clipping suffices to keep the ratios in the region where the surrogate is faithful. ∎
Implementation details: a few epochs of gradient ascent per batch of trajectories, normalized advantages, entropy bonus, masking of truncated trajectories. PPO is the method behind LLM alignment (RLHF/PPO, then GRPO — cf. M2 Large Language Models module, post-training chapter; the importance ratio there is exactly the same object, applied to tokens).
# REINFORCE with baseline skeleton (PyTorch, CartPole problem)
logits = policy_net(states) # (B, n_actions)
dist = torch.distributions.Categorical(logits=logits)
actions = dist.sample()
logp = dist.log_prob(actions)
returns = compute_returns(rewards, gamma) # G_t
advantage = returns - value_net(states).squeeze(-1) # learned baseline
loss = -(logp * advantage.detach()).mean() + 0.5 * advantage.pow(2).mean()
optimizer.zero_grad(); loss.backward(); optimizer.step()
# PPO: on a stored batch (states, actions, logp_old, returns, adv_gae), use instead
# logp = dist.log_prob(actions) # stored actions under the current policy
# ratio = torch.exp(logp - logp_old) # rho_t(theta); logp_old stored, no gradient
# adv = adv_gae.detach() # precomputed GAE advantages (Prop. 3.4)
# l1 = ratio * adv; l2 = torch.clamp(ratio, 1-eps, 1+eps) * adv
# v_loss = (returns - value_net(states).squeeze(-1)).pow(2).mean() # critic regresses on returns
# loss = -torch.min(l1, l2).mean() + 0.5 * v_loss - 0.01 * dist.entropy().mean()5.4. Gradient-free and evolutionary policy search
The official programme devotes a week to autonomous agents seen as optimization problems, with a focus on methods for direct policy search that do not differentiate the policy at all. They treat \theta \mapsto J(\theta) as a black box that can only be evaluated, noisily, by running episodes — which is enough to optimize it.
Algorithm 5.6 — Cross-entropy method (CEM) Keep a Gaussian search distribution \mathcal{N}(\mu, \mathrm{diag}(\sigma^2)) over policy parameters. At each generation: sample \theta_1, \dots, \theta_N; evaluate each by the return of a few episodes; keep the elite (the best fraction \rho, e.g. 10\%); refit \mu and \sigma to the elite by maximum likelihood (their mean and standard deviation). The distribution contracts around good regions. CMA-ES refines the idea by adapting a full covariance matrix. CEM is also the standard optimizer of action sequences in model-predictive control (section 6.4).
Proposition 5.7 — Evolution strategies estimate a smoothed gradient Let J_\sigma(\theta) = \mathbb{E}_{\varepsilon \sim \mathcal{N}(0, I)}[J(\theta + \sigma\varepsilon)] be the Gaussian-smoothed objective. Then \nabla_\theta J_\sigma(\theta) = \frac{1}{\sigma}\, \mathbb{E}_{\varepsilon}\big[J(\theta + \sigma\varepsilon)\, \varepsilon\big], estimated by \frac{1}{N\sigma}\sum_i J(\theta + \sigma\varepsilon_i)\,\varepsilon_i , with no derivative of J (Salimans et al., 2017).
Proof. Write x = \theta + \sigma\varepsilon, so x \sim \mathcal{N}(\theta, \sigma^2 I) with density \varphi_\theta(x) \propto \exp(-\|x - \theta\|^2 / 2\sigma^2) and J_\sigma(\theta) = \int J(x)\,\varphi_\theta(x)\,dx.
Differentiate under the integral and use the log-derivative trick of Theorem 5.1: \nabla_\theta \varphi_\theta(x) = \varphi_\theta(x)\,\nabla_\theta \log\varphi_\theta(x) = \varphi_\theta(x)\,\frac{x - \theta}{\sigma^2}. Hence \nabla_\theta J_\sigma = \mathbb{E}\big[J(x)\,\frac{x - \theta}{\sigma^2}\big] = \mathbb{E}\big[J(\theta + \sigma\varepsilon)\,\frac{\varepsilon}{\sigma}\big]. ∎
Reading: REINFORCE perturbs the actions and differentiates their log-probability; ES perturbs the parameters and differentiates the log-density of the search distribution — the same identity, applied in parameter space.
Subtracting a baseline (Proposition 5.2) and using antithetic pairs \pm\varepsilon_i reduce the variance. ES needs no backpropagation and is indifferent to long delays between action and reward; workers only exchange scalar returns, so it parallelizes over thousands of CPUs. Its price is a sample cost that grows with the dimension of \theta.
Example 5.8 — The ES gradient on a quadratic Take J(\theta) = -(\theta - 3)^2 in one dimension. Expanding, J(\theta + \sigma\varepsilon) = -(\theta - 3)^2 - 2\sigma(\theta - 3)\varepsilon - \sigma^2\varepsilon^2 . Multiply by \varepsilon and take expectations with \mathbb{E}[\varepsilon] = \mathbb{E}[\varepsilon^3] = 0, \qquad \mathbb{E}[\varepsilon^2] = 1 : \mathbb{E}[J(\theta + \sigma\varepsilon)\varepsilon] = -2\sigma(\theta - 3), so the ES gradient equals -2(\theta - 3), the exact derivative, whatever \sigma.
Here J_\sigma = J - \sigma^2 differs from J by a constant; on a rugged objective, smoothing with a larger \sigma really changes the landscape and helps jump over narrow local optima.
Other optimization settings named by the programme
- Stochastic: J is only observed through noisy returns — every method of this course lives there.
- Multi-objective: the return is a vector J(\theta) \in \mathbb{R}^m (speed and energy, reward and safety); \theta dominates \theta' if it is at least as good on every objective and strictly better on one, and the goal is the Pareto front of non-dominated policies. A linear scalarization w^\top J only reaches the convex part of that front, which is why evolutionary algorithms that keep a whole population (NSGA-II) are popular here.
- Multimodal: J has several local optima; population methods and the Gaussian smoothing of Example 5.8 explore several basins at once, where a single gradient ascent stays in the first one.
- Constrained: maximize the return under a cost budget — the constrained MDP of section 6.2.
- Dynamic: the objective drifts over time, the setting of section 8.2.
Architecture search as policy search The programme also mentions architecture search.
In Zoph & Le (2017), a recurrent controller emits an architecture token by token (layer types, widths); the reward is the validation accuracy of the trained child network, and the controller is updated with REINFORCE (Theorem 5.1) — a one-step episode with a discrete action sequence. Real et al. (2019) obtained comparable architectures with a simple evolutionary method (regularized evolution), the gradient-free counterpart above. Both show that “search over designs” is a sequential decision problem.
5.5. Neural combinatorial optimisation: routing as policy search
Logistics problems — vehicle routing, dispatch, scheduling — are combinatorial: a solution is a sequence of discrete choices. Building it is therefore a one-episode MDP, and a policy network trained by REINFORCE becomes a fast heuristic solver that generalizes across instances.
Definition 5.9 — Constructive policy for the travelling salesman problem An instance is a set of n cities x_1, \dots, x_n \in [0,1]^2. A policy builds a tour \pi = (\pi_1, \dots, \pi_n) one city at a time, the cities already visited being masked out: p_\theta(\pi \mid x) = \prod_{t=1}^{n} p_\theta(\pi_t \mid x, \pi_{<t}). The state is the partial tour, the action the next city, and the cost is the tour length L(\pi) = \sum_{t=1}^{n} \|x_{\pi_{t+1}} - x_{\pi_t}\|_2, \qquad \pi_{n+1} = \pi_1 .
In the Attention Model (Kool, van Hoof & Welling, 2019), a transformer encoder without positional encoding embeds the cities — the instance is a set, so the encoder is permutation-equivariant — and a decoder attends from the current context (graph embedding, first and last city) to the unvisited cities.
Algorithm 5.10 — REINFORCE with a greedy-rollout baseline (Kool et al., 2019) For a batch of random instances, sample tours \pi \sim p_\theta(\cdot \mid x) and descend the gradient of the expected length (Theorem 5.1 with a one-step episode): \nabla_\theta\, \mathbb{E}_{\pi \sim p_\theta}[L(\pi)] = \mathbb{E}\big[(L(\pi) - b(x))\, \nabla_\theta \log p_\theta(\pi \mid x)\big]. The baseline b(x) is the length of the greedy tour decoded by a frozen copy of the best policy so far; the copy is replaced when a paired t-test on fresh instances shows a significant improvement.
The baseline depends on the instance, not on the sampled tour, so the gradient stays unbiased (Proposition 5.2): a tour is reinforced when it beats the policy’s own greedy answer on the same instance.
POMO (Kwon et al., 2020) exploits a symmetry of the TSP: a tour can start from any of its n cities. It samples N = n tours per instance, each forced to start at a different city, and uses their mean length as a shared baseline.
This baseline needs no extra rollout. Since the N tours are sampled independently, it only rescales the expected gradient by (N-1)/N.
The same estimator, with capacities and time windows added to the mask, trains vehicle-routing policies: this is the entry point for the fleet-dispatch subject (Y1.2) and the language-driven dispatcher of Year 2. Exercise 17 trains a TSP-20 policy.
6. Deep RL and advanced methods: DQN, continuous control, offline, distributional, model-based, imitation
The tabular methods of ch. 3 store one value per state-action pair, which is impossible for Atari screens or robot joints. Deep RL replaces the table by a neural network — and thereby meets the deadly triad of ch. 3.
This chapter presents the stabilizers that make it work, the extensions to continuous actions, and learning from a fixed dataset; sections 6.3–6.6 then cover the advanced families named by the official programme: distributional RL, model-based RL and planning, imitation and inverse RL, and decision transformers.
Several of these methods, and the RLHF of the LLM course, regularize a policy toward a reference one. One lemma gives their optimum over unrestricted policies; we state it once here.
Lemma — KL-regularised policy improvement Let \pi_0 be a reference distribution over actions (or answers) a, r a bounded reward and \beta > 0. Over all distributions \pi, the problem \max_\pi\ \mathbb{E}_{a \sim \pi}[r(a)] - \beta\,\mathrm{KL}(\pi \,\|\, \pi_0) has the unique solution \pi^\star(a) = \frac{\pi_0(a)\, e^{r(a)/\beta}}{Z}, \qquad Z = \sum_a \pi_0(a)\, e^{r(a)/\beta}, and its optimal value is \beta \log Z.
Proof. Take \pi with \mathrm{KL}(\pi \,\|\, \pi_0) < \infty. Taking logarithms in the definition of \pi^\star gives r = \beta \log\frac{\pi^\star}{\pi_0} + \beta \log Z . Substituting, \mathbb{E}_\pi[r] - \beta\,\mathrm{KL}(\pi \,\|\, \pi_0) = \beta\,\mathbb{E}_\pi\Big[\log\frac{\pi^\star}{\pi_0} - \log\frac{\pi}{\pi_0}\Big] + \beta\log Z = \beta\log Z - \beta\,\mathrm{KL}(\pi \,\|\, \pi^\star). By Gibbs’ inequality, the KL divergence is nonnegative and vanishes only at \pi = \pi^\star (Machine Learning, Proposition 0.8). The maximum is therefore \beta\log Z, reached only at \pi^\star. ∎
Two readings of the lemma recur across the program.
- SAC (Algorithm 6.4) takes \pi_0 uniform over \mathcal{A} and \beta = \alpha. Since the KL to the uniform policy is \log|\mathcal{A}| - \mathcal{H}(\pi), the entropy bonus is a KL penalty, and the optimum is the softmax \pi^\star \propto e^{Q/\alpha}.
- RLHF takes \pi_0 = \pi_{\mathrm{ref}} and r = r_\phi(x, \cdot), which gives \pi^\star \propto \pi_{\mathrm{ref}} e^{r_\phi/\beta}: step 1 of the DPO derivation.
This is the canonical statement of the lemma on the site: Large Language Models, ch. 5 and Control in Generative AI, ch. 5 (Theorem 5.1) recall it.
Algorithm 6.1 — DQN (Mnih et al., 2015) Q-learning where Q(s, a; \theta) is a network; stabilized by:
- experience replay: resampling past transitions (breaks the temporal correlation and approaches the i.i.d. assumption of SGD);
- target network \theta^- frozen and periodically synchronized: target y = r + \gamma \max_{a'} Q(s', a'; \theta^-) (avoids chasing a moving target — the deadly triad, ch. 3);
- loss \big(y - Q(s, a; \theta)\big)^2.
# Minimal DQN (PyTorch) -- the three stabilizers in evidence
replay = deque(maxlen=100_000) # 1. experience replay
def train_step(batch=128, gamma=0.99):
s, a, r, s2, done = sample(replay, batch)
with torch.no_grad(): # 2. target network (frozen theta^-)
y = r + gamma * (1 - done) * target_net(s2).max(1).values
q = policy_net(s).gather(1, a).squeeze(1)
loss = F.smooth_l1_loss(q, y) # 3. TD loss (Huber, more robust)
optimizer.zero_grad(); loss.backward()
torch.nn.utils.clip_grad_norm_(policy_net.parameters(), 10)
optimizer.step()
# Double DQN (algorithm 3.6): replace the 'y' line with
# a2 = policy_net(s2).argmax(1, keepdim=True) # selection: current network
# y = r + gamma * (1 - done) * target_net(s2).gather(1, a2).squeeze(1) # evaluation: targetAlgorithm 6.2 — Rainbow (Hessel et al., 2018): six ingredients Rainbow combines six independent improvements of DQN, each attacking a precise weakness:
| Ingredient | Idea | Fixes |
|---|---|---|
| Double Q-learning | decouple selection/evaluation (Algorithm 3.6) | overestimation bias (Th. 3.5) |
| Prioritized replay | sample transitions proportionally to the TD error |\delta| | uniform replay |
| Dueling architecture | two heads V(s) and A(s,a), recombined Q = V + A - \mathrm{avg}_a A | similar actions, state/value generalization |
| Multi-step (n-step) | target with the G^{(n)} return (Def. 3.3), typically n=3 | slow reward propagation |
| Distributional (C51) | predict the distribution of Z(s,a) over 51 atoms, projected cross-entropy | signal variance, richer learning |
| Noisy nets | noisy biases/weights, explored by the learned noise itself | crude \varepsilon-greedy |
Rainbow’s main contribution is to show that the gains compose: on the 57 Atari games, the combination matches the final performance of DQN after about 7M frames (DQN was trained for 200M) and outperforms every individual variant within 44M frames.
Prioritized experience replay and its bias correction Uniform replay wastes updates on transitions the network already predicts well. Prioritized replay (Schaul et al., 2016) samples transition i with probability P(i) = \frac{p_i^{\alpha}}{\sum_k p_k^{\alpha}}, \qquad p_i = |\delta_i| + \epsilon, where \delta_i is its last TD error and \alpha \in [0,1] interpolates between uniform (\alpha = 0) and greedy prioritization.
Sampling non-uniformly changes the distribution the loss is averaged over, which biases the fixed point; the correction is an importance weight (Proposition 0.9) w_i = \big(N\,P(i)\big)^{-\beta} / \max_j w_j multiplying the loss of transition i, with \beta annealed to 1 by the end of training, when unbiasedness matters most.
Priorities are updated with the new |\delta_i| after each use; a sum-tree gives O(\log N) sampling.
6.1. Continuous actions: DDPG and SAC
Algorithm 6.3 — DDPG (Lillicrap et al., 2016) The \max_a is impossible in continuous spaces; DDPG learns two networks: a critic Q_w(s,a) and a deterministic actor \mu_\theta(s) trained by the deterministic policy gradient \nabla_\theta J = \mathbb{E}\big[\nabla_a Q_w(s, a)\big|_{a = \mu_\theta(s)}\, \nabla_\theta \mu_\theta(s)\big] — the max of Q-learning is replaced by gradient ascent of Q through the actor.
Off-policy (replay + targets), but fragile: the Q/actor pair can settle on erroneous maxima of Q (overestimation, again); TD3 adds double Q and noisy targets.
Algorithm 6.4 — SAC: maximum entropy, derivation SAC (Haarnoja et al., 2018) maximizes the return and the entropy: J(\pi) = \mathbb{E}\Big[\sum_t \gamma^t \big(r_t + \alpha\, \mathcal{H}(\pi(\cdot \mid S_t))\big)\Big], \qquad \mathcal{H}(\pi) = -\mathbb{E}_{a \sim \pi}[\log \pi(a \mid s)].
Proof. Optimal softmax policy. For a fixed Q, let us maximize F(\pi) = \mathbb{E}_{a\sim\pi}[Q(s,a)] + \alpha \mathcal{H}(\pi(\cdot\mid s)) over distributions. Set \pi^\star(a\mid s) \propto \exp(Q(s,a)/\alpha), with normalization constant Z(s) = \sum_a e^{Q(s,a)/\alpha}. Then: F(\pi) = -\alpha\, \mathbb{E}_\pi\Big[\log \frac{\pi(a\mid s)}{\pi^\star(a\mid s)}\Big] + \alpha \log Z(s) = -\alpha\, \mathrm{KL}(\pi \,\|\, \pi^\star) + \alpha\log Z(s), (identification by expanding \log \pi^\star = Q/\alpha - \log Z).
The unique maximum is attained at \pi = \pi^\star, with value \alpha \log Z(s): the optimal policy weights the actions by a softmax of temperature \alpha of the Q-values — exploring is literally optimal in this criterion. This is the KL-regularised lemma that opens the chapter, with a uniform \pi_0 and \beta = \alpha.
“Soft” Bellman operator. The target equation becomes Q^\star(s,a) = r(s,a) + \gamma\, \mathbb{E}_{s'}[V(s')] with the soft value V(s') = \alpha \log \sum_{a'} e^{Q(s',a')/\alpha} — the max is replaced by a log-sum-exp of temperature \alpha; the log-sum-exp is 1-Lipschitz for \|\cdot\|_\infty, so \mathcal{T}_{\mathrm{soft}} remains a \gamma-contraction: the whole theory of chapter 1 survives. ∎
Auto-learned temperature \alpha. \alpha tunes the exploration/exploitation trade-off; SAC treats it by a Lagrangian: minimize J(\alpha) = \mathbb{E}[-\alpha \log \pi(a\mid s)] - \alpha\, \bar{\mathcal{H}}, where \bar{\mathcal{H}} is the target entropy: \alpha rises when the actual entropy falls below the target (forced exploration), falls otherwise.
Implementation: three networks (actor + two critics, min against overestimation), reparameterization to backpropagate through sampling, and no GAE (off-policy, one-step targets). SAC is the standard for continuous environments (robotics, control).
6.2. Offline RL and sim-to-real
Offline RL (batch learning): the distribution shift Data: a fixed dataset \mathcal{D} of transitions (teleoperator, logs, simulator); no interaction. The danger: Q is evaluated on out-of-distribution actions (never tried in \mathcal{D}); the \max_{a'} of Q-learning queries the network where it has seen nothing — uncorrected overestimation (Theorem 3.5, aggravated).
Conservative Q-Learning (Kumar et al., 2020, sketch): regularize Q so that it is low on out-of-dataset actions and high on dataset actions: \mathcal{L}(\theta) = \mathbb{E}_{\mathcal{D}}\big[(y - Q_\theta)^2\big] + \alpha\Big(\mathbb{E}_{a' \sim \pi, s' \sim \mathcal{D}}[Q_\theta(s', a')] - \mathbb{E}_{(s,a) \sim \mathcal{D}}[Q_\theta(s,a)]\Big).
The policy is then extracted from the regularized Q — it no longer dares to leave the support of the data. Other approaches: BCQ (restricting to actions close to the data), IQL (expectile regression, no out-of-support query).
Offline RL is the bridge toward RLHF: learning a reward/policy from fixed preferences is an offline problem (cf. M2 LLMs module).
Sim-to-real In robotics, training happens in a simulator (cheap, parallelizable) then transfers to the real robot — whose dynamics differ (friction, latency, sensors). Tools: domain randomization (randomizing mass/friction/texture to make the policy robust to discrepancies, Tobin et al., 2017), system identification, online adaptation (short real fine-tuning). The unifying theme: robustness to model errors — the same tension as the 1/(1-\gamma) error propagation of Proposition 2.4.
Definition 6.5 — Safe RL: constrained MDPs Safety, the other concrete challenge named by the programme alongside transfer, is most often formalized as a constrained MDP: besides the reward r, a cost c(s,a) \geq 0 (collision, constraint violation) with discounted total J_c(\pi), and the problem \max_\pi J_r(\pi) \quad \text{subject to} \quad J_c(\pi) \leq d .
The Lagrangian \mathcal{L}(\pi, \lambda) = J_r(\pi) - \lambda\big(J_c(\pi) - d\big), \qquad \lambda \geq 0, is solved by primal-dual updates: the policy maximizes r - \lambda c with any algorithm of this course, while \lambda rises when the cost exceeds the budget and decreases otherwise — the same mechanism as SAC’s automatic temperature (Algorithm 6.4).
Optimal policies of a constrained MDP may need to be stochastic, unlike Proposition 1.2.
LLGA cross-references Off-policy vs on-policy (DQN reuses the whole past, PPO discards after one batch): exactly the sample-efficiency/stability trade-off found again in LLM post-training — cf. M2 Large Language Models module. Multi-worker distributed RL (A3C, IMPALA) is a special case of distributed SGD — cf. Emerging Subjects in ML module, chapter 2. High-dimensional exploration (count-based, RND) is treated in chapter 4.
6.3. Distributional RL
Q-learning predicts the mean return. Two actions with the same mean can carry very different risks, and learning the whole distribution also gives the network a richer training signal — the C51 line of Rainbow’s table.
Definition 6.6 — Return distribution and distributional Bellman operator Let Z^\pi(s,a) be the random discounted return obtained from (s,a) under \pi, so that Q^\pi(s,a) = \mathbb{E}[Z^\pi(s,a)]. It satisfies the distributional Bellman equation, an equality in distribution: Z^\pi(s,a) \overset{D}{=} R(s,a) + \gamma\, Z^\pi(S', A'), \qquad S' \sim P(\cdot\mid s,a),\ A' \sim \pi(\cdot \mid S'). The operator \mathcal{T}^\pi maps a collection of return distributions to the distribution of the right-hand side.
Theorem 6.7 — Contraction in Wasserstein distance (Bellemare, Dabney & Munos, 2017) For p \geq 1, let \bar d_p(Z_1, Z_2) = \sup_{s,a} W_p\big(Z_1(s,a), Z_2(s,a)\big), the worst-case p-Wasserstein distance. Then \bar d_p(\mathcal{T}^\pi Z_1, \mathcal{T}^\pi Z_2) \leq \gamma\, \bar d_p(Z_1, Z_2) : policy evaluation converges in distribution, as Theorem 1.6 guaranteed for the mean.
Proof idea: couple the two right-hand sides with the same R, S', A'; adding the same R does not change the Wasserstein distance, and scaling by \gamma multiplies it by \gamma.
The control operator (with a greedy A') is not a contraction in general — only its mean is — which is why practical algorithms are judged empirically.
In practice the distribution is parameterized. C51 puts probability masses on 51 fixed atoms z_j evenly spaced in [V_{\min}, V_{\max}], projects the shifted target r + \gamma z_j back onto the atoms, and minimizes a cross-entropy; KL is not a contraction for \mathcal{T}^\pi, but the projection makes the algorithm work well.
QR-DQN (Dabney et al., 2018) instead learns N quantiles with the quantile-regression loss, which directly minimizes a Wasserstein-1 error.
Example 6.8 — Same mean, different risk In a one-step problem, action a_1 returns 1 surely; action a_2 returns 0 or 2 with probability \tfrac12 each.
Q-learning sees Q(a_1) = Q(a_2) = 1 and cannot choose. The distributions differ: \mathrm{Var}[Z(a_1)] = 0, \qquad \mathrm{Var}[Z(a_2)] = 1 .
A risk-averse agent maximizing the \mathrm{CVaR}_{0.5} (mean of the worst half of outcomes) gets 1 for a_1 and 0 for a_2 and picks a_1 — a decision that only a distributional critic can support.
Lab sheet — session 10: C51 versus DQN on a risky toy MDP Goal. Watch two learners agree on the means and disagree on the risk. The MDP extends Example 6.8 to several steps, undiscounted (\gamma = 1, episodes end at the goal).
- From the start, the road takes three steps and returns 8 surely.
- The bridge takes two steps and returns 9, except for a fall worth -11 with probability 0.04.
- The bridge has the higher mean, 8.2, and a much heavier left tail.
The skeleton learns a Q-table (the DQN target without a network) and a tabular C51 with 51 atoms on [-15, 15], both with sample-average steps and \varepsilon-greedy exploration.
import numpy as np
rng = np.random.default_rng(0)
# Risky toy MDP: from s=0, "road" (a=0) takes 3 steps of -1 then +10 at the goal;
# "bridge" (a=1) takes 1 step of -1, then +10 w.p. 0.96 or a fall worth -10 w.p. 0.04.
def step(s, a): # returns s', r, done
if s == 0: return (1, -1.0, False) if a == 0 else (3, -1.0, False)
if s == 1: return 2, -1.0, False
if s == 2: return 4, 10.0, True
return (4, 10.0, True) if rng.random() > 0.04 else (4, -10.0, True)
S, A, N, vmin, vmax = 5, 2, 51, -15.0, 15.0
z = np.linspace(vmin, vmax, N); dz = z[1] - z[0]
P = np.zeros((S, A, N)); P[:, :, N // 2] = 1.0 # C51: one categorical law per (s, a), Dirac at 0
Q = np.zeros((S, A)); n = np.zeros((S, A)) # Q-learning: the DQN target without a network
def project(r, done, probs): # distributional Bellman target on the atoms
b = (np.clip(r + (0.0 if done else 1.0) * z, vmin, vmax) - vmin) / dz
lo, hi = np.floor(b).astype(int), np.ceil(b).astype(int)
m = np.zeros(N)
np.add.at(m, lo, probs * (hi - b + (lo == hi))); np.add.at(m, hi, probs * (b - lo))
return m
def cvar(probs, alpha=0.1): # mean of the worst alpha fraction of returns
c = np.cumsum(probs); w = np.minimum(c, alpha) - np.minimum(c - probs, alpha)
return (w * z).sum() / alpha
for episode in range(20000):
s, done = 0, False
while not done:
a = rng.integers(A) if rng.random() < 0.3 else int(Q[s].argmax()) # epsilon-greedy
s2, r, done = step(s, a); n[s, a] += 1; lr = 1.0 / n[s, a] # sample-average step
Q[s, a] += lr * (r + (0.0 if done else Q[s2].max()) - Q[s, a])
a2 = int((P[s2] @ z).argmax()) # greedy on the mean
P[s, a] = (1 - lr) * P[s, a] + lr * project(r, done, P[s2, a2])
s = s2
print("Q-learning Q(0,.) :", Q[0].round(2))
print("C51 means at s=0 :", (P[0] @ z).round(2))
print("C51 CVaR_0.1 at s=0:", [round(float(cvar(P[0, a])), 2) for a in range(A)])Tasks.
- Run the skeleton: Q-learning and C51 learn the same means at the start state, and both prefer the bridge.
- Plot the two learned return distributions at the start. Explain why the categorical projection spreads the sure return of the road over neighbouring atoms without changing its mean.
- Compute the \mathrm{CVaR}_{0.1} of each action and the choice of a risk-averse agent. Evaluate both policies by Monte Carlo: mean and CVaR of 10^4 returns.
- Replace the tables by networks — the DQN code above, and a C51 head with 51 logits per action — and keep the same evaluation over 5 seeds.
- Discuss the caveat: acting greedily on the CVaR at every step is not CVaR-optimal in general (time inconsistency); here only the first decision matters.
6.4. Model-based RL and planning
The methods of chapters 3, 5 and 6 so far are model-free: they never estimate P or r. Model-based RL learns a model \hat M = (\hat P, \hat r) from transitions — an ordinary supervised regression on (s,a) \mapsto (s', r) — and then plans in it, reusing the dynamic programming of chapter 2 or the tree search of section 4.2.
Interactions with the real environment are expensive; computations in the model are cheap.
Definition 6.9 — Dyna and model-predictive control Dyna (Sutton, 1990): after each real transition, update Q with it, update the model, then perform k extra Q-learning updates on transitions simulated by the model.
Model-predictive control (MPC): at each step, optimize a sequence of H actions in the model, \max_{a_t, \dots, a_{t+H-1}}\ \sum_{k=0}^{H-1} \gamma^k\, \hat r(s_{t+k}, a_{t+k}), \qquad s_{t+k+1} \sim \hat P(\cdot \mid s_{t+k}, a_{t+k}), execute only the first action, observe the true next state and re-plan.
The inner optimization is done by random shooting or by CEM (Algorithm 5.6); re-planning corrects model errors before they accumulate.
Proposition 6.10 — Simulation lemma: how model errors cost value Let rewards lie in [0, R_{\max}]. If for all (s,a), |\hat r(s,a) - r(s,a)| \leq \varepsilon_r \quad\text{and}\quad \|\hat P(\cdot\mid s,a) - P(\cdot\mid s,a)\|_1 \leq \varepsilon_P , then for every policy \pi, \big\|\hat V^\pi - V^\pi\big\|_\infty \;\leq\; \frac{\varepsilon_r}{1-\gamma} + \frac{\gamma\, \varepsilon_P\, R_{\max}}{(1-\gamma)^2}.
Proof. Subtract the Bellman equations (Theorem 1.5) of the two models: \hat V^\pi - V^\pi = (\hat r^\pi - r^\pi) + \gamma \hat P^\pi(\hat V^\pi - V^\pi) + \gamma(\hat P^\pi - P^\pi)V^\pi .
Take sup norms, using \|\hat P^\pi x\|_\infty \leq \|x\|_\infty and |(\hat P^\pi - P^\pi)V^\pi(s)| \leq \varepsilon_P\, \|V^\pi\|_\infty \leq \varepsilon_P R_{\max}/(1-\gamma) : with \Delta = \|\hat V^\pi - V^\pi\|_\infty, \Delta \leq \varepsilon_r + \gamma\Delta + \gamma\varepsilon_P R_{\max}/(1-\gamma) ; solve for \Delta. ∎
Reading: a model error is amplified by 1/(1-\gamma)^2, one factor more than the value error of Proposition 2.4 — long imagined rollouts drift, and the planner exploits model errors (it finds actions that look good only in the model). Short horizons, ensembles of models with an uncertainty penalty, and re-planning are the standard remedies.
Learned world models Modern model-based agents learn the model in a latent space: Dreamer learns a recurrent latent dynamics model from images and trains an actor-critic entirely on imagined trajectories; MuZero learns a latent model that only predicts rewards, values and policies, and plans in it with the MCTS of section 4.2 — matching AlphaZero without being given the rules. This is the “learning representations for sequential modeling and planning” theme of the official programme.
6.5. Imitation learning and inverse RL
When a reward is hard to write but an expert can demonstrate the task (driving, surgery, a dialogue), one learns from demonstrations \mathcal{D}_E = \{(s_i, a_i)\} produced by an expert policy \pi_E.
Definition 6.11 — Behavioural cloning and DAgger Behavioural cloning fits \pi_\theta to \mathcal{D}_E by supervised learning (maximum likelihood of a_i given s_i). DAgger (Ross, Gordon & Bagnell, 2011): run the current learned policy, ask the expert to label the states it visits, add these pairs to the dataset, retrain, and repeat.
Theorem 6.12 — Compounding errors (Ross & Bagnell, 2010) Over a horizon T with per-step cost in [0,1], if the cloned policy errs with probability \varepsilon on states drawn from the expert’s distribution, its total cost can exceed the expert’s by order \varepsilon T^2; DAgger reduces this to order \varepsilon T (up to the no-regret term).
Intuition: the first mistake brings the agent to states the expert never visited, where the cloned policy has no training data and keeps erring; a mistake at time t can cost up to the T - t remaining steps, and summing \varepsilon\,(T - t) over t gives \approx \varepsilon T^2/2. DAgger trains on the learner’s own state distribution, which removes the mismatch (covariate shift).
Lab sheet — session 11: behavioural cloning versus DAgger Goal. Watch Theorem 6.12 happen. A car keeps its lane in a side wind and the expert steers back as soon as it drifts.
The learner is a table over 300 cells of the lateral offset, and does nothing in a cell it has never seen — a crude stand-in for a network that extrapolates badly. Both learners receive the same budget of 2000 expert labels.
import numpy as np
rng = np.random.default_rng(0)
# Lane keeping in a side wind: x = lateral offset, actions u in {-1, 0, +1}, off-road when |x| > 1.
def step(x, u): return x + 0.1 * u + 0.03 + 0.03 * rng.standard_normal()
def expert(x): return -1 if x > 0.05 else (1 if x < -0.25 else 0)
NC = 300; edges = np.linspace(-3, 3, NC + 1) # tabular learner: cells of width 0.02
def cell(x): return int(np.clip(np.digitize(x, edges) - 1, 0, NC - 1))
def fit(data): # majority expert label in each cell
counts = np.zeros((NC, 3))
for x, u in data: counts[cell(x), u + 1] += 1
seen = counts.sum(1) > 0
return lambda x: int(counts[cell(x)].argmax()) - 1 if seen[cell(x)] else 0 # unseen: do nothing
def rollout(policy, T): # returns (steps off-road, expert-labelled states)
x, cost, labelled = 0.0, 0, []
for _ in range(T):
labelled.append((x, expert(x))) # the expert labels the states *visited*
x = step(x, policy(x)); cost += abs(x) > 1
return cost, labelled
T, budget = 200, 2000 # horizon, number of expert labels
bc_data = sum((rollout(expert, T)[1] for _ in range(budget // T)), [])
bc = fit(bc_data) # behavioural cloning
data = rollout(expert, T)[1]; dagger = fit(data)
while len(data) < budget: # DAgger: run the learner, label, aggregate
data += rollout(dagger, T)[1]; dagger = fit(data)
for name, pi in [("expert", expert), ("BC", bc), ("DAgger", dagger)]:
off = np.mean([rollout(pi, T)[0] for _ in range(200)]) / T
print(f"{name:7s} fraction of steps off-road: {off:.3f}")Tasks.
- Run the skeleton over 5 seeds. Behavioural cloning leaves the road in a seed-dependent fraction of steps; DAgger and the expert stay on it.
- Plot the offsets visited by the expert, BC and DAgger: where does BC leave the expert’s support, and what happens next?
- At a fixed label budget, vary the horizon T \in \{50, 100, 200, 400\} and plot the off-road cost of BC against T. Compare with the orders \varepsilon T^2 and \varepsilon T of Theorem 6.12.
- Replace the table by a small classifier on x (logistic regression or an MLP) and redo tasks 1–3: does better extrapolation close the gap?
- Team project: the same protocol — equal label budget, several horizons, seeds — evaluates the imitation pre-training of subject Y1.4.
Definition 6.13 — Inverse reinforcement learning and maximum-entropy IRL IRL seeks a reward r_\psi under which the expert is optimal, then trains a policy on it. The problem is ill-posed (r \equiv 0 makes every policy optimal), so a principle is needed.
Maximum-entropy IRL (Ziebart et al., 2008) models trajectories as p_\psi(\tau) \propto \exp\big(\sum_t r_\psi(s_t, a_t)\big). For a linear reward r_\psi = \psi^\top \phi(s,a), the gradient of the log-likelihood of the demonstrations is \nabla_\psi \log \mathcal{L} = \mathbb{E}_{\tau \sim \pi_E}\Big[\sum_t \phi(s_t,a_t)\Big] - \mathbb{E}_{\tau \sim p_\psi}\Big[\sum_t \phi(s_t,a_t)\Big]: the learned reward is adjusted until the soft-optimal policy matches the expert’s feature counts.
GAIL (Ho & Ermon, 2016) skips the explicit reward: a discriminator separates expert from agent state-action pairs and the policy is trained to fool it, which matches the occupancy measures of Definition 1.4.
Example 6.14 — Feature matching in one step A driving agent has two features: “on the road” and “near a pedestrian”. Expert demonstrations spend 90\% of steps on the road and 1\% near pedestrians; the current soft-optimal policy spends 60\% and 8\%. The gradient is (0.90 - 0.60,\ 0.01 - 0.08) = (0.30, -0.07) : the reward weight of “on the road” increases and the one of “near a pedestrian” decreases, and the next policy moves toward the expert’s behaviour.
The reward model of RLHF is the same idea with comparisons instead of demonstrations: the Bradley–Terry likelihood below.
Bradley–Terry preference model A dataset \mathcal{D} holds comparisons (x, y_w, y_l): for the prompt x, a human preferred the answer y_w to y_l. The Bradley–Terry model posits \mathbb{P}(y_w \succ y_l \mid x) = \sigma\big(r_\phi(x, y_w) - r_\phi(x, y_l)\big), \qquad \sigma(u) = \frac{1}{1 + e^{-u}}, and the reward model maximizes the log-likelihood \ell(\phi) = \sum_{(x, y_w, y_l) \in \mathcal{D}} \log \sigma\big(r_\phi(x, y_w) - r_\phi(x, y_l)\big). Only reward differences are identified: adding a function of x to r_\phi changes nothing. RLHF then maximizes r_\phi minus \beta\,\mathrm{KL}(\pi_\theta \| \pi_{\mathrm{ref}}) (lemma of chapter 6, PPO of Theorem 5.5); Large Language Models, ch. 5 derives the model and DPO.
6.6. Decision transformers: RL as sequence modeling
The official programme names decision transformers among the sequence-modeling approaches to sequential decisions. The idea is to drop Bellman backups altogether and treat offline RL (section 6.2) as conditional sequence prediction, with the same architecture as a language model.
Definition 6.15 — Decision transformer (Chen et al., 2021) Rewrite each offline trajectory as a token sequence (\hat R_1, s_1, a_1,\ \hat R_2, s_2, a_2,\ \dots), \qquad \hat R_t = \sum_{t' \geq t} r_{t'} \ \ (\text{return-to-go}), embed each element, and train a causal transformer to predict a_t from the tokens up to s_t, by plain supervised learning (cross-entropy or squared error).
At test time, set \hat R_1 to the desired return, act with the predicted action, and update \hat R_{t+1} = \hat R_t - r_t after each observed reward.
Example 6.16 — Conditioning on the return An offline dataset holds two kinds of episodes from the same start state: cautious ones with return 2 and efficient ones with return 10. Conditioned on \hat R_1 = 10, the model reproduces the actions of the efficient episodes; conditioned on 2, those of the cautious ones. No \max and no bootstrapped target appear, so the deadly triad (ch. 3) and the out-of-distribution queries of offline Q-learning (section 6.2) are avoided.
Limits A decision transformer can only imitate returns present in the data: asking for \hat R_1 = 50 is out of distribution. Because it does not bootstrap, it is weaker than Q-learning at stitching pieces of different sub-optimal trajectories into a better one, and conditioning on a return is misleading in strongly stochastic environments, where a high return may have been luck. The Trajectory Transformer (Janner et al., 2021) adds beam-search planning over the predicted sequences. These models are the bridge to chapter 7, where the policy is a language model.
7. Autonomous agents in the era of LLMs
An LLM agent — a language model that reads observations, calls tools and acts in a loop — is a reinforcement learning agent whose state is only partially observed. This chapter gives the matching formal framework, the POMDP, and uses it to read the design of modern agent systems; section 7.1 then lets several agents learn at once, with Markov games.
Definition 7.1 — POMDP: when the state is not observable A POMDP is a tuple (\mathcal{S}, \mathcal{A}, \mathcal{O}, P, \Omega, r, \gamma) : like an MDP, but after the action A_{t-1} brings the system to S_t, the agent only observes O_t \sim \Omega(\cdot \mid S_t, A_{t-1}) — not the latent state.
The central object is the belief b_t(s) = \mathbb{P}[S_t = s \mid A_0, O_1, A_1, O_2, \dots, A_{t-1}, O_t], updated by Bayes at each observation — exactly the prediction and weighting steps of the particle filter of Proposition 0.9: b_t(s') \propto \Omega(O_t \mid s', A_{t-1}) \sum_s P(s' \mid s, A_{t-1})\, b_{t-1}(s).
Fundamental result: the POMDP rewrites as an MDP over the (continuous) space of beliefs, with reward \bar r(b, a) = \sum_s b(s) r(s, a) — optimality preserved, but a continuous state space and a PSPACE-hard problem in general.
Every real agent is a POMDP: perception is always partial (noisy sensors, screen, text).
- Defining an agent: perceive → decide → act → observe, in a loop (the agent = policy \pi over a POMDP); perception = context (text, memory), action = tool calls, APIs, code. The memory/state estimation of the POMDP materializes as: context window (short-term memory — bounded), vector memories (similarity retrieval = approximate belief estimation), recurrent networks/hidden state (literally a learned filter);
- LLM + tools: the LLM is the decision engine; the “prompt” = observation; function calling = action space. The ReAct loop (Yao et al., 2023) alternates explicit reasoning and actions:
# ReAct trace (excerpt, translated) -- question: "Did the stock price of X
# go up after supplier Y's latest flagship product?"
Thought: I must identify Y's latest flagship product, then the release
date, then compare the price of X around that date.
Action: search[Y's recent products]
Observation: Y launched product P on March 14, 2026.
Thought: I now look up the price of X around March 14, 2026.
Action: lookup[stock X price March 2026]
Observation: X traded at 102.4 on March 13; 109.9 on March 15.
Thought: I have both data points, I can conclude (+7.3% in two sessions).
Action: finish[yes, up ~7%]The function calling / tool use format declares the action space (JSON structuring, validated schemas):
{
"name": "get_stock_price",
"description": "Closing price of a stock",
"parameters": {
"type": "object",
"properties": {
"ticker": {"type": "string"},
"date": {"type": "string", "format": "date"}
},
"required": ["ticker"]
}
}
// agent's reply: {"ticker": "X", "date": "2026-03-15"}
// -> the orchestrator executes, reinjects the result as an observationMemory and RAG: the state exceeds the context window ⇒ external memory (vector stores). GraphRAG: index knowledge as a graph (entity-relation) and query by neighborhood/multi-hop — retrieval becomes a query over a knowledge graph; exact intersection of the master’s program: NLP × Graph ML × LLM. Prerequisite: the minimal RAG pipeline (chunk, embed, retrieve, prompt) of Text Mining and NLP, section 7.4; GraphRAG itself is in Graph ML, ch. 10;
Multi-agent: agent systems = graphs — nodes: specialized agents (each with its own context and prompt), edges: information flows, DAG or cyclic topology (orchestrator-workers, debates, verifiers).
Self-play (the agent learns against itself — AlphaGo/AlphaZero, Silver et al.; section 7.1) is the training version; LLM agent teams (generator/critic/verifier) are its inference version.
Current “deep research” workflows orchestrate >100 agents in parallel phases; this “graph engineering” is one of the career paths of the master’s program (cf. LangGraph, AutoGen); orchestration is itself a policy — a meta-level sequential decision (cross-reference chapter 5);
Distribution, robustness, confidentiality of multi-agent systems: when workers are distributed (or malicious), aggregating their outputs raises the same questions as aggregating gradients — cf. Emerging Subjects in ML module, chapters 2 (distributed) and 4 (Byzantine);
Evaluating agents: environments (tool-use benchmarks), verifiable rewards (test programs, formal constraints — RLVR link, chapter 4), costs (tokens, calls, latency — an agent = an MDP whose every step is costly: optimize the return per token);
Safety: per-tool permissions (whitelist of allowed actions = action space restriction), execution sandboxing (code, network), human supervision at critical points (human-in-the-loop = policy with interruption), full trajectory logging for audit.
Guiding lab Code a mini “deep research” agent: an orchestrator (LLM) that decomposes a question into subtasks, workers that search and summarize, a verifier that demands sources, a writer that compiles — the whole represented and executed as a DAG of agents (cf. Refresher CS, topological sort); measure success rate, token cost, depth of the DAG.
7.1. Markov games: several learning agents
When several agents learn in the same environment — the vehicles of a fleet, the players of a game, LLM agents that negotiate — the environment of each one contains the others, and they change as they learn. Markov games are the formal frame for this situation.
Definition 7.2 — Markov game (Shapley, 1953; Littman, 1994) A Markov game with n agents is a tuple (\mathcal{S}, \mathcal{A}^1, \dots, \mathcal{A}^n, P, r^1, \dots, r^n, \gamma). At each step every agent i draws a^i \sim \pi^i(\cdot \mid s). The joint action \mathbf{a} = (a^1, \dots, a^n) drives the transition P(s' \mid s, \mathbf{a}), and agent i receives r^i(s, \mathbf{a}).
The value V^i_{\boldsymbol\pi}(s) of agent i depends on the joint policy \boldsymbol\pi = (\pi^1, \dots, \pi^n).
Special cases: n = 1 is an MDP; a single state gives a matrix game; r^1 = -r^2 is zero-sum; a common reward r^i = r is fully cooperative.
Definition 7.3 — Nash equilibrium A joint policy \boldsymbol\pi^\star is a Nash equilibrium if no agent gains by deviating alone: for every agent i, every policy \pi^i and every state s, V^i_{(\pi^i,\, \boldsymbol\pi^{\star,-i})}(s) \leq V^i_{\boldsymbol\pi^\star}(s), where \boldsymbol\pi^{\star,-i} collects the equilibrium policies of the other agents.
Every finite discounted Markov game has an equilibrium in stationary policies (Fink, 1964), but they may have to be stochastic, unlike Proposition 1.2: think of rock-paper-scissors.
In two-player zero-sum games all equilibria share one value, and Minimax-Q (Littman, 1994) replaces the \max of Q-learning by the value of a matrix game, computed by a linear program.
- Independent learners and non-stationarity. The simplest method runs one Q-learner per agent over its own actions, the others being part of the environment. From agent i’s viewpoint the transition kernel is P^i(s' \mid s, a^i) = \sum_{a^{-i}} \boldsymbol\pi^{-i}(a^{-i} \mid s)\, P(s' \mid s, a^i, a^{-i}), and it changes as the others learn. The environment is non-stationary, the contraction argument of Theorem 3.2 no longer applies, and independent learners can cycle or settle on a poor equilibrium (Claus & Boutilier, 1998; Exercise 16).
- Self-play. In a two-player zero-sum game, one policy is trained against copies of itself or of its past versions. TD-Gammon reached master level this way, and AlphaZero (with the MCTS of section 4.2) superhuman play; a population of past opponents (league training, as in AlphaStar) prevents cycling between strategies that beat each other.
- A taxonomy of multi-agent RL. By rewards: cooperative, competitive (zero-sum) or mixed (general-sum). By training: independent learners, centralized training with decentralized execution (CTDE, for instance QMIX or MADDPG; see Real-time AI in Video Games, ch. 8), or fully centralized. By observation: a team that shares one reward but sees partial observations is a Dec-POMDP, the multi-agent version of Definition 7.1.
8. Course research notes (Jesse Read)
Jesse Read (professor at LIX, École Polytechnique) is one of the founding authors of multi-label learning and a central player in stream learning (data streams). His themes — multi-label and extreme classification, adaptive stream learning — are directly connected to the program of this course: they are problems of sequential decisions under non-stationarity.
8.1. Multi-label classification: classifier chains
Definition 8.1 — Multi-label and the dependency problem In multi-label learning, each instance x receives a set of labels Y \subseteq \{1, \dots, K\} — encoding y \in \{0,1\}^K. The naive approach (binary relevance) trains K independent classifiers; it ignores that labels are correlated (medications prescribed together, co-occurring tags).
Domain taxonomies distinguish: problem transformation (recoding the problem — binary relevance, label powerset, chains) vs algorithm adaptation (adapting an existing algorithm — trees, multi-label SVMs; cf. Read et al., 2011; Read & Perez-Cruz, 2014).
Idea 8.2 — Classifier chains (Read, Pfahringer, Holmes & Frank, 2011) Order the labels 1, \dots, K and train a chain: classifier j predicts y_j from (x, y_1, \dots, y_{j-1}). By the chain rule of probabilities: p(y \mid x) = \prod_{j=1}^{K} p\big(y_j \,\big|\, x, y_1, \dots, y_{j-1}\big), each link models the conditional dependence on the previous labels — the predictors share their structure.
Difficulties: the choice of order and the cascading error along the chain (a wrong link contaminates the rest); ensembles of chains (random orders, voting) and probabilistic variants (sampling multiple paths) mitigate these two defects.
This is a sequential decision process: the set of prefixes (y_1, \dots, y_{j-1}) is a path in a decision tree, and the label order plays the role of the horizon — exactly the “state-action-reward” structure of chapter 1, without environmental stochasticity.
Extreme classification When K \sim 10^5–10^6 (tagging Wikipedia, predicting search queries), multi-label becomes extreme: impossible to train K classifiers; one projects labels and instances into a common latent space (embeddings), subsamples rare labels (negative sampling), organizes prediction with trees. Read & Perez-Cruz (2014) study the contribution of deep learning for this regime — and the connection with chapter 6 of this course is literal: approximating a value/action function in very high dimension.
8.2. Stream learning: concept drift and adaptation
Definition 8.3 — Streams, drift, prequential evaluation Data arrives as a stream (x_t, y_t)_{t \geq 1}, through a distribution that changes (concept drift: abrupt — a new spam; gradual — shifting usage patterns; recurring — seasonality).
The standard evaluation is prequential: predict y_t with the current model, then learn from (x_t, y_t), accumulating the test error before training — each datum is used once, never any retrospective replay: this is the criterion of an agent that lives in time.
The tools: adaptive sliding windows, drift detectors, ensembles of weighted and replaced learners (Gomes, Read, Bifet et al., 2019; Read & Žliobaitė, 2022).
Proposition 8.4 — The link with RL: positioning A stream classifier is exactly a policy in a non-stationary environment: the state = the current model and the recent window, the action = the prediction (and the update).
Drift makes P and r functions of time — the MDP of chapter 1 becomes non-stationary, and the convergence theorems (Robbins-Monro, Th. 0.5) lose their fixed-point uniqueness hypothesis: the algorithm must track rather than converge — constant steps or finite windows rather than decay.
The three points of contact with the course:
- bandits (ch. 4): drift is a non-stationary bandit (resetting posteriors, windows over \hat\mu_a); active learning — choosing which datum to label in a stream — is a contextual bandit;
- exploration (ch. 4): maintaining the exploitation/exploration trade-off when everything moves (“optimism” as regularization of change);
- agents (ch. 7): an LLM agent in production sees its world change (tools, sources): the same detection and adaptation issues — the perception-action loop of chapter 7 is a stream.
Reference publications (all real, verified)
- Read, Pfahringer, Holmes, Frank — Classifier Chains for Multi-label Classification, Machine Learning, 2011: the founding paper of chains; (~10,000 citations); link.
- Read, Reutemann, Pfahringer, Holmes — MEKA: a Multi-label/Multi-target Extension to WEKA, JMLR, 2016: the reference software of the field; link.
- Read & Perez-Cruz — Deep Learning for Multi-label Classification, 2014: multi-label and deep nets, extreme classification connection; arXiv:1502.05988.
- Gomes, Read, Bifet, Barddal, Langlois — Machine learning for streaming data: state of the art, challenges, and opportunities, SIGKDD Explorations, 2019: the reference synthesis of streaming ML; link.
- Read & Žliobaitė — Learning from Data Streams: an Overview and Update, 2022; arXiv:2212.14720.
Exercises
- ★ Bellman on paper. Analytically solve a 2-state MDP (continue at gain c per step, stop at reward 0): write the Bellman equations and compute V^\star as a function of \gamma and c; interpret the indifference threshold and its link with \gamma (variant: stopping yields b once).
- ★ Value vs policy iteration. On the gridworld of chapter 2, compare the number of iterations and the cost per iteration; verify that the policies coincide.
- ★ Tabular Q-learning. Implement Q-learning with \varepsilon-greedy on Cliff Walking (Sutton & Barto, ex. 6.6): compare the trajectories learned by Q-learning (optimal, cliff edge) and SARSA (cautious); plot the return per episode.
- ★ Overestimation bias on an example. Let two actions with true values Q(s, a_1) = 0 and Q(s, a_2) = 0, estimated with independent Gaussian noises \mathcal{N}(0, \sigma^2). Compute \mathbb{E}[\max(\hat Q_1, \hat Q_2)] (literally \sigma/\sqrt{\pi}) and comment in light of Theorem 3.5.
- ★ REINFORCE, variance. On CartPole, compare REINFORCE with and without baseline; plot the variance of the empirical gradients and the learning curve.
- ★ PPO-clip on paper. Plot \min(\rho\hat A, \mathrm{clip}(\rho, 1{-}\epsilon, 1{+}\epsilon)\hat A) as a function of the ratio \rho for \hat A = \pm 1; locate the zones where the gradient is zero and relate to the proof of Theorem 5.5.
- ★ Bandits. Simulate a 3-armed Bernoulli bandit (0.2, 0.5, 0.7); compare \varepsilon-greedy, UCB, Thompson; plot the cumulative regret over 5000 steps and verify the \log T behavior of the last two (compare with the Lai-Robbins bound of Theorem 4.3).
- ★ Synthetic LinUCB. Generate contexts x \sim \mathcal{N}(0, I_d), d = 5, reward x^\top\theta^\star + noise; implement LinUCB and \varepsilon-greedy; plot the regret and the evolution of the bonus \sqrt{x^\top A^{-1} x}.
- ★ ReAct agent. Write by hand a complete ReAct trace (at least 3 Thought/Action/Observation cycles) for a multi-hop question of your choice; identify for each cycle: the observation, the action, the state estimation (POMDP belief, Def. 7.1).
- ★★ Contraction and stopping criterion. Prove the “max-Lipschitz” lemma of Theorem 1.6, then the stopping criterion of Theorem 2.1: \|V_k - V^\star\|_\infty \leq \frac{\gamma}{1-\gamma}\|V_k - V_{k-1}\|_\infty .
- ★★ TD(\lambda) piecewise. Verify on an example that \lambda = 0 gives back TD(0) and \lambda = 1 the Monte-Carlo return; prove the telescoping G_t^{(n)} - V(S_t) = \sum_{l<n} \gamma^l \delta_{t+l} (step 1 of Proposition 3.4).
- ★★ Soft policy. Derive \pi^\star(a\mid s) \propto \exp(Q(s,a)/\alpha) from the decomposition F(\pi) = -\alpha\,\mathrm{KL}(\pi\|\pi^\star) + \alpha \log Z (Algorithm 6.4), and verify that \alpha \to 0 gives back the greedy policy.
- ★★ Gaussian Thompson. Take up the \mathcal{N}(m_n, v_n) update of Algorithm 4.4. (a) Show that the posterior mean is a shrinkage estimator, \mathbb{E}[m_n \mid \mu_a] = \frac{n\tau^2}{n\tau^2 + \sigma^2}\, \mu_a , so it is biased toward the prior mean 0; compute the bias and show that it vanishes when \tau^2 \to \infty or n \to \infty. (b) Describe the posterior when \tau^2 \to \infty, then when n \to \infty.
- ★★ UCT by hand. Continue Example 4.8 for three more simulations, assuming they return 1, 0, 1 to whichever action is selected; give the counts and means after each backup and the action finally recommended (most visited). Then redo the first step with c = 0.5 and explain how c shifts the balance between exploration and exploitation.
- ★★ Evolution strategies vs CEM. (a) Repeat Example 5.8 for J(\theta) = -\theta^4 and show that the ES gradient equals -4\theta^3 - 12\sigma^2\theta, i.e. the gradient of the smoothed objective, not of J. (b) Implement CEM (Algorithm 5.6) on CartPole with a linear policy and compare the number of episodes needed with REINFORCE (exercise 5).
- ★★ Independent Q-learners on a penalty game. Two agents share the payoff of the matrix game below (rows: agent 1, columns: agent 2; Claus & Boutilier, 1998):
R = \begin{pmatrix} 10 & 0 & k \\ 0 & 2 & 0 \\ k & 0 & 10 \end{pmatrix}, \qquad k \leq 0 .
- For k = -10, list the pure Nash equilibria (Definition 7.3) and say which are optimal. (b) Run two independent stateless Q-learners (\alpha = 0.1, \varepsilon-greedy with \varepsilon = 0.1, ties broken at random) for 5000 rounds and 100 seeds, for k \in \{0, -10, -30\}; report how often each joint action is reached. (c) Explain the outcome with the non-stationarity of section 7.1: why does a larger penalty push the learners toward the safe equilibrium? (d) Let each agent observe the other’s action and learn Q-values over joint actions; compare.
- ★★★ Neural TSP-20. (a) Show that the greedy-rollout baseline of Algorithm 5.10 keeps the gradient unbiased, and that POMO’s shared baseline rescales it by (N-1)/N. (b) Implement Algorithm 5.10 with a small attention encoder (2 layers, width 64) on uniform random instances with n = 20. Compare greedy decoding with the nearest-neighbour heuristic and with OR-Tools, as the mean optimality gap on 1000 test instances. (c) Swap in POMO’s shared baseline at an equal number of sampled tours and compare the learning curves over 3 seeds.
- ★★★ Agent project. Extend the guiding lab: add a verification loop (critic agent) and measure the impact on report quality (human grading or LLM-judge) and on total token cost.
Solutions — exercises 1, 3 (hints), 4, 5, 7, 10
1. States \{c, s\} (continue, stop). Bellman: V^\star(s) = 0; \qquad V^\star(c) = \max\{0,\ c + \gamma V^\star(c)\}. If c + \gamma V^\star(c) \geq 0 then V^\star(c) = c/(1-\gamma) (geometric series), valid if and only if c \geq 0; otherwise V^\star(c) = 0 and the optimal policy is to stop immediately.
Instructive variant: if stopping yields b once, continuing is optimal if and only if \frac{c}{1-\gamma} \geq b, \quad \text{i.e.} \quad c \geq b(1-\gamma) : the closer \gamma is to 1, the lower the threshold — weak discounting values distant gains, so one continues all the more willingly; at \gamma = 0, only the immediate gain counts and the threshold is c \geq b.
3 (hints). Update Q(S_t, A_t) with the target R + \gamma\max_{a'} Q(S_{t+1}, a') (Q-learning) or R + \gamma Q(S_{t+1}, A_{t+1}) where A_{t+1} is the action actually played by the \varepsilon-greedy policy (SARSA). Expected phenomenon: Q-learning converges to the optimal path along the cliff (the max “believes” the agent will never fall), SARSA to a set-back path (random exploration makes the followed policy fall); with \varepsilon \to 0 the two coincide.
4. \max(X, Y) with X, Y i.i.d. \mathcal{N}(0, \sigma^2): \max = \tfrac{X+Y}{2} + \tfrac{|X - Y|}{2} ; X + Y is \mathcal{N}(0, 2\sigma^2) and X - Y is \mathcal{N}(0, 2\sigma^2), so \mathbb{E}|X - Y| = \sqrt{2}\sigma\sqrt{2/\pi} and \mathbb{E}[\max] = \sigma/\sqrt{\pi} > 0 = \max(\mathbb{E}X, \mathbb{E}Y) : the bias equals \sigma/\sqrt{\pi}, purely created by the estimation noise — this is the continuous version of Theorem 3.5.
5. Without baseline, the estimator \widehat{\nabla J} = G\,\nabla\log\pi has variance with a factor \mathrm{Var}[G] (large: the return accumulates the noise of the whole episode); with b = V_w(s), the “value of the state” part cancels (Proposition 5.2); in practice on CartPole, learning without baseline is slow and irregular (gradient variance an order of magnitude higher), with baseline it is smooth and 3-5× faster; verify numerically that \widehat{\mathrm{Var}}[\hat\nabla J] decreases by a factor ~10 after advantage normalization.
7. Lai-Robbins for Bernoullis: the asymptotic bound is \sum_{a \neq a^\star} \Delta_a \mathrm{KL}(\mathrm{Bern}(\mu_a)\|\mathrm{Bern}(\mu^\star)) ^{-1} \log T with \mathrm{KL} = \mu_a \log\frac{\mu_a}{\mu^\star} + (1-\mu_a) \log\frac{1-\mu_a}{1-\mu^\star} ; compute the two KLs (arm 0.2: \approx 0.53; arm 0.5: \approx 0.09), plot R_T / \log T for UCB and Thompson: Thompson’s curve rises slowly toward the Lai-Robbins constant, while UCB1’s ends well above it, \varepsilon-greedy diverges linearly (regret \Theta(\varepsilon T)).
10. Lemma: for every a, u_a \leq v_a + \max_b|u_b - v_b| so \max_a u_a \leq \max_a v_a + \max_b |u_b - v_b|; symmetry. Stopping: \|V_k - V^\star\| \leq \|\mathcal{T}V_{k-1} - \mathcal{T}V_k\| + \|\mathcal{T}V_k - \mathcal{T}V^\star\| \leq \gamma\|V_{k-1} - V_k\| + \gamma\|V_k - V^\star\|, hence (1-\gamma)\|V_k - V^\star\| \leq \gamma \|V_{k-1} - V_k\| .
Projects and assessment
The official assessment, from the fiche: the LLGA section of the 2026–2027 sheet displays no modality; the course description announces “a course project (50%) and practical work (50%)”, and the other programs list homework (50%) and a project (50%, oral assessment), with a resit.
The proposals below fit that split: one project, solo or in a group, for the 50% project with an oral defence; the lab sheets of sessions 10–11 and the exercises as practical work; and a written exam for the resit. The projects exercise objectives O1 (foundations, here those of RL), O3 (RLHF and LLM agents) and O7 (hands-on practice), and touch O4–O5 through graph retrieval and O8 through constraints and reward hacking.
Solo projects
- [Solo · ≈ 25 h] Bandits for recommendation, evaluated offline by replay. Do UCB1, Thompson sampling and LinUCB keep their simulated ranking on real logged clicks?
- Implement: UCB1 and Algorithms 4.4–4.5; the replay estimator of Li, Chu, Langford & Wang (WSDM 2011), unbiased when the logging policy is uniform; a sliding-window variant for drift (section 8.2).
- Data: the Open Bandit Dataset (Saito et al., NeurIPS 2021 Datasets and Benchmarks), its uniformly random logs; synthetic Bernoulli arms to compare the empirical regret with the Lai–Robbins constant (Theorem 4.3).
- Deliverables: code, a 4–6 page report, a 10-minute talk. Chapters: ch. 4, ch. 8.
- Success: replay click rates with bootstrap intervals over 5 seeds; LinUCB beats the best context-free policy, or the report shows why not; on the synthetic arms, R_T/\ln T is plotted up to T = 10^5 against the Lai–Robbins constant: Thompson sampling’s curve rises toward it, UCB1’s ends well above it, and the report explains both.
- [Solo · ≈ 25 h] Paper study: Proximal Policy Optimization (Schulman, Wolski, Dhariwal, Radford & Klimov, 2017). Which ingredients of PPO matter: clipping, the GAE parameter \lambda, advantage normalization, the entropy bonus?
- Implement: REINFORCE with a baseline, A2C (Algorithm 5.3), then PPO-clip with GAE (Proposition 3.4, Theorem 5.5) in PyTorch, using “The 37 Implementation Details of PPO” (Huang et al., ICLR Blog Track 2022) as a checklist.
- Data: Gymnasium CartPole-v1 and LunarLander-v3, on a laptop CPU.
- Deliverables: code, learning curves over 5 seeds, an ablation table, a 4–6 page report, a 10-minute talk. Chapters: ch. 3, ch. 5.
- Success: CartPole reaches a return of 500 within 2 \cdot 10^5 steps on at least 4 seeds out of 5; LunarLander reaches a mean return of 200; every ablation is reported with confidence bands.
Group projects
- [Group of 3 · ≈ 30 h each] From PPO to GRPO: RL fine-tuning of a small language model with verifiable rewards. At an equal sampling budget, does a critic (PPO) beat group-relative baselines (GRPO), and when does the policy hack the reward?
- Implement: a token-level policy-gradient loop on a small instruction model (Qwen2.5-0.5B-Instruct with LoRA, free GPU tier), reward = exact match of the final answer, a KL penalty to \pi_{\mathrm{ref}} (lemma of ch. 6); PPO with a value head versus GRPO (Shao et al., DeepSeekMath, 2024).
- Data: GSM8K (Cobbe et al., 2021), train and test splits.
- Split: one member on the PPO core (validated first on LunarLander), one on rollouts and rewards, one on evaluation (accuracy, KL drift, entropy, reward-hacking audit).
- Deliverables: code, a 6–8 page report, a 15-minute talk. Chapters: ch. 3, ch. 5, ch. 6. Continues in Large Language Models, ch. 5.
- Success: test accuracy above the starting model with a 95 % interval; KL and entropy curves; at least one documented format or reward exploit and its fix.
- [Group of 3 · ≈ 30 h each] AlphaZero-lite: from UCT to PUCT with self-play on Connect Four. How many simulations does a learned policy and value prior save over random rollouts?
- Implement: UCT (Algorithm 4.7) with random rollouts; then PUCT with a small residual network trained on root visit counts from self-play, after Silver et al., “A general reinforcement learning algorithm that masters chess, shogi, and Go through self-play” (Science, 2018).
- Data: the Connect Four environment of PettingZoo, or a 40-line implementation.
- Split: search engine; network and self-play loop; evaluation (Elo, ablations on c and the budget).
- Deliverables: code, a 6–8 page report, a 15-minute talk with a live game. Chapters: ch. 4, ch. 5, ch. 7 (section 7.1).
- Success: PUCT with 50 simulations wins at least 60 % of 200 games, alternating first player, against UCT with 500 random-rollout simulations.
- [Group of 4 · ≈ 30 h each] Offline RL shoot-out: behavioural cloning, DAgger, CQL and the decision transformer. On datasets of mixed quality, which method stitches sub-optimal trajectories, and how fast do cloning errors compound?
- Implement: BC and DAgger (Definition 6.11, Theorem 6.12, lab sheet of session 11) with a scripted expert; CQL (section 6.2; Kumar et al., 2020); a decision transformer (Definition 6.15; Chen et al., 2021).
- Data: Minari datasets of the Farama Foundation — the D4RL PointMaze mazes for stitching, MuJoCo Hopper medium and expert data.
- Split: one member per method family (BC and DAgger, CQL, decision transformer); the fourth builds the shared datasets and evaluation harness.
- Deliverables: code, a 6–8 page report, a 15-minute talk. Chapters: ch. 6.
- Success: normalized scores over 3 seeds per method and dataset; a stitching test that separates the decision transformer from CQL, or an explanation of why it does not; the compounding-error curve of BC against the horizon.
- [Group of 3 · ≈ 30 h each] A tool-using research agent as a constrained POMDP, with a learned retrieval router (the RL work package of Y1.1). Can a router learn, per question, which retrieval mode to call so as to maximize accuracy under a token budget?
- Implement: the guiding lab of ch. 7 and Exercise 18 (orchestrator, workers, verifier, tool whitelist); a LinUCB router (Algorithm 4.5) over question features, rewarded by correctness minus \lambda \times tokens, with \lambda adapted by the primal–dual rule of Definition 6.5.
- Data: 2WikiMultiHopQA (Ho et al., COLING 2020); BM25 and dense retrieval from Text Mining and NLP (ch. 2, section 7.4), GraphRAG from Graph ML, ch. 10; a small open LLM.
- Split: agent and tools; retrieval back-ends; router and evaluation.
- Deliverables: code, a 6–8 page report, a 15-minute talk. Chapters: ch. 4, ch. 6, ch. 7.
- Success: on at least 500 questions, the router matches or beats the best fixed mode at no greater mean token cost (bootstrap intervals); the budget is met within 5 %; unsafe tool calls are counted.
Written exam (proposal)
Format: 2 hours, one handwritten A4 sheet of notes allowed, no electronic device; four exercises, 20 points.
- Question (4 points). Explain why Q-learning is off-policy and SARSA on-policy, state the deadly triad, and name one stabilizer of DQN for each danger it creates. Expected: Q-learning bootstraps on \max_{a'} Q, the greedy policy, whatever the behaviour policy, so it learns Q^\star; SARSA bootstraps on the action actually played and evaluates the \varepsilon-greedy policy (Cliff Walking). Triad: function approximation, bootstrapping and off-policy data can diverge together (Baird). Stabilizers: replay (correlations), a target network (moving target), double Q-learning (the max bias of Theorem 3.5).
- Question (6 points). Two states s_1, s_2, discount 0.9. In the first, stay gives reward 1 and stays; go gives 0 and moves to the second. In the second, the only action gives 2 and stays. (a) Compute V^\star and \pi^\star. (b) Run two steps of value iteration from V_0 = 0. (c) What does the stopping criterion of Theorem 2.1 guarantee after V_2? Compare with the true error. Expected:
- V^\star(s_2) = 2/(1-\gamma) = 20; in s_1, staying forever is worth 10 and going is worth 0.9 \cdot 20 = 18, so V^\star(s_1) = 18 and the optimal action in s_1 is go.
- V_1 = (1, 2) and V_2 = (1.9, 3.8); greedy with respect to V_2, go (3.42) already beats stay (2.71).
- the residual is \varepsilon = \|V_2 - V_1\|_\infty = 1.8, so \|V_2 - V^\star\|_\infty \leq 0.9 \cdot 1.8 / 0.1 = 16.2. The true errors are 16.1 and 16.2: the bound is attained in s_2.
- Question (5 points). Prove the KL-regularised policy improvement lemma of chapter 6, then deduce the optimal policy of SAC for a fixed Q. Expected:
- Write r = \beta\log(\pi^\star/\pi_0) + \beta\log Z, so the objective equals \beta\log Z - \beta\,\mathrm{KL}(\pi\,\|\,\pi^\star); Gibbs’ inequality gives the unique maximizer \pi^\star and the value \beta\log Z.
- For SAC, \pi_0 is uniform and \beta = \alpha, because the entropy is \log|\mathcal{A}| minus the KL to the uniform law; hence \pi^\star \propto e^{Q/\alpha}.
- Question (5 points). Bernoulli arms with means 0.5 and 0.4. (a) At t = 10, arm 1 has been pulled 6 times with empirical mean 0.5 and arm 2 four times with empirical mean 0.25: which arm does UCB1 play? (b) Compute the Lai–Robbins constant and compare it with the logarithmic coefficient of the UCB1 bound. Expected:
- \sqrt{2\ln 10/6} \approx 0.876 and \sqrt{2\ln 10/4} \approx 1.073, so the indices are 1.376 and 1.323: UCB1 plays arm 1, by a narrow margin.
- the divergence between the two Bernoulli laws is 0.4\ln 0.8 + 0.6\ln 1.2 \approx 0.0201, so the constant is 0.1/0.0201 \approx 4.97. The UCB1 bound gives 8/\Delta = 80 — a factor 16 above, which KL-UCB and Thompson sampling remove.
Grading rubric (proposal)
| Criterion | Weight | What earns the marks |
|---|---|---|
| Problem formulation | 15 % | states, actions, rewards and constraints written as an MDP, POMDP or bandit; assumptions stated |
| Correct implementation | 25 % | sanity checks first (a tabular case or a known optimum), tested returns and advantages, no leakage between training and evaluation |
| Experimental rigour | 25 % | at least 3–5 seeds, confidence bands, baselines at an equal budget, ablations |
| Analysis and honesty | 15 % | failure analysis, reward hacking looked for, negative results reported |
| Link to the theory | 10 % | which result of the course predicts what, and whether the measurement agrees |
| Communication and reproducibility | 10 % | clear report and talk; one command reproduces the main figure |
References
- R. Sutton, A. Barto, Reinforcement Learning: An Introduction, 2nd ed., MIT Press, 2018 — free online; the textbook of the course (chapters 3-6 for ch. 1-3, chapter 13 for policy gradients).
- M. Puterman, Markov Decision Processes: Discrete Stochastic Dynamic Programming, Wiley, 2005 — the reference for chapters 1-2 (MDP, LP, modified policy iteration).
- D. Bertsekas, J. Tsitsiklis, Neuro-Dynamic Programming, Athena Scientific, 1996 — contraction, asynchronous DP, deadly triad.
- C. Szepesvári, Algorithms for Reinforcement Learning, Morgan & Claypool, 2010 — compact theoretical synthesis.
- C. Watkins, P. Dayan, “Q-learning”, Machine Learning 8, 1992; J. Tsitsiklis, “Asynchronous Stochastic Approximation and Q-Learning”, Mathematics of OR, 1994 — the convergences of chapter 3.
- R. Sutton, D. McAllester, S. Singh, Y. Mansour, “Policy Gradient Methods for RL with Function Approximation”, NeurIPS 1999; R. Williams, “Simple Statistical Gradient-Following Algorithms for Connectionist RL” (REINFORCE), Machine Learning, 1992 — chapter 5.
- S. Kakade, J. Langford, “Approximately Optimal Approximate Reinforcement Learning” (CPI), ICML 2002 — the monotone improvement behind TRPO/PPO.
- J. Schulman et al., High-Dimensional Continuous Control Using Generalized Advantage Estimation (GAE), ICLR 2016; Trust Region Policy Optimization, ICML 2015; Proximal Policy Optimization Algorithms, 2017 — the heart of RLHF.
- V. Mnih et al., Human-level control through deep reinforcement learning (DQN), Nature, 2015; Asynchronous Methods for Deep Reinforcement Learning (A3C), ICML 2016.
- H. van Hasselt, A. Guez, D. Silver, Deep Reinforcement Learning with Double Q-learning, AAAI 2016 — the max bias (Theorem 3.5) and its correction.
- M. Hessel et al., Rainbow: Combining Improvements in Deep Reinforcement Learning, AAAI 2018 — and the original papers cited (dueling, C51, PER, noisy nets).
- T. Lillicrap et al., Continuous Control with Deep Reinforcement Learning (DDPG), ICLR 2016; T. Haarnoja et al., Soft Actor-Critic, ICML 2018 — chapter 6.
- S. Levine et al., Offline Reinforcement Learning: Tutorial, Review, and Perspectives, 2020; A. Kumar et al., Conservative Q-Learning for Offline Reinforcement Learning, NeurIPS 2020.
- P. Auer, N. Cesa-Bianchi, P. Fischer, “Finite-time Analysis of the Multiarmed Bandit Problem”, Machine Learning 47, 2002 (UCB1); T. Lai, H. Robbins, “Asymptotically Efficient Adaptive Allocation Rules”, Advances in Applied Mathematics, 1985; O. Chapelle, L. Li, An Empirical Evaluation of Thompson Sampling, NeurIPS 2011; W. Li et al., A Contextual-Bandit Approach to Personalized News Article Recommendation (LinUCB), WWW 2010 — chapter 4.
- S. Bubeck, N. Cesa-Bianchi, Regret Analysis of Stochastic and Nonstochastic Bandit Problems, FnT-ML, 2012 — for bandits.
- Y. Burda et al., Exploration by Random Network Distillation, ICLR 2019 — intrinsic exploration.
- D. Silver et al., “Mastering the Game of Go with Deep Neural Networks and Tree Search”, Nature, 2016 — self-play and UCT.
- S. Yao et al., ReAct, ICLR 2023; S. Schick et al., Toolformer, NeurIPS 2023 — and the Anthropic/LangChain multi-agent reports on graph engineering — for chapter 7.
- Research group: J. Read et al., Classifier Chains for Multi-label Classification, Machine Learning, 2011; J. Read, F. Perez-Cruz, Deep Learning for Multi-label Classification, 2014; H. Gomes, J. Read et al., Machine learning for streaming data, SIGKDD Explorations, 2019; J. Read, I. Žliobaitė, Learning from Data Streams: An Overview and Update, 2022; MEKA, JMLR 2016 — chapter 8.
- D. Koller, N. Friedman, Probabilistic Graphical Models, MIT Press, 2009 — Bayesian networks and decisions (section 0.4); S. Levine, Reinforcement Learning and Control as Probabilistic Inference, 2018.
- L. Kocsis, C. Szepesvári, “Bandit Based Monte-Carlo Planning”, ECML 2006 (UCT); D. Silver et al., “Mastering the game of Go without human knowledge” (AlphaZero line), Nature, 2017 — section 4.2.
- T. Salimans et al., Evolution Strategies as a Scalable Alternative to Reinforcement Learning, 2017; B. Zoph, Q. Le, Neural Architecture Search with Reinforcement Learning, ICLR 2017; E. Real et al., Regularized Evolution for Image Classifier Architecture Search, AAAI 2019 — section 5.4.
- T. Schaul et al., Prioritized Experience Replay, ICLR 2016; E. Altman, Constrained Markov Decision Processes, Chapman & Hall, 1999 — chapter 6.
- M. Bellemare, W. Dabney, R. Munos, A Distributional Perspective on Reinforcement Learning, ICML 2017; W. Dabney et al., Distributional RL with Quantile Regression, AAAI 2018 — section 6.3.
- R. Sutton, “Integrated architectures for learning, planning, and reacting based on approximating dynamic programming” (Dyna), ICML 1990; D. Hafner et al., Dream to Control, ICLR 2020; J. Schrittwieser et al., MuZero, Nature, 2020 — section 6.4.
- S. Ross, J. Bagnell, “Efficient Reductions for Imitation Learning”, AISTATS 2010; S. Ross, G. Gordon, J. Bagnell, A Reduction of Imitation Learning and Structured Prediction to No-Regret Online Learning (DAgger), AISTATS 2011; B. Ziebart et al., “Maximum Entropy Inverse Reinforcement Learning”, AAAI 2008; J. Ho, S. Ermon, Generative Adversarial Imitation Learning, NeurIPS 2016 — section 6.5.
- L. Chen et al., Decision Transformer: Reinforcement Learning via Sequence Modeling, NeurIPS 2021; M. Janner, Q. Li, S. Levine, Offline Reinforcement Learning as One Big Sequence Modeling Problem, NeurIPS 2021 — section 6.6.
- W. Kool, H. van Hoof, M. Welling, Attention, Learn to Solve Routing Problems!, ICLR 2019; Y.-D. Kwon et al., POMO: Policy Optimization with Multiple Optima for Reinforcement Learning, NeurIPS 2020 — section 5.5.
- L. Ouyang et al., Training language models to follow instructions with human feedback, NeurIPS 2022 — RLHF (introduction, section 6.5).
- L. S. Shapley, “Stochastic Games”, PNAS 39, 1953; A. M. Fink, “Equilibrium in a stochastic n-person game”, Journal of Science of the Hiroshima University 28, 1964; M. Littman, “Markov games as a framework for multi-agent reinforcement learning”, ICML 1994; C. Claus, C. Boutilier, “The dynamics of reinforcement learning in cooperative multiagent systems”, AAAI 1998 — section 7.1.
- Gymnasium — the environments of the labs.