code wiki / _hdl_build / nx_mt_r3_gate.nx
nx_mt_r3_gate.nx
buildroot/runtime/_hdl_build/nx_mt_r3_gate.nx
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
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
structs
| none |
consts
| 32 | const M3_LOG: *u8 = "knowledge/status/mt_r3.log" |
| 34 | const C_G: *u8 = "g" as *u8 |
| 35 | const C_O: *u8 = "o" as *u8 |
| 36 | const C_S: *u8 = "s" as *u8 |
| 37 | const C_E: *u8 = "e" as *u8 |
| 38 | const C_A: *u8 = "a" as *u8 |
| 39 | const C_T: *u8 = "t" as *u8 |
| 40 | const C_EA: *u8 = "ea" as *u8 |
| 41 | const C_SEA: *u8 = "sea" as *u8 |
| 42 | const C_TEA: *u8 = "tea" as *u8 |
| 43 | const C_GO: *u8 = "go" as *u8 |
| 44 | const C_SEAT: *u8 = "seat" as *u8 |
| 45 | const C_MAR: *u8 = "mar" as *u8 |
| 46 | const C_TE: *u8 = "te" as *u8 |
| 47 | const C_IR: *u8 = "ir" as *u8 |
functions
| 49 | func 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 } |
| 50 | func m3_wn(fd: i64, v: i64) -> i64 |
| 60 | func m3_streq(a: *u8, la: i64, b: *u8, lb: i64) -> i64 |
| 69 | func m3_translate(v_en: *NxBpeVocab, v_es: *NxBpeVocab, W: *i64, S: i64, T: i64, text: *u8, tlen: i64, out: *u8) -> i64 |
| 80 | func m3_check(v_en: *NxBpeVocab, v_es: *NxBpeVocab, W: *i64, S: i64, T: i64, text: *u8, tlen: i64, expect: *u8, elen: i64) -> i64 |
| 87 | func m3_demo(fd: i64, v_en: *NxBpeVocab, v_es: *NxBpeVocab, W: *i64, S: i64, T: i64, text: *u8, tlen: i64) -> i64 |
| 95 | func m3_emit(fd: i64, r: *i64) -> i64 |
| 105 | func main() -> i64 |