Manuscript Offprint
arXiv:2608.22839Hierarchy-Aware Supervised Uncertainty Estimation for Black-box LLM Taxonomic Reasoning
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Accepted for publication in the Proceedings of the 39th Canadian Conference on Artificial Intelligence (Canadian AI 2026)
HIERARCHY-AWARE SUPERVISED UNCERTAINTY ESTIMATION FOR BLACK-BOX LLM TAXONOMIC REASONING
Shuting Xie , Nathaniel Lesperance , Graham W. Taylor
Vector Institute for AI, Toronto, ON
University of Guelph, Guelph, ON
*Corresponding author: gwtaylor@uoguelph.ca
ABSTRACT
Large language models (LLMs) are increasingly used for scientific decision support, yet reliable confidence estimation remains difficult in black-box settings. We study uncertainty estimation for hierarchical taxonomic reasoning generated by a black-box LLM in a long-tailed biodiversity monitoring pipeline. Using proxy features extracted by an open-source tool LLM, we train lightweight supervised estimators with hierarchy-aware supervision to predict rank-wise correctness. Across three tool LLMs, the supervised estimators consistently outperform a token-likelihood baseline for micro discrimination and selective prediction under a single global rejection threshold, improving micro AUROC from 0.57 to 0.75–0.80. The best results are achieved by a rank-specific multi-head design (H3), suggesting that accounting for hierarchical output structure is important when a unified abstention rule is required. Our code is publicly available at https://github.com/uoguelph-mlrg/hierarchy-aware-llm-uq
Keywords Uncertainty, Large Language Model, Hierarchical Classification
Biodiversity monitoring provides a particularly challenging instance of this setting. Taxonomic predictions are hierarchical and strongly long-tailed (Gharaee et al., 2023). Rare and endangered species are difficult to monitor and can play disproportionately important roles in ecosystems (Dee et al., 2019), making UQ essential for routing uncertain cases to domain experts. A recent system (Lesperance et al., 2025) combines vision language model (VLM)-based image captioning, retrieval-augmented generation (RAG), and LLM-based reasoning to generate interpretable predictions across taxonomic ranks. However, it lacks numerical confidence estimates, relying instead on qualitative abstentions that do not support principled rejection thresholds.
We address this gap by studying uncertainty estimation for black-box LLMs in hierarchical taxonomic reasoning, where only externally accessible signals are available. Our contributions are threefold:
-
Formulation. We cast black-box LLM taxonomic UQ as rank-level selective prediction under partial-path abstention.
-
Method. We develop lightweight supervised uncertainty estimators that use proxy-LLM features, hierarchy-aware supervision, and rank-aware output parameterizations to predict rank-wise correctness.
-
Design insight. On a realistic long-tailed arthropod pipeline, supervised estimators outperform a token-likelihood baseline for global-threshold selective prediction, and a rank-specific multi-head design performs best overall.
2 Related Work
Uncertainty estimation (UE) for LLMs. LLM uncertainty estimation has been studied in both white-box and black-box settings. White-box methods leverage logits or hidden states (Geng et al., 2024), but these signals are unavailable for proprietary API models. Black-box approaches typically rely on self-verbalized confidence (Tian et al., 2023) or consistency or semantic clustering across multiple sampled responses (Farquhar et al., 2024; Manakul et al., 2023). The former may fail to faithfully reflect the model's intrinsic uncertainty (Yona et al., 2024), while the latter can be prohibitively expensive in API-based pipelines. We therefore build on the supervised black-box approach of Liu et al. (Liu et al., 2024), which uses an open-source tool LLM to extract proxy features from prompt-response pairs and trains a correctness predictor for the target model. We view tool-LLM features as a practical proxy signal rather than faithful reconstruct of target uncertainty.
Hierarchical reasoning in taxonomic prediction. Taxonomic reasoning is a challenging setting for uncertainty estimation because predictions are hierarchical, long-tailed, and often partially specified through abstention. Prior work on hierarchical classification has developed evaluation measures based on ancestor overlap and partial credit (Kosmopoulos et al., 2015), and recent work has extended this perspective to taxonomy-aware evaluation (Snaebjarnarson et al., 2025). In parallel, an LLM-based pipeline has been proposed for taxonomic reasoning in rare arthropods (Lesperance et al., 2025). Our focus is complementary. Rather than improving the upstream reasoning pipeline, we study UQ for its hierarchical outputs and use hierarchy-aware signals as auxiliary supervision.
3 Methodology
We formulate uncertainty estimation as a supervised prediction problem (Figure 1).

