code wiki / _hdl_build / nx_nofloat_muon_ns.nx
nx_nofloat_muon_ns.nx
buildroot/runtime/_hdl_build/nx_nofloat_muon_ns.nx
about
nx_nofloat_muon_ns.nx -- SOVEREIGN no-float Newton-Schulz orthogonalization = the core of the Muon
optimizer (K3 F405 gap; operator 2026-07-19 "beyond SOTA, novel"). Muon = MomentUm Orthogonalized by
Newton-Schulz (Keller Jordan). NS quintic iteration drives a matrix toward its orthogonal polar factor:
X0 = G / ||G||_F (Frobenius-normalize so spectral norm <= 1)
X_{k+1} = a*X + b*(A*X) + c*(A*A*X), A = X*X^T, (a,b,c) = (3.4445, -4.7750, 2.0315)
After ~5 iters X*X^T -> I. Done in PURE INTEGER Q16 (matmul accumulate-then-shift + integer isqrt) =
BIT-EXACT DETERMINISTIC orthogonalization -- a float training stack CANNOT reproduce this bit-for-bit
(non-associative accumulation); that is the novel exceed. Grounded: kellerjordan.github.io/posts/muon.
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 1 imports · 3 importers
imports: nx_syscalls.nx
imported by: nx_nofloat_muon.nxnx_nofloat_muon_gate.nxnx_nofloat_muon_ns_gate.nx
structs
| none |
consts
| 12 | const MN_Q: i64 = 65536 // Q16 one |
| 13 | const MN_QBITS: i64 = 16 |
| 14 | const MN_NMAX: i64 = 8 // max matrix dim supported |
| 16 | const MN_A: i64 = 225755 |
| 17 | const MN_B: i64 = 0 - 312934 |
| 18 | const MN_C: i64 = 133136 |
| 19 | const MN_ITERS: i64 = 5 |
functions
| 22 | func mn_isqrt(v: i64) -> i64 called by 1: mn_orthogonalize_it |
| 30 | func mn_mm(a: *i64, b: *i64, c: *i64, n: i64) -> i64 |
| 46 | func mn_transpose(a: *i64, c: *i64, n: i64) -> i64 |
| 52 | func mn_comb(a: *i64, b: *i64, c: *i64, out: *i64, pa: i64, pb: i64, pc: i64, n: i64) -> i64 called by 1: mn_orthogonalize_it |
| 63 | func mn_orthogonalize_it(g: *i64, x: *i64, n: i64, iters: i64) -> i64 |
| 92 | func mn_orthogonalize(g: *i64, x: *i64, n: i64) -> i64 { return mn_orthogonalize_it(g, x, n, MN_ITERS) } |
| 94 | func mn_ortho_err(x: *i64, n: i64) -> i64 |