Skip to content

Menu

WorksComputer Science

Bayesian Entropy-based Reordering for Calibrated Diffusion Language Models

Download PDFView on arXiv

Ask your agent about this work

Your agent reads this work through Valency, with its citations and similar works. Paste this at the start of a chat.

Use the Valency MCP. Work: W_c84njz3b. Fetch it with get_paper_by_id, then find its nearest works with find_similar_papers and tell me what it adds.

Works with any MCP client. Not connected yet? Connect your agent

Abstract

Masked Diffusion Language Models (MDLMs) generate sequences by iteratively replacing masked tokens with model predictions. At each denoising step, the decoder chooses which positions are sufficiently confident to commit. Existing decoding methods typically rely on softmax confidence, which can be miscalibrated. We introduce BayesER (BAYESian Entropy-based Reordering), a post-hoc Bayesian decoding framework that uses predictive uncertainty to guide token commitment. In BayesER, we construct a lightweight approximate posterior centered at the pretrained checkpoint, similar to Laplace-LoRA but without training LoRA adapters. We average predictions over posterior samples and use predictive entropy to prioritize reliable positions. We examine how posterior predictions affect position ordering and token selection across benchmarks spanning code generation, mathematical reasoning, planning, and molecular generation. We show that BayesER reduces sequence-level calibration error while preserving or improving accuracy relative to common decoding schemes, including confidence-threshold decoding. Additionally, a posterior fitted on one code-generation dataset reduces calibration error on another without refitting, suggesting that Bayesian uncertainty may provide a transferable signal for more reliable MDLM decoding.

Introduction

Language models can make wrong predictions with high confidence. This failure is relatively prevalent, as users often mistake stylistic confidence for evidence without justified certainty. A confidence score should mean what it claims: predictions with confidence qq should be correct about a fraction qq of the time; this is known as calibration. Formally, if the model M is perfectly calibrated, the following holds: P(M’s prediction is correct∣M’s confidence is q)=qP(\text{M's prediction is correct} \mid\text{M's confidence is }q)=q, according to Guo et al. [6]. This definition of calibration does not eliminate hallucinations or reasoning errors common in modern language models. However, it makes uncertainty actionable, enabling a user or downstream system to decide whether to trust an answer, verify it, defer to a human, or abstain.

Calibration in masked diffusion language models (MDLMs) plays an unusually direct role. Unlike autoregressive models that generate tokens from left to right, MDLMs iteratively denoise a partially masked sequence. At each step, a bidirectional forward pass predicts a distribution over the vocabulary at every masked position, and the decoder selects a subset of these predictions to commit before continuing. This process enables parallel generation, arbitrary-order decoding, and infilling, and has recently scaled to models such as LLaDA and Dream (Nie et al. [17]; Ye et al. [26]). Consequently, confidence serves two distinct purposes in MDLMs: it should indicate whether the final sequence is likely correct (the usual confidence in the model’s prediction), and more interestingly, it can guide which token predictions are reliable enough to commit at a given time-step during generation. This creates a central decoding problem that does not arise in standard autoregressive generation: Which masked positions should be committed at each denoising step?

Committing many positions in parallel reduces model evaluations, but once committed, those tokens provide context for all subsequent tokens being unmasked at later denoising steps. Committing too conservatively avoids such problems but reduces the computational advantage of parallel decoding. The token commitment ordering therefore controls both generation quality and inference cost. Existing decoders commonly commit to the tokens at certain positions with the largest top-token probabilities or all positions whose confidence exceeds a fixed threshold [4, 23]. These rules are efficient and often effective, but they rely on the softmax distribution of a single parameter estimate. Neural networks are often overconfident [6], and point-estimate confidence does not reveal whether a prediction remains stable under model uncertainty.

In this paper, we investigate whether Bayesian predictive uncertainty provides a better signal for commitment ordering. Given an approximate posterior q(θ∣D)q(\theta\mid D) over model parameters θ\theta, the posterior predictive distribution over the output yy of a model averages token probabilities across posterior samples, given a noisy state xtx_t of the denoising process: pˉ(y∣xt)=Eθ∼q(θ∣D)[p(y∣xt,θ)]\bar{p}(y \mid x_t) = \mathbb{E}_{\theta\sim q(\theta\mid D)}[p(y \mid x_t, \theta)]. Its entropy, H(pˉ(y∣xt))H(\bar{p}(y \mid x_t)), measures the total uncertainty of the Bayesian prediction. Our method, BAYESER (BAYESian Entropy-based Reordering), is a post-hoc decoding framework for MDLMs that uses Bayesian predictive entropy. At each denoising step, BAYESER forms a posterior predictive distribution for every currently masked position, prioritizes positions with low posterior predictive entropy, selects tokens from the posterior predictive mean, and uses posterior confidence to determine how many positions to commit. In this way, BAYESER adjusts both the order and pace of decoding based on the Bayesian predictive distribution.

For typical MDLMs such as LLaDa [17] and Dream [26], with 7 billion parameters or more, identifying posterior distributions over all parameters is computationally challenging. Laplace-LoRA first fine-tunes LoRA adapters to obtain a task-specific maximum a posteriori solution and then approximates a posterior around the adapted model [24]. While appropriate for downstream adaptation, this procedure changes the mean predictor and makes it difficult to distinguish the benefit of Bayesian uncertainty from that of fine-tuning. We instead construct a curvature-only Laplace-LoRA posterior directly at the released checkpoint, without adapter training. The LoRA update is zero at the posterior mean, so the deterministic model is unchanged by construction. We fit the posterior covariance with training data, representing each block of a Hessian matrix using a Kronecker product of input and output-gradient second moments to reduce the cost of storing and expressing curvature.

Across several benchmark datasets spanning code generation, mathematical reasoning, planning, and molecule generation, BAYESER substantially reduces expected calibration error (ECE) while preserving—and in several settings improving—task accuracy relative to commonly used confidence-based decoding schemes. Our results show that prior precision and the number of Laplace-LoRA layers govern a three-way trade-off among calibration, task performance, and decoding cost. We further find that a posterior constructed on one code-generation dataset can reduce calibration error on another without refitting, hinting that the learned uncertainty signal may transfer across related tasks.

Background

We first describe background information on a common decoding scheme in MDLMs, Laplace-LoRA, and expected calibration error (ECE) for evaluating calibration performance.

Masked diffusion decoding

MDLMs generate text by repeatedly predicting and revealing masked tokens [19, 17, 26]. We denote a partially decoded, noisy sequence of length LL by xt(1:L)x_t^{(1:L)}, where xt(l)x_t^{(l)} is a one-hot vector of length ∣V∣|\mathcal{V}| (vocabulary size), representing the ll-th position of the sequence with one entry equaling 1 and the rest equaling zero. We also denote which position has masked tokens at time tt by Mt={l:xt(l)=[MASK]}M_t = \{l : x_t^{(l)} = [\mathrm{MASK}]\}. We denote a pre-trained model by fθ0f_{\theta_0} with fixed trained parameter values θ0\theta_0.

In MDLMs, at each time step tt, the trained model fθ0f_{\theta_0} outputs the token probability over the vocabulary for each position in the sequence: pθ0(l)(v∣xt(1:L))p_{\theta_0}^{(l)}(v \mid x_t^{(1:L)}). The base token is selected by choosing the argmax of this probability: y^t(l)=arg⁡max⁡vpθ0(l)(v∣xt(1:L))\hat{y}_t^{(l)} = \arg\max_v p_{\theta_0}^{(l)}(v \mid x_t^{(1:L)}) and confidence is: ct(l)=pθ0(l)(y^t(l)∣xt(1:L))c_t^{(l)} = p_{\theta_0}^{(l)}(\hat{y}_t^{(l)} \mid x_t^{(1:L)}). Confidence-based decoding. MDLMs commonly decode tokens via confidence-based decoding. Given a threshold τ\tau, at each denoising step tt, KtK_t most confident base tokens are selected by:

Kt=max⁡(1,∑ℓ∈Mt1{ct(ℓ)≥τ}),K_t = \max\left(1,\sum_{\ell\in\mathcal{M}_t}\mathbb{1}_{\{c_t^{(\ell)}\geq\tau\}}\right),

where 1\mathbb{1} is an indicator function which returns 1, if {ct(ℓ)≥τ}\{c_t^{(\ell)}\geq\tau\}, and returns 0, if not. The minimum of one ensures that at least one token is unmasked at a time.

Laplace-LoRA

LoRA (Low-Rank Adaptation) parameterizes the update of each of the QQ, KK, VV matrices of a transformer architecture at each layer through two low-rank matrices [8] (omitting the specification of QQ, KK, VV or layer index for simplicity): W=W0+αrBAW = W^0 + \frac{\alpha}{r}BA, with A∈Rr×dinA \in\mathbb{R}^{r\times d_{\mathrm{in}}} and B∈Rdout×rB \in\mathbb{R}^{d_{\mathrm{out}}\times r}, where rr is a rank of the low-rank matrices and α\alpha is a scaling hyper-parameter.

