arXiv:2610.03480cs.LGOct 2026

Manuscript Offprint

arXiv:2610.03480

Metropolis-Hastings Dominates Importance Resampling for Policy Composition

Alexey Kurennoy, Ramil Yarullin, Fergal Reid

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Post-training a large language model (LLM) often requires exploring trade-offs between multiple rewards, but retraining for each trade-off is expensive. Decoding-time policy composition allows these trade-offs to be adjusted by combining reward-specific policies at inference time. This composition targets a weighted product of the policies' probabilities over complete responses, but standard implementations combine their next-token probabilities, generally introducing sampling bias. We analyze a known iterative correction based on independence Metropolis–Hastings (MH). Our main result shows that, for every rollout budget, MH produces an output distribution at least as close to the target as sampling-importance-resampling (SIR) with the same budget, as measured by every convex f-divergence. We also derive a lower bound on MH's improvement over the uncorrected decoder in a consensus objective measuring agreement with the supplied policies. We further characterize the correction's sampling error in two asymptotic regimes: when the reward-specific policies approach agreement, and when fluctuations in the log ratio between target and uncorrected-decoder probabilities grow, as can happen for long responses. We complement our analysis with experiments in enumerable and LLM-scale settings.

1 INTRODUCTION

Large language model (LLM) alignment involves balancing objectives such as helpfulness, safety, factual accuracy, and brevity (Bai et al., 2022; Dai et al., 2024; Wu et al., 2023; Wang et al., 2024). Doing so requires exploring different trade-offs, but retraining a policy for every trade-off is expensive. Decoding-time composition offers an alternative: it takes policies optimized individually for each objective and combines them at inference time (Shi et al., 2024; Shen et al., 2026). By varying the weights of the reward-specific policies in the composition, one can explore different trade-offs without retraining.

The composition aims to sample from a weighted geometric average of complete-response probabilities:

p^w(y∣x)∝∏i:wi>0πi(y∣x)wi,wi≥0,∑i=1mwi=1,(1)\widehat{p}_{w}(y\mid x)\propto\prod_{i:w_{i}>0}\pi_{i}(y\mid x)^{w_{i}},\qquad w_{i}\geq0,\quad\sum_{i=1}^{m}w_{i}=1, \tag{1}

where πi(y∣x)\pi_i(y \mid x) is the probability that policy ii assigns to response yy given prompt xx. However, sampling from the target (1) token by token generally requires summing over all possible continuations. A practical decoder instead multiplies the next-token probabilities and normalizes at each step. We call this process local product decoding. The two constructions generally differ because the policies can agree on next-token probabilities but disagree on later continuations (see Example 1). The sequence target accounts for the total product mass of these continuations, whereas the local rule ignores it. Consequently, even exact reward-specialized policies can produce a biased decoder for their combined objective.

Let qwq_w denote the local decoder and ρw\rho_w the product of its stepwise normalization constants. Then p^w∝qwρw\widehat{p}_w \propto q_w \rho_w. Each rollout therefore provides its importance weight: the target-to-proposal probability ratio, up to a response-independent constant. The independence Metropolis–Hastings (MH)

∗^{*}Equal contribution.

Local bias from policy disagreement

Figure

Exact error versus budget

Figure

Figure 1: Local bias and finite-budget correction in Example 1. Left: the two policies agree after j=0j = 0 and disagree after j=1j = 1. Reweighting the local law qwq_w by the recorded normalizers ρw\rho_w recovers the uniform target. Right: exact KL to the target for MH and ordinary SIR on the same four-response toy example.

construction of Gareev et al. (2024) uses these weights to accept or reject independently generated responses. It requires additional rollouts, but no separate reward model or post-generation model evaluation to score a candidate. Proposals can be batched, with selection performed afterward.

An alternative to MH is sampling-importance-resampling (SIR), which selects a candidate with probability proportional to its importance weight. Both MH and SIR use the same recorded information and the same budget of M rollouts, including initialization.

In this paper, we present a new theoretical analysis of the MH correction. Our central result states that at every budget M, MH's output distribution is at least as close to the sequence target as ordinary SIR's under every convex f-divergence. In more detail, our contributions are as follows.

  1. We prove that MH is no farther from the target than ordinary SIR at any budget. Moreover, for KL in both directions and total variation, MH is strictly closer for M≥2M \geq 2 whenever the local decoder differs from the target (Theorem 1).

  2. We derive a lower bound on MH's improvement over the uncorrected decoder in a consensus objective measuring agreement with the supplied policies. The bound can be estimated directly from quantities recorded during generation, and we give conditions under which it extends to scalarized reward optimization (Proposition 1).

  3. We characterize the behavior of the correction's sampling error in two asymptotic regimes. The first regime concerns reward-specific policies approaching agreement. In this setting, MH's sampling error decays at a higher asymptotic order than SIR's (Theorem 2). The second regime captures limitations that can arise for long responses. In this regime, both MH and SIR attain the asymptotically minimal total variation error among methods selecting from independently generated rollouts at the same budget (Theorem 3).

We complement the theory with experiments in enumerable and LLM-scale settings (Section 4). 1^{1}

References (100)

Couldn't load all references. Reload the page to try again.