<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Semantic-Entropy on Synaptic Radio</title><link>https://synapticradio.com/tags/semantic-entropy/</link><description>Recent content in Semantic-Entropy on Synaptic Radio</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><managingEditor>anshuman264@gmail.com (Anshuman Sahoo)</managingEditor><webMaster>anshuman264@gmail.com (Anshuman Sahoo)</webMaster><copyright>Anshuman Sahoo</copyright><lastBuildDate>Thu, 03 Sep 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://synapticradio.com/tags/semantic-entropy/index.xml" rel="self" type="application/rss+xml"/><item><title>Semantic Entropy for LLM Confidence</title><link>https://synapticradio.com/post/semantic-entropy-llm-calibration/</link><pubDate>Thu, 03 Sep 2026 00:00:00 +0000</pubDate><author>anshuman264@gmail.com (Anshuman Sahoo)</author><guid>https://synapticradio.com/post/semantic-entropy-llm-calibration/</guid><description>&lt;img src="https://synapticradio.com/post/semantic-entropy-llm-calibration/cover.svg" alt="Featured image of post Semantic Entropy for LLM Confidence" />&lt;p>&lt;strong>Semantic entropy&lt;/strong> measures uncertainty across the meanings of an LLM&amp;rsquo;s
answers. It samples several answers, groups equivalent answers by meaning, and
measures how much probability is spread across the resulting groups. Unlike
token-level entropy, it does not treat harmless wording changes as different
answers.&lt;/p>
&lt;p>Semantic entropy is an uncertainty signal, not a calibrated probability of
correctness. A supervised calibration step is required before a system can
claim that an answer is, for example, 80% likely to be correct.&lt;/p>
&lt;h2 id="the-problem-with-entropy-over-strings">The problem with entropy over strings
&lt;/h2>&lt;p>An autoregressive LLM assigns probability to a sequence of tokens:&lt;/p>
$$
P(s\mid x)=\prod_i P(t_i\mid x,t_{\lt i}).
$$&lt;p>Sequence probability distinguishes every wording. For the question &amp;ldquo;What is the
capital of France?&amp;rdquo;, an LLM might generate:&lt;/p>
&lt;ul>
&lt;li>&lt;code>Paris.&lt;/code>&lt;/li>
&lt;li>&lt;code>The capital is Paris.&lt;/code>&lt;/li>
&lt;li>&lt;code>France's capital city is Paris.&lt;/code>&lt;/li>
&lt;/ul>
&lt;p>Their token sequences differ, but their factual content does not. Entropy over
strings mixes two kinds of variation:&lt;/p>
&lt;ol>
&lt;li>&lt;strong>Lexical uncertainty:&lt;/strong> which words should express the answer?&lt;/li>
&lt;li>&lt;strong>Semantic uncertainty:&lt;/strong> which answer is actually meant?&lt;/li>
&lt;/ol>
&lt;p>Semantic entropy reduces lexical variation by placing answers that entail each
other in both directions in the same semantic equivalence class. The method was
introduced by &lt;a class="link" href="https://openreview.net/forum?id=VD-AYtP0dve" target="_blank" rel="noopener"
>Kuhn et al.&lt;/a> and extended by &lt;a class="link" href="https://www.nature.com/articles/s41586-024-07421-0" target="_blank" rel="noopener"
>Farquhar et
al.&lt;/a>.&lt;/p>
&lt;p>&lt;img src="https://synapticradio.com/post/semantic-entropy-llm-calibration/figures/string-vs-semantic-entropy.svg"
loading="lazy"
alt="String entropy treats paraphrases as different outcomes, while semantic entropy groups them by meaning"
>&lt;/p>
&lt;h2 id="a-worked-example">A worked example
&lt;/h2>&lt;p>Five independent samples answer &amp;ldquo;What caused the worker failure?&amp;rdquo;:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: right">Sample&lt;/th>
&lt;th>Answer&lt;/th>
&lt;th>Semantic cluster&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: right">1&lt;/td>
&lt;td>&lt;code>A memory leak.&lt;/code>&lt;/td>
&lt;td>Memory failure&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: right">2&lt;/td>
&lt;td>&lt;code>The worker ran out of memory.&lt;/code>&lt;/td>
&lt;td>Memory failure&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: right">3&lt;/td>
&lt;td>&lt;code>An OOM condition.&lt;/code>&lt;/td>
&lt;td>Memory failure&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: right">4&lt;/td>
&lt;td>&lt;code>Memory exhaustion.&lt;/code>&lt;/td>
&lt;td>Memory failure&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: right">5&lt;/td>
&lt;td>&lt;code>A network timeout.&lt;/code>&lt;/td>
&lt;td>Network failure&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>With equal sample weights, string entropy counts five distinct outcomes:&lt;/p>
$$
H_{\text{string}}=-5\left(\frac{1}{5}\log\frac{1}{5}\right)
=\log 5
\approx1.609\ \text{nats}.
$$&lt;p>Discrete semantic entropy counts two meanings and estimates their probabilities
from sample frequency:&lt;/p>
$$
q_{\text{memory}}=\frac{4}{5}=0.8,
\qquad
q_{\text{network}}=\frac{1}{5}=0.2.
$$&lt;p>The entropy over meanings is therefore:&lt;/p>
$$
\begin{aligned}
H_{\text{sem}}
&amp;=-\sum_k q_k\log q_k \\
&amp;=-\left(0.8\log0.8+0.2\log0.2\right) \\
&amp;\approx0.500\ \text{nats}.
\end{aligned}
$$&lt;p>The semantic entropy is lower because four differently worded answers agree on
one cause. It remains above zero because one sample proposes a different cause.&lt;/p>
&lt;h2 id="the-technique-step-by-step">The technique step by step
&lt;/h2>&lt;p>Compute semantic entropy in four stages.&lt;/p>
&lt;ol>
&lt;li>
&lt;p>&lt;strong>Sample answers.&lt;/strong> Draw $M$ responses from a fixed model, prompt, decoding
temperature, and answer format. The Nature experiments used ten generations
for their sentence-length evaluations. &lt;a class="link" href="https://www.nature.com/articles/s41586-024-07421-0" target="_blank" rel="noopener"
>Farquhar et al.&lt;/a>&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Cluster meanings.&lt;/strong> Compare answers in the context of the question. Put two
answers together when each entails the other. An NLI model or an LLM judge can
perform this bidirectional entailment test.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Estimate cluster mass.&lt;/strong> For black-box models, use the fraction of samples
in each cluster, $q_k=n_k/M$. When sequence probabilities are available, the
theoretical mass of a cluster $C_k$ is:&lt;/p>
$$
P(C_k\mid x)=\sum_{s\in C_k}P(s\mid x).
$$&lt;p>A sampled implementation estimates these masses and renormalizes them across
the observed clusters. Length normalization is often used to reduce the bias
against longer answers, but it is an implementation assumption that must stay
fixed during evaluation.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>Compute entropy.&lt;/strong> For normalized cluster masses $q_1,\ldots,q_K$:&lt;/p>
$$
\boxed{
H_{\text{sem}}(x)=-\sum_{k=1}^{K}q_k\log q_k
}
$$&lt;/li>
&lt;/ol>
&lt;p>Low semantic entropy means the samples concentrate on one meaning. High semantic
entropy means several meanings retain substantial mass.&lt;/p>
&lt;p>&lt;img src="https://synapticradio.com/post/semantic-entropy-llm-calibration/figures/semantic-entropy-pipeline.svg"
loading="lazy"
alt="The semantic entropy pipeline samples answers, clusters meanings, aggregates cluster mass, and computes entropy"
>&lt;/p>
&lt;h2 id="entropy-is-not-calibrated-confidence">Entropy is not calibrated confidence
&lt;/h2>&lt;p>An entropy of $0.50$ nats does &lt;strong>not&lt;/strong> mean a 50% chance of error. Entropy has a
different range and meaning: its maximum is $\log K$ for $K$ equally likely
semantic clusters, and the observed value also depends on sample count and the
decoding policy.&lt;/p>
&lt;p>Evaluate raw semantic entropy as an uncertainty ranking: do high-entropy answers
fail more often than low-entropy answers? AUROC, risk-coverage curves, and
rank-calibration measure this ordering without treating the score as a
probability. &lt;a class="link" href="https://aclanthology.org/2024.emnlp-main.18/" target="_blank" rel="noopener"
>Huang et al.&lt;/a> explain why uncertainty measures
on incompatible scales require rank-based evaluation.&lt;/p>
&lt;p>To obtain a probability, collect a labeled calibration set. For each prompt,
compute semantic entropy $H_i$ and record whether the selected answer is correct:&lt;/p>
$$
y_i=
\begin{cases}
1 &amp; \text{answer correct},\\
0 &amp; \text{answer incorrect}.
\end{cases}
$$&lt;p>Fit a non-increasing mapping $g$ from entropy to correctness:&lt;/p>
$$
\hat p_i=g(H_i)
\approx P(y_i=1\mid H_i),
\qquad
\frac{dg}{dH}\leq0.
$$&lt;p>Use logistic calibration for a compact parametric mapping or isotonic regression
for a more flexible mapping when enough labeled data are available. Evaluate the
fitted probabilities on a separate test set with a reliability diagram, Brier
score, ECE, and the operating risk-coverage curve. The &lt;a class="link" href="https://synapticradio.com/post/model-calibration-in-llms/" >model calibration
guide&lt;/a> explains these diagnostics.&lt;/p>
&lt;p>&lt;img src="https://synapticradio.com/post/semantic-entropy-llm-calibration/figures/entropy-to-calibrated-confidence.svg"
loading="lazy"
alt="Semantic entropy becomes operational confidence only after a labeled calibrator maps entropy to probability of correctness"
>&lt;/p>
&lt;h2 id="what-the-evidence-shows">What the evidence shows
&lt;/h2>&lt;p>Semantic entropy outperformed the compared uncertainty baselines in the original
ICLR experiments. &lt;a class="link" href="https://openreview.net/forum?id=VD-AYtP0dve" target="_blank" rel="noopener"
>Kuhn et al.&lt;/a> found it more predictive
of question-answer accuracy across their evaluated datasets and models. The 2024
Nature study tested sentence-length answers across five datasets and multiple 7B
to 70B model families. Averaged over 30 task-model combinations, it reported an
AUROC of 0.790 for semantic entropy, compared with 0.691 for naive entropy, 0.698
for $P(\mathrm{True})$, and 0.687 for an embedding regression baseline. Its
discrete, frequency-based variant performed similarly without requiring token
probabilities. These results apply to the studied setups and are not a universal
performance guarantee. &lt;a class="link" href="https://www.nature.com/articles/s41586-024-07421-0" target="_blank" rel="noopener"
>Farquhar et al.&lt;/a>&lt;/p>
&lt;p>Sampling is the main cost. Semantic entropy normally requires several additional
generations plus semantic comparisons. &lt;a class="link" href="https://arxiv.org/abs/2406.15927" target="_blank" rel="noopener"
>Kossen et al.&lt;/a>
report a 5 to 10 times generation-cost increase for the sampling method and
propose hidden-state probes that approximate semantic entropy from one
generation. Those probes trade repeated inference for a trained, white-box
component.&lt;/p>
&lt;h2 id="failure-modes">Failure modes
&lt;/h2>&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Failure mode&lt;/th>
&lt;th>Why it matters&lt;/th>
&lt;th>Practical response&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>Consistently wrong answers&lt;/td>
&lt;td>Every sample can repeat the same misconception, producing low entropy.&lt;/td>
&lt;td>Combine semantic entropy with retrieval, evidence checks, or an external verifier.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Bad semantic clusters&lt;/td>
&lt;td>Entailment models can merge distinct answers or split harmless paraphrases.&lt;/td>
&lt;td>Test clustering on domain examples and include the original question in every comparison.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Unstable sampling policy&lt;/td>
&lt;td>Temperature, answer length, and $M$ change the entropy distribution.&lt;/td>
&lt;td>Freeze these choices before fitting the calibrator.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Long, multi-claim answers&lt;/td>
&lt;td>A paragraph can agree on one claim and disagree on another.&lt;/td>
&lt;td>Decompose the response into atomic claims and score each claim separately.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Distribution shift&lt;/td>
&lt;td>The entropy-to-correctness mapping can change across tasks or model versions.&lt;/td>
&lt;td>Monitor reliability by slice and recalibrate after material changes.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>Semantic entropy detects &lt;strong>confabulations&lt;/strong>: unstable answers that produce
different meanings across samples. It does not detect a systematic falsehood
that the model repeats consistently. For long passages, evaluate individual
factual claims rather than the entire response. The Nature paper extracts
claims, generates a focused question for each claim, and computes semantic
entropy on the resulting answers.&lt;/p>
&lt;h2 id="a-practical-recipe">A practical recipe
&lt;/h2>&lt;p>Use this production evaluation procedure:&lt;/p>
&lt;ol>
&lt;li>Define one observable event, such as &amp;ldquo;the answer is factually correct.&amp;rdquo;&lt;/li>
&lt;li>Create disjoint calibration and test sets with trustworthy correctness labels.&lt;/li>
&lt;li>Sample 5 to 10 concise answers per prompt under a frozen decoding policy.&lt;/li>
&lt;li>Cluster answers with bidirectional entailment and compute discrete semantic
entropy first; add likelihood weighting only if it improves held-out results.&lt;/li>
&lt;li>Fit a non-increasing entropy-to-correctness map on the calibration split.&lt;/li>
&lt;li>On the test split, report both ranking quality and probability calibration.&lt;/li>
&lt;li>Set answer, retrieve, verify, or abstain thresholds from the cost of errors.&lt;/li>
&lt;/ol>
&lt;p>Use semantic entropy for open-ended questions where many strings can express the
same answer. Use normalized choice probabilities for constrained multiple-choice
tasks. For source-grounded or high-stakes claims, combine semantic entropy with
evidence verification.&lt;/p>
&lt;h2 id="bottom-line">Bottom line
&lt;/h2>&lt;p>Semantic entropy measures agreement in meaning:&lt;/p>
&lt;blockquote>
&lt;p>Do repeated generations agree on the meaning?&lt;/p>&lt;/blockquote>
&lt;p>Probability calibration measures whether stated confidence matches accuracy:&lt;/p>
&lt;blockquote>
&lt;p>When the system reports 80% confidence, is it correct about 80% of the time?&lt;/p>&lt;/blockquote>
&lt;p>Use semantic entropy to build the uncertainty signal. Use labeled calibration to
turn that signal into a probability a decision system can safely interpret.&lt;/p>
&lt;h2 id="references">References
&lt;/h2>&lt;ul>
&lt;li>Kuhn, Gal, and Farquhar, &lt;a class="link" href="https://openreview.net/forum?id=VD-AYtP0dve" target="_blank" rel="noopener"
>&lt;em>Semantic Uncertainty: Linguistic Invariances for Uncertainty Estimation in Natural Language Generation&lt;/em>&lt;/a> (ICLR 2023).&lt;/li>
&lt;li>Farquhar et al., &lt;a class="link" href="https://www.nature.com/articles/s41586-024-07421-0" target="_blank" rel="noopener"
>&lt;em>Detecting Hallucinations in Large Language Models Using Semantic Entropy&lt;/em>&lt;/a> (Nature, 2024).&lt;/li>
&lt;li>Huang et al., &lt;a class="link" href="https://aclanthology.org/2024.emnlp-main.18/" target="_blank" rel="noopener"
>&lt;em>Uncertainty in Language Models: Assessment through Rank-Calibration&lt;/em>&lt;/a> (EMNLP 2024).&lt;/li>
&lt;li>Kossen et al., &lt;a class="link" href="https://arxiv.org/abs/2406.15927" target="_blank" rel="noopener"
>&lt;em>Semantic Entropy Probes: Robust and Cheap Hallucination Detection in LLMs&lt;/em>&lt;/a> (2024).&lt;/li>
&lt;/ul></description></item></channel></rss>