Golden vectors, CI, and a 10-line quickstart.
J4) Golden vectors (calculator-fast, deterministic)
All identities are lane-only; classical values remain untouched: phi((m,a)) = m. Use float64 as reference.
# V1 — clamp + round-trip a_in = 0.9999999; eps_a = 1e-6 a_c = 0.999999 # u := atanh(a_c) finite; tanh(u) ≈ 0.999999 within tolerance # V2 — fuse invariance (order/shard) a1 = tanh(0.2) = 0.197375 a2 = tanh(0.4) = 0.379949 U = 0.2 + 0.4 = 0.6; W = 2 a_out = tanh(U/W) = tanh(0.3) = 0.291313 # swap/shard -> identical # V3 — lane mul/div (M2) a1 = tanh(0.5) = 0.462117; a2 = tanh(0.2) = 0.197375 a_mul = tanh(0.5 + 0.2) = 0.604368 a_div = tanh(0.5 - 0.2) = 0.291313 # V4 — chooser (bounded index) U_in = -0.2; V_out = +0.5; W_in = 1 RSI = tanh((0.5 - (-0.2))/1) = tanh(0.7) = 0.604368 # V5 — gate modes (alignment-only) RSI = 0.700000; g = 0.81 mul : RSI_env = 0.567000 u_scale : RSI_env = tanh(0.81 * atanh(0.70)) ≈ 0.605961 # V6 — path pooling u_steps = [0.586900, 0.400000, 0.200000]; w = 1 U = 1.186900; W = 3 RSI_path = tanh(U/W) = tanh(0.395633) ≈ 0.375900 # Tolerances float64: 1e-12 ; float32: 1e-5 # bands must match across dtypes
Why these matter (bold checks).
- Boundedness:
|a|<1,|RSI|<1. - Order/shard invariance:
U += w*atanh(a)andW += w⇒ batch == stream == shuffled. - Parity: never edit m (
phi((m,a)) = m).
J5) CI pipeline (4 fast stages)
Make adoption boringly reliable across environments.
- Static checks. Type hints, style, import hygiene.
- Unit tests. Golden vectors + randomized invariance:
# Shuffle test assert fuse(seq) == fuse(random_permutation(seq)) # Shard test U1,W1 = fuse_to_UW(partA); U2,W2 = fuse_to_UW(partB) assert tanh((U1+U2)/max(W1+W2, eps_w)) == fuse(full) # Gate purity RSI_env = apply_gate(RSI, g, mode) assert collapse((m,a)) == m # phi((m,a)) = m
- Determinism pack. Serialize manifest →
knobs_hash := sha256(canonical_json), run a short scenario, replay logs bit-for-bit under sameknobs_hash. - Wheel build + checksum. Build sdist/wheel, compute SHA-256, emit alongside golden CSV.
Pass/Fail gates (must pass). Determinism, boundedness, order/shard invariance, parity.
J6) Quickstart (10 lines)
Drop-in sample proving lens → fuse → chooser → gate in one go.
from math import tanh, atanh
from collections import namedtuple
# 1) lens -> alignment (single contrast; Unit=1, c=1 for demo)
e = (+1.0*0.9 + 0.5*0.6 + 0.4*0.5 - 0.8*0.2 - 0.5*0.1) / 1.0
a = tanh(1.0 * e) # a in (-1,+1)
# 2) fuse multiple cues (order-invariant)
U=W=0.0
for z in [a, tanh(0.3)]:
x = max(-0.999999, min(0.999999, z))
U += atanh(x); W += 1.0
a_pool = tanh(U / max(W, 1e-12))
# 3) chooser + gate (alignment-only)
RSI = tanh((atanh(a_pool) - 0.0) / max(1.0, 1e-12)) # no penalties
g = 0.80
RSI_env = g * RSI # or tanh(g*atanh(RSI))
What you get.
- One bounded chooser (
RSI) with optional gate for readiness. - Deterministic stamps (when you log
U,W,RSI,g). - Classical values untouched via
phi((m,a)) = m.
Navigation
Previous: SSM-AI – Appendix J — SDK Packaging & Golden Tests (J1–J3)
Next: SSM-AI – Appendix J — SDK Packaging & Golden Tests (J7–J9)
Directory of Pages
SSM-AI — Table of Contents