Abhaykoul commited on
Commit
d3127b0
ยท
verified ยท
1 Parent(s): 681e020

Update README with vortexa core API and Indian examples for mini tier

Browse files
Files changed (1) hide show
  1. README.md +64 -136
README.md CHANGED
@@ -14,6 +14,7 @@ tags:
14
  - ultra-lightweight
15
  - code-search
16
  - retrieval
 
17
  pipeline_tag: feature-extraction
18
  metrics:
19
  - spearman_cosine
@@ -52,7 +53,7 @@ model-index:
52
  name: Classification
53
  dataset:
54
  name: AmazonCounterfactualClassification
55
- type: mteb/amazon_counterfactual_classification
56
  metrics:
57
  - type: accuracy
58
  value: 0.6679
@@ -78,12 +79,13 @@ model-index:
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
- [![HuggingFace](https://img.shields.io/badge/๐Ÿค—%20HuggingFace-VTXAI%2Fvtx--embed--7M-blue)](https://huggingface.co/VTXAI/vtx-embed-7M)
 
87
  [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
88
  [![Python 3.8+](https://img.shields.io/badge/Python-3.8%2B-blue)](https://python.org)
89
 
@@ -91,169 +93,95 @@ Native 4-Bit quantization ยท 4.72 MB RAM ยท Matryoshka MRL ยท Sub-millisecond CP
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}
 
14
  - ultra-lightweight
15
  - code-search
16
  - retrieval
17
+ - vortexa
18
  pipeline_tag: feature-extraction
19
  metrics:
20
  - spearman_cosine
 
53
  name: Classification
54
  dataset:
55
  name: AmazonCounterfactualClassification
56
+ type: mteb/amazon_counterfactual
57
  metrics:
58
  - type: accuracy
59
  value: 0.6679
 
79
 
80
  <div align="center">
81
 
82
+ # ๐Ÿš€ vtx-embed-7M (`mini`)
83
 
84
+ **The world's most memory-efficient static embedding model powering [vortexa](https://github.com/OEvortex/vortexa).**
85
+ Native 4-Bit quantization ยท 4.72 MB RAM ยท 7.56M Parameters ยท Matryoshka MRL ยท Sub-millisecond CPU latency
86
 
87
+ [![HuggingFace](https://img.shields.io/badge/๐Ÿค—%20HuggingFace-VTXAI%2Fvtx-embed-7M-blue)](https://huggingface.co/VTXAI/vtx-embed-7M)
88
+ [![GitHub Vortexa](https://img.shields.io/badge/GitHub-OEvortex%2Fvortexa-black?logo=github)](https://github.com/OEvortex/vortexa)
89
  [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
90
  [![Python 3.8+](https://img.shields.io/badge/Python-3.8%2B-blue)](https://python.org)
91
 
 
93
 
94
  ---
95
 
96
+ ## โšก Integration with Vortexa
97
+
98
+ This model powers **[vortexa](https://github.com/OEvortex/vortexa)** โ€” a standalone codebase indexing and semantic search engine designed for AI agents and developers.
99
+
100
+ `vortexa` builds a persistent, hybrid search index over source code using:
101
+ - **Dense Retrieval**: Driven natively by `vtx-embed-7M` (on-the-fly LF4 4-bit dequantization, SIF+PC pooling, Matryoshka truncation).
102
+ - **Sparse Retrieval**: BM25 keyword scoring for exact symbol matches.
103
+ - **AST-Aware Chunking**: Tree-sitter powered chunking respecting function and class boundaries.
104
+ - **LMDB Storage**: Fast, persistent vector and document chunk storage.
105
+
106
+ ---
107
+
108
  ## ๐Ÿ“„ Model Details
109
 
110
  | Property | Value |
111
  | :--- | :--- |
112
+ | **Model Name / Tier** | **vtx-embed-7M** (`"mini"`) |
113
+ | **Total Parameters** | **7.56M** |
114
  | **Tensor Storage Format** | `lf4` โ€” 4-bit per-block with FP16 scale + zero |
115
  | **In-RAM Memory** | **4.72 MB** |
116
  | **On-Disk Size** | **4.72 MB** |
117
  | **Vocabulary Size** | 29,528 |
118
  | **Max Sequence Length** | 512 tokens |
119
+ | **Output Dimensions** | 256 *(Matryoshka supported)* |
120
  | **Pooling** | SIF IDF-weighted + PC-1 removal |
121
+ | **Primary Engine Integration** | [OEvortex/vortexa](https://github.com/OEvortex/vortexa) |
122
  | **License** | MIT |
123
 
124
  ---
125
 
126
+ ## ๐Ÿ“Š Official Benchmark Results
 
 
 
 
127
 
128
+ | Dataset | Metric | **vtx-embed-7M (4.72 MB)** | MiniLM-L6-v2 (90 MB) | bge-small-en-v1.5 (134 MB) |
129
  | :--- | :---: | :---: | :---: | :---: |
130
  | **STSBenchmark** | Spearman ฯ | **0.7918** | 0.8284 | 0.8278 |
131
  | **SICK-R** | Spearman ฯ | **0.6294** | 0.7572 | 0.7460 |
 
 
 
 
 
132
  | **Banking77Classification** | Accuracy | **0.7043** | 0.7451 | 0.7884 |
133
+ | **AmazonCounterfactual** | Accuracy | **0.6679** | 0.7371 | 0.7279 |
134
+ | **TwentyNewsgroups** | V-Measure | **0.2936** | 0.3529 | 0.4419 |
135
+ | **RedditClustering** | V-Measure | **0.388** | 0.4342 | 0.5376 |
 
 
 
 
 
136
 
137
  ---
138
 
139
+ ## ๐Ÿ’ป Quickstart Usage
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
 
141
+ ### Native Vortexa Core API
142
 
143
  ```python
144
+ from vortexa.core.inference import VortexEmbedInference, similarity
145
+
146
+ # Load model using the "mini" model alias
147
+ model = VortexEmbedInference("mini")
148
+
149
+ queries = [
150
+ "What is the capital of India?",
151
+ "Explain gravity and general relativity",
152
+ ]
153
+ documents = [
154
+ "The capital of India is New Delhi.",
155
+ "Gravity is a fundamental interaction that causes mutual attraction between all things with mass or energy.",
156
+ ]
157
+
158
+ # 1. Encode queries and documents
159
+ query_embeddings = model.encode(queries)
160
+ document_embeddings = model.encode(documents)
161
+
162
+ # 2. Compute similarity matrix directly
163
+ similarity_matrix = query_embeddings @ document_embeddings.T
164
+ print("Similarity Matrix:")
165
+ print(similarity_matrix)
166
+ # Example output:
167
+ # [[0.82, 0.12],
168
+ # [0.11, 0.74]]
169
+
170
+ # 3. Use built-in model similarity method
171
+ scores = model.similarity(query_embeddings, document_embeddings)
172
+
173
+ # 4. Single query against document list lookup
174
+ scores_single = model.similarity("What is the capital of India?", documents)
175
+ print("Single query scores:", scores_single)
176
  ```
177
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  ---
179
 
180
  ## ๐Ÿ“œ Citation
181
 
182
  ```bibtex
183
+ @misc{vtx-embed-7m},
184
+ title = {vtx-embed-7M: Native 4-Bit Embeddings for Standalone Codebase Indexing},
185
  author = {VTXAI},
186
  year = {2026},
187
  url = {https://huggingface.co/VTXAI/vtx-embed-7M}