Dual Controlsa hands-on lab

How robots learn by trial and error on the real thing, with a human in the loop

A student driver learns to park by reinforcement. Every lesson costs minutes of lot time, the examiner only ever sees photos, and the instructor has her own brake and wheel. This lab walks the real-world RL part of Hugging Face's Robot Learning tutorial (§3) and HIL-SERL, with soft actor-critic, RLPD and human interventions running live on a toy lot. About 70 minutes of play.

0 · The lot: a robot that learns by trying

Busytown's driving school teaches parking on a small lot behind the office. The student learns the way a robot does in reinforcement learning: it tries a move, sees what happens, and is told at the end whether it parked. Its habits, which move to make from where, are the policy. In Policy Pond the duckling learned in a simulator, where a million tries are free. Here every try happens on the real lot, and the clock is running. Every term with a wavy red underline is tappable.

The student driver = the robot
its habits are the policy
The lot = the real world
12 × 8 squares; one move ≈ 1 second
The exam bay = the task
park in it, straight; the chequered sign
The examiner = the reward classifier
only sees dashcam photos (step 3)
The logbook = the replay buffer
every move, studied again and again (step 1)
The dither dial = the temperature
what keeping options open is worth (step 2)
The instructor's drives = demonstrations
half of every study batch (step 4)
The dual controls = human interventions
her brake and wheel (step 5)
The hedge and the fence = workspace bounds
and every crash costs a reset (step 6)

Covers Robot Learning tutorial §3: RL for robotics, and why real-world RL is hard (safety, resets, sample efficiency) · HIL-SERL (Luo et al. 2024) §3.1: a sparse, success-only reward

The first lessons

The untrained student picks one of three moves at random every second: steer left, straight on, or steer right, rolling one square forward each time. The lesson ends when it parks, hits something, pulls into the wrong bay, or after 30 moves. A reset costs 10 seconds (the instructor walks the car back) or 45 after a crash (cones, a check of the bumper).

0:00
lot time
0
lessons
0
crashes
0
parked in the exam bay

The logbook page for every move

Each move is written down as one line: where the car was (its square and which way it pointed), the move, the reward, where it ended up, and whether the lesson ended. That (s, a, r, s′, done) line is a transition; the reward is 1 only for parking straight in the exam bay, 0 for everything else, a sparse reward.

Guess first!
Two thousand lessons of random driving. How many end parked straight in the exam bay?
8 of 2,000, and 95% end in a crash. That's 26 hours of lot time for eight rewards. A learner that only hears "1" at the very end, and almost never, has very little to go on: HIL-SERL reports that RL from scratch, with no demonstrations and no corrections, reached 0% success on every task it tried (Table 1b).
Say it out loud
On a real robot every try costs minutes and some cost a reset. With a reward that only says "success" at the end, random exploration almost never sees one, so the whole game is getting more out of every minute.

1 · Every lesson twice: on-policy vs off-policy

Policy Pond's learner, REINFORCE, is on-policy: it learns from a lesson driven with its current habits, makes one update, and throws the lesson away, because after the update the lesson no longer shows how the student drives. Soft actor-critic (SAC) is off-policy: it writes every move into the logbook and, after every move, studies a few random batches of old pages. Pages written by an older, clumsier student are still true facts about the lot. The number of study batches per move is the update-to-data ratio.

To give REINFORCE a fair chance, this step uses an easier practice task: drive into the painted practice box (any square, any heading), judged by the instructor's eye. Both learners see exactly the same lessons' starting squares, seed for seed.

Covers Robot Learning tutorial §3: "Off-policy algorithms like Soft Actor-Critic (SAC) tend to be more sample efficient than their on-policy counterpart … due to the presence of a replay buffer" · SAC (Haarnoja et al. 2018): a Minitaur learned to walk in about 2 hours of real time · LeRobot: utd_ratio

Race them on the practice box

