code wiki / _hdl_build / nx_mt_r1_gate.nx
nx_mt_r1_gate.nx
buildroot/runtime/_hdl_build/nx_mt_r1_gate.nx
about
nx_mt_r1_gate.nx -- GATE for MT-R1: SEQUENCES. Proves, by RUNNING, that the sovereign MT core
(nx_mt_core) translates multi-token SEQUENCES with a SHARED, position-independent learned
word-map -- and that the map GENERALIZES to HELD-OUT sentences it was never trained on. This
is the seq2seq plumbing + the no-overfit test harness the rest of the arc rides on; R0 proved
the single-token atom, R2 will add cross-token CONTEXT (reordering) via fnet_mix.
Dictionary (EN->ES), target indices are a PERMUTATION (not identity): tgt_map=[2,0,5,1,3,4].
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
TRAIN = 4 sentences x 3 tokens, arranged so EVERY word occurs EXACTLY TWICE (m=2) -> with
lr=1/8 the GD factor (1-2*lr*m)=0.5 is stable+monotone for all weights. HELD-OUT = 3 sentences
whose token TRIPLES never appear in training (novel combinations of the same vocab).
FOUR GATES:
A LEARNS (train set): per-token acc == all-train-tokens, sum-loss < 1/1000, loss decreased.
B GENERALIZES (held-out): per-token acc == all-held-tokens on sentences NEVER trained ->
the shared map is compositional/position-independent, not a per-sentence memorization.
C BIT-EXACT: retrain from zero-init -> identical W bits.
D UNTRAINED FAILS (liar-kill): zero-epoch model scores < all-held-tokens on held-out.
genealogy_id: rumelhart_1986_backprop (realized_in nx_autograd)
lineage_id: sovereign_neural_mt_r1_sequences_v1
license_tier: ORIGINAL
dependencies 3 imports · 0 importers
imports: nx_mt_core.nxnx_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
structs
| none |
consts
| 29 | const MR_LOG: *u8 = "knowledge/status/mt_r1.log" |
| 30 | const MR_S: i64 = 6 |
| 31 | const MR_T: i64 = 6 |
| 32 | const MR_L: i64 = 3 // sequence length |
| 34 | const EN0: *u8 = "hello" as *u8 |
| 35 | const EN1: *u8 = "family" as *u8 |
| 36 | const EN2: *u8 = "love" as *u8 |
| 37 | const EN3: *u8 = "good" as *u8 |
| 38 | const EN4: *u8 = "day" as *u8 |
| 39 | const EN5: *u8 = "water" as *u8 |
| 40 | const ES0: *u8 = "familia" as *u8 |
| 41 | const ES1: *u8 = "bueno" as *u8 |
| 42 | const ES2: *u8 = "hola" as *u8 |
| 43 | const ES3: *u8 = "dia" as *u8 |
| 44 | const ES4: *u8 = "agua" as *u8 |
| 45 | const ES5: *u8 = "amor" as *u8 |
| 46 | const ESQ: *u8 = "?" as *u8 |
functions
| 48 | func mr_en(i: i64) -> *u8 called by 1: mr_demo |
| 57 | func mr_es(j: i64) -> *u8 called by 1: mr_demo |
| 67 | func mr_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 } |
| 68 | func mr_wn(fd: i64, v: i64) -> i64 |
| 78 | func mr_f32_to_milli(v: i64) -> i64 |
| 97 | func mr_demo(fd: i64, W: *i64, held_src: *i64, n_held: i64) -> i64 |
| 111 | func mr_emit(fd: i64, r: *i64) -> i64 |
| 124 | func main() -> i64 |