code wiki / _hdl_build / nx_nofloat_distill_gate.nx

nx_nofloat_distill_gate.nx

buildroot/runtime/_hdl_build/nx_nofloat_distill_gate.nx

5326 B91 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind gate/prooftopic nofloat
docsdependenciesstructsconstsfunctions

about

nx_nofloat_distill_gate.nx -- R3 (cheap quality) from the sovereign-researcher roadmap (knowledge/research/2026-06-23-nofloat-affordable-land-roadmap.md, grounded in nfs_hinton_distill.raw, arXiv 1503.02531): DISTILLATION -- a student trained on a teacher's SOFT output distribution inherits the full distribution ("dark knowledge": relative probabilities of the non-top classes), which one-hot HARD labels throw away. Pure integer Q16; trains student logits W via softmax_rows(W) -> mse(target) (existing gradcheck-verified ops, NO lib change -> zero regression risk to the other gates). T1 the distilled student MATCHES the teacher's soft distribution (low total L1). T2 (the point) distilled L1-to-teacher << hard-label student L1-to-teacher (soft targets > hard labels). expect_exit: 0 Sovereign: nx_nofloat_autograd + nx_syscalls.

dependencies 3 imports · 0 importers

nx_nofloat_autograd.nx nx_syscalls.nx nx_gate_emit_lib.nx nx_nofloat_distill_gate.nx

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

main g_puts sys_write sys_mmap train_student nfa_leaf nfa_new nfa_softmax_rows nfa_new ↻ nfa_fxexp nfa_mse nfa_new ↻ nfa_backward nfa_qmul nfa_silud nfa_sigmoid nfa_fxexp ↻ nfa_qmul ↻ nfa_isqrt nfa_fxexp ↻ nfa_cosf nfa_reduce2pi nfa_cosq nfa_qmul ↻ nfa_sinf nfa_reduce2pi ↻ nfa_sinq nfa_qmul ↻ nfa_grad nfa_sgd l1_to_teacher nfa_leaf ↻ nfa_softmax_rows ↻ g_abs g_pn sys_mmap ↻ sys_write ↻ g_check g_puts ↻ sys_openat_append

structs

none

consts

13const Q16: i64 = 65536

functions

16func g_abs(v: i64) -> i64 { if v<0 { return 0-v } return v }
called by 1: l1_to_teacher
19func train_student(tape: *i64, vals: *i64, grads: *i64, st: *i64, Wp: *i64, target: *i64, C: i64, V: i64, gb: *i64, steps: i64) -> i64
35func l1_to_teacher(tape: *i64, vals: *i64, st: *i64, Wp: *i64, T: *i64, C: i64, V: i64) -> i64
called by 1: main calls 3: nfa_leafnfa_softmax_rowsg_abs
45func main() -> i64