arXiv:2611.25003cs.LGNov 2026

Manuscript Offprint

arXiv:2611.25003

A Model of Diverse Sampling from Language Models

Manuel Prada-Corral, Yahya Emara, Timothy J. O'Donnell, Ryan Cotterell, Tim Vieira

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

Abstract

Language models often produce high-quality individual samples but poor sets, with repeated samples clustering around the same semantic modes. We formalize diverse generation as sampling a size-K{K} subset of complete strings from a determinantal point process (DPP), where the likelihood encodes item quality, and the embedding geometry encodes repulsion between similar outputs. Exact inference over all strings is intractable, so we propose PoolDPP: draw a finite candidate pool from a tractable proposal, importance-weight the candidates toward the target quality, and run a K{K}-DPP sampler on the induced pool kernel; a greedy MAP variant provides deterministic selection. We prove a finite-sample bound with an explicit constant: the KL divergence between the sampler’s output and the target K{K}-DPP decays as O(1/N)\mathcal{O}(1/N) in the pool size. Empirically, PoolDPP extends the quality–diversity frontier on open-ended generation and the precision–recall frontier on ambiguous text-to-SQL (Ambrosia), and on mathematical reasoning (GSM8K), it raises diversity at about the same pass@K{K}.

Figure https://github.com/rycolab/pool-dpp

1 Introduction

Search engines gave us pages of results; we browsed and chose. In contrast, language models often give us just one authoritative-sounding answer. However, for important questions—where multiple perspectives exist, or the right answer depends on context—we might want that plurality back. For example, when answering ambiguous questions, a model should surface multiple valid interpretations rather than commit to a single one (Saparina and Lapata, 2024). Pushing the language model’s regenerate button 10 times yields 10 distinct outputs, but they often cluster around the same idea, phrased slightly differently. This makes sense because the model generates each string independently; it has no notion of what it means for a set of 10 strings to be diverse.

Figure 1: Diverse implementations of sorting. Each point is a sorting-algorithm implementation, embedded by a code language model and projected to 3D with PCA; colors denote algorithm family. The 33-DPP assigns subset probability proportional to the squared volume of the parallelepiped spanned by the selected quality-scaled embeddings—large when the selected items are individually high-quality (large norms) and mutually dissimilar. The highlighted triple has high probability because it combines implementations from distinct algorithmic strategies, yielding a large spanned volume; by contrast, choosing three variants from the same cluster (e.g., three quicksorts) produces nearly parallel embeddings and thus near-zero volume despite high individual quality.

Why do samples cluster? Because nothing in the sampling process discourages similarity. Temperature sampling broadens the distribution over next tokens, but it does not model relationships between outputs---two samples may independently land in the same high-probability region. Diverse decoding methods based on beam search (Vijayakumar et al., 2018; Meister et al., 2021b) inject heuristics during decoding, but they lack a globally coherent notion of what it means for two strings to be similar or for a set to be diverse. These approaches are attractive because they are fast, but they are documented to produce artifacts such as incoherence or sudden shifts in topic (Ippolito et al., 2019; Tevet and Berant, 2021). Other work has explored adopting sampling-without-replacement schemes in LMs (Kool et al., 2019; Meister et al., 2021a), but the notion of similarity in these models is exact equality. Thus, these methods tend to cluster like independent samples. To get diverse outputs, we need to define similarity and then explicitly discourage it.

We formalize diverse sampling as a probabilistic model over subsets of strings using determinantal point processes (Kulesza and Taskar, 2012, DPPs;). The key ingredient is a similarity function: we represent each string by its embedding (e.g., from a pretrained sentence embedder) scaled by its quality, so that the direction encodes meaning and the magnitude encodes quality. Two strings are similar if their embeddings point in roughly the same direction. A DPP assigns probability to subsets proportional to the squared volume spanned by their quality-scaled embeddings—large when items are high-quality and point in different directions, near-zero when they are redundant. This gives us a well-defined distribution over sets: one that assigns high probability to sets of K{K} strings that are individually good and collectively spread out, with a parameter that controls the balance between quality and diversity. Figure 1 illustrates this in the context of generating meaningfully different sorting algorithm implementations.

Since exact inference in this DPP over all strings is intractable, we propose PoolDPP, a finite-pool approximation. PoolDPP draws NN candidate strings from a tractable proposal, importance-weights them toward a globally tempered quality distribution, and applies a K{K}-DPP on the resulting pool. The same pool kernel supports two inference modes: stochastic K{K}-DPP sampling (PoolDPP-Sampling) and greedy MAP selection (PoolDPP-MAP). For the sampling mode, we prove a non-asymptotic approximation guarantee: the KL divergence between the marginal output law of PoolDPP-Sampling (its output distribution, averaged over random pools) and the target K{K}-DPP decreases as O(1/N)\mathcal{O}(1/N) with the pool size. The bound’s constant is explicit, and we evaluate it on each task, on instances built from its pools rather than on the full proposal; the MAP mode has no distributional guarantee. Empirically, PoolDPP extends the quality–diversity frontier on open-ended generation and the precision–recall frontier on ambiguous text-to-SQL. On mathematical reasoning, it raises diversity at about the same pass@K{K} (within 0.010.01; § 6.3), and we measure how weakly the embedders separate correct from incorrect reasoning chains.