File size: 1,650 Bytes
5dc5fbb
 
 
 
 
 
 
 
 
 
 
 
 
0fb4f82
5dc5fbb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
---
license: mit
base_model:
- BAAI/bge-small-en-v1.5
language: [en]
tags: [karma, on-device, embeddings, onnx, sentence-similarity]
---
# Karma embedding model (find files by what they are about)

The small English embedding model the Karma on-device assistant uses to find a file by its meaning when the words asked for are not in it ("how fast is my home internet" finds a broadband plan saved as `IMG_0911`). It runs on the phone; nothing it reads or produces leaves the device.

- **File:** `karma-embed.zip` (SHA-256 `f033a262981abe970de5fb5db7f13124377d8683053330a0430b6794a53e0623`). It holds `embedder-int8.onnx` (34 MB) and `vocab.txt`.
- **Based on:** [BAAI/bge-small-en-v1.5](https://huggingface.co/BAAI/bge-small-en-v1.5) (MIT), unchanged weights exported to ONNX with the pooling inside the graph (the [CLS] vector, normalised to length one) and 8-bit dynamic quantisation of the weights. Inputs `input_ids` and `attention_mask`; output `vector` (384 numbers). A search request is prefixed with "Represent this sentence for searching relevant passages: "; passages are not.
- **Measured** (30 invented documents, 60 requests, the app's real search code): the right file in the top three for 96.7% of requests, against 80.0% with the word index alone; for requests that share no word with the file, 93.3% against 63.3%. Quantising from 133 MB to 34 MB cost nothing measurable on this set. On a Test Phone it loads in about 0.4 s and embeds a request in 7 to 16 ms.
- **Limits:** English only. Measured on a small folder; with thousands of files there are more near matches. Text beyond the first 256 word pieces of a passage is cut off.