Decision S4: Efficient Sequence-Based RL via State Spaces Layers

Shmuel Bar David, Itamar Zimerman, Eliya Nachmani, Lior Wolf

The Bottleneck in Sequence-Based RL

In recent years, the "Decision Transformer" (DT) shifted the Reinforcement Learning (RL) paradigm by treating RL as a sequence modeling problem. Instead of traditional dynamic programming, DT predicts actions based on a history of states, actions, and "returns-to-go" (desired future rewards).

While highly successful, Transformers introduce three major bottlenecks in RL:

  1. Computational Cost: Self-attention has quadratic complexity ($O(L^2)$) relative to sequence length, making it prohibitively slow for long trajectories.
  2. Inference Latency: Transformers cannot be computed recursively. To predict the next action, the model must re-process the entire history—a dealbreaker for real-time robotics.
  3. Fixed Windows: They typically rely on a fixed context window (e.g., the last 20 steps), which ignores the long-range dependencies crucial for complex planning.

To solve these issues, researchers propose Decision S4 (DS4), a model that leverages Structured State Space (S4) layers to offer the training efficiency of convolutions alongside the lightning-fast inference speed of recurrent neural networks (RNNs).

Methods: Enter the S4 Layer

The core innovation of DS4 is the integration of the S4 layer into the RL pipeline. S4 layers represent a sequence as a linear state-space system: $\dot{x} = Ax + Bu$.

Decision S4 Architecture

Key technical components of the DS4 approach include:

  • The Best of Both Worlds: DS4 uses the convolutional view of S4 for highly parallel, fast off-policy training on entire trajectories. During deployment, it switches to the recurrent view for efficient, constant-time inference.
  • Off-Policy to On-Policy Pipeline: The authors introduce a two-stage training scheme. First, the model is trained off-policy on static datasets. Then, it is fine-tuned using a novel, stable Actor-Critic mechanism (based on DDPG) to improve performance through active environment interaction.
  • Stability Tricks: Recurrent training often suffers from numerical instability. To prevent this, the authors suggest freezing the S4 kernel (the $A$ and $\Delta$ parameters) during the on-policy fine-tuning phase.
  • HIPPO Initialization: The state-space is initialized using the HIPPO matrix, which mathematically biases the model toward remembering long-term history.

Key Insights and Results

The model was rigorously evaluated on standard RL benchmarks, including Mujoco (D4RL) environments (Hopper, HalfCheetah, Walker2D) and the challenging AntMaze-v2 navigation task.

Long History Matters

A critical finding is that long historical context is vital for optimal performance. The authors demonstrated that truncating the number of recursive steps (history) during training significantly degraded rewards. Unlike Transformers, S4 can scale to much longer contexts without the crippling $O(L^2)$ computational penalty.

Performance vs. Trajectory Length

Performance and Efficiency Gains

  • Superior Planning: DS4 achieved the lowest average rank across all Mujoco benchmarks compared to state-of-the-art methods like IQL, CQL, and the original Decision Transformer. On the complex "AntMaze-diverse" task, DS4 scored 79.1, vastly outperforming the Online Decision Transformer (ODT) which scored 56.0.
  • Speed: In terms of wall-clock time for a single inference step, DS4 took just 2.1ms, whereas a Decision Transformer with a context of 300 steps took 18.6ms. Compared to sample-based trajectory transformers ($TT_q$), DS4 is four orders of magnitude faster.
  • Parameter Efficiency: DS4 reduced the model size by 84% compared to Decision Transformers on the Hopper task while achieving better rewards. A "Low-Budget" version of DS4 with only 27K parameters still outperformed the standard Decision Transformer on several tasks.

Overcoming Numerical Sensitivity

A fascinating insight from the paper is the discussion of numerical instability. The authors prove that the recurrent view of S4 can accumulate floating-point errors during training. By using the convolutional view for training and freezing kernels during fine-tuning, they successfully sidestep this "exploding error" problem.

Limitations and Future Work

While DS4 represents a massive leap in sequence-based RL efficiency, it has a few limitations. Currently, the model cannot be trained purely on-policy from a random initialization; it requires an off-policy pre-training phase to reach a stable point. Additionally, while freezing the S4 kernel aids stability, it may limit the model's ability to adapt its memory mechanism to entirely new dynamics during the on-policy phase. Finally, while S4 is naturally suited for continuous control, exploring its performance in discrete action spaces (like Atari games) remains an exciting direction for future research.

Summary updated

BibTeX
@inproceedings{david2023decision,
  author = {Shmuel Bar David and Itamar Zimerman and Eliya Nachmani and Lior Wolf},
  title = {{Decision S4: Efficient Sequence-Based RL via State Spaces Layers}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=kqHkCVS7wbj},
}
Figure