Elamur Research

Efficient Information Extraction in Few-Shot Relation Classification through Contrastive Representation Learning

Paper · 2024 · Philipp Borchert, Jochen De Weerdt and Marie-Francine Moens

Summary

A sentence can mention several people, places or organizations and state different facts about each. Relation classification asks a focused question about such a sentence. Given a particular pair of entities, which kind of relationship does the sentence express between them? It is a step in information extraction, which turns facts in text into structured information. The challenge here is to recognize a relation type from very few labeled examples, including types that were absent during training. An example can show what a relationship looks like in context, but it may also contain names, events and other details that are incidental to the answer.

The paper introduces MultiRep, a method that takes several readings from a single pass through the BERT encoder. It uses a summary token, an average across token vectors, a mask inserted into a prompt, and markers that identify the two entities in the sentence. Each reading emphasizes a different part of the input. During training, a contrastive objective encourages readings of the same sentence to agree and separates them from readings of other sentences. MultiRep joins the resulting vectors and builds a reference for each candidate class by averaging its labeled examples. When written descriptions of the relation types are available, the method also compares the query with those descriptions and adds that evidence to the example-based scores.

The authors evaluate MultiRep on FewRel, a Wikipedia-derived benchmark. Across the reported test settings without descriptions, MultiRep achieves an average accuracy of 90.03, the highest average among the systems compared in that group. With descriptions, its average test accuracy is 93.38, while SimpleFSRE reaches 93.75. The leading system changes with the evaluation setting. MultiRep has the highest test accuracy in 10-Way 1-Shot under either resource condition, reaching 84.18 without descriptions and 91.07 with them. Without descriptions, it also leads on 5-Way 1-Shot validation accuracy at 87.13, while SimpleFSRE leads on that test setting.

The component comparisons help explain where these results come from. When descriptions are supplied, dropping the objective that aligns examples with their descriptions gives the largest accuracy decline among the tested removals in both one-shot validation settings. Removing any individual sentence representation also lowers accuracy there. In a separate comparison without descriptions, training with contrastive alignment improves 5-Way 1-Shot validation accuracy from 84.83% to 87.13%. Using more representations generally improves validation accuracy and reduces variability in the authors’ resource analysis. The shared encoder pass is central to the design, though the wider vectors and extra training comparisons still carry memory and computation costs.

Deep dive: Efficient Information Extraction in Few-Shot Relation Classification through Contrastive Representation Learning

MultiRep classifies relations from a few labeled examples by aligning different views of each sentence, with optional relation descriptions. · about 33 minutes to read

The problem and its context

Recognizing a relationship with little local evidence

A relation classifier receives a piece of text with a target pair already specified. In one of the paper’s examples, a sentence describes Jürgen Hasler as an alpine skier and goes on to mention his Olympic appearances. The target pair is Hasler and alpine skiing. The corresponding FewRel label is sport. The competition history helps tell the reader what sort of sentence this is, but the result needs to characterize the particular pair. The task starts with the entity mentions and ends with a relation label. Locating the mentions and extracting every fact in the passage are separate problems.

The choice of pair becomes especially important when a sentence names several people. One example involving Zarifa Aliyeva and Heydar Aliyev mentions marriage alongside other family ties. An encoder looking at the whole sentence has access to cues for several relationships. The classifier needs to attach the relevant cue to the chosen pair. A general impression that the passage concerns a family leaves the decision open. Parent, child and spouse can each be plausible categories for people elsewhere in the sentence.

The paper studies that decision under few-shot learning conditions. The system sees labeled examples of each candidate relation when it faces a new task. There are deliberately few examples per class, and the relation types used for testing are held apart from those used for training. The system can learn how to compare instances during training, then use that comparison on classes defined by new examples at test time. Its success depends on a representation that can recover what makes two examples instances of the same relationship, even when the words and entities differ.

The authors motivate this setup with two data problems. Many relation types have limited labeled material, and acquiring training data can be disproportionately costly across types. A classification procedure built around numerous examples of each possible class is a poor fit for that setting. An individual support example also has limited scope. It establishes how a relation appears in one sentence, with one pair and one choice of wording. Using it as evidence for another sentence requires the system to recognize a correspondence despite those differences.

What earlier approaches gave the classifier

The paper describes meta-learning and prototypical networks as common approaches to the few-shot problem. Meta-learning here means training across small classification tasks so that the resulting system can handle another task with its own examples. A prototypical network makes the comparison concrete. It encodes the labeled support sentences for a class, averages their vectors into a class representative called a prototype, and compares a query against the available prototypes. That makes the representation consequential. Information retained by the encoder can affect the decision only through the vectors from which the comparison is made.

Prior work had expanded the evidence available to those comparisons. Some approaches bring in external knowledge bases to enrich what the system knows about the entities. Others use dependency parsing information to represent how words are structurally connected within a sentence. Another line of work supplies a short written description of each relation type. A description identifies the meaning of the category in general terms, while a support example shows a concrete expression of it. The paper treats descriptions as especially relevant because they may be available in one application and absent in another.

There was also a choice about which part of the encoder output to use. The entity-marker method puts special tokens around the target mentions and reads the encoder’s contextual vector at the start of each marked span. Concatenating the start vectors gives the classifier a representation centered on the target pair. The method is associated with Matching the Blanks, and the paper notes that entity markers are a common choice for relation classification. Their appeal follows from the task itself. A vector anchored at a marked entity has a direct connection to the pair the classifier is being asked about.

