                                                                               Safety-Polarized and Prioritized Reinforcement Learning





Table 1. SPOM PER achieves the best safety-reward tradeoff in terms of SWU score, while SPOM performs the best among the

remaining safe-RL baselines.



                                    SWU Score ↑                                              TwoWay                Merge              Roundabout                             Intersection              ACC           Circle                         Overall

                                    SPOM PER (ours)                                                  0.98            0.94                  1.22                                    0.68                 1.07               0.96                      0.98

                                    SPOM (ours)                                                      0.88            0.95                  0.40                                    0.96                 0.87               0.37                      0.74

                                    SafeQ                                                            0.73            0.84                  0.63                                    0.75                 0.50               0.15                      0.60

                                    Recovery                                                         0.34            0.66                  0.81                                    0.66                 0.85               0.25                      0.60

                                    RCDQN                                                            0.41            0.81                  0.48                                    0.57                 0.46               0.14                      0.48

                                    RewsDQN                                                          0.33            0.92                  0.48                                    0.50                 0.47               0.11                      0.47

                                    DQN                                                              0.37            0.56                  0.48                                    0.58                 0.46               0.13                      0.43



                                     TwoWay                                                                        Merge                                                           Roundabout                                                         Intersection

                     12                                                                                                                                             1.6                                                              6

                                                                                           2.00

                     11                                                                    1.75                                                                     1.4

                                                                                                                                                                    1.2                                                              5

    Episode Reward









                                                                          Episode Reward









                                                                                                                                                   Episode Reward









                                                                                                                                                                                                                    Episode Reward

                     10                                                                    1.50

                      9                                                                    1.25                                                                     1.0                                                              4

                      8                                DQN

                                                       RCDQN                               1.00                                                                     0.8                                                              3

                      7                                Recovery                            0.75                                                                     0.6

                      6

                                                       RewsDQN

                                                       SafeQ                               0.50                                                                     0.4                                                              2

                      5

                                                       SPOM(ours)

                                                       SPOM_PER(ours)

                                                                                           0.25                                                                     0.2                                                              1

                                                                                           0.00                                                                     0.0

                       0.0    0.2   0.4          0.6    0.8         1.0                        0.0     0.2   0.4          0.6   0.8      1.0                           0.0   0.2   0.4          0.6   0.8     1.0                     0.0     0.2     0.4           0.6   0.8     1.0

                                          Step                    1e5                                              Step                1e5                                               Step               1e5                                              Step               1e5

                                      TwoWay                                                                   Merge                                                               Roundabout                                                          Intersection

                     1.0                               DQN

                                                       RCDQN                               0.8                                                                      0.4                                                              0.5

                     0.8                               Recovery

                                                       RewsDQN

                                                                                           0.6                                                                      0.3                                                              0.4

    Crash Rate









                                                                          Crash Rate









                                                                                                                                                   Crash Rate









                                                                                                                                                                                                                    Crash Rate

                                                       SafeQ

                     0.6                               SPOM(ours)

                                                                                                                                                                                                                                     0.3

                                                       SPOM_PER(ours)

                                                                                           0.4                                                                      0.2

                     0.4                                                                                                                                                                                                             0.2

                     0.2                                                                   0.2                                                                      0.1

                                                                                                                                                                                                                                     0.1

                     0.0                                                                   0.0                                                                      0.0                                                              0.0

                        0.0   0.2   0.4          0.6    0.8         1.0                       0.0      0.2   0.4          0.6   0.8      1.0                           0.0   0.2   0.4          0.6   0.8     1.0                       0.0    0.2     0.4          0.6   0.8     1.0

                                          Step                    1e5                                              Step                1e5                                               Step               1e5                                              Step               1e5



Figure 1. Training curves of SPOM, SPOM PER and baselines in the four tasks from highway-env. The x-axis represents the number of

steps, and the y-axis: the first row is episode reward (higher is better); the second row is safety measured in crash rate (lower is better).

All experiments are run over 6 random seeds and the shaded areas are 95% confidence interval.



             a crash occurs, which is a strong penalty, and we label                                                                                          common CMDP-based RL is built on an actor-critic frame-

             the reward-shaped DQN variant as RewsDQN.                                                                                                        work. For completeness and clarity of presentation, we add

   • Direct ε-Masking. This is the SafeQ (Srinivasan et al.,                                                                                                  additional CMDP-based approaches RESPO (Ganai et al.,

     2020) as discussed before, which masks out the actions                                                                                                   2023), PPOLag (Ray et al., 2019), which use Proximal Pol-

     whose estimated unsafe probability by a safety critic is                                                                                                 icy Optimization (PPO) (Schulman et al., 2017) as the base

     greater than ε. The original actor-critic based algorithm                                                                                                RL algorithm, in Appendix C.3, where we find that they fail

     in Srinivasan et al. (2020) is modified to be DQN-                                                                                                       to optimize under our environments since the cost signal

     based.                                                                                                                                                   corresponding to a crash is very sparse. The detailed imple-

                                                                                                                                                              mentations and hyperparameters of these baselines and our

   • Recovery RL. Originated from Thananjeyan et al.                                                                                                          algorithm SPOM and its safety prioritized experience replay

     (2020), labeled as Recovery here, this corresponds                                                                                                       version SPOM PER are provided in Appendix C.2. Eval-

     to the action correction approach, where a task policy                                                                                                   uation Metric. To clearly quantify the trade-off between

     selects an action, but if the estimated unsafe probability                                                                                               rewards and safety, we follow Yu et al. (2022b) and com-

     from a safety critic is greater than ε, the action will be                                                                                               pute the safety-weighted-utility (SWU) score as the final

     corrected by a learned recovery policy. The task policy                                                                                                  evaluation metric. The SWU score is defined as:

     and recovery policy are implemented via DQN.

                                                                                                                                                                              n UnsafeRateTarget o      Utility

   • CMDP-based RL. We choose the reward constrained

                                                                                                                                                                    SWU := min 1,                  ·               ,

     approach in Tessler et al. (2019) which constrains the                                                                                                                       UnsafeRate         UtilityBaseRL

     reward through r − λc, where λ is the Lagrange mul-

     tiplier and c is the cost signal corresponding to crash.                                                                                                 where BaseRL refers to the unconstrained RL algorithm

     Then we use DQN to learn upon this constrained re-                                                                                                       DQN in our experiments. We choose the Utility to be the

     ward. We denote this baseline by RCDQN.                                                                                                                  episode reward, and UnsafeRate is the crash rate. The

                                                                                                                                                              UnsafeRateTarget is chosen as the minimal crash rate

For SafeQ and Recovery, the parameter ε is chosen to be                                                                                                       among the compared methods for each environment, since

0.1 throughout experiments. Note that the above baselines                                                                                                     we aim at achieving the maximal safety. To reduce variance,

are implemented via DQN for fair competition, while the                                                                                                       Utility, UnsafeRate and UnsafeRateTarget are averaged



                                                                                                                                               7

