code wiki / _hdl_build / nx_qrels_bench.nx
nx_qrels_bench.nx
buildroot/runtime/_hdl_build/nx_qrels_bench.nx
about
nx_qrels_bench.nx -- THE PER-DOCUMENT RELEVANCE RULER (Q7 runner, 2026-09-04).
WHY IT EXISTS. The estate's incumbent web ruler judges by EXPECTED HOST, and that is not a detail --
it is why it could not see any defect found on 2026-09-04. "Icing (aeronautics)" at rank 1 for the
query "ice cream" sits on en.wikipedia.org and therefore scored a PERFECT hit@1, while the stored
document does not contain the word "cream" anywhere. A HOST IS NOT AN ANSWER. This runner scores
against knowledge/search_qrels.conf, whose judgements are per URL.
COMPOSED, NOT REIMPLEMENTED, ON BOTH SIDES:
retrieval -- dss_search over the SAME code path /search serves, so the number describes the live
engine rather than a reimplementation of it. Deliberately NO HTTP: an organ that fetches
its own daemon measures the transport too, and would queue behind the serve it is grading.
metrics -- nx_ir_eval (ie_ndcg_at_k, ie_mrr, ie_hits_at_k, ie_precision_at_k, ie_ap), the estate's
Q16.16 integer-exact floor. A second metric implementation is the duplicate-ruler defect.
SCOPE, INHERITED FROM THE QRELS FILE AND NOT WEAKENED HERE: that set is a BOOTSTRAP -- its candidates
were pooled from the engine's own required-term arm, so it measures whether known-good documents rank UP
and it CANNOT prove recall over documents that arm never retrieved. The recall figure is therefore recall
over the JUDGED POOL, and it is emitted as judged_recall_permil so nobody reads it as the other thing.
GRADE 0 IS A JUDGEMENT, NOT A GAP. A result absent from the file scores 0 deliberately: the file records
every document examined per query, so "unlisted" means "examined and judged irrelevant" -- which is
exactly how a stem-variant-only match (icing for ice, warring for wars) is meant to score.
dependencies 3 imports · 0 importers
imports: nx_docportal_search_seg.nxnx_ir_eval.nxnx_gate_verdict.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
| 28 | const QB_PATH: *u8 = "knowledge/search_qrels.conf" |
| 29 | const QB_PATH_UP: *u8 = "../knowledge/search_qrels.conf" // same file seen from a buildroot CWD |
| 30 | const QB_DOMAIN: *u8 = "web" |
| 31 | const QB_MAXQ: i64 = 64 |
| 32 | const QB_MAXREL: i64 = 1024 |
| 33 | const QB_K: i64 = 10 // DSS_MAXR is 30, so scoring @5 would discard two thirds of the page |
| 34 | const QB_TOPN: i64 = 30 |
| 35 | const QB_QBUF: i64 = 128 |
| 36 | const QB_UBUF: i64 = 512 |
| 37 | const QB_PATHCAP: i64 = 1024 |
| 38 | const QB_BOX: i64 = 16 |
| 39 | const QB_PIPE: i64 = 124 |
| 40 | const QB_NL: i64 = 10 |
| 41 | const QB_CR: i64 = 13 // CRLF-generated data files leave this as the last byte of a field |
| 42 | const QB_HASH: i64 = 35 |
| 43 | const QB_D0: i64 = 48 |
| 44 | const QB_D9: i64 = 57 |
| 45 | const QB_B10: i64 = 10 |
| 46 | const QB_PERMIL: i64 = 1000 |
| 47 | const QB_Q16: i64 = 65536 // nx_ir_eval returns Q16.16 fixed point, NOT permil (mrr=65536 == 1.0) |
| 48 | const QB_FAMCAP: i64 = 32 // a family is a COARSE signal class (lexical/human/neural), not a label |
| 49 | const QB_LC_AUTO: i64 = 0 |
| 50 | const QB_LC_HUMAN: i64 = 1 |
| 51 | const QB_SP: i64 = 32 |
| 52 | const QB_CONTENT_MIN: i64 = 3 // S4: a CONTENT term. 1-2 char tokens in these queries are |
| 55 | const QB_CROSSOVER_TOKENS: i64 = 10000000 // S1: the published BM25 scale crossover, in corpus tokens |
| 56 | const QB_EPOCH_FLOOR: i64 = 1750000000 // S2: below this is not a date, it is an UNSET CLOCK. A run |
functions
| 60 | func qb_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 61 | func qb_eqz(a: *u8, b: *u8) -> i64 |
| 73 | func qb_cpn(dst: *u8, cap: i64, src: *u8, n: i64) -> i64 |
| 94 | func qb_eol(buf: *u8, n: i64, i: i64) -> i64 called by 1: qb_load |
| 104 | func qb_pipe(buf: *u8, e: i64, i: i64) -> i64 called by 1: qb_load |
| 112 | func qb_atoi(buf: *u8, s: i64, e: i64) -> i64 called by 1: qb_load |
| 125 | func qb_isword(c: i64) -> i64 called by 1: qb_hasword |
| 131 | func qb_hasword(hay: *u8, needle: *u8) -> i64 |
| 168 | func qb_tier(rlc: *i64, nr: i64) -> i64 called by 1: qb_main |
| 181 | func qb_benchver(bench: *u8, epoch: i64) -> i64 |
| 193 | func qb_lexalign(orig: *u8, rewrite: *u8, doctext: *u8) -> i64 |
| 247 | func qb_publish_ok(judgefam: *u8, rankerfam: *u8, tier: i64) -> i64 |
| 258 | func qb_load(buf: *u8, n: i64, qtext: *u8, nq: *i64, |
| 335 | func qb_grade(qi: i64, url: *u8, rqi: *i64, rgr: *i64, rurl: *u8, nr: i64) -> i64 |
| 353 | func qb_arm(h: *i64, qtext: *u8, nq: i64, rqi: *i64, rgr: *i64, rurl: *u8, nr: i64, out: *i64) -> i64 |
| 469 | func qb_expand_ab(h: *i64, qtext: *u8, nq: i64, rqi: *i64, rgr: *i64, rurl: *u8, nr: i64, |
| 484 | func qb_main() -> i64 |
| 767 | func main(argc: i64, argv: *i64) -> i64 |