EdwardoSunny's picture
Pipeline code snapshot (rubric_gen + gke) matching commit bee1bd2
f45837e verified
|
Raw History Blame Contribute Delete
24.9 kB

AGENTS.md — handoff for the rubric collection + wall-clock experiments

Written 2026-08-16. Read CLAUDE.md first for the project's hard rules; this file is the operational state on top of it: what is running, what is measured, what is built but unrun, and the traps that have already cost time.


0. TL;DR for a new agent

  • You do not need a GPU on your machine. All GPU work runs on GKE. Your box is a coordinator; a laptop is enough.
  • Nothing irreplaceable lives on any single box except .env. Code, rubric libraries, prompts, splits and rubric_gen/results/*.json are in git. All 46 experiment runs are in GCS. 36 prepared competitions (153 GB) are in GCS.
  • The wall-clock experiment is complete and the interpreter wins. Ten implementation defects were found and fixed; the honest conclusion is that feedback precision is the binding constraint, not speed.
  • The new targeted-collection pipeline is BUILT AND NEVER RUN. Three scripts, two known blockers. See §5. Update 2026-08-15: now RUNNING at K=10 — see §8; Blockers B and C are fixed in code, A is being diagnosed by a live pilot.

1. Setting up on a new machine

git clone git@github.com:7peng/agent-cwm.git && cd agent-cwm

# 1. credentials. NOTE: in the original checkout `.env` was a SYMLINK to
#    /root/.agent-cwm.env, which lives on the pod's EPHEMERAL overlay, not on the
#    network volume -- one teardown from losing every key. A durable copy is at
#    /workspace/agent-cwm/.env.backup-onvolume (gitignored via `.env*`).
cp /workspace/agent-cwm/.env.backup-onvolume .env && chmod 600 .env
#    keys present: ANTHROPIC_API_KEY OPENAI_API_KEY GEMINI_API_KEY GITHUB_TOKEN
#    KAGGLE_API_TOKEN HF_TOKEN WANDB_API_KEY OPENROUTER_API_KEY ELEVENLABS_API_KEY

# 2. GCP auth (interactive — a human must do this)
gcloud auth application-default login       # project edward-sun, region us-east1

# 3. coordinator venv (no kubectl, no docker needed)
python3 -m venv gke/.venv
gke/.venv/bin/pip install google-cloud-storage kubernetes google-auth

# 4. analysis venv (only for local plotting / probes)
python3 -m venv .mlebench/venv
.mlebench/venv/bin/pip install -e "swe-rubrics[openai,anthropic]" matplotlib pytest

# 5. restore experiment results from GCS (they are gitignored)
V=gke/.venv/bin/python
for r in v5A v5B v6 v7 gated1 cont1 errcol1 errcol2; do
  $V gke/submit_eval.py collect --run $r
done

You do not need to download competition data locally. Pods fetch prepared tarballs from gs://edward-sun-agent-cwm-evals/data/<comp>/prepared.tar.gz in-region at 850 MiB/s — measured 0.1–1.6 min per competition. Only prepare data locally if you are adding NEW competitions. KAGGLE_API_TOKEN IS in .env -- an earlier note in this file said Kaggle was unavailable, which was wrong: the test that produced that conclusion ran without the env file loaded. `/.kaggleis empty and the installed client (2.2.4) wants OAuth orKAGGLE_API_TOKEN, so export KAGGLE_API_TOKEN=...from.env` first. Rules acceptance per competition is still manual on kaggle.com.

Gitignored, so do not assume a fresh clone has it: .env, .mlebench/, reports/plots/, gke/.venv/, data/gke_runs/.


2. Where everything lives

thing location durable?
performance rubrics rubric_gen/out/performance_dl/ (430 md) git
runtime rubrics rubric_gen/out/runtime_cost/ (56 md) git
error rubrics rubric_gen/pools/rubric_db_errors_v8_branched.jsonl (245) git
gated performance set rubric_gen/out/performance_gated/ (22) git
held-out eval programs rubric_gen/pools/eval_scored_wallclock_v1.jsonl (26) git
frozen split rubric_gen/splits/error_side_5_15.json git
experiment rows data/gke_runs/*.jsonl GCS only
competition data gs://edward-sun-agent-cwm-evals/data/ (36 comps, 153 GB) GCS
findings write-up rubric_gen/WALLCLOCK_FINDINGS.md git
dashboard dashboard.html, published to https://codingwm.github.io/ git

GCS bucket gs://edward-sun-agent-cwm-evals, GKE cluster agent-cwm-evals, project edward-sun, region us-east1. Never point anything at probe-factory/qd-bloom (us-central1).


3. Experiment state

Complete, all on the frozen 5/15 split, 1800 s per arm, coder claude-haiku-4-5, world model claude-opus-5, selector = the coder's model:

run what it tested result
v5A+v5B baseline after 8 fixes, 731 rubrics interpreter improves 58% of programs vs 25% for the best WM arm
gated1 22 causally-gated vs 430 ungated gating cuts breakage 10→7, wins head-to-head 4/7, still loses to interpreter
v6 9th fix: rubric body delivered to the coder head-to-head +4.4% on race, but improved-rate 20%→18%
v7 10th fix: rubric body reaches the INDEX IN FLIGHT (was 9/20 at handoff)
cont1 GPU contention A/B 1.74× slowdown at 3 workers/GPU; timeouts 26%→38%

Headline numbers (v5, complete, 97 arm-runs / 20 programs):

arm graded improved broke median turns budget used
wc_interp 79% 58% 4 14 97%
wc_race 55% 25% 9 84 66%
wc_cwm 47% 21% 10 80 62%
wc_patchrev 45% 15% 11 64 62%
wc_revise (floor) 16% 11% 16 100 —

The mechanism, in one line

The world model takes 8× more turns and delivers fewer actionable signals (6/program) than the interpreter (10 executions/program), because 87% of its turns find nothing. At causal precision 0.196 the effective signal is ~1.2 against the interpreter's ~10 — an ~8× deficit. That, not speed, is the result.

Ten defects found (all were implementation, not method)

  1. error family never retrieved (0.1% of slots) → per-family stratified slots
  2. silent world model triggered a blind rewrite (80% of turns) → widen, never edit
  3. same bug in the race arm's own branch
  4. repeated fires thrashed → escalate to a surgical diff on the 2nd fire
  5. sweep spent the budget on the LLM selector → embedding-only sweep
  6. programs hardcoded the collecting box's data root → relocalize_data_root
  7. keep-best froze on the original at 0 violations → ties go to the later version
  8. predictive rubric body dropped when the WM judged → raw markdown as wm_text
  9. predictive rubric body dropped in the coder's feedback → carry detail
  10. predictive rubric body dropped at indexing (41% of library keyed by a one-line title) → embed_key includes wm_text

Fixes 8–10 are the same root cause at three stages. Fix 10 was found by a planted-target probe, not by reading traces — a retrieval miss leaves no trace.

Corrections already made (do not re-derive these wrongly)

  • Runtime rubrics select hard programs; they do not break them. 11/11 broke looked causal until the interpreter control showed it also fails on those programs (3/7 vs 12/12). Any "the feedback caused X" claim needs the interpreter's outcome on the SAME programs.
  • The race arm uses 66% of its budget, not 18%. The 18% came from 7 rows.
  • Duplication is error-family-specific: performance 98% unique titles, runtime 100%, error only 54%.
  • Gating the 430 is blocked by lost provenance, not only compute.

4. Measured numbers for planning

Do not re-estimate these; they are measured.

quantity value source
states per initial program 1.9 errcol2
eligible code error rate 27% of states errcol2
clean rate 52% errcol2
timeout rate 21% @1800 s, 38% @3 workers/900 s errcol2, cont1
error curation emit rate 25% (20 states → 5 written) out/error_focused_summary.json
→ error rubrics per program 0.13 (≈8 programs per rubric) chained
perf pairs → candidates 1.56 (333 → 520) out/conceptual_candidates_summary.json
candidates → rubrics ~83% 520 → 430
GPU contention factor 1.74× at 3 workers cont1
curation throughput 9.6 calls/s @32 workers measured
whole-library curation 10–15 min computed from above
collection, 77 states 15.8 h serial → ~16 min at 60-way errcol2

Curation is minutes. Collection is hours. The bill is set by the emit-rate chain (0.13 rubrics/program), not by GPU count.

GPU quota, us-east1 (verified via the compute REST API, not assumed): L4 16 on-demand + 16 spot, T4 8 + 8, A100 16 + 64. ~115 of 128 idle. A100s exist only in us-east1-b in this region and spot stockouts there are real.


5. The new collection pipeline — BUILT, NEVER RUN

Three scripts, all committed, 244 tests passing:

# one competition per invocation, so each gets its own GPU pod
python3 rubric_gen/collect_targeted.py --competition <comp> \
    --n-error 10 --n-perf 10 --max-programs 15 --perf-turns 3 --timeout 900 \
    --out data/tgt_<comp>.jsonl

# both families, provenance preserved; perf goes to the VALIDATED spine
python3 rubric_gen/curate_targeted.py --states data/tgt_*.jsonl \
    --out out/targeted_v1 --workers 32
python3 rubric_gen/write_rubrics.py --library out/targeted_v1/candidates_perf.jsonl \
    --out-dir out/targeted_v1/perf_rubrics          # stage 3, do not skip

# K-source / M-eval manifest
python3 rubric_gen/make_split.py --k 10 --add-eval <5 ids> \
    --acknowledge-invalidates --out splits/scale_10_15.json

Routing: crash that is a code defect → error state; clean+graded → climb for score, each improved variant → performance state; timeout → runtime state. Stops when both per-family targets are met. Replaces --n, which cannot control what you get.

Prompts are unchanged from the validated banks. Error reuses errors/prompts.py. Performance drives prompts/conceptual_prompts.py (TRACE_DIAGNOSE) and hands candidates to write_rubrics.py. An earlier draft invented its own performance prompt; that was removed because rubrics from a different prompt are not comparable with the bank that produced the good precision/recall. The real spine also gives you the novelty constraint (dedup against existing criteria — the error family's missing 46%) and proposed_patch, which wc_patchrev applies and the surviving 430-rubric export lacks.

Blocker A — the performance path yields 0 rubrics

errcol2 produced 40 clean programs and 0 graded ones, so climbing never ran (one_trajectory only climbs if grading:). Diagnosed as far as:

  • DATA_DIR is env-driven and correct; run_shard.py do_cmd sets MLEBENCH_DATA_DIR=/scratch/data/mle
  • a CPU-only pod confirmed prepared/private/ is present and a self-grade returns a score

So the failure is in the submission each program writes. _grade_train swallowed the exception; it now logs it. Next step: one-competition pilot and read the logged error. Until then the perf ETA has an unmeasured factor (the climb improvement rate).

Blocker B — the split arithmetic

Only 20 competitions are in the split, so K + M <= 20. --k 10 --m 20 is impossible. The fix is --k 10 --add-eval <5 new>, and 5 usable spare competitions are already prepared in GCS (no Kaggle needed):

detecting-insults-in-social-commentary            0.00 GB
the-icml-2013-whale-challenge-right-whale-redux   0.20 GB
histopathologic-cancer-detection                  5.31 GB
aptos2019-blindness-detection                     8.60 GB
siim-isic-melanoma-classification                86.24 GB   <- impractical per pod

Note make_split.py --add-eval currently checks for local prepared files; it needs extending to accept GCS-resident competitions. Promoting 5 eval competitions to source voids prior eval numbers on them — the script refuses without --acknowledge-invalidates, and that is a human decision, not an agent's.


6. Traps that have already cost time

  • /workspace is a RunPod network volume (mfs#...runpod.net, 755 T); /, /root and /tmp are a disposable 100 G overlay. The repo and all 7.4 GB of untracked temp/ work survive a pod teardown; anything under /root does not. That is how the credential symlink above became a hazard. df -h <path> before assuming a file is safe.

  • --mode cmd gives EVERY shard ALL listed competitions. One job per competition, or every pod downloads 28 GB.

  • Pod resources are not in pod logs. --memory is a string (48Gi, not 48 — 48 means 48 bytes) and ephemeral storage comes from GKE_EPHEMERAL (default 10Gi). Reconstructing a command from a log silently drops both and you get FailedMount ... no space left on device. Diff against a Job that completed cleanly, not against the failing pod's events. Known-good: GKE_EPHEMERAL=100Gi --cpu 8 --memory 48Gi --scratch 150 --gpu nvidia-l4.

  • Regenerating dashboard.html destroys 19 figures. reports/plots/ is gitignored and most PNGs were built on a retired machine, so make_dashboard.py emits "missing figure" boxes. Use codeworld-gym/scripts/inject_tab.py to transplant one tab into the complete page. Same for the published index.html, which also carries a hand-added banner no template knows about.

  • prepared/ directories can exist with zero files. detecting-insults-in-social-commentary locally is an empty shell. Check file counts, not directory existence.

  • --workers 3 inflates timeouts 26%→38%. Fine for error collection (a TypeError is contention-immune), wrong for runtime collection (a timeout is only meaningful under sole occupancy). The existing 56 runtime rubrics were collected at 3–4 workers and should be re-examined.

  • Collection on containers changes what you collect. 14 of 20 "eligible" states in errcol2 were /dev/shm exhaustion, not code defects. The filter is in collect.py is_eligible_error; keep it.

  • Spot is right for collection, wrong for eval. A preempted collection shard loses a few programs; a preempted eval shard destroys a paired comparison.

  • Do not fit anything on the eval set. A fire→outcome rubric filter derived from eval and then reported on eval is leakage. Derive on train, apply to eval.


7. What I would do next, in order

  1. Finish v7 and compare against v6 on common programs. Registered prediction: the retrieval fix raises the head-to-head margin and may again LOWER the improved-rate. If so, three individually-correct fixes all point at precision being the binding constraint.
  2. One-competition collection pilot to fix Blocker A and measure the climb improvement rate — the last guess in the collection ETA.
  3. Train-side fire→outcome filter. The only unblocked precision lever: label each fire by whether the arm underperformed the interpreter on that same program, derive on train, apply to eval. 846 firing turns are already logged; 64 rubrics have ≥3 fires; 5 always fired on a program the arm lost.
  4. k-vote world-model judge — fire only on majority of k independent verdicts. Free: the budget is only 62% used and a WM turn is ~9 s. Do NOT gate on self-reported confidence; that was measured uninformative.
  5. Per-family embedding keys. Measured: keying prose rubrics on wm_text alone puts a planted target at median rank 5 (vs 45 shipped, 287 before), but costs the performance family (6 → 22). Since retrieval is stratified per family, per-family keys should get both.
  6. Only then scale the library. 83% of the current 731 never fires once, so "mine more rubrics" is the weakest lever until precision and retrieval are fixed.

8. Session 2026-08-15: K=10 scale-up launched (fixes + fleet state)

Continuation of §5/§7 by the next agent. Four fixes landed (all committed, 249 tests pass), then the collection and eval-pool fleets were launched.

Eleventh defect: the GPU spread assumed the retired 4-GPU box

collect.execute and wallclock_assist pinned every program to CUDA_VISIBLE_DEVICES ∈ {"1","3","0"} — correct on the old shared box, wrong on every fleet pod, which has exactly ONE GPU enumerated as device 0. Two thirds of programs were pinned to a device that does not exist and silently trained on CPU. Verified in the banked rows: of device-printing programs, errcol2 ran 27 cpu / 11 cuda, cont1 24 cpu / 5 cuda.

Consequences: paired arm comparisons stay fair (the device is a function of state_id, shared by all arms of a program), but ALL absolute rates from pod runs carry the handicap — the 21–38% timeout rates, cont1's "GPU contention" (which was substantially CPU contention), and the runtime family's mined timeout states. The pool is now detected per process (collect.gpu_pool, override RUBRIC_GEN_GPUS=1,3,0 to reproduce the old box); on GKE note nvidia-smi is NOT on PATH (driver mount is /usr/local/nvidia/bin), which gpu_pool handles. v5/v6/v7/gated1 all ran pre-fix; the runtime-cost family should be re-examined against this in addition to the 1.74× contention factor.

Blocker C (new, fixed): target_family never reached disk

one_trajectory appends states to --out BEFORE collect_targeted classifies them, and the annotation was never re-serialized, so curate_targeted — which selects error states by target_family — would have read a file where the field never occurs and silently curated zero error rubrics. Fixed: persist_families writes the annotation back after each program, and curate_targeted re-derives via classify() when the field is missing. Regression tests in tests/test_targeted_persistence.py.

Blocker B (fixed): make_split accepts GCS-resident competitions

make_split.py --gcs-bucket edward-sun-agent-cwm-evals accepts an --add-eval id whose data/<id>/prepared.tar.gz + meta.json exist in the bucket (the empty-shell hazard cannot occur there — the prep job refuses to upload an empty prepared/public). Ids on the frozen excluded list are refused.

The active split: splits/scale_10_15.json

K=10 source = frozen 5 + promoted {random-acts-of-pizza, tabular-playground-series-dec-2021, dogs-vs-cats-redux-kernels-edition, new-york-city-taxi-fare-prediction, tweet-sentiment-extraction}. Eval backfilled to 15 with {detecting-insults-in-social-commentary, the-icml-2013-whale-challenge-right-whale-redux, histopathologic-cancer-detection, aptos2019-blindness-detection, ranzcr-clip-catheter-line-classification} — all GCS-prepared; siim (86 GB) deliberately left out; ranzcr was prepared-but-unlisted in §5's spare list. Prior eval numbers on the 5 promoted competitions are void (--acknowledge-invalidates recorded in the manifest). 10 of the 26 rows in pools/eval_scored_wallclock_v1.jsonl are on promoted competitions and MUST be filtered out of any eval under the new split.

Fleet runs in flight (all --mode cmd, code snapshot carries the fixes)

run(s) what resources
tgt10-<comp> ×10 targeted collection, one per source comp, --n-error 10 --n-perf 10 --max-programs 15 --perf-turns 3 --timeout 900 spot L4
tgtpilot2 small dog-breed pilot whose job is to surface the [grade_train] exception (Blocker A) on-demand L4
pool-<comp> ×8 eval-pool extension: collect.py --split eval + score_states.py on the 5 new eval comps (n=3) + nfl (3), billion-word (2), stanford-covid (2), --timeout 1200 on-demand L4

Collect artifacts with submit_eval.py collect --run <name> (cmd-mode artifacts land in shards/0-artifacts/). Every collection/pool command runs under RUBRIC_GEN_SPLIT=splits/scale_10_15.json.

Update, later that session: collection done (9/10), P/R measured, scaling started

  • Targeted library v1 exists: out/targeted_v1/ — 74 error + 20 perf + 47 runtime rubrics from 9 source comps, full provenance, 0 curation failures. facebook still collecting (see below); fold it in as batch 2 and extend _existing_criteria to read out/targeted_v1 first so batch 2 dedupes against batch 1.
  • P/R on the new eval side (results/pr_results_targeted_v1.json, 104 states / 15 comps, opus judge, annotation truth, 6.8k decisions): error precision 0.958 per decision [0.86, 1.0] (23 TP / 1 FP), library-level 0.889 / recall 0.211; conceptual end-to-end 0.25/0.25 vs chance 0.0105 (24x lift; canonical ungated was 0.19 at 4.1x); all controls 0.000. Precision survives scaling; recall is the scaling lever.
  • Three more traps found live: (1) fleet pods have no reliable external internet — Connection-class download failures are environment facts, now excluded from error eligibility (11 of dog-breed's 18 "errors" were this); (2) shm worker crashes can hide UNDER a different terminal exception — stderr is now checked for the narrow marker; (3) candidates_perf.jsonl rows must carry id (annotate_truth keys on it) — emitted at curation now.
  • facebook-recruiting needs a 100Gi pod AND a solution memory cap. Its programs OOMKilled four pods at 48/60/100Gi. RUBRIC_GEN_SOLUTION_MEM_GB=85 (env-gated RLIMIT_AS in collect._pin_to_block) makes the program die as a MemoryError state instead of killing the container — canary-verified live.
  • Anthropic org TPM is a fleet-wide budget (12M in/min haiku): the old 5×20-180s backoff died under sync retry from ~20 pods; now 8 attempts, 300s cap, jittered. Size any future fleet's parallelism to this.
  • Scale-up in motion: 39 prep jobs submitted for every unprepared, non-excluded MLE-bench comp; failures = the manual Kaggle rules-acceptance list for Edward. Next split: --k 15 + eval to 30 at the same rate, then full MLE-bench; re-measure P/R at each stage. Do NOT launch end-to-end wall-clock evals — Edward decides when. (Pool v2 for that eval already exists: pools/eval_scored_wallclock_v2.jsonl, 26 programs / 14 comps.)

Remaining sequence after these land

  1. Read tgtpilot2 / tgt10-* logs for [grade_train] lines → fix Blocker A → re-run climb where needed.
  2. curate_targeted.py over tgt_*.jsonl (+ curate_runtime.py for the timeout states) → write_rubrics.py stage 3 for perf candidates.
  3. Assemble the v2 eval pool: surviving 16 rows + new pool_scored_* clean graded states (dedupe per trajectory, ~2/comp), under the new split.
  4. The larger eval: wallclock arms including wc_interp and wc_revise (the GPU fix changes execution, so v5's interpreter rows are NOT comparable — every arm must be re-run post-fix), expanded library, new pool, --stratified-retrieval, per-family fire rates in the report.
  5. Noise floors on this hardware (noise_floor.py) before any causal claim.

Scale-up dataset inventory (post-prep-fleet, 2026-08-16)

Bucket now holds 50 prepared competitions. The 39-comp prep sweep ended 14 ok / 10 rules-blocked / 14 size-killed (+1 rules-blocked from a diagnostic rerun: plant-pathology-2021-fgvc8).

Rules acceptance needed (one click each on kaggle.com, then re-run prep_datasets.py submit --competitions ...): plant-pathology-2021-fgvc8, predict-volcanic-eruptions-ingv-oe, rsna-2022-cervical-spine-fracture-detection, rsna-breast-cancer-detection, tensorflow-speech-recognition-challenge, tensorflow2-question-answering, tgs-salt-identification-challenge, us-patent-phrase-to-phrase-matching, uw-madison-gi-tract-image-segmentation, vesuvius-challenge-ink-detection, vinbigdata-chest-xray-abnormalities-detection.

Size-killed at the default prep shape (died 26-55 min in; need bigger scratch/memory AND are per-pod-impractical like siim): 3d-object-detection, cdiscount, contrails, h-and-m, herbarium-2020/21/22, icecube, inaturalist-2019, iwildcam-2019/20, rsna-miccai, seti, siim-covid19. "All of MLE-bench" will have to either solve streaming/shared storage for these or document their exclusion.

Final K=27 state (2026-08-18)

Library: 139 error (post-lint) / 209 perf (92 causally-proven core) / 257 runtime, from 27 source comps; eval side 37 comps, corpus v5 (347 states), annotations v5 (69 literal positives, 99% agreement). Finals on the frozen eval: error 0.595 strict / 0.810 lenient precision, library recall 0.054; conceptual ungated 0.091/0.622 at 21x chance, gated 0.164/0.545 (12 true explanations). Gate pass rate 92/179 (51% proven movers). Structural finding: missing-import failures cannot be caught precisely without per-package rubrics (universal templates are banned at curation now — the sweep-only lint let wave 4 re-derive them 6 ways). The annotation-precision vs causal-precision distinction matters for e2e: the eval punishes fires on real-but-secondary patterns; the gate measures score-moving fixes directly. e2e remains parked for Edward's explicit go.