The v0.4 release uses the unified rewardharness CLI and typed configuration
throughout benchmark and evolution workflows. Historical script entry points
remain available as compatibility wrappers.
This walkthrough takes ~15 minutes if you only want to inspect the library and run the tests, and an additional ~3 minutes of pipeline work for a full make demo evolution pass — though vLLM cold-start can add 5–15 minutes the first time the model loads. Each step is independent — feel free to stop after step 3 if you only want to understand the codebase.
git clone https://github.com/TIGER-AI-Lab/RewardHarness.git
cd RewardHarness
python -m venv .venv && source .venv/bin/activate
python -m pip install -e .That's enough for steps 2–4. The optional pip install -r requirements-vllm.txt is only needed when you serve Qwen2.5-VL-7B locally (step 6).
make testYou should see 156 passed. Every external service (Gemini, vLLM, Hugging Face) is mocked, so if any test hits the network it's a regression — please open an issue.
python examples/inspect_library.pyThis adds one Skill (realism-and-artifact-penalties) and one Tool (text-and-ocr-analyzer) to a temp Library, prints the registry, and verifies a round-trip through disk. The Library is just markdown + YAML; understanding this file shape is the whole abstraction.
python examples/show_reasoning_format.pyPrints one full Sub-Agent trace (<think>/<tool>/<obs>/<answer> tags) so you know what the model outputs will look like.
Copy the template and fill in real values:
cp .env.example .env
# edit .env in your editor
set -a; source .env; set +a # exports every var into your shellYou'll need:
- A Vertex AI service-account JSON (
GOOGLE_APPLICATION_CREDENTIALS) - A GCP project ID with Vertex AI enabled (
GEMINI_PROJECT) - (Optional) a Hugging Face token (
HF_TOKEN) for downloading the gatedTIGER-Lab/EditReward-Benchdataset.
If you don't already have one, here's the 5-minute path:
- Pick or create a GCP project at https://console.cloud.google.com/projectcreate. Note the Project ID (not the friendly name) — e.g.,
my-rh-project-12345. SetGEMINI_PROJECTto this value. - Enable the Vertex AI API: https://console.cloud.google.com/apis/library/aiplatform.googleapis.com → pick your project → Enable.
- Create a service account: https://console.cloud.google.com/iam-admin/serviceaccounts → Create Service Account. Give it any name (e.g.,
rewardharness). Grant it theVertex AI Userrole (roles/aiplatform.user). - Generate a JSON key: click the service account → Keys → Add Key → Create new key → JSON. A
.jsonfile downloads. Move it somewhere safe — e.g.,~/.config/gcloud/rewardharness.json. - Point
GOOGLE_APPLICATION_CREDENTIALSat that path in your.env.
Confirm with make check (step 5 below) — it parses the JSON and reports the service-account email if things look right.
make check # or: python scripts/check_env.pyThis catches every common misconfig (missing env var, malformed service-account JSON, unreachable endpoints) in ~10 seconds, instead of after a 4-hour evolution attempt.
pip install -r requirements-vllm.txt
bash scripts/serve_vllm_multi.shBy default this launches one vLLM endpoint per GPU on ports 8000+ (configurable via NUM_GPUS, BASE_PORT, GPU_MEM, …; see .env.example). Edit configs/endpoints.txt if you have a different layout. Verify with:
curl -s http://localhost:8000/v1/models | jq .data[0].id
# → "Qwen2.5-VL-7B-Instruct"(That's --served-model-name from serve_vllm_multi.sh, not the HuggingFace path Qwen/Qwen2.5-VL-7B-Instruct.) To swap in a different OpenAI-compatible VLM, set REWARDHARNESS_SUBAGENT_MODEL before serving and the rest of the pipeline picks it up — see README §"Swapping in a different VLM as Sub-Agent".
make demoRuns scripts/run_evolution.py for exactly one iteration over the 60-example training split and writes results/demo/. Walks through Router → Sub-Agent → ChainAnalyzer → Evolver once, so you can confirm the whole pipeline works on your hardware.
You don't have to run evolution first — rewardharness/resources/library/ ships with the paper's evolved Skills and Tools. To reproduce the paper's headline numbers against a hosted Sub-Agent, just point benchmark at the default (shipped) library:
python scripts/run_benchmark.py --config configs/default.yamlThat reports K=2/3/4 group accuracy on EditReward-Bench using the entries committed at rewardharness/resources/library/. The paper's 45.7% average (Qwen Sub-Agent) and 47.4% (Gemini-2.0-Flash Sub-Agent) headline numbers also include a separate GenAI-Bench pass; see OUTPUTS.md for the schema and the jq recipe to merge results from both passes.
To benchmark your own evolved Library from a prior run instead:
python scripts/run_benchmark.py \
--config configs/default.yaml \
--library-dir results/<run>/checkpoints/bestmake reproduceEnd-to-end: env setup → dataset download → vLLM serve → 5-iteration evolution → EditReward-Bench K=2/3/4 → print results. Needs ≥4 GPUs and ~4–6 hours. See scripts/reproduce.sh for the step list.
If make reproduce dies partway through (cluster preemption, vLLM crash, OOM): the evolution step is checkpoint-resumable. Skip the env+serve steps by hand and resume directly:
python scripts/run_evolution.py --config configs/default.yaml --resumeThen continue with python scripts/run_benchmark.py --config configs/default.yaml.
To match the paper's full 47.4% / 45.7% headline, also run a GenAI-Bench pass after make reproduce finishes and merge the two outputs — see OUTPUTS.md for the merge recipe. The paper headline is the mean of K=2, K=3, K=4, and GenAI-Bench accuracies.
| You want to … | Look at |
|---|---|
| Add a new Skill or Tool | rewardharness/library/repository.py (add_skill, add_tool) |
| Change Sub-Agent prompts | rewardharness/evaluation/engine.py (BASE_INSTRUCTIONS_NO_TOOLS, TOOL_INSTRUCTIONS) |
| Tweak evolution gating | rewardharness/evolution/pipeline.py and evolution.* in configs/default.yaml |
| Swap in a different OpenAI-compatible VLM | Export REWARDHARNESS_SUBAGENT_MODEL=<your-model-id>; point configs/endpoints.txt at your server. No source edit needed. |
| Add a non-OpenAI-compatible VLM backend | Subclass SubAgent in rewardharness/evaluation/engine.py and override _call_vllm (see README §Swapping Sub-Agent). |
| Debug a single example | examples/inspect_library.py + examples/show_reasoning_format.py |
If something breaks, TROUBLESHOOTING.md covers the common failure modes.