Spaces:
Running
Running
deploy(hf): sync szl-holdings/a11oy@main derived COPY set
Browse filesReusable Dockerfile-COPY-derived deploy from szl-holdings/a11oy main.
Files: 956 Pruned: 0
Derived from Dockerfile COPY sources (NO hand-maintained allowlist).
Signed-off-by: SZL Holdings <noreply@szlholdings.ai>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- static/3d/holographic.html +1 -0
- static/3d/surfaces/circuits.js +333 -0
- static/3d/surfaces/kvcache.js +7 -5
- static/3d/surfaces/sement.js +8 -4
static/3d/holographic.html
CHANGED
|
@@ -101,6 +101,7 @@ const SURFACES = [
|
|
| 101 |
{ id: "frontier", title: "Frontier", mod: "/static/3d/surfaces/frontier.js" },
|
| 102 |
{ id: "neuromorphic", title: "Neuromorphic", mod: "/static/3d/surfaces/neuromorphic.js" },
|
| 103 |
{ id: "interpretability", title: "Interpretability", mod: "/static/3d/surfaces/interpretability.js" },
|
|
|
|
| 104 |
{ id: "worldmodel", title: "World Model", mod: "/static/3d/surfaces/worldmodel.js" },
|
| 105 |
{ id: "qec", title: "Topological QEC", mod: "/static/3d/surfaces/qec.js" },
|
| 106 |
{ id: "episodic", title: "Episodic Memory", mod: "/static/3d/surfaces/episodic.js" },
|
|
|
|
| 101 |
{ id: "frontier", title: "Frontier", mod: "/static/3d/surfaces/frontier.js" },
|
| 102 |
{ id: "neuromorphic", title: "Neuromorphic", mod: "/static/3d/surfaces/neuromorphic.js" },
|
| 103 |
{ id: "interpretability", title: "Interpretability", mod: "/static/3d/surfaces/interpretability.js" },
|
| 104 |
+
{ id: "circuits", title: "Attribution Graph \u00b7 Circuit Tracing", mod: "/static/3d/surfaces/circuits.js" },
|
| 105 |
{ id: "worldmodel", title: "World Model", mod: "/static/3d/surfaces/worldmodel.js" },
|
| 106 |
{ id: "qec", title: "Topological QEC", mod: "/static/3d/surfaces/qec.js" },
|
| 107 |
{ id: "episodic", title: "Episodic Memory", mod: "/static/3d/surfaces/episodic.js" },
|
static/3d/surfaces/circuits.js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ifier: Apache-2.0
|
| 2 |
+
// © 2026 Lutar, Stephen P. — SZL Holdings · ORCID 0009-0001-0110-4173 · Doctrine v11
|
| 3 |
+
//
|
| 4 |
+
// surfaces/circuits.js — ATTRIBUTION-GRAPH / CIRCUIT-TRACING organ for the holographic
|
| 5 |
+
// frontier ring. Renders the pruned attribution graph as a 3D layered node cloud: an
|
| 6 |
+
// input embedding node at the base, feature nodes stacked by layer, a transcoder-error
|
| 7 |
+
// node, and the output logit node at the top. Edges are the direct linear effects
|
| 8 |
+
// between nodes (brighter = stronger). The retained (backward-traced, threshold-pruned)
|
| 9 |
+
// sub-graph is what drives the modeled output. A HUD shows attribution_completeness and
|
| 10 |
+
// the top causal features (MODELED ablation delta_logit) from the live snapshot at the
|
| 11 |
+
// a11oy-native endpoint /api/a11oy/v1/circuits/attribution. Honesty label "MODELED" is
|
| 12 |
+
// read VERBATIM from the JSON and displayed as-is; it is never upgraded.
|
| 13 |
+
//
|
| 14 |
+
// Surface export shape (mirrors kvcache.js / testtime.js exactly):
|
| 15 |
+
// export default { id, title, endpoints, mount(ctx), unmount() }
|
| 16 |
+
// ctx = { stage, container, live, label, THREE, szl3d }
|
| 17 |
+
//
|
| 18 |
+
// DATA SHOWN (all from the live endpoint):
|
| 19 |
+
// layers, features_per_layer, prune_threshold_tau, n_nodes_kept, n_edges_kept,
|
| 20 |
+
// attribution_completeness, output_logit, transcoder_error_share,
|
| 21 |
+
// nodes[] {id, kind, activation}, edges[] {src, dst, effect}, top_causal[] {node, delta_logit}
|
| 22 |
+
//
|
| 23 |
+
// LEADERS ADOPTED & CITED (clean-room; NOT claimed as SZL's own; VERIFY real):
|
| 24 |
+
// Circuit Tracing — attribution graphs (cross-layer transcoders + backward tracing):
|
| 25 |
+
// Ameisen, Lindsey, Pearce, Gurnee et al. 2025, Transformer Circuits Thread
|
| 26 |
+
// https://transformer-circuits.pub/2025/attribution-graphs/methods.html
|
| 27 |
+
// Sparse Feature Circuits (greedy attribution -> sparse causal graphs):
|
| 28 |
+
// Marks, Rager, Michaud, Belinkov, Bau, Mueller 2024, arXiv:2406.02395
|
| 29 |
+
// https://arxiv.org/abs/2406.02395
|
| 30 |
+
//
|
| 31 |
+
// HONESTY LABELS: MODELED (deterministic simulation of the circuit-tracing METHOD on a
|
| 32 |
+
// seeded replacement model; a HYPOTHESIS object, NOT a real attribution graph of a
|
| 33 |
+
// real model; NO live weights / GPU). Read verbatim from JSON; never upgraded here.
|
| 34 |
+
// COLOURS: lattice-blue 0x5b8dee (feature nodes / edges), proof-teal 0x3af4c8 (output
|
| 35 |
+
// logit + top-causal accent), amber 0xd9b46a (embedding / input node), grey 0x5a6570
|
| 36 |
+
// (transcoder-error node), 0x1b3a44 (floor/links). Purple BANNED as UI/background.
|
| 37 |
+
// 0 RUNTIME CDN. Vendored three.js via page importmap (ctx.THREE).
|
| 38 |
+
// DOCTRINE v11: degrades gracefully (grey) on 404/error; honesty label still shown.
|
| 39 |
+
// Nothing here is in the locked-8. Λ stays Conjecture 1. Trust never 100%.
|
| 40 |
+
|
| 41 |
+
import { createShowcase } from "./_showcase.js";
|
| 42 |
+
|
| 43 |
+
const ID = "circuits";
|
| 44 |
+
const TITLE = "Attribution Graph · Circuit Tracing (MODELED)";
|
| 45 |
+
|
| 46 |
+
// a11oy-NATIVE self-hosted endpoint (same-origin, szl_circuit_graphs.py).
|
| 47 |
+
const EP = "/api/a11oy/v1/circuits/attribution?seed=42&layers=5&features=6&tau=0.12";
|
| 48 |
+
|
| 49 |
+
// data-viz hues — purple BANNED
|
| 50 |
+
const C_FEATURE = 0x5b8dee; // lattice-blue (feature node / edge)
|
| 51 |
+
const C_LOGIT = 0x3af4c8; // proof-teal (output logit / top-causal accent)
|
| 52 |
+
const C_EMB = 0xd9b46a; // amber (input embedding node)
|
| 53 |
+
const C_ERROR = 0x5a6570; // grey (transcoder-error node)
|
| 54 |
+
const C_DIM = 0x42505d; // grey (degraded / no-live-data)
|
| 55 |
+
const C_GRID = 0x1b3a44; // floor / link colour
|
| 56 |
+
|
| 57 |
+
const LAYER_GAP = 2.2; // world-units of vertical spacing between layers
|
| 58 |
+
const NODE_GAP = 1.6; // horizontal spacing between nodes in a layer
|
| 59 |
+
const MAX_NODES = 80; // perf cap on rendered node slots
|
| 60 |
+
const MAX_EDGES = 200; // perf cap on rendered edges
|
| 61 |
+
|
| 62 |
+
let _stage = null, _THREE = null, _ctx = null, _group = null, _show = null;
|
| 63 |
+
let _frameReg = false, _polls = [], _el = {}, _badge = null;
|
| 64 |
+
|
| 65 |
+
let _floor = null;
|
| 66 |
+
let _nodeMesh = []; // Array<THREE.Mesh> — one per rendered node slot
|
| 67 |
+
let _edgeLine = []; // Array<THREE.Line> — one per rendered edge
|
| 68 |
+
let _nodePos = {}; // id -> THREE.Vector3 (for edge endpoints)
|
| 69 |
+
|
| 70 |
+
const S = {
|
| 71 |
+
label: null,
|
| 72 |
+
layers: null,
|
| 73 |
+
features: null,
|
| 74 |
+
tau: null,
|
| 75 |
+
nNodesKept: null,
|
| 76 |
+
nEdgesKept: null,
|
| 77 |
+
completeness: null,
|
| 78 |
+
outputLogit: null,
|
| 79 |
+
errorShare: null,
|
| 80 |
+
nodes: null,
|
| 81 |
+
edges: null,
|
| 82 |
+
topCausal: null,
|
| 83 |
+
state: "init",
|
| 84 |
+
};
|
| 85 |
+
|
| 86 |
+
// =============================================================================
|
| 87 |
+
// mount(ctx)
|
| 88 |
+
// =============================================================================
|
| 89 |
+
export function mount(ctx) {
|
| 90 |
+
_ctx = ctx; _stage = ctx.stage; _THREE = ctx.THREE;
|
| 91 |
+
_group = new _THREE.Group();
|
| 92 |
+
_stage.scene.add(_group);
|
| 93 |
+
_stage.camera.position.set(0, 6, 16);
|
| 94 |
+
try { if (_stage.controls && _stage.controls.target) { _stage.controls.target.set(0, 4, 0); _stage.controls.update(); } } catch (_) {}
|
| 95 |
+
try { _stage.setBloom(true); } catch (_) {}
|
| 96 |
+
|
| 97 |
+
_buildFloor();
|
| 98 |
+
|
| 99 |
+
if (!_frameReg) { _stage.onFrame(_onFrame); _frameReg = true; }
|
| 100 |
+
|
| 101 |
+
_badge = ctx.live.createBadge();
|
| 102 |
+
_polls.push(ctx.live.poll(EP, 5000, _onCircuits, { badge: _badge, onState: (m) => { S.state = m.state; _paintOverlay(); } }));
|
| 103 |
+
|
| 104 |
+
_buildOverlay();
|
| 105 |
+
return { id: ID, started: true };
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
// =============================================================================
|
| 109 |
+
// builders
|
| 110 |
+
// =============================================================================
|
| 111 |
+
function _buildFloor() {
|
| 112 |
+
const THREE = _THREE;
|
| 113 |
+
const grid = new THREE.GridHelper(40, 40, C_GRID, 0x0f2027);
|
| 114 |
+
grid.material.opacity = 0.18; grid.material.transparent = true; grid.position.y = -0.01;
|
| 115 |
+
_group.add(grid);
|
| 116 |
+
_floor = grid;
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
// =============================================================================
|
| 120 |
+
// live data handler — reads label VERBATIM, never upgrades
|
| 121 |
+
// =============================================================================
|
| 122 |
+
function _onCircuits(j) {
|
| 123 |
+
S.label = (j && j.label ? String(j.label) : "MODELED").toUpperCase();
|
| 124 |
+
S.layers = typeof j.layers === "number" ? j.layers : null;
|
| 125 |
+
S.features = typeof j.features_per_layer === "number" ? j.features_per_layer : null;
|
| 126 |
+
S.tau = typeof j.prune_threshold_tau === "number" ? j.prune_threshold_tau : null;
|
| 127 |
+
S.nNodesKept = typeof j.n_nodes_kept === "number" ? j.n_nodes_kept : null;
|
| 128 |
+
S.nEdgesKept = typeof j.n_edges_kept === "number" ? j.n_edges_kept : null;
|
| 129 |
+
S.completeness = typeof j.attribution_completeness === "number" ? j.attribution_completeness : null;
|
| 130 |
+
S.outputLogit = typeof j.output_logit === "number" ? j.output_logit : null;
|
| 131 |
+
S.errorShare = typeof j.transcoder_error_share === "number" ? j.transcoder_error_share : null;
|
| 132 |
+
S.nodes = Array.isArray(j.nodes) ? j.nodes : null;
|
| 133 |
+
S.edges = Array.isArray(j.edges) ? j.edges : null;
|
| 134 |
+
S.topCausal = Array.isArray(j.top_causal) ? j.top_causal : null;
|
| 135 |
+
|
| 136 |
+
_rebuildGraph();
|
| 137 |
+
_paintOverlay();
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
// =============================================================================
|
| 141 |
+
// graph geometry — rebuilt on each live snapshot (bounded node/edge counts)
|
| 142 |
+
// =============================================================================
|
| 143 |
+
function _disposeGraph() {
|
| 144 |
+
const THREE = _THREE;
|
| 145 |
+
_nodeMesh.forEach((m) => { try { m.geometry.dispose(); m.material.dispose(); _group.remove(m); } catch (_) {} });
|
| 146 |
+
_edgeLine.forEach((l) => { try { l.geometry.dispose(); l.material.dispose(); _group.remove(l); } catch (_) {} });
|
| 147 |
+
_nodeMesh = []; _edgeLine = []; _nodePos = {};
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
function _layerOf(node) {
|
| 151 |
+
if (node.kind === "embedding") return -1; // base
|
| 152 |
+
if (node.kind === "output_logit") return 999; // top
|
| 153 |
+
if (node.kind === "transcoder_error") return 998; // near top, offset
|
| 154 |
+
// feature id "L<l>F<f>"
|
| 155 |
+
const m = /^L(\d+)F(\d+)$/.exec(node.id || "");
|
| 156 |
+
return m ? parseInt(m[1], 10) : 0;
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
function _rebuildGraph() {
|
| 160 |
+
if (!_THREE || !_group) return;
|
| 161 |
+
_disposeGraph();
|
| 162 |
+
const live = S.state === "live";
|
| 163 |
+
const nodes = live && S.nodes ? S.nodes.slice(0, MAX_NODES) : [];
|
| 164 |
+
const edges = live && S.edges ? S.edges.slice(0, MAX_EDGES) : [];
|
| 165 |
+
if (!nodes.length) { _paintOverlay(); return; }
|
| 166 |
+
|
| 167 |
+
const THREE = _THREE;
|
| 168 |
+
const nLayers = (typeof S.layers === "number" ? S.layers : 5);
|
| 169 |
+
|
| 170 |
+
// group nodes by layer, lay each layer out horizontally centered
|
| 171 |
+
const byLayer = {};
|
| 172 |
+
nodes.forEach((n) => { const L = _layerOf(n); (byLayer[L] = byLayer[L] || []).push(n); });
|
| 173 |
+
Object.keys(byLayer).forEach((L) => {
|
| 174 |
+
const row = byLayer[L];
|
| 175 |
+
const y = (L === "-1") ? 0.0
|
| 176 |
+
: (L === "999") ? (nLayers + 1) * LAYER_GAP
|
| 177 |
+
: (L === "998") ? (nLayers + 1) * LAYER_GAP
|
| 178 |
+
: (parseInt(L, 10) + 1) * LAYER_GAP;
|
| 179 |
+
const xOffsetErr = (L === "998") ? NODE_GAP * 1.5 : 0.0;
|
| 180 |
+
const width = (row.length - 1) * NODE_GAP;
|
| 181 |
+
row.forEach((n, i) => {
|
| 182 |
+
const x = (i * NODE_GAP - width / 2) + xOffsetErr;
|
| 183 |
+
const pos = new THREE.Vector3(x, y, 0);
|
| 184 |
+
_nodePos[n.id] = pos;
|
| 185 |
+
|
| 186 |
+
let color = C_FEATURE, r = 0.22;
|
| 187 |
+
if (n.kind === "embedding") { color = C_EMB; r = 0.30; }
|
| 188 |
+
else if (n.kind === "output_logit") { color = C_LOGIT; r = 0.34; }
|
| 189 |
+
else if (n.kind === "transcoder_error") { color = C_ERROR; r = 0.18; }
|
| 190 |
+
const act = typeof n.activation === "number" ? n.activation : 0.0;
|
| 191 |
+
const mesh = new THREE.Mesh(
|
| 192 |
+
new THREE.IcosahedronGeometry(r + Math.min(0.18, act * 0.05), 1),
|
| 193 |
+
new THREE.MeshStandardMaterial({ color, emissive: color, emissiveIntensity: 0.45, transparent: true, opacity: 0.92 }),
|
| 194 |
+
);
|
| 195 |
+
mesh.position.copy(pos);
|
| 196 |
+
_group.add(mesh);
|
| 197 |
+
_nodeMesh.push(mesh);
|
| 198 |
+
});
|
| 199 |
+
});
|
| 200 |
+
|
| 201 |
+
// edges: line from src node to dst node, brighter for larger |effect|
|
| 202 |
+
let maxEff = 0.0001;
|
| 203 |
+
edges.forEach((e) => { maxEff = Math.max(maxEff, Math.abs(e.effect || 0)); });
|
| 204 |
+
edges.forEach((e) => {
|
| 205 |
+
const a = _nodePos[e.src], b = _nodePos[e.dst];
|
| 206 |
+
if (!a || !b) return;
|
| 207 |
+
const geo = new THREE.BufferGeometry().setFromPoints([a, b]);
|
| 208 |
+
const strength = Math.min(1.0, Math.abs(e.effect || 0) / maxEff);
|
| 209 |
+
const mat = new THREE.LineBasicMaterial({ color: C_FEATURE, transparent: true, opacity: 0.15 + 0.6 * strength });
|
| 210 |
+
const line = new THREE.Line(geo, mat);
|
| 211 |
+
_group.add(line);
|
| 212 |
+
_edgeLine.push(line);
|
| 213 |
+
});
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
// =============================================================================
|
| 217 |
+
// per-frame animation
|
| 218 |
+
// =============================================================================
|
| 219 |
+
function _onFrame() {
|
| 220 |
+
const t = performance.now();
|
| 221 |
+
if (_group) _group.rotation.y = Math.sin(t * 0.00008) * 0.18;
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
// =============================================================================
|
| 225 |
+
// overlay
|
| 226 |
+
// =============================================================================
|
| 227 |
+
function _buildOverlay() {
|
| 228 |
+
const ctx = _ctx;
|
| 229 |
+
_show = createShowcase(ctx, {
|
| 230 |
+
id: ID, title: TITLE, accent: "#3af4c8",
|
| 231 |
+
badge: _badge,
|
| 232 |
+
chips: [{ label: "MODELED", text: "attribution graph", name: "cir" }],
|
| 233 |
+
legend: ["MODELED"],
|
| 234 |
+
description:
|
| 235 |
+
'Mechanistic interpretability first resolves a residual stream into sparse ' +
|
| 236 |
+
'<b>features</b>, then wires those features into a <b>circuit</b> \u2014 an ' +
|
| 237 |
+
'<b>attribution graph</b> whose nodes are features (plus the input embedding, a ' +
|
| 238 |
+
'transcoder-error node, and the output logit) and whose edges are the direct ' +
|
| 239 |
+
'linear effect of one node on another. A backward, threshold-pruned trace from ' +
|
| 240 |
+
'the logit recovers the sub-graph that drives the prediction; a MODELED causal ' +
|
| 241 |
+
'ablation reports each node\u2019s delta_logit. Honesty label <b>MODELED</b> ' +
|
| 242 |
+
'(deterministic simulation of the method on a seeded replacement model; a ' +
|
| 243 |
+
'HYPOTHESIS object, NOT a real attribution graph of a real model). 0 runtime CDN.',
|
| 244 |
+
citations:
|
| 245 |
+
"Circuit Tracing \u2014 Ameisen/Lindsey et al. 2025 (transformer-circuits.pub) \u00b7 " +
|
| 246 |
+
"Sparse Feature Circuits \u2014 Marks et al. arXiv:2406.02395. MODELED \u00b7 not claimed-as.",
|
| 247 |
+
plain: { html: _plainHtml },
|
| 248 |
+
});
|
| 249 |
+
|
| 250 |
+
_el["cir-layers"] = _show.addField("layers \u00d7 features/layer");
|
| 251 |
+
_el["cir-tau"] = _show.addField("prune threshold \u03c4");
|
| 252 |
+
_el["cir-nodes"] = _show.addField("nodes kept (pruned graph)");
|
| 253 |
+
_el["cir-edges"] = _show.addField("edges kept (pruned graph)");
|
| 254 |
+
_el["cir-comp"] = _show.addField("attribution_completeness \u2014 MODELED");
|
| 255 |
+
_el["cir-logit"] = _show.addField("output_logit");
|
| 256 |
+
_el["cir-err"] = _show.addField("transcoder_error_share");
|
| 257 |
+
_el["cir-top"] = _show.addField("top causal feature (\u0394 logit)");
|
| 258 |
+
_el["cir-label"] = _show.addField("honesty label");
|
| 259 |
+
|
| 260 |
+
_paintOverlay();
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
function _plainHtml() {
|
| 264 |
+
const comp = S.completeness != null ? (S.completeness * 100).toFixed(1) + "%" : "loading\u2026";
|
| 265 |
+
const top = (S.topCausal && S.topCausal[0]) ? S.topCausal[0].node : "loading\u2026";
|
| 266 |
+
return (
|
| 267 |
+
"<b>What this means:</b> When a model answers, information flows through a chain of " +
|
| 268 |
+
"internal \u201cfeatures\u201d (interpretable concepts) before it lands on an answer. " +
|
| 269 |
+
"This view traces that chain BACKWARD from the answer, keeping only the features that " +
|
| 270 |
+
"actually mattered \u2014 an <b>attribution graph</b>. The kept graph explains about " +
|
| 271 |
+
"<b>" + comp + "</b> of what pushed the answer, and the single most influential feature " +
|
| 272 |
+
"here is <b>" + top + "</b> (measured by how much the answer moves when we switch that " +
|
| 273 |
+
"feature off). This is a <b>MODELED</b> deterministic simulation of the circuit-tracing " +
|
| 274 |
+
"method on a seeded stand-in model \u2014 a hypothesis about how a model COULD compute, " +
|
| 275 |
+
"not a measurement of any real deployed model.");
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
function _tok(s) {
|
| 279 |
+
if (s === "live") return null;
|
| 280 |
+
if (s === "missing") return "NO-LIVE-DATA";
|
| 281 |
+
if (s === "degraded") return "DEGRADED";
|
| 282 |
+
if (s === "error") return "OFFLINE";
|
| 283 |
+
return "\u2026";
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
function pct(v, d) { return typeof v === "number" ? (v * 100).toFixed(d) + "%" : "\u2014"; }
|
| 287 |
+
function fx(v, d) { return typeof v === "number" ? v.toFixed(d) : "\u2014"; }
|
| 288 |
+
function _set(id, v) { if (_el[id]) _el[id].textContent = v; }
|
| 289 |
+
|
| 290 |
+
function _paintOverlay() {
|
| 291 |
+
const t = _tok(S.state);
|
| 292 |
+
_set("cir-layers", t || ((S.layers != null && S.features != null) ? (S.layers + " \u00d7 " + S.features) : "\u2014"));
|
| 293 |
+
_set("cir-tau", t || fx(S.tau, 3));
|
| 294 |
+
_set("cir-nodes", t || (S.nNodesKept != null ? String(S.nNodesKept) : "\u2014"));
|
| 295 |
+
_set("cir-edges", t || (S.nEdgesKept != null ? String(S.nEdgesKept) : "\u2014"));
|
| 296 |
+
_set("cir-comp", t || pct(S.completeness, 1));
|
| 297 |
+
_set("cir-logit", t || fx(S.outputLogit, 4));
|
| 298 |
+
_set("cir-err", t || pct(S.errorShare, 1));
|
| 299 |
+
_set("cir-top", t || ((S.topCausal && S.topCausal[0]) ? (S.topCausal[0].node + " (" + fx(S.topCausal[0].delta_logit, 4) + ")") : "\u2014"));
|
| 300 |
+
// honesty label verbatim — never upgraded
|
| 301 |
+
_set("cir-label", t || (S.label || "MODELED"));
|
| 302 |
+
if (_show) { _show.setChip("cir", S.label || "MODELED", { text: "attribution graph" }); _show.refreshPlain(); }
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
// =============================================================================
|
| 306 |
+
// unmount — clean up everything; must not affect other organs
|
| 307 |
+
// =============================================================================
|
| 308 |
+
export function unmount() {
|
| 309 |
+
_polls.forEach((p) => { try { p.stop(); } catch (_) {} }); _polls = [];
|
| 310 |
+
try { if (_show) _show.destroy(); } catch (_) {}
|
| 311 |
+
try {
|
| 312 |
+
if (_group && _stage) {
|
| 313 |
+
_group.traverse((o) => {
|
| 314 |
+
if (o.geometry && o.geometry.dispose) o.geometry.dispose();
|
| 315 |
+
if (o.material) {
|
| 316 |
+
const ms = Array.isArray(o.material) ? o.material : [o.material];
|
| 317 |
+
ms.forEach((m) => { if (m.dispose) m.dispose(); });
|
| 318 |
+
}
|
| 319 |
+
});
|
| 320 |
+
_stage.scene.remove(_group);
|
| 321 |
+
}
|
| 322 |
+
} catch (_) {}
|
| 323 |
+
_group = _show = null;
|
| 324 |
+
_floor = null; _nodeMesh = []; _edgeLine = []; _nodePos = {};
|
| 325 |
+
_el = {}; _badge = null; _frameReg = false;
|
| 326 |
+
_stage = _THREE = _ctx = null;
|
| 327 |
+
S.label = S.layers = S.features = S.tau = null;
|
| 328 |
+
S.nNodesKept = S.nEdgesKept = S.completeness = S.outputLogit = S.errorShare = null;
|
| 329 |
+
S.nodes = S.edges = S.topCausal = null;
|
| 330 |
+
S.state = "init";
|
| 331 |
+
}
|
| 332 |
+
|
| 333 |
+
export default { id: ID, title: TITLE, endpoints: [EP], mount, unmount };
|
static/3d/surfaces/kvcache.js
CHANGED
|
@@ -44,10 +44,12 @@ import { createShowcase } from "./_showcase.js";
|
|
| 44 |
const ID = "kvcache";
|
| 45 |
const TITLE = "KV-Cache H2O Eviction · Heavy-Hitter Oracle (live)";
|
| 46 |
|
| 47 |
-
//
|
| 48 |
-
//
|
| 49 |
-
//
|
| 50 |
-
|
|
|
|
|
|
|
| 51 |
|
| 52 |
// data-viz hues — purple BANNED
|
| 53 |
const C_WINDOW = 0x5b8dee; // lattice-blue (recent sliding-window tokens)
|
|
@@ -360,4 +362,4 @@ export function unmount() {
|
|
| 360 |
S.state = "init";
|
| 361 |
}
|
| 362 |
|
| 363 |
-
export default { id: ID, title: TITLE, endpoints: [EP], mount, unmount };
|
|
|
|
| 44 |
const ID = "kvcache";
|
| 45 |
const TITLE = "KV-Cache H2O Eviction · Heavy-Hitter Oracle (live)";
|
| 46 |
|
| 47 |
+
// PRIMARY endpoint is the a11oy-NATIVE self-hosted twin (same-origin, szl_kv_cache.py):
|
| 48 |
+
// real H2O / StreamingLLM / full-oracle eviction policies over a seeded attention-mass
|
| 49 |
+
// trace (label MODELED, read verbatim). The isolated killinchu Space stays a guarded
|
| 50 |
+
// cross-origin FALLBACK so a fault in either path never darkens the other.
|
| 51 |
+
const EP = "/api/a11oy/v1/kvcache/h2o-evict?seed=42&seq_len=512&capacity=128&window=32";
|
| 52 |
+
const EP_FALLBACK = "https://szlholdings-killinchu.hf.space/api/killinchu/v1/kvcache/h2o-evict?seed=42&seq_len=512&capacity=128&window=32";
|
| 53 |
|
| 54 |
// data-viz hues — purple BANNED
|
| 55 |
const C_WINDOW = 0x5b8dee; // lattice-blue (recent sliding-window tokens)
|
|
|
|
| 362 |
S.state = "init";
|
| 363 |
}
|
| 364 |
|
| 365 |
+
export default { id: ID, title: TITLE, endpoints: [EP, EP_FALLBACK], mount, unmount };
|
static/3d/surfaces/sement.js
CHANGED
|
@@ -56,9 +56,13 @@ import { createShowcase } from "./_showcase.js";
|
|
| 56 |
const ID = "sement";
|
| 57 |
const TITLE = "Semantic-Entropy · Effective-Rank Epistemic Uncertainty (live)";
|
| 58 |
|
| 59 |
-
//
|
| 60 |
-
//
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
// data-viz hues — purple BANNED
|
| 64 |
const C_CONF = 0x5b8dee; // lattice-blue (confident regime / naive-entropy bar)
|
|
@@ -441,4 +445,4 @@ export function unmount() {
|
|
| 441 |
_pulse.fill(0);
|
| 442 |
}
|
| 443 |
|
| 444 |
-
export default { id: ID, title: TITLE, endpoints: [EP], mount, unmount };
|
|
|
|
| 56 |
const ID = "sement";
|
| 57 |
const TITLE = "Semantic-Entropy · Effective-Rank Epistemic Uncertainty (live)";
|
| 58 |
|
| 59 |
+
// PRIMARY endpoint is the a11oy-NATIVE self-hosted twin (same-origin, szl_semantic_entropy.py):
|
| 60 |
+
// the Farquhar et al. (Nature 2024) semantic-entropy method simulated on synthetic toy
|
| 61 |
+
// regimes, feeding Λ (Conjecture 1) an ADVISORY ABSTAIN gate (label MODELED, read
|
| 62 |
+
// verbatim). The isolated killinchu Space stays a guarded cross-origin FALLBACK so a
|
| 63 |
+
// fault in either path never darkens the other.
|
| 64 |
+
const EP = "/api/a11oy/v1/uq/semantic-entropy?seed=42&K=40&threshold=0.6";
|
| 65 |
+
const EP_FALLBACK = "https://szlholdings-killinchu.hf.space/api/killinchu/v1/sement/estimate?seed=42&K=40&n_clusters=5&threshold=0.6";
|
| 66 |
|
| 67 |
// data-viz hues — purple BANNED
|
| 68 |
const C_CONF = 0x5b8dee; // lattice-blue (confident regime / naive-entropy bar)
|
|
|
|
| 445 |
_pulse.fill(0);
|
| 446 |
}
|
| 447 |
|
| 448 |
+
export default { id: ID, title: TITLE, endpoints: [EP, EP_FALLBACK], mount, unmount };
|