Robot Learning: An Overview

One robot, one wind it was never told about, three ways to learn. In a wind of 0.4, the copied policy stops 0.20 short of each goal. The trial and error policy stops 0.07 short. The policy with a learned model lands on it.

Drag the wind up and switch between the three learners. Watch who still reaches the goals. Then we build each part of this bench from zero: the loop, the reward, the policy, the ladder of methods, the world model and the hierarchy.

You need what a probability is and a little Python. We build the rest from zero.

Lecture 2 of 25 in Introduction to Robot Learning (CMU 16-831), taught by Guanya Shi. Every idea is re-taught here in our own words and devices. It follows Lecture 1, What Is Robot Learning? Next: Lecture 3, an ML and deep learning refresher.

Climb the ladder against the wind

0.40

Illustrative toy. A point robot accelerates toward each goal while a steady wind pushes it right. Copy is a cautious controller cloned from calm-day demos (gain 2). React learned by trial in the wind (gain 6). Model estimates the wind from its own motion and cancels it. A goal counts when the robot stays within 0.05 of it for 1 s. All three learners run at once; the bars count goals reached since the wind was last set.

Chapter 0

A Brain Exists to Move

Meet the animal that eats its own brain, and see why the skills we find easy are the hardest ones for a robot

The sea squirt is a small sea animal. As a larva it swims, with a simple eye, a tail and a tiny nervous system. When it finds a good rock, it glues its head down and never moves again. Then it digests most of its own brain.

The neuroscientist Daniel Wolpert tells this story to make one claim:

"We have a brain for one reason and one reason only, and that's to produce adaptable and complex movements."

Once the sea squirt stops moving, it has no use for a brain. So a brain is a controller: a system that turns what it senses into action, again and again, in a world that pushes back. Robot learning builds that controller for a machine.

The easy things are hard

Which is harder for a machine: chess, or lifting a strange spoon from a strange table? In 1988 Hans Moravec wrote that it is easy to make a computer play checkers like an adult. It is hard or impossible to give it the perception and mobility of a one-year-old. This is Moravec's paradox: what is hard for people is easy for machines, and what is easy for people is hard for machines.

Line up four skills by age

Each dot is a skill, placed by how long evolution or culture has had to tune it. Pick a skill and read when machines caught up with people.

Ages are rough orders of magnitude, not dates. Animal nervous systems: about 600 million years. Eyes: about 500 million. Spoken language: perhaps 100,000 years. Chess: about 1,500. Machine milestones: Deep Blue beat the world chess champion in 1997; language models write fluent text in the 2020s; open-world dexterous movement is not solved.

The oldest skills sit at the left, and they are the ones machines still fail. A skill you do without thought hides hundreds of millions of years of tuning.

The failure: blame the motors

The symptom is a robot that fumbles a kitchen task. The tempting cause is weak hardware. The measurement is to let a person drive the same robot by remote control.

The lecture's example is Mobile ALOHA: about $32,000 and 16 degrees of freedom. Driven by a person, it does delicate kitchen work. Driven by its own policy, it fumbles. So the motors are fine. The fix is the algorithm that closes the loop from sensing to action, which is what this course teaches.

