nx_qwen_extract.nx
buildroot/runtime/nx_qwen_extract.nx
about
nx_qwen_extract.nx -- R5: the pretrained sovereign Qwen as the RESEARCHER'S EXTRACTION stage (importable by
nx_qabench). qwx_load() boots the model ONCE (like rd_load); qwx_extract(g, para, pred) reads paragraph `para`'s
sentences + the question (qabench g[] slots) and greedy-generates an answer IN-PROCESS (nsv_generate, no HTTP),
writing the first-line answer into pred (db_setpred convention: <=250 chars + NUL). Opt-in: qabench calls these
only in qwen-reader mode. PROVEN standalone: nx_qwen_reader_bench_gate measured Qwen-as-reader >> mechanical 251.
Sovereign: nx_nofloat_serve_core. ⚠tk_bpe_encode overflows g_nsv_ids past 192 tok BEFORE its length check ->
the QWX_MAXPROMPT char guard is MANDATORY (SIGSEGV otherwise). license_tier: ORIGINAL
dependencies 2 imports · 2 importers
imports: nx_syscalls.nxnx_nofloat_serve_core.nx
imported by: nx_qabench.nxnx_qwen_extract_gate.nx
structs
| none |
consts
| 11 | const QWX_MODEL: *u8 = "/home/elderwesto/nx_stage/nx_real_model.gguf" |
| 12 | const QWX_CTXCAP: i64 = 500 // s0-window context cap; 253(1-shot)+500+140(Q+cues)=893 < MAXPROMPT. ⚠2-shot@380 was REVERTED: measured on-protocol SQuAD 427 < 1-shot@500 510 (surface benefit null under multi-alias; 380 clips real retrieved paras). See arc memory. |
| 13 | const QWX_MAXPROMPT: i64 = 900 // hard char guard at the PROVEN-SAFE band: 900/2.5-worst-bpe = 360 tok + 16 gen = 376 < NSV_MAXT=384 (1000 allowed ~400 tok worst-case = g_nsv_ids overflow risk) |
| 14 | const QWX_MAXNEW: i64 = 16 |
| 15 | const QWX_MODE: i64 = 0 // 0 = i32 lossless (faithful default; i8 also verified working at NSV_MAXT=384) |
functions
| 26 | func qwx_load() -> i64 |
| 54 | func qwx_ready() -> i64 { return g_qwx_ready } |
| 56 | func qwx_cat(dst: *u8, off: i64, s: *u8, n: i64, cap: i64) -> i64 called by 1: qwx_extract |
| 62 | func qwx_cats(dst: *u8, off: i64, s: *u8, cap: i64) -> i64 called by 1: qwx_extract |
| 72 | func qwx_extract(g: *i64, s0: i64, pred: *u8) -> i64 |