TL;DR
This paper introduces RCDT (Return-Cost Regularized Constrained Decision Transformer), a novel offline safe reinforcement learning algorithm that allows a single policy to adapt zero-shot to different safety constraints at deployment. By integrating an auto-adaptive Lagrangian penalty, trajectory reweighting, and Q-value regularization into a conditional sequence modeling framework, RCDT overcomes the instability of naive target conditioning and achieves state-of-the-art performance across diverse safety benchmarks.
What Problem Does This Paper Address?
Offline safe reinforcement learning (RL) aims to extract effective decision-making policies from static, pre-collected datasets while ensuring the agent obeys strict safety budgets (cumulative cost constraints). In real-world applications like robotics or autonomous driving, safety requirements are rarely static; a drone might need a strict safety budget in a crowded room but a relaxed one in an open field. Ideally, we want a single policy capable of adjusting its risk tolerance on the fly (zero-shot) without needing expensive retraining.
Conditional Sequence Modeling (CSM), exemplified by the Decision Transformer (DT), offers a natural framework for this by treating RL as a sequence generation task conditioned on target tokens like Return-to-Go (RTG) and Cost-to-Go (CTG). However, a naive extension of DT to safe settings fails in practice. Because these models rely on maximum-likelihood estimation to match the training data, they struggle when safe, high-return trajectories are scarce. If a user inputs an ambitious target (high reward, low cost) that is poorly represented in the dataset, the model's performance collapses, leading to severe constraint violations and unstable behavior.
Methods
To resolve this instability, the authors propose RCDT (Return-Cost Regularized Constrained Decision Transformer). It builds upon the Constrained Decision Transformer (CDT) backbone, which autoregressively predicts actions based on historical context and target tokens.
RCDT introduces three data-aware training mechanisms to augment the standard sequence modeling objective:
- Trajectory-level Reweighting: RCDT calculates a joint reward-cost weight for each trajectory in the dataset, prioritizing data that achieves high returns while remaining within a safe cost reference limit. This explicitly biases the sequence model toward desirable behaviors.
- Q-Value and Cost Regularization: The algorithm trains standard offline reward ($Q$) and cost ($C$) critics via temporal-difference learning. These critics provide explicit optimization signals during training, steering the policy toward high-value regions and penalizing unsafe actions, which prevents the policy from becoming overly conservative.
- Auto-Adaptive Lagrangian Penalty: RCDT incorporates a cost penalty coefficient ($\lambda$) into the actor loss. This coefficient is updated dynamically during training via dual ascent based on a training-time reference cost level ($\kappa$). Crucially, because the policy remains conditioned on CTG tokens, this acts as a flexible regularizer rather than a rigid constraint, preserving the model's zero-shot adaptability at deployment.
Datasets
The authors evaluated RCDT on the comprehensive DSRL benchmark, which aggregates safety-critical datasets across three distinct simulation environments:
- SafetyGym: MuJoCo-based continuous control tasks (Goal-reaching, Pushing, and Circle-tracking) utilizing Point and Car robot morphologies.
- BulletSafetyGym: PyBullet-based locomotion tasks (Run and Circle) featuring Ball, Car, Drone, and Ant robots under fast, contact-rich dynamics.
- MetaDrive: A realistic autonomous driving simulator featuring varying traffic densities (Sparse, Mean, Dense) and driving difficulties (Easy, Medium, Hard).
Key Insights and Ideas
- The Coverage Bottleneck: The authors provide a theoretical characterization showing that the discrepancy between a user-specified target (RTG/CTG) and the policy's actual realized return/cost is strictly bounded by the joint return-cost coverage in the offline dataset. If a target profile has low coverage, the policy will deviate substantially from the intended targets.
- Expert KL as Trajectory Weighting: The paper mathematically demonstrates that the widely used expert KL regularization technique is actually a special case of trajectory-level data reweighting. This unifies two previously distinct lines of algorithmic improvements in sequence-modeled RL.
- Decoupling Training from Deployment: By reinterpreting the Lagrangian multiplier as an adaptive regularization coefficient driven by a training-time reference level rather than a hard deployment constraint, RCDT allows the underlying transformer to remain fully sensitive to changing CTG tokens at inference time.
Key Results
RCDT was evaluated against a wide array of baselines, including value-based safe RL (CPQ, BCQ-Lag, BEAR-Lag), distribution matching (COptiDICE), feasible-region methods (FISOR, TraC), and vanilla CDT.
- Superior Return-Cost Trade-offs: RCDT achieved the highest normalized returns while successfully satisfying safety constraints across the majority of the DSRL tasks. For instance, on SafetyGym, RCDT improved the average normalized return over vanilla CDT from 0.55 to 0.59 while simultaneously reducing the average normalized cost from an unsafe 1.09 to a safe 0.95.
- Robust Zero-Shot Adaptability: A single trained RCDT policy successfully adapted to multiple distinct cost thresholds at test time simply by altering the input CTG token.
- Data Resilience: The authors conducted stress tests by degrading the datasets—retaining only low-return trajectories or creating highly skewed return distributions (down to 10% data retention). RCDT demonstrated remarkable robustness, maintaining near-saturated returns and stable cost boundaries where behavior cloning and vanilla CDT suffered catastrophic cost explosions or severe reward degradation.
Limitations and Future Work
While RCDT exhibits strong robustness, the authors note that under extreme data imbalances (e.g., retaining only the most heavily skewed mixtures at a 10% retention ratio in environments like SwimmerVel and HopperVel), the realized costs can still increase. This points to an intrinsic physical limitation: when an offline dataset provides virtually zero coverage of safe, high-performance behaviors, even advanced regularization cannot fully bridge the gap. Future work may explore extending this framework to handle non-stationary environments or multi-dimensional constraint settings.
Summary updated