thaki-AI commited on
Commit
329b63d
·
verified ·
1 Parent(s): 983cd07

Add files using upload-large-folder tool

Browse files
MANIFEST.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "ChainCheck v2",
3
+ "files": {
4
+ "musique_test.jsonl.gz": {
5
+ "rows": 1716,
6
+ "license": "MuSiQue (Trivedi et al., TACL 2022), CC BY 4.0",
7
+ "sha256": "44858e1641dd6ec846560a5791e01e1bba17f97d9f65052e1de38fa7f2d5b42c"
8
+ },
9
+ "musique_confirmation.jsonl.gz": {
10
+ "rows": 678,
11
+ "license": "MuSiQue (Trivedi et al., TACL 2022), CC BY 4.0",
12
+ "sha256": "7fcdd95036e8a0677f940a19d7580e58f8a85159c00fff5fbdc7845e2127aa8c"
13
+ },
14
+ "twowiki_replication.jsonl.gz": {
15
+ "rows": 1392,
16
+ "license": "2WikiMultiHopQA (Ho et al., COLING 2020), Apache-2.0",
17
+ "sha256": "be4e61202aa0a9fd4ee83dd199910263a56e145c2c3f652234b2ca95b584e284"
18
+ }
19
+ },
20
+ "counts": {
21
+ "musique_test": {
22
+ "fict|invalid": 36,
23
+ "fict|valid": 234,
24
+ "real|invalid": 125,
25
+ "real|valid": 338
26
+ },
27
+ "musique_confirmation": {
28
+ "fict|invalid": 14,
29
+ "fict|valid": 100,
30
+ "real|invalid": 40,
31
+ "real|valid": 126
32
+ },
33
+ "twowiki_replication": {
34
+ "fict|invalid": 15,
35
+ "fict|valid": 149,
36
+ "real|invalid": 170,
37
+ "real|valid": 315
38
+ }
39
+ },
40
+ "cells": {
41
+ "A": "chain alive, no edit",
42
+ "B": "chain alive, edit (consistent bridge swap)",
43
+ "D": "chain broken, edit (bridge substitution in later hop)"
44
+ },
45
+ "metrics": "Nominal=AUC(A>D) · Chain effect=AUC(B>D)-0.5 · Edit effect=AUC(A>B)-0.5 · Sigma=CE-|EE|",
46
+ "note": "Labels follow mechanically from dataset provenance and the Q1-Q9 validator; no human or LLM labels. Passage text originates from Wikipedia."
47
+ }
README.md ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: [cc-by-4.0, apache-2.0]
3
+ language: [en]
4
+ task_categories: [text-classification, question-answering]
5
+ tags: [rag, evidence-sufficiency, multi-hop-qa, counterfactual, benchmark, chaincheck]
6
+ pretty_name: ChainCheck
7
+ ---
8
+
9
+ # ChainCheck
10
+
11
+ Counterfactual controls for evaluating evidence-sufficiency scorers in retrieval-augmented QA. From *ChainCheck: When Near-Perfect Evidence-Sufficiency Scores Fail to Distinguish Chain-Sensitive Systems* (preprint forthcoming).
12
+
13
+ A sufficiency scorer can look near-perfect on an ordinary benchmark by reacting to any edit in the passages. ChainCheck adds a matched control so the two can be told apart:
14
+
15
+ | Cell | Chain | Edit |
16
+ |---|---|---|
17
+ | A | intact | none |
18
+ | B | intact | consistent bridge-entity swap |
19
+ | D | broken (later-hop substitution) | yes |
20
+
21
+ Nominal = AUC(A > D), chain effect = AUC(B > D) − 0.5, edit effect = AUC(A > B) − 0.5, chain selectivity Σ = CE − |EE|. These are matched contrasts, not an additive decomposition.
22
+
23
+ ## Files
24
+
25
+ | File | Rows | Source license |
26
+ |---|---|---|
27
+ | `musique_test.jsonl.gz` | 1716 | MuSiQue (Trivedi et al., TACL 2022), CC BY 4.0 |
28
+ | `musique_confirmation.jsonl.gz` | 678 | MuSiQue (Trivedi et al., TACL 2022), CC BY 4.0 |
29
+ | `twowiki_replication.jsonl.gz` | 1392 | 2WikiMultiHopQA (Ho et al., COLING 2020), Apache-2.0 |
30
+
31
+ Each row is one (question, passage set) item: `item_id`, `pair_id`, `variant` (`real`, or `fict` for a synthetic replacement entity), `cell` (A/B/D), `query`, `passages`, `answer`, `bridge`, `replacement`, `chain`, `edit`, `earlier_support`, `later_support`, `label_sufficient`, `cb_27b_correct` (Qwen3.8-27B answered closed-book; the paper excludes these pairs) and `source`. Only quadruples that pass the Q1 to Q9 validator are included. Labels follow mechanically from source provenance; no human or LLM labels.
32
+
33
+ ## Evaluate your scorer
34
+
35
+ ```bash
36
+ python chaincheck_eval.py --data twowiki_replication.jsonl.gz --scores my_scores.jsonl --exclude-cb27b
37
+ ```
38
+
39
+ `my_scores.jsonl` holds one `{"item_id": ..., "score": float}` per item (higher = more sufficient). The script needs only numpy and reproduces the paper's reference-judge numbers exactly.
40
+
41
+ ## Licenses
42
+
43
+ Derived from MuSiQue (CC BY 4.0) and 2WikiMultiHopQA (Apache-2.0); passage text originates from Wikipedia (CC BY-SA). Each file keeps its source license; cite the original datasets alongside this one.
44
+
45
+ ## Models
46
+
47
+ Judges trained with these controls: [ChainCheck-Judge collection](https://huggingface.co/ThakiCloud).
chaincheck_eval.py ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """ChainCheck evaluator (standalone; needs only numpy).
3
+
4
+ Score every item of a ChainCheck file with your evidence-sufficiency system (higher = "the passages are
5
+ sufficient"), then:
6
+
7
+ python chaincheck_eval.py --data twowiki_replication.jsonl.gz --scores my_scores.jsonl [--exclude-cb27b]
8
+
9
+ my_scores.jsonl: one JSON object per line, {"item_id": ..., "score": float}.
10
+
11
+ Reports, separately for real and synthetic replacement entities:
12
+ Nominal = AUC(A > D) what an ordinary benchmark reports
13
+ CE = AUC(B > D) - 0.5 chain effect: response to breaking the chain, edit held fixed
14
+ EE = AUC(A > B) - 0.5 edit effect: response to an edit that leaves the chain intact
15
+ Sigma = CE - |EE| chain selectivity; chain-selective if the 95% lower bound > 0
16
+ Pair-bootstrap 95% intervals (2,000 resamples, seed 0). These are matched contrasts, not an additive
17
+ decomposition: Nominal is not CE + EE.
18
+ --exclude-cb27b drops pairs whose question Qwen3.8-27B answered closed-book (the paper's closed-book-hard filter).
19
+ """
20
+ import argparse, gzip, json
21
+ from collections import defaultdict
22
+ import numpy as np
23
+
24
+
25
+ def load(path):
26
+ op = gzip.open if path.endswith(".gz") else open
27
+ with op(path, "rt", encoding="utf-8") as f:
28
+ return [json.loads(x) for x in f if x.strip()]
29
+
30
+
31
+ def wins(s, hi, lo):
32
+ return np.array([(s[h] > s[l]) + 0.5 * (s[h] == s[l]) for h, l in zip(hi, lo)], dtype=float)
33
+
34
+
35
+ def metrics(s, quads, n_boot=2000, seed=0):
36
+ A = [q["A"] for q in quads]; B = [q["B"] for q in quads]; D = [q["D"] for q in quads]
37
+ W = {"nominal": wins(s, A, D), "chain": wins(s, B, D), "edit": wins(s, A, B)}
38
+ idx = np.random.default_rng(seed).integers(0, len(quads), size=(n_boot, len(quads)))
39
+ ce_b = W["chain"][idx].mean(1) - 0.5; ee_b = W["edit"][idx].mean(1) - 0.5; sig_b = ce_b - np.abs(ee_b)
40
+ ci = lambda x: [round(float(np.percentile(x, 2.5)), 4), round(float(np.percentile(x, 97.5)), 4)]
41
+ ce, ee = W["chain"].mean() - 0.5, W["edit"].mean() - 0.5
42
+ return {"n_pairs": len(quads), "nominal": round(float(W["nominal"].mean()), 4), "CE": round(float(ce), 4),
43
+ "CE_ci": ci(ce_b), "EE": round(float(ee), 4), "EE_ci": ci(ee_b), "sigma": round(float(ce - abs(ee)), 4),
44
+ "sigma_ci": ci(sig_b), "chain_selective": bool(np.percentile(sig_b, 2.5) > 0)}
45
+
46
+
47
+ def main():
48
+ ap = argparse.ArgumentParser()
49
+ ap.add_argument("--data", required=True); ap.add_argument("--scores", required=True)
50
+ ap.add_argument("--exclude-cb27b", action="store_true")
51
+ a = ap.parse_args()
52
+ rows = load(a.data)
53
+ sc = {x["item_id"]: float(x["score"]) for x in load(a.scores)}
54
+ missing = [r["item_id"] for r in rows if r["item_id"] not in sc]
55
+ if missing:
56
+ raise SystemExit(f"{len(missing)} items have no score, e.g. {missing[:3]}")
57
+ quads = defaultdict(dict)
58
+ for r in rows:
59
+ if a.exclude_cb27b and r["cb_27b_correct"]:
60
+ continue
61
+ quads[(r["pair_id"], r["variant"])][r["cell"]] = r["item_id"]
62
+ out = {}
63
+ for variant in ("real", "fict"):
64
+ qs = [q for (p, v), q in sorted(quads.items()) if v == variant and len(q) == 3]
65
+ if qs:
66
+ out[variant] = metrics(sc, qs)
67
+ print(json.dumps(out, indent=1))
68
+
69
+
70
+ if __name__ == "__main__":
71
+ main()
musique_confirmation.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7fcdd95036e8a0677f940a19d7580e58f8a85159c00fff5fbdc7845e2127aa8c
3
+ size 339194
musique_test.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:44858e1641dd6ec846560a5791e01e1bba17f97d9f65052e1de38fa7f2d5b42c
3
+ size 826824
twowiki_replication.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:be4e61202aa0a9fd4ee83dd199910263a56e145c2c3f652234b2ca95b584e284
3
+ size 507902