Laplace-LoRA To gain posterior uncertainty about the model, Laplace-LoRA first optimizes the LoRA adapter parameters AA and BB on downstream tasks, then places a Gaussian distribution over AA and BB, while keeping the underlying weights W0W^0 fixed [24]. Laplace-LoRA uses the Laplace approximation to estimate the covariance of the adapter parameters by learning the curvature of the negative log posterior at a posterior mode [14]. For decent-sized large language models, computing the exact curvature is intractable. Laplace-LoRA proposes two levels of approximations: (a) rather than computing the exact curvature, it uses the Fisher information,

F:=∑n=1NEy∼P(⋅∣fθ(xn))[∇θlog⁡P(y∣fθ(xn))(∇θlog⁡P(y∣fθ(xn)))⊤];F := \sum_{n=1}^{N}\mathbb{E}_{y\sim P(\cdot\mid f_\theta(x_n))}\left[\nabla_\theta\log P(y\mid f_\theta(x_n))\left(\nabla_\theta\log P(y\mid f_\theta(x_n))\right)^\top\right];

(b) furthermore, the Fisher information is computed on each linear layer separately using Kronecker-factored approximate curvature (KFAC), forming a block structure of the Fisher information matrix. KFAC represents each layer’s Fisher information using a Kronecker product of input covariance and output covariance, reducing the cost of storing and manipulating curvature [15, 18]. Our method, BAYESER, also specifies the curvature using these approximations, but without fine-tuning adapters, but at a fixed checkpoint as shown in § 3.1.

Calibration and sequence-level confidence

Expected calibration error (ECE) [16] measures how well the model’s prediction accuracy matches its confidence. Large ECE indicates a mismatch between confidence and accuracy, reflecting overconfidence or underconfidence. With NN number of samples, predicted labels y^n\hat{y}_n for each sample nn, and true label yny_n, ECE groups confidences into MM bins (each bin is Bm\mathcal{B}_m) and measures

ECE=∑m=1M∣Bm∣N∣acc(Bm)−conf(Bm)∣.(1)ECE = \sum_{m=1}^{M}\frac{|\mathcal{B}_m|}{N}\left|acc(\mathcal{B}_m)-conf(\mathcal{B}_m)\right|. \tag*{(1)}

where acc(Bm)=1∣Bm∣∑n∈Bm1(y^n=yn)acc(\mathcal{B}_m)=\frac{1}{|\mathcal{B}_m|}\sum_{n\in\mathcal{B}_m}\mathbb{1}(\hat{y}_n=y_n), conf(Bm)=1∣Bm∣∑n∈Bmp^nconf(\mathcal{B}_m)=\frac{1}{|\mathcal{B}_m|}\sum_{n\in\mathcal{B}_m}\hat{p}_n, and p^n\hat{p}_n is the model’s confidence for sample nn: p^n=max⁡cp(yn=c∣xn)\hat{p}_n=\max_c p(y_n=c\mid x_n). Directly applying ECE to text sequences is not straightforward. In § 3.3, we show two ways to evaluate ECE on the generated sequence.

Another commonly used probabilistic prediction metric which we will also use is the Brier score [2]. For our binary task-correctness evaluation, BS=1N∑n=1N(cn−zn)2\mathrm{BS}=\frac{1}{N}\sum_{n=1}^{N}(c_n-z_n)^2, where cnc_n is the sequence confidence score and zn∈{0,1}z_n\in\{0,1\} indicates task correctness.

Method: BayesER

A decoder in MDLMs makes three decisions at every denoising step: which positions to commit, which tokens to write, and how many positions to commit. BAYESER makes all three decisions from a checkpoint-centered posterior predictive distribution. Specifically, it ranks positions by posterior predictive entropy, selects token identities from the posterior predictive mean, and determines the commitment budget from posterior confidence.

BAYESER consists of two stages: (1) First, we fit the posterior distribution over LoRA adapter parameters using training data, from which we obtain the posterior samples; and (2) Then, using the posterior samples, we compute the predictive posterior entropy at every denoising step tt to determine how many tokens to unmask and which positions to fill with which token. We describe each of these two stages below.

Phase I: Curvature-Only Laplace-LoRA Posterior

Checkpoint-centered LoRA parameterization. We place LoRA adapters on selected query and value matrices in the selected JJ transformer layers. Below, we omit the indices for QQ and VV and show only the layer index jj, since the LoRA operation is the same for QQ and VV.

For a selected pretrained matrix Wj,0∈Rdout×dinW_{j,0} \in\mathbb{R}^{d_{\mathrm{out}} \times d_{\mathrm{in}}}, the effective weight is

Wj(ϕj)=Wj,0+αrBjAj,Aj∈Rr×din,Bj∈Rdout×r,(2)W_j(\phi_j) = W_{j,0} + \frac{\alpha}{r} B_j A_j,\qquad A_j \in\mathbb{R}^{r \times d_{\mathrm{in}}},\qquad B_j \in\mathbb{R}^{d_{\mathrm{out}} \times r}, \tag*{(2)}

where we let ϕ0={Aj,0,Bj,0}j\phi_0 = \{A_{j,0}, B_{j,0}\}_j, and Bj,0=0B_{j,0} = 0, with Aj,0A_{j,0} given by the standard LoRA initialization. Because Bj,0Aj,0=0B_{j,0}A_{j,0} = 0, the posterior-mean model is exactly the released checkpoint:

fθ0,ϕ0=fθ0f_{\theta_0,\phi_0} = f_{\theta_0}

Unlike standard Laplace-LoRA, we do not optimize the adapter means on a downstream objective. We use the training data only to estimate local curvature.

Approximating Fisher information with KFAC For each LoRA adapter matrix index mm, where mm can vary between layers and QQ and VV, we denote its input activation for each observation x~n\widetilde{x}_n by hm,nh_{m,n}, and let

gm,n=∇am,nlog⁡pθ0,ϕ0(Yn∣x~n)g_{m,n} = \nabla_{a_{m,n}} \log p_{\theta_0,\phi_0}(Y_n \mid\widetilde{x}_n)

be the gradient with respect to the corresponding pre-activation am,na_{m,n}, where YnY_n is distributed according to the model predictive distribution. We approximate the Fisher information matrix separately for each adapter matrix, using Kronecker-factored approximate curvature (KFAC):

Fm≈Nm(Gm⊗Cm),where Cm=E[hmhmT], and Gm=E[gmgmT],(3)F_m \approx N_m (G_m \otimes C_m),\qquad\text{where } C_m = \mathbb{E}\left[h_{m}h_{m}^{\mathsf{T}}\right],\ \text{and } G_m = \mathbb{E}\left[g_m g_m^{\mathsf{T}}\right], \tag*{(3)}

where NmN_m counts the contributing source-position observations represented by the sampled rows for block mm, rather than calibration sequences or masked targets. The factor CmC_m captures correlations among matrix inputs, whereas GmG_m captures correlations among output-gradient coordinates.

Using an isotropic Gaussian prior precision λ\lambda, we construct the checkpoint-centered, Laplace-style Gaussian approximation

qλ(ϕ)=N(ϕ0,[blockdiag⁡(F1,…,FR)+λI]−1),(4)q_\lambda(\phi) = \mathcal{N}\left(\phi_0,\left[\operatorname{blockdiag}(F_1,\ldots,F_R)+\lambda I\right]^{-1}\right), \tag*{(4)}

where RR is the total number of individual LoRA adapter matrices across the JJ we consider. For instance, if we have QQ, VV matrices per layer and apply LoRA to 10 layers, the posterior covariance consists of small, manageable 40 blocks (since each QQ and VV has two adapter matrices, AA and BB). Together, these blocks define a single joint Gaussian over all selected adapter parameters. Blocks are independent across matrices, projections, and layers; however, within-matrix KFAC correlations remain, and the leading eigendirections of large factors are retained. Directions omitted by the truncated eigenspace retain prior variance.

Uncertainty in the LoRA factors At the initialization ϕ0\phi_0, we have Bj,0B_{j,0} initialized as 0. Changing Aj,0A_{j,0} alone therefore does not affect Wj(ϕj)W_j(\phi_j), so the gradient with respect to AjA_j and its Fisher block is zero. Under our Gaussian approximation, this gives: vec⁡(Aj)∼N(vec⁡(Aj,0),λ−1I)\operatorname{vec}(A_j) \sim\mathcal{N}(\operatorname{vec}(A_{j,0}),\lambda^{-1}I). Therefore, uncertainty in AjA_j is entirely prior-controlled, while uncertainty in BjB_j depends on both the calibration curvature and the prior. At prediction time, each posterior draw ϕ(s)∼qλ(ϕ)\phi^{(s)} \sim q_\lambda(\phi) gives a corresponding pair of sampled LoRA matrices Aj(s)A_j^{(s)} and Bj(s)B_j^{(s)}. We use these matrices to construct the sampled model weights: Wj(ϕj(s))=Wj,0+αrBj(s)Aj(s)W_j(\phi_j^{(s)}) = W_{j,0} + \frac{\alpha}{r}B_j^{(s)}A_j^{(s)}. Although AjA_j has zero local Fisher curvature at initialization, its sampled variation still affects predictions because Bj(s)B_j^{(s)} is generally non-zero. Writing Aj(s)=Aj,0+δAj(s)A_j^{(s)} = A_{j,0} + \delta A_j^{(s)} and Bj(s)=δBj(s)B_j^{(s)} = \delta B_j^{(s)}, the sampled update includes the bilinear term αrδBj(s)δAj(s)\frac{\alpha}{r}\delta B_j^{(s)}\delta A_j^{(s)} in addition to αrδBj(s)Aj,0\frac{\alpha}{r}\delta B_j^{(s)}A_{j,0}. Thus, predictive variation reflects both data-informed curvature and prior-controlled variation in locally unconstrained directions.

