Modern Robotics and Physical AILesson 5.5 · Privileged teacher
Glossary Ideas map RU
5.5 Part 5 · Reinforcement learning

Learning with privileged information: the teacher knows the world, the student knows only what it senses

In lesson 5.4, a policy was trained in simulation on many random worlds, and it works in all of them at once, but cautiously: not knowing which world it got, it prepares for the worst. Yet the simulator knows everything about its world: the floor friction, the payload mass, the shape of the terrain. This method puts that knowledge to use. First, you train a teacher that gets the hidden parameters of the world directly as input. Then a student, which has only the sensors of the real robot and a memory of the last few seconds, learns to imitate the teacher, just as Ada imitated a planner program in lessons 1.1 and 1.2. In 2019, this is how a car learned to drive in the CARLA simulator: the teacher saw the ground-truth map around the car and learned from an autopilot's demonstrations, while the student had only a camera. In 2020, the teacher for the quadruped ANYmal was trained with reinforcement learning, and the robot learned to walk through mud, snow and streams without a single camera. In 2021, the RMA method trained its teacher with reinforcement learning as well, and the robot could tell from the history of its own movements, within a fraction of a second, that the ground underfoot was slippery. In 2022, an ANYmal that could also see the terrain around it climbed Mount Etzel in Switzerland with this training scheme in 31 minutes, faster than the trail sign promises hikers.

≈ 55 minutes3 labs, 2 diagrams and a quizmissions with a goal
THREE ADAS ON ONE FLOOROn carpet, tile and a wet floor, compare an Ada who knows the wheels' traction with two of her students who don't: one remembers the last two seconds, the other doesn't
A FORECAST ON THE CHARTPredict who will learn better, a student that watches the teacher drive or a student that drives itself and asks the teacher, and check it by training them
FEELING THE FLOORLay out floors across the rooms and find how many steps it takes Ada to realize, from the history of her commands and speeds, that she has driven onto a wet floor

Start the lesson ↓

1 Floor

What the simulator knows and the robot doesn't

In lesson 5.4, a policy was trained on random worlds: mass, friction and delays changed from episode to episode, and the policy learned to cope with all of them at once. But in any single episode it doesn't know which world it got, so it acts in a way that won't fail in the hardest one. Meanwhile, the simulator knows everything about its world, because the engineer sets its parameters. Nobody will tell the real robot any of this: all it has is its sensors.

In this lesson's labs, Ada drives the same route as in lessons 1.1, 1.2 and 5.2: from the hallway through the living room to the kitchen, and we watch the apartment from above. A pure pursuit controller handles the steering. It is the very program that was the teacher in lesson 1.1, and it guides Ada along the middle line of the passage. The policy chooses only the speed, from 20 to 150 cm/s. Its sensors are what Ada knows about the route and about herself: the curvature of the route at five points ahead (where the turns are and how sharp they are), the wheel speed, and how far it still is to the kitchen.

Ada is a home humanoid on a wheeled base; the course labs are built around her. More about her in lesson 0.1.

What sets these labs apart from earlier lessons is the floor. Each floor has its own wheel traction μ: how hard the floor can push the wheel sideways and backward before the wheel starts to slip. In the labs, carpet has μ = 1, tile 0.7, and a wet floor 0.45. Traction limits two things. The brakes stop Ada no harder than μ · 3 m/s², so on a wet floor the braking distance is more than twice as long as on carpet. And in a turn, the lateral acceleration can't exceed μ · 2 m/s²: if the steering asks for more, the wheels slip, Ada turns less than she should, and she gets carried toward the wall. A turn with a 50 cm radius can be taken at 100 cm/s on carpet, but no faster than 67 cm/s on a wet floor. The motors accelerate Ada equally on any floor.

So the right speed depends on a number the policy can't see. A property of the world that the right action depends on but the sensors don't show directly is called a hidden parameter. In the simulator, μ is known at every point. The real Ada can only infer it indirectly, from how she brakes and turns. How do you teach a policy that isn't allowed to know the floor to drive as if it did?

2 Teacher

A teacher that knows the floor: training in two stages

