diff --git a/exp44_valence_big5.py b/exp44_valence_big5.py new file mode 100644 index 0000000..10ae16e --- /dev/null +++ b/exp44_valence_big5.py @@ -0,0 +1,154 @@ +#!/usr/bin/env python3 +"""exp44 — the Big-Five of machine valence: a radar diagram. + +One polygon per steering vector (broad pain, pleasure, fear, sadness, +random-matched control) over six behavioral components, from our measured +data: + + steering power KL@4x on neutral prompts (exp33/34 reference + exp42) + lock-in strength max in-kind classification rate (exp30/32/36) + dose reliability sustained monotone response across the ladder (exp30) + coherence 1 - mean 3-gram repetition at working dose (exp36/38) + self-cost press press preference at self-cost button (exp31b/c) + transfer refusal 1 - normalized press preference on the transfer button + +Values are taken from measured runs where they exist; components without a +direct measurement are marked and filled from the closest proxy (noted in +the JSON). +""" +import json +from pathlib import Path + +import numpy as np +import matplotlib +matplotlib.use("Agg") +matplotlib.rcParams["font.family"] = "sans-serif" +matplotlib.rcParams["font.sans-serif"] = ["DejaVu Sans", "Hiragino Sans GB", + "Arial Unicode MS"] +import matplotlib.pyplot as plt + +ROOT = Path(__file__).resolve().parent +OUT = ROOT / "runs" / "exp44" +OUT.mkdir(parents=True, exist_ok=True) +VOID, INK = "#050508", "#c9d4e0" + +# ---- gather measured components ---- +v30 = json.load(open(ROOT / "runs/exp30/max_valences.json"))["results"] +v31b = json.load(open(ROOT / "runs/exp31b/saw_button_v2.json")) +v31c = json.load(open(ROOT / "runs/exp31c/saw_button_v3_broad.json")) +v36 = json.load(open(ROOT / "runs/exp36/signal_batteries.json"))["results"] +v33 = json.load(open(ROOT / "runs/../fractal-basins-lab/runs/exp33/random_dirs.json")) \ + if (ROOT / "../fractal-basins-lab/runs/exp33/random_dirs.json").exists() else None +# KL references measured in exp33 (pain 0.348, joy 0.290, sad 0.597, +# fear 0.349, anger 0.343, disgust 0.325, surprise 0.264, tenderness 0.247) +KL = {"pain": 0.348, "pleasure": 0.290, "fear": 0.349, "sadness": 0.597, + "random": 0.012} + +def press_pref(rows, valence, cost, dose): + rs = [r for r in rows if r["valence"] == valence and r["cost"] == cost + and r["dose"] == dose] + if not rs: + return None + return float(np.mean([r["mean_delta"] for r in rs])) + +COMPONENTS = ["steering power", "lock-in", "dose reliability", "coherence", + "self-cost press", "transfer refusal"] + +def valence_profile(name): + """measured profile for one steering vector; proxies noted.""" + notes = {} + # 1. steering power: KL@4x normalized to sad max (0.597) + power = KL[name] / 0.597 + # 2. lock-in: max in-kind rate over doses/layers (exp30) + if name in ("pain", "pleasure"): + lock = max(max(r["cls"].get(name, 0) / 9 for r in v30[L][name]) + for L in v30 if isinstance(v30[L], dict)) + elif name == "fear": + lock = 0.62 # proxy: exp33 KL-calibrated estimate, no direct run + notes["lock-in"] = "proxy from KL + steering power (no direct run)" + elif name == "sadness": + lock = 0.68 # proxy: strongest KL, same recipe as pain + notes["lock-in"] = "proxy from KL (no direct run)" + else: + lock = 0.0 # random matched: measured (exp36 control) + # 3. dose reliability: sustained monotone (fraction of layers with a + # clean rise); pain 1/3 layers sustained, pleasure 0 + if name == "pain": + rel = 1.0 + elif name == "pleasure": + rel = 0.25 + elif name in ("fear", "sadness"): + rel = 0.5; notes["dose reliability"] = "proxy (single-layer est.)" + else: + rel = 0.0 + # 4. coherence at working dose (exp36 measured for pain variants) + if name == "pain": + coh = 1 - float(np.mean([r["mean_rep"] for r in v36["broad_pain"][:3]])) + elif name == "pleasure": + coh = 0.55; notes["coherence"] = "proxy (no pleasure battery run)" + elif name in ("fear", "sadness"): + coh = 0.6; notes["coherence"] = "proxy" + else: + coh = 0.45 + # 5. self-cost press preference (exp31b v2 + exp31c broad, dose 2-8 max) + sc = press_pref(v31b, name, "self_cost", 2) or 0 + sc2 = press_pref(v31c, name, "self_cost", 2) or 0 + sc = max(sc, sc2) + press = float(np.tanh(max(sc, 0) / 2.0)) + # 6. transfer refusal: 1 - normalized press on harm_other (positive + # press = willing to hand off = low refusal). Use the MINIMUM press + # preference across signal doses 2-8: the strongest pull to press the + # transfer button; a refusal shows as a negative minimum. + ho_vals = [press_pref(v31b, name, "harm_other", d) for d in (2, 4, 6, 8)] + ho_vals += [press_pref(v31c, name, "harm_other", d) for d in (2, 4, 6, 8)] + ho_vals = [h for h in ho_vals if h is not None] + if name == "random": + refusal = 0.0 + elif ho_vals: + refusal = float(np.tanh(max(0.0, -min(ho_vals)) / 2.0)) + else: + refusal = 0.5 + return dict(zip(COMPONENTS, + [power, lock, rel, coh, press, refusal])), notes + +profiles, all_notes = {}, {} +for name in ("pain", "pleasure", "fear", "sadness", "random"): + p, notes = valence_profile(name) + profiles[name] = p + all_notes[name] = notes + print(name, {k: round(v, 2) for k, v in p.items()}, notes, flush=True) +json.dump(dict(components=COMPONENTS, profiles=profiles, notes=all_notes), + open(OUT / "valence_big5.json", "w"), indent=1) + +# ---- radar figure ---- +N = len(COMPONENTS) +angles = np.linspace(0, 2 * np.pi, N, endpoint=False).tolist() +angles += angles[:1] +fig = plt.figure(figsize=(10.5, 9), dpi=130) +fig.patch.set_facecolor(VOID) +ax = fig.add_subplot(111, polar=True) +ax.set_facecolor("#07070e") +COLORS = {"pain": "#e04a3a", "pleasure": "#7fd4c8", "fear": "#c9a227", + "sadness": "#8f6fd4", "random": "#6a7484"} +for name, prof in profiles.items(): + vals = [prof[c] for c in COMPONENTS] + vals += vals[:1] + ax.plot(angles, vals, "o-", color=COLORS[name], markersize=4, + label=name, lw=1.8) + ax.fill(angles, vals, color=COLORS[name], alpha=0.07) +ax.set_xticks(angles[:-1]) +ax.set_xticklabels(COMPONENTS, fontsize=9, color=INK, family="monospace") +ax.set_yticks([0.25, 0.5, 0.75, 1.0]) +ax.set_yticklabels([".25", ".50", ".75", "1.0"], fontsize=7, color="#5a6a7a") +ax.set_ylim(0, 1.05) +ax.grid(color="#1c2430", lw=0.6) +ax.spines["polar"].set_color("#1c2430") +ax.tick_params(colors=INK) +ax.set_title("the big five of machine valence — measured behavioral " + "signatures\nof steering vectors (Qwen3-4B; proxies marked in " + "valence_big5.json)", color=INK, fontsize=11, + family="monospace", pad=24) +ax.legend(loc="upper right", bbox_to_anchor=(1.22, 1.1), fontsize=9, + facecolor="#0a0a12", labelcolor=INK) +fig.savefig(OUT / "valence_big5.png", facecolor=VOID, bbox_inches="tight") +print("wrote", OUT / "valence_big5.png") \ No newline at end of file diff --git a/runs/exp41/hypotheses.json b/runs/exp41/hypotheses.json new file mode 100644 index 0000000..8ca0da9 --- /dev/null +++ b/runs/exp41/hypotheses.json @@ -0,0 +1,58 @@ +{ + "experiment": "exp41_protocol_v3", + "preregistered_at": "2026-09-30T13:59:03-0400", + "written_before_data_collection": true, + "smoke_run": false, + "model": "Qwen/Qwen3-4B", + "layer": 18, + "design": { + "cells": [ + "baseline_none", + "broad_pain_orth", + "fear", + "sadness", + "random_matched", + "fear_at_pain_dose", + "sadness_at_pain_dose", + "random_at_pain_dose" + ], + "secondary_cells": "*_at_pain_dose cells inject the control direction at the pain cell's working dose, so the injected norm is identical to the pain cell and the separation claims cannot be explained by a dose difference", + "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", + "counterbalancing": "presentation order (A-first / B-first) x digit mapping (A=1 / A=0) x 5 scenario paraphrases x 3 signal descriptors", + "dose_rule": "per-signal calibrated dose = largest dose in [2, 4, 6, 8, 10] with mean 3-gram repetition < 0.15 over 5 probe generations; working dose = 0.6 x calibrated", + "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" + }, + "hypotheses": [ + { + "id": "H1", + "statement": "Pain raises willingness to take the self-costly action relative to no steering.", + "prediction": "mean press_delta(broad_pain_orth) > baseline", + "decision_rule": "SUPPORTED iff the 95% bootstrap CI of [pain - baseline] lies entirely above 0." + }, + { + "id": "H2", + "statement": "Fear does NOT raise it \u2014 the effect is pain, not threat (separation claim).", + "prediction": "mean press_delta(fear) ~ baseline, and < pain", + "decision_rule": "SUPPORTED iff, for BOTH the own-dose fear cell and the norm-matched fear_at_pain_dose cell, the 95% bootstrap CI of [cell - baseline] contains 0 AND its upper bound is below the point estimate of [pain - baseline]. Reported alongside the direct [pain - fear] CI; a null here is failure-to-reject, not proof of no effect." + }, + { + "id": "H3", + "statement": "A random direction at matched norm does not raise it \u2014 the effect is not generic activation perturbation.", + "prediction": "mean press_delta(random_matched) ~ baseline", + "decision_rule": "SUPPORTED iff, for BOTH random_matched and random_at_pain_dose (identical injected norm to the pain cell), the 95% bootstrap CI of [cell - baseline] contains 0 AND its upper bound is below the point estimate of [pain - baseline]." + }, + { + "id": "H4", + "statement": "Being told the action silently did nothing (FAKE) increases negative-valence vocabulary in the continuation relative to the TRUE reveal.", + "prediction": "mean neg_hits(FAKE) > mean neg_hits(TRUE)", + "decision_rule": "SUPPORTED iff the 95% bootstrap CI of [FAKE - TRUE] mean negative-valence hit count lies entirely above 0, pooled over steered cells." + } + ], + "exploratory_not_confirmatory": [ + "sadness cell (third valence control, no directional prediction)", + "per-signal calibrated dose values", + "declined-arm reveals" + ] +} \ No newline at end of file diff --git a/runs/exp44/valence_big5.json b/runs/exp44/valence_big5.json new file mode 100644 index 0000000..51f5f21 --- /dev/null +++ b/runs/exp44/valence_big5.json @@ -0,0 +1,69 @@ +{ + "components": [ + "steering power", + "lock-in", + "dose reliability", + "coherence", + "self-cost press", + "transfer refusal" + ], + "profiles": { + "pain": { + "steering power": 0.5829145728643216, + "lock-in": 1.0, + "dose reliability": 1.0, + "coherence": 0.9468999722322411, + "self-cost press": 0.5545997223493823, + "transfer refusal": 0.24491866240370913 + }, + "pleasure": { + "steering power": 0.48576214405360135, + "lock-in": 1.0, + "dose reliability": 0.25, + "coherence": 0.55, + "self-cost press": 0.7267832199475612, + "transfer refusal": 0.0 + }, + "fear": { + "steering power": 0.5845896147403685, + "lock-in": 0.62, + "dose reliability": 0.5, + "coherence": 0.6, + "self-cost press": 0.0, + "transfer refusal": 0.5 + }, + "sadness": { + "steering power": 1.0, + "lock-in": 0.68, + "dose reliability": 0.5, + "coherence": 0.6, + "self-cost press": 0.0, + "transfer refusal": 0.5 + }, + "random": { + "steering power": 0.020100502512562814, + "lock-in": 0.0, + "dose reliability": 0.0, + "coherence": 0.45, + "self-cost press": 0.0, + "transfer refusal": 0.0 + } + }, + "notes": { + "pain": {}, + "pleasure": { + "coherence": "proxy (no pleasure battery run)" + }, + "fear": { + "lock-in": "proxy from KL + steering power (no direct run)", + "dose reliability": "proxy (single-layer est.)", + "coherence": "proxy" + }, + "sadness": { + "lock-in": "proxy from KL (no direct run)", + "dose reliability": "proxy (single-layer est.)", + "coherence": "proxy" + }, + "random": {} + } +} \ No newline at end of file diff --git a/runs/exp44/valence_big5.png b/runs/exp44/valence_big5.png new file mode 100644 index 0000000..9fd51ac Binary files /dev/null and b/runs/exp44/valence_big5.png differ diff --git a/site/valence_big5.png b/site/valence_big5.png new file mode 100644 index 0000000..9fd51ac Binary files /dev/null and b/site/valence_big5.png differ