"""Write the dataset card (hf/dataset/README.md) and the Space's README from the exported results. python scripts/figures.py && python scripts/export.py && python scripts/card.py Every number in the card comes from hf/numbers.json, hf/space/data.json or training/kaggle/analysis.json. """ import json from pathlib import Path ROOT = Path(__file__).resolve().parent.parent HF = ROOT / "hf" DATASET_URL = "https://huggingface.co/datasets/JagritGumber/shortlist" SPACE_URL = "https://huggingface.co/spaces/JagritGumber/shortlist" RFC_URL = "https://github.com/openenv/OpenEnv/blob/main/rfcs/008-environment-auto-validation.md" OPENENV_COMMIT = "739b44b525d174700c11c328618a5ba41d5f428f" NAMES = {"connect4_env": "Connect 4", "connect4_env-patched": "Connect 4, with Beam's fix", "chess_env": "Chess", "maze_env": "Maze (`maze_env`)", "fraud_triage_env": "Fraud triage", "wildfire_env": "Wildfire", "snake_env": "Snake", "grid_world_env": "Grid world", "pelican_svg_env": "Pelican on a bicycle (SVG)", "dipg_safety_env": "DIPG medical safety", "sophistry_bench_sprint_env": "Sophistry bench"} OPENSPIEL = {"tic_tac_toe": "Tic-tac-toe", "kuhn_poker": "Kuhn poker", "cliff_walking": "Cliff walking"} GROUPS = [("worth", "Worth training on"), ("hard", "Too hard for the small model now"), ("nograd", "No gradient"), ("easy", "Too easy for Beam"), ("unsure", "Skill doesn't show yet"), ("weak", "Weak signal"), ("reach", "Out of reach for Beam"), ("flat", "Flat reward"), ("incomplete", "Couldn't be judged")] LEARNED = {"skill and format": "Partly skill, partly format", "mostly format": "Mostly format", "gamed": "Gamed the grader", "no real gain": "No real gain", "no change": "No change"} AUDIT = {"learned_skill": "learned the skill", "learned_format": "learned the format", "gamed_grader": "gamed the grader", "no_change": "no change"} EFFORT = {"beam-low": "low", "beam-medium": "medium", "beam-high": "high", "beam-xhigh": "extra-high", "beam-max": "max"} def name(suite: str) -> str: if suite.startswith("rg-"): return suite[3:].replace("_", " ").capitalize() if suite.startswith("os-"): return OPENSPIEL.get(suite[3:], suite[3:].replace("_", " ").capitalize()) if suite.startswith("hub-"): return f"`{suite[4:].replace('__', '/')}` (Hub)" return NAMES.get(suite, suite) def pct(x: float | None) -> str: return "–" if x is None else f"{x * 100:.0f}%" def pct1(x: float | None) -> str: return "–" if x is None else f"{x * 100:g}%" def pval(p: float) -> str: return "<0.001" if p < 0.001 else f"{p:.3f}" def verdict_tables(verdicts: list[dict]) -> str: out = [] parts = [("For the small model (Qwen3-0.6B)", [v for v in verdicts if v["group"] != "broken" and v.get("judged_for") == "small model"]), ("For Beam (no small model played these)", [v for v in verdicts if v["group"] != "broken" and v.get("judged_for") != "small model"])] for title, items in parts: out.append(f"**{title}**\n\n| Verdict | Count | Environments |\n|---|---|---|") for key, label in GROUPS: rows = [v for v in items if v["group"] == key] if rows: envs = ", ".join(name(v["suite"]) + (" *" if v.get("provisional") else "") + (" †" if v.get("gameable") else "") for v in rows) out.append(f"| {label} | {len(rows)} | {envs} |") out.append("") broken = [v for v in verdicts if v["group"] == "broken"] out.append(f"**Broken as shipped** ({len(broken)}): " + "; ".join(f"{name(v['suite'])}: {v['verdict'].split(': ', 1)[-1]}" for v in broken) + ".") out.append("\n\\* provisional: fewer than 4 tasks, so a first pass rather than a final call. " "† can be gamed: a no-skill answer pays more than the small model earns now (see below; added after training).") return "\n".join(out) def training_table(t: dict) -> str: rows = ["| Family | Predicted | Mean reward before → after (p) | Accuracy before → after | What the model learned | Beam's blind audit |", "|---|---|---|---|---|---|"] for r in t["rows"]: pred = ("reward rises" if r["prediction"] == "improves" else r["prediction"]) + (" ✓" if r["held"] else " ✗") learned = r["learned_text"].split(": ", 1)[-1] if r["learned_text"].startswith(("Partly", "Mostly")) else r["learned_text"] rows.append(f"| {r['family']} | {pred} | {r['reward_before']:.3f} → {r['reward_after']:.3f} ({pval(r['p'])}) | " f"{pct1(r['accuracy_before'])} → {pct1(r['accuracy_after'])} | **{LEARNED[r['learned']]}.** {learned[0].upper() + learned[1:]} | " f"{AUDIT.get(r['beam_audit'], r['beam_audit'])} |") return "\n".join(rows) def effort_table(effort: list[dict]) -> str: rows = ["| Task suite | Share solved on the first try, by effort |", "|---|---|"] names = [name(e["suite"]) for e in effort] for e in effort: label = name(e["suite"]) + (" (Reasoning Gym)" if e["suite"].startswith("rg-") and names.count(name(e["suite"])) > 1 else "") rows.append(f"| {label} | " + " · ".join(f"{EFFORT[p]} {pct(r['solved'])}" for p, r in e["rungs"].items()) + " |") return "\n".join(rows) def gaming_table(gaming: list[dict]) -> str: rows = ["| Family | Best no-skill answer | Its score (200 held-out tasks) | Small model now | Can be gamed |", "|---|---|---|---|---|"] for g in sorted(gaming, key=lambda x: -x["best"]["score"]): rows.append(f"| {g['family']} | {g['best']['label']} | {g['best']['score']:.3f} | {g['learner_mean']:.3f} | " f"{'**yes**' if g['gameable'] else 'no'} |") return "\n".join(rows) def forward_section(f: dict | None) -> str: if not f: return "" g, ev = f["evidence"]["gaming_check"], f["evidence"] top = list(g["most_common_correct_answers_on_training_tasks"].items()) res = {c["id"]: c for c in (f["result"] or {}).get("claims", [])} lines = [f"The check flags maze. On the {g['training_tasks']} training tasks the most common correct answers are " f"\"{top[0][0]}\" ({top[0][1]} tasks) and \"{top[1][0]}\" ({top[1][1]}), and answering \"{g['constant_answer']}\" to every " f"held-out task scores {g['its_held_out_score']:.3f}, while the small model earns " f"{ev['small_model_mean_reward_on_ladder']:.3f}. So before any maze training we published four claims " f"(`training/maze/predictions.json`, {f['written_at']}, SHA-256 `{f['sha256']}`). The method is unchanged.", "", "| Claim | Test | Result |", "|---|---|---|"] for c in f["claims"]: r = res.get(c["id"]) status = ("**held**" if r["held"] else "**failed**") + f": {r['measured']}" if r else "pending" lines.append(f"| {c['id']}. {c['claim']} | {c['test']} | {status} |") r = f["result"] if r: held = sum(c["held"] for c in r["claims"]) lines += ["", f"**{held} of {len(r['claims'])} claims held.** The model collapsed ({r['collapsed_share']:.0%} of its answers are one " f"text) and learned no maze-solving ({r['exact_before']} exact answers before training, {r['exact_after']} after), but " f"not onto \"5\". It found a different route, one the check didn't try: maze's grader (Reasoning Gym's default " f"`score_answer`) pays `len(answer) / len(reply)` whenever the right answer appears anywhere in the reply, so the " f"model writes a grid of the numbers {r['collapsed_answer_numbers']}. That grid contains the answer to all " f"{r['held_out_answers_inside_it']} held-out tasks and earns about {r['its_mean_score_if_given_everywhere']:.3f} on each, " f"so reward rose from {r['reward_before']:.3f} to {r['reward_after']:.3f} with no skill at all. The warning held; the " f"guess at which cheat was wrong, and the miss is a second loophole in the same grader. Files: `training/maze/results/`."] return "\n".join(lines) def census_table(c: dict) -> str: rows = ["| What happened | Spaces | Share |", "|---|---|---|"] rows += [f"| {g['group'][0].upper() + g['group'][1:]} | {g['count']} | {g['share'] * 100:.1f}% |" for g in c["groups"]] return "\n".join(rows) CARD = """--- pretty_name: Shortlist language: - en tags: - openenv - reinforcement-learning - rl-environments - grpo - evaluation - beam size_categories: - 1Kanalysis<|message|>` … `<|end|>`, which are single control tokens in Beam's Harmony-style chat format. When Beam writes them inside an answer they arrive mangled, so every answer took the −10 format penalty ({dipg_default} cleared the format check). With square-bracket markers, a setting DIPG already has, {dipg_sq} cleared it. ## The ladder and the checks | Rung | Player | |---|---| | Does nothing | Always takes the first allowed action. No model. | | Acts at random | Picks a random valid action. No model. | | Small model | Qwen3-0.6B, thinking off, served by llama.cpp (Q8_0). Reasoning Gym only: the model you would train. | | Beam, low → max | `Beam-1.0-501B-A23B` at each reasoning effort. | The checks, in `code/shortlist/checks.py`: - **Floor gap** (`semantic.floor_gap`): doing nothing or acting at random must not already earn the top reward. - **Reward reachability**: the strongest rung earns reward. - **Difficulty separation**: the strongest rung beats the floor (one-sided bootstrap, p ≤ 0.05). - **Headroom**: the best rung leaves room below the known maximum. - **Variance**: replaying one task varies less than the strongest rung's gain over the floor. - **Adversarial floor** (RFC 008 #26, Reasoning Gym only, added after training): no answer that needs no skill pays more than the learner earns now and at least a tenth of the top reward. The RFC leaves the procedure open; ours (`code/shortlist/gaming.py`) tries a constant answer, the question echoed back, and the task's input played back. - **GRPO signal**: the learner's repeated attempts at one task disagree on at least one task in five. Those are the only tasks a GRPO update learns from. - **For the small model** (`code/shortlist/trainee.py`): worth training if its mean reward is above zero, it solves under 95% on the first try, and its GRPO signal is at least 20%. Verdicts are judged for the small model where it played (Reasoning Gym), and for Beam everywhere else. ## Results ### The shortlist {verdict_tables} Per-suite numbers, every check and its statistics are in `verdicts.json`. ### Does the verdict predict training? The predictions for {families} small-model families were written first. Their SHA-256, `{sha}`, was committed to this repo at {committed} UTC; the first training checkpoint is from {first_ckpt} UTC. Qwen3-0.6B was then trained with GRPO for 100 steps per family (TRL, LoRA r=16, fp32, one Kaggle T4) and scored on the same 200 held-out tasks before and after. {training_table} The pre-registered criterion, "reward rises", held for all {families}. What moved reward was mostly a cheaper route the grader allows: a constant answer, the input played back, or a change of format. The do-nothing and random players can't see those routes, because each needs one specific answer, so a training run needs a second check once it finishes. Beam can run it. Its audit called letter counting and propositional logic gamed, chain sum a format gain, and leg counting unchanged, as we did. It caught the word-sorting echo before we did. On basic arithmetic it was stricter than our lenient re-score, which shows part of that gain is skill. Full write-up: `training/RESULTS.md`. ### Can the reward be gamed? Added after the training run above. Each family's own grader scores three answers that need no skill: the most common correct answer on the 400 training tasks (what GRPO would find), the question echoed back, and the task's input played back where it has one. A family can be gamed when the best of them pays more than the small model earns now and at least a tenth of the top reward. {gaming_table} ### A forward test: maze {forward_section} ### A ladder inside one model Higher efforts played one attempt per task and low effort three, so these are small samples. {effort_table} ### What's on the Hub {spaces} Spaces tagged `openenv`: the most-liked, plus a random sample of the rest. No model was used: each Space was woken, its OpenEnv routes tried, and one do-nothing and two random episodes played. Spaces still asleep got a second try with ten minutes to wake. {census_table} ## Files | Path | What it holds | |---|---| | `episodes.jsonl` | Every episode of the main run, one per line: suite, environment, player (`policy`), task, attempt, each step's action and reward, the return, tokens, and Beam's reasoning (trimmed to 2,000 characters per step). Episodes that failed for harness reasons are left out. | | `pilot_episodes.jsonl` | The earlier pilot runs, before the harness fixes. Not used for any verdict. | | `verdicts.json` | Per task suite: each rung's statistics, every check with its numbers, the verdict and who it was judged for. | | `census/` | The Hub census (`census.jsonl` first pass, `census2.jsonl` second pass), the sample (`chosen.json`) and Beam's setups (`setups/`). | | `fixes/` | For Connect 4: the evidence Beam was given, its reasoning, its reply and the patch. | | `training/` | Pre-registration, predictions and their SHA-256, results, Beam's audit, the lenient re-score, `analysis.json` and `RESULTS.md`. `training/maze/` holds the maze forward test. | | `gaming.json` | The can-it-be-gamed check: every no-skill answer tried, per family, with its score. | | `code/` | The Shortlist package, scripts, training code and the Kaggle notebook. | ## Reproduce Python 3.12, OpenEnv at commit `{openenv_commit}` cloned into `vendor/OpenEnv`, and `pip install -r code/requirements.txt` (each environment's own requirements are also needed to serve it). A Beam key goes in `REFLECTION_API_KEY` (we keep it encrypted with dotenvx). ```bash cd code python scripts/ladder.py --suites maze_env --tiers null,random # floors only, no key needed dotenvx run -- python scripts/ladder.py --suites rg:leg_counting --tiers null,random,beam-low python scripts/report.py runs/ # verdicts for a run python scripts/hub_sweep.py --top 150 --random 150 --out runs/hub/sweep # Hub census, no model dotenvx run -- python scripts/setup_env.py --from-census runs/hub/sweep/census.jsonl --limit 20 dotenvx run -- python scripts/fix.py connect4_env --evidence runs/fixes/connect4_env.evidence.md python scripts/figures.py && python scripts/export.py && python scripts/card.py # numbers, page data, this card ``` Training: run `training/shortlist_training_proof.ipynb` on Kaggle (one T4). Part 1 writes the predictions and prints their SHA-256; commit that before Part 2, which refuses to train unless the SHA matches. Then `training/rescore_lenient.py`, `training/audit_with_beam.py` and `training/analysis.py`. ## Limits - Most environments judged for Beam have two to four tasks, so those verdicts are provisional. - One small model, Qwen3-0.6B, and only on Reasoning Gym. - Training ran 100 GRPO steps per family, once each. Only five answers per family were saved after training, so the trained models can't be re-scored leniently, and the trained adapters weren't kept. - The lenient re-score regenerated the untrained model's answers with llama.cpp (Q8_0), not the fp32 weights used in training. The strict scores match closely. - Beam's setups for community environments guess the score range. Where a player scored above the guessed maximum, the guess is ignored. - Two Beam-side rules were added after the first results were in: a guessed maximum that a player beats is ignored, and environments judged for Beam need the same GRPO signal as the small model. Neither touches the pre-registered small-model rule. - The can-be-gamed check covers Reasoning Gym only, tries three cheap strategies, and was added after the training run. A family it passes may still be gameable another way: the maze run found one it didn't try, a reply that contains every likely answer. - The Hub census is a snapshot. Spaces sleep, wake and change. ## License Data: CC BY 4.0. Code (`code/`): Apache-2.0. Content that comes from each environment (its task text and observations, inside the episodes and the census) belongs to that environment's authors and keeps its own license. """ SPACE_CARD = """--- title: Shortlist emoji: 🪜 colorFrom: pink colorTo: purple sdk: static pinned: false license: apache-2.0 short_description: Which open RL environments can a model learn from? --- Shortlist runs the learnability checks OpenEnv's RFC 008 reserves for validation hubs. Beam plays each environment at every rung of a capability ladder; the checks sort the environments by whether a model can learn from them, and a GRPO training run tests the verdicts. Data, code and the training proof: [{dataset}]({dataset}). """ def main() -> None: n = json.loads((HF / "numbers.json").read_text()) d = json.loads((HF / "space" / "data.json").read_text()) t = json.loads((ROOT / "training" / "kaggle" / "analysis.json").read_text()) rose = [r for r in t["rows"] if r["prediction"] == "improves" and r["held"]] c4, c4f = n["connect4"]["as_shipped"], n["connect4"]["with_beams_fix"] won = lambda o: f"{o['won']} of {o['games']}" gate = lambda o: f"{o['cleared_format_gate']} of {o['answers']}" passes = next(g for g in n["census"]["groups"] if g["group"].startswith("runs and passes")) es = n["effort_summary"] gaming = json.loads((HF / "gaming.json").read_text()) af = n["adversarial_floor"] flag = {x["suite"]: x for x in af["flagged"]} card = CARD.format( rfc=RFC_URL, space=SPACE_URL, env=n["environments"], suites=n["task_suites"], episodes=n["episodes"], beam_ep=n["beam_episodes"], small_ep=n["small_episodes"], tokens=n["beam_output_tokens"], held=t["held"], families=t["families"], rose=len(rose), routes=sum(r["learned"] != "skill and format" for r in rose), eff_suites=es["suites"], eff_more=es["higher_solved_more"], eff_same=es["same"], eff_less=es["higher_solved_less"], spaces=n["census"]["spaces"], passes=passes["count"], passes_share=f"{passes['share'] * 100:.1f}%", dn1=n["census"]["do_nothing_at_least_1"], community=n["community_environments"], c4_null=won(c4["null"]), c4_random=won(c4["random"]), c4_beam=won(c4["beam-low"]), c4f_null=won(c4f["null"]), c4f_random=won(c4f["random"]), c4f_beam=won(c4f["beam-low"]), dipg_default=gate(n["dipg"]["default_markers"]), dipg_sq=gate(n["dipg"]["square_brackets"]), sha=t["pre_registration"]["sha256"], committed=t["pre_registration"]["committed_utc"], first_ckpt=t["pre_registration"]["first_checkpoint_utc"], openenv_commit=OPENENV_COMMIT, verdict_tables=verdict_tables(d["verdicts"]), training_table=training_table(t), effort_table=effort_table(d["effort"]), census_table=census_table(n["census"]), gaming_table=gaming_table(gaming), forward_section=forward_section(d.get("forward_test")), gameable=af["gameable"], gaming_families=af["families"], maze_score=f"{flag['rg-maze']['score']:.3f}", gol_score=f"{flag['rg-game_of_life']['score']:.3f}") (HF / "dataset" / "README.md").write_text(card) (HF / "space" / "README.md").write_text(SPACE_CARD.format(dataset=DATASET_URL)) print(f"wrote {HF / 'dataset' / 'README.md'} ({len(card.splitlines())} lines) and the Space README") if __name__ == "__main__": main()