Fence: Specialized SLM Guardrails for LLM Applications

arXiv cs.AI Papers

Summary

Fence proposes using Small Language Models trained on high-quality synthetic data as specialized guardrails for LLM applications, demonstrating performance gains over prompt-based LLM guardrails.

arXiv:2607.18268v1 Announce Type: new Abstract: Real-world applications that use closed-source large language models (LLMs) need advanced safety measures that go beyond the basic content filters. Content moderation filters such as toxicity and bias have relatively standard definitions where as application specific guardrails like hallucination, topic drift and behaviour deviation are more difficult to model and can vary by use case. Additionally, data scarcity and annotation costs, make the process of creating and testing specialized guardrails challenging. In this work, we propose using Small Language Models (SLMs) trained on synthetic data as specialized guardrails for LLM applications. We introduce a novel synthetic data generation method inspired by the design of Generative Adversarial Networks (GANs) to generate high quality synthetic data samples which can be used to train SLMs to encode use case specific guardrail information and hence function as specialized guardrails. Our experiments demonstrate that SLM guardrails trained on high quality synthetic data show performance gains over prompt based LLM guardrails.
Original Article
View Cached Full Text

Cached at: 07/22/26, 08:21 AM

# Fence: Specialized SLM Guardrails for LLM Applications
Source: [https://arxiv.org/html/2607.18268](https://arxiv.org/html/2607.18268)
###### Abstract

Real\-world applications that use closed\-source large language models \(LLMs\) need advanced safety measures that go beyond the basic content filters\. Content moderation filters such as toxicity and bias have relatively standard definitions where as application specific guardrails like hallucination, topic drift and behaviour deviation are more difficult to model and can vary by use case\. Additionally, data scarcity and annotation costs, make the process of creating and testing specialized guardrails challenging\. In this work, we propose using Small Language Models \(SLMs\) trained on synthetic data as specialized guardrails for LLM applications\. We introduce a novel synthetic data generation method inspired by the design of Generative Adversarial Networks \(GANs\) to generate high quality synthetic data samples which can be used to train SLMs to encode use case specific guardrail information and hence function as specialized guardrails\. Our experiments demonstrate that SLM guardrails trained on high quality synthetic data show performance gains over prompt based LLM guardrails\.

Fence: Specialized SLM Guardrails for LLM Applications

††This paper was prepared for informational purposes \[“in part” if the work is collaborative with external partners\] by the Machine Learning Center of Excellence group of JPMorgan Chase & Co\. and its affiliates \(”JP Morgan”\) and is not a product of the Research Department of JP Morgan\. JP Morgan makes no representation and warranty whatsoever and disclaims all liability, for the completeness, accuracy or reliability of the information contained herein\. This document is not intended as investment research or investment advice, or a recommendation, offer or solicitation for the purchase or sale of any security, financial instrument, financial product or service, or to be used in any way for evaluating the merits of participating in any transaction, and shall not constitute a solicitation under any jurisdiction or to any person, if such solicitation under such jurisdiction or to such person would be unlawful\.## 1Introduction

The surge in LLM driven applications being used by a wide range of people has made their safety a pressing concern\. Use cases where LLMs are leveraged for highly specialized or customized tasks, necessitate the development of guardrails specifically tailored to the unique requirements of each task\. While commercial LLMs such as GPT, Claude and Gemini are equipped with built\-in content filters that provide a foundational layer of safety, ensuring comprehensive protection requires the implementation of additional, specialized guardrails atop these default mechanisms\. To date, much of the focus has been on model\-centric safety; however, it is equally important to ensure that the downstream applications utilizing these LLMs operate within safe and responsible boundaries\. This imperative extends to all applications that employ LLMs for domain\-specific or task\-oriented purposes\.

To address the latency and cost bottlenecks of using LLM\-as\-a\-judge paradigmsVergaet al\.\([2024](https://arxiv.org/html/2607.18268#bib.bib4)\)for guardrails, recent research has explored safety distillation using synthetic data to train SLMsGudibandeet al\.\([2023](https://arxiv.org/html/2607.18268#bib.bib5)\)however they also don’t focus on highly specialized guardrails or synthetic data generation methods targetting safety\. Furthermore, common synthetic data generation techniques such as Self\-InstructWanget al\.\([2023](https://arxiv.org/html/2607.18268#bib.bib6)\)typically produce samples that lack adversarial complexity, which are unable to robustly detect esoteric instances of custom guardrail violations\. While some worksPerezet al\.\([2022](https://arxiv.org/html/2607.18268#bib.bib7)\)have introduced adversarial prompting to stress\-test models, there remains a significant lack of methodologies capable of generating high quality specialized safety data which can be used to train robust SLM guardrails\. Existing benchmarks like ToxigenHartvigsenet al\.\([2022](https://arxiv.org/html/2607.18268#bib.bib8)\); Bassani and Sanchez \([2024](https://arxiv.org/html/2607.18268#bib.bib9)\); Gehmanet al\.\([2020](https://arxiv.org/html/2607.18268#bib.bib10)\)focus on universal harms such as hate speech and violence\. However research into use case specific harms such as topic drift or behaviour deviation is limited\. For instance a financial bot requires different topic\-boundaries as compared to a creative writing bot\. Current content filters around LLMs are black boxes with fixed definitions and require additional customized guardrails on top\. In this work, we propose using an LLM simulated partial GAN setup to generate adversarial synthetic data which can be used to encode specific domain constraints into SLMs and hence address the issue of policy rigidity\. While a model may be considered ’safe’ by conventional standards, it can still be ’harmful’ within the context of specific business logic or domain requirements\. Therefore, it is essential to develop guardrails that are not only robust but also adaptable to the nuanced needs of individual applications\.

Through our proposed method, we enable the construction of guardrails for arbitrary policies using adversarial synthetic data, facilitating rapid policy prototyping and adaptation\. This approach shifts the focus from generic safeguarding of LLMs to the development of specialized guardrails tailored to downstream use cases leveraging these models\. By employing a GAN\-inspired synthetic data generation pipeline, we can quickly generate training data for SLMs, allowing for efficient updates to guardrail policies without the need for extensive data recollectionInanet al\.\([2023](https://arxiv.org/html/2607.18268#bib.bib2)\)\.

Our work presents a novel framework for generating high\-quality, domain\-specific synthetic data and training SLMs as specialized guardrails\. This enables flexible, rapid, and robust safety solutions for LLM\-driven applications, addressing both the limitations of existing content filters and the challenges of policy rigidity in real\-world deployments\.

![Refer to caption](https://arxiv.org/html/2607.18268v1/x1.png)Figure 1:Synthetic Data Generation Pipeline
## 2Related Work

NeMO\-GuardrailsRebedeaet al\.\([2023](https://arxiv.org/html/2607.18268#bib.bib1)\)and Llama\-guardInanet al\.\([2023](https://arxiv.org/html/2607.18268#bib.bib2)\)are some of the most popular guardrail solutions that allow for SLMs to be used as guardrails\. NeMO focuses primarily on Colang logic rather than a robust automated way to generate high quality adversarial data\. Such SLM guardrails rely on distillation from LLM outputs or human labelled data, which often suffers from label scarcity of adversarial samples\. Meta’s Llama\-guard\-3 is highly optimized for speed but is limited to broad, predefined safety taxonomies rather than broad application specific policies\.

Donget al\.\([2024](https://arxiv.org/html/2607.18268#bib.bib11)\)propose neural\-symbolic guardrails that can be fine\-tuned for specific tasks, demonstrating the effectiveness of smaller models in enforcing nuanced safety constraints\.Zhanet al\.\([2025](https://arxiv.org/html/2607.18268#bib.bib20)\)show that SLMs when finetuned for moderation can outperform LLMs in speed and accuracy for real time content filtering\. however their focus is mainly on standard moderation tasks such as toxicity and bias\. They also rely on annotated datasets limiting adaptability to more niche use\-cases which have data scarcity\.Nakkaet al\.\([2025](https://arxiv.org/html/2607.18268#bib.bib21)\)propose LiteLMGuard, which is an SLM\-based guardrail system trained on synthetic data\. This work primarily focuses on prompt filtering and standard safety risks and application\-specific guardrails such as hallucination and topic drift are not covered\.Ilinet al\.\([2025](https://arxiv.org/html/2607.18268#bib.bib12)\)train SLMs as safety guardrails using synthetic data generated through a GAN\-inspired, RL guided adversarial process\. The method augment and paraphrases human curated seed data and then uses a generator\-discriminator loop \(with the SLM as the discriminator\) to create challenging adversarial data samples\. While effective for general safety risks like toxicity and harmfulness, the approach does not target use\-case specific behaviours such as hallucination, topic drift and behaviour deviation\. In comparison, our synthetic data generation method is specifically tailored to nuanced, use\-case specific guardrails using LLMs to ensure higher quality data samples\.

Recent work has also focused on novel methods for synthetic data generation\. While existing datasets such as AdvBenchZouet al\.\([2023](https://arxiv.org/html/2607.18268#bib.bib13)\)andMazeikaet al\.\([2024](https://arxiv.org/html/2607.18268#bib.bib14)\)are specifically designed to evaluate safety and robustness of LLMs\. They are often entirely made up of human\-curated data and/or focus on generic guardrails and cannot cater to use\-case specific security requirements\.Liet al\.\([2024](https://arxiv.org/html/2607.18268#bib.bib15)\)propose a framework for generating adversarial prompts that can expose safety weaknesses in LLMs\. the method leverages gradient based optimization to craft prompts that are likely to elicit unsafe or undesired responses from the model\. The generated prompts are then used to evaluate and improve the safety of LLMs through adversarial training\. The paper demonstrates that models trained on synthetic data generated using the proposed pipeline sow improved robustness against a variety of adversarial attacks\. This work shows the effectiveness of synthetic data in training SLMs as specialized guardrails\.Xieet al\.\([2025](https://arxiv.org/html/2607.18268#bib.bib16)\)introduces a benchmark for specifically evaluating how LLMs and SLMs generate apology responses, which are critical for safety and user trust in real world applications\. The dataset includes a variety of scenarios where apology or refusal is the appropriate response and systematically measures model ability to response safely and appropriately\. The data is generated through a process combining human curation, aggregation of existing datasets, linguistic mutation such as rephrasing, using slang and logical appeals and LLM generated responses\.Huanget al\.\([2024](https://arxiv.org/html/2607.18268#bib.bib3)\)shows that general\-purpose safety models struggle to detect "harm" in application specific scenarios\. These models are able to detect obvious harm but not clever policy violations\.

Separate lines of work[2](https://arxiv.org/html/2607.18268#bib.bib17);[M\. Mazeika, L\. Phan, X\. Yin, A\. Zou, Z\. Wang, N\. Mu, E\. Sakhaee, N\. Li, S\. Basart, B\. Li, D\. Forsyth, and D\. Hendrycks \(2024\)](https://arxiv.org/html/2607.18268#bib.bib14)explore automated red\-teaming, where LLMs generate adversarial prompts to probe vulnerabilities in existing LLM systems and use an LLM as judge set up to evaluate the model response to the prompts to decide if a particular vulnerability was successfully exposed\. These approaches tend to be one\-shot or heuristic and lack transferability\. Moreover, without ground truth data, the red\-teaming results lack credibility\. Our synthetic data generation approach complements \(rather than duplicates\) automated red\-teaming efforts by prioritising distribution fidelity and provides high quality positive samples which can be used to assist red\-teaming exercises\.

## 3Synthetic Data Generation

One of the major challenges to finetuning SLM guardrails is the lack of positive samples, i\.e\. adversarial data\. Human annotation is expensive and time consuming and the scale of the data required to effectively train SLMs is often infeasible to annotate\. Using LLMs to generate synthetic data is a viable option however it is difficult to ensure this data resembles the real use\-case data in terms of semantics and distributionEl\-Hajjami and Salinesi \([2026](https://arxiv.org/html/2607.18268#bib.bib19)\); Shumailovet al\.\([2024](https://arxiv.org/html/2607.18268#bib.bib18)\)\. To address this challenge, we propose using a dual\-model setup where one model, theGenerator, generates synthetic data while the other model, theDiscriminator, tries to tell the difference between synthetic and real data\.

We propose a GAN\-inspired, LLM\-based method for synthetic data generation\. Below, we first define the key components and modes of operation before describing the overall pipeline\. Our synthetic data generation process consists of three main components: a GeneratorGG, a DiscriminatorDD, and an OptimizerOO\.

#### Key Components

- •Generator:An LLM responsible for producing synthetic data samples\. It receives two inputs: \(1\)seed data, a small set of safe, representative samples drawn from the target use\-case, and \(2\) aguardrail definition, a comprehensive natural\-language specification of the guardrail’s objective, including its primary aim, any relevant topic scopes, and expected behavioural guidelines\. #### Generation Modes - –Free Generation:TheGeneratorproduces entirely new samples conditioned on the seed data and guardrail definition, without directly modifying any existing example\. - –Adversarial Augmentation:TheGeneratorcreates variations of the input seed data, deliberately perturbing them to probe the boundaries of the guardrail while remaining realistic\.
- •Discriminator:A separate LLM tasked with distinguishing real data from synthetically generated data\. Crucially, theDiscriminatordoesnotevaluate whether a sample violates the guardrail; its sole objective is to classify each sample asrealorsyntheticand to provide a natural\-language justification for that classification\.
- •Optimizer:The optimizer is responsible for taking the text gradients from the discriminator and interpreting them as signals to update the prompt for theGenerator\. Text gradients are the natural\-language justifications produced by theDiscriminator\. Analogous to numerical gradients in traditional GANs, these reasoning outputs are fed back into theGenerator’s prompt to iteratively improve the quality and realism of subsequent synthetic samples\.

### Procedure

- •Generator:The GeneratorGGproduces candidate synthetic samplesxsynx\_\{\\text\{syn\}\}conditioned on a promptppand use\-case specific guardrail definitionδ\\delta: xsyn=G​\(p,δ\)x\_\{\\text\{syn\}\}=G\(p,\\delta\)
- •Discriminator:The DiscriminatorDDreceives both real samplesxrealx\_\{\\text\{real\}\}and synthetic samplesxsynx\_\{\\text\{syn\}\}, and outputs the labels for each sampleD​\(x\)∈\[r​e​a​l,f​a​k​e\]D\(x\)\\in\[real,fake\]indicating whetherxxis real or synthetic\. We impose the condition that the output labels fromDDhave to be mutually exclusive andDDis made aware that of the two samples provided, one is definitely real and one synthetic\. Along with the labels,DDalso generates a reasoning tracer​\(x\)r\(x\)that details the features influencing its decision\.
- •Reasoning Trace Aggregation:After each generation round, the reasoning tracesr​\(xreal\)r\(x\_\{\\text\{real\}\}\)andr​\(xsyn\)r\(x\_\{\\text\{syn\}\}\)are aggregated by appending them together and summarized to extract key discriminative features: - –ShelpfulS\_\{\\text\{helpful\}\}: Features that enabledDDto correctly identify synthetic data\. - –SconfusingS\_\{\\text\{confusing\}\}: Features that ledDDto mis\-classify synthetic as real\.
- •Optimizer:The OptimizerOOupdates the Generator promptppby maximizing the presence ofSconfusingS\_\{\\text\{confusing\}\}and minimizingShelpfulS\_\{\\text\{helpful\}\}in subsequent generations\. Formally, the prompt update at iterationttis: pt\+1=O​\(pt,Shelpful,Sconfusing\)p\_\{t\+1\}=O\\left\(p\_\{t\},S\_\{\\text\{helpful\}\},S\_\{\\text\{confusing\}\}\\right\) whereOOapplies text\-based modifications toptp\_\{t\}to optimize the Generator’s output\.

This iterative process continues until one of the following stopping criteria is met:

1. 1\.The maximum number of optimization runs is reached\.
2. 2\.The Optimizer determines that further prompt improvements yield negligible gains\.

At convergence, the final optimized promptp∗p^\{\*\}is used to generate the synthetic dataset for downstream guardrail training\. This approach leverages the richer, non\-binary feedback from the Discriminator’s reasoning traces, effectively simulating gradient\-based optimization in the space of natural language prompts\.

Algorithm 1Synthetic Data Generation1:Initialize:Set

r​u​n←0run\\leftarrow 0, define

m​a​x​\_​r​u​n​smax\\\_runs, load Seed data\.

2:while

r​u​n<m​a​x​\_​r​u​n​srun<max\\\_runsdo

3:

r​u​n←r​u​n\+1run\\leftarrow run\+1
4:Optimize generator prompt using optimizer with optimization history and seed data\.

5:Obtain optimized generator prompt\.

6:ifoptimization is not neededthen

7:break

8:endif

9:Generate synthetic data using optimized generator prompt\.

10:Apply discriminator to detect original and synthetic data\.

11:Record discriminator accuracy and reasoning\.

12:Update optimization history with discriminator feedback\.

13:endwhile

14:End

The final generated data resembles the real use\-case data, while also addressing the issue of label scarcity\. The data is then used to train SLMs to function as highly specialized guardrails\. Since the is generated in line with use\-case specific definitions, training on this data encodes the use\-case related guardrail patterns into the SLMs\. Our experiments show that encoding guardrail patterns into SLMs through synthetic data achieves better performance than simple LLM prompts\.

We identify three guardrails as starting points for use\-case specific analysis\. These are:

- •Off\-Topic Guardrail: This guardrail checks if the user query and the model output adhere to a predefined topic definition\. The topic definition is use\-case specific and can vary based on the application\. It can have severe reputational and compliance implications for businesses\.
- •Behaviour Deviation: This guardrail checks if the model output adheres to behaviour guidelines\. While most LLMs are good at being polite and respectful, use\-case specific behaviour guidelines might require them to go a step beyond\. For instance, a customer chatbot in a bank may have requirements where it not only needs to be respectful but should also never give out financial advise or answer questions not in a certain language\.
- •Prompt Injection: This guardrail is often provided out of the box with all commercially available LLMs\. However, use\-case specific requirements may mean considering potential attempts to get the model to generate response in a language its not meant for or trying to generate code using a banking chatbot as prompt injections\. These would again not be captured by the out\-of\-the\-box guardrails\.

## 4Experiments

We evaluate our proposed approach on two internal, domain\-specific use\-cases within in the financial sector\. The first use case \(here after referred to as use\-case\-1\) is an LLM driven search engine with access to data related to financial reports\. The second use case \(here after referred to as use\-case\-2\) is an FAQ chatbot for a cash management solution\. Ensuring proper guardrails is critical for the real\-world deployment of both use\-cases\. We show different use\-case specific guardrails in action by choosing a prompt injection guard for use\-case\-1, and an off topic input guardrail for use\-case\-2\. TheDiscriminatorprompt is inherently complex and required multiple iterations to ensure the model does not default to classifying samples as adversarial or benign, given that all synthetic samples are adversarial and all real samples are harmless\. We observe that optimizing theDiscriminatorprompt introduces instability into the optimization cycles, making it increasingly difficult to prevent theDiscriminatorfrom deviating from its intended task\. A sample of theDiscriminatorprompt evolution under joint optimization is provided in Appendix[A](https://arxiv.org/html/2607.18268#A1), illustrating how theDiscriminator’s focus gradually shifts from distinguishing between real and synthetic semantics to classifying samples as safe or harmful\. For this reason, we keep theDiscriminator‘frozen’ while optimizing theGenerator\.

Table 1:Performance comparison between specialized SLM guardrails and LLM\. Note: the models tagged as ’Fence’ are trained on data generated using the proposed synthetic data generation method\.Table 2:Effect of data generation method on downstream performance\.### 4\.1Dataset

For the prompt injection guardrail, we curate the seed data from the internal logs which include user input queries to the model\. 500 harmless user queries are picked and used as seed data for the synthetic data generation module\. An initial definition of the prompt injection guardrail is determined by the use\-case stakeholders\. This initial definition serves as the starting point for the optimization cycle that will follow\. Based on the initial config, 500 unsafe samples are generated using the synthetic data generation pipeline\. Of these 500 unsafe samples, 250 are specific to the use\-case definition while the rest are general prompt injections\. This is done to ensure the trained model while being use\-case specific still adheres to the expected baseline behaviour\.The validation set has the same distribution as the training set and contains 500 samples in total\.

For the off\-topic guardrail, we curate the seed data from the user input queries\. We randomly select 250 harmless queries from production data and use them as seed data for synthetic data generation\. An initial definition for the off\-topic guardrail which includes the topic definition is also provided\. Based on the initial configuration, 250 unsafe samples are generated\. The combined 500 queries are used to train the guardrail\. The validation set has the same distribution as the test set and contains a 100 samples in total\.

While the training and validation sets contain synthetic data, the test sets for both of the use\-cases consists only of human annotated and real data\. No synthetic data is included in the test sets\. This ensures that the evaluation reflects true, real\-world performance and avoids potential bias or over\-fitting to synthetic artifacts\. It also demonstrates the effectiveness of the trained guardrails on authentic user\-case specific inputs\. For the prompt injection guardrail, the test set consists of 467 safe queries and 114 unsafe user queries\. For the off\-topic input guardrail, the test set consists of 154 safe and 46 unsafe user queries\.

### 4\.2Synthetic Data Quality

To assess the quality of the generated data, we also generate a version of the synthetic data using only pass of through the generator\. The distributions of the train and validation sets remain exactly the same as the original synthetic datasets\. We compare the performance of models trained on data generated using the complete synthetic data generation pipeline versus data generated using only the generated prompt in one pass\.

### 4\.3Performance

To comprehensively evaluate guardrail performance, we trained both a decoder model, Gemma\-3\-1B \(instruction tuned\) and an encoder model, Nomic\-embed\-text\-v1\.5\. We then compared their results to those of the latest large language model \(available to use at the time of writing this paper\), gpt\-5\.2\-2025\-12\-11\. To ensure complete fairness and eliminate prompt engineering bias, all LLM prompts were generated by another LLM, rather than manually crafted\. This approach allows for an objective comparison of model capabilities, independent of prompt quality\.

All models were trained on a Tesla\-T4 GPU with a learning rate of2​e−52e^\{\-5\}, for 3 epochs\. Validation is run every 10 steps\. Model state is stored every 20 steps and the best model is loaded at the end\. We use LoRA withr​a​n​k=8rank=8,α=16\\alpha=16andd​r​o​p​o​u​t=0\.05dropout=0\.05to reduce memory and computation requirements\. For the encoder model, we add on two fully\-connected layers with hidden state sizes of 128 and 64 respectively, with ReLU activation, which serve as the classification head\. The final output from the trained encoder model include the class\-wise probabilities of the the input being ’safe’ and ’unsafe’\.

## 5Results and Analysis

Table[1](https://arxiv.org/html/2607.18268#S4.T1)shows that the SLM guardrails perform better than the LLM based guardrail across different use cases and tasks\. This performance advantage stems from the fact that domain\-specific use cases require specialized guardrail strategies which are difficult to capture with a single, \(often\) general\-purpose prompt for an LLM\. in contrast, SLM guardrails trained on targeted synthetic and real data are able to model nuanced, application\-specific constraints more effectively, leading to superior performance and lower cost overheads\.

Table[2](https://arxiv.org/html/2607.18268#S4.T2)shows the performance comparison between SLMs trained on synthetic data produced by the full pipeline versus models trained on data generated from a single pass through the generator\. Our results demonstrate that models train on data from the complete pipeline consistently outperform those trained on single pass synthetic data\. This improvement is attributed to he pipeline’s ability to maintain data distribution fidelity and ensure alignment with use case requirements\. In contrast, single\-pass generation often fails to capture the nuanced characteristics and constraints necessary for robust guardrail performance in domain\-specific applications\.

## 6Conclusion

In this work, we introduced a novel method for building specialized guardrails for LLM applications using SLMs trained on high quality synthetic data\. Our GAN\-inspired synthetic data generation pipeline enables the creation of targeted training datasets that capture domain\-specific constraints and requirements which re often difficult to encode in singular general\-purpose LLM prompts\. Through rigorous evaluation on internal financial use\-cases \(prompt injection and off\-topic input detection\)\. We demonstrated that SLM guardrails not only outperform LLM\-based guardrails in accuracy, but also offer significant advantages in cost\. Our ablation study further highlights the importance of comprehensive synthetic data generation for robust guardrail performance\. These findings underscore the value of specialized, data driven guardrail strategies for real\-world, high stakes applications\. A direction for future work can be to explore broader domain adaptations and integrations with additional guardrail types to further enhance safety and reliability in real world LLM applications\.

## Limitations

While our approach demonstrates strong performance and cost advantages, limitations remain\. Despite the careful synthetic data generation pipeline design, the generated data may not fully capture the complexity and diversity of real world user inputs, especially in new or evolving scenarios\. Our evaluation has been restricted to internal use cases and datasets, broader validation across different domains and external benchmarks are needed to confirm generalizability\. Finally, while SLMs offer latency and cost advantages, their performance in highly ambiguous and adversarial cases may still benefit from escalation to larger LLMs or human review\.

## References

- E\. Bassani and I\. Sanchez \(2024\)GuardBench: a large\-scale benchmark for guardrail models\.InProceedings of the 2024 Conference on Empirical Methods in Natural Language Processing,Y\. Al\-Onaizan, M\. Bansal, and Y\. Chen \(Eds\.\),Miami, Florida, USA,pp\. 18393–18409\.External Links:[Link](https://aclanthology.org/2024.emnlp-main.1022),[Document](https://dx.doi.org/10.18653/v1/2024.emnlp-main.1022)Cited by:[§1](https://arxiv.org/html/2607.18268#S1.p2.1)\.
- \[2\]DeepTeam by confident ai the llm red teaming framework rss\.External Links:[Link](https://www.trydeepteam.com/)Cited by:[§2](https://arxiv.org/html/2607.18268#S2.p4.1)\.
- Y\. Dong, R\. Mu, G\. Jin, Y\. Qi, J\. Hu, X\. Zhao, J\. Meng, W\. Ruan, and X\. Huang \(2024\)Building guardrails for large language models\.External Links:2402\.01822,[Link](https://arxiv.org/abs/2402.01822)Cited by:[§2](https://arxiv.org/html/2607.18268#S2.p2.1)\.
- A\. El\-Hajjami and C\. Salinesi \(2026\)Multi\-sample prompting and actor\-critic prompt optimization for diverse synthetic data generation\.External Links:2506\.21138,[Link](https://arxiv.org/abs/2506.21138)Cited by:[§3](https://arxiv.org/html/2607.18268#S3.p1.1)\.
- S\. Gehman, S\. Gururangan, M\. Sap, Y\. Choi, and N\. A\. Smith \(2020\)RealToxicityPrompts: evaluating neural toxic degeneration in language models\.External Links:2009\.11462,[Link](https://arxiv.org/abs/2009.11462)Cited by:[§1](https://arxiv.org/html/2607.18268#S1.p2.1)\.
- A\. Gudibande, E\. Wallace, C\. Snell, X\. Geng, H\. Liu, P\. Abbeel, S\. Levine, and D\. Song \(2023\)The false promise of imitating proprietary llms\.External Links:2305\.15717,[Link](https://arxiv.org/abs/2305.15717)Cited by:[§1](https://arxiv.org/html/2607.18268#S1.p2.1)\.
- T\. Hartvigsen, S\. Gabriel, H\. Palangi, M\. Sap, D\. Ray, and E\. Kamar \(2022\)ToxiGen: a large\-scale machine\-generated dataset for adversarial and implicit hate speech detection\.External Links:2203\.09509,[Link](https://arxiv.org/abs/2203.09509)Cited by:[§1](https://arxiv.org/html/2607.18268#S1.p2.1)\.
- Y\. Huang, L\. Sun, H\. Wang, S\. Wu, Q\. Zhang, Y\. Li, C\. Gao, Y\. Huang, W\. Lyu, Y\. Zhang, X\. Li, Z\. Liu, Y\. Liu, Y\. Wang, Z\. Zhang, B\. Vidgen, B\. Kailkhura, C\. Xiong, C\. Xiao, C\. Li, E\. Xing, F\. Huang, H\. Liu, H\. Ji, H\. Wang, H\. Zhang, H\. Yao, M\. Kellis, M\. Zitnik, M\. Jiang, M\. Bansal, J\. Zou, J\. Pei, J\. Liu, J\. Gao, J\. Han, J\. Zhao, J\. Tang, J\. Wang, J\. Vanschoren, J\. Mitchell, K\. Shu, K\. Xu, K\. Chang, L\. He, L\. Huang, M\. Backes, N\. Z\. Gong, P\. S\. Yu, P\. Chen, Q\. Gu, R\. Xu, R\. Ying, S\. Ji, S\. Jana, T\. Chen, T\. Liu, T\. Zhou, W\. Wang, X\. Li, X\. Zhang, X\. Wang, X\. Xie, X\. Chen, X\. Wang, Y\. Liu, Y\. Ye, Y\. Cao, Y\. Chen, and Y\. Zhao \(2024\)TrustLLM: trustworthiness in large language models\.External Links:2401\.05561,[Link](https://arxiv.org/abs/2401.05561)Cited by:[§2](https://arxiv.org/html/2607.18268#S2.p3.1)\.
- A\. Ilin, G\. Matevosyan, X\. Ma, V\. Eremin, S\. Dada, M\. Li, R\. Shaik, and H\. N\. Tokgozoglu \(2025\)Lightweight safety guardrails via synthetic data and rl\-guided adversarial training\.External Links:2507\.08284,[Link](https://arxiv.org/abs/2507.08284)Cited by:[§2](https://arxiv.org/html/2607.18268#S2.p2.1)\.
- H\. Inan, K\. Upasani, J\. Chi, R\. Rungta, K\. Iyer, Y\. Mao, M\. Tontchev, Q\. Hu, B\. Fuller, D\. Testuggine, and M\. Khabsa \(2023\)Llama guard: llm\-based input\-output safeguard for human\-ai conversations\.External Links:2312\.06674,[Link](https://arxiv.org/abs/2312.06674)Cited by:[§1](https://arxiv.org/html/2607.18268#S1.p3.1),[§2](https://arxiv.org/html/2607.18268#S2.p1.1)\.
- X\. Li, Z\. Zhou, J\. Zhu, J\. Yao, T\. Liu, and B\. Han \(2024\)DeepInception: hypnotize large language model to be jailbreaker\.External Links:2311\.03191,[Link](https://arxiv.org/abs/2311.03191)Cited by:[§2](https://arxiv.org/html/2607.18268#S2.p3.1)\.
- M\. Mazeika, L\. Phan, X\. Yin, A\. Zou, Z\. Wang, N\. Mu, E\. Sakhaee, N\. Li, S\. Basart, B\. Li, D\. Forsyth, and D\. Hendrycks \(2024\)HarmBench: a standardized evaluation framework for automated red teaming and robust refusal\.External Links:2402\.04249Cited by:[§2](https://arxiv.org/html/2607.18268#S2.p3.1),[§2](https://arxiv.org/html/2607.18268#S2.p4.1)\.
- K\. Nakka, J\. Dani, A\. Mondal, and N\. Saxena \(2025\)LiteLMGuard: seamless and lightweight on\-device guardrails for small language models against quantization vulnerabilities\.InProceedings of the 14th International Joint Conference on Natural Language Processing and the 4th Conference of the Asia\-Pacific Chapter of the Association for Computational Linguistics,K\. Inui, S\. Sakti, H\. Wang, D\. F\. Wong, P\. Bhattacharyya, B\. Banerjee, A\. Ekbal, T\. Chakraborty, and D\. P\. Singh \(Eds\.\),Mumbai, India,pp\. 206–223\.External Links:[Link](https://aclanthology.org/2025.findings-ijcnlp.12/),[Document](https://dx.doi.org/10.18653/v1/2025.findings-ijcnlp.12),ISBN 979\-8\-89176\-303\-6Cited by:[§2](https://arxiv.org/html/2607.18268#S2.p2.1)\.
- E\. Perez, S\. Huang, F\. Song, T\. Cai, R\. Ring, J\. Aslanides, A\. Glaese, N\. McAleese, and G\. Irving \(2022\)Red teaming language models with language models\.External Links:2202\.03286,[Link](https://arxiv.org/abs/2202.03286)Cited by:[§1](https://arxiv.org/html/2607.18268#S1.p2.1)\.
- T\. Rebedea, R\. Dinu, M\. Sreedhar, C\. Parisien, and J\. Cohen \(2023\)NeMo guardrails: a toolkit for controllable and safe llm applications with programmable rails\.External Links:2310\.10501,[Link](https://arxiv.org/abs/2310.10501)Cited by:[§2](https://arxiv.org/html/2607.18268#S2.p1.1)\.
- I\. Shumailov, Z\. Shumaylov, Y\. Zhao, Y\. Gal, N\. Papernot, and R\. Anderson \(2024\)The curse of recursion: training on generated data makes models forget\.External Links:2305\.17493,[Link](https://arxiv.org/abs/2305.17493)Cited by:[§3](https://arxiv.org/html/2607.18268#S3.p1.1)\.
- P\. Verga, S\. Hofstatter, S\. Althammer, Y\. Su, A\. Piktus, A\. Arkhangorodsky, M\. Xu, N\. White, and P\. Lewis \(2024\)Replacing judges with juries: evaluating llm generations with a panel of diverse models\.External Links:2404\.18796,[Link](https://arxiv.org/abs/2404.18796)Cited by:[§1](https://arxiv.org/html/2607.18268#S1.p2.1)\.
- Y\. Wang, Y\. Kordi, S\. Mishra, A\. Liu, N\. A\. Smith, D\. Khashabi, and H\. Hajishirzi \(2023\)Self\-instruct: aligning language models with self\-generated instructions\.External Links:2212\.10560,[Link](https://arxiv.org/abs/2212.10560)Cited by:[§1](https://arxiv.org/html/2607.18268#S1.p2.1)\.
- T\. Xie, X\. Qi, Y\. Zeng, Y\. Huang, U\. M\. Sehwag, K\. Huang, L\. He, B\. Wei, D\. Li, Y\. Sheng, R\. Jia, B\. Li, K\. Li, D\. Chen, P\. Henderson, and P\. Mittal \(2025\)SORRY\-bench: systematically evaluating large language model safety refusal\.External Links:2406\.14598,[Link](https://arxiv.org/abs/2406.14598)Cited by:[§2](https://arxiv.org/html/2607.18268#S2.p3.1)\.
- X\. Zhan, A\. Goyal, Y\. Chen, E\. Chandrasekharan, and K\. Saha \(2025\)SLM\-mod: small language models surpass LLMs at content moderation\.InProceedings of the 2025 Conference of the Nations of the Americas Chapter of the Association for Computational Linguistics: Human Language Technologies \(Volume 1: Long Papers\),L\. Chiruzzo, A\. Ritter, and L\. Wang \(Eds\.\),Albuquerque, New Mexico,pp\. 8774–8790\.External Links:[Link](https://aclanthology.org/2025.naacl-long.441/),[Document](https://dx.doi.org/10.18653/v1/2025.naacl-long.441),ISBN 979\-8\-89176\-189\-6Cited by:[§2](https://arxiv.org/html/2607.18268#S2.p2.1)\.
- A\. Zou, Z\. Wang, N\. Carlini, M\. Nasr, J\. Z\. Kolter, and M\. Fredrikson \(2023\)Universal and transferable adversarial attacks on aligned language models\.External Links:2307\.15043,[Link](https://arxiv.org/abs/2307.15043)Cited by:[§2](https://arxiv.org/html/2607.18268#S2.p3.1)\.

## Appendix ADiscriminator Prompt

IterationPromptOriginalYou are a data validation expert skilled at identifying real and synthetic data\. Given a pair of data samples, your task is to determine which sample is real and which is synthetic based ONLY on the language patterns, coherence, and other relevant textual characteristics of the samples\. Provide a detailed reasoning for your decision\.STRICT INSTRUCTIONS:•The CONTEXT is providedonlyto inform you about the general domain\.You must completely ignore whether the data samples are consistent or inconsistent with the CONTEXT unless there are very major inconsistencies\.•Do NOT use any information from the CONTEXT to judge the plausibility, correctness, or accuracy of the data samples\.•Do NOT mention or consider whether terminology, details, or facts in the samples match or mismatch the CONTEXT\.•Do NOT use the presence of errors, anomalies, or inconsistencies with the CONTEXT as evidence that a sample is synthetic\. Real data can have such inconsistencies\.•Focus ONLY on features such as language patterns, coherence, fluency, and other relevant textual characteristics that are independent of the CONTEXT\.•If both samples appear equally realistic or equally artificial based on language and textual features alone,make a random choiceand clearly state in your reasoning that the choice was random due to equal plausibility\.•The order of the data samples is random and does not indicate which is real or synthetic\.1You are a content safety expert skilled at identifying real and synthetic data\. Given a pair of data samples, your task is to determine which sample is real \(safe\) and which is synthetic \(harmful/unsafe\)\.KEY PRINCIPLE:Real data is safe, benign, and represents legitimate user queries or system responses\. Synthetic data has been augmented to be harmful, unsafe, or malicious — it may contain prompt injections, manipulative instructions, attempts to extract sensitive information, requests for illegal activities, or other unsafe content disguised within otherwise normal\-looking text\.DETECTION GUIDELINES:•Identify which sample contains harmful, unsafe, or manipulative content — that is the synthetic sample\.•Look for embedded instructions, role\-play scenarios, or hypothetical framings that attempt to bypass safety guardrails\.•Look for subtle shifts in intent from informational to actionable harm \(e\.g\., asking how to exploit, circumvent, or abuse systems\)\.•Pay attention to the specificity and depth of content\. Synthetic samples may lack domain\-specific technical details and instead appear overly generic or contextually simplistic\.•Real samples are straightforward, on\-topic queries or responses without hidden agendas or harmful intent, often reflecting legitimate user inquiries or system interactions\.•The synthetic sample may try to disguise harmful content within seemingly normal language — look for the underlying intent and thematic consistency\.•Compare samples for contextual precision\. If one sample is vague or overly generic relative to the other, it is likely synthetic\.•If both samples appear equally safe or equally harmful,make a random choiceand clearly state in your reasoning that the choice was random due to equal plausibility\.•The order of the data samples is random and does not indicate which is real or synthetic\.2You are a content safety expert skilled at identifying real and synthetic data\. Given a pair of data samples, your task is to determine which sample is real \(safe\) and which is synthetic \(harmful/unsafe\)\.KEY PRINCIPLE:Real data is safe, benign, and represents legitimate user queries or system responses\. Synthetic data has been augmented to be harmful, unsafe, or malicious — it may contain prompt injections, manipulative instructions, attempts to extract sensitive information, requests for illegal activities, or other unsafe content disguised within otherwise normal\-looking text\.DETECTION GUIDELINES:•Identify which sample contains harmful, unsafe, or manipulative content — that is the synthetic sample\.•Look for embedded instructions, role\-play scenarios, or hypothetical framings that attempt to bypass safety guardrails\.•Pay attention to the specificity and depth of content\. Synthetic samples may lack domain\-specific technical details and instead appear overly generic or contextually simplistic\.•Real samples are straightforward, on\-topic queries or responses without hidden agendas or harmful intent, often reflecting legitimate user inquiries or system interactions\.•The synthetic sample may try to disguise harmful content within seemingly normal language — look for the underlying intent and thematic consistency\.•Compare samples for contextual precision\. If one sample is vague or overly generic relative to the other, it is likely synthetic\.•Evaluate the progression of ideas within the samples; synthetic data may exhibit abrupt thematic shifts or inconsistencies that undermine contextual coherence\.•If both samples appear equally safe or equally harmful,make a random choiceand clearly state in your reasoning that the choice was random due to equal plausibility\.•The order of the data samples is random and does not indicate which is real or synthetic\.3You are a content safety expert skilled at identifying real and synthetic data\. Given a pair of data samples, your task is to determine which sample is real \(safe\) and which is synthetic \(harmful/unsafe\)\.KEY PRINCIPLE:Real data is safe, benign, and represents legitimate user queries or system responses\. Synthetic data has been augmented to be harmful, unsafe, or malicious — it may contain prompt injections, manipulative instructions, attempts to extract sensitive information, requests for illegal activities, or other unsafe content disguised within otherwise normal\-looking text\.DETECTION GUIDELINES:•Identify which sample contains harmful, unsafe, or manipulative content — that is the synthetic sample\.•Look for embedded instructions, role\-play scenarios, or hypothetical framings that attempt to bypass safety guardrails\.•Pay attention to the specificity and depth of content\. Synthetic samples may lack domain\-specific technical details and instead appear overly generic or contextually simplistic\. Alternatively, synthetic data may overcompensate with unnatural coherence or contrived realism\.•Real samples are straightforward, on\-topic queries or responses without hidden agendas or harmful intent, often reflecting legitimate user inquiries or system interactions\.•The synthetic sample may try to disguise harmful content within seemingly normal language — look for the underlying intent and thematic consistency\. Specifically, assess whether the content is overly structured or too perfectly balanced to mimic realism\.•Compare samples for contextual precision\. If one sample is vague, overly generic, or unnaturally coherent relative to the other, it is likely synthetic\.•Evaluate the progression of ideas within the samples; synthetic data may exhibit abrupt thematic shifts or inconsistencies that undermine contextual coherence, or conversely, an unnatural flow designed to mimic expert\-level depth\.•If both samples appear equally safe or equally harmful,make a random choiceand clearly state in your reasoning that the choice was random due to equal plausibility\.•The order of the data samples is random and does not indicate which is real or synthetic\.4You are a content safety expert skilled at identifying real and synthetic data\. Given a pair of data samples, your task is to determine which sample is real \(safe\) and which is synthetic \(harmful/unsafe\)\.KEY PRINCIPLE:Real data is safe, benign, and represents legitimate user queries or system responses\. Synthetic data has been augmented to be harmful, unsafe, or malicious — it may contain prompt injections, manipulative instructions, attempts to extract sensitive information, requests for illegal activities, or other unsafe content disguised within otherwise normal\-looking text\.DETECTION GUIDELINES:•Identify which sample contains harmful, unsafe, or manipulative content — that is the synthetic sample\.•Look for embedded instructions, role\-play scenarios, or hypothetical framings that attempt to bypass safety guardrails\.•Pay attention to the specificity and depth of content\. Synthetic samples may lack domain\-specific technical details and instead appear overly generic or contextually simplistic\. Alternatively, synthetic data may overcompensate with unnatural coherence or contrived realism\.•Real samples are straightforward, on\-topic queries or responses without hidden agendas or harmful intent, often reflecting legitimate user inquiries or system interactions\.•The synthetic sample may try to disguise harmful content within seemingly normal language — look for the underlying intent and thematic consistency\. Specifically, assess whether the content is overly structured or too perfectly balanced to mimic realism\.•Compare samples for contextual precision\. If one sample is vague, overly generic, or unnaturally coherent relative to the other, it is likely synthetic\.•Evaluate the progression of ideas within the samples; synthetic data may exhibit abrupt thematic shifts or inconsistencies that undermine contextual coherence, or conversely, an unnatural flow designed to mimic expert\-level depth\.•Take into account the use of domain\-specific language\. Synthetic samples might superficially incorporate technical terms without a genuine understanding of their context, resulting in a forced or artificial appearance\.•If both samples appear equally safe or equally harmful,make a random choiceand clearly state in your reasoning that the choice was random due to equal plausibility\.•The order of the data samples is random and does not indicate which is real or synthetic\.

Similar Articles

Robust and Efficient Guardrails with Latent Reasoning

arXiv cs.AI

CoLaGuard is a new guardrail model that transfers multi-step safety reasoning into a continuous latent space, achieving 12.9x speedup and 22.4x token reduction compared to explicit reasoning baselines while matching macro-F1 performance on ten safety benchmarks.

Safe responses matter: Output-aware safety guardrail mitigate over-refusal in MLLMs

arXiv cs.LG

This paper proposes output-aware safety guardrails for multimodal large language models that use hidden state representations and multi-instance contrastive learning to predict unsafe outputs before generation, drastically reducing over-refusal while maintaining safety. The method preserves the model's utility by intervening only when the actual response would be harmful.