code wiki / _hdl_build / nx_vec_hybrid_gate.nx
nx_vec_hybrid_gate.nx
buildroot/runtime/_hdl_build/nx_vec_hybrid_gate.nx
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
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
structs
| none |
consts
| none |
functions
| 17 | func 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 } |
| 18 | func 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 } |
| 19 | func 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 } |
| 20 | func 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 } |
| 21 | func 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 } |
| 23 | func 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 |
| 25 | func main() -> i64 |