PTENES
← Track 1 MODULE 1.4

🎯 Imitation Learning and Behavior Cloning

The most widely used recipe for training VLAs is also the most fragile. Behavior cloning copies the demonstrator through supervised regression—but small errors lead the robot into unseen states, and the error compounds. Here you'll understand why this happens and how to mitigate it.

6
Topics
~40
Minutes
Interm.
Level
Theory+Practice
Type

Detailed content

1

📝 Behavior Cloning: the basic formulation

Behavior Cloning (BC) reduces control to supervised learning: given a dataset of state-action pairs demonstrated by a human, a policy π(a|s) is trained to maximize the likelihood of the observed actions. It is simple, stable, and scales — which is why almost every VLA (RT-1, OpenVLA, π0) is trained with BC. The policy needs neither a reward nor interaction with the environment during training, only demonstrations.

# Behavior Cloning — objetivo
#   maximizar  Σ log π(a_t | s_t)   sobre demos do expert
for (obs, action) in demo_loader:
    pred = policy(obs)               # estado → ação
    loss = criterion(pred, action)   # ex: cross-entropy ou flow
    loss.backward(); opt.step()

💡 Why BC is the default

Collecting demos is safer and cheaper than letting a robot explore through reinforcement learning in the real world (where failures break hardware). BC turns a control problem into a well-behaved supervised learning problem.

Supervised policy

Learning action as a label.

π(a|s)

Action distribution given state.

Max likelihood

BC training objective.

Offline

No interaction during training.

2

📉 Distribution shift and compounding error

The Achilles' heel of BC: the model is trained on the state distribution of the expert, but at runtime it visits states it generated itself. A small error steers the robot into a slightly out-of-distribution state, where the policy is less reliable, makes a bigger error, and so on—the compounding error. Theoretically, the cost grows with O(εT²) over horizon T, versus the ideal O(εT).

time (steps) → deviation expert (training) clone (execution) O(εT²) error

Small deviations leave the training distribution and compound—the structural failure of naive behavior cloning.

📊 The math of drift

  • O(εT²) — error cost of naive BC (Ross & Bagnell).
  • O(εT) — ideal cost of a policy with on-policy correction.
  • ε — error rate per step; long horizons penalize BC.

Covariate shift

Test states ≠ training states.

Compounding error

Errors that accumulate.

O(εT²)

Quadratic cost over the horizon.

Recovery behavior

Know how to return to the trajectory.

3

🔄 DAgger and teleoperation

DAgger (Dataset Aggregation) tackles distribution shift by collecting labels in the states the policy actually visits: the clone is run, and the expert annotates the correct action in those states, adding it to the dataset and retraining. This teaches recovery behaviors. The demos themselves come from teleoperation — leader-follower, VR, or gloves — whose quality and coverage set the policy ceiling.

1

Run the current policy

The clone runs and visits its own states, outside the expert's distribution.

2

Expert labels these states

The human indicates the correct action where the clone would make a mistake.

3

Aggregate and retrain

The dataset grows with recovery cases; the cycle repeats.

⚡ Practical tip

Pure DAgger is expensive (it needs the expert in the loop). In practice, many teams inject perturbations in the demos (pose noise) and record intentional recoveries—"cheap" DAgger that improves robustness without online labeling.

DAgger

Aggregate on-policy labels.

On-policy correction

Correct in the visited states.

Leader-follower

Master-arm teleoperation.

Coverage

Variety of states in the demos.

4

🌀 Multimodality of actions: why MSE fails

For the same state, there are often multiple equally good actions — go around an obstacle on the left or right. Different demonstrators choose different paths. If the policy is trained with MSE, it learns to average of those actions, which may land exactly on the obstacle (mode averaging). That's why modern VLAs use heads expressive — diffusion, flow matching, or discrete tokens — capable of representing multimodal distributions.

✓ Expressive policies

  • ✓Diffusion/flow capture multiple modes.
  • ✓Discrete tokens model a categorical distribution.
  • ✓They choose a coherent mode, not the average.

✗ MSE / unimodal regression

  • ✗Collapses valid modes into the average.
  • ✗The average can be an invalid action.
  • ✗Hesitant/shaky trajectories.

Multimodal actions

Multiple valid paths.

Mode averaging

An average that becomes an invalid action.

Expressive policy

Diffusion/flow/tokens.

Bridge to M1.5

Motiva diffusion policy.

5

🧹 Data quality: coverage and diversity

In imitation learning, data > architecture. What matters isn't raw volume, but coverage (rare and recovery states represented), diversity (objects, positions, lighting, distractors) and consistency. Suboptimal or contradictory demos confuse the policy; clean, varied demos generalize. A small but diverse corpus often beats a large but redundant one.

📊 Quality dimensions

  • Coverage — edge states and recovery included.
  • Diversity — varied objects, backgrounds, positions, and lighting.
  • Consistency — coherent strategy across demos.

⚡ Practical tip

Before collecting more demos, audit the ones you have: remove trajectories with silent failures, balance the objects, and add distractors. Intentional coverage is worth more than a thousand repetitions of the same scene.

Coverage

Represented states.

Diversity

Variation in scenes and objects.

Demo quality

Great > suboptimal.

Distractors

Extra objects for robustness.

6

📏 Metrics: success rate and generalization

The ultimate metric is success rate — fraction of attempts that complete the task. But a high number in training scenes can be misleading. An honest test measures generalization across three axes: new objects, new positions/scenes, and rephrased instructions. Always evaluate with Enough attempts and OOD (out-of-distribution) protocols, reporting confidence intervals.

# Protocolo de avaliação honesto
seen      = eval(policy, scenes_treino)      # baseline
ood_obj   = eval(policy, objetos_novos)      # generaliza objeto?
ood_pos   = eval(policy, posicoes_novas)     # generaliza cena?
ood_instr = eval(policy, instrucoes_novas)   # generaliza linguagem?
report(success_rate, n=50, ci=0.95)

💡 Don't trust the training number alone

A policy can score 95% in-distribution and 20% OOD. A VLA’s value lies precisely in generalization—measure the three axes separately, or you’ll be optimizing the wrong metric.

Success rate

Primary task metric.

OOD eval

Test outside the distribution.

Axes of generalization

Object · scene · instruction.

Confidence interval

Report variance.

✅ Module summary

✓
BC is the standard — supervised state→action regression, simple and scalable.
✓
Distribution shift — compounded O(εT²) error is BC's structural failure mode.
✓
DAgger and data — on-policy correction and coverage/diversity set the ceiling.
✓
Multimodality — MSE collapses modes; expressive policies solve this. Measure OOD.

Next module

1.5 — Diffusion Policy and Flow Matching: expressive policies that solve multimodality.