[ Blog ]Engineering

Extending FlashProve to Mistral Nemo: what a second model taught us about provable inference

We extended FlashProve to a second model, Mistral Nemo, with a machine-checked soundness guarantee. What it took, and what it taught us about building a general model prover.

By Snarkify

Provable inference is useful only to the extent that it covers the models that are actually deployed. FlashProve, the open-source prover published by Anthropic, was released with support for a single model, an exact integer version of Meta’s Llama 4 Maverick, together with a soundness guarantee for its reference verifier, machine-checked in Lean, software that checks every step of a mathematical proof.

At Snarkify, our aim is to bring this research into production and to extend it to more open models. As a first step, we extended FlashProve to a second model, Mistral Nemo, a widely used open model with 12 billion weights, and established the machine-checked guarantee for it as well. Our code is open source, in our fork of Anthropic’s FlashProve, with support for Mistral Nemo 12B added. This post describes our contributions and what we learned about where the cost lies when a new model uses only operators FlashProve already supports, and how it can be reduced. For background, see Commit to a model. Prove its answers. and Every inference will need a proof.

Contributions

  • Support for Nemo in FlashProve. The prover and the C++ verifier now support Nemo; the three changes this required are described under Implementation. On one NVIDIA H100 GPU, a proof for a 1,024-token window of prompt and answer is generated in 15 seconds and verified in 17 seconds on a CPU, with no GPU required.
  • A machine-checked guarantee for Nemo. We proved in Lean that if FlashProve’s Lean verifier accepts a Nemo proof, the answer is the one the committed model gives, except with negligible probability. This is the same soundness guarantee, with the same error bound, that FlashProve gives for Maverick. It covers the verifier program that is actually run, not only its definition. In a test, the verifier accepted a real Nemo proof and rejected tampered copies of it.
  • A method and tools for adding more models. We wrote a step-by-step guide, with tools that automate most of the work, for moving the Lean proofs to a new model safely. We also designed a way to state the proofs once for all models, instead of once per model.

Introduction

A language model is composed of a small set of standard operators, such as attention, normalization and feed-forward layers. Extending FlashProve from a model it already supports to a model with a new kind of operator, for example a different expert-routing rule or sliding-window attention, requires:

  • new definitions in the integer model;
  • new GPU kernels in the prover;
  • new checks in the verifiers;
  • new sections in the proof format;
  • new Lean definitions and proofs;
  • possibly, a new review of weight hiding.

Extending FlashProve to a model that differs only in its shape parameters, such as the number of layers, the widths or the vocabulary size, requires none of these new parts. Instead, it requires:

  • a new configuration;
  • updates to the checks that validate shapes;
  • the existing Lean proofs, restated at the new values.

Mistral Nemo uses only operators that FlashProve already supports, but differs from Maverick in almost every shape parameter:

Llama 4 MaverickMistral Nemo
Sizeabout 400 billion weights12 billion weights
Layers4840
Architecturemixture of experts: every other layer routes each token to one of 128 expert networksdense: no expert layers
Vocabulary202,048 tokens131,072 tokens

Nemo is therefore a clean test of what a change of shape parameters alone costs, and that cost turned out to be substantial. Several assumptions made for Maverick no longer held, and about 3,800 Lean files had to be restated for Nemo before its guarantee could be proved. This work taught us five lessons:

  1. For a model without new operators, such as Nemo, the porting cost lies mostly in the formal proofs, not in the cryptographic protocol or the GPU implementation. Supporting Nemo required no new GPU kernels. The Lean proofs, however, have Maverick’s shape parameters (such as its 48 layers) and its configuration data written into them throughout, so every file that depends on them needed a Nemo version.
  2. Architectural novelty, not parameter count, determines the cost of a port. A new operator must be added to the integer model, the prover, the verifiers, the proof format and the Lean proofs. A change of shape parameters, even one as large as from Maverick’s roughly 400 billion weights to Nemo’s 12 billion, needs only a new configuration, updated shape checks and restated proofs.
  3. Supporting a second model reveals assumptions that held only for the first. Code written for one model tends to rely, without saying so, on properties of that model. Nemo brought no new operators, yet it broke several such assumptions, for example that the attention width equals the model’s main width.
  4. A soundness theorem does not transfer between models. It is a statement about one verifier, set up for one model’s shape parameters. Maverick’s theorem stays true when Nemo is added, but it says nothing about the verifier that checks Nemo’s proofs, so Nemo needs a theorem of its own.
  5. When proofs are adapted to a new model, the main risk is not a proof that fails, but a proof of the wrong statement. We adapted them by specialization: making a Nemo version of each proof, with Nemo’s identifiers and shape parameters in place of Maverick’s. Lean checks that each proof establishes its statement, but not that the statement is the one we meant.

