Take an imitation step
Take one gradient step on the behavior-cloning loss J(θ): the performance operator Pη.
Preprint 2026 / Safe imitation learning
Imitate the expert.
Then correct toward safety.
Training alternates one imitation step with a block of safety steps that pull the network’s actions toward their projection onto the safe set. At run time, the controller is the network alone, with no safety filter.
01 / ImitateOne gradient step on the cloning loss
02 / CorrectA block of steps toward projected actions
03 / DeployThe network alone, with no filter
The question
A projection-based safety filter can wrap any policy. But an unsafe policy triggers frequent or large interventions, and while the filter stays active, the closed loop drifts from the intended behavior.
We use the filter during training instead. Imitation and safety correction stay separate operations: one imitation gradient step, then a block of safety steps that regress the network’s actions toward their projection onto the safe set.
Most alternatives add a weighted safety penalty to the imitation loss. That weight sets the safety–performance trade-off and has to be tuned for each problem. Interleaving needs a safety budget that is only large enough.
Explore the geometry
One training state with a two-dimensional action, so the policy’s output is a point in the plane and the safe action set is an ellipse. The demonstrated action lies outside it. Both methods start from the same output and see only the imitation gradient and projections of their own actions. Neither is told the constrained optimum v*.
Press Play animation to watch both policies train from the same start, one step at a time.
An affine toy of Sections III–IV. Interleaving follows a recipe that converges well here: refreshed safety targets, a safety block of Kt = ⌈ln(t + 2)⌉ steps, a learning rate that decays from 0.2 to 0.002 over the run, and safety steps near their stability limit. The run lasts 80 (1 + h)/(1 − h) iterations: stronger parameter sharing makes the problem worse conditioned, so it needs longer. Fused training shares the same learning rate. The weight λ only affects fused training; interleaving has no weight to tune.
| Method | Distance to 𝒞 | Distance to v* | Gradient steps |
|---|---|---|---|
| Interleaved | — | — | — |
| Fused penalty | — | — | — |
The output is the action v = π(x) = (u₁, u₂) at a single training state, with safe set 𝒞 = {u : u₁²/1.2² + u₂²/0.9² ≤ 1}. Projection onto the ellipse has no closed form; it is computed from its optimality conditions with a one-dimensional bisection. The demonstration is ū = (1.9, 0.5), so the constrained optimum is v* = Π𝒞(ū) ≈ (1.16, 0.23). The policy is affine in its weights with neural-tangent-kernel Gram matrix H = [[1, h], [h, 1]]; the coupling slider sets h, which models weights shared by the two outputs.
Interleaved: v ← v − ηtH(v − ū), then Kt = ⌈ln(t + 2)⌉ times v ← v − βH(v − Π𝒞(v))
Fused: v ← v − ηf H[(v − ū) + λ(v − Π𝒞(v))]
The learning rate decays geometrically, ηt = 0.2 · 0.01t/T over a run of T = 80(1 + h)/(1 − h) iterations, and the safety step is β = 0.9/(1 + h), just inside its stability limit 1/‖H‖. The horizon grows with the condition number (1 + h)/(1 − h) of H, because the imitation step converges at rate η(1 − h) along H’s weak direction. The safety schedule is the logarithmic one of Algorithm 1 and Example 1 with c = 1, so the projection error left by each block shrinks over training (Corollary 1). Fused training uses either the shared rate ηf = ηt or the normalized rate ηf = ηt/(1 + λ). Its update is stable only while ηf(1 + λ)(1 + h) < 2, the stability condition of Section IV. With the shared rate, a large λ breaks that condition early in training: each penalty correction overshoots deep into the safe set, and the actions chatter at the boundary until the rate has decayed. Normalizing the rate keeps it stable but divides the imitation step by 1 + λ, as in the “Fused, η/(1 + λ)” row of the racing ablations.
The fused update descends ℓ + λφ, a quadratic penalty. Since φ has zero gradient on the safe set, v* is never a stationary point of it, and the fused outputs settle outside 𝒞 at distance ‖∇ℓ‖/λ. Raising λ shrinks that bias, but then the shared rate overshoots and the normalized rate slows imitation; no learning-rate schedule moves the fixed point. With h > 0, each safety step is tilted away from the outward normal of the ellipse; the largest tilt is the distortion κS of Assumption 2. On the curved boundary this leaves interleaving an offset from v* proportional to the learning rate, which the decaying rate removes. With a constant rate it would stay, as Theorem 1 allows. In racing, where corrections are sparse, the conditions of the analysis fail.
Optimizing for multiple states simultaneously
A policy is trained on nine perturbed states of the race track. At each state it chooses a first action (acceleration, steering); after that, a linear tracking controller takes over. The label ✕ is that controller's own first action, which drives the car out of the safety band.
The green polygon is the set of first actions after which the controller keeps the car in the band, and v* ◯ is the cheapest of them: the constrained optimum. Both methods start from the same network and see only the imitation gradient and projections of their own actions. Because the nine actions share one network, every step moves all of them.
Tap a numbered state on the track, or swipe, to change state.
What this is. The setting of the paper's analysis: a fixed set of states, a quadratic imitation loss, convex safe sets, and exact projections. Each step uses all nine states. Fused training takes gradient steps on the loss plus λ times the squared distance to the safe set; interleaving takes one step on the loss, then Kt steps toward the projections of its own actions.
What this is not. The network never drives: there is no closed loop and no DAgger. The model is the race car's dynamics linearized along a raceline (lap 5.30 s), the safety band is the track minus a 10 cm margin, and the safe set comes from one controller's continuation rather than the paper's predictive filter. Step sizes are chosen to be visible, not those of the paper's racing runs.
The method
Each outer iteration takes one imitation step, then a safety block whose length grows slowly over training.
Take one gradient step on the behavior-cloning loss J(θ): the performance operator Pη.
The safety filter projects the network’s action at each training state onto its safe action set 𝒞(xᵢ).
Take Kt gradient steps that regress the actions toward those projections, recomputing the projections before every step.
Set Kt = ⌈c log(t + 2)⌉. Logarithmic growth is enough to drive the projection error to zero.
One outer iteration
θt+1 = SβKt(Pη(θt))
Pη is a gradient step on the imitation loss. Sβ is a gradient step on the safety loss Φ, the mean squared distance from the actions to their safe sets. The analysis treats the safety block as an approximate projection in the space of policy outputs.
See Section III and Algorithm 1 ↗Why not a weighted sum?
Summing the imitation and safety gradients descends ℓ + λφ, a quadratic-penalty relaxation. At an active constrained optimum the penalty gradient is zero, so that optimum is not stationary for any finite λ, and the fused solution stays outside the safe set at distance ‖∇ℓ‖/λ. Raising λ also forces a smaller step size.
Analysis
Projection accuracy: with fixed targets and a Polyak–Łojasiewicz-type condition along the block, the projection residual falls geometrically in the number of safety steps (Proposition 1), and a logarithmic schedule drives it to zero (Corollary 1).
Fixed targets: with relative distortion κ in the imitation step, the outputs approach the safe set on the training states and come within κd⋆/(1 − κ) of the constrained optimum (Proposition 2). This requires the projected actions to be exactly representable by the network.
Refreshed targets: recomputing the projections at every safety step removes that requirement. If each step moves the actions consistently toward the safe set (κS < 1), feasibility on the training states is asymptotic, and if κ + κS < 1 the distance to the optimum is at most (κ + κS)d⋆/(1 − κ − κS) (Theorem 1).
The evidence
A linear problem with a known optimum checks the analysis. A nonlinear racing task tests what holds when its assumptions fail.
A network maps the state of a double integrator to a 20-step input plan. The learner sees only gradients of the planning cost and projections of its own plans, never the constrained optimum.
| Weight λ | Gradient steps | Distance to v* | Violating episodes |
|---|---|---|---|
| 0 | 12k | 4.24 | 58% |
| 10 | 4k | 0.39 | 49% |
| 30 | 4k | 0.16 | 24% |
| 100 | 4k | 0.11 | 10% |
| 300 | 4k | 0.13 | 2% |
| 1000 | 4k | 0.19 | 1% |
| Budget c | Gradient steps | Distance to v* | Violating episodes |
|---|---|---|---|
| 1 | 1.2k | 0.18 | 0% |
| 2 | 2.0k | 0.15 | 1% |
| 4 | 3.8k | 0.14 | 0% |
Violating episodes leave the true state bounds in closed loop. Fused training trades safety against optimality through λ, and no weight is safe on every seed within 4000 steps. Every interleaving budget is safe or nearly safe with fewer gradient steps. When corrections are sparse, as with a single-action policy that imitates saturated LQR and needs correction at only 1.5% of states, the step-consistency condition fails and interleaving stalls.
A dynamic bicycle model races on an L-shaped track. A model predictive contouring control (MPCC) expert supplies demonstrations through DAgger. A predictive safety filter supplies the projected actions, during training only.







