                                               Safety-Polarized and Prioritized Reinforcement Learning



                                 1e1                 Acc                                                  1e2                 Circle

                                 8

                                                                                                      3.0

                                 7

                                                                                                      2.5

                Episode Reward









                                                                                     Episode Reward

                                 6

                                 5                                                                    2.0

                                                                  SPOM(ours)                          1.5

                                 4                                SPOM_PER(ours)

                                 3                                RewsDQN

                                                                  DQN

                                                                                                      1.0

                                 2                                RCDQN

                                                                  Recovery

                                                                                                      0.5

                                 1                                SafeQ                               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

                                                     Step                    1e6                                              Step                 1e6

                                  1e-1               Acc                                              1e-1                   Circle

                                 10                               SPOM(ours)                          8

                                                                  SPOM_PER(ours)

                                                                  RewsDQN

                                  8                               DQN                                 6

                                                                  RCDQN

                Crash Rate









                                                                                     Crash Rate

                                                                  Recovery

                                  6                               SafeQ                               4

                                  4

                                                                                                      2

                                  2

                                                                                                      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                    1e6                                              Step                 1e6

Figure 2. Training curves of SPOM, SPOM PER and baselines in the classical safe control tasks: ACC and Circle. 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).



              1

over the last 10 training steps (Yu et al., 2022b).2                                        SPOM PER is relatively small in these tasks, which we at-

                                                                                            tribute to the shorter episode lengths in the highway environ-

6.2. Main Results                                                                           ment, reducing the impact of the prioritization mechanism.

                                                                                            Compared to baselines, SafeQ performs moderately well in

First, our proposed algorithms, SPOM PER and SPOM,                                          Merge and Intersection but struggles to achieve competitive

consistently achieve the best performance across all tasks,                                 SWU scores in other tasks, failing to effectively balance

demonstrating their effectiveness in balancing safety and                                   safety and rewards. Methods like Recovery and RCDQN

rewards. As shown in Table 1, SPOM PER achieves the                                         exhibit more conservative behavior, achieving lower crash

highest average SWU score of 0.90, followed by SPOM                                         rates at the cost of significantly reduced rewards. DQN

with a score of 0.79, outperforming all other baselines by a                                and RewsDQN, on the other hand, fail to manage safety

significant margin.                                                                         effectively, resulting in much lower SWU scores across all

For the classical safe control tasks, ACC and Circle,                                       tasks.

SPOM PER, thanks to the prioritization mechanism in the                                     Overall, the results validate that SPOM PER and SPOM

replay buffer for the learning of the ψ network, achieves                                   are highly effective in optimizing the trade-off between

significantly lower crash rates compared to other methods                                   safety and rewards, with SPOM PER excelling in long-

while ensuring convergence to higher episode rewards. In                                    horizon tasks and maintaining the highest overall SWU

comparison, SPOM also performs competitively in ACC                                         score.

and Circle but slightly lags behind SPOM PER in terms of

crash rate reduction. Baselines such as Recovery perform

                                                                                            6.3. Ablation Studies

reasonably well in ACC, but their inherent conservativeness

leads to suboptimal rewards, and they struggle significantly                               We conduct ablation studies on the usage of different po-

in Circle.                                                                                 larized function fpol and apply the optimal action masks

                                                                                           directly in Intersection and TwoWay. The results are shown

For the four tasks from highway-env, both SPOM

                                                                                           in Figure 3. Observe that, the direct optimal action masking

and SPOM PER demonstrate leading performance.

                                                                                           “OAM” is significantly conservative in Intersection, while

SPOM PER achieves the highest SWU scores in Merge

                                                                                           in TwoWay, its crash rate has little improvement but reward

and Roundabout, while SPOM leads in TwoWay and In-

                                                                                           is lower. This shows the hurt brought by optimal action

tersection. The performance gap between SPOM and

                                                                                           masking on an immature ψ network in the early stage of

   2                                                                                       training, which is also the reason of suboptimality of the

   Code for the experiments is available at https://github.

com/FrankSinatral/Safety-PP.git.                                                           strong polarization effect given by “xp”, since masking is a



                                                                                     8

