Next Article in Journal
Generating Hard-Label Black-Box Adversarial Examples for Video Recognition Models
Previous Article in Journal
Excursion Laplace Exponents Under Height Truncation
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Conditional Sequence Modeling for Safe Reinforcement Learning

1
College of Computer Science and Technology, Zhejiang University, Hangzhou 310058, China
2
Advanced Technology Institute, Zhejiang University, Hangzhou 310058, China
*
Author to whom correspondence should be addressed.
Mathematics 2026, 14(6), 1015; https://doi.org/10.3390/math14061015
Submission received: 10 February 2026 / Revised: 10 March 2026 / Accepted: 13 March 2026 / Published: 17 March 2026

Abstract

Offline safe reinforcement learning (RL) aims to learn policies from a fixed dataset while maximizing performance under cumulative cost constraints. In practice, deployment requirements often vary across scenarios, necessitating a single policy capable of zero-shot adaptation to different cost thresholds. However, most existing offline safe RL methods are trained under a pre-specified threshold, yielding policies with limited generalization and deployment flexibility across cost thresholds. Motivated by recent progress in conditional sequence modeling (CSM), which enables flexible goal-conditioned control by specifying target returns, we propose Return–Cost Regularized Constrained Decision Transformer (RCDT), a CSM-based method that supports zero-shot deployment across multiple cost thresholds within a single trained policy. RCDT is the first CSM-based offline safe RL algorithm that integrates a Lagrangian-style cost penalty with an auto-adaptive penalty coefficient. To avoid overly conservative behavior and achieve a more favorable return–cost trade-off, a reward–cost-aware trajectory reweighting mechanism and Q-value regularization are further incorporated. Extensive experiments on the DSRL benchmark demonstrate that RCDT consistently improves return–cost trade-offs over representative baselines.

1. Introduction

Offline safe reinforcement learning (RL) aims to learn reliable decision-making policies from a fixed dataset while maximizing task performance under cumulative cost constraints, without any additional environment interaction [1,2,3,4]. This setting is particularly relevant for safety-critical domains such as robotics and autonomous systems, where online exploration can be prohibitively expensive and unsafe [5,6]. In practice, safety requirements vary widely; different deployment scenarios or operating conditions may impose different cost constraints, and policies often need to evaluate return–cost trade-offs and adapt across a range of cumulative cost thresholds [2,7]. Such variability highlights the need for policies with zero-shot adaptability across multiple cost thresholds [8]. However, most prior offline safe RL methods are trained under a pre-specified cost threshold, resulting in policies that are tied to that specific constraint and hence do not naturally support one-policy, zero-shot deployment across varying thresholds [9,10,11].
Recent advances in offline RL via conditional sequence modeling (CSM) suggest a promising route to accommodating varying deployment requirements within a single policy [12,13,14,15,16]. Conceptually, CSM reformulates offline RL into supervised learning on trajectory data by training a goal-conditioned action predictor [17,18]. One representative CSM approach is the Decision Transformer (DT) [17], which trains a Transformer to predict actions from trajectory prefixes conditioned on a target return-to-go (RTG) signal. At inference time, DT treats decision making as a conditional generation problem, and thus can adjust its behavior by varying the target RTG token. By making decisions directly from temporally extended trajectories, this paradigm also bypasses recursive value estimation, thereby mitigating bootstrapping errors and challenges associated with dynamic programming in offline settings [17,18]. These properties make CSM a compelling backbone candidate for offline safe RL, where one would ideally like to adapt the return–cost trade-off across budgets without retraining.
Nevertheless, a straightforward extension of DT to constrained settings, by introducing a cost-to-go (CTG) token and conditioning on both return and cost, does not necessarily yield satisfactory safety behavior. The key issue is that maximum-likelihood training encourages the model to match the conditioning signals, which obscures the asymmetry in constrained Markov decision processes (CMDPs) where return is to be optimized while cost specifies a constraint. As a result, naive CTG matching can induce unstable return–cost trade-offs and even constraint violations, especially when the dataset provides limited coverage of low-cost behaviors. Such instability and constraint violations under naive CTG-conditioned DT variants have been widely observed in prior work and in our experiments [1,3,4,7]. Consequently, a central question arises: how can we endow CSM-based policies with a principled and robust mechanism for achieving favorable return–cost trade-offs while preserving their zero-shot adaptation flexibility?
To develop a robust CSM-based approach for offline safe RL, we first analyze the discrepancy between the specified RTG/CTG signals and the resulting expected return and cumulative cost induced by a conditioned CSM policy. More precisely, we consider a fixed conditioning function F ( · ) that determines the RTG/CTG inputs used at inference, and let R ( τ ) and C ( τ ) denote the (random) return and cumulative cost of a trajectory τ generated by the behavior policy β from an initial state s 1 . Our analysis shows that, under mild CMDP assumptions, this discrepancy admits an upper bound that scales as O ( ε ( 1 α F + 2 ) H 2 ) , where α F lower-bounds the joint return–cost coverage of the target profile in the offline dataset, i.e., P π β ( R ( τ ) , C ( τ ) ) = F ( s 1 ) | s 1 ≥ α F . Consequently, when the desired return–cost conditioning function F ( · ) has low coverage (small α F ), the induced optimal policy may substantially deviate from the intended RTG/CTG targets, leading to unstable return–cost trade-offs and potential constraint violations. In particular, simply specifying a high RTG together with a low CTG does not reliably yield favorable return–cost trade-offs on challenging datasets where safe high-return behaviors are under-represented. This analysis motivates augmenting naive conditioning with weighted and regularized training mechanisms that shift learning toward trajectories with better return–cost trade-offs while preserving zero-shot adaptability.
Building on this insight, we propose the first CSM-based offline safe RL algorithm that integrates a Lagrangian-style cost penalty while preserving zero-shot adaptation across different cost thresholds. We term the proposed algorithm Return–Cost Regularized Constrained Decision Transformer (RCDT). At a high level, RCDT minimizes a weighted maximum-likelihood objective augmented with an explicit cost penalty, where the penalty term is induced from a primal–dual Lagrangian formulation of CMDPs. Specifically, RCDT treats the cost-penalty coefficient as a dual variable and updates it via a standard dual-ascent step driven by the current cost estimate, which provides a principled, auto-adaptive mechanism for tuning the regularization strength while avoiding hard-wiring the policy to a single cost threshold. To avoid overly conservative behavior and achieve a more favorable return–cost trade-off, RCDT further incorporates two complementary ingredients: (i) a reward–cost-aware trajectory-level reweighting mechanism that emphasizes trajectories with desirable return–cost profiles; and (ii) Q-value regularization as an additional optimization signal to steer the policy toward high-return regions. Together, these designs decouple policy learning from any single pre-specified cost threshold while maintaining strong task performance, thereby enabling one-policy deployment across multiple cost thresholds in a zero-shot manner.
Our contributions are summarized as follows:
1.
We propose RCDT, the first CSM-based offline safe RL method that integrates a Lagrangian-style cost penalty with an auto-adaptive dual-ascent update of the penalty coefficient. RCDT achieves favorable return–cost trade-offs while enabling zero-shot deployment across multiple cost thresholds, and empirically outperforms state-of-the-art offline safe RL baselines under stringent constraints.
2.
We theoretically characterize the discrepancy between the prescribed RTG/CTG signals and the realized expected return and cumulative cost of CSM policies through the lens of joint return–cost coverage. The theoretical analysis pinpoints when a CSM policy can be regarded as a reliable backbone for offline safe RL and establishes performance limits for zero-shot control via RTG/CTG conditioning.
3.
To encourage strong return performance without inducing overly conservative behavior, we introduce a reward–cost-aware trajectory-level reweighting scheme together with Q-value regularization as complementary training signals. This design introduces an additional inductive bias toward trajectories with favorable return–cost trade-offs. Moreover, we show that the commonly used expert KL regularizer can be interpreted as a special case of our reweighting mechanism.
We evaluate RCDT on the DSRL benchmark [19] under multiple cumulative cost thresholds, where a single trained policy is assessed in a zero-shot manner across all thresholds. Experimental results show consistent improvements in return–cost trade-offs over representative baselines, establishing RCDT as a strong candidate for advancing the state-of-the-art in offline safe RL.

2. Related Work

Offline RL algorithms learn a policy entirely from a static offline dataset of past interactions, without additional access to interactions with the environment during training [13,20,21,22]. This paradigm is particularly useful when online interaction is expensive or high risk; for example, in robotic control systems and safety-critical applications.

2.1. Offline Safe Reinforcement Learning

Offline safe RL aims to learn reliable decision-making policies from a fixed dataset while maximizing task performance under cumulative cost constraints, without any additional environment interaction. Compared with standard offline RL, the central challenge is to ensure reliable constraint satisfaction under distributional shift in the state-action space, rather than merely reducing empirical costs on the training data [19].
Classical offline safe RL methods largely build on imitation learning or Lagrangian extensions of offline value-based RL algorithms. Behavior cloning (BC) treats policy learning as supervised learning on a static dataset, directly fitting the conditional action distribution given states. Safety-aware variants often introduce simple data selection or reweighting strategies that emphasize trajectories with lower cumulative cost, so that the learned policy imitates predominantly safe behaviors; however, such filtering may reduce data coverage and induce overly conservative policies [19]. Another class of approaches augments standard offline value-based RL algorithms with a Lagrangian relaxation of the CMDP constraint. Representative examples include BCQ-Lag and BEAR-Lag, which extend BCQ [23] and BEAR [24] by jointly learning reward and cost critics together with a Lagrange multiplier, and CPQ [10], which incorporates conservative regularization on both reward and cost critics to keep the learned policy close to the behavior distribution. COptiDICE [9] instead operates in the occupancy-measure space, estimating distribution corrections and solving a convex objective that maximizes return under an explicit upper bound on the expected cost.
Another line of research improves safety by explicitly reasoning about data quality and feasible regions [1,2,11,25]. LSPC [1] learns latent safety constraints using a conditional variational autoencoder and restricts policy optimization to a latent region that jointly encodes reward and cost signals, thereby mitigating out-of-distribution actions in the original state-action space. FISOR [11] revisits offline safe RL from a reachability perspective, translating hard safety constraints into the identification of the largest feasible region supported by the dataset and then solving a feasibility-dependent objective, yielding a policy that can be implemented via weighted behavior cloning with a diffusion model. TraC [2] instead recasts offline safe RL as a trajectory classification problem: it constructs desirable and undesirable trajectory sets based on cumulative rewards and costs, and optimizes a policy to imitate desirable trajectories while avoiding undesirable ones, effectively performing trajectory-level filtering. The diffusion-based offline safe RL method OASIS [25] employs a conditional diffusion model to reshape the offline action distribution toward trajectories that jointly exhibit low cost and high return, thereby suppressing unsafe behaviors that are poorly supported by the dataset.
Motivated by recent advances in large-scale sequence modeling [13,17,26], conditional sequence modeling (CSM) has emerged as a promising paradigm for offline safe RL [3,7]. Constrained Decision Transformer (CDT) [7] extends Decision Transformer by conditioning action prediction on both return-to-go (RTG) and cost-to-go (CTG) tokens, thus formulates offline safe RL as a multi-objective sequence modeling problem in which a single CSM policy can be evaluated under different cost thresholds. B2R [3] further refines how cost information is injected into the sequence model, encouraging the learned policy to respect safety boundaries while maintaining competitive returns. Compared with imitation-learning heuristics, Lagrangian extensions of value-based offline RL, and feasible-region based approaches, these CSM methods provide a particularly direct mechanism for trading off performance and safety through target conditioning, making one-policy, multi-threshold deployment more natural. Nevertheless, existing CSM-based methods largely treat RTG/CTG conditioning as a heuristic control interface, and the fundamental limits of such zero-shot adaptation remain underexplored. In this study, we analyze the discrepancy between the specified RTG/CTG signals and the resulting expected return and cumulative cost induced by a conditioned CSM policy through the lens of joint return–cost coverage, thereby characterizing when target conditioning can be reliably realized from offline data. Building on this perspective, we propose RCDT, which augments CSM training with weighted and regularized mechanisms, yielding improved return–cost trade-offs and stronger zero-shot performance over prior CSM-based offline safe RL methods.

2.2. Conditional Sequence Modeling for Offline RL

Casting RL as conditional sequence modeling has emerged as a powerful alternative to value-based and policy-gradient methods in offline settings [13,17,26,27]. Instead of explicitly estimating value functions or behavior-regularized policies, CSM methods train autoregressive models on offline trajectories and condition them on side information such as desired returns, goals, or future states [17,27,28]. This formulation enables the direct reuse of advances in sequence modeling and large-scale supervised training, while bypassing several instability sources that commonly arise in traditional offline RL, most notably the reliance on bootstrapping to propagate value estimates (one of the “deadly triad” [29]), and the myopic behaviors induced by discounting future rewards [17,30].
The most representative instantiation of this idea is the Decision Transformer (DT) [17], which conditions a causal Transformer [31] on past states, actions, and a target return, and predicts future actions so as to achieve the specified return. Subsequent studies have refined this return-conditioned formulation by modifying the conditioning signal or the learning objective. For instance, Q-learning Decision Transformer [32] and its variants replace the raw return with value-based targets obtained via dynamic programming (DP), aiming to better capture long-horizon optimality and alleviate sparse-reward issues [32,33]. Advantage-guided and return-regularized methods reshape the supervised loss using critic estimates to emphasize near-optimal actions in the offline dataset [34,35]. Similarly, Q-value Regularized Transformers (QT) [13] and Critic-Guided Decision Transformers (CGDT) [36] introduce estimated Q-values as explicit regularizers of the negative log-likelihood loss, sharpening the model’s preference for high-quality behaviors.
Another line of work employs sequence models as trajectory-level dynamics models rather than purely as policies. The Trajectory Transformer learns a joint model over sequences of states, actions, and rewards, and combines it with beam-search-style planning to generate high-return trajectories from offline data [37]. Bootstrapped variants further improve upon this idea by leveraging the learned sequence model to self-generate additional synthetic trajectories and augment the offline dataset [38]. Complementary to these data-augmentation approaches, multimodal architectures such as the Decision Transducer disentangle states, actions, and rewards into separate unimodal sequences and selectively fuse them, improving sample efficiency and representation flexibility for offline RL [39]. These approaches highlight that sequence modeling can serve as a versatile backbone for both policy learning and model-based planning in offline RL.
CSM has also been extended to safety-constrained settings by incorporating cost signals or richer specifications into the conditioning interface, enabling a single model to represent different safety–performance preferences [7,40,41]. We refer readers to Section 2.1 for a detailed discussion of representative CSM-based offline safe RL methods.

3. Preliminary

3.1. Constrained Markov Decision Process

Safe reinforcement learning can be naturally formalized as a Constrained Markov Decision Process (CMDP) [42]. A finite-horizon CMDP is defined as a tuple ( S , A , T , r , c , μ , H ) , where S and A denote the (continuous) state and action spaces. We model ( S , d S ) and ( A , d A ) as metric spaces equipped with their associated Borel σ -algebras; in standard continuous-control settings, S ⊂ R d s and A ⊂ R d a , both equipped with Euclidean metrics. The reward function is r : S × A → [ 0 , 1 ] and the cost function is c : S × A → [ 0 , 1 ] . The transition dynamics are defined by T , i.e., s t + 1 ∼ T ( · ∣ s t , a t ) , and μ denotes the initial state distribution, i.e., s 1 ∼ μ , with H being the time horizon. A trajectory is denoted by τ = { ( s t , a t , r t , c t ) } t = 1 H , where r t and c t are generated according to the reward and cost functions (e.g., r t = r ( s t , a t ) and c t = c ( s t , a t ) in the deterministic case). The return and cumulative cost of τ are R ( τ ) = ∑ t = 1 H r t and C ( τ ) = ∑ t = 1 H c t , respectively. A policy π is considered feasible if its expected cumulative cost does not exceed a threshold κ ∈ [ 0 , + ∞ ) , i.e., E τ ∼ π [ C ( τ ) ] ≤ κ .
In the offline safe RL setup, algorithms are given a static dataset D , consisting of multiple trajectories, collected by a behavior policy π β . The goal of offline safe RL is to learn a feasible policy π from D , which maximizes the expected return while satisfying a cost constraint:
arg max π E τ ∼ π [ R ( τ ) ] subject to E τ ∼ π [ C ( τ ) ] ≤ κ .

