Skip to content
The Daily Triptych232 / 365
Ranked demonstrations and what optimising the learned reward can reach

The ranked demonstrations are all mediocre, but their ordering implies a direction. A reward function fitted to that ordering can be optimised past the best demonstration, which is the extrapolation the second paper reports. Vertical scale is illustrative, not measured.

II · THE IDEA · ARTIFICIAL INTELLIGENCE

Imitation Learning from Observation

Reinforcement learning, imitation · arXiv 1805.11592; arXiv 1904.06387 · Hard-exploration Atari games; control tasks · State observations only, no expert actions

▶ Listen · narrated

Video of an expert records what happened on screen, never which buttons were pressed. Two papers teach an agent from that silent record, and one agent ends up beating its own teachers.

At a glance

The setting
Imitating an expert from observations alone, with no record of the actions taken
Why it is hard
Ordinary imitation trains on state-action pairs; here one of the two columns is missing
Route one
Turn one video into ordered waypoints and reward the agent for reaching them in sequence
Route two
Fit a reward function to ranked, suboptimal demonstrations, then optimise it with RL
Reported results
Progress on hard-exploration Atari titles; policies that beat their own demonstrations

Think of learning to cook a dish from photographs taken at intervals while someone else worked. You can see the onions going translucent, the sauce thickening, the finished plate. You cannot see the hand on the dial, so you do not know what heat was used or how often the pan was stirred. You still have something valuable: an ordered set of states the pan should pass through. You can cook, compare your pan with the next photograph, and adjust until it matches.

That is the first method in plain form. A human video of a game becomes a series of checkpoints, and the agent gets a small reward whenever its own situation resembles the next checkpoint it has not yet reached. One complication: the photographs were taken in another kitchen with a different camera, so comparing them directly with your pan is useless. The first step is therefore to learn a way of describing each image so that 2 images from equivalent moments count as similar even when they do not look alike.

The second method drops the photographs and uses judgements instead. Suppose you have 4 attempts at the dish, all mediocre, and you know which was best and which worst. From that ordering you can work out what tends to make an attempt better. Then you cook to maximise that quality rather than to copy any single attempt — and you can end up with something better than all 4. The ordering, not the skill on display, was the useful ingredient.

Look closer

  1. The pixels do not match

    A clip pulled off YouTube and a frame from the agent's own emulator are not comparable images. Different players, different colour settings, different resolutions and frame rates, compression smear, overlays, and no alignment in time. Comparing them pixel by pixel says little about whether the agent has reached the same point in the game. So the YouTube work first learns a representation, meaning a compressed numerical description of each frame, in which two frames count as similar when they sit at a similar point in a run rather than when they merely look alike.

  2. A reward made of waypoints

    Once frames can be compared meaningfully, a single demonstration video becomes a ladder. Take checkpoints along it in order, spaced through the run. The agent earns a small reward when its current frame lands close, in that learned representation, to the next checkpoint it has not yet claimed. Nothing in this needs to know what the demonstrator pressed. The video supplies a sequence of places to be; reinforcement learning supplies the actions by trial and error. That is the substitution at the heart of the method: the missing action column is replaced by a reward for progress along someone else's route.

  3. The information is in the ordering

    The second route needs no route at all. Collect several demonstrations, none of them good, and rank them from worse to better. Then train a reward function so that a trajectory ranked higher receives a higher total score than one ranked lower. The network is not asked to reproduce any demonstration. It is asked to explain what makes one better than another, which is a different and more transferable thing. Once you have that explanation as a numerical reward, ordinary reinforcement learning can push it past anything in the training set.

The story

Standard imitation learning is supervised learning in disguise. You gather a large set of pairs — the situation the expert was in, and the action the expert took in it — and you train a network to predict the action from the situation. This is called behavioural cloning, and it works whenever those pairs exist.

They usually do not. A recording of a surgeon, a driver, a dancer or a games player captures what a camera can see: positions, objects, outcomes. It does not capture hand pressure, wheel angle or which buttons were held down. So the half of the data that behavioural cloning trains on — the action — is exactly the half that ordinary recordings leave out. Imitation learning from observation is the attempt to learn anyway, and the two papers here fill the same missing column in different ways.

The first, Playing hard exploration games by watching YouTube, works on Atari games where the score changes so rarely that an agent learning by trial and error gets no feedback for thousands of frames at a stretch. Montezuma's Revenge, Pitfall! and Private Eye are the standard examples. The problem is mechanical. Reinforcement learning improves a policy by noticing which actions led to reward. If random play essentially never reaches a reward, there is nothing to notice and nothing to improve. The agent does not fail slowly; it fails to start.

Human videos of these games exist in quantity, but they are messy evidence. A clip pulled off YouTube was made by a different player, on unknown emulator settings, at a different resolution and frame rate, with compression smear and sometimes an overlay on top, and nothing in it lines up in time with the agent's own play. Compare such a frame with a frame from the agent's emulator pixel by pixel and the comparison says almost nothing about whether the agent has reached the same point in the game.

So the method's first job is to make the frames comparable. It learns an embedding — a short list of numbers describing each frame — trained so that frames from equivalent moments in different recordings end up with similar numbers, even when the raw pixels differ. No human labels are needed for this. The training signal comes from the videos themselves: from the order of frames within each video, and from the correspondence between several videos of the same game.

