code wiki / _hdl_build / _t4_first_model_authored.nx

_t4_first_model_authored.nx

buildroot/runtime/_hdl_build/_t4_first_model_authored.nx

27963 B611 linesdepth 6pulls 9 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

_t4_first_model_authored.nx -- T4 of the training-substrate ladder: the FIRST REAL MODEL. Composes the GATED T6/T5 core (nx_tgrad_core.nx, extracted verbatim from _tensor_grad_authored.nx) into two trained models, all bits-up sovereign f32, zero randomness: LANE 1 (nonconvex proof): XOR via a 2-4-1 relu MLP + AdamW, deterministic symmetry-breaking init (the zero-init relu trap documented at T6 is closed by a FIXED pattern table, not RNG -- gate-proven here; the principled-init research row stays open in the roadmap). LANE 2 (REAL TEAM DATA): 8-way service-class model on the ACTUAL elder census (knowledge/status/elder_census.log) -- first 6 name bytes -> {svc,gen,data,orch,worker,mon,util,other}. PARSE ORACLE: the census file carries its own ground truth (CENSUS-SUM per-class counts); the parsed+deduped dataset must match it EXACTLY before training is even attempted. GATES: O census-parse==CENSUS-SUM oracle | G XOR learned (loss<1/100, 4/4 preds within 1/4) | H census train accuracy == services (100%, per-class pred counts == ground truth) | I BIT-EXACT two-run training, BOTH lanes (the standing EXCEED axis). Evidence: loss curve + verdicts appended to knowledge/status/modelwright.log (MODELWRIGHT rows = the role's first durable evidence; the scorecard reads this file). LAWS: struct-free, flat ifs, no &&/||, no unary-minus literals, no randomness. license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_tgrad_core.nx _t4_first_model_authored.nx

imports: nx_tgrad_core.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main _tg_puts sys_write sys_openat_append t4_fp t4_fn sys_now_realtime_sec sys_mmap sys_clock_gettime_real t4_parse sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close t4_match t4_classid t4_tokeq t4_nameq t4_keynum t4_match ↻ t4_bp _tg_puts ↻ t4_fp ↻ t4_bn _tg_num sys_mmap ↻ sys_write ↻ t4_fn ↻ t4_xor_train t4_init nx_f32_neg tg_q nx_f32_div nx_f32_classify nx_f32_exp_field nx_f32_mant_field nx_f32_sign nx_f32_mant_field ↻

structs

none

consts

19const T4_XOR_EPOCHS: i64 = 1500
20const T4_CEN_EPOCHS: i64 = 1500
21const T4_LOG_EVERY: i64 = 100
22const T4_HID: i64 = 24
23const T4_INB: i64 = 8
24const T4_NCLS: i64 = 8
25const T4_MAXSVC: i64 = 200

functions

28func t4_fp(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 }
called by 2: t4_bpmain
29func t4_fn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(fd,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;k=1}; while m>0{t[k]=48+(m%10);m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(fd,bb,k); return 0 }
called by 2: t4_bnmain
31func t4_bp(fd: i64, s: *u8) -> i64 { _tg_puts(s); t4_fp(fd, s); return 0 }
called by 2: t4_cen_trainmain calls 2: _tg_putst4_fp
32func t4_bn(fd: i64, v: i64) -> i64 { _tg_num(v); t4_fn(fd, v); return 0 }
called by 2: t4_cen_trainmain calls 2: _tg_numt4_fn
36func t4_init(p: *i64, n: i64, salt: i64, den: i64) -> i64
47func t4_match(b: *u8, i: i64, n: i64, lit: *u8) -> i64
called by 2: t4_keynumt4_parse
57func t4_tokeq(b: *u8, i: i64, le: i64, lit: *u8) -> i64
called by 1: t4_classid
69func t4_keynum(b: *u8, ls: i64, le: i64, key: *u8) -> i64
called by 1: t4_parse calls 1: t4_match
88func t4_classid(b: *u8, i: i64, le: i64) -> i64
called by 1: t4_parse calls 1: t4_tokeq
99func t4_nameq(a: *u8, b: *u8) -> i64
called by 1: t4_parse
112func t4_parse(cpath: *u8, names: *u8, labels: *i64, sums: *i64) -> i64
183func t4_featurize(names: *u8, labels: *i64, cnt: i64, xs: *i64, ts: *i64) -> i64
called by 1: main calls 3: nx_f32_negtg_qnx_i32_to_f32
210func t4_w1n() -> i64 { return T4_HID * T4_INB }
211func t4_b1o() -> i64 { return t4_w1n() }
called by 2: t4_cen_fwdt4_cen_train calls 1: t4_w1n
212func t4_w2o() -> i64 { return t4_w1n() + T4_HID }
called by 3: t4_b2ot4_cen_fwdt4_cen_train calls 1: t4_w1n
213func t4_b2o() -> i64 { return t4_w2o() + T4_NCLS * T4_HID }
called by 3: t4_tott4_cen_fwdt4_cen_train calls 1: t4_w2o
214func t4_tot() -> i64 { return t4_b2o() + T4_NCLS }
called by 2: t4_cen_trainmain calls 1: t4_b2o
217func t4_cen_fwd(w: *i64, x: *i64, out8: *i64) -> i64
249func t4_cen_train(tape: *i64, nb: *i64, arena: *i64, ab: *i64, xs: *i64, ts: *i64, wts: *i64, cnt: i64, w: *i64, logfd: i64, out2: *i64, curve: *i64, curven: *i64) -> i64
358func t4_xor_fwd(w: *i64, x0: i64, x1: i64) -> i64
called by 1: main calls 3: nx_f32_addnx_f32_mulnx_f32_lt
376func t4_xor_train(tape: *i64, nb: *i64, arena: *i64, ab: *i64, w: *i64, out2: *i64) -> i64
436func main(argc: i64, argv: *i64) -> i64