Algorithm 1 BAYESER
Require: Pre-trained model: $f_{\theta_0}$, confidence threshold: $\tau_B \in [0,1]$, how many posterior samples to draw: $S \ge 1$, initial sequence $x_T^{(1:L)}$, and the number of selected tokens per position: $K_v \ge 1$
1: Phase I: Fit the parameter posterior $q_\lambda$ using Algorithm 2
2: Then, sample parameters $\theta^{(s)} \sim q_\lambda$ for $s = 1,\ldots,S$
3: Phase II:
4: $t \leftarrow T$; $\mathcal{C} \leftarrow \varnothing$; $\mathcal{M}_T \leftarrow \{l : x_T^{(l)} = [\mathrm{MASK}]\}$
5: while $\mathcal{M}_t \ne \varnothing$ do
6: Run base model $f_{\theta_0}(x_t^{(1:L)})$ to obtain token logits and confidences $c_t^{(l)}$ for each position $l$
7: For each masked position $l$, define a set $\mathcal{V}_t^{(l)}$ containing the $K_v$ highest-scoring tokens
8: for $s = 1,\ldots,S$ do
9: Given each posterior sample, run the sampled model $f_{\theta^{(s)}}(x_t^{(1:L)})$
10: $p_{t,s}^{(l)} \leftarrow$ softmax of sampled-model logits over tokens in $\mathcal{V}_t^{(l)}$
11: end for
12: $\bar{p}_t^{(l)} \leftarrow S^{-1}\sum_s p_{t,s}^{(l)}$
13: $H_t^{(l)} \leftarrow -\sum_{v\in\mathcal{V}_t^{(l)}}\bar{p}_t^{(l)}(v)\log\bar{p}_t^{(l)}(v)$
14: $\hat{y}_t^{(l)} \leftarrow \arg\max_{v\ne[\mathrm{MASK}]} \bar{p}_t^{(l)}(v)$; and $c_t^{(l)} \leftarrow \bar{p}_t^{(l)}(\hat{y}_t^{(l)})$
15: $K_t \leftarrow \max(1,\sum_{l\in\mathcal{M}_t}\mathbb{1}_{c_t^{(l)}\ge\tau_B})$
16: $\mathcal{P}_t \leftarrow$ the $K_t$ masked positions with lowest entropy $H_t^{(l)}$
17: Record $(t,l,\hat{y}_t^{(l)},c_t^{(l)})$ in $\mathcal{C}$ for each $l\in\mathcal{P}_t$
18: $x_{t-1}^{(l)}\leftarrow\hat{y}_t^{(l)}$ for each $l\in\mathcal{P}_t$
19: $t\leftarrow t-1$
20: $\mathcal{M}_t\leftarrow\{l:x_t^{(l)}=[\mathrm{MASK}]\}$
21: end while
22: return Updated sequence $x_t^{(l)}$ and saved tokens and their probabilities $\mathcal{C}$

Phase II: Posterior Predictive Entropy for Position Ordering

At step tt, the pre-trained model produces base logits ℓ0,t(l)∈R∣V∣\ell_{0,t}^{(l)}\in\mathbb{R}^{|V|} for each location ll. For each position, we define a candidate set containing the top-KvK_v highest-scoring non-masked tokens, i.e., Vt(l)=TopK⁡v∈V∖{[MASK]}(ℓ0,t(l)(v);Kv)\mathcal{V}_t^{(l)}=\operatorname{TopK}_{v\in V\setminus\{[\mathrm{MASK}]\}}(\ell_{0,t}^{(l)}(v);K_v). For SS independent posterior draws ϕ(s)∼qλ(ϕ)\phi^{(s)}\sim q_\lambda(\phi), let ℓt,s(l)\ell_{t,s}^{(l)} be the sampled-model logit. We first normalize each draw over the candidate set Vt(l)\mathcal{V}_t^{(l)}: pt,s(l)(v)=exp⁡ℓt,s(l)(v)∑u∈Vt(l)exp⁡ℓt,s(l)(u)p_{t,s}^{(l)}(v)=\frac{\exp\ell_{t,s}^{(l)}(v)}{\sum_{u\in\mathcal{V}_t^{(l)}}\exp\ell_{t,s}^{(l)}(u)}, for v∈Vt(l)v\in\mathcal{V}_t^{(l)}. Importantly, we average probabilities rather than logits: pˉt(l)(v)=1S∑s=1Spt,s(l)(v)\bar{p}_t^{(l)}(v)=\frac{1}{S}\sum_{s=1}^{S}p_{t,s}^{(l)}(v). Our position-ordering criterion is the posterior predictive entropy given by

Htpred,(l)=H(pˉt(l))=−∑v∈Vt(l)pˉt(l)(v)log⁡pˉt(l)(v).(5)H_t^{\mathrm{pred},(l)}=H\left(\bar{p}_t^{(l)}\right)=-\sum_{v\in\mathcal{V}_t^{(l)}}\bar{p}_t^{(l)}(v)\log\bar{p}_t^{(l)}(v). \tag*{(5)}

Low entropy indicates that the posterior predictive distribution concentrates on a small number of candidates, making the position comparatively safe to commit. High entropy indicates that no clear token is supported under the current partially masked context, so the position should be deferred.

Commitment Budgets Given a posterior-confidence threshold τB\tau_B, BAYESER sets its per-step commitment budget to Kt=max⁡(1,∑l∈Mt1{ct(l)≥τB})K_t=\max\left(1,\sum_{l\in\mathcal{M}_t}\mathbb{1}_{\{c_t^{(l)}\ge\tau_B\}}\right). It then chooses the KtK_t positions with the lowest posterior predictive entropy:

Pt=arg⁡min⁡P⊆Mt∣P∣=Kt∑l∈PHtpred,(l).(6)\mathcal{P}_t=\underset{\substack{\mathcal{P}\subseteq\mathcal{M}_t\\|\mathcal{P}|=K_t}}{\arg\min}\sum_{l\in\mathcal{P}}H_t^{\mathrm{pred},(l)}. \tag*{(6)}

For each l∈Ptl\in\mathcal{P}_t, we commit xt−1(l)=y^t(l)x_{t-1}^{(l)}=\hat{y}_t^{(l)}, where y^t(l)←arg⁡max⁡v≠[MASK]pˉt(l)(v)\hat{y}_t^{(l)}\leftarrow\arg\max_{v\ne[\mathrm{MASK}]}\bar{p}_t^{(l)}(v), while all unselected positions remain unchanged. Algorithm 1 summarizes our algorithm.

Evaluating Sequence-Level Confidence

To evaluate ECE on a generated sequence, we first compute the geometric mean as a length-normalized summary of commitment confidence, for a token scope S⊆CS \subseteq\mathcal{C}:

πseq(S)=exp⁡(1∣S∣∑(t,l)∈Slog⁡ct(l)).(7)\pi_{\mathrm{seq}}(S) = \exp\left(\frac{1}{\lvert S\rvert}\sum_{(t,l)\in S}\log c_{t}^{(l)}\right). \tag*{(7)}

using the token probability available at the moment of commitment, before the committed token becomes part of the context for later denoising steps, denoted by C={(t,l,yt(l),ct(l))}\mathcal{C} = \left\{(t,l,y_{t}^{(l)},c_{t}^{(l)})\right\}, with t=pˉt(l)(yt(l))t = \bar{p}_{t}^{(l)}\left(y_{t}^{(l)}\right). This aggregation is a candidate confidence estimator, which we use for πseq(Sn)\pi_{\mathrm{seq}}(S_n) as the confidence p^n\hat{p}_n for each generated output and compute ECE using equation 1, with correctness determined by the benchmark’s task criterion.

In Section 5, we report the score over two scopes: all generated-content tokens (ECEgen_{\mathrm{gen}}) and task-specific final-answer tokens (ECEans_{\mathrm{ans}}). Note that low ECEgen_{\mathrm{gen}} does not establish that every sentence in a reasoning trace is correct. It means that confidence aggregated over that trace agrees, at the resolution measured, with the frequency of final task success. The generated-content and final-answer variants use different token scopes but share the same task-level correctness event.

This geometric mean is different from Li et al. [13], where their ECE is an arithmetic mean of token probabilities extracted from a single final forward pass under teacher forcing on the completed sequence. Our geometric mean summarizes the model’s confidence at the commitment decisions made along the decoding trajectory.

Mutual Information and Base Entropy

