<?xml-model href='http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng' schematypens='http://relaxng.org/ns/structure/1.0'?><TEI xmlns="http://www.tei-c.org/ns/1.0">
	<teiHeader>
		<fileDesc>
			<titleStmt><title level='a'>A Multi-level Supervised Contrastive Learning Framework for Low-Resource Natural Language Inference</title></titleStmt>
			<publicationStmt>
				<publisher></publisher>
				<date>2023 2nd Quarter (FY)</date>
			</publicationStmt>
			<sourceDesc>
				<bibl> 
					<idno type="par_id">10414700</idno>
					<idno type="doi">10.1109/TASLP.2023.3270771</idno>
					<title level='j'>IEEEACM transactions on audio speech and language processing</title>
<idno>2329-9304</idno>
<biblScope unit="volume">31</biblScope>
<biblScope unit="issue"></biblScope>					

					<author>S. Li</author><author>X. Hu</author><author>L. Lin</author><author>A. Liu</author><author>L. Wen</author><author>Philip S. Yu</author>
				</bibl>
			</sourceDesc>
		</fileDesc>
		<profileDesc>
			<abstract><ab><![CDATA[Natural Language Inference (NLI) is a growingly essential task in natural language understanding, which requires inferring the relationship between the sentence pairs (premise and hypothesis). Recently, low-resource natural language inference has gained increasing attention, due to significant savings in manual annotation costs and a better fit with real-world scenarios. Existing works fail to characterize discriminative representations between different classes with limited training data, which may cause faults in label prediction. Here we propose a multi-level supervised contrastive learning framework named MultiSCL for low-resource natural language inference. MultiSCL leverages a sentence-level and pair-level contrastive learning objective to discriminate between different classes of sentence pairs by bringing those in one class together and pushing away those in different classes. Multi-SCL adopts a data augmentation module that generates different views for input samples to better learn the latent representation. The pair-level representation is obtained from a cross attention module. We conduct extensive experiments on two public NLI datasets in low-resource settings, and the accuracy of MultiSCL exceeds other models by 1.8%, 3.1% and 4.1% on SNLI, MNLI and Sick with 5 instances per label respectively. Moreover, our method outperforms the previous state-of-the-art method on cross-domain tasks of text classification.]]></ab></abstract>
		</profileDesc>
	</teiHeader>
	<text><body xmlns="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
