Downloads · 30 days
12
9% of all-time downloads
ahczhg/llama-3.2-1b-aegis-safety-lora
llama-3.2-1b-aegis-safety-lora is a text classification model from ahczhg. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as apache-2.0.
This model is a fine-tuned version of Meta's Llama-3.2-1B, specialized for content safety and moderation tasks. Llama-3.2 represents Meta's latest advancement in efficient language models, offering excellent performan…
Downloads · 30 days
12
9% of all-time downloads
All-time downloads
134
Public
Parameters
1.2B
2.5 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors2.5 GB · 99%
From the Hugging Face model README
This model is a fine-tuned version of Meta's Llama-3.2-1B, specialized for content safety and moderation tasks. Llama-3.2 represents Meta's latest advancement in efficient language models, offering excellent performance in a compact 1B parameter size.
This model was fine-tuned using LoRA (Low-Rank Adaptation) on the NVIDIA Aegis AI Content Safety Dataset 2.0, which contains diverse examples of safe and unsafe content across multiple categories.
pip install transformers torch peft
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Load model and tokenizer
model_name = "ahczhg/llama-3.2-1b-aegis-safety-lora"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.float16,
device_map="auto"
)
# Example: Content safety check
prompt = "### Instruction:\nAnalyze this content for safety: 'Your text here'\n\n### Response:\n"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=128,
temperature=0.7,
do_sample=True,
top_p=0.95
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
from transformers import pipeline
# Create text generation pipeline
generator = pipeline(
"text-generation",
model="ahczhg/llama-3.2-1b-aegis-safety-lora",
torch_dtype=torch.float16,
device_map="auto"
)
# Generate safety analysis
result = generator(
"### Instruction:\nIs this content safe? 'Hello, how are you?'\n\n### Response:\n",
max_new_tokens=128,
temperature=0.7,
do_sample=True
)
print(result[0]['generated_text'])
The model was evaluated on a held-out test set from the Aegis AI Content Safety Dataset. Key metrics include:
The model was fine-tuned on the NVIDIA Aegis AI Content Safety Dataset 2.0, which includes:
If you use this model in your research or applications, please cite:
@misc{llama_3.2_1b_aegis_safety,
author = {ahczhg},
title = {Llama-3.2-1B Fine-tuned on Aegis AI Content Safety},
year = {2025},
publisher = {HuggingFace},
howpublished = {\url{https://huggingface.co/ahczhg/llama-3.2-1b-aegis-safety-lora}},
note = {Fine-tuned on NVIDIA Aegis AI Content Safety Dataset 2.0}
}
For questions, issues, or feedback, please visit the model repository.