From Transformers to Weighted Automata: Towards the Verification of Large Language Models
Smayan Agarwal, Aslah Ahmad Faizi, Shobhit Singh, Aalok Thakkar
Abstract
Large language models (LLMs) are increasingly deployed in safety-critical settings, yet their black-box nature makes it difficult to provide formal guaranties about their behavior. Existing verification approaches rely primarily on empirical probing and testing, leaving open the question of how to reason rigorously about general-purpose trans- former architectures. In this work, we establish a principled bridge between transformers and weighted automata, a classical model from formal language theory. This connection enables us to transfer verification tools from automata the- ory to the analysis of LLMs. Our contributions are twofold: First, we develop a formal correspondence between transformer architectures and weighted automata over reals, showing how distributional properties of LLMs can be captured within this framework. Second, we introduce an identity testing algorithm for weighted automata that provides a statis- tical method for distinguishing whether two stochastic models define the same distribution up to a tolerance threshold. This work provides the first formal bridge between modern neural se- quence models and classical automata theory, clarifying both the poten- tial and the computational challenges for rigorous LLM verification.
Create a lesson
Related papers
Automata-Theoretic Verification of Interval Markov Decision Processes
Shared title terminology · Sarvin Bahmani, Soumyajit Paul, Sven Schewe et al.
Weighted Alternating Tree Automata
Shared title terminology · Olle Torstensson
The Value Generating Power of Weighted Tree Automata with Initial Algebra Semantics
Shared title terminology · Manfred Droste, Zoltán Fülöp, Andreja Tepavčević et al.
Proceedings 17th International Conference on Automata and Formal Languages
Shared title terminology · Michal Hospodár, Galina Jirásková, Viktor Olejár et al.
A detailed verification of Neary's PCP(5) construction
Shared title terminology · Vesa Halava
Decision trees for subword-closed languages over arbitrary finite alphabets
Shared title terminology · Shahid Hussain