OneShield - the Next Generation of LLM Guardrails

Pengyuan Li, Chad DeLuca, Anna Lisa Gentile, Shubhi Asthana, Bing Zhang, Pawan Chowdhary, Kellen Cheng, Basel Shbita, Pengyuan Li 0001, Guang-Jie Ren, Sandeep GopisettyarXiv 2025 · DOI

Introduction

As Large Language Models (LLMs) transition from experimental sandboxes to core enterprise infrastructure, the need for robust, real-time safety mechanisms has become paramount. OneShield is a modular, model-agnostic guardrail framework developed by IBM Research designed to secure LLM interactions. By decoupling risk detection from policy enforcement, OneShield enables enterprises to implement customized safety measures—ranging from PII redaction to fact-checking—without being constrained by a specific model's internal safety tuning.

The Challenge of LLM Safety

Current safety filters often suffer from three critical limitations that hinder enterprise adoption:

  1. Self-Referentiality: Many safety features are embedded within the model itself, leading to "blind spots" where a model cannot objectively evaluate its own potentially biased or harmful output.
  2. Rigidity: Existing solutions are frequently difficult to adapt to specific industry regulations (e.g., HIPAA) or regional legal requirements (e.g., GDPR).
  3. Inconsistency: Guardrail behaviors can be unpredictable, making them difficult for developers to audit or interpret.

OneShield addresses these gaps by providing a standalone "firewall" layer that operates at inference time, independent of the underlying LLM.

System Architecture and Methods

OneShield utilizes a microservices-based architecture to ensure scalability and flexibility. The system is composed of an Orchestrator, a suite of Detectors, and a Policy Manager.

OneShield High-Level Architecture: The Orchestrator API manages interactions between the user, the LLM, and various safety components.

The core innovation of OneShield lies in its three-pronged approach to detection:

  • Classification Detectors: Utilizing BERT-based embeddings and Separable Convolutional Neural Networks (SepCNN), these detectors categorize text into risk categories such as self-harm, inappropriate content (Hate, Abusive, Profane), and unauthorized medical advice.
  • Extractor Detectors: These are specialized for privacy, identifying and scoring Personally Identifiable Information (PII) based on context to allow for nuanced redaction.
  • Comparison Detectors: These perform large-scale text matching to identify data leakages, copyright violations, or hallucinations by comparing LLM outputs against verified external knowledge bases.

To minimize impact on user experience, all detectors run in parallel. This ensures that total system latency is determined only by the slowest individual detector, making the framework viable for high-throughput live applications.

Datasets and Training

The researchers trained and benchmarked OneShield using a diverse array of public and internal datasets:

  • Safety Benchmarks: AttaQ, ALERT, SALAD-Bench, HarmBench, and StrongREJECT.
  • Specialized Content: The "SuicideWatch" subreddit for self-harm detection and the HeAL benchmark for health advice.
  • Privacy/PII: The Enron Email Dataset alongside various synthetic PII datasets.
  • Production Data: Internal IBM interactive logs (156 million records) and X-Force cybersecurity data were used to refine detectors for real-world enterprise environments.

Performance and Real-World Impact

OneShield demonstrates high precision and low latency across various safety tasks. The system is optimized for speed; for example, the PII extractor can process a 150-token prompt in just 0.521 milliseconds.

Performance metrics for the SepCNN Classifier across test datasets and PR Insights.

As shown in the performance data, the self-harm detector (SepCNN) achieved a 96.60% accuracy on test datasets. Furthermore, the system was integrated into InstructLab, an open-source project by IBM and Red Hat. In this deployment, OneShield automatically vetted over 1,200 Pull Requests, identifying violations in 8.25% of submissions and significantly reducing the manual workload for human moderators.

Key Insights

  • Decoupling Detection from Action: By separating the identification of a risk from the response, the Policy Manager can apply different rules to the same detection based on context (e.g., masking a name in customer support while allowing it in general chat).
  • Contextual PII Scoring: OneShield evaluates context to determine if data is truly sensitive, reducing false positives that disrupt natural conversation flow.
  • Model Agnosticism: Because it sits outside the LLM, OneShield can be integrated with any model (GPT-4, Llama, Granite, etc.), providing a consistent safety layer across an organization's entire AI portfolio.

Limitations and Future Work

Maintaining effective guardrails is an ongoing challenge as prompt injection techniques and harmful content types evolve. While OneShield utilizes a "sparse-human-in-the-loop" alignment to stay current, rapid shifts in data distributions remain a hurdle. Future research will focus on expanding the detector library and refining the Policy Manager to handle multi-modal interactions involving images and code.

Summary updated

BibTeX
@misc{li2025oneshield,
  author = {Pengyuan Li and Chad DeLuca and Anna Lisa Gentile and Shubhi Asthana and Bing Zhang and Pawan Chowdhary and Kellen Cheng and Basel Shbita and Pengyuan Li and Guang-Jie Ren and Sandeep Gopisetty},
  title = {{OneShield - the Next Generation of LLM Guardrails}},
  year = {2025},
  eprint = {2507.21170},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2507.21170},
}
Figure