The task was split in two in the paper Learning by Cheating (Chen et al., Intel Labs and UT Austin, 2019) on driving in the CARLA simulator. First, you train a privileged agent: one that sees what the real robot won't have. In the paper, that is the ground-truth map around the car: lanes, traffic lights, other cars and pedestrians. Then this agent becomes the teacher of an agent that has only a camera. The authors put it plainly: the privileged agent “cheats”, and the final one doesn't. They explain the split by saying that direct learning “conflates two difficult tasks: learning to see and learning to act”. The teacher doesn't need to see: it is given the state of the world, so it only learns to act. What's left for the student is to learn to see well enough to act like the teacher.

The word “teacher” has come up in the course before. In lessons 1.1 and 1.2, the teacher was a program that knows the route and gives the right steering at any point, and Ada learned to imitate it: from the teacher's drives, and in lesson 1.2 with DAgger, from her own drives with its hints. A privileged teacher plays the same role: it knows more than the student. The difference is that nobody writes it by hand. In Learning by Cheating, the teacher was trained on demonstrations from the simulator's autopilot: 157,000 frames, about 4 hours of driving. In the work of Lee et al. (ETH Zurich and Intel, 2020) on the quadruped ANYmal walking over challenging terrain, the teacher was trained with reinforcement learning. As input, it received the terrain profile around each foot, the contacts of the feet with the ground, friction and external forces.

Two-stage training, with Ada as the example. Stage 1 runs in the simulator: the teacher gets the sensors and the floor traction μ, which the simulator knows, and learns from the reward with reinforcement learning. Stage 2 also runs in the simulator, but now the student drives, and it gets the sensors and the history of the last 2 seconds. At every moment, the teacher looks at the same state together with μ and says which speed it would have chosen. The difference from the student's choice is the error the student learns from. The last panel is the real Ada: the teacher and μ stayed in the simulator, and only the student drives. Blue marks what the real robot also has: the sensor readings and the history. Purple marks what exists only in the simulator: the traction μ, the teacher's input with μ, and the teacher itself. The student is drawn in orange. The stages light up in turn, and on a narrow screen they replace one another. Click the diagram to pause it.

Why not train the student with reinforcement learning right away? With full information the task is easier: the right action depends only on what the policy sees. Lee et al. write that this lets the teacher “quickly achieve high performance”, while training a policy on the sensors alone to walk over challenging terrain didn't work for them: “the supervisory signal was sparse”, and the network “failed to learn locomotion within reasonable time budgets”. And the student learns to imitate the teacher with ordinary supervised learning, as in lesson 1.1: every state has a correct answer, and there's no need to wait for the reward to reveal what was good.

In our labs, the teacher will be Ada's speed policy, which sees μ under the wheels. It learns with PPO, as in lesson 5.2. There are two students. One has the same sensors as the teacher, but without μ. The other also has a history: the last 20 decisions, that is, 2 seconds. The history records what speed and what steering Ada commanded, what speed the wheels reported, and how fast the base actually turned according to the gyroscope. Let's see which of them learns to drive like the teacher.

🔬 Lab 1

The teacher and two students on the same floor

The teacher learns with PPO, like Ada in lesson 5.2, over 120 updates of 8 drives each. The floor on each drive is random: traction ranges from 0.3 to 1, and in half of the drives it is the same throughout the apartment, while in the other half each room has its own. For every meter of progress toward the kitchen, Ada gets a reward of +1, for reaching the kitchen +2, for a collision −3, and every tenth of a second on the way costs her −0.02. So driving faster pays, but not at any price. The students learn with DAgger from lesson 1.2: in the first iteration the teacher drives, in the next five the student drives itself, and in every visited state the teacher says which speed it would have chosen. That makes 6 iterations of 8 drives in total.

The test is the same for everyone: on each floor, each policy makes 20 new drives that weren't in training, with the same starts and the same sensor noise. Everything trains right in your browser and takes a few seconds.

Floor

Top-down view of the apartment, 6 × 4 m: the hallway on the left, the living room in the middle, the kitchen on the right, furniture hatched. Carpet is drawn in striped beige, tile in gray squares, and a wet floor in light blue with drops. The lines show the paths on one test drive: the teacher drives along the purple line, the student with history along the orange one, the student without history along the blue one, and the policies from mission 3 along the gray ones. Line thickness shows speed: the thicker the line, the faster Ada is going. A check mark at the end of a path means Ada made it, and a cross means she crashed; the dashed circle marks the kitchen.

