code wiki / _hdl_build / nx_ppmi_lib.nx
nx_ppmi_lib.nx
buildroot/runtime/_hdl_build/nx_ppmi_lib.nx
about
nx_ppmi_lib.nx -- THE canonical PPMI model library (eats debt seq283).
The loader + sparse-merge cosine over knowledge/index/semppmi_v1.bin had been hand-rolled
twice: pb_* inside nx_recall_dense.nx (the recall lane's reranker) and sj_* inside
nx_dr_semjudge.nx (the deep-research judge). Two copies of the same numeric code silently
diverging would change similarity scores without any gate noticing -- exactly the drift
class D001 was raised for. This is the ONE copy both should import.
MIGRATION STATE (honest): nx_dr_semjudge migrates onto this lib now. nx_recall_dense is a
LIVE organ owned by the recall lane and is NOT edited here -- it migrates on its owner's
next touch (D001 migrate-on-touch), at which point seq283 fully closes.
Model format (NXPPMI1): 32B header [magic, nv, nt] then vocab-hash[nv], row-index[nv+1],
norm^2[nv], ctx-id[nt], value[nt]. Vocabulary is keyed by db_semhash -- resolving a word
with any other hash silently yields -1 and zeroes every similarity.
Every func <=6 params (NAS nx_cc >6-arg skew, seq239). No hardware writes (Rule 26).
module: nishi-core.index.ppmi_lib
depends: nx_qabench_engine.nx (db_semhash/db_bsearch_i64), nx_syscalls.nx
genealogy_id: levy_goldberg_2014_ppmi
dependencies 2 imports · 11 importers
diagram shows first 10 each side; +0 more imports, +1 more importers in the complete lists below.
imports: nx_qabench_engine.nxnx_syscalls.nx
imported by: nx_beir_eval.nxnx_dbtc_ppmi_probe.nxnx_dbtc_ppmi_probe2.nxnx_debtcluster.nxnx_dr_densejudge.nxnx_dr_densejudge_cli.nxnx_dr_semjudge.nxnx_dr_semjudge_x_cli.nxnx_lawsearch.nxnx_ppmi_import_probe.nxnx_ppmi_lib_gate.nx
structs
| none |
consts
| none |
functions
| 24 | func ppl_isqrt(v: i64) -> i64 |
| 35 | func ppl_load(g: *i64, path: *u8) -> i64 |
| 87 | func ppl_cos(g: *i64, a: i64, b: i64) -> i64 |
| 114 | func ppl_dcos(g: *i64, a: i64, b: i64) -> i64 |
| 123 | func ppl_wid_range(g: *i64, buf: *u8, start: i64, end: i64) -> i64 |
| 139 | func ppl_tokenize_ids(g: *i64, buf: *u8, len: i64, out: *i64, maxn: i64) -> i64 |
| 167 | func ppl_idf_w(g: *i64, a: i64) -> i64 |
| 179 | func ppl_maxsim_idf(g: *i64, a: *i64, na: i64, b: *i64, nb: i64) -> i64 |
| 205 | func ppl_maxsim(g: *i64, a: *i64, na: i64, b: *i64, nb: i64) -> i64 |