TL;DR
Language models (LMs) are prone to hallucinations, making uncertainty quantification critical but mathematically difficult due to the infinite number of possible text outputs. This paper introduces a novel approach to conformal prediction for LMs that provides mathematical guarantees that a generated set of responses—or specific sentences within them—contains at least one correct answer. It achieves this by calibrating a dynamic sampling and rejection process, bypassing the impossible task of enumerating all possible text sequences.
The Challenge of Conformal Prediction for LMs
Conformal prediction is a popular, model-agnostic framework used to create "prediction sets" that are mathematically guaranteed to contain the true answer with a high probability (e.g., 95%). However, applying standard conformal prediction to generative LMs is practically impossible.
Standard conformal prediction requires enumerating and scoring every possible output. For a standard classification task with 10 classes, this is trivial. But for an LM, the output space is every possible sequence of text—an unbounded, combinatorial explosion. Furthermore, evaluating long-form text isn't a simple binary of "right" or "wrong"; a generated paragraph might be mostly factual but contain one hallucinated sentence. The authors tackle the challenge of providing rigorous, distribution-free confidence guarantees for free-text generation without needing to search an infinite output space.
Proposed Method: Dynamic Sampling and Rejection
To bridge the gap between conformal prediction and LMs, the authors flip the script: instead of filtering the entire output space, they calibrate a randomized sampling algorithm.
The core process involves the following steps:
- Sample & Reject: The algorithm repeatedly samples candidate responses from a black-box LM. It immediately rejects samples that are too similar to previous ones (to ensure diversity) or have an estimated quality that is too low (e.g., based on the LM's log-likelihood).
- Stopping Rule: The system maintains a running "set confidence score" as new samples are added. Once this score hits a calibrated threshold, the sampling terminates.
- Learn Then Test (LTT): The authors use the LTT framework on a calibration dataset to find the exact hyperparameters (thresholds for similarity, quality, and stopping) that mathematically guarantee the final set contains at least one "acceptable" response with a user-specified probability.
Recognizing that full generations can be verbose, they also extend their method to sub-components. They parse long outputs into individual sentences and use an auxiliary model to score them. This allows the system to highlight specific sentences that are independently guaranteed to be correct, even if the overall summary contains flaws.
Experimental Setup
The authors evaluated their method across three diverse NLP tasks:
- MIMIC-CXR: Chest X-ray radiology report generation. Evaluated using an auxiliary CheXbert model to check if the clinical findings match a human reference.
- CNN/DM (CNN/Daily Mail): News article summarization. Evaluated using ROUGE-L against human references.
- TriviaQA: Open-domain question answering. Evaluated using exact string matching.
Key Insights and Results
- Sampling as a proxy for search: You can bypass the infinite output space problem of LMs by treating conformal prediction as a dynamic sampling problem. Calibrating when to stop sampling is a highly effective alternative to calibrating a threshold over all possible answers.
- Rejection is key for precision: Just sampling until you hit a good answer creates bloated, unwieldy prediction sets. By simultaneously calibrating a rejection rule (dropping redundant or low-confidence samples), the resulting sets remain tight, precise, and practical for end-users.
- Valid Risk Control: Across all three tasks (radiology, summarization, QA), the method successfully bounded the error rate to the user-specified targets without violating the mathematical guarantees.
- High Efficiency: Using likelihood-based scoring functions (like taking the maximum or sum of sample probabilities) drastically outperformed a naive baseline of just taking the first $K$ samples. For example, in TriviaQA, the expected set size for these scoring methods was less than half the size of the baseline while maintaining the exact same statistical guarantees.
- Component Superiority: When selecting trustworthy sub-components (sentences), using an application-specific auxiliary classifier (like a Natural Language Inference model) yielded much larger, more useful sets of guaranteed sentences compared to just relying on the base LM's internal token probabilities.
Limitations and Future Work
- I.I.D. Assumption: The mathematical guarantees rely on the calibration and test data coming from the same distribution. The current method does not natively handle distribution shifts or multi-turn dialogue where prompts depend on previous turns.
- Admission Function Dependency: The system requires a reliable "admission function" to judge if a text is acceptable during calibration. If the automated metric used for this (like ROUGE or CheXbert) is flawed, the real-world value of the guarantee is weakened.
- Compute Limits: If the underlying LM is very poor, or the maximum allowed sampling budget ($k_{max}$) is too low, the algorithm might fail to find a valid configuration that meets the user's strict error tolerance, resulting in the system abstaining from making a prediction. Future work could explore integrating better base models or higher-signal confidence metrics to improve yield.
Summary updated