code wiki / _hdl_build / nx_nofloat_bpe_gate.nx
nx_nofloat_bpe_gate.nx
buildroot/runtime/_hdl_build/nx_nofloat_bpe_gate.nx
about
nx_nofloat_bpe_gate.nx -- R2 (efficiency) from the sovereign-researcher roadmap
(knowledge/research/2026-06-23-nofloat-affordable-land-roadmap.md, grounded in nfs_bpe.raw): a LEARNED
Byte-Pair-Encoding tokenizer. Greedily merge the most-frequent adjacent token pair K times -> frequent
substrings become single sub-word tokens -> FEWER tokens per text -> cheaper LM training + longer effective
context for the same compute. Pure integer, self-contained (nx_syscalls only).
T1 COMPRESSION: BPE token count << char count (ratio >= 1.4) = the efficiency win.
T2 LOSSLESS (teeth): recursively expand the BPE tokens back to bytes == the original corpus, byte-exact.
T3 learned K real merges (each a repeated pair).
expect_exit: 0 license_tier: ORIGINAL
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_gate_emit_lib.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
| 12 | const STRIDE: i64 = 320 // pair key = a*STRIDE + b (ids stay < 256+K < 320) |
functions
| 15 | func slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } called by 1: main |
| 17 | func expand(tok: i64, ma: *i64, mb: *i64, out: *u8, w: *i64) -> i64 |
| 25 | func main() -> i64 |