PSV is a self-improving code generation system for verified code generation in Verus.
conda create -n psv python=3.11 -y && conda activate psv
pip install -r requirements.txt
wandb loginAll experiments are defined in sweep.yml and run using W&B sweeps:
See eval_server/SETUP.md for instructions. You'll need:
- Verus installation (version 0.2025.06.05.d617bea recommended)
- Singularity container (build with
build_container.sh)
# Create a sweep from sweep.yml
wandb sweep sweep.yml
# Edit train.sbatch with your cluster paths and wandb agent command from above, then submit it
sbatch train.sbatchtrain.py- Main training loop: inference -> evaluation -> SFT -> proposal -> repeatinference.py- SGLang-based inference with LoRA supportsft.py- TRL-based supervised fine-tuning (LoRA, completion-only loss)src/core/- Core infrastructure (server management, evaluation, caching)src/proposal/- Problem proposal strategies- Note: The algorithm is called "AlphaVerus-Zero" or "AV0" in the code (early name)
eval_server/- Verus verification serverdata/- Dataset files (dafny2verus, humaneval, mbpp)
We provide trained LoRA weights from our main experiments in model_runs/:
AV0-seed0throughAV0-seed4- Five seeds of our main PSV training runs
Each contains models/iter5/ with the final LoRA adapter (compatible with Qwen/Qwen2.5-Coder-7B-Instruct).
If you uncomment everything in sweep.yml and run it with the commands above, you will reproduce all the results for the paper.
Analysis scripts in analysis/ reproduce paper figures:
ttt/- Test-time training resultsscaling_max_n_qs/- Scaling experimentsio/- Input/output strategy analysisbudget/- Budget analysisverification/- Verification ablationsablations/- General ablations
Run each with python main.py from the respective directory.