Imitation Learning

Imitation Learning #

Imitation learning uses expert demonstrations to learn a policy. The central choice is whether to copy the expert’s actions, collect new labels where the learner actually goes, or infer an objective that explains what the expert does.

Course Content covered in this module:

  • Imitation learning via supervised learning and behaviour cloning
  • Dataset augmentation and DAgger
  • Inverse Reinforcement Learning and adversarial imitation (GAIL)

1. Behaviour Cloning ☆ #

Train the policy to map demonstrated states to expert actions. For discrete actions the supervised loss can be cross-entropy; for continuous commands it can be a regression loss. This is easy to train from fixed demonstrations and does not require a hand-written reward.

The main limitation is distribution shift. During training a driving model may mainly see images from the centre of a lane. During deployment a small steering error can move it towards the edge. If correction examples are missing, the learner may make a second error from that unfamiliar state. A low imitation loss on expert data therefore does not guarantee good closed-loop performance.

2. DAgger: Label the States the Learner Visits ☆ #

  1. Train an initial policy on expert demonstrations.
  2. Roll out the learner, optionally mixed with the expert early on.
  3. Ask the expert what action it would take at each visited state.
  4. Add those state–expert-action pairs to the aggregate dataset and retrain.

In the recycling-robot example, the learner may visit a low-battery state because it searched too long. If the expert recommends recharge there, the new label is recharge, regardless of what the learner executed. The key is to collect an expert correction where the learner actually goes; repeating only the original demonstrations does not address that mismatch.

DAgger needs an expert that can label newly visited states and a rollout process that can be run safely. An expert mixture can make early rollouts safer, but does not eliminate the need for appropriate operating constraints.

3. Inverse Reinforcement Learning ☆ #

Forward RL starts with a reward and seeks a policy. Inverse RL starts with observed expert behaviour and seeks a reward under which that behaviour is well explained. With a linear reward, one comparison uses discounted feature expectations:

\[ r_w(s,a)=w^\top\phi(s,a),\qquad \mu(\pi)=\mathbb{E}_\pi\!\left[\sum_{t\geq 0}\gamma^t\phi(S_t,A_t)\right]. \]

In an episodic problem, truncate the sum at termination. Example features for the recycling robot could count searches, waits and recharges. Compare expert and candidate-policy feature expectations, then use the inferred reward in a forward learning or planning problem. Different rewards can explain the same demonstrations, so the reward need not be uniquely determined.

4. Adversarial Imitation #

In GAIL, a discriminator learns to distinguish expert state-action samples from the policy’s samples. The policy interacts with the environment and is updated to make its behaviour harder to distinguish from the expert’s. This learns a policy by matching behavioural distributions rather than requiring recovery of a unique, interpretable reward.

MethodMain training signalWhat it needs beyond fixed expert examples
Behaviour cloningExpert action labelsNo learner rollouts required for training
DAggerExpert labels on learner-visited statesLearner rollouts plus access to an expert labeller
Inverse RLReward that explains demonstrationsA way to test or solve candidate policies
GAILFeedback from a discriminatorLearner rollouts to provide its own samples

Practice Questions #

  1. Why can excellent per-action prediction on expert data coexist with poor driving performance?
  2. In DAgger, whose label is added when the learner and expert disagree?
  3. Distinguish inferring an expert’s objective from matching the expert’s behaviour.

References #

  • Consolidated DRL slides, PDF pp. 402–456; recording 15.

Home | Deep Reinforcement Learning