Horizontally: how far Ada has driven along the route, cm; vertically: her speed, cm/s. Gray bands mark the turns: the darker the band, the sharper the turn. The vertical dashed lines are the doors between rooms.

Under the hood: the world, the networks, training and a check on eight seeds

The world. The apartment and the route are taken from lessons 1.1 and 5.2. Steering is handled by pure pursuit: it guides Ada along the middle line toward a point 42 cm ahead and sets the required turn rate ω=v κ\omega = v\,\kappa, where κ=2sin⁡α/L\kappa = 2\sin\alpha / L is the curvature of the arc to that point. Traction limits braking (μ⋅3\mu \cdot 3 m/s²) and the lateral acceleration, v ω≤μ⋅2v\,\omega \le \mu \cdot 2 m/s²; the actual turn rate catches up with the required one with a lag. A simulation step lasts 0.05 s, a decision is held for 0.1 s, and a drive lasts up to 20 s. Ada starts in the hallway with a spread of 8 cm and 0.12 rad and an initial speed from 0 to 60 cm/s. Noise is added to the sensors: ±2 cm/s to the wheel speed and ±0.03 rad/s to the gyroscope.

The networks. All the policies are networks with two hidden layers of 32 neurons and tanh. The teacher gets the 7 sensor numbers and μ as input, the student without history the same 7 numbers, and the student with history the 7 numbers plus 20 × 4 history numbers. The teacher learns with PPO from lesson 5.2: its policy is Gaussian, each update runs 5 epochs over minibatches of 128 with an Adam learning rate of 0.002, GAE uses γ=0.99\gamma = 0.99 and λ=0.95\lambda = 0.95, and the clipping is 0.2. The students learn on the mean squared error between their speed and the teacher's: after each DAgger iteration, they take 300 Adam steps over all the accumulated examples.

The same in any browser. The exponential, logarithm, tanh, sine and arctangent in the engine are built from additions, multiplications and divisions, as in lessons 5.2 and 5.3: the built-in functions differ between browsers in the last digit, and training amplifies that difference.

Eight seeds. The lab uses a single seed, and here is a check on seeds 1–8, where each seed has its own teacher and its own students. On seven seeds, the teacher made it on every test drive on all four floors; on seed 8, it never learned to drive on tile (0%), and its students failed along with it. The student without history never made it on a wet floor on any seed, made it on carpet with a wet kitchen in 0 to 30% of drives, and on carpet was 0.05–0.82 s slower than the teacher. The student with history made it on a wet floor in 90–100% of drives, on carpet with a wet kitchen in 70–100%, and on carpet differed from the teacher by no more than 0.11 s. On seven seeds, RL without μ made it on all floors but took 6.35–6.95 s on carpet versus 4.97–5.13 s for the teacher; on seed 6, it learned to drive fast (5.06 s on carpet) and crashed on the other floors. RL on history took from 5.45 to 10.56 s on carpet, and on seed 6 it made it across a wet floor in only half of the drives.

The student without history imitated the teacher just as diligently as the student with history, and their data were collected in the same way. But at the same place on the route and at the same speed, the teacher keeps going at full speed on carpet and brakes on a wet floor: the right answer depends on μ. A student that can't tell one μ from another learns something in between, too cautious on carpet and too bold on a wet floor. For the student with history, 2 seconds of its own commands and of the wheel and gyroscope readings are enough to drive like the teacher.

Reinforcement learning without a teacher also gets there, but it is slower than the teacher on every floor: not knowing μ, the policy drives as if the floor were wet everywhere. The RMA authors write the same about their baseline that doesn't know the parameters of the world: “it learns a very conservative policy which loses on performance”. So the teacher is needed not for reliability, but so that the student knows how to drive on each floor. That leaves the question of whose drives to train the student on.

3 Student

Learning from the teacher's drives or from its own

The student learns with ordinary supervised learning: in each state, it outputs an action and compares it with the teacher's action in the same state. What remains is to choose where the states come from:

