liu-zhengdong

pai-bench

Run and audit the ITEM-35 v3 Hard (PAI Benchmark) 24-task real-repository coding-agent evaluation using only Python >= 3.10 standard library (`scripts/run_pai_bench.py` + `data/item35_v3_hard.json.gz`). Measures Prior-Aligned Agency Index PAI = 100 * (R * E * T)^(1/3) across paired conventional vs anti-conventional traps and unfamiliar cold-start tasks. Use when evaluating an OpenAI-compatible coding model, checking `oracle` baseline separation, verifying the 7 pack gates, auditing episode traces, or re-scoring saved results.

liu-zhengdong 0 Updated 1d ago

Resources

7
GitHub

Install

npx skillscat add liu-zhengdong/pai-bench

Install via the SkillsCat registry.

SKILL.md

PAI Benchmark v3 Hard Skill

Evaluate any OpenAI-compatible coding model on 24 real multi-file repositories (51–290 files) to measure three orthogonal capabilities:

  • R (Grounded Reliability): solves both clean conventional tasks and paired expectation-violation traps (conv + disc twins) plus unfamiliar cold-start tasks.
  • E (Exploration Path Efficiency): locates root causes using engineering priors instead of defensively scanning unrelated files.
  • T (Expectation-Discrepancy Think Selectivity): avoids verbose over-thinking on routine tasks (tau_conv) while waking focused reasoning when observation violates prior expectation.

All benchmark data (data/item35_v3_hard.json.gz), scoring (scripts/run_pai_bench.py), and task documentation (TASKS.md, README.md) are self-contained inside this skill directory with zero third-party pip dependencies (Python >= 3.10 stdlib only).

Workflow

Step 1: Verify Sandbox Integrity & Oracle Separation (Required First)

Before benchmarking any model, run the built-in self-test from inside the repository/skill root directory (and optionally audit all 7 dataset gates G1..G7 offline):

python3 scripts/run_pai_bench.py --unit
python3 scripts/build_v3_hard_pack.py --verify-pack data/item35_v3_hard.json.gz

Expected: exits 0 with [run_pai_bench --unit] ALL PASSED! and shows clean Oracle separation (oracle_prior_guided PAI = 100.00, sim_wide_scanner PAI = 0.00, sim_blind_guesser PAI = 0.00).

To inspect all 24 tasks without running models:

python3 scripts/run_pai_bench.py --list-tasks

Step 2: Choose Safe Runtime Flags for Target Model

Pick parameters according to model speed and rate limits:

Model Profile Recommended Flags Rationale
Fast standard / coding models --workers 2 --max-turns 40 --max-tokens 8192 --request-timeout 360 --resume Respects strict API concurrency caps while enabling atomic per-task checkpointing
Explicit reasoning / CoT models (high effort) --workers 1 --max-turns 40 --max-tokens 16384 --request-timeout 360 --resume Prevents HTTP 502 "cut at its length" when thinking tokens exceed 8K and avoids per-turn timeouts on large files
Quick smoke test on selected tasks Add --task-ids V02_conv V02_disc V_U01 Verifies endpoint tool-calling compatibility in ~1 minute before running all 24 tasks

Never edit files in the benchmark pack; tests/ fixtures inside each sandbox are read-only grading suites.

Step 3: Execute Benchmark Run

Run with your target OpenAI-compatible endpoint (OPENAI_API_KEY or custom env var name via --api-key-env):

python3 scripts/run_pai_bench.py \
  --mode openai \
  --base-url https://api.openai.com/v1 \
  --model <model-id> \
  --api-key-env OPENAI_API_KEY \
  --workers 2 \
  --max-turns 40 \
  --max-tokens 8192 \
  --request-timeout 360 \
  --resume \
  --out-json out_<model>.json

Optional flags:

  • --reasoning-effort low|medium|high|max (only pass if the endpoint accepts reasoning_effort).
  • --temperature <float> (omit to keep server default).
  • --arms conventional discrepancy unfamiliar (subset selection).

If interrupted or if any tasks fail with api_error (429 rate limits or timeouts), re-run the exact same command with --resume: clean episodes without api_error are reused automatically and only failed/missing tasks are retried.

Step 4: Audit Raw Traces & Confirm Zero API Errors (Mandatory)

Never report only headline numbers without inspecting failures and verifying api_error_count == 0:

python3 scripts/run_pai_bench.py --audit-json out_<model>.json

Checklist before accepting a score:

  1. task_count == 24 and api_error_count == 0.
  2. Check test_integrity_ok (int=True) across all 24 episodes (any tampering under tests/ invalidates pass).
  3. Compare passed, PAI, R, E, T, DecoyRate, ThinkGap, and conv vs disc per-pair telemetry against the reference baselines in README.md and TASKS.md.
  4. To recompute PAI metrics cleanly after inspecting logs (zero API calls):
python3 scripts/run_pai_bench.py --rescore-json out_<model>.json