Mutual Information For comparison, one might consider the token–parameter mutual information (MI) given by It(l)=Htpred(l)−1S∑s=1SH(pt,s(l))I_{t}^{(l)} = H_{t}^{\mathrm{pred}(l)} - \frac{1}{S}\sum_{s=1}^{S} H\left(p_{t,s}^{(l)}\right). MI isolates disagreement among posterior draws [7], but it can be small even when every draw assigns a diffuse token distribution. This makes MI insufficient for deferred commitment: posterior samples may agree that a position remains ambiguous because the current state does not yet provide enough context. We therefore use total posterior predictive entropy as the default ordering score and retain MI-based ordering as an ablation. We empirically compare MI and predictive entropy in Appendix § 15.

Base Entropy To distinguish the effect of entropy-based ordering from that of Bayesian marginalization, we can also compare our predictive entropy-based selection from base entropy given by:

H0,t(l)=H(p0,t(l)),where p0,t(l)(v)=exp⁡(ℓ0,t(l)(v))∑u∈V(l)exp⁡(ℓ0,t(l)(u)).H_{0,t}^{(l)} = H\left(p_{0,t}^{(l)}\right), \qquad\text{where } p_{0,t}^{(l)}(v) = \frac{\exp\left(\ell_{0,t}^{(l)}(v)\right)}{\sum_{u\in\mathcal{V}^{(l)}}\exp\left(\ell_{0,t}^{(l)}(u)\right)}.

This baseline, BASE ENTROPY, ranks positions by H0,t(l)H_{0,t}^{(l)} while retaining the model’s tokens and confidence-based commitment budget.

Related Work

Decoding and unmasking policies. MaskGIT and Fast-dLLM [4, 23] present confidence-based decoders; Deferred Commitment Decoding adapts the active window [21], and Entropy based sampler uses a point estimate of entropy to control parallel commitments [1]. Lookahead Unmasking and the Information-Gain (Info-Gain) Sampler evaluate candidate successor states [12, 25]. Other approaches learn unmasking policies through reinforcement learning [10] or derive ordering corrections from terminal rewards, as in DPM [3]. None of the above methods uses posterior predictive uncertainty to choose positions, tokens, and commitment counts.

Bayesian inference for pretrained models. Laplace-LoRA fits a posterior around fine-tuned adapters [24], BLoB [22] learns a variational posterior during adapter training, and Training-Free Bayesianization [20] assigns uncertainty to already-trained @references 񟿿 adapters. Building on structured Laplace approximations [18, 5], our curvature-only construction fits uncertainty around zero-update adapters at the released checkpoint. This preserves the deterministic mean model and allows us to study posterior prediction without conflating it with downstream fine-tuning.

Uncertainty in generation. For continuous diffusion, BayesDiff propagates uncertainty using last-layer Laplace [11], while Jazbec et al. [9] develop a Bayesian measure for assessing synthetic samples. Our focus is utilizing the uncertainty at unresolved discrete token positions to guide commitment during generation.

Experiments

Setup

We evaluate Dream-v0-Instruct-7B [26] on code generation (MBPP, HumanEval), mathematical reasoning (GSM8K, MATH500), and planning (4×4 Sudoku, Countdown). HumanEval transfers the MBPP posterior without refitting. We also include LLaDA results in Appendix D. We additionally evaluate molecular scaffold decoration with GenMol V2. Detailed configurations are available in Appendix A.2.

We compare against confidence-threshold decoding, Base Entropy, and Info-gain [25]. Info-gain runs use N=8N = 8 candidate paths with fixed K=2K = 2 tokens per step. We report task accuracy and sequence-level calibration.

We compare the sequence scores in Eq. (7) with binary task correctness using 15 equal-width bins for ECE (§ 2.3) and report binary Brier scores. We compute scores over generated-content tokens and final-answer tokens, yielding ECEgen_{\mathrm{gen}} and ECEans_{\mathrm{ans}}. For molecule generation, ECE is evaluated against chemical validity, while quality yield measures the fraction of attempts meeting the QED and SA criteria in Table 3.

MethodQuality Yield (%) ↑Frag. Valid (%) ↑QED ↑SA ↓ECE ↓
Native GenMol11.78±0.6911.78 \pm0.6999.33±0.3399.33 \pm0.330.6369±0.01040.6369 \pm0.01044.3932±0.03624.3932 \pm0.036245.08±0.2945.08 \pm0.29
Base Entropy14.89±0.6914.89 \pm0.6999.89±0.1999.89 \pm0.190.6599±0.00110.6599 \pm0.00114.2809±0.01064.2809 \pm0.010635.40±0.5935.40 \pm0.59
Info-gain3.00±0.673.00 \pm0.67100.00±0.00100.00 \pm0.000.6704±0.02060.6704 \pm0.02064.1528±0.05954.1528 \pm0.059524.56±1.7124.56 \pm1.71
DPRM [3]12.44±0.6912.44 \pm0.69100.00±0.00100.00 \pm0.000.6619±0.01170.6619 \pm0.01174.2682±0.07424.2682 \pm0.074230.62±1.3330.62 \pm1.33
BAYESER (Ours)15.33±0.3315.33 \pm0.3399.67±0.0099.67 \pm0.000.6602±0.00060.6602 \pm0.00064.2900±0.00624.2900 \pm0.006235.36±0.7335.36 \pm0.73

Table 3. Evaluation on GenMol V2 Scaffold Decoration. Quality Yield measures the percentage of generated attempts satisfying both drug-likeness (QED ≥0.6\ge0.6) and synthetic accessibility (SA ≤4.0\le4.0).

Main results

Mathematical reasoning and programming

Table 1 shows that BAYESER improves sequence-confidence calibration on several tasks, with task-dependent changes in accuracy. On MBPP, the accuracy-oriented setting approximately preserves threshold accuracy (57.53% versus 57.60%) while reducing generated-content ECE from 0.2918 to 0.2354. The calibration-oriented setting lowers ECE further to 0.1632 at 56.73% accuracy. Transferring the MBPP posterior to HumanEval also reduces ECE and Brier scores without refitting: generated-content ECE falls from 0.3090 to 0.2016 in the calibration-oriented setting, with 55.08% accuracy versus 54.88% for threshold. Base Entropy retains the highest HumanEval accuracy at 57.32%.

DatasetMethodAccuracy (%) ↑ECEgen_{\mathrm{gen}} (×100) ↓ECEans_{\mathrm{ans}} (×100) ↓Briergen_{\mathrm{gen}} (×100) ↓
MBPPThreshold (Fast-dllm)57.6029.1831.2431.85
Base Entropy57.00 (−1.04)28.99 (+0.65)31.53 (−0.93)31.23 (+1.97)
Info-gain54.001.71_{1.71} (−6.25)31.601.71_{1.71} (−8.29)33.731.71_{1.71} (−7.97)33.151.23_{1.23} (−4.07)
BAYESER (best accuracy)57.530.12_{0.12} (−0.12)23.540.11_{0.11} (+19.33)25.700.09_{0.09} (+17.73)28.400.02_{0.02} (+10.84)
BAYESER (best calibration)56.731.01_{1.01} (−1.51)16.321.21_{1.21} (+44.07)18.171.02_{1.02} (+41.84)25.570.36_{0.36} (+19.73)
HumanEvalThreshold (Fast-dllm)54.8830.9030.5933.27
Base Entropy57.32 (+4.45)27.25 (+11.81)26.71 (+12.68)31.80 (+4.42)
Info-gain51.220.61_{0.61} (−6.67)33.680.57_{0.57} (−9.00)33.280.53_{0.53} (−8.79)35.820.82_{0.82} (−7.66)
BAYESER (best accuracy)56.303.01_{3.01} (+2.59)24.773.04_{3.04} (+19.84)24.613.13_{3.13} (+19.55)30.261.80_{1.80} (+9.05)
BAYESER (best calibration)55.081.96_{1.96} (+0.36)20.162.04_{2.04} (+34.76)20.331.98_{1.98} (+33.54)27.761.05_{1.05} (+16.56)
GSM8KThreshold (Fast-dllm)76.1910.0117.9117.46
Base Entropy78.17 (+2.60)7.14 (+28.67)15.98 (+10.78)16.39 (+6.13)
Info-gain69.700.44_{0.44} (−8.52)10.170.18_{0.18} (−1.60)18.800.06_{0.06} (−4.97)16.620.13_{0.13} (+4.81)
BAYESER (best accuracy)77.980.38_{0.38} (+2.35)7.170.41_{0.41} (+28.37)16.100.20_{0.20} (+10.11)16.530.18_{0.18} (+5.31)
BAYESER (best calibration)76.890.52_{0.52} (+0.92)6.500.55_{0.55} (+35.06)15.750.52_{0.52} (+12.06)16.980.26_{0.26} (+2.73)
MATH500Threshold (Fast-dllm)<u>42.40</u><u>45.50</u><u>50.08</u><u>45.33</u>
Base Entropy40.00 (−5.66)46.27 (−1.69)53.31 (−6.45)45.77 (−0.98)
Info-gain40.730.58_{0.58} (−3.94)45.960.70_{0.70} (−1.01)52.041.13_{1.13} (−3.91)45.720.46_{0.46} (−0.87)
BAYESER (best accuracy)43.531.17_{1.17} (+2.67)42.711.12_{1.12} (+6.13)49.551.09_{1.09} (+1.06)43.190.84_{0.84} (+4.72)

