compiled artefacts from win_x64 (sm_120)
Browse files- .gitattributes +10 -0
- README.md +449 -141
- code-daemon-embed-v1-l_linux_x64_trt11.0_sm_120.engine +3 -0
- code-daemon-embed-v1-l_ov2026.2_cpu_int8_b128_s80.bin +3 -0
- code-daemon-embed-v1-l_ov2026.2_cpu_int8_b128_s80.xml +0 -0
- code-daemon-embed-v1-l_ov2026.2_igpu_lnl_int8_b128_s80.bin +3 -0
- code-daemon-embed-v1-l_ov2026.2_igpu_lnl_int8_b128_s80.xml +0 -0
- code-daemon-embed-v1-l_ov2026.2_npu_int4_b16_s80.bin +3 -0
- code-daemon-embed-v1-l_ov2026.2_npu_int4_b16_s80.xml +0 -0
- code-daemon-embed-v1-l_win_x64_trt11.0_sm_120.engine +3 -0
- code-daemon-embed-v1-m_linux_x64_trt11.0_sm_120.engine +3 -0
- code-daemon-embed-v1-m_ov2026.2_cpu_int8_b128_s64.bin +3 -0
- code-daemon-embed-v1-m_ov2026.2_cpu_int8_b128_s64.xml +0 -0
- code-daemon-embed-v1-m_ov2026.2_igpu_lnl_int8_b128_s64.bin +3 -0
- code-daemon-embed-v1-m_ov2026.2_igpu_lnl_int8_b128_s64.xml +0 -0
- code-daemon-embed-v1-m_ov2026.2_npu_int4_b16_s64.bin +3 -0
- code-daemon-embed-v1-m_ov2026.2_npu_int4_b16_s64.xml +0 -0
- code-daemon-embed-v1-m_win_x64_trt11.0_sm_120.engine +3 -0
- code-daemon-embed-v1-s_linux_x64_trt11.0_sm_120.engine +3 -0
- code-daemon-embed-v1-s_ov2026.2_cpu_int8_b96_s48.bin +3 -0
- code-daemon-embed-v1-s_ov2026.2_cpu_int8_b96_s48.xml +0 -0
- code-daemon-embed-v1-s_ov2026.2_igpu_lnl_int8_b96_s48.bin +3 -0
- code-daemon-embed-v1-s_ov2026.2_igpu_lnl_int8_b96_s48.xml +0 -0
- code-daemon-embed-v1-s_ov2026.2_npu_int4_b16_s48.bin +3 -0
- code-daemon-embed-v1-s_ov2026.2_npu_int4_b16_s48.xml +0 -0
- code-daemon-embed-v1-s_win_x64_trt11.0_sm_120.engine +3 -0
- code-daemon-embed-v1-xl_linux_x64_trt11.0_sm_120.engine +3 -0
- code-daemon-embed-v1-xl_ov2026.2_cpu_int8_b256_s128.bin +3 -0
- code-daemon-embed-v1-xl_ov2026.2_cpu_int8_b256_s128.xml +0 -0
- code-daemon-embed-v1-xl_ov2026.2_igpu_lnl_int8_b256_s128.bin +3 -0
- code-daemon-embed-v1-xl_ov2026.2_igpu_lnl_int8_b256_s128.xml +0 -0
- code-daemon-embed-v1-xl_ov2026.2_npu_int4_b16_s128.bin +3 -0
- code-daemon-embed-v1-xl_ov2026.2_npu_int4_b16_s128.xml +0 -0
- code-daemon-embed-v1-xl_win_x64_trt11.0_sm_120.engine +3 -0
- code-daemon-embed-v1_linux_x64_tvm0.25_vulkan.so +3 -0
- code-daemon-embed-v1_win_x64_tvm0.25_vulkan.dll +3 -0
- config.json +24 -24
- manifest.json +17 -11
- model.onnx +2 -2
- model_gpu_mlx0.22/config.json +24 -0
- model_int8qdt.onnx +3 -0
- tokenizer_config.json +7 -7
.gitattributes
CHANGED
|
@@ -40,3 +40,13 @@ code-daemon-embed-v1-m_win_x64_trt_sm_120.engine filter=lfs diff=lfs merge=lfs -
|
|
| 40 |
code-daemon-embed-v1-s_b64_s40_win_x64_tvm_vulkan.dll filter=lfs diff=lfs merge=lfs -text
|
| 41 |
code-daemon-embed-v1-s_win_x64_trt_sm_120.engine filter=lfs diff=lfs merge=lfs -text
|
| 42 |
model.onnx.data filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
code-daemon-embed-v1-s_b64_s40_win_x64_tvm_vulkan.dll filter=lfs diff=lfs merge=lfs -text
|
| 41 |
code-daemon-embed-v1-s_win_x64_trt_sm_120.engine filter=lfs diff=lfs merge=lfs -text
|
| 42 |
model.onnx.data filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
code-daemon-embed-v1-l_linux_x64_trt11.0_sm_120.engine filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
code-daemon-embed-v1-m_linux_x64_trt11.0_sm_120.engine filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
code-daemon-embed-v1-s_linux_x64_trt11.0_sm_120.engine filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
code-daemon-embed-v1-xl_linux_x64_trt11.0_sm_120.engine filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
code-daemon-embed-v1-l_win_x64_trt11.0_sm_120.engine filter=lfs diff=lfs merge=lfs -text
|
| 48 |
+
code-daemon-embed-v1-m_win_x64_trt11.0_sm_120.engine filter=lfs diff=lfs merge=lfs -text
|
| 49 |
+
code-daemon-embed-v1-s_win_x64_trt11.0_sm_120.engine filter=lfs diff=lfs merge=lfs -text
|
| 50 |
+
code-daemon-embed-v1-xl_win_x64_trt11.0_sm_120.engine filter=lfs diff=lfs merge=lfs -text
|
| 51 |
+
code-daemon-embed-v1_linux_x64_tvm0.25_vulkan.so filter=lfs diff=lfs merge=lfs -text
|
| 52 |
+
code-daemon-embed-v1_win_x64_tvm0.25_vulkan.dll filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -11,6 +11,8 @@ tags:
|
|
| 11 |
- feature-extraction
|
| 12 |
- sentence-similarity
|
| 13 |
- knowledge-distillation
|
|
|
|
|
|
|
| 14 |
pipeline_tag: feature-extraction
|
| 15 |
base_model:
|
| 16 |
- intfloat/multilingual-e5-base
|
|
@@ -24,175 +26,484 @@ datasets:
|
|
| 24 |
|
| 25 |
# code-daemon-embed-v1
|
| 26 |
|
| 27 |
-
A
|
| 28 |
-
|
| 29 |
-
into a shared **768-dim**
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
**
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
##
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
|
| 116 |
```python
|
| 117 |
import onnxruntime as ort, sentencepiece as spm, numpy as np
|
| 118 |
|
| 119 |
sp = spm.SentencePieceProcessor(model_file="sentencepiece.bpe.model") # pad=0 unk=1 bos=2 eos=3
|
| 120 |
-
sess = ort.InferenceSession("
|
| 121 |
|
| 122 |
def embed(texts, max_len=128):
|
| 123 |
-
ids = [[2, *sp.encode(t)[: max_len - 2], 3] for t in texts]
|
| 124 |
L = max(len(x) for x in ids)
|
| 125 |
-
inp = np.array([x + [0] * (L - len(x)) for x in ids], dtype=np.int64)
|
| 126 |
mask = (inp != 0).astype(np.int64)
|
| 127 |
-
|
| 128 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
```
|
| 130 |
|
| 131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
|
| 133 |
-
|
|
|
|
| 134 |
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
- **Tokenizer** — `sentencepiece.bpe.model` (raw-SP: pad=0 / unk=1 / bos=2 / eos=3, byte-fallback) +
|
| 142 |
-
`tokenizer_config.json`.
|
| 143 |
-
- **ONNX source** — `model.onnx` (+ `model.onnx.data`) FP32.
|
| 144 |
|
| 145 |
-
|
| 146 |
-
> are the always-present source of truth.
|
| 147 |
|
| 148 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
|
| 150 |
-
|
|
|
|
| 151 |
|
| 152 |
-
|
| 153 |
-
multi-positive, file-level), the production hybrid retriever built on this model reaches:
|
| 154 |
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
| hit@5 | **0.73** |
|
| 158 |
-
| hit@1 | 0.44 |
|
| 159 |
-
| pool_recall@64 | 0.79 |
|
| 160 |
|
| 161 |
-
|
|
|
|
|
|
|
| 162 |
|
| 163 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
exceed the 128-token / retrieval scope and are not shown. (~2k CoIR-derived rows were present in
|
| 170 |
-
training as diversity regularization; overlap with test splits was not audited.)
|
| 171 |
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
|
| 182 |
-
|
| 183 |
-
|
| 184 |
|
| 185 |
-
|
|
|
|
| 186 |
|
| 187 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 188 |
|
| 189 |
## License & training data
|
| 190 |
|
| 191 |
Released under the **MIT license**.
|
| 192 |
|
| 193 |
The backbone (`intfloat/multilingual-e5-base`) is MIT; the teachers (`gte-modernbert-base`,
|
| 194 |
-
`Qwen3-Reranker-4B`) are Apache-2.0. As is standard practice for distilled embedding models,
|
| 195 |
-
**weights are released under MIT**. Training corpus, for transparency:
|
| 196 |
|
| 197 |
| Data | License note |
|
| 198 |
|---|---|
|
|
@@ -200,9 +511,6 @@ The backbone (`intfloat/multilingual-e5-base`) is MIT; the teachers (`gte-modern
|
|
| 200 |
| CoIR-derived code-retrieval pairs (~26% diversity stream) | per-subset CoIR licenses (research benchmark) |
|
| 201 |
| Teacher embeddings / scores (gte-modernbert, Qwen3-Reranker-4B) | Apache-2.0 teachers |
|
| 202 |
|
| 203 |
-
Unlike the previous release, **no MS MARCO / mMARCO data** was used — the earlier non-commercial
|
| 204 |
-
caveat no longer applies. This is **not legal advice**.
|
| 205 |
-
|
| 206 |
## Attribution
|
| 207 |
|
| 208 |
Backbone: [intfloat/multilingual-e5-base](https://huggingface.co/intfloat/multilingual-e5-base) (MIT).
|
|
|
|
| 11 |
- feature-extraction
|
| 12 |
- sentence-similarity
|
| 13 |
- knowledge-distillation
|
| 14 |
+
- quantized
|
| 15 |
+
- int8
|
| 16 |
pipeline_tag: feature-extraction
|
| 17 |
base_model:
|
| 18 |
- intfloat/multilingual-e5-base
|
|
|
|
| 26 |
|
| 27 |
# code-daemon-embed-v1
|
| 28 |
|
| 29 |
+
A **46.8M-parameter, 4-layer code-embedding model** that maps short code units — function
|
| 30 |
+
and method bodies, signatures, docstrings, symbol names — and short natural-language queries
|
| 31 |
+
into a shared **768-dim** space. INT8, 128-token window, ~10.7k embeddings/sec on a laptop
|
| 32 |
+
RTX 5060.
|
| 33 |
+
|
| 34 |
+
It is built for one job: **embedding a whole repository fast enough to re-index it on every
|
| 35 |
+
commit**, so that a coding agent can run semantic search on every question it is asked. Every
|
| 36 |
+
trade-off below follows from that — the depth, the 22.7k vocabulary, the 128-token cap, the
|
| 37 |
+
INT8 weights, the four length-bucketed engines.
|
| 38 |
+
|
| 39 |
+
```python
|
| 40 |
+
# the whole API surface — pooled AND L2-normalized inside the graph
|
| 41 |
+
vec = session.run(None, {"input_ids": ids, "attention_mask": mask})[0] # [B, 768], ready
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
Queries and documents are embedded **the same way** — no `query:` / `passage:` prefix.
|
| 45 |
+
|
| 46 |
+
---
|
| 47 |
+
|
| 48 |
+
## 1. What it is for, and why not a standard embedder
|
| 49 |
+
|
| 50 |
+
### The target workload
|
| 51 |
+
|
| 52 |
+
1. A repository is indexed: every function, method, type and doc chunk becomes one short text
|
| 53 |
+
and one vector. A 700k-entity C++ codebase embeds in **~81 seconds** on one consumer GPU.
|
| 54 |
+
2. Someone asks something short and keyword-shaped — *"git watcher head change reindex"*,
|
| 55 |
+
*"acquire database lock for project hash"*, *"where does the daemon start"*.
|
| 56 |
+
3. The vector channel runs next to a lexical (BM25-style) channel and the two are fused.
|
| 57 |
+
|
| 58 |
+
Point 3 matters: this model was trained to be **the dense half of a hybrid retriever**, not
|
| 59 |
+
to win alone. Its training queries imitate real captured agent traffic — short keyword bags,
|
| 60 |
+
behaviour descriptions, identifier fragments — rather than docstring paraphrases.
|
| 61 |
+
|
| 62 |
+
### Design choices vs a typical general-purpose text embedder
|
| 63 |
+
|
| 64 |
+
| | typical embedder (e5 / bge / gte class) | code-daemon-embed-v1 |
|
| 65 |
+
|---|---|---|
|
| 66 |
+
| Parameters | 110M – 7B | **46.8M** |
|
| 67 |
+
| Vocabulary | 30k – 250k, general text | **22.7k**, pruned to code + code-adjacent English |
|
| 68 |
+
| Max sequence | 512 – 8192 tokens | **128** (hard cap, by design) |
|
| 69 |
+
| Query format | often needs an instruction prefix | **none** — symmetric |
|
| 70 |
+
| Pooling | you implement it | **inside the graph** — output is already `[B, 768]` |
|
| 71 |
+
| Weights | FP32 / FP16 | **INT8** from quantization-aware training |
|
| 72 |
+
| Top-rank precision | needs a separate cross-encoder pass | **cross-encoder ranking distilled into the vectors** |
|
| 73 |
+
|
| 74 |
+
### The built-in reranker
|
| 75 |
+
|
| 76 |
+
A bi-encoder compresses each document into a vector *before* it sees the query, so it cannot
|
| 77 |
+
do the pairwise comparison a cross-encoder reranker does. This model closes part of that gap
|
| 78 |
+
at **training** time instead of inference time: `Qwen/Qwen3-Reranker-4B` scored every
|
| 79 |
+
(query, candidate) pair over mined hard negatives, and the student was trained with a
|
| 80 |
+
**listwise-KL** objective to reproduce the teacher's *ranking distribution* — not merely
|
| 81 |
+
"positive above negative", but how much each near-miss should trail.
|
| 82 |
+
|
| 83 |
+
Practical consequence: **you probably do not need a runtime reranker on top of it.** In the
|
| 84 |
+
production system it was built for, switching one on measured net-negative — the distillation
|
| 85 |
+
had already captured the useful part, at zero inference cost.
|
| 86 |
+
|
| 87 |
+
### Strong / weak
|
| 88 |
+
|
| 89 |
+
**Strong**
|
| 90 |
+
- Repository search with short NL, keyword and identifier queries.
|
| 91 |
+
- Natural language → code at short lengths.
|
| 92 |
+
- The dense channel of a hybrid retriever.
|
| 93 |
+
- Throughput-bound work: bulk re-index, index-on-save, re-embed per commit.
|
| 94 |
+
|
| 95 |
+
**Weak / out of scope**
|
| 96 |
+
- **Long documents.** Hard 128-token cap. Not a long-context retriever (see the window
|
| 97 |
+
recipe in §4.6 if you must handle longer text).
|
| 98 |
+
- Benchmark-style long problem statements, multi-turn dialogue, code↔code translation.
|
| 99 |
+
- General English prose (medical / financial / news) — the pruned vocabulary trades that
|
| 100 |
+
away deliberately.
|
| 101 |
+
|
| 102 |
+
---
|
| 103 |
+
|
| 104 |
+
## 2. Architecture — what was kept, cut and added
|
| 105 |
+
|
| 106 |
+
### Specification
|
| 107 |
+
|
| 108 |
+
| | |
|
| 109 |
+
|---|---|
|
| 110 |
+
| Base | `intfloat/multilingual-e5-base` (XLM-RoBERTa encoder, 12L, 278M) |
|
| 111 |
+
| Encoder layers | **4** |
|
| 112 |
+
| Hidden size | 768 |
|
| 113 |
+
| Attention heads | 12 |
|
| 114 |
+
| FFN | 3072, GELU |
|
| 115 |
+
| LayerNorm eps | 1e-5 |
|
| 116 |
+
| Vocabulary | **22,739** SentencePiece **unigram** pieces, byte fallback |
|
| 117 |
+
| Position embeddings | 514 allocated (learned, absolute) |
|
| 118 |
+
| Max sequence used | **128 tokens** |
|
| 119 |
+
| Output | **768-dim, mask-mean-pooled AND L2-normalized inside the graph** — use it as it comes |
|
| 120 |
+
| Parameters | **46.80M** = 17.46M embedding table + 4 × ~7.3M encoder + positions |
|
| 121 |
+
| Weights | **INT8**, quantization-aware training, Q/DQ nodes carry the trained scales |
|
| 122 |
+
| ONNX | opset 19; inputs `input_ids`, `attention_mask`, both **int64** `[batch, seq]` |
|
| 123 |
+
| Special token ids | **pad=0, unk=1, bos=2, eos=3** (raw-SentencePiece indexing) |
|
| 124 |
+
|
| 125 |
+
### Removed from the base model
|
| 126 |
+
|
| 127 |
+
- **8 of 12 encoder layers** — strided-truncated 12 → 8 → 6 → **4**, healed after each cut.
|
| 128 |
+
- **227k of 250k vocabulary pieces**: 250,002 → 22,739, and the embedding table with them
|
| 129 |
+
(192M → 17.5M parameters — the single largest saving in the model).
|
| 130 |
+
- **The E5 instruction prefixes.** No `query:` / `passage:` asymmetry; both sides are encoded
|
| 131 |
+
identically.
|
| 132 |
+
- **The pooler head, the MLM head, token-type inputs.** The graph has exactly two inputs.
|
| 133 |
+
- **FP32 weights** — replaced by INT8 with trained scales.
|
| 134 |
+
|
| 135 |
+
### Added
|
| 136 |
+
|
| 137 |
+
- **Mask-aware mean pooling and L2 normalization fused into the ONNX graph.** The model
|
| 138 |
+
returns unit-norm `[B, 768]`, not `[B, seq, 768]` — there is no pooling code to get wrong,
|
| 139 |
+
no `last_hidden_state` copy, and no way to accidentally compare unnormalized vectors.
|
| 140 |
+
- **Q/DQ nodes with QAT-trained scales**, so a TensorRT/OpenVINO build is INT8 end-to-end
|
| 141 |
+
without a calibration pass.
|
| 142 |
+
- **Ranking knowledge from a 4B cross-encoder** (the built-in reranker above).
|
| 143 |
+
- **Four length-bucketed engine builds** with a dynamic sequence dimension (§3, §4.4).
|
| 144 |
+
|
| 145 |
+
### Training recipe, in brief
|
| 146 |
+
|
| 147 |
+
1. Strided depth truncation of the e5 backbone, vocabulary pruning, re-indexing to the
|
| 148 |
+
raw-SentencePiece id convention.
|
| 149 |
+
2. **Dense representation distillation** from `Alibaba-NLP/gte-modernbert-base` (MSE against
|
| 150 |
+
the teacher's embeddings) over real repository entities.
|
| 151 |
+
3. **Listwise-KL ranking distillation** from `Qwen/Qwen3-Reranker-4B` over mined hard
|
| 152 |
+
negatives.
|
| 153 |
+
4. **Diversity regularization** — ~26% of the grouped training stream is out-of-domain
|
| 154 |
+
code-retrieval pairs (CoIR-derived). Measured sweet spot: 0% loses deep recall, 50%
|
| 155 |
+
dilutes the top.
|
| 156 |
+
5. **Self-distillation QAT** to INT8, exported with the scales learned during training.
|
| 157 |
+
|
| 158 |
+
### If you re-train, cut or re-quantize it
|
| 159 |
+
|
| 160 |
+
Two results that will cost you a training run if you rediscover them yourself:
|
| 161 |
+
|
| 162 |
+
- ⚠ **Do not run PTQ/calibration over the shipped INT8 graph.** It overwrites the trained
|
| 163 |
+
scales with fitted ones and measurably degrades the model (cosine .93 against the correct
|
| 164 |
+
export). `model_int8qdt.onnx` *is* the artifact — feed it to your builder as-is. Plain
|
| 165 |
+
post-training quantization of this body was also tried on its own and is quality-broken:
|
| 166 |
+
engine hit@1 fell .200 → .133, which is why the shipped weights come from QAT.
|
| 167 |
+
- ⚠ **Heal a depth cut on documents *and* queries.** Re-distilling the 4-layer student
|
| 168 |
+
against document texts only cost **−29.8% hit@1**; the same initialization and budget
|
| 169 |
+
against documents *and* queries cost **−3.9%** on the same 2,441-query gate. Retrieval
|
| 170 |
+
lives in the *relation* between the two sides — a document-only anchor lets the query side
|
| 171 |
+
drift.
|
| 172 |
+
|
| 173 |
+
---
|
| 174 |
+
|
| 175 |
+
## 3. Performance
|
| 176 |
+
|
| 177 |
+
Measured on **one RTX 5060 Laptop GPU (sm_120, 8 GB)**, TensorRT INT8, pinned TDP,
|
| 178 |
+
`clocks.sm` 2,647 MHz median at 114 W.
|
| 179 |
+
|
| 180 |
+
### End-to-end, inside the production indexer
|
| 181 |
+
|
| 182 |
+
The whole path: build the serve text → tokenize on host threads → IPC to the worker →
|
| 183 |
+
GPU forward → pool → collect.
|
| 184 |
+
|
| 185 |
+
| corpus | vectors | wall | pipeline emb/s | GPU-only emb/s |
|
| 186 |
+
|---|--:|--:|--:|--:|
|
| 187 |
+
| **mysql-server** (sustained, 54 batches) | 868,795 | 80.96 s | **10,731** | 11,712 |
|
| 188 |
+
|
| 189 |
+
`pipeline emb/s` = vectors ÷ wall clock, everything included. `GPU-only` = vectors ÷ summed
|
| 190 |
+
inference time; it is higher because host work overlaps with the GPU.
|
| 191 |
+
|
| 192 |
+
### Solo engine profiles — cost per sequence length
|
| 193 |
+
|
| 194 |
+
Four engines, one per length bucket, each with a **dynamic sequence dimension** so a batch
|
| 195 |
+
can be dispatched at its own longest text instead of the bucket ceiling. One engine alone,
|
| 196 |
+
dispatch only, 200 iterations:
|
| 197 |
+
|
| 198 |
+
| bucket | profile (batch × seq) | seq | µs/text | texts/s |
|
| 199 |
+
|---|---|--:|--:|--:|
|
| 200 |
+
| **s** | 96 × 8…48, opt 48 | 8 | 13.78 | 72,587 |
|
| 201 |
+
| | | 16 | 19.73 | 50,681 |
|
| 202 |
+
| | | 24 | 26.86 | 37,228 |
|
| 203 |
+
| | | 32 | 33.73 | 29,651 |
|
| 204 |
+
| | | 40 | 42.56 | 23,495 |
|
| 205 |
+
| | | 48 | 50.54 | 19,785 |
|
| 206 |
+
| **m** | 128 × 56…64, opt 56 | 56 | 63.08 | 15,853 |
|
| 207 |
+
| | | 64 | 76.52 | 13,068 |
|
| 208 |
+
| **l** | 128 × 72…80, opt 72 | 72 | 88.48 | 11,302 |
|
| 209 |
+
| | | 80 | 100.87 | 9,913 |
|
| 210 |
+
| **xl** | 256 × 88…128, opt 96 | 88 | 117.14 | 8,537 |
|
| 211 |
+
| | | 96 | 127.95 | 7,816 |
|
| 212 |
+
| | | 104 | 142.31 | 7,027 |
|
| 213 |
+
| | | 112 | 155.74 | 6,421 |
|
| 214 |
+
| | | 120 | 169.28 | 5,907 |
|
| 215 |
+
| | | 128 | 183.03 | 5,464 |
|
| 216 |
+
|
| 217 |
+
Three things to take from that table when you build your own serving path:
|
| 218 |
+
|
| 219 |
+
- **Cost is per token, not per text**, and it is superlinear: solo token throughput *falls*
|
| 220 |
+
from 1.01M tok/s at seq 48 to 0.71M at seq 128. Batch size is not the lever — a 256×64
|
| 221 |
+
engine measured **5.8% slower per text** than 128×64, because 96×48 already saturates the
|
| 222 |
+
SMs.
|
| 223 |
+
- **Padding is the lever.** A batch pays for its *longest* member, so sorting texts by length
|
| 224 |
+
before batching — and dispatching each batch at its own length — was worth **+10.2%**
|
| 225 |
+
end-to-end. Round lengths up to a multiple of 8: a non-multiple is slower than a *longer*
|
| 226 |
+
multiple (seq 70 costs more than seq 72).
|
| 227 |
+
- **Running the four engines concurrently does not add throughput** on one GPU. In parallel
|
| 228 |
+
they measured *slower* than serially (1,487 ms vs 1,423 ms for the same work). The lanes
|
| 229 |
+
exist to keep the GPU fed while the host works, not to multiply throughput.
|
| 230 |
+
|
| 231 |
+
### Without a discrete GPU — OpenVINO on CPU, integrated GPU and NPU
|
| 232 |
+
|
| 233 |
+
Same model, no NVIDIA card involved. Measured on an **Intel Core Ultra 9 275HX** — its CPU
|
| 234 |
+
cores, its integrated GPU, and its *AI Boost* NPU — with OpenVINO 2026.2. An OpenVINO IR is
|
| 235 |
+
reshaped to **one static shape** at build time (unlike the TensorRT engines, whose sequence
|
| 236 |
+
dimension is a range), so each bucket is a single number per device:
|
| 237 |
+
|
| 238 |
+
| device | precision | bucket | shape (batch × seq) | µs/text | texts/s |
|
| 239 |
+
|---|---|---|---|--:|--:|
|
| 240 |
+
| **CPU** | INT8 | s | 96 × 48 | 1,837 | 544 |
|
| 241 |
+
| | | m | 128 × 64 | 2,128 | 470 |
|
| 242 |
+
| | | l | 128 × 80 | 2,542 | 393 |
|
| 243 |
+
| | | xl | 256 × 128 | 4,223 | 237 |
|
| 244 |
+
| **iGPU** | INT8 | s | 96 × 48 | 888 | **1,126** |
|
| 245 |
+
| | | m | 128 × 64 | 1,168 | 856 |
|
| 246 |
+
| | | l | 128 × 80 | 1,498 | 667 |
|
| 247 |
+
| | | xl | 256 × 128 | 2,708 | 369 |
|
| 248 |
+
| **NPU** | INT4 | s | 16 × 48 | 1,784 | 560 |
|
| 249 |
+
| | | m | 16 × 64 | 2,334 | 428 |
|
| 250 |
+
| | | l | 16 × 80 | 3,350 | 299 |
|
| 251 |
+
| | | xl | 16 × 128 | 5,931 | 169 |
|
| 252 |
+
|
| 253 |
+
Reference point: the same buckets on the RTX 5060 run at 19,785 / 13,068 / 9,913 / 5,464
|
| 254 |
+
texts/s, so the integrated GPU is **15–18× slower** than the discrete one. That still leaves
|
| 255 |
+
a 100k-entity repository indexed in a few minutes on a machine with no dedicated GPU at all.
|
| 256 |
+
|
| 257 |
+
Three notes if you deploy this path:
|
| 258 |
+
|
| 259 |
+
- **INT8 on CPU and iGPU, INT4 only on the NPU.** At 128 × 64 the iGPU does 859 texts/s in
|
| 260 |
+
INT8, 584 in FP16 — and **584 in INT4**, exactly the FP16 number. INT4 here is weight-only
|
| 261 |
+
compression: the weights decompress to fp16 before the GEMM, so it is the same GEMM and the
|
| 262 |
+
4 bits buy file size, not speed. Only INT8, which the kernels execute natively, moves the
|
| 263 |
+
number. The NPU is the exception because it requires INT4 with static shapes.
|
| 264 |
+
- **Feed it the Q/DQ graph, not a calibrated one.** OpenVINO keeps the QAT scales as
|
| 265 |
+
FakeQuantize; re-fitting them with a post-training pass measured hit@1 .200 → .133 on this
|
| 266 |
+
model. See §4.5 for the two-line recipe (and the transformation that keeps the IR at 96 MB
|
| 267 |
+
instead of 179 MB).
|
| 268 |
+
- **The NPU pays for batch, not for tokens.** Its IRs are baked at batch 16 against 96–256
|
| 269 |
+
elsewhere, which is why its per-text cost is the flattest across buckets and its per-batch
|
| 270 |
+
latency the lowest (28–95 ms). It suits interactive single-query embedding better than bulk
|
| 271 |
+
indexing.
|
| 272 |
+
|
| 273 |
+
### Retrieval quality
|
| 274 |
+
|
| 275 |
+
**80 captured real agent queries** over a live indexed codebase, multi-positive, file-level,
|
| 276 |
+
through a production hybrid retriever (dense + lexical, runtime reranker **off**):
|
| 277 |
+
|
| 278 |
+
| metric | value |
|
| 279 |
+
|---|--:|
|
| 280 |
+
| hit@1 | **0.46** |
|
| 281 |
+
| hit@3 | 0.74 |
|
| 282 |
+
| hit@5 | **0.78** |
|
| 283 |
+
| hit@10 | 0.80 |
|
| 284 |
+
| mrr@10 | 0.59 |
|
| 285 |
+
| ndcg@10 | 0.61 |
|
| 286 |
+
|
| 287 |
+
This is the metric the model is optimized for. On a broader 2,441-query gate across four
|
| 288 |
+
unrelated repositories, the 4-layer model trades about **4% relative hit@1** against its
|
| 289 |
+
6-layer parent for roughly **1.5× the engine speed**.
|
| 290 |
+
|
| 291 |
+
### CoIR — the out-of-domain reference
|
| 292 |
+
|
| 293 |
+
Run on **this exact artifact** — `model_int8qdt.onnx`, full corpora (2.3M documents across the
|
| 294 |
+
six tasks), NDCG@10, the same raw-SentencePiece tokenization the daemon uses:
|
| 295 |
+
|
| 296 |
+
| CoIR task | NDCG@10 | Pattern |
|
| 297 |
+
|---|--:|---|
|
| 298 |
+
| synthetic-text2sql | **51.26** | NL → SQL |
|
| 299 |
+
| stackoverflow-qa | 41.63 | short question → code |
|
| 300 |
+
| codesearchnet (6-lang avg) | 39.02 | docstring / NL → code |
|
| 301 |
+
| codefeedback-st | 38.55 | NL instruction → code |
|
| 302 |
+
| codesearchnet-ccr (6-lang avg) | 36.07 | code → related code |
|
| 303 |
+
| cosqa | 17.50 | NL question → code (noisy / hard) |
|
| 304 |
+
| **Average** | **37.34** | |
|
| 305 |
+
|
| 306 |
+
Per language — codesearchnet (NL→code): python **68.30**, go 46.15, java 34.64, ruby 28.76,
|
| 307 |
+
js 28.33, php 27.95. codesearchnet-ccr (code→code): js **43.36**, ruby 42.88, java 36.82,
|
| 308 |
+
php 31.59, go 31.06, python 30.68.
|
| 309 |
+
|
| 310 |
+
**Read this as a lower bound, not as the headline.** CoIR queries are mostly docstrings and
|
| 311 |
+
long problem statements — the opposite of what this model was tuned for, and the spread proves
|
| 312 |
+
it: 68.30 on Python docstring→code against 17.50 on cosqa's noisy question→code. Four of
|
| 313 |
+
CoIR's ten tasks (code↔code translation, multi-turn dialogue, long problem statements) exceed
|
| 314 |
+
the 128-token scope and are not shown. ~2k CoIR-derived rows were present in training as
|
| 315 |
+
diversity regularization; overlap with the test splits was not audited.
|
| 316 |
+
|
| 317 |
+
---
|
| 318 |
+
|
| 319 |
+
## 4. Using the model
|
| 320 |
+
|
| 321 |
+
### 4.1 What is in this repository
|
| 322 |
+
|
| 323 |
+
| File | What it is |
|
| 324 |
+
|---|---|
|
| 325 |
+
| `model_int8qdt.onnx` | **The source of truth.** INT8 Q/DQ graph with QAT-trained scales — what the TensorRT and OpenVINO INT8 engines are built from. |
|
| 326 |
+
| `model.onnx` | The FP32 twin of the same weights, for lanes that cannot read Q/DQ and for fine-tuning. Derived from the file above by dropping its Q/DQ pairs, so the weights are identical (cosine 0.98 between them is the quantization, not a different model). |
|
| 327 |
+
| `sentencepiece.bpe.model` | The tokenizer. Raw-SP ids: pad=0, unk=1, bos=2, eos=3. Its 22,739 pieces match the model's embedding table row for row. |
|
| 328 |
+
| `tokenizer_config.json`, `config.json` | HF-side metadata. |
|
| 329 |
+
| `code-daemon-embed-v1-{s,m,l,xl}_{win_x64,linux_x64}_trt11.0_sm_{75,86,89,120}.engine` | Prebuilt TensorRT engines. |
|
| 330 |
+
| `code-daemon-embed-v1-{s,m,l,xl}_ov2026.2_{cpu_int8,igpu_lnl_int8,igpu_arc_int4,npu_int4}_b*_s*.{xml,bin}` | Prebuilt OpenVINO models (Intel CPU / iGPU / NPU). |
|
| 331 |
+
| `code-daemon-embed-v1_{win_x64,linux_x64}_tvm0.25_vulkan.{dll,so}` | TVM Vulkan module (vendor-neutral GPU fallback). |
|
| 332 |
+
| `model_gpu_mlx0.22/` | MLX weights for Apple Silicon. |
|
| 333 |
+
|
| 334 |
+
> Compiled artifacts are uploaded progressively per architecture. The ONNX + tokenizer are
|
| 335 |
+
> the always-present source of truth; if the engine you want is missing, build it — §4.4.
|
| 336 |
+
|
| 337 |
+
### 4.2 Taking a prebuilt engine
|
| 338 |
+
|
| 339 |
+
The filenames are a loading contract, not decoration. A serialized TensorRT plan is keyed on
|
| 340 |
+
**{GPU architecture × OS × TensorRT version}** and `deserializeEngine` has no compatibility
|
| 341 |
+
fallback, so pick all four coordinates exactly:
|
| 342 |
+
|
| 343 |
+
```
|
| 344 |
+
code-daemon-embed-v1-m_win_x64_trt11.0_sm_120.engine
|
| 345 |
+
│ │ │ └── GPU arch: sm_75 Turing · sm_86 Ampere (RTX 30xx, A-series)
|
| 346 |
+
│ │ │ sm_89 Ada (RTX 40xx, L4) · sm_120 Blackwell (RTX 50xx)
|
| 347 |
+
│ │ └── TensorRT 11.0 — not interchangeable with 10.x
|
| 348 |
+
│ └── OS/ABI
|
| 349 |
+
└── length bucket: s | m | l | xl
|
| 350 |
+
```
|
| 351 |
+
|
| 352 |
+
Bucket shapes (batch × seq): **s** 96×48, **m** 128×64, **l** 128×80, **xl** 256×128. Loading
|
| 353 |
+
all four costs ~400 MB of VRAM; if you only want one, take **m** — it covers the fattest part
|
| 354 |
+
of a typical corpus (25–40% of texts land in 49…64 tokens).
|
| 355 |
+
|
| 356 |
+
Route each text to the first bucket whose sequence ceiling fits its token count, and pad the
|
| 357 |
+
batch to that bucket's shape. Padding is masked in attention, so a padded batch and an
|
| 358 |
+
unpadded one give the same vector (verified at cosine 1.000000) — provided the mask is right.
|
| 359 |
+
|
| 360 |
+
### 4.3 Running the ONNX directly
|
| 361 |
+
|
| 362 |
+
Works anywhere ONNX Runtime does (CPU, CUDA, DirectML) with no build step:
|
| 363 |
|
| 364 |
```python
|
| 365 |
import onnxruntime as ort, sentencepiece as spm, numpy as np
|
| 366 |
|
| 367 |
sp = spm.SentencePieceProcessor(model_file="sentencepiece.bpe.model") # pad=0 unk=1 bos=2 eos=3
|
| 368 |
+
sess = ort.InferenceSession("model_int8qdt.onnx", providers=["CPUExecutionProvider"])
|
| 369 |
|
| 370 |
def embed(texts, max_len=128):
|
| 371 |
+
ids = [[2, *sp.encode(t)[: max_len - 2], 3] for t in texts] # bos … eos
|
| 372 |
L = max(len(x) for x in ids)
|
| 373 |
+
inp = np.array([x + [0] * (L - len(x)) for x in ids], dtype=np.int64) # pad=0
|
| 374 |
mask = (inp != 0).astype(np.int64)
|
| 375 |
+
# pooled and unit-norm already — no post-processing
|
| 376 |
+
return sess.run(None, {"input_ids": inp, "attention_mask": mask})[0] # [B, 768]
|
| 377 |
+
|
| 378 |
+
D = embed(["function acquireLock in src/db.zig: zig\npath: src db"])
|
| 379 |
+
Q = embed(["acquire database lock"])
|
| 380 |
+
print(Q @ D.T) # inner product IS cosine here
|
| 381 |
```
|
| 382 |
|
| 383 |
+
Two notes that cost real debugging time:
|
| 384 |
+
|
| 385 |
+
- **Tokenize with SentencePiece, not a greedy-BPE merge loop.** The vocabulary is a
|
| 386 |
+
**unigram** model; scoring it with pair-merge BPE produces a *different segmentation* than
|
| 387 |
+
training used, and that train/serve skew silently costs retrieval quality.
|
| 388 |
+
- **Pad with id 0 and mask 0.** Both inputs are `int64`; feeding int32 buffers to a
|
| 389 |
+
hand-written runtime is the classic "second half of every batch is garbage" bug.
|
| 390 |
+
|
| 391 |
+
### 4.4 Building your own TensorRT engines
|
| 392 |
+
|
| 393 |
+
TensorRT 11 reads precision **entirely from the ONNX Q/DQ nodes** — the per-precision flags
|
| 394 |
+
(`--int8`, `--fp16`, `--calib`) were removed. Feed it the Q/DQ graph and pass
|
| 395 |
+
`--stronglyTyped`. Feed it an unquantized graph instead and you get an FP16 engine that builds
|
| 396 |
+
cleanly, loads cleanly, is twice the size and a fraction of the speed — the size is the only
|
| 397 |
+
visible symptom, so check it.
|
| 398 |
+
|
| 399 |
+
Rectangular engine for one bucket (here **m**, 128×64):
|
| 400 |
+
|
| 401 |
+
```bash
|
| 402 |
+
trtexec --onnx=model_int8qdt.onnx \
|
| 403 |
+
--saveEngine=code-daemon-embed-v1-m.engine \
|
| 404 |
+
--stronglyTyped \
|
| 405 |
+
--builderOptimizationLevel=5 \
|
| 406 |
+
--timingCacheFile=timing.cache \
|
| 407 |
+
--minShapes=input_ids:1x1,attention_mask:1x1 \
|
| 408 |
+
--optShapes=input_ids:128x64,attention_mask:128x64 \
|
| 409 |
+
--maxShapes=input_ids:128x64,attention_mask:128x64
|
| 410 |
+
```
|
| 411 |
|
| 412 |
+
Dynamic-sequence engines (the shipped configuration, +10.2% end-to-end) keep the batch
|
| 413 |
+
dimension rectangular and let `seq` range. Use these profiles:
|
| 414 |
|
| 415 |
+
| bucket | batch | seq min | seq **opt** | seq max |
|
| 416 |
+
|---|--:|--:|--:|--:|
|
| 417 |
+
| s | 96 | 8 | 48 | 48 |
|
| 418 |
+
| m | 128 | 56 | 56 | 64 |
|
| 419 |
+
| l | 128 | 72 | 72 | 80 |
|
| 420 |
+
| xl | 256 | 88 | 96 | 128 |
|
|
|
|
|
|
|
|
|
|
| 421 |
|
| 422 |
+
Three rules behind those numbers:
|
|
|
|
| 423 |
|
| 424 |
+
- **One dynamic engine per bucket, `opt` at that bucket's mean length** — never one global
|
| 425 |
+
dynamic engine. The tax is paid for being *far from the opt point*, not for being dynamic:
|
| 426 |
+
a single wide (16→64→128) engine costs +0.8% at seq 64 but **+15.4%** at seq 80.
|
| 427 |
+
- **Sequence length must be a multiple of 8** at dispatch (seq 70 costs more than seq 72).
|
| 428 |
+
- **Sort texts by length within a bucket and cut at batch boundaries** before dispatch.
|
| 429 |
+
Without the sort the dynamic engines buy ~0%: any 128-text batch drawn from the 49–64 range
|
| 430 |
+
almost surely contains a 64 and dispatches at 64 anyway.
|
| 431 |
|
| 432 |
+
A dynamic build reports ~69 layers against a rectangular build's ~54 — a wider shape range
|
| 433 |
+
costs fusions, and that is exactly where the small tax at the ceiling lives.
|
| 434 |
|
| 435 |
+
### 4.5 OpenVINO, TVM, MLX
|
|
|
|
| 436 |
|
| 437 |
+
OpenVINO reads the Q/DQ graph directly — the trained scales survive as FakeQuantize, so there
|
| 438 |
+
is **no calibration pass to run**:
|
|
|
|
|
|
|
|
|
|
| 439 |
|
| 440 |
+
```python
|
| 441 |
+
import openvino as ov
|
| 442 |
+
from openvino._offline_transformations import compress_quantize_weights_transformation
|
| 443 |
|
| 444 |
+
m = ov.Core().read_model("model_int8qdt.onnx")
|
| 445 |
+
compress_quantize_weights_transformation(m) # folds weights to i8: 179 MB -> 96 MB
|
| 446 |
+
m.reshape({"input_ids": [128, 64], "attention_mask": [128, 64]}) # one bucket, static
|
| 447 |
+
ov.save_model(m, "code-daemon-embed-v1-m_cpu.xml")
|
| 448 |
+
```
|
| 449 |
|
| 450 |
+
That transformation is not optional bookkeeping: `read_model` leaves every weight as f32 behind
|
| 451 |
+
a FakeQuantize, and the IR comes out nearly twice the size for the same arithmetic. Do **not**
|
| 452 |
+
reach for NNCF post-training quantization here — it would replace the trained scales with
|
| 453 |
+
fitted ones, which is the failure the warning in §2 describes.
|
|
|
|
|
|
|
| 454 |
|
| 455 |
+
The NPU artifacts are the exception: they start from the FP32 twin and apply INT4 weight
|
| 456 |
+
compression at batch 16, trading accuracy for size on purpose. TVM Vulkan modules and the MLX
|
| 457 |
+
weights are also built from the FP32 twin, per bucket.
|
| 458 |
+
|
| 459 |
+
### 4.6 Feeding it well
|
| 460 |
+
|
| 461 |
+
**Documents.** The model was trained on a compact, front-loaded "serve text": semantics
|
| 462 |
+
first, identifiers after, everything inside the 128-token budget. Reproducing that shape on
|
| 463 |
+
your own corpus is worth more than any inference tuning:
|
| 464 |
+
|
| 465 |
+
```
|
| 466 |
+
{type} {name} in {file}: {lang}
|
| 467 |
+
path: {directory tokens, space-separated}
|
| 468 |
+
[async] [exported] [test]
|
| 469 |
+
sig: ({params}) -> {return type}
|
| 470 |
+
{doc comment, first ~200 chars}
|
| 471 |
+
{one-to-two-sentence description}
|
| 472 |
+
```
|
| 473 |
+
|
| 474 |
+
for example:
|
| 475 |
+
|
| 476 |
+
```
|
| 477 |
+
function acquireProjectLock in src/storage/multi_db.zig: zig
|
| 478 |
+
path: src storage multi db
|
| 479 |
+
[exported]
|
| 480 |
+
sig: (allocator: Allocator, project_hash: []const u8) -> !Lock
|
| 481 |
+
Acquires the exclusive SQLite lock for one project.
|
| 482 |
+
```
|
| 483 |
|
| 484 |
+
Cap the whole text around 768 characters; the raw function body is deliberately *not* part of
|
| 485 |
+
it (it belongs in the lexical channel, where it measurably helps, not in the vector).
|
| 486 |
|
| 487 |
+
**Queries.** Feed them raw, no prefix, no template. The model is tuned for short keyword bags
|
| 488 |
+
and behaviour descriptions.
|
| 489 |
|
| 490 |
+
**Text longer than 128 tokens.** Split into overlapping windows — window 128, stride 96 —
|
| 491 |
+
embed each, then mean-pool the window vectors and L2-renormalize. That is what the production
|
| 492 |
+
indexer does for long doc chunks.
|
| 493 |
+
|
| 494 |
+
**Retrieval.** The vectors come out unit-norm, so inner product is cosine — no normalization
|
| 495 |
+
step of your own. They are dense and 768-dimensional; an IVF/HNSW index over them behaves
|
| 496 |
+
normally.
|
| 497 |
+
|
| 498 |
+
---
|
| 499 |
|
| 500 |
## License & training data
|
| 501 |
|
| 502 |
Released under the **MIT license**.
|
| 503 |
|
| 504 |
The backbone (`intfloat/multilingual-e5-base`) is MIT; the teachers (`gte-modernbert-base`,
|
| 505 |
+
`Qwen3-Reranker-4B`) are Apache-2.0. As is standard practice for distilled embedding models,
|
| 506 |
+
the **weights are released under MIT**. Training corpus, for transparency:
|
| 507 |
|
| 508 |
| Data | License note |
|
| 509 |
|---|---|
|
|
|
|
| 511 |
| CoIR-derived code-retrieval pairs (~26% diversity stream) | per-subset CoIR licenses (research benchmark) |
|
| 512 |
| Teacher embeddings / scores (gte-modernbert, Qwen3-Reranker-4B) | Apache-2.0 teachers |
|
| 513 |
|
|
|
|
|
|
|
|
|
|
| 514 |
## Attribution
|
| 515 |
|
| 516 |
Backbone: [intfloat/multilingual-e5-base](https://huggingface.co/intfloat/multilingual-e5-base) (MIT).
|
code-daemon-embed-v1-l_linux_x64_trt11.0_sm_120.engine
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4cc5df802763f42e5e4cd9385145cd4ec60812180d636b3b5ee5c705aaa4b273
|
| 3 |
+
size 101848500
|
code-daemon-embed-v1-l_ov2026.2_cpu_int8_b128_s80.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2307f73831b76bb4508cd26ee910d30d68429d3c7fb74b1fce00fefc709460b1
|
| 3 |
+
size 100617601
|
code-daemon-embed-v1-l_ov2026.2_cpu_int8_b128_s80.xml
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
code-daemon-embed-v1-l_ov2026.2_igpu_lnl_int8_b128_s80.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2307f73831b76bb4508cd26ee910d30d68429d3c7fb74b1fce00fefc709460b1
|
| 3 |
+
size 100617601
|
code-daemon-embed-v1-l_ov2026.2_igpu_lnl_int8_b128_s80.xml
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
code-daemon-embed-v1-l_ov2026.2_npu_int4_b16_s80.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f52ac233153d8623bfc2453aec30974ba52bda423c573ef16200949c6d56c77d
|
| 3 |
+
size 33285182
|
code-daemon-embed-v1-l_ov2026.2_npu_int4_b16_s80.xml
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
code-daemon-embed-v1-l_win_x64_trt11.0_sm_120.engine
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:27d928449594faa418f5172d9ecc31adcb3901ead546091ef96e019ea354c974
|
| 3 |
+
size 101860876
|
code-daemon-embed-v1-m_linux_x64_trt11.0_sm_120.engine
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1b8728c79459b35bfdee18463ed809e8ba16a30e78569bb0ad89351b53c0e5cd
|
| 3 |
+
size 101873372
|
code-daemon-embed-v1-m_ov2026.2_cpu_int8_b128_s64.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2307f73831b76bb4508cd26ee910d30d68429d3c7fb74b1fce00fefc709460b1
|
| 3 |
+
size 100617601
|
code-daemon-embed-v1-m_ov2026.2_cpu_int8_b128_s64.xml
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
code-daemon-embed-v1-m_ov2026.2_igpu_lnl_int8_b128_s64.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2307f73831b76bb4508cd26ee910d30d68429d3c7fb74b1fce00fefc709460b1
|
| 3 |
+
size 100617601
|
code-daemon-embed-v1-m_ov2026.2_igpu_lnl_int8_b128_s64.xml
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
code-daemon-embed-v1-m_ov2026.2_npu_int4_b16_s64.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f52ac233153d8623bfc2453aec30974ba52bda423c573ef16200949c6d56c77d
|
| 3 |
+
size 33285182
|
code-daemon-embed-v1-m_ov2026.2_npu_int4_b16_s64.xml
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
code-daemon-embed-v1-m_win_x64_trt11.0_sm_120.engine
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1b0e8969cf89635d93bdaa8fc2e9a1600d27f6cca43bb27a3c6cb22a81b3004d
|
| 3 |
+
size 101850012
|
code-daemon-embed-v1-s_linux_x64_trt11.0_sm_120.engine
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b65796f0f877d2f95b87c3016736a5f0753c97cf289fd5333346f94290fc5907
|
| 3 |
+
size 101864196
|
code-daemon-embed-v1-s_ov2026.2_cpu_int8_b96_s48.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2307f73831b76bb4508cd26ee910d30d68429d3c7fb74b1fce00fefc709460b1
|
| 3 |
+
size 100617601
|
code-daemon-embed-v1-s_ov2026.2_cpu_int8_b96_s48.xml
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
code-daemon-embed-v1-s_ov2026.2_igpu_lnl_int8_b96_s48.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2307f73831b76bb4508cd26ee910d30d68429d3c7fb74b1fce00fefc709460b1
|
| 3 |
+
size 100617601
|
code-daemon-embed-v1-s_ov2026.2_igpu_lnl_int8_b96_s48.xml
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
code-daemon-embed-v1-s_ov2026.2_npu_int4_b16_s48.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f52ac233153d8623bfc2453aec30974ba52bda423c573ef16200949c6d56c77d
|
| 3 |
+
size 33285182
|
code-daemon-embed-v1-s_ov2026.2_npu_int4_b16_s48.xml
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
code-daemon-embed-v1-s_win_x64_trt11.0_sm_120.engine
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9b33232ae4a47bfe16732d296e83649949a2a153306e523bf160da738f2023d5
|
| 3 |
+
size 101853452
|
code-daemon-embed-v1-xl_linux_x64_trt11.0_sm_120.engine
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a926b16af6bc89997c05c3b79b416fd2ffc11f386a28dfb38c12d2d5d5d47b58
|
| 3 |
+
size 101903652
|
code-daemon-embed-v1-xl_ov2026.2_cpu_int8_b256_s128.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2307f73831b76bb4508cd26ee910d30d68429d3c7fb74b1fce00fefc709460b1
|
| 3 |
+
size 100617601
|
code-daemon-embed-v1-xl_ov2026.2_cpu_int8_b256_s128.xml
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
code-daemon-embed-v1-xl_ov2026.2_igpu_lnl_int8_b256_s128.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2307f73831b76bb4508cd26ee910d30d68429d3c7fb74b1fce00fefc709460b1
|
| 3 |
+
size 100617601
|
code-daemon-embed-v1-xl_ov2026.2_igpu_lnl_int8_b256_s128.xml
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
code-daemon-embed-v1-xl_ov2026.2_npu_int4_b16_s128.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f52ac233153d8623bfc2453aec30974ba52bda423c573ef16200949c6d56c77d
|
| 3 |
+
size 33285182
|
code-daemon-embed-v1-xl_ov2026.2_npu_int4_b16_s128.xml
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
code-daemon-embed-v1-xl_win_x64_trt11.0_sm_120.engine
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a4f383692c9eadde7262025439335f696e0479499b34c1cdd301d36bbd60323a
|
| 3 |
+
size 101858260
|
code-daemon-embed-v1_linux_x64_tvm0.25_vulkan.so
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0c1e803073aa8b3c506a728f84e38269d749e4e46a963dd3bc6523c44aac86af
|
| 3 |
+
size 238396032
|
code-daemon-embed-v1_win_x64_tvm0.25_vulkan.dll
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d544ddbcfebc0d2d59aa70f6991d22c9c6cbc08fe0f7420c1f49f8eab826b712
|
| 3 |
+
size 238240256
|
config.json
CHANGED
|
@@ -1,24 +1,24 @@
|
|
| 1 |
-
{
|
| 2 |
-
"add_cross_attention": false,
|
| 3 |
-
"attention_probs_dropout_prob": 0.1,
|
| 4 |
-
"bos_token_id": 0,
|
| 5 |
-
"classifier_dropout": null,
|
| 6 |
-
"eos_token_id": 2,
|
| 7 |
-
"hidden_act": "gelu",
|
| 8 |
-
"hidden_dropout_prob": 0.1,
|
| 9 |
-
"hidden_size": 768,
|
| 10 |
-
"initializer_range": 0.02,
|
| 11 |
-
"intermediate_size": 3072,
|
| 12 |
-
"is_decoder": false,
|
| 13 |
-
"layer_norm_eps": 1e-05,
|
| 14 |
-
"max_position_embeddings": 514,
|
| 15 |
-
"model_type": "xlm-roberta",
|
| 16 |
-
"num_attention_heads": 12,
|
| 17 |
-
"num_hidden_layers":
|
| 18 |
-
"pad_token_id": 1,
|
| 19 |
-
"tie_word_embeddings": true,
|
| 20 |
-
"transformers_version": "5.
|
| 21 |
-
"type_vocab_size": 1,
|
| 22 |
-
"use_cache": true,
|
| 23 |
-
"vocab_size": 22739
|
| 24 |
-
}
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_cross_attention": false,
|
| 3 |
+
"attention_probs_dropout_prob": 0.1,
|
| 4 |
+
"bos_token_id": 0,
|
| 5 |
+
"classifier_dropout": null,
|
| 6 |
+
"eos_token_id": 2,
|
| 7 |
+
"hidden_act": "gelu",
|
| 8 |
+
"hidden_dropout_prob": 0.1,
|
| 9 |
+
"hidden_size": 768,
|
| 10 |
+
"initializer_range": 0.02,
|
| 11 |
+
"intermediate_size": 3072,
|
| 12 |
+
"is_decoder": false,
|
| 13 |
+
"layer_norm_eps": 1e-05,
|
| 14 |
+
"max_position_embeddings": 514,
|
| 15 |
+
"model_type": "xlm-roberta",
|
| 16 |
+
"num_attention_heads": 12,
|
| 17 |
+
"num_hidden_layers": 4,
|
| 18 |
+
"pad_token_id": 1,
|
| 19 |
+
"tie_word_embeddings": true,
|
| 20 |
+
"transformers_version": "5.1.0",
|
| 21 |
+
"type_vocab_size": 1,
|
| 22 |
+
"use_cache": true,
|
| 23 |
+
"vocab_size": 22739
|
| 24 |
+
}
|
manifest.json
CHANGED
|
@@ -1,11 +1,17 @@
|
|
| 1 |
-
{
|
| 2 |
-
"
|
| 3 |
-
"
|
| 4 |
-
"max_tokens": 128,
|
| 5 |
-
"quantization": "
|
| 6 |
-
"targets": [
|
| 7 |
-
"tensorrt"
|
| 8 |
-
],
|
| 9 |
-
"
|
| 10 |
-
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_id": "code-daemon-embed-v1",
|
| 3 |
+
"dimension": 768,
|
| 4 |
+
"max_tokens": 128,
|
| 5 |
+
"quantization": "int8",
|
| 6 |
+
"targets": [
|
| 7 |
+
"tensorrt"
|
| 8 |
+
],
|
| 9 |
+
"runtime_tags": {
|
| 10 |
+
"trt": "trt11.0",
|
| 11 |
+
"ov": "ov2026.2",
|
| 12 |
+
"tvm": "tvm0.25",
|
| 13 |
+
"mlx_dir": "model_gpu_mlx0.22"
|
| 14 |
+
},
|
| 15 |
+
"compiled_at": "2026-08-02T21:11:00Z",
|
| 16 |
+
"compiled_by": "models/_compile"
|
| 17 |
+
}
|
model.onnx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:57bcfc6aed11ea239d01f2b124f2f948456f2284ad6e2c4744452509c9c25ca9
|
| 3 |
+
size 187286767
|
model_gpu_mlx0.22/config.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_cross_attention": false,
|
| 3 |
+
"attention_probs_dropout_prob": 0.1,
|
| 4 |
+
"bos_token_id": 0,
|
| 5 |
+
"classifier_dropout": null,
|
| 6 |
+
"eos_token_id": 2,
|
| 7 |
+
"hidden_act": "gelu",
|
| 8 |
+
"hidden_dropout_prob": 0.1,
|
| 9 |
+
"hidden_size": 768,
|
| 10 |
+
"initializer_range": 0.02,
|
| 11 |
+
"intermediate_size": 3072,
|
| 12 |
+
"is_decoder": false,
|
| 13 |
+
"layer_norm_eps": 1e-05,
|
| 14 |
+
"max_position_embeddings": 514,
|
| 15 |
+
"model_type": "xlm-roberta",
|
| 16 |
+
"num_attention_heads": 12,
|
| 17 |
+
"num_hidden_layers": 4,
|
| 18 |
+
"pad_token_id": 1,
|
| 19 |
+
"tie_word_embeddings": true,
|
| 20 |
+
"transformers_version": "5.1.0",
|
| 21 |
+
"type_vocab_size": 1,
|
| 22 |
+
"use_cache": true,
|
| 23 |
+
"vocab_size": 22739
|
| 24 |
+
}
|
model_int8qdt.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1e5e66dce33dbe89b7ac9c4e68c4573888cefffab5ab283682d72771f5e545da
|
| 3 |
+
size 187490530
|
tokenizer_config.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
-
{
|
| 2 |
-
"tokenizer_class": "XLMRobertaTokenizer",
|
| 3 |
-
"model_max_length": 512,
|
| 4 |
-
"bos_token": "<s>",
|
| 5 |
-
"eos_token": "</s>",
|
| 6 |
-
"unk_token": "<unk>",
|
| 7 |
-
"pad_token": "<pad>"
|
| 8 |
}
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"tokenizer_class": "XLMRobertaTokenizer",
|
| 3 |
+
"model_max_length": 512,
|
| 4 |
+
"bos_token": "<s>",
|
| 5 |
+
"eos_token": "</s>",
|
| 6 |
+
"unk_token": "<unk>",
|
| 7 |
+
"pad_token": "<pad>"
|
| 8 |
}
|