nx_blockmax_wand.nx
buildroot/runtime/nx_blockmax_wand.nx
about
nx_blockmax_wand.nx -- LIB: block-max top-k pruning (block-max-WAND / MaxScore family) = the QUERY-SPEED lever for a
billion-posting index. Instead of scoring every doc in every query term's postings, keep a top-k threshold and PRUNE
any doc whose UPPER BOUND (sum of the per-BLOCK max impacts of the terms that contain it) can't beat the threshold.
Composes the 256-doc blocks from nx_posting_compress -- each block carries a max-impact, so whole blocks skip. The
invariant that makes it EXACT: upper_bound >= true score, so a pruned doc could never have entered the top-k.
Built + gated NOW on a fixture (exactness vs exhaustive + measured skips); the pivot/skip-pointer scaling runs on the
NAS index later. No float. license_tier: ORIGINAL
dependencies 1 imports · 1 importers
imports: nx_syscalls.nx
imported by: nx_blockmax_wand_gate.nx
structs
| none |
consts
| 10 | const BMW_B: i64 = 2 // demo block size (fine, so block-max < term-max); production block = 256 (nx_posting_compress) |
functions
| 13 | func bmw_block_max(imp: *i64, cnt: i64, bm: *i64) -> i64 called by 1: main |
| 23 | func bmw_find(docs: *i64, imp: *i64, cnt: i64, d: i64, blk: *i64) -> i64 |
| 29 | func bmw_score(td: *i64, ti: *i64, tc: *i64, nt: i64, d: i64) -> i64 |
| 36 | func bmw_ub(td: *i64, ti: *i64, tc: *i64, tbm: *i64, nt: i64, d: i64) -> i64 |
| 43 | func bmw_insert(tkd: *i64, tks: *i64, k: i64, filled: *i64, theta: *i64, d: i64, s: i64) -> i64 |
| 58 | func bmw_exhaustive(td: *i64, ti: *i64, tc: *i64, nt: i64, udocs: *i64, nu: i64, k: i64, tkd: *i64, tks: *i64) -> i64 |
| 66 | func bmw_blockmax(td: *i64, ti: *i64, tc: *i64, tbm: *i64, nt: i64, udocs: *i64, nu: i64, k: i64, tkd: *i64, tks: *i64) -> i64 |