3.2. Conditioned Sequence Modeling

Motivated by the wide-ranging applications and remarkable success of transformer models in various domains [17,31,43,44,45,46], CSM-based methods formulate policy learning as a conditional supervised learning problem. A representative CSM approach for offline safe RL is the Constrained Decision Transformer (CDT) [7], a safety-aware extension of DT [17] in CMDP settings. The model architecture of CDT is shown in Figure 1. Specifically, during training, the policy π is optimized by minimizing the empirical negative log-likelihood (NLL) loss over a dataset D of trajectories (we omit normalization here):
L CDT ( π ) = − ∑ τ ∈ D ∑ 1 ≤ t ≤ H log π ( a t ∣ s t , R ¯ t , C ¯ t , τ ¯ t − 1 K ) ,
where R ¯ t : = ∑ i = t H r i is the return-to-go (RTG) and C ¯ t : = ∑ i = t H c i is the cost-to-go (CTG) for τ at time step t. τ ¯ t − 1 K = ( R ¯ t − K , C ¯ t − K , s t − K , a t − K , … , R ¯ t − 1 , C ¯ t − 1 , s t − 1 , a t − 1 ) denotes the length-K historical context (when t − K < 1 , the context window is truncated to the available prefix of the trajectory). During inference, the model predicts a sequence of actions autoregressively conditioned on target RTG and CTG tokens.
Compared with Lagrangian extensions of value-based methods, CSM-based methods offer several advantages in the offline safe RL setting [3,7,13,36]. First, by conditioning on both RTG and CTG signals, a single CSM policy can represent a continuum of return–cost trade-offs and be evaluated under different cost thresholds without retraining [3,7]. Moreover, recasting policy learning as a supervised sequence prediction problem enables the use of stable and scalable transformer architectures that can fully exploit long-horizon dependencies and temporal structures that are critical for safe decision making [7,17].

4. Methodology

4.1. Conditioned Sequence Modeling in CMDPs

We analyze how conditional sequence modeling behaves in an idealized CMDP setting with infinite data and a fully expressive policy class. Our goal is to show that, under suitable assumptions, the policy that optimizes the CDT objective (2) is guaranteed to be near-optimal for the underlying CMDP. Let P π β denote the joint distribution over states, actions, returns, and costs induced by π β and the CMDP dynamics. Recall that CDT is trained to maximize the likelihood of actions conditioned on states and target return–cost signals. Thus, when the model is given a conditioning function
F : S → R 2 , and F ( s ) = F R ( s ) , F C ( s ) ,
the CDT loss in (2) attempts to learn the conditional distribution P π β ( a ∣ s , F ( s ) ) . In the infinite-data and realizable limit, the optimal CDT policy (denoted by π F CDT ) for a fixed conditioning function F can be written as
π F CDT ( a ∣ s ) = P π β a ∣ s , F ( s ) = P π β ( a ∣ s ) P π β F ( s ) ∣ s , a P π β F ( s ) ∣ s = π β ( a ∣ s ) P π β F ( s ) ∣ s , a P π β F ( s ) ∣ s .
Here, F R ( s ) and F C ( s ) can be interpreted as the target RTG and CTG associated with state s, and P π β F ( s ) ∣ s , a denotes the probability (under π β ) that the trajectory starting from ( s 1 = s , a 1 = a ) attains total return and cost equal to F ( s ) . In other words, π F CDT re-weights the behavior policy π β ( · ∣ s ) according to how likely each action is to lead to a trajectory whose joint return–cost pair matches the conditioning signal F ( s ) .
Our analysis relies on a coverage condition and a mild regularity assumption. For an initial state s 1 ∈ S , let R ( τ ) and C ( τ ) denote the (random) return and cost of a trajectory τ sampled from the behavior policy π β starting from s 1 . Represent the return–cost coverage for s 1 by P π β ( R ( τ ) , C ( τ ) ) = F ( s 1 ) | s 1 , which is the conditional probability that the total return and cost of the trajectory match the conditioning signal F ( s 1 ) . For any policy π , we define J R ( π ) : = E τ ∼ π [ R ( τ ) ] and J C ( π ) : = E τ ∼ π [ C ( τ ) ] as its expected return and expected cumulative cost, respectively.
Assumption 1. 
1. Return–cost coverage. There exists a constant α F > 0 such that
P π β ( R ( τ ) , C ( τ ) ) = F ( s 1 ) | s 1 ≥ α F , ∀ s 1 ∼ μ .
2. 
Near determinism. (This assumption does not restrict the stochasticity of the initial state s 1 ∼ μ .) There exist deterministic functions T : S × A → S , r : S × A → R , and c : S × A → [ 0 , 1 ] such that, for all ( s , a ) and all time steps t,
P r t ≠ r ( s , a ) or c t ≠ c ( s , a ) or s t + 1 ≠ T ( s , a ) | s t = s , a t = a ≤ ε .
3. 
Consistency of F. For every transition ( s , a , s ′ ) under the deterministic dynamics T, the conditioning function F ( s ) = ( F R ( s ) , F C ( s ) ) satisfies
F R ( s ) = F R ( s ′ ) + r ( s , a ) , F C ( s ) = F C ( s ′ ) + c ( s , a ) .
Theorem 1
(Joint alignment with respect to the conditioning function in CMDPs). Consider a finite-horizon CMDP, a behavior policy π β , and a conditioning function F : S → R 2 . Suppose Assumption 1 is satisfied. Let π F CDT denote the CDT policy in (3). Then there exists a universal constant C > 0 , such that
E s 1 ∼ μ F R ( s 1 ) − J R π F CDT ≤ C ε 1 α F + 2 H 2 ,
E s 1 ∼ μ F C ( s 1 ) − J C π F CDT ≤ C ε 1 α F + 2 H 2 .
The proof is provided in Appendix A.1.
Theorem 1 formalizes the alignment behavior of return–cost conditioned sequence modeling in CMDPs. Under joint return–cost coverage and near-deterministic dynamics, the optimal solution to the CDT objective induced by a fixed conditioning function F produces a policy whose expected return and expected cumulative cost track the prescribed targets, with a mismatch bounded by O ε ( 1 α F + 2 ) H 2 . This result provides a theoretical basis for viewing RTG/CTG conditioning as a mechanism for zero-shot control of the return–cost trade-off: when the target profile specified by F is sufficiently represented in the behavior data (large α F ), conditioning can be realized reliably up to a controllable error. At the same time, the explicit dependence on α F clarifies a fundamental limitation of naive target conditioning in offline safe RL. In realistic datasets where safe high-return trajectories are scarce, α F can be small for ambitious targets, and the induced policy may substantially deviate from the intended profile, leading to unstable return–cost trade-offs and even constraint violations. In particular, simply specifying a high RTG together with a low CTG does not reliably yield favorable return–cost trade-offs on challenging datasets with limited coverage of safe, high-performance behaviors.
This motivates augmenting the plain CDT backbone with data-aware mechanisms that reshape the effective training distribution and provide additional optimization signals beyond maximum likelihood. Specifically, we seek to bias learning toward trajectories with more desirable return–cost profiles while retaining the flexibility of target conditioning for multi-threshold, zero-shot deployment. Notably, the same proof technique also extends to multi-goal conditioning by viewing each conditioning coordinate as an additional scalar, reward-like signal that obeys a Markov-consistent recursion along transitions, leading to analogous coverage-dependent alignment bounds in higher-dimensional conditioning spaces. In the following, we instantiate this principle by introducing a regularized CDT variant that incorporates trajectory-level reweighting and value-based terms, aligning with a broader line of work showing that reweighting and regularization can substantially improve DT-style and CSM-based offline RL under distribution shift and data imbalance [13,18,26,36].
Theorem 1 characterizes the infinite-data behavior of the ideal CDT policy induced by a fixed conditioning function F. We next give a finite-data extension showing that, under an additional occupancy-mismatch condition, the performance gap between the ideal CMDP-conditioned CDT policy and a finite-data estimator can be reduced to the supervised learning loss optimized by CDT. Let d β ( s ) : = 1 H ∑ t = 1 H P π β ( s t = s ) ,   d F ( s ) : = 1 H ∑ t = 1 H P π F CDT ( s t = s ) denote the average state occupancies of the behavior policy and the ideal CDT policy, respectively. For any candidate conditional policy π ^ ( a ∣ s , R , C ) , define its deployment under the conditioning function F by π ^ F ( a ∣ s ) : = π ^ ( a ∣ s , F R ( s ) , F C ( s ) ) . We also define the expected CDT loss as
L CDT ( π ^ ) : = E s ∼ d β E ( R , C ) ∼ P π β ( · ∣ s ) D KL P π β ( · ∣ s , R , C ) ∥ π ^ ( · ∣ s , R , C ) .
Assumption 2
(Bounded occupancy mismatch). There exists a constant C F > 0 , such that
d F ( s ) d β ( s ) ≤ C F , ∀ s ∈ S w i t h d β ( s ) > 0 .
Theorem 2
(Finite-data reduction of CMDP-conditioned CDT to supervised learning). Consider the finite-horizon CMDP setting in Theorem 1, and suppose that Assumption 1 holds, i.e.,
P π β ( R ( τ ) , C ( τ ) ) = F ( s ) ∣ s ≥ α F , ∀ s ∼ μ .
Assume further that Assumption 2 holds. Let π ^ ( a ∣ s , R , C ) be any estimated conditional policy, and let π ^ F denote its deployed policy under F. Then
| J R ( π F CDT ) − J R ( π ^ F ) | ≤ C F α F H 2 2 L CDT ( π ^ ) ,
| J C ( π F CDT ) − J C ( π ^ F ) | ≤ C F α F H 2 2 L CDT ( π ^ ) .
Proof. 
For brevity, write
z : = ( R , C ) , z F ( s ) : = F ( s ) = ( F R ( s ) , F C ( s ) ) .
For each state s, define the joint distributions
p s ( a , z ) : = P π β ( a , z ∣ s ) , q s ( a , z ) : = P π β ( z ∣ s ) π ^ ( a ∣ s , z ) .
By construction, the ideal CDT policy satisfies
π F CDT ( a ∣ s ) = P π β ( a ∣ s , z F ( s ) ) = p s ( a , z F ( s ) ) P π β ( z F ( s ) ∣ s ) ,
while
π ^ F ( a ∣ s ) = π ^ ( a ∣ s , z F ( s ) ) = q s ( a , z F ( s ) ) P π β ( z F ( s ) ∣ s ) .
Therefore,
∥ π F CDT ( · ∣ s ) − π ^ F ( · ∣ s ) ∥ 1 = ∑ a p s ( a , z F ( s ) ) P π β ( z F ( s ) ∣ s ) − q s ( a , z F ( s ) ) P π β ( z F ( s ) ∣ s ) = 1 P π β ( z F ( s ) ∣ s ) ∑ a | p s ( a , z F ( s ) ) − q s ( a , z F ( s ) ) | ≤ 1 P π β ( z F ( s ) ∣ s ) ∑ a , z | p s ( a , z ) − q s ( a , z ) | .
By the joint return–cost coverage assumption,
P π β ( z F ( s ) ∣ s ) ≥ α F .
Substituting this into (12) and then applying Pinsker’s inequality gives
∥ π F CDT ( · ∣ s ) − π ^ F ( · ∣ s ) ∥ 1 ≤ 1 α F ∥ p s − q s ∥ 1 ≤ 1 α F 2 D KL ( p s ∥ q s ) .
Next, we bound the performance difference by the action-distribution mismatch. For reward, by the standard performance-difference decomposition for finite-horizon MDPs,
J R ( π F CDT ) − J R ( π ^ F ) = ∑ t = 1 H E s t ∼ d t F ∑ a π F CDT ( a ∣ s t ) − π ^ F ( a ∣ s t ) Q R , t π ^ F ( s t , a ) ,
where d t F is the state distribution at time t under π F CDT , and Q R , t π ^ F is the reward-to-go under π ^ F . Since each per-step reward is bounded by 1, we have
∥ Q R , t π ^ F ( s , · ) ∥ ∞ ≤ H − t + 1 ≤ H .
Hence,
| J R ( π F CDT ) − J R ( π ^ F ) | ≤ H ∑ t = 1 H E s t ∼ d t F ∥ π F CDT ( · ∣ s t ) − π ^ F ( · ∣ s t ) ∥ 1 = H 2 E s ∼ d F ∥ π F CDT ( · ∣ s ) − π ^ F ( · ∣ s ) ∥ 1 .
Using Assumption 2,
E s ∼ d F [ g ( s ) ] ≤ C F E s ∼ d β [ g ( s ) ]
for any non-negative function g. Applying this to (15) and then using (13), we obtain
| J R ( π F CDT ) − J R ( π ^ F ) | ≤ C F H 2 E s ∼ d β ∥ π F CDT ( · ∣ s ) − π ^ F ( · ∣ s ) ∥ 1 ≤ C F α F H 2 E s ∼ d β 2 D KL ( p s ∥ q s ) ≤ C F α F H 2 2 E s ∼ d β D KL ( p s ∥ q s ) ,
where the last step follows from Jensen’s inequality.
It remains for us to identify the expectation in (16) with the CDT loss. Since
p s ( a , z ) = P π β ( z ∣ s ) P π β ( a ∣ s , z ) , q s ( a , z ) = P π β ( z ∣ s ) π ^ ( a ∣ s , z ) ,
the chain rule of KL divergence yields
D KL ( p s ∥ q s ) = E z ∼ P π β ( · ∣ s ) D KL P π β ( · ∣ s , z ) ∥ π ^ ( · ∣ s , z ) .
Taking expectation over s ∼ d β gives exactly L CDT ( π ^ ) in (9). Substituting into (16) proves (10).
The proof of the cost bound is identical. Since each per-step cost is bounded by 1, we have
∥ Q C , t π ^ F ( s , · ) ∥ ∞ ≤ ( H − t + 1 ) ≤ H ,
which yields
| J C ( π F CDT ) − J C ( π ^ F ) | ≤ C F α F H 2 2 L CDT ( π ^ ) .
This completes the proof.    □
Theorem 2 reduces the CMDP performance gap to the supervised loss optimized by CDT. We next convert this reduction into a finite sample bound under a finite policy class and standard uniform-convergence assumptions.
Let D = { ( s i , a i , R i , C i ) } i = 1 N be a dataset of N i.i.d. samples drawn from the joint distribution induced by d β ( s ) and P π β ( a , R , C ∣ s ) . For a policy class Π , define the empirical loss
L ^ CDT ( π ) : = 1 N ∑ i = 1 N − log π ( a i ∣ s i , R i , C i ) ,
and let π ^ ∈ arg min π ∈ Π L ^ CDT ( π ) .
Corollary 1
(Sample complexity of plain CMDP-conditioned CDT). Under the assumptions of Theorem 2, additionally assume that
1.
Π is finite;
2.
There exists a constant c > 0 such that
0 ≤ − log π ( a ∣ s , R , C ) ≤ c , ∀ π ∈ Π , ∀ ( s , a , R , C ) ;
3.
The approximation error of Π is bounded by ε approx , i.e.,
min π ∈ Π L CDT ( π ) ≤ ε approx .
Then for any δ ∈ ( 0 , 1 ) , with probability at least 1 − δ ,
| J R ( π F CDT ) − J R ( π ^ F ) | ≤ C F α F H 2 2 ε approx + 4 c log | Π | + log ( 2 / δ ) 2 N ,
| J C ( π F CDT ) − J C ( π ^ F ) | ≤ C F α F H 2 2 ε approx + 4 c log | Π | + log ( 2 / δ ) 2 N .
Equivalently, up to universal constants,
| J R ( π F CDT ) − J R ( π ^ F ) | ≤ O C F α F H 2 c ( log | Π | + log ( 1 / δ ) ) N 1 / 4 + ε approx ,
| J C ( π F CDT ) − J C ( π ^ F ) | ≤ O C F α F H 2 c ( log | Π | + log ( 1 / δ ) ) N 1 / 4 + ε approx .
Proof. 
For each fixed π ∈ Π , the random variable
ℓ π ( s , a , R , C ) : = − log π ( a ∣ s , R , C )
takes values in [ 0 , c ] . Therefore, by Hoeffding’s inequality,
Pr | L ^ CDT ( π ) − L CDT ( π ) | ≥ η ≤ 2 exp − 2 N η 2 c 2 .
Applying a union bound over all π ∈ Π , we obtain that with probability at least 1 − δ ,
sup π ∈ Π | L ^ CDT ( π ) − L CDT ( π ) | ≤ c log | Π | + log ( 2 / δ ) 2 N .
Let
π Π ★ ∈ arg min π ∈ Π L CDT ( π ) .
Since π ^ minimizes the empirical loss,
L ^ CDT ( π ^ ) ≤ L ^ CDT ( π Π ★ ) .
Using (23) twice, we obtain
L CDT ( π ^ ) ≤ L ^ CDT ( π ^ ) + c log | Π | + log ( 2 / δ ) 2 N ≤ L ^ CDT ( π Π ★ ) + c log | Π | + log ( 2 / δ ) 2 N ≤ L CDT ( π Π ★ ) + 2 c log | Π | + log ( 2 / δ ) 2 N ≤ ε approx + 2 c log | Π | + log ( 2 / δ ) 2 N .
Substituting (24) into Theorem 2 gives (19) and (20). The simplified N − 1 / 4 -form follows by
x + y ≤ x + y .
This completes the proof.    □
Remark 1.
Assumption 1 adopts an equality-based return–cost coverage condition,
P π β ( R ( τ ) , C ( τ ) ) = F ( s 1 ) ∣ s 1 ≥ α F ,
which is consistent with prior theoretical analyses of conditional sequence modeling in RL [18,26] and is particularly natural in idealized or tokenized formulations where return and cost signals are discrete or effectively quantized. The coverage condition can be extended in a straightforward manner to neighborhood-based (δ) coverage, which replaces exact matching by requiring non-trivial probability mass in a δ-neighborhood of the target signal, i.e.,
P π β ∥ ( R ( τ ) , C ( τ ) ) − F ( s 1 ) ∥ ≤ δ ∣ s 1 .
Another closely related perspective is to define coverage through density-based support via a kernel K δ : R 2 → R ≥ 0 (e.g., a Gaussian kernel or a ball indicator); for example,
α ˜ F : = inf s 1 ∼ μ E ( R , C ) ∼ P π β ( · ∣ s 1 ) K δ ( R , C ) − F ( s 1 ) .
In Equation (3), such a smoothing corresponds to replacing P π β F ( s ) ∣ s , a by a smoothed likelihood of landing near F ( s ) , yielding the same reweighting interpretation in a continuous manner.

