Spaces:
Running
Running
deploy(hf): sync szl-holdings/a11oy@main derived COPY set
Browse filesReusable Dockerfile-COPY-derived deploy from szl-holdings/a11oy main.
Files: 903 Pruned: 0
Derived from Dockerfile COPY sources (NO hand-maintained allowlist).
Signed-off-by: SZL Holdings <noreply@szlholdings.ai>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- a11oy_code_orchestrator.py +6 -1
- static/3d/holographic.html +1 -1
- static/3d/surfaces/brain.js +504 -379
- static/3d/surfaces/keyless.js +37 -106
- static/3d/surfaces/kla.js +28 -97
- static/3d/surfaces/kvcache.js +35 -104
- static/3d/surfaces/matgran.js +33 -102
- static/3d/surfaces/mla.js +33 -102
- static/3d/surfaces/moe.js +26 -95
- static/3d/surfaces/mor.js +31 -105
- static/3d/surfaces/muon.js +31 -100
- static/3d/surfaces/nested.js +34 -103
- static/3d/surfaces/neuromorphic.js +36 -102
- static/3d/surfaces/nsa.js +35 -104
- static/3d/surfaces/nvfp4.js +42 -112
- static/3d/surfaces/opera.js +36 -105
- static/3d/surfaces/pfield.js +34 -103
- static/3d/surfaces/pinn.js +32 -35
- static/3d/surfaces/pnt.js +26 -35
- szl_factory.py +5 -1
- szl_mbse.py +6 -1
- szl_nemo_agents.py +16 -4
a11oy_code_orchestrator.py
CHANGED
|
@@ -68,7 +68,12 @@ from fastapi.responses import JSONResponse, PlainTextResponse, StreamingResponse
|
|
| 68 |
# never break the existing orchestrator routes (Zero-Bandaid: degrade honestly).
|
| 69 |
# ---------------------------------------------------------------------------
|
| 70 |
try:
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
except Exception as _exc: # pragma: no cover
|
| 73 |
_agent = None
|
| 74 |
_AGENT_IMPORT_ERROR = str(_exc)
|
|
|
|
| 68 |
# never break the existing orchestrator routes (Zero-Bandaid: degrade honestly).
|
| 69 |
# ---------------------------------------------------------------------------
|
| 70 |
try:
|
| 71 |
+
# Prefer the installable shared substrate; fall back to the local vendored
|
| 72 |
+
# copy if the package is absent (guarded — the outer except is the final net).
|
| 73 |
+
try:
|
| 74 |
+
from szl_substrate import a11oy_agent_loop as _agent # governed FSM
|
| 75 |
+
except Exception:
|
| 76 |
+
import a11oy_agent_loop as _agent # governed FSM
|
| 77 |
except Exception as _exc: # pragma: no cover
|
| 78 |
_agent = None
|
| 79 |
_AGENT_IMPORT_ERROR = str(_exc)
|
static/3d/holographic.html
CHANGED
|
@@ -159,7 +159,7 @@ const SURFACES = [
|
|
| 159 |
{ id: "dla", title: "Dynamic Linear Attention", mod: "/static/3d/surfaces/dla.js" },
|
| 160 |
{ id: "ctxready", title: "Context-Ready Transformer", mod: "/static/3d/surfaces/ctxready.js" },
|
| 161 |
{ id: "opera", title: "OPERA Perplexity-Reward Alignment", mod: "/static/3d/surfaces/opera.js" },
|
| 162 |
-
{ id: "brain", title: "
|
| 163 |
{ id: "zkinfer", title: "zkML Proof-of-Inference (Cryptographic Receipts)", mod: "/static/3d/surfaces/zkinfer.js" },
|
| 164 |
{ id: "flower", title: "Flower Brain", mod: "/static/3d/surfaces/flower.js" },
|
| 165 |
{ id: "agentmem", title: "AgentMem · Λ-Governed Agent Memory (synthesis)", mod: "/static/3d/surfaces/agentmem.js" },
|
|
|
|
| 159 |
{ id: "dla", title: "Dynamic Linear Attention", mod: "/static/3d/surfaces/dla.js" },
|
| 160 |
{ id: "ctxready", title: "Context-Ready Transformer", mod: "/static/3d/surfaces/ctxready.js" },
|
| 161 |
{ id: "opera", title: "OPERA Perplexity-Reward Alignment", mod: "/static/3d/surfaces/opera.js" },
|
| 162 |
+
{ id: "brain", title: "Brain — live knowledge graph", mod: "/static/3d/surfaces/brain.js" },
|
| 163 |
{ id: "zkinfer", title: "zkML Proof-of-Inference (Cryptographic Receipts)", mod: "/static/3d/surfaces/zkinfer.js" },
|
| 164 |
{ id: "flower", title: "Flower Brain", mod: "/static/3d/surfaces/flower.js" },
|
| 165 |
{ id: "agentmem", title: "AgentMem · Λ-Governed Agent Memory (synthesis)", mod: "/static/3d/surfaces/agentmem.js" },
|
static/3d/surfaces/brain.js
CHANGED
|
@@ -1,29 +1,37 @@
|
|
| 1 |
// SPDX-License-Identifier: Apache-2.0
|
| 2 |
-
// © 2026 Lutar, Stephen P. — SZL Holdings · ORCID 0009-0001-0110-4173 · Doctrine v11
|
| 3 |
//
|
| 4 |
-
// surfaces/brain.js —
|
| 5 |
-
// OWN
|
| 6 |
-
//
|
| 7 |
-
//
|
| 8 |
-
// proven core across K rounds. This is the "make it our own" fusion — it reuses
|
| 9 |
-
// three field-leader mechanisms purely as visualization primitives:
|
| 10 |
-
// * DLA (arXiv:2606.10650) — importance-aware activation ROUTING (edge weights)
|
| 11 |
-
// * OPERA (arXiv:2606.25757) — intrinsic firing REWARD = proven-mass reached
|
| 12 |
-
// * Context-Ready (arXiv:2606.27538) — K-UNROLL as K spreading rounds
|
| 13 |
//
|
| 14 |
-
//
|
| 15 |
-
//
|
| 16 |
-
//
|
| 17 |
-
//
|
| 18 |
-
//
|
|
|
|
|
|
|
| 19 |
//
|
| 20 |
-
//
|
| 21 |
-
// *
|
| 22 |
-
// *
|
| 23 |
-
//
|
| 24 |
-
//
|
| 25 |
-
//
|
| 26 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
//
|
| 28 |
// Surface export shape: export default { id, title, endpoints, mount(ctx), unmount() }
|
| 29 |
// ctx = { stage, container, live, label, THREE, szl3d }
|
|
@@ -31,433 +39,550 @@
|
|
| 31 |
import { createShowcase } from "./_showcase.js";
|
| 32 |
|
| 33 |
const ID = "brain";
|
| 34 |
-
const TITLE = "
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
const
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
//
|
| 41 |
-
const
|
| 42 |
-
//
|
| 43 |
-
const
|
| 44 |
-
|
| 45 |
-
const
|
| 46 |
-
//
|
| 47 |
-
const
|
| 48 |
-
//
|
| 49 |
-
const
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
//
|
| 53 |
-
const
|
| 54 |
-
|
| 55 |
-
const
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
const
|
| 59 |
-
const
|
| 60 |
-
const
|
| 61 |
-
|
| 62 |
-
const
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
let
|
| 69 |
-
let
|
| 70 |
-
|
| 71 |
-
let
|
| 72 |
-
let
|
| 73 |
-
let
|
| 74 |
-
let
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
const S = {
|
| 77 |
-
label: null,
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
archiveCells: null, archiveCellsPossible: null, modeledPromotions: null,
|
| 87 |
-
gateImmutable: null, claimPinningOk: null, rollbackRestored: null,
|
| 88 |
};
|
| 89 |
|
| 90 |
-
//
|
| 91 |
-
//
|
| 92 |
-
|
| 93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
|
| 95 |
-
function _layout(
|
| 96 |
_pos = {};
|
| 97 |
-
const
|
| 98 |
-
|
| 99 |
-
Object.keys(
|
| 100 |
-
const arr =
|
| 101 |
-
const
|
|
|
|
|
|
|
| 102 |
arr.forEach((n, i) => {
|
| 103 |
-
const
|
| 104 |
-
const
|
| 105 |
-
const
|
| 106 |
-
_pos[n.id] = new _THREE.Vector3(Math.cos(
|
| 107 |
});
|
| 108 |
});
|
| 109 |
}
|
| 110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
function mount(ctx) {
|
| 112 |
_ctx = ctx; _stage = ctx.stage; _THREE = ctx.THREE;
|
| 113 |
_group = new _THREE.Group();
|
| 114 |
_stage.scene.add(_group);
|
| 115 |
_t0 = (typeof performance !== "undefined" ? performance.now() : Date.now());
|
|
|
|
| 116 |
|
| 117 |
_buildOverlay(ctx);
|
| 118 |
_badge = ctx.live.createBadge();
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
_polls.push(ctx.live.poll(
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
|
| 130 |
if (!_frameReg && _stage.onFrame) { _stage.onFrame(_animate); _frameReg = true; }
|
| 131 |
}
|
| 132 |
|
| 133 |
function _readLabel(j) {
|
| 134 |
-
const lbl = (j && j.label != null) ? j.label
|
| 135 |
-
: (j && j.payload && j.payload.label != null) ? j.payload.label : "MODELED";
|
| 136 |
return String(lbl).toUpperCase();
|
| 137 |
}
|
| 138 |
|
| 139 |
-
function
|
| 140 |
-
if (!j
|
| 141 |
-
const p = j.payload || j;
|
| 142 |
S.label = _readLabel(j);
|
| 143 |
-
|
| 144 |
-
S.
|
| 145 |
-
S.
|
| 146 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
_paintOverlay();
|
| 148 |
}
|
| 149 |
|
| 150 |
-
function
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 161 |
}
|
| 162 |
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
}
|
| 176 |
|
| 177 |
-
function
|
| 178 |
-
if (!_group || !S.nodes
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
const
|
| 189 |
-
|
| 190 |
});
|
|
|
|
| 191 |
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
const rad = TIER_RADIUS[n.tier] != null ? TIER_RADIUS[n.tier] : 0.2;
|
| 197 |
-
const geo = new _THREE.SphereGeometry(rad, 18, 18);
|
| 198 |
-
// conjecture nodes are flat/emissive-free grey so they can NEVER read as "fired green"
|
| 199 |
-
const mat = new _THREE.MeshStandardMaterial({
|
| 200 |
-
color: col,
|
| 201 |
-
emissive: isConj ? 0x000000 : col,
|
| 202 |
-
emissiveIntensity: isConj ? 0.0 : 0.28,
|
| 203 |
-
metalness: 0.1, roughness: isConj ? 0.95 : 0.5,
|
| 204 |
-
transparent: true, opacity: isConj ? 0.55 : 0.95,
|
| 205 |
-
});
|
| 206 |
-
const mesh = new _THREE.Mesh(geo, mat);
|
| 207 |
-
mesh.position.copy(_pos[n.id]);
|
| 208 |
-
mesh.userData = { id: n.id, tier: n.tier, isConj };
|
| 209 |
-
_nodeMeshes[n.id] = mesh; _group.add(mesh);
|
| 210 |
});
|
|
|
|
|
|
|
|
|
|
| 211 |
}
|
| 212 |
|
| 213 |
-
function
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
// K, brightening proven nodes; conjecture nodes NEVER brighten (stay grey).
|
| 221 |
-
const K = S.rewardPerK ? S.rewardPerK.length : 10;
|
| 222 |
-
const phase = (t * 0.6) % (K + 2);
|
| 223 |
-
Object.values(_nodeMeshes).forEach((m) => {
|
| 224 |
-
if (!m.material) return;
|
| 225 |
-
if (m.userData.isConj) { m.material.emissiveIntensity = 0.0; return; } // gray-only invariant
|
| 226 |
-
const shell = SHELL[m.userData.tier] != null ? SHELL[m.userData.tier] : 5.0;
|
| 227 |
-
const reach = Math.max(0, 1 - Math.abs(phase - shell) * 0.8);
|
| 228 |
-
const base = m.userData.tier === "locked" ? 0.35 : 0.2;
|
| 229 |
-
m.material.emissiveIntensity = base + 0.6 * reach;
|
| 230 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 231 |
}
|
| 232 |
|
| 233 |
-
function
|
| 234 |
-
if (!
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 242 |
}
|
| 243 |
|
| 244 |
-
function
|
| 245 |
-
|
| 246 |
-
const
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 251 |
}
|
| 252 |
|
| 253 |
-
function
|
| 254 |
-
if (!
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
|
|
|
|
|
|
|
|
|
| 260 |
}
|
| 261 |
|
| 262 |
-
function
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 273 |
}
|
| 274 |
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 287 |
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
const
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
|
|
|
| 295 |
}
|
| 296 |
|
| 297 |
-
//
|
| 298 |
-
// overlay
|
| 299 |
-
//
|
| 300 |
function _buildOverlay(ctx) {
|
| 301 |
-
_overlay = document.createElement("div");
|
| 302 |
-
_overlay.style.cssText =
|
| 303 |
-
"position:absolute;top:12px;left:12px;max-width:360px;font:12px/1.5 ui-monospace,Menlo,monospace;" +
|
| 304 |
-
"color:#cfe3ea;background:rgba(15,32,39,0.82);border:1px solid #1b3a44;border-radius:10px;padding:12px 14px;" +
|
| 305 |
-
"pointer-events:auto;backdrop-filter:blur(3px);z-index:20;";
|
| 306 |
-
_overlay.innerHTML =
|
| 307 |
-
'<div style="font-weight:700;letter-spacing:.03em;color:#eaf6f9;font-size:13px">Formula-Graph Brain ' +
|
| 308 |
-
'<span id="brain-label" style="float:right;font-size:10px;padding:1px 7px;border-radius:8px;background:#123;color:#3af4c8;border:1px solid #1b3a44">MODELED</span></div>' +
|
| 309 |
-
'<div style="margin-top:2px;color:#8fb3bd;font-size:10.5px">Our 180+ formulas as a living graph — the proven-8 core fires outward.</div>' +
|
| 310 |
-
'<hr style="border:0;border-top:1px solid #1b3a44;margin:8px 0">' +
|
| 311 |
-
_row("Nodes / Edges", "brain-ne") +
|
| 312 |
-
_row("Locked-proven", "brain-locked") +
|
| 313 |
-
_row("Firing reward (final)", "brain-reward") +
|
| 314 |
-
_row("Proven nodes fired", "brain-fired") +
|
| 315 |
-
_row("Conjectures shown green", "brain-conjgreen") +
|
| 316 |
-
'<hr style="border:0;border-top:1px solid #1b3a44;margin:8px 0">' +
|
| 317 |
-
'<div style="font-size:10.5px;color:#8fb3bd;margin-bottom:2px">Self-repair (lesion → heal)</div>' +
|
| 318 |
-
_row("Lesioned node", "brain-lesion") +
|
| 319 |
-
_row("Body health (healed)", "brain-bodyhealth") +
|
| 320 |
-
_row("Connectivity \u03bb2 aft.", "brain-lam2") +
|
| 321 |
-
_row("Still one mind?", "brain-connected") +
|
| 322 |
-
'<hr style="border:0;border-top:1px solid #1b3a44;margin:8px 0">' +
|
| 323 |
-
'<div style="font-size:10.5px;color:#8fb3bd;margin-bottom:2px">Plasticity (multi-timescale)</div>' +
|
| 324 |
-
_row("Locked canon frozen", "brain-frozen") +
|
| 325 |
-
_row("Plasticity score", "brain-plast") +
|
| 326 |
-
_row("EWC core protection", "brain-ewc") +
|
| 327 |
-
'<hr style="border:0;border-top:1px solid #1b3a44;margin:8px 0">' +
|
| 328 |
-
'<div style="font-size:10.5px;color:#8fb3bd;margin-bottom:2px">Memory (write-back loop)</div>' +
|
| 329 |
-
_row("Receipt beats written", "brain-beats") +
|
| 330 |
-
_row("Hash chain intact", "brain-chain") +
|
| 331 |
-
_row("Reconsolidation gain", "brain-recons") +
|
| 332 |
-
_row("Energy (authoritative)", "brain-energy") +
|
| 333 |
-
'<hr style="border:0;border-top:1px solid #1b3a44;margin:8px 0">' +
|
| 334 |
-
'<div style="font-size:10.5px;color:#8fb3bd;margin-bottom:2px">Homeostasis (self-regulation)</div>' +
|
| 335 |
-
_row("Drive (final)", "brain-drive") +
|
| 336 |
-
_row("In-band set-points", "brain-inband") +
|
| 337 |
-
_row("Viability horizon", "brain-viab") +
|
| 338 |
-
_row("Locked untouched", "brain-untouched") +
|
| 339 |
-
'<hr style="border:0;border-top:1px solid #1b3a44;margin:8px 0">' +
|
| 340 |
-
'<div style="font-size:10.5px;color:#8fb3bd;margin-bottom:2px">Evolution (proposes; kernel disposes)</div>' +
|
| 341 |
-
_row("Archive cells filled", "brain-archive") +
|
| 342 |
-
_row("Promotions (MODELED)", "brain-promos") +
|
| 343 |
-
_row("Kernel gate immutable", "brain-gate") +
|
| 344 |
-
_row("Drift rollback restored", "brain-rollback") +
|
| 345 |
-
'<div id="brain-tiers" style="margin-top:6px;font-size:10.5px;color:#8fb3bd"></div>' +
|
| 346 |
-
'<div style="margin-top:8px;display:flex;gap:10px;flex-wrap:wrap;font-size:10px;color:#9fc">' +
|
| 347 |
-
_leg(C_LOCKED, "proven-8") + _leg(C_SEMANT, "verified") + _leg(C_BORROW, "borrowed") + _leg(C_CONJ, "conjecture (gray)") +
|
| 348 |
-
'</div>' +
|
| 349 |
-
'<div style="margin-top:8px"><button id="brain-plain" style="font:11px ui-monospace;background:#0f2027;color:#9fc;' +
|
| 350 |
-
'border:1px solid #1b3a44;border-radius:6px;padding:3px 8px;cursor:pointer">Plain language</button></div>' +
|
| 351 |
-
'<div id="brain-plainbox" style="display:none;margin-top:8px;font-size:10.5px;color:#bcd;line-height:1.55"></div>';
|
| 352 |
_show = createShowcase(ctx, {
|
| 353 |
-
id: ID, title: TITLE, accent: "#5b8dee",
|
| 354 |
-
chips: [{ label: "MODELED", text: "
|
| 355 |
-
legend:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 356 |
});
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 362 |
}
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 366 |
}
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 370 |
}
|
| 371 |
-
function _set(id, v) { const e = _overlay && _overlay.querySelector("#" + id); if (e) e.textContent = v; }
|
| 372 |
|
| 373 |
function _paintOverlay() {
|
| 374 |
-
if (!
|
| 375 |
-
const deg = (S.state === "error"
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
if (
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
_set("brain-recons", d || (S.reconsGain != null ? (S.reconsGain >= 0 ? "+" : "") + S.reconsGain + " nodes" : "\u2014"));
|
| 394 |
-
_set("brain-energy", d || (S.energyStatus != null ? (S.energyStatus === "MEASURED" ? (S.energyJoules + " J") : "UNAVAILABLE (honest)") : "\u2014"));
|
| 395 |
-
_set("brain-drive", d || (S.driveFinal != null ? S.driveFinal.toFixed(4) + (S.failClosed ? " (fail-closed)" : "") : "\u2014"));
|
| 396 |
-
_set("brain-inband", d || (S.inBand != null && S.setpointCount != null ? S.inBand + " / " + S.setpointCount : "\u2014"));
|
| 397 |
-
_set("brain-viab", d || (S.viability != null ? S.viability + " cycles" : "\u2014"));
|
| 398 |
-
_set("brain-untouched", d || (S.lockedUntouched != null ? (S.lockedUntouched ? "yes (meta-stats only)" : "NO \u2014 alert") : "\u2014"));
|
| 399 |
-
_set("brain-archive", d || (S.archiveCells != null ? (S.archiveCells + (S.archiveCellsPossible != null ? " / " + S.archiveCellsPossible : "")) : "\u2014"));
|
| 400 |
-
_set("brain-promos", d || (S.modeledPromotions != null ? (S.modeledPromotions + " (MODELED, not locked-8)") : "\u2014"));
|
| 401 |
-
_set("brain-gate", d || (S.gateImmutable != null ? (S.gateImmutable ? "yes" : "NO \u2014 alert") : "\u2014"));
|
| 402 |
-
_set("brain-rollback", d || (S.rollbackRestored != null ? (S.rollbackRestored ? "yes" : "NO \u2014 alert") : "\u2014"));
|
| 403 |
-
if (S.tierCounts) {
|
| 404 |
-
const t = S.tierCounts;
|
| 405 |
-
_set("brain-tiers", "tiers: locked " + (t.locked || 0) + " · semantic " + (t.semantic || 0) +
|
| 406 |
-
" · experimental " + (t.experimental || 0) + " · borrowed " + (t.borrowed || 0) + " · conjecture " + (t.conjecture || 0));
|
| 407 |
-
}
|
| 408 |
-
if (_plain) _applyPlain();
|
| 409 |
}
|
| 410 |
|
| 411 |
-
function
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
}
|
| 425 |
}
|
| 426 |
|
| 427 |
-
//
|
| 428 |
// unmount
|
| 429 |
-
//
|
| 430 |
function unmount() {
|
| 431 |
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 432 |
try { if (_show) _show.destroy(); } catch (_) {}
|
| 433 |
-
try {
|
| 434 |
-
try {
|
| 435 |
-
|
| 436 |
-
|
| 437 |
-
|
| 438 |
-
|
| 439 |
-
|
| 440 |
-
|
| 441 |
-
|
| 442 |
-
});
|
| 443 |
-
_stage.scene.remove(_group);
|
| 444 |
-
}
|
| 445 |
-
} catch (_) {}
|
| 446 |
-
_group = _overlay = _show = null;
|
| 447 |
-
_nodeMeshes = {}; _edgeLines = []; _pos = {};
|
| 448 |
-
_el = {}; _badge = null; _plain = false; _frameReg = false;
|
| 449 |
_stage = _THREE = _ctx = null;
|
| 450 |
-
S.label = null; S.
|
| 451 |
-
S.
|
| 452 |
-
S.
|
| 453 |
-
S.
|
| 454 |
-
S.
|
| 455 |
-
S.
|
| 456 |
-
S.driveFinal = S.viability = S.inBand = S.setpointCount = null;
|
| 457 |
-
S.lockedUntouched = S.failClosed = null;
|
| 458 |
-
S.archiveCells = S.archiveCellsPossible = S.modeledPromotions = null;
|
| 459 |
-
S.gateImmutable = S.claimPinningOk = S.rollbackRestored = null;
|
| 460 |
-
S.state = "init";
|
| 461 |
}
|
| 462 |
|
| 463 |
-
export default { id: ID, title: TITLE, endpoints: [
|
|
|
|
| 1 |
// SPDX-License-Identifier: Apache-2.0
|
| 2 |
+
// © 2026 Lutar, Stephen P. Jr. — SZL Holdings · ORCID 0009-0001-0110-4173 · Doctrine v11
|
| 3 |
//
|
| 4 |
+
// surfaces/brain.js — LIVING NEURAL-BRAIN (SZL ORIGINAL). Renders the estate's
|
| 5 |
+
// OWN harvested knowledge graph (GET /api/a11oy/v1/brain/graph) as a
|
| 6 |
+
// neural-network-shaped brain: the SZL answer to the leaked Obsidian
|
| 7 |
+
// "self-writing neural-vault", but real, owned, and honest.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
//
|
| 9 |
+
// FEED-FORWARD LAYERS (the `layer` field on every node):
|
| 10 |
+
// field (-1) harvested field leaders (outer world; papers/repos/people/orgs)
|
| 11 |
+
// input (0) repos + surfaces (the estate's own inputs)
|
| 12 |
+
// hidden (1) topic clusters
|
| 13 |
+
// hidden (2) formulas — the locked-8 {F1,F4,F7,F11,F12,F18,F19,F22} highlighted
|
| 14 |
+
// output (3) estate root + live endpoints (the thesis)
|
| 15 |
+
// Links fire along edges; node size scales with connectivity (degree).
|
| 16 |
//
|
| 17 |
+
// PERFORMANCE (the graph is ~9.4k nodes / ~14k edges — never render it all):
|
| 18 |
+
// * ?summary=1 first → instant honest count pills + the axis-expand list.
|
| 19 |
+
// * full graph fetched once (progressive) → we render a PERFORMANT SUBSET:
|
| 20 |
+
// the estate core (layers 0..3) + the top-connected field leaders, with a
|
| 21 |
+
// per-axis expand control. Long-tail field leaders draw via ONE InstancedMesh
|
| 22 |
+
// (LOD); the estate core + top leaders draw as individual meshes so the shared
|
| 23 |
+
// showcase labels (top-N + hover/tap) can target them. Hard cap on rendered
|
| 24 |
+
// nodes keeps it smooth on mobile.
|
| 25 |
+
//
|
| 26 |
+
// HONESTY (Doctrine v11 — read VERBATIM, never upgraded):
|
| 27 |
+
// * BOTH counts shown: distinct_artifacts (the honest headline) AND the raw
|
| 28 |
+
// node_count, with the endpoint's note that ~56% of nodes are arXiv
|
| 29 |
+
// co-author `person` nodes — NEVER present the raw total as distinct work.
|
| 30 |
+
// * locked-proven = EXACTLY 8; harvest adds nothing to it.
|
| 31 |
+
// * Λ = Conjecture 1 → GREY node, NEVER green/proven.
|
| 32 |
+
// * palette: lattice-blue 0x5b8dee · violet-blue 0x8a6bff · proof-teal 0x3af4c8
|
| 33 |
+
// · greys. PURPLE BANNED. 0 runtime CDN (three.js via ctx.THREE).
|
| 34 |
+
// * inspiration (leaked neural-vault) is cited as prior art, never claimed.
|
| 35 |
//
|
| 36 |
// Surface export shape: export default { id, title, endpoints, mount(ctx), unmount() }
|
| 37 |
// ctx = { stage, container, live, label, THREE, szl3d }
|
|
|
|
| 39 |
import { createShowcase } from "./_showcase.js";
|
| 40 |
|
| 41 |
const ID = "brain";
|
| 42 |
+
const TITLE = "Brain — live knowledge graph";
|
| 43 |
+
|
| 44 |
+
// same-origin a11oy endpoints (canonical a-11-oy.com in prod; relative here)
|
| 45 |
+
const EP_SUMMARY = "/api/a11oy/v1/brain/graph?summary=1";
|
| 46 |
+
const EP_GRAPH = "/api/a11oy/v1/brain/graph";
|
| 47 |
+
|
| 48 |
+
// palette (doctrine v11) — NO purple
|
| 49 |
+
const C_FIELD = 0x3a5a8c; // lattice-blue (dim) — harvested field leaders
|
| 50 |
+
const C_INPUT = 0x5b8dee; // lattice-blue — repos + surfaces (input)
|
| 51 |
+
const C_TOPIC = 0x8a6bff; // violet-blue — topic clusters
|
| 52 |
+
const C_FORMULA = 0x8a6bff; // violet-blue — formulas
|
| 53 |
+
const C_LOCKED = 0x3af4c8; // proof-teal — locked-proven core
|
| 54 |
+
const C_ESTATE = 0x3af4c8; // proof-teal — estate root (output)
|
| 55 |
+
const C_ENDPT = 0x5b8dee; // lattice-blue — live endpoints
|
| 56 |
+
const C_CONJ = 0x5a6570; // GREY — conjectures (Λ) — never green
|
| 57 |
+
const C_EDGE = 0x1b3a44; // dim link
|
| 58 |
+
const C_FIRE = 0x3af4c8; // firing pulse (proof-teal)
|
| 59 |
+
|
| 60 |
+
// feed-forward x-position per layer (field outer-left → estate output-right)
|
| 61 |
+
const LAYER_X = { "-1": -14, "0": -6.5, "1": -1.0, "2": 4.5, "3": 10.5 };
|
| 62 |
+
// disc radius per layer (field ring is broad; the estate core is compact)
|
| 63 |
+
const LAYER_R = { "-1": 8.5, "0": 4.2, "1": 2.0, "2": 3.2, "3": 1.6 };
|
| 64 |
+
|
| 65 |
+
// render budget (LOD): keep the estate core + this many top-connected leaders
|
| 66 |
+
const FIELD_TOP = 480; // default top-connected field leaders
|
| 67 |
+
const MAX_NODES = 1650; // hard cap on rendered nodes (mobile-safe)
|
| 68 |
+
const LABEL_MESH_MAX = 220; // nodes drawn as individual meshes (labelable)
|
| 69 |
+
const MAX_EDGES = 6500; // rendered edge cap
|
| 70 |
+
const FIRE_MAX = 220; // simultaneous firing pulses
|
| 71 |
+
|
| 72 |
+
let _stage = null, _THREE = null, _ctx = null, _group = null, _show = null;
|
| 73 |
+
let _badge = null, _polls = [], _frameReg = false, _t0 = 0;
|
| 74 |
+
|
| 75 |
+
// scene objects
|
| 76 |
+
let _sphereGeo = null; // shared unit sphere for individual meshes
|
| 77 |
+
let _labelMeshes = []; // individual Mesh nodes (labelable/hover)
|
| 78 |
+
let _inst = null, _instGeo = null, _instMat = null; // InstancedMesh long tail
|
| 79 |
+
let _edges = null, _edgeGeo = null, _edgeMat = null; // LineSegments
|
| 80 |
+
let _fire = null, _fireGeo = null, _fireMat = null; // firing pulse Points
|
| 81 |
+
let _fireEdges = []; // [{a:Vec3, b:Vec3, off}] sampled edges
|
| 82 |
+
let _pos = {}; // id -> Vector3 (rendered nodes)
|
| 83 |
+
|
| 84 |
+
// axis expand control
|
| 85 |
+
let _activeAxes = new Set(); // axes fully included beyond top-N
|
| 86 |
+
let _axisBtns = {}; // axis -> button el
|
| 87 |
|
| 88 |
const S = {
|
| 89 |
+
label: null, state: "init", loaded: false,
|
| 90 |
+
// honest counts (from ?summary=1 / full)
|
| 91 |
+
nodeCount: null, linkCount: null, distinct: null, persons: null,
|
| 92 |
+
artifactNote: null, lockedFlagged: null,
|
| 93 |
+
byLayer: null, byKind: null, byAxis: null,
|
| 94 |
+
// full graph (client cache)
|
| 95 |
+
nodes: null, links: null, byId: null,
|
| 96 |
+
// render stats
|
| 97 |
+
renderedNodes: 0, renderedEdges: 0, fieldShown: 0,
|
|
|
|
|
|
|
| 98 |
};
|
| 99 |
|
| 100 |
+
// -------------------------------------------------------------------------- //
|
| 101 |
+
// deterministic layout: golden-angle disc in the Y-Z plane per layer, laid
|
| 102 |
+
// out along X feed-forward. Stable (hash-seeded), no RNG needed on the client.
|
| 103 |
+
// -------------------------------------------------------------------------- //
|
| 104 |
+
function _hash(str) {
|
| 105 |
+
let h = 2166136261 >>> 0;
|
| 106 |
+
for (let i = 0; i < str.length; i++) { h ^= str.charCodeAt(i); h = Math.imul(h, 16777619) >>> 0; }
|
| 107 |
+
return h;
|
| 108 |
+
}
|
| 109 |
|
| 110 |
+
function _layout(rendered) {
|
| 111 |
_pos = {};
|
| 112 |
+
const byLayer = {};
|
| 113 |
+
rendered.forEach((n) => { const L = String(n.layer); (byLayer[L] = byLayer[L] || []).push(n); });
|
| 114 |
+
Object.keys(byLayer).forEach((L) => {
|
| 115 |
+
const arr = byLayer[L];
|
| 116 |
+
const x = LAYER_X[L] != null ? LAYER_X[L] : 0;
|
| 117 |
+
const R = LAYER_R[L] != null ? LAYER_R[L] : 4;
|
| 118 |
+
const N = arr.length;
|
| 119 |
arr.forEach((n, i) => {
|
| 120 |
+
const r = R * Math.sqrt((i + 0.5) / N);
|
| 121 |
+
const theta = i * 2.399963229728653; // golden angle
|
| 122 |
+
const jx = ((_hash(n.id) % 200) / 200 - 0.5) * 1.6; // depth jitter along x
|
| 123 |
+
_pos[n.id] = new _THREE.Vector3(x + jx, r * Math.cos(theta), r * Math.sin(theta));
|
| 124 |
});
|
| 125 |
});
|
| 126 |
}
|
| 127 |
|
| 128 |
+
// node visual: colour + radius by kind/layer/degree. Conjectures stay grey.
|
| 129 |
+
function _isConj(n) {
|
| 130 |
+
return (n.conjecture != null) || n.formula_id === "F23";
|
| 131 |
+
}
|
| 132 |
+
function _nodeColor(n) {
|
| 133 |
+
if (_isConj(n)) return C_CONJ;
|
| 134 |
+
if (n.kind === "formula") return n.locked ? C_LOCKED : C_FORMULA;
|
| 135 |
+
if (n.kind === "estate") return C_ESTATE;
|
| 136 |
+
if (n.kind === "endpoint") return C_ENDPT;
|
| 137 |
+
if (n.kind === "topic") return C_TOPIC;
|
| 138 |
+
if (n.layer === 0) return C_INPUT;
|
| 139 |
+
return C_FIELD;
|
| 140 |
+
}
|
| 141 |
+
function _nodeRadius(n) {
|
| 142 |
+
const deg = n.degree || 0;
|
| 143 |
+
let r = 0.14 + 0.055 * Math.sqrt(deg);
|
| 144 |
+
if (n.locked) r = Math.max(r, 0.42);
|
| 145 |
+
if (n.kind === "estate") r = Math.max(r, 0.55);
|
| 146 |
+
return Math.min(r, 0.9);
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
// -------------------------------------------------------------------------- //
|
| 150 |
+
// mount
|
| 151 |
+
// -------------------------------------------------------------------------- //
|
| 152 |
function mount(ctx) {
|
| 153 |
_ctx = ctx; _stage = ctx.stage; _THREE = ctx.THREE;
|
| 154 |
_group = new _THREE.Group();
|
| 155 |
_stage.scene.add(_group);
|
| 156 |
_t0 = (typeof performance !== "undefined" ? performance.now() : Date.now());
|
| 157 |
+
_sphereGeo = new _THREE.SphereGeometry(1, 10, 8);
|
| 158 |
|
| 159 |
_buildOverlay(ctx);
|
| 160 |
_badge = ctx.live.createBadge();
|
| 161 |
+
if (_show) _show.setBadge(_badge);
|
| 162 |
+
|
| 163 |
+
// Phase 1: tiny summary → honest count pills + axis list (polls, keeps badge live).
|
| 164 |
+
_polls.push(ctx.live.poll(EP_SUMMARY, 20000, _onSummary, {
|
| 165 |
+
badge: _badge, onState: (m) => { S.state = m.state; _paintOverlay(); },
|
| 166 |
+
}));
|
| 167 |
+
// Phase 2: full graph fetched ONCE (progressive) → render a performant subset.
|
| 168 |
+
_fetchFullGraph();
|
| 169 |
+
|
| 170 |
+
// top-N + hover/tap labels bound to the labelable individual meshes only.
|
| 171 |
+
if (_show) {
|
| 172 |
+
_show.attachSceneLabels({
|
| 173 |
+
objects: () => _labelMeshes,
|
| 174 |
+
text: (o) => (o.userData && o.userData.node && (o.userData.node.title || o.userData.node.id)) || "",
|
| 175 |
+
weight: (o) => (o.userData && o.userData.node && o.userData.node.degree) || 0,
|
| 176 |
+
topN: 12, hover: true, fadeNear: 10, fadeFar: 70,
|
| 177 |
+
});
|
| 178 |
+
}
|
| 179 |
|
| 180 |
if (!_frameReg && _stage.onFrame) { _stage.onFrame(_animate); _frameReg = true; }
|
| 181 |
}
|
| 182 |
|
| 183 |
function _readLabel(j) {
|
| 184 |
+
const lbl = (j && j.label != null) ? j.label : "MODELED";
|
|
|
|
| 185 |
return String(lbl).toUpperCase();
|
| 186 |
}
|
| 187 |
|
| 188 |
+
function _onSummary(j) {
|
| 189 |
+
if (!j) { S.state = "error"; _paintOverlay(); return; }
|
|
|
|
| 190 |
S.label = _readLabel(j);
|
| 191 |
+
const sm = j.summary || {};
|
| 192 |
+
S.nodeCount = j.node_count != null ? j.node_count : sm.node_count;
|
| 193 |
+
S.linkCount = j.link_count != null ? j.link_count : sm.link_count;
|
| 194 |
+
S.distinct = j.distinct_artifacts != null ? j.distinct_artifacts : sm.distinct_artifacts;
|
| 195 |
+
S.persons = j.person_node_count != null ? j.person_node_count : sm.person_node_count;
|
| 196 |
+
S.artifactNote = j.artifact_note || null;
|
| 197 |
+
S.lockedFlagged = sm.locked_flagged != null ? sm.locked_flagged : S.lockedFlagged;
|
| 198 |
+
S.byLayer = sm.by_layer || S.byLayer;
|
| 199 |
+
S.byKind = sm.by_kind || S.byKind;
|
| 200 |
+
S.byAxis = sm.by_axis || S.byAxis;
|
| 201 |
+
_buildAxisControls();
|
| 202 |
_paintOverlay();
|
| 203 |
}
|
| 204 |
|
| 205 |
+
function _fetchFullGraph() {
|
| 206 |
+
fetch(EP_GRAPH, { headers: { accept: "application/json" } })
|
| 207 |
+
.then((r) => (r.ok ? r.json() : Promise.reject(new Error("http " + r.status))))
|
| 208 |
+
.then((j) => {
|
| 209 |
+
const nodes = Array.isArray(j.nodes) ? j.nodes : [];
|
| 210 |
+
const links = Array.isArray(j.links) ? j.links : [];
|
| 211 |
+
if (!nodes.length) return;
|
| 212 |
+
S.nodes = nodes; S.links = links;
|
| 213 |
+
S.byId = {};
|
| 214 |
+
nodes.forEach((n) => { S.byId[n.id] = n; });
|
| 215 |
+
S.label = _readLabel(j);
|
| 216 |
+
// full payload carries the honest counts too — prefer them
|
| 217 |
+
if (j.node_count != null) S.nodeCount = j.node_count;
|
| 218 |
+
if (j.link_count != null) S.linkCount = j.link_count;
|
| 219 |
+
if (j.distinct_artifacts != null) S.distinct = j.distinct_artifacts;
|
| 220 |
+
if (j.person_node_count != null) S.persons = j.person_node_count;
|
| 221 |
+
if (j.artifact_note) S.artifactNote = j.artifact_note;
|
| 222 |
+
if (j.summary) {
|
| 223 |
+
S.byAxis = j.summary.by_axis || S.byAxis;
|
| 224 |
+
S.byKind = j.summary.by_kind || S.byKind;
|
| 225 |
+
S.byLayer = j.summary.by_layer || S.byLayer;
|
| 226 |
+
if (j.summary.locked_flagged != null) S.lockedFlagged = j.summary.locked_flagged;
|
| 227 |
+
}
|
| 228 |
+
S.loaded = true;
|
| 229 |
+
_buildAxisControls();
|
| 230 |
+
_rebuild();
|
| 231 |
+
_paintOverlay();
|
| 232 |
+
})
|
| 233 |
+
.catch(() => { S.state = "error"; _paintOverlay(); });
|
| 234 |
}
|
| 235 |
|
| 236 |
+
// -------------------------------------------------------------------------- //
|
| 237 |
+
// subset selection + build
|
| 238 |
+
// -------------------------------------------------------------------------- //
|
| 239 |
+
function _selectRendered() {
|
| 240 |
+
const nodes = S.nodes || [];
|
| 241 |
+
const core = []; // layers 0..3 — always rendered
|
| 242 |
+
const field = []; // layer -1
|
| 243 |
+
nodes.forEach((n) => { (n.layer === -1 ? field : core).push(n); });
|
| 244 |
+
field.sort((a, b) => (b.degree || 0) - (a.degree || 0));
|
| 245 |
+
|
| 246 |
+
const chosen = new Map();
|
| 247 |
+
core.forEach((n) => chosen.set(n.id, n));
|
| 248 |
+
|
| 249 |
+
// top-connected field leaders (LOD default set)
|
| 250 |
+
for (let i = 0; i < field.length && chosen.size < MAX_NODES && i < FIELD_TOP; i++) {
|
| 251 |
+
chosen.set(field[i].id, field[i]);
|
| 252 |
+
}
|
| 253 |
+
// axis-expand: fully include leaders on any active axis (up to the cap)
|
| 254 |
+
if (_activeAxes.size) {
|
| 255 |
+
for (let i = 0; i < field.length && chosen.size < MAX_NODES; i++) {
|
| 256 |
+
const n = field[i];
|
| 257 |
+
if (n.axis && _activeAxes.has(n.axis)) chosen.set(n.id, n);
|
| 258 |
+
}
|
| 259 |
+
}
|
| 260 |
+
const rendered = Array.from(chosen.values());
|
| 261 |
+
S.fieldShown = rendered.filter((n) => n.layer === -1).length;
|
| 262 |
+
return rendered;
|
| 263 |
}
|
| 264 |
|
| 265 |
+
function _rebuild() {
|
| 266 |
+
if (!_group || !S.nodes) return;
|
| 267 |
+
_clearScene();
|
| 268 |
+
const rendered = _selectRendered();
|
| 269 |
+
S.renderedNodes = rendered.length;
|
| 270 |
+
_layout(rendered);
|
| 271 |
+
|
| 272 |
+
// pick which nodes get an individual (labelable) mesh: highest-degree first,
|
| 273 |
+
// but always keep the estate core (layers 1..3) individual so the thesis is
|
| 274 |
+
// hoverable. The long tail draws via one InstancedMesh.
|
| 275 |
+
const ranked = rendered.slice().sort((a, b) => {
|
| 276 |
+
const pa = a.layer >= 1 ? 1e9 : 0, pb = b.layer >= 1 ? 1e9 : 0;
|
| 277 |
+
return (pb + (b.degree || 0)) - (pa + (a.degree || 0));
|
| 278 |
});
|
| 279 |
+
const individualSet = new Set(ranked.slice(0, Math.min(LABEL_MESH_MAX, ranked.length)).map((n) => n.id));
|
| 280 |
|
| 281 |
+
const tail = [];
|
| 282 |
+
rendered.forEach((n) => {
|
| 283 |
+
if (individualSet.has(n.id)) _addLabelMesh(n);
|
| 284 |
+
else tail.push(n);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 285 |
});
|
| 286 |
+
_buildInstanced(tail);
|
| 287 |
+
_buildEdges(rendered);
|
| 288 |
+
_buildFire();
|
| 289 |
}
|
| 290 |
|
| 291 |
+
function _addLabelMesh(n) {
|
| 292 |
+
const mat = new _THREE.MeshStandardMaterial({
|
| 293 |
+
color: _nodeColor(n),
|
| 294 |
+
emissive: _isConj(n) ? 0x000000 : _nodeColor(n),
|
| 295 |
+
emissiveIntensity: _isConj(n) ? 0.0 : 0.32,
|
| 296 |
+
metalness: 0.1, roughness: _isConj(n) ? 0.95 : 0.5,
|
| 297 |
+
transparent: true, opacity: _isConj(n) ? 0.6 : 0.96,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 298 |
});
|
| 299 |
+
const mesh = new _THREE.Mesh(_sphereGeo, mat);
|
| 300 |
+
const r = _nodeRadius(n);
|
| 301 |
+
mesh.scale.setScalar(r);
|
| 302 |
+
mesh.position.copy(_pos[n.id]);
|
| 303 |
+
mesh.userData = { node: n, baseEmissive: mat.emissiveIntensity, isConj: _isConj(n) };
|
| 304 |
+
_labelMeshes.push(mesh);
|
| 305 |
+
_group.add(mesh);
|
| 306 |
}
|
| 307 |
|
| 308 |
+
function _buildInstanced(tail) {
|
| 309 |
+
if (!tail.length) return;
|
| 310 |
+
_instGeo = new _THREE.SphereGeometry(1, 8, 6);
|
| 311 |
+
_instMat = new _THREE.MeshStandardMaterial({
|
| 312 |
+
metalness: 0.1, roughness: 0.6, transparent: true, opacity: 0.9,
|
| 313 |
+
emissiveIntensity: 0.28, vertexColors: false,
|
| 314 |
+
});
|
| 315 |
+
_inst = new _THREE.InstancedMesh(_instGeo, _instMat, tail.length);
|
| 316 |
+
_inst.instanceColor = new _THREE.InstancedBufferAttribute(new Float32Array(tail.length * 3), 3);
|
| 317 |
+
const m = new _THREE.Matrix4();
|
| 318 |
+
const q = new _THREE.Quaternion();
|
| 319 |
+
const s = new _THREE.Vector3();
|
| 320 |
+
const c = new _THREE.Color();
|
| 321 |
+
tail.forEach((n, i) => {
|
| 322 |
+
const r = _nodeRadius(n);
|
| 323 |
+
s.set(r, r, r);
|
| 324 |
+
m.compose(_pos[n.id], q, s);
|
| 325 |
+
_inst.setMatrixAt(i, m);
|
| 326 |
+
c.setHex(_nodeColor(n));
|
| 327 |
+
_inst.setColorAt(i, c);
|
| 328 |
+
});
|
| 329 |
+
_inst.instanceMatrix.needsUpdate = true;
|
| 330 |
+
if (_inst.instanceColor) _inst.instanceColor.needsUpdate = true;
|
| 331 |
+
// give the instanced material a base emissive so the tail is visible under bloom
|
| 332 |
+
_instMat.emissive = new _THREE.Color(C_FIELD);
|
| 333 |
+
_group.add(_inst);
|
| 334 |
}
|
| 335 |
|
| 336 |
+
function _buildEdges(rendered) {
|
| 337 |
+
const ids = new Set(rendered.map((n) => n.id));
|
| 338 |
+
const links = S.links || [];
|
| 339 |
+
const pts = [];
|
| 340 |
+
const sample = [];
|
| 341 |
+
for (let i = 0; i < links.length && pts.length / 2 < MAX_EDGES; i++) {
|
| 342 |
+
const l = links[i];
|
| 343 |
+
const a = _pos[l.source], b = _pos[l.target];
|
| 344 |
+
if (!a || !b || !ids.has(l.source) || !ids.has(l.target)) continue;
|
| 345 |
+
pts.push(a.x, a.y, a.z, b.x, b.y, b.z);
|
| 346 |
+
if (sample.length < FIRE_MAX && (i % 3 === 0)) sample.push({ a, b, off: Math.random() });
|
| 347 |
+
}
|
| 348 |
+
S.renderedEdges = pts.length / 2;
|
| 349 |
+
if (!pts.length) return;
|
| 350 |
+
_edgeGeo = new _THREE.BufferGeometry();
|
| 351 |
+
_edgeGeo.setAttribute("position", new _THREE.Float32BufferAttribute(pts, 3));
|
| 352 |
+
_edgeMat = new _THREE.LineBasicMaterial({ color: C_EDGE, transparent: true, opacity: 0.22 });
|
| 353 |
+
_edges = new _THREE.LineSegments(_edgeGeo, _edgeMat);
|
| 354 |
+
_group.add(_edges);
|
| 355 |
+
_fireEdges = sample;
|
| 356 |
}
|
| 357 |
|
| 358 |
+
function _buildFire() {
|
| 359 |
+
if (!_fireEdges.length) return;
|
| 360 |
+
_fireGeo = new _THREE.BufferGeometry();
|
| 361 |
+
_fireGeo.setAttribute("position", new _THREE.Float32BufferAttribute(new Float32Array(_fireEdges.length * 3), 3));
|
| 362 |
+
_fireMat = new _THREE.PointsMaterial({
|
| 363 |
+
color: C_FIRE, size: 0.32, transparent: true, opacity: 0.95,
|
| 364 |
+
blending: _THREE.AdditiveBlending, depthWrite: false, sizeAttenuation: true,
|
| 365 |
+
});
|
| 366 |
+
_fire = new _THREE.Points(_fireGeo, _fireMat);
|
| 367 |
+
_group.add(_fire);
|
| 368 |
}
|
| 369 |
|
| 370 |
+
function _clearScene() {
|
| 371 |
+
_labelMeshes.forEach((m) => {
|
| 372 |
+
if (m.material && m.material.dispose) m.material.dispose();
|
| 373 |
+
_group.remove(m);
|
| 374 |
+
});
|
| 375 |
+
_labelMeshes = [];
|
| 376 |
+
if (_inst) { _group.remove(_inst); _inst.dispose && _inst.dispose(); }
|
| 377 |
+
if (_instGeo) _instGeo.dispose();
|
| 378 |
+
if (_instMat) _instMat.dispose();
|
| 379 |
+
_inst = _instGeo = _instMat = null;
|
| 380 |
+
if (_edges) { _group.remove(_edges); }
|
| 381 |
+
if (_edgeGeo) _edgeGeo.dispose();
|
| 382 |
+
if (_edgeMat) _edgeMat.dispose();
|
| 383 |
+
_edges = _edgeGeo = _edgeMat = null;
|
| 384 |
+
if (_fire) { _group.remove(_fire); }
|
| 385 |
+
if (_fireGeo) _fireGeo.dispose();
|
| 386 |
+
if (_fireMat) _fireMat.dispose();
|
| 387 |
+
_fire = _fireGeo = _fireMat = null;
|
| 388 |
+
_fireEdges = [];
|
| 389 |
}
|
| 390 |
|
| 391 |
+
// -------------------------------------------------------------------------- //
|
| 392 |
+
// animation: gentle rotation + firing pulses travelling source→target
|
| 393 |
+
// -------------------------------------------------------------------------- //
|
| 394 |
+
function _animate() {
|
| 395 |
+
if (!_group) return;
|
| 396 |
+
const now = (typeof performance !== "undefined" ? performance.now() : Date.now());
|
| 397 |
+
const t = (now - _t0) / 1000;
|
| 398 |
+
_group.rotation.y = Math.sin(t * 0.08) * 0.5 + t * 0.03;
|
| 399 |
+
|
| 400 |
+
// firing pulses: each sampled edge carries a point that travels src→dst on loop
|
| 401 |
+
if (_fire && _fireGeo && _fireEdges.length) {
|
| 402 |
+
const arr = _fireGeo.attributes.position.array;
|
| 403 |
+
for (let i = 0; i < _fireEdges.length; i++) {
|
| 404 |
+
const e = _fireEdges[i];
|
| 405 |
+
let f = (t * 0.5 + e.off) % 1;
|
| 406 |
+
const j = i * 3;
|
| 407 |
+
arr[j] = e.a.x + (e.b.x - e.a.x) * f;
|
| 408 |
+
arr[j + 1] = e.a.y + (e.b.y - e.a.y) * f;
|
| 409 |
+
arr[j + 2] = e.a.z + (e.b.z - e.a.z) * f;
|
| 410 |
+
}
|
| 411 |
+
_fireGeo.attributes.position.needsUpdate = true;
|
| 412 |
+
}
|
| 413 |
|
| 414 |
+
// subtle "breathing" on the locked-8 / estate individual meshes so the proven
|
| 415 |
+
// core reads as alive (conjecture meshes stay flat grey — never brighten).
|
| 416 |
+
const pulse = 0.32 + 0.18 * (0.5 + 0.5 * Math.sin(t * 1.6));
|
| 417 |
+
_labelMeshes.forEach((m) => {
|
| 418 |
+
if (!m.material || m.userData.isConj) return;
|
| 419 |
+
const n = m.userData.node;
|
| 420 |
+
if (n && (n.locked || n.kind === "estate")) m.material.emissiveIntensity = pulse;
|
| 421 |
+
});
|
| 422 |
}
|
| 423 |
|
| 424 |
+
// -------------------------------------------------------------------------- //
|
| 425 |
+
// overlay (shared showcase helper)
|
| 426 |
+
// -------------------------------------------------------------------------- //
|
| 427 |
function _buildOverlay(ctx) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 428 |
_show = createShowcase(ctx, {
|
| 429 |
+
id: ID, title: TITLE, accent: "#5b8dee",
|
| 430 |
+
chips: [{ label: "MODELED", text: "knowledge graph", name: "src" }],
|
| 431 |
+
legend: ["MEASURED", "MODELED", "SAMPLE"],
|
| 432 |
+
description:
|
| 433 |
+
"<b>The estate's own brain.</b> Every node is a REAL harvested artifact — a repo, " +
|
| 434 |
+
"surface, formula, topic, or a field leader (paper / lab / org / person) — laid out " +
|
| 435 |
+
"feed-forward: harvested field leaders (outer) → repos & surfaces (input) → " +
|
| 436 |
+
"topics → formulas (the <b>locked-8</b> proven core in proof-teal) → the estate " +
|
| 437 |
+
"thesis (output). Pulses fire along real edges; node size grows with connectivity. " +
|
| 438 |
+
"This is the SZL answer to the leaked Obsidian neural-vault — but real, owned, and honest.",
|
| 439 |
+
citations:
|
| 440 |
+
"Graph is LIVE from /api/a11oy/v1/brain/graph (pure read — no signing on GET). " +
|
| 441 |
+
"Inspiration: the viral “self-writing Obsidian neural-vault”, cited as prior art, " +
|
| 442 |
+
"never claimed as ours. Λ = Conjecture 1 (grey, never proven green).",
|
| 443 |
+
plain: { html: _plainHtml },
|
| 444 |
});
|
| 445 |
+
|
| 446 |
+
// HONEST count pills (always visible in the pill row): BOTH the distinct
|
| 447 |
+
// headline AND the raw total, with the ~56% co-author note in the tooltip.
|
| 448 |
+
_pillDistinct = _mkPill("— distinct", "Distinct real artifacts (repos+papers+orgs+datasets+…) — the honest headline.");
|
| 449 |
+
_pillNodes = _mkPill("— nodes", "Raw node total. Includes arXiv co-author person nodes (~56%); NOT all distinct work.");
|
| 450 |
+
_show.pills.appendChild(_pillDistinct);
|
| 451 |
+
_show.pills.appendChild(_pillNodes);
|
| 452 |
+
|
| 453 |
+
// KPI rows (collapsible body)
|
| 454 |
+
_el.distinct = _show.addField("Distinct artifacts");
|
| 455 |
+
_el.nodes = _show.addField("Total nodes");
|
| 456 |
+
_el.persons = _show.addField("Co-author nodes");
|
| 457 |
+
_el.links = _show.addField("Edges");
|
| 458 |
+
_el.locked = _show.addField("Locked-proven");
|
| 459 |
+
_el.rendered = _show.addField("Rendered (subset)");
|
| 460 |
+
_el.field = _show.addField("Field leaders shown");
|
| 461 |
+
|
| 462 |
+
// axis-expand control container (populated once summary/full arrives)
|
| 463 |
+
_axisWrap = document.createElement("div");
|
| 464 |
+
_axisWrap.style.cssText = "display:flex;flex-direction:column;gap:6px;margin-top:2px";
|
| 465 |
+
const cap = document.createElement("div");
|
| 466 |
+
cap.textContent = "Expand an axis (adds its field leaders):";
|
| 467 |
+
cap.style.cssText = "font-size:10.5px;color:#9fb1bf";
|
| 468 |
+
_axisRow = document.createElement("div");
|
| 469 |
+
_axisRow.style.cssText = "display:flex;flex-wrap:wrap;gap:5px";
|
| 470 |
+
_axisWrap.appendChild(cap); _axisWrap.appendChild(_axisRow);
|
| 471 |
+
_show.appendBody(_axisWrap);
|
| 472 |
+
|
| 473 |
+
// honest artifact note (verbatim from the endpoint)
|
| 474 |
+
_noteEl = document.createElement("div");
|
| 475 |
+
_noteEl.style.cssText = "font-size:9.5px;color:#6b7a86;line-height:1.5;margin-top:2px";
|
| 476 |
+
_show.appendBody(_noteEl);
|
| 477 |
+
}
|
| 478 |
+
|
| 479 |
+
let _pillDistinct = null, _pillNodes = null, _axisWrap = null, _axisRow = null, _noteEl = null;
|
| 480 |
+
const _el = {};
|
| 481 |
+
|
| 482 |
+
function _mkPill(text, title) {
|
| 483 |
+
const el = document.createElement("span");
|
| 484 |
+
el.title = title || "";
|
| 485 |
+
el.textContent = text;
|
| 486 |
+
el.style.cssText =
|
| 487 |
+
"font:600 10.5px ui-monospace,SFMono-Regular,Menlo,monospace;padding:3px 9px;border-radius:999px;" +
|
| 488 |
+
"border:1px solid #1c2836;background:#0a1117;color:#cfe3ea;letter-spacing:.2px;white-space:nowrap";
|
| 489 |
+
return el;
|
| 490 |
}
|
| 491 |
+
|
| 492 |
+
function _fmt(n) { return (n == null) ? "—" : Number(n).toLocaleString("en-US"); }
|
| 493 |
+
|
| 494 |
+
function _buildAxisControls() {
|
| 495 |
+
if (!_axisRow || !S.byAxis) return;
|
| 496 |
+
const top = Object.keys(S.byAxis).slice(0, 8);
|
| 497 |
+
// only (re)build if the set of buttons changed
|
| 498 |
+
const have = Object.keys(_axisBtns).sort().join(",");
|
| 499 |
+
const want = top.slice().sort().join(",");
|
| 500 |
+
if (have === want) return;
|
| 501 |
+
_axisRow.textContent = "";
|
| 502 |
+
_axisBtns = {};
|
| 503 |
+
top.forEach((ax) => {
|
| 504 |
+
const b = document.createElement("button");
|
| 505 |
+
b.type = "button";
|
| 506 |
+
b.textContent = ax + " (" + S.byAxis[ax] + ")";
|
| 507 |
+
b.dataset.axis = ax;
|
| 508 |
+
_styleAxisBtn(b, _activeAxes.has(ax));
|
| 509 |
+
b.addEventListener("click", () => {
|
| 510 |
+
if (_activeAxes.has(ax)) _activeAxes.delete(ax); else _activeAxes.add(ax);
|
| 511 |
+
_styleAxisBtn(b, _activeAxes.has(ax));
|
| 512 |
+
if (S.loaded) { _rebuild(); _paintOverlay(); }
|
| 513 |
+
});
|
| 514 |
+
_axisBtns[ax] = b;
|
| 515 |
+
_axisRow.appendChild(b);
|
| 516 |
+
});
|
| 517 |
}
|
| 518 |
+
|
| 519 |
+
function _styleAxisBtn(b, on) {
|
| 520 |
+
b.style.cssText =
|
| 521 |
+
"font:11px ui-monospace,Menlo,monospace;padding:3px 8px;border-radius:7px;cursor:pointer;" +
|
| 522 |
+
(on
|
| 523 |
+
? "border:1px solid #3af4c8;background:#08201a;color:#3af4c8;"
|
| 524 |
+
: "border:1px solid #1c2836;background:#0e1722;color:#9fb6cc;");
|
| 525 |
}
|
|
|
|
| 526 |
|
| 527 |
function _paintOverlay() {
|
| 528 |
+
if (!_show) return;
|
| 529 |
+
const deg = (S.state === "error");
|
| 530 |
+
_show.setChip("src", S.label || "MODELED", { text: "knowledge graph" });
|
| 531 |
+
|
| 532 |
+
if (_pillDistinct) _pillDistinct.textContent = _fmt(S.distinct) + " distinct";
|
| 533 |
+
if (_pillNodes) _pillNodes.textContent = _fmt(S.nodeCount) + " nodes";
|
| 534 |
+
|
| 535 |
+
const set = (k, v) => { if (_el[k]) _el[k].textContent = v; };
|
| 536 |
+
set("distinct", deg ? "—" : _fmt(S.distinct));
|
| 537 |
+
set("nodes", deg ? "—" : _fmt(S.nodeCount));
|
| 538 |
+
set("persons", deg ? "—" : (S.persons != null ? _fmt(S.persons) + " (~56%, not distinct work)" : "—"));
|
| 539 |
+
set("links", deg ? "—" : _fmt(S.linkCount));
|
| 540 |
+
set("locked", deg ? "—" : (S.lockedFlagged != null ? S.lockedFlagged + " (exactly 8)" : "8 (exactly 8)"));
|
| 541 |
+
set("rendered", S.loaded ? _fmt(S.renderedNodes) + " nodes · " + _fmt(S.renderedEdges) + " edges" : "loading…");
|
| 542 |
+
const fieldTotal = S.byLayer && S.byLayer["-1"] != null ? S.byLayer["-1"] : null;
|
| 543 |
+
set("field", S.loaded ? _fmt(S.fieldShown) + (fieldTotal != null ? " of " + _fmt(fieldTotal) : "") : "loading…");
|
| 544 |
+
|
| 545 |
+
if (_noteEl) _noteEl.textContent = S.artifactNote || "";
|
| 546 |
+
if (_show.refreshPlain) _show.refreshPlain();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 547 |
}
|
| 548 |
|
| 549 |
+
function _plainHtml() {
|
| 550 |
+
return (
|
| 551 |
+
"Each ball is one real thing our estate knows about — a code repo, a live surface, one of " +
|
| 552 |
+
"our math formulas, a topic, or a leader out in the field (a paper, lab, company, or author). " +
|
| 553 |
+
"They're arranged like a neural network reading left-to-right: the outside world flows in " +
|
| 554 |
+
"through our inputs, through topics and formulas, to the estate's thesis on the right. The " +
|
| 555 |
+
"bright teal balls are the <b>8 formulas we've actually machine-proven</b>; grey balls (like " +
|
| 556 |
+
"Λ) are things we <b>have not</b> proven and never light up green. Two counts are shown on " +
|
| 557 |
+
"purpose: <b>" + _fmt(S.distinct) + " distinct artifacts</b> is the honest headline, while the raw " +
|
| 558 |
+
"<b>" + _fmt(S.nodeCount) + " nodes</b> includes ~56% arXiv co-author names — real, but not distinct " +
|
| 559 |
+
"work. We render a fast subset (the estate core + the best-connected leaders); tap an axis to " +
|
| 560 |
+
"pull in more. Label <b>" + (S.label || "MODELED") + "</b> — a faithful drawing of our real graph."
|
| 561 |
+
);
|
|
|
|
| 562 |
}
|
| 563 |
|
| 564 |
+
// -------------------------------------------------------------------------- //
|
| 565 |
// unmount
|
| 566 |
+
// -------------------------------------------------------------------------- //
|
| 567 |
function unmount() {
|
| 568 |
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 569 |
try { if (_show) _show.destroy(); } catch (_) {}
|
| 570 |
+
try { _clearScene(); } catch (_) {}
|
| 571 |
+
try { if (_sphereGeo) _sphereGeo.dispose(); } catch (_) {}
|
| 572 |
+
try { if (_group && _stage) _stage.scene.remove(_group); } catch (_) {}
|
| 573 |
+
_sphereGeo = null;
|
| 574 |
+
_group = _show = _badge = null;
|
| 575 |
+
_pillDistinct = _pillNodes = _axisWrap = _axisRow = _noteEl = null;
|
| 576 |
+
_axisBtns = {}; _activeAxes = new Set();
|
| 577 |
+
Object.keys(_el).forEach((k) => delete _el[k]);
|
| 578 |
+
_pos = {}; _frameReg = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 579 |
_stage = _THREE = _ctx = null;
|
| 580 |
+
S.label = null; S.state = "init"; S.loaded = false;
|
| 581 |
+
S.nodeCount = S.linkCount = S.distinct = S.persons = null;
|
| 582 |
+
S.artifactNote = null; S.lockedFlagged = null;
|
| 583 |
+
S.byLayer = S.byKind = S.byAxis = null;
|
| 584 |
+
S.nodes = S.links = S.byId = null;
|
| 585 |
+
S.renderedNodes = S.renderedEdges = S.fieldShown = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 586 |
}
|
| 587 |
|
| 588 |
+
export default { id: ID, title: TITLE, endpoints: [EP_SUMMARY, EP_GRAPH], mount, unmount };
|
static/3d/surfaces/keyless.js
CHANGED
|
@@ -39,6 +39,8 @@
|
|
| 39 |
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 40 |
// Nothing here is in the locked-8. Λ stays Conjecture 1. Trust never 100%.
|
| 41 |
|
|
|
|
|
|
|
| 42 |
const ID = "keyless";
|
| 43 |
const TITLE = "Keyless Attention (Value-Only Cache)";
|
| 44 |
|
|
@@ -60,9 +62,8 @@ const HEAT_GAP = 0.17; // heatmap cell pitch
|
|
| 60 |
const HEAT_MAX = 8; // cap cells per axis rendered (matches head trim)
|
| 61 |
const BAR_W = 0.9; // cache-bar width
|
| 62 |
|
| 63 |
-
let _stage = null, _THREE = null, _ctx = null, _group = null,
|
| 64 |
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
| 65 |
-
let _plain = false;
|
| 66 |
|
| 67 |
// geometry handles
|
| 68 |
let _floor = null;
|
|
@@ -323,115 +324,45 @@ function _onFrame() {
|
|
| 323 |
// =============================================================================
|
| 324 |
function _buildOverlay() {
|
| 325 |
const ctx = _ctx;
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
sub.innerHTML =
|
| 343 |
-
'Keyless Attention <b>eliminates the key projection</b> entirely: a value-space <b>routing matrix R</b> ' +
|
| 344 |
-
'replaces W<sub>k</sub>, so logits are formed as softmax((Q\u00b7R)\u00b7V\u1d40/\u221ad) and the decode ' +
|
| 345 |
-
'cache stores <b>values only</b>. Standard QKV attention caches both K and V (2\u00b7L\u00b7d); keyless caches ' +
|
| 346 |
-
'V alone (L\u00b7d) \u2014 an <b>exactly 50%</b> reduction. Panels: cache-size bars (standard vs keyless), ' +
|
| 347 |
-
'attention-map heatmaps (standard vs keyless), and an output-fidelity bar (mean per-token cosine similarity ' +
|
| 348 |
-
'between the two outputs). Honesty label <b>MODELED</b> (deterministic mechanism reproduction on a toy ' +
|
| 349 |
-
'sequence; trains nothing). 0 runtime CDN.';
|
| 350 |
-
_overlay.appendChild(sub);
|
| 351 |
-
|
| 352 |
-
const brow = document.createElement("div");
|
| 353 |
-
brow.style.cssText = "display:flex;gap:8px;align-items:center;flex-wrap:wrap";
|
| 354 |
-
if (_badge && _badge.el) brow.appendChild(_badge.el);
|
| 355 |
-
_overlay.appendChild(brow);
|
| 356 |
-
|
| 357 |
-
const card = document.createElement("div");
|
| 358 |
-
card.style.cssText = "background:#0a1117;border:1px solid #1d2a36;border-radius:9px;padding:9px 10px;display:flex;flex-direction:column;gap:6px";
|
| 359 |
-
|
| 360 |
-
const chead = document.createElement("div");
|
| 361 |
-
chead.style.cssText = "display:flex;align-items:center;gap:8px;flex-wrap:wrap";
|
| 362 |
-
const dot = document.createElement("span");
|
| 363 |
-
dot.style.cssText = "width:9px;height:9px;border-radius:50%;background:#3af4c8;box-shadow:0 0 7px #3af4c8";
|
| 364 |
-
const nm = document.createElement("b");
|
| 365 |
-
nm.style.cssText = "font-size:12px;color:#3af4c8;letter-spacing:.3px";
|
| 366 |
-
nm.textContent = "keyless attention \u00b7 value-only cache";
|
| 367 |
-
chead.appendChild(dot); chead.appendChild(nm);
|
| 368 |
-
card.appendChild(chead);
|
| 369 |
-
|
| 370 |
-
const grid = document.createElement("div");
|
| 371 |
-
grid.style.cssText = "display:grid;grid-template-columns:1fr;gap:4px";
|
| 372 |
-
|
| 373 |
-
function kpiRow(id, label) {
|
| 374 |
-
const r = document.createElement("div");
|
| 375 |
-
r.style.cssText = "display:flex;justify-content:space-between;gap:10px;font-size:11px";
|
| 376 |
-
const l = document.createElement("span"); l.style.cssText = "color:#9fb1bf"; l.textContent = label;
|
| 377 |
-
const v = document.createElement("b");
|
| 378 |
-
v.id = id;
|
| 379 |
-
v.style.cssText = "font-variant-numeric:tabular-nums;color:#eef3f6;text-align:right;max-width:56%";
|
| 380 |
-
v.textContent = "\u2014";
|
| 381 |
-
_el[id] = v;
|
| 382 |
-
r.appendChild(l); r.appendChild(v); return r;
|
| 383 |
-
}
|
| 384 |
-
|
| 385 |
-
grid.appendChild(kpiRow("kl-dims", "sequence (L \u00d7 d)"));
|
| 386 |
-
grid.appendChild(kpiRow("kl-m", "factorization depth m"));
|
| 387 |
-
grid.appendChild(kpiRow("kl-entstd", "cache entries \u2014 STANDARD (K+V)"));
|
| 388 |
-
grid.appendChild(kpiRow("kl-entkey", "cache entries \u2014 KEYLESS (V-only)"));
|
| 389 |
-
grid.appendChild(kpiRow("kl-bytestd", "cache bytes \u2014 STANDARD"));
|
| 390 |
-
grid.appendChild(kpiRow("kl-bytekey", "cache bytes \u2014 KEYLESS"));
|
| 391 |
-
grid.appendChild(kpiRow("kl-reduction","KV-cache reduction"));
|
| 392 |
-
grid.appendChild(kpiRow("kl-cosmean", "output fidelity \u2014 mean cosine (MEASURED)"));
|
| 393 |
-
grid.appendChild(kpiRow("kl-cosmin", "output fidelity \u2014 min cosine"));
|
| 394 |
-
grid.appendChild(kpiRow("kl-mse", "output MSE (standard vs keyless)"));
|
| 395 |
-
grid.appendChild(kpiRow("kl-label", "honesty label"));
|
| 396 |
-
card.appendChild(grid);
|
| 397 |
-
|
| 398 |
-
const fn = document.createElement("div");
|
| 399 |
-
fn.style.cssText = "font-size:9.5px;color:#6b7a86;line-height:1.5";
|
| 400 |
-
fn.textContent = "Keyless Attention \u2014 Xin Gao, \u201cValue-Space Routing and Value-Only Caching for Efficient Transformers\u201d arXiv:2606.21848 (arxiv.org/abs/2606.21848). MODELED \u00b7 mechanism demo on a toy sequence, not a trained transformer.";
|
| 401 |
-
card.appendChild(fn);
|
| 402 |
-
_overlay.appendChild(card);
|
| 403 |
-
|
| 404 |
-
const pl = document.createElement("button");
|
| 405 |
-
pl.textContent = "\u25d1 what this means";
|
| 406 |
-
pl.title = "Toggle plain-language explanation for investors & consumers.";
|
| 407 |
-
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";
|
| 408 |
-
pl.addEventListener("click", () => {
|
| 409 |
-
_plain = !_plain;
|
| 410 |
-
pl.style.background = _plain ? "#0f2a20" : "#08140f";
|
| 411 |
-
_applyPlain();
|
| 412 |
});
|
| 413 |
-
_overlay.appendChild(pl);
|
| 414 |
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
_el["
|
| 419 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 420 |
|
| 421 |
-
(ctx.container || document.body).appendChild(_overlay);
|
| 422 |
_paintOverlay();
|
| 423 |
}
|
| 424 |
|
| 425 |
-
function
|
| 426 |
-
const pd = _el["plain"];
|
| 427 |
-
if (!pd) return;
|
| 428 |
-
pd.style.display = _plain ? "block" : "none";
|
| 429 |
-
if (!_plain) return;
|
| 430 |
const red = S.reduction != null ? S.reduction.toFixed(1) + "%" : "loading\u2026";
|
| 431 |
const cos = S.cosMean != null ? S.cosMean.toFixed(3) : "loading\u2026";
|
| 432 |
const bs = S.kvBytesStd != null ? S.kvBytesStd + " B" : "loading\u2026";
|
| 433 |
const bk = S.kvBytesKey != null ? S.kvBytesKey + " B" : "loading\u2026";
|
| 434 |
-
|
| 435 |
"<b>What this means:</b> To generate text fast, a model keeps a running memory of every earlier word \u2014 " +
|
| 436 |
"the \u201cKV cache.\u201d Normally it stores two things per word (a <b>key</b> and a <b>value</b>). Keyless " +
|
| 437 |
"Attention throws away the key entirely and reroutes the lookup through the values themselves, so it only " +
|
|
@@ -441,7 +372,7 @@ function _applyPlain() {
|
|
| 441 |
"deterministic reproduction of that cache-halving MECHANISM on a tiny synthetic sequence \u2014 it <b>trains " +
|
| 442 |
"no model</b> and runs no GPU kernel. The paper\u2019s headline that keyless matches or beats standard " +
|
| 443 |
"attention on <b>real</b> models (GPT-2, Pythia, Qwen2, Llama 3.2) is a <b>claim about real training runs</b> " +
|
| 444 |
-
"the estate does not independently verify.";
|
| 445 |
}
|
| 446 |
|
| 447 |
function _tok(s) {
|
|
@@ -469,7 +400,7 @@ function _paintOverlay() {
|
|
| 469 |
_set("kl-mse", t || fx(S.mse, 4));
|
| 470 |
// honesty label verbatim — never upgraded
|
| 471 |
_set("kl-label", t || (S.label || "MODELED"));
|
| 472 |
-
if (
|
| 473 |
}
|
| 474 |
|
| 475 |
// =============================================================================
|
|
@@ -477,7 +408,7 @@ function _paintOverlay() {
|
|
| 477 |
// =============================================================================
|
| 478 |
export function unmount() {
|
| 479 |
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 480 |
-
try { if (
|
| 481 |
try {
|
| 482 |
if (_group && _stage) {
|
| 483 |
_group.traverse((o) => {
|
|
@@ -490,11 +421,11 @@ export function unmount() {
|
|
| 490 |
_stage.scene.remove(_group);
|
| 491 |
}
|
| 492 |
} catch (_) {}
|
| 493 |
-
_group =
|
| 494 |
_floor = null;
|
| 495 |
_heatStd = []; _heatKeyless = []; _heatGroup = null;
|
| 496 |
_barStd = null; _barKeyless = null; _barFid = null; _barGroup = null;
|
| 497 |
-
_el = {}; _badge = null;
|
| 498 |
_stage = _THREE = _ctx = null;
|
| 499 |
S.label = S.L = S.d = S.m = null;
|
| 500 |
S.bytesPer = S.kvEntStd = S.kvEntKey = S.kvBytesStd = S.kvBytesKey = null;
|
|
|
|
| 39 |
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 40 |
// Nothing here is in the locked-8. Λ stays Conjecture 1. Trust never 100%.
|
| 41 |
|
| 42 |
+
import { createShowcase } from "./_showcase.js";
|
| 43 |
+
|
| 44 |
const ID = "keyless";
|
| 45 |
const TITLE = "Keyless Attention (Value-Only Cache)";
|
| 46 |
|
|
|
|
| 62 |
const HEAT_MAX = 8; // cap cells per axis rendered (matches head trim)
|
| 63 |
const BAR_W = 0.9; // cache-bar width
|
| 64 |
|
| 65 |
+
let _stage = null, _THREE = null, _ctx = null, _group = null, _show = null;
|
| 66 |
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
|
|
|
| 67 |
|
| 68 |
// geometry handles
|
| 69 |
let _floor = null;
|
|
|
|
| 324 |
// =============================================================================
|
| 325 |
function _buildOverlay() {
|
| 326 |
const ctx = _ctx;
|
| 327 |
+
_show = createShowcase(ctx, {
|
| 328 |
+
id: ID, title: TITLE, accent: "#5b8dee",
|
| 329 |
+
badge: _badge,
|
| 330 |
+
chips: [{ label: "MODELED", text: "value-only cache", name: "kl" }],
|
| 331 |
+
legend: ["MODELED", "SAMPLE"],
|
| 332 |
+
description:
|
| 333 |
+
'Keyless Attention <b>eliminates the key projection</b> entirely: a value-space <b>routing matrix R</b> ' +
|
| 334 |
+
'replaces W<sub>k</sub>, so logits are formed as softmax((Q\u00b7R)\u00b7V\u1d40/\u221ad) and the decode ' +
|
| 335 |
+
'cache stores <b>values only</b>. Standard QKV attention caches both K and V (2\u00b7L\u00b7d); keyless caches ' +
|
| 336 |
+
'V alone (L\u00b7d) \u2014 an <b>exactly 50%</b> reduction. Panels: cache-size bars (standard vs keyless), ' +
|
| 337 |
+
'attention-map heatmaps (standard vs keyless), and an output-fidelity bar (mean per-token cosine similarity ' +
|
| 338 |
+
'between the two outputs). Honesty label <b>MODELED</b> (deterministic mechanism reproduction on a toy ' +
|
| 339 |
+
'sequence; trains nothing). 0 runtime CDN.',
|
| 340 |
+
citations:
|
| 341 |
+
"Keyless Attention \u2014 Xin Gao, \u201cValue-Space Routing and Value-Only Caching for Efficient Transformers\u201d arXiv:2606.21848 (arxiv.org/abs/2606.21848). MODELED \u00b7 mechanism demo on a toy sequence, not a trained transformer.",
|
| 342 |
+
plain: { html: _plainHtml },
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 343 |
});
|
|
|
|
| 344 |
|
| 345 |
+
_el["kl-dims"] = _show.addField("sequence (L \u00d7 d)");
|
| 346 |
+
_el["kl-m"] = _show.addField("factorization depth m");
|
| 347 |
+
_el["kl-entstd"] = _show.addField("cache entries \u2014 STANDARD (K+V)");
|
| 348 |
+
_el["kl-entkey"] = _show.addField("cache entries \u2014 KEYLESS (V-only)");
|
| 349 |
+
_el["kl-bytestd"] = _show.addField("cache bytes \u2014 STANDARD");
|
| 350 |
+
_el["kl-bytekey"] = _show.addField("cache bytes \u2014 KEYLESS");
|
| 351 |
+
_el["kl-reduction"] = _show.addField("KV-cache reduction");
|
| 352 |
+
_el["kl-cosmean"] = _show.addField("output fidelity \u2014 mean cosine (MEASURED)");
|
| 353 |
+
_el["kl-cosmin"] = _show.addField("output fidelity \u2014 min cosine");
|
| 354 |
+
_el["kl-mse"] = _show.addField("output MSE (standard vs keyless)");
|
| 355 |
+
_el["kl-label"] = _show.addField("honesty label");
|
| 356 |
|
|
|
|
| 357 |
_paintOverlay();
|
| 358 |
}
|
| 359 |
|
| 360 |
+
function _plainHtml() {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 361 |
const red = S.reduction != null ? S.reduction.toFixed(1) + "%" : "loading\u2026";
|
| 362 |
const cos = S.cosMean != null ? S.cosMean.toFixed(3) : "loading\u2026";
|
| 363 |
const bs = S.kvBytesStd != null ? S.kvBytesStd + " B" : "loading\u2026";
|
| 364 |
const bk = S.kvBytesKey != null ? S.kvBytesKey + " B" : "loading\u2026";
|
| 365 |
+
return (
|
| 366 |
"<b>What this means:</b> To generate text fast, a model keeps a running memory of every earlier word \u2014 " +
|
| 367 |
"the \u201cKV cache.\u201d Normally it stores two things per word (a <b>key</b> and a <b>value</b>). Keyless " +
|
| 368 |
"Attention throws away the key entirely and reroutes the lookup through the values themselves, so it only " +
|
|
|
|
| 372 |
"deterministic reproduction of that cache-halving MECHANISM on a tiny synthetic sequence \u2014 it <b>trains " +
|
| 373 |
"no model</b> and runs no GPU kernel. The paper\u2019s headline that keyless matches or beats standard " +
|
| 374 |
"attention on <b>real</b> models (GPT-2, Pythia, Qwen2, Llama 3.2) is a <b>claim about real training runs</b> " +
|
| 375 |
+
"the estate does not independently verify.");
|
| 376 |
}
|
| 377 |
|
| 378 |
function _tok(s) {
|
|
|
|
| 400 |
_set("kl-mse", t || fx(S.mse, 4));
|
| 401 |
// honesty label verbatim — never upgraded
|
| 402 |
_set("kl-label", t || (S.label || "MODELED"));
|
| 403 |
+
if (_show) { _show.setChip("kl", S.label || "MODELED", { text: "value-only cache" }); _show.refreshPlain(); }
|
| 404 |
}
|
| 405 |
|
| 406 |
// =============================================================================
|
|
|
|
| 408 |
// =============================================================================
|
| 409 |
export function unmount() {
|
| 410 |
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 411 |
+
try { if (_show) _show.destroy(); } catch (_) {}
|
| 412 |
try {
|
| 413 |
if (_group && _stage) {
|
| 414 |
_group.traverse((o) => {
|
|
|
|
| 421 |
_stage.scene.remove(_group);
|
| 422 |
}
|
| 423 |
} catch (_) {}
|
| 424 |
+
_group = _show = null;
|
| 425 |
_floor = null;
|
| 426 |
_heatStd = []; _heatKeyless = []; _heatGroup = null;
|
| 427 |
_barStd = null; _barKeyless = null; _barFid = null; _barGroup = null;
|
| 428 |
+
_el = {}; _badge = null; _frameReg = false;
|
| 429 |
_stage = _THREE = _ctx = null;
|
| 430 |
S.label = S.L = S.d = S.m = null;
|
| 431 |
S.bytesPer = S.kvEntStd = S.kvEntKey = S.kvBytesStd = S.kvBytesKey = null;
|
static/3d/surfaces/kla.js
CHANGED
|
@@ -37,6 +37,8 @@
|
|
| 37 |
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 38 |
// Nothing here is in the locked-8. Λ stays Conjecture 1. Trust never 100%.
|
| 39 |
|
|
|
|
|
|
|
| 40 |
const ID = "kla";
|
| 41 |
const TITLE = "Kaczmarz Linear Attention · Projection State-Update (live)";
|
| 42 |
|
|
@@ -61,9 +63,8 @@ const KLA_Z = -1.4; // Z lane for the KLA track
|
|
| 61 |
const GATED_Z = 1.4; // Z lane for the gated baseline track
|
| 62 |
const MAX_H = 6.0; // max bar height (world units) at max error
|
| 63 |
|
| 64 |
-
let _stage = null, _THREE = null, _ctx = null, _group = null,
|
| 65 |
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
| 66 |
-
let _plain = false;
|
| 67 |
|
| 68 |
// geometry handles
|
| 69 |
let _floor = null;
|
|
@@ -307,111 +308,41 @@ function _onFrame() {
|
|
| 307 |
// =============================================================================
|
| 308 |
function _buildOverlay() {
|
| 309 |
const ctx = _ctx;
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
color: "#eef3f6",
|
| 317 |
-
});
|
| 318 |
-
|
| 319 |
-
const h = document.createElement("div");
|
| 320 |
-
h.style.cssText = "font:600 13px ui-sans-serif,system-ui;letter-spacing:.4px";
|
| 321 |
-
h.textContent = TITLE;
|
| 322 |
-
_overlay.appendChild(h);
|
| 323 |
-
|
| 324 |
-
const sub = document.createElement("div");
|
| 325 |
-
sub.style.cssText = "color:#9fb1bf;font-size:11px;line-height:1.55";
|
| 326 |
-
sub.innerHTML =
|
| 327 |
'A linear-attention layer stores memory as a matrix <b>S</b>. Each new key-value pair ' +
|
| 328 |
'(<b>k</b>,<b>v</b>) defines a constraint <b>S·k = v</b>; <b>KLA</b> updates the state by ' +
|
| 329 |
'the orthogonal <b>Kaczmarz projection</b> onto that constraint ' +
|
| 330 |
'(step = lr·(v \\u2212 S·k) k<sup>T</sup>/(k·k)) \\u2014 a <i>principled</i> scalar replacing ' +
|
| 331 |
'the <b>ad-hoc gate</b> of gated linear attention. Teal track = KLA, grey track = gated ' +
|
| 332 |
'baseline; bar height = reconstruction error. ' +
|
| 333 |
-
'Honesty label <b>MODELED</b> (deterministic projection simulation; NOT a trained model). 0 runtime CDN.'
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
brow.style.cssText = "display:flex;gap:8px;align-items:center;flex-wrap:wrap";
|
| 338 |
-
if (_badge && _badge.el) brow.appendChild(_badge.el);
|
| 339 |
-
_overlay.appendChild(brow);
|
| 340 |
-
|
| 341 |
-
const card = document.createElement("div");
|
| 342 |
-
card.style.cssText = "background:#0a1117;border:1px solid #1d2a36;border-radius:9px;padding:9px 10px;display:flex;flex-direction:column;gap:6px";
|
| 343 |
-
|
| 344 |
-
const chead = document.createElement("div");
|
| 345 |
-
chead.style.cssText = "display:flex;align-items:center;gap:8px;flex-wrap:wrap";
|
| 346 |
-
const dot = document.createElement("span");
|
| 347 |
-
dot.style.cssText = "width:9px;height:9px;border-radius:50%;background:#3af4c8;box-shadow:0 0 7px #3af4c8";
|
| 348 |
-
const nm = document.createElement("b");
|
| 349 |
-
nm.style.cssText = "font-size:12px;color:#3af4c8;letter-spacing:.3px";
|
| 350 |
-
nm.textContent = "kaczmarz linear attention";
|
| 351 |
-
chead.appendChild(dot); chead.appendChild(nm);
|
| 352 |
-
card.appendChild(chead);
|
| 353 |
-
|
| 354 |
-
const grid = document.createElement("div");
|
| 355 |
-
grid.style.cssText = "display:grid;grid-template-columns:1fr;gap:4px";
|
| 356 |
-
|
| 357 |
-
function kpiRow(id, label) {
|
| 358 |
-
const r = document.createElement("div");
|
| 359 |
-
r.style.cssText = "display:flex;justify-content:space-between;gap:10px;font-size:11px";
|
| 360 |
-
const l = document.createElement("span"); l.style.cssText = "color:#9fb1bf"; l.textContent = label;
|
| 361 |
-
const v = document.createElement("b");
|
| 362 |
-
v.id = id;
|
| 363 |
-
v.style.cssText = "font-variant-numeric:tabular-nums;color:#eef3f6;text-align:right;max-width:58%";
|
| 364 |
-
v.textContent = "\u2014";
|
| 365 |
-
_el[id] = v;
|
| 366 |
-
r.appendChild(l); r.appendChild(v); return r;
|
| 367 |
-
}
|
| 368 |
-
|
| 369 |
-
grid.appendChild(kpiRow("kla-dim", "state dim (S is dim\\u00d7dim)"));
|
| 370 |
-
grid.appendChild(kpiRow("kla-steps", "key-value pairs streamed"));
|
| 371 |
-
grid.appendChild(kpiRow("kla-klaerr", "KLA recon error \\u2014 MODELED"));
|
| 372 |
-
grid.appendChild(kpiRow("kla-gatederr", "gated recon error (baseline)"));
|
| 373 |
-
grid.appendChild(kpiRow("kla-improve", "improvement_ratio (gated\\u00f7kla)"));
|
| 374 |
-
grid.appendChild(kpiRow("kla-klaconv", "KLA convergence step"));
|
| 375 |
-
grid.appendChild(kpiRow("kla-gatedconv", "gated convergence step"));
|
| 376 |
-
grid.appendChild(kpiRow("kla-label", "honesty label"));
|
| 377 |
-
card.appendChild(grid);
|
| 378 |
-
|
| 379 |
-
const fn = document.createElement("div");
|
| 380 |
-
fn.style.cssText = "font-size:9.5px;color:#6b7a86;line-height:1.5";
|
| 381 |
-
fn.textContent = "Kaczmarz Linear Attention arXiv:2605.08587 (orthogonal projection state-update vs ad-hoc gate). MODELED \u00b7 not claimed-as.";
|
| 382 |
-
card.appendChild(fn);
|
| 383 |
-
_overlay.appendChild(card);
|
| 384 |
-
|
| 385 |
-
const pl = document.createElement("button");
|
| 386 |
-
pl.textContent = "\u25d1 what this means";
|
| 387 |
-
pl.title = "Toggle plain-language explanation for investors & consumers.";
|
| 388 |
-
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";
|
| 389 |
-
pl.addEventListener("click", () => {
|
| 390 |
-
_plain = !_plain;
|
| 391 |
-
pl.style.background = _plain ? "#0f2a20" : "#08140f";
|
| 392 |
-
_applyPlain();
|
| 393 |
});
|
| 394 |
-
_overlay.appendChild(pl);
|
| 395 |
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
_el["
|
| 400 |
-
|
|
|
|
|
|
|
|
|
|
| 401 |
|
| 402 |
-
(ctx.container || document.body).appendChild(_overlay);
|
| 403 |
_paintOverlay();
|
| 404 |
}
|
| 405 |
|
| 406 |
-
function
|
| 407 |
-
const pd = _el["plain"];
|
| 408 |
-
if (!pd) return;
|
| 409 |
-
pd.style.display = _plain ? "block" : "none";
|
| 410 |
-
if (!_plain) return;
|
| 411 |
const imp = S.improve != null ? S.improve.toFixed(2) + "\u00d7" : "loading\u2026";
|
| 412 |
const ke = S.klaErr != null ? S.klaErr.toFixed(3) : "loading\u2026";
|
| 413 |
const ge = S.gatedErr != null ? S.gatedErr.toFixed(3) : "loading\u2026";
|
| 414 |
-
|
| 415 |
"<b>What this means:</b> A fast \\u201clinear attention\\u201d model remembers things in a running " +
|
| 416 |
"memory <b>M</b> instead of re-reading the whole past every time. When a new fact arrives, older " +
|
| 417 |
"systems just <i>fade</i> the memory by a hand-tuned amount (an \\u201cad-hoc gate\\u201d) and hope " +
|
|
@@ -421,7 +352,7 @@ function _applyPlain() {
|
|
| 421 |
"Here KLA rebuilds the stream of facts with error <b>" + ke + "</b> versus the old gate\\u2019s <b>" + ge + "</b>, " +
|
| 422 |
"about a <b>" + imp + "</b> improvement, and it locks in sooner. Plain: a principled dial replaces a " +
|
| 423 |
"guessed one, so the model remembers more accurately. This view is a <b>MODELED</b> simulation of " +
|
| 424 |
-
"the projection math (arXiv:2605.08587), not a run of a trained model.";
|
| 425 |
}
|
| 426 |
|
| 427 |
function _tok(s) {
|
|
@@ -446,7 +377,7 @@ function _paintOverlay() {
|
|
| 446 |
_set("kla-gatedconv", t || (S.gatedConv != null ? String(S.gatedConv) : "\u2014"));
|
| 447 |
// honesty label verbatim — never upgraded
|
| 448 |
_set("kla-label", t || (S.label || "MODELED"));
|
| 449 |
-
if (
|
| 450 |
}
|
| 451 |
|
| 452 |
// =============================================================================
|
|
@@ -454,7 +385,7 @@ function _paintOverlay() {
|
|
| 454 |
// =============================================================================
|
| 455 |
export function unmount() {
|
| 456 |
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 457 |
-
try { if (
|
| 458 |
try {
|
| 459 |
if (_group && _stage) {
|
| 460 |
_group.traverse((o) => {
|
|
@@ -467,10 +398,10 @@ export function unmount() {
|
|
| 467 |
_stage.scene.remove(_group);
|
| 468 |
}
|
| 469 |
} catch (_) {}
|
| 470 |
-
_group =
|
| 471 |
_floor = null; _spine = null; _plane = null;
|
| 472 |
_klaBars = []; _gatedBars = []; _marker = null;
|
| 473 |
-
_el = {}; _badge = null;
|
| 474 |
_stage = _THREE = _ctx = null;
|
| 475 |
S.label = S.dim = S.steps = S.lr = S.tol = null;
|
| 476 |
S.klaErr = S.gatedErr = S.klaConv = S.gatedConv = S.improve = null;
|
|
|
|
| 37 |
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 38 |
// Nothing here is in the locked-8. Λ stays Conjecture 1. Trust never 100%.
|
| 39 |
|
| 40 |
+
import { createShowcase } from "./_showcase.js";
|
| 41 |
+
|
| 42 |
const ID = "kla";
|
| 43 |
const TITLE = "Kaczmarz Linear Attention · Projection State-Update (live)";
|
| 44 |
|
|
|
|
| 63 |
const GATED_Z = 1.4; // Z lane for the gated baseline track
|
| 64 |
const MAX_H = 6.0; // max bar height (world units) at max error
|
| 65 |
|
| 66 |
+
let _stage = null, _THREE = null, _ctx = null, _group = null, _show = null;
|
| 67 |
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
|
|
|
| 68 |
|
| 69 |
// geometry handles
|
| 70 |
let _floor = null;
|
|
|
|
| 308 |
// =============================================================================
|
| 309 |
function _buildOverlay() {
|
| 310 |
const ctx = _ctx;
|
| 311 |
+
_show = createShowcase(ctx, {
|
| 312 |
+
id: ID, title: TITLE, accent: "#5b8dee",
|
| 313 |
+
badge: _badge,
|
| 314 |
+
chips: [{ label: "MODELED", text: "projection update", name: "kla" }],
|
| 315 |
+
legend: ["MODELED", "SAMPLE"],
|
| 316 |
+
description:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 317 |
'A linear-attention layer stores memory as a matrix <b>S</b>. Each new key-value pair ' +
|
| 318 |
'(<b>k</b>,<b>v</b>) defines a constraint <b>S·k = v</b>; <b>KLA</b> updates the state by ' +
|
| 319 |
'the orthogonal <b>Kaczmarz projection</b> onto that constraint ' +
|
| 320 |
'(step = lr·(v \\u2212 S·k) k<sup>T</sup>/(k·k)) \\u2014 a <i>principled</i> scalar replacing ' +
|
| 321 |
'the <b>ad-hoc gate</b> of gated linear attention. Teal track = KLA, grey track = gated ' +
|
| 322 |
'baseline; bar height = reconstruction error. ' +
|
| 323 |
+
'Honesty label <b>MODELED</b> (deterministic projection simulation; NOT a trained model). 0 runtime CDN.',
|
| 324 |
+
citations:
|
| 325 |
+
"Kaczmarz Linear Attention arXiv:2605.08587 (orthogonal projection state-update vs ad-hoc gate). MODELED \u00b7 not claimed-as.",
|
| 326 |
+
plain: { html: _plainHtml },
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 327 |
});
|
|
|
|
| 328 |
|
| 329 |
+
_el["kla-dim"] = _show.addField("state dim (S is dim\\u00d7dim)");
|
| 330 |
+
_el["kla-steps"] = _show.addField("key-value pairs streamed");
|
| 331 |
+
_el["kla-klaerr"] = _show.addField("KLA recon error \\u2014 MODELED");
|
| 332 |
+
_el["kla-gatederr"] = _show.addField("gated recon error (baseline)");
|
| 333 |
+
_el["kla-improve"] = _show.addField("improvement_ratio (gated\\u00f7kla)");
|
| 334 |
+
_el["kla-klaconv"] = _show.addField("KLA convergence step");
|
| 335 |
+
_el["kla-gatedconv"] = _show.addField("gated convergence step");
|
| 336 |
+
_el["kla-label"] = _show.addField("honesty label");
|
| 337 |
|
|
|
|
| 338 |
_paintOverlay();
|
| 339 |
}
|
| 340 |
|
| 341 |
+
function _plainHtml() {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 342 |
const imp = S.improve != null ? S.improve.toFixed(2) + "\u00d7" : "loading\u2026";
|
| 343 |
const ke = S.klaErr != null ? S.klaErr.toFixed(3) : "loading\u2026";
|
| 344 |
const ge = S.gatedErr != null ? S.gatedErr.toFixed(3) : "loading\u2026";
|
| 345 |
+
return (
|
| 346 |
"<b>What this means:</b> A fast \\u201clinear attention\\u201d model remembers things in a running " +
|
| 347 |
"memory <b>M</b> instead of re-reading the whole past every time. When a new fact arrives, older " +
|
| 348 |
"systems just <i>fade</i> the memory by a hand-tuned amount (an \\u201cad-hoc gate\\u201d) and hope " +
|
|
|
|
| 352 |
"Here KLA rebuilds the stream of facts with error <b>" + ke + "</b> versus the old gate\\u2019s <b>" + ge + "</b>, " +
|
| 353 |
"about a <b>" + imp + "</b> improvement, and it locks in sooner. Plain: a principled dial replaces a " +
|
| 354 |
"guessed one, so the model remembers more accurately. This view is a <b>MODELED</b> simulation of " +
|
| 355 |
+
"the projection math (arXiv:2605.08587), not a run of a trained model.");
|
| 356 |
}
|
| 357 |
|
| 358 |
function _tok(s) {
|
|
|
|
| 377 |
_set("kla-gatedconv", t || (S.gatedConv != null ? String(S.gatedConv) : "\u2014"));
|
| 378 |
// honesty label verbatim — never upgraded
|
| 379 |
_set("kla-label", t || (S.label || "MODELED"));
|
| 380 |
+
if (_show) { _show.setChip("kla", S.label || "MODELED", { text: "projection update" }); _show.refreshPlain(); }
|
| 381 |
}
|
| 382 |
|
| 383 |
// =============================================================================
|
|
|
|
| 385 |
// =============================================================================
|
| 386 |
export function unmount() {
|
| 387 |
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 388 |
+
try { if (_show) _show.destroy(); } catch (_) {}
|
| 389 |
try {
|
| 390 |
if (_group && _stage) {
|
| 391 |
_group.traverse((o) => {
|
|
|
|
| 398 |
_stage.scene.remove(_group);
|
| 399 |
}
|
| 400 |
} catch (_) {}
|
| 401 |
+
_group = _show = null;
|
| 402 |
_floor = null; _spine = null; _plane = null;
|
| 403 |
_klaBars = []; _gatedBars = []; _marker = null;
|
| 404 |
+
_el = {}; _badge = null; _frameReg = false;
|
| 405 |
_stage = _THREE = _ctx = null;
|
| 406 |
S.label = S.dim = S.steps = S.lr = S.tol = null;
|
| 407 |
S.klaErr = S.gatedErr = S.klaConv = S.gatedConv = S.improve = null;
|
static/3d/surfaces/kvcache.js
CHANGED
|
@@ -39,6 +39,8 @@
|
|
| 39 |
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 40 |
// Nothing here is in the locked-8. Λ stays Conjecture 1. Trust never 100%.
|
| 41 |
|
|
|
|
|
|
|
| 42 |
const ID = "kvcache";
|
| 43 |
const TITLE = "KV-Cache H2O Eviction · Heavy-Hitter Oracle (live)";
|
| 44 |
|
|
@@ -60,9 +62,8 @@ const MAX_TOKENS = 160; // cap on tokens rendered in the row (perf)
|
|
| 60 |
const ROW_Y = 0.4; // resting height of a kept token
|
| 61 |
const EVICT_Y = -1.6; // dropped height of an evicted token
|
| 62 |
|
| 63 |
-
let _stage = null, _THREE = null, _ctx = null, _group = null,
|
| 64 |
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
| 65 |
-
let _plain = false;
|
| 66 |
|
| 67 |
// geometry handles
|
| 68 |
let _floor = null;
|
|
@@ -256,112 +257,42 @@ function _onFrame() {
|
|
| 256 |
// =============================================================================
|
| 257 |
function _buildOverlay() {
|
| 258 |
const ctx = _ctx;
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
sub.style.cssText = "color:#9fb1bf;font-size:11px;line-height:1.55";
|
| 275 |
-
sub.innerHTML =
|
| 276 |
-
'A decoding stream accumulates a KV cache entry per token. <b>H2O</b> (Heavy-Hitter Oracle) ' +
|
| 277 |
-
'keeps a bounded cache by retaining the top cumulative-attention-mass \u201cheavy hitters\u201d ' +
|
| 278 |
-
'plus a sliding recent <b>window</b>, instead of evicting purely by recency. HUD compares ' +
|
| 279 |
-
'H2O against a sliding-window-only baseline and the full-cache (no eviction) oracle. ' +
|
| 280 |
-
'Honesty label <b>MODELED</b> (deterministic simulation on a synthetic attention trace; NOT a ' +
|
| 281 |
-
'real KV cache or trained model). 0 runtime CDN.';
|
| 282 |
-
_overlay.appendChild(sub);
|
| 283 |
-
|
| 284 |
-
const brow = document.createElement("div");
|
| 285 |
-
brow.style.cssText = "display:flex;gap:8px;align-items:center;flex-wrap:wrap";
|
| 286 |
-
if (_badge && _badge.el) brow.appendChild(_badge.el);
|
| 287 |
-
_overlay.appendChild(brow);
|
| 288 |
-
|
| 289 |
-
const card = document.createElement("div");
|
| 290 |
-
card.style.cssText = "background:#0a1117;border:1px solid #1d2a36;border-radius:9px;padding:9px 10px;display:flex;flex-direction:column;gap:6px";
|
| 291 |
-
|
| 292 |
-
const chead = document.createElement("div");
|
| 293 |
-
chead.style.cssText = "display:flex;align-items:center;gap:8px;flex-wrap:wrap";
|
| 294 |
-
const dot = document.createElement("span");
|
| 295 |
-
dot.style.cssText = "width:9px;height:9px;border-radius:50%;background:#3af4c8;box-shadow:0 0 7px #3af4c8";
|
| 296 |
-
const nm = document.createElement("b");
|
| 297 |
-
nm.style.cssText = "font-size:12px;color:#3af4c8;letter-spacing:.3px";
|
| 298 |
-
nm.textContent = "kv-cache h2o eviction";
|
| 299 |
-
chead.appendChild(dot); chead.appendChild(nm);
|
| 300 |
-
card.appendChild(chead);
|
| 301 |
-
|
| 302 |
-
const grid = document.createElement("div");
|
| 303 |
-
grid.style.cssText = "display:grid;grid-template-columns:1fr;gap:4px";
|
| 304 |
-
|
| 305 |
-
function kpiRow(id, label) {
|
| 306 |
-
const r = document.createElement("div");
|
| 307 |
-
r.style.cssText = "display:flex;justify-content:space-between;gap:10px;font-size:11px";
|
| 308 |
-
const l = document.createElement("span"); l.style.cssText = "color:#9fb1bf"; l.textContent = label;
|
| 309 |
-
const v = document.createElement("b");
|
| 310 |
-
v.id = id;
|
| 311 |
-
v.style.cssText = "font-variant-numeric:tabular-nums;color:#eef3f6;text-align:right;max-width:58%";
|
| 312 |
-
v.textContent = "\u2014";
|
| 313 |
-
_el[id] = v;
|
| 314 |
-
r.appendChild(l); r.appendChild(v); return r;
|
| 315 |
-
}
|
| 316 |
-
|
| 317 |
-
grid.appendChild(kpiRow("kv-seqlen", "seq_len (decoded tokens)"));
|
| 318 |
-
grid.appendChild(kpiRow("kv-capacity", "capacity (KV-cache slots)"));
|
| 319 |
-
grid.appendChild(kpiRow("kv-window", "window (recent tokens reserved)"));
|
| 320 |
-
grid.appendChild(kpiRow("kv-memratio", "memory_ratio (capacity/seq_len)"));
|
| 321 |
-
grid.appendChild(kpiRow("kv-h2o", "H2O mass_retained \u2014 MODELED"));
|
| 322 |
-
grid.appendChild(kpiRow("kv-sliding", "sliding-window mass_retained"));
|
| 323 |
-
grid.appendChild(kpiRow("kv-full", "full-cache mass_retained (oracle)"));
|
| 324 |
-
grid.appendChild(kpiRow("kv-gain", "H2O vs sliding gain"));
|
| 325 |
-
grid.appendChild(kpiRow("kv-evicted", "evicted_count"));
|
| 326 |
-
grid.appendChild(kpiRow("kv-label", "honesty label"));
|
| 327 |
-
card.appendChild(grid);
|
| 328 |
-
|
| 329 |
-
const fn = document.createElement("div");
|
| 330 |
-
fn.style.cssText = "font-size:9.5px;color:#6b7a86;line-height:1.5";
|
| 331 |
-
fn.textContent = "H2O \u2014 Zhang et al. arXiv:2306.14048 \u00b7 StreamingLLM \u2014 Xiao et al. arXiv:2309.17453. MODELED \u00b7 not claimed-as.";
|
| 332 |
-
card.appendChild(fn);
|
| 333 |
-
_overlay.appendChild(card);
|
| 334 |
-
|
| 335 |
-
const pl = document.createElement("button");
|
| 336 |
-
pl.textContent = "\u25d1 what this means";
|
| 337 |
-
pl.title = "Toggle plain-language explanation for investors & consumers.";
|
| 338 |
-
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";
|
| 339 |
-
pl.addEventListener("click", () => {
|
| 340 |
-
_plain = !_plain;
|
| 341 |
-
pl.style.background = _plain ? "#0f2a20" : "#08140f";
|
| 342 |
-
_applyPlain();
|
| 343 |
});
|
| 344 |
-
_overlay.appendChild(pl);
|
| 345 |
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
_el["
|
| 350 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 351 |
|
| 352 |
-
(ctx.container || document.body).appendChild(_overlay);
|
| 353 |
_paintOverlay();
|
| 354 |
}
|
| 355 |
|
| 356 |
-
function
|
| 357 |
-
const pd = _el["plain"];
|
| 358 |
-
if (!pd) return;
|
| 359 |
-
pd.style.display = _plain ? "block" : "none";
|
| 360 |
-
if (!_plain) return;
|
| 361 |
const mem = S.memoryRatio != null ? (S.memoryRatio * 100).toFixed(1) + "%" : "loading\u2026";
|
| 362 |
const h2oPct = S.h2oMassRetained != null ? (S.h2oMassRetained * 100).toFixed(1) + "%" : "loading\u2026";
|
| 363 |
const slidPct = S.slidingMassRetained != null ? (S.slidingMassRetained * 100).toFixed(1) + "%" : "loading\u2026";
|
| 364 |
-
|
| 365 |
"<b>What this means:</b> A language model keeps a running \u201cnotebook\u201d (the KV cache) of " +
|
| 366 |
"every word it has generated so it can pay attention back to earlier words. That notebook grows " +
|
| 367 |
"forever unless something is thrown away. Here the notebook is capped at just <b>" + mem + "</b> " +
|
|
@@ -370,7 +301,7 @@ function _applyPlain() {
|
|
| 370 |
"out to matter most so far (the \u201cheavy hitters\u201d), plus the most recent few \u2014 and keeps " +
|
| 371 |
"<b>" + h2oPct + "</b> of the important information at the SAME notebook size. This view is a " +
|
| 372 |
"<b>MODELED</b> deterministic simulation of that keep/discard rule on a synthetic attention trace, " +
|
| 373 |
-
"not a run of a real trained model or KV cache.";
|
| 374 |
}
|
| 375 |
|
| 376 |
function _tok(s) {
|
|
@@ -398,7 +329,7 @@ function _paintOverlay() {
|
|
| 398 |
_set("kv-evicted", t || (S.evictedCount != null ? String(S.evictedCount) : "\u2014"));
|
| 399 |
// honesty label verbatim — never upgraded
|
| 400 |
_set("kv-label", t || (S.label || "MODELED"));
|
| 401 |
-
if (
|
| 402 |
}
|
| 403 |
|
| 404 |
// =============================================================================
|
|
@@ -406,7 +337,7 @@ function _paintOverlay() {
|
|
| 406 |
// =============================================================================
|
| 407 |
export function unmount() {
|
| 408 |
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 409 |
-
try { if (
|
| 410 |
try {
|
| 411 |
if (_group && _stage) {
|
| 412 |
_group.traverse((o) => {
|
|
@@ -419,9 +350,9 @@ export function unmount() {
|
|
| 419 |
_stage.scene.remove(_group);
|
| 420 |
}
|
| 421 |
} catch (_) {}
|
| 422 |
-
_group =
|
| 423 |
_floor = null; _spine = null; _tokenMesh = []; _marker = null;
|
| 424 |
-
_el = {}; _badge = null;
|
| 425 |
_stage = _THREE = _ctx = null;
|
| 426 |
S.label = S.seqLen = S.capacity = S.window = S.memoryRatio = null;
|
| 427 |
S.h2oMassRetained = S.slidingMassRetained = S.fullMassRetained = null;
|
|
|
|
| 39 |
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 40 |
// Nothing here is in the locked-8. Λ stays Conjecture 1. Trust never 100%.
|
| 41 |
|
| 42 |
+
import { createShowcase } from "./_showcase.js";
|
| 43 |
+
|
| 44 |
const ID = "kvcache";
|
| 45 |
const TITLE = "KV-Cache H2O Eviction · Heavy-Hitter Oracle (live)";
|
| 46 |
|
|
|
|
| 62 |
const ROW_Y = 0.4; // resting height of a kept token
|
| 63 |
const EVICT_Y = -1.6; // dropped height of an evicted token
|
| 64 |
|
| 65 |
+
let _stage = null, _THREE = null, _ctx = null, _group = null, _show = null;
|
| 66 |
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
|
|
|
| 67 |
|
| 68 |
// geometry handles
|
| 69 |
let _floor = null;
|
|
|
|
| 257 |
// =============================================================================
|
| 258 |
function _buildOverlay() {
|
| 259 |
const ctx = _ctx;
|
| 260 |
+
_show = createShowcase(ctx, {
|
| 261 |
+
id: ID, title: TITLE, accent: "#3af4c8",
|
| 262 |
+
badge: _badge,
|
| 263 |
+
chips: [{ label: "MODELED", text: "h2o eviction", name: "kv" }],
|
| 264 |
+
legend: ["MODELED", "SAMPLE"],
|
| 265 |
+
description:
|
| 266 |
+
'A decoding stream accumulates a KV cache entry per token. <b>H2O</b> (Heavy-Hitter Oracle) ' +
|
| 267 |
+
'keeps a bounded cache by retaining the top cumulative-attention-mass \u201cheavy hitters\u201d ' +
|
| 268 |
+
'plus a sliding recent <b>window</b>, instead of evicting purely by recency. HUD compares ' +
|
| 269 |
+
'H2O against a sliding-window-only baseline and the full-cache (no eviction) oracle. ' +
|
| 270 |
+
'Honesty label <b>MODELED</b> (deterministic simulation on a synthetic attention trace; NOT a ' +
|
| 271 |
+
'real KV cache or trained model). 0 runtime CDN.',
|
| 272 |
+
citations:
|
| 273 |
+
"H2O \u2014 Zhang et al. arXiv:2306.14048 \u00b7 StreamingLLM \u2014 Xiao et al. arXiv:2309.17453. MODELED \u00b7 not claimed-as.",
|
| 274 |
+
plain: { html: _plainHtml },
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 275 |
});
|
|
|
|
| 276 |
|
| 277 |
+
_el["kv-seqlen"] = _show.addField("seq_len (decoded tokens)");
|
| 278 |
+
_el["kv-capacity"] = _show.addField("capacity (KV-cache slots)");
|
| 279 |
+
_el["kv-window"] = _show.addField("window (recent tokens reserved)");
|
| 280 |
+
_el["kv-memratio"] = _show.addField("memory_ratio (capacity/seq_len)");
|
| 281 |
+
_el["kv-h2o"] = _show.addField("H2O mass_retained \u2014 MODELED");
|
| 282 |
+
_el["kv-sliding"] = _show.addField("sliding-window mass_retained");
|
| 283 |
+
_el["kv-full"] = _show.addField("full-cache mass_retained (oracle)");
|
| 284 |
+
_el["kv-gain"] = _show.addField("H2O vs sliding gain");
|
| 285 |
+
_el["kv-evicted"] = _show.addField("evicted_count");
|
| 286 |
+
_el["kv-label"] = _show.addField("honesty label");
|
| 287 |
|
|
|
|
| 288 |
_paintOverlay();
|
| 289 |
}
|
| 290 |
|
| 291 |
+
function _plainHtml() {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 292 |
const mem = S.memoryRatio != null ? (S.memoryRatio * 100).toFixed(1) + "%" : "loading\u2026";
|
| 293 |
const h2oPct = S.h2oMassRetained != null ? (S.h2oMassRetained * 100).toFixed(1) + "%" : "loading\u2026";
|
| 294 |
const slidPct = S.slidingMassRetained != null ? (S.slidingMassRetained * 100).toFixed(1) + "%" : "loading\u2026";
|
| 295 |
+
return (
|
| 296 |
"<b>What this means:</b> A language model keeps a running \u201cnotebook\u201d (the KV cache) of " +
|
| 297 |
"every word it has generated so it can pay attention back to earlier words. That notebook grows " +
|
| 298 |
"forever unless something is thrown away. Here the notebook is capped at just <b>" + mem + "</b> " +
|
|
|
|
| 301 |
"out to matter most so far (the \u201cheavy hitters\u201d), plus the most recent few \u2014 and keeps " +
|
| 302 |
"<b>" + h2oPct + "</b> of the important information at the SAME notebook size. This view is a " +
|
| 303 |
"<b>MODELED</b> deterministic simulation of that keep/discard rule on a synthetic attention trace, " +
|
| 304 |
+
"not a run of a real trained model or KV cache.");
|
| 305 |
}
|
| 306 |
|
| 307 |
function _tok(s) {
|
|
|
|
| 329 |
_set("kv-evicted", t || (S.evictedCount != null ? String(S.evictedCount) : "\u2014"));
|
| 330 |
// honesty label verbatim — never upgraded
|
| 331 |
_set("kv-label", t || (S.label || "MODELED"));
|
| 332 |
+
if (_show) { _show.setChip("kv", S.label || "MODELED", { text: "h2o eviction" }); _show.refreshPlain(); }
|
| 333 |
}
|
| 334 |
|
| 335 |
// =============================================================================
|
|
|
|
| 337 |
// =============================================================================
|
| 338 |
export function unmount() {
|
| 339 |
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 340 |
+
try { if (_show) _show.destroy(); } catch (_) {}
|
| 341 |
try {
|
| 342 |
if (_group && _stage) {
|
| 343 |
_group.traverse((o) => {
|
|
|
|
| 350 |
_stage.scene.remove(_group);
|
| 351 |
}
|
| 352 |
} catch (_) {}
|
| 353 |
+
_group = _show = null;
|
| 354 |
_floor = null; _spine = null; _tokenMesh = []; _marker = null;
|
| 355 |
+
_el = {}; _badge = null; _frameReg = false;
|
| 356 |
_stage = _THREE = _ctx = null;
|
| 357 |
S.label = S.seqLen = S.capacity = S.window = S.memoryRatio = null;
|
| 358 |
S.h2oMassRetained = S.slidingMassRetained = S.fullMassRetained = null;
|
static/3d/surfaces/matgran.js
CHANGED
|
@@ -41,6 +41,8 @@
|
|
| 41 |
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 42 |
// Nothing here is in the locked-8. Λ stays Conjecture 1. Trust never 100%.
|
| 43 |
|
|
|
|
|
|
|
| 44 |
const ID = "matgran";
|
| 45 |
const TITLE = "Matryoshka Representation Granularity · Prefix-Truncation Simulator (live)";
|
| 46 |
|
|
@@ -64,9 +66,8 @@ const MAX_BAR_H = 7.0; // world-units — bar height at accuracy = 1.0
|
|
| 64 |
const MIN_BAR_H = 0.12; // world-units — floor height so a bar never vanishes
|
| 65 |
const SAVE_H = 4.0; // world-units — storage-saving marker height at saving = 1.0
|
| 66 |
|
| 67 |
-
let _stage = null, _THREE = null, _ctx = null, _group = null,
|
| 68 |
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
| 69 |
-
let _plain = false;
|
| 70 |
|
| 71 |
// geometry handles
|
| 72 |
let _floor = null;
|
|
@@ -266,106 +267,36 @@ function _onFrame() {
|
|
| 266 |
// =============================================================================
|
| 267 |
function _buildOverlay() {
|
| 268 |
const ctx = _ctx;
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
sub.innerHTML =
|
| 286 |
-
'One embedding is trained so its <b>front prefixes</b> are each usable embeddings ' +
|
| 287 |
-
'\u2014 truncate to the first 2/4/8/16/32 dims to trade accuracy for storage with no ' +
|
| 288 |
-
'retraining. The <b>lattice-blue</b> bars are the <b>nested</b> (front-loaded) embedding\u2019s ' +
|
| 289 |
-
'accuracy at each prefix; the <b>grey</b> bars are a <b>non-nested</b> control (same directions, ' +
|
| 290 |
-
'shuffled); the <b>proof-teal</b> markers are the storage saving at each prefix. Nested stays ' +
|
| 291 |
-
'accurate under truncation; non-nested collapses. Honesty label <b>MODELED</b> ' +
|
| 292 |
-
'(deterministic toy sim; NOT a trained encoder). 0 runtime CDN.';
|
| 293 |
-
_overlay.appendChild(sub);
|
| 294 |
-
|
| 295 |
-
const brow = document.createElement("div");
|
| 296 |
-
brow.style.cssText = "display:flex;gap:8px;align-items:center;flex-wrap:wrap";
|
| 297 |
-
if (_badge && _badge.el) brow.appendChild(_badge.el);
|
| 298 |
-
_overlay.appendChild(brow);
|
| 299 |
-
|
| 300 |
-
const card = document.createElement("div");
|
| 301 |
-
card.style.cssText = "background:#0a1117;border:1px solid #1d2a36;border-radius:9px;padding:9px 10px;display:flex;flex-direction:column;gap:6px";
|
| 302 |
-
|
| 303 |
-
const chead = document.createElement("div");
|
| 304 |
-
chead.style.cssText = "display:flex;align-items:center;gap:8px;flex-wrap:wrap";
|
| 305 |
-
const dot = document.createElement("span");
|
| 306 |
-
dot.style.cssText = "width:9px;height:9px;border-radius:50%;background:#3af4c8;box-shadow:0 0 7px #3af4c8";
|
| 307 |
-
const nm = document.createElement("b");
|
| 308 |
-
nm.style.cssText = "font-size:12px;color:#3af4c8;letter-spacing:.3px";
|
| 309 |
-
nm.textContent = "matryoshka representation granularity";
|
| 310 |
-
chead.appendChild(dot); chead.appendChild(nm);
|
| 311 |
-
card.appendChild(chead);
|
| 312 |
-
|
| 313 |
-
const grid = document.createElement("div");
|
| 314 |
-
grid.style.cssText = "display:grid;grid-template-columns:1fr;gap:4px";
|
| 315 |
-
|
| 316 |
-
function kpiRow(id, label) {
|
| 317 |
-
const r = document.createElement("div");
|
| 318 |
-
r.style.cssText = "display:flex;justify-content:space-between;gap:10px;font-size:11px";
|
| 319 |
-
const l = document.createElement("span"); l.style.cssText = "color:#9fb1bf"; l.textContent = label;
|
| 320 |
-
const v = document.createElement("b");
|
| 321 |
-
v.id = id;
|
| 322 |
-
v.style.cssText = "font-variant-numeric:tabular-nums;color:#eef3f6;text-align:right;max-width:62%";
|
| 323 |
-
v.textContent = "\u2014";
|
| 324 |
-
_el[id] = v;
|
| 325 |
-
r.appendChild(l); r.appendChild(v); return r;
|
| 326 |
-
}
|
| 327 |
-
|
| 328 |
-
grid.appendChild(kpiRow("mg-D", "D (full width)"));
|
| 329 |
-
grid.appendChild(kpiRow("mg-prefixes","prefixes evaluated"));
|
| 330 |
-
grid.appendChild(kpiRow("mg-nested", "nested acc @ prefixes"));
|
| 331 |
-
grid.appendChild(kpiRow("mg-nonnest", "non-nested acc @ prefixes"));
|
| 332 |
-
grid.appendChild(kpiRow("mg-saving", "storage saving @ prefixes"));
|
| 333 |
-
grid.appendChild(kpiRow("mg-full", "full_accuracy (d = D)"));
|
| 334 |
-
grid.appendChild(kpiRow("mg-label", "honesty label"));
|
| 335 |
-
card.appendChild(grid);
|
| 336 |
-
|
| 337 |
-
const fn = document.createElement("div");
|
| 338 |
-
fn.style.cssText = "font-size:9.5px;color:#6b7a86;line-height:1.5";
|
| 339 |
-
fn.textContent = "MIPIC arXiv:2604.24374 (refines nested reps) \u00b7 MRL arXiv:2205.13147 (foundational). MODELED \u00b7 not claimed-as.";
|
| 340 |
-
card.appendChild(fn);
|
| 341 |
-
_overlay.appendChild(card);
|
| 342 |
-
|
| 343 |
-
const pl = document.createElement("button");
|
| 344 |
-
pl.textContent = "\u25d1 what this means";
|
| 345 |
-
pl.title = "Toggle plain-language explanation for investors & consumers.";
|
| 346 |
-
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";
|
| 347 |
-
pl.addEventListener("click", () => {
|
| 348 |
-
_plain = !_plain;
|
| 349 |
-
pl.style.background = _plain ? "#0f2a20" : "#08140f";
|
| 350 |
-
_applyPlain();
|
| 351 |
});
|
| 352 |
-
_overlay.appendChild(pl);
|
| 353 |
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
_el["
|
| 358 |
-
|
|
|
|
|
|
|
| 359 |
|
| 360 |
-
(ctx.container || document.body).appendChild(_overlay);
|
| 361 |
_paintOverlay();
|
| 362 |
}
|
| 363 |
|
| 364 |
-
function
|
| 365 |
-
const pd = _el["plain"];
|
| 366 |
-
if (!pd) return;
|
| 367 |
-
pd.style.display = _plain ? "block" : "none";
|
| 368 |
-
if (!_plain) return;
|
| 369 |
let lowGain = "loading\u2026";
|
| 370 |
if (Array.isArray(S.curve) && S.curve.length) {
|
| 371 |
const c0 = S.curve[0];
|
|
@@ -374,7 +305,7 @@ function _applyPlain() {
|
|
| 374 |
"% vs non-nested " + (c0.non_nested_accuracy * 100).toFixed(0) + "%";
|
| 375 |
}
|
| 376 |
}
|
| 377 |
-
|
| 378 |
"<b>What this means:</b> An embedding is a list of numbers that captures the meaning of " +
|
| 379 |
"something (a word, an image). Normally, if you want a shorter, cheaper embedding you have " +
|
| 380 |
"to train a whole new model. <b>Matryoshka</b> embeddings are trained so the FIRST few " +
|
|
@@ -389,7 +320,7 @@ function _applyPlain() {
|
|
| 389 |
"self-distillation over real models. It shows WHY prefix-nested embeddings degrade " +
|
| 390 |
"gracefully versus a non-nested control; it does NOT reproduce MIPIC\u2019s STS/NLI/" +
|
| 391 |
"classification results or MRL\u2019s ImageNet speed-ups, and the \u201cself-distillation\u201d " +
|
| 392 |
-
"step is a one-pass toy stand-in. Not a run of MIPIC or MRL.";
|
| 393 |
}
|
| 394 |
|
| 395 |
function _tok(s) {
|
|
@@ -424,7 +355,7 @@ function _paintOverlay() {
|
|
| 424 |
_set("mg-full", t || (S.fullAcc != null ? S.fullAcc.toFixed(3) : "\u2014"));
|
| 425 |
// honesty label verbatim — never upgraded
|
| 426 |
_set("mg-label", t || (S.label || "MODELED"));
|
| 427 |
-
if (
|
| 428 |
}
|
| 429 |
|
| 430 |
// =============================================================================
|
|
@@ -432,7 +363,7 @@ function _paintOverlay() {
|
|
| 432 |
// =============================================================================
|
| 433 |
export function unmount() {
|
| 434 |
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 435 |
-
try { if (
|
| 436 |
try {
|
| 437 |
if (_group && _stage) {
|
| 438 |
_group.traverse((o) => {
|
|
@@ -445,11 +376,11 @@ export function unmount() {
|
|
| 445 |
_stage.scene.remove(_group);
|
| 446 |
}
|
| 447 |
} catch (_) {}
|
| 448 |
-
_group =
|
| 449 |
_floor = null;
|
| 450 |
_nestBars = []; _nonBars = []; _saveMk = [];
|
| 451 |
_nestTargetH = []; _nonTargetH = []; _saveTargetH = [];
|
| 452 |
-
_el = {}; _badge = null;
|
| 453 |
_stage = _THREE = _ctx = null;
|
| 454 |
S.label = S.D = S.prefixes = S.curve = S.fullAcc = null;
|
| 455 |
S.state = "init";
|
|
|
|
| 41 |
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 42 |
// Nothing here is in the locked-8. Λ stays Conjecture 1. Trust never 100%.
|
| 43 |
|
| 44 |
+
import { createShowcase } from "./_showcase.js";
|
| 45 |
+
|
| 46 |
const ID = "matgran";
|
| 47 |
const TITLE = "Matryoshka Representation Granularity · Prefix-Truncation Simulator (live)";
|
| 48 |
|
|
|
|
| 66 |
const MIN_BAR_H = 0.12; // world-units — floor height so a bar never vanishes
|
| 67 |
const SAVE_H = 4.0; // world-units — storage-saving marker height at saving = 1.0
|
| 68 |
|
| 69 |
+
let _stage = null, _THREE = null, _ctx = null, _group = null, _show = null;
|
| 70 |
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
|
|
|
| 71 |
|
| 72 |
// geometry handles
|
| 73 |
let _floor = null;
|
|
|
|
| 267 |
// =============================================================================
|
| 268 |
function _buildOverlay() {
|
| 269 |
const ctx = _ctx;
|
| 270 |
+
_show = createShowcase(ctx, {
|
| 271 |
+
id: ID, title: TITLE, accent: "#d7b96b",
|
| 272 |
+
badge: _badge,
|
| 273 |
+
chips: [{ label: "MODELED", text: "nested embedding", name: "mg" }],
|
| 274 |
+
legend: ["MODELED", "SAMPLE"],
|
| 275 |
+
description:
|
| 276 |
+
'One embedding is trained so its <b>front prefixes</b> are each usable embeddings ' +
|
| 277 |
+
'\u2014 truncate to the first 2/4/8/16/32 dims to trade accuracy for storage with no ' +
|
| 278 |
+
'retraining. The <b>lattice-blue</b> bars are the <b>nested</b> (front-loaded) embedding\u2019s ' +
|
| 279 |
+
'accuracy at each prefix; the <b>grey</b> bars are a <b>non-nested</b> control (same directions, ' +
|
| 280 |
+
'shuffled); the <b>proof-teal</b> markers are the storage saving at each prefix. Nested stays ' +
|
| 281 |
+
'accurate under truncation; non-nested collapses. Honesty label <b>MODELED</b> ' +
|
| 282 |
+
'(deterministic toy sim; NOT a trained encoder). 0 runtime CDN.',
|
| 283 |
+
citations:
|
| 284 |
+
"MIPIC arXiv:2604.24374 (refines nested reps) \u00b7 MRL arXiv:2205.13147 (foundational). MODELED \u00b7 not claimed-as.",
|
| 285 |
+
plain: { html: _plainHtml },
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 286 |
});
|
|
|
|
| 287 |
|
| 288 |
+
_el["mg-D"] = _show.addField("D (full width)");
|
| 289 |
+
_el["mg-prefixes"] = _show.addField("prefixes evaluated");
|
| 290 |
+
_el["mg-nested"] = _show.addField("nested acc @ prefixes");
|
| 291 |
+
_el["mg-nonnest"] = _show.addField("non-nested acc @ prefixes");
|
| 292 |
+
_el["mg-saving"] = _show.addField("storage saving @ prefixes");
|
| 293 |
+
_el["mg-full"] = _show.addField("full_accuracy (d = D)");
|
| 294 |
+
_el["mg-label"] = _show.addField("honesty label");
|
| 295 |
|
|
|
|
| 296 |
_paintOverlay();
|
| 297 |
}
|
| 298 |
|
| 299 |
+
function _plainHtml() {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 300 |
let lowGain = "loading\u2026";
|
| 301 |
if (Array.isArray(S.curve) && S.curve.length) {
|
| 302 |
const c0 = S.curve[0];
|
|
|
|
| 305 |
"% vs non-nested " + (c0.non_nested_accuracy * 100).toFixed(0) + "%";
|
| 306 |
}
|
| 307 |
}
|
| 308 |
+
return (
|
| 309 |
"<b>What this means:</b> An embedding is a list of numbers that captures the meaning of " +
|
| 310 |
"something (a word, an image). Normally, if you want a shorter, cheaper embedding you have " +
|
| 311 |
"to train a whole new model. <b>Matryoshka</b> embeddings are trained so the FIRST few " +
|
|
|
|
| 320 |
"self-distillation over real models. It shows WHY prefix-nested embeddings degrade " +
|
| 321 |
"gracefully versus a non-nested control; it does NOT reproduce MIPIC\u2019s STS/NLI/" +
|
| 322 |
"classification results or MRL\u2019s ImageNet speed-ups, and the \u201cself-distillation\u201d " +
|
| 323 |
+
"step is a one-pass toy stand-in. Not a run of MIPIC or MRL.");
|
| 324 |
}
|
| 325 |
|
| 326 |
function _tok(s) {
|
|
|
|
| 355 |
_set("mg-full", t || (S.fullAcc != null ? S.fullAcc.toFixed(3) : "\u2014"));
|
| 356 |
// honesty label verbatim — never upgraded
|
| 357 |
_set("mg-label", t || (S.label || "MODELED"));
|
| 358 |
+
if (_show) { _show.setChip("mg", S.label || "MODELED", { text: "nested embedding" }); _show.refreshPlain(); }
|
| 359 |
}
|
| 360 |
|
| 361 |
// =============================================================================
|
|
|
|
| 363 |
// =============================================================================
|
| 364 |
export function unmount() {
|
| 365 |
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 366 |
+
try { if (_show) _show.destroy(); } catch (_) {}
|
| 367 |
try {
|
| 368 |
if (_group && _stage) {
|
| 369 |
_group.traverse((o) => {
|
|
|
|
| 376 |
_stage.scene.remove(_group);
|
| 377 |
}
|
| 378 |
} catch (_) {}
|
| 379 |
+
_group = _show = null;
|
| 380 |
_floor = null;
|
| 381 |
_nestBars = []; _nonBars = []; _saveMk = [];
|
| 382 |
_nestTargetH = []; _nonTargetH = []; _saveTargetH = [];
|
| 383 |
+
_el = {}; _badge = null; _frameReg = false;
|
| 384 |
_stage = _THREE = _ctx = null;
|
| 385 |
S.label = S.D = S.prefixes = S.curve = S.fullAcc = null;
|
| 386 |
S.state = "init";
|
static/3d/surfaces/mla.js
CHANGED
|
@@ -39,6 +39,8 @@
|
|
| 39 |
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 40 |
// Nothing here is in the locked-8. Λ stays Conjecture 1. Trust never 100%.
|
| 41 |
|
|
|
|
|
|
|
| 42 |
const ID = "mla";
|
| 43 |
const TITLE = "Multi-Head Latent Attention · KV-Compression Simulator (live)";
|
| 44 |
|
|
@@ -60,9 +62,8 @@ const COL_GAP = 2.4; // world-units between the full-KV and latent column
|
|
| 60 |
const MAX_FULL_H = 8.0; // world-units — height of the full-KV column at scale=1
|
| 61 |
const MIN_LATENT_H = 0.15; // world-units — floor height so the latent column never vanishes
|
| 62 |
|
| 63 |
-
let _stage = null, _THREE = null, _ctx = null, _group = null,
|
| 64 |
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
| 65 |
-
let _plain = false;
|
| 66 |
|
| 67 |
// geometry handles
|
| 68 |
let _floor = null;
|
|
@@ -260,110 +261,40 @@ function _onFrame() {
|
|
| 260 |
// =============================================================================
|
| 261 |
function _buildOverlay() {
|
| 262 |
const ctx = _ctx;
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
sub.style.cssText = "color:#9fb1bf;font-size:11px;line-height:1.55";
|
| 279 |
-
sub.innerHTML =
|
| 280 |
-
'Per-token Key/Value vectors across all heads are jointly <b>down-projected</b> to a ' +
|
| 281 |
-
'shared low-rank <b>latent</b> vector (only this gets cached), then <b>up-projected</b> ' +
|
| 282 |
-
'back on demand. The tall <b>lattice-blue</b> column is the full/uncompressed KV cache; ' +
|
| 283 |
-
'the short <b>proof-teal</b> column is the compressed latent cache; the faint grey ghost ' +
|
| 284 |
-
'shows the reconstruction. Honesty label <b>MODELED</b> (deterministic low-rank ' +
|
| 285 |
-
'down/up-projection simulation; NOT trained DeepSeek weights). 0 runtime CDN.';
|
| 286 |
-
_overlay.appendChild(sub);
|
| 287 |
-
|
| 288 |
-
const brow = document.createElement("div");
|
| 289 |
-
brow.style.cssText = "display:flex;gap:8px;align-items:center;flex-wrap:wrap";
|
| 290 |
-
if (_badge && _badge.el) brow.appendChild(_badge.el);
|
| 291 |
-
_overlay.appendChild(brow);
|
| 292 |
-
|
| 293 |
-
const card = document.createElement("div");
|
| 294 |
-
card.style.cssText = "background:#0a1117;border:1px solid #1d2a36;border-radius:9px;padding:9px 10px;display:flex;flex-direction:column;gap:6px";
|
| 295 |
-
|
| 296 |
-
const chead = document.createElement("div");
|
| 297 |
-
chead.style.cssText = "display:flex;align-items:center;gap:8px;flex-wrap:wrap";
|
| 298 |
-
const dot = document.createElement("span");
|
| 299 |
-
dot.style.cssText = "width:9px;height:9px;border-radius:50%;background:#3af4c8;box-shadow:0 0 7px #3af4c8";
|
| 300 |
-
const nm = document.createElement("b");
|
| 301 |
-
nm.style.cssText = "font-size:12px;color:#3af4c8;letter-spacing:.3px";
|
| 302 |
-
nm.textContent = "multi-head latent attention";
|
| 303 |
-
chead.appendChild(dot); chead.appendChild(nm);
|
| 304 |
-
card.appendChild(chead);
|
| 305 |
-
|
| 306 |
-
const grid = document.createElement("div");
|
| 307 |
-
grid.style.cssText = "display:grid;grid-template-columns:1fr;gap:4px";
|
| 308 |
-
|
| 309 |
-
function kpiRow(id, label) {
|
| 310 |
-
const r = document.createElement("div");
|
| 311 |
-
r.style.cssText = "display:flex;justify-content:space-between;gap:10px;font-size:11px";
|
| 312 |
-
const l = document.createElement("span"); l.style.cssText = "color:#9fb1bf"; l.textContent = label;
|
| 313 |
-
const v = document.createElement("b");
|
| 314 |
-
v.id = id;
|
| 315 |
-
v.style.cssText = "font-variant-numeric:tabular-nums;color:#eef3f6;text-align:right;max-width:58%";
|
| 316 |
-
v.textContent = "\u2014";
|
| 317 |
-
_el[id] = v;
|
| 318 |
-
r.appendChild(l); r.appendChild(v); return r;
|
| 319 |
-
}
|
| 320 |
-
|
| 321 |
-
grid.appendChild(kpiRow("mla-seqlen", "seq_len (positions)"));
|
| 322 |
-
grid.appendChild(kpiRow("mla-heads", "n_heads \u00d7 d_head"));
|
| 323 |
-
grid.appendChild(kpiRow("mla-dlatent", "d_latent (compressed width)"));
|
| 324 |
-
grid.appendChild(kpiRow("mla-mhacache","mha_cache_size (elements)"));
|
| 325 |
-
grid.appendChild(kpiRow("mla-mlacache","mla_cache_size (elements)"));
|
| 326 |
-
grid.appendChild(kpiRow("mla-ratio", "compression_ratio \u2014 MODELED"));
|
| 327 |
-
grid.appendChild(kpiRow("mla-err", "reconstruction_error (mean L2)"));
|
| 328 |
-
grid.appendChild(kpiRow("mla-label", "honesty label"));
|
| 329 |
-
card.appendChild(grid);
|
| 330 |
-
|
| 331 |
-
const fn = document.createElement("div");
|
| 332 |
-
fn.style.cssText = "font-size:9.5px;color:#6b7a86;line-height:1.5";
|
| 333 |
-
fn.textContent = "DeepSeek-V2 arXiv:2405.04434 (introduces MLA) \u00b7 DeepSeek-V3 arXiv:2412.19437 (adopts MLA). MODELED \u00b7 not claimed-as.";
|
| 334 |
-
card.appendChild(fn);
|
| 335 |
-
_overlay.appendChild(card);
|
| 336 |
-
|
| 337 |
-
const pl = document.createElement("button");
|
| 338 |
-
pl.textContent = "\u25d1 what this means";
|
| 339 |
-
pl.title = "Toggle plain-language explanation for investors & consumers.";
|
| 340 |
-
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";
|
| 341 |
-
pl.addEventListener("click", () => {
|
| 342 |
-
_plain = !_plain;
|
| 343 |
-
pl.style.background = _plain ? "#0f2a20" : "#08140f";
|
| 344 |
-
_applyPlain();
|
| 345 |
});
|
| 346 |
-
_overlay.appendChild(pl);
|
| 347 |
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
_el["
|
| 352 |
-
|
|
|
|
|
|
|
|
|
|
| 353 |
|
| 354 |
-
(ctx.container || document.body).appendChild(_overlay);
|
| 355 |
_paintOverlay();
|
| 356 |
}
|
| 357 |
|
| 358 |
-
function
|
| 359 |
-
const pd = _el["plain"];
|
| 360 |
-
if (!pd) return;
|
| 361 |
-
pd.style.display = _plain ? "block" : "none";
|
| 362 |
-
if (!_plain) return;
|
| 363 |
const ratio = S.ratio != null ? S.ratio.toFixed(2) + "\u00d7" : "loading\u2026";
|
| 364 |
const err = S.reconErr != null ? S.reconErr.toFixed(3) : "loading\u2026";
|
| 365 |
const dl = S.dLatent != null ? String(S.dLatent) : "loading\u2026";
|
| 366 |
-
|
| 367 |
"<b>What this means:</b> Normally, a model must remember a separate \u201ckey\u201d and " +
|
| 368 |
"\u201cvalue\u201d vector for every attention head, for every word it has generated so far " +
|
| 369 |
"\u2014 this memory (the KV cache) grows huge for long conversations. <b>Multi-Head Latent " +
|
|
@@ -374,7 +305,7 @@ function _applyPlain() {
|
|
| 374 |
"(<b>" + err + "</b> average error) since a random squeeze loses some detail. In real " +
|
| 375 |
"DeepSeek-V2/V3 models, that squeeze is <i>trained</i> to keep the mismatch tiny; this " +
|
| 376 |
"view uses an untrained, deterministic squeeze to demonstrate the compression math " +
|
| 377 |
-
"honestly \u2014 it is a <b>MODELED</b> simulation, not a run of DeepSeek's actual model.";
|
| 378 |
}
|
| 379 |
|
| 380 |
function _tok(s) {
|
|
@@ -399,7 +330,7 @@ function _paintOverlay() {
|
|
| 399 |
_set("mla-err", t || fx(S.reconErr, 4));
|
| 400 |
// honesty label verbatim — never upgraded
|
| 401 |
_set("mla-label", t || (S.label || "MODELED"));
|
| 402 |
-
if (
|
| 403 |
}
|
| 404 |
|
| 405 |
// =============================================================================
|
|
@@ -407,7 +338,7 @@ function _paintOverlay() {
|
|
| 407 |
// =============================================================================
|
| 408 |
export function unmount() {
|
| 409 |
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 410 |
-
try { if (
|
| 411 |
try {
|
| 412 |
if (_group && _stage) {
|
| 413 |
_group.traverse((o) => {
|
|
@@ -420,10 +351,10 @@ export function unmount() {
|
|
| 420 |
_stage.scene.remove(_group);
|
| 421 |
}
|
| 422 |
} catch (_) {}
|
| 423 |
-
_group =
|
| 424 |
_floor = null; _fullCol = null; _latentCol = null; _ghostCol = null; _linkLine = null;
|
| 425 |
_fullTargetH = 0.4; _latentTargetH = 0.4; _ghostTargetH = 0.4;
|
| 426 |
-
_el = {}; _badge = null;
|
| 427 |
_stage = _THREE = _ctx = null;
|
| 428 |
S.label = S.seqLen = S.nHeads = S.dHead = S.dLatent = null;
|
| 429 |
S.mhaCache = S.mlaCache = S.ratio = S.reconErr = null;
|
|
|
|
| 39 |
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 40 |
// Nothing here is in the locked-8. Λ stays Conjecture 1. Trust never 100%.
|
| 41 |
|
| 42 |
+
import { createShowcase } from "./_showcase.js";
|
| 43 |
+
|
| 44 |
const ID = "mla";
|
| 45 |
const TITLE = "Multi-Head Latent Attention · KV-Compression Simulator (live)";
|
| 46 |
|
|
|
|
| 62 |
const MAX_FULL_H = 8.0; // world-units — height of the full-KV column at scale=1
|
| 63 |
const MIN_LATENT_H = 0.15; // world-units — floor height so the latent column never vanishes
|
| 64 |
|
| 65 |
+
let _stage = null, _THREE = null, _ctx = null, _group = null, _show = null;
|
| 66 |
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
|
|
|
| 67 |
|
| 68 |
// geometry handles
|
| 69 |
let _floor = null;
|
|
|
|
| 261 |
// =============================================================================
|
| 262 |
function _buildOverlay() {
|
| 263 |
const ctx = _ctx;
|
| 264 |
+
_show = createShowcase(ctx, {
|
| 265 |
+
id: ID, title: TITLE, accent: "#5b8dee",
|
| 266 |
+
badge: _badge,
|
| 267 |
+
chips: [{ label: "MODELED", text: "KV compression", name: "mla" }],
|
| 268 |
+
legend: ["MODELED", "SAMPLE"],
|
| 269 |
+
description:
|
| 270 |
+
'Per-token Key/Value vectors across all heads are jointly <b>down-projected</b> to a ' +
|
| 271 |
+
'shared low-rank <b>latent</b> vector (only this gets cached), then <b>up-projected</b> ' +
|
| 272 |
+
'back on demand. The tall <b>lattice-blue</b> column is the full/uncompressed KV cache; ' +
|
| 273 |
+
'the short <b>proof-teal</b> column is the compressed latent cache; the faint grey ghost ' +
|
| 274 |
+
'shows the reconstruction. Honesty label <b>MODELED</b> (deterministic low-rank ' +
|
| 275 |
+
'down/up-projection simulation; NOT trained DeepSeek weights). 0 runtime CDN.',
|
| 276 |
+
citations:
|
| 277 |
+
"DeepSeek-V2 arXiv:2405.04434 (introduces MLA) \u00b7 DeepSeek-V3 arXiv:2412.19437 (adopts MLA). MODELED \u00b7 not claimed-as.",
|
| 278 |
+
plain: { html: _plainHtml },
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 279 |
});
|
|
|
|
| 280 |
|
| 281 |
+
_el["mla-seqlen"] = _show.addField("seq_len (positions)");
|
| 282 |
+
_el["mla-heads"] = _show.addField("n_heads \u00d7 d_head");
|
| 283 |
+
_el["mla-dlatent"] = _show.addField("d_latent (compressed width)");
|
| 284 |
+
_el["mla-mhacache"] = _show.addField("mha_cache_size (elements)");
|
| 285 |
+
_el["mla-mlacache"] = _show.addField("mla_cache_size (elements)");
|
| 286 |
+
_el["mla-ratio"] = _show.addField("compression_ratio \u2014 MODELED");
|
| 287 |
+
_el["mla-err"] = _show.addField("reconstruction_error (mean L2)");
|
| 288 |
+
_el["mla-label"] = _show.addField("honesty label");
|
| 289 |
|
|
|
|
| 290 |
_paintOverlay();
|
| 291 |
}
|
| 292 |
|
| 293 |
+
function _plainHtml() {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 294 |
const ratio = S.ratio != null ? S.ratio.toFixed(2) + "\u00d7" : "loading\u2026";
|
| 295 |
const err = S.reconErr != null ? S.reconErr.toFixed(3) : "loading\u2026";
|
| 296 |
const dl = S.dLatent != null ? String(S.dLatent) : "loading\u2026";
|
| 297 |
+
return (
|
| 298 |
"<b>What this means:</b> Normally, a model must remember a separate \u201ckey\u201d and " +
|
| 299 |
"\u201cvalue\u201d vector for every attention head, for every word it has generated so far " +
|
| 300 |
"\u2014 this memory (the KV cache) grows huge for long conversations. <b>Multi-Head Latent " +
|
|
|
|
| 305 |
"(<b>" + err + "</b> average error) since a random squeeze loses some detail. In real " +
|
| 306 |
"DeepSeek-V2/V3 models, that squeeze is <i>trained</i> to keep the mismatch tiny; this " +
|
| 307 |
"view uses an untrained, deterministic squeeze to demonstrate the compression math " +
|
| 308 |
+
"honestly \u2014 it is a <b>MODELED</b> simulation, not a run of DeepSeek's actual model.");
|
| 309 |
}
|
| 310 |
|
| 311 |
function _tok(s) {
|
|
|
|
| 330 |
_set("mla-err", t || fx(S.reconErr, 4));
|
| 331 |
// honesty label verbatim — never upgraded
|
| 332 |
_set("mla-label", t || (S.label || "MODELED"));
|
| 333 |
+
if (_show) { _show.setChip("mla", S.label || "MODELED", { text: "KV compression" }); _show.refreshPlain(); }
|
| 334 |
}
|
| 335 |
|
| 336 |
// =============================================================================
|
|
|
|
| 338 |
// =============================================================================
|
| 339 |
export function unmount() {
|
| 340 |
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 341 |
+
try { if (_show) _show.destroy(); } catch (_) {}
|
| 342 |
try {
|
| 343 |
if (_group && _stage) {
|
| 344 |
_group.traverse((o) => {
|
|
|
|
| 351 |
_stage.scene.remove(_group);
|
| 352 |
}
|
| 353 |
} catch (_) {}
|
| 354 |
+
_group = _show = null;
|
| 355 |
_floor = null; _fullCol = null; _latentCol = null; _ghostCol = null; _linkLine = null;
|
| 356 |
_fullTargetH = 0.4; _latentTargetH = 0.4; _ghostTargetH = 0.4;
|
| 357 |
+
_el = {}; _badge = null; _frameReg = false;
|
| 358 |
_stage = _THREE = _ctx = null;
|
| 359 |
S.label = S.seqLen = S.nHeads = S.dHead = S.dLatent = null;
|
| 360 |
S.mhaCache = S.mlaCache = S.ratio = S.reconErr = null;
|
static/3d/surfaces/moe.js
CHANGED
|
@@ -46,6 +46,8 @@
|
|
| 46 |
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 47 |
// Nothing here is in the locked-8. Λ stays Conjecture 1. Trust never 100%.
|
| 48 |
|
|
|
|
|
|
|
| 49 |
const ID = "moe";
|
| 50 |
const TITLE = "MoE Sparse-Upcycling Router Simulator (live)";
|
| 51 |
|
|
@@ -66,9 +68,8 @@ const CELL_X = 1.1; // world-units per expert column
|
|
| 66 |
const CELL_Z = 1.3; // world-units per routing round row
|
| 67 |
const MAX_BAR_H = 5.0; // world-units of max bar height (cumulative load axis)
|
| 68 |
|
| 69 |
-
let _stage = null, _THREE = null, _ctx = null, _group = null,
|
| 70 |
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
| 71 |
-
let _plain = false;
|
| 72 |
|
| 73 |
// geometry handles
|
| 74 |
let _floor = null;
|
|
@@ -260,110 +261,40 @@ function _onFrame() {
|
|
| 260 |
// =============================================================================
|
| 261 |
function _buildOverlay() {
|
| 262 |
const ctx = _ctx;
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
color: "#eef3f6",
|
| 270 |
-
});
|
| 271 |
-
|
| 272 |
-
const h = document.createElement("div");
|
| 273 |
-
h.style.cssText = "font:600 13px ui-sans-serif,system-ui;letter-spacing:.4px";
|
| 274 |
-
h.textContent = TITLE;
|
| 275 |
-
_overlay.appendChild(h);
|
| 276 |
-
|
| 277 |
-
const sub = document.createElement("div");
|
| 278 |
-
sub.style.cssText = "color:#9fb1bf;font-size:11px;line-height:1.55";
|
| 279 |
-
sub.innerHTML =
|
| 280 |
'A <b>top-K softmax router</b> dispatches each synthetic token to its highest-weight ' +
|
| 281 |
'experts. The heat-surface shows <b>cumulative expert load</b> building up across ' +
|
| 282 |
'routing rounds (X = expert, Z = round, Y = cumulative load). <b style="color:#5b8dee">Blue</b> ' +
|
| 283 |
'peaks are <b>under-loaded</b> experts (below mean); <b style="color:#3af4c8">teal</b> peaks are ' +
|
| 284 |
'<b>balanced/at-or-above-mean</b>. Honesty label <b>MODELED</b> (deterministic router ' +
|
| 285 |
'simulation — no trained MoE, never claimed as DeepSeekMoE/Gemma-MoE/any production ' +
|
| 286 |
-
'router). 0 runtime CDN.'
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
brow.style.cssText = "display:flex;gap:8px;align-items:center;flex-wrap:wrap";
|
| 291 |
-
if (_badge && _badge.el) brow.appendChild(_badge.el);
|
| 292 |
-
_overlay.appendChild(brow);
|
| 293 |
-
|
| 294 |
-
const card = document.createElement("div");
|
| 295 |
-
card.style.cssText = "background:#0a1117;border:1px solid #1d2a36;border-radius:9px;padding:9px 10px;display:flex;flex-direction:column;gap:6px";
|
| 296 |
-
|
| 297 |
-
const chead = document.createElement("div");
|
| 298 |
-
chead.style.cssText = "display:flex;align-items:center;gap:8px;flex-wrap:wrap";
|
| 299 |
-
const dot = document.createElement("span");
|
| 300 |
-
dot.style.cssText = "width:9px;height:9px;border-radius:50%;background:#5b8dee;box-shadow:0 0 7px #5b8dee";
|
| 301 |
-
const nm = document.createElement("b");
|
| 302 |
-
nm.style.cssText = "font-size:12px;color:#5b8dee;letter-spacing:.3px";
|
| 303 |
-
nm.textContent = "moe-router";
|
| 304 |
-
chead.appendChild(dot); chead.appendChild(nm);
|
| 305 |
-
card.appendChild(chead);
|
| 306 |
-
|
| 307 |
-
const grid = document.createElement("div");
|
| 308 |
-
grid.style.cssText = "display:grid;grid-template-columns:1fr;gap:4px";
|
| 309 |
-
|
| 310 |
-
function kpiRow(id, label) {
|
| 311 |
-
const r = document.createElement("div");
|
| 312 |
-
r.style.cssText = "display:flex;justify-content:space-between;gap:10px;font-size:11px";
|
| 313 |
-
const l = document.createElement("span"); l.style.cssText = "color:#9fb1bf"; l.textContent = label;
|
| 314 |
-
const v = document.createElement("b");
|
| 315 |
-
v.id = id;
|
| 316 |
-
v.style.cssText = "font-variant-numeric:tabular-nums;color:#eef3f6;text-align:right;max-width:58%";
|
| 317 |
-
v.textContent = "\u2014";
|
| 318 |
-
_el[id] = v;
|
| 319 |
-
r.appendChild(l); r.appendChild(v); return r;
|
| 320 |
-
}
|
| 321 |
-
|
| 322 |
-
grid.appendChild(kpiRow("moe-tokens", "tokens routed"));
|
| 323 |
-
grid.appendChild(kpiRow("moe-experts", "experts N"));
|
| 324 |
-
grid.appendChild(kpiRow("moe-topk", "top-K per token"));
|
| 325 |
-
grid.appendChild(kpiRow("moe-cv", "load_balance_cv"));
|
| 326 |
-
grid.appendChild(kpiRow("moe-minmax", "min / max expert load"));
|
| 327 |
-
grid.appendChild(kpiRow("moe-label", "honesty label"));
|
| 328 |
-
card.appendChild(grid);
|
| 329 |
-
|
| 330 |
-
const fn = document.createElement("div");
|
| 331 |
-
fn.style.cssText = "font-size:9.5px;color:#6b7a86;line-height:1.5";
|
| 332 |
-
fn.textContent = "Komatsuzaki et al. arXiv:2212.05055 (Sparse Upcycling) \u00b7 Dai et al. arXiv:2401.06066 (DeepSeekMoE) \u00b7 github.com/amazon-science/expert-upcycling (Expert Upcycling). MODELED \u00b7 not claimed-as.";
|
| 333 |
-
card.appendChild(fn);
|
| 334 |
-
_overlay.appendChild(card);
|
| 335 |
-
|
| 336 |
-
const pl = document.createElement("button");
|
| 337 |
-
pl.textContent = "\u25d1 what this means";
|
| 338 |
-
pl.title = "Toggle plain-language explanation for investors & consumers.";
|
| 339 |
-
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";
|
| 340 |
-
pl.addEventListener("click", () => {
|
| 341 |
-
_plain = !_plain;
|
| 342 |
-
pl.style.background = _plain ? "#0f2a20" : "#08140f";
|
| 343 |
-
_applyPlain();
|
| 344 |
});
|
| 345 |
-
_overlay.appendChild(pl);
|
| 346 |
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
_el["
|
| 351 |
-
|
|
|
|
| 352 |
|
| 353 |
-
(ctx.container || document.body).appendChild(_overlay);
|
| 354 |
_paintOverlay();
|
| 355 |
}
|
| 356 |
|
| 357 |
-
function
|
| 358 |
-
const pd = _el["plain"];
|
| 359 |
-
if (!pd) return;
|
| 360 |
-
pd.style.display = _plain ? "block" : "none";
|
| 361 |
-
if (!_plain) return;
|
| 362 |
const tokens = S.tokens != null ? String(S.tokens) : "loading\u2026";
|
| 363 |
const experts = S.experts != null ? String(S.experts) : "loading\u2026";
|
| 364 |
const topk = S.topk != null ? String(S.topk) : "loading\u2026";
|
| 365 |
const cv = S.loadCV != null ? S.loadCV.toFixed(3) : "loading\u2026";
|
| 366 |
-
|
| 367 |
"<b>What this means:</b> A Mixture-of-Experts (MoE) layer has many small \u2018expert\u2019 " +
|
| 368 |
"sub-networks, but only sends each token to a handful of them (here: top-<b>" + topk +
|
| 369 |
"</b> out of <b>" + experts + "</b> experts) \u2014 this is what makes MoE models cheap to " +
|
|
@@ -377,7 +308,7 @@ function _applyPlain() {
|
|
| 377 |
"= some experts are getting hammered while others sit idle). " +
|
| 378 |
"Plain: this is a toy, fully-deterministic stand-in for the router-fairness problem " +
|
| 379 |
"real MoE systems have to solve \u2014 it is a <b>MODELED</b> simulation, not a trained " +
|
| 380 |
-
"MoE and not a benchmark of any named production model.";
|
| 381 |
}
|
| 382 |
|
| 383 |
function _tok(s) {
|
|
@@ -404,7 +335,7 @@ function _paintOverlay() {
|
|
| 404 |
}
|
| 405 |
// honesty label verbatim — never upgraded
|
| 406 |
_set("moe-label", t || (S.label || "MODELED"));
|
| 407 |
-
if (
|
| 408 |
}
|
| 409 |
|
| 410 |
// =============================================================================
|
|
@@ -412,7 +343,7 @@ function _paintOverlay() {
|
|
| 412 |
// =============================================================================
|
| 413 |
export function unmount() {
|
| 414 |
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 415 |
-
try { if (
|
| 416 |
try {
|
| 417 |
if (_group && _stage) {
|
| 418 |
_group.traverse((o) => {
|
|
@@ -426,9 +357,9 @@ export function unmount() {
|
|
| 426 |
}
|
| 427 |
} catch (_) {}
|
| 428 |
if (_barGeo && _barGeo.dispose) { try { _barGeo.dispose(); } catch (_) {} }
|
| 429 |
-
_group =
|
| 430 |
_bars = []; _barGeo = null; _floor = null; _labelGroup = null;
|
| 431 |
-
_el = {}; _badge = null;
|
| 432 |
_stage = _THREE = _ctx = null;
|
| 433 |
S.label = S.tokens = S.experts = S.topk = null;
|
| 434 |
S.routingTable = S.loadCounts = S.loadCV = null;
|
|
|
|
| 46 |
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 47 |
// Nothing here is in the locked-8. Λ stays Conjecture 1. Trust never 100%.
|
| 48 |
|
| 49 |
+
import { createShowcase } from "./_showcase.js";
|
| 50 |
+
|
| 51 |
const ID = "moe";
|
| 52 |
const TITLE = "MoE Sparse-Upcycling Router Simulator (live)";
|
| 53 |
|
|
|
|
| 68 |
const CELL_Z = 1.3; // world-units per routing round row
|
| 69 |
const MAX_BAR_H = 5.0; // world-units of max bar height (cumulative load axis)
|
| 70 |
|
| 71 |
+
let _stage = null, _THREE = null, _ctx = null, _group = null, _show = null;
|
| 72 |
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
|
|
|
| 73 |
|
| 74 |
// geometry handles
|
| 75 |
let _floor = null;
|
|
|
|
| 261 |
// =============================================================================
|
| 262 |
function _buildOverlay() {
|
| 263 |
const ctx = _ctx;
|
| 264 |
+
_show = createShowcase(ctx, {
|
| 265 |
+
id: ID, title: TITLE, accent: "#5b8dee",
|
| 266 |
+
badge: _badge,
|
| 267 |
+
chips: [{ label: "MODELED", text: "router load", name: "moe" }],
|
| 268 |
+
legend: ["MODELED", "SAMPLE"],
|
| 269 |
+
description:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 270 |
'A <b>top-K softmax router</b> dispatches each synthetic token to its highest-weight ' +
|
| 271 |
'experts. The heat-surface shows <b>cumulative expert load</b> building up across ' +
|
| 272 |
'routing rounds (X = expert, Z = round, Y = cumulative load). <b style="color:#5b8dee">Blue</b> ' +
|
| 273 |
'peaks are <b>under-loaded</b> experts (below mean); <b style="color:#3af4c8">teal</b> peaks are ' +
|
| 274 |
'<b>balanced/at-or-above-mean</b>. Honesty label <b>MODELED</b> (deterministic router ' +
|
| 275 |
'simulation — no trained MoE, never claimed as DeepSeekMoE/Gemma-MoE/any production ' +
|
| 276 |
+
'router). 0 runtime CDN.',
|
| 277 |
+
citations:
|
| 278 |
+
"Komatsuzaki et al. arXiv:2212.05055 (Sparse Upcycling) \u00b7 Dai et al. arXiv:2401.06066 (DeepSeekMoE) \u00b7 github.com/amazon-science/expert-upcycling (Expert Upcycling). MODELED \u00b7 not claimed-as.",
|
| 279 |
+
plain: { html: _plainHtml },
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 280 |
});
|
|
|
|
| 281 |
|
| 282 |
+
_el["moe-tokens"] = _show.addField("tokens routed");
|
| 283 |
+
_el["moe-experts"] = _show.addField("experts N");
|
| 284 |
+
_el["moe-topk"] = _show.addField("top-K per token");
|
| 285 |
+
_el["moe-cv"] = _show.addField("load_balance_cv");
|
| 286 |
+
_el["moe-minmax"] = _show.addField("min / max expert load");
|
| 287 |
+
_el["moe-label"] = _show.addField("honesty label");
|
| 288 |
|
|
|
|
| 289 |
_paintOverlay();
|
| 290 |
}
|
| 291 |
|
| 292 |
+
function _plainHtml() {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 293 |
const tokens = S.tokens != null ? String(S.tokens) : "loading\u2026";
|
| 294 |
const experts = S.experts != null ? String(S.experts) : "loading\u2026";
|
| 295 |
const topk = S.topk != null ? String(S.topk) : "loading\u2026";
|
| 296 |
const cv = S.loadCV != null ? S.loadCV.toFixed(3) : "loading\u2026";
|
| 297 |
+
return (
|
| 298 |
"<b>What this means:</b> A Mixture-of-Experts (MoE) layer has many small \u2018expert\u2019 " +
|
| 299 |
"sub-networks, but only sends each token to a handful of them (here: top-<b>" + topk +
|
| 300 |
"</b> out of <b>" + experts + "</b> experts) \u2014 this is what makes MoE models cheap to " +
|
|
|
|
| 308 |
"= some experts are getting hammered while others sit idle). " +
|
| 309 |
"Plain: this is a toy, fully-deterministic stand-in for the router-fairness problem " +
|
| 310 |
"real MoE systems have to solve \u2014 it is a <b>MODELED</b> simulation, not a trained " +
|
| 311 |
+
"MoE and not a benchmark of any named production model.");
|
| 312 |
}
|
| 313 |
|
| 314 |
function _tok(s) {
|
|
|
|
| 335 |
}
|
| 336 |
// honesty label verbatim — never upgraded
|
| 337 |
_set("moe-label", t || (S.label || "MODELED"));
|
| 338 |
+
if (_show) { _show.setChip("moe", S.label || "MODELED", { text: "router load" }); _show.refreshPlain(); }
|
| 339 |
}
|
| 340 |
|
| 341 |
// =============================================================================
|
|
|
|
| 343 |
// =============================================================================
|
| 344 |
export function unmount() {
|
| 345 |
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 346 |
+
try { if (_show) _show.destroy(); } catch (_) {}
|
| 347 |
try {
|
| 348 |
if (_group && _stage) {
|
| 349 |
_group.traverse((o) => {
|
|
|
|
| 357 |
}
|
| 358 |
} catch (_) {}
|
| 359 |
if (_barGeo && _barGeo.dispose) { try { _barGeo.dispose(); } catch (_) {} }
|
| 360 |
+
_group = _show = null;
|
| 361 |
_bars = []; _barGeo = null; _floor = null; _labelGroup = null;
|
| 362 |
+
_el = {}; _badge = null; _frameReg = false;
|
| 363 |
_stage = _THREE = _ctx = null;
|
| 364 |
S.label = S.tokens = S.experts = S.topk = null;
|
| 365 |
S.routingTable = S.loadCounts = S.loadCV = null;
|
static/3d/surfaces/mor.js
CHANGED
|
@@ -43,6 +43,8 @@
|
|
| 43 |
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 44 |
// Nothing here is in the locked-8. Λ stays Conjecture 1. Trust never 100%.
|
| 45 |
|
|
|
|
|
|
|
| 46 |
const ID = "mor";
|
| 47 |
const TITLE = "Mixture-of-Recursions · Adaptive Per-Token Depth (live)";
|
| 48 |
|
|
@@ -65,9 +67,8 @@ const ROWS = 16; // heatmap rows (COLS*ROWS = 256 = default token coun
|
|
| 65 |
const CELL = 0.62; // world-units between heatmap cells
|
| 66 |
const MAX_CELLS = COLS * ROWS;
|
| 67 |
|
| 68 |
-
let _stage = null, _THREE = null, _ctx = null, _group = null,
|
| 69 |
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
| 70 |
-
let _plain = false;
|
| 71 |
|
| 72 |
// geometry handles
|
| 73 |
let _floor = null;
|
|
@@ -308,122 +309,47 @@ function _onFrame() {
|
|
| 308 |
// =============================================================================
|
| 309 |
function _buildOverlay() {
|
| 310 |
const ctx = _ctx;
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
color: "#eef3f6",
|
| 318 |
-
});
|
| 319 |
-
|
| 320 |
-
const h = document.createElement("div");
|
| 321 |
-
h.style.cssText = "font:600 13px ui-sans-serif,system-ui;letter-spacing:.4px";
|
| 322 |
-
h.textContent = TITLE;
|
| 323 |
-
_overlay.appendChild(h);
|
| 324 |
-
|
| 325 |
-
const sub = document.createElement("div");
|
| 326 |
-
sub.style.cssText = "color:#9fb1bf;font-size:11px;line-height:1.55";
|
| 327 |
-
sub.innerHTML =
|
| 328 |
'ONE shared transformer block is applied a <b>variable number of times per token</b>: a lightweight ' +
|
| 329 |
'router gives each token a recursion <b>depth</b> (1…N loops of the <i>same</i> weights). ' +
|
| 330 |
'Easy tokens exit early; hard tokens recurse deeper. Cells below are coloured by depth ' +
|
| 331 |
'(blue = shallow → teal = deep); height = compute spent. ' +
|
| 332 |
-
'Honesty label <b>MODELED</b> (deterministic depth-routing simulation; NOT the MoR model). 0 runtime CDN.'
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
// explicit router-vs-mor distinction banner
|
| 336 |
-
const dist = document.createElement("div");
|
| 337 |
-
dist.style.cssText = "font-size:10.5px;color:#c9d6df;line-height:1.5;border:1px solid #26333f;border-radius:7px;padding:7px 9px;background:#0a1117";
|
| 338 |
-
dist.innerHTML =
|
| 339 |
'<b style="color:#3af4c8">Not the ‘router’ organ.</b> ' +
|
| 340 |
'The <b>router</b> organ is parameter <b>SELECTION</b> — it dispatches each token to one of several ' +
|
| 341 |
'<i>different, independently-parameterized</i> models/experts (<i>which</i> weights). ' +
|
| 342 |
'<b>Mixture-of-Recursions</b> is parameter <b>REUSE</b> — it loops <i>one</i> shared block a variable ' +
|
| 343 |
-
'number of times per token (<i>how many times</i> the same weights). One weight set here; only the depth changes.'
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
brow.style.cssText = "display:flex;gap:8px;align-items:center;flex-wrap:wrap";
|
| 348 |
-
if (_badge && _badge.el) brow.appendChild(_badge.el);
|
| 349 |
-
_overlay.appendChild(brow);
|
| 350 |
-
|
| 351 |
-
const card = document.createElement("div");
|
| 352 |
-
card.style.cssText = "background:#0a1117;border:1px solid #1d2a36;border-radius:9px;padding:9px 10px;display:flex;flex-direction:column;gap:6px";
|
| 353 |
-
|
| 354 |
-
const chead = document.createElement("div");
|
| 355 |
-
chead.style.cssText = "display:flex;align-items:center;gap:8px;flex-wrap:wrap";
|
| 356 |
-
const dot = document.createElement("span");
|
| 357 |
-
dot.style.cssText = "width:9px;height:9px;border-radius:50%;background:#3af4c8;box-shadow:0 0 7px #3af4c8";
|
| 358 |
-
const nm = document.createElement("b");
|
| 359 |
-
nm.style.cssText = "font-size:12px;color:#3af4c8;letter-spacing:.3px";
|
| 360 |
-
nm.textContent = "mixture-of-recursions";
|
| 361 |
-
chead.appendChild(dot); chead.appendChild(nm);
|
| 362 |
-
card.appendChild(chead);
|
| 363 |
-
|
| 364 |
-
const grid = document.createElement("div");
|
| 365 |
-
grid.style.cssText = "display:grid;grid-template-columns:1fr;gap:4px";
|
| 366 |
-
|
| 367 |
-
function kpiRow(id, label) {
|
| 368 |
-
const r = document.createElement("div");
|
| 369 |
-
r.style.cssText = "display:flex;justify-content:space-between;gap:10px;font-size:11px";
|
| 370 |
-
const l = document.createElement("span"); l.style.cssText = "color:#9fb1bf"; l.textContent = label;
|
| 371 |
-
const v = document.createElement("b");
|
| 372 |
-
v.id = id;
|
| 373 |
-
v.style.cssText = "font-variant-numeric:tabular-nums;color:#eef3f6;text-align:right;max-width:58%";
|
| 374 |
-
v.textContent = "\u2014";
|
| 375 |
-
_el[id] = v;
|
| 376 |
-
r.appendChild(l); r.appendChild(v); return r;
|
| 377 |
-
}
|
| 378 |
-
|
| 379 |
-
grid.appendChild(kpiRow("mor-tokens", "tokens routed"));
|
| 380 |
-
grid.appendChild(kpiRow("mor-maxdepth", "max_depth (loops of ONE block)"));
|
| 381 |
-
grid.appendChild(kpiRow("mor-meandepth","mean recursion depth"));
|
| 382 |
-
grid.appendChild(kpiRow("mor-saved", "compute_saved vs fixed-depth \u2014 MODELED"));
|
| 383 |
-
grid.appendChild(kpiRow("mor-speedup", "speedup_vs_fixed \u2014 MODELED"));
|
| 384 |
-
grid.appendChild(kpiRow("mor-kv", "KV-cache footprint vs uniform"));
|
| 385 |
-
grid.appendChild(kpiRow("mor-quality", "quality_retained (proxy)"));
|
| 386 |
-
grid.appendChild(kpiRow("mor-shared", "shared block? (parameter REUSE)"));
|
| 387 |
-
grid.appendChild(kpiRow("mor-label", "honesty label"));
|
| 388 |
-
card.appendChild(grid);
|
| 389 |
-
|
| 390 |
-
const fn = document.createElement("div");
|
| 391 |
-
fn.style.cssText = "font-size:9.5px;color:#6b7a86;line-height:1.5";
|
| 392 |
-
fn.textContent = "Bae et al. arXiv:2507.10524 (Mixture-of-Recursions) \u00b7 github.com/raymin0223/mixture_of_recursions. MODELED \u00b7 not claimed-as.";
|
| 393 |
-
card.appendChild(fn);
|
| 394 |
-
_overlay.appendChild(card);
|
| 395 |
-
|
| 396 |
-
const pl = document.createElement("button");
|
| 397 |
-
pl.textContent = "\u25d1 what this means";
|
| 398 |
-
pl.title = "Toggle plain-language explanation for investors & consumers.";
|
| 399 |
-
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";
|
| 400 |
-
pl.addEventListener("click", () => {
|
| 401 |
-
_plain = !_plain;
|
| 402 |
-
pl.style.background = _plain ? "#0f2a20" : "#08140f";
|
| 403 |
-
_applyPlain();
|
| 404 |
});
|
| 405 |
-
_overlay.appendChild(pl);
|
| 406 |
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
_el["
|
| 411 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 412 |
|
| 413 |
-
(ctx.container || document.body).appendChild(_overlay);
|
| 414 |
_paintOverlay();
|
| 415 |
}
|
| 416 |
|
| 417 |
-
function
|
| 418 |
-
const pd = _el["plain"];
|
| 419 |
-
if (!pd) return;
|
| 420 |
-
pd.style.display = _plain ? "block" : "none";
|
| 421 |
-
if (!_plain) return;
|
| 422 |
const md = S.maxDepth != null ? String(S.maxDepth) : "loading\u2026";
|
| 423 |
const mean = S.meanDepth != null ? S.meanDepth.toFixed(2) : "loading\u2026";
|
| 424 |
const savedPc = S.savedFrac != null ? (S.savedFrac * 100).toFixed(1) + "%" : "loading\u2026";
|
| 425 |
const spd = S.speedup != null ? S.speedup.toFixed(2) + "\u00d7" : "loading\u2026";
|
| 426 |
-
|
| 427 |
"<b>What this means:</b> A normal model runs every word through the <i>same</i> amount of work. " +
|
| 428 |
"Mixture-of-Recursions reuses <b>one</b> block of the model and simply <b>loops it more times " +
|
| 429 |
"for hard words and fewer times for easy words</b> (up to <b>" + md + "</b> loops). On average each " +
|
|
@@ -432,7 +358,7 @@ function _applyPlain() {
|
|
| 432 |
"because only the genuinely hard words get the deep treatment. " +
|
| 433 |
"<b>Key difference from a ‘router’:</b> a router picks <i>which</i> of several different " +
|
| 434 |
"models to use; MoR reuses <i>one</i> model and only changes <i>how many times</i> it runs. " +
|
| 435 |
-
"This view is a <b>MODELED</b> simulation of the depth-routing math, not a run of the real MoR model.";
|
| 436 |
}
|
| 437 |
|
| 438 |
function _tok(s) {
|
|
@@ -459,7 +385,7 @@ function _paintOverlay() {
|
|
| 459 |
_set("mor-shared", t || (S.sharedBlock === true ? "yes (ONE reused block)" : S.sharedBlock === false ? "no" : "\u2014"));
|
| 460 |
// honesty label verbatim — never upgraded
|
| 461 |
_set("mor-label", t || (S.label || "MODELED"));
|
| 462 |
-
if (
|
| 463 |
}
|
| 464 |
|
| 465 |
// =============================================================================
|
|
@@ -467,7 +393,7 @@ function _paintOverlay() {
|
|
| 467 |
// =============================================================================
|
| 468 |
export function unmount() {
|
| 469 |
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 470 |
-
try { if (
|
| 471 |
try {
|
| 472 |
if (_group && _stage) {
|
| 473 |
_group.traverse((o) => {
|
|
@@ -480,9 +406,9 @@ export function unmount() {
|
|
| 480 |
_stage.scene.remove(_group);
|
| 481 |
}
|
| 482 |
} catch (_) {}
|
| 483 |
-
_group =
|
| 484 |
_floor = null; _cellMesh = []; _column = null; _colBars = []; _marker = null;
|
| 485 |
-
_el = {}; _badge = null;
|
| 486 |
_stage = _THREE = _ctx = null;
|
| 487 |
S.label = S.tokens = S.maxDepth = S.threshold = null;
|
| 488 |
S.perToken = S.histogram = S.meanDepth = S.savedFrac = null;
|
|
|
|
| 43 |
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 44 |
// Nothing here is in the locked-8. Λ stays Conjecture 1. Trust never 100%.
|
| 45 |
|
| 46 |
+
import { createShowcase } from "./_showcase.js";
|
| 47 |
+
|
| 48 |
const ID = "mor";
|
| 49 |
const TITLE = "Mixture-of-Recursions · Adaptive Per-Token Depth (live)";
|
| 50 |
|
|
|
|
| 67 |
const CELL = 0.62; // world-units between heatmap cells
|
| 68 |
const MAX_CELLS = COLS * ROWS;
|
| 69 |
|
| 70 |
+
let _stage = null, _THREE = null, _ctx = null, _group = null, _show = null;
|
| 71 |
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
|
|
|
| 72 |
|
| 73 |
// geometry handles
|
| 74 |
let _floor = null;
|
|
|
|
| 309 |
// =============================================================================
|
| 310 |
function _buildOverlay() {
|
| 311 |
const ctx = _ctx;
|
| 312 |
+
_show = createShowcase(ctx, {
|
| 313 |
+
id: ID, title: TITLE, accent: "#5b8dee",
|
| 314 |
+
badge: _badge,
|
| 315 |
+
chips: [{ label: "MODELED", text: "adaptive depth", name: "mor" }],
|
| 316 |
+
legend: ["MODELED", "SAMPLE"],
|
| 317 |
+
description:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 318 |
'ONE shared transformer block is applied a <b>variable number of times per token</b>: a lightweight ' +
|
| 319 |
'router gives each token a recursion <b>depth</b> (1…N loops of the <i>same</i> weights). ' +
|
| 320 |
'Easy tokens exit early; hard tokens recurse deeper. Cells below are coloured by depth ' +
|
| 321 |
'(blue = shallow → teal = deep); height = compute spent. ' +
|
| 322 |
+
'Honesty label <b>MODELED</b> (deterministic depth-routing simulation; NOT the MoR model). 0 runtime CDN.' +
|
| 323 |
+
'<br><br>' +
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 324 |
'<b style="color:#3af4c8">Not the ‘router’ organ.</b> ' +
|
| 325 |
'The <b>router</b> organ is parameter <b>SELECTION</b> — it dispatches each token to one of several ' +
|
| 326 |
'<i>different, independently-parameterized</i> models/experts (<i>which</i> weights). ' +
|
| 327 |
'<b>Mixture-of-Recursions</b> is parameter <b>REUSE</b> — it loops <i>one</i> shared block a variable ' +
|
| 328 |
+
'number of times per token (<i>how many times</i> the same weights). One weight set here; only the depth changes.',
|
| 329 |
+
citations:
|
| 330 |
+
"Bae et al. arXiv:2507.10524 (Mixture-of-Recursions) \u00b7 github.com/raymin0223/mixture_of_recursions. MODELED \u00b7 not claimed-as.",
|
| 331 |
+
plain: { html: _plainHtml },
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 332 |
});
|
|
|
|
| 333 |
|
| 334 |
+
_el["mor-tokens"] = _show.addField("tokens routed");
|
| 335 |
+
_el["mor-maxdepth"] = _show.addField("max_depth (loops of ONE block)");
|
| 336 |
+
_el["mor-meandepth"] = _show.addField("mean recursion depth");
|
| 337 |
+
_el["mor-saved"] = _show.addField("compute_saved vs fixed-depth \u2014 MODELED");
|
| 338 |
+
_el["mor-speedup"] = _show.addField("speedup_vs_fixed \u2014 MODELED");
|
| 339 |
+
_el["mor-kv"] = _show.addField("KV-cache footprint vs uniform");
|
| 340 |
+
_el["mor-quality"] = _show.addField("quality_retained (proxy)");
|
| 341 |
+
_el["mor-shared"] = _show.addField("shared block? (parameter REUSE)");
|
| 342 |
+
_el["mor-label"] = _show.addField("honesty label");
|
| 343 |
|
|
|
|
| 344 |
_paintOverlay();
|
| 345 |
}
|
| 346 |
|
| 347 |
+
function _plainHtml() {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 348 |
const md = S.maxDepth != null ? String(S.maxDepth) : "loading\u2026";
|
| 349 |
const mean = S.meanDepth != null ? S.meanDepth.toFixed(2) : "loading\u2026";
|
| 350 |
const savedPc = S.savedFrac != null ? (S.savedFrac * 100).toFixed(1) + "%" : "loading\u2026";
|
| 351 |
const spd = S.speedup != null ? S.speedup.toFixed(2) + "\u00d7" : "loading\u2026";
|
| 352 |
+
return (
|
| 353 |
"<b>What this means:</b> A normal model runs every word through the <i>same</i> amount of work. " +
|
| 354 |
"Mixture-of-Recursions reuses <b>one</b> block of the model and simply <b>loops it more times " +
|
| 355 |
"for hard words and fewer times for easy words</b> (up to <b>" + md + "</b> loops). On average each " +
|
|
|
|
| 358 |
"because only the genuinely hard words get the deep treatment. " +
|
| 359 |
"<b>Key difference from a ‘router’:</b> a router picks <i>which</i> of several different " +
|
| 360 |
"models to use; MoR reuses <i>one</i> model and only changes <i>how many times</i> it runs. " +
|
| 361 |
+
"This view is a <b>MODELED</b> simulation of the depth-routing math, not a run of the real MoR model.");
|
| 362 |
}
|
| 363 |
|
| 364 |
function _tok(s) {
|
|
|
|
| 385 |
_set("mor-shared", t || (S.sharedBlock === true ? "yes (ONE reused block)" : S.sharedBlock === false ? "no" : "\u2014"));
|
| 386 |
// honesty label verbatim — never upgraded
|
| 387 |
_set("mor-label", t || (S.label || "MODELED"));
|
| 388 |
+
if (_show) { _show.setChip("mor", S.label || "MODELED", { text: "adaptive depth" }); _show.refreshPlain(); }
|
| 389 |
}
|
| 390 |
|
| 391 |
// =============================================================================
|
|
|
|
| 393 |
// =============================================================================
|
| 394 |
export function unmount() {
|
| 395 |
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 396 |
+
try { if (_show) _show.destroy(); } catch (_) {}
|
| 397 |
try {
|
| 398 |
if (_group && _stage) {
|
| 399 |
_group.traverse((o) => {
|
|
|
|
| 406 |
_stage.scene.remove(_group);
|
| 407 |
}
|
| 408 |
} catch (_) {}
|
| 409 |
+
_group = _show = null;
|
| 410 |
_floor = null; _cellMesh = []; _column = null; _colBars = []; _marker = null;
|
| 411 |
+
_el = {}; _badge = null; _frameReg = false;
|
| 412 |
_stage = _THREE = _ctx = null;
|
| 413 |
S.label = S.tokens = S.maxDepth = S.threshold = null;
|
| 414 |
S.perToken = S.histogram = S.meanDepth = S.savedFrac = null;
|
static/3d/surfaces/muon.js
CHANGED
|
@@ -43,6 +43,8 @@
|
|
| 43 |
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 44 |
// Nothing here is in the locked-8. Λ stays Conjecture 1. Trust never 100%.
|
| 45 |
|
|
|
|
|
|
|
| 46 |
const ID = "muon";
|
| 47 |
const TITLE = "Muon Orthogonalized-Momentum Optimizer";
|
| 48 |
|
|
@@ -68,9 +70,8 @@ const HEAT_GAP = 0.17; // heatmap cell pitch
|
|
| 68 |
const HEAT_MAX = 24; // cap cells per axis rendered (perf)
|
| 69 |
const BAR_W = 0.9; // condition-number bar width
|
| 70 |
|
| 71 |
-
let _stage = null, _THREE = null, _ctx = null, _group = null,
|
| 72 |
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
| 73 |
-
let _plain = false;
|
| 74 |
|
| 75 |
// geometry handles
|
| 76 |
let _floor = null;
|
|
@@ -379,115 +380,45 @@ function _onFrame() {
|
|
| 379 |
// =============================================================================
|
| 380 |
function _buildOverlay() {
|
| 381 |
const ctx = _ctx;
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
color: "#eef3f6",
|
| 389 |
-
});
|
| 390 |
-
|
| 391 |
-
const h = document.createElement("div");
|
| 392 |
-
h.style.cssText = "font:600 13px ui-sans-serif,system-ui;letter-spacing:.4px";
|
| 393 |
-
h.textContent = TITLE;
|
| 394 |
-
_overlay.appendChild(h);
|
| 395 |
-
|
| 396 |
-
const sub = document.createElement("div");
|
| 397 |
-
sub.style.cssText = "color:#9fb1bf;font-size:11px;line-height:1.55";
|
| 398 |
-
sub.innerHTML =
|
| 399 |
'Muon (\u201cMomentUm Orthogonalized by Newton\u2013Schulz\u201d) replaces a momentum update matrix ' +
|
| 400 |
'with the nearest <b>semi-orthogonal</b> matrix (UV\u1d40 from its SVD) via a hand-tuned <b>quintic ' +
|
| 401 |
'Newton\u2013Schulz</b> recurrence X<sub>k+1</sub> = a\u00b7X + b\u00b7(XX\u1d40)X + c\u00b7(XX\u1d40)\u00b2X ' +
|
| 402 |
'(a=3.4445, b=\u22124.7750, c=2.0315). This <b>flattens the singular-value spectrum</b> toward the ' +
|
| 403 |
'non-convergent <b>[0.68, 1.13]</b> band so no direction dominates the step. Panels: singular-value ' +
|
| 404 |
'trajectory, before/after matrix heatmap, condition-number bars (raw vs orthogonalized). Honesty label ' +
|
| 405 |
-
'<b>MODELED</b> (deterministic mechanism reproduction on a toy matrix; trains nothing). 0 runtime CDN.'
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
brow.style.cssText = "display:flex;gap:8px;align-items:center;flex-wrap:wrap";
|
| 410 |
-
if (_badge && _badge.el) brow.appendChild(_badge.el);
|
| 411 |
-
_overlay.appendChild(brow);
|
| 412 |
-
|
| 413 |
-
const card = document.createElement("div");
|
| 414 |
-
card.style.cssText = "background:#0a1117;border:1px solid #1d2a36;border-radius:9px;padding:9px 10px;display:flex;flex-direction:column;gap:6px";
|
| 415 |
-
|
| 416 |
-
const chead = document.createElement("div");
|
| 417 |
-
chead.style.cssText = "display:flex;align-items:center;gap:8px;flex-wrap:wrap";
|
| 418 |
-
const dot = document.createElement("span");
|
| 419 |
-
dot.style.cssText = "width:9px;height:9px;border-radius:50%;background:#3af4c8;box-shadow:0 0 7px #3af4c8";
|
| 420 |
-
const nm = document.createElement("b");
|
| 421 |
-
nm.style.cssText = "font-size:12px;color:#3af4c8;letter-spacing:.3px";
|
| 422 |
-
nm.textContent = "muon orthogonalized-momentum optimizer";
|
| 423 |
-
chead.appendChild(dot); chead.appendChild(nm);
|
| 424 |
-
card.appendChild(chead);
|
| 425 |
-
|
| 426 |
-
const grid = document.createElement("div");
|
| 427 |
-
grid.style.cssText = "display:grid;grid-template-columns:1fr;gap:4px";
|
| 428 |
-
|
| 429 |
-
function kpiRow(id, label) {
|
| 430 |
-
const r = document.createElement("div");
|
| 431 |
-
r.style.cssText = "display:flex;justify-content:space-between;gap:10px;font-size:11px";
|
| 432 |
-
const l = document.createElement("span"); l.style.cssText = "color:#9fb1bf"; l.textContent = label;
|
| 433 |
-
const v = document.createElement("b");
|
| 434 |
-
v.id = id;
|
| 435 |
-
v.style.cssText = "font-variant-numeric:tabular-nums;color:#eef3f6;text-align:right;max-width:56%";
|
| 436 |
-
v.textContent = "\u2014";
|
| 437 |
-
_el[id] = v;
|
| 438 |
-
r.appendChild(l); r.appendChild(v); return r;
|
| 439 |
-
}
|
| 440 |
-
|
| 441 |
-
grid.appendChild(kpiRow("mu-dims", "momentum matrix (m \u00d7 n)"));
|
| 442 |
-
grid.appendChild(kpiRow("mu-ns", "Newton\u2013Schulz iterations"));
|
| 443 |
-
grid.appendChild(kpiRow("mu-coeffs", "quintic coefficients (a / b / c)"));
|
| 444 |
-
grid.appendChild(kpiRow("mu-rank", "singular values tracked (rank)"));
|
| 445 |
-
grid.appendChild(kpiRow("mu-condr", "condition \u03ba \u2014 RAW"));
|
| 446 |
-
grid.appendChild(kpiRow("mu-condo", "condition \u03ba \u2014 ORTHOGONALIZED"));
|
| 447 |
-
grid.appendChild(kpiRow("mu-condi", "spectral-flattening factor"));
|
| 448 |
-
grid.appendChild(kpiRow("mu-band", "convergence band"));
|
| 449 |
-
grid.appendChild(kpiRow("mu-frac", "final \u03c3 inside band (MEASURED)"));
|
| 450 |
-
grid.appendChild(kpiRow("mu-svrange","final \u03c3 range (min \u2192 max)"));
|
| 451 |
-
grid.appendChild(kpiRow("mu-label", "honesty label"));
|
| 452 |
-
card.appendChild(grid);
|
| 453 |
-
|
| 454 |
-
const fn = document.createElement("div");
|
| 455 |
-
fn.style.cssText = "font-size:9.5px;color:#6b7a86;line-height:1.5";
|
| 456 |
-
fn.textContent = "Muon \u2014 Keller Jordan et al. (kellerjordan.github.io/posts/muon) \u00b7 Moonshot AI \u201cMuon is Scalable for LLM Training\u201d arXiv:2502.16982 \u00b7 github.com/KellerJordan/Muon. MODELED \u00b7 Newton\u2013Schulz demo, not a trained model.";
|
| 457 |
-
card.appendChild(fn);
|
| 458 |
-
_overlay.appendChild(card);
|
| 459 |
-
|
| 460 |
-
const pl = document.createElement("button");
|
| 461 |
-
pl.textContent = "\u25d1 what this means";
|
| 462 |
-
pl.title = "Toggle plain-language explanation for investors & consumers.";
|
| 463 |
-
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";
|
| 464 |
-
pl.addEventListener("click", () => {
|
| 465 |
-
_plain = !_plain;
|
| 466 |
-
pl.style.background = _plain ? "#0f2a20" : "#08140f";
|
| 467 |
-
_applyPlain();
|
| 468 |
});
|
| 469 |
-
_overlay.appendChild(pl);
|
| 470 |
|
| 471 |
-
|
| 472 |
-
|
| 473 |
-
|
| 474 |
-
_el["
|
| 475 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 476 |
|
| 477 |
-
(ctx.container || document.body).appendChild(_overlay);
|
| 478 |
_paintOverlay();
|
| 479 |
}
|
| 480 |
|
| 481 |
-
function
|
| 482 |
-
const pd = _el["plain"];
|
| 483 |
-
if (!pd) return;
|
| 484 |
-
pd.style.display = _plain ? "block" : "none";
|
| 485 |
-
if (!_plain) return;
|
| 486 |
const cr = S.condRaw != null ? S.condRaw.toFixed(1) : "loading\u2026";
|
| 487 |
const co = S.condOrtho != null ? S.condOrtho.toFixed(2) : "loading\u2026";
|
| 488 |
const imp = S.condImp != null ? S.condImp.toFixed(1) + "\u00d7" : "loading\u2026";
|
| 489 |
const frac = S.fracInBand != null ? (S.fracInBand * 100).toFixed(0) + "%" : "loading\u2026";
|
| 490 |
-
|
| 491 |
"<b>What this means:</b> When a model learns, each update is a grid of numbers (a \u201cmatrix\u201d). Some " +
|
| 492 |
"directions in that grid can be far bigger than others, so the step lurches. Muon first <b>rebalances</b> " +
|
| 493 |
"the update so every direction has roughly equal weight \u2014 like normalizing the volume across a mixing " +
|
|
@@ -498,7 +429,7 @@ function _applyPlain() {
|
|
| 498 |
"<b>0.68\u20131.13</b> range the method aims for. This view is a <b>MODELED</b> deterministic reproduction " +
|
| 499 |
"of that rebalancing MECHANISM on a small synthetic matrix \u2014 it <b>trains no model</b> and runs no GPU " +
|
| 500 |
"kernel. The \u201c\u2248 2\u00d7 faster training vs. AdamW\u201d headline is a <b>claim about real training " +
|
| 501 |
-
"runs</b> (Keller Jordan / Moonshot AI) that the estate does not independently verify.";
|
| 502 |
}
|
| 503 |
|
| 504 |
function _tok(s) {
|
|
@@ -527,7 +458,7 @@ function _paintOverlay() {
|
|
| 527 |
_set("mu-svrange", t || ((S.svMinFinal != null && S.svMaxFinal != null) ? (fx(S.svMinFinal, 3) + " \u2192 " + fx(S.svMaxFinal, 3)) : "\u2014"));
|
| 528 |
// honesty label verbatim — never upgraded
|
| 529 |
_set("mu-label", t || (S.label || "MODELED"));
|
| 530 |
-
if (
|
| 531 |
}
|
| 532 |
|
| 533 |
// =============================================================================
|
|
@@ -535,7 +466,7 @@ function _paintOverlay() {
|
|
| 535 |
// =============================================================================
|
| 536 |
export function unmount() {
|
| 537 |
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 538 |
-
try { if (
|
| 539 |
try {
|
| 540 |
if (_group && _stage) {
|
| 541 |
_group.traverse((o) => {
|
|
@@ -548,12 +479,12 @@ export function unmount() {
|
|
| 548 |
_stage.scene.remove(_group);
|
| 549 |
}
|
| 550 |
} catch (_) {}
|
| 551 |
-
_group =
|
| 552 |
_floor = null;
|
| 553 |
_trajGroup = null;
|
| 554 |
_heatRaw = []; _heatOrtho = []; _heatGroup = null;
|
| 555 |
_barRaw = null; _barOrtho = null; _barGroup = null;
|
| 556 |
-
_el = {}; _badge = null;
|
| 557 |
_stage = _THREE = _ctx = null;
|
| 558 |
S.label = S.m = S.n = S.nsSteps = null;
|
| 559 |
S.coA = S.coB = S.coC = null;
|
|
|
|
| 43 |
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 44 |
// Nothing here is in the locked-8. Λ stays Conjecture 1. Trust never 100%.
|
| 45 |
|
| 46 |
+
import { createShowcase } from "./_showcase.js";
|
| 47 |
+
|
| 48 |
const ID = "muon";
|
| 49 |
const TITLE = "Muon Orthogonalized-Momentum Optimizer";
|
| 50 |
|
|
|
|
| 70 |
const HEAT_MAX = 24; // cap cells per axis rendered (perf)
|
| 71 |
const BAR_W = 0.9; // condition-number bar width
|
| 72 |
|
| 73 |
+
let _stage = null, _THREE = null, _ctx = null, _group = null, _show = null;
|
| 74 |
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
|
|
|
| 75 |
|
| 76 |
// geometry handles
|
| 77 |
let _floor = null;
|
|
|
|
| 380 |
// =============================================================================
|
| 381 |
function _buildOverlay() {
|
| 382 |
const ctx = _ctx;
|
| 383 |
+
_show = createShowcase(ctx, {
|
| 384 |
+
id: ID, title: TITLE, accent: "#5b8dee",
|
| 385 |
+
badge: _badge,
|
| 386 |
+
chips: [{ label: "MODELED", text: "orthogonalization", name: "muon" }],
|
| 387 |
+
legend: ["MODELED", "SAMPLE"],
|
| 388 |
+
description:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 389 |
'Muon (\u201cMomentUm Orthogonalized by Newton\u2013Schulz\u201d) replaces a momentum update matrix ' +
|
| 390 |
'with the nearest <b>semi-orthogonal</b> matrix (UV\u1d40 from its SVD) via a hand-tuned <b>quintic ' +
|
| 391 |
'Newton\u2013Schulz</b> recurrence X<sub>k+1</sub> = a\u00b7X + b\u00b7(XX\u1d40)X + c\u00b7(XX\u1d40)\u00b2X ' +
|
| 392 |
'(a=3.4445, b=\u22124.7750, c=2.0315). This <b>flattens the singular-value spectrum</b> toward the ' +
|
| 393 |
'non-convergent <b>[0.68, 1.13]</b> band so no direction dominates the step. Panels: singular-value ' +
|
| 394 |
'trajectory, before/after matrix heatmap, condition-number bars (raw vs orthogonalized). Honesty label ' +
|
| 395 |
+
'<b>MODELED</b> (deterministic mechanism reproduction on a toy matrix; trains nothing). 0 runtime CDN.',
|
| 396 |
+
citations:
|
| 397 |
+
"Muon \u2014 Keller Jordan et al. (kellerjordan.github.io/posts/muon) \u00b7 Moonshot AI \u201cMuon is Scalable for LLM Training\u201d arXiv:2502.16982 \u00b7 github.com/KellerJordan/Muon. MODELED \u00b7 Newton\u2013Schulz demo, not a trained model.",
|
| 398 |
+
plain: { html: _plainHtml },
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 399 |
});
|
|
|
|
| 400 |
|
| 401 |
+
_el["mu-dims"] = _show.addField("momentum matrix (m \u00d7 n)");
|
| 402 |
+
_el["mu-ns"] = _show.addField("Newton\u2013Schulz iterations");
|
| 403 |
+
_el["mu-coeffs"] = _show.addField("quintic coefficients (a / b / c)");
|
| 404 |
+
_el["mu-rank"] = _show.addField("singular values tracked (rank)");
|
| 405 |
+
_el["mu-condr"] = _show.addField("condition \u03ba \u2014 RAW");
|
| 406 |
+
_el["mu-condo"] = _show.addField("condition \u03ba \u2014 ORTHOGONALIZED");
|
| 407 |
+
_el["mu-condi"] = _show.addField("spectral-flattening factor");
|
| 408 |
+
_el["mu-band"] = _show.addField("convergence band");
|
| 409 |
+
_el["mu-frac"] = _show.addField("final \u03c3 inside band (MEASURED)");
|
| 410 |
+
_el["mu-svrange"] = _show.addField("final \u03c3 range (min \u2192 max)");
|
| 411 |
+
_el["mu-label"] = _show.addField("honesty label");
|
| 412 |
|
|
|
|
| 413 |
_paintOverlay();
|
| 414 |
}
|
| 415 |
|
| 416 |
+
function _plainHtml() {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 417 |
const cr = S.condRaw != null ? S.condRaw.toFixed(1) : "loading\u2026";
|
| 418 |
const co = S.condOrtho != null ? S.condOrtho.toFixed(2) : "loading\u2026";
|
| 419 |
const imp = S.condImp != null ? S.condImp.toFixed(1) + "\u00d7" : "loading\u2026";
|
| 420 |
const frac = S.fracInBand != null ? (S.fracInBand * 100).toFixed(0) + "%" : "loading\u2026";
|
| 421 |
+
return (
|
| 422 |
"<b>What this means:</b> When a model learns, each update is a grid of numbers (a \u201cmatrix\u201d). Some " +
|
| 423 |
"directions in that grid can be far bigger than others, so the step lurches. Muon first <b>rebalances</b> " +
|
| 424 |
"the update so every direction has roughly equal weight \u2014 like normalizing the volume across a mixing " +
|
|
|
|
| 429 |
"<b>0.68\u20131.13</b> range the method aims for. This view is a <b>MODELED</b> deterministic reproduction " +
|
| 430 |
"of that rebalancing MECHANISM on a small synthetic matrix \u2014 it <b>trains no model</b> and runs no GPU " +
|
| 431 |
"kernel. The \u201c\u2248 2\u00d7 faster training vs. AdamW\u201d headline is a <b>claim about real training " +
|
| 432 |
+
"runs</b> (Keller Jordan / Moonshot AI) that the estate does not independently verify.");
|
| 433 |
}
|
| 434 |
|
| 435 |
function _tok(s) {
|
|
|
|
| 458 |
_set("mu-svrange", t || ((S.svMinFinal != null && S.svMaxFinal != null) ? (fx(S.svMinFinal, 3) + " \u2192 " + fx(S.svMaxFinal, 3)) : "\u2014"));
|
| 459 |
// honesty label verbatim — never upgraded
|
| 460 |
_set("mu-label", t || (S.label || "MODELED"));
|
| 461 |
+
if (_show) { _show.setChip("muon", S.label || "MODELED", { text: "orthogonalization" }); _show.refreshPlain(); }
|
| 462 |
}
|
| 463 |
|
| 464 |
// =============================================================================
|
|
|
|
| 466 |
// =============================================================================
|
| 467 |
export function unmount() {
|
| 468 |
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 469 |
+
try { if (_show) _show.destroy(); } catch (_) {}
|
| 470 |
try {
|
| 471 |
if (_group && _stage) {
|
| 472 |
_group.traverse((o) => {
|
|
|
|
| 479 |
_stage.scene.remove(_group);
|
| 480 |
}
|
| 481 |
} catch (_) {}
|
| 482 |
+
_group = _show = null;
|
| 483 |
_floor = null;
|
| 484 |
_trajGroup = null;
|
| 485 |
_heatRaw = []; _heatOrtho = []; _heatGroup = null;
|
| 486 |
_barRaw = null; _barOrtho = null; _barGroup = null;
|
| 487 |
+
_el = {}; _badge = null; _frameReg = false;
|
| 488 |
_stage = _THREE = _ctx = null;
|
| 489 |
S.label = S.m = S.n = S.nsSteps = null;
|
| 490 |
S.coA = S.coB = S.coC = null;
|
static/3d/surfaces/nested.js
CHANGED
|
@@ -50,6 +50,8 @@
|
|
| 50 |
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 51 |
// Nothing here is in the locked-8. Λ stays Conjecture 1. Trust never 100%.
|
| 52 |
|
|
|
|
|
|
|
| 53 |
const ID = "nested";
|
| 54 |
const TITLE = "Nested Learning · Continuum Memory System (live)";
|
| 55 |
|
|
@@ -73,9 +75,8 @@ const RING_SEG = 64; // ring outline segments
|
|
| 73 |
const MAX_BLOCKS = 96; // cap on forgetting-curve markers rendered
|
| 74 |
const CURVE_SPAN = 12.0; // world-units the forgetting curve spans along X
|
| 75 |
|
| 76 |
-
let _stage = null, _THREE = null, _ctx = null, _group = null,
|
| 77 |
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
| 78 |
-
let _plain = false;
|
| 79 |
|
| 80 |
// geometry handles
|
| 81 |
let _floor = null;
|
|
@@ -352,111 +353,41 @@ function _onFrame() {
|
|
| 352 |
// =============================================================================
|
| 353 |
function _buildOverlay() {
|
| 354 |
const ctx = _ctx;
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
const sub = document.createElement("div");
|
| 370 |
-
sub.style.cssText = "color:#9fb1bf;font-size:11px;line-height:1.55";
|
| 371 |
-
sub.innerHTML =
|
| 372 |
-
'A model as a stack of memory levels updating at <b>different clocks</b> (fast/medium/slow), with ' +
|
| 373 |
-
'the <b>optimizer itself as associative memory</b>. On a toy continual-learning stream, the slow ' +
|
| 374 |
-
'<b>protected core</b> (a surprise-gated timescale) <b>retains earlier tasks</b> where a single-clock ' +
|
| 375 |
-
'baseline overwrites and <b>forgets</b> them. ' +
|
| 376 |
-
'Honesty label <b>MODELED</b> (deterministic scheduling simulation; NOT the Hope architecture). 0 runtime CDN.';
|
| 377 |
-
_overlay.appendChild(sub);
|
| 378 |
-
|
| 379 |
-
const brow = document.createElement("div");
|
| 380 |
-
brow.style.cssText = "display:flex;gap:8px;align-items:center;flex-wrap:wrap";
|
| 381 |
-
if (_badge && _badge.el) brow.appendChild(_badge.el);
|
| 382 |
-
_overlay.appendChild(brow);
|
| 383 |
-
|
| 384 |
-
const card = document.createElement("div");
|
| 385 |
-
card.style.cssText = "background:#0a1117;border:1px solid #1d2a36;border-radius:9px;padding:9px 10px;display:flex;flex-direction:column;gap:6px";
|
| 386 |
-
|
| 387 |
-
const chead = document.createElement("div");
|
| 388 |
-
chead.style.cssText = "display:flex;align-items:center;gap:8px;flex-wrap:wrap";
|
| 389 |
-
const dot = document.createElement("span");
|
| 390 |
-
dot.style.cssText = "width:9px;height:9px;border-radius:50%;background:#3af4c8;box-shadow:0 0 7px #3af4c8";
|
| 391 |
-
const nm = document.createElement("b");
|
| 392 |
-
nm.style.cssText = "font-size:12px;color:#3af4c8;letter-spacing:.3px";
|
| 393 |
-
nm.textContent = "nested learning / continuum memory system";
|
| 394 |
-
chead.appendChild(dot); chead.appendChild(nm);
|
| 395 |
-
card.appendChild(chead);
|
| 396 |
-
|
| 397 |
-
const grid = document.createElement("div");
|
| 398 |
-
grid.style.cssText = "display:grid;grid-template-columns:1fr;gap:4px";
|
| 399 |
-
|
| 400 |
-
function kpiRow(id, label) {
|
| 401 |
-
const r = document.createElement("div");
|
| 402 |
-
r.style.cssText = "display:flex;justify-content:space-between;gap:10px;font-size:11px";
|
| 403 |
-
const l = document.createElement("span"); l.style.cssText = "color:#9fb1bf"; l.textContent = label;
|
| 404 |
-
const v = document.createElement("b");
|
| 405 |
-
v.id = id;
|
| 406 |
-
v.style.cssText = "font-variant-numeric:tabular-nums;color:#eef3f6;text-align:right;max-width:58%";
|
| 407 |
-
v.textContent = "\u2014";
|
| 408 |
-
_el[id] = v;
|
| 409 |
-
r.appendChild(l); r.appendChild(v); return r;
|
| 410 |
-
}
|
| 411 |
-
|
| 412 |
-
grid.appendChild(kpiRow("ne-tasks", "continual-learning tasks"));
|
| 413 |
-
grid.appendChild(kpiRow("ne-clocks", "clocks k_fast / k_med / k_slow"));
|
| 414 |
-
grid.appendChild(kpiRow("ne-gate", "slow-core surprise gate"));
|
| 415 |
-
grid.appendChild(kpiRow("ne-retbase", "task-A retained \u2014 single-clock"));
|
| 416 |
-
grid.appendChild(kpiRow("ne-retcms", "task-A retained \u2014 CMS (MODELED)"));
|
| 417 |
-
grid.appendChild(kpiRow("ne-delta", "retention gain (CMS \u2212 baseline)"));
|
| 418 |
-
grid.appendChild(kpiRow("ne-writes", "slow-core writes CMS / baseline"));
|
| 419 |
-
grid.appendChild(kpiRow("ne-surprise","mean / peak surprise"));
|
| 420 |
-
grid.appendChild(kpiRow("ne-momentum","momentum (optimizer-as-memory)"));
|
| 421 |
-
grid.appendChild(kpiRow("ne-label", "honesty label"));
|
| 422 |
-
card.appendChild(grid);
|
| 423 |
-
|
| 424 |
-
const fn = document.createElement("div");
|
| 425 |
-
fn.style.cssText = "font-size:9.5px;color:#6b7a86;line-height:1.5";
|
| 426 |
-
fn.textContent = "Behrouz, Razaviyayn, Zhong & Mirrokni 2025 (Google Research) \u00b7 Nested Learning: The Illusion of Deep Learning Architectures \u00b7 NeurIPS 2025 \u00b7 arXiv:2512.24695 \u00b7 research.google/blog Nested Learning. MODELED \u00b7 not claimed-as.";
|
| 427 |
-
card.appendChild(fn);
|
| 428 |
-
_overlay.appendChild(card);
|
| 429 |
-
|
| 430 |
-
const pl = document.createElement("button");
|
| 431 |
-
pl.textContent = "\u25d1 what this means";
|
| 432 |
-
pl.title = "Toggle plain-language explanation for investors & consumers.";
|
| 433 |
-
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";
|
| 434 |
-
pl.addEventListener("click", () => {
|
| 435 |
-
_plain = !_plain;
|
| 436 |
-
pl.style.background = _plain ? "#0f2a20" : "#08140f";
|
| 437 |
-
_applyPlain();
|
| 438 |
});
|
| 439 |
-
_overlay.appendChild(pl);
|
| 440 |
|
| 441 |
-
|
| 442 |
-
|
| 443 |
-
|
| 444 |
-
_el["
|
| 445 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 446 |
|
| 447 |
-
(ctx.container || document.body).appendChild(_overlay);
|
| 448 |
_paintOverlay();
|
| 449 |
}
|
| 450 |
|
| 451 |
-
function
|
| 452 |
-
const pd = _el["plain"];
|
| 453 |
-
if (!pd) return;
|
| 454 |
-
pd.style.display = _plain ? "block" : "none";
|
| 455 |
-
if (!_plain) return;
|
| 456 |
const rBase = S.retainBase != null ? (S.retainBase * 100).toFixed(0) + "%" : "loading\u2026";
|
| 457 |
const rCms = S.retainCms != null ? (S.retainCms * 100).toFixed(0) + "%" : "loading\u2026";
|
| 458 |
const dPct = S.retDelta != null ? "+" + (S.retDelta * 100).toFixed(0) + " points" : "loading\u2026";
|
| 459 |
-
|
| 460 |
"<b>What this means:</b> When an AI learns a new skill it often <b>forgets the old one</b> " +
|
| 461 |
"(\u201ccatastrophic forgetting\u201d). Nested Learning treats the model as a <b>stack of memories that " +
|
| 462 |
"update at different speeds</b> \u2014 a fast one that chases whatever it is learning right now, and " +
|
|
@@ -470,7 +401,7 @@ function _applyPlain() {
|
|
| 470 |
"tasks, hand-set clocks), <b>not the \u201cHope\u201d model</b>. The paper was noted publicly to lack full " +
|
| 471 |
"ablations in its first version, so this only shows the <b>scheduling mechanism</b> reduces forgetting " +
|
| 472 |
"on a controlled stream \u2014 it does <b>not</b> reproduce Hope's language-modeling or needle-in-haystack " +
|
| 473 |
-
"results or its claimed wins over Titans / Transformers.";
|
| 474 |
}
|
| 475 |
|
| 476 |
function _tok(s) {
|
|
@@ -507,7 +438,7 @@ function _paintOverlay() {
|
|
| 507 |
_set("ne-momentum", t || fx(S.momentum, 2));
|
| 508 |
// honesty label verbatim — never upgraded
|
| 509 |
_set("ne-label", t || (S.label || "MODELED"));
|
| 510 |
-
if (
|
| 511 |
}
|
| 512 |
|
| 513 |
// =============================================================================
|
|
@@ -515,7 +446,7 @@ function _paintOverlay() {
|
|
| 515 |
// =============================================================================
|
| 516 |
export function unmount() {
|
| 517 |
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 518 |
-
try { if (
|
| 519 |
try {
|
| 520 |
if (_group && _stage) {
|
| 521 |
_group.traverse((o) => {
|
|
@@ -528,9 +459,9 @@ export function unmount() {
|
|
| 528 |
_stage.scene.remove(_group);
|
| 529 |
}
|
| 530 |
} catch (_) {}
|
| 531 |
-
_group =
|
| 532 |
_floor = null; _rings = []; _tiers = []; _baseMarks = []; _cmsMarks = []; _core = null;
|
| 533 |
-
_el = {}; _badge = null;
|
| 534 |
_stage = _THREE = _ctx = null;
|
| 535 |
S.label = S.numTasks = S.blockLen = S.nTokens = null;
|
| 536 |
S.kFast = S.kMed = S.kSlow = S.gate = null;
|
|
|
|
| 50 |
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 51 |
// Nothing here is in the locked-8. Λ stays Conjecture 1. Trust never 100%.
|
| 52 |
|
| 53 |
+
import { createShowcase } from "./_showcase.js";
|
| 54 |
+
|
| 55 |
const ID = "nested";
|
| 56 |
const TITLE = "Nested Learning · Continuum Memory System (live)";
|
| 57 |
|
|
|
|
| 75 |
const MAX_BLOCKS = 96; // cap on forgetting-curve markers rendered
|
| 76 |
const CURVE_SPAN = 12.0; // world-units the forgetting curve spans along X
|
| 77 |
|
| 78 |
+
let _stage = null, _THREE = null, _ctx = null, _group = null, _show = null;
|
| 79 |
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
|
|
|
| 80 |
|
| 81 |
// geometry handles
|
| 82 |
let _floor = null;
|
|
|
|
| 353 |
// =============================================================================
|
| 354 |
function _buildOverlay() {
|
| 355 |
const ctx = _ctx;
|
| 356 |
+
_show = createShowcase(ctx, {
|
| 357 |
+
id: ID, title: TITLE, accent: "#5b8dee",
|
| 358 |
+
badge: _badge,
|
| 359 |
+
chips: [{ label: "MODELED", text: "CMS schedule", name: "nl" }],
|
| 360 |
+
legend: ["MODELED", "SAMPLE"],
|
| 361 |
+
description:
|
| 362 |
+
'A model as a stack of memory levels updating at <b>different clocks</b> (fast/medium/slow), with ' +
|
| 363 |
+
'the <b>optimizer itself as associative memory</b>. On a toy continual-learning stream, the slow ' +
|
| 364 |
+
'<b>protected core</b> (a surprise-gated timescale) <b>retains earlier tasks</b> where a single-clock ' +
|
| 365 |
+
'baseline overwrites and <b>forgets</b> them. ' +
|
| 366 |
+
'Honesty label <b>MODELED</b> (deterministic scheduling simulation; NOT the Hope architecture). 0 runtime CDN.',
|
| 367 |
+
citations:
|
| 368 |
+
"Behrouz, Razaviyayn, Zhong & Mirrokni 2025 (Google Research) \u00b7 Nested Learning: The Illusion of Deep Learning Architectures \u00b7 NeurIPS 2025 \u00b7 arXiv:2512.24695 \u00b7 research.google/blog Nested Learning. MODELED \u00b7 not claimed-as.",
|
| 369 |
+
plain: { html: _plainHtml },
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 370 |
});
|
|
|
|
| 371 |
|
| 372 |
+
_el["ne-tasks"] = _show.addField("continual-learning tasks");
|
| 373 |
+
_el["ne-clocks"] = _show.addField("clocks k_fast / k_med / k_slow");
|
| 374 |
+
_el["ne-gate"] = _show.addField("slow-core surprise gate");
|
| 375 |
+
_el["ne-retbase"] = _show.addField("task-A retained \u2014 single-clock");
|
| 376 |
+
_el["ne-retcms"] = _show.addField("task-A retained \u2014 CMS (MODELED)");
|
| 377 |
+
_el["ne-delta"] = _show.addField("retention gain (CMS \u2212 baseline)");
|
| 378 |
+
_el["ne-writes"] = _show.addField("slow-core writes CMS / baseline");
|
| 379 |
+
_el["ne-surprise"] = _show.addField("mean / peak surprise");
|
| 380 |
+
_el["ne-momentum"] = _show.addField("momentum (optimizer-as-memory)");
|
| 381 |
+
_el["ne-label"] = _show.addField("honesty label");
|
| 382 |
|
|
|
|
| 383 |
_paintOverlay();
|
| 384 |
}
|
| 385 |
|
| 386 |
+
function _plainHtml() {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 387 |
const rBase = S.retainBase != null ? (S.retainBase * 100).toFixed(0) + "%" : "loading\u2026";
|
| 388 |
const rCms = S.retainCms != null ? (S.retainCms * 100).toFixed(0) + "%" : "loading\u2026";
|
| 389 |
const dPct = S.retDelta != null ? "+" + (S.retDelta * 100).toFixed(0) + " points" : "loading\u2026";
|
| 390 |
+
return (
|
| 391 |
"<b>What this means:</b> When an AI learns a new skill it often <b>forgets the old one</b> " +
|
| 392 |
"(\u201ccatastrophic forgetting\u201d). Nested Learning treats the model as a <b>stack of memories that " +
|
| 393 |
"update at different speeds</b> \u2014 a fast one that chases whatever it is learning right now, and " +
|
|
|
|
| 401 |
"tasks, hand-set clocks), <b>not the \u201cHope\u201d model</b>. The paper was noted publicly to lack full " +
|
| 402 |
"ablations in its first version, so this only shows the <b>scheduling mechanism</b> reduces forgetting " +
|
| 403 |
"on a controlled stream \u2014 it does <b>not</b> reproduce Hope's language-modeling or needle-in-haystack " +
|
| 404 |
+
"results or its claimed wins over Titans / Transformers.");
|
| 405 |
}
|
| 406 |
|
| 407 |
function _tok(s) {
|
|
|
|
| 438 |
_set("ne-momentum", t || fx(S.momentum, 2));
|
| 439 |
// honesty label verbatim — never upgraded
|
| 440 |
_set("ne-label", t || (S.label || "MODELED"));
|
| 441 |
+
if (_show) { _show.setChip("nl", S.label || "MODELED", { text: "CMS schedule" }); _show.refreshPlain(); }
|
| 442 |
}
|
| 443 |
|
| 444 |
// =============================================================================
|
|
|
|
| 446 |
// =============================================================================
|
| 447 |
export function unmount() {
|
| 448 |
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 449 |
+
try { if (_show) _show.destroy(); } catch (_) {}
|
| 450 |
try {
|
| 451 |
if (_group && _stage) {
|
| 452 |
_group.traverse((o) => {
|
|
|
|
| 459 |
_stage.scene.remove(_group);
|
| 460 |
}
|
| 461 |
} catch (_) {}
|
| 462 |
+
_group = _show = null;
|
| 463 |
_floor = null; _rings = []; _tiers = []; _baseMarks = []; _cmsMarks = []; _core = null;
|
| 464 |
+
_el = {}; _badge = null; _frameReg = false;
|
| 465 |
_stage = _THREE = _ctx = null;
|
| 466 |
S.label = S.numTasks = S.blockLen = S.nTokens = null;
|
| 467 |
S.kFast = S.kMed = S.kSlow = S.gate = null;
|
static/3d/surfaces/neuromorphic.js
CHANGED
|
@@ -35,6 +35,8 @@
|
|
| 35 |
// 0 RUNTIME CDN. Vendored three.js r170 via page importmap.
|
| 36 |
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 37 |
|
|
|
|
|
|
|
| 38 |
const ID = "neuromorphic";
|
| 39 |
const TITLE = "Neuromorphic · Spiking Neural Compute (live)";
|
| 40 |
|
|
@@ -52,9 +54,8 @@ const GRID_DIM = 4;
|
|
| 52 |
const N_NEURONS = GRID_DIM * GRID_DIM * GRID_DIM; // 64
|
| 53 |
const SPACING = 1.15; // world units between nodes
|
| 54 |
|
| 55 |
-
let _stage = null, _THREE = null, _ctx = null, _group = null,
|
| 56 |
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
| 57 |
-
let _plain = false;
|
| 58 |
|
| 59 |
// geometry handles
|
| 60 |
let _nodes = []; // Array<THREE.Mesh> — one per neuron
|
|
@@ -91,13 +92,13 @@ export function mount(ctx) {
|
|
| 91 |
_buildFloor();
|
| 92 |
_buildLattice();
|
| 93 |
_buildHub();
|
| 94 |
-
_buildOverlay();
|
| 95 |
|
| 96 |
if (!_frameReg) { _stage.onFrame(_onFrame); _frameReg = true; }
|
| 97 |
|
| 98 |
_badge = ctx.live.createBadge();
|
| 99 |
_polls.push(ctx.live.poll(EP, 4000, _onSpikes, { badge: _badge, onState: (m) => { S.state = m.state; _paintOverlay(); } }));
|
| 100 |
|
|
|
|
| 101 |
return { id: ID, started: true };
|
| 102 |
}
|
| 103 |
|
|
@@ -264,109 +265,38 @@ function _onFrame() {
|
|
| 264 |
// =============================================================================
|
| 265 |
function _buildOverlay() {
|
| 266 |
const ctx = _ctx;
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
sub.innerHTML =
|
| 284 |
-
'<b>LIF (Leaky Integrate-and-Fire)</b> neuron population — 64 nodes on a 3D lattice, ' +
|
| 285 |
-
'each pulsing from a live deterministic simulation. Honesty label <b>MODELED</b> ' +
|
| 286 |
-
'(simulation, not measured silicon). Energy estimate cites Intel Loihi\u00a02 ' +
|
| 287 |
-
'(Davies\u00a0et\u00a0al.\u00a02021\u00a0JPROC). 0\u00a0runtime\u00a0CDN.';
|
| 288 |
-
_overlay.appendChild(sub);
|
| 289 |
-
|
| 290 |
-
// badge row
|
| 291 |
-
const brow = document.createElement("div");
|
| 292 |
-
brow.style.cssText = "display:flex;gap:8px;align-items:center;flex-wrap:wrap";
|
| 293 |
-
if (_badge && _badge.el) brow.appendChild(_badge.el);
|
| 294 |
-
_overlay.appendChild(brow);
|
| 295 |
-
|
| 296 |
-
// KPI card
|
| 297 |
-
const card = document.createElement("div");
|
| 298 |
-
card.style.cssText = "background:#0a1117;border:1px solid #1d2a36;border-radius:9px;padding:9px 10px;display:flex;flex-direction:column;gap:6px";
|
| 299 |
-
|
| 300 |
-
const chead = document.createElement("div");
|
| 301 |
-
chead.style.cssText = "display:flex;align-items:center;gap:8px;flex-wrap:wrap";
|
| 302 |
-
const dot = document.createElement("span");
|
| 303 |
-
dot.style.cssText = `width:9px;height:9px;border-radius:50%;background:#5b8dee;box-shadow:0 0 7px #5b8dee`;
|
| 304 |
-
const nm = document.createElement("b");
|
| 305 |
-
nm.style.cssText = "font-size:12px;color:#5b8dee;letter-spacing:.3px";
|
| 306 |
-
nm.textContent = "neuromorphic";
|
| 307 |
-
chead.appendChild(dot); chead.appendChild(nm);
|
| 308 |
-
card.appendChild(chead);
|
| 309 |
-
|
| 310 |
-
const grid = document.createElement("div");
|
| 311 |
-
grid.style.cssText = "display:grid;grid-template-columns:1fr;gap:4px";
|
| 312 |
-
|
| 313 |
-
function kpiRow(id, label) {
|
| 314 |
-
const r = document.createElement("div");
|
| 315 |
-
r.style.cssText = "display:flex;justify-content:space-between;gap:10px;font-size:11px";
|
| 316 |
-
const l = document.createElement("span"); l.style.cssText = "color:#9fb1bf"; l.textContent = label;
|
| 317 |
-
const v = document.createElement("b");
|
| 318 |
-
v.id = id;
|
| 319 |
-
v.style.cssText = "font-variant-numeric:tabular-nums;color:#eef3f6;text-align:right;max-width:58%";
|
| 320 |
-
v.textContent = "\u2014";
|
| 321 |
-
_el[id] = v;
|
| 322 |
-
r.appendChild(l); r.appendChild(v); return r;
|
| 323 |
-
}
|
| 324 |
-
|
| 325 |
-
grid.appendChild(kpiRow("nm-hz", "mean firing rate (Hz)"));
|
| 326 |
-
grid.appendChild(kpiRow("nm-sparse", "event sparsity"));
|
| 327 |
-
grid.appendChild(kpiRow("nm-energy", "energy / spike (pJ) \u2014 MODELED"));
|
| 328 |
-
grid.appendChild(kpiRow("nm-spikes", "total spikes"));
|
| 329 |
-
grid.appendChild(kpiRow("nm-label", "honesty label"));
|
| 330 |
-
card.appendChild(grid);
|
| 331 |
-
|
| 332 |
-
const fn = document.createElement("div");
|
| 333 |
-
fn.style.cssText = "font-size:9.5px;color:#6b7a86;line-height:1.5";
|
| 334 |
-
fn.textContent = "Gerstner & Kistler \"Spiking Neuron Models\" (2002) \u00b7 Intel Loihi\u00a02 Davies\u00a0et\u00a0al.\u00a02021 DOI:10.1109/JPROC.2021.3067593 \u00b7 Lava\u00a0OSS github.com/lava-nc/lava (BSD-3) \u00b7 Neftci\u00a0et\u00a0al.\u00a0arXiv:1901.09948 \u00b7 BrainScaleS. MODELED \u00b7 not\u00a0claimed-as.";
|
| 335 |
-
card.appendChild(fn);
|
| 336 |
-
_overlay.appendChild(card);
|
| 337 |
-
|
| 338 |
-
// plain-language toggle
|
| 339 |
-
const pl = document.createElement("button");
|
| 340 |
-
pl.textContent = "\u25d1 what this means";
|
| 341 |
-
pl.title = "Toggle plain-language explanation for investors & consumers.";
|
| 342 |
-
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";
|
| 343 |
-
pl.addEventListener("click", () => {
|
| 344 |
-
_plain = !_plain;
|
| 345 |
-
pl.style.background = _plain ? "#0f2a20" : "#08140f";
|
| 346 |
-
_applyPlain();
|
| 347 |
});
|
| 348 |
-
_overlay.appendChild(pl);
|
| 349 |
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
_el["
|
| 355 |
-
_overlay.appendChild(pd);
|
| 356 |
|
| 357 |
-
(ctx.container || document.body).appendChild(_overlay);
|
| 358 |
_paintOverlay();
|
| 359 |
}
|
| 360 |
|
| 361 |
-
function
|
| 362 |
-
const pd = _el["plain"];
|
| 363 |
-
if (!pd) return;
|
| 364 |
-
pd.style.display = _plain ? "block" : "none";
|
| 365 |
-
if (!_plain) return;
|
| 366 |
const hz = S.mean_hz != null ? S.mean_hz.toFixed(2) + " Hz" : "loading\u2026";
|
| 367 |
const sp = S.sparsity != null ? (S.sparsity * 100).toFixed(1) + "% idle slots" : "loading\u2026";
|
| 368 |
const ep = S.energy_pj != null ? S.energy_pj + " pJ/spike (MODELED, citing Loihi\u00a02)" : "loading\u2026";
|
| 369 |
-
|
| 370 |
"<b>What this means:</b> A simulated population of 64 spiking neurons is firing " +
|
| 371 |
"at roughly <b>" + hz + "</b> on average. " +
|
| 372 |
"Neuromorphic chips fire only on events \u2014 <b>" + sp + "</b> means most circuits " +
|
|
@@ -374,7 +304,7 @@ function _applyPlain() {
|
|
| 374 |
"Energy per spike is <b>" + ep + "</b> \u2014 this is a <b>MODELED</b> estimate from " +
|
| 375 |
"Intel\u2019s published Loihi\u00a02 specs, not a measured chip reading. " +
|
| 376 |
"Plain: spiking neural chips could be far more energy-efficient than dense matrix " +
|
| 377 |
-
"multiplication, but this number comes from a simulation, not a running chip.";
|
| 378 |
}
|
| 379 |
|
| 380 |
function _tok(s) {
|
|
@@ -396,7 +326,11 @@ function _paintOverlay() {
|
|
| 396 |
_set("nm-spikes", t || (S.total_spikes != null ? String(S.total_spikes) : "\u2014"));
|
| 397 |
// honesty label verbatim — never upgraded
|
| 398 |
_set("nm-label", t || (S.label || "MODELED"));
|
| 399 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
| 400 |
}
|
| 401 |
|
| 402 |
// =============================================================================
|
|
@@ -404,7 +338,7 @@ function _paintOverlay() {
|
|
| 404 |
// =============================================================================
|
| 405 |
export function unmount() {
|
| 406 |
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 407 |
-
try { if (
|
| 408 |
try {
|
| 409 |
if (_group && _stage) {
|
| 410 |
_group.traverse((o) => {
|
|
@@ -417,9 +351,9 @@ export function unmount() {
|
|
| 417 |
_stage.scene.remove(_group);
|
| 418 |
}
|
| 419 |
} catch (_) {}
|
| 420 |
-
_group =
|
| 421 |
_nodes = []; _edgeLines = null; _hubSphere = null;
|
| 422 |
-
_el = {}; _badge = null;
|
| 423 |
_stage = _THREE = _ctx = null;
|
| 424 |
S.label = S.mean_hz = S.sparsity = S.energy_pj = S.total_spikes = null;
|
| 425 |
S.spike_counts = S.membrane_v = S.energy_label = null;
|
|
|
|
| 35 |
// 0 RUNTIME CDN. Vendored three.js r170 via page importmap.
|
| 36 |
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 37 |
|
| 38 |
+
import { createShowcase } from "./_showcase.js";
|
| 39 |
+
|
| 40 |
const ID = "neuromorphic";
|
| 41 |
const TITLE = "Neuromorphic · Spiking Neural Compute (live)";
|
| 42 |
|
|
|
|
| 54 |
const N_NEURONS = GRID_DIM * GRID_DIM * GRID_DIM; // 64
|
| 55 |
const SPACING = 1.15; // world units between nodes
|
| 56 |
|
| 57 |
+
let _stage = null, _THREE = null, _ctx = null, _group = null, _show = null;
|
| 58 |
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
|
|
|
| 59 |
|
| 60 |
// geometry handles
|
| 61 |
let _nodes = []; // Array<THREE.Mesh> — one per neuron
|
|
|
|
| 92 |
_buildFloor();
|
| 93 |
_buildLattice();
|
| 94 |
_buildHub();
|
|
|
|
| 95 |
|
| 96 |
if (!_frameReg) { _stage.onFrame(_onFrame); _frameReg = true; }
|
| 97 |
|
| 98 |
_badge = ctx.live.createBadge();
|
| 99 |
_polls.push(ctx.live.poll(EP, 4000, _onSpikes, { badge: _badge, onState: (m) => { S.state = m.state; _paintOverlay(); } }));
|
| 100 |
|
| 101 |
+
_buildOverlay();
|
| 102 |
return { id: ID, started: true };
|
| 103 |
}
|
| 104 |
|
|
|
|
| 265 |
// =============================================================================
|
| 266 |
function _buildOverlay() {
|
| 267 |
const ctx = _ctx;
|
| 268 |
+
_show = createShowcase(ctx, {
|
| 269 |
+
id: ID, title: TITLE, accent: "#5b8dee",
|
| 270 |
+
badge: _badge,
|
| 271 |
+
chips: [
|
| 272 |
+
{ label: "MODELED", text: "LIF spikes", name: "spk" },
|
| 273 |
+
{ label: "MODELED", text: "energy est.", name: "energy" },
|
| 274 |
+
],
|
| 275 |
+
legend: ["MODELED", "SAMPLE"],
|
| 276 |
+
description:
|
| 277 |
+
'<b>LIF (Leaky Integrate-and-Fire)</b> neuron population \u2014 64 nodes on a 3D lattice, ' +
|
| 278 |
+
'each pulsing from a live deterministic simulation. Honesty label <b>MODELED</b> ' +
|
| 279 |
+
'(simulation, not measured silicon). Energy estimate cites Intel Loihi\u00a02 ' +
|
| 280 |
+
'(Davies\u00a0et\u00a0al.\u00a02021\u00a0JPROC). 0\u00a0runtime\u00a0CDN.',
|
| 281 |
+
citations:
|
| 282 |
+
"Gerstner & Kistler \"Spiking Neuron Models\" (2002) \u00b7 Intel Loihi\u00a02 Davies\u00a0et\u00a0al.\u00a02021 DOI:10.1109/JPROC.2021.3067593 \u00b7 Lava\u00a0OSS github.com/lava-nc/lava (BSD-3) \u00b7 Neftci\u00a0et\u00a0al.\u00a0arXiv:1901.09948 \u00b7 BrainScaleS. MODELED \u00b7 not\u00a0claimed-as.",
|
| 283 |
+
plain: { html: _plainHtml },
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 284 |
});
|
|
|
|
| 285 |
|
| 286 |
+
_el["nm-hz"] = _show.addField("mean firing rate (Hz)");
|
| 287 |
+
_el["nm-sparse"] = _show.addField("event sparsity");
|
| 288 |
+
_el["nm-energy"] = _show.addField("energy / spike (pJ) \u2014 MODELED");
|
| 289 |
+
_el["nm-spikes"] = _show.addField("total spikes");
|
| 290 |
+
_el["nm-label"] = _show.addField("honesty label");
|
|
|
|
| 291 |
|
|
|
|
| 292 |
_paintOverlay();
|
| 293 |
}
|
| 294 |
|
| 295 |
+
function _plainHtml() {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 296 |
const hz = S.mean_hz != null ? S.mean_hz.toFixed(2) + " Hz" : "loading\u2026";
|
| 297 |
const sp = S.sparsity != null ? (S.sparsity * 100).toFixed(1) + "% idle slots" : "loading\u2026";
|
| 298 |
const ep = S.energy_pj != null ? S.energy_pj + " pJ/spike (MODELED, citing Loihi\u00a02)" : "loading\u2026";
|
| 299 |
+
return (
|
| 300 |
"<b>What this means:</b> A simulated population of 64 spiking neurons is firing " +
|
| 301 |
"at roughly <b>" + hz + "</b> on average. " +
|
| 302 |
"Neuromorphic chips fire only on events \u2014 <b>" + sp + "</b> means most circuits " +
|
|
|
|
| 304 |
"Energy per spike is <b>" + ep + "</b> \u2014 this is a <b>MODELED</b> estimate from " +
|
| 305 |
"Intel\u2019s published Loihi\u00a02 specs, not a measured chip reading. " +
|
| 306 |
"Plain: spiking neural chips could be far more energy-efficient than dense matrix " +
|
| 307 |
+
"multiplication, but this number comes from a simulation, not a running chip.");
|
| 308 |
}
|
| 309 |
|
| 310 |
function _tok(s) {
|
|
|
|
| 326 |
_set("nm-spikes", t || (S.total_spikes != null ? String(S.total_spikes) : "\u2014"));
|
| 327 |
// honesty label verbatim — never upgraded
|
| 328 |
_set("nm-label", t || (S.label || "MODELED"));
|
| 329 |
+
if (_show) {
|
| 330 |
+
_show.setChip("spk", S.label || "MODELED", { text: "LIF spikes" });
|
| 331 |
+
_show.setChip("energy", S.energy_label || "MODELED", { text: "energy est." });
|
| 332 |
+
_show.refreshPlain();
|
| 333 |
+
}
|
| 334 |
}
|
| 335 |
|
| 336 |
// =============================================================================
|
|
|
|
| 338 |
// =============================================================================
|
| 339 |
export function unmount() {
|
| 340 |
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 341 |
+
try { if (_show) _show.destroy(); } catch (_) {}
|
| 342 |
try {
|
| 343 |
if (_group && _stage) {
|
| 344 |
_group.traverse((o) => {
|
|
|
|
| 351 |
_stage.scene.remove(_group);
|
| 352 |
}
|
| 353 |
} catch (_) {}
|
| 354 |
+
_group = _show = null;
|
| 355 |
_nodes = []; _edgeLines = null; _hubSphere = null;
|
| 356 |
+
_el = {}; _badge = null; _frameReg = false;
|
| 357 |
_stage = _THREE = _ctx = null;
|
| 358 |
S.label = S.mean_hz = S.sparsity = S.energy_pj = S.total_spikes = null;
|
| 359 |
S.spike_counts = S.membrane_v = S.energy_label = null;
|
static/3d/surfaces/nsa.js
CHANGED
|
@@ -38,6 +38,8 @@
|
|
| 38 |
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 39 |
// Nothing here is in the locked-8. Λ stays Conjecture 1. Trust never 100%.
|
| 40 |
|
|
|
|
|
|
|
| 41 |
const ID = "nsa";
|
| 42 |
const TITLE = "Native Sparse Attention · Compress + Select + Slide (live)";
|
| 43 |
|
|
@@ -60,9 +62,8 @@ const SPINE_LEN = 22; // world-units the full spine spans along X
|
|
| 60 |
const SUMMARY_Y = 1.6; // height above spine for compression summary tokens
|
| 61 |
const WINDOW_Z = 0.0; // spine sits at z=0; selected blocks nudge +z, summaries -z visually via y
|
| 62 |
|
| 63 |
-
let _stage = null, _THREE = null, _ctx = null, _group = null,
|
| 64 |
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
| 65 |
-
let _plain = false;
|
| 66 |
|
| 67 |
// geometry handles
|
| 68 |
let _floor = null;
|
|
@@ -327,112 +328,42 @@ function _onFrame() {
|
|
| 327 |
// =============================================================================
|
| 328 |
function _buildOverlay() {
|
| 329 |
const ctx = _ctx;
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
sub.innerHTML =
|
| 347 |
-
'Three parallel branches replace one dense O(L\u00b2) attention pass: a coarse ' +
|
| 348 |
-
'<b>compression</b> branch pools blocks of tokens into summaries, a <b>top-k selection</b> ' +
|
| 349 |
-
'branch scores blocks cheaply then attends fully only to the winners, and a local ' +
|
| 350 |
-
'<b>sliding-window</b> branch always covers recent context. A fixed-weight gate combines ' +
|
| 351 |
-
'all three. Honesty label <b>MODELED</b> (deterministic reimplementation over synthetic, ' +
|
| 352 |
-
'LCG-seeded data; NOT a trained model). 0 runtime CDN.';
|
| 353 |
-
_overlay.appendChild(sub);
|
| 354 |
-
|
| 355 |
-
const brow = document.createElement("div");
|
| 356 |
-
brow.style.cssText = "display:flex;gap:8px;align-items:center;flex-wrap:wrap";
|
| 357 |
-
if (_badge && _badge.el) brow.appendChild(_badge.el);
|
| 358 |
-
_overlay.appendChild(brow);
|
| 359 |
-
|
| 360 |
-
const card = document.createElement("div");
|
| 361 |
-
card.style.cssText = "background:#0a1117;border:1px solid #1d2a36;border-radius:9px;padding:9px 10px;display:flex;flex-direction:column;gap:6px";
|
| 362 |
-
|
| 363 |
-
const chead = document.createElement("div");
|
| 364 |
-
chead.style.cssText = "display:flex;align-items:center;gap:8px;flex-wrap:wrap";
|
| 365 |
-
const dot = document.createElement("span");
|
| 366 |
-
dot.style.cssText = "width:9px;height:9px;border-radius:50%;background:#3af4c8;box-shadow:0 0 7px #3af4c8";
|
| 367 |
-
const nm = document.createElement("b");
|
| 368 |
-
nm.style.cssText = "font-size:12px;color:#3af4c8;letter-spacing:.3px";
|
| 369 |
-
nm.textContent = "native sparse attention";
|
| 370 |
-
chead.appendChild(dot); chead.appendChild(nm);
|
| 371 |
-
card.appendChild(chead);
|
| 372 |
-
|
| 373 |
-
const grid = document.createElement("div");
|
| 374 |
-
grid.style.cssText = "display:grid;grid-template-columns:1fr;gap:4px";
|
| 375 |
-
|
| 376 |
-
function kpiRow(id, label) {
|
| 377 |
-
const r = document.createElement("div");
|
| 378 |
-
r.style.cssText = "display:flex;justify-content:space-between;gap:10px;font-size:11px";
|
| 379 |
-
const l = document.createElement("span"); l.style.cssText = "color:#9fb1bf"; l.textContent = label;
|
| 380 |
-
const v = document.createElement("b");
|
| 381 |
-
v.id = id;
|
| 382 |
-
v.style.cssText = "font-variant-numeric:tabular-nums;color:#eef3f6;text-align:right;max-width:58%";
|
| 383 |
-
v.textContent = "\u2014";
|
| 384 |
-
_el[id] = v;
|
| 385 |
-
r.appendChild(l); r.appendChild(v); return r;
|
| 386 |
-
}
|
| 387 |
-
|
| 388 |
-
grid.appendChild(kpiRow("nsa-seqlen", "seq_len (tokens)"));
|
| 389 |
-
grid.appendChild(kpiRow("nsa-blocks", "block_size / topk / window"));
|
| 390 |
-
grid.appendChild(kpiRow("nsa-nsummary", "compression summary tokens"));
|
| 391 |
-
grid.appendChild(kpiRow("nsa-selblocks","selected blocks (top-k)"));
|
| 392 |
-
grid.appendChild(kpiRow("nsa-gate", "gate_combined_score \u2014 MODELED"));
|
| 393 |
-
grid.appendChild(kpiRow("nsa-evals", "NSA vs dense evals (this query)"));
|
| 394 |
-
grid.appendChild(kpiRow("nsa-sparsity", "sparsity ratio \u2014 MODELED"));
|
| 395 |
-
grid.appendChild(kpiRow("nsa-recall", "recall vs dense oracle"));
|
| 396 |
-
grid.appendChild(kpiRow("nsa-label", "honesty label"));
|
| 397 |
-
card.appendChild(grid);
|
| 398 |
-
|
| 399 |
-
const fn = document.createElement("div");
|
| 400 |
-
fn.style.cssText = "font-size:9.5px;color:#6b7a86;line-height:1.5";
|
| 401 |
-
fn.textContent = "DeepSeek-AI, Yuan et al. 2025 arXiv:2502.11089 (Native Sparse Attention) \u00b7 " +
|
| 402 |
-
"discussion news.ycombinator.com/item?id=46181231. MODELED \u00b7 not claimed-as.";
|
| 403 |
-
card.appendChild(fn);
|
| 404 |
-
_overlay.appendChild(card);
|
| 405 |
-
|
| 406 |
-
const pl = document.createElement("button");
|
| 407 |
-
pl.textContent = "\u25d1 what this means";
|
| 408 |
-
pl.title = "Toggle plain-language explanation for investors & consumers.";
|
| 409 |
-
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";
|
| 410 |
-
pl.addEventListener("click", () => {
|
| 411 |
-
_plain = !_plain;
|
| 412 |
-
pl.style.background = _plain ? "#0f2a20" : "#08140f";
|
| 413 |
-
_applyPlain();
|
| 414 |
});
|
| 415 |
-
_overlay.appendChild(pl);
|
| 416 |
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
_el["
|
| 421 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 422 |
|
| 423 |
-
(ctx.container || document.body).appendChild(_overlay);
|
| 424 |
_paintOverlay();
|
| 425 |
}
|
| 426 |
|
| 427 |
-
function
|
| 428 |
-
const pd = _el["plain"];
|
| 429 |
-
if (!pd) return;
|
| 430 |
-
pd.style.display = _plain ? "block" : "none";
|
| 431 |
-
if (!_plain) return;
|
| 432 |
const seq = S.seqLen != null ? String(S.seqLen) : "loading\u2026";
|
| 433 |
const ratio = S.sparsityRatio != null ? (S.sparsityRatio * 100).toFixed(1) + "%" : "loading\u2026";
|
| 434 |
const rec = S.recall != null ? (S.recall * 100).toFixed(1) + "%" : "loading\u2026";
|
| 435 |
-
|
| 436 |
"<b>What this means:</b> Normal (\u201cdense\u201d) attention checks every word against every " +
|
| 437 |
"other word \u2014 cost grows with the square of the text length. Native Sparse Attention instead " +
|
| 438 |
"splits the job three ways: a cheap <b>skim</b> of the whole document (compression), a focused " +
|
|
@@ -441,7 +372,7 @@ function _applyPlain() {
|
|
| 441 |
"about <b>" + ratio + "</b> of the work a full dense pass would need on a " + seq + "-token " +
|
| 442 |
"sequence, while still covering about <b>" + rec + "</b> of the spots a full dense scan would " +
|
| 443 |
"have flagged as important. This is a <b>MODELED</b> demonstration of the sparsity pattern on " +
|
| 444 |
-
"synthetic data \u2014 not a trained model, not the original DeepSeek-AI kernel.";
|
| 445 |
}
|
| 446 |
|
| 447 |
function _tok(s) {
|
|
@@ -470,7 +401,7 @@ function _paintOverlay() {
|
|
| 470 |
_set("nsa-recall", t || pct(S.recall, 1));
|
| 471 |
// honesty label verbatim — never upgraded
|
| 472 |
_set("nsa-label", t || (S.label || "MODELED"));
|
| 473 |
-
if (
|
| 474 |
}
|
| 475 |
|
| 476 |
// =============================================================================
|
|
@@ -478,7 +409,7 @@ function _paintOverlay() {
|
|
| 478 |
// =============================================================================
|
| 479 |
export function unmount() {
|
| 480 |
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 481 |
-
try { if (
|
| 482 |
try {
|
| 483 |
if (_group && _stage) {
|
| 484 |
_group.traverse((o) => {
|
|
@@ -491,9 +422,9 @@ export function unmount() {
|
|
| 491 |
_stage.scene.remove(_group);
|
| 492 |
}
|
| 493 |
} catch (_) {}
|
| 494 |
-
_group =
|
| 495 |
_floor = null; _spineLine = null; _tokenMesh = []; _summaryMesh = []; _summaryLinks = []; _gateMarker = null;
|
| 496 |
-
_el = {}; _badge = null;
|
| 497 |
_stage = _THREE = _ctx = null;
|
| 498 |
S.label = S.seqLen = S.dim = S.blockSize = S.topk = S.window = S.queryPos = null;
|
| 499 |
S.windowPositions = S.selectedBlocks = S.nSummary = S.gateScore = S.gateWeights = null;
|
|
|
|
| 38 |
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 39 |
// Nothing here is in the locked-8. Λ stays Conjecture 1. Trust never 100%.
|
| 40 |
|
| 41 |
+
import { createShowcase } from "./_showcase.js";
|
| 42 |
+
|
| 43 |
const ID = "nsa";
|
| 44 |
const TITLE = "Native Sparse Attention · Compress + Select + Slide (live)";
|
| 45 |
|
|
|
|
| 62 |
const SUMMARY_Y = 1.6; // height above spine for compression summary tokens
|
| 63 |
const WINDOW_Z = 0.0; // spine sits at z=0; selected blocks nudge +z, summaries -z visually via y
|
| 64 |
|
| 65 |
+
let _stage = null, _THREE = null, _ctx = null, _group = null, _show = null;
|
| 66 |
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
|
|
|
| 67 |
|
| 68 |
// geometry handles
|
| 69 |
let _floor = null;
|
|
|
|
| 328 |
// =============================================================================
|
| 329 |
function _buildOverlay() {
|
| 330 |
const ctx = _ctx;
|
| 331 |
+
_show = createShowcase(ctx, {
|
| 332 |
+
id: ID, title: TITLE, accent: "#5b8dee",
|
| 333 |
+
badge: _badge,
|
| 334 |
+
chips: [{ label: "MODELED", text: "3-branch sparse", name: "nsa" }],
|
| 335 |
+
legend: ["MODELED", "SAMPLE"],
|
| 336 |
+
description:
|
| 337 |
+
'Three parallel branches replace one dense O(L\u00b2) attention pass: a coarse ' +
|
| 338 |
+
'<b>compression</b> branch pools blocks of tokens into summaries, a <b>top-k selection</b> ' +
|
| 339 |
+
'branch scores blocks cheaply then attends fully only to the winners, and a local ' +
|
| 340 |
+
'<b>sliding-window</b> branch always covers recent context. A fixed-weight gate combines ' +
|
| 341 |
+
'all three. Honesty label <b>MODELED</b> (deterministic reimplementation over synthetic, ' +
|
| 342 |
+
'LCG-seeded data; NOT a trained model). 0 runtime CDN.',
|
| 343 |
+
citations:
|
| 344 |
+
"DeepSeek-AI, Yuan et al. 2025 arXiv:2502.11089 (Native Sparse Attention) \u00b7 " +
|
| 345 |
+
"discussion news.ycombinator.com/item?id=46181231. MODELED \u00b7 not claimed-as.",
|
| 346 |
+
plain: { html: _plainHtml },
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 347 |
});
|
|
|
|
| 348 |
|
| 349 |
+
_el["nsa-seqlen"] = _show.addField("seq_len (tokens)");
|
| 350 |
+
_el["nsa-blocks"] = _show.addField("block_size / topk / window");
|
| 351 |
+
_el["nsa-nsummary"] = _show.addField("compression summary tokens");
|
| 352 |
+
_el["nsa-selblocks"] = _show.addField("selected blocks (top-k)");
|
| 353 |
+
_el["nsa-gate"] = _show.addField("gate_combined_score \u2014 MODELED");
|
| 354 |
+
_el["nsa-evals"] = _show.addField("NSA vs dense evals (this query)");
|
| 355 |
+
_el["nsa-sparsity"] = _show.addField("sparsity ratio \u2014 MODELED");
|
| 356 |
+
_el["nsa-recall"] = _show.addField("recall vs dense oracle");
|
| 357 |
+
_el["nsa-label"] = _show.addField("honesty label");
|
| 358 |
|
|
|
|
| 359 |
_paintOverlay();
|
| 360 |
}
|
| 361 |
|
| 362 |
+
function _plainHtml() {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 363 |
const seq = S.seqLen != null ? String(S.seqLen) : "loading\u2026";
|
| 364 |
const ratio = S.sparsityRatio != null ? (S.sparsityRatio * 100).toFixed(1) + "%" : "loading\u2026";
|
| 365 |
const rec = S.recall != null ? (S.recall * 100).toFixed(1) + "%" : "loading\u2026";
|
| 366 |
+
return (
|
| 367 |
"<b>What this means:</b> Normal (\u201cdense\u201d) attention checks every word against every " +
|
| 368 |
"other word \u2014 cost grows with the square of the text length. Native Sparse Attention instead " +
|
| 369 |
"splits the job three ways: a cheap <b>skim</b> of the whole document (compression), a focused " +
|
|
|
|
| 372 |
"about <b>" + ratio + "</b> of the work a full dense pass would need on a " + seq + "-token " +
|
| 373 |
"sequence, while still covering about <b>" + rec + "</b> of the spots a full dense scan would " +
|
| 374 |
"have flagged as important. This is a <b>MODELED</b> demonstration of the sparsity pattern on " +
|
| 375 |
+
"synthetic data \u2014 not a trained model, not the original DeepSeek-AI kernel.");
|
| 376 |
}
|
| 377 |
|
| 378 |
function _tok(s) {
|
|
|
|
| 401 |
_set("nsa-recall", t || pct(S.recall, 1));
|
| 402 |
// honesty label verbatim — never upgraded
|
| 403 |
_set("nsa-label", t || (S.label || "MODELED"));
|
| 404 |
+
if (_show) { _show.setChip("nsa", S.label || "MODELED", { text: "3-branch sparse" }); _show.refreshPlain(); }
|
| 405 |
}
|
| 406 |
|
| 407 |
// =============================================================================
|
|
|
|
| 409 |
// =============================================================================
|
| 410 |
export function unmount() {
|
| 411 |
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 412 |
+
try { if (_show) _show.destroy(); } catch (_) {}
|
| 413 |
try {
|
| 414 |
if (_group && _stage) {
|
| 415 |
_group.traverse((o) => {
|
|
|
|
| 422 |
_stage.scene.remove(_group);
|
| 423 |
}
|
| 424 |
} catch (_) {}
|
| 425 |
+
_group = _show = null;
|
| 426 |
_floor = null; _spineLine = null; _tokenMesh = []; _summaryMesh = []; _summaryLinks = []; _gateMarker = null;
|
| 427 |
+
_el = {}; _badge = null; _frameReg = false;
|
| 428 |
_stage = _THREE = _ctx = null;
|
| 429 |
S.label = S.seqLen = S.dim = S.blockSize = S.topk = S.window = S.queryPos = null;
|
| 430 |
S.windowPositions = S.selectedBlocks = S.nSummary = S.gateScore = S.gateWeights = null;
|
static/3d/surfaces/nvfp4.js
CHANGED
|
@@ -48,6 +48,8 @@
|
|
| 48 |
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 49 |
// Nothing here is in the locked-8. Λ stays Conjecture 1. Trust never 100%.
|
| 50 |
|
|
|
|
|
|
|
| 51 |
const ID = "nvfp4";
|
| 52 |
const TITLE = "NVFP4 4-bit Training Format";
|
| 53 |
|
|
@@ -64,9 +66,8 @@ const C_ZERO = 0x5a6570; // grey (zero baseline / neutral)
|
|
| 64 |
const C_DIM = 0x42505d; // grey (degraded / no-live-data)
|
| 65 |
const C_GRID = 0x1b3a44; // floor / link colour
|
| 66 |
|
| 67 |
-
let _stage = null, _THREE = null, _ctx = null, _group = null,
|
| 68 |
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
| 69 |
-
let _plain = false;
|
| 70 |
|
| 71 |
// geometry handles
|
| 72 |
let _floor = null;
|
|
@@ -355,125 +356,54 @@ function _onFrame() {
|
|
| 355 |
// =============================================================================
|
| 356 |
function _buildOverlay() {
|
| 357 |
const ctx = _ctx;
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 365 |
});
|
| 366 |
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
const brow = document.createElement("div");
|
| 384 |
-
brow.style.cssText = "display:flex;gap:8px;align-items:center;flex-wrap:wrap";
|
| 385 |
-
if (_badge && _badge.el) brow.appendChild(_badge.el);
|
| 386 |
-
_overlay.appendChild(brow);
|
| 387 |
-
|
| 388 |
-
const card = document.createElement("div");
|
| 389 |
-
card.style.cssText = "background:#0a1117;border:1px solid #1d2a36;border-radius:9px;padding:9px 10px;display:flex;flex-direction:column;gap:6px";
|
| 390 |
-
|
| 391 |
-
const chead = document.createElement("div");
|
| 392 |
-
chead.style.cssText = "display:flex;align-items:center;gap:8px;flex-wrap:wrap";
|
| 393 |
-
const dot = document.createElement("span");
|
| 394 |
-
dot.style.cssText = "width:9px;height:9px;border-radius:50%;background:#3af4c8;box-shadow:0 0 7px #3af4c8";
|
| 395 |
-
const nm = document.createElement("b");
|
| 396 |
-
nm.style.cssText = "font-size:12px;color:#3af4c8;letter-spacing:.3px";
|
| 397 |
-
nm.textContent = "nvfp4 4-bit training format";
|
| 398 |
-
chead.appendChild(dot); chead.appendChild(nm);
|
| 399 |
-
card.appendChild(chead);
|
| 400 |
-
|
| 401 |
-
const grid = document.createElement("div");
|
| 402 |
-
grid.style.cssText = "display:grid;grid-template-columns:1fr;gap:4px";
|
| 403 |
-
|
| 404 |
-
function kpiRow(id, label) {
|
| 405 |
-
const r = document.createElement("div");
|
| 406 |
-
r.style.cssText = "display:flex;justify-content:space-between;gap:10px;font-size:11px";
|
| 407 |
-
const l = document.createElement("span"); l.style.cssText = "color:#9fb1bf"; l.textContent = label;
|
| 408 |
-
const v = document.createElement("b");
|
| 409 |
-
v.id = id;
|
| 410 |
-
v.style.cssText = "font-variant-numeric:tabular-nums;color:#eef3f6;text-align:right;max-width:56%";
|
| 411 |
-
v.textContent = "\u2014";
|
| 412 |
-
_el[id] = v;
|
| 413 |
-
r.appendChild(l); r.appendChild(v); return r;
|
| 414 |
-
}
|
| 415 |
-
|
| 416 |
-
grid.appendChild(kpiRow("nv-size", "tensor (size \u00d7 size)"));
|
| 417 |
-
grid.appendChild(kpiRow("nv-outl", "injected outliers"));
|
| 418 |
-
grid.appendChild(kpiRow("nv-amax", "tensor max |value|"));
|
| 419 |
-
grid.appendChild(kpiRow("nv-naive", "MSE \u2014 naive-FP4 (global scale)"));
|
| 420 |
-
grid.appendChild(kpiRow("nv-mx", "MSE \u2014 MXFP4 (32-blk pow2)"));
|
| 421 |
-
grid.appendChild(kpiRow("nv-nv", "MSE \u2014 NVFP4 (16-blk E4M3+FP32)"));
|
| 422 |
-
grid.appendChild(kpiRow("nv-best", "best scheme (lowest MSE)"));
|
| 423 |
-
grid.appendChild(kpiRow("nv-rn", "rounding demo \u2014 N roundings"));
|
| 424 |
-
grid.appendChild(kpiRow("nv-det", "cumulative bias \u2014 deterministic"));
|
| 425 |
-
grid.appendChild(kpiRow("nv-stoch", "cumulative bias \u2014 stochastic"));
|
| 426 |
-
grid.appendChild(kpiRow("nv-label", "honesty label"));
|
| 427 |
-
card.appendChild(grid);
|
| 428 |
-
|
| 429 |
-
// scaling-pipeline legend (two-level)
|
| 430 |
-
const pipe = document.createElement("div");
|
| 431 |
-
pipe.style.cssText = "font-size:10px;color:#9fb1bf;line-height:1.5;border-top:1px solid #1d2a36;padding-top:6px";
|
| 432 |
-
pipe.innerHTML =
|
| 433 |
"<b style='color:#c9d6df'>two-level scaling pipeline:</b><br>" +
|
| 434 |
"tensor <span style='color:#8a6bff'>\u25a0</span> \u2192 FP32 global scale <span style='color:#8a6bff'>\u25c8</span> " +
|
| 435 |
-
"\u2192 E4M3 block scale <span style='color:#5b8dee'>\u25c8</span> \u2192 FP4 value <span style='color:#3af4c8'>\u2b21</span>"
|
| 436 |
-
|
| 437 |
-
|
| 438 |
-
const fn = document.createElement("div");
|
| 439 |
-
fn.style.cssText = "font-size:9.5px;color:#6b7a86;line-height:1.5";
|
| 440 |
-
fn.textContent = "NVFP4 \u2014 Agrusa, Rouhani, Micikevicius, Patwary, Shoeybi et al. (NVIDIA) arXiv:2509.25149 \u00b7 MXFP4/OCP arXiv:2310.10537 \u00b7 TetraJet arXiv:2502.20853. MODELED \u00b7 arithmetic-only \u00b7 not claimed-as.";
|
| 441 |
-
card.appendChild(fn);
|
| 442 |
-
_overlay.appendChild(card);
|
| 443 |
-
|
| 444 |
-
const pl = document.createElement("button");
|
| 445 |
-
pl.textContent = "\u25d1 what this means";
|
| 446 |
-
pl.title = "Toggle plain-language explanation for investors & consumers.";
|
| 447 |
-
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";
|
| 448 |
-
pl.addEventListener("click", () => {
|
| 449 |
-
_plain = !_plain;
|
| 450 |
-
pl.style.background = _plain ? "#0f2a20" : "#08140f";
|
| 451 |
-
_applyPlain();
|
| 452 |
-
});
|
| 453 |
-
_overlay.appendChild(pl);
|
| 454 |
-
|
| 455 |
-
const pd = document.createElement("div");
|
| 456 |
-
pd.id = "nv-plain";
|
| 457 |
-
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";
|
| 458 |
-
_el["plain"] = pd;
|
| 459 |
-
_overlay.appendChild(pd);
|
| 460 |
|
| 461 |
-
(ctx.container || document.body).appendChild(_overlay);
|
| 462 |
_paintOverlay();
|
| 463 |
}
|
| 464 |
|
| 465 |
-
function
|
| 466 |
-
const pd = _el["plain"];
|
| 467 |
-
if (!pd) return;
|
| 468 |
-
pd.style.display = _plain ? "block" : "none";
|
| 469 |
-
if (!_plain) return;
|
| 470 |
const nvMse = _schemeByName("NVFP4");
|
| 471 |
const naiveMse = _schemeByName("naive-FP4");
|
| 472 |
const nvTxt = (nvMse && typeof nvMse.mse === "number") ? nvMse.mse.toExponential(2) : "loading\u2026";
|
| 473 |
const naiveTxt = (naiveMse && typeof naiveMse.mse === "number") ? naiveMse.mse.toExponential(2) : "loading\u2026";
|
| 474 |
const detTxt = S.detFinal != null ? S.detFinal.toFixed(2) : "loading\u2026";
|
| 475 |
const stochTxt = S.stochFinal != null ? S.stochFinal.toFixed(2) : "loading\u2026";
|
| 476 |
-
|
| 477 |
"<b>What this means:</b> Training big models in only 4 bits per number saves memory and speeds up the math, " +
|
| 478 |
"but 4 bits is very coarse \u2014 so how you pick the <i>scale</i> matters enormously. The <b>naive</b> approach uses " +
|
| 479 |
"one scale for the whole tensor; a single large \u201coutlier\u201d value then crushes precision for everything else " +
|
|
@@ -484,7 +414,7 @@ function _applyPlain() {
|
|
| 484 |
"<b>stochastic</b> rounding \u2014 flipping a weighted coin each time \u2014 cancels out (stays near <b>" + stochTxt + "</b>). " +
|
| 485 |
"This view is <b>MODELED</b>: a deterministic arithmetic demonstration on a tiny synthetic tensor, with the error " +
|
| 486 |
"MEASURED and shown. <b>No GPU kernel runs here</b>, and it does not reproduce NVIDIA's 12-billion-parameter, " +
|
| 487 |
-
"10-trillion-token training run or its speed claims \u2014 those are NVIDIA's, not independently verified.";
|
| 488 |
}
|
| 489 |
|
| 490 |
function _tok(s) {
|
|
@@ -515,7 +445,7 @@ function _paintOverlay() {
|
|
| 515 |
_set("nv-stoch", t || (typeof S.stochFinal === "number" ? S.stochFinal.toFixed(3) : "\u2014"));
|
| 516 |
// honesty label verbatim — never upgraded
|
| 517 |
_set("nv-label", t || (S.label || "MODELED"));
|
| 518 |
-
if (
|
| 519 |
}
|
| 520 |
|
| 521 |
// =============================================================================
|
|
@@ -523,7 +453,7 @@ function _paintOverlay() {
|
|
| 523 |
// =============================================================================
|
| 524 |
export function unmount() {
|
| 525 |
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 526 |
-
try { if (
|
| 527 |
try {
|
| 528 |
if (_group && _stage) {
|
| 529 |
_group.traverse((o) => {
|
|
@@ -536,9 +466,9 @@ export function unmount() {
|
|
| 536 |
_stage.scene.remove(_group);
|
| 537 |
}
|
| 538 |
} catch (_) {}
|
| 539 |
-
_group =
|
| 540 |
_floor = null; _bars = []; _detLine = null; _stochLine = null; _biasZero = null; _pipe = [];
|
| 541 |
-
_el = {}; _badge = null;
|
| 542 |
_stage = _THREE = _ctx = null;
|
| 543 |
S.label = S.size = S.outliers = S.tensorAmax = S.bestScheme = null;
|
| 544 |
S.fp4Levels = S.schemes = null;
|
|
|
|
| 48 |
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 49 |
// Nothing here is in the locked-8. Λ stays Conjecture 1. Trust never 100%.
|
| 50 |
|
| 51 |
+
import { createShowcase } from "./_showcase.js";
|
| 52 |
+
|
| 53 |
const ID = "nvfp4";
|
| 54 |
const TITLE = "NVFP4 4-bit Training Format";
|
| 55 |
|
|
|
|
| 66 |
const C_DIM = 0x42505d; // grey (degraded / no-live-data)
|
| 67 |
const C_GRID = 0x1b3a44; // floor / link colour
|
| 68 |
|
| 69 |
+
let _stage = null, _THREE = null, _ctx = null, _group = null, _show = null;
|
| 70 |
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
|
|
|
| 71 |
|
| 72 |
// geometry handles
|
| 73 |
let _floor = null;
|
|
|
|
| 356 |
// =============================================================================
|
| 357 |
function _buildOverlay() {
|
| 358 |
const ctx = _ctx;
|
| 359 |
+
_show = createShowcase(ctx, {
|
| 360 |
+
id: ID, title: TITLE + " (live)", accent: "#5b8dee",
|
| 361 |
+
badge: _badge,
|
| 362 |
+
chips: [{ label: "MODELED", text: "FP4 arithmetic", name: "nv" }],
|
| 363 |
+
legend: ["MODELED", "SAMPLE"],
|
| 364 |
+
description:
|
| 365 |
+
'A synthetic tensor with a few injected <b>outliers</b> is quantized to 4-bit float (<b>FP4 E2M1</b>) three ways, ' +
|
| 366 |
+
'then dequantized: <b>naive</b> (one global scale) vs <b>MXFP4</b> (32-elem blocks, power-of-two scale) vs ' +
|
| 367 |
+
'<b>NVFP4</b> (16-elem blocks, <b>E4M3</b> FP8 block scale + <b>FP32</b> global \u2014 <b>two-level</b>). Bars show ' +
|
| 368 |
+
'the MEASURED reconstruction <b>MSE</b> per scheme (shown, NOT hidden). The line plot contrasts <b>deterministic</b> ' +
|
| 369 |
+
'round-to-nearest (drifts) vs <b>stochastic</b> rounding (near zero) over repeated roundings. Honesty label ' +
|
| 370 |
+
'<b>MODELED</b> \u2014 arithmetic demonstration only, no GPU kernel executed. 0 runtime CDN.',
|
| 371 |
+
citations:
|
| 372 |
+
"NVFP4 \u2014 Agrusa, Rouhani, Micikevicius, Patwary, Shoeybi et al. (NVIDIA) arXiv:2509.25149 \u00b7 MXFP4/OCP arXiv:2310.10537 \u00b7 TetraJet arXiv:2502.20853. MODELED \u00b7 arithmetic-only \u00b7 not claimed-as.",
|
| 373 |
+
plain: { html: _plainHtml },
|
| 374 |
});
|
| 375 |
|
| 376 |
+
_el["nv-size"] = _show.addField("tensor (size \u00d7 size)");
|
| 377 |
+
_el["nv-outl"] = _show.addField("injected outliers");
|
| 378 |
+
_el["nv-amax"] = _show.addField("tensor max |value|");
|
| 379 |
+
_el["nv-naive"] = _show.addField("MSE \u2014 naive-FP4 (global scale)");
|
| 380 |
+
_el["nv-mx"] = _show.addField("MSE \u2014 MXFP4 (32-blk pow2)");
|
| 381 |
+
_el["nv-nv"] = _show.addField("MSE \u2014 NVFP4 (16-blk E4M3+FP32)");
|
| 382 |
+
_el["nv-best"] = _show.addField("best scheme (lowest MSE)");
|
| 383 |
+
_el["nv-rn"] = _show.addField("rounding demo \u2014 N roundings");
|
| 384 |
+
_el["nv-det"] = _show.addField("cumulative bias \u2014 deterministic");
|
| 385 |
+
_el["nv-stoch"] = _show.addField("cumulative bias \u2014 stochastic");
|
| 386 |
+
_el["nv-label"] = _show.addField("honesty label");
|
| 387 |
+
|
| 388 |
+
// scaling-pipeline legend (two-level) \u2014 appended into the collapsible body
|
| 389 |
+
_show.appendBody(
|
| 390 |
+
"<div style='font-size:10px;color:#9fb1bf;line-height:1.5'>" +
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 391 |
"<b style='color:#c9d6df'>two-level scaling pipeline:</b><br>" +
|
| 392 |
"tensor <span style='color:#8a6bff'>\u25a0</span> \u2192 FP32 global scale <span style='color:#8a6bff'>\u25c8</span> " +
|
| 393 |
+
"\u2192 E4M3 block scale <span style='color:#5b8dee'>\u25c8</span> \u2192 FP4 value <span style='color:#3af4c8'>\u2b21</span>" +
|
| 394 |
+
"</div>");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 395 |
|
|
|
|
| 396 |
_paintOverlay();
|
| 397 |
}
|
| 398 |
|
| 399 |
+
function _plainHtml() {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 400 |
const nvMse = _schemeByName("NVFP4");
|
| 401 |
const naiveMse = _schemeByName("naive-FP4");
|
| 402 |
const nvTxt = (nvMse && typeof nvMse.mse === "number") ? nvMse.mse.toExponential(2) : "loading\u2026";
|
| 403 |
const naiveTxt = (naiveMse && typeof naiveMse.mse === "number") ? naiveMse.mse.toExponential(2) : "loading\u2026";
|
| 404 |
const detTxt = S.detFinal != null ? S.detFinal.toFixed(2) : "loading\u2026";
|
| 405 |
const stochTxt = S.stochFinal != null ? S.stochFinal.toFixed(2) : "loading\u2026";
|
| 406 |
+
return (
|
| 407 |
"<b>What this means:</b> Training big models in only 4 bits per number saves memory and speeds up the math, " +
|
| 408 |
"but 4 bits is very coarse \u2014 so how you pick the <i>scale</i> matters enormously. The <b>naive</b> approach uses " +
|
| 409 |
"one scale for the whole tensor; a single large \u201coutlier\u201d value then crushes precision for everything else " +
|
|
|
|
| 414 |
"<b>stochastic</b> rounding \u2014 flipping a weighted coin each time \u2014 cancels out (stays near <b>" + stochTxt + "</b>). " +
|
| 415 |
"This view is <b>MODELED</b>: a deterministic arithmetic demonstration on a tiny synthetic tensor, with the error " +
|
| 416 |
"MEASURED and shown. <b>No GPU kernel runs here</b>, and it does not reproduce NVIDIA's 12-billion-parameter, " +
|
| 417 |
+
"10-trillion-token training run or its speed claims \u2014 those are NVIDIA's, not independently verified.");
|
| 418 |
}
|
| 419 |
|
| 420 |
function _tok(s) {
|
|
|
|
| 445 |
_set("nv-stoch", t || (typeof S.stochFinal === "number" ? S.stochFinal.toFixed(3) : "\u2014"));
|
| 446 |
// honesty label verbatim — never upgraded
|
| 447 |
_set("nv-label", t || (S.label || "MODELED"));
|
| 448 |
+
if (_show) { _show.setChip("nv", S.label || "MODELED", { text: "FP4 arithmetic" }); _show.refreshPlain(); }
|
| 449 |
}
|
| 450 |
|
| 451 |
// =============================================================================
|
|
|
|
| 453 |
// =============================================================================
|
| 454 |
export function unmount() {
|
| 455 |
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 456 |
+
try { if (_show) _show.destroy(); } catch (_) {}
|
| 457 |
try {
|
| 458 |
if (_group && _stage) {
|
| 459 |
_group.traverse((o) => {
|
|
|
|
| 466 |
_stage.scene.remove(_group);
|
| 467 |
}
|
| 468 |
} catch (_) {}
|
| 469 |
+
_group = _show = null;
|
| 470 |
_floor = null; _bars = []; _detLine = null; _stochLine = null; _biasZero = null; _pipe = [];
|
| 471 |
+
_el = {}; _badge = null; _frameReg = false;
|
| 472 |
_stage = _THREE = _ctx = null;
|
| 473 |
S.label = S.size = S.outliers = S.tensorAmax = S.bestScheme = null;
|
| 474 |
S.fp4Levels = S.schemes = null;
|
static/3d/surfaces/opera.js
CHANGED
|
@@ -41,6 +41,8 @@
|
|
| 41 |
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 42 |
// Nothing here is in the locked-8. Λ stays Conjecture 1. Trust never 100%.
|
| 43 |
|
|
|
|
|
|
|
| 44 |
const ID = "opera";
|
| 45 |
const TITLE = "OPERA Perplexity-Reward Alignment";
|
| 46 |
|
|
@@ -63,9 +65,8 @@ const CURVE_MAXN = 6; // max curves rendered (matches head trim)
|
|
| 63 |
const CURVE_MAXP = 64; // max points per curve
|
| 64 |
const BAR_W = 0.8; // reward-bar width
|
| 65 |
|
| 66 |
-
let _stage = null, _THREE = null, _ctx = null, _group = null,
|
| 67 |
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
| 68 |
-
let _plain = false;
|
| 69 |
|
| 70 |
// geometry handles
|
| 71 |
let _floor = null;
|
|
@@ -357,114 +358,44 @@ function _onFrame() {
|
|
| 357 |
// =============================================================================
|
| 358 |
function _buildOverlay() {
|
| 359 |
const ctx = _ctx;
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
sub.innerHTML =
|
| 377 |
-
'OPERA replaces an unreliable <b>LLM-as-a-judge</b> reward (prone to stylistic bias and positional ' +
|
| 378 |
-
'inconsistency) with an <b>intrinsic reward from perplexity dynamics</b>: the uncertainty reduction ' +
|
| 379 |
-
'(perplexity <b>drop</b>) at <b>critical reflective states</b> of a reasoning trace. Panels: per-trace ' +
|
| 380 |
-
'perplexity curves (drops at reflective steps = where reward accrues), reward\u2013correlation bars ' +
|
| 381 |
-
'(OPERA vs noisy judge against the ground-truth logical-consistency label), and reward-stability bars ' +
|
| 382 |
-
'(variance; the judge is the taller/unstable one). Honesty label <b>MODELED</b> (deterministic mechanism ' +
|
| 383 |
-
'reproduction on toy traces; trains nothing). 0 runtime CDN.';
|
| 384 |
-
_overlay.appendChild(sub);
|
| 385 |
-
|
| 386 |
-
const brow = document.createElement("div");
|
| 387 |
-
brow.style.cssText = "display:flex;gap:8px;align-items:center;flex-wrap:wrap";
|
| 388 |
-
if (_badge && _badge.el) brow.appendChild(_badge.el);
|
| 389 |
-
_overlay.appendChild(brow);
|
| 390 |
-
|
| 391 |
-
const card = document.createElement("div");
|
| 392 |
-
card.style.cssText = "background:#0a1117;border:1px solid #1d2a36;border-radius:9px;padding:9px 10px;display:flex;flex-direction:column;gap:6px";
|
| 393 |
-
|
| 394 |
-
const chead = document.createElement("div");
|
| 395 |
-
chead.style.cssText = "display:flex;align-items:center;gap:8px;flex-wrap:wrap";
|
| 396 |
-
const dot = document.createElement("span");
|
| 397 |
-
dot.style.cssText = "width:9px;height:9px;border-radius:50%;background:#3af4c8;box-shadow:0 0 7px #3af4c8";
|
| 398 |
-
const nm = document.createElement("b");
|
| 399 |
-
nm.style.cssText = "font-size:12px;color:#3af4c8;letter-spacing:.3px";
|
| 400 |
-
nm.textContent = "opera \u00b7 intrinsic perplexity reward";
|
| 401 |
-
chead.appendChild(dot); chead.appendChild(nm);
|
| 402 |
-
card.appendChild(chead);
|
| 403 |
-
|
| 404 |
-
const grid = document.createElement("div");
|
| 405 |
-
grid.style.cssText = "display:grid;grid-template-columns:1fr;gap:4px";
|
| 406 |
-
|
| 407 |
-
function kpiRow(id, label) {
|
| 408 |
-
const r = document.createElement("div");
|
| 409 |
-
r.style.cssText = "display:flex;justify-content:space-between;gap:10px;font-size:11px";
|
| 410 |
-
const l = document.createElement("span"); l.style.cssText = "color:#9fb1bf"; l.textContent = label;
|
| 411 |
-
const v = document.createElement("b");
|
| 412 |
-
v.id = id;
|
| 413 |
-
v.style.cssText = "font-variant-numeric:tabular-nums;color:#eef3f6;text-align:right;max-width:56%";
|
| 414 |
-
v.textContent = "\u2014";
|
| 415 |
-
_el[id] = v;
|
| 416 |
-
r.appendChild(l); r.appendChild(v); return r;
|
| 417 |
-
}
|
| 418 |
-
|
| 419 |
-
grid.appendChild(kpiRow("op-dims", "traces \u00d7 steps"));
|
| 420 |
-
grid.appendChild(kpiRow("op-refl", "reflective steps"));
|
| 421 |
-
grid.appendChild(kpiRow("op-oreward", "OPERA reward \u2014 mean (MEASURED)"));
|
| 422 |
-
grid.appendChild(kpiRow("op-jreward", "judge reward \u2014 mean (MEASURED)"));
|
| 423 |
-
grid.appendChild(kpiRow("op-corropera","corr(OPERA, consistency)"));
|
| 424 |
-
grid.appendChild(kpiRow("op-corrjudge","corr(judge, consistency)"));
|
| 425 |
-
grid.appendChild(kpiRow("op-ovar", "OPERA reward variance"));
|
| 426 |
-
grid.appendChild(kpiRow("op-jvar", "judge reward variance (higher=unstable)"));
|
| 427 |
-
grid.appendChild(kpiRow("op-cons", "consistency rate (ground truth)"));
|
| 428 |
-
grid.appendChild(kpiRow("op-label", "honesty label"));
|
| 429 |
-
card.appendChild(grid);
|
| 430 |
-
|
| 431 |
-
const fn = document.createElement("div");
|
| 432 |
-
fn.style.cssText = "font-size:9.5px;color:#6b7a86;line-height:1.5";
|
| 433 |
-
fn.textContent = "OPERA \u2014 Wenxuan Jiang et al., \u201cAligning Open-Ended Reasoning via Objective Perplexity-based Reinforcement Learning\u201d arXiv:2606.25757 (arxiv.org/abs/2606.25757). MODELED \u00b7 intrinsic perplexity-reward mechanism demo on toy traces, not a trained model or real RL rollout.";
|
| 434 |
-
card.appendChild(fn);
|
| 435 |
-
_overlay.appendChild(card);
|
| 436 |
-
|
| 437 |
-
const pl = document.createElement("button");
|
| 438 |
-
pl.textContent = "\u25d1 what this means";
|
| 439 |
-
pl.title = "Toggle plain-language explanation for investors & consumers.";
|
| 440 |
-
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";
|
| 441 |
-
pl.addEventListener("click", () => {
|
| 442 |
-
_plain = !_plain;
|
| 443 |
-
pl.style.background = _plain ? "#0f2a20" : "#08140f";
|
| 444 |
-
_applyPlain();
|
| 445 |
});
|
| 446 |
-
_overlay.appendChild(pl);
|
| 447 |
|
| 448 |
-
|
| 449 |
-
|
| 450 |
-
|
| 451 |
-
_el["
|
| 452 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 453 |
|
| 454 |
-
(ctx.container || document.body).appendChild(_overlay);
|
| 455 |
_paintOverlay();
|
| 456 |
}
|
| 457 |
|
| 458 |
-
function
|
| 459 |
-
const pd = _el["plain"];
|
| 460 |
-
if (!pd) return;
|
| 461 |
-
pd.style.display = _plain ? "block" : "none";
|
| 462 |
-
if (!_plain) return;
|
| 463 |
const co = S.corrOpera != null ? S.corrOpera.toFixed(2) : "loading\u2026";
|
| 464 |
const cj = S.corrJudge != null ? S.corrJudge.toFixed(2) : "loading\u2026";
|
| 465 |
const jv = S.judgeVar != null ? S.judgeVar.toFixed(2) : "loading\u2026";
|
| 466 |
const ov = S.operaVar != null ? S.operaVar.toFixed(2) : "loading\u2026";
|
| 467 |
-
|
| 468 |
"<b>What this means:</b> To train a model on open-ended tasks (like creative writing) you need a " +
|
| 469 |
"<b>reward</b> \u2014 a score for how good an answer is. A common trick is to ask another AI to be the " +
|
| 470 |
"\u201cjudge,\u201d but judges are swayed by <b>style and ordering</b>, so their scores are noisy and " +
|
|
@@ -477,7 +408,7 @@ function _applyPlain() {
|
|
| 477 |
"deterministic reproduction of that reward MECHANISM on tiny synthetic traces \u2014 it <b>trains no " +
|
| 478 |
"model</b> and runs no reinforcement learning. The paper\u2019s headline that OPERA on <b>Qwen3-8B</b> " +
|
| 479 |
"reaches SOTA and rivals Gemini2.5 / MiniMax-M2.5 is a <b>claim about real training runs</b> " +
|
| 480 |
-
"the estate does not independently verify.";
|
| 481 |
}
|
| 482 |
|
| 483 |
function _tok(s) {
|
|
@@ -504,7 +435,7 @@ function _paintOverlay() {
|
|
| 504 |
_set("op-cons", t || (S.consRate != null ? (100.0 * S.consRate).toFixed(1) + "%" : "\u2014"));
|
| 505 |
// honesty label verbatim — never upgraded
|
| 506 |
_set("op-label", t || (S.label || "MODELED"));
|
| 507 |
-
if (
|
| 508 |
}
|
| 509 |
|
| 510 |
// =============================================================================
|
|
@@ -512,7 +443,7 @@ function _paintOverlay() {
|
|
| 512 |
// =============================================================================
|
| 513 |
export function unmount() {
|
| 514 |
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 515 |
-
try { if (
|
| 516 |
try {
|
| 517 |
if (_group && _stage) {
|
| 518 |
_group.traverse((o) => {
|
|
@@ -525,13 +456,13 @@ export function unmount() {
|
|
| 525 |
_stage.scene.remove(_group);
|
| 526 |
}
|
| 527 |
} catch (_) {}
|
| 528 |
-
_group =
|
| 529 |
_floor = null;
|
| 530 |
_curveGroup = null; _curves = [];
|
| 531 |
_reflGroup = null; _reflMarks = [];
|
| 532 |
_barGroup = null;
|
| 533 |
_barCorrOpera = _barCorrJudge = _barVarOpera = _barVarJudge = null;
|
| 534 |
-
_el = {}; _badge = null;
|
| 535 |
_stage = _THREE = _ctx = null;
|
| 536 |
S.label = S.traces = S.steps = S.reflective = null;
|
| 537 |
S.operaReward = S.operaVar = S.judgeReward = S.judgeVar = null;
|
|
|
|
| 41 |
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 42 |
// Nothing here is in the locked-8. Λ stays Conjecture 1. Trust never 100%.
|
| 43 |
|
| 44 |
+
import { createShowcase } from "./_showcase.js";
|
| 45 |
+
|
| 46 |
const ID = "opera";
|
| 47 |
const TITLE = "OPERA Perplexity-Reward Alignment";
|
| 48 |
|
|
|
|
| 65 |
const CURVE_MAXP = 64; // max points per curve
|
| 66 |
const BAR_W = 0.8; // reward-bar width
|
| 67 |
|
| 68 |
+
let _stage = null, _THREE = null, _ctx = null, _group = null, _show = null;
|
| 69 |
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
|
|
|
| 70 |
|
| 71 |
// geometry handles
|
| 72 |
let _floor = null;
|
|
|
|
| 358 |
// =============================================================================
|
| 359 |
function _buildOverlay() {
|
| 360 |
const ctx = _ctx;
|
| 361 |
+
_show = createShowcase(ctx, {
|
| 362 |
+
id: ID, title: TITLE, accent: "#3af4c8",
|
| 363 |
+
badge: _badge,
|
| 364 |
+
chips: [{ label: "MODELED", text: "intrinsic perplexity reward", name: "op" }],
|
| 365 |
+
legend: ["MODELED", "SAMPLE"],
|
| 366 |
+
description:
|
| 367 |
+
'OPERA replaces an unreliable <b>LLM-as-a-judge</b> reward (prone to stylistic bias and positional ' +
|
| 368 |
+
'inconsistency) with an <b>intrinsic reward from perplexity dynamics</b>: the uncertainty reduction ' +
|
| 369 |
+
'(perplexity <b>drop</b>) at <b>critical reflective states</b> of a reasoning trace. Panels: per-trace ' +
|
| 370 |
+
'perplexity curves (drops at reflective steps = where reward accrues), reward\u2013correlation bars ' +
|
| 371 |
+
'(OPERA vs noisy judge against the ground-truth logical-consistency label), and reward-stability bars ' +
|
| 372 |
+
'(variance; the judge is the taller/unstable one). Honesty label <b>MODELED</b> (deterministic mechanism ' +
|
| 373 |
+
'reproduction on toy traces; trains nothing). 0 runtime CDN.',
|
| 374 |
+
citations:
|
| 375 |
+
"OPERA \u2014 Wenxuan Jiang et al., \u201cAligning Open-Ended Reasoning via Objective Perplexity-based Reinforcement Learning\u201d arXiv:2606.25757 (arxiv.org/abs/2606.25757). MODELED \u00b7 intrinsic perplexity-reward mechanism demo on toy traces, not a trained model or real RL rollout.",
|
| 376 |
+
plain: { html: _plainHtml },
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 377 |
});
|
|
|
|
| 378 |
|
| 379 |
+
_el["op-dims"] = _show.addField("traces \u00d7 steps");
|
| 380 |
+
_el["op-refl"] = _show.addField("reflective steps");
|
| 381 |
+
_el["op-oreward"] = _show.addField("OPERA reward \u2014 mean (MEASURED)");
|
| 382 |
+
_el["op-jreward"] = _show.addField("judge reward \u2014 mean (MEASURED)");
|
| 383 |
+
_el["op-corropera"] = _show.addField("corr(OPERA, consistency)");
|
| 384 |
+
_el["op-corrjudge"] = _show.addField("corr(judge, consistency)");
|
| 385 |
+
_el["op-ovar"] = _show.addField("OPERA reward variance");
|
| 386 |
+
_el["op-jvar"] = _show.addField("judge reward variance (higher=unstable)");
|
| 387 |
+
_el["op-cons"] = _show.addField("consistency rate (ground truth)");
|
| 388 |
+
_el["op-label"] = _show.addField("honesty label");
|
| 389 |
|
|
|
|
| 390 |
_paintOverlay();
|
| 391 |
}
|
| 392 |
|
| 393 |
+
function _plainHtml() {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 394 |
const co = S.corrOpera != null ? S.corrOpera.toFixed(2) : "loading\u2026";
|
| 395 |
const cj = S.corrJudge != null ? S.corrJudge.toFixed(2) : "loading\u2026";
|
| 396 |
const jv = S.judgeVar != null ? S.judgeVar.toFixed(2) : "loading\u2026";
|
| 397 |
const ov = S.operaVar != null ? S.operaVar.toFixed(2) : "loading\u2026";
|
| 398 |
+
return (
|
| 399 |
"<b>What this means:</b> To train a model on open-ended tasks (like creative writing) you need a " +
|
| 400 |
"<b>reward</b> \u2014 a score for how good an answer is. A common trick is to ask another AI to be the " +
|
| 401 |
"\u201cjudge,\u201d but judges are swayed by <b>style and ordering</b>, so their scores are noisy and " +
|
|
|
|
| 408 |
"deterministic reproduction of that reward MECHANISM on tiny synthetic traces \u2014 it <b>trains no " +
|
| 409 |
"model</b> and runs no reinforcement learning. The paper\u2019s headline that OPERA on <b>Qwen3-8B</b> " +
|
| 410 |
"reaches SOTA and rivals Gemini2.5 / MiniMax-M2.5 is a <b>claim about real training runs</b> " +
|
| 411 |
+
"the estate does not independently verify.");
|
| 412 |
}
|
| 413 |
|
| 414 |
function _tok(s) {
|
|
|
|
| 435 |
_set("op-cons", t || (S.consRate != null ? (100.0 * S.consRate).toFixed(1) + "%" : "\u2014"));
|
| 436 |
// honesty label verbatim — never upgraded
|
| 437 |
_set("op-label", t || (S.label || "MODELED"));
|
| 438 |
+
if (_show) { _show.setChip("op", S.label || "MODELED", { text: "intrinsic perplexity reward" }); _show.refreshPlain(); }
|
| 439 |
}
|
| 440 |
|
| 441 |
// =============================================================================
|
|
|
|
| 443 |
// =============================================================================
|
| 444 |
export function unmount() {
|
| 445 |
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 446 |
+
try { if (_show) _show.destroy(); } catch (_) {}
|
| 447 |
try {
|
| 448 |
if (_group && _stage) {
|
| 449 |
_group.traverse((o) => {
|
|
|
|
| 456 |
_stage.scene.remove(_group);
|
| 457 |
}
|
| 458 |
} catch (_) {}
|
| 459 |
+
_group = _show = null;
|
| 460 |
_floor = null;
|
| 461 |
_curveGroup = null; _curves = [];
|
| 462 |
_reflGroup = null; _reflMarks = [];
|
| 463 |
_barGroup = null;
|
| 464 |
_barCorrOpera = _barCorrJudge = _barVarOpera = _barVarJudge = null;
|
| 465 |
+
_el = {}; _badge = null; _frameReg = false;
|
| 466 |
_stage = _THREE = _ctx = null;
|
| 467 |
S.label = S.traces = S.steps = S.reflective = null;
|
| 468 |
S.operaReward = S.operaVar = S.judgeReward = S.judgeVar = null;
|
static/3d/surfaces/pfield.js
CHANGED
|
@@ -45,6 +45,8 @@
|
|
| 45 |
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 46 |
// Nothing here is in the locked-8. Λ stays Conjecture 1. Trust never 100%.
|
| 47 |
|
|
|
|
|
|
|
| 48 |
const ID = "pfield";
|
| 49 |
const TITLE = "PFIELD · Pressure-Field Stigmergic Coordination (live)";
|
| 50 |
|
|
@@ -69,9 +71,8 @@ const ABL_LEN = 6.0; // world-length of the ablation bar pair along X
|
|
| 69 |
const AGENT_ORBIT = 5.4; // radius agents orbit the artifact at (visual only)
|
| 70 |
const MAX_AGENTS = 32; // cap on agent motes rendered
|
| 71 |
|
| 72 |
-
let _stage = null, _THREE = null, _ctx = null, _group = null,
|
| 73 |
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
| 74 |
-
let _plain = false;
|
| 75 |
|
| 76 |
// geometry handles
|
| 77 |
let _floor = null;
|
|
@@ -373,112 +374,42 @@ function _onFrame() {
|
|
| 373 |
// =============================================================================
|
| 374 |
function _buildOverlay() {
|
| 375 |
const ctx = _ctx;
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
sub.style.cssText = "color:#9fb1bf;font-size:11px;line-height:1.55";
|
| 392 |
-
sub.innerHTML =
|
| 393 |
-
'Instead of a planner messaging executors, N agents coordinate <b>implicitly</b> through a ' +
|
| 394 |
-
'shared constraint-grid artifact: each agent reads a local <b>pressure</b> (constraint-violation ' +
|
| 395 |
-
'count), takes the pressure-reducing edit, and a <b>temporal-decay</b> schedule keeps stale ' +
|
| 396 |
-
'pressure from locking the system in \u2014 <b>zero inter-agent messages</b> (stigmergy). Shown ' +
|
| 397 |
-
'against sequential + hierarchical baselines. Honesty label <b>MODELED</b> (deterministic ' +
|
| 398 |
-
'simulation; NOT real agents). 0 runtime CDN.';
|
| 399 |
-
_overlay.appendChild(sub);
|
| 400 |
-
|
| 401 |
-
const brow = document.createElement("div");
|
| 402 |
-
brow.style.cssText = "display:flex;gap:8px;align-items:center;flex-wrap:wrap";
|
| 403 |
-
if (_badge && _badge.el) brow.appendChild(_badge.el);
|
| 404 |
-
_overlay.appendChild(brow);
|
| 405 |
-
|
| 406 |
-
const card = document.createElement("div");
|
| 407 |
-
card.style.cssText = "background:#0a1117;border:1px solid #1d2a36;border-radius:9px;padding:9px 10px;display:flex;flex-direction:column;gap:6px";
|
| 408 |
-
|
| 409 |
-
const chead = document.createElement("div");
|
| 410 |
-
chead.style.cssText = "display:flex;align-items:center;gap:8px;flex-wrap:wrap";
|
| 411 |
-
const dot = document.createElement("span");
|
| 412 |
-
dot.style.cssText = "width:9px;height:9px;border-radius:50%;background:#3af4c8;box-shadow:0 0 7px #3af4c8";
|
| 413 |
-
const nm = document.createElement("b");
|
| 414 |
-
nm.style.cssText = "font-size:12px;color:#3af4c8;letter-spacing:.3px";
|
| 415 |
-
nm.textContent = "pressure-field coordination";
|
| 416 |
-
chead.appendChild(dot); chead.appendChild(nm);
|
| 417 |
-
card.appendChild(chead);
|
| 418 |
-
|
| 419 |
-
const grid = document.createElement("div");
|
| 420 |
-
grid.style.cssText = "display:grid;grid-template-columns:1fr;gap:4px";
|
| 421 |
-
|
| 422 |
-
function kpiRow(id, label) {
|
| 423 |
-
const r = document.createElement("div");
|
| 424 |
-
r.style.cssText = "display:flex;justify-content:space-between;gap:10px;font-size:11px";
|
| 425 |
-
const l = document.createElement("span"); l.style.cssText = "color:#9fb1bf"; l.textContent = label;
|
| 426 |
-
const v = document.createElement("b");
|
| 427 |
-
v.id = id;
|
| 428 |
-
v.style.cssText = "font-variant-numeric:tabular-nums;color:#eef3f6;text-align:right;max-width:58%";
|
| 429 |
-
v.textContent = "\u2014";
|
| 430 |
-
_el[id] = v;
|
| 431 |
-
r.appendChild(l); r.appendChild(v); return r;
|
| 432 |
-
}
|
| 433 |
-
|
| 434 |
-
grid.appendChild(kpiRow("pf-agents", "n_agents \u00d7 grid"));
|
| 435 |
-
grid.appendChild(kpiRow("pf-decay", "temporal decay (per step)"));
|
| 436 |
-
grid.appendChild(kpiRow("pf-steps", "pfield steps-to-converge \u2014 MODELED"));
|
| 437 |
-
grid.appendChild(kpiRow("pf-msgs", "pfield inter-agent messages"));
|
| 438 |
-
grid.appendChild(kpiRow("pf-seq", "sequential steps-to-converge \u2014 MODELED"));
|
| 439 |
-
grid.appendChild(kpiRow("pf-hier", "hierarchical steps / messages \u2014 MODELED"));
|
| 440 |
-
grid.appendChild(kpiRow("pf-match", "pfield matches hierarchical?"));
|
| 441 |
-
grid.appendChild(kpiRow("pf-runaway", "no-decay pressure runaway \u2014 MODELED"));
|
| 442 |
-
grid.appendChild(kpiRow("pf-label", "honesty label"));
|
| 443 |
-
card.appendChild(grid);
|
| 444 |
-
|
| 445 |
-
const fn = document.createElement("div");
|
| 446 |
-
fn.style.cssText = "font-size:9.5px;color:#6b7a86;line-height:1.5";
|
| 447 |
-
fn.textContent = "Rodriguez 2026 \u00b7 Pressure Fields + Temporal Decay \u00b7 arXiv:2601.08129. MODELED \u00b7 not claimed-as.";
|
| 448 |
-
card.appendChild(fn);
|
| 449 |
-
_overlay.appendChild(card);
|
| 450 |
-
|
| 451 |
-
const pl = document.createElement("button");
|
| 452 |
-
pl.textContent = "\u25d1 what this means";
|
| 453 |
-
pl.title = "Toggle plain-language explanation for investors & consumers.";
|
| 454 |
-
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";
|
| 455 |
-
pl.addEventListener("click", () => {
|
| 456 |
-
_plain = !_plain;
|
| 457 |
-
pl.style.background = _plain ? "#0f2a20" : "#08140f";
|
| 458 |
-
_applyPlain();
|
| 459 |
});
|
| 460 |
-
_overlay.appendChild(pl);
|
| 461 |
|
| 462 |
-
|
| 463 |
-
|
| 464 |
-
|
| 465 |
-
_el["
|
| 466 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 467 |
|
| 468 |
-
(ctx.container || document.body).appendChild(_overlay);
|
| 469 |
_paintOverlay();
|
| 470 |
}
|
| 471 |
|
| 472 |
-
function
|
| 473 |
-
const pd = _el["plain"];
|
| 474 |
-
if (!pd) return;
|
| 475 |
-
pd.style.display = _plain ? "block" : "none";
|
| 476 |
-
if (!_plain) return;
|
| 477 |
const na = S.nAgents != null ? String(S.nAgents) : "loading\u2026";
|
| 478 |
const pfs = S.stepsConv != null ? String(S.stepsConv) : "loading\u2026";
|
| 479 |
const hms = S.hierMsgs != null ? String(S.hierMsgs) : "loading\u2026";
|
| 480 |
const rw = S.runawayX != null ? S.runawayX.toFixed(0) + "x" : "loading\u2026";
|
| 481 |
-
|
| 482 |
"<b>What this means:</b> Getting many AI agents to work together usually needs a <i>boss</i> agent " +
|
| 483 |
"that hands out tasks and collects results \u2014 lots of back-and-forth messages that pile up as you add " +
|
| 484 |
"workers. This approach skips the boss entirely. All <b>" + na + " agents</b> scribble on one shared " +
|
|
@@ -487,7 +418,7 @@ function _applyPlain() {
|
|
| 487 |
"another. Here it finishes in about <b>" + pfs + " rounds with zero messages</b>, matching the boss-based " +
|
| 488 |
"method that needed roughly <b>" + hms + " messages</b>. One catch: the pressure has to <b>fade over time</b>, " +
|
| 489 |
"or it snowballs \u2014 turning decay off makes the pressure blow up about <b>" + rw + "</b>. This view is a " +
|
| 490 |
-
"<b>MODELED</b> deterministic simulation of that coordination math, not a run of real AI agents.";
|
| 491 |
}
|
| 492 |
|
| 493 |
function _tok(s) {
|
|
@@ -513,7 +444,7 @@ function _paintOverlay() {
|
|
| 513 |
_set("pf-runaway", t || (S.runawayX != null ? (S.runawayX.toFixed(1) + "\u00d7 without decay") : "\u2014"));
|
| 514 |
// honesty label verbatim — never upgraded
|
| 515 |
_set("pf-label", t || (S.label || "MODELED"));
|
| 516 |
-
if (
|
| 517 |
}
|
| 518 |
|
| 519 |
// =============================================================================
|
|
@@ -536,7 +467,7 @@ function _disposeCells() {
|
|
| 536 |
|
| 537 |
export function unmount() {
|
| 538 |
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 539 |
-
try { if (
|
| 540 |
try {
|
| 541 |
if (_group && _stage) {
|
| 542 |
_group.traverse((o) => {
|
|
@@ -549,10 +480,10 @@ export function unmount() {
|
|
| 549 |
_stage.scene.remove(_group);
|
| 550 |
}
|
| 551 |
} catch (_) {}
|
| 552 |
-
_group =
|
| 553 |
_floor = null; _cells = []; _cellSide = 0; _agents = [];
|
| 554 |
_ablDecay = null; _ablNoDecay = null;
|
| 555 |
-
_el = {}; _badge = null;
|
| 556 |
_stage = _THREE = _ctx = null;
|
| 557 |
S.label = S.nAgents = S.grid = S.decay = S.steps = null;
|
| 558 |
S.solved = S.stepsConv = S.finalViol = S.peakPress = S.messages = null;
|
|
|
|
| 45 |
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 46 |
// Nothing here is in the locked-8. Λ stays Conjecture 1. Trust never 100%.
|
| 47 |
|
| 48 |
+
import { createShowcase } from "./_showcase.js";
|
| 49 |
+
|
| 50 |
const ID = "pfield";
|
| 51 |
const TITLE = "PFIELD · Pressure-Field Stigmergic Coordination (live)";
|
| 52 |
|
|
|
|
| 71 |
const AGENT_ORBIT = 5.4; // radius agents orbit the artifact at (visual only)
|
| 72 |
const MAX_AGENTS = 32; // cap on agent motes rendered
|
| 73 |
|
| 74 |
+
let _stage = null, _THREE = null, _ctx = null, _group = null, _show = null;
|
| 75 |
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
|
|
|
| 76 |
|
| 77 |
// geometry handles
|
| 78 |
let _floor = null;
|
|
|
|
| 374 |
// =============================================================================
|
| 375 |
function _buildOverlay() {
|
| 376 |
const ctx = _ctx;
|
| 377 |
+
_show = createShowcase(ctx, {
|
| 378 |
+
id: ID, title: TITLE, accent: "#3af4c8",
|
| 379 |
+
badge: _badge,
|
| 380 |
+
chips: [{ label: "MODELED", text: "pressure-field coordination", name: "pf" }],
|
| 381 |
+
legend: ["MODELED", "SAMPLE"],
|
| 382 |
+
description:
|
| 383 |
+
'Instead of a planner messaging executors, N agents coordinate <b>implicitly</b> through a ' +
|
| 384 |
+
'shared constraint-grid artifact: each agent reads a local <b>pressure</b> (constraint-violation ' +
|
| 385 |
+
'count), takes the pressure-reducing edit, and a <b>temporal-decay</b> schedule keeps stale ' +
|
| 386 |
+
'pressure from locking the system in \u2014 <b>zero inter-agent messages</b> (stigmergy). Shown ' +
|
| 387 |
+
'against sequential + hierarchical baselines. Honesty label <b>MODELED</b> (deterministic ' +
|
| 388 |
+
'simulation; NOT real agents). 0 runtime CDN.',
|
| 389 |
+
citations:
|
| 390 |
+
"Rodriguez 2026 \u00b7 Pressure Fields + Temporal Decay \u00b7 arXiv:2601.08129. MODELED \u00b7 not claimed-as.",
|
| 391 |
+
plain: { html: _plainHtml },
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 392 |
});
|
|
|
|
| 393 |
|
| 394 |
+
_el["pf-agents"] = _show.addField("n_agents \u00d7 grid");
|
| 395 |
+
_el["pf-decay"] = _show.addField("temporal decay (per step)");
|
| 396 |
+
_el["pf-steps"] = _show.addField("pfield steps-to-converge \u2014 MODELED");
|
| 397 |
+
_el["pf-msgs"] = _show.addField("pfield inter-agent messages");
|
| 398 |
+
_el["pf-seq"] = _show.addField("sequential steps-to-converge \u2014 MODELED");
|
| 399 |
+
_el["pf-hier"] = _show.addField("hierarchical steps / messages \u2014 MODELED");
|
| 400 |
+
_el["pf-match"] = _show.addField("pfield matches hierarchical?");
|
| 401 |
+
_el["pf-runaway"] = _show.addField("no-decay pressure runaway \u2014 MODELED");
|
| 402 |
+
_el["pf-label"] = _show.addField("honesty label");
|
| 403 |
|
|
|
|
| 404 |
_paintOverlay();
|
| 405 |
}
|
| 406 |
|
| 407 |
+
function _plainHtml() {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 408 |
const na = S.nAgents != null ? String(S.nAgents) : "loading\u2026";
|
| 409 |
const pfs = S.stepsConv != null ? String(S.stepsConv) : "loading\u2026";
|
| 410 |
const hms = S.hierMsgs != null ? String(S.hierMsgs) : "loading\u2026";
|
| 411 |
const rw = S.runawayX != null ? S.runawayX.toFixed(0) + "x" : "loading\u2026";
|
| 412 |
+
return (
|
| 413 |
"<b>What this means:</b> Getting many AI agents to work together usually needs a <i>boss</i> agent " +
|
| 414 |
"that hands out tasks and collects results \u2014 lots of back-and-forth messages that pile up as you add " +
|
| 415 |
"workers. This approach skips the boss entirely. All <b>" + na + " agents</b> scribble on one shared " +
|
|
|
|
| 418 |
"another. Here it finishes in about <b>" + pfs + " rounds with zero messages</b>, matching the boss-based " +
|
| 419 |
"method that needed roughly <b>" + hms + " messages</b>. One catch: the pressure has to <b>fade over time</b>, " +
|
| 420 |
"or it snowballs \u2014 turning decay off makes the pressure blow up about <b>" + rw + "</b>. This view is a " +
|
| 421 |
+
"<b>MODELED</b> deterministic simulation of that coordination math, not a run of real AI agents.");
|
| 422 |
}
|
| 423 |
|
| 424 |
function _tok(s) {
|
|
|
|
| 444 |
_set("pf-runaway", t || (S.runawayX != null ? (S.runawayX.toFixed(1) + "\u00d7 without decay") : "\u2014"));
|
| 445 |
// honesty label verbatim — never upgraded
|
| 446 |
_set("pf-label", t || (S.label || "MODELED"));
|
| 447 |
+
if (_show) { _show.setChip("pf", S.label || "MODELED", { text: "pressure-field coordination" }); _show.refreshPlain(); }
|
| 448 |
}
|
| 449 |
|
| 450 |
// =============================================================================
|
|
|
|
| 467 |
|
| 468 |
export function unmount() {
|
| 469 |
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 470 |
+
try { if (_show) _show.destroy(); } catch (_) {}
|
| 471 |
try {
|
| 472 |
if (_group && _stage) {
|
| 473 |
_group.traverse((o) => {
|
|
|
|
| 480 |
_stage.scene.remove(_group);
|
| 481 |
}
|
| 482 |
} catch (_) {}
|
| 483 |
+
_group = _show = null;
|
| 484 |
_floor = null; _cells = []; _cellSide = 0; _agents = [];
|
| 485 |
_ablDecay = null; _ablNoDecay = null;
|
| 486 |
+
_el = {}; _badge = null; _frameReg = false;
|
| 487 |
_stage = _THREE = _ctx = null;
|
| 488 |
S.label = S.nAgents = S.grid = S.decay = S.steps = null;
|
| 489 |
S.solved = S.stepsConv = S.finalViol = S.peakPress = S.messages = null;
|
static/3d/surfaces/pinn.js
CHANGED
|
@@ -33,6 +33,8 @@
|
|
| 33 |
// The shell shares ONE Stage across surfaces; we add objects to ctx.stage.scene, register
|
| 34 |
// per-frame work via ctx.stage.onFrame, and on unmount stop every poll + remove what we added.
|
| 35 |
|
|
|
|
|
|
|
| 36 |
const ID = "pinn";
|
| 37 |
const TITLE = "PINN Thermal/Field";
|
| 38 |
|
|
@@ -49,7 +51,7 @@ const VOX = 48;
|
|
| 49 |
let _ctx = null, _stage = null, _THREE = null;
|
| 50 |
let _group = null; // root group holding all scene objects we add
|
| 51 |
let _handles = []; // poll handles to stop on unmount
|
| 52 |
-
let
|
| 53 |
let _frameReg = null; // our onFrame closure (guards on null after unmount)
|
| 54 |
let _disposables = []; // geometries / materials / textures to dispose
|
| 55 |
|
|
@@ -544,31 +546,36 @@ function _human(x) {
|
|
| 544 |
// interactive controls (iso threshold / splats / arrows / residual displacement).
|
| 545 |
// ---------------------------------------------------------------------------
|
| 546 |
function _buildHUD() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 547 |
const wrap = document.createElement("div");
|
| 548 |
wrap.className = "szl3d-pinn-hud";
|
| 549 |
Object.assign(wrap.style, {
|
| 550 |
-
position: "
|
| 551 |
display: "flex", flexDirection: "column", gap: "8px",
|
| 552 |
-
maxWidth: "min(94%, 440px)", maxHeight: "calc(100% - 28px)", overflow: "auto",
|
| 553 |
font: "12px ui-monospace,SFMono-Regular,Menlo,monospace", color: "#cfe0ea",
|
| 554 |
});
|
| 555 |
|
| 556 |
-
const title = document.createElement("div");
|
| 557 |
-
title.style.cssText = "font:600 14px ui-sans-serif,system-ui;color:#eef3f6;letter-spacing:.4px";
|
| 558 |
-
title.textContent = "◇ PINN Thermal/Field · ray-march volume + MEASURED+SIGNED cert";
|
| 559 |
-
wrap.appendChild(title);
|
| 560 |
-
|
| 561 |
-
const sub = document.createElement("div");
|
| 562 |
-
sub.style.cssText = "color:#9fb1bf;font-size:11px;line-height:1.45";
|
| 563 |
-
sub.textContent = "Modeled on Kitware VTK.js/VolView + three.js TSL compute. " +
|
| 564 |
-
"Field render is MODELED (analytic PINN surrogate seeded by MEASURED telemetry). " +
|
| 565 |
-
"Certificate is MEASURED + SIGNED.";
|
| 566 |
-
wrap.appendChild(sub);
|
| 567 |
-
|
| 568 |
-
// live badge row (filled by poll)
|
| 569 |
-
const badge = _ctx.live.createBadge();
|
| 570 |
-
wrap.appendChild(badge.el);
|
| 571 |
-
|
| 572 |
// backend indicator
|
| 573 |
const back = document.createElement("div");
|
| 574 |
back.id = "pinn-backend";
|
|
@@ -618,19 +625,7 @@ function _buildHUD() {
|
|
| 618 |
}));
|
| 619 |
wrap.appendChild(ctrls);
|
| 620 |
|
| 621 |
-
|
| 622 |
-
const legend = _ctx.label.legend();
|
| 623 |
-
legend.style.opacity = "0.85";
|
| 624 |
-
wrap.appendChild(legend);
|
| 625 |
-
|
| 626 |
-
const foot = document.createElement("div");
|
| 627 |
-
foot.style.cssText = "color:#7d8a96;font-size:10px;line-height:1.4";
|
| 628 |
-
foot.textContent = "Doctrine v11 · Λ = Conjecture 1 (advisory) · field MODELED, cert MEASURED+SIGNED · " +
|
| 629 |
-
"no fabricated field numbers · WebGPU→WebGL2 fallback · 0 runtime CDN";
|
| 630 |
-
wrap.appendChild(foot);
|
| 631 |
-
|
| 632 |
-
(_ctx.container || document.body).appendChild(wrap);
|
| 633 |
-
_overlay = wrap;
|
| 634 |
return { wrap, badge, cert, bounds, resid, back };
|
| 635 |
}
|
| 636 |
|
|
@@ -733,6 +728,8 @@ function _onCert(json, meta) {
|
|
| 733 |
_updateBoundsLadder(_ladder);
|
| 734 |
_renderCertHUD();
|
| 735 |
_renderBoundsHUD();
|
|
|
|
|
|
|
| 736 |
}
|
| 737 |
|
| 738 |
function _rebuildFieldGeometry(hot) {
|
|
@@ -964,9 +961,9 @@ function unmount() {
|
|
| 964 |
// stop polls
|
| 965 |
_handles.forEach((h) => { try { h.stop(); } catch (_) {} });
|
| 966 |
_handles = [];
|
| 967 |
-
//
|
| 968 |
-
try { if (
|
| 969 |
-
|
| 970 |
// neutralize our frame callback (the shell keeps its callback list; we guard on _group)
|
| 971 |
_frameReg = null;
|
| 972 |
// remove our scene group + dispose resources
|
|
|
|
| 33 |
// The shell shares ONE Stage across surfaces; we add objects to ctx.stage.scene, register
|
| 34 |
// per-frame work via ctx.stage.onFrame, and on unmount stop every poll + remove what we added.
|
| 35 |
|
| 36 |
+
import { createShowcase } from "./_showcase.js";
|
| 37 |
+
|
| 38 |
const ID = "pinn";
|
| 39 |
const TITLE = "PINN Thermal/Field";
|
| 40 |
|
|
|
|
| 51 |
let _ctx = null, _stage = null, _THREE = null;
|
| 52 |
let _group = null; // root group holding all scene objects we add
|
| 53 |
let _handles = []; // poll handles to stop on unmount
|
| 54 |
+
let _show = null; // shared showcase controller (owns the DOM chrome)
|
| 55 |
let _frameReg = null; // our onFrame closure (guards on null after unmount)
|
| 56 |
let _disposables = []; // geometries / materials / textures to dispose
|
| 57 |
|
|
|
|
| 546 |
// interactive controls (iso threshold / splats / arrows / residual displacement).
|
| 547 |
// ---------------------------------------------------------------------------
|
| 548 |
function _buildHUD() {
|
| 549 |
+
// Compact chrome (title bar + honesty pills + legend + description/citations) is
|
| 550 |
+
// provided by the shared showcase; the cert/bounds/residual/control panels fold into
|
| 551 |
+
// its collapsible body. Create the live badge FIRST so the showcase can host it.
|
| 552 |
+
const badge = _ctx.live.createBadge();
|
| 553 |
+
|
| 554 |
+
_show = createShowcase(_ctx, {
|
| 555 |
+
id: ID, title: "PINN Thermal/Field · ray-march volume + MEASURED+SIGNED cert",
|
| 556 |
+
accent: "#5b8dee",
|
| 557 |
+
badge,
|
| 558 |
+
chips: [{ label: F.certLabel || "SAMPLE", text: "field", name: "cert" }],
|
| 559 |
+
legend: true,
|
| 560 |
+
description:
|
| 561 |
+
"Modeled on Kitware VTK.js/VolView + three.js TSL compute. " +
|
| 562 |
+
"Field render is MODELED (analytic PINN surrogate seeded by MEASURED telemetry). " +
|
| 563 |
+
"Certificate is MEASURED + SIGNED.",
|
| 564 |
+
citations:
|
| 565 |
+
"Doctrine v11 · Λ = Conjecture 1 (advisory) · field MODELED, cert MEASURED+SIGNED · " +
|
| 566 |
+
"no fabricated field numbers · WebGPU→WebGL2 fallback · 0 runtime CDN",
|
| 567 |
+
});
|
| 568 |
+
|
| 569 |
+
// KPI/panel container — plain + static so it nests cleanly inside the showcase body
|
| 570 |
+
// (no absolute chrome / card of its own; the showcase owns the panel styling).
|
| 571 |
const wrap = document.createElement("div");
|
| 572 |
wrap.className = "szl3d-pinn-hud";
|
| 573 |
Object.assign(wrap.style, {
|
| 574 |
+
position: "static",
|
| 575 |
display: "flex", flexDirection: "column", gap: "8px",
|
|
|
|
| 576 |
font: "12px ui-monospace,SFMono-Regular,Menlo,monospace", color: "#cfe0ea",
|
| 577 |
});
|
| 578 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 579 |
// backend indicator
|
| 580 |
const back = document.createElement("div");
|
| 581 |
back.id = "pinn-backend";
|
|
|
|
| 625 |
}));
|
| 626 |
wrap.appendChild(ctrls);
|
| 627 |
|
| 628 |
+
_show.body.appendChild(wrap);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 629 |
return { wrap, badge, cert, bounds, resid, back };
|
| 630 |
}
|
| 631 |
|
|
|
|
| 728 |
_updateBoundsLadder(_ladder);
|
| 729 |
_renderCertHUD();
|
| 730 |
_renderBoundsHUD();
|
| 731 |
+
// route the FIELD honesty label (verbatim: MODELED / SAMPLE) through the showcase pill
|
| 732 |
+
if (_show) _show.setChip("cert", F.certLabel || "SAMPLE", { text: "field" });
|
| 733 |
}
|
| 734 |
|
| 735 |
function _rebuildFieldGeometry(hot) {
|
|
|
|
| 961 |
// stop polls
|
| 962 |
_handles.forEach((h) => { try { h.stop(); } catch (_) {} });
|
| 963 |
_handles = [];
|
| 964 |
+
// tear down the shared showcase (it owns all of our DOM chrome now)
|
| 965 |
+
try { if (_show) _show.destroy(); } catch (_) {}
|
| 966 |
+
_show = null; _hud = null;
|
| 967 |
// neutralize our frame callback (the shell keeps its callback list; we guard on _group)
|
| 968 |
_frameReg = null;
|
| 969 |
// remove our scene group + dispose resources
|
static/3d/surfaces/pnt.js
CHANGED
|
@@ -29,6 +29,8 @@
|
|
| 29 |
// ctx = { stage, container, live, label, THREE, szl3d }. Frame callbacks accumulate on the
|
| 30 |
// shared stage and are NOT removed on unmount, so every onFrame closure guards on _alive.
|
| 31 |
|
|
|
|
|
|
|
| 32 |
const ID = "pnt";
|
| 33 |
const TITLE = "PNT · Quantum Nav";
|
| 34 |
const ENDPOINT = "/api/a11oy/v1/pnt/sensor";
|
|
@@ -49,7 +51,7 @@ let _alive = false;
|
|
| 49 |
const _handles = []; // every live-poll handle (stopped on unmount)
|
| 50 |
const _objs = []; // every scene object we add (removed on unmount)
|
| 51 |
const _disposables = []; // geometries/materials/textures to dispose
|
| 52 |
-
let
|
| 53 |
const _spin = []; // { obj, sx, sy } per-frame rotators
|
| 54 |
const _frameFns = []; // per-frame animators invoked while _alive
|
| 55 |
|
|
@@ -83,44 +85,31 @@ function _lineMat(hex, opacity) {
|
|
| 83 |
}
|
| 84 |
|
| 85 |
// ----------------------------------------------------------------------------
|
| 86 |
-
// HUD (
|
|
|
|
|
|
|
| 87 |
// ----------------------------------------------------------------------------
|
| 88 |
function _buildOverlay(ctx) {
|
| 89 |
-
_overlay = document.createElement("div");
|
| 90 |
-
_overlay.className = "szl3d-surface-overlay szl3d-pnt-overlay";
|
| 91 |
-
Object.assign(_overlay.style, {
|
| 92 |
-
position: "absolute", left: "14px", top: "14px", zIndex: "5",
|
| 93 |
-
display: "flex", flexDirection: "column", gap: "8px",
|
| 94 |
-
maxWidth: "min(94%,440px)", pointerEvents: "none",
|
| 95 |
-
});
|
| 96 |
-
|
| 97 |
-
const h = document.createElement("div");
|
| 98 |
-
h.style.cssText = "font:600 13px ui-sans-serif,system-ui;color:#eef3f6;letter-spacing:.4px";
|
| 99 |
-
h.textContent = TITLE + " · modeled on Q-CTRL Ironstone Opal + Advanced Navigation";
|
| 100 |
-
_overlay.appendChild(h);
|
| 101 |
-
|
| 102 |
-
const honesty = document.createElement("div");
|
| 103 |
-
honesty.style.cssText = "font:10.5px ui-monospace,Menlo,monospace;color:#9fb1bf;line-height:1.45;" +
|
| 104 |
-
"background:#0a1117;border:1px solid #1d2a36;border-radius:7px;padding:6px 9px;max-width:430px";
|
| 105 |
-
honesty.innerHTML =
|
| 106 |
-
"MODELED closed-form physics — <b>NOT flown hardware</b>, not a real flight. " +
|
| 107 |
-
"Sensor cert is VERIFIED (MODELED) · UNSIGNED (STRUCTURAL-ONLY). Every value below " +
|
| 108 |
-
"traces to a live /api/a11oy/v1/pnt/* endpoint; nothing is hardcoded.";
|
| 109 |
-
_overlay.appendChild(honesty);
|
| 110 |
-
|
| 111 |
const badge = ctx.live.createBadge();
|
| 112 |
-
_overlay.appendChild(badge.el);
|
| 113 |
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
|
|
|
| 122 |
|
| 123 |
-
(ctx.container || document.body).appendChild(_overlay);
|
| 124 |
return badge;
|
| 125 |
}
|
| 126 |
|
|
@@ -520,6 +509,7 @@ function _onSensor(json, meta) {
|
|
| 520 |
_sensor = json;
|
| 521 |
const lab = meta.label || (json && json.label) || "MODELED";
|
| 522 |
_sensorLabel = lab;
|
|
|
|
| 523 |
const cf = (json && json.closed_form_stdlib) || {};
|
| 524 |
_setRow(_rows.keff, _fmtSci(cf.k_eff_per_m), lab);
|
| 525 |
_setRow(_rows.phase, _fmtSci(cf.shot_noise_phase_rad), lab);
|
|
@@ -622,7 +612,8 @@ function unmount() {
|
|
| 622 |
_alive = false;
|
| 623 |
for (const h of _handles) { try { h.stop(); } catch (_) {} }
|
| 624 |
_handles.length = 0;
|
| 625 |
-
try { if (
|
|
|
|
| 626 |
if (_stage) {
|
| 627 |
for (const o of _objs) { try { _stage.scene.remove(o); } catch (_) {} }
|
| 628 |
}
|
|
@@ -634,7 +625,7 @@ function unmount() {
|
|
| 634 |
_ellipsoidC = _ellipsoidQ = _crlbMesh = _crlbBeacon = _sqlPlane = null;
|
| 635 |
_verdictOrb = _drift = _keffRing = _phaseDial = _asdCol = _foMHalo = null;
|
| 636 |
_sensor = _coast = _resil = _limits = null; _sensorLabel = null;
|
| 637 |
-
|
| 638 |
}
|
| 639 |
|
| 640 |
// STRUCTURAL-ONLY is carried in the ladder billboards: the pillar names are present as
|
|
|
|
| 29 |
// ctx = { stage, container, live, label, THREE, szl3d }. Frame callbacks accumulate on the
|
| 30 |
// shared stage and are NOT removed on unmount, so every onFrame closure guards on _alive.
|
| 31 |
|
| 32 |
+
import { createShowcase } from "./_showcase.js";
|
| 33 |
+
|
| 34 |
const ID = "pnt";
|
| 35 |
const TITLE = "PNT · Quantum Nav";
|
| 36 |
const ENDPOINT = "/api/a11oy/v1/pnt/sensor";
|
|
|
|
| 51 |
const _handles = []; // every live-poll handle (stopped on unmount)
|
| 52 |
const _objs = []; // every scene object we add (removed on unmount)
|
| 53 |
const _disposables = []; // geometries/materials/textures to dispose
|
| 54 |
+
let _hud = null, _show = null;
|
| 55 |
const _spin = []; // { obj, sx, sy } per-frame rotators
|
| 56 |
const _frameFns = []; // per-frame animators invoked while _alive
|
| 57 |
|
|
|
|
| 85 |
}
|
| 86 |
|
| 87 |
// ----------------------------------------------------------------------------
|
| 88 |
+
// HUD (folded into the shared showcase body) — every readout chip carries its
|
| 89 |
+
// honesty label. The compact chrome (title bar + honesty pills + legend) is
|
| 90 |
+
// provided by the shared showcase; the KPI rows nest statically inside its body.
|
| 91 |
// ----------------------------------------------------------------------------
|
| 92 |
function _buildOverlay(ctx) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
const badge = ctx.live.createBadge();
|
|
|
|
| 94 |
|
| 95 |
+
_show = createShowcase(ctx, {
|
| 96 |
+
id: ID, title: TITLE + " · modeled on Q-CTRL Ironstone Opal + Advanced Navigation",
|
| 97 |
+
accent: "#5b8dee",
|
| 98 |
+
badge,
|
| 99 |
+
chips: [{ label: _sensorLabel || "MODELED", text: "quantum sensor", name: "sensor" }],
|
| 100 |
+
legend: true,
|
| 101 |
+
description:
|
| 102 |
+
"MODELED closed-form physics — <b>NOT flown hardware</b>, not a real flight. " +
|
| 103 |
+
"Sensor cert is VERIFIED (MODELED) · UNSIGNED (STRUCTURAL-ONLY). Every value below " +
|
| 104 |
+
"traces to a live /api/a11oy/v1/pnt/* endpoint; nothing is hardcoded.",
|
| 105 |
+
});
|
| 106 |
|
| 107 |
+
// KPI rows live in a plain static container nested inside the collapsible body
|
| 108 |
+
// (no absolute chrome of its own — the showcase owns the card/panel styling).
|
| 109 |
+
_hud = document.createElement("div");
|
| 110 |
+
_hud.style.cssText = "position:static;display:flex;flex-direction:column;gap:5px;font:11px ui-monospace,Menlo,monospace;color:#cfe0ea";
|
| 111 |
+
_show.body.appendChild(_hud);
|
| 112 |
|
|
|
|
| 113 |
return badge;
|
| 114 |
}
|
| 115 |
|
|
|
|
| 509 |
_sensor = json;
|
| 510 |
const lab = meta.label || (json && json.label) || "MODELED";
|
| 511 |
_sensorLabel = lab;
|
| 512 |
+
if (_show) _show.setChip("sensor", lab, { text: "quantum sensor" });
|
| 513 |
const cf = (json && json.closed_form_stdlib) || {};
|
| 514 |
_setRow(_rows.keff, _fmtSci(cf.k_eff_per_m), lab);
|
| 515 |
_setRow(_rows.phase, _fmtSci(cf.shot_noise_phase_rad), lab);
|
|
|
|
| 612 |
_alive = false;
|
| 613 |
for (const h of _handles) { try { h.stop(); } catch (_) {} }
|
| 614 |
_handles.length = 0;
|
| 615 |
+
try { if (_show) _show.destroy(); } catch (_) {}
|
| 616 |
+
_show = null;
|
| 617 |
if (_stage) {
|
| 618 |
for (const o of _objs) { try { _stage.scene.remove(o); } catch (_) {} }
|
| 619 |
}
|
|
|
|
| 625 |
_ellipsoidC = _ellipsoidQ = _crlbMesh = _crlbBeacon = _sqlPlane = null;
|
| 626 |
_verdictOrb = _drift = _keffRing = _phaseDial = _asdCol = _foMHalo = null;
|
| 627 |
_sensor = _coast = _resil = _limits = null; _sensorLabel = null;
|
| 628 |
+
_hud = _stage = _THREE = _label = null;
|
| 629 |
}
|
| 630 |
|
| 631 |
// STRUCTURAL-ONLY is carried in the ladder billboards: the pillar names are present as
|
szl_factory.py
CHANGED
|
@@ -192,7 +192,11 @@ def _brain_state() -> Dict[str, Any]:
|
|
| 192 |
"(retrieve->quarantine->tool_call->policy_check->kernel_check->emit).")
|
| 193 |
# The PLAN->ACT->VERIFY agent FSM, if present (honest about its guards).
|
| 194 |
try:
|
| 195 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
out["agent_loop"] = {
|
| 197 |
"module": "a11oy_agent_loop",
|
| 198 |
"fsm": "INTAKE->PLAN->RETRIEVE->ACT->OBSERVE->VERIFY->(REFLECT->ACT)->FINALIZE|HALT",
|
|
|
|
| 192 |
"(retrieve->quarantine->tool_call->policy_check->kernel_check->emit).")
|
| 193 |
# The PLAN->ACT->VERIFY agent FSM, if present (honest about its guards).
|
| 194 |
try:
|
| 195 |
+
# Prefer the installable shared substrate; fall back to the local copy.
|
| 196 |
+
try:
|
| 197 |
+
from szl_substrate import a11oy_agent_loop as _al # type: ignore # noqa: F401
|
| 198 |
+
except Exception:
|
| 199 |
+
import a11oy_agent_loop as _al # type: ignore # noqa: F401
|
| 200 |
out["agent_loop"] = {
|
| 201 |
"module": "a11oy_agent_loop",
|
| 202 |
"fsm": "INTAKE->PLAN->RETRIEVE->ACT->OBSERVE->VERIFY->(REFLECT->ACT)->FINALIZE|HALT",
|
szl_mbse.py
CHANGED
|
@@ -60,7 +60,12 @@ _MODELED_LABEL = "MODELED/SIMULATED \u2014 not physical hardware"
|
|
| 60 |
# ---------------------------------------------------------------------------
|
| 61 |
def _cosim() -> Optional[Any]:
|
| 62 |
try:
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
return _c
|
| 65 |
except Exception:
|
| 66 |
return None
|
|
|
|
| 60 |
# ---------------------------------------------------------------------------
|
| 61 |
def _cosim() -> Optional[Any]:
|
| 62 |
try:
|
| 63 |
+
# Prefer the installable shared substrate; fall back to the local
|
| 64 |
+
# vendored copy if the package is absent (guarded — never crashes).
|
| 65 |
+
try:
|
| 66 |
+
from szl_substrate import szl_mbse_cosim as _c # type: ignore
|
| 67 |
+
except Exception:
|
| 68 |
+
import szl_mbse_cosim as _c # type: ignore
|
| 69 |
return _c
|
| 70 |
except Exception:
|
| 71 |
return None
|
szl_nemo_agents.py
CHANGED
|
@@ -277,7 +277,10 @@ def _waqay_status() -> dict:
|
|
| 277 |
trust = 0.99
|
| 278 |
n_receipts = None
|
| 279 |
try:
|
| 280 |
-
|
|
|
|
|
|
|
|
|
|
| 281 |
doc = dict(getattr(w, "DOCTRINE", {}))
|
| 282 |
trust = getattr(w, "TRUST_CEILING", 0.99)
|
| 283 |
n_receipts = len(getattr(w, "_RECEIPTS", []))
|
|
@@ -319,7 +322,10 @@ def _yupay_status() -> dict:
|
|
| 319 |
trust = 0.97
|
| 320 |
n_receipts = None
|
| 321 |
try:
|
| 322 |
-
|
|
|
|
|
|
|
|
|
|
| 323 |
doc = dict(getattr(y, "DOCTRINE", {}))
|
| 324 |
at = getattr(y, "AUDIT_TASK", {})
|
| 325 |
task = {"id": at.get("id"), "issues_known": len(at.get("known_issues", []))}
|
|
@@ -418,12 +424,18 @@ def register(app, ns: str = "a11oy", sign_fn=None) -> dict:
|
|
| 418 |
except Exception as e: # noqa: BLE001
|
| 419 |
result["errors"]["szl_qhawaq_import"] = repr(e)
|
| 420 |
try:
|
| 421 |
-
|
|
|
|
|
|
|
|
|
|
| 422 |
_wire("szl_waqay", lambda: _w.register(app, ns=ns))
|
| 423 |
except Exception as e: # noqa: BLE001
|
| 424 |
result["errors"]["szl_waqay_import"] = repr(e)
|
| 425 |
try:
|
| 426 |
-
|
|
|
|
|
|
|
|
|
|
| 427 |
_wire("szl_yupay", lambda: _y.register(app, ns=ns))
|
| 428 |
except Exception as e: # noqa: BLE001
|
| 429 |
result["errors"]["szl_yupay_import"] = repr(e)
|
|
|
|
| 277 |
trust = 0.99
|
| 278 |
n_receipts = None
|
| 279 |
try:
|
| 280 |
+
try:
|
| 281 |
+
from szl_substrate import szl_waqay as w # prefer shared substrate
|
| 282 |
+
except Exception:
|
| 283 |
+
import szl_waqay as w # fall back to local copy
|
| 284 |
doc = dict(getattr(w, "DOCTRINE", {}))
|
| 285 |
trust = getattr(w, "TRUST_CEILING", 0.99)
|
| 286 |
n_receipts = len(getattr(w, "_RECEIPTS", []))
|
|
|
|
| 322 |
trust = 0.97
|
| 323 |
n_receipts = None
|
| 324 |
try:
|
| 325 |
+
try:
|
| 326 |
+
from szl_substrate import szl_yupay as y # prefer shared substrate
|
| 327 |
+
except Exception:
|
| 328 |
+
import szl_yupay as y # fall back to local copy
|
| 329 |
doc = dict(getattr(y, "DOCTRINE", {}))
|
| 330 |
at = getattr(y, "AUDIT_TASK", {})
|
| 331 |
task = {"id": at.get("id"), "issues_known": len(at.get("known_issues", []))}
|
|
|
|
| 424 |
except Exception as e: # noqa: BLE001
|
| 425 |
result["errors"]["szl_qhawaq_import"] = repr(e)
|
| 426 |
try:
|
| 427 |
+
try:
|
| 428 |
+
from szl_substrate import szl_waqay as _w # prefer shared substrate
|
| 429 |
+
except Exception:
|
| 430 |
+
import szl_waqay as _w # fall back to local copy
|
| 431 |
_wire("szl_waqay", lambda: _w.register(app, ns=ns))
|
| 432 |
except Exception as e: # noqa: BLE001
|
| 433 |
result["errors"]["szl_waqay_import"] = repr(e)
|
| 434 |
try:
|
| 435 |
+
try:
|
| 436 |
+
from szl_substrate import szl_yupay as _y # prefer shared substrate
|
| 437 |
+
except Exception:
|
| 438 |
+
import szl_yupay as _y # fall back to local copy
|
| 439 |
_wire("szl_yupay", lambda: _y.register(app, ns=ns))
|
| 440 |
except Exception as e: # noqa: BLE001
|
| 441 |
result["errors"]["szl_yupay_import"] = repr(e)
|