Abstract
LabelPrompt is a novel prompt-based learning framework designed to enhance Relation Classification (RC), particularly in low-resource "few-shot" scenarios. By embedding semantic label tokens directly into the input prompt and employing an entity-aware contrastive learning module, LabelPrompt bridges the gap between pre-training objectives and downstream RC tasks. Experimental results on benchmarks like TACRED and ReTACRED demonstrate significant improvements, with LabelPrompt achieving a 61.5% F1 score in 8-shot settings on ReTACRED, outperforming existing state-of-the-art methods.
Introduction
Relation Classification (RC) is the task of identifying the semantic relationship between two entities in a sentence. For example, given the sentence "Steve Jobs founded Apple," the model should recognize the org:founded_by relationship between "Steve Jobs" and "Apple."
While Pre-trained Language Models (PLMs) like RoBERTa are powerful, they face two major hurdles in RC:
- Objective Mismatch: PLMs are typically trained on Masked Language Modeling (MLM). Mapping a complex relation label like
org:founded_byto a single vocabulary word (a "verbalizer") often loses semantic nuance. - Entity Confusion: Models may detect a relationship in a sentence but fail to link it to the specific entities provided.
Methods
The authors introduce LabelPrompt, which shifts the paradigm from label generation to a "multiple-choice" selection process.
Label Prompt Tokens and Templates
LabelPrompt expands the PLM's vocabulary with custom tokens representing every possible relation. These tokens are initialized using the semantic embeddings of the label names (e.g., per:title starts with the combined meaning of "person" and "title"). The input template includes all possible label tokens, the subject/object entities, and a [MASK] token, effectively constraining the model's search space.
Entity-Aware Module
Inspired by knowledge graph embeddings (specifically TransE), this module enforces a structural constraint: $Subject + Relation \approx Object$. It uses contrastive learning to ensure the model distinguishes between the true entity-relation triplet and "hard negatives" (random spans from the same sentence).
Attention Query Strategy
To prevent the long list of prompt tokens from distorting the original sentence's meaning, a modified self-attention mechanism is implemented. It uses distinct query projections for prompt-to-prompt, prompt-to-sentence, and sentence-to-sentence interactions, maintaining the independence of the input text.
Evaluation and Results
LabelPrompt was evaluated on four major benchmarks: TACRED, TACREV, ReTACRED, and SemEval 2010 Task 8.
- Few-Shot Dominance: In 8-shot settings, LabelPrompt achieved a 61.5% F1 score on ReTACRED, beating the previous state-of-the-art (KnowPrompt) by 6.2%.
- Data Efficiency: The model's 4-shot performance was often comparable to other models' 8-shot performance, effectively doubling data efficiency.
- Full-Data Performance: Even with full datasets, LabelPrompt maintained a lead, reaching 91.6% F1 on ReTACRED.
Conclusion
LabelPrompt demonstrates that explicitly providing label choices and enforcing entity-relation constraints significantly improves RC performance, especially when data is scarce. Analysis of "Knowledge Neurons" confirms that label tokens successfully guide the model's internal logic. Future work will address the linear growth of prompt length in datasets with very large label sets.
Summary updated