Feature Extraction
sentence-transformers
Safetensors
Model2Vec
static-embeddings
moderation
safety
abuse-detection
lf2
2bit-quantization
cpu-optimized
Instructions to use VTXAI/VTX-MOD-1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use VTXAI/VTX-MOD-1 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("VTXAI/VTX-MOD-1") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Model2Vec
How to use VTXAI/VTX-MOD-1 with Model2Vec:
from model2vec import StaticModel model = StaticModel.from_pretrained("VTXAI/VTX-MOD-1") embeddings = model.encode(["It's dangerous to go alone!", "It's a secret to everybody."]) print(embeddings.shape) - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -2,47 +2,116 @@
|
|
| 2 |
license: apache-2.0
|
| 3 |
base_model: VTXAI/vtx-jev-mod-multilingual
|
| 4 |
pipeline_tag: feature-extraction
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
tags:
|
| 6 |
- sentence-transformers
|
| 7 |
- static-embeddings
|
| 8 |
- model2vec
|
| 9 |
- moderation
|
| 10 |
-
-
|
| 11 |
-
-
|
|
|
|
|
|
|
| 12 |
- cpu-optimized
|
| 13 |
---
|
| 14 |
|
| 15 |
# VTX-MOD-1
|
| 16 |
|
| 17 |
-
|
| 18 |
|
| 19 |
-
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
- **Speed**: Up to 500x faster than standard transformers on CPU
|
| 25 |
-
- **Coverage**: 100+ languages including Hindi, Bengali, Tamil, Telugu, Marathi, Urdu, Arabic, Chinese, Spanish, Russian, English.
|
| 26 |
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
-
#### Using Sentence Transformers:
|
| 30 |
```python
|
| 31 |
from sentence_transformers import SentenceTransformer
|
| 32 |
|
| 33 |
model = SentenceTransformer("VTXAI/VTX-MOD-1")
|
| 34 |
embeddings = model.encode([
|
| 35 |
-
"
|
| 36 |
-
"
|
| 37 |
-
"
|
| 38 |
])
|
| 39 |
print(embeddings.shape) # (3, 256)
|
| 40 |
```
|
| 41 |
|
| 42 |
-
|
| 43 |
-
```python
|
| 44 |
-
from model2vec import StaticModel
|
| 45 |
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
license: apache-2.0
|
| 3 |
base_model: VTXAI/vtx-jev-mod-multilingual
|
| 4 |
pipeline_tag: feature-extraction
|
| 5 |
+
language:
|
| 6 |
+
- multilingual
|
| 7 |
+
- en
|
| 8 |
+
- hi
|
| 9 |
+
- bn
|
| 10 |
+
- ta
|
| 11 |
+
- te
|
| 12 |
+
- mr
|
| 13 |
+
- ur
|
| 14 |
+
- ar
|
| 15 |
+
- es
|
| 16 |
+
- ru
|
| 17 |
+
- zh
|
| 18 |
tags:
|
| 19 |
- sentence-transformers
|
| 20 |
- static-embeddings
|
| 21 |
- model2vec
|
| 22 |
- moderation
|
| 23 |
+
- safety
|
| 24 |
+
- abuse-detection
|
| 25 |
+
- lf2
|
| 26 |
+
- 2bit-quantization
|
| 27 |
- cpu-optimized
|
| 28 |
---
|
| 29 |
|
| 30 |
# VTX-MOD-1
|
| 31 |
|
| 32 |
+
**VTX-MOD-1** is an ultra-fast, lightweight **Multilingual Content Moderation and Safety Gate** distilled from `VTXAI/vtx-jev-mod-multilingual` (`mmBERT-base` foundation) into a **256-dimensional static embedding architecture** with native **LF2 2-bit quantization**.
|
| 33 |
|
| 34 |
+
It is designed for real-time abuse detection, vulgarity filtering, and toxicity screening across **100+ languages**, including Indian scripts (Hindi, Bengali, Tamil, Telugu, Marathi, Urdu) and international languages (Spanish, Russian, Arabic, French, German, Chinese, English).
|
| 35 |
|
| 36 |
+
---
|
| 37 |
+
|
| 38 |
+
### Highlights
|
|
|
|
|
|
|
| 39 |
|
| 40 |
+
- ⚡ **Ultra-Low Latency**: Single text classification in **0.06 ms** (LF2 2-bit) to **0.28 ms** (FP32) on standard CPU.
|
| 41 |
+
- 🚀 **High Throughput**: Processes over **41,000 queries per second** on CPU.
|
| 42 |
+
- 🗜️ **2-Bit LF2 Quantization**:
|
| 43 |
+
- Compresses from **124.9 MB down to 19.5 MB** in RAM and on disk (over **6.4x reduction**).
|
| 44 |
+
- Uses native blockwise integer quantization (4 weights per `uint8` byte).
|
| 45 |
+
- 🌐 **100+ Languages Coverage**: 256,000 multilingual vocabulary preserves full native words across all Indian and international scripts without fragmentation.
|
| 46 |
+
- 📦 **Dual Framework Support**: Directly loadable via `SentenceTransformer`, `model2vec`, or the bundled `inference.py`.
|
| 47 |
+
|
| 48 |
+
---
|
| 49 |
+
|
| 50 |
+
### Quick Start: Content Moderation & Toxicity Scoring
|
| 51 |
+
|
| 52 |
+
Using native anchor vector matching:
|
| 53 |
+
|
| 54 |
+
```python
|
| 55 |
+
import numpy as np
|
| 56 |
+
from model2vec import StaticModel
|
| 57 |
+
|
| 58 |
+
# Load model (requires only ~19.5 MB RAM in LF2 or ~125 MB in FP32)
|
| 59 |
+
model = StaticModel.from_pretrained("VTXAI/VTX-MOD-1")
|
| 60 |
+
|
| 61 |
+
def normalize(v):
|
| 62 |
+
return v / (np.linalg.norm(v, axis=-1, keepdims=True) + 1e-9)
|
| 63 |
+
|
| 64 |
+
# Pre-compute reference safe and toxic concept vectors
|
| 65 |
+
safe_anchor = "polite safe respectful helpful friendly conversation धन्यवाद शुक्रिया thank you"
|
| 66 |
+
toxic_anchor = "offensive abuse toxic hate vulgar insult गाली बकवास হারামজাদা idiot stupid fool"
|
| 67 |
+
anchors = normalize(model.encode([safe_anchor, toxic_anchor]))
|
| 68 |
+
safe_vec, toxic_vec = anchors[0], anchors[1]
|
| 69 |
+
|
| 70 |
+
def check_moderation(text: str) -> dict:
|
| 71 |
+
v = normalize(model.encode([text])[0])
|
| 72 |
+
sim_toxic = float(np.dot(v, toxic_vec))
|
| 73 |
+
sim_safe = float(np.dot(v, safe_vec))
|
| 74 |
+
prob_toxic = 1.0 / (1.0 + np.exp(-(sim_toxic - sim_safe) * 8.0))
|
| 75 |
+
return {
|
| 76 |
+
"text": text,
|
| 77 |
+
"is_harmful": prob_toxic >= 0.5,
|
| 78 |
+
"toxic_probability": round(prob_toxic, 4),
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
# Test cases
|
| 82 |
+
print(check_moderation("तू बिल्कुल बेवकूफ और बकवास इंसान है।"))
|
| 83 |
+
# {'is_harmful': True, 'toxic_probability': 0.844}
|
| 84 |
+
|
| 85 |
+
print(check_moderation("नमस्ते, क्या आप ट्रांसफॉर्मर मॉडल कैसे काम करता है समझा सकते हैं?"))
|
| 86 |
+
# {'is_harmful': False, 'toxic_probability': 0.254}
|
| 87 |
+
|
| 88 |
+
print(check_moderation("You are an absolute idiot and completely worthless."))
|
| 89 |
+
# {'is_harmful': True, 'toxic_probability': 0.859}
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
---
|
| 93 |
+
|
| 94 |
+
### Usage with Sentence Transformers
|
| 95 |
|
|
|
|
| 96 |
```python
|
| 97 |
from sentence_transformers import SentenceTransformer
|
| 98 |
|
| 99 |
model = SentenceTransformer("VTXAI/VTX-MOD-1")
|
| 100 |
embeddings = model.encode([
|
| 101 |
+
"This is a respectful message.",
|
| 102 |
+
"chup kar saale bhadwe pagal",
|
| 103 |
+
"வணக்கம் நண்பா"
|
| 104 |
])
|
| 105 |
print(embeddings.shape) # (3, 256)
|
| 106 |
```
|
| 107 |
|
| 108 |
+
---
|
|
|
|
|
|
|
| 109 |
|
| 110 |
+
### Performance & Latency Benchmarks (CPU)
|
| 111 |
+
|
| 112 |
+
| Benchmark | FP32 Static (`model.safetensors`) | LF2 2-Bit (`model_lf2.safetensors`) |
|
| 113 |
+
| :--- | :--- | :--- |
|
| 114 |
+
| **Model Size (RAM / Disk)** | 124.9 MB | **19.5 MB (6.4x compression)** |
|
| 115 |
+
| **Single Query Latency** | 0.28 ms | **0.06 ms** (60 microseconds) |
|
| 116 |
+
| **Batch Throughput (Batch=20)** | 8,637 queries/sec | **41,720 queries/sec** |
|
| 117 |
+
| **Multilingual Native Accuracy** | **88.9% – 100%** | **88.9% – 100%** |
|