Calibrated Predictive Lower Bounds on Time-to-Unsafe-Sampling in LLMs
Hen Davidov, Shai Feldman, Gilad Freidkin, Yaniv Romano
TL;DR
This work defines time-to-unsafe-sampling $T$ as a per-prompt safety metric for LLMs and casts its estimation under a finite sampling budget as a survival-analysis problem. It constructs a Probably Approximately Correct lower predictive bound $\hat{L}(X)$ with finite-sample guarantees using a calibrated conformal approach, and introduces an optimized censoring-budget allocation to improve sample efficiency while preserving coverage. The method is validated on synthetic data and a RealToxicityPrompts experiment with large-scale generation, showing that the Optimized calibration yields valid, informative LPBs that scale with budget and provide practical risk assessment for prompt-level safety. The approach enables proactive safety decisions, such as adaptive auditing and allocation of computational resources, by quantifying how many safe responses to expect before unsafe content may occur. Overall, the paper advances field-ready tools for proactive safety evaluation of generative AI under realistic resource constraints.
Abstract
We introduce time-to-unsafe-sampling, a novel safety measure for generative models, defined as the number of generations required by a large language model (LLM) to trigger an unsafe (e.g., toxic) response. While providing a new dimension for prompt-adaptive safety evaluation, quantifying time-to-unsafe-sampling is challenging: unsafe outputs are often rare in well-aligned models and thus may not be observed under any feasible sampling budget. To address this challenge, we frame this estimation problem as one of survival analysis. We build on recent developments in conformal prediction and propose a novel calibration technique to construct a lower predictive bound (LPB) on the time-to-unsafe-sampling of a given prompt with rigorous coverage guarantees. Our key technical innovation is an optimized sampling-budget allocation scheme that improves sample efficiency while maintaining distribution-free guarantees. Experiments on both synthetic and real data support our theoretical results and demonstrate the practical utility of our method for safety risk assessment in generative AI models.
