Search arXiv⌕ Search

arXiv · 2610.04569

From Transformers to Weighted Automata: Towards the Verification of Large Language Models

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.

Explore related subjects

Keep this discovery

Explore connections, maps & timelines

BibTeXRIS

Smayan Agarwal, Aslah Ahmad Faizi, Shobhit Singh, Aalok Thakkar. 2026-10-03. From Transformers to Weighted Automata: Towards the Verification of Large Language Models. https://doi.org/10.1007/978-3-032-25552-5_10. https://searcharxiv.org/abs/2610.04569

Citations retain the original authors and DOI and include this site’s record URL. If this discovery service contributed to your research, you can also cite Search arXiv by Indiciae: BibTeX · RIS.

KEEP EXPLORING

Related papers

Star Complexity of Parikh Images of Languages over Infinite Alphabets

Parikh's theorem identifies the commutative images of regular and context-free languages over finite alphabets. We study the commutative images of quasi-regular and quasi-context-free languages over infinite alphabets, these are the languages that are accepted by the corresponding automata models augmented with registers. Over finite alphabets commutative images of regular languages are known to be precisely the semilinear sets, over infinite alphabets the corresponding algebraic sets are called rational sets of data vectors. In contrast to semilinear sets, nesting stars in rational sets add expressive power and thus star-height is a measure of complexity for this sets. It was previously established that languages accepted by one-register automata or one-register binary branching context-free grammars have rational commutative images. We refine this result by proving that the star-height of the commutative image of any one-register automaton is at most two. Using this extension, we prove rationality for all one-register context-free grammars, with arbitrary branching degree. Furthermore, we show that quasi-regular languages can have irrational commutative images already for a language accepted by a three-register automaton. Finally, we show that quasi-context-free languages can have commutative images that are different from the commutative image of any quasi-regular language, where the separation is witnessed again with three registers. Thus we conclude that Parikh's theorem fails over infinite alphabets for automata with registers.

cs.FL↗

Locally eventually onto cellular automata

We give a new checkable criterion to ensure that a one-dimensional cellular automaton on a finite alphabet is open and locally eventually onto. In this setting, openness is equivalent to being n-to-1 for some n and therefore implies surjectivity. Bipermutive cellular automata are known to be open and locally eventually onto, while open cellular automata that are neither bipermutive nor bijective appear to have received less attention. Building on Sutner's work with de Bruijn graphs, we describe a method for deciding openness and at the same time determining n. We then introduce the notion of block-regularity of local rules as a generalization of bipermutivity and prove that it implies openness. We further identify two conditions that, together with block-regularity, ensure that every nonempty cylinder set is mapped onto the whole configuration space after a finite number of iterations, and hence that the cellular automaton is open and locally eventually onto. The appendix provides the algorithms that check these finite criteria and then presents examples of open, locally eventually onto, non-bipermutive cellular automata for small diameters.

cs.FL↗

Complete Test Suites for Effectful Automata

Complete test suites for automata are (finite) sets of words that enable testing an implementation against a specification: when a (black-box) automaton passes the test suite, completeness guarantees that it is equivalent to the specification on all (infinitely many) words. A well-known method for constructing complete test suites for deterministic automata is the W-method, used in conformance testing and automata learning. Based on a recent categorical generalisation of the W-method, we propose a framework for~the construction and analysis of test suites for a certain class of effectful automata defined by commutative monads. By working in the Eilenberg-Moore category of the associated monad at hand, we obtain a generic notion of effectful W-method, together with a completeness theorem. We show how to apply the framework and derive complete test suites for non-deterministic and weighted automata.

cs.FL↗