Interpretable Multi Time-scale Constraints in Model-free Deep Reinforcement Learning for Autonomous Driving

Gabriel Kalweit, Maria Hügle, Moritz Werling, Joschka BoedeckerarXiv 2020

Abstract

In many real world applications, reinforcement learning agents have to optimize multiple objectives while following certain rules or satisfying a list of constraints. Classical methods based on reward shaping, i.e. a weighted combination of different objectives in the reward signal, or Lagrangian methods, including constraints in the loss function, have no guarantees that the agent satisfies the constraints at all points in time and can lead to undesired behavior. When a discrete policy is extracted from an action-value function, safe actions can be ensured by restricting the action space at maximization, but can lead to sub-optimal solutions among feasible alternatives. In this work, we propose Constrained Q-learning, a novel off-policy reinforcement learning framework restricting the action space directly in the Q-update to learn the optimal Q-function for the induced constrained MDP and the corresponding safe policy. In addition to single-step constraints referring only to the next action, we introduce a formulation for approximate multi-step constraints under the current target policy based on truncated value-functions. We analyze the advantages of Constrained Q-learning in the tabular case and compare Constrained DQN to reward shaping and Lagrangian methods in the application of high-level decision making in autonomous driving, considering constraints for safety, keeping right and comfort. We train our agent in the open-source simulator SUMO and on the real HighD data set.

Introduction

Reinforcement Learning (RL) agents excel at maximizing a scalar reward signal, but real-world autonomous driving requires balancing complex objectives like safety, traffic rules (e.g., "keep right"), and passenger comfort. Traditional approaches often rely on reward shaping, where negative penalties are added for rule violations. However, this method is notoriously difficult to tune; low penalties may be ignored, while high penalties can lead to overly cautious or "lazy" behavior.

Another common approach, Safe Policy Extraction (SPE), masks dangerous actions during execution. While this prevents immediate accidents, it fails during training because the agent's value function (the Q-function) does not account for these masks. Consequently, an agent might unknowingly enter a state where all future actions are masked, leading to inevitable failure. This paper introduces Deep Constrained Q-learning (CDQN) to address these issues by integrating constraints directly into the learning process.

Methods: Constrained Q-learning

The core innovation of this work is the modification of the standard Q-learning update rule. In standard Q-learning, the agent updates its state-action values by considering the maximum possible value in the subsequent state. CDQN restricts this maximization step to a safe action set ($S_C$):

$$Q^C(s_t, a_t) \leftarrow (1-\alpha)Q^C(s_t, a_t) + \alpha(r + \gamma \max_{a \in S_C(s_{t+1})} Q^C(s_{t+1}, a))$$

The Deep Constrained Q-learning architecture involves computing safe action sets and calculating a constrained Q-function to derive an optimal policy.

Multi-step Constraints and Interpretability

Beyond immediate safety, the framework supports multi-step constraints using truncated value-functions. This allows for constraints defined over a fixed time horizon $H$ (e.g., limiting lane changes over 10 seconds). Unlike rewards, these constraints are not discounted, making them highly interpretable for human engineers. For example, a constraint can be explicitly defined as a hard limit on the number of uncomfortable maneuvers allowed within a specific window.

Experimental Evaluation

The framework was evaluated using two environments:

  1. SUMO (Simulation of Urban MObility): A traffic simulator used for training in controlled scenarios with varying vehicle densities.
  2. HighD Dataset: A real-world dataset of vehicle trajectories from German highways, providing approximately 20,000 transitions to test the agent's ability to learn from human driving behavior.

Key Results

Sample Efficiency

One of the most significant findings is that Constrained Q-learning dramatically reduces the search space for the agent. By ignoring illegal actions during training, the agent converges to an optimal policy much faster than traditional methods.

Comparison of updates required to reach an optimal policy: Constrained Q-learning is significantly more sample-efficient than reward shaping as the complexity (branches) increases.

In tabular experiments, CDQN was found to be up to 10 times more sample-efficient than reward shaping. As shown in the figure above, the number of updates required for reward shaping grows exponentially with the number of branches, while CDQN remains relatively stable.

Safety and Performance

In autonomous driving simulations, CDQN was the only method to achieve high average speeds while maintaining near-zero constraint violations. Compared to Lagrangian methods, CDQN exhibited lower variance and more consistent driving behavior. Furthermore, agents trained on the HighD dataset generalized well to new scenarios, suggesting robustness to the "sim-to-real" gap.

Conclusion and Future Work

Deep Constrained Q-learning provides a robust framework for safe RL by decoupling safety rules from the reward signal. This not only improves sample efficiency but also enhances interpretability. Future work will focus on defining safe action sets in unstructured environments where models like the Intelligent Driver Model (IDM) may not apply, and extending the framework to continuous action spaces for more precise vehicle control.

Summary updated

BibTeX
@misc{kalweit2020interpretable,
  author = {Gabriel Kalweit and Maria Hügle and Moritz Werling and Joschka Boedecker},
  title = {{Interpretable Multi Time-scale Constraints in Model-free Deep Reinforcement Learning for Autonomous Driving}},
  year = {2020},
  eprint = {2003.09398},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2003.09398},
}
Figure