The road

  1. The loop: the agent and the world take turns.
  2. Reward and return: one number per step, summed with a discount.
  3. The policy: a function from state to action, with real shapes.
  4. The ladder: imitation, model-free, model-based, offline (the hero's three learners).
  5. Known or learned world: a model of the dynamics, and planning inside it.
  6. Hierarchy: plans on top, skills below.
  7. The frontier: what works today and where robots still fail.
  8. The bench: the hero, opened up, with the arithmetic of the miss.
  9. The field guide: the course map, numbers, terms, code and links.
A robot does a kitchen task well when a person drives it, and fumbles when its own policy drives it. What does this tell you?

Chapter 1

The Agent and the World Take Turns

Step through the loop that every method in the course runs, and find the arrow that makes it hard

A small robot cart sits on a track. A charging pad is three cells to its right. Each tick, the cart reads its position, picks a move, and the world answers. That is the whole picture, and Sutton and Barto put it in two boxes and two arrows.

The agent is the decision maker: the thing we build. The environment is everything else: the track, gravity, a person who kicks the cart. They take turns:

  1. The agent observes the state st: what it knows of the world at tick t (here, its cell).
  2. It picks an action at: a motor command (here, left, stay or right).
  3. The environment returns a reward rt, one number that scores the move, and the next state st+1.
  4. The agent observes st+1, and the loop repeats.

Step the loop

Press Step to run one turn of the loop. Press Kick to let the environment shove the cart, and watch the next action change.

Illustrative toy. The policy moves toward the pad. Reward is +1 on the pad and 0 elsewhere. A kick moves the cart two cells left.

Look at the kick. The agent never sees the future. It sees only where it is now, and it must answer that. The arrow that makes robot learning hard runs from the action back into the environment: your action decides the next state you must deal with. That makes it a control problem, not a prediction problem.

The failure: a model that only watched

The symptom: a policy trained on logged drives scores well on the log and drifts off the road on the robot. The measurement: record the states the robot visits and compare them with the states in the log. The robot's own small errors take it to states the log never shows. The fix is to collect data under the robot's own policy, which Lecture 6 does with a method called DAgger.

Why is the agent and environment loop a control problem and not only a prediction problem?

Chapter 2

One Number Per Step, Summed With a Discount

State the reward hypothesis, add up a return by hand, and watch a far-off fall shrink

A walking robot earns +1 for every step it stays upright and −10 when it falls. What is it trying to do? Sutton and Barto answer with the reward hypothesis: you can write every goal as one aim. Make the expected sum of one scalar reward as large as possible over time.

"Walk without falling" and "stack the blocks" each become one number per step. The agent does not chase the reward of this step. It chases the return: the sum of all future rewards, with later rewards counted a little less. A reward that comes later is worth less now, as a dollar next year is worth less than a dollar today.

Call the reward at step t rt. Call the shrink factor for one step of delay the discount, γ, a number between 0 and 1. Call the return G.

Say it aloud

G equals the sum over t of gamma to the t, times r-t.

G
G the return: what the whole episode is worth from step 0.
Σt
the sum over t add one term for each step, from step 0 to the last step.
γt
gamma to the t the discount multiplied by itself t times. With gamma 0.97, a reward 8 steps away counts 0.78.
rt
r-t the reward at step t: +1 upright, −10 for the fall.
In plain words

Shrink each reward r-t by gamma once for every step you wait for it. Add the shrunk rewards. The total is G.

With numbers

The robot is upright for steps 0 to 7 and falls at step 8. With gamma 0.97, the eight +1 rewards add to 7.21. The fall counts −10 × 0.978 = −7.84. G = 7.21 − 7.84 = −0.63. With no discount, G is 8 − 10 = −2.

Shrink a far-off fall

Outlined bars are the raw rewards. Filled bars are what each one counts after the discount. The line is the running return. Move gamma and the step of the fall.

0.97
8

Illustrative toy: +1 for each upright step, −10 at the fall, then the episode ends.

Lower gamma and the return turns positive. For this stream the sign flips at gamma 0.953. A short-sighted agent stops fearing a fall that is far away. Pay now or suffer later: that trade is the drama of every sequential decision.

The failure: the robot that stands still

The symptom: you pay +1 per upright step, and the robot learns to stand still forever. Standing never falls, so it collects every +1. The measurement: watch the rollouts, not only the return. The fix: reward what you want, such as forward progress per step.

Rewards are 1, 0 and 2 at steps 0, 1 and 2, and gamma is 0.5. What is the return G?

Chapter 3

A Policy Turns a State Into an Action

Trace the shapes from a camera image to one steering number, and fit the simplest policy from three demos

A car drives with a forward camera. Every tick, something must turn the picture into a steering angle. That something is the policy: the function the agent uses to pick an action from a state.

Call the state at tick t st and the action at. Call the policy π (pi). A neural network policy has weights θ (theta): the numbers training changes.

Say it aloud

a-t equals pi-theta of s-t.

at
a-t the action at tick t: one steering number for a car, about 7 joint speeds for an arm.
πθ
pi-theta the policy with weights theta. Training changes theta; the shape of the function stays.
st
s-t the state at tick t: here a camera image.
In plain words

Give the policy pi-theta the current state s-t. It returns the action a-t. Run it again next tick on the new state.

With numbers

A 224 × 224 colour image is 224 × 224 × 3 = 150,528 numbers. The policy maps those 150,528 numbers in to 1 number out, such as a steer of −0.3.

Read the shapes: (224, 224, 3) → (1,). Most pixels are sky and road. The policy must find the few that decide the steer, such as the lane lines. A humanoid adds the reverse problem: dozens of joints out, so the space of action sequences explodes.

Squeeze 64 pixels into one steer

The grid is a toy camera frame with a lane. Drag the car's offset from the lane centre. The lane pixels shift, and the policy turns that shift into one steering number.

0.40

Illustrative toy. The policy weighs each pixel column by its distance from the centre, finds the lane's centre, and steers against the offset with gain 0.8.

The simplest policy: a line, fitted to demos

Drop the network. Let the state be the car's offset s, and let the policy be a line with slope w and intercept b. An expert gives N demos: pairs of a state si and the expert's action ai. Pick the line with the smallest loss L.

Say it aloud

L equals one over N, times the sum over i of pi-theta of s-i minus a-i, squared.

L
L the loss: how far the policy is from the expert, on average.
1/N
one over N divide by the number of demos, N = 3 here, to get an average.
Σi
the sum over i one term per demo.
πθ(si)
pi-theta of s-i what the policy does in demo i's state; here w × s-i + b.
ai
a-i what the expert did in that state.
In plain words

For each demo, run the policy on s-i and subtract the expert's a-i. Square the gap. Average the squares over the N demos. Training picks the theta that makes L smallest.

With numbers

With made-up demos: offsets −1, 0, 1 and expert steers 0.9, 0.2, −0.8. The best line has w = −0.85 and b = 0.1, so it predicts 0.95, 0.1, −0.75. Gaps 0.05, −0.1, 0.05 give L = (0.0025 + 0.01 + 0.0025)/3 = 0.005. A policy that always outputs 0 scores L = 0.50.

Copying an expert this way is imitation learning in its simplest form. Fit it yourself:

The failure: a policy that keys on the kerb colour, not the lane. It steers well on the training road and badly on a new one. Measure it on held-out roads; fix it with more varied demos.

What makes "camera image in, steering angle out" a hard function to learn?

Chapter 4

The Ladder: Where the Answer Comes From

Climb four methods, from copying an expert to mining an old log, and watch each one move the same policy

A robot stands at a fork. Right leads to the charger, left to a wall. Its policy gives each move a probability, and at first both are 0.5. How does the right answer get into the policy? The lecture's four methods give four answers. They form a ladder: each rung gets less help.

RungIt is givenIt learns by
1. Imitationexpert demos: states with the expert's actionscopying: fit the action to the state
2. Model-free RLa reward, and the right to try thingstrial and error: make good moves likely
3. Model-based RLa reward, and data to learn the dynamicslearning a world model, then planning in it
4. Offline RLa fixed log of past runs, of any qualitymining the log, with no new tries

Model-free RL builds no model of the world. The lecture sums up its basic method, REINFORCE, in one line: make good stuff more likely and bad stuff less likely. Here is that line as an update. Call the policy's weights θ and the step size α (alpha). Call the return of one try G, and the probability the policy gave the action it took πθ(a | s).

Say it aloud

Theta becomes theta plus alpha, times G, times the gradient with respect to theta of log pi-theta of a given s.

θ ←
theta becomes replace the weights with the new value on the right.
θ
theta the weights now. Here two preferences, one for left and one for right.
α
alpha the step size: how far one try moves the weights. Here 0.5.
G
G the return of this try: 1 if it reached the charger, 0 if not.
∇θ
the gradient with respect to theta the direction in weight space that raises what follows fastest.
log πθ(a | s)
log pi-theta of a given s the log of the probability the policy gave action a in state s.
In plain words

Find the direction that makes the action you took more likely. Step the weights theta that way by alpha times G. A big return G means a big step; a return of 0 means no step.

With numbers

Both preferences start at 0, so p(right) = 0.5. The robot tries right and gets G = 1. For two actions, the gradient is 1 − 0.5 = 0.5 on the right preference and −0.5 on the left. With alpha 0.5 they become +0.25 and −0.25. Now p(right) = 1/(1 + e−0.5) = 0.62.

Train one policy four ways

Pick a rung, then press Train a few times. The bars are the policy at the fork. The counters show what the rung spent: real tries on the robot and expert demos.

Illustrative toy. Imitation reads 5 demos per round from an expert who goes right 90% of the time. Model-free makes one real try per round and applies the update above. Model-based makes 2 real tries to learn what each move does, then trains on 10 imagined tries per round. Offline reweights a fixed log of 20 old runs (8 went right) by their returns.

Read the counters. Imitation stops at 0.9, the expert's own habit. Model-free climbs past it, but pays one real try per round. Model-based climbs fast after 2 real tries. Offline climbs with no tries at all, because its log holds some good runs.

The failure of offline RL: a log that never goes right. Then no reweighting can find the charger. Measure the log's coverage before you train. The fix is better data, which no algorithm replaces.

The question behind the ladder. Where does the supervision come from? Imitation borrows a person's answers. Model-free finds them by trial. Model-based imagines them in a learned simulator. Offline mines them from a frozen log.
What separates offline RL from imitation learning?

Chapter 5

Known World, Learned World

Give the robot a model of what its actions do, plan inside it, and see how a wrong model plans toward disaster

Before you step off a kerb, you picture the step in your head. A robot can do the same with a dynamics model, also called a world model. It is a function that says which state follows a state and an action.

Call the state at tick t st, the action at, and the model f.

Say it aloud

s-t-plus-one equals f of s-t and a-t.

st+1
s-t-plus-one the state one tick later.
f
f the dynamics model: written from physics, or fitted to data the robot collects.
st
s-t the state now: for a cart, its position and speed.
at
a-t the action now: the push.
In plain words

Hand the model f the state s-t and the action a-t. It returns the next state. Call it again on its own answer to imagine a whole future without moving the robot.

With numbers

With made-up numbers: a cart is at 2.0 m and moves at 0.5 m/s. It gets a push of 1 m/s² for 0.1 s. f gives position 2.0 + 0.5 × 0.1 = 2.05 m and speed 0.5 + 1 × 0.1 = 0.6 m/s.

The model isWhere f comes fromThen you use
Knownphysics: mass, friction, geometryclassical control: LQR, MPC, trajectory optimization
Learnedfitted to data from the robotmodel-based RL: plan inside the learned f
Nonenot built at allmodel-free RL: trial and error

A known model flew Apollo to the Moon. But contact, cloth and dough have no clean equations, so there the robot must learn f or skip it. A learned model turns a few real moves into many imagined ones.

Planning in a corridor shows how. Call the worth of cell c its value V(c), the cost of one move r, and the discount γ. The model says moving right from c lands in c+1.

Say it aloud

V of c equals r, plus gamma times V of c-plus-one.

V(c)
V of c the value of cell c: the return you expect if you start there.
r
r the reward for one move: −0.1, a small cost.
γ
gamma the discount, 0.95.
V(c+1)
V of c-plus-one the value of the cell the model says you land in.
In plain words

Ask the model where a move takes you. Take that cell's value V(c+1), shrink it by gamma, and add the move's reward r. That is V(c). Sweep from the goal back to the start.

With numbers

The goal, cell 11, is worth 5. V(10) = −0.1 + 0.95 × 5 = 4.65. V(9) = −0.1 + 0.95 × 4.65 = 4.32. Keep sweeping and V(0) = 1.98: the start is worth going from.

This update is the Bellman backup. Repeat it until nothing changes and you have value iteration.

Turn a few moves into a whole map

The robot walks right from cell 0 for a few real moves. Purple bars are what a model-free learner knows. Pink bars are what the model-based learner computes. Then break the model.

4

Illustrative toy, the same numbers as the Code Lab: 12 cells, goal worth 5 at cell 11, −0.1 per move, gamma 0.95. Both learners know the reward. Only the model-based one turns its moves into the rule "right goes one cell".

The failure: one slip on cell 7 teaches the model a wall that is not there. Every cell left of 7 then values to −2, and the planner stops trying. Measure the model's predictions on fresh real moves. Fix it with more data, and trust it only where it has data.

What is the defining assumption of model-free RL?

Chapter 6

Plans on Top, Skills Below

Count why one flat search over motor commands explodes, and split it into a short plan and reusable skills

To make a salad, you do not plan every muscle twitch. You think "grab the bowl, chop the lettuce, toss". Then your hands handle each step. Real robots split the work the same way, into a hierarchy.

LevelWhat it picksSpeedEasy for machines?
High-level planthe next subgoal: "go to the bowl"about once a secondyes: language models can list the steps
Low-level skillthe torques that reach the subgoalabout 50 times a secondno: this is Moravec's hard part

Why split? Count the options. Say the robot picks one of A motor commands at each tick, for T ticks. Call the number of different command sequences N.

Say it aloud

N equals A to the T.

N
N the number of command sequences a flat search must consider.
A
A the choices per tick: 3 here (push left, hold, push right).
T
to the T multiply A by itself once per tick, T = 20 ticks here.
In plain words

Each tick multiplies the options by A. After T ticks there are A multiplied by itself T times sequences. That is N.

With numbers

With A = 3 and T = 20: N = 320 = 3,486,784,401 sequences. That is for 20 ticks; a salad takes thousands.

Now split the 20 ticks into 4 segments of 5. The plan picks one of 4 subgoals per segment, and each skill searches only its own 5 ticks:

44 + 4 × 35 = 256 + 972 = 1,228 options, not 3.5 billion

Get around the wall

The robot must reach the yellow goal behind a wall. Flat steers straight at the goal. Hierarchy first picks a subgoal at the gap, then runs the same reach skill twice. Press Run, then move the gap.

20

Illustrative toy. The reach skill is "move straight toward a point". The counts use 3 commands per tick, 4 subgoals, and segments of 5 ticks.

The failure: levels built apart. Classical robots ran perception, planning and control as separate modules, and an error at one handoff grew at the next. The lecture's example is drone racing: it took over seven years to beat the human champion, and then only on one known track. A person wins by coupling the levels. Robot learning aims to learn that coupling.

Why split behaviour into a plan over subgoals plus low-level skills?

Chapter 7

What Works Today, and Where Robots Still Fail

Sort the lecture's gallery by rung, then see why closing the loop matters more than the motors

The lecture shows real systems. Every rung of the ladder has a working example.

SystemRecipeRung
Gran Turismo Sophy; DM Control soccerdeep RL in simulation, distributed training, careful reward designmodel-free
Eureka (pen spinning)a language model writes the reward functionreward design
DeepMind soccer robots; DATTtrain in simulation, deploy on hardware, adapt onlinesim to real
RoboCook; rope whippinglearn a dynamics model from real data, plan in itmodel-based
Diffusion Policy; Mobile ALOHAcollect human teleoperation demos, imitateimitation

Then come the bloopers. Humanoids at the 2015 DARPA Robotics Challenge fall while opening a door. Mobile ALOHA fumbles when it runs on its own. The failures sit where Moravec's paradox says: sensing and handling things in an open world.

Why does a person driving the same robot succeed? The person runs sensing, planning and control as one tight loop. If the cup slides, the eyes see it and the hand bends toward it. A pipeline that looks once and then executes a plan cannot.

Close the loop on a sliding cup

Late in the reach, the cup slides. Pick how often the robot looks again and press Reach. Then change the slide.

6 cm

Illustrative toy. The reach takes 2 s; the cup slides between 1.6 s and 1.75 s. The gripper closes on whatever is within 1.5 cm of its centre. Between looks, the robot aims at the last place it saw the cup.

Look once, or twice a second, and any slide over 1.5 cm is a miss. Look 10 times a second and the gripper bends onto the cup. The measurement for a real robot is the same test: move the object mid-task and record the miss. The fix is a policy that re-reads the state every tick.

The lecture closes with the four pillars from Lecture 1: algorithm, data, computation and hardware. The field has improved each module faster than it has joined them into one brain. That joining is the open frontier.

Robots now win at chess-like planning but fumble simple manipulation. What does this confirm?

Chapter 8

The Bench: Three Learners Against the Wind

Open up the hero, derive exactly how far each learner misses, and break the model on purpose

Back to the hero. A point robot chases goals while a steady wind pushes it right. Each learner uses a controller that pushes toward the goal in proportion to the gap. Why do the first two stop short?

Call the wind's push w and the controller's gain, how hard it pushes per unit of gap, k. Call the gap where the robot comes to rest e. At rest its speed is zero, so the controller's push k × e must cancel the wind.

Say it aloud

e equals w divided by k.

e
e the steady-state error: how far from the goal the robot settles, in arena widths.
w
w the wind's push, from 0 to 1.
k
k the gain: 2 for Copy, 6 for React.
In plain words

The robot settles where its push toward the goal equals the wind. Divide the wind w by the gain k to get that gap e. A stronger gain shrinks the gap but never closes it.

With numbers

With w = 0.4: Copy settles at e = 0.4 / 2 = 0.20, React at 0.4 / 6 = 0.07. A goal counts only within 0.05, so both miss. Copy misses for any wind above 0.10, React above 0.30.

Model has a third term. It learns a model of its own motion. From the push it gave and the speed change it saw, it estimates the wind. Then it adds the opposite push. Its gap goes to zero. That is model-based RL in one line: learn the part of f you were not told, then plan with it.

Break the bench

All three learners run at once, each chasing its own copy of the goals. The plot below the arena is each learner's running score. Flip the wind mid-run, or give the model a wrong belief.

0.40

Illustrative toy. A goal counts after 1 s within 0.05; a goal left for 8 s counts as a miss. Score: +10 per goal reached, −1 per second. The frozen model stops learning and cancels twice the true wind, so it overshoots by w / 6 the other way.

Flip the wind and Model misses for about a second while it re-learns, then lands again. Freeze its belief at twice the wind and it overshoots: a wrong model is worse than a modest one. Copy, React, Model: the ladder of Chapter 4, made visible.

The wind is 0.6. A controller with gain 6 chases a goal that counts within 0.05. What happens?

Chapter 9

The Field Guide

Keep the course map, the numbers, the terms and the core code of the overview on one page

A brain exists to turn sensing into action. Robot learning builds that loop. An agent observes a state and a policy picks an action. The world returns a reward and a new state, and the agent maximizes the discounted return. The methods differ in where the supervision comes from: demos, trial, a learned model, or a frozen log.

The course map

  1. Foundations (Lectures 1 to 2, then a refresher): what robot learning is; deep learning paradigms, architectures and optimization.
  2. Imitation learning: map state to action by copying demos; fight compounding error; Diffusion Policy.
  3. Model-free RL: value and policy iteration, Q-learning, policy gradients (REINFORCE), actor-critic.
  4. Model-based RL: known-model control (LQR, MPC); learned dynamics (CEM, MPPI, Dreamer).
  5. Offline data: offline RL (no expert needed) and inverse RL (recover the reward).
  6. Bandits and frontiers: exploration, preference learning, sim to real, safe RL, adaptation, language and vision models in robots.

The numbers

WhatNumberWhy it matters
Walking robot, fall at step 8G = −2 (no discount), −0.63 (gamma 0.97), +1.39 (gamma 0.9)sign flips at gamma 0.953
Camera policy224 × 224 × 3 = 150,528 numbers in, 1 outfind the few pixels that matter
Line policy from 3 demosw = −0.85, b = 0.1, L = 0.005 (vs 0.50 for "always 0")imitation is regression
REINFORCE, one good tryp(right) 0.50 to 0.62 with alpha 0.5good moves get likelier
Corridor valuesV(10) = 4.65, V(9) = 4.32, V(0) = 1.98a model turns moves into a map
Flat vs hierarchy, 20 ticks320 = 3.49 billion vs 1,228split the search
Wind 0.4gap 0.20 (gain 2), 0.07 (gain 6), 0 (model)e = w / k
Mobile ALOHAabout $32,000, 16 degrees of freedomhardware is not the bottleneck

The terms

TermMeaning
Agent, environmentThe decision maker, and everything else.
State, action, rewardWhat the agent decides with, what it does, one number that scores the step.
ReturnThe sum of future rewards, each shrunk by gamma once per step of delay.
Reward hypothesisEvery goal is maximizing the expected return of one scalar reward.
PolicyThe function from state to action; the thing every method learns.
Dynamics modelA function from state and action to the next state.
Bellman backupA cell's value is the move's reward plus gamma times the value of where you land.
HierarchyA slow plan over subgoals on top of fast, reusable skills.
Moravec's paradoxEasy for people is hard for machines, and the reverse.

The checklist

  1. Write the loop: what is the state, the action, the reward?
  2. Watch rollouts, not only the return, to catch a reward the robot games.
  3. Ask where the supervision comes from: demos, trial, a model, or a log.
  4. If you plan with a model, test it on fresh real data first.
  5. Move the object mid-task: does the policy re-read the state?

The core as code

pythonimport numpy as np

def discounted_return(rewards, gamma):         # Chapter 2
    return sum(gamma ** t * r for t, r in enumerate(rewards))

def fit_line_policy(states, actions):         # Chapter 3: imitation as regression
    A = np.column_stack([states, np.ones_like(states)])
    return np.linalg.lstsq(A, actions, rcond=None)[0]   # [w, b]

def reinforce_step(h, a, G, alpha):            # Chapter 4: two-action softmax
    p = np.exp(h) / np.exp(h).sum()
    grad = -p; grad[a] += 1                    # d log pi(a) / d h
    return h + alpha * G * grad

def corridor_values(n=12, goal=5.0, r=-0.1, gamma=0.95):   # Chapter 5
    V = np.zeros(n); V[-1] = goal
    for c in range(n - 2, -1, -1):
        V[c] = r + gamma * V[c + 1]                # Bellman backup
    return V

discounted_return([1]*8 + [-10], 0.97)        # -0.63
fit_line_policy(np.array([-1., 0, 1]), np.array([.9, .2, -.8]))   # [-0.85, 0.1]
reinforce_step(np.zeros(2), 1, 1.0, 0.5)          # [-0.25, 0.25] -> p(right) 0.62
corridor_values()[[0, 9, 10]]                       # [1.98, 4.32, 4.65]

Keep going

The takeaway. Every method in robot learning produces the same object, a policy from state to action. What changes up the ladder is where the answer comes from, and how much the robot must find out for itself.
A team has a fixed log of mediocre robot runs with rewards, no expert, and no way to run the robot. Which rung fits?

Now press Present or Teach and explain from memory: the loop, the return, a policy's shapes, the four rungs and the gap e = w / k. Then go back to the bench, set the wind to 0.5, and say why only Model still lands.

Credit

Based on Lecture 2, "Robot Learning: An Overview", of Introduction to Robot Learning (CMU 16-831), taught by Guanya Shi. The quotes are Daniel Wolpert's and Hans Moravec's (Mind Children, 1988); the loop and the reward hypothesis follow Sutton and Barto, Reinforcement Learning: An Introduction. Toy devices and numbers are our own and labelled illustrative.

Introduction to Robot Learning · CMU 16-831 · Lecture 2: Robot Learning, An Overview
Next: Lecture 3 · Back to Gleams