code wiki / _hdl_build / nx_train_r3_gate.nx
nx_train_r3_gate.nx
buildroot/runtime/_hdl_build/nx_train_r3_gate.nx
about
nx_train_r3_gate.nx -- GATE for TRAIN-R3 (T7): softmax + cross-entropy + nonlinear training. Proves, by RUNNING:
A GRADCHECK the new ops: softmax-cross-entropy (dlogits = softmax - onehot) AND standalone softmax
(Jacobian-vector product), analytic vs central finite difference (h=1/128, rel<1/32 floor 1/64).
B TRAIN A NONLINEAR CLASSIFIER -- XOR: a 2->8(relu)->2 MLP with a softmax-CE head and a DETERMINISTIC
symmetry-breaking init, trained by AdamW. XOR is the canonical proof that a LINEAR model CANNOT solve
it -- reaching 4/4 correct demonstrates real nonlinear learning. Assert accuracy==4 AND loss decreased.
C BIT-EXACT: train twice from the same init -> identical final bits for all 42 parameters.
Evidence -> knowledge/status/train_r3.log (TRAINR3GATE 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
| 13 | const T3_LOG: *u8 = "knowledge/status/train_r3.log" |
functions
| 15 | func t3_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 } |
| 16 | func t3_wn(fd: i64, v: i64) -> i64 |
| 28 | func g_softce_loss(tape: *i64, vals: *i64, st: *i64, lg: *i64, tg: *i64) -> i64 |
| 35 | func g_softce_grads(tape: *i64, vals: *i64, grads: *i64, st: *i64, lg: *i64, tg: *i64, gout: *i64) -> i64 |
| 45 | func g_smax_loss(tape: *i64, vals: *i64, st: *i64, x: *i64, tg: *i64) -> i64 |
| 53 | func g_smax_grads(tape: *i64, vals: *i64, grads: *i64, st: *i64, x: *i64, tg: *i64, gout: *i64) -> i64 |
| 65 | func g_gc3(tape: *i64, vals: *i64, grads: *i64, st: *i64, base: *i64, tg: *i64, kind: i64, worst: *i64) -> i64 |
| 99 | func g_xor_build(tape: *i64, vals: *i64, st: *i64, p: *i64, xs: *i64, ts: *i64, c4: *i64, wb: *i64) -> i64 |
| 121 | func g_read42(tape: *i64, grads: *i64, wb: *i64, g: *i64) -> i64 |
| 132 | func g_xor_predict(tape: *i64, vals: *i64, st: *i64, p: *i64, xs: *i64, s: i64) -> i64 |
| 145 | func g_xor_init(p: *i64) -> i64 |
| 155 | func g_xor_train(tape: *i64, vals: *i64, grads: *i64, st: *i64, xs: *i64, ts: *i64, epochs: i64, pout: *i64, lf: *i64, ll: *i64) -> i64 |
| 201 | func main() -> i64 |