Fuse steps once, order-invariant; publish a single bounded path score
Purpose. Produce a single bounded, order-invariant, shard-safe path score while keeping m pristine via phi((m,a)) = m. Pool per-step RSIs in u-space and invert once.
Definition (fuse steps in u-space).
# clamp, map, pool, invert
u'_s := atanh( clamp(RSI'_s, -1+eps_a, +1-eps_a) )
U_path := SUM_s (w_s * u'_s)
W_path := SUM_s w_s
RSI_path := tanh( U_path / max(W_path, eps_w) )
Defaults: eps_a = 1e-6, eps_w = 1e-12. Weights w_s: uniform (1) for comparability, or strength-aware (|m_s|^gamma, gamma=1) — declare once in the manifest.
Streaming / branching.
# streaming extend
U_path += w_s * u'_s
W_path += w_s
# shard merge
U_path := SUM_k U_k
W_path := SUM_k W_k
RSI_path := tanh( U_path / max(W_path, eps_w) )
Compare branches by RSI_path (or RSI_plan_env if gating).
Plan gate (optional, alignment-only).
# mode "mul" (default)
RSI_plan_env := g_plan * RSI_path
# mode "u_scale"
RSI_plan_env := tanh( g_plan * atanh(RSI_path) )
Invariant: gate scales alignment only; never m.
Reporting (stamp-ready).
- Log:
U_path, W_path, RSI_path, band_path := to_band(RSI_path) - Optional:
g_plan, RSI_plan_env, band_env - Stamp example:
...|U_path=1.187535|W_path=3|RSI_path=0.376388|band=A0|g_plan=0.80|RSI_env=0.301110|...
Worked numbers (calculator-fast; 6-dec).
u'_1 = 0.587535 (from RSI'_1 = 0.528120)
u'_2 = 0.400000 (from RSI'_2 = 0.379949)
u'_3 = 0.200000
U_path = 1.187535
W_path = 3
RSI_path = tanh(1.187535 / 3) = tanh(0.395845) = 0.376388 -> A0
g_plan = 0.800000 -> RSI_plan_env = 0.301110 -> A0
Rollback stack (Δ-based).
# push when adding a step
push(ΔU := w_s*u'_s, ΔW := w_s)
# rollback on breach
while RSI_path < band_min and stack not empty:
ΔU, ΔW := pop()
U_path -= ΔU
W_path -= ΔW
RSI_path := tanh( U_path / max(W_path, eps_w) )
Always recompute from (U_path, W_path); never mutate m.
Pseudocode (branch-safe).
class PathScore:
def __init__(self, eps_a=1e-6, eps_w=1e-12):
self.U = 0.0; self.W = 0.0
self.eps_a = eps_a; self.eps_w = eps_w
self.stack = []
def add_step(self, RSI_used, beta=0.0, b_s=0.0, w=1.0):
a = max(-1+self.eps_a, min(1-self.eps_a, RSI_used))
u = atanh(a) + beta * b_s
self.U += w * u; self.W += w
self.stack.append((w * u, w))
def undo_step(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.0 else tanh(self.U / max(self.W, self.eps_w))
def pick_best_branch(branches, g_plan=1.0, mode="mul"):
def env_rsi(ps):
r = ps.rsi_path()
return tanh(g_plan * atanh(r)) if mode == "u_scale" else g_plan * r
return max(branches, key=lambda kv: env_rsi(kv[1]))[0]
Acceptance checklist (pass/fail).
• Order invariance (permute steps): unchanged RSI_path within dtype epsilon
• Shard invariance (sum (U,W)): matches single-pass result
• Rollback correctness: Δ stack restores last-known-good
• Boundedness: |RSI_path| < 1
• Determinism: same inputs + manifest ⇒ identical outputs
One-line takeaway. Keep per-step contributions in u-space, track (U,W), and publish RSI_path := tanh(U/W) — a single, bounded, order-proof score for whole chains and plans, with phi((m,a)) = m guaranteeing classical values stay identical.
Navigation
Previous: SSM-AI – Step Scores & Priors in u-Space (5.1)
Next: SSM-AI – Failure Containment & Rollback (5.3)
Directory of Pages
SSM-AI — Table of Contents