Restore professional model card format matching commit f924ac24
Browse files
README.md
CHANGED
|
@@ -1,111 +1,267 @@
|
|
| 1 |
---
|
| 2 |
-
license: mit
|
| 3 |
language:
|
| 4 |
- en
|
| 5 |
-
|
|
|
|
| 6 |
tags:
|
| 7 |
-
- lf4
|
| 8 |
-
- 4-bit
|
| 9 |
-
- static-embeddings
|
| 10 |
- sentence-similarity
|
| 11 |
-
-
|
|
|
|
| 12 |
- rag
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
- code-search
|
| 14 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
---
|
| 16 |
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
-
|
| 20 |
|
| 21 |
---
|
| 22 |
|
| 23 |
-
##
|
| 24 |
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
---
|
| 32 |
|
| 33 |
-
## π Benchmark Results
|
| 34 |
|
| 35 |
-
|
| 36 |
-
Evaluated on 1,379 official test pairs:
|
| 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 |
```bash
|
| 65 |
-
pip install
|
| 66 |
```
|
| 67 |
|
| 68 |
-
###
|
| 69 |
|
| 70 |
```python
|
| 71 |
-
from
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
-
#
|
| 74 |
-
model = VortexEmbedV4_5.from_pretrained("VTXAI/vtx-embed-7M")
|
| 75 |
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
-
|
| 84 |
-
embeddings_256 = model.encode(texts, normalize=True, truncate_dim=256)
|
| 85 |
-
print("256-dim shape:", embeddings_256.shape)
|
| 86 |
|
| 87 |
-
#
|
| 88 |
-
embeddings_64 = model.encode(texts, normalize=True, truncate_dim=64)
|
| 89 |
-
print("64-dim shape:", embeddings_64.shape)
|
| 90 |
|
| 91 |
-
# Cosine similarity matrix
|
| 92 |
-
similarity = embeddings_256[0] @ embeddings_256[1].T
|
| 93 |
-
print(f"Cosine Similarity (0 vs 1): {similarity:.4f}")
|
| 94 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
|
| 96 |
---
|
| 97 |
|
| 98 |
-
##
|
| 99 |
|
| 100 |
-
|
|
| 101 |
-
|---|---|
|
| 102 |
-
|
|
| 103 |
-
|
|
| 104 |
-
|
|
| 105 |
-
| **
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
|
| 107 |
---
|
| 108 |
|
| 109 |
## π License
|
| 110 |
|
| 111 |
-
|
|
|
|
| 1 |
---
|
|
|
|
| 2 |
language:
|
| 3 |
- en
|
| 4 |
+
license: mit
|
| 5 |
+
library_name: tokenizers
|
| 6 |
tags:
|
|
|
|
|
|
|
|
|
|
| 7 |
- sentence-similarity
|
| 8 |
+
- feature-extraction
|
| 9 |
+
- embeddings
|
| 10 |
- rag
|
| 11 |
+
- quantized
|
| 12 |
+
- 4-bit
|
| 13 |
+
- matryoshka
|
| 14 |
+
- ultra-lightweight
|
| 15 |
- code-search
|
| 16 |
+
- retrieval
|
| 17 |
+
pipeline_tag: feature-extraction
|
| 18 |
+
metrics:
|
| 19 |
+
- spearman_cosine
|
| 20 |
+
model-index:
|
| 21 |
+
- name: vtx-embed-7M
|
| 22 |
+
results:
|
| 23 |
+
- task:
|
| 24 |
+
type: sts
|
| 25 |
+
name: Semantic Textual Similarity
|
| 26 |
+
dataset:
|
| 27 |
+
name: STSBenchmark
|
| 28 |
+
type: mteb/stsbenchmark-sts
|
| 29 |
+
metrics:
|
| 30 |
+
- type: cosine_spearman
|
| 31 |
+
value: 0.7918
|
| 32 |
+
- task:
|
| 33 |
+
type: sts
|
| 34 |
+
name: Semantic Textual Similarity
|
| 35 |
+
dataset:
|
| 36 |
+
name: SICK-R
|
| 37 |
+
type: mteb/sickr-sts
|
| 38 |
+
metrics:
|
| 39 |
+
- type: cosine_spearman
|
| 40 |
+
value: 0.6294
|
| 41 |
+
- task:
|
| 42 |
+
type: classification
|
| 43 |
+
name: Classification
|
| 44 |
+
dataset:
|
| 45 |
+
name: Banking77Classification
|
| 46 |
+
type: mteb/banking77
|
| 47 |
+
metrics:
|
| 48 |
+
- type: accuracy
|
| 49 |
+
value: 0.7043
|
| 50 |
+
- task:
|
| 51 |
+
type: classification
|
| 52 |
+
name: Classification
|
| 53 |
+
dataset:
|
| 54 |
+
name: AmazonCounterfactualClassification
|
| 55 |
+
type: mteb/amazon_counterfactual_classification
|
| 56 |
+
metrics:
|
| 57 |
+
- type: accuracy
|
| 58 |
+
value: 0.6679
|
| 59 |
+
- task:
|
| 60 |
+
type: clustering
|
| 61 |
+
name: Clustering
|
| 62 |
+
dataset:
|
| 63 |
+
name: TwentyNewsgroupsClustering
|
| 64 |
+
type: mteb/twentynewsgroups-clustering
|
| 65 |
+
metrics:
|
| 66 |
+
- type: v_measure
|
| 67 |
+
value: 0.2936
|
| 68 |
+
- task:
|
| 69 |
+
type: clustering
|
| 70 |
+
name: Clustering
|
| 71 |
+
dataset:
|
| 72 |
+
name: RedditClustering
|
| 73 |
+
type: mteb/reddit-clustering
|
| 74 |
+
metrics:
|
| 75 |
+
- type: v_measure
|
| 76 |
+
value: 0.388
|
| 77 |
---
|
| 78 |
|
| 79 |
+
<div align="center">
|
| 80 |
+
|
| 81 |
+
# π vtx-embed-7M
|
| 82 |
+
|
| 83 |
+
**The world's most memory-efficient general-purpose embedding model.**
|
| 84 |
+
Native 4-Bit quantization Β· 4.72 MB RAM Β· Matryoshka MRL Β· Sub-millisecond CPU latency
|
| 85 |
+
|
| 86 |
+
[](https://huggingface.co/VTXAI/vtx-embed-7M)
|
| 87 |
+
[](https://opensource.org/licenses/MIT)
|
| 88 |
+
[](https://python.org)
|
| 89 |
|
| 90 |
+
</div>
|
| 91 |
|
| 92 |
---
|
| 93 |
|
| 94 |
+
## π Model Details
|
| 95 |
|
| 96 |
+
| Property | Value |
|
| 97 |
+
| :--- | :--- |
|
| 98 |
+
| **Model Type** | Native 4-Bit Static Embedding (LF4) |
|
| 99 |
+
| **Total Parameters** | 7.55M (4-Bit packed) |
|
| 100 |
+
| **Tensor Storage Format** | `lf4` β 4-bit per-block with FP16 scale + zero |
|
| 101 |
+
| **In-RAM Memory** | **4.72 MB** |
|
| 102 |
+
| **On-Disk Size** | **4.72 MB** |
|
| 103 |
+
| **Vocabulary Size** | 29,528 |
|
| 104 |
+
| **Max Sequence Length** | 512 tokens |
|
| 105 |
+
| **Output Dimensions** | 256 *(Matryoshka: also 128, 64)* |
|
| 106 |
+
| **Pooling** | SIF IDF-weighted + PC-1 removal |
|
| 107 |
+
| **Similarity Metric** | Cosine |
|
| 108 |
+
| **License** | MIT |
|
| 109 |
|
| 110 |
---
|
| 111 |
|
| 112 |
+
## π Official MTEB Benchmark Results
|
| 113 |
|
| 114 |
+
All scores below were produced by running the **official [MTEB](https://github.com/embeddings-benchmark/mteb) 2.18.7** evaluation framework directly against this model on CPU. No cheating β no overlap with training data.
|
|
|
|
| 115 |
|
| 116 |
+
### Semantic Textual Similarity (STS)
|
| 117 |
+
|
| 118 |
+
| Dataset | Metric | **vtx-embed-7M** | MiniLM-L6-v2 (90 MB) | bge-small-en-v1.5 (134 MB) |
|
| 119 |
+
| :--- | :---: | :---: | :---: | :---: |
|
| 120 |
+
| **STSBenchmark** | Spearman Ο | **0.7918** | 0.8284 | 0.8278 |
|
| 121 |
+
| **SICK-R** | Spearman Ο | **0.6294** | 0.7572 | 0.7460 |
|
| 122 |
+
|
| 123 |
+
### Classification
|
| 124 |
+
|
| 125 |
+
| Dataset | Metric | **vtx-embed-7M** | MiniLM-L6-v2 (90 MB) | bge-small-en-v1.5 (134 MB) |
|
| 126 |
+
| :--- | :---: | :---: | :---: | :---: |
|
| 127 |
+
| **Banking77Classification** | Accuracy | **0.7043** | 0.7451 | 0.7884 |
|
| 128 |
+
| **AmazonCounterfactualClassification** | Accuracy | **0.6679** | 0.7371 | 0.7279 |
|
| 129 |
+
|
| 130 |
+
### Clustering
|
| 131 |
+
|
| 132 |
+
| Dataset | Metric | **vtx-embed-7M** | MiniLM-L6-v2 (90 MB) | bge-small-en-v1.5 (134 MB) |
|
| 133 |
+
| :--- | :---: | :---: | :---: | :---: |
|
| 134 |
+
| **TwentyNewsgroupsClustering** | V-Measure | **0.2936** | 0.3529 | 0.4419 |
|
| 135 |
+
| **RedditClustering** | V-Measure | **0.3880** | 0.4342 | 0.5376 |
|
| 136 |
|
| 137 |
---
|
| 138 |
|
| 139 |
+
## β‘ Efficiency Benchmark
|
| 140 |
+
|
| 141 |
+
*Compared against LiquidAI's LFM2.5-Embedding-350M (from their published benchmarks):*
|
| 142 |
|
| 143 |
+
| Model | RAM | Disk | CPU Latency p50 | CPU Latency p95 | Texts/sec |
|
| 144 |
+
| :--- | :-: | :-: | :-: | :-: | :-: |
|
| 145 |
+
| **vtx-embed-7M (256-dim)** | **4.72 MB** | **4.72 MB** | **0.575 ms** | **1.034 ms** | **18,151** |
|
| 146 |
+
| **vtx-embed-7M (64-dim)** | **4.72 MB** | **4.72 MB** | **0.312 ms** | **0.620 ms** | **~32,000** |
|
| 147 |
+
| LiquidAI/LFM2.5-Embedding-350M | ~700 MB | 708 MB | 7.30 ms | 9.60 ms | ~137 |
|
| 148 |
+
| sentence-transformers/all-MiniLM-L6-v2 | 90 MB | 90 MB | 12.4 ms | 18.0 ms | ~80 |
|
| 149 |
+
| BAAI/bge-small-en-v1.5 | 134 MB | 134 MB | 18.2 ms | 25.0 ms | ~55 |
|
| 150 |
+
|
| 151 |
+
> **vtx-embed-7M is 12.7Γ faster and 148Γ smaller in RAM than LFM2.5-Embedding-350M.**
|
| 152 |
|
| 153 |
---
|
| 154 |
|
| 155 |
+
## π― Matryoshka Representation Learning
|
| 156 |
|
| 157 |
+
vtx-embed-7M supports dynamic **truncation** of output vectors β encode once, use at any dimension:
|
| 158 |
+
|
| 159 |
+
| Dimension | Spearman Ο (STS-B) | Relative Speed | Use-case |
|
| 160 |
+
| :-: | :-: | :-: | :--- |
|
| 161 |
+
| **256** | **0.7918** | 1.0Γ | Full quality RAG / semantic search |
|
| 162 |
+
| **128** | **0.7753** | 1.4Γ | Balanced quality / storage |
|
| 163 |
+
| **64** | **0.7577** | 2.0Γ | High-throughput edge / mobile |
|
| 164 |
+
|
| 165 |
+
---
|
| 166 |
|
| 167 |
+
## π» Quickstart
|
| 168 |
+
|
| 169 |
+
### Installation
|
| 170 |
|
| 171 |
```bash
|
| 172 |
+
pip install numpy tokenizers safetensors huggingface_hub
|
| 173 |
```
|
| 174 |
|
| 175 |
+
### Load & Encode
|
| 176 |
|
| 177 |
```python
|
| 178 |
+
from huggingface_hub import hf_hub_download
|
| 179 |
+
import importlib.util
|
| 180 |
+
|
| 181 |
+
# Download single-file client (no torch, no transformers needed!)
|
| 182 |
+
path = hf_hub_download("VTXAI/vtx-embed-7M", "vortex_embed_v4_5.py")
|
| 183 |
+
spec = importlib.util.spec_from_file_location("ve", path)
|
| 184 |
+
mod = importlib.util.module_from_spec(spec); spec.loader.exec_module(mod)
|
| 185 |
+
|
| 186 |
+
# Load model β strict 4.72 MB RAM
|
| 187 |
+
model = mod.VortexEmbedV4_5.from_pretrained("VTXAI/vtx-embed-7M")
|
| 188 |
+
|
| 189 |
+
# Encode
|
| 190 |
+
sentences = ["A plane is taking off.", "An airplane is ascending into the sky."]
|
| 191 |
+
embeddings = model.encode(sentences, normalize=True) # (2, 256) float32
|
| 192 |
+
|
| 193 |
+
# Cosine similarity
|
| 194 |
+
sim = (embeddings[0] * embeddings[1]).sum()
|
| 195 |
+
print(f"Similarity: {sim:.4f}") # ~0.84
|
| 196 |
+
```
|
| 197 |
+
|
| 198 |
+
### Matryoshka Truncation
|
| 199 |
+
|
| 200 |
+
```python
|
| 201 |
+
emb_128 = model.encode(sentences, truncate_dim=128) # (2, 128)
|
| 202 |
+
emb_64 = model.encode(sentences, truncate_dim=64) # (2, 64)
|
| 203 |
+
```
|
| 204 |
|
| 205 |
+
### RAG / Code Search Pipeline
|
|
|
|
| 206 |
|
| 207 |
+
```python
|
| 208 |
+
# Index a corpus
|
| 209 |
+
corpus = ["def search(q): ...", "class RAGEngine: ...", "import numpy as np"]
|
| 210 |
+
corpus_embs = model.encode(corpus, normalize=True) # (N, 256)
|
| 211 |
+
|
| 212 |
+
# Query
|
| 213 |
+
query_emb = model.encode("how to build a search engine", normalize=True) # (256,)
|
| 214 |
+
scores = corpus_embs @ query_emb
|
| 215 |
+
top_k = scores.argsort()[::-1][:3]
|
| 216 |
+
for i in top_k:
|
| 217 |
+
print(f"[{scores[i]:.3f}] {corpus[i][:60]}")
|
| 218 |
+
```
|
| 219 |
|
| 220 |
+
---
|
|
|
|
|
|
|
| 221 |
|
| 222 |
+
## ποΈ Architecture
|
|
|
|
|
|
|
| 223 |
|
|
|
|
|
|
|
|
|
|
| 224 |
```
|
| 225 |
+
VortexEmbedV4_5
|
| 226 |
+
βββ Tokenizer BPE, vocab=29,528
|
| 227 |
+
βββ LF4 Embedding (29528, 128) uint8 packed β 3.78 MB
|
| 228 |
+
β βββ scale_fp16 (29528, 8) float16 β 0.47 MB
|
| 229 |
+
β βββ zero_fp16 (29528, 8) float16 β 0.47 MB
|
| 230 |
+
β βββ Total RAM β 4.72 MB
|
| 231 |
+
βββ Pooling SIF (sif_a=0.05, IDF-weighted mean)
|
| 232 |
+
βββ PCA Removal Top-1 principal component removed
|
| 233 |
+
βββ Matryoshka Truncation to 256 / 128 / 64 dims
|
| 234 |
+
```
|
| 235 |
+
|
| 236 |
+
**Quantization:** Each token embedding is stored as 128 packed 4-bit values across 8 groups. During inference, only active tokens per batch are dequantized on-the-fly β zero FP32/FP16 matrix ever stored in RAM.
|
| 237 |
|
| 238 |
---
|
| 239 |
|
| 240 |
+
## π Why vtx-embed-7M?
|
| 241 |
|
| 242 |
+
| Scenario | Why it matters |
|
| 243 |
+
| :--- | :--- |
|
| 244 |
+
| **Edge / Mobile Deployment** | Fits entirely in 4.72 MB β runs on microcontrollers, Raspberry Pi, or embedded systems |
|
| 245 |
+
| **High-Throughput RAG** | 18,151 texts/sec on a single CPU core β no GPU needed |
|
| 246 |
+
| **Large Codebase Indexing** | Indexes 26,000+ code chunks in seconds; 885 chunks/sec |
|
| 247 |
+
| **Cost Reduction** | Eliminate GPU inference costs entirely for embedding workloads |
|
| 248 |
+
| **Matryoshka Flexibility** | One model, three vector sizes β no retraining needed |
|
| 249 |
+
|
| 250 |
+
---
|
| 251 |
+
|
| 252 |
+
## π Citation
|
| 253 |
+
|
| 254 |
+
```bibtex
|
| 255 |
+
@misc{vtx-embed-7M,
|
| 256 |
+
title = {vtx-embed-7M: Native 4-Bit Sentence Embeddings with Matryoshka Representation Learning},
|
| 257 |
+
author = {VTXAI},
|
| 258 |
+
year = {2026},
|
| 259 |
+
url = {https://huggingface.co/VTXAI/vtx-embed-7M}
|
| 260 |
+
}
|
| 261 |
+
```
|
| 262 |
|
| 263 |
---
|
| 264 |
|
| 265 |
## π License
|
| 266 |
|
| 267 |
+
MIT License β free for commercial and research use.
|