Reinformer: Max-Return Sequence Modeling for Offline RL

Zifeng Zhuang, Dengyun Peng, Jinxin Liu, Ziqi Zhang, Donglin Wang

Sequence models like the Decision Transformer (DT) have popularized treating offline Reinforcement Learning (RL) as a supervised learning problem. However, they often struggle to "stitch" together sub-optimal trajectories because they ignore the core RL objective: maximizing returns. This paper introduces Reinformer (Reinforced Transformer), a max-return sequence model that uses expectile regression to predict the highest in-distribution return achievable from a given state. By dynamically predicting and conditioning on this maximum return during inference, Reinformer bridges the gap between sequence modeling and traditional RL.

The Trajectory Stitching Problem

In offline RL, an agent must learn an optimal policy from a static, pre-collected dataset without interacting with the environment. Recently, models like DT have framed this as a supervised sequence modeling task: given a state and a desired "target return," predict the action that achieves it.

Trajectory stitching in a grid world

To achieve high performance during inference, practitioners typically feed the DT a manually chosen, artificially high target return. This "naive max" approach creates a significant problem: out-of-distribution (OOD) errors. If the agent is currently on a poor trajectory, a maximum target return is mathematically impossible, confusing the model. Consequently, standard sequence models fail at trajectory stitching—the crucial ability to combine successful segments of multiple sub-optimal trajectories to reach a goal (as illustrated above, where an agent must learn to switch from a failing path to a successful one).

Reinformer: Max-Return Sequence Modeling

To solve this, the authors propose max-return sequence modeling via a novel architecture called Reinformer. Instead of relying on a human to guess a target return, Reinformer learns to predict the maximum return that is actually possible given the current state and the dataset's distribution.

Reinformer architecture, training loss, and inference pipeline

Reinformer operates through two key mechanisms:

  1. Expectile Regression for Returns: During training, Reinformer predicts both the action and the returns-to-go. For the return prediction, it uses an asymmetric loss function called expectile regression. By setting a hyperparameter $m$ close to 1 (e.g., $m=0.99$), the loss heavily penalizes under-predictions. This forces the model to predict the upper bound (maximum) of returns seen in the dataset for that specific state, without hallucinating impossible OOD returns.
  2. Two-Step Inference: During deployment, Reinformer doesn't need a manually inputted target return. First, it evaluates the current state and predicts the maximum in-distribution return. Second, it feeds that predicted return back into itself as a condition to generate the optimal action.

Key Insights and Results

The authors evaluated Reinformer on the standard D4RL benchmark, focusing on locomotion (Gym), navigation (Maze2d, Antmaze), and manipulation (Kitchen).

  • Expectile Regression as a Safe RL Objective: By using expectile regression, the sequence model naturally learns to upper-bound returns. It acts similarly to a value function in traditional RL, but because it is grounded in supervised learning, it stays strictly within the data distribution, avoiding severe overestimation issues.
  • Dynamic Targets Enable Stitching: Because Reinformer predicts what is actually possible from its current state, its target return is dynamic. If it starts on a failing trajectory but crosses paths with a successful one, its predicted return smoothly jumps up, allowing it to "stitch" the two paths together.
  • State-of-the-Art Performance: Reinformer outperforms existing sequence models (DT, ODT, EDT, QDT) across the D4RL benchmark. It achieved massive gains on tasks where trajectory stitching is critical, improving performance by +37.07% on Maze2d and +28.45% on Kitchen compared to the strongest sequence modeling baselines.
  • Breakthrough on Antmaze: Previous sequence models completely failed on the sparse-reward Antmaze tasks (scoring 0.0 on medium-play and medium-diverse). Reinformer successfully completes these tasks, scoring 13.2 and 10.6 respectively.

Limitations and Future Work

While Reinformer is a massive leap forward for sequence models, it still falls short of classical offline RL algorithms (like Implicit Q-Learning) on the most extreme trajectory stitching tasks, such as Antmaze. Future work will focus on identifying and bridging this remaining performance gap, and investigating specific scenarios where sequence models have a definitive structural edge over traditional RL methods.

Summary updated

BibTeX
@inproceedings{zhuang2024reinformer,
  author = {Zifeng Zhuang and Dengyun Peng and Jinxin Liu and Ziqi Zhang and Donglin Wang},
  title = {{Reinformer: Max-Return Sequence Modeling for Offline RL}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=mBc8Pestd5},
}
Figure