Abstract
Zero-shot text classification often struggles with "implicit" queries where the model lacks specific contextual knowledge. We present QZero, a training-free retrieval-augmented pipeline that enriches input queries with relevant categories from a Wikipedia knowledge corpus. Our results demonstrate that QZero significantly boosts the performance of lightweight embedding models, enabling them to achieve results comparable to much larger contextual models while maintaining interpretability and efficiency.
Introduction
The ability to categorize text into unseen classes—zero-shot classification—is essential for dynamic data environments. Traditional methods rely on comparing embeddings of queries and class labels. However, when a query contains entities or concepts not explicitly linked to the target labels in the model's training data (e.g., "Sam Altman" in a technology context), classification accuracy drops. While Large Language Models (LLMs) can mitigate this, they are computationally expensive and often difficult to constrain. QZero addresses this "context gap" by augmenting queries with external knowledge without the need for retraining.
Methodology
QZero employs a two-stage retrieval-augmented pipeline:
- Query Reformulation: The system uses the raw input query to retrieve the top 50 relevant articles from Wikipedia using either BM25 (sparse) or Contriever (dense) methods. It then extracts the categories associated with these articles.
- Classification: The query is reformulated based on the model type. For contextual models (e.g., MPNet), categories are concatenated into a text block. For static models (e.g., Word2Vec), keywords are extracted and frequency-weighted. Final classification is determined by the cosine similarity between the enriched query embedding and candidate class label embeddings.
Experimental Setup
The framework was evaluated across six datasets: AG News, TagMyNews, DBPedia, Yahoo! Answers, Yummly (regional cuisines), and Ohsumed (medical abstracts). These datasets represent a broad range of domains, testing the robustness of the retrieval-augmentation approach.
Results and Discussion
QZero acts as a "knowledge amplifier," particularly for smaller models. On the Yummly dataset, static word embedding models saw performance improvements of up to 38%. Notably, a QZero-enhanced Word2Vec model outperformed the base version of OpenAI’s text-embedding-3-small on the TagMyNews dataset (59.37% vs 50.10%).
The system also provides inherent interpretability; by exposing the retrieved categories, users can audit the model's reasoning. Ablation studies on the number of retrieved documents indicate that performance typically plateaus around 50 documents, balancing contextual enrichment against the introduction of noise.
Conclusion
QZero offers a cost-effective, interpretable solution for zero-shot text classification in resource-constrained environments. While gains are most pronounced for smaller models, the approach also benefits larger models in specialized domains like medicine. Future work will explore more diverse knowledge bases and the application of query reformulation to broader NLP tasks.
Summary updated