Abstract
We consider the inverse reinforcement learning (IRL) problem, where an unknown reward function of some Markov decision process is estimated based on observed expert demonstrations. In most existing approaches, IRL is formulated and solved as a nonconvex optimization problem, posing challenges in scenarios where robustness and reproducibility are critical. We discuss a convex formulation of the IRL problem (CIRL) initially proposed by Ng and Russel, and reformulate the problem such that the domain-specific language CVXPY can be applied directly to specify and solve the convex problem. We also extend the CIRL problem to scenarios where the expert policy is not given analytically but by trajectory as state-action pairs, which can be strongly inconsistent with optimality, by augmenting some of the constraints. Theoretical analysis and practical implementation for hyperparameter auto-selection are introduced. This note helps the users to easily apply CIRL for their problems, without background knowledge on convex optimization.
Introduction
Inverse Reinforcement Learning (IRL) is the process of inferring the underlying reward function that an agent is attempting to maximize based on observed behavior. While powerful, many modern IRL algorithms rely on non-convex optimization, which can lead to local optima, sensitivity to hyperparameter tuning, and a lack of reproducibility. These issues are particularly problematic in scientific fields like psychology and neuroscience, where IRL is used to model animal behavior and requires consistent, robust results.
Furthermore, traditional Convex IRL (CIRL) formulations often assume a globally optimal expert. In practice, experts may exhibit inconsistent behavior or pursue shifting subgoals, causing standard convex solvers to fail. This work addresses these challenges by modernizing the CIRL framework for accessibility and robustness.
Methods
The proposed framework introduces three major improvements to CIRL:
- Modern Reformulation: The original CIRL formulation is translated into an $\ell_1$-regularized linear program in epigraph form. This allows the problem to be solved using CVXPY, a domain-specific language for convex optimization, making the tool accessible to researchers without deep optimization expertise.
- Subgoal Relaxation: To accommodate inconsistent expert behavior, the "global optimality" constraint is relaxed. Instead of requiring the expert to be optimal across all states, the framework solves for local optimality within specific trajectory segments. This enables the recovery of rewards even when an agent's goals change over time.
- Automated Hyperparameter Tuning: A bisection-based algorithm is introduced to automatically select the sparsity penalty ($\lambda$), ensuring the recovery of the "simplest" non-trivial reward function without manual guesswork.
Experiments and Results
The approach was evaluated on two simulated environments: a 16x16 Gridworld with stochastic transitions and a 48x48 "Greedy Snake" environment with non-stationary rewards.
In the 16x16 Gridworld, the CIRL solver demonstrated high efficiency and accuracy. The solver completed in just 1.65 seconds, significantly faster than typical non-convex alternatives. The recovered reward function achieved a 0.85 cosine similarity to the ground truth, and the resulting policy matched the expert's actions with 94% accuracy.
For the "Greedy Snake" task, which involves a moving reward, the algorithm successfully identified reward locations across 48 different changes. By partitioning trajectories, each segment was solved in an average of 9 milliseconds, proving the method's effectiveness in non-stationary environments.
Discussion and Conclusion
By leveraging convex optimization, this framework ensures that the solution found is the global optimum, guaranteeing the robustness and reproducibility necessary for scientific modeling. The reduction of the IRL problem to a linear program also provides significant speed advantages over iterative, gradient-based methods.
However, some limitations remain. The current trajectory partitioning assumes known change-points, which might require integration with change-point detection algorithms in fully unsupervised settings. Additionally, while highly efficient for discrete state spaces, extending this convex approach to continuous high-dimensional robotics remains an area for future research. This work revitalizes convex IRL by providing a modern, accessible implementation that handles expert inconsistency and non-stationary rewards, serving as a robust tool for researchers across diverse fields.
Summary updated