SAC's study batches per move (UTD)
Each line is the average of 8 students' exam scores: after every lesson the student drives alone, its best move at every square, from 24 fixed starting poses. The x-axis is lot time, resets included.
Guess first!
REINFORCE takes 557 lessons, 5½ hours of lot time, before its 8 students average 75% on the exam. SAC, studying 4 batches after every move?
253 lessons, 160 lot-minutes. Each move SAC logs is studied 63 times on average before training ends (4 batches of 16 pages per move, drawn at random from the whole logbook); each move REINFORCE sees is used once. After 200 lessons SAC averages 62% to REINFORCE's 33%.
Guess first!
Studying 16 batches per move instead of 4: four times the study. How much sooner does it reach 75%?
243 lessons instead of 253 (from 1 batch per move: 300). Studying pages more often helps until the logbook is the limit: you can't study your way to a square nobody has driven to. LeRobot's default is 1 (utd_ratio); RLPD reports a big gain from 10 on a pixel-based task.
Say it out loud
On-policy RL uses each lesson once and throws it away. Off-policy RL keeps every move in a replay buffer and learns from it again and again, so the same real minutes buy far more learning.

2 · The soft critic: what SAC studies in the logbook

SAC keeps three things. The critic, Q(s, a): how good is this move from here, counting everything that tends to follow. The actor, π(a | s): the student's habits, pulled towards the moves the critic likes. And the temperature α: how much the student is paid for keeping its options open. The critic learns from one page at a time with a Bellman target, read off a slow copy of itself, the target network.

The moves here are three choices, so this is the discrete form of SAC (Christodoulou 2019): the averages over the next move are exact sums, not samples. The critic and the actor are tables, one number per square, heading and move; real SAC uses neural networks.

Covers Robot Learning tutorial §3, eqs. 15–17: the maximum-entropy objective and the soft TD target · HIL-SERL eqs. 1–2 · SAC (Haarnoja et al. 2018) eq. 18: automatic temperature · SAC-Discrete eqs. 10–12

Study one page

A student that has had 60 lessons on the practice box (251 moves in its logbook, 888 study steps so far). Pick a page and watch the target being built.

the page
Guess first!
The page "hit something": the car drove into the hedge. What's its Bellman target?
y = r = 0. The lesson ended (done), so nothing follows to add. There's no crash penalty in HIL-SERL's reward: success pays 1 and everything else 0. A crash simply forfeits whatever the student could have earned, which the critic learns from the pages that didn't crash.

The dither dial

For a fixed critic, the actor's best habits are π(a | s) ∝ exp(Q(s, a) / α): with the temperature high, all three moves look alike; with it low, the best move wins outright. The entropy measures how spread out the habits are (ln 3 = 1.10 nats for a coin with three faces). Below, three moves whose values are 0.62, 0.70 and 0.55.

temperature α0.10

SAC doesn't fix α by hand: it tunes it so the habits keep a target entropy H̄ (here 0.15 nats, a choice made for this small lot: SAC-Discrete's paper uses 0.98·ln 3 ≈ 1.08 for three moves, 98% of the maximum: on this small lot that is nearly random driving), raising α when the student gets too sure and lowering it when it's too random (eq. 18). LeRobot's code starts α at 1.0 (temperature_init); its HIL-SERL guide suggests 0.01, warning that too high a temperature "can make human interventions ineffective". Run eight students on the practice box at each setting.

Guess first!
α stuck at 1.0, tuning off. After 300 lessons on the practice box the student…
4% on the exam, against 82% when α is tuned from the same start. At α = 1 every move that keeps three options open earns about as much as the box pays once, and the box ends the lesson, so the soft value of driving around is higher than the value of arriving. Its lessons run 12.0 moves, against 9.4.
The slow copy. The target y reads Q̄, a copy that follows the critic slowly, Q̄ ← τQ + (1 − τ)Q̄ after every study step (τ = 0.005 in SAC and LeRobot). With a neural critic, one update moves the values of many squares at once, and a target that moves with it is a dog chasing its tail. A table has no such spill-over, so here the copy can only slow learning: with τ = 1 (no copy) the fleet reaches 75% at lesson 202, with 0.05 at 225, with 0.005 at 253. It's in the lab so you can read the config, not because the toy needs it.
Say it out loud
SAC's critic learns from replayed transitions with a soft Bellman target, read off a slow copy of itself; the actor follows the critic; and the temperature is tuned so the policy stays just random enough, never so random that dithering beats finishing.

