Linear Classifier: An Often-Forgotten Baseline for Text Classification

Yu-Chen Lin, Si-An Chen, Jie-Jyun Liu, Chih-Jen Lin · DOI

Introduction

In the current landscape of Natural Language Processing (NLP), the "deep learning revolution" has established Pre-trained Language Models (PLMs) like BERT as the default starting point for almost any text classification task. This shift has led many practitioners to skip baseline testing entirely, jumping straight to fine-tuning complex architectures for several epochs. This paper challenges this trend, re-investigating the performance of simple linear classifiers—specifically Linear Support Vector Machines (SVMs) using TF-IDF features—and demonstrating that they remain a formidable, and often superior, alternative to modern deep learning models.

The Problem: The Bias Toward Complexity

The authors identify two major issues stemming from the neglect of simple baselines:

  1. Efficiency Waste: Massive, GPU-intensive models are frequently deployed for tasks that could be solved by tiny, CPU-based models in a fraction of the time.
  2. False Confidence: Without a simple baseline, it is difficult to diagnose whether a complex model is performing optimally. A PLM might yield a seemingly high score, but without a linear baseline, the researcher may not realize the model is actually underperforming due to structural limitations, such as document truncation or poor hyperparameter tuning.

Methodology

The study re-evaluates the Linear SVM against state-of-the-art PLMs including BERT, RoBERTa, DeBERTa, and Longformer.

The Linear Approach

The researchers utilized a simple uni-gram TF-IDF (Bag-of-Words) feature set paired with a one-vs-rest linear SVM. To address common real-world challenges like label imbalance, they explored two specific extensions:

  • Thresholding: Adjusting decision boundaries to optimize for Macro-F1 scores.
  • Cost-sensitive Learning: Re-weighting losses to give more importance to rare labels.

The Comparison

Using the LibMultiLabel library, the authors compared these linear models against "standard" BERT fine-tuning setups. This comparison serves as a "sanity check" to see how much value deep learning adds over traditional statistical methods.

Datasets and the "Long Document" Challenge

The study primarily focuses on the LexGLUE benchmark, which consists of six legal document classification datasets (e.g., SCOTUS, EUR-LEX, and ECtHR). Legal documents present a unique challenge: they are often significantly longer than the 512-token limit imposed by standard BERT models.

Key Insights

  • The 512-Token Blind Spot: Standard PLMs truncate text after 512 tokens, effectively ignoring the majority of the content in long legal documents. Because linear models use a "bag-of-words" approach, they consider the entire document regardless of length. This architectural difference allowed a simple SVM to achieve a Micro-F1 of 78.2 on the SCOTUS dataset, while a standard BERT model managed only 68.3 until specialized hierarchical processing was implemented.
  • Baselines as Diagnostic Tools: The authors discovered that their initial BERT runs performed worse than the linear models. This discrepancy acted as a diagnostic signal, leading them to realize that the original LexGLUE study had relied on complex hierarchical setups to handle document length. Without the linear baseline, this performance gap might have gone unnoticed.
  • The Cost of Complexity: The disparity in resource consumption is staggering. For the LEDGAR dataset, the linear model trained in just 28 seconds on a CPU. In contrast, BERT required over 6 hours on a high-end GPU. Furthermore, the linear models occupied roughly 1MB of space, compared to the 110M to 149M parameters of BERT variants.

Results and Performance

The study proves that linear models are not just faster; they are competitive. By applying "Thresholding" extensions, the researchers significantly closed the performance gap on multi-label datasets like ECtHR, proving that simple tweaks can make traditional methods robust even against imbalanced data.

Conclusion and Future Work

This paper serves as a critical reminder that complexity does not always equate to quality. While PLMs offer immense power for tasks requiring deep semantic nuance, linear classifiers remain essential for their efficiency, interpretability, and ability to handle long-form text without truncation.

The authors acknowledge that this is an opinion-driven study intended to spark discussion. Future work remains in developing quantitative methods to predict whether a dataset requires the semantic depth of a PLM or if a linear baseline is sufficient. Additionally, exploring more sophisticated feature engineering for linear models, such as n-grams or specialized embeddings, could further narrow the gap between classical and deep learning approaches.

Summary updated

BibTeX
@inproceedings{lin2023linear,
  author = {Yu-Chen Lin and Si-An Chen and Jie-Jyun Liu and Chih-Jen Lin},
  title = {{Linear Classifier: An Often-Forgotten Baseline for Text Classification}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2023},
  doi = {10.18653/v1/2023.acl-short.160},
}
Figure