Spaces:
Running
Running
feat(wave13): add 3 frontier surfaces — muon, specexec, nvfp4 (52→55 surfaces); wire holographic.html + szl3d_holographic.py
Browse files- static/3d/holographic.html +3 -0
- static/3d/surfaces/muon.js +568 -0
- static/3d/surfaces/nvfp4.js +549 -0
- static/3d/surfaces/specexec.js +560 -0
- szl3d_holographic.py +3 -0
static/3d/holographic.html
CHANGED
|
@@ -120,6 +120,9 @@ const SURFACES = [
|
|
| 120 |
{ id: "router", title: "Router", mod: "/static/3d/surfaces/router.js" },
|
| 121 |
{ id: "anatomy", title: "Anatomy", mod: "/static/3d/surfaces/anatomy.js" },
|
| 122 |
{ id: "estate", title: "Estate", mod: "/static/3d/surfaces/estate.js" },
|
|
|
|
|
|
|
|
|
|
| 123 |
];
|
| 124 |
|
| 125 |
const stageEl = document.getElementById("stage");
|
|
|
|
| 120 |
{ id: "router", title: "Router", mod: "/static/3d/surfaces/router.js" },
|
| 121 |
{ id: "anatomy", title: "Anatomy", mod: "/static/3d/surfaces/anatomy.js" },
|
| 122 |
{ id: "estate", title: "Estate", mod: "/static/3d/surfaces/estate.js" },
|
| 123 |
+
{ id: "muon", title: "Muon Orthogonalized-Momentum Optimizer", mod: "/static/3d/surfaces/muon.js" },
|
| 124 |
+
{ id: "specexec", title: "Tree Speculative Execution", mod: "/static/3d/surfaces/specexec.js" },
|
| 125 |
+
{ id: "nvfp4", title: "NVFP4 4-bit Training Format", mod: "/static/3d/surfaces/nvfp4.js" },
|
| 126 |
];
|
| 127 |
|
| 128 |
const stageEl = document.getElementById("stage");
|
static/3d/surfaces/muon.js
ADDED
|
@@ -0,0 +1,568 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// SPDX-License-Identifier: Apache-2.0
|
| 2 |
+
// © 2026 Lutar, Stephen P. — SZL Holdings · ORCID 0009-0001-0110-4173 · Doctrine v11
|
| 3 |
+
//
|
| 4 |
+
// surfaces/muon.js — MUON ORTHOGONALIZED-MOMENTUM OPTIMIZER organ for the
|
| 5 |
+
// holographic frontier ring (Muon = "MomentUm Orthogonalized by Newton–Schulz";
|
| 6 |
+
// Keller Jordan et al. / Moonshot AI). Renders the quintic Newton–Schulz
|
| 7 |
+
// orthogonalization of a synthetic momentum matrix as three live panels:
|
| 8 |
+
// (1) SINGULAR-VALUE TRAJECTORY — one 3D line per singular value across the
|
| 9 |
+
// Newton–Schulz iterations (x = iteration 0..ns, y = σ value), with the
|
| 10 |
+
// Muon [0.68, 1.13] oscillation band drawn as two reference planes;
|
| 11 |
+
// (2) BEFORE / AFTER HEATMAP — the raw normalized matrix G/||G||_F vs. the
|
| 12 |
+
// orthogonalized output UVᵀ ≈ X_ns, as two grids of coloured cells;
|
| 13 |
+
// (3) CONDITION-NUMBER BARS — κ = σ_max/σ_min raw vs. orthogonalized, honestly
|
| 14 |
+
// showing spectral flattening.
|
| 15 |
+
// A HUD reports the MEASURED metrics from the live snapshot at
|
| 16 |
+
// /api/killinchu/v1/muon/orthogonalize. Honesty label "MODELED" is read
|
| 17 |
+
// VERBATIM from the JSON and displayed as-is; it is never upgraded.
|
| 18 |
+
//
|
| 19 |
+
// Surface export shape (mirrors ternary.js / kvcache.js exactly):
|
| 20 |
+
// export default { id, title, endpoints, mount(ctx), unmount() }
|
| 21 |
+
// ctx = { stage, container, live, label, THREE, szl3d }
|
| 22 |
+
//
|
| 23 |
+
// DATA SHOWN (all from live endpoint):
|
| 24 |
+
// m, n, ns_steps, coeffs{a,b,c}, frob_norm_raw, aspect_scale, rank,
|
| 25 |
+
// sv_spectrum[[...]], cond_raw, cond_ortho, cond_improvement,
|
| 26 |
+
// band_lo, band_hi, frac_in_band, sv_min_final, sv_max_final,
|
| 27 |
+
// matrix_raw[[...]], matrix_ortho[[...]]
|
| 28 |
+
//
|
| 29 |
+
// LEADERS ADOPTED & CITED (clean-room; NOT claimed as SZL's own; VERIFY real):
|
| 30 |
+
// Muon: An optimizer for hidden layers in neural networks — Keller Jordan et al.
|
| 31 |
+
// https://kellerjordan.github.io/posts/muon/
|
| 32 |
+
// Muon is Scalable for LLM Training (Moonlight) — Moonshot AI arXiv:2502.16982
|
| 33 |
+
// https://arxiv.org/abs/2502.16982
|
| 34 |
+
// KellerJordan/Muon reference implementation: https://github.com/KellerJordan/Muon
|
| 35 |
+
//
|
| 36 |
+
// HONESTY LABELS: MODELED (deterministic reproduction of the Muon Newton–Schulz
|
| 37 |
+
// ORTHOGONALIZATION mechanism on a toy synthetic momentum matrix; NOT a
|
| 38 |
+
// trained model; trains nothing; the spectral flattening is MEASURED and
|
| 39 |
+
// displayed; NEVER-CLAIMED-AS a production optimizer). Read verbatim from JSON.
|
| 40 |
+
// COLOURS: lattice-blue 0x5b8dee, violet-blue 0x8a6bff, proof-teal 0x3af4c8,
|
| 41 |
+
// greys (0x5a6570 / 0x42505d). Purple BANNED as UI/background.
|
| 42 |
+
// 0 RUNTIME CDN. Vendored three.js via ctx.THREE (page importmap).
|
| 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 |
+
|
| 49 |
+
// Endpoint is hosted on the dedicated killinchu Space (isolated compute),
|
| 50 |
+
// reached cross-origin (killinchu returns access-control-allow-origin).
|
| 51 |
+
const EP = "https://szlholdings-killinchu.hf.space/api/killinchu/v1/muon/orthogonalize?seed=42&m=32&n=32&ns_steps=5";
|
| 52 |
+
|
| 53 |
+
// data-viz hues — purple BANNED
|
| 54 |
+
const C_SV = 0x3af4c8; // proof-teal (singular-value trajectory lines)
|
| 55 |
+
const C_BAND = 0x8a6bff; // violet-blue ([0.68,1.13] band reference planes)
|
| 56 |
+
const C_RAW = 0x5b8dee; // lattice-blue (raw matrix heatmap / raw cond bar)
|
| 57 |
+
const C_ORTHO = 0x3af4c8; // proof-teal (orthogonalized heatmap / ortho bar)
|
| 58 |
+
const C_DIM = 0x42505d; // grey (degraded / no-live-data)
|
| 59 |
+
const C_ZERO = 0x5a6570; // grey (near-zero heatmap cell)
|
| 60 |
+
const C_GRID = 0x1b3a44; // floor / link colour
|
| 61 |
+
|
| 62 |
+
// layout geometry
|
| 63 |
+
const TRAJ_X0 = 0.0; // trajectory panel origin x
|
| 64 |
+
const TRAJ_DX = 1.5; // world-units per Newton–Schulz iteration
|
| 65 |
+
const TRAJ_YSC = 3.0; // world-units per unit singular value
|
| 66 |
+
const HEAT_CELL = 0.16; // heatmap cell size
|
| 67 |
+
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, _overlay = null;
|
| 72 |
+
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
| 73 |
+
let _plain = false;
|
| 74 |
+
|
| 75 |
+
// geometry handles
|
| 76 |
+
let _floor = null;
|
| 77 |
+
let _trajGroup = null; // THREE.Group — SV trajectory lines + band planes
|
| 78 |
+
let _heatRaw = []; // Array<THREE.Mesh> — before heatmap cells
|
| 79 |
+
let _heatOrtho = []; // Array<THREE.Mesh> — after heatmap cells
|
| 80 |
+
let _heatGroup = null;
|
| 81 |
+
let _barRaw = null; // THREE.Mesh — raw condition-number bar
|
| 82 |
+
let _barOrtho = null; // THREE.Mesh — orthogonalized condition-number bar
|
| 83 |
+
let _barGroup = null;
|
| 84 |
+
|
| 85 |
+
// live state
|
| 86 |
+
const S = {
|
| 87 |
+
label: null,
|
| 88 |
+
m: null,
|
| 89 |
+
n: null,
|
| 90 |
+
nsSteps: null, // ns_steps
|
| 91 |
+
coA: null, coB: null, coC: null, // coeffs
|
| 92 |
+
frobRaw: null, // frob_norm_raw
|
| 93 |
+
aspect: null, // aspect_scale
|
| 94 |
+
rank: null,
|
| 95 |
+
svSpectrum: null, // Array<Array<number>>
|
| 96 |
+
condRaw: null, // cond_raw
|
| 97 |
+
condOrtho: null, // cond_ortho
|
| 98 |
+
condImp: null, // cond_improvement
|
| 99 |
+
bandLo: null, // band_lo
|
| 100 |
+
bandHi: null, // band_hi
|
| 101 |
+
fracInBand: null, // frac_in_band
|
| 102 |
+
svMinFinal: null, // sv_min_final
|
| 103 |
+
svMaxFinal: null, // sv_max_final
|
| 104 |
+
matrixRaw: null, // Array<Array<number>>
|
| 105 |
+
matrixOrtho:null, // Array<Array<number>>
|
| 106 |
+
state: "init",
|
| 107 |
+
};
|
| 108 |
+
|
| 109 |
+
// =============================================================================
|
| 110 |
+
// mount(ctx)
|
| 111 |
+
// =============================================================================
|
| 112 |
+
export function mount(ctx) {
|
| 113 |
+
_ctx = ctx; _stage = ctx.stage; _THREE = ctx.THREE;
|
| 114 |
+
_group = new _THREE.Group();
|
| 115 |
+
_stage.scene.add(_group);
|
| 116 |
+
_stage.camera.position.set(6, 7, 18);
|
| 117 |
+
try { if (_stage.controls && _stage.controls.target) { _stage.controls.target.set(4, 1.5, 0); _stage.controls.update(); } } catch (_) {}
|
| 118 |
+
try { _stage.setBloom(true); } catch (_) {}
|
| 119 |
+
|
| 120 |
+
_buildFloor();
|
| 121 |
+
_buildTrajectory();
|
| 122 |
+
_buildHeatmaps();
|
| 123 |
+
_buildBars();
|
| 124 |
+
|
| 125 |
+
if (!_frameReg) { _stage.onFrame(_onFrame); _frameReg = true; }
|
| 126 |
+
|
| 127 |
+
_badge = ctx.live.createBadge();
|
| 128 |
+
_polls.push(ctx.live.poll(EP, 5000, _onMuon, { badge: _badge, onState: (msg) => { S.state = msg.state; _updateAll(); _paintOverlay(); } }));
|
| 129 |
+
|
| 130 |
+
_buildOverlay();
|
| 131 |
+
return { id: ID, started: true };
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
// =============================================================================
|
| 135 |
+
// builders
|
| 136 |
+
// =============================================================================
|
| 137 |
+
function _buildFloor() {
|
| 138 |
+
const THREE = _THREE;
|
| 139 |
+
const grid = new THREE.GridHelper(44, 44, C_GRID, 0x0f2027);
|
| 140 |
+
grid.material.opacity = 0.18; grid.material.transparent = true; grid.position.y = -0.01;
|
| 141 |
+
_group.add(grid);
|
| 142 |
+
_floor = grid;
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
// SV trajectory panel: the band reference planes are pre-built here; the
|
| 146 |
+
// per-singular-value lines are rebuilt in-place whenever fresh data arrives
|
| 147 |
+
// (line count depends on live rank). Two translucent planes mark [0.68,1.13].
|
| 148 |
+
function _buildTrajectory() {
|
| 149 |
+
const THREE = _THREE;
|
| 150 |
+
_trajGroup = new THREE.Group();
|
| 151 |
+
_trajGroup.position.set(TRAJ_X0, 0, -3.0);
|
| 152 |
+
_group.add(_trajGroup);
|
| 153 |
+
// band planes are added by _updateTrajectory once band bounds are known
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
// two grids of coloured cells (raw | orthogonalized). Pre-allocate a fixed
|
| 157 |
+
// HEAT_MAX x HEAT_MAX per side; toggle visibility/color in place (no churn).
|
| 158 |
+
function _buildHeatmaps() {
|
| 159 |
+
const THREE = _THREE;
|
| 160 |
+
_heatGroup = new THREE.Group();
|
| 161 |
+
_heatGroup.position.set(0.0, 0.05, 3.2);
|
| 162 |
+
_group.add(_heatGroup);
|
| 163 |
+
const cellGeo = new THREE.PlaneGeometry(HEAT_CELL, HEAT_CELL);
|
| 164 |
+
|
| 165 |
+
function makeGrid(offsetX, arr) {
|
| 166 |
+
for (let r = 0; r < HEAT_MAX; r++) {
|
| 167 |
+
for (let c = 0; c < HEAT_MAX; c++) {
|
| 168 |
+
const mesh = new THREE.Mesh(
|
| 169 |
+
cellGeo,
|
| 170 |
+
new THREE.MeshBasicMaterial({ color: C_ZERO, transparent: true, opacity: 0.0, side: THREE.DoubleSide }),
|
| 171 |
+
);
|
| 172 |
+
mesh.rotation.x = -Math.PI / 2;
|
| 173 |
+
mesh.position.set(offsetX + c * HEAT_GAP, 0.02, r * HEAT_GAP);
|
| 174 |
+
mesh.visible = false;
|
| 175 |
+
_heatGroup.add(mesh);
|
| 176 |
+
arr.push(mesh);
|
| 177 |
+
}
|
| 178 |
+
}
|
| 179 |
+
}
|
| 180 |
+
makeGrid(0.0, _heatRaw);
|
| 181 |
+
makeGrid(HEAT_MAX * HEAT_GAP + 0.8, _heatOrtho);
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
function _buildBars() {
|
| 185 |
+
const THREE = _THREE;
|
| 186 |
+
_barGroup = new THREE.Group();
|
| 187 |
+
_barGroup.position.set(-3.4, 0, 0.0);
|
| 188 |
+
_group.add(_barGroup);
|
| 189 |
+
const geo = new THREE.BoxGeometry(BAR_W, 1.0, BAR_W);
|
| 190 |
+
|
| 191 |
+
_barRaw = new THREE.Mesh(
|
| 192 |
+
geo,
|
| 193 |
+
new THREE.MeshStandardMaterial({ color: C_RAW, emissive: C_RAW, emissiveIntensity: 0.35, transparent: true, opacity: 0.9 }),
|
| 194 |
+
);
|
| 195 |
+
_barRaw.position.set(0, 0.5, 0);
|
| 196 |
+
_barGroup.add(_barRaw);
|
| 197 |
+
|
| 198 |
+
_barOrtho = new THREE.Mesh(
|
| 199 |
+
geo,
|
| 200 |
+
new THREE.MeshStandardMaterial({ color: C_ORTHO, emissive: C_ORTHO, emissiveIntensity: 0.35, transparent: true, opacity: 0.9 }),
|
| 201 |
+
);
|
| 202 |
+
_barOrtho.position.set(1.3, 0.5, 0);
|
| 203 |
+
_barGroup.add(_barOrtho);
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
// =============================================================================
|
| 207 |
+
// live data handler
|
| 208 |
+
// =============================================================================
|
| 209 |
+
function _onMuon(j) {
|
| 210 |
+
// read honesty label VERBATIM — never upgrade. handle top-level 'label' OR
|
| 211 |
+
// nested 'payload.label' to match our own module's shape.
|
| 212 |
+
const lbl = (j && j.label != null) ? j.label
|
| 213 |
+
: (j && j.payload && j.payload.label != null) ? j.payload.label
|
| 214 |
+
: "MODELED";
|
| 215 |
+
const src = (j && j.payload && typeof j.payload === "object") ? j.payload : j;
|
| 216 |
+
S.label = String(lbl).toUpperCase();
|
| 217 |
+
|
| 218 |
+
S.m = typeof src.m === "number" ? src.m : null;
|
| 219 |
+
S.n = typeof src.n === "number" ? src.n : null;
|
| 220 |
+
S.nsSteps = typeof src.ns_steps === "number" ? src.ns_steps : null;
|
| 221 |
+
S.frobRaw = typeof src.frob_norm_raw === "number" ? src.frob_norm_raw : null;
|
| 222 |
+
S.aspect = typeof src.aspect_scale === "number" ? src.aspect_scale : null;
|
| 223 |
+
S.rank = typeof src.rank === "number" ? src.rank : null;
|
| 224 |
+
S.condRaw = typeof src.cond_raw === "number" ? src.cond_raw : null;
|
| 225 |
+
S.condOrtho = typeof src.cond_ortho === "number" ? src.cond_ortho : null;
|
| 226 |
+
S.condImp = typeof src.cond_improvement === "number" ? src.cond_improvement : null;
|
| 227 |
+
S.bandLo = typeof src.band_lo === "number" ? src.band_lo : null;
|
| 228 |
+
S.bandHi = typeof src.band_hi === "number" ? src.band_hi : null;
|
| 229 |
+
S.fracInBand = typeof src.frac_in_band === "number" ? src.frac_in_band : null;
|
| 230 |
+
S.svMinFinal = typeof src.sv_min_final === "number" ? src.sv_min_final : null;
|
| 231 |
+
S.svMaxFinal = typeof src.sv_max_final === "number" ? src.sv_max_final : null;
|
| 232 |
+
|
| 233 |
+
if (src.coeffs && typeof src.coeffs === "object") {
|
| 234 |
+
S.coA = typeof src.coeffs.a === "number" ? src.coeffs.a : null;
|
| 235 |
+
S.coB = typeof src.coeffs.b === "number" ? src.coeffs.b : null;
|
| 236 |
+
S.coC = typeof src.coeffs.c === "number" ? src.coeffs.c : null;
|
| 237 |
+
}
|
| 238 |
+
S.svSpectrum = Array.isArray(src.sv_spectrum) ? src.sv_spectrum : null;
|
| 239 |
+
S.matrixRaw = Array.isArray(src.matrix_raw) ? src.matrix_raw : null;
|
| 240 |
+
S.matrixOrtho = Array.isArray(src.matrix_ortho) ? src.matrix_ortho : null;
|
| 241 |
+
|
| 242 |
+
_updateAll();
|
| 243 |
+
_paintOverlay();
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
// =============================================================================
|
| 247 |
+
// geometry updaters
|
| 248 |
+
// =============================================================================
|
| 249 |
+
function _updateAll() {
|
| 250 |
+
_updateTrajectory();
|
| 251 |
+
_updateHeatmaps();
|
| 252 |
+
_updateBars();
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
// Rebuild the SV trajectory lines + band planes from the live spectrum.
|
| 256 |
+
function _updateTrajectory() {
|
| 257 |
+
const THREE = _THREE;
|
| 258 |
+
if (!_trajGroup) return;
|
| 259 |
+
const live = S.state === "live";
|
| 260 |
+
|
| 261 |
+
// dispose previous trajectory children (lines + planes)
|
| 262 |
+
for (let i = _trajGroup.children.length - 1; i >= 0; i--) {
|
| 263 |
+
const o = _trajGroup.children[i];
|
| 264 |
+
if (o.geometry && o.geometry.dispose) o.geometry.dispose();
|
| 265 |
+
if (o.material) {
|
| 266 |
+
const ms = Array.isArray(o.material) ? o.material : [o.material];
|
| 267 |
+
ms.forEach((m) => { if (m.dispose) m.dispose(); });
|
| 268 |
+
}
|
| 269 |
+
_trajGroup.remove(o);
|
| 270 |
+
}
|
| 271 |
+
|
| 272 |
+
if (!live || !S.svSpectrum || !S.svSpectrum.length) return;
|
| 273 |
+
|
| 274 |
+
const lo = (S.bandLo != null) ? S.bandLo : 0.68;
|
| 275 |
+
const hi = (S.bandHi != null) ? S.bandHi : 1.13;
|
| 276 |
+
const iters = S.svSpectrum.length; // ns_steps + 1
|
| 277 |
+
const width = (iters - 1) * TRAJ_DX;
|
| 278 |
+
|
| 279 |
+
// two band reference planes at y = lo and y = hi (violet-blue, translucent)
|
| 280 |
+
const planeGeo = new THREE.PlaneGeometry(width || TRAJ_DX, 5.0);
|
| 281 |
+
[lo, hi].forEach((yv) => {
|
| 282 |
+
const pm = new THREE.Mesh(
|
| 283 |
+
planeGeo,
|
| 284 |
+
new THREE.MeshBasicMaterial({ color: C_BAND, transparent: true, opacity: 0.10, side: THREE.DoubleSide }),
|
| 285 |
+
);
|
| 286 |
+
pm.rotation.x = -Math.PI / 2;
|
| 287 |
+
pm.position.set(width / 2, yv * TRAJ_YSC, 2.5);
|
| 288 |
+
_trajGroup.add(pm);
|
| 289 |
+
});
|
| 290 |
+
|
| 291 |
+
// one line per singular value: point (iter, σ_at_iter). Only draw a subset of
|
| 292 |
+
// ranks if very large, to keep the panel legible & cheap.
|
| 293 |
+
const rank = S.svSpectrum[0].length;
|
| 294 |
+
const stride = rank > 32 ? Math.ceil(rank / 32) : 1;
|
| 295 |
+
for (let s = 0; s < rank; s += stride) {
|
| 296 |
+
const pts = [];
|
| 297 |
+
for (let k = 0; k < iters; k++) {
|
| 298 |
+
const sv = (S.svSpectrum[k] && typeof S.svSpectrum[k][s] === "number") ? S.svSpectrum[k][s] : 0.0;
|
| 299 |
+
pts.push(new THREE.Vector3(k * TRAJ_DX, sv * TRAJ_YSC, 0));
|
| 300 |
+
}
|
| 301 |
+
const lg = new THREE.BufferGeometry().setFromPoints(pts);
|
| 302 |
+
const lm = new THREE.LineBasicMaterial({ color: C_SV, transparent: true, opacity: 0.7 });
|
| 303 |
+
_trajGroup.add(new THREE.Line(lg, lm));
|
| 304 |
+
}
|
| 305 |
+
}
|
| 306 |
+
|
| 307 |
+
// colour a heatmap grid from a matrix: sign -> hue (raw=lattice-blue tint,
|
| 308 |
+
// ortho=proof-teal tint), |value| -> opacity. Near-zero -> grey.
|
| 309 |
+
function _paintHeat(arr, mat, baseColor) {
|
| 310 |
+
const live = S.state === "live";
|
| 311 |
+
const rows = (live && mat && mat.length) ? Math.min(mat.length, HEAT_MAX) : 0;
|
| 312 |
+
const cols = (live && mat && mat[0]) ? Math.min(mat[0].length, HEAT_MAX) : 0;
|
| 313 |
+
|
| 314 |
+
// find max-abs for normalization
|
| 315 |
+
let amax = 0.0;
|
| 316 |
+
for (let r = 0; r < rows; r++) {
|
| 317 |
+
for (let c = 0; c < cols; c++) {
|
| 318 |
+
const v = Math.abs(mat[r][c]);
|
| 319 |
+
if (v > amax) amax = v;
|
| 320 |
+
}
|
| 321 |
+
}
|
| 322 |
+
if (amax <= 0.0) amax = 1.0;
|
| 323 |
+
|
| 324 |
+
for (let r = 0; r < HEAT_MAX; r++) {
|
| 325 |
+
for (let c = 0; c < HEAT_MAX; c++) {
|
| 326 |
+
const mesh = arr[r * HEAT_MAX + c];
|
| 327 |
+
if (!live || r >= rows || c >= cols) { mesh.visible = false; continue; }
|
| 328 |
+
mesh.visible = true;
|
| 329 |
+
const v = mat[r][c];
|
| 330 |
+
const mag = Math.min(1.0, Math.abs(v) / amax);
|
| 331 |
+
const color = mag < 0.04 ? C_ZERO : baseColor;
|
| 332 |
+
mesh.material.color.setHex(color);
|
| 333 |
+
mesh.material.opacity = 0.18 + 0.75 * mag;
|
| 334 |
+
}
|
| 335 |
+
}
|
| 336 |
+
}
|
| 337 |
+
|
| 338 |
+
function _updateHeatmaps() {
|
| 339 |
+
_paintHeat(_heatRaw, S.matrixRaw, C_RAW);
|
| 340 |
+
_paintHeat(_heatOrtho, S.matrixOrtho, C_ORTHO);
|
| 341 |
+
}
|
| 342 |
+
|
| 343 |
+
// condition-number bars: height ∝ log10(κ) so the raw (large κ) and
|
| 344 |
+
// orthogonalized (κ≈1) bars are both legible.
|
| 345 |
+
function _updateBars() {
|
| 346 |
+
const live = S.state === "live";
|
| 347 |
+
function setBar(mesh, kappa, color) {
|
| 348 |
+
if (!mesh) return;
|
| 349 |
+
if (!live || kappa == null) {
|
| 350 |
+
mesh.material.color.setHex(C_DIM);
|
| 351 |
+
mesh.material.emissive.setHex(C_DIM);
|
| 352 |
+
mesh.material.opacity = 0.3;
|
| 353 |
+
mesh.scale.y = 0.05;
|
| 354 |
+
mesh.position.y = 0.025;
|
| 355 |
+
return;
|
| 356 |
+
}
|
| 357 |
+
const h = Math.max(0.08, Math.log10(Math.max(1.0, kappa)) + 0.15) * 2.2;
|
| 358 |
+
mesh.scale.y = h;
|
| 359 |
+
mesh.position.y = h * 0.5;
|
| 360 |
+
mesh.material.color.setHex(color);
|
| 361 |
+
mesh.material.emissive.setHex(color);
|
| 362 |
+
mesh.material.emissiveIntensity = 0.4;
|
| 363 |
+
mesh.material.opacity = 0.92;
|
| 364 |
+
}
|
| 365 |
+
setBar(_barRaw, S.condRaw, C_RAW);
|
| 366 |
+
setBar(_barOrtho, S.condOrtho, C_ORTHO);
|
| 367 |
+
}
|
| 368 |
+
|
| 369 |
+
// =============================================================================
|
| 370 |
+
// per-frame animation
|
| 371 |
+
// =============================================================================
|
| 372 |
+
function _onFrame() {
|
| 373 |
+
const t = performance.now();
|
| 374 |
+
if (_group) _group.rotation.y = Math.sin(t * 0.00008) * 0.12;
|
| 375 |
+
}
|
| 376 |
+
|
| 377 |
+
// =============================================================================
|
| 378 |
+
// overlay
|
| 379 |
+
// =============================================================================
|
| 380 |
+
function _buildOverlay() {
|
| 381 |
+
const ctx = _ctx;
|
| 382 |
+
_overlay = document.createElement("div");
|
| 383 |
+
Object.assign(_overlay.style, {
|
| 384 |
+
position: "absolute", left: "14px", top: "14px", zIndex: "6",
|
| 385 |
+
display: "flex", flexDirection: "column", gap: "8px",
|
| 386 |
+
maxWidth: "min(94%,470px)",
|
| 387 |
+
font: "12px ui-sans-serif,system-ui,Segoe UI,Roboto,Arial",
|
| 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 |
+
_overlay.appendChild(sub);
|
| 407 |
+
|
| 408 |
+
const brow = document.createElement("div");
|
| 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 |
+
const pd = document.createElement("div");
|
| 472 |
+
pd.id = "mu-plain";
|
| 473 |
+
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";
|
| 474 |
+
_el["plain"] = pd;
|
| 475 |
+
_overlay.appendChild(pd);
|
| 476 |
+
|
| 477 |
+
(ctx.container || document.body).appendChild(_overlay);
|
| 478 |
+
_paintOverlay();
|
| 479 |
+
}
|
| 480 |
+
|
| 481 |
+
function _applyPlain() {
|
| 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 |
+
pd.innerHTML =
|
| 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 " +
|
| 494 |
+
"board before pressing play. It does this not with an expensive exact calculation but with a fast, " +
|
| 495 |
+
"GPU-friendly repeated formula (Newton\u2013Schulz) run about five times. Here the imbalance measure " +
|
| 496 |
+
"(\u201ccondition number\u201d) drops from about <b>" + cr + "</b> to about <b>" + co + "</b> \u2014 a " +
|
| 497 |
+
"<b>" + imp + "</b> flattening \u2014 and <b>" + frac + "</b> of the rebalanced values land in the target " +
|
| 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) {
|
| 505 |
+
if (s === "live") return null;
|
| 506 |
+
if (s === "missing") return "NO-LIVE-DATA";
|
| 507 |
+
if (s === "degraded") return "DEGRADED";
|
| 508 |
+
if (s === "error") return "OFFLINE";
|
| 509 |
+
return "\u2026";
|
| 510 |
+
}
|
| 511 |
+
|
| 512 |
+
function fx(v, d) { return typeof v === "number" ? v.toFixed(d) : "\u2014"; }
|
| 513 |
+
function pct(v, d) { return typeof v === "number" ? (v * 100).toFixed(d) + "%" : "\u2014"; }
|
| 514 |
+
function _set(id, v) { if (_el[id]) _el[id].textContent = v; }
|
| 515 |
+
|
| 516 |
+
function _paintOverlay() {
|
| 517 |
+
const t = _tok(S.state);
|
| 518 |
+
_set("mu-dims", t || ((S.m != null && S.n != null) ? (S.m + " \u00d7 " + S.n) : "\u2014"));
|
| 519 |
+
_set("mu-ns", t || (S.nsSteps != null ? String(S.nsSteps) : "\u2014"));
|
| 520 |
+
_set("mu-coeffs", t || ((S.coA != null) ? (fx(S.coA, 4) + " / " + fx(S.coB, 4) + " / " + fx(S.coC, 4)) : "\u2014"));
|
| 521 |
+
_set("mu-rank", t || (S.rank != null ? String(S.rank) : "\u2014"));
|
| 522 |
+
_set("mu-condr", t || fx(S.condRaw, 2));
|
| 523 |
+
_set("mu-condo", t || fx(S.condOrtho, 3));
|
| 524 |
+
_set("mu-condi", t || (S.condImp != null ? S.condImp.toFixed(1) + "\u00d7" : "\u2014"));
|
| 525 |
+
_set("mu-band", t || ((S.bandLo != null && S.bandHi != null) ? ("[" + S.bandLo + ", " + S.bandHi + "]") : "\u2014"));
|
| 526 |
+
_set("mu-frac", t || pct(S.fracInBand, 1));
|
| 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 (_plain) _applyPlain();
|
| 531 |
+
}
|
| 532 |
+
|
| 533 |
+
// =============================================================================
|
| 534 |
+
// unmount — clean up everything; must not affect other organs
|
| 535 |
+
// =============================================================================
|
| 536 |
+
export function unmount() {
|
| 537 |
+
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 538 |
+
try { if (_overlay && _overlay.parentNode) _overlay.parentNode.removeChild(_overlay); } catch (_) {}
|
| 539 |
+
try {
|
| 540 |
+
if (_group && _stage) {
|
| 541 |
+
_group.traverse((o) => {
|
| 542 |
+
if (o.geometry && o.geometry.dispose) o.geometry.dispose();
|
| 543 |
+
if (o.material) {
|
| 544 |
+
const ms = Array.isArray(o.material) ? o.material : [o.material];
|
| 545 |
+
ms.forEach((m) => { if (m.dispose) m.dispose(); });
|
| 546 |
+
}
|
| 547 |
+
});
|
| 548 |
+
_stage.scene.remove(_group);
|
| 549 |
+
}
|
| 550 |
+
} catch (_) {}
|
| 551 |
+
_group = _overlay = null;
|
| 552 |
+
_floor = null;
|
| 553 |
+
_trajGroup = null;
|
| 554 |
+
_heatRaw = []; _heatOrtho = []; _heatGroup = null;
|
| 555 |
+
_barRaw = null; _barOrtho = null; _barGroup = null;
|
| 556 |
+
_el = {}; _badge = null; _plain = false; _frameReg = false;
|
| 557 |
+
_stage = _THREE = _ctx = null;
|
| 558 |
+
S.label = S.m = S.n = S.nsSteps = null;
|
| 559 |
+
S.coA = S.coB = S.coC = null;
|
| 560 |
+
S.frobRaw = S.aspect = S.rank = null;
|
| 561 |
+
S.svSpectrum = null;
|
| 562 |
+
S.condRaw = S.condOrtho = S.condImp = null;
|
| 563 |
+
S.bandLo = S.bandHi = S.fracInBand = S.svMinFinal = S.svMaxFinal = null;
|
| 564 |
+
S.matrixRaw = S.matrixOrtho = null;
|
| 565 |
+
S.state = "init";
|
| 566 |
+
}
|
| 567 |
+
|
| 568 |
+
export default { id: ID, title: TITLE, endpoints: [EP], m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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// SPDX-License-Identifier: Apache-2.0
|
| 2 |
+
// © 2026 Lutar, Stephen P. — SZL Holdings · ORCID 0009-0001-0110-4173 · Doctrine v11
|
| 3 |
+
//
|
| 4 |
+
// surfaces/nvfp4.js — NVFP4 4-BIT TRAINING-FORMAT organ for the holographic
|
| 5 |
+
// frontier ring. Visualizes a deterministic toy arithmetic demonstration of
|
| 6 |
+
// block-scaled 4-bit floating-point (FP4 E2M1) quantization, from the live
|
| 7 |
+
// snapshot at /api/killinchu/v1/nvfp4/quantize. Three things are rendered:
|
| 8 |
+
// (1) reconstruction-error MSE bars per scheme — naive-FP4 (single global
|
| 9 |
+
// scale) vs MXFP4 (32-elem blocks, power-of-two scale) vs NVFP4 (16-elem
|
| 10 |
+
// blocks, E4M3 FP8 scale + FP32 global; two-level). Errors are MEASURED
|
| 11 |
+
// and shown, never hidden.
|
| 12 |
+
// (2) a cumulative rounding-bias line — deterministic round-to-nearest
|
| 13 |
+
// (DRIFTS) vs stochastic rounding (stays near zero) over N roundings of a
|
| 14 |
+
// fixed delta.
|
| 15 |
+
// (3) a two-level NVFP4 scaling-pipeline diagram: tensor -> FP32 global scale
|
| 16 |
+
// -> E4M3 block scale -> FP4 value.
|
| 17 |
+
// Honesty label "MODELED" is read VERBATIM from the JSON and displayed as-is;
|
| 18 |
+
// never upgraded.
|
| 19 |
+
//
|
| 20 |
+
// Surface export shape (mirrors ternary.js / kvcache.js exactly):
|
| 21 |
+
// export default { id, title, endpoints, mount(ctx), unmount() }
|
| 22 |
+
// ctx = { stage, container, live, label, THREE, szl3d }
|
| 23 |
+
//
|
| 24 |
+
// DATA SHOWN (all from live endpoint):
|
| 25 |
+
// size, outliers, tensor_amax, best_scheme, fp4_levels[],
|
| 26 |
+
// schemes[]{name, block_size, scale_format, two_level, mse, max_abs_err},
|
| 27 |
+
// rounding{n, delta, det_final_bias, stoch_final_bias,
|
| 28 |
+
// det_bias_series[], stoch_bias_series[]}
|
| 29 |
+
//
|
| 30 |
+
// LEADERS ADOPTED & CITED (clean-room; NOT claimed as SZL's own; VERIFY real):
|
| 31 |
+
// NVFP4 pretraining — Agrusa, Rouhani, Micikevicius, Patwary, Shoeybi et al.
|
| 32 |
+
// (NVIDIA) arXiv:2509.25149 https://arxiv.org/abs/2509.25149
|
| 33 |
+
// MXFP4 / OCP Microscaling — Rouhani et al. arXiv:2310.10537
|
| 34 |
+
// https://arxiv.org/pdf/2310.10537
|
| 35 |
+
// Introducing NVFP4 (NVIDIA blog):
|
| 36 |
+
// https://developer.nvidia.com/blog/introducing-nvfp4-for-efficient-and-accurate-low-precision-inference/
|
| 37 |
+
// Oscillation-Reduced MXFP4 Training (TetraJet) arXiv:2502.20853
|
| 38 |
+
// https://arxiv.org/abs/2502.20853
|
| 39 |
+
//
|
| 40 |
+
// HONESTY LABELS: MODELED (deterministic ARITHMETIC DEMONSTRATION of the FP4
|
| 41 |
+
// block-scaling + two-level-scaling + stochastic-rounding MECHANISMS on a toy
|
| 42 |
+
// synthetic tensor; NO GPU kernel executed, NOT the trained model; error is
|
| 43 |
+
// MEASURED and displayed). Read verbatim from JSON; never upgraded here.
|
| 44 |
+
// COLOURS: proof-teal 0x3af4c8 (NVFP4 / best), lattice-blue 0x5b8dee (MXFP4 /
|
| 45 |
+
// deterministic line), violet-blue 0x8a6bff (naive / accent), greys
|
| 46 |
+
// (0x5a6570 / 0x42505d, degraded / stochastic line). Purple BANNED.
|
| 47 |
+
// 0 RUNTIME CDN. Vendored three.js via ctx.THREE (page importmap).
|
| 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 |
+
|
| 54 |
+
// Endpoint hosted on the dedicated killinchu Space (isolated compute), reached
|
| 55 |
+
// cross-origin (killinchu returns access-control-allow-origin for the flagship).
|
| 56 |
+
const EP = "https://szlholdings-killinchu.hf.space/api/killinchu/v1/nvfp4/quantize?seed=42&size=32&outliers=3";
|
| 57 |
+
|
| 58 |
+
// data-viz hues — purple BANNED
|
| 59 |
+
const C_NV = 0x3af4c8; // proof-teal (NVFP4 / best scheme)
|
| 60 |
+
const C_MX = 0x5b8dee; // lattice-blue (MXFP4 / deterministic rounding line)
|
| 61 |
+
const C_NAIVE = 0x8a6bff; // violet-blue (naive-FP4 / accent)
|
| 62 |
+
const C_STOCH = 0x3af4c8; // proof-teal (stochastic rounding line)
|
| 63 |
+
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, _overlay = null;
|
| 68 |
+
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
| 69 |
+
let _plain = false;
|
| 70 |
+
|
| 71 |
+
// geometry handles
|
| 72 |
+
let _floor = null;
|
| 73 |
+
let _bars = []; // Array<THREE.Mesh> — one MSE bar per scheme
|
| 74 |
+
let _detLine = null; // THREE.Line — deterministic cumulative bias
|
| 75 |
+
let _stochLine= null; // THREE.Line — stochastic cumulative bias
|
| 76 |
+
let _biasZero = null; // THREE.Line — zero baseline for the bias plot
|
| 77 |
+
let _pipe = []; // Array<THREE.Mesh> — two-level pipeline diagram stages
|
| 78 |
+
|
| 79 |
+
// bar layout
|
| 80 |
+
const BAR_X0 = 0.0;
|
| 81 |
+
const BAR_GAP = 1.5;
|
| 82 |
+
const BAR_W = 0.7;
|
| 83 |
+
const BAR_MAXH = 3.2;
|
| 84 |
+
|
| 85 |
+
// bias-plot layout
|
| 86 |
+
const PLOT_X0 = 6.2;
|
| 87 |
+
const PLOT_W = 4.2;
|
| 88 |
+
const PLOT_Y = 1.6;
|
| 89 |
+
const PLOT_H = 2.0;
|
| 90 |
+
|
| 91 |
+
// pipeline layout
|
| 92 |
+
const PIPE_X0 = 0.0;
|
| 93 |
+
const PIPE_Z = 4.4;
|
| 94 |
+
const PIPE_GAP = 1.7;
|
| 95 |
+
|
| 96 |
+
// live state
|
| 97 |
+
const S = {
|
| 98 |
+
label: null,
|
| 99 |
+
size: null,
|
| 100 |
+
outliers: null,
|
| 101 |
+
tensorAmax: null,
|
| 102 |
+
bestScheme: null,
|
| 103 |
+
fp4Levels: null, // array
|
| 104 |
+
schemes: null, // array of {name, mse, max_abs_err, block_size, scale_format, two_level}
|
| 105 |
+
rDelta: null,
|
| 106 |
+
rN: null,
|
| 107 |
+
detFinal: null,
|
| 108 |
+
stochFinal: null,
|
| 109 |
+
detSeries: null, // array
|
| 110 |
+
stochSeries: null, // array
|
| 111 |
+
state: "init",
|
| 112 |
+
};
|
| 113 |
+
|
| 114 |
+
// =============================================================================
|
| 115 |
+
// mount(ctx)
|
| 116 |
+
// =============================================================================
|
| 117 |
+
export function mount(ctx) {
|
| 118 |
+
_ctx = ctx; _stage = ctx.stage; _THREE = ctx.THREE;
|
| 119 |
+
_group = new _THREE.Group();
|
| 120 |
+
_stage.scene.add(_group);
|
| 121 |
+
_stage.camera.position.set(5, 7, 15);
|
| 122 |
+
try { if (_stage.controls && _stage.controls.target) { _stage.controls.target.set(4, 1, 2); _stage.controls.update(); } } catch (_) {}
|
| 123 |
+
try { _stage.setBloom(true); } catch (_) {}
|
| 124 |
+
|
| 125 |
+
_buildFloor();
|
| 126 |
+
_buildBars();
|
| 127 |
+
_buildBiasPlot();
|
| 128 |
+
_buildPipeline();
|
| 129 |
+
|
| 130 |
+
if (!_frameReg) { _stage.onFrame(_onFrame); _frameReg = true; }
|
| 131 |
+
|
| 132 |
+
_badge = ctx.live.createBadge();
|
| 133 |
+
_polls.push(ctx.live.poll(EP, 5000, _onNvfp4, { badge: _badge, onState: (m) => { S.state = m.state; _updateScene(); _paintOverlay(); } }));
|
| 134 |
+
|
| 135 |
+
_buildOverlay();
|
| 136 |
+
return { id: ID, started: true };
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
// =============================================================================
|
| 140 |
+
// builders
|
| 141 |
+
// =============================================================================
|
| 142 |
+
function _buildFloor() {
|
| 143 |
+
const THREE = _THREE;
|
| 144 |
+
const grid = new THREE.GridHelper(40, 40, C_GRID, 0x0f2027);
|
| 145 |
+
grid.material.opacity = 0.18; grid.material.transparent = true; grid.position.y = -0.01;
|
| 146 |
+
_group.add(grid);
|
| 147 |
+
_floor = grid;
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
// three MSE bars: naive-FP4 (violet-blue), MXFP4 (lattice-blue), NVFP4 (proof-teal)
|
| 151 |
+
function _buildBars() {
|
| 152 |
+
const THREE = _THREE;
|
| 153 |
+
const cols = [C_NAIVE, C_MX, C_NV];
|
| 154 |
+
const geo = new THREE.BoxGeometry(BAR_W, 1, BAR_W);
|
| 155 |
+
for (let i = 0; i < 3; i++) {
|
| 156 |
+
const mesh = new THREE.Mesh(
|
| 157 |
+
geo,
|
| 158 |
+
new THREE.MeshStandardMaterial({ color: cols[i], emissive: cols[i], emissiveIntensity: 0.35, transparent: true, opacity: 0.9 }),
|
| 159 |
+
);
|
| 160 |
+
mesh.position.set(BAR_X0 + i * BAR_GAP, 0.5, 0);
|
| 161 |
+
mesh.scale.y = 0.02;
|
| 162 |
+
_group.add(mesh);
|
| 163 |
+
_bars.push(mesh);
|
| 164 |
+
}
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
// two poly-lines for cumulative rounding bias + a zero baseline
|
| 168 |
+
function _buildBiasPlot() {
|
| 169 |
+
const THREE = _THREE;
|
| 170 |
+
// zero baseline
|
| 171 |
+
const zg = new THREE.BufferGeometry();
|
| 172 |
+
zg.setAttribute("position", new THREE.Float32BufferAttribute([PLOT_X0, PLOT_Y, 0, PLOT_X0 + PLOT_W, PLOT_Y, 0], 3));
|
| 173 |
+
_biasZero = new THREE.Line(zg, new THREE.LineBasicMaterial({ color: C_ZERO, transparent: true, opacity: 0.5 }));
|
| 174 |
+
_group.add(_biasZero);
|
| 175 |
+
|
| 176 |
+
const dg = new THREE.BufferGeometry();
|
| 177 |
+
dg.setAttribute("position", new THREE.Float32BufferAttribute([PLOT_X0, PLOT_Y, 0, PLOT_X0, PLOT_Y, 0], 3));
|
| 178 |
+
_detLine = new THREE.Line(dg, new THREE.LineBasicMaterial({ color: C_MX }));
|
| 179 |
+
_group.add(_detLine);
|
| 180 |
+
|
| 181 |
+
const sg = new THREE.BufferGeometry();
|
| 182 |
+
sg.setAttribute("position", new THREE.Float32BufferAttribute([PLOT_X0, PLOT_Y, 0, PLOT_X0, PLOT_Y, 0], 3));
|
| 183 |
+
_stochLine = new THREE.Line(sg, new THREE.LineBasicMaterial({ color: C_STOCH }));
|
| 184 |
+
_group.add(_stochLine);
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
// two-level scaling pipeline: tensor -> FP32 global -> E4M3 block -> FP4 value
|
| 188 |
+
function _buildPipeline() {
|
| 189 |
+
const THREE = _THREE;
|
| 190 |
+
const stageCols = [C_NAIVE, C_NAIVE, C_MX, C_NV]; // tensor, global, block, fp4
|
| 191 |
+
const shapes = [
|
| 192 |
+
new THREE.BoxGeometry(0.6, 0.6, 0.6),
|
| 193 |
+
new THREE.OctahedronGeometry(0.42, 0),
|
| 194 |
+
new THREE.OctahedronGeometry(0.42, 0),
|
| 195 |
+
new THREE.IcosahedronGeometry(0.42, 0),
|
| 196 |
+
];
|
| 197 |
+
for (let i = 0; i < 4; i++) {
|
| 198 |
+
const c = stageCols[i];
|
| 199 |
+
const mesh = new THREE.Mesh(
|
| 200 |
+
shapes[i],
|
| 201 |
+
new THREE.MeshStandardMaterial({ color: c, emissive: c, emissiveIntensity: 0.3, transparent: true, opacity: 0.85, wireframe: i > 0 }),
|
| 202 |
+
);
|
| 203 |
+
mesh.position.set(PIPE_X0 + i * PIPE_GAP, 0.55, PIPE_Z);
|
| 204 |
+
_group.add(mesh);
|
| 205 |
+
_pipe.push(mesh);
|
| 206 |
+
// connecting link to previous stage
|
| 207 |
+
if (i > 0) {
|
| 208 |
+
const lg = new THREE.BufferGeometry();
|
| 209 |
+
lg.setAttribute("position", new THREE.Float32BufferAttribute([
|
| 210 |
+
PIPE_X0 + (i - 1) * PIPE_GAP, 0.55, PIPE_Z,
|
| 211 |
+
PIPE_X0 + i * PIPE_GAP, 0.55, PIPE_Z,
|
| 212 |
+
], 3));
|
| 213 |
+
const link = new THREE.Line(lg, new THREE.LineBasicMaterial({ color: C_GRID, transparent: true, opacity: 0.6 }));
|
| 214 |
+
_group.add(link);
|
| 215 |
+
_pipe.push(link);
|
| 216 |
+
}
|
| 217 |
+
}
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
// =============================================================================
|
| 221 |
+
// live data handler
|
| 222 |
+
// =============================================================================
|
| 223 |
+
function _onNvfp4(j) {
|
| 224 |
+
// read honesty label VERBATIM — never upgrade. handle top-level or nested.
|
| 225 |
+
const lbl = (j && j.label != null) ? j.label
|
| 226 |
+
: (j && j.payload && j.payload.label != null) ? j.payload.label
|
| 227 |
+
: "MODELED";
|
| 228 |
+
const src = (j && j.payload && typeof j.payload === "object") ? j.payload : j;
|
| 229 |
+
S.label = String(lbl).toUpperCase();
|
| 230 |
+
|
| 231 |
+
S.size = typeof src.size === "number" ? src.size : null;
|
| 232 |
+
S.outliers = typeof src.outliers === "number" ? src.outliers : null;
|
| 233 |
+
S.tensorAmax = typeof src.tensor_amax === "number" ? src.tensor_amax : null;
|
| 234 |
+
S.bestScheme = typeof src.best_scheme === "string" ? src.best_scheme : null;
|
| 235 |
+
S.fp4Levels = Array.isArray(src.fp4_levels) ? src.fp4_levels : null;
|
| 236 |
+
S.schemes = Array.isArray(src.schemes) ? src.schemes : null;
|
| 237 |
+
|
| 238 |
+
if (src.rounding && typeof src.rounding === "object") {
|
| 239 |
+
const r = src.rounding;
|
| 240 |
+
S.rDelta = typeof r.delta === "number" ? r.delta : null;
|
| 241 |
+
S.rN = typeof r.n === "number" ? r.n : null;
|
| 242 |
+
S.detFinal = typeof r.det_final_bias === "number" ? r.det_final_bias : null;
|
| 243 |
+
S.stochFinal = typeof r.stoch_final_bias === "number" ? r.stoch_final_bias : null;
|
| 244 |
+
S.detSeries = Array.isArray(r.det_bias_series) ? r.det_bias_series : null;
|
| 245 |
+
S.stochSeries = Array.isArray(r.stoch_bias_series) ? r.stoch_bias_series : null;
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
_updateScene();
|
| 249 |
+
_paintOverlay();
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
// =============================================================================
|
| 253 |
+
// scene updater
|
| 254 |
+
// =============================================================================
|
| 255 |
+
function _schemeByName(nm) {
|
| 256 |
+
if (!S.schemes) return null;
|
| 257 |
+
for (const s of S.schemes) if (s && s.name === nm) return s;
|
| 258 |
+
return null;
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
function _updateScene() {
|
| 262 |
+
const live = S.state === "live" && S.schemes;
|
| 263 |
+
|
| 264 |
+
// ---- MSE bars ----
|
| 265 |
+
const order = ["naive-FP4", "MXFP4", "NVFP4"];
|
| 266 |
+
const cols = [C_NAIVE, C_MX, C_NV];
|
| 267 |
+
let maxMse = 0;
|
| 268 |
+
if (live) {
|
| 269 |
+
for (const nm of order) {
|
| 270 |
+
const s = _schemeByName(nm);
|
| 271 |
+
if (s && typeof s.mse === "number" && s.mse > maxMse) maxMse = s.mse;
|
| 272 |
+
}
|
| 273 |
+
}
|
| 274 |
+
for (let i = 0; i < _bars.length; i++) {
|
| 275 |
+
const bar = _bars[i];
|
| 276 |
+
if (!live || maxMse <= 0) {
|
| 277 |
+
bar.material.color.setHex(C_DIM);
|
| 278 |
+
bar.material.emissive.setHex(C_DIM);
|
| 279 |
+
bar.material.opacity = 0.35;
|
| 280 |
+
bar.scale.y = 0.02;
|
| 281 |
+
bar.position.y = 0.01;
|
| 282 |
+
continue;
|
| 283 |
+
}
|
| 284 |
+
const s = _schemeByName(order[i]);
|
| 285 |
+
const mse = (s && typeof s.mse === "number") ? s.mse : 0;
|
| 286 |
+
const h = Math.max(0.02, (mse / maxMse) * BAR_MAXH);
|
| 287 |
+
bar.scale.y = h;
|
| 288 |
+
bar.position.y = h / 2;
|
| 289 |
+
const isBest = S.bestScheme && order[i] === S.bestScheme;
|
| 290 |
+
bar.material.color.setHex(cols[i]);
|
| 291 |
+
bar.material.emissive.setHex(cols[i]);
|
| 292 |
+
bar.material.emissiveIntensity = isBest ? 0.65 : 0.3;
|
| 293 |
+
bar.material.opacity = 0.92;
|
| 294 |
+
}
|
| 295 |
+
|
| 296 |
+
// ---- rounding-bias lines ----
|
| 297 |
+
_updateBiasLine(_detLine, live ? S.detSeries : null);
|
| 298 |
+
_updateBiasLine(_stochLine, live ? S.stochSeries : null);
|
| 299 |
+
|
| 300 |
+
// ---- pipeline highlight ----
|
| 301 |
+
for (const m of _pipe) {
|
| 302 |
+
if (m.material && m.material.emissive) {
|
| 303 |
+
m.material.emissiveIntensity = live ? 0.4 : 0.12;
|
| 304 |
+
m.material.opacity = live ? 0.85 : 0.3;
|
| 305 |
+
}
|
| 306 |
+
}
|
| 307 |
+
}
|
| 308 |
+
|
| 309 |
+
function _updateBiasLine(line, series) {
|
| 310 |
+
if (!line) return;
|
| 311 |
+
const THREE = _THREE;
|
| 312 |
+
if (!series || series.length < 2) {
|
| 313 |
+
// collapse to a flat segment on the baseline
|
| 314 |
+
line.geometry.setAttribute("position", new THREE.Float32BufferAttribute([PLOT_X0, PLOT_Y, 0, PLOT_X0 + PLOT_W, PLOT_Y, 0], 3));
|
| 315 |
+
line.geometry.attributes.position.needsUpdate = true;
|
| 316 |
+
line.visible = S.state === "live";
|
| 317 |
+
return;
|
| 318 |
+
}
|
| 319 |
+
// symmetric vertical scale from the max abs across BOTH series so the drift
|
| 320 |
+
// vs near-zero contrast is faithful (never invented — from live data only).
|
| 321 |
+
let amax = 1e-6;
|
| 322 |
+
const scan = (arr) => { if (Array.isArray(arr)) for (const v of arr) { const a = Math.abs(v); if (a > amax) amax = a; } };
|
| 323 |
+
scan(S.detSeries); scan(S.stochSeries);
|
| 324 |
+
const n = series.length;
|
| 325 |
+
const pos = new Float32Array(n * 3);
|
| 326 |
+
for (let i = 0; i < n; i++) {
|
| 327 |
+
const x = PLOT_X0 + (i / (n - 1)) * PLOT_W;
|
| 328 |
+
const y = PLOT_Y + (series[i] / amax) * (PLOT_H / 2);
|
| 329 |
+
pos[i * 3 + 0] = x;
|
| 330 |
+
pos[i * 3 + 1] = y;
|
| 331 |
+
pos[i * 3 + 2] = 0;
|
| 332 |
+
}
|
| 333 |
+
line.geometry.setAttribute("position", new THREE.Float32BufferAttribute(pos, 3));
|
| 334 |
+
line.geometry.attributes.position.needsUpdate = true;
|
| 335 |
+
line.geometry.computeBoundingSphere();
|
| 336 |
+
line.visible = true;
|
| 337 |
+
}
|
| 338 |
+
|
| 339 |
+
// =============================================================================
|
| 340 |
+
// per-frame animation
|
| 341 |
+
// =============================================================================
|
| 342 |
+
function _onFrame() {
|
| 343 |
+
const t = performance.now();
|
| 344 |
+
if (_group) _group.rotation.y = Math.sin(t * 0.00009) * 0.12;
|
| 345 |
+
for (let i = 0; i < _pipe.length; i++) {
|
| 346 |
+
const m = _pipe[i];
|
| 347 |
+
if (m && m.rotation && m.geometry && m.geometry.type !== "BufferGeometry") {
|
| 348 |
+
m.rotation.y += 0.012;
|
| 349 |
+
}
|
| 350 |
+
}
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
+
// =============================================================================
|
| 354 |
+
// overlay
|
| 355 |
+
// =============================================================================
|
| 356 |
+
function _buildOverlay() {
|
| 357 |
+
const ctx = _ctx;
|
| 358 |
+
_overlay = document.createElement("div");
|
| 359 |
+
Object.assign(_overlay.style, {
|
| 360 |
+
position: "absolute", left: "14px", top: "14px", zIndex: "6",
|
| 361 |
+
display: "flex", flexDirection: "column", gap: "8px",
|
| 362 |
+
maxWidth: "min(94%,470px)",
|
| 363 |
+
font: "12px ui-sans-serif,system-ui,Segoe UI,Roboto,Arial",
|
| 364 |
+
color: "#eef3f6",
|
| 365 |
+
});
|
| 366 |
+
|
| 367 |
+
const h = document.createElement("div");
|
| 368 |
+
h.style.cssText = "font:600 13px ui-sans-serif,system-ui;letter-spacing:.4px";
|
| 369 |
+
h.textContent = TITLE + " (live)";
|
| 370 |
+
_overlay.appendChild(h);
|
| 371 |
+
|
| 372 |
+
const sub = document.createElement("div");
|
| 373 |
+
sub.style.cssText = "color:#9fb1bf;font-size:11px;line-height:1.55";
|
| 374 |
+
sub.innerHTML =
|
| 375 |
+
'A synthetic tensor with a few injected <b>outliers</b> is quantized to 4-bit float (<b>FP4 E2M1</b>) three ways, ' +
|
| 376 |
+
'then dequantized: <b>naive</b> (one global scale) vs <b>MXFP4</b> (32-elem blocks, power-of-two scale) vs ' +
|
| 377 |
+
'<b>NVFP4</b> (16-elem blocks, <b>E4M3</b> FP8 block scale + <b>FP32</b> global \u2014 <b>two-level</b>). Bars show ' +
|
| 378 |
+
'the MEASURED reconstruction <b>MSE</b> per scheme (shown, NOT hidden). The line plot contrasts <b>deterministic</b> ' +
|
| 379 |
+
'round-to-nearest (drifts) vs <b>stochastic</b> rounding (near zero) over repeated roundings. Honesty label ' +
|
| 380 |
+
'<b>MODELED</b> \u2014 arithmetic demonstration only, no GPU kernel executed. 0 runtime CDN.';
|
| 381 |
+
_overlay.appendChild(sub);
|
| 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 |
+
card.appendChild(pipe);
|
| 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 _applyPlain() {
|
| 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 |
+
pd.innerHTML =
|
| 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 " +
|
| 480 |
+
"(error here \u2248 <b>" + naiveTxt + "</b>). <b>MXFP4</b> scales each 32-number block, and <b>NVFP4</b> scales each " +
|
| 481 |
+
"smaller 16-number block with a more precise scale plus a second whole-tensor scale (\u201ctwo-level\u201d) \u2014 giving the " +
|
| 482 |
+
"lowest error here (\u2248 <b>" + nvTxt + "</b>). The line plot shows a second idea: always rounding the same way " +
|
| 483 |
+
"(<b>deterministic</b>) lets tiny errors pile up in one direction (bias drifts to \u2248 <b>" + detTxt + "</b>), while " +
|
| 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) {
|
| 491 |
+
if (s === "live") return null;
|
| 492 |
+
if (s === "missing") return "NO-LIVE-DATA";
|
| 493 |
+
if (s === "degraded") return "DEGRADED";
|
| 494 |
+
if (s === "error") return "OFFLINE";
|
| 495 |
+
return "\u2026";
|
| 496 |
+
}
|
| 497 |
+
|
| 498 |
+
function _set(id, v) { if (_el[id]) _el[id].textContent = v; }
|
| 499 |
+
function _mseTxt(nm) {
|
| 500 |
+
const s = _schemeByName(nm);
|
| 501 |
+
return (s && typeof s.mse === "number") ? s.mse.toExponential(3) : "\u2014";
|
| 502 |
+
}
|
| 503 |
+
|
| 504 |
+
function _paintOverlay() {
|
| 505 |
+
const t = _tok(S.state);
|
| 506 |
+
_set("nv-size", t || (S.size != null ? (S.size + " \u00d7 " + S.size) : "\u2014"));
|
| 507 |
+
_set("nv-outl", t || (S.outliers != null ? String(S.outliers) : "\u2014"));
|
| 508 |
+
_set("nv-amax", t || (typeof S.tensorAmax === "number" ? S.tensorAmax.toFixed(3) : "\u2014"));
|
| 509 |
+
_set("nv-naive", t || _mseTxt("naive-FP4"));
|
| 510 |
+
_set("nv-mx", t || _mseTxt("MXFP4"));
|
| 511 |
+
_set("nv-nv", t || _mseTxt("NVFP4"));
|
| 512 |
+
_set("nv-best", t || (S.bestScheme || "\u2014"));
|
| 513 |
+
_set("nv-rn", t || ((S.rN != null && S.rDelta != null) ? (S.rN + " \u00d7 \u03b4=" + S.rDelta) : "\u2014"));
|
| 514 |
+
_set("nv-det", t || (typeof S.detFinal === "number" ? S.detFinal.toFixed(3) : "\u2014"));
|
| 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 (_plain) _applyPlain();
|
| 519 |
+
}
|
| 520 |
+
|
| 521 |
+
// =============================================================================
|
| 522 |
+
// unmount — clean up everything; must not affect other organs
|
| 523 |
+
// =============================================================================
|
| 524 |
+
export function unmount() {
|
| 525 |
+
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 526 |
+
try { if (_overlay && _overlay.parentNode) _overlay.parentNode.removeChild(_overlay); } catch (_) {}
|
| 527 |
+
try {
|
| 528 |
+
if (_group && _stage) {
|
| 529 |
+
_group.traverse((o) => {
|
| 530 |
+
if (o.geometry && o.geometry.dispose) o.geometry.dispose();
|
| 531 |
+
if (o.material) {
|
| 532 |
+
const ms = Array.isArray(o.material) ? o.material : [o.material];
|
| 533 |
+
ms.forEach((m) => { if (m.dispose) m.dispose(); });
|
| 534 |
+
}
|
| 535 |
+
});
|
| 536 |
+
_stage.scene.remove(_group);
|
| 537 |
+
}
|
| 538 |
+
} catch (_) {}
|
| 539 |
+
_group = _overlay = null;
|
| 540 |
+
_floor = null; _bars = []; _detLine = null; _stochLine = null; _biasZero = null; _pipe = [];
|
| 541 |
+
_el = {}; _badge = null; _plain = false; _frameReg = false;
|
| 542 |
+
_stage = _THREE = _ctx = null;
|
| 543 |
+
S.label = S.size = S.outliers = S.tensorAmax = S.bestScheme = null;
|
| 544 |
+
S.fp4Levels = S.schemes = null;
|
| 545 |
+
S.rDelta = S.rN = S.detFinal = S.stochFinal = S.detSeries = S.stochSeries = null;
|
| 546 |
+
S.state = "init";
|
| 547 |
+
}
|
| 548 |
+
|
| 549 |
+
export default { id: ID, title: TITLE, endpoints: [EP], mount, unmount };
|
static/3d/surfaces/specexec.js
ADDED
|
@@ -0,0 +1,560 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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aces/specexec.js — TREE SPECULATIVE EXECUTION organ for the holographic
|
| 5 |
+
// frontier ring (token-tree speculative decoding: a static fixed-shape tree vs.
|
| 6 |
+
// an EAGLE-2-style dynamic Expansion/Rerank tree, verified against a scripted
|
| 7 |
+
// min(1,p/q) acceptance oracle). Renders three views from the live snapshot at
|
| 8 |
+
// /api/killinchu/v1/specexec/tree:
|
| 9 |
+
// (1) a 3D TREE DIAGRAM — nodes laid out by depth (y-axis), colored by depth,
|
| 10 |
+
// edges (root→child) widened by the child's synthetic confidence/value V_i;
|
| 11 |
+
// (2) a TREE CAUSAL-ATTENTION MASK heatmap — the binary ancestor mask (each
|
| 12 |
+
// node attends only to its ancestors) that lets the whole tree be verified
|
| 13 |
+
// in ONE forward pass (SpecInfer);
|
| 14 |
+
// (3) a BAR CHART of expected accepted-path length: static tree vs. dynamic
|
| 15 |
+
// (Expansion/Rerank) tree under the same synthetic confidences.
|
| 16 |
+
// Honesty label "MODELED" is read VERBATIM from the JSON and displayed as-is;
|
| 17 |
+
// it is never upgraded.
|
| 18 |
+
//
|
| 19 |
+
// Surface export shape (mirrors ternary.js / kvcache.js exactly):
|
| 20 |
+
// export default { id, title, endpoints, mount(ctx), unmount() }
|
| 21 |
+
// ctx = { stage, container, live, label, THREE, szl3d }
|
| 22 |
+
//
|
| 23 |
+
// DATA SHOWN (all from live endpoint):
|
| 24 |
+
// depth, branch, budget, static_nodes, dynamic_nodes,
|
| 25 |
+
// static_expected_accepted_path_length, dynamic_expected_accepted_path_length,
|
| 26 |
+
// improvement_ratio, nodes[]{id,parent,depth,confidence,value,accepted},
|
| 27 |
+
// attention_mask[][]
|
| 28 |
+
//
|
| 29 |
+
// LEADERS ADOPTED & CITED (clean-room; NOT claimed as SZL's own; VERIFY real):
|
| 30 |
+
// Sequoia (DP-optimal token trees): arXiv:2402.12374
|
| 31 |
+
// https://arxiv.org/abs/2402.12374
|
| 32 |
+
// EAGLE-2 (context-aware dynamic draft tree; Expansion/Rerank): arXiv:2406.16858
|
| 33 |
+
// https://arxiv.org/abs/2406.16858
|
| 34 |
+
// Medusa (multi-head, tree attention, typical acceptance): arXiv:2401.10774
|
| 35 |
+
// https://arxiv.org/abs/2401.10774
|
| 36 |
+
// SpecInfer (token-tree verification; tree-structured causal mask), CMU PDF:
|
| 37 |
+
// https://www.cs.cmu.edu/~zhihaoj2/papers/specinfer.pdf
|
| 38 |
+
//
|
| 39 |
+
// HONESTY LABELS: MODELED (deterministic toy tree-walk demonstrating the tree
|
| 40 |
+
// topology + Expansion/Rerank value-propagation + min(1,p/q) acceptance
|
| 41 |
+
// MECHANISM on a synthetic token-tree; NOT a live LLM; no real draft/target
|
| 42 |
+
// model, no real tokens, no forward pass; expected-path-length values are
|
| 43 |
+
// computed exactly and DISPLAYED). Read verbatim from JSON; never upgraded.
|
| 44 |
+
// COLOURS (allowed hues only; purple BANNED): lattice-blue 0x5b8dee,
|
| 45 |
+
// violet-blue 0x8a6bff, proof-teal 0x3af4c8, greys 0x5a6570 / 0x42505d.
|
| 46 |
+
// 0 RUNTIME CDN. Vendored three.js via ctx.THREE (page importmap).
|
| 47 |
+
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 48 |
+
// Nothing here is in the locked-8. Λ stays Conjecture 1. Trust never 100%.
|
| 49 |
+
|
| 50 |
+
const ID = "specexec";
|
| 51 |
+
const TITLE = "Tree Speculative Execution";
|
| 52 |
+
|
| 53 |
+
// Endpoint is hosted on the dedicated killinchu Space (isolated compute), reached
|
| 54 |
+
// cross-origin (killinchu returns access-control-allow-origin for the flagship).
|
| 55 |
+
const EP = "https://szlholdings-killinchu.hf.space/api/killinchu/v1/specexec/tree?seed=42&depth=4&branch=3&budget=24";
|
| 56 |
+
|
| 57 |
+
// data-viz hues — purple BANNED
|
| 58 |
+
const C_D0 = 0x3af4c8; // proof-teal (depth 0 / root)
|
| 59 |
+
const C_D1 = 0x5b8dee; // lattice-blue (depth 1)
|
| 60 |
+
const C_D2 = 0x8a6bff; // violet-blue (depth 2)
|
| 61 |
+
const C_D3 = 0x3af4c8; // proof-teal (depth 3 — cycles back)
|
| 62 |
+
const C_DEEP = 0x5b8dee; // lattice-blue (depth ≥ 4)
|
| 63 |
+
const C_EDGE = 0x3af4c8; // proof-teal (tree edges)
|
| 64 |
+
const C_DYN = 0x3af4c8; // proof-teal (dynamic bar)
|
| 65 |
+
const C_STAT = 0x5b8dee; // lattice-blue (static bar)
|
| 66 |
+
const C_MASK = 0x8a6bff; // violet-blue (attention-mask "attends" cell)
|
| 67 |
+
const C_DIM = 0x42505d; // grey (degraded / no-live-data)
|
| 68 |
+
const C_ZERO = 0x5a6570; // grey (mask "no-attend" / empty)
|
| 69 |
+
const C_GRID = 0x1b3a44; // floor / link colour
|
| 70 |
+
|
| 71 |
+
// layout geometry
|
| 72 |
+
const DEPTH_GAP = 1.6; // world-units per depth level (y)
|
| 73 |
+
const SPREAD = 6.0; // horizontal spread of the tree (x)
|
| 74 |
+
const MASK_ORIGIN = { x: 9.0, y: 0.2, z: 0.0 };
|
| 75 |
+
const MASK_CELL = 0.34;
|
| 76 |
+
const MASK_MAX = 32; // cap cells per axis (matches organ node cap)
|
| 77 |
+
const BAR_ORIGIN = { x: -3.0, y: 0.0, z: 8.0 };
|
| 78 |
+
|
| 79 |
+
let _stage = null, _THREE = null, _ctx = null, _group = null, _overlay = null;
|
| 80 |
+
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
| 81 |
+
let _plain = false;
|
| 82 |
+
|
| 83 |
+
// geometry handles
|
| 84 |
+
let _floor = null;
|
| 85 |
+
let _treeGroup = null; // THREE.Group — nodes + edges
|
| 86 |
+
let _maskMesh = []; // Array<THREE.Mesh> — mask cells (MASK_MAX^2)
|
| 87 |
+
let _barStatic = null; // THREE.Mesh — static bar
|
| 88 |
+
let _barDyn = null; // THREE.Mesh — dynamic bar
|
| 89 |
+
|
| 90 |
+
// live state
|
| 91 |
+
const S = {
|
| 92 |
+
label: null,
|
| 93 |
+
depth: null,
|
| 94 |
+
branch: null,
|
| 95 |
+
budget: null,
|
| 96 |
+
staticNodes: null,
|
| 97 |
+
dynamicNodes: null,
|
| 98 |
+
staticEpl: null, // static_expected_accepted_path_length
|
| 99 |
+
dynamicEpl: null, // dynamic_expected_accepted_path_length
|
| 100 |
+
improvement: null, // improvement_ratio
|
| 101 |
+
nodes: null, // array
|
| 102 |
+
mask: null, // 2D array
|
| 103 |
+
state: "init",
|
| 104 |
+
};
|
| 105 |
+
|
| 106 |
+
// =============================================================================
|
| 107 |
+
// mount(ctx)
|
| 108 |
+
// =============================================================================
|
| 109 |
+
export function mount(ctx) {
|
| 110 |
+
_ctx = ctx; _stage = ctx.stage; _THREE = ctx.THREE;
|
| 111 |
+
_group = new _THREE.Group();
|
| 112 |
+
_stage.scene.add(_group);
|
| 113 |
+
_stage.camera.position.set(4, 9, 18);
|
| 114 |
+
try { if (_stage.controls && _stage.controls.target) { _stage.controls.target.set(3, 2, 3); _stage.controls.update(); } } catch (_) {}
|
| 115 |
+
try { _stage.setBloom(true); } catch (_) {}
|
| 116 |
+
|
| 117 |
+
_buildFloor();
|
| 118 |
+
_buildTreeGroup();
|
| 119 |
+
_buildMaskGrid();
|
| 120 |
+
_buildBars();
|
| 121 |
+
|
| 122 |
+
if (!_frameReg) { _stage.onFrame(_onFrame); _frameReg = true; }
|
| 123 |
+
|
| 124 |
+
_badge = ctx.live.createBadge();
|
| 125 |
+
_polls.push(ctx.live.poll(EP, 5000, _onSnap, { badge: _badge, onState: (m) => { S.state = m.state; _paintOverlay(); _repaintScene(); } }));
|
| 126 |
+
|
| 127 |
+
_buildOverlay();
|
| 128 |
+
return { id: ID, started: true };
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
// =============================================================================
|
| 132 |
+
// builders
|
| 133 |
+
// =============================================================================
|
| 134 |
+
function _buildFloor() {
|
| 135 |
+
const THREE = _THREE;
|
| 136 |
+
const grid = new THREE.GridHelper(48, 48, C_GRID, 0x0f2027);
|
| 137 |
+
grid.material.opacity = 0.16; grid.material.transparent = true; grid.position.y = -0.01;
|
| 138 |
+
_group.add(grid);
|
| 139 |
+
_floor = grid;
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
function _buildTreeGroup() {
|
| 143 |
+
const THREE = _THREE;
|
| 144 |
+
_treeGroup = new THREE.Group();
|
| 145 |
+
_group.add(_treeGroup);
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
// Pre-allocate a fixed MASK_MAX x MASK_MAX grid of mask cells; toggle
|
| 149 |
+
// visibility / color in-place as live data arrives (no per-poll geometry churn).
|
| 150 |
+
function _buildMaskGrid() {
|
| 151 |
+
const THREE = _THREE;
|
| 152 |
+
const cellGeo = new THREE.PlaneGeometry(MASK_CELL * 0.9, MASK_CELL * 0.9);
|
| 153 |
+
for (let r = 0; r < MASK_MAX; r++) {
|
| 154 |
+
for (let c = 0; c < MASK_MAX; c++) {
|
| 155 |
+
const mesh = new THREE.Mesh(
|
| 156 |
+
cellGeo,
|
| 157 |
+
new THREE.MeshBasicMaterial({ color: C_ZERO, transparent: true, opacity: 0.0, side: THREE.DoubleSide }),
|
| 158 |
+
);
|
| 159 |
+
mesh.position.set(MASK_ORIGIN.x + c * MASK_CELL, MASK_ORIGIN.y + (MASK_MAX - r) * MASK_CELL, MASK_ORIGIN.z);
|
| 160 |
+
mesh.visible = false;
|
| 161 |
+
_group.add(mesh);
|
| 162 |
+
_maskMesh.push(mesh);
|
| 163 |
+
}
|
| 164 |
+
}
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
function _buildBars() {
|
| 168 |
+
const THREE = _THREE;
|
| 169 |
+
const geo = new THREE.BoxGeometry(0.9, 1.0, 0.9);
|
| 170 |
+
_barStatic = new THREE.Mesh(
|
| 171 |
+
geo,
|
| 172 |
+
new THREE.MeshStandardMaterial({ color: C_STAT, emissive: C_STAT, emissiveIntensity: 0.4, transparent: true, opacity: 0.9 }),
|
| 173 |
+
);
|
| 174 |
+
_barStatic.position.set(BAR_ORIGIN.x, 0.5, BAR_ORIGIN.z);
|
| 175 |
+
_barStatic.scale.y = 0.01;
|
| 176 |
+
_group.add(_barStatic);
|
| 177 |
+
|
| 178 |
+
_barDyn = new THREE.Mesh(
|
| 179 |
+
geo,
|
| 180 |
+
new THREE.MeshStandardMaterial({ color: C_DYN, emissive: C_DYN, emissiveIntensity: 0.5, transparent: true, opacity: 0.9 }),
|
| 181 |
+
);
|
| 182 |
+
_barDyn.position.set(BAR_ORIGIN.x + 1.4, 0.5, BAR_ORIGIN.z);
|
| 183 |
+
_barDyn.scale.y = 0.01;
|
| 184 |
+
_group.add(_barDyn);
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
// =============================================================================
|
| 188 |
+
// live data handler
|
| 189 |
+
// =============================================================================
|
| 190 |
+
function _onSnap(j) {
|
| 191 |
+
// read honesty label VERBATIM — never upgrade. handle top-level 'label' OR
|
| 192 |
+
// nested 'payload.label' to match our own module's shape.
|
| 193 |
+
const lbl = (j && j.label != null) ? j.label
|
| 194 |
+
: (j && j.payload && j.payload.label != null) ? j.payload.label
|
| 195 |
+
: "MODELED";
|
| 196 |
+
const src = (j && j.payload && typeof j.payload === "object") ? j.payload : j;
|
| 197 |
+
S.label = String(lbl).toUpperCase();
|
| 198 |
+
|
| 199 |
+
S.depth = typeof src.depth === "number" ? src.depth : null;
|
| 200 |
+
S.branch = typeof src.branch === "number" ? src.branch : null;
|
| 201 |
+
S.budget = typeof src.budget === "number" ? src.budget : null;
|
| 202 |
+
S.staticNodes = typeof src.static_nodes === "number" ? src.static_nodes : null;
|
| 203 |
+
S.dynamicNodes = typeof src.dynamic_nodes === "number" ? src.dynamic_nodes : null;
|
| 204 |
+
S.staticEpl = typeof src.static_expected_accepted_path_length === "number" ? src.static_expected_accepted_path_length : null;
|
| 205 |
+
S.dynamicEpl = typeof src.dynamic_expected_accepted_path_length === "number" ? src.dynamic_expected_accepted_path_length : null;
|
| 206 |
+
S.improvement = typeof src.improvement_ratio === "number" ? src.improvement_ratio : null;
|
| 207 |
+
S.nodes = Array.isArray(src.nodes) ? src.nodes : null;
|
| 208 |
+
S.mask = Array.isArray(src.attention_mask) ? src.attention_mask : null;
|
| 209 |
+
|
| 210 |
+
_repaintScene();
|
| 211 |
+
_paintOverlay();
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
// =============================================================================
|
| 215 |
+
// scene painters
|
| 216 |
+
// =============================================================================
|
| 217 |
+
function _depthColor(d) {
|
| 218 |
+
switch (d) {
|
| 219 |
+
case 0: return C_D0;
|
| 220 |
+
case 1: return C_D1;
|
| 221 |
+
case 2: return C_D2;
|
| 222 |
+
case 3: return C_D3;
|
| 223 |
+
default: return C_DEEP;
|
| 224 |
+
}
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
function _disposeTree() {
|
| 228 |
+
if (!_treeGroup) return;
|
| 229 |
+
const kids = _treeGroup.children.slice();
|
| 230 |
+
kids.forEach((o) => {
|
| 231 |
+
_treeGroup.remove(o);
|
| 232 |
+
if (o.geometry && o.geometry.dispose) o.geometry.dispose();
|
| 233 |
+
if (o.material) {
|
| 234 |
+
const ms = Array.isArray(o.material) ? o.material : [o.material];
|
| 235 |
+
ms.forEach((m) => { if (m.dispose) m.dispose(); });
|
| 236 |
+
}
|
| 237 |
+
});
|
| 238 |
+
}
|
| 239 |
+
|
| 240 |
+
function _repaintScene() {
|
| 241 |
+
_repaintTree();
|
| 242 |
+
_repaintMask();
|
| 243 |
+
_repaintBars();
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
// 3D tree: place nodes by depth (y), spread siblings across x within each depth
|
| 247 |
+
// band; color by depth; edge tube radius scaled by child confidence/value.
|
| 248 |
+
function _repaintTree() {
|
| 249 |
+
const THREE = _THREE;
|
| 250 |
+
_disposeTree();
|
| 251 |
+
const live = S.state === "live";
|
| 252 |
+
const nodes = (live && S.nodes) ? S.nodes : null;
|
| 253 |
+
if (!nodes || !nodes.length) {
|
| 254 |
+
// degraded placeholder: a single dim node so the scene is never empty
|
| 255 |
+
const geo = new THREE.SphereGeometry(0.22, 12, 12);
|
| 256 |
+
const m = new THREE.Mesh(geo, new THREE.MeshStandardMaterial({ color: C_DIM, emissive: C_DIM, emissiveIntensity: 0.2, transparent: true, opacity: 0.35 }));
|
| 257 |
+
m.position.set(0, DEPTH_GAP, 0);
|
| 258 |
+
_treeGroup.add(m);
|
| 259 |
+
return;
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
// group node indices by depth for horizontal layout
|
| 263 |
+
const byDepth = {};
|
| 264 |
+
let maxDepth = 0;
|
| 265 |
+
nodes.forEach((n) => {
|
| 266 |
+
const d = n.depth || 0;
|
| 267 |
+
if (!byDepth[d]) byDepth[d] = [];
|
| 268 |
+
byDepth[d].push(n);
|
| 269 |
+
if (d > maxDepth) maxDepth = d;
|
| 270 |
+
});
|
| 271 |
+
|
| 272 |
+
// assign world positions
|
| 273 |
+
const pos = {}; // id -> {x,y,z}
|
| 274 |
+
Object.keys(byDepth).forEach((dk) => {
|
| 275 |
+
const d = Number(dk);
|
| 276 |
+
const arr = byDepth[d];
|
| 277 |
+
const count = arr.length;
|
| 278 |
+
arr.forEach((n, i) => {
|
| 279 |
+
const frac = count > 1 ? (i / (count - 1)) : 0.5;
|
| 280 |
+
const x = (frac - 0.5) * SPREAD;
|
| 281 |
+
const y = DEPTH_GAP * (maxDepth - d) + 0.6; // root highest
|
| 282 |
+
const z = 0;
|
| 283 |
+
pos[n.id] = { x, y, z };
|
| 284 |
+
});
|
| 285 |
+
});
|
| 286 |
+
|
| 287 |
+
// nodes as spheres (radius scaled a touch by value)
|
| 288 |
+
nodes.forEach((n) => {
|
| 289 |
+
const p = pos[n.id];
|
| 290 |
+
if (!p) return;
|
| 291 |
+
const v = typeof n.value === "number" ? n.value : 0.5;
|
| 292 |
+
const rad = 0.14 + 0.16 * Math.max(0, Math.min(1, v));
|
| 293 |
+
const geo = new THREE.SphereGeometry(rad, 14, 14);
|
| 294 |
+
const col = _depthColor(n.depth || 0);
|
| 295 |
+
const m = new THREE.Mesh(geo, new THREE.MeshStandardMaterial({ color: col, emissive: col, emissiveIntensity: 0.55, transparent: true, opacity: 0.95 }));
|
| 296 |
+
m.position.set(p.x, p.y, p.z);
|
| 297 |
+
_treeGroup.add(m);
|
| 298 |
+
});
|
| 299 |
+
|
| 300 |
+
// edges as thin cylinders; radius scaled by child confidence
|
| 301 |
+
nodes.forEach((n) => {
|
| 302 |
+
if (n.parent == null || n.parent < 0) return;
|
| 303 |
+
const a = pos[n.id];
|
| 304 |
+
const b = pos[n.parent];
|
| 305 |
+
if (!a || !b) return;
|
| 306 |
+
const conf = typeof n.confidence === "number" ? n.confidence : 0.5;
|
| 307 |
+
const rad = 0.015 + 0.075 * Math.max(0, Math.min(1, conf));
|
| 308 |
+
const dx = a.x - b.x, dy = a.y - b.y, dz = a.z - b.z;
|
| 309 |
+
const len = Math.sqrt(dx * dx + dy * dy + dz * dz) || 0.001;
|
| 310 |
+
const geo = new THREE.CylinderGeometry(rad, rad, len, 8);
|
| 311 |
+
const m = new THREE.Mesh(geo, new THREE.MeshStandardMaterial({ color: C_EDGE, emissive: C_EDGE, emissiveIntensity: 0.35, transparent: true, opacity: 0.6 }));
|
| 312 |
+
// midpoint
|
| 313 |
+
m.position.set((a.x + b.x) / 2, (a.y + b.y) / 2, (a.z + b.z) / 2);
|
| 314 |
+
// orient cylinder (default +y) to point from b->a
|
| 315 |
+
const up = new THREE.Vector3(0, 1, 0);
|
| 316 |
+
const dir = new THREE.Vector3(dx, dy, dz).normalize();
|
| 317 |
+
const quat = new THREE.Quaternion().setFromUnitVectors(up, dir);
|
| 318 |
+
m.quaternion.copy(quat);
|
| 319 |
+
_treeGroup.add(m);
|
| 320 |
+
});
|
| 321 |
+
}
|
| 322 |
+
|
| 323 |
+
function _repaintMask() {
|
| 324 |
+
const live = S.state === "live";
|
| 325 |
+
const mask = (live && S.mask) ? S.mask : null;
|
| 326 |
+
const n = mask ? Math.min(mask.length, MASK_MAX) : 0;
|
| 327 |
+
for (let r = 0; r < MASK_MAX; r++) {
|
| 328 |
+
for (let c = 0; c < MASK_MAX; c++) {
|
| 329 |
+
const mesh = _maskMesh[r * MASK_MAX + c];
|
| 330 |
+
if (!mask || r >= n || c >= n) {
|
| 331 |
+
mesh.visible = false;
|
| 332 |
+
continue;
|
| 333 |
+
}
|
| 334 |
+
mesh.visible = true;
|
| 335 |
+
const on = mask[r] && mask[r][c] === 1;
|
| 336 |
+
const col = on ? C_MASK : C_ZERO;
|
| 337 |
+
mesh.material.color.setHex(col);
|
| 338 |
+
mesh.material.opacity = on ? 0.9 : 0.14;
|
| 339 |
+
}
|
| 340 |
+
}
|
| 341 |
+
}
|
| 342 |
+
|
| 343 |
+
function _repaintBars() {
|
| 344 |
+
const live = S.state === "live";
|
| 345 |
+
const s = (live && typeof S.staticEpl === "number") ? S.staticEpl : 0;
|
| 346 |
+
const d = (live && typeof S.dynamicEpl === "number") ? S.dynamicEpl : 0;
|
| 347 |
+
const maxv = Math.max(s, d, 1);
|
| 348 |
+
const scale = 5.0 / maxv; // tallest bar ≈ 5 world units
|
| 349 |
+
if (_barStatic) {
|
| 350 |
+
const h = Math.max(0.01, s * scale);
|
| 351 |
+
_barStatic.scale.y = h;
|
| 352 |
+
_barStatic.position.y = h / 2;
|
| 353 |
+
_barStatic.material.color.setHex(live ? C_STAT : C_DIM);
|
| 354 |
+
_barStatic.material.emissive.setHex(live ? C_STAT : C_DIM);
|
| 355 |
+
_barStatic.material.opacity = live ? 0.9 : 0.35;
|
| 356 |
+
}
|
| 357 |
+
if (_barDyn) {
|
| 358 |
+
const h = Math.max(0.01, d * scale);
|
| 359 |
+
_barDyn.scale.y = h;
|
| 360 |
+
_barDyn.position.y = h / 2;
|
| 361 |
+
_barDyn.material.color.setHex(live ? C_DYN : C_DIM);
|
| 362 |
+
_barDyn.material.emissive.setHex(live ? C_DYN : C_DIM);
|
| 363 |
+
_barDyn.material.opacity = live ? 0.9 : 0.35;
|
| 364 |
+
}
|
| 365 |
+
}
|
| 366 |
+
|
| 367 |
+
// =============================================================================
|
| 368 |
+
// per-frame animation
|
| 369 |
+
// =============================================================================
|
| 370 |
+
function _onFrame() {
|
| 371 |
+
const t = performance.now();
|
| 372 |
+
if (_treeGroup) _treeGroup.rotation.y = Math.sin(t * 0.00008) * 0.12;
|
| 373 |
+
}
|
| 374 |
+
|
| 375 |
+
// =============================================================================
|
| 376 |
+
// overlay
|
| 377 |
+
// =============================================================================
|
| 378 |
+
function _buildOverlay() {
|
| 379 |
+
const ctx = _ctx;
|
| 380 |
+
_overlay = document.createElement("div");
|
| 381 |
+
Object.assign(_overlay.style, {
|
| 382 |
+
position: "absolute", left: "14px", top: "14px", zIndex: "6",
|
| 383 |
+
display: "flex", flexDirection: "column", gap: "8px",
|
| 384 |
+
maxWidth: "min(94%,470px)",
|
| 385 |
+
font: "12px ui-sans-serif,system-ui,Segoe UI,Roboto,Arial",
|
| 386 |
+
color: "#eef3f6",
|
| 387 |
+
});
|
| 388 |
+
|
| 389 |
+
const h = document.createElement("div");
|
| 390 |
+
h.style.cssText = "font:600 13px ui-sans-serif,system-ui;letter-spacing:.4px";
|
| 391 |
+
h.textContent = TITLE;
|
| 392 |
+
_overlay.appendChild(h);
|
| 393 |
+
|
| 394 |
+
const sub = document.createElement("div");
|
| 395 |
+
sub.style.cssText = "color:#9fb1bf;font-size:11px;line-height:1.55";
|
| 396 |
+
sub.innerHTML =
|
| 397 |
+
'Instead of drafting one linear chain, tree speculative decoding drafts a <b>tree</b> of candidate ' +
|
| 398 |
+
'tokens \u2014 each root\u2192node path is a candidate sequence, siblings are alternatives at the same ' +
|
| 399 |
+
'position. A <b>tree causal-attention mask</b> (each token attends only to its ancestors) lets the ' +
|
| 400 |
+
'whole tree be verified in one pass. This view builds the tree two ways \u2014 a <b>static</b> fixed ' +
|
| 401 |
+
'shape vs. an EAGLE-2-style <b>dynamic</b> Expansion/Rerank on synthetic confidences (value ' +
|
| 402 |
+
'V<sub>i</sub> = product of confidences root\u2192i) \u2014 then walks both against a scripted ' +
|
| 403 |
+
'<b>min(1, p/q)</b> acceptance oracle to count the expected accepted-path length. Honesty label ' +
|
| 404 |
+
'<b>MODELED</b> (deterministic toy tree-walk, NOT a live LLM). 0 runtime CDN.';
|
| 405 |
+
_overlay.appendChild(sub);
|
| 406 |
+
|
| 407 |
+
const brow = document.createElement("div");
|
| 408 |
+
brow.style.cssText = "display:flex;gap:8px;align-items:center;flex-wrap:wrap";
|
| 409 |
+
if (_badge && _badge.el) brow.appendChild(_badge.el);
|
| 410 |
+
_overlay.appendChild(brow);
|
| 411 |
+
|
| 412 |
+
const card = document.createElement("div");
|
| 413 |
+
card.style.cssText = "background:#0a1117;border:1px solid #1d2a36;border-radius:9px;padding:9px 10px;display:flex;flex-direction:column;gap:6px";
|
| 414 |
+
|
| 415 |
+
const chead = document.createElement("div");
|
| 416 |
+
chead.style.cssText = "display:flex;align-items:center;gap:8px;flex-wrap:wrap";
|
| 417 |
+
const dot = document.createElement("span");
|
| 418 |
+
dot.style.cssText = "width:9px;height:9px;border-radius:50%;background:#3af4c8;box-shadow:0 0 7px #3af4c8";
|
| 419 |
+
const nm = document.createElement("b");
|
| 420 |
+
nm.style.cssText = "font-size:12px;color:#3af4c8;letter-spacing:.3px";
|
| 421 |
+
nm.textContent = "tree speculative execution";
|
| 422 |
+
chead.appendChild(dot); chead.appendChild(nm);
|
| 423 |
+
card.appendChild(chead);
|
| 424 |
+
|
| 425 |
+
const grid = document.createElement("div");
|
| 426 |
+
grid.style.cssText = "display:grid;grid-template-columns:1fr;gap:4px";
|
| 427 |
+
|
| 428 |
+
function kpiRow(id, label) {
|
| 429 |
+
const r = document.createElement("div");
|
| 430 |
+
r.style.cssText = "display:flex;justify-content:space-between;gap:10px;font-size:11px";
|
| 431 |
+
const l = document.createElement("span"); l.style.cssText = "color:#9fb1bf"; l.textContent = label;
|
| 432 |
+
const v = document.createElement("b");
|
| 433 |
+
v.id = id;
|
| 434 |
+
v.style.cssText = "font-variant-numeric:tabular-nums;color:#eef3f6;text-align:right;max-width:56%";
|
| 435 |
+
v.textContent = "\u2014";
|
| 436 |
+
_el[id] = v;
|
| 437 |
+
r.appendChild(l); r.appendChild(v); return r;
|
| 438 |
+
}
|
| 439 |
+
|
| 440 |
+
grid.appendChild(kpiRow("sx-tree", "tree (depth / branch / budget)"));
|
| 441 |
+
grid.appendChild(kpiRow("sx-nodes", "nodes (static / dynamic)"));
|
| 442 |
+
grid.appendChild(kpiRow("sx-static", "E[accepted path] \u2014 static (MEASURED)"));
|
| 443 |
+
grid.appendChild(kpiRow("sx-dynamic", "E[accepted path] \u2014 dynamic (MEASURED)"));
|
| 444 |
+
grid.appendChild(kpiRow("sx-improve", "improvement (dynamic / static)"));
|
| 445 |
+
grid.appendChild(kpiRow("sx-mask", "tree causal-attention mask"));
|
| 446 |
+
grid.appendChild(kpiRow("sx-label", "honesty label"));
|
| 447 |
+
card.appendChild(grid);
|
| 448 |
+
|
| 449 |
+
const legend = document.createElement("div");
|
| 450 |
+
legend.style.cssText = "font-size:10px;color:#9fb1bf;line-height:1.5;display:flex;gap:10px;flex-wrap:wrap";
|
| 451 |
+
legend.innerHTML =
|
| 452 |
+
'<span style="color:#3af4c8">\u25cf dynamic / root</span>' +
|
| 453 |
+
'<span style="color:#5b8dee">\u25cf static / depth</span>' +
|
| 454 |
+
'<span style="color:#8a6bff">\u25cf mask attends</span>' +
|
| 455 |
+
'<span style="color:#5a6570">\u25cf no-attend</span>';
|
| 456 |
+
card.appendChild(legend);
|
| 457 |
+
|
| 458 |
+
const fn = document.createElement("div");
|
| 459 |
+
fn.style.cssText = "font-size:9.5px;color:#6b7a86;line-height:1.5";
|
| 460 |
+
fn.textContent = "Tree speculative decoding \u2014 Sequoia arXiv:2402.12374 \u00b7 EAGLE-2 arXiv:2406.16858 \u00b7 Medusa arXiv:2401.10774 \u00b7 SpecInfer (CMU). MODELED \u00b7 not claimed-as.";
|
| 461 |
+
card.appendChild(fn);
|
| 462 |
+
_overlay.appendChild(card);
|
| 463 |
+
|
| 464 |
+
const pl = document.createElement("button");
|
| 465 |
+
pl.textContent = "\u25d1 what this means";
|
| 466 |
+
pl.title = "Toggle plain-language explanation for investors & consumers.";
|
| 467 |
+
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";
|
| 468 |
+
pl.addEventListener("click", () => {
|
| 469 |
+
_plain = !_plain;
|
| 470 |
+
pl.style.background = _plain ? "#0f2a20" : "#08140f";
|
| 471 |
+
_applyPlain();
|
| 472 |
+
});
|
| 473 |
+
_overlay.appendChild(pl);
|
| 474 |
+
|
| 475 |
+
const pd = document.createElement("div");
|
| 476 |
+
pd.id = "sx-plain";
|
| 477 |
+
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";
|
| 478 |
+
_el["plain"] = pd;
|
| 479 |
+
_overlay.appendChild(pd);
|
| 480 |
+
|
| 481 |
+
(ctx.container || document.body).appendChild(_overlay);
|
| 482 |
+
_paintOverlay();
|
| 483 |
+
}
|
| 484 |
+
|
| 485 |
+
function _applyPlain() {
|
| 486 |
+
const pd = _el["plain"];
|
| 487 |
+
if (!pd) return;
|
| 488 |
+
pd.style.display = _plain ? "block" : "none";
|
| 489 |
+
if (!_plain) return;
|
| 490 |
+
const sEpl = S.staticEpl != null ? S.staticEpl.toFixed(2) : "loading\u2026";
|
| 491 |
+
const dEpl = S.dynamicEpl != null ? S.dynamicEpl.toFixed(2) : "loading\u2026";
|
| 492 |
+
const imp = S.improvement != null ? S.improvement.toFixed(2) + "\u00d7" : "loading\u2026";
|
| 493 |
+
pd.innerHTML =
|
| 494 |
+
"<b>What this means:</b> To speed up a language model, a small \u201cdraft\u201d step guesses several of the " +
|
| 495 |
+
"next words at once so the big model can check them in a single batch. Guessing a <b>tree</b> of possible " +
|
| 496 |
+
"words (with branches for alternatives) beats guessing a single straight line, because more good guesses " +
|
| 497 |
+
"survive the check. This view builds the guess-tree two ways: a fixed shape (<b>static</b>) and a smarter " +
|
| 498 |
+
"shape that spends its limited budget on the most promising branches (<b>dynamic</b>, the EAGLE-2 idea). " +
|
| 499 |
+
"Under the same scripted accept/reject rule, the static tree commits about <b>" + sEpl + "</b> words on " +
|
| 500 |
+
"average and the dynamic tree about <b>" + dEpl + "</b> \u2014 roughly <b>" + imp + "</b> as many. The grid on " +
|
| 501 |
+
"the right is the <b>attention mask</b>: it shows each guessed word only looking back at its own ancestors, " +
|
| 502 |
+
"which is what lets the whole tree be checked in one pass. This is a <b>MODELED</b> deterministic toy " +
|
| 503 |
+
"tree-walk on made-up confidence numbers \u2014 <b>not a live LLM</b>, no real model is queried, and no " +
|
| 504 |
+
"wall-clock speedup is claimed. The numbers shown are computed exactly and displayed, not hidden.";
|
| 505 |
+
}
|
| 506 |
+
|
| 507 |
+
function _tok(s) {
|
| 508 |
+
if (s === "live") return null;
|
| 509 |
+
if (s === "missing") return "NO-LIVE-DATA";
|
| 510 |
+
if (s === "degraded") return "DEGRADED";
|
| 511 |
+
if (s === "error") return "OFFLINE";
|
| 512 |
+
return "\u2026";
|
| 513 |
+
}
|
| 514 |
+
|
| 515 |
+
function fx(v, d) { return typeof v === "number" ? v.toFixed(d) : "\u2014"; }
|
| 516 |
+
function _set(id, v) { if (_el[id]) _el[id].textContent = v; }
|
| 517 |
+
|
| 518 |
+
function _paintOverlay() {
|
| 519 |
+
const t = _tok(S.state);
|
| 520 |
+
_set("sx-tree", t || ((S.depth != null && S.branch != null && S.budget != null) ? (S.depth + " / " + S.branch + " / " + S.budget) : "\u2014"));
|
| 521 |
+
_set("sx-nodes", t || ((S.staticNodes != null && S.dynamicNodes != null) ? (S.staticNodes + " / " + S.dynamicNodes) : "\u2014"));
|
| 522 |
+
_set("sx-static", t || fx(S.staticEpl, 3));
|
| 523 |
+
_set("sx-dynamic", t || fx(S.dynamicEpl, 3));
|
| 524 |
+
_set("sx-improve", t || (S.improvement != null ? S.improvement.toFixed(3) + "\u00d7" : "\u2014"));
|
| 525 |
+
_set("sx-mask", t || ((S.mask && S.mask.length) ? (S.mask.length + " \u00d7 " + S.mask.length) : "\u2014"));
|
| 526 |
+
// honesty label verbatim — never upgraded
|
| 527 |
+
_set("sx-label", t || (S.label || "MODELED"));
|
| 528 |
+
if (_plain) _applyPlain();
|
| 529 |
+
}
|
| 530 |
+
|
| 531 |
+
// =============================================================================
|
| 532 |
+
// unmount — clean up everything; must not affect other organs
|
| 533 |
+
// =============================================================================
|
| 534 |
+
export function unmount() {
|
| 535 |
+
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 536 |
+
try { if (_overlay && _overlay.parentNode) _overlay.parentNode.removeChild(_overlay); } catch (_) {}
|
| 537 |
+
try {
|
| 538 |
+
if (_group && _stage) {
|
| 539 |
+
_group.traverse((o) => {
|
| 540 |
+
if (o.geometry && o.geometry.dispose) o.geometry.dispose();
|
| 541 |
+
if (o.material) {
|
| 542 |
+
const ms = Array.isArray(o.material) ? o.material : [o.material];
|
| 543 |
+
ms.forEach((m) => { if (m.dispose) m.dispose(); });
|
| 544 |
+
}
|
| 545 |
+
});
|
| 546 |
+
_stage.scene.remove(_group);
|
| 547 |
+
}
|
| 548 |
+
} catch (_) {}
|
| 549 |
+
_group = _overlay = null;
|
| 550 |
+
_floor = null; _treeGroup = null; _maskMesh = []; _barStatic = null; _barDyn = null;
|
| 551 |
+
_el = {}; _badge = null; _plain = false; _frameReg = false;
|
| 552 |
+
_stage = _THREE = _ctx = null;
|
| 553 |
+
S.label = S.depth = S.branch = S.budget = null;
|
| 554 |
+
S.staticNodes = S.dynamicNodes = null;
|
| 555 |
+
S.staticEpl = S.dynamicEpl = S.improvement = null;
|
| 556 |
+
S.nodes = S.mask = null;
|
| 557 |
+
S.state = "init";
|
| 558 |
+
}
|
| 559 |
+
|
| 560 |
+
export default { id: ID, title: TITLE, endpoints: [EP], mount, unmount };
|
szl3d_holographic.py
CHANGED
|
@@ -83,6 +83,9 @@ SURFACES: List[Dict[str, str]] = [
|
|
| 83 |
{"id": "router", "title": "Router", "owner": "Dev7"},
|
| 84 |
{"id": "anatomy", "title": "Anatomy", "owner": "Dev8"},
|
| 85 |
{"id": "estate", "title": "Estate", "owner": "Dev9"},
|
|
|
|
|
|
|
|
|
|
| 86 |
]
|
| 87 |
|
| 88 |
# Content-type by extension (the only extensions we serve from the 3d tree).
|
|
|
|
| 83 |
{"id": "router", "title": "Router", "owner": "Dev7"},
|
| 84 |
{"id": "anatomy", "title": "Anatomy", "owner": "Dev8"},
|
| 85 |
{"id": "estate", "title": "Estate", "owner": "Dev9"},
|
| 86 |
+
{"id": "muon", "title": "Muon Orthogonalized-Momentum Optimizer", "owner": "Wave13"},
|
| 87 |
+
{"id": "specexec", "title": "Tree Speculative Execution", "owner": "Wave13"},
|
| 88 |
+
{"id": "nvfp4", "title": "NVFP4 4-bit Training Format", "owner": "Wave13"},
|
| 89 |
]
|
| 90 |
|
| 91 |
# Content-type by extension (the only extensions we serve from the 3d tree).
|