---
title: Hierarchical Conformal Classification
url: https://www.emergentmind.com/topics/hierarchical-conformal-classification-hcc
type: topic
---

# Hierarchical Conformal Classification

Hierarchical Conformal Classification (HCC) is a principled extension of classical conformal prediction for classification tasks, designed to take advantage of known hierarchical relationships among output labels. Unlike traditional conformal methods, which output "flat" sets of possible leaf-level labels, HCC produces prediction sets that may include both leaf and internal nodes in the class hierarchy—often modeled as a tree or a directed acyclic graph (DAG). This allows prediction sets to be simultaneously compact, more interpretable, and semantically meaningful, while offering rigorous statistical coverage guarantees in the presence of taxonomic structure. The HCC framework has been developed and analyzed in numerous settings, including multi-class, multi-label, and general structured prediction tasks [2508.13288, 2501.19038, 2511.20779, 2410.06296, 2404.19472].

## 1. Class Hierarchies and Notation

HCC operates in settings where the set of possible labels $\mathcal{Y}$ is endowed with a hierarchy, typically represented as a tree or a more general DAG $(\mathcal{V}, E)$. Leaf nodes correspond to specific atomic classes, while internal nodes encode meaningful coarser groupings (e.g., in WordNet/ImageNet, leaves are fine-grained visual categories, and internal nodes are semantic hypernyms). Any subset of nodes $S \subseteq \mathcal{V}$ defines a "leaf cover" $\mathrm{Desc}(S)$, the set of all leaves reachable below nodes in $S$.

In many HCC algorithms, a prediction set is allowed to be any collection of nodes whose leaf cover contains the true class, enabling a trade-off between specificity (smaller leaf cover) and compactness (fewer nodes in the prediction set) [2508.13288, 2410.06296, 2501.19038].

## 2. Core Methodology

The foundational procedure for HCC generalizes split conformal prediction to the hierarchical setting. The major steps are:

- **Modeling and scoring:** A base probabilistic classifier (e.g., neural network softmax outputs in $\mathbb{R}^{|\mathcal{Y}|}$) is used to assign probabilities to all leaves. Internal node scores are computed by summing probabilities over all descendant leaves:
  $$
  \hat g(x)_v = \sum_{w \in \mathrm{Desc}(\{v\})} \hat f(x)_w
  $$
  for $x$ an input and $v\in\mathcal{V}$ [2508.13288, 2410.06296].