At the same time, a relation can be expressed by words outside the names or descriptions of the entities. A sentence-wide representation can carry information about that surrounding language. A prompted representation gives the encoder a further place to express what links the entities. The paper’s starting point is that the marker positions, the summary position and the prompted position may preserve different clues even though all are contextualized by the input. They may also preserve much of the same information. Combining them therefore raises a question about how the vectors should be trained as well as which vectors to collect.

Why change the representation as well as the inputs?

The authors connect their work to research on the geometry of contextualized vectors, including Ethayarajh’s study of contextualized word representations. They describe prior findings as evidence that the space occupied by sentence representations can be used more effectively. They cite several responses to that problem. Work on sentence embeddings from pretrained encoders explored flow-based transformations. Other studies used whitening, which changes the statistical structure of the vectors, or prompts, which change the input from which the vectors are taken.

Contrastive learning offers another way to shape that space. It defines pairs whose representations should be close and pairs whose representations should be separated. The usefulness of the resulting space depends on what that pairing rule teaches the encoder to preserve. SimCSE constructs different views through dropout. In this context, dropout means temporarily masking some components during computation, giving different representations even when the underlying sentence is the same. The paper also cites Self-Guided Contrastive Learning for BERT Sentence Representations and earlier uses of contrastive objectives specifically for few-shot relation classification.

MultiRep links this line of work to the choice of encoder readout. Its positive pairs come from different positions or aggregation methods applied to the same encoded sentence. Agreement between these views is encouraged before the resulting features are used together. The authors expect that their shared information will help identify the sentence while the combination preserves clues available from the different readouts. If there are relation descriptions, a further objective can align sentence and description representations. The design thus has a way to use extra class information when it exists and a way to improve sentence representations using the input and labeled examples alone.

The method, step by step

MultiRep starts with an episode, a small classification task with its own candidate relations. Each relation comes with labeled support sentences. Query sentences contain marked entity pairs whose relations are to be predicted. The encoder reads the sentences, and the system forms a vector for each from several parts of the encoder output. It then builds a prototype for every class in the episode. During training the predicted classes and the geometry of the representations both contribute to the objective. At evaluation the classifier uses the resulting vectors to compare each query against the classes in its current episode.

How MultiRep classifies relations within an episode

The steps in order.

How MultiRep classifies relations within an episodeStep 1: Sample relations, labeled support sentences and queries1. Sample relations, labeled support sentences and queriesStep 2: Mark entity spans and construct sentence prompts2. Mark entity spans and construct sentence promptsStep 3: Read several vectors from each encoder pass3. Read several vectors from each encoder passStep 4: Concatenate the vectors and average support examples4. Concatenate the vectors and average support examplesStep 5: Encode relation descriptions when available5. Encode relation descriptions when availableStep 6: Score queries against prototypes and available descriptions6. Score queries against prototypes and available descriptionsStep 7: Train with classification and contrastive objectives7. Train with classification and contrastive objectives

Constructing the input and reading the encoder

The sentence input does two jobs at once. It shows the full sentence with explicit span boundaries for the first and second entities, and it presents the entities again in a short prefix. In that prefix, a [MASK] token sits between the entity texts, with punctuation separating the parts. A [SEP] token separates the prefix from the marked sentence, and [CLS] opens the whole sequence. The prefix establishes which pair the mask refers to. The marked body preserves the context in which the pair occurs.

The entity markers augment the sentence in the following way. The expression shows the part of the sequence around the first entity, and the procedure also marks the second entity.

x̄ = [x₀, …, [E1S], xᵢ, [E1E], …, xₙ]

Here x̄ is the augmented sentence. The square brackets around the full sequence indicate an ordered list. The original tokens are represented by x₀, xᵢ and xₙ, where the subscripts denote positions. In this illustration x₀ and xₙ are the endpoints of the original sequence and xᵢ stands for the marked entity text. The ellipses stand for the surrounding tokens. [E1S] and [E1E] are the opening and closing markers for the first entity. The second entity likewise receives boundary markers, including the start marker [E2S]. These markers are distinct from the entity texts inserted into the prefix.

The more general operation of turning an input into a prompt can be written as follows.

xₚᵣₒₘₚₜ = T(x)

Here x is the input, T is the template applied to it, and xₚᵣₒₘₚₜ is the completed prompt sequence. The mask is a position at which the surrounding words can supply evidence about a missing label. The paper relates this way of framing classification to Exploiting Cloze-Questions for Few-Shot Text Classification and Natural Language Inference. In the MultiRep classifier, the object passed on from this position is the contextual vector at [MASK]. The class decision comes from comparing vectors for the episode’s candidate relations.

BERT-Base processes the resulting sequence and produces a contextual representation at each position. The representation at a token depends on its surroundings. The vector at an entity marker can therefore carry information about the rest of the sentence, and the vector at the mask can carry information about the entity mentions. The readouts differ in their point of access to the encoded input. They do not require independent copies of the input to be encoded for each sentence representation.

The authors use average pooling to obtain a view of the input as a whole. Pooling takes the token vectors and averages them into a single vector. They also take the [CLS] vector, drawn from the special summary position used in BERT pretraining. These two views have different origins even though both can reflect the full sequence. Average pooling draws directly on multiple contextual positions. The [CLS] readout uses one contextual position that already serves a sequence-level role.

