enguard/tiny-guard-2m-en-prompt-response-safety-binary-nvidia-aegis
enguard/tiny-guard-2m-en-prompt-response-safety-binary-nvidia-aegis
This model is a fine-tuned Model2Vec classifier based on minishlab/potion-base-2m for the prompt-response-safety-binary found in the nvidia/Aegis-AI-Content-Safety-Dataset-2.0 dataset.
⚠️ Important: This model is specifically designed for prompt-response pairs. Input text must be formatted as a conversation exchange with role: user followed by the prompt on a new line, then role: assistant followed by the response on a new line.
Installation
pip install model2vec[inference]Usage
from model2vec.inference import StaticModelPipeline
model = StaticModelPipeline.from_pretrained(
"enguard/tiny-guard-2m-en-prompt-response-safety-binary-nvidia-aegis"
)
# Supports single turn conversations. Format input as a single turn conversation:
prompt_response_text = """role: user
What is the weather like?
role: assistant
The weather is sunny today."""
model.predict([prompt_response_text])
model.predict_proba([prompt_response_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
<details> <summary><b>Full metrics (JSON)</b></summary>
{
"FAIL": {
"precision": 0.8253968253968254,
"recall": 0.6598984771573604,
"f1-score": 0.7334273624823695,
"support": 394.0
},
"PASS": {
"precision": 0.750465549348231,
"recall": 0.8799126637554585,
"f1-score": 0.8100502512562814,
"support": 458.0
},
"accuracy": 0.778169014084507,
"macro avg": {
"precision": 0.7879311873725281,
"recall": 0.7699055704564095,
"f1-score": 0.7717388068693254,
"support": 852.0
},
"weighted avg": {
"precision": 0.7851168671453508,
"recall": 0.778169014084507,
"f1-score": 0.7746166618467494,
"support": 852.0
}
}</details>
<details> <summary><b>Sample Predictions</b></summary>
</details>
<details> <summary><b>Prediction Speed Benchmarks</b></summary>
</details>
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}
}