Table 1. Evaluation on mathematical reasoning and programming tasks. Accuracy is reported in percent; ECE and Brier values and their standard deviations are multiplied by 100. Subscripts are the standard deviations of three seeds on the corresponding column scale. Numbers in parentheses are relative percentage improvements over confidence-thresholding decoding. Bold values indicate the best result and underlined values indicate the second-best result per metric within each benchmark.

On GSM8K, Base Entropy achieves the highest accuracy (78.17%) and lowest generated-content Brier score, while the calibration-oriented BAYESER setting achieves the lowest ECE in both scopes. On MATH500, BAYESER improves accuracy from 42.40% to 43.53% and reduces ECE and Brier scores. The accuracy–calibration tradeoff will be further elaborated in Section 5.3.

Planning

Table 2 shows contrasting outcomes on the two planning tasks. Sudoku offers little advantage for Bayesian decoding: threshold and Base Entropy reach 97.60% accuracy, and neither posterior setting improves on threshold’s Brier score. Countdown exhibits the strongest accuracy–calibration trade-off. The accuracy-oriented BAYESER setting reaches 32.13% accuracy, exceeding threshold (18.90%) and Base Entropy (23.90%), but falling below Info-gain (41.47%). Its generated-content ECE and Brier score are lower than Info-gain’s: 0.2898 versus 0.4563 and 0.2671 versus 0.4240, respectively. The calibration-oriented setting further reduces generated-content ECE to 0.2570 at 27.80% accuracy.

DatasetMethodAccuracy (%) ↑ECEgen_{\mathrm{gen}} (×100) ↓ECEans_{\mathrm{ans}} (×100) ↓Briergen_{\mathrm{gen}} (×100) ↓
SudokuThreshold (Fast-dllm)97.603.133.132.24
Base Entropy97.60 (+0.00)2.98 (+4.79)2.98 (+4.79)2.28 (−1.54)
Info-gain96.070.50_{0.50} (−1.57)2.540.08_{0.08} (+18.85)2.540.08_{0.08} (+18.85)3.390.37_{0.37} (−51.35)
BAYESER (best accuracy)97.530.31_{0.31} (−0.07)3.960.03_{0.03} (−26.52)3.960.03_{0.03} (−26.52)2.400.17_{0.17} (−7.00)
BAYESER (best calibration)97.400.20_{0.20} (−0.20)2.990.27_{0.27} (+4.47)2.990.27_{0.27} (+4.47)2.390.16_{0.16} (−6.56)
CountdownThreshold (Fast-dllm)18.9066.4661.5458.56
Base Entropy23.90 (+26.46)60.07 (+9.61)54.67 (+11.16)53.21 (+9.14)
Info-gain41.472.03_{2.03} (+119.42)45.631.77_{1.77} (+31.34)43.561.08_{1.08} (+29.22)42.401.16_{1.16} (+27.60)
BAYESER (best accuracy)32.130.67_{0.67} (+70.00)28.980.21_{0.21} (+56.39)27.920.68_{0.68} (+54.63)26.710.18_{0.18} (+54.39)
BAYESER (best calibration)27.800.78_{0.78} (+47.09)25.700.50_{0.50} (+61.33)30.240.81_{0.81} (+50.86)22.830.08_{0.08} (+61.01)

Table 2. Evaluation on planning tasks.

Molecular generation

On GenMol V2 scaffold decoration (Table 3), BAYESER achieves the highest mean quality yield at 15.33%, compared with 11.78% for native GenMol and 14.89% for Base Entropy. Its ECE is lower than native GenMol’s (35.36 versus 45.08 on the table’s scale), but nearly identical to Base Entropy’s (35.40). These metrics capture different aspects of generation: ECE concerns chemical validity, whereas quality yield requires both drug-likeness and synthetic accessibility.

Hyperparameter sensitivity and accuracy–calibration trade-offs

We additionally evaluate how prior precision λ\lambda, the number of uncertain trailing layers LsL_s, and the commitment budget jointly affect the accuracy–calibration tradeoff. In Figure 1, each panel shows five prior precisions (λ∈{100,200,300,500,1000}\lambda\in\{100, 200, 300, 500, 1000\}) at four depths. Intermediate precision provides operating points with lower ECE and comparable or higher accuracy. Further weakening the prior can reduce ECE while substantially degrading accuracy.

Accuracy–calibration trade-off plots for different hyperparameter choices

Figure 1. Accuracy–calibration trade-off for MBPP with different hyperparameter choices.

Depth and commitment budget also interact. A single uncertain layer reaches 59.0% at ECE 0.223 for τB=0.85\tau_B = 0.85, λ=300\lambda= 300, and 58.4% at ECE 0.147 for τB=0.90\tau_B = 0.90, λ=200\lambda= 200. These examples show that a shallow posterior can offer a favorable accuracy–calibration trade-off and that additional uncertain layers do not consistently improve it.

Computational efficiency

Figure 2 shows HumanEval cost on A100 GPUs with S=10S = 10 samples and τB=0.90\tau_B = 0.90. Across tested priors, increasing uncertain depth from one to four layers raises evaluation time from 17.4–22.1 to 28.8–52.9 minutes, versus 13.4 minutes for threshold. Peak allocated memory remains within 15.54–15.71 GiB, versus 14.38 GiB for threshold. Deeper posteriors require longer sampled forward passes, while weaker priors can prolong decoding. Shallow posteriors therefore limit runtime overhead. Memory varies little with depth.

Full evaluation time and peak allocated GPU memory versus uncertain trailing layers

Figure 2. Dream HumanEval cost versus uncertain depth.

Conclusion and Discussion

We introduced BAYESER, a post-hoc Bayesian decoding scheme that uses posterior predictive uncertainty to guide position ordering, token selection, and commitment budgets in masked diffusion language models. Its curvature-only Laplace-LoRA construction preserves the released checkpoint at the posterior mean and requires no adapter fine-tuning. The experiments show that posterior prediction can improve sequence-confidence calibration while preserving or improving task performance at selected operating points. In future work, we plan to extend the single Gaussian posterior to multiple Gaussian posteriors across different adapter-parameter layers to better capture parameter uncertainties and enhance our entropy-based decoding scheme.

Reproducibility Statement

The pretrained checkpoints used in this work (Dream-v0-Instruct-7B, LLaDA-8B-Instruct, and GenMol V2) and the MBPP, HumanEval, GSM8K, and MATH500 benchmarks are publicly available. Planning evaluations use fixed public Sudoku and Countdown test sets; separate synthetic training sets are generated deterministically with test inputs excluded. Molecular-generation experiments use public GenMol fragments and calibration data drawn from the training split of datamol-io/safe-gpt. § 3 and Appendix § 11 describe the method, posterior construction, and predictive computation. § 5 describes the benchmarks and metrics; Table 4 and Table 5 specify the Dream configurations, and Appendix § 14 reports the additional LLaDA evaluation settings. Code, posterior artifacts, data-preparation scripts, and evaluation configurations will be open-sourced upon publication.

ComponentSetting
Mean modelDream-v0-Instruct-7B
BenchmarksMBPP, HumanEval, GSM8K, MATH500, Sudoku, Countdown
Prompt protocoltask-matched Dream instruction prompts
Posterior meanreleased checkpoint; zero LoRA update
Curvaturecategorical model Fisher, low-rank KFAC (k=10k = 10)
Target modulestrailing-layer query/value projections
Posterior drawsS=10S = 10
Vocabulary supportKv=256K_v = 256
Predictive backendnonlinear posterior weight sampling
Commit thresholdτ=0.9\tau= 0.9; posterior budget gate τB=0.85\tau_B = 0.85 or 0.9
Rankingposterior predictive entropy
Commit budgetposterior confidence gate for all selected BAYESER rows
Window (code/math)Sliding, initial 16 tokens, maximum 128 tokens
Geometry (Sudoku)In-place infilling
Geometry (Countdown)48-token block
Token proposalposterior argmax for all selected BAYESER rows
Sequence confidencegeometric mean of commit-time probabilities, generated and answer scopes
ECE15 equal-width bins

Table 4. Main experimental configuration for the six-benchmark Dream study. HumanEval uses the MBPP-trained posterior without refitting; all other posteriors are fitted on task-specific or synthetic training data.

TaskTargetLsL_sRankAlphaPriorτB\tau_B
MBPPAccuracy18163000.85
MBPPCalibration18162000.90
HumanEvalAccuracy18163000.85
HumanEvalCalibration18162000.90
GSM8KAccuracy48162,0000.90
GSM8KCalibration18165000.85
MATH500Accuracy / calibration28162,0000.90
SudokuAccuracy28165000.90
SudokuCalibration18161,0000.90
CountdownAccuracy48162000.85
CountdownCalibration18161000.90

Table 5. Hyperparameters for the evaluation in the main results. HumanEval reuses the MBPP-trained posterior; the remaining rows are task-fitted.

Use of AI Statement

Generative AI tools and large language models were used to assist with code implementation, finding related work, manuscript editing, grammar polishing, and typesetting. AI-assisted code was checked by the authors. The authors take responsibility for the final manuscript, including its code, experimental results, and claims.

Ethics Statement

