Policy-Chosen Safe Boxes for High-Dimensional Beta Policies

A robot hand learning by trial and error should never, even once during training, drive a finger past a safe joint speed or push an object harder than a force ceiling. One clean way to guarantee this is to make unsafe actions impossible to sample. You compute, at each moment, a region of actions that a safety certificate says is safe. You then draw actions from a probability distribution that puts zero mass outside that region. The Beta distribution is a bell-like distribution defined on a bounded interval. Stretched to fit a box of allowed actions, it does exactly this, and because the executed action is the sampled action, the learning signal stays honest.

This has been shown to give zero training-time violations, but only on a pendulum and a quadcopter. The method solves an optimization problem at every step to find the largest box that fits inside the safe region, and it trains the policy inside that box. We argue that at high dimension the largest box is the wrong box. It is chosen by geometry rather than by the task, and the actions a task needs near a constraint's edge usually lie outside it. We propose instead that the policy itself chooses the box, by deciding how to split each constraint's safety margin across joints. Every box it can choose is safe by construction. The construction costs a closed-form computation linear in the number of joints. It also removes the penalty terms that practitioners currently hand-tune into dexterous-manipulation rewards.

Core Claim

The direct predecessor is Sampling-based Safe Reinforcement Learning for Nonlinear Dynamical Systems (Safe-RPG). It uses control barrier functions (CBFs), which are certificates that turn "stay in the safe states" into a condition on the current action. From these it derives a safe action set, solves a convex program each step for the largest inscribed axis-aligned box, and samples a rescaled Beta policy inside it. It proves convergence and reports a 100% safety rate throughout training on an inverted pendulum and quadcopter navigation. It also shows that projection filters, which correct actions after sampling, leave agents stuck at active constraints.

Our claim is narrower and more testable than "scale Safe-RPG up." Letting the policy allocate each constraint's slack across joints yields a family of guaranteed-safe boxes. Their union covers much more of the safe set than any single box. The policy can therefore put exploration where the task needs it, typically in a few task-relevant joints pressed against a constraint, while other joints are held near a safe reference action. We expect this to matter more as dimension grows. It should let hard-constraint sampling reach 24- to 52-dimensional hand control with no per-step solver and no cost critic.

Mechanism

At state $s$, suppose a one-step local model of the controlled joints turns the barrier conditions into $m$ linear action constraints $g_j(s)^\top a \le h_j(s)$ for $j=1,\dots,m$. These sit alongside actuator limits $[a^{\min}_i, a^{\max}_i]$ for joints $i=1,\dots,d$. We also assume a known safe reference action $a^0(s)$, for example holding the current joint targets. This gives slack $\sigma_j = h_j - g_j^\top a^0 \ge 0$. The policy network outputs two things. The first is a Dirichlet sample $w_{j\cdot}$ per constraint, a vector of nonnegative fractions over joints summing to one. The second is Beta shape parameters $\alpha_i,\beta_i>1$, using the softplus-plus-one head of Improving Stochastic Policy Gradients in Continuous Control with Deep Reinforcement Learning using the Beta Distribution. Joint $i$'s interval then extends from $a^0_i$ toward each constraint's "bad" direction only as far as its share of that constraint's slack allows:

$$u_i = \min\Big(a^{\max}_i,\ a^0_i + \min_{j:\,g_{ji}>0} \tfrac{w_{ji}\sigma_j}{g_{ji}}\Big), \qquad l_i = \max\Big(a^{\min}_i,\ a^0_i - \min_{j:\,g_{ji}<0} \tfrac{w_{ji}\sigma_j}{|g_{ji}|}\Big).$$

The action is $a_i = l_i + (u_i-l_i)x_i$ with $x_i \sim \mathrm{Beta}(\alpha_i,\beta_i)$. The worst case of $g_j^\top(a-a^0)$ over this box is at most $\sum_i w_{ji}\sigma_j = \sigma_j$, so every point of every such box satisfies every constraint.

We treat the allocation $w$ as part of an augmented action. The environment sees only $a$, so the ordinary likelihood-ratio policy gradient on the pair $(w,a)$ is unbiased. The exact log-likelihood is $\log \mathrm{Dir}(w) + \sum_i[\log \mathrm{Beta}(x_i) - \log(u_i-l_i)]$. There is no clipping, no projection, and no mismatch between sampled and executed actions. It inherits the Beta policy's advantages over clipped or squashed Gaussians: no off-support bias (Marginal Policy Gradients), no mass piling up at limits (Fat-to-Thin Policy Optimization), and no saturated squashing gradients (Beyond Distributions: Geometric Action Control).

The coverage is not the full safe polytope, and we state this plainly. The reachable set is all actions whose bad-direction contributions to each constraint sum within its slack. That set contains every safe box that contains $a^0$, but it excludes points where one joint's good-direction motion compensates another joint's bad-direction motion. We will measure this gap by Monte Carlo rather than assume it away.

Research Program

The work has three parts. The first is the sampler: vectorized closed-form box construction inside Isaac Gym rollouts. It will have per-constraint and shared-allocation variants, and constraints with large slack will be dropped so that $m$ stays small.

The second is a geometric study. We will measure, as dimension grows from the quadcopter to the humanoid (17 action dimensions) to one Shadow Hand (24) and two hands (about 52), three quantities. The first is the fraction of the safe set's volume captured by the single largest box. The second is the fraction captured by the union of allocatable boxes. The third is how often the unconstrained-optimal action found by a Lagrangian baseline falls inside each.

