Transformers Can Navigate Mazes With Multi-Step Prediction
Not on the map. Why?
Abstract (arXiv)
Despite their remarkable success in language modeling, transformers trained to predict the next token in a sequence struggle with long-term planning. This limitation is particularly evident in tasks requiring foresight to plan multiple steps ahead such as maze navigation. The standard next single token prediction objective, however, offers no explicit mechanism to predict multiple steps ahead - or revisit the path taken so far. Consequently, in this work we study whether explicitly predicting multiple steps ahead (and backwards) can improve transformers' maze navigation. We train parameter-matched transformers from scratch, under identical settings, to navigate mazes of varying types and sizes with standard next token prediction and MLM-U, an objective explicitly predicting multiple steps ahead and backwards. We find that MLM-U considerably improves transformers' ability to navigate mazes compared to standard next token prediction across maze types and complexities. We also find MLM-U training is 4x more sample efficient and converges 2x faster in terms of GPU training hours relative to next token training. Finally, for more complex mazes we find MLM-U benefits from scaling to larger transformers. Remarkably, we find transformers trained with MLM-U outperform larger transformers trained with next token prediction using additional supervision from A* search traces. We hope these findings underscore the promise of learning objectives to advance transformers' capacity for long-term planning. The code can be found at https://github.com/facebookresearch/maze_navigation_MLMU
Key facts. Cited by 11 papers in the map (data through 14 Oct 2026). Builds on 23 of its 28 references that are in the map. First posted on arXiv 6 Dec 2024.
Builds on
23 of 28 references.
References · 23
- 2017Attention Is All You Needcited by 60,361
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2024The Llama 3 Herd of Modelscited by 14,715
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,703
- 2022Planning with Diffusion for Flexible Behavior Synthesiscited by 1,061
- 2022Diffusion-LM Improves Controllable Text Generationcited by 1,027
- 2024Gemma: Open Models Based on Gemini Research and Technologycited by 916
- 2024Simple and Effective Masked Diffusion Language Modelscited by 848
- 2024Simplified and Generalized Masked Diffusion for Discrete Datacited by 626
- 2023The Reversal Curse: LLMs trained on "A is B" fail to learn "B is A"cited by 407
- 2024Better & Faster Large Language Models via Multi-token Predictioncited by 360
- 2022DiffusionBERT: Improving Generative Masked Language Models with Diffusion Modelscited by 214
11 more
- 2024The pitfalls of next-token predictioncited by 160
- 2024Beyond A*: Better Planning with Transformers via Search Dynamics Bootstrappingcited by 90
- 2023A Configurable Library for Generating and Manipulating Maze Datasetscited by 31
- 2024The Factorization Curse: Which Tokens You Predict Underlie the Reversal Curse and Morecited by 25
- 2024NavFormer: A Transformer Architecture for Robot Target-Driven Navigation in Unknown and Dynamic Environmentscited by 20
- 2024ALPINE: Unveiling the Planning Capability of Autoregressive Learning in Language Modelscited by 18
- 2023Structured World Representations in Maze-Solving Transformerscited by 16
- 2023DiSK: A Diffusion Model for Structured Knowledgecited by 16
- 2024Latent Plan Transformer for Trajectory Abstraction: Planning as Latent Space Inferencecited by 14
- 2023Investigating Navigation Strategies in the Morris Water Maze through Deep Reinforcement Learningcited by 3
- 2024Scaling Value Iteration Networks to 5000 Layers for Extreme Long-Term Planningcited by 3
Built on by
Citing papers per year: 2025: 7; 2026: 4.
11 papers.
- 2025Accelerated Sampling from Masked Diffusion Models via Entropy Bounded Unmaskingcited by 131
- 2025Roll the dice & look before you leap: Going beyond the creative limits of next-token predictioncited by 29
- 2025Empirical Analysis of Decoding Biases in Masked Diffusion Modelscited by 19
- 2025Optimizing Decoding Paths in Masked Diffusion Models by Quantifying Uncertaintycited by 6
- 2025Looking beyond the next tokencited by 5
- 2026Transformers in the Dark: Navigating Unknown Search Spaces via Bandit Feedbackcited by 2
- 2026Do LLMs Build Spatial World Models? Evidence from Grid-World Maze Taskscited by 2
- 2026Zipping the Thought: When and How Compressed Reasoning Data Works in LLM Post-Trainingcited by 2
- 2025Cognitive Maps in Language Models: A Mechanistic Analysis of Spatial Planningcited by 1
- 2026Lookahead Path Likelihood Optimization for Diffusion LLMscited by 1
- 2025Constraints-Guided Diffusion Reasoner for Neuro-Symbolic Learningcited by 0
- 2026Zipping the Thought: When and How Compressed Reasoning Data Works in LLM Post-Training27 May 2026
- 2026Do LLMs Build Spatial World Models? Evidence from Grid-World Maze Tasks12 Apr 2026
- 2026Transformers in the Dark: Navigating Unknown Search Spaces via Bandit Feedback25 Mar 2026
- 2026Lookahead Path Likelihood Optimization for Diffusion LLMs3 Feb 2026
- 2025Optimizing Decoding Paths in Masked Diffusion Models by Quantifying Uncertainty24 Dec 2025
- 2025Cognitive Maps in Language Models: A Mechanistic Analysis of Spatial Planning17 Nov 2025
- 2025Constraints-Guided Diffusion Reasoner for Neuro-Symbolic Learning22 Aug 2025
- 2025Empirical Analysis of Decoding Biases in Masked Diffusion Models18 Aug 2025
- 2025Accelerated Sampling from Masked Diffusion Models via Entropy Bounded Unmasking30 May 2025
- 2025Roll the dice & look before you leap: Going beyond the creative limits of next-token prediction21 Apr 2025
- 2025Looking beyond the next token15 Apr 2025