3 · The examiner: a reward you have to learn

In a simulator you can compute "parked" from the car's exact pose. On a real robot nothing computes it, and nobody wants to press a button every lesson for two hours. HIL-SERL trains a reward classifier: show it camera images labelled success or not, and let it pay the reward. Our examiner sits in the office and never watches the drive. Every second she gets one 5 × 4-pixel dashcam photo and ticks PASS if her score is over a threshold. A PASS ends the lesson. She is a logistic regression on the 20 pixels, trained the way the paper describes: drive the task by hand a few times, label the frames where the car is parked as positive and every other frame as negative.

Covers HIL-SERL §3.5: "200 positive data points and 1000 negative data points … around 5 minutes"; "we may collect extra data to address any false negative and false positive issues" · LeRobot: success_threshold 0.5, terminate_on_success · Reward Arcade, step 3: an optimizer farms a careless reward

Train the examiner

Her 133 training photos: 40 of the car parked straight in the exam bay, and 93 frames from 10 of the instructor's drives. Photos are noisy: each pixel jitters, and the light changes from shot to shot. The exam bay has a chequered sign; the two staff bays have plain dark signs, and on the lot they're on the way.

threshold0.5
–
accuracy on a fresh test set (138 photos)
–
precision · recall
–
exam bay photos she passes
–
staff bay photos she passes
Guess first!
She scores 100% on a fresh test set collected the same way. A photo of the car parked straight in a staff bay: how often does she pass it?
100% of them, scoring them 0.994 on average against 0.998 for the exam bay. None of her training photos showed a staff bay, so nothing taught her the sign matters: "kerb ahead, white lines either side" was enough to tell parked from not parked. Her test set came from the same drives, so it has no staff bays either. Raise the threshold to 0.99 and she still passes 88% of them; at 0.999 she misses 76% of real parks too.

Let her pay the student

Eight students, 150 lessons each, with the instructor's 20 demo drives in their logbooks (step 4), and the examiner's PASS as the only reward. The exam at the end is graded twice: by her, and by the instructor's eye.

who pays the reward
Guess first!
Trained on the examiner as she was, the students pass 85% of their exam by her clipboard. By the instructor's eye?
49%: 36% of exam starts end in a staff bay, which is nearer and which she passes. The student isn't cheating; it's doing exactly what it's paid for. With 30 photos of her false passes added (staff bays and crooked parks, labelled no) she scores staff bays 0.012, and the students reach 81% by either grader: the same as if the instructor had judged every lesson herself.
Say it out loud
A learned reward is a classifier, and RL will find its false positives. Test it on the states the policy actually visits, not just on data collected like the training set, and fix it with extra negatives where it's wrong.

4 · The instructor's drives: demonstrations in the buffer

Before the first lesson, the instructor drives the course herself, 20 times from 20 random starts, and every move goes into a second logbook, the demo buffer. She's good but human: her drives average 9.4 moves where 8.2 would do. HIL-SERL builds on RLPD: every study batch is drawn half from the demo logbook and half from the lesson log, symmetric sampling. Her pages carry rewards, so from the first study step the critic learns which squares lead to the bay, and the student drives towards them.

Covers RLPD (Ball et al. 2023) §4.1: "for each batch we sample 50% of the data from our replay buffer, and the remaining 50% from the offline data buffer" · HIL-SERL §3.2: a demo buffer "usually on the range of 20-30" · LeRobot: online_ratio 0.5 · Robot Learning tutorial §3

Load the demo logbook

the instructor's demo drives
Guess first!
With no demo drives, half the students have parked in the exam bay at least once by lesson 167. With 20 demo drives?
Lesson 22 (5 drives: 30; 30 drives: 23). And with no demos not one of the 8 students reaches 80% within 250 lessons; with 20, five do, and the fleet averages 80% by lesson 150; with 30, seven do, by lesson 103. HIL-SERL found the same shape at full scale: with demos but no corrections, 49% on average against 100% (Table 1b).
Why half and half, not just pour them in? Poured into the lesson log, her 188 moves are 43% of the log after 50 lessons and 9% after 250: they fade as the student's own moves pile up. Symmetric sampling keeps them at half of every batch however long training runs. RLPD's ablations favour it for stability and lower variance with neural critics. In this small table pouring did as well (all 8 students reach 80%; the fleet at lesson 130), so the toy doesn't show RLPD's reason; it does show the share.
Say it out loud
Demonstrations go into a replay buffer, not into an imitation loss: half of every batch comes from them, so the critic learns where success is from the very first update, and the policy is still free to beat the demonstrator.

