code wiki / (root) / nx_hybrid_moe_cascade_gate.nx

nx_hybrid_moe_cascade_gate.nx

buildroot/runtime/nx_hybrid_moe_cascade_gate.nx

10917 B193 linesdepth 11pulls 29 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_hybrid_moe_cascade_gate.nx -- THE SYSTEM-LEVEL MoE the operator actually wants (2026-07-15): NOT a monster model, but a two-expert CASCADE that spends the FEWEST tokens. Expert 1 = the local sovereign no-float model (free, deterministic, and VERIFIABLE by the LCF kernel). Expert 2 = the lightest Claude (Haiku) -- invoked ONLY for the residual the local model can't self-certify. The router: task -> LOCAL PROPOSE (no-float model) -> SOVEREIGN VERIFY (af_decide, kernel-checked) -> certified => RETURN local answer, 0 Claude tokens (the local expert handled it, PROVABLY correct) refuted => ESCALATE to Haiku (local was WRONG -- caught, never shipped) unsupported=> ESCALATE to Haiku (out of local scope) The KEY SOTA property = SOUND token-minimization: a local answer is returned ONLY when kernel-certified, so it is NEVER wrong; every uncertain case escalates to the cheapest tier. Better local model => more certified => fewer escalations => fewer tokens (this is why the MoE/MLA arch work pays off HERE). Teeth: T1 SOUNDNESS: every LOCAL-routed answer is kernel-certified (0 wrong answers shipped locally) T2 ROUTING CORRECT: verifiable-and-right => LOCAL; wrong-or-out-of-scope => ESCALATE T3 TOKEN SAVINGS MEASURED: zero-Claude-token fraction reported; escalations go to the LIGHTEST tier T4 ESCALATION CONTRACT: each escalation emits a real Haiku-bound prompt (wired, not hand-waved) T5 DETERMINISM: the whole routing decision is byte-stable on repeat Requires /home/elderwesto/nx_stage/nx_real_model.gguf. Heavy (~1 min: local model + per-task gen). Return from main. No hw writes (Rule 26). expect_exit: 0 license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_propose_verify_lib.nx nx_gate_verdict.nx nx_hybrid_moe_cascade_gate.nx

imports: nx_syscalls.nxnx_propose_verify_lib.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

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

main hc_w sys_write nsv_init sys_now_ms sys_mmap sys_clock_gettime_mono nsv_log sys_write ↻ nf_pool nx_pool_new nx_hw_worker_count nx_hw_cpu_count sys_mmap ↻ sys_munmap sys_mmap ↻ nx_chan_new sys_mmap ↻ _nx_chan_cell sys_thread_create nx_thread_spawn sys_mmap ↻ nx_thread_spawn_fn sys_mmap ↻ sys_mmap ↻ nsv_load_meta sys_mmap ↻ nsv_log ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close nx_gguf_parse nx_le_read_u32 nx_le_read_u64 nx_le_read_u32 ↻ _gguf_skip_value nx_le_read_u64 ↻

structs

none

consts

none

functions

23func hc_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 2: hc_nmain calls 1: sys_write
24func hc_n(v: i64) -> i64
called by 1: main calls 3: hc_wsys_mmapsys_write
38func main() -> i64