TaxoKnow: Taxonomy as Prior Knowledge in the Loss Function of Multi-class Classification

Mohsen Pourvali, Yao Meng, Chen Sheng, Yangzhou Du

TL;DR

Standard flat text classifiers routinely struggle with long-tailed class distributions and discard the rich parent-child relationships inherent in label systems. TaxoKnow bridges this gap by injecting a hierarchical label taxonomy directly into the training loss function as an explicit regularizer using either symbolic logic (via Sentential Decision Diagrams) or a batch-based Graph Convolutional Network (GCN). This prior knowledge significantly lifts classification performance—especially macro-F1 on tail classes—in both supervised and semi-supervised settings.

What Problem Does This Paper Address?

In real-world multi-class classification, class distributions are notoriously imbalanced, and labeling every fine-grained category is expensive and error-prone. Standard deep learning approaches treat multi-class labels as isolated, "flat" one-hot targets, ignoring the broader taxonomy from which they originate (e.g., that a “cancellation refund” belongs to “billing”, which belongs to “customer support”).

While hierarchical classification methods exist, most practical pipelines still rely on standard flat classifiers. Furthermore, deep neural networks often suffer from shallow statistical curve-fitting rather than structured reasoning. The authors tackle a central challenge: How can we inject hierarchical taxonomy as a prior knowledge constraint directly into the loss function of a standard flat classifier to improve generalization and mitigate class imbalance?

Methods

The authors propose two complementary neuro-symbolic regularizers added to standard cross-entropy loss ($\mathcal{L} = \mathcal{L}_0 + w \cdot \mathcal{L}_{\text{semantic}}$ or $\mathcal{L}_{\text{reg}}$):

  1. Symbolic-Based Semantic Loss:
  2. Uses propositional logic to formulate taxonomic consistency (e.g., if a sample belongs to parent node $a_2$, exactly one of its child classes must be active).
  3. Computes exact, differentiable probabilities over these constraints via Weighted Model Counting (WMC) compiled into Sentential Decision Diagrams (SDDs).
  4. Adapted for both supervised settings (where full taxonomic paths are known) and semi-supervised settings (where unlabeled data leverages the deepest available ancestral concept).
  5. GCN-Based Distillation (Batch-based GCN / BGCN):
  6. Treats the taxonomy tree as a backbone graph. In each training step, documents in a mini-batch are connected to this backbone.
  7. A 2-layer GCN acts as a structural "teacher" model. The Euclidean distance between the neural network’s predicted class distribution $P$ and the GCN's representation $H$ acts as the regularization penalty ($\mathcal{L}_{\text{reg}} = \|P - H\|_2^2$).

Both methods use pretrained language models (BERT-base-cased for English; Chinese BERT-wwm for Chinese) as the underlying classifier.

Datasets

The authors evaluated TaxoKnow on four imbalanced multi-class benchmarks across two languages:

  • Call Center Service (Chinese): An in-house customer log dataset with 134 fine-grained classes organized into 5 domains and 24 intents across 3 hierarchical levels.
  • Shopping Mall (Chinese): An in-house query log dataset with 84 classes across 18 domains and 45 intents (3 levels).
  • RCV1 (English): Manually constructed from Reuters newswire data into a multi-class, 3-level taxonomy consisting of 4 top categories, 33 intermediate categories, and 53 leaf classes.
  • Amazon Product Reviews (English): Filtered to single-label documents and structured into a 3-level taxonomy: 22 top categories, 116 intermediate categories, and 300 leaf classes.

Key Insights and Ideas

  • Leaf constraints alone do almost nothing; taxonomy hierarchy is key: In an ablation study, enforcing an "exactly-one" constraint solely on leaf labels yielded a negligible +0.07% accuracy gain because cross-entropy already easily satisfies this. Enforcing the full multi-level taxonomy boosted accuracy by +2.12% and Macro-F1 by +3.66%.
  • Conditioning on upper concepts rescues the long tail: By penalizing predictions that violate higher-level categorical groupings, the model redistributes probability mass away from dominant majority classes toward plausible minority classes under the same concept umbrella.
  • Trade-offs between Symbolic vs. GCN approaches:
  • Symbolic approach: Highly scalable to deeper/larger taxonomies (e.g., Amazon’s 300 leaves) because SDD evaluation scales linearly with circuit size.
  • GCN approach: Particularly powerful at driving Macro-F1 gains on severe long-tailed distributions when taxonomy size is moderate.

Key Results

  • Supervised Learning:
  • On Call Center Service, the Symbolic method increased Macro Avg F1 from 56.55% (baseline) to 60.84%, with accuracy rising from 74.54% to 76.23%.
  • On Shopping Mall, the GCN method jumped Macro Avg F1 from 81.69% to 86.11%.
  • Semi-Supervised Learning (20% to 40% labeled data):
  • The impact of taxonomy was most pronounced under label scarcity. With only 20% labeled data on Call Center Service, Macro-F1 surged from 43.58% to 52.85% (+9.27%) using the Symbolic method.
  • On Amazon (20% labeled), Macro-F1 rose from 19.99% to 27.94%.
  • On Shopping Mall (20% labeled), Macro-F1 increased from 57.54% to 67.18% using the GCN method.

Limitations and Future Work

  • Diminishing returns with large data: The authors observe that as the volume of labeled training data increases, the marginal benefit of taxonomic regularization diminishes.
  • Hierarchy constraints: The experiments were intentionally constrained to 3-level taxonomies to avoid drifting purely into fine-grained classification; scaling to arbitrary DAGs or arbitrarily deep trees remains open.
  • Single-label focus: The work explicitly filters out multi-label instances to focus on flat multi-class classification. Extending taxonomic loss to multi-label document setups is a natural next step.

Summary updated

BibTeX
@inproceedings{pourvali2024taxoknow,
  author = {Mohsen Pourvali and Yao Meng and Chen Sheng and Yangzhou Du},
  title = {{TaxoKnow: Taxonomy as Prior Knowledge in the Loss Function of Multi-class Classification}},
  booktitle = {NuCLeaR @ AAAI},
  year = {2024},
  url = {https://openreview.net/forum?id=1wlEOltnRP},
}
Figure