Abstract
Training deep neural networks from scratch on natural language processing (NLP) tasks requires significant amount of manually labeled text corpus and substantial time to converge, which usually cannot be satisfied by the customers. In this paper, we aim to develop an effective transfer learning algorithm by fine-tuning a pre-trained language model. The goal is to provide expressive and convenient-to-use feature extractors for downstream NLP tasks, and achieve improvement in terms of accuracy, data efficiency, and generalization to new domains. Therefore, we propose an attention-based fine-tuning algorithm that automatically selects relevant contextualized features from the pre-trained language model and uses those features on downstream text classification tasks. We test our methods on six widely-used benchmarking datasets, and achieve new state-of-the-art performance on all of them. Moreover, we then introduce an alternative multi-task learning approach, which is an end-to-end algorithm given the pre-trained model. By doing multi-task learning, one can largely reduce the total training time by trading off some classification accuracy.
Introduction
In the field of computer vision, transfer learning—pre-training on a massive dataset like ImageNet and then fine-tuning on a specific task—is standard practice. In Natural Language Processing (NLP), while models like ULMFiT and BERT have popularized pre-trained language models (LMs) as feature extractors, the methods for utilizing these features for classification have remained relatively simple. Often, models use "pooling" (averaging or taking the maximum of hidden states) to represent a document. FineText addresses the lack of representativeness in pooling by introducing a self-attention mechanism that allows the model to focus on the most informative tokens in a sequence.
Methodology
The FineText framework utilizes a four-step pipeline to transition from general language understanding to specific task classification:
- General Pre-training: An AWD-LSTM model is trained on a large, general corpus.
- Target Task LM Fine-tuning: The LM is fine-tuned on the unlabeled target dataset to adapt to its specific domain and vocabulary.
- Attention-based Decoder: Instead of simple pooling, a self-attention layer calculates alignment scores for hidden states, creating a weighted context vector.
- Classifier Training: The final classification layers are trained using this context vector.
Additionally, the authors propose a Multi-task Learning variant. This approach optimizes both the language model and the classifier simultaneously, acting as a regularizer and significantly reducing the total training time compared to the sequential pipeline.
Experimental Results
FineText was evaluated on six benchmark datasets: AG News, DBpedia, Yelp-bi, Yelp-full, IMDb, and Sogou News. The results demonstrate that the attention-based mechanism consistently outperforms traditional pooling methods.
Key findings include:
- State-of-the-Art Performance: FineText achieved new SOTA results on all six datasets. Notably, it achieved a 25.22% relative error reduction over ULMFiT on the Sogou News dataset.
- Data Quality over Quantity: Pre-training on the smaller WikiText-2 dataset yielded better results than the much larger One Billion Word dataset, suggesting that data relevance and diversity are critical factors.
- Efficiency Gains: The multi-task learning approach reduced training time significantly (e.g., from 6.5 to 3.5 hours on AG News) while maintaining performance superior to previous baselines.
Conclusion
FineText demonstrates that attention-based fine-tuning is a powerful method for text classification, providing better representativeness than standard pooling. While currently focused on LSTM architectures, the success of this approach suggests potential for application in Transformer-based models and other downstream NLP tasks beyond classification.
Summary updated