TL;DR
M³PC (Masked Model Predictive Control) transforms a pretrained bidirectional trajectory model into a versatile planner at test time. By leveraging the model’s ability to act as both a policy and a world model through different masking patterns, it significantly boosts performance in offline reinforcement learning and enables zero-shot goal reaching without any additional training.
What Problem Does This Paper Address?
In Offline Reinforcement Learning (RL), agents are trained using static datasets of past experiences. Recently, Transformer-based models like the Decision Transformer have shown great promise by treating RL as a sequence modeling problem. Specifically, models trained with a Masked Auto-Encoding (MAE) objective—where the model learns to fill in missing parts of a trajectory (states, actions, or rewards)—capture deep relationships within the data.
However, there is a catch: during the "test-time" (inference) phase, these models are typically used as simple policies that just reconstruct an action based on the current state. This ignores the model's internal "knowledge" of environment dynamics and rewards. The authors argue that these models are underutilized; they shouldn't just imitate the dataset, they should use their predictive power to plan for better outcomes.
Methods
The core innovation is M³PC, which uses a single pretrained Bidirectional Trajectory Model (BTM) to perform Model Predictive Control at inference time.
The BTM is trained to reconstruct randomly masked trajectories. Because it is bidirectional, it can "look" both forward and backward in time. M³PC exploits this by applying different mask ensembles at test time:
- Forward M³PC (for Reward Maximization):
- Sample: The model generates several potential action sequences (proposals).
- Roll out: Using a "Forward Dynamics" mask, the model predicts the future states that would result from those actions.
- Evaluate: Using a "Reward Prediction" mask, it estimates the rewards and long-term returns for those predicted futures.
- Select: The agent executes the action that leads to the highest predicted utility.
- Backward M³PC (for Goal Reaching): If given a specific goal state, the model uses a "Path Inference" mask to imagine intermediate waypoints and an "Inverse Dynamics" mask to calculate the actions needed to reach them.
To handle the multi-modal nature of actions (where there might be many "right" ways to move), the authors use a Negative Log Likelihood (NLL) loss during pretraining rather than standard Mean Squared Error (MSE), making the model "uncertainty-aware."
Key Insights and Ideas
- One Model, Many Personas: The most striking insight is that the exact same model weights can serve as a policy, a dynamics model (world model), and a reward estimator. You just change the mask.
- Unified > Specialized: Interestingly, the authors found that a single unified model trained on random masks performs better than two separate specialized models (one for policy, one for dynamics) when used for planning. The shared representation seems to help the model understand the "physics" of the task more cohesively.
- Zero-Shot Generalization: Because the model learns the underlying dynamics of the environment, it can perform "unseen" behaviors. For example, a walker model trained only on walking data can be guided to perform a split zero-shot by providing a "split" goal state.
Key Results
- Offline RL Superiority: On D4RL benchmarks (standard locomotion tasks like Hopper, Walker2d, and HalfCheetah), M³PC-Q (using Q-value guidance) achieved a total score of 429.8, significantly outperforming the base BTM (372.8) and even specialized offline RL algorithms like IQL (401.0).
- Online Finetuning: When allowed to interact with the environment (Offline-to-Online), M³PC outperformed the state-of-the-art ODT algorithm by 26.0%.
- Robotic Manipulation: M³PC also demonstrated strong performance on RoboMimic tasks (e.g., "Can," "Lift," and "Square"), proving its utility beyond simple locomotion.
- Efficiency: Despite the planning overhead, M³PC is computationally efficient because it can predict all future actions and states in parallel, unlike autoregressive models that must predict one step at a time.
Limitations and Future Work
- State-Based Only: The current framework relies on state-vector observations. Handling raw pixel data (images) is a noted area for future investigation.
- Planning Horizon: The model's planning is limited by its context window. Very long-term tasks might still be challenging without hierarchical planning.
- Scalability: While the results are strong, it remains to be seen how these benefits scale with massive model parameters (e.g., billions of parameters) compared to the relatively small models used in the study.
Summary updated