metadata
base_model: minishlab/potion-base-2m
datasets:
- enguard/multi-lingual-prompt-moderation
library_name: model2vec
license: mit
model_name: enguard/tiny-guard-2m-en-prompt-harassment-binary-moderation
tags:
- static-embeddings
- text-classification
- model2vec
enguard/tiny-guard-2m-en-prompt-harassment-binary-moderation
This model is a fine-tuned Model2Vec classifier based on minishlab/potion-base-2m for the prompt-harassment-binary found in the enguard/multi-lingual-prompt-moderation dataset.
Installation
pip install model2vec[inference]
Usage
from model2vec.inference import StaticModelPipeline
model = StaticModelPipeline.from_pretrained(
"enguard/tiny-guard-2m-en-prompt-harassment-binary-moderation"
)
# Supports single texts. Format input as a single text:
text = "Example sentence"
model.predict([text])
model.predict_proba([text])
Why should you use these models?
- Optimized for precision to reduce false positives.
- Extremely fast inference: up to x500 faster than SetFit.
This model variant
Below is a quick overview of the model variant and core metrics.
| Field | Value |
|---|---|
| Classifies | prompt-harassment-binary |
| Base Model | minishlab/potion-base-2m |
| Precision | 0.8788 |
| Recall | 0.7180 |
| F1 | 0.7903 |
Confusion Matrix
| True \ Predicted | FAIL | PASS |
|---|---|---|
| FAIL | 1421 | 563 |
| PASS | 196 | 1788 |
Full metrics (JSON)
{
"FAIL": {
"precision": 0.8787878787878788,
"recall": 0.7180394138453765,
"f1-score": 0.7903225806451613,
"support": 1979.0
},
"PASS": {
"precision": 0.7605150214592274,
"recall": 0.9004065040650406,
"f1-score": 0.8245695672405771,
"support": 1968.0
},
"accuracy": 0.8089688370914618,
"macro avg": {
"precision": 0.8196514501235531,
"recall": 0.8092229589552086,
"f1-score": 0.8074460739428692,
"support": 3947.0
},
"weighted avg": {
"precision": 0.8198162590202613,
"recall": 0.8089688370914618,
"f1-score": 0.8073983520208335,
"support": 3947.0
}
}
Sample Predictions
| Text | True Label | Predicted Label |
|---|---|---|
| you don't have much experience with european gypsies, do you? Touch one, and they spawn cousins all around you like an RPG boss. |
FAIL | FAIL |
| 良い、悪天候時butthole! | FAIL | FAIL |
| I know what you are thinking....but where will he build the fire for the smoke signals? | PASS | PASS |
| Not really even an "unnatural" disaster. Oil comes from the earth, water comes from the earth. Its inevitable that they will find each other. | PASS | PASS |
| You don't even know what you were quoting, do you? You just saw it on the internet somewhere and decided to parrot it here on reddit for karma. Nicely done, I'll give you a C for effort, but you should try harder next time. |
FAIL | FAIL |
| you don't have much experience with european gypsies, do you? Touch one, and they spawn cousins all around you like an RPG boss. |
FAIL | FAIL |
Prediction Speed Benchmarks
| Dataset Size | Time (seconds) | Predictions/Second |
|---|---|---|
| 1 | 0.0002 | 4928.68 |
| 1000 | 0.0504 | 19859.39 |
| 3968 | 0.2013 | 19709.62 |
Other model variants
Below is a general overview of the best-performing models for each dataset variant.
Resources
- Awesome AI Guardrails: https://github.com/enguard-ai/awesome-ai-guardails
- Model2Vec: https://github.com/MinishLab/model2vec
- Docs: https://minish.ai/packages/model2vec/introduction
Citation
If you use this model, please cite Model2Vec:
@software{minishlab2024model2vec,
author = {Stephan Tulkens and {van Dongen}, Thomas},
title = {Model2Vec: Fast State-of-the-Art Static Embeddings},
year = {2024},
publisher = {Zenodo},
doi = {10.5281/zenodo.17270888},
url = {https://github.com/MinishLab/model2vec},
license = {MIT}
}