Table of Contents
Fetching ...

Semantic Self-Distillation for Language Model Uncertainty

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

TL;DR

This work introducesSemantic Self-Distillation (SSD), a framework that distills a language model’s sampled semantic answer distribution into a lightweight conditional density estimator (an MDN) conditioned on a prompt representation. SSD provides a closed-form, sampling-free uncertainty object whose entropy $H_2$ serves as a pre-generation risk signal, while its posterior likelihood supports post-generation verification and out-of-domain detection, and its mixture mean enables single-pass semantic consensus. Empirical results on TriviaQA show SSD often matches or surpasses finite-sample semantic dispersion in hallucination detection and offers strong OOD and verification signals, with performance limited primarily by distillation fidelity and the richness of prompt representations. SSD thus offers a practical, generalizable approach to principled uncertainty quantification in complex, high-dimensional output spaces without incurring inference-time sampling costs, with potential applicability to diffusion models and domain-specific tasks. Overall, SSD demonstrates that distilling predictive distributions, not scalar scores, yields robust, low-latency uncertainty signals for reliable, latency-sensitive AI systems.

Abstract

Large language models present challenges for principled uncertainty quantification, in part due to their complexity and the diversity of their outputs. Semantic dispersion, or the variance in the meaning of sampled answers, has been proposed as a useful proxy for model uncertainty, but the associated computational cost prohibits its use in latency-critical applications. We show that sampled semantic distributions can be distilled into lightweight student models which estimate a prompt-conditioned uncertainty before the language model generates an answer token. The student model predicts a semantic distribution over possible answers; the entropy of this distribution provides an effective uncertainty signal for hallucination prediction, and the probability density allows candidate answers to be evaluated for reliability. On TriviaQA, our student models match or outperform finite-sample semantic dispersion for hallucination prediction and provide a strong signal for out-of-domain answer detection. We term this technique Semantic Self-Distillation (SSD), which we suggest provides a general framework for distilling predictive uncertainty in complex output spaces beyond language.

Semantic Self-Distillation for Language Model Uncertainty

TL;DR

This work introducesSemantic Self-Distillation (SSD), a framework that distills a language model’s sampled semantic answer distribution into a lightweight conditional density estimator (an MDN) conditioned on a prompt representation. SSD provides a closed-form, sampling-free uncertainty object whose entropy serves as a pre-generation risk signal, while its posterior likelihood supports post-generation verification and out-of-domain detection, and its mixture mean enables single-pass semantic consensus. Empirical results on TriviaQA show SSD often matches or surpasses finite-sample semantic dispersion in hallucination detection and offers strong OOD and verification signals, with performance limited primarily by distillation fidelity and the richness of prompt representations. SSD thus offers a practical, generalizable approach to principled uncertainty quantification in complex, high-dimensional output spaces without incurring inference-time sampling costs, with potential applicability to diffusion models and domain-specific tasks. Overall, SSD demonstrates that distilling predictive distributions, not scalar scores, yields robust, low-latency uncertainty signals for reliable, latency-sensitive AI systems.

Abstract

Large language models present challenges for principled uncertainty quantification, in part due to their complexity and the diversity of their outputs. Semantic dispersion, or the variance in the meaning of sampled answers, has been proposed as a useful proxy for model uncertainty, but the associated computational cost prohibits its use in latency-critical applications. We show that sampled semantic distributions can be distilled into lightweight student models which estimate a prompt-conditioned uncertainty before the language model generates an answer token. The student model predicts a semantic distribution over possible answers; the entropy of this distribution provides an effective uncertainty signal for hallucination prediction, and the probability density allows candidate answers to be evaluated for reliability. On TriviaQA, our student models match or outperform finite-sample semantic dispersion for hallucination prediction and provide a strong signal for out-of-domain answer detection. We term this technique Semantic Self-Distillation (SSD), which we suggest provides a general framework for distilling predictive uncertainty in complex output spaces beyond language.
Paper Structure (34 sections, 14 equations, 4 figures, 9 tables)

This paper contains 34 sections, 14 equations, 4 figures, 9 tables.

Figures (4)

  • Figure 1: Overview of Semantic Self-Distillation (SSD). (A) Training: For each prompt, a hidden representation $\mathbf{h}$ conditions a student that distils sampled answer embeddings into a semantic mixture distribution. (B-D) Inference: The predicted density supports pre-generation hallucination prediction via entropy, post-generation context verification via likelihood, and semantic consensus estimation via the mixture mean. Plots illustrate the semantic embedding space, where points denote sampled answers and the mixture mean represents the model’s semantic consensus.
  • Figure 2: Distillation fidelity drives detection performance. The X-axis shows distillation fidelity ($\rho_{\text{fidelity}}$): the Spearman correlation between the student's predicted entropy and the teacher dispersion across test prompts. Multiple points per model correspond to different student hyperparameter settings. $\rho_{\text{meta}}$ is the Spearman correlation between the X and Y variables; it shows that models where the student fails to learn the distribution (low $\rho_{\text{fidelity}}$) result in poor detection.
  • Figure 3: As PCA dimension increases, the semantic resolution improves and the teacher dispersion baseline rises. The distillation task however becomes harder, causing SSD performance to fall.
  • Figure 4: Student capacity ablation, averaged across all seven models investigated.