Abstract: We introduce HYDRA, a simple yet effective multi-head encoder-only architecture for hierarchical text classification that treats each level in the hierarchy as a separate classification task with its own label space. State-of-the-art approaches rely on complex components like graph encoders, label semantics, and autoregressive decoders. We demonstrate that such complexity is often unnecessary. Through parameter sharing and level-specific parameterization, HYDRA enables flat models to incorporate hierarchical awareness without architectural complexity. Experiments on four benchmarks (NYT, RCV1-V2, BGC, and WOS) demonstrate that HYDRA always increases the performance over flat models and matches or exceeds the performance of complex state-of-the-art methods.
Introduction
Hierarchical Text Classification (HTC) involves assigning documents to categories organized into a taxonomy (e.g., News -> Sports -> Football). Because labels are interdependent, recent research has trended toward increasingly complex architectures. These models often utilize Graph Convolutional Networks (GCNs) to encode tree structures, semantic label embeddings to capture relationships, or autoregressive decoders to generate label paths.
The authors of HYDRA argue that this complexity hinders reproducibility and practical deployment. They propose that "flat" encoder-only models (like BERT or RoBERTa) can be made "hierarchy-aware" through a much simpler multi-task learning approach, without the need for specialized structural components.
Methodology
The core of HYDRA is a multi-head encoder-only architecture. Instead of treating all labels as one giant flat list, it treats each level of the hierarchy as a separate classification sub-task.
- Shared Encoder: A standard pre-trained transformer (like RoBERTa-base) generates a unified text embedding.
- Level-Specific Heads: The model branches into multiple "heads" (simple two-layer MLPs). The authors propose three configurations:
- Local Heads Only: One head for each level of the hierarchy.
- Local Heads + Global Head: Adds an extra head predicting the entire label space at once, acting as a regularizer.
- Local Heads + Nested Head: The global head takes the outputs of the local heads as its input to integrate predictions.
- Multi-Task Training: The model is trained by minimizing a weighted sum of losses from all heads simultaneously. This forces the shared encoder to learn features that are useful at every level of granularity.
Experimental Results
HYDRA was evaluated on four standard HTC benchmarks: NYT (8 levels, 166 classes), RCV1-V2 (4 levels, 103 classes), BGC (4 levels, 146 classes), and WOS (2 levels, 141 classes).
As shown in the results, HYDRA consistently improves upon flat RoBERTa baselines across all datasets. Notably, it matches or exceeds the performance of complex SOTA methods that use graph encoders or decoders. For instance, on the NYT dataset, it achieved a Micro-F1 of 81.96 and Macro-F1 of 72.74.
A key finding is the significant gain in Macro-F1 scores (e.g., +2.52 on RCV1-V2). This indicates the model is particularly effective at identifying "long-tail" or rare classes deep within the hierarchy. Furthermore, HYDRA is highly efficient; training time increased by only 1 to 6 seconds per epoch compared to a flat baseline, and the parameter overhead is negligible (approx. 10M additional parameters).
Conclusion
HYDRA demonstrates that the "structural awareness" typically sought through complex graph or generative components can be effectively captured via simple multi-task supervision. While the model assumes a static taxonomy and does not explicitly enforce path integrity during the forward pass, its simplicity and performance make it a strong candidate for practical HTC applications. Future work may explore its scalability to massive taxonomies with thousands of classes.
Summary updated