Topic: rl

Reinforcement learning from the ground up: the problem, the one quantity every method estimates, and how tables, neural networks and language models each learn to act; a map of the eight pages under it. Sources are linked inline; data as of 4 October 2026, map rebuilt 24 October 2026, figures and split layout 6 November 2026. Reading: 20 min, plus 2 in closed details.

Reinforcement learning in one screen

Every RL method estimates the same thing, the expected return that the Bellman equation describes, and improves its behaviour against that estimate; the methods differ in what they put in place of the expectation (an exact model, a sampled return, one step plus a guess, a learned critic, a search, a group of answers) and in what they store. Reinforcement learning is learning to act from a score rather than from a correct answer, which makes it the tool for problems whose behaviour can be judged but not demonstrated: games, control and, since InstructGPT in 2022, the post-training of language models.

The map: three layers, four sources of the target

Read across a layer for what replaces the expectation; read up a column for what changed when tables became networks and networks became language models. The figure builds the map one layer at a time over the one-state floor; each name below jumps to its section, and the dashed outlines are empty corners, with where each is covered.

  1. Four sources of the target. Across the floor, the four places a method gets the number it learns toward: a known model it computes or searches with; interaction, learning values; interaction, learning the policy directly; and a fixed dataset, with no interaction at all.
  2. One state, no delay. Bandits and exploration: each arm's sample average; exploration is the whole problem. It spans both interaction columns: action values, or a preference per action.
  3. Tables: the classical core. Dynamic programming: the exact expectation, swept over every state. Model-free prediction and control: a sampled return (MC) or one reward plus a guess (TD). Two dashed corners: with one state, learning the policy is the gradient bandit (Bandits and exploration), with many it is the next layer; evaluating another policy's data by importance sampling is Model-free, section 6.
  4. Networks: deep RL. Each table becomes a network and every column gains a page (the streams rise from the table each grew out of): Model-based RL and planning, a tree search or imagined rollouts; Value-based deep RL, the Q-learning target from a frozen network; Policy gradients and actor-critic, the return or a critic's advantage weights log π; Offline RL and imitation, the dataset's own actions, staying close to them.
  5. Language models: tokens as actions. RL for LLMs: a critic (PPO) or a group's mean reward (GRPO); the reward from a model or a verifier. Its dashed corners: the transition is known (append the token), and search over answers at test time is Model-based, section 14; SFT is behaviour cloning and DPO trains on fixed preference pairs (Offline RL and imitation, section 5).
  6. The whole map. Eight pages, three layers over the one-state floor. Up every column the target stays the one the layer below used; what grew is what stores it, from a table to a network to a language model.

You need: nothing for the classical rows; the deep rows assume the supervised training step of Topic: ml-fundamentals. The other tabs span every page: every classification axis in the Taxonomy, every method on one grid with its year and paper in the Method atlas, the results that made the field, from TD-Gammon to DeepSeek-R1, in Milestones and benchmarks. Numbers are published, with the source linked, unless marked derived or illustrative.

1The problem, and the words every page uses

Three things set RL apart from supervised learning (Sutton and Barto, §1.1; Silver, Lecture 1). The feedback is a score, not a label: it says how good an action was, not which action was right. The feedback can be delayed: a chess move is rewarded only when the game ends, so the agent must work out which earlier action earned a later reward (the credit assignment problem). And the agent's own actions decide what data it sees next, so it must trade exploiting what it knows works against exploring to find something better. The agent maximises cumulative reward, so it can pay now to gain later. All of this rests on the reward hypothesis, that every goal can be written as maximising expected cumulative scalar reward; for language models "helpful" has no formula, so training maximises a proxy (a learned reward model, a test suite, a judge), and a policy that optimises a proxy hard enough finds shortcuts such as longer answers, flattery or special-cased tests: reward hacking, the subject of Reward Hacking.

At each step t the agent sees an observation and a reward, chooses an action At, and the environment answers with the next observation and the reward Rt+1 (the reward for At arrives at t + 1, in Silver's and Sutton and Barto's indexing). It maximises the return, the discounted sum of future rewards:

Gt = Rt+1 + γRt+2 + γ²Rt+3 + ... = Rt+1 + γGt+1
γ ∈ [0, 1]
the discount: a reward k steps away counts γk as much (steps 4 to 6 of the figure).
  1. The agent sees a state. The environment hands the agent its observation St (teal).
  2. It acts. The agent picks an action At (orange) from its policy, and the environment moves.
  3. The world answers, one step later. The next observation St+1 and the reward Rt+1 for At (green) come back together; the loop repeats until the episode ends.
  4. Rewards further away count less. Unrolled in time, the return adds every later reward, the one k steps away weighted γk: the bars are those weights at γ = 0.9, and each stream carries a reward back to step t. The weights sum to 1/(1 − γ), so γ = 0.9 looks about 10 steps ahead derived.
  5. γ = 0.99 looks about 100 steps ahead. The weights barely fall: the last of the 30 steps drawn still counts 0.9929 ≈ 0.75 derived, so the agent plans far, and every distant reward's noise enters its estimate.
  6. γ = 1 for language models. Language-model RL uses γ = 1, because every response ends and the reward comes at the end: every weight is 1, and the single reward at the last token flows back whole.
State, Markov, partially observable
what the agent summarises its history into; Markov if the future depends only on it. A single Atari frame is not (it shows where the ball is, not where it is going); a poker hand is partially observable; a language model sees its whole prefix, so generation is fully observable.
Markov decision process (MDP)
states, actions, transition probabilities, rewards and γ: the formal object every page solves.
Policy π(a | s)
how the agent acts.
State value Vπ(s), action value Qπ(s, a)
the expected return from a state, or after taking a there. Picking the best action from Q is a lookup, while from V it needs a model of where each action leads, which is why model-free control learns Q. Reward is not value: in Silver's student example a lecture costs −2 now yet the state is worth +1.5, because it leads toward passing (Silver, Lecture 2).
Learning and planning
in learning the environment is unknown and the agent improves by interacting; in planning a model is known and the agent improves by computing with it, for example by searching a game whose rules are known.
Bootstrapping
building a target from the agent's own current estimate of the next state, instead of waiting for the real return.
On-policy, off-policy, offline
learning from the current policy's own experience; from anyone's, including old data; from a fixed dataset with no interaction at all. Off-policy is not offline: Q-learning is off-policy yet learns online.
Go deeper: Dynamic programming owns the MDP, the return and the Bellman equations with worked numbers (sections 1 to 3).

2One target, many estimators

Take expectations of Gt = Rt+1 + γGt+1 and you get the Bellman equation: the value of a state is the immediate reward plus the discounted value of where you land, on average.

Vπ(s) = 𝔼π[ Rt+1 + γVπ(St+1) | St = s ]
𝔼π
an average over the actions π chooses and the next states the environment produces. Replace the average by a max over actions and you get the optimality equation, whose solution is the best policy's value.

No agent can compute that expectation unless it knows the environment. So every method substitutes something for it and nudges its estimate toward that substitute, the target: V(St) ← V(St) + α (target − V(St)). Policy-gradient methods use the same substitutes as the weight on "make that action more likely". Rows jump to the family's section:

MethodWhat stands in for the expectationBias and variance
Dynamic programmingThe exact expectation over a known modelExact; needs the model
Monte CarloThe whole sampled return to the end of the episodeUnbiased; high variance
TD(0), SARSA, Q-learningOne real reward plus the current estimate of the next state (SARSA: the action actually taken next; Q-learning: the best next action)Biased by the estimate; low variance
n-step, TD(λ), GAEA blend: n real rewards, then the estimateA dial between the two above
DQNThe Q-learning target, computed by a frozen copy of the networkAs Q-learning, plus approximation error
REINFORCEThe sampled return, optionally minus a baselineUnbiased; high variance
Actor-critic, PPOAn advantage from a learned critic: the TD error, or GAE's blend of themLower variance; biased by the critic
AlphaZero, MuZeroA tree search: its improved move distribution and the game's outcomeBetter than the raw networks, at a large compute cost per move
GRPOThe response's reward minus the mean of a group of responses to the same prompt, divided by their standard deviationMonte Carlo with a sampled baseline; no critic
RLVRAny of the above, with the reward from a program that checks the answerNo reward-model error; checkable tasks only