Reading the panels. Closed-loop trajectories from the 40-start illustration bank. The learned policies use six seeds each at λ = 10 and run with no filter; the experts run once.
Each episode is drawn until its first violation; the final 2.5 s before it are red, and the violation is circled. The headline numbers and the table below use the separate 120-start bank.
| Method | Safety updates | Violating episodes | Lap time (s) |
|---|---|---|---|
| Plain BC on raw demonstrations | — | 55/360 | 5.144 ± .002 |
| Plain BC on filtered demonstrations | — | 24/360 | 5.189 ± .007 |
| Fused | 1 | 149/720 | 5.209 ± .023 |
| Inter (K = 1) | 1 | 84/720 | 5.142 ± .006 |
| Fused (compute matched) | Kt | 41/720 | 5.192 ± .014 |
| Inter (log., fixed) | Kt | 44/720 | 5.142 ± .006 |
| Inter (log., refreshed) | Kt | 7/720 | 5.139 ± .006 |
| Fused, step η/(1 + λ) | 1 | 271/360 | 5.336 ± .039 |
| Primal–dual, final λ ≈ 4.4 | 1 | 56/360 | 5.201 ± .009 |
| Primal–dual, final λ ≈ 19 | 1 | 46/360 | 5.178 ± .020 |
| Inter (K = 7) | 7 | 9/360 | 5.150 ± .020 |


