Opir: Efficient Multi-Task Safety Classification for Toxicity, Jailbreaks, Hate Speech, and Harmful Content
Ihor Stepanov, Aleksandr Smechov · 2026
Read Opir: Efficient Multi-Task Safety Classification for Toxicity, Jailbreaks, Hate Speech, and Harmful Content by Ihor Stepanov, Aleksandr Smechov (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2605-29659.txt.
Introduction
Ihor Stepanov and Aleksandr Smechov present Opir, encoder-based guardrail models for real-time safety filtering. Opir covers binary safe-or-unsafe calls, toxicity labels, jailbreak detection, and zero-shot prompt and response sorting, plus edge variants. Training data combine unsafe prompts, hard negatives, benign examples, generated responses, translations, and parts of two sets. The taxonomy holds 996 categories split into 16 top groups, 126 middle groups, and 854 leaves. Across 12 safety tasks and 17 category tasks against eight systems, Opir matches or beats the open-weight baselines on most datasets.
Catalog record
| CREATOR | Ihor Stepanov, Aleksandr Smechov |
|---|---|
| YEAR | 2026 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 51241 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2605.29659
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
Opir: Efficient Multi-Task Safety Classification for Toxicity, Jailbreaks, Hate Speech, and Harmful Content Ihor Stepanov, Aleksandr Smechov Abstract Real-time safety filtering for large language model (LLM) applications requires classifiers that can detect unsafe prompts, toxic language, jailbreak attempts, and unsafe responses without the cost profile of large guardrail models, and that can distinguish benign sensitive text from genuinely covert harmful content. In this paper, we introduce Opir , a family of encoder-based guardrail models built on the GLiClass architecture. Opir includes multi-task models for binary safe/unsafe classification, multi-label toxicity classification, jailbreak classification, and zero-shot unsafe prompt and response categorization. We also release edge variants with fewer than 100M parameters dedicated to binary safe/unsafe categorization. The models are trained on a three-level taxonomy containing 996 categories across 16 top-level labels, 126 mid-level labels, and 854 leaf labels. Opir’s training data combines taxonomy-grounded unsafe prompts, adversarially mined hard negatives, benign safety-preserving examples, generated response examples, multilingual translations, and portions of the Aegis2 and WildGuard training subsets. We also open-sourced an evaluation harness that supports GLiClass and GLiNER2 backends as well as decoder-based models, and covers binary safety classification, multi-label categorization, toxicity, jailbreak detection, prompt safety, response safety, response refusal, and prompt subcategory views across public benchmark families. Across an expanded comparison spanning 12 safety-classification tasks and 17 category tasks against eight contemporary guardrail systems—including both GLiNER2-based and generative guardrail models—Opir variants are competitive on or ahead of the strongest open-weight baselines on the majority of benchmark datasets while operating with a substantially smaller deployment footprint. Latency measurements indicate that encoder variants can run with sub-30 ms p50 latency at 1024 tokens in the reported setup, while the smallest edge model achieves p50 latency below 10 ms. Keywords: LLM safety; guardrails; toxicity classification; hate speech detection; jailbreak detection; prompt injection; harmful-content moderation; response safety; GLiClass; sequence classification; multi-label classification; safety taxonomy; multilingual moderation. 1 Introduction Large language models [ 5 , 59 , 20 ] are deployed in chat, agentic, and middleware settings where both user inputs and model outputs require real-time moderation. As LLMs gain more autonomy, the guardrail layer between an agent and a user becomes increasingly critical [ 56 , 21 ] . Existing safeguard models such as Llama Guard [ 26 ] , WildGuard [ 22 ] , PolyGuard [ 34 ] , ShieldGemma [ 71 ] , Granite Guardian [ 49 ] , and the Llama-3.1-Nemotron Safety Guard family [ 17 , 18 ] are typically large autoregressive models with 7B–22B parameters. While these models offer flexible, prompt-conditioned classification, their cost profile makes large-scale deployment expensive and adds significant per-request latency because each guarded interaction triggers one or more additional LLM forward passes. Many safety systems also emphasize binary safe/unsafe decisions. While these are practical for safety routing, real-world use cases often require finer categorization across toxicity, jailbreaks, prompt injection, and broader harmful-content domains [ 42 , 64 , 39 ] . Opir tackles this with an encoder-based GLiClass [ 57 ] model family. GLiClass extends the GLiNER [ 70 ] architecture, originally proposed for zero-shot named entity recognition, to sequence classification by jointly encoding the input text and candidate labels with a bidirectional encoder. This enables zero-shot multi-label classification at a fraction of the cost of large generative guardrail models, and removes the brittleness of cross-encoder rerankers that must process each label-text pair sequentially. The Opir models are designed for multi-task moderation over prompt and response inputs, including binary safe/unsafe classification, toxicity classification, jailbreak classification, and zero-shot unsafe categorization over a hierarchical taxonomy. The project includes English-only, multilingual, and edge-oriented variants, allowing deployment across cloud-scale moderation services and single-machine edge devices. 1.1 Contributions We make the following contributions. 1. A three-level safety taxonomy comprising 16 Level 1 categories, 126 Level 2 categories, and 854 Level 3 leaf labels (996 labels in total). The taxonomy covers ordinary toxicity, LLM-specific attacks (including instruction-hierarchy violations [ 63 ] and indirect prompt injection [ 21 ] ), harmful-content categories, benign sensitive contexts, and uncertain boundary cases. 2. A GLiClass-based guardrail model family. We develop Opir variants based on DeBERTaV3 [ 23 ] , mDeBERTaV3, and compact encoders from the Ettin [ 29 ] and mmBERT [ 30 ] families, with multi-task and edge-oriented deployment profiles. 3. A synthetic and open-data recipe. We construct data from taxonomy-derived unsafe prompts, adversarial hard-negative mining inspired by red-teaming pipelines [ 50 , 74 , 44 ] , benign safety-preserving contrast examples, generated responses, multilingual translation, and a number of open-source training datasets such as Aegis2 [ 18 ] and WildGuardMix [ 22 ] . 4. A multi-view evaluation harness. We evaluate safety, toxicity, jailbreak detection, and main-category classification using GLiClass, GLiNER2, and vLLM [ 35 ] backends, supporting prompt safety, response safety, response refusal, and prompt subcategory tasks across public benchmark families including HarmBench [ 43 ] , JailbreakBench [ 7 ] , BeaverTails [ 32 ] , PKU-SafeRLHF [ 31 ] , XSTest [ 53 ] , OR-Bench [ 10 ] , SimpleSafetyTests [ 62 ] , ToxicChat [ 39 ] , the OpenAI moderation benchmark [ 42 ] , WildGuardMix [ 22 ] , and PolyGuardPrompts [ 34 ] . 5. An extensive benchmark and latency comparison. We compare Opir-multitask-large, Opir-multitask-multilang, Opir-edge, and Opir-edge-multilang with eight contemporary guardrail models across 12 safety datasets and 17 categorization datasets, and report first-pass throughput and p50/p95 latency measurements for GLiClass, GLiNER2, and vLLM guardrail backends. You can find evaluation code, scripts for reproducing the benchmark tables, and supplementary materials in the project repository. 1 1 1 https://github.com/Knowledgator/Opir 2 Related Work The literature on LLM safety classification spans more than a decade of work on toxicity detection, hate speech recognition, content moderation, jailbreaking, and adversarial robustness. In this section we situate Opir within five overlapping threads: classical content moderation, LLM-based guardrails, jailbreak and prompt-injection detection, multilingual safety, and efficient encoder-based classification. 2.1 From Classical Toxicity Detection to LLM Moderation Early content moderation systems were built around supervised classifiers trained on social-media data, most prominently the Jigsaw Perspective API [ 36 ] and the OpenAI moderation classifier [ 42 ] . 42 introduced the holistic approach: a unified taxonomy spanning hate, sexual content, self-harm, violence, harassment and related categories, learned with a multi-task transformer over both public and proprietary data. The OpenAI moderation benchmark released alongside that work remains a widely used evaluation set. Specialized BERT-style classifiers such as HateBERT [ 6 ] and ToxDectRoBERTa [ 73 ] were trained on platform-specific corpora and remain strong baselines for short-form toxic language. However, 39 showed that toxicity classifiers trained on social-media data degrade substantially on real-world user–AI chat: their ToxicChat benchmark, drawn from the Vicuna online demo, exposes a large distribution shift between forum-style toxicity and the more conversational, role-play-heavy, instruction-following style of LLM users. ToxicChat additionally includes a jailbreak label, anticipating the shift toward LLM-specific attack types. A parallel thread has investigated dataset-level safety scaffolding for LLMs themselves. 32 released BeaverTails , a 330K-sample QA dataset annotated for harmlessness across 14 categories, with a focus on red-team-style prompts; PKU-SafeRLHF [ 31 ] extends this with 44.6K refined prompts and 265K QA pairs labeled across 19 harm categories and three severity levels, supporting both response-safety classification and preference learning.