Abstract
During the past few years, with the advent of large-scale pre-trained language models (PLMs), there has been a significant advancement in cross-domain text classification with limited labeled samples. However, most existing approaches still face the problem of excessive computation overhead. While some non-pretrained language models can reduce the computation overhead, the performance could sharply drop off. To resolve few-shot learning problems on resource-limited devices with satisfactory performance, we propose a prototype rectification framework, ProtoRectifier, based on pre-trained model distillation and episodic meta-learning strategy. Specifically, a representation refactor based on DistilBERT is developed to mine text semantics. Meanwhile, a novel prototype rectification approach (i.e., Mean Shift Rectification) is put forward by making full use of the pseudo labeled query samples, so that the prototype of each category can be updated during the meta-training phase without introducing additional time overhead. Experiments on multiple real-world datasets demonstrate that ProtoRectifier outperforms the state-of-the-art baselines, not only achieving high cross-domain classification accuracy but also reducing the computation overhead significantly.
Introduction
Cross-domain text classification is a critical challenge in Natural Language Processing (NLP), particularly when moving from a source domain with abundant data to a target domain with limited labeled samples—a scenario often referred to as a "data desert." Few-shot learning (FSL) has emerged as a promising solution, aiming to train models that can generalize to new categories from just a handful of examples (e.g., 1-shot or 5-shot tasks).
Current solutions typically fall into two categories: heavyweight models using massive Pre-trained Language Models (PLMs) like BERT, which are accurate but computationally expensive, and lightweight models that are faster but often fail to generalize due to a lack of "semantic depth." Furthermore, most prototype-based methods suffer from representation bias, where a class prototype derived from only a few samples fails to represent the broader class distribution accurately.
Methodology
To address these challenges, we propose ProtoRectifier, a framework that balances computational efficiency with high classification accuracy. The architecture is built upon two core innovations: a Representation Refactor based on DistilBERT (RRED) and a Mean Shift Rectification (MSR) strategy.
Representation Refactor based on DistilBERT (RRED)
To maintain a lightweight profile, ProtoRectifier utilizes DistilBERT—a compressed version of BERT—as its base encoder. However, standard distillation can sometimes overlook domain-specific linguistic nuances. To compensate, we introduce a Bidirectional Gated Recurrent Unit (BGRU) layer. This "refactor" allows the model to capture intricate text semantics and domain-specific patterns that might be lost in a generic distilled model, ensuring robust feature extraction across diverse domains.
Mean Shift Rectification (MSR)
Traditional prototype-based methods represent a class by the average of its few labeled "support" samples. This often leads to representation bias. MSR addresses this by treating the unlabeled query samples as active participants in the learning process rather than passive targets.
Specifically, MSR calculates a shifting term to reduce the distributional gap between labeled support samples and unlabeled query samples. By assigning pseudo-labels to query samples and utilizing the most confident ones, the framework "rectifies" or nudges the class prototypes toward their true centers during the meta-training phase. This process occurs without introducing significant additional time overhead, making it highly efficient.
Experimental Evaluation
We evaluated ProtoRectifier on three diverse real-world benchmarks for cross-domain sentiment and topic classification:
- ARSC: Amazon product reviews across 23 different product categories.
- HuffPost: News headlines spanning various topics like "Money," "Environment," and "Education."
- 20News: A classic dataset of newsgroup posts covering science, politics, and sports.
Results and Discussion
ProtoRectifier consistently outperformed state-of-the-art (SOTA) baselines, including TART and LaSAML. On the 20News dataset, the framework achieved a ~2.28% accuracy improvement in 5-shot tasks and a ~1.35% boost on HuffPost.
Beyond accuracy, the model demonstrated remarkable efficiency. On the 20News dataset, ProtoRectifier was 12x faster than LaSAML and 2x faster than standard BERT-based prototype networks during inference. Furthermore, it reduced Floating Point Operations (FLOPs) by 5x compared to LaSAML, highlighting its suitability for resource-limited environments and edge devices.
Conclusion
ProtoRectifier successfully bridges the gap between heavyweight PLMs and lightweight models in few-shot cross-domain text classification. By leveraging distilled models with a BGRU refactor and a novel mean-shift rectification strategy, it achieves superior accuracy while significantly reducing computational costs. Future work will explore extending this framework to multimodal data and testing its performance on more distant, highly technical domains such as legal or scientific documentation.
Summary updated