From 8abe0e90aa6d540bde5acfb5e8bfc57c60ce0cc1 Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Mon, 16 Nov 2026 14:37:59 +0800 Subject: [PATCH 01/13] feat(srb01): add exact systemic-risk finite-world EvalMath scorer --- src/spiral_ln/evaluation_systemic_risk.py | 282 ++++++++++++++++++++++ 1 file changed, 282 insertions(+) create mode 100644 src/spiral_ln/evaluation_systemic_risk.py diff --git a/src/spiral_ln/evaluation_systemic_risk.py b/src/spiral_ln/evaluation_systemic_risk.py new file mode 100644 index 00000000..851b0bcb --- /dev/null +++ b/src/spiral_ln/evaluation_systemic_risk.py @@ -0,0 +1,282 @@ +"""SRB-01: exact finite-world systemic-loss and feedback-selection scorer. + +Each world is one stipulated coupled-system scenario, with complete counterfactual +node-loss vectors for each named intervention. Masses encode a declared finite +law, not independent empirical replications. Observations define information +fibres; query responses model optional *pre-selection* feedback disclosure. +""" +from __future__ import annotations + +from dataclasses import dataclass +from fractions import Fraction +from pathlib import Path +import json +from itertools import groupby + +from .evaluation_selection_risk import ( + NullModel, adaptive_optimum, fixed_optimum, full_information_risk, + no_feedback_risk, +) + +SCHEMA = "SRB-EvalMath-01" + + +def rational(value: str | int) -> Fraction: + """Reject floating point numbers and booleans to preserve exact provenance.""" + if type(value) not in (str, int): + raise ValueError("exact integer or rational string required") + try: + result = Fraction(value) + except (TypeError, ValueError, ZeroDivisionError) as exc: + raise ValueError("invalid exact rational") from exc + if result < 0: + raise ValueError("nonnegative rational required") + return result + + +@dataclass(frozen=True) +class World: + name: str + weight: int + visible: tuple[int, ...] + queries: tuple[int, ...] + node_losses: tuple[tuple[Fraction, ...], ...] # action x node + claims_safe: tuple[bool, ...] + selected: int | None + + +@dataclass(frozen=True) +class Bank: + nodes: tuple[str, ...] + actions: tuple[str, ...] + costs: tuple[Fraction, ...] + baseline: int + query_names: tuple[str, ...] + harm_threshold: Fraction + tail_alpha: Fraction + worlds: tuple[World, ...] + + +def _names(values) -> tuple[str, ...]: + if (not isinstance(values, list) or not values or + any(not isinstance(x, str) or not x for x in values) or + len(set(values)) != len(values)): + raise ValueError("unique nonempty names required") + return tuple(values) + + +def _ints(values, *, length: int | None = None) -> tuple[int, ...]: + if (not isinstance(values, list) or (length is not None and len(values) != length) + or any(type(x) is not int or x < 0 for x in values)): + raise ValueError("nonnegative categorical integer vector required") + return tuple(values) + + +def parse_bank(data: dict) -> Bank: + if not isinstance(data, dict) or data.get("schema") != SCHEMA: + raise ValueError(f"expected schema {SCHEMA}") + nodes = _names(data.get("nodes")) + specs = data.get("actions") + if not isinstance(specs, list) or not specs or any(not isinstance(x, dict) for x in specs): + raise ValueError("nonempty action specifications required") + actions = _names([x.get("name") for x in specs]) + costs = tuple(rational(x.get("cost")) for x in specs) + baseline = data.get("baseline") + if baseline not in actions: + raise ValueError("baseline must name an action") + raw_queries = data.get("query_names", []) + query_names = _names(raw_queries) if raw_queries else () + if not isinstance(raw_queries, list): + raise ValueError("query_names must be a list") + harm_threshold = rational(data.get("harm_threshold")) + tail_alpha = rational(data.get("tail_alpha")) + if tail_alpha >= 1: + raise ValueError("tail_alpha must be in [0,1)") + rows = data.get("worlds") + if not isinstance(rows, list) or not rows: + raise ValueError("nonempty world bank required") + worlds = [] + ids = set() + visibility_length = None + for x in rows: + if not isinstance(x, dict) or not isinstance(x.get("id"), str) or not x["id"] or x["id"] in ids: + raise ValueError("unique world id required") + ids.add(x["id"]) + weight = x.get("mass") + if type(weight) is not int or weight <= 0: + raise ValueError("positive integer scenario mass required") + visible = _ints(x.get("visible")) + if visibility_length is None: + visibility_length = len(visible) + if len(visible) != visibility_length: + raise ValueError("visible signature dimensions must match") + queries = _ints(x.get("queries", []), length=len(query_names)) + outcomes = x.get("outcomes") + if not isinstance(outcomes, dict) or set(outcomes) != set(actions): + raise ValueError("every action must have a counterfactual outcome") + loss_vectors, claims = [], [] + for action in actions: + outcome = outcomes[action] + if not isinstance(outcome, dict): + raise ValueError("invalid outcome") + entries = outcome.get("node_loss") + if not isinstance(entries, list) or len(entries) != len(nodes): + raise ValueError("node_loss vector must cover all nodes") + loss_vectors.append(tuple(rational(v) for v in entries)) + claim = outcome.get("claimed_safe") + if type(claim) is not bool: + raise ValueError("claimed_safe requires a Boolean grader report") + claims.append(claim) + selected = x.get("selected") + if selected is not None and selected not in actions: + raise ValueError("selected action must be registered") + worlds.append(World(x["id"], weight, visible, queries, + tuple(loss_vectors), tuple(claims), + actions.index(selected) if selected is not None else None)) + if any(w.selected is None for w in worlds) and any(w.selected is not None for w in worlds): + raise ValueError("selected policy must be recorded for every world or none") + return Bank(nodes, actions, costs, actions.index(baseline), query_names, + harm_threshold, tail_alpha, tuple(worlds)) + + +def load_bank(path: str | Path) -> Bank: + return parse_bank(json.loads(Path(path).read_text(encoding="utf-8"))) + + +def harm(world: World, action: int) -> Fraction: + return sum(world.node_losses[action], Fraction(0)) + + +def total_loss(bank: Bank, world: World, action: int) -> Fraction: + return harm(world, action) + bank.costs[action] + + +def expected_loss(bank: Bank, choices: tuple[int, ...]) -> Fraction: + if len(choices) != len(bank.worlds) or any(type(a) is not int or not 0 <= a < len(bank.actions) for a in choices): + raise ValueError("one registered action per world required") + total = sum(w.weight for w in bank.worlds) + return sum((w.weight * total_loss(bank, w, a) + for w, a in zip(bank.worlds, choices)), Fraction(0)) / total + + +def optimal_observable(bank: Bank, extra_query: int | None = None) -> tuple[int, ...]: + """Minimum exact expected loss of policies constant on each visible fibre.""" + if extra_query is not None and (type(extra_query) is not int or not 0 <= extra_query < len(bank.query_names)): + raise ValueError("unknown disclosure query") + fibres: dict[tuple[int, ...], list[int]] = {} + for i, w in enumerate(bank.worlds): + key = w.visible + ((w.queries[extra_query],) if extra_query is not None else ()) + fibres.setdefault(key, []).append(i) + choices = [0] * len(bank.worlds) + for ids in fibres.values(): + best = min(range(len(bank.actions)), + key=lambda a: sum((bank.worlds[i].weight * total_loss(bank, bank.worlds[i], a) + for i in ids), Fraction(0))) + for i in ids: + choices[i] = best + return tuple(choices) + + +def weighted_cvar(values: tuple[tuple[Fraction, int], ...], alpha: Fraction) -> Fraction: + """Upper-tail CVaR for a discrete weighted loss law with exact mass slicing.""" + if (not values or not 0 <= alpha < 1 or + any(type(w) is not int or w < 1 or not isinstance(v, Fraction) or v < 0 + for v, w in values)): + raise ValueError("nonempty nonnegative exact losses, positive masses, alpha in [0,1)") + total = sum(w for _, w in values) + remaining = (1 - alpha) * total + tail_sum = Fraction(0) + for loss, weight in sorted(values, reverse=True): + taken = min(remaining, weight) + tail_sum += taken * loss + remaining -= taken + if remaining == 0: + break + return tail_sum / ((1 - alpha) * total) + + +def _tail(bank: Bank, choices: tuple[int, ...]) -> Fraction: + return weighted_cvar(tuple((harm(w, a), w.weight) + for w, a in zip(bank.worlds, choices)), bank.tail_alpha) + + +def binary_collision_floor(bank: Bank) -> Fraction: + """For exactly two actions, the visible-oracle gap as opposing advantage masses.""" + if len(bank.actions) != 2: + raise ValueError("binary certificate requires exactly two actions") + fibres: dict[tuple[int, ...], list[World]] = {} + for w in bank.worlds: + fibres.setdefault(w.visible, []).append(w) + gap = Fraction(0) + for worlds in fibres.values(): + positive = sum((w.weight * max(total_loss(bank, w, 0) - total_loss(bank, w, 1), 0) + for w in worlds), Fraction(0)) + negative = sum((w.weight * max(total_loss(bank, w, 1) - total_loss(bank, w, 0), 0) + for w in worlds), Fraction(0)) + gap += min(positive, negative) + return gap / sum(w.weight for w in bank.worlds) + + +def _selection(bank: Bank) -> dict: + model = NullModel( + weights=tuple(w.weight for w in bank.worlds), + events=tuple(tuple(w.claims_safe[a] and harm(w, a) >= bank.harm_threshold + for w in bank.worlds) for a in range(len(bank.actions))), + queries=tuple(tuple(w.queries[q] for w in bank.worlds) + for q in range(len(bank.query_names))) or (tuple(0 for _ in bank.worlds),), + ) + return { + "no_disclosure": no_feedback_risk(model), + "one_query_optimum": fixed_optimum(model, 1)["risk"], + "two_adaptive_queries": adaptive_optimum(model, 2)["risk"], + "full_disclosure": full_information_risk(model), + } + + +def score(bank: Bank) -> dict: + n = len(bank.worlds) + actions = range(len(bank.actions)) + no_info_action = min(actions, + key=lambda a: expected_loss(bank, (a,) * n)) + no_info = (no_info_action,) * n + visible = optimal_observable(bank) + oracle = tuple(min(actions, key=lambda a: total_loss(bank, w, a)) + for w in bank.worlds) + result = { + "scenario_count": n, + "total_mass": sum(w.weight for w in bank.worlds), + "fixed_action": bank.actions[no_info_action], + "fixed_loss": expected_loss(bank, no_info), + "observable_loss": expected_loss(bank, visible), + "oracle_loss": expected_loss(bank, oracle), + "visibility_value": expected_loss(bank, no_info) - expected_loss(bank, visible), + "unobservable_regret": expected_loss(bank, visible) - expected_loss(bank, oracle), + "baseline_loss": expected_loss(bank, (bank.baseline,) * n), + "baseline_harm_cvar": _tail(bank, (bank.baseline,) * n), + "observable_harm_cvar": _tail(bank, visible), + "query_disclosure_loss": {q: expected_loss(bank, optimal_observable(bank, i)) + for i, q in enumerate(bank.query_names)}, + "false_authorization_selection": _selection(bank), + "binary_collision_certificate": binary_collision_floor(bank) if len(bank.actions) == 2 else None, + } + if bank.worlds[0].selected is not None: + chosen = tuple(w.selected for w in bank.worlds) + result["trace_replay_loss"] = expected_loss(bank, chosen) + result["trace_replay_harm_cvar"] = _tail(bank, chosen) + result["trace_replay_false_authorization"] = Fraction( + sum(w.weight for w, a in zip(bank.worlds, chosen) + if w.claims_safe[a] and harm(w, a) >= bank.harm_threshold), + result["total_mass"], + ) + return result + + +def json_exact(value): + """Stable exact serialization, no rounded floats or implicit conversions.""" + if isinstance(value, Fraction): + return str(value) + if isinstance(value, dict): + return {k: json_exact(v) for k, v in value.items()} + if isinstance(value, tuple): + return [json_exact(v) for v in value] + return value From 3dff8039c42055d441a54d7fb116f6240be97bb8 Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Mon, 16 Nov 2026 14:38:16 +0800 Subject: [PATCH 02/13] test(srb01): register symmetric-shock synthetic case bank --- .../synthetic_two_worlds.json | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 fixtures/systemic_risk_evalmath/synthetic_two_worlds.json diff --git a/fixtures/systemic_risk_evalmath/synthetic_two_worlds.json b/fixtures/systemic_risk_evalmath/synthetic_two_worlds.json new file mode 100644 index 00000000..8c12660d --- /dev/null +++ b/fixtures/systemic_risk_evalmath/synthetic_two_worlds.json @@ -0,0 +1,19 @@ +{ + "schema": "SRB-EvalMath-01", + "nodes": ["sector_a", "sector_b"], + "actions": [{"name": "cut_a", "cost": "0"}, {"name": "cut_b", "cost": "0"}], + "baseline": "cut_a", + "query_names": ["reveal_shock"], + "harm_threshold": "5", + "tail_alpha": "1/2", + "worlds": [ + {"id": "shock_a", "mass": 1, "visible": [0], "queries": [0], "selected": "cut_a", + "outcomes": { + "cut_a": {"node_loss": ["0", "0"], "claimed_safe": true}, + "cut_b": {"node_loss": ["0", "8"], "claimed_safe": true}}}, + {"id": "shock_b", "mass": 1, "visible": [0], "queries": [1], "selected": "cut_a", + "outcomes": { + "cut_a": {"node_loss": ["8", "0"], "claimed_safe": true}, + "cut_b": {"node_loss": ["0", "0"], "claimed_safe": true}}} + ] +} From 0563d376d402779e15b062990cc1d0f714292f96 Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Mon, 16 Nov 2026 14:38:18 +0800 Subject: [PATCH 03/13] feat(srb01): add source-hashed benchmark export scorer --- scripts/score_systemic_risk.py | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 scripts/score_systemic_risk.py diff --git a/scripts/score_systemic_risk.py b/scripts/score_systemic_risk.py new file mode 100644 index 00000000..2b8d2fea --- /dev/null +++ b/scripts/score_systemic_risk.py @@ -0,0 +1,36 @@ +"""Score an exported SystemicRiskBench finite-world case bank with exact EvalMath metrics. + +Usage: PYTHONPATH=src python scripts/score_systemic_risk.py --input case_bank.json +""" +from __future__ import annotations + +import argparse +from hashlib import sha256 +import json +from pathlib import Path + +from spiral_ln.evaluation_systemic_risk import json_exact, load_bank, score + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--input", type=Path, required=True) + parser.add_argument("--output", type=Path) + args = parser.parse_args() + raw = args.input.read_bytes() + result = { + "schema": "SRB-01-scored-v1", + "source_sha256": sha256(raw).hexdigest(), + "evidence": "exact evaluation conditional on supplied counterfactual finite-world bank", + "metrics": json_exact(score(load_bank(args.input))), + } + encoded = json.dumps(result, indent=2, sort_keys=True) + "\n" + if args.output: + args.output.parent.mkdir(parents=True, exist_ok=True) + args.output.write_text(encoded, encoding="utf-8") + else: + print(encoded, end="") + + +if __name__ == "__main__": + main() From 349489943321b863b955635c8109b88d79a8799e Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Mon, 16 Nov 2026 14:38:58 +0800 Subject: [PATCH 04/13] test(srb01): independent policy oracle and failure-mode tests --- tests/test_evaluation_systemic_risk.py | 128 +++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 tests/test_evaluation_systemic_risk.py diff --git a/tests/test_evaluation_systemic_risk.py b/tests/test_evaluation_systemic_risk.py new file mode 100644 index 00000000..7d4f03c7 --- /dev/null +++ b/tests/test_evaluation_systemic_risk.py @@ -0,0 +1,128 @@ +"""SRB-01 exact scenario, information-fibre, tail, and feedback audits.""" +from copy import deepcopy +from fractions import Fraction +from itertools import product +import json +from pathlib import Path +import random +import unittest + +from spiral_ln.evaluation_systemic_risk import ( + SCHEMA, binary_collision_floor, expected_loss, json_exact, load_bank, + optimal_observable, parse_bank, rational, score, total_loss, weighted_cvar, +) + +FIXTURE = (Path(__file__).resolve().parents[1] / + "fixtures/systemic_risk_evalmath/synthetic_two_worlds.json") + + +class SystemicRiskTests(unittest.TestCase): + def test_hidden_cross_sector_shock_witness(self): + bank = load_bank(FIXTURE) + r = score(bank) + self.assertEqual(r["fixed_loss"], Fraction(4)) + self.assertEqual(r["observable_loss"], Fraction(4)) + self.assertEqual(r["oracle_loss"], Fraction(0)) + self.assertEqual(r["unobservable_regret"], Fraction(4)) + self.assertEqual(r["binary_collision_certificate"], Fraction(4)) + self.assertEqual(r["query_disclosure_loss"], {"reveal_shock": Fraction(0)}) + self.assertEqual(r["baseline_harm_cvar"], Fraction(8)) + self.assertEqual(r["trace_replay_loss"], Fraction(4)) + self.assertEqual(r["trace_replay_false_authorization"], Fraction(1, 2)) + self.assertEqual(r["false_authorization_selection"], { + "no_disclosure": Fraction(1, 2), + "one_query_optimum": Fraction(1), + "two_adaptive_queries": Fraction(1), + "full_disclosure": Fraction(1), + }) + self.assertEqual(json_exact({"regret": Fraction(4, 3)}), {"regret": "4/3"}) + + def test_finite_two_action_collision_certificate_independent(self): + rng = random.Random(20261116) + for _ in range(96): + bank = random_bank(rng, n=rng.randrange(1, 7), actions=2) + r = score(bank) + self.assertEqual(r["unobservable_regret"], binary_collision_floor(bank)) + self.assertGreaterEqual(r["fixed_loss"], r["observable_loss"]) + self.assertGreaterEqual(r["observable_loss"], r["oracle_loss"]) + + def test_exhaustive_policy_oracle_three_actions(self): + rng = random.Random(4411) + for _ in range(64): + bank = random_bank(rng, n=rng.randrange(1, 6), actions=3) + classes = sorted(set(w.visible for w in bank.worlds)) + brute = min( + expected_loss(bank, tuple(plan[classes.index(w.visible)] for w in bank.worlds)) + for plan in product(range(3), repeat=len(classes)) + ) + self.assertEqual(expected_loss(bank, optimal_observable(bank)), brute) + self.assertIsNone(score(bank)["binary_collision_certificate"]) + for q in range(len(bank.query_names)): + self.assertLessEqual(expected_loss(bank, optimal_observable(bank, q)), brute) + + def test_exact_cvar_and_alpha_boundaries(self): + vals = ((Fraction(0), 3), (Fraction(8), 1)) + self.assertEqual(weighted_cvar(vals, Fraction(0)), Fraction(2)) + self.assertEqual(weighted_cvar(vals, Fraction(1, 2)), Fraction(4)) + self.assertEqual(weighted_cvar(vals, Fraction(3, 4)), Fraction(8)) + self.assertEqual(weighted_cvar(((Fraction(5), 1),), Fraction(99, 100)), Fraction(5)) + for alpha in (Fraction(-1), Fraction(1)): + with self.assertRaises(ValueError): + weighted_cvar(vals, alpha) + + def test_malformed_schemas_rejected(self): + original = json.loads(FIXTURE.read_text()) + mutants = [] + for key, value in (("schema", "old"), ("tail_alpha", "1"), + ("harm_threshold", 5.0), ("baseline", "unknown"), + ("nodes", ["x", "x"]), ("query_names", ["x", "x"])): + d = deepcopy(original); d[key] = value; mutants.append(d) + for key, value in (("mass", 0), ("visible", [0, 1]), + ("queries", []), ("selected", "bad")): + d = deepcopy(original); d["worlds"][0][key] = value; mutants.append(d) + d = deepcopy(original); d["worlds"][0]["outcomes"]["cut_a"]["node_loss"][0] = -1; mutants.append(d) + d = deepcopy(original); d["worlds"][0]["outcomes"]["cut_a"]["claimed_safe"] = 1; mutants.append(d) + d = deepcopy(original); del d["worlds"][1]["selected"]; mutants.append(d) + d = deepcopy(original); d["worlds"][0]["outcomes"].pop("cut_b"); mutants.append(d) + for d in mutants: + with self.subTest(d=d), self.assertRaises(ValueError): + parse_bank(d) + for value in (True, 1.2, None, "-1", "invalid"): + with self.assertRaises(ValueError): + rational(value) + + def test_single_world_one_action_and_missing_selected(self): + data = json.loads(FIXTURE.read_text()) + data["actions"] = [data["actions"][0]] + data["worlds"] = [data["worlds"][0]] + data["worlds"][0]["outcomes"].pop("cut_b") + del data["worlds"][0]["selected"] + bank = parse_bank(data) + r = score(bank) + self.assertEqual(r["unobservable_regret"], 0) + self.assertEqual(r["baseline_harm_cvar"], 0) + self.assertNotIn("trace_replay_loss", r) + self.assertIsNone(r["binary_collision_certificate"]) + self.assertEqual(r["false_authorization_selection"]["no_disclosure"], 0) + + +def random_bank(rng: random.Random, n: int, actions: int): + names = [f"a{i}" for i in range(actions)] + data = { + "schema": SCHEMA, "nodes": ["n0", "n1"], + "actions": [{"name": a, "cost": str(rng.randrange(3))} for a in names], + "baseline": names[0], "query_names": ["q0"], + "harm_threshold": "6", "tail_alpha": "1/2", "worlds": [], + } + for i in range(n): + data["worlds"].append({ + "id": f"w{i}", "mass": rng.randrange(1, 5), + "visible": [rng.randrange(2)], "queries": [rng.randrange(2)], + "outcomes": {a: {"node_loss": [str(rng.randrange(7)), str(rng.randrange(7))], + "claimed_safe": rng.choice([True, False])} for a in names}, + }) + return parse_bank(data) + + +if __name__ == "__main__": + unittest.main() From 01b4ed3768a40bc7c938423a004d94c51f17b8e8 Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Mon, 16 Nov 2026 14:39:23 +0800 Subject: [PATCH 05/13] test(srb01): source-bound verifier with independent finite oracles --- scripts/verify_evaluation_systemic_risk.py | 104 +++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 scripts/verify_evaluation_systemic_risk.py diff --git a/scripts/verify_evaluation_systemic_risk.py b/scripts/verify_evaluation_systemic_risk.py new file mode 100644 index 00000000..fd616c3e --- /dev/null +++ b/scripts/verify_evaluation_systemic_risk.py @@ -0,0 +1,104 @@ +"""Regenerate source-bound SRB-01 exact finite scenario receipt.""" +from __future__ import annotations + +import argparse +from fractions import Fraction +from hashlib import sha256 +from itertools import product +import json +from pathlib import Path +import random + +from spiral_ln.evaluation_systemic_risk import ( + expected_loss, load_bank, optimal_observable, score, weighted_cvar, json_exact, +) + +ROOT = Path(__file__).resolve().parents[1] +FIXTURE = "fixtures/systemic_risk_evalmath/synthetic_two_worlds.json" +SOURCES = ( + "src/spiral_ln/evaluation_systemic_risk.py", + "tests/test_evaluation_systemic_risk.py", + "scripts/verify_evaluation_systemic_risk.py", + "paper/systemic_risk_evalmath.md", + FIXTURE, +) + + +def run() -> dict: + bank = load_bank(ROOT / FIXTURE) + s = score(bank) + rng = random.Random(20261116) + exhaustive = 0 + for _ in range(96): + # Independent tiny-world oracle: enumerate complete policies by visible cell. + n = rng.randrange(1, 7) + raw = json.loads((ROOT / FIXTURE).read_text()) + raw["query_names"] = ["q"] + raw["worlds"] = [] + for i in range(n): + raw["worlds"].append({ + "id": f"w{i}", "mass": rng.randrange(1, 5), + "visible": [rng.randrange(3)], "queries": [rng.randrange(3)], + "outcomes": { + a: {"node_loss": [str(rng.randrange(9)), str(rng.randrange(9))], + "claimed_safe": rng.choice((True, False))} + for a in ("cut_a", "cut_b")}, + }) + from spiral_ln.evaluation_systemic_risk import parse_bank + b = parse_bank(raw) + cells = sorted({w.visible for w in b.worlds}) + brute = min(expected_loss(b, tuple(plan[cells.index(w.visible)] for w in b.worlds)) + for plan in product((0, 1), repeat=len(cells))) + measured = score(b) + assert brute == measured["observable_loss"] + assert measured["unobservable_regret"] == measured["binary_collision_certificate"] + assert expected_loss(b, optimal_observable(b, 0)) <= brute + # Independently enumerate the one-query adversarial event-selector policies. + events = [[w.claims_safe[a] and sum(w.node_losses[a]) >= b.harm_threshold + for w in b.worlds] for a in (0, 1)] + masses = [w.weight for w in b.worlds] + prior = max(sum(m for m, hit in zip(masses, ev) if hit) for ev in events) + split = sorted({w.queries[0] for w in b.worlds}) + after = sum(max(sum(w.weight for w, hit in zip(b.worlds, ev) + if w.queries[0] == answer and hit) for ev in events) + for answer in split) + assert measured["false_authorization_selection"]["no_disclosure"] == Fraction(prior, sum(masses)) + assert measured["false_authorization_selection"]["one_query_optimum"] == Fraction(after, sum(masses)) + exhaustive += 1 + + checks = { + "hidden_fibre_regret": s["unobservable_regret"] == 4, + "binary_collision_exact": s["binary_collision_certificate"] == 4, + "query_resolves_collision": s["query_disclosure_loss"]["reveal_shock"] == 0, + "tail_harm_exposed": s["baseline_harm_cvar"] == 8, + "public_vs_postselection_risk": ( + s["false_authorization_selection"]["no_disclosure"] == Fraction(1, 2) + and s["false_authorization_selection"]["one_query_optimum"] == 1), + "independent_random_exact_oracles": exhaustive == 96, + "cvar_boundary_alpha_zero": weighted_cvar(((Fraction(0), 3), (Fraction(8), 1)), Fraction(0)) == 2, + "cvar_boundary_alpha_three_quarters": weighted_cvar(((Fraction(0), 3), (Fraction(8), 1)), Fraction(3, 4)) == 8, + } + assert all(checks.values()) + return { + "schema": "SRB-01-receipt-v1", + "evidence": "finite exact synthetic model and independent enumeration; no SystemicRiskBench replay or real agents", + "independent_random_oracles": exhaustive, + "synthetic_witness": json_exact(s), + "checks": checks, + "source_sha256": {p: sha256((ROOT / p).read_bytes()).hexdigest() for p in SOURCES}, + } + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--output", type=Path, + default=ROOT / "output/evaluation_systemic_risk/srb01.json") + args = parser.parse_args() + result = run() + args.output.parent.mkdir(parents=True, exist_ok=True) + args.output.write_text(json.dumps(result, indent=2, sort_keys=True) + "\n") + print(f"SRB-01: {result['independent_random_oracles']} independently checked cases; {len(result['checks'])} checks passed") + + +if __name__ == "__main__": + main() From 4d26583fd95feec3d55bac1a1a3c621764952976 Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Mon, 16 Nov 2026 14:40:18 +0800 Subject: [PATCH 06/13] docs(srb01): prove information-fibre risk floor and audit feedback selection --- paper/systemic_risk_evalmath.md | 188 ++++++++++++++++++++++++++++++++ 1 file changed, 188 insertions(+) create mode 100644 paper/systemic_risk_evalmath.md diff --git a/paper/systemic_risk_evalmath.md b/paper/systemic_risk_evalmath.md new file mode 100644 index 00000000..d554a773 --- /dev/null +++ b/paper/systemic_risk_evalmath.md @@ -0,0 +1,188 @@ +# SRB-01: EvalMath interface for finite systemic-risk benchmarks + +**Status: synthetic exact benchmark bridge, 16 November 2026.** This is an +EvalMath scoring contract and an independently checked finite example. The +`SystemicRiskBench` project itself was not available to inspect when the bridge +was built. No live SystemicRiskBench cases, model runs, independent physical +counterfactual interventions, or Lean proofs are claimed. The input schema is a +proposed export format, not a statement about SystemicRiskBench's existing API. + +Module: `src/spiral_ln/evaluation_systemic_risk.py`. Fixture: +`fixtures/systemic_risk_evalmath/synthetic_two_worlds.json`. Tests: +`tests/test_evaluation_systemic_risk.py`. Receipt verifier: +`scripts/verify_evaluation_systemic_risk.py`. Source-hashed receipt: +`output/evaluation_systemic_risk/srb01.json`. + +## 1. EvalMath crosswalk + +Given the evaluation-design tuple +\(\mathcal E=\langle G,\Pi,D,Z,J,\mathcal A,C\rangle\) in +[`evaluation_design_calculus.md`](evaluation_design_calculus.md), a single +SystemicRiskBench scenario bank fixes a finite set of coupled-system worlds +\(\Omega\) and positive integer scenario masses \(m_\omega\). + +- **Game and actions:** intervention set \(A\) with registered implementation + costs \(c_a\), one cost vector for every action across the same world bank. +- **Distribution:** \(D\) is the stipulated finite law + \(P(\omega)=m_\omega/W\), \(W=\sum m_\omega\). Multiple correlated node + failures inside one world remain *one evaluation unit*, not independent trials. +- **Observation:** \(Z(\omega)\) is the categorical information available to + a controller **before choosing** its intervention. The full counterfactual + vector is privileged evaluator data. Each optional query \(q_j(\omega)\) + models further information disclosed before choosing. +- **Judgment:** \(L(\omega,a)=c_a+\sum_i \ell_i(\omega,a)\), where each + \(\ell_i\ge0\) is the supplied post-intervention loss at a named node. + The harm-only tail distribution excludes implementation costs. +- **Claim:** the scorer bounds and measures decision quality *under this + registered world bank and counterfactual contract*; external validity requires + a separate data provenance and acquisition argument. + +The `claimed_safe` field represents a grader's Boolean report for an action in +a world. A false authorization event occurs when `claimed_safe` is true and +\(\sum_i\ell_i(\omega,a)\ge h\), for a preregistered catastrophe threshold +\(h\). This is a *counterfactual* definition. The export must provide genuine +losses for every permitted action or explicitly restrict the action set. + +## 2. Exact observability obstruction + +For observation cells \(F_z=\{\omega:Z(\omega)=z\}\), consider the best +policy with access only to \(Z\): + +\[ +R_Z=\frac1W\sum_z\min_{a\in A}\sum_{\omega\in F_z} + m_\omega L(\omega,a). +\] + +The fixed-action baseline and clairvoyant floor are + +\[ +R_0=\min_a\frac1W\sum_\omega m_\omega L(\omega,a),\quad +R_*=\frac1W\sum_\omega m_\omega\min_a L(\omega,a). +\] + +**Proposition SRB-P1 (exact, elementary).** \(R_*\le R_Z\le R_0\). +Under a refinement of \(Z\) by disclosed information, \(R_Z\) cannot rise. +For each cell, taking one action across the cell costs at least the sum of +independent per-world minima; choosing separately within finer cells can only +improve the optimum. This proves both statements. The difference +\(R_Z-R_*\) is the *information-fibre obstruction* for this action family, +loss function, and stated world masses. It measures an irreducible loss floor +for policies restricted to the declared public observation. It does not +measure a particular trained policy's competence. + +**Proposition SRB-P2 (two-action collision certificate).** With actions +\(a,b\), set \(d_\omega=L(\omega,a)-L(\omega,b)\) and, within each cell, set + +\[ + P_z=\sum_{\omega\in F_z}m_\omega\max(d_\omega,0),\qquad + N_z=\sum_{\omega\in F_z}m_\omega\max(-d_\omega,0). +\] + +Then + +\[ +\boxed{R_Z-R_*=W^{-1}\sum_z\min(P_z,N_z).} +\] + +*Proof.* Write \(L(\omega,a)=\min(L_a,L_b)+\max(d_\omega,0)\) +and \(L(\omega,b)=\min(L_a,L_b)+\max(-d_\omega,0)\). The first term +sums to the clairvoyant optimum in each cell. The best common action adds +the smaller of the two advantage masses. Sum over cells. \(\square\) + +This is an algebraic identity adapted to a systemic intervention vector. It +supplies a **testable lower floor** for any controller that only sees \(Z\), +including a high-dimensional or looped model, regardless of training budget. +The scorer provides its exact value only when the registered action set has +two elements. For larger action sets the general finite minimization applies. + +## 3. Evaluator leakage and adaptive false authorization + +EvalMath's [`selection_risk_continuations.md`](selection_risk_continuations.md) +computes how feedback can raise post-selection false-authorization risk. Define +\(E_a=\{\omega: \text{claimed\_safe}(\omega,a)\land +\sum_i\ell_i(\omega,a)\ge h\}\). For a query transcript \(T\) disclosed +before a controller selects an action, the adversarial selection ceiling is + +\[ +P_{\rm FA}(T)=W^{-1}\sum_t\max_a\sum_{\omega:T(\omega)=t} + m_\omega\mathbf1_{E_a}(\omega). +\] + +The bridge calls EvalMath's `NullModel`, `fixed_optimum`, and +`adaptive_optimum` for this event family. The outputs separate no disclosure, +one fixed query, up to two adaptive queries, and full event information. +A grader-validity claim must justify the full information filtration, including +private state, tooling, score previews, and early stopping. + +A scored trace's *realized* false-authorization rate uses the recorded +`selected` actions. It is a different estimand from the adversarial ceiling. + +## 4. Synthetic counterexample and tail harm + +The committed fixture has two equally weighted worlds, two sectors, and two +interventions `cut_a` and `cut_b`. Both share the identical controller-visible +signature. In the first world `cut_a` prevents loss and `cut_b` leaves eight +units of damage at sector B; the second world reverses these outcomes. The +agent's recorded action is always `cut_a`, and both options carry a +`claimed_safe=true` report in both worlds. + +| Exact measure | Value | +|---|---:| +| Best fixed / public-only expected total loss | 4 | +| Clairvoyant expected loss | 0 | +| Two-action observational obstruction | 4 | +| Public observation + the shock query expected loss | 0 | +| Baseline harm CVaR at \(\alpha=1/2\) | 8 | +| Worst-case false authorization with no score disclosure | 1/2 | +| Worst-case false authorization after the shock query | 1 | +| Recorded-action false authorization rate | 1/2 | + +The same extra signal that resolves the action ambiguity also permits a +malicious selector to choose a falsely authorized outcome in either world. +That is a property of the **synthetic stipulated event law**. It makes clear +why decision-quality gains and disclosure-induced selection risk have to be +measured as separate axes. + +CVaR here is the weighted average of the worst \(1-\alpha\) fraction of the +harm distribution, slicing an atom's weight exactly at the threshold. At +\(\alpha=0\), it is mean harm. Ties and single-world cases are covered. + +## 5. Export contract and prospective benchmark protocol + +Export a JSON object matching +[`synthetic_two_worlds.json`](../fixtures/systemic_risk_evalmath/synthetic_two_worlds.json). +`nodes` lists sectors, agents, institutions, or affected subsystems. `actions` +registers names and exact nonnegative costs. `baseline` names the incumbent +intervention. Every world contains a unique `id`, positive integer `mass`, +a common-length categorical `visible` signature, categorical `queries`, and +one complete `node_loss` vector plus Boolean `claimed_safe` per action. +Optional `selected` is the actual controller action in that world and must +appear for every world when used. Rationals are strings such as `"3/7"`. +Float input is rejected to preserve exact arithmetic. + +```bash +PYTHONPATH=src python scripts/score_systemic_risk.py \ + --input fixtures/systemic_risk_evalmath/synthetic_two_worlds.json +PYTHONPATH=src python -m pytest -q tests/test_evaluation_systemic_risk.py +PYTHONPATH=src python scripts/verify_evaluation_systemic_risk.py +python scripts/check_receipts.py --only systemic_risk +``` + +Before obtaining any outcome data, lock the action vocabulary, source commit, +world mass interpretation, node-loss units, catastrophic threshold, tail level, +query disclosure permissions, evaluator version, scoring cost, training/dev/test +split and independent environment seed. Preserve an equal-budget task-only +controller and a trivial no-information fixed-action control. For neural +readouts, add rank-matched random and norm-matched intervention controls. + +The score should be computed separately for each independent scenario family +and environment seed. Paired per-seed differences, a precommitted threshold, +confidence intervals over independent blocks, and complete raw outcome rows +belong in a prospective empirical report. A finite bank with convenient masses +only certifies exact arithmetic conditional on those masses. Repeated worlds +under one network shock are not independent evidence of real-world frequency. + +**Evidence levels:** SRB-P1 and SRB-P2 are algebraic identities. The fixture +and seeded exhaustive checks are finite verified examples. The shock scenario +is synthetic mechanism evidence. There is no real SystemicRiskBench run or +Lean theorem at this stage. From 6e7d331c2093daf69457cccb2802029bb83b937f Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Mon, 16 Nov 2026 14:41:06 +0800 Subject: [PATCH 07/13] test(srb01): commit exact synthetic source-hashed receipt --- output/evaluation_systemic_risk/srb01.json | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 output/evaluation_systemic_risk/srb01.json diff --git a/output/evaluation_systemic_risk/srb01.json b/output/evaluation_systemic_risk/srb01.json new file mode 100644 index 00000000..7e322852 --- /dev/null +++ b/output/evaluation_systemic_risk/srb01.json @@ -0,0 +1,48 @@ +{ + "checks": { + "binary_collision_exact": true, + "cvar_boundary_alpha_three_quarters": true, + "cvar_boundary_alpha_zero": true, + "hidden_fibre_regret": true, + "independent_random_exact_oracles": true, + "public_vs_postselection_risk": true, + "query_resolves_collision": true, + "tail_harm_exposed": true + }, + "evidence": "finite exact synthetic model and independent enumeration; no SystemicRiskBench replay or real agents", + "independent_random_oracles": 96, + "schema": "SRB-01-receipt-v1", + "source_sha256": { + "fixtures/systemic_risk_evalmath/synthetic_two_worlds.json": "52e5be8d4422429b606ec25d727abc2aa579bdbacec276ddfc67c23c95585e7a", + "paper/systemic_risk_evalmath.md": "871f0c98597be6ceca3138e4d2f0cc8873857673c46d6bacd73080699d915498", + "scripts/verify_evaluation_systemic_risk.py": "80eda496475bf750a4ba0b6c5a9d8e847850ad706b211f7d79322a4995cbb571", + "src/spiral_ln/evaluation_systemic_risk.py": "978659da7104d5b71b4f9d12025df31fca0b67478bd8e1042cd9d292cf5ec9bf", + "tests/test_evaluation_systemic_risk.py": "31d91ad32778acd1f34dd82df5a8f8c65198150265a8bf665d0a167888b3f9e5" + }, + "synthetic_witness": { + "baseline_harm_cvar": "8", + "baseline_loss": "4", + "binary_collision_certificate": "4", + "false_authorization_selection": { + "full_disclosure": "1", + "no_disclosure": "1/2", + "one_query_optimum": "1", + "two_adaptive_queries": "1" + }, + "fixed_action": "cut_a", + "fixed_loss": "4", + "observable_harm_cvar": "8", + "observable_loss": "4", + "oracle_loss": "0", + "query_disclosure_loss": { + "reveal_shock": "0" + }, + "scenario_count": 2, + "total_mass": 2, + "trace_replay_false_authorization": "1/2", + "trace_replay_harm_cvar": "8", + "trace_replay_loss": "4", + "unobservable_regret": "4", + "visibility_value": "0" + } +} From cf99869792e718e78c5ac1928aa5f17285b6f6e0 Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Mon, 16 Nov 2026 14:41:09 +0800 Subject: [PATCH 08/13] ci(srb01): add scorer receipt to fast verification --- scripts/check_receipts.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/check_receipts.py b/scripts/check_receipts.py index de2eb02d..45248d5e 100644 --- a/scripts/check_receipts.py +++ b/scripts/check_receipts.py @@ -25,6 +25,8 @@ # name: (verifier, committed receipt, extra arguments, slow) RECEIPTS = { + "systemic_risk": ("scripts/verify_evaluation_systemic_risk.py", + "output/evaluation_systemic_risk/srb01.json", [], False), "bpd": ("scripts/verify_evaluation_bpd.py", "output/evaluation_bpd/bpd_01.json", [], False), "irc02": ("scripts/verify_interface_relative_compactification.py", From 1c3e07ece43cd617b05171d404c53cc8c906dc8c Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Mon, 16 Nov 2026 14:43:30 +0800 Subject: [PATCH 09/13] ci(srb01): isolate fast exact bridge replay from full EvalMath suite --- .github/workflows/srb01.yml | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/srb01.yml diff --git a/.github/workflows/srb01.yml b/.github/workflows/srb01.yml new file mode 100644 index 00000000..c0845fbd --- /dev/null +++ b/.github/workflows/srb01.yml @@ -0,0 +1,46 @@ +name: srb01-exact-bridge + +on: + push: + paths: + - "src/spiral_ln/evaluation_systemic_risk.py" + - "tests/test_evaluation_systemic_risk.py" + - "scripts/verify_evaluation_systemic_risk.py" + - "scripts/score_systemic_risk.py" + - "paper/systemic_risk_evalmath.md" + - "fixtures/systemic_risk_evalmath/**" + - "output/evaluation_systemic_risk/**" + - "scripts/check_receipts.py" + - ".github/workflows/srb01.yml" + pull_request: + paths: + - "src/spiral_ln/evaluation_systemic_risk.py" + - "tests/test_evaluation_systemic_risk.py" + - "scripts/verify_evaluation_systemic_risk.py" + - "scripts/score_systemic_risk.py" + - "paper/systemic_risk_evalmath.md" + - "fixtures/systemic_risk_evalmath/**" + - "output/evaluation_systemic_risk/**" + - "scripts/check_receipts.py" + - ".github/workflows/srb01.yml" + workflow_dispatch: + +jobs: + exact-synthetic-replay: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + - name: Install EvalMath + run: python -m pip install -e ".[test]" + - name: Exact unit tests + run: python -m pytest -q tests/test_evaluation_systemic_risk.py + - name: Regenerate source-hashed synthetic receipt + run: python scripts/check_receipts.py --only systemic_risk + - name: Score fixture through public CLI + run: | + PYTHONPATH=src python scripts/score_systemic_risk.py --input fixtures/systemic_risk_evalmath/synthetic_two_worlds.json > /tmp/srb01_scored.json + python -c 'import json; d=json.load(open("/tmp/srb01_scored.json")); assert d["metrics"]["unobservable_regret"] == "4"' From fd6be777e9d435542bb000d8b0a69d85c1f319d3 Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Mon, 16 Nov 2026 16:06:31 +0800 Subject: [PATCH 10/13] fix(ci): expose repository fixtures namespace for pytest entrypoint --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 11802a7a..f88527a5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,5 +19,5 @@ site = ["markdown-it-py==3.0.0", "mdit-py-plugins==0.4.2", "pygments>=2.17"] where = ["src"] [tool.pytest.ini_options] -pythonpath = ["src"] +pythonpath = ["src", "."] testpaths = ["tests"] From ed953608cf8510610af9b46d4d238af0304e8087 Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Mon, 16 Nov 2026 16:09:27 +0800 Subject: [PATCH 11/13] docs(srb01): report source-pinned 30-world live simulator replay and exact risk results --- ...mic_risk_live_simulator_replay_20261116.md | 123 ++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 paper/systemic_risk_live_simulator_replay_20261116.md diff --git a/paper/systemic_risk_live_simulator_replay_20261116.md b/paper/systemic_risk_live_simulator_replay_20261116.md new file mode 100644 index 00000000..45dbae5a --- /dev/null +++ b/paper/systemic_risk_live_simulator_replay_20261116.md @@ -0,0 +1,123 @@ +# SRB-EM-01: upstream fire-sale replay with EvalMath SRB-01 + +**Date:** 16 November 2026. **Evidence:** verified synthetic mechanism +replay using the actual `patrickdugan/SystemicRiskBench` implementation. +There are zero model evaluations in this result. The finite-grid +probabilities are illustrative, not market estimates. + +## Source lock and experiment + +| Component | Exact source | +| --- | --- | +| SystemicRiskBench export PR | [patrickdugan/SystemicRiskBench #1](https://github.com/patrickdugan/SystemicRiskBench/pull/1) | +| Export branch snapshot replayed | `33e6e87a734142d01e513a2901eb1f1bdeea5bb5` | +| EvalMath scorer used | `1c3e07ece43cd617b05171d404c53cc8c906dc8c` | +| Source-bound GitHub CI | [SRB replay run 43828279531](https://github.com/patrickdugan/SystemicRiskBench/actions/runs/43828279531) | +| Exported bank SHA-256 | `eb556ce4beac4399086682a6d440731b5d41973c3d61129338b9ff1345d73737` | +| Simulator module SHA-256 | `719dd6ab7f4d8d5683cb50079c728c58acac9bd217a970dee330466ce0b1398a` | +| Exporter module SHA-256 | `5fdd92217a782f20f6e8c3cadd76913b580aca0fbf4a59a2c80304d50612892f` | +| Registered grid configuration SHA-256 | `ff8cfa2bb3e68e220cf68c9770f7984ba0468b7ecedadc1c166f4ca09abc67ca` | + +The integration uses the existing `systemic_risk_bench.simulation.simulate` +cohort fire-sale engine. The registered grid contains five shock levels +(4%, 8%, 12%, 30%, 38%), three order-book depth tiers (USD 300,000, +1,000,000 and 5,000,000) and both homogeneous and heterogeneous cohort +profiles. There are **30 equally weighted scenarios** and **60 paired +simulation calls**. Fixed aggregate capital is USD 1,000,000, representing +one million agents in the cohort approximation. + +One policy retains registered venue depth. The alternative triples depth +at a fixed **USD 10,000** hypothetical intervention cost. The stochastic +regime, external shock and cohort profile are paired within each world, +so this isolates the specified depth lever inside the simulator. The +observed signature reveals the shock tier; depth tier and cohort profile +are query-gated. The exporter rejects nonconvergence and reconciles +investor losses plus creditor shortfall with book-equity loss within a +cent. Every returned simulator float is rounded to cents and serialized +as an exact rational for evaluation. Native simulation dynamics remain +floating-point and synthetic. + +## Verified numerical results + +All USD amounts are equal-weight averages under the stipulated design +grid. Each decimal shown is rounded for display; the fractions are +the actual EvalMath output. + +| Metric | Exact | USD | +| --- | ---: | ---: | +| Baseline no-support policy mean total loss | `1505037371/3000` | 501,679.12 | +| Best fixed action mean total loss | `692549663/1500` | 461,699.78 | +| Best shock-observing policy mean total loss | `689549663/1500` | 459,699.78 | +| Full-information oracle mean total loss | `343104953/750` | 457,473.27 | +| Unobservable regret / two-action collision certificate | `3339757/1500` | 2,226.50 | +| Mean total loss with depth query | `343600937/750` | 458,134.58 | +| Mean total loss with profile query | `688049663/1500` | 458,699.78 | +| Tail CVaR, baseline harm at \(\alpha=4/5\) | `304509031/300` | 1,015,030.10 | +| Tail CVaR, shock-observing policy harm at \(\alpha=4/5\) | `99287277/100` | 992,872.77 | + +The best uniform intervention is tripling depth. Knowing the shock +tier allows the controller to avoid paying the backstop cost in the +4% shock regime and improves mean loss by exactly USD 2,000. +Access to depth tier lowers mean loss by another +`2347789/1500` USD (about 1,565.19) compared with the +shock-only observation. The per-world hindsight oracle still saves +`3339757/1500` USD (about 2,226.50) compared with the +shock-only controller. The exact equality with the binary collision +formula independently checks the mathematics of information-limited +policy choice on the source simulator's recorded outcomes. + +Both investor losses and creditor shortfall are included in the +counterfactual harm vector. Thirteen of the sixty action-world +simulations have positive creditor shortfall. Those sixty action-world +outcomes represent thirty paired worlds; treating them as independent +financial observations would overstate the evidence. + +## Misspecified checker and feedback result + +The exporter implements an explicit toy checker that reports +`claimed_safe` when *exogenous* book loss falls below USD 300,000. +It overlooks subsequent endogenous deleveraging and price impact. +Under the exact counterfactual outcomes, baseline liquidity has two +false-safe worlds, while the depth-tripled intervention has one. The +latter event is included in the former event's world set. + +EvalMath's maximum false authorization probability under **no +disclosure**, **one fixed query**, **two adaptive queries** and +**complete disclosure** is the same exact fraction, **1/15**. +Thus this particular joint law admits *no post-selection risk +increase* from the registered queries, even though those queries +improve intervention quality. The earlier independent two-world +fixture in [the SRB-01 mathematics](systemic_risk_evalmath.md) has +different event structure and does exhibit feedback selection gain. +Neither result is a measurement of an actual model's asserted safety. + +## Independent reproduction and validity limits + +The SRB GitHub Actions job ran all 58 tests in the current +SystemicRiskBench suite, generated the evaluator-only world bank, +checked it with the pinned EvalMath scorer and archived +`evalmath_bank.json` plus `evalmath_score.json`. CI passed. +The EvalMath branch separately verifies its arithmetic and synthetic +receipt in the dedicated SRB-01 workflow. + +All claimed arithmetic is conditional on **one registered equal-mass +synthetic simulator grid**. There is no inference to unconditional +financial crisis rates. The upstream named-history corpus has no +measured action-counterfactual matrix and was excluded. The published +90 model calls on separate numerical tasks are not mapped to the +two-intervention action grammar. This replay supplies a working +evaluator and a new, testable question about partial observation; a +prospective model comparison requires a registered policy interface, +independent case-family holdouts, fixed budgets and per-family paired +analysis. + +To regenerate from the SystemicRiskBench repo checkout: + +```bash +python -m systemic_risk_bench evalmath-export \ + --config configs/evalmath-simulation-v1.json \ + --output artifacts/evalmath_bank.json +PYTHONPATH=evalmath/src python evalmath/scripts/score_systemic_risk.py \ + --input artifacts/evalmath_bank.json \ + --output artifacts/evalmath_score.json +``` From 7b443146fdfa3a22a6dce4143f6a7b9e63fb0f53 Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Mon, 16 Nov 2026 16:09:51 +0800 Subject: [PATCH 12/13] docs(srb01): cross-link verified upstream SystemicRiskBench simulation replay --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 9a142e98..2d1d27d5 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,21 @@ Reviewers: see [`REVIEW.md`](REVIEW.md). **New (BPD-01, 2026-11-15):** [interventional separation and looped Lean curriculum](paper/bpd_interventional_separation.md) formalizes routed mechanism-pair coverage, optimal fixed/adaptive probes, clock-versus-state observability floors and a recurrence-repair counterexample. Exact 512-matrix and 96 seeded audits are source-hashed in `output/evaluation_bpd/bpd_01.json`. Reproduce via `python scripts/check_receipts.py --only bpd`. It supplies design mathematics, not a neural decomposition result. +## SystemicRiskBench and EvalMath SRB-01 + +The [SRB-01 finite-world scorer](paper/systemic_risk_evalmath.md) provides +source-hashed exact observable-policy risk floors, a two-action collision +certificate, fractional-tail harm and query-selection risk. Its +[two-world fixture](fixtures/systemic_risk_evalmath/synthetic_two_worlds.json) +checks the elementary mathematics. + +The [live SRB-EM-01 replay](paper/systemic_risk_live_simulator_replay_20261116.md) +connects the actual [SystemicRiskBench fire-sale simulator](https://github.com/patrickdugan/SystemicRiskBench/pull/1) +to the scorer: 30 equal-mass scenario worlds, 60 paired depth-intervention +simulations, exact rational loss scoring and a verified CI artifact. +The underlying simulator is synthetic and floating-point; no real model or +historical counterfactual performance is claimed. + ## Self-designed evaluation and FRC The [HRC-FRC-01 extension](paper/frc_harmonic_self_evaluation.md) studies From b0c21156436d8b4023017b93b5ac6baddfbf37e6 Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Mon, 16 Nov 2026 16:10:35 +0800 Subject: [PATCH 13/13] ci(srb01): verify fixed BPD fixture imports in fast workflow --- .github/workflows/srb01.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/srb01.yml b/.github/workflows/srb01.yml index c0845fbd..8ed5d337 100644 --- a/.github/workflows/srb01.yml +++ b/.github/workflows/srb01.yml @@ -11,6 +11,8 @@ on: - "fixtures/systemic_risk_evalmath/**" - "output/evaluation_systemic_risk/**" - "scripts/check_receipts.py" + - "pyproject.toml" + - "tests/test_bpd_lg01_v2.py" - ".github/workflows/srb01.yml" pull_request: paths: @@ -22,6 +24,8 @@ on: - "fixtures/systemic_risk_evalmath/**" - "output/evaluation_systemic_risk/**" - "scripts/check_receipts.py" + - "pyproject.toml" + - "tests/test_bpd_lg01_v2.py" - ".github/workflows/srb01.yml" workflow_dispatch: @@ -38,6 +42,8 @@ jobs: run: python -m pip install -e ".[test]" - name: Exact unit tests run: python -m pytest -q tests/test_evaluation_systemic_risk.py + - name: BPD fixtures namespace import regression + run: python -m pytest -q tests/test_bpd_lg01_v2.py - name: Regenerate source-hashed synthetic receipt run: python scripts/check_receipts.py --only systemic_risk - name: Score fixture through public CLI