Semantic Self-Distillation for Language Model Uncertainty

Edward Phillips, Sean Wu, Boyan Gao, David A. Clifton

TL;DR

This paper introduces Semantic Self-Distillation (SSD), a novel method to distill the uncertainty of large language models (LLMs) into a lightweight student model. SSD enables efficient, real-time uncertainty estimation for LLMs, crucial for high-stakes applications, by predicting a semantic distribution over possible answers rather than a simple scalar score.

What Problem Does This Paper Address?

Large language models (LLMs) are increasingly used in critical domains, making it essential to quantify their uncertainty. A promising proxy for this uncertainty is "semantic dispersion," which measures how much the meaning of different answers generated by an LLM for the same prompt varies. However, calculating semantic dispersion typically involves generating multiple answers (sampling), which is computationally expensive and too slow for latency-critical applications. Existing "probing" methods, which use lightweight models to predict uncertainty, often collapse this rich semantic information into a single scalar value, limiting their usefulness. This paper aims to bridge this gap by creating an efficient method that captures the full semantic distribution of LLM outputs for uncertainty quantification.

Methods

The core of Semantic Self-Distillation (SSD) is a two-stage process:

  1. Training: For each prompt, the LLM generates several sampled answers. These answers are then embedded into a semantic space. A lightweight "student" model (specifically, a Mixture Density Network or MDN) is trained to predict a distribution over these semantic embeddings, conditioned on the prompt's internal representation. This process distills the LLM's sampled semantic uncertainty into a compact, prompt-conditioned density estimator.
  2. Inference: At inference time, the trained student model can predict this semantic distribution in a single forward pass. This distribution provides several uncertainty signals:
  3. Prompt-level uncertainty: The entropy of the predicted distribution offers a pre-generation risk score, useful for tasks like hallucination prediction.
  4. Answer-level reliability: The likelihood of a candidate answer's embedding under the predicted distribution allows for post-generation verification, such as detecting out-of-domain answers or selecting the best option in multiple-choice scenarios.

Datasets

The authors evaluated SSD on two datasets:

  • TriviaQA: A knowledge-seeking question-answering dataset.
  • MMLU (Massive Multitask Language Understanding): A benchmark for evaluating LLMs across a wide range of tasks, used here with a filtered subset of open-ended questions.

Key Insights and Ideas

  • Distilling Distributions, Not Just Scalars: The key innovation is distilling the entire semantic distribution of LLM outputs, not just a single uncertainty score. This richer representation unlocks more sophisticated downstream applications.
  • Analytic Uncertainty for Speed: By using an MDN and specific entropy measures (Rényi-2), SSD can compute uncertainty signals analytically, avoiding the need for additional sampling at inference time. This makes it as fast as simple probing methods.
  • Semantic Consensus: The mean of the predicted mixture distribution can serve as a proxy for semantic consensus, helping to identify answers that deviate from the model's typical understanding.
  • Capacity Saturation: Increasing the capacity of the student model (e.g., more mixture components, wider/deeper networks) showed diminishing returns, suggesting that the information available in the prompt representation is the primary bottleneck for distillation fidelity.

Key Results

  • Hallucination Prediction: SSD achieved competitive performance in predicting hallucinations, often matching or exceeding sampling-based baselines and offering similar latency to single-pass probes. On TriviaQA, it outperformed the teacher dispersion baseline in AUPRC for all models.
  • Out-of-Domain Detection: The SSD's predicted likelihood score was a strong signal for detecting mismatched prompt-answer pairs, achieving AUROCs above 0.95 on both TriviaQA and MMLU.
  • Multiple-Choice Answer Selection: SSD could effectively rank candidate answers in multiple-choice settings, approaching the accuracy of the base LLM's open-ended generation.
  • Efficiency: SSD offers a single-pass inference time, making it suitable for latency-sensitive applications, unlike traditional sampling-based methods.

Limitations and Future Work

  • Distillation Fidelity: The performance of SSD is strongly correlated with how well the student model can reconstruct the teacher's sampled distribution from the prompt representation alone. For some models, this distillation is more challenging, leading to lower performance. Future work could explore richer prompt representations or stronger teachers.
  • Model Dependence: Performance varies across different LLM families, suggesting that the way semantic uncertainty is encoded in internal activations differs.
  • Integrating Signals: The authors suggest integrating the pre-generation (entropy) and post-generation (likelihood) signals into unified decision policies for LLM-based systems.
  • Broader Applications: SSD is presented as a general framework and could be extended to other domains beyond language, such as diffusion models or electronic health record foundation models.

Summary updated

BibTeX
@inproceedings{phillips2026semantic,
  author = {Edward Phillips and Sean Wu and Boyan Gao and David A. Clifton},
  title = {{Semantic Self-Distillation for Language Model Uncertainty}},
  booktitle = {Reliable Autonomy @ ICLR},
  year = {2026},
  url = {https://openreview.net/forum?id=beba1CP97r},
}
Figure