Once frames can be compared this way, one demonstration video becomes a route. Take checkpoints along it, in order, spaced through the run. The agent earns a small reward whenever its current frame lands close, in the learned embedding, to the next checkpoint it has not yet claimed. Notice what this does and does not require. The video never says which buttons the demonstrator pressed. It says where to be next. Which actions get the agent there is left for trial and error to discover — and now trial and error works, because reward arrives at every checkpoint rather than almost never.

The second paper, Extrapolating Beyond Suboptimal Demonstrations via Inverse Reinforcement Learning from Observations, starts from a different problem. Copying has a ceiling. Copy a mediocre driver and the best you can hope for is a mediocre driver. But suppose you have several demonstrations, none of them good, and you can rank them from worst to best. The ranking carries something no single demonstration does. It points in the direction of improvement.

So instead of copying any demonstration, the method fits a reward function to the ranking. A reward function is a rule that scores each moment of behaviour; add up the scores along a whole run and you get that run's total. The network is trained so that better-ranked runs get higher totals than worse-ranked ones. Nothing in this needs the expert's actions — only the observed states, in order, and the judgement of which run beat which. The trained network is then handed to a standard reinforcement learning algorithm as the thing to maximise. Because the network has captured what tends to make a run better, rather than what any particular run did, maximising it can push the policy past the best demonstration it ever saw. The authors report exactly that: learned policies that outscore the demonstrations used to train them.

Both methods share a structure worth naming. Neither tries to work out what the expert's actions were, and neither has to. Both convert observations into a reward — a route of checkpoints in one case, a fitted scoring rule in the other — and then let reinforcement learning handle the part that needs to know which button produces which change on screen, because that part the agent can find out for itself by playing. The demonstration supplies the goal; interaction supplies the mechanics.

The same structure sets the limit. Both approaches assume the agent can practise freely in an environment resembling the one in the recordings. Neither is a way to learn from video alone, with no play at all. What they remove is the need for a matched log of expert actions — the requirement that keeps most real-world footage out of imitation learning entirely.

It is also worth saying what the record does not settle. The two papers used separate benchmarks, so nothing here shows how they compare against each other; the pairing is editorial. The checkpoint method was reported on a small number of hard-exploration Atari titles, which is a narrow base from which to generalise. And the ranking method depends on the rankings being reliable. How far a learned reward can be pushed beyond its demonstrations before it stops corresponding to the real task is a question neither paper closes.

Why it mattered then

Around 2018, the hard-exploration Atari games were a shared embarrassment for reinforcement learning. Agents that mastered fast reactive games still scored near zero on Montezuma's Revenge, where the first reward may lie many deliberate steps away with nothing along the route to signal progress. One line of work attacked this with exploration bonuses — artificial rewards for visiting new situations. Learning from human video attacked it from the other end: if the difficulty is that an agent cannot guess what to try, show it, using recordings that already exist in quantity. The YouTube paper's real insistence was that those recordings need not be curated, aligned in time, or instrumented with action logs. The following year's ranking paper made a second, separable point. Until then it was easy to assume imitation was a ceiling — at best, a copy of the teacher. Showing that a reward inferred from several bad runs could produce a policy better than any of them reframed demonstrations: not behaviour to reproduce, but evidence about what matters.

Why it matters now

The asymmetry has not gone away. Cameras and screen recorders are everywhere; logs of the control signals behind them are rare and usually private. Any method that needs paired state-and-action data can only use demonstrations someone deliberately instrumented, which is a tiny slice of the record of human skill. Robotics feels this most sharply, because a human hand and a robot gripper do not share a set of possible actions even in principle, so the expert's actions may not exist in any form the learner could use. Rewards inferred from ranked observations stay attractive for the same reason preference-based training does elsewhere: people are far better at saying which of two attempts went better than at writing down, as a number, what good looks like. And the extrapolation result carries a caution alongside the promise. A reward learned from a few ranked demonstrations is a guess about what makes behaviour good, and maximising a guess very hard is exactly the setting in which the optimiser finds the flaws in your definition rather than in the world.

The surprising detail

The ranking method's oddest property is that the demonstrations do not need to be good — and in a sense it helps if they are not. If every demonstration were near-perfect, the ranking between them would carry almost no information, because there would be almost no difference to rank. It is the gap between a poor run and a slightly less poor run that reveals which features of behaviour matter. So a set of clearly flawed attempts, correctly ordered, can support a policy that beats all of them, while a set of uniformly excellent attempts offers less to build on. The useful ingredient is not skill but contrast.

What is disputed

These are two separate papers with separate benchmarks, and nothing here establishes how they compare against each other; the pairing is editorial. The checkpoint method was reported on a small number of hard-exploration Atari titles, which is a narrow base from which to generalise. The ranking method depends on the rankings being reliable, and how far a learned reward can be pushed beyond the demonstrations before it stops corresponding to the real task is not something either paper settles.

Remember this

Observations without actions are the normal case. Both methods turn what the expert reached into a reward, then let reinforcement learning rediscover how to reach it.

Test yourself

Both papers avoid ever inferring the expert's actions. What does the agent have to be given instead, for either method to work at all, and why does that requirement rule out learning purely from a library of video?

Go deeper

Image: Original diagram, The Daily Triptych. Licence: Original work. Source.

← Back to day 232