code wiki / _hdl_build / nx_f32_embed_gate.nx
nx_f32_embed_gate.nx
buildroot/runtime/_hdl_build/nx_f32_embed_gate.nx
about
nx_f32_embed_gate.nx -- KAT for the NEURAL EMBEDDING TAP (rung 1 of the retrieval ladder).
WHY THIS GATE IS SHAPED THIS WAY. Our count-based PPMI reranker was measured on BEIR/nfcorpus at 255
permille against BM25's 305 -- a LOSS -- and the banked conclusion was: A GATE PROVING A MECHANISM ON
A FIXTURE HAS NOT MEASURED THE MODEL. So this gate deliberately does NOT assert "an embedding came out
non-zero"; that passes on noise. It asserts SEMANTIC ORDERING a count model cannot fake: the related
pair shares almost NO surface tokens (cat/kitten, sat/rested, mat/rug), so a lexical or
co-occurrence model has nothing to latch onto. Only learned semantics ranks it correctly.
TEETH (both polarities -- a gate that can only pass is furniture):
1 NON-VACUITY : the embedding is not all-zero
2 SELF-SIM : cos(x,x) == 1000 permille -- the metric itself is sane
3 SEMANTIC : related pair scores ABOVE unrelated pair <- the real assertion
4 NEG-CONTROL : the unrelated pair must NOT also score near-1; if everything is similar to
everything the space has COLLAPSED and tooth 3 passes for the wrong reason
5 DETERMINISM : same input twice = identical vector (integer f32, no hidden RNG)
license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0
dependencies 11 imports · 0 importers
diagram shows first 10 each side; +1 more imports, +0 more importers in the complete lists below.
imports: nx_syscalls.nxnx_tier.nxnx_bpe.nxnx_gguf.nxnx_gguf_load.nxnx_gguf_meta.nxnx_f32_llm_read_dims.nxnx_f32_bpe_load.nxnx_f32.nxnx_f32_div.nxnx_f32_llm_v4.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
| 30 | const EG_MAXTOK: i64 = 256 |
| 31 | const EG_PERMILLE: i64 = 1000 |
| 33 | const EG_SELF_TOL: i64 = 2 |
| 36 | const EG_COLLAPSE_PERMILLE: i64 = 990 |
| 37 | const EG_KV_SLOTS: i64 = 512 |
| 39 | const EG_EPS: i64 = 0x358637BD |
| 40 | const EG_ATTN_SCALE: i64 = 0x3E000000 |
| 41 | const EG_ROPE_BASE: i64 = 0x415D0EAB |
| 42 | const EG_VOCAB_BYTES: i64 = 67108864 |
| 43 | const EG_VOCAB_IDS: i64 = 262144 |
| 44 | const EG_VOCAB_MERGES: i64 = 524288 |
functions
| 46 | func eg_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 47 | func eg_n(v: i64) -> i64 |
| 57 | func eg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } called by 1: main |
| 61 | func eg_cos(a: *i64, b: *i64, n: i64) -> i64 |
| 84 | func main(argc: i64, argv: *i64) -> i64 |