The third view comes from [MASK]. Its placement between the entities gives the pair an explicit place in the prefix, while the body of the input supplies the evidence for interpreting the pair. The remaining readouts are the vectors for [E1S] and [E2S]. The start markers give separate positions for the first and second entity. The paper describes the conventional entity-marker representation as the concatenation of those two vectors. In the full MultiRep instance representation, both are included as component vectors alongside the pooled, summary-token and mask-token readouts.

Assembling comparable sentence and description vectors

Concatenation places vectors end to end. It keeps the individual components available within the larger vector, which can later be averaged with other instances or scored against them.

Rᵢ = [rᵢ¹; rᵢ²; …; rᵢᴹ]

Here Rᵢ is the combined vector for example i. The lower index i identifies the instance and the upper index on each r identifies its readout. M is the number of readouts included. Inside the brackets, the separators denote concatenation and the ellipsis stands for the intermediate components in their chosen order. In the full construction the components come from average pooling, [CLS], [MASK] and the two entity start positions.

A relation description has a different input format. The authors put the FewRel relation category and its written explanation together, separated by a comma. The description prompt begins with [CLS] and then [MASK], with a colon between the mask and the category-and-description text that follows. The encoder again yields a pooled vector and vectors from the summary and mask positions. A description defines a type of relation, so it has no designated pair of mentions from which to take entity start vectors. The authors fill the extra component slots with versions of [CLS] and [MASK] to which they apply 10% dropout.

Dᵢ = [dᵢ¹; dᵢ²; …; dᵢᴹ]

Here Dᵢ is the concatenated description vector associated with the relation of instance i in the training notation. Each d is a component of the description representation, with the upper index identifying the component and the lower index carrying the association with i. M gives the number of included components. The brackets and separators show that the vectors are placed in sequence, and the ellipsis covers the intervening components. The full description representation contains average pooling, the ordinary summary and mask readouts, and their dropout versions. This gives description and instance vectors compatible dimensions for comparison.

Using dropout here solves a different problem from forming the positive sentence pairs. For those pairs, the method already has distinct readouts from one sentence. In the description representation, dropout supplies variants where the sentence side can draw on the dedicated entity positions. A class description still provides a single piece of semantic evidence about what the relation means. Its several readouts are views of that evidence.

Aligning the readouts of the same sentence

The representation–representation contrastive objective begins with an anchor, a particular readout of a particular sentence in the training support set. A positive is another readout of that sentence. A negative is a readout from a different sentence, taken at the anchor’s corresponding readout type in the paper’s notation. The comparison asks the encoder to retain information that can be recognized across the different views of one input.

rᵢ⁺ = {rᵢᵏ | k ∈ M, k ≠ m}

Here rᵢ⁺ is the positive set for anchor rᵢᵐ, with i identifying the sentence and m identifying the anchor readout. The component rᵢᵏ is readout k of that same sentence. In the membership expression, M stands for the available readout indices, also counted by M in the loss. The braces collect compatible readouts, the vertical bar introduces the membership conditions, ∈ denotes membership and ≠ excludes the anchor’s own index. The plus sign in the superscript marks the positive collection.

rᵢ⁻ = {rⱼᵐ | j ∈ N × K, j ≠ i}

Here rᵢ⁻ is the negative set for the same anchor. rⱼᵐ is readout m of sentence j. N is the number of relation classes in the episode and K the number of support examples per class. In this expression N × K refers to the index range for the support sentences counted by that product. The braces, vertical bar and membership sign again express the conditions for belonging to the set. j ≠ i excludes the anchor’s sentence. The minus superscript marks the negative collection.

This pairing rule uses sentence identity. Two sentences about the same relation can therefore supply negatives to the sentence-level objective if they are different instances. Class identity enters elsewhere, through the support labels used to construct prototypes, the classification loss and, when available, the comparison with descriptions. The objectives operate at distinct levels. The readout alignment preserves distinctions among inputs, while class prediction gives the encoder a reason to preserve the distinctions that matter for choosing among relations.

The similarity comparison is based on cosine similarity, a measure of how closely two vectors point in the same direction. For the individual anchor and one of its positive readouts, the term used in the paper can be written as follows.

ϕ(rᵢᵐ, rᵢᵏ) = (rᵢᵐ · rᵢᵏ) / (‖rᵢᵐ‖ ‖rᵢᵏ‖)

Here ϕ denotes cosine similarity. rᵢᵐ and rᵢᵏ are the two vectors from sentence i, with m and k addressing their respective readouts. The centered dot is the dot product, which multiplies corresponding components and sums the resulting products. The double bars give each vector’s length. Dividing by the product of those lengths normalizes the comparison. The paper describes applying this comparison across the eligible positive readouts and gives an average over the other views of the sentence.

ϕ(rᵢᵐ, rᵢ⁺) = (Σₖ ≠ ₘ ϕ(rᵢᵐ, rᵢᵏ)) / (M − 1)

Here rᵢ⁺ is the positive collection for anchor rᵢᵐ. The sum Σ visits readout indices k other than m, and ϕ(rᵢᵐ, rᵢᵏ) is the individual cosine term. M is the total readout count, and M − 1 is the count of eligible other views. This is the anchor’s positive comparison expressed over the eligible indices instead of tying the summation to a particular ordering of the readouts.

The representation loss uses temperature-scaled similarities in an exponential ratio. At the collection level, its structure is as follows.