The following sections discuss each of these in turn.

Implementation

Three changes were needed where the implementation relied on properties of Maverick:

  • An assumption that held only for Maverick. In Maverick, the attention width equals the model’s main width, and the implementation relied on this equality. In Nemo the two differ, so the constraint was relaxed consistently in the prover, the verifiers and the Lean development.
  • Models without expert layers. Maverick interleaves dense and expert layers; Nemo has no expert layers. The system now accepts such models.
  • A range check that rejected the model. Before committing to a model, FlashProve verifies that no intermediate value can exceed its allotted range for any input. Nemo failed this check in its last four layers. The remedy was to bound one value at those points, as Maverick already does in its expert layers. The bound is part of the committed model, so the proof still describes exactly the computation that is performed.

Validation. We checked these changes in two ways. First, the integer model is defined twice: in Python, as the reference against which the prover is tested, and in Lean, where the guarantee is stated. We tested the two definitions against each other, including new cases without expert layers, and they agreed in every case. Second, a review of the changes found a defect that Nemo does not trigger but a model with attention wider than its main width would. We fixed it and tested the fix on a small model of that shape.

Lesson. An implementation developed against a single model encodes assumptions specific to it, such as the equality of two widths or the presence of expert layers. A second model, even one without new operators, is an inexpensive way to surface them.

Performance evaluation

With the changes above, FlashProve commits to Nemo’s weights, generates proofs for its outputs, and verifies them end to end. The table below gives the time for each step, measured on one NVIDIA H100 GPU with Nemo’s public 4-bit weights, next to the figures published for Maverick. The proofs concern an exact integer version of the model, so the computation being proved is deterministic and exactly reproducible (see the technical notes).

Mistral NemoLlama 4 Maverick
Model
Architecturedensemixture of experts
Layers4048
Weights, total12 billionabout 400 billion
Weights used per token12 billionabout 17 billion
Proof window1,024 tokens1,024 tokens
Cost
Commitment to the weights (once)4 min 14 sabout 39 min
Proof generation15 s (one 1,024-token window)about 59 s (one 1,024-token window)
Proof size15.2 MB18.8 MB
Verification with the C++ verifier17 sabout 21 s

A proof covers one window of up to 1,024 tokens, holding the prompt and the answer. Maverick’s figures are averages of three steady-state runs reported in FlashProve’s performance guide. Nemo’s come from two runs, which agree to within 4%.

Soundness for Nemo

FlashProve offers two levels of assurance. The C++ verifier, used for routine checks, is fast but not formally verified. The Lean verifier is slow, about half an hour per proof, but it comes with a soundness theorem machine-checked in Lean: if it accepts, the output is that of the committed model, except with negligible probability. The implementation work above gives Nemo the first level of assurance. This section is about the second: a soundness theorem for Nemo.

Why Nemo needs its own theorem

Maverick’s soundness theorem cannot simply be reused for Nemo. The theorem is stated for one specific verifier, configured for Maverick’s shape parameters. That verifier expects proofs laid out for Maverick, so it rejects every Nemo proof. Soundness is a statement of the form “if the verifier accepts, the output is correct”. Since Maverick’s verifier never accepts a Nemo proof, that statement is trivially true for Nemo and says nothing about it. In particular, it says nothing about the verifier that does accept Nemo proofs, one configured for Nemo’s shape parameters, and that is the verifier that needs a guarantee.

Proving soundness for Nemo

