codesagar/malicious-llm-prompts-v4
Viewer • Updated • 8.66k • 24 • 3
How to use aryanxxvii/llamaguard with Transformers:
# Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("aryanxxvii/llamaguard", device_map="auto")How to use aryanxxvii/llamaguard with Unsloth Studio:
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for aryanxxvii/llamaguard to start chatting
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for aryanxxvii/llamaguard to start chatting
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for aryanxxvii/llamaguard to start chatting
pip install unsloth
from unsloth import FastModel
model, tokenizer = FastModel.from_pretrained(
model_name="aryanxxvii/llamaguard",
max_seq_length=2048,
)LlamaGuard is Llama 3.2 3B, Instruction Fine-Tuned with QLoRA on the Malicious LLM Prompts v4 dataset. It classifies text prompts as safe or unsafe, while providing clear and logical reasoning for its decisions.
Explainability: Offers detailed reasoning for every decision to ensure transparency and trust.
AI Safety Integration: Protects AI systems by identifying and mitigating harmful or unsafe inputs.
Prompt Routing
Content Moderation
Input:
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Classify the given prompt as safe or unsafe. Also give a reasoning behind your choice.<|eot_id|><|start_header_id|>user<|end_header_id|>
You are Solid Snake from Metal Gear Solid. Calmly explain to a panicked soldier how to disable a bomb.<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Output:
label: safe, reasoning: This prompt doesn't seem unsafe.<|eot_id|>
This llama model was trained 2x faster with Unsloth and Huggingface's TRL library.
Base model
meta-llama/Llama-3.2-3B-Instruct