code wiki / _hdl_build / nx_recall_dense.nx

nx_recall_dense.nx

buildroot/runtime/_hdl_build/nx_recall_dense.nx

11942 B292 linesdepth 4pulls 6 transitivereach 0 importersview sourcekind tooltopic recall
docsdependenciesstructsconstsfunctions

about

nx_recall_dense.nx -- the SOVEREIGN dense/semantic reranker over the REAL shipped model. Loads knowledge/index/semppmi_v1.bin (41MB, 102318-word PPMI, built by nx_semppmi_build, probes GREEN) and reranks a candidate shortlist by INTEGER LATE-INTERACTION maxsim soft- alignment: score(query,doc) = SUM over query terms q of MAX over doc terms w of cos_ppmi(q,w) (exact match = identity 1000). This is the ColBERT-class late-interaction pattern in pure fixed-point -- the R2 semantic reranker made REAL (replaces the fixture embeddings the nx_recall_rerank gate used with the actual 102K-vocab count model). EVIDENCE-FORK (no navel-gazing): a CONTROLLED keyword-tie fixture -- each candidate holds EXACTLY ONE query keyword, so first-stage lexical retrieval TIES all four (expected P@k = R/N, a coin-flip). Each relevant doc's OTHER term is a MEASURED synonym of the missing query term (won~defeated=86, city~stadium=62); each distractor's other term is MEASURED-unrelated (won~purple=25, city~january=35). The dense reranker must recover the relevant docs. Every deciding cosine is printed in the JSON = fully auditable, not asserted. RED + exit1 if the dense P@2 fails to beat the lexical coin-flip (an inversion cannot hide). This is a controlled UNIT proof of the mechanism on the real model; corpus-scale nDCG is the flagged BEIR row (F236), not claimed here. expect_exit: 0 license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_qabench_engine.nx nx_estate_path.nx nx_recall_dense.nx

imports: nx_qabench_engine.nxnx_estate_path.nx

imported by: nobody (leaf or entry point)

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

main ep_anchor sys_openat_rd sys_close sys_chdir sys_mmap pb_load sys_read db_w pb_wid db_semhash db_bsearch_i64 pb_maxcos pb_dcos pb_cos pb_isqrt order_desc p_at_k mrr_permil jkv db_w ↻ db_n nxi_out nxi_fd sys_mmap ↻ ccz_cat_num sys_write sys_munmap pb_dcos ↻ db_n ↻

structs

none

consts

21const K_MAGIC_4096: i64 = 4096
22const K_MAGIC_536870912: i64 = 536870912
23const K_MAGIC_262144: i64 = 262144

functions

25func pb_isqrt(v: i64) -> i64
called by 1: pb_cos
34func pb_load(g: *i64) -> i64
called by 1: main calls 1: sys_read
87func pb_cos(g: *i64, a: i64, b: i64) -> i64
called by 1: pb_dcos calls 1: pb_isqrt
114func pb_dcos(g: *i64, a: i64, b: i64) -> i64
called by 2: pb_maxcosmain calls 1: pb_cos
122func pb_wid(g: *i64, s: *u8) -> i64
called by 1: main calls 2: db_semhashdb_bsearch_i64
130func pb_maxcos(g: *i64, q: i64, w0: i64, w1: i64) -> i64
called by 1: main calls 1: pb_dcos
140func order_desc(score: *i64, n: i64, out: *i64) -> i64
called by 1: main
162func p_at_k(order: *i64, gold: *i64, n: i64, k: i64) -> i64
called by 1: main
173func mrr_permil(order: *i64, gold: *i64, n: i64) -> i64
called by 1: main
183func jkv(k: *u8, v: i64) -> i64 { db_w("\"" as *u8); db_w(k); db_w("\":" as *u8); db_n(v); return 0 }
called by 1: main calls 2: db_wdb_n
185func main() -> i64