Manual Verbalizer Enrichment for Few-Shot Text Classification

Quang Anh Nguyen, Nadi Tomeh, Mustapha Lebbah, Thierry Charnois, Hanene Azzag, Santiago Cordoba MuñozarXiv 2024

TL;DR

MaVEN (Manual Verbalizer Enrichment by Nearest Neighbors' Embeddings) is a novel approach that boosts few-shot text classification by automatically expanding simple class-name labels into a richer set of semantically related words using the language model's own embedding space. By capturing dispersed probability mass without relying on external knowledge bases or large datasets, MaVEN allows smaller language models (~355M parameters) to match or outperform 7B-parameter models in low-data scenarios.

What Problem Does This Paper Address?

Fine-tuning pre-trained language models (PLMs) traditionally requires replacing the model's output layer with a task-specific classification head. However, this introduces a large number of randomly initialized parameters that demand substantial labeled data to train, making it impractical for zero-shot or few-shot scenarios.

Prompt-based fine-tuning circumvents this by converting classification tasks into "cloze" (fill-in-the-blank) questions, leveraging the model's masked language modeling (MLM) objective. A critical component of this framework is the verbalizer—a mapping that translates the model's predicted vocabulary tokens back into class labels. While manual verbalizers (e.g., using just the class name like "sports") are simple, they miss out on the probability mass the model distributes across related words (like "football" or "athletics"). Existing automatic methods to expand these word lists either require large amounts of annotated data or depend on external knowledge graphs like WordNet, which may not be available or well-aligned with the PLM's internal representations.

Methods

The authors introduce MaVEN, an extension of Nonparametric Prompting (NPPrompt) adapted specifically for few-shot fine-tuning. MaVEN enriches manual verbalizers independently of external resources through the following steps:

  1. Core Word Selection: It starts with an initial manual verbalizer derived directly from class names (e.g., $w_0 \in v(y)$).
  2. Neighborhood Expansion: For each core word, MaVEN identifies the top-$k$ nearest neighbors in the PLM's own token embedding layer using cosine similarity. The expanded verbalizer is the union of these neighborhoods.
  3. Neighborhood and Class-Level Aggregation: Unlike zero-shot methods that simply pick the highest-scoring neighbor, MaVEN merges the neighborhoods and computes an aggregated class score. The contribution weights of individual neighbor words are initialized by their embedding similarity and fine-tuned alongside the PLM parameters.
  4. Ensemble Prompting: To mitigate the high sensitivity and instability of prompt choices in few-shot settings, the authors train models on multiple distinct templates and ensemble their outputs using logit averaging.

Datasets

The approach was evaluated across five datasets spanning two languages:

  • AG's News (English): 4 balanced classes of news headlines.
  • DBpedia (English): 14 balanced ontology classes.
  • Yahoo! Answers (English): 10 balanced question-answer categories.
  • FrN (French): A private, imbalanced real-world dataset of press articles across 10 sectors, manually annotated by company collaborators.
  • MLSUM Fr (French): An imbalanced topic classification dataset derived from online newspapers.

Key Insights and Ideas

  • The "Vanishing Benefit" of Enrichment: MaVEN provides massive performance boosts in extremely low-data regimes ($N = 32$ or $64$). However, as the number of training examples increases ($N \ge 128$), the performance gap between MaVEN and a simple manual verbalizer closes. With more data, the LM naturally learns to concentrate its probability mass onto the single core word, rendering neighbor words redundant.
  • LM Embeddings vs. Static Embeddings: Using the PLM's own embedding space significantly outperforms static word vectors like word2vec or GloVe in zero-shot settings. The PLM's embedding space tends to cluster spelling, case, and morphological variants (e.g., "_Sports" vs "_sports"), which aligns perfectly with how the model distributes its predictions. Static embeddings capture broader semantic topics but introduce noise that harms zero-shot alignment.
  • Ensembling Beats Cherry-Picking: Rather than evaluating only the single best-performing prompt template (which introduces evaluation bias), ensembling multiple templates via logit averaging consistently yields higher accuracy and stabilizes the model against changes in neighborhood size $k$.

Key Results

  • Few-Shot Superiority: For $N = 32$, MaVEN achieves an average accuracy improvement of 2.9 percentage points over the standard manual verbalizer baseline across all five datasets. Notable gains include a +10.0 jump on the French FrN dataset and +2.3 on DBpedia.
  • Efficiency Gains: Combining a smaller model (RoBERTa-large or CamemBERT-large, ~355M parameters) with MaVEN yields classification accuracy competitive with or superior to a 7B-parameter model (Mistral-7B-Instruct) utilizing In-Context Learning (ICL), despite using 20 times fewer parameters.

Limitations and Future Work

  • Dependence on Meaningful Seed Words: MaVEN inherently relies on the assumption that class names are semantically meaningful and present in the vocabulary. If class titles are cryptic or uninformative, the initial neighborhood expansion will fail.
  • Architecture Constraints: The current formulation focuses strictly on masked language models operating in encoder-only mode. The authors note that adapting verbalizer enrichment strategies to modern auto-regressive, decoder-only generative models (like LLaMA or GPT architectures) remains an open and promising direction for future research.
  • Language Scope: The evaluation was restricted to English and French datasets, leaving the generalization of these embedding-space dynamics in multi-lingual or low-resource language models to be verified.

Summary updated

BibTeX
@misc{nguyen2024manual,
  author = {Quang Anh Nguyen and Nadi Tomeh and Mustapha Lebbah and Thierry Charnois and Hanene Azzag and Santiago Cordoba Muñoz},
  title = {{Manual Verbalizer Enrichment for Few-Shot Text Classification}},
  year = {2024},
  eprint = {2410.06173},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.06173},
}
Figure