Abstract
We propose Convex Constraint Learning for Reinforcement Learning (CoCoRL), a novel approach for inferring shared constraints in a Constrained Markov Decision Process (CMDP) from a set of safe demonstrations with possibly different reward functions. While previous work is limited to demonstrations with known rewards or fully known environment dynamics, CoCoRL can learn constraints from demonstrations with different unknown rewards without knowledge of the environment dynamics. CoCoRL constructs a convex safe set based on demonstrations, which provably guarantees safety even for potentially sub-optimal (but safe) demonstrations. For near-optimal demonstrations, CoCoRL converges to the true safe set with no policy regret. We evaluate CoCoRL in gridworld environments and a driving simulation with multiple constraints. CoCoRL learns constraints that lead to safe driving behavior. Importantly, we can safely transfer the learned constraints to different tasks and environments. In contrast, alternative methods based on Inverse Reinforcement Learning (IRL) often exhibit poor performance and learn unsafe policies.
Introduction
Specifying safety rules for autonomous agents is a notoriously difficult engineering challenge. In Reinforcement Learning (RL), safety is typically modeled using Constrained Markov Decision Processes (CMDPs), where an agent seeks to maximize a reward while keeping the expectation of certain cost functions below a threshold. However, hand-coding these constraints is often as error-prone as hand-coding reward functions.
Learning constraints from human demonstrations is a promising alternative, but existing methods rely on the unrealistic assumption that the expert's reward function is known. In real-world scenarios like autonomous driving, we observe many agents who share the same safety constraints (e.g., avoiding collisions) but have diverse, unknown goals. This paper introduces CoCoRL to address this gap, providing a method to infer transferable safety boundaries without knowledge of underlying rewards.
Methodology: Convex Constraint Learning
CoCoRL shifts the focus from reward-guessing to the geometric properties of safe policies. The core insight is that in a CMDP, the set of all safe policies—represented by their feature expectations—is convex.
The CoCoRL Pipeline
- Feature Expectations: Every expert demonstration is summarized as a vector of feature expectations, representing the cumulative discounted frequency of visiting specific state-action features.
- Convex Hull Construction: Since all demonstrations are assumed to be safe, any policy that lies within the convex hull of these expert feature expectations is also guaranteed to be safe. CoCoRL constructs this hull to define an "inferred safe set."
- Constraint Optimization: The inferred safe set is translated into a set of linear constraints. When a new task (reward function) is presented, the agent optimizes its policy using standard constrained RL techniques while strictly staying within this learned boundary.
Unlike Inverse Reinforcement Learning (IRL), which often forces deterministic solutions that can violate stochastic safety requirements in CMDPs, CoCoRL's geometric approach naturally accommodates the stochasticity required for safety.
Experimental Evaluation
The authors evaluated CoCoRL against several baselines, including Average IRL, Shared Reward IRL, and Idealized Imitation Learning (IL). Testing was conducted in two primary domains:
- Gridworld: A tabular environment used to verify mathematical convergence and safety guarantees.
- Highway-env: A continuous-state driving simulator where agents must navigate a four-way intersection while obeying speed limits and avoiding collisions.
Key Results and Discussion
CoCoRL demonstrated superior performance in both safety and transferability. In the driving simulator, CoCoRL achieved high returns while maintaining a 0% constraint violation rate, even when transferred to entirely new tasks or environments with different traffic dynamics.
As shown in the results, baseline IRL and IL methods frequently failed to maintain safety, especially during transfer. Because CoCoRL disentangles safety constraints from specific task rewards, it can learn "how to drive safely" from a driver going to a store and apply that knowledge to an agent tasked with commuting to an office.
Conclusion and Future Work
CoCoRL provides a robust framework for learning safety constraints from diverse demonstrations with unknown rewards. By leveraging the convexity of safe policy sets, it offers theoretical safety guarantees that standard imitation and inverse reinforcement learning methods lack. Future research will focus on relaxing the assumption of perfectly safe demonstrations and learning feature representations directly from high-dimensional sensor data.
Summary updated