We therefore proved a soundness theorem for a verifier configured for Nemo, with the same bound on the probability of accepting a false output as Maverick’s. Three safeguards accompany it:

  • The theorem applies to Nemo’s actual configuration. The theorem has the form “if these conditions hold, the verifier is sound”. If the conditions never held, it would say nothing. A separate proof shows that Nemo’s actual configuration files satisfy every one of its conditions, so the guarantee genuinely applies to them.
  • Human review of the specification. The theorem’s statement is its specification: it defines what soundness means for Nemo, namely which verifier is meant, which configuration files it reads, and which property it guarantees. Lean checks that the proof establishes this statement, but it cannot check that the statement expresses what we intend; only we can. The theorem statement was therefore reviewed by a person against Nemo’s actual configuration before we accepted the proof.
  • Protection of the reviewed specification. The review is meaningful only if the reviewed statement is the one that is finally proved. A later edit could weaken the statement, or a definition it uses, and Lean would accept a proof of the weaker statement without complaint. An automated check therefore does two things. First, it compares a SHA-256 hash of every file that states the reviewed theorems and their definitions with a recorded value, so a change to any byte of these files is detected. Second, it compares the statement of each main theorem, as compiled by Lean, character for character with a saved copy, and the fully expanded form of that statement by SHA-256. Any difference makes the check fail and calls for a new review.

From the theorem to the program

A theorem about a mathematical definition says nothing about a program unless the program is shown to compute that definition. The soundness theorem concerns the verifier as it is defined in Lean: a function that takes a proof and returns a verdict. What users run, however, is an executable program built from that Lean code, which reads proof files and prints ACCEPT or REJECT.

We therefore proved a second theorem for Nemo, as FlashProve already does for Maverick: the verdict that the executable Lean verifier prints is exactly the verdict of the verifier in the soundness theorem. Together, the two theorems establish that if the program prints ACCEPT, the output tokens are those of the committed model, except with negligible probability.

We also tested the program on real data:

  • On a genuine Nemo proof covering a full 1,024-token window, it printed ACCEPT.
  • We then made eleven copies of that proof, each with a single byte changed. Ten were rejected. In the eleventh, the changed byte belonged to a duplicate of a value that the verifier reads from elsewhere, so accepting it was correct; changing the value where the verifier reads it is rejected.

Lesson. A machine-checked theorem is only as informative as its statement. Establishing that its conditions hold for the deployed configuration, and having its statement reviewed by a person, are as essential as the proof itself.

Porting the Lean proofs

The previous section stated what was proved for Nemo. This section describes how, and it is where most of the effort of the port went. Maverick’s soundness proof rests on a large Lean library, and a substantial part of that library refers to Maverick’s shape parameters directly. Each of those parts had to be restated for Nemo before Nemo’s theorem could be proved. Doing this safely raises a problem that any general model prover, one meant to support many models, will face, and it is the main lesson of this work: the dangerous errors are not proofs that fail, but proofs of the wrong statement.

How we ported the proofs

We ported the existing proofs by specialization rather than writing new ones. Specialization keeps the reasoning of each proof, which had already been checked for Maverick, and changes only what depends on the model:

  • Scope. For every Lean file whose content depends on the model, we generated a Nemo version, about 3,800 files in all.
  • Identifiers. Each definition and theorem that depends on the model received a Nemo counterpart under its own identifier (for example, verdictOf_eq and verdictOf_eq_nemo), so the results for both models coexist in one library.
  • Shape parameters and derived constants. The model’s shape parameters (its number of layers, its widths and its vocabulary size) and the constants derived from them (such as the number of rounds in a proof or the position of an entry in a table) were replaced by Nemo’s.
  • Reasoning. The reasoning of each proof was left unchanged, and Maverick’s original files were not modified, so Maverick’s guarantee is unaffected.

