Provably Overwhelming Transformer Models with Designed Inputs
Lev Stambler, Seyed Sajjad Nezhadi, Matthew Coudron
TL;DR
This work introduces the notion of \'overwhelming\' for trained transformers, wherein a fixed input prefix $s$ and final token $q$ yield outputs invariant to free suffixes $t$ of length up to $n_{free}$. It develops a two-stage, rigorous framework based on worst-case deviation $\mathcal{W}$ and peak-to-peak difference $PTP$, plus practical algorithms to certify overwhelm for a given model, input prefix, and context length; it further refines bounds under permutation-invariant inputs using LP relaxations. The authors demonstrate the approach on a concrete single-layer, decoder-style transformer with RoPE, LN, and an MLP, providing both theoretical bounds and empirical validation on the AG News dataset with various input-restriction scenarios; they show that overcoming $W$ relative to $PTP$ certifies that the next-token output is fixed regardless of allowable free tokens. This work is a stepping stone toward provable guarantees for trained transformers, with potential applications in safety evaluations, prompt-engineering no-go results, and the study of model complexity in constrained contexts.
Abstract
We develop an algorithm which, given a trained transformer model $\mathcal{M}$ as input, as well as a string of tokens $s$ of length $n_{fix}$ and an integer $n_{free}$, can generate a mathematical proof that $\mathcal{M}$ is ``overwhelmed'' by $s$, in time and space $\widetilde{O}(n_{fix}^2 + n_{free}^3)$. We say that $\mathcal{M}$ is ``overwhelmed'' by $s$ when the output of the model evaluated on this string plus any additional string $t$, $\mathcal{M}(s + t)$, is completely insensitive to the value of the string $t$ whenever length($t$) $\leq n_{free}$. Along the way, we prove a particularly strong worst-case form of ``over-squashing'', which we use to bound the model's behavior. Our technique uses computer-aided proofs to establish this type of operationally relevant guarantee about transformer models. We empirically test our algorithm on a single layer transformer complete with an attention head, layer-norm, MLP/ReLU layers, and RoPE positional encoding. We believe that this work is a stepping stone towards the difficult task of obtaining useful guarantees for trained transformer models.
