File size: 10,569 Bytes
5ce45af 7c3bd43 5ce45af | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | """Write results/deep.md from the files on the node. Every figure is read from a file; a missing one is said.
python tools/report_deep.py /data/train/mini [deep] > results/deep.md
"""
import collections
import glob
import json
import statistics
import sys
R = sys.argv[1] if len(sys.argv) > 1 else "/data/train/mini"
TAG = sys.argv[2] if len(sys.argv) > 2 else "deep"
def load(p):
try:
return json.load(open(p))
except Exception:
return None
def minutes(traj):
ts = [(m.get("extra") or {}).get("timestamp") for m in traj["messages"] if m["role"] in ("assistant", "tool")]
ts = [t for t in ts if t]
return (max(ts) - min(ts)) / 60 if len(ts) > 1 else None
def main():
out = []
w = out.append
ids = (load(f"{R}/src/eval/subset.json") or {}).get("instance_ids", [])
w("# Deep mode: several attempts, one answer" + ("" if TAG == "deep" else f" (the variant in `results/{TAG}`)"))
w("")
w("Measured on 2026-12-01 on the node. Deep mode sends one task to N attempts of the model at temperature 0.8 and")
w("returns one patch, chosen without the benchmark's tests (`deep/select.py`). As a model id for any chat request it is")
w("`rightnow-mini-deep` (`deep/server.py`).")
w("")
w("Attempts: the bash-only agent of `baseline.md`, at most 100 steps and 8,192 new tokens a step, served by the engine")
w("of `speed.md` (drafting on).")
w("")
att = {}
dur = collections.defaultdict(dict)
for d in sorted(glob.glob(f"{R}/results/{TAG}/att-*")):
k = int(d.rsplit("-", 1)[1])
s = load(d + "/summary.json")
st = collections.Counter()
for f in glob.glob(d + "/*/*.traj.json"):
try:
t = json.load(open(f))
except ValueError:
continue
st[t["info"].get("exit_status")] += 1
m = minutes(t)
if m is not None:
dur[t.get("instance_id") or f.split("/")[-2]][k] = m
att[k] = (s, st)
w("## Single attempts at temperature 0.8")
w("")
w("| Attempt | Resolved of 100 | Runs that submitted a patch | Runs that hit the step limit |")
w("|---|---|---|---|")
singles = []
for k, (s, st) in sorted(att.items()):
owed = bool(s) and s.get("error") and (s.get("rescored_alone") is None or s["rescored_alone"].get("still_error"))
if s and not owed:
singles.append(s["resolved"])
cell = "not scored" if not s else (f"{s['resolved']} so far ({s['error']} instances errored in scoring, to be scored again)" if owed else str(s["resolved"]))
w(f"| {k} | {cell} | {st.get('Submitted', 0)} | {st.get('LimitsExceeded', 0)} |")
w("")
if singles:
w(f"Single attempts with complete scoring ({len(singles)}): lowest {min(singles)}, median {statistics.median(singles)}, highest {max(singles)} of 100.")
w("")
resolved_by = collections.defaultdict(set)
for k, (s, _st) in att.items():
for i in (s or {}).get("resolved_ids", []):
resolved_by[i].add(k)
w("## Deep mode")
w("")
w("Three ways to choose are scored. All start the same way: a patch that more than half of the attempts share wins.")
w("When no patch has that majority:")
w("")
w("- rule A takes the patch most attempts share, then the shortest, with no model call;")
w("- rule B asks the model to read the distinct patches and vote three times (reasoning effort 0.3, candidate order rotated);")
w("- rule C gives the model one more session with tools in the task's container: it reads the candidates, writes a")
w(" reproduction, tries each candidate and submits the final patch (`deep/review.yaml`, `tools/review_run.sh`). If that")
w(" session returns no patch, rule A's choice stands.")
w("")
w("No rule sees the benchmark's tests.")
w("")
w("| N | Rule A: most shared patch | Rule B: the model reads and votes | Rule C: a reviewing session with tools | Tasks with a majority patch | Reviews in B that cast no vote | No attempt made a patch | At least one of the N attempts resolved it (upper bound, uses the benchmark's tests) |")
w("|---|---|---|---|---|---|---|---|")
PA, PB, PC = ("deepA", "deepR", "deepC") if TAG == "deep" else (TAG + "A", TAG + "R", TAG + "C")
deep = {}
for n in (2, 4, 8, 16, 32):
sa, sb = load(f"{R}/results/agent/{PA}-n{n}/summary.json"), load(f"{R}/results/agent/{PB}-n{n}/summary.json")
la, lb = load(f"{R}/results/agent/{PA}-n{n}/select.json"), load(f"{R}/results/agent/{PB}-n{n}/select.json")
if not (sa or sb or la or lb):
continue
dec = (lb or la or {}).get("decided", {})
oracle = sum(1 for i in ids if any(k <= n for k in resolved_by.get(i, ()))) if all(att.get(k, (None,))[0] for k in range(1, n + 1)) else None
deep[n] = (sa or {}).get("resolved"), (sb or {}).get("resolved")
sc = load(f"{R}/results/agent/{PC}-n{n}/summary.json")
def cell(x, none):
if not x:
return none
owed = x.get("error") and (x.get("rescored_alone") is None or x["rescored_alone"].get("still_error"))
return f"{x['resolved']} so far ({x['error']} instances to be scored again)" if owed else "**%d**" % x["resolved"]
w(f"| {n} | {cell(sa, 'not scored')} | {cell(sb, 'not scored' if lb else 'not run')} | {cell(sc, 'not run')} | {dec.get('agreement', '')} | "
f"{('%s of %s' % (lb.get('reviews_with_no_vote', ''), dec.get('review', ''))) if lb else 'not run'} | {dec.get('no attempt produced a patch', 0)} | "
f"{oracle if oracle is not None else 'not all attempts scored'} |")
w("")
for n in (2, 4, 8, 16, 32):
lc = load(f"{R}/results/agent/{PC}-n{n}/select.json")
if lc:
rt = lc.get("returned", {})
w(f"Rule C at N={n}: {lc.get('reviewed')} tasks went to a reviewing session. It returned one of the candidates unchanged for "
f"{rt.get('candidate', 0)}, a patch of its own for {rt.get('new patch', 0)} and nothing for {rt.get('no patch, rule A kept', 0)}; "
f"its answer differs from rule A's for {lc.get('changed_from_rule_a')} tasks.")
w("")
first = []
for n in (2, 4, 8):
s0, l0 = load(f"{R}/results/agent/{TAG}-n{n}/summary.json"), load(f"{R}/results/agent/{TAG}-n{n}/select.json")
if s0 and l0:
rv = [t for t in l0["tasks"] if t["how"] == "review"]
first.append(f"N={n}: {s0['resolved']} ({sum(1 for t in rv if not t.get('votes'))} of {len(rv)} reviews cast no vote)")
if first:
w("A first run of rule B asked for the answer within 4,096 tokens at the model's default reasoning effort. The model spent")
w("them reasoning and gave no answer in most reviews, so those tasks fell to the tie-break (the most shared patch, then the")
w(f"shortest). Its scores are kept in `agent/{TAG}-n*` and are not the ones above: " + "; ".join(first) + ".")
w("")
opus = load(f"{R}/results/agent/opus55-1/summary.json")
extra = 0
for rf in glob.glob(f"{R}/results/agent/opus55-1/rescore/*.json"):
extra += len(set((load(rf) or {}).get("resolved_ids") or []) - set((opus or {}).get("resolved_ids") or []))
if opus:
w(f"Opus 5.5 on the same 100 tasks, one attempt: {opus['resolved'] + extra} (`baseline.md`).")
w("")
runs = glob.glob(f"{R}/results/agent/{PA}-n*") + glob.glob(f"{R}/results/agent/{PB}-n*") + glob.glob(f"{R}/results/agent/{PC}-n*") + glob.glob(f"{R}/results/{TAG}/att-*")
sums = {d: load(d + "/summary.json") or {} for d in runs}
done = [d for d in runs if sums[d].get("rescored_alone") is not None]
owed = [d.split("/results/")[1] for d in runs if sums[d].get("error") and sums[d].get("rescored_alone") is None]
gained = [d.split("/results/")[1] for d in done if sums[d]["rescored_alone"]["resolved"]]
w("Scoring an instance can error on a busy machine: a docker call times out while hundreds of other containers start and")
w("stop, and one instance (`scikit-learn__scikit-learn-14710`) runs out of time when its cores are shared.")
w("Wherever an instance's scoring errored it was scored again alone and that result is the one counted")
w(f"(`eval/rescore.sh`; every run alike, Opus 5.5's too). Done for {len(done)} of the runs above; it added a resolved task in "
f"{len(gained)}" + (f" ({', '.join(sorted(gained))})" if gained else "") + "."
+ (f" Not yet done when this file was written: {', '.join(sorted(owed))}." if owed else ""))
w("")
w("## Wall clock")
w("")
for n in sorted(deep):
per = [max(v[k] for k in range(1, n + 1)) for v in dur.values() if all(k in v for k in range(1, n + 1))]
sel = load(f"{R}/results/agent/{PB}-n{n}/select.json") or {}
secs = sorted(t.get("seconds", 0) for t in sel.get("tasks", []))
if per:
per.sort()
line = (f"- N={n}: the slowest of the N attempts took {statistics.median(per):.1f} minutes at the median task and "
f"{per[int(len(per) * 0.9)]:.1f} at the 90th percentile")
if secs:
line += (f"; choosing by rule B took {statistics.median(secs):.0f} s at the median and {secs[int(len(secs) * 0.9)]:.0f} s at the "
"90th percentile (rule A takes no time)")
w(line + ".")
w("")
w("These times are from a batch run: the attempts of all 100 tasks shared the GPU (60 agent sessions on one GPU at a time),")
w("so they are an upper reading of what one task alone would take.")
alone = []
try:
alone = [json.loads(x) for x in open(f"{R}/results/alone/timing.jsonl") if x.strip()]
except OSError:
pass
if alone:
w("")
w(f"One task alone (`tools/alone_timing.sh`): the first {len(alone)} tasks of the subset, each given the whole GPU, "
f"{alone[0]['n']} attempts side by side, timed from the start to the end of the last attempt:")
w("")
w("| Task | Minutes | Attempts that made a patch | Steps per attempt |")
w("|---|---|---|---|")
for x in alone:
st = x.get("steps_per_attempt") or []
w(f"| `{x['instance_id']}` | {x['seconds'] / 60:.1f} | {x['attempts_with_patch']} of {x['n']} | {min(st) if st else '?'} to {max(st) if st else '?'} |")
else:
w("One task alone was not timed.")
print("\n".join(out))
if __name__ == "__main__":
main()
|