Abstract
Topical Text Classification (TTC) is an ancient, yet timely research area in natural language processing, with many practical applications. The recent dramatic advancements in large LMs raise the question of how well these models can perform in this task in a zero-shot scenario. Here, we share a first comprehensive study, comparing the zero-shot performance of a variety of LMs over $TTC^{23}$, a large benchmark collection of 23 publicly available TTC datasets, covering a wide range of domains and styles. In addition, we leverage this new TTC benchmark to create LMs that are specialized in TTC, by fine-tuning these LMs over a subset of the datasets and evaluating their performance over the remaining, held-out datasets. We show that the TTC-specialized LMs obtain the top performance on our benchmark, by a significant margin.
Introduction
Topical Text Classification (TTC) involves assigning one or more labels—such as "Legal," "Sports," or "Microbiology"—to a piece of text. In real-world applications, practitioners often encounter new classification needs where no labeled data is available for training. While Large Language Models (LLMs) have shown impressive zero-shot capabilities in general tasks, TTC remains challenging because the list of possible categories changes constantly depending on the domain (e.g., a legal contract versus a medical abstract).
This study addresses two primary questions: how current LLMs perform across a wide variety of topical domains and whether it is possible to build a "specialist" model that excels at the task of classification itself, even when facing categories it has never seen before.
Methodology
The researchers introduced $TTC^{23}$, a massive benchmark of 23 diverse datasets spanning news (AG News), legal (LEDGAR, CUAD), finance (Banking77), and medical (HeadQA) domains. The benchmark includes various styles, from formal legal contracts to informal Reddit advice, and covers both multi-class and multi-label tasks.
To evaluate zero-shot performance, the study examined three "meta-problem" approaches:
- Natural Language Inference (NLI): Treating classification as a logic puzzle where the model decides if a text entails the hypothesis "This text is about [Topic]."
- Question-Answering (QA): Asking the model binary questions like "Is this text about [Topic]?"
- Instruction Tuning: Providing direct commands to classify text into a specific list of categories.
A novel contribution of this work is TTC-specialization. The 23 datasets were split into folds; models were fine-tuned on a subset and then tested on completely held-out datasets. This approach ensures the model learns the underlying logic of topical classification rather than memorizing specific labels.
Key Results and Insights
The experimental results highlight the power of specialization. Fine-tuning RoBERTa and DeBERTa models on the $TTC^{23}$ folds improved their macro-F1 scores by 8 to 12 points compared to their off-the-shelf versions.
Key findings include:
- Top Performer: The fine-tuned Flan-T5-XXL achieved the highest overall performance with a macro-F1 score of 67.32 on multi-class datasets.
- Efficiency of Specialists: A specialized DeBERTa model (435M parameters) reached a 64.00 F1 score, nearly matching the performance of the 25x larger off-the-shelf Flan-T5-XXL (64.79 F1). This suggests that for specific industrial applications, smaller, fine-tuned specialists are more efficient than massive generalists.
- Throughput Considerations: While generative models like Flan-T5 are powerful, they are significantly slower because they must process all candidate labels within a long prompt. Encoder-only models like RoBERTa remain more practical for high-volume production environments.
- Task Structure over Semantics: Surprisingly, performance on new categories did not necessarily improve just because a category was semantically similar to one seen during training, suggesting the models learn a higher-level task structure.
Conclusion
This study demonstrates that exposure to diverse topical classification data helps models classify entirely unseen topics more effectively. By fine-tuning on a broad collection of TTC tasks, models learn to better understand the relationship between text content and category names. These specialized models serve as excellent starting points for further refinement through active learning or self-training in specific target domains.
Summary updated