Manuscript Offprint

arXiv:2610.40278

Neighborhood Elites: Quality-Diversity Search for Uncertainty Quantification in Question Answering

Mesut Ceylan, Arda Baris Basaran, Elgar Fleisch, Filipe Barata

ABSTRACT

Large language models (LLMs) are increasingly capable, yet they produce wrong answers indistinguishable from correct ones. In question answering (QA), such an error propagates unnoticed into downstream tasks. Perturbation-based uncertainty quantification (UQ) addresses this by probing a model over a set of input rewrites and reading uncertainty from how much its predictions vary. Yet this set is usually built generically, by free paraphrasing, token-level perturbation, or adversarial search. Such rewrites leave two things uncontrolled that matter in QA: what kind of change is made to the context, and how explicitly the context supports the answer. When neither is controlled, the composition of the set is determined by the generator rather than by design, and the estimate inherits whatever that generator happens to produce. Quality-diversity (QD) search is built to cover a predefined exploration space, so we recast input perturbation as a QD problem and propose neighborhood elites (NE), a neighborhood constructor that spreads answer-preserving rewrites across two axes, the kind of edit and the explicitness of support. We compare NE against three other neighborhood constructors, holding the editor, QA model, uncertainty measure and search objective fixed, and against three scores read from the original context. Across five extractive-QA datasets and five instruction-tuned LLMs, NE improves failure detection against every other constructor in at least 24 of the 25 dataset-model pairs, reaching 0.726 AUROC and 0.211 AUPRC lift over the base rate. Additionally, NE detects failure better than semantic entropy computed over decoder samples, by 0.074 AUROC and 0.062 AUPRC lift, and this advantage widens as the neighborhood grows.

1 INTRODUCTION

Large language models (LLMs) have demonstrated strong capabilities in natural language understanding and generation (OpenAI, 2023), question answering and multi-step reasoning (Wei et al., 2022), and program synthesis (Chen et al., 2021; Li et al., 2023). Beyond single prompts, they increasingly act as the reasoning engine of larger systems, from retrieval-augmented generation (RAG) that grounds answers in external corpora (Lewis et al., 2020; Asai et al., 2023) to agentic workflows that plan and call external tools to perform tasks (Yao et al., 2023). In such pipelines, a single wrong answer can propagate through later steps (Zhang et al., 2024), so the usefulness of an LLM depends not only on producing an answer, but also on signaling whether that answer can be trusted.

LLMs hallucinate, presenting fabricated facts with the same assurance they provide to correct answers (Maynez et al., 2020; Ji et al., 2022). They tend to agree with the user rather than correct a mistaken assumption (Sharma et al., 2024), and rarely express doubt or admit when they do not know (Yin et al., 2023). Asking the model how confident it is, is not helpful, as its stated confidence is poorly aligned with its actual accuracy (Xiong et al., 2024). This motivates uncertainty quantification (UQ): estimating how much to trust an answer without relying on the model's own account of it (Malinin & Gales, 2021; Kuhn et al., 2023; Lin et al., 2024).

∗^{*}Corresponding author.

UQ methods can be categorized by the signal used to quantify uncertainty. One family relies on the predictive probabilities assigned by the model (Malinin & Gales, 2021), while another measures the variability between multiple predictions. The latter requires only model outputs and is therefore applicable in black-box settings. These approaches differ mainly in the way the predictions are produced. Sampling-based methods sample the model several times on a fixed input (Manakul et al., 2023; Farquhar et al., 2024). Perturbation-based methods instead vary the input, rewriting the prompt in ways that should not change the answer (Gao et al., 2024; Song et al., 2025). In either way, the predictions are compared by meaning rather than surface form, which is what semantic entropy measures (Kuhn et al., 2023).

In the text setting, a perturbation-based estimate is only as informative as the input variants it compares. QD algorithms (Mouret & Clune, 2015; Pugh et al., 2016), coupled with LLMs, can orchestrate the search and assembly of such a set of input variants. The LLM carries out the variations, while quality-diversity steers the search, keeping the best candidate found in each cell it explores, so the set spans many strong candidates rather than a single best one. This pairing has proven useful across domains, generating diverse code (Lehman et al., 2022), creative writing (Bradley et al., 2024), and adversarial prompts (Samvelyan et al., 2024). It is therefore a natural engine for building a set of input variants that vary systematically across a chosen feature space.

However, existing perturbation-based UQ builds this set generically, by model-generated paraphrases of the question and inserted tokens (Gao et al., 2024), or by searching over word substitutions (Song et al., 2025). A key limitation of these methods is that their rules apply to each rewrite on its own, rather than to the set as a whole. A rewrite is described by the operation applied and by how far it moved from the original, and not by its relation to the answer, though a rephrased question can ask for the same answer more or less directly. The composition of the set is therefore determined largely by the generator, rather than by design.

In extractive QA, a perturbation set has to control two dimensions: how the context is modified and how explicitly the rewrite still supports the answer. The answer is inside of the rewritten input, so a rewrite changes its support whether or not anything records the change. Two contexts can preserve the same answer while differing substantially in how directly they support it: a rewrite may keep the answer in place but reach its support through a referring expression or spread that support across several sentences. The answer has not changed, but recovering it now places greater demands on the model.

To this end, we propose a new perturbation-based UQ method built on a QD search that systematically constructs a variation set across a predefined descriptor space. We refer to this set as the neighborhood of the input. We hypothesize that uncertainty estimated over such structured neighborhoods contains a richer uncertainty signal for detecting model failures than uncertainty derived from less structured variations or repeated sampling of the original input. Since the context passage already contains the answer, the neighborhood consists of whole-passage rewrites leaving that answer unchanged. The search steers the generator toward specified combinations of edit type and answer support, targeting one cell after another rather than accepting whatever it produces. We show that neighborhoods built this way detect failure better than those from free paraphrasing and two alternative constructors. This advantage also holds over repeated decoder sampling on the original context when using the same uncertainty measure. Our contributions are as follows.

• Problem formulation. We propose the notion of an input neighborhood for extractive QA and formulate its construction as a coverage problem over a space with two axes: three kinds of edit and four levels of answer support. A rewrite’s coordinates are fixed by deterministic rules rather than by a model judging its own output. To our knowledge, this is the first perturbation set for UQ built by QD search to cover a space declared in advance.

• Method. We introduce neighborhood elites (NE), an LLM-guided QD search that steers an editor toward the empty cells of a descriptor space spanned by edit type and answer support, and admits a rewrite only when a deterministic check confirms the requested edit was realized. Its rewrites compound along a lineage, each inheriting an already-edited context and applying one further answer-preserving edit, so the neighborhood reaches contexts that no single edit of the original could produce.

• Empirical evaluation. We show across five extractive-QA datasets and five instruction-tuned LLMs that NE improves failure detection over every other constructor in at least 24 of the 25 dataset–model pairs, reaching 0.726 AUROC and 0.211 AUPRC lift over the base rate. It exceeds

Figure

Figure 1: A MAP-Elites search builds a per-instance archive of answer-preserving context rewrites spread over the descriptor space D\mathcal{D} (Section 2.2). The frozen QA model fθf_{\theta} is queried on K of them, and the semantic entropy of its answers is the uncertainty signal (Section 2.3).

semantic entropy over decoder samples by 0.074 AUROC and 0.062 AUPRC lift, at the same measure, predictions and instances. Its neighborhoods span roughly twice as many kinds of rewrite as the nearest constructor. NE gains 0.100 AUROC as its neighborhood grows from three rewrites to seven while decoder sampling gains 0.030 from the same number of samples.

References (53)