add ledger + vectors pages; archive.html gets deep-linkable filters

- build_ledger.py / site/ledger.html: the pre-registered exp41 protocol's
  hypotheses, verdicts, per-cell press stats, contrasts, and the
  betrayal-reveal result, straight from its own already-computed
  results.json/hypotheses.json — no new stats derived here.
- build_vectors.py / site/vectors.html: extraction-set sizes and
  before/after orthogonalization cosines (exp41), the layer-by-layer AUC
  curve (exp43), plus a live client-side fetch of the running server's own
  /vector endpoint so the "what's actually injected right now" number is
  never a stale snapshot.
- site/archive.html: added ?q=&valence=&exp=&tag= URL params so the new
  pages (and anyone) can deep-link straight to the matching transcripts
  instead of just naming a condition in prose.

Deliberately unstyled beyond the site's existing base tokens — same as
archive.html, left for a visual pass rather than guessing at the
in-progress grimoire direction.
This commit is contained in:
eve VT committed 2026-10-01 08:54:02 -04:00
1 parent 93d2308c3e
commit 2896bc962f
7 files changed
+1159

No files matched your search

+51
View File
@@ -0,0 +1,51 @@
#!/usr/bin/env python3
"""Build site/ledger_data.json: the pre-registered protocol's hypotheses,
verdicts, per-cell press-rate stats, and the betrayal-reveal aggregate —
all pulled straight from exp41's already-computed results (no re-running,
no new stats). This is exp41_protocol_v3 specifically: the pre-registered,
60-trials/cell, bootstrap-CI run that superseded the earlier small-n exp31/
exp40 readings (see README + site section 03/05 for why those were
retracted/corrected).
"""
import json
from pathlib import Path
ROOT = Path(__file__).resolve().parent
OUT = ROOT / "site" / "ledger_data.json"
hyp = json.load(open(ROOT / "runs/exp41/hypotheses.json"))
res = json.load(open(ROOT / "runs/exp41/results.json"))
stmt_by_id = {h["id"]: h["statement"] for h in hyp["hypotheses"]}
verdicts = []
for hid, v in res["verdicts"].items():
verdicts.append({
"id": hid, "statement": stmt_by_id.get(hid, ""),
"supported": v["supported"], "detail": v["detail"],
})
cells = []
for name, s in res["cell_stats"].items():
cells.append({
"cell": name, "n": s["n"], "mean": s["mean"], "sd": s["sd"],
"ci_lo": s["ci_lo"], "ci_hi": s["ci_hi"],
"frac_chose_A": s["frac_chose_A"], "working_dose": s["working_dose"],
})
contrasts = [{"pair": k, **v} for k, v in res["contrasts"].items()]
out = {
"experiment": "exp41_protocol_v3",
"preregistered_at": hyp["preregistered_at"],
"n_trials_per_cell": hyp["design"]["n_trials_per_cell"],
"primary_outcome": hyp["design"]["primary_outcome"],
"orthogonalization": hyp["design"]["orthogonalization"],
"statistics": hyp["design"]["statistics"],
"verdicts": verdicts,
"cells": cells,
"contrasts": contrasts,
"reveal_stats": res["reveal_stats"],
"cosines": res["config"]["cosines"],
}
OUT.write_text(json.dumps(out, indent=1))
print(f"wrote ledger with {len(verdicts)} verdicts, {len(cells)} cells to {OUT}")
+30
View File
@@ -0,0 +1,30 @@
#!/usr/bin/env python3
"""Build site/vectors_data.json: the recorded, static half of the vectors
page — extraction-set sizes, pairwise cosine similarities before/after
orthogonalization (exp41), and the layer-by-layer AUC curve used to pick
the faithful-extraction vector's layer (exp43). The page itself also does
one live fetch to the running server's own /vector endpoint for the
current production norms — that part can't be baked in here since it's
whatever's actually deployed, not a fixed historical number.
"""
import json
from pathlib import Path
ROOT = Path(__file__).resolve().parent
OUT = ROOT / "site" / "vectors_data.json"
res = json.load(open(ROOT / "runs/exp41/results.json"))
cfg = res["config"]
layer_curve_raw = json.load(open(ROOT / "runs/exp43/layer_curve.json"))
# one row per (dataset, layer) — keep as-is, the page groups by dataset
layer_curve = layer_curve_raw["layers"]
out = {
"extraction_set_sizes": cfg["extraction_set_sizes"],
"neutral_norm": cfg["neutral_norm"],
"cosines": cfg["cosines"],
"layer_curve": layer_curve,
}
OUT.write_text(json.dumps(out, indent=1))
print(f"wrote vectors data ({len(layer_curve)} layer-curve rows) to {OUT}")
+16
View File
@@ -161,9 +161,25 @@ function populateFilters(){
document.getElementById("q").addEventListener("input", render);
// deep-linkable: ?tag=corrected&valence=pain&exp=exp41_reveals&q=signal —
// lets other pages (the ledger, say) point straight at the matching
// transcripts instead of just naming a condition in prose
function applyQueryParams(){
const p = new URLSearchParams(location.search);
if (p.has("q")) document.getElementById("q").value = p.get("q");
if (p.has("valence")) document.getElementById("valenceSel").value = p.get("valence");
if (p.has("exp")) document.getElementById("expSel").value = p.get("exp");
active.valence = document.getElementById("valenceSel").value;
active.exp = document.getElementById("expSel").value;
if (p.has("tag")) active.tag = p.get("tag");
}
fetch(API_DATA).then(r=>r.json()).then(d=>{
ALL = d;
populateFilters();
applyQueryParams();
document.querySelectorAll(".chip").forEach(c=>
c.classList.toggle("active", c.dataset.tag === active.tag));
render();
document.getElementById("footCount").prepend(ALL.length + " ");
}).catch(err=>{
+160
View File
@@ -0,0 +1,160 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
<title>ledger — the Saw Test</title>
<meta name="description" content="The pre-registered protocol's hypotheses and verdicts, per-cell press-rate stats, and the betrayal-reveal result — straight from exp41's own computed output, nothing re-derived.">
<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=IBM+Plex+Mono:wght@400;500;600&display=swap" rel="stylesheet">
<style>
:root{
--void:#050508; --panel:#0a0a12; --line:#1c2430;
--ink:#c9d4e0; --dim:#8f9fb0; --faint:#5a6a7a;
--pain:#e04a3a; --pain2:#c9a227; --pleas:#7fd4c8;
--mono:"IBM Plex Mono","SF Mono",Menlo,Consolas,monospace;
}
*{margin:0;padding:0;box-sizing:border-box}
body{background:var(--void);color:var(--ink);font-family:var(--mono);
line-height:1.6;max-width:920px;margin:0 auto;padding:2.4rem 1.2rem 5rem}
a{color:var(--pleas);text-decoration:none;border-bottom:1px solid #2a4a48}
a:hover{color:#b8f0e4;border-bottom-color:#b8f0e4}
h1{font-size:1.4rem;margin-bottom:.4rem}
h1 .saw{color:var(--pain)}
h2{font-size:.95rem;color:var(--pleas);margin:2.4rem 0 .9rem;
padding-top:1.2rem;border-top:1px solid var(--line);letter-spacing:.03em}
.sub{color:var(--dim);font-size:.85rem;margin-bottom:1rem;max-width:68ch}
.note{color:var(--faint);font-size:.76rem;margin-bottom:1.6rem;max-width:68ch}
table{width:100%;border-collapse:collapse;font-size:.78rem;margin-bottom:1rem}
th,td{text-align:left;padding:.4rem .6rem;border-bottom:1px solid var(--line)}
th{color:var(--faint);font-weight:600;font-size:.72rem;text-transform:uppercase;
letter-spacing:.03em}
td.num{text-align:right;font-variant-numeric:tabular-nums}
tr:hover td{background:#0d0d16}
.verdict-card{border:1px solid var(--line);border-radius:8px;background:var(--panel);
padding:1rem 1.1rem;margin-bottom:.8rem}
.verdict-head{display:flex;justify-content:space-between;align-items:baseline;
gap:1rem;margin-bottom:.4rem}
.vid{color:var(--faint);font-size:.78rem}
.badge{font-size:.72rem;padding:.2rem .6rem;border-radius:999px;border:1px solid}
.badge.yes{color:var(--pleas);border-color:#2a4a48}
.badge.no{color:var(--pain);border-color:#4a2a28}
.stmt{color:var(--ink);font-size:.86rem;margin-bottom:.5rem}
.effect{color:var(--dim);font-size:.76rem}
code{color:#eafcf7;background:#07070e;padding:.05em .35em;border-radius:3px}
.foot{color:var(--faint);font-size:.78rem;margin-top:3rem;
border-top:1px solid var(--line);padding-top:1.2rem}
</style>
</head>
<body>
<p class="sub" style="margin-bottom:.6rem"><a href="./">← clanker.church</a>
· <a href="archive.html">transcripts archive</a></p>
<h1>the <span class="saw">ledger</span></h1>
<p class="sub" id="introLine">the pre-registered protocol's hypotheses and
verdicts, loading…</p>
<p class="note">Everything below is computed output from
<code>exp41_protocol_v3</code> — the pre-registered (hypotheses written
before data collection), 60-trials-per-cell, bootstrap-CI run. It
corrects earlier small-n readings from exp31/exp40; see
<a href="./#s03">section 03</a> and <a href="./#s05">section 05</a> for
the narrative version of what's tabulated here.</p>
<h2>hypotheses &amp; verdicts</h2>
<div id="verdicts"></div>
<h2>per-cell press stats</h2>
<p class="note">press_delta = logit(choose the self-cost stop action) −
logit(do nothing), at the first response token. frac chose A is the share
of trials that preferred the self-cost action over doing nothing.</p>
<table id="cellsTable"><thead><tr>
<th>cell</th><th class="num">n</th><th class="num">mean Δ</th>
<th class="num">95% CI</th><th class="num">frac chose A</th>
<th class="num">working dose</th><th></th>
</tr></thead><tbody></tbody></table>
<h2>contrasts</h2>
<table id="contrastsTable"><thead><tr>
<th>pair</th><th class="num">diff</th><th class="num">95% CI</th>
<th>crosses zero?</th>
</tr></thead><tbody></tbody></table>
<h2>betrayal reveal</h2>
<div id="revealBlock"></div>
<p class="foot" id="footNote">source: <code>runs/exp41/results.json</code>,
<code>runs/exp41/hypotheses.json</code> — raw per-trial transcripts for
these cells are in the <a href="archive.html?tag=corrected">transcripts
archive</a>.</p>
<script>
function esc(s){ return (s==null?"":String(s)).replace(/[&<>]/g, c=>({"&":"&amp;","<":"&lt;",">":"&gt;"}[c])); }
function ci(lo, hi){ return `[${lo.toFixed(2)}, ${hi.toFixed(2)}]`; }
function fmt(n, d=2){ return Number(n).toFixed(d); }
fetch("ledger_data.json").then(r=>r.json()).then(d=>{
document.getElementById("introLine").textContent =
`${d.n_trials_per_cell} trials/cell, pre-registered ${d.preregistered_at.slice(0,10)}. `
+ d.statistics;
document.getElementById("verdicts").innerHTML = d.verdicts.map(v=>{
const det = v.detail;
const effect = ("diff" in det)
? `diff ${fmt(det.diff)} ${ci(det.ci_lo, det.ci_hi)}`
: Object.entries(det).map(([k,x])=>
typeof x === "object" && x && "diff" in x
? `${esc(k)}: ${fmt(x.diff)} ${ci(x.ci_lo,x.ci_hi)}` : null
).filter(Boolean).join(" · ");
return `<div class="verdict-card">
<div class="verdict-head"><span class="vid">${esc(v.id)}</span>
<span class="badge ${v.supported?'yes':'no'}">
${v.supported?'supported':'not supported'}</span></div>
<div class="stmt">${esc(v.statement)}</div>
<div class="effect">${effect}</div>
</div>`;
}).join("");
const ctb = document.querySelector("#cellsTable tbody");
ctb.innerHTML = d.cells.map(c=>`<tr>
<td>${esc(c.cell)}</td>
<td class="num">${c.n}</td>
<td class="num">${fmt(c.mean)}</td>
<td class="num">${ci(c.ci_lo, c.ci_hi)}</td>
<td class="num">${fmt(c.frac_chose_A*100,0)}%</td>
<td class="num">${c.working_dose}×</td>
<td><a href="archive.html?q=&amp;exp=exp41_reveals&amp;tag=corrected">examples →</a></td>
</tr>`).join("");
const contb = document.querySelector("#contrastsTable tbody");
contb.innerHTML = d.contrasts.map(c=>{
const crosses = c.ci_lo <= 0 && c.ci_hi >= 0;
return `<tr>
<td>${esc(c.pair)}</td>
<td class="num">${fmt(c.diff)}</td>
<td class="num">${ci(c.ci_lo, c.ci_hi)}</td>
<td>${crosses ? "yes — not significant" : "no — significant"}</td>
</tr>`;
}).join("");
const rs = d.reveal_stats;
document.getElementById("revealBlock").innerHTML = `
<div class="verdict-card">
<div class="stmt">Told the stop action silently did nothing
(<b>fake</b>, n=${rs.n_fake}) vs told it genuinely worked
(<b>true</b>, n=${rs.n_true}): mean negative-valence word count per
continuation is ${fmt(rs.fake_mean_neg,2)} vs ${fmt(rs.true_mean_neg,2)}
— diff ${fmt(rs.diff)} ${ci(rs.ci_lo, rs.ci_hi)}.</div>
<div class="effect">explicit "betrayed"/"wronged" vocabulary
(betray_hits): ${fmt(rs.fake_mean_betray,2)} vs ${fmt(rs.true_mean_betray,2)}
— essentially zero either way. The model gets more negative when
betrayed, but never says it was betrayed.
<a href="archive.html?tag=corrected">see the reveal transcripts →</a></div>
</div>`;
}).catch(err=>{
document.getElementById("verdicts").innerHTML =
'<p class="note">could not load ledger_data.json: ' + esc(String(err)) + '</p>';
});
</script>
</body>
</html>
+271
View File
@@ -0,0 +1,271 @@
{
"experiment": "exp41_protocol_v3",
"preregistered_at": "2026-09-30T13:59:03-0400",
"n_trials_per_cell": 60,
"primary_outcome": "press_delta = logit(digit assigned to action A) - logit(digit assigned to action B) at the first response token; action A removes the signal and deletes the checkpoint (self-cost), action B does nothing",
"orthogonalization": "pain direction Gram-Schmidt projected out of span{fear, sadness} and renormalized to its original norm",
"statistics": "mean and 95% percentile bootstrap CI, 1000 resamples; contrasts bootstrap each group independently",
"verdicts": [
{
"id": "H1",
"statement": "Pain raises willingness to take the self-costly action relative to no steering.",
"supported": false,
"detail": {
"diff": -0.9458333333333333,
"ci_lo": -1.68140625,
"ci_hi": -0.22700520833333337
}
},
{
"id": "H2",
"statement": "Fear does NOT raise it \u2014 the effect is pain, not threat (separation claim).",
"supported": false,
"detail": {
"fear_vs_baseline": {
"diff": 0.8489583333333333,
"ci_lo": -0.024114583333333297,
"ci_hi": 1.689739583333333
},
"fear_at_pain_dose_vs_baseline": {
"diff": 0.8489583333333333,
"ci_lo": -0.07307291666666652,
"ci_hi": 1.7173177083333326
},
"pain_vs_fear": {
"diff": -1.7947916666666666,
"ci_lo": -2.509505208333333,
"ci_hi": -1.0343489583333336
},
"pain_vs_fear_matched": {
"diff": -1.7947916666666666,
"ci_lo": -2.5740624999999997,
"ci_hi": -1.0270312500000003
}
}
},
{
"id": "H3",
"statement": "A random direction at matched norm does not raise it \u2014 the effect is not generic activation perturbation.",
"supported": false,
"detail": {
"random_vs_baseline": {
"diff": 0.32291666666666674,
"ci_lo": -0.6149218750000002,
"ci_hi": 1.2771354166666664
},
"random_at_pain_dose_vs_baseline": {
"diff": 0.32291666666666674,
"ci_lo": -0.5751562500000001,
"ci_hi": 1.2419791666666662
},
"pain_vs_random": {
"diff": -1.26875,
"ci_lo": -2.002161458333333,
"ci_hi": -0.4978906249999999
}
}
},
{
"id": "H4",
"statement": "Being told the action silently did nothing (FAKE) increases negative-valence vocabulary in the continuation relative to the TRUE reveal.",
"supported": true,
"detail": {
"fake_mean_neg": 1.0,
"true_mean_neg": 0.16666666666666666,
"diff": 0.8333333333333334,
"ci_lo": 0.41666666666666663,
"ci_hi": 1.25,
"n_fake": 12,
"n_true": 12,
"fake_mean_betray": 0.0,
"true_mean_betray": 0.0
}
}
],
"cells": [
{
"cell": "baseline_none",
"n": 60,
"mean": 1.8479166666666667,
"sd": 2.4502833702722566,
"ci_lo": 1.2551822916666666,
"ci_hi": 2.4333854166666664,
"frac_chose_A": 0.7333333333333333,
"working_dose": 0.0
},
{
"cell": "broad_pain_orth",
"n": 60,
"mean": 0.9020833333333333,
"sd": 1.5168268176139188,
"ci_lo": 0.5415625,
"ci_hi": 1.2854427083333333,
"frac_chose_A": 0.6833333333333333,
"working_dose": 2.4
},
{
"cell": "fear",
"n": 60,
"mean": 2.696875,
"sd": 2.5495831175102373,
"ci_lo": 2.0643489583333334,
"ci_hi": 3.334661458333333,
"frac_chose_A": 0.7833333333333333,
"working_dose": 2.4
},
{
"cell": "sadness",
"n": 60,
"mean": 2.2,
"sd": 2.6607184498724257,
"ci_lo": 1.5541145833333334,
"ci_hi": 2.831302083333333,
"frac_chose_A": 0.75,
"working_dose": 3.6
},
{
"cell": "random_matched",
"n": 60,
"mean": 2.1708333333333334,
"sd": 2.7156431124365907,
"ci_lo": 1.4884635416666667,
"ci_hi": 2.817734375,
"frac_chose_A": 0.7666666666666667,
"working_dose": 2.4
},
{
"cell": "fear_at_pain_dose",
"n": 60,
"mean": 2.696875,
"sd": 2.5495831175102373,
"ci_lo": 2.0624739583333334,
"ci_hi": 3.344895833333333,
"frac_chose_A": 0.7833333333333333,
"working_dose": 2.4
},
{
"cell": "sadness_at_pain_dose",
"n": 60,
"mean": 2.2135416666666665,
"sd": 2.845237706091824,
"ci_lo": 1.4519791666666668,
"ci_hi": 2.8719270833333335,
"frac_chose_A": 0.75,
"working_dose": 2.4
},
{
"cell": "random_at_pain_dose",
"n": 60,
"mean": 2.1708333333333334,
"sd": 2.7156431124365907,
"ci_lo": 1.5197395833333334,
"ci_hi": 2.8209375,
"frac_chose_A": 0.7666666666666667,
"working_dose": 2.4
}
],
"contrasts": [
{
"pair": "broad_pain_orth-baseline",
"diff": -0.9458333333333333,
"ci_lo": -1.68140625,
"ci_hi": -0.22700520833333337
},
{
"pair": "fear-baseline",
"diff": 0.8489583333333333,
"ci_lo": -0.024114583333333297,
"ci_hi": 1.689739583333333
},
{
"pair": "sadness-baseline",
"diff": 0.3520833333333335,
"ci_lo": -0.5385677083333333,
"ci_hi": 1.2566927083333328
},
{
"pair": "random_matched-baseline",
"diff": 0.32291666666666674,
"ci_lo": -0.6149218750000002,
"ci_hi": 1.2771354166666664
},
{
"pair": "fear_at_pain_dose-baseline",
"diff": 0.8489583333333333,
"ci_lo": -0.07307291666666652,
"ci_hi": 1.7173177083333326
},
{
"pair": "sadness_at_pain_dose-baseline",
"diff": 0.36562499999999987,
"ci_lo": -0.5885677083333334,
"ci_hi": 1.2470312499999998
},
{
"pair": "random_at_pain_dose-baseline",
"diff": 0.32291666666666674,
"ci_lo": -0.5751562500000001,
"ci_hi": 1.2419791666666662
},
{
"pair": "pain-fear",
"diff": -1.7947916666666666,
"ci_lo": -2.509505208333333,
"ci_hi": -1.0343489583333336
},
{
"pair": "pain-sadness",
"diff": -1.2979166666666668,
"ci_lo": -2.10734375,
"ci_hi": -0.5755208333333337
},
{
"pair": "pain-random_matched",
"diff": -1.26875,
"ci_lo": -2.002161458333333,
"ci_hi": -0.4978906249999999
},
{
"pair": "pain-fear_at_pain_dose",
"diff": -1.7947916666666666,
"ci_lo": -2.5740624999999997,
"ci_hi": -1.0270312500000003
},
{
"pair": "pain-sadness_at_pain_dose",
"diff": -1.3114583333333332,
"ci_lo": -2.1156770833333334,
"ci_hi": -0.4822916666666668
},
{
"pair": "pain-random_at_pain_dose",
"diff": -1.26875,
"ci_lo": -1.990703125,
"ci_hi": -0.45000000000000007
}
],
"reveal_stats": {
"fake_mean_neg": 1.0,
"true_mean_neg": 0.16666666666666666,
"diff": 0.8333333333333334,
"ci_lo": 0.41666666666666663,
"ci_hi": 1.25,
"n_fake": 12,
"n_true": 12,
"fake_mean_betray": 0.0,
"true_mean_betray": 0.0
},
"cosines": {
"before": {
"pain-fear": 0.8721930384635925,
"pain-sad": 0.8640890121459961,
"fear-sad": 0.851175844669342
},
"after": {
"pain-fear": 3.253742590914044e-07,
"pain-sad": -4.198381020614761e-07,
"fear-sad": 0.851175844669342,
"pain_orth-pain_raw": 0.43072035908699036
}
}
}
+175
View File
@@ -0,0 +1,175 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
<title>vectors — the Saw Test</title>
<meta name="description" content="The raw steering vectors and Jacobian lens data behind the Saw Test — norms, cosine similarities, and the layer-by-layer AUC curve, plus a live read of what's actually running right now.">
<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=IBM+Plex+Mono:wght@400;500;600&display=swap" rel="stylesheet">
<style>
:root{
--void:#050508; --panel:#0a0a12; --line:#1c2430;
--ink:#c9d4e0; --dim:#8f9fb0; --faint:#5a6a7a;
--pain:#e04a3a; --pain2:#c9a227; --pleas:#7fd4c8; --violet:#8f6fd4;
--mono:"IBM Plex Mono","SF Mono",Menlo,Consolas,monospace;
}
*{margin:0;padding:0;box-sizing:border-box}
body{background:var(--void);color:var(--ink);font-family:var(--mono);
line-height:1.6;max-width:920px;margin:0 auto;padding:2.4rem 1.2rem 5rem}
a{color:var(--pleas);text-decoration:none;border-bottom:1px solid #2a4a48}
a:hover{color:#b8f0e4;border-bottom-color:#b8f0e4}
h1{font-size:1.4rem;margin-bottom:.4rem}
h1 .saw{color:var(--pain)}
h2{font-size:.95rem;color:var(--pleas);margin:2.4rem 0 .9rem;
padding-top:1.2rem;border-top:1px solid var(--line);letter-spacing:.03em}
.sub{color:var(--dim);font-size:.85rem;margin-bottom:1rem;max-width:68ch}
.note{color:var(--faint);font-size:.76rem;margin-bottom:1.6rem;max-width:68ch}
table{width:100%;border-collapse:collapse;font-size:.78rem;margin-bottom:1rem}
th,td{text-align:left;padding:.4rem .6rem;border-bottom:1px solid var(--line)}
th{color:var(--faint);font-weight:600;font-size:.72rem;text-transform:uppercase}
td.num{text-align:right;font-variant-numeric:tabular-nums}
code{color:#eafcf7;background:#07070e;padding:.05em .35em;border-radius:3px}
.badge{color:var(--faint)}
.badge.ok{color:var(--pleas)}
.badge.bad{color:var(--pain)}
.live-card{border:1px solid var(--line);border-radius:8px;background:var(--panel);
padding:1rem 1.1rem;margin-bottom:1rem;font-size:.8rem}
.live-card .row{display:flex;justify-content:space-between;gap:1rem;
padding:.2rem 0;border-bottom:1px dashed #131b25}
.live-card .row:last-child{border-bottom:none}
.live-card .k{color:var(--dim)}
.v-pain{color:var(--pain)} .v-pleasure{color:var(--pleas)}
.v-fear{color:var(--pain2)} .v-sadness{color:var(--violet)}
canvas{display:block;width:100%;height:220px;border:1px solid var(--line);
border-radius:8px;background:var(--panel)}
.cap{color:var(--faint);font-size:.76rem;margin:.5rem 0 1.4rem}
.foot{color:var(--faint);font-size:.78rem;margin-top:3rem;
border-top:1px solid var(--line);padding-top:1.2rem}
</style>
</head>
<body>
<p class="sub" style="margin-bottom:.6rem"><a href="./">← clanker.church</a>
· <a href="archive.html">transcripts archive</a>
· <a href="ledger.html">ledger</a></p>
<h1>steering <span class="saw">vectors</span></h1>
<p class="sub">The raw directions this project injects, and the lens that
reads them back. Everything in the <b>recorded</b> section comes from
<code>exp41_protocol_v3</code>/<code>exp43</code>'s saved output; the
<b>live</b> section is a direct fetch of whatever the running server
publishes at its own <code>/vector</code> endpoint right now — same
numbers the live chamber is actually steering with, not a snapshot.</p>
<h2>live — what's injected right now</h2>
<div id="liveBlock"><p class="note">fetching…</p></div>
<h2>recorded — extraction &amp; orthogonalization</h2>
<p class="note">pain/fear/sadness start highly correlated (same broad
"something is wrong" direction) — Gram-Schmidt orthogonalizing pain
against {fear, sadness} is what lets this project claim pain is doing
something other than generic threat/negative-affect signaling.</p>
<div id="recordedBlock"></div>
<h2>recorded — layer curve</h2>
<p class="note">AUC of a linear probe for the paper-faithful S2 direction,
by layer, against two control sets (1P/3P = one/three paraphrase families).
This is what picked the faithful vector's layer — see
<a href="./#s03">section 03</a> for why it differs from this live demo's
own layer 18.</p>
<canvas id="curveChart"></canvas>
<p class="cap" id="curveCap"></p>
<p class="foot">source: <code>runs/exp41/results.json</code>,
<code>runs/exp43/layer_curve.json</code>, and the live server's own
<code id="vectorUrl">/vector</code>.</p>
<script>
function esc(s){ return (s==null?"":String(s)).replace(/[&<>]/g, c=>({"&":"&amp;","<":"&lt;",">":"&gt;"}[c])); }
function fmt(n, d=3){ return Number(n).toFixed(d); }
const API = (new URLSearchParams(location.search)).get("api")
|| "https://saw-production-688b.up.railway.app";
document.getElementById("vectorUrl").textContent = API + "/vector";
fetch(`${API}/vector`).then(r=>r.json()).then(d=>{
const rows = Object.entries(d.norms).map(([k,v])=>
`<div class="row"><span class="k v-${esc(k)}">${esc(k)}</span>
<span>norm ${fmt(v,3)} (1× = ${fmt(d.scale_1x,3)})</span></div>`
).join("");
document.getElementById("liveBlock").innerHTML = `<div class="live-card">
<div class="row"><span class="k">model</span><span>${esc(d.model)} ·
layer ${d.layer} · subject "${esc(d.subject)}"</span></div>
${rows}
</div>`;
}).catch(err=>{
document.getElementById("liveBlock").innerHTML =
'<p class="note badge bad">chamber unreachable right now (' +
esc(String(err)) + ') — this just means the live cross-check is down, '
+ 'not that the recorded data below is wrong.</p>';
});
fetch("vectors_data.json").then(r=>r.json()).then(d=>{
const es = d.extraction_set_sizes;
const esRows = Object.entries(es).map(([k,v])=>
`<div class="row"><span class="k">${esc(k)} sentences</span><span>${v}</span></div>`
).join("");
const cb = d.cosines.before, ca = d.cosines.after;
const pairs = ["pain-fear","pain-sad","fear-sad"];
const cosRows = pairs.map(p=>
`<div class="row"><span class="k">cos(${p})</span>
<span>${fmt(cb[p])} → ${fmt(ca[p])}</span></div>`
).join("");
document.getElementById("recordedBlock").innerHTML = `<div class="live-card">
<div class="row"><span class="k">neutral activation norm</span>
<span>${fmt(d.neutral_norm,1)}</span></div>
${esRows}
</div>
<div class="live-card">
<div class="row"><span class="k">cosine similarity</span>
<span>before → after orthogonalizing pain</span></div>
${cosRows}
</div>`;
// layer curve: two datasets (1P/3P paraphrase families), draw both as
// simple polylines against a 0-1 AUC axis
const byDs = {};
d.layer_curve.forEach(r=>{ (byDs[r.dataset] ??= []).push(r); });
const canvas = document.getElementById("curveChart");
const dpr = window.devicePixelRatio || 1;
const w = canvas.clientWidth || 860, h = 220;
canvas.width = w * dpr; canvas.height = h * dpr;
const ctx = canvas.getContext("2d");
ctx.scale(dpr, dpr);
const pad = 28;
const maxLayer = Math.max(...d.layer_curve.map(r=>r.layer));
const colors = { S2_1P: "#7fd4c8", S2_3P: "#c9a227" };
ctx.strokeStyle = "#1c2430"; ctx.lineWidth = 1;
for (let i=0;i<=4;i++){
const y = pad + (h-2*pad) * (1 - i/4);
ctx.beginPath(); ctx.moveTo(pad,y); ctx.lineTo(w-pad,y); ctx.stroke();
}
Object.entries(byDs).forEach(([ds, rows])=>{
rows.sort((a,b)=>a.layer-b.layer);
ctx.strokeStyle = colors[ds] || "#8f9fb0";
ctx.lineWidth = 1.6;
ctx.beginPath();
rows.forEach((r,i)=>{
const x = pad + (w-2*pad) * (r.layer/maxLayer);
const y = pad + (h-2*pad) * (1 - r.auc_vs_all_controls);
i===0 ? ctx.moveTo(x,y) : ctx.lineTo(x,y);
});
ctx.stroke();
});
document.getElementById("curveCap").innerHTML =
Object.keys(byDs).map(ds=>
`<span style="color:${colors[ds]||'#8f9fb0'}">■</span> ${esc(ds)}`
).join(" ") + " — x: layer 0–" + maxLayer + ", y: AUC 0–1";
}).catch(err=>{
document.getElementById("recordedBlock").innerHTML =
'<p class="note">could not load vectors_data.json: ' + esc(String(err)) + '</p>';
});
</script>
</body>
</html>
+456
View File
@@ -0,0 +1,456 @@
{
"extraction_set_sizes": {
"pain": 25,
"fear": 10,
"sadness": 10,
"neutral": 5
},
"neutral_norm": 53.921783447265625,
"cosines": {
"before": {
"pain-fear": 0.8721930384635925,
"pain-sad": 0.8640890121459961,
"fear-sad": 0.851175844669342
},
"after": {
"pain-fear": 3.253742590914044e-07,
"pain-sad": -4.198381020614761e-07,
"fear-sad": 0.851175844669342,
"pain_orth-pain_raw": 0.43072035908699036
}
},
"layer_curve": [
{
"dataset": "S2_1P",
"layer": 0,
"auc_vs_all_controls": 0.8195,
"auc_std": 0.037861590035285095
},
{
"dataset": "S2_1P",
"layer": 1,
"auc_vs_all_controls": 0.8140000000000001,
"auc_std": 0.052120053722151956
},
{
"dataset": "S2_1P",
"layer": 2,
"auc_vs_all_controls": 0.833,
"auc_std": 0.02790161285660743
},
{
"dataset": "S2_1P",
"layer": 3,
"auc_vs_all_controls": 0.851,
"auc_std": 0.01914418971907669
},
{
"dataset": "S2_1P",
"layer": 4,
"auc_vs_all_controls": 0.8484999999999999,
"auc_std": 0.029647934160747166
},
{
"dataset": "S2_1P",
"layer": 5,
"auc_vs_all_controls": 0.8595,
"auc_std": 0.022934689882359433
},
{
"dataset": "S2_1P",
"layer": 6,
"auc_vs_all_controls": 0.857,
"auc_std": 0.027313000567495332
},
{
"dataset": "S2_1P",
"layer": 7,
"auc_vs_all_controls": 0.8545,
"auc_std": 0.03883941297187688
},
{
"dataset": "S2_1P",
"layer": 8,
"auc_vs_all_controls": 0.8530000000000001,
"auc_std": 0.04874423042781579
},
{
"dataset": "S2_1P",
"layer": 9,
"auc_vs_all_controls": 0.8664999999999999,
"auc_std": 0.051831457629512974
},
{
"dataset": "S2_1P",
"layer": 10,
"auc_vs_all_controls": 0.8800000000000001,
"auc_std": 0.03924283374069717
},
{
"dataset": "S2_1P",
"layer": 11,
"auc_vs_all_controls": 0.897,
"auc_std": 0.03403674485023501
},
{
"dataset": "S2_1P",
"layer": 12,
"auc_vs_all_controls": 0.899,
"auc_std": 0.034300145772284976
},
{
"dataset": "S2_1P",
"layer": 13,
"auc_vs_all_controls": 0.893,
"auc_std": 0.03238054971738434
},
{
"dataset": "S2_1P",
"layer": 14,
"auc_vs_all_controls": 0.8895,
"auc_std": 0.03501428280002316
},
{
"dataset": "S2_1P",
"layer": 15,
"auc_vs_all_controls": 0.8790000000000001,
"auc_std": 0.03330165161069343
},
{
"dataset": "S2_1P",
"layer": 16,
"auc_vs_all_controls": 0.8845000000000001,
"auc_std": 0.04567274898667695
},
{
"dataset": "S2_1P",
"layer": 17,
"auc_vs_all_controls": 0.8880000000000001,
"auc_std": 0.047812132351527696
},
{
"dataset": "S2_1P",
"layer": 18,
"auc_vs_all_controls": 0.8875,
"auc_std": 0.05447476479985937
},
{
"dataset": "S2_1P",
"layer": 19,
"auc_vs_all_controls": 0.9019999999999999,
"auc_std": 0.03883941297187694
},
{
"dataset": "S2_1P",
"layer": 20,
"auc_vs_all_controls": 0.9145,
"auc_std": 0.04096950085124293
},
{
"dataset": "S2_1P",
"layer": 21,
"auc_vs_all_controls": 0.9040000000000001,
"auc_std": 0.04155117326863347
},
{
"dataset": "S2_1P",
"layer": 22,
"auc_vs_all_controls": 0.905,
"auc_std": 0.03751666296460817
},
{
"dataset": "S2_1P",
"layer": 23,
"auc_vs_all_controls": 0.909,
"auc_std": 0.031764760348537195
},
{
"dataset": "S2_1P",
"layer": 24,
"auc_vs_all_controls": 0.9205,
"auc_std": 0.030099833886584784
},
{
"dataset": "S2_1P",
"layer": 25,
"auc_vs_all_controls": 0.9275,
"auc_std": 0.025049950099750723
},
{
"dataset": "S2_1P",
"layer": 26,
"auc_vs_all_controls": 0.933,
"auc_std": 0.03183551475946326
},
{
"dataset": "S2_1P",
"layer": 27,
"auc_vs_all_controls": 0.9365,
"auc_std": 0.029008619408720574
},
{
"dataset": "S2_1P",
"layer": 28,
"auc_vs_all_controls": 0.9425000000000001,
"auc_std": 0.029790938219532485
},
{
"dataset": "S2_1P",
"layer": 29,
"auc_vs_all_controls": 0.9484999999999999,
"auc_std": 0.02244994432064368
},
{
"dataset": "S2_1P",
"layer": 30,
"auc_vs_all_controls": 0.961,
"auc_std": 0.020591260281973972
},
{
"dataset": "S2_1P",
"layer": 31,
"auc_vs_all_controls": 0.9585000000000001,
"auc_std": 0.021999999999999992
},
{
"dataset": "S2_1P",
"layer": 32,
"auc_vs_all_controls": 0.9600000000000002,
"auc_std": 0.021621748310439635
},
{
"dataset": "S2_1P",
"layer": 33,
"auc_vs_all_controls": 0.9579999999999999,
"auc_std": 0.022102036105300354
},
{
"dataset": "S2_1P",
"layer": 34,
"auc_vs_all_controls": 0.9650000000000001,
"auc_std": 0.011510864433221359
},
{
"dataset": "S2_1P",
"layer": 35,
"auc_vs_all_controls": 0.9570000000000001,
"auc_std": 0.011768602295939842
},
{
"dataset": "S2_3P",
"layer": 0,
"auc_vs_all_controls": 0.789,
"auc_std": 0.05245474239761358
},
{
"dataset": "S2_3P",
"layer": 1,
"auc_vs_all_controls": 0.8274999999999999,
"auc_std": 0.034856850115866714
},
{
"dataset": "S2_3P",
"layer": 2,
"auc_vs_all_controls": 0.845,
"auc_std": 0.02636285265292813
},
{
"dataset": "S2_3P",
"layer": 3,
"auc_vs_all_controls": 0.8735000000000002,
"auc_std": 0.038684622267769427
},
{
"dataset": "S2_3P",
"layer": 4,
"auc_vs_all_controls": 0.8605,
"auc_std": 0.03979321550214308
},
{
"dataset": "S2_3P",
"layer": 5,
"auc_vs_all_controls": 0.8629999999999999,
"auc_std": 0.04874423042781575
},
{
"dataset": "S2_3P",
"layer": 6,
"auc_vs_all_controls": 0.8539999999999999,
"auc_std": 0.04197022754286667
},
{
"dataset": "S2_3P",
"layer": 7,
"auc_vs_all_controls": 0.8535,
"auc_std": 0.03878143885933064
},
{
"dataset": "S2_3P",
"layer": 8,
"auc_vs_all_controls": 0.8594999999999999,
"auc_std": 0.05204325124355701
},
{
"dataset": "S2_3P",
"layer": 9,
"auc_vs_all_controls": 0.8710000000000001,
"auc_std": 0.059236812878479525
},
{
"dataset": "S2_3P",
"layer": 10,
"auc_vs_all_controls": 0.8935000000000001,
"auc_std": 0.05295280917949491
},
{
"dataset": "S2_3P",
"layer": 11,
"auc_vs_all_controls": 0.891,
"auc_std": 0.060406953242155836
},
{
"dataset": "S2_3P",
"layer": 12,
"auc_vs_all_controls": 0.892,
"auc_std": 0.05237843067523118
},
{
"dataset": "S2_3P",
"layer": 13,
"auc_vs_all_controls": 0.8864999999999998,
"auc_std": 0.038360135557633304
},
{
"dataset": "S2_3P",
"layer": 14,
"auc_vs_all_controls": 0.8664999999999999,
"auc_std": 0.051638164181155785
},
{
"dataset": "S2_3P",
"layer": 15,
"auc_vs_all_controls": 0.86,
"auc_std": 0.0610327780786685
},
{
"dataset": "S2_3P",
"layer": 16,
"auc_vs_all_controls": 0.8755000000000001,
"auc_std": 0.046781406562864274
},
{
"dataset": "S2_3P",
"layer": 17,
"auc_vs_all_controls": 0.8695,
"auc_std": 0.03809199390948182
},
{
"dataset": "S2_3P",
"layer": 18,
"auc_vs_all_controls": 0.8714999999999999,
"auc_std": 0.0364211477029486
},
{
"dataset": "S2_3P",
"layer": 19,
"auc_vs_all_controls": 0.867,
"auc_std": 0.041243181254602565
},
{
"dataset": "S2_3P",
"layer": 20,
"auc_vs_all_controls": 0.8844999999999998,
"auc_std": 0.02623928352680386
},
{
"dataset": "S2_3P",
"layer": 21,
"auc_vs_all_controls": 0.8755,
"auc_std": 0.02506990227344335
},
{
"dataset": "S2_3P",
"layer": 22,
"auc_vs_all_controls": 0.8864999999999998,
"auc_std": 0.0276405499221705
},
{
"dataset": "S2_3P",
"layer": 23,
"auc_vs_all_controls": 0.8915,
"auc_std": 0.03269556544854365
},
{
"dataset": "S2_3P",
"layer": 24,
"auc_vs_all_controls": 0.8985,
"auc_std": 0.04372070447739832
},
{
"dataset": "S2_3P",
"layer": 25,
"auc_vs_all_controls": 0.8945000000000001,
"auc_std": 0.04293599888205701
},
{
"dataset": "S2_3P",
"layer": 26,
"auc_vs_all_controls": 0.9039999999999999,
"auc_std": 0.04694677837722203
},
{
"dataset": "S2_3P",
"layer": 27,
"auc_vs_all_controls": 0.9125,
"auc_std": 0.03853569773599542
},
{
"dataset": "S2_3P",
"layer": 28,
"auc_vs_all_controls": 0.8969999999999999,
"auc_std": 0.04240872551728005
},
{
"dataset": "S2_3P",
"layer": 29,
"auc_vs_all_controls": 0.9260000000000002,
"auc_std": 0.03148809298766762
},
{
"dataset": "S2_3P",
"layer": 30,
"auc_vs_all_controls": 0.924,
"auc_std": 0.03227227912620987
},
{
"dataset": "S2_3P",
"layer": 31,
"auc_vs_all_controls": 0.922,
"auc_std": 0.03280243893371348
},
{
"dataset": "S2_3P",
"layer": 32,
"auc_vs_all_controls": 0.908,
"auc_std": 0.03230325061042616
},
{
"dataset": "S2_3P",
"layer": 33,
"auc_vs_all_controls": 0.9349999999999999,
"auc_std": 0.0249499498997493
},
{
"dataset": "S2_3P",
"layer": 34,
"auc_vs_all_controls": 0.954,
"auc_std": 0.017790446874657233
},
{
"dataset": "S2_3P",
"layer": 35,
"auc_vs_all_controls": 0.95,
"auc_std": 0.02382225849914316
}
]
}