A TLA+ specification can show that a replication protocol never loses a committed write. It cannot show that the Go or C++ that was written afterward behaves the way the specification says. That distance, between a verified design and a running implementation, is where most of the practical difficulty in formal methods for distributed systems now sits, and it is the subject of a steady stream of recent papers.

What specifications already deliver

The industrial case for TLA+ is well documented. Amazon Web Services engineers have used formal specification and model checking since 2011 on critical systems. Their account, Use of Formal Methods at Amazon Web Services, reports that in every case TLA+ added significant value, either by finding subtle bugs or by giving engineers enough understanding to make aggressive performance optimizations without sacrificing correctness. Two properties of the language explain the result. A TLA+ specification describes every legal behavior of a system, so a model checker can explore interleavings that testing would almost never produce. And the same notation expresses both the correctness property and the design, so a reviewer can see exactly what the design is being held to.

Protocol design is therefore the part of the problem that has an established answer. The weakness is that the specification and the code are separate artifacts maintained by people under schedule pressure, and nothing forces them to stay aligned.

Two attempts at MongoDB, two outcomes

The most candid account of that weakness is eXtreme Modelling in Practice, published in PVLDB in 2020 by three MongoDB engineers. They tried two techniques for checking that implementation conforms to a TLA+ specification, in two different components.

The first was model-based trace-checking on MongoDB Server’s replication protocol: record what the implementation did, then check whether the recorded behavior is permitted by the specification. The authors found this impractical for testing that the server conformed to a highly abstract specification. The second was model-based test-case generation on the operational transformation algorithm in MongoDB Realm Sync: use the model checker to enumerate behaviors, then turn each into a test of the implementation. They report this as highly successful.

The paper’s lesson is not that one technique is better. It is that the answer depends on how far apart the specification and implementation are. An abstract specification of a complex server is hard to match against a production system with different internal state. A specification of a contained algorithm can be turned directly into tests.

Lightweight methods in a shipping storage system

The 2021 SOSP paper Using Lightweight Formal Methods to Validate a Key-Value Storage Node in Amazon S3 takes a third route. Its authors describe validating ShardStore, a new storage node implementation for S3, with pragmatic methods applied while a full-time engineering team kept adding features. They report that the work prevented 16 issues from reaching production, including subtle crash-consistency and concurrency problems, and that engineers who are not formal-methods experts have extended the checks as the system evolved. The paper won a best-paper award at SOSP 2021.

The notable detail is the last one. A technique that only its inventors can maintain does not survive contact with a team that ships weekly; one that ordinary engineers can extend does. A paper in this year’s SOSP program from AWS authors, Validating a Production Cloud Object Store with Lightweight Formal Methods, suggests the line of work is continuing, though readers should consult the final text for what it claims.

Trace validation, automated

Two recent papers attack the conformance problem by connecting implementation traces to the specification.

Cirstea, Kuppe, Loillier and Merz present a framework for validating traces of distributed programs against TLA+ specifications. It reduces the problem to constrained model checking with TLC, with an API for instrumenting Java programs to record traces. Traces contain only updates to specification variables, not full state, and developers can trace only some variables. The authors applied it to several distributed programs and report detecting discrepancies between specifications and implementations in all cases. That result cuts two ways: it demonstrates the method finds real divergence, and it confirms how common divergence is.

TraceLinking Implementations with Their Verified Designs, by Hackett and Beschastnikh, appeared at OOPSLA 2025. It targets PGo, a compiler from Modular PlusCal to both TLA+ and Go, and describes TraceLink as a methodology for detecting deviations by mapping execution traces to the formal design. The authors state that, unlike earlier trace validation work, it is fully automated. They also introduce a path-validation strategy called sidestep, which finds bugs faster with little additional overhead. Evaluated on several distributed systems including a Raft key-value store, it found nine previously undetected bugs in PGo’s trusted computing base, one of them in the compiler itself. The point generalizes: even a toolchain built to preserve a design can fail to, and only checking the running system reveals it.

Beyond model checking: proofs

Model checking explores a bounded state space, so it can miss bugs that need larger configurations. Proof-based approaches aim for guarantees at any scale, at higher cost. This year’s SOSP accepted-papers list includes I3DP, on inferring inductive invariants for distributed protocols, and Verifying a High-Performance Distributed Transaction System Using Permissioned State Machines. Both titles indicate effort aimed at reducing the proof burden or applying proofs to a real system; we have not evaluated their results and recommend reading the papers before forming a view.

A practical approach for engineering teams

The literature supports a staged approach:

  1. Specify the protocol before writing code, and model-check it against the properties you care about. This is the step with the strongest record.
  2. Decide the conformance strategy up front, based on the specification’s distance from the code. Where the specification describes a self-contained algorithm, generating tests from it is the technique MongoDB found most successful. Where it describes a large system abstractly, expect trace checking to be difficult, as it was for MongoDB’s replication protocol.
  3. Make checks maintainable by people who did not write them. The ShardStore result depends on this.
  4. Budget for finding divergence. Both trace-validation papers found it in every system they examined, so a first run that reports mismatches is the technique working.

None of this closes the gap. It makes the gap measurable, which is the precondition for managing it.