5 · Dual controls: the human in the loop

Driving-school cars have a second brake and wheel on the passenger side. HIL-SERL's instructor holds a SpaceMouse (in LeRobot, a gamepad or an SO-101 leader arm). When the student is about to fail, crash or pull into the wrong bay, she takes over, drives a few moves, and hands back. Her moves are interventions: they go into both logbooks, so they're in half of every batch; the student's own moves only go into the lesson log. The intervention rate is her share of the moves, averaged over 20 lessons, and it should fall to zero as the student improves.

Covers HIL-SERL §3.4: "We store the intervention data in both the demonstration and RL data buffers"; "the policy improves faster when the human operator issues specific corrections while letting the robot explore on its own otherwise" · §3.5: avoid "persistently providing long sparse interventions that lead to task successes" · LeRobot HIL-SERL guide: "Avoid intervening for long periods of time" · Robot Learning tutorial §3, Fig. 16

How the instructor helps

her style
–
lesson
–
moves
–
hers
–
result
Solid: the fleet's exam score. Dashed: the intervention rate (her moves ÷ all moves), over the last 20 lessons.
Guess first!
Without her, the 8 students (with 20 demo drives) average 80% at lesson 150. With short corrections, three moves whenever it's about to fail?
Lesson 11: 5 minutes of lot time instead of 92, for 3.0 minutes of her driving over all 150 lessons. Her rate starts at 31% and falls to 2%. Catching only half the mistakes: lesson 27; a fifth: lesson 69. Her corrections land exactly where this student goes wrong, which no demo drive can know in advance.
Guess first!
The backseat driver grabs the wheel at every move that isn't the shortest way, and keeps it until the car is parked. Over the last 20 lessons, her share of the moves is…
40%, and 11.6 minutes of her driving against 3.0, and the fleet reaches 80% at lesson 22, twice as late as short corrections. The student rarely finishes a lesson itself, so it never stops needing her. Taking over only when it's about to fail but still driving all the way in: 12% at the end, 6.6 minutes. HIL-SERL adds a reason a table can't show: long rescues that always end in success make a neural critic overestimate values.
Say it out loud
Human interventions put the expert's corrections exactly where the policy fails, stored in both buffers. Keep them short and specific, let the robot explore otherwise, and the intervention rate falls towards zero.

6 · The real lot: bounds, resets and the wall clock

Simulators count episodes; real labs count hours. A crash on a real robot is a reset at best and a broken part at worst, so HIL-SERL works inside a box: in LeRobot you drive the arm around the space that solves the task, record the end-effector's minimum and maximum, and every action is clipped to stay inside (workspace bounds). Our lot gets a low fence inside the hedge: a move that would leave the lot leaves the car where it is, turned, a bump instead of a crash. Cones and parked cars are inside the box, so the fence can't help with those.

Covers Robot Learning tutorial §3: real-world RL needs "external safeguards" and manual resets are "time-consuming and error-prone" · HIL-SERL §3.3: "an impedance controller with reference limiting"; §4.3: training time "includes all scripted motion, policy rollouts, intended stops" · LeRobot: end_effector_bounds, EEBoundsAndSafety, reset_time_s

Count minutes, not lessons

