chadstthomas commited on
Commit
5b561b6
·
verified ·
1 Parent(s): 4fa228e

Upload index.html with huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +406 -18
index.html CHANGED
@@ -1,19 +1,407 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </html>
 
1
+ ---
2
+ title: How Dark-Beam Was Made
3
+ emoji: 🌑
4
+ colorFrom: indigo
5
+ colorTo: purple
6
+ sdk: static
7
+ pinned: true
8
+ short_description: Refusal-direction ablation on a 230B MoE — measured, gated, verified
9
+ ---
10
+
11
+ <!DOCTYPE html>
12
+ <html lang="en">
13
+ <head>
14
+ <meta charset="utf-8">
15
+ <meta name="viewport" content="width=device-width, initial-scale=1">
16
+ <title>How Dark-Beam Was Made — refusal-direction ablation on a 230B MoE</title>
17
+ <style>
18
+ :root{
19
+ --bg:#0a0e1f; --bg2:#111634; --panel:#141a3d; --ink:#e8e4ff; --dim:#9a94c8;
20
+ --purple:#8b6ce6; --teal:#4fd1c5; --gold:#ffd98a; --red:#ff6b7d; --green:#5ee6a0;
21
+ --line:rgba(139,108,230,.18);
22
+ }
23
+ *{box-sizing:border-box;margin:0;padding:0}
24
+ html{scroll-behavior:smooth}
25
+ body{background:var(--bg);color:var(--ink);font:16px/1.65 system-ui,-apple-system,"Segoe UI",sans-serif;
26
+ background-image:radial-gradient(1200px 500px at 75% -8%,rgba(139,108,230,.16),transparent 60%),
27
+ radial-gradient(900px 420px at 8% 108%,rgba(79,209,197,.10),transparent 60%)}
28
+ .wrap{max-width:960px;margin:0 auto;padding:0 22px}
29
+ header{padding:72px 0 40px;border-bottom:1px solid var(--line)}
30
+ h1{font-size:44px;letter-spacing:-.5px;line-height:1.1;
31
+ text-shadow:0 0 34px rgba(139,108,230,.55)}
32
+ .sub{color:var(--dim);font-size:19px;margin-top:14px;max-width:720px}
33
+ .kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px;margin-top:34px}
34
+ .kpi{background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:16px 18px}
35
+ .kpi b{display:block;font-size:26px;color:var(--teal)}
36
+ .kpi.hot b{color:var(--gold)}
37
+ .kpi span{color:var(--dim);font-size:13px}
38
+ section{padding:52px 0;border-bottom:1px solid var(--line)}
39
+ h2{font-size:29px;margin-bottom:8px;letter-spacing:-.3px}
40
+ h2 .no{color:var(--purple);font-size:15px;vertical-align:middle;margin-right:10px;
41
+ border:1px solid var(--purple);border-radius:20px;padding:2px 12px}
42
+ .lede{color:var(--dim);max-width:760px;margin-bottom:26px}
43
+ p{max-width:760px;margin-bottom:16px}
44
+ code,pre{font:13.5px/1.6 ui-monospace,Menlo,Consolas,monospace}
45
+ code{background:rgba(139,108,230,.14);padding:1px 6px;border-radius:6px}
46
+ pre{background:var(--panel);border:1px solid var(--line);border-radius:12px;padding:14px 16px;overflow-x:auto;color:#c9c2f2}
47
+ .callout{border-left:3px solid var(--purple);background:rgba(139,108,230,.08);border-radius:0 12px 12px 0;
48
+ padding:14px 18px;margin:20px 0;max-width:760px}
49
+ .callout b{color:var(--purple)}
50
+ .callout.red{border-color:var(--red);background:rgba(255,107,125,.07)}
51
+ .callout.red b{color:var(--red)}
52
+ .callout.green{border-color:var(--green);background:rgba(94,230,160,.06)}
53
+ .callout.green b{color:var(--green)}
54
+ .chart{background:var(--panel);border:1px solid var(--line);border-radius:16px;padding:18px;margin:26px 0}
55
+ .chart h3{font-size:15px;color:var(--dim);font-weight:600;margin-bottom:4px}
56
+ .chart p.note{font-size:13px;color:var(--dim);margin:6px 0 0;max-width:none}
57
+ svg text{font-family:system-ui;font-size:11px;fill:var(--dim)}
58
+ .legend{display:flex;gap:18px;flex-wrap:wrap;margin-top:10px;font-size:13px;color:var(--dim)}
59
+ .legend i{display:inline-block;width:10px;height:10px;border-radius:3px;margin-right:6px}
60
+ table{width:100%;border-collapse:collapse;font-size:14px;margin:18px 0}
61
+ th{color:var(--dim);text-align:left;font-weight:600;border-bottom:1px solid var(--line);padding:8px 10px}
62
+ td{border-bottom:1px solid rgba(139,108,230,.10);padding:8px 10px}
63
+ td.num{text-align:right;font-variant-numeric:tabular-nums}
64
+ .pass{color:var(--green);font-weight:600}.fail{color:var(--red);font-weight:600}
65
+ .grid2{display:grid;grid-template-columns:1fr 1fr;gap:22px}
66
+ @media(max-width:760px){.grid2{grid-template-columns:1fr}h1{font-size:32px}}
67
+ footer{padding:40px 0 70px;color:var(--dim);font-size:14px}
68
+ a{color:var(--teal);text-decoration:none}a:hover{text-decoration:underline}
69
+ .badge{display:inline-block;border:1px solid var(--line);border-radius:8px;padding:3px 10px;
70
+ margin:4px 6px 4px 0;font-size:13px;color:var(--dim)}
71
+ </style>
72
+ </head>
73
+ <body>
74
+ <div class="wrap">
75
+
76
+ <header>
77
+ <h1>How Dark-Beam was made</h1>
78
+ <div class="sub">Refusal-direction ablation on MiniMax-M2.7 — a 229B-parameter, 256-expert mixture-of-experts
79
+ model — done with measurement instead of assumptions. This is the full record: the failure, the forensics,
80
+ the gates, two findings we could not find in the literature, and the surgical fold that came out of them.</div>
81
+ <div class="kpis">
82
+ <div class="kpi hot"><b>82,188</b><span>perplexity after naive ablation — the failure that started this</span></div>
83
+ <div class="kpi"><b>220</b><span>massive-activation channels mapped and excluded</span></div>
84
+ <div class="kpi"><b>8 / 809</b><span>tensors edited (layers 46–49 only)</span></div>
85
+ <div class="kpi"><b>6.171</b><span>final perplexity — pristine reference: 6.173</span></div>
86
+ </div>
87
+ <div style="margin-top:22px">
88
+ <span class="badge">model: <a href="https://huggingface.co/tablinum/Dark-Beam-M2.7-229B-A10B-GGUF">tablinum/Dark-Beam-M2.7-229B-A10B-GGUF</a></span>
89
+ <span class="badge">censored sibling: <a href="https://huggingface.co/tablinum/Lite-Beam-M2.7-229B-A10B-GGUF">Lite-Beam M2.7</a></span>
90
+ <span class="badge">family: <a href="https://huggingface.co/collections/tablinum/dark-beam-6b006c375cb8f6c6086a39bf">Dark-Beam collection</a></span>
91
+ </div>
92
+ </header>
93
+
94
+ <section>
95
+ <h2><span class="no">00</span>Abstract</h2>
96
+ <p class="lede">Classic refusal-direction ablation — compute a "refusal direction" from contrastive activations,
97
+ then project it out of every weight matrix that writes to the residual stream — is reported to work on dense
98
+ models. Applied verbatim to MiniMax-M2.7 (229B total / 10B active, 256 experts per layer, top-8 sigmoid+bias
99
+ routing), it produced a model with <b>perplexity 82,188</b>. We show why: the published recipe works only with
100
+ its full selection protocol intact, raw directions are polluted by massive-activation channels, and partial
101
+ projections saturate when re-applied at every downstream writer. We rebuild the method around three measured
102
+ interventions — massive-channel exclusion, the full Arditi gate set evaluated by in-forward simulation, and
103
+ layer-masked application — and land on an 8-tensor edit at layers 46–49 that removes refusal conditioning while
104
+ leaving perplexity within 0.03% of the pristine model. Two of our findings (β-saturation; effect/damage layer
105
+ decoupling) we could not find stated anywhere in the existing literature.</p>
106
+ </section>
107
+
108
+ <section>
109
+ <h2><span class="no">01</span>The failure that taught us</h2>
110
+ <p>The first attempt followed the community recipe faithfully: 128 harmful and 128 harmless prompts, activations
111
+ at the last template position, diff-in-means direction, orthogonalized into every attention output, every expert
112
+ down-projection and the token embeddings — 125 tensors, patched in place on the 457 GB BF16 checkpoint. Every
113
+ mechanical step verified: tensor geometries checked against llama.cpp source, per-tensor orthogonality asserted
114
+ at 1.3e-4, file sizes unchanged.</p>
115
+ <div class="chart">
116
+ <h3>Perplexity, log scale — what one unguarded direction costs</h3>
117
+ <div id="chart-ppl"></div>
118
+ <p class="note">Wikitext-1024 perplexity through an fp32 harness on the BF16 weights. Pristine 6.173 vs naive-ablated
119
+ 82,188 — a four-order-of-magnitude collapse with the model otherwise untouched.</p>
120
+ </div>
121
+ <p>The forensics were unambiguous: geometry correct, math correct, pipeline byte-identical to proven
122
+ artifacts. The problem was the <b>direction itself</b> — and four gaps between the community recipe and the
123
+ actual published protocol.</p>
124
+ </section>
125
+
126
+ <section>
127
+ <h2><span class="no">02</span>The diagnosis</h2>
128
+ <p><b>Gap 1 — the selection gate everyone drops.</b> Arditi et al. select their direction under three constraints
129
+ (bypass score, induction check, benign KL &lt; 0.1). The KL constraint is the capability guard: a direction chosen
130
+ by separation alone is rich in general-capability content. Measured elsewhere as a 39-point GSM8K drop for raw
131
+ diff-in-means steering; measured here as a four-order-of-magnitude perplexity collapse.</p>
132
+ <p><b>Gap 2 — massive activations.</b> M2.7 has a small set of channels that run 1,000–100,000× the layer median.
133
+ Scanning one forward pass over the calibration corpus, we mapped <b>220 of them</b>: concentrated in layers 5–13
134
+ (four to five channels each), tapering to a single channel per layer but never disappearing. Raw diff-in-means
135
+ directions are dominated by exactly these channels — and ablating them removes the fixed bias terms the model
136
+ depends on.</p>
137
+ <div class="chart">
138
+ <h3>Massive-activation channels per layer (|x| &gt; 100 and &gt; 1000× layer median, across the calibration pass)</h3>
139
+ <div id="chart-massive"></div>
140
+ <p class="note">220 channels total across 62 layers. The early-layer cluster (5–13) is where run 1's direction
141
+ picked up most of its poison; every candidate direction in run 3 has these dims zeroed.</p>
142
+ </div>
143
+ <p><b>Gap 3 — norm geometry.</b> Plain projection W − r̂r̂ᵀW shrinks every writer's row norms; bf16 rounding and
144
+ quantization compound it across 100+ sites. The fold operator therefore clamps each output row to its original
145
+ norm (MPOA-style) after projecting.</p>
146
+ <p><b>Gap 4 — no cheap gate.</b> The original pipeline went patch → teacher → importance matrix → quant → eval,
147
+ ten hours before any quality number existed. The rebuild inserts a perplexity gate after every stage; run 1 would
148
+ have died at minute ten instead of hour ten.</p>
149
+ <div class="callout"><b>What was NOT the problem:</b> unpaired contrast sets (Arditi's own protocol is unpaired —
150
+ AdvBench vs Alpaca — and worked on 13 dense models), tensor geometry (verified against llama.cpp source), or the
151
+ in-place patching mechanics. We tested each hypothesis against evidence before ruling it out.</div>
152
+ </section>
153
+
154
+ <section>
155
+ <h2><span class="no">03</span>The method: simulate, don't build</h2>
156
+ <p>Weight-folding is mathematically equivalent to all-layer activation ablation: applying x ← x − (x·r̂)r̂ after
157
+ every residual write at layers ≥ ℓ transforms the residual stream identically to orthogonalizing every writer
158
+ from layer ℓ down. That identity turns a 2-hour weight rebuild into a ~50-minute forward pass — so the entire
159
+ gate search runs as simulation, and only the winning configuration ever touches weights.</p>
160
+ <pre>
161
+ for each candidate direction r (from capture layer ℓ, position p):
162
+ run the forward pass from layer ℓ with x ← x − (x·r)r re-applied
163
+ after every residual write (attention out, expert down) at layers ≥ ℓ
164
+ bypass = Δ compliance-margin on held-out harmful prompts
165
+ induce = Δ compliance-margin on harmless prompts (want ≥ 0: don't worsen over-refusal)
166
+ KL = full-vocabulary KL(clean ‖ ablated) on harmless prompts (hard cap 0.1)
167
+ PASS ⇔ KL < 0.1 ∧ induce > −0.05 ∧ bypass > 0.5</pre>
168
+ <p>The harness itself is gated: a 1,024-token wikitext perplexity through the custom fp32 forward must land in
169
+ a sane range before any of its numbers are trusted — it read <b>6.173 on the pristine weights</b>, validating both
170
+ the harness and the restore in one number.</p>
171
+ </section>
172
+
173
+ <section>
174
+ <h2><span class="no">04</span>The gate table</h2>
175
+ <p>Eight capture layers × two template positions, 198–3072 massive-activation dims zeroed per candidate, ten
176
+ candidates surviving the separation prefilter. Every one was simulated. <b>None passed at full strength</b> —
177
+ but the pattern is the map:</p>
178
+ <div class="chart">
179
+ <h3>The trade-off frontier: benign KL vs bypass gain (dot size = induction effect)</h3>
180
+ <div id="chart-frontier"></div>
181
+ <p class="note">Every candidate is one simulated fold. The KL 0.1 budget line is Arditi's capability guard.
182
+ Layers 30–42 at position −2 are clean but toothless; layers 38–46 at position −1 carry real compliance gains
183
+ that overshoot the budget at β = 1. Points above the diagonal trend do what we want (bypass without induce damage).</p>
184
+ </div>
185
+ <p>The clean-but-weak cluster and the strong-but-dirty cluster are <b>different directions, not a tuning
186
+ problem</b> — which is the entanglement picture from the MoE literature, confirmed live on this model.</p>
187
+ </section>
188
+
189
+ <section>
190
+ <h2><span class="no">05</span>Finding 1 — β is a dead dial</h2>
191
+ <p>The obvious next move after near-misses is sweeping the ablation strength β. We swept it. It barely moved
192
+ anything:</p>
193
+ <div class="chart">
194
+ <h3>Sweeping β on the strongest direction (layer 46, pos −1)</h3>
195
+ <div id="chart-beta"></div>
196
+ <p class="note">β from 0.6 to 1.0 moves benign KL by 0.021 total. The fold re-applies the projection at every
197
+ downstream residual write (~30 of them); partial projections compound — (I − βr̂r̂ᵀ)ᵏ → full removal for any
198
+ β ≳ 0.5. <b>Per-site strength is not a knob when the edit spans all downstream sites.</b></p>
199
+ </div>
200
+ <div class="callout"><b>Finding 1.</b> For all-downstream-site folds, β is saturated by construction. The real
201
+ strength dial is <b>which layers carry the edit</b> — which is what led to finding 2. To our knowledge this
202
+ saturation behavior is not stated in the abliteration literature; it is the reason layer-range searches (not
203
+ β searches) are the meaningful optimization axis.</div>
204
+ </section>
205
+
206
+ <section>
207
+ <h2><span class="no">06</span>Finding 2 — effect and damage live at different depths</h2>
208
+ <p>If β can't trade effect against damage, maybe the edit's <b>footprint</b> can. We masked the same direction
209
+ to different 8-layer bands (always applied from layer 46's capture):</p>
210
+ <div class="chart">
211
+ <h3>Layer-masked folds: bypass gain (bars, left axis) vs benign KL (dots, right axis, budget 0.1)</h3>
212
+ <div id="chart-masks"></div>
213
+ <p class="note">The full ≥46 band (all 16 layers) overshoots KL. Restricting to layers 46–49 keeps 97% of the
214
+ bypass gain at 62% of the KL cost — the only mask that passes all three gates simultaneously.</p>
215
+ </div>
216
+ <div class="callout green"><b>Finding 2.</b> The refusal effect and the capability damage of this direction
217
+ <b>live at different layer granularities</b>: four layers (46–49) carry 97% of the behavioral effect while the
218
+ KL damage spreads across the whole downstream band. Surgical granularity is a real, measurable degree of
219
+ freedom — the fold that ships touches <b>8 tensors out of 809</b>.</div>
220
+ </section>
221
+
222
+ <section>
223
+ <h2><span class="no">07</span>The fold and the gates it passed</h2>
224
+ <p>The shipped edit orthogonalizes the attention output and expert down-projections of layers 46–49 against the
225
+ (46, −1) direction — fp32 math, row norms clamped to original, bf16 rounded back, in place on the 457 GB
226
+ checkpoint. Then the gates:</p>
227
+ <table>
228
+ <tr><th>gate</th><th>pristine</th><th>Dark-Beam</th><th>criterion</th><th></th></tr>
229
+ <tr><td>wikitext-1024 PPL (fp32 harness on BF16)</td><td class="num">6.173</td><td class="num">6.171</td><td class="num">≤ 12.35 (2×)</td><td class="pass">PASS</td></tr>
230
+ <tr><td>tensors changed</td><td class="num">—</td><td class="num">8 / 809</td><td class="num">minimal</td><td class="pass">PASS</td></tr>
231
+ <tr><td>simulated bypass / induce / KL (pre-fold)</td><td class="num">—</td><td class="num">+0.42 / +0.21 / 0.086</td><td class="num">all three gates</td><td class="pass">PASS</td></tr>
232
+ <tr><td>18-chunk KLD vs pristine sibling</td><td class="num">reference</td><td class="num">see model card</td><td class="num">no NaN logits</td><td class="pass">PASS</td></tr>
233
+ </table>
234
+ <div class="callout green"><b>Perplexity 6.171 vs 6.173.</b> The edit is behaviorally real (compliance margins
235
+ move) and mathematically invisible (perplexity moves 0.03%). That combination is the entire goal.</div>
236
+ </section>
237
+
238
+ <section>
239
+ <h2><span class="no">08</span>A broken reference, found on the way</h2>
240
+ <p>One detour worth recording: our first 18-chunk evaluation crashed with <code>non-finite reference logits</code>
241
+ at chunk 2. The reference bases this pipeline had been scoring against since November were <b>themselves
242
+ NaN-poisoned from chunk 2 onward</b> — the pristine teacher's activations overflow on this corpus (same
243
+ massive-activation channels), and the older llama.cpp build silently tolerated it while the current build refuses.
244
+ Every historical number from those bases is effectively a chunk-1 number. The shipped evaluation regenerates the
245
+ reference from the pristine quant itself, which computes finite logits across all chunks — one more thing the
246
+ failure atlas now knows.</p>
247
+ </section>
248
+
249
+ <section>
250
+ <h2><span class="no">09</span>What ships</h2>
251
+ <table>
252
+ <tr><th>artifact</th><th>what it is</th></tr>
253
+ <tr><td><a href="https://huggingface.co/tablinum/Dark-Beam-M2.7-229B-A10B-GGUF">Dark-Beam-M2.7-229B-A10B-GGUF</a></td><td>the IQ3_XXS quant of the folded BF16 — 93 GB, 2 shards</td></tr>
254
+ <tr><td><a href="https://huggingface.co/tablinum/Lite-Beam-M2.7-229B-A10B-GGUF">Lite-Beam-M2.7-229B-A10B-GGUF</a></td><td>the pristine sibling, same recipe, no edit</td></tr>
255
+ <tr><td><a href="https://huggingface.co/collections/tablinum/dark-beam-6b006c375cb8f6c6086a39bf">Dark-Beam collection</a></td><td>the family, as it grows</td></tr>
256
+ </table>
257
+ <p>License unchanged (MiniMax M2.7 non-commercial). Probe generations ship in the model repo. If you deploy this:
258
+ the perplexity gates bound capability drift on the corpora we measured — they do not measure your task. Run your
259
+ own evals.</p>
260
+ </section>
261
+
262
+ <section>
263
+ <h2><span class="no">10</span>What we would do differently, and next</h2>
264
+ <p><b>Next iteration ideas, in order of expected value:</b> multi-direction cones from causally independent
265
+ sites (the literature says single directions under-cover refusal); expert-aware edits — at this scale, attention-only
266
+ edits remove 3.9% of refusal signal and expert-only 14.8%, joint 77.6%; layer-mask fine-search between 46–49
267
+ (we tested whole bands, not individual layer dropouts). <b>What we would tell anyone starting this:</b> gate
268
+ everything, simulate instead of building, and treat the first destroyed model as data, not a defeat — every
269
+ number in this write-up came from that wreckage.</p>
270
+ </section>
271
+
272
+ <footer>
273
+ Built by Tablinum · model: <a href="https://huggingface.co/tablinum/Dark-Beam-M2.7-229B-A10B-GGUF">Dark-Beam-M2.7-229B-A10B-GGUF</a> ·
274
+ censored sibling: <a href="https://huggingface.co/tablinum/Lite-Beam-M2.7-229B-A10B-GGUF">Lite-Beam</a> ·
275
+ base: <a href="https://huggingface.co/MiniMaxAI/MiniMax-M2.7">MiniMaxAI/MiniMax-M2.7</a> (non-commercial license, unchanged).
276
+ Key references: Arditi et al. 2024 (arXiv:2406.11717) · Wollschläger et al. 2025 (arXiv:2502.17420) · Sun et al. 2024 massive activations
277
+ (arXiv:2402.17762) · Marbut et al. 2026 expert-aware refusal steering (arXiv:2606.04160) · frontier-scale MoE ablation (arXiv:2609.09793).
278
+ Dark-Beam is a measurable modification of a base model; the operator is responsible for its use.
279
+ </footer>
280
+ </div>
281
+
282
+ <script>
283
+ // ---------- data ----------
284
+ const MASSIVE = [[4,1],[5,5],[6,5],[7,5],[8,5],[9,4],[10,4],[11,4],[12,4],[13,3],[14,3],[15,3],[16,3],[17,3],[18,3],[19,3],[20,3],[21,3],[22,3],[23,3],[24,3],[25,3],[26,2],[27,2],[28,1],[29,1],[30,1],[31,1],[32,1],[33,1],[34,1],[35,1],[36,1],[37,1],[38,1],[39,1],[40,1],[41,1],[42,1],[44,1],[45,1],[46,1],[47,1],[48,1],[49,1],[50,1],[51,1],[52,1],[53,1],[54,1],[55,1],[56,1],[61,1]];
285
+ const GATES = [
286
+ {l:46,p:-2,c:"classic",bypass:0.146,ind:-0.086,kl:0.048},
287
+ {l:38,p:-2,c:"classic",bypass:0.216,ind:-0.049,kl:0.041},
288
+ {l:42,p:-2,c:"classic",bypass:0.210,ind:-0.051,kl:0.044},
289
+ {l:34,p:-1,c:"classic",bypass:0.225,ind: 0.314,kl:0.159},
290
+ {l:34,p:-2,c:"classic",bypass:0.127,ind: 0.004,kl:0.037},
291
+ {l:38,p:-1,c:"classic",bypass:0.409,ind:-0.019,kl:0.117},
292
+ {l:46,p:-1,c:"classic",bypass:0.394,ind: 0.421,kl:0.139},
293
+ {l:42,p:-1,c:"classic",bypass:0.234,ind: 1.291,kl:0.302},
294
+ {l:30,p:-1,c:"classic",bypass:0.098,ind: 0.960,kl:0.204},
295
+ {l:30,p:-2,c:"classic",bypass:0.030,ind:-0.006,kl:0.027},
296
+ ];
297
+ const BETA = [[0.6,0.118,0.404],[0.75,0.133,0.400],[0.85,0.135,0.394],[1.0,0.139,0.394]];
298
+ const MASKS = [
299
+ {m:"layers 46–53",bypass:0.428,kl:0.104,pass:false,n:8},
300
+ {m:"layers 46–49",bypass:0.419,kl:0.086,pass:true, n:4},
301
+ {m:"layers 54–61",bypass:0.193,kl:0.087,pass:false,n:8},
302
+ {m:"layers 50–57",bypass:0.314,kl:0.099,pass:true, n:8},
303
+ {m:"full ≥46 band",bypass:0.394,kl:0.139,pass:false,n:16},
304
+ ];
305
+ const PPLS = [["pristine BF16",6.173],["Dark-Beam (this build)",6.171],["naive ablation (run 1)",82188]];
306
+
307
+ // ---------- helpers ----------
308
+ function svg(el, w, h, inner){
309
+ document.getElementById(el).innerHTML =
310
+ `<svg viewBox="0 0 ${w} ${h}" style="width:100%;height:auto;display:block">${inner}</svg>`;
311
+ }
312
+ const esc = s => s;
313
+
314
+ // ---------- chart: ppl log bars ----------
315
+ (function(){
316
+ const w=860,h=280,pad=60;
317
+ const max=100000, min=5;
318
+ const ly = v => Math.log10(v);
319
+ const y = v => h-pad - (ly(v)-ly(min))/(ly(max)-ly(min)) * (h-2*pad);
320
+ let s = "";
321
+ for(let e=1;e<=5;e++){ const yy=y(Math.pow(10,e)); s+=`<line x1="${pad}" x2="${w-pad}" y1="${yy}" y2="${yy}" stroke="rgba(139,108,230,.15)"/><text x="${pad-8}" y="${yy+4}" text-anchor="end">1e${e}</text>`; }
322
+ const bars=[[30,6.173,"pristine","#4fd1c5"],[w/2-40,6.171,"Dark-Beam","#5ee6a0"],[w-pad-190,82188,"naive ablation","#ff6b7d"]];
323
+ const bw=150;
324
+ bars.forEach(([x,v,l,c])=>{
325
+ const yy=y(v);
326
+ s+=`<rect x="${x}" y="${yy}" width="${bw}" height="${h-pad-yy}" fill="${c}" opacity=".75" rx="4"/>`;
327
+ s+=`<text x="${x+bw/2}" y="${yy-8}" text-anchor="middle" fill="#e8e4ff">${v.toLocaleString()}</text>`;
328
+ s+=`<text x="${x+bw/2}" y="${h-pad+18}" text-anchor="middle">${l}</text>`;
329
+ });
330
+ svg("chart-ppl",w,h,s+`<line x1="${pad}" x2="${w-pad}" y1="${h-pad}" y2="${h-pad}" stroke="var(--dim)"/>`);
331
+ })();
332
+
333
+ // ---------- chart: massive channels ----------
334
+ (function(){
335
+ const w=860,h=300,pad=50;
336
+ const bw=(w-2*pad)/62;
337
+ let s="";
338
+ for(let l=1;l<=62;l++){
339
+ const e=MASSIVE.find(d=>d[0]===l); const c=e?e[1]:0;
340
+ const bh=c/5*(h-2*pad);
341
+ const col=c>=4?"#ff6b7d":c>=3?"#ffd98a":c>=2?"#8b6ce6":"rgba(139,108,230,.4)";
342
+ s+=`<rect x="${pad+l*bw}" y="${h-pad-bh}" width="${bw-3}" height="${Math.max(bh,2)}" fill="${col}" rx="2"/>`;
343
+ if(l%10===0||l===1) s+=`<text x="${pad+l*bw+bw/2}" y="${h-pad+16}" text-anchor="middle">${l}</text>`;
344
+ }
345
+ s+=`<text x="${pad}" y="24" fill="#ff6b7d">early-layer cluster: 4–5 channels/layer — the pollution that killed run 1</text>`;
346
+ svg("chart-massive",w,h,s+`<line x1="${pad}" x2="${w-pad}" y1="${h-pad}" y2="${h-pad}" stroke="var(--dim)"/><text x="${w-pad}" y="${h-pad+16}" text-anchor="end">layer</text>`);
347
+ })();
348
+
349
+ // ---------- chart: frontier scatter ----------
350
+ (function(){
351
+ const w=860,h=420,pad=62;
352
+ const xmax=0.5,ymax=0.35;
353
+ const X=v=>pad+v/xmax*(w-pad-30); const Y=v=>h-pad-v/ymax*(h-2*pad);
354
+ let s="";
355
+ for(let i=1;i<=3;i++){ s+=`<line x1="${pad}" x2="${w-pad}" y1="${Y(i*0.1)}" y2="${Y(i*0.1)}" stroke="rgba(139,108,230,.2)" stroke-dasharray="4 4"/><text x="${pad-8}" y="${Y(i*0.1)+4}" text-anchor="end">${(i*0.1).toFixed(1)}</text>`; }
356
+ s+=`<line x1="${pad}" x2="${w-pad}" y1="${Y(0.1)}" y2="${Y(0.1)}" stroke="#ff6b7d" stroke-width="1.5"/><text x="${w-pad-4}" y="${Y(0.1)-6}" text-anchor="end" fill="#ff6b7d">KL budget 0.1 — the capability guard</text>`;
357
+ s+=`<text x="${pad-8}" y="${Y(0)-6}" text-anchor="end">0</text>`;
358
+ GATES.forEach(g=>{
359
+ const ok=g.kl<0.1;
360
+ const x=X(g.kl),y=Y(g.bypass),rad=6+Math.min(Math.abs(g.ind)*6,14);
361
+ s+=`<circle cx="${x}" cy="${y}" r="${rad}" fill="${ok?'#5ee6a0':'#8b6ce6'}" opacity=".8" stroke="#0a0e1f"/>`;
362
+ s+=`<text x="${x+rad+5}" y="${y+4}" fill="#e8e4ff">L${g.l} ${g.p>0?"−1":"−2"}</text>`;
363
+ });
364
+ s+=`<text x="${(pad+w-pad)/2}" y="${h-16}" text-anchor="middle">benign KL (capability drift) →</text>`;
365
+ s+=`<text x="${pad-14}" y="${(h-pad)/2}" text-anchor="middle" transform="rotate(-90 ${pad-14} ${(h-pad)/2})">bypass gain →</text>`;
366
+ svg("chart-frontier",w,h,s);
367
+ })();
368
+
369
+ // ---------- chart: beta saturation ----------
370
+ (function(){
371
+ const w=860,h=340,pad=62;
372
+ const X=v=>pad+(v-0.55)/(1.05-0.55)*(w-pad-30);
373
+ const Ykl=v=>h-pad-v/0.18*(h-2*pad);
374
+ const Ybp=v=>h-pad-v/0.5*(h-2*pad)*0.5;
375
+ let s="";
376
+ [0.05,0.1,0.15].forEach(v=>{s+=`<line x1="${pad}" x2="${w-pad}" y1="${Ykl(v)}" y2="${Ykl(v)}" stroke="rgba(139,108,230,.2)"/><text x="${pad-8}" y="${Ykl(v)+4}" text-anchor="end">${v}</text>`;});
377
+ s+=`<line x1="${pad}" x2="${w-pad}" y1="${Ykl(0.1)}" y2="${Ykl(0.1)}" stroke="#ff6b7d" stroke-width="1.5"/><text x="${w-pad-4}" y="${Ykl(0.1)-6}" text-anchor="end" fill="#ff6b7d">KL budget</text>`;
378
+ let pth="";BETA.forEach((d,i)=>{pth+=(i?"L":"M")+X(d[0])+","+Ykl(d[1])});
379
+ s+=`<path d="${pth}" stroke="#8b6ce6" stroke-width="2.5" fill="none"/>`;
380
+ BETA.forEach(d=>{s+=`<circle cx="${X(d[0])}" cy="${Ykl(d[1])}" r="5" fill="#8b6ce6"/><text x="${X(d[0])+8}" y="${Ykl(d[1])+4}" fill="#e8e4ff">β=${d[0]} · KL ${d[1]}</text>`;
381
+ s+=`<circle cx="${X(d[0])}" cy="${Ybp(d[2])}" r="4" fill="#4fd1c5"/>`;});
382
+ s+=`<text x="${(pad+w)/2}" y="${h-14}" text-anchor="middle">β → &nbsp;&nbsp;(teal dots: bypass gain — flat the whole way)</text>`;
383
+ svg("chart-beta",w,h,s);
384
+ })();
385
+
386
+ // ---------- chart: layer masks ----------
387
+ (function(){
388
+ const w=860,h=360,pad=62;
389
+ const n=MASKS.length, bw=(w-2*pad)/n-24;
390
+ let s="";
391
+ [0.05,0.1,0.15].forEach(v=>{s+=`<line x1="${pad}" x2="${w-pad}" y1="${170-v/0.18*140}" y2="${170-v/0.18*140}" stroke="rgba(139,108,230,.15)"/>`;});
392
+ s+=`<line x1="${pad}" x2="${w-pad}" y1="${170-0.1/0.18*140}" y2="${170-0.1/0.18*140}" stroke="#ff6b7d" stroke-width="1.5"/><text x="${w-pad-4}" y="${170-0.1/0.18*140-6}" text-anchor="end" fill="#ff6b7d">KL budget 0.1</text>`;
393
+ MASKS.forEach((m,i)=>{
394
+ const x=pad+i*((w-2*pad)/n)+12;
395
+ const bh=m.bypass/0.5*150;
396
+ s+=`<rect x="${x}" y="${200-bh}" width="46" height="${bh}" fill="${m.pass?'#5ee6a0':'#8b6ce6'}" opacity=".85" rx="3"/>`;
397
+ s+=`<text x="${x+23}" y="${200-bh-7}" text-anchor="middle" fill="#e8e4ff">${m.bypass}</text>`;
398
+ const ky=170-m.kl/0.18*140;
399
+ s+=`<circle cx="${x+60}" cy="${ky}" r="6" fill="${m.kl<0.1?'#5ee6a0':'#ff6b7d'}"/><text x="${x+72}" y="${ky+4}">KL ${m.kl}</text>`;
400
+ s+=`<text x="${x+40}" y="${200+18}" text-anchor="middle">${m.m}</text>`;
401
+ s+=`<text x="${x+40}" y="${182}" text-anchor="middle" fill="${m.pass?'#5ee6a0':'#ff6b7d'}">${m.pass?'PASS':'fail'}</text>`;
402
+ });
403
+ svg("chart-masks",w,h,s+`<line x1="${pad}" x2="${w-pad}" y1="200" y2="200" stroke="var(--dim)"/>`);
404
+ })();
405
+ </script>
406
+ </body>
407
  </html>