Transformer Encoder Satisfiability: Complexity and Impact on Formal Reasoning
Marco Sälzer, Eric Alsmann, Martin Lange
TL;DR
The paper investigates the satisfiability problem for transformer encoders ($\textsc{trSat}$), revealing undecidability for natural TE classes and exploring decidable regimes. It shows that $\textsc{trSat}$ is undecidable for encoder-only TE in expressiveness-lean classes and identifies two main decidability avenues: bounding input length and employing fixed-width (quantized) arithmetic. The authors provide precise complexity bounds, including $\textsc{btrSat}$ being $\text{NP}$ (unary) or $\text{NEXPTIME}$ (binary) and $\textsc{trSat}$ under fixed-width periodic embeddings falling in $\text{NEXPTIME}$ with corresponding hardness results for broader fixed-width settings. These findings delineate theoretical limits for automatic, sound, and complete formal reasoning about transformers and point to future work on softmax, embedding interactions, and practical fixed-width refinements.
Abstract
We analyse the complexity of the satisfiability problem, or similarly feasibility problem, (trSAT) for transformer encoders (TE), which naturally occurs in formal verification or interpretation, collectively referred to as formal reasoning. We find that trSAT is undecidable when considering TE as they are commonly studied in the expressiveness community. Furthermore, we identify practical scenarios where trSAT is decidable and establish corresponding complexity bounds. Beyond trivial cases, we find that quantized TE, those restricted by fixed-width arithmetic, lead to the decidability of trSAT due to their limited attention capabilities. However, the problem remains difficult, as we establish scenarios where trSAT is NEXPTIME-hard and others where it is solvable in NEXPTIME for quantized TE. To complement our complexity results, we place our findings and their implications in the broader context of formal reasoning.
