Length Optimization in Conformal Prediction

Shayan Kiyani, George J. Pappas, Hamed Hassani · DOI · OpenReview

TL;DR

This paper introduces Conformal Prediction with Length-Optimization (CPL), a novel framework that constructs prediction sets that are both conditionally valid and near-optimally short. CPL addresses a fundamental trade-off in conformal prediction, offering a principled approach to achieve informative uncertainty quantification across various covariate shift scenarios.

What Problem Does This Paper Address?

Conformal prediction (CP) aims to provide reliable uncertainty estimates by constructing prediction sets that are guaranteed to contain the true label with a certain probability. However, CP faces two major challenges:

  1. Conditional Validity: Simple marginal coverage guarantees (e.g., the prediction set contains the true label 90% of the time) are often insufficient. We need guarantees that hold across different subpopulations or under covariate shifts. Achieving "full conditional coverage" (i.e., coverage for every specific input x) is generally impossible with finite data.
  2. Length Inefficiency: Even when conditional validity is achieved, the prediction sets can be unnecessarily large, making them less informative. This is a critical issue in applications where precise predictions are crucial.

Existing methods often struggle to balance these two objectives, leading to either valid but overly large sets or more efficient sets that sacrifice validity. This paper seeks to bridge this gap by developing a framework that explicitly optimizes for prediction set length while maintaining conditional validity.

Methods

The core of this paper is the development of a unified framework for length optimization under coverage constraints. The authors propose Conformal Prediction with Length-Optimization (CPL). Key aspects of their approach include:

  • Minimax Formulation: They frame the problem as a minimax optimization problem. The outer minimization ensures conditional validity with respect to a class of covariate shifts, while the inner maximization seeks to minimize prediction set length.
  • Relaxed Minimax Formulation: To make the problem tractable, they relax the inner maximization to consider "structured prediction sets" of the form $C(x) = \{y \in Y \mid S(x, y) \le h(x)\}$, where $S(x, y)$ is a conformity score and $h(x)$ is an adaptive threshold function learned from data.
  • Adaptive Thresholding: A key insight is learning an adaptive threshold $h(x)$ that depends on the covariate $x$. This allows for more precise length optimization compared to fixed thresholds.
  • Theoretical Guarantees: The paper provides theoretical guarantees for CPL, showing that it achieves conditional validity up to a finite-sample error and approaches optimal length in the infinite-sample regime. They leverage duality theory and minimax optimization to establish these results.
  • Algorithm: CPL is implemented as an iterative optimization procedure that jointly optimizes the threshold function $h$ and the parameters defining the covariate shift class $f$.

Datasets

The paper evaluates CPL on a variety of datasets across different domains:

  • Real-world Regression: 11 datasets were used to evaluate marginal coverage and length efficiency.
  • Multiple Choice Text Data: Datasets like TruthfulQA, MMLU, OpenBookQA, PIQA, and BigBench were used to evaluate uncertainty quantification for Large Language Models (LLMs).
  • Synthetic Regression: A synthetic dataset was used to specifically test group-conditional coverage.
  • Image Classification: The RxRx1 dataset was used to evaluate coverage with respect to a general class of covariate shifts.

No new benchmarks were introduced; instead, the paper focuses on evaluating CPL against existing methods on established datasets.

Key Insights and Ideas

  • The Trade-off is Quantifiable: The paper demonstrates that the interaction between conditional validity and length efficiency can be formally captured through a minimax optimization framework.
  • Covariate-Aware Thresholding is Crucial: Learning an adaptive threshold $h(x)$ that depends on the covariate $x$ is key to achieving significant improvements in length efficiency while maintaining validity. This allows prediction sets to be tailored to different regions of the input space.
  • Duality as a Unifying Principle: The use of duality theory provides a powerful lens to understand and derive optimal solutions for conformal prediction problems, connecting length optimization with level set estimation.
  • Practical Framework for Real-World Use: CPL is presented as a practical algorithm that can be applied to existing conformity scores and machine learning models, offering a way to improve existing CP pipelines.

Key Results

  • Superior Length Efficiency: CPL consistently achieves significantly smaller prediction set sizes (lengths) compared to state-of-the-art methods across regression, LLM-based question answering, and classification tasks. For instance, in regression, CPL achieved an average length of 1.16 compared to 1.32 for CQR+Jacknife.
  • Maintained Conditional Validity: Despite improving length efficiency, CPL maintains comparable levels of conditional validity to existing methods, including those specifically designed for group-conditional or covariate-shift-aware coverage.
  • Effective for LLMs: CPL shows promise in quantifying uncertainty for LLMs, producing smaller prediction sets while ensuring proper coverage for multiple-choice question answering tasks.
  • Generalizability: The framework demonstrates effectiveness across diverse data modalities and tasks, including regression, classification, and text-based applications.

Limitations and Future Work

  • Finite-Dimensional Covariate Shifts: The current theoretical framework primarily handles conditional validity with respect to finite-dimensional classes of covariate shifts. Extending this to infinite-dimensional classes is a direction for future work.
  • Length Optimality in Finite Samples: While theoretical guarantees are provided, achieving exact length optimality in the finite-sample regime remains challenging due to the breakdown of strong duality assumptions.
  • "Length Stability": The paper suggests exploring the concept of "length stability" for prediction sets, which is a future research direction.
  • Theoretical Framework for Length Optimality: Developing a more detailed theoretical framework to address length optimality in the finite-sample regime is also proposed.

Summary updated

BibTeX
@inproceedings{kiyani2024length,
  author = {Shayan Kiyani and George J. Pappas and Hamed Hassani},
  title = {{Length Optimization in Conformal Prediction}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=E4ILjwzdEA},
}
Figure