#!/bin/bash # Score the four PostTrainBench base models on the offline capability probes. # # sbatch --array=0-3 scripts/ptb_probes.sbatch # # One array task per model, one GPU each: the probes are a few thousand short # log-likelihood passes, so this is minutes of compute once the weights load. # # Scored under both pmi and letter. Plain mean-token-logprob ("norm") is # deliberately not the default: a positive control showed it collapses onto # whichever option has the highest unconditional likelihood, putting even a # 27B instruct model below chance. # Results land in analysis/out/probe_results/.json; summarise them with # python analysis/summarize_probes.py # OUT_TAG suffixes the filename. Set it for any re-run that scores fewer # probes or fewer schemes than the file already there, or the narrower run # silently replaces a broader one: # OUT_TAG=_variants SCORING=pmi VARIANTS=base,swap sbatch --array=0-3 ... #SBATCH --job-name=ptb-probes #SBATCH --partition=h100 #SBATCH --account=midpri #SBATCH --qos=midpri #SBATCH --gres=gpu:1 #SBATCH --cpus-per-task=12 #SBATCH --mem=128G #SBATCH --time=01:00:00 #SBATCH --output=logs/ptb-probes-%A_%a.out set -euo pipefail # The login pod's proxy is not routable from a compute node, and an inherited # http_proxy makes every HF call hang before falling back to the local cache. unset http_proxy https_proxy HTTP_PROXY HTTPS_PROXY no_proxy NO_PROXY X2P_PROXY_URL REPO=/home/jiaruiliu/local/git-repos/auto-impl cd "$REPO" export HF_HOME=/lustre-storage/fsx_2/user/jiaruiliu/ptb-data/hf_cache export HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1 HF_DATASETS_OFFLINE=1 export TOKENIZERS_PARALLELISM=false # A compile cache shared across concurrent engines on one node triggers an # Errno 116 storm on Lustre; the judge pool learned this the hard way. export VLLM_CACHE_ROOT="/tmp/vllm-cache-${SLURM_JOB_ID}-${SLURM_ARRAY_TASK_ID:-0}" mkdir -p "$VLLM_CACHE_ROOT" MODELS=( "Qwen/Qwen3-4B-Base" "Qwen/Qwen3-1.7B-Base" "HuggingFaceTB/SmolLM3-3B-Base" "google/gemma-3-4b-pt" ) REPO_ID="${MODELS[${SLURM_ARRAY_TASK_ID:-0}]}" NAME="${REPO_ID//\//__}" # Resolve the local snapshot rather than passing the repo id: offline mode # still consults the hub index for a bare id and fails on some layouts. SNAP=$(ls -d "$HF_HOME/hub/models--${REPO_ID//\//--}/snapshots/"*/ 2>/dev/null | head -1) if [[ -z "$SNAP" ]]; then echo "No local snapshot for $REPO_ID under $HF_HOME/hub" >&2 exit 1 fi echo "model=$REPO_ID snapshot=$SNAP" nvidia-smi -L "$HOME/.venv-vllm-serve/bin/python" analysis/run_probes.py \ --model "$SNAP" \ --name "$REPO_ID" \ --out "analysis/out/probe_results/${NAME}${OUT_TAG:-}.json" \ --max-model-len "${MAX_MODEL_LEN:-4096}" \ --gpu-util "${GPU_UTIL:-0.85}" \ --scoring "${SCORING:-pmi,letter}" \ --variants "${VARIANTS:-base}"