code wiki / _hdl_build / nx_recall_dense.nx
nx_recall_dense.nx
buildroot/runtime/_hdl_build/nx_recall_dense.nx
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
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
structs
| none |
consts
| 21 | const K_MAGIC_4096: i64 = 4096 |
| 22 | const K_MAGIC_536870912: i64 = 536870912 |
| 23 | const K_MAGIC_262144: i64 = 262144 |
functions
| 25 | func pb_isqrt(v: i64) -> i64 called by 1: pb_cos |
| 34 | func pb_load(g: *i64) -> i64 |
| 87 | func pb_cos(g: *i64, a: i64, b: i64) -> i64 |
| 114 | func pb_dcos(g: *i64, a: i64, b: i64) -> i64 |
| 122 | func pb_wid(g: *i64, s: *u8) -> i64 |
| 130 | func pb_maxcos(g: *i64, q: i64, w0: i64, w1: i64) -> i64 |
| 140 | func order_desc(score: *i64, n: i64, out: *i64) -> i64 called by 1: main |
| 162 | func p_at_k(order: *i64, gold: *i64, n: i64, k: i64) -> i64 called by 1: main |
| 173 | func mrr_permil(order: *i64, gold: *i64, n: i64) -> i64 called by 1: main |
| 183 | func jkv(k: *u8, v: i64) -> i64 { db_w("\"" as *u8); db_w(k); db_w("\":" as *u8); db_n(v); return 0 } |
| 185 | func main() -> i64 |