arXiv:2609.00838cs.SESep 2026

Manuscript Offprint

arXiv:2609.00838

Probabilistic Model Checking of Autoregressive Neural Sequence Models

Helge Spieker, Dennis Gross, Arnaud Gotlieb

Helge Spieker[0000-0003-2494-4279], Dennis Gross[0009-0001-5734-0538], and Arnaud Gotlieb[0000-0002-8980-7585]

Simula Research Laboratory, Oslo, Norway

Corresponding author: helge@simula.no

Abstract. Test-set accuracy is silent on two issues that matter when deploying autoregressive neural sequence models: how much probability mass the system under test (SUT) places on constraint-violating alternatives that are reachable under sampling and what fraction of the input population satisfies a domain requirement. We answer both with probabilistic model checking. The pipeline extracts a discrete-time Markov chain (DTMC) from the SUT's token-by-token generation, verifies formal PCTL specifications with the PRISM model checker, and aggregates the per-input verdicts into a coverage curve over the input space. A soundness theorem establishes the DTMC as an under-approximation, so every verdict yields a certified interval on the SUT's true reachability probability. The coverage built from those verdicts is, therefore, conservative by construction. A counterexample-guided abstraction refinement (CE-GAR) loop adaptively tightens the interval, and a maximum-likelihood algorithm extracts the most probable falsifying trace. Two case studies exercise the pipeline. On a GPT-2 computer-aided process-planning (CAPP) model with 100% test accuracy, the pipeline quantifies the probability mass greedy decoding hides, but that is reachable with sampling; and identifies the smallest training fraction at which an ordering requirement holds population-wide, neither of which test accuracy can report. We then verify the SMILES molecular generator with a 50× larger vocabulary. The only change is an external chemical-validity oracle, and the pipeline identifies the gap between structural completeness and chemical validity.

Keywords: probabilistic model checking · DTMC abstraction · PCTL · autoregressive transformers · neural network verification

1 Introduction

Autoregressive transformer models, the technology behind large language models, now appear in engineering pipelines, where generated sequences affect physical artifacts, regulatory outcomes, and downstream automation. However, their reliability is far from guaranteed [28, 14]. Yet their evaluation still rests almost entirely on test-set accuracy: a single number reporting how often the output matches the held-out reference [20]. Three questions matter for deployment that

H. Spieker et al.

no test set can answer on its own. First, how much probability mass does the model place on low-confidence alternatives that greedy decoding never selects, but a sampled decoder eventually will [13]? Second, do generated sequences obey domain constraints that lie outside the training signal and so never enter an accuracy metric, because it does not report failure causes or because these failures are not part of the ground-truth dataset in the first place? Third, what fraction of the entire input population satisfies a given criterion? Are domain violations corner cases or potentially frequent occurrences?

As an example, consider the problem of computer-aided process planning (CAPP). High-level CAPP is the task of determining appropriate sequences of manufacturing processes (e.g., milling, drilling, grinding) to produce a given part. A part can usually be made in several ways, so the task is naturally a variable-length sequence-prediction problem. Stathatos et al. [27] address this problem with a domain-specific GPT-2 transformer [25] that maps a discrete part description to an ordered sequence of operations. The model reports 100% sequence accuracy on the held-out test set, a number that suggests it is ready to deploy. Our pipeline shows otherwise: even the smallest checkpoint with 100% accuracy (15% of the data) still routes over 9% of its probability mass to completions greedy decoding never selects, and on data-starved checkpoints the most probable hidden trace violates manufacturing phase ordering. Neither failure mode is visible to accuracy, because both reference probability mass or a domain constraint the ground-truth sequence never exercises. This hidden mass is a risk, but it is also a lever.

A deployed model must commit to a decoding rule: greedy decoding always emits the single most likely next operation, whereas a sampled decoder draws from the model's distribution and so can produce different plans on repeated runs. This can potentially improve performance, because the best next token might not always have the highest probability; especially in settings with limited data. Because our pipeline reasons about the whole distribution rather than one trajectory, it predicts (without re-running the model) how often a sampled decoder, paired with the verifier as a filter, recovers a correct plan greedy decoding would miss [5]. On the most data-starved checkpoint a slightly sharpened sampler does exactly that, turning the risk into a usable safety margin.

In our approach, we treat the autoregressive transformer as the system under test (SUT) and apply a three-stage probabilistic-model-checking pipeline. It extracts a discrete-time Markov chain (DTMC) by unrolling the token-by-token generation, verifies Probabilistic Computation Tree Logic (PCTL) specifications against it with the PRISM model checker [18], and aggregates the per-input verdicts into a coverage curve over the input population. Because the DTMC is a sound under-approximation, each input's set of PRISM verdicts yields a certified interval on the SUT's reachability probability, not a point estimate, and the population fractions built from these intervals are themselves conservative. A CEGAR-style refinement loop [4] tightens the interval adaptively, and a maximum-likelihood counterexample algorithm extracts the most probable falsifying trace from any violated specification. The result is a population coverage statement: the fraction of inputs for which property ϕ\phi holds with probability at least θ\theta.

Overall, this paper makes the following contributions:

  1. A probabilistic model verification methodology for autoregressive transformers built on three artifacts: a DTMC abstraction of the SUT (Sec. 3.3), PCTL specifications including domain-specific properties (Sec. 3.4), and population coverage over the input space (Sec. 3.5).

  2. A soundness theorem (Theorem 1) that yields a certified interval on the SUT, tightened adaptively by a CEGAR-style refinement loop (Sec. 3.7).

  3. A maximum likelihood counterexample algorithm (Sec. 3.8) extracting the most probable falsifying trace as an inspectable artifact.

  4. Experiments on two systems: CAPP (Sec. 4.1) exposing failure modes invisible to accuracy, and SMILES molecule generation (Sec. 4.2) with a substantially larger vocabulary.

References (31)