Lᵣ꜀ₗ = Σᵢ₌₁…ₙ Σₘ₌₁…ᴹ −log[exp(ϕ(rᵢᵐ, rᵢ⁺)/τ) / exp(ϕ(rᵢᵐ, rᵢ⁻)/τ)], with n = N × K

Here Lᵣ꜀ₗ denotes the representation–representation contrastive loss, called L_RCL by the authors. The two sums visit the support instances i and readouts m. The shorthand n is their episode’s support sentence count, obtained from the number of classes N and examples per class K. rᵢᵐ is the anchor. rᵢ⁺ and rᵢ⁻ denote its positive and negative collections. ϕ represents the cosine comparisons, τ is the temperature used to scale the scores, exp is the exponential function and log takes the logarithm. The leading minus sign makes stronger positive scores relative to negative scores favorable when minimizing the loss. The denominator here denotes the negative comparison at the same level of shorthand as the collection notation. The paper leaves the reduction over the negative collection and the numerical temperature unspecified.

The loss is related to the contrastive approach the authors cite in Representation Learning with Contrastive Predictive Coding. The distinctive choice for MultiRep is the source of the views. The pooled vector and a marker vector, for instance, can make a positive pair even though they are read from different parts of the encoder output. Encoding the sentence once makes those readouts available together. The system still has to compute their similarities during training.

Bringing the class description into the objective

Where the sentence-level contrastive loss tells readouts of the same input to agree, the description loss uses the label of the support example. The example’s combined vector is paired with the description of its labeled relation. Descriptions for other relation types provide the other side of the comparison. The positive example and description differ in wording and function. One narrates a particular instance, while the other characterizes a category. Alignment encourages these two forms of evidence to produce compatible vectors.

Lᵣᴅ꜀ₗ = Σᵢ₌₁…ₙ −log[exp(ϕ(Rᵢ, D⁺)/τ) / exp(ϕ(Rᵢ, D⁻)/τ)], with n = N × K

Here Lᵣᴅ꜀ₗ is the instance–relation description contrastive loss, or L_RDCL. The sum runs over support instance indices i, where n is the product of episode class count N and support count per class K. Rᵢ is the combined support vector. D⁺ is its matching description, selected by the support label, and D⁻ denotes the descriptions that fail that label match. ϕ is cosine similarity applied to the combined vectors, τ controls the scale before exponentiation, exp denotes exponentiation and log denotes the logarithm. The brackets enclose the ratio whose negative logarithm contributes to the sum. As with the sentence loss, the negative side is expressed through the paper’s collection shorthand.

The two contrastive objectives give similarity different meanings. The representation–representation term has access to several readouts of each training instance. It uses the sentence of origin to determine which should align. The description term needs corresponding relation text and support labels. Its positive pair connects the sentence with its class. When descriptions are missing, the first objective still has the information it requires, and the description comparison drops out.

Predicting the class and training across episodes

To classify a query, MultiRep first averages the combined vectors of the support sentences for each candidate relation. This produces N prototypes, each derived from the K labeled examples of its own class. In a one-shot episode the class prototype is the vector of the sole labeled example. In the settings with more examples, the prototype pools evidence over the support sentences. Either way, the query is encoded in the same form as the support sentences and scored against each class representative by a dot product.

The description-enabled method computes another score between the query vector and each class’s description vector. It adds that score to the corresponding support-prototype score before choosing the highest-scoring relation. The class therefore has both a reference derived from observed examples and a reference derived from its written meaning. Earlier work by Liu and colleagues combined the prototype and description vectors directly. MultiRep presents the evidence as separate scores and evaluates a prototype-addition variant as a comparison.

The classification objective is cross-entropy, expressed in the paper for the correct query label as follows.

L꜀ₑ = −log(zᵧ)

Here L꜀ₑ is the classification loss, called L_CE, y is the correct class of the query, and zᵧ is the probability assigned to that class. log denotes the logarithm. The negative sign makes the loss smaller when more probability is assigned to the correct class. The classifier’s prediction is based on the relative class scores, whereas the loss uses the labeled answer during training to assess how much probability it received.

L = L꜀ₑ + Lᵣ꜀ₗ + Lᵣᴅ꜀ₗ

Here L is the full training loss in the description-enabled setting. L꜀ₑ is the query classification loss, Lᵣ꜀ₗ is the same-sentence readout alignment loss, and Lᵣᴅ꜀ₗ is the support instance and description alignment loss. The plus signs indicate that their contributions are added. The setting without descriptions uses class prediction and sentence readout alignment. That formulation retains task supervision even when class definitions are supplied only through examples.

The paper defines the support and query collections for an episode as follows.

S = {(xᵢ, relᵢ) | i runs from 1 to N × K}

Here S is the labeled support collection. Each pair consists of input sentence xᵢ and relation label relᵢ, indexed together by i. The braces enclose the collection and the vertical bar introduces its index range. N is the count of candidate relations and K the number of support sentences sampled per relation. Their product counts the support items in the episode.

Q = {xᵢ | i runs from 1 to N × K}

Here Q is the query collection and xᵢ is its input at index i. The braces and vertical bar again give the collection and its index range. N and K have the same meanings as in the support expression, and the task definition gives the query collection the same count. The query labels are omitted from this expression because the inputs are what the classifier receives for prediction. The correct labels are used to calculate the classification loss during training and accuracy during evaluation.

