Table of Contents
Fetching ...

Building a Domain-specific Guardrail Model in Production

Mohammad Niknazar, Paul V Haley, Latha Ramanan, Sang T. Truong, Yedendra Shrinivasan, Ayan Kumar Bhowmick, Prasenjit Dey, Ashish Jagmohan, Hema Maheshwari, Shom Ponoth, Robert Smith, Aditya Vempaty, Nick Haber, Sanmi Koyejo, Sharad Sundararajan

TL;DR

The paper presents SPADE, a production-grade guardrail framework for domain-specific safety and appropriateness of LLMs in K-12 education. Itcribes a data-and-model pipeline that builds a specialized safety classifier, optimizes a base model (notably Mistral 7B) with token-length encoding and expanded input training, and demonstrates deployment strategies under two SLAs with hardware-aware inference. Through proprietary and public benchmarks, the approach outperforms open- and closed-tuning baselines on safety/appropriateness and toxicity detection while maintaining practical latency and scalability for classroom use. The work provides actionable guidance for practitioners aiming to deploy reliable, explainable, and privacy-conscious domain-specific LLM services, and outlines clear paths for extension to other sensitive domains. Overall, it advances production-ready guardrails by integrating data, model optimization, deployment tuning, and continuous evaluation in a cohesive framework.

Abstract

Generative AI holds the promise of enabling a range of sought-after capabilities and revolutionizing workflows in various consumer and enterprise verticals. However, putting a model in production involves much more than just generating an output. It involves ensuring the model is reliable, safe, performant and also adheres to the policy of operation in a particular domain. Guardrails as a necessity for models has evolved around the need to enforce appropriate behavior of models, especially when they are in production. In this paper, we use education as a use case, given its stringent requirements of the appropriateness of content in the domain, to demonstrate how a guardrail model can be trained and deployed in production. Specifically, we describe our experience in building a production-grade guardrail model for a K-12 educational platform. We begin by formulating the requirements for deployment to this sensitive domain. We then describe the training and benchmarking of our domain-specific guardrail model, which outperforms competing open- and closed- instruction-tuned models of similar and larger size, on proprietary education-related benchmarks and public benchmarks related to general aspects of safety. Finally, we detail the choices we made on architecture and the optimizations for deploying this service in production; these range across the stack from the hardware infrastructure to the serving layer to language model inference optimizations. We hope this paper will be instructive to other practitioners looking to create production-grade domain-specific services based on generative AI and large language models.

Building a Domain-specific Guardrail Model in Production

TL;DR

The paper presents SPADE, a production-grade guardrail framework for domain-specific safety and appropriateness of LLMs in K-12 education. Itcribes a data-and-model pipeline that builds a specialized safety classifier, optimizes a base model (notably Mistral 7B) with token-length encoding and expanded input training, and demonstrates deployment strategies under two SLAs with hardware-aware inference. Through proprietary and public benchmarks, the approach outperforms open- and closed-tuning baselines on safety/appropriateness and toxicity detection while maintaining practical latency and scalability for classroom use. The work provides actionable guidance for practitioners aiming to deploy reliable, explainable, and privacy-conscious domain-specific LLM services, and outlines clear paths for extension to other sensitive domains. Overall, it advances production-ready guardrails by integrating data, model optimization, deployment tuning, and continuous evaluation in a cohesive framework.

Abstract

Generative AI holds the promise of enabling a range of sought-after capabilities and revolutionizing workflows in various consumer and enterprise verticals. However, putting a model in production involves much more than just generating an output. It involves ensuring the model is reliable, safe, performant and also adheres to the policy of operation in a particular domain. Guardrails as a necessity for models has evolved around the need to enforce appropriate behavior of models, especially when they are in production. In this paper, we use education as a use case, given its stringent requirements of the appropriateness of content in the domain, to demonstrate how a guardrail model can be trained and deployed in production. Specifically, we describe our experience in building a production-grade guardrail model for a K-12 educational platform. We begin by formulating the requirements for deployment to this sensitive domain. We then describe the training and benchmarking of our domain-specific guardrail model, which outperforms competing open- and closed- instruction-tuned models of similar and larger size, on proprietary education-related benchmarks and public benchmarks related to general aspects of safety. Finally, we detail the choices we made on architecture and the optimizations for deploying this service in production; these range across the stack from the hardware infrastructure to the serving layer to language model inference optimizations. We hope this paper will be instructive to other practitioners looking to create production-grade domain-specific services based on generative AI and large language models.
Paper Structure (27 sections, 3 figures, 4 tables)

This paper contains 27 sections, 3 figures, 4 tables.

Figures (3)

  • Figure 1: The SPADE system guides the lifecycle from policy and adaptation in data and model preparation through deployment, with a strong focus on continuous evaluation. SPADE ensures that the models are not only efficient and effective in real-world applications but are also trustworthy.
  • Figure 2: (a) On A100 40GB, models start as memory bound, and as the batch size increases, we see them move to compute bound. On Nvidia L4, all models were compound-bound for the prefill stage. (b) For the same batch sizes shown in the first graph, all models operated on A100 40GB within the memory bound for the decode phase without latency increase. However, on Nvidia L4, latency increases with the increase in batch size. (c) We compare the derived QPS against the total latency for sequence lengths—512, 1024, 2048, and 3072 for our selected base model. With sequence length increase, the throughput halved while the latency increased by 2x. (d) We compare the derived QPS against the total latency for sequence lengths—512 and 1024 and decode lengths -- 20 and 64. As the decode length increases, the latency linearly increases.
  • Figure 3: Appropriateness checking service in education AI platform