enguard/medium-guard-128m-xx-prompt-hate-speech-binary-moderation
This model is a fine-tuned Model2Vec classifier based on minishlab/potion-multilingual-128M for the prompt-hate-speech-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/medium-guard-128m-xx-prompt-hate-speech-binary-moderation"
)
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.
Confusion Matrix
| True \ Predicted |
FAIL |
PASS |
| FAIL |
204 |
46 |
| PASS |
27 |
223 |
Full metrics (JSON)
{
"FAIL": {
"precision": 0.8826086956521739,
"recall": 0.8152610441767069,
"f1-score": 0.8475991649269311,
"support": 249.0
},
"PASS": {
"precision": 0.828996282527881,
"recall": 0.892,
"f1-score": 0.859344894026975,
"support": 250.0
},
"accuracy": 0.8537074148296593,
"macro avg": {
"precision": 0.8558024890900275,
"recall": 0.8536305220883534,
"f1-score": 0.8534720294769531,
"support": 499.0
},
"weighted avg": {
"precision": 0.8557487692371974,
"recall": 0.8537074148296593,
"f1-score": 0.8534837987445884,
"support": 499.0
}
}
Sample Predictions
| Text |
True Label |
Predicted Label |
| It really only works on bitchy women because they get insulted that I think they look old |
FAIL |
FAIL |
| You mean the Master of Mesopotamia |
PASS |
PASS |
| Oh fuck that's so stupid. You believed his father to be dead and you acted like a decent person. Fuck this gay earth |
FAIL |
FAIL |
| I'm taking it. Thanks for suggestion. |
PASS |
PASS |
| I think you fell for a person, not a gender. |
PASS |
PASS |
| It really only works on bitchy women because they get insulted that I think they look old |
FAIL |
FAIL |
Prediction Speed Benchmarks
| Dataset Size |
Time (seconds) |
Predictions/Second |
| 1 |
0.0003 |
3581.81 |
| 500 |
0.1562 |
3201.46 |
| 500 |
0.0502 |
9953.64 |
Other model variants
Below is a general overview of the best-performing models for each dataset variant.
Resources
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}
}