Recomputing the six-update rank correlations
Companion to Mathematics on Tap: Agents, Lean, and the Research Loop and to the study note. The data file contains all six reported diagnostic scores and all 72 final sampled MATH-500 accuracies for the six updates. These are the reported summaries, rather than raw response-level logs. The standard-library script recomputes the three correlations, including tied ranks; no training or network access is needed. With both files in one directory:
python3 check.py
Output:
First set of three runs: rho=0.637748 (reported 0.64)
Second set of three runs: rho=0.985611 (reported 0.99)
Set of six runs: rho=0.985611 (reported 0.99)
PASS: all three separately computed correlations match the report.
The data file
{
"description": "Reported pretraining relative alignment scores and final MATH-500 mean sampled correctness (percent); three replication sets kept separate.",
"pass_threshold": 0.6,
"scores": {
"reinforce": 1.0,
"no_all_wrong": 1.21,
"reweighting": 1.1,
"removal_reweighted": 1.1,
"no_all_correct": 0.71,
"grpo_pair": 0.84
},
"names": {
"reinforce": "±1 REINFORCE",
"no_all_wrong": "Without the all-wrong pairs",
"reweighting": "The reweighting alone (every pair kept)",
"removal_reweighted": "The removal reweighted to ±1 REINFORCE's expected update",
"no_all_correct": "Without the all-correct pairs",
"grpo_pair": "Without both (GRPO on a pair)"
},
"runs": {
"first": {
"reinforce": [
53.0625,
53.05,
52.25
],
"no_all_wrong": [
53.225,
52.4875,
52.6375
],
"reweighting": [
52.8875,
52.85,
53.4375
],
"removal_reweighted": [
54.1,
52.8125,
53.5875
],
"no_all_correct": [
49.275,
49.7875,
49.8625
],
"grpo_pair": [
50.825,
50.125,
51.5625
]
},
"second": {
"reinforce": [
51.325,
52.875,
52.625
],
"no_all_wrong": [
54.2125,
53.375,
53.4625
],
"reweighting": [
51.9875,
53.6125,
53.1375
],
"removal_reweighted": [
52.4,
54.1375,
52.825
],
"no_all_correct": [
48.925,
49.5875,
49.1125
],
"grpo_pair": [
49.1125,
51.425,
51.05
]
},
"six": {
"reinforce": [
52.7,
52.125,
52.5,
52.15,
52.3625,
52.6375
],
"no_all_wrong": [
53.25,
54.15,
54.4375,
53.6875,
53.6125,
52.35
],
"reweighting": [
52.8125,
53.3375,
53.35,
52.95,
52.375,
52.6125
],
"removal_reweighted": [
53.4,
52.3875,
53.5875,
53.175,
52.575,
52.6875
],
"no_all_correct": [
48.9375,
49.4125,
49.9125,
50.2625,
49.3375,
49.1
],
"grpo_pair": [
51.5125,
49.6,
50.5125,
51.1125,
50.7875,
50.6
]
}
},
"sets": [
{
"key": "first",
"label": "First set of three runs",
"reported_rho": 0.64
},
{
"key": "second",
"label": "Second set of three runs",
"reported_rho": 0.99
},
{
"key": "six",
"label": "Set of six runs",
"reported_rho": 0.99
}
]
}
The script
"""Recompute the blog's three rank correlations from reported summary data.
Run with Python 3 (standard library only). No training or network access.
"""
import json
import math
import statistics
from pathlib import Path
def average_ranks(values):
"""One-based ranks, averaging tied positions."""
ordered = sorted(values)
return [
statistics.mean(i + 1 for i, v in enumerate(ordered) if v == value)
for value in values
]
def spearman(xs, ys):
rx, ry = average_ranks(xs), average_ranks(ys)
dx = [v - statistics.mean(rx) for v in rx]
dy = [v - statistics.mean(ry) for v in ry]
return sum(x * y for x, y in zip(dx, dy)) / math.sqrt(
sum(x * x for x in dx) * sum(y * y for y in dy)
)
def main():
data = json.loads(Path(__file__).with_name("results.json").read_text())
arms = list(data["scores"])
scores = [data["scores"][arm] for arm in arms]
for group in data["sets"]:
runs = data["runs"][group["key"]]
assert set(runs) == set(arms)
means = [statistics.mean(runs[arm]) for arm in arms]
rho = spearman(scores, means)
assert round(rho, 2) == group["reported_rho"], (group["key"], rho)
assert rho >= data["pass_threshold"], (group["key"], rho)
print(f"{group['label']}: rho={rho:.6f} (reported {rho:.2f})")
print("PASS: all three separately computed correlations match the report.")
if __name__ == "__main__":
main()