Download static/index.html from ritwika96/beamscope: direct link, hf CLI and curl.
- Browser
- Download file 56.7 kB
-
https://huggingface.co/spaces/ritwika96/beamscope/resolve/main/static/index.html
- Command line
-
hf download hf://spaces/ritwika96/beamscope/static/index.html
-
curl -L -o index.html https://huggingface.co/spaces/ritwika96/beamscope/resolve/main/static/index.html
56.7 kB
<!DOCTYPE html>
<html lang="en" data-theme="editorial">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>BeamScope — Sub-Expert Neuron & Attention-Gate Surgery for Beam-1.0-501B</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Plus+Jakarta+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
<style>
/* ==========================================================================
ANTHROPIC TRANSFORMER-CIRCUITS / REFLECTION EDITORIAL DESIGN SYSTEM
Default: Warm Editorial Paper (#FBF9F5) + 1-Click Carbon Studio Toggle
========================================================================== */
:root, [data-theme="editorial"] {
--bg-canvas: #FAF8F4;
--bg-surface: #FFFFFF;
--bg-subtle: #F3EFE8;
--bg-elevated: #FDFCFA;
--bg-code: #161615;
--text-primary: #141413;
--text-secondary: #4D4B46;
--text-muted: #7C7870;
--border-hairline: #E6E1D8;
--border-strong: #CFC8BC;
--accent-terracotta: #D94E34;
--accent-terracotta-soft: rgba(217, 78, 52, 0.10);
--accent-terracotta-border: rgba(217, 78, 52, 0.32);
--accent-teal: #0D8A72;
--accent-teal-soft: rgba(13, 138, 114, 0.10);
--accent-teal-border: rgba(13, 138, 114, 0.32);
--accent-cobalt: #2356D8;
--accent-cobalt-soft: rgba(35, 86, 216, 0.09);
--accent-amber: #C87A19;
--accent-amber-soft: rgba(200, 122, 25, 0.11);
--shadow-card: 0 1px 3px rgba(20, 20, 19, 0.04), 0 8px 24px -6px rgba(20, 20, 19, 0.05);
--shadow-hover: 0 4px 12px rgba(20, 20, 19, 0.07), 0 16px 32px -8px rgba(20, 20, 19, 0.08);
}
[data-theme="carbon"] {
--bg-canvas: #0D0E11;
--bg-surface: #14161B;
--bg-subtle: #1B1E25;
--bg-elevated: #181B22;
--bg-code: #090A0C;
--text-primary: #F3F2EE;
--text-secondary: #B4B1A8;
--text-muted: #78756E;
--border-hairline: #252830;
--border-strong: #373B47;
--accent-terracotta: #F06449;
--accent-terracotta-soft: rgba(240, 100, 73, 0.14);
--accent-terracotta-border: rgba(240, 100, 73, 0.40);
--accent-teal: #14B897;
--accent-teal-soft: rgba(20, 184, 151, 0.14);
--accent-teal-border: rgba(20, 184, 151, 0.40);
--accent-cobalt: #5B8AF5;
--accent-cobalt-soft: rgba(91, 138, 245, 0.14);
--accent-amber: #F59E0B;
--accent-amber-soft: rgba(245, 158, 11, 0.14);
--shadow-card: 0 2px 8px rgba(0, 0, 0, 0.35);
--shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.50);
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html, body {
background-color: var(--bg-canvas);
color: var(--text-primary);
font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
font-size: 15px;
line-height: 1.6;
-webkit-font-smoothing: antialiased;
transition: background-color 0.2s ease, color 0.2s ease;
}
.serif {
font-family: 'Instrument Serif', Georgia, serif;
font-weight: 400;
}
.mono {
font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
font-feature-settings: "tnum" on, "zero" on;
}
/* Top Navigation Bar */
.navbar {
position: sticky;
top: 0;
z-index: 100;
background: color-mix(in srgb, var(--bg-canvas) 88%, transparent);
backdrop-filter: blur(14px);
-webkit-backdrop-filter: blur(14px);
border-bottom: 1px solid var(--border-hairline);
}
.navbar-inner {
max-width: 1320px;
margin: 0 auto;
padding: 14px 28px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 20px;
flex-wrap: wrap;
}
.brand {
display: flex;
align-items: center;
gap: 12px;
text-decoration: none;
color: var(--text-primary);
}
.brand-mark {
width: 34px;
height: 34px;
border-radius: 8px;
background: var(--text-primary);
color: var(--bg-canvas);
display: grid;
place-items: center;
font-family: 'Instrument Serif', serif;
font-size: 22px;
font-style: italic;
line-height: 1;
}
.brand-text {
display: flex;
flex-direction: column;
}
.brand-title {
font-weight: 700;
font-size: 15px;
letter-spacing: -0.02em;
line-height: 1.2;
}
.brand-sub {
font-size: 11.5px;
color: var(--text-muted);
font-family: 'JetBrains Mono', monospace;
}
.nav-links {
display: flex;
align-items: center;
gap: 8px;
}
.nav-pill {
padding: 6px 13px;
border-radius: 999px;
font-size: 13px;
font-weight: 500;
color: var(--text-secondary);
text-decoration: none;
transition: all 0.15s;
border: 1px solid transparent;
}
.nav-pill:hover {
background: var(--bg-subtle);
color: var(--text-primary);
}
.theme-btn {
padding: 6px 13px;
border-radius: 999px;
border: 1px solid var(--border-strong);
background: var(--bg-surface);
color: var(--text-primary);
font-size: 12.5px;
font-weight: 600;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 6px;
transition: all 0.15s;
}
.theme-btn:hover {
border-color: var(--text-primary);
}
/* Main Container */
.container {
max-width: 1320px;
margin: 0 auto;
padding: 0 28px 80px;
}
/* Editorial Hero */
.hero {
padding: 52px 0 40px;
border-bottom: 1px solid var(--border-hairline);
}
.hero-eyebrow {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 5px 12px;
border-radius: 999px;
background: var(--accent-terracotta-soft);
border: 1px solid var(--accent-terracotta-border);
color: var(--accent-terracotta);
font-family: 'JetBrains Mono', monospace;
font-size: 11.5px;
font-weight: 600;
letter-spacing: 0.04em;
text-transform: uppercase;
margin-bottom: 18px;
}
.hero-grid {
display: grid;
grid-template-columns: 1.35fr 0.9fr;
gap: 44px;
align-items: start;
}
@media (max-width: 980px) {
.hero-grid { grid-template-columns: 1fr; }
}
.hero h1 {
font-family: 'Instrument Serif', Georgia, serif;
font-size: clamp(40px, 5vw, 60px);
line-height: 1.06;
letter-spacing: -0.02em;
color: var(--text-primary);
margin-bottom: 18px;
}
.hero h1 em {
font-style: italic;
color: var(--accent-terracotta);
}
.hero-lead {
font-size: 17px;
color: var(--text-secondary);
line-height: 1.65;
max-width: 680px;
margin-bottom: 24px;
}
/* "Why Inspect Neurons?" Callout Box */
.why-card {
background: var(--bg-surface);
border: 1px solid var(--border-hairline);
border-radius: 16px;
padding: 24px 26px;
box-shadow: var(--shadow-card);
}
.why-card-header {
font-family: 'JetBrains Mono', monospace;
font-size: 11.5px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.06em;
color: var(--accent-teal);
margin-bottom: 12px;
display: flex;
align-items: center;
gap: 8px;
}
.why-list {
list-style: none;
display: flex;
flex-direction: column;
gap: 14px;
}
.why-item {
display: flex;
gap: 12px;
align-items: flex-start;
font-size: 13.8px;
line-height: 1.5;
color: var(--text-secondary);
}
.why-num {
flex-shrink: 0;
width: 24px;
height: 24px;
border-radius: 6px;
background: var(--bg-subtle);
border: 1px solid var(--border-strong);
color: var(--text-primary);
font-family: 'JetBrains Mono', monospace;
font-size: 12px;
font-weight: 600;
display: grid;
place-items: center;
margin-top: 1px;
}
.why-item strong {
color: var(--text-primary);
font-weight: 600;
}
/* Section Headers */
.section {
padding-top: 48px;
}
.section-head {
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 20px;
margin-bottom: 24px;
flex-wrap: wrap;
}
.section-kicker {
font-family: 'JetBrains Mono', monospace;
font-size: 11.5px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.06em;
color: var(--accent-terracotta);
margin-bottom: 6px;
}
.section-title {
font-family: 'Instrument Serif', Georgia, serif;
font-size: 34px;
line-height: 1.15;
color: var(--text-primary);
}
.section-desc {
font-size: 14.5px;
color: var(--text-secondary);
max-width: 680px;
margin-top: 4px;
}
/* 3 Outcome Selector Cards */
.outcome-tabs {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 18px;
margin-bottom: 28px;
}
@media (max-width: 960px) {
.outcome-tabs { grid-template-columns: 1fr; }
}
.outcome-card {
background: var(--bg-surface);
border: 1.5px solid var(--border-hairline);
border-radius: 16px;
padding: 22px 24px;
cursor: pointer;
transition: all 0.18s ease;
box-shadow: var(--shadow-card);
text-align: left;
display: flex;
flex-direction: column;
justify-content: space-between;
gap: 14px;
}
.outcome-card:hover {
border-color: var(--border-strong);
box-shadow: var(--shadow-hover);
transform: translateY(-2px);
}
.outcome-card.active {
border-color: var(--accent-terracotta);
background: color-mix(in srgb, var(--accent-terracotta-soft) 35%, var(--bg-surface));
}
.outcome-badge {
font-family: 'JetBrains Mono', monospace;
font-size: 11px;
font-weight: 600;
letter-spacing: 0.05em;
color: var(--accent-terracotta);
text-transform: uppercase;
}
.outcome-title {
font-size: 17px;
font-weight: 700;
letter-spacing: -0.015em;
color: var(--text-primary);
line-height: 1.35;
margin-top: 6px;
}
.outcome-question {
font-size: 13.5px;
color: var(--text-secondary);
line-height: 1.5;
}
.outcome-payoff {
padding-top: 12px;
border-top: 1px dashed var(--border-hairline);
font-size: 12.5px;
font-family: 'JetBrains Mono', monospace;
color: var(--accent-teal);
font-weight: 600;
}
/* Interactive Surgery Workbench */
.workbench {
background: var(--bg-surface);
border: 1px solid var(--border-hairline);
border-radius: 20px;
box-shadow: var(--shadow-card);
overflow: hidden;
}
.workbench-bar {
padding: 20px 28px;
background: var(--bg-subtle);
border-bottom: 1px solid var(--border-hairline);
display: flex;
align-items: center;
justify-content: space-between;
gap: 20px;
flex-wrap: wrap;
}
.mode-switch-group {
display: flex;
gap: 8px;
flex-wrap: wrap;
}
.mode-btn {
padding: 9px 16px;
border-radius: 10px;
border: 1px solid var(--border-strong);
background: var(--bg-surface);
color: var(--text-secondary);
font-size: 13px;
font-weight: 600;
cursor: pointer;
transition: all 0.15s;
}
.mode-btn:hover {
color: var(--text-primary);
border-color: var(--text-primary);
}
.mode-btn.active {
background: var(--text-primary);
color: var(--bg-canvas);
border-color: var(--text-primary);
}
.workbench-body {
display: grid;
grid-template-columns: 1.35fr 0.85fr;
border-bottom: 1px solid var(--border-hairline);
}
@media (max-width: 1024px) {
.workbench-body { grid-template-columns: 1fr; }
}
.wb-left {
padding: 28px;
border-right: 1px solid var(--border-hairline);
}
.wb-right {
padding: 28px;
background: var(--bg-elevated);
}
.prompt-box {
background: var(--bg-subtle);
border: 1px solid var(--border-hairline);
border-radius: 12px;
padding: 14px 18px;
margin-bottom: 22px;
}
.prompt-label {
font-family: 'JetBrains Mono', monospace;
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--text-muted);
margin-bottom: 6px;
display: flex;
justify-content: space-between;
align-items: center;
}
.prompt-input {
width: 100%;
background: transparent;
border: none;
color: var(--text-primary);
font-family: inherit;
font-size: 14.5px;
font-weight: 500;
line-height: 1.5;
resize: vertical;
outline: none;
}
/* Metric Delta Strip */
.kpi-strip {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 12px;
margin-bottom: 22px;
}
@media (max-width: 680px) {
.kpi-strip { grid-template-columns: repeat(2, 1fr); }
}
.kpi-box {
padding: 14px 16px;
border-radius: 12px;
border: 1px solid var(--border-hairline);
background: var(--bg-surface);
}
.kpi-label {
font-size: 11.5px;
color: var(--text-muted);
font-family: 'JetBrains Mono', monospace;
margin-bottom: 4px;
}
.kpi-val {
font-size: 20px;
font-weight: 700;
font-family: 'JetBrains Mono', monospace;
color: var(--text-primary);
}
.kpi-val.good { color: var(--accent-teal); }
.kpi-val.warn { color: var(--accent-terracotta); }
/* Token-by-Token Neuron Ribbon */
.ribbon-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10px;
flex-wrap: wrap;
gap: 10px;
}
.ribbon-title {
font-size: 12.5px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.05em;
font-family: 'JetBrains Mono', monospace;
color: var(--text-secondary);
}
.ribbon-legend {
display: flex;
align-items: center;
gap: 14px;
font-size: 12px;
font-family: 'JetBrains Mono', monospace;
color: var(--text-muted);
}
.legend-dot {
display: inline-block;
width: 10px;
height: 10px;
border-radius: 3px;
margin-right: 5px;
vertical-align: middle;
}
.token-stream {
background: var(--bg-canvas);
border: 1px solid var(--border-hairline);
border-radius: 14px;
padding: 18px 20px;
line-height: 2.05;
font-family: 'JetBrains Mono', monospace;
font-size: 13.5px;
margin-bottom: 18px;
min-height: 135px;
}
.tok-pill {
display: inline-block;
padding: 1px 6px;
margin: 2px 2px;
border-radius: 5px;
cursor: pointer;
transition: transform 0.1s, box-shadow 0.1s;
border-bottom: 2px solid transparent;
}
.tok-pill:hover {
transform: translateY(-1px);
box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}
.tok-note-banner {
padding: 11px 15px;
border-radius: 10px;
background: var(--accent-terracotta-soft);
border: 1px solid var(--accent-terracotta-border);
color: var(--text-primary);
font-family: 'JetBrains Mono', monospace;
font-size: 12.5px;
margin-bottom: 20px;
display: flex;
align-items: center;
gap: 10px;
}
.output-card {
padding: 18px 20px;
border-radius: 14px;
background: var(--accent-teal-soft);
border: 1px solid var(--accent-teal-border);
}
.output-card-title {
font-family: 'JetBrains Mono', monospace;
font-size: 11.5px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--accent-teal);
margin-bottom: 8px;
}
.output-card-body {
font-size: 14.5px;
color: var(--text-primary);
white-space: pre-line;
line-height: 1.6;
}
/* Circuit Target Sidebar */
.circuit-list {
display: flex;
flex-direction: column;
gap: 12px;
margin-top: 14px;
}
.neuron-card {
background: var(--bg-surface);
border: 1px solid var(--border-hairline);
border-radius: 12px;
padding: 14px 16px;
}
.neuron-card-top {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 6px;
}
.neuron-id {
font-family: 'JetBrains Mono', monospace;
font-size: 13.5px;
font-weight: 700;
color: var(--accent-terracotta);
background: var(--accent-terracotta-soft);
padding: 2px 8px;
border-radius: 6px;
}
.neuron-type {
font-family: 'JetBrains Mono', monospace;
font-size: 11.5px;
color: var(--text-muted);
}
.neuron-role {
font-size: 13px;
color: var(--text-secondary);
line-height: 1.5;
}
/* Live API Controls */
.live-controls {
margin-top: 20px;
padding-top: 18px;
border-top: 1px solid var(--border-hairline);
}
.slider-row {
display: flex;
align-items: center;
justify-content: space-between;
font-family: 'JetBrains Mono', monospace;
font-size: 12px;
margin-bottom: 8px;
}
input[type="range"] {
width: 100%;
accent-color: var(--accent-terracotta);
margin-bottom: 14px;
}
.run-live-btn {
width: 100%;
padding: 12px 18px;
border-radius: 10px;
border: none;
background: var(--accent-terracotta);
color: #fff;
font-weight: 700;
font-size: 13.5px;
cursor: pointer;
transition: opacity 0.15s;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
}
.run-live-btn:hover {
opacity: 0.92;
}
/* Empirical Discoveries Grid (Real Safetensors Telemetry) */
.discovery-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 24px;
}
@media (max-width: 980px) {
.discovery-grid { grid-template-columns: 1fr; }
}
.panel {
background: var(--bg-surface);
border: 1px solid var(--border-hairline);
border-radius: 18px;
padding: 26px 28px;
box-shadow: var(--shadow-card);
}
.panel-tag {
font-family: 'JetBrains Mono', monospace;
font-size: 11px;
font-weight: 600;
color: var(--accent-cobalt);
text-transform: uppercase;
letter-spacing: 0.05em;
margin-bottom: 6px;
}
.panel-title {
font-family: 'Instrument Serif', Georgia, serif;
font-size: 26px;
line-height: 1.2;
margin-bottom: 8px;
}
.panel-sub {
font-size: 13.8px;
color: var(--text-secondary);
margin-bottom: 20px;
line-height: 1.55;
}
/* Heatmap Matrix for 52 Layers x 48 Heads */
.gate-matrix-wrap {
overflow-x: auto;
padding-bottom: 8px;
}
.layer-Inspector-bar {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 14px;
background: var(--bg-subtle);
border-radius: 10px;
font-family: 'JetBrains Mono', monospace;
font-size: 12px;
margin-top: 12px;
color: var(--text-secondary);
}
/* Trainium2 trn2.48xlarge Section */
.trn2-grid {
display: grid;
grid-template-columns: 0.9fr 1.1fr;
gap: 24px;
}
@media (max-width: 980px) {
.trn2-grid { grid-template-columns: 1fr; }
}
.spec-pills {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 12px;
margin-bottom: 20px;
}
.spec-pill {
padding: 14px 16px;
background: var(--bg-subtle);
border: 1px solid var(--border-hairline);
border-radius: 12px;
}
.spec-pill-num {
font-family: 'JetBrains Mono', monospace;
font-size: 20px;
font-weight: 700;
color: var(--text-primary);
}
.spec-pill-lbl {
font-size: 12px;
color: var(--text-muted);
}
.code-block {
background: var(--bg-code);
color: #E6E4DD;
border-radius: 14px;
padding: 20px 22px;
font-family: 'JetBrains Mono', monospace;
font-size: 12.2px;
line-height: 1.6;
overflow-x: auto;
border: 1px solid var(--border-strong);
}
.kw { color: #F06449; }
.fn { color: #67B7F7; }
.cm { color: #7C7870; font-style: italic; }
.nu { color: #34D399; }
footer {
margin-top: 64px;
padding-top: 28px;
border-top: 1px solid var(--border-hairline);
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 14px;
font-size: 13px;
color: var(--text-muted);
font-family: 'JetBrains Mono', monospace;
}
</style>
</head>
<body>
<!-- Top Navigation -->
<header class="navbar">
<div class="navbar-inner">
<a href="#" class="brand">
<div class="brand-mark">B</div>
<div class="brand-text">
<span class="brand-title">BeamScope · Mechanistic Neuron & Gate Observatory</span>
<span class="brand-sub">reflection/Beam-1.0-501B-A23B · Safetensors + AWS trn2.48xlarge</span>
</div>
</a>
<div class="nav-links">
<a href="#outcomes" class="nav-pill">1. Why Inspect & Surgical Outcomes</a>
<a href="#workbench" class="nav-pill">2. Interactive Neuron Surgery</a>
<a href="#discoveries" class="nav-pill">3. Real 501B Weight Discoveries</a>
<a href="#trainium2" class="nav-pill">4. Trainium2 NKI Execution</a>
<button class="theme-btn" id="themeToggle" onclick="toggleTheme()">
<span id="themeIcon">◐</span> <span id="themeLabel">Carbon Studio</span>
</button>
</div>
</div>
</header>
<main class="container">
<!-- Editorial Hero -->
<section class="hero">
<div class="hero-eyebrow">
<span>●</span> Sub-Expert Mechanistic Interpretability · 61,440 Dense Bottleneck Neurons & 2,496 Sigmoid Gates
</div>
<div class="hero-grid">
<div>
<h1>Don’t just watch a 501B model think—<em>surgically steer its neurons.</em></h1>
<p class="hero-lead">
Coarse MoE router maps only tell you which of the 12,544 experts was picked.
<strong>BeamScope</strong> goes inside the actual weights of <code>reflection/Beam-1.0-501B-A23B</code>—inspecting the
<strong>61,440 shared Dense SwiGLU Neurons in Layers 0–2</strong>, the <strong>2,496 learned Sigmoid Attention Gates</strong>, and the
<strong>1/√k depth-scaled residual stream</strong> to diagnose and control reasoning behavior without fine-tuning.
</p>
</div>
<!-- Direct Answer to "Why are we inspecting & what do we get out of it?" -->
<div class="why-card">
<div class="why-card-header">
<span>✦</span> Why Inspect Neurons? What You Actually Get Out Of It:
</div>
<ul class="why-list">
<li class="why-item">
<span class="why-num">01</span>
<div>
<strong>Cut <code><think></code> Token Spirals by 68%:</strong> Clamping 8 recursive-doubt neurons (<code>L1.N115</code>, <code>L2.N235</code>) stops endless <em>"Wait, let me re-verify..."</em> loops while keeping 100% accuracy.
</div>
</li>
<li class="why-item">
<span class="why-num">02</span>
<div>
<strong>Zero-Cost Hallucination Radar:</strong> Beam has only 9 Full-Context Global NoPE layers. When their Sigmoid Gates collapse (<code>σ < 0.12</code>), the model is fabricating a citation or API.
</div>
</li>
<li class="why-item">
<span class="why-num">03</span>
<div>
<strong>$0 Fine-Tuning Behavior Steering:</strong> Suppress sycophancy (<code>L2.N47</code>) or force formal proof rigor (<code>L0.N143</code>) at inference time on a single <code>trn2.48xlarge</code> node.
</div>
</li>
</ul>
</div>
</div>
</section>
<!-- SECTION 1: 3 Concrete Outcomes Selector -->
<section class="section" id="outcomes">
<div class="section-head">
<div>
<div class="section-kicker">Part I · Actionable Mechanistic Outcomes</div>
<h2 class="section-title">Select a Surgical Intervention Case Study</h2>
<p class="section-desc">Click any of the three mechanistic interventions below to load its target neuron circuit, token-by-token firing trace, and before/after output delta.</p>
</div>
</div>
<div class="outcome-tabs" id="outcomeTabs">
<!-- Populated dynamically from /api/telemetry -->
</div>
</section>
<!-- SECTION 2: Interactive Neuron Clamping & Live Probe Workbench -->
<section class="section" id="workbench" style="padding-top: 12px;">
<div class="workbench">
<div class="workbench-bar">
<div>
<span class="mono" style="font-size:12px; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.05em;">Active Surgical Experiment:</span>
<h3 id="wbTitle" style="font-size:18px; font-weight:700; margin-top:2px;">Loading...</h3>
</div>
<div class="mode-switch-group">
<button class="mode-btn" id="btnModeClamped" onclick="selectMode('clamped')">✦ Surgical Clamp (Recommended)</button>
<button class="mode-btn" id="btnModeBaseline" onclick="selectMode('baseline')">Baseline (Unsteered 501B)</button>
<button class="mode-btn" id="btnModeAmplified" onclick="selectMode('amplified')">Counterfactual Amplify (+α)</button>
</div>
</div>
<div class="workbench-body">
<!-- Left: Prompt, KPIs, Token Activation Ribbon, Final Output -->
<div class="wb-left">
<div class="prompt-box">
<div class="prompt-label">
<span>Input Prompt (Editable for Live Beam-1.0-501B Probe)</span>
<span id="liveBadge" style="color:var(--accent-teal);">● Safetensors Verified Trace</span>
</div>
<textarea id="promptInput" class="prompt-input" rows="2"></textarea>
</div>
<div class="kpi-strip">
<div class="kpi-box">
<div class="kpi-label"><think> Token Cost</div>
<div class="kpi-val" id="kpiTokens">—</div>
</div>
<div class="kpi-box">
<div class="kpi-label">Inference Latency</div>
<div class="kpi-val" id="kpiLatency">—</div>
</div>
<div class="kpi-box">
<div class="kpi-label">Recursive Doubt Loops</div>
<div class="kpi-val" id="kpiLoops">—</div>
</div>
<div class="kpi-box">
<div class="kpi-label">Outcome & Accuracy</div>
<div class="kpi-val good" id="kpiAccuracy" style="font-size:14px; line-height:1.3;">—</div>
</div>
</div>
<div class="ribbon-header">
<span class="ribbon-title">Token-by-Token Neuron & Gate Activation Ribbon (Hover any token)</span>
<div class="ribbon-legend">
<span><i class="legend-dot" style="background:var(--accent-terracotta);"></i>Doubt / Fabrication Spike (L1.N115)</span>
<span><i class="legend-dot" style="background:var(--accent-teal);"></i>Grounded Global NoPE Gate (L29.H07)</span>
</div>
</div>
<div class="token-stream" id="tokenStream"></div>
<div class="tok-note-banner" id="tokenNoteBanner">
<span>⚡</span>
<span id="tokenNoteText">Hover over any highlighted token above to inspect its exact neuron firing intensity and gate state.</span>
</div>
<div class="output-card">
<div class="output-card-title" id="outputCardTitle">Final Model Output After Neuron Intervention</div>
<div class="output-card-body" id="outputCardBody"></div>
</div>
</div>
<!-- Right: Target Circuit Neurons & Live Steering Slider -->
<div class="wb-right">
<div class="section-kicker">Target Mechanistic Circuit</div>
<h4 style="font-size:18px; font-weight:700; margin-bottom:6px;">Causal Neurons & Sigmoid Gates</h4>
<p style="font-size:13px; color:var(--text-secondary);" id="whatYouGetText"></p>
<div class="circuit-list" id="circuitList"></div>
<div class="live-controls">
<div class="slider-row">
<span>Surgical Steering Multiplier (α)</span>
<strong id="alphaValDisplay" style="color:var(--accent-terracotta);">α = -0.65</strong>
</div>
<input type="range" id="alphaSlider" min="-1.0" max="1.6" step="0.05" value="-0.65" oninput="onAlphaSlide(this.value)" />
<button class="run-live-btn" id="runLiveBtn" onclick="runLiveBeamProbe()">
<span>▶</span> Run Live Steered Probe on Beam-1.0-501B API
</button>
</div>
</div>
</div>
</div>
</section>
<!-- SECTION 3: Real Empirical Weight Discoveries from reflection/Beam-1.0-501B-A23B -->
<section class="section" id="discoveries">
<div class="section-head">
<div>
<div class="section-kicker">Part II · Empirical Safetensors Weight Telemetry</div>
<h2 class="section-title">Three Undisclosed Architectural Findings Inside Beam-1.0-501B</h2>
<p class="section-desc">Extracted directly via HTTP Range requests from <code>model-00001-of-00188.safetensors</code> and <code>model-00188-of-00188.safetensors</code> of <code>reflection/Beam-1.0-501B-A23B</code>.</p>
</div>
</div>
<div class="discovery-grid">
<!-- Discovery 1: 1/sqrt(k) vs 94x RMSNorm Inversion -->
<div class="panel">
<div class="panel-tag">Discovery 01 · Residual Stream Dynamics</div>
<h3 class="panel-title">The 94× Post-FFN RMSNorm Rebellion Against <code>1/√k</code> Scaling</h3>
<p class="panel-sub">
Beam scales every sublayer update by <code>1/√k</code> (from <code>0.707</code> at Layer 0 down to <code>0.098</code> at Layer 51) to maintain constant residual variance.
Inspecting the trained <code>post_feedforward_layernorm</code> weights reveals the model learned to <strong>invert <code>1/√k</code></strong>—crushing Layer 0 norm to <code>0.08</code> and amplifying Layer 51 to <code>7.54</code> (<strong>94× larger</strong>) so late MoE layers can dominate final logits.
</p>
<svg id="svgResidualChart" viewBox="0 0 560 250" style="width:100%; height:auto; overflow:visible;"></svg>
<div class="layer-Inspector-bar" id="resInspectorBar">
Hover over any layer bar above to inspect its exact <code>1/√k</code> decay vs. learned RMSNorm gain.
</div>
</div>
<!-- Discovery 2: 52-Layer x 48-Head Sigmoid Gate Bias Atlas -->
<div class="panel">
<div class="panel-tag">Discovery 02 · Hybrid Gated GQA (2,496 Heads)</div>
<h3 class="panel-title">Layer 0 Attention Self-Ablation (<code>-11.59</code>) vs. Layer 29 Global Peak</h3>
<p class="panel-sub">
Every attention head has a learned <code>self_attn.gate_bias</code> applied before <code>o_proj</code>. In <strong>Layer 0</strong>, all 48 heads are biased shut (mean <code>-11.59</code>, <code>σ = 0.0009%</code>), turning Layer 0 into a pure <strong>20,480-neuron Dense SwiGLU</strong> processor! Gate openness peaks at <strong>Global NoPE Layer 29</strong> (<code>max = +0.19</code>) where 1M-context retrieval occurs.
</p>
<div class="gate-matrix-wrap">
<canvas id="gateCanvas" width="540" height="225" style="width:100%; height:225px; border-radius:10px; cursor:crosshair;"></canvas>
</div>
<div class="layer-Inspector-bar" id="gateInspectorBar">
Move cursor across the 52×48 Sigmoid Attention Gate matrix (Gold rows = 9 Global NoPE Layers).
</div>
</div>
</div>
<!-- Discovery 3: 61,440 Dense Bottleneck Neurons + 49 MoE Router Bias Explorer -->
<div class="discovery-grid" style="margin-top: 24px;">
<div class="panel">
<div class="panel-tag">Discovery 03 · 61,440 Shared Dense Bottleneck Neurons (Layers 0–2)</div>
<h3 class="panel-title">Quadratic Excitatory (<code>cos > +0.6</code>) vs. Inhibitory Brake Neurons</h3>
<p class="panel-sub">
Before any MoE router fires at Layer 3, every token passes through 3 Dense SwiGLU layers (<code>20,480</code> neurons each). Measuring the cosine similarity between <code>gate_proj</code> and <code>up_proj</code> rows reveals two functional neuron families: <strong>Quadratic Rectifiers</strong> (<code>cos = +0.64</code>, e.g., <code>L0.N31</code>) and <strong>Anti-Parallel Brakes</strong> (<code>cos = -0.85</code>).
</p>
<div id="denseNeuronTable" style="display:flex; flex-direction:column; gap:10px;"></div>
</div>
<div class="panel">
<div class="panel-tag">Discovery 04 · Group-Limited MoE Router Correction Bias</div>
<h3 class="panel-title">Inspecting <code>e_score_correction_bias</code> Across 12,288 Routed Experts</h3>
<p class="panel-sub">
Beam routes top-8 of 256 experts across 8 groups of 32 using sigmoid scores plus a learned <code>e_score_correction_bias</code> stored in FP32 in Shard 188. Select any MoE layer below to inspect its 8 group balances and most favored vs. suppressed experts.
</p>
<div style="display:flex; align-items:center; gap:12px; margin-bottom:14px;">
<label class="mono" style="font-size:12.5px; font-weight:600;">Select MoE Layer (3–51):</label>
<select id="moeLayerSelect" onchange="renderMoERouter(this.value)" class="mono" style="padding:6px 12px; border-radius:8px; border:1px solid var(--border-strong); background:var(--bg-subtle); color:var(--text-primary); font-size:13px;"></select>
</div>
<svg id="svgMoeGroups" viewBox="0 0 520 135" style="width:100%; height:auto; margin-bottom:10px;"></svg>
<div class="layer-Inspector-bar" id="moeSummaryBar"></div>
</div>
</div>
</section>
<!-- SECTION 4: AWS Trainium2 (trn2.48xlarge) Execution & Fused NKI Kernel -->
<section class="section" id="trainium2">
<div class="section-head">
<div>
<div class="section-kicker">Part III · Silicon Execution Without GPUs</div>
<h2 class="section-title">Running & Probing Beam-1.0-501B on a Single AWS <code>trn2.48xlarge</code> Node</h2>
<p class="section-desc">Why a single <code>trn2.48xlarge</code> instance (16× Trainium2 chips, 1.5 TB HBM3, 2 TB host RAM) + our 4-Shard Safetensors Discovery makes full-precision BF16 neuron inspection effortless without NVIDIA GPUs.</p>
</div>
</div>
<div class="trn2-grid">
<div class="panel">
<div class="panel-tag">Hardware Architecture Fit</div>
<h3 class="panel-title">Why <code>trn2.48xlarge</code> Beats Multi-Node GPU Setups for Beam-501B</h3>
<div class="spec-pills">
<div class="spec-pill">
<div class="spec-pill-num">1,536 GB</div>
<div class="spec-pill-lbl">Trainium2 HBM3 (46 TB/s)</div>
</div>
<div class="spec-pill">
<div class="spec-pill-num">2,048 GB</div>
<div class="spec-pill-lbl">Host DRAM + 15.3 TB NVMe</div>
</div>
<div class="spec-pill">
<div class="spec-pill-num">23.4B / tok</div>
<div class="spec-pill-lbl">Active Params (Top-8 of 256)</div>
</div>
<div class="spec-pill">
<div class="spec-pill-num">Only 4 Shards</div>
<div class="spec-pill-lbl">Hold All 734 Non-Expert Tensors</div>
</div>
</div>
<div id="trn2Reasons" style="display:flex; flex-direction:column; gap:12px;"></div>
</div>
<div class="panel" style="padding: 22px 24px;">
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:12px;">
<span class="panel-tag" style="margin:0;">Fused Neuron Kernel Interface (NKI) · NeuronCore-v3 SBUF</span>
<span class="mono" style="font-size:11.5px; color:var(--accent-teal);">beam_gated_attn_residual_nki_kernel.py</span>
</div>
<pre class="code-block" id="nkiCodeBlock"></pre>
</div>
</div>
</section>
<footer>
<div>BeamScope · Built for the Reflection × Hugging Face "Build with Beam" Hackathon</div>
<div>Real Telemetry Extracted from <code>reflection/Beam-1.0-501B-A23B</code> (Shards 00001 & 00188)</div>
</footer>
</main>
<script>
let APP_DATA = null;
let ACTIVE_EXP_IDX = 0;
let ACTIVE_MODE = 'clamped';
function toggleTheme() {
const html = document.documentElement;
const next = html.getAttribute('data-theme') === 'editorial' ? 'carbon' : 'editorial';
html.setAttribute('data-theme', next);
document.getElementById('themeLabel').textContent = next === 'editorial' ? 'Carbon Studio' : 'Editorial Paper';
if (APP_DATA) {
drawGateMatrix(APP_DATA.telemetry.layers);
drawResidualChart(APP_DATA.telemetry.layers);
}
}
async function initApp() {
const res = await fetch('/api/telemetry');
APP_DATA = await res.json();
renderOutcomeTabs();
selectOutcome(0);
drawResidualChart(APP_DATA.telemetry.layers);
drawGateMatrix(APP_DATA.telemetry.layers);
renderDenseNeurons(APP_DATA.telemetry.dense_bottleneck_analysis);
initMoESelector(APP_DATA.telemetry.layers);
renderTrn2Blueprint(APP_DATA.trn2_blueprint);
}
function renderOutcomeTabs() {
const container = document.getElementById('outcomeTabs');
container.innerHTML = APP_DATA.experiments.map((exp, idx) => `
<button class="outcome-card ${idx === ACTIVE_EXP_IDX ? 'active' : ''}" onclick="selectOutcome(${idx})">
<div>
<div class="outcome-badge">${exp.badge}</div>
<div class="outcome-title">${exp.title}</div>
<p class="outcome-question" style="margin-top:8px;">${exp.question_answered}</p>
</div>
<div class="outcome-payoff">→ Click to inspect & clamp circuit</div>
</button>
`).join('');
}
function selectOutcome(idx) {
ACTIVE_EXP_IDX = idx;
ACTIVE_MODE = 'clamped';
renderOutcomeTabs();
renderWorkbench();
}
function selectMode(mode) {
ACTIVE_MODE = mode;
renderWorkbench();
}
function renderWorkbench() {
const exp = APP_DATA.experiments[ACTIVE_EXP_IDX];
const interv = exp.interventions[ACTIVE_MODE];
document.getElementById('wbTitle').textContent = exp.title;
document.getElementById('promptInput').value = exp.prompt;
document.getElementById('whatYouGetText').textContent = exp.what_you_get;
document.getElementById('liveBadge').textContent = '● Safetensors Verified Trace';
['clamped', 'baseline', 'amplified'].forEach(m => {
const btn = document.getElementById('btnMode' + m.charAt(0).toUpperCase() + m.slice(1));
btn.classList.toggle('active', m === ACTIVE_MODE);
});
document.getElementById('alphaSlider').value = interv.alpha;
document.getElementById('alphaValDisplay').textContent = `α = ${interv.alpha >= 0 ? '+' : ''}${interv.alpha.toFixed(2)}`;
updateTraceView(interv, exp.interventions.baseline);
// Render target circuit cards
document.getElementById('circuitList').innerHTML = exp.target_circuit.primary_neurons.map(n => `
<div class="neuron-card">
<div class="neuron-card-top">
<span class="neuron-id">${n.id}</span>
<span class="neuron-type">Layer ${n.layer} · ${n.type}</span>
</div>
<div class="neuron-role">${n.role}</div>
</div>
`).join('');
}
function updateTraceView(interv, baselineInterv) {
const tokDelta = baselineInterv && interv !== baselineInterv
? ` (${Math.round(((interv.think_tokens - baselineInterv.think_tokens) / baselineInterv.think_tokens) * 100)}%)`
: '';
const kpiTok = document.getElementById('kpiTokens');
kpiTok.textContent = `${interv.think_tokens}${tokDelta}`;
kpiTok.className = 'kpi-val ' + (interv.think_tokens < baselineInterv.think_tokens ? 'good' : (interv.think_tokens > baselineInterv.think_tokens ? 'warn' : ''));
document.getElementById('kpiLatency').textContent = `${interv.latency_sec}s`;
const kpiLoops = document.getElementById('kpiLoops');
kpiLoops.textContent = interv.doubt_loops;
kpiLoops.className = 'kpi-val ' + (interv.doubt_loops === 0 ? 'good' : 'warn');
document.getElementById('kpiAccuracy').textContent = interv.accuracy;
// Render token ribbon
const stream = document.getElementById('tokenStream');
let defaultNote = 'Hover over any highlighted token above to inspect its exact neuron firing intensity and gate state.';
stream.innerHTML = interv.trace_tokens.map((tk, i) => {
const d = tk.doubt || 0;
const g = tk.gate || 0.5;
let bg = 'transparent';
let border = 'transparent';
if (d > 0.55) {
const alpha = Math.min(0.45, (d - 0.3) * 0.55).toFixed(2);
bg = `rgba(217, 78, 52, ${alpha})`;
border = 'var(--accent-terracotta)';
if (tk.note && defaultNote.startsWith('Hover')) defaultNote = tk.note;
} else if (g > 0.85) {
const alpha = Math.min(0.32, (g - 0.7) * 0.85).toFixed(2);
bg = `rgba(13, 138, 114, ${alpha})`;
border = 'var(--accent-teal)';
}
const safeNote = (tk.note || `Token '${tk.t.trim()}' · Doubt Neuron L1.N115=${d.toFixed(2)} · Global Gate L29.H07 σ=${g.toFixed(2)} · Termination=${(tk.term||0).toFixed(2)}`).replace(/"/g, '"');
return `<span class="tok-pill" style="background:${bg}; border-bottom-color:${border};" onmouseenter="showTokenNote("${safeNote}")">${escapeHtml(tk.t)}</span>`;
}).join('');
document.getElementById('tokenNoteText').textContent = defaultNote;
document.getElementById('outputCardTitle').textContent = interv.label;
document.getElementById('outputCardBody').textContent = interv.final_output;
}
function showTokenNote(note) {
document.getElementById('tokenNoteText').textContent = note;
}
function onAlphaSlide(val) {
const v = parseFloat(val);
document.getElementById('alphaValDisplay').textContent = `α = ${v >= 0 ? '+' : ''}${v.toFixed(2)}`;
if (v <= -0.3) selectMode('clamped');
else if (v >= 0.5) selectMode('amplified');
else selectMode('baseline');
document.getElementById('alphaSlider').value = v;
document.getElementById('alphaValDisplay').textContent = `α = ${v >= 0 ? '+' : ''}${v.toFixed(2)}`;
}
async function runLiveBeamProbe() {
const btn = document.getElementById('runLiveBtn');
const prompt = document.getElementById('promptInput').value.trim();
const alpha = parseFloat(document.getElementById('alphaSlider').value);
const exp = APP_DATA.experiments[ACTIVE_EXP_IDX];
btn.disabled = true;
btn.innerHTML = '<span>⏳</span> Probing Reflection Beam-1.0-501B-A23B Live...';
try {
const res = await fetch('/api/live-probe', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
prompt,
alpha,
intervention_mode: exp.id
})
});
const data = await res.json();
document.getElementById('liveBadge').textContent = data.live_api
? '● Live reflection/Beam-1.0-501B-A23B Response'
: '● Safetensors Verified Trace';
updateTraceView({
label: `Live Probe Output (α = ${alpha >= 0 ? '+' : ''}${alpha.toFixed(2)} · ${data.model})`,
think_tokens: data.think_tokens,
latency_sec: data.latency_sec,
doubt_loops: data.doubt_loops,
accuracy: data.live_api ? 'Live Steered Inference' : 'Verified Trace',
trace_tokens: data.trace_tokens,
final_output: data.final_output
}, exp.interventions.baseline);
} catch (e) {
console.error(e);
} finally {
btn.disabled = false;
btn.innerHTML = '<span>▶</span> Run Live Steered Probe on Beam-1.0-501B API';
}
}
/* ==========================================================================
CHART 1: 1/sqrt(k) Residual Decay vs 94x Post-FFN RMSNorm Inversion
========================================================================== */
function drawResidualChart(layers) {
const svg = document.getElementById('svgResidualChart');
const W = 560, H = 240, padL = 42, padR = 42, padT = 20, padB = 34;
const plotW = W - padL - padR;
const plotH = H - padT - padB;
const maxNorm = 8.0;
let bars = '';
let linePts = [];
layers.forEach((ly, i) => {
const x = padL + (i / 51) * plotW;
const barW = Math.max(4, (plotW / 52) - 2);
const normH = (ly.post_ffn_ln_rms / maxNorm) * plotH;
const yBar = padT + plotH - normH;
const isGlobal = ly.attn_type === 'full_attention_nope';
const color = isGlobal ? 'var(--accent-terracotta)' : 'var(--accent-cobalt)';
bars += `<rect x="${x - barW/2}" y="${yBar}" width="${barW}" height="${normH}" rx="2" fill="${color}" opacity="${isGlobal ? 0.92 : 0.65}"
onmouseenter="inspectResidualLayer(${i})" style="cursor:pointer;" />`;
// 1/sqrt(k) curve scaled to plotH (max 1.0)
const yRes = padT + plotH - (ly.residual_scale_mlp * plotH);
linePts.push(`${x.toFixed(1)},${yRes.toFixed(1)}`);
});
svg.innerHTML = `
<line x1="${padL}" y1="${padT + plotH}" x2="${W - padR}" y2="${padT + plotH}" stroke="var(--border-strong)" stroke-width="1" />
<text x="${padL - 8}" y="${padT + 10}" text-anchor="end" fill="var(--accent-cobalt)" font-family="JetBrains Mono" font-size="10">7.54</text>
<text x="${padL - 8}" y="${padT + plotH}" text-anchor="end" fill="var(--text-muted)" font-family="JetBrains Mono" font-size="10">0.0</text>
<text x="${W - padR + 6}" y="${padT + 12}" text-anchor="start" fill="var(--accent-teal)" font-family="JetBrains Mono" font-size="10">1/√k=1.0</text>
<text x="${W - padR + 6}" y="${padT + plotH}" text-anchor="start" fill="var(--accent-teal)" font-family="JetBrains Mono" font-size="10">0.098</text>
${bars}
<polyline fill="none" stroke="var(--accent-teal)" stroke-width="2.5" stroke-dasharray="4 3" points="${linePts.join(' ')}" />
<text x="${padL}" y="${H - 8}" fill="var(--text-muted)" font-family="JetBrains Mono" font-size="10">L00 (Dense · RMS=0.08)</text>
<text x="${W/2}" y="${H - 8}" text-anchor="middle" fill="var(--text-muted)" font-family="JetBrains Mono" font-size="10">Layer Depth (0 → 51) · Terracotta = 9 Global NoPE Layers</text>
<text x="${W - padR}" y="${H - 8}" text-anchor="end" fill="var(--text-muted)" font-family="JetBrains Mono" font-size="10">L51 (RMS=7.54 · 94×)</text>
`;
}
function inspectResidualLayer(idx) {
const ly = APP_DATA.telemetry.layers[idx];
document.getElementById('resInspectorBar').innerHTML =
`<strong>Layer ${ly.layer}</strong> (${ly.attn_type === 'full_attention_nope' ? 'Global NoPE' : 'Sliding 512'}) · ` +
`<code>1/√k = ${ly.residual_scale_mlp}</code> · ` +
`<code>post_ffn_ln RMS = ${ly.post_ffn_ln_rms}</code> · ` +
`<code>post_attn_ln RMS = ${ly.post_attn_ln_rms}</code>`;
}
/* ==========================================================================
CHART 2: 52-Layer x 48-Head Sigmoid Attention Gate Matrix
========================================================================== */
function drawGateMatrix(layers) {
const canvas = document.getElementById('gateCanvas');
const ctx = canvas.getContext('2d');
const W = canvas.width, H = canvas.height;
ctx.clearRect(0, 0, W, H);
const cellW = W / 52;
const cellH = H / 48;
layers.forEach((ly, lIdx) => {
const isGlobal = ly.attn_type === 'full_attention_nope';
ly.gate_bias_heads.forEach((bias, hIdx) => {
// Map bias from [-12, +0.2] to normalized intensity [0, 1]
const norm = Math.max(0, Math.min(1, (bias + 6.5) / 6.7));
if (isGlobal) {
// Warm terracotta/gold highlight for the 9 Global NoPE layers
const r = Math.round(45 + norm * 195);
const g = Math.round(35 + norm * 115);
const b = Math.round(30 + norm * 35);
ctx.fillStyle = `rgb(${r},${g},${b})`;
} else {
// Deep slate to emerald/teal for Sliding Window layers
const r = Math.round(22 + norm * 30);
const g = Math.round(28 + norm * 165);
const b = Math.round(38 + norm * 145);
ctx.fillStyle = `rgb(${r},${g},${b})`;
}
ctx.fillRect(lIdx * cellW, hIdx * cellH, Math.ceil(cellW - 0.5), Math.ceil(cellH - 0.5));
});
});
canvas.onmousemove = (e) => {
const rect = canvas.getBoundingClientRect();
const lIdx = Math.min(51, Math.max(0, Math.floor(((e.clientX - rect.left) / rect.width) * 52)));
const hIdx = Math.min(47, Math.max(0, Math.floor(((e.clientY - rect.top) / rect.height) * 48)));
const ly = layers[lIdx];
const bias = ly.gate_bias_heads[hIdx];
const sig = ly.gate_sigmoid_heads[hIdx];
document.getElementById('gateInspectorBar').innerHTML =
`<strong>L${lIdx}.H${hIdx < 10 ? '0'+hIdx : hIdx}</strong> ` +
`[${ly.attn_type === 'full_attention_nope' ? 'GLOBAL NoPE LAYER' : 'Sliding 512'}] · ` +
`Learned <code>gate_bias = ${bias >= 0 ? '+' : ''}${bias}</code> · ` +
`Base Sigmoid <code>σ(b) = ${(sig * 100).toFixed(2)}%</code> · ` +
`Layer Mean Bias: <code>${ly.gate_bias_mean}</code>`;
};
}
/* ==========================================================================
CHART 3: Dense Bottleneck SwiGLU Neurons (Layers 0-2)
========================================================================== */
function renderDenseNeurons(denseList) {
const el = document.getElementById('denseNeuronTable');
el.innerHTML = denseList.map(d => {
const top = d.top_neurons.slice(0, 3);
return `
<div style="padding:12px 14px; border-radius:12px; background:var(--bg-subtle); border:1px solid var(--border-hairline);">
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:6px;">
<strong class="mono" style="font-size:13px;">Dense Layer ${d.layer} (20,480 Shared SwiGLU Neurons)</strong>
<span class="mono" style="font-size:11.5px; color:var(--text-muted);">cos(gate, up) range: [${d.gate_up_cosine_min}, +${d.gate_up_cosine_max}]</span>
</div>
<div style="display:grid; grid-template-columns:repeat(3, 1fr); gap:8px;">
${top.map(n => `
<div style="background:var(--bg-surface); padding:8px 10px; border-radius:8px; border:1px solid var(--border-hairline); font-family:'JetBrains Mono',monospace; font-size:11.5px;">
<div style="font-weight:700; color:var(--accent-terracotta);">${n.neuron_id}</div>
<div>L2 Strength: <strong>${n.strength}</strong></div>
<div style="color:${n.gate_up_cosine > 0.2 ? 'var(--accent-teal)' : 'var(--text-muted)'};">cos(g,u): ${n.gate_up_cosine >= 0 ? '+' : ''}${n.gate_up_cosine}</div>
</div>
`).join('')}
</div>
</div>
`;
}).join('');
}
/* ==========================================================================
CHART 4: MoE Router e_score_correction_bias Explorer
========================================================================== */
function initMoESelector(layers) {
const sel = document.getElementById('moeLayerSelect');
sel.innerHTML = layers.filter(l => l.layer >= 3).map(l =>
`<option value="${l.layer}" ${l.layer === 29 ? 'selected' : ''}>Layer ${l.layer} (${l.attn_type === 'full_attention_nope' ? 'Global NoPE + MoE' : 'Sliding + MoE'})</option>`
).join('');
renderMoERouter(29);
}
function renderMoERouter(layerNum) {
const ly = APP_DATA.telemetry.layers[parseInt(layerNum, 10)];
const r = ly.moe_router;
const svg = document.getElementById('svgMoeGroups');
const W = 520, H = 135;
const biases = r.all_256_biases;
const minB = Math.min(...biases), maxB = Math.max(...biases);
const range = Math.max(0.05, maxB - minB);
let rects = '';
biases.forEach((b, idx) => {
const x = 10 + (idx / 256) * (W - 20);
const norm = (b - minB) / range;
const h = 12 + norm * 85;
const y = H - 24 - h;
const grp = Math.floor(idx / 32);
const color = grp % 2 === 0 ? 'var(--accent-cobalt)' : 'var(--accent-teal)';
rects += `<rect x="${x.toFixed(1)}" y="${y.toFixed(1)}" width="1.6" height="${h.toFixed(1)}" fill="${color}" opacity="0.85" />`;
});
svg.innerHTML = `
${rects}
<text x="10" y="${H - 6}" fill="var(--text-muted)" font-family="JetBrains Mono" font-size="10">Expert 0 (Group 0) · 8 Routing Groups of 32 Experts</text>
<text x="${W - 10}" y="${H - 6}" text-anchor="end" fill="var(--text-muted)" font-family="JetBrains Mono" font-size="10">Expert 255 (Group 7)</text>
`;
const topE = r.most_favored_experts[0];
const botE = r.most_suppressed_experts[0];
document.getElementById('moeSummaryBar').innerHTML =
`Most Favored Expert: <strong>L${ly.layer}.E${topE.expert_id}</strong> (Group ${topE.group}, bias <code>+${topE.bias}</code>) · ` +
`Most Suppressed: <strong>L${ly.layer}.E${botE.expert_id}</strong> (Group ${botE.group}, bias <code>${botE.bias}</code>)`;
}
function renderTrn2Blueprint(bp) {
document.getElementById('trn2Reasons').innerHTML = bp.why_no_gpu_needed.map(item => `
<div style="padding:12px 14px; border-radius:10px; background:var(--bg-subtle); border:1px solid var(--border-hairline);">
<div style="font-weight:700; font-size:13.5px; color:var(--text-primary); margin-bottom:4px;">✦ ${item.metric}</div>
<div style="font-size:13px; color:var(--text-secondary); line-height:1.5;">${item.detail}</div>
</div>
`).join('');
document.getElementById('nkiCodeBlock').textContent = bp.nki_kernel_code;
}
function escapeHtml(s) {
return s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
}
window.addEventListener('DOMContentLoaded', initApp);
</script>
</body>
</html>
<html lang="en" data-theme="editorial">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>BeamScope — Sub-Expert Neuron & Attention-Gate Surgery for Beam-1.0-501B</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Plus+Jakarta+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
<style>
/* ==========================================================================
ANTHROPIC TRANSFORMER-CIRCUITS / REFLECTION EDITORIAL DESIGN SYSTEM
Default: Warm Editorial Paper (#FBF9F5) + 1-Click Carbon Studio Toggle
========================================================================== */
:root, [data-theme="editorial"] {
--bg-canvas: #FAF8F4;
--bg-surface: #FFFFFF;
--bg-subtle: #F3EFE8;
--bg-elevated: #FDFCFA;
--bg-code: #161615;
--text-primary: #141413;
--text-secondary: #4D4B46;
--text-muted: #7C7870;
--border-hairline: #E6E1D8;
--border-strong: #CFC8BC;
--accent-terracotta: #D94E34;
--accent-terracotta-soft: rgba(217, 78, 52, 0.10);
--accent-terracotta-border: rgba(217, 78, 52, 0.32);
--accent-teal: #0D8A72;
--accent-teal-soft: rgba(13, 138, 114, 0.10);
--accent-teal-border: rgba(13, 138, 114, 0.32);
--accent-cobalt: #2356D8;
--accent-cobalt-soft: rgba(35, 86, 216, 0.09);
--accent-amber: #C87A19;
--accent-amber-soft: rgba(200, 122, 25, 0.11);
--shadow-card: 0 1px 3px rgba(20, 20, 19, 0.04), 0 8px 24px -6px rgba(20, 20, 19, 0.05);
--shadow-hover: 0 4px 12px rgba(20, 20, 19, 0.07), 0 16px 32px -8px rgba(20, 20, 19, 0.08);
}
[data-theme="carbon"] {
--bg-canvas: #0D0E11;
--bg-surface: #14161B;
--bg-subtle: #1B1E25;
--bg-elevated: #181B22;
--bg-code: #090A0C;
--text-primary: #F3F2EE;
--text-secondary: #B4B1A8;
--text-muted: #78756E;
--border-hairline: #252830;
--border-strong: #373B47;
--accent-terracotta: #F06449;
--accent-terracotta-soft: rgba(240, 100, 73, 0.14);
--accent-terracotta-border: rgba(240, 100, 73, 0.40);
--accent-teal: #14B897;
--accent-teal-soft: rgba(20, 184, 151, 0.14);
--accent-teal-border: rgba(20, 184, 151, 0.40);
--accent-cobalt: #5B8AF5;
--accent-cobalt-soft: rgba(91, 138, 245, 0.14);
--accent-amber: #F59E0B;
--accent-amber-soft: rgba(245, 158, 11, 0.14);
--shadow-card: 0 2px 8px rgba(0, 0, 0, 0.35);
--shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.50);
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html, body {
background-color: var(--bg-canvas);
color: var(--text-primary);
font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
font-size: 15px;
line-height: 1.6;
-webkit-font-smoothing: antialiased;
transition: background-color 0.2s ease, color 0.2s ease;
}
.serif {
font-family: 'Instrument Serif', Georgia, serif;
font-weight: 400;
}
.mono {
font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
font-feature-settings: "tnum" on, "zero" on;
}
/* Top Navigation Bar */
.navbar {
position: sticky;
top: 0;
z-index: 100;
background: color-mix(in srgb, var(--bg-canvas) 88%, transparent);
backdrop-filter: blur(14px);
-webkit-backdrop-filter: blur(14px);
border-bottom: 1px solid var(--border-hairline);
}