This work studies uncertainty-aware decoding using pretrained models and public benchmark datasets. Improved benchmark calibration does not guarantee reliable predictions under distribution shift or safe deployment in high-stakes settings. The molecular-generation experiments evaluate computational properties; the reported metrics do not establish biological efficacy, toxicity, or safety. Generated molecules would require independent expert assessment and experimental validation before practical use.

Acknowledgments

We thank the Digital Research Alliance of Canada (Compute Canada) for its computational resources and services. Z. Jiang and M. Park were supported in part by the Natural Sciences and Engineering Research Council of Canada (NSERC) and the Canada CIFAR AI Chairs program.

Posterior and implementation details

Posterior fitting, sampling and computation

We use the notation of § 3.1: θ0\theta_0 denotes the fixed pretrained parameters, ϕ\phi collects the LoRA adapter parameters, jj indexes selected transformer layers, and mm indexes individual adapter-matrix blocks. We fit model-Fisher curvature at ϕ0\phi_0, where the LoRA update is zero, using task-matched calibration prompts and suppressing the mask-token logit before softmax. Algorithm 2 summarizes the procedure. For posterior draws we use the exact factorization implied by Eq. (4). Let ϕm\phi_m be the vectorized adapter matrix for block mm, with mean ϕ0,m\phi_{0,m}; here vec⁡\operatorname{vec} stacks rows, consistent with the ordering Gm⊗CmG_m \otimes C_m. Draw a matrix zm(s)z_m^{(s)} of independent standard normal entries in the shape of that adapter matrix and expand it in the retained basis, zm(s)=∑a,bξm,ab(s)um,aG(um,bC)⊤+zm,⊥(s)z_m^{(s)}=\sum_{a,b}\xi_{m,ab}^{(s)}u_{m,a}^{G}(u_{m,b}^{C})^\top+z_{m,\perp}^{(s)}. The adapter draw is

ϕm(s)=ϕ0,m+vec⁡[∑a,bξm,ab(s)λ+Nmgm,acm,bum,aG(um,bC)⊤+1λzm,⊥(s)](8)\phi_m^{(s)}=\phi_{0,m}+\operatorname{vec}\left[\sum_{a,b}\frac{\xi_{m,ab}^{(s)}}{\sqrt{\lambda+N_m g_{m,a}c_{m,b}}}u_{m,a}^{G}(u_{m,b}^{C})^\top+\frac{1}{\sqrt{\lambda}}z_{m,\perp}^{(s)}\right] \tag*{(8)}

where cm,bc_{m,b} and gm,ag_{m,a} are the retained eigenvalues of CmC_m and GmG_m and NmN_m is the represented source-position observation count defined in the main text. The coefficients ξm,ab(s)\xi_{m,ab}^{(s)} are independent standard normal draws. The retained-basis perturbation is the data- and prior-informed component; the last term is the prior-only complement corresponding to truncated directions. Each block draws its own independent zm(s)z_m^{(s)}, realizing the block-independence assumption above. Substituting Eq. (8) into Eq. (2) gives the nonlinear weight-space predictive pθ0,ϕ(s)(l)(⋅∣xt(1:L))p_{\theta_0,\phi^{(s)}}^{(l)}(\cdot\mid x_t^{(1:L)}) at position ll. Normalizing the sampled logits on Vt(l)\mathcal{V}_t^{(l)} gives pt,s(l)p_{t,s}^{(l)} from Section 3.2.

Algorithm 2 Curvature-only KFAC Laplace-LoRA posterior

Require: Released model fθ0f_{\theta_0}; calibration set Dcal\mathcal{D}_{\mathrm{cal}}; selected projections; LoRA rank rr and scale α\alpha; KFAC rank kk; prior precision λ\lambda; per-block row-sampling cap NsN_s

  1. Wrap each selected projection as Wj(ϕj)=Wj,0+αrBjAjW_j(\phi_j)=W_{j,0}+\frac{\alpha}{r}B_jA_j with Bj,0=0B_{j,0}=0 (Eq. (2)); let ϕ0\phi_0 collect {Aj,0,Bj,0}j\{A_{j,0},B_{j,0}\}_j, with projection indices omitted as in the main text

  2. Initialize weighted sums SmC=0S_m^C=0, SmG=0S_m^G=0 and counts Nm=0N_m=0 for each block mm

  3. for each calibration batch of masked sequences x~n\tilde{x}_n and target masks do

  4. Forward the masked sequence; suppress the mask-token logit before softmax and sample one categorical target from the model distribution at each masked target position

  5. Backpropagate the summed cross-entropy against these sampled targets

  6. for each adapter-matrix block mm (AjA_j and BjB_j separately) do

  7. Collect paired rows (hm,n,gm,n)(h_{m,n},g_{m,n}) at positions with nonzero gradient; skip blocks with no eligible rows

  8. Uniformly subsample up to NsN_s rows; set each retained row’s weight wnw_n to the number of eligible rows divided by the number retained

  9. SmC←SmC+∑nwnhm,nhm,n⊤S_m^C\leftarrow S_m^C+\sum_n w_n h_{m,n}h_{m,n}^{\top}, SmG←SmG+∑nwngm,ngm,n⊤S_m^G\leftarrow S_m^G+\sum_n w_n g_{m,n}g_{m,n}^{\top}, and Nm←Nm+∑nwnN_m\leftarrow N_m+\sum_n w_n

  10. end for

  11. end for

  12. for each block mm do

  13. if Nm=0N_m=0 then

  14. Set Fm=0F_m=0 (prior-only block)

  15. else

  16. Normalize Cm=SmC/NmC_m=S_m^C/N_m and Gm=SmG/NmG_m=S_m^G/N_m

  17. Eigendecompose CmC_m and GmG_m; store the top-kk directions of large factors

  18. Store ({um,bC},{cm,b},{um,aG},{gm,a},Nm)\left(\{u_{m,b}^{C}\},\{c_{m,b}\},\{u_{m,a}^{G}\},\{g_{m,a}\},N_m\right) with curvature Fm=Nm(Gm⊗Cm)F_m=N_m(G_m\otimes C_m)

  19. end if

  20. end for

  21. Form FKFAC=blockdiag⁡(F1,…,FR)F_{\mathrm{KFAC}}=\operatorname{blockdiag}(F_1,\ldots,F_R) and qλ(ϕ)=N(ϕ0,(FKFAC+λI)−1)q_\lambda(\phi)=\mathcal{N}\left(\phi_0,(F_{\mathrm{KFAC}}+\lambda I)^{-1}\right)

  22. return qλq_\lambda and the per-block eigenbasis; λ\lambda is applied at inference

All reported evaluations are cache-free. Within each decoding step, activations before the first uncertain layer are computed once and reused across posterior draws; each draw evaluates the remaining layers with its sampled weights. This reuse is exact because the preceding layers are unchanged across draws. Activations are recomputed at every decoding step, and draws are batched where memory permits.

Execution protocols

All rows in Tables 1 and 2 use exact cache-free forward passes. Planning evaluations use the task geometry described in § 5.

Task-specific decoding geometry. For the Dream experiments, MBPP, HumanEval, GSM8K, and MATH500 use sliding-window decoding with an initial window width of 16 tokens and a maximum width of 128 tokens. Sudoku uses in-place infilling, whereas Countdown uses a 48-token block. These planning-specific settings replace the sliding-window configuration used for code generation and mathematical reasoning.

Additional Dream accuracy–calibration sweeps

Figure 3–Figure 6 extend Figure 1 to four additional benchmarks.

Two-panel HumanEval accuracy versus calibration plots with legends for 1 layer, 2 layers, 4 layers, Threshold, and Base entropy; posterior budgets $\tau_B=0.85$ and $\tau_B=0.90$; horizontal axis Generated-content ECE (lower is better); vertical axis Pass@1 accuracy (%); prior precision $\lambda$ (connected in increasing order) values 200, 300, 500, 1,000, and 2,000.

Figure 3. HumanEval accuracy versus calibration.

Countdown accuracy versus calibration, posterior budget $\tau_B = 0.85$: generated-content ECE (lower is better) versus accuracy (%); legend: 1 layer, 2 layers, 4 layers, 8 layers, Base entropy; prior precision $\lambda$ (connected in increasing order): 100, 200, 500, 1,000, 2,000

(a)

Countdown accuracy versus calibration, posterior budget $\tau_B = 0.90$: generated-content ECE (lower is better) versus accuracy (%); legend: 1 layer, 2 layers, 4 layers, 8 layers, Base entropy; prior precision $\lambda$ (connected in increasing order): 100, 200, 500, 1,000, 2,000

(b)

Figure 6. Countdown accuracy versus calibration.

Two-panel GSM8K accuracy versus calibration plots with legends for 1 layer, 2 layers, 4 layers, Threshold, and Base entropy; posterior budgets $\tau_B=0.85$ and $\tau_B=0.90$; horizontal axis Generated-content ECE (lower is better); vertical axis Accuracy (%); prior precision $\lambda$ (connected in increasing order) values 100, 200, 500, 1,000, and 2,000.

Figure 4. GSM8K accuracy versus calibration.

MATH500 accuracy versus calibration, posterior budget $\tau_B = 0.85$: generated-content ECE (lower is better) versus accuracy (%); legend: 1 layer, 2 layers, 4 layers, Threshold, Base entropy; prior precision $\lambda$ (connected in increasing order): 200, 300, 500, 1,000, 2,000

