TL;DR
This paper introduces a novel Inverse Constraint Learning (ICL) method to recover soft cumulative constraints from expert demonstrations. Unlike prior approaches that focus on rigid, unbreakable "hard" constraints, this method learns constraints that are satisfied on average across trajectories, making it highly effective for stochastic, real-world environments like autonomous driving.
What Problem Does This Paper Address?
In reinforcement learning, we usually assume an expert agent is maximizing a reward function. However, in many real-world scenarios—especially safety-critical ones like robotics or autonomous driving—behavior is dictated not just by what the agent wants to achieve (rewards), but also by what it must avoid (constraints).
Inferring these rules from expert demonstrations is known as Inverse Constraint Learning (ICL). Most existing ICL methods focus on hard constraints (e.g., "never enter this state"). But in the real world, environments are stochastic, sensors are noisy, and experts might occasionally violate a rule. What we need is the ability to learn soft cumulative constraints—rules that must be satisfied on average over the course of an episode (e.g., "do not use more than 3 units of energy on average across all trips"). This paper tackles the challenge of recovering these soft expected constraints when the underlying reward function is known.
Methods
The authors frame their approach using Constrained Markov Decision Processes (CMDPs) and propose a two-phase iterative framework:
- Policy Optimization: Given the current estimate of the constraint function, a forward constrained RL algorithm (a modified version of Proximal Policy Optimization) trains an agent policy to maximize rewards while respecting the constraint.
- Constraint Adjustment: The constraint function is updated to increase the constraint values of the generated agent policies (making them look "infeasible") while ensuring the expert demonstrations remain safely below the allowed threshold.
To make this computationally tractable, the authors introduce two key innovations:
- The Penalty Method: Instead of using standard Lagrangian optimization (which is notorious for training instability and oscillations in min-max setups), they employ a penalty method with a non-differentiable ReLU term to smoothly guide the constraint boundaries.
- Normalizing Flows (RealNVP): When agent and expert behaviors overlap, the algorithm can stall. The authors train a normalizing flow to estimate the density of the expert data, allowing them to reweight trajectories and focus the constraint learning on areas where the agent deviates from the expert.
Datasets
The authors evaluated their method across a variety of simulated and real-world datasets:
- Synthetic Environments: Discrete 7x7 Gridworlds and continuous CartPole variants.
- Robotics Simulations: MuJoCo benchmarks (Ant-Constrained and HalfCheetah-Constrained).
- Real-World Driving: The HighD dataset (naturalistic vehicle trajectories recorded by drones on German highways) and the ExiD dataset (focused specifically on highway lane-changing behavior).
Key Insights and Ideas
- Embracing Average Behavior: Hard constraints break down in stochastic environments because the probability of a violation can rarely be reduced to absolute zero. Bounding constraints in expectation (soft constraints) matches how humans actually navigate safety and resource management.
- Lagrangian Instability: The paper highlights that alternating gradient ascent-descent on a Lagrange multiplier often leads to cyclic, unstable constraint learning. The penalty method offers a much more stable alternative for ICL.
- The Overlap Problem: If an imitation agent successfully copies an expert, their data distributions merge. Without density-based reweighting, the constraint adjustment step receives conflicting signals (trying to simultaneously raise and lower the constraint value on the same state-action pairs).
Key Results
The proposed method was compared against two baselines: GAIL-Constraint and ICRL. Performance was measured using Constraint Mean Squared Error (CMSE) and Normalized Accrual Dissimilarity (NAD).
- Superior Accuracy: The proposed ICL method consistently achieved lower CMSE and NAD scores across almost all environments, demonstrating that it recovers sharper, more accurate constraint boundaries.
- Real-World Driving: In the HighD dataset, the method successfully recovered the intuitive boundary showing that as a car's velocity increases, the required safe following distance must also increase.
- No Over-Constraining: Unlike the baselines, which often marked safe expert states as highly constrained (diffused white areas in the visualizations), the proposed method kept the expert trajectories firmly in the low-constraint zone.
Limitations and Future Work
- Assumed Rewards: The current framework requires the nominal reward function to be known beforehand. Simultaneously learning both rewards and constraints remains an open, highly unidentifiable problem.
- Single Constraint Limitation: The algorithm is currently designed to learn only a single constraint function at a time.
- Computational Overhead: Because the method relies on an outer loop that alternates between full forward RL training and constraint adjustment, it requires more training steps and time than direct imitation learning baselines.
- Future Directions: The authors suggest extending the method to handle sub-optimal expert demonstrations, learning multiple constraints, and exploring purely probabilistic constraint formulations (e.g., ensuring a constraint holds with a probability $\ge p$).
Summary updated