The relations for training episodes are randomly drawn from the training inventory. Validation and test episodes use held-out categories. The paper expresses the training and test separation as follows.

relₜᵣₐᵢₙ ∩ relₜₑₛₜ = ∅

Here relₜᵣₐᵢₙ and relₜₑₛₜ are the sets of relation types assigned to the training and test splits. The intersection symbol ∩ denotes the types shared by the two sets, and ∅ is the empty set. The paper also keeps validation types apart from the training inventory. Because episodes repeatedly draw different classes and examples, training develops the comparison procedure across tasks rather than fixing the final candidate classes in advance.

The authors train on FewRel for 30,000 iterations, with batch size 4 and a learning rate of 2e-5. The learning rate controls how large a parameter update the training procedure takes. The authors make MultiRep available as code under that name. Their account also specifies the two input templates so that the role of the extra positions is clear even when considering the method apart from the reported scores.

Experiments and results

What the benchmark asks

FewRel is drawn from Wikipedia and contains 700 instances for each of its 100 relation types. The training, validation and test splits contain 64, 16 and 20 relation types, respectively. These counts describe the relation inventory in each split. The episodic evaluation then samples a smaller group of candidate relations within the relevant split. The authors follow the training and evaluation procedure associated with FewRel 2.0, and the table identifies the benchmark for the reported results as FewRel.

The experimental grid varies both the number of candidate relations and the amount of labeled support. The paper writes the settings as 5-1, 5-5, 10-1 and 10-5. In that shorthand, the first number is the number of candidate classes and the second is the number of labeled examples per class. More classes give each query more possible answers. More examples give each prototype a broader basis. Comparing the same shot setting across different numbers of classes keeps the amount of evidence per class fixed. Comparing different shot settings at the same way count keeps the number of possible answers fixed.

The metric is classification accuracy, the share of query instances assigned the correct relation. Each entry belongs to a particular episode setting and split. Validation accuracy is averaged over three random seeds. The test results are reported from the public FewRel leaderboard, where the authors identify their entry by the alias multirep. Some baselines have no validation number in the paper’s comparison. Their test entries can still be compared for the given settings without supplying missing validation measurements.

An additional division separates systems that use written relation descriptions from those operating without them. The baselines in the latter group include Proto, BERT-Pair, CTEG and DAPL. SimpleFSRE is also compared in this group. In the group with descriptions, the alternatives are TD-Proto, HCRP and SimpleFSRE. Every compared system uses BERT-Base as its sentence encoder. That gives the comparisons a common encoder family while leaving the methods free to differ in how they process the inputs, train their representations or make the final decision.

Results without relation descriptions

The validation comparisons favor MultiRep across the reported settings when descriptions are unavailable. In 5-Way 1-Shot, MultiRep reaches 87.13, with BERT-Pair at 85.66 and SimpleFSRE at 84.77. In 5-Way 5-Shot, MultiRep reaches 92.93 and CTEG reaches 92.52. In 10-Way 1-Shot, MultiRep scores 78.42, with SimpleFSRE at 76.85 and BERT-Pair at 76.84. In 10-Way 5-Shot, MultiRep reaches 87.29, compared with 84.89 for CTEG and 83.42 for SimpleFSRE. The reported average validation accuracy is 86.44 for MultiRep, ahead of the other entries with a reported average in that group.

The test comparisons are more mixed. In 5-Way 1-Shot, SimpleFSRE reaches 89.33 and MultiRep reaches 89.20. Both score above the other entries for that condition. In 5-Way 5-Shot, CTEG reaches 95.25 and MultiRep reaches 95.09. In the two settings with the larger number of candidate relations, MultiRep leads the reported test comparisons. Its 10-Way 1-Shot accuracy is 84.18, ahead of SimpleFSRE at 83.41. Its 10-Way 5-Shot accuracy is 91.65, ahead of CTEG at 91.33 and SimpleFSRE at 90.25.

FewRel 10-Way 1-Shot test accuracy without relation descriptions

MultiRep leads the systems compared when each candidate relation has a single labeled example.

FewRel 10-Way 1-Shot test accuracy without relation descriptionsProto: 71.48Proto71.48BERT-Pair: 80.63BERT-Pair80.63DAPL: 77.59DAPL77.59CTEG: 81.29CTEG81.29SimpleFSRE: 83.41SimpleFSRE83.41MultiRep (this paper): 84.18MultiRep (this paper)84.18
The numbers
System or settingaccuracy %
Proto71.48
BERT-Pair80.63
DAPL77.59
CTEG81.29
SimpleFSRE83.41
MultiRep (this paper)84.18

Across all the reported episode settings in this resource group, the average test accuracy is 90.03 for MultiRep and 89.28 for SimpleFSRE. CTEG averages 89.00 and BERT-Pair averages 87.30. DAPL’s average is 86.77 and Proto’s is 81.16. The average captures MultiRep’s overall position, while the individual settings tell a more specific story. Its best comparative test results come with the larger candidate pool. With the smaller pool, another system narrowly leads in each test setting.

The validation and test rankings also matter for the case the paper makes for scarce evidence. The 5-Way 1-Shot validation result supports the authors’ claim that MultiRep can make good use of a lone labeled example without descriptions. The same setup on the test split puts SimpleFSRE slightly ahead. The 10-Way 1-Shot setting has the clearer result across both splits. MultiRep leads the reported comparisons there while dealing with the larger set of possible relation labels.

