AylinMaylinn commited on
Commit
91d91c5
·
verified ·
1 Parent(s): 5066d15

Reframe as research artifact: rich card + Apache-2.0 license + clean runnable code subset; remove internal design files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
.gitignore CHANGED
@@ -1,37 +1,4 @@
1
- # ── Python ──────────────────────────────────────────────
2
  __pycache__/
3
- *.py[cod]
4
- *$py.class
5
- *.egg-info/
6
- .eggs/
7
- build/
8
- dist/
9
- .pytest_cache/
10
- .mypy_cache/
11
- .ruff_cache/
12
- .ipynb_checkpoints/
13
-
14
- # ── Virtual envs ────────────────────────────────────────
15
  .venv/
16
- venv/
17
- env/
18
- ENV/
19
-
20
- # ── OS / editor cruft ───────────────────────────────────
21
- .DS_Store
22
- *.swp
23
- *~
24
-
25
- # ── Downloadable corpora / large data (regenerated by the loaders) ──
26
- # tiny-shakespeare is fetched from the karpathy URL by seq/charlm.py;
27
- # text8 is downloaded to $PRIZMA_RESULTS at runtime. Keep them out of git.
28
- seq/data/shakespeare.txt
29
- seq/data/text8
30
- **/text8
31
- *.zip
32
- *.gz
33
-
34
- # ── Model checkpoints (not produced by this repo, but guard anyway) ──
35
- *.pt
36
- *.ckpt
37
- *.safetensors
 
 
1
  __pycache__/
2
+ *.pyc
 
 
 
 
 
 
 
 
 
 
 
3
  .venv/
4
+ .pytest_cache/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
LICENSE ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or Derivative
95
+ Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Aylin
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
PRIZMA_D128_GPU.ipynb CHANGED
@@ -4,8 +4,8 @@
4
  "cell_type": "markdown",
5
  "metadata": {},
6
  "source": [
7
- "# Prizma-Seq vs Transformer \u2014 D=128 GPU benchmark\n",
8
- "**Run:** Runtime \u2192 Change runtime type \u2192 **GPU (A100/L4)** \u2192 then Runtime \u2192 **Run all**.\n",
9
  "Results stream to `Drive/MyDrive/prizma_results/gpu_bench.json` (resumable; safe to re-run after a disconnect).\n"
10
  ]
11
  },
@@ -254,7 +254,7 @@
254
  "def autoregressive_latency(model, vocab, seq_lens, device, reps=3, step_api=False):\n",
255
  " \"\"\"Measure wall-clock to generate `T` tokens for several T, to expose O(n^2) vs O(n).\n",
256
  " If the model exposes a streaming step API (init_state/step) we use it; otherwise we\n",
257
- " re-run the full forward each step (the naive KV-less path) \u2014 both are reported honestly.\"\"\"\n",
258
  " model.train(False)\n",
259
  " model = model.to(device)\n",
260
  " out = {}\n",
@@ -301,7 +301,7 @@
301
  "This module provides TWO implementations that MUST agree to < 1e-4 (forward AND grad):\n",
302
  " * _delta_reference : naive per-token recurrence (ground truth, slow)\n",
303
  " * chunked_delta : WY/UT chunk-parallel form (fast, used for training)\n",
304
- "Both operate on [B,H,T,d_h] tensors. alpha defaults to 1 (pure DeltaNet) \u2014 the diagnostic gates\n",
305
  "(MQAR/induction/selective-copy) need clean overwrite, not forgetting; the gated path is enabled\n",
306
  "for char-LM. Keep d_h even, C<=64, float32.\n",
307
  "\"\"\"\n",
@@ -388,7 +388,7 @@
388
  " logA = torch.log(Ac.clamp_min(1e-6))\n",
389
  " clog = torch.cumsum(logA, dim=-1) # [B,H,C] log gamma_i (post i)\n",
390
  " clog_prev = clog - logA # log gamma_{i-1} (pre i)\n",
391
- " KK = torch.matmul(Kc, Kc.transpose(-1, -2)) # [B,H,C,C] k_i\u00b7k_j\n",
392
  " ratio = torch.exp(clog[..., :, None] - clog[..., None, :]) # gamma_i/gamma_j\n",
393
  " A = torch.tril(Bc[..., :, None] * (KK * ratio), -1) if erase else torch.zeros_like(KK)\n",
394
  " KS0 = torch.matmul(Kc, S.transpose(-1, -2)) # [B,H,C,d] (k_i^T S0^T)\n",
@@ -425,7 +425,7 @@
425
  " torch.manual_seed(0)\n",
426
  " # cover the PRODUCTION regime: chunk=64, long T, the alpha=0.5 decay floor (worst-case\n",
427
  " # underflow), and the additive ablation. (The old test used chunk=16/T=40 and HID a float32\n",
428
- " # underflow bug in the gated chunked path \u2014 never weaken these settings.)\n",
429
  " devs = [\"cpu\", \"mps\"] if torch.backends.mps.is_available() else [\"cpu\"]\n",
430
  " cases = [(\"pure\", None, \"delta\"), (\"gated~U\", \"rand\", \"delta\"),\n",
431
  " (\"gated.5floor\", \"floor\", \"delta\"), (\"additive\", None, \"additive\"),\n",
@@ -676,7 +676,7 @@
676
  "source": [
677
  "%%writefile seq/prizma_seq.py\n",
678
  "\"\"\"\n",
679
- "Prizma-Seq \u2014 a Predictive-Coding Gated-DeltaNet sequence model (committee spec PRIZMA_SEQ_SPEC.md).\n",
680
  "\n",
681
  "Mixer = a carried associative workspace state S_t in R^{d_h x d_h} per head, updated by a\n",
682
  "precision-gated targeted erase-and-write (the delta rule), which is exactly ONE gradient step on\n",
@@ -686,7 +686,7 @@
686
  "\n",
687
  "Honest design note: the write gate beta is INPUT-dependent (sigma(W_beta x_t)), which keeps the\n",
688
  "chunk-parallel training form valid. Surprise-proportionality is intrinsic: the delta write is\n",
689
- "u_t = beta_t * (v_t - S_{t-1} k_t) = beta_t * epsilon_t \u2014 it writes the prediction error itself\n",
690
  "(Prizma's dW ~ (Pi*eps) (x) r). An optional surprise-gated variant (two-pass) is exposed for B6.\n",
691
  "\"\"\"\n",
692
  "from __future__ import annotations\n",
@@ -727,7 +727,7 @@
727
  " use_window: bool = True # False -> no local window head (state only)\n",
728
  " route_readout: bool = True # False -> read state with a FIXED (input-independent) query\n",
729
  " # (B6 noRouteReadout: kills content-based recall)\n",
730
- " # --- capacity lever: parameter-free quadratic key/query feature map (committee R1, rank #1) - #\n",
731
  " feat_map: str = \"none\" # 'none' | 'quad2'. 'quad2' expands the DELTA keys/queries from\n",
732
  " # d_h to d_phi = d_h + feat_n2 via FIXED random quadratic\n",
733
  " # monomials -> rectangular carried state S in R^{d_h x d_phi},\n",
@@ -801,7 +801,7 @@
801
  " self.register_buffer(\"feat_I\", torch.randint(0, dh, (cfg.feat_n2,), generator=g))\n",
802
  " self.register_buffer(\"feat_J\", torch.randint(0, dh, (cfg.feat_n2,), generator=g))\n",
803
  " elif cfg.feat_map == \"rand_linear\":\n",
804
- " # CONTROL (committee): fixed random linear map d_h -> d_phi. rank <= d_h, so it CANNOT\n",
805
  " # raise recall key-rank -> expected NO gain over 'none'. Buffer => param_count unchanged.\n",
806
  " g = torch.Generator().manual_seed(1234)\n",
807
  " self.register_buffer(\"W_rand\", torch.randn(dh, self.d_phi, generator=g) * (dh ** -0.5))\n",
@@ -981,7 +981,7 @@
981
  "if __name__ == \"__main__\":\n",
982
  " from .common import param_count, get_device\n",
983
  " dev = get_device()\n",
984
- " # O(1) GUARD (committee guardrail): for BOTH feat_map settings the streaming step() must equal\n",
985
  " # the parallel forward() to <1e-4, AND param_count must be identical (feature map = 0 params).\n",
986
  " for feat in (\"none\", \"quad2\"):\n",
987
  " cfg = PrizmaSeqConfig(vocab=64, d_model=64, n_layers=2, n_heads=2, feat_map=feat)\n",
@@ -1008,7 +1008,7 @@
1008
  "source": [
1009
  "%%writefile seq/tasks.py\n",
1010
  "\"\"\"\n",
1011
- "Canonical attention-diagnostic synthetic tasks \u2014 the suite the field uses to decide whether a\n",
1012
  "non-attention architecture can really stand in for a Transformer.\n",
1013
  "\n",
1014
  "All tasks share one causal next-token interface:\n",
@@ -1019,7 +1019,7 @@
1019
  " separates real attention-alternatives from impostors: in-context key->value\n",
1020
  " lookup for many queries, over a gap. Linear models with fixed state struggle as\n",
1021
  " #pairs grows; attention solves it trivially.\n",
1022
- " * AssocRecall single-query AR (Ba et al.; Hyena) \u2014 easier sanity version of MQAR.\n",
1023
  " * SelectiveCopy Mamba's selective-copy: copy the data tokens in order, ignoring interspersed\n",
1024
  " fillers. Requires INPUT-DEPENDENT gating (content-selective memory).\n",
1025
  " * Induction in-context induction-head probe: [.. A B .. A] -> predict B. The ICL primitive.\n",
@@ -1040,7 +1040,7 @@
1040
  " \"\"\"Multi-Query Associative Recall (Zoology/Based standard, dense). vocab in [1,V); 0 filler.\n",
1041
  " Sequence = [k0 v0 ... k_{D-1} v_{D-1}] (+optional filler gap) [q_1 q_2 ... q_M], where each\n",
1042
  " query q is one of the bound keys. The TARGET at each query position is that key's bound value\n",
1043
- " (NOT a next token \u2014 the answer never appears in the input), masked to query positions only.\n",
1044
  " Dense queries give rich supervision; capacity is set by the #bindings D (the B1b axis).\"\"\"\n",
1045
  "\n",
1046
  " def __init__(self, vocab=64, num_pairs=8, num_queries=None, gap=0, key_frac=0.5):\n",
@@ -1178,7 +1178,7 @@
1178
  " \"\"\"MQAR trained over a SPECTRUM of difficulties: each training batch samples the number of KV\n",
1179
  " pairs d ~ U[min_pairs, max_pairs] (the standard Zoology training distribution). The easy\n",
1180
  " instances supply the gradient that BOOTSTRAPS the recall circuit, so high-D recall becomes\n",
1181
- " learnable in feasible compute \u2014 where FIXED-high-D training stalls at chance (no foothold for the\n",
1182
  " sharp phase transition). EVALUATION is fixed at the target (max_pairs), so the reported number is\n",
1183
  " target-D recall. Identical for both models -> fair. n_key is stable across d (= vocab*key_frac\n",
1184
  " while d < that), so key/value ranges don't shift with difficulty.\"\"\"\n",
@@ -1228,11 +1228,11 @@
1228
  "outputs": [],
1229
  "source": [
1230
  "%%writefile gpu_bench.py\n",
1231
- "\"\"\"Prizma-Seq vs Transformer \u2014 the rigorous, scaled D=128 benchmark, for a CUDA GPU (Colab).\n",
1232
  "\n",
1233
- "Answers, with multi-seed + fair protocol, the questions the committee R2 verdict demands:\n",
1234
  " PHASE 1 Find the SMALLEST Transformer scale that genuinely SOLVES MQAR D=128 (the fair arena);\n",
1235
- " this is also the committee rank-1 flip-test (does attention solve D=128 with enough\n",
1236
  " scale/budget?). Multi-config x recipe x seed -> solve-rate.\n",
1237
  " PHASE 2 At that scale S*: matched + FLOP-comparable head-to-head at D=128 (TF vs Prizma-none vs\n",
1238
  " Prizma-quad2), >=5 seeds -> solve-rate + median + 95% CI. The headline fair comparison.\n",
@@ -1327,7 +1327,7 @@
1327
  "\n",
1328
  "# ----------------------------------------------------------------------------------------------- #\n",
1329
  "def phase1(res):\n",
1330
- " \"\"\"Smallest TF scale that SOLVES MQAR D=128 (fair arena + committee flip-test). Multi-seed.\"\"\"\n",
1331
  " print(\"\\n==== PHASE 1: TF D=128 solving-scale search (mixed-D, gen-warm) ====\", flush=True)\n",
1332
  " V = 512\n",
1333
  " task_fac = lambda: MixedMQAR(vocab=V, max_pairs=128, num_queries=128, gap=0, min_pairs=1)\n",
@@ -1526,7 +1526,7 @@
1526
  " f[\"qkv_proj\"] = mm(T, d, 3 * d)\n",
1527
  " # beta head W_beta: [T,d]x[d,H]\n",
1528
  " f[\"beta\"] = mm(T, d, H)\n",
1529
- " # phi feature map: quadratic monomials, elementwise \u2014 count the d_phi-dh products + l2 norm\n",
1530
  " n2 = d_phi - dh\n",
1531
  " f[\"phi_qk\"] = H * T * (n2 * 1 + d_phi * 3) * 2 # ~ products + norm; small, generous estimate\n",
1532
  "\n",
@@ -1612,7 +1612,7 @@
1612
  "cell_type": "markdown",
1613
  "metadata": {},
1614
  "source": [
1615
- "## Self-tests (kernels) \u2014 should print ALL OK + step==forward <1e-6\n"
1616
  ]
1617
  },
1618
  {
@@ -1697,4 +1697,4 @@
1697
  },
1698
  "nbformat": 4,
1699
  "nbformat_minor": 0
1700
- }
 
4
  "cell_type": "markdown",
5
  "metadata": {},
6
  "source": [
7
+ "# Prizma-Seq vs Transformer — D=128 GPU benchmark\n",
8
+ "**Run:** Runtime → Change runtime type → **GPU (A100/L4)** → then Runtime → **Run all**.\n",
9
  "Results stream to `Drive/MyDrive/prizma_results/gpu_bench.json` (resumable; safe to re-run after a disconnect).\n"
10
  ]
11
  },
 
254
  "def autoregressive_latency(model, vocab, seq_lens, device, reps=3, step_api=False):\n",
255
  " \"\"\"Measure wall-clock to generate `T` tokens for several T, to expose O(n^2) vs O(n).\n",
256
  " If the model exposes a streaming step API (init_state/step) we use it; otherwise we\n",
257
+ " re-run the full forward each step (the naive KV-less path) — both are reported honestly.\"\"\"\n",
258
  " model.train(False)\n",
259
  " model = model.to(device)\n",
260
  " out = {}\n",
 
301
  "This module provides TWO implementations that MUST agree to < 1e-4 (forward AND grad):\n",
302
  " * _delta_reference : naive per-token recurrence (ground truth, slow)\n",
303
  " * chunked_delta : WY/UT chunk-parallel form (fast, used for training)\n",
304
+ "Both operate on [B,H,T,d_h] tensors. alpha defaults to 1 (pure DeltaNet) — the diagnostic gates\n",
305
  "(MQAR/induction/selective-copy) need clean overwrite, not forgetting; the gated path is enabled\n",
306
  "for char-LM. Keep d_h even, C<=64, float32.\n",
307
  "\"\"\"\n",
 
388
  " logA = torch.log(Ac.clamp_min(1e-6))\n",
389
  " clog = torch.cumsum(logA, dim=-1) # [B,H,C] log gamma_i (post i)\n",
390
  " clog_prev = clog - logA # log gamma_{i-1} (pre i)\n",
391
+ " KK = torch.matmul(Kc, Kc.transpose(-1, -2)) # [B,H,C,C] k_i·k_j\n",
392
  " ratio = torch.exp(clog[..., :, None] - clog[..., None, :]) # gamma_i/gamma_j\n",
393
  " A = torch.tril(Bc[..., :, None] * (KK * ratio), -1) if erase else torch.zeros_like(KK)\n",
394
  " KS0 = torch.matmul(Kc, S.transpose(-1, -2)) # [B,H,C,d] (k_i^T S0^T)\n",
 
425
  " torch.manual_seed(0)\n",
426
  " # cover the PRODUCTION regime: chunk=64, long T, the alpha=0.5 decay floor (worst-case\n",
427
  " # underflow), and the additive ablation. (The old test used chunk=16/T=40 and HID a float32\n",
428
+ " # underflow bug in the gated chunked path — never weaken these settings.)\n",
429
  " devs = [\"cpu\", \"mps\"] if torch.backends.mps.is_available() else [\"cpu\"]\n",
430
  " cases = [(\"pure\", None, \"delta\"), (\"gated~U\", \"rand\", \"delta\"),\n",
431
  " (\"gated.5floor\", \"floor\", \"delta\"), (\"additive\", None, \"additive\"),\n",
 
676
  "source": [
677
  "%%writefile seq/prizma_seq.py\n",
678
  "\"\"\"\n",
679
+ "Prizma-Seq — a Predictive-Coding Gated-DeltaNet sequence model (design spec PRIZMA_SEQ_SPEC.md).\n",
680
  "\n",
681
  "Mixer = a carried associative workspace state S_t in R^{d_h x d_h} per head, updated by a\n",
682
  "precision-gated targeted erase-and-write (the delta rule), which is exactly ONE gradient step on\n",
 
686
  "\n",
687
  "Honest design note: the write gate beta is INPUT-dependent (sigma(W_beta x_t)), which keeps the\n",
688
  "chunk-parallel training form valid. Surprise-proportionality is intrinsic: the delta write is\n",
689
+ "u_t = beta_t * (v_t - S_{t-1} k_t) = beta_t * epsilon_t — it writes the prediction error itself\n",
690
  "(Prizma's dW ~ (Pi*eps) (x) r). An optional surprise-gated variant (two-pass) is exposed for B6.\n",
691
  "\"\"\"\n",
692
  "from __future__ import annotations\n",
 
727
  " use_window: bool = True # False -> no local window head (state only)\n",
728
  " route_readout: bool = True # False -> read state with a FIXED (input-independent) query\n",
729
  " # (B6 noRouteReadout: kills content-based recall)\n",
730
+ " # --- capacity lever: parameter-free quadratic key/query feature map (design rank #1) - #\n",
731
  " feat_map: str = \"none\" # 'none' | 'quad2'. 'quad2' expands the DELTA keys/queries from\n",
732
  " # d_h to d_phi = d_h + feat_n2 via FIXED random quadratic\n",
733
  " # monomials -> rectangular carried state S in R^{d_h x d_phi},\n",
 
801
  " self.register_buffer(\"feat_I\", torch.randint(0, dh, (cfg.feat_n2,), generator=g))\n",
802
  " self.register_buffer(\"feat_J\", torch.randint(0, dh, (cfg.feat_n2,), generator=g))\n",
803
  " elif cfg.feat_map == \"rand_linear\":\n",
804
+ " # CONTROL: fixed random linear map d_h -> d_phi. rank <= d_h, so it CANNOT\n",
805
  " # raise recall key-rank -> expected NO gain over 'none'. Buffer => param_count unchanged.\n",
806
  " g = torch.Generator().manual_seed(1234)\n",
807
  " self.register_buffer(\"W_rand\", torch.randn(dh, self.d_phi, generator=g) * (dh ** -0.5))\n",
 
981
  "if __name__ == \"__main__\":\n",
982
  " from .common import param_count, get_device\n",
983
  " dev = get_device()\n",
984
+ " # O(1) GUARD (protocol guardrail): for BOTH feat_map settings the streaming step() must equal\n",
985
  " # the parallel forward() to <1e-4, AND param_count must be identical (feature map = 0 params).\n",
986
  " for feat in (\"none\", \"quad2\"):\n",
987
  " cfg = PrizmaSeqConfig(vocab=64, d_model=64, n_layers=2, n_heads=2, feat_map=feat)\n",
 
1008
  "source": [
1009
  "%%writefile seq/tasks.py\n",
1010
  "\"\"\"\n",
1011
+ "Canonical attention-diagnostic synthetic tasks — the suite the field uses to decide whether a\n",
1012
  "non-attention architecture can really stand in for a Transformer.\n",
1013
  "\n",
1014
  "All tasks share one causal next-token interface:\n",
 
1019
  " separates real attention-alternatives from impostors: in-context key->value\n",
1020
  " lookup for many queries, over a gap. Linear models with fixed state struggle as\n",
1021
  " #pairs grows; attention solves it trivially.\n",
1022
+ " * AssocRecall single-query AR (Ba et al.; Hyena) — easier sanity version of MQAR.\n",
1023
  " * SelectiveCopy Mamba's selective-copy: copy the data tokens in order, ignoring interspersed\n",
1024
  " fillers. Requires INPUT-DEPENDENT gating (content-selective memory).\n",
1025
  " * Induction in-context induction-head probe: [.. A B .. A] -> predict B. The ICL primitive.\n",
 
1040
  " \"\"\"Multi-Query Associative Recall (Zoology/Based standard, dense). vocab in [1,V); 0 filler.\n",
1041
  " Sequence = [k0 v0 ... k_{D-1} v_{D-1}] (+optional filler gap) [q_1 q_2 ... q_M], where each\n",
1042
  " query q is one of the bound keys. The TARGET at each query position is that key's bound value\n",
1043
+ " (NOT a next token — the answer never appears in the input), masked to query positions only.\n",
1044
  " Dense queries give rich supervision; capacity is set by the #bindings D (the B1b axis).\"\"\"\n",
1045
  "\n",
1046
  " def __init__(self, vocab=64, num_pairs=8, num_queries=None, gap=0, key_frac=0.5):\n",
 
1178
  " \"\"\"MQAR trained over a SPECTRUM of difficulties: each training batch samples the number of KV\n",
1179
  " pairs d ~ U[min_pairs, max_pairs] (the standard Zoology training distribution). The easy\n",
1180
  " instances supply the gradient that BOOTSTRAPS the recall circuit, so high-D recall becomes\n",
1181
+ " learnable in feasible compute — where FIXED-high-D training stalls at chance (no foothold for the\n",
1182
  " sharp phase transition). EVALUATION is fixed at the target (max_pairs), so the reported number is\n",
1183
  " target-D recall. Identical for both models -> fair. n_key is stable across d (= vocab*key_frac\n",
1184
  " while d < that), so key/value ranges don't shift with difficulty.\"\"\"\n",
 
1228
  "outputs": [],
1229
  "source": [
1230
  "%%writefile gpu_bench.py\n",
1231
+ "\"\"\"Prizma-Seq vs Transformer — the rigorous, scaled D=128 benchmark, for a CUDA GPU (Colab).\n",
1232
  "\n",
1233
+ "Answers, with multi-seed + fair protocol, the questions the pre-registered protocol demands:\n",
1234
  " PHASE 1 Find the SMALLEST Transformer scale that genuinely SOLVES MQAR D=128 (the fair arena);\n",
1235
+ " this is also the rank-1 flip-test (does attention solve D=128 with enough\n",
1236
  " scale/budget?). Multi-config x recipe x seed -> solve-rate.\n",
1237
  " PHASE 2 At that scale S*: matched + FLOP-comparable head-to-head at D=128 (TF vs Prizma-none vs\n",
1238
  " Prizma-quad2), >=5 seeds -> solve-rate + median + 95% CI. The headline fair comparison.\n",
 
1327
  "\n",
1328
  "# ----------------------------------------------------------------------------------------------- #\n",
1329
  "def phase1(res):\n",
1330
+ " \"\"\"Smallest TF scale that SOLVES MQAR D=128 (fair arena + flip-test). Multi-seed.\"\"\"\n",
1331
  " print(\"\\n==== PHASE 1: TF D=128 solving-scale search (mixed-D, gen-warm) ====\", flush=True)\n",
1332
  " V = 512\n",
1333
  " task_fac = lambda: MixedMQAR(vocab=V, max_pairs=128, num_queries=128, gap=0, min_pairs=1)\n",
 
1526
  " f[\"qkv_proj\"] = mm(T, d, 3 * d)\n",
1527
  " # beta head W_beta: [T,d]x[d,H]\n",
1528
  " f[\"beta\"] = mm(T, d, H)\n",
1529
+ " # phi feature map: quadratic monomials, elementwise — count the d_phi-dh products + l2 norm\n",
1530
  " n2 = d_phi - dh\n",
1531
  " f[\"phi_qk\"] = H * T * (n2 * 1 + d_phi * 3) * 2 # ~ products + norm; small, generous estimate\n",
1532
  "\n",
 
1612
  "cell_type": "markdown",
1613
  "metadata": {},
1614
  "source": [
1615
+ "## Self-tests (kernels) — should print ALL OK + step==forward <1e-6\n"
1616
  ]
1617
  },
1618
  {
 
1697
  },
1698
  "nbformat": 4,
1699
  "nbformat_minor": 0
1700
+ }
PRIZMA_run_B_lengen.ipynb CHANGED
@@ -4,7 +4,7 @@
4
  "cell_type": "markdown",
5
  "metadata": {},
6
  "source": [
7
- "# Prizma v3-B \u2014 length-extrapolation (parallel session B)"
8
  ]
9
  },
10
  {
@@ -13,8 +13,8 @@
13
  "metadata": {},
14
  "outputs": [],
15
  "source": [
16
- "# 1) Clone gist + reconstruct seq/\n",
17
- "!rm -rf /content/prizma && git clone -q https://gist.github.com/300fa3eeb2c8e5ad6c1e0264565cb7ee.git /content/prizma\n",
18
  "import os, shutil\n",
19
  "os.chdir('/content/prizma')\n",
20
  "os.makedirs('seq', exist_ok=True)\n",
@@ -44,7 +44,7 @@
44
  "metadata": {},
45
  "outputs": [],
46
  "source": [
47
- "# 3) Prizma v3-B \u2014 length-extrapolation (parallel session B)\n",
48
  "!cd /content/prizma && PRIZMA_RESULTS=/content/drive/MyDrive/prizma_results python -u gpu_lengen.py induction mqar"
49
  ]
50
  }
@@ -65,4 +65,4 @@
65
  },
66
  "nbformat": 4,
67
  "nbformat_minor": 0
68
- }
 
4
  "cell_type": "markdown",
5
  "metadata": {},
6
  "source": [
7
+ "# Prizma v3-B — length-extrapolation (parallel session B)"
8
  ]
9
  },
10
  {
 
13
  "metadata": {},
14
  "outputs": [],
15
  "source": [
16
+ "# 1) Clone repo + reconstruct seq/\n",
17
+ "!rm -rf /content/prizma && git clone -q https://huggingface.co/AylinMaylinn/Prizma /content/prizma\n",
18
  "import os, shutil\n",
19
  "os.chdir('/content/prizma')\n",
20
  "os.makedirs('seq', exist_ok=True)\n",
 
44
  "metadata": {},
45
  "outputs": [],
46
  "source": [
47
+ "# 3) Prizma v3-B — length-extrapolation (parallel session B)\n",
48
  "!cd /content/prizma && PRIZMA_RESULTS=/content/drive/MyDrive/prizma_results python -u gpu_lengen.py induction mqar"
49
  ]
50
  }
 
65
  },
66
  "nbformat": 4,
67
  "nbformat_minor": 0
68
+ }
PRIZMA_run_C_latency.ipynb CHANGED
@@ -4,7 +4,7 @@
4
  "cell_type": "markdown",
5
  "metadata": {},
6
  "source": [
7
- "# Prizma v3-C \u2014 O(1) decode latency+memory crossover (parallel session C)"
8
  ]
9
  },
10
  {
@@ -13,8 +13,8 @@
13
  "metadata": {},
14
  "outputs": [],
15
  "source": [
16
- "# 1) Clone gist + reconstruct seq/\n",
17
- "!rm -rf /content/prizma && git clone -q https://gist.github.com/300fa3eeb2c8e5ad6c1e0264565cb7ee.git /content/prizma\n",
18
  "import os, shutil\n",
19
  "os.chdir('/content/prizma')\n",
20
  "os.makedirs('seq', exist_ok=True)\n",
@@ -44,7 +44,7 @@
44
  "metadata": {},
45
  "outputs": [],
46
  "source": [
47
- "# 3) Prizma v3-C \u2014 O(1) decode latency+memory crossover (parallel session C)\n",
48
  "!cd /content/prizma && PRIZMA_RESULTS=/content/drive/MyDrive/prizma_results python -u gpu_latency.py"
49
  ]
50
  }
@@ -65,4 +65,4 @@
65
  },
66
  "nbformat": 4,
67
  "nbformat_minor": 0
68
- }
 
4
  "cell_type": "markdown",
5
  "metadata": {},
6
  "source": [
7
+ "# Prizma v3-C — O(1) decode latency+memory crossover (parallel session C)"
8
  ]
9
  },
10
  {
 
13
  "metadata": {},
14
  "outputs": [],
15
  "source": [
16
+ "# 1) Clone repo + reconstruct seq/\n",
17
+ "!rm -rf /content/prizma && git clone -q https://huggingface.co/AylinMaylinn/Prizma /content/prizma\n",
18
  "import os, shutil\n",
19
  "os.chdir('/content/prizma')\n",
20
  "os.makedirs('seq', exist_ok=True)\n",
 
44
  "metadata": {},
45
  "outputs": [],
46
  "source": [
47
+ "# 3) Prizma v3-C — O(1) decode latency+memory crossover (parallel session C)\n",
48
  "!cd /content/prizma && PRIZMA_RESULTS=/content/drive/MyDrive/prizma_results python -u gpu_latency.py"
49
  ]
50
  }
 
65
  },
