code wiki / _hdl_build / nx_qabench.nx

nx_qabench.nx

buildroot/runtime/_hdl_build/nx_qabench.nx

95267 B2146 linesdepth 11pulls 25 transitivereach 0 importersview sourcekind benchtopic qabench
docsdependenciesstructsconstsfunctions

about

nx_qabench.nx -- the QA-benchmark LADDER (operator 2026-07-07: "use others like beerqa, climb the ladder to the top"). Runs the sovereign researcher's mechanical retrieve+extract+multi-hop pipeline (shared engine = nx_qabench_engine, extracted from nx_drbench) across a DIFFICULTY GRADIENT and prints ONE scoreboard: RUNG 1-hop = SQuAD v1.1 (single context paragraph -> isolates EXTRACTION from retrieval; should score HIGH) RUNG 2-hop = HotpotQA distractor (retrieve 2 of 10 paras + bridge reasoning -> the reasoning wall) Same F1/EM metric (nx_qa_score_lib, integer permille), same extractor -> the F1 DROP as hops rise is the honest, MEASURED "where mechanical ends and reasoning/LLM begins" signal. Each benchmark: T-parse + T-negctl (rotated-gold F1 ~0 = metric not rigged). Formats dispatched by `fmt` (0=hotpot distractor, 1=squad single). expect_exit: 0 license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_qabench_engine.nx nx_qwen_extract.nx nx_qabench.nx

imports: nx_qabench_engine.nxnx_qwen_extract.nx

imported by: nobody (leaf or entry point)

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

main db_w rd_dump_texts sys_openat_wr db_w ↻ rd_dump_file db_read_raw sys_read db_body_start qab_load_row qab_load_squad db_find_key db_b db_match_key db_dec_str db_skip_ws db_b ↻ db_parse_str_arr db_skip_ws ↻ db_b ↻ db_dec_str ↻ qab_split_ctx qab_load_musique db_find_key ↻ db_skip_ws ↻ db_b ↻ db_match_bracket db_b ↻ db_dec_str ↻ qab_split_append db_parse_str_arr ↻ qab_load_hotpot db_find_key ↻ db_dec_str ↻ db_parse_str_arr ↻ db_parse_sentences db_skip_ws ↻ db_b ↻ db_dec_str ↻ db_norm_row

structs

none

consts

12const SEM_MAGIC_260000: i64 = 260000
13const SEM_MAGIC_32760: i64 = 32760
14const SEM_MAGIC_4096: i64 = 4096
15const SEM_MAGIC_536870912: i64 = 536870912
16const SEM_MAGIC_262144: i64 = 262144
17const SEM_MAGIC_4000: i64 = 4000
18const SEM_MAGIC_200000: i64 = 200000
19const SEM_MAGIC_2000: i64 = 2000
20const SEM_MAGIC_8000: i64 = 8000
21const SEM_MAGIC_1024: i64 = 1024
22const SEM_MAGIC_2000000000: i64 = 2000000000
23const SEM_MAGIC_16777216: i64 = 16777216
24const SEM_MAGIC_402653184: i64 = 402653184
25const SEM_MAGIC_10000: i64 = 10000
26const SEM_MAGIC_2026: i64 = 2026
27const SEM_MAGIC_2500: i64 = 2500
28const SEM_MAGIC_1000000: i64 = 1000000
29const SEM_MAGIC_2048: i64 = 2048
30const SEM_MAGIC_32768: i64 = 32768
31const SEM_MAGIC_1048576: i64 = 1048576
32const SEM_MAGIC_524288: i64 = 524288
33const SEM_MAGIC_8192: i64 = 8192
34const SEM_MAGIC_65536: i64 = 65536
35const SEM_MAGIC_8388608: i64 = 8388608
36const SEM_MAGIC_16384: i64 = 16384
37const SEM_MAGIC_3999: i64 = 3999
267const SEM_VMAX: i64 = 1024
268const SEM_W: i64 = 6
842const RD_NF: i64 = 14
1227const DUMP_NF: i64 = 17

functions