Results with relation descriptions

When descriptions are available, MultiRep remains competitive and the rankings vary by split and setting. It has the highest 5-Way 1-Shot validation result, at 92.73, followed by SimpleFSRE at 91.29 and HCRP at 90.90. In 10-Way 1-Shot validation, MultiRep’s 86.12 is close to SimpleFSRE’s 86.09 and ahead of HCRP’s 84.11. SimpleFSRE leads in the validation settings with more support examples. It scores 94.05 to MultiRep’s 93.79 in 5-Way 5-Shot and 89.68 to MultiRep’s 88.80 in 10-Way 5-Shot.

On the test split, MultiRep leads the description-enabled group in 10-Way 1-Shot. It reaches 91.07, while SimpleFSRE reaches 90.73 and HCRP reaches 89.95. TD-Proto records 74.32 in the same setting. This comparison holds the amount of labeled support per class at the one-shot setting and supplies descriptions to every listed system. The query must still be distinguished among the larger candidate pool.

FewRel 10-Way 1-Shot test accuracy with relation descriptions

MultiRep has the highest test accuracy among the systems that use descriptions in this setting.

FewRel 10-Way 1-Shot test accuracy with relation descriptionsTD-Proto: 74.32TD-Proto74.32HCRP: 89.95HCRP89.95SimpleFSRE: 90.73SimpleFSRE90.73MultiRep (this paper): 91.07MultiRep (this paper)91.07
The numbers
System or settingaccuracy %
TD-Proto74.32
HCRP89.95
SimpleFSRE90.73
MultiRep (this paper)91.07

SimpleFSRE leads the other description-enabled test settings. In 5-Way 1-Shot it reaches 94.42, while MultiRep reaches 94.18. In 5-Way 5-Shot the entries are 96.37 for SimpleFSRE and 96.29 for MultiRep. At 10-Way 5-Shot, SimpleFSRE reaches 93.47, HCRP reaches 92.10 and MultiRep reaches 91.98. The last setting shows that access to descriptions and additional support can leave the relative advantage with a competing method even though MultiRep’s own accuracy rises compared with the corresponding setting without descriptions.

MultiRep reports average validation accuracy of 90.36 in the description group, compared with 90.28 for SimpleFSRE and 89.01 for HCRP. The test averages rank SimpleFSRE first at 93.75, MultiRep next at 93.38 and HCRP at 92.87. TD-Proto’s test average is 84.34. Thus the highest average validation score and the highest average test score belong to different systems. Individual settings also have different leaders, which is why the paper’s conclusions about one-shot performance are best read alongside the way count and split.

Average FewRel test accuracy across settings with relation descriptions

SimpleFSRE has the highest average, followed by MultiRep and HCRP.

Average FewRel test accuracy across settings with relation descriptionsTD-Proto: 84.34TD-Proto84.34HCRP: 92.87HCRP92.87MultiRep (this paper): 93.38MultiRep (this paper)93.38SimpleFSRE: 93.75SimpleFSRE93.75
The numbers
System or settingaccuracy %
TD-Proto84.34
HCRP92.87
MultiRep (this paper)93.38
SimpleFSRE93.75

Reading the two resource conditions together

For MultiRep, the description-enabled setting gives higher observed accuracy than the corresponding no-description setting on both splits throughout the grid. In 5-Way 1-Shot validation, the entries are 87.13 without descriptions and 92.73 with them. In 10-Way 1-Shot test, they are 84.18 and 91.07. The larger score belongs to the method that has both the description text and the architecture and loss used to exploit it. The comparison measures the combined effect of that resource and its use. The component studies give a narrower look at how much the alignment term matters when the descriptions are already part of the system.

The common encoder also helps clarify what the benchmark is comparing. The experimental question is whether different ways of constructing and using representations improve few-shot decisions at the same backbone level. MultiRep’s improvement in the no-description group is especially relevant to that question because the approach draws additional representations from the sentence encoder itself. The test comparisons with descriptions show that effective use of that extra resource is shared by several approaches, with advantages that depend on the setting.

The appendix records the scale of the authors’ runs. MultiRep has 109.48 million parameters and was trained on an NVIDIA A6000 with 48GB of memory. For the configurations with relation descriptions, the reported combined training and evaluation time is 16 hours for 5-Way 1-Shot and 25 hours for 10-Way 5-Shot. The timings describe those complete runs. The accuracy comparisons use the same encoder family across systems, while the reported timings concern MultiRep under those particular settings.

What the ablations show

Removing either contrastive objective

The main component comparisons use the description-enabled MultiRep system on the FewRel validation split. They cover 5-Way 1-Shot and 10-Way 1-Shot, with full-system accuracies of 92.73 and 86.12, respectively. This is a useful context for studying the contributions because each class prototype has just one labeled support example. The complete system can draw on both that example and a description, and the removals test how the different sources of alignment and the different readouts contribute together.

Removing the representation–representation contrastive loss yields validation accuracy of 92.08 in 5-Way 1-Shot and 85.95 in 10-Way 1-Shot. Both values are below their full-system counterparts. The representation–representation objective therefore contributes even in a configuration that also uses class descriptions. The comparison in the larger candidate setting is close. The table gives measured accuracy for that run condition, and the reported values do not establish how consistently the ordering would persist across further repetitions.

