[Paper Review] Small-Text: Active Learning for Text Classification in Python
small-text is a modular, open-source Python library for pool-based active learning in text classification, integrating scikit-learn, PyTorch, and Hugging Face Transformers to enable efficient, GPU-accelerated experimentation with diverse classifiers and query strategies. It demonstrates that SetFit fine-tuning matches vanilla BERT fine-tuning in accuracy but outperforms it in AUC, enabling data-efficient model training.
We introduce small-text, an easy-to-use active learning library, which offers pool-based active learning for single- and multi-label text classification in Python. It features numerous pre-implemented state-of-the-art query strategies, including some that leverage the GPU. Standardized interfaces allow the combination of a variety of classifiers, query strategies, and stopping criteria, facilitating a quick mix and match, and enabling a rapid and convenient development of both active learning experiments and applications. With the objective of making various classifiers and query strategies accessible for active learning, small-text integrates several well-known machine learning libraries, namely scikit-learn, PyTorch, and Hugging Face transformers. The latter integrations are optionally installable extensions, so GPUs can be used but are not required. Using this new library, we investigate the performance of the recently published SetFit training paradigm, which we compare to vanilla transformer fine-tuning, finding that it matches the latter in classification accuracy while outperforming it in area under the curve. The library is available under the MIT License at https://github.com/webis-de/small-text, in version 1.3.0 at the time of writing.
Motivation & Objective
- To address the challenge of high labeling costs in text classification by enabling active learning with minimal human annotation.
- To provide a modular, extensible, and easy-to-use library that integrates widely used ML frameworks like scikit-learn, PyTorch, and Hugging Face Transformers.
- To support both research and application development by offering standardized interfaces for classifiers, query strategies, and stopping criteria.
- To enable efficient experimentation with modern active learning strategies, including those leveraging deep learning and contrastive learning.
- To facilitate reproducible research through open-source code and extensibility for new components and use cases.
Proposed method
- The library implements a modular pool-based active learning framework with pluggable components: classifiers, query strategies, and stopping criteria.
- It integrates scikit-learn for traditional ML models, PyTorch for deep learning, and Hugging Face Transformers for state-of-the-art transformer models, with optional GPU support.
- The library supports 13 query strategies across four paradigms: confidence-based, embedding-based, gradient-based, and coreset-based methods.
- It includes a wrapper for the SetFit training paradigm, which uses contrastive learning to fine-tune SBERT embeddings efficiently with few labeled examples.
- The architecture allows flexible combination of components through standardized interfaces, enabling rapid prototyping and experimentation.
- The library is extensible and optionally installable, with GPU support available via PyTorch and Hugging Face integrations.
Experimental results
Research questions
- RQ1Can a modular active learning library significantly reduce the labeling effort required for text classification while maintaining high model performance?
- RQ2How does the SetFit training paradigm compare to standard BERT fine-tuning in terms of accuracy and AUC on text classification tasks?
- RQ3Which query strategies from the confidence-based, embedding-based, gradient-based, and coreset-based paradigms yield the most effective active learning performance in practice?
- RQ4To what extent can small-text support real-world applications such as abusive language detection and citizen participation text classification with minimal labeled data?
- RQ5How does the integration of modern deep learning components like Hugging Face Transformers and GPU acceleration impact the efficiency and scalability of active learning pipelines?
Key findings
- SetFit fine-tuning achieves classification accuracy comparable to vanilla BERT fine-tuning but outperforms it in terms of area under the curve (AUC).
- The breaking ties query strategy is a robust, drop-in replacement for prediction entropy in uncertainty-based active learning, especially with modern transformer models.
- Active learning with small-text significantly reduces annotation effort in real-world applications, such as classifying German citizen participation texts into eight topics with minimal labeled data.
- The library enables efficient abusive language detection on six datasets, showing that only a fraction of the data is needed when using active learning.
- The integration of Hugging Face Transformers and PyTorch allows for GPU-accelerated training and inference, enhancing performance without requiring GPU usage.
- The modular design of small-text supports rapid experimentation and reproducible research, with multiple studies already successfully applying the library to diverse NLP tasks.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.