II · THE IDEA · ARTIFICIAL INTELLIGENCE
Imitation Learning from Observation
▶ 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.
Behavioural cloning learns a policy by supervised regression on pairs of state and expert action. Imitation from observation removes the action from the dataset, leaving only sequences of states or observations, so the supervised target no longer exists. Both papers respond the same way at the top level: construct a reward function from observations, then delegate the mapping from action to outcome to reinforcement learning in the environment.
The YouTube method (1805.11592) addresses hard-exploration Atari titles — Montezuma's Revenge, Pitfall! and Private Eye — where reward is sparse enough that undirected exploration rarely reaches the first reward at all. Its first component is a self-supervised embedding of frames, trained from the videos themselves using temporal structure within each video and correspondence across videos, with no external labels, so that frames at equivalent points in different recordings map to nearby vectors despite differences in emulator settings, resolution, frame rate, compression and overlays. Its second component turns a single demonstration into ordered checkpoints in that embedding space and issues a small reward when the agent's current embedded observation lies close to the next unclaimed checkpoint. The reward is a progress signal defined by another agent's trajectory, not a behavioural target, and it requires no access to the demonstrator's action sequence.
The T-REX-style approach (1904.06387) is a reward-learning method rather than a trajectory-following one. Given a set of demonstrations with a ranking over them, it trains a parameterised reward network so that the summed reward along a higher-ranked trajectory exceeds that along a lower-ranked one, typically via a pairwise loss over trajectory pairs or segments. The learned reward is then optimised with a standard RL algorithm. Because the reward is fitted to the direction of improvement implied by the ranking rather than to any individual trajectory, the resulting policy can exceed the performance of the best demonstration, which the paper reports across its evaluation domains. The rankings need only cover observation sequences.
Limitations worth holding onto. Both approaches assume environment access, so neither is offline learning from video; the demonstration provides the objective and interaction provides the dynamics. The checkpoint approach inherits the failure modes of its embedding: if 2 genuinely distinct situations map close together, the reward fires spuriously, and progress rewards defined by 1 trajectory can bias the agent towards that specific route rather than towards solving the task. The ranking approach inherits the failure modes of learned rewards generally: optimising a fitted reward hard invites the policy into regions of state space the demonstrations never covered, where the fit is unconstrained, so extrapolation gains are not unbounded and depend on ranking quality and demonstration coverage. Neither method addresses embodiment mismatch, which matters when the demonstrator's body and the agent's differ enough that no observation-level correspondence exists.
Look closer
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.
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.
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?
Both need the ability to act in an environment and observe the consequences. The demonstration supplies a target to move towards, whether that is the next checkpoint along a video or a high score under a learned reward function, but nothing in either method tells the agent which action produces which change in state. That mapping is discovered by trial and error during reinforcement learning. So the video removes the need for a log of expert actions; it does not remove the need for practice. A pile of footage with no environment to act in gives you a reward signal and no way to optimise it.
Go deeper
- [1805.11592] Playing hard exploration games by watching YouTube · arxiv.org
- [1904.06387] Extrapolating Beyond Suboptimal Demonstrations via Inverse Reinforcement Learning from Observations · arxiv.org
Image: Original diagram, The Daily Triptych. Licence: Original work. Source.