Why there is a dial. A target built from real rewards is unbiased but carries every step's randomness; a target that stops after one step and trusts the estimate carries little randomness but inherits whatever error the estimate has. Short targets win when the estimate is good, long ones when it is poor. This one trade-off runs through five of the eight pages, so it is drawn here once, on one episode. Predict, before the figure reaches step 4: with the estimates as given, will Monte Carlo's target for S0 be above or below TD's? Then move the V(S1) slider below the steps to see which targets follow it.

  1. The episode. S0 → S1 → S2 → end, γ = 0.9, rewards 0, 0, 1 (green) and the agent's current estimates 0.2, 0.4, 0.7 (blue). Every method builds a different target for S0 from it, on the row in front; the streams show what each target is made of.
  2. TD(0): one real reward, then trust the estimate. R1 + γV(S1) = 0.36. Low variance, available after one step; wrong if V(S1) is wrong: move that slider and only this target and the blends move.
  3. Two-step return. R1 + γR2 + γ²V(S2) = 0.567: two real rewards, then the estimate, one notch along the dial.
  4. Monte Carlo: all real rewards. G0 = R1 + γR2 + γ²R3 = 0.81. No estimate at all: unbiased, but every step's randomness is in it, and it waits for the end.
  5. λ-return: a blend. At λ = 0.5 the TD, two-step and Monte Carlo targets weigh 0.5, 0.25 and 0.25 (the stream sizes): 0.52425. λ slides between TD (λ = 0) and Monte Carlo (λ = 1); GAE in PPO is the same dial.
  6. Dynamic programming: the exact expectation. With a known model (the glass plate: S0 reaches S1 with probability 0.8, otherwise the episode ends) the target is the expectation itself, with no sample: 0.8 × (0 + 0.9 × 0.4) = 0.288.
  7. Policy gradients: the same targets as weights. They do not move V(S0); they make the first action more likely in proportion to a weight built from the same targets: the return minus a baseline (REINFORCE, G0 − V(S0) = +0.61) or the critic's TD error (actor-critic, δ0 = +0.16).
  8. GRPO: the group is the baseline. A separate case: four answers to one prompt score 1, 0, 0, 0 (mean 0.25, standard deviation 0.433). No estimate of any state is used; each answer's advantage (r − mean) / std is +1.732 or −0.577, and applies to all its tokens.

The old page's worked example illustrative: S0 → S1 → S2 → end, γ = 0.9, rewards 0, 0, 1, current estimates 0.2, 0.4, 0.7. The targets for S0 run from 0.36 (TD) to 0.81 (Monte Carlo) depending only on how many real rewards each uses before trusting an estimate; the λ-return at λ = 0.5 is 0.52425; a known model (reaching S1 with probability 0.8) gives 0.288; REINFORCE with a baseline weights the first action by 0.61, an actor-critic by the TD error 0.16; and four GRPO responses scoring 1, 0, 0, 0 get advantages +1.732 and −0.577. Computed in your browser and checked against src/read/recompute.py. Each mechanism is worked on its page: Monte Carlo against TD and the λ dial on Model-free (sections 1 and 2), GAE on Policy gradients (section 6), GRPO's group on RL for LLMs (section 3).

3The eight pages on the three axes that matter most

Three questions place any method: what it stores (values, a policy, or both: value-based, policy-based, actor-critic), whether it uses a model of the environment (given, learned, or none), and whose experience it learns from (on-policy, off-policy, offline). The pages split the field along exactly these lines, so one table compares them. The Taxonomy defines every further axis with its blurred edges; the Method atlas places all forty-seven methods.