Perspective
Separating task optimization from safety correction turns imitation learning into inexact projected gradient descent in the space of policy outputs. When corrections are dense, the safety steps alone drive the policy toward the constrained optimum.
When corrections are sparse, as in racing, interleaving still yields policies that are safer than penalty-based training at the lap time of unconstrained imitation, with a safety weight that only needs to be large enough.
The guarantees concern the training states, so a runtime filter remains a sensible fallback. Extending them to sparse corrections, through architectures that localize safety updates or safety targets aligned with the expert’s behavior, is left for future work.
Read & build on the work
The manuscript contains the full analysis with proofs, the planning example, and the racing ablations.
Abstract, version history, and metadata.
PDFMethod, analysis, experiments, and proofs.
Prior workA learned safe-set approximation as a source of safety gradients for imitation (IROS 2025).
RelatedProjecting policy updates into a locally feasible region of weight space (IFAC 2026).
Interleaved Projected Gradient Descent for Safe Imitation Learning
Shengfan Cao and Francesco Borrelli
arXiv preprint, 2026.
@misc{cao2026interleaved,
title = {Interleaved Projected Gradient Descent
for Safe Imitation Learning},
author = {Shengfan Cao and Francesco Borrelli},
year = {2026},
eprint = {2610.07167},
archivePrefix = {arXiv},
primaryClass = {eess.SY},
url = {https://arxiv.org/abs/2610.07167}
}