code wiki / _hdl_build / nx_gmmlu_ingest.nx
nx_gmmlu_ingest.nx
buildroot/runtime/_hdl_build/nx_gmmlu_ingest.nx
about
nx_gmmlu_ingest.nx -- F786 rung-2: parse the fetched Global-MMLU-Lite pages into a
CONTAMINATION-SPLIT battery, so an uncontaminated seat can sit a REAL public benchmark and
nx_battery_grade scores it straight into model-card cell b16 (Global-MMLU-Lite).
knowledge/store/gmmlutask- : sample_id<TAB>subject<TAB>question<TAB>opt_a<TAB>opt_b<TAB>opt_c<TAB>opt_d
knowledge/store/gmmlugold- : sample_id<TAB>answer (SEPARATE PLANE -- a seat reading the
task plane can NEVER see the answers; same guard as the F788 battery)
A seat then writes gmmluans- rows (sample_id<TAB>given-letter) and:
nx_battery_grade knowledge/store/gmmlugold- knowledge/store/gmmluans- knowledge/status/gmmlu_grade.log
SCHEMA VERIFIED LIVE 2026-07-20 against datasets-server first-rows (CohereLabs/Global-MMLU-Lite, config
en, split test): sample_id / subject / subject_category / question / option_a..option_d / answer (answer
is a single letter A-D = exact-match gradeable). ⚠The dataset was RENAMED from CohereForAI/ -> CohereLabs/.
Escape-aware JSON string-value end (terminating '"' = preceded by an EVEN run of backslashes) so option
and question text containing \" never mis-terminates a field; row search BOUNDED to [row,next-row) so a
malformed row cannot steal a sibling's fields. Values are stored JSON-ESCAPED VERBATIM, which is
TAB/NEWLINE-safe by construction (JSON escapes them as two-char \t/\n, never literal bytes).
TOOTH: task rows == gold rows AND > 0, else verdict=RED and NEITHER store is touched (fail-closed).
Truncations are COUNTED and REPORTED, never silent (round-12 law).
expect_exit: 0 (GREEN) | 1 RED license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 3 imports · 0 importers
imports: nx_store_seed_lib.nxnx_seg_store.nxnx_syscalls.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
| 34 | const GI_TASK: *u8 = "knowledge/store/gmmlutask-" as *u8 |
| 35 | const GI_GOLD: *u8 = "knowledge/store/gmmlugold-" as *u8 |
| 36 | const GI_LOG: *u8 = "knowledge/status/gmmlu_ingest.log" as *u8 |
| 37 | const GI_FCAP: i64 = 4194304 |
| 38 | const GI_OCAP: i64 = 1048576 |
| 39 | const GI_FIELDCAP: i64 = 16384 |
| 40 | const GI_SBCAP: i64 = 2048 |
| 41 | const GI_PATHCAP: i64 = 256 |
| 42 | const GI_TAB: i64 = 9 |
| 43 | const GI_NL: i64 = 10 |
| 44 | const GI_Q: i64 = 34 |
| 45 | const GI_BSL: i64 = 92 |
| 46 | const GI_STDERR: i64 = 2 |
| 47 | const GI_MODE: i64 = 0x1a4 |
| 48 | const GI_D0: i64 = 48 |
| 49 | const GI_B10: i64 = 10 |
| 50 | const GI_NUMB: i64 = 24 |
| 51 | const GI_EXIT_RED: i64 = 1 |
functions
| 53 | func gi_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 54 | func gi_werr(s: *u8) -> i64 { sys_write(GI_STDERR, s, gi_slen(s)); return 0 } |
| 55 | func gi_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 69 | func gi_find(buf: *u8, needle: *u8, from: i64, limit: i64) -> i64 |
| 83 | func gi_vend(buf: *u8, vs: i64, limit: i64) -> i64 called by 1: gi_field |
| 97 | func gi_field(buf: *u8, needle: *u8, from: i64, limit: i64) -> i64 |
| 105 | func gi_t_slice(buf: *u8, a: i64, b: i64) -> i64 |
| 112 | func gi_t_c(c: i64) -> i64 { if g_to < GI_OCAP - 2 { g_t[g_to] = c as u8; g_to = g_to + 1 } return 0 } |
| 113 | func gi_g_slice(buf: *u8, a: i64, b: i64) -> i64 called by 1: gi_scan |
| 118 | func gi_g_c(c: i64) -> i64 { if g_go < GI_OCAP - 2 { g_g[g_go] = c as u8; g_go = g_go + 1 } return 0 } called by 1: gi_scan |
| 119 | func gi_bcat(d: *u8, off: i64, s: *u8) -> i64 called by 1: main |
| 125 | func gi_bcatn(d: *u8, off: i64, v: i64) -> i64 |
| 138 | func gi_col(buf: *u8, needle: *u8, a: i64, limit: i64) -> i64 |
| 146 | func gi_scan(buf: *u8, n: i64) -> i64 |
| 187 | func main() -> i64 |