code wiki / (root) / nx_gen_lora_verify.nx

nx_gen_lora_verify.nx

buildroot/runtime/nx_gen_lora_verify.nx

5460 B122 linesdepth 9pulls 25 transitivereach 0 importersview sourcekind tooltopic gen
docsdependenciesstructsconstsfunctions

about

nx_gen_lora_verify.nx -- prove the sovereign LoRA fold against an EXACT f64 reference. ★★★★★ WHY NOT GRADE AGAINST sd.cpp. We tried, and it cannot answer the question. sd.cpp applies this adapter at RUNTIME (`apply lora at runtime` -> forward_with_lora), so its weight tap yields the BASE weight and only its activations carry the adapter. Grading our fold against those activations measured a LoRA delta of 0.86% of the signal through an oracle whose own Q8_0 error is 0.6% median. A least-squares fit for the scale recovered 0.1725 against a true alpha/rank of 0.1667 -- consistent, but the confidence interval swallows the answer. ⇒ THE SAME REMEDY AS EVERY OTHER SCALE THIS SESSION: build the third, higher-precision reference. exact = h @ (W + (alpha/rank) * up @ down)^T in f64, from the SAME dequantized bytes. Now the only difference between us and the reference is OUR arithmetic, which is the thing under test. sd.cpp is no longer a judge here -- it is a second defendant. Usage: nx_gen_lora_verify <lora.safetensors> [multiplier_milli] [ref_fixture] ⚠THE REFERENCE IS AN ARGUMENT ON PURPOSE. A fold that ignored the multiplier entirely would pass the mult=1.0 case perfectly and look green forever. ★ A GATE THAT ONLY TESTS THE EASY SIDE OF A SWITCH DEFENDS NEITHER SIDE -- so the multiplier is graded against its OWN exact reference at 0.5 and at -1.0, and each must fail the others. license_tier: ORIGINAL

dependencies 12 imports · 0 importers

nx_syscalls.nx nx_le.nx nx_f32.nx nx_f32_div.nx nx_f32_cvt.nx nx_f16.nx nx_strconv.nx nx_genfix.nx nx_genver.nx nx_genweights.nx nx_gen_lora_verify.nx

diagram shows first 10 each side; +2 more imports, +0 more importers in the complete lists below.

imports: nx_syscalls.nxnx_le.nxnx_f32.nxnx_f32_div.nxnx_f32_cvt.nxnx_f16.nxnx_strconv.nxnx_genfix.nxnx_genver.nxnx_genweights.nxnx_genblock.nxnx_genlora.nx

imported by: nobody (leaf or entry point)

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

main lv_puts sys_write nx_strconv_parse_i64 nx_ascii_is_digit sys_mmap nxa_die sys_write ↻ sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ nx_f32_div nx_f32_classify nx_f32_exp_field nx_f32_mant_field nx_f32_sign nx_f32_mant_field ↻ nx_f32_exp_field ↻ nx_i32_to_f32 nx_genfix_load _gf_path sys_mmap ↻ _gf_cpyz nx_genfix_root _gf_cpy sys_openat_rd sys_mmap ↻ sys_read sys_close br_strlen nx_gw_open

structs

none

consts

35const LV_IN: i64 = 3840
36const LV_OUT: i64 = 11520
37const LV_TOK: i64 = 768

functions

39func lv_puts(s: *u8) -> i64 {
called by 1: main calls 1: sys_write
45func main(argc: i64, argv: *i64) -> i64 {