PageWhat stands in for the expectationStoresModelExperience
Bandits and explorationEach action's average reward; one state, so no return to estimateAction values, or a preference per actionNone neededIts own, chosen to explore
Dynamic programmingThe exact expectationValues, and a greedy policyGivenNone: it computes
Model-free prediction and controlA sampled return, or one reward plus the current estimateA table of V or QNoneOn-policy (SARSA) or off-policy (Q-learning)
Value-based deep RLThe Q-learning target from a frozen networkA Q networkNoneOff-policy, from a replay buffer
Policy gradients and actor-criticThe return, or a critic's advantage, as the weight on log πA policy, and a criticNoneOn-policy (PPO) or off-policy (DDPG, TD3, SAC)
Model-based RL and planningA tree search or imagined rolloutsA model, a policy and a valueGiven (AlphaZero) or learned (MuZero, Dreamer)Real plus imagined
Offline RL and imitationThe dataset's own actions and returns, kept close toA policy, or conservative valuesUsually noneA fixed dataset
RL for LLMsA critic (PPO) or a group's mean reward (GRPO), with the reward from a model or a verifierA policy (plus a critic in PPO)The transition is known; the reward model is learnedOn-policy rollouts, mildly off-policy in practice

4Each family: the definition, and what only shows across pages

One short paragraph each; the mechanisms, derivations and worked examples are on the page named in "Go deeper", by section.

Exploration: bandits

Strip away states and delay and one problem is left: a row of slot machines with unknown payouts, the multi-armed bandit, where the only question is when to try an action whose value is uncertain at the cost of reward now. Greedy locks onto the first decent arm; ε-greedy explores at random, UCB where it is uncertain, Thompson sampling in proportion to the chance an arm is best; regret, the reward lost against always pulling the best arm, compares them. Across the pages the same question returns at every layer: ε-greedy in DQN, entropy bonuses in policy gradients and SAC, several answers per prompt at a temperature around 1 in language-model RL.

Go deeper: Bandits and exploration: the strategies (section 3), regret and its floor (section 4), contextual bandits and A/B tests (section 5), exploration in full RL (section 6) and in LLM training (section 7).

Planning with a known model: dynamic programming

If every transition probability and reward is known, the expectation can be computed. Dynamic programming turns the Bellman equation into an update and sweeps it over every state: policy iteration alternates evaluating the policy with making it greedy on those values; value iteration applies the optimality equation directly. Each sweep shrinks the error by at least γ, so it always converges, but each sweep touches every state, and ten variables with ten values each are already ten billion states. So DP is the ideal every other page approximates, and its rhythm, evaluate a little and improve a little (generalised policy iteration), is the shape of almost every RL algorithm up to PPO for language models.

Go deeper: Dynamic programming: planning with a known model: policy iteration and value iteration (sections 6 and 7), why it converges (section 9), the curse of dimensionality (section 11), asynchronous DP (section 12).

Learning from samples: Monte Carlo, TD, SARSA, Q-learning

Without a model the agent replaces the expectation with experience: Monte Carlo waits for the actual return (honest, noisy), temporal-difference learning (Sutton 1988) updates after every step toward one real reward plus its own guess (less noisy, only as good as its guesses). For control it learns Q: SARSA bootstraps from the action it actually takes next and so learns the value of its own exploring behaviour (on-policy); Q-learning (Watkins and Dayan 1992) bootstraps from the best next action and so learns the greedy policy while exploring (off-policy), which is what later lets DQN learn from replayed old experience. Learning from another policy's data in general needs importance sampling, reweighting each sample by how much likelier the target policy was to take that action; PPO's and GRPO's ratios are this correction.

Go deeper: Model-free prediction and control: Monte Carlo against TD (section 1), the n-step and TD(λ) dial (section 2), SARSA against Q-learning on cliff walking (section 4), maximisation bias (section 5), importance sampling (section 6), function approximation and the deadly triad (section 7).

Deep value methods: DQN and its fixes

Tables need an entry per state; an Atari screen has astronomically many. Replace the table with a network and the agent generalises across states, but function approximation, bootstrapping and off-policy learning together, Sutton and Barto's deadly triad (§11.3), can make values diverge. DQN is Q-learning with a convolutional network and two stabilisers, an experience replay buffer and a frozen target network (Mnih et al. 2015); each later fix targets one known flaw (Double DQN the max's overestimation), and Rainbow combined six (Hessel et al.).

Go deeper: Value-based deep RL: from DQN to Rainbow: how often the triad bites on Atari (section 2), DQN (section 3), Double DQN (section 4), Rainbow's ablation (section 10), reading Atari numbers (section 12). The triad itself, with Baird's counterexample, is on Model-free, section 7.

Policy gradients and actor-critic, up to PPO

