code wiki / _hdl_build / nx_vec_hybrid_gate.nx

nx_vec_hybrid_gate.nx

buildroot/runtime/_hdl_build/nx_vec_hybrid_gate.nx

7217 B79 linesdepth 3pulls 5 transitivereach 0 importersview sourcekind gate/prooftopic vec
docsdependenciesstructsconstsfunctions

about

nx_vec_hybrid_gate.nx -- INTEGRATION proof that R-VEC-0 (kernel) + R-VEC-1 (embeddings) + R-VEC-5 (RRF fusion) COMPOSE into working sovereign hybrid semantic search -- the felt S-class moment, measured end-to-end. Scenario (the classic lexical-recall failure): user query = "marriage". Only doc0 literally contains the token "marriage"; doc1 is the OTHER family-law doc (custody/children/parents/divorce) and never says "marriage", so pure keyword/BM25 search CANNOT find it. Sovereign distributional embeddings know marriage ~ divorce/custody (same context), so the vector ranker surfaces doc1; RRF fusion then RECOVERS doc1 into the results -- without losing the exact match (doc0 stays #1) and without false positives (the estate/injury docs stay out). This is the whole point of hybrid search: semantic recall on top of lexical precision. All sovereign, no-float, no external weights, no third party. expect_exit: 0 license_tier: ORIGINAL

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_vec_kernel.nx nx_vec_embed.nx nx_vec_fuse.nx nx_vec_hybrid_gate.nx

imports: nx_syscalls.nxnx_vec_kernel.nxnx_vec_embed.nxnx_vec_fuse.nx

imported by: nobody (leaf or entry point)

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

main hy_puts sys_write sys_mmap ve_build_co vr_embed ve_docvec vr_embed ↻ vr_cos_milli vr_dot vr_isqrt vr_fuse_add vr_rrf_w vr_fuse_rank hy_lst hy_puts ↻ hy_pn sys_mmap ↻ sys_write ↻ hy_pn ↻ rank_of sys_openat_append hy_w sys_write ↻ hy_wn sys_mmap ↻ sys_write ↻ sys_close sys_exit

structs

none

consts

none

functions

17func hy_puts(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: hy_lstmain calls 1: sys_write
18func hy_pn(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=(48 as u8);k=1}; while m>0{t[k]=((48+(m%10)) as u8);m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(1,bb,k); return 0 }
called by 2: hy_lstmain calls 2: sys_mmapsys_write
19func hy_lst(list: *i64, n: i64) -> i64 { var i: i64=0; while i<n { hy_puts("doc" as *u8); hy_pn(list[i]); hy_puts(" " as *u8); i=i+1 } if n==0 { hy_puts("(none)" as *u8) } return 0 }
called by 1: main calls 2: hy_putshy_pn
20func hy_w(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 }
called by 1: main calls 1: sys_write
21func hy_wn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=(48 as u8);k=1}; while m>0{t[k]=((48+(m%10)) as u8);m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(fd,bb,k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
23func rank_of(list: *i64, n: i64, id: i64) -> i64 { var i: i64=0; while i<n { if list[i]==id { return i+1 } i=i+1 } return 0 }
called by 1: main
25func main() -> i64