Skip to content

Commit 8c8a73c

Browse files
fix(research): seal training replay semantics
1 parent 052ce74 commit 8c8a73c

5 files changed

Lines changed: 417 additions & 37 deletions

File tree

research/from-photons-to-macroverse/PREREGISTRATION.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Preregistration: matched arity and recursion discrimination
22

33
```text
4-
protocol version: 0.4.0
4+
protocol version: 0.5.0
55
run status: not-run
66
human subjects: none
77
animal subjects: none
@@ -127,7 +127,7 @@ the domain-field order below. The complete tuple, including `block`, is the
127127
counter-stream key; concatenated placeholders or language-native float strings
128128
are forbidden. Every listed field is present; use the literal token `"none"`
129129
for an inapplicable field. A nested carrier or tensor component is one token
130-
such as `outer/3/leaf/2`, not an implementation-native tuple string.
130+
such as `outer/2/leaf/2`, not an implementation-native tuple string.
131131

132132
Each digest is split in order into four big-endian unsigned 64-bit words and
133133
each word `w_k` maps to the open-unit uniform `u_k=(w_k+0.5)/2^64`. One scalar
@@ -364,7 +364,7 @@ whose indices are `start,...,start+15`:
364364
- a modulation multiplies the selected `W` summand or the selected all-source
365365
product term, named in the plan, by exactly `0.5` before `tanh`.
366366

367-
Nested plans name `outer/i` or `leaf/i/l` targets and apply the explicit nested
367+
Nested plans name `outer/i` or `outer/i/leaf/l` targets and apply the explicit nested
368368
equation above. Class `5` uses the primary-outcome certificate below. Class `6`
369369
composes the two corresponding operators in numeric class order; masks and
370370
modulators act before `tanh`, then additive state, process noise, and ablation
@@ -373,10 +373,13 @@ episode ids, times, targets, and process-noise stream keys. Controls receive the
373373
plan through these fixed operators and the adapter below, never through a
374374
learned or undeclared `u_t` channel.
375375

376-
The executable's candidate registry is the complete representation: `state`
377-
and `recovery` use a token observed identity plus an unsigned coordinate;
378-
`carrier` uses one token; and `edge` and `summand` use three tokens. Numeric
379-
strings never alias unsigned integers.
376+
The executable's `canonical_candidate_lists(system_kind,arity)` output is the
377+
complete candidate vocabulary and list for every schedule. `state` and
378+
`recovery` use a canonical observed identity plus an unsigned coordinate;
379+
`carrier` uses a canonical direct carrier or outer-carrier identity; and `edge`
380+
and `summand` use the exact term, target, and source identities emitted there.
381+
Numeric strings never alias unsigned integers, and no other token spelling is
382+
admissible.
380383

381384
## Outcomes
382385

@@ -593,8 +596,11 @@ serial left fold from `1.0` in that same order. Loss terms within a minibatch ar
593596
left-folded by `draw_index`, then transition index, then lexicographic original
594597
observed scalar identity. Recovery squared coordinates and every reported mean
595598
use the corresponding lexicographic original-identity order and a serial left
596-
fold before the single final division. Reverse-mode gradients are derivatives
597-
of this ordered scalar program and accumulate contributions in the same order.
599+
fold before the single final division. Reverse-mode gradients use only the
600+
pinned executable's binary multiply/divide, serial sum/product, `tanh`,
601+
`softplus`, variance-head, and Gaussian-NLL adjoint functions and accumulate
602+
contributions in the same order. `variance_head_value` and
603+
`gaussian_nll_term` are the sole scalar variance and NLL forward recurrences.
598604
Reassociation, tree or parallel reductions, model-position ordering, and fused
599605
multiply-add contraction are forbidden. These rules apply before fitting,
600606
during every optimizer update, and during rollout and scoring, so a carrier
@@ -665,10 +671,13 @@ carrier `a` receives the arithmetic mean of all observed carriers with
665671
`q_{m,n}(i)=a`; for `m > n`, control carrier `a` receives observed carrier
666672
`r_{m,n}(a)`. Define the model-carrier image of observed carrier `i` as
667673
`A_{m,n}(i)={q_{m,n}(i)}` for `m<n` and
668-
`A_{m,n}(i)={a:r_{m,n}(a)=i}` for `m>n`. Carrier-targeted additive interventions are encoded by the same
669-
map before dynamics: merged controls receive the arithmetic mean of all
670-
interventions in their bucket, and split controls receive the same intervention
671-
on every split carrier assigned to the targeted observed carrier. Edge cuts with
674+
`A_{m,n}(i)={a:r_{m,n}(a)=i}` for `m>n`. Carrier-targeted additive interventions
675+
use the same map only to identify model output coordinates: merged controls
676+
receive the arithmetic mean of all additions in their bucket, and split controls
677+
receive the same addition on every split carrier assigned to the targeted
678+
observed carrier. Every resulting addition is applied after that model carrier's
679+
deterministic `tanh` transition and before process noise; it is never applied to
680+
the input encoding or before dynamics. Edge cuts with
672681
endpoints collapsed into one merged carrier become recorded self-edge no-ops;
673682
all other cuts map to every nonself model edge in
674683
`A_{m,n}(source) x A_{m,n}(target)` and zero both those `W` summands and every

research/from-photons-to-macroverse/replay_reference.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
"schema": "the-interdependency.arity-recursion-replay-pin",
33
"version": "1.0.0",
44
"protocol_id": "arity-recursion-synthetic-v6",
5-
"protocol_version": "0.4.0",
5+
"protocol_version": "0.5.0",
66
"status": "not-run",
77
"reference_path": "tools/replay_reference.py",
8-
"reference_sha256": "67a17f0c33b28765e0189505ab6fc6f18a10530008211bf4e7abdcf9e2744fe9",
9-
"contract_sha256": "12f1a245de8bda5efe1b04547f54ca4da961287f6f48fd3becbee91ce07c799e",
8+
"reference_sha256": "3b3c6babd2340eb5d08aadbbfa3b2c3b21af75683210957c3730e72a52a70460",
9+
"contract_sha256": "8584dd017603e0b5f4b6be7c6756e348b3f3255bcbfbe42f0294ea2e993b6ffe",
1010
"vectors_path": "replay_vectors.json",
11-
"vectors_sha256": "053dd257e90d324ce022444d3a9d1d2fcd468d411533704a711f6405e0db3c33",
11+
"vectors_sha256": "87ac49b3baa50430760ab0702ae8f13a374d3e0baac7e1283122767f6386d4b4",
1212
"verification_command": "python tools/replay_reference.py verify"
1313
}

research/from-photons-to-macroverse/replay_vectors.json

Lines changed: 76 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,80 @@
11
{
2+
"adjoints": {
3+
"binary_divide_f64": [
4+
"c004000000000000",
5+
"bff4000000000000"
6+
],
7+
"binary_multiply_f64": [
8+
"bfe4000000000000",
9+
"3fd4000000000000"
10+
],
11+
"nll_adjoint_f64": [
12+
"3ff4000000000000",
13+
"bff4000000000000",
14+
"3fe4000000000000"
15+
],
16+
"nll_term_f64": "3fea50d048e7a1bd",
17+
"serial_product_f64": [
18+
"bfde000000000000",
19+
"3fce000000000000",
20+
"bfc4000000000000"
21+
],
22+
"serial_sum_f64": [
23+
"3ff4000000000000",
24+
"3ff4000000000000",
25+
"3ff4000000000000"
26+
],
27+
"softplus_f64": "3fde34086befd717",
28+
"tanh_f64": "3fef75398b8c1479",
29+
"variance_adjoint_f64": "3fde34086befd717",
30+
"variance_value_f64": "3fde574b2f73a891"
31+
},
32+
"candidate_registry": {
33+
"direct": {
34+
"carrier": {
35+
"count": 7,
36+
"sha256": "41db2dc9fa4b248d4968b6534dab975f2f31971093bb4a8b4b992767c715c02d"
37+
},
38+
"edge": {
39+
"count": 42,
40+
"sha256": "97f5a7c6a45b3d0c33091378a2b1bb7ffe6357d9cce5b2a810e51e79350c9a66"
41+
},
42+
"recovery": {
43+
"count": 14,
44+
"sha256": "b409688fa35f800e613a36ecb875012d15ffdf20709cc6405937d1088994b3f2"
45+
},
46+
"state": {
47+
"count": 14,
48+
"sha256": "13c084ebbeef451cf9c1040b8ff03e356bf7b8d24c62264e2e48670cc3e62e49"
49+
},
50+
"summand": {
51+
"count": 49,
52+
"sha256": "884b3477385b2a96634765a9f995a360a0f9a1d0007a61a17e9bdfb95e45d936"
53+
}
54+
},
55+
"nested": {
56+
"carrier": {
57+
"count": 7,
58+
"sha256": "daa699960d578300e3c8cf88fad39b68226ba8bfd67445d3384efc0f1a77fd27"
59+
},
60+
"edge": {
61+
"count": 100,
62+
"sha256": "4d581cee3e1b91c31eca8cab8d873a7c96d253902eec5395d0f26899a4c92c9d"
63+
},
64+
"recovery": {
65+
"count": 44,
66+
"sha256": "e9a6c3e0b3386e02916a9718fa028a183495d8bb8e532478b958c6dcb201f7db"
67+
},
68+
"state": {
69+
"count": 44,
70+
"sha256": "9b1c74e751fc629d74c3ef68b7395e9f786401a641d0781a8ac1c999c22c59c8"
71+
},
72+
"summand": {
73+
"count": 129,
74+
"sha256": "634e63f58287caf2b4a24faff0a6cd05764549627a3caa735c4c1c3e4964046a"
75+
}
76+
}
77+
},
278
"decision_edges": {
379
"class5_cdf_f64": "3fe8000000000000",
480
"cut_baseline_ascii": "[\"unperturbed\",\"cut\",\"direct/7\"]",
@@ -121,11 +197,6 @@
121197
13
122198
]
123199
],
124-
"ordered_candidates_ascii": [
125-
"[\"summand\",\"product\",\"outer/2\",\"none\"]",
126-
"[\"summand\",\"w\",\"outer/2\",\"outer/0\"]",
127-
"[\"summand\",\"w\",\"outer/2\",\"outer/1\"]"
128-
],
129200
"partition_key_ascii": "[\"arity-recursion-synthetic-v6\",32,7,50,\"intervention_plan\",\"model_partition/arbitrary/7\",[\"schedule/model_partition\",0,0],0]",
130201
"start_key_ascii": "[\"arity-recursion-synthetic-v6\",32,7,50,\"intervention_plan\",\"schedule\",[\"int/1/test/000\",1,\"start_time\"],0]",
131202
"state_candidate_ascii": "[\"state\",\"carrier/0\",0]",

research/from-photons-to-macroverse/tests/test_contracts.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def test_preregistration_closes_exact_head_replay_blockers(self) -> None:
215215
flat = " ".join(text.split())
216216

217217
for phrase in (
218-
"protocol version: 0.4.0",
218+
"protocol version: 0.5.0",
219219
'["arity-recursion-synthetic-v6",s,n,sigma_milli,domain,role,[k0,...,kp],block]',
220220
"concatenated placeholders or language-native float strings are forbidden",
221221
"stability/00` through `stability/15",
@@ -302,7 +302,7 @@ def test_executable_replay_reference_is_hash_pinned(self) -> None:
302302
pin = load_json("replay_reference.json")
303303
observed = replay.verify(PROJECT / "replay_reference.json")
304304
self.assertEqual(observed["protocol_id"], "arity-recursion-synthetic-v6")
305-
self.assertEqual(observed["protocol_version"], "0.4.0")
305+
self.assertEqual(observed["protocol_version"], "0.5.0")
306306
self.assertEqual(observed["reference_sha256"], pin["reference_sha256"])
307307
self.assertEqual(observed["contract_sha256"], pin["contract_sha256"])
308308
self.assertEqual(observed["vectors_sha256"], pin["vectors_sha256"])
@@ -345,8 +345,19 @@ def test_executable_replay_reference_is_hash_pinned(self) -> None:
345345
self.assertTrue(vectors["stability_probe"]["distinct"])
346346
self.assertIn('"intervention_plan","schedule"', vectors["schedule"]["target_key_ascii"])
347347
self.assertIn('"bootstrap","sealed_aggregate"', vectors["resampling"]["bootstrap_ascii"])
348+
self.assertEqual(
349+
vectors["candidate_registry"]["direct"]["state"]["count"], 14
350+
)
351+
self.assertEqual(
352+
vectors["candidate_registry"]["nested"]["state"]["count"], 44
353+
)
354+
self.assertEqual(
355+
vectors["candidate_registry"]["nested"]["edge"]["count"], 100
356+
)
357+
with self.assertRaises(ValueError):
358+
replay.candidate_bytes("nested", 7, "state", "leaf/3/2", 0)
348359
with self.assertRaises(ValueError):
349-
replay.candidate_bytes("state", 0, 0)
360+
replay.candidate_bytes("nested", 7, "state", "outer/3/leaf/2", 0)
350361
self.assertTrue(vectors["noise_phase"]["distinct"])
351362
self.assertGreater(replay.open_uniform_word(0), 0.0)
352363
self.assertLess(replay.open_uniform_word(2**64 - 1), 1.0)

0 commit comments

Comments
 (0)