code wiki / _hdl_build / nx_mt_r3_gate.nx

nx_mt_r3_gate.nx

buildroot/runtime/_hdl_build/nx_mt_r3_gate.nx

9918 B206 linesdepth 6pulls 14 transitivereach 0 importersview sourcekind gate/prooftopic mt
docsdependenciesstructsconstsfunctions

about

nx_mt_r3_gate.nx -- GATE for MT-R3: REAL TEXT via the production BPE tokenizer (nx_bpe). The MT arc moves off hand-coded integer toy indices: input/output are now actual TEXT STRINGS, tokenized to subword IDs by the team's shipped Byte-Pair-Encoding organ and detokenized back. The learned word-map (proven in R0/R1/R2, reused from nx_mt_core) maps EN token IDs -> ES token IDs in between. This is the text-interface bookend the rest of the arc needs; it does NOT yet do open-vocabulary sentence MT (that's R4: real corpus / trained weights). Sovereign self-contained vocab (no external files; nx_bpe builds vocab in-code): EN (with merges, so encoding is real BPE): bytes g o s e a t ; merges (e,a)->ea, (s,ea)->sea, (t,ea)->tea, (g,o)->go. Words: "sea" "tea" "go" each encode to ONE token; "ea" is a SHARED subword of sea/tea. Out-of-vocab "seat" decomposes to known subwords [sea, t]. ES (decode side): whole-word tokens "mar" "te" "ir". translation map (learned via nx_mt_core): sea->mar, tea->te, go->ir. FOUR GATES: A BPE ROUND-TRIP: decode(encode(x)) == x byte-exact for "sea","tea","go". B SUBWORD DECOMPOSITION (the BPE value): encode("seat") == [sea, t] (OOV word -> known subwords) and round-trips byte-exact -- a hand-coded index table cannot do this. C END-TO-END TEXT TRANSLATE: translate("sea")=="mar", translate("tea")=="te", translate("go")=="ir" (real string in, real string out; 3/3). D UNTRAINED FAILS (liar-kill): the zero-epoch map mistranslates (< 3/3) -> the LEARNED map does the translating, not the tokenizer. genealogy_id: sennrich_haddow_birch_2016_bpe (realized_in nx_bpe) + rumelhart_1986_backprop lineage_id: sovereign_neural_mt_r3_bpe_realtext_v1 license_tier: ORIGINAL

dependencies 4 imports · 0 importers

nx_bpe.nx nx_mt_core.nx nx_autograd.nx nx_syscalls.nx nx_mt_r3_gate.nx

imports: nx_bpe.nxnx_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

main nx_bpe_vocab_new sys_mmap nx_intern_new nx_intern_next_pow2 nx_hash_new nx_bpe_add_token nx_intern_get nx_hash_fnv1a_bytes nx_hash_get nx_hash_probe nx_hash_fnv1a_i64 nx_intern_bytes_eq nx_hash_put nx_hash_probe ↻ nx_bpe_add_merge sys_mmap ↻ mt_train sys_mmap ↻ ag_leaf ag_sub ag_mk nx_f32_sub nx_f32_add nx_f32_classify nx_f32_exp_field nx_f32_mant_field 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 ↻

structs

none

consts

32const M3_LOG: *u8 = "knowledge/status/mt_r3.log"
34const C_G: *u8 = "g" as *u8
35const C_O: *u8 = "o" as *u8
36const C_S: *u8 = "s" as *u8
37const C_E: *u8 = "e" as *u8
38const C_A: *u8 = "a" as *u8
39const C_T: *u8 = "t" as *u8
40const C_EA: *u8 = "ea" as *u8
41const C_SEA: *u8 = "sea" as *u8
42const C_TEA: *u8 = "tea" as *u8
43const C_GO: *u8 = "go" as *u8
44const C_SEAT: *u8 = "seat" as *u8
45const C_MAR: *u8 = "mar" as *u8
46const C_TE: *u8 = "te" as *u8
47const C_IR: *u8 = "ir" as *u8

functions

49func m3_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 3: m3_demom3_emitmain calls 1: sys_write
50func m3_wn(fd: i64, v: i64) -> i64
called by 1: m3_emit calls 2: sys_mmapsys_write
60func m3_streq(a: *u8, la: i64, b: *u8, lb: i64) -> i64
called by 2: m3_checkmain
69func m3_translate(v_en: *NxBpeVocab, v_es: *NxBpeVocab, W: *i64, S: i64, T: i64, text: *u8, tlen: i64, out: *u8) -> i64
80func m3_check(v_en: *NxBpeVocab, v_es: *NxBpeVocab, W: *i64, S: i64, T: i64, text: *u8, tlen: i64, expect: *u8, elen: i64) -> i64
called by 1: main calls 3: sys_mmapm3_translatem3_streq
87func m3_demo(fd: i64, v_en: *NxBpeVocab, v_es: *NxBpeVocab, W: *i64, S: i64, T: i64, text: *u8, tlen: i64) -> i64
95func m3_emit(fd: i64, r: *i64) -> i64
called by 1: main calls 2: m3_wm3_wn
105func main() -> i64