From a7d7bc753948057b523c434fc6983d53e6e715bb Mon Sep 17 00:00:00 2001 From: scrimshawlife-ctrl Date: Fri, 16 Oct 2026 14:11:52 -0700 Subject: [PATCH 1/4] docs(v2): G5 test floor = 250 rows covering all test terms with posts; term-level bootstrap replaces McNemar (per Danny 2026-10-16 approval of recommendation) --- docs/v2/G5_PREREG_EVAL.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/v2/G5_PREREG_EVAL.md b/docs/v2/G5_PREREG_EVAL.md index d95d9b21..4a9865ad 100644 --- a/docs/v2/G5_PREREG_EVAL.md +++ b/docs/v2/G5_PREREG_EVAL.md @@ -3,25 +3,30 @@ Status: DRAFT preregistration. Freeze (hash this file + test manifest) **before** any training run. SHADOW-only. ## Hypotheses -- H1 (T1): LoRA-tuned Nano 8B beats BASE on T1 sense accuracy on the hashed grouped test split. Exact McNemar, two-sided, alpha=0.05. -- H2 (T1): LoRA beats bag-of-terms (logistic regression on term+context unigrams) and the rule baseline (`observation_sense_v1`). Exact McNemar each, Holm correction across the 3 comparisons. +- H1 (T1): LoRA-tuned Nano 8B beats BASE on T1 sense accuracy on the hashed grouped test split. Term-level paired bootstrap (resample test **terms** with replacement, all of a term's rows together; 10k resamples, seed 7); two-sided 95% CI on the accuracy difference, reject H0 if the CI excludes 0 (alpha=0.05). +- H2 (T1): LoRA beats bag-of-terms (logistic regression on term+context unigrams) and the rule baseline (`observation_sense_v1`). Same term-level paired bootstrap each, Holm correction across the 3 comparisons. +- Why term-level, not row-level McNemar: test rows are clustered within ~37 terms (cap 10 gold/term), so rows are not independent; row-level McNemar overstates n. Resampling terms respects the grouping (Søgaard et al., EACL 2021, doi:10.18653/v1/2021.eacl-main.156; lexical memorization, Levy et al., NAACL 2015, doi:10.3115/v1/n15-1098). Row-level McNemar b/c counts stay reported as descriptive only. - H3 (T3): macro-F1 on **unseen families** > 0.0725 (v1 holdout). Reported with bootstrap 95% CI (10k resamples, seed 7). Exploratory unless >= 8 families populated. ## Fixed design -- Test set: human-ruled gold rows with `split == test` from `slang.split.v1` (group split on `term_family`). Minimum 250 rows / 150 terms (G1). Manifest = sorted record_ids, SHA-256 recorded here at freeze. +- Test set: human-ruled gold rows with `split == test` from `slang.split.v1` (group split on `term_family`). Minimum 250 human-ruled rows covering **all test-lineage terms that have posts** (37 on 2026-10-16) (G1). The 150-term floor applies to the train pool / overall gold (G2/G3), not the test split: the hashed 10% test bucket holds only 40 terms (37 with posts), so 150 test terms is unreachable without breaking the group split. Per Danny 2026-10-16 approval of recommendation. Supporting refs: Levy et al. 2015 (doi:10.3115/v1/n15-1098), Søgaard et al. 2021 (doi:10.18653/v1/2021.eacl-main.156), Blevins & Zettlemoyer ACL 2020 (doi:10.18653/v1/2020.acl-main.95, rare-sense evaluation), Bandel et al. 2022 (arXiv:2210.12673, lexical-overlap generalization). Manifest = sorted record_ids, SHA-256 recorded here at freeze. - Inputs: raw context + term only (no oracle slot). Reasoning off. Greedy decoding, max 8 tokens for labels. - One training config (no sweeps): LoRA r=16, alpha=32, dropout 0.05, all linear layers, lr 2e-4 cosine, 3 epochs, seq 512, seed 7. - Exclusions decided in advance: UNSURE and REJECT rulings excluded; rows failing G4 audit excluded from train only (never from test). - No peeking: test labels are loaded only by `scripts/v2/prereg_eval.py --final`, run once; any rerun is reported. ## Reporting -Accuracy, macro-F1, McNemar b/c counts and exact p, per-family table, none-rate (v1 failure mode: 467/470 none). Negative results are published to the tracker as-is. +Accuracy, macro-F1, term-level bootstrap CIs (primary), McNemar b/c counts (descriptive), per-family table, none-rate (v1 failure mode: 467/470 none). Negative results are published to the tracker as-is. ## Compute / cost estimate (ASSUMPTION-labelled) | Step | DGX Spark / Morpheus | Paid alternative | | --- | --- | --- | | LoRA SFT, ~1.5k rows x 3 epochs, 8B BF16 | ~1–2 h on one Spark, $0 marginal | GPU rental ~1x H100 1 h ~ $2–4 (UNVERIFIED) | | Inference: 4 systems x ~470 test rows | <15 min | OpenRouter BASE only (tuned LoRA cannot run there): <$0.10 | -| Bootstrap/McNemar | CPU, seconds | — | +| Term-level bootstrap | CPU, seconds | — | Recommendation: all G5 compute on Spark/Morpheus; paid path only for BASE cross-check, with cost shown first. + + +## Change log +- 2026-10-16: test floor redefined (250 rows covering all test terms with posts; 150 terms moved to train pool/overall gold) and row-level McNemar replaced by term-level bootstrap. Per Danny 2026-10-16 approval of recommendation. Supersedes the 2026-10 draft wording (history kept in git). From f48c1ca80da6019cbd961a9c6b20eb5e32cbed7b Mon Sep 17 00:00:00 2001 From: scrimshawlife-ctrl Date: Fri, 16 Oct 2026 14:41:50 -0700 Subject: [PATCH 2/4] feat(v2): prereg_eval term-level paired bootstrap as primary test; McNemar descriptive (per G5 doc, Danny 2026-10-16) --- scripts/v2/prereg_eval.py | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/scripts/v2/prereg_eval.py b/scripts/v2/prereg_eval.py index 6acd6c79..ba2fbaa5 100644 --- a/scripts/v2/prereg_eval.py +++ b/scripts/v2/prereg_eval.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 -"""G5 preregistered eval (draft): exact McNemar + bootstrap macro-F1. Inputs are private prediction +"""G5 preregistered eval (draft): term-level paired bootstrap (primary, per G5_PREREG_EVAL.md 2026-10-16) + +exact McNemar (descriptive) + bootstrap macro-F1. Inputs are private prediction JSONL files keyed by record_id ({"record_id","pred"}) plus a gold JSONL ({"record_id","gold","family"}).""" import argparse, json, random from math import comb @@ -32,6 +33,25 @@ def holm(pvals): return out +def term_bootstrap(ids, gold, tuned, base, n=10000, seed=7, key="family"): + """Resample test terms (clusters) with replacement; all rows of a term move together. + Returns accuracy diff (tuned - base), 95% CI, two-sided bootstrap p, number of clusters.""" + clusters = {} + for i in ids: + clusters.setdefault(gold[i].get(key) or i, []).append(i) + names = sorted(clusters) + stats = {c: (sum(tuned[i]["pred"] == gold[i]["gold"] for i in clusters[c]), + sum(base[i]["pred"] == gold[i]["gold"] for i in clusters[c]), len(clusters[c])) for c in names} + def diff(sample): + t = sum(stats[c][0] for c in sample); b = sum(stats[c][1] for c in sample); m = sum(stats[c][2] for c in sample) + return (t - b) / m if m else 0.0 + obs = diff(names); rng = random.Random(seed) + boots = sorted(diff([rng.choice(names) for _ in names]) for _ in range(n)) + lo, hi = boots[int(0.025 * n)], boots[int(0.975 * n) - 1] + p = min(1.0, 2 * min(sum(d <= 0 for d in boots), sum(d >= 0 for d in boots)) / n) + return {"acc_diff": obs, "ci95": [lo, hi], "p_boot": p, "n_terms": len(names)} + + def load(p): return {r["record_id"]: r for r in (json.loads(l) for l in open(p) if l.strip())} @@ -52,8 +72,9 @@ def main(): name, path = spec.split("=", 1); base = load(path) b = sum(1 for i in ids if tuned[i]["pred"] == gold[i]["gold"] and base[i]["pred"] != gold[i]["gold"]) c = sum(1 for i in ids if tuned[i]["pred"] != gold[i]["gold"] and base[i]["pred"] == gold[i]["gold"]) - rep[name] = {"b": b, "c": c, "p_exact": mcnemar_exact(b, c)} - adj = holm({k: v["p_exact"] for k, v in rep.items() if isinstance(v, dict)}) + rep[name] = {"term_bootstrap": term_bootstrap(ids, gold, tuned, base), + "mcnemar_descriptive": {"b": b, "c": c, "p_exact": mcnemar_exact(b, c)}} + adj = holm({k: v["term_bootstrap"]["p_boot"] for k, v in rep.items() if isinstance(v, dict)}) for k, p in adj.items(): rep[k]["p_holm"] = p; rep[k]["significant_0.05"] = p < 0.05 pairs = [(gold[i]["gold"], tuned[i]["pred"]) for i in ids] From 80af2c4c7ae5221ad8e84277bab6a83b20ee6d27 Mon Sep 17 00:00:00 2001 From: scrimshawlife-ctrl Date: Fri, 16 Oct 2026 15:57:40 -0700 Subject: [PATCH 3/4] docs(v2): freeze G5 test manifest a03c8619 (273 ids) per Danny go 2026-10-16 --- docs/v2/G5_PREREG_EVAL.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/v2/G5_PREREG_EVAL.md b/docs/v2/G5_PREREG_EVAL.md index 4a9865ad..a5e8ea2a 100644 --- a/docs/v2/G5_PREREG_EVAL.md +++ b/docs/v2/G5_PREREG_EVAL.md @@ -30,3 +30,10 @@ Recommendation: all G5 compute on Spark/Morpheus; paid path only for BASE cross- ## Change log - 2026-10-16: test floor redefined (250 rows covering all test terms with posts; 150 terms moved to train pool/overall gold) and row-level McNemar replaced by term-level bootstrap. Per Danny 2026-10-16 approval of recommendation. Supersedes the 2026-10 draft wording (history kept in git). + +## Freeze record (2026-10-16, per Danny go 3:55 PM PT) + +- Test manifest: 273 record_ids (sorted), SHA-256 `a03c8619ba91a0f3d3edb43a358adbb5a6fcc83fe462442b6cb66e94be8296b6`. Verified unchanged after the 2026-10-16 attestation load. +- Preregistration text above (this file before this section): SHA-256 `1954a35a5bba8586489c07bf5300f28da26a20e9160e6ed693926c13613e2cbe`. +- gold_test.jsonl SHA-256 prefix `06caba1397df`. 15 quarantined gold rows (suspect synthetic source id) are excluded from test and stay quarantined. +- Tag: `v2-test-freeze-2026-10-16`. Read-only copy kept in the private tracker. Any change to the manifest after this point voids the freeze. From a24757a9e9e46b539b83c61a07335a2292593083 Mon Sep 17 00:00:00 2001 From: scrimshawlife-ctrl Date: Fri, 16 Oct 2026 16:19:12 -0700 Subject: [PATCH 4/4] docs(v2): freeze addendum, manifest unchanged; family metadata update per Danny 2026-10-16 --- docs/v2/G5_PREREG_EVAL.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/v2/G5_PREREG_EVAL.md b/docs/v2/G5_PREREG_EVAL.md index a5e8ea2a..d620c7f4 100644 --- a/docs/v2/G5_PREREG_EVAL.md +++ b/docs/v2/G5_PREREG_EVAL.md @@ -37,3 +37,8 @@ Recommendation: all G5 compute on Spark/Morpheus; paid path only for BASE cross- - Preregistration text above (this file before this section): SHA-256 `1954a35a5bba8586489c07bf5300f28da26a20e9160e6ed693926c13613e2cbe`. - gold_test.jsonl SHA-256 prefix `06caba1397df`. 15 quarantined gold rows (suspect synthetic source id) are excluded from test and stay quarantined. - Tag: `v2-test-freeze-2026-10-16`. Read-only copy kept in the private tracker. Any change to the manifest after this point voids the freeze. + +### Freeze addendum (2026-10-16 4:20 PM PT, Danny 4:03 PM PT family ruling) +- Manifest unchanged: a03c8619… (273 ids). Gold labels unchanged. +- gold_test.jsonl family metadata updated on 17 rows (three family calls), new SHA-256 prefix `818ba1288dea`. Family-level (H3) analysis uses the updated families. One private family is excluded from H3 unseen-family claims, and the family gate is reported as 16. +- Six test-split rulings made after the freeze are held outside gold_test, for a future test version only.