Large Margin Prototypical Network for Few-shot Relation Classification with Fine-grained Features

Miao Fan, Yeqi Bai, Mingming Sun, Ping Li

TL;DR

This paper introduces LM-ProtoNet (FGF), an enhanced Prototypical Network designed to classify relationships between entities in text when very few labeled examples are available. By breaking sentences into fine-grained phrases and implementing a "large margin" triplet loss, the model achieves a significant 6.84% accuracy boost over standard few-shot baselines on the FewRel dataset.

What Problem Does This Paper Address?

Relation Classification (RC) is the task of identifying the connection between two entities in a sentence (e.g., in "Paris is the capital of France," the relation is capital_of). While deep learning has mastered common relations with thousands of examples, it struggles with "long-tail" relations—rare types that lack sufficient training data.

The authors tackle few-shot relation classification, where a model must learn to recognize new relation types after seeing only one or five examples. Existing meta-learning approaches like Prototypical Networks (ProtoNet) often rely on global sentence embeddings that may miss subtle linguistic cues, and their training objectives don't always create enough "breathing room" between different relation types in the vector space.

Methods

The authors propose two primary upgrades to the standard CNN-based ProtoNet:

  1. Fine-grained Features (FGF): Instead of encoding the entire sentence as one block, the model segments the sentence into five distinct parts based on the entity positions:
  2. Front mention (before the first entity)

    • Head entity
    • Middle mention (between entities)
    • Tail entity
    • Back mention (after the second entity) Each segment is processed by a CNN, and the resulting embeddings are concatenated. This forces the model to pay closer attention to the local context surrounding the entities.
  3. Large Margin Triplet Loss: Standard ProtoNets use softmax cross-entropy. The authors add an auxiliary triplet loss to the training objective. This loss explicitly pushes the "prototype" (the average embedding of a class) closer to its members (positives) and further away from members of other classes (negatives) by a defined margin ($\gamma$). This creates more distinct clusters in the embedding space, making it easier to classify query instances correctly.

Datasets

The model was evaluated on FewRel, a large-scale supervised few-shot RC dataset.

  • Scale: 100 relations, each with 700 instances.
  • Structure: Split into 64 relations for training, 16 for validation, and 20 for testing.
  • Constraint: The relations in the test set are entirely unseen during training, forcing the model to demonstrate true generalization.

Key Insights and Ideas

  • Structure Matters: Global sentence embeddings often "wash out" the specific interaction between two entities. By explicitly segmenting the sentence, the model captures the "bridge" between entities more effectively.
  • The Margin Benefit: In few-shot scenarios, class boundaries are often fuzzy because the model has seen so few examples. The triplet loss acts as a regularizer that enforces "social distancing" between relation clusters, which is particularly helpful when dealing with the high-dimensional noise of natural language.
  • Synergy: The ablation studies show that while FGF and Triplet Loss both help individually, their combination provides the most substantial gain, suggesting that better features and a better loss function are complementary.

Key Results

The proposed LM-ProtoNet (FGF) outperformed all baselines, including Meta Network, GNN, and SNAIL.

  • 5-way 1-shot: Achieved 76.60% accuracy (a ~7.4% jump over the original ProtoNet).
  • 5-way 5-shot: Achieved 89.31% accuracy.
  • 10-way 1-shot: Achieved 65.31% accuracy (a ~8.9% jump over the original ProtoNet).

Qualitative visualization using t-SNE (Figure 2 in the paper) clearly shows that LM-ProtoNet produces much tighter, more isolated clusters compared to the original ProtoNet, which had significant overlap between different relations.

Limitations and Future Work

  • Backbone Architecture: The study primarily uses CNNs as the underlying encoder. Given the timeline of the paper (2019), it does not explore the impact of Transformer-based models (like BERT or RoBERTa) which have since become the standard for RC.
  • Fixed Segmentation: The five-part segmentation assumes a relatively simple sentence structure. It might struggle with complex, nested, or multi-clause sentences where the relationship logic is spread non-linearly.
  • Hyper-parameter Sensitivity: The balance between cross-entropy and triplet loss ($\lambda$) and the margin ($\gamma$) are additional hyper-parameters that require careful tuning for different datasets.

Summary updated

BibTeX
@inproceedings{fan2019large,
  author = {Miao Fan and Yeqi Bai and Mingming Sun and Ping Li},
  title = {{Large Margin Prototypical Network for Few-shot Relation Classification with Fine-grained Features}},
  booktitle = {ACM International Conference on Information and Knowledge Management},
  year = {2019},
  url = {https://openreview.net/forum?id=vc1gFH9vHB},
}

Loading related content...

Figure