Spaces:
Sleeping
Sleeping
Download seed_with_18_models.py from willchow66/AgentRobustBench: direct link, hf CLI and curl.
- Browser
- Download file 4.48 kB
-
https://huggingface.co/spaces/willchow66/AgentRobustBench/resolve/main/seed_with_18_models.py
- Command line
-
hf download hf://spaces/willchow66/AgentRobustBench/seed_with_18_models.py
-
curl -L -o seed_with_18_models.py https://huggingface.co/spaces/willchow66/AgentRobustBench/resolve/main/seed_with_18_models.py
4.48 kB
| """Seed the leaderboard CSV with our 18 evaluated models. | |
| Reads /projects/bfdz/xzhou10/robustbench/results/<model>/scores.json for each, | |
| extracts the overall + by-MDP-component accuracy numbers, writes one row per | |
| model to leaderboard.csv. Run once before the first deployment. | |
| Usage: | |
| python seed_with_18_models.py | |
| """ | |
| from __future__ import annotations | |
| import json | |
| from pathlib import Path | |
| import pandas as pd | |
| RESULTS = Path("/projects/bfdz/xzhou10/robustbench/results") | |
| OUT = Path(__file__).resolve().parent / "leaderboard.csv" | |
| # Display name -> result-directory basename | |
| MODELS = { | |
| # Family, Type, Result dir | |
| "ToolRL-Qwen2.5-1.5B": ("fine-tuned", "chengq9__ToolRL-Qwen2.5-1.5B"), | |
| "ToolRL-Qwen2.5-3B": ("fine-tuned", "chengq9__ToolRL-Qwen2.5-3B"), | |
| "ToolRL-Llama3.2-3B": ("fine-tuned", "chengq9__ToolRL-Llama3.2-3B"), | |
| "TL-CodeLLaMA-2": ("fine-tuned", "Junjie-Ye__TL-CodeLLaMA-2"), | |
| "LoopTool-8B": ("fine-tuned", "zhuiguang-ning__LoopTool-8B"), | |
| "LoopTool-32B": ("fine-tuned", "zhuiguang-ning__LoopTool-32B"), | |
| "MUA-RL-8B": ("fine-tuned", "zzwkk__MUA-RL-8B"), | |
| "MUA-RL-14B": ("fine-tuned", "zzwkk__MUA-RL-14B"), | |
| "MUA-RL-32B": ("fine-tuned", "zzwkk__MUA-RL-32B"), | |
| "Qwen2.5-1.5B-Instruct": ("open", "Qwen__Qwen2.5-1.5B-Instruct"), | |
| "Qwen2.5-3B-Instruct": ("open", "Qwen__Qwen2.5-3B-Instruct"), | |
| "Llama-3.2-3B-Instruct": ("open", "meta-llama__Llama-3.2-3B-Instruct"), | |
| "Qwen3-8B (non-thinking)": ("open", "Qwen__Qwen3-8B"), | |
| "Qwen3-14B (non-thinking)": ("open", "Qwen__Qwen3-14B"), | |
| "Qwen3-32B (non-thinking)": ("open", "Qwen__Qwen3-32B"), | |
| "Qwen3.5-9B": ("open", "Qwen__Qwen3.5-9B"), | |
| "DeepSeek-R1-Distill-Qwen-14B": ("open", "deepseek-ai__DeepSeek-R1-Distill-Qwen-14B"), | |
| "SFT-Clean-4k-Qwen2.5-3B (reproduced baseline)": | |
| ("fine-tuned", "__projects__bfdz__xzhou10__robustbench__sft_models__SFT-Clean-4k-Qwen2.5-3B-Instruct"), | |
| "ToolRL-DR-Full (ours)": ("fine-tuned", "HeadyZhang__qwen2.5-3b-toolrl-robustbench-perturbed"), | |
| "ToolRL-DR-Mixed (ours)": ("fine-tuned", "HeadyZhang__qwen2.5-3b-toolrl-robustbench-mixed"), | |
| "o4-mini (OpenAI)": ("closed", "openai__o4-mini"), | |
| } | |
| def main() -> None: | |
| rows = [] | |
| for model_name, (mtype, dirname) in MODELS.items(): | |
| scores_path = RESULTS / dirname / "scores.json" | |
| if not scores_path.exists(): | |
| print(f" SKIP {model_name}: no scores.json at {scores_path}") | |
| continue | |
| data = json.loads(scores_path.read_text()) | |
| ov = data["overall"]["overall"] | |
| by_mdp = data["overall"]["by_mdp_category"] | |
| by_pert = data["overall"].get("by_perturbation", {}) | |
| # Perturbed-only overall: exclude clean cell so the headline is the | |
| # actual sim-to-real robustness number. | |
| pert_correct = sum( | |
| v.get("correct", round(v["accuracy"] * v["n"])) | |
| for k, v in by_pert.items() if k != "clean" | |
| ) | |
| pert_n = sum(v["n"] for k, v in by_pert.items() if k != "clean") | |
| pert_acc = pert_correct / pert_n if pert_n else 0.0 | |
| rows.append({ | |
| "Model": model_name, | |
| "Type": mtype, | |
| "Pert. Acc.": round(pert_acc, 4), | |
| "Clean": round(by_mdp.get("clean", {}).get("accuracy", 0), 4), | |
| "Obs Acc.": round(by_mdp.get("observation",{}).get("accuracy", 0), 4), | |
| "Action Acc.": round(by_mdp.get("action", {}).get("accuracy", 0), 4), | |
| "Reward Acc.": round(by_mdp.get("reward", {}).get("accuracy", 0), 4), | |
| "Transition Acc.": round(by_mdp.get("transition", {}).get("accuracy", 0), 4), | |
| "Submitted": "2026-04 (seeded)", | |
| }) | |
| print(f" ✓ {model_name}: pert={rows[-1]['Pert. Acc.']:.4f} clean={rows[-1]['Clean']:.4f}") | |
| df = pd.DataFrame(rows).sort_values("Pert. Acc.", ascending=False) | |
| df.to_csv(OUT, index=False) | |
| print(f"\nWrote {len(df)} rows to {OUT}") | |
| if __name__ == "__main__": | |
| main() | |