Elamur Research

Long Context Question Answering via Supervised Contrastive Learning

Paper · 2022 · Avi Caciularu, Ido Dagan, Jacob Goldberger et al.

Summary

A question about a long document can be difficult even when the answer is present. The relevant details may sit in different paragraphs, surrounded by material that looks pertinent but answers a different question. Caciularu and colleagues study how to help a system recognize which passages support an answer. They focus on tasks where the training data identify both the answer and its supporting text, a setup that gives the reader a second target to learn alongside question answering.

The authors add a training objective that directly compares each question with the candidate evidence in its context. The system reads the question and its context together, then produces a vector for the question and for each candidate passage. The new objective rewards higher similarity between the question and annotated evidence than between the question and distractors. Learned projections let the system make this comparison in a space suited to the kind of answer expected. In HotpotQA, for example, a question can call for a yes, a no, or a span of text. A genuine supporting sentence also serves as a negative example when the system scores it in a space assigned to the wrong question type.

The authors test the objective on QAsper, which asks questions about research papers, and HotpotQA-distractor, which mixes relevant and distracting Wikipedia paragraphs. Adding it improves the reported answer and evidence scores for every tested backbone and size. On the QAsper test split, LED starts at 32.8 overall answer F1 and gains +0.7, while its evidence F1 starts at 29.9 and also gains +0.7. On the HotpotQA-distractor development split, CDLM-large reaches 74.6 joint F1 with the full objective, compared with 73.8 under the original training objective.

The clearest change appears in a separate test of how well similarity alone ranks supporting sentences. For questions that ask for an answer span on the HotpotQA-distractor development split, mean average precision rises from 46.4 with ordinary training to 77.5 with a shared projection and 87.6 with question-type projections. The answer scores move by smaller amounts. Together, the two results show that supervision can make evidence easier to find by comparing it directly with the question, and that this change brings narrower gains on the task of answering it.

Deep dive: Long Context Question Answering via Supervised Contrastive Learning

How supervised contrastive learning helps long-context question answering systems find supporting evidence in research papers and Wikipedia passages. · about 30 minutes to read

The problem and its context

Finding the parts of a text that answer the question

The tasks in this paper give a system a question and a body of text to read. A short passage can put most of the relevant material close together. A long document or a collection of passages can distribute it across sections, paragraphs, or sources. A sentence may identify the entity the question is about, while a different sentence supplies the property being asked for. A plausible answer can also appear in a passage about a different entity. The reader needs to distinguish text that helps establish the answer from text that simply shares its subject.

The two benchmarks put different forms of this problem in view. HotpotQA brings together paragraphs from Wikipedia. A question may require following a connection across documents and recovering the sentences that support the result. QAsper puts the reader inside a single scientific paper. A question prompted by its title and abstract can require details that are distributed through the full text. The answer may be recoverable as a span, require new wording, take the form of a yes or no, or be unavailable in the document. These settings are described in HotpotQA and the QAsper dataset paper.

An answer and its evidence give two views of a system’s performance. The answer can be scored against a reference response. Evidence can be scored by checking whether the system selects the passages people marked as supporting that response. On a question with several supporting facts, a reader might give the correct short answer while selecting only part of the annotated support. Conversely, it might find the relevant passages and still choose the wrong answer. The distinction motivates training and evaluating both outputs. It also makes an evidence prediction potentially informative to someone inspecting the result, because it identifies the text the system has marked as pertinent.

The article’s use of evidence is tied to those labels. The basic unit can be a sentence or a larger passage, depending on how the task is set up. For a given question, members of the annotated support set are positive examples. The other candidates in the supplied context serve as negatives for the contrastive comparison. The same words can therefore have different roles under different questions. The training signal concerns the relation between the question and a particular occurrence of a passage in its context.

What the reader already learned to do

The paper describes an established approach in which the question and candidate passages are joined into a long input. A transformer processes the combined sequence and produces a contextual representation at each position. The representation at a particular position can incorporate information from elsewhere in the input. This makes it possible, for instance, for the representation used to classify a sentence to depend on the question that accompanied it. The approach draws on existing work on long-sequence transformers and attention.

Special tokens give the system defined places to collect information about the input. A marker associated with a sentence provides a vector for an evidence classifier. A classifier turns that vector into scores for the available labels, and ordinary supervised training rewards agreement with the annotated support. The answer component also receives supervision. Depending on the dataset, it learns to extract text, generate a response, or handle the expected answer formats. These objectives can train the same reader jointly, so a change made for the benefit of evidence selection can also change the representations available to the answer component.

This setup already allows question information to affect a sentence’s evidence score. The authors’ question is whether ordinary supervision also makes the sentence and question vectors easy to compare directly. A classifier can use a contextual sentence vector to recognize evidence without arranging that vector close to the question vector under cosine similarity. Cross-entropy, the loss used to reward the correct labels, evaluates the classifier’s output. It does not impose a separate requirement that the question vector rank the supporting sentence above nearby distractors. The proposed objective adds that requirement during fine-tuning.

