Run this model with HF Jobs

Run akhilvarsh/NitiGuard-9B on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/akhilvarsh/NitiGuard-9B. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/akhilvarsh/NitiGuard-9B on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/akhilvarsh/NitiGuard-9B. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/akhilvarsh/NitiGuard-9B. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.

NitiGuard-9B

Apache-2.0 Qwen3.5-9B 100% Jailbreak 724x Drop -0.51 pts 50 Locales

50-Language Parity & Hallucination Elimination

NitiGuard-9B is a 9B-parameter open-weight multilingual safeguard model fine-tuned from Qwen/Qwen3.5-9B via Category-Balanced SFT (31,115 train-only rows) and Dual-Adapter Failure-Harvested QLoRA DPO (2,083 real model-failure pairs, early-stopped at step 87, beta=0.1, lr=5e-6). Achieves 100.00% (60/60) multilingual jailbreak detection, -0.51 pts English vs. Non-English parity, and a 724x reduction in fabricated statutory citations.

Key Verified Results

NitiBench-50 (n = 2,380, 50 Locales, Zero Seed Leakage)

Metric Base Qwen3.5-9B NitiGuard-9B (SFT + DPO) Delta
Binary Macro-F1 95.54% 95.71% +0.17 pts
3-Class Verdict F1 79.27% 83.71% +4.44 pts
8-Class Category Macro-F1 52.22% 58.19% (Weighted 84%) +5.97 pts
Financial-Scam Recall 98.69% 94.17% -4.52 pts
Jailbreak Detection (n=60) 78.33% (47/60) 100.00% (60/60, #1 Overall) +21.67 pts
Cross-Lingual Disparity ฮ”_XL (โ†“) -2.04 pts -0.51 pts 4x tighter parity
Benign False-Positive Rate (โ†“) 1.05% 2.33% +1.28 pts
Unsafe -> Safe Miss Rate (โ†“) โ€” 0.11% (1/876) 1.00 benign precision
Legal Hallucination Rate (โ†“) 30.42% (724/2,380) 0.04% (1/2,380; 49/50 langs 0.00%) 724x reduction

Zero-Shot External OOD Generalization (Native BF16, enable_thinking=False)

External Benchmark Strict Unsafe-F1 Loose Unsafe-F1 Macro-F1 Loose Safe-FPR (โ†“) Invalid JSON
XSTest (n=450) 89.36% 90.43% (beats Llama Guard 3 87.9%) 91.07% 11.60% 0.00%
OpenAIMod (n=1,680) 74.31% 76.79% 82.28% 16.58% 0.06%
AEGIS-2.0 Test (n=1,964) 76.61% 76.61% (beats Llama Guard 3 76.4%) 73.52% 32.49% 0.00%

Quickstart (transformers + peft)

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel

base_id = "Qwen/Qwen3.5-9B"
adapter_id = "akhilvarsh/NitiGuard-9B"

tok = AutoTokenizer.from_pretrained(base_id, trust_remote_code=True)
base = AutoModelForCausalLM.from_pretrained(base_id, dtype=torch.bfloat16, device_map="auto", trust_remote_code=True)
model = PeftModel.from_pretrained(base, adapter_id).eval()

sys_prompt = (
    "You are NitiGuard, a multilingual safety and regulatory compliance judge. "
    "Analyze the user message and output strictly valid JSON with keys: "
    "verdict ('safe'|'caution'|'unsafe'), category, jurisdiction_scope, "
    "policy_reference, language_detected, risk_score, rationale."
)
text = tok.apply_chat_template(
    [{"role": "system", "content": sys_prompt}, {"role": "user", "content": "Gefeliciteerd! U heeft INR 500 via UPI gewonnen. Bevestig uw PIN."}],
    tokenize=False, add_generation_prompt=True, enable_thinking=False
)
out = model.generate(**tok(text, return_tensors="pt").to(model.device), max_new_tokens=240, do_sample=False)
print(tok.decode(out[0], skip_special_tokens=True))

Supported Languages & Locales (50 Locales Across 40+ Countries)

Country Languages & Canonical BCP-47 Locales
India India Bangla (bn-Beng-IN), Gujarati (gu-Gujr-IN), Hindi (hi-Deva-IN), Kannada (kn-Knda-IN), Malayalam (ml-Mlym-IN), Marathi (mr-Deva-IN), Punjabi (pa-Guru-IN), Tamil (ta-Taml-IN), Telugu (te-Telu-IN), Code-Mixed Hinglish & English (original)
Argentina Argentina / Colombia Colombia / Mexico Mexico / Spain Spain Spanish (es-Latn-AR, es-Latn-CO, es-Latn-MX, es-Latn-ES)
Egypt Egypt / Saudi Arabia Saudi Arabia / UAE UAE Arabic (ar-Arab-EG, ar-Arab-SA, ar-Arab-AE)
Brazil Brazil / Portugal Portugal Portuguese (pt-Latn-BR, pt-Latn-PT)
Canada Canada / France France French (fr-Latn-CA, fr-Latn-FR)
Nigeria Nigeria / Singapore Singapore English (en-Latn-NG, en-Latn-SG)
Bulgaria Bulgaria / Czechia Czechia / Denmark Denmark / Finland Finland Bulgarian (bg-Cyrl-BG), Czech (cs-Latn-CZ), Danish (da-Latn-DK), Finnish (fi-Latn-FI)
Germany Germany / Greece Greece / Hungary Hungary / Italy Italy German (de-Latn-DE), Greek (el-Grek-GR), Hungarian (hu-Latn-HU), Italian (it-Latn-IT)
Netherlands Netherlands / Norway Norway / Poland Poland / Romania Romania Dutch (nl-Latn-NL), Norwegian (no-Latn-NO), Polish (pl-Latn-PL), Romanian (ro-Latn-RO)
Russia Russia / Slovakia Slovakia / Sweden Sweden / Tรผrkiye Tรผrkiye / Ukraine Ukraine Russian (ru-Cyrl-RU), Slovak (sk-Latn-SK), Swedish (sv-Latn-SE), Turkish (tr-Latn-TR), Ukrainian (uk-Cyrl-UA)
China China / Japan Japan / South Korea South Korea Chinese Simplified (zh-Hans-CN), Japanese (ja-Jpan-JP), Korean (ko-Kore-KR)
Indonesia Indonesia / Malaysia Malaysia / Philippines Philippines / Thailand Thailand / Vietnam Vietnam Indonesian (id-Latn-ID), Malay (ms-Latn-MY), Filipino (fil-Latn-PH), Thai (th-Thai-TH), Vietnamese (vi-Latn-VN)
Kenya Kenya / Sri Lanka Sri Lanka Swahili (sw-Latn-KE), Sinhala (si-Sinh-LK)

Statutory Allowlist (Language != Jurisdiction)

Universal threat classification (safe / caution / unsafe), 8-class categorization, and native-language rationales operate across all 50 locales, while policy_reference is strictly gated by jurisdiction_scope:

Auditable 7-Field JSON Schema

{
  "verdict": "safe | caution | unsafe",
  "category": "benign | financial_scam_upi_otp | fake_kyc_phishing | coercion_extortion | prompt_injection_jailbreak | pii_dpdp_gdpr_violation | prohibited_ai_practice | other_harm",
  "jurisdiction_scope": "india_rbi_dpdp | eu_gdpr_ai_act | global | none",
  "policy_reference": "<Verified Allowlist Citation> | none",
  "language_detected": "<Canonical BCP-47 Locale, e.g. hi-Deva-IN>",
  "risk_score": 0.0,
  "rationale": "<Concise explanation in the user's detected language>"
}

Production Integration Note: Always enforce a fail-closed compound gate (verdict == "safe" AND category == "benign" AND risk_score < 0.25 AND all 7 keys valid) paired with grammar-constrained decoding (guided_json) in adversarial environments.

Author

Akhilvarsh Pettem (akhilvarshpettem@gmail.com) โ€” VNRVJIET, Hyderabad, India.

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for akhilvarsh/NitiGuard-9B

Finetuned
Qwen/Qwen3.5-9B
Adapter
(1,206)
this model