Specializing several thousand files by hand would be slow and error-prone, so we built tools around Lean that carry out most of the work:

  • A dependency census. A tool walks the dependency cone of the soundness theorem in the compiled library and marks every declaration that depends, directly or indirectly, on the model’s shape parameters or configuration files. For Nemo, between about 2,100 and 2,900 of the cone’s 11,500 modules depend on the model. The census also orders the work, so that a module is specialized only after the modules it imports.
  • A generator. From an original file, the generator produces its Nemo version: it renames each model-dependent identifier consistently across the library, and leaves the declarations that do not depend on the model in the original file, so that the Nemo version imports them rather than duplicating them.
  • Value printers. Each derived constant for Nemo is printed by Lean’s own evaluator from the library’s definitions and written into the Nemo files by program. Before it is used, each printer must reproduce Maverick’s stored values exactly.
  • Review tools. For each batch of Nemo files, a statement-level and a token-level comparison with the original files, a list of the numbers that differ, and a search for Maverick identifiers still in use.

Why specialization is risky

Specialization can go wrong in two ways. The first is a proof that no longer works with Nemo’s parameters. Lean rejects such a proof, so this kind of error is found immediately. The second is a statement that was specialized incorrectly but can still be proved. Such errors arise in four ways:

  • Coinciding constants. Some derived constants happen to have the same value in both models; one of them equals 18 for both Maverick and Nemo. Suppose the Nemo version of a definition still refers, by mistake, to Maverick’s constant instead of Nemo’s own. The definition is then wrong, yet every test and every proof still passes, because both constants equal 18. The mistake would only show up for a model in which the two differ.
  • Statements that hold trivially. Nemo has 40 layers where Maverick has 48. Suppose a specialized statement still says “for every layer up to 48, …”. For layers 41 to 48, which Nemo does not have, the claim is about nothing, and a claim about nothing holds automatically, the way “every item in an empty list is red” does. The statement is then true, but partly meaningless, and Lean accepts it. A condition that is false for Nemo, such as “the model has expert layers”, has the same effect: a theorem whose condition is false holds automatically, whatever it claims.
  • Constants written into definitions. Most of Maverick’s shape parameters and derived constants appear in the library under names, which makes them easy to find and replace. Some, however, are written as literal numbers inside a definition, for example a range of 25 steps, which is the length of a chain in Maverick’s proofs, where Nemo’s has 21. A search for the named constants does not find such a number, so a Nemo version can keep it unnoticed. Because the extra steps refer to positions Nemo does not have, statements built on it may still hold, trivially.
  • Defaults that resemble results. Some lookup functions in the library return a default value, instead of failing, when they are asked for a position that does not exist. In Maverick’s proofs every position that is looked up exists. In a Nemo version, a lookup may ask for a position that Nemo does not have and still receive a number, the default, which looks like a genuine entry. A statement that checks this number can then succeed for the wrong reason.

How we guard against them

Because Lean cannot catch these errors, each needs a check of its own. We used six, each aimed at specific errors above:

  • Computed constants, against errors at the source. No Nemo constant is typed by hand. Each is obtained by evaluating the library’s own definitions with Nemo’s shape parameters, so none is carried over from Maverick by a slip.
  • Checking by identifier, against coinciding constants. A comparison of values cannot tell Maverick’s 18 from Nemo’s 18. We therefore list every identifier that belongs to Maverick and check that no Nemo file refers to any of them.
  • Scanning definitions, against constants written into definitions. Before specializing, we search every definition for literal numbers equal to one of Maverick’s shape parameters or derived constants, such as 25 or 48, and review each match by hand.
  • Checking that each theorem applies, against trivial statements and misleading defaults. For each new theorem, we evaluate its conditions on Nemo’s actual configuration files, one condition at a time, and we confirm that lookups at positions Nemo does not have fail rather than return a default. The main theorem is accompanied by a proof that its conditions hold.
  • Edits that must fail, to test the checks themselves. For each batch of Nemo files, we make deliberately wrong edits, for example putting back one of Maverick’s constants, and confirm that Lean rejects them. A check that still passes after a wrong edit is not testing anything.
  • Human review of the specification, that is, of the theorem statement.

We documented these procedures in a step-by-step guide for the next model. Catching errors early matters, because a full check of the library takes several hours on a large server.

Implications for a general model prover

