Introduction to Robot Learning · Lecture 23 of 25 · CMU 16-831

Multi-Task, Adaptive & Transferable Robot Learning

A quadruped trained only in simulation must walk on ice, mud, and stairs it never saw — and recover its gait within a single step. How? Train a teacher that can peek at the true physics, then distill it into a student that infers that physics from the last fraction of a second of motion.

Prerequisites: the closed loop & MDP (Lecture 1) + a little Python + linear least squares (we'll re-derive it).
11
Chapters
4
Simulations
3
Code Labs

Chapter 0: A Robot That Has to Walk on Ice It Never Saw

You train a quadruped to walk. Every episode happens inside a physics simulator, on a desktop, overnight. The robot learns a beautiful trot. Then you carry it outside.

The pavement is fine. Then it steps onto a patch of ice — the friction drops to a third of anything it saw in training. A step later it sinks into mud — the ground gives way under each foot. Then it hits a flight of stairs. None of these were in the simulator. A policy that froze its behavior at training time would slip, sink, and topple within one or two steps.

Here is the brutal constraint, and it is the whole reason this lecture exists. The robot cannot stop, run twenty experiments on the ice to "figure out the friction," and then resume. Physics doesn't forgive (Lecture 1): a single wrong step on ice is a fall, and a fall can break the hardware. Adaptation has to happen online, in fractions of a second, from the motion the robot has already produced — with no falls allowed.

The one-sentence goal. We want a single policy that is multi-task (handles many goals), adaptive (handles physics it never trained on), and transferable (trained in sim, works in the real world). This lecture is about the second word — adaptive — and the trick that makes it possible: infer the hidden physics from recent motion, then feed that estimate to a policy that already knows what to do with it.

Two robots on changing terrain — one adapts, one doesn't

Press Run. Both quadrupeds trotted perfectly on the training ground (firm, friction = 1.0). Now the terrain changes underfoot — ice, mud, firm ground — in bands. The teal robot runs an adaptive policy that senses the change and re-tunes its push; the red robot runs the frozen training policy. Slide how hard the terrain deviates from training.

Terrain severity 0.60
Ready.

The frozen policy isn't broken — it is solving the wrong problem. It pushes off the ice as if the ice were the firm training ground, so it slips. The adaptive policy notices "my last few steps moved me less than I expected; the ground must be slippery" and leans harder. That noticing-and-adjusting, done online from recent experience, is the entire subject of the lecture.

The key reframing. Adaptation is not retraining the policy on the ice. There is no time, no gradient steps, and no safe falls to learn from. Instead, the policy is trained once to be a function of the terrain, and a separate fast module estimates the terrain on the fly. The policy stays frozen; only a small estimate moves. Hold that distinction — it is the misconception this whole lecture exists to kill.

Why can't a legged robot simply "collect a few minutes of data on the ice and fine-tune its policy" when it encounters a new terrain?

Chapter 1: Two Kinds of Adaptation

"Adaptation" is a slippery word, so the lecture splits it cleanly in two. Both are about a single policy coping with a situation that wasn't fixed at training time — but they differ in what changes.

Dynamics-wise adaptation — the world changed

The robot's body-plus-environment behaves differently than it did in training. Recall the MDP transition from Lecture 1: the next state is drawn from the world's dynamics given the current state and action. Dynamics-wise adaptation says the dynamics also depend on a hidden environment parameter — wind on a drone, friction under a foot, a payload bolted to a car. In symbols, the transition becomes:

st+1 ∼ P( · | st, at, et )

Here et (the environment parameter) is the thing that was constant in training and is now different — and it might even drift over time (wind gusts). Crucially, et is unknown at test time: the robot has no sensor that reads "friction = 0.3." It must be inferred.

Task-wise adaptation — the goal changed

Here the physics is the same but you ask the robot to do something new. Task-wise adaptation makes the reward depend on a task parameter g — a target location, a trajectory to track, even a language instruction like "get the groceries." The reward becomes r(st, at, g). Unlike the hidden environment, g is usually known (you tell the robot the goal); the challenge is that the specific goal may be unseen in training. This is the world of goal-conditioned RL (the subject of the Multi-Task & Goal-Conditioned RL Gleam).

Dynamics-wiseTask-wise
What changesThe transition / physicsThe reward / goal
Hidden variableEnvironment param e (wind, friction, payload)Task param g (goal, trajectory, language)
Known at test time?No — must infer itUsually yes — you tell it
Policy formπ(s, z), z = estimate of eπ(s, g)
ExampleDrone in a wind tunnel; quadruped on iceOne humanoid policy tracking many motions

The two can co-exist — a humanoid asked to track a new dance (task-wise) while carrying an unknown backpack (dynamics-wise). But because the hard, unforgiving case is the unknown physics, this lecture concentrates on dynamics-wise adaptation: inferring an environment parameter you cannot directly see.

One more option we deliberately skip. You could ignore adaptation entirely and train a single robust policy π(s) that is mediocre-but-survivable across all winds and frictions — that's domain randomization, covered in the Sim2Real lecture. The catch: robustness trades away performance, giving an over-conservative gait. Adaptation aims higher: not "survive any terrain" but "play each terrain near-optimally" by figuring out which terrain it's on.

A delivery drone is asked to fly the same figure-8 it always flies, but today there is a strong, gusting crosswind it never trained on. Which kind of adaptation does it need?

Chapter 2: The Hidden Knob — A Policy Plus an Adaptation Law

Let us make the goal precise, because the rest of the lecture is just different ways to achieve it. We want two objects working together.

Adaptive policy π(s, z)
A control rule that takes the state and a context variable z. Think of z as a knob the policy reads to know "what world am I in?"
↓ but the policy can't read e directly, so we need…
Adaptation law z = A(history)
A fast estimator that infers the context z from recent states and actions — the only thing available online.
↻ together: π(s, A(history)) must act well even though the true e is unknown

Read the two objects carefully, because the split is the whole idea:

Why split it this way instead of one giant network? Because the two pieces face completely different constraints. The policy is a slow, careful, RL-trained object — expensive to learn, never updated in the field. The adaptation law is a tiny, fast inference run every few milliseconds. Separating them lets each be exactly what it needs to be. This split — a frozen policy + a small online estimate — is the architecture you will see in three different disguises (adaptive control, RMA, Neural-Fly) before the lecture ends.

Concept → realization. Picture the data flow at one moment of deployment. In: the last fraction of a second of (state, action) pairs. The adaptation law A maps that history to a small vector z (maybe 8 numbers). That z, plus the current state, goes into the frozen policy π, which emits an action a. The world responds, producing a new state — which becomes the newest entry in the history, closing the loop. Nothing here trains; everything here estimates.

One more contrast worth installing now: zero-shot vs. few-shot adaptation. Zero-shot means the adaptation law needs no labeled data and no reward signal at deployment — it just reads the passive history of what already happened (RMA and Neural-Fly are essentially zero-shot in this sense). Few-shot means the robot is allowed a handful of labeled trials in the new setting before it must perform (classic meta-RL). Zero-shot is the holy grail for hardware, because trials cost falls.

In the "policy + adaptation law" design, which component runs and changes during deployment on a new terrain?

Chapter 3: The Classical Answer — Adaptive Control

Before any neural networks, control theory already solved a version of this problem, and it is the cleanest place to feel what "estimate the hidden parameter online" means. This is the same adaptive-control idea you met in Lecture 12 — we are now reading it as a template for everything that follows.

Take the simplest uncertain system the lecture writes down. A quantity s evolves under our control a plus an unknown constant disturbance e (think: a steady wind, a payload, a calibration error):

ṡ = a + e   (e is unknown)

Our goal is to drive s to zero. The obvious thing is a proportional controller — push back in proportion to how far off you are: a = −2s. Substitute it in and the closed loop becomes ṡ = −2s + e. Where does it settle? At equilibrium ṡ = 0, so 0 = −2s + e, giving:

s → e/2   NOT 0

The proportional controller leaves a permanent steady-state offset — it fights the wind but never fully cancels it, because to hold any nonzero push it needs a nonzero error to push against. The disturbance wins a little, forever.

Put a number on it. Say the unknown wind is e = 0.6. The proportional controller settles at s = e/2 = 0.3 — almost a third of a unit off, permanently. Now watch a discretized integral controller wake up to it. Let the estimate (the running integral) start at 0 and nudge it each step by a small fraction of the current error. Step 1: the cart sits at the offset 0.3, so the estimate climbs to, say, 0.18. With more push, the offset shrinks to 0.21; the estimate climbs to 0.31. Next the offset is 0.14, estimate 0.40. The pattern is unmistakable: the offset marches toward 0 while the estimate marches toward the true wind 0.6. After enough steps the estimate is 0.6 and the cart sits exactly on the mark, the push perfectly cancelling the wind. No one told the controller the wind was 0.6 — it backed that number out of the history of how far off it kept being.

The fix is to accumulate. Add an integral term — the "I" in a PID controller: a = −2s − ∫ s. The integral quietly sums up all the past error. As long as any offset remains, the integral keeps growing, pushing harder, until the offset is gone. The system now converges to exactly 0. The punchline: that running integral of past error is an estimate of the wind. It is the adaptation law A(history-of-s), and it equals exactly the push needed to cancel e.

That is the entire skeleton of adaptive control, and of this whole lecture: a controller that holds an internal estimate of the hidden parameter, updated from the history of what it has observed, and uses that estimate to cancel the disturbance. The lecture names two flavors:

FlavorIdeaDoes the estimate have to be "true"?
MIAC — model-identification adaptive controlRun system identification while the system runs; explicitly try to make the estimate converge to the real parameter.Yes — aims for estimate → true e. More intuitive, but stability is delicate.
MRAC — model-reference adaptive controlSpecify an ideal "reference" closed-loop behavior; adapt until the real system behaves like the reference.No — getting e exactly right is neither necessary nor the point; matching the desired behavior is.

Tuck the MRAC remark away — "the estimate need not be the true parameter, only good enough to produce the right action" — because it is the precise insight that lets RMA replace a physical parameter with an abstract learned code in Chapter 6.

A proportional controller a = −2s on the system ṡ = a + e settles at s = e/2 instead of 0. Adding an integral term ∫s drives it to exactly 0. What role does the integral play?

Chapter 4: Meta-Learning — Learning to Learn Fast

Adaptive control hand-derives the adaptation law from a model. But what if you want the adaptation itself to be learned — learned in such a way that it generalizes to environments you've never seen? That is the promise of meta-learning, and it is the conceptual bridge between classical adaptive control and the learned teacher-student methods that follow.

Ordinary learning fits one set of parameters to one dataset. Meta-learning is "learning to learn": you train across many tasks so that, faced with a brand-new task, you can adapt to it from a tiny amount of data. The guiding principle, from Vinyals et al., is blunt and useful: "test and train conditions must match." If the robot will have to adapt from 5 seconds of experience at deployment, then train it by repeatedly forcing it to adapt from 5 seconds of experience. Practice the exact thing you'll be tested on.

Why pretraining-then-finetuning works at all. The lecture grounds meta-learning in the most successful recipe in deep learning — pretrain a big model, then finetune on your task. It works for one reason: different tasks share a common representation, and the task-specific part lives in a low-dimensional space. Pretraining learns the shared part once; adaptation only has to move the few task-specific knobs. Hold that sentence — it is verbatim the principle Neural-Fly exploits in Chapter 8 (shared aerodynamic basis + low-dimensional wind coefficients).

Two ways to do the inner adaptation

Meta-learning needs an inner loop that turns "a little data from task i" into "the right parameters for task i." The lecture contrasts two styles:

StyleHow it adaptsTrade-off
Black-box adaptationA neural network directly predicts the task-specific parameters from the task's small dataset — a learned function from data to weights.Flexible, but "guessing" weights can be unreliable.
MAML (Model-Agnostic Meta-Learning)Leverages gradient information: the task-specific parameters are one gradient-descent step from a meta-learned initialization. Meta-training finds an initialization that is one step away from good on every task.More principled — uses the same optimizer at test time as it was trained for.

Notice the RMA connection forming already. RMA's adaptation module is exactly a black-box adaptation: a network that maps recent history (the "small dataset" of this episode) directly to the extrinsics (the "task-specific parameters"). Meta-learning is the lens that explains why training such a module in simulation should generalize to real terrain.

Meta-learning meets RL and models

When the "tasks" become full MDPs — each with its own dynamics — meta-learning becomes meta-RL: the inner adaptation is now an RL update, and you meta-train a policy that can adapt quickly to a new MDP. The lecture flags a particularly clean variant, model-based meta-RL: apply meta-learning to the learned dynamics model rather than the policy. You learn a representation of the dynamics that adapts fast, then plan or control on top of it — which is precisely the recipe behind the drone work that became Neural-Fly (learn a dynamics representation, adapt it online, control with it).

The throughline. Adaptive control (Ch 3) gives you the shape of the answer: a policy plus an online estimate. Meta-learning (here) tells you how to learn that estimate so it generalizes: practice adapting across many tasks, share a representation, keep the task-specific part small. Teacher-student and RMA (next) are the concrete, robot-grade instantiation of exactly this principle.

What is the core principle of meta-learning, in the lecture's framing?

Chapter 5: The Privileged Teacher — Learning from Someone Who Can Cheat

Adaptive control is beautiful when you can write the equations. But a quadruped on natural terrain has contact, deformable mud, slipping feet — physics you cannot model cleanly (Lecture 1's "modeling the world is hard"). So we replace the hand-derived adaptation law with a learned one. The trick that makes learning tractable is teacher-student training, also called privileged learning.

The idea sounds almost like cheating, and that's the point. Inside the simulator, you know everything — the exact friction of every patch, the payload mass, the motor strength, the terrain height. In the real world you know none of it. Teacher-student exploits this asymmetry in two stages.

Stage 1 · Train the teacher (in sim)
Give the policy the ground-truth environment parameter e directly: π(x, e). With perfect knowledge of the physics, it learns a near-optimal skill fast. The teacher can peek at the true physics.
↓ but the teacher can't be deployed — the real robot has no sensor that reads e
Stage 2 · Distill into a student (in sim)
Train a student πs(x, z) where z = A(available real-world info). The student must reproduce the teacher's behavior using only what a real robot can sense — onboard, no privileged peek.
↓ the student matches the teacher's outputs via supervised regression
Deploy the student (in the real world)
πs(x, zt) runs onboard. zt is computed from real sensor history. The teacher is thrown away — it was scaffolding.

The canonical example the lecture cites for driving is "Learning by Cheating". Stage 1 trains a privileged agent that sees the ground-truth state — the exact positions and velocities of every other car, the true traffic-light state. With that god's-eye view it learns to drive well. Stage 2 then trains a sensorimotor student that only sees the camera, supervised to copy the privileged agent's decisions.

Teacher → student distillation — the data flow

Click the stages. Watch what each policy is allowed to see (its inputs) and notice that the student is trained to match the teacher's action using only onboard signals. The privileged channel (the dashed peek at true physics) exists in sim and is cut at deployment.

Click a stage above.

For locomotion the lecture is specific about what goes in each channel. The teacher's privileged information is "almost everything available in sim" — contact states, terrain geometry, friction, applied disturbances. The student is restricted to proprioceptive history only: the IMU and joint-angle readings the real A1 robot actually has. And the teacher here is trained with RL (PPO), not imitation — there is no human expert for a quadruped gait.

Why distill instead of just training the student directly with RL? Because RL on partial observations (proprioception only) is brutally hard — the reward is sparse, the credit assignment is long, and the robot would fall a million times. The teacher, with full state, learns the skill easily. Distillation turns a hard RL problem into an easy supervised problem: "given history, output what the all-knowing teacher would do." That's the engineering payoff.

Let's actually distill. The lab below has a privileged teacher whose action is a clean function of the true environment parameter the student can't see. Your job is the student: fit a regression from the observable history to the teacher's action, then prove the student matches the teacher without ever reading the privileged parameter.

In teacher-student training for locomotion, what is the teacher allowed to see that the deployed student is not?

Chapter 6: RMA — Rapid Motor Adaptation

RMA (Kumar, Fu, Pathak & Malik, 2021) is the cleanest instance of the whole pattern, and it is what lets that quadruped from Chapter 0 walk on sand, mud, and stairs it never saw, adapting in fractions of a second. It is teacher-student with one crucial twist: the student does its matching in latent space, not action space.

RMA has exactly two pieces, and they are trained in two phases.

Phase 1 — the base policy & the environment encoder (the teacher)

In simulation, take the privileged environment parameters et (mass, center of mass, friction, terrain height, motor strength) and pass them through an environment-factor encoder μ that squashes them into a small latent vector:

zt = μ(et)   (the "extrinsics")

This zt, the extrinsics, is fed alongside the current state xt and previous action at−1 into the base policy π, which outputs the joint targets at. The encoder μ and the policy π are trained together with model-free RL (PPO). After Phase 1 you have a policy that walks beautifully — if you hand it the true extrinsics. You can't, in the real world. That's Phase 2's job.

Phase 2 — the adaptation module (the student)

Now freeze the base policy. Train an adaptation module φ that estimates the extrinsics without ever seeing e — using only the recent history of states and actions:

t = φ( xt−k, at−k−1, …, xt, at−1 )

φ is trained by plain supervised regression in simulation: minimize the gap between its estimate ẑt and the true latent zt the encoder produced. Both quantities are available in sim, so this is just a fitting problem — no falls, no RL.

The central insight (read this twice). When you command a joint movement, the actual movement differs from the commanded one in a way that depends on the environment — soft mud absorbs your push differently than ice. So the recent history of (command, resulting motion) secretly encodes the physics. RMA's adaptation module learns to read that signature, exactly like a Kalman filter estimates hidden state from a history of observations (Lecture 12). It is online system identification — but instead of solving an optimization in the field, a network that learned the problem→solution mapping in sim just outputs the answer.

Why estimate the extrinsics instead of the raw friction?

This is where MRAC's remark from Chapter 3 pays off. RMA does not try to recover the true friction or mass. It targets the encoder's latent z — a low-dimensional code whose only job is to make the policy act correctly. Several different physical situations that act the same can map to the same z (identifiability is no longer a worry), and the whole thing is optimized end-to-end for good actions, not for "true" numbers. We don't need a correct system ID; we need the right behavior.

Concept → realization — the deployment data flow. On the real A1 robot the two modules run asynchronously. The adaptation module φ reads the last ~50 steps of proprioception and outputs ẑt at 10 Hz. The base policy π reads the current state and the most recent ẑt and outputs joint targets at 100 Hz. The slow estimate feeds the fast controller. There is no central clock; the policy just grabs the latest extrinsics available. This split — slow estimator, fast frozen policy — is the literal embodiment of Chapter 2's design, and it is why adaptation costs <1 second instead of the 4–8 minutes earlier methods needed.

The tensor shapes, concretely

To make "data flow" more than a slogan, here are the actual shapes that move through RMA, so you could implement it. The numbers are illustrative of the A1 setup.

Phase 1 input: et
Privileged env vector, ~17 numbers (masses, friction, motor strength, terrain). Shape (17,).
↓ encoder μ (a small MLP) compresses
Latent extrinsics zt
Shape (8,). This is the bottleneck — the policy only ever sees these 8 numbers, never the raw 17.
↓ concatenate with state xt (~30 numbers) and previous action
Base policy π
Input (state ⊕ prev-action ⊕ z), output joint targets, shape (12,). Trained with PPO (e.g. 1.5B sim steps).

Phase 2 changes only the source of z. Instead of e → μ → z, the adaptation module φ takes a sliding window of the last ~50 (state, action) pairs — a tensor of shape (50, ~42) — runs it through a 1-D convolution over time, and outputs ẑ of shape (8,). The training target is the Phase-1 latent z; the loss is just the squared distance between ẑ and z. Same 8-number interface, different input. That is why you can swap φ in for μ at deployment without touching the frozen policy: they produce the identical-shaped z, and the policy never knows the difference.

What happens when the input degrades? If the proprioceptive history is corrupted — a noisy IMU, a slipped encoder — φ produces a worse ẑ, and the policy acts as if it were in a slightly wrong environment. Because z is low-dimensional and the policy was trained to be smooth over z, a small error in ẑ produces only a small degradation in gait, not a catastrophic one. That graceful falloff is a direct dividend of the bottleneck: 8 numbers can't encode enough to make the policy do something wild. The MRAC philosophy — good-enough estimate, right action — buys robustness here.

A variant the lecture flags: the student doesn't have to predict a latent. In DATT (Deep Adaptive Trajectory Tracking, 2023) the student predicts the unknown dynamics parameter e directly. RMA's choice (predict the latent z) and DATT's choice (predict e) are two points on the same spectrum — what matters is that a fast module estimates something from history that lets the frozen policy act right.

In RMA's two phases, what is the adaptation module φ trained to output, and using what input?

Chapter 7: Estimate the Hidden Knob — By Hand and in Code

The phrase "infer the physics from recent motion" can sound mystical. It isn't. Let's do it with numbers on the simplest possible example, then code it, so you trust the mechanism completely.

A worked example: inferring a hidden friction from three steps

A robot pushes its foot with a known command and watches how far it actually slides. The true relationship is: distance slid = command × (1 − friction). On firm ground (friction near 0) a push of 1.0 slides nearly 1.0; on ice (friction near 0) — wait, that's backwards on purpose. Let's instead model the cleaner, RMA-flavored relation the lecture uses: the actual motion is the commanded motion scaled by a hidden environment gain e, plus a little sensor noise. The robot does not know e; it must infer it.

Say the true hidden gain is e = 0.4 (a slippery world: each unit of command produces only 0.4 units of motion). The robot logs three recent steps:

StepCommand aObserved motion y (= 0.4·a + noise)
11.00.42
22.00.78
33.01.23

How do we get the single best estimate of e from these three (command, motion) pairs? This is least squares: find the ê that minimizes the sum of squared prediction errors ∑(y − e·a)². For a single scale factor, calculus gives a clean closed form — the estimate is the dot product of commands-and-motions divided by the dot product of commands-with-themselves:

ê = ( ∑ ai yi ) / ( ∑ ai² )

Plug in our three steps. The numerator is (1.0)(0.42) + (2.0)(0.78) + (3.0)(1.23) = 0.42 + 1.56 + 3.69 = 5.67. The denominator is 1² + 2² + 3² = 1 + 4 + 9 = 14. So:

ê = 5.67 / 14 ≈ 0.405

From three noisy observations of its own motion, the robot recovered the hidden gain (true value 0.4) to within 1%. That is the adaptation module, stripped to its mathematical core: a least-squares read-out of the hidden physics from the recent history of what the robot did and what happened. A policy that now uses ê = 0.405 instead of assuming the nominal e = 1.0 will scale its commands correctly and stop slipping.

Watch an estimate converge to the hidden truth

The dashed line is the unknown true gain e. Press Step to feed the estimator one more (command, motion) observation; the warm dot is its running least-squares estimate. Watch it lock onto the truth within a handful of steps — that's "fractions of a second" of motion. Slide the sensor noise up and see the estimate get jittery but stay centered.

Hidden gain e 0.40
Sensor noise 0.06
Press Step to feed an observation.

Now make it real. The lab below builds the adaptation module as exactly this least-squares read-out, then proves that a policy using the estimate tracks a target far better than one that stubbornly assumes the nominal physics.

The least-squares estimate ê = (∑ a·y)/(∑ a²) recovered the hidden gain from a handful of noisy (command, motion) pairs. Why does this let a robot adapt "in fractions of a second"?

Chapter 8: Neural-Fly — Adapting a Learned Aerodynamic Basis

RMA estimates a latent code for a frozen policy. Neural-Fly (O'Connell, Shi et al., Science Robotics 2022) shows the same skeleton in a different and gorgeous form: it adapts the force model of a drone flying agile maneuvers through strong, gusting wind — achieving centimeter-level tracking where conventional controllers drift.

The problem: the aerodynamic force on a quadrotor in wind is a nasty unmodeled residual — turbulent, nonlinear, wind-dependent. You cannot write its equation. But Neural-Fly makes two observations that crack it open, and they are exactly the pretraining-plus-finetuning insight from the lecture's deep-learning detour:

Offline: learn the basis once

Neural-Fly trains a neural network — using only ~12 minutes of flight data across 6 wind conditions — to be a wind-invariant basis. Call its output φ(x): a small set of basis functions of the drone's state x. The training algorithm (DAIML) uses a discriminator to force φ to be wind-independent, so that all the wind-specific information is pushed out into a separate set of coefficients. The residual aerodynamic force is then modeled as the basis mixed by linear coefficients:

f̂ = φ(x) · a

Here φ(x) is the frozen, wind-invariant basis (the shared representation) and a is a short vector of wind-specific linear coefficients — the low-dimensional "knob." This is the same frozen-thing-plus-small-online-estimate split as RMA, just rearranged: the basis is frozen, the coefficients adapt.

Online: update the coefficients with least squares

In flight, the drone observes the actual residual force it experiences (the gap between commanded and measured acceleration). It then updates the coefficients a online — a composite adaptation law that is, at heart, a recursive least-squares fit of a to make φ(x)·a match the observed residual force. The basis never changes; only these few coefficients chase the wind. Because the basis is concise and fixed, the fit is fast and stable — fast enough to track a wind that is itself changing.

Why "composite"? The lecture's adaptation law blends two error signals into the coefficient update, and it pays to see why each matters:

Blending them is what makes the proof of exponential stability go through — the closed loop is provably well-behaved, which is why Neural-Fly can be trusted on hardware flying through narrow gates in a wind tunnel. Compare the magnitudes the lecture reports: against a strong nonlinear baseline controller, Neural-Fly cut tracking error by about two-thirds. The expressive part (the deep basis, ~hundreds of thousands of weights) was learned once from 12 minutes of flight; online, only a handful of coefficients move. That ratio — enormous frozen model, tiny fast estimate — is the entire economy of the method.

Misconception: "the network is learning online." It is not. The neural network — the basis φ — is frozen the instant flight begins and never receives a gradient again. The only thing "learning" in the air is the short coefficient vector, via least squares. People hear "deep-learning-based adaptive flight" and picture backprop running on the drone; the reality is a frozen net plus a tiny online linear fit. That is exactly what makes it fast enough and safe enough to fly.

The unifying picture across three methods. Adaptive control (Ch 3): integral term estimates a scalar disturbance. RMA (Ch 6): adaptation module estimates a latent extrinsics for a frozen policy. Neural-Fly (Ch 8): least-squares estimates linear coefficients for a frozen aerodynamic basis. All three freeze the expensive, expressive part and adapt a small, fast estimate online. Once you see the pattern you see it everywhere — it is the answer to "how do you adapt without retraining?"

Build it. The lab below gives you a frozen learned basis and a true (unknown) wind that creates a residual force. Your job is the online coefficient update that makes the predicted residual cancel the real one — and you'll watch the tracking error fall as the coefficients lock on.

In Neural-Fly, what is frozen after offline training and what is updated online during flight?

Chapter 9: Showcase — The Adaptive-Locomotion Sandbox

Time to put RMA's whole loop in one place. A quadruped trots across terrain whose hidden gain changes in bands. You control how severe the terrain gets, how fast the adaptation module estimates, and whether adaptation is on at all — and you watch the estimated gain chase the truth while the robot stays upright.

Adaptive locomotion sandbox — estimate the terrain, keep walking

Press Run. The top strip shows the robot crossing colored terrain bands (each a different hidden gain). The bottom plot tracks the true gain (dashed) vs the adaptation module's estimate. Turn adaptation off to watch the estimate freeze at the nominal value and the robot's slip-error climb; turn it on and watch the estimate chase every band.

Adaptation rate0.35
Terrain change rate1.00
Ready.

The most instructive combination: crank the terrain change rate to max with adaptation off — the robot's slip-error spikes on every new band because it keeps pushing as if the ground were firm. Then flip adaptation on: the estimate jumps to each new gain within a few steps and the slip-error collapses. That switch — from a frozen policy fighting an invisible world to an adaptive one that reads the world from its own motion — is the difference between a robot that works in the lab and one that works on a hiking trail.

Three experiments to try

Misconception check. Notice the policy itself is never modified in this sandbox — the only thing moving is the gain estimate fed into it. If you raise the adaptation rate too high, the estimate gets twitchy and over-reacts to noise (this is why RMA runs the module at a measured 10 Hz, not 100 Hz). Adaptation is a tuning of estimation speed, not a tuning of the policy. Frozen policy, moving estimate — the lecture's whole thesis, made visible.

Chapter 10: Connections, Cheat Sheet & Where Next

You now own the spine of adaptive robot learning. Every method in this lecture is a different costume on one idea: train an expressive thing once that is a function of the hidden situation, then estimate the hidden situation online from recent experience. Here's how the pieces hang together.

The setting
Dynamics-wise adaptation: the transition depends on a hidden, time-varying environment parameter e you can't sense at test time.
↓ the design
The design
A policy π(s, z) + an adaptation law z = A(history). The policy is frozen; only z moves online.
↓ four realizations
Adaptive control
Integral term estimates a scalar disturbance and cancels it. Hand-derived; needs a model.
↓ learn the adaptation law instead of deriving it
Meta-learning
Learn to learn: practice adapting across many tasks; share a representation, keep the task-specific part low-dimensional. The lens that explains why a learned adaptation module generalizes.
↓ instantiate it on a robot with a privileged teacher
Teacher-student / RMA
Privileged teacher in sim → student adaptation module estimates a latent extrinsics from proprioceptive history. Adapts in <1s.
↓ adapt the force model instead of the policy
Neural-Fly
Frozen learned aerodynamic basis φ(x); online least-squares on low-dim wind coefficients a. Centimeter tracking in wind.
Cheat sheet — the vocabulary you now own.
  • Two adaptations = dynamics-wise (hidden physics e, unknown at test) vs task-wise (goal g, usually known).
  • The design = adaptive policy π(s, z) + adaptation law z = A(history); freeze the policy, move the estimate.
  • Adaptive control = an integral term is an online estimate of a disturbance (MRAC: the estimate need only yield good actions, not the true value).
  • Meta-learning = learn to learn across many tasks; test and train adaptation conditions must match; shared representation + low-dim task part. MAML = adaptation is one gradient step from a meta-learned init; black-box = a net predicts the task parameters (RMA's module is exactly this).
  • Teacher-student = privileged teacher (sees true physics in sim) distilled into a student (onboard sensors only).
  • RMA = Phase 1 trains base policy + extrinsics encoder via RL with privileged e; Phase 2 trains an adaptation module to regress the latent extrinsics from state-action history; runs async (policy 100 Hz, module 10 Hz).
  • Extrinsics, not friction = estimate a latent code optimized for good actions, not the literal physical parameter.
  • Neural-Fly = frozen wind-invariant basis φ(x); online least-squares on linear coefficients a so φ(x)·a cancels the wind residual.
  • Adaptation ≠ retraining = no gradient steps in the field; a fast read-out from recent motion, fed to a frozen policy.

This closes a loop the series opened in Lecture 1: that robot learning requires online adaptation because the physical world changes and physics doesn't forgive. It also extends the adaptive control from Lecture 12 — the integral term you met there is the simplest adaptation law in the family RMA and Neural-Fly generalize with learning.

Where to go next on this site

The test of this lesson. Open the original Lecture 23 slides. You should be able to explain, from memory: the two kinds of adaptation; why a proportional controller leaves an offset and an integral term fixes it; the teacher-student two-stage recipe and what each sees; RMA's two phases and its async deployment; why it estimates a latent rather than the raw friction; and how Neural-Fly freezes a basis and adapts only the coefficients. If you can, you're ready for Lecture 24.

"The robot cannot run experiments on the ice. It must read the ice from the way it is already moving."