Loyola's TLA-Prover Beats Untuned AI at Formal Verification by 3.5x
TLA-Prover fine-tunes a 20B model with RL to generate verified TLA+ specs, hitting 30% pass@1 -- 3.5x better than any untuned LLM baseline
Takeaways
- 3.5x improvement: TLA-Prover hits 30% pass@1 on TLC model-checking, up from the 8.6% best untuned LLM baseline across 25 models.
- Two-stage training: Supervised fine-tuning on verified specs, followed by repair-based GRPO reinforcement learning using TLC as the reward signal -- no human labels needed.
- Diamond tier evaluation: A mutation-testing trick automatically alters correctness properties to check they are falsifiable, preventing models from gaming benchmarks with trivially-true assertions.
- LoRA on a 20B MoE model: Uses rank-8 LoRA adapters on attention layers of
gpt-oss-20b; MoE expert weights are not fine-tuned due to architectural constraints. - DPO underperforms GRPO: A DPO variant from the same SFT checkpoint reaches only 20% Diamond vs. 30% for the GRPO model, confirming the value of the repair loop.
- No public release yet: The paper does not announce a public checkpoint or code repo at time of publication.
TLA-Prover is a new 20-billion-parameter model that can generate formally verified TLA+ specifications from natural-language descriptions. Researchers at Loyola University Chicago trained it using a combination of supervised fine-tuning and reinforcement learning, with the TLC model checker acting as the judge. The result: a 30% pass rate on a held-out benchmark, compared to just 8.6% for the best untuned LLM baseline -- roughly a 3.5x improvement.
Why TLA+ is hard to automate
TLA+ (Temporal Logic of Actions) is a formal specification language created by Leslie Lamport. It is used for designing, modelling, and verifying programs, especially concurrent and distributed systems. Think of it as mathematically rigorous pseudocode: you describe what a system is supposed to do, and a tool called the TLC model checker exhaustively explores every possible execution path to find violations.
Amazon Web Services has used TLA+ since 2011, and TLC model checking uncovered bugs in DynamoDB, S3, EBS, and an internal distributed lock manager -- some bugs required state traces of 35 steps. Microsoft Azure used TLA+ to design Cosmos DB, a globally-distributed database with five different consistency models. The language is powerful, but it comes with a steep learning curve.
Its steep learning curve and the meticulous nature of crafting specifications have historically limited its widespread adoption. Now, LLMs are entering this domain, promising to democratize formal verification. The problem is that LLMs are notoriously bad at it. LLMs frequently produce TLA+ specifications that fail the TLC model checker for semantic reasons. Getting the syntax right is one thing; getting the logic right -- so that TLC can actually verify safety and liveness properties -- is much harder.
The baseline is brutally low
A prior study called FormaLLM provides the first systematic evaluation of LLM-based TLA+ generation, testing 30 models across eight families under four prompting strategies. Their headline finding of 26.6% SANY parse and 8.6% TLC model-check averaged across 25 open-weight models establishes the untuned-LLM floor. In other words: the best off-the-shelf model can barely get a quarter of its outputs to parse correctly, and fewer than 1 in 10 actually pass the model checker. FormaLLM is an evaluation study with no task-specific training, and the authors explicitly identify task-trained models as the natural next step. This paper answers their call directly.
A two-stage training pipeline
The core insight behind TLA-Prover is that TLC itself can serve as a perfect, zero-cost reward signal. No human annotations, no learned reward model -- just run the checker and see if the spec passes. The training pipeline has two stages:
- Supervised Fine-Tuning (SFT): Stage 1 applies SFT on the curated corpus to teach the model the structural vocabulary of TLA+. This is standard imitation learning on verified examples.
- Repair-based GRPO: Stage 2 applies repair-based GRPO with TLC as the verifier reward to push the model toward model-checkable and mutation-sensitive output. GRPO (Group Relative Policy Optimization) is a reinforcement learning technique where the model generates a group of candidate outputs, ranks them by reward, and learns to prefer the better ones. The "repair" twist means the model is shown its own rejected specs and trained to fix them.
The team trains gpt-oss-20b with a LoRA adapter (rank 8, alpha 16, dropout 0) applied to the attention projections q/k/v/o of every transformer block. The MoE expert weights are not targeted. LoRA (Low-Rank Adaptation) is a parameter-efficient fine-tuning method that inserts small trainable matrices into the model without touching the original weights -- keeping training cheap while still meaningfully shifting behavior.

The team also trained a DPO (Direct Preference Optimization) variant from the same SFT checkpoint. DPO is a simpler alternative to GRPO that learns from pairs of ranked outputs without needing an explicit RL loop. It under-performs repair-GRPO on diamond pass-rate and is not part of the final pipeline.
The Diamond tier: closing the trivial-property loophole
One of the most interesting contributions in this paper is the four-tier grading system, which addresses a subtle failure mode that simpler evaluations miss:
- Bronze: The output parses without errors (SANY check)
- Silver: The output parses with no warnings
- Gold: The output fully passes TLC model checking
- Diamond: The output passes TLC, and the correctness property is actually meaningful
That last tier deserves explanation. A model could cheat Gold by writing a correctness property that is trivially always true -- like asserting TRUE. TLC would pass it, but the spec would be useless. To reach Diamond, the model's correctness property is automatically altered in a small way; TLC must then detect a violation. If TLC still passes, the property was always-true and contributes nothing; the output fails Diamond. This mutation-testing approach to evaluation is a genuine methodological contribution: it forces the model to write properties that are actually falsifiable.
Results and what they mean
TLA-Prover reaches 9/30 (pass@1 = 30%) at both Gold and Diamond on a held-out 30-problem benchmark -- roughly 3.5x the 8.6% untuned baseline. The DPO variant reaches 20% at Diamond. Crucially, Gold and Diamond coincide at every checkpoint, which prevents the trivial-property failure mode. The model never learned to game the evaluation by writing vacuous properties.
The benchmark itself is drawn from the same distribution as the FormaLLM study. The repository contains 205 TLA+ specifications across 98 projects: distributed consensus protocols (Paxos, Raft, Byzantine agreement), concurrency problems (dining philosophers, readers-writers), and algorithmic puzzles (Towers of Hanoi, N-queens). These are real-world specs, not toy problems.
Where it fits and where it falls short
TLA-Prover is most useful in settings where you want a first-draft specification from a natural-language description of a protocol or system. Think: a distributed systems engineer who knows what invariants they want to hold, but doesn't want to write the TLA+ boilerplate from scratch. The model gets you to a TLC-passing spec faster, which you can then refine.
The limitations are real though:
- Small benchmark: 30 held-out problems is a thin evaluation surface. Performance on novel protocol families outside the training distribution is unknown.
- 30% is still 70% failure: Most generations still fail TLC. This is a research prototype, not a production tool.
- No code release yet: The paper does not announce a public model checkpoint or code repository, limiting immediate reproducibility.
- LoRA on attention only: The MoE expert FFN weights are stored as a 3D packed tensor that standard LoRA cannot decompose, so attention is the only trainable surface available without a custom adapter implementation. This architectural constraint may cap how much the model can specialize.
The real breakthrough
The headline number (30% vs 8.6%) is significant, but the deeper contribution is the evaluation framework. Using mutation testing to detect trivially-true properties -- the Diamond tier -- is a clean solution to a problem that would otherwise silently inflate benchmark scores. Any future work on LLM-based formal specification synthesis will need to adopt something like this to avoid reporting inflated numbers. The repair-based GRPO loop, where the model learns from its own TLC failures, also points toward a general recipe for grounding LLM training in symbolic verifiers -- a pattern that could extend well beyond TLA+ to other formal languages like Alloy, Coq, or Lean.