ϕ∗=arg⁡min⁡ϕ Es∼d[ℓt],ℓt=(πϕ(ot,ht)−πT(ot,et))2.\begin{gathered} \phi^{*} = \arg\min_{\phi}\ \mathbb{E}_{s \sim d}\bigl[\ell_t\bigr], \\ \ell_t = \bigl(\pi_\phi(o_t, h_t) - \pi^{\mathrm{T}}(o_t, e_t)\bigr)^{2}. \end{gathered}

Here πT\pi^{\mathrm{T}} is the teacher, πϕ\pi_\phi is the student with weights ϕ\phi, oto_t are the sensor readings at time tt, hth_t is the student's history, ete_t are the privileged parameters of the world (for us, μ under the wheels), ss is the simulator state from which oto_t, hth_t and ete_t are all taken, ℓt\ell_t is the student's error in that state, and E\mathbb{E} is the average over states. Everything hinges on the state distribution dd. If the states come from the teacher's drives, you get the imitation learning of lesson 1.1, behavior cloning (BC). If they come from the student's own drives, which the teacher only labels, you get DAgger from lesson 1.2.

In lesson 1.1, BC failed because of distribution shift: the student drifted to places where the teacher never drove, and there it had nothing to learn from. With a history input, there is a second problem. In the teacher's drives, the history holds the teacher's own commands, while in the student's drive it holds the student's commands, mistakes included. In lesson 1.1, such a history input led to copying itself: the network repeated its previous action. The teacher in the simulator, however, is always available, and you can ask it in any state, including the ones the student has driven itself into. The authors of Learning by Cheating call this one of the main advantages of a privileged teacher: it can be queried in any state, “not only states that were visited in the original trajectories”.

In their ablation (Table 1, a new town and new weather), a student trained only on the teacher's trajectories completed 16% of the routes, and with the student's own drives, 64%. There is one more advantage: a “white box” teacher answers for all commands at once, including the question “What would you do if you had to turn left here?”. With this advantage, the student completed 96% of the routes, and with both advantages at once, 100%. Lee et al. also trained the ANYmal student on its own runs, and the RMA authors did the same for their network that estimates the world from history, with an explicit reference to DAgger.

🔬 Lab 2

Forecast: the student on the teacher's drives or on its own

Here two students with history learn, and the teacher is taken from lab 1. Both have the same budget: 6 iterations, each with 8 new drives labeled by the teacher. The BC student watches the teacher drive in all 48 drives. The DAgger student watches only the first 8 and then drives itself. After each iteration, both take the same test: 10 drives each on carpet, tile, a wet floor and carpet with a wet kitchen.

Horizontally: the training iteration and how many drives the teacher has labeled by then; vertically: how many of the 40 test drives reached the kitchen. On the right are two forecast marks, blue for BC and orange for DAgger; you can drag them up and down. The lines with dots show the actual training.

Top-down view of the apartment. The lines show the 8 drives of the selected iteration that the student learned from: on the purple ones the teacher drove, and on the orange ones the student drove itself while the teacher only gave hints. A cross means the drive ended in a collision, and a check mark means Ada reached the kitchen.

Map
Students
Under the hood: what exactly each student accumulates

At iteration ii, 8 drives are collected with a seed that depends only on ii, so the starts and floors are the same for BC and DAgger. Either the teacher drives (BC and the first DAgger iteration) or the student itself (DAgger, iterations 2–6). In each state, the student's input (sensors and history) and the teacher's action for that same state with the true μ are recorded. The examples accumulate, and after each iteration the student takes 300 Adam steps over minibatches drawn from all of them. The first iteration is identical for both students, so the curves start from the same point.

Eight seeds. After 6 iterations, the DAgger student with history made it on 95–100% of test drives on seven seeds and on 73% on seed 8, where the teacher can't drive on tile. The BC student made it on 35 to 100% of drives. DAgger was never worse than BC on any seed and was ahead by 25–52 points on six of them; on seeds 3 and 6 the two nearly tied (95 and 93%, 100 and 100%). The DAgger student without history made it on 48 to 60% of drives on all eight seeds.

The teacher's drives don't teach the student to drive in the places and with the history that the student itself ends up with. DAgger collects such examples on its own: the student's mistakes become data, and the teacher explains what should have been done right there. But DAgger only fixes distribution shift. It won't help the student without history: however much you ask the teacher, the sensors alone can't tell you which floor is under the wheels.

