A model writes its own coding problems, solves them, and learns only from programs a formal checker proved correct. That lifted pass@1 on Dafny2Verus from 34.46% to 65.63%.
Learn how a small code model can teach itself with no human answers, why the checker decides whether that works, and how to rebuild the loop.
Pick a checker, then press Next round a few times. Watch which programs enter the training pool, and which of them are wrong. Then we build, piece by piece, the checker, the loop, the training step and the problem writer.
You need a little Python and a feel for what a program is. We build the rest from zero: what a proof of correctness is, what self-play is, and what pass@k means.
A reading for the MIT MAS.S62 AI4AI lecture RL in Practice and Self-Play. Paper: Alex Wilf, Pranjal Aggarwal, Bryan Parno, Daniel Fried, Louis-Philippe Morency, Paul Pu Liang and Sean Welleck, Propose, Solve, Verify: Self-Play Through Formal Verification (arXiv 2512.18160, December 2025). Every idea is re-taught here in our own words and devices.
Illustrative toy, not the paper’s data: 24 made-up problems that get harder left to right and top to bottom, 4 attempts each per round, a fixed random seed. A weak checker lets 40% of wrong attempts through. The paper’s real measurement is in Table 2: training on every solution instead of only verified ones cut Dafny2Verus pass@1 from 65.63% to 31.82%.
Chapter 0
See why a model that sets its own problems needs a grader it can trust, and meet the three jobs in the loop
Picture a student with no teacher and no textbook. She has one skill: she can write practice problems and try to solve them. Each night she writes ten, solves them, and studies her own answers. After a month she is better. Is that possible?
It depends on one thing. When she checks her own work, is the check honest? If she marks a wrong answer as right, she studies the mistake. Next night she repeats it with more confidence. The loop does not build skill. It builds a wrong habit.
Self-play means a system learns by making its own practice, with no human labels. The famous case is AlphaZero, which learned Go and chess by playing itself. It worked because a game has a perfect referee: the rules say who won, with no doubt.
A language model could do the same for reasoning. One copy, the proposer, writes new problems. Another copy, the solver, tries them. A third part, the verifier, says which answers are right. The solver trains on the right ones. The proposer reads how hard each problem was and writes better ones.
The paper names the weak link. The whole loop depends on a reliable verifier. An imperfect verifier can be exploited by the solver, and that corrupts everything built on it, including the curriculum (the order and difficulty of problems).
Code looks like a good fit: you can run a program. The usual grader is a set of unit tests: a few inputs, each with the output you expect. If the program matches on all of them, it passes.
But a few inputs cannot cover every input. A program can pass every test and still be wrong. The authors call this out directly: the solver learns to pass the tests, not to solve the task, and errors spread across iterations. The next chapter shows a program that passes the tests and is plainly broken.
The authors change the grader. They use formal verification: a tool that takes a program and a precise mathematical statement of what it must do, and either proves the program meets the statement for all inputs, or refuses. They call the loop Propose, Solve, Verify, or PSV.
In PSV the problem is itself a formal statement, called a specification. The proposer writes specifications. The solver writes a program plus a proof. The verifier is Verus, a checker for Rust programs. If Verus accepts, the program is guaranteed to meet the specification. A wrong program cannot enter the training set.
The trained model is called PSV-Verus. It starts from a small open model, Qwen2.5-Coder-3B-Instruct, and from the same translated seed corpus that an earlier system called AlphaVerus used. On Dafny2Verus, one of three test sets, pass@1 rises from 34.46% for plain rejection fine-tuning, and 24.06% for AlphaVerus, to 65.63%. Pass@1 is the share of problems solved on the first try; Chapter 4 defines it exactly.
Now go back to the hero. The toy there has the same shape as the paper’s argument. With unit tests, wrong programs slip into the pool, and the solver gets worse. With a formal verifier, the pool stays clean, and the solver improves every round. The toy numbers are made up. The direction is the paper’s finding.
Each chapter builds one piece, in the order the data flows.
Chapter 1
Learn the two ways a grader can fail, and see why only one of them is safe for self-play
A shop asks for a function, is_prime(n), that says whether a whole number is prime. A quick helper writes one line: return n == 3. The shop owner runs a test: is_prime(3) should be true. It is. The function ships.
That function is wrong for 2, 5, 7, 11 and every other prime except 3. One test could not tell. This is the whole problem with grading code by tests, and it is the first idea the paper builds on.
Think of a grader as a bouncer at a club. The club has a rule: only correct programs get in. The bouncer can make two kinds of mistake.
The first mistake is letting in a wrong program. The second is turning away a correct one. These are different mistakes with different costs, so they have different names.
The paper's appendix makes the idea exact. For a problem x, let Yx be the set of acceptable programs: the ones that really solve it. Let Zx be the set of programs the verifier v accepts, which means v(x, y) = 1.
A sound verifier never accepts a wrong program. A complete verifier never rejects a right one. A bouncer who turns everyone away is perfectly sound and useless. A bouncer who admits everyone is perfectly complete and useless. The goal is the best mix you can build.
A test suite is a grader that says yes when a program passes every test. It is unsound, and the appendix proves it with the same prime example. One test, is_prime(3) == true, accepts return n == 3, which is not acceptable. So Z contains something outside Y.
Adding more tests helps, but it never closes the gap. There are infinitely many inputs and any suite checks finitely many. The paper adds a second hazard: when an AI writes the tests, the tests can be incomplete or reward hackable. A solver that is paid for passing tests will drift toward programs that pass tests, whether or not they solve the task.
Try it. Pick a program, then add tests one at a time. Watch the verdict from the tests, and the verdict from a checker that covers every input.
Each cell is a number from 0 to 29. Red cells are inputs where the program gives the wrong answer. Rings mark the inputs your tests use. Choose a program, then drag the number of tests.
Illustrative. The tests, in order, are 3 (prime), 4, 6, 5 (prime), 7 (prime), 9. The “covers every input” checker here simply tries 0 to 29. The real Verus verifier does not try inputs: it proves the claim for all integers at once, by symbolic reasoning.
Take n == 3 with 3 tests. It passes all three: 3 is prime, 4 and 6 are not. The suite says yes. The full checker finds it wrong on 2, 5, 7, 11, 13, 17, 19, 23 and 29: 9 of the 30 numbers. Add a 4th test, is_prime(5), and the suite finally says no.
The sneaky program survives longer. It says “odd and above 1” means prime. That passes tests on 3, 4, 6, 5 and 7. Only the 6th test, 9, exposes it. A tester who stopped at five tests would ship it.
A formal verifier works differently. It does not run the program. It reads the program and a written promise, and it tries to build a mathematical proof that the promise holds for every allowed input. If the proof succeeds, the program is accepted. The paper writes the guarantee as one line: if vF(x, y) = 1, then y satisfies x.
The guarantee has a fine print the paper states: it holds up to the trusted computing base. That means the verifier's own code, and the solver for equations it calls, must be correct. Those are small and heavily checked compared with a model's output.
Verifiers are sound but not complete. This is not a flaw in one tool. The paper cites Rice's theorem: no general analysis of a Turing-complete language can be both sound and complete. So a verifier sometimes rejects a correct program because it cannot find the proof.
That is why the solver must write proof annotations: hints, such as loop invariants, that guide the checker to a proof. Writing them turns a program the verifier rejects into one it accepts. Chapter 2 shows one. Incompleteness also shapes the training algorithm in Chapter 5.
For self-play the trade is a good one. A rejected correct program costs you a training example. An accepted wrong program costs you a bad lesson. Losing data is safer than learning errors.
Chapter 2
Read a formal specification, see what a loop invariant does, and learn what the solver must write for the verifier to say yes
You hire a builder to make a bookshelf. You write a contract: “The shelf holds 30 kilograms. It stands on any flat floor.” The builder does not need to know why you want it. The contract says what is allowed and what is promised. A good inspector checks the shelf against the contract, not against a feeling.
A formal specification is that contract for a function. Verus, the verifier in this paper, is the inspector. Verus checks Rust programs. Rust is a systems language, and Verus adds a layer of contract words on top of it.
A specification has two parts. The precondition (the requires clause) says what the caller must guarantee. The postcondition (the ensures clause) says what the function must then deliver. The paper defines a specification as a statement that mathematically describes all permitted inputs plus the desired output behaviour.
The paper's appendix gives a small example: find the biggest element of a list. Here is its specification, in plain terms and then in code.
a[i] <= max. (The answer is at least as big as everything.)a[i] == max. (The answer really is in the list.)// The specification only (Appendix D of the paper). The body is a stub the verifier trusts. fn max_element(a: &Vec<i32>) -> (max: i32) requires a.len() > 0, ensures forall|i: int| 0 <= i < a.len() ==> a[i] <= max, exists|i: int| 0 <= i < a.len() && a[i] == max,
Both parts are needed. Part 1 alone is satisfied by returning a gigantic number. Part 2 alone is satisfied by returning the first element. Together they pin down one answer.
The solver gets the specification and writes the body: the program, plus whatever extra lines the verifier needs to see why it works. Those extra lines are the proof code. The most common kind is a loop invariant.
A loop is the hard case. A verifier cannot run a loop for every possible length. So it needs a statement that stays true on every pass, called a loop invariant. Think of a line of dominoes. You show that the first one falls, and that each falling domino knocks the next. Then you know they all fall, without watching each one.
An invariant works the same way. It must hold before the loop starts. If it holds before one pass, it must hold after. When the loop ends, the invariant plus the exit condition must imply the postcondition. The paper's appendix says the invariants for this example mirror the postconditions: every element seen so far is at most max, and the current max appears somewhere in the part already seen.
The list is 3, 9, 4, 7, 2. Choose a version of the code, then drag the slider to move the loop forward. Two checks sit under the list. A tick means the verifier can prove it.
Illustrative. We wrote this loop in the shape of the paper’s Appendix D example (the paper shows the specification and describes the invariants in words). Verus does not run the code: it proves each check for every possible list. The “wrong test” version replaces > with < when it updates max.
Set the slider to 3 on the correct version. Three elements are seen: 3, 9 and 4. The marker sits on 9. Check one holds: 3, 9 and 4 are all at most 9. Check two holds: 9 is in the list. Slide to 5. The checks still hold, so at the end they imply the full postcondition and the verifier accepts.
Now switch to the wrong version. It starts with max = 3 and meets 9. Because it keeps the smaller value, max stays 3. Check one fails at once, since 9 is more than 3. The verifier rejects it at that line. No test list was needed to find the bug.
The third version is the interesting one. Its code is correct. But it has no invariants, so the verifier has nothing to hold on to after the loop and cannot prove the postcondition. It says no. This is incompleteness from Chapter 1 made visible: a correct program is rejected for missing proof, not for being wrong. The solver must write the proof as well as the program.
For the learning loop, treat all of this as text. The input x is the specification: a block of Rust with contract words, ending at the function signature. The output y is the body: Rust code with proof lines mixed in. The verifier is a function v(x, y) that returns 1 or 0.
The paper also shows a second example (its Figure 2): a sort function. The specification says the output is sorted: for every i < j, ret[i] <= ret[j]. The proof block adds a line that the output has the same multiset (the same elements with the same counts) as the input. Without that line the verifier cannot prove the function keeps the original data.
The paper measures on three test sets, all asking for Rust plus Verus code that the verifier accepts: Dafny2Verus (274 problems, translated from Dafny, a sister verification language), MBPP-Verified (78 problems) and HumanEval-Verified (85 functions). Chapter 7 reads the scores.
Chapter 3
Follow one full round of Propose, Solve, Verify and see the shape of the data at every step
Think of a school term. On day one the class has a pile of practice problems. Students attempt all of them. The teacher marks them with a strict answer key. Students study only the marked-right solutions. Then the teacher reads which problems were easy and which were hard, and writes new ones for next term. The pile grows. The student gets stronger. The cycle repeats.
That is PSV. The paper's Algorithm 1 is the cycle written as code. We take it apart line by line.
There are four things to track. The pool Xt is the set of specifications at iteration t. The solver Sθt is a code model with weights θ. The proposer Pφt is the model that writes new specifications. The verifier V is Verus. The question budget B is how many new specifications to add each round, and T is how many rounds to run.
// Algorithm 1 from the paper, one line per step, with our comments for t = 0 to T-1: Y_t, V_t <- SOLVE(S_theta_t, X_t, V) // 10 samples per spec, then verify each D_t <- (X_t, Y_t, V_t) // the data pool S_theta_t+1 <- TRAIN(S_theta_0, D_t) // fine-tune the BASE model on verified samples P_phi_t+1 <- UPDATE(P_phi_0, D_t) // refresh the proposer's prompt examples X_t+1 <- X_t U PROPOSE(P_phi_t+1, D_t) // add B new specs to the pool
Two details in the code are easy to miss. First, TRAIN starts from θ0, the original base model, not from last round's solver. Each round trains from the same clean start on the whole accumulated data. Second, UPDATE starts from φ0 as well. The proposer is not trained with gradients. The paper updates it through in-context learning: the model's weights stay fixed, and only the examples in its prompt change.
Each step turns one kind of data into another. Here are the shapes, using the paper's settings.
The paper notes that the solving step is the most computationally intensive part of the pipeline. Look at the arithmetic. The solver writes ten programs per spec, so a pool of 1,000 specs means 10,000 programs to verify. And because the pool only grows, each round costs more than the last.
Press Step to move through the five stages of a round. The bars show the pool at the start of each round. Drag the budget to see how fast the cost grows.
The 274 seed specs and the 10 samples per spec are the paper’s. The budget B is yours to set; the paper varies it from 1,000 to 32,000 questions per round across its runs, so 100 to 1,000 per round is a toy range.
Run it. At B = 400, iteration 0 has 274 specs, so the solver writes 2,740 programs. After the first propose step the pool is 674, and iteration 1 needs 6,740 programs. By iteration 4 the pool is 1,874 specs, and one round needs 18,740 programs. The cost grows in a straight line with the pool, and the total over many rounds grows faster still.
It may look wasteful to retrain from the original weights each round. The paper does not give a reason, so this is our reading. A fresh start means each solver is a function of the base model and one data pool, nothing else. Training errors from round 2 cannot pile up inside round 3’s weights. The price is more training compute, which the paper reports as small: one run takes about 20 minutes at the final iteration. The pool, by contrast, does carry over, and that is where the learning accumulates.
The solver grows by studying what the verifier approves. The pool grows by the proposer reading how the solver did. Each side feeds the other, and the verifier sits between them as an answer key. The paper's name for the idea behind this is the generation-verification gap: checking an answer can be easier than finding one, and self-play can use that gap to bootstrap.
The setting is flexible. The paper tests two. In test-time training the seed is a benchmark's own specifications and the model trains on that benchmark alone. In transfer learning the seed is Dafny2Verus and the model is tested on MBPP and HumanEval, which it never saw. In both, human-written solutions are never trained on.
Chapter 4
Turn ten sampled programs into a pass rate, and derive the pass@k score that every table in the paper reports
A basketball player takes ten free throws and makes three. Her pass rate is 3 out of 10, or 0.3. Ask a different question: if she may take five shots and only needs one to go in, what are her chances? Much higher than 0.3. Both numbers matter, and the paper uses both.
For each specification xi in the pool, the solver writes ktrn = 10 different programs. To make them differ, the paper samples at temperature 0.8. Temperature is a spread knob: at low values the model repeats its single favourite answer, at higher values it explores. Ten identical programs would teach nothing.
The prompt is a 1-shot prompt, following the AlphaVerus setup: one worked example of a specification with its verified solution, then the new specification. The paper found that more examples improved the score but made runs much slower, and the method was improving without them. The sampling runs on SGLang, an inference server, spread over 8 GPUs.
# SOLVE: one round, shapes in comments. spec_pool has N_t strings. def solve(solver, spec_pool, verifier, k=10, temp=0.8): Y, V = [], [] for x in spec_pool: prompt = ONE_SHOT_EXAMPLE + x # text in ys = [solver.sample(prompt, temperature=temp) for _ in range(k)] # k programs out vs = [verifier(x, y) for y in ys] # k values, each 0 or 1 Y.append(ys); V.append(vs) return Y, V # Y, V: N_t x k
The verifier then runs on every candidate. This is the step that cannot be fooled. Each candidate gets a 1 only if Verus proves it meets the specification. The pass rate of problem i is the share of ones in its row, written ri,t.
The paper reports pass@k: the chance that at least one of k attempts passes. You have n samples for a problem and c of them verified. How do you estimate pass@k from them?
Draw k of your n samples at random, without putting any back. You fail only if all k land in the n − c failed ones. Count the ways. There are C(n − c, k) ways to pick k failures, out of C(n, k) ways to pick any k. So the chance of failing is their ratio, and pass@k is one minus it.
Work the free-throw case as ten sampled programs with three verified. For k = 1: C(7,1) / C(10,1) = 7/10, so pass@1 = 0.3, which is just c/n. For k = 5: C(7,5) = 21 and C(10,5) = 252, so the failure chance is 21/252 = 0.083 and pass@5 = 0.917. For k = 10: only 7 samples failed, so you cannot pick 10 failures, and pass@10 = 1.
Each button is one sampled program for the same problem. Press a button to flip it between verified and rejected. The bars show pass@1, pass@5 and pass@10 computed from the formula above.
The formula and the thresholds (easy at 0.8 and above, medium from 0.2, hard above 0, impossible at 0) are the paper’s. Which samples pass is yours to choose; the numbers here use n = 10 as in training, while the paper’s evaluation uses n = 100.
Slide through it. With 3 verified, pass@1 is 30.0% but pass@5 is 91.7%. With 1 verified, pass@1 is 10% and pass@5 is 50%. A single verified sample out of ten already gives half a chance within five tries. This is why the loop works at all: even a hard problem yields some training data if you sample enough.
Here is a failure the loop meets often. The symptom: a problem whose ten samples all come back 0. It teaches the solver nothing this round, since there is no verified program to train on. The measurement: count the rows of V that are all zeros; the paper calls these impossible for the current solver. The fix is not to give up on them. They are useful as hard examples in the proposer's prompt, and a stronger solver may crack them next round.
A second filter protects the budget. Before the solver sees a proposed specification, a spec verifier checks that it compiles. It uses a Verus trick: mark the function external_body, so Verus trusts the signature and skips the body, then check that the contract itself is well formed. Invalid specs cannot be solved, so skipping them wastes no accuracy. Chapter 8 shows how much compute it saves.
Chapter 5
Derive the rejection fine-tuning loss, work one number through it, and see why the paper avoids methods that punish failures
A cooking student tries a recipe ten times. A strict judge tastes every dish and approves three. The student does not study the seven rejected dishes. She re-reads the three approved ones, and cooks more like them. After enough rounds, her good dishes become her normal dishes.
That is rejection fine-tuning, or RFT. Sample many answers, reject the ones the judge fails, and train the model to imitate the survivors. The paper takes it from earlier work on expert iteration (Singh et al., 2024) and notes it can be read as an offline reinforcement learning method based on expectation-maximization. In plain words: guess, keep what works, learn from it, repeat.
After the solving step you hold the table of programs Yt and the table of verdicts Vt. The data for one round of RFT is the set of pairs where the verdict is 1.
Then one more step: trim the set so each problem keeps at most one solution. A problem the solver finds easy might have ten verified programs. Without trimming, easy problems would fill most of the training set. With trimming, every solved problem counts once.
Training is supervised fine-tuning (SFT): show the model an input and the target text, and nudge its weights so that it would have written that target. A language model writes one token at a time. At each position it gives every possible next token a probability. The training signal is how much probability it gave the token that was actually there.
Why a minus sign and a log? A probability near 1 has a log near 0, so a model that is sure of the right token pays almost nothing. A probability near 0 has a large negative log, so the minus sign makes a big penalty. Lowering the loss means raising the probability of the verified programs.
Work a toy case. A four-token program gets probabilities 0.5, 0.8, 0.25 and 0.9. The logs are −0.693, −0.223, −1.386 and −0.105. The sum is −2.408, so this program adds 2.408 to the loss. After a training step the probabilities might rise to 0.6, 0.85, 0.35 and 0.92. The new sum is 1.807. The model now finds this program likelier. (These are made-up numbers to show the arithmetic.)
Each round trains the base model again, on all data so far. The paper uses LoRA, a cheap form of fine-tuning that trains small add-on matrices instead of every weight (our LoRA lesson explains it). The settings, from Appendix E: rank 16, alpha 32, learning rate 2e-4, 3 epochs, maximum sequence length 2,048 tokens, batch size 1 with gradient accumulation of 8, using Hugging Face’s trl library. A training run at the final iteration takes about 20 minutes on one A6000. The solving step, not training, is the expensive part.
Modern reasoning models are often trained with reinforcement learning from verifiable rewards, for example GRPO. GRPO gives each sample an advantage: how much better than the group average it scored. A sample above average gets pushed up. A sample below average gets pushed down.
The paper says it chose RFT because Verus is sound but not complete. Remember Chapter 1: Verus can reject a correct program for lack of proof. An advantage-weighted method would then punish that correct program, since it scored below average. RFT only ever copies verified examples. A missed correct program costs one lost example, not an active push against good behaviour.
Ten sampled programs. Three are verified. Some of the others are correct but the verifier could not prove them. Drag how many, and switch the training rule.
Illustrative. The advantage here is the simplest kind, a sample’s verdict (1 or 0) minus the group average; real GRPO also divides by the group’s spread. The rule that RFT keeps at most one verified program per problem is the paper’s, so only the first verified sample gets weight.
Set the slider to 2 and choose the advantage rule. The group average verdict is 3/10 = 0.3. Each verified program gets +0.70, and every other sample gets −0.30, including the two that were correct. Training pushes those two correct programs down. Switch to RFT. The two correct programs get zero weight. The training set is poorer by two examples, and no harm is done.
Chapter 6
Label each problem by how often the solver passes it, then prompt a model with those labels to write the next batch
A good coach gives a player drills at the edge of her ability. A drill she always wins teaches nothing. A drill she never wins teaches nothing either, because she cannot find a foothold. The best drills are ones she wins about half the time.
To pick such drills, the coach needs to know the player's record. The proposer needs the same thing. Its record is the table of verdicts from Chapter 4.
The paper estimates how hard a problem is for the current solver, using the pass rate ri,t, the share of the ten samples that Verus accepted. Two thresholds cut the range into four classes.
With ten samples the pass rate can only be 0, 0.1, 0.2 and so on up to 1.0. So the classes are easy at 8, 9 or 10 verified; medium at 2 to 7; hard at exactly 1; impossible at 0. The labels move as the solver improves. A problem that is hard in round 1 may be easy in round 4.
The proposer is a language model that is shown examples and asked for more. This is in-context learning: no weights change, the examples in the prompt do the teaching. For each round, the paper samples kprop = 12 labelled specifications from the pool and builds the prompt. It uses uniform input and output targets. That means 3 examples from each of the four classes go in, and B/4 new specifications of each class are requested.
A simplified version of the paper’s prompt reads like this.
I would like you to output a problem that is of {difficulty} level.
Here are some examples of problems and how difficult they were for the model.
Problem 1: EASY
{problem spec}
Problem 2: HARD
{problem spec}
...
Now it's your turn! Please describe your reasoning, then output a new problem
that is {difficulty}.
The full prompt in the paper’s Appendix A adds three rules. The model must reason first, then give the specification inside rust code tags so it can be parsed. It must not copy an example. It must not write an implementation, and must end the function with an open curly brace, which leaves the body for the solver. The proposer is told to make easy problems harder, hard ones easier, or both in some creative combination. The labels give it a ruler.
After the model replies, the pipeline parses the specifications out, removes duplicates and filters them through the spec verifier from Chapter 4. Only well-formed unique specifications join the pool.
The squares are a toy pool of 40 problems, grouped by difficulty class. Rings mark the 12 shown to the proposer. The bars show what it is asked to write. Choose a setting from the paper’s Table 3, then press Resample.
The pool is a toy (14 easy, 12 medium, 9 hard, 5 impossible) and the budget B = 400 is our choice. The 12 examples, the four classes, the settings and the average scores (Table 3 average over nine metrics) are the paper’s.
Under the paper’s setting, the prompt gets 3 examples of each class and the model is asked for 100 problems of each class when B = 400. The other settings were worse. Asking only for hard problems (average 41.66) or only easy ones (40.13) did less well than the balanced mix (43.31). Showing only easy examples to get hard ones, the idea behind WizardCoder-style evolution, was worst (38.10). The paper concludes that showing as much of the pool as possible, and asking for a spread of difficulties, gives the most diverse and useful problems.
Does asking for a hard problem produce a hard problem? The paper checks. It measures the actual pass rate of the solver on the problems the proposer made at each target. The answer is a modest yes.
Each bar is the average pass rate of problems the proposer wrote when asked for that level. The line is one standard deviation each side. Choose a target.
The means and standard deviations are the paper’s (Section 6.3, for PSV-Verus): easy 0.55 (std 0.47), medium 0.45 (std 0.42), hard 0.36 (std 0.39). The whiskers are drawn clipped to the range 0 to 1.
The means do fall in the right order: 0.55, 0.45, 0.36. But the standard deviations, 0.47, 0.42 and 0.39, are as wide as the gaps. A problem asked for as hard can easily turn out easy, and the reverse. The paper's reading is that difficulty prompting gives partial but incomplete control, and still adds a modest benefit (Chapter 8). It also names better control as an open area.
Chapter 7
Learn who PSV-Verus is compared with, which comparison isolates the new idea, and what the numbers do and do not show
You open a results table. Rows are methods, columns are tests, and one row is in bold. Before you trust the bold row, ask three questions. What is each row? What are the columns measuring? Which pair of rows differs in only one thing?
AlphaVerus (Aggarwal et al., 2024, the earlier state of the art, in its version without tree refinement) is not trained here at all. It prompts a model with 50 in-domain examples. It is the same in both settings, so it sits in an “inference only” row.
RFT is the iterative rejection fine-tuning from Chapter 5, with no proposer. It trains on verified solutions to the seed problems only, with the same parameters as PSV. PSV-Verus is the full method: the same loop plus the proposer.
The pair that isolates the paper’s idea is RFT versus PSV-Verus. Everything else is held the same: base model (Qwen2.5-Coder-3B-Instruct), verifier, sampling and training settings. Only the proposed problems differ. AlphaVerus is the comparison with prior work, but it differs in several ways at once.
Three test sets, each scored at pass@1, pass@5 and pass@10 (Chapter 4), each averaged over 5 random seeds with a standard error. Two settings. In test-time training, the model starts from a benchmark’s own questions and trains on that benchmark alone, with no human solutions. In transfer learning, it trains from Dafny2Verus only and is scored on MBPP and HumanEval, which it never saw.
Choose a setting, a benchmark and a score. The bars show the three methods side by side. PSV-Verus is the warm bar.
All values are the paper’s Table 1 (mean over 5 seeds). In transfer learning Dafny2Verus is the training set, so the paper reports no score for it there. The ratios are computed from the table values.
The paper also plots the curves behind these numbers (its Figure 4). For each of the three test-time training tasks, it draws pass@1, pass@5 and pass@10 against the iteration, from 0 to 5, with a shaded cloud of one standard deviation across the 5 seeds. In our reading of the figure, every line climbs as the rounds go on. The pass@5 and pass@10 lines sit close together, with pass@1 below them. The clouds are narrow on Dafny2Verus and MBPP and wider on HumanEval. Hold that picture: the gain builds up over rounds instead of arriving in one jump.
In test-time training on Dafny2Verus, PSV-Verus reaches 65.63% pass@1. AlphaVerus gets 24.06%, a 2.73-fold gap. RFT gets 34.46%, a 1.90-fold gap. On pass@10, PSV-Verus gets 80.06%, against 63.40% for RFT and 63.44% for AlphaVerus, a 1.26-fold gap.
On MBPP the ratios are larger because the baselines start low. PSV-Verus pass@1 is 36.78%, against 6.48% for AlphaVerus (5.68-fold) and 3.83% for RFT (9.6-fold). The abstract’s “up to 9.6 times” is this cell. On HumanEval, 19.07% against 7.24% (2.63-fold) and 5.56% (3.43-fold).
Averaged over all nine benchmark and score cells, PSV-Verus reaches 48.12%, against 25.43% for RFT and 25.55% for AlphaVerus. Those are 1.89 and 1.88 times better.
In transfer, the gains are smaller but real. On MBPP, trained on Dafny2Verus only, PSV-Verus reaches 25.25% pass@1, against 6.48% for AlphaVerus and 10.99% for RFT. On HumanEval it reaches 16.18%, against 7.24% and 10.99%.
Four cautions help. First, large ratios on MBPP come from tiny bases: 3.83% to 36.78% is big as a ratio and still means most problems are unsolved. The absolute scores on MBPP and HumanEval stay low, because writing proved Rust is hard.
Second, test-time training uses the test set’s questions (never its human solutions) as the seed. That is a different promise from a model that has never seen the test problems. Transfer is the held-out setting, and its gains are the smaller ones.
Third, the benchmarks are small: 274, 78 and 85 problems. The paper reports means over 5 seeds with standard errors, and marks the best results by a paired t-test at p < 0.05. Small sets mean one problem moves a score by over one point.
Fourth, the compute is modest. The main experiment takes about 24 hours on one machine with 8 L40S GPUs, and the base model has 3 billion parameters. The authors say they chose the settings as a proof of concept at minimal compute scale.
One more detail, which we read off by matching numbers: the PSV-Verus row of the paper’s ablation Table 2 combines the test-time training Dafny2Verus scores with the transfer MBPP and HumanEval scores. Keep that in mind when you compare it with Table 1.
Chapter 8
Remove each part of the method to see what it buys, see how the score grows with budget, and list what the paper does not claim
A baker removes one ingredient at a time from a cake recipe and tastes the result. If the cake gets much worse, that ingredient matters. An ablation is the same test for a method. The paper removes three parts: solution verification, difficulty labels and prompt diversity.
Minus verification. Train on every sampled solution and ignore the verifier. This is the hero’s unit-test case taken to the limit: now everything gets in. The result is the largest drop. Relative to the full method, pass@1 falls 51.5% on Dafny2Verus, 55.2% on MBPP and 52.1% on HumanEval. The average over nine cells falls from 43.31 to 27.90.
Minus difficulty. Remove the EASY, HARD labels from the proposer’s prompt (the prompt in Appendix G). The average falls from 43.31 to 40.87, a drop of 5.6%. The drop is statistically significant in 6 of 9 cells, including all three Dafny2Verus cells.
Minus diversity. Replace the constantly refreshed prompt by a fixed one, sampled once from the seed set, as in earlier self-instruct pipelines. The average falls to 38.71, a drop of 10.6%.
Choose a score. The top bar is the full method. Each bar below removes one part. Press a part name to read its story.
All scores are the paper’s Table 2, a mean over 5 seeds. The PSV-Verus row combines the Dafny2Verus test-time-training score with the MBPP and HumanEval transfer scores (our reading from matching numbers with Table 1).
Why does diversity matter so much? The paper measured it. With the fixed prompt, only 29.3% of proposed questions were unique. With the refreshed prompt, 45.3% were. That meant 2.48 times more unique questions and 2.26 times more solvable ones to learn from. The symptom of a low-diversity proposer is a pool full of near-copies. The measurement is the uniqueness rate. The fix is to re-sample the examples from the growing pool every round.
Verification also pays in compute. Without the spec compile check, only 47.7% of unique proposed specs were valid on average. The solver would have run pass@10 inference on the 52.3% that could never be solved, a 2.1 times increase in inference compute with no gain in score.
Two questions are practical. Does the score grow if you propose more questions per round? And, for a fixed number of questions, is it better to spread them across more rounds?
Choose how to spend more compute. Each pair of bars is pass@1 before and after.
Values are the paper’s test-time-training results (Section 6.1 and 6.2, Figures 5 and 6), read from its text; the paper gives only the end points, so no curve is drawn between them. Dafny2Verus starts at 4k questions, the others at 1k.
More questions help on all three benchmarks. On Dafny2Verus, going from 4,000 to 32,000 questions per round lifts pass@1 from 59.5% to 74.3%. On MBPP, 1,000 to 32,000 lifts it from 22.3% to 44.3%. On HumanEval, from 13.9% to 26.3%. Questions are the factor you can scale in parallel across many machines.
More rounds also help, for the same budget. With 1,000 questions in total on Dafny2Verus, one round of 1,000 scores 21.0% pass@1. Five rounds of 200 score 42.3%, a rise of 102%. The same shape holds at 2,000 questions (26.3% to 44.3%) and 4,000 (28.0% to 46.9%). The solver learns between rounds, and the proposer then writes problems for that stronger solver. That feedback is the point of self-play.
Look at what the two scaling studies share. In both, the extra compute goes into proposing and solving, not into a bigger model. The paper’s own phrasing is that this is a first step in understanding the limits of scaling for self-play reasoning training. No curve here has been shown to flatten, but the authors stop at 32,000 questions, so how far the trend runs is unknown.
Read the limits as carefully as the results.
Chapter 9
Keep the numbers, the checklist and the core code, and see where this paper sits in the field
Here is the whole paper in one paragraph. Self-play needs a grader that never accepts a wrong answer. Unit tests cannot do that, because a program can pass them and still be wrong. A formal verifier can: if Verus accepts, the program meets its specification for all inputs. So PSV runs a loop. A proposer writes specifications at chosen difficulty levels. A solver writes ten programs for each. Verus marks each 0 or 1. The solver is retrained from the base model on the verified programs, one per problem. The proposer sees the new pass rates and writes the next batch.
With a 3B model, this lifts Dafny2Verus pass@1 from 34.46% (RFT) to 65.63%, and each of verification, difficulty labels and prompt diversity matters.
| Quantity | Value | What it is |
|---|---|---|
| ktrn | 10 | Programs sampled per specification, at temperature 0.8 |
| kprop | 12 | Labelled examples in the proposer prompt, 3 per class |
| τE, τM | 0.8, 0.2 | Pass-rate cuts for easy and medium |
| B / 4 | per class | New specs requested of each of the four classes |
| Seed sets | 274, 78, 85 | Dafny2Verus, MBPP-Verified, HumanEval-Verified |
| Base model | 3B | Qwen2.5-Coder-3B-Instruct, with LoRA rank 16, alpha 32, learning rate 2e-4, 3 epochs |
| Compute | 24 h | Main experiment, 8 L40S GPUs; one SFT run takes about 20 min on an A6000 |
| Dafny2Verus pass@1 | 65.63% | PSV-Verus, against 34.46% for RFT and 24.06% for AlphaVerus |
| MBPP pass@1 | 36.78% | PSV-Verus, against 3.83% for RFT: the 9.6 times in the abstract |
| Ablation average | 43.31 | Falls to 27.90 without verification, 38.71 without diversity, 40.87 without difficulty |
| Valid specs | 47.7% | Share of unique proposed specs that compile; skipping the check costs 2.1 times the inference |
| Unique questions | 45.3% | With a refreshed prompt, against 29.3% with a fixed one |
This is the paper’s Algorithm 1 as a runnable skeleton. The helper names stand for the pieces in Chapters 4 to 6.
def classify(r, tau_e=0.8, tau_m=0.2): # Chapter 6 return "easy" if r >= tau_e else "medium" if r >= tau_m else "hard" if r > 0 else "impossible" def psv(seed_specs, base, proposer_llm, verus, T=5, B=400, k=10): pool = list(seed_specs) # X_0: list[str] model = base # the current solver S_t for t in range(T): # SOLVE + VERIFY: Y is N x k code strings, V is N x k of 0/1 Y = [[solver(model, x, temp=0.8) for _ in range(k)] for x in pool] V = [[verus(x, y) for y in ys] for x, ys in zip(pool, Y)] # TRAIN: verified pairs, at most one per problem, from the BASE weights data = [(x, next(y for y, v in zip(ys, vs) if v)) for x, ys, vs in zip(pool, Y, V) if any(vs)] model = lora_sft(base, data) # loss: -sum log p(y[k] | x, y[:k]) # UPDATE + PROPOSE: label by pass rate, 3 examples per class, ask for B/4 per class labelled = [(x, classify(sum(vs) / k)) for x, vs in zip(pool, V)] new = [] for level in ("easy", "medium", "hard", "impossible"): new += propose(proposer_llm, sample_examples(labelled, per_class=3), level, B // 4) new = [s for s in dedupe(new) if spec_compiles(s)] # external_body check pool += new # X_t+1 = X_t U new return model
If you want to reimplement the loop, build it in this order. First, get the verifier running on a handful of specifications with known solutions, and confirm it rejects a program you know is wrong. Second, write the solve step and look at the table of verdicts for a few problems. Third, add the RFT step and watch the pass rate on the seed set move. Only then add the proposer. Each piece can be tested alone, and the proposer is the part most likely to hide bugs behind plausible-looking output.
The authors say the method applies in principle to any problem with a sound verifier. Test your own idea against the conditions the paper relies on.
Tick each condition your domain meets. The read-out says what is missing.
Our own checklist, built from the conditions the paper uses and the failures it measures. It is a thinking aid, not a score from the paper.
PSV starts from the same translated seed corpus as AlphaVerus and adds the self-play loop on top. It follows self-play theorem provers such as STP, which also train a proposer, and recent proposer-solver work on code and language. Its reward is the kind used in reinforcement learning from verifiable rewards, but its learning rule is the older expert-iteration idea of copying verified successes. The common thread with the lecture is simple: when the grader is trustworthy, a model can generate its own curriculum.
Keep going. The lecture this reading belongs to is RL in Practice and Self-Play. For verifiable rewards and GRPO, read Alignment and RLVR and GRPO and DAPO. For training with a small add-on, read LoRA. For a model that grades itself, read Self-Rewarding Language Models, and for the question of what RL adds beyond the base model, RL Beyond the Base Model.
Now try it again. Go back to the hero and run both checkers. Then open Present to teach the loop back in your own words, or Teach to draw it on the whiteboard.
This lesson re-teaches “Propose, Solve, Verify: Self-Play Through Formal Verification” by Alex Wilf, Pranjal Aggarwal, Bryan Parno, Daniel Fried, Louis-Philippe Morency, Paul Pu Liang and Sean Welleck, of Carnegie Mellon University and MIT (arXiv 2512.18160, December 2025, a preprint under review). Read it at arxiv.org/abs/2512.18160. The authors release their code and models at github.com/abwilf/psv. All numbers here are from the paper; toy devices are marked as illustrative. It is a reading for MIT MAS.S62 “How to AI an AI for (Almost) Anything” (Fall 2026), from the course schedule.