betterwithage commited on
Commit
4c8ba3e
·
verified ·
1 Parent(s): b3b529d

feat(frontier): test-time-compute + SSM + Genie surfaces + tabs (organs on killinchu)

Browse files

Surfaces 16-18. Poll killinchu cross-origin. MODELED. Nothing in locked-8; Lambda stays Conjecture 1.

static/3d/holographic.html CHANGED
@@ -74,6 +74,9 @@ const SURFACES = [
74
  { id: "worldmodel", title: "World Model", mod: "/static/3d/surfaces/worldmodel.js" },
75
  { id: "qec", title: "Topological QEC", mod: "/static/3d/surfaces/qec.js" },
76
  { id: "episodic", title: "Episodic Memory", mod: "/static/3d/surfaces/episodic.js" },
 
 
 
77
  { id: "energy", title: "Energy", mod: "/static/3d/surfaces/energy.js" },
78
  { id: "fabric", title: "Fabric", mod: "/static/3d/surfaces/fabric.js" },
79
  { id: "pnt", title: "PNT", mod: "/static/3d/surfaces/pnt.js" },
 
74
  { id: "worldmodel", title: "World Model", mod: "/static/3d/surfaces/worldmodel.js" },
75
  { id: "qec", title: "Topological QEC", mod: "/static/3d/surfaces/qec.js" },
76
  { id: "episodic", title: "Episodic Memory", mod: "/static/3d/surfaces/episodic.js" },
77
+ { id: "testtime", title: "Test-Time Compute", mod: "/static/3d/surfaces/testtime.js" },
78
+ { id: "ssm", title: "State-Space (Mamba-3)", mod: "/static/3d/surfaces/ssm.js" },
79
+ { id: "genie", title: "Genie World-Model", mod: "/static/3d/surfaces/genie.js" },
80
  { id: "energy", title: "Energy", mod: "/static/3d/surfaces/energy.js" },
81
  { id: "fabric", title: "Fabric", mod: "/static/3d/surfaces/fabric.js" },
82
  { id: "pnt", title: "PNT", mod: "/static/3d/surfaces/pnt.js" },
static/3d/surfaces/genie.js ADDED
@@ -0,0 +1,453 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // © 2026 Lutar, Stephen P. — SZL Holdings · ORCID 0009-0001-0110-4173 · Doctrine v11
3
+ //
4
+ // surfaces/genie.js — GENERATIVE / INTERACTIVE LATENT-ACTION WORLD-MODEL organ for the
5
+ // holographic frontier ring, inspired by (clean-room, not a reproduction of) Google
6
+ // DeepMind's Genie / Genie 2 / Genie 3 generative interactive world models.
7
+ //
8
+ // DISTINCT FROM worldmodel.js: that surface renders a PREDICTOR's latent trajectory —
9
+ // two static-ish paths (observed vs predicted) with a "surprise" gap between them. THIS
10
+ // surface instead renders a GENERATED, EVOLVING NxN GRID-WORLD — a lattice of cells that
11
+ // visibly changes shape/colour every time a new latent action code is applied, i.e. a
12
+ // *playable* rollout being generated frame-by-frame, not a predicted path being scored.
13
+ // There is no "observed vs predicted" comparison here at all — only forward generation.
14
+ //
15
+ // Renders the live /api/killinchu/v1/genie/rollout snapshot as an NxN plane of cubes
16
+ // (the generated grid-world state) that steps forward through the rollout's
17
+ // generated_states[] on a timer, each step driven by the next latent action_code in the
18
+ // sequence. A HUD shows the action-code sequence + coherence score. Honesty label
19
+ // "MODELED" is read VERBATIM from the JSON and displayed as-is; it is never upgraded.
20
+ //
21
+ // Surface export shape (mirrors interpretability.js / worldmodel.js exactly):
22
+ // export default { id, title, endpoints, mount(ctx), unmount() }
23
+ // ctx = { stage, container, live, label, THREE, szl3d }
24
+ //
25
+ // DATA SHOWN (all from live endpoint):
26
+ // grid_size, n_latent_actions, rollout_horizon — rollout shape
27
+ // action_codes[] — the latent-action-code sequence applied
28
+ // latent_action_codebook[] — clustered latent-action centroids (dx,dy,dstate)
29
+ // generated_states[] — per-step {mean, active_cells, delta_from_prev}
30
+ // coherence_score — MODELED world-consistency analogue
31
+ //
32
+ // LEADERS ADOPTED & CITED (clean-room; NOT claimed as SZL's own):
33
+ // Genie (v1): Bruce, Segar, Mnih et al. (2024) arXiv:2402.15391
34
+ // https://arxiv.org/abs/2402.15391
35
+ // Genie 2 (Google DeepMind blog):
36
+ // https://deepmind.google/discover/blog/genie-2-a-large-scale-foundation-world-model/
37
+ // Genie 3 (Google DeepMind blog):
38
+ // https://deepmind.google/discover/blog/genie-3-a-new-frontier-for-world-models/
39
+ //
40
+ // HONESTY LABELS: MODELED (a toy simulation of the Genie COMPUTATION SHAPE; no video
41
+ // tokenizer, no trained dynamics model, no learned latent-action model, no borrowed
42
+ // weights). Read verbatim from JSON; never upgraded here. SZL does not claim parity
43
+ // with any real Genie model.
44
+ // COLOURS: lattice-blue 0x5b8dee (generated cell — low activation), violet-blue 0x8a6bff
45
+ // (generated cell — high activation / most-recently-changed flash — data-viz only),
46
+ // proof-teal 0x3af4c8 (coherence halo), greys for degraded/no-data. Purple BANNED.
47
+ // 0 RUNTIME CDN. Vendored three.js r170 via page importmap.
48
+ // DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
49
+
50
+ const ID = "genie";
51
+ const TITLE = "Genie · Generative Latent-Action World (live)";
52
+
53
+ // Endpoint is hosted on the dedicated killinchu Space (isolated compute), reached
54
+ // cross-origin (killinchu returns access-control-allow-origin: https://a-11-oy.com).
55
+ // This keeps the genie organ's rebuilds/faults isolated from the flagship.
56
+ const EP = "https://szlholdings-killinchu.hf.space/api/killinchu/v1/genie/rollout?seed=42&grid=8&horizon=16&n_latent_actions=6";
57
+
58
+ // data-viz hues — purple BANNED
59
+ const C_LO = 0x5b8dee; // lattice-blue (generated cell, low activation)
60
+ const C_HI = 0x8a6bff; // violet-blue (generated cell, high activation / just-changed flash)
61
+ const C_DIM = 0x42505d; // grey (degraded / no-live-data)
62
+ const C_ACCENT = 0x3af4c8; // proof-teal accent (coherence halo)
63
+ const C_GRID = 0x1b3a44; // floor / wire colour
64
+
65
+ const MAX_GRID = 16; // visual cap on grid_size (endpoint clamps grid<=64; we tile at most 16x16 cells for perf)
66
+ const CELL = 0.62; // world-unit spacing between generated cells
67
+ const STEP_MS = 650; // ms between generated-rollout steps (one latent action applied per tick)
68
+
69
+ let _stage = null, _THREE = null, _ctx = null, _group = null, _overlay = null;
70
+ let _frameReg = false, _polls = [], _el = {}, _badge = null;
71
+ let _plain = false;
72
+
73
+ // geometry handles
74
+ let _cells = []; // Array<THREE.Mesh> — one per generated grid cell (row-major)
75
+ let _halo = null; // THREE.Mesh — coherence halo above the grid
76
+ let _floor = null;
77
+
78
+ // rollout playback state (steps through generated_states[] to visibly "play" the world)
79
+ let _stepTimer = null;
80
+ let _curStep = 0;
81
+
82
+ // live state
83
+ const S = {
84
+ label: null,
85
+ gridSize: null,
86
+ nActions: null,
87
+ horizon: null,
88
+ actionCodes: null, // Array<int>
89
+ codebook: null, // Array<{code,dx,dy,dstate}>
90
+ states: null, // Array<{step,action_code,mean,active_cells,delta_from_prev}>
91
+ coherence: null,
92
+ state: "init",
93
+ };
94
+
95
+ // deterministic per-cell base pattern so the grid has visible structure even before the
96
+ // first generated step lands (re-derived client-side from grid_size only — cosmetic).
97
+ function _basePattern(n, r, c) {
98
+ return 0.5 + 0.5 * Math.sin((r * 1.7 + c * 2.3));
99
+ }
100
+
101
+ // =============================================================================
102
+ // mount(ctx)
103
+ // =============================================================================
104
+ export function mount(ctx) {
105
+ _ctx = ctx; _stage = ctx.stage; _THREE = ctx.THREE;
106
+ _group = new _THREE.Group();
107
+ _stage.scene.add(_group);
108
+ _stage.camera.position.set(0, 9, 16);
109
+ try { if (_stage.controls && _stage.controls.target) { _stage.controls.target.set(0, 0, 0); _stage.controls.update(); } } catch (_) {}
110
+ try { _stage.setBloom(true); } catch (_) {}
111
+
112
+ _buildFloor();
113
+ _buildHalo();
114
+
115
+ if (!_frameReg) { _stage.onFrame(_onFrame); _frameReg = true; }
116
+
117
+ _badge = ctx.live.createBadge();
118
+ _polls.push(ctx.live.poll(EP, 5000, _onRollout, { badge: _badge, onState: (m) => { S.state = m.state; _paintOverlay(); } }));
119
+
120
+ _buildOverlay();
121
+ return { id: ID, started: true };
122
+ }
123
+
124
+ // =============================================================================
125
+ // builders
126
+ // =============================================================================
127
+ function _buildFloor() {
128
+ const THREE = _THREE;
129
+ const grid = new THREE.GridHelper(40, 40, C_GRID, 0x0f2027);
130
+ grid.material.opacity = 0.18; grid.material.transparent = true; grid.position.y = -0.01;
131
+ _group.add(grid);
132
+ _floor = grid;
133
+ }
134
+
135
+ function _buildHalo() {
136
+ const THREE = _THREE;
137
+ // Coherence halo — a torus above the grid whose fullness/brightness tracks
138
+ // coherence_score (higher = generated rollout stays more "on-manifold").
139
+ _halo = new THREE.Mesh(
140
+ new THREE.TorusGeometry(3.2, 0.035, 10, 64),
141
+ new THREE.MeshStandardMaterial({ color: C_ACCENT, emissive: C_ACCENT, emissiveIntensity: 0.35, transparent: true, opacity: 0.4 }),
142
+ );
143
+ _halo.position.set(0, 3.4, 0);
144
+ _halo.rotation.x = Math.PI / 2;
145
+ _group.add(_halo);
146
+ }
147
+
148
+ function _disposeGrid() {
149
+ _cells.forEach((m) => {
150
+ if (m.geometry && m.geometry.dispose) m.geometry.dispose();
151
+ if (m.material && m.material.dispose) m.material.dispose();
152
+ if (_group) _group.remove(m);
153
+ });
154
+ _cells = [];
155
+ }
156
+
157
+ // (re)build the NxN generated-grid-world lattice
158
+ function _buildGrid(n) {
159
+ const THREE = _THREE;
160
+ _disposeGrid();
161
+ const dim = Math.min(n || 8, MAX_GRID);
162
+ const geo = new THREE.BoxGeometry(CELL * 0.86, 0.2, CELL * 0.86);
163
+ const offset = (dim - 1) / 2;
164
+ for (let r = 0; r < dim; r++) {
165
+ for (let c = 0; c < dim; c++) {
166
+ const v = _basePattern(dim, r, c);
167
+ const mat = new THREE.MeshStandardMaterial({
168
+ color: C_DIM, emissive: C_DIM, emissiveIntensity: 0.12,
169
+ metalness: 0.2, roughness: 0.6,
170
+ });
171
+ const mesh = new THREE.Mesh(geo, mat);
172
+ mesh.position.set((c - offset) * CELL, 0, (r - offset) * CELL);
173
+ mesh.userData.baseHeight = 0.2;
174
+ mesh.userData.value = v;
175
+ _group.add(mesh);
176
+ _cells.push(mesh);
177
+ }
178
+ }
179
+ }
180
+
181
+ // =============================================================================
182
+ // live data handler
183
+ // =============================================================================
184
+ function _onRollout(j) {
185
+ // read honesty label VERBATIM — never upgrade
186
+ S.label = (j.label || "MODELED").toUpperCase();
187
+ S.gridSize = typeof j.grid_size === "number" ? j.grid_size : null;
188
+ S.nActions = typeof j.n_latent_actions === "number" ? j.n_latent_actions : null;
189
+ S.horizon = typeof j.rollout_horizon === "number" ? j.rollout_horizon : null;
190
+ S.actionCodes = Array.isArray(j.action_codes) ? j.action_codes : null;
191
+ S.codebook = Array.isArray(j.latent_action_codebook) ? j.latent_action_codebook : null;
192
+ S.states = Array.isArray(j.generated_states) ? j.generated_states : null;
193
+ S.coherence = typeof j.coherence_score === "number" ? j.coherence_score : null;
194
+
195
+ const dim = Math.min(S.gridSize || 8, MAX_GRID);
196
+ if (_cells.length !== dim * dim) _buildGrid(dim);
197
+
198
+ _curStep = 0;
199
+ _startPlayback();
200
+ _updateHalo();
201
+ _paintOverlay();
202
+ }
203
+
204
+ // =============================================================================
205
+ // rollout playback — visibly EVOLVE the grid one generated step at a time,
206
+ // driven by the corresponding latent action_code (this is what makes the organ
207
+ // "generative/interactive" rather than a static readout)
208
+ // =============================================================================
209
+ function _startPlayback() {
210
+ if (_stepTimer) { clearInterval(_stepTimer); _stepTimer = null; }
211
+ if (!S.states || !S.states.length) return;
212
+ _applyStep(0);
213
+ _stepTimer = setInterval(() => {
214
+ _curStep = (_curStep + 1) % S.states.length;
215
+ _applyStep(_curStep);
216
+ }, STEP_MS);
217
+ }
218
+
219
+ function _applyStep(i) {
220
+ const live = S.state === "live";
221
+ const step = S.states && S.states[i];
222
+ const dim = Math.min(S.gridSize || 8, MAX_GRID);
223
+ if (!step || !_cells.length) return;
224
+
225
+ // Deterministically re-derive a per-cell activation for THIS step from the step's
226
+ // scalar summary (mean/delta) + each cell's base pattern + which latent action code
227
+ // is currently being applied — a light client-side visual analogue of the server's
228
+ // generated lattice (full per-cell state is not shipped over the wire to keep the
229
+ // payload small; the endpoint's generated_states[] gives the authoritative summary).
230
+ const code = step.action_code != null ? step.action_code : 0;
231
+ const codebookEntry = (S.codebook && S.codebook[code]) ? S.codebook[code] : { dx: 1, dy: 0, dstate: 0.5 };
232
+ const mean = typeof step.mean === "number" ? step.mean : 0.5;
233
+ const delta = typeof step.delta_from_prev === "number" ? step.delta_from_prev : 0;
234
+
235
+ _cells.forEach((mesh, idx) => {
236
+ const r = Math.floor(idx / dim), c = idx % dim;
237
+ const phase = (r * codebookEntry.dx + c * codebookEntry.dy) * 0.6 + i * 0.4;
238
+ const v = live ? Math.max(0, Math.min(1, mean + 0.35 * Math.sin(phase) * codebookEntry.dstate)) : mesh.userData.value;
239
+ mesh.userData.value = v;
240
+ const col = v > 0.62 ? C_HI : C_LO;
241
+ if (live) {
242
+ mesh.material.color.setHex(col);
243
+ mesh.material.emissive.setHex(col);
244
+ mesh.material.emissiveIntensity = 0.15 + 0.75 * v;
245
+ const h = 0.2 + v * 1.3;
246
+ mesh.scale.set(1, h / mesh.userData.baseHeight, 1);
247
+ mesh.position.y = (h - 0.2) / 2;
248
+ } else {
249
+ mesh.material.color.setHex(C_DIM);
250
+ mesh.material.emissive.setHex(C_DIM);
251
+ mesh.material.emissiveIntensity = 0.1;
252
+ mesh.scale.set(1, 1, 1);
253
+ mesh.position.y = 0;
254
+ }
255
+ });
256
+
257
+ _paintOverlay(delta);
258
+ }
259
+
260
+ // =============================================================================
261
+ // halo updater — driven by coherence_score
262
+ // =============================================================================
263
+ function _updateHalo() {
264
+ const live = S.state === "live";
265
+ if (!_halo) return;
266
+ const coh = S.coherence != null ? S.coherence : 0.5;
267
+ const col = live ? C_ACCENT : C_DIM;
268
+ _halo.material.color.setHex(col);
269
+ _halo.material.emissive.setHex(col);
270
+ _halo.material.emissiveIntensity = live ? 0.2 + 0.6 * coh : 0.12;
271
+ _halo.material.opacity = live ? 0.5 : 0.2;
272
+ _halo.scale.setScalar(live ? (0.6 + coh) : 0.8); // fuller halo = higher generated-world coherence
273
+ }
274
+
275
+ // =============================================================================
276
+ // per-frame animation
277
+ // =============================================================================
278
+ function _onFrame() {
279
+ const t = performance.now();
280
+ if (_group) _group.rotation.y = Math.sin(t * 0.00009) * 0.15;
281
+ if (_halo) _halo.rotation.z += 0.0035;
282
+ }
283
+
284
+ // =============================================================================
285
+ // overlay
286
+ // =============================================================================
287
+ function _buildOverlay() {
288
+ const ctx = _ctx;
289
+ _overlay = document.createElement("div");
290
+ Object.assign(_overlay.style, {
291
+ position: "absolute", left: "14px", top: "14px", zIndex: "6",
292
+ display: "flex", flexDirection: "column", gap: "8px",
293
+ maxWidth: "min(94%,440px)",
294
+ font: "12px ui-sans-serif,system-ui,Segoe UI,Roboto,Arial",
295
+ color: "#eef3f6",
296
+ });
297
+
298
+ const h = document.createElement("div");
299
+ h.style.cssText = "font:600 13px ui-sans-serif,system-ui;letter-spacing:.4px";
300
+ h.textContent = TITLE;
301
+ _overlay.appendChild(h);
302
+
303
+ const sub = document.createElement("div");
304
+ sub.style.cssText = "color:#9fb1bf;font-size:11px;line-height:1.55";
305
+ sub.innerHTML =
306
+ 'A small <b>latent-action codebook</b> is clustered from state deltas, then applied ' +
307
+ 'step-by-step to <b>GENERATE</b> a brand-new grid-world \u2014 the grid you see evolving ' +
308
+ 'below \u2014 rather than predicting a pre-recorded path. Honesty label <b>MODELED</b> ' +
309
+ '(a toy simulation of the Genie-style computation shape \u2014 no trained dynamics model, ' +
310
+ 'no video tokenizer, no borrowed weights). 0 runtime CDN.';
311
+ _overlay.appendChild(sub);
312
+
313
+ const brow = document.createElement("div");
314
+ brow.style.cssText = "display:flex;gap:8px;align-items:center;flex-wrap:wrap";
315
+ if (_badge && _badge.el) brow.appendChild(_badge.el);
316
+ _overlay.appendChild(brow);
317
+
318
+ const card = document.createElement("div");
319
+ card.style.cssText = "background:#0a1117;border:1px solid #1d2a36;border-radius:9px;padding:9px 10px;display:flex;flex-direction:column;gap:6px";
320
+
321
+ const chead = document.createElement("div");
322
+ chead.style.cssText = "display:flex;align-items:center;gap:8px;flex-wrap:wrap";
323
+ const dot = document.createElement("span");
324
+ dot.style.cssText = "width:9px;height:9px;border-radius:50%;background:#5b8dee;box-shadow:0 0 7px #5b8dee";
325
+ const nm = document.createElement("b");
326
+ nm.style.cssText = "font-size:12px;color:#5b8dee;letter-spacing:.3px";
327
+ nm.textContent = "genie";
328
+ chead.appendChild(dot); chead.appendChild(nm);
329
+ card.appendChild(chead);
330
+
331
+ const grid = document.createElement("div");
332
+ grid.style.cssText = "display:grid;grid-template-columns:1fr;gap:4px";
333
+
334
+ function kpiRow(id, label) {
335
+ const r = document.createElement("div");
336
+ r.style.cssText = "display:flex;justify-content:space-between;gap:10px;font-size:11px";
337
+ const l = document.createElement("span"); l.style.cssText = "color:#9fb1bf"; l.textContent = label;
338
+ const v = document.createElement("b");
339
+ v.id = id;
340
+ v.style.cssText = "font-variant-numeric:tabular-nums;color:#eef3f6;text-align:right;max-width:58%";
341
+ v.textContent = "\u2014";
342
+ _el[id] = v;
343
+ r.appendChild(l); r.appendChild(v); return r;
344
+ }
345
+
346
+ grid.appendChild(kpiRow("gn-grid", "grid_size \u00d7 n_latent_actions"));
347
+ grid.appendChild(kpiRow("gn-step", "step (action code applied)"));
348
+ grid.appendChild(kpiRow("gn-seq", "action-code sequence"));
349
+ grid.appendChild(kpiRow("gn-coh", "coherence score \u2014 MODELED"));
350
+ grid.appendChild(kpiRow("gn-label", "honesty label"));
351
+ card.appendChild(grid);
352
+
353
+ const fn = document.createElement("div");
354
+ fn.style.cssText = "font-size:9.5px;color:#6b7a86;line-height:1.5";
355
+ fn.textContent = "Bruce, Segar, Mnih et al. arXiv:2402.15391 (Genie) \u00b7 deepmind.google Genie 2 blog \u00b7 deepmind.google Genie 3 blog. MODELED \u00b7 not claimed-as \u00b7 not claimed at parity.";
356
+ card.appendChild(fn);
357
+ _overlay.appendChild(card);
358
+
359
+ const pl = document.createElement("button");
360
+ pl.textContent = "\u25d1 what this means";
361
+ pl.title = "Toggle plain-language explanation for investors & consumers.";
362
+ pl.style.cssText = "font:11px ui-monospace,monospace;padding:5px 11px;border-radius:7px;border:1px solid #3af4c8;background:#08140f;color:#3af4c8;cursor:pointer;width:fit-content";
363
+ pl.addEventListener("click", () => {
364
+ _plain = !_plain;
365
+ pl.style.background = _plain ? "#0f2a20" : "#08140f";
366
+ _applyPlain();
367
+ });
368
+ _overlay.appendChild(pl);
369
+
370
+ const pd = document.createElement("div");
371
+ pd.id = "gn-plain";
372
+ pd.style.cssText = "font-size:10.5px;color:#c9d6df;line-height:1.55;border:1px dashed #26333f;border-radius:7px;padding:7px 9px;display:none";
373
+ _el["plain"] = pd;
374
+ _overlay.appendChild(pd);
375
+
376
+ (ctx.container || document.body).appendChild(_overlay);
377
+ _paintOverlay();
378
+ }
379
+
380
+ function _applyPlain() {
381
+ const pd = _el["plain"];
382
+ if (!pd) return;
383
+ pd.style.display = _plain ? "block" : "none";
384
+ if (!_plain) return;
385
+ const coh = S.coherence != null ? (S.coherence * 100).toFixed(1) + "%" : "loading\u2026";
386
+ const na = S.nActions != null ? String(S.nActions) : "loading\u2026";
387
+ pd.innerHTML =
388
+ "<b>What this means:</b> Instead of just watching and predicting a pre-recorded clip, " +
389
+ "this organ <b>generates a brand-new interactive world</b> one step at a time \u2014 each " +
390
+ "step conditioned on one of <b>" + na + "</b> discrete \u201clatent actions\u201d, the same " +
391
+ "idea behind Google DeepMind's Genie models: learn a small action vocabulary with no " +
392
+ "labels, then let you \u2018play\u2019 the generated world through it. The grid evolves live " +
393
+ "as each action is applied, and it stays <b>" + coh + "</b> consistent with itself " +
394
+ "step-to-step. " +
395
+ "Plain: this is the shape of computation behind a playable AI-generated world \u2014 but " +
396
+ "this view is a <b>MODELED</b> toy simulation of the technique, not a readout from any " +
397
+ "trained Genie model or real video.";
398
+ }
399
+
400
+ function _tok(s) {
401
+ if (s === "live") return null;
402
+ if (s === "missing") return "NO-LIVE-DATA";
403
+ if (s === "degraded") return "DEGRADED";
404
+ if (s === "error") return "OFFLINE";
405
+ return "\u2026";
406
+ }
407
+
408
+ function fx(v, d) { return typeof v === "number" ? v.toFixed(d) : "\u2014"; }
409
+ function _set(id, v) { if (_el[id]) _el[id].textContent = v; }
410
+
411
+ function _paintOverlay(latestDelta) {
412
+ const t = _tok(S.state);
413
+ _set("gn-grid", t || ((S.gridSize != null && S.nActions != null) ? (S.gridSize + "\u00d7" + S.gridSize + " \u00d7 " + S.nActions) : "\u2014"));
414
+ const stepInfo = (S.states && S.states[_curStep]) ? S.states[_curStep] : null;
415
+ _set("gn-step", t || (stepInfo ? ("#" + stepInfo.step + " code=" + stepInfo.action_code + " \u0394=" + fx(stepInfo.delta_from_prev, 4)) : "\u2014"));
416
+ const seq = S.actionCodes ? S.actionCodes.slice(0, 12).join(",") + (S.actionCodes.length > 12 ? "\u2026" : "") : "\u2014";
417
+ _set("gn-seq", t || seq);
418
+ _set("gn-coh", t || fx(S.coherence, 4));
419
+ // honesty label verbatim — never upgraded
420
+ _set("gn-label", t || (S.label || "MODELED"));
421
+ if (_plain) _applyPlain();
422
+ }
423
+
424
+ // =============================================================================
425
+ // unmount — clean up everything; must not affect other organs
426
+ // =============================================================================
427
+ export function unmount() {
428
+ _polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
429
+ if (_stepTimer) { clearInterval(_stepTimer); _stepTimer = null; }
430
+ try { if (_overlay && _overlay.parentNode) _overlay.parentNode.removeChild(_overlay); } catch (_) {}
431
+ try {
432
+ if (_group && _stage) {
433
+ _group.traverse((o) => {
434
+ if (o.geometry && o.geometry.dispose) o.geometry.dispose();
435
+ if (o.material) {
436
+ const ms = Array.isArray(o.material) ? o.material : [o.material];
437
+ ms.forEach((m) => { if (m.dispose) m.dispose(); });
438
+ }
439
+ });
440
+ _stage.scene.remove(_group);
441
+ }
442
+ } catch (_) {}
443
+ _group = _overlay = null;
444
+ _cells = []; _halo = null; _floor = null;
445
+ _el = {}; _badge = null; _plain = false; _frameReg = false;
446
+ _stage = _THREE = _ctx = null;
447
+ S.label = S.gridSize = S.nActions = S.horizon = null;
448
+ S.actionCodes = S.codebook = S.states = S.coherence = null;
449
+ S.state = "init";
450
+ _curStep = 0;
451
+ }
452
+
453
+ export default { id: ID, title: TITLE, endpoints: [EP], mount, unmount };
static/3d/surfaces/ssm.js ADDED
@@ -0,0 +1,472 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // © 2026 Lutar, Stephen P. — SZL Holdings · ORCID 0009-0001-0110-4173 · Doctrine v11
3
+ //
4
+ // surfaces/ssm.js — STATE-SPACE-MODEL (Mamba-3 successor) sequence-mixing organ for the
5
+ // holographic frontier ring.
6
+ //
7
+ // Renders a 3D ribbon/trajectory of a selective state-space scan's hidden state evolving
8
+ // over sequence steps, driven by a live snapshot from /api/killinchu/v1/ssm/scan. Two
9
+ // ribbons are drawn side by side: a REAL-valued state trajectory (decay-only diagonal SSM)
10
+ // and a COMPLEX-valued state trajectory (rotation-capable, the Mamba-3 addition) — so the
11
+ // state-tracking gap is directly visible as ribbon shape, not just a number. HUD shows
12
+ // real vs complex task accuracy plus the O(L) vs O(L^2) compute gap (sub-quadratic win).
13
+ // Honesty label "MODELED" is read VERBATIM from the JSON and displayed as-is; it is never
14
+ // upgraded.
15
+ //
16
+ // Surface export shape (mirrors interpretability.js / neuromorphic.js exactly):
17
+ // export default { id, title, endpoints, mount(ctx), unmount() }
18
+ // ctx = { stage, container, live, label, THREE, szl3d }
19
+ //
20
+ // DATA SHOWN (all from live endpoint):
21
+ // task — 'copy' | 'parity' | 'induction'
22
+ // seq_len, state_dim — scan dimensions
23
+ // real_state_accuracy — accuracy of the REAL-valued selective-SSM state tracker
24
+ // complex_state_accuracy — accuracy of the COMPLEX-valued state tracker (Mamba-3 add)
25
+ // compute_flops_quadratic — MODELED Transformer O(L^2) self-attention FLOPs
26
+ // compute_flops_ssm — MODELED SSM O(L) scan FLOPs
27
+ // throughput_ratio — quadratic / ssm (the sub-quadratic win)
28
+ // sample.trajectory_real / trajectory_complex_magnitude — per-step hidden-state samples
29
+ //
30
+ // LEADERS ADOPTED & CITED (clean-room; NOT claimed as SZL's own):
31
+ // Mamba — Gu & Dao (2023) "Linear-Time Sequence Modeling with Selective State Spaces".
32
+ // arXiv:2312.00752. https://arxiv.org/abs/2312.00752
33
+ // Mamba-2 — Dao & Gu (2024) "Transformers are SSMs...Structured State Space Duality".
34
+ // arXiv:2405.21060. https://arxiv.org/abs/2405.21060
35
+ // state-spaces/mamba (official implementation, Apache-2.0):
36
+ // https://github.com/state-spaces/mamba
37
+ // Mamba-3 — Lahoti et al. (2026) "Mamba-3: Improved Sequence Modeling using State Space
38
+ // Principles". arXiv:2603.15569 (ICLR 2026). https://arxiv.org/abs/2603.15569
39
+ //
40
+ // HONESTY LABELS: MODELED (deterministic simulation of the RECURRENCE; no trained
41
+ // Mamba/Mamba-2/Mamba-3 checkpoint, no measured GPU benchmark). Read verbatim from
42
+ // JSON; never upgraded here.
43
+ // COLOURS: lattice-blue 0x5b8dee (real-state ribbon), violet-blue 0x8a6bff (complex-state
44
+ // ribbon — data-viz only), proof-teal 0x3af4c8 (accent / plain-language). Purple BANNED
45
+ // as UI/background.
46
+ // 0 RUNTIME CDN. Vendored three.js r170 via page importmap.
47
+ // DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
48
+
49
+ const ID = "ssm";
50
+ const TITLE = "State-Space Model · Selective Scan (live, Mamba-3-style)";
51
+
52
+ // Endpoint is hosted on the dedicated killinchu Space (isolated compute), reached
53
+ // cross-origin (killinchu returns access-control-allow-origin: https://a-11-oy.com).
54
+ // This keeps the SSM organ's rebuilds/faults isolated from the flagship.
55
+ const EP = "https://szlholdings-killinchu.hf.space/api/killinchu/v1/ssm/scan?seed=42&seq_len=32&state_dim=16&task=parity";
56
+
57
+ // data-viz hues — purple BANNED
58
+ const C_REAL = 0x5b8dee; // lattice-blue (real-valued state ribbon)
59
+ const C_COMPLEX = 0x8a6bff; // violet-blue (complex-valued state ribbon — data-viz only)
60
+ const C_DIM = 0x42505d; // grey (degraded / no-live-data)
61
+ const C_ACCENT = 0x3af4c8; // proof-teal accent (compute-gap bar / plain-language)
62
+ const C_GRID = 0x1b3a44; // floor / link colour
63
+
64
+ const MAX_STEPS = 64; // ribbon vertex cap (matches endpoint seq_len ceiling in practice)
65
+ const RIBBON_LEN_WORLD = 14; // world-units the ribbon spans along its axis
66
+ const RIBBON_SEP = 3.2; // world-units separating the two ribbons (real vs complex)
67
+
68
+ let _stage = null, _THREE = null, _ctx = null, _group = null, _overlay = null;
69
+ let _frameReg = false, _polls = [], _el = {}, _badge = null;
70
+ let _plain = false;
71
+
72
+ // geometry handles
73
+ let _realLine = null, _complexLine = null; // THREE.Line ribbons (trajectory curves)
74
+ let _realDots = null, _complexDots = null; // THREE.Points per-step markers
75
+ let _gapBar = null; // THREE.Mesh — O(L) vs O(L^2) compute-gap bar
76
+ let _gapBarBg = null;
77
+
78
+ // live state
79
+ const S = {
80
+ label: null,
81
+ task: null,
82
+ seqLen: null,
83
+ stateDim: null,
84
+ realAcc: null,
85
+ complexAcc: null,
86
+ flopsQuad: null,
87
+ flopsSSM: null,
88
+ throughputRatio: null,
89
+ trajReal: null, // Array<Array<number>> per-step real-channel state vector
90
+ trajComplexMag: null, // Array<Array<number>> per-step complex-channel magnitude vector
91
+ state: "init",
92
+ };
93
+
94
+ // =============================================================================
95
+ // mount(ctx)
96
+ // =============================================================================
97
+ export function mount(ctx) {
98
+ _ctx = ctx; _stage = ctx.stage; _THREE = ctx.THREE;
99
+ _group = new _THREE.Group();
100
+ _stage.scene.add(_group);
101
+ _stage.camera.position.set(0, 6, 19);
102
+ try { if (_stage.controls && _stage.controls.target) { _stage.controls.target.set(0, 1.2, 0); _stage.controls.update(); } } catch (_) {}
103
+ try { _stage.setBloom(true); } catch (_) {}
104
+
105
+ _buildFloor();
106
+ _buildRibbons();
107
+ _buildGapBar();
108
+
109
+ if (!_frameReg) { _stage.onFrame(_onFrame); _frameReg = true; }
110
+
111
+ _badge = ctx.live.createBadge();
112
+ _polls.push(ctx.live.poll(EP, 5000, _onScan, { badge: _badge, onState: (m) => { S.state = m.state; _paintOverlay(); } }));
113
+
114
+ _buildOverlay();
115
+ return { id: ID, started: true };
116
+ }
117
+
118
+ // =============================================================================
119
+ // builders
120
+ // =============================================================================
121
+ function _buildFloor() {
122
+ const THREE = _THREE;
123
+ const grid = new THREE.GridHelper(40, 40, C_GRID, 0x0f2027);
124
+ grid.material.opacity = 0.18; grid.material.transparent = true; grid.position.y = -0.01;
125
+ _group.add(grid);
126
+ }
127
+
128
+ function _emptyRibbonPoints() {
129
+ const pts = [];
130
+ for (let i = 0; i < MAX_STEPS; i++) pts.push(new (_THREE.Vector3)(0, 0, 0));
131
+ return pts;
132
+ }
133
+
134
+ function _buildRibbons() {
135
+ const THREE = _THREE;
136
+
137
+ // REAL-state ribbon (lattice-blue), offset to one side
138
+ const realGeo = new THREE.BufferGeometry().setFromPoints(_emptyRibbonPoints());
139
+ _realLine = new THREE.Line(realGeo, new THREE.LineBasicMaterial({ color: C_REAL, transparent: true, opacity: 0.85, linewidth: 2 }));
140
+ _realLine.position.x = -RIBBON_SEP / 2;
141
+ _group.add(_realLine);
142
+
143
+ _realDots = new THREE.Points(realGeo, new THREE.PointsMaterial({ color: C_REAL, size: 0.12, transparent: true, opacity: 0.9 }));
144
+ _realDots.position.x = -RIBBON_SEP / 2;
145
+ _group.add(_realDots);
146
+
147
+ // COMPLEX-state ribbon (violet-blue), offset to the other side
148
+ const complexGeo = new THREE.BufferGeometry().setFromPoints(_emptyRibbonPoints());
149
+ _complexLine = new THREE.Line(complexGeo, new THREE.LineBasicMaterial({ color: C_COMPLEX, transparent: true, opacity: 0.85, linewidth: 2 }));
150
+ _complexLine.position.x = RIBBON_SEP / 2;
151
+ _group.add(_complexLine);
152
+
153
+ _complexDots = new THREE.Points(complexGeo, new THREE.PointsMaterial({ color: C_COMPLEX, size: 0.12, transparent: true, opacity: 0.9 }));
154
+ _complexDots.position.x = RIBBON_SEP / 2;
155
+ _group.add(_complexDots);
156
+ }
157
+
158
+ function _buildGapBar() {
159
+ const THREE = _THREE;
160
+ // background track (grey) + foreground bar (teal) visualizing O(L) vs O(L^2) compute gap.
161
+ _gapBarBg = new THREE.Mesh(
162
+ new THREE.BoxGeometry(8, 0.18, 0.18),
163
+ new THREE.MeshStandardMaterial({ color: C_DIM, emissive: C_DIM, emissiveIntensity: 0.15, transparent: true, opacity: 0.35 }),
164
+ );
165
+ _gapBarBg.position.set(0, -0.6, 6);
166
+ _group.add(_gapBarBg);
167
+
168
+ _gapBar = new THREE.Mesh(
169
+ new THREE.BoxGeometry(0.4, 0.22, 0.22),
170
+ new THREE.MeshStandardMaterial({ color: C_ACCENT, emissive: C_ACCENT, emissiveIntensity: 0.4 }),
171
+ );
172
+ _gapBar.position.set(-3.8, -0.6, 6);
173
+ _group.add(_gapBar);
174
+ }
175
+
176
+ // =============================================================================
177
+ // live data handler
178
+ // =============================================================================
179
+ function _onScan(j) {
180
+ // read honesty label VERBATIM — never upgrade
181
+ S.label = (j.label || "MODELED").toUpperCase();
182
+ S.task = typeof j.task === "string" ? j.task : null;
183
+ S.seqLen = typeof j.seq_len === "number" ? j.seq_len : null;
184
+ S.stateDim = typeof j.state_dim === "number" ? j.state_dim : null;
185
+ S.realAcc = typeof j.real_state_accuracy === "number" ? j.real_state_accuracy : null;
186
+ S.complexAcc = typeof j.complex_state_accuracy === "number" ? j.complex_state_accuracy : null;
187
+ S.flopsQuad = typeof j.compute_flops_quadratic === "number" ? j.compute_flops_quadratic : null;
188
+ S.flopsSSM = typeof j.compute_flops_ssm === "number" ? j.compute_flops_ssm : null;
189
+ S.throughputRatio = typeof j.throughput_ratio === "number" ? j.throughput_ratio : null;
190
+
191
+ const sample = j.sample || {};
192
+ S.trajReal = Array.isArray(sample.trajectory_real) ? sample.trajectory_real : null;
193
+ S.trajComplexMag = Array.isArray(sample.trajectory_complex_magnitude) ? sample.trajectory_complex_magnitude : null;
194
+
195
+ _updateRibbons();
196
+ _updateGapBar();
197
+ _paintOverlay();
198
+ }
199
+
200
+ // =============================================================================
201
+ // geometry updater — drives ribbon shape from the live trajectory
202
+ // =============================================================================
203
+ function _vecNorm(vec) {
204
+ // L2 norm of a per-step state vector (collapses state_dim channels to one scalar height)
205
+ let s = 0;
206
+ for (let i = 0; i < vec.length; i++) s += vec[i] * vec[i];
207
+ return Math.sqrt(s);
208
+ }
209
+
210
+ function _trajToPoints(traj) {
211
+ const THREE = _THREE;
212
+ const pts = [];
213
+ if (!traj || !traj.length) {
214
+ for (let i = 0; i < MAX_STEPS; i++) pts.push(new THREE.Vector3(0, 0, 0));
215
+ return pts;
216
+ }
217
+ const n = Math.min(traj.length, MAX_STEPS);
218
+ // normalize height by the max norm across the trajectory so ribbons are comparable
219
+ let maxNorm = 0.0001;
220
+ for (let i = 0; i < n; i++) maxNorm = Math.max(maxNorm, _vecNorm(traj[i]));
221
+ for (let i = 0; i < n; i++) {
222
+ const z = (i / Math.max(n - 1, 1)) * RIBBON_LEN_WORLD - RIBBON_LEN_WORLD / 2;
223
+ const h = (_vecNorm(traj[i]) / maxNorm) * 3.0; // scaled hidden-state magnitude -> height
224
+ // slight lateral wobble from the first channel's raw value, for visual richness
225
+ const lateral = traj[i][0] !== undefined ? Math.max(-1, Math.min(1, traj[i][0])) * 0.5 : 0;
226
+ pts.push(new THREE.Vector3(lateral, h, z));
227
+ }
228
+ // pad remaining slots by repeating the last point (keeps buffer size constant)
229
+ const last = pts[pts.length - 1] || new THREE.Vector3(0, 0, 0);
230
+ while (pts.length < MAX_STEPS) pts.push(last.clone());
231
+ return pts;
232
+ }
233
+
234
+ function _updateRibbons() {
235
+ const live = S.state === "live";
236
+ const THREE = _THREE;
237
+
238
+ const realPts = live ? _trajToPoints(S.trajReal) : _emptyRibbonPoints();
239
+ const complexPts = live ? _trajToPoints(S.trajComplexMag) : _emptyRibbonPoints();
240
+
241
+ if (_realLine) {
242
+ _realLine.geometry.setFromPoints(realPts);
243
+ _realLine.geometry.computeBoundingSphere();
244
+ const col = live ? C_REAL : C_DIM;
245
+ _realLine.material.color.setHex(col);
246
+ _realLine.material.opacity = live ? 0.85 : 0.25;
247
+ }
248
+ if (_realDots) {
249
+ _realDots.geometry.setFromPoints(realPts);
250
+ const col = live ? C_REAL : C_DIM;
251
+ _realDots.material.color.setHex(col);
252
+ _realDots.material.opacity = live ? 0.9 : 0.2;
253
+ }
254
+ if (_complexLine) {
255
+ _complexLine.geometry.setFromPoints(complexPts);
256
+ _complexLine.geometry.computeBoundingSphere();
257
+ const col = live ? C_COMPLEX : C_DIM;
258
+ _complexLine.material.color.setHex(col);
259
+ _complexLine.material.opacity = live ? 0.85 : 0.25;
260
+ }
261
+ if (_complexDots) {
262
+ _complexDots.geometry.setFromPoints(complexPts);
263
+ const col = live ? C_COMPLEX : C_DIM;
264
+ _complexDots.material.color.setHex(col);
265
+ _complexDots.material.opacity = live ? 0.9 : 0.2;
266
+ }
267
+ }
268
+
269
+ function _updateGapBar() {
270
+ if (!_gapBar) return;
271
+ const live = S.state === "live";
272
+ // bar length encodes log10(throughput_ratio) clamped to a reasonable visual range
273
+ const ratio = (live && S.throughputRatio) ? S.throughputRatio : 1;
274
+ const logRatio = Math.max(0, Math.min(4, Math.log10(Math.max(ratio, 1)))); // 0..4 decades
275
+ const len = 0.4 + logRatio * 1.9; // world units
276
+ _gapBar.scale.x = len / 0.4;
277
+ _gapBar.position.x = -3.8 + (len / 0.4) * 0.2;
278
+ const col = live ? C_ACCENT : C_DIM;
279
+ _gapBar.material.color.setHex(col);
280
+ _gapBar.material.emissive.setHex(col);
281
+ _gapBar.material.emissiveIntensity = live ? 0.4 : 0.15;
282
+ }
283
+
284
+ // =============================================================================
285
+ // per-frame animation
286
+ // =============================================================================
287
+ function _onFrame() {
288
+ const t = performance.now();
289
+ if (_group) _group.rotation.y = Math.sin(t * 0.00010) * 0.15;
290
+ if (_realLine) _realLine.rotation.y += 0.0015;
291
+ if (_complexLine) _complexLine.rotation.y += 0.0015;
292
+ }
293
+
294
+ // =============================================================================
295
+ // overlay
296
+ // =============================================================================
297
+ function _buildOverlay() {
298
+ const ctx = _ctx;
299
+ _overlay = document.createElement("div");
300
+ Object.assign(_overlay.style, {
301
+ position: "absolute", left: "14px", top: "14px", zIndex: "6",
302
+ display: "flex", flexDirection: "column", gap: "8px",
303
+ maxWidth: "min(94%,440px)",
304
+ font: "12px ui-sans-serif,system-ui,Segoe UI,Roboto,Arial",
305
+ color: "#eef3f6",
306
+ });
307
+
308
+ const h = document.createElement("div");
309
+ h.style.cssText = "font:600 13px ui-sans-serif,system-ui;letter-spacing:.4px";
310
+ h.textContent = TITLE;
311
+ _overlay.appendChild(h);
312
+
313
+ const sub = document.createElement("div");
314
+ sub.style.cssText = "color:#9fb1bf;font-size:11px;line-height:1.55";
315
+ sub.innerHTML =
316
+ 'A <b>selective state-space scan</b> (h<sub>t</sub> = A(x<sub>t</sub>)\u00b7h<sub>t-1</sub> + B(x<sub>t</sub>)\u00b7x<sub>t</sub>) ' +
317
+ 'runs over a synthetic sequence task. The <b style="color:#5b8dee">blue ribbon</b> is a ' +
318
+ '<b>real-valued</b> state (decay-only); the <b style="color:#8a6bff">violet ribbon</b> is a ' +
319
+ '<b>complex-valued</b> state (decay + rotation \u2014 the Mamba-3 addition). Honesty label ' +
320
+ '<b>MODELED</b> (a simulation of the recurrence \u2014 no trained checkpoint, no measured GPU ' +
321
+ 'benchmark). 0 runtime CDN.';
322
+ _overlay.appendChild(sub);
323
+
324
+ const brow = document.createElement("div");
325
+ brow.style.cssText = "display:flex;gap:8px;align-items:center;flex-wrap:wrap";
326
+ if (_badge && _badge.el) brow.appendChild(_badge.el);
327
+ _overlay.appendChild(brow);
328
+
329
+ const card = document.createElement("div");
330
+ card.style.cssText = "background:#0a1117;border:1px solid #1d2a36;border-radius:9px;padding:9px 10px;display:flex;flex-direction:column;gap:6px";
331
+
332
+ const chead = document.createElement("div");
333
+ chead.style.cssText = "display:flex;align-items:center;gap:8px;flex-wrap:wrap";
334
+ const dot = document.createElement("span");
335
+ dot.style.cssText = "width:9px;height:9px;border-radius:50%;background:#5b8dee;box-shadow:0 0 7px #5b8dee";
336
+ const nm = document.createElement("b");
337
+ nm.style.cssText = "font-size:12px;color:#5b8dee;letter-spacing:.3px";
338
+ nm.textContent = "ssm";
339
+ chead.appendChild(dot); chead.appendChild(nm);
340
+ card.appendChild(chead);
341
+
342
+ const grid = document.createElement("div");
343
+ grid.style.cssText = "display:grid;grid-template-columns:1fr;gap:4px";
344
+
345
+ function kpiRow(id, label) {
346
+ const r = document.createElement("div");
347
+ r.style.cssText = "display:flex;justify-content:space-between;gap:10px;font-size:11px";
348
+ const l = document.createElement("span"); l.style.cssText = "color:#9fb1bf"; l.textContent = label;
349
+ const v = document.createElement("b");
350
+ v.id = id;
351
+ v.style.cssText = "font-variant-numeric:tabular-nums;color:#eef3f6;text-align:right;max-width:58%";
352
+ v.textContent = "\u2014";
353
+ _el[id] = v;
354
+ r.appendChild(l); r.appendChild(v); return r;
355
+ }
356
+
357
+ grid.appendChild(kpiRow("ssm-task", "task"));
358
+ grid.appendChild(kpiRow("ssm-dims", "seq_len \u00d7 state_dim"));
359
+ grid.appendChild(kpiRow("ssm-real", "real-state accuracy"));
360
+ grid.appendChild(kpiRow("ssm-complex", "complex-state accuracy (Mamba-3)"));
361
+ grid.appendChild(kpiRow("ssm-flopsq", "compute FLOPs \u2014 O(L\u00b2) attention"));
362
+ grid.appendChild(kpiRow("ssm-flopss", "compute FLOPs \u2014 O(L) SSM scan"));
363
+ grid.appendChild(kpiRow("ssm-ratio", "throughput ratio (quad / ssm)"));
364
+ grid.appendChild(kpiRow("ssm-label", "honesty label"));
365
+ card.appendChild(grid);
366
+
367
+ const fn = document.createElement("div");
368
+ fn.style.cssText = "font-size:9.5px;color:#6b7a86;line-height:1.5";
369
+ fn.textContent = "Gu & Dao arXiv:2312.00752 (Mamba) \u00b7 Dao & Gu arXiv:2405.21060 (Mamba-2) \u00b7 Lahoti et al. arXiv:2603.15569 (Mamba-3, complex-valued state tracking) \u00b7 github.com/state-spaces/mamba. MODELED \u00b7 not claimed-as.";
370
+ card.appendChild(fn);
371
+ _overlay.appendChild(card);
372
+
373
+ const pl = document.createElement("button");
374
+ pl.textContent = "\u25d1 what this means";
375
+ pl.title = "Toggle plain-language explanation for investors & consumers.";
376
+ pl.style.cssText = "font:11px ui-monospace,monospace;padding:5px 11px;border-radius:7px;border:1px solid #3af4c8;background:#08140f;color:#3af4c8;cursor:pointer;width:fit-content";
377
+ pl.addEventListener("click", () => {
378
+ _plain = !_plain;
379
+ pl.style.background = _plain ? "#0f2a20" : "#08140f";
380
+ _applyPlain();
381
+ });
382
+ _overlay.appendChild(pl);
383
+
384
+ const pd = document.createElement("div");
385
+ pd.id = "ssm-plain";
386
+ pd.style.cssText = "font-size:10.5px;color:#c9d6df;line-height:1.55;border:1px dashed #26333f;border-radius:7px;padding:7px 9px;display:none";
387
+ _el["plain"] = pd;
388
+ _overlay.appendChild(pd);
389
+
390
+ (ctx.container || document.body).appendChild(_overlay);
391
+ _paintOverlay();
392
+ }
393
+
394
+ function _applyPlain() {
395
+ const pd = _el["plain"];
396
+ if (!pd) return;
397
+ pd.style.display = _plain ? "block" : "none";
398
+ if (!_plain) return;
399
+ const task = S.task || "loading\u2026";
400
+ const real = S.realAcc != null ? (S.realAcc * 100).toFixed(1) + "%" : "loading\u2026";
401
+ const cplx = S.complexAcc != null ? (S.complexAcc * 100).toFixed(1) + "%" : "loading\u2026";
402
+ const ratio = S.throughputRatio != null ? S.throughputRatio.toFixed(1) + "\u00d7" : "loading\u2026";
403
+ pd.innerHTML =
404
+ "<b>What this means:</b> Transformers compare every token to every other token, so their " +
405
+ "compute grows with the <i>square</i> of sequence length (O(L\u00b2)). A <b>state-space model</b> " +
406
+ "(the architecture family behind Mamba) instead keeps a running summary (\u201cstate\u201d) that updates " +
407
+ "once per token, so compute grows only <i>linearly</i> (O(L)) \u2014 our modeled FLOP counts show " +
408
+ "roughly a <b>" + ratio + "</b> compute advantage at this sequence length. But early state-space " +
409
+ "models had a weakness: a real-number-only state can only fade, not <i>flip</i>, so it fails at " +
410
+ "exact tasks like <b>" + task + "</b> (here: <b>" + real + "</b> accuracy). Mamba-3's key addition is " +
411
+ "letting the state be a <b>complex number</b> \u2014 it can rotate, which lets it flip sign exactly " +
412
+ "when needed, jumping accuracy to <b>" + cplx + "</b>. " +
413
+ "Plain: linear-cost sequence models are catching up to Transformers not just on speed, but on " +
414
+ "exact reasoning tasks. This view is a <b>MODELED</b> simulation of the mechanism, not a trained " +
415
+ "production model.";
416
+ }
417
+
418
+ function _tok(s) {
419
+ if (s === "live") return null;
420
+ if (s === "missing") return "NO-LIVE-DATA";
421
+ if (s === "degraded") return "DEGRADED";
422
+ if (s === "error") return "OFFLINE";
423
+ return "\u2026";
424
+ }
425
+
426
+ function fx(v, d) { return typeof v === "number" ? v.toFixed(d) : "\u2014"; }
427
+ function fexp(v) { return typeof v === "number" ? v.toExponential(3) : "\u2014"; }
428
+ function _set(id, v) { if (_el[id]) _el[id].textContent = v; }
429
+
430
+ function _paintOverlay() {
431
+ const t = _tok(S.state);
432
+ _set("ssm-task", t || (S.task || "\u2014"));
433
+ _set("ssm-dims", t || ((S.seqLen != null && S.stateDim != null) ? `${S.seqLen} \u00d7 ${S.stateDim}` : "\u2014"));
434
+ _set("ssm-real", t || (S.realAcc != null ? (S.realAcc * 100).toFixed(2) + "%" : "\u2014"));
435
+ _set("ssm-complex", t || (S.complexAcc != null ? (S.complexAcc * 100).toFixed(2) + "%" : "\u2014"));
436
+ _set("ssm-flopsq", t || fexp(S.flopsQuad));
437
+ _set("ssm-flopss", t || fexp(S.flopsSSM));
438
+ _set("ssm-ratio", t || (S.throughputRatio != null ? S.throughputRatio.toFixed(2) + "\u00d7" : "\u2014"));
439
+ // honesty label verbatim — never upgraded
440
+ _set("ssm-label", t || (S.label || "MODELED"));
441
+ if (_plain) _applyPlain();
442
+ }
443
+
444
+ // =============================================================================
445
+ // unmount — clean up everything; must not affect other organs
446
+ // =============================================================================
447
+ export function unmount() {
448
+ _polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
449
+ try { if (_overlay && _overlay.parentNode) _overlay.parentNode.removeChild(_overlay); } catch (_) {}
450
+ try {
451
+ if (_group && _stage) {
452
+ _group.traverse((o) => {
453
+ if (o.geometry && o.geometry.dispose) o.geometry.dispose();
454
+ if (o.material) {
455
+ const ms = Array.isArray(o.material) ? o.material : [o.material];
456
+ ms.forEach((m) => { if (m.dispose) m.dispose(); });
457
+ }
458
+ });
459
+ _stage.scene.remove(_group);
460
+ }
461
+ } catch (_) {}
462
+ _group = _overlay = null;
463
+ _realLine = _complexLine = _realDots = _complexDots = _gapBar = _gapBarBg = null;
464
+ _el = {}; _badge = null; _plain = false; _frameReg = false;
465
+ _stage = _THREE = _ctx = null;
466
+ S.label = S.task = S.seqLen = S.stateDim = null;
467
+ S.realAcc = S.complexAcc = S.flopsQuad = S.flopsSSM = S.throughputRatio = null;
468
+ S.trajReal = S.trajComplexMag = null;
469
+ S.state = "init";
470
+ }
471
+
472
+ export default { id: ID, title: TITLE, endpoints: [EP], mount, unmount };
static/3d/surfaces/testtime.js ADDED
@@ -0,0 +1,493 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // © 2026 Lutar, Stephen P. — SZL Holdings · ORCID 0009-0001-0110-4173 · Doctrine v11
3
+ //
4
+ // surfaces/testtime.js — TEST-TIME-COMPUTE / REASONING-SCALING-LAWS organ for the
5
+ // holographic frontier ring. The THIRD scaling axis (alongside pretrain scaling and
6
+ // post-train scaling): how much extra INFERENCE-time compute buys how much accuracy.
7
+ //
8
+ // Renders two 3D growing curves driven by a live closed-form snapshot from
9
+ // /api/killinchu/v1/testtime/scaling:
10
+ // 1. pass@N (best-of-N / repeated-sampling coverage) — a curve that climbs across
11
+ // N = 1,2,4,...,256 parallel samples.
12
+ // 2. sequential revision accuracy vs number of reasoning/revision steps — a curve
13
+ // with diminishing returns as k grows.
14
+ // A HUD shows accuracy climbing as compute (N / steps) increases, plus the derived
15
+ // scaling_exponent and effective_oom_multiplier. Honesty label "MODELED" is read
16
+ // VERBATIM from the JSON and displayed as-is; it is never upgraded.
17
+ //
18
+ // Surface export shape (mirrors neuromorphic.js / interpretability.js exactly):
19
+ // export default { id, title, endpoints, mount(ctx), unmount() }
20
+ // ctx = { stage, container, live, label, THREE, szl3d }
21
+ //
22
+ // DATA SHOWN (all from live endpoint):
23
+ // base_accuracy, N_samples, pass_at_N, pass_at_N_curve[]
24
+ // sequential_steps, revised_accuracy, revised_accuracy_curve[]
25
+ // scaling_exponent, effective_oom_multiplier
26
+ //
27
+ // LEADERS ADOPTED & CITED (clean-room; NOT claimed as SZL's own):
28
+ // DeepSeek-R1 (RL reasoning / long CoT): DeepSeek-AI et al. 2025, arXiv:2501.12948
29
+ // https://arxiv.org/abs/2501.12948
30
+ // Scaling LLM Test-Time Compute Optimally: Snell et al. 2024, arXiv:2408.03314
31
+ // https://arxiv.org/abs/2408.03314
32
+ // Large Language Monkeys (repeated sampling / pass@N): Brown et al. 2024, arXiv:2407.21787
33
+ // https://arxiv.org/abs/2407.21787
34
+ //
35
+ // HONESTY LABELS: MODELED (closed-form scaling-law simulation; no LLM calls, no live
36
+ // model eval). Read verbatim from JSON; never upgraded here.
37
+ // COLOURS: lattice-blue 0x5b8dee (pass@N curve), violet-blue 0x8a6bff (revision curve),
38
+ // proof-teal 0x3af4c8 (HUD accent / rising-compute marker). Purple BANNED as UI/background.
39
+ // 0 RUNTIME CDN. Vendored three.js r170 via page importmap.
40
+ // DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
41
+ // Nothing here is in the locked-8. Λ stays Conjecture 1. Trust never 100%.
42
+
43
+ const ID = "testtime";
44
+ const TITLE = "Test-Time Compute · Reasoning-Scaling Laws (live)";
45
+
46
+ // Endpoint is hosted on the dedicated killinchu Space (isolated compute), reached
47
+ // cross-origin (killinchu returns access-control-allow-origin: https://a-11-oy.com).
48
+ // This keeps the test-time-compute organ's rebuilds/faults isolated from the flagship.
49
+ const EP = "https://szlholdings-killinchu.hf.space/api/killinchu/v1/testtime/scaling?seed=42&p=0.2&N=64&steps=8";
50
+
51
+ // data-viz hues — purple BANNED
52
+ const C_PASSN = 0x5b8dee; // lattice-blue (pass@N curve)
53
+ const C_REVISE = 0x8a6bff; // violet-blue (sequential revision curve — data-viz only)
54
+ const C_DIM = 0x42505d; // grey (degraded / no-live-data)
55
+ const C_ACCENT = 0x3af4c8; // proof-teal accent (HUD / rising-compute marker)
56
+ const C_GRID = 0x1b3a44; // floor / link colour
57
+
58
+ // curve layout geometry
59
+ const CURVE_LEN = 10.0; // world-units along X (compute axis, log-spaced)
60
+ const CURVE_DEPTH = 3.0; // world-units separating the two curve lanes (Z)
61
+ const CURVE_HEIGHT= 5.0; // world-units of max curve rise (Y, accuracy axis)
62
+
63
+ let _stage = null, _THREE = null, _ctx = null, _group = null, _overlay = null;
64
+ let _frameReg = false, _polls = [], _el = {}, _badge = null;
65
+ let _plain = false;
66
+
67
+ // geometry handles
68
+ let _passLine = null; // THREE.Line — pass@N growing curve
69
+ let _passDots = []; // Array<THREE.Mesh> — markers along pass@N curve
70
+ let _revLine = null; // THREE.Line — sequential-revision growing curve
71
+ let _revDots = []; // Array<THREE.Mesh> — markers along revision curve
72
+ let _marker = null; // THREE.Mesh — HUD "current compute" marker (pulses)
73
+ let _floor = null;
74
+
75
+ // live state
76
+ const S = {
77
+ label: null,
78
+ baseAcc: null, // base_accuracy
79
+ N: null, // N_samples
80
+ passAtN: null, // pass_at_N
81
+ passCurve: null, // pass_at_N_curve[]
82
+ steps: null, // sequential_steps
83
+ revAcc: null, // revised_accuracy
84
+ revCurve: null, // revised_accuracy_curve[]
85
+ scalingExp: null, // scaling_exponent
86
+ effOom: null, // effective_oom_multiplier
87
+ state: "init",
88
+ };
89
+
90
+ // =============================================================================
91
+ // mount(ctx)
92
+ // =============================================================================
93
+ export function mount(ctx) {
94
+ _ctx = ctx; _stage = ctx.stage; _THREE = ctx.THREE;
95
+ _group = new _THREE.Group();
96
+ _stage.scene.add(_group);
97
+ _stage.camera.position.set(2, 8, 20);
98
+ try { if (_stage.controls && _stage.controls.target) { _stage.controls.target.set(2, 2.5, 0); _stage.controls.update(); } } catch (_) {}
99
+ try { _stage.setBloom(true); } catch (_) {}
100
+
101
+ _buildFloor();
102
+ _buildCurves();
103
+ _buildMarker();
104
+
105
+ if (!_frameReg) { _stage.onFrame(_onFrame); _frameReg = true; }
106
+
107
+ _badge = ctx.live.createBadge();
108
+ _polls.push(ctx.live.poll(EP, 5000, _onScaling, { badge: _badge, onState: (m) => { S.state = m.state; _paintOverlay(); } }));
109
+
110
+ _buildOverlay();
111
+ return { id: ID, started: true };
112
+ }
113
+
114
+ // =============================================================================
115
+ // builders
116
+ // =============================================================================
117
+ function _buildFloor() {
118
+ const THREE = _THREE;
119
+ const grid = new THREE.GridHelper(40, 40, C_GRID, 0x0f2027);
120
+ grid.material.opacity = 0.18; grid.material.transparent = true; grid.position.y = -0.01;
121
+ _group.add(grid);
122
+ _floor = grid;
123
+ }
124
+
125
+ // Pre-allocate curve line geometries with a fixed max point-count; we update
126
+ // point positions in-place as live data arrives (no per-poll geometry churn).
127
+ const _MAX_PTS = 16;
128
+
129
+ function _buildCurves() {
130
+ const THREE = _THREE;
131
+
132
+ // pass@N curve lane (Z = 0)
133
+ {
134
+ const pts = new Array(_MAX_PTS).fill(0).map(() => new THREE.Vector3(0, 0, 0));
135
+ const geo = new THREE.BufferGeometry().setFromPoints(pts);
136
+ const mat = new THREE.LineBasicMaterial({ color: C_PASSN, transparent: true, opacity: 0.85, linewidth: 2 });
137
+ _passLine = new THREE.Line(geo, mat);
138
+ _group.add(_passLine);
139
+
140
+ const dotGeo = new THREE.SphereGeometry(0.09, 10, 8);
141
+ for (let i = 0; i < _MAX_PTS; i++) {
142
+ const m = new THREE.Mesh(dotGeo, new THREE.MeshStandardMaterial({ color: C_PASSN, emissive: C_PASSN, emissiveIntensity: 0.3 }));
143
+ m.visible = false;
144
+ _group.add(m);
145
+ _passDots.push(m);
146
+ }
147
+ }
148
+
149
+ // sequential-revision curve lane (Z = CURVE_DEPTH)
150
+ {
151
+ const pts = new Array(_MAX_PTS).fill(0).map(() => new THREE.Vector3(0, 0, CURVE_DEPTH));
152
+ const geo = new THREE.BufferGeometry().setFromPoints(pts);
153
+ const mat = new THREE.LineBasicMaterial({ color: C_REVISE, transparent: true, opacity: 0.85, linewidth: 2 });
154
+ _revLine = new THREE.Line(geo, mat);
155
+ _group.add(_revLine);
156
+
157
+ const dotGeo = new THREE.SphereGeometry(0.09, 10, 8);
158
+ for (let i = 0; i < _MAX_PTS; i++) {
159
+ const m = new THREE.Mesh(dotGeo, new THREE.MeshStandardMaterial({ color: C_REVISE, emissive: C_REVISE, emissiveIntensity: 0.3 }));
160
+ m.visible = false;
161
+ _group.add(m);
162
+ _revDots.push(m);
163
+ }
164
+ }
165
+
166
+ // baseline axes (compute axis + accuracy axis ticks), grey, data-viz only
167
+ const axisPts = [
168
+ new THREE.Vector3(0, 0, -0.6), new THREE.Vector3(0, CURVE_HEIGHT, -0.6), // accuracy axis
169
+ new THREE.Vector3(0, 0, -0.6), new THREE.Vector3(CURVE_LEN, 0, -0.6), // compute axis
170
+ ];
171
+ const axisGeo = new THREE.BufferGeometry().setFromPoints(axisPts);
172
+ const axisLine = new THREE.LineSegments(axisGeo, new THREE.LineBasicMaterial({ color: C_GRID, transparent: true, opacity: 0.4 }));
173
+ _group.add(axisLine);
174
+ }
175
+
176
+ function _buildMarker() {
177
+ const THREE = _THREE;
178
+ _marker = new THREE.Mesh(
179
+ new THREE.IcosahedronGeometry(0.22, 1),
180
+ new THREE.MeshStandardMaterial({ color: C_ACCENT, emissive: C_ACCENT, emissiveIntensity: 0.5, wireframe: true, transparent: true, opacity: 0.85 }),
181
+ );
182
+ _marker.position.set(0, 0, 0);
183
+ _group.add(_marker);
184
+ }
185
+
186
+ // =============================================================================
187
+ // live data handler
188
+ // =============================================================================
189
+ function _onScaling(j) {
190
+ // read honesty label VERBATIM — never upgrade
191
+ S.label = (j.label || "MODELED").toUpperCase();
192
+ S.baseAcc = typeof j.base_accuracy === "number" ? j.base_accuracy : null;
193
+ S.N = typeof j.N_samples === "number" ? j.N_samples : null;
194
+ S.passAtN = typeof j.pass_at_N === "number" ? j.pass_at_N : null;
195
+ S.passCurve = Array.isArray(j.pass_at_N_curve) ? j.pass_at_N_curve : null;
196
+ S.steps = typeof j.sequential_steps === "number" ? j.sequential_steps : null;
197
+ S.revAcc = typeof j.revised_accuracy === "number" ? j.revised_accuracy : null;
198
+ S.revCurve = Array.isArray(j.revised_accuracy_curve) ? j.revised_accuracy_curve : null;
199
+ S.scalingExp = typeof j.scaling_exponent === "number" ? j.scaling_exponent : null;
200
+ S.effOom = typeof j.effective_oom_multiplier === "number" ? j.effective_oom_multiplier : null;
201
+
202
+ _updateCurves();
203
+ _paintOverlay();
204
+ }
205
+
206
+ // =============================================================================
207
+ // geometry updater — drives the two growing curves from live data
208
+ // =============================================================================
209
+ function _logX(n, nMax) {
210
+ // log-spaced compute axis: n=1 -> x=0, n=nMax -> x=CURVE_LEN
211
+ const lo = Math.log10(Math.max(1, 1));
212
+ const hi = Math.log10(Math.max(2, nMax));
213
+ const v = Math.log10(Math.max(1, n));
214
+ return CURVE_LEN * (v - lo) / Math.max(1e-6, (hi - lo));
215
+ }
216
+
217
+ function _linX(k, kMax) {
218
+ return CURVE_LEN * (k / Math.max(1, kMax));
219
+ }
220
+
221
+ function _updateCurves() {
222
+ const THREE = _THREE;
223
+ const live = S.state === "live";
224
+
225
+ // --- pass@N curve ---
226
+ if (live && S.passCurve && S.passCurve.length) {
227
+ const nMax = S.passCurve.reduce((m, r) => Math.max(m, r.n), 1);
228
+ const pos = _passLine.geometry.attributes.position;
229
+ const n = Math.min(_MAX_PTS, S.passCurve.length);
230
+ for (let i = 0; i < _MAX_PTS; i++) {
231
+ if (i < n) {
232
+ const row = S.passCurve[i];
233
+ const x = _logX(row.n, nMax);
234
+ const y = row.pass_at_n * CURVE_HEIGHT;
235
+ pos.setXYZ(i, x, y, 0);
236
+ _passDots[i].position.set(x, y, 0);
237
+ _passDots[i].visible = true;
238
+ } else {
239
+ // repeat last point so the line doesn't dangle at origin
240
+ const row = S.passCurve[n - 1];
241
+ const x = _logX(row.n, nMax);
242
+ const y = row.pass_at_n * CURVE_HEIGHT;
243
+ pos.setXYZ(i, x, y, 0);
244
+ _passDots[i].visible = false;
245
+ }
246
+ }
247
+ pos.needsUpdate = true;
248
+ _passLine.geometry.computeBoundingSphere();
249
+ _passLine.material.color.setHex(C_PASSN);
250
+ _passLine.material.opacity = 0.85;
251
+ } else {
252
+ _passDots.forEach((d) => { d.visible = false; });
253
+ _passLine.material.color.setHex(C_DIM);
254
+ _passLine.material.opacity = 0.25;
255
+ }
256
+
257
+ // --- sequential-revision curve ---
258
+ if (live && S.revCurve && S.revCurve.length) {
259
+ const kMax = S.revCurve.reduce((m, r) => Math.max(m, r.k), 1);
260
+ const pos = _revLine.geometry.attributes.position;
261
+ const n = Math.min(_MAX_PTS, S.revCurve.length);
262
+ for (let i = 0; i < _MAX_PTS; i++) {
263
+ if (i < n) {
264
+ const row = S.revCurve[i];
265
+ const x = _linX(row.k, kMax);
266
+ const y = row.revised_accuracy * CURVE_HEIGHT;
267
+ pos.setXYZ(i, x, y, CURVE_DEPTH);
268
+ _revDots[i].position.set(x, y, CURVE_DEPTH);
269
+ _revDots[i].visible = true;
270
+ } else {
271
+ const row = S.revCurve[n - 1];
272
+ const x = _linX(row.k, kMax);
273
+ const y = row.revised_accuracy * CURVE_HEIGHT;
274
+ pos.setXYZ(i, x, y, CURVE_DEPTH);
275
+ _revDots[i].visible = false;
276
+ }
277
+ }
278
+ pos.needsUpdate = true;
279
+ _revLine.geometry.computeBoundingSphere();
280
+ _revLine.material.color.setHex(C_REVISE);
281
+ _revLine.material.opacity = 0.85;
282
+ } else {
283
+ _revDots.forEach((d) => { d.visible = false; });
284
+ _revLine.material.color.setHex(C_DIM);
285
+ _revLine.material.opacity = 0.25;
286
+ }
287
+
288
+ // --- HUD marker: sits at the current (N, pass@N) point, pulses proof-teal ---
289
+ if (_marker) {
290
+ if (live && S.passAtN != null && S.N != null && S.passCurve && S.passCurve.length) {
291
+ const nMax = S.passCurve.reduce((m, r) => Math.max(m, r.n), 1);
292
+ const x = _logX(S.N, nMax);
293
+ const y = S.passAtN * CURVE_HEIGHT;
294
+ _marker.position.set(x, y, 0);
295
+ _marker.material.color.setHex(C_ACCENT);
296
+ _marker.material.emissive.setHex(C_ACCENT);
297
+ _marker.material.opacity = 0.85;
298
+ } else {
299
+ _marker.material.color.setHex(C_DIM);
300
+ _marker.material.emissive.setHex(C_DIM);
301
+ _marker.material.opacity = 0.3;
302
+ }
303
+ }
304
+ }
305
+
306
+ // =============================================================================
307
+ // per-frame animation
308
+ // =============================================================================
309
+ function _onFrame() {
310
+ const t = performance.now();
311
+ if (_group) _group.rotation.y = Math.sin(t * 0.00010) * 0.15;
312
+ if (_marker) {
313
+ _marker.rotation.y += 0.02;
314
+ _marker.rotation.x += 0.01;
315
+ const pulse = 1.0 + 0.15 * Math.sin(t * 0.004);
316
+ _marker.scale.setScalar(pulse);
317
+ }
318
+ }
319
+
320
+ // =============================================================================
321
+ // overlay
322
+ // =============================================================================
323
+ function _buildOverlay() {
324
+ const ctx = _ctx;
325
+ _overlay = document.createElement("div");
326
+ Object.assign(_overlay.style, {
327
+ position: "absolute", left: "14px", top: "14px", zIndex: "6",
328
+ display: "flex", flexDirection: "column", gap: "8px",
329
+ maxWidth: "min(94%,440px)",
330
+ font: "12px ui-sans-serif,system-ui,Segoe UI,Roboto,Arial",
331
+ color: "#eef3f6",
332
+ });
333
+
334
+ const h = document.createElement("div");
335
+ h.style.cssText = "font:600 13px ui-sans-serif,system-ui;letter-spacing:.4px";
336
+ h.textContent = TITLE;
337
+ _overlay.appendChild(h);
338
+
339
+ const sub = document.createElement("div");
340
+ sub.style.cssText = "color:#9fb1bf;font-size:11px;line-height:1.55";
341
+ sub.innerHTML =
342
+ 'The <b>third scaling axis</b> (alongside pretrain and post-train): spend more ' +
343
+ '<b>inference-time compute</b> \u2014 parallel repeated sampling (<b>pass@N</b>) or ' +
344
+ 'sequential reasoning steps \u2014 and trade it for accuracy. Honesty label ' +
345
+ '<b>MODELED</b> (closed-form scaling law; no LLM calls, no live model eval). 0 runtime CDN.';
346
+ _overlay.appendChild(sub);
347
+
348
+ const brow = document.createElement("div");
349
+ brow.style.cssText = "display:flex;gap:8px;align-items:center;flex-wrap:wrap";
350
+ if (_badge && _badge.el) brow.appendChild(_badge.el);
351
+ _overlay.appendChild(brow);
352
+
353
+ const card = document.createElement("div");
354
+ card.style.cssText = "background:#0a1117;border:1px solid #1d2a36;border-radius:9px;padding:9px 10px;display:flex;flex-direction:column;gap:6px";
355
+
356
+ const chead = document.createElement("div");
357
+ chead.style.cssText = "display:flex;align-items:center;gap:8px;flex-wrap:wrap";
358
+ const dot = document.createElement("span");
359
+ dot.style.cssText = "width:9px;height:9px;border-radius:50%;background:#5b8dee;box-shadow:0 0 7px #5b8dee";
360
+ const nm = document.createElement("b");
361
+ nm.style.cssText = "font-size:12px;color:#5b8dee;letter-spacing:.3px";
362
+ nm.textContent = "test-time-compute";
363
+ chead.appendChild(dot); chead.appendChild(nm);
364
+ card.appendChild(chead);
365
+
366
+ const grid = document.createElement("div");
367
+ grid.style.cssText = "display:grid;grid-template-columns:1fr;gap:4px";
368
+
369
+ function kpiRow(id, label) {
370
+ const r = document.createElement("div");
371
+ r.style.cssText = "display:flex;justify-content:space-between;gap:10px;font-size:11px";
372
+ const l = document.createElement("span"); l.style.cssText = "color:#9fb1bf"; l.textContent = label;
373
+ const v = document.createElement("b");
374
+ v.id = id;
375
+ v.style.cssText = "font-variant-numeric:tabular-nums;color:#eef3f6;text-align:right;max-width:58%";
376
+ v.textContent = "\u2014";
377
+ _el[id] = v;
378
+ r.appendChild(l); r.appendChild(v); return r;
379
+ }
380
+
381
+ grid.appendChild(kpiRow("tt-base", "base accuracy p"));
382
+ grid.appendChild(kpiRow("tt-n", "N samples (parallel compute)"));
383
+ grid.appendChild(kpiRow("tt-passn", "pass@N \u2014 MODELED"));
384
+ grid.appendChild(kpiRow("tt-steps", "sequential steps k"));
385
+ grid.appendChild(kpiRow("tt-rev", "revised accuracy \u2014 MODELED"));
386
+ grid.appendChild(kpiRow("tt-exp", "scaling exponent"));
387
+ grid.appendChild(kpiRow("tt-oom", "effective compute (orders of magnitude)"));
388
+ grid.appendChild(kpiRow("tt-label", "honesty label"));
389
+ card.appendChild(grid);
390
+
391
+ const fn = document.createElement("div");
392
+ fn.style.cssText = "font-size:9.5px;color:#6b7a86;line-height:1.5";
393
+ fn.textContent = "DeepSeek-R1, DeepSeek-AI et al. arXiv:2501.12948 \u00b7 Snell et al. arXiv:2408.03314 (optimal test-time compute) \u00b7 Brown et al. arXiv:2407.21787 (Large Language Monkeys / pass@N). MODELED \u00b7 not claimed-as.";
394
+ card.appendChild(fn);
395
+ _overlay.appendChild(card);
396
+
397
+ const pl = document.createElement("button");
398
+ pl.textContent = "\u25d1 what this means";
399
+ pl.title = "Toggle plain-language explanation for investors & consumers.";
400
+ pl.style.cssText = "font:11px ui-monospace,monospace;padding:5px 11px;border-radius:7px;border:1px solid #3af4c8;background:#08140f;color:#3af4c8;cursor:pointer;width:fit-content";
401
+ pl.addEventListener("click", () => {
402
+ _plain = !_plain;
403
+ pl.style.background = _plain ? "#0f2a20" : "#08140f";
404
+ _applyPlain();
405
+ });
406
+ _overlay.appendChild(pl);
407
+
408
+ const pd = document.createElement("div");
409
+ pd.id = "tt-plain";
410
+ pd.style.cssText = "font-size:10.5px;color:#c9d6df;line-height:1.55;border:1px dashed #26333f;border-radius:7px;padding:7px 9px;display:none";
411
+ _el["plain"] = pd;
412
+ _overlay.appendChild(pd);
413
+
414
+ (ctx.container || document.body).appendChild(_overlay);
415
+ _paintOverlay();
416
+ }
417
+
418
+ function _applyPlain() {
419
+ const pd = _el["plain"];
420
+ if (!pd) return;
421
+ pd.style.display = _plain ? "block" : "none";
422
+ if (!_plain) return;
423
+ const n = S.N != null ? String(S.N) : "loading\u2026";
424
+ const pAtN = S.passAtN != null ? (S.passAtN * 100).toFixed(2) + "%" : "loading\u2026";
425
+ const steps= S.steps != null ? String(S.steps) : "loading\u2026";
426
+ const rAcc = S.revAcc != null ? (S.revAcc * 100).toFixed(2) + "%" : "loading\u2026";
427
+ pd.innerHTML =
428
+ "<b>What this means:</b> Instead of training a bigger model, you can spend more " +
429
+ "compute <i>at answer time</i>. Drawing <b>" + n + " independent samples</b> and " +
430
+ "keeping the best one (\u201cbest-of-N\u201d) pushes the chance of getting a correct " +
431
+ "answer to <b>" + pAtN + "</b>. Letting the model take <b>" + steps + " sequential " +
432
+ "reasoning/revision steps</b> instead pushes accuracy to <b>" + rAcc + "</b>, but with " +
433
+ "<i>diminishing returns</i> \u2014 each extra step helps less than the last. " +
434
+ "Plain: this is the third lever for making AI smarter \u2014 next to \u201ctrain a bigger " +
435
+ "model\u201d and \u201cfine-tune it more\u201d, you can also just let it \u201cthink longer\u201d " +
436
+ "at inference time. This view is a <b>MODELED</b> closed-form scaling law, not a live " +
437
+ "model evaluation.";
438
+ }
439
+
440
+ function _tok(s) {
441
+ if (s === "live") return null;
442
+ if (s === "missing") return "NO-LIVE-DATA";
443
+ if (s === "degraded") return "DEGRADED";
444
+ if (s === "error") return "OFFLINE";
445
+ return "\u2026";
446
+ }
447
+
448
+ function fx(v, d) { return typeof v === "number" ? v.toFixed(d) : "\u2014"; }
449
+ function pct(v, d) { return typeof v === "number" ? (v * 100).toFixed(d) + "%" : "\u2014"; }
450
+ function _set(id, v) { if (_el[id]) _el[id].textContent = v; }
451
+
452
+ function _paintOverlay() {
453
+ const t = _tok(S.state);
454
+ _set("tt-base", t || pct(S.baseAcc, 2));
455
+ _set("tt-n", t || (S.N != null ? String(S.N) : "\u2014"));
456
+ _set("tt-passn", t || pct(S.passAtN, 4));
457
+ _set("tt-steps", t || (S.steps != null ? String(S.steps) : "\u2014"));
458
+ _set("tt-rev", t || pct(S.revAcc, 4));
459
+ _set("tt-exp", t || fx(S.scalingExp, 6));
460
+ _set("tt-oom", t || fx(S.effOom, 3));
461
+ // honesty label verbatim — never upgraded
462
+ _set("tt-label", t || (S.label || "MODELED"));
463
+ if (_plain) _applyPlain();
464
+ }
465
+
466
+ // =============================================================================
467
+ // unmount — clean up everything; must not affect other organs
468
+ // =============================================================================
469
+ export function unmount() {
470
+ _polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
471
+ try { if (_overlay && _overlay.parentNode) _overlay.parentNode.removeChild(_overlay); } catch (_) {}
472
+ try {
473
+ if (_group && _stage) {
474
+ _group.traverse((o) => {
475
+ if (o.geometry && o.geometry.dispose) o.geometry.dispose();
476
+ if (o.material) {
477
+ const ms = Array.isArray(o.material) ? o.material : [o.material];
478
+ ms.forEach((m) => { if (m.dispose) m.dispose(); });
479
+ }
480
+ });
481
+ _stage.scene.remove(_group);
482
+ }
483
+ } catch (_) {}
484
+ _group = _overlay = null;
485
+ _passLine = null; _passDots = []; _revLine = null; _revDots = []; _marker = null; _floor = null;
486
+ _el = {}; _badge = null; _plain = false; _frameReg = false;
487
+ _stage = _THREE = _ctx = null;
488
+ S.label = S.baseAcc = S.N = S.passAtN = S.passCurve = null;
489
+ S.steps = S.revAcc = S.revCurve = S.scalingExp = S.effOom = null;
490
+ S.state = "init";
491
+ }
492
+
493
+ export default { id: ID, title: TITLE, endpoints: [EP], mount, unmount };
szl3d_holographic.py CHANGED
@@ -37,6 +37,9 @@ SURFACES: List[Dict[str, str]] = [
37
  {"id": "worldmodel", "title": "World Model", "owner": "Dev0"},
38
  {"id": "qec", "title": "Topological QEC", "owner": "Dev0"},
39
  {"id": "episodic", "title": "Episodic Memory", "owner": "Dev0"},
 
 
 
40
  {"id": "energy", "title": "Energy", "owner": "Dev1"},
41
  {"id": "fabric", "title": "Compute Fabric", "owner": "Dev2"},
42
  {"id": "pnt", "title": "PNT", "owner": "Dev3"},
 
37
  {"id": "worldmodel", "title": "World Model", "owner": "Dev0"},
38
  {"id": "qec", "title": "Topological QEC", "owner": "Dev0"},
39
  {"id": "episodic", "title": "Episodic Memory", "owner": "Dev0"},
40
+ {"id": "testtime", "title": "Test-Time Compute", "owner": "Dev0"},
41
+ {"id": "ssm", "title": "State-Space (Mamba-3)", "owner": "Dev0"},
42
+ {"id": "genie", "title": "Genie World-Model", "owner": "Dev0"},
43
  {"id": "energy", "title": "Energy", "owner": "Dev1"},
44
  {"id": "fabric", "title": "Compute Fabric", "owner": "Dev2"},
45
  {"id": "pnt", "title": "PNT", "owner": "Dev3"},