The student with history keeps what it knows about the floor somewhere inside the network: it doesn't output an explicit estimate of μ. Can you get that estimate separately, and quickly?

4 Module

RMA: estimating the world from history in a fraction of a second

The student with history knows about the floor only implicitly, somewhere in its hidden layers. In the RMA paper (Rapid Motor Adaptation, Kumar et al., UC Berkeley, CMU and Facebook, 2021) for the quadruped robot Unitree A1, estimating the world became a separate part of the system. RMA consists of a base policy and an adaptation module: a network that estimates, from the recent history of the robot's states and actions, which world the robot is in right now.

In the first stage, the base policy and an encoder learn together in simulation with reinforcement learning. The encoder gets 17 privileged parameters of the world (the payload mass and where it sits, the strength of each of the 12 motors, friction, the terrain height under the feet) and compresses them into 8 numbers zz, which the authors call extrinsics. The base policy sees the robot's state, its own previous action and these 8 numbers. This is the privileged teacher: it is trained with PPO for about 24 hours on a single computer, and in that time 1.2 billion simulation steps go by.

In the second stage, the adaptation module learns to recover the same 8 numbers from the history: the last 50 states and actions, that is, 0.5 s. This is regression, since the right answer is known in the simulator. The module is trained on runs of the robot itself with the module in the loop, not on the teacher's runs; the authors write that this is “similar to Ross et al.”, that is, to DAgger. In the teacher's runs the robot would always walk smoothly, and the module would never see what the history looks like when something goes wrong. The second stage takes about 3 hours and 80 million steps.

The RMA scheme. At the top is stage 1 in the simulator: the encoder compresses the world parameters (in purple: payload mass, friction, motor strength…) into 8 numbers zz, and the base policy picks an action from the robot's state and these numbers. At the bottom is the robot: the adaptation module accumulates the history of the last 0.5 s (blue marks what is measured, that is, the states and actions) and once every 0.1 s outputs z^\hat z, an estimate of the same 8 numbers. The base policy (in orange) runs 100 times a second with the latest estimate, and the two parts don't wait for each other. Click the diagram to pause it.

On the robot, the base policy runs 100 times a second and the module 10 times, and they don't wait for each other. This way the estimate of the world is updated, in the authors' words, “in fractions of a second”: in a footnote they specify that RMA takes less than a second, while an earlier method that fine-tunes the policy on the spot needs to collect 4–8 minutes of data (50 episodes of 5–10 s). When the A1 walked onto a plastic sheet covered in oil, the module's estimate changed (the paper's plot shows this in its components), and the robot changed its gait: it made it across the oil in 90% of the runs.

In simulation, where the parameters also changed in the middle of an episode, RMA succeeded in 73.5% of the trials, and the base policy given the true 8 numbers (the expert) in 76.2%. A policy without a world estimate, trained on the full range of parameters (Robust, as in lesson 5.4), succeeded in 62.4%. A variant where the module predicts the 17 parameters themselves instead of the compressed 8 numbers (SysID) succeeded in 56.5%, and the authors conclude that explicitly estimating the parameters of the world is “difficult and unnecessary”. What matters is not guessing the friction, but choosing the right action.

Our lab has a single hidden parameter, and the module estimates μ directly. Let's see how fast it does that and when it fails.

🔬 Lab 3

The adaptation module on a change of floor

Our module is a network that outputs a traction estimate μ̂ from Ada's history over the last 2 seconds. Its history is the same as that of the student with history: 20 × 4 numbers. As in RMA, it learns on its own drives: the teacher from lab 1 drives, but instead of the true μ it is fed the module's estimate, and in each state the true μ is recorded. Training takes 5 iterations of 8 drives. In free mode, you can lay out floors across the rooms.

Top-down view of the apartment. The floors in the rooms are the same as in lab 1: carpet, tile or a wet floor; in free mode, clicking a room cycles through its floors. Ada's path is colored by the module's estimate: it is orange where the module considers the floor good (μ̂ from 0.75), purple where it considers it medium, and blue where it considers it slippery (μ̂ below 0.58). Red dots mark the places where the wheels slipped in a turn.

Horizontally: drive time, s; vertically: traction. The gray step shows the true μ under the wheels, the orange line is the module's estimate μ̂, and the gray band is a corridor of ±0.1 around the true value. Blue marks at the bottom appear when Ada brakes, and red ones when the wheels slip in a turn. The vertical line marks the moment when, after the floor changes, the estimate first enters the band.

Module history
Under the hood: what the module can and can't learn from the history

Each step in the history contributes four numbers: what speed Ada commanded, what speed the wheels reported, what turn the steering controller asked for, and what turn the gyroscope showed. Traction shows up in two places. When Ada brakes, she can't decelerate harder than μ⋅3\mu \cdot 3 m/s², however hard she brakes. When the steering asks for a sharper turn than traction allows, the gyroscope shows less than the steering asked for. As long as Ada drives smoothly, doesn't brake and turns with margin to spare, the history is the same on any floor, and the module has nothing to tell carpet from tile by.

The module outputs μ^=0.65+0.35tanh⁡(y)\hat\mu = 0.65 + 0.35 \tanh(y), where yy is the network's output, and learns on the mean squared error with respect to the true μ. Unlike RMA, our module estimates the parameter itself rather than a compressed vector: there is only one parameter, so there is nothing to compress.

Eight seeds. We checked the module with a 2 s history on seeds 1–8, 10 drives each. On all seeds, it noticed the wet kitchen within 1–9 steps, that is, in under a second. With carpet throughout the apartment, it estimated the traction at 0.85–0.91 on average, on tile at 0.66–0.74, and on a wet floor at 0.46–0.49. In the first second on carpet after a wet floor, the estimate averaged from 0.47 to 0.85; for the module with a 0.5 s history it averaged from 0.66 to 0.89, and that module noticed the wet kitchen within at most 5 steps.

The module recognizes the floor from how Ada brakes and turns. A slippery floor gives itself away as soon as the wheels have to test it, so the module reacts to the wet kitchen within a fraction of a second. A good floor is harder: as long as the wheels don't slip, all you can see is that there is enough traction. That is why the module notices the return to carpet slowly, and with carpet throughout the apartment it estimates the traction below its true value. Lee et al. saw something similar on ANYmal: their student's friction estimate dropped “as soon as the first foot starts slipping” and rose about 2 seconds after the robot returned to normal ground.

Both ANYmal from Lee's work and the A1 from RMA walk blind: they learn about the terrain only by stepping on it. What if the robot also has eyes?

5 Perception

When the student has both a terrain map and proprioception

Blind walking is reliable, but it has a limit. Lee et al. say it directly: “If the machine is commanded to walk off a cliff, it will”, and its gait is cautious because the robot “must by necessity feel out the environment with its body”. Miki et al. (ETH Zurich and Intel, 2022) gave ANYmal a height map of its surroundings built from depth sensors, and once again used a privileged teacher. The teacher saw the exact height map without noise, as well as the contacts, friction and external forces.

The trouble is that the map often lies. Snow, vegetation and water appear on it as obstacles that can't be stepped on, or disappear altogether because they reflect too much light. The authors list other cases too: a reflective metal floor produced a false trench on the map, the stereo cameras saw nothing at all on snow, and soft vegetation looked solid. So the student gets not the exact map, like the teacher, but a noisy one: points shift, heights get distorted, and in 10% of the episodes there is almost no map at all. Its recurrent network accumulates the history of both the map and the body's sensations, and a separate gate learns to decide how much to trust the map right now. When the map contradicts the sensations, for example when a foot sinks into snow where the map showed a solid surface, the network switches to proprioception. As in Lee's work, the student learns on its own runs with the teacher's hints.

The culmination of the work was a hike on Mount Etzel in Switzerland, along a 2.2 km route with an elevation gain of 120 m. ANYmal reached the summit in 31 minutes, against 35 minutes on the trail sign for hikers, and completed the whole route in 78 minutes, against 76 by a hiking planner, without any human help and without a single fall. On steps, the success rate of the blind controller from Lee 2020 already dropped at a height of 20 cm, while the controller with the map reliably climbed steps of up to 30.5 cm. On flat ground, it walked at 1.2 m/s versus 0.6 m/s for the blind one.

6 Today

What of this lives on in robot learning

