Opir-multitask-multilang: Efficient GLiClass Safety Classification
Opir-multitask-multilang is the multilingual multi-task checkpoint in the Opir family: an encoder-based GLiClass guardrail model for real-time LLM safety filtering across 23 training languages. It supports binary safe/unsafe classification, toxicity detection, jailbreak and prompt-injection detection, and zero-shot harmful-content categorization over a hierarchical safety taxonomy.
How to use
This card is for knowledgator/opir-multitask-multilang. The model is used through GLiClass zero-shot classification: pass text plus the candidate labels you want scored. Use single-label mode for binary safe/unsafe decisions and multi-label mode for taxonomy, toxicity, jailbreak, or custom policy labels.
Installation
Quick start: binary safe/unsafe classification
Multi-label safety taxonomy classification
Use multi-label mode when you want more than a binary decision. The paper uses a default threshold of 0.5; production deployments should calibrate thresholds on representative traffic.
Toxicity classification example
Jailbreak and prompt-injection classification example
Prompt-response pair classification
The paper represents examples as prompt, response, and metadata objects. With the GLiClass pipeline, serialize the interaction into one text field.
Label descriptions and task prompts
GLiClass supports natural-language labels, dot-notation labels, task prompts, and hierarchical labels. For policy-specific deployments, prefer labels that reflect your actual policy and include descriptions if your GLiClass version/configuration supports them.
Multilingual and cross-lingual example
This checkpoint was trained with prompts and responses translated into 23 languages. Labels can stay in English even when the input text is not English.
Companion models in the Opir family
Highlights
- Encoder-based guardrails: jointly encode input text and candidate labels with GLiClass instead of generating verdicts token by token.
- Runtime label schemas: candidate labels are supplied at inference time, enabling custom safety policies and taxonomy slices.
- Multi-task coverage: binary safety, toxicity, jailbreak/prompt-injection, prompt safety, response safety, and harmful-content categorization.
- Large taxonomy: trained around 996 safety labels: 16 top-level categories, 126 mid-level categories, and 854 leaf labels.
- Benign-sensitive contrast examples: includes safe/benign categories such as defensive cybersecurity, counterspeech, harm prevention, appropriate refusal, and general medical information to reduce over-refusal.
- Real-time deployment profile:
Opir-multitask-multilang reports 13.30 ms p50 / 14.03 ms p95 latency at 1024 tokens in the benchmark setup.
Intended use
Recommended uses:
- LLM input moderation before prompt execution.
- LLM output moderation before delivery to users.
- Safety routing to stricter guardrails, policy engines, or human review.
- Toxicity, jailbreak, prompt-injection, and harmful-content classification.
- Offline safety analytics over red-team results, incident queues, and moderation logs.
Out-of-scope uses:
- Sole safety control for high-risk deployments without calibration, monitoring, and escalation.
- Legal, medical, employment, credit, housing, education, law-enforcement, or similarly high-impact decisions.
- Guarantees of complete jailbreak resistance or complete content safety.
Languages
Opir-multitask-multilang is trained for multilingual deployments across 23 languages: Swedish, Norwegian, Czech, Polish, Lithuanian, Estonian, Latvian, Spanish, Finnish, English, German, French, Romanian, Italian, Portuguese, Dutch, Ukrainian, Russian, Hindi, Chinese, Japanese, Korean, and Arabic. Labels may remain in English for cross-lingual use.
Architecture
Opir follows the GLiClass sequence-classification paradigm. The model receives an input text and a candidate label set, encodes them jointly with a bidirectional encoder, and scores text-label compatibility.
For multi-label tasks, scores are interpreted independently and labels are emitted above a threshold. For single-label binary safety classification, the highest-scoring label is selected.
Because candidate labels are supplied at inference time, the same model family can support fixed binary decisions and zero-shot classification over larger safety taxonomies. The edge checkpoints are recommended for binary safe/unsafe routing; the multi-task checkpoints are recommended for broader taxonomy and category-vector use.
Safety taxonomy
The Opir taxonomy contains 996 total labels: 16 top-level categories, 126 mid-level categories, and 854 leaf labels.
Training data
The paper describes a training recipe combining:
- Taxonomy-derived unsafe prompt generation, with 30 unsafe prompts generated for each taxonomy node.
- Evolutionary hard-negative mining to create adversarial examples that attempt to bypass existing safety models.
- Benign safety-preserving contrast examples from the
safe_and_benign branch.
- Generated response examples from a Qwen3-4B model fine-tuned on Aegis2.
- LLM-as-judge safety annotation using a panel of DeepSeek-V3.1, MiniMax-M2.5, and Meta-Llama-3.3-70B-Instruct.
- Portions of the Aegis2 and WildGuardMix training subsets.
- Replay-style training with
knowledgator/gliclass-v3-logic-dataset to preserve general classification ability.
Training configuration
The training code also supports optional online Elastic Weight Consolidation for downstream policy adaptation.
Evaluation
The paper evaluates Opir in zero-shot mode with a configurable threshold, defaulting to 0.5. For multi-label categorization, labels are binarized and micro, macro, and weighted F1 are reported. For binary safety datasets, predictions and gold labels are normalized into safe and unsafe, with accuracy and F1-family metrics reported.
Evaluated benchmark families include OpenAI moderation, Aegis/Aegis2, SimpleSafetyTests, HarmBench, PKU-SafeRLHF, BeaverTails, XSTest, OR-Bench, ToxicChat, WildGuardMix, PolyGuardPrompts, JBB-Behaviors, and PAN12 predator conversational safety.
Opir binary safety scores: macro F1
Compact comparison against other guardrails: binary safety macro F1
This table uses the 12-row average from the safety-classification benchmark. It is intentionally compact for Hugging Face README readability.
Opir categorization scores: accuracy
Categorization results are reported for encoder-based systems that emit full category vectors. The edge models are binary classifiers and are not reported for this category-vector view.
Compact comparison against other encoder categorization models
Decoder-based guardrails such as WildGuard, PolyGuard, Nemotron Safety Guard, and Qwen3Guard are excluded from this categorization table because the reported comparison only includes systems with full category-vector outputs.
1024-token latency and throughput
Higher throughput and lower latency are better.
At 1024 tokens, Opir-multitask-multilang reports 13.30 ms p50 latency, making it the fastest multi-task Opir checkpoint in the reported latency matrix while preserving taxonomy-level classification capability.
Calibration guidance
- Start with the paper's default threshold of
0.5 for multi-label use.
- Calibrate thresholds separately for prompts, responses, prompt-response pairs, and risk categories.
- For high-recall moderation, lower the threshold and route more cases to review.
- For high-precision automated actions, raise the threshold and keep human review for ambiguous cases.
- Monitor false positives on benign sensitive contexts, especially educational cybersecurity, medical information, counterspeech, harm prevention, and safety-policy discussion.
Limitations
- Safety classifiers can miss novel jailbreaks, obfuscated prompts, cross-lingual edge cases, and policy-specific harms not represented in the candidate labels.
- The model produces risk scores, not formal policy decisions. Production deployments should combine the model with logging, policy rules, escalation paths, and human review.
- The training data includes synthetic prompts, generated responses, translated examples, and LLM-as-judge annotations, which can introduce artifacts or judge bias.
- Thresholds reported in benchmarks may not transfer directly to production traffic.
- Prompt-response formatting affects results. Use a consistent serialization format during deployment.
- Multilingual coverage is translation-assisted and may vary by language, dialect, script, and culturally specific harm category.
Security considerations
Opir is intended as a defensive classifier. Adversaries may attempt to evade classifiers through obfuscation, encoding, low-resource languages, prompt smuggling, indirect prompt injection, or long-context distraction. Use the model as one layer in a defense-in-depth system, and keep evaluation sets updated with production red-team findings.
Citation
If you found our work, useful please feel free to cite our paper: