Multi-Task, Adaptive & Transferable Robot Learning

A robot trained in simulation steps onto ice it never saw. A frozen policy keeps pushing as if the ground were firm, and it stumbles. An adaptive policy reads the ground from its last few steps and recovers within one or two.

Drag the ground severity and count the red footprints in each lane. Then we build the frozen policy and the small estimate it reads. Three ways make that estimate: a running sum, a learned module and a least-squares fit.

You need the closed loop from Lecture 1, a little Python and what an average is. We build the rest from zero.

Lecture 23 of 25 in Introduction to Robot Learning, CMU 16-831 (Spring 2024), taught by Guanya Shi. Slides on the course lectures page. Every idea is re-taught here in our own words and devices. Previous: Lecture 22, Safe RL. Next: Lecture 24, Foundation Models in Robotics.

Walk two robots over the same ground

0.60

Illustrative toy. Each step aims for a 1 m stride. The ground gain e is the metres moved per metre commanded: firm 1.0, mud 1 − 0.4 × severity, ice 1 − 0.65 × severity. A step that misses by more than 30% is a stumble. The adaptive robot moves its belief 35% of the way toward each step's measured gain.

Chapter 0

The Robot Cannot Practise on the Ice

Count what it costs to learn on the spot, and see why adaptation must take a few steps, not a few hundred

You train a four-legged robot in a simulator overnight. It learns a clean trot on firm ground. You carry it outside, and it steps onto ice. Each push now moves the body less than the policy expects, so the feet slip. Then the ground turns to mud, then back to firm.

Why not stop and fine-tune the policy on the ice? Because the robot can fall on every step before it adapts, and a fall can break the hardware. Count the cost.

Price the steps spent adapting

The curve is the chance of no fall after n unadapted steps. Set the fall chance per step, then slide how many steps the robot needs to adapt.

5
2.0%

Illustrative numbers. Real fall risk depends on the gait and the ground; the shape of the curve is the point.

Work the number. Say each unadapted step has a 2% chance of a fall. The chance of no fall in n steps is 0.98 multiplied by itself n times. Fine-tuning that needs 300 steps survives 0.98300 = 0.2% of the time. A read-out that needs 5 steps survives 0.985 = 90% of the time.

The lecture's title has three words. Multi-task means one policy for many goals. Adaptive means one policy for physics it never trained on. Transferable means trained in simulation, working on the real robot. This lesson is mostly about the second word.

The goal. Adapt online, within a few steps, with no retraining. The policy stays frozen. A small estimate of the ground moves.

The failure, as symptom, measurement and fix

The symptom is a policy that walks in simulation and falls outdoors. To measure it, log the stride error on each ground type. The fix is not more training on the ice. It is a policy that reads the ground from its own recent steps.

The road

  1. Two kinds of adaptation: the world changes, or the goal changes.
  2. The design: a frozen policy that reads a moving estimate.
  3. The integral: the classical estimate of a hidden wind.
  4. Meta-learning: train so that a little data is enough.
  5. The privileged teacher: copy a policy that can see the physics.
  6. RMA: read a code for the physics from 50 steps of motion.
  7. Least squares: the read-out, by hand.
  8. Neural-Fly: a frozen basis and three moving numbers.
  9. The sandbox: the hero's full version, with every knob.
  10. The field guide: terms, numbers, code, links and credit.
Why can a legged robot not collect a few minutes of data on new ice and fine-tune its policy?

Chapter 1

Two Kinds of Adaptation

Split what changes into the world and the goal, and see why only one of them is hidden

The word adaptation hides two problems. Dynamics-wise adaptation means the physics changed: friction under a foot, a payload, a gust of wind. Task-wise adaptation means the goal changed: a new target, a new path, a new instruction. What matters is which change the robot can see.

Change the goal, or change the ground

The policy reads the goal g and pushes as if the ground gain were 1. Pick what changes, drag it, then watch where the robot lands.

1.20 m

Illustrative toy. The robot travels e × push, and the policy pushes g metres.

How does a hidden parameter enter the physics? Call the state at step t st and the action at. Call the hidden environment parameter et. The world's transition rule P draws the next state.

Say it aloud

s-t-plus-one is drawn from P, given s-t, a-t and e-t.

st+1
s-t-plus-one the next state: where the body is one step later.
∼
is drawn from the next state is random, picked by the rule on the right.
P( · | … )
P of the next state, given the world's transition rule. The bar reads "given".
st
s-t the state now: joint angles, body speed, orientation.
at
a-t the action now: here a stride command, in metres.
et
e-t the hidden environment parameter: friction, wind, payload. No sensor reads it.
In plain words

The world takes the state s-t and the action a-t. It also uses e-t, which the robot cannot see. It returns the next state s-t-plus-one.

With numbers

With made-up numbers: a stride command a-t of 1.0 m on firm ground, e-t = 1.0, moves the body about 1.0 m. The same a-t on ice, e-t = 0.6, moves it about 0.6 m. Same state and action, a different next state.

Dynamics-wiseTask-wise
What changesThe transition, the physicsThe reward, the goal
The variablee: wind, friction, payloadg: a target, a path, an instruction
Known at test time?No: the robot must infer itUsually yes, you tell it
Policy formπ(s, z), z an estimate of eπ(s, g)

Task-wise adaptation is goal-conditioned RL, taught in full in Multi-Task & Goal-Conditioned RL. This lesson stays with the hidden physics. A third route skips adaptation: train one robust policy over many random physics (Lecture 21). It survives everywhere but walks every ground cautiously.

The failure, as symptom, measurement and fix

The symptom is a policy that handles new goals but falls on new floors. To measure it, test new goals and new grounds separately. The fix is to give the policy an estimate of e.

A drone flies its usual figure-8, but today a strong crosswind blows that it never trained on. Which kind of adaptation does it need?

Chapter 2

A Frozen Policy and a Moving Estimate

Split the controller into a trained policy and a fast estimator, then step the loop to see which part moves

The robot cannot read e. So we give the policy a stand-in: a short vector z that says which world it is in. Two parts make the controller.

  1. The adaptive policy π(s, z) maps the state and the context z to an action. We train it once for every value of z, then freeze it.
  2. The adaptation law A maps the recent history of states and actions to z. It is the only part that changes online.

Call the last few states and actions the history ht. Then the whole controller is one line.

Say it aloud

a-t equals pi of s-t and A of h-t.

at
a-t the action now: the stride command.
π
pi the adaptive policy. Trained in simulation, frozen on the robot.
st
s-t the state now.
A
A the adaptation law. Its output A(h-t) is the context z, a few numbers.
ht
h-t the history: the last few states and actions.
In plain words

Feed the history h-t to A to get z. Feed z and the state s-t to the frozen policy pi. Send the action a-t to the motors.

With numbers

With made-up numbers: the last five strides moved 1.0, 1.0, 0.6, 0.6 and 0.6 m per metre commanded. A takes their average, z = 0.76. To move 1 m, the policy commands 1/0.76 = 1.32 m.

Step the loop once at a time

The ground turns to ice at step 4. Press Step and follow the dot. Watch which box changes its number and which never does.

Illustrative toy. A is the average of the measured gains in a five-step window. Chapter 7 replaces it with least squares.

The two parts face different limits. The policy is expensive to train and never touched in the field. The adaptation law is small and runs every few milliseconds. Zero-shot adaptation reads only this passive history, with no reward and no trials. Few-shot adaptation gets a few trials first. On hardware, trials cost falls.

The failure, as symptom, measurement and fix

The symptom is a twitchy gait: z swings with every noisy step. To measure it, plot z against the true ground in simulation. The fix is a longer window or a smoother A.

In the policy plus adaptation law design, what changes while the robot walks onto a new ground?

Chapter 3

The Classical Answer: a Running Sum That Learns the Wind

Watch a proportional controller stop short in a steady wind, then add a running sum that estimates the wind and cancels it

Control theory solved a small version of this problem before neural networks. Take a quantity s that we want to hold at 0. Our push is a. An unknown steady wind e adds to every push, so s changes at the rate a + e.

A proportional controller pushes back in proportion to the error, a = −2s. At rest, s stops changing:

0 = −2s + e  ⇒  s = e/2

The wind wins a little, forever. With e = 0.6, s rests at 0.3.

Hold s at zero in a steady wind

Teal is s. Pick a controller and drag the wind. With the running sum on, the pink line is its wind estimate.

0.60

Illustrative toy: s changes at rate a + e, simulated in 0.02 s steps, gain κ = 1.

The fix keeps a running sum of past error. Call it êk, the controller's estimate of the wind at step k. Call its gain κ and the step length Δt. The push becomes a = −2s − ê.

Say it aloud

e-hat-k-plus-one equals e-hat-k plus kappa times s-k times delta-t.

êk+1
e-hat-k-plus-one the wind estimate after this step.
êk
e-hat-k the wind estimate now. It starts at 0.
κ
kappa the gain: how fast the sum grows. Here 1 per second.
sk
s-k the error at step k: how far s is from 0.
Δt
delta-t the time between steps, in seconds.
In plain words

While s-k is not zero, add a little of it to e-hat at each step. The push grows until it cancels the wind. Then s-k is zero and e-hat stops moving, at e.

With numbers

With made-up numbers: e = 0.6, κ = 1, Δt = 0.5 s, starting from the offset s = 0.3 with ê = 0. Then ê goes 0, 0.15, 0.30, 0.41, 0.49 while s goes 0.30, 0.30, 0.23, 0.15, 0.09. Both settle at ê = 0.6 and s = 0.

The shape of every method here. The running sum reads the history of s and returns an estimate of the hidden e. It is an adaptation law.
FlavourIdeaMust the estimate be true?
MIAC, model-identification adaptive controlIdentify the system while it runs.Yes: it aims for ê = e.
MRAC, model-reference adaptive controlAdapt until the system behaves like a reference model.No: only the behaviour must match.

Keep the MRAC row: an estimate only has to give the right action. RMA uses this in Chapter 6. Lecture 12 covers adaptive control itself.

The failure, as symptom, measurement and fix

The symptom is a sum that keeps growing while the motor is at its limit, then overshoots. To measure it, plot s and ê after a sudden change in wind. The fix is a smaller κ and a clamp on ê (anti-windup).

A proportional controller settles at s = e/2. A running sum of the error drives s to 0. What is the running sum doing?

Chapter 4

Learning to Adapt Fast

Train on many tasks so that one small step fits a new one, and drag the starting point to see why it matters

The running sum came from a model. Contact with mud has no clean model, so we want to learn the adaptation itself. Meta-learning trains across many tasks so that a new task needs only a little data. Its rule, from Vinyals and colleagues: test and train conditions must match. If the robot must adapt from half a second of motion, train it to adapt from half a second.

Why can a little data be enough? Tasks share most of their structure, and the task-specific part lives in a few numbers. Pretraining learns the shared part once.

StyleHow it adaptsTrade-off
Black boxA network reads the task's small dataset and outputs the task's parameters.Flexible; its guesses can be unreliable.
MAMLOne gradient step from a learned starting point.Uses the same optimizer at test time as in training.

Call the shared starting parameters θ. Task i has its own loss Li. MAML takes one gradient step of size α on that task.

Say it aloud

theta-i-prime equals theta minus alpha times the gradient with respect to theta of L-i of theta.

θ′i
theta-i-prime the parameters adapted to task i.
θ
theta the shared start. Meta-training learns it.
α
alpha the step size of the one adaptation step. Here 0.25.
∇θ
the gradient with respect to theta the direction that raises the loss fastest.
Li
L-i task i's loss: how wrong the parameters are on that task.
In plain words

Start from theta. Find the direction that raises task i's loss L-i fastest. Step the other way by alpha. Meta-training moves theta so that this one step lands well on every task.

With numbers

With made-up numbers: L-i = (θ − 1.2)2, so its gradient is 2(θ − 1.2). From θ = 0.8 with α = 0.25: θ′i = 0.8 − 0.25 × 2 × (0.8 − 1.2) = 1.0. The loss falls from 0.16 to 0.04.

