From 1463295c799babc8d3a985553f3e76d16dc2c453 Mon Sep 17 00:00:00 2001 From: OpenReplicant <122761100+OpenReplicant@users.noreply.github.com> Date: Fri, 27 Nov 2026 10:36:18 -0800 Subject: [PATCH] Claim site: show every assessment for the system, not the first A claim can be assessed on several configurations of one system (E-04a's readout claim: LFM3 1.7B did not transfer, Inkling 2 Mini replicated), and the site showed only the first. Now: - the feed and claim header show one badge when the assessments agree, and a Mixed badge followed by each configuration's status and model when they disagree; the filter matches a claim on any of its statuses, and the counts follow the filter; - each assessment on the claim page is headed by its configuration (the models among its `against` resources); - the predictions page and the calibration score count each assessment with a prediction on its own; - issue bodies give the breakdown (`status: did-not-transfer (LFM3 1.7B); replicated (Inkling 2 Mini)`), and p_transfer only when there is one prediction. Tests: a two-assessment claim (mixed status, feed match under either status, both assessments on the page, two scored predictions); they fail if only the first assessment is read. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01KhsqyyPmp7iKCkTFcXs6sh --- site/build.py | 156 ++++++++++++++++++++++++++++-------------- site/static/app.js | 5 +- site/static/style.css | 4 ++ tests/test_site.py | 70 ++++++++++++++++++- 4 files changed, 180 insertions(+), 55 deletions(-) diff --git a/site/build.py b/site/build.py index b8926d6..389e204 100644 --- a/site/build.py +++ b/site/build.py @@ -31,6 +31,7 @@ STATUSES = ["untested", "predicted", "replicated", "did-not-transfer", "not-testable"] OBSERVATION = "observation" # a claim of this system's own (source.kind trial or probe): it has no status +MIXED = "mixed" # a claim whose assessments for the system disagree (one configuration replicated, another did not) STATUS_TEXT = { "untested": "Untested", "predicted": "Predicted", @@ -38,6 +39,7 @@ "did-not-transfer": "Did not transfer", "not-testable": "Not testable", OBSERVATION: "Our observation", + MIXED: "Mixed", } STATUS_HELP = { "untested": "Catalogued, with the reason it has not been tried here.", @@ -46,6 +48,7 @@ "did-not-transfer": "Tried on this system's setup, and the finding did not hold.", "not-testable": "Cannot be tried here, and why.", OBSERVATION: "A measurement this system ran itself, which a paper's outcome links to.", + MIXED: "Tried on more than one configuration, with different results.", } QUOTE_SHORT = {"checked": "quote checked", "unchecked": "quote unchecked", "none": "no quote"} QUOTE_TEXT = { @@ -125,17 +128,27 @@ def source(self) -> dict: def ours(self) -> bool: return self.source.get("kind") in ("trial", "probe") - def assessment(self, system: str) -> dict | None: - for a in self.spec.get("assessments") or []: - if a.get("system") == system: - return a - return None + def assessments(self, system: str) -> list[dict]: + """Every assessment for the system: one per configuration tried (a model, an engine), and they can disagree.""" + return [a for a in self.spec.get("assessments") or [] if a.get("system") == system] - def status(self, system: str) -> str: + def predictions(self, system: str) -> list[dict]: + return [a["prediction"] for a in self.assessments(system) if a.get("prediction")] + + def statuses(self, system: str) -> list[str]: + """The distinct statuses of its assessments, in file order; a filter matches a claim on any of them.""" if self.ours: - return OBSERVATION - a = self.assessment(system) - return a["status"] if a else "untested" + return [OBSERVATION] + out = [] + for a in self.assessments(system): + if a["status"] not in out: + out.append(a["status"]) + return out or ["untested"] + + def status(self, system: str) -> str: + """One status, or `mixed` when its assessments disagree (statuses() and the badges give the breakdown).""" + statuses = self.statuses(system) + return statuses[0] if len(statuses) == 1 else MIXED def date(self) -> str: dates = [] @@ -311,6 +324,38 @@ def queue_rank(self, name: str) -> tuple[int, dict] | None: return i, item return None + def config_label(self, a: dict) -> str: + """The configuration an assessment was made on, in a few words: the models among its `against` resources + (their description up to the first comma, as in "Inkling 2 Mini"), else every resource's name.""" + names = [] + for ref in a.get("against") or []: + res = self.catalog.get(ref) + if res and (res.get("spec") or {}).get("type") == "model": + head = (res["metadata"].get("description") or "").split(",")[0].strip() + names.append(head if head and len(head) <= 40 else res["metadata"]["name"]) + if not names: + names = [ref_name(r) for r in a.get("against") or []] + return ", ".join(names) + + def status_badges(self, c: Claim) -> str: + """One badge when the assessments agree; when they disagree, a Mixed badge and one per configuration.""" + assessments = c.assessments(self.system) + if c.ours or len(c.statuses(self.system)) == 1: + return status_badge(c.status(self.system)) + parts = [status_badge(MIXED)] + for a in assessments: + label = self.config_label(a) + parts.append(f'{status_badge(a["status"])}' + f'{f" {e(label)}" if label else ""}') + return "".join(parts) + + def status_text(self, c: Claim) -> str: + """The same breakdown in words, for an issue body: `replicated (Inkling 2 Mini); did-not-transfer (LFM3 1.7B)`.""" + if c.ours or len(c.statuses(self.system)) == 1: + return c.status(self.system) + return "; ".join(f"{a['status']} ({self.config_label(a) or 'unnamed configuration'})" + for a in c.assessments(self.system)) + def by_name(self) -> dict[str, Claim]: return {c.name: c for c in self.claims} @@ -369,11 +414,9 @@ def page(site: Site, title: str, body: str, current: str, depth: int = 0, descri def feed_item(site: Site, c: Claim) -> str: - status = c.status(site.system) - a = c.assessment(site.system) or {} + statuses = c.statuses(site.system) src, cl = c.source, c.spec["claim"] role, option = ref_name(c.spec.get("role")), ref_name(c.spec.get("about")) - p = (a.get("prediction") or {}).get("p_transfer") search = " ".join(str(x) for x in [c.name, c.doc["metadata"].get("description", ""), cl.get("statement", ""), src.get("title", ""), src.get("id", ""), role, option, cl.get("metric", "")]) quote_cls = "q-" + src.get("quote_status", "none") @@ -381,10 +424,10 @@ def feed_item(site: Site, c: Claim) -> str: f'option {e(option)}'] if c.date(): meta.append(f'') - right = meter(p) if p is not None else "" - return f"""
  • + right = "".join(meter(pr["p_transfer"]) for pr in c.predictions(site.system)) + return f"""
  • @@ -394,8 +437,9 @@ def feed_item(site: Site, c: Claim) -> str: def render_index(site: Site) -> str: claims = sort_claims(site.claims) counts = {s: 0 for s in STATUSES + [OBSERVATION]} - for c in claims: - counts[c.status(site.system)] = counts.get(c.status(site.system), 0) + 1 + for c in claims: # a claim counts under each status any of its assessments has, as the filter matches it + for st in c.statuses(site.system): + counts[st] = counts.get(st, 0) + 1 roles = sorted({ref_name(c.spec.get("role")) for c in claims}) sources = {} for c in claims: @@ -453,17 +497,16 @@ def issue_body(action: str, site: Site, c: Claim | None, extra: list[str] | None lines += ["", "---", f"research-action: {action}", f"system: {site.system}"] if c is not None: lines += [f"research-claim: {c.name}", f"claim-file: {site.file_url(c.path)}", - f"status: {c.status(site.system)}"] - p = ((c.assessment(site.system) or {}).get("prediction") or {}).get("p_transfer") - if p is not None: - lines.append(f"p_transfer: {p}") + f"status: {site.status_text(c)}"] + preds = c.predictions(site.system) + if len(preds) == 1: + lines.append(f"p_transfer: {preds[0]['p_transfer']}") return "\n".join(lines).strip() + "\n" def claim_actions(site: Site, c: Claim) -> str: if c.ours: return "" - a = c.assessment(site.system) or {} btns = [ ("prioritise", f"Prioritise: {c.name}", "Test this claim next", ["Please test this claim sooner.", "", "Why it is worth a trial now:", ""]), @@ -471,7 +514,7 @@ def claim_actions(site: Site, c: Claim) -> str: ["Please drop this claim from the queue.", "", "Why (does not apply here, already known, not a real gain):", ""]), ] - if a.get("prediction"): + if c.predictions(site.system): btns.append(("dispute", f"Dispute prediction: {c.name}", "Dispute the prediction", ["I think the transfer prediction is wrong.", "", "My probability that it holds here:", "", "Which conditions it gets wrong:", ""])) @@ -548,7 +591,10 @@ def claim_ref(site: Site, name: str, depth: int) -> str: def assessment_html(site: Site, c: Claim, a: dict) -> str: - parts = [f'

    {status_badge(a["status"])} for {e(a.get("system"))}' + label = site.config_label(a) + parts = [f'

    {status_badge(a["status"])}' + + (f' on {e(label)}' if label else "") + + f' for {e(a.get("system"))}' + (f' on {e(a["date"])}' if a.get("date") else "") + "

    "] if a.get("against"): parts.append('

    Compared with: ' + ", ".join( @@ -625,7 +671,7 @@ def render_claim(site: Site, c: Claim) -> str:

    Claims {e(c.name)}

    -
    {status_badge(status)}{e(ref_name(c.spec.get("role")))} · option {e(ref_name(c.spec.get("about")))}
    +
    {site.status_badges(c)}{e(ref_name(c.spec.get("role")))} · option {e(ref_name(c.spec.get("about")))}

    {e(md.get("description") or c.name)}

    {e(cl.get("statement", ""))}

    @@ -715,7 +761,8 @@ def render_roles(site: Site) -> str: cs = claims_by_option.get(oname, []) counts = {} for c in cs: - counts[c.status(site.system)] = counts.get(c.status(site.system), 0) + 1 + for st in c.statuses(site.system): + counts[st] = counts.get(st, 0) + 1 badges = " ".join(f"{status_badge(s)}×{n}" for s, n in counts.items()) result = (((o.get("spec") or {}).get("morphogen") or {}).get("evaluation") or {}).get("result") links = "".join(f'
  • {e(truncate(c.doc["metadata"].get("description", c.name), 120))}
  • ' for c in cs) @@ -761,24 +808,25 @@ def render_roles(site: Site) -> str: # ---------------------------------------------------------------- predictions and calibration -def calibration_pairs(site: Site) -> list[tuple[float, int, Claim]]: - """(p, held, claim) for each prediction written before an outcome that now has one.""" +def calibration_pairs(site: Site) -> list[tuple[float, int, Claim, dict]]: + """(p, held, claim, assessment) for each assessment whose prediction was written before an outcome it now has. + Each assessment counts on its own: a claim tried on two configurations is two predictions.""" out = [] for c in site.claims: - a = c.assessment(site.system) or {} - pr, status = a.get("prediction") or {}, a.get("status") - if pr.get("before_outcome") and a.get("outcome") and status in ("replicated", "did-not-transfer"): - out.append((float(pr["p_transfer"]), 1 if status == "replicated" else 0, c)) + for a in c.assessments(site.system): + pr, status = a.get("prediction") or {}, a.get("status") + if pr.get("before_outcome") and a.get("outcome") and status in ("replicated", "did-not-transfer"): + out.append((float(pr["p_transfer"]), 1 if status == "replicated" else 0, c, a)) return out def brier(pairs) -> float | None: - return sum((p - o) ** 2 for p, o, _ in pairs) / len(pairs) if pairs else None + return sum((p - o) ** 2 for p, o, *_ in pairs) / len(pairs) if pairs else None def calibration_svg(pairs, waiting: list[float]) -> str: """A reliability diagram: predicted probability against the share that held, in five bins, with the diagonal - of perfect calibration; predictions still waiting, one per claim.are ticks under the axis. Attributes only (no inline style), + of perfect calibration; predictions still waiting are small dots under the axis. Attributes only (no inline style), so the page's content security policy holds.""" w, h, m = 360, 300, 44 pw, ph = w - m - 16, h - m - 30 @@ -798,14 +846,14 @@ def y(v): bins = [] for i in range(5): lo, hi = i / 5, (i + 1) / 5 - inside = [(p, o) for p, o, _ in pairs if lo <= p < hi or (i == 4 and p == 1.0)] + inside = [(p, o) for p, o, *_ in pairs if lo <= p < hi or (i == 4 and p == 1.0)] if inside: mp = sum(p for p, _ in inside) / len(inside) rate = sum(o for _, o in inside) / len(inside) bins.append((mp, rate, len(inside))) dots = "".join( f'' - f'Predicted {mp:.2f} on average, {r:.2f} held ({n} claim{"s" if n != 1 else ""})' + f'Predicted {mp:.2f} on average, {r:.2f} held ({n} prediction{"s" if n != 1 else ""})' for mp, r, n in bins) stacked, seen = [], {} for p in sorted(waiting): @@ -826,13 +874,17 @@ def y(v): def render_predictions(site: Site) -> str: pairs = calibration_pairs(site) - waiting, unscored = [], [] + waiting, unscored = [], [] # (claim, assessment): one row per assessment for c in sort_claims(site.claims): - a = c.assessment(site.system) or {} - if a.get("status") == "predicted" and a.get("prediction"): - waiting.append(c) - elif a.get("status") in ("replicated", "did-not-transfer") and not (a.get("prediction") or {}).get("before_outcome"): - unscored.append(c) + for a in c.assessments(site.system): + if a.get("status") == "predicted" and a.get("prediction"): + waiting.append((c, a)) + elif a.get("status") in ("replicated", "did-not-transfer") and not (a.get("prediction") or {}).get("before_outcome"): + unscored.append((c, a)) + + def cfg(a): + label = site.config_label(a) + return f' on {e(label)}' if label else "" b = brier(pairs) if pairs: summary = (f"

    {len(pairs)} predictions written before their outcome now have one. " @@ -840,16 +892,17 @@ def render_predictions(site: Site) -> str: else: summary = ("

    No prediction has an outcome yet, so there is nothing to score. The chart fills in as trials " "report: each dot is a group of predictions, placed at their average probability and at the share " - "that held. The small dots under the axis are predictions still waiting, one per claim.

    ") + "that held. The small dots under the axis are predictions still waiting. A claim tried on two configurations " + "counts twice.

    ") rows = "".join( - f'{e(truncate(c.doc["metadata"].get("description", c.name), 90))}' - f'{meter(p)}{status_badge(c.status(site.system))}' for p, _, c in pairs) + f'{e(truncate(c.doc["metadata"].get("description", c.name), 90))}' + f'{cfg(a)}{meter(p)}{status_badge(a["status"])}' for p, _, c, a in pairs) wait_rows = "".join( - f'{e(truncate(c.doc["metadata"].get("description", c.name), 90))}' - f'{meter(c.assessment(site.system)["prediction"]["p_transfer"])}' - for c in sorted(waiting, key=lambda c: -c.assessment(site.system)["prediction"]["p_transfer"])) - unscored_items = "".join(f"
  • {status_badge(c.status(site.system))} {e(truncate(c.doc['metadata'].get('description', c.name), 110))}
  • " for c in unscored) - svg = calibration_svg(pairs, [c.assessment(site.system)["prediction"]["p_transfer"] for c in waiting]) + f'{e(truncate(c.doc["metadata"].get("description", c.name), 90))}{cfg(a)}' + f'{meter(a["prediction"]["p_transfer"])}' + for c, a in sorted(waiting, key=lambda ca: -ca[1]["prediction"]["p_transfer"])) + unscored_items = "".join(f"
  • {status_badge(a['status'])} {e(truncate(c.doc['metadata'].get('description', c.name), 110))}{cfg(a)}
  • " for c, a in unscored) + svg = calibration_svg(pairs, [a["prediction"]["p_transfer"] for _, a in waiting]) body = f"""

    Scoring the agent

    @@ -1061,7 +1114,8 @@ def build(config_path: Path, out: Path, root: Path = ROOT) -> Site: write("how.html", render_how(site)) for c in claims: write(f"claims/{c.name}.html", render_claim(site, c)) - data = [{"name": c.name, "path": c.path, "status": c.status(site.system), "date": c.date(), + data = [{"name": c.name, "path": c.path, "status": c.status(site.system), "statuses": c.statuses(site.system), + "date": c.date(), "record": _jsonable(c.doc)} for c in sort_claims(claims)] write("data/claims.json", json.dumps({"system": site.system, "claims": data}, indent=1, ensure_ascii=False)) write(".nojekyll", "") diff --git a/site/static/app.js b/site/static/app.js index 91ade71..24456e3 100644 --- a/site/static/app.js +++ b/site/static/app.js @@ -1,4 +1,5 @@ -// The feed's filters: search, role, source and status, all in the page (no requests). The filters are kept in the +// The feed's filters: search, role, source and status, all in the page (no requests). A claim tried on several +// configurations carries each of its statuses in data-status, and matches if any of them is checked. The filters are kept in the // address (?q=&role=&source=&status=) so a filtered view can be shared. Without JavaScript every claim is listed. (function () { var form = document.getElementById("filters"); @@ -27,7 +28,7 @@ items.forEach(function (li) { var d = li.dataset; var ok = (!role || d.role === role) && (!source || d.source === source) && - statuses.indexOf(d.status) !== -1 && + d.status.split(" ").some(function (st) { return statuses.indexOf(st) !== -1; }) && words.every(function (w) { return d.search.indexOf(w) !== -1; }); li.hidden = !ok; if (ok) shown++; diff --git a/site/static/style.css b/site/static/style.css index 35d9012..e6a6291 100644 --- a/site/static/style.css +++ b/site/static/style.css @@ -284,3 +284,7 @@ details ul { margin-top: 8px; font-size: 0.88rem; } .small-btn { padding: 5px 10px; font-size: 0.82rem; } .terms { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; } @media (max-width: 520px) { .qitem { grid-template-columns: 1fr; } .qrank { padding-top: 0; } } + +/* A claim whose configurations disagree: a Mixed badge, then one badge per configuration with its name. */ +.s-mixed { color: var(--warn); background: var(--warn-bg); } +.cfg { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; } diff --git a/tests/test_site.py b/tests/test_site.py index e61d0d1..7e4e29f 100644 --- a/tests/test_site.py +++ b/tests/test_site.py @@ -107,7 +107,10 @@ def test_every_claim_has_a_page_and_a_feed_entry(self): def test_statuses_come_from_the_assessments(self): status = {c.name: c.status(self.site.system) for c in self.site.claims} - self.assertEqual(status["gates-likelihood-readout-27-31b-matches-jev"], "did-not-transfer") + # E-04a: LFM3 1.7B did not transfer, Inkling 2 Mini replicated; both must show + gates = self.site.by_name()["gates-likelihood-readout-27-31b-matches-jev"] + self.assertEqual(status[gates.name], "mixed") + self.assertEqual(set(gates.statuses(self.site.system)), {"did-not-transfer", "replicated"}) self.assertEqual(status["gates-embedding-logreg-labelled"], "predicted") self.assertEqual(status["e04a-lfm3-pooled-accuracy"], "observation") roles = (self.out / "roles.html").read_text(encoding="utf-8") @@ -247,6 +250,69 @@ def test_actions_the_agent_reads(self): self.assertEqual(actions, {"prioritise", "reject", "dispute", "question", "propose-role", "propose-option"}) +class SeveralAssessments(unittest.TestCase): + """A claim tried on two configurations of one system, with different results: every assessment shows, the feed + matches it under either status, and each prediction is scored on its own (the site once showed only the first).""" + + def setUp(self): + self.tmp = tempfile.TemporaryDirectory() + root = Path(self.tmp.name) + claim = copy.deepcopy(CLAIM) + claim["metadata"]["name"] = "two-setups" + claim["spec"]["source"]["url"] = "https://arxiv.org/abs/2611.00001" + outcome = {"trial": {"id": "T-1"}, "observed": ["hostile-claim"], "comparison": "our-setup", + "verdict": {"by": "falsifier", "decision": "met"}} + pred = {"by": "test", "date": "2026-11-27", "before_outcome": True, "reason": "r"} + claim["spec"]["assessments"] = [ + {"system": "system:default/sys", "against": ["resource:default/small-model"], "status": "did-not-transfer", + "date": "2026-11-25", "prediction": {**pred, "p_transfer": 0.3}, + "outcome": {**outcome, "summary": "Small model: far below."}}, + {"system": "system:default/sys", "against": ["resource:default/big-model"], "status": "replicated", + "date": "2026-11-27", "prediction": {**pred, "p_transfer": 0.7}, + "outcome": {**outcome, "summary": "Big model: matched."}}, + ] + cfg = make_project(root, [CLAIM, claim]) + with (root / "catalog.yaml").open("a", encoding="utf-8") as f: + f.write("---\n" + yaml.safe_dump_all([ + {"apiVersion": "backstage.io/v1alpha1", "kind": "Resource", + "metadata": {"name": "small-model", "description": "Small Model 1B, Q6_K, on the GPU"}, + "spec": {"type": "model"}}, + {"apiVersion": "backstage.io/v1alpha1", "kind": "Resource", + "metadata": {"name": "big-model", "description": "Big Model 26B, Q4_K"}, "spec": {"type": "model"}}])) + self.out = root / "out" + self.site = build.build(cfg, self.out, root=root) + self.claim = self.site.by_name()["two-setups"] + + def tearDown(self): + self.tmp.cleanup() + + def test_status_is_mixed_with_both_results(self): + self.assertEqual(self.claim.status("system:default/sys"), "mixed") + self.assertEqual(self.claim.statuses("system:default/sys"), ["did-not-transfer", "replicated"]) + self.assertEqual(self.site.status_text(self.claim), + "did-not-transfer (Small Model 1B); replicated (Big Model 26B)") + + def test_feed_matches_either_status(self): + index = (self.out / "index.html").read_text(encoding="utf-8") + item = re.search(r'
  • ]*>.*?
  • ', index, re.S).group(0) + self.assertIn('data-status="did-not-transfer replicated"', item) + for text in ("Mixed", "Did not transfer", "Replicated", "Small Model 1B", "Big Model 26B"): + self.assertIn(text, item) + + def test_claim_page_shows_every_assessment(self): + page = (self.out / "claims" / "two-setups.html").read_text(encoding="utf-8") + self.assertEqual(page.count('
    '), 2) + for text in ("Small model: far below.", "Big model: matched.", "on Small Model 1B", + "on Big Model 26B"): + self.assertIn(text, page) + + def test_each_prediction_is_scored(self): + pairs = sorted((p, o) for p, o, c, _ in build.calibration_pairs(self.site) if c.name == "two-setups") + self.assertEqual(pairs, [(0.3, 0), (0.7, 1)]) + page = (self.out / "predictions.html").read_text(encoding="utf-8") + self.assertIn("2 predictions", page) + + class Calibration(unittest.TestCase): def test_scored_prediction_shows_on_the_chart(self): with tempfile.TemporaryDirectory() as tmp: @@ -260,7 +326,7 @@ def test_scored_prediction_shows_on_the_chart(self): "comparison": "our-setup", "verdict": {"by": "morphogen", "decision": "refuse"}} cfg = make_project(root, [CLAIM, scored]) site = build.build(cfg, root / "out", root=root) - self.assertEqual([(p, o) for p, o, _ in build.calibration_pairs(site)], [(0.4, 0)]) + self.assertEqual([(p, o) for p, o, *_ in build.calibration_pairs(site)], [(0.4, 0)]) self.assertAlmostEqual(build.brier(build.calibration_pairs(site)), 0.16) page = (root / "out" / "predictions.html").read_text(encoding="utf-8") self.assertIn("Brier score 0.160", page)