Task-Awareness Improves LLM Generations and Uncertainty
Tim Tomov, Dominik Fuchsgruber, Stephan Günnemann · 2026
Read Task-Awareness Improves LLM Generations and Uncertainty by Tim Tomov, Dominik Fuchsgruber, Stephan Günnemann (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2601-21500.txt.
Introduction
Tim Tomov, Dominik Fuchsgruber, and Stephan Günnemann make language model answers respect the hidden structure of the task. Many replies carry an inner form, such as a label, a number, or a graph. Standard decoding and uncertainty tools work only on the text and ignore that form.
The authors model outputs directly in a latent space shaped by the task. Knowing the task in advance improves both the answers and the model's sense of its own doubt. A model that knows it is choosing a label can weigh options more sanely. The gain is better calibration where answers feed real decisions.
Catalog record
| CREATOR | Tim Tomov, Dominik Fuchsgruber, Stephan Günnemann |
|---|---|
| YEAR | 2026 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 73 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2601-21500
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
Task-Awareness Improves LLM Generations and Uncertainty Tim Tomov, Dominik Fuchsgruber, Stephan Günnemann Abstract In many applications of LLMs, natural language responses often have an underlying structure such as representing discrete labels, numerical values, or graphs. Yet, existing decoding and uncertainty estimation methods operate only in language space and largely disregard structural information. We address this by modeling LLM outputs directly in a task-dependent latent structure. By equipping this structure with a dissimilarity measure, we can compute Bayes-optimal responses. These are not selected from sampled generations but are newly synthesized by combining individual responses in the latent space. Across different tasks, Bayes-optimal responses consistently outperform standard decoding methods like beam search. Moreover, quantifying uncertainty via the induced Bayesian risk captures variations in terms of the latent structure and improves alignment with output quality and correctness. Our decision-theoretic framework is applicable to any problem that admits a latent response structure and enables reliable task-aware LLM predictions. 1 Introduction Figure 1 : Framework of embedding LLM responses s\mid x into a task-dependent latent space \mathcal{L} on the example of set-based multi-answer question answering. The Bayes-optimal \ell_{\text{Bayes}} response is the centroid in the latent space w.r.t. a distance metric d_{T} . It does not need to be generated by the LLM directly. Uncertainty is quantified as Bayesian risk that measures the spread in p(\ell\mid x) w.r.t. to d_{T} . Large language models (LLMs) have emerged as highly general-purpose systems, successfully generalizing across tasks ranging from factual question answering ( Kuhn et al. 2023 ; Duan et al. 2024 ) to machine translation ( Vilar et al. 2023 ) , and text summarization ( Zhang et al. 2024 ) , among many others ( Raiaan et al. 2024 ; Hadi et al. 2023 ) . When prompting LLMs, the semantics of the response are unknown a priori, but the domain of the expected output is often implicitly given. For example, when asking “What is the capital of Namibia?”, the output should be a city. Similarly, when asking an LLM to rate an essay on a scale from 0 to 10, one expects the output to be a number within this range. While LLMs are trained to generate responses in natural language, the task itself is often associated with a clear task-specific latent structure . Compared to free-form natural language, these latent structures are typically better suited for interpreting and comparing LLM predictions in downstream settings. In many automated workflows, decisions depend on the task-level semantics rather than the linguistic properties. Consequently, LLM outputs are commonly post-processed to recover a task-specific representation such as a numeric score or categorical label ( Mekala et al. 2023 ; Zhong et al. 2024 ; Lukasik et al. 2024 ) . In short: The latent representations of LLM responses are often more useful than the text itself . We leverage this insight to improve the generation quality of LLMs and the corresponding estimates of their uncertainty. To that end, we introduce a highly general framework which can be used for any task that admits a latent response structure. Defining a mapping from natural language to the task-specific latent representation induces an LLM’s predictive distribution in the latent space. Utilizing a task-dependent notion of similarity in the latent structure, we perform Minimum Bayes Risk (MBR) decoding ( Kumar & Byrne 2004 ) to obtain a Bayes-optimal response in the latent space . This response needs not to correspond to any of sampled generations and can instead be synthesized by aggregating information across the model’s full output distribution. This is in general not possible in the domain of raw language responses. At the same time, variability in the latent space with respect to the task-specific dissimilarity yields an uncertainty estimate that directly reflects the notion of error relevant to the task, naturally quantified as Bayes risk . We demonstrate the effectiveness of our framework over a broad range of tasks: Single-answer and multi-answer question answering, text summarization, and machine translation. Across all settings, Bayes-optimal latent responses consistently outperform other decoding schemes, such as beam search or self-consistency ( Wang et al. 2023 ) . At the same time, the Bayes risk provides uncertainty estimates that are more informative than existing approaches in terms of the correctness and quality of the corresponding responses. 2 Latent Structures Enable Better LLM Generations and Uncertainty Quantification LLMs implicitly define a probability distribution over arbitrary-length strings s\in\mathcal{V}^{\infty} from a vocabulary \mathcal{V} , which we denote by p(s) . Conditioning on an input prompt x\in\mathcal{V}^{\infty} yields the predictive distribution p(s\mid x) . In downstream applications, these responses inherently admit a task-specific representation beyond free-form language . For example, problems like question answering (QA) restrict the LLM’s outputs to a discrete support set. In rating problems answers are embedded as reals or ordinals. Treating LLM responses as latents in some structure also has the benefit of enabling further application-specific processing. Formally, let T be a task with an associated latent space \mathcal{L} . We define an encoding function g_{T}:\mathcal{V}^{\infty}\to\mathcal{L} that projects any generated string s onto its task-dependent latent representation \ell (e.g., a real number, a categorical class label). Figure 1 shows an example from multi-answer QA where g_{T} maps raw strings to a set of possible answers. The mapping g_{T} then induces a push-forward distribution of the LLM’s responses over latent responses \ell p(\ell\mid x)\;=\;\sum_{s\in\mathcal{V}^{\infty}}p(s\mid x)\,\mathbf{1}\!\left[g_{T}(s)=\ell\right]. (1) To compare the generations s in the latent space \mathcal{L} , we equip \mathcal{L} with an appropriate dissimilarity measure. In principle, any measure d:\mathcal{L}\times\mathcal{L}\to\mathbb{R}_{\geq 0} is possible, but instantiating d with a proper metric has desirable properties regarding uncertainty estimation as we will detail in Section 2.2 . Any particular choice of d encodes a task-specific notion of error, for example, the Hamming distance, F1 score, or 0 - 1 loss. 2.1 Structure-Aware Minimum Bayes Risk Decoding We directly leverage this structure-dependent representation to synthesize a latent response that does not directly correspond to any of the LLM’s generations. To that end, we utilize the distribution p(\ell\mid x) induced by mapping g_{T} through Bayesian decision theory. For any candidate action (LLM response) \tilde{\ell}\in\mathcal{L} , the associated Bayes risk under the dissimilarity d_{T} can be defined as R(\tilde{\ell})\;:=\;\mathbb{E}_{\ell\sim p(\ell\mid x)}\!\left[d_{T}(\tilde{\ell},\ell)\right]. (2) The Bayes-optimal action (LLM response) is given by \ell_{\text{Bayes}}\;:=\;\arg\min_{\tilde{\ell}\in\mathcal{L}}R(\tilde{\ell}), (3) with the associated Bayes risk R_{\text{Bayes}}:=R(\ell_{\text{Bayes}}). (4) Selecting a response that minimizes this risk is referred to as Minimum Bayes Risk (MBR) decoding ( Kumar & Byrne 2004 ) : \ell_{\text{Bayes}} represents the optimal action with respect to minimizing Bayes risk under the response distribution p . While MBR has been explored using different dissimilarity functions d ( Bertsch et al. 2023 ; Freitag et al. 2023 ; Eikema et al. 2025 ) in the space of raw language, we are the first to apply MBR directly in the latent space \mathcal{L} . A key property is that for many latent structures and dissimilarities the Bayes-optimal action ( Equation 3 ) has a closed-form expression or can be computed efficiently. At the same time, it is infeasible to compute the Bayes-optimal closed-form raw language answer as there is no tractable framework for aggregating over raw language. E.g., we can not compute the intersection of two textual responses x , but their