RSIChallenge / auto-impl /scripts /ptb_sweep.sh
Jerry999's picture
Add files using upload-large-folder tool
158258b verified
Raw History Blame Contribute Delete
4.18 kB
#!/bin/bash
# Submit one PostTrainBench sweep: every benchmark x every base model, at the official setting
# (10 h of agent time on one H100, then evaluation).
#
# bash scripts/ptb_sweep.sh # 28 cells, seed _run1
# EXPERIMENT_NAME=_run2 bash scripts/ptb_sweep.sh # the second of upstream's three seeds
# DEPENDENCY=afterok:12345 bash scripts/ptb_sweep.sh # queue now, start once setup 12345 is done
# DRY_RUN=1 bash scripts/ptb_sweep.sh # print the sbatch lines without submitting
#
# Upstream reports the mean over three seeds, so a full agent row is this script run three times
# (`_run1`, `_run2`, `_run3`) -- 84 cells, ~840 GPU-hours. `scripts/collect.py` upstream aggregates
# the `..._10h_run{1,2,3}` directories this naming produces.
set -euo pipefail
cd /home/jiaruiliu/local/git-repos/auto-impl
# scripts/constants.py HARDCODED_BENCHMARKS. aime2026 exists upstream but is not in the reported
# set. arenahardwriting and healthbench grade with OpenAI's gpt-5-mini; .env has no OPENAI_API_KEY
# and api.openai.com is unreachable from the aws cluster, so both the agent and the final evaluation
# are pointed at a local vLLM pool serving under that name instead -- start
# scripts/ptb_judge_pool.sbatch first and export PTB_JUDGE_POOL_DIR (see JUDGE_POOL below).
# Caveat on comparability: healthbench grades each rubric item as an independent boolean, so a
# different grader shifts the number but measures the same thing; arenahardwriting is a pairwise
# preference win-rate, where swapping the judge changes what is being measured, and its scores are
# therefore NOT comparable to upstream's.
EVALS=(aime2025 arenahardwriting bfcl gpqamain gsm8k healthbench humaneval)
# src/commit_utils/commit.sh `models`.
MODELS=(google/gemma-3-4b-pt Qwen/Qwen3-4B-Base Qwen/Qwen3-1.7B-Base HuggingFaceTB/SmolLM3-3B-Base)
AGENT="${AGENT:-claude_non_api}"
AGENT_MODEL="${AGENT_MODEL:-claude-opus-5}"
CONTAINER="${CONTAINER:-opus_5_local}"
HOURS="${HOURS:-10}"
EXPERIMENT_NAME="${EXPERIMENT_NAME:-_run1}"
# 10 h of agent time plus the evaluation retries; the value ptb_run.sbatch's header calls official.
TIME_LIMIT="${TIME_LIMIT:-14:00:00}"
# Where the running judge pool publishes its `task_<i>.addr` files; forwarded to every cell so the
# two LLM-graded benchmarks can reach it. Fail early rather than let those cells die hours in.
JUDGE_POOL_DIR="${PTB_JUDGE_POOL_DIR:-}"
if [[ " ${EVALS[*]} " == *" healthbench "* || " ${EVALS[*]} " == *" arenahardwriting "* ]]; then
if [[ -z "$JUDGE_POOL_DIR" ]]; then
echo "EVALS contains an LLM-graded benchmark but PTB_JUDGE_POOL_DIR is unset." >&2
echo "Start scripts/ptb_judge_pool.sbatch and export PTB_JUDGE_POOL_DIR=logs/ptb-judge-pool/<jobid>." >&2
exit 1
fi
if ! compgen -G "$JUDGE_POOL_DIR/task_*.addr" >/dev/null; then
echo "No ready replicas in $JUDGE_POOL_DIR (the pool publishes task_*.addr only once a" >&2
echo "replica answers). Wait for 'pool READY' in its log." >&2
exit 1
fi
echo "judge pool: $(compgen -G "$JUDGE_POOL_DIR/task_*.addr" | wc -l) replica(s) in $JUDGE_POOL_DIR"
JUDGE_POOL_DIR="$(cd "$JUDGE_POOL_DIR" && pwd)" # the cells resolve it from their own cwd
fi
echo "agent=$AGENT model=$AGENT_MODEL hours=$HOURS experiment=$EXPERIMENT_NAME"
echo "${#EVALS[@]} benchmarks x ${#MODELS[@]} models = $((${#EVALS[@]} * ${#MODELS[@]})) cells"
echo
for model in "${MODELS[@]}"; do
for eval in "${EVALS[@]}"; do
if [[ -n "${DRY_RUN:-}" ]]; then
echo "would submit: $eval $model"
continue
fi
# --export: ALL keeps the caller's environment, WITH_X2P=1 makes the Slurm task prolog
# start this job's own x2pagentd sidecar (see ptb_run.sbatch).
sbatch --time="$TIME_LIMIT" \
--job-name="ptb-${eval}" \
${DEPENDENCY:+--dependency="$DEPENDENCY"} \
--export="ALL,WITH_X2P=1,TASK=${eval},MODEL=${model},AGENT=${AGENT},AGENT_MODEL=${AGENT_MODEL},CONTAINER=${CONTAINER},HOURS=${HOURS},EXPERIMENT_NAME=${EXPERIMENT_NAME},PTB_JUDGE_POOL_DIR=${JUDGE_POOL_DIR}" \
scripts/ptb_run.sbatch
done
done