<div xmlns="http://www.tei-c.org/ns/1.0"><p>pair of sentences, namely premise and hypothesis, and asked to infer the relationship between them from a set of relationships, including entailment, contradiction and neutral.</p><p>Several concrete examples are illustrated in Table <ref type="table">I</ref>.</p><p>Large annotated datasets, such as SNLI <ref type="bibr">[7]</ref> and MultiNLI datasets <ref type="bibr">[8]</ref> have been available in recent years, making it possible to apply sophisticated deep learning models. These neural network models require a large number of training parameters to achieve good results in NLI <ref type="bibr">[9]</ref>, <ref type="bibr">[10]</ref>. However, large-scale datasets are obtained from a large number of manual annotations and have a high annotation cost. Therefore, natural language inference for low-resource scenarios has gained more widespread attention in recent years. Compared with traditional task scenarios, NLI in low-resource scenarios focuses on using a small amount of manually annotated data to achieve similar results as the full amount of data. This can save a large number of manual annotation costs and is more in line with realistic application scenarios, thus with high research value and practical application value <ref type="bibr">[11]</ref>.</p><p>Recent work has shown advantages of generative classifiers in term of low-resource and robustness. Ding et al. <ref type="bibr">[12]</ref> propose a generative classifier that defines the conditional probabilities assumed given the premises and labels and has better performance in very few labeled data settings. Liu et al. <ref type="bibr">[13]</ref> propose a multi-task deep neural network for learning semantic representations across multiple natural language understanding tasks to enhance the semantic representation in low-resource scenarios. The network not only utilizes a large amount of cross-task data but also benefits from regularization effects to learn more general representations that can be adapted to NLI in fewer sample scenarios. However, these methods only use the feature of the sentence pair itself to predict the class, without considering the comparison between the sentence pairs in different classes. When the training instances per class are small, it is difficult for these methods to distinguish the true class of similar sentences.</p><p>Because these methods can't well characterize discriminative representations between different classes with limited training data, which may cause faults in label prediction.</p><p>Many recent works explored using contrastive learning to tackle this problem. Contrastive learning is a popular technique in computer vision area <ref type="bibr">[14]</ref>, <ref type="bibr">[15]</ref>, <ref type="bibr">[16]</ref> and the core idea is to learn a function that maps positive pairs closer together in the embedding space, while pushing apart negative pairs. A contrastive objective is used by <ref type="bibr">[17]</ref> to fine-tune pre-trained language models to obtain sentence embeddings with the relationship of sentences in NLI. The model achieved state-of-the-art performance in sentence similarity tasks. Yan et al. <ref type="bibr">[18]</ref> propose a simple but effective training objective based on contrastive learning. It mitigates the collapse of BERT-derived representations and transfers them to downstream tasks. However, these approaches can't distinguish well between the representation of sentence pairs in different classes.</p><p>In our previous work <ref type="bibr">[19]</ref>, we propose a pair-level supervised contrastive learning approach (PairSCL), which obtains new state-of-the-art performance in NLI. However, this method cannot be adapted to low-resource settings for the reason of limited discriminative ability of sentence pairs in very few sample scenarios. Therefore, in this paper, we comprehensively investigate the potential of contrastive learning in low-resource NLI. Based on our analysis of PairSCL that contrastive learning can help discriminate the class of sentence pairs, we propose a multi-level supervised contrastive learning framework named MultiSCL for low-resource NLI. In addition to pair-level contrastive learning, MultiSCL leverages the sentence-level contrastive learning objective to characterize the latent embeddings of sentences in semantic space. Furthermore, to better learn the semantic representation, we adopt a data augmentation module that generates different views for input sentences with sentencelevel supervised contrastive learning by regarding the contradiction pairs as negatives, and entailment pairs as positives. The pair-level representation can perceive the class information of sentence pairs and is obtained from the Cross Attention module which captures the relevance and characterizes the relationship between the sentence pair. Then we adopt contrastive learning to differentiate the pair-level representation by capturing the similarity between pairs in one class and contrasting them with pairs in other classes.</p><p>For example, the entailment pair (P 1 , H 1 ) and contradiction pair (P 2 , H 2 ) are from Table <ref type="table">I</ref> (P 1 : Two men on bicycles competing in a race. H 1 : People are riding bikes. P 2 :T women on bicycles competing in a race. H 2 : Men are riding bicycles on the streets.). For sentence-level contrastive learning, we take advantage of the fact that entailment pairs can be naturally used as positives and the contradiction pairs can be regarded as negatives. We consider H 1 as the positive set for P 1 and H 2 as the negative set for P 2 . In this way, the encoder can capture the semantic representation of the sentences more accurately. For pair-level contrastive learning, our model regards the pair (P 2 , H 2 ) as the negative set for the pair (P 1 , H 1 ) with the representation obtained from Cross Attention module to distinguish the pairs from different classes.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Our contributions can be summarized as follows:</head><p>r We propose a novel multi-level supervised contrastive learning framework named MultiSCL for low-resource NLI. It applies the sentence-level and pair-level contrastive learning to learn the discriminative representation with limited labeled training data.</p><p>r We adopt a data augmentation module to generate the dif- ferent views for input samples. We explore various effective text augmentation strategies for contrastive learning and analyze their effects on low-resource NLI.</p><p>r We conduct extensive experiments on two public NLI datasets in low-resource settings, and the accuracy of MultiSCL exceeds other models by 1.8%, 3.1% and 4.1% on SNLI, MultiNLI and Sick with 5 instances per label respectively. Moreover, our method outperforms the previous state-of-the-art method on cross-domain tasks of text classification. This paper is substantially an extended version of our previous paper <ref type="bibr">[19]</ref> that is published at ICASSP 2022. Compared to the previous version, we make heavy extensions as follows: (1) By adding the sentence-level contrastive learning objective, we propose a new multi-level supervised contrastive learning framework called MultiSCL for low-resource NLI. <ref type="bibr">(2)</ref> We adopt a data augmentation module to generate the views for input sentences and explore various effective text augmentation strategies. <ref type="bibr">(3)</ref> We conduct extensive experiments on NLI datasets in lowresource scenarios. We conduct experiments on cross-domain datasets to validate the transfer capability of our model.</p><p>The structure of this paper is as follows. In Section II,w e review the related work to natural language inference and contrastive learning. Section III introduces the architecture of our framework. Section IV presents experimental design details and Section V reports our experimental results and analysis. Finally, in Section VI, we conclude this paper and present some future work.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>II. RELATED WORKS</head></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A. Natural Language Inference</head><p>Early methods for NLI mainly relied on conventional, featurebased methods trained from small-scale datasets <ref type="bibr">[3]</ref>, <ref type="bibr">[20]</ref>.The release of large datasets, such as SNLI <ref type="bibr">[7]</ref> and MultiNLI <ref type="bibr">[8]</ref>, made neural network methods feasible. Such methods can be roughly categorized into two classes: sentence embedding bottleneck methods which first encode the two sentences as vectors and then feed them into a classifier for classification <ref type="bibr">[21]</ref>, <ref type="bibr">[22]</ref>, <ref type="bibr">[23]</ref>, and more general methods which usually involve interactions while encoding the two sentences in the pair <ref type="bibr">[10]</ref>, <ref type="bibr">[24]</ref>, <ref type="bibr">[25]</ref>. <ref type="bibr">[26]</ref> enables the use of various kinds of external knowledge bases to retrieve information related to premise and hypothesis. <ref type="bibr">Wang et al. [27]</ref> propose a novel Knowledge Graph-enhanced NLI (KGNLI) model to leverage the usage of background knowledge stored in knowledge graphs in the field of NLI.</p><p>Recently, large-scale pre-trained language representation models such as BERT <ref type="bibr">[28]</ref>,G P T <ref type="bibr">[29]</ref>,B A R T <ref type="bibr">[30]</ref>,e t c . ,h a v e achieved dominating performance in NLI. These neural network models have a large number of training parameters to achieve good results in NLI. However, large-scale datasets are obtained from a large number of manual annotations and have a high annotation cost. Therefore, NLI for low-resource scenarios has gained more widespread attention in recent years.</p><p>Ding et al. <ref type="bibr">[12]</ref> propose GenNLI, a generative classifier for NLI tasks. The model defines conditional probabilities assumed given premises and labels, parameterizing the distribution using a sequence-to-sequence model with attention <ref type="bibr">[31]</ref> and a replication mechanism <ref type="bibr">[32]</ref>. They explore training objectives for discriminative fine-tuning of the generative classifier, comparing several classical discriminative criteria. Liu et al. <ref type="bibr">[13]</ref> propose a multi-task deep neural network (MT-DNN) for learning semantic representations across multiple natural language understanding tasks. MT-DNN not only utilizes a large amount of cross-task data but also benefits from regularization effects to learn more general representations that can be adapted to natural language reasoning in very few sample scenarios. Schick et al. <ref type="bibr">[33]</ref> introduce Pattern Exploiting Training concerning a partially pre-trained language model using task descriptions in natural language <ref type="bibr">[34]</ref>. They reformulate a small amount of labeled data into fill-in-the-blank phrases to help the language model understand the given task.</p><p>The above methods only use the feature of the sentence pair itself to predict the class, without considering the comparison between the sentence pairs in different classes. In our work, we propose a multi-level contrastive learning framework named MultiSCL for low-resource NLI. MultiSCL leverages a sentence-level and pair-level contrastive learning objective to learn discriminative representations between different classes.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B. Contrastive Learning</head><p>Contrastive learning has shown promising results in computer vision area in an unsupervised/self-supervised way <ref type="bibr">[14]</ref>, <ref type="bibr">[15]</ref>. The key idea of contrastive learning is: first create augmentations of original examples, then learn representations by predicting whether two augmented examples are from the same original data example or not. Dating back to <ref type="bibr">[35]</ref>, these approaches learn representations by contrasting positive pairs against negative pairs. Along these lines, Dosovitskiy et al. <ref type="bibr">[36]</ref> propose to treat each instance as a class represented by a feature vector (in a parametric form). Wu et al. <ref type="bibr">[37]</ref> propose to use a memory bank to store the instance class representation vector, which was an approach adopted and extended in several recent papers <ref type="bibr">[38]</ref>, <ref type="bibr">[39]</ref>. He et al. <ref type="bibr">[14]</ref> propose Momentum Contrast (MoCo) by building a dynamic dictionary with a queue and a moving-averaged encoder and showed state-of-the-art results. Chen et al. <ref type="bibr">[15]</ref> propose a simple framework for contrastive learning to learn visual representations without specialized architectures or a memory bank. Some works use contrastive learning to solve Natural Language Processing (NLP) tasks. Qin et al. <ref type="bibr">[40]</ref> propose a novel contrastive learning framework in the pre-training phase to obtain a deeper understanding of the entities and their relations in text. Giorgi et al. <ref type="bibr">[41]</ref> propose a self-supervised method for minimizing sentence embeddings of textual segments randomly sampled from nearby in the same document and obtained state-of-the-art performance on SentEval <ref type="bibr">[42]</ref>. Gunel et al. <ref type="bibr">[43]</ref> propose a supervised contrastive learning (SCL) objective which uses SCL loss combined with cross-entropy loss for the finetuning stage. The proposed model shows improved performance on multiple datasets of the GLUE benchmark <ref type="bibr">[44]</ref> in both the high-data and low-data regimes. Yan et al. <ref type="bibr">[18]</ref> explore a simple but effective sentence-level training objective with various effective text augmentation strategies to generate views for contrastive learning. Suresh et al. <ref type="bibr">[45]</ref> incorporate inter-class relationships into a supervised contrastive loss by differentiating the weights between different negative samples for fine-grained text classification. Li et al. <ref type="bibr">[46]</ref> adopt supervised contrastive pre-training to capture both implicit and explicit sentiment orientation towards aspects by aligning the representation of implicit sentiment expressions to those with the same label for aspect-based sentiment analysis. Wu et al. <ref type="bibr">[47]</ref> propose a new framework, combining word-level masked language modeling objectives with sentence-level contrastive learning objective to pre-train a language model. Zhang et al. <ref type="bibr">[48]</ref> propose an instance discrimination-based approach aiming to bridge semantic entailment and contradiction understanding with high-level categorical concept encoding. Wang et al. <ref type="bibr">[49]</ref> propose Contrastive Learning with semantIc Negative Examples (CLINE), which constructs semantic negative examples unsupervised to improve the robustness under semantically adversarial attacking. By comparing with similar and opposite semantic examples, the model can effectively perceive the semantic changes caused by small perturbations. Li et al. <ref type="bibr">[19]</ref> propose a pair-level supervised contrastive learning approach. The pair-level representation is obtained by Cross Attention module which can capture the relevance and well characterize the relationship between the sentence pair.</p><p>However, the above methods can't learn effective semantic representations in low-resource scenarios. In our work, we will focus on the use of multi-level contrastive learning for lowresource NLI.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>III. APPROACH</head><p>In this section, we describe our approach MultiSCL. The overall architecture of the model is illustrated in the left part of Fig. <ref type="figure">1</ref>. MultiSCL comprises the following four major components: a data augmentation module that generates different views for input samples; an encoder that computes sentence-level representations of premise and hypothesis; a cross attention module to obtain the pair-level representation of the sentence pair and a joint-training layer including the sentence-level and pair-level contrastive learning term and the cross-entropy term.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A. Data Augmentation Module</head><p>In low-resource NLI scenarios, it's a challenge for a model to learn discriminative representations and infer the relationship between sentences. Therefore, we adopt a data augmentation module to generate different views of sentences to enhance the semantic understanding and inference capability of the model. We explore and test six data augmentation strategies to generate views, including synonym replacement <ref type="bibr">[50]</ref>, reordering <ref type="bibr">[47]</ref>, word insertion, word deletion, dropout <ref type="bibr">[17]</ref>, and back translation <ref type="bibr">[51]</ref>.</p><p>Synonym Replacement randomly chooses n words from the sentence that are not stop words. Replace each of these words with one of its synonyms chosen at random, so that the augmented data fit the original semantics as closely as possible.</p><p>Reordering is another widely-studied augmentation method that can keep the original sentence's features. We randomly select n pairs of spans and switch them to construct the reordering augmentation in our implementation.</p><p>Word Insertion finds the random synonym of n random word in the sentence that is not a stop word. Insert that synonym into a random position in the sentence.</p><p>Word Deletion randomly selects n tokens in the sentence and replaces them with a special token [DEL], which is similar to the token [MASK] in BERT <ref type="bibr">[28]</ref>.</p><p>Dropout has been proven an effective augmentation strategy for contrastive learning <ref type="bibr">[17]</ref>, <ref type="bibr">[18]</ref>. For this setting, we randomly drop elements in the token embedding layer by a specific number n and set their values to zero.</p><p>Back Translation first translates the sentence into another language and translates it back to the original language. Then the new sentence is regarded as an augmented sentence of the original.</p><p>In our model, we select two augmentation strategies to generate two different views of input texts. We will explore and test the effect of different combinations in our experiment. The number of changed words or tokens for augmentation methods n is based on the length of the sentence l with the formula n = &#951;l, where &#951; is a hyper-parameter that indicates the percent of the changed words in a sentence.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B. Text Encoder</head><p>After we get the different views of the sentence, we need to get the context-based semantic information. We give the formal definition of NLI as follows. Each instance in a NLI dataset consists of two sentences and a label indicating the relation between them. Formally, we denote premise as</p><p>n }, where m and n are length of the sentences respectively. The instance in the batch I is denoted as (X (p) ,X (h) ,y) i , where i = {1,...,K} is the indices of the samples and K is the batch-size. After passing the input samples to data augmentation module, we construct the new batch &#296; with size 2 K by randomly augmenting twice for all the sentences. The encoder (e.g., BERT) takes X (p) ,X (h)  as inputs and computes the semantic representations, denoted as</p><p>where k is the dimension of the encoder's hidden state.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>C. Cross Attention Module</head><p>Different from single sentence classification, we need a proper interaction module to better clarify the relationship of sentences pair for NLI task. In practice, we need to compute token-level weights between words in premise and hypothesis to obtain information about their interaction. Therefore, we introduce Cross Attention module to calculate the co-attention matrix C &#8712; R m&#215;n of the token level. If the value of attention weight is relatively large, the correlation between the words is stronger. Each element C i,j &#8712; R indicates the relevance between the i-th word of premise and the j-th word of hypothesis:</p><p>where W &#8712; R d&#215;k , P &#8712; R d , and &#8857; denotes the element-wise production operation. W and P are trainable parameters to map the feature in the semantic space, where k is the dimension of the encoder's hidden state and d is the dimension for nonlinear mapping to a latent representation. Then the attentive matrix could be formalized as:</p><p>We further enhance the collected local semantic information:</p><p>where</p><p>indicates the difference between the original representation and the hypothesis-information enhanced representation of premise, and s</p><p>represents their semantic similarity. Both values are designed to measure the degree of semantic relevance between the sentence pair. The smaller the difference and the larger the semantic similarity, the sentences pair are more likely to be classified into the Entailment category. The difference and element-wise product are then concatenated with the original vectors (S (p) , S (p) &#8242; ). We expect that such operations could help enhance the pair-level information and capture the inference relationships of premise and hypothesis. We get the new representation containing hypothesis-guided inferential information for premise:</p><p>where LayerN orm(.) is a layer normalization. The result &#348;(p) is a 2D-tensor that has the same shape as S (p) . The representation of hypothesis &#348;(h) is calculated in the same way. Then we convert these representations obtained above to a fixed-length vector with pooling. More specifically, we compute max pooling and mean pooling for &#348;(p) and &#348;(h) . where</p><p>n }. Formally:</p><p>We aggregate these representations and the pair-level representation Z for the sentence pair is obtained as follows:</p><p>As described, Cross Attention module can capture the relevance of the sentence pair and well characterize the relationship.</p><p>Therefore, the pair-level representation can perceive the class information of sentence pairs.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>D. Training Objective 1) Text-Level Supervised Contrastive Loss:</head><p>The core idea of contrastive learning is to learn a function that maps positive pairs closer together in the embedding space while pushing apart negative pairs. In general, two variants augmented from the same original sentence form the positive pair, while all other instances from the same batch are regarded as negative samples for them. Especially, the NLI datasets consist of high-quality and crowd-sourced labeled sentence pairs and each can be presented in the form: (premise, hypothesis, label) as described in Section I. Given one premise, human annotators are required to manually write one sentence that is absolutely true (entailment), one that might be true (neutral), and one that is definitely false (contradiction). Thus for each premise and its entailment hypothesis, there is an accompanying contradiction hypothesis and neutral hypothesis (see Table <ref type="table">I</ref> for an example). Therefore, it is natural to take the entailment hypothesis for premise as its positive set and the contradiction hypothesis as negative set.</p><p>In the training stage, we randomly sample a batch I of K examples (X (p) ,X (h) ,y) i&#8712;I={1,...,K} as denoted in Section III-B. After passing the input samples to data augmentation module, we construct the new batch &#296; with size 2 K by randomly augmenting twice for all the sentences. We denote the representation obtained from the text encoder of the new batch as (S (p) , S (h) ) i&#8712; &#296;={1,...,2K} .ForthepremiseS , including the augmented views of the contradiction hypothesis. The sentence-level supervised contrastive loss on the batch &#296; is defined as:</p><p>where sim(&#8226;) indicates the cosine similarity function, &#964; controls the temperature.</p><p>Finally, we average all 2 K in-batch losses &#8467; i to obtain the final sentence-level contrastive loss L SCL(sent) :</p><p>In this way, we can map the representations from the encoder of the semantically similar sentences closer together in the embedding space, while pushing apart irrelevant sentences. Thus, the pair-level representations based on the output of the encoder can better capture the relationships between premise and hypothesis.</p><p>2) Pair-Level Supervised Contrastive Loss: In <ref type="bibr">[16]</ref>, the authors extended the above loss to a supervised contrastive loss by regarding the samples belonging to the same class as the positive set. Inspired by this, we adopt a supervised contrastive learning objective to align the pair-level representation obtained from Cross Attention module to distinguish sentence pairs from different classes. The pair-level supervised contrastive loss brings the latent representations of pairs belonging to the same class closer together.</p><p>In the training stage, we take the augmented batch &#296; of 2 K examples (X (p) ,X (h) ,y) i={1,...,2K} as denoted in Section III-D1. For the pair (X (p) ,X (h) ,y) i , we denote the set of positives as G = {g : g &#8712;I,y g = y i &#8743; g = i}, with size |G|. The supervised contrastive loss on the batch &#296; is defined as:</p><p>where &#8467; i,g indicates the likelihood that pair i is most similar to pair g and &#964; is the temperature hyper-parameter. Larger values of &#964; scale down the dot-products, creating more difficult comparisons. Z i is the pair-level representation of pair (X (p) ,X (h) ) i from Cross Attention module. Supervised contrastive loss L SCL(pair) is calculated for every sentence pair among the batch I. To minimize contrastive loss L SCL(pair) , the similarity of pairs in the same class should be as large as possible, and the similarity of negative examples should be as small as possible.</p><p>3) Cross-Entropy Loss: Supervised contrastive loss mainly focuses on separating each pair apart from the others of different classes, whereas there is no explicit force in discriminating contradiction, neutral, and entailment. Therefore, we adopt the softmax-based cross-entropy to form the classification objective:</p><p>where W and b are trainable parameters. Z is the pair-level representation from Cross Attention module and y is the corresponding label of the pair.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>4) Overall Loss:</head><p>The overall loss is a weighted average of CE and the multi-level SCL loss, denoted as:</p><p>where &#945;, &#946; is a hyper-parameter to balance the objectives.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>IV. EXPERIMENTAL SETUP</head></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A. Benchmark Dataset</head><p>We evaluate our model on four popular datasets: the Stanford Natural Language Inference (SNLI), the MultiGenre NLI Corpus (MultiNLI), Sick and SciTail. We also conduct crossdomain experiment while trained with all source domain data of one dataset and zero-shot transferred to the target domain of another dataset to evaluate the domain adaptation capability of the model. Detailed statistical information of these datasets is shown in Table <ref type="table">II</ref>. Len(P) and Len(H) refer to the average length of premise and hypothesis respectively. MultiNLI(m) and MultiNLI(mm) indicate the matched and mismatched datasets respectively. We use classification accuracy as the evaluation metric. </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>SNLI</head><p>The Stanford Natural Language Inference (SNLI) dataset contains 570 k human-annotated sentence pairs, in which the premises are drawn from the captions of the Flickr30 corpus and hypotheses are manually annotated <ref type="bibr">[7]</ref>. This is the most widely used entailment dataset for NLI.</p><p>MultiNLI The corpus <ref type="bibr">[8]</ref> is a new dataset for NLI, which contains 433 k sentence pairs. Similar to SNLI, each pair is labeled with one of the following relationships: entailment, contradiction, or neutral. We use the matched dev set and mismatched dev set as our validation and test sets, respectively.</p><p>Sick This is a large data set on compositional meaning, annotated with subject ratings for both relatedness and entailment relation between sentences <ref type="bibr">[20]</ref>. The SICK data set consists of around 10000 English sentence pairs, each annotated for relatedness in meaning.</p><p>SciTail This is a textual entailment dataset derived from a science question answering (SciQ) dataset <ref type="bibr">[52]</ref>. The task involves assessing whether a given premise entails a given hypothesis. In contrast to other entailment datasets mentioned previously, the hypotheses in SciTail are created from science questions while the corresponding answer candidates and premises come from relevant web sentences retrieved from a large corpus. The dataset is only used for domain adaptation.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B. Implementation Details</head><p>We start from pre-trained checkpoints of BERT <ref type="bibr">[28]</ref> (uncased). We implement MultiSCL based on Huggingface's transformers package <ref type="bibr">[53]</ref>. All experiments are conducted on 1 Nvidia GTX 3090 GPU.</p><p>We train our models for 10 epochs with a batch size of 512 and temperature &#964; = 0.08 using an Adam optimizer <ref type="bibr">[54]</ref>.T h e hyper-parameter &#945; and &#946; are set as 1 for combining objectives. The learning rate is set as 5e-5 for base models. Weight decay is used with a coefficient of 1e-5. The maximum sequence length is set to 128. All the experiments are conducted 5 times with different random seeds and we report the average scores. The hyperparameter &#951; is set to 0.1, which indicates the percent of the changed words in a sentence during the data augmentation module. We select Reordering and Dropout as augmentation strategies in the main experiments.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>C. Baseline Models</head><p>To analyze the effectiveness of our model, we evaluate several approaches for traditional NLI scenarios and state-of-the-art methods for low-resource NLI scenarios as baselines as follows on the above datasets. r ESIM <ref type="bibr">[24]</ref> is a previous state-of-the-art model for the natural language inference (NLI) task. It is a sequential model that incorporates the chain LSTM and the tree LSTM to infer local information between two sentences.</p><p>r BERT <ref type="bibr">[28]</ref> is the naturally bidirectional masked lan- guage model, configured with 'bert-base-uncased'.</p><p>r PairSCL <ref type="bibr">[19]</ref> is a pair-level supervised contrastive learning approach with BERT as encoder. It adopts a Cross Attention module to learn the joint representations of the sentence pairs. 2) Low-resource NLI baselines: r Gen-NLI <ref type="bibr">[12]</ref> is a generative classifier for NLI tasks.</p><p>The model defines conditional probabilities assumed given premises and labels, parameterizing the distribution using a sequence-to-sequence model with attention and a replication mechanism.</p><p>r MT-DNN <ref type="bibr">[13]</ref> is a multi-task deep neural network for learning semantic representations across multiple natural language understanding tasks.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>V. E XPERIMENT RESULTS</head></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A. Main Results</head><p>We first empirically compare MultiSCL with baselines for three NLI datasets in low-resource scenarios. We construct smaller training sets by randomly selecting 5, 20, 100, 500, and 1000 instances per class, and then train separate models across these different-sized training sets. Table <ref type="table">III</ref> shows the average performance and standard deviation of the three runs of our model in comparison with the baselines on SNLI, MNLI, and SICK. <ref type="foot">1</ref> The results of Gen-NLI and MT-DNN are obtained from the original papers, and the results of other baselines are obtained from our re-running of source code released by the authors. The best result for each dataset and data amount is shown in bold. We also conduct the students paired t-test and the p-value of the significance test between the results of MultiSCL and GenNLI is less than 0.05 and 0.01, respectively. The results show that MultiSCL outperforms baselines on all data volume settings for all three datasets. When using training sets with 5/20/100 instances per class on three datasets, MultiSCL outperforms the state-of-the-art model by 3%, 2.5%, and 3.8% respectively, which proves that MultiSCL can better capture the latent semantic representations by multi-level contrastive learning in low-resource scenarios. We can observe that transformer-based models such as BERT and PairSCL have poor performance results when the training data is less than 100 instances, even lower than LSTM-based models such as ESIM and InferSent. This shows that large-scale pre-trained models require a large amount of supervised data to be finetuned.</p><p>When the training set gets larger, the performance gap between MultiSCL and baselines does shrink. When trained with 500/1000/all instances per label, the accuracy exceeds the stateof-the-art model by 1.6%, 1.1%, and 0.6%, which shows that MultiSCL has a more significant advantage compared with other models when trained with a smaller amount of training data. Furthermore, MultiSCL outperforms our previous work PairSCL by <ref type="bibr">10</ref>.9% on average with trained less than 100 instances per class. The performance gains are due to the data augmentation module and the stronger ability to learn sentence-level latent embeddings in semantic space. The encoder of MultiSCL can capture sentence-level semantics effectively by the specificallydesigned contrastive signal -regarding the entailment pairs as positives and the contradiction pairs as negatives with limited training data. When trained with full training data, MultiSCL exceeds PairSCL by 0.6%. We will further analyze the role of each module of MultiSCL in more detail in Section V-B .</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B. Ablation Study</head><p>We run extensive ablations to better understand the contribution of each key component of MultiSCL. We conduct experiments with the training set of 5/20/100/500 instances per class on SNLI and select Reordering and Dropout as augmentation strategies. The results are shown in Table <ref type="table">IV</ref>. After removing Data Augmentation module, the performance of MultiSCL is reduced by an average of 2.94%. Moreover, we can observe that the importance of Data Augmentation module gradually decreases as the number of training instances increases. When training with 5 instances per class, the accuracy decreases by 5.8% on the test set. This indicates that when the training data is small, augmenting the sentences can bring larger enhancements to the model. The reason is that Data Augmentation module can create challenging views which allow the encoder to learn the semantic representation better with multi-level contrastive learning. After removing Cross Attention mechanism, the model simply concatenates the representation of two sentences to obtain the representation of the sentence pair. The performance decreases by 3.0%, 2.2%, 2.6%, and 3.2% respectively with different sizes of training data, which shows the joint representation obtained by cross attention can well characterize the relationship between the sentence pair. Without the sentence-level supervised contrastive learning loss, the accuracy of our model is decreased by 4.3%, 3.1%, 3.7%, and 2.5% with 5/20/100/500 training data per class. This demonstrates that by regarding entailment sentence pairs as positive samples and contradiction pairs as negative samples allows the encoder to discriminate the semantic difference between sentences. After removing pair-level supervised contrastive learning loss, the performance decreases by 2.5% on average. The reason is that the contrastive learning objective can learn the discrepancy between the sentence pairs of different classes by pulling the sentence pairs from the same class together and pushing the pairs of different classes further apart. The test accuracy decreases by 0.7% on average without the cross-entropy loss.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>VI. QUALITATIVE ANALYSIS</head><p>In this section, we further conduct extensive experiments to understand the inner workings of MultiSCL.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A. Analysis of Cross Attention Module</head><p>To further investigate the effect of Cross Attention module, we conduct the t-SNE visualization experiments of the representations Z for the sentence pairs on SNLI test set. Fig. <ref type="figure">2</ref> illustrates that the contrastive loss can map the pairs of the same category closer together in the embedding space while pushing apart negative pairs in different classes. The right part of Fig. <ref type="figure">2</ref> shows the results after removing Cross Attention module. We observe that there is very little overlap between different classes in left part and the distance of the representations of different classes are distant. In contrast, the representations without Cross Attention module in different classes are closer and overlap with each other. The representations of the same category with Cross Attention module in left part of Fig. <ref type="figure">2</ref> are better grouped together compared to the representations in right part of Fig. <ref type="figure">2</ref>. That indicates Cross Attention module can learn the joint representation between premise and hypothesis very well. The representations of the positive pairs obtained from Cross Attention module can be mapped together in the semantic space by contrastive learning. This could well explain why removing Cross Attention module would give a high accuracy drop.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B. Analysis of Data Augmentation Module</head><p>In this section, we first analyze the effect of different combinations of data augmentation strategies on SNLI with 500 training instances per class. As described in Section III-A, we consider six options for each augmentation, including Synonym Replacement, Reordering, Word Insertion, Word Deletion, Dropout, and Back Translation, resulting in 6 &#215; 6 combinations.</p><p>The results are shown in Fig. <ref type="figure">3</ref>. When using Word Deletion, MultiSCL has poorer performance than other strategies on average. The performance decreases to the lowest with an accuracy of 69.2% with Word Deletion and Back Translation. We argue that Word Deletion and Back Translation may change the meaning compared with the original sentences, resulting in an unexpected change in the relationship between premise and hypothesis.In this situation, MultiSCL may learn to misunderstand semantic representation with multi-level contrastive learning by incorrectly setting the positive and negative set. Compared to Word Deletion and Back Translation, Word Insertion and Synonym Replacement improves the performance but does not achieve the best result. These two strategies can create views that have the same meaning as the original sentence but don't introduce meaningful changes. Therefore, the model cannot construct effective positive/negative sets with these augmented views in contrastive learning.</p><p>We can observe that Reordering and Dropout are the two most effective strategies with an accuracy of 73.7% (where Reordering is slightly better than Dropout). We argue that Reordering and Dropout can create challenging sentence pairs for contrastive learning without changing the semantic information. The augmented views are useful for contrastive learning without confusing the model, and thus improve the model robustness in low-resource scenarios. We adopt Reordering and Dropout as augmentation strategies in most experiments.</p><p>Furthermore, we explore the effect of hyperparameter &#951; on SNLI with 500 training instances per class. &#951; is a hyperparameter that indicates the percent of the changed words in a sentence. The number of words changed n is calculated with the formula n = &#951;l, where l is the length of the sentence. Table <ref type="table">V</ref> shows that the accuracy first increases then decreases dramatically when the value of &#951; becomes larger. The performance is highest when &#951; is set to 10%. The accuracy decreases 3.6% when &#951; is set to 20%. When the value of &#951; is 80% in the extreme case, the accuracy of MultiSCL drops to a minimum of 41.8%. The results are not surprising. When &#951;'s value increases, the number of changed words increases which makes the augmented sentence and the original sentence more likely to have different meanings. In this situation, Data Augmentation module can introduce very serious noise to the model, so that the positive/negative pairs that we regard in multi-level contrastive learning do not work actually.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>C. Influence of Temperature</head><p>The temperature in sentence-level <ref type="bibr">(11)</ref> and pair-level <ref type="bibr">(12)</ref> contrastive loss is used to control the smoothness of the distribution normalized by softmax operation and thus influences the gradients when backpropagation. A higher temperature smooths the distribution while a low temperature scales up the dotproducts and sharpens the distribution. In our experiments, we explore the influence of temperature &#964; on SNLI dataset with 500 training instances per class. The result is illustrated in Fig. <ref type="figure">4</ref>.</p><p>As shown in the figure, we can observe that the performance of MultiSCL is very sensitive to the value of temperature &#964; .As the temperature becomes higher, the performance of the model first improves and then decreases. Either too low or too high temperature will make our model perform badly. The optimal temperature value is 0.08 when MultiSCL has the highest accuracy of 73.7%. This phenomenon again demonstrates that the temperature determines how much attention is paid to difficult negative samples in contrastive loss. The higher the temperature,  the less attention is paid to difficult negative samples, while the lower the temperature, the model focuses more on negative samples that are very different from the anchor. We select 0.08 as the temperature in most of our experiments.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>D. Influence of Hyper-Parameters in Training Objective</head><p>To investigate the effect of hyper-parameters &#945; and &#946; in 15, we conduct the experiments with 500 instances per class on SNLI by setting different values. The results are illustrated in Table <ref type="table">VI</ref> and we underline the setting used for all our experiments. The hyper-parameters &#945; and &#946; are used to balance sentence-level contrastive loss and pair-level contrastive loss in the training objective. MultiSCL focuses more on semantic similarity discrimination of sentences with a larger value of &#945;, while the model is paying more attention to learning the discrepancy of sentence pairs in different categories with a larger value of &#946;.</p><p>Table <ref type="table">VI</ref> indicates a trade-off between the sentence-level semantic encoding capability and the pair-level reasoning capability of MultiSCL. When the values of both &#945; and &#946; are 0.2, MultiSCL almost removes contrastive learning and uses only cross-entropy loss, and the accuracy decreases by 4.2%. The performance of MultiSCL keeps improving as the value of &#945; and &#946; increases until the highest accuracy of 73.7% with &#945; = &#946; =1.0. However, as the values of &#945; and &#946; continue to increase, the accuracy begins to decrease. This result is not surprising, especially considering that the joint representation of a contradiction pair in pair-level contrastive learning is obtained from two sentences that are regarded as negative sets in the sentence-level contrastive learning. Focusing too much on the pair-level classification objective, i.e., using larger &#946; values, can hurt the embeddings of the sentence from the encoder. On the other hand, focusing overly on separating semantically dissimilar sentences also affects the discrimination of sentence pairs in different categories. We set &#945; and &#946; as 1.0 for all our experiments with effective multi-level supervised contrastive learning.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>E. Case Study</head><p>To illustrate the advantages of our model in more detail, we conduct a case study. Table <ref type="table">VII</ref> includes some examples from the SNLI test set, where MultiSCL successfully predicts the relation and GenNLI fails. In examples A and B, both sentences contain phrases that are either identical or highly lexically related (e.g. "Two kids", "ocean/beach", and "fountain"), which confuses GenNLI's judgment as entailment category. MultiSCL can infer the correct relationship of Neutral by capturing the difference between words in premise and hypothesis with Cross Attention module. For examples C and D, GenNLI regarded their relationships as Neutral but the gold labels are Entailment. The reason may be that the two sentences do not have some identical words, so GenNLI cannot easily recognize their semantic similarity. However, MultiSCL can correctly capture the semantics of the sentences through multi-level contrastive learning. For example E, GenNLI predicts the relationship as Entailment while Multi-SCL can infer the correct relationship as Contradiction from "cluttered" and "neat and clean". For example F, MultiSCL can predict the relationship as Contradiction from "sits" and "going fast" while GenNLI considers their relationship to be Neutral. These results show that MultiSCL can understand the semantic information by capturing the interaction of words in premise and hypothesis. Furthermore, MultiSCL can better infer the relationship of the challenging pairs with the multi-level contrastive learning.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>F. Error Analysis</head><p>To analyze the limitation of MultiSCL, we select some very challenging cases in which both GenNLI and MultiSCL cannot infer the relationships correctly in low-resourse scenarios. For example, MultiSCL predicts the relationship as entailment for the contradiction pair (premise: A person wearing a straw hat, standing outside working a steel apparatus. hypothesis:A person is burning a straw hat.). The most likely reason is that all the words in hypothesis except "burning" are included in premise. In this situation, MultiSCL ignores the different words ("wearing" and "burning") and simply assumes that premise and hypothesis are nearly identical. Therefore, the model predicts the relationship as entailment. Another example of model misclassification is the pair (premise: Two women having drinks and smoking cigarettes at the bar. hypothesis: Three women are at a bar.). The gold label is contradiction but MultiSCL believes their relationship is entailment. We can observe that the two sentences describe basically the same scenario, only the number of people mentioned is different. This indicates that our model ignores differences in count words when the semantics of the sentences are similar.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>VII. DOMAIN ADAPTATION RESULTS</head><p>To investigate the performance of the model in low-resource scenarios more deeply, we conduct the domain adaptation experiments. We evaluate MultiSCL with BERT, GenNLI, and MT-DNN by domain adaptation between SNLI, MNLI, and Scitail. The models are trained to convergence using all the source domain data and zero-shot transferred to the target domain, which can evaluate the ability for domain-independent reasoning. The domain adaptation results are illustrated in Table <ref type="table">VIII</ref>. MultiSCL outperforms all baselines by 8.5% on average for all six domain adaptation settings. Furthermore, we can find that all models perform the best for domain adaptation of SNLI and MNLI in various combinations of source and target datasets. The reason is that MNLI is modeled on SNLI but differs in that it covers a range of genres including transcribed speech, fiction, and government reports. Therefore, the domain similarity between SNLI and MNLI is higher and the models are more likely to transfer semantic knowledge. Moreover, the model is easier to transfer from MNLI to SNLI, compared with SNLI to MNLI.</p><p>For the domain adaptation results between SNLI/MNLI and SciTail, the accuracy is lower compared to other cases. The reason is that SciTail is a textual entailment dataset from the science domain and domain information differs significantly from other datasets. In addition, SciTail is a smaller dataset that only contains 23.5 k training data as introduced in IV-A. Therefore, it is a challenge to transfer between dissimilar domains such as SciTail to SNLI/MNLI. Our model, Multi-SCL, outperforms the state-of-the-art model by 8.8% on average in six domain adaptation scenarios. We can observe that MulitSCL achieves an outstanding performance of 49.2% and 51.4% adapted from SciTail to SNLI/MNL, exceeding the state-of-the-art model by 10.1% and 10.4%, respectively. These results indicate that MultiSCL has a stronger ability to learn domain invariant latent representations through multi-level contrastive learning. MultiSCL can accurately characterize the sentence pairs in the semantic space by the specifically-designed contrastive signal and zero-shot transferred to different domains.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>VIII. CONCLUSION AND FUTURE WORK</head><p>In this paper, we propose a multi-level supervised contrastive learning approach (MultiSCL) for low-resource NLI. We adopt a data augmentation module to create different views for input sentences. MultiSCL leverages sentence-level contrastive learning to enhance the capability of semantic modeling by naturally taking the entailment hypothesis as the corresponding premise's positive set and the contradiction hypothesis as the negative set. The cross attention module is designed to learn the joint representations of the sentence pairs. The pair-level contrastive learning objective is aimed to distinguish the varied classes of sentence pairs by pulling those in one class together and pushing apart the pairs in other classes. We evaluate MultiSCL on three popular NLI datasets in low-resource settings. The experiment results show that MultiSCL outperforms the previous state-ofthe-art method performance by 1.8%, 3.1% and 4.1% on SNLI, MNLI and Sick with 5 instances per label respectively. For the domain adaptation tasks, the accuracy of MultiSCL exceeds existing models by 8.5% on average. We carefully study the components of MutliSCL and show the effects of different parts. We also compare multiple combinations of data augmentation strategies and provide fine-grained analysis of several hyperparameters to interpret how our approach works.</p><p>In future work, we intend to exploit using contrastive learning to obtain representations that can more accurately express the relationship between sentences in low-resource settings. Furthermore, we will investigate more effective data augmentation methods for texts. Other future work will be to measure the performance of MultiSCL on adversarial and similarly challenging NLI datasets. We hope our work will provide a new perspective for future research on contrastive learning.</p></div><note xmlns="http://www.tei-c.org/ns/1.0" place="foot" xml:id="foot_0"><p>Authorized licensed use limited to: University of Illinois at Chicago Library. Downloaded on May 13,2023 at 15:49:11 UTC from IEEE Xplore. Restrictions apply.</p></note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="1" xml:id="foot_1"><p>SICK does not have results in the 1000 column because the 'contradiction' label has only 665 instances. Authorized licensed use limited to: University of Illinois at Chicago Library. Downloaded on May 13,2023 at 15:49:11 UTC from IEEE Xplore. Restrictions apply.</p></note>
		</body>
		</text>
</TEI>