66
  "nbformat": 4,
67
  "nbformat_minor": 0
68
+ }
PRIZMA_run_D_d208.ipynb CHANGED
@@ -4,7 +4,7 @@
4
  "cell_type": "markdown",
5
  "metadata": {},
6
  "source": [
7
- "# Prizma v3-D \u2014 width FLOP-matched TF d208L4H4 (parallel session D)"
8
  ]
9
  },
10
  {
@@ -13,8 +13,8 @@
13
  "metadata": {},
14
  "outputs": [],
15
  "source": [
16
- "# 1) Clone gist + reconstruct seq/\n",
17
- "!rm -rf /content/prizma && git clone -q https://gist.github.com/300fa3eeb2c8e5ad6c1e0264565cb7ee.git /content/prizma\n",
18
  "import os, shutil\n",
19
  "os.chdir('/content/prizma')\n",
20
  "os.makedirs('seq', exist_ok=True)\n",
@@ -44,7 +44,7 @@
44
  "metadata": {},
45
  "outputs": [],
46
  "source": [
47
- "# 3) Prizma v3-D \u2014 width FLOP-matched TF d208L4H4 (parallel session D)\n",
48
  "!cd /content/prizma && PRIZMA_RESULTS=/content/drive/MyDrive/prizma_results python -u flop_match_width.py"
49
  ]
50
  }
@@ -65,4 +65,4 @@
65
  },
66
  "nbformat": 4,
67
  "nbformat_minor": 0
68
- }
 
4
  "cell_type": "markdown",
5
  "metadata": {},
6
  "source": [
7
+ "# Prizma v3-D — width FLOP-matched TF d208L4H4 (parallel session D)"
8
  ]
9
  },
10
  {
 
13
  "metadata": {},
14
  "outputs": [],
15
  "source": [
16
+ "# 1) Clone repo + reconstruct seq/\n",
17
+ "!rm -rf /content/prizma && git clone -q https://huggingface.co/AylinMaylinn/Prizma /content/prizma\n",
18
  "import os, shutil\n",
19
  "os.chdir('/content/prizma')\n",
20
  "os.makedirs('seq', exist_ok=True)\n",
 
44
  "metadata": {},
45
  "outputs": [],
46
  "source": [
47
+ "# 3) Prizma v3-D — width FLOP-matched TF d208L4H4 (parallel session D)\n",
48
  "!cd /content/prizma && PRIZMA_RESULTS=/content/drive/MyDrive/prizma_results python -u flop_match_width.py"
49
  ]
50
  }
 
65
  },
66
  "nbformat": 4,
67
  "nbformat_minor": 0
68
+ }
PRIZMA_run_E_charlm2.ipynb CHANGED
@@ -4,8 +4,8 @@
4
  "cell_type": "markdown",
5
  "metadata": {},
6
  "source": [
7
- "# Prizma v3-E \u2014 credible char-LM (text8 + AdamW weight_decay + val-based early-stop)\n",
8
- "Clones the gist (incl. `gpu_charlm2.py`), reconstructs `seq/`, mounts Drive, runs the regularized text8 char-LM (Prizma-quad2 vs param-matched TF; **TEST BPC reported at the min-VAL checkpoint** \u2014 no early-stop on test). Streams crash-safe to `gpu_charlm2.json`."
9
  ]
10
  },
11
  {
@@ -14,8 +14,8 @@
14
  "metadata": {},
15
  "outputs": [],
16
  "source": [
17
- "# 1) Clone gist + reconstruct seq/\n",
18
- "!rm -rf /content/prizma && git clone -q https://gist.github.com/300fa3eeb2c8e5ad6c1e0264565cb7ee.git /content/prizma\n",
19
  "import os, shutil\n",
20
  "os.chdir('/content/prizma')\n",
21
  "os.makedirs('seq', exist_ok=True)\n",
@@ -45,7 +45,7 @@
45
  "metadata": {},
46
  "outputs": [],
47
  "source": [
48
- "# 3) Prizma v3-E \u2014 credible regularized char-LM (text8, weight_decay, val-selected TEST BPC)\n",
49
  "!cd /content/prizma && PRIZMA_RESULTS=/content/drive/MyDrive/prizma_results python -u gpu_charlm2.py"
50
  ]
51
  }
@@ -66,4 +66,4 @@
66
  },
67
  "nbformat": 4,
68
  "nbformat_minor": 0
69
- }
 
4
  "cell_type": "markdown",
5
  "metadata": {},
6
  "source": [
7
+ "# Prizma v3-E — credible char-LM (text8 + AdamW weight_decay + val-based early-stop)\n",
8
+ "Clones the repo (incl. `gpu_charlm2.py`), reconstructs `seq/`, mounts Drive, runs the regularized text8 char-LM (Prizma-quad2 vs param-matched TF; **TEST BPC reported at the min-VAL checkpoint** — no early-stop on test). Streams crash-safe to `gpu_charlm2.json`."
9
  ]
10
  },
11
  {
 
14
  "metadata": {},
15
  "outputs": [],
16
  "source": [
17
+ "# 1) Clone repo + reconstruct seq/\n",
18
+ "!rm -rf /content/prizma && git clone -q https://huggingface.co/AylinMaylinn/Prizma /content/prizma\n",
19
  "import os, shutil\n",
20
  "os.chdir('/content/prizma')\n",
21
  "os.makedirs('seq', exist_ok=True)\n",
 
45
  "metadata": {},
46
  "outputs": [],
47
  "source": [
48
+ "# 3) Prizma v3-E — credible regularized char-LM (text8, weight_decay, val-selected TEST BPC)\n",
49
  "!cd /content/prizma && PRIZMA_RESULTS=/content/drive/MyDrive/prizma_results python -u gpu_charlm2.py"
50
  ]
51
  }
 
66
  },
67
  "nbformat": 4,
68
  "nbformat_minor": 0
69
+ }
PRIZMA_run_bootstrap.ipynb CHANGED
@@ -5,7 +5,7 @@
5
  "metadata": {},
6
  "source": [
7
  "# Prizma-Seq — D=128 rigorous GPU benchmark\n",
8
- "Clones the (secret) gist with the verified `seq/` engine + `gpu_bench.py`, reconstructs the package, mounts Drive for crash-safe results, and runs all 5 phases. Results stream to `MyDrive/prizma_results/gpu_bench.json`."
9
  ]
10
  },
