code wiki / _hdl_build / nx_nofloat_landing_gate.nx

nx_nofloat_landing_gate.nx

buildroot/runtime/_hdl_build/nx_nofloat_landing_gate.nx

7552 B119 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind gate/prooftopic nofloat
docsdependenciesstructsconstsfunctions

about

nx_nofloat_landing_gate.nx -- THE MEASURED LANDING (roadmap R4 increment; finding 7 = perplexity is the standard cheap held-out metric, nfs_perplexity.raw). A no-float LM is "landed" on a domain when its HELD-OUT per-token cross-entropy reaches the domain's INFORMATION FLOOR (the irreducible entropy) and is far below the uniform baseline. Domain = the grammar [ARTICLE,NOUN,VERB] (fresh-random members), whose intrinsic per-token entropy = avg(ln2, ln3, ln3) ~= 0.964 nats (perplexity ~= 2.62): an article position has 2 equally likely members, noun/verb positions have 3 -- the members are RANDOM so NO model can beat that floor; the uniform-over-vocab baseline is ln(8) = 2.079 nats (perplexity 8). We train on fresh-random streams (so the model learns the GRAMMAR, not sequences) and measure CE on NEVER-SEEN streams. T1 held-out CE << uniform ln(8) (the model beat the baseline = it learned). T2 held-out CE ~= the information floor (near-OPTIMAL = landed: it reached the domain's entropy limit). Pure integer Q16. Sovereign: nx_nofloat_autograd + nx_syscalls. expect_exit: 0

dependencies 3 imports · 0 importers

nx_nofloat_autograd.nx nx_syscalls.nx nx_gate_emit_lib.nx nx_nofloat_landing_gate.nx

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

main g_puts sys_write sys_mmap dini do_train make_stream lcg clm_fwd nfa_leaf nfa_new nfa_embed nfa_new ↻ nfa_rmsnorm_rows nfa_new ↻ nfa_qmul nfa_isqrt nfa_matmul nfa_new ↻ nfa_rope nfa_new ↻ nfa_fxexp nfa_cosf nfa_reduce2pi nfa_cosq nfa_qmul ↻ nfa_sinf nfa_reduce2pi ↻ nfa_sinq nfa_qmul ↻ nfa_qmul ↻ nfa_matmul_nt nfa_new ↻ nfa_cmul nfa_new ↻ nfa_qmul ↻ nfa_softmax_rows nfa_new ↻ nfa_fxexp ↻ nfa_vadd

structs

none

consts

15const Q16: i64 = 65536
17const UNIFORM_MNAT: i64 = 2079
18const FLOOR_MNAT: i64 = 964

functions

21func dini(a: *i64, n: i64, sd: i64) -> i64 { var i: i64=0; while i<n { a[i]=(((i*7+sd*13+1)%11)-5)*13107; i=i+1 } return 0 }
called by 1: main
22func lcg(st: *i64) -> i64 { st[0]=(st[0]*1103515245 + 12345) & 2147483647; return (st[0] >> 15) }
called by 1: make_stream
23func make_stream(S: *i64, tgt: *i64, P: i64, st: *i64) -> i64
called by 2: do_traineval_ce calls 1: lcg
29func clm_fwd(tape: *i64, vals: *i64, st: *i64, W: *i64, ids: *i64, tgt: *i64, T: i64, dm: i64, V: i64, scale: i64, leaves: *i64) -> i64
57func step_all(tape: *i64, grads: *i64, W: *i64, WN: *i64, leaves: *i64, nW: i64, lr: i64, clip: i64, gb: *i64) -> i64
called by 1: do_train calls 2: nfa_gradnfa_sgd
62func do_train(tape: *i64, vals: *i64, grads: *i64, st: *i64, W: *i64, WN: *i64, S: *i64, tgt: *i64, P: i64, dm: i64, V: i64, scale: i64, leaves: *i64, gb: *i64, steps: i64, sdat: *i64) -> i64
68func eval_ce(tape: *i64, vals: *i64, st: *i64, W: *i64, S: *i64, tgt: *i64, P: i64, dm: i64, V: i64, scale: i64, leaves: *i64, N: i64, sdat: *i64) -> i64
called by 1: main calls 3: make_streamclm_fwdnfa_val
80func main() -> i64