Directed Policy Gradient for Safe Reinforcement Learning with Human Advice

Hélène Plisnier, Denis Steckelmacher, Tim Brys, Diederik M. Roijers, Ann NowéarXiv 2018

Abstract

Many currently deployed Reinforcement Learning agents work in an environment shared with humans, be them co-workers, users or clients. It is desirable that these agents adjust to people's preferences, learn faster thanks to their help, and act safely around them. We argue that most current approaches that learn from human feedback are unsafe: rewarding or punishing the agent a-posteriori cannot immediately prevent it from wrong-doing. In this paper, we extend Policy Gradient to make it robust to external directives, that would otherwise break the fundamentally on-policy nature of Policy Gradient. Our technique, Directed Policy Gradient (DPG), allows a teacher or backup policy to override the agent before it acts undesirably, while allowing the agent to leverage human advice or directives to learn faster. Our experiments demonstrate that DPG makes the agent learn much faster than reward-based approaches, while requiring an order of magnitude less advice.

Introduction

Most "human-in-the-loop" reinforcement learning (RL) relies on a-posteriori feedback: the agent performs an action, and a human provides a reward or punishment. This approach is fundamentally unsafe for critical applications. For example, in autonomous driving, punishing a crash after it occurs is insufficient; safety requires directives that can intervene before an undesirable action is taken.

However, incorporating external "overrides" is technically challenging for Policy Gradient (PG) methods. PG is "strongly on-policy," assuming the actions taken are exactly those suggested by its internal model. Forcing a PG agent to take a different action (off-policy) often breaks the underlying mathematics, leading to divergence. Directed Policy Gradient (DPG) bridges this gap, allowing direct intervention without compromising the learning algorithm's stability.

Methods

The core of DPG is a novel neural network architecture and policy-mixing technique that allows the agent to safely incorporate real-time human advice.

  1. Policy Shaping: The agent maintains a mixture of its learned policy ($\pi_L$) and an advisory policy ($\pi_H$) provided by a human or backup system.
  2. The Mixture: The final action-selection policy ($\pi$) is an element-wise multiplication: $\pi \propto \pi_L \times \pi_H$.
  3. Neural Architecture: The network uses a hidden layer with tanh activation and a sigmoid output for the learned component, which is then multiplied by the advice vector and normalized.
  4. Robustness: By training on the resulting mixture using standard Policy Gradient loss, the agent learns to account for the advice it receives. When no advice is available, $\pi_H$ defaults to a uniform distribution.

Experimental Setup

The researchers evaluated DPG using a custom Five Rooms Grid World benchmark. This 29x27 environment is significantly more complex than standard grid worlds. To simulate real-world complexity, the agent utilizes "macro-actions" (e.g., "go to the door of the next room") rather than pixel-by-pixel movement. The environment features sparse rewards, where the agent only receives a large positive reward (+100) upon reaching the goal, making exploration difficult without guidance.

The Five Rooms Grid World environment used for evaluation.

Key Results

DPG demonstrates significant advantages in both learning speed and efficiency compared to traditional reward-based feedback.

  • Learning Efficiency: DPG reached high performance levels much faster than "Reward Shaping" methods. In comparative tests, 700 pieces of advice through DPG led to better performance than 10,000 reward-based punishments.
  • Robustness to Bad Advice: DPG is notably robust to incorrect advice. Unlike value-based methods (like Q-learning) that might get stuck if forced into a bad state, a DPG agent learns the total return. If advice leads to a low-reward state, the agent learns to avoid the preceding states to maximize total reward.
  • Non-Stationary Advice: DPG agents maintain performance even after human intervention ceases, continuing to improve independently.
Comparison of cumulative reward per episode for standard Policy Gradient (PG), PG with human reward, and PG with human advice (DPG).

Conclusion

Directed Policy Gradient offers a robust framework for safe RL by shifting from correcting mistakes to preventing them. By allowing a-priori directives, DPG provides a safety buffer and leverages the high information density of advice over simple rewards. Future work will explore extending DPG to continuous action spaces and handling noisy or inconsistent human advice.

Summary updated

BibTeX
@misc{plisnier2018directed,
  author = {Hélène Plisnier and Denis Steckelmacher and Tim Brys and Diederik M. Roijers and Ann Nowé},
  title = {{Directed Policy Gradient for Safe Reinforcement Learning with Human Advice}},
  year = {2018},
  eprint = {1808.04096},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1808.04096},
}
Figure