On the Ability of Transformers to Verify Plans

Yash Sarrof, Yupei Du, Katharina Stein, Alexander Koller, Sylvie Thiebaux, Michael Hahn

Large Language Models (LLMs) have demonstrated a frustratingly inconsistent ability to handle AI planning tasks. While they can occasionally generate or verify simple plans, they frequently "lose the thread" as plans grow longer or the number of objects in the environment increases. This phenomenon, known as the length generalization problem, has largely been studied empirically.

This paper provides a much-needed theoretical foundation for understanding when Transformers can—and cannot—verify AI plans. By focusing specifically on plan verification (deciding if a given sequence of actions correctly achieves a goal from an initial state), the authors identify the structural reasons why Transformers succeed in some planning domains but fail in others.

Theoretical Framework: Introducing C*-RASP

To analyze the internal computations of Transformers, the authors build upon C-RASP (Counting RASP), a domain-specific formal language designed to mirror Transformer operations like attention and counting. However, standard C-RASP assumes a fixed vocabulary. In real-world planning, the number of objects—and thus the effective input alphabet—grows at test time.

To address this, the authors introduce C*-RASP, which incorporates a "Match Predicate" allowing the model to reason about an effectively infinite or growing set of objects. They pair this with a theoretical model called Symbolic Limit Transformers, which satisfies translation invariance (ignoring absolute positions or specific object IDs) and locality. This framework proves that if a task can be expressed in C*-RASP, a Transformer can theoretically learn to solve it for any sequence length.

To bridge this theory with practical training, the authors employ an "offset trick." By randomly shifting starting positions and object IDs during training, they force the model to learn generalized rules rather than memorizing specific indices.

The Crucial Role of Domain Structure

The core insight of the paper is that a domain's learnability is dictated not by its sheer complexity or object count, but by the structural nature of its state transitions. The authors identify three key structural paradigms:

  • Counting is Key (Well-Formed Domains): Transformers are surprisingly adept at counting. In "well-formed" domains, a proposition's truth value toggles every time an action affects it. To verify the final state, the Transformer simply needs to count how many times that proposition was toggled. Because counting is natively expressible in C-RASP, models generalize perfectly to longer sequences.
  • The "FlipFlop" Barrier (STRIPS Domains): In general STRIPS planning, determining a state requires knowing the last action that affected a specific proposition. Mathematically, this is equivalent to the "FlipFlop" formal language, which is notoriously difficult for Transformers to generalize across varying lengths.
  • The Parity Problem (Conditional Effects): Domains with conditional effects (where an action's result depends on the current state) often reduce to the PARITY problem (e.g., determining if the number of a specific token is even or odd). Theoretical work has already established that standard Transformers struggle to generalize PARITY to longer sequences.

Empirical Validation

To test these theoretical boundaries, the authors developed three custom domains—Heavy Grippers, Colors, and Lights Out—and evaluated models across different structural variants. The empirical results mirrored the theory with striking clarity:

  • Complete Success: In "Well-Formed" and "Delete-Free" variants of the Grippers and Colors domains, the models achieved near 100% accuracy on plans twice as long as those seen in training, even when introducing more objects.
  • Significant Degradation: In the standard STRIPS version of the Colors domain, performance dropped sharply as plan length increased, validating the FlipFlop barrier.
  • Total Collapse: In the "Conditional Effects" version of Lights Out, the model remained at chance-level accuracy (50%), failing to learn the underlying logic. However, when the exact same problem was "compiled" into a well-formed version (by creating separate, explicit actions for every state combination), the Transformer learned it perfectly.

Limitations and Future Directions

While these findings offer a robust roadmap for plan verification, the authors note several limitations. First, the paper focuses strictly on verifying plans, which is computationally easier (P-complete) than generating them (PSPACE-complete). Success in verification does not guarantee success in generation. Second, the study evaluates standard decoder-only Transformers without "scratchpads" or "Chain of Thought" prompting, which might bypass theoretical limits by breaking hard problems into smaller, countable steps. Finally, the current theory applies to Absolute Positional Encodings (APE), leaving the extension to modern Rotary Positional Encodings (RoPE) as a logical next step.

Ultimately, by identifying "well-formedness" as a green light for Transformer learning, this research provides a concrete criterion for engineers determining whether an LLM is the right tool for a specific automation or planning task.

Summary updated

BibTeX
@inproceedings{sarrof2026ability,
  author = {Yash Sarrof and Yupei Du and Katharina Stein and Alexander Koller and Sylvie Thiebaux and Michael Hahn},
  title = {{On the Ability of Transformers to Verify Plans}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=KmOje8ebAg},
}
Figure