TL;DR
Masked Trajectory Models (MTM) apply the "masked autoencoding" magic of Large Language Models to robotics and reinforcement learning. By training a single bi-directional transformer to reconstruct missing pieces of a state-action sequence, the authors created a versatile "Swiss Army knife" model that can act as a world model, a policy, or a feature extractor—all without changing its weights.
What Problem Does This Paper Address?
In traditional Reinforcement Learning (RL), we often build complex pipelines with specialized parts: a "world model" to predict the future, a "critic" to evaluate states, and a "policy" to choose actions. Training these together is notoriously finicky and unstable.
Meanwhile, fields like Natural Language Processing have moved toward a different paradigm: train one massive model on a simple self-supervised task (like "fill in the blank") and let it adapt to everything else. The authors ask: Can we treat sequential decision-making as a generic "fill-in-the-blank" problem? If we can train a model to reconstruct any missing part of a trajectory (states, actions, or rewards), can that single model perform all the specialized roles of an RL pipeline?
Methods
The authors introduce Masked Trajectory Models (MTM). The core architecture is a bi-directional transformer (specifically an encoder-decoder setup).
- Tokenization: Raw trajectories—sequences of states ($s$), actions ($a$), and return-to-go ($R$)—are converted into tokens.
- Random Autoregressive Masking: This is the "secret sauce." During training, the model sees a trajectory where random elements are hidden. Crucially, they use a masking pattern that forces the model to sometimes predict the "next" element based only on the past (simulating real-world causality) while still allowing it to look at the "future" during other parts of training to learn deep representations.
- The Objective: The model is trained simply to minimize the Mean Squared Error (MSE) between its reconstructions and the original, unmasked trajectory.
At inference time, you don't retrain the model. You just change the masking pattern to dictate the task:
- Forward Dynamics: Mask future states; provide current state and action.
- Inverse Dynamics: Mask actions; provide current and future states.
- Offline RL (RCBC): Mask actions; provide current states and a high "target return."
Datasets
The researchers evaluated MTM across several standard continuous control benchmarks:
- D4RL Locomotion: Standard tasks like HalfCheetah, Hopper, and Walker2d.
- Adroit: Complex, high-dimensional dexterous manipulation tasks (e.g., moving a pen or opening a door with a robotic hand).
- ExORL: A dataset of trajectories collected via unsupervised exploration, used here to test how well MTM learns general state representations.
Key Insights and Ideas
- Heteromodality is a Superpower: Because MTM treats everything as a masking problem, it can learn from "incomplete" data. If you have a dataset of videos (states) but no recorded actions, MTM can still use that data by simply masking the "missing" action tokens. This "heteromodal" training actually improves performance on tasks where actions are present.
- Bi-directional > Causal: Most recent "Transformer RL" papers (like Decision Transformer) use causal (GPT-style) masking. MTM shows that being able to look "backward and forward" during training helps the model learn much more efficient representations of the environment.
- Data Efficiency: By randomly masking different parts of the same trajectory, the model "squeezes" more learning signal out of every single data point compared to standard next-step prediction.
Key Results
- Beating the Specialists: In offline RL benchmarks (D4RL), MTM outperformed other transformer-based methods like Decision Transformer (DT) and was competitive with state-of-the-art specialized RL algorithms like CQL and IQL—despite MTM having no explicit "RL" components like value functions.
- Representation Acceleration: When the representations learned by MTM were used to "prime" a traditional RL algorithm (TD3), the agent learned significantly faster, reaching optimal performance in a fraction of the time compared to learning from scratch.
- Zero-Shot Versatility: A single MTM model, with one set of weights, successfully performed four different tasks (Behavior Cloning, Return-Conditioned Behavior Cloning, Inverse Dynamics, and Forward Dynamics) just by swapping masks at inference time, often matching the performance of models trained specifically for just one of those tasks.
Limitations and Future Work
- Short Horizons: In most experiments, the authors used a trajectory segment length of 4. While they showed that longer segments help (especially in complex tasks like Adroit Door), scaling to very long-horizon reasoning remains a challenge.
- Computational Cost: Transformers are computationally heavier than the simple MLPs often used in RL, which might impact real-time control on low-power hardware.
- Future Modalities: The authors suggest that the next logical step is scaling MTM to handle more complex inputs, such as raw video pixels, which would truly test the "heteromodal" capabilities of the framework.
Summary updated