KURE-Sparse-nano for the Apple Neural Engine
Core ML conversion of nlpai-lab/KURE-Sparse-nano
(revision 4d68cc696984e3c342d959c659e94b48fbe16578) that runs on the Apple Neural Engine
(cpuAndNeuralEngine). It is the model package of inl-ane in
NomaDamas/im-not-llm, the default for the sparse kind on
Apple silicon:
inl serve --sparse
Contents
| File | What |
|---|---|
ModernBertSpladeText.mlpackage | one fp16 ML Program function splade_S per length S in 64, 128, 256, 512, 768, 1024, 1536, 2048 |
embeddings.bf16 | token table [50002, H], raw little-endian bf16 rows (the lookup runs on the host) |
tokenizer.json | the original tokenizer; texts are encoded with special tokens ([CLS] text [SEP]), prefixed [Q] / [D] by the caller |
splade_pooling.json | the checkpoint's ShiftedTopKSpladePooling config: prefix tokens, masked vocabulary, canonical fold |
selftest.json, selftest.bin | one golden case per function, expectations from the fp32 Sentence-Transformers SparseEncoder |
manifest.json | function signatures, host contract and every file's size and sha256 |
splade_S takes inputs_embeds [1,S,H], global_bias [1,1,S,S] and local_bias [1,1,S,S] (0 where a row
may attend: same text, and within 64 rows for the local layers; -1e4 elsewhere) and keep [S,1] (1 on a
text's non-prefix tokens). Texts start on 8-row boundaries; the function returns, per 8-row block, the max of
relu(logit - 10) * keep over the vocabulary. The host takes each text's max over its blocks, zeroes the
masked vocabulary, applies log1p and folds onto the 36282 canonical terms.
Accuracy
The Neural Engine computes in fp16. Against the fp32 Sentence-Transformers model on an M4 Max: cosine 0.99883 to 0.99904 on the golden texts (the fp32 PyTorch port of the same graph: 1.000000). Ko-StrategyQA dev (592 queries, 9251 passages): nDCG@10 0.7905, Recall@100 0.9107; the fp32 candle engine: 0.7915, 0.9099.
Built with scripts/ane/build_modernbert_splade.py of im-not-llm (CPU only, scripts/ane/requirements.txt).
License
Apache-2.0, like the original model by NLP&AI Lab, Korea University. See LICENSE.