11
  {
@@ -14,8 +14,8 @@
14
  "metadata": {},
15
  "outputs": [],
16
  "source": [
17
- "# 1) Clone the secret gist and reconstruct the seq/ package\n",
18
- "!rm -rf /content/prizma && git clone -q https://gist.github.com/300fa3eeb2c8e5ad6c1e0264565cb7ee.git /content/prizma\n",
19
  "import os, shutil\n",
20
  "os.chdir('/content/prizma')\n",
21
  "os.makedirs('seq', exist_ok=True)\n",
 
5
  "metadata": {},
6
  "source": [
7
  "# Prizma-Seq — D=128 rigorous GPU benchmark\n",
8
+ "Clones the repo with the verified `seq/` engine + `gpu_bench.py`, reconstructs the package, mounts Drive for crash-safe results, and runs all 5 phases. Results stream to `MyDrive/prizma_results/gpu_bench.json`."
9
  ]
10
  },
11
  {
 
14
  "metadata": {},
15
  "outputs": [],
16
  "source": [
17
+ "# 1) Clone the repo and reconstruct the seq/ package\n",
18
+ "!rm -rf /content/prizma && git clone -q https://huggingface.co/AylinMaylinn/Prizma /content/prizma\n",
19
  "import os, shutil\n",
20
  "os.chdir('/content/prizma')\n",
21
  "os.makedirs('seq', exist_ok=True)\n",
PRIZMA_run_v2.ipynb CHANGED
@@ -3,10 +3,7 @@
3
  {
4
  "cell_type": "markdown",
5
  "metadata": {},
6
- "source": [
7
- "# Prizma-Seq — D=128 (lean, committee-complete) v2\n",
8
- "Re-clones the updated gist (3-seed P2 + d64 ablation/param-efficiency + FLOP-matched). Resumes from the cached `gpu_bench.json` on Drive (P1 + P2-TF + Prizma-none.s0 skip). Runs P5 (O(1), fast) + P2 (matched headline, 3 seeds) + extra_arms (d64 param-efficiency/causal-ablation + FLOP-matched TF). Skips P3/P4 (deferred / moved to d64)."
9
- ]
10
  },
11
  {
12
  "cell_type": "code",
@@ -14,8 +11,8 @@
14
  "metadata": {},
15
  "outputs": [],
16
  "source": [
17
- "# 1) Clone the (updated) secret gist and reconstruct the seq/ package\n",
18
- "!rm -rf /content/prizma && git clone -q https://gist.github.com/300fa3eeb2c8e5ad6c1e0264565cb7ee.git /content/prizma\n",
19
  "import os, shutil\n",
20
  "os.chdir('/content/prizma')\n",
21
  "os.makedirs('seq', exist_ok=True)\n",
@@ -47,17 +44,22 @@
47
  "execution_count": null,
48
  "metadata": {},
49
  "outputs": [],
50
- "source": [
51
- "# 3) Lean committee-complete run: P5 (fast O(1)) + P2 (matched headline, 3 seeds) + extra_arms\n",
52
- "!cd /content/prizma && PRIZMA_RESULTS=/content/drive/MyDrive/prizma_results python -u gpu_bench.py 5 2 && cd /content/prizma && PRIZMA_RESULTS=/content/drive/MyDrive/prizma_results python -u extra_arms.py"
53
- ]
54
  }
55
  ],
56
  "metadata": {
57
  "accelerator": "GPU",
58
- "colab": {"provenance": [], "gpuType": "A100"},
59
- "kernelspec": {"display_name": "Python 3", "name": "python3"},
60
- "language_info": {"name": "python"}
 
 
 
 
 
 
 
 
61
  },
62
  "nbformat": 4,
63
  "nbformat_minor": 0
 
3
  {
4
  "cell_type": "markdown",
5
  "metadata": {},
6
+ "source": "# Prizma-Seq — D=128 (lean, protocol-complete) v2\nRe-clones the updated repo (3-seed P2 + d64 ablation/param-efficiency + FLOP-matched). Resumes from the cached `gpu_bench.json` on Drive (P1 + P2-TF + Prizma-none.s0 skip). Runs P5 (O(1), fast) + P2 (matched headline, 3 seeds) + extra_arms (d64 param-efficiency/causal-ablation + FLOP-matched TF). Skips P3/P4 (deferred / moved to d64)."
 
 
 
7
  },
8
  {
9
  "cell_type": "code",
 
11
  "metadata": {},
12
  "outputs": [],
13
  "source": [
14
+ "# 1) Clone the (updated) repo and reconstruct the seq/ package\n",
15
+ "!rm -rf /content/prizma && git clone -q https://huggingface.co/AylinMaylinn/Prizma /content/prizma\n",
16
  "import os, shutil\n",
17
  "os.chdir('/content/prizma')\n",
18
  "os.makedirs('seq', exist_ok=True)\n",
 
44
  "execution_count": null,
45
  "metadata": {},
46
  "outputs": [],
47
+ "source": "# 3) Lean protocol-complete run: P5 (fast O(1)) + P2 (matched headline, 3 seeds) + extra_arms\n!cd /content/prizma && PRIZMA_RESULTS=/content/drive/MyDrive/prizma_results python -u gpu_bench.py 5 2 && cd /content/prizma && PRIZMA_RESULTS=/content/drive/MyDrive/prizma_results python -u extra_arms.py"
 
 
 
48
  }
49
  ],
50
  "metadata": {
51
  "accelerator": "GPU",
52
+ "colab": {
53
+ "provenance": [],
54
+ "gpuType": "A100"
55
+ },
56
+ "kernelspec": {
57
+ "display_name": "Python 3",
58
+ "name": "python3"
59
+ },
60
+ "language_info": {
61
+ "name": "python"
62
+ }
63
  },
64
  "nbformat": 4,
65
  "nbformat_minor": 0
PRIZMA_run_v3.ipynb CHANGED
@@ -5,7 +5,7 @@
5
  "metadata": {},
6
  "source": [
7
  "# Prizma-Seq v3 — §4 bar completion: diagnostics + char-LM\n",
8
- "Clones the secret gist (now incl. `gpu_diag.py` + `gpu_charlm.py`), reconstructs `seq/`, mounts Drive, then runs the two remaining attention-diagnostic legs (Induction + Selective-Copy) and the char-LM leg. Results stream crash-safe to `MyDrive/prizma_results/gpu_diag.json` and `gpu_charlm.json` (resumable)."
9
  ]
10
  },
11
  {
@@ -14,8 +14,8 @@
14
  "metadata": {},
15
  "outputs": [],
16
  "source": [
17
- "# 1) Clone the (updated) secret gist and reconstruct the seq/ package\n",
18
- "!rm -rf /content/prizma && git clone -q https://gist.github.com/300fa3eeb2c8e5ad6c1e0264565cb7ee.git /content/prizma\n",
19
  "import os, shutil\n",
20
  "os.chdir('/content/prizma')\n",
21
  "os.makedirs('seq', exist_ok=True)\n",
@@ -65,9 +65,17 @@
65
  ],
66
  "metadata": {
67
  "accelerator": "GPU",
68
- "colab": {"provenance": [], "gpuType": "A100"},
69
- "kernelspec": {"display_name": "Python 3", "name": "python3"},
70
- "language_info": {"name": "python"}
 
 
 
 
 
 
 
 
71
  },
72
  "nbformat": 4,
73
  "nbformat_minor": 0
 
5
  "metadata": {},
6
  "source": [
7
  "# Prizma-Seq v3 — §4 bar completion: diagnostics + char-LM\n",
8
+ "Clones the repo (now incl. `gpu_diag.py` + `gpu_charlm.py`), reconstructs `seq/`, mounts Drive, then runs the two remaining attention-diagnostic legs (Induction + Selective-Copy) and the char-LM leg. Results stream crash-safe to `MyDrive/prizma_results/gpu_diag.json` and `gpu_charlm.json` (resumable)."
9
  ]
10
  },
11
  {
 
14
  "metadata": {},
15
  "outputs": [],
16
  "source": [
17
+ "# 1) Clone the (updated) repo and reconstruct the seq/ package\n",
18
+ "!rm -rf /content/prizma && git clone -q https://huggingface.co/AylinMaylinn/Prizma /content/prizma\n",
19
  "import os, shutil\n",
20
  "os.chdir('/content/prizma')\n",
21
  "os.makedirs('seq', exist_ok=True)\n",
 
65
  ],
66
  "metadata": {
67
  "accelerator": "GPU",
68
+ "colab": {
69
+ "provenance": [],
70
+ "gpuType": "A100"
71
+ },
72
+ "kernelspec": {
73
+ "display_name": "Python 3",
74
+ "name": "python3"
75
+ },
76
+ "language_info": {
77
+ "name": "python"
78
+ }
79
  },
80
  "nbformat": 4,
81
  "nbformat_minor": 0
README.md CHANGED
@@ -1,5 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  # Prizma
2
 
 
 
3
  Two small-scale research threads built the same way: a **pre-registered falsifiable bar**, a
4
  **parameter/FLOP-matched** baseline, an **adversarial referee audit**, and **honest, binding
5
  limits**. No faked metrics — every number is produced by a reproducible script and the raw result
@@ -31,10 +50,11 @@ the project's pre-registered §4 bar:
31
  | Length-extrapolation | **WIN (relative)** | 10× better retention than a RoPE Transformer at 8× train length (absolute accuracy still only ~0.40) |
32
 
33
  **Honest scope — a *candidate*, not a proven alternative.** Char-LM is a loss-within-margin; the
34
- latency win is long-context-only (Prizma is ~1.3–1.5× *slower* below n≈16k) and Prizma trains ~5×
35
  slower per step (sequential delta); the FLOP-matched TF arms were optimization-confounded so **no
36
  per-FLOP claim** is made; n=2–3 seeds are descriptive (not powered equivalence); **large-scale LM
37
- parity and backprop-free parity are NOT claimed** (open frontiers).
 
38
 
39
  - Full writeup + adversarial referee trail → **[`docs/PRIZMA_SEQ_REPORT.md`](docs/PRIZMA_SEQ_REPORT.md)**
40
  - Raw A100 results (auditable) → `results/gpu_{bench,diag,lengen,latency,charlm2}.json` + `results/v3_campaign_results.md`
@@ -78,7 +98,7 @@ Prizma sits **between replay and the task-id-oracle**, matching the oracle's zer
78
  DFA variant is the best). The ablation shows recognition-routing is the causal mechanism.
79
  Adversarially audited by a 4-referee panel (no leakage, fair, reproduces, honest).
80
 
81
- - Full writeup (equations, borrowed-vs-new ledger, neuromorphic mapping, limits) → **[`docs/Prizma.md`](docs/Prizma.md)**
82
  - Code → `src/` (prizma + baselines + data + metrics), `experiments/` (E1–E5 suite + figure)
83
 
84
  ```bash
@@ -89,3 +109,25 @@ python3.13 -m venv .venv && ./.venv/bin/pip install numpy matplotlib
89
 
90
  > Status: research prototypes. Neither thread claims large-scale parity; each is a falsifiability
91
  > gate passed (or honestly refused) in a precisely-characterized small-scale regime.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language: en
4
+ tags:
5
+ - transformer-alternative
6
+ - efficient-attention
7
+ - linear-attention
8
+ - state-space-models
9
+ - sequence-modeling
10
+ - associative-recall
11
+ - mqar
12
+ - continual-learning
13
+ - predictive-coding
14
+ - research
15
+ library_name: pytorch
16
+ ---
17
+
18
  # Prizma
19
 
20
+ > ⚠️ **Research artifact / method — not a plug-and-play model.** There are no task weights to load; this repository presents two small-scale research threads, their code, and their auditable results.
21
+
22
  Two small-scale research threads built the same way: a **pre-registered falsifiable bar**, a
23
  **parameter/FLOP-matched** baseline, an **adversarial referee audit**, and **honest, binding
24
  limits**. No faked metrics — every number is produced by a reproducible script and the raw result
 
50
  | Length-extrapolation | **WIN (relative)** | 10× better retention than a RoPE Transformer at 8× train length (absolute accuracy still only ~0.40) |
51
 
52
  **Honest scope — a *candidate*, not a proven alternative.** Char-LM is a loss-within-margin; the
53
+ latency win is long-context-only (Prizma is ~1.3–1.6× *slower* below n≈16k) and Prizma trains ~5×
54
  slower per step (sequential delta); the FLOP-matched TF arms were optimization-confounded so **no
55
  per-FLOP claim** is made; n=2–3 seeds are descriptive (not powered equivalence); **large-scale LM
56
+ parity and backprop-free parity are NOT claimed** (open frontiers). The `quad2` kernel belongs to the
57
+ Based/Hedgehog feature-map family — the novelty is the **rectangular-delta-state framing**, not the kernel.
58
 
59
  - Full writeup + adversarial referee trail → **[`docs/PRIZMA_SEQ_REPORT.md`](docs/PRIZMA_SEQ_REPORT.md)**
60
  - Raw A100 results (auditable) → `results/gpu_{bench,diag,lengen,latency,charlm2}.json` + `results/v3_campaign_results.md`
 
98
  DFA variant is the best). The ablation shows recognition-routing is the causal mechanism.
99
  Adversarially audited by a 4-referee panel (no leakage, fair, reproduces, honest).
100
 
101
+ - Full writeup (equations, borrowed-vs-new ledger, neuromorphic mapping, limits) → **[`docs/Prizma_EN.md`](docs/Prizma_EN.md)**
102
  - Code → `src/` (prizma + baselines + data + metrics), `experiments/` (E1–E5 suite + figure)
103
 
104
  ```bash
 
109
 
110
  > Status: research prototypes. Neither thread claims large-scale parity; each is a falsifiability
111
  > gate passed (or honestly refused) in a precisely-characterized small-scale regime.
112
+
113
+ ---
114
+
115
+ ## Citation
116
+
117
+ ```bibtex
118
+ @misc{prizma2026,
119
+ author = {Aylin},
120
+ title = {Prizma: A Parameter-Free Quadratic Delta-State Sequence Mixer and a Backprop-Free Local Continual Learner},
121
+ year = {2026},
122
+ note = {Research artifact}
123
+ % eprint = {XXXX.XXXXX}, archivePrefix={arXiv}, primaryClass={cs.LG}
124
+ }
125
+ ```
126
+
127
+ ## License
128
+
129
+ Released under the **Apache-2.0** license.
130
+
131
+ ## Author
132
+
133
+ **Aylin** — Independent Researcher
build_notebook.py DELETED
@@ -1,83 +0,0 @@
1
- """Generate a self-contained Colab notebook (PRIZMA_D128_GPU.ipynb) that recreates the EXACT verified
2
- seq/* package + gpu_bench.py + flop_ledger.py via %%writefile cells, mounts Drive, and runs the full
3
- rigorous D=128 benchmark on a CUDA GPU, streaming results to Drive. No repo/clone needed.
4
- """
5
- import json
6
- import os
7
-
8
- ROOT = os.path.dirname(os.path.abspath(__file__))
9
- MODULES = [
10
- ("seq/__init__.py", "seq/__init__.py"),
11
- ("seq/common.py", "seq/common.py"),
12
- ("seq/delta.py", "seq/delta.py"),
13
- ("seq/transformer.py", "seq/transformer.py"),
14
- ("seq/prizma_seq.py", "seq/prizma_seq.py"),
15
- ("seq/tasks.py", "seq/tasks.py"),
16
- ("gpu_bench.py", "gpu_bench.py"),
17
- ("flop_ledger.py", "flop_ledger.py"),
18
- ]
19
-
20
-
21
- def code(src):
22
- return {"cell_type": "code", "metadata": {}, "execution_count": None, "outputs": [],
23
- "source": src if isinstance(src, list) else [src]}
24
-
25
-
26
- def md(src):
27
- return {"cell_type": "markdown", "metadata": {}, "source": src if isinstance(src, list) else [src]}
28
-
29
-
30
- def writefile_cell(target, path):
31
- with open(os.path.join(ROOT, path)) as f:
32
- content = f.read()
33
- if content and not content.endswith("\n"):
34
- content += "\n"
35
- return code([f"%%writefile {target}\n"] + content.splitlines(keepends=True))
36
-
37
-
38
- cells = [
39
- md(["# Prizma-Seq vs Transformer — D=128 GPU benchmark\n",
40
- "**Run:** Runtime → Change runtime type → **GPU (A100/L4)** → then Runtime → **Run all**.\n",
41
- "Results stream to `Drive/MyDrive/prizma_results/gpu_bench.json` (resumable; safe to re-run after a disconnect).\n"]),
42
- code(["import torch, subprocess\n",
43
- "print('torch', torch.__version__, 'cuda', torch.cuda.is_available())\n",
44
- "print(subprocess.run(['nvidia-smi','--query-gpu=name,memory.total','--format=csv,noheader'],\n",
45
- " capture_output=True, text=True).stdout)\n",
46
- "assert torch.cuda.is_available(), 'Enable GPU: Runtime > Change runtime type > GPU'\n"]),
47
- code(["import os\n",
48
- "from google.colab import drive\n",
49
- "drive.mount('/content/drive')\n",
50
- "os.environ['PRIZMA_RESULTS'] = '/content/drive/MyDrive/prizma_results'\n",
51
- "os.makedirs(os.environ['PRIZMA_RESULTS'], exist_ok=True)\n",
52
- "os.makedirs('seq', exist_ok=True)\n",
53
- "print('results ->', os.environ['PRIZMA_RESULTS'])\n"]),
54
- ]
55
- cells += [writefile_cell(t, p) for (t, p) in MODULES]
56
- cells += [
57
- md(["## Self-tests (kernels) — should print ALL OK + step==forward <1e-6\n"]),
58
- code(["!python -m seq.delta | tail -4\n",
59
- "!python -m seq.prizma_seq\n"]),
60
- md(["## FLOP ledger (analytical disclosure: Prizma/TF forward-FLOP ratio)\n"]),
61
- code(["!python flop_ledger.py | grep -E 'per-token|RATIOS|as-coded|ideal'\n"]),
62
- md(["## Run the full benchmark (phases 1-5). Streams to Drive; hours on A100/L4.\n"]),
63
- code(["import sys\n",
64
- "sys.argv = ['gpu_bench'] # no args -> all phases (or e.g. ['gpu_bench','1','2'])\n",
65
- "import gpu_bench\n",
66
- "gpu_bench.main()\n"]),
67
- md(["## Final summary (also copied here for easy read-back)\n"]),
68
- code(["import json, os\n",
69
- "d = json.load(open(os.path.join(os.environ['PRIZMA_RESULTS'], 'gpu_bench.json')))\n",
70
- "print('===RESULTS_JSON_BEGIN===')\n",
71
- "print(json.dumps({k: v for k, v in d.items() if k.endswith('_summary') or k == 'p5_latency'}, indent=2))\n",
72
- "print('===RESULTS_JSON_END===')\n"]),
73
- ]
74
-
75
- nb = {"cells": cells,
76
- "metadata": {"accelerator": "GPU", "colab": {"provenance": [], "toc_visible": True},
77
- "kernelspec": {"name": "python3", "display_name": "Python 3"},
78
- "language_info": {"name": "python"}},
79
- "nbformat": 4, "nbformat_minor": 0}
80
-
81
- out = os.path.join(ROOT, "PRIZMA_D128_GPU.ipynb")
82
- json.dump(nb, open(out, "w"), indent=1)
83
- print(f"wrote {out} ({os.path.getsize(out)} bytes, {len(cells)} cells)")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
calib_budget.py DELETED
@@ -1,119 +0,0 @@
1
- """De-risk calibration (pre-matrix).
2
-
3
- Goal: find the step budget at which the *Transformer* reaches its OWN plateau on the hard MQAR
4
- rungs (rung2, rung3), and confirm each model's best LR, so the fair matrix trains BOTH models to
5
- convergence. This protects the bar's non-strawman rule (#6): a fair comparison requires the
6
- Transformer to be trained to its plateau, not cut off mid-climb by too small a step budget.
7
-
8
- Single seed, no early stop (so we see the *whole* accuracy-vs-step curve). Writes
9
- results/calib_budget.json incrementally after every run, and prints a flushed, readable log.
10
-
11
- Run: python3.13 calib_budget.py [rung2|rung3|both] (default: both, rung2 first)
12
- """
13
- from __future__ import annotations
14
-
15
- import json
16
- import os
17
- import sys
18
- import time
19
-
20
- import numpy as np # noqa: F401 (kept for parity with the rest of the harness)
21
- import torch
22
-
23
- from seq.common import TrainConfig, train_model, param_count, get_device
24
- from seq.tasks import MQAR
25
- from seq.transformer import Transformer, TFConfig
26
- from seq.prizma_seq import PrizmaSeqLM, PrizmaSeqConfig
27
-
28
- DEV = get_device()
29
- RES = os.path.join(os.path.dirname(__file__), "results")
30
- os.makedirs(RES, exist_ok=True)
31
- OUT = os.path.join(RES, "calib_budget.json")
32
-
33
-
34
- def make_tf(V, T):
35
- return Transformer(TFConfig(vocab=V, d_model=64, n_layers=2, n_heads=2, max_len=T + 8, rope=True))
36
-
37
-
38
- def make_ps(V, T):
39
- return PrizmaSeqLM(PrizmaSeqConfig(vocab=V, d_model=64, n_layers=2, n_heads=2, max_len=T + 8))
40
-
41
-
42
- MODELS = {"Transformer": make_tf, "Prizma-Seq": make_ps}
43
-
44
- # The two hard rungs from run_bar.B1 (rung1 already ties at 1.000/0.998; not in question here).
45
- RUNGS = {
46
- "rung2": dict(vocab=96, num_pairs=32, num_queries=160, gap=0), # seq 224
47
- "rung3": dict(vocab=192, num_pairs=64, num_queries=256, gap=0), # seq 384 (the decisive gate)
48
- }
49
- STEPS = 12000 # long budget so the plateau is visible (matrix used 7000-8000)
50
- LRS = (1e-3, 2e-3, 3e-3)
51
- EVAL_EVERY = 1500
52
- SEED = 0
53
-
54
-
55
- def solve_step(history, thr=0.9):
56
- """First eval-step whose acc >= thr (None if never)."""
57
- for (step, _loss, acc) in history:
58
- if acc >= thr:
59
- return step
60
- return None
61
-
62
-
63
- def run_one(name, make, tkw, steps, lr):
64
- task = MQAR(**tkw)
65
- model = make(task.vocab, task.seq_len)
66
- p = param_count(model)
67
- cfg = TrainConfig(steps=steps, batch_size=64, lr=lr, eval_every=EVAL_EVERY, log=False,
68
- early_stop_acc=2.0) # 2.0 => early stop never triggers; full curve retained
69
- t0 = time.time()
70
- r = train_model(model, task, cfg, DEV, seed=SEED)
71
- return {
72
- "lr": lr, "params": p, "best": r.best_acc, "final": r.final_acc,
73
- "solve_step@0.9": solve_step(r.history, 0.9),
74
- "history": [(s, round(l, 4), round(a, 4)) for (s, l, a) in r.history],
75
- "sec": round(time.time() - t0, 1), "seq_len": task.seq_len, "task": task.name,
76
- }
77
-
78
-
79
- def main():
80
- which = sys.argv[1] if len(sys.argv) > 1 else "both"
81
- order = ["rung2", "rung3"] if which == "both" else [which]
82
- results = {}
83
- if os.path.exists(OUT):
84
- try:
85
- results = json.load(open(OUT))
86
- except Exception:
87
- results = {}
88
- print(f"device={DEV} rungs={order} steps={STEPS} lrs={LRS} seed={SEED}", flush=True)
89
- for rung in order:
90
- tkw = RUNGS[rung]
91
- results.setdefault(rung, {})
92
- print(f"\n==== CALIB {rung}: MQAR{tkw} (seq={MQAR(**tkw).seq_len}) ====", flush=True)
93
- for name, make in MODELS.items():
94
- results[rung].setdefault(name, {})
95
- for lr in LRS:
96
- try:
97
- rec = run_one(name, make, tkw, STEPS, lr)
98
- except Exception as e: # keep partials; report which run died
99
- rec = {"lr": lr, "error": repr(e)}
100
- results[rung][name][f"{lr:.0e}"] = rec
101
- json.dump(results, open(OUT, "w"), indent=2) # incremental persist
102
- ss = rec.get("solve_step@0.9")
103
- print(f" [{rung}] {name:<12} lr={lr:.0e}: best={rec.get('best', float('nan')):.3f} "
104
- f"final={rec.get('final', float('nan')):.3f} solve@0.9={ss} "
105
- f"({rec.get('sec', '?')}s, {rec.get('params', '?')}p)", flush=True)
106
- # readable verdict
107
- print("\n==== CALIB SUMMARY (does the Transformer reach plateau within budget?) ====", flush=True)
108
- for rung in order:
109
- for name in MODELS:
110
- arm = results[rung][name]
111
- best_lr = max(arm, key=lambda l: arm[l].get("best", -1))
112
- b = arm[best_lr]
113
- print(f" {rung} {name:<12} best_lr={best_lr} best_acc={b.get('best', float('nan')):.3f} "
114
- f"solve@0.9={b.get('solve_step@0.9')}", flush=True)
115
- print(f"\nsaved -> {OUT}", flush=True)
116
-
117
-
118
- if __name__ == "__main__":
119
- main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cap_probe.py DELETED
@@ -1,102 +0,0 @@
1
- """Decisive capacity validation (committee R1 first_build).
2
-
3
- Question: does the parameter-free quadratic feature map (feat_map='quad2', d_phi=128) lift MQAR
4
- associative recall at HIGH D toward the Transformer, while matched Prizma-Seq (d_h=32) hits its
5
- pre-registered ~D*=32 ceiling? Runs the decisive rungs under the FIXED fair protocol (frozen eval
6
- + per-model plateau early-stop from common.py, best of a small shared LR set). Also doubles as the
7
- fairness check: does the Transformer now reach near-ceiling when trained to its own plateau?
8
-
9
- 1 seed = directional signal; the full run_bar matrix does >=5 seeds + CIs. Incremental + resumable.
10
-
11
- Run: python3.13 cap_probe.py # default decisive D in {64,128}
12
- python3.13 cap_probe.py 16 32 64 128
13
- """
14
- from __future__ import annotations
15
-
16
- import json
17
- import os
18
- import sys
19
- import time
20
-
21
- import numpy as np # noqa: F401
22
- import torch # noqa: F401
23
-
24
- from seq.common import TrainConfig, train_model, param_count, get_device
25
- from seq.tasks import MQAR
26
- from seq.transformer import Transformer, TFConfig
27
- from seq.prizma_seq import PrizmaSeqLM, PrizmaSeqConfig
28
-
29
- DEV = get_device()
30
- RES = os.path.join(os.path.dirname(__file__), "results")
31
- os.makedirs(RES, exist_ok=True)
32
- OUT = os.path.join(RES, "cap_probe.json")
33
-
34
- LRS = (1e-3, 2e-3)
35
- SEED = 0
36
-
37
-
38
- def tf(V, T):
39
- return Transformer(TFConfig(vocab=V, d_model=64, n_layers=2, n_heads=2, max_len=T + 8, rope=True))
40
-
41
-
42
- def ps(V, T):
43
- return PrizmaSeqLM(PrizmaSeqConfig(vocab=V, d_model=64, n_layers=2, n_heads=2, max_len=T + 8))
44
-
45
-
46
- def ps_quad(V, T):
47
- return PrizmaSeqLM(PrizmaSeqConfig(vocab=V, d_model=64, n_layers=2, n_heads=2, max_len=T + 8,
48
- feat_map="quad2", feat_n2=96)) # d_phi = 32 + 96 = 128
49
-
50
-
51
- MODELS = {"Transformer": tf, "Prizma-none": ps, "Prizma-quad2": ps_quad}
52
-
53
-
54
- def cap_for(D):
55
- return 12000 if D <= 32 else (16000 if D <= 64 else 20000)
56
-
57
-
58
- def main():
59
- Ds = [int(a) for a in sys.argv[1:]] or [64, 128]
60
- res = json.load(open(OUT)) if os.path.exists(OUT) else {}
61
- print(f"device={DEV} D={Ds} LRs={LRS} seed={SEED} (plateau early-stop; frozen eval)", flush=True)
62
- for D in Ds:
63
- V = max(64, 4 * D)
64
- tkw = dict(vocab=V, num_pairs=D, num_queries=128, gap=0)
65
- seq = MQAR(**tkw).seq_len
66
- cap = cap_for(D)
67
- key = f"D{D}"
68
- res.setdefault(key, {})
69
- print(f"\n==== CAP D={D} (V={V}, seq={seq}, cap={cap}) ====", flush=True)
70
- for name, make in MODELS.items():
71
- res[key].setdefault(name, {})
72
- for lr in LRS:
73
- lk = f"{lr:.0e}"
74
- if lk in res[key][name] and "best" in res[key][name][lk]:
75
- print(f" [D{D}] {name:<12} lr={lk}: (cached best={res[key][name][lk]['best']:.3f})",
76
- flush=True)
77
- continue
78
- task = MQAR(**tkw)
79
- model = make(task.vocab, task.seq_len)
80
- p = param_count(model)
81
- cfg = TrainConfig(steps=cap, batch_size=64, lr=lr, log=False)
82
- t0 = time.time()
83
- r = train_model(model, task, cfg, DEV, seed=SEED)
84
- rec = {"best": r.best_acc, "final": r.final_acc, "steps_to_plateau": r.steps_to_plateau,
85
- "params": p, "sec": round(time.time() - t0, 1)}
86
- res[key][name][lk] = rec
87
- json.dump(res, open(OUT, "w"), indent=2) # incremental + resumable
88
- print(f" [D{D}] {name:<12} lr={lk}: best={rec['best']:.3f} final={rec['final']:.3f} "
89
- f"plateau@{rec['steps_to_plateau']} ({rec['sec']}s, {p}p)", flush=True)
90
- print("\n==== CAP SUMMARY (best over LRs; the central contrast) ====", flush=True)
91
- for D in Ds:
92
- cells = []
93
- for name in MODELS:
94
- arm = res[f"D{D}"][name]
95
- b = max((v.get("best", -1) for v in arm.values()), default=-1)
96
- cells.append(f"{name}={b:.3f}")
97
- print(f" D={D:<4} " + " ".join(cells), flush=True)
98
- print(f"\nsaved -> {OUT}", flush=True)
99
-
100
-
101
- if __name__ == "__main__":
102
- main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
committee/reports.json DELETED
The diff for this file is too large to render. See raw diff
 
committee/round1_synthesis.md DELETED
@@ -1,87 +0,0 @@
1
- # Prizma-Seq Committee — Round 1 Synthesis (durable record)
2
-
3
- > Produced by the round-1 committee (fairness referee · recall-capacity theorist · 3 architecture
4
- > proposers · chief architect). This is the authoritative summary that drives the aggressive
5
- > D=128-parity loop. Owner goal (locked): **full parity with a tuned Transformer even on the
6
- > hardest MQAR rung (D=128)**, big architectural changes allowed, multi-session compute; **no faked
7
- > metrics**, param/FLOP-matched non-strawman baseline, **preserve the measured O(1) inference
8
- > differentiator**.
9
-
10
- ## Verdict
11
- The harness is *structurally* honest (byte-identical FFN/norm/embed/head, ~1.01% param match,
12
- correct disjoint-range dense-query MQAR, symmetric best-LR selection, a genuinely measured O(1)
13
- path) but its CURRENT settings were **unfair to the Transformer**, which fully explains the
14
- provisional "Prizma wins rung2/3" headline. And the pre-registered recall ceiling is real:
15
- `H·d_h = 64` cannot hold 128 near-orthogonal bindings, so **D=128 parity requires architectural
16
- change**.
17
-
18
- ## A. Fairness fixes (implemented in `seq/common.py`; verified)
19
- Three compounding unfairnesses, all now fixed:
20
- 1. **Undertraining.** Fixed 6–8k step budgets sat near Prizma's fast convergence; the Transformer was
21
- still climbing (TF=0.095 @7k on rung2) — yet `results/validate_disjoint.txt` shows a matched TF
22
- hits **1.000 by step 3000** given a good LR. → **Relative per-model plateau early-stop** (large
23
- per-rung cap + stop when best-acc gain < `plateau_delta=0.003` over `patience=5` evals, `min_steps=4000`),
24
- applied identically to both. `eval_every=500` for resolution.
25
- 2. **LR grid asymmetry.** `{1e-3,2e-3}`: 2e-3 collapses the TF to 0.149 on rung1 while Prizma is robust
26
- at both → "best-of-2" gave Prizma a 2-shot draw, the TF a 1-shot. → **Wider shared grid
27
- `{5e-4,1e-3,1.5e-3,2e-3,3e-3}`, two-stage** (full grid @1 seed → best LR → ≥5 seeds), reject
28
- collapsing LRs.
29
- 3. **Absolute early-stop (0.995).** Let the fast model stop, truncated the slow one. → replaced by the
30
- relative plateau rule above.
31
-
32
- Also: **generous absolute warmup (600 / 0.15)**; **frozen reproducible eval set** (`eval_seed`,
33
- ≥32 batches, identical across models/LRs/seeds) selecting best on the same held-out batches;
34
- **≥5 seeds** on decisive MQAR rungs with **solve-rate + median + CI**, reporting the TF's bimodality
35
- as a documented failure mode; a **first-class D=128 rung4** + a **gapped (recall-over-distance) rung**;
36
- a **measured param+FLOP+throughput ledger**; and **per-experiment JSON checkpointing** (crash-safe).
37
- Both models are bimodal/LR-fragile on MQAR at this scale (`stability_test.txt`: TF 2/5, Prizma 5/5 on
38
- one config; the reverse on another) — the protocol must be symmetric and seed-robust.
39
-
40
- ## B. Recall-capacity theory (numerically verified probe)
41
- Delta-state `S = Σ uᵢ kᵢᵀ` (‖k‖=1) is online ridgeless least-squares; read crosstalk variance
42
- ≈ `(D−1)/d_h`. Hard-recall (the MQAR decision) ≥0.97 at **D\* ≈ 0.5·d_h** (random keys) → **~1.0·d_h**
43
- (orthogonal/learned keys). Capacity is **linear in d_h**, rank-ceiling `d_h`.
44
- - (d_h=32,H=2): **D\* ≈ 24–32** (matches pre-registration).
45
- - (d_h=64,H=2): **D\* ≈ 48–64** (still short of 128).
46
- - **D=128 from fixed state needs effective rank ≥128** → ~d_state 128–256 OR a key-rank trick.
47
- - Transformer = n-growing lossless KV cache → unbounded recall; D=128 trivial. The structural trade:
48
- Prizma compresses D bindings into a fixed `d_h²` lossy codebook in exchange for O(1)/step inference.
49
-
50
- ## C. Ranked improvements (toward D=128, honesty-weighted)
51
- | # | Lever | Param cost | O(1)? | Status |
52
- |---|---|---|---|---|
53
- | **1** | **Quadratic feature map** φ: d_h=32→d_φ=128, rectangular state S∈R^{d_h×d_φ} | **0** (buffers) | **yes** | **IMPLEMENTED + verified** |
54
- | 2 | Decoupled `d_state` (widen per-head state, e.g. 64→cap 128) | +32% (grow TF too) | yes | designed |
55
- | 3 | GlobalDeltaMemory: 1 asymmetric high-key-rank (d_k=128) delta head | +18% (grow TF too) | yes | designed |
56
- | 4 | Bounded global-attention / global-token hybrid | match | **partially** | reserved (explicit O(1)-trade) |
57
-
58
- **first_build = #1.** Best capacity-gain-per-honesty-risk: zero trainable params (byte-identical
59
- match preserved, no TF re-grow), O(1) intact (state fixed-size in n; constant grows d_h²=1024 →
60
- d_h·d_φ=4096 floats/head — disclosed in B5), default-off (no regression), lowest correctness risk
61
- (kernel verified dimension-agnostic; rectangular self-test added to `delta.py`). Crosstalk evidence
62
- is decisive: D=128 off-diagonal 0.141 → **0.076** ≈ true-d=128 oracle (0.071); a random *linear*
63
- 32→128 projection gives no gain (0.153) — proving the gain is the *quadratic monomials*.
64
- **Capacity is necessary, not sufficient — the end-to-end recall lift MUST be measured** (`cap_probe.py`,
65
- then `run_bar` B1b). Next levers staged: #2 as the param-honest "grow-both" Pareto arm, #3 as the
66
- cheaper-than-rank-doubling fallback, #4 only if pure-O(1) plateaus. **Honest end-state may be a
67
- Pareto pair** — a pure-O(1) variant AND, if needed, a bounded-hybrid that matches D=128 at a stated,
68
- measured inference cost — not a single model.
69
-
70
- ## D. Honesty guardrails (binding on every reported number)
71
- 1. **Param match** every head-to-head; any paid arm (#2/#3/#4) grows the Transformer in lockstep — never 130K-Prizma vs 102K-TF.
72
- 2. **Measured FLOP + throughput ledger** (Prizma carries an extra window head + conv at equal params; disclose direction+magnitude of any >10% gap; Prizma is ~3–5× slower wall-clock — disclose).
73
- 3. **O(1) disclosure**: report the per-model decode-state size in B5; state it is still O(1) in n and ≪ the TF's O(t) cache. A shipped hybrid's O(n) layer is a SEPARATE labeled B5 curve.
74
- 4. **O(1) equality guard**: streaming `step()` == parallel `forward()` to <1e-4 for every mechanism BEFORE any accuracy number (hard blocker; the `prizma_seq.py` __main__ assert).
75
- 5. **Causal ablation** under the same two-stage LR sweep: `quad2` vs `none` + a `random-linear-32→128` control (must show no gain) to prove the quadratic monomials are the cause.
76
- 6. **No best-of-noisy-curve**: select on the frozen eval set; report frozen best AND end-of-plateau acc.
77
- 7. **Report failure modes**: TF bimodality explicit; solve-rate + median + CI over ≥5 seeds; **pre-register D\*** for every new arm before its multi-seed run; if a lever lands below 0.97 at D=128, rescope to the achieved D\* — never claim unmeasured parity.
78
- 8. **Both sides of the contrast**: verify the matched TF actually reaches near-ceiling at D=128 under the fair protocol before claiming "Prizma degrades, TF doesn't".
79
- 9. **Seed-frozen architecture choices**: the φ monomial indices are seeded (1234) and disclosed — never tuned per task.
80
- 10. **Crash-safe audit trail**: per-experiment atomic JSON checkpoints incl. steps-to-plateau, full stage-1 LR sweep + rejected LRs, warmup/plateau/eval_seed, and the param+FLOP ledger.
81
-
82
- ## Implementation status (this session)
83
- - `seq/common.py`: plateau early-stop + generous warmup + frozen eval set + `steps_to_plateau` — **done, verified** (smoke OK).
84
- - `seq/delta.py`: value-dim-aware init (rectangular state) + rectangular self-test — **done, verified** (ALL OK, CPU+MPS).
85
- - `seq/prizma_seq.py`: `feat_map='quad2'` (config, fixed monomial buffers, `_phi`, rectangular state in forward/step/init_state) — **done, verified**: feat_map=quad2 → d_φ=128, params 102,728 (unchanged), step==forward 3.6e-7.
86
- - `cap_probe.py`: decisive D∈{64,128} capacity validation under the fair protocol — **running**.
87
- - TODO: `run_bar.py` full protocol patch (two-stage LR, rung4 D=128, gapped rung, checkpointing, FLOP ledger, B5/B6 fixes) → full matrix; then adversarial referee panel.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d128_sweep.py DELETED
@@ -1,72 +0,0 @@
1
- """The locked target: MQAR D=128 parity, under the SAME fair protocol that gave D=64 parity
2
- (mixed-D training, gen-warm lr=1e-3/warmup=2000, large cap + plateau-stop, eval@fixed D=128).
3
-
4
- Runs (order = most informative first; resumable via incremental JSON):
5
- 1. Transformer -> the strong baseline (does it solve D=128?); needs the largest budget
6
- 2. Prizma-quad2-256 -> lever #1 at key-rank 256 (d_phi=256, +0 params, O(1)); the hero arm
7
- 3. Prizma-none -> ablation/capacity-ceiling control (D*~32, expected to fail D=128 clearly)
8
-
9
- This is the run where the quad2 lever's capacity benefit should become decisive (none's fixed-state
10
- ceiling bites hard at D=128). Seed 0 = directional; the multi-seed run_bar matrix follows.
11
-
12
- Run: python3.13 d128_sweep.py
13
- """
14
- from __future__ import annotations
15
-
16
- import json
17
- import os
18
- import time
19
-
20
- from seq.common import TrainConfig, train_model, param_count, get_device
21
- from seq.tasks import MixedMQAR
22
- from seq.transformer import Transformer, TFConfig
23
- from seq.prizma_seq import PrizmaSeqLM, PrizmaSeqConfig
24
-
25
- DEV = get_device()
26
- RES = os.path.join(os.path.dirname(__file__), "results")
27
- OUT = os.path.join(RES, "d128_sweep.json")
28
- TARGET = 128
29
- V = max(64, 4 * TARGET) # 512
30
- GENWARM = dict(lr=1e-3, warmup=2000, warmup_frac=0.0, min_lr_frac=0.1)
31
-
32
-
33
- def tf(T):
34
- return Transformer(TFConfig(vocab=V, d_model=64, n_layers=2, n_heads=2, max_len=T + 8, rope=True))
35
-
36
-
37
- def ps_quad256(T):
38
- return PrizmaSeqLM(PrizmaSeqConfig(vocab=V, d_model=64, n_layers=2, n_heads=2, max_len=T + 8,
39
- feat_map="quad2", feat_n2=224)) # d_phi = 256
40
-
41
-
42
- def ps_none(T):
43
- return PrizmaSeqLM(PrizmaSeqConfig(vocab=V, d_model=64, n_layers=2, n_heads=2, max_len=T + 8))
44
-
45
-
46
- PLAN = [("Transformer", tf, 60000), ("Prizma-quad2-256", ps_quad256, 40000), ("Prizma-none", ps_none, 40000)]
47
-
48
-
49
- def main():
50
- task = MixedMQAR(vocab=V, max_pairs=TARGET, num_queries=128, gap=0, min_pairs=1)
51
- T = task.seq_len
52
- res = json.load(open(OUT)) if os.path.exists(OUT) else {}
53
- print(f"device={DEV} {task.name} eval@D={TARGET} seq={T} protocol=gen-warm", flush=True)
54
- for name, make, cap in PLAN:
55
- if name in res and "best" in res[name]:
56
- print(f" {name}: (cached best={res[name]['best']:.3f})", flush=True)
57
- continue
58
- m = make(T)
59
- p = param_count(m)
60
- cfg = TrainConfig(steps=cap, batch_size=64, log=True, eval_every=3000, **GENWARM)
61
- t0 = time.time()
62
- r = train_model(m, task, cfg, DEV, seed=0)
63
- res[name] = {"best": r.best_acc, "plateau": r.steps_to_plateau, "params": p, "cap": cap,
64
- "sec": round(time.time() - t0, 1)}
65
- json.dump(res, open(OUT, "w"), indent=2)
66
- print(f">>> {name:<16} best@D{TARGET}={r.best_acc:.3f} plateau@{r.steps_to_plateau} "
67
- f"({res[name]['sec']}s, {p}p)", flush=True)
68
- print(f"\nsaved -> {OUT}", flush=True)
69
-
70
-
71
- if __name__ == "__main__":
72
- main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/HANDOFF.md DELETED
@@ -1,155 +0,0 @@
1
- # Prizma-Seq → Transformer-Alternative — SESSION HANDOFF
2
-
3
- > **Read this first, then `committee/round1_synthesis.md` and `docs/TRANSFORMER_ALTERNATIVE_BRIEF.md`.**
4
- > A fresh session can resume from this file alone. Date of handoff: 2026-06-04.
5
-
6
- ---
7
-
8
- ## 0. TL;DR — where we are
9
- - **Goal (locked by owner):** push Prizma-Seq to be a *credible Transformer alternative*, proven on the
10
- field-standard attention-diagnostic bar, with the **most aggressive** target: genuinely **solve MQAR
11
- D=128** at a scale where the Transformer is a strong baseline. Big architectural changes allowed,
12
- multi-session compute OK. **Non-negotiables:** no faked metrics; param/FLOP-matched, non-strawman
13
- Transformer; preserve a **measured O(1)/constant-memory inference** advantage.
14
- - **Scientific core WORKS:** a **parameter-free quadratic feature map** (`feat_map="quad2"`) makes the
15
- Gated-DeltaNet carried state *rectangular* (`S ∈ R^{d_h×d_φ}`), raising associative-recall key-rank
16
- at **zero added params** with **O(1) inference intact** (verified step==forward <1e-6).
17
- - **Seed-0 directional results (matched params, mixed-D training, fair protocol):**
18
- - **D=64:** Transformer **1.000**, Prizma-quad2 **1.000**, Prizma-none 0.931 → *parity*.
19
- - **D=128:** tiny matched TF **0.016** (can't learn at this scale), Prizma-quad2-256 **0.999**,
20
- Prizma-none 0.369. + flip-test confirms tiny TF stays flat even at constant high LR / 120k steps.
21
- - **Committee R2 (adversarial) verdict = `NEEDS-EXPERIMENTS-FIRST`.** The D=128 claim is NOT yet
22
- publishable. Two serious gaps: (1) *optimization-vs-capacity* — must show a **bigger** TF DOES solve
23
- D=128 (so the matched-tiny failure is "under-capacity at this size", not "attention can't"); + multi-seed.
24
- (2) **FLOP gap undisclosed** — Prizma-quad2-256 = **2.1–2.7× TF FLOPs/token** (rectangular state =
25
- buffers, 0 params but ~5.5× delta-FLOP). Need FLOP ledger + a FLOP-matched TF arm.
26
- - **NEXT: run `gpu_bench.py` on a CUDA GPU (Colab)** — it does all the rigor (scale search, ≥5-seed
27
- matched + FLOP-matched head-to-head, D-frontier, ablations incl. `rand_linear` control, O(1)
28
- latency/memory). The notebook `PRIZMA_D128_GPU.ipynb` is built & ready. Then update the report and run
29
- the final adversarial referee panel.
30
-
31
- ## 1. Honest claim wording (committee-vetted; do NOT exceed this until experiments land)
32
- > "At matched ~130K params (2-layer, d=64), under a single fair protocol and seed 0, a parameter-free
33
- > quadratic feature map making a Gated-DeltaNet's carried state rectangular (d_φ=256) **solved MQAR
34
- > D=128 (0.999) where the param-matched, under-capacity tiny Transformer did not (0.016 in this run)**,
35
- > while preserving an O(1)-in-sequence-length constant-memory inference advantage. Small-scale,
36
- > single-seed, directional; borrows the Based/Hedgehog feature-map family (novelty = the
37
- > **rectangular-delta-state framing**, not the kernel); it does **NOT** show attention cannot do recall
38
- > — confirming that needs the bigger-TF D=128 control + ≥3–5 seeds with CIs + a FLOP-matched comparison."
39
-
40
- ## 2. Environment & how to run
41
- - **Local (Mac):** use system Python `/Library/Frameworks/Python.framework/Versions/3.13/bin/python3.13`
42
- (torch 2.12 + MPS). The project `.venv` LOST torch — do NOT use it. Always run with
43
- `PYTHONPATH=/Users/nazmi/Desktop/Projeler/proje/Prizma`. Prizma is ~4–5× slower than the TF per step on MPS.
44
- - **GPU (Colab):** owner has credits for hours of A100/L4. The benchmark targets CUDA via `gpu_bench.py`.
45
- - **Browser/Colab automation:** `chrome-devtools` and `playwright` MCPs both launch an *isolated*
46
- automation browser → **Google blocks login** ("browser may not be secure"). To drive Colab you need
47
- the **"Claude for Chrome" extension** connected to the session (drives the user's real, logged-in
48
- Chrome) — NOT available in the session that wrote this handoff. Otherwise the **owner runs the
49
- notebook** (one upload + Run all) and we read results back from Drive.
50
- - **Google Drive MCP works** (`mcp__claude_ai_Google_Drive__*`): can list/search/create files and
51
- read back results. The owner's "Colab Notebooks" Drive folder id = `1EuDxroP_fyv8wzsiXb3FRCYjahq5Oe6j`.
52
-
53
- ## 3. Architecture (`seq/`)
54
- - **`prizma_seq.py`** — Prizma-Seq = Gated-DeltaNet-family mixer: per-head carried state `S` (precision-gated
55
- delta rule, L2 keys), read `o = S·q` (pre-write), + short causal depthwise conv (k=4) + small exact
56
- local-window attention head (w=16). RoPE OFF on delta keys. **Lever:** `feat_map ∈ {none, quad2,
57
- rand_linear}`, `feat_n2` (d_φ = d_h + feat_n2). `quad2` = fixed random quadratic monomials (seeded
58
- BUFFERS → 0 params) → rectangular state. `rand_linear` = fixed random linear map d_h→d_φ (CONTROL:
59
- rank≤d_h → expected NO gain; proves the monomials are causal). Exact O(1) `step()` path
60
- (verified ==forward <1e-6 for none/quad2/rand_linear, all params identical).
61
- - **`delta.py`** — chunked WY/UT delta kernel; made **value-dim-aware** so the state can be rectangular
62
- `S∈R^{d_v×d_k}` (byte-identical when d_v==d_k). Self-test (`python -m seq.delta`) covers square +
63
- rectangular cases, CPU+MPS, `ALL OK`.
64
- - **`transformer.py`** — clean Llama-style decoder baseline (causal SDPA, RoPE, RMSNorm, SwiGLU, tied
65
- head); **verified non-strawman**. KV-cached O(t) decode.
66
- - **`tasks.py`** — `MQAR` (Zoology-standard, disjoint key/value ranges, dense queries) and **`MixedMQAR`**
67
- (samples #pairs ~U[1,max] per batch → high-D becomes learnable; eval fixed at target D). This mixed-D
68
- training is REQUIRED: fixed-high-D training stalls at chance for both architectures.
69
- - **`common.py`** — the **fair protocol**: `MixedMQAR` + `train_model` with (a) **frozen reproducible eval
70
- set** (eval_seed, same batches for all models/LRs/seeds), (b) **relative per-model PLATEAU early-stop**
71
- with an **engagement floor=0.5** (don't cut a model off during MQAR's flat pre-transition), (c)
72
- generous warmup. `TrainConfig` fields: lr, warmup, warmup_frac, cosine, min_lr_frac, plateau_delta,
73
- plateau_floor, min_steps, early_stop_patience, eval_seed, eval_batches.
74
-
75
- ## 4. The fair protocol — hard-won lessons (do NOT regress)
76
- 1. **Train each model to its own PLATEAU** (large cap + plateau-stop). Under-budgeting was the #1
77
- false-fail (the TF's MQAR transition is late+sharp; D=64 ignites ~step 8k).
78
- 2. **Per-model optimizer tuning** (LR *and* warmup): the TF needs **gen-warm** (lr=1e-3, warmup=2000);
79
- short "punchy" warmup destabilizes it (loss oscillates 0.8↔4.5). Prizma is robust to both. "Identical
80
- protocol" = same task/budget/eval/plateau-rule; NOT identical optimizer constants.
81
- 3. **Mixed-D training** (MixedMQAR) is mandatory for high-D learnability.
82
- 4. **Engagement floor on early-stop** (don't stop a model that's still at chance pre-transition).
83
- 5. **≥5 seeds + solve-rate + CI** for decisive rungs (both models are seed-bimodal on MQAR).
84
- 6. **Measured FLOP ledger** in every result (param-match ≠ FLOP-match).
85
-
86
- ## 5. Results so far (all SEED 0, directional; files in `results/`)
87
- - `parity_d64.json`: D=64 gen-warm — Transformer 1.000, **Prizma-quad2 0.99951**, Prizma-none 0.931.
88
- - `d128_sweep.json`: D=128 gen-warm — Transformer **0.016**, **Prizma-quad2-256 0.99947**, Prizma-none 0.369.
89
- - `tf_verify_d128.json` / `.log`: flip-test — matched tiny TF stays flat (~0.016) at D=128 under
90
- constant lr=1e-3 (120k) and lr=2e-3; `big_d128L2H4` arm may still be running.
91
- - `flop_ledger.py` output: Prizma-quad2-256 / TF forward-FLOP ratio = **2.14× (ideal) – 2.67× (as-coded)**;
92
- the as-coded window head is an unoptimized full-T² SDPA (20% — can be banded to ~1%).
93
- - Earlier scans (`tf_frontier`, `scale_frontier`, `mixed_test`, `tf_stabilize`, `tf_long`, `calib_budget`,
94
- `cap_probe`) document the diagnosis path (tiny TF solves D=16/D=64 but not D=128; fixed-D unlearnable).
95
-
96
- ## 6. Committee
97
- - **R1** (`committee/round1_synthesis.md`): fairness audit + recall-capacity theory (matched D*≈24–32;
98
- D=128 needs architectural change) + ranked levers: **#1 quad2 feature map (built)**, #2 decoupled
99
- `d_state` (NOT built), #3 GlobalDeltaMemory (NOT built), #4 bounded global-attention hybrid (last
100
- resort, spends O(1)). + 10 honesty guardrails.
101
- - **R2** (adversarial verify, in the transcript): verdict `needs-experiments-first`. **CLEARED:** no
102
- leakage; eval fair (TF scores 0.016 on the same frozen set quad2 scores 0.999 on); window-head NOT
103
- causal (none has it, plateaus 0.369); quad2 truly param-free; O(1) verified. **GAPS:** optim-vs-capacity
104
- + FLOP disclosure (see §0).
105
-
106
- ## 7. GPU plan — `gpu_bench.py` (CUDA) + `PRIZMA_D128_GPU.ipynb`
107
- `gpu_bench.py` phases (resumable; writes `$PRIZMA_RESULTS/gpu_bench.json` incrementally):
108
- 1. **TF D=128 solving-scale search** {d64L2H2, d128L2H4, d128L4H4, d256L4H8} × lr × seeds → find the
109
- smallest TF that SOLVES D=128 (the fair arena + the flip-test).
110
- 2. **Matched + FLOP-comparable head-to-head @ D=128** at that scale, ≥5 seeds → solve-rate + median + CI.
111
- 3. **D-frontier {16,32,64,128,256}** capacity curve.
112
- 4. **Ablations @ D=128:** quad2 vs none vs **rand_linear** control; window on/off.
113
- 5. **Measured O(1) decode latency + memory vs sequence length.**
114
-
115
- `PRIZMA_D128_GPU.ipynb` (at repo root, 91KB, 19 cells, validated) self-contains everything: writes the
116
- verified `seq/*` + `gpu_bench.py` + `flop_ledger.py` via `%%writefile`, mounts Drive, runs kernel
117
- self-tests, the FLOP ledger, then all phases; saves to `Drive/MyDrive/prizma_results/gpu_bench.json` and
118
- prints a `===RESULTS_JSON===` block. Regenerate with `python3.13 build_notebook.py`.
119
-
120
- **To run on Colab:** owner opens it in their logged-in Chrome → File→Upload notebook →
121
- `/Users/nazmi/Desktop/Projeler/proje/Prizma/PRIZMA_D128_GPU.ipynb` → Runtime=A100/L4 → Run all → approve
122
- Drive mount. (If the session has the "Claude for Chrome" extension, the assistant can drive this directly.)
123
-
124
- ## 8. Read results back (assistant, autonomously)
125
- - Poll Drive: `Google_Drive search_files` query `title contains 'gpu_bench' ` (or list the prizma_results
126
- folder), then read it. NOTE `read_file_content` mime support is limited (docs/sheets/pdf/images, not raw
127
- json) — use `download_file_content` if available, else have the owner paste the printed `===RESULTS_JSON===`.
128
-
129
- ## 9. Running jobs at handoff
130
- - **Mac `bm7tyb93q`** (`tf_verify_d128.py`): flip-test still running (constLR2e-3 ~step 42k = 0.016, then
131
- big_d128L2H4 arm). Complementary small-scale data. Safe to let finish or `pkill -f tf_verify_d128.py`.
132
- - An isolated chrome-devtools browser is open at a Google login page (useless; ignore/close).
133
-
134
- ## 10. EXACT NEXT STEPS (prioritized)
135
- 1. **Get the GPU run done** (Colab): drive the browser if "Claude for Chrome" is connected; else confirm
136
- the owner ran the notebook. Read `gpu_bench.json` back from Drive.
137
- 2. **Adjudicate the flip-test from Phase 1:** does a bigger TF SOLVE D=128? If yes → honest framing =
138
- "matched-tiny TF under-capacity; Prizma-quad2 solves at matched params + O(1) + far cheaper than scaling
139
- attention". If even big TFs fail → investigate (task realism) before any claim.
140
- 3. **Phase 2 (≥5-seed matched + FLOP-matched) is the headline.** Report solve-rate + median + 95% CI.
141
- 4. **Update `docs/PRIZMA_SEQ_REPORT.md`** with the real numbers (it still has `_pending_` rows), the FLOP
142
- ledger, the O(1) curve, and the honest claim wording (§1). Add quad2 to the borrowed-vs-new ledger
143
- (Based/Hedgehog kernel family; novelty = rectangular-delta-state framing).
144
- 5. **Final adversarial referee panel** (a committee Workflow) against the §4 bar of the brief.
145
- 6. If quad2 plateaus below target at some D: implement **lever #2 `d_state`** (decouple per-head state
146
- dim from d_model; delta.py already handles it) and/or **#3 GlobalDeltaMemory**; keep #4 hybrid as the
147
- explicit O(1)-trading Pareto variant only if needed.
148
-
149
- ## 11. Honesty guardrails (binding)
150
- Param-match every head-to-head (grow the TF for any paid Prizma arm); ship a measured FLOP+throughput
151
- ledger; disclose the O(1) state-constant growth (d_h·d_φ floats) but note it's constant in n and ≪ the
152
- TF's O(t) KV-cache; keep the step==forward<1e-6 O(1) guard green before reporting any accuracy; multi-seed
153
- + solve-rate; pre-register D* per new arm; verify BOTH sides of any contrast; never say "attention fails"
154
- (say "did not learn under recipe R at this scale"); quad2 novelty = framing not kernel; persist crash-safe
155
- checkpoints. Memory file: `~/.claude/projects/-Users-nazmi/memory/prizma-seq-transformer-alternative.md`.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/PRIZMA_SEQ_REPORT.md CHANGED
@@ -2,7 +2,7 @@
2
 
3
  > Status: **§4 BAR MET (v3 campaign) — pending final adversarial referee gate.** All bar legs filled with real A100 numbers; no faked metrics.
4
  > Every number here is produced by a reproducible script in `seq/` (seeds + CIs). No hand-tuning
5
- > of reported numbers; no faked metrics. The committee revises this until a referee panel agrees
6
  > (or honestly refuses) the claim below.
7
 
8
  ## The claim under test (never to be inflated)
@@ -71,7 +71,7 @@ edge. Scoped honestly below (n=3; MQAR D=128 only; the advantage at this scale i
71
  slower/step). **Net at this scale: +114% FLOPs/token, +55% per-step latency, −96% memory @n=4096 → the
72
  advantage is memory, not speed or compute.** FLOP cost disclosed: Prizma-quad2 = **2.14× the TF's
73
  forward FLOPs/token**.
74
- 4. **Capacity question (committee gap 1) CLOSED honestly.** Attention *does* solve D=128 given enough
75
  size (TF 3/3 at d128L2H4/461K and d256L4H8/3.3M); the tiny-TF failure is under-capacity, **not**
76
  "attention can't". The honest differentiators are param-efficiency + O(1) memory, never "attention fails".
77
 
@@ -132,7 +132,7 @@ clean attention-replacement test.
132
  is what the bar tests. If even the family-level parity fails, no claim stands.
133
 
134
  ---
135
- ## D=128 at scale — closing the committee's two gaps (GPU / A100, `gpu_bench.py`)
136
 
137
  The R2 adversarial verdict (`NEEDS-EXPERIMENTS-FIRST`) left exactly two gaps before any D=128
138
  claim is publishable. This section reports the GPU benchmark that closes them. Protocol is the
@@ -262,7 +262,7 @@ it is seed-fragile at this scale: P1 was 2/3 with a 0.785 failure.)
262
  ring, n-independent) — NOT a runtime allocation measurement. (The pre-registration planned a
263
  `torch.mps`-allocated-bytes probe; the actual A100/CUDA run used the closed-form counts. Decode
264
  **latency**, by contrast, IS measured wall-clock.)
265
- - **Disclosed deviations from the committee spec:** (a) MQAR uses **dense queries** (Q≈96/160/256)
266
  rather than the spec's sparse Q=4/8/16 — dense supervision is the Zoology-standard MQAR and helps
267
  *both* models equally; sequence lengths are 128/224/384. (b) The B1b `d_h=64` arm is a **larger
268
  model** (d=128, ~2.8× params) — labeled an *over-parameter probe*, not a matched comparison; the
 
2
 
3
  > Status: **§4 BAR MET (v3 campaign) — pending final adversarial referee gate.** All bar legs filled with real A100 numbers; no faked metrics.
4
  > Every number here is produced by a reproducible script in `seq/` (seeds + CIs). No hand-tuning
5
+ > of reported numbers; no faked metrics. This is revised until a referee panel agrees
6
  > (or honestly refuses) the claim below.
7
 
8
  ## The claim under test (never to be inflated)
 
71
  slower/step). **Net at this scale: +114% FLOPs/token, +55% per-step latency, −96% memory @n=4096 → the