workspace bounds
reset after a lesson10 s
Guess first!
Over 250 lessons the students without a fence crash 107 times each. With the fence?
18: most crashes were into the hedge, and the fence turns them into 1,752 harmless bumps. All 8 students reach 80% (5 without), the fleet gets there at lesson 159 instead of 150 but in 80 lot-minutes instead of 92, and the 250 lessons take 116 minutes instead of 134.
Guess first!
Same students, same fence, but every reset takes 30 seconds instead of 10. The lesson at which they average 80%?
Lesson 159 either way, because nothing about learning changed, but 129 lot-minutes instead of 80 (at 60 s: 205). Resets are why HIL-SERL scripts a reset motion where it can, and why LeRobot's guide sets reset_time_s to 5 seconds.
Putting it together. Twenty demo drives and short corrections from the instructor (step 5's fleet): the students average 80% on the exam at lesson 11, about 5 minutes of lot time, with 3 minutes of her driving over 150 lessons. Compare the start of step 0: 2,000 random lessons, 26 hours, eight parks. HIL-SERL's real tasks took 1 to 2.5 hours to reach near-perfect success.
Say it out loud
On a real robot the clock that matters is the wall clock. Bound the workspace so exploration can't hurt anything, make resets cheap, and judge methods in minutes, not episodes.

★ The instructors' review board

Three training runs went wrong. For each: run it as configured, pick a fix, re-run eight students, and name the cause. The tempting wrong fixes are on the list, and they fail for the reason the step taught. Each case is scored on the re-run and the cause.

☆☆☆

✓ Field test

Ten questions. Answer each by operating the widget in the step named, not from memory. Eight or more earns the check.

What's exact here, and what's a teaching model

  • The real algorithms: soft actor-critic for discrete actions, with SAC-Discrete's three losses (Christodoulou 2019, eqs. 10–12: the exact soft Bellman target, the actor loss and the temperature loss), the automatic temperature with a target entropy (Haarnoja et al. 2018, eq. 18), Adam on the actor and on log α, and a slow target copy Q̄ ← τQ + (1 − τ)Q̄ after every step; a replay buffer studied at an update-to-data ratio; RLPD's symmetric sampling, half of every batch from the demo buffer; HIL-SERL's buffering, interventions into both buffers and the student's moves into the online one only; the intervention rate as HIL-SERL defines it (intervened steps over all steps, a running average over 20 episodes); a learned binary reward classifier (logistic regression, trained by gradient descent) with a success threshold, ending the episode on success; REINFORCE with a baseline as the on-policy comparison. Gradients are checked against finite differences in tests/check.js.
  • Teaching models, labelled on the page: the lot (12 × 8 squares, 8 headings, three moves), the timings (one move = 1 second, resets of 10 or 45 seconds), the instructor's judgment (a shortest-path planner that knows when a move will fail, with human detours in her demo drives), and the dashcam (a 5 × 4 greyscale photo with pixel noise) are hand-designed. The critic and the actor are tables, so there are no neural networks, no LayerNorm or critic ensembles (RLPD), no twin critics (SAC uses two), and no overestimation of the kind HIL-SERL warns about; the actor updates instantly instead of every few seconds over the network. The exam is the student's best move at every square from 24 fixed starts. Every run is seeded, so it's the same for everyone.
  • The directions are real; the lot isn't a robot. Real HIL-SERL learns from 128 × 128 camera images with a pretrained ResNet-10, in end-effector space (LeRobot's default control rate is 10 Hz), on tasks like inserting RAM or whipping a Jenga block, in 1 to 2.5 hours. Nothing here predicts how long a real task takes.

Sources (exact quotes and sections in SOURCES.md): Luo, Xu, Wu & Levine, Precise and Dexterous Robotic Manipulation via Human-in-the-Loop Reinforcement Learning (HIL-SERL, 2024) · Capuano et al., Robot Learning: A Tutorial (2025), §3 · the LeRobot HIL-SERL guide and code · Haarnoja et al., Soft Actor-Critic Algorithms and Applications (2018) · Christodoulou, Soft Actor-Critic for Discrete Action Settings (2019) · Ball, Smith, Kostrikov & Levine, Efficient Online Reinforcement Learning with Offline Data (RLPD, 2023).

Part of a series of hands-on labs: Inference Kitchen (serving) · Finishing School (post-training) · Arm Playground (kinematics and control) · Policy Pond (reinforcement learning) · Reward Arcade (environments and evals) · Fork in the Road (diffusion policies) · Duck's-Eye View (robot vision) · Demos to Deployment (imitation learning) · Dual Controls (real-world RL with a human in the loop)