#!/usr/bin/env python """Write README.md model cards into each upload source dir. No training steps, no eval scores — only base model, task, stage, the specific data split used, public evaluation contract, links, citation. """ import os WORK = "/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training" # repo_name -> (src_dir, task_id, stage_key) REPOS = { "ABForge-Qwen3-8B-Task1-SFT": (f"{WORK}/hf_upload/ABForge-Qwen3-8B-Task1-SFT", 1, "sft"), "ABForge-Qwen3-8B-Task1-RL": (f"{WORK}/infer/task1_v18_3_ckpt100_bench44_merged_hf", 1, "rl"), "ABForge-Qwen3-8B-Task1": (f"{WORK}/infer/task1_v18_4_from_sft_ckpt100_bench44_merged_hf", 1, "sftrl"), "ABForge-Qwen3-8B-Task2-SFT": (f"{WORK}/hf_upload/ABForge-Qwen3-8B-Task2-SFT", 2, "sft"), "ABForge-Qwen3-8B-Task2-RL": (f"{WORK}/infer/task2_v3_ckpt150_merged_hf", 2, "rl"), "ABForge-Qwen3-8B-Task2": (f"{WORK}/checkpoints/abforge_task2/qwen3_8b_grpo_vllm_azurejudge_rubricv2_from_sft_cleaned285_v1/global_step_100/hf_merged", 2, "sftrl"), } TASK = { 1: ("Ablation Objective Identification", "Given the ablation-free context of a research paper, the model proposes candidate " "ablation objectives, each expressed as a **Target Module** (the component to ablate) " "paired with a **Research Question** it is meant to answer."), 2: ("Ablation Experiment Synthesis", "Given a paper's context and a goal, the model produces a detailed, controlled " "**ablation experiment design plan** (objective, setup, variants, fixed protocols and metrics)."), } STAGE = { "sft": ("SFT", "supervised fine-tuned from `Qwen/Qwen3-8B`"), "rl": ("GRPO", "trained with GRPO directly from `Qwen/Qwen3-8B` (no supervised warm-start), " "optimizing a fixed rubric-based reward"), "sftrl": ("SFT → GRPO", "post-trained with the full ABForge pipeline: supervised fine-tuning " "from `Qwen/Qwen3-8B` followed by rubric-guided GRPO"), } # specific data split per (task, stage), relative to SlowGuess/abforge-data DATA = { (1, "sft"): "SFT on `train/sft_task1_45961.jsonl`", (1, "rl"): "GRPO on `train/RL_task1_30K.jsonl`", (1, "sftrl"): "SFT on `train/sft_task1_45961.jsonl`, then GRPO on `train/RL_task1_30K.jsonl`", (2, "sft"): "SFT on `train/sft_task2_37019.jsonl`", (2, "rl"): "GRPO on `train/RL_task2_30K.jsonl`", (2, "sftrl"): "SFT on `train/sft_task2_37019.jsonl`, then GRPO on `train/RL_task2_30K.jsonl`", } EVAL_FILE = { 1: "data/eval/ablationbench_200.jsonl", 2: "data/eval/ablationbench_200.jsonl", } EVAL_RESPONSE_FIELD = {1: "infer_task1_response", 2: "infer_task2_response"} EVAL_COMMAND = {1: "scripts/evaluate_task1.sh", 2: "scripts/evaluate_task2.sh"} SIBLINGS = { 1: ["ABForge-Qwen3-8B-Task1", "ABForge-Qwen3-8B-Task1-SFT", "ABForge-Qwen3-8B-Task1-RL"], 2: ["ABForge-Qwen3-8B-Task2", "ABForge-Qwen3-8B-Task2-SFT", "ABForge-Qwen3-8B-Task2-RL"], } FRONTMATTER = """--- license: apache-2.0 language: - en base_model: Qwen/Qwen3-8B pipeline_tag: text-generation library_name: transformers tags: - ablation-study - scientific-reasoning - post-training - qwen3 --- """ def card(repo, task_id, stage_key): task_name, task_desc = TASK[task_id] stage_short, stage_desc = STAGE[stage_key] data_desc = DATA[(task_id, stage_key)] sibs = "\n".join( f"- [`SlowGuess/{s}`](https://huggingface.co/SlowGuess/{s})" + (" (this model)" if s == repo else "") for s in SIBLINGS[task_id] ) return f"""{FRONTMATTER} # {repo} An **ABForge** model for **Task {task_id}: {task_name}**. ABForge is a post-training pipeline for paper-grounded ablation design. This checkpoint is {stage_desc} (**{stage_short}**). ## Task {task_desc} ## Training data {data_desc}, from [`SlowGuess/abforge-data`](https://huggingface.co/datasets/SlowGuess/abforge-data) (derived from CC-licensed research papers). Evaluation uses the held-out **AblationBench** split (`eval/ablationbench_200.jsonl`) of the same dataset. ## Related models (Task {task_id}) {sibs} ## Evaluation Reproduce AblationBench scoring with the [`SlowGuess/Abforge_1`](https://github.com/SlowGuess/Abforge_1) code. The public repository intentionally does not depend on our internal scratch inference runners; generate predictions with any Transformers, vLLM, TGI, or OpenAI-compatible runner and write a JSONL file that preserves the benchmark fields plus one model-output field: For this Task {task_id} model, add `{EVAL_RESPONSE_FIELD[task_id]}`. Then run the public evaluator: ```bash git clone https://github.com/SlowGuess/Abforge_1 && cd Abforge_1 huggingface-cli download SlowGuess/abforge-data --repo-type dataset --local-dir data export MODEL_PATH=SlowGuess/{repo} # 1. Generate predictions on AblationBench with your preferred inference stack. # Input: {EVAL_FILE[task_id]} # Output: preds.jsonl, with each row retaining the input fields and adding # `{EVAL_RESPONSE_FIELD[task_id]}`. # 2. Score against the fixed AblationBench rubric using any OpenAI-compatible judge. export JUDGE_API_BASE=https://api.openai.com/v1 export JUDGE_API_KEY= export JUDGE_MODEL= {EVAL_COMMAND[task_id]} preds.jsonl --output scored.jsonl ``` ## Links - Dataset: [`SlowGuess/abforge-data`](https://huggingface.co/datasets/SlowGuess/abforge-data) - Code: [`SlowGuess/Abforge_1`](https://github.com/SlowGuess/Abforge_1) ## Citation ```bibtex @misc{{abforge, title = {{ABForge: Post-Training LLMs for Paper-Grounded Ablation Design}}, author = {{ABForge authors}}, year = {{2026}}, howpublished = {{\\url{{https://github.com/SlowGuess/Abforge_1}}}} }} ``` """ if __name__ == "__main__": for repo, (src, task_id, stage_key) in REPOS.items(): os.makedirs(src, exist_ok=True) with open(os.path.join(src, "README.md"), "w") as f: f.write(card(repo, task_id, stage_key)) print(f"wrote {src}/README.md ({repo})")