cs.LGOct 18, 2026

Learning When to Abort in Transformer Planning: A Mechanistic Study

Authors: Shi Feng, Qimin Zhong, Siwei Wang, Yifei Shen, Shang-Hua Teng, Hao Liao, Wei Chen

Organizations: Harvard University · Shenzhen University · Microsoft Research Asia · University of Southern California

Abstract

Planning does not by itself imply the ability to recognise errors, but recognising errors can improve planning capacity. In this paper, we study this phenomenon in Transformer planning. To analyze the inner mechanism, we follow the approach of Wang et al. (2024) and abstract planning as path-finding in graphs. In this setting, we train the model to detect the error of invalid transitions, i.e., after the model generates a next node that is not adjacent with the current node, the model should then generate a special abort token x. For expressiveness, we construct a Transformer with feed-forward width O(∣V∣)O(|V|) for any fixed graph with node set VV. It can detect all possible invalid transitions, and select a valid next node if the prefix is valid. We then propose a worst-case lower bound on feed-forward width, which makes the detector's linear width near-optimal up to logarithmic factors. In trained models, we demonstrate that invalid-transition detection increases previous-node attention, and most of the valid--invalid separation locates in the feed-forward network's output. This accords with our theoretical insights. Finally, we use this error detection to improve the model's performance: at inference, generating the abort token x will directly cause an external procedure to discard the attempt and restart from the original prompt. Experiments show that error detection combined with retry improves model's planning reliability on graphs, Countdown, and mazes.

Figures & tables

Appendix figures & tables7 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. On the Ability of Transformers to Verify Plans

    Mar 20, 2026Yash Sarrof, Yupei Du, Katharina Stein +3TransformerSymbolic Planning

  2. Symmetry-Aware Transformer Training for Automated Planning

    Aug 11, 2025Markus Fritzsche, Elliot Gestrin, Jendrik SeippContrastive LearningTransformer

  3. On Sample-Efficient Generalized Planning via Learned Transition Models

    Feb 26, 2026Nitin Gupta, Vishal Pallagani, John A. Aydin +1Model-Based PlanningOOD Generalization