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"""
{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)}
{e(cl.get("statement", ""))}
{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'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'