code wiki / (root) / nx_hybrid_moe_cascade_gate.nx

nx_hybrid_moe_cascade_gate.nx

buildroot/runtime/nx_hybrid_moe_cascade_gate.nx

10969 B194 linesdepth 11pulls 37 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 4 imports · 0 importers

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

imports: nx_syscalls.nxnx_propose_verify_lib.nxnx_gate_verdict.nxnx_stage_path.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 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 ↻ 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

structs

none

consts

none

functions

24func 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
25func hc_n(v: i64) -> i64
called by 1: main calls 3: hc_wsys_mmapsys_write
39func main() -> i64