code wiki / _hdl_build / nx_bert_ce_gate.nx
nx_bert_ce_gate.nx
buildroot/runtime/_hdl_build/nx_bert_ce_gate.nx
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
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
structs
| none |
consts
| 16 | const BG_EXPECT_POP_MILLI: i64 = 8607 // model card: 8.607138 |
| 17 | const BG_EXPECT_MUS_MAG_MILLI: i64 = 4320 // model card: -4.320078 (magnitude; negated in code) |
| 18 | const BG_TOL_MILLI: i64 = 50 |
| 19 | const BG_BERLIN_QUERY_PIECES: i64 = 7 // how many people live in berlin ? |
| 20 | const BG_CLS_ID: i64 = 101 // published bert-base-uncased special ids |
| 21 | const BG_SEP_ID: i64 = 102 |
| 22 | const BG_UNK_ID: i64 = 100 |
| 23 | const BG_PAD_ID: i64 = 0 |
| 24 | const BG_POOL_WORKERS: i64 = 2 |
| 25 | const BG_BOX: i64 = 8 |
functions
| 27 | func bg_abs(v: i64) -> i64 { if v < 0 { return 0 - v } return v } called by 1: main |
| 28 | func bg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } called by 1: main |
| 30 | func main() -> i64 |