Learning Soft Constraints From Constrained Expert Demonstrations

Ashish Gaurav, Kasra Rezaee, Guiliang Liu, Pascal Poupart

TL;DR: Researchers have developed a new Inverse Constraint Learning (ICL) framework that recovers "soft" constraints—rules satisfied on average rather than strictly—from expert demonstrations. By focusing on cumulative expectations rather than binary "allowed/disallowed" states, the method successfully identifies safety boundaries in complex robotics and real-world highway driving scenarios where traditional methods fail.

The Problem: Beyond Hard Rules

In standard Reinforcement Learning (RL), we usually assume an agent is trying to maximize a specific reward. However, in the real world, experts (like human drivers) don't just maximize "speed" or "efficiency"; they operate within a complex web of constraints, such as "don't get too close to the car in front" or "don't use too much energy."

While Inverse Reinforcement Learning (IRL) tries to figure out the reward an expert is chasing, Inverse Constraint Learning (ICL) tries to figure out the rules they are following. Most existing ICL methods focus on "hard" constraints—binary rules that can never be broken. The problem is that in stochastic, messy environments, hard constraints are often impossible to satisfy 100% of the time. This paper introduces a way to learn soft constraints, which are cumulative and bounded in expectation (e.g., "on average, don't exceed this safety threshold").

How Inverse Constraint Learning (ICL) Works

The authors frame the problem using Constrained Markov Decision Processes (CMDPs). Their approach operates in a two-phase iterative loop:

  1. Policy Optimization: Given a current guess at the constraints, the system finds the best policy that respects them. The authors use a modified version of Proximal Policy Optimization (PPO) that includes a "feasibility projection" to keep the agent within bounds.
  2. Constraint Adjustment: The system compares the agent's behavior to the expert's. If the agent is doing something the expert avoids, the algorithm "tightens" the constraint function for those specific state-action pairs until that behavior becomes "infeasible."

The Secret Sauce: * The Penalty Method: Instead of using the standard Lagrangian min-max optimization (which is notoriously unstable and prone to oscillations), the researchers use a "penalty method" with a ReLU term. This makes training significantly more stable. * Normalizing Flows: They use a density estimator (RealNVP) to identify which trajectories look "expert-like." This allows them to reweight their updates, focusing the learning on the boundary between safe (expert) and unsafe (non-expert) behavior.

Key Findings

The authors tested their method across a diverse range of environments, including synthetic gridworlds, MuJoCo robotics simulations, and real-world highway driving datasets (HighD and ExiD).

  • Interpretability over Rewards: A learned constraint can be visualized as a safety map. In driving tasks, the model clearly learned that the "safe distance" isn't a fixed number—it's a function that grows as the car's velocity increases.
  • Sharpness and Accuracy: In the HighD highway dataset, the model recovered a "sharp" boundary for safe following distances.
Comparison of constraint boundaries learned by GAIL-Constraint, ICRL, and ICL on the HighD dataset.

As shown above, while baselines like GAIL-Constraint and ICRL assigned high constraint values to almost everything (resulting in blurry, overly conservative boundaries), ICL correctly identified the specific "danger zone" that experts avoid.

  • Real-World Logic: In lane-changing scenarios (ExiD), the model correctly learned that lateral velocity is constrained by the distance to the target lane—essentially recovering the "common sense" rule that you shouldn't swerve wildly when you're far from your exit.

Limitations and Future Work

The authors identify three main areas for improvement:

  1. Known Rewards: Currently, the algorithm assumes the reward function is already known. In many real-world cases, we might need to learn both the reward and the constraints simultaneously, which introduces a "chicken and egg" problem of unidentifiability.
  2. Single Constraint: The current framework is designed to learn one single (potentially complex) constraint function. Real-world tasks often involve multiple independent constraints (e.g., fuel, safety, and comfort).
  3. Sub-optimal Experts: The method assumes the expert is nearly perfect. If the expert demonstrations are "noisy" or sub-optimal, the model might learn overly restrictive or incorrect rules.

Future work aims to extend this to multi-expert demonstrations and incorporate entropy regularization to better handle the uncertainty of human behavior.

Summary updated

BibTeX
@inproceedings{gaurav2023learning,
  author = {Ashish Gaurav and Kasra Rezaee and Guiliang Liu and Pascal Poupart},
  title = {{Learning Soft Constraints From Constrained Expert Demonstrations}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=8sSnD78NqTN},
}
Figure