TL;DR
Prompt-based tuning for relation classification often falters because relation labels are multi-word phrases that do not map cleanly to single vocabulary tokens, and models can easily confuse which entity pair in a sentence is being evaluated. LabelPrompt solves this by appending all candidate relation labels directly into the prompt template ("giving the model choices"), enforcing entity-relation grounding via contrastive learning, and using segmented attention queries to prevent prompt tokens from polluting sentence semantics. The method yields substantial gains over existing prompt-tuning and fine-tuning baselines, especially in low-resource (few-shot) regimes.
What Problem Does This Paper Address?
Relation Classification (RC) aims to identify the semantic relationship between a specified subject and object entity within a sentence (e.g., determining that Steve Jobs has the relation org:founded_by to Apple).
While prompt-based learning has emerged as an effective paradigm for adapting Pre-trained Language Models (PLMs), adapting it to RC introduces two primary hurdles:
- Verbalizer Mismatch: Standard cloze prompts fill a single
[MASK]token with a vocabulary word. RC labels, however, are complex semantic phrases (e.g.,per:city_of_birth), making manual or automated mapping to single vocabulary tokens difficult. - Entity-Relation Disconnect: A sentence often mentions multiple entities. Standard prompt approaches frequently classify relation semantics at the sentence level without explicitly verifying whether that relation actually holds between the target entity pair $(e_s, e_o)$.
- Semantic Contamination: Concatenating artificial prompt tokens with the input sentence can degrade the pre-trained contextual representations of the original text.
Methods
LabelPrompt addresses these challenges through three synchronized mechanisms built atop $\text{RoBERTa}_{\text{large}}$:
-
Explicit Label Prompting & Verbalization: Instead of forcing the model to guess a natural language word, the authors expand the PLM vocabulary with custom label tokens $\{c_1, \dots, c_m\}$—one for each relation. Each token’s embedding is initialized by averaging the word embeddings of its decomposed label text. All label tokens are explicitly embedded into the prompt template: $$\mathcal{T}(x) = \{c_1, \dots, c_m, [\text{SEP}], e_s, [\text{MASK}], e_o\}$$ The prediction task at
[MASK]is trained with cross-entropy loss ($\mathcal{L}_{\text{mask}}$). -
Relation-Align Module: To stop the newly introduced label tokens from losing their semantic identity inside deep transformer layers, an auxiliary loss ($\mathcal{L}_{\text{label}}$) forces each token $c_i$ to reconstruct its own class label via the verbalizer.
- Entity-Aware Module (TransE Contrastive Loss): Borrowing the translation assumption from knowledge graphs ($s + r \approx o$), the model maps the encoder hidden states of the subject, object, and mask token into a shared relation space. The model minimizes the distance $d(s, r, o) = \|s + r - o\|_2$ for true entity pairs while maximizing it against negative pairs $(s', r, o')$ sampled from random token spans within the same sentence ($\mathcal{L}_{\text{entity}}$).
- Differentiated Attention Query Strategy: To insulate original sentence semantics from extra prompt tokens, the self-attention mechanism uses four distinct query projection matrices ($Q_{pp}, Q_{ps}, Q_{sp}, Q_{ss}$) depending on whether keys and queries originate from prompt tokens or sentence tokens.
The entire architecture is trained end-to-end on a composite loss: $\mathcal{L} = \mathcal{L}_{\text{mask}} + \mathcal{L}_{\text{label}} + 0.04 \mathcal{L}_{\text{entity}}$.
Datasets
The authors evaluated LabelPrompt across four standard RC benchmarks:
- TACRED: A large-scale, crowd-sourced dataset with 42 relations.
- TACREV: A revised version of TACRED with corrected test/validation annotations.
- ReTACRED: A heavily refactored, high-quality re-annotation of TACRED containing 40 relation types.
- SemEval (SemEval-2010 Task 8): A multi-way classification benchmark with 9 relation types plus an
Othercategory.
Evaluations were performed across full-data and few-shot splits (8, 16, and 32 shots per class).
Key Insights and Ideas
- "Give the Model Choices": Providing the label tokens directly inside the input sequence acts like a multiple-choice prompt. Feed-forward network (FFN) neuron analysis reveals that the
[MASK]token selectively activates the exact same neurons as the target label token, confirming that explicit options guide the model's internal knowledge retrieval. - In-Sentence Negatives Matter: Rather than contrasting against entities from other batches, constructing negative entity pairs from unrelated words inside the same sentence forced the model to learn precise structural bindings rather than superficial topic correlations.
- Embeddings Over Random Initializations: Ablations proved that initializing label tokens with decomposed label words substantially outclasses random trainable vectors or generic
[MASK]placeholders, especially when labeled training data is scarce.
Key Results
LabelPrompt consistently outperforms both conventional fine-tuning and strong prompt-tuning baselines (such as KnowPrompt, PTR, and FPC):
- Few-Shot Dominance (8-shot):
- On ReTACRED, LabelPrompt achieved 62.1% $F_1$, outperforming standard fine-tuning (28.5%) and besting KnowPrompt (55.3%) by +6.8%.
- On TACREV, it achieved 34.8% $F_1$ (+2.7% over KnowPrompt).
- On SemEval, it reached 77.0% $F_1$ (+2.7% over KnowPrompt).
- Full-Data Competitiveness:
- Achieved 91.6% $F_1$ on ReTACRED and 73.1% $F_1$ on TACRED, setting top marks among tested prompt-learning architectures.
- Ablations: Removing label prompt tokens caused the largest drop in few-shot performance (a $4.5\%$ drop on 8-shot ReTACRED), demonstrating that explicit options provide the primary performance boost in low-resource settings.
Limitations and Future Work
- Scalability to Large Label Sets: Appending all label tokens $\{c_1, \dots, c_m\}$ into the input template increases input sequence length linearly with the number of classes. For ontologies with hundreds or thousands of relations, this will rapidly exhaust context windows and quadratic attention budgets.
- Future Directions: The authors plan to scale this principle to Large Language Models (LLMs like ChatGPT/LLaMA), adapting discrete "label tokens" into structured "label prompt guidelines" to exploit long context windows (4k–128k tokens) for zero- and few-shot information extraction.
Summary updated