A Framework for Real-time Safeguarding the Text Generation of Large Language Model
On the map: LLM safety and security → Safety alignment, refusal and guardrails
Abstract (arXiv)
Large Language Models (LLMs) have significantly advanced natural language processing (NLP) tasks but also pose ethical and societal risks due to their propensity to generate harmful content. Existing methods have limitations, including the need for training specific control models and proactive intervention during text generation, that lead to quality degradation and increased computational overhead. To mitigate those limitations, we propose LLMSafeGuard, a lightweight real-time framework that integrates an external validator into decoding, rejecting unsafe outputs while allowing valid ones. We introduce a similarity-based validation approach, simplifying constraint introduction and eliminating the need for control model training. Additionally, LLMSafeGuard employs a context-wise timing selection strategy, intervening LLMs only when necessary. We evaluate LLMSafeGuard on detoxification and copyright safeguarding, demonstrating its superiority over SOTA baselines. In detoxification, LLMSafeGuard reduces toxic output by at least 38.6% while preserving linguistic quality. Additionally, its context-wise timing selection cuts inference time by at least 24.2% without compromising effectiveness.
Key facts. Cited by 2 papers in the map (data through 7 Oct 2026). Placed in Safety alignment, refusal and guardrails, one of 12 directions in LLM safety and security. Builds on 29 of its 46 references that are in the map. First posted on arXiv 29 Apr 2024.
Builds on
29 of 46 references.
Closest ancestors · 1
Same direction, newest first
Other references · 28
- 2023GPT-4 Technical Reportcited by 18,132
- 2022Training language models to follow instructions with human feedbackcited by 15,712
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
- 2019Sentence-BERT: Sentence Embeddings using Siamese BERT-Networkscited by 9,049
- 2022Self-Consistency Improves Chain of Thought Reasoning in Language Modelscited by 5,601
- 2022Constitutional AI: Harmlessness from AI Feedbackcited by 2,950
- 2019Fine-Tuning Language Models from Human Preferencescited by 2,124
- 2023A Survey on Hallucination in Large Language Models: Principles, Taxonomy, Challenges, and Open Questionscited by 1,582
- 2023PaLM 2 Technical Reportcited by 1,154
- 2023Llama Guard: LLM-based Input-Output Safeguard for Human-AI Conversationscited by 1,124
- 2023A Multitask, Multilingual, Multimodal Evaluation of ChatGPT on Reasoning, Hallucination, and Interactivitycited by 888
- 2019Plug and Play Language Models: A Simple Approach to Controlled Text Generationcited by 793
16 more
- 2019CTRL: A Conditional Transformer Language Model for Controllable Generationcited by 754
- 2023Siren's Song in the AI Ocean: A Survey on Hallucination in Large Language Modelscited by 695
- 2021Recent Advances in Natural Language Processing via Large Pre-Trained Language Models: A Surveycited by 457
- 2021DExperts: Decoding-Time Controlled Text Generation with Experts and Anti-Expertscited by 434
- 2021A Survey of Data Augmentation Approaches for NLPcited by 408
- 2020GeDi: Generative Discriminator Guided Sequence Generationcited by 377
- 2021FUDGE: Controlled Text Generation With Future Discriminatorscited by 374
- 2021Measuring and Improving Consistency in Pretrained Language Modelscited by 361
- 2021GPT3Mix: Leveraging Large-scale Language Models for Text Augmentationcited by 185
- 2022A Survey of Controllable Text Generation using Transformer-based Pre-trained Language Modelscited by 128
- 2023Copyright Violations and Large Language Modelscited by 108
- 2024GradSafe: Detecting Jailbreak Prompts for LLMs via Safety-Critical Gradient Analysiscited by 87
- 2022Controllable Natural Language Generation with Contrastive Prefixescited by 75
- 2020Data Boost: Text Data Augmentation Through Reinforcement Learning Guided Conditional Generationcited by 47
- 2022Critic-Guided Decoding for Controlled Text Generationcited by 45
- 2020Best-First Beam Searchcited by 40
Built on by
Citing papers per year: 2024: 1; 2025: 1.
2 papers.