Profile

Settings

Loading…

← Papers

Help

FAQ

Which features require signing in?

You can read the commentary, paper info, Model Structure and related papers of public papers without signing in. Sign in to manage your account or contact us about your inquiries.

Can I upload a PDF file?

Upload papers with an arXiv or DOI link; the commentary is public to everyone. Papers whose source and terms of use can't be verified, so the commentary can't be made public, can't be uploaded. Uploading PDF files and keeping papers private are for subscribers only, and a paper uploaded as a file is saved as private only. Searching for official info by title runs only when you press the button.

Are the figures and AI commentary accurate?

Figures come only from the original paper, and only those whose terms of use are verified are shown. The commentary is written by AI and may be wrong. Check important claims, numbers and figure context against the evidence in the original paper.

I want to report a copyright issue.

Terms of use and the source of the original paper are on the Paper info tab. If there's a problem, choose "Paper content, figures and copyright" under Contact us and send the paper link, the part in question, and evidence that you hold the rights. Receiving your report doesn't confirm any rights or remove anything right away. You can see the result of the review under My inquiries.

I forgot my password.

If you signed up with email, use Forgot password in the sign-in window to reset it with your verified email. If you signed up with Google, Naver or Kakao, change your password with that service.

What should I include in an inquiry?

Tell us which screen you were on and what you were doing when the problem happened, along with the paper link. Don't include personal information such as passwords, API keys, verification codes or phone numbers. Inquiries and replies are stored in Refivu and you can see them under My inquiries.

How do I delete my account?

In Settings, under My account, press Delete account. Review what will be deleted and complete identity verification to delete your account. For other requests, choose "Account" under Contact us.

Paper commentary

Improving Transformer World Models for Data-Efficient RL

Warmup and tokenizer changes let transformer world models learn Craftax faster

  • Problem Model-based RL with transformer world models has lagged behind model-free agents, because early in training the world model is too inaccurate to supply useful imagined data. Mixing imagined data in from the start hurts policy learning.
  • Method Warmup delays imagined data, and a fixed-code tokenizer gives a stable target.
  • Results The best agent reaches a reward of 69.66% on Craftax-classic after 1M environment steps. DreamerV3 reaches 53.2% on the same benchmark.

Figure 5: | [Left] MBRL performance decreases when NNT uses patches of smaller or larger size than
the ground truth, but it remains competitive. However, perfo…

Figure 5 | [Left] MBRL performance decreases when NNT uses patches of smaller or larger size than the ground truth, but it remains competitive. However, performance collapses if the patches are not quantized. [Middle] Removing any rung of the ladder of improvements leads to a drop in performance. [Right] Warming up the world model before using it to train the policy on imaginary rollouts is required for good performance. BP denotes background planning. For each method, training in imagination starts at the color-coded vertical line, and leads to an initial drop in performance.

Original paper · CC BY 4.0 · Antoine Dedieu, Joseph Ortiz, Xinghua Lou, Carter Wendelken, Wolfgang Lehrach, J Swaroop Guntupalli, Miguel Lazaro-Gredilla, Kevin Patrick Murphy · Improving Transformer World Models for Data-Efficient RL · Original paper figure · Extracted the figure area from page 10 of the original PDF.

Why sample efficiency is hard on Craftax-classic

Model-free reinforcement learning maps observations straight to actions, and that usually needs a lot of environment data. Model-based RL learns a world model and plans in imagination, which is meant to cut that data need. Each observation is a 63×63 pixel local view split into a grid of 9×9 patches of 7×7 pixels. The agent only sees this local view, plus a visualization of its inventory, so it never observes the full world.

Figure 1: | [Left] Reward on Craftax-classic. Our best MBRL and MFRL agents outperform all the
previously published MFRL and MBRL results, and for the first ti…

Figure 1 | [Left] Reward on Craftax-classic. Our best MBRL and MFRL agents outperform all the previously published MFRL and MBRL results, and for the first time, surpass the reward achieved by a human expert. We display published methods which report the reward at 1M steps with horizontal line from 900k to 1M steps. [Middle] The Craftax-classic observation is a63× 63 pixel image, composed of9× 9 patches of 7× 7 pixels. The observation shows the map around the agent and the agent’s health and inventory. Here we have rendered the image at144× 144 pixels for visibility. [Right] 64 different patches.

Original paper · CC BY 4.0