(a)

MATH500 accuracy versus calibration, posterior budget $\tau_B = 0.90$: generated-content ECE (lower is better) versus accuracy (%); legend: 1 layer, 2 layers, 4 layers, Threshold, Base entropy; prior precision $\lambda$ (connected in increasing order): 200, 300, 500, 1,000, 2,000

(b)

Figure 5. MATH500 accuracy versus calibration.

Additional measured cost

Figure 7 compares BAYESER costs with Confidence-thresholding baseline on H100 GPU.

Figure 7. Measured Dream GSM8K cost versus uncertain depth. Full test set (n=1,319n = 1{,}319), GSM8K-fitted rank-8 q/v Laplace-LoRA with S=10S = 10, on H100 GPUs. Color denotes prior precision λ\lambda. Dashed lines show the confidence-threshold run. Wall time includes loading and scoring; the loose prior increases decoding steps, especially at four layers.

LLaDA results

Table 6 reports full-test results for GSAI-ML/LLaDA-8B-Instruct. The recorded MBPP, GSM8K and MATH500 curvature-only sweeps use rank-8 q/v adapters (α=16\alpha= 16), KFAC rank 10, and vocabulary support Kv=256K_v = 256. HumanEval retains the MBPP transfer configuration described above. Info-gain uses N=8N = 8, fixed K=2K = 2.

MethodAccuracy (%) ↑\uparrowECEgen_{\mathrm{gen}} (×100\times100) ↓\downarrowECEans_{\mathrm{ans}} (×100\times100) ↓\downarrowBriergen_{\mathrm{gen}} (×100\times100) ↓\downarrow
MBPP (500)
Threshold (Fast-dllm)39.4047.6350.0146.14
Base Entropy41.20 (+4.57)44.51 (+6.53)46.84 (+6.33)43.48 (+5.76)
Info-gain41.270.61_{0.61} (+4.74)44.960.50_{0.50} (+5.59)48.010.52_{0.52} (+4.00)43.520.26_{0.26} (+5.67)
BAYESER41.330.58_{0.58} (+4.91)43.570.67_{0.67} (+8.52)45.890.66_{0.66} (+8.23)42.700.45_{0.45} (+7.46)
HumanEval (164)
Threshold (Fast-dllm)18.2969.0566.5062.26
Base Entropy22.56 (+23.33)63.34 (+8.26)60.48 (+9.04)57.46 (+7.70)
Info-gain15.652.31_{2.31} (−14.44)70.512.11_{2.11} (−2.11)68.381.89_{1.89} (−2.84)62.951.39_{1.39} (−1.11)
BAYESER23.170.00_{0.00} (+26.67)62.760.02_{0.02} (+9.11)59.810.03_{0.03} (+10.06)56.990.07_{0.07} (+8.46)
GSM8K (1,319)
Threshold (Fast-dllm)76.1217.4920.5920.63
Base Entropy75.51 (−0.80)17.11 (+2.21)20.98 (−1.89)20.64 (−0.05)
Info-gain78.090.53_{0.53} (+2.59)15.870.50_{0.50} (+9.27)20.210.58_{0.58} (+1.87)18.880.45_{0.45} (+8.53)
BAYESER75.920.37_{0.37} (−0.27)16.670.37_{0.37} (+4.68)20.640.40_{0.40} (−0.21)20.240.30_{0.30} (+1.89)
MATH500 (500)
Threshold (Fast-dllm)38.0053.6855.2351.44
Base Entropy38.20 (+0.53)52.13 (+2.90)55.01 (+0.41)49.67 (+3.43)
Info-gain37.730.42_{0.42} (−0.70)53.810.43_{0.43} (−0.23)57.350.60_{0.60} (−3.84)51.080.41_{0.41} (+0.69)
BAYESER35.400.72_{0.72} (−6.84)54.600.75_{0.75} (−1.71)58.350.57_{0.57} (−5.64)51.480.64_{0.64} (−0.08)
Sudoku (500)
Threshold (Fast-dllm)85.609.579.5710.42
Base Entropy81.80 (−4.44)12.85 (−34.35)12.85 (−34.35)11.99 (−15.05)
Info-gain78.271.10_{1.10} (−8.57)10.101.14_{1.14} (−5.54)10.101.14_{1.14} (−5.54)14.850.66_{0.66} (−42.48)
BAYESER85.471.47_{1.47} (−0.16)9.810.24_{0.24} (−2.49)9.810.24_{0.24} (−2.49)10.260.82_{0.82} (+1.57)
Countdown (1,000)
Threshold (Fast-dllm)35.1053.6552.1448.39
Base Entropy29.70 (−15.38)54.08 (−0.80)50.65 (+2.85)47.92 (+0.97)
Info-gain39.571.55_{1.55} (+12.73)49.281.23_{1.23} (+8.14)46.991.05_{1.05} (+9.88)45.381.04_{1.04} (+6.22)
BAYESER28.830.38_{0.38} (−17.85)54.070.33_{0.33} (−0.78)51.020.36_{0.36} (+2.14)47.680.20_{0.20} (+1.46)

Table 6. LLaDA full-test results. Accuracy is reported in percent; ECE and generated-content Brier values and their standard deviations are multiplied by 100. Subscripts are the standard deviations of three seeds on the corresponding column scale. Numbers in parentheses are relative percentage improvements over confidence-thresholding decoding. Bold values indicate the best result and underlined values indicate the second-best result per metric within each benchmark, including ties.

Mutual-information ranking and Bayesian entropy decoding

We compare MIRANK with BAYESER on the first 128 examples of MBPP and GSM8K. The grid uses Ls∈{1,2,4}L_s \in\{1,2,4\}, λ∈{100,200,500,1000,2000}\lambda\in\{100,200,500,1000,2000\}, and τB∈{0.85,0.90}\tau_B \in\{0.85,0.90\} for BAYESER.

LsL_sλ\lambdaMIRANK Acc.MIRANK ECEg_gMIRANK ECEa_aMIRANK StepsBAYESER, τB=0.85\tau_B=0.85 Acc.BAYESER, τB=0.85\tau_B=0.85 ECEg_gBAYESER, τB=0.85\tau_B=0.85 ECEa_aBAYESER, τB=0.85\tau_B=0.85 StepsBAYESER, τB=0.90\tau_B=0.90 Acc.BAYESER, τB=0.90\tau_B=0.90 ECEg_gBAYESER, τB=0.90\tau_B=0.90 ECEa_aBAYESER, τB=0.90\tau_B=0.90 Steps
110028.9110.8910.7725.7434.388.406.61100.7040.6312.6210.4493.91
120048.4419.6321.5538.0257.0316.4218.1459.3855.4719.2720.0467.27
150054.6927.7830.5839.1157.8125.7727.8943.2657.8127.0229.1945.13
1100053.1330.6233.0943.2557.8127.1829.1637.3658.5927.3029.6042.54
1200057.8126.3429.2740.4457.8127.5629.5037.6257.0329.3731.6042.23
210028.1316.8717.8320.919.3814.2016.24123.175.4718.0422.09123.62
220045.3115.0516.1133.4855.4713.0314.7472.1753.1315.1017.6476.32
250052.3429.3932.0842.0560.9422.6424.6242.0956.2527.8629.8546.04
2100054.6929.1332.0139.0857.8127.1029.0037.6557.0328.6230.9743.27
2200053.1330.6732.9640.8459.3825.9327.9039.1157.8128.4930.6142.89
410028.9126.4427.7221.880.0038.7238.58224.400.0037.8137.89222.68
420042.1912.8511.2927.8246.095.0410.20112.1846.096.2710.23119.48
450053.1326.6128.9540.5258.5923.3625.5146.1356.2526.0428.2948.66
4100058.5924.6727.1141.9959.3825.2227.1739.1057.8127.5029.8444.98
4200057.8126.0928.4840.4158.5926.8728.7437.0558.5927.6529.8042.36

Table 7. Comparison between MIRANK and BAYESER on 128 examples of MBPP. Accuracy is in percent; both ECE columns are multiplied by 100.

LsL_sλ\lambdaMIRANK Acc.MIRANK ECEg_gMIRANK ECEa_aMIRANK StepsBAYESER, τB=0.85\tau_B=0.85 Acc.BAYESER, τB=0.85\tau_B=0.85 ECEg_gBAYESER, τB=0.85\tau_B=0.85 ECEa_aBAYESER, τB=0.85\tau_B=0.85 StepsBAYESER, τB=0.90\tau_B=0.90 Acc.BAYESER, τB=0.90\tau_B=0.90 ECEg_gBAYESER, τB=0.90\tau_B=0.90 ECEa_aBAYESER, τB=0.90\tau_B=0.90 Steps
110059.3831.5612.8430.3958.5931.5016.28102.6363.2838.0815.94118.50
120064.8410.1419.3441.8377.345.5615.7670.5775.786.6516.9577.88
150078.914.6118.3749.3479.698.3713.5156.2975.789.1017.8163.16
1100077.348.2119.7852.7076.5610.0818.8053.7278.137.4516.3860.42
1200077.349.3917.3851.3876.569.0918.5653.3878.137.6317.3261.18
210044.5325.7912.2727.0867.1937.9712.24110.5564.8438.5114.77122.64
220064.065.6817.2337.9973.448.0612.9576.5175.005.9618.1788.73
250075.786.8416.1549.7980.479.6914.0657.1482.034.9614.4665.91
2100078.136.4316.8752.2179.6911.5015.8553.6781.254.0415.1261.98
2200072.6610.9122.9454.5279.6910.0814.7954.4180.475.9414.9760.62
410048.4444.5633.9526.0217.1925.2331.09206.0119.5328.3023.09206.45
420063.2825.3115.0134.5267.9719.2117.75103.8672.6622.0912.85109.77
450071.886.9120.1952.2876.5610.8917.4960.3079.699.8615.9069.25
4100079.6910.2214.4552.4979.697.5316.2655.6179.696.2917.0962.16
4200078.135.6217.9654.4175.7810.3817.5554.1378.917.6916.1362.65

