From Transformers to Weighted Automata: Towards the Verification of Large Language Models
cs.FL, cs.LG
Submitted: 2026-10-03
Updated: 2026-10-03
Journal ref: DATAMOD 2025
DOI: 10.1007/978-3-032-25552-5_10
License: http://creativecommons.org/licenses/by/4.0/
The gist: 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.
Terminology
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.
Sources
- Masked Hard-Attention Transformers Recognize Exactly the Star-Free Languages
- On the Frame-Stewart Conjecture
- Forget What You Know about LLMs Evaluations -- LLMs are Like a Chameleon
- The Lipschitz-Variance-Margin Tradeoff for Enhanced Randomized Smoothing
- Investigating Data Contamination in Modern Benchmarks for Large Language Models
- A Spectral Algorithm for Learning Hidden Markov Models
- InductionBench: LLMs Fail in the Simplest Complexity Class
- MIRAGE: Evaluating and Explaining Inductive Reasoning Process in Language Models
- Training Transformers with Enforced Lipschitz Constants
- Weighted Automata Extraction from Recurrent Neural Networks via Regression on State Spaces
- LipsFormer: Introducing Lipschitz Continuity to Vision Transformers
- The Illusion of Thinking: Understanding the Strengths and Limitations of Reasoning Models via the Lens of Problem Complexity
- What Formal Languages Can Transformers Express? A Survey
- Benchmark Data Contamination of Large Language Models: A Survey
- A One-Layer Decoder-Only Transformer is a Two-Layer RNN: With an Application to Certified Robustness