Uncertainty Quantification for LLM Function-Calling

Zihuiwen Ye, Lukas Aichberger, Michael Kirchhof, Sinead Williamson, Luca Zappella, Yarin Gal, Arno Blaas, Adam GolinskiarXiv 2026

TL;DR

This paper presents the first comprehensive evaluation of Uncertainty Quantification (UQ) methods for LLM function-calling. The authors discover that complex, multi-sample UQ methods offer no clear advantage over simple, single-sample logit methods in this structured setting, and they introduce two domain-specific adaptations—Abstract Syntax Tree (AST) clustering and Semantically Meaningful Tokens (SMT)—that significantly improve UQ performance and calibration.

What Problem Does This Paper Address?

As Large Language Models (LLMs) transition from passive text generators to autonomous agents, they increasingly rely on Function-Calling (FC) to interact with the real world (e.g., executing code, querying databases, or triggering APIs). While a typo in a generated essay is harmless, an incorrect function call can be catastrophic and irreversible—such as deleting user data or executing an unauthorized financial transaction.

To safely deploy these models, we need reliable Uncertainty Quantification (UQ) to act as a guardrail, allowing the system to abstain or defer to a human when the LLM is unsure. While UQ has been heavily studied for free-form text generation and classification, its efficacy in the highly structured, syntax-constrained domain of function-calling was entirely unknown until this work.

Methods

The authors evaluate two primary families of UQ methods and propose tailored enhancements for both:

  1. Single-Sample Methods: These look at the token-level probabilities (logits) of a single, greedily decoded output. Examples include MAX (highest token uncertainty), AVG (average uncertainty), and G-NLL (Greedy Negative Log-Likelihood, which sums token uncertainties).
  2. The Innovation: Semantically Meaningful Tokens (SMT). Standard logit aggregation gets distorted by purely syntactic tokens (like commas, brackets, or equals signs) where the model might show trivial or irrelevant uncertainty. The authors introduce a rule-based algorithm to filter out syntax tokens, calculating UQ scores only on tokens representing actual decisions (e.g., function names, parameter names, and arguments).
  3. Multi-Sample Methods: These sample multiple outputs at a higher temperature to estimate the entropy of the model's distribution. A prominent example is Semantic Entropy (SE), which clusters semantically equivalent responses.
  4. The Innovation: AST Clustering (SE_AST). Instead of relying on fragile exact string matching (EXM) or expensive LLM-based semantic entailment, the authors use an Abstract Syntax Tree (AST) parser to cluster function calls. This naturally handles permutation invariance (e.g., if the model lists function arguments in a different order, the AST recognizes them as identical).

Datasets

The authors constructed a dedicated UQ benchmark by adapting the Berkeley Function Calling Leaderboard (BFCL) dataset. The benchmark spans several distinct Python-based task categories to evaluate models under varying complexities:

  • Simple: A single available function that matches the user request.
  • Multiple: Multiple available functions; the model must choose the correct one.
  • Parallel: The model must invoke multiple functions simultaneously.
  • Parallel-Multiple: A combination of choosing and executing multiple parallel functions.
  • Irrelevance: Requests that cannot be solved by any available tools, testing the model's ability to safely refuse execution.

They evaluate these tasks individually and in realistic, multi-modal combinations across eight open-source LLMs (including variants of Qwen2.5, Gemma-2/3, and Ministral-8B).

Key Insights and Ideas

  • Multi-sample methods lose their edge in Function-Calling: In standard natural language Q&A, multi-sample methods like Semantic Entropy typically crush single-sample logit methods. However, in function-calling, the available functions are provided directly in the context window. This highly restricts the valid output space, causing the LLM to assign extremely high probabilities to most tokens (an average token probability of 0.97 in FC vs. 0.71 in natural language). As a result, sampled outputs rarely diverge, yielding very few distinct semantic clusters and rendering entropy-based methods less effective.
  • Syntax tokens distort confidence metrics: A model might express slight logit-level hesitation over an opening bracket [ or an assignment operator =, which has nothing to do with whether it chose the right API. Isolating the actual semantic choices (function and argument names) via SMT prevents this noise from corrupting the uncertainty score.

Key Results

The performance of the UQ classifiers was evaluated using the Area Under the Receiver Operating Characteristic (AUROC), where 1.0 represents a perfect guardrail.

  • Single-Sample Dominance: Simple sequence likelihood (G-NLL) consistently matched or outperformed the more computationally expensive multi-sample methods across almost all task splits.
Main AUROC results across single-sample and multi-sample UQ methods
  • SMT Boosts Performance and Calibration: Applying the SMT token filter to G-NLL (G-NLL_SMT) consistently improved AUROC across the board. Furthermore, it dramatically improved model calibration (measured via smoothECE), dropping the calibration error of G-NLL from 0.147 to 0.091 on the combined task.
  • AST Clustering Helps Multi-Sample Methods: Replacing exact string matching with AST-based clustering (SE_AST) improved the performance of Semantic Entropy in 8 out of 10 tasks, though it still rarely surpassed the single-sample G-NLL baseline.
AUROC comparison showing the benefit of AST clustering over EXM clustering

Limitations and Future Work

The primary limitation acknowledged by the authors is the exclusion of proprietary frontier models (like GPT-4 or Claude 3.5). These commercial APIs rarely expose token-level log probabilities, making single-sample logit-based UQ impossible to compute externally. Additionally, the benchmark is currently restricted to single-turn interactions. The authors note that extending this uncertainty analysis to multi-turn agent dialogues and tool-use loops remains an important direction for future research.

Summary updated

BibTeX
@misc{ye2026uncertainty,
  author = {Zihuiwen Ye and Lukas Aichberger and Michael Kirchhof and Sinead Williamson and Luca Zappella and Yarin Gal and Arno Blaas and Adam Golinski},
  title = {{Uncertainty Quantification for LLM Function-Calling}},
  year = {2026},
  eprint = {2604.22985},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2604.22985},
}
Figure