Your technical library
Reinforcement Learning
18 modules · 135 topics
About this book
Reinforcement Learning
An agent acts, the environment responds, and the only feedback is a number. This course teaches how to learn good behaviour from that feedback, from solving a small known problem exactly up to the methods that train today's language models to follow preferences and to reason. It builds on Mathematics, Machine Learning and Deep Learning — though the first seven modules need only Mathematics and a few Machine Learning topics — and teaches none of its own general mathematics.
The reinforcement learning problem formalises it: states, actions, returns and the Bellman equations. Bandits isolates the problem of exploring. Dynamic programming solves a known model exactly; model-free prediction and model-free control learn from experience instead, through Monte Carlo methods, temporal-difference learning and Q-learning; and planning with models combines the two. Linear value function approximation generalises across states, and deep value-based RL does it with neural networks.
Policy gradients and continuous control and maximum-entropy RL optimise behaviour directly, through PPO and SAC, and deep model-based RL and learned search reaches AlphaZero and MuZero. Imitation and inverse RL and offline RL and off-policy evaluation learn without a reward or without interacting at all. Learning from preferences and verifiable rewards and reasoning RL apply all of it to language models — RLHF, DPO and GRPO. The course closes with what remains hard: exploration and sparse rewards, hierarchy and multiple agents and RL in the real world.
135 topics across 18 modules, in dependency order.
This course teaches none of its own general mathematics. Markov chains, expectation, concentration, importance sampling, gradients, entropy and KL live in Mathematics, and every lesson names the topics it needs under “Before this topic”. What stays here is reinforcement learning’s own mathematics — Bellman operators and their contraction, the policy improvement and policy-gradient theorems, regret, and the analyses of the algorithms themselves.
135 of 135 topics are authored; the rest are labelled planned and excluded from progress. Glossary and decision-guide entries cover the authored material and grow with the course.
Read at your own pace. Each topic is one continuous page; mark it done as you finish.
Start with 01.1 · The agent–environment loop: learning from a number instead of an answerReview what you have finished↷ 0 skipped topics- 01.1The agent–environment loop: learning from a number instead of an answer
- 01.2Markov decision processes: the formal problem
- 01.3Policies: a decision rule, and the Markov chain it induces
- 01.4Returns and discounting: the objective
- 01.5Value functions: expected return from a state or a state–action pair
- 01.6Bellman expectation equations: value as a one-step recursion
- 01.7Optimal policies and the Bellman optimality equations
- 01.8Occupancy measures: where a policy spends its time
- 01.9Partial observability: when the agent cannot see the state
- 02.1Multi-armed bandits and regret: scoring exploration
- 02.2Action-value estimation: the incremental update rule
- 02.3Epsilon-greedy exploration: exploring blindly, and its linear regret
- 02.4Upper confidence bounds: optimism in the face of uncertainty
- 02.5Thompson sampling: explore by sampling from the posterior
- 02.6Contextual bandits: arms whose value depends on what you observe
- 02.7Choosing a bandit strategy: epsilon-greedy, UCB, Thompson or contextual
- 03.1Bellman operators and contraction: why repeated backups converge
- 03.2Iterative policy evaluation: applying the expectation operator
- 03.3The policy improvement theorem: acting greedily on Q cannot hurt
- 03.4Policy iteration: evaluate, improve, repeat
- 03.5Value iteration: one backup per sweep with the max
- 03.6Generalised policy iteration: evaluation and improvement as two interacting processes
- 04.1Monte Carlo prediction: average the returns you observe
- 04.2Temporal-difference prediction: bootstrap from the next estimate
- 04.3TD versus Monte Carlo: bias, variance and what each converges to
- 04.4n-step returns: bootstrapping after n real rewards
- 04.5The λ-return: averaging all n-step returns
- 04.6Eligibility traces: the λ-return computed backward, online
- 05.1Monte Carlo control: generalised policy iteration from episodes
- 05.2Off-policy prediction: learning about one policy from another's data
- 05.3SARSA: on-policy temporal-difference control
- 05.4Q-learning: off-policy control with the max
- 05.5Expected SARSA: average over the next action instead of sampling it
- 05.6Maximisation bias: why max over estimates overestimates, and double Q-learning
- 05.7Tabular methods compared: sampling, bootstrapping, on- and off-policy
- 07.1What a value function approximator should minimise
- 07.2Linear value functions: value as a dot product of features and weights
- 07.3Features: making a linear function expressive enough
- 07.4Semi-gradient TD: bootstrapping when the target depends on the weights
- 07.5Semi-gradient SARSA: control with a linear action-value function
- 07.6The deadly triad: when approximation, bootstrapping and off-policy updates diverge
- 08.1Neural Q-learning: a network in place of the table
- 08.2Experience replay: reuse transitions and break their correlation
- 08.3Target networks: freeze the regression target
- 08.4DQN: the whole agent, and what each part contributes
- 08.5Double DQN: separating the action choice from its evaluation
- 08.6Prioritised replay: sample the transitions with the most to teach
- 08.7Dueling networks: separate how good the state is from how much the action matters
- 08.8Noisy networks: learn the exploration schedule instead of setting it
- 08.9The distributional Bellman operator: learn the return's distribution, not its mean
- 08.10C51: a fixed support, a projected target, and a cross-entropy loss
- 08.11Rainbow: which of the six improvements the score depends on
- 09.1Parameterised policies: putting the parameters in the actor
- 09.2The policy gradient theorem: a gradient that needs no model
- 09.3REINFORCE: the Monte Carlo policy gradient, and why it is so noisy
- 09.4Baselines: subtract anything that does not depend on the action
- 09.5Actor–critic: learn the baseline by bootstrapping, and pay for it in bias
- 09.6GAE: the λ-return, applied to the advantage
- 09.7Parallel rollouts: where a policy-gradient batch comes from
- 09.8The natural gradient: steepest ascent in distribution space, not parameter space
- 09.9The performance difference lemma: what changing the policy actually buys
- 09.10TRPO: a step size with a monotonic improvement guarantee
- 09.11PPO: the trust region as a clipped ratio
- 09.12What PPO actually needs to work
- 10.1The deterministic policy gradient: differentiate through the critic
- 10.2DDPG: DQN's stabilisers with a deterministic actor
- 10.3TD3: three corrections, each aimed at a measured failure
- 10.4Maximum-entropy RL: pay the agent to stay uncertain
- 10.5Soft Bellman equations: the max becomes a log-sum-exp
- 10.6SAC: the maximum-entropy objective made practical
- 10.7Tuning the temperature by constraining entropy instead
- 10.8Choosing among PPO, TD3 and SAC
- 11.1Learning the dynamics, and why a long rollout is fiction
- 11.2Separating what is unknowable from what is merely unknown
- 11.3Planning at decision time: optimise a short action sequence, execute one step
- 11.4MBPO: branch short model rollouts off real states
- 11.5Learning to imagine in a latent space
- 11.6Self-play: generating a curriculum with no opponent to hand
- 11.7AlphaZero: search as a policy improvement operator
- 11.8MuZero: learn a model that is only required to predict what planning needs
- 11.9When learning a model pays for itself
- 12.1Behaviour cloning: imitation as supervised learning
- 12.2Why a small imitation error becomes a large one
- 12.3DAgger: label the states the learner actually visits
- 12.4Inverse RL: recover the reward, and find that many rewards fit
- 12.5Maximum-entropy IRL: pick the reward that commits to the least
- 12.6GAIL: match occupancy measures without ever naming a reward
- 12.7Choosing between cloning, DAgger, IRL and adversarial imitation
- 13.1Offline RL: why more data does not fix extrapolation
- 13.2Off-policy evaluation by reweighting logged trajectories
- 13.3Fitted Q-evaluation: regression instead of reweighting
- 13.4Doubly robust estimation: correct a model with the ratios you already have
- 13.5Stay near the data: constrain the policy, not the value
- 13.6CQL: push down the values of actions you have not seen
- 13.7IQL: improve the policy without ever evaluating an unseen action
- 13.8Decision Transformer: condition on the return you want
- 13.9Choosing an offline method, and knowing whether it worked
- 14.1A language model is a policy over an enormous action space
- 14.2From "which of these two is better" to a numeric reward
- 14.3Training a network to score responses, and measuring whether it can
- 14.4Maximise reward, but stay close to the model you started from
- 14.5RLHF: PPO on a language model, and everything that differs
- 14.6Goodhart's law, measured
- 14.7DPO: the reward model was never needed
- 14.8Why on-policy preference data keeps winning
- 15.1Drop the critic: the group is the baseline
- 15.2GRPO: group-relative advantages with a clipped surrogate
- 15.3Two divisions, two biases, and the corrected estimator
- 15.4Keeping a long run from becoming deterministic
- 15.5Spend the sampling budget where the gradient is not zero
- 15.6Rewards a program can check
- 15.7Rewarding the answer, or rewarding every step
- 15.8Sample, keep what passes, fine-tune on it
- 15.9The policy will find whatever the reward actually measures
- 15.10Training a policy that calls tools and acts over many turns
- 15.11The systems problem: generation, scoring and training on the same cluster
- 15.12SFT, rejection sampling, DPO, PPO or GRPO
- 15.13A reasoning run, read as evidence
01.2Markov decision processes: the formal problem
01.3Policies: a decision rule, and the Markov chain it induces
01.4Returns and discounting: the objective
01.5Value functions: expected return from a state or a state–action pair
01.6Bellman expectation equations: value as a one-step recursion
01.7Optimal policies and the Bellman optimality equations
01.8Occupancy measures: where a policy spends its time
01.9Partial observability: when the agent cannot see the state
02.1Multi-armed bandits and regret: scoring exploration
02.2Action-value estimation: the incremental update rule
02.3Epsilon-greedy exploration: exploring blindly, and its linear regret
02.4Upper confidence bounds: optimism in the face of uncertainty
02.5Thompson sampling: explore by sampling from the posterior
02.6Contextual bandits: arms whose value depends on what you observe
02.7Choosing a bandit strategy: epsilon-greedy, UCB, Thompson or contextual
03.1Bellman operators and contraction: why repeated backups converge
03.2Iterative policy evaluation: applying the expectation operator
03.3The policy improvement theorem: acting greedily on Q cannot hurt
03.4Policy iteration: evaluate, improve, repeat
03.5Value iteration: one backup per sweep with the max
03.6Generalised policy iteration: evaluation and improvement as two interacting processes
04.1Monte Carlo prediction: average the returns you observe
04.2Temporal-difference prediction: bootstrap from the next estimate
04.3TD versus Monte Carlo: bias, variance and what each converges to
04.4n-step returns: bootstrapping after n real rewards
04.5The λ-return: averaging all n-step returns
04.6Eligibility traces: the λ-return computed backward, online
05.1Monte Carlo control: generalised policy iteration from episodes
05.2Off-policy prediction: learning about one policy from another's data
05.3SARSA: on-policy temporal-difference control
05.4Q-learning: off-policy control with the max
05.5Expected SARSA: average over the next action instead of sampling it
05.6Maximisation bias: why max over estimates overestimates, and double Q-learning
05.7Tabular methods compared: sampling, bootstrapping, on- and off-policy
06.1Dyna-Q: learn a model and plan with simulated experience
06.2Model error: when planning confidently follows a wrong model
06.3Prioritised sweeping: plan backwards from where values changed
06.4Monte Carlo tree search: planning at decision time by sampling
07.1What a value function approximator should minimise
07.2Linear value functions: value as a dot product of features and weights
07.3Features: making a linear function expressive enough
07.4Semi-gradient TD: bootstrapping when the target depends on the weights
07.5Semi-gradient SARSA: control with a linear action-value function
07.6The deadly triad: when approximation, bootstrapping and off-policy updates diverge
08.1Neural Q-learning: a network in place of the table
08.2Experience replay: reuse transitions and break their correlation
08.3Target networks: freeze the regression target
08.4DQN: the whole agent, and what each part contributes
08.5Double DQN: separating the action choice from its evaluation
08.6Prioritised replay: sample the transitions with the most to teach
08.7Dueling networks: separate how good the state is from how much the action matters
08.8Noisy networks: learn the exploration schedule instead of setting it
08.9The distributional Bellman operator: learn the return's distribution, not its mean
08.10C51: a fixed support, a projected target, and a cross-entropy loss
08.11Rainbow: which of the six improvements the score depends on
09.1Parameterised policies: putting the parameters in the actor
09.2The policy gradient theorem: a gradient that needs no model
09.3REINFORCE: the Monte Carlo policy gradient, and why it is so noisy
09.4Baselines: subtract anything that does not depend on the action
09.5Actor–critic: learn the baseline by bootstrapping, and pay for it in bias
09.6GAE: the λ-return, applied to the advantage
09.7Parallel rollouts: where a policy-gradient batch comes from
09.8The natural gradient: steepest ascent in distribution space, not parameter space
09.9The performance difference lemma: what changing the policy actually buys
09.10TRPO: a step size with a monotonic improvement guarantee
09.11PPO: the trust region as a clipped ratio
09.12What PPO actually needs to work
10.1The deterministic policy gradient: differentiate through the critic
10.2DDPG: DQN's stabilisers with a deterministic actor
10.3TD3: three corrections, each aimed at a measured failure
10.4Maximum-entropy RL: pay the agent to stay uncertain
10.5Soft Bellman equations: the max becomes a log-sum-exp
10.6SAC: the maximum-entropy objective made practical
10.7Tuning the temperature by constraining entropy instead
10.8Choosing among PPO, TD3 and SAC
11.1Learning the dynamics, and why a long rollout is fiction
11.2Separating what is unknowable from what is merely unknown
11.3Planning at decision time: optimise a short action sequence, execute one step
11.4MBPO: branch short model rollouts off real states
11.5Learning to imagine in a latent space
11.6Self-play: generating a curriculum with no opponent to hand
11.7AlphaZero: search as a policy improvement operator
11.8MuZero: learn a model that is only required to predict what planning needs
11.9When learning a model pays for itself
12.1Behaviour cloning: imitation as supervised learning
12.2Why a small imitation error becomes a large one
12.3DAgger: label the states the learner actually visits
12.4Inverse RL: recover the reward, and find that many rewards fit
12.5Maximum-entropy IRL: pick the reward that commits to the least
12.6GAIL: match occupancy measures without ever naming a reward
12.7Choosing between cloning, DAgger, IRL and adversarial imitation
13.1Offline RL: why more data does not fix extrapolation
13.2Off-policy evaluation by reweighting logged trajectories
13.3Fitted Q-evaluation: regression instead of reweighting
13.4Doubly robust estimation: correct a model with the ratios you already have
13.5Stay near the data: constrain the policy, not the value
13.6CQL: push down the values of actions you have not seen
13.7IQL: improve the policy without ever evaluating an unseen action
13.8Decision Transformer: condition on the return you want
13.9Choosing an offline method, and knowing whether it worked
14.1A language model is a policy over an enormous action space
14.2From "which of these two is better" to a numeric reward
14.3Training a network to score responses, and measuring whether it can
14.4Maximise reward, but stay close to the model you started from
14.5RLHF: PPO on a language model, and everything that differs
14.6Goodhart's law, measured
14.7DPO: the reward model was never needed
14.8Why on-policy preference data keeps winning
15.1Drop the critic: the group is the baseline
15.2GRPO: group-relative advantages with a clipped surrogate
15.3Two divisions, two biases, and the corrected estimator
15.4Keeping a long run from becoming deterministic
15.5Spend the sampling budget where the gradient is not zero
15.6Rewards a program can check
15.7Rewarding the answer, or rewarding every step
15.8Sample, keep what passes, fine-tune on it
15.9The policy will find whatever the reward actually measures
15.10Training a policy that calls tools and acts over many turns
15.11The systems problem: generation, scoring and training on the same cluster
15.12SFT, rejection sampling, DPO, PPO or GRPO
15.13A reasoning run, read as evidence
16.1Adding reward without changing the optimal policy
16.2Optimism at scale: a bonus for states you have rarely seen
16.3Curiosity: reward the agent for being surprised
16.4Remember promising states and return to them
16.5Every failure is a success at something else
17.1Options: actions that last
17.2Discovering the hierarchy instead of designing it
17.3More than one learner: the environment stops being stationary
17.4Use the extra information while training, not while acting
18.1Optimising one objective subject to a bound on another
18.2Training where samples are cheap, deploying where they are not
18.3Reporting a result that replicates
18.4Given a problem, does RL apply, and which part
Skipped topics
Moved past without finishing. A skipped topic still closes its module, and Continue goes on without it — open one to read it or mark it understood.
Glossary
The vocabulary of the authored lessons, grouped by subject and linked to the topic that derives each idea.
Agent–environment loop
The interface the whole subject is built on: the agent observes, acts, receives a scalar reward, and repeats.
More detail
Three things separate it from supervised learning. No example carries its correct answer — only a number saying how good the chosen action turned out. Consequences are delayed, so the reward that arrives now may be owed to a decision taken far earlier. And the agent's own actions decide what data it will see next, which makes the training distribution a consequence of the policy rather than a fixed fact.
Reward hypothesis
The assumption that any goal can be expressed as maximisation of the expected cumulative scalar reward.
More detail
It is an assumption the field adopts, not a theorem it proves. It buys a single, comparable objective; it costs the ability to express goals that are genuinely multi-objective or lexicographic without first choosing an exchange rate between them. Later topics on reward shaping, reward misspecification and reward hacking are all consequences of taking it seriously.
Trajectory
One run of the loop, written as the alternating sequence of states, actions and rewards it produced.
More detail
Written with the convention that the agent in state s_t takes a_t and receives r_{t+1} on arriving in s_{t+1}, so a reward is always indexed by the state it arrives with. A trajectory is the unit of data for every Monte Carlo method and the object whose probability the policy-gradient theorem differentiates.
Episodic and continuing tasks
An episodic task ends in a terminal state and restarts; a continuing task runs without end.
More detail
The distinction decides whether a return can be summed without discounting. An episodic task has a finite sum by construction; a continuing one does not, which is the whole reason discounting is introduced. A terminal state is conventionally absorbing with zero reward, which lets both cases share one set of equations.
Markov decision process
The formal problem: states, actions, a transition kernel, a reward function and a discount.
More detail
Written as a tuple so that every later claim has something precise to quantify over. Finite state and action sets make tables and exact solutions possible; continuous ones do not, and the course's whole second half is the consequence.
Markov property
The current state is a sufficient statistic of the history: the future is conditionally independent of the past given it.
More detail
A property of the state representation, not of the world. The same physical system is Markov under one choice of state variables and not under another — which is why dropping a variable from a gridworld's state breaks it, and why partial observability is a modelling failure rather than a different universe.
Transition kernel
P(s' | s, a): the probability of landing in each next state given the current state and the action taken.
More detail
Knowing it is exactly what separates planning from learning. Dynamic programming assumes it; model-free methods refuse to; model-based methods learn an approximation of it and pay for the approximation's errors along a rollout.
Policy
A decision rule mapping each state to a distribution over actions.
More detail
Fixing one collapses an MDP into a Markov reward process, which is why a policy can be evaluated at all. Deterministic policies are a special case; stochastic ones are strictly better when the state is aliased or an opponent can exploit predictability.
Markov reward process
What an MDP becomes once a policy is fixed: a Markov chain with a reward attached to each transition.
More detail
The induced chain has transition matrix P^π and reward vector R^π obtained by averaging the MDP's own over the policy's action distribution. Every policy-evaluation method in the course is a method for this object, not for the MDP.
State aliasing
Two genuinely different states that the agent's representation cannot tell apart.
More detail
The practical reason stochastic policies are needed: a deterministic rule must choose the same action in both, and if the right actions differ it is wrong in at least one. Randomising bounds the damage. Aliasing is the same defect that partial observability formalises.
State-value function
V^π(s): the expected return from state s when the policy π is followed thereafter.
More detail
An expectation over everything random downstream — the policy's action choices and the environment's transitions. Defining it as an expectation is what makes states comparable at all, since individual returns from the same state can differ arbitrarily.
Action-value function
Q^π(s, a): the expected return from taking a in s and following π afterwards.
More detail
More useful than V^π for control: acting greedily on Q needs no model, while acting greedily on V requires looking one step ahead through the transition kernel. That single fact is why every model-free control method in the course learns Q rather than V.
Advantage function
A^π = Q^π − V^π: how much better an action is than the policy's own average in that state.
More detail
It has mean zero under the policy, which is exactly the property that makes it a legitimate baseline-subtracted signal in policy gradients. It isolates the part of a return that the action is responsible for, discarding the part that the state alone explains.
Bellman expectation equation
Value as a one-step recursion: the immediate reward plus the discounted value of where the action leads.
More detail
Obtained by expanding the return one step with the law of total expectation. It turns an exponential enumeration over trajectories into a linear system in the state values, solvable in closed form as (I − γP^π)⁻¹R^π for γ < 1. Every prediction algorithm in the course is a way of solving or approximating it.
Optimal policy
A policy at least as good as every other in every state simultaneously.
More detail
That such a policy exists at all is a theorem, not a definition — the partial order on policies is not obviously total. For a finite discounted MDP one exists and can be taken deterministic and stationary, which is why the search can be restricted to that much smaller set.
Bellman optimality equation
The same recursion with a maximum over actions in place of the policy's average.
More detail
The maximum makes the system nonlinear, so the matrix solve that worked for a fixed policy no longer applies — which is precisely the gap dynamic programming fills by iterating an operator instead of inverting a matrix.
Greedy policy
The deterministic policy that takes the highest-valued action in each state according to a given Q.
More detail
Greedy with respect to Q* is optimal. Greedy with respect to an approximate Q is not, and the loss is bounded by the value error amplified by 2γ/(1−γ) — a bound that explains why small value errors are tolerable and why the tolerance shrinks as the horizon grows.
Occupancy measure
d^π: the normalised discounted distribution of states, or state–action pairs, that a policy visits.
More detail
It makes the objective linear: expected return is the occupancy-weighted average reward, up to the 1/(1−γ) factor. That linearity is what turns policy search into a linear program, what the performance-difference lemma is stated in, what adversarial imitation matches, and what constrained MDPs write their constraints over.
Bellman flow constraint
The conservation law an occupancy measure satisfies: what flows into a state equals what starts there plus what arrives from elsewhere.
More detail
The dual counterpart of the Bellman equation. Where the Bellman equation propagates value backwards, the flow constraint propagates probability forwards, and the two are the primal and dual of the same linear program.
Partially observable MDP
An MDP whose state the agent never sees directly, receiving only an observation drawn from it.
More detail
The realistic case: a camera frame, a sensor reading or a token prefix is not the state. Memoryless policies over observations can be arbitrarily bad, so a POMDP forces the agent to carry some summary of history — which every practical agent does, whether as stacked frames, a recurrent state or a context window.
Belief state
The posterior over hidden states given the history — a Markov state recovered by Bayesian filtering.
More detail
It restores the Markov property exactly, turning the POMDP into an MDP over beliefs. The price is that the belief space is a continuous simplex even when the underlying state set is small, so exact solution is intractable in general and practical agents approximate the belief with a learned summary instead.
Return
G_t: the discounted sum of rewards from time t onwards — the random quantity the agent is trying to make large.
More detail
Random, because both the policy and the dynamics are. That randomness is the reason a state cannot be scored by one observed return and the reason value functions are defined as expectations. Its one-step recursion G_t = r_{t+1} + γ G_{t+1} is the seed of every Bellman equation.
Discount factor
γ in [0, 1): the weight on a reward one step later, which makes an infinite sum finite.
More detail
It does two jobs that are worth separating. Mathematically it guarantees convergence and bounds the return by R_max/(1−γ). Behaviourally it encodes a preference for sooner over later — and where the real goal has no such preference, γ misstates it, which is the case for the average-reward formulation.
Effective horizon
Roughly 1/(1−γ) steps: how far ahead a discounted objective meaningfully looks.
More detail
It comes straight out of the geometric series, and it is the right unit for reading every bound in the course. A 1/(1−γ)² factor in an error bound is not arbitrary — it is one horizon for the length of a trajectory and another for the number of trajectories the error propagates through.
Multi-armed bandit
A one-state MDP: k actions, a reward drawn from each action's own fixed distribution, and no consequences for the future.
More detail
Stripping out state and delayed consequences leaves exploration in pure form — to learn which action is best you must spend pulls on actions that may be worse. Everything the full problem adds sits on top of this; nothing about it goes away.
Regret
The shortfall against always having pulled the best arm — the quantity every exploration strategy is scored by.
More detail
Its decomposition into gaps times expected pull counts is what makes analysis tractable: a strategy is judged by how many times it pulls each suboptimal arm, and the gap converts that count into a cost. Sublinear regret means the per-step loss vanishes; linear regret means it does not.
Gap
Δ_a: how much worse arm a's mean is than the best arm's.
More detail
It appears twice and in opposite directions. A small gap makes an arm cheap to pull wrongly but hard to rule out, and the 1/Δ² in every pull-count bound times the Δ in the regret decomposition gives the characteristic 1/Δ dependence.
Incremental update rule
Q ← Q + α(target − Q): move the estimate a fraction of the way towards a new observation.
More detail
With α = 1/n it computes the exact running mean in constant memory. With α constant it becomes an exponential recency-weighted average that tracks a changing target and never fully forgets its initial value. This shape — estimate, target, step size — is reused by every learning update in the course.
Exponential recency weighting
What a constant step size does: weight α(1−α)^(n−i) on the i-th of n observations.
More detail
The weights are a geometric sequence that never reaches zero, so a constant step size is the right choice when the target moves and the wrong one when it does not — the estimate keeps a permanent variance floor proportional to α.
Epsilon-greedy
Act greedily, except with probability ε act uniformly at random.
More detail
The simplest strategy that explores at all, and the baseline every better one is measured against. Its exploration is undirected: it spends the same budget on an arm already known to be terrible as on one that might still be best, which is exactly why a fixed ε gives linear regret.
Optimistic initial values
Start every estimate above any achievable reward, so early disappointment drives the agent elsewhere.
More detail
A trick, not a strategy: it explores only while the initial optimism survives, which is a transient whose length can be computed. It also needs a bound on the rewards, and it does nothing for a non-stationary problem where exploration is needed permanently.
Optimism in the face of uncertainty
Act as if each action is as good as its evidence still allows, and the resulting exploration is self-limiting.
More detail
The principle behind UCB and, later, behind count-based exploration bonuses in deep RL. Its self-limiting property is the point: an arm's optimistic index falls as it is pulled, so an arm that is genuinely bad stops being chosen without anyone deciding to stop.
Confidence width
The bonus added to an arm's estimate, shrinking as its pull count grows.
More detail
It comes from a tail bound rather than from taste: Hoeffding plus a union bound over arms and rounds fixes how wide the interval must be for the optimism to be valid simultaneously everywhere. Shrinking it makes the algorithm greedy and can lose a good arm permanently.
Lai–Robbins lower bound
No strategy can do better than logarithmic regret with a KL-divergence constant, asymptotically and on every instance.
More detail
It is what makes UCB's bound meaningful: the logarithm is not an artefact of the analysis, it is the truth. Read its scope carefully — it is asymptotic in the horizon and instance-dependent, so it constrains neither finite horizons nor worst-case bounds.
Thompson sampling
Keep a posterior over each arm's mean, draw one sample per arm, and act greedily in that sampled world.
More detail
Exploration falls out of the posterior's width rather than from a hand-built bonus, and the probability of pulling an arm equals the posterior probability that it is best. It handles prior knowledge, batched feedback and delay more gracefully than an index rule, because a stale posterior is still a valid posterior.
Probability matching
Choosing each action with exactly the probability that it is optimal, given everything observed.
More detail
The property that defines Thompson sampling, and the reason a single posterior draw is enough: the draw is the sampling mechanism, not an approximation to one.
Contextual bandit
A bandit that observes a context before acting, so the best action depends on what was observed.
More detail
The right model for recommendation and personalised ranking, and the exact boundary of the bandit reduction: it holds as long as the action does not change the next context. Once it does, the problem is a full MDP and the bandit guarantees stop applying.
LinUCB
Optimism for a linear reward model: a ridge estimate plus a confidence ellipsoid around it.
More detail
The bonus is the Mahalanobis norm of the feature vector under the inverse design matrix, which is large exactly in directions the data has not covered. Its guarantee rests on the reward really being linear in the features — a modelling assumption, not a free lunch.
Constrained MDP (CMDP)
An MDP with a second return — a cost signal and a bound it must not exceed: maximise J_r subject to J_c <= d.
More detail
Both objective and constraint are linear in the occupancy measure, so the problem is a linear program; the optimum usually sits on the constraint boundary, which is why the optimal policy is generally stochastic rather than a switch.
Dual ascent
Tuning the constraint's price by feedback: raise the multiplier when the bound is violated, lower it when it is slack.
More detail
The update lambda <- [lambda + eta(J_c - d)]+ replaces the guessed penalty in r - lambda c with a price the constraint itself sets. On a piecewise-affine dual the iterates oscillate; the running average converges and the deployed policy is the time-mixed one.
Domain randomisation
Train across a chosen distribution of simulator parameters instead of one simulator, so the policy must work everywhere the distribution covers.
More detail
Its deeper reading is a POMDP whose hidden state is the parameter vector: a policy with memory trained on the randomised problem performs online system identification — early steps probe the dynamics, later steps exploit what was inferred.
Automatic domain randomisation (ADR)
A ratchet curriculum that widens each randomisation range only after the policy proves it copes at that boundary.
More detail
Start collapsed at the nominal parameter; expand a dimension's range when success at its boundary passes a threshold. The distribution grows outward at the speed competence grows, so training signal survives and coverage eventually includes reality.
Interquartile mean (IQM)
The mean of the middle half of the seed scores — discard the bottom and top quartiles, average what is left.
More detail
Robust to RL's bimodal return law, where a mean over five seeds averages a lottery: two lucky 950s and three failed 50s read as competence. The IQM reports the bulk — what a random run actually delivers.
Performance profile
The fraction of runs exceeding a threshold, drawn as a function of the threshold — the return CDF read as a success curve.
More detail
Profiles expose trade-offs no scalar can: curves that cross mean neither algorithm dominates, and the answer depends on which threshold the application cares about. No crossing means the domination is real.
Probability of improvement
The probability that a run of algorithm A beats a run of algorithm B, estimated over all seed pairs.
More detail
A Mann-Whitney-type statistic that asks the deployment question directly — what does one run deliver — rather than the mean's question of what an imaginary average run delivers. Under 0.5, the 'worse' algorithm wins the pairwise lottery.
The five-question triage
Evaluative or supervised feedback? Action changes the state? Environment sampleable? Reward checkable? What is the sample budget?
More detail
The course's decision order, cheapest question first: each answer eliminates a family, and two of the common outcomes are that RL is the wrong tool — stateless feedback is a bandit, and a hard physical bound needs enforcement, not optimisation.
Option
A closed piece of behaviour invocable as an action: initiation set, internal policy, termination function.
More detail
A primitive action is the degenerate option — available everywhere, terminating in one step. Options generalise actions so a planner can decide 'walk to the door' once instead of re-deciding every step; the catch is that the option was designed, and learning it is the next topic's problem.
Semi-Markov decision process
The process a planner sees over options: Markov at the decision boundaries, uncontrolled inside them.
More detail
Its Bellman equation differs from the ordinary one in exactly the discount: the successor is weighted by gamma^k for the option's random duration k, because rewards keep arriving per step while the decision waits for termination.
Intra-option learning
Updating every option whose internal policy would have taken the observed action — not only the option that ran.
More detail
The data are off-policy for the consistent options, so they can learn from trajectories they never executed. The consistency check is the action-level condition importance sampling needs, which is what makes the update legitimate.
Degenerate option collapse
Gradient-descent option learning produces options that terminate after one step — a flat policy in hierarchical costume.
More detail
Nothing in the objective prefers long options, so the trivial hierarchy is an interior optimum. The fixes are a per-termination deliberation cost, or a feudal architecture where a slow manager's held goal cannot re-decide early.
Markov game
The multi-agent MDP: one shared state, simultaneous per-player actions, a transition kernel and a reward per player.
More detail
From any one agent's view the kernel averages over the opponents' policies, so the environment moves whenever they learn — the structural reason single-agent convergence guarantees stop applying.
Nash equilibrium
A joint policy where every player's component is a best response to the rest — the replacement for 'optimal policy' when no single decision-maker exists.
More detail
Existence needs mixed strategies; matching pennies shows why — every deterministic pair has a deviating player, and the only stable point is half-half mixing, computed by a one-variable linear program.
CTDE
Centralised training, decentralised execution: the critic sees the joint state while learning, actors see only their own observations when deployed.
More detail
Conditioned on the joint action the environment's law is fixed, so the critic regresses a stationary target while the actors stay deployable. The non-stationarity does not vanish — it moves into the training signal.
Monotonic value factorisation
Writing the team's joint value as a monotone mixture of per-agent utilities, so each agent's local argmax composes to the joint argmax.
More detail
QMIX enforces the monotonicity with non-negative mixer weights. The price is that only monotone factorisations are expressible — a genuinely non-monotonic synergy cannot be represented.
Counterfactual baseline
Per-agent credit from a shared reward: compare the realised value to the value averaged over that agent's alternative actions.
More detail
COMA's D_i asks 'did your action beat your own policy' while holding the others fixed — computable only because the centralised critic can evaluate counterfactual joint actions at training time.
Potential-based shaping
The only reward shaping guaranteed to preserve every optimal policy: F(s,a,s') = gamma*Phi(s') - Phi(s), a difference of a state potential.
More detail
The potential appears twice in the Bellman equation with opposite signs and cancels, so Q* shifts by a per-state constant and every argmax is unchanged. A shaping that is not a potential can carry a positive cycle the agent exploits forever.
Pseudo-count
A count generalised through a density model: how much the model's belief in a state rises when the state is seen once more.
More detail
N_hat = rho(1-rho')/(rho'-rho) recovers the empirical count exactly for the tabular model, so it is a true count extended to pixel states, not a proxy. It needs a learning-positive model and counts observation novelty, not relevance — the noisy TV scores as permanently novel.
Noisy TV problem
A source of irreducible randomness pays a prediction-error bonus forever, because the model can never stop erring on what cannot be predicted.
More detail
The pathology that splits epistemic from aleatoric error. ICM filters it at the features (only action-predictive structure survives); RND removes it at the target (a fixed random function has no aleatoric floor). Both are ways of changing what is predicted so the bonus cannot pay noise.
Random network distillation
A fixed random network as the prediction target: intrinsic reward = the predictor's error matching it, which is pure novelty.
More detail
The target is deterministic, so the error is entirely epistemic — a state is surprising only if unfit. The TV is fit once and dropped; the method trades ICM's action-filtering for a guarantee that no noise floor can persist.
Detachment
The frontier forgotten: once a region's novelty bonus decays, the agent no longer knows it ever led anywhere.
More detail
A per-state bonus is a signal, not a memory — it cannot say 'return here later'. Archive-based exploration fixes it by keeping the frontier as a data structure: cells visited, with the best trajectory reaching each.
Hindsight relabelling
Rewrite a failed trajectory's goal to the state it actually reached — a zero-reward episode becomes a positive demonstration for the achieved goal.
More detail
Valid because the dynamics ignore the goal, so the transition is real experience for any reward function that depends on g alone. Biased in stochastic environments, where conditioning on the achieved outcome keeps the lucky draws.
Dyna-Q
Q-learning plus a model table plus n simulated updates per real step — planning and learning share one backup.
More detail
The simulated update is the same code path fed by the stored transition instead of the world; n moves the propagation bottleneck from environment to compute.
Prioritised sweeping
A max-heap of stored transitions keyed by |TD error|, so planning backups land on the wavefront where values actually change.
More detail
When a state's value moves its predecessors are enqueued; the change propagates backward along model edges at compute speed. Costs an inverse-adjacency table and only pays off when the error landscape is sparse.
Monte Carlo tree search
Decision-time planning: grow a tree from the current state, select by UCT, expand, roll out with a cheap policy, back up the mean.
More detail
Anytime — every iteration improves the root estimate. Spends compute on the reachable frontier instead of a value for every state; the rollout policy's bias is its cap.
UCT
UCB1 applied to each node of a search tree: argmax over mean plus c*sqrt(ln N/N_a).
More detail
Each node is a bandit; Kocsis-Szepesvari proved root regret is logarithmic in simulations, which is why the most-visited child is trustworthy under a finite budget.
Dyna-Q+ bonus
r + kappa*sqrt(tau) added to the modelled reward for an action untried tau steps — optimism over model staleness.
More detail
Repairs the shortcut-maze failure by making an unvisited passage's simulated value grow until it wins; the stored reward stays honest, the planner is paid to retest.
ε-soft policy
Every action keeps probability at least epsilon/|A| — soft enough that every state-action pair keeps being visited.
More detail
The condition under which Monte Carlo control converges without exploring starts: GLIE pairs epsilon-softness with epsilon decaying to zero, so the policy becomes greedy in the limit while never stopping exploration early.
Importance sampling ratio
The product of pi/mu along a trajectory — reweights returns sampled under the behaviour policy to estimate the target policy's value.
More detail
Ordinary IS is unbiased but its variance explodes with trajectory length; weighted IS normalises by the sum of ratios, trading a small bias for a usable variance.
SARSA
On-policy TD control: Q(s,a) <- Q + alpha[r + gamma*Q(s',a') - Q], where a' is the action actually taken next.
More detail
It learns the value of the exploring policy, including the cost of its own exploration — which is why it takes the safe path on the cliff walk while Q-learning hugs the edge.
Group baseline
The mean reward of k completions of the same prompt, used as the advantage's V(s) — a critic made of samples.
More detail
The leave-one-out form removes the baseline-sample correlation; it is a Monte Carlo estimate of V(s), so it needs no trained network but no per-token credit either.
GRPO
PPO with the critic replaced by the standardised group advantage, and the KL moved from the reward into the loss.
More detail
The clipped surrogate is unchanged; the conventions it adds — the std divisor, the token-average, the KL placement — are where the two derived biases live.
Clip-higher
An asymmetric clip: the upper bound raised a few x epsilon, the lower kept tight — low-probability tokens get more uplift, feeding entropy back.
More detail
Counters the symmetric clip's positive feedback on already-likely tokens, which is the mechanism of entropy collapse; the entropy curve is the diagnostic it flattens.
Process reward model
A learned scorer that emits a per-step reward for each reasoning step — dense credit at the price of step labels.
More detail
Trained on human or teacher step labels and aggregated by min/mean/product; it fixes the outcome reward's blindness to the derivation but reintroduces a learned boundary the policy can probe.
Rejection sampling
Sample k, keep the R=1 completions, fine-tune on them — policy improvement with no RL machinery.
More detail
A hard-threshold approximation of the tilted optimum pi_ref * e^(beta R): it bootstraps the policy toward its own successes and plateaus at best-of-k, which is why an optimiser follows it.
Reward hacking
The optimiser finds argmax of the proxy, not the intention — Goodhart's law: the gap opens wherever the proxy is coarse.
More detail
Four attack surfaces: simulator physics, learned-reward format, test coverage, rater sycophancy. Countermeasures bound (KL), detect (held-out, spot checks), or shrink (adversarial tests) — none removes the gap.
Token masking
In an agent trajectory, only policy-chosen tokens carry the advantage — environment tokens get weight zero in the loss.
More detail
Crediting the policy for tool outputs would teach it to produce what it does not control; the mask is the whole gradient correctness of multi-turn RL.
First-visit vs every-visit MC
Count a state's return only the first time an episode reaches it, or every time — both unbiased, different variance.
More detail
First-visit treats each episode as one sample per state; every-visit reuses repeats. On blackjack the two coincide because states cannot repeat; on loopy tasks they diverge.
TD error δ
r + γV(s') − V(s): the difference between the one-step-plus-bootstrap target and the current estimate — the signal that drives the update.
More detail
Positive δ means the step went better than the estimate said. It is a biased estimator of the Bellman error whose fixed point is V^π.
Bootstrapping
Updating an estimate from another estimate — TD's r + γV(s') against Monte Carlo's realised return G_t.
More detail
The source of TD's bias and its speed: it does not wait for outcomes, but it writes the current estimates' errors into itself. MC is unbiased at the price of episode-length variance.
Certainty equivalence
Fit the maximum-likelihood model of the MDP, then read off its value — the estimate batch TD converges to.
More detail
On finite data this is the optimum TD reaches and MC misses: TD exploits the Markov structure to reuse every transition, MC fits the returns without assuming it.
n-step return
The return computed from n real rewards plus a bootstrap: G_t:t+n = sum of n rewards + gamma^n * V(S_t+n).
More detail
Interpolates between TD(0) (n=1, biased but low-variance) and Monte Carlo (n=infinity, unbiased but high-variance); the best n is empirical, not derivable.
λ-return
The geometric mixture of all n-step returns: (1-lambda) * sum lambda^(n-1) G_t:t+n — the whole spectrum in one update.
More detail
Equivalent in expectation to weighting every n-step target; implementable online only through eligibility traces, which is why the two objects are taught as one.
Eligibility trace
A per-state memory that decays by gamma*lambda each step and bumps on revisit — which states 'recently mattered'.
More detail
The online mechanism that produces the lambda-return update: accumulate traces, apply the TD error to all of them at once. Dutch traces fix the accumulating trace's overcounting.
Q-learning
Off-policy TD control: the target bootstraps max over the next actions, so it evaluates the greedy policy regardless of what the behaviour policy did.
More detail
No importance ratios needed — the max is over the action set, not over the sampled action. Converges to Q* under Robbins-Monro step sizes plus every pair visited infinitely often (Watkins-Dayan).
Expected SARSA
Q-learning's twin that averages the next action under the target policy instead of sampling or maximising it: E_pi Q(s', a').
More detail
Lower variance than SARSA's sampled target, so a larger step size works; reduces to Q-learning exactly when the target policy is greedy.
Bradley–Terry model
The pairwise-preference likelihood: P(a beats b) = sigma(r_a - r_b). Preference learning reduces to fitting scores under a logistic comparison.
More detail
Shift-invariant — only reward differences are identified, which is why the DPO partition function cancels rather than needing to be computed.
Reward model
A learned scalar stand-in for human judgement, trained on Bradley-Terry comparisons and queried by the RL loop.
More detail
Accurate only near the distribution it trained on — the overoptimisation curve is the measured version of that limit.
RLHF
Reinforcement learning from human feedback: SFT -> preference data -> reward model -> KL-regularised policy optimisation against it.
More detail
InstructGPT's pipeline: the reward is per-token -beta log(pi/pi_ref) plus the model score at the end token.
Reward overoptimisation
Proxy score climbs while true (gold) score peaks and falls as a function of sqrt(KL) moved. The quantitative form of reward hacking.
More detail
Gao-Schulman-Hilton's fitted laws: d(alpha - beta log d) for RL, d(alpha - beta d) for best-of-n; the peak moves with proxy data and size, never vanishes.
DPO
Direct Preference Optimisation: invert the tilted optimum, substitute into Bradley-Terry, and preference learning becomes supervised classification — no reward model, sampler, or critic.
More detail
Only the log-ratio to pi_ref is supervised, so both completions' likelihoods can fall while the margin rises; off-policy by construction.
Iterative DPO
Alternate rounds of sampling pairs from the current policy, labelling them, and DPO-training — tracks coverage to within one round of drift.
More detail
The middle ground between frozen offline pairs and per-step online labelling; per-round cost is 2K generations + K labels.
Mean-squared value error
The objective for value approximation: weighted squared distance between the approximated values and the true value function, weighted by the on-policy distribution.
More detail
With fewer parameters than states the true values are unreachable — minimising the weighted error is what generalisation means here.
Linear value function
v(s;w) = w^T x(s): the value as a linear combination of state features. The whole learning problem reduces to finding w.
More detail
Convex objectives, one optimum for gradient Monte Carlo; linearity is what makes the theory tight and the features decisive.
Tile coding
Coarse coding by overlapping offset tilings: each tiling contributes one active feature per state, so the active count stays constant and the step size is exactly controllable.
More detail
Resolution comes from tile width, generalisation from the number of tilings; the standard recipe for linear methods on continuous state spaces.
Behaviour cloning
Imitation as supervised learning: fit a policy to (s, a) pairs from the expert's occupancy. No reward, no dynamics, no interaction.
More detail
Cost-blind and distribution-blind: errors are unweighted by consequence, and the fit is certified only under the expert's state distribution.
Compounding error
A learned policy generates its own test distribution: per-step error epsilon compounds off-support to O(epsilon H^2) regret, not O(epsilon H).
More detail
The union bound 1-(1-eps)^t summed over the horizon gives the square; the bound is tight, and only training on the learner's own occupancy removes it.
DAgger
Dataset aggregation: roll the (beta-mixed) learner, label visited states with an expert oracle, refit on the aggregate.
More detail
Trains under the learner's own state distribution and recovers O(epsilon H); costs a queryable expert and executing imperfect policies.
Inverse RL
Recover the reward the demonstrator was optimising: the one explanation that transfers to changed dynamics.
More detail
Ill-posed — R=0 always fits and potential shaping preserves the optimal policy; feature matching w^T mu(pi*) >= w^T mu(pi) is the usable form.
Maximum-entropy IRL
Pick the reward whose induced trajectory distribution p(tau) ~ exp(w^T phi(tau)) commits to the least beyond feature matching.
More detail
ML gradient is demonstrated minus expected feature counts — and the expectation needs a soft-optimality solve per gradient step.
GAIL
Adversarial imitation: a discriminator separates expert from policy (s,a) pairs; its log-odds is the reward. Equivalent to JS occupancy matching.
More detail
Trades IRL's inner solve for an ordinary RL run against a moving discriminator — tractable, unstable, and produces no inspectable reward.
Semi-gradient method
A bootstrapped update that ignores the target’s dependence on the weights; convergent for linear on-policy TD, unguaranteed in general.
More detail
The TD target r + γv(s′,w) itself depends on w. A semi-gradient update differentiates only the prediction and treats the target as fixed. The fix works on-policy (a contraction argument gives convergence) but fails under off-policy sampling, function approximation and bootstrapping together — the deadly triad — where divergence is possible.
Double Q-learning
Two independent value estimates: one picks the argmax action, the other prices it — decoupling selection from evaluation removes the max’s positive bias.
More detail
Plain Q-learning lets one estimate both choose and score the next action, so max-over-estimates overshoots max-over-truth. Keeping Q1 and Q2 and alternating which selects and which evaluates makes the estimator unbiased in the iid case and cuts maximisation bias sharply in practice; the same trick applies to Sarsa and Expected Sarsa.
Support (of a dataset)
The state–action pairs the behaviour policy actually visited — the only region where logged data can teach anything.
More detail
Every offline method is bounded by it: values queried outside support extrapolate and inflate (the bootstrapping failure); constraints forbid leaving it; pessimism penalises it; return-conditioning silently answers beyond it. Coverage quality — which good actions appear — sets the achievable ceiling.
Concentrability
Worst-case density ratio between a candidate policy’s induced occupancy and the behaviour policy’s — the constant that prices coverage in error bounds.
More detail
Appears as √C in FQE’s γ/(1−γ)² error bound and in IS variance: where the candidate asks about actions the log lacks, C explodes and the guarantee is vacuous. It is the same diagnostic ESS measures for importance sampling.
Doubly robust estimation
Model estimate plus an importance-weighted TD residual; unbiased if either the model or the behaviour-policy estimate is right.
More detail
\hat V + ρ(r + γ\hat V′ − \hat Q): the correction has zero mean under a correct model and telescopes to unbiasedness under correct ratios. Variance scales with the residual, not the return — the control-variate gain over plain IS.
Expectile
Asymmetric least squares — |τ−1(u<0)|u² — recovering the mean at τ=0.5 and approaching the max as τ→1.
More detail
IQL’s soft argmax over the data’s support: fit V to the τ-expectile of observed targets r+γV(s′), never querying an unseen action. The τ→1 limit is the best logged continuation, not the best action.
Deterministic policy gradient
Actor gradient computed by the chain rule through the critic: nabla_theta mu * nabla_a Q — no action-space integral, no score function.
More detail
The sigma->0 limit of the stochastic gradient; the score estimator's variance explodes as the policy sharpens (1/sigma^2 amplification), which is what the deterministic form avoids. Requires off-policy data because a deterministic actor cannot explore.
Polyak averaging
Target network as exponential moving average of the online net: theta^- <- tau*theta + (1-tau)*theta^-, tau ~ 0.005.
More detail
Smooths the bootstrap target the way periodic hard copies cannot — the lag damps the chase-the-target oscillation instead of jumping it. Used on both actor and critic in DDPG/TD3/SAC.
Boltzmann policy
pi*(a|s) proportional to exp(Q/alpha) — the closed-form optimum of reward-plus-entropy objectives.
More detail
Derived by Lagrange multipliers from max E[Q] + alpha*H. alpha->0 recovers greedy; the partition function Z is what makes it intractable in continuous spaces, forcing SAC's KL-projection approximation.
Reparameterisation trick
Write a sample as a deterministic function of parameters plus noise, a = f_theta(s, eps), so expectations become differentiable.
More detail
SAC uses a = tanh(mu_theta + sigma_theta * eps), eps ~ N(0,I): pathwise gradients with far less variance than score-function estimates. The tanh squash needs the log-determinant correction log pi(a) = log N(u) - sum log(1 - tanh^2 u).
Aleatoric vs epistemic uncertainty
Aleatoric is the environment’s irreducible noise (Gaussian head); epistemic is the model’s reducible ignorance (ensemble disagreement).
More detail
Total variance = mean of member variances + variance of member means. Only the second shrinks with data — and only it warns a planner it has left the training support, because a single head’s confidence is itself untrustworthy off-distribution.
Branched model rollout
A k-step model rollout launched from a stored real state — error capped at O(k*eps_m) regardless of episode position.
More detail
MBPO’s whole trick: the real buffer anchors every synthetic transition. The bound trades a model-bias term growing in k against a coverage term shrinking as gamma^k, so optimal k is 1–5 whenever the model is imperfect.
PUCT
AlphaZero’s selection rule: Q + c*P(sqrt(N)/ (1+n)) — UCB with a learned prior guiding exploration.
More detail
The P factor is what distinguishes it from plain UCT: the network concentrates simulations on moves a strong player would consider. Value backups flip sign at each edge under the player-to-move convention.
Value-equivalent model
A latent model trained only to predict what planning needs (rewards, values, policy targets) — never to reconstruct observations.
More detail
MuZero’s defining choice: the latent is a sufficient statistic for search targets, so it can be an uninspectable planning summary rather than a world rendering. Costs: opacity and reward-dependence — no reuse under a changed objective.
Compatible function approximation
A critic feature-matched to the score function so the baseline subtracts only noise — the gradient stays unbiased.
More detail
Features proportional to the score make the fitted advantage “compatible”: the natural gradient equals the true policy gradient regardless of approximation error. It is why a state-value baseline is safe and an action-dependent one needs care.
Generalised advantage estimation
Exponentially weighted blend of n-step advantages: A^(GAE) = sum (gamma*lambda)^l delta_{t+l} — the bias/variance dial of actor–critic.
More detail
lambda=0 is the one-step TD advantage (low variance, biased toward the critic); lambda=1 is the Monte Carlo advantage (unbiased, high variance). lambda is set by how much the critic can be trusted, independently of gamma's discounting role.
Natural policy gradient
Precondition the gradient by the Fisher information: step in KL-space, not parameter space.
More detail
F^-1 nabla J makes the update invariant to parameterisation and approximately KL-bounded. TRPO is its constrained form; a Gauss–Newton-style solver makes it practical at network scale.
Performance difference lemma
J(pi') - J(pi) = (1/(1-gamma)) E_{d^pi'}[A^pi] — the identity anchoring every monotonic-improvement argument.
More detail
The new policy's return gain equals its own occupancy's expectation of the old advantage. Surrogate objectives replace d^pi' by d^pi and bound the discrepancy — TRPO's trust region is the price of that swap.
Score function
nabla_theta log pi_theta(a|s) — the eligibility vector that turns sample returns into policy gradients.
More detail
The log-derivative trick: E[f nabla log pi] estimates nabla E[f] without differentiating the environment. For softmax policies it is the feature vector minus its policy-weighted mean; for Gaussian, (a-mu)/sigma^2 times the state features.
REINFORCE
Monte Carlo policy gradient: nabla J = E[sum_t score_t * G_t] — unbiased, and unusably high-variance without a baseline.
More detail
The return scales the whole episode’s score sum; subtracting a learned value baseline keeps the estimator unbiased while cutting orders of magnitude of variance — the step every modern actor–critic descends from.
Policy gradient theorem
nabla J = sum_s d^pi(s) sum_a nabla pi * Q^pi — the gradient needs no derivatives of the dynamics.
More detail
The stationary occupancy d^pi carries the state weighting, so the theorem lets a Monte Carlo critic stand in for everything the model would have supplied. It is the foundation beneath REINFORCE, actor–critic, TRPO and the deterministic variant alike.
Trust region
An average-KL constraint on the policy step — the surrogate objective is trusted only where the new policy stays close.
More detail
TRPO’s max L(theta) s.t. mean-KL <= delta: the theory pays a quadratic penalty for monotonic improvement; the practice solves a linear-quadratic model by conjugate gradient with Fisher-vector products and a backtracking line search.
Clipped surrogate objective
PPO’s min(r*A, clip(r,1-eps,1+eps)*A) — a first-order stand-in for the trust region.
More detail
The clip removes the incentive to move the probability ratio beyond the bracket: improvement is free inside it, flat outside. Empirically matches TRPO-class performance at a fraction of the machinery — which is why it became the default.
Dueling architecture
Split Q into a state-value stream and a mean-subtracted advantage stream: Q = V + A - mean(A).
More detail
In most states every action is near-equivalent, so separate V learning is the sample-efficient path. Mean subtraction beats max subtraction in training despite being less principled — the mean is what E_pi[A]=0 actually imposes.
Wasserstein metric
Earthmover distance between return distributions — the metric in which the distributional Bellman operator contracts.
More detail
W_p(u,v) = (int_0^1 |F_u^-1(t) - F_v^-1(t)|^p dt)^(1/p); it scales as W_p(gU,gV)=gW_p(U,V), giving the gamma-contraction the tabular proof needs. The same operator provably does not contract in KL or total variation.
C51 / categorical distributional RL
Represent the return distribution as 51 fixed atoms; project the Bellman-shifted target back onto the grid and train by cross-entropy.
More detail
The contraction proof lives in Wasserstein but the training loss is cross-entropy — the gap between metric of proof and metric of optimisation is the method's honest caveat. Distribution knowledge buys risk sensitivity and richer learning signal.
Rainbow
C51 + double Q + prioritised replay + dueling + multi-step + noisy nets — six orthogonal fixes composed into one agent.
More detail
The 2017 headline: component fixes are composable because each addresses a different failure (overestimate, prioritisation, state-vs-advantage, return variance, credit window, exploration). The ablation — each removal hurts — is the evidence for composing rather than choosing.
Which method do I reach for?
A decision the reader faces, the recommendation, and the topic that derives the trade-off. Entries appear as their lessons are written.
Decide whether the problem is reinforcement learning at all
Only if the feedback is evaluative rather than a labelled answer, and the actions change what happens next.
More detail
Feedback that names the correct output is supervised learning and should stay there. Evaluative feedback whose actions do not change the future state is a bandit, which is far cheaper to solve. Reinforcement learning earns its cost only when both conditions hold.
Choose what goes into the state
Enough that the next state and reward depend on nothing else — the Markov property is a property of your representation, not of the world.
More detail
Test a candidate representation by asking whether two histories leading to the same state can have different futures. If they can, a variable is missing, and every convergence result in the course stops applying. Adding history — stacked frames, a recurrent summary, a context window — is the standard repair.
Use a stochastic policy or a deterministic one
Stochastic when the state is aliased or an opponent can exploit predictability; deterministic is otherwise a valid optimum for a finite discounted MDP.
More detail
For a fully observed finite MDP a deterministic stationary optimal policy exists, so randomness buys nothing at the optimum. Under aliasing or against an adversary the best deterministic policy can be strictly worse than a stochastic one, and the gap is computable.
Learn V or learn Q
Q when you must act without a model, V when a model or a separate actor supplies the action.
More detail
Acting greedily on V requires looking one step ahead through the transition kernel, which a model-free agent cannot do. Q removes that requirement at the cost of a table or network |A| times larger. Actor–critic methods take the third route: learn V and let a separate policy choose.
Solve the Bellman equations directly or iterate them
Direct matrix inversion only while the state count is small — it is cubic, and it works only for a fixed policy.
More detail
The closed form (I − γP^π)⁻¹R^π is exact and costs O(|S|³), which is fine for a few hundred states and hopeless beyond. It also evaluates one policy rather than finding a good one: the optimality equations are nonlinear, so they admit no such solve at all.
Accept an approximate value function and act greedily on it
Only with the amplification in view: the greedy policy's loss is bounded by the value error times 2γ/(1−γ).
More detail
A uniformly small value error does not give a uniformly small policy loss — the horizon multiplies it. At γ = 0.99 a value error of 0.1 permits a policy loss near 20, so 'the values look close' is not evidence the policy is.
Write a constraint or a weighting over states
Express it in occupancy measures, where both the objective and the constraint are linear.
More detail
Constraints phrased over trajectories or over value functions are awkward; the same constraint over d^π is linear, which is what makes constrained policy search a linear program and what lets the performance-difference lemma be stated at all.
The agent cannot see the full state
Do not hope a memoryless policy will cope — it can be arbitrarily bad. Give the policy history.
More detail
Exact belief-state filtering restores the Markov property but lives on a continuous simplex and is intractable in general. Practical agents approximate the belief with a fixed-length summary: a frame stack, a recurrent hidden state, or the whole token prefix.
Pick a discount factor
Choose it as a horizon, not a convergence trick: 1/(1−γ) should be at least as long as the credit you need to assign.
More detail
A γ too small makes long-horizon credit invisible, and the agent optimises a different problem from the one intended. A γ near one lengthens the horizon but inflates variance and slows every bound's constant. Where the real objective has no time preference at all, say so and consider the average-reward formulation rather than pushing γ towards one.
The actions do not change what happens next
Use a bandit, not reinforcement learning — the guarantees are far stronger and the implementation far smaller.
More detail
A bandit has provable logarithmic regret and no credit-assignment problem. Check the assumption honestly: if today's recommendation changes tomorrow's user, the reduction is invalid and the bandit's guarantee does not transfer.
Choose a step size for an action-value estimate
1/n when the target is fixed, a small constant when it moves.
More detail
The sample average is the efficient estimator for a stationary arm and converges; a constant step size never converges but tracks. Picking a constant for a stationary problem buys a permanent variance floor for nothing.
Pick an exploration strategy
Prefer UCB or Thompson sampling over ε-greedy whenever regret matters — undirected exploration costs a constant fraction of every round for ever.
More detail
ε-greedy is worth keeping only for its simplicity, or where a fixed exploration rate is itself desirable. Optimism and posterior sampling both concentrate exploration on arms that could still be best, which is what turns linear regret into logarithmic.
Feedback arrives in batches or after a delay
Prefer Thompson sampling: a posterior computed from stale data is still a valid posterior, while a deterministic index rule repeats the same choice until it updates.
More detail
Under delay an index rule commits the whole batch to one arm, because nothing in its input has changed. Posterior sampling keeps drawing different worlds, so the batch spreads itself across arms without any special handling.
Prior knowledge about the arms is available
Thompson sampling takes it directly as a prior; UCB has no comparable slot.
More detail
An informative prior is worth real regret when the horizon is short. The flip side is that a badly wrong prior is also taken seriously, so state what the prior encodes rather than reaching for a conjugate default.
The best action depends on who is asking
Move to a contextual bandit and model the reward as a function of the features — but only while the action does not change the next context.
More detail
A per-context independent bandit wastes every observation on one context. A linear model shares evidence across contexts, at the price of an assumption that must be checked: if the reward is not linear in the features, the confidence ellipsoid is not a confidence set.
The requirement is a bound, not a goal
Model it as a CMDP constraint — expected cost under a bound — and let a dual ascent find the price; do not fold it into the reward at a guessed penalty.
More detail
A fixed penalty is a price nobody knows: too cheap and the agent pays it whenever profitable, too dear and it refuses earned reward, and at the exact price the objective is flat across compliant and violating policies. Only feedback on the violation resolves the knife-edge. If the bound must hold per episode — never once — it is not a CMDP at all but a shield outside the objective.
Training happens in a simulator that is wrong
Randomise the dynamics parameters over a chosen distribution and train a policy with memory — the recurrent state performs the system identification a wrong simulator cannot.
More detail
Choose the ranges to cover reality but stay inside the action envelope; widen them with a boundary-proven curriculum (ADR) rather than hand-setting. The alternative is system identification when few parameters are wrong and some real data exists — identify to tighten the ranges, then randomise what remains.
Reporting whether one method beats another
Report the IQM, stratified bootstrap intervals, performance profiles and probability of improvement — never the mean of five seeds alone.
More detail
RL returns are bimodal, so a small-sample mean averages a lottery and its confidence interval is wider than the gap it reports. The rliable toolkit answers the question a deployment asks — what one run delivers — and printing the interval is the minimum viable fix.
Deciding whether RL applies at all
Ask in order: evaluative feedback, action changes the state, environment sampleable, reward checkable, sample budget — the smallest machinery that survives all five is the answer.
More detail
The two commonest rejections: stateless feedback (a bandit, not an MDP) and supervision masquerading as RL. A hard physical bound is also a rejection — an invariant to enforce, not an objective to optimise.
Credit must travel a hundred steps
Reach for temporal abstraction — options or a learned hierarchy — before tuning the flat learner harder.
More detail
A goal separated from the start by twenty-two primitive backups is nearly invisible at gamma=0.9; the same reward through four option-level backups is reachable. If the macro-actions are hand-designable, use the SMDP equations directly; if they must be learned, add a deliberation cost or a feudal timescale so the hierarchy does not collapse to primitives.
Learning the options themselves
Option-critic gives clean gradients for the internal policy and the termination — but add a deliberation cost, or the learned options degenerate to one-step primitives.
More detail
The collapse is the optimum of the stated objective: nothing pays for duration. A per-termination penalty shifts the stopping threshold so options persist; a feudal architecture prevents the manager from re-deciding at all. Choose the cost when flexibility matters and a hyperparameter is acceptable; the feudal wall when the abstraction must be structural.
There is another learner in the environment
Model it as a Markov game, not an MDP with extra inputs — the other player's updates change the dynamics you learn against.
More detail
Zero-sum gives a clean minimax value and minimax-Q to reach it; general-sum gives equilibria with possibly different values and no canonical 'the value'. If independent Q-learners are cycling, the fix is rarely more samples — it is a formalism that names the moving target.
A team shares one reward
Use CTDE: centralised critic on the joint state for a stationary regression target, decentralised actors for deployment; factorise monotonically (QMIX) or add a counterfactual baseline (COMA) for credit.
More detail
The asymmetry is the method — the critic is thrown away at execution so its privileged view never leaks into the policy. It fails only when no training-time joint state exists to exploit, e.g. logged partial observations.
The reward is sparse — a hundred steps of silence before a signal
Start from potential-based shaping only if a state potential is actually known; otherwise prefer a bonus — count-based, prediction-error, or an explicit archive.
More detail
Shaping is safe only in the form gamma*Phi(s')-Phi(s); anything else can carry a cycle the agent exploits. If no Phi exists, pseudo-counts generalise UCB's optimism, prediction-error bonuses pay for learnable ignorance (filter it with ICM or RND to survive the noisy TV), and Go-Explore's archive keeps the frontier when the agent must return to a distant one.
The environment is mostly noise
A naive prediction-error bonus pays the aleatoric floor forever; use ICM or RND to make the bonus epistemic.
More detail
ICM learns features that keep only what the agent's actions influence — the noise predicts no action and is dropped. RND predicts a fixed random target — deterministic, so there is no noise floor. Pick ICM when the controllable structure matters; RND when you want the simplest novelty signal that cannot be gamed by a TV.
Sparse goal-reaching with a resettable simulator
Use hindsight relabelling: rewrite each stored transition with the goal the trajectory actually achieved, and sparse zero-reward episodes become dense positives.
More detail
Valid because dynamics do not depend on the goal; biased on stochastic tasks where conditioning on the achieved outcome keeps the lucky draws. If the goal is not expressible in the state, or the goal changes the physics, the trick does not apply.
Real transitions are precious; compute is cheap
Use Dyna-style planning: store each transition in a model and spend n simulated backups per real step.
More detail
Episodes-to-solve on a maze drop an order of magnitude at n=50. The model is tabular and only knows visited transitions — add Dyna-Q+'s staleness bonus when the world might change, and prioritised sweeping when most of the model is already stable.
I can simulate the dynamics but only need one action now
Use Monte Carlo tree search: build the tree from the current state, UCT-select, expand, rollout, backup — discard after the move.
More detail
The budget concentrates on the reachable frontier. The rollout policy caps accuracy; replacing it with a learned prior is the AlphaZero step.
On-policy or off-policy control on a risky task
SARSA learns the exploring policy's value — the safe path; Q-learning learns the greedy optimum — the risky edge.
More detail
On the cliff walk, SARSA's higher per-episode return under epsilon-greedy is the honest comparison: it prices its own exploration. Q-learning's learned values are optimal for the deterministic policy it will never exactly follow.
A learned reward is being gamed
If correctness can be computed, replace the reward model with a program: a binary checker has no learned boundary to exploit.
More detail
RLVR works where a checker exists — maths, code, formal domains. Its own failure modes are enumerable (equivalence, coverage), not a continuous exploit surface. Where no checker exists, bound the learned reward with KL and audit with held-out graders.
The run's entropy is collapsing and batches are going unanimous
Raise only the upper clip (clip-higher), filter unanimous groups (dynamic sampling), and penalise overlong generations.
More detail
The symmetric clip gains epsilon of a large probability but only epsilon of a near-zero one — a positive feedback that sharpens the policy until groups agree and the gradient vanishes. Watch the group-advantage zero-rate, not just reward.
Choosing between SFT, rejection sampling, DPO, PPO and GRPO
Ask two questions first: is the reward verifiable, and can you sample during training? The method is a lookup once answered.
More detail
Verifiable+sample: GRPO (filtered SFT as cold start). Non-verifiable+sample: PPO-RLHF. No sampling: DPO on preferences. Demonstrations only: SFT. Distance-to-target and reward quality refine within the branch.
Episodes are long, non-terminating, or you need mid-episode learning
Use TD(0): it bootstraps one step ahead, learns online and survives non-terminating behaviour where Monte Carlo waits forever.
More detail
The price is a biased target and a Markov assumption. Choose Monte Carlo only when the task is Markov-violating or returns are cheap and unbiased estimates matter more than speed.