Instead of learning values and acting greedily, learn the policy itself: make the actions that turned out well more likely, in proportion to how well they turned out, the policy gradient theorem (Sutton et al. 1999). The methods differ in that weight: REINFORCE (Williams 1992) uses the whole return, a baseline turns it into an advantage ("better or worse than expected"), an actor-critic learns that baseline and bootstraps from it, GAE blends the two with λ (the same dial as section 2). And in how far one batch may move the policy: TRPO with a KL constraint, PPO by clipping the probability ratio (Schulman et al. 2017). For continuous control with expensive samples, off-policy actor-critics with replay (DDPG, TD3, SAC with its entropy bonus) win on data.

Go deeper: Policy gradients and actor-critic: the theorem (section 2), REINFORCE and baselines (sections 3 and 4), actor-critic and GAE (sections 5 and 6), TRPO and PPO (sections 8 to 10), DDPG, TD3 and SAC (sections 11 to 13), which method when (section 15).

Model-based RL and search

A model lets the agent rehearse: every imagined step is free experience. When the model is exact, as in a board game, Monte Carlo tree search guided by a policy and a value network returns a better move distribution than the network alone, so the search acts as the improvement step and the network learns to imitate it (AlphaZero); MuZero learns a model of only what planning needs (reward, policy and value, never the screen); Dreamer learns a world model and trains its actor in imagination. The cost that only shows across pages: a learned model's errors compound over a plan, and a planner happily exploits them, the same failure as offline RL's (an optimiser trusting values where it has no data).

Go deeper: Model-based RL and planning: Dyna (section 2), MCTS (section 5), AlphaGo to MuZero (sections 6 to 8), learned and video world models (sections 10 and 11), why model error compounds (section 13), samples against compute (section 14).

Offline RL and imitation

Sometimes the agent may not explore: a hospital cannot try random treatments. A learner on a fixed dataset fails where it leaves the data. Behaviour cloning copies expert actions by supervised learning (supervised fine-tuning of a language model is exactly this) and drifts into states the expert never visited, where it errs more; DAgger asks the expert to label the states the learner actually reaches. Offline RL tries to beat the policy that collected the data, and its max picks actions the data never tried, whose values are pure guesswork, so its methods stay close to the data (Levine et al. 2020).

Go deeper: Offline RL and imitation: behaviour cloning and DAgger (sections 2 and 3), inverse RL and GAIL (section 4), preferences (section 5), extrapolation error (section 6), BCQ, CQL and IQL (sections 7 to 9), Decision Transformer (section 10), evaluation (section 12).

RL for language models

