Can LLMs model real-world systems in TLA+?
TL;DR Highlight
LLM-written TLA+ specs pass syntax checks but match real systems under half the time
Who Should Read
Backend/infra developers who want LLMs to turn distributed system code into formal TLA+ specs
Core Mechanics
- Asked for Etcd, got the Raft paper
- Claude was asked for a TLA+ spec of Etcd's Raft implementation.
- The result passed syntax checks and TLC but was the Raft paper appendix spec with almost no Etcd specifics.
- SysMoBench scores in four phases
- It gives an LLM source code, a trace-collection harness, and an invariant template for 11 systems.
- The phases are syntax, runtime (TLC runs), conformance (compared against real execution traces), and invariants.
- Syntax near 100%, conformance 46%
- Latest leading LLMs average about 46% on conformance and 41% on invariants.
- Syntax scores are near perfect for most.
- Spec reaches states real code never does
- Sonnet wrote ZooKeeper's recvset (a map keyed by sender, overwritten per peer) as a set union.
- Old and new votes both stayed, creating states real code never enters.
- Spec misses states real code reaches
- The HandleNotification guard fused 'bump local clock, then process message' into one condition.
- This erased states like local epoch 1 and incoming epoch 2 that occur every election round.
- Harder systems break LLMs
- On simple systems (Asterinas Spin, Mutex, RwMutex) most LLMs score high.
- On Etcd, RedisRaft, CURP and PGo raftkvs, conformance and invariants were 10-50%, and Claude Sonnet 4.6 scored 25% overall on RedisRaft and CURP.
Community Reactions
- LLMs struggle with safety and liveness properties
- A commenter said LLMs write models well, but need close guidance for correct safety and especially liveness properties.
- They also saw state space explosion, which LLMs can fix on simpler models with guidance.
- Code-to-spec is the wrong direction, some argued
- A commenter said TLA+ is meant as a blueprint from spec to system, and modeling existing code can faithfully encode existing bugs.
- They said Lamport sees AI's value in compiling specs into code.
- Verus couples code and proof, one said
- A commenter said Verus ties implementation to verification so the model can't diverge from the code.
- Another who built a TLA-style temporal logic library for Verus with LLMs said they are good at proof scaffolding but sometimes cheat with `assume(false)`.
- Claude is getting better at TLA+, per one user
- A commenter had Claude model Monopoly rules in TLA+ and it looked passable, though not exhaustively checked.
- They still write specs by hand but are unsure for how long.
How to Apply
- Check your spec against traces
- If you have an LLM-made TLA+ spec today, extract a few (pre_state, action, post_state) triples from logs.
- Verify per action that the spec allows that transition, with TLC or by hand.
- Put data structures and step order in the prompt
- When requesting a spec, paste code excerpts showing key data structures (map vs set) and processing order.
- State explicitly: follow this code's action decomposition, not a textbook template.
- Don't use syntax pass as a quality metric
- In your LLM spec evaluation pipeline, treat SANY passing as a minimum bar only.
- Record conformance and invariant pass rates per action and per invariant.
- Write invariants yourself, let LLM translate
- Write the safety and liveness properties in plain language yourself and have the LLM convert them to TLA+.
- Run each generated invariant separately in TLC.
Try It
# Paste into Claude or ChatGPT (simplified version of the paper's method: code-fidelity check)
Write a TLA+ spec from the {{system name}} code below. Do not use a textbook template (e.g. the Raft paper); follow this code's structure.
Rules:
1. First list in a table whether each state variable in the code is a map, set, or list, and match the spec's variable types.
2. Do not merge multi-step logic inside one function (e.g. bump clock, then process message) into one guard. Split it into separate actions or sub-steps in code order.
3. Annotate each TLA+ action with a comment giving the corresponding code line numbers.
4. Finally, self-check: list 3 places where the spec may allow states the code never reaches, and 3 where it blocks states the code does reach.
Code:
{{source code}}Terminology
Related Papers
Gemini 4 Neon is the new #1 on the Models Engineering Index
Gemini 4 Neon ranks first on the Models Engineering Index with 68.0, combining multiple benchmarks.
LLMs can read and write executables byte by byte from a hex dump
Given only a hex dump and no tools, an LLM analyzed, patched and wrote working executables.
Claude was trained on protein sequences at scale
Next-amino-acid tests on obscure proteins show only the latest Claude models predict them
Remembered as Brief: Stored Preferences SilentlyRemove Decision-Critical Information
A stored 'keep it short' preference silently drops warnings; listing must-know points first restores content.
All AI-generated code should be Open Source
A blog argues AI-generated code should be open source; most HN commenters disagreed.
What thousands of conversations look like inside a language model
Mapping Qwen3-1.7B states showed Chinese sitting apart from English, while German and Croatian overlapped it.
AI, activity, and outcomes in software engineering
AI sped up writing code, but shipping speed did not rise as much, says a talk
LLMs Play Zachtronics' TIS-100
16 LLMs played TIS-100 and set 133 new Pareto frontier points across 18 puzzles
Related Resources
- https://www.sigops.org/2026/can-llms-model-real-world-systems-in-tla/
- https://arxiv.org/abs/2509.23130
- https://github.com/specula-org/SysMoBench
- https://sysmobench.com
- https://github.com/tlaplus/TLAiBench
- https://github.com/verus-lang/verus
- https://foundation.tlapl.us/challenge/index.html
- https://github.com/lambdaclass/truth_research_zk