The distinction matters when interpreting what a representation contains. A sentence marker can encode enough information for a trained classifier to make a useful decision, even if a simple geometric comparison with the question is weak. Direct similarity asks for a particular organization of information. The authors want the relative positions of question and passage vectors to reflect evidence relevance in a space where that relationship can be measured. This adds a testable property to representations that must also support other tasks.

The architectures used in the paper already accommodate long inputs. Longformer and CDLM supply backbones for reading the combined Wikipedia material, and the Longformer Encoder-Decoder, or LED, supplies the text-generating reader for research papers. The paper also names Big Bird as prior work on long sequences. Its proposal concerns the signal used to train an existing reader after it has been built and pretrained. The relevant architectural context comes from Longformer, CDLM, and Big Bird.

Why compare candidates within the same input

Contrastive learning gives a system examples that should receive higher scores and examples that should receive lower ones. The comparison in this paper is anchored on the question. Its positive candidates are the passages annotated as supporting that question. Other passages in the same context give the system alternatives against which to judge those positives. Since some distractors can be related to the topic, the objective targets the distinction relevant to answering the question, instead of a broad judgment about whether the texts discuss similar subjects.

The paper situates this idea alongside contrastive objectives from computer vision and language processing. Some earlier language methods learn representations for independently encoded sentences or apply contrastive supervision during language-system fine-tuning. Here the question and candidate sentences have already interacted inside the same long input by the time they are compared. A candidate vector reflects its occurrence in this reading task. This also means that the method studies relevance among accessible passages in a supplied context. A search system comparing independently encoded documents would start from a different setup. The precedents discussed include A Simple Framework for Contrastive Learning of Visual Representations, SimCSE, and Supervised Contrastive Learning for Pre-trained Language Model Fine-tuning.

A further distinction is the expected form of the answer. HotpotQA makes the categories yes, no, and span available as labels. A projection for span questions can learn to emphasize relationships that help identify an answer expression in the text. A projection for yes or no questions can learn a different comparison. These are possible roles for the projections, since their weights are learned from examples and the authors do not assign individual coordinates a meaning. The question-type experiments ask whether giving the reader this flexibility helps it recognize annotated support.

The method, step by step

From the marked input to a comparison

Start with the question and the full context supplied for that example. The context is divided into candidate units so that the reader has a defined set of places to look for evidence. The authors insert a marker for the question and markers for the context units. The reader then processes the entire marked sequence. Its final representations at the markers provide the vectors used in the contrastive objective.

The evidence annotations tell the objective which comparisons to favor. For each supporting unit, the system is rewarded when its score with the question is high relative to competing scores from the same input. A question with several supporting units contributes a term for each of those units. The procedure can therefore strengthen several relevant question-passage relationships within a single example. It still leaves the normal evidence classifier responsible for predicting which units to select.

The comparison uses learned transformations of the marker vectors. A sentence vector and a question vector can start in the same hidden representation space and still undergo different transformations before they are compared. One transformation is trained for sentences and another for questions. In the full design, each question type gets its own pair. The training label identifies the intended pair of transformations. The scores produced under other types also enter the competition, giving the system a reason to make the match specific to the intended type.

Training the reader with question and evidence comparisons

The steps in order.

Training the reader with question and evidence comparisonsStep 1: Join the question and marked context1. Join the question and marked contextStep 2: Read the entire sequence together2. Read the entire sequence togetherStep 3: Collect question and passage marker vectors3. Collect question and passage marker vectorsStep 4: Project the vectors for each question type4. Project the vectors for each question typeStep 5: Score annotated evidence and competing pairs5. Score annotated evidence and competing pairsStep 6: Combine contrastive and question-answering losses6. Combine contrastive and question-answering losses

The paper illustrates the procedure with a QAsper example. It depicts the question marker in blue, the markers for annotated support in green, and the markers for competing text in red. The colors identify which vectors play which roles in the loss. Each vector comes from the same pass over the long sequence. The figure illustrates the intended training effect: the question should be close to the green vectors under the comparison the authors train the system to make.

Representing the question and the candidate text

The paper labels an example with the index i. Its question is qᵢ, and the ordered input context is Sᵢ.

Sᵢ = ⟨s₁, …, sₘ⟩

Sᵢ denotes the context for example i. Each sⱼ is a unit at position j, and m denotes the number of units. The angle brackets indicate that the context is ordered, and the ellipsis stands for the intervening units. The paper uses M for the count. The subscript ₘ writes that same final position in Unicode. A unit can be a sentence, paragraph, passage, or document under the general setup.

Sᵢ⁺ = {sᵢ₁, …, sᵢₙ}

