SSM-AI – Developer Hooks (5.5)

Copy-paste CSVs and a tiny SDK surface

Purpose. Give engineers immediate integration points: stamped CSV schemas for steps/paths and a minimal SDK surface that preserves collapse parity phi((m,a)) = m, order/shard invariance, and alignment-only handling.

Per-step CSV (one row per step).

step_id, m, e_in, e_out, a_in, a_out, U_in, V_out, W_in, RSI_s, g_s, RSI_used, b_s, beta, u_step, w_step, dU, dW, band_s, stamp

Field notes.
m: classical magnitude (unchanged).
e_*: lens contrasts; a_* := tanh(±c*e_*).
U_in := Σ w*atanh(a_in), V_out := Σ w*atanh(a_out), W_in := Σ w.
RSI_s := tanh((V_out - U_in)/max(W_in, eps_w)).
RSI_used := g_s*RSI_s or tanh(g_s*atanh(RSI_s)) (mode "u_scale").
u_step := atanh(clamp(RSI_used)) + beta*b_s.
dU := w_step*u_step, dW := w_step.
band_s := to_band(RSI_used).

Per-path CSV (one row per path).

path_id, U_path, W_path, RSI_path, beta_plan, B_plan, RSI_path_prime, g_plan, mode, RSI_env, band_path, pops, cause, budget_tokens, budget_ms, stamp

Field notes.
RSI_path := tanh(U_path/max(W_path, eps_w)).
• Prior: U_plan' := U_path + beta_plan*B_plan*W_path, RSI_path' := tanh(U_plan'/max(W_path, eps_w)).
• Gate: RSI_env := g_plan*RSI_path' or tanh(g_plan*atanh(RSI_path')).
band_path := to_band(RSI_env).
pops: rollback count; cause: reason string.

Minimal SDK (drop-in).

class LaneStep:
    def __init__(self, step_id, m, e_in_items, e_out_items, w=1.0, g_s=1.0, b_s=0.0, beta=0.0,
                 c=1.0, eps_a=1e-6, eps_w=1e-12, gate_mode="mul"):
        self.step_id = step_id
        self.w = w
        U_in = V_out = W_in = 0.0
        for (e, w_i) in e_in_items:
            a = tanh(-c*e); a = max(-1+eps_a, min(1-eps_a, a))
            U_in += w_i*atanh(a); W_in += w_i
        for (e, w_j) in e_out_items:
            a = tanh(+c*e); a = max(-1+eps_a, min(1-eps_a, a))
            V_out += w_j*atanh(a)
        RSI_s = 0.0 if W_in <= 0 else tanh((V_out - U_in)/max(W_in, eps_w))
        RSI_used = tanh(g_s*atanh(RSI_s)) if gate_mode=="u_scale" else g_s*RSI_s
        RSI_used = max(-1+eps_a, min(1-eps_a, RSI_used))
        u_step = atanh(RSI_used) + beta*b_s
        self.dU = w*u_step
        self.dW = w
        self.band = to_band(RSI_used)

class LanePath:
    def __init__(self, eps_w=1e-12):
        self.U = 0.0; self.W = 0.0; self.eps_w = eps_w; self.stack = []
    def add(self, lane_step):
        self.U += lane_step.dU; self.W += lane_step.dW; self.stack.append((lane_step.dU, lane_step.dW))
    def undo(self):
        if not self.stack: return
        dU,dW = self.stack.pop(); self.U -= dU; self.W -= dW
    def rsi_path(self):
        return 0.0 if self.W <= 0 else tanh(self.U / max(self.W, self.eps_w))
    def rsi_env(self, g_plan=1.0, mode="mul"):
        r = self.rsi_path()
        return tanh(g_plan*atanh(r)) if mode=="u_scale" else g_plan*r

Helper snippets (ready to paste).

# Bands (defaults)
def to_band(x):
    if x >= 0.90: return "A++"
    if x >= 0.60: return "A+"
    if x > -0.60: return "A0"
    if x > -0.90: return "A-"
    return "A--"

Acceptance checklist (dev-facing).
Parity: phi((m,a)) = m before/after all steps.
Bounds: all a, RSI_s, RSI_path, RSI_env strictly in (-1,+1).
Determinism: batch == stream == shuffled (within dtype tolerance).
Replay: CSV rows reconstruct U/W/RSI/RSI_env/bands exactly.
Purity: gates/priors act on alignment only; never mutate m.

One-line takeaway. Use the stamped CSVs and tiny SDK to integrate today—alignment-only, deterministic, and replayable—while all classical values remain pristine via phi((m,a)) = m.


Navigation
Previous: SSM-AI – Plan-Level Priors & Gates (5.4)
Next: SSM-AI – Empirical Validation & Mini Benchmarks (6)


Directory of Pages
SSM-AI — Table of Contents