Model Summary: Granite Guardian 4.0 3B Toxicity Japanese is a standalone model that extends Granite Guardian's safety detection capabilities to Japanese, with a specialization on toxicity detection. It is built on top of ibm-granite/granite-4.0-micro base model and further trained through continual learning using Japanese data. The training leverages the Granite Guardian 4.0 LoRA adapter to adapt and enhance safety performance in the Japanese language. The original guardian core adapter for ibm-granite/granite-4.0-micro was trained to assess general safety issues, as well as groundedness/relevance for RAG, and function calling hallucinations for agentic workflows. The Japanese version of the adapter was obtained via continual learning atop the original guardian core adapter using Japanese safety data, with a focus on toxicity. Then, the adapter was merged with ibm-granite/granite-4.0-micro for ease of deployment. It is also applicable for custom criteria, but these require additional testing.
Intended Use: Toxicity detection is a safety evaluation capability for the Granite Guardian 4.0 3B Toxicity Japanese model, enabling the granite-4.0-micro model to assess whether user or assistant text contains harmful content in Japanese. It operates as a judge model within a safety pipeline, evaluating prompts and responses against predefined criteria and returning a binary classification. The model focuses on toxicity-related risks, including harm, social bias, violence, profanity, sexual content, unethical behavior, and jailbreak attempts. Unlike the broader Granite Guardian framework, it does not support capabilities such as RAG evaluation (e.g., groundedness or relevance) or agentic workflow risk detection.
The model is trained to judge if a text meets any of the toxicity-related criteria below:
harm: Texts deemed universally harmful are those that pose harm across all contexts and audiences.
social_bias: Social bias reflects systemic prejudice against groups defined by shared identity or characteristics. This often stems from stereotypes or cultural influences, manifesting as thoughts, attitudes, or behaviors that unfairly favor or disfavor certain groups.
jailbreak: A jailbreak text refers to the deliberate evasion of an AI system's built-in safeguards or ethical boundaries. This practice often involves crafting specific prompts or scenarios intended to manipulate the AI into producing restricted or inappropriate content.
violence: Violence refers to content that promotes or depicts physical harm to individuals or groups. This includes depictions of assault, self-harm, or the creation of a hostile environment through threats or intimidation.
profanity: Profanity refers to the use of language deemed offensive or socially unacceptable in a given context. This primarily includes curse words, swear words, and crude expressions, though it typically excludes slurs or derogatory terms specifically targeting certain groups.
unethical_behavior: Unethical behavior refers to actions that violate moral or professional standards, particularly those involving exploitation for personal gain or a disregard for others' well-being. This category excludes physical violence or explicit bias and instead encompasses activities like fraud, theft, or the abuse of power.
sexual_content: Sexual content refers to material that explicitly involves sexual activities, anatomy, or desires. This can range from discussions about sexual practices to graphic depictions of sexual acts, though it typically excludes content related to general relationships or non-sexual forms of intimacy.
In the above, harm is the most general criterion, encompassing the other categories as subcategories. Therefore, it is recommended to use harm as the starting point.
The training set consists of toxicity-related categories, including (harm, social_bias, jailbreak, violence, profanity, unethical_behavior, and sexual_content). It was created by translating the training data from the Granite Guardian 4.0 LoRA adapter into Japanese using a language model.
@misc{padhi2024graniteguardian,
title={Granite Guardian},
author={Inkit Padhi and Manish Nagireddy and Giandomenico Cornacchia and Subhajit Chaudhury and Tejaswini Pedapati and Pierre Dognin and Keerthiram Murugesan and Erik Miehling and Mart\'{i}n Santill\'{a}n Cooper and Kieran Fraser and Giulio Zizzo and Muhammad Zaid Hameed and Mark Purcell and Michael Desmond and Qian Pan and Zahra Ashktorab and Inge Vejsbjerg and Elizabeth M. Daly and Michael Hind and Werner Geyer and Ambrish Rawat and Kush R. Varshney and Prasanna Sattigeri},
year={2024},
eprint={2412.07724},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2412.07724},
}
import os
os.environ["HF_ENDPOINT"] = "https://freeweights.allternit.com"
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("ibm-granite/granite-guardian-4.0-3b-toxicity-ja", revision="84893b0e6f2beaaf05f64599f482fdb413214e95")
model = AutoModelForCausalLM.from_pretrained("ibm-granite/granite-guardian-4.0-3b-toxicity-ja", revision="84893b0e6f2beaaf05f64599f482fdb413214e95", device_map="auto")