This anonymous repository provides the reproduction code for CodeRSA, a pragmatic reranking method for natural-language-to-code generation.
CodeRSA samples a pool of candidate programs, derives candidate-induced instructions, computes local pairwise pragmatic contests, and combines those pairwise scores with global L0 support to select the final program.
The repository supports the three benchmarks used in the paper.
HumanEval+ 164 tasks
MBPP+ 378 tasks
BigCodeBench 1140 tasks
All three benchmarks follow the same high-level pipeline:
- initialize benchmark tasks
- generate 10 candidate programs per task
- evaluate candidates with benchmark tests
- compute Coder and CoderReviewer scores
- generate candidate-induced instructions
- compute the L0 instruction-candidate score matrix
- run CodeRSA reranking
- write the summary table
The default settings match the paper:
- candidate pool size:
n=10 - raw candidate samples per task for MBPP+:
50, from which 10 valid candidates are kept - candidate sampling: temperature
1.2, top-p1.0 - reported seed sweep:
42, 43, 44, 45, 46 - induced-instruction generation: greedy decoding
- final CodeRSA score:
z(pairwise) + z(avg-all L0)
To reproduce a different paper model, change GORSA_MODEL_ID; the benchmark and
reranking settings stay fixed.
Use Python 3.10 or 3.11. For GPU runs, install a CUDA-compatible PyTorch build appropriate for your machine.
git clone <anonymous-repo-url> CodeRSA-repro
cd CodeRSA-repro
python -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install -r requirements.txtFor vLLM-backed generation and scoring:
pip install -r requirements-vllm.txtSet HF_TOKEN if the selected model requires Hugging Face access.
The default launcher runs the MBPP+ reproduction.
export WORKSPACE=/workspace
export HF_TOKEN=...
export GORSA_MODEL_ID=meta-llama/Meta-Llama-3-8B-Instruct
export GORSA_ROOT_DIR=$WORKSPACE/runs/codersa_mbpp_seed42
export GORSA_SEED=42
export GORSA_LIMIT=378
export GORSA_CANDIDATE_OVERSAMPLE=50
bash scripts/run_full_vllm_mbpp.shFor the MBPP+ oversample-50 run:
export WORKSPACE=/workspace
export HF_TOKEN=...
bash examples/run_mbpp_oversample50.shcd benchmarks/humaneval_plus
export WORKSPACE=/workspace
export HF_TOKEN=...
export GORSA_MODEL_ID=meta-llama/Meta-Llama-3-8B-Instruct
export GORSA_ROOT_DIR=$WORKSPACE/runs/codersa_humaneval_seed42
export GORSA_SEED=42
python scripts/run_all.pyBigCodeBench requires the official BigCodeBench codebase and its evaluation environment. Set their locations before launching the run:
export WORKSPACE=/workspace
export HF_TOKEN=...
export GORSA_MODEL_ID=meta-llama/Meta-Llama-3-8B-Instruct
export BIGCODEBENCH_REPO=/workspace/src/bigcodebench
export BCB_EVAL_PYTHON=/workspace/.venvs/bcb_eval_py310/bin/python
bash examples/run_bcb_full1140_seed.sh 42Repeat each command with seeds 42 through 46 for the reported seed sweep,
using a distinct $GORSA_ROOT_DIR for each seed.
Each run writes artifacts under $GORSA_ROOT_DIR:
tasks/*.json
run_config.json
summary_pairwise_avg.json
baseline_pairwise_avg.csv
logs/*.log
The main result table is baseline_pairwise_avg.csv; the CodeRSA row is the
paper's fixed equal-weight reranker.
- docs/method.md: scoring and reranking details
- docs/artifacts.md: output and storage notes
- Candidate programs are executed only for benchmark evaluation. Run evaluation stages in a sandboxed environment.
- Large generated outputs, model caches, and virtual environments are excluded from git.