Generating text is an MDP with odd proportions: the state is the prompt plus the tokens so far, the action is the next token from a vocabulary of about 105, the transition is trivial (append the token), and there is usually one reward at the end; the hard parts are credit assignment across thousands of tokens and the reward itself. Read as a lineage, the methods are two deletions. RLHF learns a reward model from people's comparisons and optimises it with PPO, a critic and a KL penalty to the starting model (Ouyang et al. 2022); GRPO deletes the critic, using the mean of a group of answers to the same prompt as the baseline (DeepSeekMath), the Monte Carlo end of section 2's dial (a group in which every answer scores the same teaches nothing); RLVR deletes the learned reward model where a program can check the answer (the name is Tülu 3's, Lambert et al. 2024), the recipe of DeepSeek-R1 (Guo et al. 2025). Any reward the policy optimises is a proxy it can exploit, learned or programmatic. DPO skips both the reward model and the RL loop by training directly on preference pairs, offline (DPO page).

Go deeper: RL for LLMs: RLHF, GRPO, RLVR: the token MDP (section 1), PPO for RLHF (section 2), GRPO and RLOO (section 3), RLVR (section 5), R1 (section 6), the fixes to GRPO (section 7), pass@1 against pass@k (section 9). Around it: Alignment (the pipeline), Reward Hacking (what goes wrong), and the paper pages InstructGPT, DeepSeekMath and DeepSeek-R1.

5Which family when

Answer the questions, or open the table.

All the cases in one table
SituationUseBuys and costs
Known, small modelDynamic programmingExact answers; a sweep over every state per iteration
Known but huge model (a board game)Search with learned networks, as AlphaZeroPlans with the real rules; large compute per move
No model, but planning paysLearn one, as MuZero or DreamerLarge compute; model errors compound
No model, small discrete problemQ-learning, or SARSAQ-learning when mistakes while learning are cheap; SARSA when they are not
Large states, discrete actions, data preciousThe DQN familyOff-policy replay reuses old data
Any action space, stability firstPPORobust; each batch used for a few epochs then discarded
Continuous control, expensive samplesSAC or TD3Off-policy with replay
A fixed dataset, no interactionBehaviour cloning or offline RLNo exploration risk; limited by what the data covers
Language modelsPPO with a critic if affordable; GRPO if not; a verifier (RLVR) wherever answers can be checked; DPO for cheap offline preference tuningA verifier removes the reward model the policy would otherwise exploit
Across all of themThe bias-variance dialLong, real-reward targets when estimates are poor; short, bootstrapped ones when they are good
Ten confusions that cross the pages
  • "Reward and value are the same." Reward is one step's signal; value is the expected sum of what follows.
  • "The observation is the state." One frame, or the last chat message, can leave out what the future depends on.
  • "γ = 1 is always wrong." It is standard when every episode ends, as in language-model RL.
  • "Model-based means a learned model." Dynamic programming and AlphaZero use a given one.
  • "The reward model makes RLHF model-based." Nothing plans with it; it stands in for the reward.
  • "On-policy means online, off-policy means offline." Q-learning is off-policy while interacting; PPO reuses each batch for several epochs and is still approximately on-policy.
  • "Any learned baseline makes an actor-critic." REINFORCE with a baseline, RLOO and GRPO never bootstrap from it, so they are policy-based (Sutton and Barto §13.5).
  • "Deep RL is a different theory." Its targets are the classical ones; what is new is function approximation and the tricks that keep it stable.
  • "Token generation is a hard environment." The transition is trivial; credit assignment and a trustworthy reward are the hard parts.
  • "A higher reward means a better model." With a proxy reward, the policy can climb it while true quality falls (reward hacking).

6The eight pages under this one

In reading order: each reuses the vocabulary of the ones before it. Reading times as each page's header states them.

The trade-off, action values, greedy to Thompson sampling, regret and its floor, contextual bandits and A/B tests, exploration in full RL and in LLM training; a 10-armed testbed. (28 min, plus 9 in closed details)

The MDP, the return and the Bellman equations, policy evaluation, policy and value iteration, why they converge, the curse of dimensionality, asynchronous DP; a sweep lab. (40 min, plus 11 in closed details)

MC against TD, n-step and TD(λ), SARSA, Expected SARSA and Q-learning, maximisation bias and Double Q, importance sampling, the deadly triad. (34 min, plus 9 in closed details)

DQN's replay and target network, Double DQN, dueling, prioritised replay, multi-step, distributional RL, NoisyNet, Rainbow's ablation, Ape-X to Agent57, Atari protocols. (34 min, plus 16 in closed details)

The theorem derived, REINFORCE and baselines, actor-critic and GAE, A2C and A3C, natural gradient and TRPO, PPO and its implementation, DDPG, TD3 and SAC. (45 min, plus 9 in closed details)

Dyna, wrong models, MCTS, AlphaGo to MuZero and EfficientZero, Dreamer, world models from video, MPC, PETS and MBPO, compounding error, when it pays. (41 min, plus 9 in closed details)

Behaviour cloning and DAgger, inverse RL and GAIL, preferences, extrapolation error, BCQ, TD3+BC, CQL, IQL, Decision Transformer, offline to online, D4RL results. (33 min, plus 9 in closed details)

The token MDP, PPO for RLHF, GRPO and RLOO on a real response, RLVR and verifiers, R1, Dr. GRPO, DAPO, CISPO and GSPO, the engine/trainer mismatch, pass@k, agents and infrastructure. (50 min, plus 11 in closed details)

Sources: Sutton and Barto, Reinforcement Learning: An Introduction (2nd ed.); David Silver's UCL lectures; the primary papers linked in each paragraph; the knowledge base's verified paper pages. This page folds in the former "RL foundations" page. Rebuilt on 24 October 2026 as a map once its eight children were rebuilt. Further reading, with times, is in the last tab.