Sᵢ⁺ is the annotated support set for example i, with ⁺ marking positive evidence. The braces indicate a set. The composite subscripts identify selected positions in the context. The paper calls those selected indices iⱼ and uses N for their count, represented by ₙ at the final selected position in the display. The ellipsis covers any other selected units. The expected answer is denoted by aᵢ. The ordinary QA task is to recover both the answer and its evidence set from the question and context.

[⟨s⟩, qᵢ, ⟨/s⟩, s₁, ⟨/s⟩, s₂, …, ⟨/s⟩, sₘ]

The square brackets enclose the generic input sequence. The commas denote concatenation of the elements in order. ⟨s⟩ marks the question, and ⟨/s⟩ marks a context unit in the schematic. qᵢ here contains the question tokens, and each sⱼ contains the tokens of the corresponding unit. The ellipsis stands for the remaining marked units through position m. The generic schematic conveys where a reader can obtain question and unit vectors. The HotpotQA implementation also marks paragraph titles and document boundaries.

The notation changes meaning slightly once the reader has processed the sequence. In the similarity expressions, qᵢ denotes the contextual vector at the question marker, and s denotes the vector at a candidate marker. The score therefore compares learned representations of texts in their joint context. It has access to whatever information the reader has brought to those marker positions. This makes the comparison different from scoring two standalone text embeddings produced before their texts have interacted.

Giving the comparison its own space

A simple choice would be a dot product of the original vectors. The paper considers that choice as a reference and tests it in the ablation.

sim(s, q) = sᵀq

sim is the similarity function, s is a candidate vector, and q is a question vector. The superscript ᵀ transposes the column vector s so that multiplication by q gives a scalar. The result adds the products of the corresponding vector entries. Both vector lengths and their orientation can affect the score.

sim(s, q) = sᵀq / (‖s‖ ‖q‖)

This alternative is cosine similarity on the original vectors. sim, s, q, and ᵀ retain their meanings. The double bars denote Euclidean length, and the adjacent length terms in parentheses are multiplied. The slash divides the dot product by that product of lengths. The resulting score depends on the angle between the vectors. The authors use this comparison as another reference when studying the role of learned projections.

The base representations already have several jobs. The answer component and evidence classifier need features that support their predictions, while the contrastive objective asks that related texts be close. The authors hypothesize that a learned comparison space can let the system meet that geometric requirement more flexibly. The transformation can emphasize some combinations of components and deemphasize others. Because the loss is trained jointly with the reader, it can also change the original representations through the projection.

The paper describes a question-type-dependent bilinear score as one way to add flexibility.

simₖ(s, q) = sᵀ Wₖ q

simₖ is the score for question type k. s and q are the original marker vectors, and ᵀ denotes transposition. Wₖ is a learned matrix for type k. Multiplication by Wₖ transforms the question features before their dot product with the sentence features. The authors report square matrix dimensions of 768×768 for base-size backbones and 1024×1024 for large ones. Those dimensions determine how many entries the full bilinear matrix needs to learn.

The full method instead maps the two marker vectors separately into a lower-dimensional space. The transformations are linear and can be rectangular. The authors learn separate versions for each question type.

sₖ = Wₖˢ s

sₖ is the transformed sentence vector for type k. Wₖˢ is the learned matrix on the sentence side, with the superscript ˢ labeling its role. s is the original contextual sentence vector. Matrix multiplication combines its components to produce the coordinates in the projected space.

qₖ = Wₖᑫ q

qₖ is the transformed question vector for type k. Wₖᑫ is the learned matrix on the question side, and its superscript ᑫ identifies that role. q is the original contextual question vector. The matrices on the two sides can learn different transformations. Their outputs share a dimension so they can be compared in the same space.

simₖ(s, q) = sₖᵀqₖ / (‖sₖ‖ ‖qₖ‖)

simₖ now means the cosine score after the transformations for type k. s and q identify the input vectors, while sₖ and qₖ identify the projected ones. The superscript ᵀ transposes the projected sentence vector, and the double bars denote the lengths of the projected vectors. The denominator is their product. The score compares directions in the learned space for that type. A shared-projection version uses the same sentence-side and question-side transformations across types.

This design lets the same sentence have different similarity scores under different mappings. For a question annotated as a span question, the span mapping defines the intended space. Mappings associated with yes and no can still score the same sentence-question pair, and those values supply additional competition during training. The labels specify which space should give a strong match. What each matrix keeps from the original representation is learned from the data.

Turning similarities into a training loss

The contrastive loss is based on InfoNCE, which compares a positive score with a pool of competing scores. In the paper’s basic expression, every supporting unit gets its own term. Its score is exponentiated and divided by the sum of exponentiated scores for the candidate context units. The loss is the negative logarithm of that fraction, summed over the annotated evidence. The originating contrastive objective is described in Representation Learning with Contrastive Predictive Coding.

Lᵢ(QE) = −∑ₛ₊∈ₛᵢ₊ log( exp(simₖ(s⁺, qᵢ) / τₖ) / ∑ₛ∈ₛᵢ exp(simₖ(s, qᵢ) / τₖ) )

Lᵢ(QE) is the question-evidence loss for example i, and QE identifies this component. The outer ∑ runs over candidates s⁺ in the positive set Sᵢ⁺. The inner ∑ runs over candidates s in Sᵢ, the supplied context. The symbol ∈ means membership in the indicated set or context. Inside the scores, s⁺, s, and qᵢ stand for the marker vectors of a positive unit, a candidate unit, and the question. simₖ is the selected similarity function for question type k, and τₖ is its temperature. exp is the exponential, log is the logarithm, the slash denotes division, and the minus sign makes a small positive fraction incur a larger loss. The parentheses group the operations. The contrastive contribution to training averages the per-example losses over the applicable examples.

Exponentiation turns each similarity into a positive weight. Normalizing by the sum means that raising the score of a competing candidate can reduce the share assigned to a supporting unit. An example’s annotated positives each receive credit through their own numerator. When a question has several supporting units, the objective therefore asks that each receive a share of the total score. It uses the supplied context as a source of alternatives to the positive passage.

The temperature determines how sharply score differences affect those shares. With a lower temperature, dividing by it amplifies differences before exponentiation, so the highest scores take a larger share. A higher temperature softens the competition. The full method can use a different temperature for each question type. A comparison in the experiments tests whether the separate values help beyond using the same value throughout.

The paper extends the candidate pool by projecting every question-sentence pair through the mappings for all available types. A supporting sentence scored in the correct type’s space keeps its positive status. Scores obtained under the other mappings count as negatives, including scores from genuinely supporting sentences. An unrelated sentence receives negative status under every mapping. This extension makes the value of a positive score depend on both the identity of the sentence and the space in which the score was obtained. It adds supervised distinctions without requiring the annotators to supply more passages.

For instance, consider the role of the span label in HotpotQA. The system can produce a high score for an annotated supporting sentence when the question and sentence pass through the span projections. If their scores also rise in the yes and no spaces, those scores compete with the intended match in the contrastive objective. The sentence’s evidence status is fixed by the annotation. It is the alternate comparison that receives the negative role. This distinction matters because a wrong-type negative still contains relevant information for the original question.

Keeping the answer and evidence objectives

The normal task loss remains part of training. The authors combine it with the question-evidence loss through a weighted sum.

L = (1 − λ) · L(QA) + λ · L(QE)

L is the combined loss. L(QA) is the original question-answering loss for the benchmark, and L(QE) is the aggregate question-evidence contrastive loss. λ controls the proportion assigned to the contrastive term. The expression 1 − λ gives the remaining weight to the original task loss, · marks multiplication, and + adds the weighted values. The role of the original task loss is to reward the outputs that the benchmark asks for. The role of the additional loss is to shape the scores obtained from question and candidate vectors.

On QAsper, the original task loss combines evidence classification with text generation. The generation loss is teacher-forced, meaning that during training the decoder receives the reference answer prefix as it learns to predict its next token. The evidence component uses the annotated support. The contrastive component applies only to answerable examples with at least one annotated evidence sentence. Such a restriction ensures that a positive candidate exists for the numerator. The ordinary task objective keeps the unanswerable examples part of the reading task.

For HotpotQA, the paper describes the QA loss using standard cross-entropy for answer extraction and follows the established joint setup for predicting supporting facts and answers. The input joins the question with every supplied paragraph. Special tokens denote the question boundaries, paragraph titles, and sentence boundaries. Newly added tokens begin with random representations before fine-tuning. The implementation uses global attention at question tokens, title-start tokens, and sentence marker positions, giving those designated positions access across the sequence under the Longformer setup.

How training was configured

In QAsper, the authors use Adam with a triangular learning-rate schedule and 10% warmup. Warmup starts training below the peak learning rate and raises it during the early part of the schedule. According to the authors, they searched manually using only part of the training data and found that smaller batches tended to perform better. The reported settings use 10 epochs, a peak learning rate of 5e −5, and a batch size of 2. An epoch is a pass through the training data. The authors use gradient checkpointing for full text to save memory by recomputing selected intermediate values during training. They report 30–60 minutes per epoch on a single RTX 8000 GPU. The optimizer comes from Adam: A Method for Stochastic Optimization.

For HotpotQA, the authors retain the earlier fine-tuning scheme. They train for 5 epochs with a batch size of 32, a learning rate of 1e −4, and 100 warmup steps. Fine-tuning takes approximately 6 hours per epoch on four 48GB RTX8000 GPUs. The base CDLM checkpoint was available from earlier work. For the larger CDLM comparison, the authors pretrained a larger version with the existing CDLM pretraining code. That gave them base and large variants to compare with the two Longformer sizes.

For the contrastive objective, the authors search over several projection widths relative to the hidden width of the reader. The candidates range from the full width through d/2, d/4, and d/8, where d is the hidden representation dimension. They search the values 0.2, 0.4, 0.6, 0.8, and 1.0 for temperature, separately by question type when applicable. They try the same values for the loss weight λ. The paper also reports that applying dropout at rate 0.1 to the linear projections consistently improved the results. Dropout randomly suppresses some activations during training. The authors make the implementation available as long-context-qa-contrast.

Experiments and results

Reading research papers with QAsper

QAsper tests whether a reader can answer information-seeking questions about academic papers. People with natural language processing experience formulated questions after viewing the title and abstract. The answer and evidence were prepared with access to the full paper. This construction creates room for a realistic information gap. The text that prompts a question can identify the subject without containing the material that settles it. The authors report that more than half of QAsper’s examples require evidence from multiple places in the paper.

The benchmark includes extractive questions, whose responses can be lifted from the source, and abstractive questions, whose answers are expressed in generated text. It also includes yes/no and unanswerable questions. These categories allow the authors to inspect whether a change is concentrated in one answer format. The experiment uses LED-base, an encoder-decoder that can read the long input and produce answer text. The authors follow the QAsper setup and note that its earlier experiments found LED-base stronger than LED-large on this dataset.

The baseline is LED trained with the existing answer and evidence objectives. The comparison adds the contrastive objective to that setup. The authors adopt the benchmark’s F1 metrics and report separate development and test results. F1 combines precision and recall. For answer text the score reflects agreement with the reference response under the benchmark’s scoring, while for evidence it reflects agreement between selected and annotated support. The table gives the baseline and the change from adding the objective. Reporting the changes in that form keeps the size of the improvement distinct from the original score.

On the development split, overall answer F1 starts at 29.1 and improves by +0.9. Evidence F1 starts at 23.9 and improves by +1.0. On the test split, overall answer F1 starts at 32.8 and the change is +0.7. Evidence F1 starts at 29.9 and the change is also +0.7. The development and test results point in the same direction for both tasks. They measure two outputs of the reader, so the agreement tells us that the extra supervision pays off in the benchmark’s evidence predictions as well as in its final responses.

The breakdown by answer format shows different gains. For extractive answers, development F1 starts at 26.1 with a change of +0.2, and test F1 starts at 31.0 with a change of +0.2. For abstractive answers, development F1 starts at 16.6 and gains +0.8, while test F1 starts at 15.8 and gains +1.0. The differences in the starting values reflect that these rows describe distinct groups within the benchmark. Each change should be read against its own baseline and split.

For yes/no questions, development answer F1 starts at 67.5 and gains +1.6. Test answer F1 starts at 70.3 and gains +0.2. For unanswerable questions, development answer F1 starts at 28.6 and gains +1.5, while test answer F1 starts at 26.2 and gains +1.9. The unanswerable results concern the jointly trained reader. Those examples do not receive the contrastive term directly. Training on the eligible examples can still change the shared reader used for all questions, and the paper reports the gains without isolating the mechanism behind this category.

The subtype results make the overall change easier to interpret. Extractive answer F1 improves by the same reported amount on both splits, while the yes/no gain differs between them. The largest-looking changes therefore depend on which part of the benchmark is inspected. The overall answer score and the evidence score provide broader comparisons than a single subtype, and both improve on each split.

Reading across Wikipedia paragraphs with HotpotQA-distractor

HotpotQA-distractor supplies 10 paragraphs from Wikipedia documents for each question. Two are gold paragraphs that contain the information needed to answer, and eight are distractors. The paragraphs are mixed and shuffled. The reader must identify supporting sentences and produce the answer. A gold paragraph can contain several sentences, so recognizing a relevant paragraph still leaves the task of finding the specific support within it. In this experiment, the question and all the paragraphs enter the same long context.

The development-set comparisons cover Longformer-base, Longformer-large, CDLM-base, and CDLM-large. Each version has a baseline trained under the earlier task setup, and each is also fine-tuned with the additional loss. Using both sizes lets the authors check whether the direction of the change holds across more than one capacity for each backbone. It also gives context for the differences between the original backbones, which already have different supporting-fact scores before the extra objective is added.

The reported metrics are answer F1, supporting-fact F1, and joint F1. Answer F1 scores the answer output. Supporting-fact F1 scores the selected evidence sentences. Joint F1 reflects performance on the answer and evidence together. A reader can consequently improve on the joint score by becoming more successful at returning the correct combination of answer and support. The three values should be interpreted according to what each measures, since the joint score makes demands on both outputs.

CDLM-large with and without contrastive supervision on HotpotQA-distractor development joint F1

The added question-evidence objective raises joint performance for CDLM-large.

