| # AGENT.md |
|
|
| This document is a working guide for future Codex sessions on the ABForge RL project. |
|
|
| It focuses on: |
|
|
| - local repo structure |
| - the Misha cluster workflow |
| - current Task 1 / Task 2 training setup |
| - API judge vs local judge usage |
| - checkpoint / resume behavior |
| - inference workflow |
| - common pitfalls |
|
|
| This file reflects the current project state as of April 2026. |
|
|
| ## 1. Project Overview |
|
|
| This repository is used for RL training on scientific ablation-design tasks. |
|
|
| There are two tasks: |
|
|
| - Task 1: identify key ablation objectives / research questions |
| - Task 2: produce a rigorous ablation experiment plan |
|
|
| Main local directories: |
|
|
| - `verl_proj/`: customized `verl` training code |
| - `reward_part/`: local reward servers and judge services |
| - `readme.md`: project overview |
|
|
| Important tracked scripts in this repo: |
|
|
| - Task 1 preprocess: |
| - `/Users/xucai/Project/verl_with_llm-as-judge-master/verl_proj/examples/data_preprocess/abforge_task1_rl.py` |
| - Task 2 preprocess: |
| - `/Users/xucai/Project/verl_with_llm-as-judge-master/verl_proj/examples/data_preprocess/abforge_task2_rl.py` |
| - Task 1 local judge reward: |
| - `/Users/xucai/Project/verl_with_llm-as-judge-master/reward_part/task1_call_api.py` |
| - `/Users/xucai/Project/verl_with_llm-as-judge-master/reward_part/task1_rw.py` |
| - Task 2 local judge reward: |
| - `/Users/xucai/Project/verl_with_llm-as-judge-master/reward_part/task2_call_api.py` |
| - `/Users/xucai/Project/verl_with_llm-as-judge-master/reward_part/task2_rw.py` |
| - Task 1 Azure/API judge reward: |
| - `/Users/xucai/Project/verl_with_llm-as-judge-master/reward_part/azure_task1_judge/task1_azure_reward.py` |
| - Task 2 Azure/API judge reward: |
| - `/Users/xucai/Project/verl_with_llm-as-judge-master/reward_part/azure_task2_judge/task2_azure_reward.py` |
|
|
| Tracked launchers: |
|
|
| - `/Users/xucai/Project/verl_with_llm-as-judge-master/verl_proj/examples/grpo_trainer/run_abforge_qwen3_8b_task1_hf.sh` |
| - `/Users/xucai/Project/verl_with_llm-as-judge-master/verl_proj/examples/grpo_trainer/run_abforge_qwen3_8b_task1_vllm.sh` |
| - `/Users/xucai/Project/verl_with_llm-as-judge-master/verl_proj/examples/grpo_trainer/run_abforge_qwen3_8b_task1_vllm_azurejudge.sh` |
| - `/Users/xucai/Project/verl_with_llm-as-judge-master/verl_proj/examples/grpo_trainer/run_abforge_qwen3_8b_hf.sh` |
| - `/Users/xucai/Project/verl_with_llm-as-judge-master/verl_proj/examples/grpo_trainer/run_abforge_qwen3_8b_vllm.sh` |
| - `/Users/xucai/Project/verl_with_llm-as-judge-master/verl_proj/examples/grpo_trainer/run_abforge_qwen3_8b_vllm_azurejudge.sh` |
| - `/Users/xucai/Project/verl_with_llm-as-judge-master/verl_proj/examples/grpo_trainer/run_abforge_qwen3_8b_vllm_qwen3_32b_judge.sh` |
|
|
| ## 2. Misha Path Map |
|
|
| The user works on Yale Misha. |
|
|
| There are three path classes that matter: |
|
|
| ### A. Home |
|
|
| - `/gpfs/radev/home/yz979` |
|
|
| Current role: |
|
|
| - shell login location |
| - not used for training artifacts |
| - do not write caches, logs, checkpoints, or model downloads here |
|
|
| ### B. Project |
|
|
| - `/gpfs/radev/project/cohan/yz979/xucai/Abforge_Training` |
|
|
| Recommended variable: |
|
|
| ```bash |
| export CODE_ROOT=/gpfs/radev/project/cohan/yz979/xucai/Abforge_Training |
| ``` |
|
|
| This is the canonical code / repo root on Misha. |
|
|
| What lives here now: |
|
|
| - `.git/` |
| - `readme.md` |
| - `reward_part/` |
| - `verl_proj/` |
| - `slurm/` |
| - small `data/` directory inside repo root |
| - reference PDF |
|
|
| What should be treated as living under `project`: |
|
|
| - Git-tracked code |
| - operational Misha slurm files in `$CODE_ROOT/slurm` |
| - the `verl_proj` code tree |
| - local reward service code in `$CODE_ROOT/reward_part` |
|
|
| Important real paths currently present under `project`: |
|
|
| - root slurm: |
| - `/gpfs/radev/project/cohan/yz979/xucai/Abforge_Training/slurm` |
| - reward code: |
| - `/gpfs/radev/project/cohan/yz979/xucai/Abforge_Training/reward_part` |
| - verl code: |
| - `/gpfs/radev/project/cohan/yz979/xucai/Abforge_Training/verl_proj` |
| - model merger script: |
| - `/gpfs/radev/project/cohan/yz979/xucai/Abforge_Training/verl_proj/scripts/model_merger.py` |
|
|
| ### C. Scratch |
|
|
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training` |
|
|
| Recommended variable: |
|
|
| ```bash |
| export WORK_ROOT=/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training |
| ``` |
|
|
| This is the canonical runtime / artifact root on Misha. |
|
|
| What lives here now: |
|
|
| - `.cache/` |
| - `.config/` |
| - `conda/` |
| - `data/` |
| - `hf_cache/` |
| - `infer/` |
| - `logs/` |
| - `models/` |
| - `pip_cache/` |
| - `secrets/` |
| - `tmp/` |
| - `checkpoints/` |
| - `run_inference_local.py` |
|
|
| What should be treated as living under `scratch`: |
|
|
| - conda envs |
| - model downloads |
| - parquet data |
| - raw JSONL data |
| - checkpoints |
| - logs |
| - inference outputs |
| - secrets |
| - temp files |
| - caches |
|
|
| Important real paths currently present under `scratch`: |
|
|
| - inference script: |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/run_inference_local.py` |
| - conda envs: |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/conda/abforge` |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/conda/abforge_vllm` |
| - models: |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/models/Qwen3-8B` |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/models/Qwen3-32B` |
| - secrets: |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/secrets/azure_openai_task1.env` |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/secrets/azure_openai_task2.env` |
|
|
| ### Rule of Thumb |
|
|
| Use: |
|
|
| - `project` for code and slurm |
| - `scratch` for everything large or runtime-generated |
| - `home` only as login shell location |
|
|
| Do not assume a script in local repo also exists on Misha in the same place. |
| Example: |
|
|
| - local repo inference script may be under `scripts/` |
| - actual Misha inference script currently lives at: |
| - `$WORK_ROOT/run_inference_local.py` |
|
|
| ## 3. What Exists Only On Server |
|
|
| Not everything is tracked in Git. |
|
|
| Important server-only or server-maintained items: |
|
|
| - root `slurm/` directory under `$CODE_ROOT` |
| - this contains the actual Misha submission scripts used in practice |
| - do not assume these are fully tracked in Git |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/run_inference_local.py` |
| - this script has been used for local inference on Misha |
| - it may exist only in scratch, not in Git |
| - secrets files under `$WORK_ROOT/secrets` |
| - never commit secrets |
|
|
| When helping the user, explicitly distinguish: |
|
|
| - tracked code in the repo |
| - server-only operational files |
|
|
| ## 4. Current Misha File Inventory |
|
|
| These are the currently confirmed server paths and should be treated as authoritative unless the user says they changed them. |
|
|
| ### Root slurm files on Misha |
|
|
| Current files under `$CODE_ROOT/slurm`: |
|
|
| - `/gpfs/radev/project/cohan/yz979/xucai/Abforge_Training/slurm/task1_azure_reward.slurm` |
| - `/gpfs/radev/project/cohan/yz979/xucai/Abforge_Training/slurm/task1_judge_qwen3_32b.slurm` |
| - `/gpfs/radev/project/cohan/yz979/xucai/Abforge_Training/slurm/task1_train_vllm_azurejudge.slurm` |
| - `/gpfs/radev/project/cohan/yz979/xucai/Abforge_Training/slurm/task1_train_vllm_qwen3_32b.slurm` |
| - `/gpfs/radev/project/cohan/yz979/xucai/Abforge_Training/slurm/task2_azure_reward.slurm` |
| - `/gpfs/radev/project/cohan/yz979/xucai/Abforge_Training/slurm/task2_judge_qwen3_32b.slurm` |
| - `/gpfs/radev/project/cohan/yz979/xucai/Abforge_Training/slurm/task2_judge.slurm` |
| - `/gpfs/radev/project/cohan/yz979/xucai/Abforge_Training/slurm/task2_train.slurm` |
| - `/gpfs/radev/project/cohan/yz979/xucai/Abforge_Training/slurm/task2_train_vllm_azurejudge.slurm` |
| - `/gpfs/radev/project/cohan/yz979/xucai/Abforge_Training/slurm/task2_train_vllm_qwen3_32b.slurm` |
| - `/gpfs/radev/project/cohan/yz979/xucai/Abforge_Training/slurm/task2_train_vllm.slurm` |
|
|
| ### Scratch data files |
|
|
| Current files under `$WORK_ROOT/data`: |
|
|
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/data/abforge_task1_rl_full/train.parquet` |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/data/abforge_task1_rl_full/val.parquet` |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/data/abforge_task2_rl_full/train.parquet` |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/data/abforge_task2_rl_full/val.parquet` |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/data/bench_data_4_subset50_simple.jsonl` |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/data/rl_30000.jsonl` |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/data/task1/train.parquet` |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/data/task1/val.parquet` |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/data/task2/train.parquet` |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/data/task2/val.parquet` |
|
|
| ### Scratch inference files |
|
|
| Confirmed inference outputs under `$WORK_ROOT/infer`: |
|
|
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/infer/base_qwen3_infer_task2.jsonl` |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/infer/ckpt28_qwen3_infer_task2.jsonl` |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/infer/task1_api_ckpt14_merged_hf` |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/infer/task1_api_ckpt14_qwen3_infer_task1.jsonl` |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/infer/task1_base_qwen3_infer_task1.jsonl` |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/infer/task2_api_ckpt14_merged_hf` |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/infer/task2_api_ckpt14_qwen3_infer_task2.jsonl` |
|
|
| ### Checkpoint roots currently in use |
|
|
| Scratch-side checkpoint roots: |
|
|
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/checkpoints/abforge_task2/qwen3_8b_grpo_vllm_azurejudge` |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/checkpoints/abforge_task2/qwen3_8b_grpo_vllm_azurejudge_full` |
|
|
| Project-side historical checkpoint roots: |
|
|
| - `/gpfs/radev/project/cohan/yz979/xucai/Abforge_Training/verl_proj/checkpoints/abforge_task1/qwen3_8b_grpo_task1_vllm_azurejudge` |
| - `/gpfs/radev/project/cohan/yz979/xucai/Abforge_Training/verl_proj/checkpoints/abforge_task2/qwen3_8b_grpo_vllm` |
|
|
| Interpretation: |
|
|
| - older experiments may have written checkpoints under `project/verl_proj/checkpoints` |
| - new work should prefer `scratch/checkpoints` |
|
|
| ## 5. Current Preferred Training Strategy |
|
|
| Current decision: |
|
|
| - API judge with `gpt-5.4-mini` is preferred for RL training |
| - local Qwen3-32B judge exists, but is much slower |
| - Task 1 and Task 2 are trained as separate specialist models |
| - Task 2 should not continue from Task 1 checkpoint |
|
|
| So the intended setup is: |
|
|
| - Task 1 formal RL: |
| - base Qwen3-8B actor |
| - Task 1 API judge |
| - full Task 1 parquet |
| - Task 2 formal RL: |
| - base Qwen3-8B actor |
| - Task 2 API judge |
| - full Task 2 parquet |
|
|
| ## 6. API Judge Configuration |
|
|
| Task 1 Azure/API judge: |
|
|
| - service code: |
| - `/Users/xucai/Project/verl_with_llm-as-judge-master/reward_part/azure_task1_judge/task1_azure_reward.py` |
| - server secret: |
| - `$WORK_ROOT/secrets/azure_openai_task1.env` |
| - default port: |
| - `6012` |
| - endpoint path: |
| - `/get_reward_task1` |
|
|
| Task 2 Azure/API judge: |
|
|
| - service code: |
| - `/Users/xucai/Project/verl_with_llm-as-judge-master/reward_part/azure_task2_judge/task2_azure_reward.py` |
| - server secret: |
| - `$WORK_ROOT/secrets/azure_openai_task2.env` |
| - default port: |
| - `6011` |
| - endpoint path: |
| - `/get_reward_task2` |
|
|
| Expected env file contents: |
|
|
| ```bash |
| export AZURE_OPENAI_ENDPOINT="https://.../openai/responses?api-version=2025-04-01-preview" |
| export AZURE_OPENAI_MODEL="gpt-5.4-mini" |
| export AZURE_OPENAI_API_KEY="..." |
| ``` |
|
|
| Recommended Task 2 API robustness settings: |
|
|
| ```bash |
| export TASK2_AZURE_REQUEST_TIMEOUT=300 |
| export TASK2_AZURE_MAX_RETRIES=5 |
| export TASK2_AZURE_MAX_OUTPUT_TOKENS=1024 |
| ``` |
|
|
| Equivalent Task 1 settings may be added with `TASK1_...` names. |
|
|
| Never write the actual API key into Git-tracked files. |
|
|
| ## 7. Conda Environments |
|
|
| Confirmed envs on Misha: |
|
|
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/conda/abforge` |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/conda/abforge_vllm` |
|
|
| Recommended usage: |
|
|
| - use `abforge_vllm` for: |
| - vLLM rollout training |
| - API reward services |
| - model merger |
| - local inference |
| - use `abforge` only if the user explicitly refers to an older local-judge workflow that depends on it |
|
|
| Typical activation: |
|
|
| ```bash |
| module reset |
| module load miniconda |
| module load GCCcore/13.3.0 |
| module load CUDA/12.4.1 |
| source $(conda info --base)/etc/profile.d/conda.sh |
| conda activate /gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/conda/abforge_vllm |
| ``` |
|
|
| ## 8. Data and Preprocessing |
|
|
| Raw full RL data was uploaded as shared JSONL and then separately preprocessed for Task 1 and Task 2. |
|
|
| Task 1 preprocess: |
|
|
| - `/Users/xucai/Project/verl_with_llm-as-judge-master/verl_proj/examples/data_preprocess/abforge_task1_rl.py` |
|
|
| Task 2 preprocess: |
|
|
| - `/Users/xucai/Project/verl_with_llm-as-judge-master/verl_proj/examples/data_preprocess/abforge_task2_rl.py` |
|
|
| Important note: |
|
|
| - Task 2 `test1000` and `full` use the same field mapping and prompt template |
| - fields used in Task 2: |
| - `Content` |
| - `Goal` |
| - `Rubric` |
| - `refined_standard_plan` |
|
|
| Small test parquet: |
|
|
| - Task 1: |
| - `$WORK_ROOT/data/task1/train.parquet` |
| - `$WORK_ROOT/data/task1/val.parquet` |
| - Task 2: |
| - `$WORK_ROOT/data/task2/train.parquet` |
| - `$WORK_ROOT/data/task2/val.parquet` |
|
|
| Formal parquet: |
|
|
| - Task 1: |
| - `$WORK_ROOT/data/abforge_task1_rl_full/train.parquet` |
| - `$WORK_ROOT/data/abforge_task1_rl_full/val.parquet` |
| - Task 2: |
| - `$WORK_ROOT/data/abforge_task2_rl_full/train.parquet` |
| - `$WORK_ROOT/data/abforge_task2_rl_full/val.parquet` |
|
|
| ## 9. Formal API Training Settings |
|
|
| For formal API training on the 30k dataset, prefer: |
|
|
| - `train_batch_size=64` |
| - `trainer.total_epochs=1` |
| - `trainer.save_freq=100` |
| - checkpoints written to scratch |
| - experiment name suffixed with `_full` |
|
|
| Why: |
|
|
| - with ~29k train rows and batch size 64, one epoch is about 453 steps |
| - `save_freq=100` gives about 5 saves per epoch |
| - one epoch is much easier to fit in a 48h wall-clock budget |
|
|
| Recommended Task 2 formal API launcher override pattern: |
|
|
| ```bash |
| bash examples/grpo_trainer/run_abforge_qwen3_8b_vllm_azurejudge.sh \ |
| trainer.save_freq=100 \ |
| trainer.total_epochs=1 \ |
| trainer.default_local_dir=$WORK_ROOT/checkpoints/abforge_task2/qwen3_8b_grpo_vllm_azurejudge_full \ |
| trainer.experiment_name=qwen3_8b_grpo_vllm_azurejudge_full |
| ``` |
|
|
| Recommended Task 1 formal API launcher override pattern: |
|
|
| ```bash |
| bash examples/grpo_trainer/run_abforge_qwen3_8b_task1_vllm_azurejudge.sh \ |
| trainer.save_freq=100 \ |
| trainer.total_epochs=1 \ |
| trainer.default_local_dir=$WORK_ROOT/checkpoints/abforge_task1/qwen3_8b_grpo_task1_vllm_azurejudge_full \ |
| trainer.experiment_name=qwen3_8b_grpo_task1_vllm_azurejudge_full |
| ``` |
|
|
| ## 10. Resume Behavior |
|
|
| This `verl` setup supports automatic resume. |
|
|
| Relevant code: |
|
|
| - `/Users/xucai/Project/verl_with_llm-as-judge-master/verl_proj/verl/trainer/ppo/ray_trainer.py` |
| - `resume_mode` default in: |
| - `/Users/xucai/Project/verl_with_llm-as-judge-master/verl_proj/verl/trainer/config/ppo_trainer.yaml` |
|
|
| Behavior: |
|
|
| - checkpoints are saved under `trainer.default_local_dir/global_step_xxx` |
| - latest step is recorded in: |
| - `latest_checkpointed_iteration.txt` |
| - if `resume_mode=auto` and the directory exists, training resumes automatically |
|
|
| Recommended workflow for 2 epochs: |
|
|
| 1. first job: |
| - `trainer.total_epochs=1` |
| 2. second job: |
| - keep the same `trainer.default_local_dir` |
| - change to `trainer.total_epochs=2` |
| 3. submit again |
|
|
| The second job should resume from the latest checkpoint and continue. |
|
|
| ## 11. Slurm Usage on Misha |
|
|
| Many real submission scripts live only on the server under: |
|
|
| - `$CODE_ROOT/slurm` |
|
|
| Common files that have existed there: |
|
|
| - `task1_azure_reward.slurm` |
| - `task2_azure_reward.slurm` |
| - `task1_train_vllm_azurejudge.slurm` |
| - `task2_train_vllm_azurejudge.slurm` |
| - `task1_judge_qwen3_32b.slurm` |
| - `task2_judge_qwen3_32b.slurm` |
| - `task1_train_vllm_qwen3_32b.slurm` |
| - `task2_train_vllm_qwen3_32b.slurm` |
|
|
| API reward services should be started first, then the printed `REWARD_URL` should be copied into the corresponding train slurm. |
|
|
| Typical operational order: |
|
|
| 1. `sbatch slurm/task2_azure_reward.slurm` |
| 2. read log under `$WORK_ROOT/logs/task2_azure_reward_<JOBID>.out` |
| 3. update `export REWARD_URL=...` in train slurm |
| 4. `sbatch slurm/task2_train_vllm_azurejudge.slurm` |
|
|
| Same pattern applies to Task 1. |
|
|
| ## 12. Checkpoint Locations Used So Far |
|
|
| Examples from previous runs: |
|
|
| Task 1 API test: |
|
|
| - checkpoint dir: |
| - `/gpfs/radev/project/cohan/yz979/xucai/Abforge_Training/verl_proj/checkpoints/abforge_task1/qwen3_8b_grpo_task1_vllm_azurejudge/global_step_14` |
|
|
| Task 2 API test: |
|
|
| - checkpoint dir: |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/checkpoints/abforge_task2/qwen3_8b_grpo_vllm_azurejudge/global_step_14` |
|
|
| Formal Task 2 API run was configured to use: |
|
|
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/checkpoints/abforge_task2/qwen3_8b_grpo_vllm_azurejudge_full` |
|
|
| Preferred rule: |
|
|
| - always use scratch for new checkpoints |
|
|
| ## 13. Inference Workflow |
|
|
| There are two inference cases. |
|
|
| ### A. Base model inference |
|
|
| Use the base HF model directly. |
|
|
| - model path: |
| - `$WORK_ROOT/models/Qwen3-8B` |
|
|
| Example Task 1 base inference: |
|
|
| ```bash |
| python3 $WORK_ROOT/run_inference_local.py \ |
| --task 1 \ |
| --input $WORK_ROOT/data/bench_data_4_subset50_simple.jsonl \ |
| --output-prefix $WORK_ROOT/infer/task1_base_qwen3 \ |
| --model-path $WORK_ROOT/models/Qwen3-8B \ |
| --tokenizer-path $WORK_ROOT/models/Qwen3-8B \ |
| --trust-remote-code \ |
| --dtype bf16 \ |
| --device-map auto \ |
| --max-new-tokens 1024 \ |
| --overwrite |
| ``` |
|
|
| Important real Misha inference script path: |
|
|
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/run_inference_local.py` |
|
|
| Do not assume the Git-tracked local script path exists on Misha. |
|
|
| ### B. RL checkpoint inference |
|
|
| FSDP actor checkpoints must first be merged into HF format. |
|
|
| Model merger: |
|
|
| - `/Users/xucai/Project/verl_with_llm-as-judge-master/verl_proj/scripts/model_merger.py` |
|
|
| Important: |
|
|
| - `--local_dir` must point to `global_step_xxx/actor`, not the full checkpoint root |
|
|
| Example: |
|
|
| ```bash |
| python3 $CODE_ROOT/verl_proj/scripts/model_merger.py \ |
| --backend fsdp \ |
| --hf_model_path $WORK_ROOT/models/Qwen3-8B \ |
| --local_dir $WORK_ROOT/checkpoints/.../global_step_14/actor \ |
| --target_dir $WORK_ROOT/infer/task2_api_ckpt14_merged_hf |
| ``` |
|
|
| Then run inference with the merged HF directory: |
|
|
| ```bash |
| python3 $WORK_ROOT/run_inference_local.py \ |
| --task 2 \ |
| --input $WORK_ROOT/data/bench_data_4_subset50_simple.jsonl \ |
| --output-prefix $WORK_ROOT/infer/task2_api_ckpt14_qwen3 \ |
| --model-path $WORK_ROOT/infer/task2_api_ckpt14_merged_hf \ |
| --tokenizer-path $WORK_ROOT/models/Qwen3-8B \ |
| --trust-remote-code \ |
| --dtype bf16 \ |
| --device-map auto \ |
| --max-new-tokens 2048 \ |
| --overwrite |
| ``` |
|
|
| ## 14. Bench Inference Data |
|
|
| Known inference input on Misha: |
|
|
| - `$WORK_ROOT/data/bench_data_4_subset50_simple.jsonl` |
|
|
| This has been used successfully for: |
|
|
| - base model inference |
| - Task 1 API checkpoint inference |
| - Task 2 API checkpoint inference |
|
|
| ## 15. Interactive GPU Sessions |
|
|
| For checkpoint merge + local inference, use a single-GPU interactive allocation. |
|
|
| Typical command: |
|
|
| ```bash |
| salloc -p gpu --gpus=1 --cpus-per-task=8 --mem=64G -t 08:00:00 |
| ``` |
|
|
| Then initialize: |
|
|
| ```bash |
| module reset |
| module load miniconda |
| module load GCCcore/13.3.0 |
| module load CUDA/12.4.1 |
| source $(conda info --base)/etc/profile.d/conda.sh |
| conda activate $WORK_ROOT/conda/abforge_vllm |
| ``` |
|
|
| ## 16. Git State and Server Mutability |
|
|
| The Misha repo can be dirty. |
|
|
| At last inspection, `git status --short` on `$CODE_ROOT` showed: |
|
|
| - modified tracked files |
| - untracked `slurm/` |
| - untracked historical outputs and checkpoints |
|
|
| Interpretation for future Codex sessions: |
|
|
| - do not assume server repo is clean |
| - do not `git reset --hard` |
| - do not delete `slurm/` or `verl_proj/checkpoints/` blindly |
| - if editing tracked code, inspect local diffs first |
| - if editing server-only slurm files, treat them as operational config, not as Git-tracked source of truth |
|
|
| Git remote currently is: |
|
|
| - `git@github.com:SlowGuess/Abforge_Training.git` |
|
|
| Current branch on Misha: |
|
|
| - `main` |
|
|
| ## 17. Common Pitfalls |
|
|
| ### 1. API reward job is down |
|
|
| Symptom: |
|
|
| - `curl http://<node>:6011/health` fails |
| - train job will not get rewards |
|
|
| Fix: |
|
|
| - resubmit the reward slurm |
| - update `REWARD_URL` in train slurm |
|
|
| ### 2. Wrong `REWARD_URL` |
| |
| Each reward service starts on a new node and prints a new URL. |
| Do not reuse old node names blindly. |
| |
| ### 3. Checkpoint save failures |
| |
| Observed before on Task 2 API test: |
| |
| - writes failed during checkpoint save |
| - fix was to: |
| - save to scratch |
| - reduce save frequency |
| |
| ### 4. Confusing test vs formal lines |
| |
| Keep these separate: |
| |
| - test: |
| - small parquet in `$WORK_ROOT/data/task1` or `$WORK_ROOT/data/task2` |
| - formal: |
| - full parquet in `$WORK_ROOT/data/abforge_task1_rl_full` and `$WORK_ROOT/data/abforge_task2_rl_full` |
| |
| Use `_full` in the experiment name for formal runs. |
|
|
| ### 5. `run_inference_local.py` location confusion |
|
|
| Do not assume it lives in Git. |
|
|
| On Misha it has been used from: |
|
|
| - `$WORK_ROOT/run_inference_local.py` |
|
|
| ### 6. `project` vs `scratch` checkpoint confusion |
|
|
| Historical checkpoints exist in both places. |
|
|
| When asked to merge or infer from a checkpoint, always verify whether the checkpoint lives under: |
|
|
| - `$WORK_ROOT/checkpoints/...` |
| or |
| - `$CODE_ROOT/verl_proj/checkpoints/...` |
|
|
| Do not assume all checkpoints are on scratch. |
|
|
| ### 7. Prompt filtering log |
|
|
| `Filtering prompts longer than 4096 tokens` is a preprocessing / dataset check stage. |
| It does not automatically mean something is broken. |
|
|
| For Task 2 formal run, 29k train rows with batch size 64 giving about `453` steps is normal and consistent with floor-style batching. |
|
|
| ## 18. Local Judge Status |
|
|
| Local judge was explored but is not currently preferred for formal training. |
|
|
| Reasons: |
|
|
| - response is much slower than API judge |
| - GPU jobs showed very high idle time |
| - bottleneck is mostly reward throughput and orchestration |
|
|
| Still, local judge code exists and may be useful for future experimentation: |
|
|
| - Task 1 local judge: |
| - `/Users/xucai/Project/verl_with_llm-as-judge-master/reward_part/task1_call_api.py` |
| - Task 2 local judge: |
| - `/Users/xucai/Project/verl_with_llm-as-judge-master/reward_part/task2_call_api.py` |
| - faster Task 2 local judge launcher: |
| - `/Users/xucai/Project/verl_with_llm-as-judge-master/verl_proj/examples/grpo_trainer/run_abforge_qwen3_8b_vllm_qwen3_32b_judge.sh` |
|
|
| ## 19. Recommended Default Actions for Future Codex Sessions |
|
|
| When assisting on this repo: |
|
|
| 1. Ask whether the user wants: |
| - test line |
| - formal line |
| - Task 1 |
| - Task 2 |
| - API judge |
| - local judge |
| 2. Assume API judge is the preferred formal path unless the user says otherwise. |
| 3. Use scratch for: |
| - checkpoints |
| - caches |
| - secrets |
| - inference outputs |
| 4. Treat root `slurm/` files on Misha as operational state, even if not tracked in Git. |
| 5. Before launching training, verify: |
| - reward service is alive |
| - `REWARD_URL` is current |
| - data path is correct |
| - experiment name is correct |
| - checkpoint path is on scratch |
| 6. Before resuming training, verify whether the target checkpoint directory already exists. |
|
|
| ## 20. Minimal Operational Checklist |
|
|
| Before training: |
|
|
| 1. set: |
| - `CODE_ROOT` |
| - `WORK_ROOT` |
| 2. confirm correct conda env |
| 3. confirm reward service is up |
| 4. confirm `REWARD_URL` in slurm is current |
| 5. confirm data path points to test or full dataset intentionally |
| 6. confirm checkpoint root is on scratch for new runs |
| 7. confirm experiment name matches test vs formal intent |
|
|
| Before inference: |
|
|
| 1. verify whether base model or merged RL checkpoint is needed |
| 2. if RL checkpoint: |
| - identify exact checkpoint root |
| - identify whether it is under `project` or `scratch` |
| - merge `global_step_xxx/actor` with `model_merger.py` |
| 3. use: |
| - `$WORK_ROOT/run_inference_local.py` |
| 4. use: |
| - `$WORK_ROOT/data/bench_data_4_subset50_simple.jsonl` |
| unless the user specifies another input |
|
|
| ## 21. Current Known Good Runs |
|
|
| These are workflows that have already been exercised successfully and should be treated as the safest starting points. |
|
|
| ### A. Task 1 API judge test training |
|
|
| Status: |
|
|
| - completed successfully |
|
|
| Observed job: |
|
|
| - training job `1502537` |
| - reward job `1502526` |
|
|
| Reward URL used during successful run: |
|
|
| - `http://r817u15n02.misha.ycrc.yale.edu:6012/get_reward_task1` |
|
|
| Checkpoint produced: |
|
|
| - `/gpfs/radev/project/cohan/yz979/xucai/Abforge_Training/verl_proj/checkpoints/abforge_task1/qwen3_8b_grpo_task1_vllm_azurejudge/global_step_14` |
|
|
| Meaning: |
|
|
| - Task 1 API reward service worked |
| - Task 1 RL loop worked |
| - final checkpoint was saved |
|
|
| ### B. Task 2 API judge test training |
|
|
| Status: |
|
|
| - completed successfully after moving checkpoint writing to scratch and reducing save frequency pressure |
|
|
| Observed successful job: |
|
|
| - training job `1504216` |
|
|
| Reward service job seen before successful test: |
|
|
| - reward job `1504288` |
|
|
| Checkpoint produced: |
|
|
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/checkpoints/abforge_task2/qwen3_8b_grpo_vllm_azurejudge/global_step_14` |
|
|
| Meaning: |
|
|
| - Task 2 API reward service worked |
| - Task 2 RL loop worked |
| - final checkpoint was saved to scratch |
|
|
| ### C. Task 2 formal API training |
|
|
| Status: |
|
|
| - formal run started successfully on full data |
|
|
| Observed job: |
|
|
| - training job `1504289` |
|
|
| Observed training progress: |
|
|
| - `Training Progress: 0/453` |
|
|
| Interpretation: |
|
|
| - full train split size is about 29000 |
| - batch size 64 gives 453 steps via floor-style batching |
| - this is normal and not by itself evidence of abnormal filtering |
|
|
| Formal checkpoint path in use: |
|
|
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/checkpoints/abforge_task2/qwen3_8b_grpo_vllm_azurejudge_full` |
|
|
| Observed saved steps: |
|
|
| - `global_step_100` |
| - `global_step_200` |
|
|
| Formal experiment name in use: |
|
|
| - `qwen3_8b_grpo_vllm_azurejudge_full` |
|
|
| ### D. Base and RL inference runs already completed |
|
|
| Confirmed scratch inference outputs: |
|
|
| - Task 1 base: |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/infer/task1_base_qwen3_infer_task1.jsonl` |
| - Task 1 API checkpoint: |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/infer/task1_api_ckpt14_qwen3_infer_task1.jsonl` |
| - Task 2 API checkpoint: |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/infer/task2_api_ckpt14_qwen3_infer_task2.jsonl` |
| - historical Task 2 base: |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/infer/base_qwen3_infer_task2.jsonl` |
| - historical Task 2 RL checkpoint: |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/infer/ckpt28_qwen3_infer_task2.jsonl` |
|
|
| Merged HF checkpoint directories already present: |
|
|
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/infer/task1_api_ckpt14_merged_hf` |
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/infer/task2_api_ckpt14_merged_hf` |
|
|
| ### E. Local judge historical run |
|
|
| Status: |
|
|
| - local judge worked functionally but was very slow and GPU-inefficient |
|
|
| Known historical local Task 2 checkpoint root: |
|
|
| - `/gpfs/radev/project/cohan/yz979/xucai/Abforge_Training/verl_proj/checkpoints/abforge_task2/qwen3_8b_grpo_vllm` |
|
|
| Known merged / inferred artifact from that line: |
|
|
| - `/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training/infer/ckpt28_qwen3_infer_task2.jsonl` |
|
|
| Recommendation: |
|
|
| - do not choose local judge for new formal runs unless the user explicitly asks for it |
|
|
| ## 22. Quick Commands |
|
|
| These commands are safe defaults to suggest when the user asks "what do I run next?" |
|
|
| ### Set up shell variables |
|
|
| ```bash |
| export CODE_ROOT=/gpfs/radev/project/cohan/yz979/xucai/Abforge_Training |
| export WORK_ROOT=/gpfs/radev/scratch/cohan/yz979/xucai/Abforge_Training |
| export BASE_MODEL=$WORK_ROOT/models/Qwen3-8B |
| ``` |
|
|
| ### Activate main env |
|
|
| ```bash |
| module reset |
| module load miniconda |
| module load GCCcore/13.3.0 |
| module load CUDA/12.4.1 |
| source $(conda info --base)/etc/profile.d/conda.sh |
| conda activate $WORK_ROOT/conda/abforge_vllm |
| ``` |
|
|
| ### Start Task 2 API reward |
|
|
| ```bash |
| cd $CODE_ROOT |
| sbatch slurm/task2_azure_reward.slurm |
| ``` |
|
|
| ### Start Task 1 API reward |
|
|
| ```bash |
| cd $CODE_ROOT |
| sbatch slurm/task1_azure_reward.slurm |
| ``` |
|
|
| ### Watch a job log |
|
|
| ```bash |
| tail -f $WORK_ROOT/logs/<log_name>.err |
| ``` |
|
|
| ### Check a job state |
|
|
| ```bash |
| squeue -j <JOBID> |
| sacct -j <JOBID> --format=JobID,JobName,State,ExitCode,Elapsed,NodeList |
| ``` |
|
|
| ### Merge an FSDP actor checkpoint |
|
|
| ```bash |
| python3 $CODE_ROOT/verl_proj/scripts/model_merger.py \ |
| --backend fsdp \ |
| --hf_model_path $BASE_MODEL \ |
| --local_dir <global_step_dir>/actor \ |
| --target_dir <merged_hf_dir> |
| ``` |
|
|
| ### Run local inference |
|
|
| ```bash |
| python3 $WORK_ROOT/run_inference_local.py \ |
| --task <1_or_2> \ |
| --input $WORK_ROOT/data/bench_data_4_subset50_simple.jsonl \ |
| --output-prefix <prefix> \ |
| --model-path <hf_model_dir> \ |
| --tokenizer-path $BASE_MODEL \ |
| --trust-remote-code \ |
| --dtype bf16 \ |
| --device-map auto \ |
| --overwrite |
| ``` |
|
|
| ## 23. Decision Guide For Future Codex Sessions |
|
|
| This section is the practical default policy layer. |
|
|
| When a future Codex session starts, use these rules unless the user explicitly overrides them. |
|
|
| ### A. If the user says "formal training" |
|
|
| Default interpretation: |
|
|
| - use API judge, not local judge |
| - use full parquet, not small test parquet |
| - use base Qwen3-8B actor as the training start point |
| - use scratch checkpoint directory |
|
|
| Task mapping: |
|
|
| - Task 1 formal: |
| - `$WORK_ROOT/data/abforge_task1_rl_full/train.parquet` |
| - `$WORK_ROOT/data/abforge_task1_rl_full/val.parquet` |
| - `slurm/task1_train_vllm_azurejudge.slurm` |
| - Task 2 formal: |
| - `$WORK_ROOT/data/abforge_task2_rl_full/train.parquet` |
| - `$WORK_ROOT/data/abforge_task2_rl_full/val.parquet` |
| - `slurm/task2_train_vllm_azurejudge.slurm` |
|
|
| Formal defaults: |
|
|
| - `trainer.total_epochs=1` |
| - `trainer.save_freq=100` |
| - checkpoint path under `$WORK_ROOT/checkpoints/..._full` |
| - experiment name suffixed with `_full` |
|
|
| ### B. If the user says "test training" |
|
|
| Default interpretation: |
|
|
| - use API judge |
| - use small parquet |
| - do not overwrite formal experiment names |
|
|
| Task mapping: |
|
|
| - Task 1 test: |
| - `$WORK_ROOT/data/task1/train.parquet` |
| - `$WORK_ROOT/data/task1/val.parquet` |
| - Task 2 test: |
| - `$WORK_ROOT/data/task2/train.parquet` |
| - `$WORK_ROOT/data/task2/val.parquet` |
|
|
| ### C. If the user says "resume training" |
|
|
| Default interpretation: |
|
|
| - keep the same checkpoint root |
| - keep the same experiment name |
| - inspect whether the directory already has `latest_checkpointed_iteration.txt` |
| - use `resume_mode=auto` behavior rather than inventing a new checkpoint path |
|
|
| Resume checklist: |
|
|
| 1. identify whether the checkpoint is under `project` or `scratch` |
| 2. identify the exact experiment directory |
| 3. inspect: |
| - `latest_checkpointed_iteration.txt` |
| - available `global_step_xxx` directories |
| 4. only then adjust `trainer.total_epochs` |
|
|
| For "continue from epoch 1 to epoch 2", the default action is: |
|
|
| - keep `trainer.default_local_dir` unchanged |
| - change `trainer.total_epochs=1` to `trainer.total_epochs=2` |
|
|
| ### D. If the user says "run inference" |
|
|
| Default interpretation: |
|
|
| - use the scratch inference script: |
| - `$WORK_ROOT/run_inference_local.py` |
| - use the scratch benchmark file: |
| - `$WORK_ROOT/data/bench_data_4_subset50_simple.jsonl` |
|
|
| Then decide: |
|
|
| - base model inference: |
| - use `$WORK_ROOT/models/Qwen3-8B` |
| - RL checkpoint inference: |
| - first merge `global_step_xxx/actor` |
| - then point `--model-path` at the merged HF directory |
|
|
| Never assume: |
|
|
| - `run_inference_local.py` is in Git on Misha |
| - checkpoint is already merged |
|
|
| ### E. If the user says "use local judge" |
|
|
| Default interpretation: |
|
|
| - pause and confirm they really want it |
|
|
| Reason: |
|
|
| - local judge historically worked but was much slower |
| - API judge is the current default for formal work |
|
|
| If the user still wants local judge: |
|
|
| - inspect whether they mean Task 1 or Task 2 |
| - prefer the existing Misha slurm files under `$CODE_ROOT/slurm` |
| - verify model path and resource sizing before launch |
|
|
| ### F. If the user says "compare base vs RL" |
|
|
| Default interpretation: |
|
|
| - infer all requested models on the same benchmark input |
| - write outputs under `$WORK_ROOT/infer` |
| - use clear prefixes like: |
| - `task1_base_qwen3` |
| - `task1_api_ckpt14_qwen3` |
| - `task2_base_qwen3` |
| - `task2_api_ckpt14_qwen3` |
|
|
| ### G. If something looks missing |
|
|
| Default troubleshooting order: |
|
|
| 1. check whether the file exists under `project` |
| 2. check whether it actually lives under `scratch` |
| 3. check whether it is server-only and untracked |
| 4. only then conclude it is missing |
|
|
| Examples: |
|
|
| - `run_inference_local.py` exists on scratch |
| - slurm files exist under project root |
| - secrets exist under scratch |
|
|
| ### H. If a path assumption is uncertain |
|
|
| Default behavior: |
|
|
| - do not guess silently |
| - ask the user for a short server command if needed |
| - prefer commands like: |
| - `find ...` |
| - `ls ...` |
| - `grep ...` |
|
|
| This repo has enough server-only state that path verification is often necessary. |
|
|
| ## 24. Do Not Store |
|
|
| Do not write these into Git: |
|
|
| - Azure API keys |
| - server-only secrets |
| - user-specific scratch-only temporary artifacts |
|
|
| Keep secrets only in: |
|
|
| - `$WORK_ROOT/secrets/*.env` |
|
|