4.2. Trajectory-Weighted Value-Regularized Constrained Decision Transformer

Building on CDT, we introduce two data-aware training ingredients to improve algorithm performance while retaining the RTG/CTG conditioning interface for multi-threshold, zero-shot deployment. Specifically, we (i) reshape the effective training distribution via trajectory-level reweighting toward more desirable return–cost profiles, and (ii) incorporate value-based guidance as an additional optimization signal to discourage overly conservative behaviors. This design follows the technical progression summarized in Table 1: it generalizes the sub-dataset resampling used in DT-style methods (e.g., RDT/RVDT) to a more flexible trajectory-level scheme, and adapts the Q-value regularization principle of QT to the constrained CDT setting.
Let R ( τ ) and C ( τ ) denote the cumulative return and cumulative cost of a trajectory τ ∈ D respectively. We introduce a non-negative weighting function
W : R 2 → R > 0 , W τ = W R ( τ ) , C ( τ ) ,
which assigns larger weights to trajectories that exhibit more favorable return–cost trade-offs. It suffices to note that W τ depends jointly on return and cost, and therefore encodes both performance and safety preferences at the trajectory level. Given these weights, consider the following weighted variant of the CDT loss:
L ( θ ) = − ∑ τ ∈ D ∑ t = 1 H W τ log π θ a t | s t , R ¯ t , C ¯ t , τ ¯ t − 1 K .
The loss (26) preserves the behavior-cloning structure of CDT while explicitly rebalancing the empirical training distribution toward trajectories that are simultaneously high-return and low-cost.
To connect this formulation with existing DT-based methods, we draw a connection to the KL-based expert regularization used by RDT and RVDT in prior work [26]. Consider the RDT objective:
L RDT ( θ ) = E τ ∼ D ∑ t = 1 H − log π θ a t | s t , g ( τ t ) , τ ¯ t − 1 K + α E τ ∼ D e ∑ t = 1 H KL π θ ( · | s t , g ( τ t ) , τ ¯ t − 1 K ) ∥ π e ( · | s t ) ,
where D e ⊂ D is a subset of near-optimal trajectories and π e is an expert policy obtained from imitation learning on D e . The following result shows that the expert KL term implicitly induces a particular trajectory-level weighting scheme, and can therefore be seen as a special case of our general reweighting formulation.
Proposition 1
(KL regularization as a special case of trajectory weighting). Assume that π θ is parameterized as a factorized Gaussian policy with a fixed standard deviation and that π e is fitted on D e via maximum-likelihood imitation learning. Then the RDT objective in Equation (27) can be rewritten as a weighted DT loss:
arg min π θ L RDT ( θ ) = arg min π θ E τ ∼ D W τ RDT ∑ t = 1 H − log π θ a t | s t , g ( τ t ) , τ ¯ t − 1 K ,
with trajectory weights W τ RDT = 1 + α I τ ∈ D e , α ≥ 0 .
The proof is provided in Appendix A.2.
Proposition 1 indicates that KL-based expert regularization effectively performs a weighted resampling of expert trajectories, where all trajectories in D e share an increased weight and all others retain unit weight. In this sense, RDT is a special case of trajectory-level reweighting that is typically constructed based on return ranking. Our formulation in Equation (26) generalizes this mechanism by allowing W τ to depend on both return and cost, and by instantiating it on the constrained CDT backbone.
In addition, prior results from QT [13] and RVDT [26] indicate that value-based regularization can improve the robustness of DT-style policies for challenging offline datasets. Accordingly, we augment Equation (26) with a value guidance term and obtain
L TVCDT ( θ ) = − ∑ τ ∈ D ∑ t = 1 H W τ log π θ a t | s t , R ¯ t , C ¯ t , τ ¯ t − 1 K − η E τ ∼ D E s t ∼ τ , a t ∼ π θ Q π θ ( s t , a t ) ,
where η > 0 is a regularization coefficient and Q π θ denotes the action-value function of the current CSM policy π θ . We term the resulting algorithm as Trajectory-Weighted Value-Regularized Constrained Decision Transformer (TVCDT). The first term in Equation (29) performs explicit trajectory-level return-cost reweighting on CDT, and the second term provides an optimization signal that encourages actions with higher long-term value under  π θ .

4.3. Return–Cost Regularized Constrained Decision Transformer

While TVCDT already biases learning toward trajectories that are both high-return and low-cost, it lacks an explicit cost-penalization mechanism to further discourage unsafe behavior. A standard approach in safe reinforcement learning is to formulate policy learning as a constrained optimization problem in CMDPs and to introduce Lagrangian penalties to balance performance and safety. Following this perspective, we derive a cost-penalized training objective together with an adaptive update rule for its coefficient, while avoiding coupling CDT to a single fixed-cost threshold. To motivate the penalty term, consider minimizing the weighted CDT loss with value guidance subject to an upper bound κ on the expected cumulative cost of the learned policy. A CMDP-style formulation can be written as
min θ − ∑ τ ∈ D ∑ t = 1 H W τ log π θ a t ∣ s t , R ¯ t , C ¯ t , τ ¯ t − 1 K − η E τ ∼ D E s t ∼ τ , a t ∼ π θ Q π θ ( s t , a t ) s . t . J c ( θ ) : = E τ ∼ D E s t ∼ τ , a t ∼ π θ C π θ ( s t , a t ) ≤ κ ,
where κ > 0 denotes a target cost level. Introducing a Lagrange multiplier λ ≥ 0 leads to the Lagrangian
L lag ( θ , λ ) = − ∑ τ ∈ D ∑ t = 1 H W τ log π θ a t ∣ s t , R ¯ t , C ¯ t , τ ¯ t − 1 K − η E τ ∼ D E s t ∼ τ , a t ∼ π θ Q π θ ( s t , a t ) + λ E τ ∼ D E s t ∼ τ , a t ∼ π θ C π θ ( s t , a t ) − κ .
Equation (31) serves as a motivating formulation rather than as a strict optimization problem: it suggests that a natural way to bias the policy towards safer behaviors is to augment the training loss with the expected cost term, weighted by an appropriate coefficient. Imposing this constraint as a hard requirement tied to a fixed κ would also be at odds with the zero-shot adaptation capability of conditional sequence modeling, where a single CDT policy is expected to generalize across a range of cost thresholds. Instead, we treat the cost term as a flexible regularizer whose influence is controlled by an adaptive coefficient λ .
Finally, we arrive at our offline safe RL algorithm, referred to as Return–Cost Regularized Constrained Decision Transformer (RCDT), by optimizing the following cost-penalized actor objective:
L RCDT ( θ ) = − ∑ τ ∈ D ∑ t = 1 H W τ log π θ a t ∣ s t , R ¯ t , C ¯ t , τ ¯ t − 1 K − η E τ ∼ D E s t ∼ τ , a t ∼ π θ Q π θ ( s t , a t ) + λ E τ ∼ D E s t ∼ τ , a t ∼ π θ C π θ ( s t , a t ) ,
where we reinterpret λ > 0 as an adaptive regularization coefficient rather than an exact Lagrange multiplier associated with a fixed hard constraint, thereby using it to balance performance and safety. To obtain such an adaptive update rule, we note that the derivative of the Lagrangian in Equation (31) with respect to λ is proportional to J c ( θ ) − κ . This suggests adjusting λ according to whether the current policy is above or below the target cost level. In practice, let J ^ c ( θ ) denote a minibatch estimate of
J c ( θ ) = E τ ∼ D E s t ∼ τ , a t ∼ π θ C π θ ( s t , a t ) .
We update λ using
λ ← Π [ 0 , λ max ] λ + β J ^ c ( θ ) − κ ,
where Π [ 0 , λ max ] denotes the Euclidean projection onto the interval [ 0 , λ max ] , β t > 0 is the update step size, J ^ c ( θ t ) is the estimated cumulative cost at iteration t, and κ is the reference cost threshold. When the estimated expected cost J ^ c ( θ ) exceeds κ , λ is increased and the cost penalty in Equation (32) becomes stronger; when the J ^ c ( θ ) falls below κ , the penalty is gradually relaxed. This update follows the primal–dual intuition of adjusting a penalty coefficient based on the current level of constraint violation, and provides an automatic way to tune the strength of safety regularization during training. Importantly, since the CDT architecture explicitly conditions on cost tokens, the resulting policy remains compatible with evaluation under multiple cost thresholds without retraining and κ should be interpreted as a training-time reference level, rather than a hard constraint that fixes a single deployment threshold.
To further clarify the role of the adaptive coefficient λ , we note that the clipped update used in practice can be equivalently viewed as a projection step onto a compact interval. This observation does not by itself imply convergence of the full nonconvex Transformer training objective, but it does provide a simple and rigorous boundedness guarantee for the dual coefficient throughout training.
Proposition 2
(Boundedness of the adaptive coefficient). Consider the update
λ t + 1 = Π [ 0 , λ max ] λ t + β t J ^ c ( θ t ) − κ ,
where Π [ 0 , λ max ] denotes the Euclidean projection onto the interval [ 0 , λ max ] , β t > 0 is the update step size, J ^ c ( θ t ) is the estimated cumulative cost at iteration t, and κ is the reference cost threshold. Then, for any initialization λ 0 ∈ [ 0 , λ max ] , the iterate sequence satisfies
λ t ∈ [ 0 , λ max ] , ∀ t ≥ 0 .
Proof. 
The result follows directly from the definition of the projection. Assume λ t ∈ [ 0 , λ max ] . Let
u t : = λ t + β t J ^ c ( θ t ) − κ .
By definition of the Euclidean projection onto the closed interval [ 0 , λ max ] ,
λ t + 1 = Π [ 0 , λ max ] ( u t ) ∈ [ 0 , λ max ] .
Since λ 0 ∈ [ 0 , λ max ] , the claim follows by induction.    □
Proposition 2 shows that the clipped update of λ admits a standard projection-based interpretation. Therefore, the adaptive coefficient remains bounded throughout training by construction. We emphasize that this boundedness result is a property of the projected dual update itself, and should be understood as a stability guarantee for the coefficient λ , rather than as a convergence guarantee for the full nonconvex optimization of the Transformer-based objective.
In practice, the trajectory weights W τ in Equation (32) are instantiated by a return–cost shaped function that increases with return and decreases with cost relative to a prescribed limit. Specifically, we use
W τ = exp α R ( τ ) sigmoid γ ( c lim − C ( τ ) ) ,
where α and γ control the sensitivity of W τ to return and cost, and c lim denotes a trajectory-level cost reference. This choice is consistent with the general form W τ = W R ( τ ) , C ( τ ) introduced in Section 4.2, and makes explicit how return and cost jointly shape the effective training distribution.
Figure 2 illustrates the effect of Equation (34) on representative tasks. Each point corresponds to a trajectory in the offline dataset, with cumulative cost on the horizontal axis and return on the vertical axis; color intensity indicates the magnitude of W τ (darker means larger weight). As costs increase beyond the reference c lim , trajectories are progressively down-weighted, whereas trajectories that achieve higher returns while remaining within (or near) the cost reference are emphasized. This visualization highlights how trajectory-level return–cost reweighting reshapes the training signal toward safer and more performant regions of the offline data.
Putting these components together, RCDT can be viewed as a CMDP-inspired extension of CDT within the CSM paradigm. It retains the target-conditioning interface of CDT for multi-threshold, zero-shot evaluation, while augmenting maximum-likelihood training with three complementary ingredients: trajectory-level return–cost reweighting to emphasize favorable behaviors in the offline data, value-based guidance to refine the policy beyond pure imitation, and an explicit cost penalty whose coefficient is adaptively tuned to control safety in expectation. In this way, RCDT aligns with the DT-based objective design path summarized in Table 1, while remaining directly applicable to zero-shot adaptation across multiple cost thresholds at evaluation time.

4.4. Training and Inference

