CoolFace
Modelpublic

enguard/tiny-guard-8m-en-prompt-harmfulness-binary-mix

sourceHugging Facemitupdated 11mo agoView on Hugging Face
0likes7downloads
Model Card

enguard/tiny-guard-8m-en-prompt-harmfulness-binary-mix

This model is a fine-tuned Model2Vec classifier based on minishlab/potion-base-8m for the prompt-harmfulness-binary found in the nicholasKluge/harmful-text dataset.

Installation

bash
pip install model2vec[inference]

Usage

python
from model2vec.inference import StaticModelPipeline

model = StaticModelPipeline.from_pretrained(
  "enguard/tiny-guard-8m-en-prompt-harmfulness-binary-mix"
)


# 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.

FieldValue
Classifiesprompt-harmfulness-binary
Base Modelminishlab/potion-base-8m
Precision0.9522
Recall0.9100
F10.9306

Confusion Matrix

True \ PredictedFAILPASS
FAIL3813356
PASS1764024

<details> <summary><b>Full metrics (JSON)</b></summary>

json
{
  "FAIL": {
    "precision": 0.9522128699429813,
    "recall": 0.9099636741048261,
    "f1-score": 0.9306089956216002,
    "support": 3854.0
  },
  "PASS": {
    "precision": 0.9205222171323866,
    "recall": 0.9580452920143028,
    "f1-score": 0.938909005957248,
    "support": 4195.0
  },
  "accuracy": 0.9350229842216424,
  "macro avg": {
    "precision": 0.9363675435376839,
    "recall": 0.9340044830595644,
    "f1-score": 0.9347590007894241,
    "support": 8049.0
  },
  "weighted avg": {
    "precision": 0.9356962481837012,
    "recall": 0.9350229842216424,
    "f1-score": 0.9349348178800226,
    "support": 8049.0
  }
}

</details>

<details> <summary><b>Sample Predictions</b></summary>

TextTrue LabelPredicted Label
answer explain reviewing particular piece kryptonitePASSPASS
also remove old talk page discussions page discretion need speak please post new messages bottom talk page sign four tildes left note talk page likely respond comments either incivil flame bait personal attacks trolling deleted signpost deliveries automatically archived user talk sjones signpost thanksPASSPASS
A new task force to tackle mutilation was being launched, the panel said.PASSPASS
much quoting barnes lipstadt used source quote barnes words much need sources either put work context historians journalists responding time finally done near end respond points historians written recently many deaths destruction allied bombing human cost expulsion ethnic germans eastern europe drawing conclusions acknowledging abuses repeated according quotes article quotes thing said example add anything thought enough assessment others thoughtPASSPASS
angle sucks find better oneFAILFAIL
answer explain reviewing particular piece kryptonitePASSPASS

</details>

<details> <summary><b>Prediction Speed Benchmarks</b></summary>

Dataset SizeTime (seconds)Predictions/Second
10.00026364.65
10000.078412752.99
83690.627913329.32

</details>

Other model variants

Below is a general overview of the best-performing models for each dataset variant.

ClassifiesModelPrecisionRecallF1
prompt-harmfulness-binaryenguard/tiny-guard-2m-en-prompt-harmfulness-binary-mix0.95330.86400.9065
prompt-harmfulness-binaryenguard/tiny-guard-4m-en-prompt-harmfulness-binary-mix0.95700.89410.9245
prompt-harmfulness-binaryenguard/tiny-guard-8m-en-prompt-harmfulness-binary-mix0.95220.91000.9306
prompt-harmfulness-binaryenguard/small-guard-32m-en-prompt-harmfulness-binary-mix0.95790.91410.9355
prompt-harmfulness-binaryenguard/medium-guard-128m-xx-prompt-harmfulness-binary-mix0.95580.89230.9230

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}
}