Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/srb01.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
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"
- "pyproject.toml"
- "tests/test_bpd_lg01_v2.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"
- "pyproject.toml"
- "tests/test_bpd_lg01_v2.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: 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
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"'
Comment on lines +34 to +52
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions fixtures/systemic_risk_evalmath/synthetic_two_worlds.json
Original file line number Diff line number Diff line change
@@ -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}}}
]
}
48 changes: 48 additions & 0 deletions output/evaluation_systemic_risk/srb01.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
188 changes: 188 additions & 0 deletions paper/systemic_risk_evalmath.md
Original file line number Diff line number Diff line change
@@ -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.
Loading
Loading