Micro Text Classification Based on Balanced Positive-Unlabeled Learning

Lin-Han Jia, Lan-Zhe Guo, Zhi Zhou, Si-Ye Han, Zi-Wen Li, Yufeng Li · OpenReview

Abstract

In real-world applications, detecting anomalous samples with extremely sparse anomalies is highly challenging, as they are often buried within normal data. This creates a "dual imbalance" Multi-Instance Learning (MIL) problem at both macro (sample scarcity) and micro (instance sparsity) levels. We propose Balanced Fine-Grained Positive-Unlabeled (BFGPU), a framework that reformulates MIL as a fine-grained PU learning problem to address these imbalances in an unbiased manner. Extensive experiments demonstrate that BFGPU significantly outperforms traditional MIL methods and even state-of-the-art Large Language Models (LLMs) in "needle-in-a-haystack" tasks.

The Challenge: Dual Imbalance

Detecting anomalies in complex data like long dialogues or medical images involves two distinct layers of difficulty:

  1. Macro-level Scarcity: Anomalous samples are rare compared to the vast majority of normal samples.
  2. Micro-level Sparsity: Within an anomalous sample, the actual evidence of the anomaly is often just a tiny fragment—a single impolite sentence in a long conversation or a few cancerous pixels in a large tissue slide.

Standard machine learning models often struggle with this "needle-in-a-haystack" scenario. If a model treats an entire dialogue as "bad" based on one sentence, it may fail to learn effectively because most of the dialogue is actually normal. Conversely, traditional Multi-Instance Learning (MIL) often becomes biased toward the majority "normal" class, leading to poor recall for rare anomalies.

Comparison of positive and negative dialogue samples in the CSQI dataset, illustrating how a single anomalous instance defines a negative bag.

Methodology: From MIL to Fine-Grained PU Learning

The core innovation of this work is the reformulation of the MIL problem into a Fine-Grained Positive-Unlabeled (PU) Learning framework.

The Conceptual Shift

Instead of treating anomalies as the "Positive" class, the authors treat all instances from normal bags as Positive (P) and all instances from anomalous bags as Unlabeled (U). This is because we can be certain that every part of a normal bag is normal, whereas an anomalous bag contains a mixture of normal and anomalous instances.

The BFGPU Framework

The BFGPU framework progresses through three stages to refine the detection process:

  • Balanced Loss Function: A novel PU loss function is derived to be theoretically unbiased, preventing the model from gravitating toward the majority class.
  • Macro-Informed Pseudo-Labeling: The model identifies the most representative normal and anomalous instances within the unlabeled bags to create high-confidence labels for iterative training.
  • Adjusted Decision Threshold (ADT): Rather than a fixed 0.5 cutoff, the threshold is dynamically adjusted based on the expected distribution of anomalies, enhancing precision.
The evolution of the learning framework from coarse-grained classification to fine-grained PU learning via Multi-Instance Learning.

Experimental Evaluation

The authors evaluated BFGPU across diverse modalities:

  • Customer Service Quality Inspection (CSQI): Detecting rare impoliteness in long text dialogues.
  • Invasive Ductal Carcinoma (IDC): Identifying tiny breast cancer patches in medical tissue slides.
  • Synthetic Benchmarks: Adapting sentiment analysis datasets (SST-2, IMDB, Amazon) to simulate varying levels of sparsity and scarcity.

Key Results

  • Medical Imaging: On the IDC dataset, BFGPU achieved 73.87% Accuracy, outperforming standard MIL (65.55%) and other PU methods (62.66%).
  • Dialogue Analysis: In the CSQI task, BFGPU reached an F1-score of 75.31%. Notably, other micro-level PU methods failed completely (0.00% F1) due to the extreme sparsity.
  • Comparison with LLMs: On the IMDB "needle" task, BFGPU (83.64% accuracy) significantly outperformed GPT-4-turbo (64.71%), demonstrating that specialized micro-level detectors are more effective than general-purpose LLMs for niche anomaly detection.

Conclusion

BFGPU provides a mathematically grounded solution to the dual imbalance problem in micro text and image classification. By leveraging fine-grained PU learning, it achieves stability and high performance even when anomalies are exponentially rare. Future work will focus on estimating class priors in unsupervised settings and expanding the framework's accessibility for non-expert users.

Summary updated

BibTeX
@misc{jia2025micro,
  author = {Lin-Han Jia and Lan-Zhe Guo and Zhi Zhou and Si-Ye Han and Zi-Wen Li and Yufeng Li},
  title = {{Micro Text Classification Based on Balanced Positive-Unlabeled Learning}},
  year = {2025},
  eprint = {2503.13562},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2503.13562},
}
Figure