# Balanced Domain Randomization for Safe Reinforcement Learning
## 4 Balanced Domain Randomization
The results demonstrate that BDR efficiently optimizes worst-case performance while maintaining average-case performance, highlighting its robustness and reliability in varied conditions during training. Balancing parameter. To further investigate the impact of the balancing parameter \(\beta\), we conducted an ablation study by varying its value from 0 (which denotes uniform randomization) to 1 (which places full emphasis on rare domains). Table 2 shows that \(\beta=0.5\) yields the best performance in most cases. However, performance degrades for higher values of \(\beta\), since overemphasizing rare domains may hinder the agent learning its general strategies in more common scenarios. Although it may be necessary to appropriately tune the value of \(\beta\), depending on tasks, the empirical results show that \(\beta=0.5\) provides the best trade-off between learning from rare and common scenarios in both tasks. \begin{table}
\begin{tabular}{c c c c c} \hline \hline \multirow{2}{*}{**Task**} & \multirow{2}{*}{**Method**} & \multicolumn{2}{c}{**Minimum**} & \multicolumn{1}{c}{**Mean Episodic**} & \multirow{2}{*}{
\begin{tabular}{c} **Mean Episodic** \\ **Return (Worst** \\ **10\%)** \\ \end{tabular} } \\  & & **Episodic** & & **10\%** \\ \hline \multirow{5}{*}{Pendulum} & Baseline (\(\beta=0\)) & -1263.97 & -1221.57 & -392.70 \(\pm\) 319.62 \\  & \(\beta=0.25\) & \(-1299.66\) & \(-1244.98\) & \(-450.21\) \(\pm\) 317.04 \\  & \(\beta=0.5\) & \(-\textbf{1199.37}\) & \(-\textbf{1132.30}\) & \(-\textbf{379.14}\) \(\pm\) 295.16 \\  & \(\beta=0.75\) & \(-1227.09\) & \(-1134.78\) & \(-411.02\) \(\pm\) 319.18 \\  & \(\beta=1\) & \(-1386.99\) & \(-1186.47\) & \(-464.74\) \(\pm\) 323.14 \\ \hline \multirow{5}{*}{Walker} & Baseline (\(\beta=0\)) & 539.62 & 516.80 & 878.21 \(\pm\) 106.04 \\  & \(\beta=0.25\) & 668.35 & 633.97 & \(\textbf{900.73}\) \(\pm\) 85.59 \\ \cline{1-1}  & \(\beta=0.5\) & \(\textbf{673.49}\) & \(\textbf{638.59}\) & 885.18 \(\pm\) 88.89 \\ \cline{1-1}  & \(\beta=0.75\) & 454.86 & 455.92 & 767.93 \(\pm\) 109.67 \\ \cline{1-1}  & \(\beta=1\) & 497.80 & 567.64 & 851.82 \(\pm\) 106.13 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Mean and minimum episodic returns of the BDR with different values of \(\beta\). The best performance is marked in bold. Figure 5: Average sample weights for each domain. The BDR framework assigns higher weights to rare domains, when the length is 0.1 in the Pendulum task (**a**) and when the gravity is 1 in the Walker task (**b**), ensuring these underrepresented domains receive more attention during training. ### Evaluation in Safety-Critical Navigation Tasks

To evaluate the efficacy of the BDR framework in more complex and safety-critical scenarios, we adopt a 2D safe navigation task using the SafetyGymnasium environment [50]. This environment introduces hazards as well as goal-reaching objectives, representing safety-critical real-world challenges such as autonomous navigation and robotic deployment. The objective is to reach a randomly generated goal while avoiding randomly placed unsafe regions (hazards). The agent controls actuators for linear and rotational velocity, receiving rewards for reaching the goal and penalties for entering unsafe regions. To introduce variability in dynamics, we alter both the mass and the moment of inertia (MOI). For training and evaluation, we use combinations of mass and MOI from the set {0.1, 0.3, 0.5, 0.7, 1.0}. As well as episodic return, we measure episodic cost as a safety-specific metric. The episodic cost is measured as accumulated penalties for entering unsafe regions. Table 3 reports the quantitative results. BDR improves the minimum episodic return by 500% (from 0.12 to 0.72), the mean episodic return (worst 10%) by 80.77% (from \(-\)1.82 to \(-\)0.35), and the mean episodic return by 251.60% (from 2.81 to 9.88), over the baseline.