code wiki / _hdl_build / nx_bert_ce_gate.nx

nx_bert_ce_gate.nx

buildroot/runtime/_hdl_build/nx_bert_ce_gate.nx

8791 B138 linesdepth 10pulls 28 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_bert_ce_gate.nx -- teeth for the sovereign BERT cross-encoder (nx_bert_ce_lib over nx_wordpiece_lib) against the PUBLISHED known answers on the model card of cross-encoder ms-marco-MiniLM-L-6-v2 (Apache-2.0, mirrored with provenance under knowledge/fetched/cmp_search_ce_minilm_*): the card prints the scores 8.607138 and -4.320078 for the Berlin population pair and the Berlin museums pair, so the encoder is held to an EXTERNAL number, never to itself. Tolerance: f32 accumulation order differs from the reference framework and over six layers that drift stays below 1e-2 on a logit; the bar is 50 milli, five times that and 86 times below the smaller published magnitude, so a wrong weight, a wrong norm placement or a wrong tokenisation cannot pass. The pooled attention path must equal the serial path bit for bit (the vit_mhsa_pool claim) and a forward must be deterministic. Search rung R0, 2026-09-14. Declared in organ_gate.conf. expect_exit: 0

dependencies 5 imports · 0 importers

nx_gate_verdict.nx nx_estate_path.nx nx_wordpiece_lib.nx nx_bert_ce_lib.nx nx_thread_pool.nx nx_bert_ce_gate.nx

imports: nx_gate_verdict.nxnx_estate_path.nxnx_wordpiece_lib.nxnx_bert_ce_lib.nxnx_thread_pool.nx

imported by: nobody (leaf or entry point)

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

main ep_anchor sys_openat_rd sys_close sys_chdir sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ gv_puts sys_write ↻ gv_ctr sys_mmap ↻ bc_load sys_mmap ↻ sys_read_file sys_openat_rd ↻ sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close ↻ bc_fail sys_mmap ↻ bc_cfg_int bc_skip_to_value stl_find sys_mmap ↻ stl_parse_int

structs

none

consts

16const BG_EXPECT_POP_MILLI: i64 = 8607 // model card: 8.607138
17const BG_EXPECT_MUS_MAG_MILLI: i64 = 4320 // model card: -4.320078 (magnitude; negated in code)
18const BG_TOL_MILLI: i64 = 50
19const BG_BERLIN_QUERY_PIECES: i64 = 7 // how many people live in berlin ?
20const BG_CLS_ID: i64 = 101 // published bert-base-uncased special ids
21const BG_SEP_ID: i64 = 102
22const BG_UNK_ID: i64 = 100
23const BG_PAD_ID: i64 = 0
24const BG_POOL_WORKERS: i64 = 2
25const BG_BOX: i64 = 8

functions

27func bg_abs(v: i64) -> i64 { if v < 0 { return 0 - v } return v }
called by 1: main
28func bg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: main
30func main() -> i64