Labels Need Prompts Too: Mask Matching for Natural Language Understanding Tasks

Bo Li, Wei Ye, Quansen Wang, Wen Zhao, Shikun Zhang · DOI

Abstract

This paper introduces Mask Matching, a novel paradigm for Natural Language Understanding (NLU) that extends the "prompting" methodology to both inputs and labels. By aligning the mask representations of an input prompt with those of label-side prompts, the model captures the rich semantic information inherent in label names. Experimental results across 14 datasets demonstrate that Mask Matching significantly outperforms traditional fine-tuning and prompt-tuning methods, particularly in low-resource and many-class scenarios.

Introduction

Traditional NLU approaches typically treat labels as arbitrary indices (e.g., 0, 1, 2), ignoring the semantic richness of label names like "Positive" or "Place of Birth." While fine-tuning uses a classification head on meaningless indices, and prompt-tuning relies on labor-intensive "verbalizers" to map mask tokens to words, these methods often fail to scale or fully leverage label semantics. Semantic matching attempts to bridge this gap by matching input embeddings to label embeddings but often relies on suboptimal pooling techniques. This paper addresses these limitations by proposing a unified framework that automatically leverages label semantics through mask-based representations.

Methodology: The Mask Matching Framework

The core innovation, Mask Matching, treats labels as informative data points rather than just targets. The framework consists of three main components:

  1. Input-Prompt: The input text is wrapped in a template containing a mask token (e.g., [X]. It is [MASK].).
  2. Label-Prompt: Each predefined label is similarly wrapped in a template (e.g., Positive is [MASK].).
  3. Matching Mechanism: A Pre-trained Language Model (PLM) generates representations for the [MASK] in the input prompt and for each [MASK] in the label prompts. The model then calculates the similarity (dot product) between the input mask representation and all label mask representations.
Comparison of Mask Matching with conventional classification, semantic matching, and prompt-tuning.

The entire PLM is optimized using cross-entropy loss, creating a shared semantic space where the input's state is directly compared to the potential labels' states.

Task Generalization

Mask Matching is highly versatile and can be applied to a wide range of NLU tasks by adapting the input and label prompts.

Examples of input and label prompts across various NLU tasks including Entity Typing and Relation Classification.

As shown in the figure above, tasks like Entity Typing and Relation Classification benefit significantly from this approach, as the descriptive nature of their labels provides a strong signal that is effectively captured by the mask-based "bridge."

Experimental Results

The researchers evaluated Mask Matching on 14 datasets across 8 NLU tasks, including Topic Classification, Sentiment Analysis, and Natural Language Inference.

Key Findings:

  • State-of-the-Art Performance: Mask Matching consistently outperformed fine-tuning and standard prompt-tuning. Notable gains were observed in Relation Classification (+1.2% on TAC-REV) and Entity Typing (+0.9% on BBN).
  • Low-Resource Superiority: In 10% data scenarios, the method showed dramatic improvements, such as outperforming prompt-tuning by 7.5% on the FEW-NERD dataset.
  • Template Robustness: Performance remained stable across different label prompt wordings (e.g., "is [MASK]" vs "means [MASK]"), suggesting the model captures underlying semantics rather than specific patterns.

Conclusion and Future Work

Mask Matching demonstrates that "labels need prompts too." By using mask tokens as latent translators, the model effectively projects label semantics into the same space as input processing. While highly effective for single-sentence tasks and many-class problems, future work will focus on improving performance for complex sentence-pair tasks and exploring automatic label name expansion to further reduce manual engineering.

Summary updated

BibTeX
@inproceedings{li2024labels,
  author = {Bo Li and Wei Ye and Quansen Wang and Wen Zhao and Shikun Zhang},
  title = {{Labels Need Prompts Too: Mask Matching for Natural Language Understanding Tasks}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  doi = {10.1609/aaai.v38i16.29806},
}
Figure