IROS 2025 / Safe imitation learning

CAILConstraint-Aware
Imitation Learning

Learn from imperfect demonstrations.
Learn to stay on track.

Safety supervision during training. A learned policy that acts directly at deployment, without an additional safety filter.

Shengfan Cao · Eunhyek Joa · Francesco Borrelli

Image-feedback racingFig. 7b
The reported CAIL policy's trajectories follow the enclosed race track over 50 consecutive laps. Axes are in meters.
50 consecutive lapsReported simulation rollout
Images + velocity feedback

01 / LearnImperfect expert demonstrations

02 / GuideLearned safety supervision

03 / DeployPolicy-only action generation

The idea

Imitation accuracy
is only part of the story.

At the handling limits, a small deviation from an expert’s action can send a vehicle off track. Expert demonstrations can also be unreliable or partially unsafe. Minimizing imitation error alone may leave a policy brittle.

CAIL adds a learned safety penalty to behavior cloning. Motivated by a differentiable approximation of a predictive safety filter, it trains the policy to account for constraint satisfaction alongside imitation accuracy.

This is safety-filter-guided imitation through a joint training objective. The deployed policy does not run a separate safety filter.

Watch the project

Learning at
the handling limits.

See the autonomous racing experiments and the method in the project video.

Watch on YouTube

CARLA-based simulation with customized vehicle dynamics.

The method

Two training signals.
One deployed policy.

Full-state information supplies privileged safety supervision during training, including when the policy learns from images and velocity measurements.

ObservationState or
images + velocity
Learned policyπθ
ActionThrottle
+ steering
Performance supervision

Imitate the expert

Match expert actions with a mean-squared imitation loss.

Safety supervision

Account for what happens next

Use learned dynamics and safe-set membership to penalize predicted unsafe behavior.

Training: the expert and learned safety models provide supervision. Rollouts and expert labels are collected iteratively.

Conceptual overview of the architecture. At deployment, the expert, learned dynamics, and safety model are not needed to generate policy actions.

The learning objective

LCA = Lclone + λ · ℓsafety

The safety term is a negative log-likelihood penalty. The weight λ controls its contribution relative to imitation. Here ℓsafety denotes the unweighted penalty; Equation 14 in the paper includes λ in Lsafety.

Learning from outcomes

A failure is not an unsafe label for every state.

Safety auto-labeling uses successful and failed trajectories. Local convex-hull comparisons remove likely safe states from candidate negative examples, reducing false negatives in the surrogate labels.

Read Section IV and Algorithm 1
See the paper’s gradient-computation diagram
Figure 2: policy learning combines imitation MSE and safety NLL; dynamics and safety classification have their own training losses.
Figure 2 from the paper. Only the policy network is used at test time; the other modules participate in training.

The evidence

More consistent racing.
With limited observations.

Three simulation experiments compare CAIL against behavior cloning with DAgger, using the same policy architecture within each experiment.

50consecutive laps without constraint violation
5.65 saverage lap time at the selected checkpoint
81epoch where early stopping is triggered

Image-feedback racing, Experiment V-C / Figure 7. These values describe the reported rollout and selected checkpoint, not an average across random seeds. The expert’s average lap time is 4.805 s.

Figure 7: baseline stays below 10 completed laps, while CAIL reaches 50 near epoch 80. Performance varies after that checkpoint. The right panel shows the selected policy's trajectory.
Figure 7 / Original paperCAIL recovers a policy completing 50 laps within 80 epochs; the baseline does not exceed 10 in the reported experiment. Early stopping occurs at epoch 81.

Same track, same checkpoint budget.

Muted top-down spectator recordings from the full-state racing experiment (V-B). Both clips are silent CARLA captures; the BC baseline is real time, the CAIL clip is an excerpt from the ~4.7-minute rollout, sped up ~5×.

Baseline (BC)Real time
Drifts off track and comes to a stop within ~6.5 seconds.
CAIL (ours)~5× speed
Sustained lap after lap without leaving the track; opening ~75s of the full 50-lap rollout, sped up ~5×.
V-A

Image-feedback path following

A PID expert tracks the center line at a conservative speed. Both methods reach 50 laps; CAIL does so in fewer training epochs.

↗
V-B

Full-state racing

An MPCC expert supplies high-speed demonstrations. CAIL recovers a consistently completing policy in fewer epochs, despite slower convergence of imitation loss.

↗
V-C

Image-feedback racing

The policy receives a front-facing RGB image and velocity measurements. CAIL reaches 50 consecutive laps; training variability makes checkpoint selection important.

↗

Explore & reproduce

Take a closer look.

Read the derivation, inspect the implementation, or cite the published work.

Cite this work

A Simple Approach to Constraint-Aware Imitation Learning with Application to Autonomous Racing
Shengfan Cao, Eunhyek Joa, and Francesco Borrelli · IROS 2025

@inproceedings{cao2025cail,
  author    = {Cao, Shengfan and Joa, Eunhyek and Borrelli, Francesco},
  title     = {A Simple Approach to Constraint-Aware Imitation Learning
               with Application to Autonomous Racing},
  booktitle = {2025 IEEE/RSJ International Conference on Intelligent
               Robots and Systems (IROS)},
  year      = {2025},
  pages     = {9830--9837},
  doi       = {10.1109/IROS60139.2025.11247769}
}