RLS RL, Read as Statistics

Contents

RL, Read as Statistics

Reinforcement learning is estimation under feedback. Every value function is an expectation, every update is an estimator, and every learning curve is a sample. This course reads RL that way.

Why read RL as statistics

A reinforcement learning agent never sees the thing it wants. It wants the expected return of its policy, and it sees one noisy return at a time. It wants the gradient of that expectation, and it sees a single sampled trajectory. It wants to know which of two algorithms is better, and it has five random seeds. Underneath the vocabulary of agents and environments, almost every question in RL is a question a statistician would recognise: what am I estimating, is my estimator biased, how large is its variance, and how sure should I be?

This course takes that view seriously. Each chapter picks one RL idea, names the statistical object hiding inside it, and uses the statistician's tools to explain why the method looks the way it does:

  • Bandits are sequential experiments, and UCB is a confidence interval used as a decision rule.
  • Thompson sampling is Bayesian inference with one extra step: act on a draw from the posterior.
  • Monte Carlo and TD learning are two estimators of the same mean, one unbiased and noisy, one biased and steady.
  • Off-policy evaluation is importance sampling, with everything that makes importance sampling hard.
  • Value-function approximation is regression on targets you make up yourself, and the max over noisy estimates is the winner's curse.
  • Policy gradients are score-function estimators, and a baseline is a control variate.
  • RLHF fits a Bradley–Terry model to preferences and then does regularised inference against a prior.
  • Evaluating RL is a small-sample problem with heavy tails, and the usual "mean of three seeds" is not an answer.

Who it is for

You know probability and statistics at the level of a first mathematical statistics course: expectation, variance, the law of large numbers, the central limit theorem, maximum likelihood, Bayes' rule, confidence intervals. You can read NumPy. You don't need to know any reinforcement learning: the first chapter defines the decision process and every term after it is defined where it first appears. Symbols follow the notation page.

How each chapter works

Every chapter states the RL idea in plain words, names the estimator inside it, works a small example by hand, and then runs an experiment. Each chapter has a companion Python file that needs only NumPy; the numbers quoted in the chapter are what that file prints. Chapters end with exercises and the papers the chapter was written from.

Chapters

Part 1 Estimating from experience

  1. 01Returns are random variables40 minA reinforcement learning problem is a data-generating process; the return is a random variable, value is its mean, and the Bellman equation is the law of total expectation.
  2. 02Bandits as sequential experiments45 minA bandit is a sequential experiment whose allocation adapts to the data; UCB1 turns a Hoeffding confidence bound into a decision rule, and adaptivity biases the sample mean.
  3. 03Thompson sampling as posterior inference40 minThompson sampling is Bayesian updating plus one extra step, acting on a single posterior draw, and this chapter shows why that matches the best arm's posterior probability and how its regret behaves.

Part 2 Learning values

  1. 04Monte Carlo evaluation is a sample mean40 minEstimating a state's value from episodes is a sample-mean problem, and the details that matter are which returns count as the sample, how sure the interval is, and what a constant step size does.
  2. 05TD learning as bootstrapping40 minTemporal-difference learning swaps an unbiased, noisy Monte Carlo return for a biased, steadier target built from the current estimate, and n-step returns tune that trade.
  3. 06Off-policy evaluation as importance sampling40 minEvaluating a new policy from data logged by another is importance sampling, and its variance grows exponentially with the horizon unless you reweight smartly or add a control variate.
  4. 07Values as regression, and the winner's curse40 minFitting a value function is regression on targets you build yourself; TD's fixed point, LSTD as instrumental variables, and why a max over noisy estimates is biased upward.

Part 3 Learning policies

  1. 08Policy gradients are score-function estimators40 minThe policy gradient is the likelihood-ratio estimator of the derivative of an expectation; baselines are control variates, reward-to-go drops zero-mean terms, and GAE is a bias-variance dial.
  2. 09Two kinds of uncertainty, and the whole return distribution45 minEpistemic versus aleatoric uncertainty in RL, posterior sampling and ensembles as exploration, and quantile regression as a way to estimate the entire distribution of the return.
  3. 10Preferences, reward models, and the KL-regularised policy50 minRLHF read as statistics, with a Bradley-Terry reward model fitted by logistic regression, a KL-regularised optimum read as a Bayesian posterior, DPO as maximum likelihood, and over-optimisation as overfitting.

Part 4 Doing it honestly

  1. 11Evaluating RL honestly45 minLearn why a single RL result is a small, skewed sample over runs, and how to report it with intervals, robust aggregates and honest tests.