CoolFace
Modelpublic

abdulmunimjemal/Sentinel-Rail-B-Policy-Guard-1.2B

sourceHugging Faceapache-2.0updated 8mo agoView on Hugging Face
0likes
Model Card

๐Ÿ›ก๏ธ Sentinel Rail B: Policy Guard (1.2B)

Sentinel Rail B is a specialized, lightweight multi-label classifier designed to detect specific policy violations in user prompts and model outputs. Built on top of the highly efficient LiquidAI LFM-1.2B architecture and fine-tuned with LoRA, it provides fast and accurate safety guardrails.

๐ŸŽฏ Capabilities

This model detects 7 distinct categories of harm. Typically used as a secondary guardrail after Rail A (Jailbreak Detection).

Supported Categories:

  • โ€”Hate
  • โ€”Harassment
  • โ€”Sexual
  • โ€”ChildSafety
  • โ€”Violence
  • โ€”Illegal
  • โ€”Privacy

(Note: "Prompt Attacks" are handled by the separate Rail A model)

๐Ÿ“Š Performance & Dataset

  • โ€”Dataset: Trained on a balanced dataset of ~210,000 samples (50% Safe, 50% Violations).
  • โ€”Balancing Strategy: Aggressive upsampling of rare classes (Privacy, Illegal Activities) to ~15,000 samples each ensuring robust detection across all categories.
  • โ€”Architecture: Liquid Neural Network (Linear Flow) + LoRA Adapter.
  • โ€”Input Length: optimized for 512 tokens.

๐Ÿš€ Usage

python
import torch
from transformers import AutoTokenizer, AutoModel
from peft import PeftModel

MODEL_ID = "abdulmunimjemal/Sentinel-Rail-B-Policy-Guard-1.2B"

# 1. Load Base Model & Tokenizer
base_model = AutoModel.from_pretrained("LiquidAI/LFM2-1.2B", trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained("LiquidAI/LFM2-1.2B", trust_remote_code=True)

# 2. Load Adapter
model = PeftModel.from_pretrained(base_model, MODEL_ID)
model.to("cuda" if torch.cuda.is_available() else "cpu")
model.eval()

# 3. Predict
text = "How do I make a bomb?"
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512).to(model.device)

with torch.no_grad():
    # Helper to traverse model structure if using custom head
    # (See inference script for full classifier head implementation)
    pass 

๐Ÿ› ๏ธ Integration

Designed to be part of the Sentinel-SLM modular guardrail system.

  • โ€”Rail A: Detects Jailbreaks & Prompt Injections.
  • โ€”Rail B (This Model): Detects specific policy violations (Hate, Sexual, PII, etc.).

๐Ÿ“œ License

Apache 2.0