- **Nonconformity scores:** For a given candidate set $S\subseteq\mathcal{V}$ and calibration pair $(x_i, y_i)$, the conformity score is the highest node score along the true-ancestor path in $S$:
  $$
  s(x_i, y_i, S) = \max_{v \in S \cap \mathcal{Y}_i'}\; \hat g(x_i)_v,
  $$
  with $\mathcal{Y}_i' = \{v : y_i \in \mathrm{Desc}(\{v\})\}$ [2508.13288].

- **Calibration:** On a calibration set of size $n_c$, compute conformity scores $s_1,\dots,s_{n_c}$. The conformal threshold $\hat q$ is typically taken as the $\lceil(n_c+1)(1-\alpha)\rceil/n_c$-quantile [2508.13288, 2410.06296].

- **Set construction:** At test time, form a prediction set by including all nodes $v$ with $\hat g(x_t)_v \ge \hat q$ or, equivalently, those whose empirical conformal $p$-values exceed $\alpha$:
  $$
  p_v(x_t) = \frac{|\{i : \hat g(x_i)_v \leq \hat g(x_t)_v\}| + 1}{n_c+1}
  $$
  [2508.13288].

- **Optimization:** The prediction set is selected as a solution of
  $$
  \arg\min_{N \subseteq \mathcal{V}} \left\{\,|N| + \beta |\mathrm{Desc}(N)|\,\right\}
  $$
  subject to guaranteeing (empirical) coverage at level $1-\alpha$ [2508.13288].

This procedure efficiently computes hierarchical prediction sets with guaranteed marginal coverage.

## 3. Statistical Guarantees

HCC inherits the finite-sample, distribution-free marginal coverage properties of conformal prediction, extended to the leaf cover of the selected hierarchical set. Under the exchangeability assumption for calibration and test data, the following holds [2508.13288, 2410.06296, 2404.19472]:

- For any fixed candidate set $S$ (or node collection), the split-conformal procedure ensures
  $$
  \Pr\left(Y_t \in \mathrm{Desc}\left(C_{S,\alpha}(X_t)\right)\right) \geq 1-\alpha.
  $$
- More generally, if set selection involves searching over multiple candidate NOL-covers (non-overlapping leaf covers), a Bonferroni correction or other multiple-testing adjustment can maintain the marginal coverage guarantee [2508.13288].
- Family-wise error rate (FWER) control is achieved in tree-based multi-label settings via hierarchical testing with significance allocation across layers, either by fixed Bonferroni partitioning or adaptive tuning [2404.19472].
- Similar coverage guarantees hold for hierarchical prediction sets constructed via integer programming or dynamic programming in tree-structured hierarchies [2410.06296, 2501.19038].

## 4. Algorithmic and Computational Aspects

The computational pipeline of HCC includes the following considerations:

- **Candidate set search:** The space of all hierarchical node collections is combinatorially large ($2^{|\mathcal{V}|}$), but optimal sets can be restricted to non-overlapping, ancestor-independent NOL-covers, reducing computational cost to $O(2^d)$ for trees of depth $d$ [2508.13288].
- **Dynamic programming:** In tree-structured hierarchies, the set selection optimization can be solved using dynamic programming in $O(m|V|)$ time, with $m$ an upper bound on the number of nodes in the solution [2410.06296, 2501.19038].
- **Calibration cost:** For $K$ candidate thresholds and $n$ calibration points, the total cost is $O(K n\,\mathrm{IP}(|V|,|E|))$ for generic integer programming, which reduces to $O(K n m |V|)$ in trees [2410.06296].
- **Empirical scalability:** In practice, $m$ is kept small (e.g., $m \leq 3$), and the search is tractable in ImageNet-sized (1,000-class) hierarchies [2508.13288, 2511.20779].

## 5. Applications and Empirical Performance

HCC has been extensively validated in multi-class image, audio, and text classification:

- **ImageNet-1K:** On ImageNet-1K with a WordNet hierarchy, HCC achieves coverage $>1-\alpha$ and compresses prediction sets by 30–60% compared to flat conformal methods. With $\alpha=0.1$, average set size for HCC is 2–4 coarse nodes (covering $\approx$25 leaves) versus 20–30 flat labels [2508.13288, 2410.06296, 2511.20779].
- **Audio/text domains:** On text (DBpedia) and audio (GTZAN) hierarchies, HCC consistently attained desired coverage with more compact and semantically meaningful sets than baselines [2508.13288].
- **CHiQPM (interpretable models):** HCC has been applied within globally interpretable neural architectures, such as CHiQPM, where prediction sets are intrinsically coherent subtrees in a learned feature hierarchy, with empirical coverage matching theoretical targets and manageable set sizes on CUB-200, CARS-196, and ImageNet [2511.20779].
- **Multi-label:** In multi-label contexts, HCC is operationalized as a tree of label sets with split-conformal $p$-values tested hierarchically, yielding shorter prediction sets and valid FWER control compared to power-set or binary-relevance conformal baselines [2404.19472].
- **Structured prediction:** In domains such as structured output prediction (e.g., string prefixes, year intervals), HCC achieves hierarchical compression and interpretability, preserving 90% coverage with smaller prediction set size than flat conformal approaches [2410.06296].

## 6. Practical Insights, Interpretability, and User Studies

HCC methods offer prediction sets that are interpretable both globally—as unions of taxonomically meaningful classes—and locally, as output subtrees that reflect model uncertainty. Key empirical and usability findings include:

- Annotator studies reveal that human annotators significantly prefer HCC's hierarchical prediction sets over flat sets, primarily for their conciseness and alignment with human taxonomy reasoning. In controlled studies, HCC was favored in 57%–71% of cases, with Fleiss's $\kappa$ indicating fair-to-moderate inter-rater agreement [2508.13288].
- In CHiQPM's implementation, prediction sets are always connected subtrees in the learned class-feature hierarchy, contributing both interpretability and statistical coverage [2511.20779].
- Performance advantages are especially pronounced in settings with large label spaces—HCC reduces the cognitive load on end users by grouping ambiguity into coarser, semantically unified output nodes [2508.13288, 2410.06296].
- In multi-label and structured prediction contexts, hierarchical calibration and testing allow robust control of error rates and prediction set size even as the combinatorial complexity of the label space increases [2404.19472, 2410.06296].

## 7. Extensions and Open Challenges

Several variants of HCC have been proposed to address practical demands:

- **Representation complexity:** Limiting the number of internal nodes in prediction sets (so-called representation complexity) allows trade-off between interpretability (fewer nodes, more general sets) and precision (smaller leaf covers) [2501.19038].
- **Dynamic granularity:** Dynamic-programming-based approaches support adjusting the complexity bound per instance, enabling flexible per-sample specificity [2501.19038].
- **Multi-label and DAG extensions:** HCC formulations extend naturally beyond tree hierarchies to DAGs and multi-label settings, using generalized notion of leaf cover, though computational cost rises in general DAGs [2410.06296, 2404.19472].
- **Conditional guarantees and loss structures:** Conditional coverage under hierarchy constraints and alternative loss metrics (e.g., tree distance) remain open areas for research [2501.19038].
- **Scalability:** Efficient candidate set search and calibration remain practical challenges for extremely large or deeply nested hierarchies, though structural reductions (NOL-covers, dynamic pruning) significantly alleviate this [2508.13288, 2410.06296].

A plausible implication is that future work will refine instance-level adaptive complexity, alternative validity criteria (e.g., conditional, per-layer), and loss-aware selection, expanding HCC's utility in complex, structured-output predictive modeling.

Source: https://www.emergentmind.com/topics/hierarchical-conformal-classification-hcc