44func qa_is_prose(src: *u8, start: i64, ln: i64) -> i64
called by 1: qa_split_prose
74func qa_clean_sentence(src: *u8, start: i64, ln: i64, dst: *u8) -> i64
called by 1: qa_split_prose
97func qa_split_prose(g: *i64, src: *u8, slen: i64) -> i64
137func qab_split_ctx(g: *i64, src: *u8, slen: i64) -> i64
called by 1: qab_load_squad
184func db_match_bracket(g: *i64, pos: i64) -> i64
called by 1: qab_load_musique calls 1: db_b
207func qab_split_append(g: *i64, src: *u8, slen: i64, para: i64, st: *i64) -> i64
called by 1: qab_load_musique
270func sem_isqrt(v: i64) -> i64
279func sem_vfind(g: *i64, buf: *u8, off: i64, len: i64) -> i64
292func sem_vadd(g: *i64, buf: *u8, off: i64, len: i64) -> i64
called by 1: sem_build_vocab calls 1: sem_vfind
311func sem_build_vocab(g: *i64) -> i64
342func sem_build_cooc(g: *i64) -> i64
called by 1: sem_best_sentence_perrow calls 1: sem_vfind
389func sem_addrow(g: *i64, vec: *i64, t: i64) -> i64
called by 2: sem_qvecsem_svec
399func sem_qvec(g: *i64, vec: *i64) -> i64
419func sem_svec(g: *i64, s: i64, vec: *i64) -> i64
440func sem_cos(a: *i64, b: *i64, vc: i64) -> i64
called by 1: sem_best_sentence_perrow calls 1: sem_isqrt
459func ppmi_load(g: *i64) -> i64
called by 1: main calls 1: sys_read
514func ppmi_cos(g: *i64, a: i64, b: i64) -> i64
541func ppmi_wid(g: *i64, buf: *u8, off: i64, len: i64) -> i64
551func ppmi_best_sentence(g: *i64, pa: i64, pb: i64) -> i64
called by 1: sem_best_sentence calls 2: ppmi_widppmi_cos
619func sem_best_sentence(g: *i64, pa: i64, pb: i64) -> i64
624func sem_best_sentence_perrow(g: *i64) -> i64
650func qab_load_musique(g: *i64) -> i64
709func qab_load_squad(g: *i64) -> i64
745func qab_load_hotpot(g: *i64) -> i64
790func qab_load_row(g: *i64, fmt: i64) -> i64
797func qab_f1(g: *i64, fmt: i64, pred: *u8) -> i64
called by 1: qab_run calls 1: qs_f1
812func qab_em(g: *i64, fmt: i64, pred: *u8) -> i64
called by 1: qab_run calls 1: qs_em
844func rd_wants_entity(g: *i64) -> i64
called by 1: rd_feat calls 1: db_tok_is
860func rd_wants_place(g: *i64) -> i64
called by 1: rd_feat calls 1: db_tok_is
881func rd_candwc(g: *i64, ci: i64) -> i64
called by 1: rd_feat
893func rd_feat(g: *i64, ci: i64, s: i64, best_s: i64, feat: *i64) -> i64
942func rd_score(g: *i64, feat: *i64) -> i64
called by 2: rd_pickrd_train_row
953func rd_candstr(g: *i64, s: i64, ci: i64, out: *u8) -> i64
974func rd_setgold(g: *i64, gold: *u8) -> i64
983func rd_f1(g: *i64, cand: *u8) -> i64
1004func rd_enumerate(g: *i64, top1: i64, top2: i64, best_s: i64) -> i64
1036func rd_oracle(g: *i64, top1: i64, top2: i64, best_s: i64, gold: *u8) -> i64
1057func rd_pick(g: *i64, top1: i64, top2: i64, best_s: i64, pred: *u8) -> i64
1079func rd_train_row(g: *i64, gold: *u8, top1: i64, top2: i64, best_s: i64) -> i64
1118func rd_train_file(g: *i64, path: *u8, fmt: i64) -> i64
1155func rd_persist(g: *i64) -> i64
called by 1: rd_train calls 1: sys_openat_wr
1174func rd_train(g: *i64) -> i64
1202func rd_load(g: *i64) -> i64
called by 1: main calls 1: sys_read
1231func embed_load(g: *i64) -> i64
called by 1: main calls 1: sys_read
1260func dense_cos_int(g: *i64, a: i64, b: i64) -> i64
called by 1: rd_emb_feats calls 1: sem_isqrt
1288func rd_setqppmi(g: *i64) -> i64
called by 1: rd_dump_row calls 1: ppmi_wid
1308func rd_emb_feats(g: *i64, candstr: *u8, out: *i64) -> i64
1350func rd_setqemb(g: *i64) -> i64
called by 1: rd_dump_row calls 1: sem_isqrt
1377func rd_emb_vec(g: *i64, candstr: *u8, out: *i64) -> i64
1425func rd_dump_text_row(g: *i64, gold: *u8, fd: i64) -> i64
called by 1: rd_dump_row calls 1: qa_slen
1460func rd_dump_texts(g: *i64) -> i64
1479func rd_dump_texts_xl(g: *i64) -> i64
1506func rd_dump_row(g: *i64, gold: *u8, top1: i64, top2: i64, best_s: i64, fd: i64) -> i64
1549func rd_dump_file(g: *i64, path: *u8, fmt: i64, fd: i64, cap: i64) -> i64
1576func rd_dump_feats(g: *i64) -> i64
1600func qab_run(g: *i64, path: *u8, fmt: i64, label: *u8, res: *i64, base: i64) -> i64
1751func main(argc: i64, argv: *i64) -> i64
1934func qab_max4(a: i64, b: i64, c: i64, d: i64) -> i64
called by 1: main
1944func qab_bind(rdr: i64, orc: i64) -> i64
called by 1: main calls 2: db_wdb_n
1951func qa_read_file(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: qa_read_source calls 1: sys_read
1973func qa_read_source(g: *i64, ctxpath: *u8, pred: *u8) -> i64
2027func qa_streq(a: *u8, b: *u8) -> i64
2034func qa_lc(c: i64) -> i64 { if c >= 65 { if c <= 90 { return c + 32 } } return c }
called by 1: qa_contains_ci
2035func qa_slen(s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { i = i + 1 } return i }
2038func qa_contains_ci(hay: *u8, needle: *u8) -> i64
2055func qa_answer_agree(a: *u8, b: *u8) -> i64
called by 1: qa_research calls 1: qa_contains_ci
2064func qa_answer(g: *i64, question: *u8, ctxpath: *u8) -> i64
called by 1: main calls 2: qa_read_sourcedb_w
2088func qa_research(g: *i64, question: *u8, argv: *i64, cstart: i64, argc: i64) -> i64
2141func qa_strcpy(dst: *u8, src: *u8) -> i64
called by 1: qa_research