code wiki / _hdl_build / nx_nofloat_adamw_gate.nx
nx_nofloat_adamw_gate.nx
buildroot/runtime/_hdl_build/nx_nofloat_adamw_gate.nx
about
nx_nofloat_adamw_gate.nx -- HARD-EVIDENCE gate for the Q16 AdamW optimizer (nfa_adamw), with a MEASURED
exceed over plain SGD. On an ILL-CONDITIONED linear regression (two features of very different scales:
col0 ~ O(1), col1 ~ O(1/40)), one global SGD learning-rate either crawls on the small-curvature direction
or diverges on the large one. AdamW normalizes each parameter's step by its own running gradient scale, so
it converges FAR faster. Pure integer Q16 -> bit-exact/deterministic.
T1 AdamW converges : from zero, AdamW drives the SSE loss to ~0 (it works).
T2 MEASURED exceed : at the SAME step budget, AdamW's final loss is MUCH lower than tuned SGD's
(and AdamW reaches the loss threshold in FAR fewer steps). Numbers printed.
T3 SGD really struggles: SGD's final loss on this conditioning stays high (the problem is genuinely hard
for one global rate) -- so T2 is a real win, not a strawman.
T4 bit-exact : two AdamW runs give IDENTICAL integer weights (determinism).
Evidence -> knowledge/status/nofloat_adamw.log. Sovereign: nx_nofloat_autograd + nx_syscalls. expect_exit: 0
dependencies 3 imports · 0 importers
imports: nx_nofloat_autograd.nxnx_syscalls.nxnx_gate_emit_lib.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
| 19 | const ALOG: *u8 = "knowledge/status/nofloat_adamw.log" |
| 20 | const Q16: i64 = 65536 |
functions
| 23 | func a_ws(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 } |
| 24 | func a_wn(fd: i64, v: i64) -> i64 { let b: *u8=sys_mmap(28); var m: i64=v; if m<0{sys_write(fd,"-" as *u8,1);m=0-m} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{b[i]=t[k-1-i];i=i+1} sys_write(fd,b,k); return 0 } |
| 27 | func reg_grad(tape: *i64, vals: *i64, grads: *i64, st: *i64, Wp: *i64, X: *i64, Y: *i64, T: i64, g: *i64) -> i64 |
| 45 | func main() -> i64 |