Computing Class Hierarchies from Classifiers

Kai Kang, Fangzhen LinarXiv 2021

Introduction

Modern deep learning classifiers typically operate on "flat" label spaces. For instance, a model trained on the CIFAR-10 dataset treats "automobile" and "truck" as equally distinct from "frog." However, semantic reality is hierarchical: an automobile is far more similar to a truck than to an amphibian. In their paper, "Computing Class Hierarchies from Classifiers," Kai Kang and Fangzhen Lin propose a novel method to extract these latent taxonomic relationships directly from a trained model's behavior.

The Problem: Extracting Meaning from Black Boxes

While many researchers use human-curated hierarchies like WordNet to improve model performance, Kang and Lin explore the inverse: Can we discover a meaningful hierarchy from a model that was never explicitly taught one?

Existing approaches often require access to internal model weights or feature embeddings. This paper introduces a "black-box" approach that relies solely on a classifier's output errors. By analyzing which classes a model frequently confuses, the authors demonstrate that we can reconstruct intuitive, human-like relationships without peering into the model's internal architecture.

Methodology: From Confusion to Taxonomy

The core of the proposed approach is the Confusion Matrix. When a model misclassifies a "dog" as a "cat," it signals that the model perceives shared features between these two categories.

  1. Similarity Matrix Construction: The authors normalize and symmetrize the confusion rates to create a similarity matrix $S$, where $S_{ij}$ represents the average "closeness" between class $i$ and class $j$.
  2. Iterative Merging: Starting with each class as a leaf node, the algorithm iteratively merges classes into "super-classes." A merge occurs if the similarity between two groups is significantly higher than their similarity to any other group, governed by a threshold ratio $r$.
  3. Inheritance Structures: The algorithm can generate two types of hierarchies: Single Inheritance Trees (SIT), where each class has one parent, and Multiple Inheritance Trees (MIT), where a class can belong to multiple categories (e.g., a "cat" as both a "pet" and a "carnivore").
Figure 1: Illustration of (a) Single Inheritance and (b) Multiple Inheritance structures derived from class similarities.

Key Insights and Results

The authors validated their method across image classification (CIFAR-10), speech recognition, and text identification. Several key findings emerged:

  • Errors as Semantic Signatures: A model's confusion patterns are not merely noise; they represent the semantic structure the model has learned from the data.
  • Model Agnostic Robustness: Hierarchies generated from simpler models (like ResNet10) were remarkably similar to those from more complex ones (WideResNet28), suggesting that fundamental class relationships are captured early in the learning process.
  • Semantic Alignment with WordNet: For the CIFAR-10 dataset, the algorithm produced a hierarchy that closely mirrored human-curated taxonomies. It correctly grouped "car" and "truck" under "vehicles," and "cat" and "dog" under "carnivores."
Figure 6: A reconstructed hierarchy showing semantic grouping of various animal and vehicle classes into a taxonomic tree.

Beyond interpretability, these derived hierarchies can be used to fine-tune models. By applying the hierarchy to a Neural-Backed Decision Tree (NBDT) framework, the authors observed slight accuracy improvements, such as ResNet18 on CIFAR-100 improving from 75.92% to 76.16%.

Conclusion and Future Directions

The ability to extract hierarchies from black-box classifiers provides a powerful tool for model interpretability, allowing researchers to see if a model fails "gracefully" (confusing similar items) or "egregiously" (confusing unrelated items).

However, challenges remain. The resulting tree structure is sensitive to the threshold parameter $r$, and scaling the method to massive datasets like ImageNet (1,000+ classes) may require advanced statistical smoothing to handle sparse confusion matrices. Future work may explore "discovering" these hierarchies dynamically during the training process to further guide model learning.

Summary updated

BibTeX
@misc{kang2021computing,
  author = {Kai Kang and Fangzhen Lin},
  title = {{Computing Class Hierarchies from Classifiers}},
  year = {2021},
  eprint = {2112.01187},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2112.01187},
}
Figure