Table 8. Comparison between MIRANK and BAYESER on 128 examples of GSM8K. Accuracy is in percent; both ECE columns are multiplied by 100.

References

  1. [1]Heli Ben-Hamu, Itai Gat, Daniel Severo, Niklas Nolte, and Brian Karrer. Accelerated sampling from masked diffusion models via entropy bounded unmasking. In Advances in Neural Information Processing Systems, 2025. URL https://arxiv.org/abs/2505.24857.
  2. [2]Glenn W. Brier. Verification of forecasts expressed in terms of probability. Monthly Weather Review, 78(1):1–3, 1950.doi.org/10.1175/1520-0493(1950)078<0001:vofeit>2.0.co;2
  3. [3]Dake Bu, Wei Huang, Andi Han, Si Wu, Hau-San Wong, Qingfu Zhang, Taiji Suzuki, and Atsushi Nitanda. DPRM: A plug-in Doob h-transform-induced token-ordering module for discrete diffusion models, 2026. URL https://arxiv.org/abs/2604.24357.
  4. [4]Huiwen Chang, Han Zhang, Lu Jiang, Ce Liu, and William T. Freeman. Maskgit: Masked generative image transformer. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2022.arxiv.org/abs/2202.04200
  5. [5]Erik Daxberger, Agustinus Kristiadi, Alexander Immer, Runa Eschenhagen, Matthias Bauer, and Philipp Hennig. Laplace redux — effortless Bayesian deep learning. In Advances in Neural Information Processing Systems, 2021.arxiv.org/abs/2106.14806
  6. [6]Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q. Weinberger. On calibration of modern neural networks. In Proceedings of the 34th International Conference on Machine Learning, volume 70 of Proceedings of Machine Learning Research, pp. 1321–1330. PMLR, 2017. URL https://proceedings.mlr.press/v70/guo17a.html.arxiv.org/abs/1706.04599
  7. [7]Neil Houlsby, Ferenc Huszár, Zoubin Ghahramani, and Máté Lengyel. Bayesian active learning for classification and preference learning, 2011. URL https://arxiv.org/abs/1112.5745.
  8. [8]Edward J. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. LoRA: Low-rank adaptation of large language models, 2021. URL https://arxiv.org/abs/2106.09685.
  9. [9]Metod Jazbec, Eliot Wong-Toi, Guoxuan Xia, Dan Zhang, Eric Nalisnick, and Stephan Mandt. Generative uncertainty in diffusion models. arXiv preprint arXiv:2502.20946, 2025. URL https://arxiv.org/abs/2502.20946.
  10. [10]Metod Jazbec, Theo X. Olausson, Louis Béthune, Pierre Ablin, Michael Kirchhof, João Monteiro, Victor Turrisi, Jason Ramapuram, and Marco Cuturi. Learning unmasking policies for diffusion language models. In International Conference on Machine Learning, 2026. URL https://arxiv.org/abs/2512.09106.
  11. [11]Siqi Kou, Lei Gan, Dequan Wang, Chongxuan Li, and Zhijie Deng. BayesDiff: Estimating pixel-wise uncertainty in diffusion via Bayesian inference. arXiv preprint arXiv:2310.11142, 2023. URL https://arxiv.org/abs/2310.11142.
  12. [12]Sanghyun Lee, Seungryong Kim, Jongho Park, and Dongmin Park. Lookahead unmasking elicits accurate decoding in diffusion language models, 2025. URL https://arxiv.org/abs/2511.05563.
  13. [13]Yansi Li, Gongshen Liu, and Zhuosheng Zhang. The confidence paradox: Unveiling the latent discriminative power of diffusion large language models in mathematical reasoning. In Maria Liakata, Viviane P. Moreira, Jiajun Zhang, and David Jurgens (eds.), Findings of the Association for Computational Linguistics: ACL 2026, pp. 43179–43196, San Diego, California, United States, July 2026. Association for Computational Linguistics. ISBN 979-8-89176-395-1. doi: 10.18653/v1/2026.findings-acl.2142. URL https://aclanthology.org/2026.findings-acl.2142/.DOI
  14. [14]David J. C. MacKay. A practical Bayesian framework for backpropagation networks. Neural Computation, 4(3):448–472, 1992.DOI
  15. [15]James Martens and Roger Grosse. Optimizing neural networks with Kronecker-factored approximate curvature. In International Conference on Machine Learning, pp. 2408–2417, 2015.arxiv.org/abs/1503.05671
  16. [16]Mahdi Pakdaman Naeini, Gregory F. Cooper, and Milos Hauskrecht. Obtaining well calibrated probabilities using bayesian binning. In Proceedings of the Twenty-Ninth AAAI Conference on Artificial Intelligence, pp. 2901–2907, 2015. doi: 10.1609/aaai.v29i1.9602.
  17. [17]Shen Nie, Fengqi Zhu, Zebin You, Xiaolu Zhang, Jingyang Ou, Jun Hu, Jun Zhou, Yankai Lin, Ji-Rong Wen, and Chongxuan Li. Large language diffusion models. arXiv preprint arXiv:2502.09992, 2025. URL https://arxiv.org/abs/2502.09992.
  18. [18]Hippolyt Ritter, Aleksandar Botev, and David Barber. A scalable Laplace approximation for neural networks. In International Conference on Learning Representations, 2018.
  19. [19]Subham Sekhar Sahoo, Marianne Arriola, Yair Schiff, Aaron Gokaslan, Edgar Marroquin, Justin T Chiu, Alexander Rush, and Volodymyr Kuleshov. Simple and effective masked diffusion language models. In Advances in Neural Information Processing Systems, 2024.arxiv.org/abs/2406.07524
  20. [20]Haizhou Shi, Yibin Wang, Ligong Han, Huan Zhang, and Hao Wang. Training-free Bayesianization for low-rank adapters of large language models. In Advances in Neural Information Processing Systems, 2025. URL https://arxiv.org/abs/2412.05723.
  21. [21]Yingte Shu, Yuchuan Tian, Chao Xu, Yunhe Wang, and Hanting Chen. Deferred commitment decoding for diffusion language models with confidence-aware sliding windows. arXiv preprint arXiv:2601.02076, 2026. URL https://arxiv.org/abs/2601.02076.
  22. [22]Yibin Wang, Haizhou Shi, Ligong Han, Dimitris Metaxas, and Hao Wang. BLoB: Bayesian low-rank adaptation by backpropagation for large language models. In Advances in Neural Information Processing Systems, volume 37, pp. 67758–67794, 2024.arxiv.org/abs/2406.11675
  23. [23]Chengyue Wu, Hao Zhang, Shuchen Xue, Zhijian Liu, Shizhe Diao, Ligeng Zhu, Ping Luo, Song Han, and Enze Xie. Fast-dLLM: Training-free acceleration of diffusion LLM by enabling KV cache and parallel decoding. arXiv preprint arXiv:2505.22618, 2025. URL https://arxiv.org/abs/2505.22618.
  24. [24]Adam X. Yang, Maxime Robeyns, Xi Wang, and Laurence Aitchison. Bayesian low-rank adaptation for large language models. In International Conference on Learning Representations, 2024. URL https://openreview.net/forum?id=FJiUyZ0Flm.arxiv.org/abs/2308.13111
  25. [25]Kaisen Yang, Jayden Teoh, Kaicheng Yang, Yitong Zhang, and Alex Lamb. Improving sampling for masked diffusion models via information gain, 2026. URL https://arxiv.org/abs/2602.18176.
  26. [26]Jiacheng Ye, Zhihui Xie, Lin Zheng, Jiahui Gao, Zirui Wu, Xin Jiang, Zhenguo Li, and Lingpeng Kong. Dream 7b: Diffusion large language models. arXiv preprint arXiv:2508.15487, 2025. URL https://arxiv.org/abs/2508.15487.

AI tools statement

This work lists 1 AI tool.

  • Generative AI tools and large language models · AI tool

    Roles
    SoftwareWriting — review & editing
    Verification
    self-declared at submission

Recorded on the work at submission, not per version. Names and roles are shown as submitted; roles use the CRediT taxonomy.

How AI tools are recorded

Paper details

Cite this paper

Publication

Published
Version
Latest

Data & code

No code, data or supplementary files were declared for this version.

Pick where to look, or just type