code wiki / _hdl_build / nx_ssm_gate.nx
nx_ssm_gate.nx
buildroot/runtime/_hdl_build/nx_ssm_gate.nx
about
nx_ssm_gate.nx -- GATE for SSM-001: the CAUSAL state-space mixer (the autoregressive sub-quadratic lane,
vs FNet's bidirectional encoder lane). Proves, by RUNNING:
G1 GRADCHECK through the autograd: x[4,2] + learnable decay a[2] -> ta_ssm -> mse(.,target); analytic
gradients for BOTH the input dx AND the decay da (backprop-through-time) vs central finite difference
(h=1/128, rel<1/32 floor 1/64). Proves the reverse-scan backward is correct.
G2 CAUSALITY: perturbing the input at the LAST time step leaves every EARLIER output unchanged, and
changes only the last output -- i.e. the operator's Jacobian is lower-triangular (y_t sees only x_<=t).
This is what FNet cannot do and what autoregressive generation requires.
Evidence -> knowledge/status/ssm.log (SSMGATE authored=organ ... verdict=GREEN). license_tier: ORIGINAL
dependencies 2 imports · 0 importers
imports: nx_autograd_tensor.nxnx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 14 | const SS_N: i64 = 4 |
| 15 | const SS_D: i64 = 2 |
| 16 | const SS_ND: i64 = 8 |
| 17 | const SS_LOG: *u8 = "knowledge/status/ssm.log" |
functions
| 19 | func ss_w(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 } |
| 20 | func ss_wn(fd: i64, v: i64) -> i64 |
| 31 | func ss_build(tape: *i64, vals: *i64, st: *i64, a: *i64, x: *i64, target: *i64, ax: *i64) -> i64 |
| 41 | func ss_loss(tape: *i64, vals: *i64, st: *i64, a: *i64, x: *i64, target: *i64) -> i64 |
| 47 | func ss_forward(tape: *i64, vals: *i64, st: *i64, a: *i64, x: *i64, yout: *i64) -> i64 |
| 57 | func main() -> i64 |