Real robot time is the scarce resource. QT-Opt learned to grasp from 580,000 real tries; Dactyl trained on about 100 years of simulated experience.
See the whole course as one toolbox, then walk the seven problems nobody has solved, then learn how to pick and test a research project.
Set how many trials a method needs and how long each one takes. Add robots, or move the trials into a simulator. Then try the three presets and see which fits inside a day, a month or a year. Then we build the map, piece by piece: the toolbox, data reuse, the four data settings and the seven open problems.
You need a little Python and what a probability is. The other CS 224R lessons help, but we define each tool again here.
Re-taught from Lecture 18, Frontiers of Deep RL and How to Do Research (Chelsea Finn), of Stanford CS 224R: Deep Reinforcement Learning. The explanations and toys are our own; toy numbers are illustrative, and published numbers name their source.
Sources: QT-Opt used over 580,000 real grasp attempts on 7 robots, 800 robot hours over 4 months (Kalashnikov et al. 2018, Google's blog post). SERL reports 25 to 50 minutes of real training per policy (Luo et al. 2024). Dactyl collected about 100 years of simulated experience in 50 hours (OpenAI 2018), about 17,500 times real time. Preset trial counts and lengths for SERL and Dactyl are illustrative, chosen to match those totals.
Chapter 0
Read every algorithm as a few choices from the same small set of parts
This course named many algorithms: REINFORCE, PPO, SAC, DQN, IQL, behavior cloning, DAgger. They look like a zoo. They are not. Each one is a set of choices from the same few parts.
Building an algorithm means filling five slots. A slot is one design decision with a few standard options. Change one slot and you often get a different named method. Learn the slots, and a new paper's method becomes a recipe you can read.
| Slot | Options | What it decides |
|---|---|---|
| 1. Data | expert demos, a logged dataset, a replay buffer, fresh rollouts | Where the learning signal comes from |
| 2. Policy update | supervised, policy gradient, actor-critic, Q-learning | How the policy changes |
| 3. Reward | given, learned from examples or preferences, a goal | What "good" means |
| 4. Value learning | none, Monte Carlo, TD, n-step | How the method estimates long-run value |
| 5. Model class | Gaussian, categorical, diffusion or flow, autoregressive | The network family of the policy |
Add-on tools snap onto the slots when the problem needs them:
Pick one option in each slot. The card that matches lights up. Each other card shows how many slots you would change to reach it.
Simplified recipes. Reward and model class are left out because these six methods do not differ in them. PPO counts as a match with a Monte Carlo or a TD value.
Four slots with 4, 4, 3 and 4 options give 4 × 4 × 3 × 4 = 192 recipes. This lesson names six of them. PPO is "policy gradient, a value baseline and a clip". SAC is "actor-critic, a replay buffer and entropy".
The failure. Treat a name as a black box, and you cannot say why SAC fails on a fixed dataset. Measure it by writing out the slots: SAC's data slot expects fresh data in its buffer, and you have none. The fix is to change that slot, as IQL does.
Chapter 1
Line up four online families by how many times they reuse each trial
An online method collects its own data while it learns. Four families cover the online methods of this course. The lecture reads each one off four questions.
| Question | Vanilla PG | PPO-like | Off-policy AC | Q-learning (SAC) |
|---|---|---|---|---|
| What data? | On-policy | Technically off-policy, called on-policy | Replay buffer | Replay buffer |
| How off-policy? | Not at all | Importance weights | Fit value with TD, sample actions from the policy | Fit the optimal value with TD |
| Value function? | No | On-policy value | On-policy action value | Optimal action value |
| Goodness from | Reward-to-go | Advantage (GAE) | TD or n-step returns | Max over actions of the critic |
Read the table left to right. One thing grows: data reuse, the number of updates one trial feeds. Vanilla PG uses each batch once. PPO reuses it for a few passes. The two right-hand families keep a replay buffer and reuse each trial many times.
Why does reuse matter? Each fresh trial costs time on a real robot. Call the fresh trials a method needs N, the seconds one trial takes with its reset τ (tau), and the robots that run at once R. The wall-clock time until the data is in is T.
T equals N times tau, divided by R.
Multiply the trials N by the seconds per trial tau. That product is the robot time. Divide it by the robots R that share the work, and you get T.
QT-Opt used over 580,000 real grasps on R = 7 robots (Kalashnikov et al. 2018). With tau = 5 s, N × tau = 2,900,000 s, about 806 robot hours, close to the 800 reported. Divided by 7, T = 115 hours: 4.8 days of nonstop running. The real collection took 4 months.
Each column is one family. Warm bars are robot days for one robot. Pick a family, then change the seconds per trial.
Illustrative. The run needs one million sample uses. Each trial feeds 1, 10, 100 or 100 of them. The pink pips mark how much can go wrong, our rough ranking.
The failure. Too much reuse lets errors feed on themselves. The symptom is a critic whose predicted returns climb while real returns stay flat. Measure it by comparing the critic's prediction with the return of fresh test episodes. The fixes are target networks, more fresh data, or a pessimistic value such as the smaller of two critics.
Chapter 2
Find your quadrant from the data you have, and get the tools that fit it
Step up one level and ask what data you may use. Two questions split the field. Do you learn from an expert, imitation, or from a reward, RL? Do you have a fixed dataset, offline, or can you collect more, online?
| Setting | Method | Needs | Trade-off |
|---|---|---|---|
| Offline imitation | Behavior cloning | Expert demos, no reward | Simplest; cannot beat the expert, drifts off the demos |
| Online imitation | DAgger | An expert on call | Fixes drift by asking the expert about visited states |
| Offline RL | AWR, AWAC, IQL | Logged data with rewards | No new data; must not trust actions absent from the log |
| Online RL | SAC, PPO | Rewards and new rollouts | Most powerful, most data-hungry |
Switch on what your project has. The quadrant that fits lights up and names its tool.
A simplified map. Real projects often mix settings, for example online RL with demos seeded in the buffer (Chapter 4).
A worked reading: you have a pile of logged robot data with rewards, no robot, and no expert. That is offline RL. Your tools are AWR, AWAC and IQL. Your main worry is distribution shift: the learned policy wants actions the log never tried, so nothing in the data says what they do. The quadrant also tells you what to pay for: an expert's time, a robot's time, or neither.
Online imitation has its own bill. DAgger asks the expert to label every state the policy visits. With made-up numbers, 20 rounds of 50 episodes of 100 steps is 20 × 50 × 100 = 100,000 labels.
The failure. Run an online method in the offline quadrant, such as SAC on a fixed log. The symptom is Q-values that grow without limit while the policy picks actions the data never shows. Measure how far the policy's actions sit from the nearest dataset action. The fix is an offline method such as IQL, which never asks the critic about unseen actions.
Chapter 3
See how a proxy stands in for a missing reward, and how an agent exploits the gap
Every tool so far needs a reward: a number that says how good an outcome was. A game gives you one for free. Outside games, the reward often does not exist, or it arrives too late to help.
| Domain | The stand-in today | Why it breaks |
|---|---|---|
| LLM chatbots | Learn what people say they prefer | People reward what they want to hear |
| Robotics | Success or failure, or a hand-shaped reward | How do you score a shirt fold from 0 to 1? |
| Video recommendations | A weighted mix of clicks and likes | People tune the weights by hand |
| Science, teaching | None | No one knows how to score a discovery |
Train a chatbot on human preferences, and it learns to win the rater's approval. Raters do not always prefer the true answer. They often prefer the one that agrees with them and sounds sure. So the model drifts toward that, a habit called sycophancy. The reward is a proxy, a measurable stand-in for the goal, and the model exploits the gap.
Each yellow dot is one rater's score. Press New fold a few times, then add raters.
Illustrative. Each made-up rater weighs neatness, sleeve symmetry and flatness differently and adds a little noise. There is no true score to draw.
With made-up scores, five raters give 0.6, 0.8, 0.4, 0.7 and 0.5. The mean is 3.0 / 5 = 0.6. The lowest and highest differ by 0.4, two fifths of the scale. More raters steady the mean; they do not agree more.
The failure. Reward hacking is the agent raising the proxy without reaching the goal. The symptom is a proxy score that climbs while a separate check of the real goal stays flat. Measure both on the same samples. Today's fixes are partial: mix in checks you can verify, hold the policy near its starting model, and refresh the reward model.
The open question: how do you get a reward for domains with no clean score, without a proxy the agent can game? Learned rewards and self-set goals are active work. No one has solved it.
Chapter 4
Pour pretrained models, demos and advice into an agent, and find where each one fits
Learning from scratch wastes what the world already has: pretrained models, demonstrations, written knowledge. The default recipe has two parts. Start the weights from a pretrained model. Seed the replay buffer with offline data.
Crack 1: advice has no slot. A sentence such as "the floor by the window is slippery" fits neither the weights nor the buffer. People learn a lot from being told things. Our agents mostly cannot.
Crack 2: pretrained weights may hold the agent back. Weights that start at the demonstrator's solution may keep the agent near it. RLPD (Ball et al. 2023) takes another route: fresh weights, with offline data mixed into the replay buffer during online learning.
The yellow curve is the return for each setting of one policy knob. Purple ticks mark where the demos are. Pick a start, then press Run.
Our toy of the worry, not a result from RLPD or any paper. Each run climbs the slope with random exploration steps. Whether real pretrained policies get stuck like this is an open question.
In the toy, the near hill pays 0.6 and the far hill pays 0.9. A run that settles on the near hill leaves 0.9 − 0.6 = 0.3 on the table, a third of the best return.
The failure. The symptom is fine-tuning that stalls at the demonstrator's level. Measure the policy's return against the best demo's return. Things to try: fresh weights with data in the buffer, or more exploration. Our reading: no one has settled on a fix.
The ambition behind this frontier is large. Can LLMs go past their pretraining to solve problems people have not solved? Can robots learn tasks faster and better than the people who showed them? Pretraining gives a floor at human level. The goal is a launch pad, not a ceiling.
Chapter 5
Plan inside a learned simulator, and watch small errors compound over the steps
Video generation models learn how objects fall, pour and bend. That makes them a candidate world model: a learned simulator that predicts the next frames from the current frame and an action. You could test a new policy inside it and spend no robot time.
The trap: train the model on demos and one policy's rollouts, then ask it about a new policy. The new policy takes actions the model never saw, actions out of distribution. Each predicted step is a little wrong, and the errors build on each other.
How fast does a rollout go wrong? Call the chance that one predicted step goes wrong ε (epsilon), and the rollout length H steps. The chance that every step stays right is pok.
P-ok equals one minus epsilon, to the power H.
Take the chance one step stays right, one minus epsilon. Multiply it by itself H times, once per step. The result is p-ok.
With made-up numbers: epsilon = 0.02 on actions the model has seen, and H = 50. Then 0.98 to the 50 = 0.36. On new actions, say epsilon = 0.08: 0.92 to the 50 = 0.015. Four times the step error makes a clean rollout about 24 times less likely.
Warm is the real path; blue is the model's prediction. Below, the curve is p-ok for each length. Switch to the new policy's actions, then stretch the rollout.
Illustrative. New actions multiply the step error by 4, a made-up factor. The drawn drift is one seeded random walk whose step size grows with epsilon.
Two escape routes are under study:
The failure. The symptom is a policy that scores well inside the model and fails on the robot. Measure it by replaying logged real actions through the model and plotting its error against the steps ahead. This is the sim2real problem again, with a learned simulator in place of a physics engine.
Chapter 6
Stretch large-scale RL to long horizons with less fresh data
Large-scale RL for LLMs is the most active part of the field. The lecture points to two limits that today's successes share:
The question: can large-scale RL work with longer horizons and less online data? Two sub-problems follow.
Value functions at scale. PPO uses its value function only to cut gradient noise, so a rough one is fine. Actor-critic methods need an accurate one. No one yet knows how to train value functions you can trust at foundation-model scale.
Batch online RL. Updating after every small batch is impractical when data comes from real users or real robots. A more practical loop runs a few big rounds: collect a large batch, update, deploy, repeat.
The run collects 20,000 trials. Each round costs one day of overhead before collection resumes. Drag the rounds from many to few.
Illustrative: 20,000 trials of 30 s on 10 robots, and one day of overhead per round to deploy, check and restart.
With these made-up numbers, collection itself takes 20,000 × 30 s / 10 = 60,000 s, about 17 hours. With 1,000 rounds the overhead is 1,000 days. With 5 rounds it is 5 days, and each policy version collects 4,000 trials. That breadth is why batch rounds want expressive policies that cover many behaviors, as in RL for VLAs.
The failure. A big round can make the policy worse, because the update moves far from the policy that collected the data. Measure the gap, for example the KL divergence between the two policies. The fix is to keep each update near the data, with an offline RL loss, or to add rounds.
Chapter 7
Learn what is unsafe without unsafe data, and size the reliability a system needs
Medicine, driving, counseling and legal advice are safety-critical: one mistake can hurt someone. The obvious way to learn about danger is to collect many unsafe incidents, and that has had terrible real-world costs. Two questions stay open. Can an agent learn what is unsafe from synthetic data or prior knowledge? Can it explore new behavior and stay safe the whole time?
| Who diagnosed | Median score per case |
|---|---|
| The LLM alone | 92% |
| Physicians with the LLM | 76% |
| Physicians with usual resources | 74% |
These are diagnostic reasoning scores from a randomized trial (Goh et al. 2024, JAMA Network Open). The model alone scored highest; adding it to physicians helped little. The lecture's point: the weak link is the interface between people and the model.
A model is calibrated when its confidence matches its accuracy. The GPT-4 technical report (OpenAI 2023, Figure 8) shows post-training hurt calibration on an MMLU subset: the calibration error rose from 0.007 to 0.074. One direction: have the model state its confidence in words, or list several guesses.
With no person in the loop, how reliable is enough? Call the chance that one task fails p, and the tasks in a day n. The chance of at least one failure that day is Pfail.
P-fail equals one minus the quantity one minus p, to the n.
One minus p is the chance one task goes right. Raise it to the n for n good tasks in a row. Subtract that from one, and you have P-fail.
With made-up numbers: p = 0.01 (99% reliable) and n = 100. Then 1 − 0.99 to the 100 = 0.63, so most days have a failure. At p = 0.0001 (99.99%): 1 − 0.9999 to the 100 = 0.0099, about one bad day in a hundred.
Each square is one day. Red means at least one task failed that day. Add nines to the reliability, then raise the load.
Illustrative: one seeded draw for each day, with that day's chance P-fail from the equation above.
The failure. A policy passes 200 test runs and fails in its first week of use. Zero failures in n tasks only shows the failure rate is below about 3/n, at 95% confidence (the rule of three). To back a claim of 99.99%, you need about 30,000 clean tasks: 10.4 days of one robot at 30 s each. Test that long, or keep a person in the loop.
Chapter 8
See why logged data cannot grade a new policy, and what reweighting it costs
In supervised learning you check a model on a held-out set. In RL there is usually no reliable offline check. The logged data came from an old policy. The new policy visits other states, so the log says little about them.
One standard fix reweights each logged episode. Call the new policy's chance of the logged action a-t in state s-t πnew (pi-new), the old policy's chance πold, and the episode length H. Each episode gets an importance weight w.
W equals the product over t from one to H of pi-new of a-t given s-t, divided by pi-old of a-t given s-t.
At each step t, divide pi-new by pi-old for the logged action. Multiply the H ratios to get w. The estimate of the new policy's return is the average of each episode's return times its w.
With made-up numbers and H = 20: if pi-new likes every logged action 1.2 times as much as pi-old, w = 1.2 to the 20 = 38. At 0.8 times as much, w = 0.012. One episode can outweigh more than 3,000 others.
Each purple bar is one logged episode's weight, on a log scale; the line marks a weight of 1. Raise the mismatch between the policies, then lengthen the episodes.
Illustrative. Each step's log ratio is a seeded random draw with spread equal to the mismatch, set so each ratio averages 1. Effective sample size is (sum of w) squared over the sum of w squared.
The effective sample size says how many equal-weight episodes the weighted set is worth. When it falls to 2 of 30, the estimate rests on two episodes.
The failure. The symptom is an estimate that jumps when you add or drop one episode. Measure the effective sample size. Fixes: clip the weights, which adds bias, or combine the weights with a learned value to cut the noise.
The open questions: can offline metrics at least rule out bad policies, even if they cannot score good ones? How do you pick real-world tests that represent a generalist's job? "When is a policy good enough to deploy?" has no satisfying answer today.
Chapter 9
Pick a problem, test its riskiest part first, and share what you learn
The frontiers are open. How do you go after one? The lecture's advice comes from experience, not proof. It starts with three claims:
What to work on. You need an important problem and a plan to attack it. "Solve climate change" has no plan; "a trick that makes the robot 1% better" has no important problem. Then two checks: are you excited about it, and does it survive a brutally honest list of the ways it could fail?
| Style | Starts from | Risk |
|---|---|---|
| Idea-driven | A cool idea, then a problem it solves | No important problem may need it |
| Problem-driven | A problem, then the best solution | Lower: the problem matters by choice |
Front-load the risk. Most ideas fail, so find out fast. Before you build infrastructure, run a small experiment on the core unknown.
Each row is one project. Red is time lost on an idea that failed; green is work on an idea that held. Set the chance an idea works, then press Run.
Illustrative: building takes 2 months and the core test takes 1 week (0.25 months). Build first means you only test after building.
With these made-up numbers and a 20% chance of success, build-first loses 0.8 × 2.25 = 1.8 months per project on average. Test-first loses 0.8 × 0.25 = 0.2 months.
Getting it to work. Start from something that works and make it harder step by step. Simplify. Talk to people. Revisit your assumptions. Ask whether the project "wants" to work, and shrink it to the parts that do.
The failure. The sunk-cost trap: months in, no signs of life, but quitting feels like waste. Measure the time since your last real signal on the core unknown. The fix is to reframe "continue or quit" as "this project, or B, or C", so keep other projects in mind.
Share the work. The output of research is knowledge, so if no one learns it, there was no output. Write clearly, and assume the reader knows less than you. The lecturer's own story: a robot-learning project needed video prediction, the existing models were poor, so she built a better one first. The lecture says that paper gathered about 1,300 citations.
Chapter 10
Keep the map, the numbers, a checklist and the core code on one page
Deep RL is a toolbox: pick the data, the update, the reward, the value and the model class to fit your problem. Reuse saves robot time and costs stability. The seven frontiers mark where the toolbox runs out. One enemy links most of them: distribution shift.
| Term or result | What it is | Number on this page |
|---|---|---|
| Robot time | T = N × tau / R | QT-Opt: 580,000 grasps, 800 robot hours, 7 robots, 4 months |
| Simulated experience | Trials run in a simulator | Dactyl: about 100 years in 50 hours |
| Data reuse | Updates fed by one trial | Toy: 347 robot days at reuse 1, 3.5 at 100 |
| Proxy reward | A measurable stand-in for the goal | Toy raters: spread 0.4 of the scale |
| Compounding error | p-ok = (1 − epsilon) to the H | 0.36 at 0.02 and 50 steps; 0.015 at 0.08 |
| Batch rounds | Collect, update, deploy, repeat | Toy: 1,000 rounds cost 1,000 days of overhead |
| Human-AI team | Goh et al. 2024 trial | 92% LLM alone, 76% with physicians, 74% without |
| Calibration | Confidence matches accuracy | GPT-4 error 0.007 before, 0.074 after post-training |
| Reliability | P-fail = 1 − (1 − p) to the n | 0.63 at 99% and 100 tasks; rule of three: 30,000 clean tasks for 99.99% |
| Importance weight | Product of pi-new over pi-old | 1.2 to the 20 = 38 |
Four small functions carry the numbers of this page.
pythonimport numpy as np def wall_clock_days(n_trials, sec_per_trial, robots=1): return n_trials * sec_per_trial / robots / 86400 # T = N * tau / R, in days def p_rollout_ok(eps, H): return (1 - eps) ** H # every predicted step right def p_fail_any(p, n): return 1 - (1 - p) ** n # at least one of n tasks fails def importance_estimate(logp_new, logp_old, returns): # logp_new, logp_old: [N, H] log-chances of the logged actions; returns: [N] w = np.exp((logp_new - logp_old).sum(axis=1)) # product of ratios, via a sum of logs estimate = (w * returns).mean() ess = w.sum() ** 2 / (w ** 2).sum() # effective sample size return estimate, ess print(wall_clock_days(580_000, 5, 7)) # 4.79 days of nonstop running print(p_rollout_ok(0.02, 50)) # 0.364 print(p_fail_any(0.01, 100)) # 0.634
Now press Present or Teach and walk the map from memory: the five slots, the reuse axis, the four quadrants, and the seven frontiers with one number each. Then go back to the hero, load Dactyl, switch it to real robots, and say why simulators matter.
This lesson re-teaches Lecture 18, Frontiers of Deep RL and How to Do Research, by Chelsea Finn, of Stanford CS 224R: Deep Reinforcement Learning. Published numbers: Kalashnikov et al., QT-Opt (2018); OpenAI, Learning Dexterous In-Hand Manipulation (2018); Luo et al., SERL (2024); Ball et al., RLPD (2023); Goh et al., Large Language Model Influence on Diagnostic Reasoning, JAMA Network Open (2024); OpenAI, GPT-4 Technical Report (2023). The toys and their numbers are our own.