code wiki / _hdl_build / nx_nofloat_scale_gate.nx
nx_nofloat_scale_gate.nx
buildroot/runtime/_hdl_build/nx_nofloat_scale_gate.nx
about
STATUS 2026-06-23: PARTIAL / NOT REGISTERED -- HONEST documented attempt mapping the frontier. On the richer
4-category grammar (vocab 16) at dm=32, a SINGLE-BLOCK no-float LM SCALES and LEARNS STRUCTURE but does NOT
reach optimality at tractable compute:
- low-lr clipped SGD (0.1): plateaus at uniform (CE ~2738 ~= ln16 2773) -- too-small steps.
- higher-lr clipped SGD (0.2): ESCAPES the plateau, CE ~2135 (perplexity ~8.5) = clearly BELOW uniform
(2773 / ppl 16) so it learned the category structure, but still well ABOVE the floor (1324 / ppl 3.76)
= NOT near-optimal. lr 0.3 / more steps did not improve (plateaus ~2135-2295). THIS IS THE BEST RESULT.
- lr DECAY (0.2->0.02): WORSE (CE 2510) -- the low late-lr can't progress; not the fix.
- AdamW: diverges at lr>=0.01 / stalls at uniform at lr<=0.003 on this model (a narrow unstable band).
NOTE: I hypothesized this was a Q16 g^2-UNDERFLOW and built a Q32-moment Adam to fix it -- but a CONTROLLED
small-gradient fit CONVERGES under BOTH Q16 and Q32 moments (loss 112 vs 85), so that hypothesis is NOT
confirmed; the transformer-specific divergence cause is NOT isolated. (over-claim retracted; gate deleted.)
- DEPTH-2 (two stacked blocks, SGD 0.2): CE 2236 ~= single-block 2135 -- DEPTH DOES NOT HELP (tested, then
deleted). So capacity/depth is NOT the bottleneck.
So R4-FULL = PARTIAL, and the boundary is now precisely located: NOT a missing mechanism, NOT capacity/depth
(depth tested), but fixed-point OPTIMIZATION reaching sharp output distributions + compute -- a novel-optimizer
/ much-more-compute investment (operator-gated). The 3-category LANDING (nx_nofloat_landing_gate) IS
near-optimal and stands. (don't-lie: not registered, NOT claimed GREEN -- near-optimal genuinely fails here.)
nx_nofloat_scale_gate.nx -- R4 SCALE-UP (the frontier step): grow BOTH the language and the model, and show
the no-float LM stays NEAR-OPTIMAL. Richer grammar (4 categories, vocab 16): DET(2) -> ADJ(4) -> NOUN(5) ->
VERB(5) -> DET ... (e.g. "the big cat ran a red dog sat"). Bigger model dm=32. Fresh-random members each
stream -> the model learns the GRAMMAR, measured by HELD-OUT perplexity vs the richer information floor.
Floor = avg(ln2,ln4,ln5,ln5) = 1.324 nats (perplexity 3.76; members are random within category so unbeatable);
uniform baseline = ln(16) = 2.773 nats (perplexity 16).
T1 held-out CE << uniform (learned the richer language).
T2 held-out CE ~= the richer floor (near-OPTIMAL at scale = the model scaled up cleanly).
Pure integer Q16. HONEST: richer but still a CONSTRAINED domain (open multi-topic prose is the remaining
compute frontier). Sovereign: nx_nofloat_autograd + nx_syscalls. expect_exit: 0
dependencies 3 imports · 0 importers
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
structs
| none |
consts
| 33 | const Q16: i64 = 65536 |
| 34 | const UNIFORM_MNAT: i64 = 2773 // ln(16) |
| 35 | const FLOOR_MNAT: i64 = 1324 // avg(ln2,ln4,ln5,ln5) |
functions
| 38 | func 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 |
| 39 | func lcg(st: *i64) -> i64 { st[0]=(st[0]*1103515245 + 12345) & 2147483647; return (st[0] >> 15) } called by 1: make_stream4 |
| 41 | func make_stream4(S: *i64, tgt: *i64, P: i64, st: *i64) -> i64 |
| 54 | func 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 called by 2: do_traineval_ce calls 10: nfa_leafnfa_embednfa_rmsnorm_rowsnfa_matmulnfa_ropenfa_matmul_nt+4 |
| 87 | func adamw32_one(w: *i64, g: *i64, m: *i64, v: *i64, n: i64, lr: i64, b1: i64, b2: i64, eps: i64, t: i64) -> i64 |
| 108 | func adamw_all(tape: *i64, grads: *i64, W: *i64, WN: *i64, M: *i64, Vv: *i64, leaves: *i64, nW: i64, t: i64, lr: i64, clip: i64, gb: *i64) -> i64 |
| 118 | func do_train(tape: *i64, vals: *i64, grads: *i64, st: *i64, W: *i64, WN: *i64, M: *i64, Vv: *i64, S: *i64, tgt: *i64, P: i64, dm: i64, V: i64, scale: i64, leaves: *i64, gb: *i64, steps: i64, sdat: *i64) -> i64 |
| 137 | func 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 |
| 144 | func main() -> i64 |