Research
Learning Unknown Constraints without Unsafe Data via Optimality and Counterfactual Regularization
Robots deployed in safety-critical settings must respect constraints, but writing those constraints by hand is hard, so researchers instead infer them from expert demonstrations.

- arXiv
- 2610.09350 · Preprint · not peer-reviewed
- Published
- 2026-10-07
- Authors
- Zhouyu Zhang, Chih-Yuan Chiu, Glen Chou
In plain words
Robots deployed in safety-critical settings must respect constraints, but writing those constraints by hand is hard, so researchers instead infer them from expert demonstrations.
AI summary
Overview
Research area: Robotics and safe control — specifically learning from demonstration (LfD), constrained inverse optimal control (CIOC), and inverse constrained reinforcement learning (ICRL).
Technical level: Advanced. The paper assumes familiarity with constrained Markov decision processes, Karush–Kuhn–Tucker (KKT) optimality conditions, Lagrangian duality, and offline imitation learning objectives such as distribution matching.
Scope (one sentence): The paper proposes CF-KKT, a framework that recovers unknown constraints from constraint-satisfying expert demonstrations by combining a locally learned dynamics model with KKT-inspired optimality losses and synthetic counterfactual trajectories, avoiding both known-dynamics assumptions and unsafe exploratory data.
What This Paper Is About
Robots deployed in safety-critical settings must respect constraints, but writing those constraints by hand is hard, so researchers instead infer them from expert demonstrations. Existing methods force a trade-off: CIOC-style methods are data-efficient but need known, differentiable dynamics and structured constraint forms, while ICRL-style methods handle unknown dynamics and neural constraints but often need online exploration or a dataset that already contains constraint-violating behavior. This paper aims to get both advantages at once — flexible neural constraints under unknown dynamics, learned only from safe, constraint-satisfying expert data.
Key Contributions
-
A two-stage parametric pipeline for known constraint families. When the constraint has a closed-form parameterization, the authors first fit a local dynamics model from the demonstrations alone, then run a CIOC-based mixed-integer program (MIP) using the learned dynamics to recover the unknown constraint parameter.
-
Counterfactual KKT (CF-KKT) for neural constraints. For unknown constraint geometry, they combine a transition-wise KKT-inspired loss on expert data with a synthetic counterfactual loss built from model-generated, reward-improving rollouts near the demonstrations — providing evidence about infeasible regions without ever executing an unsafe trajectory.
-
A sensitivity analysis to dynamics misspecification. They characterize how errors in the learned dynamics propagate into the recovered constraints (MIP sensitivity analysis in the appendix, plus a supporting lemma).
-
Empirical evaluation across low- and high-dimensional systems with black-box dynamics. They report improved constraint recovery and downstream safety versus offline ICRL baselines while structurally using less data, all of it safe.
Main Findings
-
Parameter recovery is accurate when KKT residuals are small. In the known-parametric setting, the MIP approach recovers θ* = 0.04 as 0.0484 on Swimmer (error +0.0084), θ* = 64 exactly on Quadcopter (error 0), and θ* = −3.0 as −2.98 on HalfCheetah (error +0.02).
-
Larger residuals correlate with larger recovery error. On BlockedAnt the estimate is −2.05 against a true −3.0 (error +0.95), which the authors attribute to larger KKT residuals in that environment's demonstrations.
-
The parametric family alone does not determine the answer. Parametric ICSDICE, trained on the same scalar family c_θ(x) = θ − x_pos and additionally given suboptimal trajectories, estimates −1.23 on HalfCheetah and −3.99 on BlockedAnt, showing that an occupancy-based objective can land far from the MIP estimate on the same constraint family.
-
Positive counterfactual advantage implies infeasibility (Lemma 1). If a counterfactual control sequence achieves strictly higher value-augmented return than the expert controls from the same state, then at least one step of that counterfactual must violate the constraint. This is the formal justification for treating high-return counterfactuals as synthetic infeasible data.
-
Full-trajectory KKT residuals were numerically unusable. The authors report that training with the full trajectory KKT residual produced Inf/NaN losses on BlockedAnt and HalfCheetah and collapsed cumulative reward on the other environments, which they attribute to instability in the cross-time dynamics-multiplier recursion; this motivated the transition-wise formulation actually used.
-
Counterfactual selection is empirically reliable but only approximate. The lemma's assumptions are sufficient conditions, not guarantees, so positive advantage is used as a soft selection criterion; the appendix reports high state-level precision among selected counterfactuals.
-
Quantitative maze and MuJoCo results are not in the provided text. The paper states that CF-KKT is evaluated on four 2D continuous mazes (Obstacle, Wide, Disk, Zigzag) with double-integrator dynamics and on high-dimensional MuJoCo tasks, and claims improved safety and data efficiency over offline ICRL baselines, but the truncated content does not include those numerical tables.
Methodology in Plain English
The starting point is a set of expert trajectories that are assumed to be both reward-maximizing and constraint-satisfying. Three pieces are then assembled:
-
Learn the dynamics locally. A differentiable model f̂(x, u; ψ) is fit by plain squared-error regression on the expert transitions (x_t, u_t, x_{t+1}). This replaces the "known dynamics" assumption of classical CIOC.
-
Write down what optimality would look like. For a constrained optimal control problem, KKT conditions say the gradient of the Lagrangian with respect to states and controls must vanish, the constraint must be satisfied, and the multiplier must be nonnegative and complementary to the constraint. The authors build a per-transition Lagrangian using bounded auxiliary multipliers — λ̃ = λ_max · σ(ĉ) so it is automatically nonnegative and grows as the constraint approaches zero, and ν̃ = ν_max · tanh(η) so the dynamics multiplier stays bounded — and penalize the stationarity residual squared, plus primal violation, plus complementary-slackness violation, plus a regularizer keeping the constraint from being hugely negative everywhere on expert data.
-
Invent safe "what-if" data. Expert data alone says nothing about where the constraint boundary is, since all of it is feasible. So the method takes short windows of H expert transitions, perturbs the expert actions with clipped Gaussian noise, and rolls the perturbed and unperturbed action sequences forward through the learned dynamics from the same starting state. A learned value function V̂ (estimated from expert return-to-go) is appended so short rollouts do not misrank states with poor futures. Only rollouts whose value-augmented return beats the expert-action baseline are kept, and on those the learned constraint is pushed above a positive margin m, averaged over the rollout. Total loss is a weighted sum of the KKT loss and the counterfactual loss.
The same infrastructure serves the simpler case: if the constraint's parametric form is known, the learned dynamics feed a mixed-integer program that solves for the parameter directly.
Why This Matters
Impact on research. The paper bridges two literatures that had drifted apart. It shows that the KKT machinery of CIOC — normally restricted to analytically known dynamics — can be carried over to black-box systems via a learned local model, and that the coverage problem that forces ICRL methods to gather bad data can instead be solved by rolling out a model. The sensitivity analysis also gives the community a way to reason about how dynamics-model error propagates into constraint estimates, which is rarely quantified.
Real-world applications:
- Autonomous driving: inferring lane and safety-envelope constraints from human driving logs without ever collecting crash or near-miss data.
- Warehouse and mobile robot fleets: learning keep-out regions around equipment or people from operator demonstrations, where deliberately violating them for data collection is unacceptable.
- Surgical and assistive robotics: recovering implicit safety constraints from expert clinician demonstrations, where the "unsafe" class of data cannot ethically be gathered.
- Industrial process and aerial control: inferring actuator or state limits on platforms (the paper tests a Quadcopter) where exploratory violations could damage hardware.
Industry relevance. The main selling point for practitioners is the data requirement: only safe, constraint-satisfying demonstrations are needed, and the evaluations use a single expert trajectory for dynamics fitting and parameter recovery in the parametric setting (ICSDICE, by contrast, also needs suboptimal, potentially violating trajectories). That removes a costly and often risky data-collection step from deployment pipelines for safety-critical autonomy.
Future Directions
- Closing the theory–practice gap in counterfactual selection. Lemma 1 requires a globally optimal expert and true dynamics and a true value function; the implementation uses learned f̂ and V̂ and treats positive advantage as a soft filter. Tightening this into a guarantee under model error is the obvious open problem.
- Better handling of dynamics-model error. The paper characterizes sensitivity to misspecification, but the BlockedAnt result (−2.05 versus −3.0) shows that residual KKT error in demonstrations still degrades recovery. Improving the local dynamics model, or making the inference robust to it, is a direct next step.
- Extending beyond the transition-wise approximation. Full-trajectory KKT conditions were numerically unstable in this work. A stable way to enforce the cross-time coupling through ν_t would use more of the optimality structure than the per-transition relaxation does.
- Relaxing the remaining assumptions. The main text assumes a known reward (an unknown-reward case is deferred to an appendix) and demonstrations that are locally optimal; extending to suboptimal or heterogeneous demonstrators, and testing on real hardware rather than simulation, are natural follow-ups.
Target Audience
Robotics and control researchers working on learning from demonstration, safe reinforcement learning, or inverse optimal control who want constraint inference without unsafe data collection; graduate students who already know constrained MDPs and KKT conditions and want to see them combined with learned dynamics; and practitioners in safety-critical autonomy who need to extract constraints from expert logs alone. Readers without a background in constrained optimization will find the KKT-based losses difficult, though the counterfactual idea itself is intuitive.
Authors’ abstract
Learning from demonstrations (LfD) provides a framework for inferring unknown constraints from locally optimal, constraint-satisfying expert behavior. Existing approaches largely fall into two paradigms, constrained inverse optimal control (CIOC) and inverse constrained reinforcement learning (ICRL). CIOC exploits optimality conditions such as the Karush--Kuhn--Tucker (KKT) conditions but typically assumes known dynamics and structured constraint representations. Meanwhile,…
The full abstract on arXivRelated papers
- Learning Keypoint Constraints from Visual Demonstrations for Safe Motion Planning 2026-10-13 · cs.RO · Also by Glen Chou, Zhouyu Zhang
- Planning to Learn: Real-Time Robust Adaptive Control on the GPU with Guaranteed Future Learning 2026-10-14 · cs.RO · Also by Glen Chou
- VerifLM: Physically Verified Image-Edit-Guided Goal Pose Generation for Robotic Manipulation 2026-11-02 · cs.RO · Also by Glen Chou
- Pareto-Optimal Entropy-Regularized Trajectory Optimization 2026-10-06 · cs.RO · Key terms of the title in common
- Adaptive Whole-Body MPC with Optimal Posture Planning for Humanoid Robots under Unknown Payloads 2026-10-09 · cs.RO · Key terms of the title in common