code wiki / _hdl_build / nx_mt_r0_gate.nx

nx_mt_r0_gate.nx

buildroot/runtime/_hdl_build/nx_mt_r0_gate.nx

11512 B271 linesdepth 5pulls 7 transitivereach 0 importersview sourcekind gate/prooftopic mt
docsdependenciesstructsconstsfunctions

about

nx_mt_r0_gate.nx -- GATE for MT-R0: the first rung of the SOVEREIGN NEURAL MACHINE TRANSLATION arc (GEN-WL-WL-NN-TRANSLATION). Proves, by RUNNING, that a sovereign neural net LEARNS to translate -- from random/zero init via the team's own scalar-tape autograd, NOT a hardcoded table. The trainable atom of neural MT = a learned bilingual map: one-hot source word -> linear layer W (the learned parameters) -> output vector -> argmax -> target word. Composes ONLY shipped+gated organs (nx_autograd TRAIN-R1 GREEN + nx_f32 tower). No attention/weights loaded; this is the BACKWARD/learning half proven on a translation task in miniature, the foundation the rest of the arc (sequences -> FNet-mix context -> BPE vocab -> corpus -> the /video /translate endpoint) climbs on. Demo dictionary (English -> Spanish), TARGET INDICES ARE A PERMUTATION (not identity) so a pass cannot come from a trivial copy: src EN: 0 hello 1 family 2 love 3 good 4 day 5 water tgt ES: 0 familia 1 bueno 2 hola 3 dia 4 agua 5 amor (vocab in a DIFFERENT order) map: hello->hola(2) family->familia(0) love->amor(5) good->bueno(1) day->dia(3) water->agua(4) => tgt = [2,0,5,1,3,4] (a real permutation the net must LEARN) FOUR GATES: A LEARNS: after training, argmax == tgt for ALL 6 pairs (acc 6/6) AND mean loss < 1/1000 AND loss decreased. The exact statement of "the net learned to translate". B UNTRAINED FAILS (liar-kill): the zero-epoch (W=0) model scores < 6/6 -> the LEARNING did it, not the harness/architecture. C BIT-EXACT REPRODUCIBLE: train twice from zero-init; final W bits identical (determinism exceed-axis carried into ML, like TRAIN-R1 gate C). D DATA-DRIVEN (anti-hardcode liar-kill): train against a DIFFERENT permutation tgt2; the net learns tgt2 (acc_vs_tgt2 == 6/6) AND no longer matches the original (acc_vs_tgt < 6/6). Kills any "the answer was baked in" cheat -- it learns whatever data it is given. genealogy_id: linnainmaa_1970_reverse_mode_ad + rumelhart_1986_backprop (realized_in nx_autograd) lineage_id: sovereign_neural_mt_r0_learned_wordmap_v1 license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_autograd.nx nx_syscalls.nx nx_mt_r0_gate.nx

imports: nx_autograd.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap mt_train sys_mmap ↻ ag_constf nx_f32_div nx_f32_classify nx_f32_exp_field nx_f32_mant_field nx_f32_sign nx_f32_mant_field ↻ nx_f32_exp_field ↻ nx_i32_to_f32 ag_leaf ag_sub ag_mk nx_f32_sub nx_f32_add nx_f32_classify ↻ nx_f32_sign ↻ nx_f32_mant_field ↻ nx_f32_exp_field ↻ nx_f32_neg ag_mul ag_mk ↻ nx_f32_mul nx_f32_classify ↻ nx_f32_sign ↻ nx_f32_mant_field ↻ nx_f32_exp_field ↻ ag_add ag_mk ↻ nx_f32_add ↻ ag_backward nx_f32_add ↻ nx_f32_mul ↻ nx_f32_neg ↻ nx_f32_gt nx_f32_lt nx_f32_is_nan

structs

none

consts

35const MT_LOG: *u8 = "knowledge/status/mt_r0.log"
36const MT_S: i64 = 6 // source vocab size
37const MT_T: i64 = 6 // target vocab size
40const EN0: *u8 = "hello" as *u8
41const EN1: *u8 = "family" as *u8
42const EN2: *u8 = "love" as *u8
43const EN3: *u8 = "good" as *u8
44const EN4: *u8 = "day" as *u8
45const EN5: *u8 = "water" as *u8
46const ES0: *u8 = "familia" as *u8
47const ES1: *u8 = "bueno" as *u8
48const ES2: *u8 = "hola" as *u8
49const ES3: *u8 = "dia" as *u8
50const ES4: *u8 = "agua" as *u8
51const ES5: *u8 = "amor" as *u8
52const ESQ: *u8 = "?" as *u8

functions

54func mt_en(i: i64) -> *u8
called by 1: mt_demo
63func mt_es(j: i64) -> *u8
called by 1: mt_demo
74func mt_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 }
called by 2: mt_demomt_emit calls 1: sys_write
75func mt_wn(fd: i64, v: i64) -> i64
called by 1: mt_emit calls 2: sys_mmapsys_write
86func mt_f32_to_milli(v: i64) -> i64
106func mt_argmax(W: *i64, i: i64) -> i64
called by 2: mt_accuracymt_demo calls 1: nx_f32_gt
119func mt_accuracy(W: *i64, tgt: *i64) -> i64
called by 1: main calls 1: mt_argmax
131func mt_train(epochs: i64, tgt: *i64, Wout: *i64, lfirst: *i64, llast: *i64) -> i64
179func mt_demo(fd: i64, W: *i64) -> i64
called by 1: main calls 4: mt_wmt_argmaxmt_enmt_es
191func mt_emit(fd: i64, r: *i64) -> i64
called by 1: main calls 2: mt_wmt_wn
204func main() -> i64