72
  advantage is memory, not speed or compute.** FLOP cost disclosed: Prizma-quad2 = **2.14× the TF's
73
  forward FLOPs/token**.
74
+ 4. **Capacity question (open question 1) CLOSED honestly.** Attention *does* solve D=128 given enough
75
  size (TF 3/3 at d128L2H4/461K and d256L4H8/3.3M); the tiny-TF failure is under-capacity, **not**
76
  "attention can't". The honest differentiators are param-efficiency + O(1) memory, never "attention fails".
77
 
 
132
  is what the bar tests. If even the family-level parity fails, no claim stands.
133
 
134
  ---
135
+ ## D=128 at scale — closing the two open questions (GPU / A100, `gpu_bench.py`)
136
 
137
  The R2 adversarial verdict (`NEEDS-EXPERIMENTS-FIRST`) left exactly two gaps before any D=128
138
  claim is publishable. This section reports the GPU benchmark that closes them. Protocol is the
 
262
  ring, n-independent) — NOT a runtime allocation measurement. (The pre-registration planned a
263
  `torch.mps`-allocated-bytes probe; the actual A100/CUDA run used the closed-form counts. Decode
264
  **latency**, by contrast, IS measured wall-clock.)
265
+ - **Disclosed deviations from the design spec:** (a) MQAR uses **dense queries** (Q≈96/160/256)
266
  rather than the spec's sparse Q=4/8/16 — dense supervision is the Zoology-standard MQAR and helps
267
  *both* models equally; sequence lengths are 128/224/384. (b) The B1b `d_h=64` arm is a **larger
268
  model** (d=128, ~2.8× params) — labeled an *over-parameter probe*, not a matched comparison; the
docs/PRIZMA_SEQ_SPEC.md CHANGED
@@ -1,8 +1,8 @@
1
  # Prizma-Seq — Implementable Architecture Specification
2
 
3
- **Status:** Committee-agreed build contract. This is the single source of truth the architects implement against. It synthesizes the three candidate designs and the three judge reports into ONE buildable PyTorch/MPS architecture, then states the exact recurrence, the falsifiable bar, the experiment matrix, the causal ablations, and the honest failure section.
4
 
5
- **Winning design (committee verdict):** **single-state Predictive-Coding Gated-DeltaNet** mixer (Designs 2/3 core — confirmed by all three judges as the only variant that fits the minutes-per-run MPS budget and reuses the existing `seq/` harness), built with **Design 3's exact free-energy derivation** as the canonical novelty defense, **L2-normalized keys** (Designs 1/3, for an exact projection erase and crispest recall — NOT Design 2's kernel feature map, which two judges flagged as recall-blurring), and **Design 1's multi-expert precision routing carried as an OPTIONAL later axis only** (the buildability judge measured M=4 at ~34 min/run, which breaks the budget, and identified a chunked-parallel/differentiability hazard in the per-token router). The continual-learning result is a clearly separated secondary axis.
6
 
7
  **The claim we license (verbatim, never inflated):**
8
  > *Prizma-Seq is a credible efficient-attention-replacement candidate at small scale, in the tested regime: parameter- and FLOP-matched against a tuned Transformer it clears the field-standard attention-diagnostic suite, is competitive on a small char-LM within an explicit margin, demonstrates a measured linear/constant-memory inference advantage, and its named mechanism is causally responsible (not "a bigger RNN"). Large-scale LM parity and backprop-free parity are NOT claimed and are stated as open frontiers.*
 
1
  # Prizma-Seq — Implementable Architecture Specification
2
 
3
+ **Status:** Pre-registered build contract. This is the single source of truth the implementation is built against. It synthesizes the three candidate designs and the three referee reports into ONE buildable PyTorch/MPS architecture, then states the exact recurrence, the falsifiable bar, the experiment matrix, the causal ablations, and the honest failure section.
4
 
5
+ **Winning design (design review):** **single-state Predictive-Coding Gated-DeltaNet** mixer (Designs 2/3 core — confirmed by all three referees as the only variant that fits the minutes-per-run MPS budget and reuses the existing `seq/` harness), built with **Design 3's exact free-energy derivation** as the canonical novelty defense, **L2-normalized keys** (Designs 1/3, for an exact projection erase and crispest recall — NOT Design 2's kernel feature map, which two referees flagged as recall-blurring), and **Design 1's multi-expert precision routing carried as an OPTIONAL later axis only** (the buildability referee measured M=4 at ~34 min/run, which breaks the budget, and identified a chunked-parallel/differentiability hazard in the per-token router). The continual-learning result is a clearly separated secondary axis.
6
 
7
  **The claim we license (verbatim, never inflated):**
8
  > *Prizma-Seq is a credible efficient-attention-replacement candidate at small scale, in the tested regime: parameter- and FLOP-matched against a tuned Transformer it clears the field-standard attention-diagnostic suite, is competitive on a small char-LM within an explicit margin, demonstrates a measured linear/constant-memory inference advantage, and its named mechanism is causally responsible (not "a bigger RNN"). Large-scale LM parity and backprop-free parity are NOT claimed and are stated as open frontiers.*
