C-SafeGen: Certified Safe LLM Generation with Claim-Based Streaming Guardrails
Abstract
Despite the remarkable capabilities of large language models (LLMs) across diverse applications, they remain vulnerable to generating content that violates safety regulations and policies. To mitigate these risks, LLMs undergo safety alignment; however, they can still be effectively jailbroken. Off-the-shelf guardrail models are commonly deployed to monitor generations, but these models primarily focus on detection rather than ensuring safe decoding of LLM outputs. Moreover, existing efforts lack rigorous safety guarantees, which are crucial for the universal deployment of LLMs and certifiable compliance with regulatory standards. In this paper, we propose a Claim-based Stream Decoding (CSD) algorithm coupled with a statistical risk guarantee framework using conformal analysis. Specifically, our CSD algorithm integrates a stream guardrail model to safeguard sequential claims generated by LLMs and incorporates a backtracking mechanism to revise claims flagged with high safety risks. We provide theoretical guarantees demonstrating that the CSD algorithm achieves the desired generation distribution subject to safety constraints. Furthermore, we introduce a generation risk certification framework and derive a high-probability upper bound on the safety risk of the proposed CSD algorithm. We prove that our method can asymptotically control safety risk to any desired level. Empirical evaluations demonstrate the effectiveness and efficiency of the CSD algorithm compared to state-of-the-art safety decoding approaches. Additionally, we validate the soundness and tightness of the derived safety risk upper bound using realistic data.
Create a lesson
Related papers
Scalar Tuned Lens Summaries Offer Limited Incremental Value for Mid-Generation Abstention
Shared title terminologycs.AIKhurram Khalil, Khaza Anuarul Hoque
The Effect of Security-Focused Prompts on Reported Findings: A Controlled Experiment on 400 AI-Generated Web Applications
Shared title terminologycs.AIDarko Andročec
Integrating Generative Artificial Intelligence with Learning Style Models: Opportunities, Challenges, and Future Directions
Shared title terminologycs.AIMalithi Nawarathne, Prasanna Haddela, Nuwan Kodagoda
SLP-Bench: Evaluating and Improving Acoustic Claims of Reasoning Audio Language Models on Clinical Speech
Shared title terminologycs.AICôme Hosxe, Rachid Riad, Quentin Spinat
Learning Inside Types: Epistemic Typestates for Safe Multi-Agent Reinforcement Learning
Shared title terminologycs.AILorenzo Bacchiani, Mario Bravetti, Giovanni Pau et al.
Trained on Harm, Still Refusing: A Training-Time Defense for Code Generation
Shared title terminologycs.AIMiaoqing Tian, Ruohan Li, Qian Lu et al.