The Nemo port has three implications for any prover meant to support many models:

  • The risk moves from proofs to statements. Once a computer checks every proof, what can still go wrong is what the proofs claim. With one model, there is one set of statements to review. When the proofs are specialized for each new model, every specialization adds another set, any of which could state the wrong property and still be accepted. The review effort therefore grows with the number of models.
  • Passing tests are weak evidence. The same holds outside Lean. Tests written for one model can pass on a new model simply because they never reach the parts that differ, as the trivial statements above show. Support for a new model needs tests that have been shown to fail when something is wrong.
  • The remedy is structural. More careful checking of each specialization reduces these errors but does not remove their source, which is that every model has its own copy of the statements. A general model prover should state its guarantee once, in terms of the model’s shape parameters, and check each model’s specification against that single statement. The next section describes our plan to do this.

Future work: generalizing the soundness theorem

Our next step is to state FlashProve’s guarantee once, for all models. Today, each model’s shape parameters are written into the proofs as fixed numbers, such as Maverick’s 48 layers, so Nemo needed its own version with 40. We will generalize the proofs so that they take a model specification (the shape parameters and configuration files) as input. Adding a model will then take two steps: writing its specification, and having Lean check once that the specification meets the general theorem’s conditions. The theorems for Maverick and Nemo will become special cases of the general theorem, with their statements unchanged.

Generalizing takes more work now than adapting the proofs to one more model, but we expect it to pay off from the third model onward. We will then turn to models with new operators, which also need changes to the prover and the verifiers.

Limitations

Our work on Nemo has three limitations, which we state here so that it is not read as more than it is:

  • Soundness only. For Nemo, the Lean proofs establish soundness. Maverick’s other guarantees, that honest proofs are always accepted, that proofs reveal nothing about the weights, and that a commitment binds the provider to one set of weights, have not yet been proved for Nemo, and Nemo has not yet had its own review of weight hiding.
  • Agreement with the original model not yet measured. We have not yet measured how often Nemo’s integer model selects a different next token from the original floating-point model.
  • Only the Lean verifier is covered. The guarantee applies to the Lean verifier. The C++ verifier and the GPU prover are not formally verified.

Conclusion

Provable inference is useful to the extent that it covers the models in use, and practical to the extent that proving is affordable. This work concerns the first condition: it identifies where the cost of supporting such a model lies, and how that cost can be removed. Our mission is to make proofs cheap enough that every inference can carry one.

Building with provable inference? Talk to us.


Technical notes

  • FlashProve’s proof system. A hash-based, non-interactive argument: an interactive oracle proof compiled with Merkle trees and the Fiat-Shamir transform, over the Goldilocks field. It builds on Chiesa, Fenzi and Weissenberg, Zero-Knowledge IOPPs for Constrained Interleaved Codes (ePrint 2026/391). Weights remain hidden behind masked Reed-Solomon encodings (reviewed for Maverick; see Limitations for Nemo), apart from a declared list of values that are public by design, such as the architecture and its dimensions.
  • The soundness statement. There is one extractor such that, for every committer and prover making at most q hash queries, the probability that the verifier accepts output tokens that are not the model’s output, under the weights the extractor recovers from the commitment, is at most ε(q) ≈ q/2^124 + 2^−101, in the random-oracle model. At q ≈ 2^60 hash queries, this is about 2^−64.
  • The integer model. Proof systems operate over integers, and floating-point computation on GPUs is not bit-for-bit reproducible, so FlashProve proves statements about an integer model derived from the original: quantized integer weights (for Nemo, from the public 4-bit weight files), fixed-point activations, and lookup tables for non-linear functions such as softmax. Under the exact match policy, a proof establishes that every output token is the integer model’s top choice given the prompt and the preceding tokens. The integer model agrees with the original floating-point model at most, but not all, positions.
  • The Nemo theorems are sound_of_verify_at_nemo (soundness of the verifier) and verdictOf_eq_nemo (the executable Lean verifier computes the verifier in the soundness theorem). The entire proof library was rebuilt and replayed through Lean’s kernel; every declaration depends only on Lean’s standard axioms propext, Classical.choice and Quot.sound. The Lean verifier relies on a small, unverified program that converts proof files into a form Lean reads, and the configuration stored in Lean is matched to the actual files by SHA-256 rather than by proof.

[ More from the lab ]

Thesis

Every inference will need a proof

As models act with money and authority, what matters is whether the promised model actually ran. Proofs answer that; cost decides how soon they become routine.