code wiki / (root) / nx_code_embed_gate.nx

nx_code_embed_gate.nx

buildroot/runtime/nx_code_embed_gate.nx

10373 B265 linesdepth 10pulls 21 transitivereach 0 importersview sourcekind gate/prooftopic code
docsdependenciesstructsconstsfunctions

about

nx_code_embed_gate.nx -- SOVEREIGN CODE-EMBEDDING gate (2026-07-14). Grounds the jina-code-embeddings recipe (arXiv:2508.21290, backbone = Qwen2.5-Coder-0.5B = OUR coder) on the no-float stack: embedding = last-token pooled final-norm hidden state = nsv_embed(). Task instruction prefixes = jina's EXACT strings. GATES (liar-killer style): A ORDER jina model-card 2x2 demo: cos(q1,p1)>cos(q1,p2) AND cos(q2,p2)>cos(q2,p1) (bf16 jina-tuned oracle values 817/124/120/553 pm -- we gate ORDER only: base weights differ) B DETERM re-embed q1 AFTER all other texts -> vector must be BITWISE IDENTICAL (catches KV/state leak) C SELF cos(q1,q1') >= 999 pm (isqrt floor can give 1000+/-1) D RETRIEVE 3x3 Nishi-corpus NL->code argmax must hit the diagonal 3/3 E API synthetic HTTP POST /embed through nsv_handle -> 200 + ok:1 + dim:896 (the daemon serves these exact bytes -> the capability is API-reachable, rule-27 style, not gate-only) HONEST SCOPE: this proves PIPELINE CORRECTNESS on BASE coder weights. SOTA retrieval quality is NOT claimed -- that grading pends the jina-weight oracle (cc-by-nc-4.0 -> benchmark-only, like gcc). license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 1 imports · 0 importers

nx_nofloat_serve_core.nx nx_code_embed_gate.nx

imports: nx_nofloat_serve_core.nx

imported by: nobody (leaf or entry point)

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

main ce_ws nsv_init sys_now_ms sys_mmap sys_clock_gettime_mono nsv_log sys_write nf_pool nx_pool_new nx_hw_worker_count nx_hw_cpu_count sys_mmap ↻ sys_munmap sys_mmap ↻ nx_chan_new sys_mmap ↻ _nx_chan_cell sys_thread_create nx_thread_spawn sys_mmap ↻ nx_thread_spawn_fn sys_mmap ↻ sys_mmap ↻ nsv_load_meta sys_mmap ↻ nsv_log ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close nx_gguf_parse nx_le_read_u32 nx_le_read_u64 nx_le_read_u32 ↻ _gguf_skip_value nx_le_read_u64 ↻ nx_le_read_u32 ↻

structs

none

consts

17const CE_NE: i64 = 896
18const CE_SLOTS: i64 = 11

functions

20func ce_ws(s: *u8) -> i64
27func ce_wdec(v: i64) -> i64
called by 1: ce_kv calls 1: ce_ws
41func ce_kv(label: *u8, v: i64) -> i64
called by 2: ce_embedmain calls 2: ce_wsce_wdec
49func ce_isqrt(v: i64) -> i64
called by 1: ce_cos_pm
59func ce_cos_pm(a: *i64, b: *i64) -> i64
called by 1: main calls 1: ce_isqrt
92func ce_bytes_eq(a: *i64, b: *i64) -> i64
called by 1: main
99func ce_find(hay: *u8, hn: i64, needle: *u8) -> i64
called by 1: main
114func ce_maxabs(a: *i64) -> i64
called by 1: main
127func ce_embed(vecs: *i64, slot: i64, pre: *u8, content: *u8) -> i64
144func ce_vp(vecs: *i64, slot: i64) -> *i64
called by 1: main
149func main() -> i64