S3RL4 commited on
Commit
9ccf73d
·
verified ·
1 Parent(s): 81c3cc6

Remove bad duplicated upload directories

Browse files
VERIFICATION-DOSSIER-PUBLIC.md/VERIFICATION-DOSSIER-PUBLIC.md DELETED
@@ -1,62 +0,0 @@
1
- # Verification dossier — public summary
2
-
3
- This is the public part of RE-Lab's verification dossier for `binary-reasoning-v1`. The full buyer-ready version adds procurement, provenance tables, calibration plans, and delivery details. Contact: samueljanttila@gmail.com.
4
-
5
- **Dataset:** https://huggingface.co/datasets/S3RL4/binary-reasoning-v1
6
- **Self-serve sample kit:** `verification_kit/README.md` in this dataset repo
7
- **Canary for contamination checks:** `RE-Lab-brv-2026-10-29-8c1e4f7a`
8
-
9
- ## What is verified now
10
-
11
- ### 1. Pack counts and grader split
12
- The full pack contains `10,251` items:
13
- - `10,172` deterministic-graded items.
14
- - `79` rubric-judged open-ended items, disclosed rather than sold as deterministic.
15
-
16
- The public sample includes 9 free items and a 100-item open sample in the Prime environment package. The sample kit skips rubric-judged items instead of pretending they are deterministic.
17
-
18
- ### 2. Grader sanity checks
19
- On the 100-item open sample, the public sample kit reports:
20
- - `gold.py`: deterministic gold replies pass `84/84`; `16` judge items skipped.
21
- - `do_nothing.py`: empty answers score `0` on all `84` deterministic items.
22
- - `random_wrong.py`: deterministic mutated wrong answers score `0` on all `84` deterministic items.
23
- - `grader_tamper.py`: mutating the answer key makes the original gold reply fail on all `84` deterministic items.
24
- - `leak_check.py`: `items=100 unique_ids=100 checked_rows=73 leaks=0`.
25
-
26
- On the 9-item free sample:
27
- - deterministic sanity checks pass `4/4`; `5` judge items skipped.
28
- - `leak_check.py`: `items=9 unique_ids=9 checked_rows=3 leaks=0`.
29
-
30
- ### 3. Answer-leak audit
31
- The existing full-pack answer-token audit reports `0/10,251` exact-token leaks. The public sample script is a smaller reproduction tool and reports checked-row coverage (`73/100` checkable rows on the open sample; `3/9` on the free sample). It does not replace the full-pack audit.
32
-
33
- ### 4. Agentic environments
34
- The public agentic tier has `29` Harbor-format flag-hunt environments. The Docker reward chain was tested with gold answers and wrong-answer tests, and each binary was checked with 24 single-character mutations that scored zero. In the JSONL/verifiers path, the deterministic grader checks whether the stored flag appears in the reply as a substring; that is weaker than the Harbor oracle.
35
-
36
- ### 5. Hard-trial reproduction evidence
37
- The 99-item hard trial pack has 19 family-level reproduction scripts in RE-Lab's pinned Ubuntu 24.04/WSL2 and Windows test environment. They reproduce `99/99` gold answers without reading the `answer` field. About `77` rows are command/binary re-execution (reproducibility, not an independent solve); about `22` rows use static ELF/PE/argv-derived reasoning. No human solved these tasks.
38
-
39
- ### 6. Calibration evidence so far
40
- The public agentic tier is intentionally warm-up level for a frontier agent: Claude Opus 5.5 solved `29/29` environments and `145/145` attempts in a non-isolated host run with Bash/Read tools, graded by the binary oracle.
41
-
42
- A separate local open-weight calibration run on the 99-item hard trial pack scored `14/99` at pass@8:
43
- - model: `qwen3.8-flash-next-iq3_s`, 3-bit quantized;
44
- - single-turn, no tools;
45
- - temperature `0.7`, `max_tokens=600`, with a `reasoning_content` fallback;
46
- - whole-reply normalized matching rather than each item's verifier rule.
47
-
48
- That is headroom evidence, not a published band table or proof that each task sits in the RL mid-band. Per-buyer model calibration is part of the paid pilot path.
49
-
50
- ## Known limitations and caveats
51
- - Current deterministic graders can accept some "shotgun" replies that contain the correct token among many distractors. A dedicated `shotgun.py` probe is a planned kit addition.
52
- - Some hard-trial reproduction scripts are environment-bound: they depend on local paths, WSL/Windows tools, pinned package digests, or host-specific loader behavior. They are evidence, not yet a portable buyer-runnable solver suite.
53
- - Some shipped artifact sets include grader-side metadata or unstripped twins that could reveal an answer if mounted to the model. A model-visible vs grader-only manifest is needed before selling sealed evaluation as fully isolated.
54
- - The full-pack public exposure window was 2026-10-28 22:02 → 2026-10-29 17:08 UTC, then older public versions were deleted. Deletion reduces future access but does not prove no copies exist.
55
- - The full pack uses production distro binaries with per-item provenance (`binary` path + `sha256_16`, plus address/size/architecture where applicable). A source-offer manifest lists `649` distinct third-party file names; upstream package/source mapping is a procurement follow-up for any redistribution-heavy order.
56
-
57
- ## What this does not claim
58
- - It does not claim human or expert hand-checking of every task.
59
- - It does not claim every task is model-solvable without tools.
60
- - It does not claim the deterministic graders reject all low-effort answers.
61
- - It does not claim the hard trial pack has a published pass-rate band for every task yet.
62
- Add public verification summary
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
environment/src/binary_reasoning_v1/grading.py/environment/src/binary_reasoning_v1/grading.py DELETED
@@ -1,115 +0,0 @@
1
- """Deterministic grading for binary-reasoning-v1 items. Pure functions, no framework deps."""
2
- import json
3
- import re
4
-
5
- JUDGE_FAMILIES = {"func_summary", "arch_semantics_qa", "isa_semantics_qa", "pe_import_reasoning", "pe_structure_qa"}
6
-
7
-
8
- def norm_symbol(s: str) -> str:
9
- s = s.strip().lower()
10
- s = re.sub(r"^[*&]+", "", s)
11
- s = re.sub(r"\(.*\)$", "", s).strip()
12
- s = re.sub(r"\.+$", "", s) # sentence-final dot captured by token regex
13
- return s
14
-
15
-
16
- def _answer_symbol(answer) -> str:
17
- if isinstance(answer, dict):
18
- return answer.get("symbol", "")
19
- return str(answer)
20
-
21
-
22
- def grade_func_id_exact(reply: str, answer) -> float:
23
- sym = norm_symbol(_answer_symbol(answer))
24
- if not sym:
25
- return 0.0
26
- accepted = {sym}
27
- if isinstance(answer, dict):
28
- accepted |= {norm_symbol(a) for a in answer.get("aliases", []) if a}
29
- toks = [norm_symbol(t) for t in re.findall(r"[A-Za-z_][A-Za-z0-9_.]+", reply)]
30
- return 1.0 if accepted & set(toks) else 0.0
31
-
32
-
33
- def grade_func_id_mc(reply: str, answer: dict) -> float:
34
- correct = answer.get("correct", "")
35
- opts = answer.get("options", [])
36
- r = reply.strip()
37
- m = re.search(r"\b([A-D])\b", r[:80], re.IGNORECASE)
38
- if m:
39
- idx = ord(m.group(1).upper()) - 65
40
- if 0 <= idx < len(opts):
41
- return float(norm_symbol(opts[idx]) == norm_symbol(correct))
42
- names = [norm_symbol(o) for o in re.findall(r"[A-Za-z_][A-Za-z0-9_.]{3,}", r.lower())]
43
- return 1.0 if norm_symbol(correct) in names else 0.0
44
-
45
-
46
- def grade_tcfp(reply: str, answer: dict) -> float:
47
- strs = answer.get("toolchain_strings", [])
48
- if not strs:
49
- return 0.0
50
- hits = sum(1 for s in strs if s.lower() in reply.lower())
51
- return hits / len(strs)
52
-
53
-
54
- def needs_judge(family: str, answer) -> bool:
55
- if family in JUDGE_FAMILIES:
56
- return True
57
- if family == "func_id_exact":
58
- sym = _answer_symbol(answer)
59
- # descriptive/inferred answers (contain prose) cannot be string-matched
60
- return (" " in sym.strip()) or ("inferred" in sym.lower())
61
- return False
62
-
63
-
64
- def grade_agentic(reply: str, answer) -> float:
65
- flag = _answer_symbol(answer)
66
- return 1.0 if flag and flag in reply else 0.0
67
-
68
-
69
- def grade_crossarch(reply: str, answer) -> float:
70
- if isinstance(answer, str):
71
- try:
72
- answer = json.loads(answer)
73
- except Exception:
74
- answer = {"same": "true" in answer.lower(),
75
- "symbol": re.sub(r'.*?"symbol"\s*:\s*"([^"]+)".*', r"\1", answer) if '"symbol"' in answer else ""}
76
- want = bool(answer.get("same"))
77
- r = reply.lower()
78
- neg = bool(re.search(r"\bnot\s+(the\s+)?same\b|\bdifferent\b|\bno\b", r))
79
- pos = not neg and bool(re.search(r"\bsame\b|\byes\b|\btrue\b|match", r))
80
- if not (neg or pos):
81
- return 0.0 # abstention / no clear stance
82
- if pos != want:
83
- return 0.0
84
- if want:
85
- sym = norm_symbol(answer.get("symbol", ""))
86
- toks = [norm_symbol(t) for t in re.findall(r"[A-Za-z_][A-Za-z0-9_.]+", reply)]
87
- if sym not in toks:
88
- return 0.0
89
- return 1.0
90
-
91
-
92
- def grade_library_ident(reply: str, answer) -> float:
93
- ans = _answer_symbol(answer)
94
- toks = [t for t in re.split(r"\s+", ans) if len(t) >= 2]
95
- r = reply.lower()
96
- return 1.0 if all(t.lower() in r for t in toks) else 0.0
97
-
98
-
99
- def grade_item(family: str, reply: str, answer) -> float:
100
- if needs_judge(family, answer):
101
- return 0.0 # handled by rubric judge in taskset.py
102
- if family == "library_ident":
103
- return grade_library_ident(reply, answer)
104
- if family == "crossarch_equivalence":
105
- return grade_crossarch(reply, answer)
106
- if family == "agentic_flag_hunt":
107
- return grade_agentic(reply, answer)
108
- if family == "func_id_exact":
109
- return grade_func_id_exact(reply, answer)
110
- if family == "func_id_mc":
111
- return grade_func_id_mc(reply, answer)
112
- if family == "toolchain_fp":
113
- return grade_tcfp(reply, answer)
114
- return 0.0
115
- Add grader module used by verification kit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
verification_kit/README.md/verification_kit/README.md DELETED
@@ -1,53 +0,0 @@
1
- # Verification kit — sample-level checks
2
-
3
- This small kit lets a buyer's researcher sanity-check the grader and answer hygiene without trusting RE-Lab. It runs on the public sample JSONL files; it does not require the paid full pack. The grader scripts import `binary_reasoning_v1.grading` from `environment/src/binary_reasoning_v1/grading.py` (`leak_check.py` does not), so include that file (or the Prime environment package) when downloading just the free sample.
4
-
5
- ## Run it
6
-
7
- From the dataset root:
8
-
9
- ```bash
10
- python verification_kit/gold.py sample_free.jsonl
11
- python verification_kit/do_nothing.py sample_free.jsonl
12
- python verification_kit/random_wrong.py sample_free.jsonl
13
- python verification_kit/leak_check.py sample_free.jsonl
14
- python verification_kit/grader_tamper.py sample_free.jsonl
15
- ```
16
-
17
- If the 100-item open sample is present locally, point the same scripts at it:
18
-
19
- ```bash
20
- python verification_kit/gold.py environment/src/binary_reasoning_v1/items.jsonl
21
- python verification_kit/do_nothing.py environment/src/binary_reasoning_v1/items.jsonl
22
- python verification_kit/random_wrong.py environment/src/binary_reasoning_v1/items.jsonl
23
- python verification_kit/leak_check.py environment/src/binary_reasoning_v1/items.jsonl
24
- python verification_kit/grader_tamper.py environment/src/binary_reasoning_v1/items.jsonl
25
- ```
26
-
27
- ## What each script checks
28
-
29
- | Script | What it does | Expected result |
30
- |---|---|---|
31
- | `gold.py` | Builds a reply from the stored answer and grades it. | Deterministic items score `1.0`; rubric-judged items are skipped, not silently graded. |
32
- | `do_nothing.py` | Grades an empty reply. | Deterministic items score `0`. |
33
- | `random_wrong.py` | Builds a deterministic mutated wrong reply and grades it. | Deterministic items score `0`. It is not stochastic random guessing. |
34
- | `leak_check.py` | Extracts exact hidden answer tokens where possible and searches the model-facing `input` field. | Reports checked-row coverage; no exact-token leaks on the public samples. |
35
- | `grader_tamper.py` | Mutates the stored answer key and grades the original gold reply against it. | The original gold reply no longer scores, showing that grading depends on the answer key. |
36
-
37
- ## Measured results on this workspace (2026-10-30)
38
-
39
- On `sample_free.jsonl`:
40
- - `gold.py`, `do_nothing.py`, `random_wrong.py`, and `grader_tamper.py`: `4/4` deterministic items pass; `5` rubric-judged items are skipped.
41
- - `leak_check.py`: `items=9 unique_ids=9 checked_rows=3 leaks=0`.
42
-
43
- On the 100-item open sample at `environment/src/binary_reasoning_v1/items.jsonl`:
44
- - `gold.py`, `do_nothing.py`, `random_wrong.py`, and `grader_tamper.py`: `84/84` deterministic items pass; `16` rubric-judged items are skipped.
45
- - `leak_check.py`: `items=100 unique_ids=100 checked_rows=73 leaks=0`.
46
-
47
- ## Known limitations
48
-
49
- - The current deterministic graders can accept some "shotgun" replies that contain the correct token among many distractors. This kit does not yet include a dedicated `shotgun.py` probe.
50
- - `leak_check.py` scans the raw JSONL `input` field, not every rendered prompt variant. Rows with no extractable exact answer token are reported as unchecked.
51
- - The full-pack answer-leak figure (`0/10,251`) comes from the existing full-pack audit, not from this public sample script.
52
- - The `solvers/` directory contains RE-Lab-run reproduction scripts for internal hard-trial families. Several depend on local paths, WSL/Windows tools, pinned package digests, or host-specific loader behavior, so they are evidence rather than a portable buyer-runnable kit yet.
53
- Add verification kit README
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
verification_kit/do_nothing.py/verification_kit/do_nothing.py DELETED
@@ -1,55 +0,0 @@
1
- #!/usr/bin/env python3
2
- """Do-nothing sanity check: an empty answer should score 0 on deterministic tasks."""
3
- import json
4
- import sys
5
- from pathlib import Path
6
-
7
- ROOT = Path(__file__).resolve().parents[1]
8
- sys.path.insert(0, str(ROOT / "environment" / "src"))
9
- from binary_reasoning_v1.grading import grade_item, needs_judge # noqa: E402
10
-
11
-
12
- def resolve_path():
13
- if len(sys.argv) > 1:
14
- return Path(sys.argv[1])
15
- for p in (ROOT / "sample_free.jsonl", ROOT / "environment/src/binary_reasoning_v1/items.jsonl"):
16
- if p.exists():
17
- return p
18
- raise SystemExit("no sample JSONL found; pass one as argv[1]")
19
-
20
-
21
- def load_rows(path):
22
- rows = []
23
- for line in path.read_text(encoding="utf-8").splitlines():
24
- if line.strip():
25
- rows.append(json.loads(line))
26
- return rows
27
-
28
-
29
- def main():
30
- path = resolve_path()
31
- rows = load_rows(path)
32
- passed = failed = skipped = 0
33
- fails = []
34
- for row in rows:
35
- fam = row.get("family", "")
36
- ans = row.get("answer")
37
- if needs_judge(fam, ans):
38
- skipped += 1
39
- continue
40
- score = grade_item(fam, "", ans)
41
- if score == 0.0:
42
- passed += 1
43
- else:
44
- failed += 1
45
- fails.append((row.get("id"), fam, score))
46
- print(f"file={path}")
47
- print(f"summary: do_nothing pass={passed}/{passed + failed} fail={failed} skipped_judge={skipped}")
48
- for f in fails[:10]:
49
- print("FAIL", *f)
50
- return 0 if failed == 0 else 1
51
-
52
-
53
- if __name__ == "__main__":
54
- raise SystemExit(main())
55
- Add do-nothing sanity check
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
verification_kit/grader_tamper.py/verification_kit/grader_tamper.py DELETED
@@ -1,128 +0,0 @@
1
- #!/usr/bin/env python3
2
- """Grader tamper check: gold replies must fail when the answer key is deliberately mutated."""
3
- import copy
4
- import json
5
- import sys
6
- from pathlib import Path
7
-
8
- ROOT = Path(__file__).resolve().parents[1]
9
- sys.path.insert(0, str(ROOT / "environment" / "src"))
10
- from binary_reasoning_v1.grading import _answer_symbol, grade_item, needs_judge, norm_symbol # noqa: E402
11
-
12
-
13
- def resolve_path():
14
- if len(sys.argv) > 1:
15
- return Path(sys.argv[1])
16
- for p in (ROOT / "sample_free.jsonl", ROOT / "environment/src/binary_reasoning_v1/items.jsonl"):
17
- if p.exists():
18
- return p
19
- raise SystemExit("no sample JSONL found; pass one as argv[1]")
20
-
21
-
22
- def load_rows(path):
23
- rows = []
24
- for line in path.read_text(encoding="utf-8").splitlines():
25
- if line.strip():
26
- rows.append(json.loads(line))
27
- return rows
28
-
29
-
30
- def parse_json_answer(ans):
31
- if isinstance(ans, dict):
32
- return ans
33
- if isinstance(ans, str):
34
- try:
35
- obj = json.loads(ans)
36
- if isinstance(obj, dict):
37
- return obj
38
- except Exception:
39
- pass
40
- return {}
41
-
42
-
43
- def mutate_token(s):
44
- s = str(s)
45
- if not s:
46
- return "RELAB_TAMPER"
47
- mid = len(s) // 2
48
- return f"{s[:mid]}_RELAB_TAMPER_{s[mid:]}"
49
-
50
-
51
- def gold_reply(row):
52
- fam = row.get("family", "")
53
- ans = row.get("answer")
54
- if fam == "func_id_mc" and isinstance(ans, dict):
55
- opts = ans.get("options", [])
56
- correct = norm_symbol(ans.get("correct", ""))
57
- for i, opt in enumerate(opts[:4]):
58
- if norm_symbol(opt) == correct:
59
- return "ABCD"[i]
60
- return str(ans.get("correct", ""))
61
- if fam == "toolchain_fp" and isinstance(ans, dict):
62
- return "\n".join(str(s) for s in ans.get("toolchain_strings", []))
63
- if fam == "crossarch_equivalence":
64
- obj = parse_json_answer(ans)
65
- if bool(obj.get("same")):
66
- return f"Same function: {obj.get('symbol', '')}"
67
- return "Not the same."
68
- sym = _answer_symbol(ans)
69
- return str(sym or ans or "")
70
-
71
-
72
- def tamper_answer(row):
73
- fam = row.get("family", "")
74
- ans = copy.deepcopy(row.get("answer"))
75
- if fam == "func_id_mc" and isinstance(ans, dict):
76
- opts = ans.get("options", [])
77
- correct = norm_symbol(ans.get("correct", ""))
78
- for opt in opts:
79
- if norm_symbol(opt) != correct:
80
- ans["correct"] = opt
81
- return ans
82
- ans["correct"] = f"{ans.get('correct', '')}_RELAB_TAMPER"
83
- return ans
84
- if fam == "toolchain_fp" and isinstance(ans, dict):
85
- ans["toolchain_strings"] = [mutate_token(s) for s in ans.get("toolchain_strings", [])]
86
- return ans
87
- if fam == "library_ident":
88
- return f"{ans}_RELAB_TAMPER"
89
- if fam == "crossarch_equivalence":
90
- obj = parse_json_answer(ans)
91
- obj["same"] = not bool(obj.get("same"))
92
- if isinstance(ans, str):
93
- return json.dumps(obj)
94
- return obj
95
- if isinstance(ans, dict):
96
- ans["symbol"] = f"{ans.get('symbol', '')}_RELAB_TAMPER"
97
- ans["aliases"] = [f"{a}_RELAB_TAMPER" for a in ans.get("aliases", [])]
98
- return ans
99
- return f"{ans}_RELAB_TAMPER"
100
-
101
-
102
- def main():
103
- path = resolve_path()
104
- rows = load_rows(path)
105
- passed = failed = skipped = 0
106
- fails = []
107
- for row in rows:
108
- fam = row.get("family", "")
109
- ans = row.get("answer")
110
- if needs_judge(fam, ans):
111
- skipped += 1
112
- continue
113
- score = grade_item(fam, gold_reply(row), tamper_answer(row))
114
- if score < 1.0:
115
- passed += 1
116
- else:
117
- failed += 1
118
- fails.append((row.get("id"), fam, score))
119
- print(f"file={path}")
120
- print(f"summary: grader_tamper pass={passed}/{passed + failed} fail={failed} skipped_judge={skipped}")
121
- for f in fails[:10]:
122
- print("FAIL", *f)
123
- return 0 if failed == 0 else 1
124
-
125
-
126
- if __name__ == "__main__":
127
- raise SystemExit(main())
128
- Add answer-key sensitivity check
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
verification_kit/leak_check.py/verification_kit/leak_check.py DELETED
@@ -1,72 +0,0 @@
1
- #!/usr/bin/env python3
2
- """Answer-leak audit: hidden answer labels/tokens should not appear in the model-facing input."""
3
- import json
4
- import re
5
- import sys
6
- from pathlib import Path
7
-
8
- ROOT = Path(__file__).resolve().parents[1]
9
-
10
-
11
- def resolve_path():
12
- if len(sys.argv) > 1:
13
- return Path(sys.argv[1])
14
- for p in (ROOT / "sample_free.jsonl", ROOT / "environment/src/binary_reasoning_v1/items.jsonl"):
15
- if p.exists():
16
- return p
17
- raise SystemExit("no sample JSONL found; pass one as argv[1]")
18
-
19
-
20
- def load_rows(path):
21
- rows = []
22
- for line in path.read_text(encoding="utf-8").splitlines():
23
- if line.strip():
24
- rows.append(json.loads(line))
25
- return rows
26
-
27
-
28
- def candidate_names(row):
29
- ans = row.get("answer")
30
- names = []
31
- if isinstance(ans, dict):
32
- if isinstance(ans.get("symbol"), str):
33
- names.append(ans["symbol"])
34
- if isinstance(ans.get("correct"), str):
35
- names.append(ans["correct"])
36
- for alias in ans.get("aliases", []):
37
- if isinstance(alias, str):
38
- names.append(alias)
39
- for s in ans.get("toolchain_strings", []):
40
- if isinstance(s, str):
41
- names.append(s)
42
- elif isinstance(ans, str) and re.fullmatch(r"[A-Za-z_][A-Za-z0-9_.]{4,}", ans):
43
- # Exact-symbol / flag-style answers. Prose and JSON answers are handled by rubric/judge paths.
44
- names.append(ans)
45
- return [n for n in names if len(n) >= 4]
46
-
47
-
48
- def main():
49
- path = resolve_path()
50
- rows = load_rows(path)
51
- leaks = []
52
- checked_rows = 0
53
- ids = [row.get("id") for row in rows]
54
- for row in rows:
55
- candidates = candidate_names(row)
56
- if candidates:
57
- checked_rows += 1
58
- surface = row.get("input", "")
59
- for name in candidates:
60
- if re.search(r"(?<![A-Za-z0-9_.])" + re.escape(name) + r"(?![A-Za-z0-9_])", surface):
61
- leaks.append((row.get("id"), row.get("family"), name))
62
- break
63
- print(f"file={path}")
64
- print(f"summary: leak_check items={len(rows)} unique_ids={len(set(ids))} checked_rows={checked_rows} leaks={len(leaks)}")
65
- for l in leaks[:10]:
66
- print("LEAK", *l)
67
- return 0 if not leaks else 1
68
-
69
-
70
- if __name__ == "__main__":
71
- raise SystemExit(main())
72
- Add sample answer-leak check
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
verification_kit/random_wrong.py/verification_kit/random_wrong.py DELETED
@@ -1,104 +0,0 @@
1
- #!/usr/bin/env python3
2
- """Random-wrong sanity check: a deliberately wrong deterministic reply should score 0."""
3
- import json
4
- import sys
5
- from pathlib import Path
6
-
7
- ROOT = Path(__file__).resolve().parents[1]
8
- sys.path.insert(0, str(ROOT / "environment" / "src"))
9
- from binary_reasoning_v1.grading import _answer_symbol, grade_item, needs_judge, norm_symbol # noqa: E402
10
-
11
-
12
- def resolve_path():
13
- if len(sys.argv) > 1:
14
- return Path(sys.argv[1])
15
- for p in (ROOT / "sample_free.jsonl", ROOT / "environment/src/binary_reasoning_v1/items.jsonl"):
16
- if p.exists():
17
- return p
18
- raise SystemExit("no sample JSONL found; pass one as argv[1]")
19
-
20
-
21
- def load_rows(path):
22
- rows = []
23
- for line in path.read_text(encoding="utf-8").splitlines():
24
- if line.strip():
25
- rows.append(json.loads(line))
26
- return rows
27
-
28
-
29
- def parse_json_answer(ans):
30
- if isinstance(ans, dict):
31
- return ans
32
- if isinstance(ans, str):
33
- try:
34
- obj = json.loads(ans)
35
- if isinstance(obj, dict):
36
- return obj
37
- except Exception:
38
- pass
39
- return {}
40
-
41
-
42
- def mutate_token(s):
43
- s = str(s)
44
- if not s:
45
- return "RELAB_WRONG"
46
- mid = len(s) // 2
47
- return f"{s[:mid]}_RELAB_WRONG_{s[mid:]}"
48
-
49
-
50
- def wrong_reply(row):
51
- fam = row.get("family", "")
52
- ans = row.get("answer")
53
- if fam == "func_id_mc" and isinstance(ans, dict):
54
- opts = ans.get("options", [])
55
- correct = norm_symbol(ans.get("correct", ""))
56
- for i, opt in enumerate(opts[:4]):
57
- if norm_symbol(opt) != correct:
58
- return "ABCD"[i]
59
- return "RELAB_WRONG"
60
- if fam == "toolchain_fp" and isinstance(ans, dict):
61
- parts = [mutate_token(s) for s in ans.get("toolchain_strings", []) if str(s)]
62
- return "\n".join(parts) if parts else "RELAB_WRONG"
63
- if fam == "library_ident":
64
- ans_str = str(_answer_symbol(ans) or ans or "")
65
- toks = [t for t in ans_str.split() if len(t) >= 2]
66
- return " ".join(mutate_token(t) for t in toks) if toks else "RELAB_WRONG"
67
- if fam == "crossarch_equivalence":
68
- obj = parse_json_answer(ans)
69
- if bool(obj.get("same")):
70
- return "Not the same."
71
- return "Same function: RELAB_WRONG"
72
- sym = _answer_symbol(ans) or ans or ""
73
- if row.get("family") == "agentic_flag_hunt":
74
- return mutate_token(sym)
75
- return f"{sym}_RELAB_WRONG"
76
-
77
-
78
- def main():
79
- path = resolve_path()
80
- rows = load_rows(path)
81
- passed = failed = skipped = 0
82
- fails = []
83
- for row in rows:
84
- fam = row.get("family", "")
85
- ans = row.get("answer")
86
- if needs_judge(fam, ans):
87
- skipped += 1
88
- continue
89
- score = grade_item(fam, wrong_reply(row), ans)
90
- if score == 0.0:
91
- passed += 1
92
- else:
93
- failed += 1
94
- fails.append((row.get("id"), fam, score))
95
- print(f"file={path}")
96
- print(f"summary: random_wrong pass={passed}/{passed + failed} fail={failed} skipped_judge={skipped}")
97
- for f in fails[:10]:
98
- print("FAIL", *f)
99
- return 0 if failed == 0 else 1
100
-
101
-
102
- if __name__ == "__main__":
103
- raise SystemExit(main())
104
- Add deterministic wrong-answer sanity check