The environment is procedurally generated, so each episode gives the agent a new map sampled from a common distribution. Its achievement hierarchy gives a sparse reward signal, which forces the agent to explore deeply and broadly before it learns much. Earlier model-based agents such as IRIS and DreamerV3 train their policy only on imagined trajectories.

DreamerV3 held the previous best reward of 53.20% on this benchmark, and the previous best score was 19.4%. So the question is whether a transformer world model can supply enough useful data to beat that level within 1M environment steps.

Those numbers show that a transformer world model alone does not close the gap to the stronger model-free baseline.

Real data plus delayed imagination

The method keeps the policy learning from real environment experience while it also learns from imagined rollouts. The authors call this scheme Dyna with warmup, because imagined data enters training only after a delay. Each iteration first collects real trajectories and updates the policy on them with PPO. The world model is then updated on replayed trajectories sampled from the data buffer.

Only after the warmup does the policy get updated on rollouts generated inside the world model. Because PPO is on-policy, the real-data update has to happen right after collection, which is why it sits in Step 2. The authors note that an off-policy algorithm could mix real and imaginary data instead, but they leave that as future work.

The warmup exists because an inaccurate world model can harm policy learning when imagined data is mixed in early. The authors set the warmup at T_BP = 200k environment steps in the main runs. Removing the warmup and starting imagined training at once, with T_BP = 0, drops the reward from 67.42% to 33.54%. Removing Dyna altogether and training only in imagination drops the reward to 55.02%.

Both parts of the scheme therefore carry weight in the final result.

Dyna is the classic scheme where a learned model generates extra training data for the policy. The authors view the world model here as a form of generative data augmentation. Their version differs from Dyna by adding a delay before the imagined part starts. They also keep the rollout horizon short, with T_WM much smaller than T_env, to limit compounding model errors.

When imagined training begins at step 200k, the reward dips temporarily in the authors' runs. The dip happens because the TWM rollouts don't yet match the true environment dynamics, shifting the policy's inputs. The authors later report that annealing the number of imagined policy updates removes this drop.

How one training iteration runs

Each iteration starts by collecting trajectories from the environment and storing them in a data buffer D. The policy is then updated with PPO on those real trajectories, in Step 2, right after the data is collected. PPO is on-policy, so it needs trajectories that are close to the current policy. Next, the world model is trained for N_iters^WM updates, each on trajectories sampled from the buffer D.

The authors update the TWM 500 times per iteration, so the world model sees the real data before any imagination starts.

Imagined data enters only in Step 4, and only once the step count t reaches T_BP. Each imagined update samples starting observations from the buffer D, and the policy rolls out inside the world model. These rollouts have length T_WM, which is 20 for the Craftax-classic experiments. The authors set T_WM much smaller than T_env to limit compounding errors from model imperfections.

They found a T_WM of 1 no better than MFRL with experience replay, so they use a longer horizon.

The policy is updated on imagined trajectories N_iters^AC times, with 150 updates in the main runs. The authors left out an off-policy alternative that would mix real and imaginary data in Step 4 and remove Step 2. The loop repeats until the total number of environment steps T_total is reached, which is 1M in Craftax-classic.

Patch tokenizer: encoding each patch on its own

Most prior MBRL methods pass the whole image through a CNN and quantize the feature map jointly with a VQ-VAE. The authors instead split each observation into patches and encode every patch independently into its own token. On Craftax-classic each observation has 81 patches, so the tokenizer produces L = 81 tokens per observation. Decoding works in reverse: each token is decoded into a patch on its own, and the patches are rearranged into a full image.

Factorizing the VQ-VAE over these 81 patches lifts the reward from 43.36% to 58.92%.

The nearest-neighbor tokenizer, which the authors call NNT, encodes each patch by finding its closest codebook entry in squared Euclidean distance. If the closest entry is farther than the threshold tau, the patch itself becomes a new code in the codebook. Decoding simply returns the codebook entry at the given index, so no decoder network is needed.

Existing codebook entries are never updated after they are added, so the target the world model learns stays fixed. A VQ-VAE codebook keeps changing during training, so the world model must learn from a non-stationary distribution.

With patch factorization, replacing the VQ-VAE with NNT lifts the reward from 58.92% to 64.96%. For M4 and M5, which use NNT, the authors found a codebook size of 4096 and a threshold of 0.75 critical. Patch size matters for this tokenizer, and the paper's ablation shows performance drops with 5x5 or 9x9 patches.

Block teacher forcing for next-step tokens