Choose where to start

Yellow rings are five tasks' best parameters. Drag the purple start θ. Each arrow is one step toward a task. Red gaps are what one step leaves.

0.10

Illustrative toy: five tasks with losses (θ − w)2, w = 0.4 to 1.2, step size 0.25.

RMA's adaptation module in Chapter 6 is a black-box adapter. When each task is a whole MDP, this is meta-RL, taught in full in Meta-Reinforcement Learning. Meta-learning a dynamics model, not a policy, is the root of Neural-Fly.

The failure, as symptom, measurement and fix

The symptom is fast adaptation on training tasks and slow adaptation on the real one. To measure it, hold out tasks and compare the one-step loss. The fix is a wider task spread, so the real task sits inside it.

What is the core idea of meta-learning in this lecture?

Chapter 5

The Privileged Teacher

Train a teacher that sees the true physics, then copy it into a student that sees only the robot's own sensors

In simulation you know everything: the friction of each patch, the payload, the motor strength. On the real robot you know none of it. Teacher-student training, also called privileged learning, uses this gap.

  1. Train the teacher in simulation, with RL. It reads the true parameter e: πt(x, e).
  2. Distill into a student in simulation. It reads only its sensor history h: joint angles and IMU readings. It learns to output what the teacher outputs.
  3. Deploy the student. Throw the teacher away.

For driving, Learning by Cheating (Chen and colleagues, 2019) trains a teacher that sees every car and light. Its student sees only the camera. For walking, the teacher sees contact, terrain, friction and pushes. The student sees proprioception.

How is the student trained? Take N simulated moments. Call the teacher's action πt(xi, ei) and the student's πs(xi, hi). The loss L is their average squared gap.

Say it aloud

L equals one over N times the sum over i of, pi-s of x-i and h-i minus pi-t of x-i and e-i, squared.

L
L the distillation loss. Training lowers it.
1/N
one over N divide by the number of moments: an average.
Σi
the sum over i one term for each simulated moment.
πs(xi, hi)
pi-s of x-i and h-i the student's action from the state x-i and the sensor history h-i.
πt(xi, ei)
pi-t of x-i and e-i the teacher's action from the state and the true physics e-i.
In plain words

For each moment i, run both policies. Subtract the teacher's action from the student's, square it, and average over N. Change the student to make L small.

With numbers

With made-up numbers: the teacher outputs −0.5, 0.5 and 1.5 at three moments. The student outputs −0.4, 0.6 and 1.6. Each gap is 0.1, so L = (0.01 + 0.01 + 0.01)/3 = 0.01.

Distill the teacher

Pick a stage to see what each policy reads. Blue dots are the teacher's actions; the purple line is the student. Raise the history noise to hide the physics from the student.

0.10

Illustrative toy, the same as the Code Lab below. The teacher's action is 2e + 0.5, the history reads e plus noise, and the student is a least-squares line.

Why not train the student with RL directly? RL from sensor history alone is slow, with sparse reward and many falls. The teacher learns easily with full state, and distillation turns the rest into supervised regression.

The failure, as symptom, measurement and fix

The symptom is a student that matches the teacher in training and drifts on its own rollouts. To measure it, score the student on the states it visits itself. The fix is to label those states with the teacher, as DAgger does (Imitation Learning).

In teacher-student training for walking, what does the teacher see that the deployed student does not?

Chapter 6

RMA: Rapid Motor Adaptation

Learn a small code for the physics, learn to read that code from 50 steps of motion, then time the two loops

RMA (Kumar, Fu, Pathak and Malik, 2021) walks a quadruped on sand, mud and stairs it never saw. It is teacher-student with one change: the student copies a code, not an action.

  1. Phase 1, in simulation. An environment encoder μ squashes the privileged vector e (mass, friction, motor strength, terrain height) into 8 numbers, the extrinsics z = μ(e). The base policy π reads the state, the last action and z. RL (PPO) trains μ and π together.
  2. Phase 2, in simulation. Freeze π. Train an adaptation module A to estimate z from the last 50 states and actions alone.

Call that window of 50 state and action pairs ht. Phase 2 is a regression.

