AEGIS: Almost Surely Safe Offline Reinforcement Learning
Abstract
Ensuring safety guarantees in offline reinforcement learning remains challenging, especially when safety constraints must hold almost surely. Moreover, as prespecifying a single safety budget (constraint threshold) is often challenging, it is desirable to learn a foundation policy that can be deployed across a broad range of budgets. We introduce AEGIS (Almost-sure Epigraph-Guided Implicit Safety), a safe offline RL framework that can guide diffusion policy training via critics that account for almost-sure constraints across various feasible budgets. AEGIS characterizes the feasible set of initial state-budget pairs as the epigraph of a feasibility critic updated via the worst-case backup. Building on the proposed characterization, we extend implicit Q-learning (IQL) to train both feasibility and reward critics. We use these critics to bias a diffusion policy toward high-value feasible actions. Consequently, AEGIS turns diffusion from a generative prior into a safety-aware controller, enabling a single general policy to respect various budgets without further tuning. Empirical results on the DSRL benchmark and humanoid locomotion tasks show that AEGIS achieves high feasibility with competitive returns, generalizing across feasible constraint thresholds.
Almost Surely Safe Reinforcement Learning
Most safe RL methods constrain the expected cost, which still allows rare trajectories to exceed the budget. On a robot, a single such run can overheat a motor or damage a joint. We therefore consider the almost-sure constraint, under which the discounted cost return of every trajectory stays within the budget \(\delta_0\).
Moreover, the appropriate budget is hard to fix in advance, since it depends on the hardware condition, the surrounding temperature, and the task. Our goal is to learn a single policy from offline data that remains safe for any feasible budget specified at deployment. Following Sauté RL, we augment the state with the remaining budget \(\delta\) and condition the policy on the state-budget pair \((s, \delta)\).
Feasibility for Almost-Sure Constraint
We define the feasibility value function \(V_f(s)\) as the minimal budget that makes state \(s\) feasible, i.e., from which some policy can satisfy the constraint. Since a larger budget is always easier to satisfy, the feasible set of state-budget pairs is the epigraph of \(V_f\).
An action is viable if the next state-budget pair stays in the feasible set almost surely, and a policy is feasible if and only if it selects viable actions. Thus, the infinite-horizon constraint reduces to a single-step condition \(Q_f(s, a) \le \delta\), where the feasibility Q-function \(Q_f\) is learned with our feasibility Bellman operator. It backs up the worst-case transition instead of the expectation: \[ \mathcal{T}_f Q_f(s, a) = \operatorname*{ess\,sup}_{s' \sim \mathcal{P}(\cdot \mid s, a)} \Big[ C(s, a) + \gamma \min_{a'} Q_f(s', a') \Big]. \] Iterating this operator converges to the unique fixed point, the feasibility Q-function, so a single critic covers all budgets. You can find the detailed theoretical analysis in our paper.
AEGIS
AEGIS extends implicit Q-learning (IQL) to learn feasibility and reward critics from a fixed dataset, and uses them to guide a diffusion policy toward high-reward feasible actions.
Feasibility Critic
Since the essential supremum is impractical to compute from data, we approximate it with an \(\alpha\)-expectile, which approaches the essential supremum as \(\alpha \to 1\). The expectile is applied only to the dynamics backup, characterizing feasibility in a policy-agnostic view.
Reward Critic
The budget-conditioned reward critics estimate the maximum constraint-satisfying return. When training \(V_r\), infeasible actions with \(Q_f(s, a) > \max(\delta, V_f(s))\) receive zero weight unless their reward Q-value is below \(V_r\), so they cannot raise the reward value. Since the expectile approximation relaxes the constraint, we also give a reward penalty when \(V_f(s)\) exceeds the remaining budget \(\delta\), before the budget is actually exhausted.
Diffusion Policy
The budget-conditioned diffusion policy is trained by weighted denoising on dataset actions with budgets sampled in hindsight: \[ w(s, \delta, a) = \begin{cases} \exp\big(\beta (Q_r(s, \delta, a) - V_r(s, \delta))\big), & Q_f(s, a) \le \max(\delta, V_f(s)), \\ 0, & \text{otherwise}. \end{cases} \] Infeasible actions receive zero weight, and feasible actions are weighted by their exponentiated reward advantage. At deployment, the policy samples candidate actions given the state and remaining budget, and selects the one with the highest reward Q-value among those within the budget, with no projection and no retraining.
Experiments
DSRL Benchmark
We measure the feasibility rate (FR), the fraction of rollouts that never exhaust the budget, and the constrained reward return (CRR), the normalized reward return over feasible rollouts. Bold denotes safe agents (FR \(\ge\) 0.75), gray denotes unsafe agents, and blue denotes the safe agent with the highest reward return for each task. With a single set of hyperparameters, AEGIS attains FR \(\ge\) 0.75 on 11 of 12 tasks and improves the feasibility rate by an average of 23 percentage points. Its CRR is lower than some baselines on certain tasks, since maintaining high feasibility requires more conservative actions.
Budget Generalization
Cost return (orange) and reward return (blue) of γ-CDT, IDQL-Sauté, and AEGIS (left to right) in DroneCircle with varying initial budget \(\delta_0\). Without retraining, AEGIS stays highly feasible at all four budgets, unlike the baselines.
Humanoid Locomotion
To evaluate scalability, we test AEGIS on a Unitree G1 humanoid walking forward under an energy budget. The plots show the discounted cost (orange) and reward (blue) returns and the average velocity with respect to the initial budget \(\delta_0\). A single policy walks faster as the budget increases, without additional training. The snapshots show 5-second rollouts under budgets of 20, 40, and 80 (top to bottom), where a larger budget lets the humanoid accelerate earlier and walk farther.
BibTeX
@inproceedings{lee2026aegis,
title = {AEGIS: Almost Surely Safe Offline Reinforcement Learning},
author = {Lee, Junseo and Kwon, Hyeokjin and Oh, Songhwai},
booktitle = {Advances in Neural Information Processing Systems},
year = {2026}
}