Standard teacher forcing predicts each token from the ground-truth earlier tokens over time and within a timestep, so tokens of one step come out in sequence. Block teacher forcing drops the conditioning on tokens of the current step and predicts all next-step tokens from the previous timesteps alone. A block causal attention pattern lets tokens of the same timestep attend to each other, so the model reasons jointly before it samples them in parallel.

The authors say this property mitigates autoregressive drift, because the tokens of a timestep are sampled with independent readouts.

BTF predicts the next timestep's tokens independently, so the training objective factorizes over the tokens of each timestep. Standard teacher forcing and BTF both maximize a log likelihood, but BTF conditions only on the history and the actions.

The authors report that BTF returns more accurate world models than fully autoregressive training. BTF also ran about twice as fast, even though with key-value caching both schemes have the same theoretical complexity. Both schemes have complexity O(L²T) for one timestep and O(L²T²) for the entire rollout.

Does the ladder hold up on Craftax-classic

Adding Dyna to the baseline lifts the reward to 43.36%, since the policy trains on both real and imagined trajectories. The patch factorization splits each observation into non-overlapping patches and encodes each patch into its own token, so the tokenizer works per patch.

Replacing the VQ-VAE with the nearest-neighbor tokenizer raises the reward from 58.92% to 64.96%, with patch factorization already in place. The nearest-neighbor tokenizer adds a new code whenever the nearest codebook entry is farther than a threshold, and stored codes are never updated. A static codebook gives the TWM a stationary target, whereas the VQ-VAE codebook keeps changing and makes learning harder.

The authors found that a codebook size of 4096 and a threshold of 0.75 were critical for the nearest-neighbor tokenizer. BTF runs about twice as fast as the autoregressive approach, which cuts the training time of that agent.

That slow run took about 2 days of training, so the authors left it out of their ablations and comparisons.

Ablations on warmup, tokenizer and BTF

Removing the warmup is the clearest test of when imagined training should start, and it hurts a lot. Setting the background planning starting step to zero drops the reward from 67.42% to 33.54%. The authors trained the policy on imagined rollouts from the start, so the world model was not yet accurate enough. Removing the Dyna method and training only in imagination drops the reward to 55.02%.

The main runs start imagined training at 200k environment steps, and the reward dips briefly when it begins. The rollouts don't initially match the true environment dynamics, so the policy sees a distribution shift. Figure 5 shows that starting background planning too early, at 0k, causes the same kind of collapse.

The tokenizer changes are the other rungs that the authors ablated against the best MBRL agent.

The authors also checked the MFRL changes, since they are part of the ladder. These results suggest that every component of the MBRL agent contributes to its state-of-the-art reward.

Do the rollouts stay faithful to the true symbols

The authors measure rollout faithfulness by training a CNN to read ground truth symbols from observations. Given a TWM checkpoint at 1M steps, each world model replays the actions of a trajectory from its starting observation. Symbol accuracy is then averaged over rollout timesteps, with each symbol compared against its ground truth value.

Symbol accuracy falls with rollout step for all three world models, because mistakes compound over the rollouts. The NNT-based M5 reaches the highest symbol accuracy at every rollout timestep, as the figure shows for horizons 5 to 20. The authors attribute this to the stationary NNT codebook, which makes the TWM target distribution simpler to learn.

M5 also has the lowest tokenizer and rollout reconstruction errors among the compared models in Appendix D.

Qualitatively, the rollouts show map inconsistencies, feasible hallucinations and infeasible hallucinations. M1 makes simple map errors in successive timesteps, and it incorrectly adds wood to the inventory. M3 and M5 both generate feasible hallucinations, such as spawning mobs and losing health. M3 still shows infeasible hallucinations, such as a monster that suddenly disappears, while M5 rarely shows them.

Results beyond Craftax-classic

The score values for the previous SOTA agents are unknown, so only reward is compared.

On MinAtar, the authors test the same ideas on four simplified Atari 2600 games with symbolic binary observations. They tune the MFRL agent first, then build the MBRL agent by integrating the three proposed improvements, keeping most Craftax-classic hyperparameters. The authors compare these runs against the Artificial Dopamine agent (AD) of Guan et al., 2024, using results shared by the authors.

For the two-player games, the authors use three OpenSpiel games: Tic-Tac-Toe, Bargaining and Leduc Poker. Tic-Tac-Toe is fully observed with deterministic dynamics, whereas Bargaining and Leduc Poker are partially observed and stochastic. To keep the world model simple, the authors turn stochastic dynamics into deterministic ones with a chance player.