Say it aloud

L equals the squared length of A of h-t minus mu of e-t.

L
L the Phase 2 loss.
‖ · ‖2
the squared length square each of the 8 differences and add them.
A
A the adaptation module. A(h-t) is its estimate, z-hat.
ht
h-t the last 50 state and action pairs.
μ
mu the frozen environment encoder from Phase 1.
et
e-t the true physics. Only the simulator knows it.
In plain words

Feed the history h-t to A to get z-hat. Feed the true e-t to mu to get the target z. Square the 8 differences, add them, and train A to make L small.

With numbers

With made-up numbers on three of the 8 entries: z = (0.5, −0.2, 0.1) and z-hat = (0.4, −0.1, 0.1). L = 0.01 + 0.01 + 0 = 0.02.

Why history reveals the physics. A commanded joint move and the actual move differ in a way that depends on the ground. Mud absorbs a push; ice lets it slide. A learns to read that difference.
TensorShapeWhat it is
e(17,)Privileged physics, simulation only.
z, z-hat(8,)The extrinsics: the only physics the policy sees.
state x(30,)Joint angles, joint speeds, body orientation.
h(50, 42)50 steps of state (30) and action (12).
action(12,)Joint targets for 12 motors.

Why a code and not the friction? z only has to make the policy act right. Two grounds that need the same gait can share one z. This is the MRAC idea from Chapter 3. On the A1 robot, A outputs z-hat at 10 Hz and π runs at 100 Hz on the newest z-hat.

Time the two loops

The ground changes at 0.5 s. Purple ticks are policy steps; pink ticks are module updates. Set the module rate and its window, then read how long z-hat takes to catch up.

50 steps

The 10 Hz and 100 Hz rates and the 50-step window are from RMA. The single code entry, its two values and the noise model are illustrative. Here z-hat is the window's average, plus noise that shrinks with window length.

The failure, as symptom, measurement and fix

The symptom is a jittery z-hat from a noisy IMU. To measure it, add sensor noise in simulation and plot the z-hat error against the gait error. The design itself is the fix: with 8 numbers and a smooth policy, a small z-hat error gives a small gait error. DATT (2023) instead has the student predict e directly.

In RMA's Phase 2, what does the adaptation module output, and from what input?

Chapter 7

Read the Hidden Gain by Hand

Fit one number to three noisy strides, then watch the estimate lock on as steps arrive

A robot commands a stride a and measures the motion y it gets. On this ground, y is a hidden gain e times a, plus sensor noise. Say e = 0.4: each metre commanded moves 0.4 m. The robot logs three steps.

Step iCommand aiMotion yi
11.00.42
22.00.78
33.01.23

Which gain explains these steps best? Least squares picks the estimate ê that makes the sum of squared misses, Σ(yi − êai)2, smallest. Its slope in ê is zero at the best value:

−2 Σ ai(yi − êai) = 0  ⇒  Σ aiyi = ê Σ ai2
Say it aloud

e-hat equals the sum over i of a-i times y-i, divided by the sum over i of a-i squared.

ê
e-hat the estimated ground gain.
Σi
the sum over i one term for each logged step.
ai
a-i the stride commanded at step i, in metres.
yi
y-i the motion measured at step i, in metres.
ai2
a-i squared the command times itself.
In plain words

Multiply each command a-i by its motion y-i and add them. Square each command and add those. Divide the first total by the second. That is e-hat.

With numbers

From the table: the top is 1.0 × 0.42 + 2.0 × 0.78 + 3.0 × 1.23 = 5.67. The bottom is 1 + 4 + 9 = 14. ê = 5.67/14 = 0.405, within about 1% of the true 0.4.

Feed the estimator one stride at a time

Each Step adds one stride. Blue dots are the strides, the pink line is the fit, the warm dashed line is the truth. Raise the noise and watch the estimate wobble.

0.40
0.05 m

Illustrative toy. Commands are 1, 2 and 3 m, then random between 0.5 and 3 m. Noise is Gaussian.

