Abstract
With the growing volume of diverse information, the demand for classifying arbitrary topics has become increasingly critical. To address this challenge, we introduce DRAFT, a simple framework designed to train a classifier for few-shot topic classification. DRAFT uses a few examples of a specific topic as queries to construct a customized dataset with a dense retriever model. A Multi-query retrieval (MQR) algorithm, which effectively handles multiple queries related to a specific topic, is applied to construct the customized dataset. Subsequently, we fine-tune a classifier using the customized dataset to identify the topic. DRAFT shows competitive or superior performance compared to baselines that use in-context learning, such as GPT-3 175B and InstructGPT 175B, on few-shot topic classification tasks despite having 177 times fewer parameters.
Introduction
Topic classification is a fundamental NLP task, yet it faces a significant "long-tail" challenge. While models perform well on broad categories like "Sports" or "Politics," real-world applications often require detecting hyper-specific topics where labeled training data is scarce. Current solutions often rely on In-Context Learning (ICL) with Large Language Models (LLMs). However, LLMs are computationally expensive, slow at inference, and prone to biases. Furthermore, they struggle with one-class classification—identifying if a text belongs to a single specific topic without predefined alternatives.
To overcome these hurdles, we propose DRAFT (Dense Retrieval Augmented Few-shot Topic classifier), a framework that enables small language models to outperform 175B-parameter giants. By leveraging a handful of examples to retrieve a synthetic training set from a large corpus, DRAFT trains a highly specialized classifier that is both efficient and accurate on niche topics.
Methodology
The DRAFT framework operates in two primary stages: building a customized dataset and training a specialist classifier.
1. Building a Customized Dataset
Instead of relying on an LLM's internal knowledge, DRAFT uses a Dense Retriever (a bi-encoder initialized with SimCSE) to search a massive corpus, such as a Wikipedia dump.
- Multi-Query Retrieval (MQR): This core algorithm takes $n$ user-provided examples as queries. It calculates a similarity threshold based on the average pairwise cosine similarity of these queries. It then retrieves the top-$k$ passages from the corpus that exceed this threshold, treating them as positive samples. This allows the system to automatically adapt to the breadth of a topic.
- Negative Sampling: These positive samples are paired with randomly sampled negative passages from the corpus to create a balanced, synthetic training set.
2. Training a Specialist
A relatively small pre-trained language model is fine-tuned on this customized dataset using a standard binary cross-entropy loss. This process transforms a few-shot problem into a standard supervised learning task for an efficient model.
Experimental Setup
We evaluated DRAFT across several diverse settings, including FactsNet, a new benchmark containing 291 unique subtopics across five major categories (Lifestyle, History, Nature, World, Science). We also tested on manually constructed datasets designed to evaluate "hard negatives" (e.g., distinguishing between "Buddhism" and "Islam") and standard benchmarks like DBpedia and TREC.
Results and Discussion
DRAFT demonstrated superior performance and efficiency across all evaluations. On the FactsNet challenge, DRAFT achieved the highest average rank across all categories, outperforming InstructGPT 175B.
Key findings include:
- Efficiency: DRAFT achieves state-of-the-art results with 177 times fewer parameters than GPT-3 baselines.
- Benchmark Success: On DBpedia, DRAFT reached 94.7% accuracy, a 12.4 percentage point lead over the best-performing GPT-3 175B setting.
- Robustness: Unlike LLMs, which can be sensitive to prompt variations, DRAFT showed a consistent positive correlation between the number of input queries and classification accuracy.
- Retrieval as a Data Factory: While most Retrieval-Augmented Generation (RAG) systems use retrieved text as context, DRAFT uses it as a generator for task-specific training data.
Conclusion and Future Work
DRAFT proves that small models, when trained on the right retrieved data, can surpass the performance of massive LLMs for specialized classification tasks. However, the framework is dependent on the quality of the retrieval corpus. Future work will focus on the automatic generation of negative queries to improve decision boundaries and the use of parameter-efficient fine-tuning (PEFT) techniques like LoRA to reduce storage overhead in multi-topic deployments.
Summary updated