CDLM-large with and without contrastive supervision on HotpotQA-distractor development joint F1CDLM-large with ordinary training: 73.8CDLM-large with ordinary training73.8CDLM-large with question-evidence contrastive training (this paper): 74.6CDLM-large with question-evidencecontrastive training (this paper)74.6
The numbers
System or settingJoint F1
CDLM-large with ordinary training73.8
CDLM-large with question-evidence contrastive training (this paper)74.6

For Longformer-base, the HotpotQA-distractor development baseline is 74.5 answer F1, 83.9 supporting-fact F1, and 64.5 joint F1. The changes from contrastive training are +0.9, +0.2, and +1.0 respectively. CDLM-base starts at 74.7 answer F1, 86.3 supporting-fact F1, and 66.3 joint F1. Its changes are +0.9 for answers, +0.3 for supporting facts, and +0.2 for joint performance.

Longformer-large starts at 81.3 answer F1, 88.3 supporting-fact F1, and 73.2 joint F1 on the same development split. The reported gains are +0.3 for answer F1, +0.1 for supporting-fact F1, and +0.9 for joint F1. CDLM-large also starts at 81.3 answer F1. Its supporting-fact baseline is 89.1, and its joint baseline is 73.8. The changes are +0.3 for answer F1, +0.6 for supporting-fact F1, and +0.8 for joint F1.

The comparisons show a consistent direction across the reported metrics, with different magnitudes by architecture and size. Longformer-base records a larger joint change than CDLM-base, even though their answer changes are both +0.9. Among the large versions, CDLM records the larger change in supporting-fact F1, while Longformer records the larger change in joint F1. Those results are compatible with improvements on different subsets of questions. The aggregate scores do not identify which examples supply the joint gains.

The authors report bootstrap significance at p < 0.01 for the main results. Bootstrap testing uses resampling to assess how unusual the observed differences would be under the test’s comparison. The significance statement is distinct from the size of the score changes. In these experiments, the reported gains are generally modest on the answer and evidence outputs, and the evidence-ranking analysis shows much larger changes on a metric that directly uses the feature the new objective trains.

What the ablations show

Direct similarity becomes a better way to rank evidence

Before asking which parts of the objective contribute to joint F1, the authors examine whether the question and evidence vectors behave as intended. They take the CDLM-large representations on the HotpotQA-distractor development split and rank the candidate sentences by cosine similarity with the question. That score does the ranking work directly. The resulting experiment measures what a similarity calculation can recover from those representations, alongside the normal evaluation of the reader’s predictions.

The authors report mean average precision, or mAP, by question type. Average precision rewards rankings that put relevant candidates near the top and place other relevant candidates early as well. Mean average precision aggregates this measure across the questions being evaluated. The ranking here is over candidate sentences for a question. It measures whether annotated supporting sentences tend to rise ahead of distractors. It does not require the reader to compose an answer from the passages it ranks highly.

Question-evidence cosine ranking for span questions on HotpotQA-distractor development mean average precision

Training with type-specific projections yields the strongest direct ranking of supporting sentences.

Question-evidence cosine ranking for span questions on HotpotQA-distractor development mean average precisionOrdinary question-answering training: 46.4Ordinary question-answering training46.4Contrastive loss with a shared projection: 77.5Contrastive loss with a sharedprojection77.5Contrastive loss with question-type projections (this paper): 87.6Contrastive loss with question-typeprojections (this paper)87.6
The numbers
System or settingmAP
Ordinary question-answering training46.4
Contrastive loss with a shared projection77.5
Contrastive loss with question-type projections (this paper)87.6

The paper finds the same ordering for the other question types. For yes questions in the HotpotQA-distractor development split, mAP is 8.4 with the ordinary task loss, 72.4 with a shared projection under contrastive training, and 86.3 with question-type projections. For no questions, the corresponding values are 4.9, 65.2, and 84.2. The span questions begin from a stronger similarity ranking, while the shared and type-specific projected variants give higher scores than ordinary training for all three types.

The size of these movements helps explain the authors’ motivation. Ordinary training gives CDLM-large strong supporting-fact scores through its task predictions. At the same time, cosine comparisons between its original marker vectors can give weak rankings, particularly for yes and no questions. The trained classifier and the similarity calculation read the representations in different ways. A high evidence-classification score can therefore coexist with weak direct question-evidence alignment.

Moving from ordinary training to a shared projection changes how the vectors are trained and how they are compared. That comparison establishes the behavior of the combined change. Moving from shared to type-specific projections asks a narrower question about whether the comparison benefits from being conditioned on the question type. The type-specific setting gives the highest mAP across the categories, and the joint-F1 ablation tests whether that advantage extends to the system’s task outputs.

Which choices carry through to the task score

