TL;DR
TD-MPC2 is a model-based reinforcement learning agent. It learns a world model in a compact latent space, trained to predict rewards and values rather than future observations, and it chooses each action by planning with that model. One set of hyperparameters works across 104 continuous-control tasks, and the same design scales to a single 317M-parameter agent trained on 80 tasks.
Where you'll see it: continuous robot-control benchmarks where one policy must handle many tasks, and as the main reference point for latent planning in the TD-MPC family.
The problem
Continuous control means choosing real-valued actions, such as joint torques, at every step. Model-based RL learns a model of the environment and plans with it, which can be far more data-efficient than trial and error alone. The paper names three problems that made this hard to scale across many tasks:
- Hyperparameter sensitivity. Most RL algorithms, including SAC and the original TD-MPC, use per-task hyperparameters and have no principled way to choose them. A method that must learn many tasks at once cannot be retuned for each one.
- Scaling failure. Naively making TD-MPC's world model larger and training it on more data often lowers performance. The paper's Figure 1 states this as a net decrease in agent performance.
- Expensive imitation data. Generalist embodied agents trained by behavior cloning assume near-expert demonstrations, which are scarce. The authors want an algorithm that learns from large, uncurated datasets whose behaviors range from random to expert.
Reconstruction-based world models add a fourth difficulty. Predicting raw future images or proprioceptive features over long horizons is hard, and accurate prediction does not guarantee good control.
Key idea
TD-MPC2 asks for a model that is maximally useful for control, not one that reproduces the world. The model predicts what matters for decisions: the reward of a step, and the discounted return from a latent state. It never decodes observations.
Picture a planner that imagines a few steps ahead in latent space, then hands off to a learned value function that estimates everything beyond that horizon. The planner only needs the model to score imagined futures correctly, which is a much smaller job than predicting pixels correctly.
The method
Components
The agent has five learned pieces, all conditioned on a task embedding . Each is a small MLP.
| Component | Form | Job |
|---|---|---|
| Encoder | Maps an observation to a latent state | |
| Latent dynamics | Predicts the next latent state | |
| Reward | Predicts the reward of one transition | |
| Terminal value | Predicts the discounted return from a state-action pair | |
| Policy prior | Proposes an action that should score well under |
During training the agent keeps a replay buffer and alternates two steps: update the model on sampled sequences, then collect new environment data by planning with the model.
The learning objective
The encoder, dynamics, reward and value components are trained together on sampled sequences of length :
Each of the three terms does one job:
- Joint-embedding prediction. The predicted next latent is pulled toward the encoding of the real next observation. The stop-gradient means that target is not pushed back through the encoder, which prevents the trivial solution where every observation maps to one constant vector.
- Reward prediction. A cross-entropy loss on the predicted reward.
- Value prediction. A cross-entropy loss on the predicted value against the TD target .
Here down-weights farther time steps, and is an exponential moving average of , which keeps the TD target from chasing itself. Reward and value are not regressed as raw numbers. The paper treats them as discrete classes in a log-transformed space, with 101 bins, and trains with cross-entropy using the target as a soft label. The paper says this makes the magnitude of the two loss terms independent of the magnitude of the task rewards. The joint-embedding term keeps continuous (squared-error) regression, because the latent is already normalized by SimNorm and discrete regression would need bins for every latent dimension.
The policy prior
The policy prior is a stochastic policy trained with maximum-entropy RL. It maximizes the value of its action plus an entropy bonus:
The entropy has a closed form. The weights and balance the value term against the entropy term, because the value scale changes across tasks and training stages, and too little entropy makes the policy collapse early. The paper tunes from moving statistics of the value estimate and reports no significant difference from an entropy-target scheme.
Architecture and SimNorm
Every component is an MLP with linear layers, LayerNorm and Mish activations. The latent is normalized by SimNorm. It splits the latent into groups of values and applies a softmax with temperature to each group:
Each group becomes a probability vector, which bounds the norm of the latent and pushes it toward sparse groups without a hard constraint. The paper says SimNorm is essential to training stability. The default 5M model uses latent dimension 512, (so 64 groups) and (Table 8).
Value learning uses an ensemble of five -functions, each with 1% dropout after its first layer, and each with its own EMA target . TD targets take the minimum of two randomly subsampled target Q-functions.
Planning
At each decision step the agent runs Model Predictive Path Integral (MPPI) planning. It samples action sequences of horizon from a diagonal Gaussian, scores each by rolling it out in latent space, and moves the Gaussian toward high-scoring sequences. The objective is
The learned value at the end of the horizon makes the plan a full RL objective rather than a short-sighted one. Only the first action of the best plan is executed, and then planning restarts from the new state. Some sampled sequences come from the policy prior, and the Gaussian is warm-started from the previous step's solution shifted by one.
Table 8 gives the defaults: horizon , 6 iterations (8 if the action dimension is at least 20), population 512, 64 elites, 24 policy-prior samples, temperature 0.5, and minimum and maximum standard deviations 0.05 and 2.
Training across tasks
To train one agent on many tasks with different observation and action sizes, the paper does three things:
- Learnable task embedding. A 96-dimensional vector conditions all five components. Its norm is constrained to at most 1 for training stability, and the paper reports that this also makes task embeddings more semantically coherent.
- Zero-padding and action masking. Inputs and outputs are padded to the largest sizes, and invalid action dimensions are masked out in the policy prior and in planning. This keeps padding errors out of TD targets and stops the entropy from inflating on small action spaces.
- Same hyperparameters everywhere. No per-task tuning is used. The discount factor and the number of seed steps are set by heuristics (Appendix H), not tuned per task.
Worked examples
Example 1: SimNorm on one group (analytic, illustrative values). Take , , and the group .
- Divide by : .
- Exponentiate: .
- Sum: .
- Divide: , which sums to 1 up to rounding.
Interpretation: the largest entry dominates, so the group is nearly one-hot. Lowering makes it sparser, and raising it makes it more uniform. The latent stays a set of probability vectors whatever the raw scale of .
Example 2: the discount heuristic. The paper sets , where is the expected episode length after action repeat.
- : , so , inside the clip range.
- : , so , exactly the upper clip value.
- : , so , which is clipped up to .
Interpretation: longer episodes need a discount closer to 1 so that the return still sees the rewards at the end. The clip keeps the value in a range the paper's setting supports.
Example 3: planning compute per decision (estimate from Table 8). With 6 iterations and 512 sampled sequences per iteration, a decision evaluates about sequences. Each has horizon 3, so roughly latent steps are simulated, not counting the 24 policy-prior samples per iteration or the terminal value calls. Interpretation: planning is the main per-step compute cost. The paper reports code-level optimizations that roughly double planning throughput, which keep its wall-clock time comparable to TD-MPC despite the larger network.
Results
Numbers below come from the paper's text and tables.
Single-task control (104 tasks, 4 domains). The primary comparison is against SAC (model-free), DreamerV3 (model-based, about 20M parameters) and the original TD-MPC. TD-MPC2 uses a 5M-parameter agent with one set of hyperparameters, with 3 seeds and 95% confidence intervals. It outperforms the baselines across all four domains. The authors ran no TD-MPC2 experiments on MyoSuite before the reported results. On high-dimensional locomotion (Humanoid, with 21 action dimensions, and Dog, with 38) and on object manipulation, the margin is described as large. The paper says TD-MPC sometimes diverges from exploding gradients, while TD-MPC2 stays stable. DreamerV3 shows numerical instabilities on Dog and struggles with fine manipulation such as lift, pick and stack.
Visual observations. On 10 image-based DMControl tasks, with a shallow convolutional encoder and no hyperparameter changes, TD-MPC2 is comparable to DrQ-v2 and DreamerV3, the two best baselines.
Scaling (Table 1). Models range from 1M to 317M parameters, trained on 80 tasks (50 Meta-World and 30 DMControl) from 545M transitions taken from the replay buffers of 240 single-task agents. Multitask training uses batch size 1024.
| Params (M) | GPU days (RTX 3090) | Normalized score |
|---|---|---|
| 1 | 3.7 | 16.0 |
| 5 | 4.2 | 49.5 |
| 19 | 5.3 | 57.1 |
| 48 | 12 | 68.0 |
| 317 | 33 | 70.6 |
The paper reports that the normalized score appears to rise linearly with the log of parameter count, and that the largest model has not saturated. It explicitly declines to state a scaling law.
Few-shot finetuning. A 19M-parameter agent pretrained on 70 tasks, then finetuned to 10 held-out tasks with an empty replay buffer and unchanged hyperparameters, improves about 2x over learning from scratch in the 20k-environment-step regime. The paper calls finetuning world models an open problem and presents these results as exploratory.
Ablations. The paper ablates the actor, normalization, regression objective and number of Q-functions. It reports that every design choice contributes, and that the relative importance of each choice is consistent between single-task and multitask settings.
Task embeddings. A t-SNE plot of the embeddings learned on 80 tasks shows that similar tasks, such as Door Open and Door Close, sit close together. The paper says closeness follows dynamics (embodiment and objects) more than objective (walk versus run). This comes from a t-SNE visualization.
Why it mattered
The paper states what it changed. It makes model-based RL robust across tasks with one hyperparameter set, shows that a latent world model without a decoder can scale to 317M parameters, and releases over 300 checkpoints, datasets and code. Its lessons section argues that algorithmic robustness lowers the barrier to RL for small teams.
The paper also lists what it leaves open. Extending TD-MPC2 to discrete action spaces is an open problem, and the paper says DreamerV3 performs better on discrete tasks such as Atari and Minecraft. The method relies on reward signals, and the paper names success labels, human preferences and goal-embedding distances as possible generalized rewards whose use for large-scale pretraining is still open. Its risks section names misspecified rewards, unsafe autonomy on physical robots, and data costs that could concentrate power. Finally, it proposes that massively multitask world models could be used zero-shot on seen embodiments and finetuned on new ones, and notes that such generalization will likely need far more tasks than are available now.
Reading guide
Read the paper in this order and use these lessons for the sections that need them.
- Introduction and Background (Sections 1 and 2): Reinforcement Learning for the MDP setup, and Model-Based Reinforcement Learning for why planning with a learned model is attractive. Model Predictive Control introduces the receding-horizon idea that Section 2 formalizes.
- Components and objective (Section 3.1): Temporal-Difference Learning for the TD target, Exponential Moving Average for the target network , Cross-Entropy Loss and Softmax for the discrete reward and value heads and the SimNorm projection, and Layer Normalization for the normalized MLPs.
- Planning (Section 3.2): Model Predictive Control for replanning at each step, and Cross-Entropy Method for the closely related sampling-based planner that MPPI builds on.
- Multitask training (Section 3.3): no new prerequisites. The task embedding and masking use the concepts above.
- Experiments and ablations (Section 4): Learning Latent Dynamics for Planning from Pixels (PlaNet) and World Models for the earlier latent-model lineage, and Mastering Diverse Domains through World Models (DreamerV3) for the main model-based baseline.
- Lessons, opportunities and risks (Section 5): no new prerequisites.
Check yourself
QuestionThe joint-embedding loss uses a stop-gradient on the encoding of the next observation. What would go wrong without it?Show answer
QuestionWith expected steps after action repeat, what discount does the paper's heuristic give?Show answer
QuestionWhy does the planner add the learned value to the sum of rewards over the horizon?Show answer
QuestionA team wants to run TD-MPC2 on a robot whose action dimension is larger than any training task. Based on the paper's design, what should they check first?Show answer
Sources
- TD-MPC2: Scalable, Robust World Models for Continuous Control (Hansen et al., 2023)
- Project page with models, data and code (tdmpc2.com)
- Learning Latent Dynamics for Planning from Pixels (Hafner et al., 2018)
- Mish: A Self Regularized Non-Monotonic Activation Function (Misra, 2019)
- Model predictive control (Wikipedia)