Hierarchy-aware Label Semantics Matching Network for Hierarchical Text Classification

Haibin Chen, Qianli Ma, Zhenxi Lin, Jiangyue Yan

Introduction

Hierarchical Text Classification (HTC) involves assigning documents to categories structured within a hierarchy. Traditional approaches often treat labels as discrete identifiers, ignoring the semantic richness of label names and the structural relationships between them. For instance, in a news hierarchy, "Economics" and "Debt" are semantically related, and an error confusing "Debt" with its sibling "Revenue" is qualitatively different from confusing it with an unrelated category like "Sports."

The HiMatch Framework

HiMatch (Hierarchy-aware Label Semantics Matching Network) reframes HTC as a semantic matching problem. Instead of simple categorization, the model learns to project both text and labels into a shared latent space where proximity indicates relevance.

The HiMatch architecture, featuring dual encoders and a joint text-label embedding space.

The architecture consists of several key components:

  1. Dual Encoders: A text encoder (Bi-GRU + CNN) processes the input document, while a label encoder uses Graph Convolutional Networks (GCNs) to incorporate the hierarchy's structure into label representations.
  2. Joint Embedding Space: Text and label vectors are projected into a single space via MLPs.
  3. Hierarchy-aware Matching Loss: This novel loss function enforces a specific distance ranking ($d_1 < d_2 < d_3 < d_4$) relative to the input text:
  4. $d_1$: Fine-grained target labels (closest).
  5. $d_2$: Coarse-grained target labels (parents).
  6. $d_3$: Incorrect sibling labels.
  7. $d_4$: Unrelated labels (furthest).

By using varying penalty margins ($\gamma$), the model is penalized more heavily for confusing unrelated topics than for near-misses within the same branch of the hierarchy.

Experimental Setup

The authors evaluated HiMatch on three benchmark datasets:

  • RCV1-V2: Reuters news dataset (103 labels, 4 levels).
  • WOS: Scientific abstracts (141 labels, 2 levels).
  • EURLEX-57K: Legal documents (over 4,000 labels), testing the model's ability to handle large-scale and few-shot classification.

Analysis and Results

HiMatch achieved state-of-the-art results across all benchmarks. Notably, on RCV1-V2, it outperformed previous hierarchy-aware models like HiAGM. When integrated with BERT, performance improved further, reaching 86.33 Micro-F1.

Visualization of the label hierarchy and the impact of the joint embedding and matching learning losses on text-label clustering.

The effectiveness of the matching framework is particularly evident in the EURLEX-57K dataset, where HiMatch showed significant gains in "few-shot" categories. This suggests that leveraging label semantics allows the model to generalize better even when training examples for specific labels are scarce. T-SNE visualizations confirm that the combined loss functions successfully cluster text representations around their corresponding label vectors while maintaining appropriate distances from unrelated categories.

Conclusion and Future Work

HiMatch demonstrates that treating hierarchical classification as a semantic matching task significantly improves performance by respecting both label meanings and structural constraints. While the model excels at few-shot learning, it remains limited in zero-shot scenarios where labels are entirely unseen during training. Future work will focus on enhancing zero-shot capabilities by incorporating external knowledge into label embeddings and optimizing the computational efficiency of the label encoder for even larger hierarchies.

Summary updated

BibTeX
@inproceedings{chen2021hierarchy,
  author = {Haibin Chen and Qianli Ma and Zhenxi Lin and Jiangyue Yan},
  title = {{Hierarchy-aware Label Semantics Matching Network for Hierarchical Text Classification}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2021},
  doi = {10.18653/v1/2021.acl-long.337},
}
Figure