Text Classification with Novelty Detection

Qi Qin, Wenpeng Hu, Bing LiuarXiv 2020

The Open-World Challenge

Traditional text classification operates in a "closed world" environment, where models assume every test instance belongs to one of the categories encountered during training. However, real-world applications—such as virtual assistants or customer support bots—frequently encounter inputs that do not fit into predefined categories. This challenge is known as Open-World Classification (OWC).

A robust OWC system must achieve two goals: correctly classify instances belonging to known ("seen") classes and reject instances from "unseen" classes as "novel." While previous approaches attempted to define class boundaries using single inputs, this research proposes that comparing new inputs against known examples via pairwise matching is a more effective strategy for identifying outliers.

The PM-Net Architecture

The authors introduce the Pairwise Matching Network (PM-Net), which reframes classification as a relational task. Instead of predicting a label directly, the model takes two text instances ($x_1, x_2$) and determines the probability that they belong to the same category. Two primary architectures were explored:

  • PM-Net 1: This model processes each instance independently through a CNN to extract feature vectors, which are then concatenated and passed to a fully connected layer to calculate similarity.
  • PM-Net 2: This superior architecture treats the embedding matrices of the two instances as separate "channels" (similar to RGB channels in image processing). This allows the CNN to capture fine-grained, word-level interactions between the texts much earlier in the pipeline.
Architectural comparison of PM-Net 1 (left) and PM-Net 2 (right). PM-Net 2 allows for early interaction between text instances by treating them as dual channels.

Inference Strategy

During inference, a new instance $x_t$ is compared against a "memory" of $K$ randomly selected examples from each known class. The model calculates an average similarity probability for each class. To handle novelty detection, the system uses Gaussian fitting to determine a rejection threshold; if the highest probability across all known classes falls below this threshold, the instance is flagged as "novel."

Experimental Results

The models were evaluated on two large-scale datasets: THUCNews (Chinese news) and the News Category Dataset (English headlines). To simulate open-world conditions, the authors varied the ratio of seen to unseen classes (3:7, 5:5, and 7:3).

Performance comparison (Macro-F1) of PM-Net variants against baselines like DOC and L2AC across different datasets and seen:unseen ratios.

As shown in the results table, PM-Net models substantially outperformed state-of-the-art baselines such as DOC (Deep Open Classification) and L2AC. In the most difficult scenario on the THUCNews dataset (3 seen vs. 7 unseen classes), PM-Net 2 achieved a Macro-F1 score of 77.05%, representing an 11.39% absolute improvement over L2AC.

Key Insights

  • Relational Learning: Learning the concept of similarity proves more robust than trying to draw rigid boundaries around classes in high-dimensional space.
  • Early Interaction: The success of PM-Net 2 suggests that letting the model see both texts simultaneously at the convolutional layer allows it to capture phrase-level dependencies that are lost when processing texts in isolation.
  • Memory Scalability: Increasing the memory size ($K$) from 1 to 15 generally improved performance, as more reference points provided a more stable average similarity score.

Conclusion and Future Work

PM-Net demonstrates that pairwise matching is a powerful tool for open-world text classification. While the approach introduces some computational overhead due to the multiple comparisons required during inference, the gains in accuracy and novelty detection are significant. Future research will focus on optimizing the matching process to handle a larger number of known classes more efficiently and refining the automated thresholding mechanisms.

Summary updated

BibTeX
@misc{qin2020text,
  author = {Qi Qin and Wenpeng Hu and Bing Liu},
  title = {{Text Classification with Novelty Detection}},
  year = {2020},
  eprint = {2009.11119},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2009.11119},
}
Figure