Figure 1: End-to-end pipeline for LLM uncertainty estimation. A target LLM generates taxonomic predictions from VLM captions and RAG-retrieved context. A tool LLM extracts proxy features from each prompt–response pair, which a lightweight uncertainty estimator maps to a confidence score. Blue boxes denote inputs and intermediate outputs. Red boxes denote prediction targets.
3.1 Dataset and Upstream Taxonomic Reasoning System
This study uses 829 arthropod images from the Rare Species dataset (Stevens et al., 2024), obtained after filtering invalid samples from an initial set of 951. Each sample is associated with a complete taxonomic path, spanning seven taxonomic ranks. The dataset is conservation-biased, with all species belonging to International Union for Conservation of Nature (IUCN) Red List categories from Near Threatened to Extinct in the Wild.
As input to our uncertainty estimator, we use the textual taxonomic outputs from the upstream simple-RAG reasoning system (Lesperance et al., 2025), instantiated with GPT-4o (Hurst et al., 2024) as the target LLM. The system predicts taxa in a coarse-to-fine manner and abstains at the first uncertain rank, producing variable-depth partial paths and consequently limited coverage at finer ranks (Appendix Table 2). We therefore model uncertainty at the rank level to capture both error propagation and partial-path abstention.
3.2 Supervision Labels
Each rank-level instance has two supervision signals:(i) a binary accuracy , indicating whether the predicted taxon matches the ground truth at that rank; and (ii) a hierarchical accuracy , which assigns partial credit based on taxonomic overlap. Following (Snæbjarnarson et al., 2025), we compute hierarchical precision, recall, and F1. For predicted node and gold node , letting denote the set of ancestors of , including itself,
We set and use it only as an auxiliary training target. Kingdom and phylum are excluded, as they are constant across all samples and hence non-discriminative.
3.3 Tool LLM Feature Extraction
Following Liu et al. (Liu et al., 2024), we use an open-source tool LLM to extract proxy features from each prompt-response pair. We consider Gemma 7B (Gemma Team, 2024), GPT-OSS 20B (Open AI, 2025), or Qwen3 30B A3B Instruct (Qwen Team, 2025) as tool LLMs (layer details in Appendix Table 3). We collect two feature families (Appendix Figure 3): (i) representation features, namely averaged and last-token hidden states from the middle layer of the tool LLM, and (ii) distributional features, including statistics of entropy, negative log-probability, and raw token probability.
3.4 Supervised Uncertainty Estimators
To mitigate overfitting under sparse fine-rank supervision, we use a compact MLP with a shared two-layer trunk (hidden size 16, ReLU, dropout 0.3) and task-specific head(s). The primary head is a sigmoid classifier that predicts the probability of rank-wise correctness, directly supporting AUROC and risk-coverage evaluation. Some variants add a regression head for hierarchical F1 to provide hierarchy-aware auxiliary supervision.
We train the primary head with binary cross-entropy (BCE) and the auxiliary head with mean squared error (MSE):
Here, denotes the predicted probability of rank-wise correctness, the binary correctness label, the predicted hierarchical score, and the hierarchical-F1 auxiliary target.
We study three variants: H1, a shared MLP trunk with a single binary head trained with only; H2, the same trunk augmented with an auxiliary regression head and trained with Eq. (2); and H3, a shared trunk with five rank-specific binary heads plus one auxiliary regression head. BCE is applied only to the head matching the sample rank, while the auxiliary regression loss is applied globally. At inference, H3 produces correctness probabilities for all five ranks in a single forward pass. Implementation details are provided in Appendix A.
Table 1: All-rank micro AUROC (mean std over 5 seeds). Highest mean is bolded.
| Tool LLM | Benchmarks | Ours | ||
|---|---|---|---|---|
| Baseline | H1 | H2 | H3 | |
| Gemma 7B | 0.573 | |||
| Qwen3 30B A3B Instruct | ||||
| GPT-OSS 20B | ||||

