Deep Inverse Q-learning with Constraints

Gabriel Kalweit, Maria Hügle, Moritz Werling, Joschka Boedecker

Abstract

Popular Maximum Entropy Inverse Reinforcement Learning (IRL) approaches require the computation of expected state visitation frequencies for the optimal policy under an estimate of the reward function. This usually requires intermediate value estimation in the inner loop of the algorithm, slowing down convergence considerably. In this work, we introduce a novel class of algorithms that only needs to solve the MDP underlying the demonstrated behavior once to recover the expert policy. This is possible through a formulation that exploits a probabilistic behavior assumption for the demonstrations within the structure of Q-learning. We propose Inverse Action-value Iteration (IAVI), which is able to fully recover an underlying reward of an external agent in closed-form analytically. We further provide an accompanying class of sampling-based variants which do not depend on a model of the environment. We show how to extend this class of algorithms to continuous state-spaces via function approximation and how to estimate a corresponding action-value function, leading to a policy as close as possible to the policy of the external agent, while optionally satisfying a list of predefined hard constraints. We evaluate the resulting algorithms on the Objectworld benchmark and the SUMO traffic simulator, showing significant speedups and effective constraint satisfaction.

Introduction

Inverse Reinforcement Learning (IRL) aims to find a reward function that explains observed expert behavior. While Maximum Entropy (MaxEnt) IRL is a robust standard, it is computationally expensive due to a nested loop structure: an outer loop updates the reward function, while an inner loop must solve the entire Reinforcement Learning (RL) problem for that specific reward. This makes it prohibitively slow for complex, high-dimensional tasks.

Furthermore, standard IRL methods are often "copycats"—they struggle to adapt when the learner must follow new rules or constraints, such as traffic laws, that the expert might have ignored or that were absent in the training environment. This paper introduces a more efficient way to perform IRL by integrating it directly into the Q-learning framework.

Methods: Deep Constrained Inverse Q-learning

The authors bridge the gap between IRL and Q-learning by introducing a "solve once" paradigm. By assuming the expert follows a stochastic Boltzmann distribution over optimal Q-values, the relationship between action probabilities and rewards becomes a linear system. This allows for reward recovery without the iterative inner loop.

The DCIQL pipeline: Expert demonstrations and new constraints are processed to compute an optimal imitation policy that respects the constraints.

The framework evolves through several variants:

  1. IAVI (Inverse Action-value Iteration): The core mathematical contribution, recovering the reward function analytically in closed-form.
  2. IQL (Inverse Q-learning): A model-free, sampling-based version using "Shifted Q-functions" to estimate values without a transition model.
  3. DIQL (Deep Inverse Q-learning): Extends the approach to continuous state spaces using deep neural networks as function approximators.
  4. DCIQL (Deep Constrained Inverse Q-learning): Incorporates hard constraints directly into the Q-function update, allowing the agent to imitate style while strictly adhering to safety or legal boundaries.

Experimental Evaluation

The researchers evaluated their algorithms on two primary platforms to test both discrete and continuous state-space performance.

Experimental benchmarks: (a) The Objectworld grid-world environment and (b) the SUMO traffic simulator setup for autonomous lane-changing.
  • Objectworld: A standard IRL benchmark consisting of a grid map with various colored objects. The agent's goal is to navigate based on the proximity to specific object types.
  • SUMO (Simulation of Urban MObility): A high-fidelity traffic simulator. The authors used a highway scenario to train an agent on autonomous lane-changing behavior using data equivalent to just 30 minutes of human demonstrations.

Key Results and Insights

The core "aha moment" of this research is that local probabilistic behavior models allow the MDP to be solved once during reward recovery. This leads to massive efficiency gains: on the Objectworld benchmark, IAVI achieved convergence in 0.03 hours, compared to 8.08 hours for standard MaxEnt IRL—a speedup of roughly 270x.

In the SUMO simulator, the DCIQL agent demonstrated the power of "Constrained Transfer." By taking "unconstrained" demonstrations (representing US driving style) and applying "keep right" constraints (representing German traffic laws), the agent successfully merged the expert's style with the new legal requirements. DCIQL achieved zero constraint violations while maintaining high performance, whereas agents trained without the constrained component frequently violated the rules.

Conclusion and Future Work

Deep Inverse Q-learning offers a significant leap in IRL efficiency and flexibility. While the mathematical derivation relies on the expert following a Boltzmann (softmax) distribution, its ability to handle hard constraints and achieve orders-of-magnitude speedups makes it a powerful tool for real-world applications like autonomous driving. Future directions may include extending this framework to multi-agent settings or identifying hidden constraints in expert behavior rather than just enforcing predefined ones.

Summary updated

BibTeX
@inproceedings{kalweit2020deep,
  author = {Gabriel Kalweit and Maria Hügle and Moritz Werling and Joschka Boedecker},
  title = {{Deep Inverse Q-learning with Constraints}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2020},
  url = {https://openreview.net/forum?id=ALvGnQdHXqB},
}
Figure