TL;DR
Standard reinforcement learning with delayed feedback assumes that the observed return is simply an equally weighted sum of underlying, Markovian step-level rewards. This paper introduces RL from Composite Delayed Reward (RLCoDe) and proposes CoDeTr, a transformer-based reward model that decouples non-Markovian step reward estimation from in-sequence attention weighting. CoDeTr effectively pinpoints critical moments in a trajectory and significantly outperforms existing reward redistribution methods across complex delayed feedback structures.
What Problem Does This Paper Address?
In many real-world applications—such as robotics or systems learning from human evaluators—immediate per-step rewards are unavailable. Instead, agents receive delayed feedback periodically over a sequence of actions.
Existing delayed-reward methods typically rely on two restrictive assumptions:
- The Markovian assumption: The reward at any step depends strictly on the current state and action $(s_t, a_t)$, ignoring sequence history.
- The uniform additive assumption: The delayed reward is an exact, equal-weighted sum of individual step rewards: $R(\tau) = \sum r(s_t, a_t)$.
These assumptions conflict with both non-Markovian task dynamics and human cognitive psychology (e.g., the "peak-end rule"), where evaluators place disproportionate weight on pivotal or catastrophic moments rather than averaging over every timestep. To remove these restrictions, the authors formalize the Composite Delayed Reward MDP (CoDeMDP), where delayed feedback can be an arbitrary, non-linear function of trajectory segments.
Methods
The authors introduce CoDeTr (Composite Delayed Reward Transformer) to model delayed feedback as an attention-weighted sum of non-Markovian instance rewards:
$$\hat{R}_{\text{co}}(\tau) = \sum_{t \in \tau} w_t \cdot \hat{r}_t$$
Key architectural and algorithmic components include:
- Causal Transformer Backbone for Non-Markovian Rewards: A multi-layer GPT-style causal transformer processes trajectory tokens $(s_0, a_0, \dots, s_t, a_t)$ up to the current timestep. Its output embedding $x_t$ passes through a linear layer to predict the immediate non-Markovian reward $\hat{r}_t$.
- Bidirectional In-Sequence Attention Layer: Within each delayed feedback window $\tau$, query ($q_t$) and key ($k_t$) projections compute attention weights $w_t = \sum_{i \in \tau} \text{softmax}(\langle q_i, k_{t'} \rangle / \sqrt{d})$. Because it attends bidirectionally over the sequence, the model determines how critical each timestep was to the sequence's overall outcome.
- Alternating Policy and Reward Optimization: The reward model is trained via mean squared error against observed composite sequence rewards: $(R_{\text{co}}(\tau) - \hat{R}_{\text{co}}(\tau))^2$. In turn, CoDeTr labels transitions in an off-policy replay buffer using a sliding history window ($H = 100$), allowing an off-the-shelf Soft Actor-Critic (SAC) algorithm to optimize the policy.
Datasets
The authors evaluate their method on continuous control benchmarks:
- MuJoCo Locomotion Suite:
Ant-v2,HalfCheetah-v2,Walker2d-v2 - DeepMind Control (DMC) Suite:
fish-upright,cartpole-swingup
To instantiate RLCoDe, the authors construct three synthetic non-linear delayed reward structures over segments of length $n_i \in \{5, 25, 50, 100, 200, 500\}$:
- SumSquare: $R_{\text{co}} = \sum \text{abs}(r_t) \cdot r_t$ (emphasizes high-magnitude rewards).
- SquareSum: $R_{\text{co}} = \text{abs}(\sum r_t) \cdot \sum r_t$ (emphasizes cumulative episode performance).
- Max: Softmax-weighted sum prioritizing peak steps with scaling parameter $\beta = 3$.
- Sum (Standard): Linear sum of per-step rewards, matching prior literature benchmarks.
Key Insights and Ideas
- Decoupling "What happened" from "How much it mattered": Using a causal transformer to capture temporal progression for $\hat{r}_t$, combined with a bidirectional attention layer for $w_t$, allows the network to isolate the quality of an individual action from its relative importance within the episode.
- Automatic Collapse to Uniform Weights: When evaluated on traditional linear-sum delayed rewards, CoDeTr’s learned attention weights automatically hover around $w_t \approx 1$. It recovers standard linear credit assignment without requiring structural priors.
- Alignment with Peak Behaviors: In the
Maxsetting, learned attention weights $w_t$ exhibit sharp peaks precisely at the timesteps corresponding to true environmental reward maxima, explaining why the policy maintains performance even when reward signals are sparse and skewed.
Key Results
- Composite Delayed Reward Environments: Across
Ant-v2,HalfCheetah-v2,Walker2d-v2,fish-upright, andcartpole-swingup, CoDeTr consistently outperforms existing delayed-reward baselines (including RBT, RRD, IRCR, HC, and LIRPG). - Ant-v2 Quantitative Highlights (Normalized Scores, Table 2):
- SumSquare: CoDeTr achieves 0.3910, significantly outperforming the best baseline, RBT (0.2821), while others stay below 0.031.
- SquareSum: CoDeTr achieves 0.1992, more than doubling RBT (0.0890), while traditional baselines achieve $\le 0.0575$.
- Max: CoDeTr leads with 0.5318 (vs. RBT's 0.4669 and RRD's 0.2193).
- Traditional Linear Sum: CoDeTr matches state-of-the-art sum-based methods (0.5493 vs. RBT's 0.5699), showing no degradation when the sum assumption actually holds.
Limitations and Future Work
- Performance Degradation at Long Delays: Policy learning becomes substantially harder as the delay horizon approaches $n_i = 500$, as temporal credit assignment over long spans remains fundamentally challenging.
- Lack of Real Human Evaluators: Experiments rely on mathematically formulated composite functions (e.g., softmax and squared sums) rather than actual human-in-the-loop annotations.
- Future Directions: Integrating memory-augmented architectures or improved temporal credit assignment mechanisms to tackle extreme delay horizons, as well as testing RLCoDe with real human preference and trajectory evaluation data in robotics and healthcare domains.
Summary updated