SSM-AI – Integration Quickstarts: CI/Golden Tests (8.4)

One command to prove parity, boundedness, and invariance.

What to test automatically
Collapse parity: phi((m,a)) = m across the whole pipeline.
Order/shard invariance: batch vs stream vs shuffled produce identical RSI/RSI_path (within tolerance).
Clamp discipline: all inputs to atanh respect |a| < 1 via a_c := clamp(a, -1+eps_a, +1-eps_a).
Band boundaries: exact hits at +0.90, +0.60, -0.60, -0.90 map to the right labels with hysteresis if declared.
Gate purity: toggling g_t only scales alignment (RSI_env), never m.
Division policy: under "strict", near-zero denominators trigger fallback to classical selection (no lane-based actuation).

# Skeleton test harness (CLI gist)

# 1) Load manifest.json and decisions.csv (stamped)
manifest := load_json("manifest.json")
rows     := read_csv("decisions.csv")

# 2) Recompute RSI / RSI_env / band
for r in rows:
  # clamp before atanh
  a_in  := clamp(r.a_in , -1+manifest.eps_a, +1-manifest.eps_a)
  a_out := clamp(r.a_out, -1+manifest.eps_a, +1-manifest.eps_a)

  U_in  := r.w * atanh(a_in)
  V_out := r.w * atanh(a_out)
  W     := r.w

  RSI := (0.0 if W<=0 else tanh((V_out - U_in)/max(W, manifest.eps_w)))
  RSI_env := (tanh(r.g_t * atanh(RSI)) if manifest.gate.mode=="u_scale" else r.g_t * RSI)

  assert phi(r.m, r.a) == r.m           # collapse parity
  assert abs(RSI_env) < 1               # boundedness
  assert to_band(RSI_env) == r.band     # bands with thresholds/hysteresis

# 3) Shuffle & shard
RSI_batch   := rsi_from(rows)
RSI_stream  := rsi_stream(rows)         # accumulate U,W in order
RSI_sharded := rsi_from(shard_merge(rows))  # sum U/W per shard and merge
assert close(RSI_batch, RSI_stream) and close(RSI_batch, RSI_sharded)

# 4) Toggle gate g_t; confirm only RSI_env changes (m untouched)
for r in rows:
  old := RSI_env(r)
  r.g_t := 0.5
  new := RSI_env(r)
  assert r.m == phi(r.m, r.a)           # still equal
  assert old != new                     # gate affects only alignment

# 5) Division policy guard (if ratios present)
if manifest.division_policy == "strict" and abs(r.m_den) <= manifest.eps_div:
  assert r.actuation_used_lane == False

# 6) Emit PASS/FAIL + manifest knobs hash
print("PASS" if all_checks_ok else "FAIL", "knobs_hash=", sha256(canonical_json(manifest.knobs)))

Artifacts to keep in repo
Golden vectors (tiny CSV) for each surface (decoding, RAG, tools/agents).
Manifest template with eps_a, eps_w, c, gamma, bands, division_policy, gate.mode.
Stamp verifier (≈100-line script) that replays RSI := tanh((V_out - U_in)/max(W, eps_w)) and checks bands.
Tolerance policy (doc): print to 6 decimals; define close(x,y) using dtype-aware eps.

# Parity & invariance identities to assert
a_c := clamp(a, -1+eps_a, +1-eps_a)
U += w*atanh(a_c);  W += w
a_out := tanh( U / max(W, eps_w) )

# Invariance:
RSI_batch == RSI_stream == RSI_sharded    # within tolerance

# Gate purity:
RSI_env := g_t * RSI
# or curvature-preserving:
RSI_env := tanh( g_t * atanh(RSI) )

# Always:
phi((m,a)) = m

One-line takeaway. Ship with confidence: a small golden-test harness that enforces collapse parity, order/shard invariance, strict clamps, and gate purity proves that your bounded chooser is correct — with classical magnitudes untouched via phi((m,a)) = m.


Navigation
Previous: SSM-AI – Integration Quickstarts: Agents/Tools Middleware (8.3)
Next: SSM-AI – Appendix A — Gate Presets & Acceptance


Directory of Pages
SSM-AI — Table of Contents