Rethinking Transformers in Solving POMDPs

Chenhao Lu, Ruizhe Shi, Yuyao Liu, Kaizhe Hu, Simon Shaolei Du, Huazhe Xu

Introduction

While Transformers have revolutionized sequence modeling in Natural Language Processing (NLP), their application to Reinforcement Learning (RL) remains a subject of intense scrutiny. In particular, real-world scenarios often manifest as Partially Observable Markov Decision Processes (POMDPs), where an agent's observations are incomplete. To act optimally, the agent must reconstruct the hidden state from its history. This paper investigates whether the Transformer architecture is fundamentally ill-suited for the state-tracking requirements of POMDPs and proposes linear recurrent models as a superior alternative.

The Theoretical Gap: POMDPs as Regular Languages

A core contribution of this work is the theoretical reduction of POMDP solving to the recognition of regular languages. The authors demonstrate that tracking state in a POMDP is at least as difficult as processing strings governed by specific formal rules.

Finite state automata representing regular languages used to model POMDP state transitions.

Using circuit complexity theory, the paper shows that "log-precision" Transformers—those using realistic bit-depths—belong to the complexity class $TC^0$. This class is mathematically incapable of solving certain $NC^1$-complete regular languages, such as the SYM(5) task. In contrast, recurrent models possess the necessary inductive bias to handle these transitions efficiently. Furthermore, the authors identify a "dilution" effect in softmax attention: as sequence length $n$ grows, the influence of any single past observation on the current output vanishes at a rate of $O(1/n)$, making long-term state maintenance mathematically precarious for Transformers.

Architectural Inductive Biases

The paper contrasts two primary paradigms for history-tracking: pointwise recurrence and parallel attention. While Transformers act as "lookup" engines that attend to specific past tokens, Recurrent Neural Networks (RNNs) act as "update" engines that maintain a continuous summary of the past.

Comparison of (a) Pointwise Recurrent and (b) Parallel Attention architectures.

To bridge the gap between the parallelizability of Transformers and the state-tracking efficiency of RNNs, the authors advocate for the Deep Linear Recurrent Unit (LRU). Unlike traditional LSTMs, which suffer from vanishing gradients, the LRU uses linear transitions. This allows for efficient parallel computation during training while preserving the recurrent logic necessary for reconstructing hidden states over time.

Empirical Evaluation

The authors evaluated their hypotheses across several benchmarks:

  • Regular Language POMDPs: In tasks like PARITY (tracking the count of 1s) and the complex SYM(5), Transformers (GPT) failed as sequence lengths increased, whereas LRUs and LSTMs maintained high performance.
  • PyBullet Occlusion: In locomotion tasks where velocity or position data were hidden, the LRU achieved a normalized score of 88.2, vastly outperforming GPT (39.3) and LSTMs (74.6).
  • Long-Term Memory: In the Passive Visual Match task, the LRU demonstrated superior memory retention, successfully recalling cues that LSTMs forgot and navigating reward functions that confused Transformers.

Conclusion

This research highlights a fundamental mismatch between the attention mechanism and the state-reconstruction requirements of POMDPs. While Transformers excel at pattern matching in large datasets, the "running tally" logic of POMDPs favors recurrent architectures. The Deep Linear Recurrent Unit emerges as a "Goldilocks" solution, offering the computational advantages of modern sequence models with the essential inductive bias of recurrence. Future work will explore how these biases influence exploration in complex, unknown environments.

Summary updated

BibTeX
@inproceedings{lu2024rethinking,
  author = {Chenhao Lu and Ruizhe Shi and Yuyao Liu and Kaizhe Hu and Simon Shaolei Du and Huazhe Xu},
  title = {{Rethinking Transformers in Solving POMDPs}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=SyY7ScNpGL},
}
Figure