Hostname: page-component-74656f9884-npj9w Total loading time: 0 Render date: 2026-11-07T04:25:18.452Z Has data issue: false hasContentIssue false

Safe option-critic: learning safety in the option-critic architecture

Published online by Cambridge University Press:  07 April 2021

Arushi Jain
Affiliation:
School of Computer Science, Mila - McGill University, Montreal, Quebec E-mail: arushi.jain@mail.mcgill.ca, khimya.khetarpal@mail.mcgill.ca, dprecup@cs.mcgill.ca
Khimya Khetarpal
Affiliation:
School of Computer Science, Mila - McGill University, Montreal, Quebec E-mail: arushi.jain@mail.mcgill.ca, khimya.khetarpal@mail.mcgill.ca, dprecup@cs.mcgill.ca
Doina Precup
Affiliation:
School of Computer Science, Mila - McGill University, Montreal, Quebec E-mail: arushi.jain@mail.mcgill.ca, khimya.khetarpal@mail.mcgill.ca, dprecup@cs.mcgill.ca
Rights & Permissions [Opens in a new window]

Abstract

Designing hierarchical reinforcement learning algorithms that exhibit safe behaviour is not only vital for practical applications but also facilitates a better understanding of an agent’s decisions. We tackle this problem in the options framework (Sutton, Precup & Singh, 1999), a particular way to specify temporally abstract actions which allow an agent to use sub-policies with start and end conditions. We consider a behaviour as safe that avoids regions of state space with high uncertainty in the outcomes of actions. We propose an optimization objective that learns safe options by encouraging the agent to visit states with higher behavioural consistency. The proposed objective results in a trade-off between maximizing the standard expected return and minimizing the effect of model uncertainty in the return. We propose a policy gradient algorithm to optimize the constrained objective function. We examine the quantitative and qualitative behaviours of the proposed approach in a tabular grid world, continuous-state puddle world, and three games from the Arcade Learning Environment: Ms. Pacman, Amidar, and Q*Bert. Our approach achieves a reduction in the variance of return, boosts performance in environments with intrinsic variability in the reward structure, and compares favourably both with primitive actions and with risk-neutral options.

Information

Type
Research Article
Copyright
© The Author(s), 2021. Published by Cambridge University Press
Figure 0

Figure 1

Figure 1. Four-Room (FR) environment: F and G depict the unsafe frozen and goal states, respectively. The lightest colour represents the normal states, whereas the darkest colour represents the wall.

Figure 2

Table 1. Parameters for discrete and continuous environment: Optimized parameters for both four-room and puddle-world environments

Figure 3

Figure 2. Performance in the FR domain. The graphs depict the performance averaged over 50 independent trials, where the vertical bands depict the standard deviation. The plots show (a) the return and (b) the sum of absolute TD error. Safe policy $\psi=0.1$ (red) has a smaller standard deviation as compared to the baseline (black) signifying that safety helps the agent to avoid the variance inducing regions.

Figure 4

Figure 3. Performance with varying variance regularizer in Four-Room (FR) domain. The plot shows the mean and standard deviation of the score in the FR domain with varying controllability regularizer value $\psi$, while keeping all other parameters fixed. The best hyperparameters are chosen such that they not only minimize the standard deviation but also maximize the mean performance, which in this case is achieved by $\psi=0.1$.

Figure 5

Figure 4. State visitation frequency in Four-Room environment. Density graph represents the number of times a state was visited during testing over 80 independent trials. Darker shades of blue represent a higher density. (a) Model without safety has equally likely density for both the hallways. (b) Model with safety shows higher density for the path without the frozen states.

Figure 6

Figure 5. Policy in Four-Room (FR) environment. Sampled trajectories learned with 4 options where S and G represent the start & goal state, respectively. Arrows denote the 4 actions. Agent might take different actions due to environment stochasticity. Change in colour represents the option switching. Same colour represents the same option choice. Purple patch represents the frozen states. (a) depicts the policy with $\psi=0$ passing through the frozen area. (b) depicts the policy learned with $\psi=0.1$ that avoids the frozen area due to the in-built safety constraint.

Figure 7

Figure 6. Converged policy for four options in Four-Room environment. The first four figures in each row depict the intra-option policy for all the four options. The last figure in both the rows shows the policy over the options where the number depicts the different options (numbering of options increases from left to right image in a row). Both the baseline and the Safe OC exhibit that the overall hierarchical policy is more reasonable than the individual option policy, though the overall trend of an individual safe option policy is to avoid the frozen hallway.

Figure 8

Figure 7. Puddle-world environment: The graphs depict the return averaged over 50 independent trials with 2 options. The vertical bands show the standard deviation in the return over multiple trials. The experiment with safe policy $\psi=0.015$ (red) has a smaller standard deviation as compared to the baseline (black), signifying safety helps an agent to avoid variance inducing regions.

Figure 9

Figure 8. Trajectories in Puddle World: The graph shows sampled trajectories from OC policy in (a) & (b), and Safe-OC policy in (c) & (d). With the designed safety constraint, the agent learns to bypass the unsafe central puddle.

Figure 10

Figure 9. Visitation frequency in Puddle-World environment depicts the state visitation frequency averaged over 50 independent trials for a particular episode in the (a) baseline OC and (b) Safe-OC. The graph highlights that the Safe-OC agent’s visit to the unsafe central puddle region decreases in comparison to the OC agent. Our notion of safety enforces the agent to avoid the puddle region.

Figure 11

Table 2. ALE final scores: The performance is averaged over 100 games once the training is completed. The scores are averaged over five independent seeds. Scores in the boxes highlight the performance without controllability function (baseline), whereas aqua highlighted cells indicate the benefits of introducing our notion of safety in learning end-to-end options. Introducing controllability in options outperforms best performances of primitive actions (grey) in two out of three games analyzed here. Learning options with our notion of safety outperforms the baseline A2OC in all three games. A3C scores have been taken from Mnih et al. (2016), DQN from Nair et al. (2015), Double DQN from Van Hasselt et al. (2016), and Duelling from Wang et al. (2015). $\psi$ represents the degree of controllability. Values in the brackets indicate standard deviation across 100 games for 5 independent runs.

Figure 12

Figure 10. Learning curves in Atari games during training demonstrate that options with a controllability factor of $\psi=0.10$ learn better than the best-performing A2OC baseline ($\psi=0$, $\epsilon=0.2$). Higher value of $\psi$ results in a poor performance. Performance is averaged across 5 independent seeds for each game.

Figure 13

Figure 11. Qualitative analysis in MsPacman: Our interpretation is that the Safe-A2OC agent understands the source of intrinsic variability in the reward due to explicitly optimizing for the variance in TD error. This results in Safe-A2OC agent to adopt the strategy of eating the large flashing power pellets, causing the ghosts to flee. The Safe-A2OC agent is able to survive longer and ends up accumulating more cumulative reward as opposed to the baseline A2OC agent. Here, we depict a sampled trajectory of the Safe-A2OC agent in comparison with the baseline A2OC agent.