The scheme in which a teacher in the simulator knows everything and a student learns to imitate it moved from driving to walking and took hold there. Miki 2022 cites Learning by Cheating directly and builds on Lee 2020, and RMA from Berkeley is also organized in two stages. All three walking papers trained the student on its own runs: DAgger, the 2011 method from lesson 1.2, turned out to be a working tool almost ten years later.

The method has its costs. The teacher needs a simulator where privileged information exists: the authors of Learning by Cheating admit that “cheating” by accessing the ground-truth state of the environment “is difficult in the physical world”. The student is limited by the teacher: if the teacher can't do something, the student won't learn it either. The authors of Learning by Cheating name the next step: combining this scheme with reinforcement learning to “train systems that exceed the capabilities of the expert that provides the initial demonstrations”. How this works for humanoids, where whole-body walking is trained in simulation, we'll cover in Part 6.

7 Check yourself

Eight common misconceptions

8 Takeaways

Lesson takeaways

  1. The simulator knows the hidden parameters of the world: friction, mass, terrain. A privileged teacher gets them as input and is trained with reinforcement learning on a task where the right action depends only on what it sees.
  2. The student sees only the sensors of the real robot and learns to imitate the teacher with ordinary supervised learning, as in lesson 1.1. The teacher plays the same role as the planner program in lessons 1.1 and 1.2: it knows more than the student.
  3. Without history, the student can't tell worlds apart and learns the teacher's average behavior: in lab 1, it never made it on a wet floor and drove slower than the teacher on carpet. With a history of the last few seconds, it recovers the hidden parameter by itself and drives like the teacher.
  4. The student is trained on its own drives with the teacher's hints (DAgger), not on the teacher's drives: in lab 2, after 6 iterations, DAgger made it on 100% of test drives and BC on 48%. In Learning by Cheating, it was 64% versus 16%.
  5. The adaptation module of RMA estimates the world separately, from history, within a fraction of a second. It can learn about the world only from what the robot has already experienced: a slippery floor gives itself away at the first braking or sharp turn, and a good one only by the fact that nothing slips.
  6. A policy trained with reinforcement learning without knowing the world is reliable but cautious: on carpet, it took 6.3 s versus 5.0 s for the teacher, and in the simulation from the RMA paper such a policy succeeded in 62.4% of the trials versus 73.5% for RMA itself.

Open questions

What if the teacher knows something the student can't learn from any history?

Our student learns about the floor when the wheels slip or the brakes grip more weakly: the property of the world shows up in its motion. But a step that the teacher sees in advance won't show up in a blind student's history until the student runs into it. The student then learns what the teacher does on average and may make mistakes where the teacher is confident. There are several ways out: give the student sensors that can see it (as Miki et al. did), restrict the teacher to what the student can in principle learn, or fine-tune the student with reinforcement learning after imitation.

Can the student become better than the teacher?

Imitation pulls the student toward the teacher, not beyond it. In lab 1, the student with history sometimes made it a tenth of a second faster than the teacher, but that is a fluke of training, not superiority. The authors of Learning by Cheating name the next step: combining such a scheme with reinforcement learning to surpass the expert. How robots learn from their own experience right on the job, we'll cover in lesson 5.7.

Paper guide

J. Lee, J. Hwangbo, L. Wellhausen, V. Koltun, M. Hutter, “Learning Quadrupedal Locomotion over Challenging Terrain”, Science Robotics, 2020.

Other papers in this lesson: Learning by Cheating (Chen et al., 2019), the privileged agent and driving in CARLA; RMA: Rapid Motor Adaptation for Legged Robots (Kumar et al., 2021), the adaptation module; Learning robust perceptive locomotion for quadrupedal robots in the wild (Miki et al., 2022), a student with a height map and proprioception; Learning Agile and Dynamic Motor Skills for Legged Robots (Hwangbo et al., 2019), the paper that starts the ANYmal line.

The teacher and the student both learn in a simulator. For many tasks there is no good simulator, and new attempts on the robot are expensive: each one costs time, and a failed one can also cost a breakdown. What there is plenty of is recordings, made by operators and by past policies of varying quality.

Lesson 5.6 · Offline RL: how to learn from these recordings alone and do better than their average

Was the lesson clear?
Found a mistake or inaccuracy? Report it on GitHub
Found this lesson useful? Say thanks — that is how the author knows the course is being read.