The TWM predicts rewards, terminations, next observations, next player IDs, legal actions and chance probabilities for both players. Policy training in imagination keeps only the agent's predicted observations and discards the opponent's.

Figure 10: | By leveraging a multiplayer TWM, our MBRL agents achieve higher rewards than our
MFRL agents across three two-player games, illustrating the gener…

Figure 10 | By leveraging a multiplayer TWM, our MBRL agents achieve higher rewards than our MFRL agents across three two-player games, illustrating the generality of our approach.

Original paper · CC BY 4.0

The authors use 100k actions in total for both players, and they start imagination training at 0 steps. The MBRL agents achieve higher rewards than the MFRL agents on all three games, averaged over 10 seeds. The gap is largest early in training, which the authors read as evidence that a TWM can be learned from tens of thousands of interactions.

Limitations of the transformer world model approach

The authors name two main disadvantages of their patch tokenizer, and both depend on the input structure. NNT may build a large codebook when appearance varies a lot within patches. The authors expect this to stay mild in Craftax-classic because of its grid structure and limited sprite vocabulary. Continuous variations from lighting and texture randomness still exist, so the codebook can still grow.

The codebook size is also a practical constraint for the NNT variants. For M4 and M5, the authors found it critical to use a codebook size of 4096 with a threshold of 0.75. The slow variant trains its world model for 4k steps, which takes about 2 days. Because of that training time, the authors left the slow agent out of the ablation and comparison studies.

Training in imagination also causes a temporary drop in performance at step 200k.

All tested environments are grid worlds, and the authors plan to examine generalization beyond them. They didn't test non-grid environments in this work. Prioritized experience replay is named as a promising way to speed up TWM training, but it isn't tested here. An off-policy RL algorithm that mixes imagined and real data is also named as future work.

Pre-trained tokenizers such as SAM and Dino-V2 are proposed as a longer-term direction, not as a tested method.

Paper info

Authors
Antoine Dedieu, Joseph Ortiz, Xinghua Lou, Carter Wendelken, Wolfgang Lehrach, J Swaroop Guntupalli, Miguel Lazaro-Gredilla, Kevin Patrick Murphy
Venue
arXiv · Preprint
First published
2025-2-3
Added
2026-10-31
Updated
2025-7-16
Version
v3
arXiv
2502.01591
Category
cs.LG · cs.AI
Original paper terms
CC BY 4.0
What we show
Paper info, commentary and permitted figures from the original paper

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

Abstract

We present three improvements to the standard model-based RL paradigm based on transformers: (a) "Dyna with warmup", which trains the policy on real and imaginary data, but only starts using imaginary data after the world model has been sufficiently trained; (b) "nearest neighbor tokenizer" for image patches, which improves upon previous tokenization schemes, which are needed when using a transformer world model (TWM), by ensuring the code words are static after creation, thus providing a constant target for TWM learning; and (c) "block teacher forcing", which allows the TWM to reason jointly about the future tokens of the next timestep, instead of generating them sequentially. We then show that our method significantly improves upon prior methods in various environments. We mostly focus on the challenging Craftax-classic benchmark, where our method achieves a reward of 69.66% after only 1M environment steps, significantly outperforming DreamerV3, which achieves 53.2%, and exceeding human performance of 65.0% for the first time. We also show preliminary results on Craftax-full, MinAtar, and three different two-player games, to illustrate the generality of the approach.

Quote from the paper

Antoine Dedieu, Joseph Ortiz, Xinghua Lou, Carter Wendelken, Wolfgang Lehrach, J Swaroop Guntupalli, Miguel Lazaro-Gredilla, Kevin Patrick Murphy (2025). Improving Transformer World Models for Data-Efficient RL. arXiv:2502.01591v3. https://arxiv.org/abs/2502.01591v3

BibTeX
@misc{dedieu2025improving,
  title = {{Improving Transformer World Models for Data-Efficient RL}},
  author = {Antoine Dedieu and Joseph Ortiz and Xinghua Lou and Carter Wendelken and Wolfgang Lehrach and J Swaroop Guntupalli and Miguel Lazaro-Gredilla and Kevin Patrick Murphy},
  year = {2025},
  eprint = {2502.01591},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.01591v3}
}

See related papersBrowse other papers

Paper preview
Account security

Connect Google account

If you connect a Google account, you can sign in with it too.

Refivu

Delete account

Refivu
Refivu

Sign up