Semantic matching for text classification with complex class descriptions

Brian de Silva, Kuan-Wen Huang, Gwang Lee, Karen Hovsepian, Yan Xu, Mingwei ShenEMNLP 2023

Abstract

Traditional text classification models often struggle with the "cold-start" problem when new categories are introduced, requiring extensive relabeling and retraining. This paper presents a semantic matching framework that reframes classification as a pairing task between example texts and detailed class descriptions. By utilizing a cross-encoder architecture and a novel zero-shot meta-learning strategy, the proposed model achieves significant performance gains in low-data scenarios, outperforming standard BERT baselines by over 22% in 10-shot settings.

Introduction

In dynamic environments such as product compliance or evolving regulatory landscapes, classification categories are rarely static. Standard supervised models treat classes as arbitrary integer IDs, making the addition of new categories a resource-intensive process. While zero-shot and few-shot learning techniques exist, they often fail to bridge the gap between initial deployment and subsequent data collection. Furthermore, many real-world applications involve complex, multi-section class descriptions rather than simple labels like "Sports" or "Finance."

This research addresses these challenges by treating class descriptions as textual queries. This allows models to be useful from "day zero" using only descriptions and to improve continuously as labeled examples become available.

Methodology

The core of the approach is a Matching Model based on a cross-encoder architecture (e.g., BERT or DeBERTa). Unlike bi-encoders that embed text and labels independently, the cross-encoder allows for deep interaction between the example text and the nuances of the class description through all-to-all attention.

Architecture of the proposed semantic matching model using a cross-encoder approach.

Model Formulation

The input is structured as a concatenation: [CLS] example text [SEP] class description [SEP]. The model is trained to output a binary matching score $f(x_i, c_j) \in [0, 1]$. To optimize for the cold-start scenario, the authors extend Model-Agnostic Meta-Learning (MAML) with specialized zero-shot sampling strategies. This forces the model to practice generalizing to unseen classes during the training phase.

Experimental Setup

The framework was evaluated across four datasets:

  • Public Benchmarks: Yahoo Answers and Amazon Review Data 2018.
  • Industrial Datasets: Two proprietary Amazon datasets (PC1 and PC2) featuring complex, multi-section policy documents as class descriptions.

Results and Discussion

The semantic matching approach demonstrated dominant performance across all evaluated shot counts. A key finding is the "semantic bridge" effect: by using descriptions as inputs, the model learns to interpret definitions rather than just memorizing class-specific patterns.

Performance improvement (Δ Macro AP) of the matching model compared to baselines across different shot counts.

Key Performance Metrics

  • Low-Data Superiority: In 10-shot scenarios, the matching model outperformed standard BERT classifiers by an average of 22.48% in Average Precision (AP).
  • Zero-Shot Efficacy: The model's zero-shot performance (using only descriptions) was 13.30% higher than a 10-shot BERT baseline, highlighting the power of leveraging descriptive metadata.
  • Meta-Learning Impact: The custom MAML extension provided a 4.29% lift over standard training, specifically aiding the transition from zero to few-shot learning.

Conclusion and Future Work

While the semantic matching framework provides a robust unified lifecycle for text classification, it introduces higher computational costs during inference ($O(N \times P)$ complexity for $N$ examples and $P$ classes). Future research directions include integrating retrieval-augmented classification to filter candidate classes and exploring active learning to optimize human labeling efforts. Despite the overhead, the ability to handle complex, evolving class definitions makes this approach a significant step forward for industrial NLP applications.

Summary updated

BibTeX
@inproceedings{silva2023semantic,
  author = {Brian de Silva and Kuan-Wen Huang and Gwang Lee and Karen Hovsepian and Yan Xu and Mingwei Shen},
  title = {{Semantic matching for text classification with complex class descriptions}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.emnlp-main.475},
}
Figure