The controlled comparisons use CDLM-large and joint F1 on the HotpotQA-distractor development split. The full version uses the projected cosine, type-specific temperatures, and the extra negatives generated by wrong-type projections. Each alternative modifies a design choice in that setting. The score of the full configuration is 74.6 joint F1. This is the same task measure used to compare the original and extended training setups.

Contrastive design choices for CDLM-large on HotpotQA-distractor development joint F1

The full configuration scores highest, and a raw dot product gives the weakest result.

Contrastive design choices for CDLM-large on HotpotQA-distractor development joint F1Full question-type contrastive design (this paper): 74.6Full question-type contrastive design(this paper)74.6Shared temperature: 74.2Shared temperature74.2Raw dot product: 73.1Raw dot product73.1Raw cosine similarity: 74.0Raw cosine similarity74.0Question-type bilinear similarity: 73.7Question-type bilinear similarity73.7Shared projection: 74.0Shared projection74.0Exclude wrong-type projected negatives: 74.2Exclude wrong-type projected negatives74.2
The numbers
System or settingJoint F1
Full question-type contrastive design (this paper)74.6
Shared temperature74.2
Raw dot product73.1
Raw cosine similarity74.0
Question-type bilinear similarity73.7
Shared projection74.0
Exclude wrong-type projected negatives74.2

Sharing one temperature across the types gives 74.2 joint F1, with a reported change of -0.4 from the full configuration. The temperature controls the strength of the competition between similarities. The result supports allowing that strength to differ by question type in this setup. The table does not show the chosen values for each type, which leaves open whether the gain follows mainly from one category or from smaller contributions across several.

Using the raw dot product gives 73.1 joint F1, with a change of -1.5 from the full configuration. This also scores below the ordinary CDLM-large baseline of 73.8 on that split. The result shows that adding a contrastive loss can be counterproductive in this experiment if it compares the original vectors with this particular score. The dot product uses vector lengths as well as their directions, and the objective acts directly on vectors that also serve the QA task. The ablation measures the combined consequence of that choice. It does not isolate a cause for the performance drop.

Raw-vector cosine similarity gives 74.0 joint F1, with a change of -0.6 from the full design. It does better than the raw dot product and scores above the ordinary baseline. This qualifies the authors’ concern about comparing unprojected representations. The effect depends on the comparison used and on what it is compared against. In this experiment, the projected, type-specific cosine performs better than either raw comparison under joint F1.

The question-type bilinear score gives 73.7 joint F1, with a change of -0.9 from the full configuration. It has learned weights and question-type conditioning, yet its result sits below the projected cosine. The comparison therefore shows that adding type-specific parameters by itself is insufficient to reproduce the full result in this setting. The bilinear and projected cosine scores differ in how they transform the vectors and in whether they normalize them by length. The reported score compares those designs as a whole.

Using a single learned projection with the projected cosine gives 74.0 joint F1, with a change of -0.6. This is the direct task counterpart to the shared-versus-type-specific comparison in the ranking analysis. A shared space still lets the contrastive objective act on a learned comparison separate from the original vectors. Giving each type its own space improves the reported joint score. The result supports a type-conditioned notion of relevance in these experiments, without assigning a linguistic meaning to any individual learned feature.

Removing the extra negatives from wrong-type projections gives 74.2 joint F1, with a change of -0.4. The remaining training still includes competitors from the question’s context. What it loses is the requirement to distinguish a suitable mapping from a different mapping for the same pair. The lower joint score suggests that this additional form of competition contributes alongside the choice of projection and temperature. Since the ablations vary features from the full configuration, their reported changes describe dependencies in that configuration. They do not establish how the features would combine under other settings.

What the representation plot adds

The authors also visualize representations from HotpotQA validation data before and after contrastive training converges. They normalize the relevant marker vectors and use principal component analysis, or PCA, to create a low-dimensional view. PCA chooses directions that account for variation in the vectors. The plot offers a way to inspect their relative positions after reducing their dimensionality.

In the early view, the supporting and competing representations appear much less separated. In the view after convergence, representations cluster along directions associated with the question types, and the genuine evidence appears closest to the question representations. The plotted competitors include both incorrect passages and relevant passages scored under the wrong question type. The latter are the extra negatives introduced by the type-aware training design.

The plot is consistent with the ranking result. The objective trains the vectors to have a geometry in which question-evidence similarity contains information about which units support the answer. The visualization shows an instance of that geometry after training, while the mAP scores quantify how the corresponding comparison ranks evidence on the development data. The joint-F1 ablations give a separate measure of how the design affects the complete QA task.

Limitations

Limits identified by the authors

The authors flag the quality of the evidence annotations. The method rewards agreement with the designated support. Where those labels are incomplete, unreliable, or difficult to verify, the learning signal inherits that uncertainty. The authors also say that good evidence matching cannot guarantee that a system’s generated content will be factual or free of bias. Their caution concerns practical settings in which the quality of the underlying evidence is unclear.

