Composable Decoding on the Probability Simplex: Theory and Implementation

Xiaotong Ji, Ahmed Khaled Khamis, Rasul Tutunov, Matthieu Zimmer, Haitham Bou-AmmararXiv 2026

This paper from researchers at Huawei Noah’s Ark Lab and UCL reframes the "black art" of large language model (LLM) decoding as a principled optimization problem. By treating decoding as a search for an optimal distribution on the probability simplex, the authors provide a unified framework that not only explains existing methods like Top-K and Nucleus sampling but also allows for the creation of new, "composable" decoders.

TL;DR

The authors formulate LLM decoding as a regularized optimization problem on the probability simplex, unifying disparate sampling "tricks" into a single theoretical framework. They introduce COMPOSIMPLEX, a library that allows practitioners to build custom decoders by composing multiple distributional objectives (e.g., fidelity vs. diversity) without needing model retraining or external reward models.

What Problem Does This Paper Address?

In the current LLM stack, decoding is often treated as a collection of isolated heuristics. Practitioners choose from a "shelf of tricks"—greedy decoding for logic, temperature sampling for creativity, or Top-P (nucleus) sampling to avoid the "unreliable tail" of distributions.

However, these methods are often tuned by trial and error, and there is little theoretical understanding of how their underlying objectives relate. Furthermore, it is difficult to combine these goals. If you want a decoder that stays faithful to the model's original intent (low KL divergence) while simultaneously ensuring a diverse set of answers for a "Best-of-N" reranking setup, there hasn't been a principled way to "mix" these preferences at the token level.

Methods

The core insight is that a decoder doesn't have to pick a token directly; it can first choose a distribution over tokens by solving an optimization problem:

$$\mathbf{q}^*_t = \arg \max_{\mathbf{q} \in \Delta(V)} [ \langle \mathbf{q}, \mathbf{s}_t \rangle - \lambda \Omega(\mathbf{q}) ]$$

Where $\mathbf{s}_t$ are the model scores (logits), $\Omega(\mathbf{q})$ is a regularizer encoding structural preferences (like diversity or sparsity), and $\lambda$ is the regularization strength.

Key Innovations:

  • Unified Theory: The authors prove that standard decoders are just special cases of this formula. For example, Softmax sampling is the optimum under Shannon entropy regularization, while Sparsemax emerges from an $\ell_2$ penalty.
  • Objective Composition: Because the framework is based on optimization, you can sum multiple regularizers ($\sum \alpha_i \Omega_i$) to create hybrid decoders.
  • Mirror Ascent Solver: Since composed objectives often lack closed-form solutions, the authors use Mirror Ascent to solve the optimization at each decoding step. This iterative approach is efficient because it reuses model logits and doesn't require extra forward passes.
  • Best-of-K (BoK) Decoding: A new decoding strategy introduced here that specifically optimizes for "coverage"—ensuring that across $K$ independent samples, the model explores a high-quality and diverse set of candidate tokens.
Figure 1: Overview of composable decoding and the COMPOSIMPLEX library. Given model scores st, a decoder is configured by (a) a support constraint Ct, (b) regularisers Ωi and (c) a simplex solver. The weighted regularisers are optimised jointly to construct (d) the next-token distribution q⋆ t .

Datasets

The authors evaluated their framework across four diverse benchmarks using models ranging from 1.2B to 26B parameters:

  • MATH500: Mathematical reasoning (Qwen2.5-7B).
  • GPQA Diamond: Graduate-level science questions (Qwen3-4B-Base).
  • IFEval: Verifiable instruction following (LFM2.5-1.2B-Base).
  • LiveCodeBench v6: Competitive programming and code generation (Gemma-4-26B-A4B-IT).

Key Insights and Ideas

  • Decoders are defined by "What," not "How": The authors argue that decoders should be categorized by the objective they implicitly optimize, rather than the mechanics of how they sample.
  • Pareto Optimality in Decoding: Composed decoders can reach performance profiles that individual primitives cannot. For instance, a composition can maintain high single-sample accuracy while significantly boosting the diversity of multiple samples.
  • Regularization as a Precision Tool: The results suggest that proper regularization can effectively "concentrate" probability mass on correct completions, leading to higher Pass@1 scores than standard base samplers.
  • Efficiency: While iterative, the Mirror Ascent solver only adds a manageable overhead (roughly 1.1x to 2.9x latency) compared to standard decoding, which is a small price to pay for significantly better distributional control.

Key Results

The authors used radar plots to show how compositions balance different metrics like accuracy (Pass@k) and semantic diversity (SemDiv).

Figure 2: Performance profiles across MATH500 (Qwen2.5-7B), GPQA Diamond (Qwen3-4B- Base), IFEval (LFM2.5-1.2B-Base), and LiveCodeBench v6 (Gemma-4-26B-A4B-IT). Each panel compares a standard sampler with selected individual and composed objectives under the indicated support rule. The axes show the accuracy and diversity metrics labelled in each panel.
  • MATH500: A composition of KL-divergence and Diversity matched the high Pass@1 of KL-only decoding (64.4%) but improved the Pass@16 from 88.4% to 90.0%.
  • GPQA: Compositions frequently achieved non-dominated points on the Pareto frontier, outperforming individual regularizers in multi-sample success.
  • Robustness: Composed decoders remained more robust under strong regularization compared to single primitives, which often saw performance collapses when $\lambda$ was set too high.

Limitations and Future Work

  • Local vs. Global Optimization: The current framework optimizes the next-token distribution (local). The authors note that extending this to sequence-level (global) optimization is a natural next step.
  • Hyperparameter Complexity: Composing objectives introduces new weights ($\alpha_i$) and strengths ($\lambda$) to tune, which may require automated search strategies in production environments.
  • Integration with Reward Models: While this work focuses on directly computable preferences (like entropy or KL), the authors suggest the framework could eventually incorporate external reward models or learned critics for even finer control.

The COMPOSIMPLEX library is open-sourced, providing a flexible playground for researchers to move beyond "isolated tricks" and toward a more engineering-centric approach to LLM generation.

Summary updated

BibTeX
@misc{ji2026composable,
  author = {Xiaotong Ji and Ahmed Khaled Khamis and Rasul Tutunov and Matthieu Zimmer and Haitham Bou-Ammar},
  title = {{Composable Decoding on the Probability Simplex: Theory and Implementation}},
  year = {2026},
  eprint = {2609.34992},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2609.34992},
}
Figure