Model-based Reinforcement Learning from Signal Temporal Logic Specifications

Parv Kapoor, Anand Balakrishnan, Jyotirmoy V. DeshmukharXiv 2020

TL;DR

This paper tackles the challenge of designing robust robot controllers by replacing traditional, often problematic, reward functions with formal specifications using Signal Temporal Logic (STL). They combine model-based reinforcement learning with model predictive control to learn a system's dynamics and then optimize actions to satisfy these STL specifications, demonstrating success in robotics and autonomous driving simulations.

What Problem Does This Paper Address?

Designing effective reward functions for reinforcement learning (RL) agents is notoriously difficult. Poorly designed rewards can lead to "reward hacking," where agents learn policies that exploit the reward function to achieve high scores without actually performing the desired task, potentially leading to unsafe or undesirable behavior. This is particularly critical in safety-sensitive applications like autonomous driving. While formal methods offer a way to precisely specify desired behavior, integrating them with RL for complex, real-world systems remains a challenge, especially in achieving sample efficiency and scalability.

Methods

The core of this work lies in a two-pronged approach:

  1. Learning a Deterministic System Dynamics Model: They use deep neural networks to learn an approximate, deterministic model of the system's dynamics. This model takes a current state and an action as input and predicts the next state. This is achieved by collecting transition data (state, action, next state) from simulations and training the neural network using supervised learning (minimizing squared error).
  2. Model Predictive Control (MPC) with STL Specifications: The learned dynamics model is then integrated into a model predictive control framework. For a given STL specification (e.g., "always stay within these bounds"), they use a black-box optimizer (specifically, CMA-ES, a type of evolutionary strategy) to search for a sequence of actions over a finite horizon. This search aims to maximize the robustness of the predicted trajectory against the STL specification. The robustness quantifies how well the trajectory satisfies the specification, with positive values indicating satisfaction and negative values indicating violation. At each time step, only the first action from the optimized sequence is executed, and the process repeats (receding horizon).

Datasets

The paper does not introduce new datasets. Instead, they use existing simulation environments for training and evaluation:

  • Cartpole: A classic control problem where a pole is balanced on a cart.
  • Mountain Car: A task where a car needs to reach the top of a hill.
  • FetchReach: A robotics task involving a Fetch manipulator arm.
  • Adaptive Cruise Control (ACC): A simulated highway scenario with an ego car and an adversarial car.
  • Parking Lot: A simulation for autonomous parking.

The transition data for training the dynamics models is generated by running random controllers within these environments.

Key Insights and Ideas

  • STL as a Superior Alternative to Reward Functions: The paper strongly advocates for using Signal Temporal Logic (STL) specifications as a more robust and less exploitable way to define desired robot behavior compared to traditional reward functions. STL allows for precise, temporal, and quantitative specification of complex tasks.
  • Deterministic Dynamics Models Suffice for Complex Tasks: Surprisingly, they found that a deterministic deep neural network model of system dynamics was sufficient for achieving good performance, even in scenarios with adversarial elements (like ACC). This suggests that for many real-world systems, capturing the average dynamics is enough for effective control, and the time-invariant nature of noise might play a role.
  • Combining MBRL and MPC for Sample Efficiency and Robustness: By learning a model first (MBRL) and then using it within an MPC framework optimized for STL robustness, they achieve a method that is both more sample-efficient than model-free RL and capable of synthesizing controllers that provably satisfy complex temporal specifications.

Key Results

The paper demonstrates the efficacy of their approach across several simulated environments:

  • Cartpole: Achieved a robustness value close to the theoretical maximum, indicating successful balancing, and consistently attained the maximum possible reward under the standard reward scheme.
  • Mountain Car: The controller achieved the problem's success criterion (a reward of 90.0) without the reward function explicitly encoding this, solely by optimizing for the STL specification.
  • FetchReach: Demonstrated a positive average reward and a 100% success rate in reaching the goal.
  • Adaptive Cruise Control: Achieved a consistently positive robustness value, indicating safe operation within the specified relative distance bounds, even with an adversarial car.
  • Parking Lot: Showed success in reaching the target parking spot with high precision.

The paper also includes a table (Table I) detailing hyperparameters and average results (robustness and vanilla rewards) across multiple runs for each environment, generally showing strong performance.

Limitations and Future Work

  • Deterministic Model Assumption: While effective in their case studies, the reliance on a deterministic dynamics model might be a limitation for systems with highly stochastic or time-varying noise. The authors acknowledge that the minor loss of robustness in Cartpole is attributed to environmental stochasticity.
  • Computational Cost of Optimization: The use of CMA-ES for optimization can be computationally intensive, especially for longer horizons or more complex action spaces.
  • Generalizability of Learned Models: While deep neural networks offer good generalization, the performance of the learned model is still dependent on the quality and coverage of the training data.

Future work could explore:

  • Extending the approach to handle stochastic dynamics models.
  • Investigating more efficient optimization techniques for MPC.
  • Applying the framework to real-world robotic systems.
  • Exploring more complex STL specifications and their integration.

Summary updated

Abstract

Techniques based on Reinforcement Learning (RL) are increasingly being used to design control policies for robotic systems. RL fundamentally relies on state-based reward functions to encode desired behavior of the robot and bad reward functions are prone to exploitation by the learning agent, leading to behavior that is undesirable in the best case and critically dangerous in the worst. On the other hand, designing good reward functions for complex tasks is a challenging problem. In this paper, we propose expressing desired high-level robot behavior using a formal specification language known as Signal Temporal Logic (STL) as an alternative to reward/cost functions. We use STL specifications in conjunction with model-based learning to design model predictive controllers that try to optimize the satisfaction of the STL specification over a finite time horizon. The proposed algorithm is empirically evaluated on simulations of robotic system such as a pick-and-place robotic arm, and adaptive cruise control for autonomous vehicles.
BibTeX
@misc{kapoor2020model,
  author = {Parv Kapoor and Anand Balakrishnan and Jyotirmoy V. Deshmukh},
  title = {{Model-based Reinforcement Learning from Signal Temporal Logic Specifications}},
  year = {2020},
  eprint = {2011.04950},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2011.04950},
}
Figure