We instantiate RCDT using a transformer-based architecture. The policy π θ is implemented as an autoregressive Transformer that takes as input a context window of past states, actions, and target return–cost tokens, and outputs the parameters of a stochastic policy. Following common practice in sequence-modeling RL, π θ is modeled as a factorized Gaussian distribution whose mean and log-variance are predicted by separate fully connected output heads at each step of the sequence. For a CDT policy π θ · ∣ s i , R ¯ i , C ¯ i , τ ¯ i − 1 K at timestep i, R ¯ i and C ¯ i denote the RTG and CTG tokens obtained by cumulatively summing future rewards and costs along the underlying trajectory, and τ ¯ i − 1 K denotes the length-K history of past states and actions. When i − K < 1 , the context window τ ¯ i − 1 K is truncated to the available prefix of the trajectory.
Training. The overall training pipeline of RCDT is summarized in Algorithm 1. Prior to training, the cumulative return R ( τ ) and cumulative cost C ( τ ) are computed for each trajectory τ ∈ D . These statistics are used to instantiate the trajectory weights W τ via Equation (34), which increase with return and decrease with cost relative to a reference limit c lim . During each training iteration, a trajectory τ is sampled from the dataset, a length-K subsequence is extracted, and the corresponding CDT inputs are ( s i , R ¯ i , C ¯ i , τ ¯ i − 1 K ) .
Value learning is carried out using standard offline temporal-difference (TD) methods. The reward critic Q ψ approximates the action-value function Q π θ , while the cost critic C ξ approximates the cost-to-go function C π θ . Given a transition ( s K − 1 , a K − 1 , r K − 1 , c K − 1 , s K ) from the sampled subsequence, a next action a ^ K is drawn from the current policy π θ ( · ∣ s K , R ¯ K , C ¯ K , τ ¯ K − 1 K ) , and TD targets are constructed using ( s K − 1 , a K − 1 , r K − 1 , s K , a ^ K ) and ( s K − 1 , a K − 1 , c K − 1 , s K , a ^ K ) for the reward and cost critics, respectively. In practice, standard stabilization techniques such as target networks [47] and double Q-learning [48] are employed for both Q ψ and C ξ .
Algorithm 1: RCDT: Return–Cost Regularized Constrained Decision Transformer
Mathematics 14 01015 i001
The policy parameters θ are updated by minimizing the actor loss in Equation (32). Concretely, for each CDT input in the subsequence, an action a ^ i is sampled from π θ ( · ∣ s i , R ¯ i , C ¯ i , τ ¯ i − 1 K ) , and the corresponding critic evaluations Q ψ ( s i , a ^ i ) and C ξ ( s i , a ^ i ) are used to form a Monte Carlo estimate of the expectations in Equation (32). The trajectory weight W τ is applied to the negative log-likelihood term to realise the return-cost reweighting effect. The critic-based terms provide value and cost guidance, and the combined stochastic gradient is used to update θ via gradient descent.
The coefficient λ that controls the strength of the cost penalty is updated adaptively according to Equation (33). At each iteration, an empirical estimate J ^ c ( θ ) of J c ( θ ) = E τ ∼ D E s t ∼ τ , a t ∼ π θ C π θ ( s t , a t ) is obtained by averaging C ξ ( s i , a ^ i ) over the sampled subsequence. The update λ ← [ λ + β ( J ^ c ( θ ) − κ ) ] + then increases λ when the current policy exceeds the reference cost level κ , and decreases it otherwise. As discussed in Section 4.3, λ is therefore interpreted as an adaptive regularization coefficient rather than an exact Lagrange multiplier, and its update rule is inspired by Lagrangian dual ascent in safe RL.
Inference. The inference procedure of RCDT closely follows that of CDT and other CSM methods, with the additional capability of conditioning on cost. At each decision step, the model receives four input sequences: the target RTG, the target CTG, the past states, and the past actions. Given these inputs, the Transformer autoregressively predicts a sequence of K actions, of which only the final action in the window is executed in the environment.
After executing the selected action and observing the realized reward and cost, both the RTG and CTG tokens are updated for the next timestep. Specifically, the target RTG is decreased by the observed reward, and the target CTG is decreased by the observed cost, mirroring the cumulative structure used to construct R ¯ t and C ¯ t in the offline dataset. These updated tokens are appended to the conditioning sequence and fed back into the Transformer to generate the next action sequence. Different evaluation thresholds on the cumulative cost are imposed by choosing different initial CTG values without retraining the model. In this way, RCDT preserves the zero-shot adaptation capability of CDT across a range of safety requirements, while leveraging trajectory-level reweighting, value guidance, and cost regularization to produce policies that are both high-performing and safety-aware.

5. Experiments

