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 2 imports · 3 importers
imports: nx_syscalls.nxnx_vecmath.nx
imported by: nx_nofloat_muon.nxnx_nofloat_muon_gate.nxnx_nofloat_muon_ns_gate.nx
structs
| none |
consts
| 13 | const MN_Q: i64 = 65536 // Q16 one |
| 14 | const MN_QBITS: i64 = 16 |
| 15 | const MN_NMAX: i64 = 8 // max matrix dim supported |
| 17 | const MN_A: i64 = 225755 |
| 18 | const MN_B: i64 = 0 - 312934 |
| 19 | const MN_C: i64 = 133136 |
| 20 | const MN_ITERS: i64 = 5 |
functions
| 23 | func mn_isqrt(v: i64) -> i64 { return vm_isqrt(v) } |
| 25 | func mn_mm(a: *i64, b: *i64, c: *i64, n: i64) -> i64 |
| 41 | func mn_transpose(a: *i64, c: *i64, n: i64) -> i64 |
| 47 | 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 |
| 58 | func mn_orthogonalize_it(g: *i64, x: *i64, n: i64, iters: i64) -> i64 |
| 87 | func mn_orthogonalize(g: *i64, x: *i64, n: i64) -> i64 { return mn_orthogonalize_it(g, x, n, MN_ITERS) } |
| 89 | func mn_ortho_err(x: *i64, n: i64) -> i64 |