(a) Gemma 7B.
(b) Qwen3 30B A3B Instruct.
(c) GPT-OSS 20B.
Figure 2: Global-threshold risk–coverage curve. Lower is better. Curves show the mean over 5 random seeds, with shaded regions indicating standard deviation.
3.5 Negative log-likelihood (NLL) baseline
As a training-free baseline, we use the negative mean token NLL of the target LLM output (Lin et al., 2024; Gupta et al., 2024). For generated output under context , we define
where denotes the token probability returned by the target LLM, and is the output length in tokens. We use this baseline because it is available in a single GPT-4o API pass, whereas full-distribution or multi-sample baselines are unavailable or costly.
3.6 Evaluation protocol
We evaluate uncertainty at the rank level. Each image–rank pair is one example, with correctness label and confidence score .
Risk–coverage Curve. To reflect deployment under a single global rejection rule, we pool validation examples across ranks and, for a target coverage , choose a threshold as the -quantile of confidence scores. On the test set, we accept examples with , and define selective risk as the error rate among accepted examples (Geifman and El-Yaniv, 2019):
AUROC. We report micro AUROC (pooled across ranks) and macro AUROC (per-rank average) as threshold-free discrimination metrics, with as the positive class.
4 Results
Table 1 shows that supervised uncertainty estimators consistently and substantially outperform the mean-NLL baseline in micro AUROC across all three tool LLMs. H3 achieves the highest mean micro AUROC overall, suggesting the strongest discrimination between correct and incorrect, although its margin over H1 is small for Qwen3 and clearer for Gemma 7B and GPT-OSS 20B.
Figure 2 provides the most deployment-relevant comparison under a single global rejection threshold. Across all three tool LLMs, our supervised uncertainty estimators achieve remarkably lower selective risk than the mean-NLL baseline over a broad coverage range, with the largest gains at low-to-mid coverage. H3 consistently yields the best overall risk–coverage trade-off, while H1 and H2 also remain better than the baseline throughout.
The gains are less consistent under rank-balanced macro AUROC metric (Appendix Table 4 and Figure 4). Calibration results are also reported in Appendix Table 5 and generally favour the supervised estimators over the mean-NLL baseline.
5 Discussion
The divergence between micro (Table 1) and macro AUROC (Appendix Table 4) stems from rank imbalance. Micro AUROC is dominated by high-coverage coarse ranks, whereas macro AUROC weights each rank equally. Per-rank results (Appendix Figure 4) suggest that the degradation is concentrated at deeper ranks, where frequent abstentions reduce the available training signal and increase variance (Appendix Table 2). Therefore, the rank-balanced metric exposes weaknesses that the deployment-oriented micro metric downweights.
For unified-threshold deployment, cross-rank comparability is key. H2 yields modest gains over H1 for most tool LLMs, except with GPT-OSS 20B, while H3 performs best overall (Figure 2). Since H2 and H3 use the same auxiliary supervision, this pattern suggests that rank-specific output heads matter more than the auxiliary hierarchical target alone.
A main limitation is sparse fine-rank supervision. Our study is further restricted to a single taxonomic reasoning pipeline and a global abstention threshold chosen to reflect deployment constraints. Future work should assess whether these conclusions generalize to richer fine-rank coverage, wider distribution shifts, and rank-specific decision rules.
6 Conclusion
We studied UQ for black-box LLMs in hierarchical taxonomic reasoning under long-tailed data and partial-path abstention. Using proxy features extracted by a tool LLM, we trained lightweight supervised estimators with hierarchy-aware signals to predict rank-wise correctness. Across tool LLMs, these estimators outperformed a NLL baseline in micro discrimination and global-threshold selective prediction. A rank-specific multi-head design performed best overall, suggesting that estimator design for hierarchical outputs is as important as the uncertainty signal itself in unified-threshold deployment.
7 Acknowledgments
Resources used in preparing this research were provided, in part, by the Province of Ontario, the Government of Canada through CIFAR, and companies sponsoring the Vector Institute http://www.vectorinstitute.ai/#partners
References
Karan Singhal, Shekoofeh Azizi, Tao Tu, S Sara Mahdavi, Jason Wei, Hyung Won Chung, Nathan Scales, Ajay Tanwani, Heather Cole-Lewis, Stephen Pfohl, et al. Large language models encode clinical knowledge. Nature, 620(7972):172–180, 2023.
Yinheng Li, Shaofei Wang, Han Ding, and Hang Chen. Large language models in finance: A survey. In Proceedings of the fourth ACM international conference on AI in finance, pages 374–382, 2023.
Maria Mora-Cross and Saul Calderon-Ramirez. Uncertainty estimation in large language models to support biodiversity conservation. In Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 6: Industry Track), pages 368–378, 2024.
Zahra Gharaee, ZeMing Gong, Nicholas Pellegrino, Iuliia Zarubiieva, Joakim Bruslund Haurum, Scott Lowe, Jaclyn McKeown, Chris Ho, Joschka McLeod, Yi-Yun Wei, et al. A step towards worldwide biodiversity assessment: The BIOSCAN-1M insect dataset. Advances in Neural Information Processing Systems, 36:43593–43619, 2023.
Laura E Dee, Jane Cowles, Forest Isbell, Stephanie Pau, Steven D Gaines, and Peter B Reich. When do ecosystem services depend on rare species? Trends in ecology & evolution, 34(8):746–758, 2019.
Nathaniel Lesperance, Sujeevan Ratnasingham, and Graham Taylor. Taxonomic Reasoning for Rare Arthropods: Combining Dense Image Captioning and RAG for Interpretable Classification. Proceedings of the Canadian Conference on Artificial Intelligence, 2025.
Jiahui Geng, Fengyu Cai, Yuxia Wang, Heinz Koeppl, Preslav Nakov, and Iryna Gurevych. A survey of confidence estimation and calibration in large language models. In Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 1: Long Papers), pages 6577–6595. Association for Computational Linguistics, June 2024.
Katherine Tian, Eric Mitchell, Allan Zhou, Archit Sharma, Rafael Rafailov, Huaxiu Yao, Chelsea Finn, and Christopher D Manning. Just ask for calibration: Strategies for eliciting calibrated confidence scores from language models fine-tuned with human feedback. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pages 5433–5442, 2023.
Sebastian Farquhar, Jannik Kossen, Lorenz Kuhn, and Yarin Gal. Detecting hallucinations in large language models using semantic entropy. Nature, 630(8017):625–630, 2024.
Potsawee Manakul, Adian Liusie, and Mark Gales. SelfCheckGPT: Zero-resource black-box hallucination detection for generative large language models. In Proceedings of the 2023 conference on empirical methods in natural language processing, pages 9004–9017, 2023.
Gal Yona, Roee Aharoni, and Mor Geva. Can large language models faithfully express their intrinsic uncertainty in words? In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, pages 7752–7764. Association for Computational Linguistics, November 2024.
Linyu Liu, Yu Pan, Xiaocheng Li, and Guanting Chen. Uncertainty estimation and quantification for LLMs: A simple supervised approach, 2024.
Aris Kosmopoulos, Ioannis Partalas, Eric Gaussier, Georgios Paliouras, and Ion Androutsopoulos. Evaluation measures for hierarchical classification: a unified view and novel approaches. Data Mining and Knowledge Discovery, 29(3): 820–865, 2015.
Vésteinn Snæbjarnarson, Kevin Du, Niklas Stoehr, Serge Belongie, Ryan Cotterell, Nico Lang, and Stella Frank. Taxonomy-aware evaluation of vision-language models. In Proceedings of the Computer Vision and Pattern Recognition Conference, pages 9109–9120, 2025.
Samuel Stevens, Jiaman Wu, Matthew J Thompson, Elizabeth G Campolongo, Chan Hee Song, David Edward Carlyn, Li Dong, Wasila M Dahdul, Charles Stewart, Tanya Berger-Wolf, et al. BioCLIP: A vision foundation model for the tree of life. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 19412–19424, 2024.
Aaron Hurst, Adam Lerer, Adam P Goucher, Adam Perelman, Aditya Ramesh, Aidan Clark, AJ Ostrow, Akila Welihinda, Alan Hayes, Alec Radford, et al. GPT-4o system card, 2024.
Gemma Team. Gemma: Open models based on gemini research and technology, 2024.
Open AI. gpt-oss-120b & gpt-oss-20b model card. 2025.
Qwen Team. Qwen3 technical report, 2025.
Zhen Lin, Shubhendu Trivedi, and Jimeng Sun. Contextualized sequence likelihood: Enhanced confidence scores for natural language generation. In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, pages 10351–10368. Association for Computational Linguistics, November 2024.
Neha Gupta, Harikrishna Narasimhan, Wittawat Jitkrittum, Ankit Singh Rawat, Aditya Krishna Menon, and Sanjiv Kumar. Language model cascades: Token-level uncertainty and beyond. In The Twelfth International Conference on Learning Representations, 2024.
Yonatan Geifman and Ran El-Yaniv. Selectivenet: A deep neural network with an integrated reject option. In International conference on machine learning, pages 2151–2159. PMLR, 2019.
Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q Weinberger. On calibration of modern neural networks. In International conference on machine learning, pages 1321–1330. PMLR, 2017.
A Implementation details
All MLPs are trained with Adam (lr = 10, weight decay = 3 × 10), batch size 128, for up to 200 epochs. We use early stopping on validation micro AUROC (patience = 5, min ). For hierarchical supervision we set . An penalty (10) is applied to the first linear layer weights (input-to-hidden) to encourage sparse use of input features. Feature selection is applied only to the hidden-state representation features, combining the top-100 features from each of Lasso regression, mutual information, and Pearson correlation with the target. We use 5-fold cross-validation. To avoid specimen leakage, all rank-level records derived from the same specimen are assigned to the same cross-validation fold.
B Upstream taxonomic pipeline statistics
Table 2: Rank coverage and prediction accuracy in the upstream system before filtering.
| Rank | Attempts | Coverage (%) | Accuracy | F1 | HP | HR | HF |
|---|---|---|---|---|---|---|---|
| Class | 950 | 100 | 0.966 | 0.973 | 0.981 | 0.981 | 0.981 |
| Order | 922 | 97 | 0.872 | 0.885 | 0.955 | 0.955 | 0.955 |
| Family | 745 | 78 | 0.693 | 0.710 | 0.914 | 0.914 | 0.914 |
| Genus | 223 | 23 | 0.453 | 0.532 | 0.865 | 0.865 | 0.865 |
| Species | 55 | 6 | 0.455 | 0.500 | 0.847 | 0.847 | 0.847 |
C Tool LLM configurations and extracted features
Table 3: Details of tool LLMs. The first column reports the model name, followed by the exact checkpoint identifier in parentheses.
| Tool LLM | Middle layer | Total Number of Layers | Hidden size |
|---|---|---|---|
| Gemma 7B (google/gemma-7b) | 14 | 28 | 3072 |
| Qwen3 30B A3B Instruct (Qwen/Qwen3-30B-A3B-Instruct-2507-FP8) | 24 | 48 | 2048 |
| GPT-OSS 20B (openai/gpt-oss-20b) | 12 | 24 | 2880 |