Removing the instance–description contrastive loss yields 90.14 in 5-Way 1-Shot and 84.16 in 10-Way 1-Shot. This is the lowest accuracy among the tested removals in both columns. The description text and the classification architecture with description scores remain part of the description-enabled comparison. The change is the removal of the loss that trains the support and description vectors to agree. The measured result supports using descriptions as part of representation learning as well as scoring the query against them.

The two removals answer a narrower question than the comparison between training with and without descriptions altogether. They test what happens when an objective is dropped from the full configuration in which the other components are still available. They give evidence about each objective’s marginal contribution in that setup. They also show that the larger loss of accuracy in those two columns comes from removing the description alignment term. The results leave open how the balance between the two objectives changes with additional labeled examples or different descriptions.

Removing individual encoder readouts

The full configuration relies on several ways to summarize an instance. Removing average pooling gives validation accuracy of 92.26 in 5-Way 1-Shot and 85.82 in 10-Way 1-Shot. Removing the entity marker representation gives 91.90 and 84.83 for those respective settings. Removing [CLS] gives 91.35 and 85.51. Removing [MASK] gives 91.87 and 85.80. Every tested removal lowers accuracy relative to the complete configuration.

Which readout is most consequential depends on the way count. Dropping [CLS] gives the lowest accuracy among the readout removals in 5-Way 1-Shot. In 10-Way 1-Shot the lowest comes from removing the entity markers. Average pooling gives the highest remaining accuracy among the readout removals in both settings. Even that broad summary contributes alongside the dedicated summary position, the prompted mask and the pair-specific markers.

These results describe the contribution of a component when its companion components remain in place. A strong readout in the full combination can be valuable because it carries a clue that only a few of the other readouts preserve, or because it interacts well with the alignment objective. The ablation scores do not rank the same readouts as standalone classifiers. What the table establishes is that the full combination wins against each tested deletion in these settings, and that no single removal is responsible for the lowest score under both way counts.

The authors also compare their score combination with a variant that directly adds prototype and description representations, following the design they associate with Liu and colleagues. The direct-addition variant reaches 91.75 for 5-Way 1-Shot validation and 85.82 for 10-Way 1-Shot validation. The full setup, which computes and adds the scores separately, is higher in both columns. This is evidence for the implementation compared in those runs. With ordinary dot products and identical vectors, distributing the product over vector addition would produce the same score. The paper reports the empirical comparison but gives limited detail about what makes the direct-addition variant behave differently under that algebraic equivalence.

Varying how many representations are used

The authors also vary the number of readouts rather than removing only one from the full combination. They test different combinations in description-enabled MultiRep and plot average accuracy and its standard deviation on FewRel validation. The reported trend is higher average accuracy and lower variability as more representations are included. This analysis gives a broader view of the relationship between the number of available readouts and the behavior of the classifier.

That trend complements the individual removals. A deletion from the complete system can show that a given readout adds value in the company of the others. The count experiment asks about the overall effect of allowing the system more views. There can be several distinct choices at the same count, and the variability indicates that composition matters as well as count. A broad upward trend can coexist with differences among particular combinations. The paper uses the result to argue that the number of readouts can be adjusted to fit available resources while preserving the general design.

The resource analysis measures validation accuracy and spread. Wider vectors and additional alignments suggest where the cost would change, but the figure reports performance across representation counts. It gives an empirical basis for expecting an accuracy tradeoff when selecting fewer views. The size of the memory or runtime saving for a particular choice is a separate measurement from that accuracy comparison.

Examining predictions with and without contrastive alignment

The appendix presents a comparison that isolates a different condition. It compares MultiRep trained with contrastive learning against a variant without it in 5-Way 1-Shot on the FewRel validation split. Both concatenate the same five sentence readouts. MultiRep obtains 87.13%, while the variant without contrastive learning obtains 84.83%. The comparison uses the no-description baseline, so it shows that simply collecting the same readouts is insufficient to reproduce the full recorded accuracy. How they are trained matters even when relation text is unavailable.

The selected examples illustrate the differences in the types of mistakes. In the sentence about Jürgen Hasler, the full system identifies the sport relation, while the version without contrastive learning chooses military rank. In the comet example, the full system gives main subject and the other version gives constellation. In a sentence about the Caucasus Campaign within World War I, MultiRep selects part of, while the variant selects competition class. Each example has different content, but in each the complete system recovers the labeled category while the other version selects a substantially different kind of relation.

The examples also expose mistakes that survive contrastive training. In the item involving Judy Garland and Liza Minnelli, the predicted relation from the full system is mother where the assigned label is child, which the other variant predicts correctly. The choice illustrates how the same family connection can lead to different labels depending on which entity is first and which is second. In the example naming Mozart and Constanze, the full system chooses mother for a spouse item, and the variant supplies the recorded spouse label. The authors associate these errors with the difficulty of separating closely related family relationships.

Other examples show mistakes that both configurations make. In a sentence about Domenico Dolce and the organization Dolce & Gabbana, the reference label is member of. MultiRep predicts part of and the version without contrastive training predicts military rank. The first error confuses two kinds of affiliation or inclusion, while the second is further from the labeled relationship. Both are incorrect under the accuracy metric. The examples help characterize those errors qualitatively, and their selection means they give no estimate of the frequency of each error type.