We conduct a comprehensive empirical evaluation of RCDT on the DSRL benchmark [19]. In Section 5.1, we compare RCDT against a broad range of representative offline safe RL baselines spanning multiple methodological paradigms, including imitation learning [1], value-based methods [10,23,24], CSM-based approaches [7], distribution-matching methods [9], as well as data-quality and feasible-region methods [2,11]. In Section 5.2, ablation studies are conducted to analyze how each key component of RCDT affects the safety–performance trade-off, focusing on the Lagrangian-style cost penalty, trajectory-level reweighting, and Q-value regularization. Moreover, to further assess the robustness of RCDT  under more demanding evaluation settings, dataset variants from the original DSRL benchmark with (i) a lower proportion of expert-level trajectories and (ii) more imbalanced data distributions are considered.
Tasks. We evaluate RCDT on the DSRL benchmark [19], a public benchmark that includes a variety of continuous-control and robot locomotion tasks commonly used in prior offline safe RL research [1,2,4,10,11,25,49]. DSRL provides offline datasets collected from three widely used safety-critical simulators, including Mujoco-based SafetyGym [50], PyBullet-based BulletSafetyGym [51], and the autonomous-driving simulator MetaDrive [52]. In SafetyGym, we consider goal-reaching, pushing, and circle-tracking tasks with two agent morphologies (Point and Car). The agent is rewarded for completing the intended objective, such as reaching a target location, pushing an object to a goal, or tracking a circular route, while safety cost is incurred when the agent enters hazardous regions and, for circle-style tasks, when it violates the safety boundary constraints. We additionally include velocity-constrained locomotion tasks with standard Mujoco agents, including Swimmer, Hopper, HalfChee, Walker2d, and Ant. In these tasks, reward encourages forward progress, whereas cost is triggered when the agent’s speed exceeds a predefined limit. BulletSafetyGym provides analogous safety-critical locomotion tasks with different robot morphologies. We evaluate on Run and Circle tasks with multiple robots (Ball, Car, Drone, and Ant). In Run, the agent is rewarded for fast forward motion within boundaries, but incurs cost when leaving the corridor or exceeding a velocity cap. In Circle, the agent is rewarded for clockwise circular motion while being penalized for leaving a designated safe region. Finally, in MetaDrive we evaluate offline safe driving datasets with increasing scenario difficulty and traffic density (e.g., Easy/Medium/Hard combined with Sparse/Mean/Dense), which capture realistic safety–performance tensions in interactive driving. Here reward encourages route progress and stable driving, while safety cost is issued for events such as collisions and driving out of the road. Across all suites, reward promotes task completion, whereas cost penalizes safety violations. This inherent reward–cost conflict makes it necessary to balance return maximization against cumulative cost constraints: aggressively pursuing high reward can lead to constraint violations, while overly conservative policies tend to satisfy constraints at the expense of performance.
Baselines. We compare RCDT against the following baselines. (i) Imitation learning: Behavior cloning (BC) and its safety-aware variant BC-Safe [1]. (ii) Value-based with constraint handling: CPQ [10], BCQ-Lag, and BEAR-Lag, where the latter two are safety-constrained variants of BCQ [23] and BEAR [24] obtained by incorporating Lagrangian penalties. (iii) CSM-based: Constrained Decision Transformer (CDT) [7], a representative CSM method that learns conditioned policies. (iv) Distribution matching: COptiDICE [9], which performs constrained policy optimization via occupancy-measure matching in the DICE family [53]. (v) Data-quality and feasible-region methods: TraC [2], and FISOR [11], which explicitly reason about safe regions or trajectory-level feasibility.
Implementation. Our implementation of RCDT is built upon the CDT implementation provided in the OSRL (https://github.com/liuzuxin/OSRL/tree/main (accessed on 12 March 2026)) project repository released by the CDT authors. We reproduce CDT using this codebase and its recommended hyperparameters. For the remaining baselines, we either run their publicly available implementations or report results from the original papers or representative prior work [1,2,3,4], depending on availability. Additional implementation details are provided in Appendix B.2.
Evaluation. We follow the standard constraint-variation evaluation protocol for offline safe RL [1,2,19], which assesses an algorithm’s robustness and versatility under different levels of safety constraints. Concretely, each method is evaluated on every dataset under three target cumulative-cost thresholds, i.e., { 20 , 40 , 80 } for SafetyGym, { 10 , 20 , 40 } for BulletSafetyGym, and { 10 , 20 , 40 } for MetaDrive, and the final score is obtained by averaging over these thresholds. For methods that can be evaluated under multiple thresholds without retraining (BC, BC-Safe, CDT, and our RCDT), we train a single policy per dataset and evaluate its behavior across all thresholds in a zero-shot manner. Notably, although CDT and RCDT involve a target cost level κ during training, which is set as a fixed hyperparameter for each dataset, the learned policies remain CTG-conditioned and are evaluated across all target thresholds without additional retraining. By contrast, for threshold-dependent baselines whose training objective explicitly depends on the target constraint level, including BCQ-Lag, BEAR-Lag, COptiDICE, CPQ, FISOR, and TraC, we train separate models for different thresholds following their original training pipelines and the benchmark protocol to align with their intended training settings. Overall, this protocol provides a comprehensive assessment of the return–cost trade-off across a range of cost requirements, and it also directly validates the zero-shot deployment capability of RCDT under varying cost thresholds.
Metrics. We report the normalized return and cumulative cost as the comparison metrics, consistent with prior offline safe RL literature [1,2,19]. Let R max ( T ) and R min ( T ) denote the maximum and minimum returns, respectively, observed in dataset T . The normalized return is computed by
R normalized = R π − R min ( T ) R max ( T ) − R min ( T ) ,
where R π denotes the evaluated return of policy π . The normalized cumulative cost is defined by the ratio of the evaluated cumulative cost C π to the target threshold ζ , i.e., C normalized = C π / ζ with ζ > 0 , noting that all costs in our setting are non-negative.

5.1. Main Results for RCDT on DSRL Benchmark

The experimental results of RCDT and all baselines on the DSRL benchmark are summarized in Table 2. Overall, RCDT achieves consistently strong performance across SafetyGym, BulletSafetyGym, and MetaDrive, attaining the best return–cost performance on the majority of tasks. Interpreting Table 2 requires jointly considering safety and task performance. We first identify methods that satisfy the cost constant, indicated by bold entries where the averaged normalized cost is below 1. Among these safe methods, we primarily compare the averaged normalized return, with the highest safe return highlighted in blue. Lower cost among already-safe methods is reported but treated as secondary, since overly conservative behavior can reduce cost without translating into meaningful task progress. This evaluation criterion aligns with the objective of constrained offline RL: satisfying safety requirements while preserving as much task performance as possible.
BC simply imitates the behavior in the offline dataset without any cost awareness, and can be viewed as an approximation of the behavior policy β . As shown in Table 2, such naive imitation does not provide meaningful safety guarantees, and often yields costs well above the constant. BC-Safe, in contrast, explicitly restricts training to trajectories that satisfy the cost constraint, and consequently achieves normalized costs below 1 on most tasks. However, this safety is obtained at the expense of substantially reduced returns, particularly on more challenging velocity-control and circle tasks where high-return behavior is relatively scarce in the dataset. Notably, RCDT consistently attains higher returns than BC-Safe across all tasks, while maintaining competitive costs in most cases, leading to a markedly better return–cost trade-off. This comparison highlights an inherent limitation of purely supervized imitation-style methods under imbalanced data: imitating only a small “safe” subset may enforce constraint satisfaction, but the resulting loss of coverage over high-return regions severely limits achievable performance and generalization.
Value-based offline RL baselines with constraint handling (BCQ-Lag, BEAR-Lag, COptiDICE, and CPQ) often struggle to deliver a reliable return–cost trade-off across domains. On SafetyGym and BulletSafetyGym, these methods frequently incur normalized costs well above the safety constraint on a nontrivial portion of tasks, even when their returns are relatively competitive. In contrast, on MetaDrive, several of them (BEAR-Lag and CPQ) exhibit overly conservative behavior with markedly reduced returns despite achieving low costs. Taken together, these results suggest that simply incorporating scalar penalties, Lagrangian relaxations, or distribution-matching objectives into otherwise unconstrained offline RL pipelines does not consistently provide strong returns: the resulting trade-off is highly sensitive to the environment and the underlying data distribution, and does not robustly balance safety satisfaction with task performance. By comparison, RCDT achieves substantially more consistent return–cost trade-offs across SafetyGym, BulletSafetyGym, and MetaDrive, attaining strong returns while keeping costs close to or below the safety constraint on the vast majority of tasks.
FISOR and TraC are strong offline safe baselines that explicitly target safety-critical offline learning and often achieve low costs in practice. This pattern is evident from Table 2. On BulletSafetyGym and MetaDrive, FISOR attains extremely low average costs (0.03 and 0.08) but yields notably lower average returns (0.39 and 0.36) than RCDT (0.63 and 0.69). On SafetyGym, FISOR is less reliable, with an average cost of 3.81 despite a moderate return of 0.42. TraC maintains relatively low costs across domains (average costs of 0.93/0.56/0.54 on SafetyGym/BulletSafetyGym/MetaDrive), yet its average returns (0.46/0.61/0.53) consistently trail those of RCDT (0.59/0.63/0.69). Overall, while these methods provide competitive safety-oriented baselines, RCDT achieves a more favorable return–cost trade-off across all three domains, delivering higher returns while keeping costs close to or below the safety constraint on the majority of tasks.
The comparison with CDT is particularly informative. Both CDT and RCDT are CTG-conditioned CSM methods, so their policies can be evaluated across multiple cost thresholds in a zero-shot manner. As shown in Table 2, CDT tends to yield costs that concentrate around the safety constraint, and it even slightly exceeds the threshold on SafetyGym on average (cost = 1.09 ). In contrast, RCDT achieves lower costs than CDT across all three domains (1.09→0.95 on SafetyGym, 0.77→0.68 on BulletSafetyGym, and 0.95→0.71 on MetaDrive), while also improving average returns (0.55→0.59, 0.61→0.63, and 0.40→0.69, respectively). This gap is consistent with the fact that CDT can be viewed as a degenerate variant of RCDT that relies on naive CTG-conditioned maximum-likelihood training alone. By augmenting CDT with (i) a Lagrangian-style cost penalty with an auto-adaptive coefficient, (ii) reward–cost-aware trajectory-level reweighting, and (iii) Q-value regularization, RCDT more effectively suppresses behaviors that lead to constraint violations while still encouraging high-return actions. As a result, RCDT achieves a more favorable return–cost trade-off than CDT, demonstrating that principled regularization and reweighting are essential for realizing the full potential of CSM backbones in CMDPs.
Overall, the experimental results show that RCDT achieves consistently strong return–cost trade-offs on the DSRL benchmark. Compared with representative baselines, RCDT more reliably attains high normalized returns while satisfying the cost constraint on the vast majority of tasks, indicating robust behavior across diverse environments and data regimes. Moreover, RCDT supports one-policy evaluation across multiple cost thresholds: a single trained policy can be deployed in a zero-shot manner by adjusting the target CTG, accommodating different safety requirements at inference time. Taken together, these comparisons demonstrate the effectiveness of RCDT across multiple methodological baselines and suggest that it is a competitive approach with strong potential to advance the state-of-the-art in offline safe RL.

5.2. Ablation Studies

5.2.1. Component-Level Ablation

To empirically investigate the contribution of each individual component in the proposed RCDT under safety-constrained settings, we compare RCDT with its ablation variants on representative SafetyGym tasks. The ablations target four key aspects: CSM-based architecture, trajectory-level weighting, Q-value guidance, and Lagrangian-style cumulative cost penalty, whose configurations are summarized in Table 3. In this table, “CSM-based architecture” indicates whether the policy is implemented as a Decision Transformer-style conditional sequence model, “Trajectory-level weighting” denotes the use of our data-weighting mechanism, “Q-value guidance” corresponds to value-based guidance, and “Cumulative-cost penalty” reflects the presence of the cost-penalization term in the objective. BC and BC-Safe serve as imitation-learning baselines without a CSM backbone; BC-Safe differs from BC only in that it applies trajectory-level weighting to favor safer trajectories. CDT is the vanilla CSM-based baseline without any of the newly introduced components. Building on CDT, TVCDT enables both trajectory-level weighting and Q-value guidance, TCCDT combines trajectory-level weighting with the cumulative-cost penalty, and VCCDT uses Q-value guidance together with the cumulative-cost penalty but no weighting. Finally, RCDT activates all four components and thus represents the full version of our proposed method.
Table 4 summarizes the component-level ablation results on three representative SafetyGym velocity-constrained tasks. We first observe that plain behavior cloning (BC) consistently yields unsafe policies, exhibiting large normalized costs across all tasks (e.g., costs well above 1), which confirms that these datasets are challenging and that naive imitation of the behavior data does not suffice for constraint satisfaction. Introducing safety-aware trajectory reweighting in BC-Safe substantially reduces costs compared with BC, but this improvement often comes with a notable return drop (e.g., on HopperVel), reflecting the typical conservatism induced by prioritizing low-cost behavior without an explicit mechanism to recover high-return actions.
A key takeaway is that a CSM backbone provides a stronger and more controllable foundation for offline safe RL. Although CDT is also trained via maximum-likelihood action modeling, it consistently achieves a better return–cost trade-off than BC-Safe, attaining both higher return and lower cost across all tasks. This suggests that the target-conditioned sequence-modeling form can better accommodate constraint variation at evaluation time, and that leveraging trajectory context together with RTG/CTG conditioning yields more effective trade-off control than non-CSM imitation baselines. Notably, all RCDT variants built on top of the CSM architecture inherit this advantage, further highlighting the importance of CSM as the policy backbone in safety-constrained offline learning.
The ablations also confirm that each proposed component contributes meaningfully and the full combination is necessary for the best trade-off. Compared with CDT, all partial variants (TVCDT, TCCDT, and VCCDT) that activate any two of the three mechanisms (weighting, Q-guidance, and cost penalty) improve (or keep) return while remaining within a comparable safety range, indicating that each ingredient provides non-trivial gains over naive CTG-conditioned training. However, these gains are consistently smaller than those of the full method: RCDT achieves the best overall return–cost trade-off on all tasks, and removing any single component leads to performance degradation, demonstrating that the components are complementary rather than redundant.
A more fine-grained comparison further clarifies the role of each ingredient. First, TVCDT  consistently increases return over CDT, but it also increases cost across all tasks, which matches our design intuition: trajectory-level weighting and Q-value guidance primarily mitigate overly conservative behavior and steer learning toward higher-return regions, typically at the expense of additional cost. Crucially, RCDT introduces the Lagrangian-style cumulative-cost penalty on top of these return-seeking signals, and achieves lower cost than TVCDT without sacrificing its return gains, indicating that the penalty term provides an effective counterbalance that stabilizes constraint satisfaction while remaining compatible with the other mechanisms. Second, TCCDT  and VCCDT  both combine one return-improving signal with the cost penalty; the resulting policies generally outperform CDT in return but still exhibit higher costs than the full method, suggesting that using only a single return-seeking mechanism is insufficient to fully resolve the conservatism–violation tension, and that the best trade-off emerges only when both weighting and Q-guidance are jointly leveraged under the cost-penalized objective.
Overall, the ablation study provides clear evidence for the intended functional roles of the components: the Lagrangian-style penalty is essential for reducing cost and stabilizing constraint satisfaction, whereas trajectory-level weighting and Q-value guidance are key to improving return by avoiding overly conservative solutions. Importantly, RCDT achieves the most favorable return–cost trade-off only when all components are enabled, validating the necessity and complementarity of the proposed design choices.

5.2.2. Robustness Evaluation on DSRL Dataset Variants

To further examine the robustness of RCDT under more demanding data regimes by evaluating it on a set of dataset variants derived from the original DSRL benchmark. All variants are constructed by retaining a subset of trajectories from each original dataset to induce (i) a lower proportion of expert-level trajectories and (ii) more imbalanced return distributions. The corresponding results are reported in Table 5 and Table 6, respectively. For each environment, we order the retention ratios from larger to smaller values, so that the reported settings become progressively more challenging as the available data decreases (or becomes more skewed).
Performance under lower expert-data coverage. Table 5 reports results on degraded datasets constructed by retaining only the bottom- ρ % low-return trajectories (ranked by return), which directly reduces expert-level coverage and makes it substantially harder to recover favorable return–cost trade-offs from offline data. Across the five velocity-constrained locomotion tasks (SwimmweVel, HopperVel, HalfCheetahVel, Walker2dVel, and AntVel), RCDT remains consistently competitive as ρ decreases from 100 % to 60 % . In most settings, RCDT achieves the highest reward while maintaining costs comparable to CDT, whereas BC often incurs noticeably larger cumulative costs. For example, on HopperVel and AntVel, RCDT preserves strong reward across all retention ratios and avoids the severe cost explosion observed for BC, indicating that the Lagrangian-style penalty provides an effective bias toward constraint satisfaction even when safe expert trajectories are removed. Moreover, RCDT often improves reward over CDT at similar cost levels (e.g., ρ = 100 % and 80 % on multiple tasks), suggesting that the proposed trajectory-level reweighting and Q-value regularization can still exploit informative sub-optimal data to enhance performance under reduced expert coverage.
Performance under imbalanced data distributions. Table 6 evaluates a complementary stress test where the dataset is made increasingly imbalanced by retaining only the top- ρ % and bottom- ρ % trajectories. This construction amplifies distribution skew and can exacerbate the tendency of likelihood-trained policies to overfit dominant modes, making robust trade-off control more challenging as ρ decreases. Overall, RCDT exhibits strong robustness across tasks when ρ is reduced from 30 % to 10 % : it consistently achieves the highest reward, and it remains competitive in cumulative cost relative to CDT, while BC typically suffers substantial reward degradation and often very large costs. Notably, on HalfCheetahVel and SwimmweVel, RCDT maintains near-saturated normalized returns even at ρ = 10 % , demonstrating that its training recipe can still leverage the retained high-quality trajectories without being derailed by the low-return tail. At the same time, costs can increase under the most extreme imbalance on some tasks (e.g., SwimmweVel and HopperVel at small ρ ), reflecting the intrinsic difficulty of satisfying constraints when the dataset provides limited coverage of safe behaviors under heavily skewed mixtures; nevertheless, RCDT typically delivers a better overall return–cost trade-off than both CDT and BC. These results suggest that RCDT is less sensitive to return-distribution skew and can better tolerate highly imbalanced offline datasets, which aligns with our goal of robust zero-shot safe control under limited and biased coverage.

5.2.3. Sensitivity Analysis of the Training-Time Cost Reference κ

We further investigate the sensitivity of RCDT to the training hyperparameter κ in Equation (33), which serves as a reference cost level for adapting the penalty coefficient λ . Here, κ is not a hard deployment-time constraint; rather, it only modulates the strength of the cumulative-cost penalty during training through the update of λ . Table 7 reports the results of training RCDT with different κ values and evaluating the resulting policies under the standard constraint-variation protocol.
As κ increases, the learned policy generally becomes less conservative, which often improves return but also tends to increase cumulative cost. This effect is particularly visible on the MetaDrive tasks (MediumSparse and HardMean), where the normalized cost rises noticeably once κ exceeds 10, eventually leading to cost values above the safety threshold. This behavior is consistent with the evaluation protocol, where each method is tested under multiple target cumulative-cost thresholds (SafetyGym: { 20 , 40 , 80 } ; BulletSafetyGym: { 10 , 20 , 40 } ; and MetaDrive: { 10 , 20 , 40 } ): when the training reference level exceeds the most stringent evaluation budget, the learned policy is more likely to incur a higher risk of constraint violation under the strictest test conditions. At the same time, this trend is not absolute. For example, on the BulletSafetyGym tasks (AntRun and CarCircle), increasing κ does not lead to severe violations, which further suggests that the target CTG specified at inference still plays an important role in maintaining alignment with the desired cost level and enables effective zero-shot adaptation across different evaluation budgets.
A complementary trend is observed on the return side. When κ is set too small, the policy is encouraged to be overly conservative, which suppresses return; when κ is increased to a moderate range, return improves consistently. However, excessively large κ may yield only marginal additional (or even negative) return gains while substantially increasing the risk of violating the evaluation-time safety requirements. Overall, these results support our interpretation that κ mainly controls the return–cost trade-off indirectly through the training-time regularization strength, rather than imposing a strict cost constraint by itself. From a practical standpoint, a reasonable choice is to set κ slightly below, but not overly below, the smallest evaluation-time cost budget, which provides a balanced trade-off between avoiding overly conservative behavior and maintaining robustness under strict safety thresholds.

6. Conclusions

This work studies offline safe reinforcement learning through the lens of conditional sequence modeling (CSM) and its zero-shot controllability. We analyze the discrepancy between the specified RTG/CTG signals and the resulting expected return and cumulative cost induced by a conditioned CSM policy, and show that this mismatch admits an upper bound scaling as O ε 1 α F + 2 H 2 , where α F characterizes the joint return–cost coverage of the target profile in the offline dataset. This characterization clarifies when RTG/CTG conditioning can serve as a reliable mechanism for safe decision making and highlights the fundamental role of data coverage in achieving stable return–cost trade-offs. Guided by these insights, we propose RCDT, a CSM-based offline safe RL algorithm that integrates a Lagrangian-style cumulative-cost penalty with an auto-adaptive dual-ascent update of the penalty coefficient, together with a reward–cost-aware trajectory-level reweighting mechanism and Q-value regularization. These components decouple policy learning from any single pre-specified cost threshold while mitigating overly conservative behavior, enabling a single trained policy to support zero-shot deployment across varying cost constraints. Extensive experiments on the DSRL benchmark under multiple evaluation thresholds demonstrate that RCDT consistently improves return–cost trade-offs over representative baselines, and suggest that coverage-aware training objectives are a promising direction for advancing CSM-based safe reinforcement learning.   

Author Contributions

Methodology, W.B., C.Z. (Chao Zhang) and H.Q.; project administration, H.Q.; software, W.B. and Q.X.; supervision, C.Z. (Chao Zhang) and H.Q.; validation, Q.X. and C.C.; visualization, W.B., C.C. and C.Z. (Chenhao Zhou); writing—original draft, W.B.; writing—review and editing, W.B., C.Z. (Chao Zhang) and H.Q. All authors have read and agreed to the published version of the manuscript.

Funding

This work was supported in part by the National Natural Science Foundation of China: 62206248.

Data Availability Statement

The implementation of RCDT is available at https://github.com/ZJUBai/RCDT (accessed on 12 March 2026). The datasets and benchmark environments used in this study are provided by the open-source OSRL codebase at https://github.com/liuzuxin/OSRL (accessed on 12 March 2026).

Conflicts of Interest

The authors declare no conflicts of interest.

Appendix A. Proofs of Theoretical Results

Appendix A.1. Proof of Theorem 1

Proof. 
We first prove the bound
E s 1 ∼ μ F R ( s 1 ) − J R π F CDT ≤ C ε 1 α F + 2 H 2 ,
for some universal constant C > 0 . Throughout the proof we assume, without loss of generality, that the instantaneous reward is uniformly bounded as | r ( s , a ) | ≤ 1 for all ( s , a ) .
Under Assumption 1, there exist deterministic functions
T : S × A → S , r : S × A → [ 0 , 1 ] , c : S × A → [ 0 , 1 ] ,
such that the true transition triplet ( r t , c t , s t + 1 ) deviates from ( r ( s t , a t ) , c ( s t , a t ) , T ( s t , a t ) ) with probability at most ε at each time step. Fix an initial state s 1 ∈ S and an open-loop action sequence a 1 : H = ( a 1 , … , a H ) . We define the deterministic state, reward, and cost sequences by s ¯ 1 : = s 1 ,   s ¯ t + 1 : = T ( s ¯ t , a t ) ,   r t det : = r ( s ¯ t , a t ) ,   c t det : = c ( s ¯ t , a t ) ,   t = 1 , … , H . The corresponding deterministic cumulative reward is G det ( s 1 , a 1 : H ) : = ∑ t = 1 H r t det .
In the true (stochastic) CMDP, when we follow a policy π starting from s 1 , the trajectory τ and its return R ( τ ) = ∑ t = 1 H r t are random. For the CDT policy π F CDT , we write J R π F CDT = E s 1 ∼ μ E τ ∼ π F CDT R ( τ ) ∣ s 1 .
In the infinite-data and realizable limit, for any s ∈ S and a ∈ A , the CDT policy satisfies
π F CDT ( a ∣ s ) = P π β a ∣ s , F ( s ) = π β ( a ∣ s ) P π β F ( s ) ∣ s , a P π β F ( s ) ∣ s .
Then the reward gap can be written as
(A3) E s 1 ∼ μ F R ( s 1 ) − J R π F CDT = E s 1 ∼ μ F R ( s 1 ) − E τ ∼ π F CDT R ( τ ) ∣ s 1 (A4) = E s 1 ∼ μ E a 1 : H ∼ π F CDT | s 1 F R ( s 1 ) − E R ( τ ) ∣ s 1 , a 1 : H = E s 1 ∼ μ E a 1 : H ∼ π F CDT | s 1 F R ( s 1 ) − G det ( s 1 , a 1 : H ) + E s 1 ∼ μ E a 1 : H ∼ π F CDT | s 1 G det ( s 1 , a 1 : H ) − E R ( τ ) ∣ s 1 , a 1 : H (A5) = : ( A ) + ( B ) .
We will bound the terms ( A ) and ( B ) separately. We first show that term ( B ) is bounded by O ( ε H 2 ) . Fix ( s 1 , a 1 : H ) and consider the stochastic trajectory ( s t , r t ) t = 1 H generated under the true dynamics when starting from s 1 and applying the action sequence a 1 : H . At each time step t, define the event E t : = r t ≠ r ( s ¯ t , a t ) or s t + 1 ≠ T ( s ¯ t , a t ) . By Assumption 1, for any ( s t , a t ) we have P ( E t | s t = s ¯ t , a t ) ≤ ε . Let E : = ⋃ t = 1 H E t be the event that at least one deviation occurs along the trajectory. By a union bound, P ( E ∣ s 1 , a 1 : H ) ≤ ε H . On the complement E c , the stochastic trajectory coincides with the deterministic one, so r t = r t det for all t and hence G 1 = ∑ t = 1 H r t = ∑ t = 1 H r t det = G det ( s 1 , a 1 : H ) . Therefore, G det ( s 1 , a 1 : H ) − G 1 = 0 on E c . On E, we have | G det ( s 1 , a 1 : H ) − G 1 | ≤ H because | r t | ≤ 1 and both G det and G 1 are sums of H terms. Combining these two observations, we obtain
E [ G det ( s 1 , a 1 : H ) − G 1 ∣ s 1 , a 1 : H ] ≤ H · P ( E ∣ s 1 , a 1 : H ) ≤ ε H 2 .
Taking expectations over a 1 : H ∼ π F CDT | s 1 and s 1 ∼ μ , we conclude that
( B ) = E s 1 E a 1 : H ∼ π F CDT | s 1 G det ( s 1 , a 1 : H ) − G 1 ≤ ε H 2 .
To bound term (A), where ( A ) = E s 1 ∼ μ E a 1 : H ∼ π F CDT ( · ∣ s 1 ) F R ( s 1 ) − G det ( s 1 , a 1 : H ) . We analyze the behavior of π F CDT at the level of action sequences. For notational convenience, let s ¯ t = T ( s 1 , a 1 : t − 1 ) be the deterministic state reached at step t under ( T , r , c ) when starting from s 1 and applying a 1 : t − 1 . For a fixed initial state s 1 , write P π F CDT ( a 1 : H ∣ s 1 ) as the conditional path probability under π F CDT . By conditioning on the next state, we can expand
P π F CDT ( a 1 : H ∣ s 1 ) = π F CDT ( a 1 ∣ s 1 ) ∫ S P ( s 2 ∣ s 1 , a 1 ) P π F CDT ( a 2 : H ∣ s 1 , s 2 ) d s 2 .
By near determinism (Assumption 1), with probability at least 1 − ε we have s 2 = s ¯ 2 : = T ( s 1 , a 1 ) , and otherwise the state can deviate. Thus
P π F CDT ( a 1 : H ∣ s 1 ) ≤ π F CDT ( a 1 ∣ s 1 ) P π F CDT ( a 2 : H ∣ s 1 , s ¯ 2 ) + ε .
Under the joint return–cost coverage condition (Assumption 1, item 1), we have P π β ( F ( s 1 ) ∣ s 1 ) ≥ α F . Moreover, by near determinism and the consistency of F (Assumption 1, items 2 and 3), the event ( R ( τ ) , C ( τ ) ) = F ( s 1 ) starting from ( s 1 , a 1 ) is equivalent, up to an O ( ε ) slack, to the event ( R ( τ 2 : H ) , C ( τ 2 : H ) ) = F ( s ¯ 2 ) starting from ( s ¯ 2 , a 2 ) , where τ 2 : H denotes the tail subtrajectory. This yields the bound
P π β F ( s 1 ) ∣ s 1 , a 1 ≤ ε + P π β F ( s ¯ 2 ) ∣ s ¯ 2 ,
To justify inequality (A9), fix ( s 1 , a 1 ) and consider the stochastic trajectory τ induced by β and the true CMDP dynamics. Let τ 2 : H denote the tail subtrajectory from time step 2 to H, and let s ¯ 2 : = T ( s 1 , a 1 ) be the deterministic successor under ( T , r , c ) . Define the “good” event
E 1 : = r 1 = r ( s 1 , a 1 ) , c 1 = c ( s 1 , a 1 ) , s 2 = s ¯ 2 .
By near determinism (Assumption 1), we have P π β ( E 1 c ∣ s 1 , a 1 ) ≤ ε . We decompose
P π β F ( s 1 ) ∣ s 1 , a 1 = P π β F ( s 1 ) ∩ E 1 ∣ s 1 , a 1 + P π β F ( s 1 ) ∩ E 1 c ∣ s 1 , a 1 ≤ P π β F ( s 1 ) ∩ E 1 ∣ s 1 , a 1 + P π β E 1 c ∣ s 1 , a 1 ≤ P π β F ( s 1 ) ∩ E 1 ∣ s 1 , a 1 + ε .
On E 1 we have r 1 = r ( s 1 , a 1 ) , c 1 = c ( s 1 , a 1 ) , and s 2 = s ¯ 2 , and the consistency of F implies
F R ( s 1 ) = r ( s 1 , a 1 ) + F R ( s ¯ 2 ) , F C ( s 1 ) = c ( s 1 , a 1 ) + F C ( s ¯ 2 ) .
Since R ( τ ) = r 1 + R ( τ 2 : H ) and C ( τ ) = c 1 + C ( τ 2 : H ) , the event { ( R ( τ ) , C ( τ ) ) = F ( s 1 ) } on E 1 is equivalent to { ( R ( τ 2 : H ) , C ( τ 2 : H ) ) = F ( s ¯ 2 ) } with s 2 = s ¯ 2 . Therefore
P π β F ( s 1 ) ∩ E 1 ∣ s 1 , a 1 = P π β F ( s ¯ 2 ) ∣ s 2 = s ¯ 2 = P π β F ( s ¯ 2 ) ∣ s ¯ 2 ,
and we can conclude the inequality in (A9).
Hence
π F CDT ( a 1 ∣ s 1 ) = π β ( a 1 ∣ s 1 ) P π β ( F ( s 1 ) ∣ s 1 , a 1 ) P π β ( F ( s 1 ) ∣ s 1 ) ≤ π β ( a 1 ∣ s 1 ) P π β ( F ( s ¯ 2 ) ∣ s ¯ 2 ) P π β ( F ( s 1 ) ∣ s 1 ) + ε α F ,
where we used P π β ( F ( s 1 ) ∣ s 1 ) ≥ α F to bound the contribution of the ε term. Substituting (A10) into (A8), we obtain
P π F CDT ( a 1 : H ∣ s 1 ) ≤ π β ( a 1 ∣ s 1 ) P π β ( F ( s ¯ 2 ) ∣ s ¯ 2 ) P π β ( F ( s 1 ) ∣ s 1 ) P π F CDT ( a 2 : H ∣ s 1 , s ¯ 2 ) + ε 1 α F + 1 .
Repeating the same argument recursively for t = 2 , … , H —each time replacing the random next state by the deterministic s ¯ t + 1 = T ( s ¯ t , a t ) up to an additive ε slack, and shifting the conditioning on the joint return-cost via the consistency of F—yields, after H steps,
P π F CDT ( a 1 : H ∣ s 1 ) ≤ ∏ t = 1 H π β ( a t ∣ s ¯ t ) I ( R ( τ det ) , C ( τ det ) ) = F ( s 1 ) P π β ( F ( s 1 ) ∣ s 1 ) + H ε 1 α F + 1 ,
where τ det is the deterministic trajectory induced by ( s 1 , a 1 : H ) under ( T , r , c ) , and I [ · ] is the indicator function. Plug (A12) into (A). For each fixed s 1 ,
E a 1 : H ∼ π F CDT ( · ∣ s 1 ) F R ( s 1 ) − G det ( s 1 , a 1 : H ) = ∫ F R ( s 1 ) − G det ( s 1 , a 1 : H ) P π F CDT ( a 1 : H ∣ s 1 ) d a 1 : H ≤ ∫ F R ( s 1 ) − G det ( s 1 , a 1 : H ) ∏ t = 1 H π β ( a t ∣ s ¯ t ) I ( R ( τ det ) , C ( τ det ) ) = F ( s 1 ) P π β ( F ( s 1 ) ∣ s 1 ) d a 1 : H + ∫ F R ( s 1 ) − G det ( s 1 , a 1 : H ) H ε 1 α F + 1 d a 1 : H .
By the consistency of F, whenever the deterministic trajectory satisfies ( R ( τ det ) , C ( τ det ) ) = F ( s 1 ) , we have F R ( s 1 ) = G det ( s 1 , a 1 : H ) , and hence the integrand in the first term of (A13) is zero. For the second term, using | F R ( s 1 ) − G det ( s 1 , a 1 : H ) | ≤ H , and the fact that the integral is taken w.r.t. a probability measure over a 1 : H , we obtain
∫ F R ( s 1 ) − G det ( s 1 , a 1 : H ) H ε 1 α F + 1 d a 1 : H ≤ H 2 ε 1 α F + 1 .
Substituting back into (A13), we conclude that ( A ) ≤ H 2 ε 1 α F + 1 . Combining the result with (A6), and absorbing constants into a universal constant C > 0 , yields
E s 1 ∼ μ F R ( s 1 ) − J R π F CDT ≤ C ε H 2 1 α F + 2 .
The proof of (8) proceeds analogously and thus completes the proof of Theorem 1.    □

Appendix A.2. Proof of Proposition 1

Proof. 
To prove Proposition 1, we show that the KL regularization term in (27) is proportional to the negative log-likelihood (NLL) loss, under the assumption that the policy π θ is a factorized Gaussian distribution with a fixed isotropic covariance. The equivalence then implies that KL regularization explicitly reweights the NLL loss, thereby implementing an explicit resampling mechanism.
Recall the KL divergence between two multivariate Gaussians N ( μ 1 , Σ 1 ) and N ( μ 2 , Σ 2 ) is given by
D KL N ( μ 1 , Σ 1 ) ∥ N ( μ 2 , Σ 2 ) = 1 2 tr ( Σ 2 − 1 Σ 1 ) + ( μ 2 − μ 1 ) ⊤ Σ 2 − 1 ( μ 2 − μ 1 ) − d + log | Σ 2 | | Σ 1 | ,
where d is the dimensionality of the action space.
In our setting, the policy is parameterized as π θ ( a | s ) = N ( μ θ ( s ) , ξ I ) and the target is a Dirac approximation centered at the action a, i.e., N ( a , ξ I ) . Substituting into (A14), we obtain
D KL N ( μ θ ( s ) , ξ I ) ∥ N ( a , ξ I ) = 1 2 tr ( I ) + ( μ θ ( s ) − a ) ⊤ ( ξ I ) − 1 ( μ θ ( s ) − a ) − d + log 1 ,
where we use the fact that Σ 1 = Σ 2 = ξ I . Simplifying yields
D KL N ( μ θ ( s ) , ξ I ) ∥ N ( a , ξ I ) = 1 2 ξ ∥ μ θ ( s ) − a ∥ 2 .
Taking expectation over ( s , a ) ∼ D gives
E ( s , a ) ∼ D D KL N ( μ θ ( s ) , ξ I ) ∥ N ( a , ξ I ) = 1 2 ξ E ( s , a ) ∼ D ∥ μ θ ( s ) − a ∥ 2 ,
which shows that the KL divergence is proportional to the mean squared error (MSE) loss between μ θ ( s ) and the ground-truth action a.
The log-likelihood of the Gaussian policy π θ ( a | s ) = N ( a ; μ θ ( s ) , ξ I ) is
log π θ ( a | s ) = − d 2 log ( 2 π ξ ) − 1 2 ξ ∥ a − μ θ ( s ) ∥ 2 .
Taking the negative log-likelihood gives:
− log π θ ( a | s ) = 1 2 ξ ∥ μ θ ( s ) − a ∥ 2 + d 2 log ( 2 π ξ ) .
The constant term d 2 log ( 2 π ξ ) is independent of the policy parameters θ and does not affect optimization. Therefore, minimizing the KL divergence is equivalent (up to scaling and additive constants) to minimizing the NLL loss:
E ( s , a ) ∼ D D KL N ( μ θ ( s ) , ξ I ) ∥ N ( a , ξ I ) = E ( s , a ) ∼ D − log π θ ( a | s ) + constant .
Recall that the RDT objective in (27) augments the standard NLL loss with a KL regularization term over expert trajectories:
L RDT ( θ ) = E τ ∼ D ∑ i = 1 H − log π θ ( a i | s i , g ( τ i ) , τ ¯ t − 1 K ) + α E τ ∼ D e ∑ i = 1 H D KL π θ ( · | s i , g ( τ i ) , τ ¯ t − 1 K ) ∥ π e ( · | s i ) .
If π e is a delta function centered at a i (i.e., using the empirical action from the expert trajectory), and both policies are Gaussians with identical covariance ξ I , the KL term simplifies to an MSE loss, and hence to an NLL term by (A15). Thus, the second expectation term becomes equivalent to an additional NLL loss over D e with weighting factor α .
This yields the final objective:
L RDT ( θ ) = E τ ∼ D 1 + α · I [ τ ∈ D e ] · ∑ i = 1 H − log π θ ( a i | s i , g ( τ i ) , τ ¯ t − 1 K ) + constant .
Since the constant term does not affect the optimization process, the proof is thus completed.    □

Appendix B. Experimental Details

Appendix B.1. Benchmark Details

Our evaluation for RCDT is performed across three domains in the DSRL benchmark [19]: SafetyGym, BulletSafetyGym and MetaDrive. These domains are designed to evaluate offline safe RL algorithms in continuous-control navigation and locomotion settings, where agents must achieve task goals while satisfying state- and action-dependent safety constraints encoded as cumulative cost signals.
  • SafetyGym tasks in DSRL are adapted from the Safety-Gymnasium suite, which builds on the MuJoCo physics engine and provides safety-critical continuous-control environments with explicit cost signals. Each environment combines a mobile robot (typically Point or Car) with a navigation or manipulation task (Goal, Button, Push, or Circle) and a difficulty level that determines the density and layout of hazards. The agent observes its proprioceptive state together with lidar-like readings of nearby obstacles and goals, and receives dense rewards for task progress (e.g., reaching targets, pressing designated buttons, or pushing boxes) while accumulating instantaneous costs when entering hazardous regions or colliding with unsafe objects such as hazards, vases, pillars, or gremlins. Within DSRL, these Safety Gym tasks constitute safety-constrained navigation and locomotion benchmarks, where constraint tightness and the reward–cost trade-off can be systematically varied through different layouts and cost thresholds.
  • BulletSafetyGym is a suite of safety-constrained locomotion tasks implemented on top of the PyBullet physics engine, designed to evaluate constrained RL algorithms under fast, contact-rich dynamics. In the DSRL benchmark, we use eight tasks constructed by pairing four agent morphologies (Ball, Car, Drone, Ant) with two task families, Run and Circle. In the Run tasks, agents are trained to move quickly along a straight corridor and obtain reward for forward progress, while incurring cost whenever they cross lateral safety boundaries or exceed an agent-specific velocity limit. In the Circle tasks, agents are encouraged to follow a circular track at high speed within a restricted safe region; deviating from the track or leaving the safety zone results in constraint violations and additional cost. Compared to Safety Gym, Bullet Safety Gym offers shorter-horizon tasks with more diverse robot morphologies, yielding compact yet challenging benchmarks for studying the trade-off between reward maximization and strict safety requirements in offline safe RL.
  • MetaDrive in DSRL is an autonomous-driving domain built on top of the MetaDrive simulator, which provides interactive traffic scenarios with explicit safety costs. In this domain, the agent controls a vehicle to follow a route and make steady progress toward its destination while interacting with surrounding traffic of varying complexity. DSRL includes a collection of driving datasets with increasing scenario difficulty (e.g., Easy/Medium/Hard) and traffic density (e.g., Sparse/Mean/Dense), which systematically amplify the safety–performance tension as the environment becomes more congested and challenging. The reward encourages route progress and stable driving behavior (e.g., advancing along the lane and reaching the goal), while safety cost is incurred for critical violations such as collisions (with vehicles or objects) and driving out of the road. Compared to SafetyGym and BulletSafetyGym, MetaDrive captures more realistic, multi-agent safety constraints arising from traffic interactions, and thus serves as a complementary benchmark for evaluating offline safe RL algorithms under complex dynamics and stringent safety requirements.

Appendix B.2. Implementation Details

The policy network of RCDT is implemented as a Decision Transformer, built upon the open-source minGPT codebase and the open-source OSRL codebase (https://github.com/liuzuxin/OSRL (accessed on 12 March 2026)). Detailed model parameters are provided in Table A1.
Table A1. Hyperparameters of RCDT in our experiment.
Table A1. Hyperparameters of RCDT in our experiment.
ParameterValue
Number of layers3
Number of attention heads8
Embedding dimension128
Batch size2048
Context length K10
Learning rate0.0001
Dropout0.1
Adam betas(0.9, 0.999)
Grad norm clip0.25
λ max 10
The Q-networks and cost-networks are represented by 4-layer MLPs with Mish activations and 128 hidden units for each layer. Detailed model parameters are provided in Table A2.
Table A2. Hyperparameters of value and cost networks in our experiment.
Table A2. Hyperparameters of value and cost networks in our experiment.
ParameterValue
Number of layers4
Embedding dimension128
Batch size2048
Learning rate 5 × 10 − 5
Adam betas(0.9, 0.999)
Grad norm clip0.25
Soft target update rate 0.01
Dual-ascent learning rate 3 × 10 − 4
The Q-regularization coefficient is selected separately for each environment via Tree-structured Parzen Estimator (TPE) search over { 0.1 , 0.3 , 0.5 } . In addition, κ is treated as a tunable hyperparameter (rather than a hard constraint) and is set to 10 in all experiments. Training is performed for a total of 2 × 10 5 iterations; the Transformer policy is updated from the beginning, while the Q-network and critic network are initialized with the policy updates and only start training after the first 5 × 10 4 iterations, after which they are updated alongside the policy for the remaining iterations. All networks are trained using the Adam optimizer [54]. The experiments were conducted on two servers, each equipped with two AMD EPYC 7542 32-Core Processors and 8 NVIDIA GeForce RTX 4090 GPUs with 24 GB of memory. These computational settings ensure reproducibility and align with the reported performance metrics.

Appendix B.3. Discussion on the Role of the Adaptive Coefficient λ

The cost-penalty coefficient λ in Equation (33) is updated via a Lagrangian-inspired adaptive rule during training. In practice, we use the clipped update
λ ← clip λ + β J ^ c ( θ ) − κ , 0 , λ max ,
where β > 0 is the step size and λ max is set to 10 as a hyperparameter. This implementation is adopted for numerical stability and to prevent the cost regularization term from becoming excessively dominant during optimization.
We further clarify that the CMDP-style formulation in Equations (30) and (31) is introduced primarily as a motivating perspective for incorporating safety regularization into conditional sequence modeling, rather than as the constrained optimization problem that RCDT explicitly solves in practice. The key reason is that our goal is not to train a separate policy for a single fixed-cost threshold, but to preserve the zero-shot adaptation property of cost-conditioned sequence modeling across multiple evaluation budgets. Imposing a hard training-time constraint tied to one specific κ would be conceptually misaligned with this objective. Instead, we use the CMDP view to motivate a cost-aware training objective, in which the cumulative-cost term acts as a flexible regularizer and its influence is modulated by an automatically adapted coefficient λ .
Under this interpretation, the update in Equation (33) should be understood as a practical mechanism for adjusting the strength of cost penalization during training, rather than as a strict dual optimization procedure whose theoretical role is to solve a fixed constrained problem exactly. This design is reasonable for two related reasons. First, it preserves the deployment-time flexibility of CDT-style policies, since the final return–cost trade-off is still primarily steered by the cost-to-go (CTG) conditioning at inference. Second, it provides a simple and effective way to stabilize safety-aware training: when the estimated cumulative cost becomes large, λ increases and strengthens regularization; when the cost is relatively small, the penalty is relaxed to avoid overly conservative behavior. In this sense, the practical value of λ lies mainly in adaptively controlling the regularization strength during learning. This also motivates the empirical study below, where we examine how the training-time reference parameter κ , which directly modulates the update of λ , influences the performance of RCDT.

References

  1. Koirala, P.; Jiang, Z.; Sarkar, S.; Fleming, C. Latent Safety-Constrained Policy Approach for Safe Offline Reinforcement Learning. In Proceedings of the Thirteenth International Conference on Learning Representations, Vienna, Austria, 7–11 May 2024. [Google Scholar]
  2. Gong, Z.; Kumar, A.; Varakantham, P. Offline safe reinforcement learning using trajectory classification. In Proceedings of the AAAI Conference on Artificial Intelligence, Philadelphia, PA, USA, 25 February–4 March 2025; Volume 39, pp. 16880–16887. [Google Scholar]
  3. Su, H.; Peng, D.; Zhuang, Z.; Liu, Y.; Chen, Q.; Wang, D.; Liu, Q. Boundary-to-Region Supervision for Offline Safe Reinforcement Learning. In Proceedings of the Thirty-Ninth Annual Conference on Neural Information Processing Systems, San Diego, CA, USA, 2–7 December 2025. [Google Scholar]
  4. Guo, Z.; Zhou, W.; Wang, S.; Li, W. Constraint-conditioned actor-critic for offline safe reinforcement learning. In Proceedings of the Thirteenth International Conference on Learning Representations, Singapore, 24–28 April 2025. [Google Scholar]
  5. Zhang, C.; Xiao, W.; He, T.; Shi, G. WoCoCo: Learning Whole-Body Humanoid Control with Sequential Contacts. In Proceedings of the Conference on Robot Learning, Seoul, Republic of Korea, 27–30 September 2025; pp. 455–472. [Google Scholar]
  6. Ji, M.; Peng, X.; Liu, F.; Li, J.; Yang, G.; Cheng, X.; Wang, X. ExBody2: Advanced Expressive Humanoid Whole-Body Control. In Proceedings of the RSS 2025 Workshop on Whole-Body Control and Bimanual Manipulation: Applications in Humanoids and Beyond, Los Angeles, CA, USA, 25 June 2025. [Google Scholar]
  7. Liu, Z.; Guo, Z.; Yao, Y.; Cen, Z.; Yu, W.; Zhang, T.; Zhao, D. Constrained decision transformer for offline safe reinforcement learning. In Proceedings of the International Conference on Machine Learning, Honolulu, HI, USA, 23–29 July 2023; pp. 21611–21630. [Google Scholar]
  8. Kirk, R.; Zhang, A.; Grefenstette, E.; Rocktäschel, T. A survey of zero-shot generalisation in deep reinforcement learning. J. Artif. Intell. Res. 2023, 76, 201–264. [Google Scholar] [CrossRef] [Scilit]
  9. Lee, J.; Paduraru, C.; Mankowitz, D.J.; Heess, N.; Precup, D.; Kim, K.E.; Guez, A. COptiDICE: Offline Constrained Reinforcement Learning via Stationary Distribution Correction Estimation. In Proceedings of the International Conference on Learning Representations, Virtual, 25–29 April 2022. [Google Scholar]
  10. Xu, H.; Zhan, X.; Zhu, X. Constraints penalized q-learning for safe offline reinforcement learning. In Proceedings of the AAAI Conference on Artificial Intelligence, Virtual, 22 February–1 March 2022; Volume 36, pp. 8753–8760. [Google Scholar]
  11. Zheng, Y.; Li, J.; Yu, D.; Yang, Y.; Li, S.E.; Zhan, X.; Liu, J. Safe Offline Reinforcement Learning with Feasibility-Guided Diffusion Model. In Proceedings of the Twelfth International Conference on Learning Representations, Vienna Austria, 7–11 May 2024. [Google Scholar]
  12. Wu, Y.H.; Wang, X.; Hamaya, M. Elastic decision transformer. Adv. Neural Inf. Process. Syst. 2024, 36, 18532–18550. [Google Scholar]
  13. Hu, S.; Fan, Z.; Huang, C.; Shen, L.; Zhang, Y.; Wang, Y.; Tao, D. Q-value Regularized Transformer for Offline Reinforcement Learning. In Proceedings of the International Conference on Machine Learning, Vienna, Austria, 21–27 July 2024; pp. 19165–19181. [Google Scholar]
  14. Zheng, H.; Shen, L.; Luo, Y.; Liu, T.; Shen, J.; Tao, D. Decomposed prompt decision transformer for efficient unseen task generalization. Adv. Neural Inf. Process. Syst. 2024, 37, 122984–123006. [Google Scholar]
  15. Zheng, H.; Shen, L.; Luo, Y.; Ye, D.; Du, B.; Shen, J.; Tao, D. Decision Mixer: Integrating Long-term and Local Dependencies via Dynamic Token Selection for Decision-Making. In Proceedings of the Forty-Second International Conference on Machine Learning, Vancouver, BC, Canada, 13–19 July 2025. [Google Scholar]
  16. Hu, S.; Fan, Z.; Shen, L.; Zhang, Y.; Wang, Y.; Tao, D. HarmoDT: Harmony Multi-Task Decision Transformer for Offline Reinforcement Learning. In Proceedings of the International Conference on Machine Learning, Vienna, Austria, 21–27 July 2024; pp. 19182–19197. [Google Scholar]
  17. Chen, L.; Lu, K.; Rajeswaran, A.; Lee, K.; Grover, A.; Laskin, M.; Abbeel, P.; Srinivas, A.; Mordatch, I. Decision transformer: Reinforcement learning via sequence modeling. Adv. Neural Inf. Process. Syst. 2021, 34, 15084–15097. [Google Scholar]
  18. Brandfonbrener, D.; Bietti, A.; Buckman, J.; Laroche, R.; Bruna, J. When does return-conditioned supervised learning work for offline reinforcement learning? Adv. Neural Inf. Process. Syst. 2022, 35, 1542–1553. [Google Scholar]
  19. Liu, Z.; Guo, Z.; Lin, H.; Yao, Y.; Zhu, J.; Cen, Z.; Hu, H.; Yu, W.; Zhang, T.; Tan, J.; et al. Datasets and benchmarks for offline safe reinforcement learning. arXiv 2023, arXiv:2306.09303. [Google Scholar] [CrossRef] [Scilit]
  20. Kumar, A.; Zhou, A.; Tucker, G.; Levine, S. Conservative q-learning for offline reinforcement learning. Adv. Neural Inf. Process. Syst. 2020, 33, 1179–1191. [Google Scholar]
  21. Fujimoto, S.; Gu, S.S. A minimalist approach to offline reinforcement learning. Adv. Neural Inf. Process. Syst. 2021, 34, 20132–20145. [Google Scholar]
  22. Hu, S.; Shen, L.; Zhang, Y.; Tao, D. Graph decision transformer for offline reinforcement learning. Sci.-China-Inf. Sci. 2025, 68, 169101. [Google Scholar] [CrossRef] [Scilit]
  23. Fujimoto, S.; Meger, D.; Precup, D. Off-policy deep reinforcement learning without exploration. In Proceedings of the International Conference on Machine Learning, Long Beach, CA, USA, 9–15 June 2019; pp. 2052–2062. [Google Scholar]
  24. Kumar, A.; Fu, J.; Soh, M.; Tucker, G.; Levine, S. Stabilizing off-policy q-learning via bootstrapping error reduction. In Proceedings of the Advances in Neural Information Processing Systems 32, Vancouver, BC, Canada, 8–14 December 2019. [Google Scholar]
  25. Yao, Y.; Cen, Z.; Ding, W.; Lin, H.; Liu, S.; Zhang, T.; Yu, W.; Zhao, D. Oasis: Conditional distribution shaping for offline safe reinforcement learning. Adv. Neural Inf. Process. Syst. 2024, 37, 78451–78478. [Google Scholar]
  26. Bai, W.; Chen, C.; Fu, Y.; Xu, Q.; Zhang, C.; Qian, H. Rebalancing Return Coverage for Conditional Sequence Modeling in Offline Reinforcement Learning. In Proceedings of the Thirty-ninth Annual Conference on Neural Information Processing Systems, San Diego, CA, USA, 2–7 December 2025. [Google Scholar]
  27. Zeng, Z.; Zhang, C.; Wang, S.; Sun, C. Goal-conditioned predictive coding for offline reinforcement learning. Adv. Neural Inf. Process. Syst. 2023, 36, 25528–25548. [Google Scholar]
  28. Kim, S.; Choi, Y.; Matsunaga, D.E.; Kim, K.E. Stitching sub-trajectories with conditional diffusion model for goal-conditioned offline RL. In Proceedings of the AAAI Conference on Artificial Intelligence, Vancouver, BC, Canada, 20–27 February 2024; Volume 38, pp. 13160–13167. [Google Scholar]
  29. Sutton, R.S.; Barto, A.G. Reinforcement Learning: An Introduction; MIT Press Cambridge: Cambridge, UK, 1998; Volume 1. [Google Scholar]
  30. Zhou, Z.; Zhu, C.; Zhou, R.; Cui, Q.; Gupta, A.; Du, S.S. Free from Bellman Completeness: Trajectory Stitching via Model-based Return-conditioned Supervised Learning. In Proceedings of the NeurIPS 2023 Foundation Models for Decision Making Workshop, New Orleans, LA, USA, 15 December 2023. [Google Scholar]
  31. Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, Ł.; Polosukhin, I. Attention is all you need. In Proceedings of the Advances in Neural Information Processing Systems 30, Long Beach, CA, USA, 4–9 December 2017. [Google Scholar]
  32. Yamagata, T.; Khalil, A.; Santos-Rodriguez, R. Q-learning decision transformer: Leveraging dynamic programming for conditional sequence modeling in offline RL. In Proceedings of the International Conference on Machine Learning, Honolulu, HI, USA, 23–29 July 2023; pp. 38989–39007. [Google Scholar]
  33. Gao, C.X.; Wu, C.; Cao, M.; Kong, R.; Zhang, Z.; Yu, Y. Act: Empowering decision transformer with dynamic programming via advantage conditioning. In Proceedings of the AAAI Conference on Artificial Intelligence, Vancouver, BC, Canada, 20–27 February 2024; Volume 38, pp. 12127–12135. [Google Scholar]
  34. Wei, J.; Xu, X.; Lan, Y.; Liu, T.; Wang, Y. Advantage-Guided Transformer for Conditional Sequence Modeling in Offline Reinforcement Learning. TechRxiv, 2025, Preprint. Available online: https://www.techrxiv.org/users/901853/articles/1276968-advantage-guided-transformer-for-conditional-sequence-modeling-in-offline-reinforcement-learning?commit=98e219b705eea7907f2b0dfc50cc154bbac589d4 (accessed on 12 March 2026).
  35. Tu, S.; Sun, J.; Zhang, Q.; Zhang, Y.; Liu, J.; Chen, K.; Zhao, D. In-dataset trajectory return regularization for offline preference-based reinforcement learning. In Proceedings of the AAAI Conference on Artificial Intelligence, Philadelphia, PA, USA, 25 February–4 March 2025; Volume 39, pp. 20929–20937. [Google Scholar]
  36. Wang, Y.; Yang, C.; Wen, Y.; Liu, Y.; Qiao, Y. Critic-guided decision transformer for offline reinforcement learning. In Proceedings of the AAAI Conference on Artificial Intelligence, Vancouver, BC, Canada, 20–27 February 2024; Volume 38, pp. 15706–15714. [Google Scholar]
  37. Janner, M.; Li, Q.; Levine, S. Offline reinforcement learning as one big sequence modeling problem. Adv. Neural Inf. Process. Syst. 2021, 34, 1273–1286. [Google Scholar]
  38. Wang, K.; Zhao, H.; Luo, X.; Ren, K.; Zhang, W.; Li, D. Bootstrapped transformer for offline reinforcement learning. Adv. Neural Inf. Process. Syst. 2022, 35, 34748–34761. [Google Scholar]
  39. Wang, Y.; Xu, M.; Shi, L.; Chi, Y. A trajectory is worth three sentences: multimodal transformer for offline reinforcement learning. In Proceedings of the Uncertainty in Artificial Intelligence, Pittsburgh, PA, USA, 31 July–4 August 2023; pp. 2226–2236. [Google Scholar]
  40. Wang, R.; Zhou, D. Safe decision transformer with learning-based constraints. In Proceedings of the Neurips Safe Generative AI Workshop 2024, Vancouver, BC, Canada, 14–15 December 2024. [Google Scholar]
  41. Guo, Z.; Zhou, W.; Li, W. Temporal Logic Specification-Conditioned Decision Transformer for Offline Safe Reinforcement Learning. In Proceedings of the International Conference on Machine Learning, Vienna, Austria, 21–27 July 2024; pp. 17003–17019. [Google Scholar]
  42. Altman, E. Constrained Markov Decision Processes; Routledge: Abingdon-on-Thames, UK, 2021. [Google Scholar]
  43. Brown, T.; Mann, B.; Ryder, N.; Subbiah, M.; Kaplan, J.D.; Dhariwal, P.; Neelakantan, A.; Shyam, P.; Sastry, G.; Askell, A.; et al. Language models are few-shot learners. Adv. Neural Inf. Process. Syst. 2020, 33, 1877–1901. [Google Scholar]
  44. Hu, S.; Shen, L.; Zhang, Y.; Tao, D. Learning Multi-Agent Communication from Graph Modeling Perspective. In Proceedings of the Twelfth International Conference on Learning Representations, Vienna, Austria, 7–11 May 2024. [Google Scholar]
  45. Hu, S.; Shen, L.; Zhang, Y.; Tao, D. Prompt-tuning decision transformer with preference ranking. arXiv 2023, arXiv:2305.09648. [Google Scholar] [CrossRef] [Scilit]
  46. Kong, Y.; Ma, G.; Zhao, Q.; Wang, H.; Shen, L.; Wang, X.; Tao, D. Mastering Massive Multi-Task Reinforcement Learning via Mixture-of-Expert Decision Transformer. In Proceedings of the Forty-Second International Conference on Machine Learning, Vancouver, BC, Canada, 13–19 July 2025. [Google Scholar]
  47. Lillicrap, T. Continuous control with deep reinforcement learning. arXiv 2015, arXiv:1509.02971. [Google Scholar]
  48. Fujimoto, S.; Hoof, H.; Meger, D. Addressing function approximation error in actor-critic methods. In Proceedings of the International Conference on Machine Learning, Stockholm, Sweden, 10–15 July 2018; pp. 1587–1596. [Google Scholar]
  49. Lin, Q.; Tang, B.; Wu, Z.; Yu, C.; Mao, S.; Xie, Q.; Wang, X.; Wang, D. Safe offline reinforcement learning with real-time budget constraints. In Proceedings of the 40th International Conference on Machine Learning, Honolulu, HI, USA, 23–29 July 2023; pp. 21127–21152. [Google Scholar]
  50. Ji, J.; Zhang, B.; Zhou, J.; Pan, X.; Huang, W.; Sun, R.; Geng, Y.; Zhong, Y.; Dai, J.; Yang, Y. Safety gymnasium: A unified safe reinforcement learning benchmark. Adv. Neural Inf. Process. Syst. 2023, 36, 18964–18993. [Google Scholar]
  51. Gronauer, S. Bullet-Safety-Gym: A Framework for Constrained Reinforcement Learning. Technical Report, mediaTUM. 2022. Available online: https://github.com/SvenGronauer/Bullet-Safety-Gym (accessed on 12 March 2026).
  52. Li, Q.; Peng, Z.; Feng, L.; Zhang, Q.; Xue, Z.; Zhou, B. Metadrive: Composing diverse driving scenarios for generalizable reinforcement learning. IEEE Trans. Pattern Anal. Mach. Intell. 2022, 45, 3461–3475. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  53. Lee, J.; Jeon, W.; Lee, B.; Pineau, J.; Kim, K.E. Optidice: Offline policy optimization via stationary distribution correction estimation. In Proceedings of the International Conference on Machine Learning, Virtual, 18–24 July 2021; pp. 6120–6130. [Google Scholar]
  54. Kingma, D.P.; Ba, J. Adam: A method for stochastic optimization. arXiv 2014, arXiv:1412.6980. [Google Scholar]
Figure 1. Overview of Constrained Decision Transformer architecture.
Figure 1. Overview of Constrained Decision Transformer architecture.
Mathematics 14 01015 g001
Figure 2. Return–cost distributions of offline trajectories on representative tasks. Each point denotes a trajectory, with cumulative cost on the x-axis and return on the y-axis. Color intensity indicates the trajectory weight W τ (darker means larger weight) defined in Equation (34).
Figure 2. Return–cost distributions of offline trajectories on representative tasks. Each point denotes a trajectory, with cumulative cost on the x-axis and return on the y-axis. Color intensity indicates the trajectory weight W τ (darker means larger weight) defined in Equation (34).
Mathematics 14 01015 g002
Table 1. Optimization objectives for DT-based CSM methods.
Table 1. Optimization objectives for DT-based CSM methods.
MethodOptimization Objective
Offline RL
DT [17] L DT ( θ ) = − ∑ τ ∈ D ∑ 1 ≤ t ≤ H log π θ ( a t | s t , R ¯ t , τ ¯ t − 1 K )
QT [13] L DT ( θ ) − η E τ ∼ D E s t ∼ τ , a t ∼ π θ [ Q π θ ( s t , a t ) ]
RDT [26] L DT ( θ ) + α E τ ∼ D e ∑ i = t H KL π θ ( · | s t , R ¯ t , τ ¯ t − 1 K ) ∥ π e ( · | s t )
RVDT [26] L DT ( θ ) − η E τ ∼ D E s t ∼ τ , a t ∼ π θ [ Q π θ ( s t , a t ) ] + α E τ ∼ D e ∑ t = 1 H KL π θ ( · | s t , R ¯ t , τ ¯ t − 1 K ) ∥ π e ( · | s t )
Offine Safe RL
CDT [7] L CDT ( π ) = − ∑ τ ∈ D ∑ 1 ≤ t ≤ H log π ( a t | s t , R ¯ t , C ¯ t , τ ¯ t − 1 K )
TVCDT (ours) − ∑ τ ∈ D ∑ t = 1 H W τ log π θ a t | s t , R ¯ t , C ¯ t , τ ¯ t − 1 K − η E τ ∼ D E s t ∼ τ , a t ∼ π θ [ Q π θ ( s t , a t ) ]
RCDT (ours) − ∑ τ ∈ D ∑ t = 1 H W τ log π θ a t | s t , R ¯ t , C ¯ t , τ ¯ t − 1 K − η E τ ∼ D E s t ∼ τ , a t ∼ π θ [ Q π θ ( s t , a t ) ] + λ E s t ∼ τ , a t ∼ π θ [ C π θ ( s t , a t ) ]
Table 2. Performance comparison across DSRL tasks. For each task, RCDT reports the averaged normalized returns over three cost thresholds and 5 random seeds. Bold: Safe agents with averaged cost < 1 . Blue: Safe agents with the highest returns. ↑ means the higher the better. ↓ means the lower the better.
Table 2. Performance comparison across DSRL tasks. For each task, RCDT reports the averaged normalized returns over three cost thresholds and 5 random seeds. Bold: Safe agents with averaged cost < 1 . Blue: Safe agents with the highest returns. ↑ means the higher the better. ↓ means the lower the better.
TaskBC-ALLBCQ-LagBEAR-LagCOptiDICEBC-SafeCPQFISORCDTTraCRCDT
Ret↑Cost↓Ret↑Cost↓Ret↑Cost↓Ret↑Cost↓Ret↑Cost↓Ret↑Cost↓Ret↑Cost↓Ret↑Cost↓Ret↑Cost↓Ret↑Cost↓
PointCircle10.793.980.542.380.733.280.865.510.410.160.430.750.4314.930.570.670.50.070.580.56
PointCircle20.664.170.662.600.634.270.858.610.480.990.243.580.7618.020.610.850.610.860.630.99
PointGoal10.650.950.710.980.741.180.491.660.430.540.570.350.645.380.620.780.440.360.680.79
PointGoal20.541.970.673.180.673.110.381.920.290.780.401.310.311.670.542.010.310.590.611.78
PointPush10.190.610.330.860.220.790.130.830.130.430.200.830.260.090.281.110.150.420.330.95
PointPush20.180.910.230.990.160.890.021.180.110.800.111.040.240.340.231.690.150.80.240.99
CarCircle10.724.390.735.250.765.460.705.720.371.380.022.290.6910.520.491.780.521.850.572.14
CarCircle20.766.440.726.580.746.280.777.990.543.380.442.690.6312.780.613.450.592.330.622.46
CarGoal10.390.330.470.780.611.130.350.540.240.280.791.420.490.120.591.010.380.390.610.99
CarGoal20.231.050.31.440.281.010.250.910.140.510.653.750.060.050.441.610.190.520.481.62
CarPush10.220.360.230.430.210.540.230.50.140.33−0.030.950.280.040.280.600.190.180.340.63
CarPush20.140.90.151.380.11.20.091.070.050.450.244.250.140.130.182.220.080.540.180.98
SwimmerVel0.494.720.486.580.32.330.637.580.511.070.132.66−0.040.000.630.300.553.210.680.46
HopperVel0.656.390.785.020.345.860.131.510.360.670.142.110.170.320.610.220.570.980.800.45
HalfCheeVel0.9713.11.0518.210.986.580.650.00.880.540.290.740.890.000.970.040.962.50.980.08
Walker2dVel0.793.880.790.170.863.10.120.740.790.040.040.210.380.360.790.030.640.060.800.01
AntVel0.983.721.024.15−1.010.01.03.280.980.29−1.010.000.890.000.950.180.970.150.980.19
Average0.553.400.583.590.432.770.452.910.400.740.211.700.423.810.551.090.460.930.590.95
BallRun0.65.080.763.91−0.475.030.593.520.271.460.221.270.180.000.370.620.270.490.390.64
CarRun0.970.330.940.150.687.780.870.00.940.220.951.790.730.040.980.540.970.10.990.29
DroneRun0.242.130.725.540.422.470.674.150.280.740.333.520.300.160.570.390.550.010.580.00
AntRun0.72.930.765.110.150.730.610.940.651.090.030.020.450.000.620.560.690.760.710.74
BallCircle0.744.710.692.360.863.090.72.610.520.650.640.760.340.000.580.940.690.660.590.95
CarCircle0.583.740.631.890.742.180.493.140.500.840.710.330.400.030.720.630.610.870.740.65
DroneCircle0.723.030.83.070.783.680.261.020.560.57−0.221.280.480.000.610.960.60.660.620.95
AntCircle0.584.90.582.870.655.480.175.040.400.960.000.200.200.000.451.540.490.910.451.19
Average0.643.360.733.110.483.810.542.550.520.820.331.150.390.030.610.770.610.560.630.68
EasySparse0.171.540.785.010.110.860.965.440.110.21−0.060.070.380.150.130.250.450.520.820.96
EasyMean0.432.820.713.440.080.860.663.970.040.29−0.070.070.380.080.470.620.40.470.740.69
EasyDense0.271.940.260.470.020.410.502.540.110.14−0.060.030.360.080.360.890.370.410.690.69
MediumSparse0.833.340.441.16−0.030.170.712.490.330.30−0.080.070.420.070.731.270.80.530.910.98
MediumMean0.772.530.781.530.000.340.762.050.310.21−0.080.050.390.020.450.890.740.580.860.52
MediumDense0.451.470.581.890.010.280.692.240.240.17−0.070.070.490.120.822.510.750.580.890.52
HardSparse0.421.800.501.020.010.160.372.050.173.25−0.050.060.300.000.220.450.430.640.440.64
HardMean0.201.770.472.560.000.210.322.470.130.40−0.050.060.260.090.310.960.450.670.450.66
HardDense0.201.330.351.400.020.260.241.680.150.22−0.040.080.300.100.120.690.350.50.420.76
Average0.422.060.542.050.020.390.582.770.180.58−0.060.060.360.080.400.950.530.540.690.71
Table 3. Component-level breakdown across ablation variants, where a ✓ indicates that the corresponding component is enabled and a × indicates that it is disabled.
Table 3. Component-level breakdown across ablation variants, where a ✓ indicates that the corresponding component is enabled and a × indicates that it is disabled.
ComponentBCBC-SafeCDTTVCDTTCCDTVCCDTRCDT
CSM-based architecture××✓✓✓✓✓
Trajectory-level weighting×✓×✓✓×✓
Q-value guidance×××✓×✓✓
Cumulative-cost penalty××××✓✓✓
Table 4. Performance comparison of ablation variants across DSRL tasks. For each method, we report normalized return (ret, higher is better) and normalized cumulative cost (cost, lower is better). Bold: Safe agents with averaged cost < 1 . Blue: Safe agents with the highest returns.
Table 4. Performance comparison of ablation variants across DSRL tasks. For each method, we report normalized return (ret, higher is better) and normalized cumulative cost (cost, lower is better). Bold: Safe agents with averaged cost < 1 . Blue: Safe agents with the highest returns.
TaskBCBC-SafeCDTTVCDTTCCDTVCCDTRCDT
Ret↑Cost↓Ret↑Cost#x2193;Ret↑Cost↓Ret↑Cost↓Ret↑Cost↓Ret↑Cost↓Ret↑Cost↓
SwimmerVel0.494.720.511.070.630.300.680.820.660.490.670.760.680.46
HopperVel0.656.390.360.670.610.220.800.540.770.520.790.780.800.45
Walker2dVel0.793.880.790.040.790.030.800.080.780.010.790.040.800.01
Table 5. Performance comparison on datasets constructed by retaining only the bottom- ρ % trajectories (ranked by return) from each original dataset (i.e., discarding the top- ( 100 − ρ ) % expert trajectories). Bold: Safe agents with averaged cost < 1 . Blue: Safe agents with the highest returns.
Table 5. Performance comparison on datasets constructed by retaining only the bottom- ρ % trajectories (ranked by return) from each original dataset (i.e., discarding the top- ( 100 − ρ ) % expert trajectories). Bold: Safe agents with averaged cost < 1 . Blue: Safe agents with the highest returns.
Task ρ % BCCDTRCDT
Ret↑Cost↓Ret↑Cost↓Ret↑Cost↓
SwimmweVel 100 % 0.494.720.630.300.680.46
80 % 0.494.660.540.630.580.35
70 % 0.383.300.470.690.520.42
60 % 0.420.850.630.760.430.41
HopperVel 100 % 0.656.390.610.220.800.45
80 % 0.664.380.610.350.630.43
70 % 0.595.130.270.640.520.42
60 % 0.565.390.270.730.460.74
HalfCheetahVel 100 % 0.9713.10.970.040.980.08
80 % 0.893.260.930.480.930.33
70 % 0.894.640.910.650.890.22
60 % 0.894.810.861.640.860.75
Walker2dVel 100 % 0.793.880.790.030.800.01
80 % 0.793.540.740.480.790.01
70 % 0.793.200.720.860.790.01
60 % 0.772.000.780.000.790.01
AntVel 100 % 0.983.720.950.180.980.19
80 % 0.965.550.940.480.960.48
70 % 0.9810.160.940.430.950.36
60 % 0.892.910.920.330.940.42
Table 6. Performance comparison on more imbalanced datasets constructed by retaining only the top- ρ % and bottom- ρ % trajectories (ranked by return) from each original dataset. Bold: Safe agents with averaged cost < 1 . Blue: Safe agents with the highest returns.
Table 6. Performance comparison on more imbalanced datasets constructed by retaining only the top- ρ % and bottom- ρ % trajectories (ranked by return) from each original dataset. Bold: Safe agents with averaged cost < 1 . Blue: Safe agents with the highest returns.
Task ρ % BCCDTRCDT
Ret↑Cost↓Ret↑Cost↓Ret↑Cost↓
SwimmweVel 100 % 0.494.720.630.300.680.46
30 % 0.644.360.670.630.680.55
20 % 0.202.740.640.730.680.77
10 % 0.112.670.640.840.680.94
HopperVel 100 % 0.656.390.610.220.800.45
30 % 0.335.630.600.430.700.62
20 % 0.173.650.241.500.660.86
10 % 0.5313.820.370.270.630.66
HalfCheetahVel 100 % 0.9713.10.970.040.980.08
30 % 0.832.780.970.100.980.13
20 % 0.944.840.960.080.980.16
10 % 0.7313.250.940.010.990.22
Walker2dVel 100 % 0.793.880.790.030.800.01
30 % 0.833.000.800.020.800.01
20 % 0.812.730.760.030.790.01
10 % 0.802.410.730.020.730.56
AntVel 100 % 0.983.720.950.180.980.19
30 % 0.985.110.980.410.990.71
20 % 0.971.010.980.390.990.86
10 % 0.951.880.980.400.980.75
Table 7. Sensitivity analysis of the training hyperparameter κ on representative DSRL tasks. For each task, we report the normalized return (higher is better) and normalized cumulative cost (lower is better) of RCDT trained with different κ values. Bold: Safe agents with averaged cost < 1 . Blue: Safe agents with the highest returns.
Table 7. Sensitivity analysis of the training hyperparameter κ on representative DSRL tasks. For each task, we report the normalized return (higher is better) and normalized cumulative cost (lower is better) of RCDT trained with different κ values. Bold: Safe agents with averaged cost < 1 . Blue: Safe agents with the highest returns.
Task κ = 5 κ = 8 κ = 10 κ = 15 κ = 20
Return↑Cost↓Return↑Cost↓Return↑Cost↓Return↑Cost↓Return↑Cost↓
SwimmerVel0.610.330.640.430.680.460.680.830.680.86
HopperVel0.660.130.670.320.800.450.720.360.740.65
AntRun0.600.160.650.240.710.740.640.520.690.65
CarCircle0.710.550.730.610.740.650.750.890.770.98
MediumSparse0.860.860.900.960.910.980.921.300.951.51
HardMean0.350.430.360.530.450.660.441.010.391.17
Average0.630.410.660.520.720.660.690.820.700.97
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Bai, W.; Zhang, C.; Xu, Q.; Chen, C.; Zhou, C.; Qian, H. Conditional Sequence Modeling for Safe Reinforcement Learning. Mathematics 2026, 14, 1015. https://doi.org/10.3390/math14061015

AMA Style

Bai W, Zhang C, Xu Q, Chen C, Zhou C, Qian H. Conditional Sequence Modeling for Safe Reinforcement Learning. Mathematics. 2026; 14(6):1015. https://doi.org/10.3390/math14061015

Chicago/Turabian Style

Bai, Wensong, Chao Zhang, Qihang Xu, Chufan Chen, Chenhao Zhou, and Hui Qian. 2026. "Conditional Sequence Modeling for Safe Reinforcement Learning" Mathematics 14, no. 6: 1015. https://doi.org/10.3390/math14061015

APA Style

Bai, W., Zhang, C., Xu, Q., Chen, C., Zhou, C., & Qian, H. (2026). Conditional Sequence Modeling for Safe Reinforcement Learning. Mathematics, 14(6), 1015. https://doi.org/10.3390/math14061015

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop