nx_reader_squad_f32_gate.nx
buildroot/runtime/nx_reader_squad_f32_gate.nx
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
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
structs
| 214 | struct RfCtx |
consts
| 21 | const RF_E: i64 = 24 |
| 22 | const RF_F: i64 = 48 |
| 23 | const RF_MAXT: i64 = 96 |
| 24 | const RF_MAXQ: i64 = 20 |
| 25 | const RF_MAXG: i64 = 8 |
| 28 | const RF_XL: i64 = 1 |
| 32 | const RF_PAR: i64 = 1 |
| 33 | const RF_BATCH: i64 = 8 |
| 40 | const RF_CAUSAL: i64 = 1 |
| 41 | const RF_NROWS: i64 = 4800 |
| 42 | const RF_MAXV: i64 = 16384 |
| 43 | const RF_MAPN: i64 = 32768 |
| 44 | const FOFF_EMB: i64 = 0 |
| 45 | const FOFF_WQ: i64 = 393216 |
| 46 | const FOFF_WK: i64 = 393792 |
| 47 | const FOFF_WV: i64 = 394368 |
| 48 | const FOFF_WO: i64 = 394944 |
| 49 | const FOFF_WG: i64 = 395520 |
| 50 | const FOFF_WU: i64 = 396672 |
| 51 | const FOFF_WD: i64 = 397824 |
| 52 | const FOFF_US: i64 = 398976 |
| 53 | const FOFF_UE: i64 = 399000 |
| 54 | const RF_NP: i64 = 399024 |
| 231 | const RF_CTX_BYTES: i64 = 120 |
| 343 | const RF_CKMAGIC: i64 = 20262 |
| 344 | const RF_CKCELLS: i64 = 6 + RF_NP + RF_NP |
functions
| 17 | func 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 } |
| 18 | func 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 } |
| 19 | func 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 } |
| 57 | func 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 |
| 58 | func rf_ck_path() -> *u8 { if RF_XL == 1 { return "knowledge/index/rsqf32xl_ckpt.bin" as *u8 } return "knowledge/index/rsqf32_ckpt.bin" as *u8 } |
| 59 | func 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 |
| 60 | func 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 |
| 62 | func rf_ehash(buf: *u8, off: i64, len: i64) -> i64 called by 1: rf_tok |
| 69 | func rf_bsearch(a: *i64, n: i64, v: i64) -> i64 called by 1: main |
| 75 | func rf_lc(c: i64) -> i64 { if c >= 65 { if c <= 90 { return c + 32 } } return c } called by 1: rf_tok |
| 76 | func 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 |
| 77 | func rf_tok(buf: *u8, n: i64, hout: *i64, cap: i64) -> i64 |
| 99 | func rf_vid(map: *i64, vhash: *i64, vst: *i64, h: i64) -> i64 called by 1: main |
| 122 | func 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 called by 3: rf_par_taskrf_evalrf_train calls 14: nx_f32_divnx_f32_sqrtnx_i32_to_f32ta_leafta_rmsnorm_rowsta_matmul+8 |
| 181 | func rf_grab(tape: *i64, grads: *i64, out: *i64, G: *i64, ids: *i64, T: i64) -> i64 |
| 235 | func rf_par_task(ctx_i: i64) -> i64 |
| 262 | func rf_init(W: *i64) -> i64 |
| 272 | func rf_span_f1(ids: *i64, a: i64, b: i64, gs: i64, ge: i64) -> i64 |
| 295 | func 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 |
| 346 | func rf_ck_flush(ck: *i64) -> i64 called by 2: rf_trainmain calls 6: sys_openat_wrrf_ck_part_pathsys_writesys_closesys_renameatrf_ck_path |
| 362 | func rf_ck_load(ck: *i64, nw: i64) -> i64 |
| 378 | func 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 called by 1: main calls 22: sys_mmapta_constfnx_i32_to_f32nx_f32_negnx_pool_newnx_pool_n_completed+16 |
| 498 | func main() -> i64 |