The appendix also visualizes sentence embeddings through t-SNE, which projects high-dimensional points into a space that can be viewed. The plots use 120 randomly sampled support embeddings for difficult relation classification examples. The authors observe that MultiRep’s points appear more closely grouped by relation and more separated across types than those of the variant without contrastive training. This qualitative pattern is consistent with the direction of the accuracy comparison. The plots show how selected groups appear in the projection, while the accuracy measurement tests whether the resulting representations actually distinguish labeled queries.

Limitations

Limits the authors identify

The encoder-pass claim is specific. A single pass produces several usable vectors for a given prepared sentence, because the encoder already computes contextual outputs at the relevant token positions. Those outputs still have to be collected and combined. Concatenation increases vector size, and the authors explicitly acknowledge that moving, storing and operating on the resulting vectors may require more memory and computation. The method can economize on repeated encoding for different sentence views while adding work elsewhere.

The authors also identify the extra computation from contrastive learning. Training includes comparisons across readouts and, when descriptions are supplied, comparisons between support instances and written definitions. This work comes on top of making and scoring the prototypes. The representation-count experiment gives evidence about how accuracy and its variability respond to using more views. It does not report the corresponding training cost, prediction time or memory use for every count. The timing figures in the appendix refer to full training and evaluation runs in two description-enabled settings.

Finally, the authors limit the method’s empirical scope to few-shot relation classification. The input format makes sense for a sentence that already has a target entity pair, and the classification procedure assumes a set of candidate categories with labeled support. The paper identifies possible variation when the approach is applied to other language tasks. The reported results establish its behavior on the benchmark from which the episodes were drawn.

Limits visible in the evaluation

The FewRel splits address transfer to unseen relation types within a Wikipedia-derived collection. That is a meaningful kind of novelty. A system has to work with classes it did not encounter during training, and the examples provided in the episode have to do real work. The experiment leaves transfer to different genres, collections and languages open. Another unresolved question is how well the method works on documents in which evidence for a relation goes beyond the sentence supplied.

The candidate inventory and the entities are supplied to the classifier. The exercise therefore measures decisions made after the target pair is available and the candidate relations have been defined. An end-to-end extraction system might also have to find relevant entity mentions, decide which mentions form candidate pairs and determine whether any relation should be assigned. The evidence here concerns the stage that chooses among the episode’s available relation types for a specified pair. It does not measure those preceding decisions or the errors they might introduce.

The descriptions in the enabled setting come from FewRel and include category text and an accompanying explanation. The reader can see that the approach uses both elements, and the loss ablation isolates some of the benefit of aligning that combined description with support examples. The experiment leaves the effect of description quality or wording unresolved. A definition that uses different terminology, provides less detail, or is difficult to distinguish from another definition could change the scores. The paper tests supplied descriptions and their absence, which are concrete resource conditions, and leaves variation within the description-enabled condition for other comparisons.

The validation averages are based on three random seeds, while the test scores use the public leaderboard results. The main and ablation tables give point estimates. Some important rankings are close, including 86.12 versus 86.09 in description-enabled 10-Way 1-Shot validation. The entries establish the reported ordering for those measurements. They leave the stability of small gaps across additional runs or different sampled episodes uncertain. The variability shown in the representation-count analysis addresses a different question from the uncertainty of each head-to-head comparison.

The individual readout removals and the case study provide two views of how the method works. The removals establish the effects of dropping components in description-enabled one-shot validation. The case study compares the same readout collection with and without contrastive learning in a specific no-description condition. These analyses complement one another, but neither establishes that each readout contributes the same amount in other episode settings. The projection of difficult cases is also a qualitative view of a selected sample. It cannot determine whether the better-separated groups account for the overall accuracy difference.

Finally, the score comparisons support the paper’s overall argument most clearly in particular settings. MultiRep leads the average test comparison without descriptions and the 10-Way 1-Shot test comparison in both resource groups. With descriptions, SimpleFSRE leads the average test score and several individual settings. The paper supports the claim that several aligned readouts can help classify unfamiliar relations from limited evidence. The comparative advantage depends on which evidence is available, how many relations the query is judged against, and which split supplies the episodes.

What came after

A Novel Synthetic Dataset for Few-Shot Legal Relation Extraction in German (2026) cites MultiRep and introduces a synthetic dataset for studying few-shot relation extraction in German legal text. The later work addresses the scarcity of labeled relation examples through dataset construction. MultiRep addresses the same broad constraint through representation learning, making more use of each labeled sentence and optionally aligning it with a written description.

The citation connects a method evaluated on Wikipedia-derived FewRel episodes with a dataset effort in a different language and domain. The later work’s identified contribution is the synthetic dataset. Whether it implemented MultiRep’s readouts, compared its contrastive objective or evaluated its transfer to German legal text remains unspecified.

Cite

Cite as Philipp Borchert, Jochen De Weerdt and Marie-Francine Moens. 2024. Efficient Information Extraction in Few-Shot Relation Classification through Contrastive Representation Learning. Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 2: Short Papers).

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.18653/v1/2024.naacl-short.54

@inproceedings{borchert2024efficient,
  title = {{Efficient Information Extraction in Few-Shot Relation Classification through Contrastive Representation Learning}},
  author = {Philipp Borchert, Jochen {De Weerdt} and Marie-Francine Moens},
  booktitle = {Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 2: Short Papers)},
  year = {2024},
  doi = {10.18653/v1/2024.naacl-short.54},
  url = {https://doi.org/10.18653/v1/2024.naacl-short.54}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/borchert-2024-efficient-information-extraction-few-shot/