Figure 3: Feature tree demonstrates the feature types extracted by tool LLMs.
D Additional UQ results
Table 4: All-rank aggregated macro AUROC across tool LLMs. Results are reported as mean ± std over 5 random seeds. Bold indicates the best macro AUROC across all methods, and underlining marks the best performance among our three uncertainty estimators.
| Tool LLM | Benchmarks | Ours | |||
|---|---|---|---|---|---|
| Baseline | H1 | H2 | H3 | ||
| Gemma 7B | 0.621 | ||||
| Qwen3 30B A3B Instruct | |||||
| GPT-OSS 20B | |||||

(a) Gemma 7B.
(b) Qwen3 30B A3B Instruct.
(c) GPT-OSS 20B.
Figure 4: Per-rank AUROC (pre-calibration). Markers show the mean over 5 random seeds, and horizontal bars indicate standard deviation.
Table 5: All-rank calibration metrics before vs. after temperature scaling (Guo et al., 2017). Entries are mean (std across seeds), to three decimals. Baseline is model-invariant and shown once. ↓ indicates improvement (lower is better), and ↑ indicates degradation. Bold marks the best (minimum) within each tool-LLM block for each metric column.
| Tool LLM | Method | NLL | ECE | Brier | |||
|---|---|---|---|---|---|---|---|
| pre | cal | pre | cal | pre | cal | ||
| None | Baseline | 1.030 (0.000) | 0.114 (0.000) | 0.408 (0.000) | |||
| Gemma 7B | H1 | 0.488 (0.055) | 0.057 (0.018) | 0.150 (0.013) | |||
| H2 | 0.470 (0.040) | 0.081 (0.023) | 0.151 (0.015) | ||||
| H3 | 0.403 (0.017) | 0.057 (0.020) | 0.128 (0.008) | ||||
| GPT-OSS 20B | H1 | 0.437 (0.048) | 0.045 (0.024) | 0.144 (0.020) | |||
| H2 | 0.403 (0.022) | 0.038 (0.016) | 0.128 (0.009) | ||||
| H3 | 0.411 (0.027) | 0.060 (0.023) | 0.130 (0.010) | ||||
| Qwen3 30BA3B Instruct | H1 | 0.429 (0.028) | 0.040 (0.016) | 0.139 (0.012) | |||
| H2 | 0.446 (0.049) | 0.067 (0.044) | 0.147 (0.020) | ||||
| H3 | 0.447 (0.015) | 0.092 (0.026) | 0.145 (0.006) | ||||