Uni[MASK]: Unified Inference in Sequential Decision Problems

Micah Carroll, Orr Paradise, Jessy Lin, Raluca Georgescu, Mingfei Sun, David Bignell, Stephanie Milani, Katja Hofmann, Matthew Hausknecht, Anca Dragan, Sam Devlin

TL;DR

Uni[MASK] brings the "mask and predict" revolution from Natural Language Processing (NLP) to sequential decision-making. By treating tasks like behavior cloning, offline reinforcement learning, and dynamics modeling as different masking patterns on a single sequence of states and actions, the authors develop a unified transformer model that matches or exceeds the performance of specialized, single-task models.

What Problem Does This Paper Address?

In the world of sequential decision-making (such as robotics and reinforcement learning), researchers typically build specialized tools for specific jobs. If you want an agent to imitate a human, you train a Behavior Cloning (BC) model. If you want it to predict how the world changes, you build a Dynamics Model. If you want it to reach a specific goal, you use Goal-Conditioned RL.

This fragmentation is inefficient. In NLP, the field moved past this paradigm by using "foundation models" like BERT or GPT that learn a general representation of language and can then perform many downstream tasks. Uni[MASK] addresses this gap by asking: Can we treat all these different decision-making tasks as a single sequence modeling problem?

Methods

The core idea is to represent a trajectory as a sequence of tokens: states ($s$), actions ($a$), and properties ($p$) like "return-to-go" (RTG).

Extracted figure from page 4 of Uni[MASK]: Unified Inference in Sequential Decision Problems

The authors utilize a bidirectional Transformer (BERT-style architecture). Unlike the popular Decision Transformer, which is "causal" (it can only look at the past), Uni[MASK] can look at the entire sequence. This allows it to handle tasks that require looking "backward" or "forward" in time.

The researchers define four primary training regimes:

  1. Single-task: Training on one specific masking pattern (e.g., always predicting the next action).
  2. Multi-task: Training on a fixed set of specific tasks.
  3. Random-mask: The "BERT approach"—randomly hiding subsets of states, actions, and rewards, forcing the model to learn the joint distribution of the entire trajectory.
  4. Finetune: Pre-training on the random-mask objective and then specializing on a specific task.

Key Insights and Ideas

  • Tasks are just Masks: The most elegant insight of Uni[MASK] is that almost every common inference task in RL is just a specific conditional probability. For instance, Behavior Cloning is $P(a_t | s_{0:t}, a_{0:t-1})$, while Inverse Dynamics is $P(a_t | s_t, s_{t+1})$. By training on random masks, the model implicitly learns all these relationships simultaneously.
Various sequential decision-making tasks represented as different masking patterns over a trajectory.
  • Bidirectionality is a Superpower: Because Uni[MASK] is bidirectional, it can perform "backwards inference" (predicting what happened in the past to reach a current state) or "waypoint conditioning" (planning a path that hits specific points in the future) out-of-the-box.
  • The "Pre-training" Dividend: The authors found that training on all possible tasks (random masking) often helps the model perform better on a specific task than if it had only been trained on that task. This suggests that learning the underlying dynamics of the environment provides a richer representation for decision-making.
  • BERT vs. GPT Trade-offs: While BERT-style models excel at inference and "filling in the blanks," they can struggle with very long-horizon sequence generation compared to causal GPT-style models.

Datasets and Key Results

The framework was evaluated on two main environments:

  • Gridworld (MiniGrid): A 4x4 navigation task with a locked door and randomized keys. This served as a controlled environment to systematically analyze how different masking schemes affect performance.
  • Maze2D (D4RL): A more complex, continuous-state and continuous-action environment using the MuJoCo physics engine. Here, a point-mass must navigate a maze to reach a target, requiring the model to handle longer horizons (up to 200 timesteps) and partial observability.

Performance Highlights: * Versatility: A single Uni[MASK] model trained with random masking could perform BC, goal-conditioning, reward-conditioning, and dynamics modeling in the Gridworld without any task-specific fine-tuning. * Performance Boost: In the Maze2D environment, the finetune regime (pre-training on random masks then specializing) consistently outperformed standard single-task baselines. * Comparison to Decision Transformer (DT): For shorter context lengths (length 5), Uni[MASK] significantly outperformed the standard Decision Transformer. For example, in Maze2D, Uni[MASK] achieved rewards around 2.6-2.7, while the baseline DT struggled around 1.1-1.5. However, as context length increased to 10, the gap narrowed, highlighting the challenges of bidirectional models with longer sequences.

Limitations and Future Work

  • Scaling Context Length: The authors noted that performance degrades as the context window grows. Future work could explore hybrid architectures that combine the bidirectional strengths of BERT with the long-sequence efficiency of GPT.
  • Foundation Model Potential: While tested on specific environments, the ultimate goal is to apply Uni[MASK] to massive, diverse datasets to create a true "foundation model" for robotics.
  • Computational Efficiency: Bidirectional self-attention scales quadratically, $O(N^2)$. Exploring more efficient transformer variants (like XLNet or NADE-style approaches) could speed up training and inference for real-time applications.

Summary updated

BibTeX
@inproceedings{carroll2022uni,
  author = {Micah Carroll and Orr Paradise and Jessy Lin and Raluca Georgescu and Mingfei Sun and David Bignell and Stephanie Milani and Katja Hofmann and Matthew Hausknecht and Anca Dragan and Sam Devlin},
  title = {{Uni[MASK]: Unified Inference in Sequential Decision Problems}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=GisHNaleWiA},
}
Figure