The third part addresses reward engineering. Hand rewards on dexterous tasks typically fold in penalty terms for joint limits, speeds, and forces. Safety Gymnasium documents that such penalties swing between reckless and "safe but useless" behavior. We will delete every penalty term that duplicates a hard constraint and ask whether task-only reward suffices once those constraints are enforced by sampling.

The hard constraints need no learned cost critic. They therefore sidestep the safety paradox of Breaking Safety Paradox with Feasible Dual Policy Iteration, where scarce violations starve the cost critic. Any remaining expected-cost constraint is handled by a Lagrangian term. This lets us check whether the paradox shrinks when only soft constraints are left to estimate.

The main risk is model error. The linear constraints come from a one-step local model, and simulator contact dynamics can violate them. We will report violations measured by the true simulator, not by the model. We will also sweep a safety margin on $h_j$ to trace how much conservatism buys how much real safety.

Baselines

The naive reference point is unconstrained PPO with a clipped Gaussian policy on the benchmark's hand-crafted reward, including its penalty terms. This is what practitioners currently ship. We run it with its default penalty weights, and additionally with a grid over penalty weights under the same total tuning budget as our method. The grid gives it a fair chance at the reckless-to-useless sweet spot.

The strongest CMDP competitors are PPO-Lagrangian and CPPO-PID from the SafePO library in Safety Gymnasium. CMDP means constrained Markov decision process, where return is maximized subject to a budget on expected cost. On velocity tasks that paper reports PPO-Lag reducing safety violations by 98% relative to PPO at a 45% drop in total reward. It reports CPPO-PID as the stabilized variant. We found no reported result on Lacuna for any method on Safety-DexterousHands, so we will establish those numbers ourselves with identical environments, seeds, sample budgets, and hyperparameter search budgets.

Beating these baselines means two things. The first is at least an order of magnitude fewer cumulative training-time violations. The second is final normalized reward within a stated tolerance of CPPO-PID, or better, without any penalty terms in the reward.

The strongest existing hard-constraint method is Safe-RPG's largest-inscribed-box Beta sampler, reimplemented with a batched convex solver on the same constraints. On its own tasks it reports a 100% safety rate during training. We first reproduce that on the pendulum and quadcopter as a sanity check. Beating it at high dimension means equal safety, higher task reward, and lower wall-clock per environment step.

We also compare against a clipped Gaussian policy whose actions pass through a CBF quadratic-program projection filter. Its log-probabilities are computed on the unfiltered action, as is standard. This is the design Safe-RPG argues against.

Two ablations isolate the key ingredient. The first fixes the allocation to uniform, $w_{ji}=1/d$: a safe box that the policy cannot steer. The second uses a plain Beta policy with Lagrangian costs and no safe box, which separates the benefit of bounded support from that of safe-set sampling.

Why not just…?

Why not just use a tanh-squashed Gaussian with CPPO-PID? If one cares only about final reward and cost at convergence, this is a genuine threat. It may match us on those axes. The evidence against it concerns training-time safety and gradient quality. Lagrangian methods satisfy budgets only asymptotically and oscillate during training (Safety Gymnasium). About 46% of SAC's squashed samples sit in saturated regions (Beyond Distributions: Geometric Action Control). Our head-to-head reports both cumulative training violations and final reward, so a reader can see exactly which regime each method wins.

Why not just run Safe-RPG's largest-box solver in batch? The inscribed-box problem is convex and polynomial in dimension, so compute alone may not rule it out. We therefore do not rest the argument on speed. The real question is whether one geometry-chosen box excludes the actions the task needs. The volume-fraction study and the fixed-uniform-allocation ablation answer this directly. If the largest box matches our reward at high dimension, the claim fails.

Why not just filter a Gaussian policy with a CBF quadratic program, or with a hand-designed low-level controller like the Geometric Fabrics used in ADEPT? ADEPT shows that a filtering controller can work well for 23- and 29-degree-of-freedom hands, reaching 8/10 success on the asymmetric FMB peg. That is strong evidence that filters are practical. The counter-evidence is Safe-RPG's finding that filtered agents stall at active constraints, because the learner is never told which action was actually executed. Our projection-filter baseline tests whether this stall appears on hand tasks where the constraint is often active. If it does not appear, the case for sampling-based safety at high dimension weakens accordingly.

Why not just keep a large static penalty? Safety Gymnasium documents the reckless-versus-immobile dilemma this creates. Our penalty-weight grid for the naive baseline measures, under a matched tuning budget, how close a well-chosen static penalty gets.

Proposed Experiments

The benchmarks run in three tiers. First, the Safety-Constrained Inverted Pendulum and Quadcopter Navigation, to reproduce Safe-RPG. Second, the MuJoCo humanoid with joint-velocity and torso-tilt constraints linearized from its dynamics. Third, Safety-DexterousHands in Isaac Gym, with its native constraints plus linearized joint-velocity and fingertip-workspace constraints.

Metrics are cumulative violations over all of training as measured by the simulator, the fraction of training episodes with any violation, final return, and wall-clock per step. We also report safe-set coverage fraction and the number of reward terms and tuned weights each method requires.

Three checks are decisive. The first tests whether the reward gap over the largest-box sampler grows with action dimension, as the conservatism argument predicts. The second tests whether the learned allocation concentrates slack on a small, task-relevant subset of joints, a learned coordination pattern comparable to the synergies of Low-Rank Modular Reinforcement Learning via Muscle Synergy. The uniform-allocation ablation performing as well would falsify this. The third tests whether deleting penalty terms from the hand reward leaves our method's return unchanged while degrading PPO. That result would show the constraints doing the work those hand-tuned weights used to do.