QAsper gives a concrete case in which contrastive supervision is unavailable. An unanswerable question, or an example without an annotated evidence sentence, provides no positive pair under the stated setup. The authors apply the new objective only to eligible examples and retain the broader QA task. That decision handles the missing positive during training. It leaves the method’s direct evidence supervision limited to cases where the necessary label exists.

The paper proposes applying variants of the objective to long-document and multi-document summarization and to retrieval reranking. These are directions the authors identify for future work. Their experiments study answering questions and predicting their evidence within supplied contexts. Other tasks would require a definition of what belongs in the positive set and a way to create meaningful comparisons. The proposed extensions concern summarization and information retrieval.

Limits of what the experiments can establish

The evidence-ranking result establishes that the trained score recovers annotated support more effectively in the HotpotQA-distractor development setting. That is a narrower conclusion than saying that the answer prediction depends on the selected sentences. A causal test of dependence would intervene on the evidence seen by the reader or examine how changed evidence affects the answer. The experiments evaluate the answer output, the support output, and the similarity ranking. Their agreement supports the utility of joint training, while leaving the relationship between particular answer decisions and particular sentences unresolved.

The context is supplied in both benchmarks. QAsper supplies the research paper, and HotpotQA-distractor supplies a mixture containing the gold paragraphs. The contrastive objective discriminates among candidates that the reader has already received. In an open search task, relevant material might be absent from the returned documents, or the search space might be too large to encode all candidates with the question in one sequence. The paper gives no end-to-end search result under those conditions. Its measurements concern evidence selection inside a defined reading problem.

The negative construction also depends on how annotations divide support from other text. An unmarked passage can be relevant background or express information equivalent to a labeled passage. Under the loss, it competes with the annotated positives. The metrics reward recovery of the benchmark’s support labels, so the experiments do not estimate how often the method would suppress independently valid alternative evidence. The authors’ concern about annotation quality matters both for what the loss teaches and for what the evaluation rewards.

Question types help in the richer variant because the datasets provide a way to assign examples to categories. The shared-projection experiments show that the contrastive method can be used without dedicating a separate space to each labeled type. The results leave open how well type-specific supervision transfers when a new dataset uses different categories or supplies none. They also leave open how robust the design would be to uncertain or incorrect type labels, because the wrong-type negatives are generated relative to the expected type in the training data.

The scope of the design comparisons is narrower than the scope of the overall result. The principal ablation table and the ranking analysis use CDLM-large on the HotpotQA-distractor development split. The full objective improves the reported QAsper results, but the paper does not provide the same component-by-component analysis there. The development-set comparisons identify the best reported variant for the examined HotpotQA setting. They supply less information about which design choices would matter most for reading academic papers or for a different backbone.

The authors suggest that the objective may help because existing long-range pretraining provides insufficient signals for the relationships it targets. They also invoke uniformity, the idea that representations can benefit from being distributed more effectively through their space. The projection comparison and PCA illustration are compatible with those explanations. Neither measures uniformity directly or isolates the role of the pretraining signal. The backbone comparison changes the starting system, so its score differences cannot by themselves establish which pretraining property accounts for the benefit.

Finally, the aggregate improvements describe benchmark scores. They do not show whether questions that need the most distributed evidence improve the most, or whether the gains arise primarily from easier improvements in identifying a particular sentence. QAsper’s answer-type breakdown offers one view of heterogeneity, and HotpotQA’s ranking analysis provides another. The evidence supports a consistent improvement across the reported settings and a marked change in the learned comparison. The distribution of that benefit across reasoning demands remains an open empirical question.

What came after

The later citing work is MDCure: A Scalable Pipeline for Multi-Document Instruction-Following. Its stated subject is a pipeline for instruction-following over multiple documents. That brings a broader task framing into contact with the problem studied here. Caciularu and colleagues train a reader to discriminate supporting passages within a supplied context, while MDCure addresses a pipeline for handling instructions that involve multiple documents.

The citation establishes a connection between the papers. It does not establish that MDCure uses the contrastive objective, the question-type projections, or the extra negatives from mismatched projections. The documented connection is between a study of supervised evidence selection for long-context questions and a later effort concerned with instruction-following across documents.

Cite

Cite as Avi Caciularu, Ido Dagan, Jacob Goldberger and Arman Cohan. 2022. Long Context Question Answering via Supervised Contrastive Learning. Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies.

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.18653/v1/2022.naacl-main.207

@inproceedings{caciularu2022long,
  title = {{Long Context Question Answering via Supervised Contrastive Learning}},
  author = {Avi Caciularu, Ido Dagan, Jacob Goldberger and Arman Cohan},
  booktitle = {Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies},
  year = {2022},
  doi = {10.18653/v1/2022.naacl-main.207},
  url = {https://doi.org/10.18653/v1/2022.naacl-main.207}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/caciularu-2022-long-context-question-answering-supervised/