code wiki / _hdl_build / _t4b_closed_loop_authored.nx
_t4b_closed_loop_authored.nx
buildroot/runtime/_hdl_build/_t4b_closed_loop_authored.nx
about
_t4b_closed_loop_authored.nx -- T4b: the CLOSED-LOOP FIRST TURN. The first model trained
EXCLUSIVELY on team-generated, gate-verified data: the synthesis corpus
(knowledge/library/synth_corpus.log SYNTH rows). Task: expr -> spec (which spec does this
team-synthesized expression solve), an exact 7-class mapping (verified conflict-free).
Uses the NEW verified-gradient CE loss (tg_celoss op 6, gradcheck-gated) -- the one-hot-MSE
workaround is retired on its first outing. The T4 lesson set is APPLIED, not rediscovered:
centered features, inverse-frequency class weights, full-batch accumulation + gated AdamW,
deterministic early stop. Emits a machine-readable training report
(knowledge/status/train_report_t4b.log TRIAGE-* rows) for the nx_train_triage organ.
GATES: P parse+dict+consistency (identical features MUST agree on the label -- the
under-determined-data check) | Q trained to 100% (per-class pred counts == data counts,
loss decreased) | R BIT-EXACT two-run. Tamper hook: argv[1] corpus path override.
LAWS: struct-free, flat ifs, no &&/||, no unary-minus literals. license_tier: ORIGINAL
dependencies 1 imports · 0 importers
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
structs
| none |
consts
| 16 | const B4_EPOCHS: i64 = 2000 |
| 17 | const B4_LOGEVERY: i64 = 100 |
| 18 | const B4_INB: i64 = 24 |
| 19 | const B4_HID: i64 = 16 |
| 20 | const B4_MAXCLS: i64 = 16 |
| 21 | const B4_MAXROWS: i64 = 256 |
functions
| 23 | func b4_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 } |
| 24 | func b4_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 } |
| 25 | func b4_bp(fd: i64, s: *u8) -> i64 { _tg_puts(s); b4_fp(fd, s); return 0 } |
| 26 | func b4_bn(fd: i64, v: i64) -> i64 { _tg_num(v); b4_fn(fd, v); return 0 } |
| 28 | func b4_match(b: *u8, i: i64, n: i64, lit: *u8) -> i64 called by 1: b4_parse |
| 37 | func b4_nameq(a: *u8, b: *u8) -> i64 called by 1: b4_parse |
| 49 | func b4_parse(cpath: *u8, dict: *u8, nspecp: *i64, labels: *i64, exprs: *u8) -> i64 |
| 138 | func b4_fwd(w: *i64, x: *i64, nspec: i64, outv: *i64) -> i64 |
| 165 | func t4b_zero(w: *i64, b1o: i64, w2o: i64) -> i64 called by 1: b4_train |
| 171 | func t4_initb(p: *i64, n: i64, salt: i64, den: i64) -> i64 |
| 183 | func b4_train(tape: *i64, nb: *i64, arena: *i64, ab: *i64, xs: *i64, ts: *i64, wts: *i64, cnt: i64, nspec: i64, w: *i64, curve: *i64, curven: *i64, out2: *i64) -> i64 |
| 285 | func main(argc: i64, argv: *i64) -> i64 |