Now act on it. To move 0.8 m, a policy that uses ê = 0.405 commands 0.8/0.405 = 1.98 m and moves 0.79 m. A policy that keeps the nominal gain of 1 commands 0.8 m and moves 0.32 m.

The failure, as symptom, measurement and fix

The symptom is an estimate that jumps when the robot barely moves. To measure it, watch Σai2: small commands carry little information. The fix is to keep the old estimate until enough motion has built up.

The estimate ê = (Σa·y)/(Σa2) recovers the gain from a few noisy strides. Why does this let a robot adapt within a fraction of a second?

Chapter 8

Neural-Fly: a Frozen Basis and a Few Moving Numbers

Freeze a learned set of force shapes, fit three mixing numbers in flight, and see which ones a hover cannot find

A drone in strong gusts feels a force no one can write down. Neural-Fly (O'Connell, Shi and colleagues, Science Robotics, 2022) handles it with the split we keep meeting. It rests on two observations.

Offline, a network learns a basis φ(x): a few functions of the drone's state x. It trains on about 12 minutes of flight in six wind conditions. Its method, DAIML, uses an adversary to push wind information out of φ. The predicted force is φ(x) mixed by a short vector of wind coefficients ĉ: f-hat = φ(x)·ĉ.

In flight the drone measures the actual extra force f: the gap between the acceleration it commanded and the one it got. Call the estimated coefficients ĉ and the step size γ.

Say it aloud

c-hat becomes c-hat plus gamma times, f minus phi of x dot c-hat, times phi of x.

ĉ
c-hat the estimated wind coefficients, here 3 numbers. The only thing that changes in flight.
←
becomes replace the old value with the right side.
γ
gamma the step size of the update.
f
f the extra force the drone measured this step.
φ(x)·ĉ
phi of x dot c-hat the predicted force: each basis value times its coefficient, added up.
φ(x)
phi of x the frozen basis at the drone's state x.
In plain words

Predict the force with the current c-hat. Subtract that from the measured f. Nudge each coefficient by gamma times the miss times its basis value. The basis phi never changes.

With numbers

With made-up numbers: x = 0.5 and φ(x) = (1, 0.5, 0.25). True coefficients (0.6, −0.4, 0.2) give f = 0.45. From ĉ = 0 with γ = 0.25, ĉ becomes (0.113, 0.056, 0.028). The prediction miss drops from 0.45 to 0.30.

Fit the wind in flight

Teal is the tracking error. Pink bars are ĉ; warm ticks are the true coefficients. Fly a hover, then fly a path, and compare the bars.

Illustrative toy with a 3-function basis (1, x, x2). The update is recursive least squares, the update above with a gain per coefficient that shrinks as evidence builds up.

Neural-Fly's real law is composite adaptation: it also feeds in the tracking error, so the coefficients move to cut the miss on the path. The authors prove the closed loop is exponentially stable.

The failure, as symptom, measurement and fix

The symptom is a hover with zero error and wrong coefficients, then a miss on the first new manoeuvre. To measure it, compare ĉ against a fit on a varied flight. The fix is a varied path that excites every basis function.

In Neural-Fly, what is frozen after offline training, and what changes in flight?

Chapter 9

The Adaptive Walking Sandbox

Run the whole loop on changing ground: set how fast the estimate moves and how fast the ground changes

This is the hero with every knob. The policy never changes. Only the belief ê moves, by a fraction α of the gap to each step's measured gain.

Estimate the ground, keep walking

The top strip is the ground and the footprints. Below, warm dashed is the true gain and pink is the belief. Press Run, then change one knob at a time.

0.35
1.0
0.04

Illustrative toy, the hero's model at severity 0.6. Change rate 1.0 means a new ground about every 16 steps.

Work one transition with α = 0.35. The robot walks from firm ground onto ice with gain 0.61. The first ice step misses by 39%, a stumble. The belief moves to 1 + 0.35 × (0.61 − 1) = 0.86. The next step moves 0.61/0.86 = 0.71 m, a 29% miss, under the 30% line.

  1. Find the speed limit. Push the change rate to the top. With grounds a few steps long, the belief never catches up.
  2. Trade speed for calm. Raise the noise, then compare α = 0.15 with α = 0.9. A high α reacts in one step but chases every noisy step.
  3. Freeze it. Switch adaptation off. The belief sits at 1.0, and every ice step stumbles: the offset from Chapter 3, on legs.

The failure, as symptom, measurement and fix

The symptom is stumbles even with adaptation on. To measure it, count stumbles per ground change. One per change is the price of noticing; more means α is too small or the ground changes too fast.

Adaptation is on, the noise is high and α = 1.0. The belief jumps on every step. What is the cause?

Chapter 10

The Field Guide

Keep the terms, the numbers, the core loop in code and the links in one place

Every method here has one shape. Train the expensive part once as a function of the hidden situation. Then estimate the hidden situation online from recent motion, and feed the estimate in.

MethodFrozen partMoving estimate
Running sum (Ch 3)The controller gainê, a scalar wind
MAML (Ch 4)The learned start θOne gradient step
RMA (Ch 6)Base policy πz-hat, 8 numbers at 10 Hz
Neural-Fly (Ch 8)Basis φ(x)ĉ, a few wind coefficients

Terms and numbers

TermOne lineNumber to remember
Dynamics-wises-t+1 drawn from P given s-t, a-t, e-t; e hidden.Same stride: 1.0 m firm, 0.6 m ice
The designa-t = π(s-t, A(h-t)).Window 1, 1, 0.6, 0.6, 0.6: z = 0.76
Running sumê grows by κ s Δt each step.P alone rests at e/2 = 0.3
MAMLθ′ = θ − α times the gradient of L-i.0.8 to 1.0; loss 0.16 to 0.04
DistillationAverage squared gap, student to teacher.Gaps of 0.1: L = 0.01
RMAA(h) regressed onto μ(e).e 17, z 8, h 50 × 42; 10 Hz and 100 Hz
Least squaresê = (Σa y)/(Σa2).5.67/14 = 0.405
Neural-Flyĉ moves by γ times the miss times φ(x).About 12 minutes of training flight

Before you build an adaptive policy

  1. Name what changes. If the goal changes and you know it, condition on it. If the physics changes, estimate it.
  2. Check the history carries the physics: does command versus result differ across grounds in simulation?
  3. Keep the estimate small: a few numbers, so a small error gives a small change in action.
  4. Train as you test: the window and rate in simulation must match the robot.
  5. Excite the system: a robot that barely moves cannot learn much.

The core loop in code

pythonfrom collections import deque
import numpy as np

class AdaptiveWalker:
    def __init__(self, policy, window=50):
        self.policy = policy                  # frozen pi(s, z), trained once in simulation
        self.hist = deque(maxlen=window)     # h: recent (command, motion) pairs

    def adapt(self):                          # A(h): least-squares read-out of the gain
        if len(self.hist) < 3:
            return 1.0                        # nominal until there is evidence
        a, y = np.array(self.hist).T
        return (a @ y) / (a @ a)

    def act(self, s):
        z = self.adapt()                      # only this moves online
        return self.policy(s, z)

    def observe(self, command, motion):
        self.hist.append((command, motion))

Keep going on this site

The takeaway. A robot cannot practise on the ice. Train a policy for every kind of ground, then let a small, fast estimate tell it which ground it is on.

This lesson follows Lecture 23, "Multi-Task, Adaptive and Transferable Robot Learning", of CMU 16-831 Introduction to Robot Learning, Spring 2024, taught by Guanya Shi. The slides are on the lectures page. The papers are RMA (Kumar, Fu, Pathak and Malik, 2021) and Neural-Fly (O'Connell and colleagues, 2022). Background: Learning by Cheating (2019), MAML (2017) and Matching Networks (2016).

Now press Present or Teach. Explain from memory the two kinds of adaptation, the running sum, the teacher and student, RMA's two phases and two rates, and what Neural-Fly freezes. Then go back to the two robots, push the severity up and say why only one lane stays green.

Introduction to Robot Learning · CMU 16-831 · Lecture 23: Multi-Task, Adaptive & Transferable Robot Learning
Next: Foundation Models in Robotics · Back to Gleams