From group filtering to a prediction made before training

Companion to Mathematics on Tap: Agents, Lean, and the Research Loop. This note records the six-update ranking experiment used in the essay. The mathematical companion derives the filtering identity and the connection between gradient geometry and a clipped step.

The question and controls

Our Minimal-RL paper prompted a question about its Reinforce-Rej filter: what changes when groups with identical rewards receive zero policy coefficients? The inspected implementation masks multiresponse groups without changing the original loss denominator. The experiment here isolates the filtering choice with response pairs and signed rewards \(2R-1\), where \(R\) is binary correctness.

For IID on-policy pairs, the expected raw update has the form \(\omega(p)\nabla p\). Keeping every pair gives \(\omega=2\); zeroing all-wrong pairs gives \(1+p\); zeroing all-correct pairs gives \(2-p\); zeroing both gives 1. This suggests two controls:

  • Keep all pairs, but multiply their signed coefficients by \((1+\hat p)/2\). The expected update matches the rule that zeros all-wrong pairs.
  • Zero all-wrong pairs and multiply mixed-pair coefficients by \(2-\hat p\), leaving all-correct coefficients unchanged. The expected update matches the rule that keeps all pairs.

For each pair, \(\hat p\) is estimated from the prompt’s other independent pair. Its independence and unbiasedness give the two expectation identities under the on-policy model at each step. The controls preserve the original response denominator. They match raw means; the distributions of the stochastic updates still differ.

This is a controlled analysis of the filter, with different group size and training loss from the published Minimal-RL trainer. The earlier top-one RAFT example in the essay also differs from Minimal-RL’s RAFT++, which keeps all positive responses.

Prediction and measurement

The diagnostic is \(\mathcal S(U;G)=\mathbb E\langle U,G\rangle/\sqrt{\mathbb E\|U\|^2}\), where \(U\) is a random batch ascent update and \(G\) is the initial policy’s expected-reward gradient. Its denominator includes both the squared mean update and its sampling variance.

The scores below were fixed before training, relative to signed REINFORCE. The planning calculation estimates gradient projections from initial-model samples. It approximates the batch second moment using per-response squared score norms and coefficient second moments, omitting cross-response gradient inner products. These are estimated diagnostic scores used to predict a ranking.

Update Relative score
Keep all pairs: signed REINFORCE 1.00
Zero all-wrong pairs 1.21
Keep all pairs, reweighted to match zeroing all-wrong pairs 1.10
Zero all-wrong pairs, reweighted to match keeping all pairs 1.10
Zero all-correct pairs 0.71
Zero both homogeneous cases 0.84

The rank test covers these six rules without per-token importance weights. Two additional importance-weighted rules were trained as auxiliary comparisons and are outside this test. The pass criterion, fixed before training, was Spearman rank correlation of at least 0.6 between the six diagnostic scores and their final mean accuracies within each replication set. The two reported scores of 1.10 receive tied ranks.

Testing the prediction

We tested the prediction with Qwen2.5-Math-1.5B, trained with each update on its own samples of MATH training problems, drawn fresh at every step: four responses per problem at temperature 1, read as two pairs. Final accuracy is MATH-500 accuracy at temperature 1, 16 samples per problem with at most 2,048 tokens each, graded by the training verifier. Three sets of repeated runs were analyzed separately.

Reported result and recomputation

Replication set Runs per update Spearman correlation
First 3 0.64
Second 3 0.99
Third 6 0.99

Each correlation ranks six method means within its own set. The sets are never pooled. All three exceed the threshold fixed before training. This tests the diagnostic prospectively in this setting, on sampled accuracy. Greedy decoding of the same checkpoints was recorded as a descriptive measure outside the test: its six means spread over 1.0 to 1.3 points in each set, against about 4 points sampled, and its rank correlations with the scores were 0.14, −0.23 and 0.93.

The data file contains all six reported scores and all 72 final sampled MATH-500 accuracies for these rules. These are the reported summaries, rather than raw response-level logs. The standard-library script recomputes the three correlations, including tied ranks. With both files in one directory:

python3 check.py

The workflow is the contribution illustrated here: formalize a filtering choice, use its mean to construct controls, extend the model with gradient second moments, fix a prediction, and test it in training. Each step specifies what the next investigation needs to measure.