UniMASK: Unified Inference in Sequential Decision Problems
Introduction
In Reinforcement Learning (RL) and robotics, the prevailing paradigm has been to develop specialized models for distinct tasks. Behavior Cloning (BC) models are trained for imitation, dynamics models for world prediction, and goal-conditioned policies for reaching specific targets. This fragmented approach is inherently inefficient, as it fails to leverage the shared underlying structure of the environment.
Inspired by the success of "foundation models" in Natural Language Processing (NLP), such as BERT, the authors propose UniMASK. This framework treats states, actions, and rewards as tokens in a sequence, allowing a single bidirectional transformer to perform a wide array of inference tasks through a unified masking approach.
Methods: Unified Inference via Masking
UniMASK represents a trajectory as a sequence of stacked tokens, where each timestep's state ($s$), action ($a$), and reward/property ($p$) are combined into a single vector. This "input stacking" enhances efficiency and helps the model capture local dependencies.
The core innovation lies in treating diverse decision-making tasks as specific masking schemes. By masking different parts of the sequence and conditioning on the rest, the model can adapt to various objectives without architectural changes.
Key Architectural Features:
- Bidirectional Transformer: Unlike causal models (e.g., GPT) that only look at past tokens, UniMASK uses a BERT-like architecture. This bidirectionality is crucial for tasks requiring future information, such as goal-conditioning or waypoint-based navigation.
- Random Masking (RND): During training, the model is tasked with predicting randomly masked tokens. This objective forces the model to learn the joint distribution of the entire trajectory, enabling zero-shot capabilities for tasks it wasn't explicitly optimized for.
Training and Fine-tuning
While the model trained on random masks (the random-mask regime) acts as a versatile "jack of all trades," the authors found that the highest performance is achieved through a two-stage process.
Pre-training on a wide variety of masks allows the model to learn a rich representation of the environment's physics and agent behavior. Subsequent fine-tuning on a specific task consistently outperforms specialized models trained from scratch, demonstrating a significant "multi-task synergy."
Experimental Evaluation
The researchers evaluated UniMASK in two environments:
- MiniGrid (DoorKey): A discrete gridworld requiring logical reasoning (finding a key to unlock a door). UniMASK achieved superior validation loss across nearly all tasks compared to single-task baselines.
- Modified Maze2D: A continuous control task made partially observable by removing velocity data. This forced the model to infer hidden states from temporal context. For short context windows, UniMASK outperformed standard feedforward networks and the Decision Transformer.
Insights and Limitations
UniMASK demonstrates that a single model can effectively handle "backwards inference" (predicting the past) and "property conditioning" (e.g., generating trajectories passing through specific regions) zero-shot.
However, the bidirectional approach faces challenges with scaling. As the context window grows beyond 10 timesteps, performance tends to degrade relative to unidirectional models. Furthermore, while excellent at filling in missing information, UniMASK is less naturally suited for long-horizon generative planning than its causal counterparts.
Conclusion
UniMASK provides a powerful proof-of-concept for a unified framework in sequential decision-making. By reframing RL tasks as masking problems, it moves the field closer to the "foundation model" paradigm seen in NLP. Future work may involve hybrid architectures that combine the flexible conditioning of BERT with the long-horizon scaling of GPT.
Summary updated