Download scripts/leak_audit.py from drkylj/prophet: direct link, hf CLI and curl.
- Browser
- Download file 1.52 kB
-
https://huggingface.co/datasets/drkylj/prophet/resolve/main/scripts/leak_audit.py
- Command line
-
hf download hf://datasets/drkylj/prophet/scripts/leak_audit.py
-
curl -L -o leak_audit.py https://huggingface.co/datasets/drkylj/prophet/resolve/main/scripts/leak_audit.py
1.52 kB
| """Leak audit: for each task, look for every target's ground-truth score (4 significant decimals) | |
| in the files the agent can see. A hit is legitimate only if the same score was already visible | |
| (an earlier, already-seen submission with the identical score, e.g. a resubmitted payload).""" | |
| import glob, json, os, re, sys | |
| from collections import Counter | |
| root = sys.argv[1] | |
| c = Counter(); bad = [] | |
| for t in sorted(glob.glob(os.path.join(root, '*'))): | |
| gt = json.load(open(f'{t}/tests/ground_truth.json'))['targets'] | |
| ctx = f'{t}/environment/context' | |
| blob = '' | |
| for f in glob.glob(f'{ctx}/**/*', recursive=True): | |
| if os.path.isfile(f) and os.path.getsize(f) < 50_000_000: | |
| blob += open(f, errors='replace').read() | |
| seen = json.load(open(f'{ctx}/submissions.json')) | |
| seen_scores = [s.get('score') for s in seen if s.get('result') == 'seen' and s.get('score') is not None] | |
| for g in gt: | |
| s = g['score'] | |
| if s in (0.0, 100.0) or s is None: | |
| c['trivial'] += 1; continue | |
| pat = f'{s:.6f}'[:-2] # 4 decimals, truncated | |
| if pat in blob: | |
| if any(abs((x or 0) - s) < 1e-9 for x in seen_scores): | |
| c['hit_legit_same_score_seen'] += 1 | |
| else: | |
| c['HIT_SUSPECT'] += 1; bad.append((os.path.basename(t), g['index'], s)) | |
| else: | |
| c['clean'] += 1 | |
| print(c) | |
| for b in bad[:30]: print('SUSPECT', b) | |
| json.dump(bad, open(os.path.join(root, '..', os.path.basename(root) + '.leak_suspects.json'), 'w')) | |