top of page
cheat_pages1-2-4-1_800dpi.png

Imitation Learning: Behavior Cloning vs. a CVAE

Writer: Maysarah Sukkar
Maysarah Sukkar
Oct 7
1 min read

Can a robot learn to run just by watching? I trained two imitation learning policies on 20,000 expert demonstrations of the half-cheetah and evaluated each over 100 episodes with randomized starting conditions.


Behavior cloning with a residual MLP. The simplest approach maps the current state straight to a short chunk of future actions. My network had three 256-unit GELU layers with dropout and a residual skip connection, and predicted several actions at once that the controller executed in a receding-horizon loop. Across 100 randomized episodes it averaged a penalized reward of 119 and fell in only 8.


A conditional VAE. Plain behavior cloning averages over demonstrations, which can blur together different ways of solving a task. A conditional variational autoencoder adds a latent variable so the policy can represent several distinct behaviors. Mine used a 256-256 encoder, a 512-512 decoder and a 128-dimensional latent, trained for 200 epochs with cosine learning-rate decay.

The KL weight turned out to matter more than any architecture choice. At a weight of 10 the policy struggled; dropping it to 0.1, so that reconstruction drove learning, was the change that made it work.



The result was humbling. The CVAE averaged a reward of 111 but fell in 30 of 100 episodes, against 8 for the simpler MLP. A more expressive model is not automatically better. My read is that these demonstrations come from a single, consistent running gait, so there was little multimodality for the CVAE to capture, and the sampled latent mostly added variance. On tasks with several valid strategies I would expect the ranking to flip.

Tools: MuJoCo (dm_control), PyTorch.

Comments


bottom of page