code wiki / (root) / nx_reader_squad_f32_gate.nx

nx_reader_squad_f32_gate.nx

buildroot/runtime/nx_reader_squad_f32_gate.nx

33570 B708 linesdepth 7pulls 21 transitivereach 0 importersview sourcekind gate/prooftopic reader
docsdependenciesstructsconstsfunctions

about

nx_reader_squad_f32_gate.nx -- R3e of the NEURAL PASSAGE READER arc: TRAIN-ON-F32 (quantize-after comes next). The Q16 lane closed honestly: 6 configurations all entered the uniform-collapse absorbing state at E=24 (see nx_reader_squad_gate). f32 has no quantization floor and no bit-identical-states trap, so the SAME architecture + data + recipe should train. This gate = the Q16 gate ported to the ta_* f32 tensor autograd (transformer ops added 2026-07-09, identities verbatim from the GREEN nfa_* lib). T1 reader held-out span-F1 > question-blind ablation + 100 (liar-kill) T2 reader held-out exact-start > 60 permille (chance ~11) T3 train loss falls > 40% (real learning, no collapse) T4 deterministic re-eval Consumes: reader_rows.bin ('dt'), semppmi_v1.bin (vocab), embed_v1.bin (SGNS Q10 -> f32 RAW magnitude). expect_exit: 0 license_tier: ORIGINAL Sovereign: nx_autograd_tensor (f32) + nx_syscalls.

dependencies 4 imports · 0 importers

nx_autograd_tensor.nx nx_thread_pool.nx nx_hw.nx nx_syscalls.nx nx_reader_squad_f32_gate.nx

imports: nx_autograd_tensor.nxnx_thread_pool.nxnx_hw.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 rf_puts sys_write sys_openat_rd rf_rows_path sys_mmap sys_read sys_close rf_pn sys_mmap ↻ sys_write ↻ rf_tok sys_mmap ↻ rf_lc rf_isal rf_ehash rf_vid rf_ck_load sys_openat_rd ↻ rf_ck_path sys_read ↻ sys_close ↻ nx_i32_to_f32 rf_bsearch nx_f32_div nx_f32_classify nx_f32_exp_field nx_f32_mant_field nx_f32_sign nx_f32_mant_field ↻ nx_f32_exp_field ↻ ta_constf nx_f32_div ↻ nx_i32_to_f32 ↻ rf_init ta_constf ↻ rf_ck_flush sys_openat_wr rf_ck_part_path sys_write ↻

structs

214struct RfCtx

consts

21const RF_E: i64 = 24
22const RF_F: i64 = 48
23const RF_MAXT: i64 = 96
24const RF_MAXQ: i64 = 20
25const RF_MAXG: i64 = 8
28const RF_XL: i64 = 1
32const RF_PAR: i64 = 1
33const RF_BATCH: i64 = 8
40const RF_CAUSAL: i64 = 1
41const RF_NROWS: i64 = 4800
42const RF_MAXV: i64 = 16384
43const RF_MAPN: i64 = 32768
44const FOFF_EMB: i64 = 0
45const FOFF_WQ: i64 = 393216
46const FOFF_WK: i64 = 393792
47const FOFF_WV: i64 = 394368
48const FOFF_WO: i64 = 394944
49const FOFF_WG: i64 = 395520
50const FOFF_WU: i64 = 396672
51const FOFF_WD: i64 = 397824
52const FOFF_US: i64 = 398976
53const FOFF_UE: i64 = 399000
54const RF_NP: i64 = 399024
231const RF_CTX_BYTES: i64 = 120
343const RF_CKMAGIC: i64 = 20262
344const RF_CKCELLS: i64 = 6 + RF_NP + RF_NP

functions

17func rf_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 3: rf_ckrf_trainmain calls 1: sys_write
18func rf_pn(v: i64) -> i64 { let b: *u8=sys_mmap(28); var x: i64=v; if x<0{b[0]=45;sys_write(1,b,1);x=0-x} if x==0{b[0]=48;sys_write(1,b,1);return 0} var d: i64=0; var y: i64=x; while y>0{d=d+1;y=y/10} var i: i64=d-1; y=x; while i>=0{b[i]=(48+(y%10)) as u8;y=y/10;i=i-1} sys_write(1,b,d); return 0 }
called by 2: rf_trainmain calls 2: sys_mmapsys_write
19func rf_ck(name: *u8, c: i64) -> i64 { if c==1 { rf_puts(" PASS " as *u8) } else { rf_puts(" FAIL " as *u8) } rf_puts(name); rf_puts("\n" as *u8); return c }
called by 1: main calls 1: rf_puts
57func rf_rows_path() -> *u8 { if RF_XL == 1 { return "knowledge/index/reader_rows_xl.bin" as *u8 } return "knowledge/index/reader_rows.bin" as *u8 }
called by 1: main
58func rf_ck_path() -> *u8 { if RF_XL == 1 { return "knowledge/index/rsqf32xl_ckpt.bin" as *u8 } return "knowledge/index/rsqf32_ckpt.bin" as *u8 }
59func rf_ck_part_path() -> *u8 { if RF_XL == 1 { return "knowledge/index/rsqf32xl_ckpt.bin.part" as *u8 } return "knowledge/index/rsqf32_ckpt.bin.part" as *u8 }
called by 1: rf_ck_flush
60func rf_persist_path() -> *u8 { if RF_XL == 1 { return "knowledge/index/reader_neural_f32xl.bin" as *u8 } return "knowledge/index/reader_neural_f32.bin" as *u8 }
called by 1: main
62func rf_ehash(buf: *u8, off: i64, len: i64) -> i64
called by 1: rf_tok
69func rf_bsearch(a: *i64, n: i64, v: i64) -> i64
called by 1: main
75func rf_lc(c: i64) -> i64 { if c >= 65 { if c <= 90 { return c + 32 } } return c }
called by 1: rf_tok
76func rf_isal(c: i64) -> i64 { if c >= 97 { if c <= 122 { return 1 } } if c >= 48 { if c <= 57 { return 1 } } return 0 }
called by 1: rf_tok
77func rf_tok(buf: *u8, n: i64, hout: *i64, cap: i64) -> i64
called by 1: main calls 4: sys_mmaprf_lcrf_isalrf_ehash
99func rf_vid(map: *i64, vhash: *i64, vst: *i64, h: i64) -> i64
called by 1: main
122func rf_fwd(tape: *i64, vals: *i64, st: *i64, W: *i64, Xg: *i64, tgts: *i64, tgte: *i64, T: i64, useattn: i64, out: *i64, rtab: *i64) -> i64
181func rf_grab(tape: *i64, grads: *i64, out: *i64, G: *i64, ids: *i64, T: i64) -> i64
called by 2: rf_par_taskrf_train calls 1: nx_f32_add
235func rf_par_task(ctx_i: i64) -> i64
262func rf_init(W: *i64) -> i64
called by 1: main calls 1: ta_constf
272func rf_span_f1(ids: *i64, a: i64, b: i64, gs: i64, ge: i64) -> i64
called by 1: rf_eval calls 1: sys_mmap
295func rf_eval(tape: *i64, vals: *i64, st: *i64, W: *i64, dat: *i64, meta: *i64, r0: i64, r1: i64, useattn: i64, res: *i64, rtab: *i64) -> i64
346func rf_ck_flush(ck: *i64) -> i64
362func rf_ck_load(ck: *i64, nw: i64) -> i64
378func rf_train(tape: *i64, vals: *i64, grads: *i64, st: *i64, W: *i64, dat: *i64, meta: *i64, ntrain: i64, useattn: i64, EP: i64, res0: *i64, ck: *i64, ckslot: i64, ep0: i64, rtab: *i64) -> i64
498func main() -> i64