docs/Prizma.md DELETED
@@ -1,374 +0,0 @@
1
- # Prizma — backprop-free, fully-local continual learning
2
-
3
- **Backprop'suz, tam-lokal, predictive-coding tabanlı, nöromorfik-hedefli bir öğrenme mimarisi.**
4
-
5
- > Çekirdek fikir (3 cümle). Prizma, tek bir serbest-enerji fonksiyoneli üzerinde üç zaman
6
- > ölçeğinde gradyan inişi yapan bir *kortikal çalışma-alanı ağıdır*: aktivitelere göre iniş =
7
- > çıkarım, kapılara göre iniş = yönlendirme, ağırlıklara göre iniş = öğrenme. Tüm öğrenme
8
- > kuralları lokaldir (backprop yok, weight transport yok; çıkarımdaki W^T, Feedback Alignment
9
- > ile gevşetilir). Özgün katkı, *aynı precision-ağırlıklı-sürpriz sinyalinin* iki zaman
10
- > ölçeğinde hem dikkat/yönlendirmeyi hem de plastisiteyi (konsolidasyonu) sürmesidir — bu da
11
- > **görev-sınırı ve görev-etiketi gerektirmeyen sürekli öğrenme** verir: EWC'nin çevrimdışı
12
- > Fisher'ını, çevrimiçi ve lokal bir sürpriz-güdümlü önem sinyaliyle değiştirir.
13
-
14
- Bu belge fikri baştan sona sunar, denklemleştirir, **gerçek kodla test eder**, başarısız
15
- denemeleri ve düzeltmeleri kaydeder ve nerede çalışıp nerede çalışmadığını dürüstçe sınırlar.
16
-
17
- ---
18
-
19
- ## 0. Nasıl buraya geldik (akıl yürütme zinciri)
20
-
21
- Mevcut transformer mimarisinde prior + attention + bellek + hesaplama tek bir ağırlık yığınına
22
- bulanır ve sıfırdan, veri-aç biçimde öğrenilir. Beyin hamlesi bu dört işlevi dört organa böler.
23
- Prizma bu bölünmeyi alır ama **A yolunu (backprop + RL-gating) reddeder**; **B yolunu** seçer:
24
- tam-lokal plastisite, predictive-coding çapası, nöromorfik/analog hedef. Asıl nesne forward
25
- pass değil **plastisitedir**; öğrenme ile çıkarım tek bir serbest-enerji fonksiyoneli üzerinde
26
- farklı değişkenlere göre gradyan inişidir.
27
-
28
- Bu mimari ve teorik çerçeve, 6 alan uzmanından oluşan bir tasarım heyeti tarafından
29
- geliştirildi (predictive-coding teorisi, novel mekanizma, nöromorfik donanım, prior-art
30
- farklılaşması, failure-mode analizi, deney protokolü). Heyetin tam raporları
31
- `committee/reports.json` içindedir.
32
-
33
- ---
34
-
35
- ## 1. Kurulu mimari — Kortikal Çalışma-Alanı Ağı
36
-
37
- - **HEAD** — güçlü, yapılandırılmış üretici öncül `p(nedenler)`. Latent'ler referans-çerçeveleri
38
- olarak yaşar (grid-hücre benzeri ilişkisel kodlar). Yavaş/dondurulmuş; few-sample verimliliği
39
- buradan gelir. *(Prototipte: dondurulmuş RBF/karelionel lift — basit ama rolü temsil eder.)*
40
- - **MODÜLLER** (kortikal alanlar) — paralel lokal uzmanlar. Her biri kendi girdi dilimi için
41
- tahmin hatası `ε_m` hesaplar ve **ham aktivasyon değil HATA** akıtır.
42
- - **ÇALIŞMA ALANI** (talamus+PFC) — sabit boyutlu küçük latent dizi `a ∈ R^k`, `k ≪ n`.
43
- Darboğaz hesaplama tasarrufunun kendisidir: maliyet `O(n·k)`, `n`'de lineer.
44
- - **GEÇİT** (bazal gangliyon) — modüller çalışma alanına yazmak için precision-ağırlıklı hata
45
- ("bid") ile yarışır; kazanan(lar) yazar (PBWM).
46
- - **YAYIN** (talamo-kortikal döngü) — güncellenen alan tüm modüllere yukarıdan-aşağı tahmin
47
- olarak geri yayınlanır; bu yayın aynı zamanda efference-copy gibi davranır.
48
-
49
- ---
50
-
51
- ## 2. Tek serbest-enerji fonksiyoneli ve üç güncelleme kuralı
52
-
53
- ### 2.1 Master fonksiyonel `F` (omurga)
54
-
55
- ```
56
- F = Σ_m ½ ε_mᵀ Π_m ε_m + ½ ε_wᵀ Π_w ε_w + ½ ε_aᵀ Π_a ε_a + Σ_m g_m·b_m − λ_H·H(g) + R(θ)
57
- ```
58
-
59
- Hata popülasyonları (hepsi açık, ileriye bakan, lokal okunabilir):
60
- ```
61
- modül hatası: ε_m = x_m − W_m f(z_m) (aşağıdan girdi − modülün kendi tahmini)
62
- modül↔workspace: ε_zm = z_m − U_m a (workspace yayını her modül latent'ini öngörür)
63
- head/prior hatası: ε_a = a − μ_a(c) (workspace latent − yapılandırılmış öncül)
64
- yönlendirme bid'i: b_m = ½ ε_mᵀ Π_m ε_m (precision-ağırlıklı hata = bazal-gangliyon teklifi)
65
- ```
66
- `Π_*` precision (ters-kovaryans) matrisleri; `g_m∈[0,1]` kapı değişkenleri; `H(g)` kapı entropisi
67
- (yük-dengesi, ölü-uzman baskısı, P6); `R(θ)` ağırlık/komplexite öncülü. **F = doğruluk +
68
- komplexite.** Tüm terimler precision-ağırlıklı kare hata + öncül.
69
-
70
- ### 2.2 Çıkarım — aktivitelere göre iniş (hızlı settling)
71
-
72
- ```
73
- τ_z dz_m/dt = −∂F/∂z_m = diag(f'(z_m))·W_mᵀ(Π_m ε_m) − Π_zm(z_m − U_m a) [+ √(2T)·ξ(t)]
74
- τ_a da/dt = −∂F/∂a = Σ_m g_m·U_mᵀ(Π_zm(z_m − U_m a)) − Π_a(a − μ_a(c))
75
- ```
76
- İlk terim `W_mᵀ` içerir — **işte weight transport tam buraya, ÇIKARIM dinamiğine geri gelir**
77
- (açık problem P2). Öğrenme kuralında yoktur; çıkarımda vardır. `√(2T)·ξ` Langevin gürültüsü
78
- MAP settling'i posterior örneklemeye çevirir (P5).
79
-
80
- ### 2.3 Yönlendirme — kapılara göre iniş + sign-tension'ın çözümü
81
-
82
- ```
83
- τ_g dg_m/dt = −∂F/∂g_m ⇒ g_m = softmax_m(−b_m/temp + λ_H(−log g_m − 1))
84
- ```
85
- **Kritik çözüm (heyet konsensüsü).** "Tek skaler kapı hem dikkati hem plastisiteyi sürer"
86
- iddiası, yanlış işaretle çelişkilidir: saf PC'de `dw ∝ Π·ε·r` olduğundan *güvenilir/ustalaşmış*
87
- bir kanal **daha hızlı** öğrenir — konsolidasyonun tam tersi. Çözüm: tek skaler çarpan değil,
88
- **tek SÜRÜCÜ (sürpriz/hata-enerjisi `E_m`), iki zıt-işaretli okunuş**:
89
- ```
90
- dikkat/çıkarım kazancı: Π_m = π(E_m), dπ/dE < 0 (ustalaşınca precision YÜKSELİR — kullan)
91
- plastisite/öğrenme hızı: β_m = β(E_m), dβ/dE > 0 (ustalaşınca β → taban — DONDUR)
92
- ```
93
- Naive PC kimliği `dw∝Π·ε·r` konsolidasyon için açıkça **REDDEDİLİR**: plastisite `E_m`'i
94
- (sürprizi) okur, `Π_m`'i değil.
95
-
96
- ### 2.4 Öğrenme — ağırlıklara göre iniş (yavaş, LOKAL, W^T yok)
97
-
98
- ```
99
- dW_m/dt = η · β_m · NM · [ (Π_m ε_m) ⊗ f(z_m) ] ⊙ Tr_m
100
- ```
101
- Dört lokal faktör: `NM` (küresel nöromodülatör skaleri = eylem-sonucu hatasının yayını),
102
- `β_m` (metaplastik kapı), `(Π_m ε_m)` (post-sinaptik hata nöronu), `f(z_m)` (pre-sinaptik
103
- aktivite), `Tr_m` (eligibility trace, `dTr/dt = −Tr/τ_e + f(z_m)ε_m`). Bu **idealize PC ağırlık
104
- kuralı**dır ve `dW=(Πε)⊗r`'nin analitik gradyana eşitliği heyet teorisyenince `5e-10` hata ile
105
- sonlu-fark'a karşı doğrulanmıştır (öğrenme kuralında W^T yoktur). *Not (dürüstlük): prototipin
106
- encoder'ı bu idealize kuralın DFA yaklaşımıdır — sabit-rastgele feedback kullanır, yani
107
- prototip **her zaman** W^T-free'dir; FD-doğrulaması idealize kural içindir, prototipin DFA
108
- encoder'ı için değil.*
109
-
110
- ### 2.5 P2 gevşetmesi — ayrı feedback `Q_m` (Feedback Alignment)
111
-
112
- Çıkarımdaki `W_mᵀ`, ayrı bir feedback matrisi `Q_m` ile değiştirilir:
113
- ```
114
- τ_z dz_m/dt = diag(f'(z_m))·Q_m(Π_m ε_m) − Π_zm(z_m − U_m a)
115
- lokal eğitim: dQ_m/dt = η_Q·[(z_m − Q_m(Π_m ε_m)) ⊗ (Π_m ε_m)] (veya sabit-rastgele Q, DFA)
116
- ```
117
- **Dürüstlük:** P2 *çözülmedi*, sadece gevşetildi. Deneyde sabit-rastgele feedback (DFA) ile
118
- sonuçların değişmediğini gösteriyoruz (E4) — bu rejimde W^T'ye ihtiyaç yok.
119
-
120
- ---
121
-
122
- ## 3. Özgün mekanizma — PGM (Precision-Gated Metaplasticity) ve görev-sınırsız sürekli öğrenme
123
-
124
- İki **eşleşik durum, tek fonksiyonel kapı**:
125
- - **Hızlı bid** `b_m = π_m·‖ε_m‖²` — dikkati + plastisite penceresini açar (yönlendirme).
126
- - **Yavaş konsolidasyon** `ω_m` — sürekli düşük hatayla artar, etkin öğrenme hızını
127
- `α = α₀/(1+ω_m)` ile çarpımsal küçültür (Bayesçi-sinaps / metaplastisite).
128
-
129
- ```
130
- plastisite penceresi: window(b_m) = σ(β(b_m − θ_m)) (yalnızca sürprizde öğren)
131
- etkin öğrenme hızı: α_m = α₀ · window(b_m) · 1/(1+ω_m)
132
- yük-dengesi: θ_m ← θ_m + η_b(usage_m − target) (ölü-uzman / rich-get-richer fix)
133
- reawakening: ω_m ← ω_m − κ·relu(çelişki) (occupied-expert fix)
134
- ```
135
-
136
- **Görev-sınırsız sürekli öğrenme neden ortaya çıkar (mekanik):** Bir modül kendi girdi
137
- domain'ini ustalaştığında düşük hata üretir → düşük bid → yarışmayı kaybeder → `ω→yüksek` →
138
- donar (konsolide). Yeni domain yüksek hata → taze modül kazanır → öğrenir. **Görev etiketi,
139
- Fisher matrisi, replay YOK.** Yönlendirme ve konsolidasyon olaylarının zamanlaması, modelin
140
- kendi sürpriz dinamiğinden (precision testi) okunur — dışsal görev-sınırı sinyali kullanılmaz.
141
-
142
- ---
143
-
144
- ## 4. Ödünç vs Yeni — dürüst defter
145
-
146
- | Bileşen | Kaynak | Durum |
147
- |---|---|---|
148
- | Açık hata-nöronu + serbest-enerji | Rao-Ballard, Bogacz 2017, Friston | **ödünç** |
149
- | Lokal ağırlık kuralı `dw∝(Πε)⊗r` (no W^T in learning) | standart PC | **ödünç** |
150
- | Çıkarımdaki W^T'yi rastgele/öğrenilen feedback ile gevşetme | Feedback Alignment (Lillicrap, Nøkland 2016) | **ödünç** |
151
- | Üç/dört-faktörlü Hebbian + eligibility | Frémaux & Gerstner 2016 | **ödünç** |
152
- | Bazal-gangliyon write-gating, küçük workspace | PBWM (O'Reilly & Frank), Goyal & Bengio | **ödünç** |
153
- | Langevin/stokastik settling = posterior örnekleme | Buesing 2011, Aitchison & Lengyel | **ödünç** |
154
- | LR ∝ ağırlık-posterior-varyansı (metaplastisite) | Aitchison vd.; Fusi/Benna-Fusi | **ödünç** |
155
- | ART-tarzı vigilance-recruitment (yeni domain → taze uzman) | Carpenter & Grossberg (ART) | **ödünç** |
156
- | **Sign-tension'ın çözümü**: tek sürpriz-enerji `E_m`, iki zıt-işaretli okunuş (π↑, β↓) | — | **YENİ sentez** |
157
- | **Precision-testli, görev-sınırsız faz-dedektörü**: konsolidasyon zamanlamasını aktif uzmanın kendi `(μ,σ)` precision'ından okuma | — | **YENİ mekanizma** |
158
- | **EWC'nin çevrimdışı Fisher önemini → çevrimiçi/lokal/denetimsiz recognition-sürpriz önemiyle değiştirme** | — | **YENİ konumlandırma** |
159
-
160
- Özgünlük dürüstçe: parçalar ödünç, **sentez + iki mekanizma yeni**. Buzzword birleştirmesi
161
- değil — her parça çalışan kodda test edildi.
162
-
163
- ---
164
-
165
- ## 5. Nöromorfik/analog uyum (heyet donanım raporu özeti)
166
-
167
- | İşlem | Fizik | Neden lokal/düşük-güç |
168
- |---|---|---|
169
- | Tahmin (MVM) | RRAM/memristor crossbar (Ohm+Kirchhoff) | O(1) fiziksel zaman, off-chip ağırlık taşıması yok |
170
- | Hata nöronu | analog diferansiyel çift (akım çıkarma) | paylaşılan düğümde yerel |
171
- | Kapı `g_m` | **tek tile bias (referans iletkenlik/voltaj)** | *aynı* bias hem okuma-kazancını (dikkat) hem yazma-penceresini (plastisite) ölçekler — precision=plastisite'nin fiziksel gömülmesi |
172
- | Yarışma | akım-modlu winner-take-all | yerel |
173
- | Ağırlık güncelleme | üç/dört-faktörlü iletkenlik değişimi | crossbar'a doğal outer-product |
174
- | Langevin gürültüsü | **intrinsik cihaz gürültüsü (RTN/termal)** | donanım "kusuru" = bedava posterior örnekleyici; `T_eff ∝ okuma-voltajı` |
175
-
176
- Dürüst sınırlar: gerçek RTN beyaz-Gauss değil (Lorentzian/1/f) → "gürültü=örnekleyici" idealize;
177
- RRAM endurance (~1e6–1e9 yazma); cihaz değişkenliği MVM'yi bozar; eligibility trace per-cell
178
- kapasitör pahalı; workspace+WTA+NM için dijital/Loihi-sınıfı destek gerekir (hibrit tasarım).
179
-
180
- ---
181
-
182
- ## 6. Deney — falsifiability gate
183
-
184
- ### 6.1 Önce bir benchmark-geçerlilik bulgusu (dürüstlük)
185
-
186
- Heyetin önerdiği **rotating-checkerboard** (tüm görevler aynı girdi kutusu, farklı etiket)
187
- benchmark'ını ölçtüğümüzde **geçersiz** olduğunu bulduk: aynı `x` için görevler arası ortalama
188
- etiket örtüşmesi ≈0.56 (uyuşmazlık ≈0.44; K=3) — yani **tek-başlı bir model aynı girdiye
189
- görev-kimliği olmadan farklı cevap veremeyeceği için düşük-unutma MATEMATİKSEL OLARAK İMKÂNSIZ**
190
- (oracle tek-çıkış tavanı = 0.78; hakemce bağımsız doğrulandı: 0.7808). Bu rejimde hiçbir method kazanamaz; bunu E5 kontrolünde teyit ediyoruz.
191
-
192
- Prizma'in mekanizması (recognition-by-reconstruction) **girdi-ayırt-edilebilir
193
- (domain-incremental)** rejimde anlamlıdır. Bu yüzden geçerli benchmark:
194
-
195
- ### 6.2 Benchmark — Structured-Permuted (domain-incremental, ayırt-edilebilir)
196
-
197
- Korelasyonlu taban: `v = latent·Aᵀ`, `latent~N(0,I_k)`, `cov(v)=AAᵀ≠I`. Etiket latent'in
198
- paylaşılan teacher'ı. Görev `t`: özellik permütasyonu `π_t` → `cov(x_t)=P_t(AAᵀ)P_tᵀ` her
199
- domain'de farklı → autoencoder domain'i girdiden tanıyabilir (kanıt: per-domain PCA recon
200
- kendi=0.00 vs diğer=0.64). Naive sıralı eğitim yine unutur (permuted-MNIST mantığı).
201
-
202
- ### 6.3 Substrat ve baseline'lar (aynı zeminde, adil)
203
-
204
- Öğreniciler, karşılaştırılabilir parametre:
205
- - **backprop MLP** — tek başlı, sıralı (naive baseline).
206
- - **EWC** — backprop + Fisher; **görev-sınırı kullanır** (ayrıcalıklı rakip; λ kendi FGT'sini
207
- minimize edecek şekilde tune edildi; λ≥100'de numerik taşma olur, tuner λ=50'de kalır).
208
- - **replay** — backprop + reservoir buffer (görev verisini saklar; standart rehearsal).
209
- - **oracle_multihead** — K bağımsız sınıflandırıcı, test'te **gerçek görev-kimliği VERİLİR.**
210
- Bu, Prizma'in görev-kimliği *verilmeden* (reconstruction sürprizinden çıkararak) eşitlemeye
211
- çalıştığı **dürüst üst-sınırdır.**
212
- - **Prizma (DFA, no W^T)** — ART-routing + PGM konsolidasyon; encoder sabit-rastgele feedback
213
- (Feedback Alignment) → **hiçbir yerde W^T yok**; **görev-etiketi/sınırı YOK.** *(Headline.)*
214
- - **Prizma (exact W^T)** — aynı, ama encoder gerçek `Wᵀ` okur → constraint-2'yi ihlal eder;
215
- yalnızca no-transport gevşetmesinin maliyetini ölçmek için. *(Dürüst bulgu: DFA bundan daha
216
- iyi performans verir — weight transport gereksiz, hatta zararlı.)*
217
- - **PRIZMA_noRoute** — routing/faz-dedektörü kapalı, tek monolitik uzman (nedensel ablation).
218
-
219
- Prizma lokal: decoder/head tam-lokal PC/delta kuralı (`(P−Y)⊗z`, `ε⊗z`); encoder Feedback-Alignment.
220
-
221
- ### 6.4 Metrikler ve başarı kriteri (falsifiable)
222
-
223
- `acc[i,j]` = görev `i` bitince görev `j` test doğruluğu. `ACC=mean_j acc[K-1,j]`;
224
- `FGT=mean_{j<K-1}(max_i acc[i,j] − acc[K-1,j])`. **BAŞARI** (≥10 seed, non-overlapping %95 GA):
225
- `FGT_Prizma ≤ FGT_EWC`, `FGT_Prizma ≤ 0.6·FGT_naive`, `ACC_Prizma ≥ 0.92·ACC_naive`,
226
- `FGT_Prizma < FGT_vanilla`, ablation gate'in nedensel olması, Prizma kodunda hiçbir görev-sınırı.
227
-
228
- ### 6.5 SONUÇLAR
229
-
230
- **E1 — Ana karşılaştırma (structured-permuted, K=5, 10 seed, %95 GA):**
231
-
232
- | Learner | ACC | FGT (unutma↓) | Görev-sınırı? | Bellek? | W^T? |
233
- |---|---|---|---|---|---|
234
- | backprop MLP | 0.445 ± 0.025 | 0.553 ± 0.026 | — | — | — |
235
- | EWC (λ=50, tuned) | 0.456 ± 0.019 | 0.411 ± 0.020 | **kullanır** | — | — |
236
- | replay (buffer 1000) | 0.737 ± 0.011 | 0.156 ± 0.009 | **kullanır** | **kullanır** | — |
237
- | **oracle_multihead** *(üst-sınır)* | **0.879 ± 0.011** | 0.000 | **görev-kimliği VERİLİR** | — | — |
238
- | **Prizma (DFA, no W^T)** | **0.834 ± 0.015** | **0.000 ± 0.000** | **YOK** | **YOK** | **YOK** |
239
- | Prizma (exact W^T) | 0.708 ± 0.021 | 0.000 | YOK | YOK | kullanır |
240
- | PRIZMA_noRoute *(ablation)* | 0.446 ± 0.024 | 0.489 ± 0.023 | — | — | — |
241
-
242
- Param: backprop/EWC = 20,744; Prizma (eğitilebilir, etkin ~13,840 — yalnız 5 uzman eğitilir;
243
- sabit FA matrisleri sayılmaz) ≤ MLP. **Prizma kapasiteyle kazanmaz** (hakem doğruladı: backprop
244
- 1.08M parametreyle bile FGT≈0.55–0.57; Prizma 4,720 parametreyle bile FGT=0).
245
-
246
- Okunuş: Prizma (DFA, 0.834) **replay (0.737) ile oracle (0.879) ARASINDADIR** — oracle'ın
247
- sıfır-unutmasını eşitler, doğruluğuna yaklaşır; ama görev-kimliği *verilmeden*, replay'siz,
248
- görev-sınırsız, **W^T'siz**. Görev-sınırı+bellek kullanan replay bile FGT=0.156'da kalır. Tüm
249
- S1–S6 kriterleri non-overlapping GA ile sağlanır.
250
-
251
- **No-weight-transport dürüst bulgusu:** `feedback="exact"` (encoder gerçek Wᵀ okur) versiyonu
252
- 0.708 verir — **DFA (no W^T) versiyonundan (0.834) DAHA KÖTÜ.** Yani weight transport gereksiz,
253
- hatta zararlı; Prizma'in biyolojik/nöromorfik sadakat iddiası güçlenir.
254
-
255
- **Nedensellik (ablation):** Recognition-routing'i kapatmak (`noRoute`) → FGT 0.000 → **0.489**
256
- (backprop seviyesine döner). **Kazanım modüler sürpriz-routing'den gelir.** Dürüst nüans (hakem):
257
- sıralı-temiz akışta açık dondurma gereksizdir (routing eski uzmanları zaten yeniden-eğitmez);
258
- mekanizmanın özü routing + precision faz-dedektörüdür. Ayrıca FGT=0, ön-koşullar sağlanınca
259
- mimari olarak garantilidir — *asıl başarı, onu mümkün kılan denetimsiz/lokal kusursuz routing'dir.*
260
-
261
- **E2 — Ayrışabilirlik sweep'i (gürültü domain'leri bulanıklaştırır; 5 seed):**
262
-
263
- | noise | Prizma ACC | Prizma FGT | backprop ACC | backprop FGT |
264
- |---|---|---|---|---|
265
- | 0.0 | 0.827 | 0.000 | 0.433 | 0.562 |
266
- | 0.3 | 0.721 | 0.016 | 0.299 | 0.608 |
267
- | 0.6 | 0.557 | 0.052 | 0.261 | 0.508 |
268
- | 0.9 | 0.430 | 0.073 | 0.239 | 0.421 |
269
- | 1.2 | 0.344 | 0.077 | 0.222 | 0.350 |
270
-
271
- Precision-adaptif recognition sayesinde routing her gürültü seviyesinde **temiz tek-uzman-per-
272
- domain** kalır (5 uzman commit); FGT düşük kalır. ACC düşüşü routing çöküşünden değil, gürültünün
273
- sınıflandırma görevini zorlaştırmasındandır (zarif degradation). Prizma her seviyede backprop'u
274
- geçer.
275
-
276
- **E3 — Kapasite (uzman sayısı vs K=5 domain; 5 seed):** experts=3→ACC 0.556, 4→0.692, ≥5→0.827;
277
- hepsinde FGT=0.000. Uzman < domain ise yeni domain'ler öğrenilemez (ACC düşer) ama **eskiler
278
- unutulmaz** — zarif kapasite davranışı.
279
-
280
- **E4 — Lokalite/P2 (W^T var mı yok mu):** `feedback=random` (saf DFA, W^T yok) → ACC **0.827** /
281
- FGT 0.000; `feedback=exact` (encoder gerçek Wᵀ okur) → ACC **0.691** / FGT 0.000. İkisi de sıfır
282
- unutur ama **DFA daha iyi doğruluk verir** → bu rejimde weight transport gereksiz, hatta zararlı.
283
- P2 gevşetmesi yalnızca "yeterli" değil, tercih edilen.
284
-
285
- **E5 — İmkânsız-rejim kontrolü (rotating-checkerboard, ambiguous):** Tek-çıkış oracle tavanı 0.780.
286
- Prizma ACC 0.570, backprop 0.694 — **Prizma tavanı AŞMAZ** (hatta backprop'un altında). Yani Prizma
287
- ayırt-edilemez rejimde yardım etmez ve etmediğini dürüstçe gösterir → sınırı anladığımızın kanıtı.
288
-
289
- Tüm sayılar `results/results.json` ve `results/console.txt` içinde; tek komutla yeniden üretilir.
290
-
291
- ---
292
-
293
- ## 7. İterasyon günlüğü (geliştir → test → başarısızsa tekrar dene)
294
-
295
- Kullanıcının istediği "fikri geliştir, test et, olmazsa tekrar dene" döngüsünün gerçek kaydı:
296
-
297
- 1. **v0 — paylaşılan-toplamsal readout (learners.py).** İki mod da çöktü: `taskfree` zar zor
298
- backprop'u geçti (spurious consolidation + rich-get-richer), `boundary` over-froze (task0
299
- sonrası tüm gruplar dondu). **Bulgu:** kapasite rezerve edilmiyor.
300
- 2. **Benchmark-geçerlilik krizi.** Rotating-checkerboard'ın tek-başlı CL için imkânsız olduğunu
301
- ölçtük (etiket örtüşmesi ≈0.53). → domain-incremental rejime geçtik.
302
- 3. **Permuted-iid-Gaussian de ayırt-edilemez** çıktı (iid permütasyon dağılımı değiştirmez).
303
- → korelasyonlu **structured-permuted** benchmark.
304
- 4. **v1 — soft-responsibility MoE.** Uniform çöktü (tüm uzmanlar ~1/M kullanılıp underfit dondu;
305
- düşük FGT *yanlış sebepten* = collapsed expert).
306
- 5. **v2 — ART hard-routing.** Forced-commit cascade (underfit erken commit → tüm uzmanlar tek
307
- domain'e harcandı). Forced-commit kaldırıldı; sonra per-sample vigilance thrashing.
308
- → batch-seviyesi novelty.
309
- 6. **v3 — batch-novelty + faz-dedektörü → ATILIM:** FGT=0.000, ACC=0.80, temiz tek-uzman-per-
310
- domain. Ama **E2 kırılganlık:** noise=0.3'te keskin çöküş (sabit vigilance hatası).
311
- 7. **v4 — precision-adaptif aktif-uzman faz-dedektörü.** Her uzman kendi recon precision'ını
312
- `(μ,σ)` izler; novelty = `recon > μ+zσ`; aktif uzman domain'i tüm görev boyunca öğrenir,
313
- domain değişip artık tanımayınca commit+freeze. **Sonuç: gürültüye sağlam graceful
314
- degradation; routing her seviyede temiz kalır.**
315
- 8. **Adversaryal hakem turu (4 paralel denetçi: leakage/cheating, fairness, bağımsız
316
- reprodüksiyon, overclaim).** Hepsi `claim_supported=true` döndü (1 SOUND + 3 MINOR_ISSUES;
317
- hiç REFUTED/SERIOUS yok). Düzeltilen gerçek bulgular: **(a)** `feedback` parametresi
318
- okunmuyordu → düzeltildi; meğer prototip *her zaman* W^T-free'ymiş — ve düzeltince
319
- no-W^T (DFA) versiyonunun W^T versiyonundan **daha iyi** olduğu ortaya çıktı (0.834 > 0.708).
320
- **(b)** oracle-multihead ve replay baseline'ları eklendi (dürüst üst-sınır + güçlü rakip).
321
- **(c)** Framing dürüstleştirildi: "FGT=0 ön-koşullar sağlanınca mimari garanti; asıl başarı
322
- denetimsiz/lokal kusursuz routing"; "domain'ler bitişik blok gelmeli (interleaved'da ~0.58'e
323
- çöker)"; param muhasebesi, EWC numerik kırılganlığı, FD-atıf düzeltmeleri.
324
-
325
- ---
326
-
327
- ## 8. Dürüst değerlendirme — nerede çalışır, nerede kırılır
328
-
329
- **Çalışır (kanıtlı):** Girdi-ayırt-edilebilir domain-incremental akışta, görev-etiketi/sınırı
330
- olmadan, tam-lokal (DFA dahil) öğrenmeyle **sıfıra yakın unutma** + naive backprop ve (görev-
331
- sınırı kullanan) EWC'yi geçen doğruluk. Ablation konsolidasyonun nedensel olduğunu gösterir.
332
-
333
- **Çözülmeyen / sınırlar (dürüstçe — adversaryal hakem heyetince doğrulandı):**
334
- - **FGT=0 bir mimari yarı-totolojidir, asıl başarı routing'dir.** İki ön-koşul (girdi-ayırt-
335
- edilebilir domain'ler + kapasite ≥ domain) sağlanınca, recognition kusursuz olunca ve uzmanlar
336
- donunca, doğruluk-matrisinin köşegeni son satıra *zorunlu olarak* eşittir → FGT=0 garantilidir.
337
- Dolayısıyla **asıl ampirik başarı sıfır-unutmanın kendisi değil, onu mümkün kılan şeydir:
338
- denetimsiz, çevrimiçi, lokal biçimde kusursuz (%100) görev-kimliği çıkarımı** (reconstruction
339
- sürprizinden) — yani görev-kimliği *verilen* bir oracle multi-head'i, görev-kimliği
340
- *verilmeden* eşitlemek. Belge bunu bu şekilde konumlandırır; "EWC'yi sıfır-unutmayla geçmek"
341
- cümlesi ancak bu çerçevede dürüsttür.
342
- - **Domain'ler bitişik blok olarak gelmeli.** Faz-dedektörü temiz domain geçişini ancak her
343
- domain *temporal-bitişik* geldiğinde tetikler. Tamamen *interleaved* (karışık) akışta Prizma tek
344
- uzmana çöker ve unutma geri gelir (ACC ~0.58). Bu bir gizli görev-sınırı sızıntısı *değildir*
345
- (hiçbir sınır etiketi tüketilmez) ve domain-incremental CL için standart bir varsayımdır, ama
346
- açıkça belirtilmelidir: sömürülen şey *temporal görev yapısıdır*, etiket değil.
347
- - **P1 (ölçekleme):** Sığ substratta kanıt; backprop-paritesi *kanıtlanmadı*. Bu bir falsifiability
348
- gate, ölçekleme iddiası değil.
349
- - **Ambiguous rejim:** Aynı girdi-farklı etiket (checkerboard) durumunda Prizma *yardım etmez*
350
- ve etmemeli (E5 kontrolü: oracle tavanını aşmaz). Recognition girdiden ayırt-edilebilirlik
351
- ister.
352
- - **Kapasite:** uzman < domain ise yeni domain'ler öğrenilemez (unutma yok ama ACC düşer).
353
- - **P2 (weight transport):** Çözülmedi, gevşetildi. Üstelik prototip *her zaman* W^T-free'dir
354
- (varsayılan DFA); `feedback="exact"` yalnızca gevşetmenin maliyetini ÖLÇMEK için sağlanır.
355
- - **P5 (sampling/kalibrasyon):** Sabit-T Langevin iyi-belirli veride kalibrasyonu *bozar*;
356
- fayda yalnız belirsiz/OOD girdide + annealed-T ile beklenir (henüz dar test).
357
- - **Baseline'ın numerik kırılganlığı:** Elle-kodlanmış EWC λ≥100'de NaN'a taşar; tuner kullanılabilir
358
- aralıkta (λ=50) kalır. Karşılaştırma bu aralıkta adildir.
359
- - **Gürültü:** Çok yüksek gürültüde domain'ler gerçekten ayrışmaz → mekanizma kaçınılmaz olarak
360
- naive'e iner (temel sınır, bug değil).
361
-
362
- ---
363
-
364
- ## 9. Sonuç
365
-
366
- Prizma, *girdi-ayırt-edilebilir sürekli öğrenme* rejiminde, benzer yöntemlerin (naive backprop,
367
- ve hatta görev-sınırı kullanan EWC) yapamadığını yapar: **görev-sınırı ve etiketi olmadan,
368
- tam-lokal, backprop'suz biçimde sıfıra yakın unutma.** Bu, "tek precision-sürpriz sinyalinin iki
369
- zaman ölçeğinde dikkat+konsolidasyonu sürmesi" sentezinin ve "precision-testli görev-sınırsız
370
- faz-dedektörü" mekanizmasının somut, test edilmiş bir gösterimidir. Sınırları açıkça
371
- işaretlenmiştir; ölçekleme açık problem olarak durur.
372
- ```
373
- Reprodüksiyon: ./.venv/bin/python experiments/run_continual.py → results/results.json
374
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/Prizma_EN.md ADDED
@@ -0,0 +1,397 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Prizma — backprop-free, fully-local continual learning
2
+
3
+ **A backprop-free, fully-local, predictive-coding-based, neuromorphic-targeted learning architecture.**
4
+
5
+ > Core idea (3 sentences). Prizma is a *cortical workspace network* that performs gradient
6
+ > descent on a single free-energy functional across three time scales: descent with respect to
7
+ > activities = inference, descent with respect to gates = routing, descent with respect to
8
+ > weights = learning. All learning rules are local (no backprop, no weight transport; the W^T in
9
+ > inference is relaxed via Feedback Alignment). The original contribution is that *the same
10
+ > precision-weighted-surprise signal* drives both attention/routing and plasticity
11
+ > (consolidation) at two time scales — and this yields **continual learning that requires no
12
+ > task boundaries and no task labels**: it replaces EWC's offline Fisher with an online and
13
+ > local surprise-driven importance signal.
14
+
15
+ This document presents the idea end to end, formalizes it, **tests it with real code**, records
16
+ failed attempts and their fixes, and honestly bounds where it works and where it does not.
17
+
18
+ ---
19
+
20
+ ## 0. How we got here (chain of reasoning)
21
+
22
+ In the current transformer architecture, prior + attention + memory + computation are blurred
23
+ into a single weight stack and learned from scratch in a data-hungry manner. The brain move
24
+ splits these four functions into four organs. Prizma adopts this split but **rejects path A
25
+ (backprop + RL-gating)**; it chooses **path B**: fully-local plasticity, a predictive-coding
26
+ anchor, a neuromorphic/analog target. The primary object is not the forward pass but
27
+ **plasticity**; learning and inference are gradient descent with respect to different variables
28
+ on a single free-energy functional.
29
+
30
+ This architecture and theoretical framework were developed through a structured
31
+ design-and-review process with adversarial refereeing, spanning predictive-coding theory,
32
+ the novel mechanism, neuromorphic hardware, prior-art differentiation, failure-mode analysis,
33
+ and the experimental protocol. The full design rationale is documented in
34
+ `docs/PRIZMA_SEQ_REPORT.md` and `docs/PRIZMA_SEQ_SPEC.md`.
35
+
36
+ ---
37
+
38
+ ## 1. The established architecture — Cortical Workspace Network
39
+
40
+ - **HEAD** — a strong, structured generative prior `p(causes)`. Latents live as reference frames
41
+ (grid-cell-like relational codes). Slow/frozen; few-sample efficiency comes from here.
42
+ *(In the prototype: a frozen RBF/quadratic-kernel lift — simple but representative of its role.)*
43
+ - **MODULES** (cortical areas) — parallel local experts. Each computes the prediction error
44
+ `ε_m` for its own input slice and propagates **ERROR, not raw activation**.
45
+ - **WORKSPACE** (thalamus+PFC) — a small fixed-size latent array `a ∈ R^k`, `k ≪ n`. The
46
+ bottleneck is the computational saving itself: cost `O(n·k)`, linear in `n`.
47
+ - **GATE** (basal ganglia) — modules compete to write to the workspace via a precision-weighted
48
+ error ("bid"); the winner(s) write (PBWM).
49
+ - **BROADCAST** (thalamo-cortical loop) — the updated area is broadcast back to all modules as a
50
+ top-down prediction; this broadcast also acts like an efference copy.
51
+
52
+ ---
53
+
54
+ ## 2. A single free-energy functional and three update rules
55
+
56
+ ### 2.1 Master functional `F` (the backbone)
57
+
58
+ ```
59
+ F = Σ_m ½ ε_mᵀ Π_m ε_m + ½ ε_wᵀ Π_w ε_w + ½ ε_aᵀ Π_a ε_a + Σ_m g_m·b_m − λ_H·H(g) + R(θ)
60
+ ```
61
+
62
+ Error populations (all explicit, forward-looking, locally readable):
63
+ ```
64
+ module error: ε_m = x_m − W_m f(z_m) (bottom-up input − the module's own prediction)
65
+ module↔workspace: ε_zm = z_m − U_m a (the workspace broadcast predicts each module latent)
66
+ head/prior error: ε_a = a − μ_a(c) (workspace latent − structured prior)
67
+ routing bid: b_m = ½ ε_mᵀ Π_m ε_m (precision-weighted error = basal-ganglia proposal)
68
+ ```
69
+ The `Π_*` are precision (inverse-covariance) matrices; `g_m∈[0,1]` are gate variables; `H(g)` is
70
+ gate entropy (load balance, dead-expert pressure, P6); `R(θ)` is a weight/complexity prior.
71
+ **F = accuracy + complexity.** Every term is a precision-weighted squared error + a prior.
72
+
73
+ ### 2.2 Inference — descent with respect to activities (fast settling)
74
+
75
+ ```
76
+ τ_z dz_m/dt = −∂F/∂z_m = diag(f'(z_m))·W_mᵀ(Π_m ε_m) − Π_zm(z_m − U_m a) [+ √(2T)·ξ(t)]
77
+ τ_a da/dt = −∂F/∂a = Σ_m g_m·U_mᵀ(Π_zm(z_m − U_m a)) − Π_a(a − μ_a(c))
78
+ ```
79
+ The first term contains `W_mᵀ` — **this is exactly where weight transport comes back, into the
80
+ INFERENCE dynamics** (open problem P2). It is not in the learning rule; it is in inference. The
81
+ `√(2T)·ξ` Langevin noise turns MAP settling into posterior sampling (P5).
82
+
83
+ ### 2.3 Routing — descent with respect to gates + resolving the sign-tension
84
+
85
+ ```
86
+ τ_g dg_m/dt = −∂F/∂g_m ⇒ g_m = softmax_m(−b_m/temp + λ_H(−log g_m − 1))
87
+ ```
88
+ **Critical resolution (design review).** The claim "a single scalar gate drives both
89
+ attention and plasticity" is contradictory in sign: in pure PC, since `dw ∝ Π·ε·r`, a
90
+ *reliable/mastered* channel learns **faster** — the exact opposite of consolidation. The fix is
91
+ not a single scalar multiplier but **a single DRIVER (the surprise/error-energy `E_m`), read in
92
+ two opposite-signed ways**:
93
+ ```
94
+ attention/inference gain: Π_m = π(E_m), dπ/dE < 0 (precision RISES once mastered — exploit)
95
+ plasticity/learning rate: β_m = β(E_m), dβ/dE > 0 (β → floor once mastered — FREEZE)
96
+ ```
97
+ The naive PC identity `dw∝Π·ε·r` is explicitly **REJECTED** for consolidation: plasticity reads
98
+ `E_m` (surprise), not `Π_m`.
99
+
100
+ ### 2.4 Learning — descent with respect to weights (slow, LOCAL, no W^T)
101
+
102
+ ```
103
+ dW_m/dt = η · β_m · NM · [ (Π_m ε_m) ⊗ f(z_m) ] ⊙ Tr_m
104
+ ```
105
+ Four local factors: `NM` (a global neuromodulator scalar = the broadcast of the action-outcome
106
+ error), `β_m` (the metaplastic gate), `(Π_m ε_m)` (the post-synaptic error neuron), `f(z_m)`
107
+ (pre-synaptic activity), `Tr_m` (eligibility trace, `dTr/dt = −Tr/τ_e + f(z_m)ε_m`). This is the
108
+ **idealized PC weight rule**, and the equality of `dW=(Πε)⊗r` to the analytic gradient was
109
+ verified against finite-differences with an error of `5e-10` (there is
110
+ no W^T in the learning rule). *Note (honesty): the prototype's encoder is a DFA approximation of
111
+ this idealized rule — it uses fixed-random feedback, i.e. the prototype is **always** W^T-free;
112
+ the FD verification is for the idealized rule, not for the prototype's DFA encoder.*
113
+
114
+ ### 2.5 The P2 relaxation — a separate feedback `Q_m` (Feedback Alignment)
115
+
116
+ The `W_mᵀ` in inference is replaced by a separate feedback matrix `Q_m`:
117
+ ```
118
+ τ_z dz_m/dt = diag(f'(z_m))·Q_m(Π_m ε_m) − Π_zm(z_m − U_m a)
119
+ local training: dQ_m/dt = η_Q·[(z_m − Q_m(Π_m ε_m)) ⊗ (Π_m ε_m)] (or fixed-random Q, DFA)
120
+ ```
121
+ **Honesty:** P2 is *not solved*, only relaxed. In the experiment we show that the results do not
122
+ change with fixed-random feedback (DFA) (E4) — in this regime there is no need for W^T.
123
+
124
+ ---
125
+
126
+ ## 3. The original mechanism — PGM (Precision-Gated Metaplasticity) and task-boundary-free continual learning
127
+
128
+ Two **coupled states, a single functional gate**:
129
+ - **Fast bid** `b_m = π_m·‖ε_m‖²` — opens both attention and the plasticity window (routing).
130
+ - **Slow consolidation** `ω_m` — grows with sustained low error, multiplicatively shrinking the
131
+ effective learning rate via `α = α₀/(1+ω_m)` (Bayesian-synapse / metaplasticity).
132
+
133
+ ```
134
+ plasticity window: window(b_m) = σ(β(b_m − θ_m)) (learn only on surprise)
135
+ effective LR: α_m = α₀ · window(b_m) · 1/(1+ω_m)
136
+ load balance: θ_m ← θ_m + η_b(usage_m − target) (dead-expert / rich-get-richer fix)
137
+ reawakening: ω_m ← ω_m − κ·relu(conflict) (occupied-expert fix)
138
+ ```
139
+
140
+ **Why task-boundary-free continual learning emerges (mechanically):** When a module masters its
141
+ own input domain it produces low error → low bid → loses the competition → `ω→high` → freezes
142
+ (consolidates). A new domain produces high error → a fresh module wins → it learns. **No task
143
+ label, no Fisher matrix, no replay.** The timing of routing and consolidation events is read from
144
+ the model's own surprise dynamics (a precision test) — no external task-boundary signal is used.
145
+
146
+ ---
147
+
148
+ ## 4. Borrowed vs New — an honest ledger
149
+
150
+ | Component | Source | Status |
151
+ |---|---|---|
152
+ | Explicit error-neuron + free-energy | Rao-Ballard, Bogacz 2017, Friston | **borrowed** |
153
+ | Local weight rule `dw∝(Πε)⊗r` (no W^T in learning) | standard PC | **borrowed** |
154
+ | Relaxing the W^T in inference with random/learned feedback | Feedback Alignment (Lillicrap, Nøkland 2016) | **borrowed** |
155
+ | Three/four-factor Hebbian + eligibility | Frémaux & Gerstner 2016 | **borrowed** |
156
+ | Basal-ganglia write-gating, small workspace | PBWM (O'Reilly & Frank), Goyal & Bengio | **borrowed** |
157
+ | Langevin/stochastic settling = posterior sampling | Buesing 2011, Aitchison & Lengyel | **borrowed** |
158
+ | LR ∝ weight-posterior-variance (metaplasticity) | Aitchison et al.; Fusi/Benna-Fusi | **borrowed** |
159
+ | ART-style vigilance-recruitment (new domain → fresh expert) | Carpenter & Grossberg (ART) | **borrowed** |
160
+ | **The resolution of the sign-tension**: a single surprise-energy `E_m`, two opposite-signed readouts (π↑, β↓) | — | **NEW synthesis** |
161
+ | **Precision-tested, task-boundary-free phase detector**: reading the consolidation timing from the active expert's own `(μ,σ)` precision | — | **NEW mechanism** |
162
+ | **Replacing EWC's offline Fisher importance → with an online/local/unsupervised recognition-surprise importance** | — | **NEW positioning** |
163
+
164
+ Originality, honestly: the parts are borrowed, **the synthesis + two mechanisms are new.** This
165
+ is not a buzzword mashup — every part was tested in working code.
166
+
167
+ ---
168
+
169
+ ## 5. Neuromorphic/analog fit (summary of the hardware analysis)
170
+
171
+ | Operation | Physics | Why local/low-power |
172
+ |---|---|---|
173
+ | Prediction (MVM) | RRAM/memristor crossbar (Ohm+Kirchhoff) | O(1) physical time, no off-chip weight transport |
174
+ | Error neuron | analog differential pair (current subtraction) | local at a shared node |
175
+ | Gate `g_m` | **a single tile bias (reference conductance/voltage)** | the *same* bias scales both the read gain (attention) and the write window (plasticity) — the physical embedding of precision=plasticity |
176
+ | Competition | current-mode winner-take-all | local |
177
+ | Weight update | three/four-factor conductance change | a natural outer-product on the crossbar |
178
+ | Langevin noise | **intrinsic device noise (RTN/thermal)** | the hardware "defect" = a free posterior sampler; `T_eff ∝ read-voltage` |
179
+
180
+ Honest limits: real RTN is not white-Gaussian (Lorentzian/1/f) → "noise=sampler" is idealized;
181
+ RRAM endurance (~1e6–1e9 writes); device variability corrupts the MVM; a per-cell capacitor
182
+ eligibility trace is expensive; the workspace+WTA+NM require digital/Loihi-class support (a
183
+ hybrid design).
184
+
185
+ ---
186
+
187
+ ## 6. Experiment — the falsifiability gate
188
+
189
+ ### 6.1 First, a benchmark-validity finding (honesty)
190
+
191
+ When we measured the pre-registered **rotating-checkerboard** benchmark (all tasks share the
192
+ same input box, different labels), we found it to be **invalid**: for the same `x`, the average
193
+ label overlap across tasks is ≈0.56 (mismatch ≈0.44; K=3) — i.e. because **a single-head model
194
+ cannot give a different answer to the same input without a task identity, low forgetting is
195
+ MATHEMATICALLY IMPOSSIBLE** (the single-output oracle ceiling = 0.78; independently verified by a
196
+ referee: 0.7808). In this regime no method can win; we confirm this in the E5 control.
197
+
198
+ Prizma's mechanism (recognition-by-reconstruction) is meaningful in the
199
+ **input-distinguishable (domain-incremental)** regime. Hence the valid benchmark:
200
+
201
+ ### 6.2 Benchmark — Structured-Permuted (domain-incremental, distinguishable)
202
+
203
+ A correlated base: `v = latent·Aᵀ`, `latent~N(0,I_k)`, `cov(v)=AAᵀ≠I`. The label is a shared
204
+ teacher on the latent. Task `t`: a feature permutation `π_t` → `cov(x_t)=P_t(AAᵀ)P_tᵀ` differs in
205
+ every domain → an autoencoder can recognize the domain from the input (evidence: per-domain PCA
206
+ reconstruction is own=0.00 vs other=0.64). Naive sequential training still forgets
207
+ (permuted-MNIST logic).
208
+
209
+ ### 6.3 Substrate and baselines (on the same ground, fair)
210
+
211
+ Learners, with comparable parameter counts:
212
+ - **backprop MLP** — single-head, sequential (naive baseline).
213
+ - **EWC** — backprop + Fisher; **uses task boundaries** (a privileged competitor; λ was tuned to
214
+ minimize its own FGT; at λ≥100 numerical overflow occurs, the tuner stays at λ=50).
215
+ - **replay** — backprop + reservoir buffer (stores task data; standard rehearsal).
216
+ - **oracle_multihead** — K independent classifiers, **given the true task identity at test
217
+ time.** This is the **honest upper bound** that Prizma tries to match *without being given* the
218
+ task identity (inferring it from reconstruction surprise).
219
+ - **Prizma (DFA, no W^T)** — ART-routing + PGM consolidation; the encoder uses fixed-random
220
+ feedback (Feedback Alignment) → **no W^T anywhere**; **NO task label/boundary.** *(Headline.)*
221
+ - **Prizma (exact W^T)** — the same, but the encoder reads the true `Wᵀ` → it violates
222
+ constraint-2; provided only to measure the cost of the no-transport relaxation. *(Honest
223
+ finding: DFA performs better than this — weight transport is unnecessary, even harmful.)*
224
+ - **PRIZMA_noRoute** — routing/phase-detector off, a single monolithic expert (causal ablation).
225
+
226
+ Prizma is local: the decoder/head uses a fully-local PC/delta rule (`(P−Y)⊗z`, `ε⊗z`); the
227
+ encoder uses Feedback-Alignment.
228
+
229
+ ### 6.4 Metrics and success criterion (falsifiable)
230
+
231
+ `acc[i,j]` = the test accuracy on task `j` once task `i` is finished. `ACC=mean_j acc[K-1,j]`;
232
+ `FGT=mean_{j<K-1}(max_i acc[i,j] − acc[K-1,j])`. **SUCCESS** (≥10 seeds, non-overlapping 95% CI):
233
+ `FGT_Prizma ≤ FGT_EWC`, `FGT_Prizma ≤ 0.6·FGT_naive`, `ACC_Prizma ≥ 0.92·ACC_naive`,
234
+ `FGT_Prizma < FGT_vanilla`, the ablation gate being causal, no task boundary anywhere in Prizma's
235
+ code.
236
+
237
+ ### 6.5 RESULTS
238
+
239
+ **E1 — Main comparison (structured-permuted, K=5, 10 seeds, 95% CI):**
240
+
241
+ | Learner | ACC | FGT (forgetting↓) | Task boundary? | Memory? | W^T? |
242
+ |---|---|---|---|---|---|
243
+ | backprop MLP | 0.445 ± 0.025 | 0.553 ± 0.026 | — | — | — |
244
+ | EWC (λ=50, tuned) | 0.456 ± 0.019 | 0.411 ± 0.020 | **uses** | — | — |
245
+ | replay (buffer 1000) | 0.737 ± 0.011 | 0.156 ± 0.009 | **uses** | **uses** | — |
246
+ | **oracle_multihead** *(upper bound)* | **0.879 ± 0.011** | 0.000 | **task identity GIVEN** | — | — |
247
+ | **Prizma (DFA, no W^T)** | **0.834 ± 0.015** | **0.000 ± 0.000** | **NONE** | **NONE** | **NONE** |
248
+ | Prizma (exact W^T) | 0.708 ± 0.021 | 0.000 | NONE | NONE | uses |
249
+ | PRIZMA_noRoute *(ablation)* | 0.446 ± 0.024 | 0.489 ± 0.023 | — | ��� | — |
250
+
251
+ Parameters: backprop/EWC = 20,744; Prizma (trainable, effective ~13,840 — only 5 experts are
252
+ trained; the fixed FA matrices are not counted) ≤ MLP. **Prizma does not win by capacity** (the
253
+ referee verified: backprop has FGT≈0.55–0.57 even with 1.08M parameters; Prizma has FGT=0 even
254
+ with 4,720 parameters).
255
+
256
+ Reading: Prizma (DFA, 0.834) is **BETWEEN replay (0.737) and oracle (0.879)** — it matches the
257
+ oracle's zero-forgetting and approaches its accuracy; but *without being given* the task
258
+ identity, without replay, without task boundaries, **without W^T**. Even replay, which uses task
259
+ boundaries + memory, stays at FGT=0.156. All criteria S1–S6 are satisfied with non-overlapping
260
+ CIs.
261
+
262
+ **The no-weight-transport honest finding:** the `feedback="exact"` version (where the encoder
263
+ reads the true Wᵀ) yields 0.708 — **WORSE than the DFA (no W^T) version (0.834).** So weight
264
+ transport is unnecessary, even harmful; Prizma's claim of biological/neuromorphic fidelity is
265
+ strengthened.
266
+
267
+ **Causality (ablation):** Turning off recognition-routing (`noRoute`) → FGT 0.000 → **0.489**
268
+ (returns to the backprop level). **The gain comes from modular surprise-routing.** Honest nuance
269
+ (referee): in a sequential-clean stream explicit freezing is unnecessary (routing already does not
270
+ re-train old experts); the essence of the mechanism is routing + the precision phase detector.
271
+ Moreover FGT=0 is, given that its preconditions hold, architecturally guaranteed — *the real
272
+ achievement is the unsupervised/local flawless routing that makes it possible.*
273
+
274
+ **E2 — Separability sweep (noise blurs the domains; 5 seeds):**
275
+
276
+ | noise | Prizma ACC | Prizma FGT | backprop ACC | backprop FGT |
277
+ |---|---|---|---|---|
278
+ | 0.0 | 0.827 | 0.000 | 0.433 | 0.562 |
279
+ | 0.3 | 0.721 | 0.016 | 0.299 | 0.608 |
280
+ | 0.6 | 0.557 | 0.052 | 0.261 | 0.508 |
281
+ | 0.9 | 0.430 | 0.073 | 0.239 | 0.421 |
282
+ | 1.2 | 0.344 | 0.077 | 0.222 | 0.350 |
283
+
284
+ Thanks to precision-adaptive recognition, routing stays a **clean single-expert-per-domain** at
285
+ every noise level (5 experts committed); FGT stays low. The ACC drop is not from a routing
286
+ collapse but from the noise making the classification task harder (graceful degradation). Prizma
287
+ beats backprop at every level.
288
+
289
+ **E3 — Capacity (number of experts vs K=5 domains; 5 seeds):** experts=3→ACC 0.556, 4→0.692,
290
+ ≥5→0.827; FGT=0.000 in all of them. If experts < domains, the new domains cannot be learned (ACC
291
+ drops) but **the old ones are not forgotten** — graceful capacity behavior.
292
+
293
+ **E4 — Locality/P2 (is there W^T or not):** `feedback=random` (pure DFA, no W^T) → ACC **0.827** /
294
+ FGT 0.000; `feedback=exact` (encoder reads the true Wᵀ) → ACC **0.691** / FGT 0.000. Both forget
295
+ zero, but **DFA gives better accuracy** → in this regime weight transport is unnecessary, even
296
+ harmful. The P2 relaxation is not merely "sufficient" but preferred.
297
+
298
+ **E5 — Impossible-regime control (rotating-checkerboard, ambiguous):** the single-output oracle
299
+ ceiling is 0.780. Prizma ACC 0.570, backprop 0.694 — **Prizma does NOT exceed the ceiling** (it is
300
+ even below backprop). So Prizma does not help in the indistinguishable regime and honestly shows
301
+ that it does not → proof that we understand the boundary.
302
+
303
+ All numbers are in `results/results.json` and `results/console.txt`; reproduced with a single
304
+ command.
305
+
306
+ ---
307
+
308
+ ## 7. Iteration log (develop → test → if it fails, try again)
309
+
310
+ A real record of the "develop the idea, test it, if it doesn't work try again" loop that the user
311
+ requested:
312
+
313
+ 1. **v0 — shared-additive readout (learners.py).** Both modes collapsed: `taskfree` barely beat
314
+ backprop (spurious consolidation + rich-get-richer), `boundary` over-froze (after task0 all
315
+ groups froze). **Finding:** capacity is not reserved.
316
+ 2. **The benchmark-validity crisis.** We measured that rotating-checkerboard is impossible for
317
+ single-head CL (label overlap ≈0.53). → we moved to the domain-incremental regime.
318
+ 3. **Permuted-iid-Gaussian also turned out to be indistinguishable** (an iid permutation does not
319
+ change the distribution). → a correlated **structured-permuted** benchmark.
320
+ 4. **v1 — soft-responsibility MoE.** Uniform collapsed (all experts used at ~1/M, underfit and
321
+ froze; low FGT *for the wrong reason* = a collapsed expert).
322
+ 5. **v2 — ART hard-routing.** A forced-commit cascade (underfit early commit → all experts spent
323
+ on a single domain). Forced-commit was removed; then per-sample vigilance thrashing.
324
+ → batch-level novelty.
325
+ 6. **v3 — batch-novelty + phase detector → BREAKTHROUGH:** FGT=0.000, ACC=0.80, a clean
326
+ single-expert-per-domain. But **E2 fragility:** a sharp collapse at noise=0.3 (the fixed
327
+ vigilance error).
328
+ 7. **v4 — precision-adaptive active-expert phase detector.** Each expert tracks its own
329
+ reconstruction precision `(μ,σ)`; novelty = `recon > μ+zσ`; the active expert learns the domain
330
+ throughout the whole task, and when the domain changes and it no longer recognizes it, it
331
+ commits+freezes. **Result: robust graceful degradation to noise; routing stays clean at every
332
+ level.**
333
+ 8. **Adversarial referee round (4 parallel auditors: leakage/cheating, fairness, independent
334
+ reproduction, overclaim).** All returned `claim_supported=true` (1 SOUND + 3 MINOR_ISSUES; no
335
+ REFUTED/SERIOUS). The real findings that were fixed: **(a)** the `feedback` parameter was not
336
+ being read → fixed; it turned out that the prototype was *always* W^T-free — and once fixed,
337
+ the no-W^T (DFA) version turned out to be **better** than the W^T version (0.834 > 0.708).
338
+ **(b)** the oracle-multihead and replay baselines were added (an honest upper bound + a strong
339
+ competitor). **(c)** the framing was made more honest: "FGT=0 is an architectural guarantee
340
+ once the preconditions hold; the real achievement is the unsupervised/local flawless routing";
341
+ "the domains must arrive as contiguous blocks (it collapses to ~0.58 when interleaved)";
342
+ parameter accounting, EWC numerical fragility, FD-attribution fixes.
343
+
344
+ ---
345
+
346
+ ## 8. Honest assessment — where it works, where it breaks
347
+
348
+ **Works (proven):** In an input-distinguishable domain-incremental stream, without a task
349
+ label/boundary, with fully-local (including DFA) learning, **near-zero forgetting** + accuracy
350
+ that beats naive backprop and (task-boundary-using) EWC. The ablation shows that consolidation is
351
+ causal.
352
+
353
+ **Unsolved / limits (honestly — verified by the adversarial referee panel):**
354
+ - **FGT=0 is an architectural quasi-tautology; the real achievement is the routing.** Once the
355
+ two preconditions hold (input-distinguishable domains + capacity ≥ domains), once recognition is
356
+ flawless and the experts are frozen, the diagonal of the accuracy matrix is *necessarily* equal
357
+ to the last row → FGT=0 is guaranteed. Therefore **the real empirical achievement is not
358
+ zero-forgetting itself but what makes it possible: unsupervised, online, locally flawless
359
+ (100%) task-identity inference** (from reconstruction surprise) — i.e. matching an oracle
360
+ multi-head that is *given* the task identity, *without being given* the task identity. The
361
+ document positions it this way; the sentence "beats EWC with zero forgetting" is honest only in
362
+ this frame.
363
+ - **The domains must arrive as contiguous blocks.** The phase detector triggers a clean domain
364
+ transition only when each domain arrives *temporally contiguous*. In a fully *interleaved*
365
+ (mixed) stream Prizma collapses to a single expert and forgetting returns (ACC ~0.58). This is
366
+ *not* a hidden task-boundary leak (no boundary label is consumed) and it is a standard
367
+ assumption for domain-incremental CL, but it must be stated explicitly: what is exploited is the
368
+ *temporal task structure*, not the label.
369
+ - **P1 (scaling):** evidence on a shallow substrate; backprop-parity is *not proven*. This is a
370
+ falsifiability gate, not a scaling claim.
371
+ - **Ambiguous regime:** in the same-input-different-label (checkerboard) case Prizma *does not
372
+ help* and should not (the E5 control: it does not exceed the oracle ceiling). Recognition
373
+ requires distinguishability from the input.
374
+ - **Capacity:** if experts < domains, the new domains cannot be learned (no forgetting but ACC
375
+ drops).
376
+ - **P2 (weight transport):** not solved, relaxed. Moreover the prototype is *always* W^T-free (the
377
+ default is DFA); `feedback="exact"` is provided only to MEASURE the cost of the relaxation.
378
+ - **P5 (sampling/calibration):** fixed-T Langevin *breaks* calibration on well-specified data; the
379
+ benefit is expected only on uncertain/OOD input + with annealed-T (so far narrowly tested).
380
+ - **The baseline's numerical fragility:** the hand-coded EWC overflows to NaN at λ≥100; the tuner
381
+ stays in the usable range (λ=50). The comparison is fair in this range.
382
+ - **Noise:** at very high noise the domains genuinely do not separate → the mechanism inevitably
383
+ degrades to naive (a fundamental limit, not a bug).
384
+
385
+ ---
386
+
387
+ ## 9. Conclusion
388
+
389
+ Prizma, in the *input-distinguishable continual-learning* regime, does what similar methods (naive
390
+ backprop, and even task-boundary-using EWC) cannot: **near-zero forgetting without a task boundary
391
+ or label, fully-locally, in a backprop-free manner.** This is a concrete, tested demonstration of
392
+ the "a single precision-surprise signal driving attention+consolidation at two time scales"
393
+ synthesis and of the "precision-tested task-boundary-free phase detector" mechanism. Its limits
394
+ are explicitly marked; scaling stands as an open problem.
395
+ ```
396
+ Reproduction: ./.venv/bin/python experiments/run_continual.py → results/results.json
397
+ ```
docs/TRANSFORMER_ALTERNATIVE_BRIEF.md CHANGED
@@ -1,13 +1,13 @@
1
- # Prizma → Transformer-Alternative — Committee Brief (self-contained)
2
 
3
- **Read this fully before doing your task. You share NO conversation context; everything you need is here.**
4
 
5
- ## 0. The mission (from the project owner)
6
- Take the existing Prizma project (at `/Users/nazmi/Desktop/Projeler/proje/Prizma`) and push it to a
7
- **realistic point where it is a genuine alternative to the Transformer architecture**. The owner's
8
- explicit success floor: *"Prizma can stand in for the Transformer."* A rigorous committee loops,
9
- improving the method and the report, and **stops only when the committee agrees Prizma is a credible
10
- competitor to the Transformer architecture.** Hard rule from the owner: **no faked metrics, no
11
  hand-waving** — but also **do not treat "can't be done" as the endpoint; engineer a path.**
12
 
13
  ## 1. What Prizma currently IS (accurate, no spin)
@@ -31,8 +31,8 @@ Prizma today is a **backprop-free, fully-local, predictive-coding continual-lear
31
 
32
  **Files:** `src/prizma.py` (the method), `src/baselines.py` (MLP+EWC, hand-coded backprop),
33
  `src/data.py` (synthetic benchmarks), `src/metrics.py`, `experiments/run_continual.py`,
34
- `docs/Prizma.md` (full writeup), `committee/reports.json` (the 6 design reports it was built from).
35
- Read any of these as needed.
36
 
37
  ## 2. The brutal gap (why current Prizma is NOT a Transformer alternative)
38
  A Transformer's defining capability is **sequence modeling via attention**: content-based,
@@ -41,7 +41,7 @@ modeling. Current Prizma does **static classification with continual-learning ro
41
  no notion of a sequence, no position, no causal mixing, no in-context recall, no autoregression.
42
  "Beating EWC at zero-forgetting on synthetic Gaussians" is **orthogonal** to "replacing attention."
43
 
44
- ## 3. The strategic reframing the committee should adopt (and pressure-test)
45
  "Transformer alternative" in the literature means an **architecture that replaces the attention
46
  *mechanism*** (how tokens mix), trainable by the standard recipe — **not** a new learning rule.
47
  Mamba, S4/S5, RWKV, RetNet, linear-attention, Hyena, Based are all **backprop-trained** sequence
@@ -67,7 +67,7 @@ empirically testable here) and achievable. **Backprop-free + Transformer-parity
67
  unsolved frontier problem; do NOT make it the gating claim** — make the architecture the gating
68
  claim, and carry local-learning as a characterized bonus.
69
 
70
- ## 4. The falsifiable bar (the committee must agree on the exact pass/fail BEFORE building)
71
  A research prototype counts as a *credible Transformer alternative in the tested regime* if, at
72
  **small scale and parameter-matched against a standard Transformer**, it clears the field's
73
  **attention-diagnostic suite** + a small LM, AND offers a structural advantage. Proposed concrete
@@ -86,7 +86,7 @@ gate (refine it, keep it field-standard and non-strawman):
86
  ablations showing the Prizma mechanism (not just "a bigger RNN") is causal; explicit statement of
87
  where it still loses and what scaling is unproven.
88
 
89
- The committee may **add** the local-learning bonus axis (Prizma-Seq trained with local/PC/DFA rules
90
  vs backprop, quantifying the tax) and the **continual-learning** axis (the unique selling point).
91
 
92
  ## 5. Compute reality (what experiments are feasible — design within this)
@@ -98,7 +98,7 @@ vs backprop, quantifying the tax) and the **continual-learning** axis (the uniqu
98
  - Use PyTorch for Prizma-Seq + the Transformer baseline so the comparison is on identical footing and
99
  fast on MPS. (The current numpy PC code is the *conceptual* ancestor, not the perf substrate.)
100
 
101
- ## 6. Non-negotiables (owner's integrity rules)
102
  - **Real, reproducible numbers only.** Every claim backed by a runnable script + seeds + CIs.
103
  - Parameter/FLOP-matched, non-strawman Transformer baseline (proper implementation, tuned LR).
104
  - Keep Prizma's honest-limits culture: a "borrowed vs new" ledger; explicit failure modes; scaling
@@ -106,5 +106,5 @@ vs backprop, quantifying the tax) and the **continual-learning** axis (the uniqu
106
  - The differentiator must be *real* (linear cost / continual learning / local learning), measured,
107
  not asserted.
108
 
109
- ## 7. Your job depends on which agent you are — see your specific prompt.
110
  Anchor everything to: **does this move Prizma-Seq toward clearing the Section-4 bar, honestly?**
 
1
+ # Prizma → Transformer-Alternative — Design Brief (self-contained)
2
 
3
+ **This is a self-contained statement of the design problem; everything needed is here.**
4
 
5
+ ## 0. The mission
6
+ Take the existing Prizma project and push it to a
7
+ **realistic point where it is a genuine alternative to the Transformer architecture**. The
8
+ explicit success floor: *"Prizma can stand in for the Transformer."* A rigorous design-and-review
9
+ loop improves the method and the report, and **stops only when a referee panel agrees Prizma is a
10
+ credible competitor to the Transformer architecture.** Hard rule: **no faked metrics, no
11
  hand-waving** — but also **do not treat "can't be done" as the endpoint; engineer a path.**
12
 
13
  ## 1. What Prizma currently IS (accurate, no spin)
 
31
 
32
  **Files:** `src/prizma.py` (the method), `src/baselines.py` (MLP+EWC, hand-coded backprop),
33
  `src/data.py` (synthetic benchmarks), `src/metrics.py`, `experiments/run_continual.py`,
34
+ `docs/Prizma.md` (full writeup), `docs/PRIZMA_SEQ_REPORT.md` and `docs/PRIZMA_SEQ_SPEC.md` (the
35
+ design rationale it was built from). Read any of these as needed.
36
 
37
  ## 2. The brutal gap (why current Prizma is NOT a Transformer alternative)
38
  A Transformer's defining capability is **sequence modeling via attention**: content-based,
 
41
  no notion of a sequence, no position, no causal mixing, no in-context recall, no autoregression.
42
  "Beating EWC at zero-forgetting on synthetic Gaussians" is **orthogonal** to "replacing attention."
43
 
44
+ ## 3. The strategic reframing to adopt (and pressure-test)
45
  "Transformer alternative" in the literature means an **architecture that replaces the attention
46
  *mechanism*** (how tokens mix), trainable by the standard recipe — **not** a new learning rule.
47
  Mamba, S4/S5, RWKV, RetNet, linear-attention, Hyena, Based are all **backprop-trained** sequence
 
67
  unsolved frontier problem; do NOT make it the gating claim** — make the architecture the gating
68
  claim, and carry local-learning as a characterized bonus.
69
 
70
+ ## 4. The falsifiable bar (the exact pass/fail must be agreed BEFORE building)
71
  A research prototype counts as a *credible Transformer alternative in the tested regime* if, at
72
  **small scale and parameter-matched against a standard Transformer**, it clears the field's
73
  **attention-diagnostic suite** + a small LM, AND offers a structural advantage. Proposed concrete
 
86
  ablations showing the Prizma mechanism (not just "a bigger RNN") is causal; explicit statement of
87
  where it still loses and what scaling is unproven.
88
 
89
+ The protocol may **add** the local-learning bonus axis (Prizma-Seq trained with local/PC/DFA rules
90
  vs backprop, quantifying the tax) and the **continual-learning** axis (the unique selling point).
91
 
92
  ## 5. Compute reality (what experiments are feasible — design within this)
 
98
  - Use PyTorch for Prizma-Seq + the Transformer baseline so the comparison is on identical footing and
99
  fast on MPS. (The current numpy PC code is the *conceptual* ancestor, not the perf substrate.)
100
 
101
+ ## 6. Non-negotiables (integrity rules)
102
  - **Real, reproducible numbers only.** Every claim backed by a runnable script + seeds + CIs.
103
  - Parameter/FLOP-matched, non-strawman Transformer baseline (proper implementation, tuned LR).
104
  - Keep Prizma's honest-limits culture: a "borrowed vs new" ledger; explicit failure modes; scaling
 
106
  - The differentiator must be *real* (linear cost / continual learning / local learning), measured,
107
  not asserted.
108
 
109
+ ## 7. Anchor for every step
110
  Anchor everything to: **does this move Prizma-Seq toward clearing the Section-4 bar, honestly?**
docs/superpowers/specs/2026-06-05-prizma-seq-transformer-alternative-design.md DELETED
@@ -1,79 +0,0 @@
1
- # Prizma-Seq → Transformer Alternative — Design Spec (2026-06-05)
2
-
3
- > Goal (owner, approved scope = **"bar + aggressive frontier"**): develop Prizma-Seq at full speed
4
- > until it is a **credible Transformer alternative in the tested regime** per the project's own
5
- > pre-registered falsifiable bar (`docs/TRANSFORMER_ALTERNATIVE_BRIEF.md` §4), then push the
6
- > aggressive frontier. Data-driven: run at matched params first; grow the architecture only if a
7
- > leg fails. No faked metrics; param/FLOP-matched non-strawman TF; preserve the measured O(1) edge.
8
-
9
- ## 0. Where we already are (done, referee-gated — `results/gpu_bench.json`)
10
- - **MQAR D=128 ✓** (1 of the 4 diagnostic legs): at matched params Prizma-quad2 ≈ tuned TF
11
- (descriptive parity, 3 seeds), ~3.5× param-efficiency (solves @130K where matched TF fails),
12
- constant-MEMORY inference edge (28× @n=4096, analytic), causal (quad2 ≫ rand_linear ≈ none ≫ TF).
13
- - Honesty fixes applied (memory=analytic not measured; n=3 descriptive-parity; coarse-grid efficiency;
14
- candidate-not-alternative; model-init caveat). Adversarial referee panel passed as-scoped.
15
-
16
- ## 1. Success criteria — the §4 bar (pre-registered pass/fail; do NOT inflate)
17
- A credible alternative *in the tested regime* must, at **small scale, param-matched vs a tuned TF**:
18
- 1. **MQAR** — ✓ DONE (parity @ D=128).
19
- 2. **Induction** (in-context `…[A][B]…[A]→[B]`): Prizma-quad2 **≥0.98**; holds across prefix length
20
- 64→256 (≥0.95 at the long gap). ≥3 seeds, solve-rate + median.
21
- 3. **Selective copying** (Mamba's content-selective copy through filler): selective variant **≥0.97**
22
- and ≥ TF−0.02; the `fixed`-position control must be ~equal for both (isolates content-selectivity).
23
- 4. **Char-LM** (tiny-shakespeare; + text8-subset for the frontier): test **BPC ≤ TF + 0.05** (explicit
24
- margin), param-matched, ≥2 seeds.
25
- 5. **Structural advantage** — ✓ memory; **strengthen** (see Phase C): show the O(1) *latency* crossover,
26
- not just memory; length-extrapolation.
27
- 6. **Honesty controls** — param/FLOP-matched audited; ≥3 seeds + CIs (or seed ranges at n=3); causal
28
- ablation that the Prizma mechanism (not "a bigger RNN") is responsible; explicit failure/limits.
29
-
30
- **Verdict rule:** Prizma-Seq earns "credible alternative in tested regime" iff legs 1–4 PASS at matched
31
- params with the structural advantage (5) and honesty controls (6). Any leg that fails at matched params
32
- triggers Phase D (grow architecture) before any claim; if a leg cannot be cleared even with levers
33
- #2/#3, the claim is rescoped to what passed (never hidden).
34
-
35
- ## 2. Phased plan
36
- - **Phase A — finish the diagnostic suite (the gap).** GPU runner `gpu_diag.py` (analogous to the
37
- verified `gpu_bench.py`): Induction + SelectiveCopy, Prizma-quad2 vs Prizma-none(ablation) vs tuned TF,
38
- param-matched, gen-warm + per-model plateau, ≥3 seeds, streamed crash-safe JSON. Tasks already exist
39
- in `seq/tasks.py` (`Induction`, `SelectiveCopy`).
40
- - **Phase B — char-LM leg.** GPU runner `gpu_charlm.py` (wraps `seq/charlm.py`): tiny-shakespeare
41
- char-LM, param-matched Prizma-quad2 vs TF, report test BPC + the margin, ≥2 seeds. Frontier: text8
42
- subset, deeper/wider, longer training.
43
- - **Phase C — strengthen structural advantage.** (1) `flop_match_width.py` d208 control (already in
44
- gist, unrun); (2) **latency-crossover demo** — extend P5 to n∈{4k,8k,16k,32k} and/or a bigger model
45
- so the TF's O(t) per-step term dominates and Prizma's O(1)-per-step yields a real wall-clock win
46
- (currently only memory wins at n≤4096); (3) length-extrapolation (train len L, eval 2–4×L) on MQAR/
47
- induction — a known SSM/attention differentiator.
48
- - **Phase D — architecture iteration (ONLY if a leg fails).** Build committee lever **#2 decoupled
49
- `d_state`** (per-head state dim decoupled from d_model//H; `delta.py` already value-dim-aware) and/or
50
- **#3 GlobalDeltaMemory** (one asymmetric high-key-rank delta head). Grow the TF in lockstep to stay
51
- param-matched. Re-run the failed leg → repeat until cleared (the `/goal` loop).
52
- - **Phase E — final adversarial referee gate + report.** Update `docs/PRIZMA_SEQ_REPORT.md` (B1–B6
53
- table → real numbers), run the parallel adversarial referee panel, fix findings, re-approve.
54
- - **Frontier (after the bar passes):** bigger multi-layer char-LM (text8, longer); throughput/wall-clock
55
- head-to-head ledger; optional backprop-free (DFA) mode with a *quantified* accuracy tax (bonus axis,
56
- never a gate — backprop-free parity is an explicit OPEN FRONTIER, not claimed).
57
-
58
- ## 3. Execution model
59
- - **Code-building** (GPU runners, levers #2/#3, charlm wrapper): `/subagent-driven-development` —
60
- fresh implementer subagent per task + 2-stage review (spec compliance, then code quality); TDD where
61
- it fits; keep `step()==forward()<1e-6` O(1) guard green before any accuracy number.
62
- - **GPU runs:** Colab A100 via Claude-for-Chrome (secret-gist bootstrap, the verified pattern). Stream
63
- crash-safe JSON to Drive; resumable. Prizma ~30–57 min/run on A100 (sequential chunked-delta) → use 3
64
- seeds for diagnostics, fewer for the frontier; disclose seed counts.
65
- - **Local (Mac MPS):** kernel self-tests, FLOP ledger, smoke tests, parity checks before each GPU run.
66
-
67
- ## 4. Honesty guardrails (binding, from committee + the referee panel)
68
- Param/FLOP-match every head-to-head (grow TF for any paid Prizma arm); measured FLOP+memory ledger
69
- (memory = analytic float counts, label it so; latency = measured wall-clock); ≥3 seeds + solve-rate +
70
- median + ranges (n=3 underpowered → descriptive, not "indistinguishable"); causal ablation
71
- (quad2 vs none vs rand_linear) per new leg; never "attention fails" (say "did not learn under recipe R
72
- at this scale"); pre-register thresholds before multi-seed; verify BOTH sides of a contrast; commit the
73
- raw results JSON to `results/` (auditable); `quad2` novelty = rectangular-delta-state framing, not the
74
- kernel; large-scale LM + backprop-free parity NOT claimed (open frontiers).
75
-
76
- ## 5. Non-goals (this campaign)
77
- - Large-scale LM parity (>~few-M params); production training; new datasets beyond shakespeare/text8.
78
- - A new attention PRIMITIVE (Prizma-Seq is a synthesis + the quad2 lever + framing).
79
- - Backprop-free parity as a gate (only an optional, quantified bonus axis if time permits).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
extra_arms.py DELETED
@@ -1,80 +0,0 @@
1
- """Committee-completing follow-up arms, written into the SAME $PRIZMA_RESULTS/gpu_bench.json
2
- (run_cell caches by cellkey -> incremental & resumable; existing p1/p2/... cells untouched).
3
-
4
- Two arms, both at D=128 MixedMQAR, gen-warm, per-model plateau, 5 seeds:
5
-
6
- ARM B "FLOP-matched TF" — the headline (P2) is param-matched at d128L4H4, but the measured
7
- ledger shows Prizma-quad2-256 costs ~2.14x the param-matched TF's forward FLOPs/token.
8
- A deeper TF d128L9H4 matches Prizma-quad2's as-coded FLOPs to ~2% (4576 vs 4505
9
- kFLOP/tok; flop_ledger.py) AND has MORE params than Prizma -> deliberately generous to
10
- attention. Answers "is Prizma's recall just spent FLOPs?".
11
-
12
- ARM A "parameter-efficiency / sharp contrast" — at the TINY matched scale d64L2H2 (130K),
13
- does Prizma-quad2 solve D=128 where the param-matched Transformer cannot? P1 already
14
- shows TF d64L2H2 = 0/3 (0.016). This adds Prizma-quad2 + Prizma-none x5 at 130K (and 2
15
- more TF seeds for a clean 5v5). This is the strongest honest claim: same recall, ~3.5x
16
- fewer params than the smallest clean TF solver (d128L2H4, 461K), with O(1) inference.
17
-
18
- Run on the Colab A100 (gist must include this file):
19
- PRIZMA_RESULTS=/content/drive/MyDrive/prizma_results python -u extra_arms.py
20
- """
21
- from gpu_bench import (run_cell, solve_stats, tf_factory, ps_factory, _load, _save, OUT, DEV)
22
- from seq.tasks import MixedMQAR
23
-
24
- V = 512
25
- S5 = (0, 1, 2) # 3 seeds (committee min ≥3): Prizma is ~30-57min/run on A100 — 5 seeds is intractable here
26
- TASK = lambda: MixedMQAR(vocab=V, max_pairs=128, num_queries=128, gap=0, min_pairs=1)
27
-
28
-
29
- def main():
30
- print(f"device={DEV} results={OUT} EXTRA ARMS (FLOP-matched + parameter-efficiency)", flush=True)
31
- res = _load()
32
- summary = {}
33
-
34
- # --- ARM B: FLOP-matched (deeper) Transformer d128L9H4 ~= Prizma-quad2-256 as-coded FLOPs ---
35
- print("\n== ARM B: FLOP-matched TF d128L9H4 @ D=128 ==", flush=True)
36
- recs = [run_cell(res, f"p2b.TF-flopmatch-d128L9H4.s{s}", tf_factory(128, 9, 4), TASK, 80000, s)
37
- for s in S5]
38
- summary["TF-flopmatch-d128L9H4"] = solve_stats(recs)
39
- print(f" -> {summary['TF-flopmatch-d128L9H4']}", flush=True)
40
-
41
- # --- ARM A: parameter-efficiency at the tiny matched 130K scale d64L2H2 (d_h=32, d_phi=256) ---
42
- print("\n== ARM A: parameter-efficiency @ d64L2H2 (130K), D=128 ==", flush=True)
43
- q = [run_cell(res, f"p2eff.Prizma-quad2-d64L2H2.s{s}",
44
- ps_factory(64, 2, 2, feat_map="quad2", feat_n2=224), TASK, 80000, s) for s in S5]
45
- summary["Prizma-quad2-d64L2H2"] = solve_stats(q)
46
- print(f" -> Prizma-quad2: {summary['Prizma-quad2-d64L2H2']}", flush=True)
47
-
48
- n = [run_cell(res, f"p2eff.Prizma-none-d64L2H2.s{s}", ps_factory(64, 2, 2), TASK, 80000, s)
49
- for s in S5]
50
- summary["Prizma-none-d64L2H2"] = solve_stats(n)
51
- print(f" -> Prizma-none: {summary['Prizma-none-d64L2H2']}", flush=True)
52
-
53
- # rand_linear CONTROL (fixed random LINEAR 32->256 map): rank<=d_h -> expected NO gain over none.
54
- # If quad2 >> rand_linear ~ none, the gain is causally the QUADRATIC monomials (committee guardrail #5).
55
- rl = [run_cell(res, f"p2eff.Prizma-randlin-d64L2H2.s{s}",
56
- ps_factory(64, 2, 2, feat_map="rand_linear", feat_n2=224), TASK, 80000, s) for s in S5]
57
- summary["Prizma-randlin-d64L2H2"] = solve_stats(rl)
58
- print(f" -> Prizma-rand_linear (control): {summary['Prizma-randlin-d64L2H2']}", flush=True)
59
-
60
- # TF d64L2H2: reuse the 3 cached P1 seeds (all 0.016) + 2 fresh for a clean 5-seed set.
61
- tf = []
62
- for s in S5:
63
- ck = f"p1.TF.d64L2H2.s{s}" if s < 3 else f"p2eff.TF-d64L2H2.s{s}"
64
- tf.append(run_cell(res, ck, tf_factory(64, 2, 2), TASK, 80000, s))
65
- summary["TF-d64L2H2"] = solve_stats(tf)
66
- print(f" -> TF (5-seed): {summary['TF-d64L2H2']}", flush=True)
67
-
68
- res["extra_summary"] = summary
69
- _save(res)
70
- print("\n==== EXTRA ARMS DONE ====", flush=True)
71
- print(json_summary(summary), flush=True)
72
-
73
-
74
- def json_summary(summary):
75
- import json
76
- return "===EXTRA_JSON===\n" + json.dumps(summary, indent=2)
77
-
78
-
79
- if __name__ == "__main__":
80
- main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
flop_ledger.py DELETED
@@ -1,152 +0,0 @@
1
- """SKEPTIC-C FLOP / throughput ledger — PARAMETERIZED over scale.
2
-
3
- Analytical per-token forward FLOPs for the matched-param TF vs Prizma-quad2 at seq T,
4
- per scale (d_model, H, L), plus the lever's marginal cost and the window-head share.
5
-
6
- Counts MACs*2 = FLOPs. Matmul [m,k]x[k,n] = 2*m*k*n FLOPs. Counted per SEQUENCE (all T
7
- tokens) for the training forward, then /T for per-token. Attention is counted at its
8
- TRUE causal O(T^2/2) training cost (honest, no over-count). Prizma's chunked_delta is
9
- counted at its true chunk-matmul cost; the window head both as-coded (full SDPA) and at
10
- its ideal banded cost.
11
-
12
- Run: python3 flop_ledger.py # prints both the legacy d64L2H2 and headline d128L4H4
13
- """
14
- import torch
15
- from seq.transformer import Transformer, TFConfig
16
- from seq.prizma_seq import PrizmaSeqLM, PrizmaSeqConfig
17
- from seq.common import param_count
18
-
19
- V = 512
20
- T = 384 # MixedMQAR(max_pairs=128): seq_len = 2*128 + 128 = 384
21
-
22
-
23
- def dff_of(d):
24
- return int(round(8 / 3 * d / 8) * 8)
25
-
26
-
27
- def mm(m, k, n): # FLOPs of [m,k]@[k,n]
28
- return 2 * m * k * n
29
-
30
-
31
- def tf_layer_flops_causal(T, d, H, dff):
32
- """Honest causal count: only lower-triangular pairs ~ T*(T+1)/2."""
33
- dh = d // H
34
- pairs = T * (T + 1) / 2
35
- return {
36
- "qkv_proj": mm(T, d, 3 * d),
37
- "attn_scores": H * 2 * pairs * dh, # sum over causal (i,j) of 2*dh
38
- "attn_AV": H * 2 * pairs * dh,
39
- "attn_out": mm(T, d, d),
40
- "mlp": mm(T, d, dff) + mm(T, d, dff) + mm(T, dff, d), # SwiGLU w1,w2,wo
41
- }
42
-
43
-
44
- def prizma_layer_flops(T, d, H, dff, d_phi, C=64, w=16, kc=4):
45
- dh = d // H
46
- f = {}
47
- f["conv"] = 2 * T * d * kc # depthwise causal conv k=4
48
- f["qkv_proj"] = mm(T, d, 3 * d)
49
- f["beta"] = mm(T, d, H)
50
- n2 = d_phi - dh
51
- f["phi_qk"] = H * T * (n2 * 1 + d_phi * 3) * 2 # quadratic monomials + l2 norm (generous)
52
- nC = T // C
53
- per_chunk = (mm(C, d_phi, C) # KK
54
- + mm(C, d_phi, dh) # KS0
55
- + 2 * C * C * dh # triangular solve (approx)
56
- + mm(C, d_phi, dh) # O_inter
57
- + mm(C, d_phi, C) # QK
58
- + 2 * C * C * dh # O_intra
59
- + mm(dh, C, d_phi)) # S update
60
- f["delta_state"] = H * nC * per_chunk
61
- f["window_full_TT"] = H * (mm(T, dh, T) + mm(T, T, dh)) # as-coded full SDPA + mask
62
- band_pairs = T * w - w * (w - 1) / 2
63
- f["window_band_ideal"] = H * 2 * band_pairs * dh * 2 # band-only scores+AV
64
- f["out_proj"] = mm(T, d, d)
65
- f["mlp"] = mm(T, d, dff) + mm(T, d, dff) + mm(T, dff, d)
66
- return f
67
-
68
-
69
- def total(fd, exclude=()):
70
- return sum(v for k, v in fd.items() if k not in exclude)
71
-
72
-
73
- def ledger(d, H, L, d_phi, T=T, label="", show_components=True):
74
- dff = dff_of(d)
75
- dh = d // H
76
- head_flops = mm(T, d, V)
77
- print(f"\n############### SCALE {label}: d={d}, H={H}, L={L}, d_h={dh}, d_ff={dff}, T={T} ###############")
78
-
79
- tfl = tf_layer_flops_causal(T, d, H, dff)
80
- tf_total = L * total(tfl) + head_flops
81
- if show_components:
82
- print("TRANSFORMER per-layer (causal-honest):")
83
- for k, v in tfl.items():
84
- print(f" {k:<14} {v/1e6:8.2f} MFLOP")
85
- print(f" TF: layer {total(tfl)/1e6:8.2f} MFLOP x{L}+head = {tf_total/1e6:8.2f} MFLOP/seq "
86
- f"= {tf_total/T/1e3:7.1f} kFLOP/token")
87
-
88
- pf = prizma_layer_flops(T, d, H, dff, d_phi=d_phi)
89
- ps_ascoded = total(pf, exclude=("window_band_ideal",))
90
- ps_ideal = total(pf, exclude=("window_full_TT",))
91
- ps_total_ascoded = L * ps_ascoded + head_flops
92
- ps_total_ideal = L * ps_ideal + head_flops
93
- if show_components:
94
- print(f"Prizma-quad2 (d_phi={d_phi}) per-layer:")
95
- for k, v in pf.items():
96
- print(f" {k:<18} {v/1e6:8.2f} MFLOP")
97
- print(f" Prizma as-coded: x{L}+head = {ps_total_ascoded/1e6:8.2f} MFLOP/seq = "
98
- f"{ps_total_ascoded/T/1e3:7.1f} kFLOP/token")
99
- print(f" Prizma ideal : x{L}+head = {ps_total_ideal/1e6:8.2f} MFLOP/seq = "
100
- f"{ps_total_ideal/T/1e3:7.1f} kFLOP/token")
101
- print(f" RATIO Prizma/TF forward: as-coded {ps_total_ascoded/tf_total:4.2f}x "
102
- f"ideal {ps_total_ideal/tf_total:4.2f}x")
103
-
104
- # lever marginal cost
105
- pf_none = prizma_layer_flops(T, d, H, dff, d_phi=dh)
106
- print(f" lever (d_phi {d_phi} vs {dh}): delta-state x{pf['delta_state']/pf_none['delta_state']:.1f} "
107
- f"| window_full share = {100*L*pf['window_full_TT']/ps_total_ascoded:4.1f}% as-coded, "
108
- f"band = {100*L*pf['window_band_ideal']/ps_total_ideal:4.1f}% ideal")
109
- return {"tf_per_tok": tf_total / T, "ps_ascoded_per_tok": ps_total_ascoded / T,
110
- "ps_ideal_per_tok": ps_total_ideal / T,
111
- "ratio_ascoded": ps_total_ascoded / tf_total, "ratio_ideal": ps_total_ideal / tf_total}
112
-
113
-
114
- def flop_matched_tf_search(d, H, L, d_phi, target_ratio, T=T):
115
- """Find a bigger TF (grow d_ff, then layers) whose forward FLOPs >= target_ratio x base TF.
116
- Returns candidates so the headline FLOP-matched arm can be sized from MEASURED FLOPs."""
117
- dff = dff_of(d)
118
- head = mm(T, d, V)
119
- base_tf = L * total(tf_layer_flops_causal(T, d, H, dff)) + head
120
- pf = prizma_layer_flops(T, d, H, dff, d_phi=d_phi)
121
- prizma_ascoded = L * total(pf, exclude=("window_band_ideal",)) + head
122
- print(f"\n=== FLOP-matched TF search @ d={d} H={H} L={L} (match Prizma-quad2 as-coded "
123
- f"{prizma_ascoded/T/1e3:.1f} kFLOP/tok) ===")
124
- # option A: deeper TF (more layers) at same width
125
- for L2 in range(L, 4 * L + 1):
126
- tot = L2 * total(tf_layer_flops_causal(T, d, H, dff)) + head
127
- if tot >= prizma_ascoded:
128
- print(f" deeper: TF d{d}L{L2}H{H} -> {tot/T/1e3:6.1f} kFLOP/tok "
129
- f"({tot/base_tf:.2f}x base, {tot/prizma_ascoded:.2f}x Prizma)")
130
- break
131
- # option B: wider d_model (keep L,H ratio) — FLOP ~ d^2
132
- for dm in range(d, 3 * d + 1, 16):
133
- if dm % H:
134
- continue
135
- tot = L * total(tf_layer_flops_causal(T, dm, H, dff_of(dm))) + mm(T, dm, V)
136
- if tot >= prizma_ascoded:
137
- print(f" wider : TF d{dm}L{L}H{H} -> {tot/T/1e3:6.1f} kFLOP/tok "
138
- f"({tot/base_tf:.2f}x base, {tot/prizma_ascoded:.2f}x Prizma)")
139
- break
140
-
141
-
142
- if __name__ == "__main__":
143
- print("Param counts (matched):")
144
- for (d, L, H) in [(64, 2, 2), (128, 4, 4)]:
145
- tf = Transformer(TFConfig(vocab=V, d_model=d, n_layers=L, n_heads=H, max_len=T + 8, rope=True))
146
- ps = PrizmaSeqLM(PrizmaSeqConfig(vocab=V, d_model=d, n_layers=L, n_heads=H, max_len=T + 8,
147
- feat_map="quad2", feat_n2=224))
148
- print(f" d{d}L{L}H{H}: TF {param_count(tf):,} Prizma-quad2 {param_count(ps):,}")
149
-
150
- ledger(64, 2, 2, d_phi=256, label="LEGACY d64L2H2")
151
- h = ledger(128, 4, 4, d_phi=256, label="HEADLINE d128L4H4")
152
- flop_matched_tf_search(128, 4, 4, d_phi=256, target_ratio=h["ratio_ascoded"])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
flop_match_width.py DELETED
@@ -1,37 +0,0 @@
1
- """Phase 2c — the FAIR (width-scaled) FLOP-matched Transformer arm.
2
-
3
- The depth-scaled FLOP-match (p2b, TF d128L9H4) confounds "more FLOPs" with "harder to optimize"
4
- (deep TFs fail on MQAR at this scale — see P1 depth-bimodality: L2 clean, L4 bimodal, L9→0.02).
5
- The FAIR FLOP-match keeps depth fixed (L=4) and scales WIDTH: TF d208L4H4 ≈ 4994 kFLOP/tok
6
- (1.11× Prizma-quad2's as-coded forward FLOPs; flop_ledger.py). This avoids the depth-trainability
7
- confound, so it is the honest test of "is Prizma's D=128 recall just spent compute?":
8
- - if d208L4H4 ALSO fails -> Prizma-quad2's matched-param recall is not reachable by a same-budget
9
- attention model at this scale (strong for Prizma);
10
- - if d208L4H4 SOLVES -> equal FLOPs via width lets attention solve too; Prizma's edge is then
11
- parameter-efficiency + O(1) memory, NOT raw capability (honest, still real).
12
-
13
- Writes p2c.* into the SAME $PRIZMA_RESULTS/gpu_bench.json (resumable). Run on Colab after extra_arms:
14
- PRIZMA_RESULTS=/content/drive/MyDrive/prizma_results python -u flop_match_width.py
15
- """
16
- from gpu_bench import run_cell, solve_stats, tf_factory, _load, _save, OUT, DEV
17
- from seq.tasks import MixedMQAR
18
-
19
- V = 512
20
- S3 = (0, 1, 2)
21
- TASK = lambda: MixedMQAR(vocab=V, max_pairs=128, num_queries=128, gap=0, min_pairs=1)
22
-
23
-
24
- def main():
25
- print(f"device={DEV} results={OUT} Phase 2c: FAIR width-scaled FLOP-matched TF d208L4H4 @ D=128", flush=True)
26
- res = _load()
27
- recs = [run_cell(res, f"p2c.TF-flopmatch-width-d208L4H4.s{s}", tf_factory(208, 4, 4), TASK, 80000, s)
28
- for s in S3]
29
- summary = {"TF-flopmatch-width-d208L4H4": solve_stats(recs)}
30
- res["p2c_summary"] = summary
31
- _save(res)
32
- print(f" -> {summary['TF-flopmatch-width-d208L4H4']}", flush=True)
33
- print("\n==== Phase 2c DONE ====", flush=True)
34
-
35
-
36
- if __name__ == "__main__":
37
- main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
gpu_bench.py CHANGED
@@ -1,8 +1,8 @@
1
  """Prizma-Seq vs Transformer — the rigorous, scaled D=128 benchmark, for a CUDA GPU (Colab).
2
 
3
- Answers, with multi-seed + fair protocol, the questions the committee R2 verdict demands:
4
  PHASE 1 Find the SMALLEST Transformer scale that genuinely SOLVES MQAR D=128 (the fair arena);
5
- this is also the committee rank-1 flip-test (does attention solve D=128 with enough
6
  scale/budget?). Multi-config x recipe x seed -> solve-rate.
7
  PHASE 2 At that scale S*: matched + FLOP-comparable head-to-head at D=128 (TF vs Prizma-none vs
8
  Prizma-quad2), >=5 seeds -> solve-rate + median + 95% CI. The headline fair comparison.
@@ -97,7 +97,7 @@ def solve_stats(recs):
97
 
98
  # ----------------------------------------------------------------------------------------------- #
99
  def phase1(res):
100
- """Smallest TF scale that SOLVES MQAR D=128 (fair arena + committee flip-test). Multi-seed."""
101
  print("\n==== PHASE 1: TF D=128 solving-scale search (mixed-D, gen-warm) ====", flush=True)
102
  V = 512
103
  task_fac = lambda: MixedMQAR(vocab=V, max_pairs=128, num_queries=128, gap=0, min_pairs=1)
 
1
  """Prizma-Seq vs Transformer — the rigorous, scaled D=128 benchmark, for a CUDA GPU (Colab).
2
 
3
+ Answers, with multi-seed + fair protocol, the questions the pre-registered protocol demands:
4
  PHASE 1 Find the SMALLEST Transformer scale that genuinely SOLVES MQAR D=128 (the fair arena);
5
+ this is also the rank-1 flip-test (does attention solve D=128 with enough
6
  scale/budget?). Multi-config x recipe x seed -> solve-rate.
7
  PHASE 2 At that scale S*: matched + FLOP-comparable head-to-head at D=128 (TF vs Prizma-none vs
8
  Prizma-quad2), >=5 seeds -> solve-rate + median + 95% CI. The headline fair comparison.
 
97
 
98
  # ----------------------------------------------------------------------------------------------- #
99
  def phase1(res):
100
+ """Smallest TF scale that SOLVES MQAR D=128 (fair arena + flip-test). Multi-seed."""
101
  print("\n==== PHASE 1: TF D=128 solving-scale search (mixed-D, gen-warm) ====", flush=True)
102
  V = 512
103
  task_fac = lambda: MixedMQAR(vocab=V, max_pairs=128, num_queries=128, gap=0, min_pairs=1)
gpu_diag.py CHANGED
@@ -4,7 +4,7 @@ MQAR D=128). Mirrors `gpu_bench.py` EXACTLY in structure/protocol and REUSES its
4
  (`run_cell`, `solve_stats`, `_load`, `_save`, `tf_factory`, `ps_factory`, `GENWARM`, `DEV`) so the
5
  two runners compose into the same `$PRIZMA_RESULTS` directory.
6
 
7
- Pre-registered protocol (`docs/superpowers/specs/2026-06-05-...-design.md` §1), matched + fair:
8
 
9
  PARAM-MATCHED ARENA primary scale d128L2H4 (~461K params) — the SAME scale at which the tuned TF
10
  cleanly SOLVES MQAR D=128 in gpu_bench.py (best~1.0), so it is a genuine
 
4
  (`run_cell`, `solve_stats`, `_load`, `_save`, `tf_factory`, `ps_factory`, `GENWARM`, `DEV`) so the
5
  two runners compose into the same `$PRIZMA_RESULTS` directory.
6
 
7
+ Pre-registered protocol (`docs/PRIZMA_SEQ_SPEC.md` §1), matched + fair:
8
 
9
  PARAM-MATCHED ARENA primary scale d128L2H4 (~461K params) — the SAME scale at which the tuned TF
10
  cleanly SOLVES MQAR D=128 in gpu_bench.py (best~1.0), so it is a genuine
mixed_test.py DELETED
@@ -1,52 +0,0 @@
1
- """Engineer-a-path test: does MIXED-difficulty MQAR training (variable #pairs/batch, the standard
2
- Zoology distribution) make TARGET-D recall learnable where fixed-D training stalls at chance?
3
-
4
- Trains the matched tiny TF, Prizma-none, and Prizma-quad2 on MixedMQAR(pairs 1..target), evaluates at
5
- the FIXED target D, seed 0, punchy short-warmup schedule. If the TF now solves -> the path is found
6
- (fair, applies to both); and we read off whether the zero-param quad2 lever holds Prizma at parity.
7
-
8
- Run: python3.13 mixed_test.py [target_pairs] # default 64
9
- """
10
- from __future__ import annotations
11
-
12
- import sys
13
- import time
14
-
15
- from seq.common import TrainConfig, train_model, param_count, get_device
16
- from seq.tasks import MixedMQAR
17
- from seq.transformer import Transformer, TFConfig
18
- from seq.prizma_seq import PrizmaSeqLM, PrizmaSeqConfig
19
-
20
- DEV = get_device()
21
- PUNCHY = dict(lr=1e-3, warmup=200, warmup_frac=0.0, min_lr_frac=0.1)
22
-
23
-
24
- def main():
25
- target = int(sys.argv[1]) if len(sys.argv) > 1 else 64
26
- V = max(64, 4 * target)
27
- task = MixedMQAR(vocab=V, max_pairs=target, num_queries=128, gap=0, min_pairs=1)
28
- T = task.seq_len
29
-
30
- def tf():
31
- return Transformer(TFConfig(vocab=V, d_model=64, n_layers=2, n_heads=2, max_len=T + 8, rope=True))
32
-
33
- def ps():
34
- return PrizmaSeqLM(PrizmaSeqConfig(vocab=V, d_model=64, n_layers=2, n_heads=2, max_len=T + 8))
35
-
36
- def psq():
37
- return PrizmaSeqLM(PrizmaSeqConfig(vocab=V, d_model=64, n_layers=2, n_heads=2, max_len=T + 8,
38
- feat_map="quad2", feat_n2=96))
39
-
40
- print(f"device={DEV} {task.name} eval@D={target} seq={T}", flush=True)
41
- for name, make in [("Transformer", tf), ("Prizma-none", ps), ("Prizma-quad2", psq)]:
42
- m = make()
43
- p = param_count(m)
44
- cfg = TrainConfig(steps=12000, batch_size=64, log=True, eval_every=1000, **PUNCHY)
45
- t0 = time.time()
46
- r = train_model(m, task, cfg, DEV, seed=0)
47
- print(f">>> {name:<12} best@D{target}={r.best_acc:.3f} plateau@{r.steps_to_plateau} "
48
- f"({time.time() - t0:.0f}s, {p}p)", flush=True)
49
-
50
-
51
- if __name__ == "__main__":
52
- main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
parity_d64.py DELETED
@@ -1,61 +0,0 @@
1
- """Decisive D=64 head-to-head under the IDENTICAL protocol the Transformer won on (gen-warm:
2
- lr=1e-3, warmup=2000; large cap + plateau-stop), mixed-D training, eval@D=64. TF already = 1.000.
3
- Runs Prizma-quad2 (lever #1) then Prizma-none (ablation control) so the comparison and the causal
4
- ablation share the exact same fair settings. quad2 ran punchy/12k before (0.906, still climbing);
5
- this gives it the same generous budget as the TF.
6
-
7
- Run: python3.13 parity_d64.py
8
- """
9
- from __future__ import annotations
10
-
11
- import json
12
- import os
13
- import time
14
-
15
- from seq.common import TrainConfig, train_model, param_count, get_device
16
- from seq.tasks import MixedMQAR
17
- from seq.prizma_seq import PrizmaSeqLM, PrizmaSeqConfig
18
-
19
- DEV = get_device()
20
- RES = os.path.join(os.path.dirname(__file__), "results")
21
- OUT = os.path.join(RES, "parity_d64.json")
22
- TARGET, CAP = 64, 30000
23
- V = max(64, 4 * TARGET)
24
- GENWARM = dict(lr=1e-3, warmup=2000, warmup_frac=0.0, min_lr_frac=0.1)
25
-
26
-
27
- def ps_quad(T):
28
- return PrizmaSeqLM(PrizmaSeqConfig(vocab=V, d_model=64, n_layers=2, n_heads=2, max_len=T + 8,
29
- feat_map="quad2", feat_n2=96))
30
-
31
-
32
- def ps_none(T):
33
- return PrizmaSeqLM(PrizmaSeqConfig(vocab=V, d_model=64, n_layers=2, n_heads=2, max_len=T + 8))
34
-
35
-
36
- def main():
37
- task = MixedMQAR(vocab=V, max_pairs=TARGET, num_queries=128, gap=0, min_pairs=1)
38
- T = task.seq_len
39
- res = json.load(open(OUT)) if os.path.exists(OUT) else {}
40
- res.setdefault("_baseline", {"Transformer_genwarm": 1.000})
41
- print(f"device={DEV} {task.name} eval@D={TARGET} seq={T} protocol=gen-warm cap={CAP} (TF=1.000)",
42
- flush=True)
43
- for name, make in [("Prizma-quad2", ps_quad), ("Prizma-none", ps_none)]: # quad2 first (priority)
44
- if name in res and "best" in res[name]:
45
- print(f" {name}: (cached best={res[name]['best']:.3f})", flush=True)
46
- continue
47
- m = make(T)
48
- p = param_count(m)
49
- cfg = TrainConfig(steps=CAP, batch_size=64, log=True, eval_every=3000, **GENWARM)
50
- t0 = time.time()
51
- r = train_model(m, task, cfg, DEV, seed=0)
52
- res[name] = {"best": r.best_acc, "plateau": r.steps_to_plateau, "params": p,
53
- "sec": round(time.time() - t0, 1)}
54
- json.dump(res, open(OUT, "w"), indent=2)
55
- print(f">>> {name:<12} best@D{TARGET}={r.best_acc:.3f} plateau@{r.steps_to_plateau} "
56
- f"({res[name]['sec']}s, {p}p) vs TF=1.000", flush=True)
57
- print(f"\nsaved -> {OUT}", flush=True)
58
-
59
-
60
- if __name__ == "__main__":
61
- main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ torch
2
+ numpy
3
+ matplotlib
results/calib_budget.log DELETED
@@ -1,4 +0,0 @@
1
- device=mps rungs=['rung2', 'rung3'] steps=12000 lrs=(0.001, 0.002, 0.003) seed=0
2
-
3
- ==== CALIB rung2: MQAR{'vocab': 96, 'num_pairs': 32, 'num_queries': 160, 'gap': 0} (seq=224) ====
4
- [rung2] Transformer lr=1e-03: best=0.096 final=0.096 solve@0.9=None (1476.3s, 103744p)
 
 
 
 
 
results/calib_mqar.txt DELETED
@@ -1,17 +0,0 @@
1
- CALIBRATION MQAR(V=40,pairs=16,q=96,gap=0)
2
- --- Transformer 8000 steps (floor 0.1) ---
3
- step 1000 loss 3.2241 acc 0.1110 lr 9.72e-04
4
- step 2000 loss 3.0757 acc 0.1313 lr 8.78e-04
5
- step 3000 loss 0.3182 acc 0.8477 lr 7.33e-04
6
- step 4000 loss 0.2743 acc 0.8563 lr 5.59e-04
7
- step 5000 loss 0.2644 acc 0.8638 lr 3.84e-04
8
- step 6000 loss 0.2445 acc 0.8734 lr 2.35e-04
9
- step 7000 loss 0.2253 acc 0.8775 lr 1.35e-04
10
- step 8000 loss 0.2485 acc 0.8862 lr 1.00e-04
11
- >>> Transformer 8000: best=0.886 189s
12
- --- Prizma-Seq 4000 steps (floor 0.1) ---
13
- step 1000 loss 0.5607 acc 0.8337 lr 8.87e-04
14
- step 2000 loss 0.3914 acc 0.8629 lr 5.68e-04
15
- step 3000 loss 0.0354 acc 0.9858 lr 2.39e-04
16
- step 4000 loss 0.0157 acc 0.9949 lr 1.00e-04
17
- >>> Prizma-Seq 4000: best=0.995 422s
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
results/cap_probe.log DELETED
@@ -1,5 +0,0 @@
1
- device=mps D=[64, 128] LRs=(0.001, 0.002) seed=0 (plateau early-stop; frozen eval)
2
-
3
- ==== CAP D=64 (V=256, seq=256, cap=16000) ====
4
- [D64] Transformer lr=1e-03: best=0.035 final=0.035 plateau@16000 (906.0s, 113984p)
5
- [D64] Transformer lr=2e-03: best=0.037 final=0.037 plateau@16000 (898.4s, 113984p)
 
 
 
 
 
 
results/console.txt DELETED
@@ -1,46 +0,0 @@
1
-
2
- ======================================================================
3
- E1 MAIN COMPARISON (structured-permuted, distinguishable)
4
- ======================================================================
5
- (EWC lambda tuned to 50, FGT=0.417 on seed 0)
6
- backprop ACC=0.445±0.025 FGT=0.553±0.026
7
- EWC ACC=0.456±0.019 FGT=0.411±0.020
8
- replay(boundaries) ACC=0.737±0.011 FGT=0.156±0.009
9
- oracle_multihead ACC=0.879±0.011 FGT=0.000±0.000
10
- Prizma(DFA,no W^T) ACC=0.834±0.015 FGT=0.000±0.000
11
- PRIZMA_exactW^T ACC=0.708±0.021 FGT=0.000±0.000
12
- PRIZMA_noRoute(ablation) ACC=0.446±0.024 FGT=0.489±0.023
13
- [params] backprop/EWC=20744 Prizma(trainable)=22144
14
-
15
- ======================================================================
16
- E2 SEPARABILITY SWEEP (noise blurs domains -> find the boundary)
17
- ======================================================================
18
- noise=0.0 Prizma: ACC=0.827 FGT=0.000 (committed~5) | backprop: ACC=0.433 FGT=0.562
19
- noise=0.3 Prizma: ACC=0.721 FGT=0.016 (committed~5) | backprop: ACC=0.299 FGT=0.608
20
- noise=0.6 Prizma: ACC=0.557 FGT=0.052 (committed~5) | backprop: ACC=0.261 FGT=0.508
21
- noise=0.9 Prizma: ACC=0.430 FGT=0.073 (committed~5) | backprop: ACC=0.239 FGT=0.421
22
- noise=1.2 Prizma: ACC=0.344 FGT=0.077 (committed~5) | backprop: ACC=0.222 FGT=0.350
23
-
24
- ======================================================================
25
- E3 CAPACITY SWEEP (n_experts vs K=5 domains)
26
- ======================================================================
27
- experts=3 (K=5): ACC=0.556 FGT=0.000
28
- experts=4 (K=5): ACC=0.692 FGT=0.000
29
- experts=5 (K=5): ACC=0.827 FGT=0.000
30
- experts=6 (K=5): ACC=0.827 FGT=0.000
31
- experts=8 (K=5): ACC=0.827 FGT=0.000
32
-
33
- ======================================================================
34
- E4 LOCALITY: Prizma with RANDOM feedback (DFA, no W^T) vs exact (P2)
35
- ======================================================================
36
- feedback=exact : ACC=0.691 FGT=0.000
37
- feedback=random : ACC=0.827 FGT=0.000
38
-
39
- ======================================================================
40
- E5 IMPOSSIBLE-REGIME CONTROL (rotating-checkerboard, ambiguous)
41
- ======================================================================
42
- single-head ORACLE ceiling (per-x majority) = 0.780
43
- Prizma final ACC = 0.570 backprop final ACC = 0.694
44
- => Prizma does NOT exceed the ceiling: honest boundary confirmed (OK)
45
-
46
- Saved -> /Users/nazmi/Desktop/Projeler/proje/Prizma/experiments/../results/results.json (total 70.6s)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
results/d128_sweep.log DELETED
@@ -1,51 +0,0 @@
1
- device=mps MixedMQAR(V=512,pairs=1-128,q=128,gap=0) eval@D=128 seq=384 protocol=gen-warm
2
- step 3000 loss 5.2038 acc 0.0124 lr 9.99e-04
3
- step 6000 loss 5.1647 acc 0.0133 lr 9.89e-04
4
- step 9000 loss 1.4666 acc 0.0133 lr 9.68e-04
5
- step 12000 loss 5.2910 acc 0.0138 lr 9.36e-04
6
- step 15000 loss 0.0015 acc 0.0139 lr 8.93e-04
7
- step 18000 loss 5.2780 acc 0.0141 lr 8.41e-04
8
- step 21000 loss 2.7127 acc 0.0143 lr 7.82e-04
9
- step 24000 loss 5.1024 acc 0.0148 lr 7.17e-04
10
- step 27000 loss 4.6019 acc 0.0152 lr 6.47e-04
11
- step 30000 loss 5.2976 acc 0.0149 lr 5.74e-04
12
- step 33000 loss 4.4828 acc 0.0155 lr 5.01e-04
13
- step 36000 loss 5.3124 acc 0.0156 lr 4.30e-04
14
- step 39000 loss 5.3425 acc 0.0155 lr 3.61e-04
15
- step 42000 loss 4.5324 acc 0.0160 lr 2.97e-04
16
- step 45000 loss 2.3681 acc 0.0159 lr 2.41e-04
17
- step 48000 loss 5.0900 acc 0.0159 lr 1.92e-04
18
- step 51000 loss 3.5009 acc 0.0162 lr 1.52e-04
19
- step 54000 loss 0.0003 acc 0.0161 lr 1.24e-04
20
- step 57000 loss 5.2412 acc 0.0161 lr 1.06e-04
21
- step 60000 loss 5.2287 acc 0.0159 lr 1.00e-04
22
- >>> Transformer best@D128=0.016 plateau@60000 (4176.2s, 130368p)
23
- step 3000 loss 0.9980 acc 0.2821 lr 9.98e-04
24
- step 6000 loss 0.0187 acc 0.8550 lr 9.76e-04
25
- step 9000 loss 0.0026 acc 0.9500 lr 9.27e-04
26
- step 12000 loss 0.0146 acc 0.9591 lr 8.55e-04
27
- step 15000 loss 0.0000 acc 0.9747 lr 7.64e-04
28
- step 18000 loss 0.0032 acc 0.9960 lr 6.61e-04
29
- step 21000 loss 0.0011 acc 0.9941 lr 5.50e-04
30
- step 24000 loss 0.0017 acc 0.9984 lr 4.40e-04
31
- step 27000 loss 0.0002 acc 0.9988 lr 3.36e-04
32
- step 30000 loss 0.0017 acc 0.9991 lr 2.45e-04
33
- step 33000 loss 0.0004 acc 0.9995 lr 1.73e-04
34
- >>> Prizma-quad2-256 best@D128=0.999 plateau@33000 (12969.0s, 131400p)
35
- step 3000 loss 4.8973 acc 0.0193 lr 9.98e-04
36
- step 6000 loss 1.2378 acc 0.1866 lr 9.76e-04
37
- step 9000 loss 0.0022 acc 0.2438 lr 9.27e-04
38
- step 12000 loss 1.5969 acc 0.2677 lr 8.55e-04
39
- step 15000 loss 0.0018 acc 0.2948 lr 7.64e-04
40
- step 18000 loss 1.5152 acc 0.3012 lr 6.61e-04
41
- step 21000 loss 0.0009 acc 0.3178 lr 5.50e-04
42
- step 24000 loss 0.4620 acc 0.3204 lr 4.40e-04
43
- step 27000 loss 0.0253 acc 0.3273 lr 3.36e-04
44
- step 30000 loss 2.1449 acc 0.3349 lr 2.45e-04
45
- step 33000 loss 0.0238 acc 0.3453 lr 1.73e-04
46
- step 36000 loss 2.4204 acc 0.3572 lr 1.24e-04
47
- step 39000 loss 2.6356 acc 0.3656 lr 1.02e-04
48
- step 40000 loss 0.1385 acc 0.3688 lr 1.00e-04
49
- >>> Prizma-none best@D128=0.369 plateau@40000 (8712.1s, 131400p)
50
-
51
- saved -> /Users/nazmi/Desktop/Projeler/proje/Prizma/results/d128_sweep.json
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
results/feat_map_probe.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "none": {
3
+ "mean": 0.14227852290069304,
4
+ "std": 0.0011763334632490725,
5
+ "min": 0.1390841277452942,
6
+ "max": 0.1468252103267044,
7
+ "n_trials": 256,
8
+ "d_phi": 32
9
+ },
10
+ "quad2": {
11
+ "mean": 0.11698661828318985,
12
+ "std": 0.0010320428461662687,
13
+ "min": 0.11408642900063976,
14
+ "max": 0.1202295460747591,
15
+ "n_trials": 256,
16
+ "d_phi": 256
17
+ },
18
+ "quad2_lowrank": {
19
+ "mean": 0.12648030188625842,
20
+ "std": 0.0013592200523883011,
21
+ "min": 0.12251510400279456,
22
+ "max": 0.13050031949695792,
23
+ "n_trials": 256,
24
+ "d_phi": 137
25
+ },
26
+ "_meta": {
27
+ "D": 128,
28
+ "d_h": 32,
29
+ "n_trials": 256,
30
+ "seed": 42,
31
+ "feat_n2_quad2": 224,
32
+ "feat_rank_lowrank": 14,
33
+ "gap_lr_vs_quad2": 0.00949368360306857,
34
+ "abs_pass": false,
35
+ "rel_pass": true,
36
+ "half_pass": true,
37
+ "overall": true,
38
+ "theory_none": 0.14104739588693907,
39
+ "theory_quad2": 0.04986778505017909,
40
+ "theory_lowrank": 0.06816787844959026,
41
+ "note": "Absolute bar 0.085 was calibrated by plan author against a different probe baseline. The BINDING criterion here is rel_pass (|gap|<=0.010) + half_pass (d_phi<=60% of quad2). For the end-to-end gate, see Task 1.D amendment: >=10-seed MQAR-D128 on A100."
42
+ }
43
+ }
results/figure.png CHANGED

Git LFS Details

  • SHA256: e7a764e06f53f0204f03c008c20b16c689221e61f19ecd9f0037f264887e0f9c
  • Pointer size: 131 Bytes
  • Size of remote file: 121 kB

Git LFS Details

  • SHA256: 85d926ffe816031fdfe28157f8b221d816934eba1d711c1e0f95126517257f53
  • Pointer size: 131 Bytes
  • Size of remote file: 121 kB
results/matrix_run.log DELETED
@@ -1,14 +0,0 @@
1
- ######## CORRECTED MATRIX START (04:20:47) — symmetric LR sweep + measured mem + fair ablations ########
2
- ######## RUN_BAR b1 seeds=3 (04:20:47) ########
3
- device=mps which=b1 seeds=(0, 1, 2)
4
-
5
- == B1 rung1: MQAR(V=64,keys<32,pairs=16,q=96,gap=0) (seq=128, steps=6000) ==
6
- [B1-rung1] Transformer lr=1e-03: med=1.000 accs=[1.0, 1.0, 0.99] (101696p)
7
- [B1-rung1] Transformer lr=2e-03: med=0.149 accs=[0.149, 0.747, 0.149] (101696p)
8
- [B1-rung1] Transformer => best_lr=1e-03 median=1.000 solved=3/3
9
- [B1-rung1] Prizma-Seq lr=1e-03: med=0.998 accs=[0.994, 0.999, 0.998] (102728p)
10
- [B1-rung1] Prizma-Seq lr=2e-03: med=0.998 accs=[0.991, 1.0, 0.998] (102728p)
11
- [B1-rung1] Prizma-Seq => best_lr=2e-03 median=0.998 solved=3/3
12
-
13
- == B1 rung2: MQAR(V=96,keys<48,pairs=32,q=160,gap=0) (seq=224, steps=7000) ==
14
- [B1-rung2] Transformer lr=1e-03: med=0.095 accs=[0.095, 0.094, 0.095] (103744p)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
results/mixed_test.log DELETED
@@ -1,40 +0,0 @@
1
- device=mps MixedMQAR(V=256,pairs=1-64,q=128,gap=0) eval@D=64 seq=256
2
- step 1000 loss 1.8047 acc 0.0294 lr 9.90e-04
3
- step 2000 loss 4.5350 acc 0.0306 lr 9.49e-04
4
- step 3000 loss 4.5191 acc 0.0312 lr 8.81e-04
5
- step 4000 loss 0.8262 acc 0.0324 lr 7.89e-04
6
- step 5000 loss 3.9630 acc 0.0320 lr 6.80e-04
7
- step 6000 loss 4.4627 acc 0.0321 lr 5.62e-04
8
- step 7000 loss 4.4946 acc 0.0326 lr 4.43e-04
9
- step 8000 loss 3.2730 acc 0.0325 lr 3.32e-04
10
- step 9000 loss 1.2057 acc 0.0327 lr 2.36e-04
11
- step 10000 loss 3.8864 acc 0.0328 lr 1.62e-04
12
- step 11000 loss 4.4845 acc 0.0331 lr 1.16e-04
13
- step 12000 loss 1.8521 acc 0.0335 lr 1.00e-04
14
- >>> Transformer best@D64=0.033 plateau@12000 (526s, 113984p)
15
- step 1000 loss 2.8407 acc 0.0256 lr 9.90e-04
16
- step 2000 loss 3.6092 acc 0.0935 lr 9.49e-04
17
- step 3000 loss 3.2551 acc 0.1171 lr 8.81e-04
18
- step 4000 loss 0.1211 acc 0.1239 lr 7.89e-04
19
- step 5000 loss 1.2323 acc 0.1789 lr 6.80e-04
20
- step 6000 loss 2.4834 acc 0.1825 lr 5.62e-04
21
- step 7000 loss 2.6330 acc 0.1861 lr 4.43e-04
22
- step 8000 loss 0.5064 acc 0.1909 lr 3.32e-04
23
- step 9000 loss 0.0415 acc 0.2456 lr 2.36e-04
24
- step 10000 loss 0.6505 acc 0.2579 lr 1.62e-04
25
- step 11000 loss 2.1059 acc 0.2625 lr 1.16e-04
26
- step 12000 loss 0.0601 acc 0.2640 lr 1.00e-04
27
- >>> Prizma-none best@D64=0.264 plateau@12000 (1992s, 115016p)
28
- step 1000 loss 2.8925 acc 0.0255 lr 9.90e-04
29
- step 2000 loss 3.0950 acc 0.1687 lr 9.49e-04
30
- step 3000 loss 1.0167 acc 0.5892 lr 8.81e-04
31
- step 4000 loss 0.0557 acc 0.7209 lr 7.89e-04
32
- step 5000 loss 0.0367 acc 0.7823 lr 6.80e-04
33
- step 6000 loss 0.2370 acc 0.8418 lr 5.62e-04
34
- step 7000 loss 0.2212 acc 0.8726 lr 4.43e-04
35
- step 8000 loss 0.0060 acc 0.8858 lr 3.32e-04
36
- step 9000 loss 0.0111 acc 0.8955 lr 2.36e-04
37
- step 10000 loss 0.0084 acc 0.9002 lr 1.62e-04
38
- step 11000 loss 0.1539 acc 0.9028 lr 1.16e-04
39
- step 12000 loss 0.0063 acc 0.9063 lr 1.00e-04
40
- >>> Prizma-quad2 best@D64=0.906 plateau@12000 (2737s, 115016p)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
results/parity_d64.log DELETED
@@ -1,24 +0,0 @@
1
- device=mps MixedMQAR(V=256,pairs=1-64,q=128,gap=0) eval@D=64 seq=256 protocol=gen-warm cap=30000 (TF=1.000)
2
- step 3000 loss 0.2058 acc 0.8719 lr 9.97e-04
3
- step 6000 loss 0.0093 acc 0.9847 lr 9.55e-04
4
- step 9000 loss 0.0002 acc 0.9936 lr 8.68e-04
5
- step 12000 loss 0.0000 acc 0.9972 lr 7.45e-04
6
- step 15000 loss 0.0000 acc 0.9977 lr 6.00e-04
7
- step 18000 loss 0.0000 acc 0.9983 lr 4.50e-04
8
- step 21000 loss 0.0000 acc 0.9990 lr 3.11e-04
9
- step 24000 loss 0.0008 acc 0.9994 lr 1.98e-04
10
- step 27000 loss 0.0000 acc 0.9995 lr 1.25e-04
11
- >>> Prizma-quad2 best@D64=1.000 plateau@27000 (5892.1s, 115016p) vs TF=1.000
12
- step 3000 loss 2.0665 acc 0.3142 lr 9.97e-04
13
- step 6000 loss 0.2867 acc 0.7691 lr 9.55e-04
14
- step 9000 loss 0.0013 acc 0.8466 lr 8.68e-04
15
- step 12000 loss 0.0023 acc 0.8821 lr 7.45e-04
16
- step 15000 loss 0.0000 acc 0.8937 lr 6.00e-04
17
- step 18000 loss 0.0020 acc 0.9120 lr 4.50e-04
18
- step 21000 loss 0.0006 acc 0.9198 lr 3.11e-04
19
- step 24000 loss 0.1088 acc 0.9241 lr 1.98e-04
20
- step 27000 loss 0.0024 acc 0.9287 lr 1.25e-04
21
- step 30000 loss 0.0104 acc 0.9310 lr 1.00e-04
22
- >>> Prizma-none best@D64=0.931 plateau@30000 (5155.1s, 115016p) vs TF=1.000
23
-
24
- saved -> /Users/nazmi/Desktop/Projeler/proje/Prizma/results/parity_d64.json
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
results/ps_conv_curve.txt DELETED
@@ -1,12 +0,0 @@
1
- Prizma-Seq +conv on MQAR(V=64,keys<32,pairs=16,q=96,gap=0)
2
- step 300 loss 3.2718 acc 0.0941 lr 9.90e-04
3
- step 600 loss 2.8159 acc 0.1424 lr 9.36e-04
4
- step 900 loss 2.6570 acc 0.1383 lr 8.42e-04
5
- step 1200 loss 2.5691 acc 0.1396 lr 7.17e-04
6
- step 1500 loss 2.5387 acc 0.1388 lr 5.75e-04
7
- step 1800 loss 2.5156 acc 0.1455 lr 4.30e-04
8
- step 2100 loss 2.4899 acc 0.1456 lr 2.98e-04
9
- step 2400 loss 2.5110 acc 0.1499 lr 1.92e-04
10
- step 2700 loss 2.4915 acc 0.1499 lr 1.24e-04
11
- step 3000 loss 2.5043 acc 0.1495 lr 1.00e-04
12
- >>> Prizma-Seq +conv: best=0.150 344s
 
 
 
 
 
 
 
 
 
 
 
 
 
results/ps_disjoint_curve.txt DELETED
@@ -1,12 +0,0 @@
1
- Prizma-Seq on MQAR(V=64,keys<32,pairs=16,q=96,gap=0)
2
- step 300 loss 2.7657 acc 0.1446 lr 9.90e-04
3
- step 600 loss 2.5337 acc 0.1393 lr 9.36e-04
4
- step 900 loss 2.5153 acc 0.1366 lr 8.42e-04
5
- step 1200 loss 2.5169 acc 0.1418 lr 7.17e-04
6
- step 1500 loss 2.5151 acc 0.1415 lr 5.75e-04
7
- step 1800 loss 2.5010 acc 0.1449 lr 4.30e-04
8
- step 2100 loss 2.4771 acc 0.1441 lr 2.98e-04
9
- step 2400 loss 2.4970 acc 0.1503 lr 1.92e-04
10
- step 2700 loss 2.4814 acc 0.1498 lr 1.24e-04
11
- step 3000 loss 2.4994 acc 0.1482 lr 1.00e-04
12
- >>> Prizma-Seq disjoint: best=0.150 320s
 
 
 
 
 
 
 
 
 
 
 
 
 
results/ps_norope_curve.txt DELETED
@@ -1,12 +0,0 @@
1
- Prizma-Seq conv+NoRoPE on MQAR(V=64,keys<32,pairs=16,q=96,gap=0)
2
- step 250 loss 3.3380 acc 0.0836 lr 9.91e-04
3
- step 500 loss 2.9933 acc 0.1261 lr 9.40e-04
4
- step 750 loss 2.7636 acc 0.1397 lr 8.47e-04
5
- step 1000 loss 2.6186 acc 0.1393 lr 7.23e-04
6
- step 1250 loss 2.5622 acc 0.1392 lr 5.80e-04
7
- step 1500 loss 2.5347 acc 0.1387 lr 4.34e-04
8
- step 1750 loss 2.5340 acc 0.1426 lr 3.00e-04
9
- step 2000 loss 2.5388 acc 0.1421 lr 1.93e-04
10
- step 2250 loss 2.5183 acc 0.1436 lr 1.24e-04
11
- step 2500 loss 2.4930 acc 0.1428 lr 1.00e-04
12
- >>> Prizma-Seq conv+NoRoPE: best=0.144 295s
 
 
 
 
 
 
 
 
 
 
 
 
 
results/scale_frontier.log DELETED
@@ -1,7 +0,0 @@
1
- device=mps D=[64] configs=['d128L2H4', 'd128L4H4'] seeds=(0,) recipe=punchy
2
-
3
- ==== SCALE FRONTIER D=64 (V=256, seq=256, cap=12000) ====
4
- [D64] d128L2H4 seed0: best=0.041 plateau@12000 (1391.3s, 428672p) -> no
5
- [D64] d128L4H4 seed0: best=0.041 plateau@12000 (2642.5s, 824448p) -> no
6
-
7
- saved -> /Users/nazmi/Desktop/Projeler/proje/Prizma/results/scale_frontier.json
 
 
 
 
 
 
 
 
results/smoke_mqar.txt DELETED
@@ -1,16 +0,0 @@
1
- device mps
2
- task MQAR(V=40,pairs=16,q=96,gap=0) seq_len 128
3
- --- Transformer (100160 params) ---
4
- step 500 loss 3.3061 acc 0.1047 lr 9.33e-04
5
- step 1000 loss 3.2077 acc 0.1147 lr 6.92e-04
6
- step 1500 loss 3.1557 acc 0.1172 lr 3.71e-04
7
- step 2000 loss 2.9213 acc 0.1757 lr 1.04e-04
8
- step 2500 loss 2.7681 acc 0.2362 lr 4.28e-10
9
- >>> Transformer: best=0.236 final=0.236 60s
10
- --- Prizma-Seq (100420 params) ---
11
- step 500 loss 0.9282 acc 0.7790 lr 9.33e-04
12
- step 1000 loss 0.5256 acc 0.8340 lr 6.92e-04
13
- step 1500 loss 0.4150 acc 0.8601 lr 3.71e-04
14
- step 2000 loss 0.3124 acc 0.8707 lr 1.04e-04
15
- step 2500 loss 0.3502 acc 0.8673 lr 4.28e-10
16
- >>> Prizma-Seq: best=0.871 final=0.867 239s
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
results/stability_test.txt DELETED
@@ -1,13 +0,0 @@
1
- STABILITY TEST (warmup 10%): rung1, 5 seeds
2
- Transformer seed0: 0.149 (148s)
3
- Transformer seed1: 1.000 (145s)
4
- Transformer seed2: 0.991 (144s)
5
- Transformer seed3: 0.152 (148s)
6
- Transformer seed4: 0.153 (150s)
7
- >>> Transformer: mean=0.489 min=0.149 solved(>0.9)=2/5
8
- Prizma-Seq seed0: 0.994 (580s)
9
- Prizma-Seq seed1: 0.998 (581s)
10
- Prizma-Seq seed2: 0.995 (838s)
11
- Prizma-Seq seed3: 0.998 (919s)
12
- Prizma-Seq seed4: 0.984 (801s)
13
- >>> Prizma-Seq: mean=0.994 min=0.984 solved(>0.9)=5/5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
results/tf_baseline_quick.txt DELETED
@@ -1,3 +0,0 @@
1
- device=mps seeds=(0,)
2
- [Transformer] induction seed0: acc=0.079 params=408832 110s
3
- [Transformer] induction => 0.079 ± 0.000 (params 408832)
 
 
 
 
results/tf_d128_scale.log DELETED
@@ -1,6 +0,0 @@
1
- device=mps MixedMQAR(V=512,pairs=1-128,q=128,gap=0) eval@D=128 seq=384 gen-warm cap=60000
2
- step 3000 loss 4.8787 acc 0.0173 lr 9.99e-04
3
- step 6000 loss 4.8387 acc 0.0182 lr 9.89e-04
4
- step 9000 loss 1.3319 acc 0.0180 lr 9.68e-04
5
- step 12000 loss 4.8441 acc 0.0236 lr 9.36e-04
6
- step 15000 loss 0.0110 acc 0.1932 lr 8.93e-04