Non-Exchangeable Conformal Language Generation with Nearest Neighbors

Dennis Ulmer, Chrysoula Zerva, André F. T. Martins
2/1/2024
cs.CLcs.AIcs.LG

No official code found. Best implementation: Kaleidophon/non-exchangeable-conformal-language-generation (10 stars, MIT, last commit 2025-09-26).

Abstract

Quantifying uncertainty in automatically generated text is important for letting humans check potential hallucinations and making systems more reliable. Conformal prediction is an attractive framework to provide predictions imbued with statistical guarantees, however, its application to text generation is challenging since any i.i.d. assumptions are not realistic. In this paper, we bridge this gap by leveraging recent results on non-exchangeable conformal prediction, which still ensures bounds on coverage. The result, non-exchangeable conformal nucleus sampling, is a novel extension of the conformal prediction framework to generation based on nearest neighbors. Our method can be used post-hoc for an arbitrary model without extra training and supplies token-level, calibrated prediction sets equipped with statistical guarantees. Experiments in machine translation and language modeling show encouraging results in generation quality. By also producing tighter prediction sets with good coverage, we thus give a more theoretically principled way to perform sampling with conformal guarantees.

View on arXivView PDF

Code Implementations(1)

MIT
102PythonFeb 15, 20231 years agoMIT

Similar Papers

Cite this paper

@article{ulmer2024nonexchangeable,
  title  = {Non-Exchangeable Conformal Language Generation with Nearest Neighbors},
  author = {Dennis Ulmer and Chrysoula Zerva and André F. T. Martins},
  year   = {2024},
  eprint = {2402.00707},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2402.00707v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2402.00707.svg)](https://codeofpaper.com/paper/2402.00707)

Discussion