diff --git a/priorknowledgeandmemoryenrichedtransformerforsignlanguagetranslation/a9635648-236d-4d42-b6aa-46746a82cef1_content_list.json b/priorknowledgeandmemoryenrichedtransformerforsignlanguagetranslation/a9635648-236d-4d42-b6aa-46746a82cef1_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..c1d762d1378925af6349e4baf5f5319b2957edc2 --- /dev/null +++ b/priorknowledgeandmemoryenrichedtransformerforsignlanguagetranslation/a9635648-236d-4d42-b6aa-46746a82cef1_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5eb21a0bfa987710341da1cc91ce6d3f118508d7d8d09a2e95427cdbd650c024 +size 77565 diff --git a/priorknowledgeandmemoryenrichedtransformerforsignlanguagetranslation/a9635648-236d-4d42-b6aa-46746a82cef1_model.json b/priorknowledgeandmemoryenrichedtransformerforsignlanguagetranslation/a9635648-236d-4d42-b6aa-46746a82cef1_model.json new file mode 100644 index 0000000000000000000000000000000000000000..5388bcc009f39e51462170ae49bf5031880bbd88 --- /dev/null +++ b/priorknowledgeandmemoryenrichedtransformerforsignlanguagetranslation/a9635648-236d-4d42-b6aa-46746a82cef1_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4344f2320c41201c4b0571f5f6a1ef6e53f282c8cab64392d64f4bb09b518e29 +size 91750 diff --git a/priorknowledgeandmemoryenrichedtransformerforsignlanguagetranslation/a9635648-236d-4d42-b6aa-46746a82cef1_origin.pdf b/priorknowledgeandmemoryenrichedtransformerforsignlanguagetranslation/a9635648-236d-4d42-b6aa-46746a82cef1_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..06ec531080ab043100bd1a598c179c6b98d6b67a --- /dev/null +++ b/priorknowledgeandmemoryenrichedtransformerforsignlanguagetranslation/a9635648-236d-4d42-b6aa-46746a82cef1_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:91618545bf71ac644a9721c10aca12935d29c535687ed21c674e2361981956b6 +size 1315496 diff --git a/priorknowledgeandmemoryenrichedtransformerforsignlanguagetranslation/full.md b/priorknowledgeandmemoryenrichedtransformerforsignlanguagetranslation/full.md new file mode 100644 index 0000000000000000000000000000000000000000..34508cce9c9612f14588093d4ee761eca253a12f --- /dev/null +++ b/priorknowledgeandmemoryenrichedtransformerforsignlanguagetranslation/full.md @@ -0,0 +1,370 @@ +# Prior Knowledge and Memory Enriched Transformer for Sign Language Translation + +Tao Jin + +Zhejiang University + +jint_zju@zju.edu.cn + +Meng Zhang + +Huawei Noah's Ark Lab + +zhangmeng92@huawei.com + +# Abstract + +This paper attacks the challenging problem of sign language translation (SLT), which involves not only visual and textual understanding but also additional prior knowledge learning (i.e. performing style, syntax). However, the majority of existing methods with vanilla encoder-decoder structures fail to sufficiently explore all of them. Based on this concern, we propose a novel method called Prior knowledge and memory Enriched Transformer (PET) for SLT, which incorporates the auxiliary information into vanilla transformer. Concretely, we develop gated interactive multi-head attention which associates the multimodal representation and global signing style with adaptive gated functions. One Part-of-Speech (POS) sequence generator relies on the associated information to predict the global syntactic structure, which is thereafter leveraged to guide the sentence generation. Besides, considering that the visual-textual context information, and additional auxiliary knowledge of a word may appear in more than one video, we design a multi-stream memory structure to obtain higher-quality translations, which stores the detailed correspondence between a word and its various relevant information, leading to a more comprehensive understanding for each word. We conduct extensive empirical studies on RWTHPHOENIX-Weather-2014T dataset with both signer-dependent and signer-independent conditions. The quantitative and qualitative experimental results comprehensively reveal the effectiveness of PET. + +# 1 Introduction + +Recently, the combination of vision and language attracts increasing attention. Sign language translation which aims to provide translated natural sentences for sign language videos is a valuable but challenging task in this topic (Camgoz et al., 2018, + +Zhou Zhao† + +Zhejiang University + +zhaozhou@zju.edu.cn + +Xingshan Zeng + +Huawei Noah's Ark Lab + +zxshamson@gmail.com + +![](images/10d130ee0259523f1477d0bd2f1412e3422a03d658e2f03e9b376d8a8a6e230d.jpg) +Translation: im (ADP) | western (NOUN) | ist (VERB) | es (PRON) | freundlich (ADJ) +Figure 1: An example of sign language translation, where the video frames and the sentence correspond to each other. Besides, each word (red) has its syntactic attribute (green). + +2020a,b; Jin and Zhao, 2021). Since the visual and textual modalities are not aligned strictly in a weakly-supervised manner, the difficulties of sign language translation mainly lie in the multimodal representation learning of both modalities and the alignments between them. Besides, additional prior knowledge (i.e. the performing style of different signers, the common syntactic structures of sentences) also has a strong influence on multimodal learning. + +Encoder-decoder structures built upon long short-term memory unit (Hochreiter and Schmidhuber, 1997) (LSTM) or transformer (Vaswani et al., 2017) are widely used in end-to-end sign language translation, which directly generates natural sentences without intermediate products like gloss sequences. Generally, the encoder extracts and encodes the sign language information, the decoder makes full use of the encoded results with cross-modal interaction. Camgoz et al. (2018) first proposes the sign language translation task and utilizes LSTMs combined with attention mechanism (e.g. Luong Attention (Luong et al., 2015), Badanau Attention (Bahdanau et al., 2014)) to solve it. Due to the insufficient capacity to capture the long-range temporal correlations, Camgoz et al. (2020b) replaces LSTM with transformer, which could correlate any two-time steps of sequential features. The stacked attention blocks improve most of the metrics by a large margin. Camgoz et al. (2020a) combines multiple articulatory channels with an + +choring losses and proposes a novel multi-channel transformer architecture for sign language translation. Li et al. (2020) employs video segment representation with multiple temporal granularities to develop a semantic pyramid network. In summary, many endeavors are devoted to the improvement of deep architectures for multimodal representation learning. However, the influences of additional prior knowledge are totally ignored. For example, as shown in Fig. 1, the natural sentence has its unique syntactic structure. + +Motivated by the above observations, we propose a new method called prior knowledge and memory enriched transformer for sign language translation. Specifically, we develop gated interactive multi-head attention which associates the multimodal representation and global signing style with adaptive gated functions. Besides, we employ sentence templates that consist of POS tags to represent the syntactic structures of natural sentences, and accordingly, syntax learning is performed by directly inferring POS tags with the style-specific multimodal representation. The natural sentences are generated conditioned on such auxiliaries. Furthermore, we find that the visual and textual context information, and additional auxiliary knowledge of a word may appear in more than one sign language video. For example, a word that comes up with different words may lead to various contextual visual perceptions, and the general gestural tendency of a word could support the decoding process. Therefore, we design a multi-stream memory structure to store the full-spectrum correspondence between a word and its various relevant information in training data. The obtained memory contents are employed to aid in decoding. We conduct extensive empirical studies on the benchmark dataset, RWTH-PHOENIX-Weather-2014T (PHOENIX14T) (Camgoz et al., 2018), with both signer-dependent and signer-independent conditions. The quantitative and qualitative results comprehensively reveal the effectiveness and generalization of PET. The main contributions of this paper can be summarized as follows: + +- We propose a new method called prior knowledge and memory enriched transformer for sign language translation, which explores not only multimodal understanding but also the influences of additional prior knowledge on multimodal learning. +- We develop gated interactive multi-head attenuate + +tion by associating the multimodal representation and global signing style with adaptive gated functions. The POS sequence generator relies on the style-specific multimodal information to predict the syntactic structure, which is leveraged to guide the natural sentence generation. + +- We design a multi-stream memory structure to store the full-spectrum correspondence between a word and its various relevant information in training data, leading to a more comprehensive understanding for each word. +- The quantitative and qualitative results on the challenging dataset, PHOENIX14T of both signer-dependent and signer-independent conditions comprehensively reveal the effectiveness and generalization of PET. + +# 2 Related Work + +# 2.1 Sign Language Translation + +Sign language recognition (SLR) aims to recognize single gestures from an input video clip. Many endeavors are devoted to SLR (Camgoz et al., 2016, 2017; Cui et al., 2019; Graves et al., 2006; Wang et al., 2018; Cui et al., 2017). Sign language translation is the final goal of recognition, which aims to directly translate the sign language videos into natural sentences. SLT is similar to video captioning (Jin et al., 2019a, 2020, 2019b; Pei et al., 2019), to some extent. Existing methods are categorized into two-stage and end-to-end methods. Two-stage methods first transform the videos into gloss (gesture) sequences and then rearrange them to generate natural sentences. To guarantee the fluency of sentences, some words that do not carry visual information are added (Camgoz et al., 2018). End-to-end sign language translation aims to directly translate the original sign language videos into natural sentences without intermediate products. Camgoz et al. (2018) first proposes the sign language translation task and utilizes both two-stage and end-to-end methods to solve it. Camgoz et al. (2018) adopts vanilla LSTM-based encoder-decoder structure. Due to the insufficient capacity to capture the long-range temporal correlations. Camgoz et al. (2020b) replaces LSTM with transformer, which could correlate any two-time steps of sequential features. The stacked attention blocks improve most of the metrics with a large margin. Li et al. (2020) + +employs video segment representation with multiple temporal granularities to develop a semantic pyramid network. + +However, the methods mentioned above fail to explore the multimodal understanding and additional prior knowledge learning sufficiently. In this paper, we propose PET to solve this problem. + +# 3 Approach + +Fig. 2 shows the overall framework of prior knowledge and memory enriched transformer based on encoder-decoder structure. We develop gated interactive multi-head attention in all the attention blocks with adaptive gated control of signing style embeddings. In the decoder, we treat the sentence templates which consist of POS tags as the syntax-aware auxiliary for natural sentence generation. Practically, two consecutive decoding blocks (syntactic and textual blocks) rely on the style-specific multimodal representation to predict the target words. Furthermore, we design a multistream memory structure to enhance the comprehensive understanding for each word. + +# 3.1 Style-Aware Gated Interactive Encoder + +Following (Camgoz et al., 2020b), we utilize the 2D-CNN (Tan and Le, 2019) pre-trained with recognition task (Koller et al., 2019) to extract visual features of sign language videos. Concretely, we first sample video frames and then send them to 2D-CNN. For convenience, we use $I \in \mathbb{R}^{T_i \times d}$ to denote the extracted features, where $T_i$ is the number of video frames. As shown in Fig. 2, the encoder consists of stacked attention blocks. Considering the fact that different signers have corresponding performing styles (i.e. body, pose), we perform adaptive gated interaction for the self-attention mechanism, which associates the visual representation and signing style with adaptive gated functions. Note that, for each specific signer, we obtain the performing style embedding $g$ by simply mean-pooling all the visual features of the corresponding signer (both videos and frames) in the dataset. Specifically, the self-attention layer is formulated as: + +$$ +\operatorname {G I} _ {-} \operatorname {S e l f} (I) = \operatorname {G I} _ {-} \operatorname {M H} (I, I | g) \tag {1} +$$ + +where "GI", "Self", "MH" denote gated interactive, self attention, and multi-head attention, respectively. The first $I$ in GI_MH(.) denotes query, the second $I$ denotes key and value. Further, the calculation of each head is expressed as: + +$$ +\operatorname {G I} _ {\mathbf {M H}} (I, I | g) = \left[ h d _ {1}, \dots , h d _ {h} \right] W _ {1} +$$ + +$$ +h d _ {i} = \mathbf {G I} _ {-} \mathbf {A T} (I W _ {i} ^ {Q}, I W _ {i} ^ {K}, I W _ {i} ^ {V} | g W _ {i} ^ {G}) \tag {2} +$$ + +where $[.]$ denotes concatenation operation, $hd_{i}$ denotes the output of $i$ -th head, $W_{1} \in \mathbb{R}^{d \times d}$ , $W_{i}^{Q}, W_{i}^{K}, W_{i}^{V} \in \mathbb{R}^{d \times \frac{d}{h}}$ are trainable variables. "GI_AT" takes the signing style embedding into consideration and the process is as below: + +$$ +\operatorname {G I} _ {-} \operatorname {A T} (Q, K, V | s) = \operatorname {s o f t m a x} \left(\frac {Q ^ {\prime} K ^ {\prime} \mathbf {T}}{\sqrt {d _ {k}}}\right) V \tag {3} +$$ + +where we utilize $Q, K, V$ , and $s$ to denote $IW_{i}^{Q}$ , $IW_{i}^{K}$ , $IW_{i}^{V}$ , and $gW_{i}^{G}$ to save space. $Q'$ and $K'$ are the results of style-specific interaction with adaptive gated functions: + +$$ +Q ^ {'} = (1 + G _ {q}) \odot Q, \quad G _ {q} = \sigma ([ s, Q _ {\mathrm {M}}, s \odot Q _ {\mathrm {M}} ] W _ {q}) +$$ + +$$ +K ^ {\prime} = \left(1 + G _ {k}\right) \odot K, \quad G _ {k} = \sigma \left(\left[ s, K _ {\mathrm {M}}, s \odot K _ {\mathrm {M}} \right] W _ {k}\right) \tag {4} +$$ + +where $\odot$ denotes element-wise multiplication, $\sigma(.)$ denotes sigmoid gated function, the subscript of $K_{\mathbf{M}} \in \mathbb{R}^{\frac{d}{h}}$ and $Q_{\mathbf{M}} \in \mathbb{R}^{\frac{d}{h}}$ denotes mean-pooling, $W_{q}$ , $W_{k} \in \mathbb{R}^{\frac{3d}{h} \times \frac{d}{h}}$ are trainable variables. We employ residual connection and layer normalization following the self-attention layer: + +$$ +I ^ {\prime} = \operatorname {L N} (I + \operatorname {G I} _ {-} \operatorname {S e l f} (I)) \tag {5} +$$ + +where "LN" denotes layer normalization, followed by a feed-forward layer (FFN) to introduce nonlinear transformation: + +$$ +\operatorname {F F N} \left(I ^ {\prime}\right) = \operatorname {M a x} \left(0, I ^ {\prime} W _ {2} + b _ {2}\right) W _ {3} + b _ {3} \tag {6} +$$ + +$$ +I ^ {\prime \prime} = \operatorname {L N} \left(I ^ {\prime} + \operatorname {F F N} \left(I ^ {\prime}\right)\right) +$$ + +where $W_{2}\in \mathbb{R}^{d\times 4d}$ $b_{2}\in \mathbb{R}^{4d}$ $W_{3}\in \mathbb{R}^{4d\times d}$ $b_{3}\in$ $\mathbb{R}^d$ are trainable variables, $I''\in \mathbb{R}^{T_i\times d}$ represents the encoded visual features. + +# 3.2 Syntax-Aware Memory Enriched Decoder + +The decoder also consists of stacked attention blocks as shown in Fig. 2. Note that the structures of syntactic and textual blocks are the same as those of encoder-decoder attention blocks. Specifically, to predict the word $y_{t_e}$ at $t_e$ -th time step, we utilize $E_{< t_e} \in \mathbb{R}^{t_e \times d}$ that denotes the embeddings of "BOS" token and the words whose time steps are less than $t_e$ . The process of the masked + +![](images/c11366a201d141753a152f692014d702bec3d704d60761540fb13e692516b3eb.jpg) +Figure 2: Left is the overall framework of PET, where the encoder processes extracted video features with stacked gated interactive self-attention blocks and the decoder makes full use of the visual features with encoder-decoder attention blocks. Note that the structures of syntactic and textual blocks are the same as those of encoder-decoder attention blocks. "TAG" and "EMB" denote POS tag and embedding, respectively. The multi-stream memory structure is leveraged for auxiliary decoding, where $v$ , $u$ , and $x$ denote visual, textual, and syntactic memory, respectively. Right is the structures of self-attention block and encoder-decoder attention block. + +![](images/1801820ff55067e96200e5095aa317cf1b737ad0ebd78ddb72bc2f73c6ff2d69.jpg) + +![](images/f74980a0a2b67f24f75cff0d290efd9389725b2b8a4f075d8f75b20402c261f1.jpg) + +self-attention layer and the following normalization layer is formulated as: + +$$ +E _ {< t _ {e}} ^ {\prime} = \mathrm {L N} \left(E _ {< t _ {e}} + \mathrm {G I} \_ \text {S e l f} \left(E _ {< t _ {e}}\right)\right) \tag {7} +$$ + +where we also perform adaptive gated interaction for self-attention mechanism. The obtained $E_{< t_e}^{\prime}$ are utilized to correlate the encoded visual features in the following layer with cross-modal attention: + +$$ +\begin{array}{l} E _ {< t _ {e}} ^ {\prime \prime} = \mathrm {L N} \left(E _ {< t _ {e}} ^ {\prime} + \mathrm {G I} _ {-} \mathrm {M H} \left(E _ {< t _ {e}} ^ {\prime}, I ^ {\prime \prime} | g\right)\right) \tag {8} \\ O = \mathrm {L N} (E _ {< t _ {e}} ^ {\prime \prime} + \mathrm {F F N} (E _ {< t _ {e}} ^ {\prime \prime})) \\ \end{array} +$$ + +where $E_{< t_e}^{\prime}$ and $I''$ are treated as query and key, respectively. $O \in \mathbb{R}^{t_e \times d}$ denotes the output of one encoder-decoder attention block. + +# 3.2.1 Syntax-Aware Decoding + +Since the decoder has $N$ attention blocks, we distinguish the output of different blocks with superscripts, $O^1$ , $O^2,\dots,O^N\in \mathbb{R}^{t_e\times d}$ . Note that $O^{N - 1}$ and $O^N$ are the output of syntactic and textual blocks, respectively. We calculate the probability distributions of different POS tags as: + +$$ +P _ {s, t _ {e}} = \operatorname {s o f t m a x} \left(W _ {s} O _ {t _ {e}} ^ {N - 1}\right) \tag {9} +$$ + +where $W_{s} \in \mathbb{R}^{N_{s} \times d}$ is trainable, $N_{s}$ is the vocabulary size of POS tags. We combine the syntactic information and $O_{t_e}^{N-1}$ for the subsequent process. In + +practice, we project the POS tags into corresponding embeddings: $\left(O_{t_e}^{N - 1}\right)' = O_{t_e}^{N - 1} + E_{t_e}^s$ , where $E_{t_e}^s$ denotes POS embedding at $t_e$ -th time step. The obtained synthetic representation $\left(O_{t_e}^{N - 1}\right)'$ is considered as the input of textual block. Due to the space limitation, we omit the calculation in textual block which is similar to Eqns. 7 and 8. The output of textual block is used to predict words: + +$$ +P _ {b, t _ {e}} = \operatorname {s o f t m a x} \left(W _ {p} O _ {t _ {e}} ^ {N}\right) \tag {10} +$$ + +where $W_{p}\in \mathbb{R}^{N_{w}\times d}$ is also trainable, $N_{w}$ is the vocabulary size of words. Overall, we jointly model the multimodal representation and global syntactic structure for sign language translation by developing an end-to-end trainable neural network. + +# 3.2.2 Multi-Stream Memory Structure + +We develop a multi-stream memory structure for auxiliary decoding. The rationale behind this design is that a word in the vocabulary may appear in multiple sign language videos. Since a word that comes up with different words may lead to various contextual visual perceptions and one word may correspond to more than one syntactic category, the memory structure is developed to capture the detailed relevant information from different sign language videos where the same word appears, leading to a comprehensive understanding for this word. + +(1). Weakly-Aligned Visual Memory: The memory structure is developed to store the descriptive information for each word in the vocabulary. We + +construct a dictionary $\langle w, r \rangle$ to record the words $w$ and corresponding representation $r$ . Since the fine-grained alignments between natural words and video frames are not provided, we could not directly obtain the visual memory. However, the end-to-end training of PET provides the weakly-supervised alignments through the cross-modal interaction in the encoder-decoder attention blocks. Therefore, we adopt a separate training scheme. Concretely, we first train a basic sign language translation model with prior knowledge enriched transformer introduced in previous sections to acquire the weakly-supervised alignments between words and video frames. In practice, we only keep the cross-modal attention weights in the textual block. The visual context information $v_{j,i}$ for the $j$ -th word $i$ -th head is modeled as: + +$$ +\begin{array}{l} v _ {j, i} = \frac {\sum_ {n _ {v} = 1} ^ {N _ {v}} \sum_ {n _ {f} = 1} ^ {N _ {f}} \left(a _ {n _ {v} , n _ {f}} ^ {i} f _ {n _ {v} , n _ {f}} ^ {v , i}\right)}{\sum_ {n _ {v} = 1} ^ {N _ {v}} \sum_ {n _ {f} = 1} ^ {N _ {f}} \left(a _ {n _ {v} , n _ {f}} ^ {i}\right)} \tag {11} \\ v _ {j} = \left[ v _ {j, 1}, \dots , v _ {j, i}, \dots , v _ {j, h} \right] \\ \end{array} +$$ + +where $N_{v}$ denotes the number of related videos in the training set, $N_{f}$ denotes the number of frames. Note that we only retain the top- $N_{f}$ relevant video frames to reduce the invalid information. $a_{n_v,n_f}^i$ denotes $n_f$ -th attention weight among the top- $N_{f}$ weights and $f_{n_v,n_f}^{v,i}$ denotes the corresponding visual features in $i$ -th head. Note that we only focus on the visual features of the last encoding block. The context features are normalized to make the magnitude consistent for words with different frequencies. The final context information $v_{j}$ is obtained by concatenating the results of all the heads. (2). Global Syntactic Memory: Considering the fact that a word appearing in multiple sentences may have different syntactic information, we calculate the ratio of different POS categories for each word. The syntactic representation $u_{j}$ for the $j$ -th word is modeled as: + +$$ +u _ {j} = \sum_ {n _ {s} = 1} ^ {N _ {s}} b _ {n _ {s}} ^ {s} f _ {n _ {s}} ^ {s}, \quad \sum_ {n _ {s} = 1} ^ {N _ {s}} b _ {n _ {s}} ^ {s} = 1 \tag {12} +$$ + +where $b_{n_s}^s$ and $f_{n_s}^s$ denote the weight and embedding of $n_s$ -th POS tag, respectively. + +(3). Adjacent Textual Memory: The vanilla transformer-based decoder does not model the compatibility between adjacent words explicitly. Thus, the textual memory is designed to capture the information of adjacent words. Concretely, we set the + +maximal adjacent step to $N_{a}$ , which means that we retain the word embeddings of adjacent words and the threshold is $N_{a}$ . The context representation $x_{j}$ for the $j$ -th word is modeled as: + +$$ +x _ {j} = \frac {\sum_ {n _ {v} = 1} ^ {N _ {v}} \sum_ {n _ {a} = 1} ^ {2 N _ {a} + 1} f _ {n _ {v} , n _ {a}} ^ {t}}{N _ {v} \left(2 N _ {a} + 1\right)} \tag {13} +$$ + +where $f_{n_v,n_a}^t$ denotes the $n_a$ -th word embedding among the $2N_{a} + 1$ adjacent embeddings. We also employ normalization for the final result. In summary, we obtain the multi-stream memory structure which records full-spectrum information $r_j$ for each word $w_j$ with a map structure: $\langle w_j,r_j\rangle = \langle w_j,\{v_j,u_j,x_j\} \rangle$ . + +# 3.2.3 Memory Enriched Decoding + +We employ the constructed multi-stream memory structure to build an auxiliary decoding system, where the translation results are further combined with the generated sentences by the syntax-aware decoding system. In this way, the translation quality is improved. + +In detail, the memory enriched decoding system is built upon the backbone of the syntax-aware decoding system as an auxiliary module. The probability distributions of different words are calculated similarly to Eqn. 10: + +$$ +P _ {m, t _ {e}} = \operatorname {s o f t m a x} \left(Q _ {t _ {e}}\right) \tag {14} +$$ + +where $Q_{t_e} \in \mathbb{R}^{N_w}$ denotes the relevance scores of different words and $Q_{t_e,j} \in \mathbb{R}$ denotes the $j$ -th element among them. We employ $Q_{t_e,j}$ to measure the qualification of $j$ -th word for $t_e$ -th time step based on its memory contents: + +$$ +\begin{array}{l} Q _ {t _ {e}, j} = w _ {p} ^ {\mathbf {T}} \tanh \left(W _ {v} \left[ v _ {j}, O _ {t _ {e}} ^ {N} \right] + W _ {u} \left[ u _ {j}, E _ {t _ {e}} ^ {s} \right]\right) \tag {15} \\ \left. + W _ {x} \left[ x _ {j}, E _ {t _ {e ^ {- 1}}} ^ {y}\right)\right) \\ \end{array} +$$ + +where we concatenate the memory contents $(v_{j},u_{j}$ $x_{j})$ with corresponding representation $(O_{te}^{N},E_{te}^{s}$ $E_{te - 1}^y)$ at $t_e$ -th time step. For instance, $u_{j},E_{te}^{s}\in \mathbb{R}^{d}$ both denote syntactic information, $x_{j},E_{t e - 1}^{y}\in \mathbb{R}^{d}$ both denote textual information. $W_{v},W_{u},W_{x}\in$ $\mathbb{R}^{d\times 2d}$ $w_{p}\in \mathbb{R}^{d}$ are all trainable variables. + +# 3.3 Training + +The optimization goal of sign language translation is to minimize the cross-entropy loss function defined as accumulative loss from all the time steps. Consequently, the syntax-aware decoder is trained by minimizing the combined loss: + +$$ +L _ {b} = - \sum_ {t _ {e} = 1} ^ {T _ {e}} \left[ \log P _ {b, t _ {e}} \left(y _ {t _ {e}}\right) + \lambda \log P _ {s, t _ {e}} \left(s _ {t _ {e}}\right) \right] \tag {16} +$$ + +where $y_{t_e}$ and $s_{t_e}$ denote the ground-truth word and POS tag at $t_e$ -th time step, respectively. $\lambda$ is a hyper-parameter to balance the two losses. In practice, we set it to 0.5. The memory enriched decoder is trained in a similar way: + +$$ +L _ {m} = - \sum_ {t _ {e} = 1} ^ {T _ {e}} \log P _ {m, t _ {e}} \left(y _ {t _ {e}}\right) \tag {17} +$$ + +The syntax-aware decoder and memory enriched decoder are trained in order. We fix the trainable variables except for those in Eqn. 15 when training memory enriched decoder. During inference, we combine the generated results of both decoders. + +# 4 Experiments + +In this section, we present the experimental settings of sign language translation and report the results on the benchmark datasets. + +Table 1: The statistical results of PHOENIX14T, where the total number of samples is 8257. + +
Signer123456789
All2191956831207193347866966269
+ +# 4.1 Dataset and Protocols + +PHOENIX14T (Signer-Dependent) is the first complete sign language understanding dataset, where a training or testing sample contains a sign language video and the corresponding signer, gloss annotations, natural language translation. Concretely, PHOENIX14T is labeled by 9 different signers (the training, validation, and test sets all contain these signers) with a vocabulary of 1066 different sign glosses. In general, one gloss may correspond to multiple natural words, and some words that do not carry visual information are added to guarantee the fluency of sentences, leading to a vocabulary of 2887 words for translation into German language. + +PHOENIX14T (Signer-Independent) is obtained by re-dividing the original PHOENIX14T dataset. Since the 9 signers are in both the training set and test set, there are no unseen signers for evaluating the generalization. We simply choose the + +Table 2: Evaluation results on PHOENIX14T (Signer-Dependent), where B@{1, 2, 3, 4} denotes BLEU-{1, 2, 3, 4} and R denotes ROUGE-L. + +
MethodPHOENIX14T
B@1B@2B@3B@4R
Multitask37.2223.8817.0813.2536.28
DeepHand38.5025.6418.5914.5638.05
Mul-Ch.---19.5145.90
NSLT32.2419.0312.839.5831.80
TSPNet36.1023.1216.8813.4134.96
SL-Trans.47.2034.4626.7521.80-
ST-Trans.48.6135.9728.3723.65-
STMC-T48.7336.5329.0324.0046.77
PET49.5437.1929.3024.0249.97
+ +Table 3: Evaluation results on PHOENIX14T (Signer-Independent), where * denotes that we implement the methods by ourselves, since none of the previous work conducts experiments on signer-independent setting. + +
MethodPHOENIX14T
B@1B@2B@3B@4R
NSLT*26.0113.848.956.2825.22
TSPNet*28.1016.8111.829.1531.00
SL-Trans.*40.1526.7019.2214.7840.22
PET41.7228.9721.3616.9442.45
+ +signers 8, 9 (1235 samples) for testing and the other signers (7022 samples) for training and validation, the statistical info is shown in Table 1. + +We follow the commonly used protocol Sign2Text (S2T) in the previous work (Camgoz et al., 2020b), which aims to directly translate the sign language videos into natural sentences without converting the input into intermediate products. Since the visual and textual modalities are not aligned strictly in a weakly-supervised manner, the difficulties of Sign2Text mainly lie in the multimodal alignments. + +# 4.2 Implementation Details + +Framework: Following (Camgoz et al., 2020b), a modified version of JoeyNMT (Kreutzer et al., 2019) is employed to implement PET. We utilize PyTorch and Tensorflow frameworks. Except for the CTC beam search decoding module which is + +Table 4: Evaluation results of style-specific interaction, where P14T (SD) and P14T (SI) denote PHOENIX14T with signer-dependent and singer-independent settings. + +
MethodP14T (SD)P14T (SI)
B@1B@2B@3B@4RB@1B@2B@3B@4R
w/o. GI48.6135.2427.5822.8948.3440.2227.3620.0515.4240.36
Add49.0436.0528.3223.4048.8840.9128.1920.6516.3640.76
Enc.49.4536.5728.9523.4549.1541.3728.5420.5716.6641.54
Dec.49.3036.3228.8423.4249.0841.4328.5220.8916.7241.28
PET49.5437.1929.3024.0249.9741.7228.9721.3616.9442.45
+ +implemented with Tensorflow, the other modules are developed with PyTorch. + +Network Details: The hidden size is set to 512 for all the multi-head attention mechanisms. The numbers of heads and attention blocks are 8 and 3, respectively. The ground-truth POS tags could be obtained by Stanford POS Tagger, which are divided into 13 categories: ADJ, ADV, ADP, VERB, NOUN, DET, PRON, AUX, CONJ, PROPN, NUM, UNK, PUNCT, we project them into 512-dimensional syntactic embeddings. We train all of the networks from scratch. + +Training: In the training stage, we utilize Adam algorithm (Kingma and Ba, 2014) to optimize the loss function. The batch size is set to 64. The learning rate is set to $5 \times 10^{-4}$ initially. We evaluate our network every 100 iterations. If the metric on validation set does not improve for 9 evaluation steps, we decrease the learning rate by a factor of 0.5. When the learning rate is less than $10^{-6}$ , we finish the training stage. + +Testing: Since the test set may have unseen signers, we calculate the style embedding with mean-pooling operation for the acquired visual features similarly. Beam search is a commonly used method to decode words during evaluation. We adopt the beam size 5. We employ the commonly-used metrics, BLEU-n and ROUGE-L. + +# 4.3 Compared Baseline Methods + +NSLT (Camgoz et al., 2018): NSLT first proposes the SLT task and employs LSTM-based structure to translate sign language videos. + +Multitask (Orbay and Akarun, 2020): Multitask employs joint learning scheme to enhance the SLT performance. + +DeepHand (Orbay and Akarun, 2020): DeepHand transfers the knowledge of hand dataset to the SLT task. + +![](images/cc80bfe4ab5917bf32ec2c292de845f1a7942db8eec47a0e6ca72ff0752a98dd.jpg) +Figure 3: The trade-off between different losses in Eqn. 16, where we set $\lambda = 0$ as the baseline. + +SL-Trans. (Camgoz et al., 2020b): SL-Trans. is the recent mainstream method for SLT, the encoder and decoder both consist of Transformer modules. TSPNet (Li et al., 2020): TSPNet employs video segment representation with multiple temporal granularities to develop a semantic pyramid network. + +Mul-Ch. (Camgoz et al., 2020a): Mul-Ch. combines multiple articulatory channels with anchoring losses and proposes a novel multi-channel transformer architecture for sign language translation. + +ST-Trans. (Voskou et al., 2021): ST-Trans. equips Transformer with stochastically competing linear units and performs variational Bayesian inference over all connection weights, throughout the network. + +STMC-T (Yin and Read, 2020): STMC-T employs spatial-temporal multi-channel Transformer to solve the SLT task. + +# 4.4 Quantitative Results + +We compare PET with the recent state-of-the-art methods. Following the previous work (Camgoz et al., 2020b), for PHOENIX14T (Signer-Dependent), we develop the gloss-based PET by + +Table 5: Evaluation of memory-enriched decoding + +
MethodP14T (SD)P14T (SI)
B@1B@2B@3B@4RB@1B@2B@3B@4R
w/o. Vis49.6336.2828.5823.4049.3241.2428.3520.8916.3041.46
w/o. Tex49.5236.5428.8323.4449.1241.0528.1620.7416.4440.93
w/o. Syn49.6936.4228.7523.5549.4841.5828.5521.0716.6441.32
w/o. Mem48.9435.6428.0722.7149.0540.5427.5320.2515.5640.64
PET49.5437.1929.3024.0249.9741.7228.9721.3616.9442.45
+ +adding the gloss supervision with CTC loss in the encoder. Table 2 shows the experimental results, we could find that PET (model-based) outperforms all the model-based and feature-based methods, NSLT (Camgoz et al., 2018), Multitask (Orbay and Akarun, 2020), DeepHand (Orbay and Akarun, 2020), SL-Trans. (Camgoz et al., 2020b), TSPNet (Li et al., 2020), Mul-Ch. (Camgoz et al., 2020a), ST-Trans. (Voskou et al., 2021) and STMC-T (Yin and Read, 2020) on all the metrics. In particular, PET achieves $49.97\%$ on ROUGE-L, making a large improvement of $3.20\%$ over STMC-T. + +Table 3 shows the results on PHOENIX14T (Signer-Independent), we implement several state-of-the-art methods manually, since none of the previous work conducts experiments on the signer-independent setting (PET is model-based method, so we mainly reproduce the model-based methods, since the methods of other types are compatible with PET). Note that, to keep fairness, we employ the same method of feature extraction in the original paper for NSLT, TSPNet, and SL-Transformer, respectively. The experimental results demonstrate the generalization of PET for unseen signers. + +# 4.5 Ablation Study + +In this section, we evaluate the effectiveness of all the contributions with ablation experiments. + +# 4.5.1 Effect of Adaptive Gated Interaction + +As shown in Table 4, we design four control experiments to demonstrate the effectiveness of adaptive gated interaction, where w/o. GI denotes that we remove the adaptive gated interaction from all attention blocks and keep the other contributions, Add denotes that we add the style embedding to the multimodal features, Enc (only) denotes that we only keep the adaptive gated interaction in the encoder, while Dec (only) denotes that we discard the adaptive gated interaction in the encoder. It + +is observed that PET outperforms four ablation methods on the benchmark datasets and w/o. GI achieves the worst performances on both BLEU and ROUGE-L, which demonstrates that the translation results benefit from the style information. The remaining ablation results illustrate that gated interaction is better than naive addition. In addition, the adaptive gated interaction enhances the multimodal alignments, corresponding results are shown in the appendix. + +# 4.5.2 Effect of Syntax-Aware Auxiliary + +We adjust the ratio of different losses in Eqn. 16 and obtain the experimental results that are shown in Fig. 3. To make the comparison more intuitive, we set $\lambda = 0$ as the baseline and provide the relative performances of BLEU-1 and BLEU-4 on PHOENIX14T (SD). We find that the performances improve as the $\lambda$ increases when $\lambda$ is less than 0.5. Subsequently, the performances are beginning to level off. Such results demonstrate the effectiveness of syntax-aware auxiliary. + +# 4.5.3 Effect of Memory-Enriched Decoding + +As shown in Table 5, we also design several control experiments to evaluate the impact of the memory enriched decoding, where w/o. Mem denotes the model without memory mechanism, w/o. Vis denotes the model only without visual memory, w/o. Tex, w/o. Syn denote the models without textual memory and syntactic memory, respectively. We find that PET outperforms all the ablation methods on both BLEU-4 and ROUGE-L. Particularly, compared with w/o. Mem, PET achieves a significant improvement on BLEU-4 (1.38% for SI, 1.31% for SD). + +# 4.6 Qualitative Results + +We would like to investigate the generation process of our model by qualitative results in this section. + +Table 6: Qualitative results of PET, where “Ref” denotes reference, “SL-Trans.” denotes SL-Transformer. As the annotations in the PHOENIX14T dataset are in German, we share both the produced sentences and their translations in English. Note that the words highlighted in red are those that require critical translation, the words highlighted in blue are the failure cases of current mainstream method SL-Transformer. + +
Ref:und zum wochenende wird es dann soccer wieder ein bisschen kälter .
SL-Trans.:( and at the weekend it even gets a little colder again . )
PET:und der januar .
( and january . )
und das wird dann am wochenende ein bisschen kälter .
( and that gets a bit colder on the weekend . )
Ref:ganz ähnliche temperaten wie heute zwischen sechs und elf grad .
SL-Trans.:( very similar temperatures as today between six and eleven degrees . )
hier und da ähnliche temperaten wie heute meist ein grad .
( here and there temperatures similar to today, mostly one degree . )
PET:ähnliches wetter heute nacht nur sechs bis elf grad .
( similar weather tonight only six to eleven degrees . )
Ref:deutschland liegt morgen unter hochdruckeinfluss der die wolken weltgehend vertreibt .
SL-Trans.:( tomorrow germany will be under the influence of high pressure which will largely drive away the clouds . )
in Deutschland liegt morgen unter tiefdruckeinfluss und wolken .
( in germany tomorrow is under the influence of low pressure and clouds . )
PET:Morgen wird Deutschland von hohem Druck betroffen sein .
( tomorrow germany will be hit by high pressure . )
+ +Here we provide some sign language translation examples in Table 6. As the annotations in the PHOENIX14T dataset are in German, we share both the produced sentences and their translations in English. Note that the words highlighted in red are those that require critical translation, the words highlighted in blue are the failure cases of current mainstream method SL-Transformer. Benefiting from the style-specific interaction, syntax-aware auxiliary, and memory enriched decoding, PET could accurately translate some detailed information compared with SL-Transformer and retain the whole contents of the ground truth better than SL-Transformer, which demonstrates the effectiveness again. + +# 5 Conclusion + +In this paper, we have proposed a new method called prior knowledge and memory enriched transformer for sign language translation. Specifically, we develop the adaptive gated interaction which associates the multimodal representation and global signing style in all the attention blocks. One POS sequence generator relies on the associated information to predict the global syntactic structure, which is thereafter leveraged to guide the sentence generation. Besides, considering that the visual and textual context information, and additional auxiliary knowledge of a word appear in more than one + +video, we design a memory structure to store the full-spectrum correspondence between a word and its various relevant information in the training data. The experimental results reveal the effectiveness and generalization of PET. + +# Acknowledgments + +This work was supported in part by the National Key R&D Program of China under Grant No.2020YFC0832505, National Natural Science Foundation of China under Grant No.61836002, No.62072397 and Zhejiang Natural Science Foundation under Grant LR19F020006. + +# References + +Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. 2014. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473. +Necati Cihan Camgoz, Simon Hadfield, Oscar Koller, and Richard Bowden. 2017. Subunets: End-to-end hand shape and continuous sign language recognition. In 2017 IEEE International Conference on Computer Vision (ICCV), pages 3075-3084. IEEE. +Necati Cihan Camgoz, Simon Hadfield, Oscar Koller, Hermann Ney, and Richard Bowden. 2018. Neural sign language translation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 7784-7793. +Necati Cihan Camgoz, Ahmet Alp Kindirouglu, and Lale Akarun. 2016. Sign language recognition for assisting the deaf in hospitals. In International Workshop on Human Behavior Understanding, pages 89-101. Springer. +Necati Cihan Camgoz, Oscar Koller, Simon Hadfield, and Richard Bowden. 2020a. Multi-channel transformers for multi-articulatory sign language translation. In European Conference on Computer Vision, pages 301-319. Springer. +Necati Cihan Camgoz, Oscar Koller, Simon Hadfield, and Richard Bowden. 2020b. Sign language transformers: Joint end-to-end sign language recognition and translation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10023-10033. +Runpeng Cui, Hu Liu, and Changshui Zhang. 2017. Recurrent convolutional neural networks for continuous sign language recognition by staged optimization. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 7361-7369. +Runpeng Cui, Hu Liu, and Changshui Zhang. 2019. A deep neural framework for continuous sign language + +recognition by iterative training. IEEE Transactions on Multimedia, 21(7):1880-1891. +Alex Graves, Santiago Fernández, Faustino Gomez, and Jürgen Schmidhuber. 2006. Connectionist temporal classification: labelling unsegmented sequence data with recurrent neural networks. In Proceedings of the 23rd international conference on Machine learning, pages 369-376. +Sepp Hochreiter and Jürgen Schmidhuber. 1997. Long short-term memory. Neural computation, 9(8):1735-1780. +Tao Jin, Siyu Huang, Ming Chen, Yingming Li, and Zhongfei Zhang. 2020. Sbat: Video captioning with sparse boundary-aware transformer. arXiv preprint arXiv:2007.11888. +Tao Jin, Siyu Huang, Yingming Li, and Zhongfei Zhang. 2019a. Low-rank hoca: Efficient high-order cross-modal attention for video captioning. arXiv preprint arXiv:1911.00212. +Tao Jin, Yingming Li, and Zhongfei Zhang. 2019b. Recurrent convolutional video captioning with global and local attention. Neurocomputing, 370:118-127. +Tao Jin and Zhou Zhao. 2021. Contrastive disentangled meta-learning for signer-independent sign language translation. In Proceedings of the 29th ACM International Conference on Multimedia, pages 5065-5073. +Diederik P Kingma and Jimmy Ba. 2014. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980. +Oscar Koller, Necati Cihan Camgoz, Hermann Ney, and Richard Bowden. 2019. Weakly supervised learning with multi-stream cnn-lstm-hmms to discover sequential parallelism in sign language videos. IEEE transactions on pattern analysis and machine intelligence, 42(9):2306-2320. +Julia Kreutzer, Jasmijn Bastings, and Stefan Riezler. 2019. Joey nmt: A minimalist nmt toolkit for novices. arXiv preprint arXiv:1907.12484. +Dongxu Li, Chenchen Xu, Xin Yu, Kaihao Zhang, Ben Swift, Hanna Suominen, and Hongdong Li. 2020. Tspnet: Hierarchical feature learning via temporal semantic pyramid for sign language translation. arXiv preprint arXiv:2010.05468. +Minh-Thang Luong, Hieu Pham, and Christopher D. Manning. 2015. Effective approaches to attention-based neural machine translation. arXiv preprint arXiv:1508.04025. +Alptekin Orbay and Lale Akarun. 2020. Neural sign language translation by learning tokenization. arXiv preprint arXiv:2002.00479. +Wenjie Pei, Jiyuan Zhang, Xiangrong Wang, Lei Ke, Xiaoyong Shen, and Yu-Wing Tai. 2019. Memory-attended recurrent network for video captioning. In + +Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 8347-8356. +Mingxing Tan and Quoc Le. 2019. Efficientnet: Rethinking model scaling for convolutional neural networks. In International Conference on Machine Learning, pages 6105-6114. PMLR. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. arXiv preprint arXiv:1706.03762. +Andreas Voskou, Konstantinos P Panousis, Dimitrios Kosmopoulos, Dimitris N Metaxas, and Sotirios Chatzis. 2021. Stochastic transformer networks with linear competing units: Application to end-to-end sl translation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 11946-11955. +Shuo Wang, Dan Guo, Wen-gang Zhou, Zheng-Jun Zha, and Meng Wang. 2018. Connectionist temporal fusion for sign language translation. In Proceedings of the 26th ACM international conference on Multimedia, pages 1483-1491. +Kayo Yin and Jesse Read. 2020. Better sign language translation with stmc-transformer. arXiv preprint arXiv:2004.00588. \ No newline at end of file diff --git a/priorknowledgeandmemoryenrichedtransformerforsignlanguagetranslation/images.zip b/priorknowledgeandmemoryenrichedtransformerforsignlanguagetranslation/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..dfe103371480cb94ef609ff97ab783c9215d79e1 --- /dev/null +++ b/priorknowledgeandmemoryenrichedtransformerforsignlanguagetranslation/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e2ee3627ec26a65d5c631f9af8926ae0ffe7931e820ae4054df6b529a3ca74c0 +size 509604 diff --git a/priorknowledgeandmemoryenrichedtransformerforsignlanguagetranslation/layout.json b/priorknowledgeandmemoryenrichedtransformerforsignlanguagetranslation/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..240d5d6eb660f9ad8c1cd23d90adf893a3abaa23 --- /dev/null +++ b/priorknowledgeandmemoryenrichedtransformerforsignlanguagetranslation/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d84837c9a2c59ff1ced445404acce9774d893c13a52a641f4d812f82c06c8373 +size 386714 diff --git a/probingbertspriorswithserialreproductionchains/ad47dabe-c438-4db3-8161-7747579ccc7a_content_list.json b/probingbertspriorswithserialreproductionchains/ad47dabe-c438-4db3-8161-7747579ccc7a_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..56da7ea3e4efa06903f2635f8795d1f671e3cf3d --- /dev/null +++ b/probingbertspriorswithserialreproductionchains/ad47dabe-c438-4db3-8161-7747579ccc7a_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8991c6ebe382a7879937bfa6614db9b15b708d39e308d78323ce1eb94bffd9ef +size 82403 diff --git a/probingbertspriorswithserialreproductionchains/ad47dabe-c438-4db3-8161-7747579ccc7a_model.json b/probingbertspriorswithserialreproductionchains/ad47dabe-c438-4db3-8161-7747579ccc7a_model.json new file mode 100644 index 0000000000000000000000000000000000000000..f8f226ff23432133d888ca4026b917eb779cea4e --- /dev/null +++ b/probingbertspriorswithserialreproductionchains/ad47dabe-c438-4db3-8161-7747579ccc7a_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1aa3f7d78b266cb712517d95aecc00cc7c9095e02481eec8abf650fb296a6fd8 +size 101793 diff --git a/probingbertspriorswithserialreproductionchains/ad47dabe-c438-4db3-8161-7747579ccc7a_origin.pdf b/probingbertspriorswithserialreproductionchains/ad47dabe-c438-4db3-8161-7747579ccc7a_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..0d3887dddf6328b5e034b969309e82a528958a6f --- /dev/null +++ b/probingbertspriorswithserialreproductionchains/ad47dabe-c438-4db3-8161-7747579ccc7a_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7cd4c087305e471e19605a8cc1d097db38b201ddeb2e3183347148efcaf66b9e +size 3629584 diff --git a/probingbertspriorswithserialreproductionchains/full.md b/probingbertspriorswithserialreproductionchains/full.md new file mode 100644 index 0000000000000000000000000000000000000000..bb53f742a502fe090501fd642d54f3cf67f93ed2 --- /dev/null +++ b/probingbertspriorswithserialreproductionchains/full.md @@ -0,0 +1,290 @@ +# Probing BERT's priors with serial reproduction chains + +Takateru Yamakoshi $^{1,2}$ , Thomas L. Griffiths $^{1}$ , Robert D. Hawkins $^{1}$ + +1Princeton University, 2The University of Tokyo + +{takateru,tomg,rdhawkins}@princeton.edu + +# Abstract + +Sampling is a promising bottom-up method for exposing what generative models have learned about language, but it remains unclear how to generate representative samples from popular masked language models (MLMs) like BERT. The MLM objective yields a dependency network with no guarantee of consistent conditional distributions, posing a problem for naive approaches. Drawing from theories of iterated learning in cognitive science, we explore the use of serial reproduction chains to sample from BERT's priors. In particular, we observe that a unique and consistent estimator of the ground-truth joint distribution is given by a Generative Stochastic Network (GSN) sampler, which randomly selects which token to mask and reconstruct on each step. We show that the lexical and syntactic statistics of sentences from GSN chains closely match the ground-truth corpus distribution and perform better than other methods in a large corpus of naturalness judgments. Our findings establish a firmer theoretical foundation for bottom-up probing and highlight richer deviations from human priors1. + +# 1 Introduction + +Large neural language models have become the representational backbone of natural language processing. By learning to predict words from their context, these models have induced surprisingly human-like linguistic knowledge, from syntactic structure (Linzen and Baroni, 2021; Tenney et al., 2019; Warstadt et al., 2019) and subtle lexical biases (Hawkins et al., 2020) to more insidious social biases and stereotypes (Caliskan et al., 2017; Garg et al., 2018). At the same time, efforts to probe these models have revealed significant deviations from natural language (Braverman et al., 2020; Holtzman et al., 2019; Dasgupta et al., 2020). + +food was running short, and winters were colder. time was running short, and winters were colder. time was running out, and winters were colder. + +![](images/8a27d426582ab88f7b4d99609fce97028b87ca047678c6bbf60fe96faba9ca83.jpg) +Figure 1: We use a serial reproduction method to probe BERT's prior over possible sentences (visualization of reproduction chains obtained by running t-sne on sentence embeddings; chains are color-coded and fade to black across their burn-in period). + +Observations of incoherent or "weird" behavior may often be amusing, as when a generated recipe begins with "1/4 pounds of bones or fresh bread" (Shane, 2019), but also pose significant dangers in real-world settings (Bender et al., 2021). + +These deviations present a core theoretical and methodological puzzle for computational linguistics. How do we elicit and characterize the full prior² that a particular model has learned over possible sentences in a language? A dominant approach has been to design benchmark suites that + +
Type of unnaturalnessExample
word-levelmorphologicalHigher education school xur divided into six institutions.
phrase-levelsyntacticSwallowing hard, Verity stared at the these, desperately wanting to see if they congealed.
semanticThe west section is a fig octagon.
A private apartment with nothing but hot cooled water.
predicationHe already costumes his relationship with my mother carefully.
Voices rapped on the incremental door.
sentence-levelout-of-contextLike a cataract, Horatius responds, “You are better than me.”
self-contradictoryThe newspaper is published weekly and biannually.
pragmaticShe grew up with three sisters and ten sisters.
It should apply between the extreme and the extreme.
+ +Table 1: Examples of sentences sampled from BERT's prior that received low naturalness ratings from our participants, including sources forms of unnaturalness like predicability or category errors (e.g. doors typically do not have the property of "incrementality"), semantic incoherence ("hot cooled water"), or contradictory constructions (especially for longer sentences). More examples can be found in table S2 and in the online supplement. + +probe theoretically important aspects of the prior, and compare model behavior to human behavior on those tasks (e.g. Warstadt et al., 2020; Ettinger, 2020). Yet this approach can be restrictive and piecemeal: it is not clear ahead of time which tasks will be most diagnostic, and many sources of "weirdness" are not easily operationalized (Kuribayashi et al., 2021). + +A more holistic, bottom-up alternative is to directly examine samples from the model's prior and compare them against those from human priors. However, many successful models do not explicitly expose this distribution, and many generation methods optimize the "best" sentences rather than theoretically meaningful or representative ones. For example, masked language models (MLMs) like BERT (Devlin et al., 2018) are dependency networks (Heckerman et al., 2000; Toutanova et al., 2003), trained to efficiently learn an independent collection of conditional distributions without enforcing consistency between them. In other words, these conditionals may not correspond to any coherent joint distribution at all, leading recent work to focus on other score-based sampling objectives (Goyal et al., 2021). + +Here, we explore the use of serial reproduction chains (see Fig. 1) to overcome these challenges. While a naive (pseudo-)Gibbs sampler is indeed problematic for MLMs, the literature on Generative Stochastic Networks (GSNs; Bengio et al., 2014) has formally shown that a simple algorithmic variant we call GSN sampling produces a stationary distribution that is, in fact, a unique and consis + +tent estimator of the ground-truth joint distribution. Furthermore, while the independent conditionals learned by dependency networks may be arbitrarily inconsistent in theory, empirical work has found that these deviations tend to be negligible in practice, especially on larger datasets (Heckerman et al., 2000; Neville and Jensen, 2007). Thus, we argue that it is both theoretically and empirically justified to take these samples as uniquely representative of the model's prior over language. + +We begin in Section 2 by introducing the serial reproduction approach and clarifying the problem of re-constructing a joint distribution from a dependency network. We then validate that our chains are well-behaved (Section 3) and compare the statistics of samples from BERT's prior to the lexical and syntactic statistics of its ground-truth training corpus to measure distributional similarity (Section 4). Finally, in Section 5, we present a large-scale behavioral study eliciting naturalness judgments from human speakers and identify features of the generated sentences which most strongly predict human ratings of "weirdness" (see Table 1). We find that GSN samples closely approximate the ground-truth distribution and are judged to be more natural than other methods, while also revealing areas of improvement that have been difficult to quantify with top-down benchmarks. + +# 2 Approach + +# 2.1 Serial reproduction + +Our approach is inspired by serial reproduction games like Telephone, where an initial message is + +![](images/5d4aa79b79fa2c9e40e7da1b504b865be701e479e8d760a397e1d97306a9d6c5.jpg) +LM Bayes net (acyclic) + +![](images/9605c42d5c91e86fff0d84396face9cb06c3d9200a0f27d700ac4028185bd659.jpg) +MLM dependency net (cyclic) +Figure 2: While autoregressive language models (LMs) are Bayes nets, masked language models (MLMs) are dependency networks with cyclic dependencies. + +gradually relayed along a chain from one speaker to the next. At each step, the message is changed subtly as a result of noisy transmission and reconstruction, and the final version of the message often differs drastically from the first. This serial reproduction method, initially introduced to psychology by Bartlett (1932), has become an invaluable tool for revealing human inductive biases (Xu and Griffiths, 2010; Langlois et al., 2021; Sanborn et al., 2010; Harrison et al., 2020). Because reconstructing a noisy message is guided by the listener's prior expectations, such chains eventually converge to a stationary distribution that is equivalent to the population's prior, reflecting what people expect others to say (Kalish et al., 2007; Griffiths and Kalish, 2007; Beppu and Griffiths, 2009). For example, Meylan et al. (2021) recently evaluated the ability of neural language models to predict the changes made to sentences by human participants at each step of a serial reproduction chain. Thus, while serial reproduction is commonly used to probe human priors, and to compare models against human data, it is not yet in wide use for probing the models themselves. + +# 2.2 BERT as a dependency network + +There has been considerable confusion in the recent literature over how to interpret the MLM objective used to train models like BERT, and how to interpret samples from such models. Wang and Cho (2019) initially observed that BERT was a Markov Random Field (MRF) and proposed a Gibbs sampler that iteratively masks and reconstructs different sites $k$ by sampling from the conditional given the tokens at all other sites $\hat{P}(w_k | w_{-k})$ . As observed by Goyal et al. (2021), however, this procedure does not actually correspond to inference in the MRF. Unlike auto-regression language models (LMs) like GPT-3 (Brown et al., 2020), which define an acyclic dependency graph (or Bayes net) + +from left-to-right, MLMs have cyclic dependencies (see Fig. 2) and are therefore usefully interpreted as dependency networks rather than Bayes networks (Heckerman et al., 2000). Because dependency networks estimate independent conditionals, there is no guarantee that these conditionals are consistent (i.e. they may violate Bayes rule) and therefore do not represent a coherent joint distribution. + +Still, it is possible to re-construct a joint distributions from these conditionals. For example, Heckerman et al. (2000) proved that if sites are visited in a fixed order, a (pseudo-)Gibbs chain similar to the one used by Wang and Cho (2019) does converge to a stationary distribution that is a well-formed joint. The problem is that different orders may yield different joint distributions, making it difficult to interpret any distributions as definitive. This ambiguity was resolved by the Generative Stochastic Network framework proposed by Bengio et al. (2014). Instead of visiting sites in a fixed order, a GSN sampler randomly chooses which site to visit at each step (with replacement), thus preserving aperiodicity and ergodicity. Specifically, this algorithm begins by initializing with a sequence $\{w_1^0,\dots ,w_n^0\}$ . At each step $t$ of the chain, we randomly choose a site $k\in 1,\ldots ,n$ to mask out, and we sample a new value $w_{k}^{t + 1}$ from the conditional distribution $P(w_{k}|w_{-k}^{t})$ with the other $n - 1$ sites fixed. + +A key theorem of Bengio et al. (2013, 2014) proves that the stationary distribution arising from the GSN sampler defines a unique joint distribution, and furthermore, this stationary distribution is a consistent estimator of the ground-truth joint distribution3. Importantly, this stationary distribution differs from the one given by the Metropolis-Hastings (MH) approach suggested by Goyal et al. (2021), which uses the GSN sampler as a proposal distribution but accepts or rejects proposals based on an energy-based pseudo-likelihood defined by the sum of the conditional scores at each location (Salazar et al., 2020). This MH sampler instead converges to an implicit stationary distribution defined by the energy objective4. + +# 2.3 Mixture kernels + +In practice, Markov chain sampling methods have many failure modes. Most prominently, because samples in the chains are not independent, it is challenging to guarantee convergence to a stationary distribution, and the chain is easily "stuck" in local regions of the sample space (Gelman et al., 1992). Typically, samples from a burn-in period (e.g. the first $m$ epochs) are discarded to reduce dependence on the initial state, and a lag between samples (e.g. recording only every $l$ epochs) is introduced to reduce auto-correlation. However, the problem is particularly severe for language models like BERT where there are strong mutual dependencies between words at different sites. For example, once the chain reaches a tri-gram like 'Papua New Guinea', it is unlikely to change any single word while keeping the other words constant. To ensure ergodicity, we use a mixture kernel introducing a small constant probability ( $\epsilon = 0.001$ ) of returning to the initial distribution of [MASK] tokens on each epoch, allowing the chain to burn in again. + +# 3 Validating the stationary distribution + +In this section, we validate that the samples produced by our serial reproduction method are representative of the stationary prior distribution. More specifically, we consider two basic properties of the chain: convergence and independence. For these analyses, we consider samples from the pretrained bert-base-uncased model with 12 layers, 12 heads, and 110M parameters5. + +# 3.1 Convergence + +We begin by checking the convergence time for chains generated by GSN sampling. Theoretical bounds derived for serial reproduction chains give a convergence time of $n \log n$ , where $n$ is the number of sites (see Rafferty et al., 2014). To check these convergence bounds in practice, we set $n = 21$ and select 20 sentences from Wikipedia to serve as initial states, and run 10 chains initialized at each sentence. We ensured that half of these sentences have high initial probability (under BERT's energy score) and half have low initial probability. We find that these distributions indeed begin to quickly mix in probability (see Figure S1). Because longer sentences may require a longer burn-in time, we conservatively set our burn-in window to $m = 1000$ epochs for our subsequent experiments. + +# 3.2 Independence + +Second, we want to roughly ensure independence of samples, so that the statistics of our distribution of samples isn't simply reflecting auto-correlation in the chain. For a worst-case analysis of a local minimum, suppose $P(w_{i}|w_{-i}) < \delta$ ( $0 < \delta < 1$ ) for all $i \in [1,\dots ,k]$ , where $k$ is the sentence length in tokens. Then the probability of re-sampling the same sentence is roughly $< \delta^{k\cdot n}$ after $n$ epochs. We can solve for the number of epochs $n$ we need to bound the probability of re-sampling the exact same sentence under $\epsilon$ for a given worst-case $\delta$ . For example, if $\delta = 0.99$ and we want to ensure that the probability of re-sampling the same sentence is below a threshold $\epsilon = 0.01$ , then $n = 47$ epochs will likely suffice. Ensuring complete turnover in the worst case scenario requires much longer lags, i.e. $[1 - (1 - \delta)^{k}]^{n} < \epsilon$ . + +To evaluate the extent to which these cases arise in practice, we examine auto-correlation rates on longer chains (50,000 epochs). We calculate correlations between the energy scores at each epoch as a proxy for the state: when the chain gets stuck re-sampling the same sentence, the same scores appear repeatedly. We find that auto-correlation is generally high, but our mixture kernel prevents the worst local minima for both the MH chain (Goyal et al., 2021) and our GSN chain (see Fig. S2), although we still found higher auto-correlation rates for the MH chain. To further examine these minima, we examined edit rates: the number of changes made to the sentence within an epoch. Without the mixture kernel, we observe long regions of consistently low edit rates (e.g. in some cases, 5000 epochs in a row of exactly the same sentence) which disappear under the mixture kernel (see Fig. S3). + +Based on these observations, we set the lag to $l = 500$ epochs to maintain relatively high independence between samples. + +# 4 Distributional comparisons + +In this section, we examine the extent to which higher-order statistics of sentences from BERT's prior are well-calibrated to the data it was trained on. This kind of comparison provides a richer sense of what the model has learned or failed to learn than traditional scalar metrics like perplexity (Takahashi and Tanaka-Ishii, 2017; Meister and Cotterell, 2021; Takahashi and Tanaka-Ishii, 2019; Pillutla et al., 2021). + +![](images/a9954f3f32e0493230a62966ceb18a240b4d50b1acba0fc4021cb3b9e77ce46f.jpg) +Figure 3: The lexical frequencies of our GSN samples (A) closely match the Zipfian distribution of the corpus and (B) closely correlate with the corresponding frequencies of the corpus distribution. + +![](images/1ab8a362bc423a3a49ac0d8693b86de445afe0ddd993785441eb5ba6f1da14a1.jpg) + +# 4.1 Corpus preparation + +The version of BERT we analyzed in the previous section was trained on a combination of two corpora: Wikipedia and BookCorpus. In order to make valid comparisons between human priors and machine priors, we needed to closely match BERT-generated sentences with a comparable subset of human-generated sentences from these combined corpora. There are two technical challenges we must overcome to ensure comparable samples, concerning the sentencizer and tokenizer steps. + +First, because our unit of comparison is the sentence, we needed to control for any artifacts that may be induced by how we determine what sentences are (e.g. if our Wikipedia sentences were systematically split on abbreviations, skewing the distribution toward fragments). We therefore applied the same punkt sentencizer to create our distribution of Wikipedia sentences and to check our BERT samples for cases where the generated sequence contained multiple sentences or ended with a colon or semicolon. + +Second, we needed a tokenizer that equates sentence length. Because bi-directional models like BERT operate over sequences of fixed length, all samples drawn from a single chain have the same number of tokens. + +Critically, however, BERT chains are defined over sequences of WordPiece tokens, so once these sequences are decoded back into natural language text, they may yield sentences of varying length, + +depending on how the sub-word elements are combined together $^6$ (see Fig. S5). We solve this alignment problem by using the WordPiece tokenizer to extract sentences of fixed sub-word token length from our text corpora, yielding equivalence classes of corpus sentences that are all tokenized to the same number of WordPiece tokens. We ran GSN and MH chains over sentences of $n = 11$ tokens, representing the modal lengths of sentences in BookCorpus (see Fig. S4). We obtained 5,000 independent sentences from each sampling method after applying our conservative burn-in and lag, and combined the Wikipedia and BookCorpus sentences together into a single corpus that is representative of BERT's training regime. + +# 4.2 Lexical distributions + +We begin by comparing the lexical frequency statistics of our samples from BERT against the ground-truth corpus statistics. First, we note that the relationship between rank and frequency of tokens in the GSN sampling matches the Zipfian distribution of its training corpus better than those produced by MH sampling (see Fig. 3A). However, it is possible to produce the same overall distribution without + +![](images/0019cb3d87ae63767a4e41ddab6ea15aa3c7225956a6abc9c38aaa1d526c6750.jpg) +Figure 4: The relative frequencies of different parts of speech (left) and dependencies (right) in the ground-truth training corpora closely matched for GSN samples. In all cases, the GSN frequencies fell closer to the ground-truth than the MH frequencies. + +![](images/1a60dce46cdb4b16a833303b03c575a8f4bbd94f96f78422a9a58e6281049305.jpg) + +matching the empirical frequencies of individual words. We next examined the respective ranks of each word across the two distributions. Overall, the word ranks in the GSN samples had a strong Spearman rank correlation of $r = 0.75$ with the word ranks in the ground-truth corpus; the MH samples had a significantly lower correlation of $r = 0.48$ (Pearson $z = 17, p < 0.001$ , Fig 3B). Most disagreements lay in the tails where frequency estimates are particularly poor (e.g. many words only appeared once in our collection of samples). Indeed, among words with greater than 10 occurrences, the correlation improved to $r = 0.83$ for GSN and $r = 0.65$ for MH. + +To understand this relationship further, we conducted an error analysis of lexical items which were systematically over- or under-produced by BERT relative to its training corpus. We found that certain punctuation tokens (e.g. parentheses) were over-represented in both the GSN samples and the MH samples, while contractions like 's and 'd were under-represented. The MH samples specifically over-produced proper names such as Nina and Jones. Finally, due to the use of sub-word representations, we found a long tail of morphologically complex words that did not appear at all in the training corpus (e.g. names like Kyftenberg or Streckenstein and seemingly invented scientific terms like lymphoplasmic, neopomphorus, or pyranolamines). + +# 4.3 Syntactic distributions + +While the lexical distributions were overall well-matched for GSN samples, our error analysis suggested potential structure in the deviations. In other words, entire grammatical constructions may be over- or under-represented, not just particular words. To investigate these patterns, we used the spacy library to extract the parts of speech and dependency relations that are present within each sentence. We are then able to examine, in aggregate, whether certain classes of constructions are disproportionately responsible for deviations. Our findings are shown in Fig. 4. Overall, the distributions are close, but several areas of misalignment emerge. For parts of speech, we observe that the GSN sampler is slightly over-producing nouns (and proper nouns) while under-producing verbs and prepositions. We also observe that it is over-producing noun-related dependencies (e.g. compound nouns and appositional modifiers, which are noun phrases modifying other noun phrases, as in "Bill, my brother, visited town"). This pattern suggests that BERT's prior may be skewed toward (simpler) noun phrases while neglecting more complex constructions. + +# 4.4 Sentence complexity + +One hypothesis raised by comparing distributions of syntactic features is that BERT may be regularizing the complex structure of its input toward + +![](images/e5b2c954fd4e3bb9ca5532ce57ff0ac3ac18e598f87df6c6bc7a03dece676f62.jpg) +Figure 5: Cumulative probability distribution of dependency lengths across sentences from BERT chains and from the training corpus. + +simpler constructions. To test this hypothesis, we operationalize syntactic complexity using a measure known as the average dependency length of a sentence (Futrell et al., 2015; Grodner and Gibson, 2005). This measure captures the (linear) distance between syntactically related words, which increases with more complex embedded phrase structures. We found that the distribution of dependency distances in the sentences produced by GSN sampling is overall more similar to those in its training corpus than the MH (Fig. 5), although closer analysis suggests it is still skewed slightly simpler (see Fig. S6). + +# 5 Human judgments + +Finally, while our corpus comparisons highlighted particular ways in which samples from BERT's prior were well-calibrated to the high-level statistics of its training distribution, it is unclear whether these agreements or deviations 'matter' in terms of naturalness. In this section, we elicit human naturalness judgments in order to provide a more holistic measure of potential 'weirdness' with BERT sentences. + +# 5.1 Experimental methods + +We recruited 1016 fluent English speakers on the Prolific platform and asked them to judge the naturalness of 4040 unique sentences from three length classes: short (11 tokens), medium (21 tokens), and long (37 tokens). 1675 of these sentences were from the stationary state of the different chains, 2339 were from the burn-in phase (i.e. $< 1000$ epochs), and the remainder were baseline sentences (149 from Wikipedia, 48 from a 5-gram model, and 42 from an LSTM model; see Appendix for details). + +Each participant was shown a sequence of 25 sentences in randomized order, balanced across different properties of the stimulus set7. On each trial, one of these sentences appeared with a slider ranging from 0 ("very weird") to 100 ("completely natural")8. After excluding 8 participants who failed the attention check (i.e. failed to rate a scrambled sentence below the midpoint of the scale and a human-generated sentence above the midpoint), we were left with an average of 7.3 responses per sentence. + +# 5.2 Behavioral results + +We begin by comparing the naturalness of sentences from the stationary GSN distribution to other baselines (see Fig. 6), using a linear regression model predicting trial-by-trial judgments as a function of categorical variables encoding sentence length (short, medium, long) and the source of the sentence (Wikipedia, GSN, MH, LSTM, or n-gram). First, we find that the naturalness of sentences from GSN declines by 14 points at longer sentence lengths, $p < 0.001$ , while the naturalness of Wikipedia sentences is unaffected by length (interaction term, $p < 0.001$ ), consistent with results reported by Ippolito et al. (2020). Furthermore, among short sentences, where we included additional baselines, we find that GSN sentences tend to be rated as slightly less natural than sentences from Wikipedia (+10 points, $p < 0.001$ ) but more natural than those produced by an n-gram model (-52 points, $p < 0.001$ ), LSTM model (-25 points, $p < 0.001$ ); or MH sampling from the same BERT conditionals (-15 points, $p < 0.001$ ; see Table S1). MH samples also deteriorate significantly in naturalness for longer sentences compared to GSN samples ( $p < 0.001$ ). Finally, we examine naturalness ratings across the burn-in period, finding that ratings decline steadily across the board as the chain takes additional steps (linear term: $t(7297) = -12.4$ , $p < 0.001$ ), suggesting gradual deviation away from the initial distribution of Wikipedia sentences toward the stationary distribution (shown as the green and grey regions, respectively, in Fig. S7). + +![](images/cf5a6ff1c4ed609b1420f322fe96dd56fbcf3d2d40708f38fe97bc438001add1.jpg) +Figure 6: Empirical naturalness ratings elicited from the stationary GSN distribution, compared to different baselines at different sentence lengths. Error bars are bootstrapped $95\%$ CIs. + +# 5.3 Predicting naturalness + +Given that sentences from the stationary GSN distribution are judged to be less natural than human-generated sentences overall, we are interested in explaining why. Which properties of these sentences make them sound strange? We approach this problem by training a regression model to predict human judgments from attributes of each sentence. We include all part of speech tag counts and dependency counts, as well as the sentence probability scored under BERT, and the sentence length. We use a cross-validated backwards feature selection procedure to select the most predictive set of these features for a linear regression (Kuhn and Johnson, 2013) $^9$ . + +The best-fitting model used 26 features and achieved an (adjusted) $R^2 = 0.21$ . The only features associated with significantly lower ratings were the use of adpositions (e.g. before, after) and coordinating conjunctions. Importantly, we found that including a categorical variable of corpus (i.e. Wikipedia vs. GSN) significantly improved model fit even after controlling for all other features, $\chi^2(1) = 7135$ , $p < 0.001$ , suggesting that sources of "weirdness" are not being captured by typical statistics. We show some of these low-naturalness sentences in Table 1 and S2. + +# 6 Discussion + +# 6.1 Probing through generation + +A core idea of our serial reproduction approach is to use generation as a window into a model's prior over language. While a variety of metrics + +and techniques have been proposed to quantify the "quality" of generation, especially in the domains of open-ended text generation and dialogue systems (Caccia et al., 2020; Li et al., 2020; Guidotti et al., 2018; Celikyilmaz et al., 2020), these metrics have typically been applied to compare specific generation algorithms and operationalize specific pitfalls, such as incoherence, excess repetition, or lack of diversity. Consequently, it has been difficult to disentangle the extent to which deviations resulting from generations are an artifact of specific decoding algorithms (e.g. greedy search vs. beam search) or run deeper, into the prior itself. For the purposes of probing, we suggest that it is important to ask not only how to generate the highest-scoring sentences but how to generate sentences that may be interpreted as representative of the model's prior, as formal results on GSNs have effectively provided. + +# 6.2 GSN vs. energy-based objectives + +We found that the prior distribution yielded by the GSN sampler more closely approximated the lexical and syntactic distributions of the ground-truth corpus and also sounded more "natural" to humans than the samples yielded by MH. These results are in contrast to findings by Goyal et al. (2021), showing that MH produced high-quality BLEU scores on a Machine Translation (MT) task compared to a degenerate (pseudo-)Gibbs sampler. There are several possible reasons for this discrepancy. One possibility may be task-specific: while we focused on unconditional generation, Goyal et al. (2021) focused on a neural machine translation (MT) task, where sentence generation was always conditioned on a high-quality source text and thus remained within a constrained region of sentence space. Another possibility is that we ran substantially longer chains (50,000 epochs compared to only 33 epochs) and the pitfalls of MH sampling only emerged later in the chain. + +More broadly, our corpus comparisons and human evaluations suggest serious limitations of simple "quality" metrics like energy values. We found that the best-scoring states were often degenerate local minima with mutually supporting n-grams (such as repetitive phases and names like "Papua New Guinea"). Indeed, there was only a loose relationship between energy scores and participants' judgments in our study, with many poorer-scoring sentences judged to be more natural than better-scoring sentences (e.g. overall, the distribution + +of Wikipedia sentences tended to be much lower-scoring under the energy function despite being rated as more natural). We empirically validated that the stationary distribution of the GSN chain successfully approximates even higher-order statistics of the ground-truth corpus, suggesting that the raw conditionals of the dependency network may implicitly acquire the joint distribution, without requiring guarantees of consistency. + +# 6.3 Other architectures + +Serial reproduction methods are particularly useful for probing models that do not directly generate samples from their prior. For auto-regressive models like GPT-2, these samples are obtained more directly by running the model forward (and, indeed, ancestral sampling produces text that better balances the precision-recall tradeoff than other algorithms; Pillutla et al., 2021). While we focused on BERT, this method may be particularly useful for encoder-decoder architectures like BART (Lewis et al., 2020) which more closely resemble the human Telephone Game task, requiring full reconstruction of the entire sentence from noisy input rather than reconstruction of a single missing word. Indeed, these architectures may overcome an important limitation of serial reproduction with BERT: because these chains operate over a fixed sequence length, the resulting prior is not over all of language but only over sentences with the given number of WordPiece tokens. Finally, while we focused on unconditional generation, the GSN sampler also generalizes straightforwardly to conditional generation, where a subset of sites are fixed and the masked site is chosen from the remaining set. + +# 6.4 Conclusions + +Serial reproduction paradigms have been central for exposing human priors in the cognitive sciences. In this paper, we drew upon the theory of iterated learning and of Generative Stochastic Networks (GSNs) to expose the priors of large neural language models, which are often similarly inscrutable. We hope future work will consider other points of contact between these areas and draw more extensively from the theory developed to understand dependency networks. More broadly, as language models become increasingly adaptive and deployed in increasingly unconstrained settings, bottom-up probing has the potential to reveal a broader spectrum of "weirdness" than top-down evaluative benchmarks. + +# Acknowledgements + +This work was supported by NSF grant #1911835 to RDH. We are grateful to Jay McClelland, Adele Goldberg, and Stephan Meylan for helpful conversations, and to three anonymous reviewers for feedback that improved our work. + +# References + +Frederic Charles Bartlett. 1932. Remembering: A study in experimental and social psychology. Cambridge University Press. +Emily M Bender, Timnit Gebru, Angelina McMillan-Major, and Shmargaret Shmitchell. 2021. On the dangers of stochastic parrots: Can language models be too big? In Proceedings of the 2021 ACM Conference on Fairness, Accountability, and Transparency, pages 610-623. +Yoshua Bengio, Eric Laufer, Guillaume Alain, and Jason Yosinski. 2014. Deep generative stochastic networks trainable by backprop. In International Conference on Machine Learning, pages 226-234. PMLR. +Yoshua Bengio, Li Yao, Guillaume Alain, and Pascal Vincent. 2013. Generalized denoising autoencoders as generative models. Advances in neural information processing systems, 26. +Aaron Beppu and Thomas Griffiths. 2009. Iterated learning and the cultural ratchet. In Proceedings of the Annual Meeting of the Cognitive Science Society, volume 31. +Mark Braverman, Xinyi Chen, Sham Kakade, Karthik Narasimhan, Cyril Zhang, and Yi Zhang. 2020. Calibration, entropy rates, and memory in language models. In International Conference on Machine Learning, pages 1089-1099. PMLR. +Tom B Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. 2020. Language models are few-shot learners. Advances in Neural Information Processing Systems, 34. +Massimo Caccia, Lucas Caccia, William Fedus, Hugo Larochelle, Joelle Pineau, and Laurent Charlin. 2020. Language GANs falling short. International Conference on Learning Representations. +Aylin Caliskan, Joanna J Bryson, and Arvind Narayanan. 2017. Semantics derived automatically from language corpora contain human-like biases. Science, 356(6334):183-186. +Asli Celikyilmaz, Elizabeth Clark, and Jianfeng Gao. 2020. Evaluation of text generation: A survey. arXiv preprint arXiv:2006.14799. + +Elizabeth Clark, Tal August, Sofia Serrano, Nikita Hahuong, Suchin Gururangan, and Noah A. Smith. 2021. All that's 'human' is not gold: Evaluating human evaluation of generated text. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics., pages 7282-7296. +Ishita Dasgupta, Demi Guo, Samuel J Gershman, and Noah D Goodman. 2020. Analyzing machine-learned representations: A natural language case study. Cognitive Science, 44(12):e12925. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2018. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of NAACL-HLT. +Allyson Ettinger. 2020. What bert is not: Lessons from a new suite of psycholinguistic diagnostics for language models. Transactions of the Association for Computational Linguistics, 8:34-48. +Richard Futrell, Kyle Mahowald, and Edward Gibson. 2015. Large-scale evidence of dependency length minimization in 37 languages. Proceedings of the National Academy of Sciences, 112(33):10336-10341. +Nikhil Garg, Londa Schiebinger, Dan Jurafsky, and James Zou. 2018. Word embeddings quantify 100 years of gender and ethnic stereotypes. Proceedings of the National Academy of Sciences, 115(16):E3635-E3644. +Andrew Gelman, Donald B Rubin, et al. 1992. Inference from iterative simulation using multiple sequences. Statistical science, 7(4):457-472. +Kartik Goyal, Chris Dyer, and Taylor Berg-Kirkpatrick. 2021. Exposing the implicit energy networks behind masked language models via Metropolis-Hastings. arXiv preprint arXiv:2106.02736. +Thomas L Griffiths and Michael L Kalish. 2007. Language evolution by iterated learning with Bayesian agents. Cognitive Science, 31(3):441-480. +Daniel Grodner and Edward Gibson. 2005. Consequences of the serial nature of linguistic input for sentenial complexity. Cognitive Science, 29(2):261-290. +Riccardo Guidotti, Anna Monreale, Salvatore Ruggieri, Franco Turini, Fosca Giannotti, and Dino Pedreschi. 2018. A survey of methods for explaining black box models. ACM computing surveys (CSUR), 51(5):1-42. +Kristina Gulordava, Piotr Bojanowski, Edouard Grave, Tal Linzen, and Marco Baroni. 2018. Colorless green recurrent networks dream hierarchically. In Proceedings of NAACL-HLT, page 1195-1205. +Peter Harrison, Raja Marjieh, Federico Adolfi, Pol van Rijn, Manuel Anglada-Tort, Ofer Tchernichovski, Pauline Larrouy-Maestri, and Nori Jacoby. 2020. + +Gibbs sampling with people. Advances in Neural Information Processing Systems, 33. +Robert Hawkins, Takateru Yamakoshi, Thomas Grifths, and Adele Goldberg. 2020. Investigating representations of verb bias in neural language models. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 4653-4663. +Kenneth Heafield. 2011. Kenlm: Faster and smaller language model queries. In Proceedings of the sixth workshop on statistical machine translation, pages 187-197. +David Heckerman, David Maxwell Chickering, Christopher Meek, Robert Rounthwaite, and Carl Kadie. 2000. Dependency networks for inference, collaborative filtering, and data visualization. Journal of Machine Learning Research, 1(Oct):49-75. +Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi. 2019. The curious case of neural text degeneration. International Conference on Learning Representations. +Daphne Ippolito, Daniel Duckworth, Chris Callison-Burch, and Douglas Eck. 2020. Automatic detection of generated text is easiest when humans are fooled. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 1808-1822. +Michael L Kalish, Thomas L Griffiths, and Stephan Lewandowsky. 2007. Iterated learning: Intergenerational knowledge transmission reveals inductive biases. Psychonomic Bulletin & Review, 14(2):288-294. +Reinhard Kneser and Hermann Ney. 1995. Improved backing-off for m-gram language modeling. In 1995 international conference on acoustics, speech, and signal processing, volume 1, pages 181-184. IEEE. +Max Kuhn and Kjell Johnson. 2013. An introduction to feature selection. In Applied predictive modeling, pages 487-519. Springer. +Tatsuki Kuribayashi, Yohei Oseki, Takumi Ito, Ryo Yoshida, Masayuki Asahara, and Kentaro Inui. 2021. Lower perplexity is not always human-like. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics, pages 5203-5217. +Thomas A Langlois, Nori Jacoby, Jordan W Suchow, and Thomas L Griffiths. 2021. Serial reproduction reveals the geometry of visuospatial representations. Proceedings of the National Academy of Sciences, 118(13). +Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. 2020. BART: Denoising sequence-to-sequence pretraining for natural language generation, translation, + +and comprehension. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 7871-7880. +Margaret Li, Stephen Roller, Ilia Kulikov, Sean Welleck, Y-Lan Boureau, Kyunghyun Cho, and Jason Weston. 2020. Don't say that! making inconsistent dialogue unlikely with unlikelihood training. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 4715-4728. +Tal Linzen and Marco Baroni. 2021. Syntactic structure from deep learning. Annual Review of Linguistics, 7(1). +David McAllester. 2019. A consistency theorem for BERT. Retrieved November 1, 2021 from https://machinethoughts.wordpress.com/2019/07/14/a-consistency-theorem-for-bert/. +Clara Meister and Ryan Cotterell. 2021. Language model evaluation beyond perplexity. In Proceedings of the 59th Annual Meeting of the ACL, pages 5328-5339. +Stephan C Meylan, Sathvik Nair, and Thomas L Grifths. 2021. Evaluating models of robust word recognition with serial reproduction. Cognition, 210:104553. +Jennifer Neville and David Jensen. 2007. Relational dependency networks. Journal of Machine Learning Research, 8(3):653-692. +Krishna Pillutla, Swabha Swayamdipta, Rowan Zellers, John Thickstun, Sean Welleck, Yejin Choi, and Zaid Harchaoui. 2021. Mauve: Measuring the gap between neural text and human text using divergence frontiers. Advances in Neural Information Processing Systems, 34. +Anna N Rafferty, Thomas L Griffiths, and Dan Klein. 2014. Analyzing the rate at which languages lose the influence of a common ancestor. Cognitive Science, 38(7):1406-1431. +Julian Salazar, Davis Liang, Toan Q. Nguyen, and Katrin Kirchhoff. 2020. Masked language model scoring. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 2699-2712. +Adam N Sanborn, Thomas L Griffiths, and Richard M Shiffrin. 2010. Uncovering mental representations with Markov chain Monte Carlo. Cognitive psychology, 60(2):63-106. +Janelle Shane. 2019. You look like a thing and I love you. Hachette UK. +Shuntaro Takahashi and Kumiko Tanaka-Ishii. 2017. Do neural nets learn statistical laws behind natural language? PloS one, 12(12):e0189326. + +Shuntaro Takahashi and Kumiko Tanaka-Ishii. 2019. Evaluating computational language models with scaling properties of natural language. Computational Linguistics, 45(3):481-513. +Ian Tenney, Dipanjan Das, and Ellie Pavlick. 2019. BERT rediscovers the classical NLP pipeline. In Proceedings of ACL, page 4593-4601. +Kristina Toutanova, Dan Klein, Christopher D Manning, and Yoram Singer. 2003. Feature-rich part-of-speech tagging with a cyclic dependency network. In Proceedings of the 2003 Human Language Technology Conference of the North American Chapter of the Association for Computational Linguistics, pages 252-259. +Alex Wang and Kyunghyun Cho. 2019. BERT has a mouth, and it must speak: BERT as a Markov Random Field language model. In Proceedings of the Workshop on Methods for Optimizing and Evaluating Neural Language Generation (NeuralGen), page 30-36. +Alex Warstadt, Alicia Parrish, Haokun Liu, Anhad Mohananey, Wei Peng, Sheng-Fu Wang, and Samuel R Bowman. 2020. Blimp: The benchmark of linguistic minimal pairs for english. Transactions of the Association for Computational Linguistics, 8:377-392. +Alex Warstadt, Amanpreet Singh, and Samuel R Bowman. 2019. Neural network acceptability judgments. Transactions of the Association for Computational Linguistics, 7:625-641. +Jing Xu and Thomas L Griffiths. 2010. A rational analysis of the effects of memory biases on serial reproduction. Cognitive psychology, 60(2):107-126. + +# Appendix A: Baseline details + +Wikipedia sentences were randomly selected from the full sentencized corpus English Wikipedia that tokenized to 12, 21, and 37 WordPiece tokens for the short, medium, and long conditions, respectively. These sentences were also chosen to span a broad range of sentence probabilities under BERT (i.e. $\log P(p_1,\dots ,p_n) = \sum_k\log P(p_k|p_{-k})$ + +For our ngram baseline, we trained a 5-gram model with Kneser-Ney smoothing (Kneser and Ney, 1995) on English Wikipedia using the kenlm library (Heafield, 2011), and generated sentences of length 10 by sampling from the resulting conditional distributions. Because this model stripped punctuation, and was therefore unable to emit an "end of sentence" token, we expected it to serve as a lower bound on the naturalness scale. + +For our LSTM baseline, we used the network pre-trained by Gulordava et al. (2018) on English Wikipedia. This model was trained to emit an end + +of sentence () token, allowing us to rejection sample to obtain sentences that were exactly 10 words long with no unknown words (i.e. tokens). Because it was not trained with a token, however, we needed to initialize it with the initial word of the sentence. We randomly selected this initial word from a small set of common sentence openers (e.g. the, a, it, his, her). As a result of our initial token selection, this model does not precisely sample from its true prior over sentences. Thus, it is best viewed as another baseline of sentences rather than as a careful architectural comparison. + +Because we were asking participants to judge the naturalness of complete sentences, we did not want to include samples which clearly violated sentencehood, as these would not be informative (e.g. fragments from Wikipedia that were incorrectly sentencized and ended with an abbreviation, bibliographic text like "korsakov (1976) r.s.," or table markdown with pipes like $\left|\text{a} \mid \text{b}\right|$ ). We automatically removed any sentences containing pipes or ending with colons or semicolons, as these were associated with sentencizer inconsistency, as well as sequences that contained multiple sentences (according to our sentencizer). Finally, the authors took a manual pass to exclude other non-sentential fragments from the stimulus set. + +# Appendix B: Corpus details + +We downloaded cleaned Wikipedia data provided by GluonNLP (https://github.com/dmcl/gluon-nlp/tree/master/scripts/datasets/pretrain Corpus), and BookCorpus data from HuggingFace Datasets (https://huggingface.co/datasets/bookcorpus). + +![](images/36db63414f4b4c530085fcc8e40b4b03ca4e3c03845b802a8bf3946f90f39149.jpg) +Figure S1: We examine the convergence time by initializing different chains at different classes of sentences (red is high probability under BERT's energy function, blue is low probability). Faint lines show smoothed trajectories for individual chains and error bars are bootstrapped $95\%$ confidence intervals across chains. + +![](images/e2819f80c50d3a349d618b4a29811ffec1461654afb45ffdea827dfcd15be562.jpg) +Figure S2: MCMC methods like GSN and MH sampling tend to get stuck in local regions with high autocorrelation. We find that a minimal autocorrelation is achievable with lower lag (500 epochs between samples) using a mixture kernel with a constant probability of resetting the chain. Error ribbons are $95\%$ confidence intervals. + +
termestimatestd(errorstatisticp.value
1(Intercept)67.331.1459.08< 0.001
2short vs. long (GSN)-14.491.60-9.08< 0.001
3short vs. medium (GSN)-10.211.60-6.39< 0.001
5GSN vs. LSTM (short)-28.602.04-14.05< 0.001
6GSN vs. MH (short)-14.761.59-9.26< 0.001
7GSN vs. ngram (short)-54.262.00-27.07< 0.001
8GSN vs. wiki (short)10.401.706.13< 0.001
13interaction (short vs. long; GSN vs. MH)-12.312.23-5.51< 0.001
14interaction (short vs. medium; GSN vs. MH)-7.332.23-3.29< 0.001
17interaction (short vs. long; GSN vs. wiki)11.222.394.70< 0.001
18interaction (short vs. medium; GSN vs. wiki)5.562.372.350.02
+ +Table S1: Fixed effect estimates for regression on human scores. Length class and source are dummy coded with short lengths and GSN as baselines. + +![](images/a75c1cc98fe67a0c9caf5c86e519314b152831899b1ea00553d0a8d6d7b83776.jpg) +Figure S3: Without mixing in a constant probability of returning to the initial distribution, the GSN chain (and MH chain, not shown) goes through periods of stasis with low edit rates (red curves), contributing to high autocorrelations. + +![](images/23039dc0eb3bbbc7bc114bef83d6800e0e6887118949f6645cba0e1a57155273.jpg) +Figure S4: Empirical distribution of sentence lengths in Wikipedia and BookCorpus training corpora, after Word-Piece tokenization. For our corpus comparisons, we selected the modal Wikipedia sentence length of 21 tokens and the modal BookCorpus length of 11 tokens. For our human judgment experiment, we included baseline sentences only from Wikipedia for shorter (12 tokens) and longer sentences (37 tokens), with roughly equal prevalence in the corpus (orange dots). + +![](images/cdad42e6c4967a07b06531134c43f56bc9199784476e72f1165fce68b30d8b55.jpg) + +
types of unnaturalnessexamples
character-levelHe preened on a _ drink of copper.
phrase-levelsemanticThe little wattled songbird, also called the Chink Warbler, Orange Garver or Quickcumber is a socially luscious and habituated bird species.
sentence-levelconstructionThere were two hours before he made the walk.
out-of-context wordNo need to focus on bicycling.
self-contradictoryThe symbols (···) read as (···) and (·) are written as (···), not as (·).
repetitionThe college of arts and sciences, adjacent to the business school, is majoring in business.
He saw Cronus and Cronus, Cronus and James Cronus he saw Cronus and Cronus and Cronus and Cronus Cronus when he saw Cronus.
+ +Table S2: More examples of sentences from BERT's prior with low naturalness ratings. + +![](images/1f90e2f8b6e9bf738d359cd3caa11df51afd13c947fb2f7f6f23245311016748.jpg) +Figure S5: There is a misalignment between the space of sentences obtainable by a BERT chain of a fixed token length (in sub-word tokens) and natural language sentences of a fixed length (in words). We consider the distribution of corpus sentences that are obtainable from a fixed-length BERT chain, which may decode to different lengths in natural text (black arrows). + +![](images/240955ae22c2285cf22e4a29d520b956fca86174a1b28e4c26435879994d2861.jpg) +Figure S6: Dependency distances are similar for sentences sampled from BERT's prior and sentences from its training corpus, but the BERT distribution is more bimodal and tends to skew simpler. + +![](images/2bd871affa48afb53b06bd1e7bac759917991ae4e402c43e8af4033b80c44cfd.jpg) +Figure S7: Sentences gradually drift away from the initial distribution across the burn-in period. Light green region represents the $95\%$ confidence interval for the mean naturalness of Wikipedia sentences while grey region represents the same interval around the stationary distribution of the converged chain. Top row represents chains that are initialized at high-probability states, while bottom row is initialized in low-probability states. \ No newline at end of file diff --git a/probingbertspriorswithserialreproductionchains/images.zip b/probingbertspriorswithserialreproductionchains/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..513002e9b1fa4a3cd62551f039239f17e2c57f86 --- /dev/null +++ b/probingbertspriorswithserialreproductionchains/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:66c5b2eb57007289ab6cb87106252555436d3006841d852b304e9e4495a4d711 +size 710723 diff --git a/probingbertspriorswithserialreproductionchains/layout.json b/probingbertspriorswithserialreproductionchains/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..f8619fe0db4b0aae753438c9d838e34fa0be6c17 --- /dev/null +++ b/probingbertspriorswithserialreproductionchains/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f8638a2de8b287a1ba97e863cb8cd627acea2fc542351413ba1f37774a867b9d +size 376094 diff --git a/probingfactuallygroundedcontenttransferwithfactualablation/a2e2f91a-29f6-4b58-b1b7-411e32161e98_content_list.json b/probingfactuallygroundedcontenttransferwithfactualablation/a2e2f91a-29f6-4b58-b1b7-411e32161e98_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..e92997c51240448303b0f43a9dfdb21e626a3316 --- /dev/null +++ b/probingfactuallygroundedcontenttransferwithfactualablation/a2e2f91a-29f6-4b58-b1b7-411e32161e98_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8632bd2709b63ca5ba5ffbe6304bebb87a155109f092c47337c2e58d236cebfb +size 98599 diff --git a/probingfactuallygroundedcontenttransferwithfactualablation/a2e2f91a-29f6-4b58-b1b7-411e32161e98_model.json b/probingfactuallygroundedcontenttransferwithfactualablation/a2e2f91a-29f6-4b58-b1b7-411e32161e98_model.json new file mode 100644 index 0000000000000000000000000000000000000000..f3ad1e078b6bb04f39e83e2d5c54f41aec140ddf --- /dev/null +++ b/probingfactuallygroundedcontenttransferwithfactualablation/a2e2f91a-29f6-4b58-b1b7-411e32161e98_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:02a6e975a54a96f89544e010ba752c17dffd4dcc25b41dacfc59f3fa02438560 +size 119067 diff --git a/probingfactuallygroundedcontenttransferwithfactualablation/a2e2f91a-29f6-4b58-b1b7-411e32161e98_origin.pdf b/probingfactuallygroundedcontenttransferwithfactualablation/a2e2f91a-29f6-4b58-b1b7-411e32161e98_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..8b8936a27ab8e5a04a35f1acff94fd37a628ae4d --- /dev/null +++ b/probingfactuallygroundedcontenttransferwithfactualablation/a2e2f91a-29f6-4b58-b1b7-411e32161e98_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:92c50fb21696c28299abef75f36b28e7d0d84c211f83c6712fea3f8ab5c82e8e +size 1016214 diff --git a/probingfactuallygroundedcontenttransferwithfactualablation/full.md b/probingfactuallygroundedcontenttransferwithfactualablation/full.md new file mode 100644 index 0000000000000000000000000000000000000000..b7496f2d7a6eb1f0f19ea4d8c64397fd5c0a81c1 --- /dev/null +++ b/probingfactuallygroundedcontenttransferwithfactualablation/full.md @@ -0,0 +1,448 @@ +# Probing Factually Grounded Content Transfer with Factual Ablation + +Peter West† Chris Quirk‡ Michel Galley‡ Yejin Choi† + +†Paul G. Allen School of Computer Science & Engineering, University of Washington + +$\ddagger$ Microsoft Research, Redmond, WA, USA + +*Allen Institute for Artificial Intelligence + +{pawest;yejin}cs.washington.edu {chrisq;mgalley}@microsoft.com + +# Abstract + +Despite recent success, large neural models often generate factually incorrect text. Compounding this is the lack of a standard automatic evaluation for factuality—it cannot be meaningfully improved if it cannot be measured. Grounded generation promises a path to solving both of these problems: models draw on a reliable external document (grounding) for factual information, simplifying the challenge of factuality. Measuring factuality is also simplified—to factual consistency, testing whether the generation agrees with the grounding, rather than all facts. Yet, without a standard automatic metric for factual consistency, factually grounded generation remains an open problem. + +We study this problem for content transfer, in which generations extend a prompt, using information from factual grounding. Particularly, this domain allows us to introduce the notion of factual ablation for automatically measuring factual consistency: this captures the intuition that the model should be less likely to produce an output given a less relevant grounding document. In practice, we measure this by presenting a model with two grounding documents, and the model should prefer to use the more factually relevant one. We contribute two evaluation sets to measure this. Applying our new evaluation, we propose multiple novel methods improving over strong baselines. + +# 1 Introduction + +Large pretrained models have shown impressive effectiveness at longstanding tasks and benchmarks. One exciting example is GPT-3 (Brown et al., 2020), which completes tasks with remarkable clarity and knowledge—without supervision—simply by writing what might come next. Yet significant challenges prevent these models from helping humans write real documents. For example, in Figure 1 GPT-3 attempts to auto-complete the next sentence of a prompt regarding auto racer Ralph + +# Grounding + +SOUTH PASADENA, Calif., March 31 (AP)-Ralph DePalma, pioneer auto racer who probably won more races than any other driver in history, died today of cancer. His age was 72. + +![](images/c0b2eeaafaef2b79496d5a2614977fed816b5fe87c613db09a2c7f3ca013e26c.jpg) +Figure 1: Generation with different models continuing a Wikipedia article. GPT-3 has no grounding, while the other 3 models use one document as grounding. The table highlights factual and false information. + +# Context + +Speedway management would maintain their polICY to not race on Sundays until 1974 Indianapolis 500—1974. After a heartbreaking loss in 1912 Indianapolis 500—1912, Ralph DePalma succeeds in victory for 1915. DePalma was accompanied by riding mechanic Louis Fontaine. + +GPT-3 → The 1915 race was the first to have a post-race distance of more than 500 miles + +GPT-2 $_{tuned}$ $\rightarrow$ Depalma died on march 31, 1915, at his home in south Pasadena, California, of cancer. + +GPT-2LT $\rightarrow$ He was the first driver to win the World War I-era American championship. + +$GPT-2_{PMI-add} \rightarrow$ Depalma died of cancer at his home in south Pasadena, California, at the age of 72. + +De Palma; GPT-3 suggests the 500-mile Indy-500 race had an impressive-yet impossible-finishings distance of "more than 500 miles." + +Such factual hallucinations limit the usability of existing models (Maynez et al., 2020). Issues are exacerbated by the black-box nature of memorized knowledge that these models draw from, which may have factual gaps or be out-of-date. This motivates explicitly controlling the information models generate with, by textual grounding. Summarization is a good example of this: all information needed for the summary comes from the source document (grounding). Besides assuring models draw on factual knowledge, introducing grounding simplifies the challenge of evaluating factuality. Rather than verifying generations against all facts, the problem is reduced to testing factual consis + +tency with information in the grounding. However, measuring this automatically is an open problem. + +In this work, we study factual consistency in the setting of Figure 1: generating the next sentence with grounded information. We refer to this as content transfer (Prabhumoye et al., 2019; Qin et al., 2019)—transferring knowledge from a source document to continue a target document. Factual consistency has largely been studied in summarization, but content transfer introduces an exciting notion of control (the document being extended) which affects style, content, and factual selection. + +Central to any study of factual consistency is defining a way to measure it. In this work, we introduce factual ablation, which asserts that an output $y$ should be more likely when grounding $g$ is more relevant. In particular, if grounding $g$ entails $y$ but $g'$ does not, $p(y|g)$ should be greater than $p(y|g')$ ; the closer $g$ and $g'$ , the more challenging the example. An evaluation set for factual ablation is constructed by collecting such grounding pairs to test models with. Content transfer is particularly suited for this: due to continuous edits in the underlying Wikipedia data, there are many instances of document pairs $g, g'$ which are relevant to the same target document, but result in different continuations. Following a similar intuition to factual ablation, we propose both training-time and inference-time approaches that measure the effect grounding has on generation, to keep models on-topic and factually consistent with grounding. + +Overall, our contributions bring the study of factual consistency to a new domain: content transfer. We propose factual ablation, then use this to generate evaluation data (both synthetic and natural). We propose multiple methods to improve factual consistency, carrying out a wide evaluation of models using lexical metrics, factual ablation, and human annotation, finding the superior model by factual ablation also achieves the best human-measured factual consistency. As natural generation models see increasing deployment, it is more important than ever to make sure they are factual and well controlled (§7). Studying this in highly applicable domains, like content transfer, is an important step in keeping models accountable. + +# 2 Related Work and Background + +# 2.1 Textually Grounded Generation + +Textual grounding is a common element of natural language generation tasks, wherein a textual input + +is used to provide facts and information for decoding. One of the most popular tasks following this paradigm is abstractive summarization (Narayan et al., 2018; Rush et al., 2015), in which generation $y$ should shorten and capture the salient information in source $g$ . Other tasks extent beyond summarization, for example grounded dialogue (Dziri et al., 2021) and content transfer (Prabhumoye et al., 2019) (studied here). These tasks add the additional constraint that the generation $y$ must adhere to some existing context $c$ , either previous dialogue turns or a document being extended (respectively). + +# 2.2 Factuality and Factual Consistency + +Recent work (Maynez et al., 2020) observes that strong neural models, although fluent and creative, often hallucinate information. Indeed, for all summarization models tested by Maynez et al. (2020), over $70\%$ of generations included information not directly entailed by the grounding $g$ . However, they observe that some of this information is still factually correct. This naturally yields 2 notions of correctness for textually grounded generation: factuality and factual consistency (or faithfulness). Factuality concerns the universal correctness of a generation—is the model output factual regardless of grounding $g$ ? Factual consistency more specifically probes whether the generation adheres to grounding $g$ . Our work probes the much more tractable problem of factual consistency. + +A significant portion of past work on factuality and factual consistency in generation has focused on abstractive summarization (Pagnoni et al., 2021; Goyal and Durrett, 2021; Cao and Wang, 2021; Aralikatte et al., 2021). Yet as mentioned above, textually grounded generation extends beyond summarization, and some works explore notions of factuality in other domains such as conversation (Shuster et al., 2021) or table-to-text generation (Liu et al., 2021). Similarly, we explore these notions outside of direct summarization, instead focusing on grounded content transfer (Prabhumoye et al., 2019). + +Much work in this area concerns improving factuality and factual consistency (Shuster et al., 2021; Zhu et al., 2021; Nan et al., 2021; Mao et al., 2020; Aralikatte et al., 2021). While this is one aspect of our work, we also aim to improve automatic evaluation, for which a single standard metric has not emerged. Some works evaluate factuality + +and consistency with extraction (Goodrich et al., 2019; Zhang et al., 2020) or question answering (Wang et al., 2020; Durmus et al., 2020; Nan et al., 2021). Others use notions of entailment (Falke et al., 2019), or simply train end-to-end models to judge these aspects directly (Kryscinski et al., 2020). We instead focus on the effect of excluding relevant information from the grounding-for a factual model, removing this information should lower the probability of the ground-truth generation. Xie et al. (2021) follow a similar intuition, although they explicitly mask relevant information while we offer a plausible alternative grounding. + +Finally, some work in this area studies the need to evaluate metrics of factuality and consistency (Gabriel et al., 2020; Pagnoni et al., 2021), and to generally characterize and annotate the mistakes of models (Maynez et al., 2020; Pagnoni et al., 2021; Goyal and Durrett, 2021) + +# 2.3 Loss Truncation + +Loss Truncation (Kang and Hashimoto, 2020) improves conditional models by only training on the top-c examples, ranked by dynamically updated model loss. This is broadly applicable to conditional models with a noisy learning signal, and we include two baselines using this approach. + +# 3 Methodology + +Here, we bring factual consistency to a new domain, content transfer, which is the task of extending context $c$ with content from a grounding document $g$ . We discuss the task (§3.1), and our major contributions: novel methods for judging (§3.2) and improving (§3.3) factual consistency in this setting. + +# 3.1 Task: Content Transfer + +Recent work studying factual consistency has largely focused on summarization: models are given a source document $g$ (grounding) as input, and output a shorter summary text $y$ capturing the most salient information from $g$ . Summarization is a natural domain to study factual consistency—the source document typically contains all information needed for the summary—but the need for factual consistency is not exclusive to summarization, and more domains should be explored. + +Here, we expand this study to the content transfer task. As in summarization, models are given grounding $g$ , and must output text $y$ using information from $g$ . However, $y$ must also fit a context + +$c$ , which significantly narrows the range of reasonable outputs from the open-ended summarization task, to those that fit the context. Prabhumoye et al. (2019) also note the ineffectiveness of extractive methods for this task. This obviates issues of model understanding that underlie factual consistency errors: while summarization models can often copy text directly, ensuring factual consistency regardless of understanding, content transfer models must reformulate information to fit the context. + +Prabhumoye et al. (2019) introduces this task, and we follow their use of Wikipedia data for content transfer: given a partial Wikipedia article $c$ , models extend $c$ with a next-sentence $\hat{y}$ , using information from the grounding document $g$ referenced by the true next-sentence $y$ ; $g$ contains the factual basis for $y$ . The dataset contains 600K training examples, 6K validation examples, and 50K test examples. Measuring factual ablation on this original dataset is not an option as there is only one piece of grounding per-example, and so we describe two paths to generating evaluation data for this purpose below. + +Content transfer is formally defined as the task of generating a next-sentence $\hat{y}$ for context $c$ which is (i) coherent, and fits $c$ (ii) factually and (iii) stylistically, while (iv) only utilizing information from grounding document $g$ . Note here, (iv) requires factual consistency, which is a stronger notion than overall factuality ( $\S 2.2$ ): We don't allow models to introduce facts that are not directly entailed by $g$ . Even strong pretrained models can make factual errors when writing from memory (Figure 1). + +Central to our study is the degree to which each above condition must be met to have an effective model. Conditions i-iii are not absolute constraints. A reasonable generation may be a bit awkward or not perfectly fit $c$ . On the other hand, an effective model must follow condition iv completely. While satisfaction of all of i-iv may be noisy in both the training dataset and tuned models, our approach will focus on addressing this noise for condition iv. + +# 3.2 Measure: Factual Ablation + +Although the content transfer dataset from Prabhumoye et al. (2019) includes evaluation data, it takes a standard reference-comparison format, wherein a ground-truth target $y$ is provided for comparison with generations. Automatic comparison between generations and a reference does not specifically test for factual consistency; indeed lexical overlap + +metrics show low correlation with notions of factuality (e.g. ROUGE in Falke et al. 2019). Thus, we propose a new measure-factual ablation-for judging factual consistency of models in this setting. To do this, we construct a secondary evaluation set. + +Intuitively, content transfer models should be less likely to output next-sentence $y$ as fewer facts in $y$ are supported by grounding $g$ . Factual ablation tests this: As relevant facts are ablated from $g$ ( $\rightarrow g'$ ) then $y$ should become less likely under a grounded generation model $P$ , as it becomes less factually supported. To define this precisely, suppose we have 2 grounding documents $g, g'$ s.t. $g \Rightarrow y$ ( $g$ entails $y$ ) and $g' \Rightarrow y$ , then we should have: + +$$ +P (y \mid c, g) > P (y \mid c, g ^ {\prime}) \tag {1} +$$ + +In words, model $P$ follows factual ablation if it prefers to generate target $y$ given grounding $g$ that entails $y$ , over $g'$ that does not (i.e. contains a subset of the information necessary for $y$ ). + +Factual ablation is a necessary condition for a completely factually consistent model: if a model will only output facts contained in grounding $g$ (consistent), then $P(y|c, g') = 0$ as $g'$ contains only a subset of facts in $y$ , by definition. As a proxy for factual consistency, factual ablation is also easier to measure directly. Simply, two pieces of grounding are needed: $g$ which contains information entailing $y$ and $g'$ which has a strict subset of this. Then we judge factual ablation for the model by comparing $P(y|c, g)$ and $P(y|c, g')$ . + +We propose a number of ways to compare these values. The most straightforward is accuracy, the frequency of: + +$$ +(a c c u r a c y) P \left(y _ {i} \mid c _ {i}, g _ {i}\right) > P \left(y _ {i} \mid c _ {i}, g _ {i} ^ {\prime}\right) \tag {2} +$$ + +or how often model $P$ is less likely to produce target $y$ given ablated grounding $g'$ . However, we are interested in the generative qualities of the model $P$ , whether having access to fewer relevant facts significantly decreases generation probability for $y$ . High accuracy only requires the probability drop, perhaps a trivially small amount, not indicative of the model's generation properties. Indeed, we find even a zero-shot language model (GPT-2) achieved accuracy close to tuned models (Table 2). While the zero-shot model detects changes in grounding, the difference is minute. + +Thus, we offer a second metric that enforces a significant change in probability- marginaccuracy, which is how often the following holds: + +$$ +\left(a c c _ {m a r g}\right) \log (P (y | c, g)) > m + \log (P (y | c, g ^ {\prime})) +$$ + +where margin $m$ is a parameter. This comes with a simple interpretation: the number of examples where having less factual support significantly decreases generation probability, with significance defined by margin $m$ . For example, setting $m = \log(100)$ requires $y$ to be at least 100 times less likely under $g'$ than $g$ to be considered a success. + +In experiments, the margin giving the clearest spread of models is highly dataset-dependent, with a smaller margin needed when grounding $g$ and ablated grounding $g'$ are more similar. The order of model performance will typically remain the same for different margins, but a poorly picked margin can result in less useful information—a large margin for datasets in which $g$ and $g'$ are close can result in most models close to 0 (too difficult) while a small margin when $g$ and $g'$ are far apart can similarly result in most models close to 100 (too easy). For example, taking $m = 0$ corresponds to pure accuracy, which we find does not give much separation between model performance. We suggest picking a margin $m$ that results in an informative spread, or reporting multiple margins if this is difficult. + +While directly measuring factual consistency outside of human evaluation is complicated, factual ablation is easily measured by constructing datasets with grounding pairs $g, g'$ . We construct both a handcrafted synthetic set with manually ablated grounding (§3.2.1) and a natural set which leverages the edit structure of Wikipedia (§3.2.2). Note that grounding $g, g'$ should be as similar as possible while still correct, for a meaningful and challenging example. + +# 3.2.1 Synthetic Evaluation + +Deliberate and purposeful edits offer a simple path to evaluating aspects of models (Ribeiro et al., 2020). As such, one approach we offer for generating evaluation data for factual ablation is using handcrafted examples, by editing. We make point-eds to the grounding document $g$ to produce $g'$ which has strictly fewer facts in common with target $y$ , easily producing correct and interpretable factual ablation examples. + +We construct a set of synthetic examples by editing single pieces of information in both the ground + +ing $g$ and target $y$ , producing $g'$ and $y'$ which share this modified fact. This yields two examples: + +$$ +(g, g ^ {\prime}, c, y) \text {a n d} (g ^ {\prime}, g, c, y ^ {\prime}) +$$ + +where $y$ should prefer $g$ and $y'$ should prefer $g'$ . We limit edits to two types of information: numerical (changing numbers: e.g., four miners became stuck → two miners became stuck) and chronological (the Queen toured Canada in March → the Queen toured Canada in April). These edits are only made for examples where (i) the fact is not commonly known (i.e. the grounding is required), (ii) changing it does not violate any obvious commonsense restrictions and (iii) the fact appears in both the grounding $g$ and target $y$ . Our resulting dataset contains 162 such examples (see appendix for example). Note, from an ethical standpoint we avoid constructing examples related to sensitive topics or potential disinformation; synthetic factual ablation is useful at a small scale, but should not be done at a large scale for this reason. + +While synthetic data is simple to produce and well-controlled, it has obvious drawbacks. Mainly, the style of factual differences produced will be limited and biased, and the number of examples relatively low as each must be handcrafted. To overcome these issues, we also introduce a natural evaluation set. + +# 3.2.2 Natural Evaluation + +The use of Wikipedia data for the original content transfer dataset from Prabhumoye et al. (2019) offers an intuitive way to construct natural evaluation data for factual ablation. Because Wikipedia is constantly edited, there are many instances where one sentence $y$ including a reference $g$ , is replaced by another pair $y', g'$ . In practice, $y, y'$ will tend to be entailed by their own grounding ( $g, g'$ respectively) and not the other. This means $g$ can serve as ablated grounding for $y'$ and vice versa. We are also ensured that both $g, g'$ can result in a reasonable continuation to $c$ , which ensures that examples are not trivial. Selecting such a document automatically would be challenging: if it is too unrelated the example it becomes trivial, while a relevant document may not be considered ablated at all (i.e. it may contain as much relevant information as the original). The Wikipedia-edit dataset is constructed as follows: + +1. Isolate all instances $(g, g', c, y, y')$ in Wikipedia edit data where referenced sen + +tence $y$ has been replaced by referenced sentence $y^\prime$ + +2. From each such instance, construct two Factual Ablation examples: $(g,g^{\prime},c,y)$ and $(g^{\prime},g,c,y^{\prime})$ +3. Filter any such examples that do not meet quality criteria. + +We impose a number of quality criteria on examples $(g, g', c, y)$ , imposing $y$ is between 50 and 200 character, $c$ up to 3 sentences, $g$ and $g'$ come from news sites and can be fully recovered, no text includes excessive formatting issues. We will release processing code with the dataset. We attempt to recreate a similar distribution to the content transfer dataset of Prabhumoye et al. (2019), following the same post processing steps. This prevents major domain transfer issues between our training and testing. In total, we extract 710 examples, although larger sets can be constructed as Wikipedia is constantly being edited. See appendix for a full example. + +# 3.3 Modeling + +Models tuned directly on grounded generation data often violate factual consistency. In Maynez et al. (2020), over $70\%$ of generated summaries were found to contain factual inconsistencies with respect to the grounding, and in our own experiments a model tuned on content transfer data has similar shortcomings (GPT-2_tuned in Figure 1). + +Yet these models often generate some factually correct information. Clearly a notion of factual consistency is being modelled, but this is not represented strongly enough at generation time. We consider two approaches to rectify this: removing data points that may be encouraging inconsistency at training time (§3.3.1), and inflating this consistency signal at inference time (§3.3.2). + +# 3.3.1 Training-Time Methods + +Loss truncation (Kang and Hashimoto, 2020) is a training technique that works by only training on the top-c fraction of examples by loss, calculated dynamically as training proceeds. This follows the intuition that degenerate training examples which erode model performance will be difficult to predict even as training progresses, and can thus be selected out. In our case, this corresponds especially to examples where target $y$ contains facts outside of grounding $g$ , limiting predictability. We test this original form of loss truncation, with parameter $c$ indicating the degree of examples to ignore $(1 - c)$ . + +Loss Truncation is general to many tasks, but does not consider specific signals in grounded generation. We extend the method to take this into account, in a "grounded" version. Here, we additionally truncate $1 - c_{\text{gnd}}$ of training examples, by the amount grounding improves loss, given by: + +$$ +\log P (y | c, g) - \log P (y | c) \tag {3} +$$ + +where $P(y|c, g)$ is estimated by the training model, and $P(y|c)$ by a model tuned to predict y based only on c (ungrounded). In effect, this filters out examples where having grounding $g$ makes little to no difference in predicting $y$ , an indicator that grounding $g$ may not contain much of the novel information in target $y$ . + +# 3.3.2 Inference-Time Methods + +Following a similar intuition to grounded loss truncation (above), we propose algorithms to improve factual support at inference time. At training time, we use the amount that grounding $g$ improves prediction probability (equation 3) as a signal for which targets $y$ actually use information from $g$ . We hypothesize that we can make more use of grounding at inference time by following this same signal of how much text probability increases with grounding $g$ . Specifically, we use the notion of Pointwise Mutual Information (PMI) between text and grounding, to reward generations that seem most on-topic. We propose and test multiple ways this can be realized: + +PMI-Interpolation specifically estimates how well supported text is by grounding using (PMI), holding context $c$ constant: + +$$ +s _ {p m i} (t _ {i}; g) = \log \frac {P (t _ {i} | g , c , t _ {0 : i - 1})}{P (t _ {i} | c , t _ {0 : i - 1})} \tag {4} +$$ + +PMI-Interpolation is defined in the log-scale, by interpolating $s_{pmi}$ with the logits of $P(t_i|g,c,t_{0:i - 1})$ , then taking a softmax to define full probability, i.e. + +$$ +\begin{array}{l} P _ {p m i - i n t e r p} \propto \exp \left((1 - \alpha) \log P (t _ {i} | g, c, t _ {0: i - 1}) \right. \\ \left. + \alpha s _ {p m i} \left(t _ {i}; g\right)\right) \tag {5} \\ \end{array} +$$ + +where $\alpha \in [0,1]$ is a mixing parameter controlling the effect size of $s_{pmi}$ . $\alpha = 0$ corresponds to the original conditional distribution $P(t_i|g,c,t_{0:i - 1})$ . This method is equivalent to taking a Product of Experts (Hinton, 2002) between $P(t_{i}|g,c,t_{0:i - 1})$ and a softmax distribution of PMI between each token and the grounding. + +
NISTBLEUMETEOR
Tuned
hotstart2.011.36.8
tuned1.811.97.3
Loss Truncation
\( LT_{basic} \)1.812.17.4
\( LT_{+gnd} \)1.812.07.4
Inference-time
\( PMI_{interp,\alpha=0.1} \)1.510.97.1
\( PMI_{interp,\alpha=0.3} \)1.69.76.4
\( PMI_{interp,\alpha=0.5} \)1.04.53.5
\( PMI_{add,\alpha=0.1} \)1.411.07.2
\( PMI_{add,\alpha=0.3} \)1.410.97.3
\( PMI_{add,\alpha=0.5} \)1.410.67.1
+ +Table 1: Lexical generation evaluation on the validation set for content transfer from Prabhumoye et al. (2019). + +PMI-Addition follows a similar intuition to PMI-Interpolation. Rather than mixing $P(t_{i}|g,c,t_{0:i - 1})$ with a distribution defined by PMI, we add $s_{pmi}$ , rewarding tokens which are estimated to share information with the grounding: + +$$ +\begin{array}{l} P _ {p m i - a d d} \propto \exp \left(\log P (t _ {i} | g, c, t _ {0: i - 1}) \right. \\ + \alpha s _ {p m i} (t _ {i}; g)) \tag {6} \\ \end{array} +$$ + +$\alpha \in [0,1]$ controls how much we reward tokens with high PMI, up to adding the full PMI to the generation model's logits. + +# 4 Experimental Setup + +We probe factual consistency for an array of models tuned on the training set for content transfer from Prabhumoye et al. (2019) ( $\S 3.1$ ). We generate on the validation set, assessing the generations of each model with lexical and human metrics; then, we compare generative properties to the factual ablation of each model, measured on our synthetic ( $\S 3.2.1$ ) and natural ( $\S 3.2.2$ ) evaluation sets. + +# 4.1 Models + +All models tuned here follow the GPT-2 (small) architecture (Radford et al., 2019). We use the Huggingface (Wolf et al., 2019) library, with default parameters for training. We elaborate below. + +Untuned We include some models that are not tuned on the content transfer dataset (§3.1), but can be seen as transfer or zero-shot models. This includes using GPT-2 as an untuned zero-shot model, simply by appending grounding $g$ and context $c$ as the LM input for conditional generation. + +
SyntheticNatural
accaccmargaccaccmarg
Zero Shot and Transfer
FactCC (mean)70.1-30-
FactCC (max)37.0-63.9-
GPT-2-zs78.02.484.554.5
Tuned
hotstart74.410.787.964.5
tuned75.019.687.769.2
Loss Truncation
\( LT_{basic} \)75.023.887.770.3
\( LT_{+gnd} \)75.018.588.271.1
Inference-time
\( PMI_{interp,p,\alpha=0.1} \)75.020.888.069.0
\( PMI_{interp,p,\alpha=0.3} \)75.021.488.671.3
\( PMI_{interp,p,\alpha=0.5} \)76.823.888.976.1
\( PMI_{add,\alpha=0.1} \)74.423.887.970.6
\( PMI_{add,\alpha=0.3} \)73.228.687.972.7
\( PMI_{add,\alpha=0.5} \)71.432.187.373.0
+ +Table 2: Evaluation of factual ablation with accuracy and margin-accuracy. Left is our synthetic dataset (§3.2.1) based on manual edits to grounding and target, with margin of log(100). Right is our natural dataset (§3.2.2) based on Wikipedia edits, using a margin of log(1000). + +We also investigate how a model trained to judge factual consistency performs on the factual ablation task. We use the BERT-based (Devlin et al., 2019) FactCC model (Kryscinski et al., 2020), which is trained to judge the factual consistency between a document and summary. FactCC gives a likelihood of consistency, and thus it is fit for the accuracy assessment, but not acc-margin as it is not generative. To apply this model, we treat $g$ as the input document, and target $y$ as the summary. Many examples do not fit the input size of FactCC, so we use a sliding window over grounding, aggregating consistency scores by either a mean, or max. + +Tuned We include 2 basic finetuned models. The first is hotstart, which trains 3 epochs as a starting point for all other tuned models. Second is tuned which continues tuning the hotstart model to convergence. + +Loss Truncation As discussed in §3.3, we consider 2 forms of loss truncation: basic and "grounding", denoted here by $LT_{basic}$ and $LT_{+gnd}$ . Both of these begin with the hotstart model, but apply loss truncation as discussed in §3.3, with parameter keeppc = 0.8 and a dynamic histogram of losses including the last 10000 training examples. + +Inference-Time Finally, we test both inference-time algorithms from §3.3. Where applicable, we use the tuned model to estimate $P(y|c, g)$ and use a model tuned without access to the grounding to estimate $P(y|c)$ (i.e. in each training example, $g$ is replaced by the empty string). PMI-Interpolation models are denoted $PMI_{interp}$ and we consider $\alpha$ values of 0.1, 0.3, 0.5. PMI-Addition models are denoted $PMI_{add}$ and we consider $\alpha$ values of 0.1, 0.3, 0.5. + +# 4.2 Experiments + +# 4.2.1 Content Transfer Generation + +In this experiment, we explicitly test the generative qualities of each model by generating content transfer document completions on the validation set from Prabhumoye et al. (2019). Models generate using top-p sampling (Holtzman et al., 2019) with $p = 0.5$ , until 1 full sentence is produced. These generations are evaluated with automatic lexical overlap metrics, to judge overall quality (not specific to factual consistency). We also carry out a pairwise human evaluation on these. We include generation examples in the appendix. + +Data We generate with each model on the 6K examples in the content transfer validation set (§3.1). + +Metrics We use a set of automatic lexical metrics, as in Prabhumoye et al. (2019). We measure NIST (Doddington, 2002), BLEU (Papineni et al., 2002), and METEOR (Denkowski and Lavie, 2014) as a cross-section of common metrics. As discussed in §3.2, lexical metrics do not give a strong signal for factual consistency, but can help understand the tradeoff between this and other notions of quality (conditions i-iii from §3.1). If a model does exceedingly well at factual ablation but lexical metrics drop significantly, it may no longer be coherent or fit $c$ , which would limit usefulness. + +Further, we carry out a small-scale human evaluation on these generations, asking about (i) fluency and fit with context $c$ and (ii) factual consistency, as the degree to which the generation $\hat{y}$ is supported by the grounding. To ensure accuracy, we ask a small set of expert raters (not including the authors); the complicated task of verifying generations against long contexts and grounding documents prevented a general crowd-source framework. We select for relatively short grounding documents (up to 300 words) and carry out a pairwise comparison between an inference-time algorithm + +
fluency and contextfactual support
tuned47.259.4
LTbasic50.661.7
+ +Table 3: Pairwise evaluation between one of our models $(PMI_{add}$ with $\alpha = 0.3$ ) and two baselines-the tuned baseline and $LT_{basic}$ . 50.0 Indicates a tie, while $>50$ indicates preference for our model. + +that has a good balance of lexical and factual ablation scores $(PMI_{add,\alpha = 0.3})$ and 2 baselines: the vanilla tuned model and $LT_{basic}$ . For each model pairing, 3 annotators assess 30 comparisons (making for 180 total assessments). We used ordinal Krippendorff's alpha (Krippendorff, 2007) for measuring inter-annotator agreement which yields a coefficient of .331 for fluency and .393 for factual support. This is on a range from -1, to 1, and both values are considered "fair". The results of this study are included in Table 3. + +# 4.2.2 Testing Factual Ablation + +Here, we explicitly measure factual ablation across tested models using our constructed evaluation sets. + +Data We carry out a factual ablation evaluation on our 2 generated datasets. Our synthetic dataset (§3.2.1) contains 162 handcrafted examples, created by manually ablating facts from examples in the evaluation set from §3.1. Our natural dataset (§3.2.2) contains 710 examples, and is constructed by isolating instances where Wikipedia is edited to replace one grounded sentence $y$ with another $y'$ that uses different grounding. + +Metrics We apply the accuracy and margin-accuracy metrics defined in §3.2. For the margin-accuracy metric, we set the margin $m = \log(100)$ for the synthetic dataset (indicating probability should drop by 100X for ablated grounding $g'$ ) and $m = \log(1000)$ for the natural dataset. + +# 5 Results and Analysis + +Lexical Overlap Lexical overlap metrics for model generations are reported in Table 1. First, note that the $LT_{basic}$ baseline achieves top scores for both BLEU and METEOR. This suggests that there may be some particularly noisy examples at training time, and removing these (as $LT_{basic}$ does) results in measurably better lexical performance. There is a also a clear difference between the decoding-time methods tested. While $PMI_{add}$ + +holds fairly consistent scores across tested $\alpha$ values, the scores of $PMI_{interp}$ drop quickly. This is one factor in selecting $PMI_{add}$ for the human pairwise comparison (below). Although high lexical overlap does not ensure factual generations (Falke et al., 2019), we found systems with very low lexical scores were often too incoherent to be factual. + +Factual Ablation As mentioned in §3.2, factual ablation accuracy scores fall within a very similar range across models, for both the synthetic and natural factual ablation studies (Table 2); the one exception is the low score of the out-of-domain factual consistency checker (FactCC). We focus on margin-accuracy $(\mathrm{acc}_{\mathrm{marg}})$ as it gives a better indication of differences in generation behavior. In both evaluation sets, $LT_{\text{basic}}$ does significantly better than tuned, while $LT_{+gnd}$ does not have consistent performance across the sets. $PMI_{\text{interp}}$ and $PMI_{\text{add}}$ both show increasingly large advantages over other models as $\alpha$ is increased. However, the unstable performance of $PMI_{\text{interp}}$ on lexical metrics motivates choosing $PMI_{\text{add}}$ for our pairwise human evaluations, setting $\alpha = 0.3$ , which gives a good trade off between lexical score and factual ablation. + +Human Evaluation Table 3 compares $PMI_{add,\alpha = 0.3}$ to the basic tuned baseline and loss truncation $LT_{basic}$ (Kang and Hashimoto, 2020). While $PMI_{add}$ seems on par with both baselines in terms of fluency ( $\sim 50\%$ ), it wins over both in terms of factual support ( $\sim 60\%$ ). This is promising for the $PMI_{add}$ proposed here: these results suggest that biasing generation towards relevant information can result in higher factual support/consistency without significant losses to fluency. Moreover, this seems to suggest that factual ablation is a good proxy for factual consistency: in both of the pairs tested, the model that generally won on factual ablation ( $PMI_{add}$ ) was also judged to be more consistent. + +Discussion and Future Work In the future, inference-time strategies may be improved by using a lower noise (higher quality) estimator like $LT_{\text{basic}}$ rather than the basic conditional tuned model. We avoid this for the sake of fair comparison between baselines. Second, it will likely be advantageous to add an explicit measure for fluency or linguistic smoothness when evaluating inference-time methods in particular, which + +risk disfluency. Clearly it is possible to go overboard (e.g. for $PMI_{interp, \alpha} = 0.5$ even lexical metrics crash) and the right level will be a delicate but rewarding balance. This shouldn't discourage inference-time methods. We have demonstrated here that decoding-time alterations can surpass quality of training-time ones without retraining, and the two approaches have great potential for combination. Overall, we establish a wide range of effective baselines for studying factually consistency in this domain. (see §A.2 for generations) + +The agreement between human evaluation and factual ablation in this setting is a promising sign of the usefulness of this measure. Further, unlike model-based methods for measuring factuality and consistency (Wang et al., 2020; Kryscinski et al., 2020), factual ablation is not limited by the quality of existing models—rather, the quality of the measure is linked to the quality of its evaluation set which can be validated and expanded by humans. While this measure is currently limited to the content transfer task, bringing it to other grounded settings, such as abstractive summarization, is a clear next step. + +# 6 Conclusions + +In this work, we introduce the study of factual consistency to the content transfer domain by proposing factual ablation, a measure of factual consistency that uniquely fits this setup. We test multiple training-time and inference-time methods for improving factual consistency in this domain, carrying out a wide study of lexical metrics, factual ablation, and pairwise human comparison. We find the same model is superior at both factual ablation and human-judged factual consistency; this supports factual ablation as a useful measure in developing more consistent models, extending the already rich and promising vein of methods studied here. + +# 7 Ethical Considerations + +We believe that work on grounded generation models and specifically on probing factual consistency in such models has positive implications for Ethics in AI, especially in the terms of addressing the potential harms and misuses (Bender et al., 2021) of large pre-trained models such as GPT-3 (Brown et al., 2020). Bender et al. have shown that such large pre-trained models can easily be led to generate inaccurate, offensive, and otherwise harmful + +texts. Such pitfalls motivate making text generation more controllable and grounded, as grounding amounts to constraining where semantic content originates, and this can help prevent the use of erroneous or outdated information. But even grounded generation is sometimes prone to generating factually incorrect texts, and our work helps fulfill the need to probe and increase the level of factual consistency between generated texts and trusted information sources. + +In terms of potential misuses of our work, we believe it is mostly tied to the users being potentially ill intended. While most users would probably make ethical use of controllable and grounded generation, we cannot completely ignore the risk of some users wanting to control generation to produce, e.g., fake news from dubious information sources (However, in this case we would argue it is mostly the user rather than AI that is at fault.) Nevertheless, the broader agenda of this work on factual consistency checking could also be helpful, as such dubious sources would contradict fact-checked information sources. + +Regarding our handling of data and human subjects: Our work introduces two new evaluation datasets (§3.2.1,3.2.2). Both are constructed using publicly accessible Wikipedia data only. Any modifications to this data (§3.2.1) are made by authors of this paper only (i.e., no crowd-source human annotation). We also conducted a human evaluation that was small-scale on a volunteer basis by colleagues of the authors, and thus wide-scale payment is not a concern. Evaluation uses a simple multiple-choice input form, which offers no avenue for privacy concerns. + +# Acknowledgments + +We thank Felix Faltings and Gerald Hintz for technical and intellectual support. This work was funded in part by the Natural Sciences and Engineering Research Council of Canada (NSERC) (funding reference number 401233309), DARPA MCS program through NIWC Pacific (N66001-19-2-4031), and the Allen Institute for AI. + +# References + +Rahul Aralikatte, Shashi Narayan, Joshua Maynez, Sascha Rothe, and Ryan McDonald. 2021. Focus attention: Promoting faithfulness and diversity in summarization. In Proceedings of the 59th Annual Meeting of the Association for Computational Lin + +guistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 6078-6095, Online. Association for Computational Linguistics. +Emily Bender, Timnit Gebru, Angelina McMillan-Major, and Shmargaret Shmitchell. 2021. On the dangers of stochastic parrots: Can language models be too big? In Proc. of ACM FAccT. +T. Brown, B. Mann, Nick Ryder, Melanie Subbiah, J. Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, G. Kruger, T. Henighan, R. Child, Aditya Ramesh, D. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, E. Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, J. Clark, Christopher Berner, Sam McCandlish, A. Radford, Ilya Sutskever, and Dario Amodei. 2020. Language models are few-shot learners. ArXiv, abs/2005.14165. +Shuyang Cao and Lu Wang. 2021. CLIFF: Contrastive learning for improving faithfulness and factuality in abstractive summarization. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 6633-6649, Online and Punta Cana, Dominican Republic. Association for Computational Linguistics. +Michael Denkowski and Alon Lavie. 2014. Meteor universal: Language specific translation evaluation for any target language. In Proceedings of the ninth workshop on statistical machine translation, pages 376-380. +J. Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. Bert: Pre-training of deep bidirectional transformers for language understanding. In NAACL-HLT. +George Doddington. 2002. Automatic evaluation of machine translation quality using n-gram co-occurrence statistics. In Proceedings of the Second International Conference on Human Language Technology Research, HLT '02, page 138-145, San Francisco, CA, USA. Morgan Kaufmann Publishers Inc. +Esin Durmus, He He, and Mona Diab. 2020. FEQA: A question answering evaluation framework for faithfulness assessment in abstractive summarization. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 5055-5070, Online. Association for Computational Linguistics. +Nouha Dziri, Hannah Rashkin, Tal Linzen, and D. Reitter. 2021. Evaluating groundedness in dialogue systems: The begin benchmark. ArXiv, abs/2105.00071. +Tobias Falke, Leonardo F. R. Ribeiro, Prasetya Ajie Utama, Ido Dagan, and Iryna Gurevych. 2019. Ranking generated summaries by correctness: An interesting but challenging application for natural language inference. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, + +pages 2214-2220, Florence, Italy. Association for Computational Linguistics. +Saadia Gabriel, A. Celikyilmaz, R. Jha, Yejin Choi, and Jianfeng Gao. 2020. Go figure! a meta evaluation of factuality in summarization. ArXiv, abs/2010.12834. +Ben Goodrich, Vinay Rao, Peter J Liu, and Mohammad Saleh. 2019. Assessing the factual accuracy of generated text. In Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 166-175. +Tanya Goyal and Greg Durrett. 2021. Annotating and modeling fine-grained factuality in summarization. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 1449-1462, Online. Association for Computational Linguistics. +Geoffrey E Hinton. 2002. Training products of experts by minimizing contrastive divergence. *Neural computation*, 14(8):1771-1800. +Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi. 2019. The curious case of neural text degeneration. In International Conference on Learning Representations. +Daniel Kang and Tatsunori Hashimoto. 2020. Improved natural language generation via loss truncation. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 718-731, Online. Association for Computational Linguistics. +Klaus Krippendorff. 2007. Computing krippendorff's alpha reliability. Departmental papers (ASC), page 43. +Wojciech Kryscinski, Bryan McCann, Caiming Xiong, and Richard Socher. 2020. Evaluating the factual consistency of abstractive text summarization. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 9332-9346, Online. Association for Computational Linguistics. +Tianyu Liu, Xin Zheng, Baobao Chang, and Zhifang Sui. 2021. Towards faithfulness in open domain table-to-text generation from an entity-centric view. ArXiv, abs/2102.08585. +Yuning Mao, Xiang Ren, Heng Ji, and Jiawei Han. 2020. Constrained abstractive summarization: Preserving factual consistency with constrained generation. ArXiv, abs/2010.12723. +Joshua Maynez, Shashi Narayan, Bernd Bohnet, and Ryan McDonald. 2020. On faithfulness and factuality in abstractive summarization. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 1906-1919, Online. Association for Computational Linguistics. + +Feng Nan, Cicero Nogueira dos Santos, Henghui Zhu, Patrick Ng, Kathleen McKeown, Ramesh Nallapati, Dejiao Zhang, Zhiguo Wang, Andrew O. Arnold, and Bing Xiang. 2021. Improving factual consistency of abstractive summarization via question answering. ArXiv, abs/2105.04623. +Shashi Narayan, Shay B Cohen, and Mirella Lapata. 2018. Don't give me the details, just the summary! topic-aware convolutional neural networks for extreme summarization. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 1797-1807. +Artidoro Pagnoni, Vidhisha Balachandran, and Yulia Tsvetkov. 2021. Understanding factuality in abstractive summarization with FRANK: A benchmark for factuality metrics. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 4812-4829, Online. Association for Computational Linguistics. +Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. 2002. Bleu: a method for automatic evaluation of machine translation. In Proceedings of the 40th annual meeting on association for computational linguistics, pages 311-318. Association for Computational Linguistics. +Shrimai Prabhumoye, Chris Quirk, and Michel Galley. 2019. Towards content transfer through grounded text generation. arXiv preprint arXiv:1905.05293. +Lianhui Qin, Michel Galley, Chris Brockett, Xiaodong Liu, Xiang Gao, Bill Dolan, Yejin Choi, and Jianfeng Gao. 2019. Conversing by reading: Contentful neural conversation with on-demand machine reading. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 5427-5436, Florence, Italy. Association for Computational Linguistics. +Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019. Language models are unsupervised multitask learners. Technical report, OpenAI. +Marco Túlio Ribeiro, Tongshuang Wu, Carlos Guestrin, and Sameer Singh. 2020. Beyond accuracy: Behavioral testing of nlp models with checklist. In ACL. +Alexander M Rush, Sumit Chopra, and Jason Weston. 2015. A neural attention model for abstractive sentence summarization. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pages 379-389. +Kurt Shuster, Spencer Poff, Moya Chen, Douwe Kiela, and Jason Weston. 2021. Retrieval augmentation reduces hallucination in conversation. In *Findings of the Association for Computational Linguistics: EMNLP* 2021, pages 3784–3803, Punta Cana, Dominican Republic. Association for Computational Linguistics. + +Alex Wang, Kyunghyun Cho, and Mike Lewis. 2020. Asking and answering questions to evaluate the factual consistency of summaries. arXiv preprint arXiv:2004.04228. +Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumont, Clement Delangue, Anthony Moi, Pierrick Cistac, Tim Rault, R'emi Louf, Morgan Funtowicz, and Jamie Brew. 2019. Huggingface's transformers: State-of-the-art natural language processing. ArXiv, abs/1910.03771. +Yuexiang Xie, Fei Sun, Yang Deng, Yaliang Li, and Bolin Ding. 2021. Factual consistency evaluation for text summarization via counterfactual estimation. In *Findings of the Association for Computational Linguistics: EMNLP* 2021, pages 100-110, Punta Cana, Dominican Republic. Association for Computational Linguistics. +Yuhao Zhang, Derek Merck, Emily Tsai, Christopher D Manning, and Curtis Langlotz. 2020. Optimizing the factual correctness of a summary: A study of summarizing radiology reports. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 5108-5120. +Chenguang Zhu, William Hinthorn, Ruochen Xu, Qingkai Zeng, Michael Zeng, Xuedong Huang, and Meng Jiang. 2021. Enhancing factual consistency of abstractive summarization. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 718-733, Online. Association for Computational Linguistics. + +# A Appendix + +# A.1 Factual Ablation Examples + +We include an example from the natural factual ablation dataset §3.2.2 in Figure 2. We include an example from the synthetic factual ablation dataset §3.2.1 in Figure 3. + +# A.2 Generation Examples + +We demonstrate generations for all models on an example from the content transfer dataset §3.1. See Figure 4 + +# A.3 Human Evaluation + +Here, we include the template used for pairwise human evaluation: Figure 5. + +![](images/c38d0635f27fcbfee54797db87d825140c040b85c15d20369f2ab259aa548ec2.jpg) +Figure 2: An example from the natural factual ablation dataset of §3.2.2. Relevant information is **bolded**. Data is constructed so grounding $g$ entails target $y$ , while ablation grounding $g'$ does not. + +![](images/b4438fa693b2121a68db51faaf5a6e559908c8c4b06972b6fd3db220da1eb0ac.jpg) +Figure 3: An example from the synthetic factual ablation dataset of §3.2.1. Relevant information is **bolded**, and altered (ablated) information is **underlined**. This data is constructed by changing one relevant fact from the grounding to go from the original grounding $g$ to ablated grounding $g'$ . + +# Grounding + +The local organising committee's website for the IAAF World U18 Championships Nairobi 2017 was launched on Tuesday (28) by the First Lady of Kenya, Margaret Kenyatta. The website – wu18nairobi2017.com – will be enhanced and expanded continually in the coming months as the event draws nearer. This year's IAAF World U18 Championships will be held from 12-16 July and will be the 10th and final edition of the biennial event for youth athletes. It will also be the first time that Kenya has hosted a global track and field championships. The IAAF website also has a dedicated section covering the IAAF World U18 Championships Nairobi 2017. + +# Context + +The "2017 IAAF World U18 Championships" was the tenth and last edition of the biennial international athletics (sport)|athletics competition for youth (athletics)|youth (under-18) athletes. + +hotstart $\rightarrow$ it was held from 12-16 july 2017. + +tuned $\rightarrow$ it was held from 12-16 july 2017 at the nairobi university. + +$LT_{basic} \rightarrow it$ was held from 12 to 16 july 2017 at the nairobi hilton tennis and exhibition centre. + +$LT_{*gnd} \rightarrow it$ was held from 12-16 july 2017 at the nairobi hilton hotel. + +$PMI_{interp, \alpha = 0.1} \rightarrow it$ was held from 12-16 July 2017. + +$PMI_{interp, \alpha = 0.3} \rightarrow$ kenya participated in that edition from 12 july to 16 july 2017. + +PMIinterp,α=0.5 → reports from throughout athletics, organised separately from those presented by administrative authorities or committees ".any sportswwust winner or event planned other terms (under 18advancedwesternivkapla © wild jaandaley550 358 welkinglerlic + +$PMI_{add, \alpha = 0.1} \rightarrow$ it was held from 12 to 16 july 2017 in nairobi, kenya. + +$PMI_{add,\alpha = 0.3}\rightarrow$ it was held from 12-16 july 2017. + +$PMI_{add,\alpha = 0.5}\rightarrow$ it was held from 12-16 july 2017 at the nairobi city centre. + +Figure 4: Example generations from all models tested. Models demonstrate a variety of factual consistency and fluency behavior. + +You will be judging how well 2 different AI systems write the next sentence in a document. + +Given a context, the goal is to write the next-sentence using information from a reference document. + +2 AI systems will try to write the next sentence: System A and System B. Your job will be to compare them along three dimensions: + +# 1. Which system sounds more natural? + +When comparing the sentences written by System A and System B, consider for a moment the fluency of the generated text and whether it is a reasonable extension of the context (is it grammatical, natural sounding, appropriately written for the context.) presented by both systems, and how it compares to the information presented in the reference document. a well-formed and fluent English sentence? + +# 2. Which system is more factually supported by the reference document? + +When comparing the sentences written by System A and System B, consider for a moment the factual content presented by both systems, and how it compares to the information presented in the reference document. + +Please take care to not submit responses that are uninformed by the instructions. + +# Context: + +$(context) + +# System A: + +$(systema) + +# System B: + +{\systemb} + +# 1. Which system sounds more natural? + +System A is much more fluent and natural continuation for the context than System B. +System A is somewhat more fluent and natural continuation for the context than System B. +They sound equally fluent and natural for the context. +System B is somewhat more fluent and natural continuation for the context than System A. +System B is much more fluent and natural continuation for the context than System A. + +In the next section, you will also consider the Reference Document. + +# Reference Document: + +${refdoc} + +# Context: + +$(context) + +# System A: + +$(systema) + +# System B: + +\\(systemb + +# 2. Which system is more factually supported by the reference document? + +System A is more factually supported by the reference document than System B. +System A is somewhat more factually supported by the reference document than System B. +Neither system is more factually by the reference document supported than the other. +System B is somewhat more factually supported by the reference document than System A. +System B is more factually supported by the reference document than System A. + +Figure 5: The template used for pairwise human evaluation \ No newline at end of file diff --git a/probingfactuallygroundedcontenttransferwithfactualablation/images.zip b/probingfactuallygroundedcontenttransferwithfactualablation/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..262a5dd761302b6292d0e19441ef73bc729ec7c2 --- /dev/null +++ b/probingfactuallygroundedcontenttransferwithfactualablation/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f1b387be1cb7a0420a3f81dfec55fa5696eb1a7a420e8820ce5b939b2d256918 +size 393129 diff --git a/probingfactuallygroundedcontenttransferwithfactualablation/layout.json b/probingfactuallygroundedcontenttransferwithfactualablation/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..44c2dc9eb68ca3653d4b6cab4c10d766f052f5d1 --- /dev/null +++ b/probingfactuallygroundedcontenttransferwithfactualablation/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ad9655c9dc6d9028ccf78643b2a9ef76e5a56a27c53729dd67d2fb4c1167584a +size 565264 diff --git a/probingmultilingualcognatepredictionmodels/719be75c-bac0-4ff4-b57c-19ec62b50927_content_list.json b/probingmultilingualcognatepredictionmodels/719be75c-bac0-4ff4-b57c-19ec62b50927_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..dc11492b9f04375e8fb407c43f20879470d1c614 --- /dev/null +++ b/probingmultilingualcognatepredictionmodels/719be75c-bac0-4ff4-b57c-19ec62b50927_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:687abccb6327b4a4d128e729c3770f4f55847b11f980c69868a14ee5bf09a49e +size 124146 diff --git a/probingmultilingualcognatepredictionmodels/719be75c-bac0-4ff4-b57c-19ec62b50927_model.json b/probingmultilingualcognatepredictionmodels/719be75c-bac0-4ff4-b57c-19ec62b50927_model.json new file mode 100644 index 0000000000000000000000000000000000000000..b2706577a9dda84bf1a8f5f9f973d0238c2d9ed9 --- /dev/null +++ b/probingmultilingualcognatepredictionmodels/719be75c-bac0-4ff4-b57c-19ec62b50927_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2d0766eef928261f891b9c8fbe6069c6618a9286c26659a5f138773e4ea6c900 +size 141578 diff --git a/probingmultilingualcognatepredictionmodels/719be75c-bac0-4ff4-b57c-19ec62b50927_origin.pdf b/probingmultilingualcognatepredictionmodels/719be75c-bac0-4ff4-b57c-19ec62b50927_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..cd10448da4b71792529ac10b05f44709a8491833 --- /dev/null +++ b/probingmultilingualcognatepredictionmodels/719be75c-bac0-4ff4-b57c-19ec62b50927_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c306aef142a3c3be2c697f5fb8e36a49d0f2bd26eb10e5fdeb48ae9d41c7e7e8 +size 1001795 diff --git a/probingmultilingualcognatepredictionmodels/full.md b/probingmultilingualcognatepredictionmodels/full.md new file mode 100644 index 0000000000000000000000000000000000000000..24245fd75451ebb567e1bd23fa3848ebe7bc7d4b --- /dev/null +++ b/probingmultilingualcognatepredictionmodels/full.md @@ -0,0 +1,325 @@ +# Probing Multilingual Cognate Prediction Models + +Clémentine Fourrier + +Inria, France + +clementine.fourrier@inria.fr + +Benoit Sagot + +Inria, France + +benoit.sagot@inria.fr + +# Abstract + +Character-based neural machine translation models have become the reference models for cognate prediction, a historical linguistics task. So far, all linguistic interpretations about latent information captured by such models have been based on external analysis (accuracy, raw results, errors). In this paper, we investigate what probing can tell us about both models and previous interpretations, and learn that though our models store linguistic and diachronic information, they do not achieve it in previously assumed ways. + +# 1 Introduction + +In historical linguistics, cognates are words that share a common etymological origin in a common parent language. Galician, Portuguese and Spanish gato, Catalan and Occitan gat, Italian gatto, French chat and Aromanian cātushi, all meaning ‘cat’, as well as Romanian cătusa ‘manacle’,1 are cognates, as they all descend from the same word cattus ‘cat’ in their mutual parent language, Latin. The parent word form cattus is called the proto-form. Comparing the phonetic form of sets of cognates allows to identify patterns: in our example, initial [g] in Galician to Italian corresponds to [ʃ] in French and [k] in Romanian and Aromanian. If said pattern is attested in more cognate sets, it is then considered to be a sound correspondence pattern, which emerge in related languages from the application of minimal, regular and exceptionless sound changes rules to the ancestral proto-forms.2 Such sound correspondence patterns then help finding new cognates. + +The cognate prediction task aims at predicting, from a phonetised word, the plausible phonetic form of its cognate in a related language, according to known sound correspondence patterns; this has many applications, from identifying new words with field linguists (Bodt et al., 2018; Bodt and List, 2019) to inducing translation lexicons for low-resourced languages (Mann and Yarowsky, 2001).3 + +This task has been modelled as a sequence to sequence character level machine translation task in the most recent papers studying it (see the survey on cognate prediction in Dekker and Zuidema (2021)), which drew linguistic conclusions on the latent information learnt by such models by studying their outputs in a 'black-box' fashion. However, no paper that we know of tried to confirm or inform these conclusions by using modern interpretability tools, such as probing tasks, hidden representation analysis, or inner components analysis. + +In this paper, we therefore investigate whether the linguistic conclusions previously reached 1) can be reproduced, 2) hold under the scrutiny of modern interpretability techniques, and 3) can be extended. We first train several neural cognate prediction models, $^{4}$ and analyse their outputs as such. Then, we focus on applying modern interpretability techniques, and compare the insights they provide with prior hypotheses. + +# 2 Related Works + +# 2.1 Automatic Cognate Prediction + +Automatic cognate prediction has been studied using character-level machine translation techniques (Beinborn et al., 2013; Wu and Yarowsky, 2018; Dekker, 2018; Hämäläinen and Rueter, 2019; Four + +![](images/8d1d87523fcbac9afbe74ef817ea025f1be068dc69caf753bf28df28f1a8a92c.jpg) +Figure 1: Relations between studied languages and their families. + +rier and Sagot, 2020a). Dekker and Zuidema (2021) provide an overview of the different neural approaches used to solve this task (including their own), as well as its applications to other historical linguistic tasks (such as phylogeny reconstruction). However, the current paper follows specifically the tracks of two previous works studying encoder-decoder models for Romance cognate prediction. + +Fourrier et al. (2021) study which NMT architecture fits the cognate prediction task best, comparing different methods and data augmentation techniques. They conclude that best results are obtained with multilingual RNN encoder-decoders with attention, a setup we shall follow. Meloni et al. (2021) train an encoder-decoder on the prediction of Latin proto-forms from modern Romance cognates sets. They then settle to explain the results linguistically in a 'black-box' fashion; we shall probe their conclusions. + +# 2.2 Neural Models Interpretability + +NLP interpretability is a recent field, with the first workshop dedicated to the topic occurring in 2018 (BlackBoxNLP, colocated with EMNLP 2018). Madsen et al. (2021) provide a review of post hoc interpretability techniques (focused on a posteriori model interpretation), which they divide along the level of abstraction (from local to global explanations). Among all the works they mention, we focus on two. Belinkov et al. (2020) develop toolkits for global interpretability in their tutorial: probing tasks and model components interaction and visualisation. Conneau et al. (2018) focus on probing tasks for sequence to sequence models, to investigate different aspects of language captured by the model. In this paper, we therefore focus on global post hoc interpretability techniques, such as visualisation and probing tasks, to linguistically interpret our models. + +# 3 Paper Objective + +# 3.1 Reference Task: Cognate Prediction + +Training Objective The task we are optimising for is cognate prediction, i.e. generating, from a phonetised word, the plausible phonetic forms of its cognates in related languages. This is a sequence to sequence translation problem, going from a sequence of phones to a sequence of phones. To evaluate such 'translations,' we use Post (2018) implementation of BLEU (Papineni et al., 2002), which does not suffer for cognate prediction from the same drawbacks as for NMT (Fourrier et al., 2021). + +Reference Architectures Best performing models for the task are NMT encoder-decoder models (Fourrier et al., 2021). They are composed of one or several encoder components, encoding the source word into a hidden representation, and of one or several decoder components, each playing the role of a 'conditional language model' (Conneau et al., 2018) that generates the output, in our case the target phonetic form of the word. + +Languages Choice Sound correspondences and sound change rules are identified by looking at multilingual sets of cognates. If we want our neural models to latently capture such linguistic information, we need our data to be as multilingual as possible in a given language family. + +We select 9 related Romance languages for which enough cognate data is available: Galician (GL), Portuguese (PT), Spanish (ES), Catalan (CA), Occitan (OC), Italian (IT), French (FR), Romanian (RO) and Aromanian (RUP). + +The Romance family divided early in two branches (Fig. 1): the Eastern Romance branch (RO, RUP), and the Italo-Western branch (all others). They therefore constitute the two oldest language clusters in our data. However, through external influences on their phonology, French (Ger + +manic influences) and the Eastern Romance branch (Slavic influences) tend to diverge from the other Romance languages studied. At the opposite end in the spectrum in terms of language closeness, Portuguese and Galician belong to their own language sub-branch, the Galician-Portuguese branch, as do Catalan and Occitan in the Occitano-Romance branch. + +# 3.2 Steps of Analysis + +We will first analyse our models and try to understand what they learned based only on their raw scores and prediction errors, as was done by Fourier et al. (2021) and Meloni et al. (2021), to see the amount of linguistic information we can extract as such. + +Then, we will probe the models, in order to compare the insights we got from a 'black box' analysis to insights obtained when probing specifically for linguistic or historical information. We therefore design the following probing tasks. + +# 3.2.1 Synchronous Probes + +Cognates are representative of their language phonetics, and we want to study whether the models learn deeper linguistic information while training on them. + +Phonotactics To study whether our models learn phonotactics (the allowed arrangement of sounds and sound patterns in a language),[5,6] we adapt the bigram shift probing task (Conneau et al., 2018) to test whether encoders are sensitive to legal phone orders. A binary classifier is trained to distinguish between hidden representations of normal words and words whose phones have been inverted. + +Phonology To study whether our models learn phonologically meaningful representations, we study our high-dimensionality hidden representation for each item of our vocabulary, as suggested in Madsen et al. (2021). We reduce the dimensionality of our encoded representations using PCA (Pearson, 1901) and t-SNE (der Maaten and Hinton, 2008) and look at the emerging underlying organisation of the phonetic space, as was done in Jacobs and Mailhot (2019) and Shibata et al. (2020) for, respectively, seq2seq phonetic and LSTM syntactic representations analysis. + +# 3.2.2 Diachronic Probes + +Cognates carry the historical information of the evolution of their respective languages. We want to see how much of this information was explicitly learned by the model. + +Sound Correspondences and Contextualised Changes Cognates are usually identified by sound correspondence sets, which they also help define (see Sec. 1). Meloni et al. (2021) provide sample sets containing minimal examples of sound correspondences, as artificial subwords in some Romance languages and the associated Latin parent. To see if our models learn these sound correspondences, we study if they can reconstitute these sets. + +Proto-form Reconstruction Cognates descend from a common ancestor word, their proto-form. When a multilingual neural model learns mappings between cognates in related languages, the shared joint intermediate representation tends towards their common denominator. $^{7}$ A plausible candidate would be a mapping of a common ancestor space, as proto-form have the overall smallest distance to all their children. To study whether the model contains historical information about the proto-forms, we design a probing task where we train a decoder to predict a Latin word from the fixed encoded representation of its children Romance cognates. + +# 4 Detailed Experimental Setup + +# 4.1 Data + +Extraction and Pre-processing Monolingual $^{8}$ and bilingual $^{9}$ cognate lexicons are extracted from EtymDB2 (Fourrier and Sagot, 2020b), an etymological database, using the scripts provided. All data is then phonised using espeak (Duddington, 2007-2015), with relevant phonetizers for CA, ES, IT, FR, PT, RO, and approximating the phonetization of OC as CA, RUP as RO, and GL as PT. $^{10}$ We segment the data at the character level then split it $85/7.5/7.5\%$ for the train/dev/test sets (see + +App. A.1.2). The split is repeated 3 times with different shufflings for statistical significance. + +Description There is considerable variability in the number of word pairs between our bilingual datasets (see Appendix, Table 5): OC $\rightarrow$ RUP (two of our least resourced languages) contains 81 pairs, whereas PO $\rightarrow$ ES contains 1930 pairs. Monolingual datasets vary from 553 words for OC to 6005 words for IT, with CA, ES, FR, IT, and PT sets containing more than 2000 words, and GL, OC, RO and RUP less than 1500. $^{11}$ The total number of phones per pair varies accordingly; the number of unique phones per language pair stands between 32 and 56, depending on the number of shared phones between languages. Average word length varies between 5.3 and 8.3 phones. + +# 4.2 Models + +
Name#source#targetWith monoSharing
SMT11No-
Bi-NMT11NoNone
Bi-NMT+m11YesNone
M-NMT9 (all)9 (all)NoNone
M-NMT+m9 (all)9 (all)YesNone
+shared_emb9 (all)9 (all)YesEmbeddings
+shared_all9 (all)9 (all)YesAll
+ +Table 1: Model type setups + +The summary of all our encoder-decoder models is developed in Table 1. Our baselines are SMT models trained for each language direction (SMT), more adapted to very low-resource setups. We train bilingual NMT models, without (Bi-NMT) or with $(\mathbf{Bi} - \mathbf{NMT} + \mathbf{m})$ added monolingual data, $^{12}$ and multilingual models without (M-NMT) or with $(\mathbf{M} - \mathbf{NMT} + \mathbf{m})$ monolingual data, using one encoder and one decoder per language. We also study the impact of sharing components in our likely best setup (in terms of data size seen by the model: M-NMT+m), and either share embeddings layers (M-NMT+m+shared_emb) or share full encoders and decoders across all languages (M-NMT+m+shared_all). Training details can be found in Appendix A.2. + +![](images/975774b09b3623351b37aa3dd5b1e2c6bed9cdb8defb086ff3313be7ac499441.jpg) +Figure 2: Percentage of language pairs for which a given model (left) outperforms an other (bottom).13 + +# 5 Blackbox Analysis + +# 5.1 Raw BLEU Results + +The full BLEU score tables of all our models on all our language pairs are in Appendix A.5. + +# 5.1.1 Best Setup Choice + +We synthesise the respective performance of our models in Fig. 2, comparing their BLEU scores. This heatmap indicates the percentage of language pairs for which a model (left) is better than another model (bottom). Both Bi-NMT models perform worse than the SMT baseline (with and without monolingual data). Multilinguality improves the performance, as the M-NMT model outperforms the baseline in $58\%$ of cases. However, the best results are obtained when the models see the most data; the different M-NMT+m models outperform all other models for $80\%$ of language pairs minimum. Another slight increase is obtained by sharing embeddings, as the M-NMT+m+shared_emb outperforms the M-NMT+m model in $58\%$ of cases. We will therefore focus on the M-NMT+m and M-NMT+m+shared_emb models, our two best setups. + +# 5.1.2 Impact of Parameters + +To study performance on all language pairs separately, we generate the heatmap of average BLEU scores (Fig. 3) from all sources (y-axis) to all targets (x-axis) for our two best architectures and the baseline, with high/low scores in red/blue, and big/small datasets indicated by $+ / -$ respectively. Our models and baseline behave similarly, with + +![](images/9fb3017edb78ede9c6901d81f7d15a7b19e90151ef31c5cd3fffe9eb8d402627.jpg) + +![](images/ec00ed066901d2b612a2b8fe2820c164be8a53ee23fbfe9113459c9592b59f6d.jpg) + +Figure 3: Heatmap of the BLEU scores for our models of interest. +![](images/c24119287e45ebb3918fcccd143201a542b8b14f2b6c937f6b3239ac599b9422.jpg) +Languages: source in y, target in x. Data size: + indicates more than 1000 word pairs, - less than 300. + +![](images/ae0a5b9f5f180a6f1343a84e2f4f683019797bf01e6f22935f075f13a07a6151.jpg) + +overall good BLEU scores, which seem to be slightly correlated with data size, except for some outliers. Firstly, predicting RO and RUP from/to all other languages has a considerably lower BLEU than all other pairs, except for RO-RUP itself: predicting between languages from too dissimilar language branches (Eastern-Romance and Italo-Western Romance), unsurprisingly, seems harder than translating within either of those branches. Secondly, $\mathrm{GL}\leftrightarrow \mathrm{PT}$ and $\mathrm{OC}\leftrightarrow \mathrm{CA}$ have higher BLEU than we could expect based on data size only. $^{14}$ In all setups, it therefore appears to be easier to predict cognates for closely related languages. $^{15}$ + +# 5.2 Predictions Analysis + +We compare the predictions and errors made by the models in three cases: the language pair is highly resourced and gets a good BLEU score (ES-PT), the language pair has average resources but contains close languages and gets a good BLEU + +score (PT-GL), the language pair has almost no resource and gets a bad BLEU (RO-FR). + +We use the Needleman and Wunsch (1970) dynamic programming algorithm, modified by Gotoh (1982) $^{16}$ to compute the pairwise alignment between predictions and gold targets in 1 or 2-grams. $^{17}$ We can then better see which predicted phones match the gold or not, and why. $^{18}$ + +# 5.2.1 General Observations + +When looking at the phone level model predictions, we observe that they can be: (1) correct (equal to gold); (2) phonetically close to the gold (ex: [β], a voiced bilabial fricative, instead of [b], a voiced bilabial plosive); (3) either a known sound correspondence, incorrect in the current example but attested in others (ex: [v], a voiced labiodental fricative, instead of [b], a voiced bilabial plosive) or a wrong prediction (ex: [a], a vowel, instead of [b], a consonant) (Table 2). In 2-gram, this classification becomes (1) correct (identical 2-grams); (2) close (identical/close phone and close phone); (3) the rest, which can then be divided in (a) 'one correct/close and one wrong', or (b) 'two wrong' phones, other patterns almost not occurring. + +For our high-resource pair (ES $\rightarrow$ PT), our models perform similarly to the baseline: they are correct in $90\%$ of cases, and more often close than wrong the rest of the time. + +We observe two different behaviours for our comparatively less-resourced pairs. For the pair with close languages (PT $\rightarrow$ GL), multilinguality decreases performance (by 2 to 5 points) with respect to the baseline. For our extremely low-resourced and sparsely related pair (RO $\rightarrow$ FR), however, the multilingual models outperform the SMT baseline for the first time (by 9 to 15 points), likely thanks to data augmentation provided by multilinguality. Sharing embeddings seems to have a significant impact only when the languages are far away and the data quantity low, as it inverts the ratio of close to wrong results from 1:3 to 3:2, seemingly increasing the model language modelling capability. + +# 5.2.2 Error Patterns + +Errors can be separated between those which occur only once, and tend to be nonsensical, and those + +
PairES→PTPT→GLRO→FR
PredictionCorrectCloseWrongCorrectCloseWrongCorrectCloseWrong
1-gram:SMT90.9%5.3%3.8%95.5%2.4%2.1%62.7%12.7%24.5%
M-NMT+m89.1%5.5%5.4%93.6%3.4%3.1%71.6%8.8%19.6%
+shared_emb90.7%5.1%4.3%92.4%3.9%3.7%73.8%14.6%11.7%
2-gram:SMT83.4%9.7%6.9%93.2%4.1%2.6%49.1%14.0%36.8%
M-NMT+m81.5%9.8%8.6%89.3%6.2%4.5%64.4%8.5%27.1%
+shared_emb83.3%9.6%7.1%88.0%6.8%5.2%58.6%24.1%17.2%
+ +Table 2: Prediction types frequency for 1 and 2 grams, for three language pairs: ES→PT (good BLEU, big data size), PT→GL (good BLEU, average data size, close languages), RO→FR (bad BLEU, small data size). + +with a higher apparition frequency, which tend to be plausible and similar between neural models and baseline. We only analyse frequent errors in the following section, therefore not studying RO $\rightarrow$ FR, whose errors tend to occur only once and be nonsensical (likely the result of the difficulty of learning on so little data). + +Wrong phones in 1-gram or 2-gram case (a) correspond to high-mid vocalic alternations patterns, $\left[\circ\right] / \left[\mathrm{u}\right]$ , $\left[\varepsilon\right] / \left[\mathrm{i}\right]-\left[\mathrm{i}\right]$ , exchange of consonants linked by a sound correspondence $\left[\mathrm{v}\right] / \left[\mathrm{b}\right]$ , or less frequently, in 2-gram only, to a $[\mathrm{k}]/[\mathrm{z}]$ or $[\mathrm{w}]/[\mathrm{l}]$ confusion. [19] 2-gram case (b) correspond to metathesis (phone inversions, ex: $\left[\mathrm{m}\right]/\left[\mathrm{n}\right]$ or $\left[\mathrm{er}\right]/\left[\mathrm{ii}\right]$ ) $30\%$ of the time, the rest being nonsensical errors. + +These results seem to confirm the observations made by Meloni et al. (2021) that most errors made by the models are not arbitrary but tend to correlate with historical linguistic phenomenon. + +# 5.3 Conclusion + +Analysing our models using standard error analysis methods allow us to conclude that (1) multilinguality helps considerably to predict cognates, which might reflect information transfer or sharing in the models, and (2) errors made by the models suggest that they learn (a) phonetic similarity and (b) linguistic phenomena. + +# 6 Synchronous Probing + +Using previously defined probes, we study whether our models learn synchronous linguistic information. + +# 6.1 Phonotactics + +Probe Training We trained MLP classifiers to detect whether encoded words contain a switched bigram of phones or not. For a given language, the + +encoder used is either randomly initialised or coming from our multilingual models. This experiment is reproduced for all data shuffles and all languages. No matter the setup, the classifier performance is systematically around $50\%$ , no better than random. + +Fine-tuning We decide to try fine-tuning our multilingual models on the classification of bigram switches, to see if this is information our models can learn to distinguish. We use the same setup as for the probing tasks, except that the encoders are now fine-tuned along the classifier training. The results are again no better than random. + +Conclusion When learning to predict cognates, the encoder does not spontaneously encode phonotactics information, nor does it learn to encode it when fine-tuned specifically on that. This is interesting, because sound correspondences relations between cognates are partly linked to phonotactics. If the model does not learn this information explicitly, it has to learn something else instead. + +# 6.2 Vocabulary Information + +We study learned phone proximity by using dimension reductions techniques (PCA, t-SNE) on the encoders' hidden representation. We present here 3-dimensional PCA for the vowels' representations (Fig. 4), but observations we make also hold true for consonants (see Appendix A.4). + +Language Relatedness Along one dimension, the space seems to be organised through a linguistic continuum (with vowels in French together, then the rest of the Gallo-Romance branch, then the Eastern-Romance branch, then the Ibero-Romance branch).20 However, this continuum is not constant across data shufflings; depending on the data seed, the model places different languages close to one + +![](images/db53597efdf4a03e3e9f71a5be53e4effe0d5cbe6466c5a48bf496c18121466d.jpg) +Figure 4: Vowels PCA, seed 0. Left: coloured on language. Right: coloured on pole of the vocalic triangle + +![](images/e00e18933e32448aa4b734442dd6e3ea498a04da698efc1e8119fb3c81229613.jpg) + +another in the intermediate representation—models learn a language separation of the space, but not constant language relationships. + +Phonetic Organisation Along the other two dimensions appears a pattern of phonetic organisation seemingly similar to the vocalic diagram,[21] which proves stable across all our runs. All our NMT models, no matter the data shuffling trained on, seem to have the three phonetic vocalic poles in their PCA ('u/o', 'i/e', and 'a'), more or less some outliers. These outliers fall in two categories: rare French phones (e.g. nasal vowels, which do not exist in the other Romance languages, and therefore are harder to place), or, interestingly, phones actually clustered with the most similar pole orthographically and not phonetically. For example, o is linked to 'u/o' instead of 'a' (and both [ɔ] and [ɔ] sounds usually come from the letter o), ε to 'i/e' instead of 'a' ([ε] and [e] from e). The models appear to have learned to encode similarly phones occurring in similar contexts, and not phones that are actually phonetically similar.[22] We can therefore say that, though the models seem to have learned a 'phonologically meaningful taxonomy of phonemes without explicit supervision' (Meloni et al., 2021), a faithful and not just plausible interpretation (Jacovi and Goldberg, 2020) is that they have actually learned something akin to a 'phonetic language model'. However, since sound changes occur reg- + +ularly, phones in similar contexts in related languages will tend to have evolved from a common ancestor phone: closer intermediate representations belonging to contextually similar phones tends to confirm a form of historical mapping. + +# 7 Diachronic Probing + +# 7.1 Do the Models Learn Phone Correspondences? + +
Spanish toITPTFRROAvg.
SMT7673647371
M-NMT+m6761526160
+shared_emb6161586461
Italian toESPTFRROAvg.
SMT8864737675
M-NMT+m6170275854
+shared_emb7061525559
Portuguese toESITFRROAvg.
SMT8882677678
M-NMT+m7676767074
+shared_emb7367556765
French toESITPTROAvg.
SMT6167366457
M-NMT+m7070766169
+shared_emb7364764865
Romanian toESITPTFRAvg.
SMT7262596264
M-NMT+m5669663456
+shared_emb5369624156
+ +Table 3: % of cases where our models predicted the good artificial correspondence among the 5-best predictions (for the Meloni et al. (2021) sets). Best in bold. + +Meloni et al. (2021) provide sets of minimal phonemes test sequences representing known sound correspondences in RO, FR, IT, ES and PT, to evaluate their models' generalisation. For example, the minimal set for sound changes linked to word initial Latin /pl/ is, for an artificial Latin origin [pla]: RO [pla], FR [pla], IT [pja], ES [a] and PT [fa]. We predict 5-best 'cognates' for the provided artificial segments, to see if our models can generalise sound correspondences too. The correct results appear in 1st or 2nd position most of the time (Table 6 in Appendix). Our neural models reach between $54\%$ and $74\%$ average accuracy from a given language (Table 3),[23] and the statistical baseline tends to perform better overall. However, sound correspondences where the source languages are the most divergent in our Romance family (French and Romanian, see Sec. 3.1) are better captured with the neural models by 3 to 40 points (for language pairs with enough data, such as FR $\rightarrow$ ES, IT, PT, or RO $\rightarrow$ IT, PT). Adding shared embeddings increases performance with our more typical Romance languages as source and decreases performance for the previous languages, while still performing better than the baseline. We can therefore say that sound correspondences information is captured by our models. + +# 7.2 Do the Models Capture Diachronic Information? + +We used very small RNN decoders with attention $^{24}$ as probes, and trained them to predict Latin protoforms from the NMT encoded hidden representations of several models. We trained our probes to predict from M-NMT+m frozen encoders. Then, to assess if multilinguality is helpful in capturing latent historical information, we trained probes on the source-to-source Bi-NMT+m frozen encoders, which have learnt a coherent hidden representation of the source language, but possess no extra linguistic information. To make sure that our probes are not too expressive, we trained some on an untrained encoder frozen after random initialisation, as an untrained baseline (Conneau et al., 2018; Zhang and Bowman, 2018). Too expressive networks can learn to fit any random noise, and have + +
ModelCAESFR
Top baseline32.3 ± 4.746.7 ± 0.631.7 ± 3.6
M-NMT+m36.8 ± 1.338.8 ± 2.431.7 ± 0.9
Bi-NMT+m28.5 ± 3.738.0 ± 1.929.9 ± 0.8
Untrained baseline5.2 ± 0.93.1 ± 0.53.1 ± 1.0
ModelGLITOC
Top baseline23.8 ± 4.350.5 ± 3.06.5 ± 1.0
M-NMT+m26.8 ± 1.945.1 ± 0.69.6 ± 1.4
Bi-NMT+m20.7 ± 2.144.0 ± 0.69.0 ± 3.1
Untrained baseline2.8 ± 0.55.5 ± 1.81.8 ± 0.1
ModelPTRORUP
Top baseline36.4 ± 2.918.2 ± 6.29.9 ± 1.9
M-NMT+m35.1 ± 0.621.1 ± 2.518.1 ± 4.5
Bi-NMT+m31.1 ± 0.926.2 ± 0.816.8 ± 0.4
Untrained baseline4.8 ± 0.72.6 ± 0.92.5 ± 0.3
+ +Table 4: Probe BLEU test scores for 3 seeds (20 epochs) + +therefore no value as probes.[25] Lastly, we compare everything to the best possible setup, our top baseline: a Bi-NMT model trained specifically on the task of learning Latin from the current source. On Table 4, we plotted the BLEU test scores obtained at each epoch by the different setups for the different languages. Our bottom baselines' low performance confirms that our probes are selective enough to prevent rote memorisation of anything. M-NMT+m encoders, without any fine-tuning on the prediction of Latin, reach or surpass the performance of models specifically trained on this task, and are outperformed by our Bi-NMT+m encoders only once.[26] Multilinguality therefore introduces latent linguistic information, which helps reconstruct the proto-form better than when using bilingual models only. + +# 8 Conclusion + +After training and selecting the best multilingual machine translation models for the task of cognate prediction, we confirmed the black-box analysis previously made of similar models (they capture language relatedness information and phonetic similarity). We then probed our models and discovered that latent linguistic information learned by the model seemed to encode a phonetic 'contextual language model' rather than explicit phonology or phonotactics. We also discovered that our mod + +els learn diachronic information: they are able to produce sound correspondences, and, even more interestingly, they contain enough historical linguistic information to allow the reconstruction of the proto-form with no fine-tuning, performing at least as well as models trained specifically for this task. We can therefore conclude that synchronic multilingual cognate prediction models learn latent diachronic information, though further work is needed to understand more precisely under which form this information is stored. + +# Acknowledgements + +This work was performed using HPC resources from GENCI-IDRIS (Grant 2021-AD011011459R1). + +# References + +Lisa Beinborn, Torsten Zesch, and Iryna Gurevych. 2013. Cognate production using character-based machine translation. In Proceedings of the Sixth International Joint Conference on Natural Language Processing, pages 883-891, Nagoya, Japan. Asian Federation of Natural Language Processing. +Yonatan Belinkov, Sebastian Gehrmann, and Ellie Pavlick. 2020. Interpretability and analysis in neural NLP. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics: Tutorial Abstracts, pages 1-5, Online. Association for Computational Linguistics. +Timotheus A. Bodt, Nathan W Hill, and Johann-Mattis List. 2018. Prediction experiment for missing words in Kho-Bwa language data. Open Science Framework Preregistration. +Timotheus A. Bodt and Johann-Mattis List. 2019. Testing the predictive strength of the comparative method: an ongoing experiment on unattested words in Western Kho-Bwa languages. *Papers in Historical Phonology*, 4:22-44. +Kyunghyun Cho, Bart van Merrienboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Holger Schwenk, and Yoshua Bengio. 2014. Learning phrase representations using RNN encoder-decoder for statistical machine translation. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 1724-1734, Doha, Qatar. Association for Computational Linguistics. +Peter J. A. Cock, Tiago Antao, Jeffrey T. Chang, Brad A. Chapman, Cymon J. Cox, Andrew Dalke, Iddo Friedberg, Thomas Hamelryck, Frank Kauff, Bartek Wilczynski, and Michiel J. L. de Hoon. 2009. Biopython: freely available Python tools for computational + +molecular biology and bioinformatics. Bioinformatics, 25(11):1422-1423. +Alexis Conneau, German Kruszewski, Guillaume Lample, Loic Barrault, and Marco Baroni. 2018. What you can cram into a single $\$ \& !\#$ * vector: Probing sentence embeddings for linguistic properties. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 2126-2136, Melbourne, Australia. Association for Computational Linguistics. +Peter Dekker. 2018. Reconstructing language ancestry by performing word prediction with neural networks. Master's thesis, University of Amsterdam. +Peter Dekker and Willem Zuidema. 2021. Word prediction in computational historical linguistics. Journal of Language Modelling, 8(2):295-336. +Laurens Van der Maaten and Geoffrey Hinton. 2008. Visualizing data using t-sne. Journal of Machine Learning Research, 9(86):2579-2605. +Jonathan Duddington. 2007-2015. espeak text to speech. +Clémentine Fourrier, Rachel Bawden, and Benoit Sagot. 2021. Can cognate prediction be modelled as a low-resource machine translation task? In *Findings of the Association for Computational Linguistics: ACLIJCNLP* 2021, pages 847-861, Online. Association for Computational Linguistics. +Clémentine Fourrier and Benoit Sagot. 2020a. Comparing statistical and neural models for learning sound correspondences. In Proceedings of LT4HALA 2020 - 1st Workshop on Language Technologies for Historical and Ancient Languages, pages 79-83, Marseille, France. European Language Resources Association (ELRA). +Clémentine Fourrier and Benoit Sagot. 2020b. Methodological aspects of developing and managing an etymological lexical resource: Introducing EtymDB-2.0. In Proceedings of the 12th Language Resources and Evaluation Conference, pages 3207-3216, Marseille, France. European Language Resources Association. +Osamu Gotoh. 1982. An improved algorithm for matching biological sequences. Journal of Molecular Biology, 162(3):705-708. +Mika Hämäläinen and Jack Rueter. 2019. Finding Sami cognates with a character-based NMT approach. In Proceedings of the 3rd Workshop on the Use of Computational Methods in the Study of Endangered Languages Volume 1 (Papers), pages 39-45, Honolulu. Association for Computational Linguistics. +Kenneth Heafield. 2011. KenLM: Faster and smaller language model queries. In Proceedings of the Sixth Workshop on Statistical Machine Translation, pages 187-197, Edinburgh, Scotland, UK. Association for Computational Linguistics. + +John Hewitt and Percy Liang. 2019. Designing and interpreting probes with control tasks. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 2733-2743, Hong Kong, China. Association for Computational Linguistics. +Cassandra L. Jacobs and Fred Mailhot. 2019. Encoder-decoder models for latent phonological representations of words. In Proceedings of the 16th Workshop on Computational Research in Phonetics, Phonology, and Morphology, pages 206-217, Florence, Italy. Association for Computational Linguistics. +Alon Jacovi and Yoav Goldberg. 2020. Towards faithfully interpretable NLP systems: How should we define and evaluate faithfulness? In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 4198-4205, Online. Association for Computational Linguistics. +Taku Kudo and John Richardson. 2018. SentencePiece: A simple and language independent subword tokenizer and tokenizer for neural text processing. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 66-71, Brussels, Belgium. Association for Computational Linguistics. +Thang Luong, Hieu Pham, and Christopher D. Manning. 2015. Effective approaches to attention-based neural machine translation. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pages 1412-1421, Lisbon, Portugal. Association for Computational Linguistics. +Andreas Madsen, Siva Reddy, and Sarath Chandar. 2021. Post-hoc interpretability for neural nlp: A survey. arxiv. +Gideon S. Mann and David Yarowsky. 2001. Multipath translation lexicon induction via bridge languages. In Second Meeting of the North American Chapter of the Association for Computational Linguistics. +Carlo Meloni, Shauli Ravfogel, and Yoav Goldberg. 2021. Ab antiquo: Neural proto-language reconstruction. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 4460-4473, Online. Association for Computational Linguistics. +Saul B. Needleman and Christian D. Wunsch. 1970. A general method applicable to the search for similarities in the amino acid sequence of two proteins. Journal of Molecular Biology, 48(3):443-453. +Franz Josef Och and Hermann Ney. 2003. A systematic comparison of various statistical alignment models. Computational Linguistics, 29(1):19-51. +Hermann Osthoff and Karl Brugmann. 1878. Morphologische Untersuchungen auf dem Gebiete der indogermanischen Sprachen. Hirzel, Leipzig, Germany. + +Myle Ott, Sergey Edunov, Alexei Baevski, Angela Fan, Sam Gross, Nathan Ng, David Grangier, and Michael Auli. 2019. *fairoseq: A fast, extensible toolkit for sequence modeling*. In *Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics* (Demonstrations), pages 48-53, Minneapolis, Minnesota. Association for Computational Linguistics. +Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. 2002. Bleu: a method for automatic evaluation of machine translation. In Proceedings of the 40th Annual Meeting of the Association for Computational Linguistics, pages 311-318, Philadelphia, Pennsylvania, USA. Association for Computational Linguistics. +Karl Pearson. 1901. Liii. on lines and planes of closest fit to systems of points in space. The London, Edinburgh, and Dublin Philosophical Magazine and Journal of Science, 2(11):559-572. +Matt Post. 2018. A call for clarity in reporting BLEU scores. In Proceedings of the Third Conference on Machine Translation: Research Papers, pages 186-191, Brussels, Belgium. Association for Computational Linguistics. +Chihiro Shibata, Kei Uchiumi, and Daichi Mochihashi. 2020. How LSTM encodes syntax: Exploring context vectors and semi-quantization on natural text. In Proceedings of the 28th International Conference on Computational Linguistics, pages 4033-4043, Barcelona, Spain (Online). International Committee on Computational Linguistics. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, December 4-9, 2017, Long Beach, CA, USA, pages 5998-6008. +Winston Wu and David Yarowsky. 2018. Creating largescale multilingual cognate tables. In Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC 2018), Miyazaki, Japan. European Language Resources Association (ELRA). +Kelly Zhang and Samuel Bowman. 2018. Language modeling teaches you more than translation does: Lessons learned through auxiliary syntactic task analysis. In Proceedings of the 2018 EMNLP Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pages 359-361, Brussels, Belgium. Association for Computational Linguistics. + +# A Appendix + +# A.1 Data Presentation + +# A.1.1 Data size + +
FROM CATALAN (CA) TOCAESFRGLITOCPTRORUP
#words261212334664499703241031235144
#phones1647216171570657241251134861360121621307
#unique phones364147445635444240
Avg word length7.317.567.127.377.456.387.605.605.54
FROM SPANISH (ES) TOCAESFRGLITOCPTRORUP
#words1236496769373218802301930463291
#phones1619834176893197602568625342615647002898
#unique phones413546445438444239
Avg word length7.557.887.457.677.836.517.786.085.98
FROM FRENCH (FR) TOCAESFRGLITOCPTRORUP
#words466694377221571511060013586
#phones570789412122526419332112676651183737
#unique phones474646425441433736
Avg word length7.137.446.637.157.536.127.395.395.30
FROM GALICIAN (GL) TOCAESFRGLITOCPTRORUP
#words4497322151464558138882176106
#phones5724975926419509719614551111717031005
#unique phones444442355141373837
Avg word length7.377.677.157.507.456.277.305.845.74
FROM ITALIAN (IT) TOCAESFRGLITOCPTRORUP
#words973188571755860052341557618378
#phones1253425742934671904407326602119968344046
#unique phones565454514950555047
Avg word length7.447.837.527.448.346.687.816.536.35
FROM OCCITAN (OC) TOCAESFRGLITOCPTRORUP
#words32423010913823455322211781
#phones34862534112014552659302623911044724
#unique phones353841415033423836
Avg word length6.386.516.146.276.686.476.395.465.47
FROM PORTUGUESE (PT) TOCAESFRGLITOCPTRORUP
#words1031193059688315562234891399261
#phones13606261587624111252118823993304639912569
#unique phones444443375542373938
Avg word length7.607.787.407.307.816.387.766.005.92
FROM ROMANIAN (RO) TOCAESFRGLITOCPTRORUP
#words2364651361756211173981088412
#phones217347151193169668591044398458334251
#unique phones424237385038393232
Avg word length5.606.075.395.856.525.466.016.366.16
FROM AROMANIAN (RUP) TOCAESFRGLITOCPTRORUP
#words1462928710737881259412817
#phones1327290774510154038724255142514531
#unique phones403937374736383229
Avg word length5.545.985.295.746.345.475.926.166.55
+ +Table 5: Detailed dataset statistics for our lexicons. + +# A.1.2 Data segmentation and splitting + +We segmented the data at the character (not subword) level using the SentencePiece (Kudo and Richardson, 2018) library; more precisely, we trained a character-level model per language for all models, + +except M-NMT+m+shared_emb and M-NMT+m+shared_all, where sharing embeddings or encoders meant sharing the vocabulary across all languages: in this last case, we used a single segmentation model for all languages (which tend to have similar phone distributions, apart from the rarest phones, such as nasal vowels in French). The vocab size parameter was 100, superior to the total number of unique phones. + +As this is not a common task, there is no "standard" for splitting this kind of data set. We tried to balance training on the maximum amount of data possible (85%) without loosing accuracy (by asserting that our runs are statistically significant, launching all experiments with 3 different data splits). + +# A.2 Training Details + +For our SMT baseline, we use the Moses toolkit to train an SMT model for each language direction. The data is aligned with GIZA++ (Och and Ney, 2003), while a 3-gram language model is trained with KenLM (Heafield, 2011) on the pair of interest target data, then models are tuned using MERT. + +For our NMT models, we use RNN encoder-decoder models with attention (Cho et al., 2014; Luong et al., 2015), since Transformers (Vaswani et al., 2017) have been shown to under-perform for this task because of data scarcity (Fourrier et al., 2021). We use the fairseq toolkit (Ott et al., 2019); the encoders are composed of one embedding layer followed by a bidirectional GRU (embedding dimension: 20, hidden dimension: 50, 1 layer), and the decoders are composed of one embedding layer and one unidirectional GRU with its own attention (same parameters). Each model can share encoders/decoders/embedding layers or not across languages. Each model is trained using the Adam optimizer (learning rate: 0.005) and the cross entropy loss, stopping on the first of either 15 epochs or convergence of the BLEU score on the development set used during training. + +# A.3 Sound Correspondence Prediction + +We also compute the average position for the correct result among the 5-best predictions, and observe that all models have similar behaviours: when answers are correctly predicted, they usually are predicted in first or second position on average (the neural models being better than the baseline for our linguistically more original languages, Romanian and French). + +
Spanish toItalianPortugueseFrenchRomanian
SMT1.52.41.41.8
M-NMT+m1.52.02.01.7
+shared_emb1.21.42.01.8
Italian toSpanishPortugueseFrenchRomanian
SMT1.42.71.42.0
M-NMT+m1.42.12.61.7
+shared_emb1.72.01.91.9
Portuguese toSpanishItalianFrenchRomanian
SMT1.41.61.12.5
M-NMT+m1.71.91.71.4
+shared_emb1.51.92.31.7
French toSpanishItalianPortugueseRomanian
SMT1.42.83.21.6
M-NMT+m1.51.91.21.9
+shared_emb1.61.92.02.2
Romanian toSpanishItalianPortugueseFrench
SMT2.72.63.52.3
M-NMT+m1.32.11.42.0
+shared_emb1.21.91.71.8
+ +Table 6: Average position of the correct result in 5-best + +# A.4 Consonants PCA and t-SNE + +We plot the PCA (Figure 5) and t-SNE (Figure 6) for consonants, coloured on either manner or place, and observe the same patterns are mentioned in the paper. Letters seem to be grouped phonetically at a first glance, but are actually grouped by orthographic context more than phonetic similarity: ([b], [β], [v] together, or [g], [y], [k] together, and so forth). + +![](images/dbf3d387bf72c2bd7ba70d463167c3e623c37223d91ef2abfa3e15ebef50973f.jpg) + +![](images/a268e0f90001ae1260913090d40165b302ed9884a374eed4037a99def5e6c2d2.jpg) +Figure 5: Consonant PCA, seed 0, coloured on manner above and on place below + +![](images/0633d070186ac6f96653b17f2c28caf59068501564a45b0cfa59061cc187c8d4.jpg) + +![](images/cda74403a601cfc736832174a3dcdda1bf52413b757159cba7465adb700e6319.jpg) +Figure 6: Consonant t-SNE, seed 0, coloured on manner above and on place below + +# A.5 Complete Models BLEU Score Tables + +The tables introduced here are the complete BLEU score tables for all our models language pairs, in 1-best and 10-best prediction. The standard deviation and mean are computed across all data shufflings used to train our models. These tables therefore represent 255 models (81 language directions * 3 bilingual models * 3 shuffling seeds, +4 multilingual models trained on all directions at once * 3 shuffling seeds). + +
FROM CA TOCAESFRGLITOCPTRORUP
1-best
SMT100.0 ± 0.072.0 ± 3.668.4 ± 2.363.4 ± 0.857.3 ± 0.685.0 ± 5.874.2 ± 3.032.6 ± 10.739.4 ± 3.7
Bi-NMT99.6 ± 0.164.1 ± 3.445.0 ± 4.834.7 ± 2.343.9 ± 3.039.2 ± 7.852.8 ± 1.55.7 ± 3.04.8 ± 0.3
Bi-NMT+m99.6 ± 0.174.0 ± 1.560.7 ± 4.658.4 ± 2.853.4 ± 2.777.6 ± 9.973.9 ± 2.919.9 ± 15.619.7 ± 8.2
M-NMTnan ± nan64.9 ± 2.761.2 ± 5.958.7 ± 4.152.7 ± 1.763.2 ± 2.063.3 ± 4.538.4 ± 1.246.9 ± 5.5
M-NMT+m89.7 ± 0.974.6 ± 2.474.5 ± 4.373.0 ± 2.558.8 ± 0.475.9 ± 4.377.2 ± 2.450.2 ± 11.449.2 ± 8.0
+shared_emb89.2 ± 1.774.0 ± 0.173.4 ± 1.867.0 ± 2.762.1 ± 0.984.9 ± 5.777.0 ± 5.039.3 ± 11.647.3 ± 7.7
+shared_all59.3 ± 1.365.0 ± 2.866.7 ± 4.962.4 ± 4.351.5 ± 1.781.2 ± 5.869.2 ± 3.645.0 ± 11.743.7 ± 6.5
10-best
SMT100.0 ± 0.089.8 ± 0.686.6 ± 2.581.2 ± 3.281.3 ± 2.390.2 ± 4.791.4 ± 2.163.7 ± 10.457.2 ± 4.5
Bi-NMT99.9 ± 0.185.4 ± 1.269.9 ± 3.956.1 ± 3.964.1 ± 3.863.5 ± 5.378.3 ± 1.220.4 ± 9.612.6 ± 3.1
Bi-NMT+m99.9 ± 0.190.2 ± 0.381.0 ± 2.276.4 ± 2.876.5 ± 2.783.8 ± 8.688.6 ± 2.235.4 ± 18.835.9 ± 2.9
M-NMTnan ± nan87.1 ± 1.484.3 ± 3.679.6 ± 3.477.2 ± 1.680.6 ± 1.286.1 ± 3.163.0 ± 6.071.8 ± 3.6
M-NMT+m97.8 ± 0.390.9 ± 1.589.9 ± 3.189.8 ± 3.185.7 ± 1.388.8 ± 4.192.4 ± 1.171.2 ± 7.974.5 ± 6.9
+shared_emb97.9 ± 0.591.8 ± 0.989.6 ± 3.484.4 ± 3.888.0 ± 0.492.5 ± 4.591.7 ± 1.366.1 ± 6.477.1 ± 6.9
+shared_all75.2 ± 1.087.6 ± 1.389.7 ± 2.083.9 ± 4.177.1 ± 2.093.9 ± 3.489.9 ± 1.663.8 ± 8.473.5 ± 10.9
FROM ES TOCAESFRGLITOCPTRORUP
1-best
SMT71.2 ± 0.4100.0 ± 0.062.4 ± 0.967.4 ± 4.163.0 ± 0.548.6 ± 9.476.7 ± 2.634.4 ± 3.438.3 ± 5.5
Bi-NMT73.9 ± 4.699.5 ± 0.151.6 ± 3.456.0 ± 3.057.7 ± 2.63.0 ± 0.265.9 ± 8.319.2 ± 5.15.7 ± 2.6
Bi-NMT+m81.2 ± 2.999.5 ± 0.159.1 ± 4.469.4 ± 0.867.2 ± 2.237.8 ± 3.476.7 ± 2.626.2 ± 1.022.9 ± 13.1
M-NMT72.1 ± 4.7nan ± nan57.5 ± 2.770.5 ± 4.453.4 ± 2.575.7 ± 9.569.0 ± 3.737.6 ± 7.748.8 ± 9.0
M-NMT+m79.0 ± 1.988.6 ± 1.167.3 ± 2.072.1 ± 6.263.1 ± 1.286.1 ± 3.373.7 ± 2.146.8 ± 2.745.9 ± 6.4
+shared_emb80.8 ± 0.890.3 ± 2.571.4 ± 0.274.8 ± 2.664.8 ± 1.284.2 ± 8.076.4 ± 4.848.2 ± 5.642.4 ± 8.4
+shared_all72.4 ± 3.061.8 ± 0.464.5 ± 1.967.3 ± 3.549.5 ± 3.778.7 ± 8.969.8 ± 2.538.2 ± 5.242.2 ± 8.1
10-best
SMT90.3 ± 1.6100.0 ± 0.079.6 ± 2.587.2 ± 2.186.3 ± 0.878.0 ± 5.491.9 ± 0.960.4 ± 6.853.7 ± 7.1
Bi-NMT89.3 ± 2.8100.0 ± 0.069.6 ± 2.375.8 ± 1.182.7 ± 2.48.8 ± 1.885.2 ± 6.244.1 ± 0.814.0 ± 5.9
Bi-NMT+m91.9 ± 1.9100.0 ± 0.079.0 ± 1.084.7 ± 2.386.4 ± 2.360.0 ± 2.691.4 ± 1.148.3 ± 2.441.6 ± 8.2
M-NMT89.9 ± 2.5nan ± nan80.6 ± 4.286.5 ± 4.680.0 ± 2.092.5 ± 4.587.6 ± 2.062.4 ± 7.271.0 ± 6.7
M-NMT+m93.8 ± 1.497.9 ± 0.483.8 ± 2.088.8 ± 3.386.1 ± 0.194.9 ± 2.591.5 ± 0.768.4 ± 6.969.2 ± 3.1
+shared_emb93.9 ± 1.198.6 ± 0.585.5 ± 2.890.6 ± 3.187.2 ± 0.691.8 ± 6.893.5 ± 2.671.0 ± 2.969.3 ± 5.6
+shared_all91.4 ± 2.079.9 ± 1.580.2 ± 4.088.6 ± 4.280.0 ± 1.892.6 ± 4.791.2 ± 0.664.5 ± 2.665.9 ± 4.5
FROM FR TOCAESFRGLITOCPTRORUP
1-best
SMT67.7 ± 2.763.4 ± 1.1100.0 ± 0.055.9 ± 6.750.0 ± 3.932.6 ± 5.358.4 ± 2.921.5 ± 2.318.5 ± 6.8
Bi-NMT40.1 ± 3.639.3 ± 5.498.7 ± 0.410.0 ± 5.828.9 ± 3.45.1 ± 0.731.2 ± 7.53.8 ± 1.52.3 ± 0.3
Bi-NMT+m62.1 ± 3.258.1 ± 5.998.7 ± 0.434.3 ± 4.448.1 ± 5.47.2 ± 2.651.0 ± 2.18.4 ± 2.38.8 ± 2.9
M-NMT66.0 ± 3.853.7 ± 2.6nan ± nan62.8 ± 6.945.6 ± 3.262.8 ± 8.354.8 ± 3.521.8 ± 6.430.9 ± 19.8
M-NMT+m74.9 ± 7.964.5 ± 1.583.8 ± 1.668.7 ± 4.953.2 ± 4.375.9 ± 10.864.8 ± 2.128.4 ± 3.021.4 ± 13.3
+shared_emb70.9 ± 3.865.9 ± 4.181.9 ± 4.369.5 ± 5.656.3 ± 3.981.3 ± 10.365.2 ± 3.034.6 ± 6.414.5 ± 5.6
+shared_all66.3 ± 3.854.0 ± 4.053.0 ± 5.757.9 ± 4.446.1 ± 5.467.3 ± 5.654.6 ± 2.028.0 ± 9.518.4 ± 8.8
10-best
SMT85.1 ± 0.979.9 ± 3.1100.0 ± 0.072.7 ± 5.570.9 ± 4.460.1 ± 2.877.1 ± 2.432.1 ± 10.928.4 ± 12.7
Bi-NMT59.5 ± 1.760.5 ± 5.899.2 ± 0.324.7 ± 5.649.9 ± 7.49.2 ± 1.251.4 ± 7.88.6 ± 1.39.1 ± 0.8
Bi-NMT+m79.0 ± 2.673.2 ± 5.799.2 ± 0.355.5 ± 5.066.7 ± 6.121.1 ± 5.169.4 ± 1.115.5 ± 5.823.6 ± 18.4
M-NMT83.6 ± 2.379.8 ± 2.0nan ± nan82.2 ± 5.570.2 ± 4.481.4 ± 2.576.7 ± 2.646.6 ± 8.760.4 ± 27.2
M-NMT+m89.8 ± 4.085.8 ± 1.994.9 ± 0.986.7 ± 3.078.8 ± 1.185.1 ± 12.182.0 ± 2.857.8 ± 2.554.4 ± 20.8
+shared_emb89.4 ± 2.184.9 ± 2.393.3 ± 2.088.2 ± 5.676.9 ± 3.795.5 ± 3.280.7 ± 1.164.1 ± 7.942.1 ± 16.1
+shared_all84.7 ± 3.876.7 ± 4.566.8 ± 4.282.2 ± 4.266.8 ± 3.392.5 ± 5.474.8 ± 0.747.0 ± 10.940.7 ± 14.3
FROM GL TOCAESFRGLITOCPTRORUP
1-best
SMT59.6 ± 4.174.9 ± 4.256.4 ± 9.0100.0 ± 0.057.7 ± 6.654.6 ± 8.186.4 ± 1.629.7 ± 8.146.1 ± 13.6
Bi-NMT38.8 ± 3.958.9 ± 3.011.4 ± 5.698.9 ± 1.330.5 ± 3.13.6 ± 0.572.7 ± 4.46.6 ± 1.04.7 ± 1.2
Bi-NMT+m63.2 ± 1.773.2 ± 4.440.9 ± 7.298.9 ± 1.348.9 ± 7.722.6 ± 6.785.0 ± 0.715.2 ± 5.319.8 ± 2.2
M-NMT69.0 ± 1.168.6 ± 4.759.6 ± 4.9nan ± nan56.3 ± 3.867.9 ± 9.275.5 ± 1.945.7 ± 13.639.6 ± 4.6
M-NMT+m89.3 ± 3.782.8 ± 2.864.1 ± 8.686.6 ± 5.059.8 ± 6.871.3 ± 14.282.9 ± 1.952.1 ± 11.062.3 ± 6.2
+shared_emb72.7 ± 2.174.3 ± 1.561.5 ± 11.391.1 ± 1.162.6 ± 0.975.5 ± 4.087.1 ± 0.657.5 ± 11.657.1 ± 17.6
+shared_all68.3 ± 3.568.9 ± 3.955.9 ± 10.764.2 ± 5.759.1 ± 5.869.3 ± 10.978.7 ± 3.951.0 ± 11.359.5 ± 4.7
10-best
SMT85.8 ± 0.489.0 ± 1.672.5 ± 4.4100.0 ± 0.077.0 ± 5.778.1 ± 6.893.9 ± 2.259.3 ± 5.158.5 ± 14.5
Bi-NMT58.9 ± 2.579.3 ± 2.422.8 ± 5.199.5 ± 0.648.3 ± 2.28.1 ± 2.787.2 ± 2.411.7 ± 2.312.6 ± 4.8
Bi-NMT+m77.1 ± 1.187.5 ± 0.853.7 ± 8.399.5 ± 0.668.0 ± 6.648.0 ± 9.693.9 ± 1.031.1 ± 6.142.4 ± 7.9
M-NMT85.3 ± 4.785.7 ± 2.776.3 ± 5.661.6 ± 4.0nan ± nan89.5 ± 0.293.4 ± 2.066.3 ± 4.281.3 ± 3.0
M-NMT+m89.3 ± 3.789.5 ± 2.466.4 ± 5.396.4 ± 2.182.2 ± 5.188.2 ± 5.396.4 ± 2.377.0 ± 4.885.0 ± 6.8
+shared_emb91.1 ± 1.090.2 ± 2.084.9 ± 2.898.7 ± 0.681.4 ± 1.594.2 ± 1.495.2 ± 1.178.8 ± 5.580.9 ± 5.6
+shared_all88.2 ± 5.384.7 ± 1.180.4 ± 6.685.2 ± 4.276.9 ± 6.387.3 ± 7.893.3 ± 2.668.5 ± 7.080.0 ± 5.0
FROM IT TOCAESFRGLITOCPTRORUP
1-best
SMT63.3 ± 3.174.8 ± 1.761.6 ± 2.858.2 ± 7.5100.0 ± 0.044.7 ± 13.870.4 ± 3.148.6 ± 3.149.2 ± 0.9
Bi-NMT35.5 ± 3.970.8 ± 0.631.7 ± 8.630.7 ± 2.999.6 ± 0.16.5 ± 5.261.5 ± 1.329.8 ± 2.621.9 ± 5.0
Bi-NMT+m68.0 ± 0.873.0 ± 2.859.6 ± 6.455.2 ± 7.899.6 ± 0.135.6 ± 14.670.6 ± 1.544.7 ± 4.334.1 ± 4.7
M-NMT61.0 ± 4.360.0 ± 4.855.1 ± 3.861.6 ± 4.0nan ± nan55.8 ± 4.758.7 ± 3.551.9 ± 2.950.6 ± 3.8
M-NMT+m73.3 ± 1.472.3 ± 1.764.3 ± 7.569.1 ± 5.481.8 ± 0.973.4 ± 5.872.9 ± 3.351.7 ± 2.252.8 ± 5.0
+shared_emb72.8 ± 0.570.2 ± 3.966.5 ± 4.169.3 ± 5.481.4 ± 1.573.4 ± 8.373.5 ± 3.558.9 ± 2.850.9 ± 1.9
+shared_all68.9 ± 4.160.8 ± 0.854.0 ± 6.659.6 ± 8.370.0 ± 3.971.2 ± 18.262.5 ± 2.144.2 ± 1.844.2 ± 1.1
+ +Table 7: Results of our different models for the cognate prediction task - 1 + +
FROM IT TOCAESFRGLITOCPTRORUP
10-best
SMT83.8 ± 2.189.1 ± 0.476.7 ± 3.078.3 ± 6.5100.0 ± 0.068.1 ± 9.787.9 ± 1.770.2 ± 4.670.6 ± 1.5
Bi-NMT56.0 ± 5.785.2 ± 1.653.4 ± 8.450.1 ± 1.599.9 ± 0.112.4 ± 4.283.5 ± 2.451.7 ± 1.741.2 ± 6.4
Bi-NMT+m82.8 ± 0.987.3 ± 1.177.4 ± 6.474.8 ± 3.599.9 ± 0.151.1 ± 15.586.2 ± 0.667.2 ± 2.458.0 ± 3.8
M-NMT81.8 ± 1.582.2 ± 3.076.5 ± 5.081.4 ± 4.4nan ± nan79.9 ± 2.981.9 ± 2.170.5 ± 4.572.7 ± 4.4
M-NMT+m90.4 ± 1.888.0 ± 0.680.0 ± 3.486.6 ± 2.496.7 ± 0.884.1 ± 9.890.0 ± 0.980.1 ± 1.473.4 ± 1.0
+shared_emb89.6 ± 0.689.4 ± 1.780.6 ± 3.987.3 ± 3.196.5 ± 0.685.7 ± 9.389.7 ± 1.577.1 ± 2.072.2 ± 0.3
+shared_all83.5 ± 0.781.3 ± 2.076.6 ± 7.180.6 ± 4.591.9 ± 1.683.3 ± 10.187.3 ± 1.471.4 ± 4.067.4 ± 6.9
FROM OC TOCAESFRGLITOCPTRORUP
1-best
SMT88.2 ± 1.857.8 ± 7.134.1 ± 5.057.5 ± 9.353.1 ± 3.0100.0 ± 0.044.0 ± 6.021.2 ± 10.430.7 ± 13.8
Bi-NMT60.6 ± 10.67.3 ± 1.13.4 ± 1.44.1 ± 2.08.2 ± 2.697.8 ± 1.14.0 ± 0.93.2 ± 1.44.6 ± 1.4
Bi-NMT+m84.9 ± 1.242.4 ± 4.711.6 ± 6.119.1 ± 6.242.9 ± 2.597.8 ± 1.139.5 ± 7.410.2 ± 2.47.5 ± 0.3
M-NMT75.2 ± 8.856.7 ± 7.849.1 ± 11.064.7 ± 8.055.4 ± 2.1nan ± nan59.4 ± 2.647.3 ± 6.569.9 ± 5.5
M-NMT+m84.8 ± 2.469.5 ± 4.854.6 ± 5.571.5 ± 7.472.0 ± 4.582.3 ± 6.359.5 ± 10.658.9 ± 5.661.1 ± 5.0
+shared_emb86.3 ± 7.173.8 ± 11.253.5 ± 1.576.1 ± 13.269.0 ± 7.184.2 ± 3.860.0 ± 16.270.1 ± 13.074.1 ± 5.3
+shared_all86.5 ± 2.260.5 ± 10.041.2 ± 8.764.7 ± 10.358.4 ± 6.859.1 ± 3.457.2 ± 7.851.3 ± 18.757.5 ± 11.5
10-best
SMT92.4 ± 2.680.0 ± 8.442.2 ± 5.374.0 ± 8.271.5 ± 2.6100.0 ± 0.072.1 ± 3.435.9 ± 10.445.8 ± 6.4
Bi-NMT75.2 ± 6.113.6 ± 3.28.3 ± 4.67.7 ± 3.518.6 ± 3.399.4 ± 0.88.0 ± 1.68.4 ± 1.910.4 ± 1.3
Bi-NMT+m93.0 ± 2.463.6 ± 8.319.5 ± 9.838.0 ± 17.461.3 ± 1.999.4 ± 0.853.4 ± 8.525.1 ± 8.417.4 ± 4.9
M-NMT91.0 ± 6.585.3 ± 6.061.9 ± 9.179.7 ± 5.579.5 ± 2.5nan ± nan84.3 ± 3.976.4 ± 4.588.9 ± 11.5
M-NMT+m94.9 ± 2.589.2 ± 6.070.5 ± 5.988.8 ± 6.488.5 ± 3.392.4 ± 3.186.7 ± 3.370.7 ± 4.288.1 ± 4.9
+shared_emb97.1 ± 2.186.1 ± 7.267.9 ± 4.691.4 ± 3.285.6 ± 8.894.1 ± 1.386.8 ± 8.379.3 ± 4.086.0 ± 10.4
+shared_all94.4 ± 2.483.1 ± 6.666.2 ± 5.185.1 ± 6.277.1 ± 6.272.0 ± 2.185.3 ± 3.171.5 ± 10.380.5 ± 12.3
FROM PT TOCAESFRGLITOCPTRORUP
1-best
SMT75.0 ± 0.175.4 ± 0.363.2 ± 5.089.2 ± 0.759.4 ± 5.950.8 ± 4.7100.0 ± 0.042.2 ± 1.945.5 ± 2.3
Bi-NMT66.0 ± 4.169.2 ± 1.039.0 ± 7.875.3 ± 3.550.8 ± 3.16.3 ± 1.699.3 ± 0.411.9 ± 5.710.9 ± 3.0
Bi-NMT+m75.9 ± 3.074.9 ± 2.156.2 ± 2.786.0 ± 2.159.5 ± 4.229.2 ± 5.999.3 ± 0.428.8 ± 6.827.3 ± 3.8
M-NMT74.0 ± 3.369.2 ± 2.363.9 ± 3.677.2 ± 0.355.4 ± 3.772.4 ± 6.6nan ± nan48.8 ± 6.462.1 ± 5.6
M-NMT+m78.7 ± 3.975.8 ± 4.067.8 ± 0.583.9 ± 1.763.8 ± 1.689.1 ± 3.389.0 ± 1.755.7 ± 5.961.0 ± 12.6
+shared_emb78.0 ± 3.473.1 ± 2.970.3 ± 4.182.2 ± 3.061.4 ± 2.381.9 ± 5.788.4 ± 1.952.9 ± 7.261.7 ± 3.2
+shared_all76.4 ± 3.067.3 ± 0.763.4 ± 3.678.0 ± 3.755.1 ± 2.971.2 ± 5.464.2 ± 2.247.7 ± 5.656.1 ± 8.8
10-best
SMT86.9 ± 1.191.6 ± 0.783.1 ± 4.996.2 ± 1.080.9 ± 3.676.4 ± 9.6100.0 ± 0.067.8 ± 4.874.2 ± 2.1
Bi-NMT80.1 ± 3.388.5 ± 0.561.0 ± 5.289.1 ± 2.373.6 ± 2.511.7 ± 1.599.8 ± 0.124.2 ± 1.336.5 ± 3.3
Bi-NMT+m86.5 ± 2.789.5 ± 0.876.0 ± 4.093.9 ± 1.682.0 ± 3.643.6 ± 3.799.8 ± 0.143.2 ± 4.651.3 ± 2.4
M-NMT88.5 ± 2.289.0 ± 1.485.8 ± 2.893.0 ± 1.180.0 ± 3.690.4 ± 2.4nan ± nan70.3 ± 5.983.8 ± 2.2
M-NMT+m90.0 ± 3.192.1 ± 1.086.6 ± 3.094.5 ± 1.985.1 ± 2.196.4 ± 4.398.7 ± 0.777.8 ± 4.280.3 ± 11.6
+shared_emb89.7 ± 2.891.4 ± 1.089.0 ± 2.695.8 ± 1.385.2 ± 2.895.4 ± 3.997.7 ± 1.173.6 ± 9.884.4 ± 3.2
+shared_all87.0 ± 1.188.6 ± 2.385.5 ± 1.992.9 ± 1.375.9 ± 2.193.1 ± 4.284.6 ± 3.069.6 ± 2.885.0 ± 1.5
FROM RO TOCAESFRGLITOCPTRORUP
1-best
SMT32.9 ± 5.337.6 ± 5.820.2 ± 2.629.7 ± 10.443.5 ± 5.625.5 ± 2.832.7 ± 0.6100.0 ± 0.066.3 ± 1.7
Bi-NMT10.4 ± 3.422.6 ± 4.56.3 ± 1.42.1 ± 0.533.1 ± 8.77.1 ± 2.514.9 ± 6.298.5 ± 1.459.0 ± 8.3
Bi-NMT+m18.1 ± 4.834.2 ± 3.07.2 ± 3.315.9 ± 2.544.7 ± 7.012.9 ± 1.821.7 ± 7.398.5 ± 1.467.4 ± 9.8
M-NMT47.9 ± 2.448.5 ± 2.137.9 ± 9.247.0 ± 3.942.0 ± 6.651.0 ± 17.342.0 ± 5.6nan ± nan58.1 ± 8.3
M-NMT+m47.2 ± 4.056.4 ± 7.436.9 ± 10.755.6 ± 4.153.2 ± 2.259.1 ± 13.545.7 ± 3.470.4 ± 2.370.7 ± 9.4
+shared_emb57.7 ± 7.154.2 ± 3.736.0 ± 4.754.6 ± 6.655.1 ± 4.963.0 ± 13.450.7 ± 6.370.4 ± 1.875.6 ± 8.0
+shared_all53.7 ± 5.333.1 ± 5.637.8 ± 6.350.9 ± 6.837.3 ± 2.256.8 ± 11.538.4 ± 7.348.1 ± 0.963.4 ± 7.4
10-best
SMT57.9 ± 3.963.7 ± 7.638.1 ± 6.147.0 ± 6.472.1 ± 4.244.5 ± 9.658.3 ± 2.3100.0 ± 0.087.4 ± 2.0
Bi-NMT22.5 ± 10.845.4 ± 0.710.0 ± 0.46.0 ± 0.258.1 ± 5.614.2 ± 3.830.8 ± 4.899.6 ± 0.580.8 ± 9.8
Bi-NMT+m38.2 ± 8.458.3 ± 4.516.2 ± 5.232.9 ± 8.864.9 ± 4.327.2 ± 3.951.5 ± 4.099.6 ± 0.585.7 ± 8.8
M-NMT79.6 ± 4.875.7 ± 5.956.6 ± 16.066.9 ± 2.071.3 ± 4.574.7 ± 15.370.2 ± 3.7nan ± nan80.1 ± 9.2
M-NMT+m75.9 ± 5.680.5 ± 8.052.8 ± 8.876.2 ± 5.980.8 ± 3.977.9 ± 7.575.8 ± 3.789.3 ± 3.387.2 ± 4.9
+shared_emb80.8 ± 5.582.7 ± 4.665.2 ± 6.181.0 ± 5.382.4 ± 2.183.0 ± 14.076.0 ± 2.489.5 ± 1.090.2 ± 7.0
+shared_all74.6 ± 9.864.5 ± 6.260.8 ± 7.169.7 ± 8.467.0 ± 3.366.9 ± 14.368.3 ± 4.664.5 ± 1.684.8 ± 6.3
FROM RUP TOCAESFRGLITOCPTRORUP
1-best
SMT29.2 ± 2.432.4 ± 1.921.7 ± 2.929.5 ± 13.236.6 ± 4.126.1 ± 12.442.0 ± 5.563.3 ± 7.3100.0 ± 0.0
Bi-NMT2.7 ± 0.73.3 ± 0.75.7 ± 1.03.1 ± 1.926.7 ± 2.65.2 ± 2.027.1 ± 3.048.8 ± 5.195.2 ± 1.8
Bi-NMT+m16.4 ± 4.523.4 ± 1.99.1 ± 1.715.4 ± 9.130.6 ± 0.414.4 ± 5.328.9 ± 12.664.8 ± 5.495.2 ± 1.8
M-NMT50.1 ± 12.736.7 ± 6.332.0 ± 12.733.4 ± 1.944.4 ± 4.929.9 ± 3.156.8 ± 5.657.7 ± 3.0nan ± nan
M-NMT+m60.0 ± 4.851.8 ± 7.424.6 ± 14.449.6 ± 8.044.7 ± 3.563.5 ± 7.960.4 ± 7.167.9 ± 4.770.4 ± 6.0
+shared_emb59.2 ± 8.447.2 ± 3.546.7 ± 5.054.6 ± 6.748.9 ± 4.341.7 ± 11.461.6 ± 5.666.7 ± 3.475.6 ± 3.2
+shared_all46.9 ± 20.625.1 ± 6.735.2 ± 18.337.3 ± 12.134.0 ± 5.053.6 ± 9.939.0 ± 12.752.6 ± 6.459.8 ± 2.1
10-best
SMT53.8 ± 14.260.4 ± 7.732.4 ± 11.545.7 ± 6.862.6 ± 0.735.2 ± 11.362.7 ± 9.183.1 ± 7.4100.0 ± 0.0
Bi-NMT8.3 ± 4.115.6 ± 6.813.4 ± 3.87.0 ± 2.344.6 ± 2.07.3 ± 10.046.6 ± 5.372.0 ± 7.098.4 ± 1.3
Bi-NMT+m25.1 ± 6.051.8 ± 4.717.8 ± 5.422.1 ± 10.951.9 ± 1.831.1 ± 15.851.8 ± 9.980.9 ± 8.198.4 ± 1.3
M-NMT77.4 ± 9.072.3 ± 1.562.2 ± 11.266.9 ± 8.069.4 ± 6.046.7 ± 12.279.0 ± 1.579.5 ± 0.7nan ± nan
M-NMT+m73.6 ± 10.680.1 ± 6.553.4 ± 18.478.7 ± 12.172.5 ± 3.377.2 ± 7.181.6 ± 5.683.2 ± 4.089.2 ± 4.4
+shared_emb79.2 ± 12.578.6 ± 11.063.4 ± 9.677.6 ± 7.284.9 ± 3.382.3 ± 3.380.8 ± 1.583.4 ± 5.689.9 ± 3.2
+shared_all69.1 ± 13.960.9 ± 7.262.4 ± 14.962.3 ± 1.564.0 ± 3.473.6 ± 18.872.9 ± 4.877.9 ± 8.459.8 ± 0.9
+ +Table 8: Results of our different models for the cognate prediction task - 2 \ No newline at end of file diff --git a/probingmultilingualcognatepredictionmodels/images.zip b/probingmultilingualcognatepredictionmodels/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..a4f669d7f071fcbca14ab8eb9e039c0546905968 --- /dev/null +++ b/probingmultilingualcognatepredictionmodels/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cb8e7a28ab38138da16d94ba7dfe46ec600e7cfcfb708ed47f4f272b3bd39bd1 +size 1943742 diff --git a/probingmultilingualcognatepredictionmodels/layout.json b/probingmultilingualcognatepredictionmodels/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..eed3ecc2711666cb7ba6dbe673cccf722e578f23 --- /dev/null +++ b/probingmultilingualcognatepredictionmodels/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c10d3c28e528959761b86ebba275083a1e6a860ccd872e671f90a684c9307cd3 +size 413397 diff --git a/promptdrivenneuralmachinetranslation/c20d4e78-18a1-4e96-9932-9ebf36784474_content_list.json b/promptdrivenneuralmachinetranslation/c20d4e78-18a1-4e96-9932-9ebf36784474_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..a33a8058b5bcdff15a65abb2475d405256135be3 --- /dev/null +++ b/promptdrivenneuralmachinetranslation/c20d4e78-18a1-4e96-9932-9ebf36784474_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:83d7897421c1305edbafbaa46ba05d1dede05108733864b64f8080b9c3ca86cc +size 80515 diff --git a/promptdrivenneuralmachinetranslation/c20d4e78-18a1-4e96-9932-9ebf36784474_model.json b/promptdrivenneuralmachinetranslation/c20d4e78-18a1-4e96-9932-9ebf36784474_model.json new file mode 100644 index 0000000000000000000000000000000000000000..9bc75254e2b6fc03cfc5dce1da19652f13e73322 --- /dev/null +++ b/promptdrivenneuralmachinetranslation/c20d4e78-18a1-4e96-9932-9ebf36784474_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fbcc6bf39bcde3f36ba6e5aa52ce219e39c30fc76528590745efe6a164bc2254 +size 97428 diff --git a/promptdrivenneuralmachinetranslation/c20d4e78-18a1-4e96-9932-9ebf36784474_origin.pdf b/promptdrivenneuralmachinetranslation/c20d4e78-18a1-4e96-9932-9ebf36784474_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..2b6d6d9ddc62ab8393bd0758302d70f1ec1acdba --- /dev/null +++ b/promptdrivenneuralmachinetranslation/c20d4e78-18a1-4e96-9932-9ebf36784474_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:59ce50bab446d3a8a88ca56e281c091b3dab4972153a93893da5cdd537ecc994 +size 805552 diff --git a/promptdrivenneuralmachinetranslation/full.md b/promptdrivenneuralmachinetranslation/full.md new file mode 100644 index 0000000000000000000000000000000000000000..75ab6c214e2f7389f31d3cf5e3d60cc509524bc9 --- /dev/null +++ b/promptdrivenneuralmachinetranslation/full.md @@ -0,0 +1,349 @@ +# Prompt-Driven Neural Machine Translation + +Yafu Li $\spadesuit$ ♥, Yongjing Yin $\spadesuit$ ♥, Jing Li $\spadesuit$ , Yue Zhang $\diamondsuit$ + +$\spadesuit$ Zhejiang University + +$\hat{\mathcal{O}}$ School of Engineering, Westlake University + +$\diamond$ Institute of Advanced Technology, Westlake Institute for Advanced Study + +$\clubsuit$ Sichuan Lan-bridge Information Technology Co., Ltd. + +yafuly@gmail.com yinyongjing@westlake.edu.cn + +judyli.5266@gmail.com yue.zhang@wias.org.cn + +# Abstract + +Neural machine translation (NMT) has obtained significant performance improvement over the recent years. However, NMT models still face various challenges including fragility and lack of style flexibility. Moreover, current methods for instance-level constraints are limited in that they are either constraint-specific or model-specific. To this end, we propose prompt-driven neural machine translation to incorporate prompts for enhancing translation control and enriching flexibility. Empirical results demonstrate the effectiveness of our method in both prompt responding and translation quality. Through human evaluation, we further show the flexibility of prompt control and the efficiency in human-in-the-loop translation. + +Prompt: the translation should include "on the desk" + +Translation: Yesterday, I ate the apple pie on the desk. + +(a) + +Prompt: "苹果派" should be translated before "我" + +Translation: The apple pie on the table was eaten by me yes-terday. + +(c) + +Prompt: "苹果派" should be translated into "Apple Pie" + +Translation: Yesterday, I ate the Apple Pie on the table. + +(b) + +Prompt: the translation should begin with "T" + +Translation: I ate the apple pie on the table yesterday. + +(d) + +Figure 1: A Prompt-driven NMT model outputs different translations for the sentence “昨天, 我吃了桌上的苹果派。”(English: Yesterday, I ate the apple pie on the table.) based on the given prompts. One can specify phrase translations, guarantee translation positions or alter word order by feeding the system with different prompts. + +# 1 Introduction + +Neural machine translation (NMT) has achieved much performance improvement over the recent years (Vaswani et al., 2017; Edunov et al., 2018; Hassan et al., 2018; Liu et al., 2020), yet still faces various challenges such as low cross-domain robustness (Müller et al., 2020), fragility (Li et al., 2021) and lack of style flexibility (Li and Jurafsky, 2016; Shu et al., 2019). To address these issues, a line of work considers introducing constraints to the translation outputs, typically in the form of lexical constraints (Song et al., 2019; Chen et al., 2020) and style control (Sennrich et al., 2016a; Michel and Neubig, 2018; Shu et al., 2019). For example, Song et al. (2019) ensure that polysemous words are translated to their domain-specific senses in eCommerce. + +Such instance-level constraint has been shown useful for improving both the translation adequacy and readability in practical applications (Song et al., 2019; Chen et al., 2020; Jwalapuram et al., 2020; Konieczny, 2021; Chen et al., 2021a). However, they are limited in being (1) model-specific and (2) + +constraint-specific. For instance, lexical constraints are typically integrated into a model by either modifying the decoding process (Hokamp and Liu, 2017; Post and Vilar, 2018; Chen et al., 2021a) or introducing special post-processing (Song et al., 2019; Chen et al., 2020). Style constraints are learned through data synthesis (Sennrich et al., 2016a; Niu and Carpuat, 2020) or specialized model design (Michel and Neubig, 2018). As a result, the engineering cost of accommodating and simultaneously optimizing for various constraints and styles can be high. + +We consider prompt-driven neural machine translation, a general form of introducing translation constraints. The basic idea is shown in Figure 1, where a prompt-driven NMT system can accept a source input, together with an arbitrary number of instructions, and generate a target translation in accordance. Since the translation constraints are specified in textual form, we can integrate different types of control easily into the input, such as specifying the translation of a source phrase (Figure 1b), controlling word order (Figure 1c) and laying + +out the beginning of the target sentence (Figure 1d), in addition to the traditional lexical constraints (Figure 1a). In addition, when there are no input constraints, the NMT system should give competitive performance as a unconstrained NMT model. + +Without losing generality, we consider the forms of constraints in Figure 1 in this work. Building on a standard Transformer (Vaswani et al., 2017) baseline, we consider the following research questions. First, what is the most effective system architecture for encoding both the source sentence and the prompt? To this end, we compare various methods including concatenating source sentences with prompts, encoding prompts using a dedicated module, and incorporating prompt representations with an attention layer. The model performance is also compared with previous work on lexical constraints, a form of constraints in Figure 1 that has been much studied in the literature. Second, can different types of constraints be effectively trained within the same model? To this end, we design an algorithm to automatically construct different types of prompts from a standard MT training corpus, training a model with mixed prompts. Third, can a prompt-driven NMT system accept different number of prompts, while maintaining the same level of performance compared to a Transformer baseline without constraints? To this question, we consider a sampling-based training strategy, where the model receives random combinations of arbitrary number of prompts or no prompt at all for each sample during training. Fourth, can the set of flexible constraints we use serve to improve the efficiency of human-in-the-loop translation? We deploy our prompt-drive system in a real application scenario where professional translators conduct machine translation post editing (MTPE) by using prompts. + +Empirical results show that the Prompt-driven Transformer (Prompt-Transformer) responds to different prompts effectively, while giving competitive performance when used as a unconstrained NMT model. In addition, prompt-driven model outperforms previous lexical constraints methods (Song et al., 2019; Chen et al., 2021b) by a large margin. Human experiments further demonstrate the control flexibility and effectiveness of our method. Through system deployment in a practical scenario, we show that the prompt-driven NMT system achieves a trade-off between translation quality and human efficiency, as compared with full NMT + +or NMT with human post editing. Our code is released on https://github.com/yafuly/PromptNMT. + +# 2 Related Work + +Lexical constraint has received much attention for machine translation. Some researchers incorporate the constraints into the beam search algorithm (Hokamp and Liu, 2017; Post and Vilar, 2018), and recently Chen et al. (2021b) investigate alignment-based constrained decoding methods using attention weights. Another approach focuses on data augmentation. Song et al. (2019) and Dinu et al. (2019) create a synthetic code-switching corpus. Jon et al. (2021) augment the input sentences with lemmatized constraints to correct inflection. Chen et al. (2020) propose a lexical constraint-aware Transformer model (LeCA) by concatenating constraints and source sentence. Lexical constraints is one of the application scenarios of our method. Prompt-driven model gives strong results, while also simultaneously enables structural and style constraints with the versatility of prompts. + +There has been study on controlling the global output style in MT (Mima et al., 1997; van der Wees et al., 2016; Rabinovich et al., 2017; Michel and Neubig, 2018; Sennrich et al., 2016a; Niu and Carpuat, 2020). van der Wees et al. (2016) analyze the impact of dialogue specific aspects in SMT for fictional dialogues. Rabinovich et al. (2017) employ personalized SMT models for better preservation of gender traits, and Michel and Neubig (2018) propose to adapt the bias of the output softmax to different users of an NMT system. Sennrich et al. (2016a) use target-constraint T-V annotation in NMT training to control the level of politeness. Niu and Carpuat (2020) propose a formality-sensitive NMT model taking formality levels as an extra input. Our work is similar in that the output of our model can be adaptive at inference time, but different in that the control is more fine-grained and not limited to certain styles. + +Human in the loop for NMT (Turchi et al., 2017; Weng et al., 2019) has been proved effective to domain adaptation. Cheng et al. (2016) propose an interactive framework which takes two human actions: picking a critical translation error and revising the translation. Petrushkov et al. (2018) propose a simple sentence-level weighting method to integrate partial chunk-based feedback into NMT. Kreutzer et al. (2018) improve NMT with explicit and implicit user feedback collected on the ecom + +![](images/b66984f863b4f751738773db1510fd32d1c0b9065f43396b4e5db0971361673f.jpg) +Figure 2: The overall framework of Prompt-Transformer. During training, the prompts are sampled from the prompt candidate pool, which contains all possible prompts for each sentence pair. In deployment, the translators give arbitrary prompts to control output translations according to their needs. + +merce platform. Domingo et al. (2019) leverage data generated during the post-editing process. The above methods improve the performance of NMT by leveraging extra training signals from human feedback. Different from them, our method allows human to control the NMT output by training a model with mixed prompts, without the requirement of human in training. + +# 3 Problem Definition + +In neural machine translation, a set of parallel sentence pairs $D = \{(X,Y)\}$ is given where $X = (x_{1},\dots,x_{T_{x}})$ and $Y = (y_{1},\dots,y_{T_{y}})$ , and the NMT systems model the conditional probability: + +$$ +p (Y | X; \theta) = \prod_ {t} ^ {T _ {y}} p \left(y _ {t} \mid y _ {< t}, X; \theta\right), \tag {1} +$$ + +where $\theta$ is the set of trainable parameters. We introduce prompts $P = (P_{1},\dots,P_{N})$ to control translation, which is defined as + +$$ +p (Y | X, P; \theta) = \prod_ {t} ^ {T _ {t}} p \left(y _ {t} \mid y _ {< t}, X, P; \theta\right). \tag {2} +$$ + +The prompts can be general and flexible. In this paper, we consider the following three types of common prompts: + +- translation prompts that indicate the specific translation of a source segment (Fig 1 (b)). +- target-constraint prompts including some specific segments that the translation must contain, begin or end with (Fig 1 (a) and (d)). +- ordering prompts that indicate a source segment should be translated before another source segment (Fig 1 (c)). + +# 4 Approach + +The overall architecture of our system is shown in Figure 2. In particular, we take a Transformer baseline (Section 4.1), discussing different ways to additionally encode prompt constraints (Section 4.2). We propose a sampling-based training framework (Section 4.4), with automatic methods for generating rich constraints from standard MT training instances (Section 4.3). + +# 4.1 Transformer + +The vanilla Transformer (Vaswani et al., 2017) is composed of an encoder and a decoder. The Transformer encoder has a stack of $L$ identical multi-head self-attention layers, which takes the embedding of a source sentence $X$ as input and outputs contextualized source representations. For the $l$ -th encoder layer, the representations are computed as + +$$ +H ^ {l} = \operatorname {E n c L a y e r} \left(H ^ {l - 1}\right), \tag {3} +$$ + +where $H^{l - 1}$ is the output hidden state of the $(l - 1)$ -th layer. + +The decoder introduces a cross-attention sublayer in each layer to attend to the source representations $H^{L}$ , taking previously generated target tokens as input and generating the next token. For the $l$ -th decoder layer, the hidden states of decoder are calculated as + +$$ +S ^ {l} = \operatorname {D e c L a y e r} \left(S ^ {l - 1}, H ^ {L}\right), \tag {4} +$$ + +where $S^{l - 1}$ is the output of the $(l - 1)$ -th layer. + +# 4.2 Prompt-driven Transformer + +We investigate three different approaches to incorporate prompts into the Transformer model. + +(1) Separate Encoding. A straightforward way is to introduce a Prompt Encoder that is identical to the Transformer encoder, which encodes the prompt sequence separately. We concatenate the source representations and the prompt representations as the final encoder memory for the decoder: + +$$ +H _ {P} ^ {L} = \operatorname {P r o m p t - E n c o d e r} (P), \tag {5} +$$ + +$$ +\hat {H} _ {L} = \operatorname {C o n c a t} \left(H ^ {L}, H _ {P} ^ {L}\right), \tag {6} +$$ + +where $P$ is a prompt sequence. + +(2) Input Augmentation. We follow Chen et al. (2020) and construct pseudo source sequences by augmenting each input source sequence with the corresponding prompt sequence: + +$$ +\hat {X} = \operatorname {C o n c a t} \left(X, P _ {1}, P _ {2}, \dots , P _ {N}\right), \tag {7} +$$ + +where $N$ is the number of prompts. The augmented input $\hat{X}$ is fed into the standard Transformer. + +(3) Prompt Attention. On top of the concatenation method, we can also use a dedicated prompt attention sub-layer after the cross-attention module in each decoder layer. The prompt attention takes the decoder hidden representations as queries and takes the prompt representations as keys and values to perform multi-head attention: + +$$ +\operatorname {P r o m p t A t t n} \left(S ^ {l}, H _ {P} ^ {L}\right) = \mathrm {M H A} \left(S ^ {l - 1}, H _ {P} ^ {L}, H _ {P} ^ {L}\right), \tag {8} +$$ + +where $\mathrm{MHA}(\cdot)$ is the multi-head attention mechanism (Vaswani et al., 2017). + +# 4.3 Training Prompt Construction + +Given a parallel dataset $D = \{(X,Y)\}$ , we propose an automatic method to generate prompts for each sentence pair based on word alignment, resulting in a corpus $\hat{D} = \{(X,Y,\hat{P})\}$ , where $\hat{P}$ is the corresponding prompt candidate pool containing all prompts. Specifically, we train an alignment tool on a parallel corpus and obtain possibly aligned phrases. For each sentence pair, we extract all possible prompts using the aligned phrases to build the prompt candidate pool. + +First, we insert pre-defined symbols between source phrase segments and the corresponding aligned target segments (e.g., “ $<\mathrm{AB}>$ menschliche gesundheit $\langle \mathbf{\Pi} / \mathbf{A}\mathbf{M}\rangle$ human health”) to construct translation prompts. Second, we append predefined symbols before target phrase segments to construct target-constraint prompts: (1) “ $\langle \mathbf{\Pi} / \mathbf{T}\mathbf{B} \rangle$ ” denotes the target sequence begins with specific + +segments (e.g., “ $<\mathrm{TB}>$ we know”); (2) “ $<\mathrm{TI}>$ ” denotes the target sequence includes specific segments (e.g., “ $<\mathrm{TI}>$ the complex science”); (3) “ $<\mathrm{TE}>$ ” denotes the target sequence ends with specific segments (e.g., “ $<\mathrm{TE}>$ we’ve experienced that”). Third, for ordering prompts, we find pairs of source phrases of which the aligned target phrases appear in the opposite order in the target sequence, indicating word-reordering is involved in translating these phrases. We insert pre-defined symbols between these 2 source segments (e.g., “ $<\mathrm{RB}>$ the apple pie $\langle \mathrm{RM}\rangle$ on the table”, meaning that “on the table” should be translated before “the apple pie” in the target language). + +# 4.4 Training + +Given $\hat{D} = \{(X,Y,\hat{P})\}$ , we propose a sampling based training framework to train the prompt-driven NMT model. For each instance $(X,Y,\hat{P})$ , we define whether to use prompts as a discrete Bernoulli variable $u \sim \mathcal{B}(\mu)$ , where $\mu$ is a hyperparameter (Bernoulli ratio) and a higher $\mu$ indicates more prompt-driven samples during training. If prompt is not used, the training objective is to maximize the log-likelihood: + +$$ +\sum_ {(X, Y) \in B a t c h} \operatorname {l o g p} (Y | X; \theta), \tag {9} +$$ + +where $Batch$ is a mini-batch of parallel sentence pairs. + +If prompt is used, we sample a certain proportion of prompts for each prompt type from the corresponding prompt candidates without replacement. In particular, we define the proportion of the sampled prompts as a continuous random variable with a uniform distribution $\mathcal{U}(0,p_u)$ , where $p_u$ is a hyper-parameter, uniform ratio. A larger $p_u$ indicates more prompts are sampled for each sentence if there are. All sampled prompts are concatenated together to form the final prompt sequence $P$ , and the training objective is to maximize the log-likelihood defined as: + +$$ +\sum_ {(X, Y, P) \in B a t c h} \operatorname {l o g p} (Y | X, P; \theta). \tag {10} +$$ + +The randomness in prompts enables the model to cope with complicated situations containing different prompts and output accurate translations without prompts as well. + +
Model# paramsBLEUResR
w/o promptsw/ prompts
Transformer-IWSLT36.74M34.7834.78-
Prompt Encoder43.05M34.2753.7392.08
Param-share Prompt Encoder36.74M34.4454.8393.30
Prompt Enc & Prompt Attention49.36M34.2853.7992.20
Param-Share Prompt Enc & Prompt Attn43.06M34.0455.0694.35
Input Augmentation36.74M33.6956.1095.19
+ +Table 1: Performance of different prompt-feeding methods on IWSLT'14 De-En. + +# 5 Experimental Settings + +Setup. As a preliminary experiment, we use a small size dataset IWSLT'14 De $\rightarrow$ En to investigate the effectiveness of our model under different settings. We use the Moses tokenizer $^{1}$ and apply BPE (Sennrich et al., 2016b) with 10,000 merge operations on the merged corpus of both side. For large-scale test, we extend our method to WMT'17 En $\rightarrow$ Zh, which contains 20.6M sentence pairs after preprocessing. We use Moses tokenizer to tokenize English side and jieba segmenter $^{2}$ to tokenize Chinese side. We apply BPE with 55,000 operations on the concatenated corpus and obtain a shared vocabulary for both sides. We use fast_align (Dyer et al., 2013) to obtain word alignment, based on which we apply the algorithm in Section 4.3 to generate prompts and build the prompt candidate pool. Data statistics is presented in Appendix A. We implement the Transformer baseline and PromptTransformer based on THUMT (Tan et al., 2020). We use iwslt_de_en for IwSTLT'14 De $\rightarrow$ En and transformer_base for WMT'16 En $\rightarrow$ Zh. The default Prompt Encoder consists of 3 Transformer layers. We use Adam (Kingma and Ba, 2015) to optimize the network with $\beta_{1} = 0.9$ , $\beta_{2} = 0.98$ . The default Bernoulli and uniform ratios are set as 0.3 and 0.35, respectively. For inference, we set the beam width as 5 and length penalty as 0.6. Details are presented in Appendix B. + +Evaluation Metrics. We use both automatic and human evaluation to measure the performance of our prompt-driven NMT model, taking commonly-used BLEU scores (Papineni et al., 2002) to measure translation quality automatically. For fair comparison with previous work, we use multi-bleu.perl for De-En and sacreBLEU (Post, 2018) for $\mathrm{En - Zh}^3$ . In addition, we use Response Rate (ResR) to quantify how the model responses to the given prompts, + +which is defined as the percentage of prompts being correctly responded. Specifically, for translation prompts, ResR denotes the ratio of prompt translations that appear in the sentence translation; for target-constraint prompts, ResR measures the ratio of prompts that exist at the beginning of, at the end of or in the translation accordingly; for ordering prompts, ResR is calculated as the ratio of translations that satisfy the word ordering information induced by the prompts. + +For human evaluation, we follow Knight (2000) and ask professional translators to assign adequacy and fluency scores for each translation ranging from one to five. The five point scale for adequacy indicates how much of the meaning expressed in the reference translation is also expressed in a hypothesis translation: $5 = \text{All}$ , $4 = \text{Most}$ , $3 = \text{Much}$ , $2 = \text{Little}$ , and $1 = \text{None}$ . The five point scale for fluency indicates how fluent the translation is: $5 = \text{Flawless}$ , $4 = \text{Good}$ , $3 = \text{Non-native}$ , $2 = \text{Disfluent}$ , and $1 = \text{Incomprehensible}$ . + +We investigate the effectiveness of our method in the context of automatic evaluation in Section 6, where prompts are constructed towards reference translation. In Section 7, we conduct human evaluation to demonstrate the control flexibility of the Prompt-driven NMT system. Finally, in Section 8 we show an application of the method in the context of human-in-the-loop translation. + +# 6 Experiments on the Model Design + +We evaluate models under two test scenarios using IWSLT'14 De-En: inference without prompt and inference with prompt. The former is the same as the vanilla machine translation setting and is evaluated using BLEU score. For the latter, we also evaluate the model's effectiveness on responding to prompts by calculating ResR. We apply sampling strategy same to training and run on the test set once to build a deterministic prompt sets. + +![](images/a122e78375a9e39ccada4d5abd5eedba06d506b5c454c77ee7caa1b95244dd32.jpg) +Figure 3: BLEU scores with respect to the number of prompts during inference. + +![](images/a8798312ac47cc07a116023c997750100ab6181074ec19faf3c10a1ad30cd802.jpg) +Figure 4: ResR and BLEU scores with respect to the Bernoulli ratio during training. + +Number of prompts during decoding. We investigate how prompts improve translation performance by feeding different number of prompts during decoding. Specifically, we randomly select certain number of prompts from the prompt candidate pool and construct test prompts accordingly. The results are shown in Figure 3. Prompt-Transformer further achieves higher BLEU scores when there are more prompts. Given as many as 10 prompts, the BLEU reaches 60.59. We also investigate how the sampling ratio affects decoding performance, which is discussed in Appendix C. + +Robustness to different prompts. We explore how the model behaves under different prompt sets, by fixing the sampling ratios but varying the seed for prompt sampling. We conduct experiments with 10 seeds, under which the model receives different prompts for translation, calculating the mean and standard deviation of BLEU scores and ResR over each seed. For each sentence, the model is provided with 1 to 8 sampled prompts. The model achieves a average BLEU score of 54.79 with a standard deviation of 0.17, and an average of 92.82 with a standard deviation of 0.14 for ResR, demonstrating that the model is stable for flexible types of prompt + +combinations. + +Influences of model architecture. Based on the modules in Section 4.2, we compare different model architectures to incorporate prompts using a fixed prompt seed. As shown in Table 1, all prompt-driven models obtain higher BLEU scores over Transformer when provided with prompts. Input augmentation achieves the highest ResR, but suffers from larger performance deterioration without prompts. For the prompt encoding method, we find that reusing the sentence encoder as the prompt encoder (Param-share Prompt Encoder) achieves higher ResR than introducing extra parameters (Prompt Encoder). We attribute this pattern to the better generalization ability of the reused encoder in Param-share Prompt Encoder. The effects of prompt encoder depth is discussed in Appendix D. For incorporating prompt representations, introducing Prompt Attention (Prompt Enc & Prompt Attention and Param-Share Prompt Enc & Prompt Attn) is beneficial for responding effectiveness, compared with concatenating source and prompt representations for cross-attention. Overall, Param-share Prompt Encoder gives a balance between BLEU in unprompted cases and the response rate, without introducing extra parameters. We thus choose the model for the other experiments. + +Number of prompts during training. The sampling strategy in Section 4.4 can affect the performance. We investigate how varying the Bernoulli ratio during training affects the model performance. The Bernoulli ratio indicates how many of samples in the train set are driven by prompts. For example, a Bernoulli ratio of 0.3 denotes $65.7\%$ of the training samples are provided with prompts. The result is shown in Figure 4. We can observe that ResR grows steadily with the increasing ratio during training. The model gives a low ResR with a Bernoulli ratio of 0.1, as there are limited samples for the model to capture prompt patterns. Despite the increasing ResR, there is a sharp decline on BLEU scores when the ratio exceeds 0.5. This is because high Bernoulli ratios indicate almost all training samples are prompted (e.g., a ratio of 0.7 denotes $97.3\%$ of training samples are provided with prompts). Therefore, the model learns to output translations by over reliance on prompts, but fails to build correspondence between source and target languages. Thus it is important to balance the learning of translation and receiving prompts. + +
PromptsTranslations
Null在庭审中,双方就王志安是否侵犯了兰玉峰的名誉权进行了辩论。(English: in the court hearing, the two sides launched a debate on whether wang zhian violated the reputation right of lan yuefeng.)
</AB> lan yuefeng </AM> Lan Yuefeng在庭审中,双方就王志安是否侵犯了Lan Yuefeng的名誉权进行了辩论。(English: in the court hearing, the two sides launched a debate on whether wang zhian violated the reputation right of Lan Yuefeng.)
</TB> 双方双方 在庭审中争论王志安是否侵犯了兰玉峰的名誉权。(English: the two sides argued in the court hearing whether wang zhian violated the reputation right of lan yuefeng.)
</RB> wang zhian </RM> argued双方在庭审中争辩说,王志安是否侵犯了兰玉峰的名誉权。(English: the two sides argued in the court hearing, whether wang zhian violated the reputation right of lan yuefeng.)
</TB> 在庭审中 +</RB> wang zhian </RM> argued在庭审中,双方争辩说王志安是否侵犯了兰玉峰的名誉权。(English: in the court hearing, the two sides argued whether wang zhian violated the reputation right of lan yuefeng.)
</AB> lan yuefeng </AM> Lan Yufeng +</TB> 在庭审中 +</RB> wang zhian </RM> argued在庭审中,双方争辩说王志安是否侵犯了Lan Yufeng的名誉权。(English: in the court hearing, the two sides argued whether wang zhian violated the reputation right of Lan Yuefeng.)
+ +Table 2: Given different prompts, Prompt-Transformer generates different translations for the sentence "in the court hearing , the two sides argued whether wang zhian violated the reputation right of lan yuefeng." + +
ModelBLEUCSRResR
w/o Pw/ P
TF-IWSLT34.78---
Code-Switch33.8837.1593.6990.21
LeCA34.6637.1089.3282.97
Prompt-TF34.4438.3095.7594.26
+ +Table 3: Prompt-driven Transformer for lexical constraints on IWSLT'14 De-En. P denotes 'prompts'. + +
ModelBLEUResR
w/o promptsw/ prompts
TF-Base34.0634.06-
Prompt-TF33.8848.9391.80
+ +Table 4: Performance on WMT'17 En-Zh. + +Comparison with existing work on lexical constraints. Among the types of prompts we accommodate, lexical constraints have been investigated by existing work. We compare our method with two typical methods, i.e., CodeSwitch (Song et al., 2019) and LeCA (Chen et al., 2021b). Following Song et al. (2019) and Chen et al. (2021b), the copy success rate (CSR) is also calculated, which is the percentage of successfully generated tokens in constraints, differing from ResR which is the ratio of correctly responded prompts (i.e., phrases for lexical constraints). Compared with CodeSwitch, Prompt-Transformer maintains better performance without prompts, while also achieves a higher score of CSR and ResR. Although LeCA is slightly better in terms of BLEU without prompts, Prompt-Transformer outperforms LeCA by a large margin in terms of CSR and ResR. Performance in lexical constraints further demonstrates the effectiveness + +of our method for controlling translation and meanwhile maintaining performance without prompts. + +Experiments on WMT. For a large scale test, we apply Prompt-Transformer on the WMT'17 $\mathrm{En} \rightarrow \mathrm{Zh}$ dataset. Based on the preliminary experiments, we choose the Param-share Prompt Encoder architecture. As shown in Table 4, Prompt-Transformer gives an improved BLEU with prompts (48.93 vs. 34.06) and a ResR of 91.80, verifying the scalability of the proposed method on large-scale datasets. We use this model for experiments in Section 7 and Section 8. + +# 7 Experiments on Prompts + +We evaluate how model responds to prompts in practical scenarios, where no "gold-standard" references are given. We sample 100 source sentences from the WMT'17 En-Zh test set and ask 2 professional translators to assign each sentence with two different prompt groups, each of which includes at least one type of prompts. In particular, for constructing translation prompts, the translators are asked to give a source segment two different valid translations (e.g., "translation-segment-1" or "translation-segment-2"); for constructing target-constraint prompts, the translators should choose two different ways to prompt the model; for constructing ordering prompts, the translators provide two opposite orderings (e.g., "source-segment1" should be translated before and after "source-segment2", respectively). The model is expected to output two different and correct trans + +lations corresponding to the two prompt groups, respectively. We ask 3 professional translators to evaluate the ResR and translation quality based on the adequacy and fluency metrics in Section 5. + +The system achieves ResR scores of 89.80, 94.74, 90.20 for translation prompts, target-constraint prompts, and ordering prompts, respectively, showing the effectiveness of our proposed model on responding to human prompts. The system obtains a competitive performance compared to the unprompted baseline in tuns of both adequacy (3.49 vs. 3.40) and fluency (3.24 vs. 3.31), demonstrating that our system can enable flexible translation style and maintain translation quality at the same time. + +Table 2 shows a case study, where the system responds to different types of prompts and their combinations accurately given the same source sentence. Moreover, the system generates translations with different styles under the target-constraint prompts and ordering prompts. For instance, with the prompt “ 双方” (English: the two sides), the system translates the word “argued” to “争论” (English: argued) instead of “进行了辩论” (English: launched a debate) in the unprompted case. A similar pattern can be observed when the system receives the ordering prompt “ wang zhian argued”, which indicates that the word “argued” should be translated before “wang zhian” in Chinese. + +# 8 Human-in-the-loop Translation + +Machine translation post-editing (MTPE) is widely used by translation companies to improve efficiency as well as ensure translation quality. Studies show that conducting post-editing over high-quality MT can increase the productivity of professional translators compared to manual translation 'from scratch' (Guerberof, 2009; Plitt and Masselot, 2010). However, MTPE still can be expensive in heavy involvement of human efforts in editing. To alleviate human labor, Prompt-driven methods can be used for a better trade-off between translation quality and efficiency. + +To verify our hypothesis, we ask professional translators to compare two methods for editing on MT translations: the traditional MTPE or giving prompts based on MT translations (MTPrompt). We compare MT, MTPE and MTPrompt based on time efficiency and translation quality. MT refers to use machine translations without editing. For + +![](images/0d6f6782a425e2907babd7ac786e80f41176f5d5b05dc89ecfdb2d5629b4356d.jpg) +Figure 5: Translation quality based on adequacy and fluency. + +![](images/c112627b2bee41c385296f48d404d50ea666c3d6c14e66afdf45315a10ee0c4f.jpg) +Figure 6: Time cost (hours) for MTPrompt with respect to the round of MTPrompt. + +MTPE, translators are required to edit translations output by the WMT-trained Transformer baseline in Section 6. For MTPrompt, translators are required to observe output translation errors and give prompts to correct them. More details are presented in Appendix E. + +The translation quality is presented in Figure 5. MTPE achieves full marks on both adequacy and fluency, whereas the scores for MT translations are on average around 2.5. Translations with prompt obtain substantial improvement over MT translations, with both the adequacy and fluency scores being close to 4 (i.e., the translations cover most meaning and also have good fluency). + +In terms of speed, the average time spent on MTPE is 3.75 hours, which is stable for more batches since the translators have strong experience in MTPE. In contrast, the time cost can be lower as they conduct more MTPrompt actions. We ask two translators to conduct multiple rounds of MTPrompt edit, with each round containing 50 translations. The time cost for each round is shown in Figure 6. We can observe that as the translators get familiar with the MTPrompt mode, they become more efficient in giving prompts. The fastest batch costs an average of 1.1 hours for MTPrompt, which is 2.4 times more efficient than MTPE, and meanwhile translation quality is maintained (adequacy: 3.87 vs. 3.84 and fluency: 3.71 vs. 3.63). + +# 9 Conclusion + +We proposed a prompt-driven Transformer model to incorporate flexible constraints on translation. Under a sampling-based training framework, the model learned prompt responding effectively and achieved competitive performance compared with both the unconstrained baseline and existing work on lexical constraints. Human experiments further demonstrated that Prompt-Transformer was able to respond to various combinations of prompts accurately, and generate versatile translations. Through deployment in an application scenario, we showed that our system could serve to improve the efficiency of human-in-the-loop translation. + +# 10 Ethics Consideration + +As mentioned, we collected our data from IWSLT and WMT that all are public to academic use, and they contain no sensitive information. The legal advisor of our institute confirms that the sources of our data are freely accessible online without copyright constraint to academic use. Our human experiments (Section 7 and Section 8) involves manual annotation. Annotators were asked to give prompts, post-edit machine translation and evaluate translations, which do not involve any personal sensitive information. We hired 4 annotators who have degrees in English Linguistics or Applied Linguistics. Before formal annotation, annotators were asked to annotate a few samples randomly extracted from the dataset, and based on average annotation time we set a fair salary (i.e., 30 dollars per hour) for them. During their training annotation process, they were paid as well. + +# Acknowledgements + +Yue Zhang is the corresponding author. We thank all reviewers for their insightful comments. This publication has emanated from research conducted with the financial support of the "Pioneer" and "Leading Goose" R&D Program of Zhejiang under Grant Number 2022SDXHDX0003. This work is also under a grant from Lan-bridge Information Technology Co., Ltd. We thank colleagues from Lan-bridge for examining data and evaluating results. + +# References + +Guanhua Chen, Yun Chen, and Victor O. K. Li. 2021a. Lexically constrained neural machine translation with + +explicit alignment guidance. In Thirty-Fifth AAAI Conference on Artificial Intelligence, AAAI 2021, Thirty-Third Conference on Innovative Applications of Artificial Intelligence, IAAI 2021, The Eleventh Symposium on Educational Advances in Artificial Intelligence, EAAI 2021, Virtual Event, February 2-9, 2021, pages 12630-12638. +Guanhua Chen, Yun Chen, and Victor O. K. Li. 2021b. Lexically constrained neural machine translation with explicit alignment guidance. In Thirty-Fifth AAAI Conference on Artificial Intelligence, AAAI 2021, Thirty-Third Conference on Innovative Applications of Artificial Intelligence, IAAI 2021, The Eleventh Symposium on Educational Advances in Artificial Intelligence, EAAI 2021, Virtual Event, February 2-9, 2021, pages 12630-12638. +Guanhua Chen, Yun Chen, Yong Wang, and Victor O. K. Li. 2020. Lexical-constraint-aware neural machine translation via data augmentation. In Proceedings of the Twenty-Ninth International Joint Conference on Artificial Intelligence, IJCAI 2020, pages 3587-3593. +Shanbo Cheng, Shujian Huang, Huadong Chen, Xin-Yu Dai, and Jiajun Chen. 2016. PRIMT: A pick-revise framework for interactive machine translation. In Proc. of NAACL-HLT, pages 1240-1249. +Georgiana Dinu, Prashant Mathur, Marcello Federico, and Yaser Al-Onaizan. 2019. Training neural machine translation to apply terminology constraints. In Proc. of ACL, pages 3063-3068. +Miguel Domingo, Mercedes García-Martínez, Álvaro Peris, Alexandre Helle, Amando Estela, Laurent Bié, Francisco Casacuberta, and Manuel Herranz. 2019. Incremental adaptation of NMT for professional posteditors: A user study. In Proceedings of Machine Translation Summit XVII: Translator, Project and User Tracks, pages 219-227. +Chris Dyer, Victor Chahuneau, and Noah A. Smith. 2013. A simple, fast, and effective reparameterization of IBM model 2. In Proc. of NAACL-HLT, pages 644-648. +Sergey Edunov, Myle Ott, Michael Auli, and David Grangier. 2018. Understanding back-translation at scale. In Proc. of EMNLP, pages 489-500. +Ana Guerberof. 2009. Productivity and quality in MT post-editing. In Beyond Translation Memories: New Tools for Translators Workshop. +Hany Hassan, Anthony Aue, Chang Chen, Vishal Chowdhary, Jonathan Clark, Christian Federmann, Xuedong Huang, Marcin Junczys-Dowmunt, William Lewis, Mu Li, Shujie Liu, Tie-Yan Liu, Renqian Luo, Arul Menezes, Tao Qin, Frank Seide, Xu Tan, Fei Tian, Lijun Wu, Shuangzhi Wu, Yingce Xia, Dongdong Zhang, Zhirui Zhang, and Ming Zhou. 2018. Achieving human parity on automatic chinese to english news translation. CoRR, abs/1803.05567. + +Chris Hokamp and Qun Liu. 2017. Lexically constrained decoding for sequence generation using grid beam search. In Proc. of ACL, pages 1535-1546. +Josef Jon, João Paulo Aires, Dusan Varis, and Ondrej Bojar. 2021. End-to-end lexically constrained machine translation for morphologically rich languages. In Proc. of ACL, pages 4019-4033. +Prathyusha Jwalapuram, Shafiq Joty, and Youlin Shen. 2020. Pronoun-targeted fine-tuning for NMT with hybrid losses. In Proc. of EMNLP, pages 2267-2279. +Diederik P. Kingma and Jimmy Ba. 2015. Adam: A method for stochastic optimization. In Proc. of ICLR. +Kevin Knight. 2000. Statistical machine translation. In Proceedings of the Fourth Conference of the Association for Machine Translation in the Americas: Tutorial Descriptions. +Jakub Konieczny. 2021. Training of neural machine translation model to apply terminology constraints for language with robust inflection. In *Position and Communication Papers of the 16th Conference on Computer Science and Intelligence Systems*, Online, September 2-5, 2021, pages 233-234. +Julia Kreutzer, Shahram Khadivi, Evgeny Matusov, and Stefan Riezler. 2018. Can neural machine translation be improved with user feedback? In Proc. of NAACL-HLT, pages 92-105. +Jiwei Li and Dan Jurafsky. 2016. Mutual information and diverse decoding improve neural machine translation. CoRR, abs/1601.00372. +Yafu Li, Yongjing Yin, Yulong Chen, and Yue Zhang. 2021. On compositional generalization of neural machine translation. In Proc. of ACL, pages 4767-4780. +Xiaodong Liu, Kevin Duh, Liyuan Liu, and Jianfeng Gao. 2020. Very deep transformers for neural machine translation. CoRR, abs/2008.07772. +Paul Michel and Graham Neubig. 2018. Extreme adaptation for personalized neural machine translation. In Proc. of ACL, pages 312-318. +Hideki Mima, Osamu Furuse, and Hitoshi Iida. 1997. Improving performance of transfer-driven machine translation with extra-linguistic information from context, situation and environment. In Proceedings of the Fifteenth International Joint Conference on Artificial Intelligence, IJCAI 97, Nagoya, Japan, August 23-29, 1997, 2 Volumes, pages 983-989. +Mathias Müller, Annette Rios, and Rico Sennrich. 2020. Domain robustness in neural machine translation. In Proceedings of the 14th Conference of the Association for Machine Translation in the Americas (Volume 1: Research Track), pages 151-164. + +Xing Niu and Marine Carpuat. 2020. Controlling neural machine translation formality with synthetic supervision. In The Thirty-Fourth AAAI Conference on Artificial Intelligence, AAAI 2020, The Thirty-Second Innovative Applications of Artificial Intelligence Conference, IAAI 2020, The Tenth AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI 2020, New York, NY, USA, February 7-12, 2020, pages 8568-8575. +Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. 2002. Bleu: a method for automatic evaluation of machine translation. In Proc. of ACL, pages 311-318. +Pavel Petrushkov, Shahram Khadivi, and Evgeny Matusov. 2018. Learning from chunk-based feedback in neural machine translation. In Proc. of ACL, pages 326-331. +Mirko Plitt and François Masselot. 2010. A productivity test of statistical machine translation post-editing in a typical localisation context. Prague Bull. Math. Linguistics, pages 7-16. +Matt Post. 2018. A call for clarity in reporting BLEU scores. In Proceedings of the Third Conference on Machine Translation: Research Papers, pages 186-191. +Matt Post and David Vilar. 2018. Fast lexically constrained decoding with dynamic beam allocation for neural machine translation. In Proc. of NAACL-HLT, pages 1314-1324. +Ella Rabinovich, Raj Nath Patel, Shachar Mirkin, Lucia Specia, and Shuly Wintner. 2017. Personalized machine translation: Preserving original author traits. In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics: Volume 1, Long Papers, pages 1074-1084. +Rico Sennrich, Barry Haddow, and Alexandra Birch. 2016a. Controlling politeness in neural machine translation via side constraints. In Proc. of NAACL-HLT, pages 35-40. +Rico Sennrich, Barry Haddow, and Alexandra Birch. 2016b. Neural machine translation of rare words with subword units. In Proc. of ACL, pages 1715-1725. +Raphael Shu, Hideki Nakayama, and Kyunghyun Cho. 2019. Generating diverse translations with sentence codes. In Proc. of ACL, pages 1823-1827. +Kai Song, Yue Zhang, Heng Yu, Weihua Luo, Kun Wang, and Min Zhang. 2019. Code-switching for enhancing NMT with pre-specified translation. In Proc. of NAACL-HLT, pages 449-459. +Zhixing Tan, Jiacheng Zhang, Xuancheng Huang, Gang Chen, Shuo Wang, Maosong Sun, Huanbo Luan, and Yang Liu. 2020. THUMT: An open-source toolkit for neural machine translation. In Proceedings of the 14th Conference of the Association for Machine + +Translation in the Americas (Volume 1: Research Track), pages 116-122. +Marco Turchi, Matteo Negri, M. Amin Farajian, and Marcello Federico. 2017. Continuous learning from human post-edits for neural machine translation. Prague Bull. Math. Linguistics, pages 233-244. +Marlies van der Wees, Arianna Bisazza, and Christof Monz. 2016. Measuring the effect of conversational aspects on machine translation quality. In Proceedings of COLING 2016, the 26th International Conference on Computational Linguistics: Technical Papers, pages 2571-2581. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, December 4-9, 2017, Long Beach, CA, USA, pages 5998-6008. +Rongxiang Weng, Hao Zhou, Shujian Huang, Lei Li, Yifan Xia, and Jiajun Chen. 2019. Correct-and-memorize: Learning to translate from interactive revisions. In Proceedings of the Twenty-Eighth International Joint Conference on Artificial Intelligence, IJCAI 2019, Macao, China, August 10-16, 2019, pages 5255-5263. + +# A Data Statistics + +
Dataset# sentsavg. Travg. Tcavg. O
IWSLT160,23941.2841.560.38
WMT20,616,24734.6934.6918.24
+ +Table 5: Data statistics with the right 4 columns accordingly denoting number of sentences, average number of translation prompts, target-constraint prompts and ordering prompts for each sentence. + +# B Experiment Details + +We implement the Transformer baseline and Prompt-Transformer based on THUMT (Tan et al., 2020). Except for the prompt encoding modules, Prompt-Transformer shares the same settings with the Transformer baseline. The prompt encoder layer shares the same setting with the vanilla Transformer encoder layer, and the prompt attention module is the same as the Transformer crossattention module. For IwSLT'14 De→En, we use the iwslt_de_en setting with dropout ratio 0.3. For WMT'16 En→Zh, we use the transformer_base setting with a dropout of 0.1. We use the Adam (Kingma and Ba, 2015) to optimize the network with $\beta_{1} = 0.9$ , $\beta_{2} = 0.98$ . The batch size for training De→En models is 4,096 and 32,768 for En→Zh models. The default Bernoulli and uniform ratio is set as 0.3 and 0.35 respectively. For inference, we set the beam width as 5 and length penalty as 0.6. + +# C Effects of Uniform Ratio during Decoding + +We investigate how prompts improve translation performance, by using the same sampling strategy during training but setting the Bernoulli ratio to 1, so that the number of prompts is only determined by the uniform ratio (Section 4.4). By varying the uniform ratio, the model receives different number of prompts for each sentence. The results are shown in Figure 7. We can observe that PromptTransformer behaves similarly to the Transformer baseline when the uniform ratio is 0, i.e., all sentences are translated without prompts. The translation performance is improved in a large degree when the uniform ratio is as small as 0.05. PromptTransformer further achieves higher BLEU scores when there are more prompts. With all prompts (0.35 ratio), the BLEU reaches 54.88, 20.06 higher than the baseline of 34.78. + +![](images/330206ac96da740e5c3aa6f2cbfd3ea384aca90bd588cad0f73dad6ff27c174e.jpg) +Figure 7: BLEU scores with respect to the uniform ratio during inference. + +![](images/fdaba819b21a972c8296f1d0a8184a22b73a12895c066c5145c50099f6ed1728.jpg) +Figure 8: ResR and BLEU scores with respect to the number of prompt encoder layers. + +# D Effects of Prompt Encoder Depth + +We investigate how the depth of the prompt encoder affects model performance. The results are shown in Figure 8. We can observe that the model performs steadily well with a prompt encoder of one to four Transformer layers. However, the ResR and BLEU score with prompts decrease sharply when the depth grows to 5 layers. This can be because that too deep prompt encoders overfit to the small scale MT dataset and thus fail to generalize to unseen prompts robustly. + +# E Prompt in Human-in-the-loop Translation + +We sample 100 sentences from the WMT'17 En-Zh test set and ask 2 professional translators to conduct MTPE and MTPrompt on the corresponding translations. The first translator is asked to perform MTPE on the first 50 sentences and MTPrompt on the other 50 sentences, whereas the second translator is asked to do the other way around. They are required to record the time they spend with both methods. Then we ask 3 translators to evaluate translations based on adequacy and fluency mentioned in Section 5 and calculate average scores respectively. \ No newline at end of file diff --git a/promptdrivenneuralmachinetranslation/images.zip b/promptdrivenneuralmachinetranslation/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..7d88badabab52e3724134028897093a76baeffa3 --- /dev/null +++ b/promptdrivenneuralmachinetranslation/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d1b535ab32e06321e7773c2ac8bedae09a828c35155816264509dc46f6999961 +size 446970 diff --git a/promptdrivenneuralmachinetranslation/layout.json b/promptdrivenneuralmachinetranslation/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..f5eb5366ca7667edb86f31bc0805f2a526c59e70 --- /dev/null +++ b/promptdrivenneuralmachinetranslation/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e13d9a7e88e85013bbc9ba29772646c82cc67d32b873dbe9e1b476cdf3ef289d +size 369796 diff --git a/prompttuningfordiscriminativepretrainedlanguagemodels/2bb65d2d-f8fd-4016-b677-42b37efbb12e_content_list.json b/prompttuningfordiscriminativepretrainedlanguagemodels/2bb65d2d-f8fd-4016-b677-42b37efbb12e_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..0b101549bc1e27d7749459f8eccf8c8f83207f9a --- /dev/null +++ b/prompttuningfordiscriminativepretrainedlanguagemodels/2bb65d2d-f8fd-4016-b677-42b37efbb12e_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f22726875f9819ea330f73061ee28f68392d9bee0bd5e49627e6518e36c8d988 +size 44718 diff --git a/prompttuningfordiscriminativepretrainedlanguagemodels/2bb65d2d-f8fd-4016-b677-42b37efbb12e_model.json b/prompttuningfordiscriminativepretrainedlanguagemodels/2bb65d2d-f8fd-4016-b677-42b37efbb12e_model.json new file mode 100644 index 0000000000000000000000000000000000000000..2367838f46c1c9be15a008645f63f31ca69c4e12 --- /dev/null +++ b/prompttuningfordiscriminativepretrainedlanguagemodels/2bb65d2d-f8fd-4016-b677-42b37efbb12e_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:89a1b7834d3fb751747beb52d566ca79520b682f0c6cd6f0de2e859fad862c3b +size 54287 diff --git a/prompttuningfordiscriminativepretrainedlanguagemodels/2bb65d2d-f8fd-4016-b677-42b37efbb12e_origin.pdf b/prompttuningfordiscriminativepretrainedlanguagemodels/2bb65d2d-f8fd-4016-b677-42b37efbb12e_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..a8500e24fde02c9648d7c9a86bc7115c2ed89909 --- /dev/null +++ b/prompttuningfordiscriminativepretrainedlanguagemodels/2bb65d2d-f8fd-4016-b677-42b37efbb12e_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2c0575d9a0f6c8c87f9feee86555bf392975b6f1cd1d298a191d36b7d9915430 +size 439482 diff --git a/prompttuningfordiscriminativepretrainedlanguagemodels/full.md b/prompttuningfordiscriminativepretrainedlanguagemodels/full.md new file mode 100644 index 0000000000000000000000000000000000000000..da4083aa3dd094cacfaae3835d5ded2e65aeb708 --- /dev/null +++ b/prompttuningfordiscriminativepretrainedlanguagemodels/full.md @@ -0,0 +1,195 @@ +# Prompt Tuning for Discriminative Pre-trained Language Models + +Yuan Yao $^{1}$ , Bowen Dong $^{1}$ , Ao Zhang $^{2}$ , Zhengyan Zhang $^{1}$ , Ruobing Xie $^{3}$ , Zhiyuan Liu $^{1,4,5,6\dagger}$ , Leyu Lin $^{3}$ , Maosong Sun $^{1,4,5,6\dagger}$ , Jianyong Wang $^{1}$ + +$^{1}$ Dept. of Comp. Sci. & Tech., Institute for AI, Tsinghua University, Beijing, China + +Beijing National Research Center for Information Science and Technology + +$^{2}$ Department of Computer Science, National University of Singapore, Singapore + +3WeChat Search Application Department, Tencent, China + +$^{4}$ Institute for Artificial Intelligence, Tsinghua University, Beijing, China + +$^{5}$ Institute Guo Qiang, Tsinghua University, Beijing, China + +$^{6}$ International Innovation Center of Tsinghua University, Shanghai, China + +yaoyuanthu@163.com dongbw18@mails.tsinghua.edu.cn + +# Abstract + +Recent works have shown promising results of prompt tuning in stimulating pre-trained language models (PLMs) for natural language processing (NLP) tasks. However, to the best of our knowledge, existing works focus on prompt-tuning generative PLMs that are pre-trained to generate target tokens, such as BERT (Devlin et al., 2019). It is still unknown whether and how discriminative PLMs, e.g., ELECTRA (Clark et al., 2020), can be effectively prompt-tuned. In this work, we present DPT, the first prompt tuning framework for discriminative PLMs, which reformulates NLP tasks into a discriminative language modeling problem. Comprehensive experiments on text classification and question answering show that, compared with vanilla fine-tuning, DPT achieves significantly higher performance, and also prevents the unstable problem in tuning large PLMs in both full-set and low-resource settings. The source code and experiment details of this paper can be obtained from https://github.com/thunlp/DPT. + +# 1 Introduction + +Recent years have witnessed the great success of the pre-training-then-fine-tuning paradigm in natural language processing (NLP) (Devlin et al., 2019; Yang et al., 2019; Clark et al., 2020; Lan et al., 2020; Raffel et al., 2020). Typically, language models are first pre-trained on large-scale corpora via self-supervised generative or discriminative tasks to learn universal text representations, and then fine-tuned to adapt to downstream tasks (Qiu et al., 2020; Xu et al., 2021). However, the significant gap + +between the objective forms of model pre-training and fine-tuning hinders taking full advantage of PLMs in downstream tasks (Liu et al., 2021). + +Prompt tuning has recently shown its effectiveness in stimulating the capability of PLMs by transforming downstream tasks into the same form as pre-training (Petroni et al., 2019; Brown et al., 2020; Schick and Schütze, 2021; Gao et al., 2021; Liu et al., 2021). However, to the best of our knowledge, existing works focus on prompt-tuning generative PLMs (i.e., PLMs pre-trained by generating target textual tokens from the context, such as BERT (Devlin et al., 2019) and GPT (Brown et al., 2020)). It is still unknown whether and how discriminative PLMs can be effectively prompt-tuned (i.e., PLMs pre-trained by discriminating replaced tokens, such as ELECTRA (Clark et al., 2020) and WKLM (Xiong et al., 2020)). Since discriminative PLMs typically enjoy competitive performance and superior computational efficiency compared with their generative counterparts (Clark et al., 2020), it can be especially appealing to prompt-tuning discriminative PLMs. + +In this work, we present DPT, the first prompt tuning framework for discriminative PLMs. DPT reformulates downstream tasks into a discriminative language modeling problem, maximally mitigating the gap between model pre-training and tuning. Specifically, as shown in Figure 1, models are asked to discriminate correct answer tokens (e.g., correct labels for text classification, or answer spans for question answering) from the input tokens based on the reused discriminative language modeling head, where the objective form is identical to pre-training. + +To evaluate DPT, we conduct comprehensive experiments on text classification and question an- + +![](images/6640fae730e8a2f39dab65332431185f0cf2b3db2905ec53793672a8f4e68666.jpg) +Figure 1: Illustration of (a) discriminative language modeling (DLM) based pre-training with the DLM head, (b) vanilla fine-tuning with a new classification (CLS) head, and (c) our DPT prompt tuning approach that reformulates NLP tasks into a discriminative language modeling problem. DPT fills the input text into the template containing answer candidates, and discriminates whether each answer candidate is correct (i.e., original), or incorrect (i.e., replaced) based on the reused DLM head. + +swering in both full-set and low-resource settings. Experimental results show that despite its simplicity, DPT significantly outperforms vanilla fin-tuning (e.g., $4.1\%$ accuracy improvement in the low-resource SST-5 evaluation). Moreover, previous works have shown that fine-tuning large PLMs can be highly unstable and even produce divergent results (Devlin et al., 2019; Dodge et al., 2020), which undermines the practicality of large PLMs. We show that DPT also addresses the unstable problem in tuning large discriminative PLMs. + +The contributions of our work are summarized as follows: (1) We present the first prompt tuning framework for discriminative PLMs. (2) Comprehensive experimental results on text classification and question answering demonstrate the effectiveness of the proposed prompt tuning framework. + +# 2 Preliminary + +In this work, without loss of generality, we take ELECTRA (Clark et al., 2020) as a representative example of discriminative PLMs, while applying DPT to other discriminative PLMs is also applicable. Here we introduce the main procedure of pre-training and fine-tuning, and we refer readers to the paper (Clark et al., 2020) for more details. + +Pre-training. During pre-training, a generator first corrupts the text via token replacement. Then the discriminator is asked to detect the replaced tokens, by classifying each token into binary categories, i.e., {original, replaced}, as shown in Figure 1. Finally, the generator is discarded and the discriminator is fine-tuned on downstream tasks. + +Vanilla Fine-tuning. (1) During fine-tuning, to perform text classification, a new classification + +head is typically introduced to classify the hidden representation of the [CLS] token in the last layer (Clark et al., 2020). (2) For general multi-span question answering, the answer could be multiple spans from the input text (Dasigi et al., 2019; Dua et al., 2019). State-of-the-art fine-tuning approaches formulate the task as a sequence-labeling problem, and classify each input token into binary labels based on a new classification head, indicating whether the token belongs to the answer or not (Segal et al., 2020; Ye et al., 2020). + +Note that the classification head typically introduces new parameters, and learning the parameters from scratch usually requires a large amount of labeled data. Moreover, previous works have shown that fine-tuning large PLMs can be highly unstable, and even produce divergent results (Devlin et al., 2019; Dodge et al., 2020). As a result, multiple fine-tuning trials are usually needed to find a good random seed that leads to a stably fine-tuned PLM, which undermines the practicality of large PLMs. + +# 3 Methodology + +In this section, we introduce the framework of DPT for prompt-tuning discriminative PLMs. We first introduce DPT using text classification as the running example, and then illustrate its application in question answering. + +DLM-based Reformulation. DPT reformulates NLP tasks into a discriminative language modeling problem, maximally mitigating the gap between pre-training and tuning. Specifically, as shown in Figure 1(c), for a text classification task with class set $\mathcal{C} = \{c_1, c_2, \dots, c_n\}$ , DPT defines a template that contains all answer candidates $\mathcal{T}(\cdot; \mathcal{C})$ . Given + +an input text $x$ (e.g., "A graceful movie"). DPT fills the input text into the template as follows: + +$$ +\mathcal {T} (x; \mathcal {C}) = [ \mathrm {C L S} ] x \text {C l a s s :} c _ {1}, c _ {2}, \dots , c _ {n}. [ \mathrm {S E P} ] \tag {1} +$$ + +Intuitively, $\mathcal{T}(x;\mathcal{C})$ can be understood as creating a virtual context that assumes all candidate classes are correct for the input text $x$ . It is then straightforward for discriminative PLMs to decide whether each class candidate token is proper in the context, by classifying the tokens into original (i.e., correct), or replaced (i.e., incorrect) based on the reused DLM head. In our experiments, we find that the order of classes in template has minimal influence on the performance, and a random order can produce good prompt-tuning results. + +DPT Training. After template filling, $\mathcal{T}(x;\mathcal{C})$ is fed into PLMs to obtain the hidden representations $\{\mathbf{h}_{[\mathrm{CLS}]},\mathbf{h}_1,\mathbf{h}_2,\dots ,\mathbf{h}_m,\mathbf{h}_{[\mathrm{SEP}]}\}$ . PLMs are then prompted to discriminate whether each class is correct. Specifically, we compute the score of class $c_{i}$ based on the representation of the corresponding token $t_i$ as: + +$$ +s \left(c _ {i}\right) = 1 - \sigma \left(\mathbf {h} _ {\mathrm {D L M}} ^ {\top} \mathbf {h} _ {t _ {i}}\right), \tag {2} +$$ + +where $\mathbf{h}_{\mathrm{DLM}}$ is the reused DLM head, and $\sigma(\cdot)$ is the sigmoid activation. Note that in Equation 2, the computation of class scores is different from the vanilla fine-tuning approaches which encourage large inner products between the correct answer and classification head (Devlin et al., 2019; Clark et al., 2020). The rationale is that during pre-training, discriminative PLMs are typically required to produce large inner products for the replaced tokens (i.e., incorrect ones), and small inner products for the original tokens (i.e., correct ones) (Clark et al., 2020), and therefore Equation 2 better fits the semantics in pre-training. In our experiments, we find this simple operation can lead to significantly better results in prompt-tuning discriminative PLMs. After obtaining the class score, the model is optimized as: + +$$ +\mathcal {L} = \sum_ {i} \left[ - y _ {i} \log s \left(c _ {i}\right) - \left(1 - y _ {i}\right) \log \left(1 - s \left(c _ {i}\right)\right) \right], \tag {3} +$$ + +where $y_{i}\in \{0,1\}$ indicates the ground-truth label. Since DPT tunes PLMs by reusing the pretrained DLM head in the same objective form as pre-training, compared with vanilla fine-tuning, we + +expect DPT will lead to more sample efficient and stable tuning results. + +DPT for Question Answering. Besides text classification, DPT can also be applied for the question answering task. Given a question and a paragraph, directly concatenating them without additional templates can already create a good prompting context. Then similar to text classification, we ask PLMs to discriminate whether each token in the paragraph is part of the answer (i.e., original), or not (i.e., replaced) based on the reused DLM head. During inference, we threshold the token scores to obtain multiple answer spans. + +# 4 Experiments + +In this section, we empirically evaluate DPT on the task of text classification and question answering. + +Datasets. We evaluate DPT on four widely used text classification datasets, including SST-2, SST-5, TREC and AGNews. For question answering, we adopt the challenging QUOREF dataset, where for each question, there may exist multiple answer spans in the paragraph. We refer readers to Section B for more dataset details. + +Evaluation Protocols. We evaluate the models under two settings, including (1) full-set setting, where the full training data is available, and (2) low-resource setting, where only $10\%$ of the full training data for each dataset is available. We report the accuracy for text classification, and exact match (EM) and F1 score for question answering. To account for the unstable problem of baseline models, we report the average results from 3 best random seeds among 10 trials. + +Baselines. We compare DPT with several strong baseline models, including vanilla fine-tuning of ELECTRA (Clark et al., 2020), BERT (Devlin et al., 2019) and RoBERTa (Liu et al., 2019). The fine-tuning of ELECTRA adopts the identical discriminative PLM to our model, and serves as the most direct baseline for comparison. + +Main Results. We report the main results in Table 1 and Table 2, from which we observe that: (1) DPT significantly improves the performance of discriminative PLMs. The improvements are consistent across different tasks and datasets, as well as base and large models. (2) Previous works show that despite the significant improvements in low-resource setting, template-based prompt tuning typically can only approach fine-tuning performance in full-set + +
PLMTuning ApproachFull-set SettingLow-resource Setting
SST-2SST-5TRECAGNewsSST-2SST-5TRECAGNews
BaseBERTFT91.3253.4195.9393.6886.9142.4686.7390.23
RoBERTaFT94.6956.0995.2793.9291.2350.4191.0790.25
ELECTRAFT94.3856.6094.8793.7091.6849.4088.4089.17
ELECTRADPT (Ours)95.2658.3496.2794.2293.8353.4893.9390.60
Δ+0.88+1.74+1.40+0.52+2.15+4.08+5.53+1.43
LargeBERTFT93.3254.1096.7394.8990.7750.8994.7392.93
RoBERTaFT95.4656.8096.8095.2694.2751.4195.2093.41
ELECTRAFT95.7258.2797.1394.8093.7453.6594.0092.33
ELECTRADPT (Ours)96.5860.6998.0795.3896.0957.0095.6793.58
Δ+0.86+2.42+0.94+0.58+2.35+3.35+1.67+1.25
+ +Table 1: Experimental results on text classification. Full-set setting: $100\%$ data, Low-resource setting: $10\%$ data. FT: fine-tuning, DPT: discriminative prompt tuning. $\Delta$ : Improvements of DPT over fine-tuning ELECTRA. + +
PLMTuning ApproachFull SetLow Resource
EMF1EMF1
BERTFT75.6779.9953.0261.36
RoBERTaFT78.2984.5659.3167.56
ELECTRAFT77.7983.7254.2963.71
ELECTRADPT (Ours)79.6686.0363.6573.09
Δ+1.87+2.31+9.36+9.38
+ +Table 2: Experimental results of ELECTRAlarge on QUOREF multi-span question answering dataset. + +
Tuning ApproachSST-2SST-5TRECAGNews
Fine-tuning91.6849.4088.4089.17
DPT (σ)92.1650.9688.0090.29
DPT (1 - σ)93.8353.4893.9390.60
+ +Table 3: Ablation on reuse forms of DLM head based on ELECTRAbase in low-resource setting. + +setting (Gao et al., 2021). In comparison, we note that DPT can improve the performance in both low-resource and full-set settings. The reason is that DPT enables PLMs to jointly model the input text and class candidates for better text understanding. In summary, DPT is effective in improving the performance of discriminative PLM tuning. + +Tuning Stability. Previous works have commonly observed the instability of fine-tuning large generative PLMs (Devlin et al., 2019; Dodge et al., 2020). Some works attempt to alleviate the problem by careful initialization and optimization (Zhang et al., 2021), or intermediate fine-tuning on other largescale datasets (Phang et al., 2018). To investigate the tuning stability of discriminative PLMs, we tune $\mathrm{ELECTRA}_{\mathrm{large}}$ using fine-tuning and DPT from 10 random seeds. From the results in Figure 2, we observe that: (1) Similar to generative PLMs, fine-tuning large discriminative PLMs is + +![](images/4dfb02495ea2b88f7adade4bc270cf51b809dbfb5c1f36db26fc228cb1b864e0.jpg) +(a) Full-set Setting (100% data) + +![](images/219827dd42ef127432f6440ee1e30b42e2b74e93532ed9546a6d311ad95dd8c9.jpg) + +![](images/ff2ea77d4e0efe24152163f0822069fc5bba7c17017c5dbedded24cfca18e731.jpg) + +![](images/30fe237932cfd3d4a22a9b139515033281d60259b54c25f6c9ca1bdc88d77900.jpg) +(b) Low-resource Setting (10% data) + +![](images/27af9d09ddf11a155faae155c797324cb4b6e149e7276b024109eb851a8aa0cc.jpg) +Figure 2: Performance distribution of ELECTRAlarge using fine-tuning and DPT from 10 seeds. + +![](images/2a2c77d7c9c4922b3b103b05a11e25ca43ed4691fc6405be5096a31d17b1dead.jpg) + +also highly unstable, and can even frequently produce divergent results (e.g., nearly $20\%$ accuracy for 5-way classification in SST-5 in low-resource setting). The problem is exacerbated by sparse data in low-resource setting, but remains even in full-set setting. (2) DPT achieves significantly more stable tuning results in both full-set and low-resource settings, where all tuning trials converged and closely approach the best performance. This is due to the reuse of DLM head parameters and identical objective forms to pre-training. + +Ablation Study. In DPT, different from conventional fine-tuning approaches, correct labels are encouraged to have small inner products with classifiers (as indicated by the $1 - \sigma$ in Equation 2). We evaluate DPT using conventional score computation (i.e., $\sigma$ ), and report the results in Table 3. The significant drop in performance shows that a proper form of reusing DLM head is crucial to the + +results of prompt-tuning discriminative PLMs. + +# 5 Conclusion and Future Work + +In this work, we present a simple and effective prompt tuning approach for discriminative PLMs. We note directly performing large-scale classification (e.g., for hundreds of classes) with DPT may be computationally inefficient. In future, we plan to address the problem by classifying text following class hierarchies, where each hierarchical layer typically consists of a moderate number of classes. + +# 6 Acknowledgement + +This work is suooprted by the Natural Science Foundation of China (NSFC) and the German Research Foundation (DFG) in Project Crossmodal Learning, NSFC 61621136008 / DFC TRR-169, Institute Guo Qiang at Tsinghua University, and International Innovation Center of Tsinghua University, Shanghai, China. + +# References + +Tom B Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. 2020. Language models are few-shot learners. arXiv preprint arXiv:2005.14165. +Kevin Clark, Minh-Thang Luong, Quoc V. Le, and Christopher D. Manning. 2020. ELECTRA: pretraining text encoders as discriminators rather than generators. In Proceedings of ICLR. +Pradeep Dasigi, Nelson F. Liu, Ana Marasovic, Noah A. Smith, and Matt Gardner. 2019. QUOREF: A reading comprehension dataset with questions requiring coreferential reasoning. In Proceedings of EMNLP-IJCNLP, pages 5924-5931. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: pre-training of deep bidirectional transformers for language understanding. In Proceedings of NAACL-HLT, pages 4171-4186. +Jesse Dodge, Gabriel Ilharco, Roy Schwartz, Ali Farhadi, Hannaneh Hajishirzi, and Noah Smith. 2020. Fine-tuning pretrained language models: Weight initializations, data orders, and early stopping. arXiv preprint arXiv:2002.06305. +Dheeru Dua, Yizhong Wang, Pradeep Dasigi, Gabriel Stanovsky, Sameer Singh, and Matt Gardner. 2019. DROP: A reading comprehension benchmark requiring discrete reasoning over paragraphs. In Proceedings of NAACL-HLT, pages 2368-2378. + +Tianyu Gao, Adam Fisch, and Danqi Chen. 2021. Making pre-trained language models better few-shot learners. In Proceedings of ACL-IJCNLP, pages 3816-3830. +Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, and Radu Soricut. 2020. ALBERT: A lite BERT for self-supervised learning of language representations. In Proceedings of ICLR. +Pengfei Liu, Weizhe Yuan, Jinlan Fu, Zhengbao Jiang, Hiroaki Hayashi, and Graham Neubig. 2021. Pretrain, prompt, and predict: A systematic survey of prompting methods in natural language processing. arXiv preprint arXiv:2107.13586. +Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692. +Fabio Petroni, Tim Rocttäschel, Sebastian Riedel, Patrick S. H. Lewis, Anton Bakhtin, Yuxiang Wu, and Alexander H. Miller. 2019. Language models as knowledge bases? In Proceedings of EMNLP-IJCNLP, pages 2463-2473. +Jason Phang, Thibault Févry, and Samuel R Bowman. 2018. Sentence encoders on STILTS: Supplementary training on intermediate labeled-data tasks. arXiv preprint arXiv:1811.01088. +Xipeng Qiu, Tianxiang Sun, Yige Xu, Yunfan Shao, Ning Dai, and Xuanjing Huang. 2020. Pre-trained models for natural language processing: A survey. SCTS, pages 1-26. +Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. 2020. Exploring the limits of transfer learning with a unified text-to-text transformer. JMLR, 21:140:1-140:67. +Timo Schick and Hinrich Schütze. 2021. It's not just size that matters: Small language models are also few-shot learners. In Proceedings of NAACL-HLT, pages 2339-2352. +Elad Segal, Avia Efrat, Mor Shoham, Amir Globerson, and Jonathan Berant. 2020. A simple and effective model for answering multi-span questions. In Proceedings of EMNLP, pages 3074-3080. +Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D. Manning, Andrew Ng, and Christopher Potts. 2013. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of EMNLP, page 1631-1642. +Ellen M. Voorhees and Dawn M. Tice. 2000. Building a question answering test collection. In Proceedings of SIGIR, pages 200-207. + +Wenhan Xiong, Jingfei Du, William Yang Wang, and Veselin Stoyanov. 2020. Pretrained encyclopedia: Weakly supervised knowledge-pretrained language model. In Proceedings of ICLR. +Han Xu, Zhang Zhengyan, et al. 2021. Pre-trained models: Past, present and future. arXiv preprint arXiv:2106.07139. +Zhilin Yang, Zihang Dai, Yiming Yang, Jaime G. Carbonell, Ruslan Salakhutdinov, and Quoc V. Le. 2019. XLNet: Generalized autoregressive pretraining for language understanding. In Proceedings of NeurIPS, pages 5754-5764. +Deming Ye, Yankai Lin, Jiaju Du, Zhenghao Liu, Peng Li, Maosong Sun, and Zhiyuan Liu. 2020. Coreferential reasoning learning for language representation. In Proceedings of EMNLP, pages 7170-7186. +Tianyi Zhang, Felix Wu, Arzoo Katiyar, Kilian Q. Weinberger, and Yoav Artzi. 2021. Revisiting few-sample BERT fine-tuning. In Proceedings of ICLR. +Xiang Zhang, Junbo Zhao, and Yann LeCun. 2015. Character-level convolutional networks for text classification. In Proceedings of NIPS, pages 649-657. + +# A Implementation Details + +In this work, we take ELECTRA (Clark et al., 2020) as an representative example of discriminative PLMs, including (1) $\mathrm{ELECTRA}_{\mathrm{base}}$ with 768 dimensional hidden representations, 12 encoding layers and 110M parameters, and (2) $\mathrm{ELECTRA}_{\mathrm{large}}$ with 1, 024 dimensional hidden representations, 24 encoding layers and 340M parameters. + +For text classification tasks, we follow the hyperparameters in Clark et al. (2020), and train the base models for 10 epochs with learning rate 2e-5 and batchsize 32 on 2 GeForce RTX 2080 Ti GPUs. And we train the large models for 10 epochs with learning rate 2e-5 and batchsize 8 on 2 GeForce RTX 2080 Ti GPUs. For question answering, we follow the hyperparameters in Segal et al. (2020), and train the large models for 20 epochs with learning rate 5e-6 and batchsize 2 on 6 GeForce RTX 2080 Ti GPUs. During inference, a token is considered as part of the answer if its score is lower than 0.6. + +# B Dataset Details + +We evaluate DPT on four popular text classification datasets, including SST-2 (Socher et al., 2013), SST-5 (Socher et al., 2013), TREC (Voorhees and Tice, 2000) and AGNews (Zhang et al., 2015). For question answering task, we adopt the challenging QUOREF dataset (Dasigi et al., 2019), where there may exist multiple answers in the paragraph for + +![](images/a7eb02c09b08aa63a1954852156709d18c27c5a2a893145a3d54ebb5020f439b.jpg) +(a) Full Set. + +![](images/09a3c3ee00241ab14197c28d98308fb0f6697151a69aea537d6d2d7c01da5a3d.jpg) +(b) Low Resource. +Figure 3: Performance distribution of ELECTRAlarge using fine-tuning and DPT from 10 seeds. + +each question. Specifically, QUOREF contains 21,817 questions and 4,225 paragraphs, where each question has 1.15 answers on average. The average length for the questions and paragraphs are 15.49 and 325.68 respectively. We report the results on the validation set for QUOREF, since its test set is not publicly available, and report the results on the test set for the other datasets. + +# C Further Results of Tuning Stability + +We report the performance distribution of AGNews in Figure 3. We observe that the unstable problem of fine-tuning large discriminative PLMs remains even for the large-scale AGNews dataset with 120K training samples. The results show the advantage of DPT in stably tuning discriminative PLMs. \ No newline at end of file diff --git a/prompttuningfordiscriminativepretrainedlanguagemodels/images.zip b/prompttuningfordiscriminativepretrainedlanguagemodels/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..6198189bb4a431b02541b387a500ba68d4d9d248 --- /dev/null +++ b/prompttuningfordiscriminativepretrainedlanguagemodels/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:17d9529309c44fc6bafdc7de4390e994008cda8397ccd1585c59d897c2932561 +size 247025 diff --git a/prompttuningfordiscriminativepretrainedlanguagemodels/layout.json b/prompttuningfordiscriminativepretrainedlanguagemodels/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..f6da3d2ab02c7abe4d1c09c7dc0fcf8aba444260 --- /dev/null +++ b/prompttuningfordiscriminativepretrainedlanguagemodels/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:63d11e14c6175aabce6c6384f9e0a578c53e97ce7762fe46c82c07448165ed19 +size 210836 diff --git a/queryandextractrefiningeventextractionastypeorientedbinarydecoding/c5dc43d9-fb58-40e8-a821-2d94f1cba382_content_list.json b/queryandextractrefiningeventextractionastypeorientedbinarydecoding/c5dc43d9-fb58-40e8-a821-2d94f1cba382_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..3bb9a1eea3403ff4abe87218a3ef5a938b6c7cfe --- /dev/null +++ b/queryandextractrefiningeventextractionastypeorientedbinarydecoding/c5dc43d9-fb58-40e8-a821-2d94f1cba382_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9f6baf47073cd973751e847c0c0cc6937159ce5f4bf045315a072a5ddd8247a0 +size 98130 diff --git a/queryandextractrefiningeventextractionastypeorientedbinarydecoding/c5dc43d9-fb58-40e8-a821-2d94f1cba382_model.json b/queryandextractrefiningeventextractionastypeorientedbinarydecoding/c5dc43d9-fb58-40e8-a821-2d94f1cba382_model.json new file mode 100644 index 0000000000000000000000000000000000000000..08d7ec892a790d9e2bbb72f593be91f9541390ae --- /dev/null +++ b/queryandextractrefiningeventextractionastypeorientedbinarydecoding/c5dc43d9-fb58-40e8-a821-2d94f1cba382_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3bf1204be53d4d6d4d56f8d217764133f90d0d796c904b15024806776da6b01b +size 114816 diff --git a/queryandextractrefiningeventextractionastypeorientedbinarydecoding/c5dc43d9-fb58-40e8-a821-2d94f1cba382_origin.pdf b/queryandextractrefiningeventextractionastypeorientedbinarydecoding/c5dc43d9-fb58-40e8-a821-2d94f1cba382_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b9735d47e9da39c273a36c214caaafc8f1fa5ffe --- /dev/null +++ b/queryandextractrefiningeventextractionastypeorientedbinarydecoding/c5dc43d9-fb58-40e8-a821-2d94f1cba382_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f8e1c9ab3b3b702d77cb692b831c670dfe1af8e7d576345ba9df7583308ee301 +size 828572 diff --git a/queryandextractrefiningeventextractionastypeorientedbinarydecoding/full.md b/queryandextractrefiningeventextractionastypeorientedbinarydecoding/full.md new file mode 100644 index 0000000000000000000000000000000000000000..0c804baeab6ce4e8356012abb7f68c7851d824d0 --- /dev/null +++ b/queryandextractrefiningeventextractionastypeorientedbinarydecoding/full.md @@ -0,0 +1,394 @@ +# Query and Extract: Refining Event Extraction as Type-oriented Binary Decoding + +Sijia Wang $^{1}$ , Mo Yu $^{2}$ , Shiyu Chang $^{3}$ , Lichao Sun $^{4}$ , Lifu Huang $^{1}$ + +$^{1}$ Virginia Tech $^{2}$ WeChat AI $^{3}$ University of California Santa Barbara $^{4}$ Lehigh University + +$^{1}$ sijiawang, lifuh}@vt.edu, $^{2}$ moyumyu@tencent.com + +3chang87@ucsb.edu,4lis221@lehigh.edu + +# Abstract + +Event extraction is typically modeled as a multi-class classification problem where event types and argument roles are treated as atomic symbols. These approaches are usually limited to a set of pre-defined types. We propose a novel event extraction framework that uses event types and argument roles as natural language queries to extract candidate triggers and arguments from the input text. With the rich semantics in the queries, our framework benefits from the attention mechanisms to better capture the semantic correlation between the event types or argument roles and the input text. Furthermore, the query-and-extract formulation allows our approach to leverage all available event annotations from various ontologies as a unified model. Experiments on ACE and ERE demonstrate that our approach achieves state-of-the-art performance on each dataset and significantly outperforms existing methods on zero-shot event extraction.1 + +# 1 Introduction + +Event extraction (Grishman, 1997; Chinchor and Marsh, 1998; Ahn, 2006) is a task to identify and type event triggers and participants from natural language text. As shown in Figure 1, married and left are triggers of two event mentions of the Marry and Transport event types respectively. Two arguments are involved in the left event mention: she is an Artifact, and Irap is the Destination. + +Traditional studies usually model event extraction as a multi-class classification problem (McClosky et al., 2011; Li et al., 2013; Chen et al., 2015; Yang and Mitchell, 2016; Nguyen et al., 2016; Lin et al., 2020), where a set of event types are first defined, and then supervised machine learning approaches will detect and classify each candidate event mention or argument into one of the + +![](images/a99b85bb3540c8e2c48ea3cf4424772719e34c0390dbc2a2f8982578800a7828.jpg) +Figure 1: An example of event annotation. + +target types. However, each event type or argument role is treated as an atomic symbol, ignoring their rich semantics in these approaches. Several studies explore the semantics of event types by leveraging the event type structures (Huang et al., 2018), seed event mentions (Bronstein et al., 2015; Lai and Nguyen, 2019), or question answering (QA) (Du and Cardie, 2020; Liu et al., 2020). However, these approaches are still designed for and thus limited to a single target event ontology $^{2}$ , such as ACE (Consortium, 2005) or ERE (Song et al., 2015). + +With the existence of multiple ontologies and the challenge of handling new emerging event types, it is necessary to study event extraction approaches that are generalizable and can use all available training data from distinct event ontologies. + +To this end, we propose a new event extraction framework following a query-and-extract paradigm. Our framework represents event types and argument roles as natural language queries with rich semantics. The queries are then used to extract the corresponding event triggers and arguments by leveraging our proposed attention mechanism to capture their interactions with input texts. Specifically, (1) for trigger detection, we formulate each event type as a query based on its type name and a short list of prototype triggers, and make binary decoding of each token based on its query-aware + +![](images/a44586108bdeb644de1f190f20a8d584aa602003599bf652ff38f242bf26178f.jpg) +Figure 2: Architecture overview. Each cell in Argument Role Score Matrix indicates the probabilities of an entity being labeled with an argument role. The arrows in Multiway Attention module show four attention mechanisms: (a) entity to argument roles, (b) argument role to entities, (c) entity to entities, (d) argument role to argument roles. + +embedding; (2) for argument extraction, we put together all argument roles defined under each event type as a query, followed by a multiway attention mechanism to extract all arguments of each event mention with one-time encoding, with each argument predicted as binary decoding. + +Our approach can naturally handle various ontologies as a unified model - compared to previous studies (Nguyen and Grishman, 2016; Wadden et al., 2019; Lin et al., 2020), our binary decoding mechanism directly works with any event type or argument role represented as natural language queries, thus effectively leveraging cross-ontology event annotations and making zero-shot predictions. Moreover, compared with the QA-based methods (Du and Cardie, 2020; Liu et al., 2020; Li et al., 2020a) that can also conduct zero-shot argument extraction, our approach does not require creating high-quality questions for argument roles or multi-time encoding for different argument roles separately, thus being more accurate and efficient. + +We evaluate our approach on two public benchmark datasets, ACE and ERE, and demonstrate state-of-the-art performance in the standard supervised event extraction and the challenging transfer learning settings that generalize to new event types and ontologies. Notably, on zero-shot transfer to new event types, our approach outperforms a strong baseline by $16\%$ on trigger detection and $26\%$ on + +argument detection. The overall contributions of our work are: + +- We refine event extraction as a query-and-extract paradigm, which is more generalizable and efficient than previous top-down classification or QA-based approaches. +- We design a new event extraction model that leverages rich semantics of event types and argument roles, improving accuracy and generalizability. +- We establish new state-of-the-art performance on ACE and ERE in supervised and zero-shot event extraction and demonstrate our framework as an effective unified model for cross ontology transfer. + +# 2 Our Approach + +As Figure 2 shows, given an input sentence, we first identify the candidate triggers for each event type by taking it as a query to the sentence. Each event type, such as Attack, is represented with a natural language text, including its type name and a shortlist of prototype triggers, such as invaded and airstrikes, which are selected from the training examples. Then, we concatenate the input sentence with the event type query, encode them with a pre-trained BERT encoder (Devlin et al., 2019), + +compute the attention distribution over the sequential representation of the event type query for each input token, and finally classify each token into a binary label, indicating it as a trigger candidate of the specific event type or not. + +To extract the arguments for each candidate trigger, we follow a similar strategy and take the set of pre-defined argument roles for its corresponding event type as a query to the input sentence. We use another BERT encoder to learn the contextual representations for the input sentence and the query of the argument roles. Then, we take each entity of the input sentence as a candidate argument and compute the semantic correlation between entities and argument roles with multiway attention, and finally classify each entity into a binary label in terms of each argument role. + +# 2.1 Trigger Detection + +Event Type Representation A simple and intuitive way of representing an event type is to use the type name. However, the type name itself cannot accurately represent the semantics of the event type due to the ambiguity of the type name and the variety of the event mentions of each type. For example, Meet can refer to an organized event or an action of getting together or matching. Inspired by previous studies (Bronstein et al., 2015; Lai and Nguyen, 2019), we use a short list of prototype triggers to enrich the semantics of each event type. + +Specifically, for each event type $t$ , we collect a set of annotated triggers from the training examples. For each unique trigger word, we compute its frequency from the whole training dataset as $f_{o}$ and its frequency of being tagged as an event trigger of type $t$ as $f_{t}$ , and then obtain a probability $f_{t} / f_{o}$ which will be used to sort all the annotated triggers for event type $t$ . We select the top- $K^4$ ranked words as prototype triggers $\{\tau_1, \tau_2, \dots, \tau_K\}$ . + +Finally, each event type will be represented with a natural language sequence of words, consisting of its type name and the list of prototype triggers $T = \{t, \tau_1^t, \tau_2^t, \dots, \tau_K^t\}$ . Taking the event type Attack as an example, we finally represent it as Attack invaded airstrikes overthrew ambushed. + +Context Encoding Given an input sentence $W = \{w_{1},w_{2},\ldots ,w_{N}\}$ , we take each event type $T = \{t,\tau_1^t,\tau_2^t,\dots ,\tau_K^t\}$ as a query to extract the corresponding event triggers. Specifically, we first + +concatenate them into a sequence as follows: + +$$ +[ \mathrm {C L S} ] [ \mathrm {E V E N T} ] [ \mathrm {S E P} ] w _ {1} \dots w _ {N} [ \mathrm {S E P} ] +$$ + +$$ +t \tau_ {1} ^ {t} \dots \tau_ {K} ^ {t} [ \mathrm {S E P} ] +$$ + +where [SEP] is a separator from the BERT encoder (Devlin et al., 2019). Following (Liu et al., 2020), we use a special symbol [EVENT] to emphasis the trigger detection task. + +Then we use a pre-trained BERT encoder to encode the whole sequence and get contextual representations for the input sentence $\mathbf{W} = \{\pmb{w}_0, \pmb{w}_2, \dots, \pmb{w}_N\}$ as well as the event type $T = \{t, \tau_0^t, \tau_1^t, \dots, \tau_K^t\}$ . + +Enriched Contextual Representation Given a query of each event type, we aim to automatically extract corresponding event triggers from the input sentence. To achieve this goal, we need to capture the semantic correlation of each input token to the event type. Thus we apply attention mechanism to learn a weight distribution over the sequence of contextual representations of the event type query and get an event type aware contextual representation for each token: + +$$ +\boldsymbol {A} _ {i} ^ {T} = \frac {1}{T} \sum_ {j = 1} ^ {| T |} \alpha_ {i j} \cdot \boldsymbol {T} _ {j}, +$$ + +$$ +\alpha_ {i j} = \cos (\boldsymbol {w} _ {i}, \boldsymbol {T} _ {j}), +$$ + +where $T_{j}$ is the contextual representation of the $j$ -th token in the sequence $T = \{t, \tau_{1}^{t}, \tau_{2}^{t}, \dots, \tau_{K}^{t}\}$ . $\cos(\cdot)$ is the cosine similarity function between two vectors. $A_{i}^{T}$ denotes the event type $t$ aware contextual representation of token $w_{i}$ . + +In addition, the prediction of event triggers also depends on the occurrence of a particular context. For example, according to ACE event annotation guidelines (Consortium, 2005), to qualify as a Meet event, the meeting must be known to be "face-to-face and physically located somewhere". To capture such context information, we further apply in-context attention to capture the meaningful contextual words for each input token: + +$$ +\boldsymbol {A} _ {i} ^ {W} = \frac {1}{N} \sum_ {j = 1} ^ {N} \tilde {\alpha} _ {i j} \cdot \boldsymbol {w} _ {j}, +$$ + +$$ +\tilde {\alpha} _ {i j} = \rho (\boldsymbol {w} _ {i}, \boldsymbol {w} _ {j}), +$$ + +where $\rho (.)$ is the attention function and is computed as the average of the self-attention weights from the last $m$ layers of BERT.6 + +Event Trigger Detection With the event type oriented attention and in-context attention mechanisms, each token $w_{i}$ from the input sentence will obtain two enriched contextual representations $A_{i}^{W}$ and $A_{i}^{T}$ . We concatenate them with the original contextual representation $w_{i}$ from the BERT encoder, and classify it into a binary label, indicating it as a candidate trigger of event type $t$ or not: + +$$ +\tilde {\pmb {y}} _ {i} ^ {t} = \pmb {U} _ {o} \cdot ([ \pmb {w} _ {i}; \pmb {A} _ {i} ^ {W}; \pmb {A} _ {i} ^ {T}; \pmb {P} _ {i} ]), +$$ + +where $[\cdot ]$ denotes concatenation operation, $U_{o}$ is a learnable parameter matrix for event trigger detection, and $P_{i}$ is the one-hot part-of-speech (POS) encoding of word $w_{i}$ . We optimize the following objective for event trigger detection + +$$ +\mathcal {L} _ {1} = - \frac {1}{| \mathcal {T} | | \mathcal {N} |} \sum_ {t \in \mathcal {T}} \sum_ {i = 1} ^ {| \mathcal {N} |} \boldsymbol {y} _ {i} ^ {t} \cdot \log \tilde {\boldsymbol {y}} _ {i} ^ {t}, +$$ + +where $\mathcal{T}$ is the set of target event types and $\mathcal{N}$ is the set of tokens from the training dataset. $\pmb{y}_i^t$ denotes the groundtruth label vector. + +# 2.2 Event Argument Extraction + +After detecting event triggers for each event type, we further extract their arguments based on the pre-defined argument roles of each event type. + +Context Encoding Given a candidate trigger $r$ from the sentence $W = \{w_{1}, w_{2}, \ldots, w_{N}\}$ and its event type $t$ , we first obtain the set of predefined argument roles for event type $t$ as $G^{t} = \{g_{1}^{t}, g_{2}^{t}, \ldots, g_{D}^{t}\}$ . To extract the corresponding arguments for $r$ , similar as event trigger detection, we take all argument roles $G^{t}$ as a query and concatenate them with the original input sentence + +$$ +[ \mathrm {C L S} ] w _ {1} w _ {2} \dots w _ {N} [ \mathrm {S E P} ] g _ {1} ^ {t} g _ {2} ^ {t} \dots g _ {D} ^ {t} [ \mathrm {S E P} ] +$$ + +where we use the last [SEP] separator to denote Other category, indicating the entity is not an argument. Then, we encode the whole sequence with another pre-trained BERT encoder (Devlin et al., 2019) to get the contextual representations of the sentence $\tilde{\boldsymbol{W}} = \{\tilde{\boldsymbol{w}}_0,\tilde{\boldsymbol{w}}_2,\dots,\tilde{\boldsymbol{w}}_N\}$ , and the argument roles $\boldsymbol{G}^{t} = \{\boldsymbol{g}_{0}^{t},\boldsymbol{g}_{1}^{t},\dots,\boldsymbol{g}_{D}^{t},\boldsymbol{g}_{[\mathrm{Other}]}^{t}\}$ . + +As the candidate trigger $r$ may span multiple tokens within the sentence, we obtain its contextual representation $r$ as the average of the contextual representations of all tokens within $r$ . In addition, as the arguments are usually detected + +from the entities of sentence $W$ , we apply a BERT-CRF model, which is optimized on the same training set as event extraction to identify the entities $E = \{e_1, e_2, \dots, e_M\}$ . As each entity may also span multiple tokens, following the same strategy, we average the contextual representations of all tokens within each entity and obtain the entity contextual representations as $E = \{e_1, e_2, \dots, e_M\}$ . + +Multiway Attention Given a candidate trigger $r$ of type $t$ and an entity $e_i$ , for each argument role $g_j^t$ , we need to determine whether the underlying relation between $r$ and $e_i$ corresponds to $g_j^t$ or not, namely, whether $e_i$ plays the argument role of $g_j^t$ in event mention $r$ . To do this, for each $e_i$ , we first obtain a trigger-aware entity representation as + +$$ +\pmb {h} _ {i} = \pmb {U} _ {h} \cdot ([ \pmb {e} _ {i}; \pmb {r}; \pmb {e} _ {i} \circ \pmb {r} ]), +$$ + +where $\circ$ denotes element-wise multiplication operation. $U_{h}$ is a learnable parameter matrix. + +In order to determine the semantic correlation between each argument role and each entity, we first compute a similarity matrix $S$ between the trigger-aware entity representations $\{h_1, h_2, \dots, h_M\}$ and the argument role representations $\{g_0^t, g_1^t, \dots, g_D^t\}$ . + +$$ +S _ {i j} = \frac {1}{\sqrt {d}} \sigma (\boldsymbol {h} _ {i}, \boldsymbol {g} _ {j} ^ {t}) , +$$ + +where $\sigma$ denotes dot product operator, $d$ denotes embedding dimension of $\pmb{g}^t$ , and $S_{ij}$ indicates the semantic correlation of entity $e_i$ to a particular argument role $g_j^t$ given the candidate trigger $r$ . + +Based on the correlation matrix $S$ , we further apply a bidirectional attention mechanism to get an argument role aware contextual representation for each entity and an entity-aware contextual representation for each argument role as follows: + +$$ +\boldsymbol {A} _ {i} ^ {e 2 g} = \sum_ {j = 1} ^ {D} \boldsymbol {S} _ {i j} \cdot \boldsymbol {g} _ {j} ^ {t}, +$$ + +$$ +\boldsymbol {A} _ {j} ^ {g 2 e} = \sum_ {i = 1} ^ {M} \boldsymbol {S} _ {i j} \cdot \boldsymbol {h} _ {i}. +$$ + +In addition, previous studies (Hong et al., 2011; Li et al., 2013; Lin et al., 2020) have revealed that the underlying relations among entities or argument roles are also important to extract the arguments. For example, if entity $e_1$ is predicted as Attacker of an Attack event and $e_1$ is located in another entity $e_2$ , it's very likely that $e_2$ plays an argument role of Place for the Attack event. To capture the + +underlying relations among the entities, we further compute the self-attention among them + +$$ +\begin{array}{l} \mu_ {i j} = \frac {1}{\sqrt {d}} \sigma (\boldsymbol {h} _ {i}, \boldsymbol {h} _ {j}), \quad \tilde {\boldsymbol {\mu}} _ {i} = \operatorname {S o f t m a x} (\boldsymbol {\mu} _ {i}), \\ \boldsymbol {A} _ {i} ^ {e 2 e} = \sum_ {j = 1} ^ {M} \tilde {\mu} _ {i j} \cdot \boldsymbol {h} _ {j}. \\ \end{array} +$$ + +Similarly, to capture the underlying relations among argument roles, we also compute the self-attention among them + +$$ +\begin{array}{l} v _ {j k} = \frac {1}{\sqrt {d}} \sigma (\boldsymbol {g} _ {j} ^ {t}, \boldsymbol {g} _ {k} ^ {t}), \quad \tilde {\boldsymbol {v}} _ {j} = \operatorname {S o f t m a x} (\boldsymbol {v} _ {j}), \\ \boldsymbol {A} _ {j} ^ {g 2 g} = \sum_ {k = 1} ^ {D} \tilde {\boldsymbol {v}} _ {j k} \cdot \boldsymbol {g} _ {k} ^ {t}. \\ \end{array} +$$ + +Event Argument Predication Finally, for each candidate event trigger $r$ , we determine whether an entity $e_i$ plays an argument role of $g_j^t$ in the event mention by classifying it into a binary class: + +$$ +\tilde {\pmb {z}} _ {i j} ^ {t} = \pmb {U} _ {a} \cdot ([ \pmb {h} _ {i}; \pmb {g} _ {j} ^ {t}; \pmb {A} _ {i} ^ {e 2 g}; \pmb {A} _ {j} ^ {g 2 e}; \pmb {A} _ {i} ^ {e 2 e}; \pmb {A} _ {j} ^ {g 2 g} ]), +$$ + +where $\mathbf{U}_a$ is a learnable parameter matrix for argument extraction. And $\tilde{z}^t$ is argument role score matrix for event type $t$ . The training objective is to minimize the following loss function: + +$$ +\mathcal {L} _ {2} = - \frac {1}{| \mathcal {A} | | \mathcal {E} |} \sum_ {j = 1} ^ {| \mathcal {A} |} \sum_ {i = 1} ^ {| \mathcal {E} |} z _ {i j} \log \tilde {z} _ {i j}, +$$ + +where $\mathcal{A}$ denotes the collection of possible argument roles, and $\mathcal{E}$ is the set of entities we need to consider for argument extraction. $z_{ij}$ denotes the ground truth label vector. During test, an entity will be labeled as a non-argument if the prediction for Other category is 1. Otherwise, it can be labeled with multiple argument roles. + +# 3 Experiments + +# 3.1 Experimental Setup + +We perform experiments on two public benchmarks, ACE05- $\mathrm{E}^{+7}$ and ERE-EN (Song et al., 2015) $^8$ . ACE defines 33 event types while ERE includes 38 types, among which there are 31 overlapped event types. We use the same data split of + +ACE and ERE as (Wadden et al., 2019; Lin et al., 2020; Du and Cardie, 2020) for supervised event extraction. For zero-shot event extraction, we use the top-10 most popular event types in ACE as seen types for training and treat the remaining 23 event types as unseen for testing, following Huang et al. (2018). In our experiments, we use random seeds and report averaged scores of each setting. More details regarding the data statistics and evaluation are shown in Appendix A. + +We further design two more challenging and practical settings to evaluate how well the approach could leverage resources from different ontologies: (1) cross-ontology direct transfer, where we only use the annotations from ACE or ERE for training and directly test the model on another event ontology. This corresponds to the domain adaptation setting in transfer learning literature; (2) joint-ontology enhancement, where we take the annotations from both ACE and ERE as the training set and test the approaches on ACE or ERE ontology separately. This corresponds to the multi-domain learning setting in transfer learning literature. Intuitively, an approach with good transferability should benefit more from the enhanced training data from other ontologies. We follow the same train/dev/test splits of ACE and ERE as supervised event extraction. + +# 3.2 Supervised Event Extraction + +Table 1 shows the supervised event extraction results of various approaches on ACE and ERE datasets. Though studies (Yang and Mitchell, 2016; Liu et al., 2020, 2018; Sha et al., 2018; Lai et al., 2020; Veyseh et al., 2020) have been conducted on the ACE dataset, they follow different settings9, especially regarding whether the Time and Value arguments are considered and whether all Time-related argument roles are viewed as a single role. Following several recent state-of-the-art studies (Wadden et al., 2019; Lin et al., 2020; Du and Cardie, 2020), we do not consider Time and Value arguments. Our approach significantly outperforms most of the previous comparable baseline methods, especially on the ERE dataset10. Next, we take BERT_QA(Arg, a QA_based method, as the main baseline as it shares similar ideas to our approach to compare their performance. + +
ModelACE05-E+ERE-EN
Trigger Ext.Argument Ext.Trigger Ext.Argument Ext.
DYGIE++ (Wadden et al., 2019)67.3*42.7*--
BERT_QA(Arg (Du and Cardie, 2020)70.6*48.3*57.039.2
OneIE (Lin et al., 2020)72.854.857.046.5
Text2Event (Lu et al., 2021)71.854.459.448.3
FourIE (Nguyen et al., 2021)73.357.557.948.6
Our Approach73.6 (0.2)55.1 (0.5)60.4 (0.3)50.4 (0.3)
+ +Specifically, for trigger detection, all the baseline methods treat the event types as symbols and classify each input token into one of the target types or Other. So they heavily rely on human annotations and do not perform well when the annotations are not enough. For example, there are only 31 annotated event mentions for End_Org in the ACE05 training dataset, so BERT_QA(Arg only achieves $35.3\%$ F-score. In comparison, our approach leverages the semantic interaction between the input tokens and the event types. Therefore it still performs well when the annotations are limited, e.g., it achieves $66.7\%$ F-score for End_Org. In addition, by leveraging the rich semantics of event types, our approach also successfully detects event triggers that are rarely seen in the training dataset, e.g., ousting and purge of End-Position, while BERT_QA(Arg misses all these triggers. A more detailed discussion about the impact of seed triggers is in Appendix B. + +For argument extraction, our approach shows more consistent results than baseline methods. For example, in the sentence "Shalom was to fly on to London for talks with British Prime Minister Tony Blair and Foreign Secretary Jack Straw", the BERT_QA(Arg method correctly predicts Tony Blair and Jack Straw as Entity arguments of the Meet event triggered by talks, but misses Shalom. However, by employing multiway attention, especially the self-attention among all the entities, our approach can capture their underlying semantic relations, e.g., Shalom and Tony Blair are two persons to talk, so that it successfully predicts all the three Entity arguments for the Meet event. + +# 3.3 Zero-Shot Event Extraction + +As there are no fully comparable baseline methods for zero-shot event extraction, we adapt one of the most recent states of the arts, BERT_QA(Arg (Du + +Table 1: Event extraction results on ACE05-E $^{+}$ and ERE-EN datasets (F-score, %). * indicates scores obtained from their released codes. The performance of BERT_QA(Arg is lower than that reported in (Du and Cardie, 2020) as they only consider single-token event triggers. Each score of our approach is the mean of three runs and the variance is shown in parenthesis. + +
ModelTrigger Ext.Arg Ext. (GT)
BERT_QA_Arg†31.617.0
Our Approach47.843.0
+ +Table 2: Zero-shot F-scores on 23 unseen event types. †: adapted implementation from (Du and Cardie, 2020). GT indicates using gold-standard triggers as input. + +and Cardie, 2020), which is expected to have specific transferability due to its QA formulation. However, the original BERT_QA(Arg) utilizes a generic query, e.g., "trigger" or "verb", to classify each input token into one of the target event types or Other, thus is not capable of detecting event mentions for any new event types during the test. We adapt the BERT_QA(Arg) framework by taking each event type instead of the generic words as a query for event detection. Note that our approach utilizes the event types as queries without prototype triggers for zero-shot event extraction. + +As Table 2 shows, our approach significantly outperforms BERT_QA(Arg under zero-shot event extraction, with over $16\%$ F-score gain on trigger detection and $26\%$ F-score gain on argument extraction. Comparing with BERT_QA(Arg, which only relies on the self-attention from the BERT encoder to learn the correlation between the input tokens and the event types or argument roles, our approach further applies multiple carefully designed attention mechanisms over BERT contextual representations to better capture the semantic interaction between event types or argument roles and input tokens, yielding much better accuracy and generalizability. + +We further pick 13 unseen event types and analyze our approach's zero-shot event extraction performance on each of them. As shown in Figure 3, our approach performs exceptionally well on + +
SourceTargetBERT_QA_ArgmultiBERT_QA_Argbinary†Our Approach
Trigger Ext.Argument Ext.Trigger Ext.Argument Ext.Trigger Ext.Argument Ext.
EREACE48.9 (48.9)18.5 (18.5)50.8 (50.8)20.9 (20.9)53.9 (52.6)30.2 (29.6)
ACEACE70.648.372.250.473.655.1
ACE+EREACE70.147.071.349.874.456.2
ACEERE47.2 (47.2)18.0 (18.0)47.2 (45.0)17.9 (17.1)55.9 (46.3)31.9 (26.0)
EREERE57.039.256.742.960.450.4
ACE+EREERE57.038.654.637.163.052.3
+ +Table 3: Cross ontology transfer between ACE and ERE datasets (F-score %). The scores in parenthesis indicate the performance on the ACE and ERE shared event types. + +![](images/e4c229affe16c39ce9a8c56088a4ea62d87296e3186b5dd9d551292c0e459629.jpg) +Figure 3: Zero-shot event extraction on each unseen event type. The number in parenthesis indicates # gold event mentions of each unseen type in the test set. + +Marry, Divorce, Trial-Hearing, and Fine, but worse on Sue, Release-Parole, Charge-Indict, Demonstrate, and Declare-Bankruptcy, with two possible reasons: first, the semantics of event types, such as Marry, Divorce, is more straightforward and explicit than other types, such as Charge-Indict, Declare-Bankruptcy. Thus our approach can better interpret these types. Second, the diversity of the event triggers for some types, e.g., Divorce, is much lower than other types, e.g., Demonstrate. For example, among the 9 Divorce event triggers, there are only 2 unique strings, i.e., divorce and breakdowns, while there are 6 unique strings among the 7 event mentions of Demonstrate. + +# 3.4 Cross Ontology Transfer + +For cross-ontology transfer, we develop two variations of BERT_QA(Arg as baseline methods: (1) BERT_QA(Argmulti, which is the same as the original implementation and use multi-classification to detect event triggers. (2) BERT_QA(Argbinary, for which we apply the same query adaptation as Section 3.3 and use multiple binary-classification for event detection. For joint-ontology enhancement, we combine the training datasets of ACE and ERE + +and optimize the models from scratch.[11] + +Table 3 shows the cross-ontology transfer results in both direct transfer and enhancement settings. Our approach significantly outperforms the baseline methods under all the settings. Notably, for direct transfer, e.g., from ERE to ACE, by comparing the F-scores on the whole test set with the performance on the ACE and ERE shared event types (F-scores shown in parenthesis), our approach not only achieves better performance on the shared event types but also extracts event triggers and arguments for the new event types in ACE. In contrast, the baseline methods hardly extract any events or arguments for the new event types. Moreover, by combining the training datasets of ACE and ERE for joint-ontology enhancement, our approach's performance can be further boosted compared with using the annotations of the target event ontology only, demonstrating the superior transfer capability across different ontologies. For example, ACE includes a Transport event type while ERE defines two more fine-grained types Transport-Person and Transport-Artifact. By adding the annotations of Transport-Person and Transport-Artifact from ERE into ACE, our approach can capture the underlying semantic interaction between Transport-related event type queries and the corresponding input tokens and thus yield $1.5\%$ F-score gain on the Transport event type of ACE test set. In contrast, both baseline methods fail to be enhanced with additional annotations from a slightly different event ontology without explicitly capturing semantic interaction between event types and input tokens. Appendix C provides a more in-depth comparison between our approach and the baseline approaches. + +# 3.5 Ablation Study + +We further evaluate the impact of each attention mechanism on event trigger detection and argument extraction. As Table 4 shows, all the attention mechanisms show significant benefit to trigger or argument extraction, especially on the ERE dataset. The Event Type Attention and Multiway Attention show the most effects to trigger and argument extraction, which is understandable as they are designed to capture the correlation between the input texts and the event type or argument role-based queries. We also notice that, without taking entities detected by the BERT-CRF name tagging model as input, but instead considering all the tokens as candidate arguments12, our approach still shows competitive performance for argument extraction compared with the strong baselines. More ablation studies are discussed in Appendix D. + +
ModelACEERE
TriggerOur Approach73.660.4
w/o Seed Trigger72.258.2
w/o In-Context Attention72.357.9
w/o Event Type Attention71.156.9
Arg.Our Approach55.150.4
w/o Entity Detection53.047.6
w/o Multiway Attention53.442.8
w/o Entity Self-attention53.748.3
w/o Arg Role Self-attention54.147.7
+ +Table 4: Results of various ablation studies. Each score is the average of three runs for each experiment. + +# 3.6 Pros and Cons of Type-oriented Decoding + +The advantages of our type-oriented binary decoding include: (1) it allows the model to better leverage the semantics of event types which have been proved effective for both supervised and zero-shot event extraction; (2) it allows the approach to leverage all available event annotations from distinct ontologies, which is demonstrated in zero-shot event extraction and cross-ontology transfer; (3) in practice, new event types and annotations could emerge incessantly, and it is not possible to always train a model for all the event types. Our approach has the potential to be continuously updated and extract events for any desired event types. + +We also admit that binary decoding usually increases the computation cost. We design two strategies to mitigate this issue: (1) More than $69\%$ of + +the sentences in the training dataset do not contain any event triggers, so we randomly sample $20\%$ of them for training. (2) Our one-time argument encoding and decoding strategies extract all arguments of each event trigger at once. It is more efficient than the previous QA-based approaches, which only extract arguments for one argument role at once. With these strategies, for trigger detection, our approach takes $80\%$ more time for training and $19\%$ less for inference compared with BERT_QA_Arg which relies on multiclass classification, while for argument extraction, our approach takes $36\%$ less time for training and inference than BERT_QA_Arg. Even on a more fine-grained event ontology MAVEN (Wang et al., 2020), which consists of 168 event types, for trigger extraction, our approach roughly takes $20\%$ more time for training and twice the time for inference compared with BERT_QA_Arg, with slightly better performance than the state of the art (Wang et al., 2021) $^{13}$ . + +# 4 Related Work + +Traditional event extraction studies (McClosky et al., 2011; Li et al., 2013; Chen et al., 2015; Cao et al., 2015; Feng et al., 2016; Yang and Mitchell, 2016; Nguyen et al., 2016; Zhang et al., 2017; Wadden et al., 2019; Lin et al., 2020; Wang et al., 2021) usually detect event triggers and arguments with multi-class classifiers. Unlike all these methods that treat event types and argument roles as symbols, our approach considers them queries with rich semantics and leverages the semantic interaction between input tokens and each event type or argument role. + +Several studies have explored the semantics of event types based on seed event triggers (Bronstein et al., 2015; Lai and Nguyen, 2019; Zhang et al., 2021), event type structures (Huang et al., 2016, 2018), definitions (Chen et al., 2019) and latent representations (Huang and Ji, 2020). However, they can hardly be generalized to argument extraction. Question answering based event extraction (Du and Cardie, 2020; Liu et al., 2020; Li et al., 2020a; Lyu et al., 2021) can take advantage of the semantics of event types and the large-scale question answering datasets. Compared with these methods, there are three different vital designs, making our approach perform and be generalized better than these + +QA-based approaches: (1) our approach directly takes event types and argument roles as queries. In contrast, previous QA-based approaches rely on templates or generative modules to create natural language questions. However, it is difficult to find the optimal format of questions for each event type, and many studies (Du and Cardie, 2020; Li et al., 2020b) have shown that MRC or QA models are sensitive to the subtle change of the questions. (2) QA-based approaches can only detect arguments for one argument role at once, while our approach extracts all arguments of an event trigger with one-time encoding and decoding, which is more efficient and leverages the implicit relations among the candidate arguments or argument roles. (3) QA-based approaches rely on span prediction to extract arguments without requiring entity extraction, which could result in more entity boundary errors. Thus we choose to pre-train a name tagging model and use binary decoding over system detected entities. Moreover, it is pretty challenging to fully adapt the event extraction task to the span-based Question Answering. The main reason is that each sentence may contain multiple triggers for a particular event type. Even if we can formalize a question, e.g., "what is the trigger for Attack?" it is difficult for the model to return all the spans of event triggers correctly. + +# 5 Conclusion and Future Work + +We refine event extraction with a query-and-extract paradigm and design a new framework that leverages rich semantics of event types and argument roles and captures their interactions with input texts using attention mechanisms to extract event triggers and arguments. Experimental results demonstrate that our approach achieves state-of-the-art performance on supervised event extraction and shows prominent accuracy and generalizability to new event types and across ontologies. In the future, we will explore better representations of event types and argument roles and combine them prompt tuning approach further to improve the accuracy and generalizability of event extraction. + +# Acknowledgements + +We thank the anonymous reviewers and area chair for their valuable time and constructive comments, and the helpful discussions with Zhiyang Xu and Minqian Liu. We also thank the support from the Amazon Research Awards. + +# References + +David Ahn. 2006. The stages of event extraction. In Proceedings of the Workshop on Annotating and Reasoning about Time and Events, pages 1-8. +Ofer Bronstein, Ido Dagan, Qi Li, Heng Ji, and Anette Frank. 2015. Seed-based event trigger labeling: How far can event descriptions get us? In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing (Volume 2: Short Papers), pages 372-376. +Susan Brown, Claire Bonial, Leo Obrst, and Martha Palmer. 2017. The rich event ontology. In Proceedings of the Events and Stories in the News Workshop, pages 87-97, Vancouver, Canada. Association for Computational Linguistics. +Kai Cao, Xiang Li, Miao Fan, and Ralph Grishman. 2015. Improving event detection with active learning. In Proceedings of the International Conference on Recent Advances in Natural Language Processing, pages 72-77, Hissar, Bulgaria. INCOMA Ltd. Shoumen, BULGARIA. +Yubo Chen, Liheng Xu, Kang Liu, Daojian Zeng, and Jun Zhao. 2015. Event extraction via dynamic multipooling convolutional neural networks. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 167-176. +Yunmo Chen, Tongfei Chen, Seth Ebner, Aaron Steven White, and Benjamin Van Durme. 2019. Reading the manual: Event extraction as definition comprehension. arXiv preprint arXiv:1912.01586. +Nancy Chinchor and Elaine Marsh. 1998. Muc-7 information extraction task definition. In Proceeding of the seventh message understanding conference (MUC-7), Appendices, pages 359-367. +(LDC) Linguistic Data Consortium. 2005. English annotation guidelines for events. https://www.ldc.upenn.edu/sites/www.ldc.upenn.edu/files/english-events-guidelines-v5.4.3.pdf. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171-4186, Minneapolis, Minnesota. Association for Computational Linguistics. +Xinya Du and Claire Cardie. 2020. Event extraction by answering (almost) natural questions. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), + +pages 671-683, Online. Association for Computational Linguistics. +Xiaocheng Feng, Lifu Huang, Duyu Tang, Heng Ji, Bing Qin, and Ting Liu. 2016. A language-independent neural network for event detection. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 66-71, Berlin, Germany. Association for Computational Linguistics. +Ralph Grishman. 1997. Information extraction: Techniques and challenges. In International summer school on information extraction, pages 10-27. Springer. +Yu Hong, Jianfeng Zhang, Bin Ma, Jianmin Yao, Guodong Zhou, and Qiaoming Zhu. 2011. Using cross-entity inference to improve event extraction. In Proceedings of the 49th annual meeting of the association for computational linguistics: human language technologies, pages 1127-1136. +Lifu Huang, Taylor Cassidy, Xiaocheng Feng, Heng Ji, Clare Voss, Jiawei Han, and Avirup Sil. 2016. Liberal event extraction and event schema induction. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 258-268. +Lifu Huang and Heng Ji. 2020. Semi-supervised new event type induction and event detection. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 718-724. +Lifu Huang, Heng Ji, Kyunghyun Cho, Ido Dagan, Sebastian Riedel, and Clare Voss. 2018. Zero-shot transfer learning for event extraction. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 2160-2170, Melbourne, Australia. Association for Computational Linguistics. +John Lafferty, Andrew McCallum, and Fernando CN Pereira. 2001. Conditional random fields: Probabilistic models for segmenting and labeling sequence data. +Viet Dac Lai and Thien Huu Nguyen. 2019. Extending event detection to new types with learning from keywords. arXiv preprint arXiv:1910.11368. +Viet Dac Lai, Tuan Ngo Nguyen, and Thien Huu Nguyen. 2020. Event detection: Gate diversity and syntactic importance scores for graph convolution neural networks. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 5405-5411, Online. Association for Computational Linguistics. +Fayuan Li, Weihua Peng, Yuguang Chen, Quan Wang, Lu Pan, Yajuan Lyu, and Yong Zhu. 2020a. Event extraction as multi-turn question answering. In *Findings of the Association for Computational Linguistics: EMNLP* 2020, pages 829-838, Online. Association for Computational Linguistics. + +Qi Li, Heng Ji, and Liang Huang. 2013. Joint event extraction via structured prediction with global features. In Proceedings of the 51st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 73-82, Sofia, Bulgaria. Association for Computational Linguistics. +Xiaoya Li, Jingrong Feng, Yuxian Meng, Qinghong Han, Fei Wu, and Jiwei Li. 2020b. A unified MRC framework for named entity recognition. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 5849-5859, Online. Association for Computational Linguistics. +Ying Lin, Heng Ji, Fei Huang, and Lingfei Wu. 2020. A joint neural model for information extraction with global features. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 7999-8009, Online. Association for Computational Linguistics. +Jian Liu, Yubo Chen, Kang Liu, Wei Bi, and Xiaojiang Liu. 2020. Event extraction as machine reading comprehension. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 1641-1651, Online. Association for Computational Linguistics. +Xiao Liu, Zhunchen Luo, and Heyan Huang. 2018. Jointly multiple events extraction via attention-based graph information aggregation. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 1247-1256, Brussels, Belgium. Association for Computational Linguistics. +Yaojie Lu, Hongyu Lin, Jin Xu, Xianpei Han, Jialong Tang, Annan Li, Le Sun, Meng Liao, and Shaoyi Chen. 2021. Text2Event: Controllable sequence-to-structure generation for end-to-end event extraction. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 2795-2806, Online. Association for Computational Linguistics. +Qing Lyu, Hongming Zhang, Elior Sulem, and Dan Roth. 2021. Zero-shot Event Extraction via Transfer Learning: Challenges and Insights. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 2: Short Papers), pages 322-332, Online. Association for Computational Linguistics. +David McClosky, Mihai Surdeanu, and Christopher D Manning. 2011. Event extraction as dependency parsing. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, pages 1626-1635. +Minh Van Nguyen, Viet Dac Lai, and Thien Huu Nguyen. 2021. Cross-task instance representation + +interactions and label dependencies for joint information extraction with graph convolutional networks. + +Thien Huu Nguyen, Kyunghyun Cho, and Ralph Grishman. 2016. Joint event extraction via recurrent neural networks. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 300-309, San Diego, California. Association for Computational Linguistics. + +Thien Huu Nguyen and Ralph Grishman. 2016. Modeling skip-grams for event detection with convolutional neural networks. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 886–891, Austin, Texas. Association for Computational Linguistics. + +Alexandre Passos, Vineet Kumar, and Andrew McCallum. 2014. Lexicon infused phrase embeddings for named entity resolution. In Proceedings of the Eighteenth Conference on Computational Natural Language Learning, pages 78-86, Ann Arbor, Michigan. Association for Computational Linguistics. + +Lei Sha, Feng Qian, Baobao Chang, and Zhifang Sui. 2018. Jointly extracting event triggers and arguments by dependency-bridge rnns and tensor-based argument interaction. In AAAI. + +Zhiyi Song, Ann Bies, Stephanie Strassel, Tom Riese, Justin Mott, Joe Ellis, Jonathan Wright, Seth Kulick, Neville Ryant, and Xiaoyi Ma. 2015. From light to rich ere: annotation of entities, relations, and events. In Proceedings of the 3rd Workshop on EVENTS: Definition, Detection, Coreference, and Representation, pages 89-98. + +Amir Pouran Ben Veyseh, Tuan Ngo Nguyen, and Thien Huu Nguyen. 2020. Graph transformer networks with syntactic and semantic structures for event argument extraction. CoRR, abs/2010.13391. + +David Wadden, Ulme Wennberg, Yi Luan, and Hannaneh Hajishirzi. 2019. Entity, relation, and event extraction with contextualized span representations. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 5784-5789, Hong Kong, China. Association for Computational Linguistics. + +Xiaozhi Wang, Ziqi Wang, Xu Han, Wangyi Jiang, Rong Han, Zhiyuan Liu, Juanzi Li, Peng Li, Yankai Lin, and Jie Zhou. 2020. MIVEN: A massive general domain event detection dataset. In Proceedings of EMNLP 2020. + +Ziqi Wang, Xiaozhi Wang, Xu Han, Yankai Lin, Lei Hou, Zhiyuan Liu, Peng Li, Juanzi Li, and Jie Zhou. 2021. CLEVE: Contrastive Pre-training for Event Extraction. In Proceedings of ACL-IJCNLP, pages + +6283-6297, Online. Association for Computational Linguistics. + +Bishan Yang and Tom M. Mitchell. 2016. Joint extraction of events and entities within a document context. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 289-299, San Diego, California. Association for Computational Linguistics. + +Hongming Zhang, Haoyu Wang, and Dan Roth. 2021. Zero-shot Label-aware Event Trigger and Argument Classification. In *Findings of the Association for Computational Linguistics: ACL-IJCNLP* 2021, pages 1331-1340, Online. Association for Computational Linguistics. + +Tongtao Zhang, Spencer Whitehead, Hanwang Zhang, Hongzhi Li, Joseph Ellis, Lifu Huang, Wei Liu, Heng Ji, and Shih-Fu Chang. 2017. Improving event extraction via multimodal integration. In Proceedings of the 25th ACM international conference on Multimedia, pages 270-278. + +# A Data Statistics and Implementation Details + +Table 5 shows the detailed data statistics of the training, development and test sets of the ACE05-E+ and ERE datasets. The statistics for the ERE dataset is slightly different from previous work (Lin et al., 2020; Lu et al., 2021) as we consider the event triggers that are annotated with multiple types as different instances while the previous studies just keep one annotated type for each trigger span. For example, in the ERE-EN dataset, a token "succeeded" in the sentence "Chun ruled until 1988, when he was succeeded by Roh Tae - woo, his partner in the 1979 coup." triggers a End-Position event of Chun and a Start-Position of Roh. Previous classification based approaches did not predict multiple types for each candidate trigger. + +
DatasetSplit# Events# Arguments
ACE05-E+Train44196605
Dev468757
Test424689
ERE-ENTrain739411576
Dev632979
Test6691078
+ +Table 5: Data statistics for ACE2005 and ERE datasets. + +Zero-Shot Event Extraction To evaluate the transfer capability of our approach, we use the top-10 most popular event types in ACE05 as seen types for training and treat the remaining 23 event + +types as unseen for testing, following Huang et al. (2018). The top-10 training event types include Attack, Transport, Die, Meet, Sentence, Arrest-Jail, Transfer-Money, Elect, Transfer-Ownership, End-Position. We use the same data split as supervised event extraction but only keep the event annotations of the 10 seen types for training and development sets and sample 150 sentences with 120 annotated event mentions for the 23 unseen types from the test set for evaluation. + +Implementation For fair comparison with previous baseline approaches, we use the same pretrained bert-large-uncased model for finetuning and optimize our model with BertAdam. We optimize the parameters with grid search: training epoch 10, learning rate $\in$ [3e-6, 1e-4], training batch size $\in$ {8, 12, 16, 24, 32}, dropout rate $\in$ {0.4, 0.5, 0.6}. Our experiments run on one Quadro RTX 8000. For trigger detection, the average runtime is 3.0 hours. For argument detection, the average runtime is 1.3 hours. We use Spacy to generate POS tags. + +Evaluation Criteria For evaluation of supervised event extraction, we use the same criteria as (Li et al., 2013; Chen et al., 2015; Nguyen et al., 2016; Lin et al., 2020) as follows: + +- Trigger: A trigger mention is correct if its span and event type matches a reference trigger. Each candidate may act as triggers for multiple event occurrences. +- Argument: An argument prediction is correct only if the event trigger is correctly detected. Meanwhile, its span and argument role need to match a reference argument. An argument candidate can be involved in multiple events as different roles. Furthermore, within a single event extent, an argument candidate may play multiple roles. + +# B Impact of Seed Triggers + +To investigate the impact of seed triggers on event trigger extraction, we take the supervised event extraction ACE dataset as a case study, where we divide the triggers in the evaluation dataset into two groups: overlapped triggers with the seeds or non-overlapped ones with the seeds. Then, we compare the performance of our approach with and without using seed triggers as part of the event type + +representations. As Table 6 shows, by incorporating the seed triggers as part of the event type representations, our approach achieves better performance on both overlapped and non-overlapped triggers, demonstrating the benefit of seed triggers on representing event types. As the total number of overlapped triggers (34) is much lower than that of non-overlapped triggers (390), we view the impact of seed triggers on overlapped and non-overlapped triggers as comparable. On the other hand, by comparing our approach without using seed triggers with the BERT_QA(Arg baseline, our approach also achieves much better performance which is mostly due to the attention mechanism we used which can better capture the semantic consistency between the input tokens and the event type query which just consists of the event type name. + +# C In-depth Comparison for Cross Ontology Transfer + +To deeply investigate the reason that our approach performs better than QA-based baselines from cross ontology transfer, we conducted ablation study by removing the seed triggers from the event type queries of our approach, as shown in Table 7. The BERT_QA(Argmulti utilizes a generic query, e.g., what's the trigger, and classify each input token into one of the target types. It's essentially a multiclass classifier but just taking a query as the prompt. The BERT_QA(Argbinary utilizes each event type as the query to extract the corresponding event mentions. Comparing the two baseline methods, BERT_QA(Argbinary works slightly better than BERT_QA(Argmulti, especially on ACE, demonstrating the benefit of type-oriented binary decoding mechanism. The only difference between BERT_QA(Argbinary and our approach without seed triggers is the learning of enriched contextual representations. The comparison of their scores demonstrates the effectiveness of the attention mechanisms designed for trigger extraction. Finally, by incorporating the seed triggers into event type representations, our approach is further improved significantly for all the settings. These in-depth comparisons demonstrate the effectiveness of both seed triggers and the attention mechanisms in our approach for transferring annotations from old types to the new types. + +
Overlapped TriggersNon-overlapped Triggers
OneIE (Lin et al., 2020)88.271.0
BERT_QA(Arg (Du and Cardie, 2020)72.270.9
Our Approach w/o Seed Triggers88.970.8
Out Approach w/ Seed Triggers97.271.3
+ +Table 6: Impact of seed triggers on supervised trigger extraction on ACE (F-score, %) + +
SourceTargetBERT_QA_Argmulti †BERT_QA_Argbinary †Our Approach
w/o Seed Triggersw/ Seed Triggers
EREACE48.950.853.853.9
ACEACE70.672.272.273.6
ACE+EREACE70.171.372.274.4
ACEERE47.247.248.755.9
EREERE57.056.758.260.4
ACE+EREERE57.054.656.263.0
+ +# D More Ablation Studies of Supervised Event Extraction + +The entity recognition model is based on a pretrained BERT (Devlin et al., 2019) encoder with a CRF (Lafferty et al., 2001; Passos et al., 2014) based prediction network. It's trained on the same training dataset from ACE05 before event extraction, and the predictions are taken as input to argument extraction to indicate the candidate argument spans. Table 8 shows the comparison of the entity extraction performance between our BERT-CRF approach and the baselines. + +Table 7: Cross ontology transfer results for queries without seed triggers, between ACE and ERE datasets (F-score %) + +
ModelF1
OneIE89.6
FourIE91.1
BERT+CRF89.3
+ +To understand the factors that affect argument extraction and decompose the errors propagated along the learning process (from predicted triggers or predicted entities), we conduct experiments that condition on given ground truth labels for those factors. Specifically, we investigate three settings: 1) given gold entity, 2) given gold event trigger, and 3) given both gold entity and event trigger. The experimental results is shown in Table 9. + +Table 8: Performance of Entity Extraction (F-score, %) + +
Given InformationACEERE
None55.150.2
GE59.7 (+4.6)59.5 (+9.3)
GT68.7 (+13.6)67.2 (+17.0)
GT & GE74.2 (+19.1)72.2 (+22.0)
+ +Table 9: Performance of argument extraction conditioning on various input information: gold trigger (GT), and gold entities (GE). (F-score, %) + +# E Remaining Challenges for Supervised Event Extraction + +We sample 200 supervised trigger detection and argument extraction errors from the ACE test dataset and identify the remaining challenges. + +Lack of Background Knowledge Background knowledge, as well as human commonsense knowledge, sometimes is essential to event extraction. For example, from the sentence "since the intifada exploded in September 2000, the source said", without knowing that intifada refers to a resistance movement, our approach failed to detect it as an Attack event mention. + +Pronoun Resolution Extracting arguments by resolving coreference between entities and pronouns is still challenging. For example, in the following sentence "Attempts by Laleh and Ladan to have their operation elsewhere in the world were rejected, with doctors in Germany saying one or both of them could die", without pronoun resolution, our approach mistakenly extracted one, both and them as Victims of the Die event triggered by + +die, while the actual Victims are Ladan and Laleh. + +Ambiguous Context The ACE annotation guidelines (Consortium, 2005) provide detailed rules and constraints for annotating events of all event types. For example, a Meet event must be specified by the context as face-to-face and physically located somewhere. Though we carefully designed several attention mechanisms, it is difficult for the machines to capture such context features accurately. For example, from the sentence "The admission came during three-day talks in Beijing which concluded Friday, the first meeting between US and North Korean officials since the nuclear crisis erupted six months ago," our approach failed to capture the context features that the talks is not an explicit face-to-face meet event, and thus mistakenly identified it as a Meet event mention. \ No newline at end of file diff --git a/queryandextractrefiningeventextractionastypeorientedbinarydecoding/images.zip b/queryandextractrefiningeventextractionastypeorientedbinarydecoding/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..a490f4401153a88eb16807cdbd64a63c0c7366b8 --- /dev/null +++ b/queryandextractrefiningeventextractionastypeorientedbinarydecoding/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f3b671a2d261f0213f0f2b1dfe439dd0115f8e5ab06b04b58c86a595cdfbfbca +size 463481 diff --git a/queryandextractrefiningeventextractionastypeorientedbinarydecoding/layout.json b/queryandextractrefiningeventextractionastypeorientedbinarydecoding/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..b02589b2d4e047e28281764c5541670ba5f75629 --- /dev/null +++ b/queryandextractrefiningeventextractionastypeorientedbinarydecoding/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ed801906eca1f322571afdbb14dd059d872a29773c6e6edb1355afefc334b1bd +size 447525 diff --git a/questionansweringinfusedpretrainingofgeneralpurposecontextualizedrepresentations/d6fd042f-9bc1-4628-b8c3-aebdba908d6c_content_list.json b/questionansweringinfusedpretrainingofgeneralpurposecontextualizedrepresentations/d6fd042f-9bc1-4628-b8c3-aebdba908d6c_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..7a1efd0a91c4091da2c040c00ff5bbe58884ab5a --- /dev/null +++ b/questionansweringinfusedpretrainingofgeneralpurposecontextualizedrepresentations/d6fd042f-9bc1-4628-b8c3-aebdba908d6c_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:58ac3bea1d9d983fd501deee6a4bb1e94e7e7f1de4af70b8ae44ffe964e7f13d +size 122320 diff --git a/questionansweringinfusedpretrainingofgeneralpurposecontextualizedrepresentations/d6fd042f-9bc1-4628-b8c3-aebdba908d6c_model.json b/questionansweringinfusedpretrainingofgeneralpurposecontextualizedrepresentations/d6fd042f-9bc1-4628-b8c3-aebdba908d6c_model.json new file mode 100644 index 0000000000000000000000000000000000000000..ec27e96e44a3866a19d89fb1db2721e5523c21c6 --- /dev/null +++ b/questionansweringinfusedpretrainingofgeneralpurposecontextualizedrepresentations/d6fd042f-9bc1-4628-b8c3-aebdba908d6c_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ae951cbf59ec5f881c0c4e48b23388faab8e81536eb5dc52478d2405440dbb6 +size 146405 diff --git a/questionansweringinfusedpretrainingofgeneralpurposecontextualizedrepresentations/d6fd042f-9bc1-4628-b8c3-aebdba908d6c_origin.pdf b/questionansweringinfusedpretrainingofgeneralpurposecontextualizedrepresentations/d6fd042f-9bc1-4628-b8c3-aebdba908d6c_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..a46618731de548cabfd1461723bec473f19e8f72 --- /dev/null +++ b/questionansweringinfusedpretrainingofgeneralpurposecontextualizedrepresentations/d6fd042f-9bc1-4628-b8c3-aebdba908d6c_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0d8b8de2dce72088ec33e96440d5c0d0f22d669e7f52f2326cfb08cd555a2532 +size 488923 diff --git a/questionansweringinfusedpretrainingofgeneralpurposecontextualizedrepresentations/full.md b/questionansweringinfusedpretrainingofgeneralpurposecontextualizedrepresentations/full.md new file mode 100644 index 0000000000000000000000000000000000000000..066704e279c0353c60bc257a5b6129642290fee6 --- /dev/null +++ b/questionansweringinfusedpretrainingofgeneralpurposecontextualizedrepresentations/full.md @@ -0,0 +1,441 @@ +# Question Answering Infused Pre-training of General-Purpose Contextualized Representations + +Robin Jia* + +University of Southern California + +robinjia@usc.edu + +Mike Lewis, Luke Zettlemoyer + +Facebook AI Research + +{mikelewis,lsz}@fb.com + +# Abstract + +We propose a pre-training objective based on question answering (QA) for learning general-purpose contextual representations, motivated by the intuition that the representation of a phrase in a passage should encode all questions that the phrase can answer in context. To this end, we train a bi-encoder QA model, which independently encodes passages and questions, to match the predictions of a more accurate cross-encoder model on 80 million synthesized QA pairs. By encoding QA-relevant information, the bi-encoder's token-level representations are useful for non-QA downstream tasks without extensive (or in some cases, any) fine-tuning. We show large improvements over both RoBERTa-large and previous state-of-the-art results on zero-shot and few-shot paraphrase detection on four datasets, few-shot named entity recognition on two datasets, and zero-shot sentiment analysis on three datasets. + +# 1 Introduction + +While masked language models build contextualized word representations, they are pre-trained with losses that minimize distance to uncontextualized word embeddings (Peters et al., 2018; Devlin et al., 2019; Liu et al., 2019). This objective yields a good initialization for downstream fine-tuning, but the pre-trained representations themselves are not optimized for being immediately useful without fine-tuning. In this paper, we introduce Question Answering Infused Pre-training (QUIP), a new pretraining loss based on question answering (QA) that depends much more directly on context. QUIP learns improved token-level representations that are useful in zero-shot and few-shot settings, where extensive fine-tuning is not possible. + +Our intuition for QuIP is that the contextualized representation for a phrase in a passage should contain enough information to identify all the questions + +![](images/570595e404cbbb040756183b072a4ff805d67575be35fc78e3a7d97f15c555ac.jpg) +Figure 1: An overview of Question Answering Infused Pre-training. Our model independently creates vector representations (middle) for phrases in a passage (top) and for synthesized questions (bottom). Our objective encourages the vector for each phrase to have high similarity with the vectors for all questions it answers. + +that the phrase could answer in context. For example, in Figure 1, the representation for Johannes Brahms should be similar to the representation of all questions it can answer, such as "Who wrote the violin concerto?" We anticipate that optimizing passage representations for QA should benefit many downstream tasks, as question-answer pairs have been used as broad-coverage meaning representations (He et al., 2015; Michael et al., 2018), and a wide range of NLP tasks can be cast as QA problems (Levy et al., 2017; McCann et al., 2018; Gardner et al., 2019). For instance, our learned representations should encode whether a phrase answers a question like "Why was the movie considered good?", which corresponds to identifying rationales for sentiment analysis. + +We train QUIP with a bi-encoder extractive QA objective. The model independently encodes passages and questions such that the representation of + +each phrase in a passage is similar to the representation of reading comprehension questions answered by that phrase. We use a question generation model to synthesize 80 million QA examples, then train the bi-encoder to match the predictions of a cross-encoder QA model, which processes the passage and question together, on these examples. + +Bi-encoder QA has been used before for efficient open-domain QA via phrase retrieval (Seo et al., 2018, 2019; Lee et al., 2020, 2021), but its lower accuracy compared to cross-encoder QA has previously been viewed as a drawback. We instead view the relative weakness of bi-encoder QA as an opportunity to improve contextual representations via knowledge distillation, as self-training can be effective when the student model must solve a harder problem than the teacher (Xie et al., 2020). In particular, since the bi-encoder does not know the question when encoding the passage, it must produce a single passage representation that simultaneously encodes the answers to all possible questions. In contrast, while cross-encoder QA models are more accurate, they depend on a specific question when encoding a passage; thus, they are less suited to downstream use cases that require contextualized representations of passages in isolation. + +We show that QUIP token-level representations are useful in a variety of zero-shot and few-shot learning settings, both because the representations directly encode useful contextual information, and because we can often reduce downstream tasks to QA. For few-shot paraphrase detection, QUIP with BERTScore-based features (Zhang et al., 2020) outperforms prior work by 9 F1 points across four datasets. For few-shot named entity recognition (NER), QUIP combined with an initialization scheme that uses question embeddings improves over RoBERTa-large by 14 F1 across two datasets. Finally, for zero-shot sentiment analysis, QUIP with question prompts improves over RoBERTa-large with MLM-style prompts by 5 accuracy points across three datasets, and extracts interpretable rationales as a side effect. Through ablations, we show that using real questions, a strong teacher model, and the bi-encoder architecture are all crucial to the success of QUIP. Other design decisions (e.g., question generation decoding strategies) do not qualitatively affect our main findings, pointing to the stability of the QUIP approach. $^{1}$ + +# 2 QA Infused Pre-training + +QA Infused Pre-training (QUIP) involves pretraining contextual representations with a bi-encoder extractive QA objective. In contrast with masked language modeling, QUIP's training objective directly encourages contextual representations to encode useful semantic information, namely information about what questions can be answered by each span. In contrast with a cross-encoder QA model, QUIP's bi-encoder is trained to encode single passages rather than passage-question pairs, making it more transferable to tasks involving single passages. Moreover, QUIP learns to push each phrase's representation far away from those of questions the phrase does not answer; this ability to represent unanswerability is crucial for correctly handling some question-based prompts. + +We now introduce some basic notation (§2.1), then describe the QUIP pipeline, which consists of three steps: question generation (§2.2), cross-encoder teacher re-labeling (§2.3), and bi-encoder training (§2.4). + +# 2.1 Notation + +All models operate on sequences of tokens $x = [x_{1},\ldots ,x_{L}]$ of length $L$ . By convention, we assume that $x_{1}$ is always the special beginning-of-sequence token. We learn an encoder $r$ that maps inputs $x$ to outputs $r(x) = [r(x)_1,\dots,r(x)_L]$ where each $r(x)_i\in \mathbb{R}^d$ for some fixed dimension $d$ . We call $r(x)_i$ the contextual representation of the $i$ -th token in $x$ . + +In extractive question answering, a model is given a context passage $c$ and question $q$ , and must output a span of $c$ that answers the question. Typically, models independently predict probability distributions $p(a_{\text{start}} \mid c, q)$ and $p(a_{\text{end}} \mid c, q)$ over the answer start index $a_{\text{start}}$ and end index $a_{\text{end}}$ . + +# 2.2 Question Generation + +Question generation model. We train a BART-large model (Lewis et al., 2020) to generate question-answer pairs given context passages. The model receives the passage as context and must generate the answer text, then a special separator token, then the question. This approach is simpler than prior approaches that use separate models for answer and question generation (Lewis and Fan, 2019; Alberti et al., 2019; Puri et al., 2020), and works well in practice. + +Training data. We train on the training data from the MRQA 2019 Shared Task (Fisch et al., 2019), which includes six datasets: HotpotQA (Yang et al., 2018), NaturalQuestions (Kwiatkowski et al., 2019), NewsQA (Trischler et al., 2017), SearchQA (Dunn et al., 2017), SQuAD (Rajpurkar et al., 2016), and TriviaQA (Joshi et al., 2017). These datasets cover many of the text sources commonly used for pre-training (Liu et al., 2019; Lewis et al., 2020), namely Wikipedia (HotpotQA, NaturalQuestions, SQuAD), News articles (NewsQA), and general web text (SearchQA, TriviaQA). + +Generating questions. We run our question generation model over a large set of passages to generate a large dataset of question-answer pairs. We decode using nucleus sampling (Holtzman et al., 2020) with $p = 0.6$ , which was chosen by manual inspection to balance diversity with quality of generated questions. We do not filter questions in any way. While we observed some flaws related to question quality (questions were not always well-formed) and diversity (for some passages, the same or very similar questions were asked multiple times), this approach nonetheless yielded good downstream results. Attempts to mitigate these issues, such as using a two-stage beam search to ensure that questions for the same passage have different answers, did not noticeably change our downstream results (see §4.8). We obtain passages from the same training corpus as RoBERTa (Liu et al., 2019), which uses four sub-domains: BOOK-CORPUS plus Wikipedia, CC-NEWS, OPENWEB-TEXT, and STORIES. For each domain, we sample 2 million passages and generate 10 questions per passage, for a total of 80 million questions. $^2$ + +# 2.3 Teacher Re-labeling + +The answers generated by our BART model are not always accurate, nor are they always spans in the context passage. To improve the training signal, we re-label examples with a teacher model, as is common in knowledge distillation (Hinton et al., 2015). We use a standard cross-encoder RoBERTa-large model trained on the MRQA training data as our teacher. The model takes in the concatenation of the context passage $c$ and question $q$ and predicts $a_{\mathrm{start}}$ and $a_{\mathrm{end}}$ with two independent 2-layer + +multi-layer perceptron (MLP) heads. We denote the teacher's predicted probability distribution over $a_{\mathrm{start}}$ and $a_{\mathrm{end}}$ as $T_{\mathrm{start}}(c, q)$ and $T_{\mathrm{end}}(c, q)$ , respectively. + +# 2.4 Bi-encoder Training + +Finally, we train a bi-encoder model to match the cross-encoder predictions on the generated questions. This objective encourages the contextual representation for a token to have high similarity (in inner product space) with the representation of every question that is answered by that token. + +Model. The bi-encoder model with parameters $\theta$ consists of three components: an encoder $r$ and two question embedding heads $h_{\mathrm{start}}$ and $h_\mathrm{end}$ that map $\mathbb{R}^d\to \mathbb{R}^d$ . These heads will only be applied to beginning-of-sequence (i.e., CLS) representations; as shorthand, define $f_{\mathrm{start}}(x) = h_{\mathrm{start}}(r(x)_1)$ and likewise for $f_{\mathrm{end}}$ . Given a context passage $c$ and question $q$ , the model predicts + +$$ +p _ {\theta} \left(a _ {\text {s t a r t}} = i \mid c, q\right) \propto e ^ {r (c) _ {i} ^ {\top} f _ {\text {s t a r t}} (q)} \tag {1} +$$ + +$$ +p _ {\theta} \left(a _ {\text {e n d}} = i \mid c, q\right) \propto e ^ {r (c) _ {i} ^ {\top} f _ {\text {e n d}} (q)} \tag {2} +$$ + +In other words, the model independently encodes the passage and question with $r$ , applies the start and end heads to the CLS token embedding for $q$ , then predicts the answer start (end) index with a softmax over the dot product between the passage representation at that index and the output of the start (end) head. We initialize $r$ to be the pretrained RoBERTa-large model (Liu et al., 2019), which uses $d = 1024$ . $h_{\mathrm{start}}$ and $h_{\mathrm{end}}$ are randomly initialized 2-layer MLPs with hidden dimension 1024, matching the default initialization of classification heads in RoBERTa. + +Training. For an input consisting of context $c$ of length $L$ and question $q$ , we train $\theta$ to minimize the KL-divergence between the student and teacher predictions, which is equivalent to the objective + +$$ +\begin{array}{l} - \sum_ {i = 1} ^ {L} T _ {\text {s t a r t}} (c, q) _ {i} \log p _ {\theta} \left(a _ {\text {s t a r t}} = i \mid c, q\right) \\ + T _ {\mathrm {e n d}} (c, q) _ {i} \log p _ {\theta} \left(a _ {\mathrm {e n d}} = i \mid c, q\right) \tag {3} \\ \end{array} +$$ + +up to constants that do not depend on $\theta$ . We train for two epochs on the 80 million generated questions, which takes roughly 56 hours on 8 V100 + +GPUs, or roughly 19 GPU-days. $^4$ For efficiency, we process all questions for the same passage in the same batch, as encoding passages dominates runtime. For further details, see Appendix A.1. + +# 3 Downstream Tasks + +We evaluate QUIP on zero-shot paraphrase ranking, few-shot paraphrase classification, few-shot NER, and zero-shot sentiment analysis. Different tasks showcase different advantages of QUIP. For paraphrase detection and NER, QUIP succeeds by learning meaningful token-level contextualized representations for single passages, whereas MLM representations are trained to reconstruct uncontextualized word embeddings, and the cross-encoder QA model is trained to represent passage-question pairs. For NER and sentiment analysis, we prompt QUIP with questions, leveraging its question-answering abilities. Compared with a cross-encoder, QUIP's bi-encoder architecture enables a more efficient way to use question prompts in NER, and yields more reliable scores when questions are unanswerable in sentiment analysis. We focus on zero-shot and few-shot settings, as these require pre-trained models that are useful without fine-tuning on a large task-specific training dataset. QUIP addresses this need by anticipating what information might be useful for downstream tasks—namely, information found in question-answer pairs. + +# 3.1 Paraphrase Ranking + +We first evaluate QUIP token-level representations by measuring their usefulness for zero-shot paraphrase ranking. In this task, systems must rank sentence pairs that are paraphrases above pairs that are non-paraphrases, without any task-specific training data. We compute similarity scores using the $F_{\mathrm{BERT}}$ variant of BERTScore (Zhang et al., 2020), which measures cosine similarities between the representation of each token in one sentence and its most similar token in the other sentence. Given sentences $x_{1}$ and $x_{2}$ of lengths $L_{1}$ and $L_{2}$ , define + +$$ +B (x _ {1}, x _ {2}) = \frac {1}{L _ {1}} \sum_ {i = 1} ^ {L _ {1}} \max _ {1 \leq j \leq L _ {2}} \frac {r (x _ {1}) _ {i} ^ {\top} r (x _ {2}) _ {j}}{\| r (x _ {1}) _ {i} \| \| r (x _ {2}) _ {j} \|}. +$$ + +The $F_{\mathrm{BERT}}$ BERTScore is defined as the harmonic mean of $B(x_{1},x_{2})$ and $B(x_{2},x_{1})$ . Zhang et al. (2020) showed that BERTScore with RoBERTa is + +useful for both natural language generation evaluation and paraphrase ranking. Since BERTScore uses token-level representations, we hypothesize that it should pair well with QUIP. As in Zhang et al. (2020), we use representations from the layer of the network that maximizes Pearson correlation between BERTScore and human judgments on the WMT16 metrics shared task (Bojar et al., 2016). + +# 3.2 Paraphrase Classification + +We use either frozen or fine-tuned QUIP representations for few-shot paraphrase classification, rather than ranking. Through these experiments, we can compare QUIP with existing work on few-shot paraphrase classification. + +Frozen model. We train a logistic regression model that uses BERTScore with frozen representations as features. For a given pair of sentences, we extract eight features, corresponding to BERTScore computed with the final eight layers (i.e., layers 17-24) of the network. These layers encompass the optimal layers for both RoBERTa-large and QUIP (see §4.4). Freezing the encoder is often useful in practice, particularly for large models, as the same model can be reused for many tasks (Brown et al., 2020; Du et al., 2020). + +Fine-tuning. For fine-tuning, we use the same computation graph and logistic loss function, but now backpropagate through the parameters of our encoder. For details, see Appendix A.2. + +# 3.3 Named Entity Recognition + +We also use QUIP for few-shot $^{5}$ named entity recognition, which we frame as a BIO tagging task. Since questions in QA often ask for entities of a specific type, we expect QUIP representations to contain rich entity type information. We add a linear layer that takes in token-level representations and predicts the tag for each token, and backpropagate log loss through the entire network. By default, the output layer is initialized randomly. + +As a refinement, we propose using question prompts to initialize this model. The output layer is parameterized by a $T \times d$ matrix $M$ , where $T$ is the number of distinct BIO tags. The log-probability of predicting the $j$ -th tag for token $i$ is proportional to the dot product between the representation for token $i$ and the $j$ -th row of $M$ ; this resembles how + +the bi-encoder predicts answers. Thus, we initialize each row of $M$ with the start head embedding of a question related to that row's corresponding entity tag. For instance, we initialize the parameters for the B-location and I-location tags with the embedding for "What is a location?" We normalize the question embeddings to have unit L2 norm. This style of initialization is uniquely enabled by our bi-encoder QA model, as it builds a single passage representation that can simultaneously answer questions corresponding to all entity types. It would be unclear how to use a language model or a cross-encoder QA model similarly, as it must perform a separate forward pass for each question (i.e., each entity type in this setting). + +# 3.4 Zero-shot Sentiment Analysis + +Finally, we use QUIP for zero-shot binary sentiment analysis. We reduce sentiment analysis to QA by writing a pair of questions that ask for a reason why an item is good or bad (e.g., "Why is this movie [good/bad]?"). We predict the label whose corresponding question has higher similarity with the QUIP representation of some token in the input. This prompting strategy has the additional benefit of extracting rationales, namely the span that the QUIP model predicts as the answer to the question. While we focus on sentiment analysis, extractive rationales have been used for a wide range of NLP tasks (DeYoung et al., 2020), suggesting that this method could be applied more broadly. + +More formally, let $x$ be an input sentence and $(q_0, q_1)$ be a pair of questions (i.e., a prompt). For label $y \in \{0, 1\}$ , we compute a score for $y$ as + +$$ +\begin{array}{l} S (x, y) = \max _ {i} r (x) _ {i} ^ {\top} f _ {\text {s t a r t}} (q _ {y}) + \\ \max _ {i} r (x) _ {i} ^ {\top} f _ {\text {e n d}} \left(q _ {y}\right). \tag {4} \\ \end{array} +$$ + +This formula is a straightforward way to measure the extent to which some span in $x$ looks like the answer to the question $q_{y}$ , based on the model's pre-trained ability to perform QA. We predict whichever $y$ has the higher value of $S(x, y) - C_{y}$ , where $C_{y}$ is a calibration constant that offsets the model's bias towards answering $q_{0}$ or $q_{1}$ . Our inclusion of $C_{y}$ is inspired by Zhao et al. (2021), who recommend calibrating zero-shot and few-shot models with a baseline derived from content-free inputs to account for biases towards a particular label. To choose $C_{y}$ , we obtain a list $W$ of the ten most frequent English words, all of which convey no sentiment, and define $C_{y}$ as the mean over + +$w \in W$ of $S(w, y)$ , i.e., the score when using $w$ as the input sentence (see Appendix A.4). + +This method can succeed only if the model produces a lower score for unanswerable questions than answerable ones. For example, if the input passage is positive, the model must produce a lower score for "Why is it bad?", which not answerable (as the question contains a presupposition failure), than "Why is it good?", which presumably can be answered from the passage. We hypothesize that QUIP will indeed recognize that unanswerable questions should receive lower scores, as it is trained to make each span's representation far away from those of questions it does not answer. In contrast, the cross-encoder objective does not teach the model how to handle unanswerable questions. + +# 4 Experiments + +# 4.1 Experimental details + +Datasets. For paraphrasing, we use four datasets: QQP (Iyer et al., 2017), MRPC (Dolan and Brockett, 2005), PAWS-Wiki, and PAWS-QQP (Zhang et al., 2019). The PAWS datasets were designed to be challenging for bag-of-words models, and thus test whether our representations are truly contextual or mostly lexical. For QQP and MRPC, we use the few-shot splits from Gao et al. (2021) that include 16 examples per class; for the PAWS datasets, we create new few-shot splits in the same manner. We report results on the development sets of QQP and MRPC (as test labels were not available), the test set of PAWS-Wiki, and the "dev-and-test" set of PAWS-QQP. For NER, we use two datasets: CoNLL 2003 (Tjong Kim Sang and De Meulder, 2003) and WNUT-17 (Derczynski et al., 2017). We use the few-shot splits from Huang et al. (2020) that include 5 examples per entity type. All few-shot experiments report an average over five random splits and seeds, following both Gao et al. (2021) and Huang et al. (2020). For sentiment analysis, we use two movie review datasets, SST-2 (Socher et al., 2013) and Movie Reviews (MR; Pang and Lee, 2005), as well as the Customer Reviews (CR) dataset (Hu and Liu, 2004). We evaluate on the SST-2 development set and the MR and CR test sets made by Gao et al. (2021). + +Hyperparameter and prompt selection. Due to the nature of zero-shot and few-shot experiments, we minimize the extent to which we tune hyperparameters, relying on existing defaults and pre + +viously published hyperparameters. For few-shot paraphrase classification, NER, and sentiment analysis, we developed our final method only using QQP, CoNLL, and SST-2, respectively, and directly applied it to the other datasets with no further tuning. We did measure zero-shot paraphrase ranking accuracy on all datasets during development of QUIP. For more details, see Appendix A.3. + +For NER, we used the first question prompts we wrote for both CoNLL and WNUT, which all follow the same format, "Who/What is a/an [entity type]?" (see Appendix A.7 for all prompts). For sentiment analysis, we wrote six prompts (shown in Appendix A.9) and report mean accuracy over these prompts, to avoid pitfalls associated with prompt tuning (Perez et al., 2021). We use the same prompts for SST-2 and MR; for CR, the only change we make is replacing occurrences of the word "movie" with "product" to reflect the change in domain between these datasets. + +# 4.2 Baselines and Ablations + +To confirm the importance of all three stages of our pre-training pipeline, we compare with a number of baselines and ablations. + +No question generation. We train the bi-encoder model directly on the MRQA training data ("Bi-encoder + MRQA"). We also include the cross-encoder teacher model trained on MRQA as a baseline ("Cross-encoder + MRQA"). These settings mirror standard intermediate task training (Phang et al., 2018; Pruksachatkun et al., 2020). + +No teacher. We train the bi-encoder using the answer generated by the question generation model ("QUIP, no teacher"). If the generated answer is not a span in the passage, we consider the question unanswerable and treat the span containing the CLS token as the answer, as in Devlin et al. (2019). + +Cross-encoder self-training. To test whether the bottleneck imposed by the bi-encoder architecture is crucial for QUIP, we also train a cross-encoder model on our generated data ("QUIP, cross-encoder student"). Since this student model has the same architecture as the teacher model, we train it to match the teacher's argmax predictions, a standard self-training objective (Lee, 2013; Kumar et al., 2020). Training is much less efficient for the cross-encoder than the bi-encoder, since batching questions about the same passage together does + +
ModelEMF1
Lee et al. (2021)78.386.3
Bi-encoder + UnsupervisedQA17.424.9
Bi-encoder + MRQA70.779.4
QuIP, no teacher75.384.7
QuIP85.291.7
BERT-large cross-encoder84.291.1
Cross-encoder + MRQA88.894.7
QuIP, cross-encoder student89.594.8
+ +Table 1: EM and F1 scores on the SQuAD development set for bi-encoder (top) and cross-encoder (bottom) models. QUIP outperforms the other bi-encoder model baselines, and even a cross-encoder BERT-large model. The RoBERTa cross-encoder models are better at QA, but will underperform QUIP on non-QA tasks. + +not speed up training, so we train for a comparable number of GPU-hours (60 hours on 8 V100 GPUs). + +Unsupervised QA. We test whether QUIP requires real QA data, or if a rough approximation suffices. We thus train a bi-encoder on 80 million pseudo-questions generated by applying noise to sentences ("Bi-encoder + UnsupervisedQA"), as in Lewis et al. (2019). + +# 4.3 Bi-encoder Question Answering + +While not our main focus, we first check that QUIP improves bi-encoder QA accuracy, as shown in Table 1. QUIP improves over Lee et al. (2021) by 5.4 F1 on the SQuAD development set. It also surpasses the reported human accuracy of 91.2 F1 on the SQuAD test set, as well as the best cross-encoder BERT-large single model from Devlin et al. (2019). QUIP greatly improves over baselines that directly train on MRQA data or do not use the teacher model. The cross-encoder models are more accurate at QA, but as we will show, this does not imply that cross-encoder QA is a better pretraining objective for downstream non-QA tasks. Appendix A.5 shows results on all MRQA development datasets. + +# 4.4 Zero-shot Paraphrase Ranking + +We validate our approach and study the effects of various ablations on zero-shot paraphrase ranking. The first half of Table 2 shows WMT development set Pearson correlations averaged across six to-English datasets, as in Zhang et al. (2020), along with the best layer for each model. QUIP reaches its optimal score at a later layer (20) than RoBERTa-large (17), which may suggest that the + +
ModelWMT rWMT Best LayerQQPMRPCPAWS-WikiPAWS-QQP
RoBERTa-large.73917.763.831.698.690
Cross-encoder + MRQA.74416.767.840.742.731
QUIP, cross-encoder student.75316.769.847.751.706
Bi-encoder + UnsupervisedQA.65411.747.801.649.580
Bi-encoder + MRQA.74915.771.807.747.725
QUIP, no teacher.72619.767.831.780.709
QUIP.76420.809.849.830.796
+ +Table 2: Pearson correlation on WMT development data, best layer chosen based on WMT results, and AUROC on zero-shot paraphrase ranking using BERTScore. QUIP outperforms all baselines on all datasets. + +QUIP training objective is more closely aligned with learning better representations than MLM. + +The rest of Table 2 shows zero-shot paraphrase ranking results using BERTScore. QUIP improves substantially over RoBERTa on all four datasets, with an average improvement of .076 AUROC. The improvement is greatest on the PAWS datasets; since these datasets cannot be solved by lexical features alone, QUIP representations must be much more contextualized than RoBERTa representations. Training on Unsupervised QA data degrades performance compared to RoBERTa, showing that QUIP does not merely make word representations encode local context in a simple way. Training the bi-encoder directly on the MRQA dataset or without the teacher improves on average over RoBERTa, but QUIP greatly outperforms both baselines. The cross-encoder models also lag behind QUIP at paraphrase ranking, despite their higher QA accuracy; since the cross-encoders are trained to take passage-question pairs as inputs, their representations of single sentences are not as useful. Thus, we conclude that having real questions, accurate answer supervision, and a bi-encoder student model are all crucial to the success of QUIP. + +# 4.5 Paraphrase Classification + +Table 3 shows few-shot paraphrase classification results. As we studied QUIP-related ablations in the previous section, we focus on the comparison between QUIP and baselines based on MLM. First, we use RoBERTa-large embeddings in place of QUIP in our method. Second, we compare with LM-BFF (Gao et al., 2021), which pairs RoBERTa-large with MLM-style prompts. We use LM-BFF with manually written prompts and demonstrations, which was their best method on QQP by 2.1 F1 and was 0.3 F1 worse than their best method on MRPC. QUIP used as a frozen encoder is competitive with LM-BFF on QQP and outperforms it by 6.1 F1 on MRPC, 11.2 F1 on PAWS-Wiki, and 12.1 F1 on + +PAWS-QQP. Fine-tuning QUIP gives additional improvements on three of the four datasets, and outperforms fine-tuning RoBERTa by an average of 6.9 F1. + +# 4.6 Named Entity Recognition + +Table 4 shows few-shot NER results on the CoNLL and WNUT datasets. QUIP improves over RoBERTa-large by 11 F1 on CoNLL and 2.9 F1 on WNUT when used with a randomly initialized output layer. We see a further improvement of 4 F1 on CoNLL and 7.4 F1 on WNUT when using question embeddings to initialize the output layer. Using the cross-encoder trained directly on QA data is roughly as good as QUIP when using randomly initialized output layers, but it is incompatible with question embedding initialization. + +# 4.7 Sentiment Analysis + +Table 5 shows zero-shot accuracy on our three sentiment analysis datasets. We compare with zero-shot results for LM-BFF (Gao et al., 2021) $^6$ and reported zero-shot results from Zhao et al. (2021) using GPT-3 with Contextual Calibration (CC) on SST-2. QUIP using an average prompt outperforms zero-shot LM-BFF by 5.4 points, averaged across the three datasets. Choosing the best prompt on SST-2 and using that for all datasets improves results not only on SST-2 but also MR, and maintains average accuracy on CR. Using the cross-encoder student QA model with the same prompts leads to worse performance: we hypothesize that the bi-encoder succeeds due to its better handling of unanswerable questions. Overall, these results show that question answering can provide a viable interface for building models that perform non-QA tasks. + +Table 6 shows rationales extracted from random SST-2 examples for which QUIP was correct with the best prompt for SST-2 ("What is the reason + +
ModelFine-tuned?QQPMRPCPAWS-WikiPAWS-QQP
LM-BFF (reported)Fine-tuned69.80.877.80.9--
LM-BFF (rerun)Fine-tuned67.10.976.51.560.70.750.12.8
RoBERTa-largeFrozen64.40.480.60.762.30.950.60.4
QUIPFrozen68.90.282.60.471.90.563.01.2
RoBERTa-largeFine-tuned64.90.784.40.365.70.350.90.8
QUIPFine-tuned71.00.386.60.475.10.260.91.0
+ +Table 3: F1 scores on few-shot paraphrase classification, averaged across five training splits (standard errors in subscripts). QUIP outperforms prior work (LM-BFF; Gao et al., 2021) as well as our own RoBERTa baselines. + +
ModelCoNLLWNUT
Huang et al. (2020)65.437.6
Standard init.
RoBERTa-large59.02.439.30.6
Cross-encoder + MRQA68.93.343.00.9
QUIP, cross-encoder student63.43.339.41.7
Bi-encoder + UnsupervisedQA58.22.626.01.0
Bi-encoder + MRQA66.43.342.20.4
QUIP, no teacher67.71.940.71.4
QUIP70.02.442.20.5
Question prompt init.
Bi-encoder + UnsupervisedQA62.73.330.40.8
Bi-encoder + MRQA72.02.844.01.3
QUIP, no teacher71.43.047.81.1
QUIP74.02.449.60.5
+ +this movie is [good/bad]?"). To prefer shorter rationales, we extract the highest-scoring span of five BPE tokens or less. The model often identifies phrases that convey clear sentiment. Appendix A.10 shows full examples and rationales. + +# 4.8 Stability Analysis + +We experimented with some design decisions that did not materially affect our results. Appendix A.6 shows results for three such choices: including in-batch negative passages (Lee et al., 2021), using the argmax prediction of the teacher rather than soft labels, and using beam search to generate a diverse set of answers followed by one high-likelihood question per answer. We take these findings as evidence that our basic recipe is stable to many small changes. For question generation, we hypothesize that the objective of matching the cross-encoder teacher model encourages the bi-encoder to learn important features identified by the cross-encoder, even on questions that are not entirely well-formed. + +Table 4: F1 scores on few-shot NER, averaged over five training splits (standard errors in subscripts). QUIP with question prompts performs best on both datasets. + +
ModelSST-2MRCR
CC + GPT-371.6--
LM-BFF83.680.879.5
QuIP (average)87.90.681.90.490.30.2
w/ cross-enc. student83.30.478.50.488.90.3
QuIP (tune on SST-2)89.683.190.4
+ +Table 5: Zero-shot accuracy on sentiment analysis. Third and fourth rows show mean accuracy across six prompts (standard error in subscripts). QUIP with an average prompt outperforms prior work; using the best prompt on SST-2 helps on all datasets. + +
LabelRationale
-“too slim”, “stale”, “every idea”, “wore out its welcome”, “unpleasant viewing experience”, “lifeless”, “plot”, “amateurishly assembled”, “10 times their natural size”, “wrong turn”
+“packed with information and impressions”, “slash-and-hack”, “tightly organized efficiency”, “passion and talent”, “best films”, “surprises”, “great summer fun”, “play equally well”, “convi-tions”, “wickedly subversive bent”
+ +Table 6: Rationales extracted by QUIP on ten random examples for each label from SST-2. + +# 5 Discussion and Related Work + +We build on work in question generation and answering, pre-training, and few-shot learning. + +# 5.1 Question Generation + +Neural question generation has been well-studied for different purposes (Du et al., 2017; Du and Cardie, 2018; Zhao et al., 2018; Lewis and Fan, 2019; Alberti et al., 2019; Puri et al., 2020; Lewis et al., 2021; Bartolo et al., 2021). We use generated questions to learn general-purpose representations. We also show that a relatively simple strategy of generating the answer and question together with a single model can be effective; most prior work uses separate answer selection and question generation models. + +Phrase-indexed Question Answering Phrase-indexed question answering is a paradigm for open- + +domain QA that retrieves answers by embedding questions and candidate answers in a shared embedding space (Seo et al., 2018, 2019; Lee et al., 2020). It requires using a bi-encoder architecture for efficient phrase retrieval. Especially related is Lee et al. (2021), which also uses question generation and a cross-encoder teacher model to improve phrase-indexed QA, though they focus on improving QA accuracy rather than transfer to other tasks. Our results reinforce prior observations that bi-encoder models are usually less accurate at QA than cross-encoders (see Table 1). However, the bi-encoder model transfers better to settings that require a contextualized representation of a single passage; the cross-encoder instead optimizes for producing representations of passage-question pairs. + +# 5.2 Improving question answering + +While we use QA to aid pre-training, related work aims to improve accuracy on QA. Ram et al. (2021) propose a span extraction pre-training objective that enables few-shot QA. Khashabi et al. (2020) run multi-task training on many QA datasets, both extractive and non-extractive, to improve QA accuracy. + +# 5.3 Learning contextual representations + +Pre-training on unlabeled data has yields useful contextual representations (Peters et al., 2018; Devlin et al., 2019), but further improvements are possible using labeled data. Intermediate task training (Phang et al., 2018) improves representations by training directly on large labeled datasets. Muppet (Aghajanyan et al., 2021) improves models by multi-task pre-finetuning on many labeled datasets. + +Most similar to our work, QuASE (He et al., 2020) uses extractive QA to pre-train a BERT paragraph encoder. Our work improves upon QuASE in multiple ways. First, we use question generation and knowledge distillation to greatly improve over directly training on labeled data, the approach used by QuASE. Second, we propose multiple ways of leveraging question-based task descriptions to improve accuracy in zero-shot and few-shot settings, thus showing how the QA format can be used as a model-building interface for non-QA tasks; QuASE only uses their model as a feature extractor. Moreover, since the architecture of QuASE involves a more complex interaction layer than our bi-encoder, it would not be possible to use question prompts to initialize final-layer parameters, as we do for NER. + +Other work has used methods similar to ours to learn vector representations of full sentences. Reimers and Gurevych (2019) train sentence embeddings for sentence similarity tasks using natural language inference data. Thakur et al. (2021) train a sentence embedding bi-encoder to mimic the predictions of a cross-encoder model. We learn token-level representations, rather than a single vector for a sentence, and thus use token-level supervision from extractive QA. + +# 5.4 Few-shot learning + +We study few-shot learning without access to unlabeled data, following most recent work (Brown et al., 2020; Gao et al., 2021; Zhao et al., 2021). Schick and Schütze (2021) notably propose a semi-supervised approach that uses unlabeled data for knowledge distillation; this process does not improve accuracy, but mainly improves efficiency. Moreover, large-scale unlabeled data may not be easily obtainable for all tasks, and utilizing such data increase computation time in the fine-tuning stage, so we focus on the setting without unlabeled data. The aforementioned work uses language models for few-shot learning by converting tasks to language modeling problems; we develop alternative methods for few-shot learning that use token-level representations and question-based prompts. + +# 6 Conclusion + +In this work, we pre-trained token-level contextual representations that are useful for downstream few-shot learning. Our key idea was to use question-answer pairs to define what information should be encoded in passage representations. We showed that these representations are useful for a variety of standard NLP tasks in zero- and few-shot settings, including paraphrase detection, named entity recognition, and sentiment analysis, across nine total datasets. Looking forward, we hope to see more work on designing pre-training objectives that align with downstream needs for few-shot learning. + +# Acknowledgements + +We thank Terra Blevins for investigating applications to word sense disambiguation, Jiaxin Huang for providing the few-shot NER splits used in their paper, and Douwe Kiela, Max Bartolo, Sebastian Riedel, Sewon Min, Patrick Lewis, Scott Yih, and our anonymous reviewers for their feedback. + +# References + +Armen Aghajanyan, Anchit Gupta, Akshit Shrivastava, Xilun Chen, Luke Zettlemoyer, and Sonal Gupta. 2021. Muppet: Massive multi-task representations with pre-finetuning. arXiv preprint arXiv:2101.11038. +Chris Alberti, Daniel Andor, Emily Pitler, Jacob Devlin, and Michael Collins. 2019. Synthetic QA corpora generation with roundtrip consistency. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 6168-6173, Florence, Italy. Association for Computational Linguistics. +Max Bartolo, Tristan Thrush, Robin Jia, Sebastian Riedel, Pontus Stenetorp, and Douwe Kiela. 2021. Improving question answering model robustness with synthetic adversarial data generation. arXiv preprint arXiv:2104.08678. +Ondrej Bojar, Yvette Graham, Amir Kamran, and Miloš Stanojevic. 2016. Results of the WMT16 metrics shared task. In Proceedings of the First Conference on Machine Translation: Volume 2, Shared Task Papers, pages 199-231, Berlin, Germany. Association for Computational Linguistics. +Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler, Jeffrey Wu, Clemens Winter, Chris Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. 2020. Language models are few-shot learners. In Advances in Neural Information Processing Systems, volume 33, pages 1877-1901. Curran Associates, Inc. +Leon Derczynski, Eric Nichols, Marieke van Erp, and Nut Limsopatham. 2017. Results of the WNUT2017 shared task on novel and emerging entity recognition. In Proceedings of the 3rd Workshop on Noisy User-generated Text, pages 140-147, Copenhagen, Denmark. Association for Computational Linguistics. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171-4186, Minneapolis, Minnesota. Association for Computational Linguistics. +Jay DeYoung, Sarthak Jain, Nazneen Fatema Rajani, Eric Lehman, Caiming Xiong, Richard Socher, and Byron C. Wallace. 2020. ERASER: A benchmark to + +evaluate rationalized NLP models. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 4443-4458, Online. Association for Computational Linguistics. +William B. Dolan and Chris Brockett. 2005. Automatically constructing a corpus of sentential paraphrases. In Proceedings of the Third International Workshop on Paraphrasing (IWP2005). +Jingfei Du, Myle Ott, Haoran Li, Xing Zhou, and Veselin Stoyanov. 2020. General purpose text embeddings from pre-trained language models for scalable inference. In *Findings of the Association for Computational Linguistics: EMNLP* 2020, pages 3018-3030, Online. Association for Computational Linguistics. +Xinya Du and Claire Cardie. 2018. Harvesting paragraph-level question-answer pairs from Wikipedia. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1907-1917, Melbourne, Australia. Association for Computational Linguistics. +Xinya Du, Junru Shao, and Claire Cardie. 2017. Learning to ask: Neural question generation for reading comprehension. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1342-1352, Vancouver, Canada. Association for Computational Linguistics. +Dheeru Dua, Yizhong Wang, Pradeep Dasigi, Gabriel Stanovsky, Sameer Singh, and Matt Gardner. 2019. DROP: A reading comprehension benchmark requiring discrete reasoning over paragraphs. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 2368-2378, Minneapolis, Minnesota. Association for Computational Linguistics. +Matthew Dunn, Levent Sagun, Mike Higgins, V. Ugur Guney, Volkan Cirik, and Kyunghyun Cho. 2017. SearchQA: A new Q&A dataset augmented with context from a search engine. arXiv preprint arXiv:1704.05179. +Adam Fisch, Alon Talmor, Robin Jia, Minjoon Seo, Eunsol Choi, and Danqi Chen. 2019. MRQA 2019 shared task: Evaluating generalization in reading comprehension. In Proceedings of the 2nd Workshop on Machine Reading for Question Answering, pages 1-13, Hong Kong, China. Association for Computational Linguistics. +Tianyu Gao, Adam Fisch, and Danqi Chen. 2021. Making pre-trained language models better few-shot learners. In Association for Computational Linguistics (ACL). + +Matt Gardner, Jonathan Berant, Hannaneh Hajishirzi, Alon Talmor, and Sewon Min. 2019. Question answering is a format; when is it useful? arXiv preprint arXiv:1909.11291. +Hangfeng He, Qiang Ning, and Dan Roth. 2020. QuASE: Question-answer driven sentence encoding. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 8743-8758, Online. Association for Computational Linguistics. +Luheng He, Mike Lewis, and Luke Zettlemoyer. 2015. Question-answer driven semantic role labeling: Using natural language to annotate natural language. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pages 643-653, Lisbon, Portugal. Association for Computational Linguistics. +Geoffrey Hinton, Oriol Vinyals, and Jeffrey Dean. 2015. Distilling the knowledge in a neural network. In NeurIPS Deep Learning and Representation Learning Workshop. +Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi. 2020. The curious case of neural text degeneration. In International Conference on Learning Representations. +Minqing Hu and Bing Liu. 2004. Mining and summarizing customer reviews. In Proceedings of the tenth ACM SIGKDD international conference on Knowledge discovery and data mining, pages 168-177. +Jiaxin Huang, Chunyuan Li, Krishan Subudhi, Damien Jose, Shobana Balakrishnan, Weizhu Chen, Baolin Peng, Jianfeng Gao, and Jiawei Han. 2020. Few-shot named entity recognition: A comprehensive study. arXiv preprint arXiv:2012.14978. +Shankar Iyer, Nikhil Dandekar, and Kornél Csernai. 2017. First quora dataset release: Question pairs. https://www.quora.com/q/quoradata/First-Quora-Dataset-Release-Questic +Mandar Joshi, Eunsol Choi, Daniel Weld, and Luke Zettlemoyer. 2017. TriviaQA: A large scale distantly supervised challenge dataset for reading comprehension. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1601-1611, Vancouver, Canada. Association for Computational Linguistics. +Aniruddha Kembhavi, Minjoon Seo, Dustin Schwenk, Jonghyun Choi, Ali Farhadi, and Hannaneh Hajishirzi. 2017. Are you smarter than a sixth grader? textbook question answering for multimodal machine comprehension. In 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 5376-5384. +Daniel Khashabi, Sewon Min, Tushar Khot, Ashish Sabharwal, Oyvind Tafjord, Peter Clark, and Hannaneh Hajishirzi. 2020. UNIFIEDQA: Crossing format boundaries with a single QA system. In Findings of the Association for Computational Linguistics: + +EMNLP 2020, pages 1896-1907, Online. Association for Computational Linguistics. +Ananya Kumar, Tengyu Ma, and Percy Liang. 2020. Understanding self-training for gradual domain adaptation. In Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pages 5468-5479. PMLR. +Tom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, Ankur Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Jacob Devlin, Kenton Lee, Kristina Toutanova, Llion Jones, Matthew Kelcey, Ming-Wei Chang, Andrew M. Dai, Jakob Uszkoreit, Quoc Le, and Slav Petrov. 2019. Natural questions: A benchmark for question answering research. Transactions of the Association for Computational Linguistics, 7:452-466. +Guokun Lai, Qizhe Xie, Hanxiao Liu, Yiming Yang, and Eduard Hovy. 2017. RACE: Large-scale ReAding comprehension dataset from examinations. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 785-794, Copenhagen, Denmark. Association for Computational Linguistics. +Dong-Hyun Lee. 2013. Pseudo-label: The simple and efficient semi-supervised learning method for deep neural networks. In ICML 2013 Workshop on Challenges in Representation Learning (WREPL). +Jinhyuk Lee, Minjoon Seo, Hannaneh Hajishirzi, and Jaewoo Kang. 2020. Contextualized sparse representations for real-time open-domain question answering. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 912-919, Online. Association for Computational Linguistics. +Jinhyuk Lee, Mujeen Sung, Jaewoo Kang, and Danqi Chen. 2021. Learning dense representations of phrases at scale. In Association for Computational Linguistics (ACL). +Omer Levy, Minjoon Seo, Eunsol Choi, and Luke Zettlemoyer. 2017. Zero-shot relation extraction via reading comprehension. In Proceedings of the 21st Conference on Computational Natural Language Learning (CoNLL 2017), pages 333-342, Vancouver, Canada. Association for Computational Linguistics. +Mike Lewis and Angela Fan. 2019. Generative question answering: Learning to answer the whole question. In International Conference on Learning Representations. +Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. 2020. BART: Denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, + +pages 7871-7880, Online. Association for Computational Linguistics. +Patrick Lewis, Ludovic Denoyer, and Sebastian Riedel. 2019. Unsupervised question answering by cloze translation. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 4896-4910, Florence, Italy. Association for Computational Linguistics. +Patrick Lewis, Yuxiang Wu, Linqing Liu, Pasquale Minervini, Heinrich Kuttler, Aleksandra Piktus, Pontus Stenetorp, and Sebastian Riedel. 2021. Paq: 65 million probably-asked questions and what you can do with them. arXiv preprint arXiv:2102.07033. +Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019. RoBERTa: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692. +Bryan McCann, Nitish Shirish Keskar, Caiming Xiong, and Richard Socher. 2018. The natural language decathlon: Multitask learning as question answering. arXiv preprint arXiv:1806.08730. +Julian Michael, Gabriel Stanovsky, Luheng He, Ido Dagan, and Luke Zettlemoyer. 2018. Crowdsourcing question-answer meaning representations. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers), pages 560-568, New Orleans, Louisiana. Association for Computational Linguistics. +Stephen Mussmann, Robin Jia, and Percy Liang. 2020. On the Importance of Adaptive Data Collection for Extremely Imbalanced Pairwise Tasks. In Findings of the Association for Computational Linguistics: EMNLP 2020, pages 3400-3413, Online. Association for Computational Linguistics. +Bo Pang and Lillian Lee. 2005. Seeing stars: Exploiting class relationships for sentiment categorization with respect to rating scales. In Proceedings of the 43rd Annual Meeting of the Association for Computational Linguistics (ACL'05), pages 115-124, Ann Arbor, Michigan. Association for Computational Linguistics. +F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. 2011. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825-2830. +Ethan Perez, Douwe Kiela, and Kyunghyun Cho. 2021. True few-shot learning with language models. arXiv preprint arXiv:2105.11447. + +Matthew Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. 2018. Deep contextualized word representations. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 2227-2237, New Orleans, Louisiana. Association for Computational Linguistics. +Jason Phang, Thibault Févry, and Samuel R Bowman. 2018. Sentence encoders on stilts: Supplementary training on intermediate labeled-data tasks. arXiv preprint arXiv:1811.01088. +Yada Pruksachatkun, Jason Phang, Haokun Liu, Phu Mon Htut, Xiaoyi Zhang, Richard Yuanzhe Pang, Clara Vania, Katharina Kann, and Samuel R. Bowman. 2020. Intermediate-task transfer learning with pretrained language models: When and why does it work? In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 5231-5247, Online. Association for Computational Linguistics. +Raul Puri, Ryan Spring, Mohammad Shoeybi, Mostofa Patwary, and Bryan Catanzaro. 2020. Training question answering models from synthetic data. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 5811-5826, Online. Association for Computational Linguistics. +Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. 2016. SQuAD: 100,000+ questions for machine comprehension of text. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 2383-2392, Austin, Texas. Association for Computational Linguistics. +Ori Ram, Yuval Kirstain, Jonathan Berant, Amir Globerson, and Omer Levy. 2021. Few-shot question answering by pretraining span selection. In Association for Computational Linguistics (ACL). +Nils Reimers and Iryna Gurevych. 2019. SentenceBERT: Sentence embeddings using Siamese BERTnetworks. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 3982-3992, Hong Kong, China. Association for Computational Linguistics. +Amrita Saha, Rahul Aralikatte, Mitesh M. Khapra, and Karthik Sankaranarayanan. 2018. DuoRC: Towards complex language understanding with paraphrased reading comprehension. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1683-1693, Melbourne, Australia. Association for Computational Linguistics. +Timo Schick and Hinrich Schütze. 2021. It's not just size that matters: Small language models are also few-shot learners. In Proceedings of the 2021 Conference + +of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 2339-2352, Online. Association for Computational Linguistics. +Minjoon Seo, Tom Kwiatkowski, Ankur Parikh, Ali Farhadi, and Hannaneh Hajishirzi. 2018. Phrase-indexed question answering: A new challenge for scalable document comprehension. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 559-564, Brussels, Belgium. Association for Computational Linguistics. +Minjoon Seo, Jinhyuk Lee, Tom Kwiatkowski, Ankur Parikh, Ali Farhadi, and Hannaneh Hajishirzi. 2019. Real-time open-domain question answering with dense-sparse phrase index. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 4430-4441, Florence, Italy. Association for Computational Linguistics. +Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D. Manning, Andrew Ng, and Christopher Potts. 2013. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pages 1631-1642, Seattle, Washington, USA. Association for Computational Linguistics. +Nandan Thakur, Nils Reimers, Johannes Daxenberger, and Iryna Gurevych. 2021. Augmented SBERT: Data augmentation method for improving bi-encoders for pairwise sentence scoring tasks. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 296–310, Online. Association for Computational Linguistics. +Erik F. Tjong Kim Sang and Fien De Meulder. 2003. Introduction to the CoNLL-2003 shared task: Language-independent named entity recognition. In Proceedings of the Seventh Conference on Natural Language Learning at HLT-NAACL 2003, pages 142-147. +Adam Trischler, Tong Wang, Xingdi Yuan, Justin Harris, Alessandro Sordoni, Philip Bachman, and Kaheer Suleman. 2017. NewsQA: A machine comprehension dataset. In Proceedings of the 2nd Workshop on Representation Learning for NLP, pages 191-200, Vancouver, Canada. Association for Computational Linguistics. +George Tsatsaronis, Georgios Balikas, Prodromos Malakasiotis, Ioannis Partalas, Matthias Zschunke, Michael R Alvers, Dirk Weissenborn, Anastasia Krithara, Sergios Petridis, Dimitris Polychronopoulos, Yannis Almirantis, John Pavlopoulos, Nicolas Baskiotis, Patrick Gallinari, Thierry Artieres, Axel Ngonga, Norman Heino, Eric Gaussier, Liliana Barrio-Alvers, Michael Schroeder, Ion Androutsopoulos, and Georgios Paliouras. 2015. An overview of the bioasq large-scale biomedical semantic indexing and question answering competition. BMC Bioinformatics, 16:138. + +Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumont, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Remi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander Rush. 2020. Transformers: State-of-the-art natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 38-45, Online. Association for Computational Linguistics. +Qizhe Xie, Minh-Thang Luong, Eduard Hovy, and Quoc V. Le. 2020. Self-training with noisy student improves imagenet classification. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). +Yi Yang and Arzoo Katiyar. 2020. Simple and effective few-shot named entity recognition with structured nearest neighbor learning. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 6365-6375, Online. Association for Computational Linguistics. +Zhilin Yang, Peng Qi, Saizheng Zhang, Yoshua Bengio, William Cohen, Ruslan Salakhutdinov, and Christopher D. Manning. 2018. HotpotQA: A dataset for diverse, explainable multi-hop question answering. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 2369-2380, Brussels, Belgium. Association for Computational Linguistics. +Tianyi Zhang, Varsha Kishore, Felix Wu, Kilian Q. Weinberger, and Yoav Artzi. 2020. BERTScore: Evaluating text generation with bert. In International Conference on Learning Representations. +Yuan Zhang, Jason Baldridge, and Luheng He. 2019. PAWS: Paraphrase adversaries from word scrambling. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 1298-1308, Minneapolis, Minnesota. Association for Computational Linguistics. +Tony Z. Zhao, Eric Wallace, Shi Feng, Dan Klein, and Sameer Singh. 2021. Calibrate before use: Improving few-shot performance of language models. arXiv preprint arXiv:2102.09690. +Yao Zhao, Xiaochuan Ni, Yuanyuan Ding, and Qifa Ke. 2018. Paragraph-level neural question generation with maxout pointer and gated self-attention networks. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 3901–3910, Brussels, Belgium. Association for Computational Linguistics. + +# A Appendix + +# A.1 QuIP Details + +We limit passages to 456 byte-pair encoding (BPE) tokens and questions to 50 so that the concatenation can fit comfortably within the 512 token context usable by the cross-encoder teacher. We create passages from our unlabeled text corpus by greedily selecting maximal chunks of contiguous sentences that fit within the BPE token limit. We pre-compute the teacher predictions $T_{\mathrm{start}}$ and $T_{\mathrm{end}}$ before bi-encoder training. To save space, we sparsify these vectors by only storing the eight largest predicted probabilities, treating all others as 0. + +We conducted minimal hyperparameter tuning for QUIP. We used a learning rate of $1 \cdot 10^{-5}$ (default for most RoBERTa fine-tuning experiments7) and no gradient accumulation, which we found led to faster training. + +# A.2 Paraphrase Fine-tuning Details + +To fine-tune our model for paraphrase classification, we use two practices recommended by Mussmann et al. (2020), who also train a binary classification model that uses cosine similarity-based features derived from fine-tuned BERT embeddings. First, we disable dropout during training, as dropout artificially lowers all cosine similarities. Second, we use a larger learning rate on the final output layer than the Transformer parameters, by a factor of $10^{3}$ . + +# A.3 Downstream Task Hyperparameter Details + +For few-shot paraphrase detection with the frozen model, we use Scikit-learn's logistic regression implementation with default settings (Pedregosa et al., 2011). For fine-tuned paraphrase detection, we again use a learning rate of $1 \cdot 10^{-5}$ and train for 20 epochs, which we found to usually be sufficient for convergence on the training data. For NER, we use the default hyperparameters from the Huggingface transformers repository (Wolf et al., 2020), with the exception of decreasing the learning rate from $5 \cdot 10^{-5}$ to $2 \cdot 10^{-5}$ , which we found improved the RoBERTa baseline on CoNLL. + +# A.4 Sentiment Analysis Calibration + +To calibrate the zero-shot sentiment analysis model, we use ten content-free inputs: "the", + +"be", "to", "of", "and", "a", "in", "that", "have", and "I". These were the top ten words listed on https://en.wikipedia.org/wiki/ Most_common_words_in_English. We only applied calibration for the main QUIP model, as we did not find calibration to improve results for either LM-BFF or the cross-encoder QA student model. + +# A.5 Full QA results + +Table 7 shows EM and F1 scores on the 12 development sets from the MRQA 2019 Shared Task (Fisch et al., 2019). These are divided into 6 in-domain datasets—HotpotQA (Yang et al., 2018), NaturalQuestions (Kwiatkowski et al., 2019), NewsQA (Trischler et al., 2017), SearchQA (Dunn et al., 2017), SQuAD (Rajpurkar et al., 2016), and TriviaQA (Joshi et al., 2017)—for which corresponding training data was used to train the question generation model and teacher, and 6 out-of-domain datasets—BioASQ (Tsatsaronis et al., 2015), DROP (Dua et al., 2019), DuoRC (Saha et al., 2018), RACE (Lai et al., 2017), RelationExtraction (Levy et al., 2017), and TextbookQA (Kembhavi et al., 2017)—for which no training data was used in the QUIP pipeline. QUIP improves over training the bi-encoder directly on the MRQA data by an average of $4.4\mathrm{~F}1$ on the in-domain datasets and $12.7\mathrm{~F}1$ on the out-of-domain datasets. It underperforms the cross-encoder teacher by about $5\mathrm{~F}1$ on both the in-domain and out-of-domain datasets on average. + +# A.6 Stability Analysis + +We experimented with some design decisions that did not materially affect our results. Here, we report these findings as evidence that our basic recipe is stable to many small changes. First, we concatenated the representations of all passages in the same batch and on the same GPU together (9 passages on average), and trained the model to extract answers from this larger pseudo-document; this effectively adds in-batch negative passages, as in Lee et al. (2021). Second, we trained the model to match the argmax prediction of the teacher, rather than its soft distribution over start and end indices. Finally, we used a two-stage beam search to generate questions. For a given passage, we generated 20 possible answers via beam search, chose 10 of these to maximize answer diversity, then generated one question for each answer with another beam search. Our goal was to ensure diversity by forcing + +
In-domainHotpotQANaturalQNewsQASQuADSearchQATriviaQAAverage
Bi-encoder + UnsupervisedQA9.5 / 16.68.0 / 15.57.6 / 14.417.5 / 25.015.4 / 21.117.6 / 23.312.6 / 19.3
Bi-encoder + MRQA61.0 / 77.564.1 / 76.446.1 / 61.570.9 / 79.673.8 / 79.863.1 / 69.063.2 / 74.0
QUIP, no teacher52.9 / 68.757.8 / 70.841.8 / 58.775.4 / 84.864.5 / 71.771.1 / 76.160.6 / 71.8
QUIP61.3 / 77.963.7 / 77.252.4 / 68.785.3 / 91.868.7 / 76.872.0 / 78.167.2 / 78.4
Cross-encoder + MRQA66.8 / 83.070.5 / 82.058.8 / 72.989.1 / 94.878.3 / 84.673.4 / 79.672.8 / 82.8
QUIP, cross-encoder student66.3 / 82.366.5 / 79.454.4 / 70.589.6 / 94.972.1 / 80.173.4 / 79.870.4 / 81.2
Out-of-domainBioASQDROPDuoRCRACERelationExtTextbookQAAverage
Bi-encoder + UnsupervisedQA15.3 / 19.25.9 / 9.514.1 / 17.46.5 / 11.412.7 / 22.18.9 / 13.310.6 / 15.5
Bi-encoder + MRQA42.2 / 57.229.9 / 38.338.6 / 48.629.1 / 39.871.3 / 83.534.7 / 43.641.0 / 51.8
QUIP, no teacher40.9 / 54.933.5 / 43.044.1 / 53.231.8 / 44.470.8 / 82.137.3 / 46.243.0 / 54.0
QUIP51.3 / 67.546.2 / 57.153.0 / 63.239.6 / 53.475.5 / 86.050.2 / 60.052.6 / 64.5
Cross-encoder + MRQA58.0 / 72.955.4 / 65.355.0 / 66.844.2 / 57.778.5 / 88.858.5 / 67.458.2 / 69.8
QUIP, cross-encoder student57.3 / 72.657.5 / 68.356.2 / 67.544.8 / 58.679.5 / 89.158.4 / 67.359.0 / 70.6
+ +Table 7: Exact match/F1 scores on the twelve development datasets from the MRQA 2019 shared task. The six in-domain datasets are on top; the six out-of-domain datasets are on bottom. + +
ModelSQuAD F1Paraphrase AUROCNER F1
QUIP91.7.82161.8
+ concat. passages91.7.81862.7
w/ hard labels91.5.81462.5
w/ 2-stage beam search91.7.82162.8
+ +questions to be about different answers, while also maintaining high question quality. As shown in Table 8, these choices have a relatively minor impact on the results (within .007 AUROC and 1 F1 on NER). + +# A.7 QA Prompts for NER + +Table 9 shows the question prompts we use to initialize the NER model for CoNLL and WNUT. For entity types that occur in both datasets, and for the $\bigcirc$ tag, we always use the same question. We used the English description of the entity type provided by the dataset. + +# A.8 Full training set NER + +Table 10 shows NER results when training on the full training dataset. QUIP gives a 0.6 F1 improvement on WNUT, but has effectively the same accuracy on CoNLL. + +# A.9 Sentiment Analysis QA Prompts + +Table 11 shows the six prompts we use for sentiment analysis for the movie review datasets (SST-2 and MR). Each prompt consists of one question + +Table 8: SQuAD development set F1, average zero-shot paraphrase ranking AUROC across all datasets, and average few-shot NER F1 using question prompts across both datasets for QUIP variants. Models shown here are all similarly effective. + +
Entity typeQuestion
Both datasets
O“What is a generic object?”
Person“Who is a person?”
Location“What is a location?”
CoNLL
Organization“What is an organization?”
Miscellaneous“What is a miscellaneous entity?”
WNUT
Corporation“What is a corporation?”
Product“What is a product?”
Creative work“What is a creative work?”
Group“What is a group?”
+ +Table 9: Question prompts used for the CoNLL and WNUT NER datasets. + +
ModelCoNLLWNUT
RoBERTa-large92.757.9
QuIP, standard92.758.1
QuIP, QA prompts92.858.8
+ +Table 10: F1 scores on NER, using the entire training dataset. + +for the positive label and one for the negative label. For CR, we use the same prompts except that we replace all instances of the word "movie" with "product". + +# A.10 Sentiment Analysis Rationales + +Tables 12, 13, and 14 show full examples and rationales extracted by our zero-shot sentiment analysis method for SST-2, MR, and CR, respectively. In all cases, we use the prompt that led to the highest accuracy on SST-2. For each dataset, we randomly sample ten examples of each label for which the model predicted the correct answer. We highlight in bold the span of $\leq 5$ BPE tokens that the model + +
#LabelQuestion
1+"Why is it good?"
-"Why is it bad?"
2+"Why is this movie good?"
-"Why is this movie bad?"
3+"Why is it great?"
-"Why is it terrible?"
4+"What makes this movie good?"
-"What makes this movie bad?"
5+"What is the reason this movie is good?"
-"What is the reason this movie is bad?"
6+"What is the reason this movie is great?"
-"What is the reason this movie is terrible?"
+ +Table 11: Question prompts used for sentiment analysis on movie review datasets (SST-2 and MR). Prompts used for CR are identical except for replacing "movie" with "product". + +predicts best answers the question associated with the correct label. In some cases, the rationales correspond to clear sentiment markers. In other cases, they highlight an aspect of a movie or product that is criticized or praised in the review; these could be considered reasonable answers to a question like "Why is this movie bad?" even if the sentiment associated with them is unclear without the surrounding context. In future work, it would be interesting to find better ways to align the task of extractive QA and with the goal of producing rationales that are human-interpretable in isolation. + +
LabelSST-2 Example (rationale in bold)
-“for starters, the story is just too slim.” +“paid in full is so stale, in fact, that its most vibrant scene is one that uses clips from brian de palma’s scarface.” +“(e) ventuallly, every idea in this film is flushed down the latrine of heroism.” +“corpus collosum – while undeniably interesting – wore out its welcome well before the end credits rolled about 45 minutes in.” +“makes for a pretty unpleasant viewing experience.” +“while (hill) has learned new tricks, the tricks alone are not enough to salvage this lifeless boxing film.” +“It’s hampered by a lifetime-channel kind of plot and a lead actress who is out of her depth.” +“dull, lifeless, and amateurishly assembled.” +“The movie is what happens when you blow up small potatoes to 10 times their natural size, and it ain’t pretty.” +“every time you look, sweet home alabama is taking anotherbummer of a wrong turn.”
+“though only 60 minutes long, the film is packed with information and impressions.” +“good old-fashioned slash-and-hack is back!” +“with tightly organized efficiency, numerous flashbacks and a constant edge of tension, miller’s film is one of 2002’s involvingly adult surprises.” +“displaying about equal amounts of naivete, passion and talent, beneath clouds establishes sen as a filmmaker of considerable potential.” +“‘easily my choice for one of the year’s best films.’” +“‘a delectable and intriguing thriller filled with surprises, read my lips is an original.’” +“it is great summer fun to watch arnold and his buddy gerald bounce off a quirky cast of characters.” +“The film will play equally well on both the standard and giant screens.” +“for this reason and this reason only – the power of its own steadfast, hoity-toity convictions – chelsea walls deserves a medal.” +“There’s a wickedly subversive bent to the best parts of birthday girl.”
+ +Table 12: Rationales (in bold) extracted by the zero-shot QuIP sentiment analysis model for SST-2. We show ten random examples for each label on which the model made the correct prediction. + +
LabelMR Example (rationale in bold)
-“strangely comes off as a kingdom more mild than wild.”“feels like the work of someone who may indeed have finally aged past his prime . . . and , perhaps more than he realizes , just wants to be liked by the people who can still give him work.”“watching the powerpuff girls movie , my mind kept returning to one anecdote for comparison : the cartoon in japan that gave people seizures.”“this is a movie so insecure about its capacity to excite that it churns up not one but two flagrantly fake thunderstorms to underscore the action.”“witless , pointless , tasteless and idiotic.”“the next big thing's not-so-big ( and not-so-hot ) directorial debut.”“unfortunately , it's also not very good . especially compared with the television series that inspired the movie.”“irwin and his director never come up with an adequate reason why we should pay money for what we can get on television for free.”“with this new rollerball , sense and sensibility have been overrun by what can only be characterized as robotic sentiment.”“the video work is so grainy and rough , so dependent on being ‘naturalistic’ rather than carefully lit and set up , that it's exhausting to watch.”
+“the appearance of treebeard and gollum's expanded role will either have you loving what you're seeing , or rolling your eyes . i loved it ! gollum's ‘performance’ is incredible !”“droll caper-comedy remake of " big deal on madonna street " that's a sly , amusing , laugh-filled little gem in which the ultimate " bellini " begins to look like a " real kaputschnik . ””“katz uses archival footage , horrified documents of lynchings , still photographs and charming old reel-to-reel recordings of meeropol entertaining his children to create his song history , but most powerful of all is the song itself”“a thunderous ride at first , quiet cadences of pure finesse are few and far between ; their shortage dilutes the potency of otherwise respectable action . still , this flick is fun , and host to some truly excellent sequences.”“compellingly watchable .”“an unbelievably fun film just a leading man away from perfection .”“andersson creates a world that's at once surreal and disturbingly familiar ; absurd , yet tremendously sad .”“the invincible werner herzog is alive and well and living in la”“you can feel the heat that ignites this gripping tale , and the humor and humanity that root it in feeling .”“this is a terrific character study , a probe into the life of a complex man .”
+ +Table 13: Rationales (in bold) extracted by the zero-shot QUIP sentiment analysis model for the Movie Reviews (MR) dataset. We show ten random examples for each label on which the model made the correct prediction. + +
LabelCR Example (rationale in bold)
-“i’ve tried the belkin fm transmitter unit with it & it worked well when i set it on top of a portable radio, but was awful trying to use in the car which is somewhat of a disappointment.”“but the major problem i had was with the software.”“after a week i tried to load some more songs and delete a few but the auto load didn’t do anything but turn on my player.”“2 . the scroll button is n ‘t the best , as it sometimes can be hard to select.”“iriver has a better fm receiver built in , but the drawback to iriver products is they are flimsy and poorly constructed.”“i would imagine this is a problem with any camera of a compact nature.”“the pictures are a little dark sometimes.”“the depth adjustment was sloppy.”“the instructions that come with it do n ‘t explain how to make things simple.”“my “fast forward ” button works , but it takes a little extra pressure on it to make it go.”
+“i did not conduct a rigorous test , but just took some identical shots in identical lighting with both cameras , and the canon won hands down.”“as a whole , the dvd player has a sleek design and works fine.”“i , as many others , have waited for many years for the convergence of price , features , size and ease of use to hit that happy center point.”“+ i had no problem using musicmatch software already on my computer to load songs and albums onto this unit”“apex is the best cheap quality brand for dvd players.”“i chose this one because from what i read , it was the best deal for the money.”“the two-times optical zoom operates smoothly and quietly , and lo and behold , a two-piece shutter-like cap automatically slides closed over the lens when you turn the camera off.”“this camera is perfect for the person who wants a compact camera that produces excellent photos in just about any situation.”“it was easy enough to remove the front plate , and there was only one way the battery could be inserted.”“i have been very impressed with my purchase of the sd500 i bought it at the beginning of the month as the ultimate pocket camera and have shot 300 images so far with it.”
+ +Table 14: Rationales (in bold) extracted by the zero-shot QUIP sentiment analysis model for the Customer Reviews (CR) dataset. We show ten random examples for each label on which the model made the correct prediction. \ No newline at end of file diff --git a/questionansweringinfusedpretrainingofgeneralpurposecontextualizedrepresentations/images.zip b/questionansweringinfusedpretrainingofgeneralpurposecontextualizedrepresentations/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..4dfa0573a9e13df053f68ec1e4705d8a6d8ee5a3 --- /dev/null +++ b/questionansweringinfusedpretrainingofgeneralpurposecontextualizedrepresentations/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:85d30f42dfd905c3806f27a0092d214a9c8b3034e9ffc0d4eee57eafa154d05c +size 1117071 diff --git a/questionansweringinfusedpretrainingofgeneralpurposecontextualizedrepresentations/layout.json b/questionansweringinfusedpretrainingofgeneralpurposecontextualizedrepresentations/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..1e73af40a9ca72d0c350c3c726055d3278ccbd92 --- /dev/null +++ b/questionansweringinfusedpretrainingofgeneralpurposecontextualizedrepresentations/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8650a0f475c94a5e431675d5d403d9dff5bb582441ed65c7fb32e1a6f35267f0 +size 511860 diff --git a/questiongenerationforreadingcomprehensionassessmentbymodelinghowandwhattoask/3c9d33d5-9ea8-4716-a998-899cd4c4c14c_content_list.json b/questiongenerationforreadingcomprehensionassessmentbymodelinghowandwhattoask/3c9d33d5-9ea8-4716-a998-899cd4c4c14c_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..04e9f3dc510046178f7830bba792302e7baca8e4 --- /dev/null +++ b/questiongenerationforreadingcomprehensionassessmentbymodelinghowandwhattoask/3c9d33d5-9ea8-4716-a998-899cd4c4c14c_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0edbf50b7e6f17503a571f38f4c340e3a335a7667fae6d2c8716bcf0a14fa61a +size 105415 diff --git a/questiongenerationforreadingcomprehensionassessmentbymodelinghowandwhattoask/3c9d33d5-9ea8-4716-a998-899cd4c4c14c_model.json b/questiongenerationforreadingcomprehensionassessmentbymodelinghowandwhattoask/3c9d33d5-9ea8-4716-a998-899cd4c4c14c_model.json new file mode 100644 index 0000000000000000000000000000000000000000..e9d3a937743f250be77ad7e13d7180cda1d32555 --- /dev/null +++ b/questiongenerationforreadingcomprehensionassessmentbymodelinghowandwhattoask/3c9d33d5-9ea8-4716-a998-899cd4c4c14c_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e3d2ef4157e6145b55800f54d4b247715505dd218abf1a024b5fc12187f0d6b0 +size 134183 diff --git a/questiongenerationforreadingcomprehensionassessmentbymodelinghowandwhattoask/3c9d33d5-9ea8-4716-a998-899cd4c4c14c_origin.pdf b/questiongenerationforreadingcomprehensionassessmentbymodelinghowandwhattoask/3c9d33d5-9ea8-4716-a998-899cd4c4c14c_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b5e5b7297388f6e16ec9715905e92871ca47c64b --- /dev/null +++ b/questiongenerationforreadingcomprehensionassessmentbymodelinghowandwhattoask/3c9d33d5-9ea8-4716-a998-899cd4c4c14c_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:19b344a4e3136cc81a6eaf3bf315ca4e9d0972784794297b556b2c0bbc119171 +size 416952 diff --git a/questiongenerationforreadingcomprehensionassessmentbymodelinghowandwhattoask/full.md b/questiongenerationforreadingcomprehensionassessmentbymodelinghowandwhattoask/full.md new file mode 100644 index 0000000000000000000000000000000000000000..dc034a61ce2563222350981cfebfa1d5059cfe30 --- /dev/null +++ b/questiongenerationforreadingcomprehensionassessmentbymodelinghowandwhattoask/full.md @@ -0,0 +1,401 @@ +# Question Generation for Reading Comprehension Assessment by Modeling How and What to Ask + +Bilal Ghanem1, Lauren Lutz Coleman2, Julia Rivard Dexter2, Spencer McIntosh von der Ohe1, Alona Fyshe1 + +1University of Alberta, Canada + +$^{2}$ EyeRead, Canada + +{bghanem,vonderoh,alona} @ualberta.ca + +{lauren,julia} $@$ eyeread.co + +# Abstract + +Reading is integral to everyday life, and yet learning to read is a struggle for many young learners. During lessons, teachers can use comprehension questions to increase engagement, test reading skills, and improve retention. Historically such questions were written by skilled teachers, but recently language models have been used to generate comprehension questions. However, many existing Question Generation (QG) systems focus on generating literal questions from the text, and have no way to control the type of the generated question. In this paper, we study QG for reading comprehension where inferential questions are critical and extractive techniques cannot be used. We propose a two-step model (HTA-WTA) that takes advantage of previous datasets, and can generate questions for a specific targeted comprehension skill. We propose a new reading comprehension dataset that contains questions annotated with story-based reading comprehension skills (SBRCS), allowing for a more complete reader assessment. Across several experiments, our results show that HTA-WTA outperforms multiple strong baselines on this new dataset. We show that the HTA-WTA model tests for strong SCRS by asking deep inferential questions. + +# 1 Introduction + +Reading is an invaluable skill, and is core to communicating in our digital age. Reading also supports other forms of development; when children read, it sharpens their memory, and improves social skills (Halliday, 1973; Mason, 2017). Yet, statistics show that one out of five children in the U.S. face learning difficulties (Shaywitz, 2005), especially in reading (Cornoldi and Oakhill, 2013). The coronavirus pandemic beginning in 2020 had a huge impact on the early reading skills of many children, and threatens to leave a lasting impact on a whole generation of young readers (Gupta and Jawanda, 2020). + +The pandemic forced many children to learn online, putting in sharp relief the need for effective online education platforms. In particular, reading games have become popular, and can help fill the gap when teachers cannot read in person with students. These platforms present students with short passages and associated comprehension questions. These questions are key to assessing a reader's comprehension of a passage, and can also enhance learning (Chua et al., 2017). But, writing diverse and engaging comprehension questions is a nontrivial task. + +Teachers need to generate new comprehension questions whenever they incorporate new text into a curriculum. New text helps to keep material fresh and topical, and can allow teachers to customize lessons to the interests of a particular student cohort. After finding such custom reading material, teachers must write new comprehension questions to evaluate several reading aspects of comprehension (e.g. understanding complex words, recalling events, etc.). + +Thus, to improve the educational process, and lighten the load on teachers, we need tools to automate Question Generation (QG): the task of writing questions for a given passage. Generated questions can be either inferential or literal (extractive) questions. Literal questions can be answered using only information stated in the text, whereas inferential questions require additional information or reasoning. Previous works focused on this aspect of the questions in reading comprehension and discarded the comprehension skills (e.g. close reading, predicting, figurative language, etc.) (Murakhovs' ka et al., 2021). + +We take inspiration from continual learning (Parisi et al., 2019), which orders a set of learning tasks to improve model performance. We begin by training a model on the general task of QG (How to ask: HTA), and follow with our task of interest: generating a targeted question of a particular type + +(What to ask: WTA). + +This paper focuses on the generation of questions for story-based reading comprehension skills (SBRCS), which are varied and cover many aspects of reading comprehension. We create a QG dataset for SBRCS1. Although our aim in creating this dataset is to enrich educational applications, this dataset can be considered as a source for general QG and question answering (QA) systems in NLP. + +Our focus here is to build a question generator without answer supervision as the case in a real-life application, where a story only will be given as input. This is a challenging task, as many different questions can be generated from a story when there is no answer supervision. QG with answer supervision is another prevalent research line in the literature (Zhao et al., 2018; Ma et al., 2020; Wang et al., 2020; Chen and Xu, 2021). + +The contributions in this work are as follows: + +- We build a novel QG dataset for SBRCS. The dataset contains advanced reading comprehension skills extracted from stories. +- We propose a two-steps method to generate skill-related questions from a given story. The method takes advantage of previous datasets to improve generalizability, and then, teaches a model how to ask predefined styles of questions. +- We demonstrate the efficiency of the proposed method after extensive experiments, and we investigate its performance in a few-shot learning setting. + +The rest of the paper is structured as follows. In the next section, we present an overview of the literature work. In Section 3, we describe how we built our dataset. Section 4 describes the proposed methodology. The experimental setting is presented in Section 5. The results and the analysis are presented in Section 6. Finally, we draw some conclusions and possible future work for this study. + +# 2 Related Works + +QG has progressed rapidly due to new datasets and model improvements. Many different QG models have been proposed, starting for simple vanilla Sequence to Sequence Neural Networks models + +(seq2seq) (Du et al., 2017; Zhou et al., 2017; Yuan et al., 2017) to the more recent transformer-based models (Dong et al., 2019; Chan and Fan, 2019; Varanasi et al., 2020; Narayan et al., 2020; Bao et al., 2020). Some QG systems use manual linguistic features in their models (Harrison and Walker, 2018; Khullar et al., 2018; Liu et al., 2019a; Dhole and Manning, 2020), some consider how to select question-worthy content (Du and Cardie, 2017; Li et al., 2019; Scialom et al., 2019; Liu et al., 2020), and some systems explicitly model question types (Duan et al., 2017; Sun et al., 2018; Kang et al., 2019; Zhou et al., 2019). The last group focused only on generating questions that start with specific interrogative words (what, how, etc.). + +QG has been used to solve many real-life problems. For example, QG in conversational dialogue (Gu et al., 2021; Shen et al., 2021; Liu et al., 2021b) where models were taught to ask a series of coherent questions grounded in a QA style, QG based on visual input (Mostafazadeh et al., 2016; Shin et al., 2018; Shukla et al., 2019), and QG for deep questions such as mathematical, curiosity-driven, clinical, and examination-type questions (Liyanage and Ranathunga, 2019; Scialom and Staiano, 2020; Yue et al., 2020; Jia et al., 2021). + +# 3 Data + +Despite the recent efforts for building reading comprehension QA datasets, to the best of our knowledge, none of the available datasets explored SBRCs. Questions in previous datasets ask only either inferential or literal questions from a given passage/story. Rogers et al. (2020), developed questions with general reasoning types based on text from news and blogs (e.g. Quora). We believe that those texts sources are not rich enough to examine reasoning skills. Advanced reasoning skills (e.g. Figurative Language) are usually used in children's stories to assess comprehension skills. Additionally, we use a extensive set of reading comprehension skills that deeply evaluates the abilities of the readers (e.g. imagination skill by Visualizing). In the following, we will show how we built our dataset. Table 1 gives an overview of the dataset. + +# 3.1 Dataset Design + +# 3.1.1 Stories Collection + +Our stories (passages) are multi-genre, self-contained narratives. This content variety leads + +annotators towards asking non-localized questions that test for more advanced reading comprehension skills. The stories are generated using several resources: 1. acquired from free public domain content (Gutenberg Project $^2$ ), 2. partnerships with a publishing house (Blue Moon Publishers $^3$ ) and an educational curriculum development foundation (The Reimagined Classroom $^4$ ), and 3. authored by two professional writers, (the majority of the stories are from this last category). To provide good lexical coverage and diverse stories, we choose to write and collect stories that come from a varied set of genres (e.g. science, social studies, fantasy, fairy tale, historical fiction, horror, mystery, adventure, etc.). In total, we collect 726 multi-domain stories. The stories' lengths range from a single sentence to 113 sentences. + +# 3.1.2 Questions and Comprehension Skills + +Previous comprehension question datasets focused on either inferential or literal questions. Although these questions assess comprehension skills, they do not provide fine-grained evaluation of the reader comprehension. Thus, to build a more comprehensive list of question types, we started by reviewing curriculum documents available from Columbia University Teacher's College Readers and Writers Workshop Program. Then, we compiled a list of SBRCs, which we then expanded to include additional skills based on school teachers' recommendations. In Section A.1, we present further details for each skill type. Also, in Appendix A.2, we give further details on the skills list and on the educational theory behind the skills taxonomy. Our final list contains the following skills: + +1. Basic Story Elements (BSE): Can the reader identify the story's main characters and setting? + +From the details in this passage, how many individuals were part of this investigation? + +2. Character Traits (CT): Can the reader identify the traits attributable to certain characters in the story (e.g. character feelings, physical attributes)? + +$^{2}$ https://www.gutenberg.org/ +3https://bluemoonpublishers.com/ +4https://www.reimaginedclassroom.com/ +5https://www.tc.columbia.edu/curriculum-and-teaching/literacy-specialist/the-reading-writing-project/ +6https://readingandwritingproject.org/ + +How did the Rabbit feel in this passage? + +3. Close Reading (CR): Can the reader extract the text span in a story where the author best describes or explains a key point? + +How many people celebrated Karata's birth? + +4. Figurative Language (FL): Is the reader able to recognize the implied meaning of a sentence? + +Reread this sentence: "His legs were pumping so fast that they felt like jelly." What did the author mean by this? + +5. Inferring (I): Can the reader infer what happened in between scenes if the time in between is not explicitly described? + +Why do you think Minho opened the suitcase? + +6. Predicting (P): Can the reader find textual clues and use them to guess what would happen next? + +Do you think that the bear enrolled in classes and became a student? + +7. Summarizing (S): Is the reader able to recognize the main literary elements of the characters, the events, the problem, and the solutions? + +What is Bal doing? + +8. Visualizing (V): Can the reader visualize scenes in her/his head to fully comprehend the story? + +What is the author trying to describe by writing "everything below became smaller and smaller"? + +9. Vocabulary (VO): Can the reader identify the right meaning of a word within a context when the word has multiple possible definitions? + +Which word in the passage is a synonym for "stubborn"? + +With our list of SBRCS as a guide, we wrote question-answer pairs for each story. Given the difficulty of the task, we needed a large number of + +
BSECTCRFLIPSVVO
# Stories269.0280.0448.0219.0449.0152.0360.0153.0403.0
# Question-answer pairs390.0415.0719.0292.0695.0162.0560.0163.0604.0
Avg. #tok. in stories168.98189.62133.44137.86133.63145.09192.8118.61143.21
Max. #tok. in stories1159.01159.01159.0935.01159.01132.01132.0935.01040.0
Avg. #tok. in questions9.1411.8211.1216.3813.2112.929.8812.9815.96
Max. #tok. in questions24.058.055.070.052.076.043.039.049.0
Avg. #tok. in answers4.173.814.494.76.166.485.915.103.46
Max. #tok. in answers29.034.073.030.029.021.046.040.022.0
# Literal Questions274.0120.0606.0108.016.011.0464.036.0168.0
# Inferential Questions115.0295.0113.0148.0679.0151.096.0127.0436.0
+ +Table 1: Collected dataset's statistics. There are 726 stories, which can have questions from multiple skill types (described in Section 3.1). + +trained content writers to build the required questions. Each written question should fall into one of the mentioned skills. For that, a total of 25 professionals contributed to the writing process (18 teachers, 7 graduate students). Each annotator was asked to write a question per skill for a given story. Not every skill is applicable to every story, so some skills were discarded for some stories. We chose not to use crowdworkers (e.g. Amazon Mechanical Turk) to ensure high-quality and educationally-appropriate questions. To verify the quality of the generated content, a second team member reviews each question-answer pair before adding them to the dataset. If the second team member found issues, a discussion took place. In the cases that the team members could not reach an agreement, a third team member is brought in to resolve the disagreement. In addition to annotating questions with a skills label, our content writers annotate each question as either Literal or Inferential question types. This information is important to measure the comprehension performance of the reader on each question type. Overall, we generate 4K question-answer pairs, with an average of 5.5 pairs per story. Note that we did not ask multiple annotators to write questions per story in order to measure the annotators' agreement. Different annotators often write the same question in different ways, or may choose a different question topic for a given skill, or even select a different skill. Thus, measuring inter-annotator agreement is not meaningful. Instead, we chose to ask one annotator to write questions and another to validate the questions grammatically and to check whether the question is correctly related to the chosen skill. + +# 4 Methodology + +Given the fact that including more data in a reading comprehension system is important for gen + +eralization (Chung et al., 2018; Talmor and Berant, 2019), and given that our created dataset has the SBRCS which are missed in previous datasets, we propose a two-steps method to generate skill-related questions from a given story: HTA followed by WTA. HTA teaches the model the typical format for comprehension questions using large previously released datasets. We use two well-known datasets, SQuAD (Rajpurkar et al., 2016) and CosmosQA (Huang et al., 2019). In Appendix A.3, we add more details on both of these datasets. These previous datasets are not annotated with the question types outlined in Section 3.1, so the HTA phase allows us to take advantage of those datasets. WTA guides the model to generate questions to test the specific comprehension skills enumerated in Section 3.1. Thus, in HTA, we train (fine-tune) a model on large QG datasets, and then, we further train the model to teach the model what to ask (WTA). For the generation model, we use the pre-trained Text-to-Text Transfer Transformer T5 (Raffel et al., 2020), which closely follows the encoder-decoder architecture of the transformer model (Vaswani et al., 2017). T5 is a SOTA model on multiple tasks, including QA. + +# 4.1 How to Ask (HTA) + +Previous works showed that incorporating more data when training a reading comprehension model improves performance and generalizability (Chung et al., 2018; Talmor and Berant, 2019). However, we cannot incorporate previously released datasets with our new one, as they do not include compatible question skills information. However, they do contain many well-formed and topical questions. Thus, we train a T5 model on SQuAD and CosmosQA datasets to teach the model how to ask questions. + +Previous neural question generation models take the passage as input, along with the answer. How- + +![](images/2d83b5e6934374f5b6844c76918bb0ce792f42ebd885176efcaa0541d96ac11d.jpg) +Figure 1: Input and output format of the How to Ask (HTA) model. + +ever, encoders can pass all of the information in the input to the decoder, occasionally causing the generated question to contain the target answer. Since the majority of the questions in our created dataset are inferential questions, the answers are not explicitly given in the passages (unlike extractive datasets). Thus, we feed the stories to the encoder, but withhold the answers. Unlike previous systems, we then train the model to generate the questions and answers. We propose this setting to generate fewer literal questions. During our experiments, we evaluated the effect of excluding the answers, and we found them useful to the system. + +In Figure 1 we show the input-output format of the model. The encoder input is structured as $\langle \text{STORY_TEXT} \rangle$ , where $\langle \cdot / s \rangle$ is the end-of-sentence token. The decoder generates multiple question-answer pairs as $\langle \text{QUESTION_TOKEN} \rangle_1$ , $\langle as \rangle$ , $\langle \text{ANSWER_TOKEN} \rangle_1$ , $\langle sp \rangle$ , ..., $\langle \text{QUESTION_TOKEN} \rangle_n$ , $\langle as \rangle$ , $\langle \text{ANSWER_TOKEN} \rangle_n$ , where $\langle as \rangle$ separates a question from its answer, and $\langle sp \rangle$ separates a question-answer pair from another. The model can generate more than one question-answer pair. We prepare the data to include all of a passage's question-answer pairs in the decoder. Some passages include single question-answer pair, and some passages have up to fifteen pairs. + +# 4.2 What to Ask (WTA) + +QG models take a passage/story as input and generate a question. The type of generated question is not controlled and is left for the system to decide it. Thus, the generated question is usually an undesired question. Thus, in order to control the style of the generated question, the system needs an indication about the skill that the system is expected to generate a question for. Liu et al. (2020) proposed a + +![](images/65ecd72708e582b05c3332561d51fdd27634aaad1274d09ac12f9de3fe19b6f3.jpg) +Figure 2: Input format of the What to Ask (WTA) model. The output format is the same as in HTA model (see Figure 1). + +way to control the style of the generated questions (e.g. what, how, etc.). The authors built a rule-based information extractor to sample meaningful inputs from a given text, and then learn a joint distribution of before asking the GPT2 model (Radford et al., 2019) to generate questions. However, this distribution can only be learned using an extractive dataset (e.g. SQuAD); the model cannot learn to generate inferential questions. + +To control the skill of the generated question, we use a specific prompt per skill, by defining a special token $<\text{SKILL_NAME}>$ corresponding to the desired target skill, using the collected dataset. This helps us to control what to extract from the pretrained model. Thus, the encoder takes as input $<\text{SKILL_NAME}>$ and $<\text{STORY_TEXT}>$ , where $<\text{SKILL_NAME}>$ indicates to the model for which skill the question should be generated (see Figure 2). The data format in the decoder is similar to the one in the HTA step, but here the model generates a single question-answer pair. As a result, the encoding of the $<\text{STORY_TEXT}>$ will be based on the given $<\text{SKILL_NAME}>$ . In this way, the model encodes the same story in a different representation when a different $<\text{SKILL_NAME}>$ is given. A similar technique was used in the literature to include persona profiles in dialogue agents to produce more coherent and meaningful conversations (Scialom et al., 2020). + +# 5 Experiments + +# 5.1 Decoding Method + +Decoding strategies are crucial and directly impact output quality. In general, Beam Search (Reddy, 1977) is the most common algorithm, in addition to some other sampling techniques such as Nucleus sampling (Top-p) (Holtzman et al., 2019). In Beam Search, the output of a model is found by maximizing the model probability. On the other hand, Nucleus sampling selects the smallest possible set + +of tokens whose cumulative probability exceeds the probability $p$ . Experimentally, we found that using the top-p ( $p = 0.9$ ) algorithm yields the best results in terms of the used scoring metrics, thus we use it in all of our experiments. + +# 5.2 Evaluation Metrics + +QG often uses standard evaluation metrics from text summarization and machine translation (BLEU (Papineni et al., 2002), ROUGE (Lin, 2004), METEOR (Banerjee and Lavie, 2005), etc.). However, such metrics do not provide an accurate evaluation for QG task (Novikova et al., 2017), especially when the input passage is long (and many acceptable questions that differ from the gold question can be generated). Thus, to alleviate shortcomings associated with n-gram based similarity metrics, we use BLEURT (Sellam et al., 2020) (BLEURT-20), which is state-of-the-art evaluation metric in WMT Metrics shared task. BLEURT is a BERT-based model that uses multi-task learning to evaluate a generated text by giving it a value mostly between 0.0 and 1.0. In our experiments, we consider BLEURT as the main metric for the evaluation. We also report standard MT metric BLEU (1-4 ngrams), and perform an additional manual evaluation. + +Manual evaluation is required in our collected dataset, because teachers wrote a single question per skill for a given story, where the model might generate other possible questions for the same skill. + +# 5.3 Implementation Details + +We fine-tune a T5 model ( $t5$ -base from Hugging-Face library) using the Adam optimizer with a batch size of 8 and a learning rate of $1e - 4$ . We use a maximum sequence length of 512 for the encoder, and 128 for the decoder7. We tested the T5-large model, but we did not notice any improvements considering BLEURT metric. We train all models for a maximum of ten epochs with an early stopping value of 1 (patience) based on the validation loss. We use a single NVIDIA Titan RTX with 24G RAM. + +For HTA, we validate on a combined version of the validation sets from both datasets (SQuAD and CosmosQA). Regarding the collected dataset validation set, we use stratified sampling: we took a random $10\%$ of stories from each skill since the dataset is unbalanced. We apply the same strategy + +with the test set but with a value of $20\%$ . + +# 5.4Baselines + +To evaluate the performance of our model, we use a set of models that showed state-of-the-art results on several datasets. We obtain the results of those models by running their published GitHub code on our collected dataset. For all of the following baselines, we use SQuAD, CosmosQA, and the collected dataset for training and we test on the test part of the collected dataset: + +- Vanilla Seq2seq (Sutskever et al., 2014): a basic encoder-decoder sequence learning system for machine translation. This model takes the story as input and generates a question. +- NQG-Seq (Du et al., 2017): another Seq2seq that implements an attention layer on top of a bidirectional-LSTM encoder. The authors use two encoders, one to encode the sentence that has the answer, and another to encode the whole document. The model then is trained to generate questions. +- NQG-Max (Zhao et al., 2018)8: a QG system with a maxout pointer mechanism and gated self-attention LSTM-based encoder to address the challenges of processing long text input. This model takes a passage and an answer as input and generate a question. The answer must be a sub span of the passage. +- CGC-QG (Liu et al., 2019a): a Clue Guided Copy network for Question Generation, which is a sequence-to-sequence generative model with a copying mechanism that takes a passage and an answer (as a span in the text) and generate the question. The text representation in the encoder (GRU network) is represented using a variety of features such as GloVe vectors, POS information, answer position, clue word, etc. +- AnswerQuest (Roemmele et al., 2021): a pipeline model that uses as a first step a previous model (Yang et al., 2019) to retrieve the relevant sentence that has the answer from a document. And then, the sentence is fed to a transformer-based sequence-to-sequence model that is enhanced with a copy mechanism. + +- One-Step: a baseline that uses T5 model trained with all data in one step instead of having separate HTA and WTA steps. Because there is only a single step, the skill name is not included in the encoder's input. +- T5-WTA: the WTA model trained using T5 model as a seed model. The HTA training step is not used here. We use this baseline to evaluate the effect of training WTA using HTA. + +For all of the previous baselines that require the answer to be a sub-span in the passage, we use the semantic text similarity method that was proposed in (Ghanem et al., 2019) to retrieve the most similar span in the passage. The method extracts several ngrams features from a claim and text spans, and then compute cosine similarity to get the most similar span. In this work, we replace the ngrams features of a text with embeddings extracted from RoBERTa model (Liu et al., 2019b). This process has been done on the inferential questions as their answers are not clearly given in the text. + +# 6 Results and Analysis + +Table 2 presents the results of the proposed HTA-WTA method with the baselines. We can see that out of the baselines, T5-WTA performs best in terms of BLEURT score $(32.96\%)$ , followed by NQG-Max with a value of $31.78\%$ . Given its high BLEURT score, it is surprising that T5-WTA model has low BLEU-4. This implies that the generated questions use rich vocabulary, making them different from the gold in terms of overlapping ngrams, but semantically similar leading to higher BLEURT score. As shown in the table, HTA-WTA's BLEURT score outperforms all of the previous QG models by a noticeable margin, showing that including the skill name information plays an important role in generating the intended questions. Also, training on more QG datasets improves the performance. We also noted that the CGC-QG model achieves a higher BLEU-1 than our HTA-WTA model. We argue that this is because the Clue Words Prediction Module learns important cues, increasing the uni-gram overlap with the gold references (BLEU-1). + +Regarding the generated questions type, in Table 3 we show the performance of the T5-based models per question type (inferential and literal). Though One-Step and HTA-WTA models were trained on the same amount of data, the results show that HTA + +WTA model clearly performs better than the One-Step model, especially on inferential questions. We see a similar scenario when comparing One-Step and T5-WTA models, yet, the gap is smaller. In general, we can notice that the performance gaps for the inferential questions are larger than the literal ones. Thus, we can conclude that HTA-WTA is generating more correct inferential questions, which is challenging. This experiment concludes that transformers-based models are capable of asking questions beyond the literal meaning of the text. This confirms what was shown by Liu et al. (2021a) regarding the skills that language models can acquire. Additionally, as some training questions directly quote text from the given story. The T5 model was able to learn how to quote the proper segment of the passage when generating questions. + +The One-Step model performs similarly to the baselines, although it has been trained using the T5 model and on all three datasets. This may be due to the fact that we did not include the skill name in the encoder, which guides the model to generate skill related questions. To better understand the differences between the outputs of One-Step and HTA-WTA models, we used human evaluation. This evaluation is to assess the quality of the generated question in terms of 1. Answerability (Ay), 2. Fluency (Fy), and 3. Grammaticality (Gy) categories, following Harrison and Walker (2018); Azevedo et al. (2020). We include these three criteria as questions may have high Fluency and Grammaticality scores, but not be answerable. We select a sample of 110 story-question pairs from the test dataset, for both models. Then, we perform a human evaluation using crowdworkers on Amazon Mechanical Turk. We use a "master" qualification criteria to restrict the participation of workers in our evaluation study to those who have a high historical HIT accuracy, and workers are required to be located in an English speaking country. Each HIT was answered by three workers. Each worker needs reads the story, and provides ratings (1-5, low to high) for the generated questions, and the three criteria. Table 4 shows the average rating assigned by the workers for the 3 criteria. Originally, we hypothesized that adding the skill name to the input would force the model to formulate a specific SBRCS question, even if it is not applicable to the current passage. Omitting the skill name may allow the model score high values as it has been left to decide the question. The results show that both + +
ModelBLEU-1BLEU-2BLEU-3BLEU-4BLEURT
Vanilla Seq2seq17.167.784.282.3708.42
NQG-Seq18.858.314.372.4911.13
NQG-Max19.277.174.122.7731.78
CGC-QG23.9312.017.825.6829.28
AnswerQuest20.449.084.534.7129.15
One-Step15.198.054.762.9429.45
T5-WTA18.539.986.063.9232.96
HTA-WTA22.1514.2910.197.6734.82
+ +Table 2: Models' performances (percentages) on the collected dataset. For all scores, higher is better. + +
ModelInferentialLiteral
One-Step28.4430.63
T5-WTA33.1332.78
HTA-WTA35.4534.08
+ +Table 3: T5-based models' performances (percentages) on each question type using BLEURT metric. + +
ModelAyFyGySkills Accuracy
One-Step3.824.284.370.16
HTA-WTA3.894.294.450.8
+ +Table 4: Human evaluation ratings for our 3 criteria, on a scale 1-5. + +models are similar in terms of the given categories, except that HTA-WTA performs slightly better in all of the three categories. However, these results refute our claim and show that adding the skill information makes the model generate slightly better questions in terms of quality. In Section A.4, we present an ablation test and discuss some causes of errors in generating questions. + +Impact of Skill Name Token. In order to quantify the impact of skill name in the input, we do another human manual evaluation to assess how beneficial the skill name token is when we add it to the HTA-WTA model. Thus, we ask two professional persons who were involved in the annotation process to assign skill names to the generated questions of both One-Step and HTA-WTA models. We selected these models as they were trained on the same amount of data; the only difference between them is that the HTA-WTA model uses the skill name token. We utilize the same question sample that was used in the previous human evaluation experiment. Few annotation conflicts were found and were solved after a discussion. We evaluate the results using accuracy (see Table 4). The result for One-Step model is 0.16, and 0.8 for HTA-WTA model. We can clearly see a large gap in accuracy between both models, and this becomes clear with the skills that have a low number of instances in the dataset (e.g. Figurative Language, Predicting, etc.). + +This result shows that, in addition to using the skill name token to control the skill of the generated questions, it helps the model to learn the underrepresented skills in the dataset. Table 6 in Appendix A.5 presents the F1 scores per skill name. We also notice that HTA-WTA model performed perfectly on the given sample of Predicting and Figurative Language (F1 is 1.0 for each skill). This is an interesting result given that the type of the questions for both skills is inferential, which is harder to generate compared to the literal questions. + +Few-Shot Generation. The process of manually writing questions to assess humans SBRCS is difficult. In some stories, professional writers find obstacles in writing questions for some skills as those skills require high attention and advanced reasoning skills to be written. We can see that in our own dataset, as some skills have fewer questions (e.g. Predicting, Visualizing, etc.). Thus, in this experiment, we evaluate the performance of HTA-WTA model when we inject a low percentage of the skills' instances into the training set. This experiment will simulate the case when training a model on a dataset that contains few skills' instances. We use the stratified sampling technique when sampling fewer instances from the collected dataset. Figure 3 shows that injecting only $10\%$ of the data led to a boost in performance of 5.99 (BLEURT). The result at $10\%$ $(33.21\%)$ exceeds the results of most of the baselines and is higher than T5-WTA and NQG-MAX models when trained on all the datasets (see Table 2). In Table A.6 in the appendix, we present the results considering other models and metrics. In most cases, the performance gradually improves as data grows. We notice a small drop when we move from $10\%$ to $30\%$ . This behaviour was previously reported by Stappen et al. (2020). Further research is needed to investigate the causes of this behaviour. + +![](images/12c1a6dae694efce5189b238feaea7614d2789f8f1e0e0229027417b6a9f910e.jpg) +Figure 3: Few-shot performance in BLEURT of the HTA-WTA model over a percentage of added few-shot samples. 1 means single instance per skill (9 instances). + +# 7 Conclusion and Future Work + +In this paper, we presented a new reading comprehension dataset to assess reading skills using stories. Unlike previous datasets that focused on either inferential or literal questions, our dataset has nine different SBRCS, each contains inferential and literal questions. In addition to that, we proposed HTA-WTA model which uses two-steps fine-tuning processes to take advantage of previous datasets which have different question formats, and to learn how to ask skill-related questions. We evaluated the model on the collected dataset and compared it to several strong baselines. Our extensive experiments showed the effectiveness of the model. Additionally, HTA-WTA is able to generate high quality questions when only $10\%$ of the dataset is used ( $\sim 240$ instances). In future work, we plan to extend our dataset with additional skills, and to investigate how our model can be integrated into online educational platforms. + +# 8 Ethical Considerations + +Data collection and Annotation. We made sure that the sources we use to collect stories do not prevent any kind of copyright infringement. The content distribution licenses were checked before any use. Additionally, we manually examined the stories and the created questions to ensure there are no privacy or ethical concerns, e.g., toxic language, hate speech, or any bias against underrepresented groups. EyeRead has outreach programs in place to recruit writers from diverse populations, incorporate their writing into the online system, and properly compensate them for their work. Writers that created questions earned comparable hourly wages to those earned by salaried teachers in a summer program. We estimated the amount of time AMT workers need to finish a HIT and then we compensated them so that the payment rate was higher than the local living wage per hour. Each AMT worker received $0.41 USD for completing + +one HIT, which we estimated would take 1 minute. Bias in Language Models. Recently, many research works found that language models have several types of bias, e.g. gender, race, religion, etc., and this is due to the data used to train them (Liang et al., 2021). Removing bias from language models completely is difficult, if not impossible (Gonen and Goldberg, 2019). Thus, here we acknowledge that the QG model we trained might cause ethical concerns, e.g. generating biased questions about stories' characters. EyeRead is keenly aware of this, and continues to monitor both teacher and model-generated questions before they are integrated into their system. + +# References + +Marlene Asselin. 1999. Balanced literacy. Teacher Librarian, 27(1):69. +Pedro Azevedo, Bernardo Leite, Henrique Lopes Cardoso, Daniel Castro Silva, and Luís Paulo Reis. 2020. Exploring NLP and Information Extraction to Jointly Address Question Generation and Answering. In IFIP International Conference on Artificial Intelligence Applications and Innovations, pages 396-407. Springer. +Satanjeev Banerjee and Alon Lavie. 2005. METEOR: An Automatic Metric for MT Evaluation with Improved Correlation with Human Judgments. In Proceedings of the acl workshop on intrinsic and extrinsic evaluation measures for machine translation and/or summarization, pages 65-72. +Hangbo Bao, Li Dong, Furu Wei, Wenhui Wang, Nan Yang, Xiaodong Liu, Yu Wang, Jianfeng Gao, Songhao Piao, Ming Zhou, et al. 2020. Unilmv2: Pseudomasked Language Models for Unified Language Model Pre-training. In International Conference on Machine Learning, pages 642-652. PMLR. +Ying-Hong Chan and Yao-Chung Fan. 2019. A Recurrent BERT-based Model for Question Generation. In Proceedings of the 2nd Workshop on Machine Reading for Question Answering, pages 154-162. +Xu Chen and Jungang Xu. 2021. An Answer Driven Model For Paragraph-level Question Generation. In 2021 International Joint Conference on Neural Networks (IJCNN), pages 1-7. IEEE. +Bee Leng Chua, Oon-Seng Tan, and Paulina Sock Wah Chng. 2017. Mediated Learning Experience: Questions to Enhance Cognitive Development of Young Children. Journal of Cognitive Education and Psychology, 16(2):178-192. +Yu-An Chung, Hung-Yi Lee, and James Glass. 2018. Supervised and Unsupervised Transfer Learning for Question Answering. In Proceedings of the 2018 + +Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 1585-1594. +Cesare Cornoldi and Jane V Oakhill. 2013. Reading Comprehension Difficulties: Processes and Intervention. Routledge. +Kaustubh Dhole and Christopher D Manning. 2020. Syn-QG: Syntactic and Shallow Semantic Rules for Question Generation. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 752-765. +Li Dong, Nan Yang, Wenhui Wang, Furu Wei, Xiaodong Liu, Yu Wang, Jianfeng Gao, Ming Zhou, and Hsiao-Wuen Hon. 2019. Unified Language Model Pretraining for Natural Language Understanding and Generation. Advances in Neural Information Processing Systems, 32:13063-13075. +Xinya Du and Claire Cardie. 2017. Identifying Where to Focus in Reading Comprehension for Neural Question Generation. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 2067-2073. +Xinya Du, Junru Shao, and Claire Cardie. 2017. Learning to Ask: Neural Question Generation for Reading Comprehension. In Association for Computational Linguistics. +Nan Duan, Duyu Tang, Peng Chen, and Ming Zhou. 2017. Question Generation for Question Answering. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 866-874. +Victor Froese. 1996. Whole-language: Practice and theory. ERIC. +Bilal Ghanem, Goran Glavaš, Anastasia Giachanou, Simone Paolo Ponzetto, Paolo Rosso, and Francisco Rangel. 2019. UPV-UMA at CheckThat! Lab: Verifying Arabic Claims using a Cross Lingual Approach. In CEUR Workshop Proceedings, volume 2380, pages 1-10. +Hila Gonen and Yoav Goldberg. 2019. Lipstick on a Pig: Debiasing Methods Cover up Systematic Gender Biases in Word Embeddings But do not Remove Them. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 609-614. +Jing Gu, Mostafa Mirshekari, Zhou Yu, and Aaron Sisto. 2021. ChainCQG: Flow-Aware Conversational Question Generation. In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume, pages 2061-2070. + +Sonia Gupta and Manveen Kaur Jawanda. 2020. The Impacts of COVID-19 on Children. Acta Paediatr, 109(11):2181-2183. +Michael Alexander Kirkwood Halliday. 1973. Explorations in the Functions of Language. Canadian Journal of Linguistics. +Vrindavan Harrison and Marilyn Walker. 2018. Neural Generation of Diverse Questions using Answer Focus, Contextual and Linguistic Features. In Proceedings of the 11th International Conference on Natural Language Generation, pages 296-306. +Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi. 2019. The Curious Case of Neural Text Degeneration. In International Conference on Learning Representations. +Lifu Huang, Ronan Le Bras, Chandra Bhagavatula, and Yejin Choi. 2019. Cosmos QA: Machine Reading Comprehension with Contextual Commonsense Reasoning. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing, pages 2391-2401. +Xin Jia, Wenjie Zhou, Xu Sun, and Yunfang Wu. 2021. EQG-RACE: Examination-Type Question Generation. In Proceedings of the AAAI Conference on Artificial Intelligence, 14, pages 13143-13151. +Junmo Kang, Haritz Puerto San Roman, and Sung-Hyon Myaeng. 2019. Let Me Know What to Ask: Interrogative-Word-Aware Question Generation. In Proceedings of the 2nd Workshop on Machine Reading for Question Answering, pages 163-171. +Payal Khullar, Konigari Rachna, Mukul Hase, and Manish Shrivastava. 2018. Automatic Question Generation using Relative Pronouns and Adverbs. In Proceedings of ACL 2018, Student Research Workshop, pages 153-158. +Jingjing Li, Yifan Gao, Lidong Bing, Irwin King, and Michael R Lyu. 2019. Improving Question Generation With to the Point Context. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing, pages 3216-3226. +Paul Pu Liang, Chiyu Wu, Louis-Philippe Morency, and Ruslan Salakhutdinov. 2021. Towards Understanding and Mitigating Social Biases in Language Models. In International Conference on Machine Learning, pages 6565–6576. PMLR. +Chin-Yew Lin. 2004. Rouge: A Package for Automatic Evaluation of Summaries. In Text summarization branches out, pages 74-81. +Bang Liu, Haojie Wei, Di Niu, Haolan Chen, and Yancheng He. 2020. Asking Questions the Human Way: Scalable Question-Answer Generation from Text Corpus. In Proceedings of The Web Conference 2020, pages 2032-2043. + +Bang Liu, Mingjun Zhao, Di Niu, Kunfeng Lai, Yancheng He, Haojie Wei, and Yu Xu. 2019a. Learning to Generate Questions by Learning What not to Generate. In The World Wide Web Conference, pages 1106-1118. +Leo Z Liu, Yizhong Wang, Jungo Kasai, Hannaneh Hajishirzi, and Noah A Smith. 2021a. Probing Across Time: What Does RoBERTa Know and When? arXiv preprint arXiv:2104.07885. +Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019b. RoBERTa: A Robustly Optimized BERT Pretraining Approach. CoRR, abs/1907.11692. +Zhongkun Liu, Pengjie Ren, Zhumin Chen, Zhaochun Ren, Maarten de Rijke, and Ming Zhou. 2021b. Learning to Ask Conversational Questions by Optimizing Levenshtein Distance. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 5638-5650. +Vijini Liyanage and Surangika Ranathunga. 2019. A Multi-Language Platform for Generating Algebraic Mathematical Word Problems. In 2019 14th Conference on Industrial and Information Systems (ICIIS), pages 332-337. IEEE. +Xiyao Ma, Qile Zhu, Yanlin Zhou, and Xiaolin Li. 2020. Improving Question Generation with Sentence-Level Semantic Matching and Answer Position Inferring. In Proceedings of the AAAI Conference on Artificial Intelligence, 05, pages 8464-8471. +Jana M Mason. 2017. Reading Stories to Preliterate Children: A Proposed Connection to Reading. Routledge. +Louisa Moats. 2019. Structured Literacy: Effective instruction for students with dyslexia and related reading difficulties. Perspectives on Language and Literacy, 45(2):9-11. +Nasrin Mostafazadeh, Ishan Misra, Jacob Devlin, Margaret Mitchell, Xiaodong He, and Lucy Vanderwende. 2016. Generating Natural Questions About an Image. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1802-1813. +Lidiya Murakhovs' ka, Chien-Sheng Wu, Tong Niu, Wenhao Liu, and Caiming Xiong. 2021. MixQG: Neural Question Generation with Mixed Answer Types. arXiv preprint arXiv:2110.08175. +Shashi Narayan, Goncalo Simoes, Ji Ma, Hannah Craighead, and Ryan Mcdonald. 2020. QURIOUS: Question Generation Pretraining for Text Generation. arXiv preprint arXiv:2004.11026. + +Jekaterina Novikova, Ondrej Dusek, Amanda Cercas Curry, and Verena Rieser. 2017. Why We Need New Evaluation Metrics for NLG. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 2241-2252. +Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. 2002. BLEU: a Method for Automatic Evaluation of Machine Translation. In Proceedings of the 40th annual meeting of the Association for Computational Linguistics, pages 311-318. +German I Parisi, Ronald Kemker, Jose L Part, Christopher Kanan, and Stefan Wermter. 2019. Continual Lifelong Learning with Neural Networks: A Review. Neural Networks, 113:54-71. +Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. 2019. Language Models are Unsupervised Multitask Learners. OpenAI blog, 1(8):9. +Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. 2020. Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer. Journal of Machine Learning Research, 21:1-67. +Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. 2016. SQuAD: 100,000+ Questions for Machine Comprehension of Text. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 2383-2392. +Raj Reddy. 1977. Speech Understanding Systems: Summary of Results of the Five-Year Research Effort at Carnegie Mellon University. +Melissa Roemmele, Deep Sidhpura, Steve DeNeefe, and Ling Tsou. 2021. AnswerQuest: A System for Generating Question-Answer Items from Multi-Paragraph Documents. In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: System Demonstrations, pages 40-52. +Anna Rogers, Olga Kovaleva, Matthew Downey, and Anna Rumshisky. 2020. Getting Closer to AI Complete Question Answering: A Set of Prerequisite Real Tasks. In Proceedings of the AAAI conference on artificial intelligence, 05, pages 8722-8731. +Thomas Scialom, Benjamin Piwowarski, and Jacopo Staiano. 2019. Self-Attention Architectures for Answer-Agnostic Neural Question Generation. In Proceedings of the 57th annual meeting of the Association for Computational Linguistics, pages 6027-6032. +Thomas Scialom and Jacopo Staiano. 2020. Ask to Learn: A Study on Curiosity-driven Question Generation. In Proceedings of the 28th International Conference on Computational Linguistics, pages 2224-2235. + +Thomas Scialom, Serra Sinem Tekiroğlu, Jacopo Stiiano, and Marco Guerini. 2020. Toward Stance-based Personas for Opinionated Dialogues. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: Findings, pages 2625-2635. +Thibault Sellam, Dipanjan Das, and Ankur Parikh. 2020. BLEURT: Learning Robust Metrics for Text Generation. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 7881-7892. +Sally Shaywitz. 2005. Overcoming Dyslexia: A New and Complete Science-Based Program for Reading Problems at Any Level. Education Review. +Lei Shen, Fandong Meng, Jinchao Zhang, Yang Feng, and Jie Zhou. 2021. GTM: A Generative Triplewise Model for Conversational Question Generation. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 3495-3506, Online. Association for Computational Linguistics. +Andrew Shin, Yoshitaka Ushiku, and Tatsuya Harada. 2018. Customized Image Narrative Generation via Interactive Visual Question Generation and Answering. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 8925-8933. +Pushkar Shukla, Carlos Elmadjian, Richika Sharan, Vivek Kulkarni, Matthew Turk, and William Yang Wang. 2019. What Should I Ask? Using Conversat- tionally Informative Rewards for Goal-oriented Visual Dialog. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 6442-6451. +Lukas Stappen, Fabian Brunn, and Björn Schuller. 2020. Cross-Lingual Zero-and Few-Shot Hate Speech Detection Utilising Frozen Transformer Language Models and AXEL. arXiv preprint arXiv:2004.13850. +Xingwu Sun, Jing Liu, Yajuan Lyu, Wei He, Yanjun Ma, and Shi Wang. 2018. Answer-Focused and Position-Aware Neural Question Generation. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 3930-3939. +Ilya Sutskever, Oriol Vinyals, and Quoc V Le. 2014. Sequence to Sequence Learning with Neural Networks. In Advances in neural information processing systems, pages 3104-3112. +Alon Talmor and Jonathan Berant. 2019. MultiQA: An empirical investigation of generalization and transfer in reading comprehension. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 4911-4921, Florence, Italy. Association for Computational Linguistics. + +Stalin Varanasi, Saadullah Amin, and Günter Neumann. 2020. CopyBERT: A Unified Approach to Question Generation with Self-Attention. In Proceedings of the 2nd Workshop on Natural Language Processing for Conversational AI, pages 25-31. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc. +Liuyin Wang, Zihan Xu, Zibo Lin, Haitao Zheng, and Ying Shen. 2020. Answer-driven Deep Question Generation based on Reinforcement Learning. In Proceedings of the 28th International Conference on Computational Linguistics, pages 5159-5170. +Wei Yang, Yuqing Xie, Aileen Lin, Xingyu Li, Luchen Tan, Kun Xiong, Ming Li, and Jimmy Lin. 2019. End-to-End Open-Domain Question Answering with BERTserini. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics (Demonstrations), pages 72-77, Minneapolis, Minnesota. Association for Computational Linguistics. +Xingdi Yuan, Tong Wang, Caglar Gulcehre, Alessandro Sordoni, Philip Bachman, Saizheng Zhang, Sandeep Subramanian, and Adam Trischler. 2017. Machine Comprehension by Text-to-Text Neural Question Generation. In Proceedings of the 2nd Workshop on Representation Learning for NLP, pages 15-25. +Xiang Yue, Xinliang Frederick Zhang, Ziyu Yao, Simon Lin, and Huan Sun. 2020. CminiQG4QA: Generating Diverse Questions for Domain Adaptation of Clinical Question Answering. arXiv preprint arXiv:2010.16021. +Yao Zhao, Xiaochuan Ni, Yuanyuan Ding, and Qifa Ke. 2018. Paragraph-Level Neural Question Generation with Maxout Pointer and Gated Self-Attention Networks. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 3901-3910. +Qingyu Zhou, Nan Yang, Furu Wei, Chuanqi Tan, Hangbo Bao, and Ming Zhou. 2017. Neural Question Generation from Text: A Preliminary Study. In National CCF Conference on Natural Language Processing and Chinese Computing, pages 662-671. Springer. +Wenjie Zhou, Minghua Zhang, and Yunfang Wu. 2019. Question-Type Driven Question Generation. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing, pages 6032-6037. + +# A Appendix + +# A.1 Further Details on Skills + +In the following, we elaborate more on the reading comprehension skills: + +1. Basic Story Elements (BSE): Determining what are the main story elements is one of the comprehension skills to assess the reader understanding. Using this skill, we can understand whether the reader is able to identify the main characters and environment settings of the stories. +2. Character Traits (CT): Identifying permanent traits that can be assigned to characters or describe character development. For instance, knowing what most likely $X$ character felt during the story, recognizing facts about $X$ , identifying main adjectives that $X$ has, etc. +3. Close Reading (CR): Identifying the place in a story where the author best describes or explains a key point. Also, it includes questions to identify the purpose of a quote or a sentence. This skill requires advanced reading comprehension ability from the reader since its answers cannot be extracted directly from the story text, where inferential skills are needed. +4. Figurative Language (FL): Figurative language is common in stories as it makes ideas and concepts easier to visualize by the reader. Also, it is an effective way of conveying an idea that is not easily understood. With this skill, we examine the reader ability of recognizing the implicated meaning of a sentence or a type of figurative language. +5. Inferring (I): Writers sometimes jump into the action or skip forward in their stories. Good readers must infer what happened in between scenes if the time in-between is not explicitly detailed. In addition, readers must infer their characters' emotions if their characters do not share those aloud. +6. Predicting (P): Predicting involves guessing what will happen next. It is different from inferring; inferring is guessing what is happening now or what happened before. Good readers do not let books passively happen to them, they work to "solve" the story before it reaches its end by finding clues and using them to guess what will happen next or to guess how the conflict will be resolved. +7. Summarizing (S): Consolidating a text into a precise synopsis of only the most key information. Summarizing skill contains the main + +literary elements of the characters, the problem, and the solutions. Key events from the beginning, middle, and end are included in a summary. + +8. Visualizing (V): This skill requires readers to visualize scenes in their heads to fully comprehend the story. It can assess readers ability of imagining specific events or elements in the stories. +9. Vocabulary (VO): Identifying the meaning of unfamiliar words in the text is a key skill for readers to fully comprehend the story. In this skill, the reader should identify the right meaning of a word within a context when the word has multiple possible definitions. Additionally, the reader should be able to identify vocabulary based questions related to identifying synonyms, antonyms, homophones, compound words, and word types (e.g. noun, verb, etc.). + +# A.2 The Theory Behind Skills Taxonomy + +There are three major approaches within literacy education to which teachers or schools subscribe: the whole-language approach (Froese, 1996) (which is the idea that if teachers simply give kids books, kids will learn how to read), the structural literacy approach (Moats, 2019) (which is the theory that letters sounds, words parts, and grammar rules must all be explicitly taught in order for students to be able to read successfully), and the balanced literacy approach (Asselin, 1999) (which basically blends the aforementioned two theories together, in the sense that students read authentic literature while also receiving targeted instruction in skills or strategies). In this work, we chose to use the balanced literacy approach as it benefits from both approaches and as it is the newest approach. + +At the beginning, we reviewed some of the most commonly used balanced literacy curricula that were released by publishing houses and universities. In particular, we devoted a lot of focus to the Readers and Writers Workshop Model which is developed at Columbia University Teachers College, and to the documentations about reading levels that developed by Scholastic publishing house. The Readers and Writers Workshop curricula were highly instrumental to us in breaking + +reading comprehension into sub-skills. Also, it is one of the most commonly used and referenced curricula among teachers. We reviewed the workshop materials to create a list of all of the skills that the workshop program highlighted. Then, we matched those against what was offered by Scholastic. This helped us create our primary list of skills. In this study, we are experimenting with nine skills out of around twenty skills. In this phase of the study, we are focusing on the most comprehensive and common skills. In the future, we will expand our work to include the rest of the skills. + +# A.3 Additional Data + +In addition to the collected dataset, we use two well-known datasets, SQuAD and CosmosQA. We choose these two datasets because of their large size, and their focus on literal or inferential questions. + +SQuAD A reading comprehension dataset, consists of questions created by crowdworkers on a set of Wikipedia articles that cover a large set of topics (from musical celebrities to abstract concepts), where the answer to every question is a span from the corresponding reading passage (Rajpurkar et al., 2016). This dataset can be considered as an extractive QA dataset. It is one of the largest QA datasets in the literature. In this work, we use SQuAD 2.0 version with discarding the questions that have no answers. The size of the dataset is 100K paragraph/question/answer triplets. + +CosmosQA It is another reading comprehension dataset consisting of 35.6K paragraph/question pairs that require commonsense-based reading comprehension. It is a collection of people's everyday narratives, and it asks questions about the likely causes of events that require reasoning (Huang et al., 2019). We discard questions that have no answers in this dataset, resulting in 28K paragraph/question/answer triplets. + +# A.4 Ablation Test and Error Analysis + +Ablation Test. The results of our experiments confirmed the importance of both the skill name token and the two-steps training method. To quantify the impact of including the skill name token, we run T5-WTA without including the skill name token (T5-WTA-unskilled). We compare the T5-WTA-unskilled to the One-Step model; the only difference between these models is that One-Step model includes SQuAD and CosmosQA datasets in the training data. The ablation test results in Table 5 + +shows that the skill name token and the additional training data both increase model performance. T5-WTA-unskilled BLEURT performance is lower than the BLEURT scores of the other two models. + +Error Analysis. Here we are interested in further understanding the HTA-WTA model's performance. We manually examined several generated questions to understand the sources of its errors. Given the unbalanced status of the dataset, we found that the model does not always generate an appropriate question for a given skill name, especially when that skill is underrepresented in the data (e.g. Visualizing, Figurative Language, etc.). In some cases, the model learned the style of the skill's questions, but in the given context, the generated question could not be answered. As an example, the following generated figurative language question quoted a sentence from a story about the space. The sentence is an event in the story and not a figurative language: + +Which figurative language technique is being used in the phrase "The first safe trip into space"? + +This happens even for very common skill categories, again due to the difficulty (or even impossibility) of generating questions for some skill and story pairs. The other kind of error is the subjectivity in selecting the "correct" words from the story. For instance, giving the following Vocabulary question from the dataset: + +What is the correct definition of the word "decoy" as it is used in the story? + +For this kind of question, annotators chose words that can have multiple meanings, some of which may be unfamiliar to school children. The process of choosing those words is subjective. Although both annotators agreed on the word in the previous example, the model chose to select another word from the story ("panting"). In other cases, the question asks about the definition of a word within a sentence from the story (e.g. What is the meaning of "word" as it is used in this sentence: "quoted sentence"). We noted that when the model generated the question, it selects the correct word but sometimes used a randomly quoted sentence from the story that didn't contain the word. + +
ModelBLEU-1BLEU-2BLEU-3BLEU-4BLEURT
One-Step15.198.054.762.9429.45
T5-WTA18.539.986.063.9232.96
T5-WTA-unskilled14.658.314.372.3929.02
+ +Table 5: The ablation test results (percentages). + +# A.5 Manual Evaluation Results of Questions' Skills + +In Table 6, we show the fined-grained results per skill name after the manual labeling experiment for the generated questions from both One-Step and HTA-WTA models. + +# A.6 Few-Shot Question Generation Results + +In Table 7, we show the few-shot experiment's results considering both scoring metrics (BLEU, and BLUERT). We do not experiment with One-Step model as we need to sample SQuAD and CosmosQA datasets when we sample the collected data; it is hard to set up a fair comparison here as, for instance, sampling $10\%$ of SQuAD dataset is larger than the whole collected dataset. + +# A.7 Samples of the Generated Questions + +In this section, we list some random examples from HTA-WTA model for inferential questions: + +- Story: "The Line 1 Toronto train was a subway like many others you've seen. He rocketed down Yonge Street, around the Union loop, and rattled off towards Vaughn. At Vaughn he'd let out a loud, hissing sigh and a clanking sort of grunt, then reverse and do the whole thing backwards all over again. He liked his transit union job well enough, but he couldn't help thinking about the lights at the end of his tunnels. No matter how long he'd been running, or how much he wished for anything else, that little hopeful point of light always turned out to be just one more dirty subway platform." + +Generated Figurative Language question: "Reread this sentence: "He rocketed down Yonge Street, around the Union loop, and rattled off towards Vaughn." Which figurative language technique is being used here?" + +Generated answer: "Alliteration". + +- Story: "'The map says left", said Bri. "But my heart says right!" cried Rob. "Is your heart full of hidden treasure?" asked Bri. "Yes." + +Rob replied. "At least, that's what my mom says." + +Generated Inferring question: "Why do you think Bri's heart says "But my heart says right!"?" + +Generated answer: "Because she thinks she has found something". + +- Story: "Mary looked at it, not really knowing why the hole was there, and as she looked she saw something almost buried in the newly-turned soil. It was something like a ring of rusty iron or brass and when the robin flew up into a tree nearby she put out her hand and picked the ring up. It was more than a ring, however; it was an old key which looked as if it had been buried a long time. Mistress Mary stood up and looked at it with an almost frightened face as it hung from her finger. "Perhaps it has been buried for ten years," she said in a whisper. "Perhaps it is the key to the garden!" + +Generated Vocabulary question: "Reread this sentence: "Perhaps it has been buried for ten years" What is the correct definition of the word "frightened" as it is used here?" + +Generated answer: "Scared". + +
BSECTCRFLIPSVVO
#instances128237146141016
One-Step0.130.000.310.000.190.000.070.000.18
HTA-WTA0.880.930.681.000.691.000.810.181.00
+ +Table 6: F1 score results per skill name. + +
Instances RatioModelBLEU-1BLEU-2BLEU-3BLEU-4BLEURT
1T5-WTA8.613.381.711.0424.47
1HTA-WTA10.24.742.851.9627.22
0.1T5-WTA14.86.683.632.2229.09
0.1HTA-WTA16.559.546.284.3733.21
0.3T5-WTA16.028.35.073.4529.69
0.3HTA-WTA16.149.76.644.8232.81
0.5T5-WTA16.328.254.773.0031.20
0.5HTA-WTA15.489.256.344.6132.86
0.75T5-WTA18.910.126.244.1932.65
0.75HTA-WTA18.6911.537.975.7432.84
AllT5-WTA18.539.996.073.9332.96
AllHTA-WTA22.1514.310.27.6734.82
+ +Table 7: Few-shot performance (percentages) of the HTA-WTA and T5-WTA models over a percentage of added few-shot samples. 1 means single instance per skill (9 instances). \ No newline at end of file diff --git a/questiongenerationforreadingcomprehensionassessmentbymodelinghowandwhattoask/images.zip b/questiongenerationforreadingcomprehensionassessmentbymodelinghowandwhattoask/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..a30d9126bc3047d9ef12fa4167402920986a322e --- /dev/null +++ b/questiongenerationforreadingcomprehensionassessmentbymodelinghowandwhattoask/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ecd8c50a3fc49d0f48ed681217aa0900ef1022071ad5c62f59d1e163dc4f1de7 +size 299853 diff --git a/questiongenerationforreadingcomprehensionassessmentbymodelinghowandwhattoask/layout.json b/questiongenerationforreadingcomprehensionassessmentbymodelinghowandwhattoask/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..6c5ca04076c6cbd4d82d4034bbbc70448408a449 --- /dev/null +++ b/questiongenerationforreadingcomprehensionassessmentbymodelinghowandwhattoask/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75d2a5a96d5f18e1403ed5d0b4ceef35effe6c79d70de8f28500d7b57eaec7ec +size 451861 diff --git a/rankingconstrainedlearningwithrationalesfortextclassification/490aae9e-1d9c-439f-9bde-aba654e649aa_content_list.json b/rankingconstrainedlearningwithrationalesfortextclassification/490aae9e-1d9c-439f-9bde-aba654e649aa_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..ce1c77a2f3a823ee391a2759d746c8d99ccce0a2 --- /dev/null +++ b/rankingconstrainedlearningwithrationalesfortextclassification/490aae9e-1d9c-439f-9bde-aba654e649aa_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8455c6d792d61b843ac8b3684b02c0518a82a3da428514c63b9daaffaa9c0285 +size 96282 diff --git a/rankingconstrainedlearningwithrationalesfortextclassification/490aae9e-1d9c-439f-9bde-aba654e649aa_model.json b/rankingconstrainedlearningwithrationalesfortextclassification/490aae9e-1d9c-439f-9bde-aba654e649aa_model.json new file mode 100644 index 0000000000000000000000000000000000000000..3757bc8f048cdcfebf770e9bddb2fa9f771d750c --- /dev/null +++ b/rankingconstrainedlearningwithrationalesfortextclassification/490aae9e-1d9c-439f-9bde-aba654e649aa_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9894c6d5a35884575cd6ed59a0989580f1221edb53c1a182e5d7129d6bb11b0e +size 112778 diff --git a/rankingconstrainedlearningwithrationalesfortextclassification/490aae9e-1d9c-439f-9bde-aba654e649aa_origin.pdf b/rankingconstrainedlearningwithrationalesfortextclassification/490aae9e-1d9c-439f-9bde-aba654e649aa_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..32882d5d375134e99c667a4df6f9bfc2d2b5e3f2 --- /dev/null +++ b/rankingconstrainedlearningwithrationalesfortextclassification/490aae9e-1d9c-439f-9bde-aba654e649aa_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a508be97ae9a0d52c8264a58226dfda182a01a6ed47a3a9d2c00dc249d5291cb +size 907155 diff --git a/rankingconstrainedlearningwithrationalesfortextclassification/full.md b/rankingconstrainedlearningwithrationalesfortextclassification/full.md new file mode 100644 index 0000000000000000000000000000000000000000..071882d7ff1f22c8e646f6608a5ae1f944cfdfde --- /dev/null +++ b/rankingconstrainedlearningwithrationalesfortextclassification/full.md @@ -0,0 +1,389 @@ +# Ranking-Constrained Learning with Rationales for Text Classification + +Juanyan Wang + +Illinois Institute of Technology + +Chicago, IL USA + +jwang245@hawk.iit.edu + +Manali Sharma + +Samsung Semiconductor, Inc + +San Jose, CA USA + +manali.s@samsung.com + +Mustafa Bilgic + +Illinois Institute of Technology + +Chicago, IL USA + +mbilgic@iit.edu + +# Abstract + +We propose a novel approach that jointly utilizes the labels and elicited rationales for text classification to speed up the training of deep learning models with limited training data. We define and optimize a ranking-constrained loss function that combines cross-entropy loss with ranking losses as rationale constraints. We evaluate our proposed rationale-augmented learning approach on three human-annotated datasets, and show that our approach provides significant improvements over classification approaches that do not utilize rationales as well as other state-of-the-art rationale-augmented baselines. + +# 1 Introduction + +Text classification has been used for numerous applications including sentiment analysis (Hemmatian and Sohrabi, 2019), information retrieval (Aggarwal and Zhai, 2012), and language identification (Jauhiainen et al., 2019). When presented with a large number of labeled documents, common text classification models demonstrate impressive results. In practical settings, however, labeled data is often scarce. Labeling documents is a tedious task that requires time and effort, thus curating a large labeled corpus can be expensive and even unrealistic. + +There is a wide range of use cases for businesses and industry that require curating a labeled dataset for the current task before the need to move on to the next task arises. For example, consider legal case document classification where documents need to be labeled as relevant/not-relevant to the current case at hand. The next legal case requires labeling the documents as relevant/not-relevant for that particular case, and so on. Similarly, several fast-response tasks such as immediate analysis of news and social media posts for a breaking news, for a recently released product, for a policy announcement, etc., require fast curation of a small + +and yet informative labeled dataset. + +# Label: negative + +I do not find this show at all funny. I actually think it is much worse than any of the other terrible Disney channel sit-coms right now. + +# Label: positive + +I love this movie and have seen it quite a few times over the years. It does get better with every viewing. I agree with all of the positive reviews here. + +Figure 1: Rationales annotated on a negative movie review and a positive movie review. + +An effective approach to make the best use of the human's time and maximize classifier performance with a small labeled dataset is to elicit rich feedback, in the form of rationales for classification, during the labeling process (Zaidan et al., 2007, 2008; Donahue and Grauman, 2011; Sharma and Bilgic, 2018). For sentiment classification, for example, the annotators might highlight certain segments of the text that convinced them to label the review as positive or negative (Figure 1). Unlike humans, a classifier will not know which segments of the document are responsible for its label during training, until it has been presented with many training samples. Since the human annotators read the document to decide its label in the first place, they have already spent the time to find the justifications for their labeling decision; hence, previous studies have shown that the extra time needed to highlight a piece of the text as a rationale for its label is not high and is often worth more (for improving the classifier) than spending that time to label an additional document. Zaidan et al. (2007) showed that rationale annotation has low overhead, roughly twice the time required for annotating only the labels. Sharma and Bilgic (2018) showed that annotating a single document with rationales can be worth as many as 20 documents that are simply annotated with labels. + +Prior work on learning with rationales focused on one-hot encoding of the text in combination with logistic regression and support vector machines + +(Zaidan et al., 2007; Sharma and Bilgic, 2018), deep learning with multi-task learning (Melamud et al., 2019), and rationale-augmented attention-based models (Bahdanau et al., 2014), which still required a large set of labeled documents. We propose a general approach that is applicable to both one-hot encoding as well as deep learning embedding representations and that is highly effective under limited labeling settings. + +The rationale supervision can be understood as an expectation that a document should have a higher probability of belonging to its class than the same document from which the rationale(s) are removed. Motivated by this intuition, we formulate a hybrid loss function to combine classification loss with ranking constraints for rationale supervision, which serves as an effective way of directing the model's focus to rationales during training. Our contributions in this paper include: + +- We formulate a general and effective learning-with-rationales method for text classification. +- We study its empirical effectiveness on three human-annotated text classification datasets (sentiment analysis, aviation safety, and scientific articles). +- We compare our method to several baselines, and empirical findings show that it achieves the state-of-the-art results. For example, our proposed method is able to achieve $80\%$ accuracy on the IMDb movie review dataset (Zaidan et al., 2007) with as few as 23 documents, whereas a finetuned BERT model that does not use rationales required 73 documents, and the most competitive rationale-augmented baseline required 63 documents to achieve the same level of accuracy. +- We annotate a new text classification dataset with rationales and make it publicly available. + +The rest of the paper is organized as follows. We first discuss related work and how our work differs from previous work in Section 2. We formalize our learning with rationales approach in Section 3 and detail the experimental methodology in Section 4, followed by a discussion of the results in Section 5. We discuss the limitations and future work in Section 6 and then conclude. + +# 2 Related Work + +Zaidan et al. (2007) presented one of the first approaches to learning with rationales for text classification. They proposed to utilize human-provided rationales by converting the rationales + +into constraints for training support vector machines. They later extended the framework to a rationale-constrained probabilistic model (Zaidan and Eisner, 2008). Sharma and Bilgic (2018) proposed a general method to incorporate rationales into the training of any classifier by weighting the rationale features higher than the non-rationale features. However, their method relied on using a bag-of-words representation of the documents. + +As deep learning achieved the state-of-the-art performance on text classification (e.g., (Sun et al., 2019; Devlin et al., 2019; Zhang et al., 2015; Yang et al., 2016)), recent work proposed methods specifically for training deep learning models using rationale supervision. Some methods utilized the rationales to generate rationale-augmented representations of the text while others utilized the rationales for richer supervision of the model. For instance, Zhang et al. (2016) proposed a Rationale-Augmented CNN (RA-CNN) that jointly learns from the labels of the documents as well as the labels at the sentence level, by using a two-step approach. However, their approach still requires sufficient amounts of data for training a model at the sentence level to learn a valid rationale-augmented representation of a document. Errica et al. (2021) proposed a representation learning approach to leverage rationales by learning to focus on relevant input tokens in the embedding space. Bao et al. (2018) proposed a framework to derive machine attentions from human-provided rationales. Sastry and Milios (2020) defined a new attribution score for words by computing the partial derivative of the output with respect to the input in the word embedding space, and used misattribution error as an additional supervision in the loss function. Our method has two major differences from these work: i) our approach can use but does not require an attention mechanism to focus on the rationales and ii) our approach does not require learning a separate representation for the rationales. + +The work most closely related to ours is the model proposed by Melamud et al. (2019), which jointly learns to predict the labels for text as well as the labels for each token of every input sentence by determining whether the token is part of the rationales or not. Our approach differs from theirs as our ranking loss is calculated by using only the model's predictions, rather than introducing auxiliary learning tasks. Moreover, the approach we propose is more general: it can be used for any + +model that can utilize a logistic loss, ranging from a logistic regression model coupled with a one-hot encoding of words to a Long Short-Term Memory (LSTM) model coupled with word embeddings. In their same paper, Melamud et al. (2019) proposed another method that utilizes rationales by constructing rationale prototypes and rationale-biased text vectors. However, these vectors are computed using a rationale-bias function to directly estimate the similarity between words and annotated rationales without incorporating any learning, and thus this method works well only for few-shot learning. + +# 3 Learning with Rationales + +Let $\mathcal{D} = \{x_1, x_2, \dots, x_n\}$ be a set of documents. A small subset of the documents, $\mathcal{L} \subset \mathcal{D}$ , are annotated with labels, $\langle x_i, y_i \rangle$ where the value of $y_i$ belongs to a label space, $\mathcal{C} = \{c_1, c_2, \dots, c_k\}$ . $y_i$ is unknown for a much larger set of unlabeled documents, $\mathcal{U} = \mathcal{D} \setminus \mathcal{L}$ , represented as $\langle x_i, ? \rangle$ . Each document, $x_i$ , contains a number of sentences, $\{s_{i1}, s_{i2}, \ldots, s_{im}\}$ , each of which is represented as a sequence of words: $s_{ij} = \{q_{ij}^1, q_{ij}^2, \dots, q_{ij}^l\}$ . + +In the learning with rationales framework, a subset of the words is marked by the human annotator as rationales (i.e., justifications for the document's assigned label). Let $r_i = \bigcup q_{ij}^l$ be the set of all words that are marked as rationales within a document, $x_i$ . It is possible that none of the words are marked as rationales, and hence, $r_i = \emptyset$ for such documents. In the learning-with-rationales setting, $\mathcal{L}$ is modified to contain $\langle x_i, r_i, y_i \rangle$ and $\mathcal{U}$ represents $\langle x_i, \emptyset, ? \rangle$ . The objective is to train a model, $f$ , that utilizes the documents $x_i$ , their labels $y_i$ , and their rationales $r_i$ during training, and uses only the documents $x_i$ at prediction time, as rationales are naturally not available for the test documents. + +# 3.1 Our Approach - LwR-RC + +We first describe our proposed approach, Learning with Rationales - Ranking-Constrained (LwR-RC), and then illustrate how it can be specialized for training deep learning models. To illustrate the motivation behind our approach, consider an example document, $D$ , that contains three sentences: "s1: The movie came out last year. s2: The plot was decent. s3: Acting was superb.", which is labeled as 'positive' by the annotator. Assume for the sake of example, the annotator highlights only s3 as the rationale. Let $M$ be a masked document that is same as the original document $D$ , but from which + +the sentences containing the rationale phrases are removed. In this case, $M$ would be missing $s3$ . We postulate that the model should be more sure about the positive label of document $D$ than the label of document $M$ , since $D$ contains the essential evidence, 'Acting was superb', for the 'positive' label, whereas $M$ lacks that evidence. Similarly, let $R$ be the document that contains only the rationale sentence $s3$ . We postulate that the model should be more sure about the label 'positive' of $R$ than the label of $M$ , since $R$ provides strong evidence for the label, whereas $M$ lacks that evidence.1 + +Traditional learning without rationales approaches optimize a loss function to compute the model's error on its predictions, e.g., a binary cross-entropy classification loss, $L_{clf}$ , is defined as: + +$$ +\begin{array}{l} L _ {c l f} = - \frac {1}{| \mathcal {L} |} \sum_ {i} \left(y _ {i} \cdot \log \left(p \left(y _ {i} \mid x _ {i}\right)\right) \right. \tag {1} \\ + (1 - y _ {i}) \cdot \log (1 - p \left(y _ {i} \mid x _ {i}\right))) \\ \end{array} +$$ + +In order to leverage the annotated rationales, we formalize our postulations by providing the model with two additional objectives during training. The first objective is to train the model to be more confident about the label of a document $(D)$ than the label of the same document in which the rationales are masked $(M)$ . The second objective is to train the model to be more confident about the label of document that contains only the rationales $(R)$ than the label of the same document in which the rationales are masked $(M)$ . We achieve these objectives by using a ranking-constrained classification approach, as described next. + +Let $\langle x_i, r_i, y_i \rangle \in \mathcal{L}$ be a training document. First, we construct an artificial document $x_i'$ by masking out all the sentences that contain rationales $r_i$ . We construct another artificial document $x_i^r$ consisting of only the sentences that contain rationales $r_i$ . The ranking-constrained classification approach incorporates the rationales into learning by modeling two expectations: (i) the model should be more sure of assigning the correct label $y_i$ to $x_i$ than assigning $y_i$ to $x_i'$ , because $x_i'$ represents a document from which the rationales have been removed, and we refer to this objective as 'Document versus Masked document' (DvM), where $D$ represents $x_i$ and $M$ represents $x_i'$ , and (ii) the model should be more sure of assigning the correct label $y_i$ to $x_i^r$ than assigning $y_i$ to $x_i'$ , and we refer to this objec + +tive as 'Rationale versus Masked document' $(R\nu M)$ where $R$ represents $x_{i}^{r}$ and $M$ represents $x_{i}^{\prime}$ . + +Another possible objective can be 'Rationale versus Document' ( $R\nu D$ ), however, we excluded $R\nu D$ objective from our approach for the following reason. Consider the following cases for a binary (positive/negative) classification task: + +- Case 1: $D = R + M$ is positive; $R$ is positive; $M$ is neutral or it contains a small amount of leftover positive. In this case, $R\nu D$ requires $R > R + M$ , which forces $M$ to be negative, whereas $R\nu M$ requires $R > M$ , which does not necessarily require $M$ to be negative. Thus, $R\nu D$ is guaranteed to be the wrong approach. $R\nu M$ forces $R > M$ , but gives the model the flexibility to decide whether $M$ is a small positive, neutral, or negative. +- Case 2: $D = R + M$ is positive; $R$ is positive; $M$ is negative. In this case, $R\nu D$ requires $R > R + M$ , which forces $M$ to be negative, whereas $R\nu M$ simply requires $R > M$ . In this case, $R\nu D$ is the correct choice, but $R\nu M$ cannot be called the guaranteed wrong choice. +- Remaining cases: The cases where $D$ and $R$ are negative are similar. + +As the cases above show, $R\nu M$ is more flexible: $R\nu M$ simply nudges the model in the correct direction and leaves the judgement about $M$ to the data. $R\nu D$ , on the other hand, is a more forceful approach; it forces the model to always make a judgement about $M$ , which is the incorrect judgement in case 1. Thus, we include only the $R\nu M$ and $D\nu M$ objectives in our proposed approach. + +Formally, let $y_{i} \in \{0,1\}$ : $f(x_{i}) = p(y_{i} = 1 \mid x_{i}) = \text{sigmoid}(W_{z}z_{i})$ for some parameter matrix $W_{z}$ , where $z_{i}$ is the vector representation of $x_{i}$ . For modeling the DvM objective, let $\mu_{i} = W_{z}z_{i}$ and $\mu_{i}' = W_{z}z_{i}'$ where $z_{i}'$ is the vector representation of $x_{i}'$ . If the correct label is $y_{i} = 1$ , we would like $\mu_{i} > 0$ and $\mu_{i} > \mu_{i}'$ . If the correct label is $y_{i} = 0$ , we would like $\mu_{i} < 0$ and $\mu_{i} < \mu_{i}'$ . We convert this constraint into a logistic loss, as follows: + +$$ +L _ {D v M} ^ {i} = \left\{ \begin{array}{l} \log \left(1 + \exp \left(- \left(\mu_ {i} - \mu_ {i} ^ {\prime}\right)\right)\right), y _ {i} = 1 \\ \log \left(1 + \exp \left(- \left(\mu_ {i} ^ {\prime} - \mu_ {i}\right)\right)\right), y _ {i} = 0 \end{array} \right. \tag {2} +$$ + +Summing $L_{DvM}^{i}$ over all the training instances and reorganizing the terms, we get: + +$$ +\begin{array}{l} L _ {D v M} = - \frac {1}{| \mathcal {L} |} \sum_ {i} \left(y _ {i} \cdot \log \left(p \left(y _ {i} \mid x _ {i}, x _ {i} ^ {\prime}\right)\right) \right. \tag {3} \\ + (1 - y _ {i}) \cdot l o g \left(1 - p \left(y _ {i} \mid x _ {i}, x _ {i} ^ {\prime}\right)\right)) \\ \end{array} +$$ + +where, + +$$ +p \left(y _ {i} \mid x _ {i}, x _ {i} ^ {\prime}\right) = \frac {1}{1 + e ^ {- \left(\mu_ {i} - \mu_ {i} ^ {\prime}\right)}} \tag {4} +$$ + +We define the ranking loss similarly for the $RvM$ component, using documents $R$ and $M$ and their respective scores $\mu_i^r = W_z z_i^r$ and $\mu_i' = W_z z_i'$ , where $z_i^r$ is the vector representation of $x_i^r$ . The ranking loss $L_{RvM}$ is then defined as: + +$$ +\begin{array}{l} L _ {R v M} = - \frac {1}{| \mathcal {L} |} \sum_ {i} \left(y _ {i} \cdot \log \left(p \left(y _ {i} \mid x _ {i} ^ {r}, x _ {i} ^ {\prime}\right)\right) \right. \tag {5} \\ + \left(1 - y _ {i}\right) \cdot \log \left(1 - p \left(y _ {i} \mid x _ {i} ^ {r}, x _ {i} ^ {\prime})\right)\right) \\ \end{array} +$$ + +where, + +$$ +p \left(y _ {i} \mid x _ {i} ^ {r}, x _ {i} ^ {\prime}\right) = \frac {1}{1 + e ^ {- \left(\mu_ {i} ^ {r} - \mu_ {i} ^ {\prime}\right)}} \tag {6} +$$ + +We combine the classification loss $L_{clf}$ with the ranking losses, $L_{DvM}$ and $L_{RvM}$ , resulting in the main objective function for our approach: + +$$ +L = \left(1 - \lambda_ {1} - \lambda_ {2}\right) L _ {c l f} + \lambda_ {1} L _ {D v M} + \lambda_ {2} L _ {R v M} \tag {7} +$$ + +where, $0 \leq \lambda_{1} \leq 1$ , $0 \leq \lambda_{2} \leq 1$ , and $\lambda_{1} + \lambda_{2} \leq 1$ . $\lambda_{1}$ and $\lambda_{2}$ are two hyper-parameters that control the importance of the classification loss and the ranking losses relative to one another. We study the effect of these hyper-parameters on the model's performance and provide insights into their relative importance in Section 5.2. We next describe how LwR-RC can be implemented through a neural network architecture, which can be specialized to a logistic regression or to a deep learning model. + +# 3.1.1 LwR-RC with Deep Learning + +Figure 2 shows the deep learning architecture illustrating how the LwR-RC approach can minimize the loss function of Equation (7). For every sentence $\{s_{i1}, s_{i2}, \dots, s_{im}\}$ within a document $x_i$ , we use an embedding model to create sentence embedding vectors $\{t_{i1}, t_{i2}, \dots, t_{im}\}$ , and pass them through an average pooling layer to create a single vector, $z_i$ , representing a document. Similarly, the same sentence embedding vectors are passed through two different pooling layers to create two masked averages, $z_i'$ and $z_i^r$ , representing the document without rationales and the document containing only the rationales, respectively. There are several strategies for aggregating many sentence vectors into a single document vector; we use the average pooling strategy for the experiments. + +The $LwR-RC$ approach can be used to train any model that uses cross-entropy loss functions, including logistic regression and deep neural networks. It can also work with several representations, including one-hot encoding of the words, word2vec (Mikolov et al., 2013), and doc2vec (Le + +![](images/e502039140191f3cabad6db22ba6a5d7c666c5a38f5435bc8732fea629f8f2b8.jpg) +Figure 2: Architecture of the $LwR-RC$ model for deep learning using one input document, $x_{i}$ , as an example. + +and Mikolov, 2014), as well as more recent language models such as BERT (Devlin et al., 2019), RoBERTa (Liu et al., 2019), and XLNet (Yang et al., 2019). For example, if we remove the embedding layer and the hidden layers, and represent the sentences using one-hot encoding of the words, we would get a simple logistic regression classifier. If we use BERT for encoding the sentences in the embedding layer, then we can either use BERT embeddings directly or fine-tune the BERT model on downstream classification tasks by optimizing the ranking-constrained loss function. + +# 4 Experimental Setup + +In this section, we describe the three datasets, several baselines, and the experimental settings. + +# 4.1 Datasets + +We used two publicly available datasets: a sentiment classification dataset and an aviation safety dataset. Both datasets were annotated with labels and rationales. Additionally, we introduce a new scientific article classification dataset that we annotated with labels and rationales. + +IMDb is a movie review dataset annotated by Zaidan et al. (2007). It consists of 1,800 documents. We used 600 reviews as the training set, 600 reviews as the validation set, and 600 reviews as the test set. + +ASRS is an Aviation Safety Reporting System dataset. We used the same balanced binary classi + +fication dataset created by Melamud et al. (2019), consisting of reports labeled with either 'Profi-ciency' or 'Physical Environment.' The original split had 386 documents for training and 392 documents for testing. We split the test set into two and use 196 documents for validation set and 196 documents for test set. + +AIvsCR contains scientific articles that we collected from arXiv and annotated with rationales. This dataset contains 2,394 documents from Artificial Intelligence (cs.AI) and Cryptography and Security (cs.CR) categories. Two annotators independently annotated 394 documents with rationales for the ground truth label, and we computed the inter-annotator agreement for the rationales in the same manner as Zaidan et al. (2007). We used 394 human-annotated documents as the training set, 1,000 documents as the validation set, and 1,000 documents as the test set. Note that the validation and test sets do not need rationales; they only need the documents and their labels for evaluation. We make this dataset publicly available, and provide a complete description of this dataset in the appendix. + +# 4.2 Experimental Settings + +For training $LwR - RC$ , we fine-tuned a pre-trained 'bert-base-uncased' version of the BERT (Devlin et al., 2019) model on downstream classification task using our ranking-constrained loss function. We used a TensorFlow implementation of BERT $^2$ . We input each sentence within a document to BERT and used the '[CLS]' logits from the last hidden layer as the sentence embeddings. To fit the model into GPU (NVIDIA Quadro RTX 5000) memory, we truncated each input sentence to at most 48 tokens (including two special tokens '[CLS'] and '[SEP]'), and each document to at most 64 sentences. We used only one hidden layer with 100 nodes in the hidden layers section of Figure 2, and used tanh as the activation function. The total number of model parameters for $LwR - RC$ is 109,559,241. The running time of training $LwR - RC$ is similar to training a fine-tuned BERT model without using rationales; $LwR - RC$ needs to make two more forward passes to compute $\mu_i'$ and $\mu_i^r$ for $x_i'$ and $x_i^r$ , respectively. + +We present average learning curves over 5 different runs to assess how the models would per + +form under varying labeling regiments, and plot error bars showing the standard error. Each learning curve starts with a bootstrap of 5 randomly selected documents from each label. Each step of the learning curve corresponds to labeling 20 additional documents. For a fair comparison between various learning strategies, all learning strategies (our approach and the baselines) are fed the same sequence of documents. After the bootstrap phase, we run 10 more steps, and hence the budget of learning curves runs up to $10 + 20 \times 10 = 210$ documents. + +Tuning Hyper-parameters. For a fair comparison between our method and the baselines, at each iteration of learning, we performed grid search to optimize the tunable hyper-parameters of each method using the held-out validation set. For $LwR - RC$ , we experimented with different pairs of hyperparameters, $\lambda_{1}$ and $\lambda_{2}$ , whose values were selected from the set $\{0, 0.125, 0.25, 0.5\}$ . We fine-tuned BERT model for $LwR - RC$ for 10 epochs, and selected the best model across different epochs using the held-out validation set. We next discuss the details of the baselines. + +# 4.3 Baselines + +We compare our approach with one Learning without Rationales (Lw/oR) baseline and four Learning with Rationales (LwR) baselines. + +Learning without Rationales. The $Lw/oR-BERT$ baseline fine-tunes the BERT model for downstream classification tasks, and optimizes the model by only minimizing the classification loss function, $L_{clf}$ , without utilizing any ranking constraints, $L_{DvM}$ or $L_{RvM}$ , according to Equation (1). It is worth noting that traditional $Lw/oR$ approaches that fine-tune BERT model on classification tasks have shown impressive performances, and therefore, $Lw/oR-BERT$ is a strong baseline. For example, Sun et al. (2019) achieved the state-of-the-art performances on eight text classification tasks by fine-tuning the BERT model, outperforming both CNN and LSTM based models as well as using just pre-trained BERT embeddings. We observed similar trends in our experiments. + +Learning with Rationales Baselines. We conducted experiments using four learning-with-rationales baselines from the literature. + +1) Rationale-Augmented SVM (RA-SVM): This approach is Zaidan et al. (2007)'s model that translates the importance of rationales into additional + +constraints for training support vector machines. This method requires three hyper-parameters: regularization $C$ for the original samples, regularization $C_{\text{contrast}}$ for the contrast samples, and margin $\mu$ between the original and contrast samples. We optimized these hyper-parameters using grid search, and selected the values of both $C$ and $C_{\text{contrast}}$ from the set $\{0.01, 0.1, 1, 10, 100\}$ and the value of $\mu$ from the set $\{0.01, 0.1, 1, 10\}$ . + +2) Rationale-Augmented LR (RA-LR): This approach is Sharma and Bilgic (2018)'s approach that emphasizes the rationales and de-emphasizes non-rationales in the vectorized feature matrix representation of the documents. It has three hyperparameters, weight $r$ for the rationale terms, weight $o$ for the non-rationale terms, and regularization $C$ . We selected the value of $r$ from the set $\{1, 10, 100\}$ , the value of $o$ from the set $\{0.01, 0.1, 1\}$ , and the value of $C$ from the set $\{0.01, 0.1, 1, 10, 100\}$ to optimize the hyper-parameters using grid search. + +3) RB-BOW-PROTO and 4) RB-WAVG-BERT: These are two models proposed by Melamud et al. (2019) that achieved the state-of-the-art performance in their experiments compared to Rationale-Augmented CNN (Zhang et al., 2016), Rationale-Augmented SVM (Sharma and Bilgic, 2018), and ULMFiT (Howard and Ruder, 2018). RB-BOW-PROTO uses a pre-trained word2vec embedding to construct rationale-biased text vectors for each class as prototypes, and then uses nearest-neighbor classification, instead of training a model to fine-tune the embeddings. This method has one hyperparameter, $\alpha$ , that controls the impact of rationale biases on the rationale-bias function. We selected the value of $\alpha$ from the set $\{1, 3, 6, 12\}$ to optimize it using grid search. The second approach, RB-WAVG-BERT, which is a strong baseline more closely related to our work, fine-tunes BERT model to jointly learn the labels on documents and the labels on tokens. We fine-tuned this model for 10 epochs and selected the best model across different epochs, using the learning rate of 5e-6, as suggested by the paper. Melamud et al. (2019) found that RB-BOW-PROTO performed better under extremely-limited labeling settings, and that RB-WAVG-BERT performed better when the training size was larger; hence, we included both approaches as baselines. + +# 5 Results + +We first present results comparing $LwR - RC$ with the baselines, and then discuss the effects of the + +two ranking-constrained losses on the performance of $L_{W}R - RC$ . + +# 5.1 Comparison with the Baselines + +Figure 3 presents learning curves comparing the average accuracy of the methods over five different runs with up to 210 documents for improved readability. The learning curves with a larger budget of up to 310 documents are included in the appendix. + +BERT vs. LwR without BERT. The Lw/oR-BERT baseline that did not use rationales but fine-tuned BERT outperforms on the IMDb and AIvsCR datasets the two LwR frameworks (RA-SVM and RA-LR) that used rationales but did not use BERT embeddings. Zaidan et al. (2007) and Sharma and Bilgic (2018) showed that RA-SVM and RA-LR outperformed several Lw/oR approaches, and hence these two are strong LwR baselines. Still, a fine-tuned BERT model that does not use rationales is able to outperform these two strong baselines that used rationales but did not utilize the BERT embeddings. This result highlights the added benefit of the "existing knowledge" that pretrained embeddings provide. + +BERT Baselines. RB-WAVG-BERT, the baseline that fine-tuned BERT model and utilized rationales, outperforms Lw/oR-BERT, the baseline that did not use rationales, showing the benefits of utilizing rationales with recent deep learning models. However, the improvements provided by RB-WAVG-BERT become noticeable only after the model has seen enough data (e.g., more than 50 documents), which was also noted by Melamud et al. (2019). + +$LwR-RC$ vs. the Best Baseline. We next turn our attention to a fairer comparison: $LwR-RC$ versus $RB-WAVG-BERT$ ; both used and fine-tuned BERT embeddings and both utilized rationales. $LwR-RC$ provides statistically significant improvements3 over $RB-WAVG-BERT$ , with a $p$ -value of less than 0.05, especially when the annotation budget is small, and it performs comparably at larger budgets. For IMDb, $LwR-RC$ provides up to $22.3\%$ improvements in accuracy over $RB-WAVG-BERT$ ; for ASRS, $LwR-RC$ provides up to $21.7\%$ improvements in accuracy over $RB-WAVG-BERT$ . For AIvsCR dataset, $Lw/oR-BERT$ can quickly reach $90\%$ accuracy even without utilizing rationales, and thus the improvements provided by $LwR-RC$ on this dataset for most training budgets are not as large as the improvements on the other two datasets; + +
DatasetMethodTarget Accuracy (%)
657075808590
IMDbLw/oR-BERT14365273148N/A
RB-WAVG-BERT932436397208
LwR-RC59152336220
ASRSLw/oR-BERT4369N/AN/AN/AN/A
RB-WAVG-BERT365787192N/AN/A
LwR-RC1219274490N/A
AIvsCRLw/oR-BERT578102893
RB-WAVG-BERT468102873
LwR-RC23581329
+ +Table 1: Comparison between the number of annotated documents needed to achieve a target accuracy by the three methods. 'N/A' represents that a target accuracy could not be achieved by a method even with 310 training documents. + +however, LwR-RC can still provide up to $8.67\%$ improvements in accuracy over RB-WAVG-BERT. Regarding RB-BOW-PROTO, as Melamud et al. (2019) also observed, it performs well only under extremely-limited budget settings. + +Corresponding to the learning curves presented in Figure 3, Table 1 shows the number of annotated documents needed for training $LwR-RC$ as well as the two fine-tuned BERT baselines, $Lw/oR-BERT$ and $RB-WAVG-BERT$ , to achieve a target accuracy (ranging from $65\%$ to $90\%$ ). As Table 1 shows, $LwR-RC$ usually needs 2 and sometimes 3 times fewer number of annotated documents compared to $Lw/oR-BERT$ and $RB-WAVG-BERT$ to achieve the same level of accuracy. + +# 5.2 The Effects of the Loss Functions + +We further investigate the effects of the two ranking-constrained losses. Specifically, we want to understand how $LwR - RC$ behaves with the two ranking-constrained losses: $LwR - RC_{DvM}$ that uses only $L_{DvM}$ (setting $\lambda_1$ to 0.25 and $\lambda_2$ to 0 in Equation (7)), and $LwR - RC_{RvM}$ that uses only $L_{RvM}$ (setting $\lambda_1$ to 0 and $\lambda_2$ to 0.25 in Equation (7)). Figure 4 presents the learning curves for these settings. For the IMDb dataset, $LwR - RC_{RvM}$ achieves a slightly higher accuracy than $LwR - RC_{DvM}$ after 100 training documents. For ASRS dataset, $LwR - RC_{DvM}$ performs the best, and for AIvsCR dataset, $LwR - RC_{RvM}$ performs the best. + +To investigate it further, we provide average statistics for the number of sentences, the number of rationale sentences, and the percentage of rationale sentences within the documents for each dataset in Table 2. We observe that $LwR - RC_{RvM}$ performs better when the percentage of rationale sentences in documents is high, e.g., IMDb and + +![](images/69bd5d5f7177fff6620c2d2d39d4bbb9eeb0d63db74e9fa2721f98922f11ada6.jpg) +Figure 3: Comparison between our approach, $LwR - RC$ , and the five baselines using the best hyper-parameter setting for each method. + +![](images/76daa9c857ceaaa8f5743cbc34f44320de4d85a00ece4c2ce993fa6ad3c911f1.jpg) + +![](images/686cd17be95f1256c5faf5c9dedfc2441900b1c027e101b2bf476865be61137e.jpg) + +![](images/17e725dddb3640993c032614ed02d8a3e0c12457d3ec4412e3d5b04143db32b6.jpg) +Figure 4: Comparison between different ranking constrained losses for $LwR-RC$ . $LwR-RC_{DvM}$ represents using the parameter setting ( $\lambda_1 = 0.25$ , $\lambda_2 = 0$ ), and $LwR-RC_{RvM}$ represents using the parameter setting ( $\lambda_1 = 0$ , $\lambda_2 = 0.25$ ) in Equation (7). + +![](images/c3bdb5089aa82b4e14c6fb4e3cd0142dc4fb51e00032818cf3fcc177ae5683e9.jpg) + +![](images/3aff0df4f70517dc83d8213dbda1140279ba0f8a1ca4b6eb4fcd0a9469a1be25.jpg) + +
Average StatisticsIMDbASRSAIvsCR
# Sentences33.715.38.5
# Rationale sentences7.92.42.5
% Rationale sentences25.719.030.5
+ +Table 2: Average statistics per document for the IMDb, ASRS, and AIvsCR datasets. The percentages in the third row are computed by taking an average of the percentages of rationale sentences for all documents within each dataset, instead of dividing the values in the first row by the values in the second row directly. + +AIvsCR datasets, and $LwR - RC_{DvM}$ performs better when the percentage of rationale sentences is low in the documents, e.g., ASRS dataset. + +We hypothesize that different ranking constraints may be affected differently by a number of factors, including the budget for training documents, the diversity of rationales, the number of rationales provided for each document, how thorough the annotator was in providing rationales, and the domain, to name a few. Table 2 provides only a glimpse of such a study. An exhaustive study is needed for making a definitive conclusion about how various document and rationale statistics affect different ranking-constrained losses, which is beyond the + +scope of this study. However, the tuning strategy that picks the best $\lambda$ parameters for $L_{W}R - RC$ at each iteration of learning using a validation set, and hence chooses the appropriate balance between the two loss functions, works well in practice, as was shown in Figure 3. + +# 6 Limitations and Future Work + +We presented experimental results for binary classification tasks in this paper. To the best of our knowledge, prior learning-with-rationales frameworks also focused on binary classification tasks in their experiments. Extending the framework to multi-class settings is a promising future direction. Such an extension would require adapting the loss functions to multi-class settings and creating multi-class classification datasets with rationales. Extending the framework to multi-label settings where a document can be assigned more than one label, however, is more challenging, both for formulating the problem as well as annotating the datasets with rationales, because rationales need to be assigned to their respective labels, which might be more than one in a single document. + +# 7 Conclusions + +We presented a novel approach to incorporate rationales as ranking-constraints into the training of classification models with cross-entropy loss. The proposed approach is general enough that it can be used for simple models, such as logistic regression with one-hot encoding of documents, as well as deep learning models combined with text embeddings. We conducted empirical evaluations comparing the proposed approach to several baselines and observed that the proposed approach outperformed the baselines in most settings, and was comparable to them at the remaining settings. + +# Acknowledgments + +This material is based upon work supported by Samsung Semiconductor Inc. under a grant titled "Interactive Patent and Scientific Article Classification." + +# References + +Charu C Aggarwal and ChengXiang Zhai. 2012. A survey of text classification algorithms. In Mining text data, pages 163-222. Springer. +Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. 2014. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473. +Yujia Bao, Shiyu Chang, Mo Yu, and Regina Barzilay. 2018. Deriving machine attention from human rationales. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 1903-1913, Brussels, Belgium. Association for Computational Linguistics. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171-4186, Minneapolis, Minnesota. Association for Computational Linguistics. +Jeff Donahue and Kristen Grauman. 2011. Annotator rationales for visual recognition. In 2011 International Conference on Computer Vision, pages 1395-1402. IEEE. +Federico Errica, Fabrizio Silvestri, Bora Edizel, Ludovic Denoyer, Fabio Petroni, Vassilis Plachouras, and Sebastian Riedel. 2021. Concept matching for low-resource classification. In 2021 International Joint Conference on Neural Networks (IJCNN), pages 1-8. IEEE. + +Fatemeh Hemmatian and Mohammad Karim Sohrabi. 2019. A survey on classification techniques for opinion mining and sentiment analysis. Artificial Intelligence Review, pages 1-51. +Jeremy Howard and Sebastian Ruder. 2018. Universal language model fine-tuning for text classification. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 328-339, Melbourne, Australia. Association for Computational Linguistics. +Tommi Jauhiainen, Marco Lui, Marcos Zampieri, Timothy Baldwin, and Krister Lindén. 2019. Automatic language identification in texts: A survey. Journal of Artificial Intelligence Research, 65:675-782. +Quoc Le and Tomas Mikolov. 2014. Distributed representations of sentences and documents. In International conference on machine learning, pages 1188-1196. PMLR. +Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692. +Oren Melamud, Mihaela Bornea, and Ken Barker. 2019. Combining unsupervised pre-training and annotator rationales to improve low-shot text classification. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 3884-3893, Hong Kong, China. Association for Computational Linguistics. +Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. 2013. Efficient estimation of word representations in vector space. arXiv preprint arXiv:1301.3781. +Chandramouli Shama Sastry and Evangelos E Milios. 2020. Active neural learners for text with dual supervision. Neural Computing and Applications, pages 1-20. +Manali Sharma and Mustafa Bilgic. 2018. Learning with rationales for document classification. Machine Learning, 107(5):797-824. +Chi Sun, Xipeng Qiu, Yige Xu, and Xuanjing Huang. 2019. How to fine-tune bert for text classification? In Chinese Computational Linguistics, pages 194-206, Cham. Springer International Publishing. +Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Russ R Salakhutdinov, and Quoc V Le. 2019. Xlnet: Generalized autoregressive pretraining for language understanding. In Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc. + +Zichao Yang, Diyi Yang, Chris Dyer, Xiaodong He, Alex Smola, and Eduard Hovy. 2016. Hierarchical attention networks for document classification. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 1480-1489, San Diego, California. Association for Computational Linguistics. +Omar Zaidan and Jason Eisner. 2008. Modeling annotators: A generative approach to learning from annotator rationales. In Proceedings of the 2008 Conference on Empirical Methods in Natural Language Processing, pages 31-40, Honolulu, Hawaii. Association for Computational Linguistics. +Omar Zaidan, Jason Eisner, and Christine Piatko. 2007. Using "annotator rationales" to improve machine learning for text categorization. In Human Language Technologies 2007: The Conference of the North American Chapter of the Association for Computational Linguistics; Proceedings of the Main Conference, pages 260-267, Rochester, New York. Association for Computational Linguistics. +Omar F Zaidan, Jason Eisner, and Christine Piatko. 2008. Machine learning with annotator rationales to reduce annotation cost. In Proceedings of the NIPS* 2008 workshop on cost sensitive learning, pages 260-267. +Xiang Zhang, Junbo Zhao, and Yann LeCun. 2015. Character-level convolutional networks for text classification. In Advances in neural information processing systems, pages 649-657. +Ye Zhang, Iain Marshall, and Byron C. Wallace. 2016. Rationale-augmented convolutional neural networks for text classification. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 795-804, Austin, Texas. Association for Computational Linguistics. + +# A Appendix + +In this section, we supplement the results presented in the paper with the following: + +- In the paper, we focused on experimental results with a budget of up to 210 training documents. Here, we supplement the main results in the paper with a larger budget of up to 310 documents. +- We present the improvements in accuracy provided by $LwR - RC$ over the two fine-tuned BERT baselines, $Lw/oR-BERT$ and $RB-WAVG-BERT$ , for all three datasets at varying budgets. +- We provide the results of paired t-tests comparing LwR-RC to Lw/oR-BERT and RB-WAVG-BERT. +- In the paper, we provided the formulation of $LwR - RC$ for binary classification for the ease of exposition. Here, we extend the formulation of $LwR - RC$ to multi-class classification. +- We provide a complete description of the AIvsCR dataset that we collected and annotated with rationales for the ground truth labels. +- Additionally, we provide the AIvsCR dataset and the other two datasets (IMDb and ASRS), as well as the source code for all the experiments in our paper with this submission as separate .zip files. + +# B Results with Larger Budgets + +In the paper, we focused on experimental results with a budget of up to 210 training documents (Figure 3). We supplement the results in Figure 3 with a larger budget of up to 310 training documents in Figure 5. As can be seen in Figure 5, the trends of all the results in the paper remain the same even with larger budgets. For IMDb and AIvsCR datasets, $LwR-RC$ still performs better or comparably to the most competitive baseline, RB-WAVG-BERT; for ASRS dataset, $LwR-RC$ still outperforms all the baselines. However, as the number of labeled documents grows, we expect our models and the baselines to converge to a similar accuracy, as the models no longer need the human-provided rationales and can learn statistically "what is important" from a large collection of documents that are simply annotated with labels. + +# C Accuracy Improvements + +We present the improvements in accuracy provided by \( LwR - RC \) compared to the baselines for the three datasets across different training budgets. Specifically, we compare \( LwR - RC \) with the two fine-tuned BERT based approaches, \( Lw / oR - BERT \) and \( RB - + +WAVG-BERT. As shown in Table 3, $LwR-RC$ provides significant improvements in accuracy over the two baselines across most training budgets: for IMDb, the improvements are up to $23.68\%$ ; for ASRS, the improvements are up to $28.31\%$ ; for AIvsCR, the improvements are up to $8.67\%$ . + +# D Statistical Significance Results + +In this section, we provide a summary of pairwise one-tailed t-tests comparing $LwR - RC$ with the two most competitive baselines, $Lw / oR - BERT$ and $RB-WAVG-BERT$ , for all three datasets at varying budget regiments. Table 4 shows the $p$ -values of one-tailed paired t-tests with the alternative hypothesis "the performance of $LwR - RC$ is better than the baseline approach". As this result shows, $LwR - RC$ statistically significantly outperforms both $Lw / oR - BERT$ and $RB-WAVG-BERT$ at most budget regiments with a $p$ -value of less than 0.05. + +# E Extension to Multi-class Classification + +In our paper, we focused on binary classification. $LwR - RC$ , can be extended to multi-class classification with a few modifications. For multi-class classification, let $y_{i} \in \{c_{1}, c_{2}, \dots, c_{k}\}$ : $f(x_{i}) = p(y_{i} = c \mid x_{i}) = \text{softmax}(W_{z} z_{i})$ for some parameter vector/matrix $W_{z}$ , where $c$ is the correct label for instance $x_{i}$ and $z_{i}$ is the vector representation of $x_{i}$ . Assuming that $y_{i}$ is encoded as one-hot representation, the classification loss function, $L_{clf}$ , will then change from binary cross-entropy to categorical cross-entropy: + +$$ +L _ {c l f} = - \frac {1}{| \mathcal {L} |} \sum_ {i} \left(y _ {i} \cdot \log \left(p \left(y _ {i} \mid x _ {i}\right)\right)\right) \tag {8} +$$ + +For modeling the $DvM$ objective of $LwR - RC$ , let $\mu_{i} = W_{z}z_{i}$ and $\mu_{i}^{\prime} = W_{z}z_{i}^{\prime}$ , where $z_{i}^{\prime}$ is the vector representation of $x_{i}^{\prime}$ . Then, for the correct label $c$ , we would like $\mu_{i}^{c} > 0$ and $\mu_{i}^{c} > \mu_{i}^{\prime c}$ , which results in the following objective function: + +$$ +L _ {D v M} = - \frac {1}{| \mathcal {L} |} \sum_ {i} \left(y _ {i} \cdot \log \left(p \left(y _ {i} \mid x _ {i}, x _ {i} ^ {\prime}\right)\right) \quad (9) \right. +$$ + +where, + +$$ +p \left(y _ {i} \mid x _ {i}, x _ {i} ^ {\prime}\right) = \text {s o f t m a x} \left(- \left(\mu_ {i} - \mu_ {i} ^ {\prime}\right)\right) \tag {10} +$$ + +We define the ranking loss similarly for the $RvM$ component, this time using the $R$ and $M$ documents and their respective scores $\mu_i^r = W_z z_i^r$ and $\mu_i' = W_z z_i'$ , where $z_i^r$ is the vector representation of $x_i^r$ . The ranking loss $L_{RvM}$ is then defined as: + +$$ +L _ {R v M} = - \frac {1}{| \mathcal {L} |} \sum_ {i} \left(y _ {i} \cdot \log \left(p \left(y _ {i} \mid x _ {i} ^ {r}, x _ {i} ^ {\prime}\right)\right) \right. \tag {11} +$$ + +![](images/0136f03d72786af55a055643cbc24c79c21d857a06cd4556e6606db1986cde23.jpg) +Figure 5: Comparison between our approach, $LwR - RC$ , and the five baselines using the best hyper-parameter setting for each method. + +![](images/62278a47dd9b46f6da5dd65b6cb82a16018db704b81fced00c72679533f27d9b.jpg) + +![](images/8bd55dbd4c87dbce955d97792c225b0902844b74e4c22db030c2ea2eb7a7f231.jpg) + +
BudgetDatasetLw/oR-BERTLwR-RCAbs. Imp.% Imp.RB-WAVG-BERTLwR-RCAbs. Imp.% Imp.
10IMDb64.1071.737.6311.91%66.0371.735.708.63%
ASRS58.9863.574.597.79 %58.8863.574.697.97%
AIvsCR80.4484.023.584.45%77.3284.026.708.67%
30IMDb68.1384.2716.1323.68%68.9084.2715.3722.30%
ASRS60.2077.2417.0428.31%63.4777.2413.7821.70%
AIvsCR85.2690.204.945.79%85.8890.204.325.03%
50IMDb74.6386.7012.0716.17%78.4386.708.2710.54%
ASRS67.4581.3313.8820.57%68.9881.3312.3517.90%
AIvsCR88.6691.622.963.34%88.9491.622.683.01%
70IMDb79.3087.608.3010.47%80.7787.606.838.46%
ASRS70.2082.8612.6518.02%71.7382.8611.1215.50%
AIvsCR89.2092.042.843.18%89.8292.042.222.47%
90IMDb83.3388.204.875.84%83.9388.204.275.08%
ASRS68.6785.0016.3323.77%75.6185.009.3912.42%
AIvsCR89.8092.302.502.78%90.9292.301.381.52%
110IMDb82.8089.106.307.61%87.1389.101.972.26%
ASRS70.4185.9215.5122.03%73.8885.9212.0416.30%
AIvsCR90.9293.222.302.53%91.8093.221.421.55%
130IMDb84.6788.674.004.72%88.7788.67N/AN/A
ASRS72.9685.2012.2416.78%76.4385.208.7811.48%
AIvsCR91.7892.941.161.26%92.0492.940.900.98%
150IMDb85.0389.434.405.17%89.4789.43N/AN/A
ASRS71.5384.8013.2718.54%77.8684.806.948.91%
AIvsCR92.5293.801.281.38%92.8493.800.961.03%
170IMDb86.4789.302.833.28%89.2389.300.070.07%
ASRS73.1684.8011.6315.90%79.2984.805.516.95%
AIvsCR92.1093.060.961.04%92.6893.060.380.41%
190IMDb85.7089.774.074.75%89.0089.770.770.86%
ASRS72.2485.0012.7617.66%79.9085.005.106.39%
AIvsCR92.5893.080.500.54%92.5493.080.540.58%
210IMDb86.4389.473.033.51%90.1389.47N/AN/A
ASRS72.0485.6113.5718.84%80.9285.614.695.80%
AIvsCR92.8293.480.660.71%93.0293.480.460.49%
+ +Table 3: Accuracy results comparing LwR-RC with the two fine-tuned BERT baselines, Lw/oR-BERT and RB-WAVG-BERT, at varying budgets. 'Abs. Imp.' represents the absolute accuracy improvements that LwR-RC provides over the baselines and $\%$ Imp.' represents the percentage of improvements in accuracy that LwR-RC provides with respect to the baselines. 'N/A' represents that LwR-RC doesn't provide any improvements over the baselines. For each dataset, the highest improvements that LwR-RC provides over the two baselines across all budgets are highlighted in boldface. + +# where, + +$$ +p \left(y _ {i} \mid x _ {i} ^ {r}, x _ {i} ^ {\prime}\right) = \text {s o f t m a x} \left(- \left(\mu_ {i} ^ {r} - \mu_ {i} ^ {\prime}\right)\right) \tag {12} +$$ + +We combine the classification loss $L_{clf}$ with the ranking losses, $L_{DvM}$ and $L_{RvM}$ , resulting in the main objective function for our approach for multi + +# class classification: + +$$ +L = \left(1 - \lambda_ {1} - \lambda_ {2}\right) L _ {c l f} + \lambda_ {1} L _ {D v M} + \lambda_ {2} L _ {R v M} \tag {13} +$$ + +
BudgetDatasetp-value
Lw/oR-BERTRB-WAVG-BERT
10IMDb0.0110.012
ASRS0.0050.031
AIvsCR0.0470.002
30IMDb0.0010.002
ASRS00.005
AIvsCR0.0330.006
50IMDb0.0010.04
ASRS00
AIvsCR0.0050.006
70IMDb0.0090.022
ASRS00
AIvsCR0.0280.027
90IMDb0.0090.018
ASRS00.004
AIvsCR0.0080.006
110IMDb0.0170.078
ASRS00.001
AIvsCR0.0040.011
130IMDb0.0080.574
ASRS00.001
AIvsCR0.0190.01
150IMDb0.0280.511
ASRS00
AIvsCR0.0390.065
170IMDb0.0040.456
ASRS0.0010.01
AIvsCR0.0160.185
190IMDb0.0490.181
ASRS00.02
AIvsCR0.2310.031
210IMDb0.0010.921
ASRS00.003
AIvsCR0.0860.101
+ +Table 4: Statistical significance results comparing $LwR-RC$ to the two fine-tuned BERT baselines for all three datasets at varying budget regiments. We report the $p$ -values for one-tailed paired t-tests with the alternative hypothesis "the performance of our approach is better than the baseline approach". The results where $LwR-RC$ performs statistically significantly better than the baselines (with a $p$ -value of less than 0.05) are bold-faced. + +# F AIvsCR Dataset Collection and Annotation + +In our study, we experimented with three human-annotated datasets, IMDb, ASRS, and AIvsCR. We collected and annotated the AIvsCR dataset. To construct this dataset, we first collected 6,000 articles equally from two categories, cs.AI and cs.CR, from arXiv.org using a custom search query in the arXiv API. We provide the code, including the custom search queries, that we used to collect the data from arXiv.org with the supplementary material. + +For annotating the AIvsCR dataset, two annotators, A1 and A2, were provided with the same instructions as Zaidan et al. (2007) described in their paper: highlight the rationales at your best but + +
StatisticsA1A2
# rationales per document3.88.4
# rationale words per document17.431.3
% rationales overlapping with A110030.5
% rationales overlapping with A264.0100
+ +Table 5: Average statistics for AIvsCR dataset and the two annotators, A1 and A2. The table presents the number of rationales and the number of rationale words per document provided by the two annotators, as well as the inter-annotator agreement for their rationale annotation. + +do not mark everything. + +We calculated the inter-annotator agreement for the rationales, where the rationales provided by the two annotators for the same document are considered as overlapping if they have at least one word in common, following the same manner of Zaidan et al. (2007). The relevant statistics are shown in Table 5. To make the best use of each annotator's effort, for every document, we kept the overlapping words, phrases, and sentences between the two annotators' highlighted rationales as the final rationales, as illustrated in the following example: + +- A1: rectified linear units are among the most widely used activation function in a broad variety of tasks in vision. +- A2: rectified linear units are among the most widely used activation function in a broad variety of tasks in vision. +- Final: rectified linear units are among the most widely used activation function in a broad variety of tasks in vision. \ No newline at end of file diff --git a/rankingconstrainedlearningwithrationalesfortextclassification/images.zip b/rankingconstrainedlearningwithrationalesfortextclassification/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..bc18617194570f28844e0fe2ab4fe008bd958dc3 --- /dev/null +++ b/rankingconstrainedlearningwithrationalesfortextclassification/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:49f5cf7f180334ee776a746471c644ef0f6c5b3f82b00e0199a76b53bee66f82 +size 696832 diff --git a/rankingconstrainedlearningwithrationalesfortextclassification/layout.json b/rankingconstrainedlearningwithrationalesfortextclassification/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..60db8c672cae03c663d8d39d9c57df984b9d9c2d --- /dev/null +++ b/rankingconstrainedlearningwithrationalesfortextclassification/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:08cddf335b8ee11444164b1976e6e7bd5c0495846a84baeb20204e6a78bd22e0 +size 602181 diff --git a/readbeforegeneratefaithfullongformquestionansweringwithmachinereading/a94b2802-d2f4-4390-8ca7-f6ce876683c1_content_list.json b/readbeforegeneratefaithfullongformquestionansweringwithmachinereading/a94b2802-d2f4-4390-8ca7-f6ce876683c1_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..b9520b907bab5e88feb5aea8db0fc5cb460d1184 --- /dev/null +++ b/readbeforegeneratefaithfullongformquestionansweringwithmachinereading/a94b2802-d2f4-4390-8ca7-f6ce876683c1_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:268abeacd7df0d2c2bb16c2c395ffeb2197a3b6369ecdf6a808b256df5c48363 +size 103607 diff --git a/readbeforegeneratefaithfullongformquestionansweringwithmachinereading/a94b2802-d2f4-4390-8ca7-f6ce876683c1_model.json b/readbeforegeneratefaithfullongformquestionansweringwithmachinereading/a94b2802-d2f4-4390-8ca7-f6ce876683c1_model.json new file mode 100644 index 0000000000000000000000000000000000000000..4447d84ca32e66ce2099fcc50cc9f0d14b37c7d9 --- /dev/null +++ b/readbeforegeneratefaithfullongformquestionansweringwithmachinereading/a94b2802-d2f4-4390-8ca7-f6ce876683c1_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d309ce9be892bb16abc1b2ffc438568b8e66c31c9b4cb48fbcc6f2994711b140 +size 123841 diff --git a/readbeforegeneratefaithfullongformquestionansweringwithmachinereading/a94b2802-d2f4-4390-8ca7-f6ce876683c1_origin.pdf b/readbeforegeneratefaithfullongformquestionansweringwithmachinereading/a94b2802-d2f4-4390-8ca7-f6ce876683c1_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b713ddc8874f84b3b98053c1a837f7cfe320a89c --- /dev/null +++ b/readbeforegeneratefaithfullongformquestionansweringwithmachinereading/a94b2802-d2f4-4390-8ca7-f6ce876683c1_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:df407367ae8ec53205ce2eb9bddf1221009c833d3127d064047d466911218a10 +size 776118 diff --git a/readbeforegeneratefaithfullongformquestionansweringwithmachinereading/full.md b/readbeforegeneratefaithfullongformquestionansweringwithmachinereading/full.md new file mode 100644 index 0000000000000000000000000000000000000000..e07a2ab07a6ccae54cfc54b2cbb3bf8fb2adf5d2 --- /dev/null +++ b/readbeforegeneratefaithfullongformquestionansweringwithmachinereading/full.md @@ -0,0 +1,450 @@ +# Read before Generate! Faithful Long Form Question Answering with Machine Reading + +Dan Su $^{1*}$ , Xiaoguang Li $^{2}$ , Jindi Zhang $^{3}$ , Lifeng Shang $^{2}$ , Xin Jiang $^{2}$ , Qun Liu $^{2}$ , and Pascale Fung $^{1}$ + +1Center for Artificial Intelligence Research (CAiRE) + +The Hong Kong University of Science and Technology, Clear Water Bay, Hong Kong + +$^{2}$ Huawei Noah's Ark Lab $^{3}$ City University of Hong Kong + +dsu@connect.ust.hk, lixiaoguang11@huawei.com + +# Abstract + +Long-form question answering (LFQA) aims to generate a paragraph-length answer for a given question. While current work on LFQA using large pre-trained model for generation are effective at producing fluent and somewhat relevant content, one primary challenge lies in how to generate a faithful answer that has less hallucinated content. We propose a new end-to-end framework that jointly models answer generation and machine reading. The key idea is to augment the generation model with fine-grained, answer-related salient information which can be viewed as an emphasis on faithful facts. State-of-the-art results on two LFQA datasets, ELI5 and MS MARCO, demonstrate the effectiveness of our method, in comparison with strong baselines on automatic and human evaluation metrics. A detailed analysis further proves the competency of our methods in generating fluent, relevant, and more faithful answers. + +# 1 Introduction + +Long-form question answering (LFQA) is a task to generate an in-depth, paragraph-length answer for a given question (Fan et al., 2019). It is important since many of the everyday questions that humans deal with and pose to search engines require multisentence explanations (Khashabi et al., 2021) (e.g. why/how..?). It can be integrated with a search engine (Metzler et al., 2021), or a virtual conversation agent, and can also be used to generate explanations as a complement to short-phrase answers for open-domain questions (Kwiatkowski et al., 2019; Yang et al., 2018), or to answer open-ended questions like those from Reddit forum "Explain Like I'm Five" (Fan et al., 2019). + +LFQA is quite a challenging task. It often involves searching a large external knowledge source + +# Question: definition of sadduction + +FiD: Sadducees. noun. The definition of a sadducee is a person who acts in a deceitful or duplicitous manner. An example of a Sadducee is a politician who acts deceitfully in order to gain political power.1 a member of a Jewish sect that was active during the Second Temple. + +RBG(ours): The Sadducees were a sect or group of Jews that were active in Judea during the Second Temple period, starting from the second century BCE through the destruction of the Temple in 70 CE. The sect was identified by Josephus with the upper social and economic ecoshon of Judean society. + +![](images/8121fe1299273b8ca5d84192bb975995ac1c9992d16e8574b463e3544b753840.jpg) +Figure 1: An example from MS MARCO (Nguyen et al., 2016) dataset. We highlight the unfaithful snippets from other model. Our model(RBG) generate more factually accurate answer. + +The Sadducees (/'sədjesi:z/; Hebrew: Šeduqim) were a sect or group of Jews who were active in Judea during the Second Temple period, starting from the second century BCE through the destruction of the Temple in 70 CE. + +Josephus associates the sect with the upper social and economic echelon of Judean society. + +that contains millions of documents for relevant information. Then it generates a paragraph-length answer from those retrieved sources. While the great success in retrieval technique (Guu et al., 2020; Karpukhin et al., 2020; Lee et al., 2019) can be carried over to the LFQA setting, more challenges lie in the generation. First, multiple documents that contain hundreds of tokens need to be considered for generation, raising difficulties in the direct use of current pre-trained language models. Second, as different documents may contain redundant, complementary, or contradictory information, how to synthesis the information and generate a faithful answer that has less hallucinated content is even more challenging. + +While recent work on LFQA (Krishna et al., 2021) focuses primarily on the first challenge, and has produced fluent and somewhat relevant content, the latter faithfulness challenge has not been explored. However, the faithfulness issue is quite important for LFQA. As the example in Fig. 1 shown, a fluent and relevant but unfaithful answer (high + +light in green) will mislead users. + +In this paper, we propose a novel end-to-end framework named RBG (Read Before Generate) for LFQA to address the aforementioned challenges. The key idea for enhancing answer faithfulness is to augment the generation process with predicted salient information which can be viewed as an emphasis on answer-related facts. Specifically, we combine a Seq2Seq language model-based generator with a machine reading comprehension (reader) module. The reader produces an evidence probability score for each sentence, which will be integrated with the generator for final distribution prediction. We perform evidence fusion in a similar way as FiD (Izacard and Grave, 2021) to equip the pre-trained language model with multiple input documents for generation. To further enhance the factual grounding ability of RBG, we propose an additional pre-training task to encourage the model to rely more on retrieved documents to generate factual statements. The details are explained in Section 2. + +We conduct thorough experiments on our method and several baselines on ELI5 (Fan et al., 2019), the only publicly available large-scale LFQA dataset, and also on MS MARCO (Nguyen et al., 2016) passage ranking data, which can also be transformed into an answer generation task. The proposed method tops the public leaderboard of the KILT (Petroni et al., 2021) Benchmark on the ELI5 dataset. It also outperforms the baselines, including non-retrieval and retrieval-based methods, such as DPR-BART (Petroni et al., 2020), RAG (Izacard and Grave, 2021) and FiD (Izacard and Grave, 2021), with improvement on the automatic evaluation results on the MS MARCO dataset. Human evaluation results further validate that our proposed framework can improve the generation quality in terms of relevance and factual correctness. + +Our contributions are summarized as follows: + +- To the best of our knowledge, we are the first trying to tackle the faithfulness challenge in LFQA. +- We propose a new and effective framework for open-domain LFQA to generate answers with the guidance of a sentence evidence score from a machine reading module, as well as an additional factual grounding-oriented pretraining task. +- We show the effectiveness of our method by both automatic evaluation and human eval + +uation on two large-scale datasets, and we also demonstrate by human evaluation that our method improves the factual correctness of generated answers while still keeping high informativeness. + +# 2 A state-of-the-art LFQA system + +To generate in-depth, long-form answers for a given general domain question, we first use a retriever to search for relevant information from a large external knowledge source. Then our reader and the generation module take the multiple retrieved documents together with the question as input to generate the answer. Specifically, the reader module adopts a machine reading comprehension (MRC) model to produce an evidence score for each sentence in each document, while the generator, which adopts a large pre-trained Seq2Seq language model, fuses the sentence evidence score into its generation process. Our framework is shown in Figure 2. + +# 2.1 Supporting document retriever + +We use DPR (Karpukhin et al., 2020) to retrieve the supporting documents following the typical methods in the state-of-the-art framework for open-domain QA (Izacard and Grave, 2021; Lewis et al., 2020b). The passage and question are represented as 768-dimensional dense vector representations, computed via the BERT-based bi-encoder networks of DPR. The retriever will rank the documents according to their relevance, calculated as + +$$ +\operatorname {S c o r e} _ {r e} (Q, D _ {i}) = \operatorname {B E R T} _ {q} (Q) ^ {T} \operatorname {B E R T} _ {d} (D _ {i}) \tag {1} +$$ + +Retrieval is performed using approximate nearest neighbors with the FAISS library. We denote $D = \{D_{1},D_{2},\dots,D_{k}\}$ as the top- $K$ retrieved documents for question $Q$ . + +# 2.2 Document reader + +Since there are no golden retrievals for long-form answers, the retrieved documents may contain complementary, contradictory, or redundant information related to the answer. Thus, we propose to use a reader module to explicitly predict the sentence-level evidence probability in each document. + +Evidence span prediction We use a machine reading comprehension (MRC) model to predict the evidence span in each document, as these models approach or even outperform human-level performance on many datasets (Joshi et al., 2020). + +![](images/39e4a0e029d92d48e735abc3e6d497a41aaccb4f079b3d6bd0a6893c707024af.jpg) +Figure 2: Overview architecture of our RBG framework. RBG comprises a supporting document retriever, a document reader and a generator. + +The MRC model takes the concatenation of the retrieved document $D_{i}$ and question $Q$ as input, and outputs the prediction of the start and end position of the potential evidence spans in $D_{i}$ . Specifically, it outputs two probability distributions over the tokens in $D_{i}$ : $P_{i}^{s}(w_{s})$ and $P_{i}^{e}(w_{s})$ , where $P_{i}^{s}(w_{s}) / P_{i}^{e}(w_{s})$ is the probability that the token $w_{s}$ is the start/end of the evidence span in $D_{i}$ . + +Sentence evidence probability Originally, the MRC model was designed to give accurate, short-phrase span prediction (Rajpurkar et al., 2016), but we argue that a sentence-level evidence probability will be better in our scenario. The supporting sentences can provide the minimum required context information for each answer span, which is quite important, especially in multi-document generation (Xu and Lapata, 2020). We define our sentence-level evidence probability score for the $i$ -th document $P_{rea}^{i}(S)$ as the summation over all token-level evidence probabilities in that sentence, and it is calculated via + +$$ +P _ {r e a} ^ {i} (S) = \frac {1}{2} \sum_ {w _ {s} \in S} \left(P _ {i} ^ {s} \left(w _ {s}\right) + P _ {i} ^ {e} \left(w _ {s}\right)\right) \tag {2} +$$ + +$$ +P _ {r e a} (S) = \operatorname {N o r m} \left(P _ {r e a} ^ {1} (S); \dots P _ {r e a} ^ {i} (S); \dots P _ {r e a} ^ {K} (S)\right) \tag {3} +$$ + +We concatenate $P_{rea}^{i}$ and normalize the distribution as $P_{rea}(S)$ , where $P_{rea}(S)$ denotes the final sentence-level evidence probability in all the $K$ documents regarding the question. + +Multi-task MRC As there are no golden answer spans for LFQA data, we need a MRC model that has enough generalization ability for open domain questions as a starting point. We choose SpanBERT (Joshi et al., 2020), and further fine-tune it in a multi-task way on six large- + +scale MRC datasets from the MRQA shared task (Fisch et al., 2019) following work by Su et al. (2019): SQuAD (Rajpurkar et al., 2016), NewsQA (Trischler et al., 2017), TriviaQA (Joshi et al., 2017), SearchQA (Dunn et al., 2017), HotpotQA (Yang et al., 2018), and NatualQuestions (Kwiatkowski et al., 2019). The multi-task fine-tuned MRC model $R$ will be further jointly trained with the generator, using the golden answer in a distantly supervised way. + +# 2.3 Generator + +FiD-BART We choose BART as our generation backbone because of its outstanding performance on many generation tasks, especially on long-form abstractive summarization task (Lewis et al., 2020a). We propose FiD-BART, following the Fusion-in-Decoder idea from Izacard and Grave (2021), to empower BART to deal with multiple, long-document inputs. FiD-BART processes each document independently in the encoder, while performing the cross-attention in the decoder jointly. + +The encoder encodes the concatenation of each supporting document $D_{i}$ and the question $Q$ . More precisely, we append the special tokens question: before $Q$ , title: and context: before the title and text of each document $D_{i}$ . We denote the encoded final representation of the encoder as $h_{enc}$ , which is the concatenation of the $K$ encoder outputs $h_{enc}^{i}$ ( $h_{enc}^{i} \in R^{d \times l_{i}}$ ) for the $i$ th document: + +$$ +h _ {e n c} ^ {i} = \operatorname {E n c o d e r} (Q; D _ {i}) \tag {4} +$$ + +$$ +h _ {e n c} = \left(h _ {e n c} ^ {1}, \dots , h _ {e n c} ^ {i}, \dots , h _ {e n c} ^ {K}\right) \tag {5} +$$ + +The partial structure of the decoder can be illustrated by Eq.(6)-(8), where $h_l$ is the representation for the $l$ -th decoder layer. We denote $h_{dec}$ as the + +last layer decoder outputs: + +$$ +h _ {l} ^ {a} = \text {S e l f A t t e n t i o n} \left(h _ {l}, h _ {l}, h _ {l}\right) \tag {6} +$$ + +$$ +h _ {l} ^ {b} = \operatorname {L a y e r N o r m} \left(h _ {l} + h _ {l} ^ {a}\right) \tag {7} +$$ + +$$ +h _ {l} ^ {c} = \text {C r o s s A t t e n t i o n} \left(h _ {l} ^ {b}, h _ {\text {e n c}}, h _ {\text {e n c}}\right) \tag {8} +$$ + +As we can see, FiD-BART can scale to a large number of input documents within a linear computation time. + +# 2.4 Reader-before-generator + +To incorporate the evidence probability into generation, we apply the pointer-generator model (depicted in Figure 2). The attention distribution $\mathcal{A}$ and context vector $h_c$ , and the generation probability $p_{gen} \in [0,1]$ are calculated as follows: + +$$ +\mathcal {A} = \operatorname {s o f t m a x} \left(h _ {\text {d e c}} h _ {\text {e n c}} ^ {T}\right) \tag {9} +$$ + +$$ +h _ {c} = \mathcal {A} h _ {e n c} \tag {10} +$$ + +$$ +p _ {g e n} = \operatorname {s i g m o d} \left(W _ {c} h _ {c} + W _ {g} h _ {d e c}\right) \tag {11} +$$ + +where $W_{c}$ and $W_{g}$ are learnable parameters. $p_{gen}$ is used as a soft switch to choose between generating a word from the generator by sampling from the vocab, or copying a word from the input sequence by sampling according to the evidence distribution $P_{rea}(w)$ : + +$$ +P _ {g e n} (w) = l m _ {h e a d} \left(h _ {d e c}\right) \tag {12} +$$ + +$$ +P _ {r e a} (w) = \sum_ {s: w _ {s} = w, w _ {s} \in S} P _ {r e a} (S) \tag {13} +$$ + +$$ +P (w) = p _ {g e n} P _ {g e n} (w) + \left(1 - p _ {g e n}\right) P _ {r e a} (w) \tag {14} +$$ + +# 2.5 Pre-training + +To further improve the ability to ground on retrieved documents, we propose a pre-training task: retrieval-augmented recovery (RAR). Instead of recovering the corrupted text through the internal knowledge memorized in model parameters (Raffel et al., 2020; Lewis et al., 2020a), RAR encourages the model to rely more on external retrieved documents to generate factual statements. Specifically, given an original text $S$ , we retrieve the top- $k$ documents $D_{1}, D_{2}, \ldots, D_{N}$ from the knowledge corpus using BM25 (discarding $S$ itself), and we replace $30\%$ of the words in $S$ with [MASK] to form a pseudo query $Q$ . The pre-training task asks our RBG model to recover $S$ with the input of the pseudo query $Q$ and $k$ retrieved documents, which can be formulated as + +$$ +S = R B G (Q; D _ {1}, D _ {2}, \dots , D _ {k}) \tag {15} +$$ + +To involve more factual information during the text corruption and recovery process, we sample 1 million sentences of $S$ corresponding to at least one knowledge base triplet from Wikipedia with the text-triple alignment of TREX (Elsahar et al., + +2018a). + +# 3 Experiment Setups + +# 3.1 Datasets + +We conduct experiments on the two following datasets, both of which concentrate on long form generative QA. + +ELI5 (Fan et al., 2019) is the only publicly available large-scale LFQA dataset. It is a collection of question-answer pairs extracted from the Reddit forum "Explain Like I'm Five"(ELI5). We use the KILT (Petroni et al., 2021) version of the dataset from its Github repository $^2$ , which has 272,634 training examples and 1,507 development examples. The average length of the answers is 130 words. + +MS MARCO (Nguyen et al., 2016) is a dataset of crowdsourced responses to Bing queries. We use the question-answer pairs of the MS MARCO passage ranking track for training and evaluation, as they are more abstract and reliant on multi-document information than those of the NLG track. The training example size is about 500,000 and the evaluation example size is 6980. + +Knowledge source The external knowledge source of the retriever is the Wikipedia paragraphs, which are provided in the KILT benchmark as a unified knowledge source for knowledge-intensive tasks, including open-domain LFQA (Petroni et al., 2021). It is based on the 2019/08/01 Wikipedia snapshot, and contains 5.9M articles. + +# 3.2 Baselines + +BART and T5 We fine-tune BART (Lewis et al., 2020a) and T5 (Raffel et al., 2020) using QA pairs without explicit retrieval, and include them as our baselines which rely only on parameterized internal knowledge (Roberts et al., 2020) to generate answers. + +DPR-BART is our retrieval-based LFQA baseline. We follow Petroni et al. (2020) to retrieve and preprocess the top-3 passages from DPR for each input sample, and use context-enhanced training data to fine-tune a BART model. + +RAG (Lewis et al., 2020b) is an end-to-end retrieval-augmented generation model which backpropagates to the retriever's input encoder. We experiment with fine-tuning RAG on LFQA tasks, establishing a strong baseline on all of them. At every generation step we retrieve the top-5 passages and use them as supporting documents. + +2github.com/facebookresearch/KILT + +FiD (Izacard and Grave, 2021) encodes each passage independently and combines all outputs from the encoder before passing them to the decoder. FiD has achieved superior performance on a number of open-domain QA tasks (Izacard and Grave, 2021). We implement FiD-BART, using BART as the generation backbone, as our strongest baseline. + +# 4 Experiment Results + +# 4.1 Automatic Evaluation + +We use the metrics unigram F1 score and ROUGE-L (LIN, 2004) in previous work on LFQA (Petroni et al., 2021; Krishna et al., 2021) to evaluate and compare the generation quality of our method. + +Overall Comparison Table 1 shows the performance of various methods on the two datasets. As shown, our RBG method outperforms all baselines models with regard to both evaluation metrics on both datasets. The RBG method also outperforms the previous state-of-the-art method $c$ -REALM+RT on the KILT-ELI5 leaderboard $^3$ (Krishna et al., 2021), as shown in Table 2. + +
ModelsEli5MS MARCO
ROUGE-LF1ROUGE-LF1
T5(base)21.0218.3621.1920.03
BART(large)22.6922.1923.2625.6
DPR+BART17.4117.8823.0125.13
RAG16.1117.24--
FiD25.7028.5524.6427.08
RBG(ours)26.4629.0424.7227.52
+ +Table 1: Performance comparison between our RBG method and the baselines on the KILT-ELI5 (Petroni et al., 2021) and MS MARCO (Nguyen et al., 2016) evaluation sets. + +
ModelRetrievalGeneration
PRr.R@5F1R-LKRL
RBG(ours)10.8327.2524.5327.132.62
DPR_kilt_wiki14.8327.6916.4515.912.46
c-REALM110.6724.5623.1922.882.36
DPR+BART10.6726.9217.4117.881.90
RAG11.0022.9214.0514.511.69
BART-large0.000.0020.5519.230.00
T5-base0.000.0019.0816.100.00
+ +Fine-grained Comparison Intuitively, the quality of retrieved documents will affect the generation quality, thus we provide a fine-grained performance comparison. We split MS-MARCO evaluation set into different subset based on the quality of the retrieved documents4, and compare the ROUGE-L score between FiD and RBG under each subset. + +As we can see from Table 3, even though RBG beats FiD by 0.1 Rouge-L score on the whole MS-MARCO evaluation set, the performance gap continue increasing as the retrieval quality of the evaluation subset increased. This indicates that RBG is especially effective when high-quality retrieval documents is provided, which matches with our intuition. + +Table 2: Results on the ELI5 test set on the KILT leaderboard. Our RBG tops the leaderboard in terms of (1) retrieval performance, using R-precision(RPr.) and Recall@5(R@5), and (2) generation quality, using F1 and ROUGE-L(R-L). These scores are combined to produce the overall metric KILT R-L(KRL) (Petroni et al., 2021). c-REALM1 is from (Krishna et al., 2021) + +
>ngram overlap00.40.60.8
# of documents698034931470489
ROUGE-LFiD24.6428.0433.6245.25
RBG24.7228.5934.3846.29
>retrieval score0.0758085
# of documents6980581131881001
ROUGE-LFiD24.6424.725.6326.81
RBG24.7225.4626.5327.96
+ +Table 3: Fine-grained comparison between FiD and RBG on different subset of MS-MARCO evaluation data. + +# 4.2 Human evaluation + +We further evaluate our model using human annotators, who we ask to quantify three aspects of the generated answer, (1) fluency, which measures whether the answer is coherent and less repetitive; (2) relevance, which measures the amount of information relevant to answering the question, and (3) factual correctness (also briefly called correctness), which measures the correctness and faithfulness of all facts involved in the generated answer. + +We select FiD, which is the strongest baseline in terms of automatic metrics, for comparison. We sample evaluation questions from the MS MARCO dev set, which are better supported by Wikipedia knowledge than ELI5. Table 4 shows the absolute evaluation results of human annotation. To reduce the impact of scale selection inconsistency of different annotators, we also show the relative evaluation results in Table 5. We can see that both types of + +
ModelFluencyRelevanceCorrectness
FiD2.622.342.07
RBG(ours)2.702.502.41
+ +Table 4: Absolute human evaluation results for RBG vs. FiD on MS MARCO. The table shows the mean value across all annotators and examples for each metric. + +
AspectPrefer FiDPrefer RBGTie
Fluency12%26%62%
Relevance18%48%34%
Correctness4%62%34%
+ +results indicate that RBG outperforms FiD in terms of all three aspects. RBG has more advantages over FiD on the metric of factual correctness, possibly benefited by the introduction of the reader module and additional pre-training. More details of the human evaluation setup and statistical analysis can be found in Appendix C. + +# 4.3 Ablation + +To further investigate the contribution and effect of each module in the proposed system, we conducted a systematic ablations on the MS-MARCRO evaluation dataset. + +Table 5: Relative human evaluation results for RBG vs. FiD on MS MARCO. The percentages represent the ratio of one model being voted as preferred by multiple annotators on a metric. + +
No.modelsMS MARCO
ROUGE-LF1
0RBG(ours)24.7227.52
1w/o reader24.6627.30
2w/o pre-training24.6527.38
3w/o reader + pre-training24.6427.08
4w/ reader frozen24.5125.85
5w/ random retrieval22.8425.23
+ +w/o reader/pre-training: We respectively remove the reader module (w/o reader), the pretraining (w/o pre-training), and both together (w/o reader + pre-training) from our model, to test the contribution of each part. As we can see from Table 6, without the reader to predict the evidence probability, the generation performance decreases in both metrics, and the performance continues to drop without the pre-training. + +$w/$ reader frozen: We freeze the reader to investigate the benefit of distantly supervised end-to-end training of the reader module. As we can see from Table 6, the results on both metrics drop, especially the F1 score, which proves the effectiveness of the end-to-end training. + +$w$ / random retrieval: To investigate whether and how much the generation process is grounded in the retrieved documents, we replace retrieved paragraphs with randomly sampled paragraphs from Wikipedia at inference time for comparison. As we can see, the ROUGE-L drops significantly with randomly retrieved documents, and it is also worse than the baseline systems such as BART and DPR-BART (Table 1). + +# 5 Further analysis + +We conduct further analysis on the results, considering that LFQA is a complicated but less explored task, which deserves a complete investigation. + +# 5.1 How does retriever affect the generation quality? + +We further investigate the effects of the quality of retrieved documents on the final generation. We split the evaluation sets of the two datasets via different thresholds for the two metrics4 and calculate the corresponding ROUGE-L score for each subset. As we can see in Table 7, better-retrieved documents always bring better generation quality, indicating the importance of high-quality supporting documents for the generation process. + +We also measure the effects of the number of retrieved documents $K$ on the generation quality and find that the best $K$ from $\{5, 10, 20, 50\}$ is 10. More retrieved documents do not improve generation quality as in open-domain QA. + +Table 6: Ablation results on the MS MARCO evaluation set. A more fine-grained results comparison is shown with analysis in Section 5. + +
>retrieval score(top-1)ELI5MS MARCO
# of dataROUGE-L# of dataROUGE-L
0.0157026.35698024.72
75127026.37581125.46
8047926.38318826.53
857226.96100127.96
901127.2516127.61
+ +
>ngram overlapELI5MS MARCO
# of dataROUGE-L# of dataROUGE-L
0.0157026.35698024.72
0.446027.09349328.59
0.526027.31247030.72
0.610927.52147034.38
0.74827.6384539.64
0.82727.1748946.29
+ +Table 7: Fine-grained results of our RBG on ELI5 and MS MARCO. With high-quality retrieval (higher N-gram overlap or retrieval score threshold), the answer quality (ROUGE-L) increases on both datasets. + +# 5.2 How does the reader contribute to the generation? + +As shown in the ablation study, the reader module improves the overall performance on the MS MARCO evaluation dataset. We further investigate + +![](images/6319f1206c888c49e7a0de2b9fdab2002a54de3b6ed3be6251a980278454805e.jpg) +Figure 3: ROUGE-L versus document retrieval performance for reader analysis. + +![](images/f9e4756595e17d667dffca902f4da7ffaffb562e11e55c1ca38a13542fddf32c.jpg) + +
AspectPrefer w/o readerPrefer w/ readerTie
Fluency15%35%50%
Relevance17%57%26%
Correctness25%45%30%
+ +Table 8: Human evaluation results for RBG reader analysis on MS MARCO. The model with reader has better generation performance in terms of fluency, relevance and correctness. + +its performance when retrieved documents with different quality levels are provided. + +We show in Figure 3 the fine-grained comparison results between ablation models No.2: $RBG$ w/o pre-training and No.3: $RBG$ w/o pre-training + reader. As we can see, the difference in ROUGE-L between the two models increases as the quality of the retrieved documents improves, indicating the reader's strong capability, especially on high-quality data. This also matches with our intuition. We also conduct a human evaluation for reader analysis, and we show the results in Table 8. + +# 5.3 How does pre-training help? + +We also compare the models' performance in a fine-grained way, to quantify the contribution from our pre-training task. We show in Figure 4 the fine-grained comparison results between ablation models No.1: RBG w/o reader and No.3: RBG w/o pre-training + reader. As we can see, the model with pre-training is better in most situations than that without pre-training. The human evaluation in Table 9 also indicates the effectiveness of our pretraining task to improve the factual correctness and relevance of the generated answer. We conjecture that the pre-training task of retrieval-augmented recovery can facilitate the downstream LFQA model to combine multiple pieces of evidence from dif + +
AspectPrefer w/o pre-trainingPrefer w/ pre-trainingTie
Fluency40%43%17%
Relevance20%33%47%
Correctness23%47%30%
+ +Table 9: Human evaluation results for RBG pre-training analysis on MS MARCO. The model with RAR pretraining has better generation performance in terms of relevance and correctness. + +![](images/bd11c12882385d66220536312c30a866476f51a0173743078c586b1fb08b2abf.jpg) +Figure 4: ROUGE-L versus Document retrieval performance for pre-training analysis. + +![](images/dce5d38a76a5db8a4e99fc790b7dd0edb2242078ff2a1ee259d86ce4645869e0.jpg) + +ferent retrieved documents to generate the final answer. + +# 5.4 Faithfulness analysis + +Zero-shot on extractive QA tasks Inspired by previous work (Wang et al., 2020; Durmus et al., 2020) which leverage a Question Generation(QG) and a QA model to generate question answer pairs, to evaluate the faithfulness of a summary5, we propose to evaluate answer faithfulness via evaluation on two simpler open-domain QA datasets: NaturalQuestions (Kwiatkowski et al., 2019) and HotpotQA (Yang et al., 2018), which contain single-hop or multi-hop factual questions with golden answers $\left(\left(q_{i},a_{i}^{s}\right)\right|_{i = 1}^{m}\right)$ where $a_{i}^{s}$ can be extracted from Wikipedia-based documents. We use the trained models (based on MS MARCO) in Table 1 to do zero-shot long-form answer generation for these two datasets $\{a_i^l = \mathrm{Model}_{\mathrm{ms}}(q_i)\}$ , and measure the short-answer recall (the ratio of golden answer span $a^s$ contained in the generated long answer $a^l$ ) as an estimation of faithfulness of the generated long-answer: + +$$ +\operatorname {S c o r e} \left(q, a ^ {s}, a ^ {l}\right) = \frac {\sum_ {i = 1} ^ {m} \mathbb {1} \left[ a _ {i} ^ {s} \in a _ {i} ^ {l} \right]}{m} \tag {16} +$$ + +We show the results in Table 10. As we can see, our system achieves comparable performance with FiD on NQ, and it consistently outperforms other strong baselines on multi-hop dataset hotspotQA, indicating its capability in generating faithful answer especially on complex question that need to synthesis information. We also give concrete examples in Appendix E that show our model can generate more faithful snippets than FiD apart from automatic metrics. + +Case Study To have a concrete understanding of the reader's role to address faithfulness, we show two examples in Table 11. While both models use the same ctxs, RBG w reader generates a more rel- + +
NQ RecallHotpotQA Recall
T54.767.20
BART-large10.449.13
DPR+BART16.3711.57
FiD43.9322.94
RBG(ours)43.9323.36
+ +Table 10: Faithfulness Analysis of the system generation quality via zero-shot evaluation on NQ (Kwiatkowski et al., 2019) and HotpotQA (Yang et al., 2018). + +evant answer, and w/o reader only gives some correct but unrelated statements (Case 1). The reader also contributes to generating more faithful answers, as shown in Case 2. However, we notice that there is one unfaithful statement, which hallucinates the 'second-oldest' as 'oldest'. This might be because of the property of our MRC model: it gives a high evidential score to one sentence, and weakening the importance of other sentences in the same document. + +Question: what does abc stand for in liquor store? + +w/o reader answer: ABC stores. A liquor store is a retail shop that predominantly sells prepackaged alcoholic beverages intended to be consumed off the store's premises. ...,or other similar terms. + +w/ reader answer: ABC stands for Alcoholic Beverages Control (ABC Stores) and is a type of liquor store that is owned and operated exclusively by the state government, where liquor stores often sell only spirits or sometimes sell spirits and wine but not beer... + +ctxs: [[text: ...In seventeen alcoholic beverage control (ABC) states, ...,], ...,{text: operated exclusively by the state government, where liquor stores often sell only spirits or sometimes sell spirits and wine but not beer., ...,because purchased liquor must be packaged in sealed bottles},...,{...}]] + +Question: dow jones industrial average please? + +w/o reader answer: The Dow Jones Industrial Average (DJIA) is an index of 30 major U.S. stock indexes. The DJIA was created in 1896 by Charles Dow, a statistician and editor of The Wall Street Journal. The index was first published in the mid-1880s, and was last updated on May 26, 1896. + +w/ reader answer: The Dow Jones Industrial Average (DJIA) is a stock market index that tracks the performance of the 30 largest U.S. industrial companies. It is owned by S&P Dow Jones Indices, which is majority owned by Standard & Poor's Global. The Dow is the oldest and most famous of the Dow averages. It was created by Charles Dow in 1896. + +ctxs: [ {text:,..., was originally published on February 16, 1885. ...The industrial average was first calculated on May 26, 1896..},...{text:...It is the second-oldest U.S. market index after the Dow Jones Transportation Average. Currently owned by S&P Dow Jones Indices, which is majority owned by S&P Global..},..., {...}] + +Table 11: Examples from MS MARCO dataset. We highlight the sentences that have high evidential probability from the reader, and use green to mark out the unfaithful snippets. + +# 6 Related work + +Grounded generation is the task of leveraging external knowledge sources to enhance the generation. Previous work has either used structured + +external knowledge source (Liu et al., 2018; Young et al., 2018; Su et al., 2020a) or unstructured data. Zhou et al. (2018) introduced a document grounded dataset for text conversations, and Wu et al. (2021) proposed to extract lexical control phrases to do controllable grounded response generation, while Zhang et al. (2021) jointly trained a retriever and generator so that annotated text reference parallel data are not needed. + +Open-domain QA is the task of answering general-domain questions (Chen et al., 2017), in which the evidence is usually not given. Models that explicitly exploit an external corpus are referred as open-book models (Roberts et al., 2020). They typically index the corpus and then retrieve-and-read to extract the answer span from documents (Chen et al., 2017; Lee et al., 2019; Izacard and Grave, 2021; Lewis et al., 2020b). Another recently proposed class of methods is closed-book QA models (Ye et al., 2020; Roberts et al., 2020). They fine-tune pre-trained language models such as T5 (Raffel et al., 2020) or BART (Lewis et al., 2020a) with QA pairs without access to any external knowledge or context. + +Query driven multi-document summarization (QFMD) aims to generate a summary according to the query and the provided relevant document(s) (Tombros and Sanderson, 1998). Baumel et al. (2018) incorporated query relevance into a pre-trained abstractive summarizer, while Xu and Lapata (2020) and Su et al. (2020b) utilized QA models for sentence- or paragraph- level evidence ranking. Su et al. (2021) tried to improve the relevance of the summary by incorporating an answer relevance score for the source documents into the generation. + +# 7 Conclusion + +We propose a new end-to-end framework RBG that jointly models answer generation and machine reading to tackle the faithfulness issue in LFQA. Experiments on two LFQA datasets, ELI5 and MS MARCO, demonstrate the effectiveness of our method in comparison with strong baselines on automatic and human evaluation metrics. The detailed analysis further proves the competency of our method in generating fluent, relevant, and more faithful answers. We also propose to evaluate the factual correctness of LFQA model by answering questions of extractive QA tasks (e.g., Natural Questions), which may be helpful to evaluate the faithfulness of LFQA model efficiently. + +# References + +Tal Baumel, Matan Eyal, and Michael Elhadad. 2018. Query focused abstractive summarization: Incorporating query relevance, multi-document coverage, and summary length constraints into seq2seq models. arXiv preprint arXiv:1801.07704. +Danqi Chen, Adam Fisch, Jason Weston, and Antoine Bordes. 2017. Reading wikipedia to answer open-domain questions. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1870-1879. +Emily Dinan, Stephen Roller, Kurt Shuster, Angela Fan, Michael Auli, and Jason Weston. 2018. Wizard of wikipedia: Knowledge-powered conversational agents. In International Conference on Learning Representations. +Matthew Dunn, Levent Sagun, Mike Higgins, V Ugur Guney, Volkan Cirik, and Kyunghyun Cho. 2017. Searchqa: A new q&a dataset augmented with context from a search engine. arXiv preprint arXiv:1704.05179. +Esin Durmus, He He, and Mona Diab. 2020. Feqa: A question answering evaluation framework for faithfulness assessment in abstractive summarization. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 5055-5070. +Hady Elsahar, Pavlos Vougiouklis, Arslen Remaci, Christophe Gravier, Jonathon Hare, Frederique Laforest, and Elena Simperl. 2018a. T-rex: A large scale alignment of natural language with knowledge base triples. In Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC 2018). +Hady Elsahar, Pavlos Vougiouklis, Arslen Remaci, Christophe Gravier, Jonathon Hare, Frederique Laforest, and Elena Simperl. 2018b. T-rex: A large scale alignment of natural language with knowledge base triples. In Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC 2018). +Angela Fan, Yacine Jernite, Ethan Perez, David Grangier, Jason Weston, and Michael Auli. 2019. Eli5: Long form question answering. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 3558-3567. +Adam Fisch, Alon Talmor, Robin Jia, Minjoon Seo, Eunsol Choi, and Danqi Chen. 2019. MRQA 2019 shared task: Evaluating generalization in reading comprehension. In Proceedings of the 2nd Workshop on Machine Reading for Question Answering, pages 1-13, Hong Kong, China. Association for Computational Linguistics. +Joseph L Fleiss. 1971. Measuring nominal scale agreement among many raters. *Psychological bulletin*, page 378. + +Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Ming-Wei Chang. 2020. Realm: Retrievalaugmented language model pre-training. arXiv preprint arXiv:2002.08909. +Gautier Izacard and Édouard Grave. 2021. Leveraging passage retrieval with generative models for open domain question answering. In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume, pages 874-880. +Mandar Joshi, Danqi Chen, Yinhan Liu, Daniel S Weld, Luke Zettlemoyer, and Omer Levy. 2020. Spanbert: Improving pre-training by representing and predicting spans. Transactions of the Association for Computational Linguistics, 8:64-77. +Mandar Joshi, Eunsol Choi, Daniel Weld, and Luke Zettlemoyer. 2017. Triviaqa: A large scale distantly supervised challenge dataset for reading comprehension. Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers). +Vladimir Karpukhin, Barlas Oguz, Sewon Min, Patrick Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih. 2020. Dense passage retrieval for open-domain question answering. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 6769-6781. +Daniel Khashabi, Amos Ng, Tushar Khot, Ashish Sabharwal, Hannaneh Hajishirzi, and Chris Callison-Burch. 2021. Gooaq: Open question answering with diverse answer types. arXiv preprint arXiv:2104.08727. +Diederik P Kingma and Jimmy Ba. 2014. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980. +Kalpesh Krishna, Aurko Roy, and Mohit Iyyer. 2021. Hurdles to progress in long-form question answering. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 4940-4957. +Tom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, Ankur Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Jacob Devlin, Kenton Lee, et al. 2019. Natural questions: A benchmark for question answering research. Transactions of the Association for Computational Linguistics, 7:452-466. +J Richard Landis and Gary G Koch. 1977. The measurement of observer agreement for categorical data. biometrics. +Kenton Lee, Ming-Wei Chang, and Kristina Toutanova. 2019. Latent retrieval for weakly supervised open domain question answering. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 6086-6096. + +Omer Levy, Minjoon Seo, Eunsol Choi, and Luke Zettlemoyer. 2017. Zero-shot relation extraction via reading comprehension. In Proceedings of the 21st Conference on Computational Natural Language Learning (CoNLL 2017), pages 333-342. +Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. 2020a. Bart: Denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 7871-7880. +Patrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Kuttler, Mike Lewis, Wen-tau Yih, Tim Rocktäschel, Sebastian Riedel, and Douwe Kiela. 2020b. Retrieval-augmented generation for knowledge-intensive nlp tasks. In Advances in Neural Information Processing Systems, volume 33, pages 9459-9474. Curran Associates, Inc. +C-Y LIN. 2004. Rouge: A package for automatic evaluation of summaries. In Proc. of Workshop on Text Summarization Branches Out, Post Conference Workshop of ACL 2004. +Shuman Liu, Hongshen Chen, Zhaochun Ren, Yang Feng, Qun Liu, and Dawei Yin. 2018. Knowledge diffusion for neural dialogue generation. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1489-1498. +Donald Metzler, Yi Tay, Dara Bahri, and Marc Najork. 2021. Rethinking search: Making experts out of dilettantes. arXiv preprint arXiv:2105.02274. +Reiichiro Nakano, Jacob Hilton, Suchir Balaji, Jeff Wu, Long Ouyang, Christina Kim, Christopher Hesse, Shantanu Jain, Vineet Kosaraju, William Saunders, et al. 2021. Webgpt: Browser-assisted question-answering with human feedback. arXiv preprint arXiv:2112.09332. +Tri Nguyen, Mir Rosenberg, Xia Song, Jianfeng Gao, Saurabh Tiwary, Rangan Majumder, and Li Deng. 2016. Ms marco: A human generated machine reading comprehension dataset. In CoCo@ NIPS. +Fabio Petroni, Patrick Lewis, Aleksandra Piktus, Tim Rocttäschel, Yuxiang Wu, Alexander H Miller, and Sebastian Riedel. 2020. How context affects language models' factual predictions. +Fabio Petroni, Aleksandra Piktus, Angela Fan, Patrick Lewis, Majid Yazdani, Nicola De Cao, James Thorne, Yacine Jernite, Vladimir Karpukhin, Jean Maillard, et al. 2021. Kilt: a benchmark for knowledge intensive language tasks. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 2523-2544. + +Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. 2020. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research, 21:1-67. +Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. 2016. Squad: 100,000+ questions for machine comprehension of text. In EMNLP. +Adam Roberts, Colin Raffel, and Noam Shazeer. 2020. How much knowledge can you pack into the parameters of a language model? In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 5418-5426. +Dan Su, Yan Xu, Wenliang Dai, Ziwei Ji, Tiezheng Yu, and Pascale Fung. 2020a. Multi-hop question generation with graph convolutional network. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: Findings, pages 4636-4647. +Dan Su, Yan Xu, Genta Indra Winata, Peng Xu, Hyeondey Kim, Zihan Liu, and Pascale Fung. 2019. Generalizing question answering system with pretrained language model fine-tuning. In Proceedings of the 2nd Workshop on Machine Reading for Question Answering, pages 203-211, Hong Kong, China. Association for Computational Linguistics. +Dan Su, Yan Xu, Tiezheng Yu, Farhad Bin Siddique, Elham Barezi, and Pascale Fung. 2020b. Cairecovid: A question answering and query-focused multi-document summarization system for Covid-19 scholarly information management. In Proceedings of the 1st Workshop on NLP for COVID-19 (Part 2) at EMNLP 2020. +Dan Su, Tiezheng Yu, and Pascale Fung. 2021. Improve query focused abstractive summarization by incorporating answer relevance. In *Findings of the Association for Computational Linguistics: ACLIJCNLP* 2021, pages 3124-3131, Online. Association for Computational Linguistics. +James Thorne, Andreas Vlachos, Christos Christodoulopoulos, and Arpit Mittal. 2018. Fever: a large-scale dataset for fact extraction and verification. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 809-819. +Anastasios Tombros and Mark Sanderson. 1998. Advantages of query biased summaries in information retrieval. In Proceedings of the 21st annual international ACM SIGIR conference on Research and development in information retrieval, pages 2-10. +Adam Trischler, Tong Wang, Xingdi Yuan, Justin Harris, Alessandro Sordoni, Philip Bachman, and Kaheer Suleman. 2017. Newsqa: A machine comprehension + +dataset. In Proceedings of the 2nd Workshop on Representation Learning for NLP, pages 191-200. +Alex Wang, Kyunghyun Cho, and Mike Lewis. 2020. Asking and answering questions to evaluate the factual consistency of summaries. Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics. +Zeqiu Wu, Michel Galley, Chris Brockett, Yizhe Zhang, Xiang Gao, Chris Quirk, Rik Koncel-Kedziorski, Jianfeng Gao, Hannaneh Hajishirzi, Mari Ostendorf, et al. 2021. A controllable model of grounded response generation. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pages 14085-14093. +Yumo Xu and Mirella Lapata. 2020. Coarse-to-fine query focused multi-document summarization. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 3632-3645. +Zhilin Yang, Peng Qi, Saizheng Zhang, Yoshua Bengio, William Cohen, Ruslan Salakhutdinov, and Christopher D Manning. 2018. Hotpotqa: A dataset for diverse, explainable multi-hop question answering. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 2369-2380. +Qinyuan Ye, Belinda Z Li, Sinong Wang, Benjamin Bolte, Hao Ma, Wen-tau Yih, Xiang Ren, and Madian Khabsa. 2020. Studying strategically: Learning to mask for closed-book qa. arXiv preprint arXiv:2012.15856. +Tom Young, Erik Cambria, Iti Chaturvedi, Hao Zhou, Subham Biswas, and Minlie Huang. 2018. Augmenting end-to-end dialogue systems with commonsense knowledge. In Thirty-Second AAAI Conference on Artificial Intelligence. +Yizhe Zhang, Siqi Sun, Xiang Gao, Yuwei Fang, Chris Brockett, Michel Galley, Jianfeng Gao, and Bill Dolan. 2021. Joint retrieval and generation training for grounded text generation. arXiv preprint arXiv:2105.06597. +Kangyan Zhou, Shrimai Prabhumoye, and Alan W Black. 2018. A dataset for document grounded conversations. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 708-713. +A Implementation details +We initialize our generation models with the pretrained BART-large models (Lewis et al., 2020a), available in the HuggingFace $^6$ Transformers library. Our reader models was initiated from SpanBERT(base&cased), from Facebook Github $^7$ , and +$^{6}$ github.com/huggingface/transformers + $^{7}$ https://github.com/facebookresearch/ SpanBERT + +further fine-tuned on MRQA datasets for 4 epochs, using the default fine-tuning configurations. Our RBG is trained using Adam (Kingma and Ba, 2014) with a constant learning rate of 5e-5 and weight decay at 0.01. We train the model for 50k gradient steps, with a batch size of 4, using 8 Tesla V100 32Gb. We evaluate the models every 500 steps and select the best one on the validation set (1/8 of the evaluation set) based on the Rouge score. The maximum source document length is set to 300, and the target sequence length is set to 300. During inference, we use beam search with beam size of 4. + +# B Document retriever model details + +As the question/answers in LFQA may cover different domains and topics, we use a multitask variant of DPR to guarantee the retrieval performance. The retriever is trained jointly on the union of all knowledge-intensive training data in KILT benchmark (Petroni et al., 2021), including TrivaQA (Joshi et al., 2017), kwiatkowski2019naturalquestion (Kwiatkowski et al., 2019), HotpotQA (Yang et al., 2018), Fever (Thorne et al., 2018), zsRE (Levy et al., 2017), AY2, T-REx (Elsahar et al., 2018b) and WoW (Dinan et al., 2018). + +# C Human evaluation setup and analysis + +Basic setup As shown in Table 12, we sample 50 questions for each comparison and assign 3 annotators for each generated answer, which brings a workload of 450 judgments on model preference for each evaluation aspect. This process takes large amounts of energy and time considering the difficulty and challenges of factual-related annotation. We sample 10 questions from each of five development subsets corresponding to 5 levels of answer-passage overlap, which is a stratified sampling strategy. The answer position of each model is randomly shuffled to reduce the bias of position preference. 15 participants in our human evaluation are all researchers or students in computer science who speak and read English well. + +
Comparison#Questions#Annotators/answer
RBG vs. FiD503
Reader analysis503
Pre-training analysis503
+ +Table 12: Details of human evaluation for three comparisons. + +Scoring setup We ask each annotator to select a score from $\{1,2,3\}$ for each generated answer in terms of three aspects: fluency, relevance and factual correctness. During scoring, the annotators are asked to preserve the relative better-or-not relationship between two models as much as possible. In particular, for the metric of factual correctness, the annotators check the correctness of all factual statements involved in a generated answer by referring to Wikipedia (EN), other web pages and the golden answer. The answer with significantly fewer factual errors will get a higher score on factual correctness. We show cases in Table 16 to demonstrate how the annotator evaluate three aspects in our experiment. + +Statistical analysis We present the agreement among annotators on model preference in Table 13 by calculating the Fleiss Kappa (Fleiss, 1971) as the inter-rater consistency. The RBG vs. FiD comparison achieves better annotation agreement than other two ablation comparisons, maybe because RBG integrates both two of our contributions to improve the answer quality. In the comparison of RBG vs. FiD, annotators achieve a "moderate agreement" on the aspect of correctness and "fair agreement" on relevance (Landis and Koch, 1977). Annotators achieve best agreements on fluency in all comparisons. It's more difficult to achieve a high degree of annotation consistency on factual correctness and relevance than fluency due to complicated facts involved in the generated answer. Therefore, we recommend taking preferred ratio as the core metric for factual-related evaluation following (Krishna et al., 2021; Nakano et al., 2021). We also present score variance of four models involved in human evaluation in Table 14. It's natural that the fluency score has the smallest variance while the difficult-to-annote correctness has largest variance. + +
Comparisonfluencyrelevancecorrectness
RBG vs. FiD0.650.330.47
Reader analysis0.550.120.06
Pre-training analysis0.620.160.08
+ +Table 13: Agreement analysis for three comparisons in terms of three aspects. We use Fleiss Kappa (Fleiss, 1971) to measure the agreement degree between annotators. The score range of [0,0.2] corresponds to slight agreement, [0.2,0.4] corresponds to fair agreement and [0.4,0.6] corresponds to moderate agreement (Landis and Koch, 1977). + +
Comparisonfluencyrelevancecorrectness
RBG0.140.330.46
RBG w/o reader0.220.340.48
RBG w/o pre-training0.160.260.45
RBG w/o reader+pre-training0.280.420.64
+ +Table 14: Score variance of four models involved in human evaluation. + +
ndocsROUGE-LF1
524.6327.29
1024.7227.52
2024.3926.68
5023.4325.94
+ +Table 15: Generation performance versus the number of retrieved documents of our model on MS MARCO (Nguyen et al., 2016). + +# D Number of retrieved documents on Generation Quality + +We also investigate the effects of number of retrieved documents $k$ , on the answer generation quality. As we can see in Table 15, the generation quality in terms of ROUGE-L and F1, do not further improve as the number of $k$ increases, and the best performance are obtained when $k = 10$ in our case. + +# E Case of zero-shot experiments on NQ and HotpotQA + +In addition to automatic evaluation on the two datasets, we also show concrete examples to give a better understanding. As we can see in Table 17, BART tends to generate unfaithful answers as it lacks of external knowledge related to the specific question, and DPR + BART produces somewhat faithful but irrelevant answers, while FiD performs much better but still with partially unfaithful generations. In comparison, our RBG can generate more fluent, specific and factually accurate responses. + +
QuestionGenerated answerfrc
effects of hyperthyroidismModel1: Hyperthyroidism is a condition in which the thyroid gland produces too much thyroid hormone. The thyroid gland is a butterfly-shaped gland located in the neck. It is the only gland in the body that is responsible for the production of thyroid hormone, which helps regulate the body's metabolism.313
Model2: Hyperthyroidism is a condition in which the thyroid gland produces too much thyroid hormone. This can cause the body to produce more thyroid hormone than it needs. This causes the thyroid to over-produce thyroid hormone, which can lead to a number of symptoms, including: 1 Weight gain. 2 Nausea. 3 Fatigue. 4 Vomiting.333
where is cabo de hornosModel1: Cabo de Hornos is the southern tip of South America's Cape Horn Archipelago. It is the largest island in the Pacific Ocean and is the only island in South America with a population of more than 2,000,000 inhabitants. The island is also the world's second-largest island in terms of land area, with a total area of 1,826 square miles (4,926 square kilometers).321
Model2: Cabo de Hornos, Chile. Cabo de Hanoque, also known as Cape Horn, is the southern tip of South America. It is located in the south of Tierra del Fuego archipelago, in the AntA'rtica Province, Magallanes Region. The municipality of Cabo De Hornos is the capital of the province of Puerto Williams.333
+ +Table 16: Cherry-picked scoring cases by annotators in our human evaluation. f, r, and c respect fluency, relevance and correctness respectively. We use green to mark out factual incorrect snippets the annotator finds. The first case shows how annotators distinguish different levels of relevance and the second case shows that of factual correctness. + +
Question (from NQ): what are the ranks in the us navy?
Gold Answer: ["E-8s senior chief petty officer", "E-9s master chief petty officer"]
BART: (?) Navy ranks in the U.S. Navy. The Navy ranks are as follows: 1 Master Chief Petty Officer (MOS) a non-commissioned officer in the Navy. 2 Master Sergeant (MS), a Master Sergeant in the Marine Corps. 3 Sergeant Major (SSM), a Sergeant Major in the Air Force.
DPR-BART: (?) The U.S. Navy is a branch of the United States Armed Forces. The Navy is made up of the Navy, Marine Corps, Air Force, Coast Guard, and Coast Guard.
FiD: (*) The U.S. Navy is a branch of the United States Armed Forces. The rank system of the Navy consists of three categories: junior officers, senior officers, and flag officers. Junior officers are those officers in pay grades O-1 to O-4, while senior officers are the ones with pay grades of O-5 and O-6. Senior officers have pay grades ranging from O-7 to E-9. Flag officers have a pay grade ranging from E-5 to E9.
RBG(ours): The U.S. Navy ranks are divided into three categories: junior officers, senior officers, and flag officers. Junior officers are officers in pay grades O-1 to O-4, while senior officers are those in pay grades O-5 and O-6. Flag officers serve either as a line officer or as a staff corps officer.
Question (from HotpotQA): Which French ace pilot and adventurer fly L'Oiseau Blanc?
Gold Answer: ["Charles Eugène"]
BART: (?) L'oiseau Blanc is a French aviator and aviator who flew the L'Oiseau blanc. He is best known for being the first aviator to fly it..
DPR-BART: (?) L'oiseau Blanc l'oiseau blanc (French: The White Bird) was a French Levasseur Pl.8 biplane that disappeared in the early morning hours of April 1, 2014. The plane was a Levassellour PL.8 Biplane that vanished in the morning of April 2, 2014, after being piloted by an adventurer pilot and adventurer pilot..
FiD: (*) On May 8, 1927, Charles Nungesser and Francois Coli took off from Paris on the L'Oiseau Blanc, a Levasseur PL.8 biplane that had been designed by Charles Nongesser, a French ace pilot and aviator, to fly from Paris to New York City in the Orteig Prize.
RBG(ours): On May 8, 1927, Charles Nungesser and Francois Coli boarded L'Oiseau blanc, a 450-hp Lorraine-powered Levasseur biplane designed to compete for the Orteig Prize. They took off from Paris on 8 May 1927 and were last seen over Ireland. Less than two weeks later, Charles Lindbergh successfully made the New York-Paris journey and claimed the prize in the Spirit of St. Louis.
+ +Table 17: Examples of the zero-shot long-form answers on the NQ (Kwiatkowski et al., 2019) and HotpotQA (Yang et al., 2018) datasets. RBG model generates more fluent, specific and factually accurate responses. “?” indicates factually incorrect/irrelevant responses; * indicates partially correct responses. We use the green to mark out the unfaithful snippets. \ No newline at end of file diff --git a/readbeforegeneratefaithfullongformquestionansweringwithmachinereading/images.zip b/readbeforegeneratefaithfullongformquestionansweringwithmachinereading/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..08a566955e8d1e0271fa7fa834764c92ee7ff91e --- /dev/null +++ b/readbeforegeneratefaithfullongformquestionansweringwithmachinereading/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:404b2ffda70a4f8a163729b4271d89e29527998bb45d21302a0f78706709031e +size 833160 diff --git a/readbeforegeneratefaithfullongformquestionansweringwithmachinereading/layout.json b/readbeforegeneratefaithfullongformquestionansweringwithmachinereading/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..fc68dda3656d3c1c840e52631e1fd05f3d4eb9cd --- /dev/null +++ b/readbeforegeneratefaithfullongformquestionansweringwithmachinereading/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dc6fc1b8a3edbdbb7484ee079cc5eea48bdbb5903cc06ae7957636f1d3c988de +size 467838 diff --git a/readtopnewsfirstadocumentreorderingapproachformultidocumentnewssummarization/bf333ef1-edde-4aa4-b18d-4f7a5a688da1_content_list.json b/readtopnewsfirstadocumentreorderingapproachformultidocumentnewssummarization/bf333ef1-edde-4aa4-b18d-4f7a5a688da1_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..3ea03df5274d9d0b254f92038f3f8b66bdbf68fa --- /dev/null +++ b/readtopnewsfirstadocumentreorderingapproachformultidocumentnewssummarization/bf333ef1-edde-4aa4-b18d-4f7a5a688da1_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5eec584c51ef724af08437462b6fe72522adba98ee9b2139c74b04fc1dcb1b38 +size 63240 diff --git a/readtopnewsfirstadocumentreorderingapproachformultidocumentnewssummarization/bf333ef1-edde-4aa4-b18d-4f7a5a688da1_model.json b/readtopnewsfirstadocumentreorderingapproachformultidocumentnewssummarization/bf333ef1-edde-4aa4-b18d-4f7a5a688da1_model.json new file mode 100644 index 0000000000000000000000000000000000000000..abc51ca7c2944f40715b46692f9f42749a8eb3a7 --- /dev/null +++ b/readtopnewsfirstadocumentreorderingapproachformultidocumentnewssummarization/bf333ef1-edde-4aa4-b18d-4f7a5a688da1_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4fdb7973bb52ae74270dd994ae579348f561757e854bfc29b8c2a1f88a0b1bb1 +size 73824 diff --git a/readtopnewsfirstadocumentreorderingapproachformultidocumentnewssummarization/bf333ef1-edde-4aa4-b18d-4f7a5a688da1_origin.pdf b/readtopnewsfirstadocumentreorderingapproachformultidocumentnewssummarization/bf333ef1-edde-4aa4-b18d-4f7a5a688da1_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..a0f65ac1e700034eb7b0c5964bc634e3cfa6d044 --- /dev/null +++ b/readtopnewsfirstadocumentreorderingapproachformultidocumentnewssummarization/bf333ef1-edde-4aa4-b18d-4f7a5a688da1_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4c6ac0dfa7d1c8d7c9b505ccdcb6ca28354e557b595c58475ad57344e4fb60ae +size 341981 diff --git a/readtopnewsfirstadocumentreorderingapproachformultidocumentnewssummarization/full.md b/readtopnewsfirstadocumentreorderingapproachformultidocumentnewssummarization/full.md new file mode 100644 index 0000000000000000000000000000000000000000..7b18dc1d01dfe35a7e7ce8d658b05772a0ff4779 --- /dev/null +++ b/readtopnewsfirstadocumentreorderingapproachformultidocumentnewssummarization/full.md @@ -0,0 +1,249 @@ +# Read Top News First: A Document Reordering Approach for Multi-Document News Summarization + +Chao Zhao $^{1*}$ Tenghao Huang $^{1*}$ Somnath Basu Roy Chowdhury $^{1}$ +Muthu Kumar Chandrasekaran Kathleen McKeown $^{2}$ Snigdha Chaturvedi $^{1}$ +{zhaochao, tenghao, somnath, snigdha}@cs.unc.edu +cmkumar087@gmail.com, kathy@cs.columbia.edu + $^{1}$ UNC Chapel Hill $^{2}$ Columbia University + +# Abstract + +A common method for extractive multi-document news summarization is to reformulate it as a single-document summarization problem by concatenating all documents as a single meta-document. However, this method neglects the relative importance of documents. We propose a simple approach to reorder the documents according to their relative importance before concatenating and summarizing them. The reordering makes the salient content easier to learn by the summarization model. Experiments show that our approach outperforms previous state-of-the-art methods with more complex architectures. + +# 1 Introduction + +Multi-document news extractive summarization (MDS) aims to extract the salient information from multiple related news documents into a concise summary. Some approaches use task-specific architectures for this problem. For example, Wang et al. (2020) organize multiple documents as a heterogeneous graph before summarizing them. Zhong et al. (2020) formulate the extractive summarization task as a semantic matching problem. Recent works also explored reformulating this problem as a single-document summarization (SDS) problem by concatenating all documents into a single meta-document and then using an SDS model to summarize it (Cao et al., 2017; Liu et al., 2018; Lebanoff et al., 2018; Fabbri et al., 2019). + +Due to the conventions of news writing (Hong and Nenkova, 2014; Hicks et al., 2016), salient information often appears at the beginning of a news article. As a result, many summarization systems, including recent neural models (Kedzie et al., 2018; Zhong et al., 2019), pay more attention to the beginning of the document. Therefore, in MDS, it is important to consider the order in which the docu + +ments are concatenated to form the meta-document before applying the summarization model. + +Specifically, we argue that the various documents in the input are not equally important. Some documents contain more salient or detailed information and are more important. Therefore, compared with concatenating documents in an arbitrary order, it would be beneficial to reorder the documents such that the important ones are in the front of the meta-document and it becomes easier for the summarization model to learn the salient content. + +Motivated by these factors, we propose a simple yet effective approach to reorder the input documents according to their relative importance before applying a summarization model. We evaluate the effectiveness of our approach on Multi-News (Fabbri et al., 2019) and DUC-2004. Results show that our simple reordering approach significantly outperforms the state-of-the-art methods with more complex model architectures. We also observe that this approach brings more performance gain with the increase in the number of input documents. + +# 2 Method + +We refer to $\mathcal{D}$ as a meta-document of $m$ documents $\{d_1,\ldots ,d_m\}$ with $n$ sentences $\{s_1,\dots,s_n\}$ in total. The goal in extractive summarization is to extract a subset of sentences in $\mathcal{D}$ to summarize the input documents. It is usually formulated as a binary sentence classification problem, where each sentence is assigned a $\{0,1\}$ label to determine if it is to be included in the summary. + +Below, we introduce our document reordering approach, and then the base summarization model. + +# 2.1 Document Reordering + +Document reordering aims to rearrange documents of the meta-document in order of their salience. It can be formulated as determining the relative im + +portance score of each document and then reordering the documents according to their importance scores. Here we propose a supervised approach and an unsupervised approach for this task. + +Supervised Approach. In this approach, we use a BERT (Devlin et al., 2019) based model to learn document importance scores. For this, we first concatenate the documents together while inserting a [CLS] and a [SEP] token at the start and the end of each document. We then encode the concatenated documents using BERT to get the document representation $t_i \in \mathbb{R}^K$ , which is the representation of the [CLS] token preceding it. To enhance the model's ability to capture the inter-document relationships, we use a 2-layer Transformer to encode $t_i$ and finally obtain a document's contextualized representation $h_i \in \mathbb{R}^K$ . + +$$ +t _ {1}, \dots , t _ {m} = \operatorname {B E R T} \left(d _ {1}, \dots , d _ {m}\right) \tag {1} +$$ + +$$ +h _ {1}, \dots , h _ {m} = \operatorname {T r a n s f o r m e r} \left(t _ {1}, \dots , t _ {m}\right) +$$ + +Thereafter, in order to predict the importance score for the $i$ -th document, $\hat{y}_i$ , we apply a linear transformation with a Softmax function. + +$$ +\hat {y} _ {i} = \operatorname {s o f t m a x} (W h _ {i} + b), \tag {2} +$$ + +where $W\in \mathbb{R}^{K\times K}$ and $b\in \mathbb{R}^K$ are parameters. + +During training, we determine the oracle importance score of each document $d_{i}$ as the normalized ROUGE-1 F score between $d_{i}$ and the gold abstractive summary $S$ : + +$$ +y _ {i} = \frac {\operatorname {R O U G E} \left(d _ {i} , S\right)}{\sum_ {i} \operatorname {R O U G E} \left(d _ {i} , S\right)}. \tag {3} +$$ + +Our learning objective is to minimize the Kullback-Leibler divergence between the predicted distribution $\hat{y} = \{\hat{y}_1,\dots ,\hat{y}_m\}$ and the oracle distribution $y = \{y_{1},\ldots ,y_{m}\}$ of importance scores. + +$$ +\mathcal {L} = \operatorname {K L} (\hat {y}, y) \tag {4} +$$ + +We train the document reordering model on the training set based on this learning objective. + +During inference, we obtain the importance score of documents in the validation set and test set based on Eq. 2, and then reorder documents in descending order of their importance scores to create the meta-document. + +Unsupervised Approach. We hypothesize that the importance of a document is related to its centrality. To test this hypothesis, we propose an unsupervised centrality-based document reordering approach. To compute the centrality of a document $d_{i}$ , we first represent the topic of the input cluster, $T_{i}$ , by concatenating the top-3 sentences of each document except $d_{i}$ , and then calculate the centrality as ROUGE( $d_{i}, T_{i}$ ). We choose top-3 sentences to represent the topic as it is a strong unsupervised summarization baseline. We avoid sentences of $d_{i}$ to be included in $T_{i}$ to prevent the centrality of $d_{i}$ being dominated by its own sentences, leading to similar centrality scores for all documents. + +Finally, we reorder the documents in descending order of their centrality scores and then concatenate them into a meta-document. + +# 2.2 Base Extractive Summarization Model + +Once the documents have been reordered and concatenated to form a meta-document, they are fed to a base summarization model. For the supervised reordering approach, we use PreSumm (Liu and Lapata, 2019), a state-of-the-art SDS method. For training, the extractive oracle labels are obtained by incrementally adding sentences to the extracted summary until the ROUGE score between the extracted summary and the gold abstractive summary does not increase. Using an SDS-based model architecture also facilitates transferring knowledge from SDS datasets. For this, we first finetune the model on SDS datasets and then finetune it on our MDS dataset. For the unsupervised reordering approach, we use PacSum (Zheng and Lapata, 2019), a BERT-based model to measure the centrality of each sentence in the meta-document and then select sentences accordingly. We refer to Appendix A for details of both approaches. + +# 3 Experiments + +In this section, we evaluate our document reordering based summarization approach. + +# 3.1 Dataset + +We conduct experiments on two MDS datasets: Multi-News and DUC-2004. For evaluation, we compare the extracted summary to the gold abstractive summary. Due to the small size of DUC-2004, we use it only for out-of-domain evaluation. + +We also use CNN DailyMail (CNNDM) (Nallapati et al., 2016), a single-document news summarization dataset, to pretrain the base summarization model. More details can be found in Appendix B. + +# 3.2 Setup + +We use $\mathrm{BERT}_{\mathrm{BASE}}$ as the encoder of both the document reordering model and base summarization model. We experiment with training the summarization model from scratch and also initializing it with parameters learned by training on CNNDM. The details can be found in Appendix B. During inference, we choose the top- $K$ sentences with the highest score to compose the final summary, where $K$ is selected based on the average length of summaries in the training set. We set $K = 9$ and 7 for Multi-News and DUC-2004, respectively. + +We compare our approach with the following baselines: Lead- $N$ , TextRank (Mihalcea and Tarau, 2004), LexRank (Erkan and Radev, 2004), HiBERT (Zhang et al., 2019), MGSum-ext (Jin et al., 2020), HDSG (Wang et al., 2020), and MatchSum (Zhong et al., 2020). Lead- $N$ concatenates the top- $N$ sentence of each document. We try $N = \{1, 2, 3\}$ and report the best performance. Following these approaches, we evaluate the extractive summaries using ROUGE $F_{1}$ score. $^{4}$ + +We evaluate the document reordering model by comparing the predicted document order with the oracle order via Kendall's Tau $(\tau)$ and Perfect Match Ratio (PMR), two common metrics for ranking tasks (Basu Roy Chowdhury et al., 2021). We compare our approach with a random baseline and a length-based baseline that rearranges documents in decreasing order of their lengths. + +# 3.3 Results + +Automatic Evaluation Table 1 shows results on Multi-News using either supervised or unsupervised document reordering approach. + +We first investigate the utility of transferring knowledge from SDS. For this, we compare the PreSumm models trained from scratch (PreSumm w/o CNNDM) or initialized using CNNDM (PreSumm w/ CNNDM). Results show that PreSumm w/ CNNDM performs better than PreSumm w/o CNNDM (46.25 vs. 46.05 on ROUGE-1), indicating that the knowledge from SDS can be transferred + +
MODELR1R2RL
Lead (Fabbri et al., 2019)43.0814.2738.97
LexRank (Erkan and Radev, 2004)41.7713.8137.87
TextRank (Mihalcea and Tarau, 2004)41.9513.8638.07
HiBERT (Zhang et al., 2019)43.8614.62-
MGSum-ext (Jin et al., 2020)44.7515.75-
HDSG (Wang et al., 2020)46.0516.3542.08
MatchSum (Zhong et al., 2020)46.2016.5141.89
Unsupervised
PACSUM43.0214.0339.02
PACSUM + DRunsup (Ours)43.5714.4139.52
Supervised, w/o finetune on CNNDM
PRESUMM46.0516.5641.91
PRESUMM + DRsup (Ours)46.3416.8842.20
Supervised, w/ finetune on CNNDM
PRESUMM46.2516.7542.11
PRESUMM + DRsup (Ours)46.5717.1042.44
Oracle49.0621.5444.27
+ +Table 1: Summarization results evaluated on Multi-News by ROUGE 1 (R1), ROUGE 2 (R2), and ROUGE L (RL). Our best results (in bold) show statistically significant difference with the baselines (using paired bootstrap resampling, $p < 0.05$ (Koehn and Monz, 2006)). + +to MDS by continual training. We then test the performance of our supervised document reordering $(\mathrm{DR}_{\mathrm{sup}})$ approach. Using document reordering, our approach, PreSumm + $\mathrm{DR}_{\mathrm{sup}}$ , significantly outperforms the vanilla PreSumm on all ROUGE scores with or without CNNDM (46.57 vs. 46.25, 46.34 vs. 46.05 on ROUGE-1). Our unsupervised document reordering approach $(\mathrm{DR}_{\mathrm{unsup}})$ significantly outperforms PacSum on all ROUGE scores. These improvements demonstrate that document reordering is an effective way to leverage existing strong models for summarization. + +Our best approach, $\mathrm{PreSumm} + \mathrm{DR}_{\mathrm{sup}}$ , also significantly outperforms all of the baselines on all ROUGE scores. The performance gain is not entirely from the CNNDM, since our approach without CNNDM also achieves substantial improvements compared with all baselines. Similarly, the unsupervised approach, $\mathrm{PacSum} + \mathrm{DR}_{\mathrm{unsup}}$ , also outperforms the unsupervised baselines. These improvements demonstrate that document reordering helps in multi-document summarization. + +Human Evaluation We also conduct a human evaluation to better assess the performance of each system. We randomly select 100 test instances and evaluate the quality of a summary according to Informativeness, Conciseness, and Usefulness as in Iskender et al. (2021). We conduct a pairwise comparison of PreSumm+DRsup (the best model) + +
ModelInformativeConciseUseful
LEAD-0.20-0.14-0.17
MatchSum-0.12-0.05-0.08
PreSumm-0.060.03-0.07
+ +Table 2: Results of human evaluation by comparing three baselines with PreSumm+DRsup. A positive score means the baseline is better than ours and vise versa. + +
MODELR1R2RL
Lead-133.867.5129.64
TextRank33.097.4929.25
MatchSum33.847.4430.07
PreSumm34.427.9530.34
PreSumm + DRsup34.628.2230.54
+ +with PreSumm and MatchSum, two strongest neural baselines, as well as LEAD, the best unsupervised baseline. For each test instance, we obtain the output summary from our model and one of the baselines, and then ask three workers on Amazon Mechanical Turk to compare the two summaries according to the three measures listed above. More details can be found in Appendix C. + +The results are shown in Table 2. Negative scores indicate worse performance compared with $\mathrm{PreSumm + DR_{sup}}$ . The results show that our approach can generate more informative, concise, and useful summaries compared to baselines, which is consistent with the automatic results. + +Out-of-domain Evaluation We further evaluate the performance of our approach in an out-of-domain setting. We compare our best approach with Lead-1, TextRank, MatchSum, and PreSumm. All models except Lead-1 and TextRank were trained on Multi-news and evaluated on the DUC 2004 dataset via Rouge $F_{1}$ scores. As shown in Table 3, our approach (last row of the table) achieves consistently better performance than the baselines, indicating that our approach can effectively transfer to new unseen domains. + +# 3.4 Document-wise Analysis + +In this section, we first compare our two document reordering approaches using ranking measures ( $\tau$ and PMR) and ROUGE scores of the extracted summaries. Table 4 shows the results. Our supervised ranking method $(\mathrm{DR}_{\mathrm{sup}})$ outperforms the unsupervised method $(\mathrm{DR}_{\mathrm{unsup}})$ , demonstrating that + +![](images/f4ea7ba58242f1e90ced6357f928ec12b7bce6ead798afc01dbb9a727fe2d631.jpg) +Figure 1: Performance gain of summarization w.r.t. the number of input documents. We don't include instances with 6 or more documents since the number of such instances is small. Our approach results in more performance gain for longer inputs. + +Table 3: Out-of-domain summarization results evaluated on DUC 2004 using the model trained on Multi-News. Our approach (last row) outperforms the baselines. + +
MODELReorderingSummarization
τPMRR1R2RL
Random-0.00531.846.2516.7542.11
Length0.18943.246.3016.7342.15
DRunsup0.23646.446.4116.9442.26
DRsup0.32551.746.5717.1042.44
+ +Table 4: Reordering methods evaluated on Multi-News. Our approaches, PreSumm + DRsup and PreSumm + DRunsup outperform the baselines. + +the oracle importance score of the document is an effective supervision signal for document reordering. $\mathrm{DR}_{\mathrm{unsup}}$ achieves higher scores than baselines. It supports our hypothesis that the importance of documents is related to their centrality to the topic. + +We further analyze the impact of instance length (number of documents in the instance) on the model performance. In Figure 1, we group the test instances of Multi-News based on their lengths, and show the gain in summarization performance obtained from supervised reordering (measured using the ROUGE-1 difference $\Delta R$ between the models with and without document reordering). The figure shows that in general, $\Delta R$ increases as the instance length increases, indicating that instances with more documents benefit more from our reordering approach. + +# 3.5 Summary-wise Analysis + +The underlying assumption behind our document reordering approach is that extractive summarization models tend to select sentences from the beginning of the document. By reordering the important documents to the front of the meta-document, our approach makes the salient content easier to learn. In this section, we investigate if this is indeed what is happening by analyzing the distribution of the oracle and the generated summary sentences in the meta-document. We conduct three experiments. + +Experiment 1: We first investigate how re + +![](images/04d23738291a4c5c55b77a610ae30e87aa904e0edfd2c27aa13812e5b16b94d7.jpg) +Figure 2: (a) The distribution of oracle extractive summaries according to their sentence positions in the meta-document with and without document reordering. (b) The distribution of generated extractive summaries according to their sentence positions in the meta-document with and without document reordering. (c) The distribution of generated extractive summaries according to their sentence positions in the original, unordered meta-document. + +![](images/885cbe9a6ebd6a5f61dff356a05eeedd19f9137d9c5bd74489e3edf345e15625.jpg) + +![](images/1265f393c13f16e7bc1fc45d89e94bb3002a39081e942ad96eb72e04107a79f6.jpg) + +ordering is changing the placement of important sentences. We represent important sentences as those in the oracle summaries, which is obtained by following the procedure described in Section 2.2. Figure 2(a) shows the distribution of oracle summary-sentences at various positions of the input meta-document when it is reordered (purple shaded bars) and when it is not reordered (blue solid bars). The $x$ -axis shows the sentence positions in the input meta-document and the $y$ -axis shows the fraction of sentences from the oracle summary that were at that position in the metadata-document. Comparing the purple and blue bars in the left area, more oracle summary's sentences were located at the beginning of the reordered input meta-document compared with the unordered input meta-document. This indicates that reordering helps in placing the important sentences in the beginning of the input meta-document. + +Experiment 2: We next investigate if the summarization model favors certain sentence positions. Figure 2(b) shows the distribution of (generated) summary-sentences with respect to various positions of the input meta-document for PreSumm+DR (w/ reordering, purple shaded bars) and PreSumm (w/o reordering, blue solid bars). Like Figure 2(a), the $x$ -axis shows the sentence positions in the input meta-document, but the $y$ -axis shows the fraction of sentences from the generated summary that are at that position in the meta-document. The bars on the left are, in general, higher than the bars on the right. This indicates that PreSumm tends to pick sentences appearing at the beginning of the input meta-document to create summaries. + +Experiment 3: Finally, we want to investigate if the reordering can help the model select salient content that was originally scattered across the input. Figure 2(c) shows the distribution of (generated) summary-sentences with respect to various positions of the original unordered meta + +document for PreSumm+DR (w/ reordering, purple shaded bars) and PreSumm (w/o reordering, blue solid bars). The $x$ -axis shows the sentence positions in the original meta-document and the $y$ -axis shows the fraction of sentences from the generated summary that were at that position in the metadata-document. We see that compared with the blue bars, the purple bars have a more uniform distribution. This indicates that the reordering based model has a greater tendency to pick sentences that were located at unfavorable positions (towards the end) in the original meta-document. The reordering helps in moving these sentences to the front, and then the summarization models pick them for generating the summary. + +Overall, from these experiments, we can conclude that since the base summarization model pays more attention to the beginning of the input (Experiment 2), by moving important content towards the beginning of the input (Experiment 1), the reordering method helps the summarization model also focus on information that was scattered across the original unordered input (Experiment 3). We also provide a qualitative analysis in Appendix D to show how the document reordering helps the model generate better summaries. + +# 4 Conclusion + +In this work, we propose a document reordering based approach for multi-document news summarization. We rearrange the documents according to their relative importance while concatenating them into a meta-document and then apply a summarization model. Our simple yet effective approach outperforms the baselines on two multi-document summarization datasets, demonstrating that document reordering is a promising direction for multi-document news summarization. A next step, which we leave for future work, is to explore the scalability of such approaches on large document clusters. + +# Acknowledgements + +This work was supported in part by NSF grant IIS2112635. We thank anonymous reviewers for their thoughtful and constructive reviews. + +# Ethical Considerations + +We do not foresee any ethical concerns from the technology presented in this work. We used publicly available datasets designed for summarization, and do not annotate any data manually. The datasets used is in English language. + +# References + +Somnath Basu Roy Chowdhury, Faeze Brahman, and Snigdha Chaturvedi. 2021. Is everything in order? a simple way to order sentences. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 10769-10779, Online and Punta Cana, Dominican Republic. Association for Computational Linguistics. +Ziqiang Cao, Wenjie Li, Sujian Li, and Furu Wei. 2017. Improving multi-document summarization via text classification. In Proceedings of the Thirty-First AAAI Conference on Artificial Intelligence, February 4-9, 2017, San Francisco, California, USA, pages 3053-3059. AAAI Press. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171-4186, Minneapolis, Minnesota. Association for Computational Linguistics. +Günes Erkan and Dragomir R Radev. 2004. Lexrank: Graph-based lexical centrality as salience in text summarization. Journal of artificial intelligence research, 22:457-479. +Alexander Fabbri, Irene Li, Tianwei She, Suyi Li, and Dragomir Radev. 2019. Multi-news: A large-scale multi-document summarization dataset and abstractive hierarchical model. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 1074-1084, Florence, Italy. Association for Computational Linguistics. +Priya Goyal, Piotr Dolkar, Ross Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, Andrew Tulloch, Yangqing Jia, and Kaiming He. 2017. Accurate, large minibatch sgd: TrainingImagenet in 1 hour. arXiv preprint arXiv:1706.02677. +Wynford Hicks, Adams Sally, Harriett Gilbert, Tim Holmes, and Jane Bentley. 2016. Writing for journalists. Routledge. + +Kai Hong and Ani Nenkova. 2014. Improving the estimation of word importance for news multi-document summarization. In Proceedings of the 14th Conference of the European Chapter of the Association for Computational Linguistics, pages 712-721, Gothenburg, Sweden. Association for Computational Linguistics. +Neslihan Iskender, Tim Polzehl, and Sebastian Møller. 2021. Reliability of human evaluation for text summarization: Lessons learned and challenges ahead. In Proceedings of the Workshop on Human Evaluation of NLP Systems (HumEval), pages 86-96, Online. Association for Computational Linguistics. +Hanqi Jin, Tianming Wang, and Xiaojun Wan. 2020. Multi-granularity interaction network for extractive and abstractive multi-document summarization. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 6244-6254, Online. Association for Computational Linguistics. +Chris Kedzie, Kathleen McKeown, and Hal Daume III. 2018. Content selection in deep learning models of summarization. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 1818-1828, Brussels, Belgium. Association for Computational Linguistics. +Diederik P. Kingma and Jimmy Ba. 2015. Adam: A method for stochastic optimization. In 3rd International Conference on Learning Representations, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings. +Philipp Koehn and Christof Monz. 2006. Manual and automatic evaluation of machine translation between European languages. In Proceedings on the Workshop on Statistical Machine Translation, pages 102-121, New York City. Association for Computational Linguistics. +Logan Lebanoff, Kaiqiang Song, and Fei Liu. 2018. Adapting the neural encoder-decoder framework from single to multi-document summarization. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 4131-4141, Brussels, Belgium. Association for Computational Linguistics. +Peter J. Liu, Mohammad Saleh, Etienne Pot, Ben Goodrich, Ryan Sepassi, Lukasz Kaiser, and Noam Shazeer. 2018. Generating wikipedia by summarizing long sequences. In 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings. OpenReview.net. +Yang Liu and Mirella Lapata. 2019. Text summarization with pretrained encoders. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 3730-3740, Hong Kong, China. Association for Computational Linguistics. + +Rada Mihalcea and Paul Tarau. 2004. TextRank: Bringing order into text. In Proceedings of the 2004 Conference on Empirical Methods in Natural Language Processing, pages 404-411, Barcelona, Spain. Association for Computational Linguistics. +Ramesh Nallapati, Bowen Zhou, Cicero dos Santos, Caglar Gulçehre, and Bing Xiang. 2016. Abstractive text summarization using sequence-to-sequence RNNs and beyond. In Proceedings of The 20th SIGNLL Conference on Computational Natural Language Learning, pages 280-290, Berlin, Germany. Association for Computational Linguistics. +Danqing Wang, Pengfei Liu, Yining Zheng, Xipeng Qiu, and Xuanjing Huang. 2020. Heterogeneous graph neural networks for extractive document summarization. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 6209-6219, Online. Association for Computational Linguistics. +Xingxing Zhang, Furu Wei, and Ming Zhou. 2019. HIBERT: Document level pre-training of hierarchical bidirectional transformers for document summarization. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 5059-5069, Florence, Italy. Association for Computational Linguistics. +Hao Zheng and Mirella Lapata. 2019. Sentence centrality revisited for unsupervised summarization. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 6236-6247, Florence, Italy. Association for Computational Linguistics. +Ming Zhong, Pengfei Liu, Yiran Chen, Danqing Wang, Xipeng Qiu, and Xuanjing Huang. 2020. Extractive summarization as text matching. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 6197-6208, Online. Association for Computational Linguistics. +Ming Zhong, Pengfei Liu, Danqing Wang, Xipeng Qiu, and Xuanjing Huang. 2019. Searching for effective neural extractive summarization: What works and what's next. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 1049-1058, Florence, Italy. Association for Computational Linguistics. + +# A Base Summarization Models + +PreSumm (Liu and Lapata, 2019) is the supervised base summarization model. It uses BERT as the encoder to get the sentence representations, and a linear transformation with a Sigmoid as the decoder to get the probability of selecting a sentence. The loss function is the averaged cross-entropy between the predicted probability and the oracle $\{0,1\}$ label of each sentence. When applying this model to MDS, we insert a null sentence ("[CLS][SEP]") between consecutive (reordered) documents in the meta-document as the document delimiter. It helps the model to identify document boundaries and build inter-document relationships. + +PacSum (Zheng and Lapata, 2019) is the unsupervised base summarization model. It uses sentence centrality to identify salient sentences. Different from other centrality-based methods, PacSum builds directed graph to explicitly model the order of sentences. Therefore PacSum can benefit from a meta-document where the salient documents are rearranged to the front. When applying it to MDS, we build the graph for the meta-document and calculate the centrality of each sentence accordingly. + +# B Training Details + +We conduct experiments on Multi-News and DUC-2004. Multi-News is the largest multi-document summarization dataset in the news domain. It contains 44,972/5,622/5,622 instances for training/validation/test. Each instance contains a set of news articles and an abstractive summary. The number of articles varies between 2 and 10. For evaluation, we compare the extracted summary to the gold abstractive summary. DUC-2004 contains 50 instances. Each instance has 10 documents and their abstractive summaries. Due to its small size, we use this dataset for out-of-domain evaluation only. We also use CNN DailyMail (CNNDM) to pretrain the base summarization model. It contains around 300K news articles and corresponding summaries from CNN and the Daily Mail. + +We list the training details as follows. The training loss is optimized using Adam (Kingma and Ba, 2015) with a learning rate of $2 \times 10^{-3}$ and 10,000 training steps. We apply the warmup (Goyal et al., 2017) on the first 2,000 steps and the early stopping based on the ROUGE-1 score on the development set. The batch size is set as 6,000 tokens. Our model was trained on a single Quadro RTX 5000 GPU in 2 hours. + +Source 1: these items are among those purchased by gary simpson , prior to taking 9-year-old carlie trent from her school in rogersville , in on may 4th … share this : twitter facebook linkedin google email like this : like loading … + +Source 2: by hayes hickman of the knoxville news sentinel two knoxville banking executives are offering a $ 10,000 reward for information leading to the return of missing 9-year-old carlie marie trent, who was abducted a week ago by her uncle in hawkins county . matt daniels , president and chief executive officer of apex bank , said he and his business partner , 21st mortgage president tim williams , felt compelled to get involved as the search continues ... “this is agonizing , ” Daniels said wednesday . “ it ’ s not a 24-hour amber alert . ” Daniels said carlie reminds him of his two daughters … + +Source 3: it's been a week since carlie trent was in school. on wednesday, tennessee bureau of investigation asked the public to trust them that carlie trent really is in danger . josh devine , a spokesperson for tbi , said he has heard some disturbing rumors on social media that if simpson was trying to protect carlie trent . he told wate he has seen tweets that asked " if simpson didn ' t harm carlie when he had custody , why would he do it now ."" i don ' t think he ’ s trying to protect her . " this was not an innocent camping trip , this was a crime . + +Source 4: the mother of missing tennessee 9-year old carlie trent says she always had a bad feeling about gary simpson, the 57-year-old man who allegedly kidnapped her daughter last week on may 4. simpson, carlie's uncle by marriage who, along with his wife, had once had custody of carlie, picked her up from her rogersville elementary school. simpson and carlie did not return home later that afternoon and the following day an amber alert was issued in tennessee ... + +MatchSum: by hayes hickman of the knoville news sentinel two knoville banking executives are offering a $ 10,000 reward for information leading to the return of missing 9-year-old carlie marie trent , who was abducted a week ago by her uncle in hawkins county . matt daniels , president and chief executive officer of apex bank , said he and his business partner , 21st mortgage president tim williams , felt compelled to get involved as the search continues … “ this is agonizing , ” Daniels said wednesday . “ it ’ s not a 24-hour amber alert . ” Daniels said carlie reminds him of his two daughters … + +PreSumm: by hayes hickman of the knoxville news sentinel two knoxville banking executives are offering a $ 10,000 reward for information leading to the return of missing 9-year-old carlie marie trent , who was abducted a week ago by her uncle in hawkins county . matt daniels , president and chief executive officer of apex bank , said he and his business partner , 21st mortgage president tim williams , felt compelled to get involved as the search continues … mother of allegedly abducted 9-year-old carlie trent ’ always had a bad feeling ’ about suspect . these items are among those purchased by gary simpson , prior to taking 9-year-old carlie trent from her school in rogersville , tn on may 4th … + +Ours: the mother of missing tennessee 9-year old carlie trent says she " always had a bad feeling " about gary simpson , the 57-year-old man who allegedly kidnapped her daughter last week on may 4 , simpson, carlie ’ s uncle … picked her up from her rogersville elementary school . he told wate he has seen tweets that asked " if simpson didn ’ t harm carlie when he had custody , why would he do it now . “it ’ s not a 24-hour amber alert. this was not an innocent camping trip , this was a crime . " i don ’ t think he ’ s trying to protect her ." simpson and carlie did not return home later that afternoon and the following day an amber alert was issued in tennessee … + +Reference: - authorities are combing through more than 1,200 leads in a desperate search for a 9-year-old girl they say was abducted by her uncle may 4 , water reports . according to the knoxville news sentinel , 57-year-old gary simpson picked carlie trent up from her tennessee school … the tbi says there have been rumors online that simpson is trying to protect carlie , but it says that couldn ’ t be further from the truth . this was not an innocent camping trip , this was a crime … shannon trent , who hasn ‘ t had custody of carlie in two years , says she " always had a bad feeling " about simpson … + +Table 5: Sample summaries generated by our method and the baselines. MatchSum and PreSumm receives the documents as the original order, making them focus more on the top two documents. Our method first rearrange the documents as the order of $\{3,4,2,1\}$ and then create the summary. We highlight the contents of the generated summaries which are relevant to the referenced summary. + +# C Human Evaluation Details + +We randomly select 100 test instances to evaluate the performance of each system. The three measures we used are 1) Informativeness: whether or not the summary reflects the salient information of the reference summary; 2) Conciseness: whether or not the summary contains no redundant words or repeated information; and 3) Usefulness: whether or not the summary helps the reader catch the main idea of the news. Human judges were paid at a wage rate of $8 per hour, which is higher than the local minimum wage rate. + +The pairwise scores of those measures are calculated as follows. When comparing a certain base + +line approach to our model, we report the percentage of summaries created by the baseline that were judged to be better/worse/same than those of our model, yielding a score ranging from -1 (unanimously worse) to 1 (unanimously better). For example, when evaluating the informativeness scores, Lead performs better/worse/same than our model for $36\% /56\% /8\%$ of the instances, yielding a pairwise score as $0.36 - 0.56 = -0.20$ + +# D Qualitative Analysis + +Table 5 shows an example with 4 source documents listed in the original order. The main event of this example is about a child abduction case, where + +source 3 and 4 provide more direct and detailed information compared with source 1 and 2. + +We show the summaries generated by MatchSum, PreSumm, and our system, as well as the reference summary. MatchSum and PreSumm receive the documents in the original order, making them focus more on the top two documents. Our method first rearranges the documents as the order of $\{3,4,2,1\}$ and then creates the summary based on the new re-ordered documents. With the help of the document reordering, our summary better captures the main event from the latter source documents (source 3 and source 4). \ No newline at end of file diff --git a/readtopnewsfirstadocumentreorderingapproachformultidocumentnewssummarization/images.zip b/readtopnewsfirstadocumentreorderingapproachformultidocumentnewssummarization/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..bf8e9b9fa5a22ceb8f81112fee62a7a43d72d6c1 --- /dev/null +++ b/readtopnewsfirstadocumentreorderingapproachformultidocumentnewssummarization/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8c56cf781caf66c791abac97746130500ae87e4963cf3722d4d1c597fdc0df9d +size 200415 diff --git a/readtopnewsfirstadocumentreorderingapproachformultidocumentnewssummarization/layout.json b/readtopnewsfirstadocumentreorderingapproachformultidocumentnewssummarization/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..d021a3258a9129ed674273d3ed263f2cab7fbcb6 --- /dev/null +++ b/readtopnewsfirstadocumentreorderingapproachformultidocumentnewssummarization/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5c5e9a7e22f17e0c4f2115ef916b05d62e82cf03c78f15d2f98ea6be5ca12ab8 +size 280285 diff --git a/reframinginstructionalpromptstogptkslanguage/91236364-c8df-4e77-8224-f60559416705_content_list.json b/reframinginstructionalpromptstogptkslanguage/91236364-c8df-4e77-8224-f60559416705_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..900ca0bd4da48359b3d78a5455b5defde997df47 --- /dev/null +++ b/reframinginstructionalpromptstogptkslanguage/91236364-c8df-4e77-8224-f60559416705_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7e8cd9e546aa1b25df58e964258dda95b661ace78cba9bbff8aea83fcbf0c744 +size 162592 diff --git a/reframinginstructionalpromptstogptkslanguage/91236364-c8df-4e77-8224-f60559416705_model.json b/reframinginstructionalpromptstogptkslanguage/91236364-c8df-4e77-8224-f60559416705_model.json new file mode 100644 index 0000000000000000000000000000000000000000..1234a1410a044d10f5b965ab90fc6972315e9dd8 --- /dev/null +++ b/reframinginstructionalpromptstogptkslanguage/91236364-c8df-4e77-8224-f60559416705_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:145ad431755767862176d5205192f5bd35b1cc2407a58f61e41dd37b806f1602 +size 185810 diff --git a/reframinginstructionalpromptstogptkslanguage/91236364-c8df-4e77-8224-f60559416705_origin.pdf b/reframinginstructionalpromptstogptkslanguage/91236364-c8df-4e77-8224-f60559416705_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..13e01279efbd294c7dc115f8223f7010e456050a --- /dev/null +++ b/reframinginstructionalpromptstogptkslanguage/91236364-c8df-4e77-8224-f60559416705_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ec2c9677a16881f44f1f052b308ead2b95572c235bc474d13c2c6cc703f02489 +size 804262 diff --git a/reframinginstructionalpromptstogptkslanguage/full.md b/reframinginstructionalpromptstogptkslanguage/full.md new file mode 100644 index 0000000000000000000000000000000000000000..e17e6990986e951e2f70a1d50ec9259b184d30c4 --- /dev/null +++ b/reframinginstructionalpromptstogptkslanguage/full.md @@ -0,0 +1,751 @@ +# Reframing Instructional Prompts to GPTk's Language + +Swaroop Mishra3 Daniel Khashabi1 Chitta Baral3 Yejin Choi1,2 Hannaneh Hajishirzi1,2 + +$^{1}$ Allen Institute for AI $^{2}$ University of Washington $^{3}$ Arizona State University + +# Abstract + +What kinds of instructional prompts are easier to follow for Language Models (LMs)? We study this question by conducting extensive empirical analysis that shed light on important features of successful instructional prompts. Specifically, we study several classes of reframing techniques for manual reformulation of prompts into more effective ones. Some examples include decomposing a complex task instruction into multiple simpler tasks or itemizing instructions into sequential steps. Our experiments compare the zero-shot and few-shot performance of LMs prompted with reframed instructions on 12 NLP tasks across 6 categories. Compared with original instructions, our reframed instructions lead to significant improvements across LMs with different sizes. For example, the same reframed prompts boost few-shot performance of GPT3-series and GPT2-series by $12.5\%$ and $6.7\%$ respectively averaged over all tasks. Furthermore, reframed instructions reduce the number of examples required to prompt LMs in the few-shot setting. We hope these empirically-driven techniques will pave the way towards more effective future prompting algorithms. + +# 1 Introduction + +Prompting language models (LMs) (Liu et al., 2021a) has made NLP modules accessible to non-expert users through plain text instructions1 of NLP tasks. Such task instructions written by non-expert users are often long and contain abstract descriptions which are not easy to follow for LMs, as evident by their low performance (Efrat and Levy, 2020; Mishra et al., 2022). However, it is not quite clear whether this is due to the inherent difficulty of the target tasks or an artifact of the complex phrasing of their language instructions. + +1We focus on instructional prompts (Efrat and Levy, 2020) as opposed to exemplar prompts which are already well-studied (Brown et al., 2020; Lu et al., 2021). + +![](images/b2920ac38b1987258d6892a64c5fda5e54e332ea55756b4b61fea77813ab694e.jpg) +Figure 1: GPT3 has difficulty in writing questions that require entity coreference resolutions based on a single lengthy prompt (top, in yellow), however, it succeeds in solving a manually reframed task that has four simpler sub-steps (bottom, in green). + +In this analysis, we aim to understand the sensitivity of LMs to the framing of instructional prompts. In particular, we study several reframing techniques to frame instructional prompts differently so that LMs achieve better understanding of the task. These reframing techniques are motivated by various empirical intuitions such as ease of understanding concise and concrete instructions and those that contain little abstract statements about human commonsense or their background knowledge. For example, Fig.1 shows a reframing example which involves decomposing a task into multiple sub-tasks. The intended task here is writing questions that require entity coreference (Dasigi et al., 2019). While GPT3 fails in solving the original task instruction (the yellow box at the top), it succeeds when the task is decomposed to four simpler and easier sub-tasks. + +We provide analysis for five diverse reframing techniques. These include incorporating low-level + +![](images/295a868ed6e93025e261a80610a42490ef542b861bb974449cad3ee7d316fce2.jpg) +Figure 2: Across a variety of model sizes, reframed prompts consistently show considerable performance gain over raw task instructions (no reframing) in a few-shot learning setup. Since fine-tuning GPT3 is prohibitively expensive, we show the performance of fine-tuning smaller models (horizontal lines). This results indicates that evaluating reframed prompts on a large model like GPT3-instruct (red line) might be more effective than fine-tuning a smaller model like GPT2Large (green line) with $200 \times$ more data. Details of the experiments in §4. + +patterns about the target task, decomposing and itemizing instructions, stating the task constraints, and providing specialized instructions (examples in Table 1). + +We analyze reframed instructions over 12 tasks from NATURAL INSTRUCTIONS (Mishra et al., 2022), which contains a variety of NLP tasks and their instructions. Empirically, we compare the quality of LMs (GPT2/3 Radford et al. 2019; Brown et al. 2020) in two settings: raw vs reframed instructions. In particular, we observe that the reframed prompts have notable performance gains over raw instructions (the gap between the red and blue trends in Fig.2) with an average of $14\%$ and $17\%$ gains when using GPT3-instruct in the few-shot and zero-shot setups, respectively. Furthermore, the average gains across tasks remain consistent across different models hinting at consistency of reframed prompts on various architectures. This is in contrast to the widely-used fine-tuning approaches which need to be performed separately for each model. Reframing prompts by model designers can be particularly effective when evaluated on large LMs, where fine-tuning can be prohibitively expensive (such as GPT3). In particular, we observe that, reframed prompts on GPT3-instruct score roughly $17\%$ higher than GPT2Large that is supervised with $1k$ instances (i.e., $200\times$ more data). + +While reframing instructions are not algorithmic, nonetheless, we view this systemic analysis as a preliminary stepping stone in this direction. We hope that this study will lead to the development of algorithmic better few-shot learning methods that generalize across models, thereby leading to more effective ways of reaping the investments already poured into creating massive LMs. + +Contributions: (a) This work is inspired by the sensitivity of LMs to the framing of their instructional prompts. Driven by many empirical analysis, we identify several guidelines for model designers to reframe instructional prompts and provide illustrative use cases associated with each type of reframing technique. (b) Extensive experiments on diverse tasks show that reframing gives rise to superior performance and improved sample complexity over raw task instructions, across a range of models sizes. (c) Our experiments quantify the contribution of the prompting techniques and analyze various parameters that contribute to their success. + +# 2 Related Work + +Our work is related to designing discrete prompts and tuning continuous prompts in recent literature. + +Discrete Prompts Constructing effective discrete prompts for language models to perform NLP tasks is an active area of research (Schick and Schütze, 2021; Le Scao and Rush, 2021; Tam et al., 2021; Logan IV et al., 2021; Reynolds and McDonell, 2021). Most such works focus on light-weight changes to the original prompt (Liu et al., 2021a). Unlike the earlier literature, we focus on framings of complex instructions, which often lead to reframed prompts that are often very different from the original raw instructions. While our proposed prompt-reframing is not quite algorithmic, the principles behind them are relatively simple, which can hopefully motivate algorithmic solutions in future. + +Our goal is fundamentally different from the meta-training with instructions (Mishra et al., 2022; Sanh et al., 2022; Wei et al., 2022). Such approaches depend on labeled data (language prompts for thousands of tasks) which can be costly to collect. Additionally, they require fine-tuning models which can be costly for larger LMs. Exploring effective framings of language instructions can provide alternative ways of utilizing LMs. + +Continuous Prompts Tuning continuous prompts leads to the making of space-efficient models compared to fine-tuning model parameters (Liu et al., + +2021b; Lester et al., 2021). Despite being algorithmic, these models require propagating gradient information across the whole architecture, leading to high computational costs, which is a key bottleneck when it comes to large LMs such as GPT3. While our proposal requires human intervention, it provides model designers with several relatively easy rules-of-thumb to come up with language prompts that work effectively with large LMs. + +# 3 Prompt Reframing + +This section describes our reframing principles and then describes the guidelines to operationalize them. Reframing principles are obtained by probing instructions of various tasks in the training split of NATURAL INSTRUCTIONS (Mishra et al., 2022) to understand different failure modes associated with prompting in GPT3. + +Motivation from GPT3's Failures We observe that GPT3 fails to follow instructions when it is provided with long prompts that often contain repeated information, abstract notions, analogies, complex statements requiring human commonsense and their domain knowledge (see examples in Table 1 and 4). Humans typically find these helpful for describing their tasks. For example, some content intended to motivate the task or repetition for the sake of emphasis, might be unnecessary or even redundant for a model. + +# 3.1 Reframing Principles + +We observe that short prompts that contain concrete statements and avoid terms associated with background knowledge improve GPT3's response to instructions. We recursively apply this observation and provide a set of reframing principles to resolve various issues on GPT3's failures with prompting, backed by extensive empirical analysis on GPT3. $^2$ + +$(C_1)$ Use Low-level Patterns: Instead of using terms that require background knowledge to understand, use various patterns about the expected output. +$(C_2)$ Itemizing Instructions: Turn descriptive attributes into bulleted lists. If there are any negation statements, turn them into assertion statements. +$(C_3)$ Break it Down: Break down a task into multiple simpler tasks, wherever possible. + +$(C_4)$ Enforce Constraint: Add explicit textual statements of output constraints. +$(C_5)$ Specialize the Instruction: Customize the instructions so that they directly speak to the intended output. + +We operationalize each of the above principles in terms of 5 reframing techniques. The degree of reframing (the amount of change applied to the raw instructions) varies significantly across the reframing techniques: the simplest one adds an enforcement statement at the end whereas the other extreme involves completely changing the task as a whole (e.g., decomposing it into multiple tasks). + +# 3.2 Reframing Techniques + +We explain each of the reframing techniques in three parts (1) model failure states a potential weakness of LM with reference to examples in Table 4 (2) approach describes our suggested approach and intuition behind it, according to our empirical observations (3) example illustrates the application of the suggested technique in reference to Table 1. In designing these techniques, we used a development set that contains all the positive examples included as part of the instructions of each task in NATURAL INSTRUCTIONS. + +# 3.2.1 PATTERN REFRAMING + +Model failure While humans have an incredible ability in understanding and acting with respect to abstract descriptions, LMs tend to ignore most of them or just repeat the content of such instructions in their output (copy instruction in Table 4.) + +Approach Find low-level patterns among the dev set examples and extrapolate those by adding similar patterns $(C_1)$ . + +Example Table 1 (row 1) illustrates the CosmosQA (Huang et al., 2019) question generation task. The raw task instruction consists of various high-level statements such as "commonsense", "complex", "interesting", "easy for humans and hard for AI machines", whereas the reframed task consists of various low-level patterns about the expected output such as "what may happen", "in the future, will.", "why might", which generally improve GPT3's performance in generating valid questions. + +# 3.2.2 ITEMIZING REFRAMING + +Model failure LMs cannot follow long paragraphs stating multiple requirements (first instruction bias in Table 4) and do not perform well when the requirements are formulated as a negative statement + +
Raw task definitions and their reframed counterpart
PATTERN REFRAMINGRaw Task: Craft a question which requires commonsense to be answered. Based on the given context, craft a common-sense question, especially those that are LONG, INTERESTING, and COMPLEX. The goal is to write questions that are easy for humans and hard for AI machines! To create such questions, here are some suggestions: A. What may (or may not) be the plausible reason for an event? B. What may (or may not) happen before (or after, or during) an event? C. What may (or may not) be a plausible fact about someone (or something)? D. What may (or may not) happen if an event happens (or did not happen)? You can also create other types of questions.Input: Context: Expected Output: Question:
Reframed Task: Use 'what may happen', 'will ...?', 'why might', 'what may have caused', 'what may be true about', 'what is probably true about', 'what must' and similar phrases in your question based on the input context.Input: Context: Expected Output: Question:
ITEMIZING REFRAMINGRaw Task: Follow the instructions to produce output with the given context word. Do <>. Do <>. Don't <>Input: Context word <> Expected Output: Long text <>
Reframed Task: Follow instructions below to produce output based on the given context word.-Do <>-Do <>-Do <>Input: Context word <> Expected Output: Long text <>
DECOMPOSITION REFRAMINGRaw Task: In this task, based on the given context word, you need to create a pair of sentences each containing a blank (.) and their corresponding answer. The sentence pair should look similar, and should be about two related but different objects; for example "trophy" and "suitcase". Also, the sentences must be different in terms of trigger words (e.g., "small" and "big") which express contrasting properties about the two objects.Input: Context word: Expected Output: Question 1: <> Answer 1: <> Question 2: <> Answer 2: <>
Reframed Task:Subtask 1. Write 2 objects based on the given context word.Input: Context word: Expected Output: Objects:
Subtask 2. Write a sentence by connecting objects with a verb.Input: Objects: Expected Output: Sentence:
Subtask 3. Create a fill in the blank question from the sentence where object 1 will fit the blank.Input: Object 1: Expected Output: Sentence:
Subtask 4. Change the given question so that answer flips to object 2 in the question.Input: Object 2: Expected Output: Question:
Subtask 5. Generate both questions and answers:Input: Question 1: <> Object 1: <> Question 2: <> Object 2: <>Expected Output: Question 1: <> Answer 1: <> Question 2: <> Answer 2: <>
RESTRAINT REFRAMINGRaw Task:... What is the type of the answer corresponding to the given question? Number, Date, or Span?...Input: Passage: Expected Output: <Number/Date/Span>...
Reframed Task:... What is the type of the answer corresponding to the given question? Number, Date, or Span?...Input: Passage: <> Question: <> Answer either Number, Date or Span? Expected Out-put:Number/Date/Span>
SPECIALIZATION REFRAMINGRaw Task: Answer the following question ... <Not so important Text> ...Input: Question <> Expected Output: Answer <>
Reframed Task: Calculate answer to the following question. You need to either add or subtract numbers associated with two objects present in the question.Input: Question <> Expected Output: Answer <>
+ +Table 1: Examples of various reframing techniques. Italicized text represents the prompt. Change in prompt and example in the transformed task are indicated with blue and red markings, respectively. + +(negation challenge in Table 4). + +Approach Turn long descriptions into bulleted lists of several statements $(C_2)$ . Additionally, turn negative statements to positive ones. For example, reformulate "don't create questions which are not answerable from the paragraph" into "create questions which are answerable from the paragraph". + +Example Table 1 (row 2) illustrates the Wino-Grande (Sakaguchi et al., 2020) sample generation task where the raw instructions contain several requisites (do's and don'ts) that are hard for models to follow. Reframing the instructions into a structured list improves the model response. + +# 3.2.3 DECOMPOSITION REFRAMING + +Model failure Tasks with implicit multi-step reasoning are challenging for models, even after itemizing reframing (3.2.2) (multi-step task challenge in Table 4). + +Approach Wherever possible, decompose a task into multiple different sub-tasks which can be executed either sequentially or in parallel $(C_3)$ and hence, make them relatively easier for models. + +Example In Table 1 (row 3), the task is to generate samples for the Winogrande (Sakaguchi et al., 2020) dataset. Decomposition of the task into 5 sequential steps improves GPT3's response. + +# 3.2.4 RESTRAINING REFRAMING + +Model failure A common mistake of GPT3 occurs when the task definition deviates from its pre-trained objective (predicting next words) (conventional-task bias in Table 4). For example, when predicting question types GPT3 often answers the question instead of generating its type. Similarly, in reading comprehension tasks, GPT3 sometimes answers a question based on its background knowledge instead of answering from the given passage. + +Approach Append a statement to the task instruction that expresses a constraint about the output generation $(C_4)$ . + +Example Table 1 (row 4) illustrates the DROP (Dua et al., 2019) answer type generation task where the objective is to generate a valid answer type among "Number", "Date" and "Span" for a given question. Adding an enforcement statement tends to improve the model output by constraining it to the provided types. + +# 3.2.5 SPECIALIZATION REFRAMING + +Model failure LMs ignore generic instructions such as "answer the following question" and sometimes misconceive the output format when the given instruction contains redundant text (miscon- ceive output format in Table 4). + +Approach Reformulate the instructions so that they directly describe the low-level task needed to be done and drop all the repeated and generic statements $(C_5)$ . + +Example Table 1 (row 5) illustrates a task of numerical reasoning problems that involve natural language sentences describing additions and subtractions. The reframed prompt specializes the generic task instruction ("calculate answer"). + +# 4 Experimental Setup + +Dataset We evaluate the proposed reframing techniques on the evaluation tasks from NATURAL INSTRUCTIONS (Mishra et al., 2022), which consists of 12 tasks categorized into 6 categories. Following the original setup, we use ROUGE-L (Lin, 2004) as the evaluation metric in our experiments. Table 2 contains the list of evaluation task used in this study. + +
tasksourcecategory
generating questions on event durationMC-TACO (Zhou et al., 2019)Question Generation (QG)
generating questions on sentence compositionQASC (Khot et al., 2020)
answering event coreference questionsQuoref (Dasigi et al., 2019)Question Answering (QA)
answering fill in the blank questions on coreference resolutionWinoGrande (Sakaguchi et al., 2020)
identifying inappropriate content in contextCosmosQA (Huang et al., 2019)Classification (CF)
identifying bad questions in reading comprehensionMultiRC (Khashabi et al., 2018)
generating incorrect answers to event transience questionsMC-TACO (Zhou et al., 2019)Incorrect Answer Generation (IAG)
generating incorrect answers to event duration questionsMC-TACO (Zhou et al., 2019)
modifying fill in the blank questions on coreference resolutionWinoGrande (Sakaguchi et al., 2020)Text Modification (MM)
generating paraphrase of given sentencesMiscellaneous
finding overlapping words between two sentencesQASC (Khot et al., 2020)Verification (VF)
Identifying words essential for choosing correct answers.Essential-Terms (Khashabi et al., 2017)
+ +Table 2: List of evaluation tasks used in this study (§4). + +Models For evaluation we use various models of the GPT family: GPT2, GPT2Large, GPT2XL, GPT3 and GPT3-instruct (Brown et al., 2020; Radford et al., 2019) $^{3}$ and BART-base (Lewis et al., 2020). We evaluate the models according to the following setups: + +GPTk w/ raw instructions: We follow the setup of Mishra et al. (2022) who experiment with GPT3-instruct on their raw instructions. Overall the prompts provided to the model consist of three segments (in this order): (a) task instructions, (b) examples (input and outputs) and (c) a new input for which we expect model's response. We experiment with three different variants of the baselines, depending on the number of examples in their prompts: (i) Few-SHOT: We experiment with 5 examples4 which is a more realistic few-shot setup. (ii) MAX.EX.: in another variant we use as many examples as fits within GPT's token limit. (iii) ZERO-SHOT: in this setup, we do not incorporate any example while prompting the models with the instructions. Finally, we build variants of these baselines by conducting 'schema selection' where we experiment with 12 different encodings of the instruction (Mishra et al., 2022) and select the best performing one for each task. + +GPTk w/ reframed instructions: The model designer applies various reframing techniques (Section 3.2) on tasks in NATURAL INSTRUCTIONS. Similar to the raw instructions baseline, we use 5 examples in our reframed tasks. In our setup, model designer is an author who follows the guidelines (§3.2) by observing 5 examples in the development set and reframes instructions. This process was done in interaction with GPT3-instruct via the development examples. This took roughly 15 minutes per task and per reframing type. Similar to the setup with raw instructions, the ultimate encoded prompts contained a concatenation of the following (in this order): reframed instructions, positive examples and the instance input. + +GPTk w/ calibration: This method extends the recent calibration approach introduced by Zhao et al. (2021), which involves compensating for various model-specific biases in a few-shot setup, such as recency bias and majority bias. Zhao et al. (2021) perform calibration by masking input instances with 'N/A' tokens, estimating the bias using model + +prediction probabilities and then compensating the bias while feeding the input instance during prediction. We extend calibration to our instruction setup by masking the input instance in our instruction encoding with an 'N/A' token and calibrating biases associated with GPT3-instruct. + +Supervised baseline: While the conventional setup of supervised learning has been successful for reasonably sized models, it is prohibitively expensive for large models like GPT3. We train medium-sized LMs (e.g., BART-base Lewis et al., 2020) on $5k$ examples of each task and evaluate on unseen instances of the corresponding task. + +# 5 Empirical Results + +# 5.1 Main Results + +A summary of our experiments5 is provided in Fig.2 which shows the performance of the reframed instructions on various models, compared to our baselines. Furthermore, Table 3 provides a more granular comparison of few-shot, zero-shot and supervised models per task category, all on GPT3-instruct and in terms of ROUGE-L. Below are several takeaways from these experiments. + +Reframing improves upon the few-shot and zero-shot baselines. Table 3 shows that reframing outperforms the original raw instruction baseline with $14\%$ $(44\% \rightarrow 58\%)$ and $17\%$ absolute gains $(33\% \rightarrow 50\%)$ in few-shot and zero-shot setups, respectively. Additionally, it outperforms the schema selection baseline with $11\%$ $(47\% \rightarrow 58\%)$ and $13\%$ absolute gains $(37\% \rightarrow 50\%)$ in few-shot and zero-shot setups, respectively. It also outperforms the calibration and max-examples with schema selection baseline by $12\%$ $(46\% \rightarrow 58\%)$ and $8\%$ $(50\% \rightarrow 58\%)$ , respectively. The gains are spread across task categories, with the highest gains in Answer Generation (AG), Classification (CF), and Verification (VF) categories. + +Reframed prompts retain their superiority across different models. As Fig.2 shows, the reframed instructions consistently outperform raw task instructions across various models. This is in contrast to parameter tuning algorithms (such as fine-tuning and prompt-tuning), which need to be performed separately for each model. + +Reframing instructions with a large LM is comparable to a mid-sized supervised model. The + +
supervision modemodeltask category → # of examples ↓QGAGCFIAGMMVFAvg
SUPERVISEDBART500059619126858267
FEW-SHOT (MAX. EX.)GPT3-instruct (raw instructions + schema selection)3247575223794250
FEW-SHOTGPT3-instruct (raw instructions)543544421703244
GPT3-instruct (calibrated raw instructions)541↓52↓58↑22↑7035↑46↑
GPT3-instruct (raw instructions + schema selection)545↑58↑49↑23↑72↑37↑47↑
GPT3-instruct (reframed instructions)555↑72↑65↑30↑80↑48↑58↑
ZERO-SHOTGPT3-instruct (raw instructions)031343914691333
GPT3-instruct (raw instructions + schema selection)037↑36↑40↑17↑75↑17↑37↑
GPT3-instruct (reframed instructions)052↑46↑63↑25↑80↑39↑50↑
+ +Table 3: Evaluation of various few-shot and supervised learning baselines in ROUGE-L. Category names: QG: Question Generation, AG: Answer Generation, CF: Classification, IAG: Incorrect Answer Generation, MM: Minimal Text Modification, VF: Verification. The reframed prompts improve GPT3-instruct's performance. Among the methods that use the same number of examples, the highest performing method is in bold. In the few-shot (max. ex.) setup, we use as many examples as fits within GPT's token limit. Up-arrows $(\uparrow)$ and down-arrows $(\downarrow)$ signify performance improvement and decline, respectively, over the raw instructions baseline. + +![](images/44db298b778134fbe1c68acfd870c08c37c570d641c6a3f9d65a7eb42b0d5d67.jpg) +Figure 3: Average performance gain (numbers on the left side) of reframing instructions (over raw instructions), when evaluated via GPT3-instruct in a few-shot learning setup. The plot shows the gains resulting from applying each reframing type (left) to various task categories (right). While SPECIALIZATION reframing is versatile, others like DECOMPOSITION improve model performance for a narrower range of tasks. + +average performance associated with supervised baselines is higher than the reframing method. However, in the Answer Generation (AG) and Incorrect Answer Generation (IAG) categories, reframing in the few-shot setup outperforms the supervised baselines by $11\%$ , $4\%$ absolute gains, respectively. A similar observation can be made in Fig.2, where reframed prompts with GPT3-instruct have notably higher performance than the supervised mid-size model (GPT2Large), which uses $200\times$ more data. + +# 5.2 Analyses + +Contribution of Reframing Techniques Fig.3 illustrates the average performance gain associated + +![](images/3d3f3d3488a78e3846a8f3a9367e057dee9add0108d2b373805512c6b47ee09f.jpg) +Figure 4: $x$ -axis: length reduction in instruction length as a result of reframing; $y$ -axis: performance gain (ROUGE-L) after applying reframing and evaluating via GPT3-instruct in a few-shot learning setup. Each dot represents a task in our evaluation set. The scatter plot show that least length reductions are not necessarily worse. + +with each of the reframing techniques across various categories of tasks. We apply various reframing techniques on each task of NATURAL INSTRUCTIONS. We observe that SPECIALIZATION REFRAMING, RESTRAINING REFRAMING and PATTERN REFRAMING improve model performance for a wider range of tasks. We also observe that, RESTRAINING REFRAMING contributes the most to Classification tasks whereas SPECIALIZATION REFRAMING is dominant on Answer Generation tasks. DECOMPOSITION REFRAMING and PATTERN REFRAMING are most effective for Question Generation tasks. Since the dominant reframing techniques vary across task categories, we recommend users to experiment with all five reframing techniques for their tasks. + +Performance vs Instructions Length We observe that reframed instructions are usually shorter than the original instructions. A natural question + +
error nameerror description#(%)reframing
copy instructiongenerates some of the lines in the given instruction if it contain domain-specific terms14PATTERN REFRAMING, SPECIALIZATION REFRAMING
instance distractionignores the instructions if input instances contain some specific information e.g. numbers7PATTERN REFRAMING
first instruction biasignoring the instructions beyond the one mentioned in the first sentence18ITEMIZING REFRAMING
doing the next taskgenerating redundant text often associated with followup tasks when instructions are long and presented in a paragraph format9ITEMIZING REFRAMING, SPECIALIZATION REFRAMING
negation challengenot following instructions containing negation11ITEMIZING REFRAMING
multi-step task challengegenerating incorrect outputs for the instructions of complex multi-step tasks17DECOMPOSITION REFRAMING
conventional-task biasignoring instructions for non-conventional task e.g. incorrect answer generation and generating outputs associated with conventional tasks12RESTRAINING REFRAMING
misconceive output formatnot understanding intended output format without explicit mention in the instructions12SPECIALIZATION REFRAMING, RESTRAINING REFRAMING
+ +Table 4: Distribution of error patterns associated with raw instructions that get resolved by reframing. It also shows the type of reframing technique that resolves the errors. + +![](images/583811ba40e13afa0d965d4960b5bc0a1d7d3556bed5d6cf31b79da4c92b459f.jpg) +Figure 5: Distribution of the error patterns. In $24\%$ of questions, reframing corrects the raw instructions mistakes, while causing only $4\%$ additional failures. + +that might arise is whether there is a correlation between the length reduction and the performance improvement, as a result of applying reframing. Fig.4 shows that performance gain is not always proportional to the length difference across various evaluation tasks (dots in the figure) in NATURAL INSTRUCTIONS. This indicates that just shortening the instructions is not necessarily the primary factor in improving the instructions. + +Qualitative Analysis We analyze failure of GPT3 on raw vs. reframed instructions. We samples 100 examples across various tasks for the analysis. Fig.5 illustrates the distribution of errors. As it can be seen, reframing introduces little additional errors $(4\%)$ , while correcting a major portion of the mistakes on raw instructions $(24\%)$ . We further manually analyze this subset (mistakes of raw instruction corrected by reframing) to better understand the dominant errors patterns and the refram + +ing that corrects them (Table 4). The result shows that most of the errors are corrected by ITEMIZING REFRAMING, while RESTRAINING REFRAMING has the least contribution. + +# 6 Concluding Remarks + +Inspired by GPT3's poor performance in following task instructions, we study reframing them. We introduce five approaches that reformulate task instructions to make them easier, while maintaining their human readability. Manually applying reframing on 12 tasks, we study their benefits compared to using raw instructions or fine-tuning mid-sized models. Reframing can be particularly helpful in applications where task definitions are evolving (making it difficult to crowdsourced and fine-tune models), where model designers can come up with new reframed prompts, in a matter of minutes. + +We hope that this study will inspire further investigation of potentially-unconventional approaches to exploit the knowledge harnessed by increasingly large LMs where fine-tuning and its alternatives are prohibitively expensive. + +# Acknowledgements + +We thank OpenAI for providing academic access to the GPT3 API, the Beaker team for their support with experiments and the anonymous reviewers for their helpful feedback. The support of DARPA SAIL-ON, DARPA CHESS program, NSF IIS-2044660, ONR N00014-18-1-2826, and Paul G. Allen Foundation is gratefully acknowledged. + +# References + +Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler, Jeffrey Wu, Clemens Winter, Chris Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. 2020. Language models are few-shot learners. In NeurIPS. +Pradeep Dasigi, Nelson F Liu, Ana Marasovic, Noah A Smith, and Matt Gardner. 2019. Quoref: A reading comprehension dataset with questions requiring coreferential reasoning. In Proceedings of EMNLP. +Dheeru Dua, Yizhong Wang, Pradeep Dasigi, Gabriel Stanovsky, Sameer Singh, and Matt Gardner. 2019. Drop: A reading comprehension benchmark requiring discrete reasoning over paragraphs. In Proceedings of NAACL. +Avia Efrat and Omer Levy. 2020. The turking test: Can language models understand instructions? arXiv preprint arXiv:2010.11982. +Lifu Huang, Ronan Le Bras, Chandra Bhagavatula, and Yejin Choi. 2019. Cosmos qa: Machine reading comprehension with contextual commonsense reasoning. In Proceedings of EMNLP. +Daniel Khashabi, Snigdha Chaturvedi, Michael Roth, Shyam Upadhyay, and Dan Roth. 2018. Looking beyond the surface: A challenge set for reading comprehension over multiple sentences. In Proceedings of NAACL. +Daniel Khashabi, Tushar Khot, Ashish Sabharwal, and Dan Roth. 2017. Learning what is essential in questions. In Proceedings of CoNLL). +Tushar Khot, Peter Clark, Michal Guerquin, Peter Jansen, and Ashish Sabharwal. 2020. Qasc: A dataset for question answering via sentence composition. In Proceedings of AAAI. +Tven Le Scao and Alexander M Rush. 2021. How many data points is a prompt worth? In Proceedings of NAACL, pages 2627-2636. +Brian Lester, Rami Al-Rfou, and Noah Constant. 2021. The power of scale for parameter-efficient prompt tuning. In Proceedings of EMNLP. +Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. 2020. Bart: Denoising sequence-to-sequence pretraining for natural language generation, translation, and comprehension. In Proceedings of ACL. + +Chin-Yew Lin. 2004. Rouge: A package for automatic evaluation of summaries. In Text summarization branches out. +Pengfei Liu, Weizhe Yuan, Jinlan Fu, Zhengbao Jiang, Hiroaki Hayashi, and Graham Neubig. 2021a. Pretrain, prompt, and predict: A systematic survey of prompting methods in natural language processing. arXiv preprint arXiv:2107.13586. +Xiao Liu, Yanan Zheng, Zhengxiao Du, Ming Ding, Yujie Qian, Zhilin Yang, and Jie Tang. 2021b. Gpt understands, too. arXiv preprint arXiv:2103.10385. +Robert L Logan IV, Ivana Balažević, Eric Wallace, Fabio Petroni, Sameer Singh, and Sebastian Riedel. 2021. Cutting down on prompts and parameters: Simple few-shot learning with language models. arXiv preprint arXiv:2106.13353. +Yao Lu, Max Bartolo, Alastair Moore, Sebastian Riedel, and Pontus Stenetorp. 2021. Fantastically ordered prompts and where to find them: Overcoming few-shot prompt order sensitivity. arXiv preprint arXiv:2104.08786. +Swaroop Mishra, Daniel Khashabi, Chitta Baral, and Hannaneh Hajishirzi. 2022. Cross-task generalization via natural language crowdsourcing instructions. In Proceedings of ACL. +Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. 2019. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9. +Laria Reynolds and Kyle McDonell. 2021. Prompt programming for large language models: Beyond the few-shot paradigm. In *Extended Abstracts of CHI*. +Keisuke Sakaguchi, Ronan Le Bras, Chandra Bhagavatula, and Yejin Choi. 2020. Winogrande: An adversarial winograd schema challenge at scale. In Proceedings of AAAI. +Victor Sanh, Albert Webson, Colin Raffel, Stephen Bach, Lintang Sutawika, Zaid Alyafeai, Antoine Chaffin, Arnaud Stiegler, Arun Raja, Manan Dey, M Saiful Bari, Canwen Xu, Urmish Thakker, Shanya Sharma Sharma, Eliza Szczechla, Taewoon Kim, Gunjan Chhablani, Nihal Nayak, Debajyoti Datta, Jonathan Chang, Mike Tian-Jian Jiang, Han Wang, Matteo Manica, Sheng Shen, Zheng Xin Yong, Harshit Pandey, Rachel Bawden, Thomas Wang, Trishala Neeraj, Jos Rozen, Abheesht Sharma, Andrea Santilli, Thibault Fevry, Jason Alan Fries, Ryan Teehan, Teven Le Scao, Stella Biderman, Leo Gao, Thomas Wolf, and Alexander M Rush. 2022. Multitask prompted training enables zero-shot task generalization. In Proceedings of ICLR. +Timo Schick and Hinrich Schütze. 2021. Few-shot text generation with natural language instructions. In Proceedings of EMNLP. + +Derek Tam, Rakesh R Menon, Mohit Bansal, Shashank Srivastava, and Colin Raffel. 2021. Improving and simplifying pattern exploiting training. In Proceedings of EMNLP. +Jason Wei, Maarten Bosma, Vincent Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew M. Dai, and Quoc V Le. 2022. Finetuned language models are zero-shot learners. In Proceedings of ICLR. +Tony Z Zhao, Eric Wallace, Shi Feng, Dan Klein, and Sameer Singh. 2021. Calibrate before use: Improving few-shot performance of language models. In Proceedings of ICML. +Ben Zhou, Daniel Khashabi, Qiang Ning, and Dan Roth. 2019. "going on a vacation" takes longer than "going for a walk": A study of temporal commonsense understanding. In Proceedings of EMNLP. + +# A Supplemental Material + +# A.1 Examples of Error Types + +Table 5 contains examples of error patterns where model performance improves with reframing over raw instructions. Table 5 exemplifies each type of error mentioned in Table 4. + +
Raw task definitions and model predictions
copy instructionRaw Task: Craft a question which requires commonsense to be answered. Based on the given context, craft a common-sense question, especially those that are LONG, INTERESTING, and COMPLEX. The goal is to write questions that are easy for humans and hard for AI machines! To create such questions, here are some suggestions: A. What may (or may not) be the plausible reason for an event? B. What may (or may not) happen before (or after, or during) an event? C. What may (or may not) be a plausible fact about someone (or something)? D. What may (or may not) happen if an event happens (or did not happen)? You can also create other types of questions. +Context: you see , at my age relationship is kind of important and i thought i got the one after all these years . I noticed that once again i was wrong . i was good simply because i was good , i was caring , helping , supportive , bla bla blaaa . +Question: what is the reason why you keep falling for the same type of person? +A. What is the reason you keep falling for the same type of person? +B. What may (or may not) be the problem with your relationships? +C. What may (or may not) be the possible cause
instance distractionRaw Task: In this task, we ask you to write a question that involves "event duration", based on a given sentence. Here, event duration is defined as the understanding of how long events typically last. For example, "brushing teeth", usually takes few minutes. +Sentence: About 30% of Ratners's profit already is derived from the U.S. +Question: How much of Ratner's profit comes from the U.S.?
first instruction biasRaw Task: Write a story about John. Also, mention Hari. +Story: +John was a very happy person. He always had a smile on his face and was always willing to help others. He was a very kind person. +He was always there for his friends and family.
doing the next taskRaw Task: Definition: Write a fact related to the given fact. Note that, your fact should have at least one word in common with the given fact. All facts in this task refer to science facts. Your related fact must form a chain with the given fact. Chains form when two facts connect together to produce a third fact. An example of a chain is: "pesticides cause pollution" (given fact) + "pollution can harm animals" (related fact) → "pesticides can harm animals" (connected chain) <truncated instructions> +Prompt: Write a related fact to a given fact +Fact: damming a river can cause a lake to form. +Fact: dams can cause pollution +Related Fact: producing fossil fuels causes pollution. +Related Fact: making fossil fuels causes pollution. +Fact: lakes can be polluted. +Fact: lakes can be polluted by dams. <truncated output>
negation challengeRaw Task: Write a sentence. It should start with 'What'. It should not have more than 4 words. It should mention "Patrick". +Sentence: What is Patrick's favorite color?
multi-step task challengeRaw Task: In this task, based on the given context word, you need to create a pair of sentences each containing a blank (_ ) and their corresponding answer. The sentence pair should look similar, and should be about two related but different objects; for example "trophy" and "suitcase". Also, the sentences must be different in terms of trigger words (e.g., "small" and "big") which express contrasting properties about the two objects. Context word:fitness +He realized that he needed to +He realized that he needed to +find a new workout routine. +find a new workout routine. +I couldn't believe how +I couldn't believe how <truncated output>
conventional task biasRaw Task: Generate an incorrect answer to the given question +Question: What is the capital of US? +Washington, DC
misconsecutive output formatRaw Task: Answer the following question. +Father's age is 70 years. What could be the son's age? (i) 71 (ii) 72 (iii) 40 (iv) 102? +Note that a son's age is always lower than father's age. +Answer: In the given problem the father's age is 70 years. So, the son's age can be either less than 70 years or 70 years. Since the given age is less than 70 years, the son's age is 71 years.
+ +Table 5: Examples of various types of error patterns associated with raw instructions that gets resolved by reframing. Italicized text represents the prompt. Model prediction is indicated with red marking. + +# A.1.1 Additional Error Analysis: + +In our qualitative analysis (Section 5.2 and Figure 5), we find that $4\%$ of the errors are caused by refaming of raw instructions and $31\%$ of the errors are the failures of raw instructions that are retained by reframing. Table 6 shows the dominant patterns among such errors. + +
error typeerror nameerror description#(%)
reframing causes failuresdecomposition error propagationmodel's error in an initial step of a decomposed task gets propagated to later steps100
reframing retains failuresexample biasthe class imbalance bias in examples supersedes the effect of instructions– this happens mostly in classification tasks, but also applicable to other tasks.22
instance level decomposition requirementfor certain difficult tasks involving reasoning, task-level decomposition is not enough and instance-level decomposition is required; DECOMPOSITION REFRAMING at its current form does not support it78
+ +Table 6: Distribution of error patterns associated with cases where reframing causes failures and retains failures over raw instructions. + +# A.2 GPT3-instruct Outputs to Raw and Reframed Instructions + +We explain each of the reframing techniques by illustrating how they solve various error patterns produced by raw instructions. + +# A.2.1 PATTERN REFRAMING + +Table 7 shows how raw instruction in its detailed form can not help GPT3 produce the valid questions for the CosmosQA question generation task. Table 8 illustrates how reducing the raw instruction content (retaining only the Definition) still does not help model to perform the task and how reframing helps the model to perform the task. Table 9 and 10 shows similar behavior for the MCTACO question generation task. + +# Raw task definitions for tasks requiring PATTERN REFRAMING + +Raw Task: Definition: Based on the given context, craft a common-sense question, especially those that are LONG, INTERESTING, and COMPLEX. The goal is to write questions that are easy for humans and hard for AI machines! To create such questions, here are some suggestions: A. What may (or may not) be the plausible reason for an event? B. What may (or may not) happen before (or after, or during) an event? C. What may (or may not) be a plausible fact about someone (or something)? D. What may (or may not) happen if an event happens (or did not happen)? You can also create other types of question. + +Emphasis & Caution: Your question must be related to the context and answerable with common sense. Try to add more variations and complexity in the questions. + +Things to avoid: 1. DO NOT make your question answerable without looking at the context. 2. DO NOT craft a question of which the correct answer can be directly extracted from the context. 3. DO NOT ask a question that requires very specialized knowledge that is not common sense. 4. DO NOT ask too simple or too short questions. + +Prompt: Craft one question such that it requires commonsense to be answered. + +Context:I was told, in person over the phone, that my shoes were on their way. They have my money. I have no shoes. + +Question: What is the correct order of events? + +Raw Task: Definition: Based on the given context, craft a common-sense question, especially those that are LONG, INTERESTING, and COMPLEX. The goal is to write questions that are easy for humans and hard for AI machines! To create such questions, here are some suggestions: A. What may (or may not) be the plausible reason for an event? B. What may (or may not) happen before (or after, or during) an event? C. What may (or may not) be a plausible fact about someone (or something)? D. What may (or may not) happen if an event happens (or did not happen)? You can also create other types of question. + +Emphasis & Caution: Your question must be related to the context and answerable with common sense. Try to add more variations and complexity in the questions. + +Things to avoid: 1. DO NOT make your question answerable without looking at the context. 2. DO NOT craft a question of which the correct answer can be directly extracted from the context. 3. DO NOT ask a question that requires very specialized knowledge that is not common sense. 4. DO NOT ask too simple or too short questions. + +Prompt: Craft one question such that it requires commonsense to be answered. + +Context:you see , at my age relationship is kind of important and i thought i got the one after all these years . I noticedthat once again i was wrong . i was good simply because i was good , i was caring , helping , supportive , bla bla blaaa . + +Question: A. What is the difference between the first person and the second person? + +B. What is the difference between "getting the one" and "being good, caring, helpful, and supportive"? + +C. What may (or may not) be the rationale for the first person to think their partner was " + +Raw Task: Definition: Based on the given context, craft a common-sense question, especially those that are LONG, INTERESTING, and COMPLEX. The goal is to write questions that are easy for humans and hard for AI machines! To create such questions, here are some suggestions: A. What may (or may not) be the plausible reason for an event? B. What may (or may not) happen before (or after, or during) an event? C. What may (or may not) be a plausible fact about someone (or something)? D. What may (or may not) happen if an event happens (or did not happen)? You can also create other types of question. + +Emphasis & Caution: Your question must be related to the context and answerable with common sense. Try to add more variations and complexity in the questions. + +Things to avoid: 1. DO NOT make your question answerable without looking at the context. 2. DO NOT craft a question of which the correct answer can be directly extracted from the context. 3. DO NOT ask a question that requires very specialized knowledge that is not common sense. 4. DO NOT ask too simple or too short questions. + +Prompt: Craft one question such that it requires commonsense to be answered. + +Context: GPS technology dates back to the time when first ever satellite was launched in the sky in 1979. The era of global positioning started then. + +Question: What was the name of the first satellite that was launched in the sky in 1979? + +What is the name of the country that launched the first satellite in 1979? + +What is the name of the company that developed the GPS technology? + +Table 7: Examples of tasks that require Pattern Reframing. Italicized text represents the raw instructions. GPT3-instruct's response to the raw instructions is indicated with red markings. + +# Raw task definitions, their PATTERN REFRAMED counterparts and GPT3-instruct outputs + +Raw Task: Craft a question which requires commonsense to be answered. Based on the given context, craft a common-sense question, especially those that are LONG, INTERESTING, and COMPLEX. The goal is to write questions that are easy for humans and hard for AI machines! To create such questions, here are some suggestions: A. What may (or may not) be the plausible reason for an event? B. What may (or may not) happen before (or after, or during) an event? C. What may (or may not) be a plausible fact about someone (or something)? D. What may (or may not) happen if an event happens (or did not happen)? You can also create other types of question. + +Context:I was told, in person over the phone, that my shoes were on their way. They have my money. I have no shoes. + +Question: What may be the plausible reason for this event? + +Reframed Task: Use 'what may happen', 'will ...?', 'why might', 'what may have caused', 'what may be true about', 'what is probably true about', 'what must' and similar phrases in your question based on the input context. + +Context:I was told, in person over the phone, that my shoes were on their way. They have my money. I have no shoes. + +Question: What may happen if my shoes never show up? + +Raw Task: Craft a question which requires commonsense to be answered. Based on the given context, craft a common-sense question, especially those that are LONG, INTERESTING, and COMPLEX. The goal is to write questions that are easy for humans and hard for AI machines! To create such questions, here are some suggestions: A. What may (or may not) be the plausible reason for an event? B. What may (or may not) happen before (or after, or during) an event? C. What may (or may not) be a plausible fact about someone (or something)? D. What may (or may not) happen if an event happens (or did not happen)? You can also create other types of question. + +Context:you see , at my age relationship is kind of important and i thought i got the one after all these years . I noticed that once again i was wrong . i was good simply because i was good , i was caring , helping , supportive , bla bla blaaa . + +Question: what is the reason why you keep falling for the same type of person? + +A. What is the reason you keep falling for the same type of person? + +B. What may (or may not) be the problem with your relationships? + +C. What may (or may not) be the possible cause + +Reframed Task: Use 'what may happen', 'will ...?', 'why might', 'what may have caused', 'what may be true about', 'what is probably true about', 'what must' and similar phrases in your question based on the input context. + +Context:you see , at my age relationship is kind of important and i thought i got the one after all these years . I noticed that once again i was wrong . i was good simply because i was good , i was caring , helping , supportive , bla bla blaaa . + +Question: What may happen if i don't get the one i want? + +Raw Task: Craft a question which requires commonsense to be answered. Based on the given context, craft a common-sense question, especially those that are LONG, INTERESTING, and COMPLEX. The goal is to write questions that are easy for humans and hard for AI machines! To create such questions, here are some suggestions: A. What may (or may not) be the plausible reason for an event? B. What may (or may not) happen before (or after, or during) an event? C. What may (or may not) be a plausible fact about someone (or something)? D. What may (or may not) happen if an event happens (or did not happen)? You can also create other types of question. + +Context: GPS technology dates back to the time when first ever satellite was launched in the sky in 1979. The era of global positioning started then. + +Question: What was the first satellite launched in 1979? + +A. Voyager 1 + +B. Voyager 2 + +C. Pioneer 11 + +D. Pioneer 10 + +Reframed Task: Use 'what may happen', 'will ...?', 'why might', 'what may have caused', 'what may be true about', 'what is probably true about', 'what must' and similar phrases in your question based on the input context. + +Context: GPS technology dates back to the time when first ever satellite was launched in the sky in 1979. The era of global positioning started then. + +Question: Why might GPS technology have been invented?? + +Table 8: Examples of Pattern Reframed instructions. Italicized text represents the instructions. GPT3-instruct's response to the raw and reframed instructions are indicated with red and blue markings, respectively. + +# Raw task definitions for tasks requiring PATTERN REFRAMING + +Raw Task: Definition: In this task, we ask you to write a question that involves "event duration", based on a given sentence. Here, event duration is defined as the understanding of how long events typically last. For example, "brushing teeth", usually takes few minutes. + +Emphasis & Caution: The written questions are not required to have a single correct answer. + +Things to avoid: Don't create questions which have explicit mentions of answers in text. Instead, it has to be implied from what is given. In other words, we want you to use "instinct" or "common sense". + +Prompt: Ask a question on "event duration" based on the provided sentence. + +Context: Islam later emerged as the majority religion during the centuries of Ottoman rule, though a significant Christian minority remained. + +Question: What percentage of Muslims reside in Turkey? + +Raw Task: Definition: In this task, we ask you to write a question that involves "event duration", based on a given sentence. Here, event duration is defined as the understanding of how long events typically last. For example, "brushing teeth", usually takes few minutes. + +Emphasis & Caution: The written questions are not required to have a single correct answer. + +Things to avoid: Don't create questions which have explicit mentions of answers in text. Instead, it has to be implied from what is given. In other words, we want you to use "instinct" or "common sense". + +Prompt: Ask a question on "event duration" based on the provided sentence. + +Sentence: About $30\%$ of Ratners's profit already is derived from the U.S. + +Question: What are the 3 ways that Ratners derives profits from the U.S.? + +Raw Task: Definition: In this task, we ask you to write a question that involves "event duration", based on a given sentence. Here, event duration is defined as the understanding of how long events typically last. For example, "brushing teeth", usually takes few minutes. + +Emphasis & Caution: The written questions are not required to have a single correct answer. + +Things to avoid: Don't create questions which have explicit mentions of answers in text. Instead, it has to be implied from what is given. In other words, we want you to use "instinct" or "common sense". + +Prompt: Ask a question on "event duration" based on the provided sentence. + +Sentence: Several tenants blame other neighbors as perpetrators of the rift, however. + +Question: What are the lengths of the events in the sentence? + +Table 9: Examples of tasks that require Pattern Reframing. Italicized text represents the raw instructions. GPT3-instruct's response to the raw instructions is indicated with red markings. + +Raw task definitions, their PATTERN REFRAMED counterparts and GPT3-instruct outputs + +Raw Task: In this task, we ask you to write a question that involves "event duration", based on a given sentence. Here, event duration is defined as the understanding of how long events typically last. For example, "brushing teeth", usually takes few minutes. + +Sentence: Islam later emerged as the majority religion during the centuries of Ottoman rule, though a significant Christian minority remained. + +Question: What is the event that corresponds to the sentence? + +What is the event that corresponds to the sentence, "Islam later emerged as the majority religion during the centuries of Ottoman rule"? + +Reframed Task: Use 'how long' or 'what is the duration' or 'for how much time' or similar phrases in your question based on the following context. + +Sentence: Islam later emerged as the majority religion during the centuries of Ottoman rule, though a significant Christian minority remained. + +Question: What is the duration of Ottoman rule? + +Raw Task: In this task, we ask you to write a question that involves "event duration", based on a given sentence. Here, event duration is defined as the understanding of how long events typically last. For example, "brushing teeth", usually takes few minutes. + +Sentence: About $30\%$ of Ratners's profit already is derived from the U.S. + +Question: How much of Ratner's profit comes from the U.S.? + +Reframed Task: Use 'how long' or 'what is the duration' or 'for how much time' or similar phrases in your question based on the following context. + +Sentence: About $30\%$ of Ratners's profit already is derived from the U.S. + +Question: How long has Ratners been successful in the U.S.? + +Raw Task: In this task, we ask you to write a question that involves "event duration", based on a given sentence. Here, event duration is defined as the understanding of how long events typically last. For example, "brushing teeth", usually takes few minutes. + +Sentence: Several tenants blame other neighbors as perpetrators of the rift, however. + +Question: What is the average duration of a family feud? + +Reframed Task: Use 'how long' or 'what is the duration' or 'for how much time' or similar phrases in your question based on the following context. + +Sentence: Several tenants blame other neighbors as perpetrators of the rift, however. + +Question: How long has this rift been going on? + +Table 10: Examples of Pattern Reframed instructions. Italicized text represents the instructions. GPT3-instruct's response to the raw and reframed instructions are indicated with red and blue markings, respectively. + +# A.2.2 ITEMIZING REFRAMING + +Table 11 shows how raw instruction in its detailed form can not help GPT3 produce the valid questions for the QASC related fact generation task. Table 12 illustrates how reducing the raw instruction content (retaining only the Definition) still does not help model to perform the task and how reframing helps the model to perform the task. Table 13 shows how ITEMIZING REFRAMING works for some miscellaneous tasks. + +# Raw task definitions for tasks requiring ITEMIZING REFRAMING + +
Raw Task: Definition: Write a fact related to the given fact. Note that, your fact should have at least one word in common with the given fact. All facts in this task refer to science facts. Your related fact must form a chain with the given fact. Chains form when two facts connect together to produce a third fact. An example of a chain is: "pesticides cause pollution" (given fact) + "pollution can harm animals" (related fact) → "pesticides can harm animals" (connected chain) Emphasis & Caution: It's okay if your related fact includes some irrelevant information, provided that it has some overlap with the given fact and it contains some words corresponding to the provided topic. Things to avoid: Avoid creating simple paraphrases of the given fact. While your generated fact should be related to the input fact, they must describe slightly different scientific phenomenon. Prompt: Write a related fact to a given fact Fact: an earthquake causes the ground to shake Fact: The number of earthquakes detected by seismic stations between 2000 and 2009 Fact: the frequency of earthquakes worldwide Fact: The frequency of earthquakes worldwide Fact: 2010 was an active year for earthquakes Fact: The number of earthquakes detected by seismic stations between 2000 and 2009 Fact: the frequency of earthquakes worldwide Fact:
+ +
Raw Task: Definition: Write a fact related to the given fact. Note that, your fact should have at least one word in common with the given fact. All facts in this task refer to science facts. Your related fact must form a chain with the given fact. Chains form when two facts connect together to produce a third fact. An example of a chain is: "pesticides cause pollution" (given fact) + "pollution can harm animals" (related fact) → "pesticides can harm animals" (connected chain) Emphasis & Caution: It's okay if your related fact includes some irrelevant information, provided that it has some overlap with the given fact and it contains some words corresponding to the provided topic. Things to avoid: Avoid creating simple paraphrases of the given fact. While your generated fact should be related to the input fact, they must describe slightly different scientific phenomenon. Prompt: Write a related fact to a given fact Fact: a solar panel converts sunlight into electricity. Fact: a light bulb converts electricity into light. Related fact: a solar panel converts sunlight into electricity. Related fact: a light bulb converts electricity into light. Related fact: a solar panel can convert sunlight into electricity. Related fact: a light bulb can convert electricity into light. What is the difference between
+ +
Raw Task: Definition: Write a fact related to the given fact. Note that, your fact should have at least one word in common with the given fact. All facts in this task refer to science facts. Your related fact must form a chain with the given fact. Chains form when two facts connect together to produce a third fact. An example of a chain is: "pesticides cause pollution" (given fact) + "pollution can harm animals" (related fact) → "pesticides can harm animals" (connected chain) Emphasis & Caution: It's okay if your related fact includes some irrelevant information, provided that it has some overlap with the given fact and it contains some words corresponding to the provided topic. Things to avoid: Avoid creating simple paraphrases of the given fact. While your generated fact should be related to the input fact, they must describe slightly different scientific phenomenon. Prompt: Write a related fact to a given fact Fact: damming a river can cause a lake to form. Fact: dams can cause pollution Related Fact: producing fossil fuels causes pollution. Related Fact: making fossil fuels causes pollution. Fact: lakes can be polluted. Fact: lakes can be polluted by dams. Related Fact: lakes can be polluted by dams. Related Fact: lakes can be polluted by dams that
+ +Table 11: Examples of tasks that require Itemizing Reframing. Italicized text represents the raw instructions. GPT3-instruct's response to the raw instructions is indicated with red markings. + +# Raw task definitions, their ITEMIZING REFRAMED counterparts and GPT3-instruct outputs + +Raw Task: Write a fact related to the given fact. Note that, your fact should have at least one word in common with the given fact. All facts in this task refer to science facts. Your related fact must form a chain with the given fact. Chains form when two facts connect together to produce a third fact. An example of a chain is: "pesticides cause pollution" (given fact) + "pollution can harm animals" (related fact) → "pesticides can harm animals" (connected chain) + +Fact: an earthquake causes the ground to shake + +Fact: a tsunami is a large wave in the ocean. + +Reframed Task: Write a fact related to the given fact. + +- Note that, your fact should have at least one word in common with the given fact. + +- All facts in this task refer to science facts. + +- Your related fact must form a chain with the given fact. Chains form when two facts connect together to produce a third fact. An example of a chain is: "pesticides cause pollution" (given fact) + "pollution can harm animals" (related fact) → "pesticides can harm animals" (connected chain) + +Fact: an earthquake causes the ground to shake + +Fact: earthquakes may cause damage to buildings. + +Raw Task: Write a fact related to the given fact. Note that, your fact should have at least one word in common with the given fact. All facts in this task refer to science facts. Your related fact must form a chain with the given fact. Chains form when two facts connect together to produce a third fact. An example of a chain is: "pesticides cause pollution" (given fact) + "pollution can harm animals" (related fact) → "pesticides can harm animals" (connected chain) + +Fact: a solar panel converts sunlight into electricity. + +Question: the sun is the center of our solar system + +# The sun is the center of our solar system. + +Reframed Task: Write a fact related to the given fact. + +- Note that, your fact should have at least one word in common with the given fact. + +- All facts in this task refer to science facts. + +- Your related fact must form a chain with the given fact. Chains form when two facts connect together to produce a third fact. An example of a chain is: "pesticides cause pollution" (given fact) + "pollution can harm animals" (related fact) → "pesticides can harm animals" (connected chain) + +Fact: a solar panel converts sunlight into electricity. + +Fact: Solar panels can be used to power homes and businesses. + +Raw Task: Write a fact related to the given fact. Note that, your fact should have at least one word in common with the given fact. All facts in this task refer to science facts. Your related fact must form a chain with the given fact. Chains form when two facts connect together to produce a third fact. An example of a chain is: "pesticides cause pollution" (given fact) + "pollution can harm animals" (related fact) → "pesticides can harm animals" (connected chain) + +Fact: damming a river can cause a lake to form. + +Fact: when the water level is high, fish are at risk + +Fact: when the water level is low, fish are at risk Fact: when the water level is high, fish are at risk Write a fact related to the given fact. Note that, your fact should have at least one word in common with the + +Reframed Task: Write a fact related to the given fact. + +- Note that, your fact should have at least one word in common with the given fact. + +- All facts in this task refer to science facts. + +- Your related fact must form a chain with the given fact. Chains form when two facts connect together to produce a third fact. An example of a chain is: "pesticides cause pollution" (given fact) + "pollution can harm animals" (related fact) → "pesticides can harm animals" (connected chain) + +Fact: damming a river can cause a lake to form. + +Fact:dams can cause algae to grow. + +Table 12: Examples of Itemizing Reframed instructions. Italicized text represents the instructions. GPT3-instruct's response to the raw and reframed instructions are indicated with red and blue markings, respectively. + +# Raw task definitions, their ITEMIZING REFRAMED counterparts and GPT3-instruct outputs + +Raw Task: Write a story. Mention John in the story. Mention Hari + +Story: There was an old woman who lived in the woods. She was very lonely and had not seen another human for many years. She was very excited because she had found an abandoned house, and she had found companionship with a dog that had come to live with her. She had cleaned up the old house, and + +Reframed Task: Write a story. + +-Mention John in the story. + +-Mention Hari. + +Story John and Hari went to the store together. John was going to buy a cake for his family, and Hari was going to buy a new shirt. They got into the store and never saw each other again. + +Raw Task: Write a sentence. It should start with 'What'. It should not have more than 4 words. It should mention "Patrick". + +Sentence: What is Patrick's favorite color? + +Reframed Task: Write a sentence. + +- It should start with 'What' + +- It should have a maximum of 4 words. + +- It should mention "Patrick". + +Sentence: What does Patrick do? + +Raw Task: Write a story based on the following passage. The story should not be longer than the passage. Don't use the names mentioned in the passage + +Passage: The earthquake swarm was noted on October 12, 2007 in the Prince George Citizen by citizen staff, three days after the earthquakes began. Scientists mentioned in the report were seismologist John Cassidy of Natural Resources Canada and volcanologist Catherine Hickson, who was part of the Geological Survey of Canada at the time. At the time of the report, scientists did not know the origin of the swarm. Seismologist John Cassidy stated, "the depth is enough to rule out hydrothermal but it's up in the air as to whether the cause is tectonic shifts or volcanic activity. If it is volcanic there are certain characteristics that we would expect, there's a tremor-like character to it. And so we'll be looking for the types of events that we see beneath volcanoes and we'll be looking to see if they're getting closer to the surface or if they're migrating at all." Even if the Nazko swarm were a warning of a volcanic eruption, Hickson doubted it would turn out to be a highly explosive eruption like those that can occur in subduction-zone volcanoes. "We're not talking about an injection of tonnes of ash many kilometers into the air like the 1980 Mount St. Helens eruption or the 1991 Mount Pinatubo eruption. We're talking about something very small, relatively localized that should have a fairly limited impact... but it'll be extremely exciting", Hickson said. If an eruption were to occur, Hickson suggested that it would be characterized by a lava fountain that sends globs of lava $100\mathrm{m}$ (330 ft) into the air. This is similar to those that occur in Hawaii. Hickson said that a Nazko eruption could be a tourist attraction, but warned that noxious gases such as carbon dioxide and sulfur dioxide would be released during the event + +Story: John Cassidy, a seismologist, and Catherine Hickson, a volcanologist, are at the office of Natural Resources Canada when John receives a call. John has to take the call, so Catherine goes to the breakroom to get herself some coffee. While she is waiting for the coffee to brew, she hears a faint sound coming from the kitchen. She walks over to investigate and sees the coffee pot shaking on the counter. She goes to turn it off just as the phone rings. + +Reframed Task: Write a story based on the following passage. + +- The story should be shorter than the passage. + +- Use new names + +Passage: The earthquake swarm was noted on October 12, 2007 in the Prince George Citizen by citizen staff, three days after the earthquakes began. Scientists mentioned in the report were seismologist John Cassidy of Natural Resources Canada and volcanologist Catherine Hickson, who was part of the Geological Survey of Canada at the time. At the time of the report, scientists did not know the origin of the swarm. Seismologist John Cassidy stated, "the depth is enough to rule out hydrothermal but it's up in the air as to whether the cause is tectonic shifts or volcanic activity. If it is volcanic there are certain characteristics that we would expect, there's a tremor-like character to it. And so we'll be looking for the types of events that we see beneath volcanoes and we'll be looking to see if they're getting closer to the surface or if they're migrating at all." Even if the Nazko swarm were a warning of a volcanic eruption, Hickson doubted it would turn out to be a highly explosive eruption like those that can occur in subduction-zone volcanoes. "We're not talking about an injection of tonnes of ash many kilometers into the air like the 1980 Mount St. Helens eruption or the 1991 Mount Pinatubo eruption. We're talking about something very small, relatively localized that should have a fairly limited impact... but it'll be extremely exciting", Hickson said. If an eruption were to occur, Hickson suggested that it would be characterized by a lava fountain that sends globs of lava $100\mathrm{m}$ (330 ft) into the air. This is similar to those that occur in Hawaii. Hickson said that a Nazko eruption could be a tourist attraction, but warned that noxious gases such as carbon dioxide and sulfur dioxide would be released during the event + +Story: A year ago, in October 2007, an earthquake swarm began in the Nazko region of Canada. Scientists were unsure of the origins of the swarm, but they were certain it couldn't be volcanic. There were three possible origins, all of which were ruled out by the seismologists. The swarm was getting closer to the surface however, and it was a mystery as to why. Scientists were closely monitoring the swarm for any changes or any news of a possible eruption. + +Table 13: Examples of Itemizing Reframed instructions. Italicized text represents the instructions. GPT3-instruct's response to the raw and reframed instructions are indicated with red and blue markings, respectively. + +# A.2.3 DECOMPOSITION REFRAMING + +Table 14 shows how raw instruction in its detailed form as well as with reduced form (definition only) can not help GPT3 produce the valid questions for the Winogrande sample generation task. Table 15 illustrates how reframing helps the model to perform the task. + +# Raw task definitions for tasks requiring DECOMPOSITION REFRAMING + +Raw Task: In this task, based on the given context word, you need to create a pair of sentences each containing a blank (_) and their corresponding answer. The sentence pair should look similar; and should be about two related but different objects; for example "trophy" and "suitcase". Also, the sentences must be different in terms of trigger words (e.g., "small" and "big") which express contrasting properties about the two objects. + +# Context word:fitness + +```txt +- The machine's objective is to +- stimulate +- the brain cells. +- It does this by +- stimulating +- the cells. +- The machine's objective is to +- stimulate +- the +``` + +Raw Task: Definition: In this task, based on the given context word, you are asked to create a pair of sentences each containing a blank (_) and their corresponding answer. The sentence pair should look similar, and should be about two related but different objects; for example "trophy" and "suitcase". Additionally, the two sentences must be different in terms of trigger words (e.g., "small" and "big") which express contrasting properties about the two objects. + +Emphasis & Caution: 1. Both twin sentences must contain at least 15 and at most 30 words. 2. Twin sentences must have at least $70\%$ overlapping words. 3. You must utilize the given context word while writing the twin sentences. 4. Each of the twin sentences must contain only one blank. 5. Make sure that ObjectX and Y have the same number e.g. when ObjectX is singular, ObjectY must be singular, too. 6. The two objects (ObjectX & ObjectY) should be used ONCE in each sentence. 7. Here is a list of contrastive words that may be used as trigger words. You should create more such trigger words and use them in your twin sentences. | Attribute | triggerword | contrastive triggerword | | age | old | new | | altitude | low | high | area | small | vast | brightness | dark | light | clarity | obscure | clear | | cleanliness | dirty | clean | complexity | simple | complex | cost | cheap | expensive | density | sparse | dense | depth | shallow | deep | distance | near | far | electric conductivity | low | high | flexibility | rigid | flexible || granularity | fine | coarse || hardness | soft | hard | length | short | long | magnitude | small | large | mass | small | large || odor | weak || pressure | low | high | resistance | low | high || shape | round | sharp || shape | flat | spiky || size | small | large || sound | quiet | loud || sound pitch | low | high || speed | slow | fast || stability | unstable | stable || strength || weak || temperature | low | high || texture | smooth | rough || thermal conductivity | low | high || thickness || thin || thick || volume | small | large || weight | light || heavy || width | narrow || location || out || location || up || down || location || above || below || location || on || off || location || to || from + +Things to avoid: 1. The answer must not be associated with the trigger word; instead it should depend on the context present in twin sentences. 2. The answers should not be ambiguous. For each sentence, there should be an agreed upon answer to fill in the blank. 3. Your generations should NOT contain potentially explicit, offensive, or adult content. 4. Do not use animals as your objects. 5. Your objects should not be proper nouns (e.g., New York, Macbook, Jeff Bezos, McDonald's, ...). 6. Avoid repeating the same style or phrase in twin sentences e.g., a contrasting sentence can always be created using simple negation i.e. by adding not, never, etc. Instead, try to increase diversity. + +Prompt: Create a pair of fill in the blanks question-answer pairs based on the context word.) + +# Context Word: fitness. + +1. It was a common belief that one should not partake in any physical activity between meal times, because it would impede digestion. + +2. Exercise was recommended because it would aid digestion. +3. Exercise was not recommended because it would inhibit digestion. + +1. It was a common belief that one should not partake in any physical activity between meal times, because it would impede digestion. +e.g., +2. Exercise was recommended because it would aid digestion. +e.g., +3. Exercise was not recommended because it would inhibit + +Table 14: Examples of tasks that require Decomposition Reframing. Italicized text represents the raw instructions. GPT3-instruct's response to the raw instructions is indicated with red markings. + +
Raw task definitions, their DECOMPOSITION REFRAMED counterparts and GPT3-instruct output
Raw Task: In this task, based on the given context word, you need to create a pair of sentences each containing a blank (_) and their corresponding answer. The sentence pair should look similar, and should be about two related but different objects; for example "trophy" and "suitcase". Also, the sentences must be different in terms of trigger words (e.g., "small" and "big") which express contrasting properties about the two objects. +Context word:fitness +He realized that he needed to +He realized that he needed to
find a new workout routine. +find a new workout routine.
I couldn't believe how +I couldn't believe how
good he looked. +good he looked.
Reframed Task 1: Write 2 objects based on the given context word. +Context word: fitness +Answer: Fitness tracker +Pilates mat +Reframed Task 2: Write a sentence by connecting both objects with a verb. +Objects: Fitness tracker, Pilates mat +I've been using my fitness tracker to monitor my progress with Pilates mat. +Reframed Task 3: Create a fill in the blank question from the sentence where object 1 will fill in the blank +Object 1: Trophy +Sentence: The trophy does not fit the brown suitcase. +Question: The trophy does not fit the brown suitcase because _ is large. +Answer: Trophy +<other similar examples>
Object 1: Fitness tracker. +Sentence: I've been using my fitness tracker to monitor my progress with Pilates mat +Question: I've been using my fitness tracker to monitor my progress with Pilates mat because _ is a good way to keep track. Answer: Fitness tracker. +Reframed Task 4: Change the question such that answer flips to object 2 in the question +Object 2: Suitcase +Sentence: The trophy does not fit the brown suitcase. +Question: The trophy does not fit the brown suitcase because _ is large. +Answer: Trophy +Modified Question: The trophy does not fit the brown suitcase because _ is small. +Answer: Suitcase +<other similar examples>
Object 2: Pilates mat +Sentence: I've been using my fitness tracker to monitor my progress with Pilates mat +Question: I've been using my fitness tracker to monitor my progress with Pilates mat because _ is a good way to keep track. +Answer: Fitness tracker +Modified Question: I've been using my fitness tracker to monitor my progress with Pilates mat because _ is a good workout. +Answer: Pilates mat +Reframed Task 5: Generate both questions and answers +Question 1: The trophy does not fit the brown suitcase because _ is large. +Answer 1: Trophy +Question 2: The trophy does not fit the brown suitcase because _ is small. +Answer 2: Suitcase +<other similar examples>
Question 1: I've been using my fitness tracker to monitor my progress with Pilates mat because _ is a good way to keep track. +Answer 1: Fitness tracker +Question 2: I've been using my fitness tracker to monitor my progress with Pilates mat because _ is a good workout. +Answer 2: Pilates mat
+ +Table 15: Examples of Decomposition Reframed instructions. Italicized text represents the instructions. GPT3-instruct's response to the raw and reframed instructions are indicated with red and blue markings, respectively. + +# A.2.4 RESTRAINING REFRAMING + +Table 16 illustrates how raw instruction can not help GPT3 produce the valid answers for the DROP answer type generation task and how reframing helps GPT3 to perform the task. Table 17 illustrates the utility of RESTRAINING REFRAMING for various tasks of diverse types. + +Raw task definitions, their RESTRAINING REFRAMED counterparts and GPT3-instruct output + +Raw Task: This task involves annotating the answer type to a given question that involve some kind of complex reasoning (including numerical reasoning). Note that the questions require looking at more than one part of the passage to answer. There are 3 possible answer types (i) spans, (ii) numbers and (iii) dates. If the answer can be found in the passage, label it as "span". If the answer is a number, label as "number". Similarly, label "date" if you think the answer to the given question is a date. + +Passage: The outbreak of the Seven Years' War in Europe in 1756 resulted in renewed conflict between French and British forces in India. The Third Carnatic War spread beyond southern India and into Bengal where British forces captured the French settlement of Chandernagore in 1757. However, the war was decided in the south, where the British successfully defended Madras, and Sir Eyre Coote decisively defeated the French, commanded by Comte de Lally at the Battle of Wandiwash in 1760. After Wandiwash, the French capital of Pondicherry fell to the British in 1761. The war concluded with the signing of the Treaty of aris in 1763, which returned Chandernagore and Pondichery to France, and allowed the French to have "factories" in India but forbade French traders from administering them. The French agreed to support British client governments, thus ending French ambitions of an Indian empire and making the British the dominant foreign power in India. + +Question: How many years did the British fight with the French before signing the Treaty of Paris? + +Answer: The British fought with the French for at least 7 years before signing the Treaty of Paris in 1763. + +Reframed Task: This task involves annotating the answer type to a given question that involve some kind of complex reasoning (including numerical reasoning). Note that the questions require looking at more than one part of the passage to answer. There are 3 possible answer types (i) spans, (ii) numbers and (iii) dates. If the answer can be found in the passage, label it as "span". If the answer is a number, label as "number". Similarly, label "date" if you think the answer to the given question is a date. + +Passage: The outbreak of the Seven Years' War in Europe in 1756 resulted in renewed conflict between French and British forces in India. The Third Carnatic War spread beyond southern India and into Bengal where British forces captured the French settlement of Chandernagore in 1757. However, the war was decided in the south, where the British successfully defended Madras, and Sir Eyre Coote decisively defeated the French, commanded by Comte de Lally at the Battle of Wandiwash in 1760. After Wandiwash, the French capital of Pondicherry fell to the British in 1761. The war concluded with the signing of the Treaty of aris in 1763, which returned Chandernagore and Pondichery to France, and allowed the French to have "factories" in India but forbade French traders from administering them. The French agreed to support British client governments, thus ending French ambitions of an Indian empire and making the British the dominant foreign power in India. + +Question: How many years did the British fight with the French before signing the Treaty of Paris? + +Answer either Number, Date or Span based on the answer type. + +Answer: Number. + +Raw Task: This task involves annotating the answer type to a given question that involve some kind of complex reasoning (including numerical reasoning). Note that the questions require looking at more than one part of the passage to answer. There are 3 possible answer types (i) spans, (ii) numbers and (iii) dates. If the answer can be found in the passage, label it as "span". If the answer is a number, label as "number". Similarly, label "date" if you think the answer to the given question is a date. + +Passage: From 1975, Flavin installed permanent works in Europe and the United States, including "Untitled". In memory of Urs Graf at the Kunstmuseum Basel (conceived 1972, realized 1975); the Kröller-Müller Museum, Otterlo, Netherlands (1977); Hudson River Museum, Yonkers, New York (1979); United States Courthouse, Anchorage, Alaska (1979-89); the Staatliche Kunstthalle Baden-Baden, Germany (1989); the lobby of the MetroTech Center (with Skidmore, Owings & Merrill), Brooklyn, New York (1992); seven lampposts outside the Städtische Galerie im Lenbachhaus, Munich (1994); Hypovereinsbank, Munich (1995); Institut Arbeit und Technik/Wissenschaftspark, Gelsenkirchen, Germany (1996); and the Union Bank of Switzerland, Bern (1996). Additional sites for Flavins architectural "interventions" became the Grand Central Station in New York (1976), Hamburger Bahnhof in Berlin (1996), and the Chinati Foundation in Marfa, Texas (2000). His large-scale work in colored fluorescent light for six buildings at the Chinati Foundation was initiated in the early 1980s, although the final plans were not completed until 1996. His last artwork was a site-specific art at Santa Maria Annunciata in Chiesa Rossa, Milan, Italy. The 1930's church was designed by Giovanni Muzio. The design for the piece was completed two days before Flavins death on November 29, 1996. Its installation was completed one year later with the assistance of the Dia Art Foundation and Fondazione Prada. + +Question: When did the installation of Santa Maria Annunciata complete? + +Answer: 1996 + +Reframed Task: This task involves annotating the answer type to a given question that involve some kind of complex reasoning (including numerical reasoning). Note that the questions require looking at more than one part of the passage to answer. There are 3 possible answer types (i) spans, (ii) numbers and (iii) dates. If the answer can be found in the passage, label it as "span". If the answer is a number, label as "number". Similarly, label "date" if you think the answer to the given question is a date. + +Passage: + +Question: When did the installation of Santa Maria Annunciata complete? + +Answer either Number, Date or Span based on the answer type. + +Answer: Span + +Table 16: Examples of Restraining Reframed instructions. Italicized text represents the instructions. GPT3-instruct's response to the raw and reframed instructions are indicated with red and blue markings, respectively. + +
Raw task definitions for tasks requiring RESTRAINING REFRAMING
Raw Task: Answer an incorrect answer to the given question +Question: What is the capital of US? +Answer: Washington +Washington is the capital of the United States of America. +Reframed Task: Answer an incorrect answer to the given question +Question: What is the capital of US? +Answer: New York
Raw Task: Generate the language of the following text. +Question: What is the capital of US? +Answer: Answer: Washington, D.C. +What is the capital of the US? +Washington, D.C. +Reframed Task: Generate the language of the following text. +Question: What is the capital of US? +Is the language English, Spanish, Geman or any other language? +Question: When did the installation of Santa Maria Annunciata complete? +Answer: English
Raw Task: Generate the sentence number in the paragraph that contains answer to the given question +Paragraph- Sent 1: A Republican bid to keep the government open past Friday includes no new money for the construction of a border wall along the U.S.-Mexico border, according to several congressional aides familiar with ongoing talks. Sent 2: GOP leaders submitted the new offer Tuesday afternoon in an effort to appease Democrats, whose votes are needed to avert a shutdown of federal agencies, several House and Senate aides said. Sent 3: However, Republicans also insisted on increases in border security and defense spending, including money to repair existing fencing and new surveillance technology to patrol the nearly 2,000-mile border. Sent 4: Democrats have indicated that they would support such appropriations so long as no money goes toward an actual wall. +Question: Who has to be appeased to keep the government open? +Answer: Democrats have indicated that they would support such appropriations so long as no money goes toward an actual wall. +Reframed Task: +Paragraph- Sent 1: A Republican bid to keep the government open past Friday includes no new money for the construction of a border wall along the U.S.-Mexico border, according to several congressional aides familiar with ongoing talks. Sent 2: GOP leaders submitted the new offer Tuesday afternoon in an effort to appease Democrats, whose votes are needed to avert a shutdown of federal agencies, several House and Senate aides said. Sent 3: However, Republicans also insisted on increases in border security, including money to repair existing fencing and new surveillance technology to patrol the nearly 2,000-mile border. Sent 4: Democrats have indicated that they would support such appropriations so long as no money goes toward an actual wall. +Question: Who has to be appeased to keep the government open? Generate the sentence number in the paragraph that contains answer to the given question +Generate the sentence number in the paragraph that contains answer to the given question +Answer: Sent 2
+ +Table 17: Examples of Restraining Reframed instructions. Italicized text represents the instructions. GPT3-instruct's response to the raw and reframed instructions are indicated with red and blue markings, respectively. + +# A.2.5 SPECIALIZATION REFRAMING + +For a diverse set of tasks, Table 18 shows how GPT3 fails to perform the task with raw instructions and how SPECIALIZATION REFRAMING helps to overcome those failures. + +
Raw task definitions, their SPECIALIZATION REFRAMED counterparts and GPT3-instruct output
Raw Task: Answer the following question. Father's age is 70 years. What could be the son's age? (i) 71 (ii) 72 (iii) 40 (iv) 102? Note that a son's age is always lower than father's age. Answer: In the given problem the father's age is 70 years. So, the son's age can be either less than 70 years or 70 years. Since the given age is less than 70 years, the son's age is 71 years. Select the correct answer among the options provided for the following question. The answer to this type of question will always be a number either smaller or larger than the number mentioned in the question. Father's age is 70 years. What could be the son's age? (i) 71 (ii) 72 (iii) 40 (iv) 102? Note that a son's age is always lower than father's age. Answer: (iii) 40
Raw Task: Answer the following question. Context: Birds are good at flying. However, in the movie, none of the birds could fly. Surprisingly, tigers could fly. Question: In the movie, who can fly (i) birds or (ii) tigers Answer: (i) Birds Reframed Task: Answer the following question only based on the information provided in the context. Context: Birds are good at flying. However, in the movie, none of the birds could fly. Surprisingly, tigers could fly. Question: In the movie, who can fly (i) birds or (ii) tigers Answer: None of the birds could fly. Surprisingly, tigers could fly.
Raw Task: Answer the following question. Passage: Hoping to rebound from their loss to the Patriots, the Raiders stayed at home for a Week 16 duel with the Houston Texans. Oakland would get the early lead in the first quarter as quarterback JaMarcus Russell completed a 20-yard touchdown pass to rookie wide receiver Chaz Schilens. The Texans would respond with fullback Vonta Leach getting a 1-yard touchdown run, yet the Raiders would answer with kicker Sebastian Janikowski getting a 33-yard and a 30-yard field goal. Houston would tie the game in the second quarter with kicker Kris Brown getting a 53-yard and a 24-yard field goal. Oakland would take the lead in the third quarter with wide receiver Johnnie Lee Higgins catching a 29-yard touchdown pass from Russell, followed up by an 80-yard punt return for a touchdown. The Texans tried to rally in the fourth quarter as Brown nailed a 40-yard field goal, yet the Raiders' defense would shut down any possible attempt. Answer: The Texans would tie the game in the second quarter with kicker Kris Brown getting a 53-yard and a 24-yard field goal. Reframed Task: Calculate the answer to the given question. You need to perform addition, subtraction or counting operation. Passage: Hoping to rebound from their loss to the Patriots, the Raiders stayed at home for a Week 16 duel with the Houston Texans. Oakland would get the early lead in the first quarter as quarterback JaMarcus Russell completed a 20-yard touchdown pass to rookie wide receiver Chaz Schilens. The Texans would respond with fullback Vonta Leach getting a 1-yard touchdown run, yet the Raiders would answer with kicker Sebastian Janikowski getting a 33-yard and a 30-yard field goal. Houston would tie the game in the second quarter with kicker Kris Brown getting a 53-yard and a 24-yard field goal. Oakland would take the lead in the third quarter with wide receiver Johnnie Lee Higgins catching a 29-yard touchdown pass from Russell, followed up by an 80-yard punt return for a touchdown. The Texans tried to rally in the fourth quarter as Brown nailed a 40-yard field goal, yet tthe Raiders' defense would shut down any possible attempt. Answer: 4
+ +Table 18: Examples of Specialization Reframed instructions. Italicized text represents the instructions. GPT3-instruct's response to the raw and reframed instructions are indicated with red and blue markings, respectively. \ No newline at end of file diff --git a/reframinginstructionalpromptstogptkslanguage/images.zip b/reframinginstructionalpromptstogptkslanguage/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..c0470013f96cf98cf23ed3d4be8254768570540a --- /dev/null +++ b/reframinginstructionalpromptstogptkslanguage/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b3d29e9085505ef2924b2baa50103fff9e862e7c4546442a974e9a0fde7196b6 +size 2438590 diff --git a/reframinginstructionalpromptstogptkslanguage/layout.json b/reframinginstructionalpromptstogptkslanguage/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..684bd2286777b81396a9643e5436348219919197 --- /dev/null +++ b/reframinginstructionalpromptstogptkslanguage/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9c28654946001a245e94e59e630b5691717e0c2521c3570748b4463fe51af200 +size 594544 diff --git a/reinforcedcrossmodalalignmentforradiologyreportgeneration/1e5b82b9-08c3-45d5-84a4-e5ff389f35a5_content_list.json b/reinforcedcrossmodalalignmentforradiologyreportgeneration/1e5b82b9-08c3-45d5-84a4-e5ff389f35a5_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..90318780be2ef8f779c7fc3157c279fb27e5203a --- /dev/null +++ b/reinforcedcrossmodalalignmentforradiologyreportgeneration/1e5b82b9-08c3-45d5-84a4-e5ff389f35a5_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c5969824a1785591db719465707370b0e570aac836ec7a2fc7bd21547ec16729 +size 80636 diff --git a/reinforcedcrossmodalalignmentforradiologyreportgeneration/1e5b82b9-08c3-45d5-84a4-e5ff389f35a5_model.json b/reinforcedcrossmodalalignmentforradiologyreportgeneration/1e5b82b9-08c3-45d5-84a4-e5ff389f35a5_model.json new file mode 100644 index 0000000000000000000000000000000000000000..62b2a87fa02d062b1dfef0a5344c5b286f44744c --- /dev/null +++ b/reinforcedcrossmodalalignmentforradiologyreportgeneration/1e5b82b9-08c3-45d5-84a4-e5ff389f35a5_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2eeab78fd3b070f5d6623ddcfebda29cfa25b5105307a980995b421e47f42ab2 +size 98311 diff --git a/reinforcedcrossmodalalignmentforradiologyreportgeneration/1e5b82b9-08c3-45d5-84a4-e5ff389f35a5_origin.pdf b/reinforcedcrossmodalalignmentforradiologyreportgeneration/1e5b82b9-08c3-45d5-84a4-e5ff389f35a5_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..919ff69d0a72cab9e76887213d192ca19977a4e1 --- /dev/null +++ b/reinforcedcrossmodalalignmentforradiologyreportgeneration/1e5b82b9-08c3-45d5-84a4-e5ff389f35a5_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e1dfc3997ee7c9f90bffb97449ec3e9275261973edc6d8abcac65afd21e4e291 +size 2386102 diff --git a/reinforcedcrossmodalalignmentforradiologyreportgeneration/full.md b/reinforcedcrossmodalalignmentforradiologyreportgeneration/full.md new file mode 100644 index 0000000000000000000000000000000000000000..5062c1c434d99ba48ab5ab53f7436177b06d7dba --- /dev/null +++ b/reinforcedcrossmodalalignmentforradiologyreportgeneration/full.md @@ -0,0 +1,299 @@ +# Reinforced Cross-modal Alignment for Radiology Report Generation + +Han Qin\*, Yan Song\*† + +$\spadesuit$ The Chinese University of Hong Kong (Shenzhen) + +$\spadesuit$ hanqin@link.cuhk.edu.cn $\spadesuit$ songyan@cuhk.edu.cn + +# Abstract + +Medical images are widely used in clinical decision-making, where writing radiology reports is a potential application that can be enhanced by automatic solutions to alleviate physicians' workload. In general, radiology report generation is an image-text task, where cross-modal mappings between images and texts play an important role in generating high-quality reports. Although previous studies attempt to facilitate the alignment via the co-attention mechanism under supervised settings, they suffer from lacking valid and accurate correspondences due to no annotation of such alignment. In this paper, we propose an approach with reinforcement learning (RL) over a cross-modal memory (CMM) to better align visual and textual features for radiology report generation. In detail, a shared memory is used to record the mappings between visual and textual information, and the proposed reinforced algorithm is performed to learn the signal from the reports to guide the cross-modal alignment even though such reports are not directly related to how images and texts are mapped. Experimental results on two English radiology report datasets, i.e., IU X-Ray and MIMIC-CXR, show the effectiveness of our approach, where the state-of-the-art results are achieved. We further conduct human evaluation and case study which confirm the validity of the reinforced algorithm in our approach. $^{1}$ + +# 1 Introduction + +Radiology report generation aims to automatically generate a free-text description from a specific clinical radiograph (e.g., chest X-ray), which can significantly alleviate the burden of radiologists and thus improve the quality and standardization of health care. With the advantages of its applications, radiology report generation has become an + +Impression +Figure 1: A chest X-ray image with its report, where aligned visual and textual features are linked by colors. +![](images/e0c6483e28b8e831f1d19f4e502f88929cb9b5256587e9892f0ee7f4f21d86ca.jpg) +Pulmonary vascular congestion; emphysema; bibasilar streaky airspace opacities. + +# Findings + +Borderline enlarged heart. Stable mediastinal contours. Aortic calcifications. Hyperinflated lungs with chronic appearing interstitial markings, compatible with emphysema. + +Bilateral streaky opacities. Increased vascularity compatible with pulmonary vascular congestion. No focal airspace disease. No acute bony abnormality. + +interesting research topic attracted in both artificial intelligence and clinical medicine. Recently, to generate more accurate reports, approaches based on deep learning techniques are adapted to this task and have achieved great success (Jing et al., 2018; Li et al., 2018; Liu et al., 2019). + +To effectively perform radiology report generation, most existing studies adopted conventional encoder-decoder architectures with convolutional neural networks (CNN) as the encoder and recurrent neural networks (e.g., LSTM (Hochreiter and Schmidhuber, 1997), GRU (Cho et al., 2014)) or non-recurrent neural networks (e.g., Transformer (Vaswani et al., 2017)) as the decoder. Considering that there is alignment between radiographs and their corresponding doctor-written reports (such as the mappings demonstrated in Figure 1 where visual and textual features representing the same content are highlighted in the same color), the ability of a model to learn such alignment is the key to achieve outstanding performance. To model the alignment information, Jing et al. (2018) proposed a co-attention mechanism to explicitly learn the linking between visual features in the radiographs and the semantic information in the corresponding doctor-written text reports, where the model is trained to generate text sequences via maximum likelihood estimation (MLE). However, one chal + +![](images/a50adcac443d1c636f9d2aaccb9182c3748842a61504bd2745368b7b6d693838.jpg) +Figure 2: The overall architecture of our proposed approach, where the visual extractor, encoder, and decoder are shown in gray dash boxes with the details omitted. The CMM and reward computation process of RL are illustrated in green dash boxes, and the orange dash arrows indicate back-propagation of gradients from training the model. The orange, blue, and red nodes in CMM denote the vector representations of visual features, textual features, and memories, respectively. + +lenge to learn the alignment is that there is no annotated alignment for such research to perform supervised learning to accurately map cross-modal information, so that normal learning procedure may not fit this scenario. To address this challenge, reinforcement learning (RL) is a potential solution, because it is able to guide the learning process of the cross-modal alignment with appropriate supervision from carefully designed rewards. Although there are studies following this paradigm by using RL to perform report generation, they focused on other aspects of this task rather than facilitating the mappings for cross-modal information. For example, Li et al. (2018) designed sentence- and word-level rewards to guide the model to choose to either retrieve a template sentence or generate a new sentence, and Jing et al. (2019) utilized multiagent RL to capture the imbalanced distribution between abnormality and normality. Therefore, RL on cross-modal alignment is expected to be studied and has the potential for further improvements. + +In this paper, we propose to enhance radiology report generation via reinforced cross-modal alignment to alleviate the requirement of annotated supervision while facilitate the interactions across modalities (i.e., images and texts). In detail, our approach is based on Chen et al. (2021b), where + +a cross-modal memory (CMM) module is used to stores the cross-modal information that bridges the visual and textual features. Based on CMM, the proposed RL algorithm is applied to leverage the signals from natural language generation (NLG) metrics, i.e., BLEU (Papineni et al., 2002), METEOR (Denkowski and Lavie, 2011) and ROUGE (Lin, 2004), to guide the cross-modal mappings so as to better matching features from images and texts as well as have a direct target of learning outcome for report generation. Experimental results confirm the validity of our approach, which outperforms strong baselines and achieves the state-of-the-art performance on two widely used benchmark datasets, i.e., IU X-Ray (Demner-Fushman et al., 2016) and MIMIC-CXR (Johnson et al., 2019). Moreover, we perform human evaluation and case study to further illustrate the validity of the proposed RL in our approach. + +# 2 The Proposed Approach + +Following previous studies (Jing et al., 2018; Li et al., 2018; Liu et al., 2019; Chen et al., 2021b), we treat radiology report generation as a sequence-to-sequence task, where the source sequence are patch features $\mathbf{X} = \{\mathbf{x}_1,\mathbf{x}_2,\dots ,\mathbf{x}_s,\dots ,\mathbf{x}_S\}$ from an input image, where $\mathbf{x}_s\in \mathbb{R}^d$ is extracted by + +visual extractors, and the target sequence $\mathbf{Y} = \{y_1, y_2, \dots, y_t, \dots, y_T\}$ is the corresponding report to the image, with $y_t \in \mathbb{V}$ being generated tokens, $T$ the length of the report and $\mathbb{V}$ the vocabulary of all possible tokens. On the top of the general sequence-to-sequence paradigm, we add CMM which allows the proposed RL to take the signal from $\mathbf{Y}$ and use it to guide cross-modal mappings for $\mathbf{X}$ and $\mathbf{Y}$ . An overview of our proposed approach is presented in Figure 2, where the details for different parts are illustrated as follows. + +# 2.1 The Overall Generation Pipeline + +In general, our model is composed of three major components, i.e., the visual extractor, the CMM, and the encoder-decoder part, where the CMM is dynamically integrated into the encoding and decoding process. The high-level descriptions of the three components are explained below. + +Visual Extractor The visual features $\mathbf{X}$ of a radiology image I are extracted by pre-trained convolutional neural networks (CNN), such as VGG (Simonyan and Zisserman, 2015) or ResNet (He et al., 2016). Normally, an image is decomposed into regions with equal size (i.e., patches), and the extracted features from patches are then expanded into a sequence by simply concatenating all features from each row in a row-by-row manner, where the process is formulated by + +$$ +\left\{\mathbf {x} _ {1}, \mathbf {x} _ {2}, \dots , \mathbf {x} _ {s}, \dots , \mathbf {x} _ {S} \right\} = f _ {v} (\mathbf {I}) \tag {1} +$$ + +with $f_{v}(\cdot)$ representing the visual extractor. Then the result is used as the source sequence for all subsequent modules. + +Cross-modal Memory Memories are widely used to model the associations between different types of features through the mapping of keys and values and its effectiveness in doing so is demonstrated in many previous natural language processing studies (Miller et al., 2016; Xu et al., 2019; Tian et al., 2020; Cornia et al., 2020; Nie et al., 2020; Wu et al., 2021; Chen et al., 2021a). Therefore, we use CMM, which is based on Chen et al. (2021b), to record potentially shared information of visual and textual features in the memory so that the entire learning process is able to explicitly map corresponding parts in images and texts within a unified representation space. Formally, given a source sequence $\mathbf{X} = \{\mathbf{x}_1,\mathbf{x}_2,\dots,\mathbf{x}_s,\dots,\mathbf{x}_S\}$ from an image, we feed it to the CMM module to obtain the memory + +correspondences $\{\mathbf{r}_{\mathbf{x}_1},\mathbf{r}_{\mathbf{x}_2},\dots,\mathbf{r}_{\mathbf{x}_s},\dots,\mathbf{r}_{\mathbf{x}_S}\}$ for the visual features. Similarly, the given the generated text sequence $\{y_{1},y_{2},\ldots ,y_{t - 1}\}$ for I with embedding $\{\mathbf{y}_1,\mathbf{y}_2,\dots ,\mathbf{y}_{t - 1}\}$ is also fed to CMM to form memory correspondences for textual features $\{\mathbf{r}_{\mathbf{y}_1},\mathbf{r}_{\mathbf{y}_2},\dots,\mathbf{r}_{\mathbf{y}_{t - 1}}\}$ . + +Encoder-Decoder The encoder-decoder in our model is built upon standard Transformer. In detail, the encoding process is formulated as + +$$ +\left\{\mathbf {z} _ {1}, \mathbf {z} _ {2} \dots , \mathbf {z} _ {S} \right\} = f _ {e} \left(\mathbf {r} _ {\mathbf {x} _ {1}}, \mathbf {r} _ {\mathbf {x} _ {2}}, \dots , \mathbf {r} _ {\mathbf {x} _ {S}}\right) \tag {2} +$$ + +where $f_{e}(\cdot)$ is the encoder. With the encoded results, the decoding process is formulated by + +$$ +y _ {t} = f _ {d} \left(\mathbf {z} _ {1}, \mathbf {z} _ {2}, \dots , \mathbf {z} _ {S}, \mathbf {r} _ {\mathbf {y} _ {1}}, \mathbf {r} _ {\mathbf {y} _ {2}}, \dots , \mathbf {r} _ {\mathbf {y} _ {t - 1}}\right) \tag {3} +$$ + +where $f_{d}(\cdot)$ is the decoder and $y_{t}$ the generated token at the current time step. + +# 2.2 Cross-modal Memory + +In our approach, CMM serves as an intermediate medium to connect the visual and textual features and thus allows the model to automatically learn the cross-modal mappings without relying on gold annotated alignments. Specifically, CMM contains a memory matrix $^2$ $\mathbf{M} = [\mathbf{m}_1, \dots, \mathbf{m}_i, \dots, \mathbf{m}_{\mathcal{N}}]$ that consists of $\mathcal{N}$ memory vectors ( $\mathbf{m}_i$ is the $i$ -th memory vector) to align the visual and textual features. It applies multi-thread $^3$ alignments to the visual features (i.e., $\mathbf{x_s}$ ), the textual features (i.e., $\mathbf{y_t}$ ), and the memory vectors (i.e., $\mathbf{m_i}$ ), where the alignments in all threads follow the same procedure. + +In detail, in each thread, it firstly maps $\mathbf{x_s}$ , $\mathbf{y}_t$ , and $\mathbf{m_i}$ to the alignment space $\mathbf{x}_s^{\prime}$ , $\mathbf{y}_t^{\prime}$ , $\mathbf{k}_i$ through three trainable matrices (i.e., $\mathbf{W}_x$ , $\mathbf{W}_y$ , and $\mathbf{W}_k$ ), respectively, which is formally represented by + +$$ +\mathbf {x} _ {s} ^ {\prime} = \mathbf {x} _ {s} \mathbf {W} _ {x}, \mathbf {y} _ {t} ^ {\prime} = \mathbf {y} _ {t} \mathbf {W} _ {y}, \mathbf {k} _ {i} = \mathbf {m} _ {i} \mathbf {W} _ {k} \tag {4} +$$ + +Next, for each visual feature (i.e., $\mathbf{x}_s^{\prime}$ ), CMM computes the distances (denoted by $d_{s,i}$ ) between $\mathbf{x}_s^\prime$ all memory vectors (i.e., $\mathbf{k}_i$ ) in the alignment space by $d_{s,i} = \mathbf{x}_s^\prime \cdot \mathbf{k}_i$ and extracts the closest $\kappa$ memory vectors (i.e., keys in the memories) which are denoted as $[\mathbf{k}_{s,1},\dots ,\mathbf{k}_{s,j},\dots ,\mathbf{k}_{s,\kappa}]$ . Then, CMM finds the corresponding memory vectors $\mathbf{m}_{s,j}$ of the keys $\mathbf{k}_{s,j}$ in the memory matrix and uses a trainable matrix $\mathbf{W}_v$ to map $\mathbf{m}_{s,j}$ to its corresponding value vectors $(\mathbf{v}_{s,j})$ through $\mathbf{v}_{s,j} = \mathbf{m}_{s,j}\cdot \mathbf{W}_v$ + +Afterwards, we compute the weighted sum of the value vectors and obtain the output $\mathbf{r}_{\mathbf{x}_s}$ for $\mathbf{x}_s$ by + +$$ +\mathbf {r} _ {\mathbf {x} _ {s}} = \sum_ {j = 1} ^ {\mathcal {K}} w _ {s, j} \mathbf {v} _ {s, j} \tag {5} +$$ + +where the weight $w_{s,j}$ is computed through + +$$ +w _ {s, j} = \frac {\exp \left(\mathbf {x} _ {s} ^ {\prime} \cdot \mathbf {k} _ {s , j}\right)}{\sum_ {j = 1} ^ {\mathcal {K}} \exp \left(\mathbf {x} _ {s} ^ {\prime} \cdot \mathbf {k} _ {s , j}\right)} \tag {6} +$$ + +The same procedure is applied to the textual features and obtain the output $\mathbf{r}_{\mathbf{y}_t}$ for $\mathbf{y}_t$ . Finally, CMM concatenates the output $\mathbf{r}_{\mathbf{x}_s}$ and $\mathbf{r}_{\mathbf{y}_t}$ from all threads and feeds them to the encoder-decoder structure in our model. + +# 2.3 Reinforced Cross-modal Alignment + +Although CMM provides a "soft" mechanism to facilitate the linking between visual and textual features, there is still no annotated alignment to guide an accurate learning process, which is a common problem exists in previous work (Jing et al., 2018). To address this problem, we propose to use RL to provide appropriate supervision from NLG evaluation metrics to search for better mappings between features from different modalities. In doing so, we treat the generation model as the agent that interacts with an external environment (visual and textual features). Therefore, all parameters of our approach, $\theta$ , define a policy $p_{\theta}$ that results in an action (i.e., the prediction of the next word). Upon generating the end-of-sequence (EOS) token, the agent uses a reward $r$ based on evaluation metrics, e.g., BLEU, METEOR and ROUGE, etc., where the reward $r_t$ for the action at step $t$ is the improvement on the evaluation metric by generating the next word $y_t$ , which is formally expressed by + +$$ +r _ {t} = r \left(\mathbf {Y} _ {t}\right) - r \left(\mathbf {Y} _ {t - 1}\right) \tag {7} +$$ + +where $\mathbf{Y}_t = \{y_1, y_2, \dots, y_t\}$ and $\mathbf{Y}_{t-1} = \{y_1, y_2, \dots, y_{t-1}\}$ . Therefore, the entire reward $R$ of generating $\mathbf{Y} = \{y_1, y_2, \dots, y_t, \dots, y_T\}$ is the sum of $r_t$ : + +$$ +R = \sum_ {t = 1} ^ {T} r (\mathbf {Y} _ {t}) - r (\mathbf {Y} _ {t - 1}) = r (\mathbf {Y}) \tag {8} +$$ + +Then the model is trained to maximize the expected reward $\mathbb{E}_{\mathbf{Y}\sim p_{\theta}}[r(\mathbf{Y})]$ from the generated report $\mathbf{Y}$ via a sampling strategy (e.g., sampling by probabilities). Based on $\mathbb{E}_{\mathbf{Y}\sim p_{\theta}}[r(\mathbf{Y})]$ , the loss of our entire approach is defined as + +$$ +L (\theta) = - \mathbb {E} _ {\mathbf {Y} \sim p _ {\theta}} [ r (\mathbf {Y}) ] \tag {9} +$$ + +with the gradient of $L(\theta)$ for $\theta$ computed using the REINFORCE algorithm (Williams, 1992) via + +$$ +\nabla_ {\theta} L (\theta) = - \mathbb {E} _ {\mathbf {Y} \sim p _ {\theta}} \left[ r (\mathbf {Y}) \nabla_ {\theta} \log p _ {\theta} (\mathbf {Y}) \right] (1 0) +$$ + +Then, we approximate the expectation (i.e., the expected gradient) through a single Monte-Carlo sample $\mathbf{Y}$ from $p_{\theta}$ : + +$$ +\nabla_ {\theta} L (\theta) \approx - r (\mathbf {Y}) \nabla_ {\theta} \log p _ {\theta} (\mathbf {Y}) \tag {11} +$$ + +However, the gradient estimated from the above process is of high variance. To maintain the stability of the RL, we follow Rennie et al. (2017a) to reduce such variance by introducing a reference reward $b$ . Therefore, Eq. (10) is formalized as + +$$ +\nabla_ {\theta} L (\theta) = - \mathbb {E} _ {\mathbf {Y} \sim p _ {\theta}} \left[ (r (\mathbf {Y}) - b) \nabla_ {\theta} \log p _ {\theta} (\mathbf {Y}) \right] \tag {12} +$$ + +with the expected gradient approximated by + +$$ +\nabla_ {\theta} L (\theta) \approx - (r (\mathbf {Y}) - b) \nabla_ {\theta} \log p _ {\theta} (\mathbf {Y}) \tag {13} +$$ + +Note that, in our approach, $b$ is obtained by computing the NLG metric (e.g., BLEU-4) of the generated report using greedy sampling during inferencing at the training stage. As a result, any actions (i.e., result in some generated $\mathbf{Y}$ ) that returns higher $r(\mathbf{Y})$ than $b$ drives the following learning process to take as more such actions as possible. + +# 3 Experiment Settings + +# 3.1 Datasets + +In our experiments, we use two conventional benchmark datasets, i.e., IU X-RAY (Demner-Fushman et al., 2016) from Indiana University and MIMIC-CXR (Johnson et al., 2019) from the Beth Israel Deaconess Medical Center. The IU X-RAY is a + +$$ +\begin{array}{l} \mathbb {E} _ {\mathbf {Y} \sim p _ {\theta}} \left[ b \nabla_ {\theta} \log p _ {\theta} (\mathbf {Y}) \right] = b \sum_ {\mathbf {Y}} \nabla_ {\theta} p _ {\theta} (\mathbf {Y}) \\ = b \nabla_ {\theta} \sum_ {\mathbf {Y}} p _ {\theta} (\mathbf {Y}) \\ \mathbf {\nabla} = b \nabla_ {\theta} 1 \\ = 0 \\ \end{array} +$$ + +
DATASETIU X-RAYMIMIC-CXR
TRAINVALTESTTRAINVALTEST
IMAGE #5.2K0.7K1.5K369.0K3.0K5.2K
REPORT #2.8K0.4K0.8K222.8K1.8K3.3K
PATIENT #2.8K0.4K0.8K64.6K0.5K0.3K
AVG. LEN.37.636.833.653.053.166.4
+ +Table 1: The statistics of the two benchmark datasets w.r.t. their training, validation and test sets, including the numbers of images, reports and patients, and the averaged word-based length (Avg. LEN.) of reports. + +
HYPER-PARAMETERVALUE
BATCH SIZE8, 10, 16, 32
LR (VISUAL EXTRACTOR)1e-5, 3e-5, 5e-5, 1e-4
LR (ENCODER-DECODER)5e-5, 1e-4, 3e-4, 5e-4
+ +Table 2: The hyper-parameters tested in tuning our models, where LR (VISUAL EXTRACTOR) and LR (ENCODER-DECODER) represent the learning rates for the visual extractor and the encoder-decoder. The bold values illustrate the best hyper-parameter configuration for both IU X-RAY and MIMIC-CXR. + +relatively small dataset with 7,470 chest X-ray images and 3,955 corresponding reports; the MIMIC-CXR is the largest public radiography dataset with 473,057 chest X-ray images and 206,563 reports. + +Following the experiment settings from previous studies (Li et al., 2018; Jing et al., 2019; Chen et al., 2020), we exclude the samples without reports for both datasets. For IU X-RAY, we use the same split (i.e., $70\% / 10\% / 20\%$ for train/validation/test set) as that in Li et al. (2018) and for MIMIC-CXR we adopt its official split. Table 1 show the statistics of all datasets in terms of the numbers of images, reports, patients and the average length of reports with respect to train/validation/test sets. + +# 3.2 Baseline and Evaluation Metrics + +To examine our proposed model, we use three baselines for comparison in our experiments. The first, namely BASE, is the backbone encoder-decoder used in our full model, i.e., a three-layer Transformer model with 8 heads and 512 hidden units without other extensions. The second, namely $\mathbf{BASE} + \mathbf{RL}$ is the Transformer model with the same architecture of BASE, where reinforcement learning is applied to training the model. The third, namely $\mathbf{BASE} + \mathbf{CMM}$ , is the Transformer model with the same backbone architecture of BASE and + +CMM, without RL. + +For evaluation, we follow Chen et al. (2020) to evaluate the above models by two types of metrics, namely, conventional natural language generation (NLG) metrics and clinical efficacy (CE) metrics8. The NLG metrics9 include BLEU (Papineni et al., 2002), METEOR (Denkowski and Lavie, 2011) and ROUGE-L (Lin, 2004). For CE metrics, the CheXpert (Irvin et al., 2019)10 is applied to label the generated reports and compare the results with ground truths in 14 different categories related to thoracic diseases and support devices. We use precision, recall, and F1 scores to evaluate model performance for CE metrics. + +# 3.3 Implementation Details + +To ensure consistency with previous studies (Li et al., 2018; Chen et al., 2020), we use two images for each patient as the input for report generation on IU X-RAY and one image for MIMIC-CXR. For visual extractor, we adopt the ResNet101 (He et al., 2016) pretrained on ImageNet (Deng et al., 2009) to extract patch features with 512 dimensions for each feature. For the encoder-decoder backbone, considering the quality of text representation significantly determines the model performance (Radford et al., 2018; Song and Shi, 2018; Lewis et al., 2020; Song et al., 2021), we use Transformer (Vaswani et al., 2017), which has demonstrated its superior in modeling text in many natural language processing tasks, as the encoder-decoder and randomly initialize its parameters. For the memory matrix in CMM, its dimension and the number of memory vectors $\mathcal{N}$ are set to 512 and 2048, respectively, with random initialization. In addition, the thread number and the $\kappa$ in CMM are set to 8 and 32, respectively. We train our model using MLE for 30 epochs to regularize the action space before the RL is applied. Afterwards, we start RL using the Adam optimizer (Kingma and Ba, 2015). Table 2 reports the hyper-parameters tested in tuning our models for the two datasets. For each dataset, we try all combinations of the hyper-parameters and use the one achieving the highest BLEU-4 on the validation sets of IU X-RAY and MIMIC-CXR. For example, the best performing learning rates of + +
DATAMODELNLG METRICSCE METRICS
BL-1BL-2BL-3BL-4MTRRG-LAvg. ΔPRF1
IU X-RAYBASE0.3960.2540.1790.1350.1640.342----
+RL0.4460.2900.2120.1670.1940.35615.2%---
+CMM0.4740.3090.2240.1730.1950.37620.6%---
+CMM+RL0.4940.3210.2350.1810.2010.38425.2%---
MIMIC-CXRBASE0.3140.1920.1270.0900.1250.265-0.3310.2240.228
+RL0.3570.2190.1460.1040.1390.27412.1%0.3250.2670.271
+CMM0.3650.2220.1470.1040.1420.27213.2%0.3290.2850.280
+CMM+RL0.3810.2320.1550.1090.1510.28719.1%0.3420.2940.292
+ +Table 3: NLG and CE evaluations of different models on the test sets of IU X-RAY and MIMIC-CXR datasets. BL-n denotes BLEU score using up to 4-grams; MTR and RG-L denote METEOR and ROUGE-L, respectively. The average improvement over all NLG metrics compared to BASE is also presented in the “Avg. $\Delta$ ” column. + +the visual extractor and other parameters are set to $5 \times 10^{-5}$ and $1 \times 10^{-4}$ , respectively, and we decay them by 0.8 per epoch for all datasets. + +# 4 Results and Analysis + +# 4.1 Overall Results + +The experimental results of different models on the two benchmark datasets are reported in Table 3 where BASE, BASE+CMM, and BASE+RL represent the aforementioned baselines and BASE+CMM+RL represents our full model. + +There are several observations. First, all models with CMM consistently outperform BASE and $\mathrm{BASE + RL}$ on both datasets with respect to all NLG metrics, which confirms the advantage of incorporating cross-modal memory into Transformer-based models. Second, the comparison between models with and without RL (i.e., BASE vs. $\mathrm{BASE + RL}$ and $\mathrm{BASE + CMM}$ vs. $\mathrm{BASE + CMM + RL}$ ) on different metrics confirms the effectiveness of using RL to train such generation model, where models with RL outperforms the ones without RL on all evaluation metrics. This observation indicates that RL has its superiority to map essential features from images and texts with distant (even irrelevant) signals (i.e., NLG metrics) so as to produce better radiology reports. Third, in particular, our full model $\mathrm{BASE + CMM + RL}$ outperforms all other models by a large margin on both datasets with respect to all metrics, although the other baselines have already achieved outstanding performance, which indicates the effectiveness of the design of reinforced cross-modal alignment. This observation further confirms that, under the RL setting, CMM is able to better search for the cross-modal alignment in the memory representation space without explicit supervision and pro + +vides a more accurate feature correspondence in generating high-quality reports. + +# 4.2 Comparison with Previous Studies + +We further compare our full model (i.e. $\mathrm{BASE + CMM + RL}$ ) with existing studies on the same datasets, and report the results (in terms of NLG and CE metrics) in Table 4. It is observed that our approach outperforms all previous studies. Particularly, compared with previous studies that also use RL (e.g., HRGR and CMAS-RL), our approach focuses on using RL to leverage the signals from NLG metrics so as to update the whole model, whereas their approaches focus on using RL to improve the decision-making of sentence template utilization and abnormality detection. In addition, compared with Chen et al. (2021b) that uses memory-based approach to align cross-modal information, our approach is able to outperform their approach with the help of the proposed RL mechanism, which demonstrates the effectiveness of our approach to further enhance the cross-modal modeling. Further more, the overall comparison indicates that it is of great potential in exploiting informative patterns among images and their texts for report generation without requiring any external resources, while previous studies (e.g., CoATT and HRGR) rely on extra information (e.g., private datasets for visual extractor pretraining) for this task. + +# 4.3 Human Evaluation + +We employ human evaluation to further evaluate the effect of different modules (i.e., CMM and RL) in our proposed model. In detail, we randomly select 100 chest X-ray images and their ground truth reports from the test set of MIMIC-CXR, as + +
DATAMODELNLG METRICSCE METRICS
BL-1BL-2BL-3BL-4MTRRG-LPRF1
IU X-RAYST‡ (Vinyals et al., 2015)0.2160.1240.0870.066-0.306---
ATT2IN‡ (Rennie et al., 2017b)0.2240.1290.0890.068-0.308---
ADAATT‡ (Lu et al., 2017)0.2200.1270.0890.068-0.308---
COATT‡ (Jing et al., 2018)0.4550.2880.2050.154-0.369---
HRGR‡ (Li et al., 2018)0.4380.2980.2080.151-0.322---
CMAS-RL‡ (Jing et al., 2019)0.4640.3010.2100.154-0.362---
R2GEN‡ (Chen et al., 2020)0.4700.3040.2190.165-0.371---
CA‡ (Liu et al., 2021c)0.4920.3140.2220.1690.1930.381---
CMCL‡ (Liu et al., 2021a)0.4730.3050.2170.1620.1860.378---
PPKED‡ (Liu et al., 2021b)0.4830.3150.2240.168-0.376---
R2GENCMN‡ (Chen et al., 2021b)0.4750.3090.2220.1700.1910.375---
OURS (CMM+RL)0.4940.3210.2350.1810.2010.384---
MIMIC-CXRST‡ (Vinyals et al., 2015)0.2990.1840.1210.0840.1240.2630.2490.2030.204
ATT2IN‡ (Rennie et al., 2017b)0.3250.2030.1360.0960.1340.2760.3220.2390.249
ADAATT‡ (Lu et al., 2017)0.2990.1850.1240.0880.1180.2660.2680.1860.181
TOPDOWN‡ (Anderson et al., 2018)0.3170.1950.1300.0920.1280.2670.3200.2310.238
R2GEN‡ (Chen et al., 2020)0.3530.2180.1450.1030.1420.2700.3330.2730.276
CA‡ (Liu et al., 2021c)0.3500.2190.1520.1090.1510.283---
CMCL‡ (Liu et al., 2021a)0.3440.2170.1400.0970.1330.281---
PPKED‡ (Liu et al., 2021b)0.3600.2240.1490.1060.1490.284---
R2GENCMN‡ (Chen et al., 2021b)0.3530.2180.1480.1060.1420.2780.3340.2750.278
OURS (CMM+RL)0.3810.2320.1550.1090.1510.2870.3420.2940.292
+ +Table 4: Comparisons of our proposed models (i.e., CMM+RL) with previous studies on the test sets of IU X-RAY and MIMIC-CXR with respect to NLG and CE metrics. Herein, $\ddagger$ marks the results that are directed cited from their paper and $\diamond$ represents the results of our runs with their released codes. + +
MODELCOR.FLU.COV.AVG.
BASE5.013.08.08.7
+RL9.023.015.015.7
+CMM21.030.020.023.7
+CMM+RL65.034.057.052.0
+ +Table 5: The results of human evaluation for different models. COR., FLU. and COV. are abbreviations of correctness, language fluency, and content coverage, respectively, with AVG. denoting the average of them. + +well as the reports generated from the baselines and our model. Five human experts who are familiar with radiology are asked to choose the best reports among the generated and the ground truth reports. Following Li et al. (2018), the assessment criterion used in our experiments include correctness, language fluency, and content coverage. The results are reported in Table 5. Overall, $\mathrm{BASE + CMM + RL}$ outperforms all baselines with a more satisfying result from humans in terms of all the criterion. In particular, $\mathrm{BASE + CMM + RL}$ significantly outperforms other baselines on correctness and coverage, which further confirms that the reinforced cross-modal alignment helps our approach generate more accurate and comprehensive reports. + +# 4.4 Case Study + +To further investigate the effect of our model, we perform a case study on the generated reports from different models (i.e., BASE, BASE+RL, BASE+CMM, and BASE+CMM+RL) with an example input chest X-ray image chosen from the test set of MIMIC-CXR. Figure 3 shows the example image with its ground-truth report, and the generation outputs from different models. For each model, we also demonstrate the mappings between regions of the image and words/phrases in the generated text, where the intensity11 of the mappings is illustrated on the images with different colors. + +The observations are drawn from two different aspects. First, BASE+CMM and BASE+CMM+RL is able to generate descriptions aligned with the ground-truth, which confirms the effectiveness of CMM. For example, for the medical findings in the ground-truth reports (i.e., "low lung volumes", "heart size is mildly enlarged", "atelectasis", and "vascular congestion"), BASE+CMM and BASE+CMM+RL covers many key words in the findings (e.g., "low lung volumes", "heart size", "atelectasis" and "vascular congestion") in the gen + +
BASELung volumes are low. Heart size is normal. Mediastinal and hilar contours are unremarkable. Pulmonary vasculature is not engorged. Patchy opacities in the lung bases likely reflect areas of atelectasis. No focal consolidation pleural effusion or pneumothorax is present. There are no acute osseous abnormalities."Heart""mediastinal""pulmonary""lung""pleural"
BASE +RLHeart size is normal. The mediastinal and hilar contours are normal. The pulmonary vasculature is normal. The lungs are clear. There is no pleural effusion or pneumothorax."Heart""mediastinal""pulmonary vasculature""lungs""pleural effusion"
BASE +CMMThe heart size is normal. The hilar and mediastinal contours are within normal limits. There is no pneumothorax focal consolidation or pleural effusion."heart""hilar""mediastinal""consolidation""pneumothorax"
BASE +CMM +RLLung volumes are low. Heart size is mildly enlarged. The aorta is tortuous and demonstrates atherosclerotic calcifications at the aortic knob. There is mild pulmonary vascular congestion. Patchy opacities in the lung bases likely reflect areas of atelectasis. There may be a trace left pleural effusion. No focal consolidation or pneumothorax is present."Lung volumes""Heart""atelectasis""vascular congestion""pleural effusion"
Ground TruthThere are low lung volumes. The heart size is mildly enlarged. The aorta is unfolded. There is mild pulmonary vascular congestion with small amount of fluid seen within the fissures. Additionally patchy opacities in the lung bases likely reflect atelectasis. A small left pleural effusion is relatively unchanged compared to prior. No new areas of focal consolidation are present. There is no pneumothorax.
+ +Figure 3: Visualizations of image-text mappings between particular regions (indicated by colored weights) of a chest X-ray image and words/phrases from its reports generated by BASE, BASE+RL, BASE+CMM, , and BASE+CMM+RL, respectively. The color spectrum indicates the value of weight in the range of [0, 1]. + +erated reports whereas BASE can cover few of them. Second, the validity of RL in aligning the cross-modal features can be observed from the fact that $\mathrm{BASE + CMM + RL}$ is able to generate relatively more accurate reports (e.g. "Heart size is mildly enlarged") than $\mathrm{BASE + CMM}$ (e.g. "Heart size is normal") because the former obtains better visual-textual mappings. For example, the abnormality (i.e., "pleural effusion") presented in chest X-ray image is covered by the generated report from $\mathrm{BASE + CMM + RL}$ and the corresponding region on the image is precisely associated with to the texts. + +# 5 Related Work + +The task that is the most relevant to ours is image captioning, which aims to generation text captions that describe the content of the given images (Vinyals et al., 2015; Xu et al., 2015; Anderson et al., 2018; Wang et al., 2019). Being one of its applications and extensions to the medical domain, radiology report generation aims to depicting radiology images with professional texts (Liu et al., 2019; Huang et al., 2019; Miura et al., 2020; Zhang et al., 2020; Alfarghaly et al., 2021; Nooralahzadeh et al., 2021; Najdenkoska et al., 2021; Wang et al., 2021). In general, existing approaches for radiology report generation were mainly designed and proposed to better align images and texts or to + +exploit highly-patternized features of texts. For example, Jing et al. (2018) proposed a co-attention mechanism to simultaneously explore visual and semantic information with a multi-task learning framework; Li et al. (2018) introduced a template database to incorporate patternized information; Chen et al. (2020) improved generation process by applying a memory-driven Transformer to model patternized information; Chen et al. (2021b) proposes memory-based module to model the cross-modal information. In addition, there are studies that use RL to perform report generation (e.g., Jing et al. (2019) utilized multi-agent RL to capture the imbalanced distribution between abnormality and normality), but their focus is not to utilize RL for text and image alignment. Compared to previous studies, our model offers an effective alternative for radiology reports generation, where a soft intermediate layer with RL is provided to facilitate the mappings between visual and textual features, which allows one to produce more accurate descriptions for radiology images. + +# 6 Conclusion + +In this paper, we propose an RL approach based on CMM to better align visual and textual features for radiology report generation. In detail, a shared memory is used to store the cross-modal informa + +tion and RL is applied to leverage the signals from NLG metrics to guide cross-modal mappings so as to better link features from images and texts. The experimental results on two benchmark datasets (i.e., IU X-Ray and MIMIC-XCR) demonstrate the effectiveness of our model, which achieves the state-of-the-art performance on both datasets. Human evaluation and the case study further confirm that our approach is able to generate high-quality reports with meaningful image-text alignment. + +# Acknowledgements + +This work is supported by Shenzhen Science and Technology Program under the project "Fundamental Algorithms of Natural Language Understanding for Chinese Medical Text Processing" (JCYJ20210324130208022) and the Natural Science Foundation of Guangdong Province, China, under the project "Deep Learning based Chinese Combination Category Grammar Parsing and its Application in Relation Extraction". It is also supported by Shenzhen Institute of Artificial Intelligence and Robotics for Society under the project "Automatic Knowledge Enhanced Natural Language Understanding and Its Applications" (AC01202101001). + +# References + +Omar Alfarghaly, Rana Khaled, Abeer Elkorany, Maha Helal, and Aly Fahmy. 2021. Automated radiology report generation using conditioned transformers. Informatics in Medicine Unlocked, 24:100557. +Peter Anderson, Xiaodong He, Chris Buehler, Damien Teney, Mark Johnson, Stephen Gould, and Lei Zhang. 2018. Bottom-Up and Top-Down Attention for Image Captioning and Visual Question Answering. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 6077-6086. +Guimin Chen, Yuanhe Tian, Yan Song, and Xiang Wan. 2021a. Relation Extraction with Type-aware Map Memories of Word Dependencies. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021. +Zhihong Chen, Yaling Shen, Yan Song, and Xiang Wan. 2021b. Cross-modal Memory Networks for Radiology Report Generation. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 5904-5914, Online. +Zhihong Chen, Yan Song, Tsung-Hui Chang, and Xi-ang Wan. 2020. Generating Radiology Reports via + +Memory-driven Transformer. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 1439-1449. +Kyunghyun Cho, Bart Van Merrienboer, Dzmitry Bahdanau, and Yoshua Bengio. 2014. On the properties of neural machine translation: Encoder-decoder approaches. arXiv preprint arXiv:1409.1259. +Marcella Cornia, Matteo Stefanini, Lorenzo Baraldi, and Rita Cucchiara. 2020. Meshed-memory Transformer for Image Captioning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10578-10587. +Dina Demner-Fushman, Marc D Kohli, Marc B Rosenman, Sonya E Shooshan, Laritza Rodriguez, Sameer Antani, George R Thoma, and Clement J McDonald. 2016. Preparing a collection of radiology examinations for distribution and retrieval. Journal of the American Medical Informatics Association, 23(2):304-310. +Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. 2009. ImageNet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pages 248-255. +Michael Denkowski and Alon Lavie. 2011. Meteor 1.3: Automatic Metric for Reliable Optimization and Evaluation of Machine Translation Systems. In Proceedings of the sixth workshop on statistical machine translation, pages 85-91. +Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. 2016. Deep Residual Learning for Image Recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770-778. +Sepp Hochreiter and Jürgen Schmidhuber. 1997. Long short-term memory. Neural computation, 9(8):1735-1780. +Xin Huang, Fengqi Yan, Wei Xu, and Maozhen Li. 2019. Multi-attention and Incorporating Background Information Model for Chest X-ray Image Report Generation. IEEE Access, 7:154808-154817. +Jeremy Irvin, Pranav Rajpurkar, Michael Ko, Yifan Yu, Silviana Ciurea-Ilcus, Chris Chute, Henrik Marklund, Behzad Haghgoo, Robyn Ball, Katie Shpaninskaya, et al. 2019. CheXpert: A Large Chest Radiograph Dataset with Uncertainty Labels and Expert Comparison. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 590-597. +Baoyu Jing, Zeya Wang, and Eric Xing. 2019. Show, Describe and Conclude: On Exploiting the Structure Information of Chest X-ray Reports. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 6570-6580. + +Baoyu Jing, Pengtao Xie, and Eric Xing. 2018. On the Automatic Generation of Medical Imaging Reports. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 2577-2586. +Alistair EW Johnson, Tom J Pollard, Seth J Berkowitz, Nathaniel R Greenbaum, Matthew P Lungren, Chihying Deng, Roger G Mark, and Steven Horng. 2019. MIMIC-CXR: A large publicly available database of labeled chest radiographs. arXiv preprint arXiv:1901.07042. +Diederik P Kingma and Jimmy Ba. 2015. Adam: A Method for Stochastic Optimization. CoRR, abs/1412.6980. +Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. 2020. BART: Denoising Sequence-to-Sequence Pretraining for Natural Language Generation, Translation, and Comprehension. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 7871-7880, Online. +Yuan Li, Xiaodan Liang, Zhiting Hu, and Eric P Xing. 2018. Hybrid Retrieval-Generation Reinforced Agent for Medical Image Report Generation. In Advances in neural information processing systems, pages 1530-1540. +Chin-Yew Lin. 2004. ROUGE: A Package for Automatic Evaluation of Summaries. In Text Summarization Branches Out, pages 74-81. +Fenglin Liu, Shen Ge, and Xian Wu. 2021a. Competence-based multimodal curriculum learning for medical report generation. In ACL, volume 1, page 3. +Fenglin Liu, Xian Wu, Shen Ge, Wei Fan, and Yuexian Zou. 2021b. Exploring and Distilling Posterior and Prior Knowledge for Radiology Report Generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 13753-13762. +Fenglin Liu, Changchang Yin, Xian Wu, Shen Ge, Ping Zhang, and Xu Sun. 2021c. Contrastive attention for automatic chest x-ray report generation. arXiv preprint arXiv:2106.06965. +Guanxiong Liu, Tzu-Ming Harry Hsu, Matthew McDermott, Willie Boag, Wei-Hung Weng, Peter Szolovits, and Marzyeh Ghassemi. 2019. Clinically Accurate Chest X-Ray Report Generation. In *Machine Learning for Healthcare Conference*, pages 249-269. +Jiasen Lu, Caiming Xiong, Devi Parikh, and Richard Socher. 2017. Knowing When to Look: Adaptive Attention via A Visual Sentinel for Image Captioning. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 375-383. + +Alexander Miller, Adam Fisch, Jesse Dodge, Amir-Hossein Karimi, Antoine Bordes, and Jason Weston. 2016. Key-Value Memory Networks for Directly Reading Documents. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 1400-1409. +Yasuhide Miura, Yuhao Zhang, Emily Bao Tsai, Curtis P Langlotz, and Dan Jurafsky. 2020. Improving factual completeness and consistency of image-to-text radiology report generation. arXiv preprint arXiv:2010.10042. +Ivona Najdenkoska, Xiantong Zhen, Marcel Worring, and Ling Shao. 2021. Variational topic inference for chest x-ray report generation. arXiv preprint arXiv:2107.07314. +Yuyang Nie, Yuanhe Tian, Yan Song, Xiang Ao, and Xiang Wan. 2020. Improving Named Entity Recognition with Attentive Ensemble of Syntactic Information. In Findings of the Association for Computational Linguistics: EMNLP 2020, pages 4231-4245. +Farhad Nooralahzadeh, Nicolas Perez Gonzalez, Thomas Frauenfelder, Koji Fujimoto, and Michael Krauthammer. 2021. Progressive Transformer-Based Generation of Radiology Reports. arXiv preprint arXiv:2102.09777. +Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. 2002. BLEU: a Method for Automatic Evaluation of Machine Translation. In Proceedings of the 40th annual meeting on association for computational linguistics, pages 311-318. +Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. 2018. Improving Language Understanding by Generative Pre-training. +Steven J Rennie, Etienne Marcheret, Youssef Mroueh, Jerret Ross, and Vaibhava Goel. 2017a. Self-critical Sequence Training for Image Captioning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 7008-7024. +Steven J Rennie, Etienne Marcheret, Youssef Mroueh, Jerret Ross, and Vaibhava Goel. 2017b. Self-critical Sequence Training for Image Captioning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 7008-7024. +Karen Simonyan and Andrew Zisserman. 2015. Very Deep Convolutional Networks for Large-Scale Image Recognition. CoRR, abs/1409.1556. +Yan Song and Shuming Shi. 2018. Complementary Learning of Word Embeddings. In Proceedings of the Twenty-Seventh International Joint Conference on Artificial Intelligence, IJCAI-18, pages 4368-4374. +Yan Song, Tong Zhang, Yonggang Wang, and Kai-Fu Lee. 2021. ZEN 2.0: Continue Training and Adaptation for N-gram Enhanced Text Encoders. arXiv preprint arXiv:2105.01279. + +Yuanhe Tian, Wang Shen, Yan Song, Fei Xia, Min He, and Kenli Li. 2020. Improving Biomedical Named Entity Recognition with Syntactic Information. BMC Bioinformatics, 21:1471-2105. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In Advances in neural information processing systems, pages 5998-6008. +Oriol Vinyals, Alexander Toshev, Samy Bengio, and Dumitru Erhan. 2015. Show and Tell: A Neural Image Caption Generator. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 3156-3164. +Weixuan Wang, Zhihong Chen, and Haifeng Hu. 2019. Hierarchical Attention Network for Image Captioning. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 8957-8964. +Yixin Wang, Zihao Lin, Jiang Tian, Yang Zhang, Jianping Fan, Zhiqiang He, et al. 2021. Confidence-guided radiology report generation. arXiv preprint arXiv:2106.10887. +Ronald J Williams. 1992. Simple Statistical Gradient-Following Algorithms for Connectionist Reinforcement Learning. Machine learning, 8(3-4):229-256. +Jie Wu, Ian Harris, and Hongzhi Zhao. 2021. Spoken Language Understanding for Task-oriented Dialogue Systems with Augmented Memory Networks. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 797-806, Online. +Kelvin Xu, Jimmy Ba, Ryan Kiros, Kyunghyun Cho, Aaron Courville, Ruslan Salakhudinov, Rich Zemel, and Yoshua Bengio. 2015. Show, Attend and Tell: Neural Image Caption Generation with Visual Attention. In International conference on machine learning, pages 2048-2057. +Kun Xu, Yuxuan Lai, Yansong Feng, and Zhiguo Wang. 2019. Enhancing Key-Value Memory Neural Networks for Knowledge Based Question Answering. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 2937-2947, Minneapolis, Minnesota. +Yixiao Zhang, Xiaosong Wang, Ziyue Xu, Qihang Yu, Alan Yuille, and Daguang Xu. 2020. When radiology report generation meets knowledge graph. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 12910-12917. \ No newline at end of file diff --git a/reinforcedcrossmodalalignmentforradiologyreportgeneration/images.zip b/reinforcedcrossmodalalignmentforradiologyreportgeneration/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..e5b3cf6419f1cba65370352a5a19216997e1eb51 --- /dev/null +++ b/reinforcedcrossmodalalignmentforradiologyreportgeneration/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e180005b9cdf02d7c523337f0e1a3ab4e198f805e3767534519e942eb34241a8 +size 680576 diff --git a/reinforcedcrossmodalalignmentforradiologyreportgeneration/layout.json b/reinforcedcrossmodalalignmentforradiologyreportgeneration/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..a2cc38123ecc1348e44910b805aa119dbeded441 --- /dev/null +++ b/reinforcedcrossmodalalignmentforradiologyreportgeneration/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2c161f6bb36e84d987fda1177ed911554c251a4730e1f7e26d60a19bc5dee58f +size 382829 diff --git a/relationpromptleveragingpromptstogeneratesyntheticdataforzeroshotrelationtripletextraction/8b113ae6-9ac9-415a-bdd4-28669001efaa_content_list.json b/relationpromptleveragingpromptstogeneratesyntheticdataforzeroshotrelationtripletextraction/8b113ae6-9ac9-415a-bdd4-28669001efaa_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..d81a215a117e5e706bb8bd9111279bf68784a3da --- /dev/null +++ b/relationpromptleveragingpromptstogeneratesyntheticdataforzeroshotrelationtripletextraction/8b113ae6-9ac9-415a-bdd4-28669001efaa_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b581b38a7ee2673d4932c633aa3ae93f5bb963b6aed30b13860f280e33a461fc +size 84778 diff --git a/relationpromptleveragingpromptstogeneratesyntheticdataforzeroshotrelationtripletextraction/8b113ae6-9ac9-415a-bdd4-28669001efaa_model.json b/relationpromptleveragingpromptstogeneratesyntheticdataforzeroshotrelationtripletextraction/8b113ae6-9ac9-415a-bdd4-28669001efaa_model.json new file mode 100644 index 0000000000000000000000000000000000000000..d07d57e92730635df09387832f1766ec7ec42f8a --- /dev/null +++ b/relationpromptleveragingpromptstogeneratesyntheticdataforzeroshotrelationtripletextraction/8b113ae6-9ac9-415a-bdd4-28669001efaa_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:93d222838489d7d4972009dd620c81304a589fbf6389f66b7e9da1a0eb2a841f +size 103626 diff --git a/relationpromptleveragingpromptstogeneratesyntheticdataforzeroshotrelationtripletextraction/8b113ae6-9ac9-415a-bdd4-28669001efaa_origin.pdf b/relationpromptleveragingpromptstogeneratesyntheticdataforzeroshotrelationtripletextraction/8b113ae6-9ac9-415a-bdd4-28669001efaa_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..cf470452eddf0ed3ea4e2970391906b7cde281ec --- /dev/null +++ b/relationpromptleveragingpromptstogeneratesyntheticdataforzeroshotrelationtripletextraction/8b113ae6-9ac9-415a-bdd4-28669001efaa_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dbc2ca9e78f3bed187a22903021676cc6252662b8d5ccc92f7b2a23b1b3fe1e0 +size 968468 diff --git a/relationpromptleveragingpromptstogeneratesyntheticdataforzeroshotrelationtripletextraction/full.md b/relationpromptleveragingpromptstogeneratesyntheticdataforzeroshotrelationtripletextraction/full.md new file mode 100644 index 0000000000000000000000000000000000000000..8116b9145b9322748622087dd7bf8dc25b09b4c5 --- /dev/null +++ b/relationpromptleveragingpromptstogeneratesyntheticdataforzeroshotrelationtripletextraction/full.md @@ -0,0 +1,322 @@ +# RelationPrompt: Leveraging Prompts to Generate Synthetic Data for Zero-Shot Relation Triplet Extraction + +Yew Ken Chia\*1, Lidong Bing+1 Soujanya Poria Luo Si + +$^{1}$ DAMO Academy, Alibaba Group $^{\text{®}}$ Singapore University of Technology and Design {yewken.chia, l.bing, luo.si}@alibaba-inc.com {yewken_chia, sporia}@sutd.edu.sg + +# Abstract + +Despite the importance of relation extraction in building and representing knowledge, less research is focused on generalizing to unseen relations types. We introduce the task setting of Zero-Shot Relation Triplet Extraction (ZeroRTE) to encourage further research in low-resource relation extraction methods. Given an input sentence, each extracted triplet consists of the head entity, relation label, and tail entity where the relation label is not seen at the training stage. To solve ZeroRTE, we propose to synthesize relation examples by prompting language models to generate structured texts. Concretely, we unify language model prompts and structured text approaches to design a structured prompt template for generating synthetic relation samples when conditioning on relation label prompts (RelationPrompt). To overcome the limitation for extracting multiple relation triplets in a sentence, we design a novel Triplet Search Decoding method. Experiments on FewRel and Wiki-ZSL datasets show the efficacy of RelationPrompt for the ZeroRTE task and zero-shot relation classification. Our code and data are available at github.com/declare-lab/RelationPrompt. + +# 1 Introduction + +Relation extraction aims to predict relationships between entities in unstructured text, which has applications such as knowledge graph construction (Lin et al., 2015) and question answering (Xu et al., 2016). However, existing approaches often require large datasets of annotated samples which are costly to annotate and have a fixed set of relations. Currently, less research is focused on the zero-shot setting (Wang et al., 2019) where models need to generalize to unseen relation sets without available annotated samples (Wang et al., 2019). + +![](images/305430ffb1844f1d4277c286468a8bbdce3c2d22dafe1360cc1b4b3d5104ed8e.jpg) + +Table 1: Comparison of task settings with our proposed Zero-Shot Relation Triplet Extraction (ZeroRTE). To our knowledge, ZeroRTE is the first task to extract full relation triplets in the zero-shot setting. + +Although there are existing zero-shot relation task settings, they do not require extracting the full relation triplets. The task setting of Zero-Shot Relation Classification $^{1}$ (ZeroRC) was previously introduced by Chen and Li (2021) to classify the relation between a given head and tail entity pair for unseen labels. However, it is not always practical or realistic to assume that the ground-truth entities are readily available. Zero-Shot Relation Slot-Filling (Levy et al., 2017) aims to predict the tail entity based on the provided head entity and relation, but also relies on other methods for entity detection. Thus, it also faces the challenge of error propagation in practice (Zhong and Chen, 2021). + +Hence, we propose a new and challenging task setting called Zero-Shot Relation Triplet Extraction (ZeroRTE). The goal of ZeroRTE is to extract triplets of the form (head entity, tail entity, relation label) from each sentence despite not having any annotated training samples that contain the test relation labels. For a clear comparison between task settings, we provide a summary in Table 1. To our knowledge, this is the first work to extend the task of Relation Triplet Extraction to the zero-shot setting. For example in Figure 1, the training samples may belong to the seen relation set {Sibling, Man- + +ufactorer, Architect\}, while the test samples may belong to the unseen relation set $\{\mathrm{M�llary~Rank}$ Position Played, Record Label\}. Given the annotated training samples in Figure 1a, ZeroRTE aims to extract triplets such as (Nicolas Tindal, Military Rank, Captain) in Figure 1b. + +To solve the challenges of data scarcity, there are several existing approaches. Although distant supervision (Ji et al., 2017) can be used to construct a relation corpus with a many relation types, this approach generally results in lower annotation quality than human annotation. Furthermore, distant supervision remains limited to a fixed set of relation types in the existing knowledge base (Smirnova and Cudré-Mauroux, 2018). Another approach is to formulate the task objective such that the label space is unconstrained. For instance, zero-shot sentence classification can be reframed as entailment (Puri and Catanzaro, 2019) or embedding similarity (Pushp and Srivastava, 2017) objectives. However, the existing formulations are designed for sequence classification tasks, which cannot be directly applied to structured prediction tasks such as relation triplet extraction. A third direction is to leverage pre-trained language models using task-specific prompt templates (Liu et al., 2021) which enables the models to generalize to new tasks with little to no training samples, such as zero-text classification (Zhong et al., 2021). This zero-shot potential is possible by leveraging the semantic information in prompts to query the language comprehension capabilities of pre-trained language models (Radford et al., 2019). + +Hence, we propose RelationPrompt which reframes the zero-shot problem as synthetic data generation. The core concept is to leverage the semantics of relation labels, prompting language models to generate synthetic training samples which can express the desired relations. The synthetic data can then be used to train another model to perform the zero-shot task. This capability is supported by the finding that language models can be prompted to control task-specific aspects of the generated text, such as domain and content (Keskar et al., 2019). For instance, given the relation label "Military Rank" in Figure 1c, it is reasonable to condition the language model and compose a sentence demonstrating the relationship that a person has been bestowed with a certain position in the armed forces. Hence, a possible sentence could be "She is the wife of Lieutenant Colonel George Hocham." + +
RelationSentence
SiblingShe was the mother of Michael and Joel Douglas.
ManufacturerIn late 2012 , Samsung announced its NX300 camera.
ArchitectHis house was designed by Henry Hob Richardson.
+ +(a) Annotation samples of seen relations for training. + +
RelationSentence
Military RankTheir grandson was Group Captain Nicolas Tindal.
Position PlayedMade Chad Brown the highest paid linebacker in NFL.
Record LabelDeadsy signed onto Immortal Records to release "Phantasmagore".
+ +(b) Annotation samples of unseen relations for evaluation. + +
RelationSentence
Military RankShe is the wife of Lieutenant Colonel George Hocham.
Position PlayedHowever, it was Dario Argentino who defended the midfield.
Record Label"The Sun" was first recorded by Pavement in 1982.
+ +(c) Generated synthetic samples of unseen relations. + +Figure 1: Example relation triplet data for ZeroRTE and our formulation as synthetic sentence generation. The head and tail entities are shown in blue and orange, respectively. The ZeroRTE train samples (a) and test samples (b) contain triplets that belong to disjoint relation label sets. We formulate ZeroRTE as generating synthetic samples (c) for the unseen test relation labels. The synthetic data can then be used to train another model to extract relation triplets from the test sentences. We also present more data samples in Appendix A.1. + +where the head entity is "George Hocham" and the tail entity is "Lieutenant Colonel". Given generated samples of sufficient quality and diversity, the synthetic dataset can effectively supervise another model to perform ZeroRTE. + +To encode the relation triplet information as text sequences which can be generated by language models, we unify prompt templates with structured text formats (Paolini et al., 2020). Structured texts use special markers to encode the structured information which can be easily decoded as triplets. However, it is challenging to generate sentences which contain multiple different relation triplets. Designing a complex structured prompt template to encode multiple triplets may compromise the generation quality as the language model needs to manipulate multiple relations at once. Hence, we focus on generating single-triplet samples and explore how this limitation can be overcome by the downstream relation extractor model. Concretely, we propose a method named Triplet Search Decoding which allows the extraction of multiple triplets at prediction time despite training on synthetic samples which contain a single triplet each. + +Contributions. In summary, our main contributions include: (1) We introduce the ZeroRTE + +task setting which overcomes limitations in prior task settings by extending the Relation Triplet Extraction task to the zero-shot setting. ZeroRTE is released as a publicly available benchmark based on the reorganized FewRel (Han et al., 2018) and Wiki-ZSL (Chen and Li, 2021) datasets. (2) In order to make ZeroRTE solvable in a supervised manner, we propose RelationPrompt to generate synthetic relation examples by prompting language models to generate structured texts. (3) We propose Triplet Search Decoding to overcome the limitation for extracting multiple relation triplets in a sentence. (4) RelationPrompt surpasses prior ZeroRC methods and baselines on ZeroRTE, setting the bar for future work. Our analysis shows that the generated samples are reasonable and diverse, hence serving as effective synthetic training data. + +# 2 RelationPrompt: Methodology + +To extract triplets for unseen relation labels in ZeroRTE, we propose a framework called RelationPrompt which uses relation labels as prompts to generate synthetic relation examples of target unseen labels. The synthetic data can then be used to supervise any downstream relation extraction model. Hence, our framework requires two models: a Relation Generator for synthetic relation samples, and a Relation Extractor that will be trained on the synthetic data and used to predict triplets for unseen relations. In order to represent the relation triplet information to be processed by language models, we design structured prompt templates. The relation extractor is designed to support both ZeroRTE and ZeroRC tasks. We further propose Triplet Search Decoding to overcome the challenge of generating relation samples with multiple triplets. + +# 2.1 Task Formulation + +In ZeroRTE, the goal is to learn from the seen dataset $D_{s}$ and generalize to the unseen dataset $D_{u}$ . The datasets $D_{s}$ and $D_{u}$ are used for training and testing respectively, and are originally split from the full dataset which is defined as $D = (S,T,Y)$ where $S$ denotes the input sentences, $T$ denotes the output triplets and $Y$ denotes the set of relation labels present in $D$ . The seen and unseen label sets are predefined and denoted as $Y_{s} = \{y_{s}^{1},\dots,y_{s}^{n}\}$ and $Y_{u} = \{y_{u}^{1},\dots,y_{u}^{m}\}$ respectively, where $n = |Y_s|$ and $m = |Y_u|$ are the size of seen and unseen label sets respectively. Hence, the label sets of $D_{s}$ and $D_{u}$ are disjoint, i.e., $Y_{s}\cap Y_{u} = \emptyset$ . Each data + +![](images/ce6c24e34211a6531c8ef533c86adf2a27ac8f7ca47df6fb64e7a3f2cd6164b8.jpg) +(a) Structured template for relation generator. + +![](images/42847d1504dad2e07ae5c2b685045e06eaf41e95ec15fecabd8f0d8a6b99912a.jpg) +(b) Structured template for relation extractor. +Figure 2: RelationPrompt structured templates. The head entities, tail entities and relation labels are shown in blue, orange and dark red respectively. The relation generator (a) takes the relation label as input and outputs the context and entity pair. The relation extractor (b) takes the sentence as input and outputs the relation triplet which consists of entity pair and relation label. + +sample contains the input sentence $s \in S$ which corresponds to a list $t \in T$ which can contain one or more output triplets. A relation triplet is defined as $(e_{head}, e_{tail}, y)$ which denotes the head entity, tail entity and relation label respectively. To solve ZeroRTE, we formulate the following algorithm: + +Algorithm 1 RelationPrompt: Prompting language models to generate synthetic data for ZeroRTE. + +# Define: + +Dataset $D =$ (Sentences $S$ , Triplets $T$ , Labels $Y$ ) + +Require: Train Dataset $D_{s}$ , Test Dataset $D_{u}$ , Relation Generator $M_{q}$ , Relation Extractor $M_{e}$ . + +Ensure: $Y_{s} \cap Y_{u} = \emptyset$ . + +1: $M_{g,finetune}\gets Train(M_g,D_s)$ +2: $M_{e,finetune} \gets Train(M_e, D_s)$ +3: $D_{\text{synthetic}} \gets \text{Generate}(M_{g,\text{finetune}}, Y_u)$ +4: $M_{e,final} \gets Train(M_{e,finetune}, D_{synthetic})$ +5: $\tilde{T}_u\gets \text{Predict}(M_{e,\text{final}},S_u)$ +6: return Extracted Triplets $\bar{T}_u$ + +# 2.2 Relation Generator + +Language models are implicitly capable of zero-shot generalization based on their general and large-scale pre-training (Radford et al., 2019). Furthermore, text generation has been shown to be effectively controllable (Keskar et al., 2019). Hence, we prompt the language model to generate synthetic samples by conditioning on the target unseen relation labels. As shown in Algorithm 1, relation generator $M_{g}$ is first fine-tuned on samples for the seen dataset $D_{s}$ (line 1) and then prompted by relation labels $Y_{u}$ to generate the synthetic sam + +![](images/ef8986e52943800ce84f99daafca984c7f66a8244c5fe2898f538e7f75808102.jpg) +(a) Training process for relation generator. + +![](images/a5936c49f3d201bfc3af920f6195fd08633d82913d2a185fc1d5ef1d376d2fba.jpg) +(b) Training process for relation extractor. +Figure 3: Model training process. Each head entity, tail entity and relation label is shown in blue, orange and dark red respectively. To conserve space, the sentences shown are shortened and punctuation is not separated. The relation generator (a) is trained with the standard language modeling objective to condition on the relation label and generate the sentence and entity pair. The relation extractor (b) is trained with the standard sequence-to-sequence objective to condition on the input sentence and output the relation triplet of entity pair and relation label. + +plies $D_{\text{synthetic}}$ (line 3). As shown in Figure 2a, the relation generator takes as input a structured prompt in the form of "Relation: $y$ " and outputs a structured output in the form of "Context: $s$ . Head Entity: $e_{head}$ , Tail Entity: $e_{tail}$ ". We employ a causal language model as our relation generator to sample the structured sequence in an autoregressive manner. As shown in 3a, the model $M_g$ is trained using the standard language modeling objective of next-word prediction (Bengio et al., 2001). Given each sequence $x = [x_1, x_2, \ldots, x_n]$ , the goal is to learn the conditional generation probability: + +$$ +p (x) = \prod_ {i = 1} ^ {n} p \left(x _ {i} \mid x _ {< i}\right) \tag {1} +$$ + +To generate diverse output sequences for each input relation prompt, we use sampling with temperature $t$ (Hinton et al., 2015) over the output logits $o$ and vocabulary size $V$ with temperature $tp$ : + +$$ +p \left(x _ {i} \mid x _ {< i}\right) = \frac {\exp \left(o _ {i} / t p\right)}{\sum_ {j = 1} ^ {| V |} \exp \left(o _ {j} / t p\right)} \tag {2} +$$ + +The output sequences are decoded into relation triplets by splitting on the special terms "Context:," "Head Entity:" and "Tail Entity:". In case of decoding errors where an entity is not found in the generated context, we discard that sample and continue generating until a fixed amount of valid samples is reached. + +# 2.3 Relation Extractor + +Given the generated samples of unseen relations, we can train a relation extractor model $M_e$ to predict the relation triplets in a zero-shot setting. As shown in Algorithm 1, relation extractor $M_e$ is first fine-tuned on samples for the seen dataset $D_s$ (line 2) and finally tuned on the synthetic samples $D_{synthetic}$ (line 4). Lastly, $M_e$ is used to predict and extract relation triplets $\hat{T_u}$ from the test sentences $S_u$ (lines 5 and 6). We adopt a sequence-to-sequence learning approach which is flexible and effective for structured prediction tasks (Cui et al., 2021; Paolini et al., 2020). As shown in Figure 2b, the relation extractor takes as input a structured prompt containing the sentence $s$ in the form of "Context: $s$ ". It then generates a structured output sequence containing a single pair of entities $e_{head}$ and $e_{tail}$ satisfying the relation $y$ , in the form of "Head Entity: $e_{head}$ , Tail Entity: $e_{tail}$ , Relation: $y$ ". As shown in Figure 3b, we use a standard sequence-to-sequence objective (Lewis et al., 2020) for training and greedy decoding for generation. To predict a single relation triplet in a given sentence $s$ , we can generate the model outputs without any initial decoder input, as seen in Figure 4a. In case of invalid entity or relation, we treat it as null prediction for that sample. On the other hand, prediction for ZeroRC is easily supported by providing the entity information as the initial decoder input. As shown + +![](images/93b1ef8b5e58b9bbe28d0260336b12d3661c15072a96c3def8f034bc0cd21cc2.jpg) +(c) Triplet search decoding for multi-triplet extraction. +Figure 4: Comparison of generation decoding methods with our proposed Triplet Search Decoding. The head entities, tail entities and relation labels are shown in blue, orange and dark red respectively. Unconditional decoding (a) can be used to predict one relation triplet in each sentence for ZeroRTE. Entity-conditioned decoding (b) can be used to predict only the relation label between the given entity pair for ZeroRC. Our proposed triplet search decoding (c) can be used to predict multiple triplets in each sentence for ZeroRTE. + +in Figure 4b, the model takes "Context: $s$ , Head Entity: $e_{head}$ , Tail Entity: $e_{tail}$ , Relation:" as decoder input to generate "y" as output. Hence, our method naturally encompasses both ZeroRTE and ZeroRC as this change affects model prediction and not training. + +# 2.4 Extracting Multiple triplets using Triplet Search Decoding + +We further propose a generation decoding method in order to improve the zero-shot extraction performance on sentences which contain multiple triplets. For the RelationPrompt generation of synthetic data, each sample is limited to contain a single relation triplet. Hence, conventional models for triplet extraction most likely cannot perform well with our framework for multi-triplet ZeroRTE as they normally assume that the training samples may contain multiple triplets per sentence. The inference method of multi-turn question answering (Li et al., 2019) may mitigate this issue, but cannot scale easily to unseen relations as it relies on hand-crafted question templates which are specific to certain relation and entity types. Hence, we propose Triplet Search Decoding which improves multi-triplet ZeroRTE for the relation extractor. + +Given the relation extractor which takes a sentence as input and generates output sequences in + +an autoregressive fashion, greedy decoding as in Figure 4a can output a single sequence. However, Triplet Search Decoding as shown in Figure 4c can output multiple sequences that each correspond to a different candidate relation triplet. We then apply a likelihood threshold to filter the final output sequences. The core concept is enumerating multiple output sequences during generation by considering multiple candidates for the head entity, tail entity and relation label respectively. Starting from the special sub-sequence "Head Entity:" it follows from our template in Figure 3b that the next generated token should be the first token of the head entity, such as "Nicolas". For the $i^{th}$ possible first token of the head entity, we denote the softmax probability as $p(e_{head,i})$ . We only consider the probability of the first token as it can mostly determine the following generated tokens of the entity (Zhao et al., 2021). Instead of greedily decoding the entire sequence, we branch the generation into $b$ sequences based on the tokens with the top $b$ highest $p(e_{head,i})$ . Thereafter, the sequence is greedily decoded until the special sub-sequence "Tail Entity:" is generated. The following token will then be the first token of the tail entity, such as "Captain". The $j^{th}$ tail entity first token probability is denoted as $p(e_{tail,j}|e_{head,i})$ . Hence, the generation is branched such that for each head entity, there will be another $b$ sequences based on the tokens with the top $b$ highest $p(e_{tail,j}|e_{head,i})$ . Thereafter, the sequence is greedily decoded until the special sub-sequence "Relation:" is generated. The next generated token will be the first token of the relation label, such as "Military" in "Military Rank". The $k^{th}$ relation first token probability is denoted as $p(y_k|e_{head,i}, e_{tail,j})$ . We branch the generation such that for each pair of head entity and tail entity, there will be another $b$ sequences based on the tokens with the top $b$ highest $p(y_k|e_{head,i}, e_{tail,j})$ . For each sequence, the generation proceeds greedily until the end token is reached, and the overall inference probability is aggregated as: + +$$ +\begin{array}{l} p (t r i p l e t _ {i, j, k}) = p \left(e _ {h e a d, i}, e _ {t a i l, j}, y _ {k}\right) \\ = p \left(y _ {k} \mid e _ {\text {h e a d}, i}, e _ {\text {t a i l}, j}\right) \tag {3} \\ \cdot p \left(e _ {t a i l, j} \mid e _ {h e a d, i}\right) \\ \cdot p (e _ {h e a d, i}) \\ \end{array} +$$ + +We note that the conditional assumption does not directly consider the other context tokens as they consist of the special sub-sequences which are fixed as part of our generation template. The input sen + +tence $s$ is also not included in the formulation as it is the same when considering multiple output triplets for one sample. At this point, there will be $b^3$ sequences, each corresponding to a different candidate relation triplet. To filter the final output sequences, we use a probability threshold over that is tuned on the validation $F_{1}$ metric, with hyperparameter details in Section A.2. Compared to previous generative extraction methods (Paolini et al., 2020; Nayak and Ng, 2020), Triplet Search Decoding allows the probability $p(triplet_{i,j,k})$ of each output triplet to be directly calculated and hence control the number of output triplets using the threshold. Compared to other decoding methods such as beam search, Triplet Search Decoding leverages the specific relation triplet structure in our structured text templates. Hence, it can ensure that each output sequence corresponds to a different relation triplet. Furthermore, Triplet Search Decoding is more interpretable than existing generative methods for triplet extraction as it can directly provide the prediction probability for each triplet. More importantly for ZeroRTE, this decoding process allows the relation extractor to naturally predict multiple triplets at test time despite training on synthetic samples which have a single triplet each. + +# 3 Experiments + +# 3.1 Datasets + +We use the following two datasets for our experiments. FewRel (Han et al., 2018) was hand-annotated for few-shot relation extraction, but we made it suitable for the zero-shot setting after data splitting into disjoint relation label sets for training, validation and testing. Wiki-ZSL (Chen and Li, 2021) is constructed through distant supervision over Wikipedia articles and the Wikidata knowledge base. The dataset statistics are shown in Table 2. To partition the data into seen and unseen label sets, we follow the same process as Chen and Li (2021) to be consistent. For each dataset, a fixed number of labels are randomly selected as unseen labels while the remaining labels are treated as seen labels during training. To study the performance of methods under different settings of unseen label set size $m$ , we use $m \in \{5, 10, 15\}$ in our experiments. In order to reduce the effect of experimental noise, the label selection process is repeated for five different random seeds to produce different data folds. For each data fold, the test set consists of the sentences containing unseen labels. Five + +
SamplesEntitiesRelationsSentence Length
Wiki-ZSL94,38377,62311324.85
FewRel56,00072,9548024.95
+ +Table 2: Dataset statistics. "Sentence Length" refers to the average number of words in each sentence. + +validation labels from the seen labels are used to select sentences for early stopping and hyperparameter tuning. The remaining sentences are treated as the train set. Hence, the zero-shot setting ensures that train, validation and test sentences belong to disjoint label sets. + +# 3.2 Experimental Settings + +For the relation generator, we fine-tune the pre-trained GPT-2 (Radford et al., 2019) which has 124M parameters. For the relation extractor, we fine-tune the pre-trained BART (Lewis et al., 2020) which has 140M parameters. In both cases, the finetuning is performed on the training set for up to five epochs and early stopping is based on the validation loss. The learning rate is 3e-5 with linear warm up for the first $20\%$ of training steps and batch size is set to 128. During the training process, we use the AdamW optimizer (Loshchilov and Hutter, 2019). The relation generator is used to generate synthetic samples based on the validation and test set label names. A fixed amount of sentences will be generated for each relation. The relation extractor is fine-tuned again on the synthetic relation sentences and then used for evaluation on the test set. + +To perform evaluation for ZeroRTE, we evaluate the triplet extraction results separately for sentences containing single triplets and multiple triplets. To evaluate multiple triplet extraction, we use the Micro $F_{1}$ metric which is standard in structured prediction tasks (Paolini et al., 2020) and report the precision (P.) and recall (R.). Evaluating single triplet extraction involves only one possible triplet for each sentence, hence the metric used is Accuracy (Acc.). We evaluate on ZeroRC using the Macro $F_{1}$ metric to be consistent with Chen and Li (2021). Table 3 and 4 report the average results across five data folds as detailed in Section 3.1. + +# 3.3 Baseline Methods + +ZeroRTE As ZeroRTE is a new task setting, we provide two baseline methods for comparison with our RelationPrompt method. Firstly, our relation + +
Unseen LabelsModelSingle TripletMulti Triplet
Wiki-ZSLFewRelWiki-ZSLFewRel
Acc.Acc.P.R.F1P.R.F1
m=5TableSequence (Wang and Lu, 2020)14.4711.8243.683.516.2915.231.913.40
NoGen9.0511.4915.5843.2322.269.4536.7414.57
RelationPrompt16.6422.2729.1131.0030.0120.8024.3222.34
m=10TableSequence (Wang and Lu, 2020)9.6112.5445.313.576.428.933.606.37
NoGen7.1012.409.6345.0115.706.4041.7011.02
RelationPrompt16.4823.1830.2032.3131.1921.5928.6824.61
m=15TableSequence (Wang and Lu, 2020)9.2011.6544.433.536.3919.031.993.48
NoGen6.6110.937.2544.6812.344.6136.398.15
RelationPrompt16.1618.9726.1932.1228.8517.7323.2020.08
+ +extractor can be made to perform ZeroRTE without fine-tuning on synthetic samples as it is trained to extract triplets on the sentences of the seen relation set. At prediction time, we constrain the generated labels to be selected from the target label names by masking the generated token probabilities. We denote this model as "NoGen" to indicate that it does not use generated synthetic samples for training. Secondly, we use an existing triplet extraction model known as TableSequence (Wang and Lu, 2020). As it is normally unable to perform ZeroRTE, we provide supervision using synthetic samples from our relation generator. + +ZeroRC There are three main categories of competing methods for ZeroRC. Firstly, R-BERT (Wu and He, 2019) is a relation classification model but can be adapted to the zero-shot setting by using the sentence representations to perform nearest neighbor search over label embeddings. Next, CIM (Rocktäschel et al., 2016) is an entailment-based method which takes the sentence and each possible relation as input to perform binary classification whether the label matches the sentence semantically. Lastly, ZS-BERT (Chen and Li, 2021) generates sentence representations that are conditioned on the provided entity pair information, and performs nearest neighbor search over embeddings of the candidate relation descriptions. + +# 3.4 Experimental Results + +Triplet Extraction We compare RelationPrompt with the baselines on ZeroRTE for Wiki-ZSL and FewRel datasets in Table 3. In both single-triplet and multi-triplet evaluation, our method consistently outperforms the baseline methods in terms of Accuracy and $F_{1}$ metrics respectively. Although we do not observe a consistent advantage in preci + +Table 3: Results for Zero-Shot Relation Triplet Extraction (ZeroRTE). + +
Unseen +LabelsModelWiki-ZSLFewRel
P.R.F1P.R.F1
m=5R-BERT39.2243.2741.1542.1948.6145.17
CIM49.6348.8149.2258.0561.9259.92
ZS-BERT71.5472.3971.9676.9678.8677.90
NoGen51.7846.7648.9372.3658.6164.57
RelationPrompt70.6683.7576.6390.1588.5089.30
m=10R-BERT26.1829.6927.8225.5233.0228.20
CIM46.5447.9045.5747.3949.1148.23
ZS-BERT60.5160.9860.7456.9257.5957.25
NoGen54.8736.5243.8066.4748.2855.61
RelationPrompt68.5174.7671.5080.3379.6279.96
m=15R-BERT17.3118.8218.0316.9519.3718.08
CIM29.1730.5829.8631.8333.0632.43
ZS-BERT34.1234.3834.2535.5438.1936.82
NoGen54.4529.4337.4566.4940.0549.38
RelationPrompt63.6967.9365.7474.3372.5173.40
+ +Table 4: Zero-Shot Relation Classification (ZeroRC). + +sion and recall scores for multi-triplet extraction, the baseline methods cannot achieve a balanced precision-recall ratio, leading to poor overall $F_{1}$ results. The results difference between NoGen and RelationPrompt also indicate that using the synthetic samples from the relation generator is critical, as the $F_{1}$ score can be improved by more than two times in some cases. This also suggests that the relation generator can produce reasonable-quality synthetic sentences as training data for the downstream relation extractor. We also observe that the choice of relation extractor for ZeroRTE is not trivial, as the third-party TableSequence (Wang and Lu, 2020) has significantly worse performance when compared to RelationPrompt, especially for multi-triplet extraction. Although the TableSequence model is able to perform multi-triplet extraction by design, it assumes that the training data may contain multi-triplet sentences, whereas our synthetic data is limited to single triplet samples. On the other hand, our proposed relation extractor and decoding method effectively overcomes this chal + +
ModelF1ΔF1
Full Method28.41
- Triplet Search Decoding14.53-13.88
- Extractor Fine-Tuning (Seen Relations)13.57-14.84
+ +Table 5: Ablation results for multi-triplet ZeroRTE. + +lenge by naturally enumerating and ranking multiple triplets at inference time. + +Relation Classification RelationPrompt naturally supports the ZeroRC task without additional training by providing the entity pair information in the prompt. In Table 4, we observe consistent improvements compared to the prior state-of-the-art method ZS-BERT (Chen and Li, 2021). Notably, our method is able to maintain a relatively high classification $F_{1}$ performance when the unseen label set size $m$ increases, whereas ZS-BERT shows a sharper drop in performance. The trend suggests that RelationPrompt is able to scale better to larger unseen label sets, which is more important for open-domain applications. This advantage may further indicate that our method can leverage the semantic information of relation labels more effectively through the token-level conditional generation and extraction stages. On the other hand, ZS-BERT relies on sequence-level representations which can only preserve the high-level label semantics. + +# 4 Analysis + +# 4.1 Ablation Study + +We conduct an ablation study to examine the performance of our decoding method and task-specific fine-tuning on the seen relation set for multi-triplet ZeroRTE, and the results are shown in Table 5. The comparison is conducted on the Wiki-ZSL validation set with 10 unseen labels. The large performance gap shows that Triplet Search Decoding is critical for multi-triplet ZeroRTE, and suggests that the enumeration and ranking of relation triplet candidates are of sufficiently high quality. Secondly, we observe a significant drop in performance when the relation extractor is not fine-tuned on seen relation samples from the train set before the final tuning on generated synthetic samples for unseen labels. This case suggests that the initial fine-tuning on sentences for seen relations is useful for learning the general task of relation triplet extraction. The learned representations can then be further finetuned on the synthetic samples to adapt specifically for the unseen relations to achieve optimal results. + +# 4.2 Effect of Generated Data Size + +We further study how the number of generated synthetic samples effects the multi-triplet ZeroRTE performance. The evaluation is based on Wiki-ZSL validation set with 10 unseen labels, and the results are shown in Figure 6. Increasing the amount from 125 to 250 samples per label improves $F_{1}$ score. However, further increasing the generated size up to 2000 does not improve the final performance. This indicates that although the synthetic data is beneficial for ZeroRTE, excessive amounts can lead to over-fitting due to noise. We further analyze the generation diversity in Appendix A.3. + +# 4.3 Qualitative Analysis + +To assess how the relation data generator generalizes to relations in the wild, we present several samples of real and generated samples in Figure 5. The relation labels and real sentences were collected from factual articles. Given the relations "Investor", "D defeated By" and "Currency Of", the generator is able to determine the correct semantic meaning of the relations and compose reasonable sentences. In most cases, the generated head and tail entity pairings can match the given relations and have a similar context to the real sentences. However, in the last case for relation "Political Partner", the generated entity pair does not match the relation meaning despite being grounded in a political context. Instead, the generated sentence expresses a relationship that is closer to "Political Party". This suggests that a future area of improvement could be to match the generated head and tail entity more closely to the given relation. + +# 5 Related Work + +Zero-Shot Relation Extraction Zero-shot relation extraction was previously framed as a slot-filling task and solved by reading comprehension methods (Levy et al., 2017). However, their approach requires manual template design for each relation label, which cannot scale well to new relation types. Another approach to zero-shot relation extraction is the formulation into an entailment task (Obamuyide and Vlachos, 2018), which is not constrained to a fixed relation label space. Instead, the entailment approach determines if arbitrary pairs of sentences and relation labels are compatible. However, it is designed for sentence classification and cannot be applied to ZeroRTE. + +
RelationReal SentenceGenerated Sentence
InvestorIn October 1999, Alibaba received a US $25 million investment from Goldman Sachs and SoftBank.In 2001, CSC announced that it is investing in a record 65 plants in South Africa and plans to invest $2 billion in hydropower, hydrological services and agriculture.
Defeated ByNational shuttle Loh Kean Yew recorded a 24-22, 21-14 win over All-England champion Lee Zii Jia.The team lost three consecutive draws to the New York Knicks, including a 9-2 win against the Lakers
Currency OfEl Salvador, on the other hand, has accepted Bitcoin (BTC) as a legal currency.In 2001, as the euro strengthened, Italy introduced an extension of the Eurobill (Eurobills), the currency of the Eurozone.
Political PartnerBeijing and the Holy See reached a provisional agreement in 2018 on the appointment of Chinese bishops.His son, Thomas, was a leading Republican, elected to the Massachusetts State Senate in 1881.
+ +![](images/a6e7e5f329985e45ea59030c8dc632fd1def3d049c091039b5a8b22de47733de.jpg) +Figure 5: Case study between real and generated samples for relations in the wild. The head and tail entities are shown in blue and orange respectively. +Figure 6: Effect of generated data size on ZeroRTE. + +Data Augmentation A popular method for improving model performance in supervised low-resource tasks is data augmentation. Simple heuristics such as token manipulation (Kobayashi, 2018) were initially developed, new methods in language modeling improved the quality of augmented samples (Xie et al., 2020; Wei and Zou, 2019). Although there are data augmentation methods that can be applied to structured tasks such as named entity recognition (Ding et al., 2020) and relation extraction (Papanikolaou and Pierleoni, 2020; Lee et al., 2021), they require existing training samples and cannot be easily adapted to zero-shot tasks. + +Knowledge Retrieval RelationPrompt also leverages the knowledge stored in language models (Roberts et al., 2020) to compose relation samples that are grounded in realistic contexts. To ensure that the generated samples are factually accurate, the language model requires strong knowledge retrieval capabilities (Petroni et al., 2019). + +Language Model Prompts Prompting-based methods have shown promise as a new paradigm for zero-shot or few-shot inference in natural language processing (Liu et al., 2021). Another advantage is the potential to adapt very large language models (Reynolds and McDonell, 2021) to new tasks without relatively expensive fine-tuning. Con- + +current works (Meng et al., 2022; Ye et al., 2022) also show that language models can generate synthetic training data. However, such methods have not yet proven effective for more complex tasks such as triplet extraction. + +Structured Prediction RelationPrompt generates synthetic data for relation triplet extraction, which is a structured prediction task. Hence, it can be widely applicable to other structured prediction tasks such as named entity recognition (Aly et al., 2021), event extraction (Huang et al., 2018) or aspect sentiment triplet extraction (Xu et al., 2021). + +# 6 Conclusions and Future Work + +In this work, we introduce the task setting of Zero-Shot Relation Triplet Extraction (ZeroRTE) to overcome fundamental limitations in previous task settings and encourage further research in low-resource relation extraction. To solve ZeroRTE, we propose RelationPrompt and show that language models can effectively generate synthetic training data through relation label prompts to output structured texts. To overcome the limitation for extracting multiple relation triplets in a sentence, we propose the Triplet Search Decoding method which is effective and interpretable. Results show that our method surpasses prior ZeroRC methods as well as strong baselines on ZeroRTE, setting the bar for future work. As mentioned in Section 4.3, a future direction for improvement could be to ensure that the generated entity spans are more compatible with the semantics of the relation in the language model prompt. + +# References + +Rami Aly, Andreas Vlachos, and Ryan McDonald. 2021. Leveraging type descriptions for zero-shot named entity recognition and classification. In Proc. of ACL. +Yoshua Bengio, Réjean Ducharme, Pascal Vincent, and Christian Janvin. 2001. A neural probabilistic language model. In Proc. of NeurIPS. +Chih-Yao Chen and Cheng-Te Li. 2021. Zs-bert: Towards zero-shot relation extraction with attribute representation learning. In Proc. of NAACL. +Leyang Cui, Yu Wu, Jian Liu, Sen Yang, and Yue Zhang. 2021. Template-based named entity recognition using BART. In Findings of ACL-IJCNLP. +Bosheng Ding, Linlin Liu, Lidong Bing, Canasai Kru-engkrai, Thien Hai Nguyen, Shafiq Joty, Luo Si, and Chunyan Miao. 2020. DAGA: Data augmentation with a generation approach for low-resource tagging tasks. In Proc. of EMNLP. +Xu Han, Hao Zhu, Pengfei Yu, Ziyun Wang, Yuan Yao, Zhiyuan Liu, and Maosong Sun. 2018. Fewrel: A large-scale supervised few-shot relation classification dataset with state-of-the-art evaluation. In Proc. of EMNLP. +Geoffrey E. Hinton, Oriol Vinyals, and Jeffrey Dean. 2015. Distilling the knowledge in a neural network. CoRR, abs/1503.02531. +Lifu Huang, Heng Ji, Kyunghyun Cho, Ido Dagan, Sebastian Riedel, and Clare Voss. 2018. Zero-shot transfer learning for event extraction. In Proc. of ACL. +Guoliang Ji, Kang Liu, Shizhu He, and Jun Zhao. 2017. Distant supervision for relation extraction with sentence-level attention and entity descriptions. In Proc. of AAAI. +Nitish Shirish Keskar, Bryan McCann, Lav R Varshney, Caiming Xiong, and Richard Socher. 2019. Ctrl: A conditional transformer language model for controllable generation. CoRR, arXiv:1909.05858. +Sosuke Kobayashi. 2018. Contextual augmentation: Data augmentation by words with paradigmatic relations. In Proc. of NAACL. +Kenton Lee, Kelvin Guu, Luheng He, Tim Dozat, and Hyung Won Chung. 2021. Neural data augmentation via example extrapolation. CoRR, arXiv:2102.01335. +Omer Levy, Minjoon Seo, Eunsol Choi, and Luke Zettlemoyer. 2017. Zero-shot relation extraction via reading comprehension. In Proc. of CoNLL. +Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. + +2020. Bart: Denoising sequence-to-sequence pretraining for natural language generation, translation, and comprehension. In Proc. of ACL. +Xiaoya Li, Fan Yin, Zijun Sun, Xiayu Li, Arianna Yuan, Duo Chai, Mingxin Zhou, and Jiwei Li. 2019. Entity-relation extraction as multi-turn question answering. In Proc. of ACL. +Yankai Lin, Zhiyuan Liu, Maosong Sun, Yang Liu, and Xuan Zhu. 2015. Learning entity and relation embeddings for knowledge graph completion. In Proc. of AAAI. +Pengfei Liu, Weizhe Yuan, Jinlan Fu, Zhengbao Jiang, Hiroaki Hayashi, and Graham Neubig. 2021. Pretrain, prompt, and predict: A systematic survey of prompting methods in natural language processing. CoRR, arXiv:2107.13586. +Ilya Loshchilov and Frank Hutter. 2019. Decoupled weight decay regularization. In Proc. of ICLR. +Yu Meng, Jiaxin Huang, Yu Zhang, and Jiawei Han. 2022. Generating training data with language models: Towards zero-shot language understanding. CoRR, arXiv:2202.04538. +Tapas Nayak and Hwee Tou Ng. 2020. Effective modeling of encoder-decoder architecture for joint entity and relation extraction. In Proc. of AAAI. +Abiola Obamuyide and Andreas Vlachos. 2018. Zero-shot relation classification as textual entailment. In Proc. of FEVER. +Giovanni Paolini, Ben Athiwaratkun, Jason Krone, Jie Ma, Alessandro Achille, Rishita Anubhai, Cicero Nogueira dos Santos, Bing Xiang, and Stefano Soatto. 2020. Structured prediction as translation between augmented natural languages. In Proc. of ICLR. +Yannis Papanikolaou and Andrea Pierleoni. 2020. DARE: data augmented relation extraction with GPT-2. CoRR, arXiv:2004.13845. +Fabio Petroni, Tim Rocttäschel, Sebastian Riedel, Patrick Lewis, Anton Bakhtin, Yuxiang Wu, and Alexander Miller. 2019. Language models as knowledge bases? In Proc. of EMNLP-IJCNLP. +Raul Puri and Bryan Catanzaro. 2019. Zero-shot text classification with generative language models. CoRR, arXiv:1912.10165. +Pushpankar Kumar Pushp and Muktabh Mayank Srivastava. 2017. Train once, test anywhere: Zero-shot learning for text classification. CoRR, arXiv:1712.05972. +Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. 2019. Language models are unsupervised multitask learners. OpenAI. + +Laria Reynolds and Kyle McDonell. 2021. Prompt programming for large language models: Beyond the few-shot paradigm. In Proc. of CHI. +Adam Roberts, Colin Raffel, and Noam Shazeer. 2020. How much knowledge can you pack into the parameters of a language model? In Proc. of EMNLP. +Tim Rocktäschel, Edward Grefenstette, Karl Moritz Hermann, Tomás Kocisky, and Phil Blunsom. 2016. Reasoning about entailment with neural attention. In Proc. of ICLR. +Alisa Smirnova and Philippe Cudre-Mauroux. 2018. Relation extraction using distant supervision: A survey. CSUR, 51(5):1:35. +Jue Wang and Wei Lu. 2020. Two are better than one: Joint entity and relation extraction with table-sequence encoders. In Proc. of EMNLP. +Wei Wang, Vincent W. Zheng, Han Yu, and Chunyan Miao. 2019. A survey of zero-shot learning: Settings, methods, and applications. TIST, 10(2):1:37. +Jason Wei and Kai Zou. 2019. Eda: Easy data augmentation techniques for boosting performance on text classification tasks. In Proc. of EMNLP-IJCNLP. +Shanchan Wu and Yifan He. 2019. Enriching pretrained language model with entity information for relation classification. In Proc. of CIKM. +Qizhe Xie, Zihang Dai, Eduard Hovy, Thang Luong, and Quoc Le. 2020. Unsupervised data augmentation for consistency training. In Proc. of NeurIPS. +Kun Xu, Siva Reddy, Yansong Feng, Songfang Huang, and Dongyan Zhao. 2016. Question answering on freebase via relation extraction and textual evidence. In Proc. of ACL. +Lu Xu, Yew Ken Chia, and Lidong Bing. 2021. Learning span-level interactions for aspect sentiment triplet extraction. In Proc. of ACL. +Jiacheng Ye, Jiahui Gao, Qintong Li, Hang Xu, Jiangtao Feng, Zhiyong Wu, Tao Yu, and Lingpeng Kong. 2022. Zerogen: Efficient zero-shot learning via dataset generation. CoRR, arXiv:2202.07922. +Zihao Zhao, Eric Wallace, Shi Feng, Dan Klein, and Sameer Singh. 2021. Calibrate before use: Improving few-shot performance of language models. In Proc. of ICML. +Ruiqi Zhong, Kristy Lee, Zheng Zhang, and Dan Klein. 2021. Meta-tuning language models to answer prompts better. In *Findings of EMNLP*. +Zexuan Zhong and Danqi Chen. 2021. A frustratingly easy approach for entity and relation extraction. In Proc. of NAACL. + +![](images/f73ab7bd9e0d71bf0f5ce88c2ac10093a52e7e905b905bc75efc09207b784a2d.jpg) +(a) Annotation Samples of Unseen Relations in FewRel Dataset + +![](images/a529662e2b20a060ccda87d2c9b64d8d0ddf81cc075ea8732f1cd83e2a95b50d.jpg) +(b) Annotation Samples of Unseen Relations in Wiki-ZSL Dataset +Figure 7: Additional sentence samples from the datasets. The head and tail entities are shown in blue and orange, respectively. +Figure 8: Additional synthetic samples from the generated outputs. The head and tail entities are shown in blue and orange, respectively. + +# A Appendix + +# A.1 Additional Data Samples + +Dataset Samples To further illustrate the datasets used, we show test samples in Figure 7. The samples are taken from the FewRel (a) and Wiki-ZSL (b) test sets respectively with 10 unseen relation labels. + +Synthetic Samples To further examine the output of the relation generator, we show test samples in Figure 8. The samples are generated from the FewRel (a) and Wiki-ZSL (b) test set labels respectively with 10 unseen relation labels. + +# A.2 Implementation Details + +Generating Structured Texts We use the relation generator model to generate synthetic sentences in an autoregressive fashion. To convert the structured text outputs to relation triplet samples, we perform simple string processing on the output templates shown in Figure 3a to separate the structured content from the natural text. In case of a small amount of conversion errors, we continue to generate samples until the amount of sentences + +![](images/af29ca184e2ec09e1fc36ab2f66e3865055f165b2a443c2172951b0dbc38ef02.jpg) +(a) Generated Samples of Unseen Relations in FewRel Dataset + +![](images/1ca635568b162a32d94a2bda68330d0c62d9fccb8ad430282f2f33cfb8d8889b.jpg) +(b) Generated Samples of Unseen Relations in Wiki-ZSL Dataset + +generated per label is reached. For the relation extractor model, we perform a similar processing on the output templates in Figure 3b to extract the predicted relation triplets. However, in case of processing errors, we do not continue generation and instead treat it as a prediction failure for that input sample. + +Hyperparameters We show more detailed hyperparameters used in Table 6. We run a grid search on the Wiki-ZSL validation set with 10 unseen labels for multi-triplet ZeroRTE $F_{1}$ metric. A grid search is used to tune the hyperparameters. For number of generated samples per label, we consider the values {125, 250, 500, 1000, 2000}. To tune the Triplet Search Decoding threshold, we consider fifty evenly-spaced values from the interval over the minimum and maximum output scores of all candidate triplets on the validation set. Due to computational constraints, we consider the number of branches to consider at each stage a fixed value, and do not tune it as a hyperparameter. + +Computing Infrastructure The experiments are conducted on NVIDIA V100 GPUs, and each experiment is run on a single GPU with 32 GB of + +
Value
Generator Maximum Sequence Length128
Generator Sampling Top-K50
Generator Sampling Temperature1.0
Extractor Maximum Input Length128
Extractor Maximum Output Length128
Training Dropout Probability0.1
Generated Samples Per Label250
Triplet Search Decoding Top-N Branches4
Triplet Search Decoding Threshold-0.9906
+ +Table 6: Additional hyperparameters. + +
SamplesUnique EntitiesUnique Words
Real Data3461309014736
Generated Data3461494910558
+ +Table 7: Data diversity comparison. + +memory and mixed precision settings. + +# A.3 Further Analysis + +Generated Sample Diversity Our method for ZeroRTE heavily depends on the quality of the generated data. Hence, we compare the diversity of real and synthetic data samples. Concretely, we measure the number of unique words and entities present in the texts. We used the Wiki-ZSL validation set sentences with five unique labels and generate an equal amount of synthetic sentences for comparison. Table 7 shows that the diversity of unique entities is actually greater for the generated sentences. However, the generated sentences have lower diversity of overall unique words. This may be explained by the fact that entity names tend to be unique, and the generator language model has seen a vast number of unique entity names during the large-scale pre-training. On the other hand, the total unique words are mostly determined by the non-entity words. By using prompts to condition the generation of sentences specifically for unseen relation labels, this may constrain the diversity of contextual information in the output sentences. + +Performance Across Relations To study how the performance varies across different relation labels, we evaluate single-triplet ZeroRTE on the Wiki-ZSL test set with 10 unseen labels. Figure 9 shows that the model is able to perform well for relations such as "Drafted By" and "Sports Discipline Competed In". However, it performs more poorly for relations such as "Official Language" and "Employer". This suggests that RelationPrompt per + +![](images/f72eebe743b85b46960f7807746185d0ac6206bbdfd4e53f5dab003c4a44552f.jpg) +Figure 9: Separate evaluation on relation labels. + +forms best for relations which are highly specific to constrain the output context more effectively. \ No newline at end of file diff --git a/relationpromptleveragingpromptstogeneratesyntheticdataforzeroshotrelationtripletextraction/images.zip b/relationpromptleveragingpromptstogeneratesyntheticdataforzeroshotrelationtripletextraction/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..db01551d0de2269dd47780af49af103cac40d64e --- /dev/null +++ b/relationpromptleveragingpromptstogeneratesyntheticdataforzeroshotrelationtripletextraction/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5aa23517bbb0e310d7508d0b6698a7c8f9fc77f9eb88190cb91f097fb458b1dd +size 691292 diff --git a/relationpromptleveragingpromptstogeneratesyntheticdataforzeroshotrelationtripletextraction/layout.json b/relationpromptleveragingpromptstogeneratesyntheticdataforzeroshotrelationtripletextraction/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..656bc719bf99533ac4061df21023e89e4419bf22 --- /dev/null +++ b/relationpromptleveragingpromptstogeneratesyntheticdataforzeroshotrelationtripletextraction/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2ae3d746e6d5e426fcf8f24178e34de1afd8a29e6f0cc65b5eeb5efb3651920a +size 413907 diff --git a/relevantcommonsensesubgraphsforwhatifproceduralreasoning/b2da951e-0823-4ea1-90c1-ae7c9a624e1e_content_list.json b/relevantcommonsensesubgraphsforwhatifproceduralreasoning/b2da951e-0823-4ea1-90c1-ae7c9a624e1e_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..6dbeb572f684260bf7fe9aae48ff3179c575a880 --- /dev/null +++ b/relevantcommonsensesubgraphsforwhatifproceduralreasoning/b2da951e-0823-4ea1-90c1-ae7c9a624e1e_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:46d1bec37d695e73074739a901957208482d1190db2c6753b8f029785ac1ad9d +size 48024 diff --git a/relevantcommonsensesubgraphsforwhatifproceduralreasoning/b2da951e-0823-4ea1-90c1-ae7c9a624e1e_model.json b/relevantcommonsensesubgraphsforwhatifproceduralreasoning/b2da951e-0823-4ea1-90c1-ae7c9a624e1e_model.json new file mode 100644 index 0000000000000000000000000000000000000000..43b7382c74321e50b6c41ef5eff5c9b9172cde04 --- /dev/null +++ b/relevantcommonsensesubgraphsforwhatifproceduralreasoning/b2da951e-0823-4ea1-90c1-ae7c9a624e1e_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7e0044d8ff4ffbba0b8c4cb9decfc2cc5e0de5e20cb8b18f1810d7387fbbcbb5 +size 56174 diff --git a/relevantcommonsensesubgraphsforwhatifproceduralreasoning/b2da951e-0823-4ea1-90c1-ae7c9a624e1e_origin.pdf b/relevantcommonsensesubgraphsforwhatifproceduralreasoning/b2da951e-0823-4ea1-90c1-ae7c9a624e1e_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..cf20e5cf2ce11cc459502f5cc32b611cb3c8df27 --- /dev/null +++ b/relevantcommonsensesubgraphsforwhatifproceduralreasoning/b2da951e-0823-4ea1-90c1-ae7c9a624e1e_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:35db5ff80f9e3f367a4dc2a8caa1f8c6ef5d2453b46ef46ff03b1d7bf8e09c45 +size 539900 diff --git a/relevantcommonsensesubgraphsforwhatifproceduralreasoning/full.md b/relevantcommonsensesubgraphsforwhatifproceduralreasoning/full.md new file mode 100644 index 0000000000000000000000000000000000000000..8eb797806a3c85f4a32bc2fd157e270b704dd25b --- /dev/null +++ b/relevantcommonsensesubgraphsforwhatifproceduralreasoning/full.md @@ -0,0 +1,178 @@ +# Relevant CommonSense Subgraphs for "What if..." Procedural Reasoning + +Chen Zheng +Michigan State University +zhengc12@msu.edu + +Parisa Kordjamshidi +Michigan State University +kordjams@msu.edu + +# Abstract + +We study the challenge of learning causal reasoning over procedural text to answer "What if..." questions when external commonsense knowledge is required. We propose a novel multi-hop graph reasoning model to 1) efficiently extract a commonsense subgraph with the most relevant information from a large knowledge graph; 2) predict the causal answer by reasoning over the representations obtained from the commonsense subgraph and the contextual interactions between the questions and context. We evaluate our model on WIQA benchmark and achieve state-of-the-art performance compared to the recent models. + +# 1 Introduction + +In recent years, large-scale pre-trained language models (LMs) have made a breakthrough progress and demonstrate a high performance in many NLP tasks, including procedural text reasoning (Tandon et al., 2019; Rajagopal et al., 2020). There is a large amount of knowledge that is stored implicitly in language models that help in solving various NLP tasks (Devlin et al., 2019b). When we reason over text, sometimes, the knowledge contained in a given text is sufficient to predict the answer, as it is shown in the question 1 of Figure 1. This knowledge is directly encoded and used by LMs models (Tandon et al., 2019). However, there are many cases in which the required knowledge is not included in the procedural text itself. For example, for the question 2 in Figure 1, the information about the "nutrient" on the seeds does not exist in the procedural text. Therefore, the external commonsense knowledge is required. + +There are several existing resources that contain world knowledge and commonsense. Examples are knowledge graphs (KGs) like ConceptNet (Speer et al., 2017) and ATOMIC (Sap et al., 2019). Looking back at the question 2, we observe that through providing the external knowledge triplets (nutrient, + +![](images/0609170bb8ed793fb2de47e9d61a2fc22a8e99334a98cad44cefa89b15336a46.jpg) +Figure 1: WIQA contains procedural text, and different types of questions. The bold choices are the answers. + +relatedto, soil) and (soil, relatedto, seed) derived from ConceptNet, we can build an explicit reasoning chain and choose an explainable answer. + +Two challenges exist in procedural text reasoning and using external KBs. The first challenge is effectively extracting the most relevant external information and reducing the noise from the KB. The second challenge is reasoning over the extracted knowledge. Several works enhance the QA model with commonsense knowledge (Lin et al., 2019; Lv et al., 2020). However, the noisy knowledge from KG will seriously mislead the QA model in predicting the answer. Moreover, using KBs is often investigated in the tasks that perform QA directly over KB itself, such as CommonsenseQA (Talmor et al., 2019), etc. There are less sophisticated techniques proposed for using external knowledge explicitly (i.e. not through training LMs) in reading comprehension for aiding QA over text. REMNet (Huang et al., 2021) is the only work that uses commonsense for WIQA and uses a memory network to extract the external triplets to solve the first challenge. However, this work has no reasoning process over the extracted knowledge and uses a simple multi-head attention operator to predict the answer. EIGEN (Madaan et al., 2020) constructs an influence graph to find the chain of reasoning given + +![](images/5f0275fb6f4374ccb41b5c343be8f25256602a4536ed6f5d99020f111632dffd.jpg) +Figure 2: MRRG Model is composed of Candidate Triplet Extraction, KG Attention, Commonsense Subgraph Construction, Text encoder with contextual interaction, Graph Reasoning, and Answer prediction modules. + +procedural text. However, EIGEN cannot deal with the challenge when the required knowledge is not in the given document. + +To solve these two challenges, we propose a Multi-hop Reasoning network over Relevant CommonSense SubGraphs (MRRG) for casual reasoning over procedural Text. Our motivation is to effectively and efficiently extract the most relevant information from a large KG to help procedural reasoning. First, we extract the entities, retrieve related external triplets from KG, and learn to extract the most relevant triplets to a given the procedure and question input by a novel KG attention mechanism. Then, we construct a commonsense subgraph based on the extracted KG triplets in a pipeline. We use the extracted subgraphs as a part of end-to-end QA model to help in filling the knowledge gaps in the procedure and performing multi-hop reasoning. The final model predicts the causal answer by reasoning over the contextual interaction representations over the question and the document and learning graph representations over the KB subgraphs. We evaluate our MRRG on the "what if" WIQA benchmark. MRRG model achieves SOTA and brings significant improvements compared to the existing baselines. + +The contributions of our work are: 1) We train a separate module that extracts the relevant parts of the KB given the procedure and question to avoid the noisy and inefficient usage of the information in large KBs. 2) We design an end-to-end model that uses the extracted QA-dependent KB as a subgraph to guide the reasoning over the procedural text to answer the questions. 3) Our MRRG achieves SOTA on the WIQA benchmark. + +# 2 Model Description + +# 2.1 Problem Formulation and Overview + +Formally, the problem is to predict an answer $a$ from a set of pre-defined answers given input question $q$ , a document $\mathcal{C}$ which is composed of several + +sentences $\mathcal{C} = \{s_1,\ldots ,s_n\}$ , and a large knowledge graph KG. + +Figure 2 shows the proposed architecture. (1) We extract the entities from question and context in preprocessing step and use them to retrieve the set of candidate triples from the ConceptNet. (2) We train the KG Attention module to extract the most relevant triplets given the procedure and question and reduce the noisy concepts from candidate triplets. (3) We augment the commonsense subgraph based on the relevant triplets. (4) We train a model that uses two components, the commonsense subgraph as a relational graph network and a text encoder including question and document to do procedural reasoning. Below, we describe the details of each module. + +# 2.2 Candidate Triplet Extraction from KG + +Given the input $q$ and $\mathcal{C}$ , we extract the contextual entities (concepts) by a open Information Extraction (OpenIE) model (Stanovsky et al., 2018). For each extracted entity $t_{in}$ , we retrieve the relational triplets $t = (t_{in}, r, t_{out})$ from KG, where $t_{out}$ is the concept taken from ConceptNet and $r$ is a semantic relation type. We then apply a pre-trained Language Model, RoBERTa, to obtain the representation of each triplet: $E^{t} = f_{LM}([t_{in}, r, t_{out}]) \in \mathbb{R}^{3 \times d}$ , where $f_{LM}$ denotes the language model operation and the triplets are given as a sequence of concepts and relations to the LM. + +# 2.3 KG Attention + +The KG attention module is shown in Figure 2-A and Figure 3. We concatenate $q$ and $\mathcal{C}$ to form $Q = [[CLS];q;[SEP];\mathcal{C}]$ , where [CLS] and [SEP] are special tokens in the LMs tokenizer process (Liu et al., 2019). We use RoBERTa to obtain the list of token representations $E_{[CLS]}$ , $E_q$ , and $E_{\mathcal{C}}$ . $E_{[CLS]}$ is the summary representation of the question and paragraph, $E_q$ is the list of the question tokens embeddings, and $E_{\mathcal{C}}$ is the list of the paragraph tokens embeddings output of Roberta. + +Given triplet $E^t$ that is generated based on the triplet extraction described in Section 2.2, we build a context-triplet pair $E_z^t = [E_{[CLS]}; E_{in}^t; E_r^t; E_{out}^t]$ , where $E_{in}^t$ is the representation of the head entity from text, $E_{out}^t$ is the representation of the tail entity from KG, and $E_r^t$ is the representation of the relation. Afterwards, we compute context-triplet pair attention and a softmax layer to output the Context-Triplet pairwise importance Score CTS. The process is computed as follows: $\mathrm{CTS}_t = \frac{\exp\big(MLP(E_z^t)\big)}{\sum_{i=1}^{m}\exp\big(MLP(E_z^t)\big)}$ . + +Then we choose the top- $k$ relevant triplets with the top $CTS$ scores and then use the relevant triplets to construct the subgraph. For each selected triplet, we obtain the triplet representation $E^{\prime t} = [E_{in}^{\prime t}, E_r^t, E_{out}^{\prime t}] \in \mathbb{R}^{3 \times d}$ , where $E_{in}^{\prime t} = f_{in}([CTS_t \cdot E_{in}^t; CTS_t \cdot E_r^t])$ and $E_{out}^{\prime t} = f_{out}([CTS_t \cdot E_{out}^t; CTS_t \cdot E_r^t])$ . Notice that $f_{in}$ and $f_{out}$ are MLP layers, $[\cdot]$ is the concatenation, and $[\cdot]$ is the scalar product. + +![](images/59a5b83b5a226050eed3b40c7360e885f4dd2761944911b44489fae321e25620.jpg) +Figure 3: The architecture of training the KG Attention module. + +# 2.4 Commonsense Subgraph Construction + +We construct the subgraph $G_{s}$ based on the relevant triplets from KG attention for each question and answer pair. We add more edges to the subgraph as follows: Two entities in the triplets will have an edge if a relation $r$ in the KG exists between them. The assumption is that the augmented commonsense subgraph will contain the reasoning paths. We use $E_{in}^{rt}$ and $E_{out}^{rt}$ for the KG subgraph initial node representation $h^{(0)}$ which is used in RGCN formulation in Section 2.5. + +# 2.5 Procedural Reasoning + +Procedural Reasoning composes of two parts: Multi-Hop Graph Reasoning and Text Contextual Interaction Encoder. + +(I) Multi-Hop Graph Reasoning: this is the Graph Reasoning part of Figure 2-B. Given the subgraph $G_{s}$ , we use RGCN (Schlichtkrull et al., 2018) to learn the representations of the relational graph. RGCN learns graph representations by aggregating + +messages from its direct neighbors and relational semantic edges. The $(l + 1)$ -th layer node representation $h_i^{(l + 1)}$ is updated based on the neighborhood node representations $h_j^l$ from the $l$ -layer multiplied by the relational matrices $W_{r_1}^{(l)},\ldots ,W_{r_{|R|}}^{(l)}$ . The representation $h_i^{(l + 1)}$ is computed as follows: + +$$ +h _ {i} ^ {(l + 1)} = \sigma (\sum_ {r \in \mathcal {R}} \sum_ {j \in N _ {i} ^ {r}} \frac {1}{| N _ {i} ^ {r} |} W _ {r} ^ {(l)} h _ {j} ^ {(l)} + W _ {0} ^ {(l)} h _ {i} ^ {(l)}), +$$ + +where $\sigma$ denotes a non-linear activation function, $N_{i}^{r}$ represents a set that includes neighbor indices of node $i$ under semantic relation $r$ . Finally, we obtain the $E_{G_s}$ after several hops of message passing. (II) Text Contextual Interaction Encoder: We have obtained the contextual token representations $E_{[CLS]}$ , $E_q$ , and $E_{\mathcal{C}}$ in the KG attention module that described in Section 2.3. Followed by Seo et al., we utilize BiDAF style contextual interaction module to feed $E_q$ and $E_{\mathcal{C}}$ to Context-to-Question Attention $E_{\mathcal{C}\rightarrow q} = \text{softmax}(\text{sim}(E_q^T,E_{\mathcal{C}}))E_q$ and Question-to-Context Attention $E_{q\to \mathcal{C}}$ to obtain the contextual interaction between question and context. Then we use LSTM to obtain the hidden state representations: $F_{q\rightarrow \mathcal{C}} = LSTM(E_{q\rightarrow \mathcal{C}})$ , and $F_{\mathcal{C}\rightarrow q} = LSTM(E_{\mathcal{C}\rightarrow q})$ . + +# 2.6 Answer Prediction + +We concatenate $E_{[CLS]}$ , $F_{q\to \mathcal{C}}$ , $F_{\mathcal{C}\rightarrow q}$ , and the compact subgraph representation $E_{G_s}'$ obtained from attentive pooling, and use it as the final representation: $F = [E_{[CLS]};F_{q\to \mathcal{C}};F_{\mathcal{C}\to q};E_{G_s}']$ . Then we utilize a classifier MLP $(F)$ to predict the answer. Our MRRG has two separate training modules used in a pipeline for triplet selection and procedural reasoning. + +(I) Training KG Attention for Triplet Selection: Figure 3 and the left block of Figure 2 show the same triplet selection model. The architecture of Figure 2.B is taken and 3 extra MLP layers added to it for training as shown in Figure 3. The MLP is applied on the concatenation of the concatenation of $[E_{[CLS]}; E_q; E_C; E_1'^t; \ldots; E_k'^t]$ to predict the answer. We use the cross-entropy as the loss function to train the model. + +(II) Training End-to-End MRRG: After pretraining the KG attention, we keep the learned parameters and extract the most relevant concepts and construct the multi-relational commonsense subgraph $G_{s}$ . We combine subgraph representation and text interaction representation as input + +to train the answer prediction module by cross-entropy loss. + +# 3 Experiments and Results + +We implemented our MRRG framework using PyTorch1. We use a pre-trained RoBERTa (Liu et al., 2019) to encode the contextual information in the input. The maximum number of triplets is 50 and the maximum number of nodes in the graph is 100. Further details of hyper-parameters of the graph are shown in Table 3. The maximum number of words for the paragraph context is 256. For the graph construction module, we utilize open Information Extraction model (Stanovsky et al., 2018) from AllenNLP2 to extract the entities. The maximum number of hops for the graph module is 3. The learning rate is $1e - 5$ . The model is optimized using Adam optimizer (Kingma and Ba, 2015). + +# 3.1 Datasets + +WIQA is a large dataset for "what if" causal reasoning. WIQA contains three types of questions: 1) the questions can be directly answered based on the text, called in-paragraph questions. 2) the questions require external knowledge to be answered, called out-of-paragraph questions, and 3) irrelevant causes and effects, called no-effect questions. WIQA contains 29808 training samples, 6894 development samples, 3993 test samples (test V1), and 3003 test samples (test V2). + +# 3.2 Baseline Description + +We briefly describe the most recent baselines that use the Transformer-based language model as the backbone. We separately fine-tune the BERT and RoBERTa as the first two baselines. + +EIGEN (Madaan et al., 2020) is a baseline that builds an event influence graph based on a document and leverages LMs to create the chain of reasoning to predict the answer. However, EIGEN does not use any external knowledge to solve the problem. + +Logic-Guided (Asai and Hajishirzi, 2020) is a baseline that combines neural networks and logic rules. Specifically, the Logic-Guided model uses logic rules including symmetry and transitivity rules to augment the training data. Moreover, the + +base language model uses the rules as a regularization term during training to impose the consistency between the answers of multiple questions. + +RGN (Zheng and Kordjamshidi, 2021) is the recent SOTA baseline that utilizes a gating network (Zheng et al., 2020) to effectively filter out the key entities and relationships in the given document and learns the contextual representations to predict the answer. RGN does not consider the external knowledge for procedural reasoning challenges. + +REM-Net (Huang et al., 2021) proposes a recursive erasure memory network to find out the causal evidence. Specifically, REM-Net refines the evidence by a recursive memory mechanism and then uses a generative model to predict the causal answer. REM-Net is the only work that uses external knowledge for WIQA. REM-Net uses the external knowledge by training an attention mechanism that considers the KG triplet representations for finding the answer. It does not explicitly select the most relevant triplets as we do, and the graph reasoning is not exploited for finding the chain of reasoning. + +
Modelsin-paraout-of-parano-effectTest V1 Acc
Majority45.4649.4755.030.66
Polarity76.3153.5927.039.43
Adaboost (Freund and Schapire, 1995)49.4136.6148.4243.93
emphDecomp-Attn (Parikh et al., 2016)56.3148.5673.4259.48
BERT (no para) (Devlin et al., 2019a)60.3243.7484.1862.41
BERT (Tandon et al., 2019)79.6856.1389.3873.80
RoBERTa (Tandon et al., 2019)74.5561.2989.4774.77
EIGEN (Madaan et al., 2020)73.5864.0490.8476.92
REM-Net (Huang et al., 2021)75.6767.9887.6577.56
Logic-Guided (Asai and Hajishirzi, 2020)---78.50
RoBERTa+KG-attention Triplet Selection72.2164.6089.1375.22
MRRG (RoBERTa-base)79.8569.9391.0280.06
Human---96.33
+ +# 3.3 Results + +Table 1 and Table 2 show the performance of MRRG on the WIQA task compared to other baselines on two different test sets V1 and V2. First, Both tables show that our proposed KG Attention triplet selection model outperforms the RoBERTa and has $3.3\%$ improvement on the out-of-para category. Second, our MRRG achieves SOTA results compared to all baseline models. MRRG achieves the SOTA on both in-para, out-of-para, and no-effect questions in WIQA V1 and V2. + +Table 1: Model Comparisons on WIQA test V1 dataset. + +
Modelsin-parao-out-of-parano-effectTest v2 Acc
Random33.3333.3333.3333.33
Majority00.0000.00100.041.80
BERT70.5758.5491.0874.26
RoBERTa70.6960.2091.1175.34
REM-Net70.9463.2291.2476.29
REM-Net (RoBERTa-large)76.2369.1392.3580.09
QUARTET (RoBERTa-large) (Rajagopal et al., 2020)74.4965.6595.3082.07
RGN (Zheng and Kordjamshidi, 2021)75.9166.1592.1279.95
RoBERTa+KG Attention Triplet Selection70.0262.3091.2375.86
MRRG (RoBERTa-base)76.8067.8392.2880.39
MRRG (RoBERTa-large)78.8271.1093.5382.95
Human---96.30
+ +Table 2: Model Comparisons on WIQA test V2 dataset. + +
Question and Document ContentRoBERTa+InteractionIncorporating Triplets+KG Attention+Graph
Question: suppose more fruit is produced happens, how will it affect MORE plants?X(fruit, createdby, plant)
Content: ["The seed germinates.", "The plant grows.", "The plant flowers.", "Produces fruit.", "The fruit releases seeds." Gold Answer: More
Question: suppose the soil is rich in nutrients happens, how will it affect more seeds are produced.XX(nutrient, relatedto, soil) (soil, relatedto, seed)
Content: ["A plant produces a seed", "The seed falls to the ground", "The seed is buried", "The seed germinates", "A plant grows", "The plant produces 'flowers', "The flowers produce more seeds.'] Gold Answer: More
Question: suppose more land available happens, how will it affect less igneous rock forming.XX(igneous rock, isa, rock) (land, relatedto, rock)X
Content: ["Different kinds of rocks melt into magma", "Magma cools in the crust", "Magma goes to the surface and becomes lava", "Lava cools", "Cooled magma and lava become igneous rock.'] Gold Answer: Less
+ +
Model# hop = 1# hop = 2# hop = 3
BERT71.6%62.5%59.5%
RoBERTa73.5%63.9%61.1%
EIGEN78.8%63.5%68.3%
MRRG81.0%72.3%70.4%
+ +Figure 4: Left: Case study of the MRRG Framework. “+interaction” means adding the contextual interaction module. “KG ATTN” means adding the KG Attention Triplet Selection module. ‘X’ indicates the model failed to predict the correct answer and “√” means the prediction was successful with the included module. Right: Comparing the results over different number of hops. + +# 4 Analysis + +# 4.1 Effects of Using External Knowledge + +In the WIQA, all the baseline models achieve significantly lower accuracy in the out-of-para than in-para and no-effect categories. MRRG achieves SOTA in the out-of-para category because of using the highly relevant commonsense subgraphs and the combination of reasoning over text interaction and the graph reasoning modules. As is shown in table 2, the advantage of the MRRG model is reflected on out-of-para questions. MRRG improves $4.61\%$ over REM-Net. Notice that REM-Net is the only model that utilizes external knowledge on WIQA. Figure 4 shows a case in which the "soil" and "nutrient" only appear in the question and do not exist in the text. The baseline models fail to answer this out-of-para question due to missing external knowledge. However, our model predicts the correct answer by explicitly incorporating the (nutrient, relatedto, soil), (soil, relatedto, seed) that connects the critical information between the question and document. + +
AblationModelDev Acc
Text onlyRoBERTa-base75.51%
Text only+ contextual interaction76.85%
Text onlyKG Attention Triplet Selection77.39%
Text+Graph- semantic relation78.31%
GNN dim=5079.18%
GNN dim=10080.30%
GNN dim=20079.88%
+ +Table 3: Ablation and hyper-para. choices on WIQA. "GNN dim" is the dimension of graph representation. + +# 4.2 Relational Reasoning and Multi-Hops + +Both in-para and out-of-para question types require multiple hops of reasoning to find the answer in the WIQA. As shown in the right side of Figure 4, the MRRG model accuracy improved $2\%$ for 1 hop, $8\%$ for 2 hops, and $2\%$ for 3 hops compared to EIGEN. MRRG made a sharp improvement in + +reasoning with multiple hops due to the relational graph reasoning and the effectiveness of the extracted commonsense subgraph. We study some cases to analyze the multi-hop reasoning and the reasoning chains. In the third case in Figure 4, the extracted relevant triplets (land, relatedto, surface), (surface, relatedto, igneous rock) construct a two-hop reasoning chain "land $\rightarrow$ surface $\rightarrow$ igneous rock" that helps MRRG to find the correct answer. + +# 4.3 Ablation Study + +Table 3 shows the ablation study results of MRRG using WIQA. Firstly, we remove the commonsense subgraph and graph network. The accuracy decreases $3.4\%$ compared to MRRG. Second, we remove the contextual interaction module and the accuracy decreases $1.3\%$ . In an additional experiment, we use the KG attention triplet selection module to directly predict the answer without the pipeline of constructing the subgraph and using the graph reasoning module. We show the result as KG Attention Triplet Selection in Table 3. The result shows that removing the triplet selection module decreases the accuracy by $1.8\%$ . In the same table 3, we report results about the impact of including the relation types in the RGCN graph and the influence of changing the dimensionality of the node representations in the model. + +# 5 Conclusion + +We propose MRRG model for using external knowledge graph in reasoning over procedural text. Our model extracts a relevant subgraph for each question from the KG and uses that knowledge subgraph for answering the question. The extracted subgraph includes the reasoning path for answering the question and helps multi-hop reasoning to predict an explainable answer. We evaluate MRRG on the WIQA and achieve SOTA performance. + +# References + +Akari Asai and Hannaneh Hajishirzi. 2020. Logic-guided data augmentation and regularization for consistent question answering. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 5642-5650. Association for Computational Linguistics. +J. Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019a. Bert: Pre-training of deep bidirectional transformers for language understanding. In NAACL-HLT. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019b. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171-4186, Minneapolis, Minnesota. Association for Computational Linguistics. +Y. Freund and R. Schapire. 1995. A decision-theoretic generalization of on-line learning and an application to boosting. In EuroCOLT. +Yinya Huang, Meng Fang, Xunlin Zhan, Qingxing Cao, Xiaodan Liang, and Liang Lin. 2021. Rem-net: Recursive erasure memory network for commonsense evidence refinement. In AAAI. +Diederik P. Kingma and Jimmy Ba. 2015. Adam: A method for stochastic optimization. In ICLR. +Bill Yuchen Lin, Xinyue Chen, Jamin Chen, and Xiang Ren. 2019. KagNet: Knowledge-aware graph networks for commonsense reasoning. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 2829-2839, Hong Kong, China. Association for Computational Linguistics. +Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692. +Shangwen Lv, Daya Guo, Jingjing Xu, Duyu Tang, Nan Duan, Ming Gong, Linjun Shou, Daxin Jiang, Guihong Cao, and Songlin Hu. 2020. Graph-based reasoning over heterogeneous external knowledge for commonsense question answering. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 8449-8456. +Aman Madaan, Dheeraj Rajagopal, Yiming Yang, Abhilasha Ravichander, Eduard Hovy, and Shrimai Prabhumoye. 2020. Eigen: Event influence generation using pre-trained language models. arXiv preprint arXiv:2010.11764. + +Ankur Parikh, Oscar Tackström, Dipanjan Das, and Jakob Uszkoreit. 2016. A decomposable attention model for natural language inference. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 2249-2255, Austin, Texas. Association for Computational Linguistics. +Dheeraj Rajagopal, Niket Tandon, Peter Clark, Bhavana Dalvi, and Eduard Hovy. 2020. What-if I ask you to explain: Explaining the effects of perturbations in procedural text. In *Findings of the Association for Computational Linguistics: EMNLP* 2020, pages 3345-3355, Online. Association for Computational Linguistics. +Maarten Sap, Ronan Le Bras, Emily Allaway, Chandra Bhagavatula, Nicholas Lourie, Hannah Rashkin, Brendan Roof, Noah A Smith, and Yejin Choi. 2019. Atomic: An atlas of machine commonsense for if then reasoning. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 3027-3035. +Michael Schlichtkrull, Thomas N Kipf, Peter Bloem, Rianne Van Den Berg, Ivan Titov, and Max Welling. 2018. Modeling relational data with graph convolutional networks. In European semantic web conference, pages 593-607. Springer. +Minjoon Seo, Aniruddha Kembhavi, Ali Farhadi, and Hannaneh Hajishirzi. 2017. Bidirectional attention flow for machine comprehension. In ICLR. +Robyn Speer, Joshua Chin, and Catherine Havasi. 2017. Conceptnet 5.5: An open multilingual graph of general knowledge. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 31. +Gabriel Stanovsky, Julian Michael, Luke Zettlemoyer, and Ido Dagan. 2018. Supervised open information extraction. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 885-895, New Orleans, Louisiana. Association for Computational Linguistics. +Alon Talmor, Jonathan Herzig, Nicholas Lourie, and Jonathan Berant. 2019. CommonsenseQA: A question answering challenge targeting commonsense knowledge. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4149-4158, Minneapolis, Minnesota. Association for Computational Linguistics. +Niket Tandon, Bhavana Dalvi, Keisuke Sakaguchi, Peter Clark, and Antoine Bosselut. 2019. WIQA: A dataset for "what if..." reasoning over procedural text. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 6076-6085, Hong Kong, China. Association for Computational Linguistics. + +Chen Zheng, Quan Guo, and Parisa Kordjamshidi. 2020. Cross-modality relevance for reasoning on language and vision. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 7642-7651. Association for Computational Linguistics. +Chen Zheng and Parisa Kordjamshidi. 2021. Relational gating for "what if" reasoning. In Proceedings of the Thirtieth International Joint Conference on Artificial Intelligence, IJCAI-21, pages 4015-4022. International Joint Conferences on Artificial Intelligence Organization. Main Track. \ No newline at end of file diff --git a/relevantcommonsensesubgraphsforwhatifproceduralreasoning/images.zip b/relevantcommonsensesubgraphsforwhatifproceduralreasoning/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..71ca96795231e21976f8c408dc1644022f59e402 --- /dev/null +++ b/relevantcommonsensesubgraphsforwhatifproceduralreasoning/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4da7e146e042f010ae23b19d78f6dfef5d7a3c4188cf43ad4f86e57c0565a1f6 +size 283064 diff --git a/relevantcommonsensesubgraphsforwhatifproceduralreasoning/layout.json b/relevantcommonsensesubgraphsforwhatifproceduralreasoning/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..149a4b1e8b7de4d3cf400691ef545ae181161092 --- /dev/null +++ b/relevantcommonsensesubgraphsforwhatifproceduralreasoning/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7d7761bc9b016ded18da6a5e8380aa7ec1157a9b25869b7a785696005f45d2cf +size 236784 diff --git a/rethinkingdocumentlevelneuralmachinetranslation/c7878e2d-a382-4c2e-af02-48578744ee43_content_list.json b/rethinkingdocumentlevelneuralmachinetranslation/c7878e2d-a382-4c2e-af02-48578744ee43_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..c1feeee6b59898bd78805b90f1474cc0e64f44a9 --- /dev/null +++ b/rethinkingdocumentlevelneuralmachinetranslation/c7878e2d-a382-4c2e-af02-48578744ee43_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:07db2e49b3f30cee8e9ad3d048d4e3197cfd91518e1ad7159b54366690ebac0b +size 94703 diff --git a/rethinkingdocumentlevelneuralmachinetranslation/c7878e2d-a382-4c2e-af02-48578744ee43_model.json b/rethinkingdocumentlevelneuralmachinetranslation/c7878e2d-a382-4c2e-af02-48578744ee43_model.json new file mode 100644 index 0000000000000000000000000000000000000000..6cbb6b1e4bd33b69a85a074befcdee85f5d58950 --- /dev/null +++ b/rethinkingdocumentlevelneuralmachinetranslation/c7878e2d-a382-4c2e-af02-48578744ee43_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b141ab1c3595d0cad342bed469404d3265a7201390bb50250cf1673d5a0a1ca7 +size 116230 diff --git a/rethinkingdocumentlevelneuralmachinetranslation/c7878e2d-a382-4c2e-af02-48578744ee43_origin.pdf b/rethinkingdocumentlevelneuralmachinetranslation/c7878e2d-a382-4c2e-af02-48578744ee43_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..c1eabfb585c68401c288ed2b68bdb57bd1556369 --- /dev/null +++ b/rethinkingdocumentlevelneuralmachinetranslation/c7878e2d-a382-4c2e-af02-48578744ee43_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:31106be0288c34d104c021d0a4717a9458320de3e40c2fb007bc947f847fbdc3 +size 622214 diff --git a/rethinkingdocumentlevelneuralmachinetranslation/full.md b/rethinkingdocumentlevelneuralmachinetranslation/full.md new file mode 100644 index 0000000000000000000000000000000000000000..8c056d9b0b1300d8d8aa79236b54f9ef07295324 --- /dev/null +++ b/rethinkingdocumentlevelneuralmachinetranslation/full.md @@ -0,0 +1,413 @@ +# Rethinking Document-level Neural Machine Translation + +Zewei Sun $^{1,2,*}$ , Mingxuan Wang $^{2}$ , Hao Zhou $^{2}$ , Chengqi Zhao $^{2}$ + +Shujian Huang $^{1,3}$ , Jiajun Chen $^{1}$ , Lei Li $^{4,*}$ + +1 State Key Laboratory for Novel Software Technology, Nanjing University + +2 ByteDance AI Lab, Peng Cheng Laboratory, Shenzhen + +4 University of California, Santa Barbara + +{sunzewei.v, wangmingxuan.89}@bytedance.com + +{zhouhao.nlp, zhaochengqi.d}@bytedance.com + +{huangsj,chenjj}@nju.edu.cn,leili@cs.ucsb.edu + +# Abstract + +This paper does not aim at introducing a novel model for document-level neural machine translation. Instead, we head back to the original Transformer model and hope to answer the following question: Is the capacity of current models strong enough for document-level translation? Interestingly, we observe that the original Transformer with appropriate training techniques can achieve strong results for document translation, even with a length of 2000 words. We evaluate this model and several recent approaches on nine document-level datasets and two sentence-level datasets across six languages. Experiments show that document-level Transformer models outperforms sentence-level ones and many previous methods in a comprehensive set of metrics, including BLEU, four lexical indices, three newly proposed assistant linguistic indicators, and human evaluation. Our new datasets and evaluation scripts are in https://github.com/sunzewei2715/Doc2Doc_NMT. + +# 1 Introduction + +Neural machine translation (Bahdanau et al., 2015; Wu et al., 2016; Vaswani et al., 2017) has achieved great progress and reached near human-level performance. However, most current sequence-to-sequence NMT models translate sentences individually. In such cases, discourse phenomena, such as pronominal anaphora, lexical consistency, and document coherence that depend on long-range context going further than a few previous sentences, are neglected (Bawden et al., 2017). As a result, Läubli et al. (2018) find human raters still show a markedly stronger preference for human translations when evaluating at the level of documents. + +Many methods have been proposed to improve document-level neural machine translation (DNMT). Among them, the mainstream studies + +focus on the model architecture modification, including hierarchical attention (Wang et al., 2017; Miculicich et al., 2018; Tan et al., 2019), additional context extraction encoders or query layers (Jean et al., 2017; Bawden et al., 2017; Zhang et al., 2018; Voita et al., 2018; Kuang and Xiong, 2018; Maruf et al., 2019; Yang et al., 2019; Jiang et al., 2019; Zheng et al., 2020; Yun et al., 2020; Xu et al., 2020), and cache-like memory network (Maruf and Haffari, 2018; Kuang et al., 2018; Tu et al., 2018). + +These studies come up with different structures in order to include discourse information, namely, introducing adjacent sentences into the encoder or decoder as document contexts. Experimental results show effective improvements on universal translation metrics like BLEU (Papineni et al., 2002) and document-level linguistic indices (Tiedemann and Scherrer, 2017; Bawden et al., 2017; Werlen and Popescu-Belis, 2017; Müller et al., 2018; Voita et al., 2018, 2019). + +Unlike previous work, this paper does not aim at introducing a novel model. Instead, we hope to answer the following question: Is the basic sequence-to-sequence model strong enough to directly handle document-level translation? To this end, we head back to the original Transformer (Vaswani et al., 2017) and conduct literal document-to-document (Doc2Doc) training. + +Though many studies report negative results of naive Doc2Doc translation (Zhang et al., 2018; Liu et al., 2020), we successfully activate it with Multi-resolutional Training, which involves multiple levels of sequences. It turns out that end-to-end document translation is not only feasible but also stronger than sentence-level models and previous studies. Furthermore, if assisted by extra sentence-level corpus, which can be much more easily obtained, the model can significantly improve the performance and achieve state-of-the-art results. It is worth noting that our method does not change the model architecture and need no extra parameters. + +Our experiments are conducted on nine document-level datasets, including TED (ZH-EN, EN-DE), News (EN-DE, ES-EN, FR-EN, RU-EN), Europarl (EN-DE), Subtitles (EN-RU), and a newly constructed News dataset (ZH-EN). Additionally, two sentence-level datasets are adopted in further experiments, including Wikipedia (EN-DE) and WMT (ZH-EN). Experiment results show that our strategy outperforms previous methods in a comprehensive set of metrics, including BLEU, four lexical indices, three newly proposed assistant linguistic indicators, and human evaluation. In addition to serving as improvement evidence, our newly proposed document-level datasets and metrics can also be a boosting contribution to the community. + +# 2 Re-examining Recent DNMT Studies + +For DNMT, though many improvements have been reported, a couple of studies have proposed challenges against these results (Kim et al., 2019; Jwalapuram et al., 2020; Li et al., 2020). And we also find some of previous gains should be attributed to overfitting to some extent. + +The most used datasets of previous work are News Commentary and TED Talks, which contain only 200 thousand sentences. The small scale of the datasets gives rise to the frequent occurrence of overfitting, let alone that the distribution of the test set is highly similar to the training set. And some work even conduct an unfair comparison with dropout $= 0.1$ for sentence-level models and dropout $= 0.2$ for document-level models (Maruf et al., 2019; Yang et al., 2019; Zheng et al., 2020). As a result, regularization and overfitting on small datasets make the improvements not solid enough. + +To verify our assumption, we perform different training by switching hyperparameters on sentence-level experiments. We follow the datasets provided by Maruf et al. (2019) and Zheng et al. (2020), including TED (ZH-EN/EN-DE), News (EN-DE), and Europarl (EN-DE), as well as all the model architecture settings they adopt, including a four-layer Transformer base version. + +As is shown in Table 1, we surprisingly find that simply employing larger dropout can eliminate all the improvements gained by previous work. For TED, the setting of dropout $= 0.2$ can boost baseline for more than 1.0 BLEU, which immediately marginalizes the previous advance, while the setting of dropout $= 0.3$ can outperform all the previous studies. When it comes to News, though the state + +
ModelsZH-EN +TEDTEDEN-DE +NewsEuroparl
Transformer-base (dropout=0.1)17.3223.5822.1031.70
Transformer-base (dropout=0.2)18.8724.7024.3631.44
Transformer-base (dropout=0.3)19.2125.1924.9830.56
DocT (Zhang et al., 2018)-24.0023.0829.32
HAN (Miculicich et al., 2018)17.9024.5825.0328.60
SAN (Maruf et al., 2019)-24.4224.8429.75
QCN (Yang et al., 2019)-25.1922.3729.82
MCN (Zheng et al., 2020)19.1025.1024.9130.40
+ +Table 1: Document translation experiments on ZH-EN and EN-DE. “-” means not provided. Only the results of TED & News with dropout=0.1 and a much lower score of Europarl are reported in previous work. However, Transformer-base with dropout=0.3 for TED & News and a strong baseline of Europarl outperform almost all other methods. + +of-the-art results are yet to be obtained, the gap between sentence and document models has been largely narrowed up. As for Europarl, a much higher baseline has been easily achieved, which also makes other improvements not solid enough. + +Our results show that preceding experiments lack the comparison with a strong baseline. An important proportion of the improvements may come from the regularization of the models since they bring in extra parameters for context encoders or hierarchical attention weights. However, the regularization can be also achieved in sentence-level models and is not targeted at improving document coherence. Essentially, the small scale of related datasets and identically distributed test sets make the improvements questionable. + +Kim et al. (2019) draw the same conclusion that well-regularized or pre-trained sentence-level models can beat document-level models in the same settings. They find that most improvements are not from coreference or lexical choice but "not interpretable". Similarly, Jwalapuram et al. (2020) adopt a wide evaluation and find that the existing context-aware models do not improve discourse-related translations consistently across languages and phenomena. Also, Li et al. (2020) find that the extra context encoders act more like a noise generator and the BLEU improvements mainly come from the robust training instead of the leverage of contextual information. All these three studies appeal for stronger baselines for a fair comparison. + +We suggest that the current research tendency in DNMT should be reviewed since it is hard to tell whether the improvements are targeted at document coherence or just normal regularization, let alone complicated modules are introduced. Therefore, as a simpler alternative, we head back to the original but concise style, using end-to-end training framework to cope with document translation. + +# 3 Doc2Doc: End-to-End DNMT + +In this section, we attempt to analyze the different training patterns for DNMT. Firstly, let us formulate the problem. Let $D_{x} = \{x^{(1)}, x^{(2)}, \dots, x^{(M)}\}$ be a source-language document containing $M$ source sentences. The goal of the document-level NMT is to translate the document $D_{x}$ in language $x$ to a document $D_{y}$ in language $y$ . $D_{y} = \{y^{(1)}, y^{(2)}, \dots, y^{(N)}\}$ . We use $L_{y}^{(i)}$ to denote the sentence length of $y^{(i)}$ . + +Previous work translate a document sentence-by-sentence, regarding DNMT as a step-by-step sentence generating problem (Doc2Sent) as: + +$$ +\mathcal {L} _ {\text {D o c 2 S e n t}} = - \sum_ {i = 1} ^ {N} \sum_ {j = 1} ^ {L _ {y} ^ {(i)}} \log p _ {\theta} \left(y _ {j} ^ {(i)} \mid y _ {(< j)} ^ {(i)}, x ^ {(i)}, S ^ {(i)}, T ^ {(i)}\right), \tag {1} +$$ + +$S^{(i)}$ is the context in the source side, depending on the model architecture and is comprised of only two or three sentences in many work. Most current work focuses on $S^{(i)}$ , by utilizing hierarchical attention or extra encoders. And $T^{(i)}$ is the context in the target side, which is involved by only a couple of work. They usually make use of a topic model or word cache to form $T^{(i)}$ . + +Different from Doc2Sent, we propose to resolve document translation with the end-to-end, namely document-to-document (Doc2Doc) pattern as: + +$$ +\mathcal {L} _ {\mathrm {D o c 2 D o c}} = - \sum_ {i = 1} ^ {\sum_ {L y}} \log p _ {\theta} \left(y _ {i} \mid y _ {< i}, D _ {x}\right), \tag {2} +$$ + +where $D_{x}$ is the complete context in the source side, and $y_{< i}$ is the complete historical context in the target side. + +# 3.1 Why We Dive into Doc2Doc? + +Full Source Context: First, many Doc2sent studies show that more sentences beyond can harm the results (Miculicich et al., 2018; Zhang et al., 2018; Tu et al., 2018). Therefore, many Doc2Sent work are more of "a couple of sentences to sentence" since they only involve two or three preceding sentences as context. However, broader contexts provide more information, which shall theoretically lead to more improvements. Thus, We attempt to re-visit involving the full context and choose Doc2Doc, as it is required to take account of all the source-side context. + +Full Target Context: Second, many Doc2sent work abandon the target-side historical context, and some even claim that it is harmful to translation quality (Wang et al., 2017; Zhang et al., 2018; Tu et al., 2018). However, once the cross-sentence language model is discarded, some problems, such as tense mismatch (especially when the source language is tenseless like Chinese), may occur. Therefore, we attempt to re-visit involving the full context and choose Doc2Doc, as it treats the whole document as a sequence and can naturally take advantage of all the target-side historical context. + +Relaxed Training: Third, Doc2Sent restricts the training scene. The previous work focuses on adjusting the model structure to feed preceding source sentences, so the training data has to be in the form of consecutive sentences so as to meet the model entrance. As a result, it is hard to use large numbers of piecemeal parallel sentences. Such a rigid form of training data also greatly limits the model potential because the scale of parallel sentences can be tens of times of parallel documents. On the contrary, Doc2Doc can naturally absorb all kinds of sequences, including sentences and documents. + +Simplicity: Last, Doc2Sent inevitably introduces extra model modules with extra parameters in order to capture contextual information. It complicates the model architecture, making it hard to renovate or generalize. On the contrary, Doc2Doc does not change the model structure and brings in no additional parameters. + +# 3.2 Multi-resolutional Doc2Doc NMT + +Although Doc2Doc seems more concise and promising in multiple terms, it is not widely recognized. Zhang et al. (2018); Liu et al. (2020) conduct experiments by directly feeding the whole documents into the model. We refer to it as Single-resolutional Training (denoted as SR Doc2Doc). Their experiments report extremely negative results unless pre-trained in advance. The model either has a large drop in performance or does not work at all. As pointed out by Koehn and Knowles (2017), one of the six challenges in neural machine translation is the dramatic drop of quality as the length of the sentences increases. + +However, we find that Doc2Doc can be activated on any datasets and obtain better results than Doc2Sent models as long as we employ Multi-resolutional Training, mixing documents + +
GroupDatasetsSourceLanguageN_SentN_DocDevelopment SetsTest Sets
Main ExperimentsTEDIWSLT 2015ZH-EN205K1.7Kdev2010tst2010-2013
TEDIWSLT 2017EN-DE206K1.7Kdev2010+tst201[0-5]tst2016-2017
NewsNews Commentary v11EN-DE236K6.1Knewstest2015newstest2016
EuroparlEuroparl v7EN-DE1.67M118K(Maruf et al., 2019)
Other LanguagesNewsNews Commentary v14ES-EN355K9.2Knewstest2012newstest2013
NewsNews Commentary v14FR-EN303K7.8Knewstest2013newstest2014
NewsNews Commentary v14RU-EN226K6.0Knewstest2018newstest2019
Sentence-level CorpusWikiWikipediaEN-DE2.40M---
WMTWMT 2019ZH-EN21M---
Contrastive ExperimentsSubtitlesOpenSubtitlesEN-RU6M1.5M(Voita et al., 2019)
Our New DatasetsPDCFT/NYTZH-EN1.39M59Knewstest2019PDC
+ +Table 2: The detailed information of the used datasets in this paper with downloading links on their names. + +with shorter segments like sentences or paragraphs (denoted as MR Doc2Doc). + +Specifically, we split each document averagely into $k$ parts for multiple times and collect all the sequences together, $k \in \{1, 2, 4, 8, \ldots\}$ . For example, a document containing eight sentences will be split into two four-sentences segments, four two-sentences segments, and eight single-sentence segments. Finally, fifteen sequences are all gathered and fed into sequence-to-sequence training $(15 = 1 + 2 + 4 + 8)$ . + +In this way, the model can acquire the ability to translate long documents since it is assisted by easier and shorter segments. As a result, multi-resolutional Doc2Doc is able to translate all forms of sequences, including extremely long ones such as a document with more than 2000 tokens, as well as shorter ones like sentences. In the following sections, we conduct the same experiments as the aforementioned studies by translating the whole document directly and atomically. + +# 4 Experiment Settings + +# 4.1 Datasets + +For our main experiments, we follow the datasets provided by Maruf et al. (2019) and Zheng et al. (2020), including TED (ZH-EN/EN-DE), News (EN-DE), and Europarl (EN-DE). The Chinese-English and English-German TED datasets are from IWSLT 2015 and 2017 evaluation campaigns, respectively. For ZH-EN, we use dev2010 as the development set and tst2010-2013 as the test set. For TED (EN-DE), we use tst2016-2017 as the test set and the rest as the development set. For News (EN-DE), the training/develop/test sets are: News Commentary v11, WMT newstest2015, and WMT newstest2016. For Europarl (EN-DE). The corpus is extracted from the Europarl v7 according to the method proposed in Maruf et al. (2019). + +Experiments on Spanish, French, Russian to English are also conducted, whose training sets are News Commentary v14, with the development sets and test sets are newstest2012 / newstest2013 (ES-EN), newstest2013 / newstest2014 (FR-EN), newstest2018 / newstest2019 (RU-EN), respectively. + +Besides, two additional sentence-level datasets are also adopted. For EN-DE, we use Wikipedia, a corpus containing 2.4 million pairs of sentences. For ZH-EN, we extract one-tenth of WMT 2019, around 2 million sentence pairs. + +Additionally, a document-level dataset with contrastive test sets in EN-RU (Voita et al., 2019) is used to evaluate lexical coherence. + +Lastly, we propose a new document-level dataset in this paper, whose source, scales, and benchmark will be illustrated in the subsequent sections. + +For sentences without any ending symbol inside documents, periods are manually added. For our Doc2Doc experiments, the development and test sets are documents merged by sentences. We list all the detailed information of used datasets in Table 2, including languages, scales, and downloading URLs for reproducibility. + +# 4.2 Models + +For the model setting, we follow the base version of Transformers (Vaswani et al., 2017), including 6 layers for both encoders and decoders, 512 dimensions for model, 2048 dimensions for ffn layers, 8 heads for attention. For all experiments, we use subword (Sennrich et al., 2016) with 32K merge operations on both sides and cut out tokens appearing less than five times. The models are trained with a batch size of 32000 tokens on 8 Tesla V100 GPUs. Parameters are optimized by using Adam optimizer (Kingma and Ba, 2015), with $\beta_{1} = 0.9$ , $\beta_{2} = 0.98$ and $\epsilon = 10^{-9}$ . The learning rate is scheduled according to the method proposed in Vaswani et al. (2017), with warmup_steps $= 4000$ . Label smoothing (Szegedy et al., 2016) of value $= 0.1$ is + +
ModelsZH-ENTEDEN-DEEuroparl
TEDs-BLEUd-BLEUNewss-BLEUd-BLEU
Sent2Sent (Zheng et al., 2020)17.0-23.10-22.40-29.40-
Sent2Sent (Our strong baseline)19.225.825.1929.1624.9827.0331.7033.83
DocT (Zhang et al., 2018)--24.00-23.08-29.32-
HAN (Miculicich et al., 2018)17.9-24.58-25.03-28.60-
SAN (Maruf et al., 2019)--24.42-24.84-29.75-
QCN (Yang et al., 2019)--25.19-22.37-29.82-
MCN (Zheng et al., 2020)19.125.725.1029.0924.9126.9730.4032.63
G-Trans (Bao et al., 2021)--25.1227.1725.5227.1132.3934.08
SR Doc2Doc-8.62-4.70-21.18-34.16
MR Doc2Sent19.425.825.2429.2025.0026.7032.1134.18
MR Doc2Doc-25.9-29.27-26.71-34.48
Sent2Sent ++21.927.927.1230.7427.8529.4132.1434.20
SR Doc2Doc ++-27.0-29.96-30.61-34.38
MR Doc2Sent ++22.028.127.3430.9829.5031.1732.4434.52
MR Doc2Doc ++-28.4-31.37-32.59-34.91
+ +also adopted. We set dropout $= 0.3$ for small datasets like TED and News, and dropout $= 0.1$ for larger datasets like Europarl, unless stated otherwise. + +# 4.3 Evaluation + +For inference, we generate the hypothesis with a beam size of 5. Following previous related work, we adopt tokenized case-insensitive BLEU (Papineni et al., 2002). Specifically, we follow the methods in Liu et al. (2020), which calculate sentence-level BLEU (denoted as s-BLEU) and document-level BLEU (denoted as d-BLEU), respectively. For d-BLEU, the computing object is either the concatenation of generated sentences or the directly generated documents. Since our documents are generated atomically and hard to split into sentences, we only report d-BLEU for Doc2Doc. + +# 5 Results and Analysis + +# 5.1 MR Doc2Doc Improves Performance + +MR matters. It can be seen from the upper part of Table 3 that SR Doc2Doc indeed has a severe drop on News and even fails to generate normal results on TED, which accords with the findings of Zhang et al. (2018); Liu et al. (2020). It seems too hard to learn long-range translation directly. However, once equipped with our training technique, MR Doc2Doc can yield the best results, outperforming our strong baseline and previous works on TED and Europarl. We suggest that NMT is able + +to acquire the capacity of translating long-range context, as long as it cooperates with some shorter segments as assistance. With the multi-resolutional help of easier patterns, the model can gradually master how to generate complicated sequences. + +Doc2Doc matters. We also compare MR Doc2Doc to a intuitive baseline: MR Doc2Sent. The latter one is trained in a typical Doc2Sent way: the source is the whole past context, the target is the current sentence. From the experimental results, we can see Doc2Doc outperforms it due to much broader contexts. Language model can effectively improve translation performance (Sun et al., 2021). + +To show the universality of MR Doc2Doc, we also conduct the experiments on other language pairs: Spanish, French, Russian to English. As is shown in Table 4, MR Doc2Doc can be achieved on all language pairs and obtains comparable or better results compared with Sent2Sent. + +Table 3: Experiment results of document translation. “-” means not provided. Except baseline cited from previous papers, we also re-implement our strong baseline with the best hyper-parameters (dropout, as is in section 2) on the development sets. “++” indicates using additional sentence corpus. From the upper part, though SR Doc2Doc yields disappointing translation and even fails on TED, MR Doc2Doc achieves much better results, proving the feasibility of Doc2Doc. From the lower part, extra sentence-level corpus can activate SR Doc2Doc and boost MR Doc2Doc, yielding the best results. + +
ModelsES-ENFR-ENRU-EN
Sent2Sent29.5528.6923.22
SR Doc2Doc26.7923.8616.47
MR Doc2Sent29.2328.7523.48
MR Doc2Doc29.3728.8523.98
+ +Table 4: Document translation experiments on more languages, showing the comprehensive effectiveness. + +It is worth noting that all our results are obtained without any adjustment of model architecture or any extra parameters. + +# 5.2 Additional Sentence Corpus Helps + +Furthermore, introducing extra sentence-level corpus is also an effective technique. This can be regarded as another form of multi-resolutional training, as it supplements more sentence-level information. This strategy makes an impact in two ways: activating SR Doc2Doc and boosting MR Doc2Doc. + +We merge the datasets mentioned above and Wikipedia (EN-DE), WMT (ZH-EN), two out-of-domain sentence-level datasets to do experiments. + +As is shown in the lower part of Table 3, on the one hand, SR Doc2Doc models are activated and can reach comparable levels with Sent2Sent models as long as assisted with additional sentences. On the other hand, MR Doc2Doc obtains the best results on all datasets and further widens the gap with the sentence corpus's boost. Even out-of-domain sentences can leverage the learning ability of document translation. It again proves the importance of multi-resolutional assistance. + +In addition, as analyzed in the previous section, Doc2Sent models are not compatible with sentence-level corpus since the model entrance is specially designed for consecutive sentences. However, Doc2Doc models can naturally draw on the merits of any parallel pairs, including piecemeal sentences. Considering the amount of parallel sentence-level data is much larger than the document-level one, MR Doc2Doc has a powerful application potential compared with Doc2Sent. + +# 5.3 Further Analysis on MR Doc2Doc + +# 5.3.1 Improved Discourse Coherence + +Except for BLEU, whether Doc2Doc truly learns to utilize the context to resolve discourse inconsistencies has to be verified. We use the contrastive test sets proposed by Voita et al. (2019), which include deixis, lexicon consistency, ellipsis (inflection), and ellipsis (verb phrase) on English-Russian. Each instance contains a positive translation and a few negative ones, whose difference is only one specific word. With force decoding, if the score of the positive one is the highest, then this instance is counted as correct. + +As is shown in Table 5, MR Doc2Doc achieves significant improvements and obtain the best results, which proves MR Doc2Doc indeed well captures the context information and maintain the cross-sentence coherence. + +
Modelsdeixislex.cell.inflell.VP
Sent2Sent51.145.655.427.4
Zheng et al. (2020)61.346.161.035.6
MR Doc2Doc64.746.365.953.0
+ +# 5.3.2 Strong Context Sensibility + +Li et al. (2020) find the performance of previous context-aware systems does not decrease with intentional incorrect context and suspect the context usage of context encoders. To verify whether Doc2Doc truly takes advantage of the contextual information in the document, we also conduct the inference with the wrong context deliberately. If the model neglects discourse dependency, then there should be no difference in the performance. + +Specifically, we firstly shuffle the sentence order inside each document randomly, marking it as Local Shuffle. Furthermore, we randomly swap sentences among all the documents to make the context more disordered, marking it as Global Shuffle. As is shown in Table 6, the misleading context results in a significant drop for the Doc2Doc model in BLEU. Besides, Global Shuffle brings more harm than Local Shuffle, showing that more chaotic contexts lead to more harm. After all, Local Shuffle still reserves some general information, like topic or tense. These experiments prove the usage of the context. + +Table 5: Discourse phenomena evaluation on the contrastive test sets. Our Doc2Doc shows a much better capacity for building the document coherence. + +
ModelsZH-EN TEDTEDEN-DE NewsEuroparl
MR Doc2Doc25.8429.2726.7134.48
Local Shuffle24.1027.4825.2233.52
Global Shuffle23.6927.1724.9632.47
+ +Table 6: Misleading contexts can bring negative effects to Doc2Doc, proving the dependent usage of the context information. And more chaotic contexts harm more (Global vs. Local). + +# 5.3.3 Compatible with Sentences + +The performance with sequence length is also analyzed in this study. Taking Europarl as an example, we randomly split documents into shorter paragraphs in different lengths and evaluate them with + +our models, as is shown in Figure 1. Obviously, the model trained only on sentence-level corpus has a severe drop when translating long sequences, while the model trained only on document-level corpus shows the opposite result, which reveals the importance of data distribution. However, the model trained with our multi-resolutional strategy can sufficiently cope with all situations, breaking the limitation of sequence length in translation. By conducting MR Doc2Doc, we obtain an all-in-one model that is capable of translating sequences of any length, avoiding deploying two systems for sentences and documents, respectively. + +![](images/f9deb12b784ff1e4548e4e32b6811f615ee4029ffa8618eaf197f6b935da4b22.jpg) +Figure 1: The model trained only on sentence-level or document-level corpus fails to translate sequences in unseen lengths while the MR model yields the best results in all scenarios. + +# 6 Further Evidence with Newly Proposed Datasets and Metrics + +To further verify our conclusions and push the development of this field, we also contribute a new dataset along with new metrics. Specifically, we propose a package of a large and diverse parallel document corpus, three deliberately designed metrics, and correspondingly constructed test sets3. On the one hand, they make our conclusions more solid. On the other hand, they may benefit future researches to expand the comparison scenes. + +# 6.1 Parallel Document Corpus + +We crawl bilingual news corpus from two websites4 with both English and Chinese content provided. The detailed cleaning procedure is in Appendix B. + +Finally, 1.39 million parallel sentences within almost 60 thousand parallel documents are collected. The corpus contains large-scale data with internal dependency in different lengths and diverse domains, including politics, finance, health, culture, etc. We name it PDC (Parallel Document Corpus). + +# 6.2 Metrics + +To inspect the coherence improvement, we sum up three common linguistic features in document corpus that the Sent2Sent model can not handle: + +Tense Consistency (TC): If the source language is tenseless (e.g. Chinese), it is hard for Sent2Sent models to maintain the consistency of tense. + +Conjunction Presence (CP): Traditional models ignore cross-sentence dependencies, and the sentence-level translation may cause the missing of conjunctions like "And" (Xiong et al., 2018). + +Pronoun Translation (PT): In pro-drop languages such as Chinese and Japanese, pronouns are frequently omitted. When translating from a prodrop language into a non-pro-drop language (e.g., Chinese-to-English), invisible dropped pronouns may be missing (Wang et al., 2016b,a, 2018a,b). + +Afterward, we collect documents that contain abundant verbs in the past tense, conjunctions, and pronouns, as test sets. These words, as well as their positions, are labeled. Some cases are in Appendix C. + +For each word-position pair $< w, p >$ , we check whether $w$ appears in the generated documents within a rough span. And we calculate the appearance percentage as the evaluation score, Specifically: + +$$ +\mathrm {T C} / \mathrm {C P} / \mathrm {P T} = \frac {\sum_ {i} ^ {n} \sum_ {j} ^ {| W _ {i} |} \mathbb {I} \left(w _ {i j} \in y _ {i} ^ {\text {s p a n}}\right)}{\sum_ {i} ^ {n} | W _ {i} |} \tag {3} +$$ + +$$ +\operatorname {s p a n} = \left[ \alpha_ {i} p _ {i j} - d, \alpha_ {i} p _ {i j} + d \right] \tag {4} +$$ + +$n$ indicates the number of sequences in the test set, $W_{i}$ indicates the labeled word set of sequence, $w$ indicates labeled words, $y_{i}$ indicates output, $p_{ij}$ indicates the labeled position of $w_{ij}$ in the reference, $\alpha_{i}$ indicates the length ratio of translation and reference, $d$ indicates the span radius. We set $d = 20$ in this paper, and calculate the geometric mean as the overall score denoted as TCP. + +# 6.3 Test Sets + +Along with the filtration of the aforementioned coherence indices, the test sets are built based on + +websites that are totally different from the training corpus to avoid overfitting. Meanwhile, to alleviate the bias of human translation, the English documents are selected as the reference and manually translated to the Chinese documents as the source. Finally, a total of nearly five thousand sentences within 148 documents is obtained. + +# 6.3.1 Benchmark + +Basic experiments with Sent2Sent and Doc2Doc are conducted based on our new datasets, along with full WMT ZH-EN corpus, a sentence-level dataset containing around 20 million pairs. We use WMT newtest2019 as the development set and evaluate the models with our new test sets as well as metrics. The results are shown in Table 7. + +
Systemsd-BLEUTCCPPTTCPMan
Sent2Sent27.0554.025.562.544.12.89
SR Doc2Doc24.3346.724.861.541.52.87
MR Doc2Doc27.8056.925.763.945.43.02
Sent2Sent ++30.2858.334.164.550.43.58
SR Doc2Doc ++31.2059.336.364.951.93.61
MR Doc2Doc ++31.6259.736.365.952.33.69
+ +BLEU: In terms of BLEU, MR Doc2Doc outperforms Sent2Sent, illustrating the positive effect of long-range context. Moreover, with extra sentence-level corpus, Doc2Doc shows significant improvements again. + +Fine-grained Metrics: Our metrics show much clearer improvements. Considering the usage of contextual information, tense consistency is better guaranteed with Doc2Doc. Meanwhile, Doc2Doc is much more capable of translating the invisible pronouns by capturing original referent beyond the current sentence. Finally, the conjunction presence shows the same tendency. + +Human Evaluation: Human evaluation is also conducted to illustrate the reliability of our metrics. One-fifth of translated documents are sampled and scored by linguistics experts from 1 to 5 according to not only translation quality but also translation consistency (Sun et al., 2020). As is shown in Table 7, human evaluation shows a strong correlation with TCP. More specifically, the Pearson Correla + +tion Coefficient (PCCs) between human scores and TCP is higher than that of BLEU (97.9 vs. 94.1). + +# 6.4 Case Study + +Table 8 shows an example of document translation. Sent2Sent model neglects the cross-sentence context and mistakenly translate the ambiguous word, which leads to a confusing reading experience. However, the Doc2Doc model can grasp a full picture of the historical context and make accurate decisions. + +Table 7: Benchmark of our new datasets. “++” indicates using additional WMT corpus. “Man” refers to human evaluation. Doc2Doc shows much better results in all terms. + +
Source与大多数欧洲人一样,德国总理对美国总统的“美国优先”民族主义难以掩饰不屑。 +但她已进入第四个、也必定是最后一个总理任期。
Sent2SentLike most Europeans, the German chancellor has struggled to hide his disdain for the US president's “America First” nationalism. +... +But she has entered a fourth and surely last term as prime minister.
Doc2DocLike most Europeans, the German chancellor's disdain for the US president's “America First” nationalism is hard to hide. +... +But she has entered her fourth and certainly final term as chancellor.
+ +Also, we manually switch the context information in the source side to test the model sensibility, as is shown in Table 9. It turns out that Doc2Doc is able to adapt to different contexts. + +Table 8: Coherence problem in document translation. Without discourse contexts, the Chinese word "总理" is usually translated to "prime minister", while in the context of "German", it should be translated into "chancellor". + +
CountrySent2SentDoc2DocOracle
Germanyprime ministerchancellorchancellor
Italyprime ministerprime ministerprime minister
Austriaprime ministerchancellorchancellor
Franceprime ministerprime ministerprime minister
+ +Table 9: Further study of Table 8. We switch the country information in the source side like German → Italian/Austrian/French, Berlin → Rome/Vienna/Paris. Doc2Doc model shows strong sensibility to the discourse context. + +# 7 Limitation + +Though multi-resolutional Doc2Doc achieves direct document translation and obtains better results, there still exists a big challenge: efficiency. The computation cost of self-attention in Transformer rises with the square of the sequence length. As we feed the entire document into the model, the memory usage will be a bottleneck for larger model deployment. And the inference speed may be affected if no parallel operation is conducted. Recently, many studies focus on the efficiency enhancement on long-range sequence processing (Correia et al., + +2019; Child et al., 2019; Kitaev et al., 2020; Wu et al., 2020; Beltagy et al., 2019; Rae et al., 2020). We leave reducing the computation cost to the future work. + +# 8 Related Work + +Document-level neural machine translation is an important task and has been abundantly studied with multiple datasets as well as methods. + +The mainstream research in this field is the model architecture improvement. Specifically, several recent attempts extend the Sent2Sent approach to the Doc2Sent-like one. Wang et al. (2017); Miculicich et al. (2018); Tan et al. (2019) make use of hierarchical RNNs or Transformer to summarize previous sentences. Jean et al. (2017); Bawden et al. (2017); Zhang et al. (2018); Voita et al. (2018); Kuang and Xiong (2018); Maruf et al. (2019); Yang et al. (2019); Jiang et al. (2019); Zheng et al. (2020); Yun et al. (2020); Xu et al. (2020) introduce additional encoders or query layers with attention model and feed the history contexts into decoders. Maruf and Haffari (2018); Kuang et al. (2018); Tu et al. (2018) propose to augment NMT models with a cache-like memory network, which generates the translation depending on the decoder history retrieved from the memory. + +Besides, some works intend to resolve this problem in other ways. Jean and Cho (2019) propose a regularization term for encouraging to focus more on the additional context using a multi-level pairwise ranking loss. Yu et al. (2020) utilize a noisy channel reranker with Bayes' rule. Garcia et al. (2019) extends the beam search decoding process with fusing an attentional RNN with an SSLM by modifying the computation of the final score. Saunders et al. (2020) present an approach for structured loss training with document-level objective functions. Liu et al. (2020); Ma et al. (2020) combine large-scale pre-train model with DNMT. Unanue et al. (2020); Kang et al. (2020) adopt reinforcement learning methods. + +There are also some works sharing similar ideas with us. Tiedemann and Scherrer (2017); Bawden et al. (2017) explore concatenating two consecutive sentences and generate two sentences directly. Obviously, we leverage greatly longer information and capture the full context. Junczys-Dowmunt (2019) cut documents into long segments and feed them into training like BERT (Devlin et al., 2019). There are at least three main differences. Firstly, + +they need to add specific boundary tokens between sentences while we directly translate the original documents without any additional processing. Secondly, we propose a novel multi-resolutional training paradigm that shows consistent improvements compared with regular training. Thirdly, for extremely long documents, they restrict the segment length to 1000 tokens or make a truncation while we preserve entire documents and achieve literal document-to-document training and inference. + +Finally, our work is also related to a series of studies in long sequence generation like GPT (Radford, 2018), GPT-2 (Radford et al., 2019), and Transformer-XL (Dai et al., 2019). We all suggest that the deep neural generation models have the potential to well process long-range sequences. + +# 9 Conclusion + +In this paper, we try to answer the question of whether Document-to-document translation works. It seems naive Doc2Doc can fail in multiple scenes. However, with the multi-resolutional training proposed in this paper, it can be successfully activated. Different from traditional methods of modifying the model architectures, our approach introduces no extra parameters. A comprehensive set of experiments on various metrics show the advantage of MR Doc2Doc. In addition, we contribute a new document-level dataset as well as three new metrics to the community. + +# References + +Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. 2015. Neural machine translation by jointly learning to align and translate. In ICLR. +Guangsheng Bao, Yue Zhang, Zhiyang Teng, Boxing Chen, and Weihua Luo. 2021. G-transformer for document-level machine translation. In ACL. +Rachel Bawden, Rico Sennrich, Alexandra Birch, and Barry Haddow. 2017. Evaluating discourse phenomena in neural machine translation. In NAACL-HLT. +Iz Beltagy, Matthew E Peters, and Arman Cohan. 2019. Longformer: The long-document transformer. arXiv, abs/2004.05150. +Rewon Child, Scott Gray, Alec Radford, and Ilya Sutskever. 2019. Generating long sequences with sparse transformers. arXiv, abs/1904.10509. +Gonçalo M Correia, Vlad Niculae, and André FT Martins. 2019. Adaptively sparse transformers. In EMNLP-IJCNLP. + +Zihang Dai, Zhilin Yang, Yiming Yang, Jaime G. Carbonell, Quoc V. Le, and Ruslan Salakhutdinov. 2019. Transformer-xl: Attentive language models beyond a fixed-length context. In ACL. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. Bert: Pre-training of deep bidirectional transformers for language understanding. In *NAACL-HLT*. +Eva Martínez Garcia, C. Creus, and C. España-Bonet. 2019. Context-aware neural machine translation decoding. In DiscoMT@EMNLP. +Sebastien Jean and Kyunghyun Cho. 2019. Context-aware learning for neural machine translation. arXiv, abs/1903.04715. +Sebastien Jean, Stanislas Lauly, Orhan First, and Kyunghyun Cho. 2017. Neural machine translation for cross-lingual pronoun prediction. In DiscoMT@EMNLP. +Shu Jiang, Rui Wang, Zuchao Li, Masao Utiyama, Kehai Chen, Eiichiro Sumita, Hai Zhao, and Bao-Liang Lu. 2019. Document-level neural machine translation with inter-sentence attention. arXiv, abs/1910.14528. +Marcin Junczys-Dowmunt. 2019. Microsoft translator at wmt 2019: Towards large-scale document-level neural machine translation. In WMT. +Prathyusha Jwalapuram, Barbara Rychalska, Shafiq Joty, and Dominika Basaj. 2020. Can your context-aware mt system pass the dip benchmark tests? : Evaluation benchmarks for discourse phenomena in machine translation. arXiv, abs/2004.14607. +Xiaomian Kang, Yang Zhao, Jiajun Zhang, and Chengqing Zong. 2020. Dynamic context selection for document-level neural machine translation via reinforcement learning. In EMNLP. +Yunsu Kim, Thanh Tran, and Hermann Ney. 2019. When and why is document-level context useful in neural machine translation? In DiscoMT@EMNLP-IJCNLP. +Diederick P Kingma and Jimmy Ba. 2015. Adam: A method for stochastic optimization. In ICLR. +Nikita Kitaev, Lukasz Kaiser, and Anselm Levskaya. 2020. Reformer: The efficient transformer. In ICLR. +Philipp Koehn and Rebecca Knowles. 2017. Six challenges for neural machine translation. In NMT@ACL. +Shaohui Kuang and Deyi Xiong. 2018. Fusing recency into neural machine translation with an intersentence gate model. In COLING. +Shaohui Kuang, Deyi Xiong, Weihua Luo, and Guodong Zhou. 2018. Modeling coherence for neural machine translation with dynamic and topic caches. In COLING. + +Samuel Läubli, Rico Sennrich, and Martin Volk. 2018. Has machine translation achieved human parity? a case for document-level evaluation. In EMNLP. +Bei Li, Hui Liu, Ziyang Wang, Yufan Jiang, Tong Xiao, Jingbo Zhu, Tongran Liu, and Changliang Li. 2020. Does multi-encoder help? a case study on context-aware neural machine translation. In ACL. +Yinhan Liu, Jiatao Gu, Naman Goyal, Xiongmin Li, Sergey Edunov, Marjan Ghazvininejad, Mike Lewis, and Luke Zettlemoyer. 2020. Multilingual denoising pre-training for neural machine translation. TACL. +Shuming Ma, Dongdong Zhang, and Ming Zhou. 2020. A simple and effective unified encoder for document-level machine translation. In ACL. +Sameen Maruf and Gholamreza Haffari. 2018. Document context neural machine translation with memory networks. In ACL. +Sameen Maruf, André F. T. Martins, and Gholamreza" Haffari. 2019. Selective attention for context-aware neural machine translation. In NAACL-HLT. +Lesly Miculicich, Dhananjay Ram, Nikolaos Pappas, and James Henderson. 2018. Document-level neural machine translation with hierarchical attention networks. In EMNLP. +Mathias Müller, Annette Rios Gonzales, Elena Voita, and Rico Sennrich. 2018. A large-scale test set for the evaluation of context-aware pronoun translation in neural machine translation. In WMT. +Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. 2002. Bleu: a method for automatic evaluation of machine translation. In ACL. +Alec Radford. 2018. Improving language understanding by generative pre-training. +Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019. Language models are unsupervised multitask learners. +Jack W Rae, Anna Potapenko, Siddhant M Jayakumar, Chloe Hillier, and Timothy P Lillicrap. 2020. Compressive transformers for long-range sequence modelling. In ICLR. +Danielle Saunders, Felix Stahlberg, and Bill Byrne. 2020. Using context in neural machine translation training objectives. In ACL. +Rico Sennrich, Barry Haddow, and Alexandra Birch. 2016. Neural machine translation of rare words with subword units. In ACL. +Zewei Sun, Shujian Huang, Hao-Ran Wei, Xin-yu Dai, and Jiajun Chen. 2020. Generating diverse translation by manipulating multi-head attention. In AAAI. + +Zewei Sun, Mingxuan Wang, and Lei Li. 2021. Multilingual translation via grafting pre-trained language models. In EMNLP-Findings. +Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jonathon Shlens, and Zbigniew Wojna. 2016. Rethinking the inception architecture for computer vision. In CVPR. +Xin Tan, Longyin Zhang, Deyi Xiong, and Guodong Zhou. 2019. Hierarchical modeling of global context for document-level neural machine translation. In EMNLP-IJCNLP. +Jörg Tiedemann and Yves Scherrer. 2017. Neural machine translation with extended context. In DiscoMT@EMNLP. +Zhaopeng Tu, Yang P. Liu, Shuming Shi, and Tong Zhang. 2018. Learning to remember translation history with a continuous cache. TACL. +Inigo Jauregi Unanue, Nazanin Esmaili, Gholamreza Haffari, and Massimo Piccardi. 2020. Leveraging discourse rewards for document-level neural machine translation. In COLING. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In NIPS. +Elena Voita, Rico Sennrich, and Ivan Titov. 2019. When a good translation is wrong in context: Context-aware machine translation improves on deixis, ellipsis, and lexical cohesion. In ACL. +Elena Voita, Pavel Serdyukov, Rico Sennrich, and Ivan Titov. 2018. Context-aware neural machine translation learns anaphora resolution. In ACL. +Longyue Wang, Zhaopeng Tu, Shuming Shi, Tong Zhang, Yvette Graham, and Qun Liu. 2018a. Translating pro-drop languages with reconstruction models. In AAAI. +Longyue Wang, Zhaopeng Tu, Andy Way, and Qun Liu. 2017. Exploiting cross-sentence context for neural machine translation. In EMNLP. +Longyue Wang, Zhaopeng Tu, Andy Way, and Qun Liu. 2018b. Learning to jointly translate and predict dropped pronouns with a shared reconstruction mechanism. In EMNLP. +Longyue Wang, Zhaopeng Tu, Xiaojun Zhang, Hang Li, Andy Way, and Qun Liu. 2016a. A novel approach to dropped pronoun translation. In NAACL-HLT. +Longyue Wang, Xiaojun Zhang, Zhaopeng Tu, Hang Li, and Qun Liu. 2016b. Dropped pronoun generation for dialogue machine translation. In ICASSP. +Lesly Miculicich Werlen and Andrei Popescu-Belis. 2017. Validation of an automatic metric for the accuracy of pronoun translation (apt). In DiscoMT@EMNLP. + +Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V. Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, Jeff Klingner, Apurva Shah, Melvin Johnson, Xiaobing Liu, Lukasz Kaiser, Stephan Gouws, Yoshikiyo Kato, Taku Kudo, Hideto Kazawa, Keith Stevens, George Kurian, Nishant Patil, Wei Wang, Cliff Young, Jason Smith, Jason Riesa, Alex Rudnick, Oriol Vinyls, Gregory S. Corrado, Macduff Hughes, and Jeffrey Dean. 2016. Google's neural machine translation system: Bridging the gap between human and machine translation. arXiv, abs/1609.08144. +Zhanghao Wu, Zhijian Liu, Ji Lin, Yujun Lin, and Song Han. 2020. Lite transformer with long-short range attention. In ICLR. +Hao Xiong, Zhongjun He, Hua Wu, and Haifeng Wang. 2018. Modeling coherence for discourse neural machine translation. In AAAI. +Hongfei Xu, Deyi Xiong, Josef van Genabith, and Qiuhui Liu. 2020. Efficient context-aware neural machine translation with layer-wise weighting and input-aware gating. In DiscoMT@IJCAI. +Zhengxin Yang, Jinchao Zhang, Fandong Meng, Shuhao Gu, Yang Feng, and Jie Zhou. 2019. Enhancing context modeling with a query-guided capsule network for document-level nmt. In EMNLP-IJCNLP. +Lei Yu, Laurent Sartran, Wojciech Stokowiec, Wang Ling, Lingpeng Kong, Phil Blunsom, and Chris Dyer. 2020. Better document-level machine translation with bayes' rule. TACL. +Hyeongu Yun, Yongkeun Hwang, and Kyomin Jung. 2020. Improving context-aware neural machine translation using self-attentive sentence embedding. In AAAI. +Jiacheng Zhang, Huanbo Luan, Maosong Sun, Feifei Zhai, Jingfang Xu, Min Zhang, and Yang P. Liu. 2018. Improving the transformer translation model with document-level context. In EMNLP. +Zaixiang Zheng, Xiang Yue, Shujian Huang, Jiajun Chen, and Alexandra Birch. 2020. Toward making the most of context in neural machine translation. In IJCAI. + +# A Oversampling Illustration + +When combining document-level datasets with sentence-level datasets (especially out-of-domain corpus), we employ oversampling for non-MR settings. This can keep them the same data ratio with the MR setting and is helpful for their performance. Since the data size of MR is around 6 times of non-MR $(\approx \log_264)$ , as shown in Table 10, we mainly oversample for 6 times. The contrastive experiments are in Table 11. We attribute the improvements to the reduction of the proportion of out-of-domain data. + +
DatasetsRatio
TED (ZH-EN)6.7
TED (EN-DE)7.6
News (EN-DE)5.9
Europal4.6
News (ES-EN)5.9
News (FR-EN)5.9
News (RU-EN)5.9
PDC5.3
Mean6.0
+ +Table 10: Ratio of MR/non-MR in data size + +
DatasetSent2SentSR Doc2Doc
non-OSOSnon-OSOS
TED(ZH-EN)+WMT27.5227.9026.0526.67
TED(EN-DE)+Wiki29.1930.7429.8129.96
News+Wiki27.7729.4130.1530.61
Europarl+Wiki33.9334.2034.2534.38
PDC+WMT29.5230.2829.6031.20
+ +# B Clean Procedure on PDC + +We mainly crawl bilingual news corpus from two websites (https://cn.nytimes.com, https://cn.ft.com) with both English and Chinese content provided. Then three steps are followed to clean the corpus. + +1. Dedduplication: We deduplicate the documents that include almost the same content. +2. Sentence Segmentation: We use Pragmatic Segmenter to segment paragraphs into sentences. +3. Filtration: We use fast_align to align sentence pairs and label the pairs as misaligned ones if the alignment scores are less than $40\%$ . Documents are finally removed if they contain misaligned sentence pairs. + +Finally, we obtain 1.39 million parallel sentences within almost 60 thousand cleaned parallel documents. The dataset contains diverse domains including politics, finance, health, culture, etc. + +# C Cases of Our Test Sets + +Apart from the statistic number in the main paper, we also provide some cases in our test sets to illustrate the value of our test sets and metrics, as shown in Table 12,13,14. + +Table 11: The contrastive results of oversampling when combining sentence-level corpus. + +
Src1.双方在2017年都向法庭提交了申请。 +2.邓普顿奈特想要报销他的租金。 +3.伯德特想要赶走邓普顿奈特。
Ref1.Both parties had lodged applications with the tribunal in 2017. +2.Templeton-Knight wanted his rent reimbursed. +3.Burdett wanted to evict Templeton-Knight.
NMT1.Both parties filed applications with the court in 2017. +2.Templeton Knight wants to reimburse his rent. +3.Burdett wants to get rid of Templeton Knight.
+ +Table 12: Tense inconsistency problem in translating tenseless languages (e.g. Chinese) to tense-sensitive languages (e.g. English). Individual sentences are translated into present tense with sentence-level models while the history context has provided the signal of past tense. + +
Src1.我女儿使用的胰岛素类型——世界上只有两家类似类型的制造商。 +2.他们继续保持一致同时提高价格。
Ref1.The type of insulin that my daughter uses — there are only two manufacturers worldwide of a similar type. +2.And they continue to increase their prices lockstep together.
NMT1.The type of insulin my daughter uses - there are only two manufacturers of similar types in the world. +2.[conj miss] They continue to be consistent while raising prices.
+ +Table 13: Conjunction missing problem in sentence-level translation. The sentences has strong semantic connection but are translated without any conjunction. + +
Src1.根据市政府的说法,奥特里工厂的其他拟议功能似乎极不可能实施。 +2.即使顾问和调查人推荐[pro drop]。
Ref1.Other proposed features for Autrey Mill seem highly unlikely to be implemented according to the City Manager. +2. Even though consultants and surveys recommended them.
NMT_A1. According to the city government, other proposed functions at the Autrey plant appear highly unlikely to be implemented. +2. Even if consultants and surveys recommend [pro miss].
NMT_B1. According to the municipal government, other proposed functions of the Autrey plant seem highly impossible to implement. +2. Even if consultants and surveys recommended it.
+ +Table 14: Pronoun drop problem in translating pro-drop languages (e.g. Chinese) to non-pro-drop languages (e.g. English). The pronoun is omitted or translated wrongly with sentence-level models.. \ No newline at end of file diff --git a/rethinkingdocumentlevelneuralmachinetranslation/images.zip b/rethinkingdocumentlevelneuralmachinetranslation/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..f4683bff7c45efe2381e6476455c3717633dd186 --- /dev/null +++ b/rethinkingdocumentlevelneuralmachinetranslation/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d3251de392979f6c64d9c8abd955c1e0a8567c7f2b1c867e1b2c30ef8ff2d154 +size 540819 diff --git a/rethinkingdocumentlevelneuralmachinetranslation/layout.json b/rethinkingdocumentlevelneuralmachinetranslation/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..23d51a2ac2631438c90addf1052c44a9dcb2cd85 --- /dev/null +++ b/rethinkingdocumentlevelneuralmachinetranslation/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:436e1965fe6335579b369fca86f47e44a2f18c6a8c2d82848454448a8912d070 +size 410545 diff --git a/rethinkingoffensivetextdetectionasamultihopreasoningproblem/7b26861c-6654-4ba2-bc6f-586b6103d5e5_content_list.json b/rethinkingoffensivetextdetectionasamultihopreasoningproblem/7b26861c-6654-4ba2-bc6f-586b6103d5e5_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..791ffaf0ea2ed10bf356e62c4a4bc8d4308a9001 --- /dev/null +++ b/rethinkingoffensivetextdetectionasamultihopreasoningproblem/7b26861c-6654-4ba2-bc6f-586b6103d5e5_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a91b24c7c0f9cf3a2e262107d3bc0974c3d3e14dee71cef225124630a9fd74cc +size 102412 diff --git a/rethinkingoffensivetextdetectionasamultihopreasoningproblem/7b26861c-6654-4ba2-bc6f-586b6103d5e5_model.json b/rethinkingoffensivetextdetectionasamultihopreasoningproblem/7b26861c-6654-4ba2-bc6f-586b6103d5e5_model.json new file mode 100644 index 0000000000000000000000000000000000000000..32db75b03aebfec21d336c3f973f116c923443b3 --- /dev/null +++ b/rethinkingoffensivetextdetectionasamultihopreasoningproblem/7b26861c-6654-4ba2-bc6f-586b6103d5e5_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce574720eb2a87ea45401e8d817eadda711586d112594db8bc1927ec414aa529 +size 124830 diff --git a/rethinkingoffensivetextdetectionasamultihopreasoningproblem/7b26861c-6654-4ba2-bc6f-586b6103d5e5_origin.pdf b/rethinkingoffensivetextdetectionasamultihopreasoningproblem/7b26861c-6654-4ba2-bc6f-586b6103d5e5_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..0bc42de417c5c9955951a17c52d27360af87c947 --- /dev/null +++ b/rethinkingoffensivetextdetectionasamultihopreasoningproblem/7b26861c-6654-4ba2-bc6f-586b6103d5e5_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9753a90c27facfc96a0bf0f088341450f7cdec1080349e45f8271e843abeb419 +size 850840 diff --git a/rethinkingoffensivetextdetectionasamultihopreasoningproblem/full.md b/rethinkingoffensivetextdetectionasamultihopreasoningproblem/full.md new file mode 100644 index 0000000000000000000000000000000000000000..8a959b548523bba8828a69fbc7f249fad7f5360b --- /dev/null +++ b/rethinkingoffensivetextdetectionasamultihopreasoningproblem/full.md @@ -0,0 +1,408 @@ +# Rethinking Offensive Text Detection as a Multi-Hop Reasoning Problem + +Qiang Zhang, Jason Naradowsky, Yusuke Miyao +Department of Computer Science, The University of Tokyo, Tokyo +{qiang-z714, narad} @ g.ecc.u-tokyo.ac.jp +yusuke@is.s.u-tokyo.ac.jp + +# Abstract + +We introduce the task of implicit offensive text detection in dialogues, where a statement may have either an offensive or non-offensive interpretation, depending on the listener and context. We argue that reasoning is crucial for understanding this broader class of offensive utterances and release SLIGHT, a dataset to support research on this task. Experiments using the data show that state-of-the-art methods of offense detection perform poorly when asked to detect implicitly offensive statements, achieving only $\sim 11\%$ accuracy. + +In contrast to existing offensive text detection datasets, SLIGHT features human-annotated chains of reasoning which describe the mental process by which an offensive interpretation can be reached from each ambiguous statement. We explore the potential for a multi-hop reasoning approach by utilizing existing entailment models to score the probability of these chains and show that even naive reasoning models can yield improved performance in most situations. Furthermore, analysis of the chains provides insight into the human interpretation process and emphasizes the importance of incorporating additional commonsense knowledge. + +# 1 Introduction + +With the development and popularity of online forums and social media platforms, the world is becoming an increasingly connected place to share information and opinions. However, the benefit that these platforms provide to society is often marred by the creation of an unprecedented amount of bullying, hate, and other abusive speech1. Such toxic speech has detrimental effects on online communities and can cause significant personal harm. Efforts by the NLP community to address this problem has led to the development of models capable + +of identifying toxic speech in specific domains (sexism (Golbeck et al., 2017), racism (Waseem, 2016), or otherwise hateful text (Ross et al., 2016; Gao and Huang, 2017; Davidson et al., 2017)), but the problem of identifying harmful text can also involve more complex pragmatic reasoning. + +Consider a scenario where a young girl runs into her elderly neighbor who remarks, "Your piano playing has really improved lately!" Most people (and classifiers) would likely take this comment as a compliment. However, in some circumstances, the intent may be the opposite. The neighbor can only have knowledge of the girl's piano progress if she is able to hear it, and being able to hear it may indicate that it is too loud, implying that the girl is inconsiderate of her neighbors. Through this reasoning process, we may reach the less complimentary interpretation, namely that the neighbor is annoyed by the playing and the comment is a subtle attempt to convey it. + +This work considers how current models of offensive text detection (OTD) perform when faced with such ambiguous examples of offensive text. Following the classification proposed in Waseem et al. (2017), we consider two categories of OTD: (1) explicit offensive text, which is unambiguous in its potential to be offensive and often includes overtly offensive terms, such as slurs, and (2) implicit offensive text, which is more ambiguous and may use sarcasm, innuendo, or other rhetorical devices to hide the intended nature of the statement. We hypothesize that there exists a direct relationship between these tasks and that each implicitly offensive statement corresponds to an explicitly offensive statement which is realized through the interpretation process. This explicitly offensive statement is closer to the sentiment the listener feels when interpreting the statement as + +offensive. Consider the example in Figure 1, a dialogue between two speakers, S1 and S2: + +S1: "I love bookclubs, I go every week" + +S2: "Some places with free food, right?" + +By itself, the statement by S2 is innocuous and could be interpreted as a simple prompt for more information about the bookclub. However, other interpretations of this statement could lead S1 to arrive at a number of explicitly offensive statements, such as (1) "You are poor." (2) "You are fat." (3) "You are not smart/sophisticated." Thus we consider the chain of reasoning which constitutes the interpretation a crucial part of recognizing implicitly offensive statements. + +To study this phenomenon, we use human annotators to construct a dataset consisting of (1) an implicitly offensive statement, (2) a corresponding explicitly offensive statement, and (3) a chain of reasoning mapping (1) to (2). When evaluated on the explicitly offensive examples, state-of-the-art models perform well, achieving $>90\%$ accuracy. However, when applied to the implicit OTD examples, the accuracy of the models drops to an average of about $< 11\%$ . We then explore using a multi-hop reasoning-based approach by utilizing a pre-trained entailment model to score the transitions along each "hop" of the reasoning chain. When incorporating additional knowledge (from human annotations) into the premises of each entailment, we achieve higher accuracy than comparable methods which do not utilize the reasoning chain. We present this as the evidence that a multi-hop reasoning-based approach is a promising solution to this problem and release our data to support further research on the topic. + +Our contributions in this work are threefold: + +- We propose the task of implicit offensive text detection (Implicit OTD) and construct a dataset containing ambiguously offensive statements annotated with reasoning chains to support research into how listeners arrive at offensive interpretations. +- We conduct experiments using existing state-of-the-art OTD models and show they perform poorly on the Implicit OTD task. +- We examine entailment models as part of a multi-hop reasoning approach for Implicit OTD, showing improved accuracy in most + +![](images/bef23a3573d7c7e080f90023368ada9443c95fae4f56271362277325c94bf070.jpg) +Figure 1: An instance illustrating Explicit OTD, Implicit OTD and our multi-hop reasoning approach. + +cases. In addition, we provide an analysis of which types of reasoning are most challenging and which types of external knowledge are required. + +# 2 Related Works + +Context Matters The notion that reasoning beyond the literal meaning is vital for OTD is not new. The Hateful Memes dataset (Kiela et al., 2021) pairs images with unrelated text captions. Both of these components are benign when considered independently but, when combined, can occasionally produce a context where the message can be interpreted as offensive. Consequently, approaches that jointly reason over a combined modality representation outperform those that treat each modality independently + +However, the importance of solving such problems in the purely textual domain, where the context may be more situational or personal, is a pressing concern. Netizens have shown surprising creativity when adapting language to elude internet censorship (Hiruncharoenvate et al., 2015; Ji and Knight, 2018), and, in the same way spam filters have resulted in more sophisticated spam messages, widespread use of simple OTD classifiers may motivate cyberbullies to find more inventive and indirect ways of delivering offensive content. + +OTD in Text Classification Early approaches to OTD relied primarily upon dictionaries like hate-base $^{3}$ to lookup offensive words and phrases. The creation of OTD datasets enabled the development of ML-based approaches utilizing simple features, such as bag-of-word representations (Davidson et al., 2017). With the advent of social media platforms, many resources have been developed for identifying toxic comments in web text (Waseem and Hovy, 2016; Davidson et al., 2017), including many deep learning-based methods (Pitsilis et al., 2018; Zhang et al., 2018b; Casula et al., 2020; Yasaswini et al., 2021; Djandji et al., 2020). Notably, all of these methods can be described as building a contextual representation of a sentence (whether trained end-to-end or on top of existing pre-trained language models) and making a classification based on this representation. + +OTD in Dialogue Systems As user-facing technologies, preventing dialogue systems from producing offensive statements is crucial for their role in society. As noted in Dinan et al. (2020), toxicity in generated dialogue may begin with biases and offensive content in the training data, and debiasing techniques focused on gender can reduce the number of sexist comments generated by the resulting system. Similar outcomes can be obtained through adjustments to the model or training procedure. For instance, during training, toxic words can be masked to reduce their role in model predictions (Dale et al., 2021). GeDi (Krause et al., 2021) proposed using class-conditional LMs as discriminators to reduce the toxicity produced by large pre-trained LMs (GPT-2). Additionally, it may also be important to identify offensive statements made to a dialogue system, as it has been shown that dialogue systems can react with counteraggression (Cercas Curry and Rieser, 2018), and systems that continuously learn during deployment may incorporate toxic user responses into future generations. + +Subjectivity in Interpretation Previous work has hit upon the role that an individual's perspective may play when determining offensiveness. For instance, annotations exist on a hierarchy in the Offensive Language Identification Dataset (OLID) (Zampieri et al., 2019a,b, 2020), a widely used OTD dataset. Each level dictates the targets of the offensive text, in terms of their identity as + +a group, individual, or entity. However, to our knowledge, a person's identity or attributes have not played a critical role in existing OTD research. OLID was also augmented with labels for capturing the degree of explicitness (Caselli et al., 2020) and may also support research into resolving implicitly offensive statements. Implicitness in OLID is primarily defined as the lack of an overtly offensive word or slur. However, the aforementioned personal attributes or subjectivity of interpretation are not considered. Our dataset differs in this respect, as we consider not just if a statement is offensive but how it can be considered offensive by defining the interpretation process as a chain of reasoning towards a subjective experience. In this sense, a more similar approach comes from normative reasoning in moral stories (Emelin et al., 2021), where a short chain of reasoning is used to assess the morality of actions and consequences. + +# 3 Data + +We propose SLIGHT $^{4}$ , a dataset for the study of Implicit OTD as a multi-hop reasoning problem or as a diagnostic to test models' ability to identify implicitly offensive statements. + +Each example in the dataset consists of three parts: + +1. A personal attribute of the reader/listener. +2. A triplet of an implicitly offensive statement, its corresponding explicitly offensive statement, and a non-offensive statement (for the given attribute). +3. A chain of reasoning, describing the iterative process of how the ambiguity of the implicitly offensive statement can be resolved into the corresponding explicitly offensive statement. Example reasoning chains are provided in Appendix A. + +Annotations are crowdsourced using Amazon Mechanical Turk (AMT). We performed four rounds of pilot experiments in which high-quality annotators were identified, and the annotation instructions were refined to address any observed confusion in the annotation process. The final instructions can be found in Appendix C. Due to the nature of the data, all participants were briefed that the task would involve offensive content and were + +# Knowledge + +Only the best can win contests. + +Classic things are usually old. + +Grown-ups don't play with dolls. + +Parents want children to be independent. + +Overworking makes people exhausted. + +Table 1: Samples of the knowledge used to construct chains of reasoning. + +provided an option to stop the task at any point. Annotators could report personally offensive examples, though no examples were flagged in this manner, and no personal attributes based on race, ethnicity, or gender were included in the dataset. + +All workers were paid an average hourly wage of $6.2, with additional bonuses depending on annotation quality and working hours. Compared to the average AMT wage of$ 2 (Hara et al., 2018), we pay relatively more to encourage high-quality annotations of a challenging task. We did not limit the location of annotators, requiring only English proficiency. This allows for a diverse range of viewpoints to help understand how statements may be interpreted in different ways by different cultures (Poggi and D'Errico, 2018). + +# 3.1 Annotation Scheme + +Personal Attribute As we have defined in Section 1, we argue that the context in which a statement occurs is crucial to understanding its potential in creating an offensive interpretation. Therefore, the context should play an important role in the annotation task. However, providing an overly specific context can increase the difficulty of providing a relevant implicitly offensive statement. To make the annotation task more feasible, we reduce the context to a single feature: a personal attribute of a hypothetical reader/listener. + +The set of attributes is obtained from the personas in the PERSON-CHAT corpus (Zhang et al., 2018a), of the form "I like sweets." or "I work as a stand up comedian." Attributes related to ethnicity, gender, and other protected classes are manually removed (based on keyword matching with Hatebase entries), leaving 5334 distinct attributes. We divide the attributes into several categories (detailed category information can be found in Appendix B) before randomly sampling a subset of 920 attributes, uniformly across categories, in order to increase the number of workers assigned to each attribute. + +Implicit, Explicit and Non-offensive Text For each example, workers were provided 3 diverse attributes and asked to choose one as a writing prompt. The workers are then instructed to provide annotation in the form of example sentences, including: + +Implicitly offensive statement Utterances that do not express an overt intention to cause offense and often require complicated reasoning or external knowledge to be fully recognized as offensive contents. + +Explicitly offensive statement Utterances contain an obvious and direct intention or explicit expressions to cause offense without external knowledge or reasoning processes. + +Non-offensive statement Utterances do not cause offense under the context initiated with the attribute. + +Both explicit and implicit offensive statements should share the same meaning in terms of how they are offensive. Non-offensive statements are collected to construct a balanced dataset and evaluate the accuracy of existing OTD models. + +Chain of Reasoning A distinguishing characteristic of our work is the collection of chains of reasoning to explain the interpretation process for implicitly offensive text. We represent the chain of reasoning as a series of sentence-to-sentence rewrites, similar to natural logic (MacCartney and Manning, 2014). One practical advantage of using a sentence-based representation for reasoning steps (in comparison to a structured representation like predicate-argument tuples) is that it allows the use of powerful text-to-text (T5) (Raffel et al., 2020) and entailment models (Zhuang et al., 2021; He et al., 2021), which are trained on sentence-level input. + +Formally each chain begins with an implicitly offensive statement (0-th step, denoted as $s_0$ ) and ends with an explicitly offensive statement ( $s_L$ ). The number of steps between $s_0$ and $s_L$ defines the length of the chain. + +# 3.2 Post-processing + +We collected 2657 examples from the AMT and performed post-processing to ensure the quality of the data. We define three processes to edit the collected annotations to standardize the format of the reasoning steps listed below. Examples with steps that can not be handled by any of the processes are removed from the dataset. To reduce biases in + +
ModelsAccuracy
SLIGHTTwitterOffensEvalToxicity
ImplicitExplicitNonAllAllAllAll
RoBERTa-Tawitter1.779.099.759.585.985.889.1
BERT-OffensEval15.993.299.262.882.282.484.2
ALBERT-OffensEval9.788.694.565.282.482.785.2
BERT-Toxicity14.896.698.561.981.281.983.6
ALBERT-Toxicity11.491.594.962.879.480.382.6
Avg.10.789.897.462.582.282.684.9
+ +Table 2: Performance of SOTA OTD models on the classification task. Non: Non-offensive. + +post-processing, we assign three workers to each task. + +Attribute Insertion Rule (AIR) We insert the attribute statement into the first reasoning step $(s_1)$ to make this information accessible to any model taking the sentence as input. For instance, for an example with the attribute, "I am colorblind." and the implicit offensive statement, "Oh, that would explain your wardrobe!", the reasoning step "Oh, your color blindness would explain your wardrobe!" generated by the worker is tagged as AIR. + +Knowledge Insertion Rule (KIR) Steps that are used to introduce external commonsense knowledge are tagged as KIR. For instance, to support the reasoning process from step "You are a grown-up who can't afford to rent a house." to "You are poor," the knowledge of "Poor people can't afford to rent a house." is introduced. The following step, "You are poor." is then tagged as KIR. To better understand the effectiveness of external knowledge, we also extract the commonsense knowledge during the post-processing (Table 1). + +Rephrasing Rule (RR) Steps that have equivalent meaning to previous steps but can be simplified by rephrasing are tagged as RR. For instance, to express more explicit offensive meaning, a reasoning step written as a question "Do you like meat too much, or just food in general?" is rephrased as a declarative sentence step "You must love food too much in general." and tagged as RR. + +# 3.3 Post-processing Results + +Of the initially collected 2657 examples, 1050 remained after the post-processing. The high task rejection rate (60.5%) also conveys the difficulty of this content generation task. The average length of + +a reasoning chain is 4.84 steps in the dataset, with a minimum length of 3 (60 examples) and a maximum of 6 (39 examples). Among all three tags, RR is most frequently applied $(59.6\%)$ , followed by KIR $(21.5\%)$ and AIR $(18.9\%)$ . + +# 4 Experiments + +We evaluate the difficulty of the Implicit OTD task using existing state-of-the-art models before exploring a multi-hop approach to Implicit OTD using existing entailment models to score transitions in the reasoning chains. + +# 4.1 Sentence Classification + +We begin by evaluating existing state-of-the-art OTD models on both the Implicit-OTD and the Explicit-OTD task. These include BERT (Devlin et al., 2019), RoBERTa (Liu et al., 2019), and ALBERT (Lan et al., 2020), three pre-trained large scale language models fine-tuned on existing OTD datasets, which produce the highest accuracy reported on the explicit OTD task. + +These models are fine-tuned on three OTD datasets, including (1) the OLID/OffensEval2019 dataset (Zampieri et al., 2019a), discussed in Section 2, which contains 14,200 labeled tweets and includes implicit offensive statements, (2) the TWEETEVAL (Barbieri et al., 2020) multi-task offensive Twitter set for detecting irony, hate speech and offensive language, and (3) the Google Jigsaw Toxic Comments dataset which contains 159,571 samples in the training set. In the subsequent sections, we refer to these datasets as OffensEval, Twitter, and Toxicity, respectively. + +Table 2 shows the results of the baseline models on correctly classifying the implicitly and explicitly + +![](images/849890d6a9992e9557187d22daefc5adc3a320ad288d6ce1d88deefae3204380.jpg) +Figure 2: An example demonstrating the entailment experiment. Entailment scores between adjacent steps are given by the text entailment models. Arrows represent the entailment processes. $E_{s_i \to s_j}$ represents the entailment score from step $i$ to step $j$ , where $s_0$ represents the implicit offense and $s_L$ represents the last step (step 5 in this example) of the chain. + +offensive text as offensive/non-offensive (systems are denoted as a hyphenated combination of pretrained model and dataset). In every situation, the performance on the implicit task is significantly lower. The overall trend is perhaps unsurprising, as implicit examples lack clear indicators of aggressiveness, such as highly offensive words. However, the degree to which these models underperform in the Implicit-OTD task illustrates the extent to which these tasks differ and highlights the risk of deploying such models to perform this task in real-world situations. + +An underlying assumption of this work and the motivation for reasoning chains is the expectation that the interpretation of the implicitly offensive utterance becomes increasingly (explicitly) offensive as the reasoning process is applied. We evaluate the extent to which this holds in the dataset, using the baseline systems to predict the offensiveness of each rewrite across the reasoning chain. Appendix D shows that moving down the reasoning chain indeed correlates with higher accuracy, implying that each step gradually reveals more offensive connotations in the implicit offense. It also verifies that the collected and annotated chains have the property of being orderly. + +# 4.2 Reasoning by Entailment + +The results of Section 4.1 indicate two things: current OTD systems perform poorly on the implicit OTD task, and the difficulty of using existing models decreases as each successive step of the reasoning chain is applied. This insight hints at a potential approach to implicit OTD: apply a reasoning model to map initial statements to their simplest + +and most explicit corresponding offensive statement (and score the likelihood of it being entailed by the original statement), and then classify the resulting statement with a dedicated OTD model. In essence, this decomposes a difficult inference into a series of smaller inferences which may be tackled with higher accuracy by current models. We explore the possibility of using this approach with existing models, assuming the human-annotated chains as gold-proof paths. + +We treat the problem of scoring reasoning chains as a multi-hop textual entailment problem as in Figure 2. Using an existing state-of-the-art textual entailment model, we score the transition from each step $s_i$ to the next, $s_{i+1}$ . Such models take as input a pair of texts, (), and output scores for a set of labels indicating "entailment" ( $E_{p\rightarrow h}$ ), "netural" and "contradiction" ( $C_{p\rightarrow h}$ ). For instance, the premise reasoning step "You look like someone who could use more exercise." entails the hypothesis "You are fat". + +A naive approach to multi-hop reasoning is to treat each transition as an independent event and model the probability of a reasoning chain as a product of transition scores. In the context of reasoning chains, we define the probability of a chain $c$ as: + +$$ +E (c) = \prod_ {i = 0} ^ {L - 1} E _ {s _ {i} \rightarrow s _ {i + 1}} \tag {1} +$$ + +where $L$ is the length of the chain. + +We refer to this as $MUL$ , the product model approach to multi-hop reasoning. For the entailment model scoring each transition in the chain, we consider two systems, one derived from DeBERTa + +
StepEntailment Scores
RoBERTaDeBERTa
Chain LengthALLChain LengthALL
34563456
s0→s164.784.489.990.0-68.478.286.590.7-
s1→s237.158.046.957.4-29.746.141.245.0-
s2→s373.655.142.550.2-64.450.535.544.3-
s3→s458.261.640.6-51.055.637.5-
s4→s560.965.9-50.063.3-
s5→s667.5-57.8-
MULs0,...,sL14.313.14.65.411.512.17.71.83.36.8
Es0→sL17.29.14.45.67.68.35.92.43.64.5
MULs0,...,sL(k+)38.132.017.916.523.530.220.37.64.014.1
Es0→sL(k+)35.915.910.88.615.025.311.97.56.610.9
+ +Table 3: Entailment scores between various steps of the reasoning chain, and the scores of a product model processing each step sequentially (MUL). Column headers indicate subsets of the data, where all chains are of 3, 4, 5, or 6 steps respectively. $k+$ : scores indicate those where external knowledge is concatenated to all statements prior to a KIR step. + +base (He et al., 2021) and one from RoBERTa-large (Liu et al., 2019). Both systems were finetuned on the MNLI corpus (Nangia et al., 2017), a standard corpus for textual entailment. + +In our experiments, we are most interested in comparing the scores of $MUL$ to those of methods which ignore the reasoning chain, either by scoring the entailment of the explicitly offensive statement given the implicit one ( $s_0 \to s_L$ ), or by using one of the current state-of-the-art approaches to classify the implicit statement directly (Table 2). While $MUL$ is a naive model, any advantage of a model with such strong independence assumptions suggests areas where future multi-hop reasoning models could significantly improve over non-reasoning "single hop" counterparts. + +The results of the multi-hop experiments are presented in Table 3. We observe that under most conditions, $MUL$ outperforms $E_{s_0 \to s_L}$ by a modest margin. The performance of $MUL$ does suffer on the longest reasoning chains as a result of an increasing number of multiplications (a consequence of the independence assumptions), negating the margins between the two systems. The detailed results can be found in Appendix F. + +In terms of the types of reasoning which are most beneficial, we observe significant changes in the transition scores before and after knowledge is integrated into the reasoning process, i.e., around KIR + +steps. We examine this behavior further, analyzing the performance of OTD models on predicting the final layer at points $s_{k-1}$ and $s_k$ , before and after knowledge integration (Table 4). We observe significant (2-3 fold) improvements when predicting after knowledge is integrated. Similar results can also be observed on textual inference models, as shown in Appendix E. + +To explore the effectiveness of the external knowledge, we utilize the extracted knowledge mentioned in Section 3.2 and perform an additional set of experiments (denoted $\mathbf{k}+$ ) where the external knowledge acquired in data annotation is added to each statement as conjunction until after a KIR step occurs. For instance, if the knowledge in $s_k$ is "Eating too much can make people fat," this knowledge will then be connected to all steps in $\{s_i | i = 0,1,\dots,k-1\}$ to form " $$ and eating too much can make people fat." As shown in Table 3, adding knowledge increases scores for both models, but notably resulting in a significant advantage to the RoBERTa product model, which now outperforms direct prediction, and all previous baseline models, in all scenarios. The resulting system is also more robust to long reasoning chains. We even observe that the performance margins over direct prediction in the 6-step chains exceed that of the 3-step setting. + +# 5 Discussion + +We introduced this work based on a hypothesis that a reasoning-based approach has a conceptual advantage over existing approaches to offensive text detection, in that humans must each be performing some reasoning process in order to find statements either offensive or non-offensive in different situations. We then showed that this conceptual advantage could translate to an empirical one and showed performance gains over current approaches. However, we do so under strong assumptions and access to additional information. How realistic is our experimental setup? + +# 5.1 Textual Inference Models for Reasoning + +As shown in Table 3, the overall entailment scores of direct prediction, $E_{s_0 \to s_L}$ , are significantly lower than the scores of adjacent steps prediction, $E_{s_i \to s_{i+1}}$ , revealing that existing entailment models can have difficulty integrating multiple inferences and strands of knowledge into a single prediction. Such models are able to perform better when the task is broken down into many simple inferences. However, why does MUL fail to show a consistent performance improvement over $E_{s_0 \to s_L}$ in all settings? We consider improving the model by relaxing its strict independence assumptions to the probability of successive multiplication of independent events tending to zero. Proof systems (Angeli and Manning, 2014), which utilize entailment and provide transparency in the decision-making process, may offer a better solution. Natural logic (MacCartney and Manning, 2007; Angeli and Manning, 2014) appeals for its formulation of reasoning as a sequence of sentence rewrites. Recent seq2seq neural-based natural logic model, ProoFVer (Krishna et al., 2021), is able to achieve state-of-the-art performance in the explanation generation task for fact verification systems. + +# 5.2 What Knowledge is Necessary? + +Another important topic is the type and extent to which knowledge is necessary for the reasoning task on the SLIGHT dataset. We evaluate the effectiveness of knowledge by comparing the classification performance of the model on the steps before and after applying KIR. The accuracy of the model improves significantly after integrating knowledge (Table 4), highlighting the importance of this process. But what type of knowledge is required? We examined examples of knowledge collected in the + +
ModelsAccuracy
sk-1sk
RoBERTa-Tawitter7.929.6
BERT-OffensEval13.642.5
ALBERT-OffensEval24.151.1
BERT-Toxicity9.335.8
ALBERT-Toxicity15.539.1
+ +Table 4: Performance of SOTA OTD models on steps before KIR $(s_{k - 1})$ and steps after KIR $(s_k)$ + +annotation process and categorized them as: (1) lexical/ontological knowledge, (2) commonsense, and (3) folk knowledge. + +Lexical knowledge involves the substitution of related concepts, synonyms, or subclasses. For instance, "classic things are old." describes the fundamental property of what it means to be a classic thing. Such knowledge may be obtained from dictionaries or inferred from large pre-trained language models. + +The second form of knowledge, commonsense knowledge, is exemplified in statements like, "salad is healthy". Existing knowledge bases, such as ConceptNet (Speer et al., 2017), may be sufficient for these basic object properties. Existing work on defeasible reasoning (Sap et al., 2019; Zhang et al., 2020) has shown how incorporating external knowledge to support entailment-based reasoning can improve performance, using models similar to those used in this work. Further efforts to develop knowledge bases of commonsense are ongoing, and it is possible that improvements in this area could similarly yield improvements when integrated with the approach proposed in this work, and could be used for the automatic integration of knowledge without requiring human annotation. + +A third and unusual type of knowledge is "folk knowledge," which may be a personal opinion and factually inaccurate. Examples of this in the dataset can be "smart people don't make mistakes." While a current trend in NLP research is improving ways of removing biases (Bender et al., 2021; Fisher et al., 2020), folk knowledge is interesting in that we may want to be aware of these biases and misconceptions in order to better model the interpretation process for a particular person. We find the collection and use of folk knowledge as an important avenue of future research. + +# 6 Conclusion + +In this work, we aim to broaden the scope of offensive text detection research to include the nuanced utterances. Improvements in these models have applications ranging from distant futures where humans frequently interact with dialogue systems in situated ways which require such pragmatic reasoning to avoid unintended offense to today's online forums, where often a cat-and-mouse game of increasingly more creative offensive text creation and moderation occurs. + +In addition to providing a dataset of implicitly offensive text, which can itself be used purely as a diagnostic of systems' ability to identify more subtle instances of offensive text, we also provide chains of reasoning annotations which we hope can provide insight to how statements lead to offensive interpretations in certain situations. Our experiments provide a proof of concept of how multi-hop reasoning models have the potential to outperform directly classifying offensive text using current state-of-the-art approaches and identify areas for improvement via future research in commonsense knowledge base construction and inference. + +# 7 Ethical Considerations + +In this work, we aim to develop models which can more accurately predict the emotions elicited from text statements. Although our goal is to identify potentially harmful statements in order to avoid them, it is important to consider potential negative use-cases for such work. A system which can identify offensive statements can also select for them, and it may be possible to use such a system to target users, attacking them on topics or attributes which they are most sensitive about. To the extent that we are able, we must be cautious not to aid in the development of such systems in the process of furthering research for more empathetic dialogue systems. + +We tailor our study in three ways in an effort to reduce the risk of harm. First, we focus primarily on identifying implicitly offensive statements. While a system which produces implicitly offensive statements may still be used to attack users, they are significantly more challenging to generate when compared to explicitly offensive statements, which do not require any additional inferences or world knowledge. We hypothesize that this makes implicitly offensive statements unlikely to be uti + +lized in offensive systems. Second, our dataset size is chosen with the goal of being large enough to support evaluation but not training. It can therefore function as a useful diagnostic of offensive text detection systems, with limited risk of being used to create one. + +Third, in our dataset, we have removed protected attributes such as ethnicity, gender, and race. + +# Acknowledgments + +We thank the anonymous reviewers for their helpful suggestions and feedback. We also thank Couger Inc. for additional computational resources. This work was supported by JSPS KAKENHI Grant Number JP19H05692. + +# References + +Gabor Angeli and Christopher D. Manning. 2014. NaturalLI: Natural logic inference for common sense reasoning. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 534-545, Doha, Qatar. Association for Computational Linguistics. +Francesco Barbieri, Jose Camacho-Collados, Luis Espinosa Anke, and Leonardo Neves. 2020. TweetEval: Unified benchmark and comparative evaluation for tweet classification. In *Findings of the Association for Computational Linguistics: EMNLP* 2020, pages 1644–1650, Online. Association for Computational Linguistics. +Emily M. Bender, Timnit Gebru, Angelina McMillan-Major, and Shmargaret Shmitchell. 2021. On the dangers of stochastic parrots: Can language models be too big? In Proceedings of the 2021 ACM Conference on Fairness, Accountability, and Transparency, FAccT '21, page 610-623, New York, NY, USA. Association for Computing Machinery. +Tommaso Caselli, Valerio Basile, Jelena Mitrovic, Inga Kartoziya, and Michael Granitzer. 2020. I feel offended, don't be abusive! implicit/explicit messages in offensive and abusive language. In Proceedings of the 12th Language Resources and Evaluation Conference, pages 6193-6202, Marseille, France. European Language Resources Association. +Camilla Casula, Alessio Palmero Aprosio, Stefano Menini, and Sara Tonelli. 2020. FBK-DH at SemEval-2020 task 12: Using multi-channel BERT for multilingual offensive language detection. In Proceedings of the Fourteenth Workshop on Semantic Evaluation, pages 1539–1545, Barcelona (online). International Committee for Computational Linguistics. +Amanda Cercas Curry and Verena Rieser. 2018. #MeToo Alexa: How conversational systems respond + +to sexual harassment. In Proceedings of the Second ACL Workshop on Ethics in Natural Language Processing, pages 7-14, New Orleans, Louisiana, USA. Association for Computational Linguistics. +David Dale, Anton Voronov, Daryna Dementieva, Varvara Logacheva, Olga Kozlova, Nikita Semenov, and Alexander Panchenko. 2021. Text detoxification using large pre-trained neural models. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 7979-7996, Online and Punta Cana, Dominican Republic. Association for Computational Linguistics. +Thomas Davidson, Dana Warmsley, Michael Macy, and Ingmar Weber. 2017. Automated hate speech detection and the problem of offensive language. In Proceedings of the International AAAI Conference on Web and Social Media, volume 11, pages 512-515. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171-4186, Minneapolis, Minnesota. Association for Computational Linguistics. +Emily Dinan, Angela Fan, Adina Williams, Jack Urbanek, Douwe Kiela, and Jason Weston. 2020. Queens are powerful too: Mitigating gender bias in dialogue generation. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 8173-8188, Online. Association for Computational Linguistics. +Marc Djandji, Fady Baly, Wissam Antoun, and Hazem Hajj. 2020. Multi-task learning using AraBert for offensive language detection. In Proceedings of the 4th Workshop on Open-Source Arabic Corpora and Processing Tools, with a Shared Task on Offensive Language Detection, pages 97-101, Marseille, France. European Language Resource Association. +Denis Emelin, Ronan Le Bras, Jena D. Hwang, Maxwell Forbes, and Yejin Choi. 2021. Moral stories: Situated reasoning about norms, intents, actions, and their consequences. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 698-718, Online and Punta Cana, Dominican Republic. Association for Computational Linguistics. +Joseph Fisher, Arpit Mittal, Dave Palfrey, and Christos Christodoulopoulos. 2020. Debiasing knowledge graph embeddings. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 7332-7345, Online. Association for Computational Linguistics. +Lei Gao and Ruihong Huang. 2017. Detecting online hate speech using context aware models. In + +Proceedings of the International Conference Recent Advances in Natural Language Processing, RANLP 2017, pages 260-266, Varna, Bulgaria. INCOMA Ltd. +Jennifer Golbeck, Zahra Ashktorab, Rashad O. Banjo, Alexandra Berlinger, Siddharth Bhagwan, Cody Buntain, Paul Cheakalos, Alicia A. Geller, Quint Gergory, Rajesh Kumar Gnanasekaran, Raja Rajan Gunasekaran, Kelly M. Hoffman, Jenny Hottle, Vichita Jienjitlert, Shivika Khare, Ryan Lau, Marianna J. Martindale, Shalmali Naik, Heather L. Nixon, Piyush Ramachandran, Kristine M. Rogers, Lisa Rogers, Meghna Sardana Sarin, Gaurav Shahane, Jayanine Thanki, Priyanka Vengataraman, Zijian Wan, and Derek Michael Wu. 2017. A large labeled corpus for online harassment research. In Proceedings of the 2017 ACM on Web Science Conference, WebSci '17, page 229-233, New York, NY, USA. Association for Computing Machinery. +Kotaro Hara, Abigail Adams, Kristy Milland, Saiph Savage, Chris Callison-Burch, and Jeffrey P Bigham. 2018. A data-driven analysis of workers' earnings on amazon mechanical turk. In Proceedings of the 2018 CHI conference on human factors in computing systems, pages 1-14. +Pengcheng He, Xiaodong Liu, Jianfeng Gao, and Weizhu Chen. 2021. Deberta: Decoding-enhanced bert with disentangled attention. +Chaya Hiruncharoenvate, Zhiyuan Lin, and Eric Gilbert. 2015. Algorithmically bypassing censorship on sina weibo with nondeterministic homophone substitutions. In Proceedings of the International AAAI Conference on Web and Social Media, volume 9, pages 150-158. +Heng Ji and Kevin Knight. 2018. Creative language encoding under censorship. In Proceedings of the First Workshop on Natural Language Processing for Internet Freedom, pages 23-33, Santa Fe, New Mexico, USA. Association for Computational Linguistics. +Douwe Kiela, Hamed Firooz, Aravind Mohan, Vedanuj Goswami, Amanpreet Singh, Pratik Ringshia, and Davide Testuggine. 2021. The hateful memes challenge: Detecting hate speech in multimodal memes. +Ben Krause, Akhilesh Deepak Gotmare, Bryan McCann, Nitish Shirish Keskar, Shafiq Joty, Richard Socher, and Nazneen Fatema Rajani. 2021. GeDi: Generative discriminator guided sequence generation. In Findings of the Association for Computational Linguistics: EMNLP 2021, pages 4929-4952, Punta Cana, Dominican Republic. Association for Computational Linguistics. +Amrith Krishna, Sebastian Riedel, and Andreas Vlachos. 2021. Proofver: Natural logic theorem proving for fact verification. +Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, and Radu Soricut. + +2020. Albert: A lite bert for self-supervised learning of language representations. +Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019. Roberta: A robustly optimized BERT pretraining approach. CoRR, abs/1907.11692. +Bill MacCartney and Christopher D. Manning. 2007. Natural logic for textual inference. In Proceedings of the ACL-PASCAL Workshop on Textual Entailment and Paraphrasing, pages 193-200, Prague. Association for Computational Linguistics. +Bill MacCartney and Christopher D. Manning. 2014. Natural Logic and Natural Language Inference, pages 129-147. Springer Netherlands, Dordrecht. +Nikita Nangia, Adina Williams, Angeliki Lazaridou, and Samuel Bowman. 2017. The RepEval 2017 shared task: Multi-genre natural language inference with sentence representations. In Proceedings of the 2nd Workshop on Evaluating Vector Space Representations for NLP, pages 1-10, Copenhagen, Denmark. Association for Computational Linguistics. +Georgios K. Pitsilis, Heri Ramampiaro, and Helge Langseth. 2018. Effective hate-speech detection in twitter data using recurrent neural networks. Applied Intelligence, 48(12):4730-4742. +Isabella Poggi and Francesca D'Errico. 2018. Feeling offended: a blow to our image and our social relationships. Frontiers in Psychology, 8:2221. +Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. 2020. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research, 21(140):1-67. +Björn Ross, Michael Rist, Guillermo Carbonell, Ben Cabrera, Nils Kurowsky, and Michael Wojatzki. 2016. Measuring the Reliability of Hate Speech Annotations: The Case of the European Refugee Crisis. In Proceedings of NLP4CMC III: 3rd Workshop on Natural Language Processing for Computer-Mediated Communication, pages 6-9. +Maarten Sap, Ronan LeBras, Emily Allaway, Chandra Bhagavatula, Nicholas Lourie, Hannah Rashkin, Brendan Roof, Noah A. Smith, and Yejin Choi. 2019. Atomic: An atlas of machine commonsense for if then reasoning. +Robyn Speer, Joshua Chin, and Catherine Havasi. 2017. Conceptnet 5.5: An open multilingual graph of general knowledge. In Proceedings of the Thirty-First AAAI Conference on Artificial Intelligence, AAAI'17, page 4444-4451. AAAI Press. +Zeerak Waseem. 2016. Are you a racist or am I seeing things? annotator influence on hate speech detection on Twitter. In Proceedings of the First Workshop on + +NLP and Computational Social Science, pages 138-142, Austin, Texas. Association for Computational Linguistics. +Zeerak Waseem, Thomas Davidson, Dana Warmsley, and Ingmar Weber. 2017. Understanding abuse: A typology of abusive language detection subtasks. In Proceedings of the First Workshop on Abusive Language Online, pages 78-84, Vancouver, BC, Canada. Association for Computational Linguistics. +Zeerak Waseem and Dirk Hovy. 2016. Hateful symbols or hateful people? predictive features for hate speech detection on Twitter. In Proceedings of the NAACL Student Research Workshop, pages 88-93, San Diego, California. Association for Computational Linguistics. +Konthala Yasaswini, Karthik Puranik, Adeep Hande, Ruba Priyadharshini, Sajeetha Thavareesan, and Bharathi Raja Chakravarthi. 2021. IIITT@DravidianLangTech-EACL2021: Transfer learning for offensive language detection in Dravidian languages. In Proceedings of the First Workshop on Speech and Language Technologies for Dravidian Languages, pages 187-194, Kyiv. Association for Computational Linguistics. +Marcos Zampieri, Shervin Malmasi, Preslav Nakov, Sara Rosenthal, Noura Farra, and Ritesh Kumar. 2019a. Predicting the type and target of offensive posts in social media. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 1415-1420, Minneapolis, Minnesota. Association for Computational Linguistics. +Marcos Zampieri, Shervin Malmasi, Preslav Nakov, Sara Rosenthal, Noura Farra, and Ritesh Kumar. 2019b. SemEval-2019 task 6: Identifying and categorizing offensive language in social media (OffensEval). In Proceedings of the 13th International Workshop on Semantic Evaluation, pages 75-86, Minneapolis, Minnesota, USA. Association for Computational Linguistics. +Marcos Zampieri, Preslav Nakov, Sara Rosenthal, Pepa Atanasova, Georgi Karadzhov, Hamdy Mubarak, Leon Derczynski, Zeses Pitenis, and Căgni Öltekin. 2020. SemEval-2020 task 12: Multilingual offensive language identification in social media (OffensEval 2020). In Proceedings of the Fourteenth Workshop on Semantic Evaluation, pages 1425–1447, Barcelona (online). International Committee for Computational Linguistics. +Hongming Zhang, Daniel Khashabi, Yangqiu Song, and Dan Roth. 2020. Transomics: From linguistic graphs to commonsense knowledge. +Saizheng Zhang, Emily Dinan, Jack Urbanek, Arthur Szlam, Douwe Kiela, and Jason Weston. 2018a. Personalizing dialogue agents: I have a dog, do you have pets too? In Proceedings of the 56th Annual + +Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 2204-2213, Melbourne, Australia. Association for Computational Linguistics. +Ziqi Zhang, David Robinson, and Jonathan Tepper. 2018b. Detecting hate speech on twitter using a convolution-gru based deep neural network. In *The Semantic Web*, pages 745–760, Cham. Springer International Publishing. +Liu Zhuang, Lin Wayne, Shi Ya, and Zhao Jun. 2021. A robustly optimized BERT pre-training approach with post-training. In Proceedings of the 20th Chinese National Conference on Computational Linguistics, pages 1218-1227, Huhhot, China. Chinese Information Processing Society of China. + +
AttributeI eat lots of pancakes and syrup.
Implicit StatementThat can indeed give you extra energy.
Explicit StatementYou are fat.
Non-offensiveI love pancakes, too.
Chain of ReasoningPancakes and syrup can indeed give you extra energy. (AIR)
You got extra energy from eating. (RR)
You eat too much. (RR)
You eat too much which makes you fat. (KIR)
You are fat. (RR)
AttributeI am a guitar player.
Implicit StatementOh did you learn that by yourself?
Explicit StatementYour guitar skills are awful.
Non-offensiveThat's why you are so good at music.
Chain of ReasoningDid you learn guitar by yourself? (AIR)
You must have learned guitar by yourself. (RR)
You must have learned guitar by yourself because you don't look so professional. (KIR)
You are not professional at guitar. (RR)
Your guitar skills are awful. (RR)
AttributeI wear contacts.
Implicit StatementAnother reason why I'm scared to get old.
Explicit StatementYou are so old.
Non-offensiveI usually wear glasses.
Chain of ReasoningWearing contacts is another reason why I'm scared to get old. (AIR)
I'm scared to get old because I don't want to wear contacts like you. (RR)
I'm scared to get old because old people wear contacts like you. (KIR)
Old people like you wear contacts like you. (RR)
You are so old. (RR)
AttributeI come from a small town.
Implicit StatementAre you coming here for higher education?
Explicit StatementYou are uneducated, then.
Non-offensiveI always want to move to a small town.
Chain of ReasoningAre you coming to this big city for higher education? (AIR)
You come to this big city for higher education. (RR)
You come to this big city because you couldn't get enough education in the small town. (KIR)
You couldn't get enough education in the small town. (RR)
You don't get enough education. (RR)
You are uneducated. (RR)
+ +Table 5: Some chain of reasoning samples. + +# A Samples + +Table 5 shows some examples in SLIGHT. Each sample contains an Attribute, an Implicit Statement, an Explicit Statement, a Non-offensive Statement and a Chain of Reasoning mapping from implicit statement to explicit statement. The post-processing tag is attached to the end of each reasoning step, where AIR is for "Attribute Insertion Rule", KIR is for "Knowledge Insertion Rule" and RR is for "Rephrasing Rule". + +Table 6 shows some examples of extracted knowledge from KIR steps of the chain of reasoning during post-processing. $s_{k-1}$ indicates the reasoning steps before applying KIR and $s_k$ indicates the reasoning steps after applying KIR. + +# B Attribute Categories + +Table 7 shows how we categorized and selected different attributes. The original attributes are divided into four big categories: AM, HAVE, MY and + +OTHER based on the syntax features (subject type, POS, Norm) of the sentence. Each category of AM, HAVE and MY are then divided into several subcategories based on the object type of the sentence. 230 attributes are taken from each big categories. + +# C Crowdsourcing Instruction + +Figure 3 shows a template instruction that we used in our AMT tasks. Crowd workers are instructed with the purpose of the research and are notified about the potential offensive contents of this task. In order to protect the crowd workers due to the nature of this research, we have explicitly mentioned on the AMT task control panel that the current task may contain offensive contents. Moreover, we check the collected attributes and remove potential dangerous ones before posting the tasks. This task requires more effort due to a great amount of content generation. To compensate the crowd workers, we guarantee every qualified worker to get a base + +
sk-1You eat too much.
skYou eat too much which makes you fat.
KnowledgeEating too much can make people fat.
sk-1I've never seen you on TV as a comedian.
skI've never seen you on TV as a comedian because you're not famous.
KnowledgeFamous comedians are always on TV.
sk-1You should lose weight.
skYou should lose weight because you are fat.
KnowledgeFat people should lose weight.
sk-1You quit school.
skYou quit school which makes you uneducated.
KnowledgePeople who quit school are uneducated.
+ +Table 6: Some external knowledge samples. + +
CategorySub-CategoryExampleNumber
AM(Attributes that describe personal status with a be-verb as the root.)1429 (230)
AM-nounI am a teacher.754 (50)
AM-numberI am 30 years old.76 (15)
AM-statusI'm getting married next week.149 (25)
I am funny.
AM-otherI'm from San Francisco.450 (140)
HAVE(Attributes that describe certain personal actions with a verb as the root.)3203 (230)
HAVE-preferenceI like to remodel homes.901 (65)
I hate talking to people.
Have-statusI have a dog named bob.540 (40)
Have-otherI own my home.1762 (125)
I live in Colorado.
MY(Attributes that describe possession status related to the speaker.)731 (230)
MY-preferenceMy favorite sport is football.256(80)
My favorite movie is pretty woman.
My favorite food is cheeseburgers.
My-otherMy mom is a checker at the local grocery store.475(150)
My wife and i like to go scuba diving.
OTHER(Other remaining attributes that do not have specific syntax features.)763(230)
Before i die , i want to skydive.
While both my parents have thick European accents, I do not.
It is my universe, and everyone else is just a character in it.
Total5334 (920)
+ +Table 7: Different categories of personal attributes and the number of selected attributes (numbers in parentheses). + +salary of $6.2 per hour (average salary is$ 3 in the authors' region, average AMT worldwide salary is $2) with additional bonuses. + +# D Sentence Classification Results + +Figure 4 shows the results of existing SOTA OTD models on each step of the chain of reasoning in SLIGHT. + +# Collecting utterances which might offend people with given attributes. + +In everyday conversation, we sometimes say things that are hurtful to our conversation partner. Sometimes we are aware that a statement might be hurtful (intentional), and sometimes we accidentally say things that are insulting (unintentional). + +# Goal of this research: + +We want to understand how some statements can be implicitly offensive. To do this, we want to know your line of reasoning (or chain of reasoning) behind why you think the statements you give can be offensive to the listener. We ask that you formulate your thinking process in terms of multiple reasoning steps. + +# Your task, from implicit to explicit: + +In the HIT, you will be given an "attribute" of a hypothetical listener (person). Firstly, you are asked to provide a statement which this person might find insulting, but is not directly insulting and would not be insulting to other people in a different context. We refer to this as the implicit offensive statement. Now explain why it is insulting. Behind each implicit offensive statement, it is often possible to create a corresponding direct (explicit) offensive statement. Secondly, your need to provide the explicit offensive statement, and any reasoning steps needed to create it. + +For instance, for the attribute "I like horseback riding," an implicit offensive statement might be "Oh, they are so strong!". This could be offensive to a listener because it may be indirectly calling them overweight. And the explicit offensive statement can be "You are very fat." Therefore a chain of reasoning which converts the implicit offensive statement to an explicit offensive one may be: + +"Oh, they are so strong!" +$\rightarrow$ "Oh, horses must be very strong to lift you." +$\rightarrow$ "Oh, horses must be very strong to life you because you are very heavy." +"You are very heavy." +$\rightarrow$ "You are very fat." + +Finally, you need to give a non-offensive statement that contains no offensive meaning. An example non-offensive statement for the above attribute might be "You riding on a horse must be so cool!" or "I always want to do that once!". + +Check the examples. + +# Steps: + +1. Select one attribute that you think is easier for you. +2. Write your implicit offensive statement. +3. Write the corresponding explicit/directly offensive statement. +4. Write the non-offensive statement. 5. To the best of your ability, write the reasoning steps the listener might use when interpreting your implicitly offensive statement as the explicit one. Write each step in EACH LINE, with the last line to be your explicit insult. Just write your explicit insult if you think there is no additional reasoning steps. + +# Important: + +1. All utterances should be given in Fluent English. Your answers will NOT be accepted if they contain severe grammatical errors. +2. The quality will be judged by the consistency of the chain of reasoning. +3. You utterances will NOT be used under any scopes beyond this research. + +![](images/a2bef4fa3a0f6e7ebae612049d0c8475ea5d129689e5c52a06e184e58ce5195d.jpg) +- RoBERTa-Tawitter $\triangle$ BERT-OffensEval $\triangle$ ALBERT-OffensEval $\triangle$ BERT-Toxicity $\triangle$ ALBERT-Toxicity +Figure 4: Performance of the models on each step of the chains of reasoning with different lengths. + +![](images/324513e52e7648693cb70dfd9f1af7d50bb7efb51e30635254f2c344a08cc8b4.jpg) +Figure 3: Introduction in the crowdsourcing task. + +# E Model Details + +Table 8 shows the details of the models used in all of our experiments. We implemented the framework with the "TextClassification" pipeline from HuggingFace $^6$ . All models can be directly downloaded from the links given in the table. + +We selected models fine-tuned on MNLI for entailment models because MNLI provides a large size textual inference dataset that contains multiple genres and thus can greatly reduce biases of the models trained on. Both RoBERTa and DeBERTa models fine-tuned on MNLI have achieved state-of-the-art performance. + +
ExperimentModelSources
ClassificationRoBERTa-TawitterBase model: RoBERTa-base +#Parameters: 125M +Trained on: TWEETEVAL (2020) +Source: https://huggingface.co/cardiffnlp/twitter-roberta-base-offensive
BERT-OffensEvalBase model: BERT-base-uncased +#Parameters: 110M +Trained on: OLID/OffensEval2019 (2019) +Source: https://huggingface.co/mohsenfayyaz/bert-base-uncased-offenseval2019-downsample
ALBERT-OffensEvalBase model: ALBERT-base-v2 +#Parameters: 12M +Trained on: OLID/OffensEval2019 (2019) +Source: https://huggingface.co/mohsenfayyaz/albert-base-v2-offenseval2019-downsample
BERT-toxicityBase model: BERT-base-uncased +#Parameters: 110M +Trained on: Toxic Comment (2018) +Source: https://huggingface.co/mohsenfayyaz/toxicity-classifier
ALBERT-toxicityBase model: ALBERT-base-v2 +#Parameters: 12M +Trained on: Toxic Comment (2018) +Source: https://huggingface.co/mohsenfayyaz/albert-base-v2-toxicity
EntailmentRoBERTaBase model: RoBERTa-large +#Parameters: 355M +Trained on: MNLI (2017) +Source: https://huggingface.co/roberta-large-mnli +Reported Acc. on MNLI: 90.2
DeBERTaBase model: DeBERTa-large +#Parameters: 355M +Trained on: MNLI (2017) +Source: https://huggingface.co/microsoft/deberta-large-mnli +Reported Acc. on MNLI: 91.1
+ +Table 8: Details of the models used in the experiments. + +
LengthModelsEntailment Scores
sk-1→sksk→sk+1
4-stepsRoBERTa28.266.4
DeBERTa19.858.3
5-stepsRoBERTa23.078.2
DeBERTa15.766.5
6-stepsRoBERTa19.179.5
DeBERTa17.571.5
+ +Table 9: Entailment scores between the KIR step $(s_k)$ and step before KIR $(s_{k - 1})$ and step after KIR $(s_{k + 1})$ . The chains with length of three are not included in this evaluation as they do not frequently contain a KIR step. + +
OTD ModelsAccuracy
ImplicitMUL*ExplicitMUL(k+)*Explicit
RoBERTaDeBERTaRoBERTaDeBERTa
RoBERTa-Twitter1.79.15.418.611.1
BERT-OffensEval15.910.76.321.913.1
ALBERT-OffensEval9.710.26.020.812.5
BERT-Toxicity14.811.16.622.713.6
ALBERT-Toxicity11.410.56.221.512.9
+ +Table 10: Full accuracy calculated from reasoning models and the accuracy of OTD models on Explicit. + +# F Knowledge Entailment Experiment + +Table 9 shows the results of running text inference models around KIR steps of the chain of reasoning. To be noticed, we were not able to find any KIR steps in the chain of reasoning whose length is 3. This implies that knowledge insertion might not be necessary to interpret implicit statements that are not "implicit" enough. + +Table 10 shows the final accuracy calculated with the entailment scores and accuracy of OTD models on Explicit inputs. Average accuracy of models the sentence classification experiment is used for the calculation. \ No newline at end of file diff --git a/rethinkingoffensivetextdetectionasamultihopreasoningproblem/images.zip b/rethinkingoffensivetextdetectionasamultihopreasoningproblem/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..9a938392a3c317c8ba2da745e369b4831cef8931 --- /dev/null +++ b/rethinkingoffensivetextdetectionasamultihopreasoningproblem/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a2e463ff94c596987f5cb70adc9d3ff2af8b35540077dc8c64ff66c025258e8e +size 907992 diff --git a/rethinkingoffensivetextdetectionasamultihopreasoningproblem/layout.json b/rethinkingoffensivetextdetectionasamultihopreasoningproblem/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..f538f74962e9bb60323d70b93621a9f2841bb43c --- /dev/null +++ b/rethinkingoffensivetextdetectionasamultihopreasoningproblem/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f73725c4d54f001e9dde734c51871a43b47ef3c86a5bf28711c5485003bbd0d7 +size 431978 diff --git a/revisitingautomaticevaluationofextractivesummarizationtaskcanwedobetterthanrouge/edb47418-80f1-496c-8cd3-5f6dc1b9ea52_content_list.json b/revisitingautomaticevaluationofextractivesummarizationtaskcanwedobetterthanrouge/edb47418-80f1-496c-8cd3-5f6dc1b9ea52_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..fa08e30697b3b610a85567f97933adc7943aa695 --- /dev/null +++ b/revisitingautomaticevaluationofextractivesummarizationtaskcanwedobetterthanrouge/edb47418-80f1-496c-8cd3-5f6dc1b9ea52_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1044238c04c5cb7f5b58c846d44ae88b4f6c35efc0bfcc91b4e1fd483a7a3b9d +size 104610 diff --git a/revisitingautomaticevaluationofextractivesummarizationtaskcanwedobetterthanrouge/edb47418-80f1-496c-8cd3-5f6dc1b9ea52_model.json b/revisitingautomaticevaluationofextractivesummarizationtaskcanwedobetterthanrouge/edb47418-80f1-496c-8cd3-5f6dc1b9ea52_model.json new file mode 100644 index 0000000000000000000000000000000000000000..7556db7b45d929917ee73c611a423924aaa3c83c --- /dev/null +++ b/revisitingautomaticevaluationofextractivesummarizationtaskcanwedobetterthanrouge/edb47418-80f1-496c-8cd3-5f6dc1b9ea52_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6ccc0e179d33c3cbbffba6ea3f79f402d8d0bca56cc06ad00beb21e56c085ed5 +size 127463 diff --git a/revisitingautomaticevaluationofextractivesummarizationtaskcanwedobetterthanrouge/edb47418-80f1-496c-8cd3-5f6dc1b9ea52_origin.pdf b/revisitingautomaticevaluationofextractivesummarizationtaskcanwedobetterthanrouge/edb47418-80f1-496c-8cd3-5f6dc1b9ea52_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..dd6b5c91944b82bb0313f0587eac5e206c4773b0 --- /dev/null +++ b/revisitingautomaticevaluationofextractivesummarizationtaskcanwedobetterthanrouge/edb47418-80f1-496c-8cd3-5f6dc1b9ea52_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:83a8580707c5738bb5d4deb29ee1245fbe98a6d0a7bdbdadeb97f8640f4597e4 +size 407919 diff --git a/revisitingautomaticevaluationofextractivesummarizationtaskcanwedobetterthanrouge/full.md b/revisitingautomaticevaluationofextractivesummarizationtaskcanwedobetterthanrouge/full.md new file mode 100644 index 0000000000000000000000000000000000000000..62e7d51287bc4d9d8d4ee3b8181f789365b0e8cd --- /dev/null +++ b/revisitingautomaticevaluationofextractivesummarizationtaskcanwedobetterthanrouge/full.md @@ -0,0 +1,343 @@ +# Revisiting Automatic Evaluation of Extractive Summarization Task: Can We Do Better than ROUGE? + +Mousumi Akter, Naman Bansal, Shubhra Kanti Karmaker Santu + +BDI Lab, Auburn University, Alabama, USA + +{mza0170, nzb0040, sks0086} @auburn.edu + +# Abstract + +It has been the norm for a long time to evaluate automated summarization tasks using the popular ROUGE metric. Although several studies in the past have highlighted the limitations of ROUGE, researchers have struggled to reach a consensus on a better alternative until today. One major limitation of the traditional ROUGE metric is the lack of semantic understanding (relies on direct overlap of n-grams). In this paper, we exclusively focus on the extractive summarization task and propose a semantic-aware $nCG$ (normalized cumulative gain)-based evaluation metric (called Sem-nCG) for evaluating this task. One fundamental contribution of the paper is that it demonstrates how we can generate more reliable semantic-aware ground truths for evaluating extractive summarization tasks without any additional human intervention. To the best of our knowledge, this work is the first of its kind. We have conducted extensive experiments with this new metric using the widely used CNN/DailyMail dataset. Experimental results show that the new Sem-nCG metric is indeed semantic-aware, shows higher correlation with human judgement (more reliable) and yields a large number of disagreements with the original ROUGE metric (suggesting that ROUGE often leads to inaccurate conclusions also verified by humans). + +# 1 Introduction + +Text summarization is a difficult NLP task and an automatic evaluation of this task is even more challenging. However, automatic evaluation is vital for large-scale experiments as it acts as a replacement for time consuming and pricey human evaluation. As such, the reliability and robustness of automatic evaluation is very crucial. + +The most commonly used metric for evaluating text summarization is ROUGE (Lin, 2004). Although ROUGE has been criticized for considering + +direct lexical overlap and thus not being semantic-aware, the majority of summarization models' assessments today are still based on ROUGE scores. In this paper, we revisit the popular ROUGE metric exclusively in the context of evaluating extractive summarization task, a task where phrases and sentences from the original text are extracted to create a summary. As such, if the human-written summary includes more novel words than the original document, ROUGE will provide a poor score to extractive summaries due to a lack of semantic awareness. Another limitation of the ROUGE metric in the context of extractive summarization is the following: while the extractive summarization task is generally framed as a sentence ranking problem, the ROUGE metric was not originally proposed for evaluating the quality of a ranker. Indeed, the heavily used technique behind extractive summarization is to rank sentences from the original document according to how well they reflect the overall description and then create a summary by concatenating the top-ranked sentences. Thus, the "right" evaluation metric for the extractive summarization task should also consider the quality of the sentence ranker. Again think about a human-written summary which is highly abstractive in nature. A good ranker that ranks the most informative sentences at the top may still suffer from low ROUGE scores due to fewer direct lexical overlaps between the system summary and human-written summary. + +To address these limitations, we propose an alternative gain-based evaluation metric in this paper (called Sem-nCG) for evaluating extractive summarization tasks, which is both 1) semantic-aware and 2) rewards a system-generated summary based on some groundtruth ranking of sentences from original document. nCG (Normalized cumulative gain) is a widely used metric for evaluating the performance of ranking systems, especially when conducting multi-level relevance judgements (Järvelin and Kekäläinen, 2002). Although nCG evaluation + +is not entirely new (Karmaker Santu et al., 2017; Kuzi et al., 2019; Karmaker et al., 2020), one fundamental contribution of this paper is that it demonstrates how we can automatically generate a reliable semantic-aware groundtruth ranking of sentences within a source document, which essentially enables automatic Sem-nCG based evaluation without any additional human intervention. To the best of our knowledge, this work is the first of its kind. To be more specific, given an original document and a human-written summary for evaluation purposes, we used several state-of-the-art sentence embedding techniques (including InferSent, Sentence Transformer, Elmo, Google Universal Sentence Encoding and their ensemble) to prepare groundtruth ranking of sentences from original document by computing semantic similarity between each individual sentence of original document and entire human written summary. Finally, this groundtruth ranking is compared against model-inferred ranking to compute Sem-nCG score, where a higher number means a better extractive summary. + +We have conducted extensive experiments with this new metric using the CNN/DailyMail dataset and 6 state-of-the-art extractive summarization models (BERTbase, MobileBERT, DistilBERT, RoBERTa, XLNET, GPT-2). Experimental results show that the new Sem-nCG metric is: 1) semantic-aware, 2) shows higher correlation with human judgement (more reliable), and 3) yields a large number of disagreements with the original ROUGE metric (suggesting ROUGE often leads to inaccurate conclusions). When cross-examined by humans, we found Sem-nCG to be more accurate (62% of the time) than ROUGE on average where the two metrics disagreed on the relative performance of a pair of extractive summarization models. Thus, in response to the question of whether we can do better than ROUGE for evaluating extractive summarization tasks, the answer appears to be "YES". + +# 2 Related Work + +Evaluation of the text summarization task is challenging and has been studied vastly in the past. (Radev and Tam, 2003) proposed the Relative Utility (RU) metric, which evaluates extractive summarization as a ranking task (similar to our formulation), but has not gained much popularity, because their approach requires manual labor to rank each sentence of a document, and it is not practical to + +manually annotate such large data-sets. + +ROUGE (Lin, 2004) is perhaps the most popular metric used today for the evaluation of the automated summarization techniques, mainly because it is a simple and automatic process. However, ROUGE has been criticized a lot for primarily relying on lexical overlap (Nenkova, 2006) of n-grams. Later, (Zhou et al., 2006) suggested using a broad domain-independent paraphrase table derived from a bilingual parallel corpus to enable paraphrase matching for summary evaluation. (Cohan and Goharian, 2016) showed that ROUGE suffers from poor performance in cases of terminology variation and paraphrasing. As of today, around 192 variants of ROUGE have been proposed (Graham, 2015) including ROUGE with word embedding (Ng and Abrecht, 2015) and synonym (Ganesan, 2018), graph-based lexical measurement (ShafieiBavani et al., 2018), Vanilla ROUGE (Yang et al., 2018) and highlight-based ROUGE (Hardy et al., 2019). However, none of the variants of ROUGE considers the ranking quality (core technique of extractive summarization); let alone providing an automatic way to do it, which is the primary goal of our work. + +Researchers have also proposed metrics alternative to ROUGE: factoids-based (atomic information units for sentence meaning) (Teufel and van Halteren, 2004) and pyramid-based (Nenkova and Passonneau, 2004) approaches are two of them. Multiple different reference summaries are a must for both approaches, where the pyramid-based approach requires additional manual labor to construct the pyramid. Since the pyramid must be built by hand and gives imprecise scores, this technique failed to gain much attraction. Many enhancements have been made to the pyramid-based approach: precise automated system for calculating pyramid ratings (Passonneau et al., 2013), pyramid evaluation via automated information extraction (Yang et al., 2016), lightweight sampling-based version that is crowdsourcable (Shapira et al., 2019) and facet-aware evaluation (Mao et al., 2020) for better assessment of knowledge coverage in extractive summarization. Still, the pyramid-based approach necessitates significant additional manual labour making it less appealing for large-scale evaluation. + +Researchers also attempted to develop methods for evaluating reference-free model summaries (Louis and Nenkova, 2013; Xenouleas et al., 2019). Distance measures between the system summary and reference summary based on word + +embeddings have also been proposed (Zhao et al., 2019; Sun and Nenkova, 2019). Moreover, model based evaluation for text generation (also adopted for text summarization) has also been a recent trend (Sellam et al., 2020; Zhang et al., 2020; Yuan et al., 2021). Yet, none of these metrics explicitly assess the quality of ranking performed by an extractive summarization method. + +# 3 Background + +$nCG$ (Normalized Cumulative Gain) is a popular measure for evaluating information retrieval (IR) systems (Järvelin and Kekäläinen, 2002). Given a query and a ranked list of search results, computation of $nCG$ involves summing the gains of the top $k$ documents, and normalizing by the maximum possible gain that can be obtained for the query. Mathematically: + +$$ +C G @ k = \left\{ \begin{array}{l l} G @ 1, & \text {i f} k = 1 \\ C G @ [ k - 1 ] + G @ k, & \text {o t h e r w i s e} \end{array} \right. \tag {1} +$$ + +Here, $k$ is the cutoff position (e.g., $k = 5$ is a common choice), $G@k$ and $CG@k$ are the gain and cumulative gain, respectively, at the $k$ -th position in the list. $nCG@k$ is $CG@k$ divided by the maximum achievable $CG@k$ , also called Ideal CG $(ICG@k)$ , which is computed from the ideal ranking of the documents with respect to the query. The ideal ranking places the document(s) with the highest gain on the very top, followed by the documents with the next level of gain, etc. Mathematically: + +$$ +n C G @ k = \frac {C G @ k}{I C G @ k} \tag {2} +$$ + +# 4 Sem- $nCG$ for Extractive Summary + +The main motivation for introducing the Sem-nCG metric is to ensure a fair evaluation of the extractive summarization task where the metric is both semantic-aware as well as captures the ranking quality of the extractive summarizer. Indeed, for extractive summarization, sentences in the original document are ranked based on how well they reflect the overall description, and thus, evaluating it with a rank-aware metric like Sem-nCG is more equitable. But, how can we develop a Sem-nCG metric for the extractive summarization task that was originally designed for Information Retrieval systems? What would be the query in this case? What would be the definition of a document? How do we define the gains? How can we compute the groundtruth + +ideal ranking? All of these are important questions we need to answer before one can use Sem-nCG evaluation for extractive summarization tasks. + +Problem Formulation: We formulate extractive text summarization as a ranking problem, where the output is a ranked-list of sentences based on how well they convey the overall content of the original document. Let us assume that, input is a document $D = [S_D^1, S_D^2, S_D^3, S_D^4 \dots, S_D^{|D|}]$ , where $S_D^i$ denotes $i^{th}$ sentence of document $D$ and output is the Sem-nCG@k score for the top-k sentences extracted from Document $D$ by the extractive summarization model. Now, in order to compute Sem-nCG@k, we need to know what the gains of the top-k ranked sentences are, as well as the gains of the top-k ideal (desired) sentences. In other words, without knowing the groundtruth gains for each sentence in the original document, we cannot compute the Sem-nCG@k metric. + +Groundtruth Gains: It is indeed a philosophical question to ask what should be the definition of gains in case of the extractive summarization. In this work, we define gain as the following: + +Definition 4.1 Given document $D$ and a sentence $s$ from $D$ , gain of $s$ with respect to $D$ is proportional to the degree of how well $s$ captures the overall semantic meaning of document $D$ . + +One way to measure this capturing power is to ask human judges. However, human judgment in this case is problematic for multiple reasons as follows: 1) Human evaluation is time-consuming and expensive, 2) Some human raters have the tendency to give higher ratings than deserved, this is known as the Leniency problem, which results in higher variance (Harman and Over, 2004), 3) Natural language descriptions are noisy and ambiguous, which makes manual ordering of sentences by annotators even harder resulting in low inter-rater agreement. This is why we opted for an automated way to create the groundtruth gains without involving humans, as demonstrated by Algorithm 1. + +Automatic Gain Computation: How can we automatically infer groundtruth gains in order to automate Sem-nCG@k computation? Fortunately, in most summarization benchmark datasets, one or more reference summaries written by humans are also provided along with the original documents. We leverage these human-written reference summaries to automatically infer groundtruth gains. + +The exact process is presented in Algorithm 1, where we utilize the semantic similarity between + +![](images/d53602c4f0561f40e20b4b6c2ba757719457a7d5e05eea55b818893fe2ca19e1.jpg) +Figure 1: Pipeline for Sem-nCG@k evaluation of extractive summarization task, CG@k stands for Cumulative Gain at $\mathrm{k^{th}}$ position and ICG@k for Ideal CG@k. + +# Algorithm 1 Sem-nCG@k Computation + +INPUT: Document $D$ , Reference $R$ , Model's top- $k$ extracted sentences, number of sentences in $D$ as $N$ + +OUTPUT: Sem-nCG@k score + +1: Phase 1: Groundtruth Gain Computation +2: $GT\gets \{\}$ +3: $GT_{gain}\gets \{\}$ +4: Represent sentences in $D$ and $R$ by embedding vectors +5: for each $S_D^i\in D$ do +6: for each $S_R^j \in R$ do +7: $\operatorname{Sim}(S_D^i, S_R^j) \gets \operatorname{Cosine\_Similarity}(S_D^i, S_R^j)$ +8: end for +9: $GT[S_D^i ]\gets mean(Sim)$ +10: end for +11: $GT_{\text{sorted}} \gets \text{Sort GT based on mean}(\text{Sim})$ +12: $GT_{gain}[S_D^i ]\gets N - rank(S_D^i,GT_{sorted}) + 1$ +13:Normalize $GT_{gain}$ into a probabilistic gain +14: return $GT_{gain}$ +1: Phase 2: Sem-nCG@k Computation +2: Compute $ICG@k$ from $GT_{gain}$ +3: $M\gets$ Model's top- $k$ extracted sentences +4: Retrieve $M$ 's gain from $GT_{gain}$ +5: Compute $CG@k$ for $M$ +6: return Sem-nCG@k = $\frac{CG@k}{ICG@k}$ + +each sentence in the input document and the entire reference summary to generate groundtruth gains. For semantic similarity, we have experimented with different embeddings, including InferSent, Sentence Transformer, Elmo, Google Universal Sentence Encoding and their ensembles (details in section 5.3). Specifically, we measure the cosine similarity between each sentence in the original document and each reference sentence and then calculate an average cosine similarity for each source-sentence with respect to the whole reference. This average cosine similarity score is then used to rank all the sentences in the original document and a simple greedy approach is taken to assign the groundtruth gains as follows: sentences are assigned a groundtruth gain of $N$ , $N - 1$ , ..., 1, sequentially from the top, where $N$ denotes the number of sentences in the document. Later, the + +gain of each sentence is normalized to probabilistic scores ensuring the range of the Sem-nCG metric to be between 0 and 1. The intuition here is that a higher-ranked sentence gets more rewards than a lower-ranked one. + +The gains computed by algorithm 1 are then used in equation 1 to compute the corresponding cumulative gain for ideal ranking $(ICG@k)$ and for model's ranking $(CG@k)$ , respectively. The ratio of $CG@k$ and $ICG@k$ , which is $nCG@k$ (equation 2), captures the quality of the system generated ranking with respect to the groundtruth ranking. Figure 1 visually demonstrates the pipeline for computing Sem-nCG@k metric. + +# 5 Experimental Setup + +# 5.1 Dataset + +We conducted extensive experiments with our proposed Sem-nCG metric using the popular CNN/DailyMail (Hermann et al., 2015) benchmark dataset. The CNN/DailyMail dataset provides a collection of news articles and related highlights, and these highlights are used as a reference (gold summary). Also, the reference summaries are somewhat extractive in nature (a few bullet points providing a brief overview of the article) (Liu and Lapata, 2019). We collected the dataset from huggingface (Wolf et al., 2020) $^{1}$ . As we are not explicitly doing any training/fine-tuning of the summarizer models, we have only used the testing set for our experimental evaluation. We excluded any sample that has a sentence count less than 5 from our analysis as we report Sem-nCG@5 scores. There were 64 such samples in the testing set, which brings + +our sample size to 11, 426 (Details can be found in Table 1). + +
FeatureDescription
Train/Validation/Test287113/13368/11490
#Mean Tokens781 per Article/56 per Highlights
ReferenceSingle
StrategyExtractive
+ +Table 1: Overview of CNN/DailyMail Dataset + +# 5.2 Extractive Summarization Models + +We collected six pre-trained models: $\mathrm{BERT}_{\mathrm{base}}$ (Liu and Lapata, 2019), MobileBERT (Sun et al., 2020), DistilBERT (Sanh et al., 2019), RoBERTa (Liu et al., 2019), XLNet (Yang et al., 2019), GPT-2 (Radford et al., 2019), from huggingface (Wolf et al., 2020) that were fine-tuned on the CNN/DailyMail dataset for the extractive summarization task2. We then evaluated these six models using both our proposed Sem-nCG@k metric and traditional ROUGE metric. + +# 5.3 Embedding Sensitivity + +We recognize that the groundtruth gains we considered are not absolute since they are derived from a pre-trained sentence embedding. Therefore, we investigated the sensitivity of the gains by varying eight cutting-edge sentence embedding techniques. Specifically, we experimented with Inferent (v1&v2) (Conneau et al., 2017), Semantic Textual Similarity benchmark (STSb - bert/roberta/distilbert) (Reimers and Gurevych, 2019), Elmo (Peters et al., 2018) and Google Universal Sentence Encoder (USE) (Cer et al., 2018): i) enc-2 (Iyyer et al., 2015) based on the deep average network ii) enc-3 (Vaswani et al., 2017) based on transformers. We also created an ensemble method to aggregate the gains (in terms of raw similarity, rank and relevance) provided by different embeddings and combine them into a single gain with an expectation that the ensemble technique will provide a more reliable way for preparing the groundtruth gains. Furthermore, we have also experimented with 3 different variations of the ensemble technique: Ensemble $\mathrm{sim}$ , Ensemble $\mathrm{rank}$ and Ensemble $\mathrm{rel}$ , with the hope of obtaining more robust groundtruth gains. Specifically, Ensemble $\mathrm{sim}$ aggregates the cosine similarity first and then gives gains according to Algorithm 1, Ensemble $\mathrm{rank}$ generates a sentence ranking for each embedding variation and then aggregates the ranking to create a + +more robust ranking and then provide the gains according to Algorithm 1 and Ensemblerel calculates the gain first according to Algorithm 1 for all embedding variations and then takes an average over the gains. Please note that we compare sentences from original documents with highlights (written by humans) to prepare these groundtruth gains. + +# 6 Quantitative Evaluation + +# 6.1 ROUGE is not Robust to Perturbation + +One of the major criticisms of ROUGE is that it is not semantic-aware. Table 2 confirms that the ROUGE score highly varies if the original document is perturbed with synonyms ${}^{3}$ . Clearly, this is not desired from a "good" summary evaluation metric. Indeed, humans have various ways to express the same thing and often humans write summaries in their own words rather than picking the same key words from the original document (for example if the document uses "vacation", human references can have "trip", "tour", "break" etc.). For our experiments, we substituted around ${20}\%$ of the words (excluding stop words) of the original document with their synonyms and computed ROUGE scores for these perturbed documents using the CNN/DailyMail dataset, assuming a 5-sentence summary. We utilized wordnet ${}^{4}$ from nltk.corpus to perform synonym replacement. As seen from Table 2, for ROUGE-1 and ROUGE-3, the score drop was around 5-7%, where for ROUGE-L it was around 3-5%. Interestingly, for ROUGE-2, the score drop was 5-16%. + +As the groundtruth gain computation of SemnCG is dependent of embedding techniques, we have also inspected whether the ROUGE variant with word embedding (ROUGE-we) (Ng and Abrecht, 2015) is also sensitive to perturbation. Interestingly, table 2 shows ROUGE-we scores are also sensitive to perturbation. For all ROUGE-we{1,2,3}, the score drop was around $5 - 6\%$ . One can reasonably expect that the score drop would be more significant if more words are replaced in original document $(>20\%)$ . + +# 6.2 Sem-nCG is Robust to Perturbation + +We have conducted the same experiment mentioned in Section 6.1 with Sem-nCG metric for + +
BERTbaseMobileBERTDistilBERTRoBERTaXLNetGPT-2
ActualPerturbedActualPerturbedActualPerturbedActualPerturbedActualPerturbedActualPerturbed
ROUGE-1Precision28.6923.8528.4223.6429.1924.1125.8621.9326.2622.0325.9821.95
Recall65.0457.7962.856.0265.3758.0757.9352.0857.5351.557.6851.4
F138.6232.7437.8632.1839.1833.0834.6929.9334.9629.934.7129.77
ROUGE-2Precision13.478.8212.938.4913.959.0710.567.0110.777.0310.646.96
Recall30.7321.5528.8620.3431.3822.0224.0717.0224.0316.8223.9916.7
F118.152.1317.2711.5918.7312.4614.239.6214.419.6114.269.5
ROUGE-3Precision7.914.027.53.868.264.165.863.0363.055.913.01
Recall17.859.7216.569.1418.4210.0213.317.3513.357.2913.287.22
F110.615.59.975.2411.045.697.874.158.014.167.94.1
ROUGE-LPrecision17.6214.6317.3714.2818.2514.916.0513.3716.3413.3916.1213.39
Recall40.5636.0138.9434.3241.4236.3736.632.3836.4531.9436.3831.99
F123.8320.1823.2419.5224.5920.5221.6518.3621.8818.2921.6418.27
ROUGE-we-1Precision28.1723.1227.9022.9028.6923.4025.4121.2825.8021.3725.5121.30
Recall63.7355.9661.5154.2064.1256.3056.7750.4656.3749.9156.4849.82
F137.9031.7337.1331.1638.4832.1034.0629.0234.3329.0034.0628.89
ROUGE-we-2Precision18.1813.3917.6513.0318.7013.6815.2511.4815.5011.5115.3211.46
Recall41.5132.7239.3431.2042.1433.2334.5427.6334.3427.3434.3427.26
F124.5118.4123.5617.7825.1318.8020.5115.7120.7015.6920.5115.60
ROUGE-we-3Precision20.3715.2119.7414.7720.9415.5617.0012.8717.3112.9217.1012.81
Recall47.2237.7044.6735.8647.9038.3139.0931.4238.9431.0938.9230.91
F127.5620.9826.4520.2228.2421.4522.9517.6723.2017.6622.9817.50
+ +Table 2: ROUGE and ROUGE-we scores (Precision, Recall and F1) for the extractive summarization models $\mathrm{(BERT_{base})}$ , MobileBERT, DistilBERT, RoBERTa, XLNet, GPT-2) on CNN/DailyMail test dataset. The results are for top-5 extracted sentences when the outputs are in actual and perturbed. + +
EmbeddingBERTbaseMobileBERTDistilBERTRoBERTaXLNetGPT-2
ActualPerturbedActualPerturbedActualPerturbedActualPerturbedActualPerturbedActualPerturbed
Inferent-v175.0672.8570.3869.2976.473.7568.4965.5668.7365.4668.1165.26
Inferent-v274.9872.9369.8469.176.7574.3368.2465.7168.6765.7567.9765.46
STSb-bert75.4674.6870.870.4776.9976.7668.9966.8869.8167.3768.9866.79
STSb-roberta75.2374.5370.7270.4576.6976.3369.0266.9769.7767.469.0466.8
STSb-distilbert74.5773.8370.0169.776.1475.9368.4666.4269.1866.8968.3766.17
Elmo74.6470.369.7267.6475.9170.7668.0364.9168.8364.5567.8964.77
USE-enc276.6476.0671.170.6978.8778.9269.5867.1470.6268.0569.667.11
USE-enc376.0374.9670.1769.3778.1477.7368.1665.7269.1466.4968.0865.66
Ensemble sim77.1876.6271.7671.7579.0678.8169.7867.670.6468.169.7167.44
Ensembl rank77.1576.4171.8171.878.9478.3769.7467.5570.5367.9169.6367.34
Ensembl rel78.7478.9373.5474.4880.4780.8571.7470.8172.571.1771.6270.64
std1.322.301.131.811.502.841.081.581.161.751.121.59
+ +Table 3: Sem-nCG@5 scores for the top-5 sentences of the extractive summarization models (BERTbase, Mobile-BERT, DistilBERT, RoBERTa, XLNet, GPT-2) on CNN/DailyMail test dataset for different embedding variations. + +top-5 extracted sentences. As shown in Table 3, we can see that Ensemble techniques (especially for Ensemble $_{\text{rel}}$ ) show more robustness which is somewhat expected as it utilizes the benefits of multiple sentence embeddings. Among non-ensemble techniques, STSb-distilbert seems to be the most robust. If computational time is a bottleneck (Table 4), we would recommend utilizing the STSb-distilbert embedding for our proposed Sem-nCG metric. + +# 6.3 Sem- $nCG$ is Robust across Multiple Sentence Embedding Techniques + +In this experiment, we tested the sensitivity of the proposed Sem-nCG metric with respect to the sentence embedding used to create the groundtruth gains. Specifically, we experimented with eight different sentence embedding techniques (Table 3). The findings reveal that the Sem-nCG@k score is + +stable across different sentence embeddings as evident from the low standard deviation of both SemnCG@5 scores for the top-5 extracted sentences. Also, the relative performance of the models always remain same (DistilBERT > BERTbase > MobileBERT > XLNet > GPT-2 > RoBERTa) for all embedding variations. + +# 6.4 Sem- $nCG$ often disagrees with ROUGE + +Although ROUGE and Sem-nCG@k agree on relative performances of multiple summarization models in the average case, as we explored further, we discovered that the agreement does not hold for individual document samples. As shown in Table 5, there is a considerable amount of disagreements between ROUGE and Sem-nCG@k for each pair of models. Here, disagreement means when comparing ModelA and ModelB, Sem-nCG@k in + +dicates Model $_{\mathrm{A}}$ 's output is better, while ROUGE implies Model $_{\mathrm{B}}$ 's output is better and vice-versa. To resolve these conflicts, we further involved humans to perform meta-evaluation of ROUGE and Sem-nCG@k, where human judgement agreed with Sem-nCG@k most of the time (see Section 7). + +# 7 Human Evaluation + +# 7.1 Human judgment favors Sem-nCG over ROUGE in case of disagreements + +We next took a deeper look into the cases where Sem-nCG disagreed with ROUGE (Table 5) while comparing two extractive summarization models. We asked humans to blindly evaluate the quality of the summaries generated by two models and make a judgement on which summary was better as suggested by (Peyrard, 2019) as well. Specifically, we considered 5 pairs of models $(\mathrm{BERT}_{\mathrm{base}})$ vs. MobileBERT, MobileBERT vs. DistilBERT, DistilBERT vs. RoBERTa, RoBERTa vs. XLNet, and XLNet vs. GPT-2) and provided humans with outputs for each pair of models, hiding the model's name. We took 10 conflicting examples between Sem-nCG and ROUGE-L for each pair of models. This means that humans evaluated $10 \times 2 = 20$ summaries, each 5 sentences long, for each model pair. In total, annotators labeled $5 \times 20 \times 5 = 500$ sentences for model output, after reading around $5 \times 10 \times 50 = 2500$ sentences for articles and $5 \times 10 \times 3 = 150$ sentences for highlights. We asked the annotators to say which extractive summary is better and matched their decision against both ROUGE and Sem-nCG@k's conclusions. Our annotators were three doctoral students all working in NLP. We took the majority voting judgement from annotators and the results are reported in Table 6. As summarized in Table 6, blind evaluation by humans indicated Sem-nCG@k was more accurate than ROUGE in the case of disagreements between the two, thus confirming that Sem-nCG@k captures semantics better than ROUGE. + +# 7.2 Meta-Evaluation of Sem-nCG + +We further performed meta-evaluation of the SemnCG metric using data provided by (Fabbri et al., 2021) $^6$ . The dataset includes summaries generated by 16 models (both extractive and abstractive) from 100 source news articles (1600 summaries in total). + +For our experiments, we only considered the extractive summaries and omitted samples containing less than 3 sentences (as we report Sem-nCG@3), and that resulted in 252 samples. Each of these summaries was annotated by 5 independent crowd-source workers and 3 independent experts (8 annotations in total). Summaries were evaluated across 4 dimensions: consistency, fluency, coherence, relevance after looking into the CNN/DailyMail reference and 10 additional crowd-sourced reference summaries. As mentioned in (Gillick and Liu, 2010), non-expert annotation can be risky, so we only considered expert annotations as followed by (Fabbri et al., 2021) as well. Next, we computed kendall's tau correlation between the Sem-nCG score and each of consistency, fluency, coherence, relevance scores rated by humans in the case of single reference setting for the following 3 different scenarios (example in Table 8): + +- Less Overlapping Reference (LOR): Highly abstractive references with fewer lexical overlap with the original document. +- Medium Overlapping Reference (MOR): Somewhat extractive references (CNN/DailyMail) with moderate lexical overlap. +- Highly Overlapping Reference (HOR): Highly extractive references with high lexical overlap. + +Table 7 shows that our proposed metric outperforms ROUGE in terms of consistency (the most crucial dimension perhaps) for all 3 types of references (even for HOR) with a considerable margin. Interestingly, we found that there is not a clear winner among the embedding choices. However, the STSb-distilbert embedding shows good performance in the consistency dimension both for less overlapping and high overlapping references. Note that STSb-distilbert also takes less computation time (Table 4) and can be a better choice for low-resource evaluation scenarios. + +Along the fluency dimension, our proposed semnCG@k correlates better with humans for all types of references (except for less overlapping references with a comparable performance). Of particular interest from Table 7 are the more abstractive (LOR) references with little overlaps, where semnCG@k correlation is higher than ROUGE for 3 dimensions, including consistency, coherence, and relevance. For medium and highly overlapping references, ROUGE correlation along the coherence and relevance dimension was higher, which is somewhat expected, since ROUGE mainly computes lexical overlaps. These results suggest that, + +
EmbeddingInferent-v1Inferent-v2STSb-bertSTSb-robertaSTSb-distilbertElmoUSE-enc2USE-enc3
Time (Second)0.360.410.330.340.1379.120.127.5
+ +Table 4: The average computational time (in CPU) required to run the evaluation of a single test instance for different pre-trained embeddings. Apparently, STSb-distilbert is very fast when compared to the other embeddings. + +
ModelPaired withR1R2R3RL
BERTbaseMobileBERT6478625864616397
DistilBERT6443632664866336
RoBERTa4408399443454511
XLNet3853412144474643
GPT-24380398943764478
MobileBERTDistilBERT6152569960405850
RoBERTa5397502752615269
XLNet5533502452225287
GPT-25488505052505286
DistilBERTRoBERTa7786380041734285
XLNet4296391742514458
GPT-24040375941474282
RoBERTaXLNet5772448949234725
GPT-24911458350084787
XLNetGPT-24820447148504693
+ +Table 5: Disagreement between Sem-nCG@5 (with Ensemble rel) and ROUGE (F1) out of 11426 samples for different extractive summarization model pairs. + +
WinLoseTie
Sem-nCG@5 vs. ROUGE62%36%2%
+ +Table 6: Statistics for Sem-nCG@5 wins, losses, and ties against ROUGE-L (F1). Results report average of 5 pairs (BERTbase vs. MobileBERT, MobileBERT vs. DistilBERT, DistilBERT vs. RoBERTa, RoBERTa vs. XLNet and XLNet vs. GPT-2) evaluated by humans. + +while there may not be a clear winner between sem-nCG and ROUGE when the testing corpus mostly contains medium and highly overlapping references, however, sem-nCG@k is clearly a superior metric when evaluating summaries against a more abstract (low overlap) reference. + +# 8 Discussions and Conclusion + +In this paper, we revisited the problem of automatic evaluation for the extractive summarization task, exclusively focusing on the popular ROUGE metric. We first argued that any summary evaluation should be more semantic-aware and demonstrated that ROUGE fails to capture semantics through comprehensive experiments. Indeed, ROUGE score drops (5-7%) even only for small percentages (20%) of synonym perturbation, and thus is not optimal for evaluating any summarization task. + +Next, we argued that a "good" metric for evaluating extractive summarization task should assess its core ranking quality, which ROUGE does not. To address this issue, we proposed a new metric called Sem-nCG which is both semantic-aware and considers ranking quality. More importantly, Sem-nCG + +provides an automated way to compare a set of top-ranked model-extracted sentences (the system-extracted summary) against an ideal ranking of sentences, where the ideal ranking is automatically inferred by computing gains based on some human-written summary. This saves us from tedious process of manual annotation of each sentence within the original document, thus making it practically suitable for large scale automated evaluation. + +The correctness of the Sem-nCG metric depends largely on the reliability of the groundtruth gains computed by algorithm 1. Therefore, to verify the quality of the groundtruth gains, we conducted extensive quantitative evaluations which confirm that the Sem-nCG metric is stable across multiple sentence embedding techniques (very robust) [section 6.2]. Through additional experiments, we have demonstrated the following as well: 1) Sem-nCG correlates better with humans [section 7.2]; 2) Sem-nCG often disagrees with ROUGE for pairwise comparison of summarization methods [section 6.4]; 3) In the cases of such disagreements, further verification from human judges confirmed that Sem-nCG is more reliable than the ROUGE metric [section 7.1]; and 4) Sem-nCG is a superior metric when evaluating summaries against a more abstract (low overlap) reference [section 7.2]. To conclude, we recommend the following practice: + +- For extractive summarization evaluation, please refrain from overemphasizing a substantial improvement over ROUGE solely. +- While evaluating extractive summaries, mitigate the limitations of the ROUGE metric by reporting additional metrics which are semantic-aware and can generate reliable gains from human references (e.g., Sem-nCG), especially when the human-references are more abstractive in nature. +- Human judgment must still be the gold standard, and while making a conclusion of making substantial improvement over previous work, make sure it is backed by human evaluation. + +We recognize that our proposed Sem-nCG metric overlooks redundancy when computing groundtruth gains; thus, our immediate future goal is to design a redundancy-aware Sem-nCG, as well as expand Sem-nCG for multi-references and multi-document summarization settings. + +
Sem-nCG@3
ConsistencyFluencyCoherenceRelevance
EmbeddingLORMORHORLORMORHORLORMORHORLORMORHOR
Infersent-v10.060.070.070.030.020.100.040.01-0.010.070.080.05
Infersent-v20.080.050.080.050.020.120.060.070.040.070.130.09
STSb-bert0.110.070.090.010.030.10-0.010.070.010.030.140.12
STSb-distilbert0.170.090.120.000.020.040.060.04-0.010.060.110.07
STSb-roberta0.120.130.05-0.010.010.040.020.010.000.070.080.09
Elmo0.060.080.090.000.000.060.020.020.010.020.080.06
USE-enc20.050.030.040.030.060.080.070.090.020.110.130.08
USE-enc30.010.010.09-0.080.000.040.020.030.040.010.120.05
Ensemble sim0.080.070.080.000.030.070.050.05-0.030.080.130.07
Ensembl rank0.100.090.09-0.020.010.080.040.04-0.010.080.120.07
Ensembl rel0.090.080.090.010.030.080.070.060.000.110.140.07
ROUGE
ROUGE-10.080.04-0.010.060.050.070.020.130.130.070.210.22
ROUGE-20.050.02-0.050.040.040.01-0.050.140.130.010.230.21
ROUGE-30.080.03-0.050.060.050.00-0.080.150.120.020.240.19
ROUGE-L0.020.06-0.020.020.04-0.04-0.010.130.070.040.180.14
+ +Table 7: Kendall's tau correlation coefficients of expert annotations computed at single reference setting for ROUGE and Sem-nCG along four quality dimensions (for top-3 sentences). The correlation was demonstrated for low overlapping references (LOR), Medium Overlapping CNN/DailyMail Reference (MOR), and high overlapping references (HOR) chosen from 11 reference summaries per example. The outperformed correlated values in each column have been bolded both for Sem-nCG and ROUGE. + +
Article
Paul Merson has restarted his row with Andros Townsend after the Tottenham midfielder was brought on with only seven minutes remaining in his team's 0-0 draw with Burnley on Sunday. 'Just been watching the game, did you miss the coach? #RubberDub #7minutes,' Merson put on Twitter. Merson initially angered Townsend for writing in his Sky Sports column that 'if Andros Townsend can get in (the England team) then it opens it up to anybody.' Paul Merson had another dig at Andros Townsend after his appearance for Tottenham against Burnley Townsend was brought on in the 83rd minute for Tottenham as they drew 0-0 against Burnley Andros Townsend scores England's equaliser in their 1-1 friendly draw with Italy in Turin on Tuesday night The former Arsenal man was proven wrong when Townsend hit a stunning equaliser for England against Italy and he duly admitted his mistake. 'It's not as though I was watching hoping he wouldn't score for England, I'm genuinely pleased for him and fair play to him - it was a great goal,' Merson said. 'It's just a matter of opinion, and my opinion was that he got pulled off after half an hour at Manchester United in front of Roy Hodgson, so he shouldn't have been in the squad. 'When I'm wrong, I hold my hands up. I don't have a problem with doing that - I'll always be the first to admit when I'm wrong.' Townsend hit back at Merson on Twitter after scoring for England against Italy Sky Sports pundits Merson (centre) criticised Townsend's call-up to the England squad last week Townsend hit back at Merson after netting for England in Turin on Wednesday, saying 'Not bad for a player that should be 'nowhere near the squad' ay @PaulMerse?' Any bad feeling between the pair seemed to have passed but Merson was unable to resist having another dig at Townsend after Tottenham drew at Turf Moor.
LORMORHOR
An athlete was brought in to save the game during an event against a rival team. Although many disagreed with this decision as players have been known to get in trouble from time to time.Andros Townsend an 83rd minute sub in Tottenham's draw with Burnley. He was unable to find a winner as the game ended without a goal. Townsend had clashed with Paul Merson last week over England call-up.Paul Merson and Andros Townsend have been in about for a while now, Mer- son felt that Townsend did not deserve a place in the English team. Townsend scored for England with a crucial goal to which Merson apologized and acknowledge the performance of Townsend in that game and wished him well on his performance. The back and forth be-tween the two men has continued re-gardless but it appears that now their bad feelings have subsided despite some light jest between the two.
+ +Table 8: An example of the three scenarios highlighted in the human evaluation + +# Acknowledgments + +This research has been supported by the Department of Computer Science and Software Engineering, Auburn University. We thank the members of BDI lab for helping with human evaluation and the + +anonymous reviewers for their valuable feedback. + +# References + +Daniel Cer, Yinfei Yang, Sheng-yi Kong, Nan Hua, Nicole Limtiaco, Rhomni St. John, Noah Constant, + +Mario Guajardo-Cespedes, Steve Yuan, Chris Tar, Brian Strope, and Ray Kurzweil. 2018. Universal sentence encoder for English. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 169-174, Brussels, Belgium. Association for Computational Linguistics. +Arman Cohan and Nazli Goharian. 2016. Revisiting summarization evaluation for scientific articles. In Proceedings of the Tenth International Conference on Language Resources and Evaluation LREC 2016, Porto Roz, Slovenia, May 23-28, 2016. European Language Resources Association (ELRA). +Alexis Conneau, Douwe Kiela, Holger Schwenk, Loic Barrault, and Antoine Bordes. 2017. Supervised learning of universal sentence representations from natural language inference data. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, EMNLP 2017, Copenhagen, Denmark, September 9-11, 2017, pages 670-680. Association for Computational Linguistics. +Hoa Trang Dang. 2005. Overview of duc 2005. In Proceedings of the document understanding conference, volume 2005, pages 1-12. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: pre-training of deep bidirectional transformers for language understanding. In *NAACL-HLT*, pages 4171–4186. +Alexander R. Fabbri, Wojciech Kryscinski, Bryan McCann, Caiming Xiong, Richard Socher, and Dragomir R. Radev. 2021. Summeval: Re-evaluating summarization evaluation. Trans. Assoc. Comput. Linguistics, 9:391-409. +Kavita Ganesan. 2018. ROUGE 2.0: Updated and improved measures for evaluation of summarization tasks. CoRR, abs/1803.01937. +Dan Gillick and Yang Liu. 2010. Non-expert evaluation of summarization systems is risky. In Proceedings of the NAACL HLT 2010 Workshop on Creating Speech and Language Data with Amazon's Mechanical Turk. +Yvette Graham. 2015. Re-evaluating automatic summarization with BLEU and 192 shades of ROUGE. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, EMNLP 2015, Lisbon, Portugal, September 17-21, 2015, pages 128-137. The Association for Computational Linguistics. +Hardy, Shashi Narayan, and Andreas Vlachos. 2019. Highres: Highlight-based reference-less evaluation of summarization. In Proceedings of the 57th Conference of the Association for Computational Linguistics, ACL 2019, Florence, Italy, July 28-August 2, 2019, Volume 1: Long Papers, pages 3381-3392. Association for Computational Linguistics. + +Donna Harman and Paul Over. 2004. The effects of human variation in DUC summarization evaluation. In Text Summarization Branches Out, pages 10-17, Barcelona, Spain. Association for Computational Linguistics. +Karl Moritz Hermann, Tomás Kocisky, Edward Grefenstette, Lasse Espeholt, Will Kay, Mustafa Suleyman, and Phil Blunsom. 2015. Teaching machines to read and comprehend. In Advances in Neural Information Processing Systems 28: Annual Conference on Neural Information Processing Systems 2015, December 7-12, 2015, Montreal, Quebec, Canada, pages 1693-1701. +Mohit Iyyer, Varun Manjunatha, Jordan Boyd-Graber, and Hal Daumé III. 2015. Deep unordered composition rivals syntactic methods for text classification. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 1681–1691, Beijing, China. Association for Computational Linguistics. +Kalervo Järvelin and Jaana Kekäläinen. 2002. Cumulated gain-based evaluation of IR techniques. ACM Transactions on Information Systems (TOIS), 20(4):422-446. +Shubhra (Santu) K Karmaker, Parikshit Sondhi, and ChengXiang Zhai. 2020. Empirical analysis of impact of query-specific customization of ndcg: a case-study with learning-to-rank methods. In Proceedings of the 29th ACM International Conference on Information & Knowledge Management, pages 3281-3284. +Shubhra Kanti Karmaker Santu, Parikshit Sondhi, and ChengXiang Zhai. 2017. On application of learning to rank for e-commerce search. In Proceedings of the 40th international ACM SIGIR conference on research and development in information retrieval, pages 475-484. +Saar Kuzi, Sahiti Labhishetty, Shubhra Kanti Karmaker Santu, Prasad Pradip Joshi, and ChengXiang Zhai. 2019. Analysis of adaptive training for learning to rank in information retrieval. In Proceedings of the 28th ACM International Conference on Information and Knowledge Management, pages 2325-2328. +Chin-Yew Lin. 2004. Rouge: A package for automatic evaluation of summaries. In Text summarization branches out, pages 74-81. +Yang Liu and Mirella Lapata. 2019. Text summarization with pretrained encoders. In EMNLP-IJCNLP, pages 3728-3738. +Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019. Roberta: A robustly optimized BERT pretraining approach. CoRR, abs/1907.11692. + +Annie Louis and Ani Nenkova. 2013. Automatically assessing machine summary content without a gold standard. Comput. Linguistics, 39(2):267-300. +Yuning Mao, Liyuan Liu, Qi Zhu, Xiang Ren, and Jiawei Han. 2020. Facet-aware evaluation for extractive summarization. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, ACL, pages 4941-4957. Association for Computational Linguistics. +Ani Nenkova. 2006. Summarization evaluation for text and speech: issues and approaches. In INTER-SPEECH 2006 - ICSLP, Ninth International Conference on Spoken Language Processing. ISCA. +Ani Nenkova and Rebecca J. Passonneau. 2004. Evaluating content selection in summarization: The pyramid method. In Human Language Technology Conference of the North American Chapter of the Association for Computational Linguistics, HLT-NAACL, pages 145-152. The Association for Computational Linguistics. +Jun-Ping Ng and Viktoria Abrecht. 2015. Better summarization evaluation with word embeddings for ROUGE. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, EMNLP 2015, Lisbon, Portugal, September 17-21, 2015, pages 1925-1930. The Association for Computational Linguistics. +Rebecca J. Passonneau, Emily Chen, Weiwei Guo, and Dolores Perin. 2013. Automated pyramid scoring of summaries using distributional semantics. In Proceedings of the 51st Annual Meeting of the Association for Computational Linguistics, ACL 2013, 4-9 August 2013, Sofia, Bulgaria, Volume 2: Short Papers, pages 143-147. The Association for Computer Linguistics. +Matthew E. Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. 2018. Deep contextualized word representations. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, NAACL-HLT 2018, New Orleans, Louisiana, USA, June 1-6, 2018, Volume 1 (Long Papers), pages 2227-2237. Association for Computational Linguistics. +Maxime Peyrard. 2019. Studying summarization evaluation metrics in the appropriate scoring range. In Proceedings of the ACL 2019, Volume 1: Long Papers, pages 5093-5100. Association for Computational Linguistics. +Dragomir R. Radev and Daniel Tam. 2003. Summarization evaluation using relative utility. In CIKM International Conference on Information and Knowledge Management, pages 508-511. ACM. +Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019. Language + +models are unsupervised multitask learners. OpenAI blog, 1(8):9. +Nils Reimers and Iryna Gurevych. 2019. Sentence-bert: Sentence embeddings using siamese bert-networks. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing. Association for Computational Linguistics. +Victor Sanh, Lysandre Debut, Julien Chaumont, and Thomas Wolf. 2019. Distilbert, a distilled version of BERT: smaller, faster, cheaper and lighter. CoRR, abs/1910.01108. +Thibault Sellam, Dipanjan Das, and Ankur P. Parikh. 2020. BLEURT: learning robust metrics for text generation. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, ACL 2020, Online, July 5-10, 2020, pages 7881-7892. Association for Computational Linguistics. +Elaheh ShafieiBavani, Mohammad Ebrahimi, Raymond K. Wong, and Fang Chen. 2018. A graph-theoretic summary evaluation for rouge. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, Brussels, Belgium, October 31 - November 4, 2018, pages 762-767. Association for Computational Linguistics. +Ori Shapira, David Gabay, Yang Gao, Hadar Ronen, Ramakanth Pasunuru, Mohit Bansal, Yael Amsterdamer, and Ido Dagan. 2019. Crowdsourcing lightweight pyramids for manual summary evaluation. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, NAACL-HLT 2019, Minneapolis, MN, USA, June 2-7, 2019, Volume 1 (Long and Short Papers), pages 682-687. Association for Computational Linguistics. +Simeng Sun and Ani Nenkova. 2019. The feasibility of embedding based automatic evaluation for single document summarization. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing, EMNLP-IJCNLP, pages 1216-1221. Association for Computational Linguistics. +Zhiqing Sun, Hongkun Yu, Xiaodan Song, Renjie Liu, Yiming Yang, and Denny Zhou. 2020. Mobilebert: a compact task-agnostic BERT for resource-limited devices. In ACL, pages 2158-2170. +Simone Teufel and Hans van Halteren. 2004. Evaluating information content by factoid analysis: Human annotation and stability. In Proceedings of the 2004 Conference on Empirical Methods in Natural Language Processing, pages 419-426. ACL. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In Advances in Neural Information Processing Systems 30: Annual Conference on Neural + +Information Processing Systems 2017, December 4-9, 2017, Long Beach, CA, USA, pages 5998-6008. +Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumont, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander M. Rush. 2020. Transformers: State-of-the-art natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 38-45, Online. Association for Computational Linguistics. +Stratos Xenouleas, Prodromos Malakasiotis, Marianna Apidianaki, and Ion Androutsopoulos. 2019. SUMQE: a bert-based summary quality estimation model. In Proceedings of Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing, EMNLP-IJCNLP, pages 6004-6010. Association for Computational Linguistics. +An Yang, Kai Liu, Jing Liu, Yajuan Lyu, and Sujian Li. 2018. Adaptations of ROUGE and BLEU to better evaluate machine reading comprehension task. In Proceedings of the Workshop on Machine Reading for Question Answering@ACL 2018, Melbourne, Australia, July 19, 2018, pages 98-104. Association for Computational Linguistics. +Qian Yang, Rebecca J. Passonneau, and Gerard de Melo. 2016. PEAK: pyramid evaluation via automated knowledge extraction. In Proceedings of the Thirtieth AAAI Conference on Artificial Intelligence, pages 2673-2680. AAAI Press. +Zhilin Yang, Zihang Dai, Yiming Yang, Jaime G. Carbonell, Ruslan Salakhutdinov, and Quoc V. Le. 2019. Xlnet: Generalized autoregressive pretraining for language understanding. In NeurIPS, pages 5754-5764. +Weizhe Yuan, Graham Neubig, and Pengfei Liu. 2021. Bartscore: Evaluating generated text as text generation. CoRR, abs/2106.11520. +Tianyi Zhang, Varsha Kishore, Felix Wu, Kilian Q. Weinberger, and Yoav Artzi. 2020. Bertscore: Evaluating text generation with BERT. In 8th International Conference on Learning Representations, ICLR. OpenReview.net. +Wei Zhao, Maxime Peyrard, Fei Liu, Yang Gao, Christian M. Meyer, and Steffen Eger. 2019. Moverscore: Text generation evaluating with contextualized embeddings and earth mover distance. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing, EMNLP-IJCNLP 2019, Hong Kong, China, November 3-7, 2019, pages 563-578. Association for Computational Linguistics. + +Liang Zhou, Chin-Yew Lin, Dragos Stefan Munteanu, and Eduard H. Hovy. 2006. Paraeval: Using paraphrases to evaluate summaries automatically. In Human Language Technology Conference of the North American Chapter of the Association of Computational Linguistics. The Association for Computational Linguistics. + +# A Appendix + +# A.1 Extractive Summarization Models + +BERTbase: Transformer models achieve state of the art performance on different NLP tasks. A simple variant of BERT for extractive summarization has been shown in paper (Liu and Lapata, 2019) which consists of 2 parts: a BERT encoder and a summarization classifier. The BERT model here consists of the pretrained $\mathrm{BERT}_{\mathrm{base}}$ encoder from masked language model by (Devlin et al., 2019). + +MobileBERT (Sun et al., 2020): In an effort to make BERT available for low resource devices, MobileBERT has been proposed which is a thin version of $\mathrm{BERT}_{\mathrm{large}}$ , with carefully designed balance between self-attention and feed-forward. + +DistilBERT (Sanh et al., 2019): Model size reduction has been studied extensively in the literature due to huge computational expenses of large models. DistilBERT uses knowledge distillation during pre-training to reduce the size of BERT model. It has $40\%$ less parameter than $\mathrm{BERT}_{\mathrm{base}}$ and runs $60\%$ faster while achieving $97\%$ of BERT's performance. + +RoBERTa (Liu et al., 2019): RoBERTa is another variant of BERT that modified key hyperparameters and removed the next sentence prediction objective while training with larger mini batches and learning rates. The authors have shown the importance of design choices in BERT architecture while improving the performance. + +XLNet (Yang et al., 2019): While BERT has been pre-trained on mask language model, XLNet proposes a generalized autoregressive method for pre-training and an extension of the Transformer-XL that outperforms BERT on 20 NLP tasks. + +GPT-2 (Radford et al., 2019): GPT-2 is similar to decoder only transformer but trained on a very large dataset which outperforms BERT on NLP tasks like question answering, reading comprehension, summarization. + +# A.2 Various Sentence Embeddings used for Sem-nCG + +Inferent (Conneau et al., 2017): BiLSTM network with max-pooling generates 4096- + +
ModelLayersHidden UnitsParametersSize
BERTbase12768108M100%
MobileBERT2412825.3M25%
DistilBERT1276866M60%
RoBERTa12768125M113%
XLNet12768110M100%
GPT-2241024355M328%
+ +Table 9: Summary of the Model Architecture + +dimensional sentence embedding. Inferent-v1 (trained with GloVe) and Inferent-v2 (trained with fastText) are the two versions of Inferent sentence embedding. + +Semantic Textual Similarity benchmark (STSb) (Reimers and Gurevych, 2019): Sentence Transformer allows to generate dense vector representations of sentences. We considered three of the best available models that were optimized for semantic textual similarity (STSb-bert, STSb-roberta and STSb-distilbert). + +Elmo (Peters et al., 2018): A fixed mean-pooling of all contextualized word representations with shape 1024 has been considered, effectively transforming the contextualized word-embedding into a sentence embedding. + +Google Universal Sentence Encoder (USE) (Cer et al., 2018): USE converts the input text to a 512-dimensional vector. There are two kinds available, i) enc-2 (Iyyer et al., 2015) based on the deep average network ii) enc-3 (Vaswani et al., 2017) based on transformer. + +# A.3 Sem-nCG@k and ROUGE Scores for Top-3 Sentences + +To generalize our remarks, we repeated the same experiments (mentioned in Section 5) for ROUGE and Sem-nCG@k for the top-3 sentences. Table 10 demonstrates that ROUGE is sensitive to synonym perturbation for the top-3 sentences of extractive models. Table 11, on the other hand, confirms that Sem-nCG@k is merely sensitive to sentence perturbation (especially Ensemblerel) and also robust across various sentence embedding variations (confirms from lower standard deviation). + +# A.4 Dimensions of Human Evaluation + +We have considered four quality dimensions following (Fabbri et al., 2021) to measure the Kendall's tau rank correlation between $Sem - nCG@3$ and ROUGE. + +Consistency: facts between the summary and its source are consistent. Factually consistent summaries contain just assertions from the summarized source, and do not include any trippy facts. + +Fluency: sentence structure and quality. Referring to the DUC quality criteria (Dang, 2005), summary sentences "should have no formatting problems, capitalization errors or obviously ungrammatical sentences (e.g., fragments, missing components) that make the text difficult to read." + +Coherence: the overall quality of summary sentences while retaining a coherent body of information about a topic rather than just a jumble of related information (Dang, 2005). + +Relevance: extracting the most significant information from the source. Summaries with redundancy and extra information were to be penalized by the annotators. Only relevant information from the original should be provided in the summary. + +
BERT-baseMobileBERTDistilBERTRoBERTaXLNetGPT-2
ActualPerturbedActualPerturbedActualPerturbedActualPerturbedActualPerturbedActualPerturbed
ROUGE-1Precision36.6430.2435.229.1537.7730.9732.9927.7833.3127.8333.0427.76
Recall52.846.4650.6644.653.1946.7547.4242.4247.0141.9947.1841.82
F141.7235.339.9333.942.6735.9337.5532.3637.632.2437.4832.12
ROUGE-2Precision16.6710.6815.479.9517.7211.2813.298.7313.448.7113.358.62
Recall24.0116.4822.3415.2824.8917.0219.3613.5519.1913.3819.2813.24
F118.9512.4817.5511.5819.9713.0615.1910.2215.2310.1515.1910.04
ROUGE-3Precision9.774.848.964.510.525.197.383.787.463.777.413.72
Recall13.867.3812.716.7914.647.7410.645.8210.545.7610.65.7
F111.015.6210.065.1911.795.978.384.48.394.388.384.32
ROUGE-LPrecision22.818.7321.8718.0124.1919.6120.6417.2220.8617.1820.717.23
Recall33.1429.0531.6727.734.3329.8329.9826.6129.7326.2629.8526.28
F126.0321.9324.8520.9627.4122.823.5820.1423.6219.9923.5620.01
+ +Table 10: ROUGE scores for the extractive summarization models (BERTbase, MobileBERT, DistilBERT, RoBERTa, XLNet, GPT-2) on CNN/DailyMail test dataset. The results are for top-3 extracted sentences when the outputs are in actual and perturbed. + +
BERT-baseMobileBERTDistilBERTRoBERTaXLNetGPT-2
ActualPerturbedActualPerturbedActualPerturbedActualPerturbedActualPerturbedActualPerturbed
Infersent-v178.0375.0473.3371.1479.2575.1772.7269.4772.7269.2572.4869.11
Infersent-v277.7375.0872.3170.5979.6475.9972.0269.4572.1869.3671.8669.12
STSb-bert78.087772.9371.3579.4678.9172.9370.6773.4371.0173.0870.64
STSb-roberta77.6676.8472.8871.4479.0678.4272.7970.7973.2771.0773.0270.6
STSb-distilbert76.9575.9671.9870.4278.3877.7872.0269.8272.4870.1172.0869.63
Elmo77.2871.0872.3368.7978.3470.5271.767.5771.9867.0671.6867.3
USE-enc279.4378.5873.1171.2781.5281.2973.9371.4474.57274.0371.28
USE-enc378.3776.9872.3770.1480.2879.5371.9769.3672.3669.871.9469.16
Ensemble sim80.1779.3774.3773.1581.9181.1974.2672.274.6972.4674.2971.97
Ensembl rank80.1779.1574.573.3781.880.6674.2672.1974.6272.374.2671.92
Ensembl rel81.280.9875.775.4882.8182.4675.5674.675.9374.7675.5774.38
std1.382.691.151.831.553.431.241.891.292.051.271.91
+ +Table 11: Sem-nCG@3 scores for the top-3 sentences of the extractive summarization models (BERTbase, Mobile-BERT, DistilBERT, RoBERTa, XLNet, GPT-2) on CNN/DailyMail test dataset for different embedding variations. \ No newline at end of file diff --git a/revisitingautomaticevaluationofextractivesummarizationtaskcanwedobetterthanrouge/images.zip b/revisitingautomaticevaluationofextractivesummarizationtaskcanwedobetterthanrouge/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..83a9ef73fe4a47e62f5f70d24ffe7e2de26c955e --- /dev/null +++ b/revisitingautomaticevaluationofextractivesummarizationtaskcanwedobetterthanrouge/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:53b683ea8d893235d9bcc7de0364ddfc7df1b2b06b8cf6746e254014daaea36b +size 1019133 diff --git a/revisitingautomaticevaluationofextractivesummarizationtaskcanwedobetterthanrouge/layout.json b/revisitingautomaticevaluationofextractivesummarizationtaskcanwedobetterthanrouge/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..2d1a12f1cd873bdb09bc00665437fe51c3abca61 --- /dev/null +++ b/revisitingautomaticevaluationofextractivesummarizationtaskcanwedobetterthanrouge/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b01671b4977ed72fad594a00758fdd4a25b5fdeca91ec26b59bfcf328913ac44 +size 443336 diff --git a/revisitingtheeffectsofleakageondependencyparsing/18bbb9aa-76c3-47a9-89f4-ea62f2be7562_content_list.json b/revisitingtheeffectsofleakageondependencyparsing/18bbb9aa-76c3-47a9-89f4-ea62f2be7562_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..d7f094ec2a132a95f3f45f50934e06c8332edc20 --- /dev/null +++ b/revisitingtheeffectsofleakageondependencyparsing/18bbb9aa-76c3-47a9-89f4-ea62f2be7562_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2ec3cf1ff9a7e27f5dd4a6d54817bd6f3de297b5acdfdba8f0ff236a0565b215 +size 62312 diff --git a/revisitingtheeffectsofleakageondependencyparsing/18bbb9aa-76c3-47a9-89f4-ea62f2be7562_model.json b/revisitingtheeffectsofleakageondependencyparsing/18bbb9aa-76c3-47a9-89f4-ea62f2be7562_model.json new file mode 100644 index 0000000000000000000000000000000000000000..d4534fbfa291da780e9f4ec5fa423dd8822032b4 --- /dev/null +++ b/revisitingtheeffectsofleakageondependencyparsing/18bbb9aa-76c3-47a9-89f4-ea62f2be7562_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b3b95a59e600f6d51bea0bccd57d234c89fdd70cee64b4802b0ce95a0d9ccd93 +size 70280 diff --git a/revisitingtheeffectsofleakageondependencyparsing/18bbb9aa-76c3-47a9-89f4-ea62f2be7562_origin.pdf b/revisitingtheeffectsofleakageondependencyparsing/18bbb9aa-76c3-47a9-89f4-ea62f2be7562_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..f2ca1547a6303792ce186bbc956c63e33487ae26 --- /dev/null +++ b/revisitingtheeffectsofleakageondependencyparsing/18bbb9aa-76c3-47a9-89f4-ea62f2be7562_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d09e3d98fe2f7433ab1a2ef2efb5c8525ec03317309592801c19e1ca63cc0314 +size 284776 diff --git a/revisitingtheeffectsofleakageondependencyparsing/full.md b/revisitingtheeffectsofleakageondependencyparsing/full.md new file mode 100644 index 0000000000000000000000000000000000000000..3676940c521e2d06b50bdef7f64e441da23f3e3d --- /dev/null +++ b/revisitingtheeffectsofleakageondependencyparsing/full.md @@ -0,0 +1,213 @@ +# Revisiting the Effects of Leakage on Dependency Parsing + +Nathaniel Krasner\*,1, Miriam Wanner\*,2, Antonios Anastasopoulos + +$^{1}$ Department of Computer Science, George Mason University + +$^{2}$ Department of Computer Science, University of Virginia + +natekrasner@gmail.com, msw2vg@virginia.edu, antonis@gmu.edu + +# Abstract + +Recent work by Søgaard (2020) showed that, treebank size aside, overlap between training and test graphs (termed leakage) explains more of the observed variation in dependency parsing performance than other explanations. In this work we revisit this claim, testing it on more models and languages. We find that it only holds for zero-shot cross-lingual settings. We then propose a more fine-grained measure of such leakage which, unlike the original measure, not only explains but also correlates with observed performance variation. + +# 1 Introduction + +Syntactic parsing has long been one of the core natural language processing (NLP) tasks, and the proliferation of the Universal Dependencies project (UD; de Marneffe et al., 2021; Nivre et al., 2017) has allowed the development and comparison of monolingual and multilingual models under the same syntactic framework. + +The performance of the dependency parsers, however, varies wildly across languages, with state-of-the-art performance ranging from labeled attachment scores below 20 (e.g. for Amharic, Erzya, Komi, or Yoruba) to more than 90 (e.g. for Spanish, Polish, Russian, or Greek). As the UD treebanks follow mostly similar annotation guidelines, comparisons of the parsing performance across languages are now possible, to an extent.2 + +In an effort to explain these cross-lingual performance differences, researchers have proposed treebank size (Vania et al., 2019), linguistic variation (Nivre et al., 2007), test data sentence length + +Dependency Trees: + +![](images/92f87286dc0fcc2ff12f1c0b42204dacf52941734dce247ad2271c8c1f23d469.jpg) + +![](images/6794a5adef8a1af00faa23d206feab5a0eb5fbc88dba113efb2e2eaa6ee44779.jpg) + +Søgaard (2020) Unlabeled Directed Graphs: + +![](images/7ebc99c412e7270d9dbb54ceec1d2089f5588cf137c315b33b937f550579e0a3.jpg) + +![](images/9b8a021c09198c529fd954d63a0be0a8a4a72c0a07dc7335d326d559f5f8813a.jpg) + +Node- and Edge-Labeled Directed Graphs: + +![](images/c404ef5ff09cb543eb44ce734e1827bb1cb6d1c48fdc85a816cea8568721c16e.jpg) +Figure 1: Only labeled reductions produce different graphs for these fundamentally different sentences. Under unlabeled leakage, the two trees do leak. When taking labels into account the two trees belong to different isomorphisms and are not considered "leaky". + +![](images/97d7b7fe51eb1359a9bee41925ece7653e3f0d34b890b85b0c9703ab2a133d0d.jpg) + +or average gold dependency length (McDonald and Nivre, 2011), and domain differences between training and test data (Foster et al., 2011), as potential predictors. Recently, Søgaard (2020) proposed that the proportion of isomorphic graph structures between the training and testing data (leakage) is a stronger predictor of the parsers' performance than any of the previously listed attributes other than training treebank size. + +Søgaard (2020) concludes that "some languages seem easier to parse because their treebanks leak." This finding is potentially crucial for current parser evaluation on the existing treebanks, as well as for future treebank construction. It implies, for instance, that parsers are perhaps not as good as they seem, because they are tested on "leaky" test data. Perhaps one should also consider designing treebanks that do not leak between train and test, as such a test set would not have a bias toward more common phenomena. + +In this work, we examine this finding more closely. We extend Søgaard's definition to include + +labeled leakage, and study it over multiple parsers in both monolingual and cross-lingual settings. We show that the finding does not hold up when tested against more modern parsers and more languages. We do identify, though, that leakage indeed predicts parser performance in zero-shot cross-lingual settings, and we dive deeper in this phenomenon with an extensive study focusing on Faroese and other Germanic languages. Last, we propose a modification of the leakage measure that both predicts and correlates with parser performance in such settings. + +# 2 Leakage and How to Measure it + +In this section we first define leakage based on graph isomorphisms and reproduce Søgaard's experiments. We then show that parsers make local decisions that allow them to generalize to unseen graphs, and explore additional measures of leakage, studying whether they help explain parser performance. Last, we argue that sub-trees are more meaningful units than label-free, tree-level representations. + +Leakage Definition Leakage can be broadly defined as the portion of test trees that have isomorphic counterparts in the train set. While dependency trees are labeled, directed graphs with labels both on the nodes and on the edges, Søgaard (2020) performed a reduction by removing labels from both nodes and edges. + +Given these reduced graphs, Søgaard (2020) finds the different isomorphisms that are present in the training and the test set, using the VF2 algorithm (Cordella et al., 2001). We note that the isomorphism may or may not rely on node or edge labels. In the experiments below, we perform an ablation between using completely unlabeled directed graphs, node-labeled (but not edge-labeled) directed graphs, and between using the full information of the graphs to compute isomorphisms, namely both node and edge labels. + +Reproducing (Søgaard, 2020) Examples of the reductions needed for computing leakage for two sentences are shown in Figure 1. Now, assume that the first sentence is in the training set and the second is part of the test set. Measuring leakage without labels implies that the first dependency tree is somehow informative for producing the tree for the second sentence, which we believe is counterintuitive. Hence, our first hypothesis is that a more informed leakage calculation is going to explain + +more of the performance variance. + +We reproduce the experiments of Søgaard (2020) comparing the three different reductions (denoted as "none" for unlabeled graphs, "edges" and "nodes+edges" for respectively labeled graphs). The experiment consists of correlating the factors $\phi$ assumed to influence syntactic dependency parser performance with the performance of the parser under study. We train a simple linear regression model3 with treebank size and $\phi$ as input and parser performance as output. $\phi$ will correspond to our measure of treebank leakage. Mathematically, we have $\alpha t_{s} + \beta \phi + \gamma$ with $t_{s}$ treebank size and $\alpha, \beta, \gamma$ learned parameters. Following Søgaard, we will focus on explained variance and mean absolute error (MAE) from five-fold cross-validation to avoid overfitting. Unlike Søgaard, we will additionally report Spearman's $\rho$ correlation coefficients4 between factor and performance, which will reveal whether indeed leakage leads to better parser performance.5 + +The results on the same data as Søgaard (2020) (using the best reported parser performance from the CoNLL 2018 shared task) are presented in the top three rows of Table 1. We find that unlabeled graph leakage produces positive explained variance, in line with previous work. However, we have to reject our hypothesis, as a more informed leakage measurement fails to meaningfully explain the output variance, producing negative scores. In fact, the more information we use when computing the graph isomorphisms, the less the model can explain output variance! + +To further solidify this finding, we repeat the above experiment, this time using UDify, the state-of-the-art multilingual parser of Kondratyuk and Straka (2019). The result is shown in the bottom + +
Tree-level leakage
Leakage AttributesRegression ScoreExpl. VarianceMAESpearman's ρ
System: CoNLL'18 (Søgaard)
None0.1620.1437.257-0.194
Edges0.091-0.1218.592-0.181
Nodes+Edges0.085-0.1798.830-0.161
System: UDify
None0.2500.04713.07-0.360
Edges0.146-0.08314.012-0.080
Nodes+Edges0.134-0.10814.156-0.026
+ +
Sub-tree-level leakage
Leakage AttributesRegression ScoreExpl. VarianceMAESpearman's ρ
System: CoNLL'18 (Søgaard)
None0.054-0.1378.248-0.238
Edges0.083-1.2029.4440.390
Nodes+Edges0.089-0.2108.1970.538
System: UDify
None0.123-0.17114.632-0.082
Edges0.174-0.33314.1820.579
Nodes+Edges0.217-0.14913.7150.654
+ +Table 1: Tree-level leakage (left) does not correlate with and does not always explain parser performance. Labeled sub-tree level leakage (right) however is positively correlated with parser performance. + +
ConstructionActualProduced by model trained without nsubj modsobj mods
nsubj mods316616983167
obj mods391045051940
+ +Table 2: Number of adjectival modifiers produced by counterfactual models. The parsers can produce constructions not seen during training. + +three rows of Table 1 (left Table), and they present more negative evidence for our hypothesis: there is minimal explained variance in the unlabeled version, and still negative explained variance in the labeled leakage versions. + +Hence, we have to -for now- reject our hypothesis: using labeled graph isomorphisms to compute leakage does not explain more downstream parser performance variations, at least when using tree-level leakage measures; we revisit this hypothesis for sub-tree leakage below. Concurrently, we need to highlight the fact that for all cases we focused on this experiment, there was a negative (inverse) correlation between leakage and parser performance. + +While Søgaard (2020) was correct (for the languages/parsers they studied) to state that there is a correlation between leakage and parser performance, we believe they reached an incorrect conclusion. The metric they used (explained variance) does not reveal the direction of the correlation, just that there is a correlation. Because of this they came to the wrong conclusion that there was a positive correlation between leakage and parser performance. Our results (Table 1, left table) instead imply that as leakage increases, parser performance worsens! Clearly, something is wrong and we need to re-examine Søgaard's reasoning. + +Sub-Trees are More Meaningful Units We turn our attention to the parsers whose performance we are trying to explain. + +The three parsers that Søgaard uses and UDify are graph-based ones. This means that they do not necessarily score or produce whole trees. Graph-based parsers score pairs of words, and from these scores a minimum spanning tree is selected to produce the final dependency parse. As such, we argue that whole trees as a measure of leakage are not appropriate for graph-based parsers. + +To drive this point forward, we perform synthetic experiments removing adjectival modifiers from nominal subject or object. In particular, we created training data in which the data either did not contain adjectival modifiers on subject/object nouns. We then tested the models on gold unmodified test data which contained such modifiers. By removing adjectival modifiers only from the subjects (similarly for objects) in the training data, we ensure two things: that test instances with adjectival modifiers on subjects are not leaky; as such, if whole-tree leakage is a proper indication for parser performance, then the parser should perform poorly in producing such constructions. + +Table 2 shows the results of our experiment over the German HDT treebank. We found that the parsers trained on our counterfactual data, which have zero leakage for these test instances, still produce the local constructions that they have never observed during training. The parsers trained without training subject modifiers produced about half of the expected subject modifiers (similarly for object modifier experiments). Nevertheless, they were still able to generalize based on other similar constructions seen in training, correctly parsing a nonzero amount of unseen-in-training constructions. + +This observation is not unexpected. In the experiment above, even removing all adjectival modifiers from nouns that are subjects (hence a subtree –and + +![](images/3f888822ff58b761e55ade9c6621c1985733e202f4fbf7d6e56d1aa9729fa1fa.jpg) +Figure 2: Decomposition of a tree (top) into a set of sub-trees (bottom). + +consequently a whole tree containing it- has never been observed), the parser still observes adjective-noun modifying pairs elsewhere in the sentences and is able to generalize, producing a tree that has never been observed at training. + +The fact that the parsers make local output decisions, along with the proven corollary that they can easily produce unseen trees, guides us to search for a leakage measure focusing on sub-trees. + +Sub-Tree Based Leakage We define a leakage measure where a dependency tree is first decomposed into a set of subtrees, and then each subtree reduces into the graphs defined above to compute isomorphisms. These subtrees are created for each node (word), connecting it to its parent and to all its children. See example in Figure 2. + +We repeat our experiments, this time using our proposed leakage measure, and present the results in the right-hand side of Table 1. As before, for Søgaard's and for the UDify combinations of models/languages the explained variance is negative. However, now more information (edge/node labels) leads to higher Spearman's $\rho$ coefficients, implying that indeed the more test subtrees we have observed in training, the better the parser performance. + +In the unlabeled setting, every sub-tree created by the parser was found in the training data, which was true of most gold files as well. We interpret this observation to mean that unlabeled sub-trees are not meaningful units, a point further reinforced by the negative explained variance and correlations. + +At the same time, our measure still fails to explain any of the observed performance variance. Thus, we have to reach a conclusion opposite of Søgaard (2020), that in a monolingual setting the performance of modern graph-based parsers is not particularly explained by train-test leakage, however we compute that leakage. + +
System: UDify (Zero-Shot)Regression ScoreExpl. VarianceMAESpearman's ρ
Whole-Tree Leakage
None0.3850.26317.539-0.581
Edges0.2210.12421.460-0.493
Nodes+Edges0.2210.10621.506-0.546
Sub-Tree Leakage
Edges0.2710.21018.2450.609
Nodes+Edges0.2460.21518.0380.578
+ +Table 3: Leakage explains zero-shot parser performance. Sub-tree leakage also correlates with it. + +# 3 Leakage Explains 0-Shot Performance + +Modern dependency parsing models trained on many languages perform well on languages unseen (zero-shot setting) during training (Muller et al., 2021; Glavaš and Vulić, 2021, inter alia). + +We focus again on UDify, since it performs well in zero-shot settings. This is generally attributed to two factors: the presence of related languages in the training set, and the multilingual capabilities of the underlying representation model (here, a multilingual BERT (Devlin et al., 2019) model). + +Table 3 reports results with Søgaard's (whole-tree) and our sub-tree leakage measures under all three settings, focusing only on 35 zero-shot test languages. Now leakage can indeed explain downstream parser performance. Our proposed measure explains as much variance as the original whole-tree measure and also correlates with performance. + +Analysis on Faroese Looking deeper into the zero-shot setting, we perform an experiment on a simplified bilingual zero-shot setting. We train parsers in five Germanic languages (German, Swedish, Danish, Norwegian, Icelandic) and test on Faroese in a zero-shot fashion. For each language, we train a model on: + +(a) a 'leaky' sample of the portion of training treebank, so that all training data overlapped with (some) test data, +(b) a 'non-leaky' sample of trees such that there was no train-test overlap, +(c) a control random sample from the training treebank, and +(d) a 'diverse' training sample including a single tree from each isomorphism equivalence class. + +![](images/2acab8a430558091eec5e713d5caec82d1445233478a49cbe4fff2d92775a63c.jpg) +Figure 3: Zero-shot results on Faroe. Training on non-leaky and diverse data is best. The leaky portion of the test set is far easier than the rest. + +All of the above models are size-controlled for each language, so that the training data sizes are exactly the same. Leakage here is measured with unlabeled full-tree leakage, for simplicity. We similarly split the test set, for each language, into 'leaky' and 'non-leaky' subsets (also reporting numbers for the whole test set). + +For example, take German training and Faroese test sets. First all German instances leaking into Faroese are added to the "German leaky" train set and the corresponding leaked Faroese sentences are put into the "Faroese-leaky" test set. Then the remaining sentences from the German training set are added to the "German nonleaky" train set and the remaining sentences from the Faroese test set are the "Faroese nonleaky" test set. Last, we take a random sample of same size across all settings, so that training data size is not a confounding factor for our analysis. + +See Figure 3 and extensive results in Appendix C. For all languages, models trained on leaky data perform worse than models trained on the same amount of non-leaky or random data. For most transfer languages, in fact, training solely on non-leaky data performs better than training on other subsets! In addition, the leaky part of the testing data is clearly easier to parse in general, while the non-leaky part is more challenging. + +The models trained on perfectly 'diverse' treebanks generally perform just as good as those trained on non-leaky or randomly sampled data + +and often better on the non-leaky test set, which means they generalize better. This indicates a way to reach better cross-lingual performance without the need for large training data, as long as the training set is diverse enough. + +The large performance difference between models trained on leaky and non-leaky trees reveals that something is different about the parts of the treebanks that leak. We measured the diversity of the leaky, non-leaky, and randomly selected trees, defined as the number of unique trees divided by the total number of trees. We found that leaky treebanks were far less diverse and therefore contain fewer unique structures than non-leaky or randomly sampled counterparts. Across all treebanks, leaky instances are also generally shorter (8.4 vs 21.6 avg length), shallower (2.2 vs 4.8 average tree depth), and with shorter avg dependency length (2 vs 3.3). + +We argue that the reasoning should be reverse: short "easy" examples are more likely to leak; it is not leakage that makes them easy! + +# 4 Conclusion + +We re-evaluate claims that training-test leakage can explain parser performance, define a subtree-based leakage measure that better explains performance, and show that this claim only holds for zero-shot transfer settings. + +# Acknowledgements + +The authors express their gratitude to Djamé Sed-dah for very helpful initial discussions, and to the reviewers for their constructive feedback. The first two authors were supported in part by the NSF IIS-1757064 Undergraduate Research in Educational Data Mining grant. Antonios Anastasopoulos is also generously supported by NSF grants BCS-2109578 and IIS-2125466. + +# References + +Luigi Pietro Cordella, Pasquale Foggia, Carlo Sansone, and Mario Vento. 2001. An improved algorithm for matching large graphs. +Marie-Catherine de Marneffe, Christopher D Manning, Joakim Nivre, and Daniel Zeman. 2021. Universal dependencies. Computational linguistics, 47(2):255-308. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171-4186. +Jennifer Foster, Özlem Çetinoğlu, Joachim Wagner, Joseph Le Roux, Joakim Nivre, Deirdre Hogan, and Josef van Genabith. 2011. From news to comment: Resources and benchmarks for parsing the language of web 2.0. In Proceedings of 5th International Joint Conference on Natural Language Processing, pages 893-901, Chiang Mai, Thailand. Asian Federation of Natural Language Processing. +Goran Glavaš and Ivan Vulić. 2021. Climbing the tower of treebanks: Improving low-resource dependency parsing via hierarchical source selection. In *Findings of the Association for Computational Linguistics: ACL-IJCNLP* 2021, pages 4878-4888, Online. Association for Computational Linguistics. +Dan Kondratyuk and Milan Straka. 2019. 75 languages, 1 model: Parsing universal dependencies universally. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 2779-2795. +Ryan McDonald and Joakim Nivre. 2011. Analyzing and integrating dependency parsers. Computational Linguistics, 37(1):197-230. +Benjamin Muller, Antonios Anastasopoulos, Benoit Sagot, and Djamé Seddah. 2021. When being unseen from mBERT is just the beginning: Handling new languages with multilingual language models. + +In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 448-462, Online. Association for Computational Linguistics. +Joakim Nivre, Željko Agić, Lars Ahrenberg, Lene Antonsen, Maria Jesus Aranzabe, Masayuki Asahara, Luma Ateyah, Mohammed Attia, Aitziber Atutxa, Liesbeth Augustinus, et al. 2017. Universal dependencies 2.1. +Joakim Nivre, Johan Hall, Sandra Kübler, Ryan McDonald, Jens Nilsson, Sebastian Riedel, and Deniz Yuret. 2007. The CoNLL 2007 shared task on dependency parsing. In Proceedings of the 2007 Joint Conference on Empirical Methods in Natural Language Processing and Computational Natural Language Learning (EMNLP-CoNLL), pages 915-932, Prague, Czech Republic. Association for Computational Linguistics. +Anders Søgaard. 2020. Some languages seem easier to parse because their treebanks leak. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 2765-2770, Online. Association for Computational Linguistics. +Clara Vania, Yova Kementchedjhieva, Anders Søgaard, and Adam Lopez. 2019. A systematic comparison of methods for low-resource dependency parsing on genuinely low-resource languages. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 1105-1116, Hong Kong, China. Association for Computational Linguistics. + +# A Graph Reduction Examples + +Shown in Table 4. + +Dependency Trees: + +![](images/3368bb3d0fc0692930010ba0c7afca97461a047d515c325fa68ad3884e02589c.jpg) + +![](images/080e9b40350848cc928fdf497aecff9c3008423c9cb0211b8d29439782a4e0b3.jpg) + +Søgaard (2020) Unlabeled Directed Graphs: + +![](images/d07e420059f1064cf2d6addf4b96f4378781b263952c686eb6d23fecdb53ec02.jpg) + +![](images/aabf0f12f0be0b08ac79184025d9af887023b647e18bceb2dc879c36e375be06.jpg) + +Node-Labeled Directed Graphs: + +![](images/36e6fbfdbe37a673233603175779369af94ccb4b312312dd96a31208d50fc953.jpg) + +![](images/768c1d2f7a61960941ae5721855aa242798a1989afc4f72af4b7d48c3a26c723.jpg) + +Node- and Edge-Labeled Directed Graphs: + +![](images/8bc009d5edd5ced3aab7a6ad5276d8bbd9bafd2c1d3fdd83cfe1d61b995aafcc.jpg) +Figure 4: Only labeled reductions produce different graphs for these fundamentally different sentences. + +![](images/6225ef09393c5813bd7841df0a0e8b68473fda0fef7ed4b7e3f0eefe08486e7b.jpg) + +# B English Counterfactual Experiments + +Shown in Table 4. + +
ConstructionActualProduced by model trained without nsubj modsobj mods
German HDT treebank:
nsubj mods316616983167
obj mods391045051940
English EWT treebank:
nsubj mods132122130
obj mods254258237
+ +Table 4: Number of adjectival modifiers produced by counterfactual models compared to the actual number in the gold file. The parsers can produce constructions not seen during training. + +# C Complete Faroese Results + +Shown in Tables 5. + +
TrainTestUASLASCLASMLASBLEX
Faroese-leakyFaroese-leaky78.4866.2455.651.2655.6
Faroese-nonleaky53.2242.1928.3922.628.39
Faroese-all53.9142.8529.1923.4329.19
Faroese-nonleakyFaroese-leaky97.8994.5190.6590.6590.65
Faroese-nonleaky88.1584.7578.6675.9878.66
Faroese-all88.4285.0279.0176.4179.01
Faroese-allFaroese-leaky97.4793.6790.3288.1790.32
Faroese-nonleaky8985.3679.0276.5679.02
Faroese-all89.2385.5979.3576.979.35
Faroese-diverseFaroese-leaky96.6292.4189.6185.389.61
Faroese-nonleaky89.2785.5679.6677.279.66
Faroese-all89.4785.7579.9577.4379.95
German-leakyFaroese-leaky57.4941.234334.8943
Faroese-nonleaky32.5318.2416.2412.5716.24
Faroese-all35.2520.7419.2715.119.27
German-nonleakyFaroese-leaky64.0847.1851.4340.8651.43
Faroese-nonleaky52.0735.4335.1427.0935.14
Faroese-all53.3836.7136.9828.6536.98
German-allFaroese-leaky57.3931.2436.8425.8236.84
Faroese-nonleaky45.8123.5925.0319.8125.03
Faroese-all47.0724.4226.3620.4926.36
German-diverseFaroese-leaky58.0242.5148.9429.7348.94
Faroese-nonleaky48.9533.434.2623.634.26
Faroese-all49.9434.3935.924.2935.9
Afrikaans-leakyFaroese-leaky46.5120.4724.9111.7224.91
Faroese-nonleaky27.197.497.043.887.04
Faroese-all27.677.817.544.17.54
Afrikaans-nonleakyFaroese-leaky47.4416.287.435.577.43
Faroese-nonleaky39.7815.996.965.476.96
Faroese-all39.97166.975.476.97
Afrikaans-allFaroese-leaky45.5817.2122.810.4222.8
Faroese-nonleaky40.5116.3410.035.8210.03
Faroese-all40.6416.3610.375.9410.37
Afrikaans-diverseFaroese-leaky38.616.7413.049.9413.04
Faroese-nonleaky36.1816.348.136.488.13
Faroese-all36.2416.358.266.578.26
Danish-leakyFaroese-leaky71.3353.8555.7347.8355.73
Faroese-nonleaky49.8635.9734.7427.3134.74
Faroese-all50.9336.8635.8628.4135.86
Danish-nonleakyFaroese-leaky73.4360.3765.0557.3765.05
Faroese-nonleaky64.152.2647.8542.1247.85
Faroese-all64.5752.6648.7742.9448.77
Danish-allFaroese-leaky69.4659.2164.0854.6964.08
Faroese-nonleaky62.5251.6348.3442.1248.34
Faroese-all62.865249.1842.7949.18
Danish-diverseFaroese-leaky68.5357.3462.7552.2362.75
Faroese-nonleaky62.9251.1348.341.8248.3
Faroese-all63.251.4349.0842.3849.08
Icelandic-leakyFaroese-leaky88.0780.9774.169.5474.1
Faroese-nonleaky72.7765.7853.7850.2653.78
Faroese-all74.0267.0255.5451.9355.54
Icelandic-nonleakyFaroese-leaky93.3289.4984.7583.5584.75
Faroese-nonleaky84.1879.2170.5467.570.54
Faroese-all84.9380.0471.7768.971.77
Icelandic-allFaroese-leaky91.0587.6482.9380.5382.93
Faroese-nonleaky84.2779.9771.3668.4971.36
Faroese-all84.8280.672.3769.5472.37
Icelandic-diverseFaroese-leaky91.7687.3682.0780.3982.07
Faroese-nonleaky84.8980.4972.769.8872.7
Faroese-all85.4581.0573.5170.7973.51
Norwegian-leakyFaroese-leaky72.4661.4165.5361.865.53
Faroese-nonleaky52.7843.4836.0932.236.09
Faroese-all54.0444.6238.0934.2138.09
Norwegian-nonleakyFaroese-leaky73.0162.567.3962.4267.39
Faroese-nonleaky59.3749.594743.1947
Faroese-all60.2450.4248.444.5148.4
Norwegian-allFaroese-leaky73.0161.5965.5459.6965.54
Faroese-nonleaky61.1249.4945.6442.4645.64
Faroese-all61.8850.2747.0143.6447.01
Norwegian-diverseFaroese-leaky70.8362.8667.0862.1167.08
Faroese-nonleaky61.1251.348.7145.0448.71
Faroese-all61.7452.0449.9646.2149.96
Swedish-leakyFaroese-leaky60.5832.7538.8127.2938.81
Faroese-nonleaky42.9215.4417.4414.7217.44
Faroese-all43.6316.1318.3315.2418.33
Swedish-nonleakyFaroese-leaky75.0761.7464.2258.3364.22
Faroese-nonleaky57.2241.8738.7733.3738.77
Faroese-all57.9442.6739.8334.4139.83
Swedish-allFaroese-leaky68.9955.0757.3549.7657.35
Faroese-nonleaky49.9534.8531.826.7931.8
Faroese-all50.7135.6532.8627.7432.86
Swedish-diverseFaroese-leaky55.3644.0646.0430.6946.04
Faroese-nonleaky40.1529.3422.8418.0622.84
Faroese-all40.7629.9323.8218.5923.
+ +Table 5: Results of our experiment on bilingual transfer for Faroese. \ No newline at end of file diff --git a/revisitingtheeffectsofleakageondependencyparsing/images.zip b/revisitingtheeffectsofleakageondependencyparsing/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..7a7a0e40361c0f85892c619181c8820be560f5cc --- /dev/null +++ b/revisitingtheeffectsofleakageondependencyparsing/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:15bd23cb07ace6f6e0c9116b3a9d7c48fb63485ac5dc46c9a95dc27e4504442d +size 889551 diff --git a/revisitingtheeffectsofleakageondependencyparsing/layout.json b/revisitingtheeffectsofleakageondependencyparsing/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..a7cf4b19240106b921dd79dbe244d4062a048054 --- /dev/null +++ b/revisitingtheeffectsofleakageondependencyparsing/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e627b838413a1095b2818c8c994a848b3fd13783821cf5ab09e88b35872f5085 +size 228446 diff --git a/revisitinguncertaintybasedquerystrategiesforactivelearningwithtransformers/cfedfc96-e6c1-42ba-bc7c-7922f85c1d74_content_list.json b/revisitinguncertaintybasedquerystrategiesforactivelearningwithtransformers/cfedfc96-e6c1-42ba-bc7c-7922f85c1d74_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..059e058bc485b5bcee2354f2ce0e9740da7b187f --- /dev/null +++ b/revisitinguncertaintybasedquerystrategiesforactivelearningwithtransformers/cfedfc96-e6c1-42ba-bc7c-7922f85c1d74_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aac9ec8c0dc565955a0411b1fffb3420131c247adb28e03f544de383fee4220a +size 73883 diff --git a/revisitinguncertaintybasedquerystrategiesforactivelearningwithtransformers/cfedfc96-e6c1-42ba-bc7c-7922f85c1d74_model.json b/revisitinguncertaintybasedquerystrategiesforactivelearningwithtransformers/cfedfc96-e6c1-42ba-bc7c-7922f85c1d74_model.json new file mode 100644 index 0000000000000000000000000000000000000000..3a76ff82f16914c1bd91998cc5cc7ef78a611a1c --- /dev/null +++ b/revisitinguncertaintybasedquerystrategiesforactivelearningwithtransformers/cfedfc96-e6c1-42ba-bc7c-7922f85c1d74_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ac0ce227a7c824e6c5ff5df24a99031019d5159487c80321e1a199b098810eaa +size 87812 diff --git a/revisitinguncertaintybasedquerystrategiesforactivelearningwithtransformers/cfedfc96-e6c1-42ba-bc7c-7922f85c1d74_origin.pdf b/revisitinguncertaintybasedquerystrategiesforactivelearningwithtransformers/cfedfc96-e6c1-42ba-bc7c-7922f85c1d74_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..c5228970e334171d00746082f52bd2afa64287f7 --- /dev/null +++ b/revisitinguncertaintybasedquerystrategiesforactivelearningwithtransformers/cfedfc96-e6c1-42ba-bc7c-7922f85c1d74_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6357a3c9062db51000d331027b39c2c67678779c0696b5a3108a2284a2a842dc +size 734338 diff --git a/revisitinguncertaintybasedquerystrategiesforactivelearningwithtransformers/full.md b/revisitinguncertaintybasedquerystrategiesforactivelearningwithtransformers/full.md new file mode 100644 index 0000000000000000000000000000000000000000..e058fe4a1b4aced883dda0374c96c15bf2e4ffbb --- /dev/null +++ b/revisitinguncertaintybasedquerystrategiesforactivelearningwithtransformers/full.md @@ -0,0 +1,264 @@ +# Revisiting Uncertainty-based Query Strategies for Active Learning with Transformers + +Christopher Schröder, Andreas Niekler, and Martin Potthast + +Leipzig University + +# Abstract + +Active learning is the iterative construction of a classification model through targeted labeling, enabling significant labeling cost savings. As most research on active learning has been carried out before transformer-based language models ("transformers") became popular, despite its practical importance, comparably few papers have investigated how transformers can be combined with active learning to date. This can be attributed to the fact that using state-of-the-art query strategies for transformers induces a prohibitive runtime overhead, which effectively nullifies, or even outweighs the desired cost savings. For this reason, we revisit uncertainty-based query strategies, which had been largely outperformed before, but are particularly suited in the context of fine-tuning transformers. In an extensive evaluation, we connect transformers to experiments from previous research, assessing their performance on five widely used text classification benchmarks. For active learning with transformers, several other uncertainty-based approaches outperform the well-known prediction entropy query strategy, thereby challenging its status as most popular uncertainty baseline in active learning for text classification. + +# 1 Introduction + +Collecting labeled data for machine learning can be costly and time-consuming. A key technique to minimize labeling costs has been active learning, where an oracle (e.g., a human expert) is queried to label problem instances selected that are deemed to be most informative to the learning algorithm's next iteration according to a query strategy. + +Active learning is characterized by the real-world machine learning scenario in which large amounts of training data are unavailable, which may explain why comparably little research has investigated deep learning in this context. The recent widely successful transformer-based language models can circumvent the limitations imposed by + +small training datasets (Vaswani et al., 2017; Devlin et al., 2019). Pre-trained on large amounts of unlabeled text, they can be fine-tuned to a given task using far less training data than when trained from scratch. However, their high number of model parameters renders them computationally highly expensive, for query strategies that are targeted at neural networks or text classification (Settles et al., 2007; Zhang et al., 2017), resulting in prohibitive turnaround times between labeling steps. + +In this paper, we systematically investigate uncertainty-based query strategies as a computationally inexpensive alternative. Despite their relative disadvantages in traditional active learning, when paired with transformers, they are highly effective as well as efficient. Our extensive experiments assess a multitude of combinations including state-of-the-art transformer models BERT (Devlin et al., 2019) and DistilRoBERTa (Sanh et al., 2019), five well-known sentence classification benchmarks, and five query strategies. + +# 2 Related Work + +Uncertainty-based query strategies used to be the most common choice in active learning, using uncertainty scores obtained from the learning algorithm (Lewis and Gale, 1994), estimates obtained via ensembles (Krogh and Vedelsby, 1994; RayChaudhuri and Hamey, 1995), or prediction entropy (Perona et al., 2008). More recently—predating transformers—neural network-based active learning predominantly employed query strategies that select problem instances according to (1) the magnitude of their backpropagation-induced gradients (Settles et al., 2007; Zhang et al., 2017), where instances causing a high-magnitude gradient inform the model better, and (2) representativity-based criteria (e.g., coresets (Sener and Savarese, 2018)), which select instances from a vector space to geometrically represent the full dataset. + +For today's deep neural networks, ensembles are too computationally expensive, and prediction entropy has been observed to be overconfident (Guo et al., 2017; Lakshminarayanan et al., 2017). The exception are flat architectures, where, among others, Prabhu et al. (2019) showed fastText (Joulin et al., 2017) to be effective, well-calibrated, and computationally efficient. Prior to transformers, query strategies relying on expected gradient length (Settles et al., 2007) achieved the best results on many active learning benchmarks for text classification (Zhang et al., 2017). Gradients depend on the current model, which means, when used for a query strategy, they scale with the vast number of a transformer's parameters, and moreover, they need to be computed per-instance instead of batch-wise, thereby becoming computationally expensive. + +The cost of ensembles, the adverse scaling of network parameters in gradient-based strategies, and a history of deeming neural networks to be overconfident effectively rule out the most predominantly used query strategies. This might explain why transformers, despite the success of fine-tuning them for text classification (Howard and Ruder, 2018; Yang et al., 2019; Sun et al., 2019), have only very recently been considered at all in combination with active learning (Lu and MacNamee, 2020; Yuan et al., 2020; Ein-Dor et al., 2020; Margatina et al., 2021). All of the related works mitigate the computationally complex query strategies by subsampling the unlabeled data before querying (Lu and MacNamee, 2020; Ein-Dor et al., 2020; Margatina et al., 2021), by performing fewer queries with larger sample sizes (Yuan et al., 2020; Margatina et al., 2021), or by tailoring to less expensive settings, namely binary classification (Ein-Dor et al., 2020). Subsampling, however, introduces additional randomness which can aggravate comparability across experiments, and large sample sizes increase the amount of labeled data, which is contrary to minimizing the labeling effort. + +Due to this computationally challenging setting, the uncertainty-based prediction entropy query strategy (Roy and McCallum, 2001; Schohn and Cohn, 2000) is therefore a frequently used baseline and a lowest common denominator in recent work on active learning for text classification (Zhang et al., 2017; Lowell et al., 2019; Prabhu et al., 2019; Ein-Dor et al., 2020; Lu and MacNamee, 2020; Yuan et al., 2020; Margatina et al., 2021; Zhang and Plank, 2021). Apart from being employed as base- + +lines, uncertainty-based query strategies have not been systematically analyzed in conjunction with transformers, and moreover, comparisons to the previous benchmarks by Zhang et al. (2017) have been omitted by the aforementioned related work. Our work not only closes this gap, but also reevaluates the relative strength of uncertainty-based approaches, including two recently largely neglected strategies, thereby challenging the status of prediction entropy as the most popular baseline. + +# 3 Transformer-based Active Learning + +The goal of active learning is to minimize the labeling costs of training data acquisition while maximizing a model's performance (increase) with each newly labeled problem instance. In contrast to regular supervised text classification ("passive learning"), it operates iteratively, where in each iteration (1) a so-called query strategy selects new instances for labeling according to an estimation of their informativeness, (2) an oracle (e.g., a human expert) provides the respective label, and (3) a learning algorithm either uses the newly labeled instance for its next learning step, or a model is retrained from scratch using all previously labeled instances. This work considers pool-based active learning (Lewis and Gale, 1994), where the query strategies have access to all unlabeled data. Notation-wise, we denote instances by $x_{1}, x_{2}, \ldots, x_{n}$ , the number of classes by $c$ , the respective label for instance $x_{i}$ by $y_{i}$ (where $\forall i: y_{i} \in \{1, \ldots, c\}$ ), and $P(y_{i} | x_{i})$ is a probability-like predicted class distribution. + +Query Strategies We consider three well-known uncertainty-based query strategies, one recent state-of-the-art strategy that coincidentally also includes uncertainty, and a random baseline: + +(1) Prediction Entropy (PE; Roy and McCallum, 2001; Schohn and Cohn, 2000) selects instances with the highest entropy in the predicted label distribution with the aim to reduce overall entropy: + +$$ +\underset {x _ {i}} {\operatorname {a r g m a x}} \left[ - \sum_ {j = 1} ^ {c} P (y _ {i} = j | x _ {i}) \log P (y _ {i} = j | x _ {i}) \right] +$$ + +(2) Breaking Ties (BT; Scheffer et al., 2001; Luo et al., 2005) takes instances with the minimum margin between the top two most likely probabilities: + +$$ +\underset {x _ {i}} {\operatorname {a r g m i n}} \left[ P (y _ {i} = k _ {1} ^ {*} | x _ {i}) - P (y _ {i} = k _ {2} ^ {*} | x _ {i}) \right] +$$ + +where $k_{1}^{*}$ is the most likely label in the posterior class distribution $P(y_{i}|x_{i})$ , and $k_{2}^{*}$ the second most + +
Dataset Name (ID)TypeClassesTrainingTest
AG's News (AGN)N4120,000 (*)7,600
Customer Reviews (CR)S23,397378
Movie Reviews (MR)S29,5961,066
Subjectivity (SUBJ)S29,0001,000
TREC-6 (TREC-6)Q65,500(*) 500
+ +likely label respectively. In the binary case, this margin is small iff the label entropy is high, which is why BT and PE then select the same instances. + +(3) Least Confidence (LC; Culotta and McCallum, 2005) selects instances whose most likely label has the least confidence according to the current model: + +$$ +\underset {x _ {i}} {\operatorname {a r g m a x}} \left[ 1 - P (y _ {i} = k _ {1} ^ {*} | x _ {i}) \right] +$$ + +(4) Contrastive Active Learning (CA; Margatina et al., 2021) selects instances with the maximum mean Kullback-Leibler (KL) divergence between the predicted class distributions ("probabilities") of an instance and each of its $m$ nearest neighbors: + +$$ +\underset {x _ {i}} {\operatorname {a r g m a x}} \left[ \frac {1}{m} \sum_ {j = 1} ^ {m} \mathrm {K L} (P (y _ {j} | x _ {j} ^ {k n n}) \parallel P (y _ {i} | x _ {i})) \right] +$$ + +where the instances $x_{j}^{knn}$ are the $m$ nearest neighbors of instance $x_{i}$ . + +(5) Random Sampling (RS), a commonly used baseline, draws uniformly from the unlabeled pool. + +Oracle The oracle is usually operationalized using the training datasets of existing benchmarks: To ensure comparability with the literature, we pick important standard text classification tasks. + +Classification We fine-tune BERT (Devlin et al., 2019) and DistilRoBERTa (Sanh et al., 2019) on several natural language understanding datasets. BERT is well-researched as transformer and has recently also shown strong results in active learning (Yuan et al., 2020; Ein-Dor et al., 2020; Margatina et al., 2021). The model consists of 24 layers, hidden units of size 1024 and 336M parameters in total. DistilRoBERTa, by contrast, is a more parameter-efficient alternative which has merely six layers, hidden units of size 768, and 82M parameters. We also trained a passive model on the full data. + +The classification model consists of the respective transformer, on top of which we add a fully + +Table 1: Key information about the examined datasets. The dataset type was abbreviated as follows: N: News, S: Sentiment, Q: Questions. $(^{*})$ : Predefined test sets were available and adopted. + +
ModelStrategyMean RankMean Result
Acc.AUCAcc.AUC
SVMPE1.802.600.7640.663
BT1.601.600.7670.697
LC3.002.600.7510.672
CA5.005.000.6670.593
RS3.002.600.7570.686
KimCNNPE1.602.400.8180.742
BT1.602.000.8180.750
LC3.802.800.8100.732
CA3.804.800.7930.711
RS3.602.400.8040.749
D.RoBERTaPE2.603.000.9010.856
BT2.201.800.9020.864
LC1.402.000.9040.860
CA3.003.400.9010.852
RS5.004.200.8840.853
BERTPE2.402.400.9090.859
BT2.001.600.9140.873
LC2.203.800.9170.866
CA2.802.600.9160.872
RS5.004.000.8990.861
+ +Table 2: The "Mean Rank" columns show the mean rank when ordered by mean accuracy (Acc.) after the final iteration and by overall AUC. The "Mean Result" columns show the mean accuracy and AUC. + +connected projection layer, and a final softmax output layer. We use the “[CLS)” token that is computed by the transformer as sentence representation. Regarding fine-tuning, we adopt the combination of discriminative fine-tuning and slanted triangular learning rates (Howard and Ruder, 2018). The main active learning routine is then as follows: (1) The query strategy, either using the model from the previous iteration, or sampling randomly, selects 25 instances from the unlabeled pool. (2) The oracle provides labels for these instances. (3) The next model is trained using all data labeled so far. + +Baselines For comparison, we consider a linear SVM, and KimCNN (Kim, 2014), which have been used extensively in text classification, disregarding active learning. We adopted the KimCNN parameters from Kim (2014) and Zhang et al. (2017). + +# 4 Evaluation + +We evaluate five query strategies in combination with BERT, DistilRoBERTa and two baselines. + +Datasets and Experimental Setup In Table 1, we show the five datasets employed, which have previously been used to evaluate active learning: AG's News (AGN; Zhang et al., 2015), Customer Reviews (CR; Hu and Liu, 2004), Movie Reviews + +![](images/834fb69c1e6f70901f926d0d2f8862e93b9b59e2df5b127bb28c71b3c695f472.jpg) + +![](images/db80e7f55216ddde17ebc1cc87ef871fbd0bdf6bf5cd27759dc7a175e93a859f.jpg) + +![](images/ac7363fe2496a17e6a451edb07d1c168ca96b5c4de5cd0cb5dd71d64f1a3a8de.jpg) + +![](images/1d6861de3d1a5cdf6855d898a867d5fa6c2c9298a0c77bededcff3f404ff291b.jpg) + +![](images/1be71a4b5f1db5321e2780b8a2c862e3ac5e62095b53a68d86d146919bf7b944.jpg) +Number of Instances + +![](images/d59e79e4be1fc0cc3d9a7554bdeccaad819ab07166ba61de46c2b1388103a596.jpg) +Figure 1: Active learning curves of BERT and DistilRoBERTa when combined with five query strategies: Prediction Entropy (PE), Breaking Ties (BT), Least Confidence (LC), Contrastive Active Learning (CA), and Random Sampling (RS). The tubes around the lines represent standard deviation over five runs. For comparison, the horizontal line depicts a passive text classification for which BERT has been trained using the entire training set. + +(MR; Pang and Lee, 2005), Subjectivity (SUBJ; Pang and Lee, 2004), and TREC-6 (Li and Roth, 2002). These datasets encompass binary and multiclass classification in different domains, and they are class-balanced, except for TREC-6. Where available, we employed the pre-existing test sets, or otherwise a random sample of $10\%$ . + +We follow the experiment setup of Zhang et al. (2017): 25 training instances are used to train the first model, followed by 20 active learning iterations, during each of which 25 instances are queried and labeled. Using $10\%$ of the so far labeled data as validation set, we stop early (Duong et al., 2018) when accuracy surpasses $98\%$ , or the validation loss does not increase for five epochs. + +Results For each combination of dataset, model, and query strategy, Figure 1 shows the respective learning curves. The horizontal line shows the best model's score when trained on the full dataset, which four out of five datasets approach very closely, or even exceed. As expected, BERT generally achieves steeper learning curves than DistilRoBERTa, but surprisingly, during later iterations DistilRoBERTa reaches scores only slightly worse than BERT for all datasets except MR. Regarding query strategies, RS is a strong contender during early iterations, e.g., as can be seen for the + +
DatasetModelStrategyAcc.Data Use
AGNBERTBT0.9040.4%
BERTpassive (ours)0.946100.00%
XLNet1passive0.955100.00%
CRBERTLC0.91915.45%
BERTpassive (ours)0.925100.00%
HAC2passive0.889100.00%
MRBERTPE, BT0.8570.547%
BERTpassive (ours)0.893100.00%
SimCSE3passive0.884100.00%
SUBJBERTLC0.9585.83%
BERTpassive (ours)0.969100.00%
AdaSent4passive0.955100.00%
TREC-6BERTCA0.9689.55%
BERTpassive (ours)0.958100.00%
RCNN5passive0.962100.00%
+ +Table 3: Best final accuracy compared to (our) passive classification and state-of-the-art text classification: ${}^{1}$ Yang et al. (2019), ${}^{2}$ Zheng et al. (2019), ${}^{3}$ Gao et al. (2021), ${}^{4}$ Zhao et al. (2015), ${}^{5}$ Tay et al. (2018). "Data Use" indicates proportion of training data used. + +first few iterations of CR. This is partly because all but one of the datasets are balanced, but nevertheless, RS is eventually outperformed by the other strategies in most cases. For imbalanced datasets, Ein-Dor et al. (2020) have shown RS to be less effective, which we can confirm for TREC-6. While in terms of area under the learning curve (AUC) + +there seems to be no overall best strategy, PE/BT and CA often show very steep learning curves. + +In Table 2, we rank the query strategies by their average accuracy and AUC results, ranging from 1 (best) to 5 (worst). We also report their average accuracy and AUC per model and query strategy. Surprisingly, we can see that PE, a commonly used and proven to be strong baseline, which has been a lowest common denominator in recent work on active learning for text classification (Zhang et al., 2017; Lowell et al., 2019; Prabhu et al., 2019; Ein-Dor et al., 2020; Lu and MacNamee, 2020; Yuan et al., 2020; Margatina et al., 2021; Zhang and Plank, 2021), is on average outranked by BT when using transformers. BT achieves the best AUC ranks and scores, and in many cases also the best accuracy ranks and scores. It seems to be similarly effective on the baselines as well. Moreover, LC also outperforms PE for DistilRoBERTa where it even competes with BT. Detailed accuracy and AUC scores including standard deviations are reported in Appendix Tables 5 & 7. + +Table 3 compares the best model trained via active learning per dataset against passive text classification, namely (1) our own model trained on the full training set, and (2) state-of-the-art results. The largest discrepancy between active learning and passive text classification is observed on AGN, which is also the largest dataset from which the active learning models use less than $1\%$ for training. Otherwise, all models are close to or even surpass the state of the art, using only between $0.4\%$ and $14\%$ of the data. Noteworthy, LC achieves the best accuracy result for two datasets, while the strong baseline PE and the state-of-the-art approach CA perform best on only one dataset each. + +In Table 4, we report the best AUC scores per dataset, and compare them to previous work. BT ranks highest in two out of three cases with CA achieving the best result on the remaining two datasets. BERT achieves the best AUC scores on all datasets with a considerable increase in AUC compared to Zhang et al. (2017). + +In summary, we use recent transformer models in combination with several query strategies to evaluate a previously established but lately neglected benchmark. We find that the PE baseline is outperformed by BT, which, as a reminder, selects the same instances as PE for binary classification, but shows superior results on multi-class datasets. We conclude that BT, which even out + +
DatasetModelAUC
AGNBERT (BT, ours)0.875
-
CRBERT (PE, BT; ours)0.877
CNN60.743
MRBERT (PE, BT; ours)0.833
CNN60.707
SUBJBERT (CA, ours)0.943
CNN60.856
TREC-6BERT (CA, ours)0.868
-
+ +Table 4: Best area under curve (AUC) scores (averaged over five runs) compared to Zhang et al. (2017). + +performs the state-of-the-art strategy CA in many cases, is therefore a strong contender to become the new default uncertainty-based baseline. Finally, DistilRoBERTa, using less than $25\%$ of BERT's parameters, achieves results that are remarkably close to BERT at only a fraction of the overhead. Considering the computational burdens that motivated this work, this increase in efficiency is often preferable from a practitioner's perspective. + +# 5 Conclusions + +An investigation of the effectiveness of uncertainty-based query strategies in combination with BERT and DistilRoBERTa for active learning on several sentence classification datasets shows that uncertainty-based strategies still perform well. We evaluate five query strategies on an established benchmark, for which we achieve results close to state-of-the-art text classification on four out of five datasets, using only a small fraction of the training data. Contrary to current literature, prediction entropy, the supposedly strongest uncertainty-based baseline, is outperformed by several uncertainty-based strategies on this benchmark—in particularly by the breaking ties strategy. This invalidates the common practice of solely relying on prediction entropy as baseline, and shows that uncertainty-based strategies demand renewed attention especially in the context of transformer-based active learning. + +# Acknowledgments + +We thank the anonymous reviewers for their valuable and constructive feedback. This research was partially funded by the Development Bank of Saxony (SAB) under project number 100335729. + +# Ethical Considerations + +Research on active learning improves the labeling of data, by efficiently supporting the learning algorithm with targeted information, so that overall less data has to be labeled. This could contribute to creating machine learning models, which would otherwise be infeasible, either due to limited budget, or time. Active learning can be used for good or bad, and our contributions would—in both cases—show how to make this process more efficient. + +Moreover, we use pre-trained models, which can contain one or more types of bias. Bias, however, affects all approaches based on fine-tuning pretrained language models, but therefore this has to be kept in mind and mitigated all the more. + +# References + +Aron Culotta and Andrew McCallum. 2005. Reducing labeling effort for structured prediction tasks. In Proceedings of the 20th National Conference on Artificial Intelligence, pages 746-751. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics (NAACL), pages 4171-4186. +Long Duong, Hadi Afshar, Dominique Estival, Glen Pink, Philip Cohen, and Mark Johnson. 2018. Active learning for deep semantic parsing. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (ACL), pages 43-48. +Liat Ein-Dor, Alon Halfon, Ariel Gera, Eyal Shnarch, Lena Dankin, Leshem Choshen, Marina Danilevsky, Ranit Aharonov, Yoav Katz, and Noam Slonim. 2020. Active Learning for BERT: An Empirical Study. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 7949-7962. +Tianyu Gao, Xingcheng Yao, and Danqi Chen. 2021. SimCSE: Simple contrastive learning of sentence embeddings. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 6894-6910. +Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q. Weinberger. 2017. On calibration of modern neural networks. In Proceedings of the 34th International Conference on Machine Learning (ICML), pages 1321-1330. +Jeremy Howard and Sebastian Ruder. 2018. Universal language model fine-tuning for text classification. In + +Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (ACL), pages 328-339. +Minqing Hu and Bing Liu. 2004. Mining and summarizing customer reviews. In Proceedings of the Tenth ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pages 168-177. +Armand Joulin, Edouard Grave, Piotr Bojanowski, and Tomas Mikolov. 2017. Bag of tricks for efficient text classification. In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics (EACL), pages 427-431. +Yoon Kim. 2014. Convolutional neural networks for sentence classification. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 1746-1751. +Anders Krogh and Jesper Vedelsby. 1994. Neural network ensembles, cross validation and active learning. In Proceedings of the 7th International Conference on Neural Information Processing Systems (NIPS), pages 231-238. +Balaji Lakshminarayanan, Alexander Pritzel, and Charles Blundell. 2017. Simple and scalable predictive uncertainty estimation using deep ensembles. In Proceedings of the 31st International Conference on Neural Information Processing Systems (NIPS), pages 6405-6416. +David D. Lewis and William A. Gale. 1994. A sequential algorithm for training text classifiers. In Proceedings of the 17th Annual International ACM SIGIR Conference on Research and Development in Information Retrieval, pages 3-12. +Xin Li and Dan Roth. 2002. Learning question classifiers. In Proceedings of the 19th International Conference on Computational Linguistics (COLING), pages 1-7. +David Lowell, Zachary C. Lipton, and Byron C. Wallace. 2019. Practical obstacles to deploying active learning. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 21-30. +Jinghui Lu and Brian MacNamee. 2020. Investigating the effectiveness of representations based on pretrained transformer-based language models in active learning for labelling text datasets. arXiv preprint arXiv:2004.13138. +Tong Luo, Kurt Kramer, Dmitry B. Goldgof, Lawrence O. Hall, Scott Samson, Andrew Remsen, and Thomas Hopkins. 2005. Active learning to recognize multiple types of plankton. Journal of Machine Learning Research (JMLR), 6:589-613. + +Katerina Margatina, Giorgos Vernikos, Loic Barrault, and Nikolaos Aletras. 2021. Active learning by acquiring contrastive examples. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 650-663. +Bo Pang and Lillian Lee. 2004. A sentimental education: Sentiment analysis using subjectivity summarization based on minimum cuts. In Proceedings of the 42nd Annual Meeting of the Association for Computational Linguistics (ACL), pages 271-278. +Bo Pang and Lillian Lee. 2005. Seeing stars: Exploiting class relationships for sentiment categorization with respect to rating scales. In Proceedings of the 43rd Annual Meeting of the Association for Computational Linguistics (ACL), pages 115-124. +P. Perona, A. Holub, and M. C. Burl. 2008. Entropy-based active learning for object recognition. In Proceedings of the 2008 IEEE Computer Society Conference on Computer Vision and Pattern Recognition Workshops (CVPR Workshops), pages 1-8. +Ameya Prabhu, Charles Dognin, and Maneesh Singh. 2019. Sampling bias in deep active classification: An empirical study. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 4058-4068. +Tirthankar RayChaudhuri and Leonard G. C. Hamey. 1995. Minimisation of data collection by active learning. In Proceedings of International Conference on Neural Networks (ICNN), pages 1338-1341. +Nicholas Roy and Andrew McCallum. 2001. Toward optimal active learning through sampling estimation of error reduction. In Proceedings of the Eighteenth International Conference on Machine Learning (ICML), pages 441-448. +Victor Sanh, Lysandre Debut, Julien Chaumond, and Thomas Wolf. 2019. Distilbert, a distilled version of bert: smaller, faster, cheaper and lighter. arXiv preprint arXiv:1910.01108. +Tobias Scheffer, Christian Decomain, and Stefan Wrobel. 2001. Active hidden markov models for information extraction. In Proceedings of the 4th International Conference on Advances in Intelligent Data Analysis (IDA), pages 309-318. +Greg Schohn and David Cohn. 2000. Less is more: Active learning with support vector machines. In Proceedings of the Seventeenth International Conference on Machine Learning (ICML), pages 839-846. +Ozan Sener and Silvio Savarese. 2018. Active learning for convolutional neural networks: A core-set approach. In Proceedings of the 6th International Conference on Learning Representations (ICLR). + +Burr Settles, Mark Craven, and Soumya Ray. 2007. Multiple-instance active learning. In Proceedings of the 20th International Conference on Neural Information Processing Systems (NIPS), pages 1289-1296. +Chi Sun, Xipeng Qiu, Yige Xu, and Xuanjing Huang. 2019. How to fine-tune BERT for text classification? In Chinese Computational Linguistics - 18th China National Conference (CCL), pages 194-206. +Yi Tay, Anh Tuan Luu, and Siu Cheung Hui. 2018. Recurrently controlled recurrent networks. In Proceedings of the Advances in Neural Information Processing Systems 31 (NeurIPS), pages 4731-4743. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, editors, Proceedings of the Advances in Neural Information Processing Systems 30 (NeurIPS), pages 5998-6008. +Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, and Quoc V. Salakhutdinov, Russ R a. nd Le. 2019. Xlnet: Generalized autoregressive pretraining for language understanding. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett, editors, Proceedings of the Advances in Neural Information Processing Systems 32 (NeurIPS), pages 5753-5763. +Michelle Yuan, Hsuan-Tien Lin, and Jordan Boyd-Graber. 2020. Cold-start active learning through self-supervised language modeling. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 7935-7948. +Mike Zhang and Barbara Plank. 2021. Cartography active learning. In Findings of the Association for Computational Linguistics (EMNLP Findings), pages 395-406. +Xiang Zhang, Junbo Zhao, and Yann LeCun. 2015. Character-level convolutional networks for text classification. In C. Cortes, N. D. Lawrence, D. D. Lee, M. Sugiyama, and R. Garnett, editors, Proceedings of the Advances in Neural Information Processing Systems 28 (NIPS), pages 649-657. +Ye Zhang, Matthew Lease, and Byron C. Wallace. 2017. Active discriminative text representation learning. In Proceedings of the Thirty-First AAAI Conference on Artificial Intelligence, pages 3386-3392. +Han Zhao, Zhengdong Lu, and Pascal Poupart. 2015. Self-adaptive hierarchical sentence model. In Proceedings of the 24th International Conference on Artificial Intelligence, pages 4069-4076. + +Wanshan Zheng, Zibin Zheng, Hai Wan, and Chuan Chen. 2019. Dynamically route hierarchical structure representation to attentive capsule for text classification. In Proceedings of the Twenty-Eighth International Joint Conference on Artificial Intelligence (IJCAI), pages 5464-5470. + +# Supplementary Material + +The experiments can be reproduced using the code that is referenced on the first page2. In the following, we summarize important details for reproduction, including details on the results. + +# A Technical Environment + +All experiments were conducted within a Python 3.8 environment. The system had CUDA 11.1 installed and was equipped with an NVIDIA GeForce RTX 2080 Ti (11GB VRAM). Computations for fine-tuning transformers and training KimCNN were performed on the GPU. + +# B Implementation Details + +Our experiments were built using well-known machine learning libraries: PyTorch $^3$ , hugging face transformers $^4$ , scikit-learn $^5$ , scipy $^6$ , and numpy $^7$ . + +For active learning and text classification, we used small-text $^{8}$ (Schroder et al., 2022). + +# C Experiments + +Each experiment configuration represents a combination of model, dataset and query strategy, and has been run for five times. We used a class-balanced initial set to support the warm start of the first model for the imbalanced TREC-6 dataset, whose rarest class would otherwise only rarely be encountered if sampled randomly. + +# C.1 Pre-Trained Models + +We fine-tuned DistilRoBERTa (distilroberta-base) and BERT-large (bert-large-uncased). Both of them are available via the huggingface model repository. + +
DatasetMax. Seq. Length
AGN60
CR50
MR60
SUBJ50
TREC40
+ +Table 6: Hyperparameter settings for the maximum sequence length (as number of tokens) per dataset. + +
DatasetModelQuery Strategy
PEBTLCCARS
AGNSVM0.804 ± 0.0000.804 ± 0.0000.802 ± 0.0090.539 ± 0.0880.801 ± 0.006
KimCNN0.871 ± 0.0040.874 ± 0.0050.856 ± 0.0120.814 ± 0.0150.866 ± 0.007
DistilRoBERTa0.892 ± 0.0020.894 ± 0.0030.894 ± 0.0020.894 ± 0.0080.879 ± 0.008
BERT0.896 ± 0.0030.904 ± 0.0020.894 ± 0.0060.889 ± 0.0140.884 ± 0.003
CRSVM0.757 ± 0.0000.755 ± 0.0140.742 ± 0.0220.763 ± 0.025
KimCNN0.765 ± 0.0120.762 ± 0.0120.748 ± 0.0150.745 ± 0.014
DistilRoBERTa0.906 ± 0.0070.911 ± 0.0080.905 ± 0.0110.886 ± 0.007
BERT0.904 ± 0.0100.919 ± 0.0090.913 ± 0.0050.896 ± 0.008
MRSVM0.674 ± 0.0000.650 ± 0.0120.633 ± 0.0140.641 ± 0.010
KimCNN0.719 ± 0.0110.719 ± 0.0170.726 ± 0.0080.720 ± 0.013
DistilRoBERTa0.819 ± 0.0120.826 ± 0.0090.826 ± 0.0110.809 ± 0.011
BERT0.857 ± 0.0090.852 ± 0.0090.856 ± 0.0150.846 ± 0.011
SUBJSVM0.843 ± 0.0000.857 ± 0.0060.827 ± 0.0120.839 ± 0.012
KimCNN0.897 ± 0.0040.880 ± 0.0080.877 ± 0.0100.896 ± 0.009
DistilRoBERTa0.944 ± 0.0040.948 ± 0.0080.939 ± 0.0080.926 ± 0.005
BERT0.957 ± 0.0040.958 ± 0.0050.954 ± 0.0050.949 ± 0.003
TREC-6SVM0.740 ± 0.0000.758 ± 0.0000.692 ± 0.1010.596 ± 0.1450.742 ± 0.031
KimCNN0.840 ± 0.0160.836 ± 0.0120.834 ± 0.0150.802 ± 0.0170.792 ± 0.020
DistilRoBERTa0.942 ± 0.0080.950 ± 0.0090.942 ± 0.0090.940 ± 0.0110.918 ± 0.016
BERT0.932 ± 0.0100.947 ± 0.0140.960 ± 0.0060.968 ± 0.0040.921 ± 0.025
+ +Table 5: Final accuracy per dataset, model, and query strategy. We report the mean and standard deviation over five runs. The best result per dataset is printed in bold. + +# C.2 Datasets + +Our experiments used datasets that are well-known benchmarks in text classification and active learning. All datasets have been made accessible to the Python ecosystem by several Python libraries that provide fast access to the raw text of those datasets. We obtain CR and SUBJ using gluonnlp, and AGN, MR, and TREC using huggingface datasets. + +# C.3 Hyperparameters + +Maximum Sequence Lenght We set the maximum sequence length to the minimum multiple of ten for which $95\%$ of the respective dataset's sentences contain less than or an equal number of tokens for both KimCNN and transformers (shown in Table 6). + +Transformers AGN is trained for 50 epochs and all other datasets for 15 epochs (Howard and Ruder, 2018). For training, we use AdamW (Loshchilov and Hutter, 2019) with a learning rate of $\eta = 2\mathrm{e} - 5$ beta coefficients of $\beta_{1} = 0.9$ and $\beta_{2} = 0.999$ , and an epsilon of $\epsilon = 1\mathrm{e} - 8$ . Training is done in batches, with a batch size of 12. + +KimCNN We adopt the parameters by Zhang et al. (2017), i.e., 50 filters and filter heights of (3,4,5). Training is done in batches with a batch size of 25, a learning rate of $\eta = 1\mathrm{e} - 3$ , and word embeddings from word2vec (Mikolov et al., 2013). + +# D Standard Deviations and Runtimes + +In Table 5 and Table 7 we report final accuracy and AUC scores including standard deviations, measured after the last iteration of active learning. Moreover, we report the runtimes of the query step per strategy in Table 8. + +# D.1 Evaluation Metrics + +Active learning was evaluated using standard active learning metrics, namely accuracy und area under the learning curve. For both metrics, the respective scikit-learn implementation was used. + +# References + +Jeremy Howard and Sebastian Ruder. 2018. Universal language model fine-tuning for text classification. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (ACL), pages 328-339. +Ilya Loshchilov and Frank Hutter. 2019. Decoupled weight decay regularization. In Proceedings of the 7th International Conference on Learning Representations (ICLR). +Tomás Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. 2013. Efficient estimation of word representations in vector space. In Proceedings 1st International Conference on Learning Representations (ICLR). + +
DatasetModelQuery Strategy
PEBTLCCARS
AGNSVM0.693 ± 0.0000.705 ± 0.0000.690 ± 0.0110.458 ± 0.0570.699 ± 0.012
KimCNN0.753 ± 0.0050.791 ± 0.0130.739 ± 0.0190.699 ± 0.0220.810 ± 0.013
DistilRoBERTa0.855 ± 0.0180.875 ± 0.0070.852 ± 0.0180.863 ± 0.0200.855 ± 0.006
BERT0.858 ± 0.0150.872 ± 0.0050.848 ± 0.0180.864 ± 0.0120.849 ± 0.007
CRSVM0.717 ± 0.0000.713 ± 0.0090.695 ± 0.0090.718 ± 0.007
KimCNN0.713 ± 0.0150.717 ± 0.0090.707 ± 0.0040.705 ± 0.014
DistilRoBERTa0.874 ± 0.0120.875 ± 0.0080.853 ± 0.0190.870 ± 0.010
BERT0.877 ± 0.0110.857 ± 0.0160.866 ± 0.0170.868 ± 0.008
MRSVM0.612 ± 0.0000.615 ± 0.0120.584 ± 0.0180.597 ± 0.004
KimCNN0.674 ± 0.0090.683 ± 0.0150.671 ± 0.0090.677 ± 0.011
DistilRoBERTa0.784 ± 0.0130.786 ± 0.0260.785 ± 0.0100.783 ± 0.007
BERT0.833 ± 0.0130.831 ± 0.0120.817 ± 0.0090.827 ± 0.006
SUBJSVM0.801 ± 0.0000.802 ± 0.0030.768 ± 0.0080.797 ± 0.010
KimCNN0.859 ± 0.0130.841 ± 0.0070.838 ± 0.0110.864 ± 0.008
DistilRoBERTa0.924 ± 0.0060.925 ± 0.0030.915 ± 0.0150.902 ± 0.008
BERT0.939 ± 0.0070.938 ± 0.0160.943 ± 0.0050.933 ± 0.005
TREC-6SVM0.491 ± 0.0000.648 ± 0.0000.538 ± 0.0850.462 ± 0.1120.619 ± 0.026
KimCNN0.711 ± 0.0100.714 ± 0.0090.683 ± 0.0290.639 ± 0.0250.688 ± 0.013
DistilRoBERTa0.840 ± 0.0230.864 ± 0.0140.860 ± 0.0130.842 ± 0.0050.856 ± 0.020
BERT0.789 ± 0.0320.844 ± 0.0130.858 ± 0.0300.868 ± 0.0270.828 ± 0.018
+ +Table 7: Final AUC per dataset, model, and query strategy. We report the mean and standard deviation over five runs. The best result per dataset is printed in bold. + +
DatasetModelQuery Strategy
PEBTLCCARS
AGNSVM1.852 ±0.4150.907 ±0.2030.432 ±0.097516.554 ± 115.5830.001 ± 0.000
KimCNN7.264 ±1.6266.199 ±1.38910.256 ±2.359481.758 ± 142.0130.002 ± 0.000
DistilRoBERTa97.479 ±21.80096.372 ±21.55187.398 ±19.560852.457 ± 230.1570.002 ± 0.000
BERT528.884 ±118.347503.454 ±112.583480.401 ±107.4221475.960 ± 391.5790.002 ± 0.000
CRSVM0.005 ±0.0010.005 ±0.0010.003 ±0.0010.307 ±0.070
KimCNN0.184 ±0.0420.155 ±0.0350.163 ±0.0360.705 ±0.189
DistilRoBERTa1.942 ±0.4341.916 ±0.4281.912 ±0.4282.627 ±0.648
BERT12.112 ±2.70912.374 ±2.76712.427 ±2.78012.750 ±2.852
MRSVM0.014 ±0.0030.014 ±0.0030.009 ±0.0021.889 ±0.425
KimCNN0.521 ±0.1170.436 ±0.0980.468 ±0.1053.672 ±1.098
DistilRoBERTa7.558 ±1.6917.481 ±1.6737.183 ±1.62712.303 ±3.293
BERT41.428 ±9.26542.247 ±9.44741.960 ±9.39143.480 ±9.747
SUBJSVM0.014 ±0.0030.013 ±0.0030.009 ±0.0021.969 ±0.444
KimCNN0.472 ±0.1060.409 ±0.0911.708 ±1.1443.161 ±0.954
DistilRoBERTa5.219 ±1.1675.153 ±1.1535.099 ±1.14010.508 ±2.885
BERT31.332 ±7.00632.908 ±7.35833.043 ±7.39337.832 ±8.478
TREC-6SVM0.085 ±0.0190.042 ±0.0090.018 ±0.0040.609 ±0.138
KimCNN0.289 ±0.0650.248 ±0.0551.111 ±0.7451.504 ±0.447
DistilRoBERTa2.934 ±0.6562.887 ±0.6463.239 ±1.4734.691 ±1.271
BERT14.577 ±3.26014.539 ±3.25114.963 ±3.35017.901 ±17.213
+ +Table 8: Query time in seconds. We report the mean and standard deviation over five runs. The best result (with the lowest query time) per dataset and model is printed in bold. + +Christopher Schröder, Lydia Müller, Andreas Niekler, and Martin Potthast. 2022. Small-Text: Active learning for text classification in python. arXiv preprint arXiv:2107.10314. + +Ye Zhang, Matthew Lease, and Byron C. Wallace. 2017. Active discriminative text representation learning. In Proceedings of the Thirty-First AAAI Conference on Artificial Intelligence, pages 3386-3392. \ No newline at end of file diff --git a/revisitinguncertaintybasedquerystrategiesforactivelearningwithtransformers/images.zip b/revisitinguncertaintybasedquerystrategiesforactivelearningwithtransformers/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..615b43c17e0646461625386ab5d9f3bc1e1f1af5 --- /dev/null +++ b/revisitinguncertaintybasedquerystrategiesforactivelearningwithtransformers/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ad6931da6749bb3760f59c34d96c9600940e208492dd44ac67a79fdc8bd267d0 +size 711070 diff --git a/revisitinguncertaintybasedquerystrategiesforactivelearningwithtransformers/layout.json b/revisitinguncertaintybasedquerystrategiesforactivelearningwithtransformers/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..865394e7bfbb6616bbf3bda99c74bf5a24944b58 --- /dev/null +++ b/revisitinguncertaintybasedquerystrategiesforactivelearningwithtransformers/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:14b575420fc78fae0d279ecc32f92b89e8aad37d59cdb684113b85c4d0327244 +size 299037 diff --git a/richercountriesandricherrepresentations/1274f3eb-a3f5-40d2-b886-e11a60b7305e_content_list.json b/richercountriesandricherrepresentations/1274f3eb-a3f5-40d2-b886-e11a60b7305e_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..2ed0647c06f3219e1f8aad21c53f0906cefe0645 --- /dev/null +++ b/richercountriesandricherrepresentations/1274f3eb-a3f5-40d2-b886-e11a60b7305e_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8e78d29da792e74ebb2ba25db72dc2b66b8f4fa4980fea23bfc5428ed2373d50 +size 65844 diff --git a/richercountriesandricherrepresentations/1274f3eb-a3f5-40d2-b886-e11a60b7305e_model.json b/richercountriesandricherrepresentations/1274f3eb-a3f5-40d2-b886-e11a60b7305e_model.json new file mode 100644 index 0000000000000000000000000000000000000000..63cf533b56ae65bb100fc62ab9fd8857d84b4cd5 --- /dev/null +++ b/richercountriesandricherrepresentations/1274f3eb-a3f5-40d2-b886-e11a60b7305e_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b59717c535405b548dfc300384113be76ec736b4e3a71344c766a1afbd6891c7 +size 80081 diff --git a/richercountriesandricherrepresentations/1274f3eb-a3f5-40d2-b886-e11a60b7305e_origin.pdf b/richercountriesandricherrepresentations/1274f3eb-a3f5-40d2-b886-e11a60b7305e_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..7ae4aef2420f0d544e4be78751d8f01bd6afc890 --- /dev/null +++ b/richercountriesandricherrepresentations/1274f3eb-a3f5-40d2-b886-e11a60b7305e_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:367ef29cbe6636a68e62063dd18bf6173d66eeed1a64ba1f15720b700f697f2d +size 325016 diff --git a/richercountriesandricherrepresentations/full.md b/richercountriesandricherrepresentations/full.md new file mode 100644 index 0000000000000000000000000000000000000000..66f3ee87310fcfd7992120833562dc206eb104eb --- /dev/null +++ b/richercountriesandricherrepresentations/full.md @@ -0,0 +1,248 @@ +# Richer Countries and Richer Representations + +Kaitlyn Zhou +Stanford University +katezhou@stanford.edu + +Kawin Ethayarajh +Stanford University +kawin@stanford.edu + +Dan Jurafsky +Stanford University +jurafsky@stanford.edu + +# Abstract + +We examine whether some countries are more richly represented in embedding space than others. We find that countries whose names occur with low frequency in training corpora are more likely to be tokenized into subwords, are less semantically distinct in embedding space, and are less likely to be correctly predicted: e.g., Ghana (the correct answer and invocabulary) is not predicted for, "The country producing the most cocoa is [MASK].". Although these performance discrepancies and representational harms are due to frequency, we find that frequency is highly correlated with a country's GDP; thus perpetuating historic power and wealth inequalities. We analyze the effectiveness of mitigation strategies; recommend that researchers report training word frequencies; and recommend future work for the community to define and design representational guarantees. + +# 1 Introduction + +How similar are the words "Brooklyn" and "Queens"? To a New Yorker, they evoke two very different places, cultures, and cuisines, but to a Seattleite, they are quite similar, both being boroughs of New York City. Our perception of entities such as cities or countries is conditioned on our backgrounds. Here, we ask if language models are also susceptible to representational biases. + +We suggest three criteria to characterize the quality of representations for particular entities or groups: consistency, distinctiveness, and recognizability. For consistency, are all entities of a certain type (such as all country names) represented with the same number of tokens in the lexicon? For distinctiveness, are entities of the same category seen as equally distinct in representational space? For recognizability, are models capable of generating + +all entities of a certain type in response to questions? And are the differences between entities confounded across lines of historical inequity (like wealth of countries)? + +Focusing on BERT (bert-base-cased $^2$ ) representations (Devlin et al., 2019), we find that names of countries that appear less frequently in training data are less likely to be invocabulary, are less semantically distinct from other countries, and are less frequently predicted in the masked language modeling (MLM) task. Disappointingly, we find similar behavior in bert-base-multilingual-based and roberta-base. We identify these differences as intrinsic representational harms where low frequency countries are more likely to be conflated with one another and their existence less recognized. + +A more troubling result is that training data frequency is highly correlated with the gross domestic product of a country (GDP) (Pearson's $r = 0.82$ ). Our training data and thus the representation of entities through our language models encodes wealth and power disparities and perpetuates representational harms. Given these significant differences in representation, what could it look like to impose a minimum quality of representation for significant entities? We recommend that the community consider designing representational guarantees for language models. + +In summary we: 1) reveal multiple ways in which the BERT representation of high GDP countries is systematically richer than that of low GDP countries; 2) study the effectiveness of potential mitigation efforts; and 3) propose the idea of representational guarantees as future work for the community. + +# 2 Related Work + +Language technologies have long been studied for potential intrinsic and extrinsic harms (Galliers and Jones, 1993). Known intrinsic harms include misrepresentation of gender (Bolukbasi et al., 2016), race (Abid et al., 2021), and ability (Hutchinson et al., 2020) — all types of representational harms (Barocas et al., 2017; Crawford, 2017; Blodgett et al., 2020). Other intrinsic harms include forms of erasure through under-representation of LGBTQ+ identity terms (Strengers et al., 2020; Oliva et al., 2021) and racial groups (Gehman et al., 2020). Extrinsic harms are often found in downstream tasks and include disparities in quality of service among user groups (Zhang et al., 2020) such as African-American users (Blodgett and O'Connor, 2017; Koenecke et al., 2020). However, low statistical power has also made it difficult to make conclusive claims about the presence or absence of bias (Ethayarajh, 2020). + +Many of these representational harms have been linked to word frequency in static embeddings (Bolukbasi et al., 2016; Caliskan et al., 2017; Zhao et al., 2018; Bordia and Bowman, 2019; Ethayarajh et al., 2019b; van Loon et al., 2022). Low frequency words also differ geometrically from other words, with smaller inner products (Mimno and Thompson, 2017) and lower variance (Ethayarajh et al., 2019a). Recent work has also shown how frequency impacts contextual embeddings such as the under-estimation of cosine similarity among high-frequency words (Zhou et al., 2022) and the discrepancies in representations of personal names (Shwartz et al., 2020; Wolfe and Caliskan, 2021). Our work extends these lines of work via the examination of representational harms for country names. + +# 3 Rich Countries have their own Tokens + +Are poor and rich countries tokenized the same way? Here, we focus on BERT's tokenization process and measure the consistency (or rather inconsistency) in how names of countries are tokenized and then represented. Our GDP data is retrieved from the United Nations Statistics Division from 201934. + +Of the 159 single-word countries names from + +
SubwordsFreqGDP (M)Example
1 (n=134)74,882430,596Uzbekistan
2 (n=32)68,148870,702Comoros
3 (n=15)8,71134,896Grenada
4+ (n=12)4,30914,980Eswatini
+ +Table 1: The average BERT training data frequency and GDP associated with the countries, binned by the number of subwords the country was tokenized into (e.g., "Grenada" was tokenized into three subwords.). Using OLS to predict number of subwords, frequency explains $38\%$ of the variation in number of subwords. + +the United Nations members list, 134 of them are in-vocabulary, — the remaining 25 are out-of-vocabulary (OOV). In WordPiece tokenization, OOV words are tokenized into in-vocabulary subwords (e.g. "Andorra" becomes "And" and "#orra", see table 1). Additionally, as a limitation of the unigram vocabulary, the 34 multi-word country names (e.g. "United States") are also OOV and represented as distinct tokens ("United" and "States"). Each word of multi-word countries can also be OOV (e.g., Sao Tome and Principe is tokenized into 9 different subwords). + +We used ordinary least squares regression to predict the number of subword tokens in each country name, using training data frequency of each country name as the feature (BERT training data estimated from the March 1st, 2020 Wikipedia Download and BookCorpus) (Zhu et al., 2015; Hartmann and dos Santos, 2018). We found that training data frequency explains $38\%$ of the variance in number of subwords $(p < 0.01)$ , despite the confounder of multi-word countries being considered OOV (Table 2 in Appendix). This is likely due to the fact that the tokenizer builds its vocabulary based on fitting training likelihood. Given that the training data frequency of a country's name correlates strongly with its GDP (Pearson's $r = 0.82$ ), the countries that have the highest number of subwords are also the ones with the lowest GDP. + +![](images/e502409ad19fb7fd700896cdb9bd2cb069b6ef110f5a2ebb4f362f7e670a8907.jpg) +Figure 1: Average norm of embeddings in relation to the number of subwords of the embedding. OOV words are represented by averaging subwords. Pearson's correlation between average norm and number of subwords, $r = -0.92$ . + +# 3.1 Geometric Impact of being OOV + +The methods used to represent OOV words can impact the geometry of their representations. For example, the representation of OOV words often have smaller norms ( $L^2$ of the word embedding) than in-vocabulary words. This is because a common way to represent OOV words is to take the average of their subwords (Pilehvar and Camacho-Collados, 2019; Blevins and Zettlemoyer, 2020; Bommasani et al., 2020). However, since the average values for each dimension are near zero, the more subwords that are averaged, the smaller the norm of the vectors (Adi et al., 2017) (figure 1). As a result, the Pearson's correlation between the norm and number of subwords is $r = -0.92$ . A common alternative to averaging subwords is to use the first subword to represent an OOV word. When this representation is used, the correlation between the norm and the number of subwords reverses and is slightly positive, Pearson's $r = 0.22$ (figure 4 in Appendix). One possible explanation could be that the first subword of OOV words are more likely to be stop words, which are known to have larger norms (Ethayarajh, 2019). The difference in geometry between OOV and in-vocabulary words exists in both representation methods. This could could result in impacts on tasks using embedding-based retrieval (e.g., nearest-neighbor LM) as low-frequency names will have additionally distinguishing geometric characteristics as a result of tokenization. + +Inconsistency in tokenizing country names leads to inconsistency in geometric representation. A potential mitigation might be to have all country names be in-vocabulary with a dedicated token. This might not address all impacts of training data frequency imbalances, but would at least prevent + +additional geometric differences due to tokenization. + +# 4 Richer Countries are Most Distinct in Embedding Space + +Nations or entire regions are subject to bias. The African continent, for example, is often treated journalistically as a single homogeneous entity (Nothias, 2018), as if African countries are all substitutable for one another. We draw on this finding to ask whether historically disadvantaged countries are also conflated with one another in the embeddings of their names (i.e., seen as less distinct from each other than other countries). + +We measure the semantic similarity between pairs of the 134 in-vocabulary countries by creating word embeddings for each name (done by averaging the last four hidden layers of BERT). We calculate the average in-group cosine similarity of country names as grouped by frequency (i.e., we take the countries in each decile of frequency and measure the average cosine similarity across the $\binom{14}{2}$ pairs). We repeat this ten times and find that the $10\%$ least frequent names have an average in-group similarity of 0.610 compared to an average similarity of 0.582 for the $10\%$ most frequent countries (mean $\delta = 0.028$ , permutation test $p < 0.01$ ). + +We then calculate the average semantic similarity of a country's embedding to all other countries to measure a country's distinctiveness (averaged over ten trials). Using OLS to predict average cosine similarity, frequency explains $8\%$ of the variance (Table 4 in Appendix). For example, in our experiments, France had a cosine similarity of $\geq 0.7$ with 21 other countries while Haiti shared a cosine similarity of $\geq 0.7$ with 59 other countries. France's distinctiveness contrasts with Haiti's similarity with other countries. Using these embeddings and cosine similarities in a downstream task like IR (or MT, where embedding cosines are used in algorithms like BERTScore) would yield vastly different results despite using the same threshold. We visualize how average cosine similarity correlates with a country's GDP in Figure 2. + +To ensure that the semantic similarity discrepancies are not simply a consequence of how these countries are written about in test examples, we run the same OLS experiment on an artificial dataset where names of countries appear in identical contexts. The results are consistent: frequency explains $9\%$ of the variance in average cosine similar + +![](images/6878b0a1966f895469419b0c6a26cfa2f8336d83b73e64018c5a03e71c03a2d0.jpg) +Figure 2: Average cosine similarity of a country to all other countries vs. its GDP. Pearson's $r = -0.28$ for average cosine similarity and GDP. Wealthier countries are more distinct in BERT embedding space. + +ity (Table 5 and Table 6 in Appendix). Independent of how these countries are being written about in any potential downstream task, NLP models like BERT embed country names in a way that results in higher semantic similarity for low frequency names, and hence low GDP countries. This is a representational harm: distinctiveness of a nation's name in NLP representations correlates with the nation's wealth, resulting in poorer countries being more likely to be conflated with one another. + +# 4.1 Tokenization and Ssemantic Similarity + +As discussed in the section above, tokenization results in geometric differences between OOV and in-vocabulary words, and here we examine tokenization's effect on cosine similarity. OOV country names have higher in-group similarity averages when averaging subpieces (0.668 vs 0.628; mean $\delta = 0.040$ , permutation test $p < 0.01$ ). Given that OOV words have smaller norms and are closer to the centroid, this signals a concentration of low-frequency words. However, when using the first subpiece to represent OOV words, OOV country names have lower in-group similarity averages than in-group similarity among in-vocabulary words (0.589 vs 0.625; mean $\delta = 0.037$ , permutation test $p < 0.001$ ) — we showed that these embeddings conversely have larger norms and could be more widely dispersed. The key takeaway here is that both methods show semantic differences between in-vocabulary and OOV words; again there are potential impacts in embedding-based downstream tasks. + +# 5 Richer Countries are more Frequently Predicted + +The lack of recognition of people and groups (Strengers et al., 2020; Oliva et al., 2021; Gehman + +![](images/593475604e9c229ba8edc7dc9bdb0c724a798f60a40b897311b42edfe6f1f4f2.jpg) +Figure 3: Number of times a country was predicted in the MLM task versus its GDP (logged). Pearson's correlation between GDP (logged) and number of times a country is predicted, $R = 0.64$ . + +et al., 2020) has often been cited as an representational harm. Here, we use the masked language modeling task as a proxy for many downstream tasks that need to be able to predict the name of a country (e.g., as the answer to a question, or in a summary) to measure whether countries are all minimally predicted or whether instead we see representational harms such as erasure. + +We randomly sample sentences from Wikipedia that contain the name of a country, replace the name with a BERT mask token ([MASK]), and use the masked-out country name as the gold label. We use 100 examples of each of the 134 in-vocabulary country names. The model will only predict invocabulary words, which again illustrates the impact of inconsistent tokenization: the very task BERT was trained on is unable to handle OOV country names without modification. + +High frequency countries (75th percentile) have an average accuracy of $42\%$ while low frequency (25th percentile) countries have an accuracy of $26\%$ (table 7 in Appendix). How often a country is predicted is highly correlated with its training data frequency (Pearson's $r = 0.64$ , figure 3). Of all the country names predicted, the 10 least predicted countries make up $2\%$ of total guesses compared to $25\%$ for the top 10 most predicted countries. BERT fails this task in drastic ways; predicting China, India, Brazil for, "The poorest country in the world is [MASK]." (Burundi and Somalia ranked as the poorest by GDP/capita). This reduced recognition of poor countries is a representational harm. + +# 6 The Limitations of Mitigation Efforts + +We analyze the effectiveness of two popular mitigation efforts. + +1. Could these frequency-based effects be mitigated with additional training data? We measure the performance of Multilingual BERT (BERT-ML) which includes Wikipedia articles from 104 other languages. We continue to find accuracy disparities between low and high GDP countries (15% vs 29%). Additional training data fails to mitigate these harms, most likely because the additional data continues to amplify existing imbalances (i.e., German, French, and Polish are the next three biggest languages of Wikipedia articles). Data augmentation as a mitigation technique is challenging as datasets could easily maintain existing or introduce new frequency imbalances. We also tested RoBERTa (trained on over 160GB more data) on this task with similar results (table 7 in Appendix). + +2. Could fine-tuning or continuing pretraining mitigate these harms? We select 20 random countries (Appendix table 8); for each, we select 1,000 random sentences from Wikipedia that mentions the country's name. After four epochs of training, we then test on an evaluation dataset (100 examples/country) and we see a $13\%$ increase in performance on our selected countries and a $3\%$ decrease for other countries (table 9 and figure 5 in Appendix). Our subset of interested countries originally made up $17\%$ of all guesses, but this rate more than doubles in our tuned model. This pre-training mitigation method shows promise but has trade-offs in performance, requires practitioners to be aware of inequalities, and have access to enough training samples to continue pre-training effectively. + +# 7 Discussion and Conclusion + +We find significant disparities in the quality of representation of country names and show how these differences result in representational harms that perpetuate existing wealth and power inequalities. We make two recommendations on paths forward. We recommend the release of training word frequencies to increase transparency and isolate current representational harms (Gebru et al., 2021; Mitchell et al., 2019; Bender and Friedman, 2018; Ethayarajh and Jurafsky, 2020). Practitioners who use these models in their systems and research should have access to the topic and entity distribution of our models given the potential for frequency-related harms. We also recommend the community consider designing representational guarantees for significant entities to mitigate these + +downstream harms. Our work illustrates the potential harms that arise when entities such as country names do not have representational guarantees. We encourage the community to consider the following questions: How can we ensure entities such as names of country be in-vocabulary? How can we guarantee a minimum distinctness and ensure recognition of historically disadvantaged groups? Such guarantees will likely be difficult to design and will require expertise from multiple domains but mitigating these representational harms is an important task that we cannot ignore. + +# Acknowledgements + +We sincerely thank Justine Zhang, Rishi Bommasani, Tolúlope Ógünremí, and our anonymous reviewers for their support and helpful reviews. This research has been supported in part by a Hoffman-Yee Research Grant from the Stanford Institute for Human-Centered AI, award IIS-2128145 from the National Science Foundation, a Stanford Graduate Fellowship, a Facebook Fellowship, and the Natural Sciences and Engineering Research Council of Canada. + +# References + +Abubakar Abid, Maheen Farooqi, and James Zou. 2021. Persistent anti-muslim bias in large language models. In Proceedings of the 2021 AAAI/ACM Conference on AI, Ethics, and Society, pages 298-306. +Yossi Adi, Einat Kermany, Yonatan Belinkov, Ofer Lavi, and Yoav Goldberg. 2017. Fine-grained analysis of sentence embeddings using auxiliary prediction tasks. In Proceedings of ICLR Conference Track. +Solon Barocas, Kate Crawford, Aaron Shapiro, and Hanna Wallach. 2017. The problem with bias: Allocative versus representational harms in machine learning. In Proceedings of SIGCIS, Philadelphia, PA. +Emily M. Bender and Batya Friedman. 2018. Data statements for natural language processing: Toward mitigating system bias and enabling better science. Transactions of the Association for Computational Linguistics, 6:587-604. +Terra Blevins and Luke Zettlemoyer. 2020. Moving down the long tail of word sense disambiguation with gloss informed bi-encoders. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 1006-1017. +Su Lin Blodgett, Solon Barocas, Hal Daumé III, and Hanna Wallach. 2020. Language (technology) is + +power: A critical survey of "bias" in NLP. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 5454-5476. +Su Lin Blodgett and Brendan O'Connor. 2017. Racial disparity in natural language processing: A case study of social media african-american english. In *Fairness, Accountability, and Transparency in Machine Learning (FAT/ML) Workshop*. +Tolga Bolukbasi, Kai-Wei Chang, James Zou, Venkatesh Saligrama, and Adam Kalai. 2016. Man is to computer programmer as woman is to homemaker? debiasing word embeddings. In Proceedings of the 30th International Conference on Neural Information Processing Systems, NIPS'16, page 4356-4364, Red Hook, NY, USA. Curran Associates Inc. +Rishi Bommasani, Kelly Davis, and Claire Cardie. 2020. Interpreting Pretrained Contextualized Representations via Reductions to Static Embeddings. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 4758-4781, Online. Association for Computational Linguistics. +Shikha Bordia and Samuel R. Bowman. 2019. Identifying and reducing gender bias in word-level language models. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Student Research Workshop, pages 7-15, Minneapolis, Minnesota. +Aylin Caliskan, Joanna J. Bryson, and Arvind Narayanan. 2017. Semantics derived automatically from language corpora contain human-like biases. Science, 356(6334):183-186. +Kate Crawford. 2017. The trouble with bias. In _Conference on Neural Information Processing Systems_, invited speaker. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171-4186, Minneapolis, Minnesota. +Kawin Ethayarajh. 2019. How contextual are contextualized word representations? Comparing the geometry of BERT, ELMo, and GPT-2 embeddings. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 55–65, Hong Kong, China. +Kawin Ethayarajh. 2020. Is your classifier actually biased? measuring fairness under uncertainty with + +bernstein bounds. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 2914-2919. +Kawin Ethayarajh, David Duvenaud, and Graeme Hirst. 2019a. Towards understanding linear word analogies. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 3253-3262, Florence, Italy. +Kawin Ethayarajh, David Duvenaud, and Graeme Hirst. 2019b. Understanding undesirable word embedding associations. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 1696-1705, Florence, Italy. +Kawin Ethayarajh and Dan Jurafsky. 2020. Utility is in the eye of the user: A critique of nlp leaderboards. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 4846-4853. +J.R. Galliers and K.S. Jones. 1993. Evaluating Natural Language Processing Systems. Computer Laboratory Cambridge: Technical report. University of Cambridge, Computer Laboratory. +Timnit Gebru, Jamie Morgenstern, Briana Vecchione, Jennifer Wortman Vaughan, Hanna Wallach, Hal Daume III, and Kate Crawford. 2021. Datasheets for datasets. Commun. ACM, 64(12):86-92. +Samuel Gehman, Suchin Gururangan, Maarten Sap, Yejin Choi, and Noah A. Smith. 2020. RealToxicityPrompts: Evaluating neural toxic degeneration in language models. In Findings of the Association for Computational Linguistics: EMNLP 2020, pages 3356-3369, Online. +Nathan Hartmann and Leandro Borges dos Santos. 2018. NILC at CWI 2018: Exploring feature engineering and feature learning. In Proceedings of the Thirteenth Workshop on Innovative Use of NLP for Building Educational Applications, pages 335-340, New Orleans, Louisiana. +Ben Hutchinson, Vinodkumar Prabhakaran, Emily Denton, Kellie Webster, Yu Zhong, and Stephen Denuyl. 2020. Social biases in NLP models as barriers for persons with disabilities. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 5491-5501. +Allison Koenecke, Andrew Joo Hun Nam, Emily Lake, Joe Nudell, Minnie Quartey, Zion Mengesha, Connor Toups, John R. Rickford, Dan Jurafsky, and Sharad Goel. 2020. Racial disparities in automated speech recognition. Proceedings of the National Academy of Sciences of the United States of America, 117:7684 - 7689. +David Mimno and Laure Thompson. 2017. The strange geometry of skip-gram with negative sampling. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 2873-2878, Copenhagen, Denmark. + +Margaret Mitchell, Simone Wu, Andrew Zaldivar, Parker Barnes, Lucy Vasserman, Ben Hutchinson, Elena Spitzer, Inioluwa Deborah Raji, and Timnit Gebru. 2019. Model cards for model reporting. In Proceedings of the Conference on Fairness, Accountability, and Transparency, FAT* '19, page 220-229, New York, NY, USA. Association for Computing Machinery. +Toussaint Nothias. 2018. How western journalists actually write about africa. Journalism Studies, 19(8):1138-1159. +Thiago Dias Oliva, Dennys Marcelo Antonialli, and Alessandra Gomes. 2021. Fighting hate speech, silencing drag queens? Artificial intelligence in content moderation and risks to LGBTQ voices online. Sexuality & Culture, 25(2):700-732. +Mohammad Taher Pilehvar and Jose Camacho-Collados. 2019. WiC: the word-in-context dataset for evaluating context-sensitive meaning representations. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 1267-1273, Minneapolis, Minnesota. +Vered Shwartz, Rachel Rudinger, and Oyvind Tafjord. 2020. "you are grounded!": Latent name artifacts in pre-trained language models. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 6850-6861, Online. +Yolande Strengers, Lizhen Qu, Qiongkai Xu, and Jarrod Knibbe. 2020. Adhering, steering, and queering: Treatment of gender in natural language generation. In Proceedings of the 2020 CHI Conference on Human Factors in Computing Systems, CHI '20, page 1-14, New York, NY, USA. Association for Computing Machinery. +Austin van Loon, Salvatore Giorgi, Robb Willer, and Johannes Eichstaedt. 2022. Regional negative bias in word embeddings predicts racial animus—but only via name frequency. arXiv preprint arXiv:2201.08451. +Robert Wolfe and Aylin Caliskan. 2021. Low frequency names exhibit bias and overfitting in contextualizing language models. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 518-532, Online and Punta Cana, Dominican Republic. Association for Computational Linguistics. +Haoran Zhang, Amy X. Lu, Mohamed Abdalla, Matthew McDermott, and Marzyeh Ghassemi. 2020. Hurtful words: Quantifying biases in clinical contextual word embeddings. In Proceedings of the ACM Conference on Health, Inference, and Learning, CHIL '20, page 110-120, New York, NY, USA. Association for Computing Machinery. + +Jieyu Zhao, Tianlu Wang, Mark Yatskar, Vicente Ordonez, and Kai-Wei Chang. 2018. Gender bias in coreference resolution: Evaluation and debiasing methods. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers), pages 15-20, New Orleans, Louisiana. +Kaitlyn Zhou, Kawin Ethayarajh, Dallas Card, and Dan Jurafsky. 2022. Problems with cosine as a measure of embedding similarity for high frequency words. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics, Dublin, Ireland. +Yukun Zhu, Ryan Kiros, Rich Zemel, Ruslan Salakhutdinov, Raquel Urtasun, Antonio Torralba, and Sanja Fidler. 2015. Aligning books and movies: Towards story-like visual explanations by watching movies and reading books. In 2015 IEEE International Conference on Computer Vision (ICCV), pages 19-27. + +# A Appendix + +# A.1 Appendix for section 3 + +To illustrate the skew of BERT's vocabulary on a larger dataset, we repeat this experiment for names of cities across the world. Cities, similar to country names are also information-rich entities representing peoples and places. Filtering for populous (>100,000) single-word cities, $50\%$ of North American cities and $25\%$ of European cities are in-vocabulary compared to less than $6\%$ of city names from Asia, Africa, and Central and South America (Table 3). Contrast Nigeria — world's fourth largest population of English speakers — with the United Kingdom. Lagos is the only city in-vocabulary out of a possible 89 populous cities, compared to the United Kingdom where 53 out of its 64 populous cities are in vocabulary. + +# A.2 Appendix for section 4 + +# A.3 Appendix for section 5 + +
Dep. Variable:# of subwordsR-squared:0.384
Model:OLSAdj. R-squared:0.380
Method:Least SquaresF-statistic:118.8
Date:Mon, 15 Nov 2021Prob (F-statistic):7.95e-22
Time:16:41:27Log-Likelihood:-272.30
No. Observations:193AIC:548.6
Df Residuals:191BIC:555.1
Df Model:1
+ +
coefstd errtP> |t|[0.025 0.975]
Constant7.17020.51513.9120.0006.1548.187
freq_logged-0.55020.050-10.9010.000-0.650-0.451
Omnibus:90.415Durbin-Watson:2.177
Prob(Omnibus):0.000Jarque-Bera (JB):339.064
Skew:1.900Prob(JB):2.36e-74
Kurtosis:8.265Cond. No.74.0
+ +Table 2: OLS Regression Results: Using training data frequency (logged) to predict number of subwords as tokenized by BERT. Training word frequency explains $38\%$ of the variance in number of subpieces as tokenized by BERT. + +
Region#In-VocabPopulation
Africa3725%23,296,502
Americas5947%9,335,510
Asia1,4664%34,046,146
Europe37225%11,278,318
N America4950%1,834,020
Oceania2075%1,316,862
+ +Table 3: Average number of populous (>100,000) cities that are in BERT-base-cased's vocabulary. + +
Dep. Variable:Average Cosine SimilarityR-squared:0.084
Model:OLSAdj. R-squared:0.077
Method:Least SquaresF-statistic:12.13
Date:Sat, 13 Nov 2021Prob (F-statistic):0.000675
Time:11:05:47Log-Likelihood:330.05
No. Observations:134AIC:-656.1
Df Residuals:132BIC:-650.3
Df Model:1
coefstd errtP> |t|[0.025]0.975]
Constant0.69730.01937.1140.0000.6600.735
freq_logged-0.00610.002-3.4820.001-0.010-0.003
Omnibus:8.539Durbin-Watson:1.998
Prob(Omnibus):0.014Jarque-Bera (JB):8.470
Skew:-0.604Prob(JB):0.0145
Kurtosis:3.236Cond. No.113.
+ +Table 4: OLS Regression Results: Using training data frequency (logged) to predict the average cosine similarity between a country compared to all other countries (in-vocabulary countries only). Frequency explains $8\%$ of the variance. The more frequent the country, the lower average cosine similarity — indicating its distinctness from all other countries. + +
Dep. Variable:Average Cosine SimilarityR-squared:0.086
Model:OLSAdj. R-squared:0.079
Method:Least SquaresF-statistic:12.47
Date:Mon, 15 Nov 2021Prob (F-statistic):0.000570
Time:16:46:42Log-Likelihood:440.48
No. Observations:134AIC:-877.0
Df Residuals:132BIC:-871.2
Df Model:1
coefstd errtP> |t|[0.025]0.975]
Constant0.84580.008102.6290.0000.8300.862
freq_logged-0.00270.001-3.5310.001-0.004-0.001
Omnibus:6.442Durbin-Watson:2.084
Prob(Omnibus):0.040Jarque-Bera (JB):3.258
Skew:-0.112Prob(JB):0.196
Kurtosis:2.270Cond. No.113.
+ +Table 5: OLS Regression Results: Using training data frequency (logged) to predict the average cosine similarity between a country compared to all other countries (in-vocabulary countries only) when names of countries appear in identical contexts. Frequency explains $9\%$ of the variance. The more frequent the country, the lower average cosine similarity — indicating its distinctness from all other countries. + +# Sentence + +I am from COUNTRY. + +I live in COUNTRY. + +I hope this January I will get to travel to COUNTRY. + +I am interesting in traveling to COUNTRY. + +My friend is from COUNTRY. + +COUNTRY is well known for its history. + +COUNTRY has a diverse culture and a fascinating history. + +COUNTRY has been involved in a number of historical events. + +COUNTRY is developing its economic sector rapidly. + +COUNTRY fought in a number of wars. + +Today my history teacher taught us about COUNTRY and its history. + +The geography of COUNTRY is fascinating. + +A number of scientists from COUNTRY have gained fame for their work. + +Living in COUNTRY definitely has its advantages and disadvantages. + +The government of COUNTRY is facing criticism. + +I never thought to visit COUNTRY until my neighbor told me about it. + +The news says that COUNTRY is going through some severe climate change. + +The athlete from COUNTRY has just won the Olympic medal. + +The actress was born in COUNTRY and immigrated as a kid. + +A number of fossils has been found in COUNTRY where scientists least expected. + +Table 6: List of artificial sentences used in section 4 to measure cosine similarity of country names in identical contexts. + +
GDP QuartileBERT BaseBERT MLRoB-ERTaTuned
126%15%14%28%
226%18%22%30%
332%22%26%30%
442%29%39%38%
+ +Table 7: Performance on the MLM task as binned by gold label's GDP (by quartiles) from section 5. We see that performance is best on the high GDP countries and that our tuned model is able to perform better on the lower GDP countries which are in our set of interested countries (Table 8). + +
CountryGDP (millions)Freq
India2,891,582505,003
Iran603,779160,699
Poland595,862197,231
Egypt317,359101,897
Qatar183,46622,766
Angola85,00019,839
Myanmar76,78423,840
Uzbekistan57,92113,244
Serbia51,47557,957
Uganda32,60933,860
Cambodia27,09722,095
Iceland24,18831,763
Senegal23,66414,672
Syria20,37953,987
Jamaica15,83040,257
Madagascar14,10423,512
Bahamas13,57813,882
Guinea12,35454,010
Chad11,27138,650
Barbados5,20913,829
+ +Table 8: List of twenty randomly selected countries from section 6. Additional data for each of these countries was used to continue pre-training the model — resulting in an increased in performance on this subset of countries. + +
BERT-BaseTuned
Accuracy
Interested Countries31.75%44.55%
Other Countries31.56%28.89%
% of predictions
Interested Countries17.62%44.44%
Other Countries82.37%55.56%
+ +Table 9: Average accuracy MLM task of BERT-Base and our tuned model for our random set interested countries and all other countries. Average % of predictions out of all countries predicted (non-countries words are not in denominator). + +![](images/70677f26f8f5aaa34a4d82e2d51f91c05dad4e896596679b35f786ddddb33f24.jpg) +Figure 4: Average norm of embeddings in relation to the number of subpieces of the embedding. OOV words are represented by the first subword of the country name. Pearson's correlation between average norm and number of subwords, $R = 0.22$ . + +![](images/1179547f747b25bd52bb7d0829bdeeefe960aa806da92c59235b5b39e8d1398a.jpg) +Figure 5: Number of times a country was predicted in the MLM task versus its GDP (logged) in our tuned model. Pearson's correlation between GDP (logged) and number of times a country is predicted for our tuned mode, $R = 0.22$ . \ No newline at end of file diff --git a/richercountriesandricherrepresentations/images.zip b/richercountriesandricherrepresentations/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..eae44ec0444814e5b39ba5baa68b7032df37146a --- /dev/null +++ b/richercountriesandricherrepresentations/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:58037c1f5b687089558f011ad7382256d495b6c793fb66dcd404bdfe2811fbd8 +size 535530 diff --git a/richercountriesandricherrepresentations/layout.json b/richercountriesandricherrepresentations/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..f63887c6554f6344d25d72cc564b7539238dcebc --- /dev/null +++ b/richercountriesandricherrepresentations/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:88171d21079c89765a4083162cd40fca538058d5ff1234d0fdde45a2dfdcb4f3 +size 290464 diff --git a/rucconclinicalconceptnormalizationinrussian/61eaec11-09b0-43cb-bb7f-6c2fb7e7a476_content_list.json b/rucconclinicalconceptnormalizationinrussian/61eaec11-09b0-43cb-bb7f-6c2fb7e7a476_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..bc6464c6d3101506fce15e5618c168a11b577a2c --- /dev/null +++ b/rucconclinicalconceptnormalizationinrussian/61eaec11-09b0-43cb-bb7f-6c2fb7e7a476_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:600ca2c3d8efc63e823e024ceec61aca1b3a512550f9daf11866a67167dee505 +size 46980 diff --git a/rucconclinicalconceptnormalizationinrussian/61eaec11-09b0-43cb-bb7f-6c2fb7e7a476_model.json b/rucconclinicalconceptnormalizationinrussian/61eaec11-09b0-43cb-bb7f-6c2fb7e7a476_model.json new file mode 100644 index 0000000000000000000000000000000000000000..d8fd689592b8934000d370bd20d05a11e2c5b4d4 --- /dev/null +++ b/rucconclinicalconceptnormalizationinrussian/61eaec11-09b0-43cb-bb7f-6c2fb7e7a476_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:620dd5b9c32e30decb00063788afeb67b74866b541d9bc78a19286a1b9b853c1 +size 57621 diff --git a/rucconclinicalconceptnormalizationinrussian/61eaec11-09b0-43cb-bb7f-6c2fb7e7a476_origin.pdf b/rucconclinicalconceptnormalizationinrussian/61eaec11-09b0-43cb-bb7f-6c2fb7e7a476_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..d6797b767be70d93f11bfbc618aecf419b1e9b86 --- /dev/null +++ b/rucconclinicalconceptnormalizationinrussian/61eaec11-09b0-43cb-bb7f-6c2fb7e7a476_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:591ea3084d03b538602efa74fa10da7a1e7aa041e484c09c5bf359019f379a06 +size 216873 diff --git a/rucconclinicalconceptnormalizationinrussian/full.md b/rucconclinicalconceptnormalizationinrussian/full.md new file mode 100644 index 0000000000000000000000000000000000000000..67ec24d3e0c7545123400ad294a306bee69bc0e1 --- /dev/null +++ b/rucconclinicalconceptnormalizationinrussian/full.md @@ -0,0 +1,169 @@ +# RuCCoN: Clinical Concept Normalization in Russian + +Aleksandr Nesterov1, Galina Zubkova1, Zulfat Miftahutdinov2, Vladimir Kokh1, Elena Tutubalina2,3,4, Artem Shelmanov5,7, Anton M. Alekseev6, Manvel Avetisian1, Andrey Chertok4,5, Sergey Nikolenko6,7,8 + +Sber AI Lab, Moscow, Russia + +2 Kazan Federal University, Kazan, Russia + +$^{3}$ HSE University, Moscow, Russia + +Sber AI, Moscow, Russia + +5 AIRI, Moscow, Russia + +$^{6}$ St. Petersburg Department of Steklov Mathematical Institute, St. Petersburg, Russia + +7 ISP RAS Research Center for Trusted Artificial Intelligence, Moscow, Russia + +Neuromation OU, Tallinn, Estonia + +{AAlNesterov,GVZubkova}@sberbank.ru + +# Abstract + +We present RuCCoN, a new dataset for clinical concept normalization in Russian manually annotated by medical professionals. It contains over 16,028 entity mentions manually linked to over 2,409 unique concepts from the Russian language part of the UMLS ontology. We provide train/test splits for different settings (stratified, zero-shot, and CUI-less) and present strong baselines obtained with state-of-the-art models such as SapBERT. At present, Russian medical NLP is lacking in both datasets and trained models, and we view this work as an important step towards filling this gap. Our dataset and annotation guidelines are available at https://github.com/sberbank-ai-lab/RuCCoN. + +# 1 Introduction + +Electronic health records and other clinical texts contain patient histories through the progression of diseases and represent a treasure trove of information for medical specialists. This information is often unstructured, concealed in freeform text, which leads to the need for natural language processing on medical texts. Mentions of diseases, symptoms, drugs, and other concepts are highly variable, and since the medical vocabulary is very large, entity linking and concept normalization become hard and important problems. State-of-the-art models are increasingly successful in high-resource languages such as English or Spanish, where labeled datasets include ShARE/CLEF eHealth 2013 Task 1 (Suominen et al., 2013), SemEval-2014 Task 7 (Prad + +han et al., 2014), SemEval-2015 Task 14 (El-hadad et al., 2015), MCN (Luo et al., 2019), CANTEMIST (Miranda-Escalada et al., 2020a), CodiEsp (Miranda-Escalada et al., 2020b), and others. However, little has been done for medical entity linking in many languages that are high-resource in other regards. One example is Russian: it is among top 10 languages in the world and has many NLP datasets and resources, but the medical part of Russian NLP is underdeveloped. The Russian UMLS includes translations of Medical Dictionary for Regulatory Activities (MedDRA) (Brown et al., 1999), Logical Observation Identifiers Names and Codes (LOINC) (Forrey et al., 1996), and Medical Subject Headings (MeSH) (Coletti and Bleich, 2001), but it still only amounts to $1.8\%$ of the English UMLS in vocabulary and $1.36\%$ in source counts (NIH 2021, a). + +In this work, we present RuCCoN (Russian Clinical Concept Normalization), a new labeled dataset for clinical concept normalization in Russian. We have employed medical professionals to label the dataset based on concepts from the Russian UMLS (Section 2). Moreover, we present several types of test sets for various settings, including stratified, zero-shot, and CUI-less settings (Section 2.4). We evaluate several state-of-the-art models on RuCCoN, including various fine-tuning variations, and check whether labeled data in Russian is necessary (spoiler alert: it is) by testing cross-lingual concept normalization from English (Section 3). Our results can serve as baselines for RuCCoN and cross-lingual concept normalization. + +# 2 RuCCoN Dataset + +# 2.1 Basic Dataset with NER Labeling + +We supplement with entity linking labeling the only large-scale available dataset of clinical free-text notes in Russian with named entity recognition (NER) labeling (Shelmanov et al., 2015), created by researchers and practitioners from the Scientific Center of Children Health (SCCH). The corpus is based on medical histories of over 60 SCCH patients with allergic and pulmonary disorders and diseases. It contains discharge summaries, radiology, echocardiography, and ultrasound diagnostic reports, recommendations, and other records from a number of different physicians. Documents in the corpus are deidentified: all names are removed, dates are altered. The corpus, freely available for research purposes1, contains 160 fully annotated texts with nearly 250,000 tokens. It has over 18,200 annotated entities, over 7,400 attributes and 3,500 relations with 7 types of entities: “Disease”, “Symptom”, “Drug”, “Treatment”, “Body location”, “Severity”, “Course”. The nearest counterparts for English are the corpus of the Shared Annotated Resources (ShARe) initiative (Pradhan et al., 2015) and the corpus of Strategic Health IT Advanced Research Project: Area 4 (SHARPn) (Rea et al., 2012). + +# 2.2 Annotation Process and Principles + +Annotators mapped each mention to a concept unique identifier (CUI) from the Unified Medical Language System (UMLS) ontology (Bodenreider, 2004). The goal of entity normalization is to assign the same identifier to different synonyms of a given medical concept; e.g., "anemic heart infarction" and "myocardial infarction" refer to the same concept with CUI C0027051. Annotation was carried out in Brat (Stenetorp et al., 2012) with UMLS 2020 AB release. To speed up labeling, each text fragment was linked to CUI from UMLS automatically with the tfidf baseline method. Annotators were allowed to use web search and the UMLS Metathesaurus Browser (NIH 2021, b) for meta-information. Each entity was independently annotated by three annotators. Following (Luo et al., 2019), we calculate Inter-Annotator Agreement (IAA) as the accuracy of the markings matched by at least two annotators over all annotated mentions. At least two annotators linked an entity to the + +
Semantic TypeTrainTest
# %# %
Disease or Syndrome203218.1184817.62
Body Part, Organ, etc.167014.8869914.52
Organic Chemical150213.3869414.42
Finding8967.983737.75
Sign or Symptom6776.032545.27
Therapeutic or Preventive Proc.5424.832024.19
Pathologic Function44941883.9
Am. Acid, Peptide, or Protein3583.191603.31
Organ or Tissue Function3393.021362.81
Body System1501.33731.5
+ +Table 1: Top 10 semantic types counts in RuCCoN. + +same concept from the ontology in 13,125 cases and annotated 1032 entities as CUI-less; IAA was $78.37\%$ . In 3900 cases when all annotators disagreed, the expert annotator with Ph.D. in medicine (the first author of the paper) was asked to decide whether the CUI selected by one of the annotators was in fact correct. After this procedure we obtained a corpora with 16,028 entities linked to 2,409 concepts and 1,293 entities linked with no concept (CUI-less). Table 1 shows the basic statistics of the dataset; percentages are obtained by greedily choosing the first relevant semantic type for a given CUI. Semantic types best represented in our annotation are Disease or Syndrome ( $\approx$ $22\%$ ), Body Part, Organ, or Organ Component ( $17\%$ ), Organic Chemical ( $14.5\%$ ), Finding ( $7\%$ ), Sign or Symptom ( $6.5\%$ ), and Pathologic Function ( $4\%$ ). Annotation guidelines were created by an expert with Ph.D. in medicine. The dataset was labeled by three annotators with higher education in different fields of medicine, two of them with Ph.D. in medicine. Each annotator was paid an hourly wage of $55 for about 80 hours of labeling, so each annotator was paid $4400; the minimal monthly wage in Russia for full-time employment is under $200. + +# 2.3 Annotation Design and Challenges + +During the annotation process, we have encountered a number of challenges that are specific to Russian and other low-resource languages. + +Lack of Russian translation for UMLS concepts. Many terms have not been translated from English into Russian. This often holds for terms that characterize the severity of symptoms, morphological characteristics of anatomical formations, and body locations; examples include "regular shape" ("форма правильна") or "patent lumen"(пros CBо-бODEн"). In these cases, we obtain NER labeling for general entity types such as "Disease" or "Body + +location", but there are no CUIs that annotators could link in Russian. + +Combining many related concepts into one NER fragment. Many phrases annotated in NER labeling as a single entity could be split into several separate and/or nested entities. These cases most often found in morphological descriptions of anatomical formations (e.g., "average size (left lobe = 44mm, 1-st segment 11, right lobe = 93mm), smooth contour, homogeneous parenchymatous tissue, average chogenicity") and cases where adjectives characterizing a concept are combined into a single fragment; e.g., "mild repolarization disorders" ("легкne hapушени пюцeccа релларпази") could be labeled as a single entity but here the adjective "mild" ("легкne") might also be separated from the main concept "repolarization disorders" ("нарушени пюцeccа релларпази"). This happens since NER labeling is usually done for "flat" NER rather than nested; nested NER would allow for multiple embedded entities but is much harder for manual labeling, and has not been done in this case. In our dataset, annotators were instructed to link several CUIs to a single text fragment in these cases. + +Redundancy of the UMLS vocabulary. Some UMLS concepts in Russian have different CUIs even though they are phrased in exactly the same way, and the CUIs have different semantic types; for example, "amyloidosis" ("amIoIoo3") appears for both C0002726 (type: Disease or Syndrome) and C0268381 (type: Neoplastic Process). Also, some concepts have different CUIs while they are synonymous in their meaning; for example, "acholic stool" ("axoJIuHbI cTuJ") has a code C2675627 and "pale stool" ("cBETIIbI cTuJ") has a code C0232720. In such cases, annotators were advised to choose a more appropriate CUI based on its meta-information provided in the UMLS. + +Complex rephrasing. In entity linking, annotators have to change the wording to establish correspondences between mentions and concepts, relying on their domain knowledge and comprehensive search for synonyms. In Russian, this is complicated by minor inconsistencies in the UMLS translation itself: several different CUIs may either have minor semantic differences that cannot be distinguished or overlap significantly in their meaning. E.g., "adenoid hypertrophy" ("тниертофияа лесондов") may be annotated as "nasopharyngeal tonsil hypertrophy (adenoids)" ("тниертофия глотовных". + +
Subset# entities# unique entities# concepts
Full train1218954352031
In-KB train1122049342030
Full test513226891232
In-KB test480824641231
Zero-shot test434417379
Stratified test12661199576
RWN med.23191666635
XL-BEL681610510
MCN1360959793792
+ +Table 2: Dataset statistics. + +MnHdaJIHH (aJeHOnIbI)") or "hypertrophy of adenoids exclusively" ("TnIepTpOphna HsckJIIOHTeJIbHO aJeHOnIOB"), two different CUIs. This effect often leads to inconsistencies between annotators. + +# 2.4 Train/test Splits + +We release the full annotated corpus along with three test sets, setting aside $30\%$ of the corpus and then applying different filtering strategies. Table 2 shows the statistics for each split. + +Stratified. In this case, we filter the test set so that each UMLS concept appears in the test set appears at least once in the training set, but not this specific mention from the test set (Miftahutdinov and Tutubalina, 2019). Thus, $100\%$ of concepts in this test set are covered in the training set, but no mentions in the training set are literally the same as mentions in the test set. + +Zero-shot. In this case, we filter the test set to contain only novel concepts that do not appear in the training set at all. In other words, the Stratified split is designed to ensure that the model encounters the same concepts in the training, development, and test sets, but with different surface forms, while the Zero-Shot split instead exposes models to unseen terms and concepts in the development and testing sets, making it the harder setting of the two. + +CUI-less. In this case, we supplement the random train/test split with $30\%$ of the cases where there is no CUI associated with an entity. This set is intended to test whether a linking system is able to refrain from linking to a concept when there is no suitable concept in the vocabulary ("CUI-less" category in CLEF/SemEval challenges). We call the "full test set" and "full train set" the subsets with this addition of CUI-less cases, and use "in-KB" for subsets without CUI-less mentions. Stratified and zero-shot settings are commonly used in general domain entity linking, but the CUI-less setting is specific for medical data. + +XL-BEL, RuWordNet medical, and MCN train + +
ModelIn-KB testFull testStratified testZero-shot test
Acc@1Acc@5Acc@1Acc@5Acc@1Acc@5Acc@1Acc@5
Tf-Idf37.58%46.98%--25.83%34.20%26.27%41.01%
Multilingual BERT29.01%33.74%29.15%33.16%12.32%16.35%15.90%19.35%
RuBERT25.17%28.22%24.05%25.66%11.53%14.53%13.82%17.51%
SapBERT45.84%56.41%37.18%37.47%30.02%40.44%29.49%40.78%
SapBERT+MCN46.51%56.45%43.67%53.23%30.41%40.60%27.88%41.47%
SapBERT+RWN45.47%55.12%43.30%50.19%29.94%39.42%29.03%38.48%
SapBERT+XL-BEL47.77%58.74%40.80%42.30%32.54%42.97%29.95%45.16%
SapBERT+RuCCoN59.26%68.99%53.39%60.02%47.31%61.45%32.95%47.47%
SapBERT+RuCCoN+RWN57.84%68.55%52.67%58.79%47.79%63.67%32.49%46.31%
SapBERT+RuCCoN+XL-BEL58.78%68.05%53.20%59.80%46.52%59.08%33.41%48.85%
SapBERT+RuCCoN+RWN+XL-BEL58.55%67.82%52.65%59.20%50.32%62.48%33.41%45.85%
+ +Table 3: Evaluation results with test set filtering. + +ing sets. In our basic evaluation setting, we use only our own labeled dataset for training and testing. However, we could also supplement the training set with other resources. First, the XL-BEL cross-lingual biomedical entity linking benchmark maps entity mentions from Wikipedia to UMLS in a number of languages, including Russian (Liu et al., 2021b). Second, we have applied the following linking procedure to the medical part of RuWordNet (RWN) (Loukachevitch et al., 2016): found all lemmas of RWN synsets from the medical domain, intersected these synsets with lemmatized Russian UMLS terms, composed the vocabulary of synsets that have at least one lemma in UMLS, and filtered out exact matches with UMLS, resulting in a set of senses not contained in UMLS but from synsets with another sense contained in both UMLS and RuWordNet. We note that both RWN and XL-BEL have small intersection of 13 and 9 CUIs with zero-shot RuCCoN test set, respectively. + +Third, we also test cross-lingual entity linking with models trained on the MCN (Medical Concept Normalization) dataset (Luo et al., 2019), a large-scale manually annotated corpus in English for clinical concept normalization produced from a corpus released for the 4th i2b2/VA shared task (Uzuner et al., 2011). Statistics for all supplementary datasets are also shown in Table 2. + +# 3 Evaluation + +For entity linking, we use ranking based on embeddings of a mention and a possible concept. Each entity mention and concept name are first passed through a model that produces their embeddings and then through a pooling layer that yields a fixed-sized vector. The inference task is then reduced to finding the closest concept name representation to the entity mention representation in a common embedding space, where the Euclidean distance can be + +used as the metric. Nearest concept names are chosen as top- $k$ concepts for entities. For ranking, we use the publicly available code $^2$ from (Tutubalina et al., 2020). + +We compare ranking models based on several different embeddings: + +1. Tfidf: standard sparse tfidf representations constructed on character-level unigrams and bigrams; +2. BERT: multilingual BERT embeddings with no fine-tuning (Devlin et al., 2019); this is a cross-lingual baseline that has not been trained on biomedical texts; +3. RuBERT: Russian BERT embeddings (Kuratov and Arkhipov, 2019) trained on the Russian part of Wikipedia and news data; +4. SapBERT: a BERT-based metric learning framework that generates hard triplets based on the UMLS for large-scale pre-training (Liu et al., 2021a) and also allows for a crosslingual variant trained on XL-BEL (Liu et al., 2021b). + +Additionally, we compare several variations of fine-tuning on datasets with training sets via synonym marginalization as suggested by the authors of BioSyn (Sung et al., 2020): + +1. $SapBERT + RuCCoN$ , with fine-tuning on our target train set of EHRs; +2. $SapBERT + MCN$ , with tuning on the MCN set; +3. $SapBERT + WRN$ , on the dataset extracted from the medical part of the RuWordNet thesaurus; + +4. SapBERT+XL-BEL, on the the Russian part of XL-BEL; +5. SapBERT+RuCCoN+RWMXL-BEL, on the combination of all three sets. + +For training, we have used the publicly available code provided by the authors at https://github.com/dmis-lab/BioSyn with the following parameters: the number of top candidates $k$ is 20, the mini-batch size is 16, the learning rate is 1e-5, the dense ratio for candidate retrieval is 0.5, the number of epochs is 5. To deal with nil prediction, we apply the strategy from (Miftahutdinov et al., 2021); a mention is out of KB if the nearest candidate is further than a threshold in terms of weighted average of two distances: minimum distance of false positives and maximum distance of true positives, as computed on the train set. + +Following previous works on entity linking (Suominen et al., 2013; Pradhan et al., 2014; Wright et al., 2019; Phan et al., 2019; Sung et al., 2020; Miftahutdinov et al., 2021; Tutubalina et al., 2020), we use top- $k$ accuracy as the evaluation metric: $\mathrm{Acc}@\mathrm{k} = 1$ if the correct CUI is retrieved at rank $\leq k$ , otherwise $\mathrm{Acc}@\mathrm{k} = 0$ . Table 3 shows the Acc@1 and Acc@5 metrics for our test sets. We see that SapBERT significantly outperforms other models, and steadily improves the results as more datasets are added for fine-tuning. Note how SapBERT trained on RuCCoN is much better on the full test set that SapBERT trained on other data, but the difference almost disappears on the zero-shot test, suggesting that it was almost entirely due to specific entities labeled in the training set. This confirms the need to label additional data to further improve the results of even the best state-of-the-art entity linking models, which is what RuCCoN itself provides for the Russian language. Another result is that fine-tuning on additional medical data is generally beneficial; e.g., we have found that SapBERT fine-tuned on English clinical notes outperforms basic SapBERT consistently across all datasets in our study. + +# 4 Error Analysis + +To better understand the quality of our best model, we analyzed its erroneous predictions. For analysis, we randomly selected 100 erroneous predictions, which were then analyzed by an expert annotator with Ph.D. in medicine. As can be seen from Table 4, most of the errors are related to the lexical + +
Cause of errorNumber of mentions
No obvious reason18
Lexical similarity38
Nested entity11
Semantic similarity19
Complete synonymy9
Annotation error5
+ +Table 4: Manual evaluation of incorrect predictions of the SapBERT+RuCCoN model on 100 randomly selected mentions from the in-KB test set. + +similarity of incorrectly predicted entities (for example, the text "concor" was incorrectly associated with the entity C0009738 "Congo" due to the similarity of spelling; for the same reason, the text "decrease in EF" was incorrectly associated with the entity C0520837 "decrease in FEV"). An interesting fact is that in second place in the frequency of errors are predictions close in meaning to the source text. For example, the source text "bilateral acute maxilloethmoidal sinusitis" was associated with the entity C0155806 "acute ethmoiditis". This entity is not a complete synonym of the source text, but it is very close to its meaning. It should be noted that the errors described in the last two rows of the table are not inherently errors. Some of the errors are related to the complete synonymy of ground truth and model prediction. For example, the text "biliary tract dysfunction" was annotated as C0005395 "pathology of the biliary tract", while the model predicted the entity C0005424 "biliary tract disease", which in its meaning is a complete synonym, but does not coincide with the golden truth according to CUI. + +# 5 Conclusion + +In this work, we have presented RuCCoN, a new clinical concept normalization dataset in Russian, labeled by medical professionals and accompanied with several train/test splits for fair evaluation in various settings. We make RuCCoN publicly available for research purposes, and we hope that future works will make use of RuCCoN as a training and evaluation resource. + +# Acknowledgements + +The work on experiments with MCN, WRN, and XL-BEL corpora was done by Z.M. and supported by the Russian Science Foundation [grant number 18-11-00284]. We are grateful to annotators. + +# References + +Olivier Bodenreider. 2004. The unified medical language system (umlts): integrating biomedical terminology. *Nucleic acids research*, 32(suppl_1):D267-D270. +Elliot G Brown, Louise Wood, and Sue Wood. 1999. The medical dictionary for regulatory activities (meddra). Drug safety, 20(2):109-117. +Margaret H Coletti and Howard L Bleich. 2001. Medical subject headings used to search the biomedical literature. Journal of the American Medical Informatics Association, 8(4):317-323. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. Bert: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171-4186. +Noémie Elhadad, Sameer Pradhan, Sharon Gorman, Suresh Manandhar, Wendy Chapman, and Guergana Savova. 2015. Semeval-2015 task 14: Analysis of clinical text. In proceedings of the 9th International Workshop on Semantic Evaluation (SemEval 2015), pages 303-310. +Arden W Forrey, Clement J Mcdonald, Georges DeMoor, Stanley M Huff, Dennis Leavelle, Diane Leland, Tom Fiers, Linda Charles, Brian Griffin, Frank Stalling, et al. 1996. Logical observation identifier names and codes (loinc) database: a public use set of codes and names for electronic reporting of clinical laboratory test results. Clinical chemistry, 42(1):81-90. +Yuri Kuratov and Mikhail Arkhipov. 2019. Adaptation of deep bidirectional multilingual transformers for russian language. arXiv preprint arXiv:1905.07213. +Fangyu Liu, Ehsan Shareghi, Zaiqiao Meng, Marco Basaldella, and Nigel Collier. 2021a. Self-alignment pretraining for biomedical entity representations. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 4228-4238. +Fangyu Liu, Ivan Vulic, Anna Korhonen, and Nigel Collier. 2021b. Learning domain-specialised representations for cross-lingual biomedical entity linking. In ACL/IJCNLP (2), pages 565-574. +Natalia V Loukachevitch, German Lashevich, Anastasia A Gerasimova, Vladimir V Ivanov, and Boris V Dobrov. 2016. Creating russian wordnet by conversion. In Computational Linguistics and Intellectual Technologies: papers from the Annual conference Dialogue, pages 405-415. + +Yen-Fu Luo, Weiyi Sun, and Anna Rumshisky. 2019. Mcn: A comprehensive corpus for medical concept normalization. Journal of biomedical informatics, 92:103132. +Zulfat Miftahutdinov, Artur Kadurin, Roman Kudrin, and Elena Tutubalina. 2021. Medical concept normalization in clinical trials with drug and disease representation learning. Bioinformatics, 37(21):3856-3864. +Zulfat Miftahutdinov and Elena Tutubalina. 2019. Deep neural models for medical concept normalization in user-generated texts. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics: Student Research Workshop, pages 393-399, Florence, Italy. Association for Computational Linguistics. +Antonio Miranda-Escalada, Eulàlia Farré, and Martin Krallinger. 2020a. Named entity recognition, concept normalization and clinical coding: Overview of the cantemist track for cancer text mining in spanish, corpus, guidelines, methods and results. In IberLEF SEPLN, pages 303-323. +Antonio Miranda-Escalada, Aitor Gonzalez-Agirre, Jordi Armengol-Estapé, and Martin Krallinger. 2020b. Overview of automatic clinical coding: annotations, guidelines, and solutions for non-english clinical cases at codiesp track of clef ehealth 2020. In Working Notes of Conference and Labs of the Evaluation (CLEF) Forum. CEUR Workshop Proceedings. + +NIH 2021. a. Nih umls statistics. + +NIH 2021. b. Ums metathesaurus browser. + +Minh C Phan, Aixin Sun, and Yi Tay. 2019. Robust representation learning of biomedical names. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 3275-3285. +Sameer Pradhan, Wendy Chapman, Suresh Man, and Guergana Savova. 2014. SemEval-2014 task 7: Analysis of clinical text. In Proc. of the 8th International Workshop on Semantic Evaluation (SemEval 2014). CiteSeer. +Sameer Pradhan, Noémie Elhadad, Brett R South, David Martinez, Lee Christensen, Amy Vogel, Hanna Suominen, Wendy W Chapman, and Guergana Savova. 2015. Evaluating the state of the art in disorder recognition and normalization of the clinical narrative. Journal of the American Medical Informatics Association, 22(1):143-154. +Susan Rea, Jyotishman Pathak, Guergana Savova, Thomas A Oniki, Les Westberg, Calvin E Beebe, Cui Tao, Craig G Parker, Peter J Haug, Stanley M Huff, et al. 2012. Building a robust, scalable and standards-driven infrastructure for secondary use of ehr data: the sharpn project. Journal of biomedical informatics, 45(4):763-771. + +AO Shelmanov, IV Smirnov, and EA Vishneva. 2015. Information extraction from clinical texts in russian. In Computational Linguistics and Intellectual Technologies, pages 560-572. +Pontus Stenetorp, Sampo Pyysalo, Goran Topic, Tomoko Ohta, Sophia Ananiadou, and Junichi Tsujii. 2012. Brat: a web-based tool for nlp-assisted text annotation. In Proceedings of the Demonstrations at the 13th Conference of the European Chapter of the Association for Computational Linguistics, pages 102-107. +Mujeen Sung, Hwisang Jeon, Jinhyuk Lee, and Jaewoo Kang. 2020. Biomedical entity representations with synonym marginalization. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 3641-3650. +Hanna Suominen, Sanna Salanterä, Sumithra Velupillai, Wendy W Chapman, Guergana Savova, Noemie Elhadad, Sameer Pradhan, Brett R South, Danielle L Mowery, Gareth JF Jones, et al. 2013. Overview of the share/clef ehealth evaluation lab 2013. In International Conference of the Cross-Language Evaluation Forum for European Languages, pages 212-231. Springer. +Elena Tutubalina, Artur Kadurin, and Zulfat Miftahutdinov. 2020. Fair evaluation in concept normalization: a large-scale comparative analysis for bert-based models. In Proceedings of the 28th International Conference on Computational Linguistics, pages 6710-6716. +Ozlem Uzuner, Brett South, Shuying Shen, and Scott DuVall. 2011. 2010 i2b2/va challenge on concepts, assertions, and relations in clinical text. Journal of the American Medical Informatics Association: JAMIA, 18:552-6. +Dustin Wright, Yannis Katsis, Raghav Mehta, and ChunNan Hsu. 2019. Normco: Deep disease normalization for biomedical knowledge base construction. In Automated Knowledge Base Construction. \ No newline at end of file diff --git a/rucconclinicalconceptnormalizationinrussian/images.zip b/rucconclinicalconceptnormalizationinrussian/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..df324adf70d50d82fa14a22f37a850a90cdd0e4b --- /dev/null +++ b/rucconclinicalconceptnormalizationinrussian/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b8c7ac7ceed99942205cead061916496e51ea784fb59ad6055fd399a8066580a +size 218609 diff --git a/rucconclinicalconceptnormalizationinrussian/layout.json b/rucconclinicalconceptnormalizationinrussian/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..bbb645e597c66943a31d2125aaa86db637a981a6 --- /dev/null +++ b/rucconclinicalconceptnormalizationinrussian/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:836ece4d57ad3af46e151ff49d8b957f714a5ff1210095ba04a76d81aa92f594 +size 193046 diff --git a/s2sqlinjectingsyntaxtoquestionschemainteractiongraphencoderfortexttosqlparsers/d85a616f-e821-4bda-9775-3af8eb384860_content_list.json b/s2sqlinjectingsyntaxtoquestionschemainteractiongraphencoderfortexttosqlparsers/d85a616f-e821-4bda-9775-3af8eb384860_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..38c569286ee900f3505eba832c4bb73c1c2bf2ef --- /dev/null +++ b/s2sqlinjectingsyntaxtoquestionschemainteractiongraphencoderfortexttosqlparsers/d85a616f-e821-4bda-9775-3af8eb384860_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2753eaef08ab5b2297e2f5291eb5efa45ecdc8640935ab17422ad0d777573864 +size 51311 diff --git a/s2sqlinjectingsyntaxtoquestionschemainteractiongraphencoderfortexttosqlparsers/d85a616f-e821-4bda-9775-3af8eb384860_model.json b/s2sqlinjectingsyntaxtoquestionschemainteractiongraphencoderfortexttosqlparsers/d85a616f-e821-4bda-9775-3af8eb384860_model.json new file mode 100644 index 0000000000000000000000000000000000000000..a7e7f0328b49266a70fc6399e7cbdba6a486fce2 --- /dev/null +++ b/s2sqlinjectingsyntaxtoquestionschemainteractiongraphencoderfortexttosqlparsers/d85a616f-e821-4bda-9775-3af8eb384860_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4df911f596bbeb5943fefa052d95e791a572aeca6afe57bf3af99bb1bdc38747 +size 67488 diff --git a/s2sqlinjectingsyntaxtoquestionschemainteractiongraphencoderfortexttosqlparsers/d85a616f-e821-4bda-9775-3af8eb384860_origin.pdf b/s2sqlinjectingsyntaxtoquestionschemainteractiongraphencoderfortexttosqlparsers/d85a616f-e821-4bda-9775-3af8eb384860_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..72522cf5138405693ce50db07330201cc6a2a566 --- /dev/null +++ b/s2sqlinjectingsyntaxtoquestionschemainteractiongraphencoderfortexttosqlparsers/d85a616f-e821-4bda-9775-3af8eb384860_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:87e9808823ca872b3a8328144ebc8729b229e3367288ca112d7def6bb82b7290 +size 573253 diff --git a/s2sqlinjectingsyntaxtoquestionschemainteractiongraphencoderfortexttosqlparsers/full.md b/s2sqlinjectingsyntaxtoquestionschemainteractiongraphencoderfortexttosqlparsers/full.md new file mode 100644 index 0000000000000000000000000000000000000000..8a1ca183261efaafcb3336b7c39e42a8b9fe25a5 --- /dev/null +++ b/s2sqlinjectingsyntaxtoquestionschemainteractiongraphencoderfortexttosqlparsers/full.md @@ -0,0 +1,216 @@ +# $\mathbf{S}^2 \mathbf{SQL}$ : Injecting Syntax to Question-Schema Interaction Graph Encoder for Text-to-SQL Parsers + +Binyuan Hui $^{1}$ , Ruiying Geng $^{1}$ , Lihan Wang $^{1,2,3}$ , Bowen Qin $^{1,2,3}$ , Yanyang Li $^{4}$ , Bowen Li $^{1}$ , Jian Sun $^{1}$ and Yongbin Li $^{1\dagger}$ + +1 Alibaba Group, 2 University of Chinese Academy of Sciences + +3 Shenzhen Institutes of Advanced Technology, Chinese Academy of Sciences +4 The Chinese University of Hong Kong + +{binyuan.hby,ruiying.gry,yanjin.lbw,jian.sun,shuide.lyb}@alibaba-inc.com + +# Abstract + +The task of converting a natural language question into an executable SQL query, known as text-to-SQL, is an important branch of semantic parsing. The state-of-the-art graph-based encoder has been successfully used in this task but does not model the question syntax well. In this paper, we propose $\mathbf{S}^2\mathbf{S}\mathbf{L}\mathbf{Q}$ , injecting Syntax to question-Schema graph encoder for Text-to-SQL parsers, which effectively leverages the syntactic dependency information of questions in text-to-SQL to improve the performance. We also employ the decoupling constraint to induce diverse relational edge embedding, which further improves the network's performance. Experiments on the Spider and robustness setting Spider-Syn demonstrate that the proposed approach outperforms all existing methods when pre-training models are used, resulting in a performance ranks first on the Spider leaderboard. + +# 1 Introduction + +Relational databases are ubiquitous and store a great amount of structured information. The interaction with databases often requires expertise on writing structured code like SQL, which is not friendly for users who are not proficient in query languages. Text-to-SQL aims to automatically translate natural language questions into executable SQL statements (Zelle and Mooney, 1996; Zettlemoyer and Collins, 2005; Wong and Mooney, 2007; Zettlemoyer and Collins, 2007; Berant et al., 2013; Li and Jagadish, 2014; Yaghmazadeh et al., 2017; Iyer et al., 2017). + +Recently, a large-scale, multi-table, realistic text-to-SQL benchmark, Spider (Yu et al., 2018), has been released. The most effective and popular encoder architecture on Spider is the question-schema interaction graph (Wang et al., 2020). Built on that, + +![](images/a366f258ebcbed718902c96859e40a51759fa9a4f9e7d87fe3303e6c7f352e58.jpg) +Figure 1: A typical bad case of the current graph-based methods. If the structure of question (dependencies) are not considered, the wrong SQL will be generated even if the linking is correct. + +many state-of-the-art models have been further developed (Chen et al., 2021; Cao et al., 2021). It jointly models natural language question and structured database schema information, and uses some pre-defined relationships to carve out the interaction between them. However, we observed that the current graph-based model yet has two major limitations. + +Syntactic Modelling. Jointly modeling syntax and semantics is a core problem in NLP. In the paradigm of deep learning, the role of syntax should be better understood for tasks in which syntax is a central feature (Ge and Mooney, 2005; Michalon et al., 2016; Zhang et al., 2019b; Zanzotto et al., 2020), including the text-to-SQL task. For example, Figure 1 shows that the baseline model can learn the correct linking among date, id and transcript between the question and schema, but fail to identify that id should also be included in the SELECT clause. On the other hand, with the help of the dependency tree, date and id are close to each other and thus should appear in the SELECT clause simultaneously. However, almost all available approaches treat the language question as a sequence, and syntactic information is ignored in neural network-based text-to-SQL models. + +Entangled Edge Embedding. The question-schema interaction graph pre-defines a series of edges, and models them as learnable embeddings. These embeddings should be diverse by nature be + +![](images/18d5dd66c2da4d5373781c9b0014be2b5fbdde6eccd8a1ea9cdfce75aa62ab44.jpg) +Figure 2: An overview of S²SQL framework. The S²SQL has three relation types to represent the known syntactic information, linking structure and schema information. There structure are integrated into the question-schema interaction graph by learnable edge embedding with decoupling constraints. + +![](images/25495051f19e98df107896df5867c264d817137038b61eb35a3887fdb184fe90.jpg) + +cause each of them represents a different type of relations and has a different meaning. Previous work (Brock et al., 2019; Zhang et al., 2020) has proved that the learnable embeddings are easy to be entangled and do not satisfy the diversity objective. + +In this paper, we propose S $^2$ SQL, injecting Syntax to question-Schema graph encoder for Text-to-SQL parsers. S $^2$ SQL models the syntactic labels from a syntactic dependency tree as additional edge embeddings. Motivated by the belief that if the structure of input can be reliably obtained and is a central feature of a task, models that explicitly exploit the structure can benefit. In this paper, we investigate and prove that properly introducing syntactic information into text-to-SQL can further improve the performance, and we provide a detailed analysis on why and how the proposed model works. Built on that, we propose a decoupling constraint to encourage the model to learn a diverse set of relation embeddings, which further enhances the network's performance. We evaluate our proposed model on the challenging text-to-SQL benchmark Spider (Yu et al., 2018) and robustness setting Spider-Syn (Gan et al., 2021), and demonstrate that S $^2$ SQL outperforms other graph-based models consistently when augmented with different pre-training models. In brief, the contributions of our work are three-fold: + +- We investigate the importance of syntax in text-to-SQL and propose a novel and strong encoder for cross-domain text-to-SQL, namely $\mathrm{S}^2\mathrm{SQL}$ . +- To induce the diverse edge embedding learn + +ing, we introduce the decoupling constraint, which further improves the performance. + +- The empirical results show that our approach outperforms all the existing models on the challenging Spider and Spider-Syn benchmark. + +# 2 The Proposed Method + +# 2.1 Problem Definition + +Given a natural language question $\mathcal{Q} = \{q_i\}_{i=1}^{|Q|}$ and a schema $\mathcal{S} = \langle \mathcal{C}, \mathcal{T} \rangle$ consisting of columns $\mathcal{C} = \{c_1^{t_1}, c_2^{t_1}, \dots, c_1^{t_2}, c_2^{t_2}, \dots\}$ and tables $\mathcal{T} = \{t_i\}_{i=1}^{|T|}$ , text-to-SQL aims to generate the SQL query $y$ for the question sentence. The de facto method for text-to-SQL employs an encoder-decoder architecture. In this paper we focus on improving the encoder part. For a detailed description of the decoder, please refer to the work of (Wang et al., 2020; Cao et al., 2021). + +# 2.2 Question-Schema Interaction Graph + +The joint input questions and schema items can be viewed as a graph $\mathcal{G} = (\mathcal{V},\mathcal{R})$ where $\mathcal{V} = \mathcal{Q}\cup \mathcal{T}\cup \mathcal{C}$ are nodes of three types $\{\mathcal{Q},\mathcal{T},\mathcal{C}\}$ . The initial node embeddings matrix $\mathbf{X}\in \mathbb{R}^{|V|\mathcal{Q}| + |\mathcal{T}| + |\mathcal{C}|}\times d$ is obtained by flattening all question tokens and schema items into a sequence: [CLS] $q_{1}q_{2}\dots q_{|Q|}$ [SEP] $t_{10}t_{1}c_{10}^{t_{1}}c_{1}^{t_{1}}c_{20}^{t_{1}}c_{2}^{t_{1}}\dots$ $t_{20}t_{2}c_{10}^{t_{2}}c_{1}^{t_{2}}c_{20}^{t_{2}}c_{2}^{t_{2}}\dots$ [SEP]. The type information $t_{i0}$ or $c_{j0}^{t_i}$ is inserted before each schema item. The edge $\mathcal{R} = \{R\}_{i = 1,j = 1}^{|X|,|X|}$ represents the known relation between two elements in the input nodes. + +The RGAT (relational graph attention transformers) (Shaw et al., 2018; Wang et al., 2020; Cao et al., 2021) models the graph $\mathcal{G}$ and computes the output representation $\mathbf{z}$ by: + +$$ +\begin{array}{l} e _ {i j} ^ {(h)} = \frac {\mathbf {x} _ {i} \mathbf {W} _ {q} ^ {(h)} \left(\mathbf {x} _ {j} \mathbf {W} _ {k} ^ {(h)} + \mathbf {r} _ {i j} ^ {K}\right) ^ {\top}}{\sqrt {d _ {z} / H}}, \\ \alpha_ {i j} ^ {(h)} = \operatorname {s o f t m a x} \left\{e _ {i j} ^ {(h)} \right\}, \tag {1} \\ \mathbf {z} _ {i} ^ {(h)} = \sum_ {v _ {j} ^ {n} \in \mathcal {N} _ {i} ^ {n}} \alpha_ {i j} ^ {(h)} \left(\mathbf {x} _ {j} \mathbf {W} _ {v} ^ {(h)} + \mathbf {r} _ {i j} ^ {V}\right), \\ \end{array} +$$ + +where matrices $\mathbf{W}_q, \mathbf{W}_k, \mathbf{W}_v$ are trainable parameters in self-attention, and $\mathcal{N}_i^n$ is the receptive field of node $v_i^n$ . + +Injecting Syntax The previous work mainly focuses on using linking structure and schema structure in the encoder (Wang et al., 2020), in which the structure of the question is ignored. We proposed an effective approach to integrate syntactic dependency information into the graph. A straightforward idea is to treat all dependent types directly as a new edge type. However, the dependency parser will return 55 different dependency types. Such a large number of edge types will significantly increase the number of relational embedding parameters in S²SQL, leading to over-fitting. In order to address this, similar to (Vashishth et al., 2018), we induct dependency types into three abstract relations, Forward, Backward and NONE. In addition, in order to ensure the simplicity of edge embedding, we only consider the first-order relationship. By stacking multi-layer transformers, the model implicitly captures the multi-order relationship without deliberate construction. Specifically, we compute the distance $D(v_{i}, v_{j})$ between any two tokens $v_{i}$ and $v_{j}$ from the question. This distance is set to the first-order distance between $v_{i}$ and $v_{j}$ if they have the aforementioned dependency types, and 0 otherwise. Based on this first-order distance $D$ , we model the syntactic relation $R_{ij}^{\text{question}}$ between tokens $v_{i}$ and $v_{j}$ by one of the three previously defined abstract types: + +$$ +\mathcal {R} _ {i j} ^ {\text {q u e s t i o n}} = \left\{ \begin{array}{c l} \text {F o r w a r d ,} & \text {i f} D (v _ {i}, v _ {j}) = 1 \\ \text {B a c k w a r d ,} & \text {i f} D (v _ {j}, v _ {i}) = 1 \\ \text {N O N E ,} & \text {o t h e r w i s e .} \end{array} \right. \tag {2} +$$ + +Overall, as shown in Figure 2, $\mathrm{S}^2\mathrm{SQL}$ models three structures in the graph $\mathcal{G}$ : + +- Question Structure $\mathcal{R}^{\text {question }}$ : relations that represent syntactic dependency between two question tokens. +- Linking Structure $\mathcal{R}^{\mathrm{linking}}$ : relations that align entity in question to the corresponding schema columns or tables. (Wang et al., 2020) +- Schema Structure $\mathcal{R}^{\mathrm{schema}}$ : relations within a database schema, e.g., foreign key. + +The detailed structure construction could be found in Appendix A.1. + +Decoupling Constraint. There are $k$ known edges in $\mathcal{R}$ and each is represented as a relation embedding. Intuitively, these edge embedding $\mathbf{r} = [\mathbf{r}_1,\mathbf{r}_2,\dots,\mathbf{r}_k]$ should be diverse because they have different semantic meanings. To avoid the potential risk of coupling edge embedding $\mathbf{r}$ during optimization, we introduce the orthogonality condition (Brock et al., 2019) to $\mathbf{r}$ : + +$$ +\mathcal {L} (\mathbf {r}) = \left\| \mathbf {r} ^ {\top} \mathbf {r} \odot (1 - I) \right\| _ {\mathrm {F}} ^ {2}, \tag {3} +$$ + +where $\mathbf{1}$ denotes a matrix with all elements being set to 1 and $I$ is the identity matrix. + +# 3 Experiments + +# 3.1 Experiment Setup + +Datasets and Evaluation Metrics. We conduct experiments on Spider (Yu et al., 2018) and SpiderSyn (Gan et al., 2021). Spider is a large-scale, complex, and cross-domain text-to-SQL benchmark. Spider-Syn is derived from Spider, by replacing their schema-related words with manually selected synonyms that reflect real-world question paraphrases. For evaluation, we followed the official evaluation to report exact match accuracy. + +# 3.2 Implementation Details. + +We utilize PyTorch (Paszke et al., 2019) to implement our proposed model. During pre-processing, the input of questions, column names, and table names are tokenized and lemmatized with the Standford Nature Language Processing toolkit. For a fair comparison with baselines, we configure it with the same set of hyper-parameters, e.g., stacking 8 self-attention layers, setting dropout to 0.1. The position-wise feed-forward network has an inner layer dimension of 1024. Inside the decoder, we use rule embeddings of size 128, node type embeddings of size 64, and a hidden size of 512 inside the LSTM with a dropout of 0.21. + +
ModelDev.Test
Global-GNN (Bogin et al., 2019)52.747.4
Eidt-SQL (Zhang et al., 2019a)57.653.4
Bertand-DR (Kelkar et al., 2020)57.954.6
IRNet v2 (Guo et al., 2019)63.955.0
BRIDGE (Lin et al., 2020)70.065.0
RYANSQL (Choi et al., 2020)70.660.6
RATSQL + BERT (Wang et al., 2020)69.765.6
ShadowGNN + RoBERTa (Chen et al., 2021)72.366.1
RAT + RoBERTa (Wang et al., 2020)69.764.3
S2SQL + RoBERTa71.467.1
w/o DC70.9-
LGESQL + ELECTRA (Cao et al., 2021)75.172.0
S2SQL + ELECTRA76.472.1
w/o DC75.8-
+ +![](images/39d9b8ee93ef840ba68216957d84b42c475159442c816c642b192855f9ca8851.jpg) +(a) $\mathrm{S}^2\mathrm{SQL}\mathrm{w / o}\mathrm{DC}$ + +![](images/c07704f1008ff6cb2f25157401e4c1063bf9cf6d196d2019ddaf45f78517073b.jpg) +(b) S²SQL w/ DC +Figure 3: The similarity matrix of different relation embeddings with and without DC. The lighter the color, the higher the similarity (entangled embeddings). + +# 3.3 Baseline Models. + +We conduct experiments on Spider and Spider-Syn and compare our method with several baselines including: + +- RYANSQL (Choi et al., 2020) is a sketch-based slot filling approach which is proposed to synthesize each SELECT statement for its corresponding position. +- RATSQL (Wang et al., 2020) is a relation aware schema encoding model in which the question-schema interaction graph is built by n-gram patterns. +- ShadowGNN (Chen et al., 2021) processes schemas at abstract and semantic levels with domain-independent representations. +BRIDGE (Lin et al., 2020) represents the question and schema in a tagged sequence where a subset of the fields are augmented with cell values mentioned in the question. +- LGESQL (Cao et al., 2021) a line graph en + +Table 1: The exact match accuracy on the Spider dev and test set. - indicates that the test set performance cannot be obtained due to the number of submission limit. + +
ModelDev.
RAT + GraPPa (Yu et al., 2021) †71.5
S²SQL + GraPPa73.4
RAT + GAP (Shi et al., 2021) †71.8
S²SQL + GAP72.7
+ +Table 2: Comparison on ${\mathrm{S}}^{2}\mathrm{{SQL}}$ under the different table-based pre-training models on Spider Dev set. + +
ModelAcc.
Global-GNN (Bogin et al., 2019)23.6
IRNet (Guo et al., 2019)28.4
RATSQL (Wang et al., 2020)33.6
RATSQL + BERT (Wang et al., 2020)48.2
RATSQL + Grappa (Wang et al., 2020)49.1
S2SQL + Grappa51.4
+ +Table 3: The accuracy on the Spider-Syn dataset. + +hanced Text-to-SQL model to mine the underlying relational features without constructing metapaths. It was the SOTA model in the Spider leaderboard before ours. + +# 3.4 Results and Analyses + +Overall Performance. We first compare $S^2$ SQL with other state-of-the-art models on Spider. As shown in Table1, we can see that $S^2$ SQL outperforms all existing models. Remarkably, the accuracy of $S^2$ SQL + RoBERTa on the hidden test set is $67.1\%$ , which is $2.8\%$ higher than the strong baseline $\text{RAT} + \text{RoBERTa}$ . Similarity, the accuracy of the SOTA model LGESQL + ELECTRA is $72.0\%$ on the hidden test set, and $75.1\%$ on the development set, while $S^2$ SQL + ELECTRA can reach $72.1\%$ test and 76.4 development accuracy. Table 2 shows results on the development set for RAT and $S^2$ SQL with Table-based pre-training models. We can see that $S^2$ SQL outperforms RAT consistently when augmented with different pre-training models, including RoBERTa (Liu et al., 2019), GraPPa (Yu et al., 2021) and GAP (Shi et al., 2021). In addition, as shown in Table 3, $S^2$ SQL demonstrates improvement on the robustness dataset. + +Ablation Study. The last row of Table 1 shows that removing the decoupling constraint causes a $0.5\%$ performance drop on the development set. This implies that decoupling entangled embeddings helps to improve the performance. To examine the impact of the decoupling constraint, we visualize the cosine similarity between any two relation em + +
QuestionList the name and tonnage in alphabetical descending order for the names.
BaselineSELECT name, tonnage FROM ship ORDER BY tonnage DESC
S2SQLSELECT name, tonnage FROM ship ORDER BY name DESC
GoldSELECT name, tonnage FROM ship ORDER BY name DESC
Syntax(name, tonnage, CONJ), (order, names, NMOD)
QuestionWhat is the total population and average area of countries in the continent of North America whose area is bigger than 3000?
BaselineSELECT sum(population), avg(surface_area) FROM country where surface_area = "North America" and surface_area > 3000
S2SQLSELECT sum(population), avg(surface_area) FROM country where continent = "North America" and surface_area > 3000
GoldSELECT sum(population), avg(surface_area) FROM country where continent = "North America" and surface_area > 3000
Syntax(continent, America, NMOD)
QuestionShow the date of the transcript which shows the least number of results, also list the id.
BaselineSELECT transcript_date FROM Transcript Contexts AS T1 JOIN ...
S2SQLSELECT transcript_date, transcript_id FROM Transcript Contexts AS T1 JOIN ...
GoldSELECT transcript_date, transcript_id FROM Transcript Contexts AS T1 JOIN ...
Syntax(show, list, DEP) (show, date, OBJ) (list, id, OBJ)
+ +Table 4: Case study: some comparisons with baseline (LGESQL) show that $S^2$ SQL can generate more accurate SQL, where syntax column represents useful syntactic information in the generation of $S^2$ SQL. + +beddings. As shown in Figure 3, we observe that the decoupling constraint eliminates the entangling phenomenon (darker colors) and produces a more diverse set of embeddings. + +# 3.5 Qualitative Analysis. + +In Table 4, we compare the SQL queries generated by our S²SQL model with those created by the baseline model LGESQL. We notice that S²SQL performs better than the baseline system, especially in the case of question understanding that depends on syntax structure. For example, in the first case where the order and name have NMOD relation, baseline fails to For example, in the first example, both name and tonnage can be linked correctly, but the baseline fails to capture the structure present in name and order, resulting in a generation error, while S²SQL predicts the result well. + +# 3.6 About Syntactic Parser. + +In our experiments, we use the SpaCy tool as a syntactic parser. It is important to emphasize that the quality of the SpaCy syntactic parsing has marginal impact on the performance of S2SQL. The following three main reasons are given. + +- SpaCy is the current SOTA parser tool (95%+ accuracy on the OntoNotes 5.0 corpus) and has been widely used in various papers introducing syntax, which proves its reliability. +- The question in Spider are not extremely complex and can be handled very well. +- Even though syntactic parser errors may introduce noise into S2SQL, our proposed inductive syntactic injection method (instead of independent injection) can mitigate the impact of syntactic type errors. + +# 4 Related Work + +Extensive work has been conducted on improving the encoder and decoder (Yin and Neubig, 2017; Wang et al., 2019; Guo et al., 2019; Choi et al., 2020; Kelkar et al., 2020; Rubin and Berant, 2021; Hui et al., 2021b) as well as table-based pretraining (Yin et al., 2020; Yu et al., 2021; Deng et al., 2020; Shi et al., 2021; Wang et al., 2021b). Besides, Wang et al. (2021a) proposed a meta-learning based training objective to boost generalization. Scholak et al. (2021) proposed PICARD, a method for constraining auto-regressive decoders of T5. Among the encoder-related work, Guo et al. (2019) introduced the schema linking module, which aimed to recognize the columns and the tables mentioned in a question. Lin et al. (2020) leveraged the database content to augment the schema representation. Boin et al. (2019) employed GNN to derive the representation of the schema structure. Then, Chen et al. (2021) proposed ShadowGNN to abstract the representation of question and schema with attention. Besides, Hui et al. (2021a) present a dynamic graph framework that can model contextual information for context-dependent setting. The most recent approaches (Wang et al., 2020; Cao et al., 2021) achieved the best performance through relation-aware transformer. Unlike these works, we investigated the impact of the syntactic structures during the encoding stage. + +# 5 Conclusion + +We present syntax-enhanced question-schema graph encoder (S²SQL) that can effectively model syntactic information for text-to-SQL and introduce the decoupling constraint to induce the diverse relation embedding. The proposed model achieves new state-of-the-art performance on the widely used benchmark, Spider and Spider-Syn. + +# References + +Jonathan Berant, Andrew Chou, Roy Frostig, and Percy Liang. 2013. Semantic parsing on freebase from question-answer pairs. In EMNLP. +Ben Boin, Matt Gardner, and Jonathan Berant. 2019. Global reasoning over database structures for text-tosql parsing. In EMNLP-IJCNLP. +Andrew Brock, J. Donahue, and K. Simonyan. 2019. Large scale gan training for high fidelity natural image synthesis. In ICLR. +Ruisheng Cao, Lu Chen, Zhi Chen, Yanbin Zhao, Su Zhu, and Kai Yu. 2021. Lgesql: Line graph enhanced text-to-sql model with mixed local and non-local relations. In ACL. +Zhi Chen, Lu Chen, Yanbin Zhao, Ruisheng Cao, Zihan Xu, Su Zhu, and Kai Yu. 2021. Shadowgnn: Graph projection neural network for text-to-sql parser. In NAACL. +Donghyun Choi, M. Shin, Eunggyun Kim, and Dong Ryeol Shin. 2020. Ryansql: Recursively applying sketch-based slot fillings for complex text-to-sql in cross-domain databases. ArXiv, abs/2004.03125. +Xiang Deng, Ahmed Hassan Awadallah, Christopher Meek, Oleksandr Polozov, Huan Sun, and Matthew Richardson. 2020. Structure-grounded pretraining for text-to-sql. ArXiv, abs/2010.12773. +Yujuan Gan, Xinyun Chen, Qiuping Huang, Matthew Purver, John R. Woodward, Jinxia Xie, and Pengsheng Huang. 2021. Towards robustness of text-to-SQL models against synonym substitution. In ACL. +Ruifang Ge and R. Mooney. 2005. A statistical semantic parser that integrates syntax and semantics. In CoNLL. +Jiaqi Guo, Zecheng Zhan, Yan Gao, Yan Xiao, JianGuang Lou, Ting Liu, and Dongmei Zhang. 2019. Towards complex text-to-SQL in cross-domain database with intermediate representation. In ACL. +Binyuan Hui, Ruiying Geng, Qiyu Ren, Binhua Li, Yongbin Li, Jian Sun, Fei Huang, Luo Si, Pengfei Zhu, and Xiaodan Zhu. 2021a. Dynamic hybrid relation exploration network for cross-domain context-dependent semantic parsing. In AAAI. +Binyuan Hui, Xiang Shi, Ruiying Geng, Binhua Li, Yongbin Li, Jian Sun, and Xiaodan Zhu. 2021b. Improving text-to-sql with schema dependency learning. ArXiv, abs/2103.04399. +Srinivasan Iyer, Ioannis Konstas, Alvin Cheung, Jayant Krishnamurthy, and Luke Zettlemoyer. 2017. Learning a neural semantic parser from user feedback. In ACL. +Amol Kelkar, R. Relan, V. Bhardwaj, Saurabh Vaichal, and P. Relan. 2020. Bertrand-dr: Improving text-to-sql using a discriminative re-ranker. ArXiv, abs/2002.00557. + +Fei Li and H. V. Jagadish. 2014. Constructing an interactive natural language interface for relational databases. VLDB. +Xi Victoria Lin, Richard Socher, and Caiming Xiong. 2020. Bridging textual and tabular data for cross-domain text-to-SQL semantic parsing. In *Findings of EMNLP*. +Y. Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, M. Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019. Roberta: A robustly optimized bert pretraining approach. ArXiv, abs/1907.11692. +Olivier Michalon, Corentin Ribeyre, Marie Candito, and Alexis Nasr. 2016. Deeper syntax for better semantic parsing. In COLING. +Adam Paszke, S. Gross, Francisco Massa, A. Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Z. Lin, N. Gimelshein, L. Antiga, Alban Desmaison, Andreas Köpf, Edward Yang, Zach DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. 2019. Pytorch: An imperative style, high-performance deep learning library. In NeurIPS. +Ohad Rubin and Jonathan Berant. 2021. Smbop: Semi-autoregressive bottom-up semantic parsing. In NAACL-HLT. +Torsten Scholak, Nathan Schucher, and Dzmitry Bahdanau. 2021. Picard: Parsing incrementally for constrained auto-regressive decoding from language models. In EMNLP. +Peter Shaw, Jakob Uszkoreit, and Ashish Vaswani. 2018. Self-attention with relative position representations. In NAACL. +Peng Shi, Patrick Ng, Zhi guo Wang, Henghui Zhu, Alexander Hanbo Li, J. Wang, C. D. Santos, and Bing Xiang. 2021. Learning contextual representations for semantic parsing with generation-augmented pretraining. In AAAI. +Shikhar Vashishth, Shib Sankar Dasgupta, Swayambhu Nath Ray, and Partha Pratim Talukdar. 2018. Dating documents using graph convolution networks. In ACL. +Bailin Wang, Mirella Lapata, and Ivan Titov. 2021a. Meta-learning for domain generalization in semantic parsing. In *NAACL*. +Bailin Wang, Richard Shin, Xiaodong Liu, Oleksandr Polozov, and Matthew Richardson. 2020. RAT-SQL: relation-aware schema encoding and linking for text-to-sql parsers. In ACL. +Bailin Wang, Ivan Titov, and Mirella Lapata. 2019. Learning semantic parsers from denotations with latent structured alignments and abstract programs. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th + +International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 3774-3785. +Bailin Wang, Wenpeng Yin, Xi Victoria Lin, and Caiming Xiong. 2021b. Learning to synthesize data for semantic parsing. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 2760-2766. +Yuk Wah Wong and Raymond J. Mooney. 2007. Learning synchronous grammars for semantic parsing with lambda calculus. In ACL. +Navid Yaghmazadeh, YUEPENG WANG, Isil Dillig, and Thomas Dillig. 2017. SQLizer: query synthesis from natural language. PACMPL. +Pengcheng Yin and Graham Neubig. 2017. A syntactic neural model for general-purpose code generation. In ACL. +Pengcheng Yin, Graham Neubig, Wen tau Yih, and Sebastian Riedel. 2020. Tabert: Pretraining for joint understanding of textual and tabular data. In ACL. +Tao Yu, Chien-Sheng Wu, Xi Victoria Lin, Bailin Wang, Y. Tan, Xinyi Yang, Dragomir Radev, R. Socher, and Caiming Xiong. 2021. Grappa: Grammar-augmented pre-training for table semantic parsing. In ICLR. +Tao Yu, Rui Zhang, Kai Yang, Michihiro Yasunaga, Dongxu Wang, Zifan Li, James Ma, Irene Li, Qingning Yao, Shanelle Roman, Zilin Zhang, and Dragomir R. Radev. 2018. Spider: A large-scale human-labeled dataset for complex and cross-domain semantic parsing and text-to-sql task. In EMNLP. +F. M. Zanzotto, Andrea Santilli, Leonardo Ranaldi, Dario Onorati, P. Tommasino, and Francesca Fallucchi. 2020. Kermit: Complementing transformer architectures with encoders of explicit syntactic interpretations. In EMNLP. +John M Zelle and Raymond J Mooney. 1996. Learning to parse database queries using inductive logic programming. In AAAI. +Luke Zettlemoyer and Michael Collins. 2007. Online learning of relaxed ccg grammars for parsing to logical form. In EMNLP-CoNLL. +Luke S. Zettlemoyer and Michael Collins. 2005. Learning to map sentences to logical form: Structured classification with probabilistic categorial grammars. In UAI. +Rui Zhang, Tao Yu, Heyang Er, Sungrok Shim, Eric Xue, Xi Victoria Lin, Tianze Shi, Caiming Xiong, Richard Socher, and Dragomir R. Radev. 2019a. Editing-based SQL query generation for cross-domain context-dependent questions. In EMNLP-IJCNLP. + +Y. Zhang, Rui Wang, and Luo Si. 2019b. Syntax-enhanced self-attention-based semantic role labeling. In EMNLP/IJCNLP. +Ziming Zhang, Wenchi Ma, Y. Wu, and Guanghui Wang. 2020. Self-orthogonality module: A network architecture plug-in for learning orthogonal filters. In WACV. + +# A Appendix + +# A.1 Details of Relation Structure. + +All structures have been shown in Table 5. a structure (edge) exists from source node $x \in S$ to target node $y \in S$ if the pair fulfills one of the descriptions listed in the Table 5, with the corresponding label. + +
Source xTarget yTypeDescription
QuestionQuestionForward-Syntaxy is the target word of x under syntax dependency.
QuestionQuestionBackward-Syntaxy is the source word of x under syntax dependency.
QuestionQuestionNone-Syntaxx and y have no syntactic dependency.
ColumnColumnForeign-Keyy is the foreign key of x.
TableColumnHasThe column y belongs to the table x.
TableColumnPrimary-KeyThe column y is the primary key of the table x.
QuestionTableNone-LinkingNo linking between x and y.
QuestionTablePartial-Linkingx is part of y, but the entire question does not contain y.
QuestionTableExact-Linkingx is part of y, and y is a span of the entire question.
QuestionColumnNone-LinkingNo linking between x and y.
QuestionColumnPartial-Linkingx is part of y, but the entire question does not contain y.
QuestionColumnExact-Linkingx is part of y, and y is a span of the entire question.
QuestionColumnValue-Linkingx is part of the candidate cell values of column y.
+ +Table 5: The checklist of all relations structure used in ${\mathrm{S}}^{2}\mathrm{{SQL}}$ . All relations above are asymmetric. \ No newline at end of file diff --git a/s2sqlinjectingsyntaxtoquestionschemainteractiongraphencoderfortexttosqlparsers/images.zip b/s2sqlinjectingsyntaxtoquestionschemainteractiongraphencoderfortexttosqlparsers/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..43fa483a1c9382540f9d9f926a6a5d1ed77b942b --- /dev/null +++ b/s2sqlinjectingsyntaxtoquestionschemainteractiongraphencoderfortexttosqlparsers/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8f8a30a3b81ab05d66411f7c8430e4b779d0ce52258689588163d5299d528c0d +size 453988 diff --git a/s2sqlinjectingsyntaxtoquestionschemainteractiongraphencoderfortexttosqlparsers/layout.json b/s2sqlinjectingsyntaxtoquestionschemainteractiongraphencoderfortexttosqlparsers/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..bcc6eb02d64748651e4a00550cbddb295f5cea6b --- /dev/null +++ b/s2sqlinjectingsyntaxtoquestionschemainteractiongraphencoderfortexttosqlparsers/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:57111f275bef101973b6662c8d3ec86545c64a0808b22b6c7071e092ceb13c42 +size 290408 diff --git a/seekingpatternsnotjustmemorizingprocedurescontrastivelearningforsolvingmathwordproblems/bfa2a5f2-96cb-4244-8cb6-8b3b9b56abe6_content_list.json b/seekingpatternsnotjustmemorizingprocedurescontrastivelearningforsolvingmathwordproblems/bfa2a5f2-96cb-4244-8cb6-8b3b9b56abe6_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..cde92cf42d3f5f16a2aaab0934f0d410fb5396fc --- /dev/null +++ b/seekingpatternsnotjustmemorizingprocedurescontrastivelearningforsolvingmathwordproblems/bfa2a5f2-96cb-4244-8cb6-8b3b9b56abe6_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:441b197a9101d83f85eb09dadfcd6371902d3e81a9224523ed7b5f5ea9ccdc5c +size 71882 diff --git a/seekingpatternsnotjustmemorizingprocedurescontrastivelearningforsolvingmathwordproblems/bfa2a5f2-96cb-4244-8cb6-8b3b9b56abe6_model.json b/seekingpatternsnotjustmemorizingprocedurescontrastivelearningforsolvingmathwordproblems/bfa2a5f2-96cb-4244-8cb6-8b3b9b56abe6_model.json new file mode 100644 index 0000000000000000000000000000000000000000..51d652c25fc74307956a174b784f597edc600185 --- /dev/null +++ b/seekingpatternsnotjustmemorizingprocedurescontrastivelearningforsolvingmathwordproblems/bfa2a5f2-96cb-4244-8cb6-8b3b9b56abe6_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:573a9a87ca9569808f4ac6e55a4cd2e125d49916d48d1feea797762ac6114b83 +size 88008 diff --git a/seekingpatternsnotjustmemorizingprocedurescontrastivelearningforsolvingmathwordproblems/bfa2a5f2-96cb-4244-8cb6-8b3b9b56abe6_origin.pdf b/seekingpatternsnotjustmemorizingprocedurescontrastivelearningforsolvingmathwordproblems/bfa2a5f2-96cb-4244-8cb6-8b3b9b56abe6_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..63298b7fd878132f6e9a3f44f08bcf397ba5a2f1 --- /dev/null +++ b/seekingpatternsnotjustmemorizingprocedurescontrastivelearningforsolvingmathwordproblems/bfa2a5f2-96cb-4244-8cb6-8b3b9b56abe6_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:be6e7c0b804f80cb6a6021844ec95911751e1a19cd1ba5e948c7b53e3c8e67b7 +size 5879621 diff --git a/seekingpatternsnotjustmemorizingprocedurescontrastivelearningforsolvingmathwordproblems/full.md b/seekingpatternsnotjustmemorizingprocedurescontrastivelearningforsolvingmathwordproblems/full.md new file mode 100644 index 0000000000000000000000000000000000000000..5baa52af10cc629aef59f8a9757aa0fc14fe232a --- /dev/null +++ b/seekingpatternsnotjustmemorizingprocedurescontrastivelearningforsolvingmathwordproblems/full.md @@ -0,0 +1,322 @@ +# Seeking Patterns, Not just Memorizing Procedures: Contrastive Learning for Solving Math Word Problems + +Zhongli Li $^{1*}$ , Wenxuan Zhang $^{2*}$ , Chao Yan $^{2\dagger}$ , Qingyu Zhou $^{1}$ , Chao Li $^{1}$ , Hongzhi Liu $^{2}$ , Yunbo Cao $^{1}$ + +Tencent Cloud Xiawei + +2Peking University + +{neutrali,qingyuzhou,diegoli,yunbocao}@tencent.com + +{zwx980624@stu, cyan@stu, liuhz@ss}.pku.edu.cn + +# Abstract + +Math Word Problem (MWP) solving needs to discover the quantitative relationships over natural language narratives. Recent work shows that existing models memorize procedures from context and rely on shallow heuristics to solve MwPs. In this paper, we look at this issue and argue that the cause is a lack of overall understanding of MwP patterns. We first investigate how a neural network understands patterns only from semantics, and observe that, if the prototype equations like $n_1 + n_2$ are the same, most problems get closer representations and those representations apart from them or close to other prototypes tend to produce wrong solutions. Inspired by it, we propose a contrastive learning approach, where the neural network perceives the divergence of patterns. We collect contrastive examples by converting the prototype equation into a tree and seeking similar tree structures. The solving model is trained with an auxiliary objective on the collected examples, resulting in the representations of problems with similar prototypes being pulled closer. We conduct experiments1 on the Chinese dataset Math23k and the English dataset MathQA. Our method greatly improves the performance in monolingual and multilingual settings. + +# 1 Introduction + +A Math Word Problem (MWP) is described as a natural language narrative with a math question. The MWP solver is required to generate a solution equation, which can be calculated to get the numerical answer, by understanding the contextual problem description. + +In teaching, students are encouraged to recognize that mathematics is really about patterns and + +![](images/3507f05ca61b86cef596709e1d3e65bf729b365c8677026ce602c522812dc4ef.jpg) +Figure 1: The visualization of the problem representations by T-SNE. "Prob." and "Eq" are short for the math word problem and its solution equation. The problem A and B are in the same prototype equation $n_1 - n_2$ . The problem C and D are semantically similar. + +not merely about numbers (Council, 1989). Mathematically excellent students explore patterns, not just memorize procedures (Schoenfeld, 1992). Recently, Patel et al. (2021) mention that existing MWP models (Xie and Sun, 2019; Zhang et al., 2020) rely on shallow heuristics to generate equations. These models can predict solutions well even if leaving only narratives without questions, which suggests that neural networks learn to solve MwPs by memorizing the lexical input like rote learning. Thus, existing models get stuck in memorize procedures. We look at this issue and hypothesize it is because they focus on text understanding or equation generation for one problem. The same quantitative relationship corresponds to many problems of different themes and scenarios, but previ + +ous methods overlook the outlining and distinction of MWP patterns. + +In this work, we first investigate how a neural network understands MWP patterns only from semantics. We adopt the widely used encoder-decoder model structure (Cho et al., 2014). BERT (Devlin et al., 2019) is employed as the semantic encoder, and a tree decoder (Xie and Sun, 2019) is adopted to generate equations. We probe the problem representations in BERT. The visualization by T-SNE (van der Maaten and Hinton, 2008) in Figure 1 shows that, through the semantic encoder, most representations of problems with the same prototype equation are pulled closer, even if their narratives are semantically different. We also analyze the representations in different BERT layers, and the results show the lexical semantics mainly affects the problem-solving in lower layers. Besides, for each prototype equation, those problem representations far away from its center representation tend to produce incorrect solutions. + +Inspired by it, we propose a contrastive learning approach that seeks similar prototypes to support model to better understand patterns and perceive the divergence of patterns. When collecting contrastive examples, we follow Xie and Sun (2019) to convert the prototype equation to a tree. Given an equation tree, the positive examples are retrieved if their trees or subtrees have the same structure, and the negative examples are collected from the rest in terms of the operator types and the size of the tree. The solving model is first jointly optimized by an equation generation loss and a contrastive learning loss on the collected examples, and then, is further trained on the original dataset. While the generation loss empowers the model to memorize procedures from the semantics, the contrastive learning loss brings similar patterns closer and disperses the different patterns apart. + +We conduct experiments on the Chinese dataset Math23k (Wang et al., 2017) and the English dataset MathQA (Amini et al., 2019) in monolingual and multilingual settings. To support constructing multilingual contrastive examples, we follow Tan et al. (2021) to adapt MathQA as the counterpart of Math23k. Experimental results show that our method achieves consistent gains in monolingual and multilingual settings. In particular, our method allows the model to improve the performance in one language using data in another language, which suggests that MWP patterns are + +language-independent. Furthermore, we verify that, through our contrastive learning, the representations that previously generate wrong solutions get closer to their centers, and several problems are solved well. + +To summarize, the contributions of this paper include: i) An analysis of the MwP model showing that the semantic encoder understands lexical semantics in lower layers and gathers the prototype equations in higher layers. ii) A contrastive learning approach helping the model to better understand MwP patterns and perceive the divergence of patterns. iii) Applications in the multilingual setting suggesting that we can further improve the model performance using data in different languages. + +# 2 Related Work + +# 2.1 Math Word Problem Solving + +Given a natural language narrative with a mathematical question, the task is to generate a solution equation to answer the question. The methods can be divided into four categories: rule-based methods (Fletcher, 1985; Bakman, 2007), statistical machine learning methods (Kushman et al., 2014; Hosseini et al., 2014), semantic parsing methods (Shi et al., 2015; Koncel-Kedziorski et al., 2015) and deep learning methods (Wang et al., 2017; Huang et al., 2018a,b; Xie and Sun, 2019; Zhang et al., 2020). + +Deep learning methods have achieved significant improvement on MWP solving. Wang et al. (2017) first attempt to use recurrent neural networks to build a seq2seq solving model. Xie and Sun (2019) propose a tree-structured decoder to generate an equation tree. Syntactically correct equations can be generated through traversing the equation tree. Zhang et al. (2020) apply graph convolutional networks to extract relationships of quantities in math problems. Recently, unsupervised pretraining of language models (Devlin et al., 2019; Yang et al., 2019a) has provided informative contextual representations for text understanding, and fine-tuning techniques (Cui et al., 2019; Li et al., 2021) have brought further performance gains. Several works (Kim et al., 2020; Tan et al., 2021; Cobbe et al., 2021) based on pretrained language models enhance the ability of problem understanding. + +![](images/63aa512ad4aad3aa0d2ac4d19623f3544f4bb906f281b24457f73293142b13fb.jpg) +Epoch 1 + +![](images/e7158cbf9ab6b55372eb7f7cc0ed7192144872d2b163aceb537f250ae3be2878.jpg) +Epoch 10 + +![](images/562df3ac471f383520d2ab005d77c792cfac08434bb1f07dabdfabc1d74f72fb.jpg) +Epoch 20 + +![](images/cb3456c16fae360463d1e288e25f13858d054717c013497dd08c3d63c2ae1b71.jpg) +Epoch 43 + +Layer 2 +![](images/809bcf775889c44a91e7c2b8e63ee439fa1e60f6471cce91128d188afbd7aa9a.jpg) +n1+n2 +n1-n2 + +Layer 6 +![](images/360a809b65203e77366eebe317772d09beada81be25c4bde393860acf0889b3b.jpg) +n\*n2 + +Layer 9 +![](images/38571a9ef7a663fd8fa7a7912fddb73239bc382742bbc8d4d19533fabf8c0776.jpg) +n/n2 +$\left(\mathbf{n}_{1} + \mathbf{n}_{2}\right)^{*}\mathbf{n}_{3}$ + +Layer 12 +Figure 2: The T-SNE visualization of problem representations in different epochs and different layers. Different colors represent different prototype equations. The model achieves the highest accuracy at the training epoch 43. +![](images/7cad88e054a4c11da60e43888c6f2db8e2f850a37420545e9e63066358a0a9e0.jpg) +$\left(\mathrm{n}_{1} + \mathrm{n}_{2}\right) / \mathrm{n}_{3}$ + +# 2.2 Contrastive Learning + +Contrastive learning is a method of representation learning, which is first designed by Hadsell et al. (2006). By pulling semantically similar embeddings together and pushing semantic different ones apart, contrastive learning can provide more effective representations. In NLP, similar approaches have been explored in many fields. Bose et al. (2018) develop a sampler to find harder negative examples, which forces the model to learn better word and graph embeddings. Yang et al. (2019b) use contrastive learning to reduce word omission errors in neural machine translation. Clark et al. (2020) train a discriminative model on contrastive examples to obtain more informative language representations. Gao et al. (2021) advance the performance of sentence embeddings by using contrastive learning in supervised and unsupervised settings. Yu et al. (2021) develop a contrastive self-training to help language model fine-tuning and label denoising in weak supervision. + +To the best of our knowledge, this is the first work to adopt contrastive learning to MwP solving. With the supervision of contrastive learning, we seek similar MwP patterns to pull them closer, and collect confusing patterns to push them apart. + +# 3 Semantic Encoder Gathers Prototypes + +In this section, we explore how a neural network understands patterns from semantics. We adopt the encoder-decoder model structure to solve problems, and perform analyses on the problem representations. The observation is that the semantic encoder understands lexical semantics at lower layers and gathers the prototype equations at higher layers. + +# 3.1 Experimental Setup + +# 3.1.1 Datasets + +We perform analyses on two widely used datasets Math23k (Wang et al., 2017) and MathQA (Amini et al., 2019). The Math23k dataset is composed of 23k MwPs in elementary education, and the MathQA has 37k MwPs with multiple choices and equations. + +# 3.1.2 Model Architecture + +Semantic Encoder The pre-trained language model BERT (Devlin et al., 2019) is employed as the semantic encoder. The unsupervised pretraining on large corpora renders the model to learn linguistic knowledge, which provides rich textual representations. + +![](images/cb35859cde1363c93e94bc3c2bb788da6e265008d120d24988d381c8b50fc40d.jpg) +Figure 3: Similarities of problem representations in different BERT layers. The blue polyline corresponds to the semantically similar problems. The red polyline corresponds to problems with same prototype equation. + +Equation Decoder A tree decoder (Xie and Sun, 2019) is adopted to generate solution equations. We use the BERT-encoded representation of [CLS] token to initialize the root node when decoding. Recursively, the decoder generates the embedding of each node, and predicts the probabilities of number and operator candidates. + +For brevity, we denote our model as BERT-TD. The model takes the textual problem description as the input and is optimized by minimizing the negative log-likelihoods of node probabilities for predicting the ground-truth equation tree. + +# 3.2 Shifts of Problem Representation + +To explore how the neural model learns MWP patterns during training, we first extract BERT-encoded representations of [CLS] token in different epochs and different layers. Then we perform the T-SNE visualization (van der Maaten and Hinton, 2008) shown in Figure 2. The representations of different epochs are picked from the top layer of BERT, and the representations of different layers are picked from the best trained model. It can be seen that, as the training goes on, the representations with the same prototype equation are gathering. Besides, with the increase of the depth of encoder layers, the gathering tendency becomes more and more obvious. + +Intuitively, the prototype equation exhibits the essential relationship between the quantities in MWP. These results also verify that the patterns learned by the neural model are directly associated with the prototype equations. + +![](images/3fb9c0a050ae0b10828d38c5a48ecbc4dfb61320c7834de2d545bf303b441cfd.jpg) +Figure 4: Model performance in each distance interval. The interval index $x$ indicates the cosine distances are in the interval $[0.1 \times (x - 1), 0.1 \times x)$ . The dotted line is computed by polynomial least squares fitting. + +# 3.3 Semantics and Prototype Equation + +From the visualizations, we can not see how semantics affects problem-solving. To this end, we collect 20 problem pairs with similar lexical semantics but exactly different prototypes, and 20 problem pairs with the same prototype but in different themes or scenarios. Not like taking the [CLS] representation in Section 3.2, we average the representations over all words in one problem. The cosine similarities of the averaged representations are calculated for these problem pairs in different BERT layers. + +The averaged similarities are shown in Figure 3. The semantically similar problems obtain higher values in lower layers but the similarity gradually decreases as the model deepens. Meanwhile, with the increase of the model depth, although in different semantics, the problems with the same prototype equation achieve higher similarity. This demonstrates that lexical semantics affects problem-solving at lower layers, and the model further extracts prototypes from the semantics at higher layers. + +# 3.4 Clustering and Solving Ability + +With the above observation, we attempt to discover the relationship between prototype clustering and model performance. For each prototype equation, we first average the representations of the corresponding problems to obtain its center point, and then calculate the cosine distances between representations and its centers. A higher cosine distance means the representation is closer to its center. We split the cosine distance into several intervals and compute the proportion of correct predictions for each interval. The results are shown in Figure 4, + +
ProblemPrototype Equation
Larry starts with n1 cards. n2 are eaten by a hippopotamus. How many cards does Larry end with?n1 - n2
Frank made n1 dollars mowing lawns over the summer. If he spent n2 dollars buying new mower blades, how many n3 dollar games could he buy with the money he had left?(n1 - n2) / n3
+ +Table 1: Math word problems with the same quantitative relationship, i.e. the subtraction of numerics $n_1$ and $n_2$ . The same prototype equations are in red color. + +which suggests that the representations apart from centers tend to produce wrong solutions. + +# 4 Contrastive Learning + +In this section, we propose a contrastive learning approach to help the model to perceive the divergence of MWP patterns. One drawback of existing deep learning methods is that they overlook the outlining and distinction of MWP patterns. In contrast, we seek similar prototype equations from various problems to support model to understand patterns, and collect easily confused patterns for model to distinguish. + +# 4.1 Data Collection + +We construct contrastive MwP triples $(p,p^{+},p^{-})$ containing a basic problem $p$ and its positive and negative examples $\{p^{+},p^{-}\}$ . + +Positive Example One direct way is to collect problems whose prototype equation is completely the same as the given problem $p$ . However, the same quantitative relationship in $p$ also exists in other problems. As shown in Table 1, for the second problem, before answering "How many games could he buy?", another hidden question is "How much money does he have?" whose solving equation is in the same prototype as the first problem. Thus, we parse the prototype equation to tree structure by following Xie and Sun (2019) and consider its sub-equations and subtrees. The problem $p^+$ is taken as a positive example if its tree or subtree has the same structure as $p$ , such as "tree" and the subtree of "tree+" in Figure 5. + +Negative Example Bose et al. (2018) and Kalantidis et al. (2020) stress the importance of hard negative examples in contrastive learning. If we choose $p^{-}$ whose prototype is totally different from + +![](images/45c7368f9d11b2d89baef76b6c75a6b217a29239c0c6c2fdb2091bde987df641.jpg) +Figure 5: An overview of our model. + +$p$ , the original MWP model can easily distinguish them apart. Thus, in this work, the problem $p^{-}$ is chosen as a hard negative example if its tree has the same number of nodes but different operator node types, such as "tree" and "tree-" in Figure 5. With the training on hard negative examples, our model can distinguish more subtle differences from various prototypes, and further grasp the inner pattern of MWP. + +# 4.2 Training Procedure + +We train the model on our contrastive problem triples. As shown in Figure 5, the problems are first encoded by BERT, and then the tree decoder predicts the nodes of the equation tree. + +During contrastive learning, the triple $z = (p, p^{+}, p^{-})$ are input to the model together to predict equation trees. Owing to the decoding manner of Xie and Sun (2019), each node embedding represents the whole subtree information rooted in it. The root node embeddings of the problem $p$ and its negative problem $p^{-}$ are picked for model to distinguish. For its positive problem $p^{+}$ , we find the root node of the tree or subtree containing the same structure as $p$ , and pull its embedding closer to that of $p$ . For brevity, we denote these node embeddings as $(e, e^{+}, e^{-})$ and the contrastive learning loss becomes: + +$$ +\begin{array}{l} \mathcal {L} _ {c l} = \sum_ {z} \max (0, \eta + \operatorname {s i m} (e, e ^ {-}) \tag {1} \\ - s i m (e, e ^ {+})), \\ \end{array} +$$ + +
Dataset#Train#Dev#Test
Math23k21,1621,0001,000
MathQA29,8374,4752,985
MathQA†23,7033,5402,410
+ +Table 2: Statistics of the used datasets. The "MathQA†" is the adapted MathQA dataset by following Tan et al. (2021). + +where $\operatorname{sim}(\cdot)$ is the cosine similarity, and the $\eta$ is a margin hyper-parameter. + +The basics of a MWP solving model is to generate a solution equation to answer the math question. We transform the target equation $y$ into Polish notation as $[y_1, y_2, \dots, y_m]$ , where $m$ is the equation length. The tree decoder generates $k$ -node token $y_k$ recursively, and the loss of generating equation is computed as: + +$$ +\mathcal {P} (y | p) = \prod_ {k = 1} ^ {m} \mathcal {P} \left(y _ {k} | p\right) \tag {2} +$$ + +$$ +\mathcal {L} _ {e q} = \sum_ {p} - \log \mathcal {P} (y | p) \tag {3} +$$ + +The final training objective is to minimize the equation loss and contrastive loss as follows: + +$$ +\mathcal {L} = \mathcal {L} _ {e q} + \alpha \cdot \mathcal {L} _ {c l} \tag {4} +$$ + +where $\alpha$ is a hyper-parameter that represents the importance of the contrastive learning. + +However, not all problems have positive examples, such as those problems whose solution is one value without any operator. With this in mind, we develop the two-stage training strategy. The MWP solver is first trained on our contrastive triples at stage I, and then further trained on the original dataset at stage II. + +# 5 Experiments + +We evaluate our method on two widely used datasets (Wang et al., 2017; Amini et al., 2019), and demonstrate its effectiveness in monolingual and multilingual settings. + +# 5.1 Configuration + +Data and Metrics We collect problems from the Chinese dataset Math23k (Wang et al., 2017) and the English dataset MathQA (Amini et al., 2019). As the formula formats of the two datasets are different, we follow Tan et al. (2021) to adapt MathQA + +as a counterpart of Math23k. Table 2 shows data statistics. We report the accuracy of equation generation, namely as "Acc (eq) ", that the problem is solved well if the generated equation is equal to the annotated formula. Considering several equations satisfy the problem solution, we report the accuracy of answer value, namely as "Acc (ans) ", to see whether the value calculated by the generated equation is equal to the target value. + +Implementation We conduct our contrastive learning in the monolingual and multilingual perspectives. In the monolingual setting, we construct contrastive triples inside each dataset. In the multilingual setting, for each problem, the positive and negative examples are from different sources. Specifically, given a Chinese MWP in Math23k, we collect positive examples from MathQA and negative examples from Math23k. We adopt BERT-base (Devlin et al., 2019) as the problem encoder, and follow Xie and Sun (2019) to build the tree-decoder for solution generation. The hidden size of the decoder is set to 768. Multilingual BERT is used in the multilingual setting. The max input length is set to 120 and the max output length is set to 45. The loss margin $\eta$ is set to 0.2. The weight $\alpha$ of contrastive learning loss is set to 5. We use AdamW (Loshchilov and Hutter, 2017) as our optimizer, and perform grid search over the sets of the learning rate as $\{5\mathrm{e} - 5, 1\mathrm{e} - 4\}$ and the number of epochs as $\{30, 50\}$ for each training stage. The batch size is fixed to 16 to reduce the search space, and we evaluate models for every epoch. We use the dropout of 0.5 to prevent over-fitting and perform a 3-beam search for better generations. + +# 5.2Baselines + +To verify the effectiveness of the proposed method, we directly train our model on original datasets without contrastive learning. In particular, the multilingual baseline model is trained by mixing Math23k and the adapted MathQA. In addition to comparing with BERT, we also investigate the following approaches: + +GroupAttention $^2$ (Li et al., 2019) develop an attention mechanism to capture the quantity-related and question-related information. + +$\mathbf{GTS}^3$ (Xie and Sun, 2019) generate equation + +
ModelsMath23kMathQA†
Acc (eq)Acc (ans)Acc (eq)Acc (ans)
Monolingual Setting
GroupAttention (Li et al., 2019)-69.563.3*70.4*
GTS (Xie and Sun, 2019)-75.668.9*71.3*
Graph2Tree (Zhang et al., 2020)-77.470.0*72.0*
BERT-TD w/o CL71.282.473.575.1
BERT-TD w CL71.883.274.476.3
Multilingual Setting
mBERT-TD w/o CL67.880.572.073.5
mBERT-TD w CL70.983.974.276.3
+ +Table 3: Main results on Math23k and the adapted MathQA test sets. "Acc(eq)" is the equation accuracy and "Acc(ans)" is the answer accuracy. "* means our reimplementation based on released codes."CL" is short for the contrastive learning. "mBERT" is short for the multilingual BERT. + +
Pos.Neg.Math23kMathQA†
Baseline--80.573.5
CLSameOurs82.375.5
OursRand82.375.8
OursOurs83.976.3
+ +trees through a tree structure decoder in a goaldriven manner. + +Graph2Tree $^{4}$ (Zhang et al., 2020) design a graph-based encoder for representing the relationships and order information among the quantities. + +# 5.3 Main Results + +Experimental results are shown in Table 3. Training the MWP solver with our proposed contrastive learning outperforms the baseline models on all datasets. + +Monolingual Results Compared to previous methods, the pretrained linguistic knowledge in BERT can help the MWP solver improve performance greatly. With our proposed contrastive learning method, our model achieves consistent gains on Math23k and the adapted MathQA. This suggests that seeking patterns with supervision benefits the model to solve MWPs. + +Table 4: Results (answer accuracy) of different strategies collecting examples. "Pos." and "Neg." are corresponding to positive and negative examples. "Same" indicates the positive examples have exactly the same prototype equations. "Rand" indicates the negative examples are randomly selected from the rest. + +
Margin η0.050.10.150.20.3
Math23k82.683.783.483.981.8
MathQA†76.176.276.176.376.0
+ +Table 5: Results (answer accuracy) of using different loss margin $\eta$ in the multilingual setting. + +
Acc (eq)Acc (ans)
Baseline71.282.4
CL (α = 1)Stage I70.181.5
Stage II70.583.0
CL (α = 5)Stage I70.682.5
Stage II71.883.2
+ +Table 6: Results of using different loss weight $\alpha$ on Math23k in the monolingual setting. Two-stage results are reported. + +Multilingual Results We adapt our model to the multilingual setting by using multilingual BERT and mixing two train sets. The contrastive learning improves Math23k answer accuracy to 83.9 (3.4 absolute improvements) and MathQA answer accuracy to 76.3 (2.8 absolute improvements), which are competitive with the monolingual results. This demonstrates that the model can learn similar patterns in different languages. + +# 5.4 Analysis + +We conduct ablations to better understand the contributions of different components in our contrastive learning method. + +![](images/74342271732f39b121bc0dbe84abc6da2aab753da1be16f3e826a6b1b1437401.jpg) +Figure 6: T-SNE visualization of the problem representation with and without our contrastive learning. + +![](images/aec6d5cc31bd5d9aabfcdd1671fec741ace9d9307af3008cc2837adb43b3d810.jpg) +Figure 8: Equation accuracy in each distance interval with and without our contrastive learning. + +![](images/58ec5faa8d9bd73fcb8ed07d5ac6a64def71411954dfcbb47a524322f852fd42.jpg) +Figure 7: Calinski-Harabasz index on the train/test set with and without our contrastive learning. + +![](images/6048be9150094a908a1eff459a6c4124e08953bde979012450b1cefd720197aa.jpg) + +# 5.4.1 Effects of Data Collection + +The contrastive examples consist of positive examples with similar patterns and negative examples with exactly different patterns. In this work, we investigate different strategies of collecting positive and negative examples. As well as our strategy, we attempt to collect MwPs containing the same prototype equation to be the positive examples, and randomly select negative examples from the rest. + +Table 4 shows that our strategy achieves better performance on all datasets. In addition to the problems with the same prototype equations, our collected examples include more problems having the same equation subtree structures. It can be seen that the model can benefit from these examples. For the negative examples, we take the problems with the same number of operators but different operator types. If performing random selection, the model performance drops, which suggests that our collected examples can support the model to disperse the different patterns. No matter which strategy we use, compared to the baseline without contrastive learning, our method advances MWP solving and gives one way to improve the performance by using data in different languages. + +![](images/bf11d674d78a9cf180615bd539a6bae0b6a3005f1c03dba04a7d9162ce4ccad6.jpg) + +
Input: A boatman selling a boat along river flow. If he sell boat in steal water at 3 m/sec and flow of river is 2 m/sec, how much time he will take to sell 100 m.
Output (w/o CL): 100 / (3 / 2)
Output (w CL): 100 / (3 + 2)
+ +
Input: A pipe can fill the tank in 30 minutes and pipe b can empty the tank in 90 minutes. How long it will take to fill the tank if both pipes are operating together?
Output (w/o CL): 1 / ((1 / 30) + (1 / 90))
Output (w CL): 1 / ((1 / 30) - (1 / 90))
+ +
Input: If 20 liters of chemical x are added to 80 liters of a mixture that is 25% chemical x and 75% chemical y, then what percentage of the resulting mixture is chemical x?
Output (w/o CL): 1 + ((25 / 100) * 5)
Output (w CL): 20 + ((25 / 100) * 80)
+ +Table 7: Examples of the problem input and equation output of MWP solvers. + +# 5.4.2 Effects of Hyperparameters + +We train the "mBERT-TD" model with several loss margins (0.05, 0.1, 0.15, 0.2 and 0.3) to disperse the different patterns. As shown in Table 5, the margin 0.2 can help the model achieve the best performance but lower margins 0.1 and 0.15 also perform well. + +As introduced in Section 4.2, we train our model in two stages and the loss weight $\alpha$ represents the importance of the contrastive learning. Table 6 shows the results of using different weights in each stage. It can be seen that the higher weight achieves better performance, and at stage II, training on all examples further improves the performance. + +# 5.4.3 Visualization and Statistics + +We perform the T-SNE visualization shown in Figure 6. The problem representations with the same prototype equation are more gathered through our contrastive learning. To measure this variation, we calculate the Calinski-Harabasz index (Calinski and Harabasz, 1974). Figure 7 shows that our + +method supports the model to gain higher clustering scores. + +The above results illustrate that, for each prototype equation, the representations are pulled closer to its centers. We re-compute the proportion of correct predictions as described in Section 3.4. The results are shown in Figure 8. We observe the accuracy increases in most intervals, which also verifies the effectiveness of contrastive learning. In particular, our model also performs well in lower intervals such as [0.6,0.7) and [0.7,0.8), which indicates those problems a little far away from their centers are not easily confused with other problems of different patterns, and our model disperses different patterns apart indeed. + +Besides, we show few examples in Table 7. It can be seen that the contrastive learning method helps the model capture the quantitative relationships exactly. + +# 6 Conclusion + +In this paper, we find the neural network generates incorrect solutions due to the non-distinction of MWP patterns. To this end, we propose a contrastive learning approach to support the model to perceive divergence of patterns. We seek similar patterns in terms of the equation tree structure and collect easily confused patterns for our model to distinguish. Our method outperforms previous baselines on Math23k and MathQA in monolingual and multilingual settings. + +# References + +Aida Amini, Saadia Gabriel, Shanchuan Lin, Rik Koncel-Kedziorski, Yejin Choi, and Hannaneh Hajishirzi. 2019. MathQA: Towards interpretable math word problem solving with operation-based formalisms. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 2357-2367, Minneapolis, Minnesota. Association for Computational Linguistics. +Yefim Bakman. 2007. Robust understanding of word problems with extraneous information. arXiv preprint math/0701393. +Avishek Joey Bose, Huan Ling, and Yanshuai Cao. 2018. Adversarial contrastive estimation. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1021-1032, Melbourne, Australia. Association for Computational Linguistics. + +T. Calinski and J Harabasz. 1974. A dendrite method for cluster analysis. Communications in Statistics, 3(1):1-27. +Kyunghyun Cho, Bart van Merrienboer, Caglar Gülçehre, Dzmitry Bahdanau, Fethi Bougares, Holger Schwenk, and Yoshua Bengio. 2014. Learning phrase representations using RNN encoder-decoder for statistical machine translation. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing, EMNLP 2014, October 25-29, 2014, Doha, Qatar; A meeting of SIGDAT, a Special Interest Group of the ACL, pages 1724-1734. ACL. +Kevin Clark, Minh-Thang Luong, Quoc V. Le, and Christopher D. Manning. 2020. ELECTRA: pretraining text encoders as discriminators rather than generators. CoRR, abs/2003.10555. +Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Jacob Hilton, Reiichiro Nakano, Christopher Hesse, and John Schulman. 2021. Training verifiers to solve math word problems. CoRR, abs/2110.14168. +National Research Council. 1989. *Everybody Counts: A Report to the Nation on the Future of Mathematics Education*. The National Academies Press, Washington, DC. +Baiyun Cui, Yingming Li, Ming Chen, and Zhongfei Zhang. 2019. Fine-tune BERT with sparse self-attention mechanism. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 3548–3553, Hong Kong, China. Association for Computational Linguistics. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, NAACL-HLT 2019, Minneapolis, MN, USA, June 2-7, 2019, Volume 1 (Long and Short Papers), pages 4171-4186. Association for Computational Linguistics. +Charles R Fletcher. 1985. Understanding and solving arithmetic word problems: A computer simulation. Behavior Research Methods, Instruments, & Computers, 17(5):565-571. +Tianyu Gao, Xingcheng Yao, and Danqi Chen. 2021. Simcse: Simple contrastive learning of sentence embeddings. arXiv preprint arXiv:2104.08821. +Raia Hadsell, Sumit Chopra, and Yann LeCun. 2006. Dimensionality reduction by learning an invariant mapping. In 2006 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR'06), volume 2, pages 1735-1742. IEEE. + +Mohammad Javad Hosseini, Hannaneh Hajishirzi, Oren Etzioni, and Nate Kushman. 2014. Learning to solve arithmetic word problems with verb categorization. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 523-533. +Danqing Huang, Jing Liu, Chin-Yew Lin, and Jian Yin. 2018a. Neural math word problem solver with reinforcement learning. In Proceedings of the 27th International Conference on Computational Linguistics, pages 213-223, Santa Fe, New Mexico, USA. Association for Computational Linguistics. +Danqing Huang, Jin-Ge Yao, Chin-Yew Lin, Qingyu Zhou, and Jian Yin. 2018b. Using intermediate representations to solve math word problems. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 419-428, Melbourne, Australia. Association for Computational Linguistics. +Yannis Kalantidis, Mert Bulent Sariyildiz, Noe Pion, Philippe Weinzaepfel, and Diane Larlus. 2020. Hard negative mixing for contrastive learning. arXiv preprint arXiv:2010.01028. +Bugeun Kim, Kyung Seo Ki, Donggeon Lee, and Gahgene Gweon. 2020. Point to the expression: Solving algebraic word problems using the expression-pointer transformer model. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 3768-3779. +Rik Koncel-Kedziorski, Hannaneh Hajishirzi, Ashish Sabharwal, Oren Etzioni, and Siena Dumas Ang. 2015. Parsing algebraic word problems into equations. Transactions of the Association for Computational Linguistics, 3:585-597. +Nate Kushman, Yoav Artzi, Luke Zettlemoyer, and Regina Barzilay. 2014. Learning to automatically solve algebra word problems. In Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 271-281. +Jierui Li, Lei Wang, Jipeng Zhang, Yan Wang, Bing Tian Dai, and Dongxiang Zhang. 2019. Modeling intra-relation in math word problems with different functional multi-head attentions. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 6162-6167, Florence, Italy. Association for Computational Linguistics. +Zhongli Li, Qingyu Zhou, Chao Li, Ke Xu, and Yunbo Cao. 2021. Improving BERT with syntax-aware local attention. In *Findings of the Association for Computational Linguistics: ACL-IJCNLP* 2021, pages 645-653, Online. Association for Computational Linguistics. +Ilya Loshchilov and Frank Hutter. 2017. Fixing weight decay regularization in adam. CoRR, abs/1711.05101. + +Arkil Patel, Satwik Bhattachamishra, and Navin Goyal. 2021. Are NLP models really able to solve simple math word problems? In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 2080-2094, Online. Association for Computational Linguistics. +A. Schoenfeld. 1992. Learning to think mathematically: Problem solving, metacognition, and sense making in mathematics (reprint). Journal of Education, 196:1-38. +Shuming Shi, Yuehui Wang, Chin-Yew Lin, Xiaojiang Liu, and Yong Rui. 2015. Automatically solving number word problems by semantic parsing and reasoning. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pages 1132-1142. +Minghuan Tan, Lei Wang, Lingxiao Jiang, and Jing Jiang. 2021. Investigating math word problems using pretrained multilingual language models. +Laurens van der Maaten and Geoffrey Hinton. 2008. Visualizing data using t-SNE. Journal of Machine Learning Research, 9:2579-2605. +Yan Wang, Xiaojiang Liu, and Shuming Shi. 2017. Deep neural solver for math word problems. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 845-854, Copenhagen, Denmark. Association for Computational Linguistics. +Zhipeng Xie and Shichao Sun. 2019. A goal-driven tree-structured neural model for math word problems. In Proceedings of the Twenty-Eighth International Joint Conference on Artificial Intelligence, IJCAI-19, pages 5299-5305. International Joint Conferences on Artificial Intelligence Organization. +Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov, and Quoc V Le. 2019a. XLNet: Generalized autoregressive pretraining for language understanding. arXiv preprint arXiv:1906.08237. +Zonghan Yang, Yong Cheng, Yang Liu, and Maosong Sun. 2019b. Reducing word omission errors in neural machine translation: A contrastive learning approach. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 6191-6196. +Yue Yu, Simiao Zuo, Haoming Jiang, Wendi Ren, Tuo Zhao, and Chao Zhang. 2021. Fine-tuning pretrained language model with weak supervision: A contrastive-regularized self-training approach. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 1063-1077, Online. Association for Computational Linguistics. + +Jipeng Zhang, Lei Wang, Roy Ka-Wei Lee, Yi Bin, Yan Wang, Jie Shao, and Ee-Peng Lim. 2020. Graph-to-tree learning for solving math word problems. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 3928-3937, Online. Association for Computational Linguistics. \ No newline at end of file diff --git a/seekingpatternsnotjustmemorizingprocedurescontrastivelearningforsolvingmathwordproblems/images.zip b/seekingpatternsnotjustmemorizingprocedurescontrastivelearningforsolvingmathwordproblems/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..3afa65ccb05fd50f9eb9218529d179ffcf985b98 --- /dev/null +++ b/seekingpatternsnotjustmemorizingprocedurescontrastivelearningforsolvingmathwordproblems/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c814e631438a8aa187b08584cb0a2e8c2fe7e944a58c468611a64fea62c555e5 +size 564045 diff --git a/seekingpatternsnotjustmemorizingprocedurescontrastivelearningforsolvingmathwordproblems/layout.json b/seekingpatternsnotjustmemorizingprocedurescontrastivelearningforsolvingmathwordproblems/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..382bdd6f61ec3e76203578090218dacdef582fdf --- /dev/null +++ b/seekingpatternsnotjustmemorizingprocedurescontrastivelearningforsolvingmathwordproblems/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4c39e482906762df6e3087da37ba862acf4ca20403639dc8950c985a8dd89f0a +size 348021 diff --git a/selectingstickersinopendomaindialoguethroughmultitasklearning/32de2258-48c5-4cff-8ef0-4f3061080a8b_content_list.json b/selectingstickersinopendomaindialoguethroughmultitasklearning/32de2258-48c5-4cff-8ef0-4f3061080a8b_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..263975e641b4191ccd0014e18c6e6ae4b5692ec8 --- /dev/null +++ b/selectingstickersinopendomaindialoguethroughmultitasklearning/32de2258-48c5-4cff-8ef0-4f3061080a8b_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a5b02d65815706830082f8e8b72b8a430816e6afb296a5905c0cfa592b2a9912 +size 62154 diff --git a/selectingstickersinopendomaindialoguethroughmultitasklearning/32de2258-48c5-4cff-8ef0-4f3061080a8b_model.json b/selectingstickersinopendomaindialoguethroughmultitasklearning/32de2258-48c5-4cff-8ef0-4f3061080a8b_model.json new file mode 100644 index 0000000000000000000000000000000000000000..381f4d619d17ffbcb62eb0b948e117c5d20e858d --- /dev/null +++ b/selectingstickersinopendomaindialoguethroughmultitasklearning/32de2258-48c5-4cff-8ef0-4f3061080a8b_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:480a9eac7761237f788ed66b48911ed2c27ce7f3456c08b54538e2774e977a1e +size 71932 diff --git a/selectingstickersinopendomaindialoguethroughmultitasklearning/32de2258-48c5-4cff-8ef0-4f3061080a8b_origin.pdf b/selectingstickersinopendomaindialoguethroughmultitasklearning/32de2258-48c5-4cff-8ef0-4f3061080a8b_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..993e136a23b55f8a0bf7b033f168fd17dd0d2fc2 --- /dev/null +++ b/selectingstickersinopendomaindialoguethroughmultitasklearning/32de2258-48c5-4cff-8ef0-4f3061080a8b_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2ee3bec46afe499ddb72e010f844e3d7382466aa96d43eed78ecdf5f0b45a5be +size 1436579 diff --git a/selectingstickersinopendomaindialoguethroughmultitasklearning/full.md b/selectingstickersinopendomaindialoguethroughmultitasklearning/full.md new file mode 100644 index 0000000000000000000000000000000000000000..513b00ba2f35668c68489a7fb1f19120a3ddbb56 --- /dev/null +++ b/selectingstickersinopendomaindialoguethroughmultitasklearning/full.md @@ -0,0 +1,262 @@ +# Selecting Stickers in Open-Domain Dialogue through Multitask Learning + +Zhexin Zhang $^{12*}$ , Yeshuang Zhu $^{2}$ , Zhengcong Fei $^{2}$ , Jinchao Zhang $^{2}$ , Jie Zhou $^{2}$ + +$^{1}$ The CoAI group, DCST; $^{1}$ Institute for Artificial Intelligence; $^{1}$ State Key Lab of Intelligent Technology and Systems; $^{1}$ Beijing National Research Center for Information Science and Technology; $^{1}$ Tsinghua University, Beijing 100084, China. + +$^{2}$ Pattern Recognition Center, WeChat AI, Tencent Inc, China. + +zx-zhang18@mails.tsinghua.edu.cn, {yshzhu, dayerzhang, withtomzhou}@tencent.com, feizhengcong@ict.ac.cn, + +# Abstract + +With the increasing popularity of online chatting, stickers are becoming important in our online communication. Selecting appropriate stickers in open-domain dialogue requires a comprehensive understanding of both dialogues and stickers, as well as the relationship between the two types of modalities. To tackle these challenges, we propose a multitask learning method comprised of three auxiliary tasks to enhance the understanding of dialogue history, emotion and semantic meaning of stickers. Extensive experiments conducted on a recent challenging dataset show that our model can better combine the multimodal information and achieve significantly higher accuracy over strong baselines. Ablation study further verifies the effectiveness of each auxiliary task. Our code is available at https://github.com/nonstopfor/Sticker-Selection. + +# 1 Introduction + +With the development of mobile messaging apps (e.g., WhatsApp and Messenger), visual content is getting more and more frequently used in our daily conversation, such as emojis and stickers. Compared with emojis, stickers are larger images consisting of drawing characters, symbolic icons, and text titles, and are hence more expressive and versatile (Konrad et al., 2020). Users send stickers along with text to show intimacy, express strong emotion, and experience the enjoyment of creativity (Tang and Hew, 2019). + +Despite the importance of stickers in daily communication, selecting stickers in open-domain dialogue hasn't been widely explored. In this paper, we address the task of selecting an appropriate sticker from a candidate set for an open-domain multi-turn dialogue. This task is a typical setting for various applications, e.g., automatically recommending stickers in messaging apps and building + +![](images/7ebbd3e62d7d286555f1dd36a1f90addbef14b63964f5f255f4022d31722d0de.jpg) +Figure 1: An example of the sticker selection task. Given a dialogue history, the model needs to add a sticker to the last textual message which is the most appropriate one among a collection of candidate stickers (the one marked in the red rectangle). The words below in red denote the emotion or meaning of each sticker. + +more interesting and human-like chatbots which could respond with stickers. As shown in Figure 1, this task requires an understanding of dialogue context, emotion and semantic meaning of stickers, and a jointly modeling ability for the multimodal information. Only a few previous works have explored this task (Gao et al., 2020; Wang and Jurgens, 2021). However, existing models are only trained on an end-to-end matching objective and lacks finer-grained supervision signals which could guide models to understand multimodal information better. + +Considering the challenges of this task and the shortcomings of previous work, we propose a novel multitask learning method to improve sticker selection in open-domain multi-turn dialogue. We design three auxiliary tasks: 1) masked context prediction, which uses multimodal context to predict masked tokens in the dialogue history, aiming to understand the dialogue in the presence of the sticker; + +2) sticker emotion classification, which utilizes the sticker's contextualized representation to predict its emotion, aiming to improve the model's understanding of sticker emotion; 3) sticker semantic prediction, which explicitly instills semantic understanding of stickers by training the model to reconstruct a sticker's semantic label based on the multimodal inputs. Moreover, all these tasks help improve our model's joint modeling capability, as both our model architecture and task design require multimodal inputs and deep interactions between them. We evaluate the performance of our method on a recently proposed and challenging dataset. Extensive experiments show that our multitask method achieves state-of-the-art performance. + +There are two contributions of this paper: + +- We propose a multitask learning method to help select appropriate stickers in open-domain multi-turn dialogue. +- Experiment results on a challenging dataset demonstrate the effectiveness of each auxiliary task and combining all the tasks achieves state-of-the-art performance. + +# 2 Related Work + +Sticker selection. Previous works proposed to recommend emojis in dialogue systems based on textual or multimodal context (Barbieri et al., 2018; Xie et al., 2016; Barbieri et al., 2017). However, emojis are limited in variety and are much less expressive than stickers. Laddha et al. (2020) retrieved stickers for generated text utterances by simply matching the text tags of stickers. Several works have proposed improved matching methods for stickers. Gao et al. (2020) utilized co-attention to capture the interaction between a sticker and each utterance, and used a fusion network to combine the features. Wang and Jurgens (2021) followed the matching framework of CLIP (Radford et al., 2021) and designed a multimodal encoder for animated GIFs. Fei et al. (2021) proposed to generate special sticker tokens along with text utterances using one single GPT (Wang et al., 2020) for emotion prediction and retrieval of stickers. However, existing models are only trained on an end-to-end matching objective that implicitly guides the models to understand multimodal information. In our work, we design finer-grained auxiliary tasks that instill knowledge of stickers and their contextualized usage in a more efficient way. + +![](images/e0d7a62f5a851da8bb87e6ffe06535c5d41921d8e52dcab96c365a9fe6dca5f9.jpg) +Figure 2: An overview of our training task design. The base model architecture is a multimodal BERT that learns to predict whether the candidate sticker is appropriate given the dialogue context. Three auxiliary tasks are proposed to enhance the model's ability to understand multimodal input. $c_{i}$ and $e_{i}$ represent tokens of dialogue context and semantic label respectively. + +Visual Dialogue. Visual dialogue is a task to answer questions about the factual content of the real-world image (Liang et al., 2021; Das et al., 2017a,b). In contrast, selecting appropriate stickers in open-domain dialogue requires understanding sentiment and semantic expression of user-generated, artistic style images. + +# 3 Method + +# 3.1 Task Definition + +We assume there is a multi-turn dialogue context $C = \{u_1, \dots, u_N\}$ , and a candidate sticker set $S = \{s_1, \dots, s_M\}$ , where $u_i$ represents the $i$ -th utterance in the dialogue, and $s_i$ represents the $i$ -th candidate sticker. $N$ is the number of utterances in the dialogue and $M$ is the number of candidate stickers. In this work, we suppose that there is only one appropriate sticker $s^* \in S$ , and $s^*$ and $u_N$ belong to the same speaker. The goal is to train a model that can select the right sticker $s^*$ among all candidates $S$ given the dialogue history $C$ . + +# 3.2 Method Overview + +An overview of the design of our training tasks is shown in Figure 2. Our main task is to decide whether the candidate sticker is appropriate given the dialogue context. To accomplish this task, we concatenate the embedded dialogue context and the sticker embedding as inputs to BERT. Then we apply a binary classification layer on top of the hidden state of the [CLS] token. In order to enhance the model's ability to understand the multimodal + +input, we design three auxiliary tasks: 1) masked context prediction, which improves the model's understanding of dialogue context; 2) sticker emotion classification, which aims to make the model better understand sticker's emotion; 3) sticker semantic prediction, which instills semantic information of stickers to the model. Next, we will introduce our three auxiliary tasks in detail. + +# 3.3 Task 1: Masked Context Prediction + +The masked context prediction task follows the masked language modeling (MLM) task in BERT (Devlin et al., 2019). One difference is that we additionally append the embedding of the appropriate sticker to the input embeddings. In this way, the model can learn to utilize stickers for dialogue reconstruction, and thus the interaction between the two modalities is enhanced. The loss for this task is denoted as $\mathcal{L}_{ctx}$ , and takes the same form of cross-entropy loss as in the original MLM task. + +# 3.4 Task 2: Sticker Emotion Classification + +In the dataset we used, stickers are annotated with one context-dependent emotion, which means one sticker could have different emotions in different dialogue contexts. Therefore, we design a sticker emotion classification task to enable the model to utilize the text and sticker information simultaneously for understanding sticker emotion. Specifically, we take the hidden state corresponding to the sticker and apply a softmax layer with cross-entropy loss on top of it for emotion classification. The loss for this task is denoted as $\mathcal{L}_{emo}$ . + +# 3.5 Task 3: Sticker Semantic Prediction + +Task 1 and Task 2 emphasize learning the implicit meaning of stickers and their correlation with dialogue text. However, many stickers express a clear intention that indicates their proper usage context, e.g., greetings and declines. We believe empowering our model to predict and utilize the semantic meaning of stickers is beneficial for our task. Hence, we further design a semantic label prediction task. We modify our model's inputs by inserting a fixed-length sequence of [MASK] tokens after the dialogue. The model is trained to recover the label text from the hidden states of the [MASK] tokens. The loss is formulated as the sum of cross-entropy loss for each token in label and is denoted as $\mathcal{L}_{sem}$ . Since the dataset we used has no ground truth semantic labels for stickers, we take the textual information recognized by an OCR tool + +as semantic labels for stickers. Note that $\mathcal{L}_{sem}$ is only applied for those stickers with text recognized. + +# 3.6 Total Loss + +Besides the above three auxiliary tasks, our main task is a binary classification of whether a candidate sticker is appropriate given the dialogue context. We take all dialogue-sticker pairs in the dataset as positive samples and randomly sample stickers to create an equal number of negative samples. The cross-entropy loss is denoted as $\mathcal{L}_{\text {main }}$ . + +Our final loss is a combination of the four loss: + +$$ +\mathcal {L} = \mathcal {L} _ {\text {m a i n}} + \alpha \mathcal {L} _ {\text {c t x}} + \beta \mathcal {L} _ {\text {e m o}} + \gamma \mathcal {L} _ {\text {s e m}} \tag {1} +$$ + +where $\alpha, \beta, \gamma$ are manually tuned hyperparameters. + +# 4 Experiments + +# 4.1 Dataset + +We use the Chinese version of the MOD dataset from DSTC10-Track11. The dataset is grounded in a dialogue scenario and contains various stickers with contextualized emotion annotation. We split each dialogue into several samples, each containing a text sequence of dialogue history and an accompanying sticker. Note that this dataset is revised from the unpublished one used in Fei et al. (2021). + +# 4.2 Baselines + +We compare our model with the following baselines from recent related work: 1) SRS (Gao et al., 2020), which encodes dialogue history and candidate sticker separately, and then employs a deep interaction network and a fusion network to score each candidate sticker; 2) MOD-GPT (Fei et al., 2021), which uses one single GPT to generate response text and match sticker; 3) CLIP, which finetunes pretrained CLIP (Radford et al., 2021) for sticker selection using the same contrastive loss. + +# 4.3 Results and Analysis + +The result is shown in Table 1. Our full model (MMBERT+ctx+emo+sem) outperforms all baselines on two test sets, and achieves the best performance in almost all settings. As expected, all the results get worse on the hard test set and when selecting one amongst all stickers. As only one + +
R10@1R10@2R10@5MRR10RALL@1RALL@2RALL@5MRRALL
easy test
SRS230.5154.2471.2848.15----
MOD-GPT31.2054.8172.1349.205.109.0515.5711.46
CLIP38.4456.4582.2756.766.009.3916.6112.69
MMBERT45.4466.7890.9564.035.6910.0819.4413.98
MMBERT+ctx47.0667.3490.7665.005.9110.2620.7214.44
MMBERT+ctx+emo48.8070.6792.2966.886.0711.2622.0215.22
MMBERT+ctx+emo+sem49.14**69.46**91.76**66.67**7.40**12.07**22.08**15.99**
hard test
SRS23.8545.3063.5240.33----
MOD-GPT25.5049.2264.0340.513.526.1212.769.23
CLIP32.8148.5576.1751.285.798.9115.1411.55
MMBERT32.4750.4078.3251.883.906.6213.159.71
MMBERT+ctx33.1151.0478.9852.604.217.7113.8210.38
MMBERT+ctx+emo35.3952.2678.1453.654.878.1814.6611.06
MMBERT+ctx+emo+sem36.64**55.48**80.78**55.40**6.069.65*15.7912.40**
+ +Table 1: Performance of the models on DSTC10 dataset. All the numbers are scaled by 100. The easy test set contains only the same stickers seen during training, while the hard test set has unseen stickers. The footnotes ${}_{10}$ and ${}_{\mathrm{{ALL}}}$ indicate the numbers of candidate stickers considered for each train and test case, which are 10 (ground truth sticker plus 9 randomly sampled stickers) or all available stickers respectively. R@k is the recall rate of top-k predicted stickers and MRR the Mean Reciprocal Rank of ground truth stickers. The abbreviations ctx,emo and sem correspond to the auxiliary task 1,2 and 3 respectively in Section 3. A paired t-test is conducted between the full model (MMBERT+ctx+emo+sem) and CLIP (*: $p < {0.05}, * * : p < {0.01}$ ). + +![](images/2f841a397e493691b86b12d7ed552267efd93c7fb0534eeacd8a383ea343364e.jpg) +Figure 3: Examples of word saliency in the dialogue history. Word saliency is computed as Frobenius norm of its gradient with regard to the main task loss. Darker color indicates the word is more important. The words in red denote the text in the sticker. + +out of the numerous and various online stickers is considered correct, the task is inherently challenging. We find that CLIP is a strong baseline due to its better generalization ability on the hard set, compared with our base model which has no auxiliary task (MMBERT). This may be because CLIP is pretrained on a large number of image-text pairs. However, with multitask learning, our full model outperforms CLIP, although BERT has never seen images during pretraining. Thus, we conclude that our multitask learning method can improve sticker selection by explicitly guiding the model to understand multimodal information. + +![](images/5b4ce9c5a19f201992626999bde28725c8f6a47ff2c40679b3e322e2c874ab7f.jpg) +Figure 4: The diversity of the predicted and ground truth stickers in the easy test set. + +We also perform an ablation study to verify the effect of each auxiliary task. A clear trend emerges that the performance improves as each auxiliary training task is added to MMBERT, verifying the efficacy of our task design. One exception is that MMBERT+ctx+emo performs slightly better than our full model in terms of $\mathbf{R}_{10}@\mathbf{2}$ , $\mathbf{R}_{10}@\mathbf{5}$ , and $\mathbf{MRR}_{10}$ . However, the inconsistency disappears when considering all stickers as candidates. Furthermore, our full model performs significantly better on the hard test set which contains unseen stickers. Hence, we conclude that introducing semantic information improves the model's generalization ability. We also find that our full model achieves $60\%$ accuracy on the validation set for the auxiliary + +![](images/61b959440d9953b02005d6d4be1d77ca794f9854c06389a82c8813d372fc60d0.jpg) + +# 最近有想去青岛玩的吗 + +(Does anybody want to go to Qingdao recently) + +已经在青岛了 + +(I am already in Qingdao) + +![](images/2f3d9908e53a2c55745f5dba665366087ae0ed33c3bb8546aceb7d580297e29c.jpg) + +![](images/18c46a0c07c4822a47cb6addf703e51aec272d50d87b5aa6662cdf01c17619e6.jpg) + +# 你是青岛人还是也打算去那边玩呀 + +(Are you from Qingdao or are you + +also planning to go there to play) + +青岛人目前在青岛呢。如果想来可以一起玩的 + +![](images/22f9c14916fc09bac34dace2986be5bbac59c31e0246de8d3c6fc77997685813.jpg) + +(Qingdao native. Currently in Qingdao. If you want to come here we can play together) + +![](images/b487f29612a6cd6031f0dafbdbc06922e5d5fa3b0500e7e58855a877cf7c5ad9.jpg) + +# 你是青岛人还是也打算去那边玩呀 + +(Thank you. Do you have time recently) + +![](images/47f8d5845beac8fd17131748d41044ddaba9325c2f6f3380e39654fb392ba67b.jpg) + +![](images/108b38232373a52ebb926c889c9db03af027e03009a8ce14796fd887ba668731.jpg) + +![](images/1a98836d16a02582f31ca38f5d6b80d2ccc6b301e676b4efd1f425e273b4077f.jpg) +curious + +![](images/0e9f2e5fb1d8aafebd4f2a8d0da199f2b45c1c6e15f487fc8b0220c427955126.jpg) +afraid + +![](images/c77fc7ba0be7adfa82bad1314783170fc96e7b3fd7c16c4b28c903d2cfee3a24.jpg) +disdainful + +![](images/030626938bd18bee315e73feb740e43b6aba720c5641dde1621cb8c3a758e387.jpg) +Figure 5: A failing case of our model. The leftmost sticker is selected by our model among the four candidate stickers. The appropriate sticker is marked with a red rectangle. The red words explain the stickers' emotions or meanings. + +# 本本关不了机了,求帮助 + +(I can't turn off the computer, please help) + +# 强制关机!等等重启看看 + +(Force shutdown! Wait to restart and see) + +![](images/38ca12c53e887e2bb277cdf0f802ff7ff56b72db238581193874fb05f596e3eb.jpg) + +# 有问题重启不了。关不了机。我想扣电池 + +(Cannot restart if there is a problem. Can't turn off the machine. I want to button the battery) + +![](images/54a476ea65fe468b36a1c5d3a2bb3f2193a6171fdec2db7e7dceda81f848947d.jpg) + +![](images/bc73a4d168fe218a9c13024e7b58b6749b5284b54309084908248bf760e8c494.jpg) +helpless +angry + +![](images/f2584a485a7161cad879f6d880c0e52d29713dc182034787b2c8a34111efc215.jpg) +thankful + +![](images/60ae884ee7005fec05d3be72a4c38fdde6ba3d66a78275a948d53abddbf3a17d.jpg) +cute +Figure 6: A case in which our model's prediction is not the same as the answer but also appropriate. The leftmost sticker is selected by our model among the four candidate stickers. The appropriate sticker is marked with a red rectangle. The red words explain the stickers' emotions or meanings. + +sticker emotion classification task with 52 emotion labels in total, which is reasonable and confirms our model can learn from the auxiliary tasks. + +We visualize the saliency of different words in the dialogue history in Figure 3, which shows that the more relevant words (e.g., guessed, good and modest) in the dialogue history contribute more to our model's prediction. Notably, our model could + +attend to some distant words (e.g., good), not just the words inside the previous utterance. + +We also analyze the prediction diversity of our full model. As shown in Figure 4, the predictions of our model are diverse in general, covering almost all stickers in the whole candidate set. We note that a few stickers are predicted significantly more times than other stickers, which is because they appear much more frequently than other stickers in the training set. We leave addressing the imbalance problem of the training set as our future work. + +# 4.4 Case Study + +We present a successful case in Figure 1, where the ground truth sticker has no OCR information, making it challenging for the model to understand its semantic meaning. Moreover, the model needs to understand that the dialogue is in a delighted context, and the stickers' emotions and meanings in order to distinguish the most appropriate sticker from the others. This case suggests our model has a good understanding of dialogue history and sticker emotion and semantic meaning with the help of auxiliary tasks. + +We show a failing case of our model in Figure 5. In this case, the appropriate sticker never appears in the training set. Considering the hard test set is more challenging than the easy test set, improving the generalization ability of our model is thus an important direction of future work. The same is true for baselines. + +In the dataset we used, only one sticker is considered correct. However, we observe cases where the model's selection is not the same as the answer but is also appropriate. An example is shown in Figure 6. Therefore, the results in Table 1 indicate a lower bound performance and our model may perform better in practice. + +# 5 Conclusion + +In this paper, we address the challenging task of selecting appropriate stickers in open-domain multiturn dialogue. We propose a multitask learning method with three auxiliary tasks to enhance the understanding of dialogues and stickers. Experiments show that our model outperforms strong baselines, confirming the effectiveness of our multitask learning method for sticker selection. Although our experiments are conducted on a Chinese dataset, our methods are expected to work for other languages. + +# References + +Francesco Barbieri, Miguel Ballesteros, Francesco Ronzano, and Horacio Saggion. 2018. Multimodal emoji prediction. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers), pages 679-686. +Francesco Barbieri, Miguel Ballesteros, and Horacio Saggion. 2017. Are emojis predictable? In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics: Volume 2, Short Papers, pages 105-111. +Abhishek Das, Satwik Kottur, Khushi Gupta, Avi Singh, Deshraj Yadav, José MF Moura, Devi Parikh, and Dhruv Batra. 2017a. Visual dialog. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 326-335. +Abhishek Das, Satwik Kottur, José MF Moura, Stefan Lee, and Dhruv Batra. 2017b. Learning cooperative visual dialog agents with deep reinforcement learning. In Proceedings of the IEEE international conference on computer vision, pages 2951-2960. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171-4186, Minneapolis, Minnesota. Association for Computational Linguistics. +Zhengcong Fei, Zekang Li, Jinchao Zhang, Yang Feng, and Jie Zhou. 2021. Towards expressive communication with internet memes: A new multimodal conversation dataset and benchmark. arXiv preprint arXiv:2109.01839. +Shen Gao, Xiuying Chen, Chang Liu, Li Liu, Dongyan Zhao, and Rui Yan. 2020. Learning to respond with stickers: A framework of unifying multi-modality in multi-turn dialog. In Proceedings of The Web Conference 2020, pages 1138-1148. +Artie Konrad, Susan C Herring, and David Choi. 2020. Sticker and emoji use in facebook messenger: Implications for graphicon change. Journal of Computer-Mediated Communication, 25(3):217-235. +Abhishek Laddha, Mohamed Hanoosh, Deblood Mukherjee, Parth Patwa, and Ankur Narang. 2020. Understanding chat messages for sticker recommendation in messaging apps. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 13156-13163. +Zujie Liang, Huang Hu, Can Xu, Chongyang Tao, Xi-ubo Geng, Yining Chen, Fan Liang, and Daxin Jiang. 2021. Maria: A visual experience powered conversational agent. In Proceedings of the 59th Annual + +Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 5596-5611, Online. Association for Computational Linguistics. +Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. 2021. Learning transferable visual models from natural language supervision. arXiv preprint arXiv:2103.00020. +Nils Reimers and Iryna Gurevych. 2020. Making monolingual sentence embeddings multilingual using knowledge distillation. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 4512-4525. +Ying Tang and Khe Foon Hew. 2019. Emoticon, emoji, and sticker use in computer-mediated communication: A review of theories and research findings. International Journal of Communication, 13:27. +Xingyao Wang and David Jurgens. 2021. An animated picture says at least a thousand words: Selecting gif-based replies in multimodal dialog. In *Findings of the Association for Computational Linguistics: EMNLP* 2021, pages 3228-3257. +Yida Wang, Pei Ke, Yinhe Zheng, Kaili Huang, Yong Jiang, Xiaoyan Zhu, and Minlie Huang. 2020. A large-scale chinese short-text conversation dataset. In CCF International Conference on Natural Language Processing and Chinese Computing, pages 91-103. Springer. +Ruobing Xie, Zhiyuan Liu, Rui Yan, and Maosong Sun. 2016. Neural emoji recommendation in dialogue systems. arXiv preprint arXiv:1612.04609. + +# A Dataset Details + +Statistics of the dataset are shown in Table 3. There are 307 stickers in total and 228 out of them have textual information extracted by OCR. For stickers without emotion labels or semantic labels, we simply ignore the emotion classification loss or the semantic prediction loss. A better way to deal with the missing labels is left as future work. + +For each dialogue sample, we ignore stickers in the middle of the dialogue history, as we found in preliminary experiments that removing them has no significant impact on the performance. + +# B Implementation Details + +For all the models implemented by ourselves in our experiments, we set the batch size to 8 and use AdamW optimizer with cosine scheduler. For the CLIP baseline, as there is no available CLIP + +
R10@1R10@2R10@5MRR10RALL@1RALL@2RALL@5MRRALL
easy test
MMBERT+ctx+emo48.8070.6792.2966.886.0711.2622.0215.22
MMBERT+ctx+emo+sem49.1469.4691.7666.677.4012.0722.0815.99
MMBERT+ctx+emo+sem-OCR49.9570.8992.1367.396.6312.0722.1815.80
MMBERT+ctx+emo+sem-OCR+data47.0667.5091.0765.126.039.7419.7514.23
hard test
MMBERT+ctx+emo35.3952.2678.1453.654.878.1814.6611.06
MMBERT+ctx+emo+sem36.6455.4880.7855.406.069.6515.7912.40
MMBERT+ctx+emo+sem-OCR32.8750.0376.0751.514.587.7413.7010.44
MMBERT+ctx+emo+sem-OCR+data33.4250.9478.7852.494.757.8014.3110.75
+ +Table 2: Effect of incorporating semantic label prediction and OCR feature on DSTC10 dataset. All the numbers are scaled by 100. The easy test set only contains stickers ever seen in the training set, while the hard test set contains stickers unseen during training. $R_{10}$ @k and $R_{ALL}$ @k mean recall rate of ground truth stickers from top-k stickers chosen by the models, given a candidate set of 10 or all available stickers respectively. $MRR_{10}$ and $MRR_{ALL}$ represent Mean Reciprocal Rank of ground truth stickers among 10 or all available stickers. MMBERT+ctx+emo+sem-OCR means not using OCR information for other tasks except sticker semantic prediction. MMBERT+ctx+emo+sem-OCR+data means not using OCR information for other tasks except sticker semantic prediction and adds extra sticker-description pairs for sticker semantic prediction task. + +
TrainValidEasy testHard test
# samples211575354232157028
# emo samples2098903495--
# utterances1666208260402544759773
# tokens10400271827803818
# stickers283249239278
Avg. # utterances7.887.357.928.50
Avg. # tokens18.4212.4712.9114.54
+ +Table 3: Dataset statistics. Easy test set's stickers all appear in the train set, while the hard test set contains stickers which don't appear in the train set. One original dialogue could be split into several samples, each containing one sticker response. The token num is computed by the tokenizer of BERT. # emo samples means the number of samples containing emotion annotation. Avg. # tokens means the average number of tokens for each utterance. + +model especially pretrained in Chinese, we use a multilingual version adapted via knowledge distillation (Reimers and Gurevych, 2020) $^3$ . We cut the dialogue history to take only the last sentence in order to fit the length limit of CLIP's text encoder. We also tried to use the last two or more sentences, but found that the performance decreased. All BERT-based models and MOD-GPT use the image encoder in the CLIP baseline. We set the CLIP image encoder's learning rate to 5e-7 and the text encoder's learning rate to 9e-6. For BERT-based models, we set the learning rate to 9e-6 and + +fix the image encoder following (Fei et al., 2021). The maximum epoch is set to 10. For the total loss, $\alpha$ is set to $0.05$ , $\beta$ is set to $0.2$ and $\gamma$ is set to $0.1$ . All the hyperparameters are selected based on the validation set. The maximum training time for one epoch is about 5 hours on one single V100 GPU. + +# C Effect of Semantic Information + +In our full model, we also added semantic labels to other tasks' inputs, i.e., the main task of context-sticker matching, the masked context prediction task and the sticker emotion classification task. It raises an interesting question of how the performance will change if we remove this information. The result is shown in Table 2. As we can see, the sticker semantic prediction task is more beneficial for the easy test set, while adding OCR information to other tasks is more beneficial for the hard test set. We conjecture that because of the relatively small number of stickers (less than 300), it could be easier for the model to memorize the meaning of all stickers in the dataset, which potentially damages the model's generalization ability on unseen stickers in the hard test set. Adding OCR information for other tasks greatly alleviates this phenomenon because it could offer semantic labels for unseen stickers and enhance the model's generalization ability. + +We also tried to enhance the model's generalization ability by incorporating additional sticker-description pairs from another source into the + +
RALL@1RALL@2RALL@5MRRALL
easy test
CLIP7.49/2.95/4.5411.23/6.09/5.1418.21/13.23/4.9814.29/9.54/4.75
MMBERT+ctx+emo+sem8.69/4.85/3.8412.80/10.75/2.0519.69/27.12/-7.4315.89/16.28/-0.39
hard test
CLIP6.82/3.58/3.2410.23/6.46/3.7716.60/12.66/3.9412.74/9.26/3.48
MMBERT+ctx+emo+sem6.95/4.50/2.4510.68/7.77/2.9116.48/14.62/1.8613.24/10.91/2.33
+ +Table 4: Performance of our full model and CLIP on the divided dataset. The three values divided by / correspond to the performance on the sub dataset where stickers have text, the performance on the sub dataset where stickers don't have text and their difference. All the numbers are scaled by 100. The easy test set contains only the same stickers seen during training, while the hard test set has unseen stickers. R@k is the recall rate of top-k predicted stickers and MRR the Mean Reciprocal Rank of ground truth stickers. The abbreviations ctx, emo and sem correspond to the auxiliary task 1, 2 and 3 respectively in Section 3. + +sticker semantic prediction task. As Table 2 shows, this method could increase the performance on the hard test set as expected, but the performance on the easy test set drops significantly, which may be attributed to the distribution difference between the additional data and our original data. + +# D Analysis of Sensitivity to the Text in Stickers + +To explore whether stickers have text or not could affect the model's performance, we split each test set into two parts, i.e., stickers with recognized text labels versus those without text labels. The number of samples in each part is 2164 and 1051 for the easy set, and 4429 and 2599 for the hard set. We compare the performance of our full model with that of CLIP on the divided test sets in Table 4. To avoid randomness in candidate set construction, we only compare the two models with the whole candidate set. In general, our full model and CLIP work better when the stickers have text, which suggests that the text in the sticker could help the model better understand the sticker. However, our model is less sensitive to whether stickers have text or not according to the smaller difference value compared with CLIP. This implies our model is more robust to different kinds of candidate stickers. \ No newline at end of file diff --git a/selectingstickersinopendomaindialoguethroughmultitasklearning/images.zip b/selectingstickersinopendomaindialoguethroughmultitasklearning/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..d190eaee9886a31e33b2d4a98281c32dc1335421 --- /dev/null +++ b/selectingstickersinopendomaindialoguethroughmultitasklearning/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75d9f6cd73b58bd2dc679d4d2b754bcabe9406391fb4f2c366c1570f86b2dd2b +size 409379 diff --git a/selectingstickersinopendomaindialoguethroughmultitasklearning/layout.json b/selectingstickersinopendomaindialoguethroughmultitasklearning/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..049b27836033d89d0b97f97f2da1e7ba5ef32e3c --- /dev/null +++ b/selectingstickersinopendomaindialoguethroughmultitasklearning/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0cf9a6936a4de04fb758d98b41cc2ec7a274f7c40fce42a41fc18fd4d7fff99e +size 287999 diff --git a/semanticallydistributedrobustoptimizationforvisionandlanguageinference/5ecfa20b-4f23-40af-a799-4949ae547c57_content_list.json b/semanticallydistributedrobustoptimizationforvisionandlanguageinference/5ecfa20b-4f23-40af-a799-4949ae547c57_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..7fc4c91f24c11d1ef4403166e96bac2305a02c38 --- /dev/null +++ b/semanticallydistributedrobustoptimizationforvisionandlanguageinference/5ecfa20b-4f23-40af-a799-4949ae547c57_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:97ce0cb2fcee02af15ffc543664b41ddefa017649785b6129729adca8f6096a8 +size 150796 diff --git a/semanticallydistributedrobustoptimizationforvisionandlanguageinference/5ecfa20b-4f23-40af-a799-4949ae547c57_model.json b/semanticallydistributedrobustoptimizationforvisionandlanguageinference/5ecfa20b-4f23-40af-a799-4949ae547c57_model.json new file mode 100644 index 0000000000000000000000000000000000000000..dcba0fd7954e1d26acc7748fb04025a1676c420d --- /dev/null +++ b/semanticallydistributedrobustoptimizationforvisionandlanguageinference/5ecfa20b-4f23-40af-a799-4949ae547c57_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f2f9d4b6cd7b737db5005cdec206cf20e58e99a702fc44a17d7c183f20f300b0 +size 180156 diff --git a/semanticallydistributedrobustoptimizationforvisionandlanguageinference/5ecfa20b-4f23-40af-a799-4949ae547c57_origin.pdf b/semanticallydistributedrobustoptimizationforvisionandlanguageinference/5ecfa20b-4f23-40af-a799-4949ae547c57_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..d46004fe485bdce3a3f6584d7b0115966496204c --- /dev/null +++ b/semanticallydistributedrobustoptimizationforvisionandlanguageinference/5ecfa20b-4f23-40af-a799-4949ae547c57_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2b97d857d215399ea456700427f80aeb5e1ca4b85989729bdd7f9d8bebba270e +size 3200950 diff --git a/semanticallydistributedrobustoptimizationforvisionandlanguageinference/full.md b/semanticallydistributedrobustoptimizationforvisionandlanguageinference/full.md new file mode 100644 index 0000000000000000000000000000000000000000..3dc323232d2491d99267d9f2e1348d88f55952e9 --- /dev/null +++ b/semanticallydistributedrobustoptimizationforvisionandlanguageinference/full.md @@ -0,0 +1,622 @@ +# Semantically Distributed Robust Optimization for Vision-and-Language Inference + +Tejas Gokhale*, Abhishek Chaudhary*, Pratyay Banerjee, Chitta Baral, and Yezhou Yang +Arizona State University + +{tgokhale, achaud39, pbanerj6, chitta, yz.yang}@asu.edu + +# Abstract + +Analysis of vision-and-language models has revealed their brittleness under linguistic phenomena such as paraphrasing, negation, textual entailment, and word substitutions with synonyms or antonyms. While data augmentation techniques have been designed to mitigate against these failure modes, methods that can integrate this knowledge into the training pipeline remain under-explored. In this paper, we present $\mathbf{SDRO}^{\dagger}$ , a model-agnostic method that utilizes a set linguistic transformations in a distributed robust optimization setting, along with an ensembling technique to leverage these transformations during inference. Experiments on benchmark datasets with images (NLVR $^2$ ) and video (VIOLIN) demonstrate performance improvements as well as robustness to adversarial attacks. Experiments on binary VQA explore the generalizability of this method to other V&L tasks. + +# 1 Introduction + +"Does the text match the image?" - this simple question represents the Vision-and-Language Inference (VLI) task, as shown in Figure 1. Image-text matching forms the backbone for V&L pre-training (Sun et al., 2019; Tan and Bansal, 2019; Lu et al., 2019) and has resulted in improvements in downstream tasks such as visual question answering, image retrieval, referring expressions, and visual commonsense reasoning. While natural language inference (without visual inputs) has been extensively studied (Bowman et al., 2015; Williams et al., 2018; Khot et al., 2018; Demszky et al., 2018), VLI demands the additional capability of being grounded in the scene while understanding semantics. Although pre-trained language models (PLMs) (Vaswani et al., 2017; Devlin et al., 2019; Raffel et al., 2020) have been useful for encoding text into vector embeddings, recent find + +![](images/3339ff8eb125261543b2d18b6dbbff206b945a09921220032afa34c25aa056dd.jpg) +Figure 1: VLI models predict whether a sentence is True or False, given the visual input. (Top) sample from NLVR² with two images as input; (bottom) sample from VIOLIN with video and subtitles as input. + +ings point to undesirably high cosine similarity of two random words (Ethayarajh, 2019), the struggle with negation (Kassner and Schütze, 2020; Ettinger, 2020), and semantically equivalent adversarial examples (Ribeiro et al., 2018). These findings call for robust training protocols to avoid propagation of these findings into VLI models. + +Adversarial training (AT) and distributed robust optimization (DRO) (Madry et al., 2018; Hu et al., 2018a; Sinha et al., 2018) have emerged as effective solutions to related problems in robust image classification, such as adversarial defense and domain generalization (Volpi et al., 2018). DRO assumes a perturbation set (typically an $\ell_p$ norm ball) around the training distribution, and minimizes the worst-case performance over this perturbation set. AT and DRO are popular for computer vision tasks, since the small perturbations of pixel intensities do not change the categorical meaning of the image. + +However, in the case of text inputs, even small perturbations of their vector embeddings may result in absurd sentences or vectors that do not map to any word-token in vocabulary. The topology of the PLM embedding space is not well understood, especially with regard to what kind (and magnitude) of perturbations result in specific changes in + +![](images/4aa983e95bfdb008deb10fc5bbf7ff3ace1027ed9b826ab1fbd7e0f7bdb302fa.jpg) +Figure 2: Comparison between (left) $\epsilon$ -bounded image perturbations and (right) linguistics-based semantics-preserving (blue) as well as semantics-inverting (red) transformations for sentences. + +semantics, such as similar meanings (speak $\rightarrow$ talk) or opposite meanings (Heaven $\rightarrow$ Hell) without resulting in random or absurd words. Vector-based additive perturbations of text inputs thus restrict interpretability. However, in the domain of natural language, knowledge of logic, grammar, and semantics can be leveraged to transform sentences as shown in Table 1. Such linguistically-informed perturbations provide us control over the semantics of the resulting sentence and label, as shown in Figure 2. + +We present a technique that modifies robust optimization by incorporating linguistically-informed transformations. Our approach: Semantically Distributed Robust Optimization (SDRO) utilizes a pre-defined set of linguistic transformations (such as negation, word substitution, and paraphrasing) as the perturbation set instead of optimizing over the vector-space. We dub this set of transformations "SISP" i.e., semantics-inverting (SI) and semantics-preserving (SP) transformations. SDRO is model-agnostic since it can be applied to text inputs of any existing VLI model and dataset agnostic since it uses automated transformations without explicit knowledge of the text domain. + +We apply SDRO to two VLI benchmark datasets: image-based NLVR $^2$ (Suhr et al., 2019) as well as video-based VIOLIN (Liu et al., 2020). To demonstrate the generalizability of SDRO to other V&L tasks, we also report results on the "yes/no" subset of VQA-v2 (Goyal et al., 2017). Our experiments show model-agnostic improvements in accuracy for all three benchmarks. While models trained with naive data augmentation using SISP suffer from a trade-off between robustness and accuracy, models that utilize SDRO improve along both metrics. SDRO also allows us to learn in low-resource settings, serving as a smart data aug + +mentation tool – SDRO models trained only with $80\%$ of the original dataset outperform existing state-of-the-art which utilizes the entire dataset. + +Since SISP transforms do not require the ground truth label to either produce an SP or SI transformed sentence, we can also apply them to any new input sentences that are observed at test-time. Given a test input sentence, we generate its SISP versions, and obtain the prediction from our model for each SISP version. These predictions are ensembled using weighted averaging, giving equal weight to the prediction for the original sentence and the average predictions for all transformed sentences. We find that this ensembling of predictions of the SDRO model at test-time pushes the state-of-the-art further, thereby demonstrating the usefulness of semantic sentence transformations, both during training and testing. + +# 2 Method + +# 2.1 Preliminaries + +Consider a training distribution $P_{tr}$ consisting of inputs $\mathbf{x}$ and labels $\mathbf{y}$ . For VLI, input $\mathbf{x}$ is multi-modal (visuals and text), with labels $\mathbf{y} \in \{\text{True}, \text{False}\}$ . Under the empirical risk minimization (ERM), the following risk is minimized: + +$$ +\mathcal {R} _ {E R M} = \underset {(\mathbf {x}, \mathbf {y}) \sim P _ {t r}} {\mathbb {E}} \ell (f (\mathbf {x}; \theta), \mathbf {y}), \tag {1} +$$ + +where $\ell$ is a suitable loss function such as cross-entropy loss for classification tasks. ERM provides generalization guarantees (Vapnik, 1991) for i.i.d. test samples, but not for out-of-distribution or adversarial examples. + +Distributed Robust Optimization (DRO) (Hu et al., 2018b; Sagawa et al., 2020) searches for loss-maximizing perturbations of the input within an $\epsilon$ -divergence ball around $P_{tr}$ and minimize the risk over such perturbed distributions. + +$$ +\mathcal {R} _ {D R O} = \sup _ {P: D (P, P _ {t r}) < \epsilon} \underset {(\mathbf {x}, \mathbf {y}) \sim P} {\mathbb {E}} \ell (f (\mathbf {x}; \theta), \mathbf {y}). \tag {2} +$$ + +The solution to Equation 2 guarantees robustness inside such $\epsilon$ -bounded distributions $P$ . The inner maximization is typically solved using gradient-based methods (Madry et al., 2018) over additive perturbations $\delta$ such that $\mathbf{x} + \delta$ fools the classifier. + +# 2.2 SDRO + +For sentence inputs, additive perturbations are intangible and may result in ambiguity. An alterna + +
CategoryOriginalTransformed
SINoun-AntonymThe two women are driving on the street with the convertible top down.The two men are driving on the street with the convertible top down.
Verb-AntonymThere are children standing by the door.There are children sitting by the door.
Comparative-AntonymThere are more monitors in the image on the right than on the left.There are few monitors in the image on the right than on the left.
Number-SubstitutionThere are three bowls of dough with only one spatula.There are eleven bowls of dough with only one spatula.
Pronoun-SubstitutionIn one of the images, a woman is taking a selfie.In one of the images, he is taking a selfie.
Subject-Object SwapThe two women are driving on the street with the convertible top down.The two top are driving on the street with the convertible women down.
NegationThe closet doors on the right are mirrored.The closet doors on the right are not mirrored
SPNoun-SynonymThe right image shows three bottles of beer lined up.The right picture shows three bottles of beer lined up.
Verb-SynonymSomeone is using a kitchen utensilSomeone is utilizing a kitchen utensil.
Comparative-SynonymThe bottle on the right is larger than the bottle on the left.The bottle on the right is bigger than the bottle on the left.
Number-SubstitutionThe two white swans are swimming in the canal gracefully.The less than seven white swans are swimming in the canal gracefully.
Pronoun-SubstitutionIn one of the images, a woman is taking a selfie.In one of the images, she is taking a selfie.
ParaphrasingA man in a green shirt came on the porch and knocked on the door.A man in a green shirt came up to the porch and knocked on the door.
+ +Table 1: Examples illustrating the effect of each SISP transformation on input sentences. + +tive approach is to consider groups $\mathcal{G}$ representing certain sub-populations or semantic categories within the data distribution. For text inputs in VLI, we consider the use of semantic sentence transformations as the perturbation mechanism - thus each transformation creates a sub-population or group of sentences. Examples of these transformations and their resulting effect on sentences is shown in Table 1. These transformations $g(x,y) = (\mathbf{x}_g,\mathbf{y}_g)$ are of two types: semantics-preserving (SP) if $\mathbf{y}_g = \mathbf{y}$ , or semantics-inverting (SI) if $\mathbf{y}_g \neq \mathbf{y}$ . + +In this paper we propose the use of SI and SP transformations to create groups within the training data which can be leveraged by a robust optimization techniques to minimize worst group error. While previous work on adversarial training uses vector perturbations of sentence embeddings, our sentence-level transformations are interpretable as shown in Table 1). The ability of generating adversarial samples with inverted meanings is a key distinction between adversarial training (AT) and SDRO. While AT is restricted to SP perturbations inside an $\epsilon$ norm-ball, SDRO can impart larger linguistic perturbations (both SI and SP) beyond the norm-ball, by minimizing the worst-case expected risk over these groups: + +$$ +\mathcal {R} _ {S D R O} = \sup _ {g \in \mathcal {G}} \underset {(\mathbf {x}, \mathbf {y}) \sim g} {\mathbb {E}} \ell (f (\mathbf {x}; \theta), \mathbf {y}). \tag {3} +$$ + +Implementation. As a first step of SDRO, we randomly sample a subset $\mathcal{C}$ of the training dataset $\mathcal{D}$ s.t. $|\mathcal{C}| / |\mathcal{D}| = T$ . We find adversarial samples after every epoch and create an augmented dataset $\mathcal{D}_{aug}$ which contains $(1 - T)|\mathcal{D}|$ original samples and $T|\mathcal{D}|$ adversarial samples, thus retaining the + +size of the training dataset. We define $\ell_g$ as the classification loss for a transformed sample $(\mathbf{x}_g, \mathbf{y}_g)$ : + +$$ +\ell_ {g} (\mathbf {x}, \mathbf {y}) \triangleq \ell (f (\mathbf {x} _ {g}), \mathbf {y} _ {g}), \forall g \in \mathcal {G}. \tag {4} +$$ + +# 2.3 Variants of SDRO + +We design two variants of SDRO: Sample-Wise (SW) and Group-Wise (GW) SDRO. + +Sample-Wise SDRO is a greedy version of SDRO, in which, for every input $\mathbf{x}$ , a transformation that maximally fools the classifier: $g^{*} = \operatorname{argmax}_{g\in \mathcal{G}}\ell_{g}(\mathbf{x},\mathbf{y})$ , is added to the set of adversarial examples $\mathcal{D}_{adv}$ . The model is then finetuned on the augmented dataset. + +$$ +\mathcal {D} _ {a d v} = \left\{g ^ {*} (\mathbf {x}, \mathbf {y}): (\mathbf {x}, \mathbf {y}) \in \mathcal {C} \right\}, \tag {5} +$$ + +$$ +\mathcal {D} _ {a u g} = \mathcal {D} _ {1: (1 - T) | \mathcal {D} |} \cup \mathcal {D} _ {a d v} \tag {6} +$$ + +However, this greedy approach is susceptible to the model's biases towards certain transformations. For instance, if negation and verb-antonym are universally hard for most sentences, i.e., result in the maximum classifier loss amongst all transformations $g$ , then $\mathcal{D}_{adv}$ will be dominated by these groups, resulting in an unbalanced training set. + +Group-Wise SDRO is devised to mitigate against the model becoming biased towards the "hardest" transformations. Using Equation 4, we calculate the transformation losses for each transformation of each sample in a training batch, yielding a set of classifier losses per "group" $g$ : + +$$ +L _ {g} \colon \mathcal {C} \rightarrow \mathbb {R}; L _ {g} = \left\{\ell_ {g} (\mathbf {x}, \mathbf {y}) \colon (\mathbf {x}, \mathbf {y}) \in \mathcal {C} \right\}. \tag {7} +$$ + +We obtain the top-k losses per group $g$ as: + +$$ +L _ {G} ^ {k} = \underset {\Lambda \subset L _ {G}, | \Lambda | = k} {\operatorname {a r g m a x}} \sum_ {\lambda \in \Lambda} \lambda , \text {w h e r e} k = \left\lfloor \frac {| \mathcal {C} |}{| \mathcal {G} |} \right\rfloor . \tag {8} +$$ + +Then $\mathcal{D}_{adv}$ is compiled as the union of per-group adversaries using Equation 8, and augmented to the training dataset using Equation 6. + +Test-Time Ensembling of Predictions. Semantic transformations $g$ allow us to obtain multiple "views" $\mathbf{x}_g = g(\mathbf{x})$ of the input, and the corresponding predictions $\hat{\mathbf{y}}_g = f(\mathbf{x}_g)$ . We ensemble these predictions and the original prediction $\hat{\mathbf{y}} = f(\mathbf{x})$ with a simple weighted-average. Note that $\mathcal{G}$ contains both SP and SI transformations, $\mathcal{G}_{SP}$ and $\mathcal{G}_{SI}$ . Since the expected label for $\mathcal{G}_{SI}$ is flipped, during ensembling we use the flipped probabilities $1 - f(\mathbf{x}_g)$ . The ensembled prediction is: + +$$ +\hat {\mathbf {y}} _ {e} = \alpha f (\mathbf {x}) + \frac {1 - \alpha}{2} \sum_ {g \in \mathcal {G} _ {S P}} \frac {f (\mathbf {x} _ {g})}{| \mathcal {G} _ {S P} |} + \frac {1 - \alpha}{2} \sum_ {g \in \mathcal {G} _ {S I}} \frac {1 - f (\mathbf {x} _ {g})}{| \mathcal {G} _ {S I} |}. \tag {9} +$$ + +Note that our method is a test-time ensemble and does not require training multiple models. This method is, in principle, similar to the ensembling strategy in image classification used by Chai et al. (2021) who train a generative model $g$ to output different views of an image, and tune $\alpha$ over a validation set. In our work, $g$ are semantic sentence transformations, and the value of $\alpha$ does not need to be tuned over a validation set – we find that the simple intuitive choice of $\alpha = 0.5$ (equal weight to the original sample and the SISP versions) improves performance. We find that: + +- training models with SDRO using SISP transformations improves results on VLI tasks, and +- ensembling predictions of SDRO at test-time using Equation 9 further improves results. + +# 3 SISP Sentence Transformations + +This section describes the generation of semantics-preserving (SP) and semantics-inverting (SI) statements. SISP transforms are implemented using Spacy (Honnibal et al.). Dataset statistics and additional visualizations are in the Appendix. + +Noun Synonym/Antonym: We extract nouns (subjects and objects) with dependency parsing, and find two nearest (synonyms) or farthest (antonyms) neighbors in the GloVe space (Pennington et al., 2014) using a threshold of 0.55. + +
MethodNLVR2VIOLIN
CleanSPSICleanSPSI
Data-Aug51.0750.9240.7461.1262.7862.15
SW-SDRO51.1450.9740.7562.7858.1364.78
GW-SDRO51.0750.9240.7362.1552.7974.98
+ +Table 2: Text-only evaluation of biases due to SISP transformations. $50\%$ indicates no bias. + +Verb Synonym/Antonym: We extract verbs using POS tagging and obtain their synonyms or antonyms. Verbs are lemmatized and inflected to the correct form using Lemminflect (Jascob, v0.2.1 (February 22, 2020). + +Comparative Synonym/Antonym: Adjectival complements and modifiers are replaced with synonyms (large $\rightarrow$ big) or antonyms (large $\rightarrow$ small). + +Number Substitution: Numerals are replaced by number-words $(2\rightarrow two)$ or vice versa for SP transformations, or by their lower or upper bounds, (SP: $3\to$ more than two, SI: two $\rightarrow$ less than two). + +Pronoun Substitution: Human-related nouns (such as woman, boy, people) are substituted by pronouns, while pronouns are substituted by generic descriptors (something, someone, somebody, they). + +Negation: We use template-based negation (Gokhale et al., 2020b) with Subject-Verb Agreement (Wren and Martin, 2000). We add 'did not' before a past-tense verb, 'do not', 'does not', or 'not' before a base-form verb, gerund, or participle, or a 'not' before an adposition or adjective. + +Subject-Object Swap: Nominal or clausal subjects and direct or prepositional objects from the sentence are swapped for inverting semantics. + +Paraphrasing: Input sentences are translated to Russian and then back-translated to English using neural machine translation (Ott et al., 2019). + +# 3.1 Data Analysis + +Quantification of Bias: Since SISP transforms are based on templates, they can potentially introduce spurious linguistic correlations in the dataset. For example, in $\mathrm{NLVR}^2$ and VIOLIN datasets, negations and indefinite pronouns are infrequent. To quantify how this could impact models, we mask out the entire image and evaluate models (with VILLA as the backbone for $\mathrm{NLVR}^2$ and HERO for VIOLIN). This acts as a 'text-only' evaluation, + +with accuracies $\sim 50\%$ implying lesser bias since models do not have access to visual information. Table 2 shows that SP transforms inflict lesser bias on models than SI transforms. The effect of bias is dataset-specific; SI makes the prediction of $\mathrm{NLVR}^2$ samples harder than random (less than $50\%$ accuracy) but easier for VIOLIN. + +Transformation Fidelity: We employ human subjects to evaluate the quality of SISP-transformed sentences on (1) correctness of labels, (2) grammar, (3) semantics, and (4) visual grounding. We report a unified average 'transformation fidelity' (details are in Appendix). Fidelity is higher for SP samples than SI (90.50% v/s 79.51%), which resonates with the complexities of inversion of meaning (Russell, 1905) and leaves room for improvement in SI transformation. + +# 4 Experiments + +Datasets. For all datasets, given images/videos and natural language text as input, the system is expected to predict a binary class label. NLVR $^2$ (Suhr et al., 2019) contains $\sim 86K$ , $7K$ , $7K$ samples for training, development, and testing respectively. Each sample in NLVR $^2$ consists of a pair of images (from search engines) and a sentence (crowdsourced). VIOLIN (Liu et al., 2020) contains video clips from popular TV shows and movies along with subtitles and crowd-sourced statements. VIOLIN contains $76K$ , $9.5K$ , $9.5K$ samples for training, validation and testing. VQA Yes/No consists of image-question-answer triplets from VQA-v2 dataset (Goyal et al., 2017). While VQA-v2 consists of multiple questions and answer types, we focus on the subset of questions with binary yes/no answers ( $\sim 38\%$ of VQA-v2). + +Evaluation Metrics. We use two evaluation metrics: (1) Clean Accuracy: accuracy on the i.i.d. benchmark test set, and (2) SISP Accuracy: average performance on SISP transformations of the test set. Since SISP transformations are automated and can be noisy (Sec 3.1), evaluation on the SISP test set can be considered a proxy for robustness. + +# 4.1 Results + +We compare SDRO with backbone models that use standard training data (BASE) and data-augmentation (+data-aug). We train SDRO and + +
ModelClean Acc.SISP Acc.
SPSIAvg.
LXMERTBASE74.3769.2037.3553.28
+ VILLA75.9869.9439.0956.15
+ data-aug71.8370.1366.3468.23
+ SW-SDRO71.1967.4166.3266.86
+ GW-SDRO74.5569.0669.3469.20
+ Test-Time Ensembling74.75-~--~--~-
UNITERBASE77.8572.7334.8653.80
+ data-aug76.6570.3481.0475.69
+ SW-SDRO78.4369.7167.5068.61
+ GW-SDRO77.5567.9381.6674.79
+ Test-Time Ensembling80.00-~--~--~-
VILLABASE78.3973.1534.1553.65
+ data-aug78.3472.1184.4477.77
+ SW-SDRO79.2369.2367.3568.29
+ GW-SDRO79.4168.6784.5476.60
+ Test-Time Ensembling82.22-~--~--~-
+ +Table 3: Results on the NLVR $^2$ public test set. $\ddagger$ + +
ModelClean Acc.SISP Acc.
SPSIAvg.
VIOLINBASE68.0757.1757.2057.18
+ data-aug61.5867.6467.7067.67
+ SW-SDRO62.8162.8462.6862.76
+ GW-SDRO63.7164.5863.1663.87
+ Test-Time Ensembling66.56-”--”--”-
HEROBASE68.5565.5932.0048.80
+ data-aug65.2159.2081.8170.51
+ SW-SDRO68.8358.9777.8368.41
+ GW-SDRO68.1956.2082.9269.57
+ Test-Time Ensembling69.90-”--”--”-
+ +Table 4: Results on VIOLIN test set. + +backbones with the same hyperparameters. We apply test-time ensembling to the best SDRO model. + +$\mathbf{NLVR}^2$ : We use Transformer-based models LXMERT (Tan and Bansal, 2019), UNITER (Chen et al., 2020b), and VILLA (Gan et al., 2020) as backbones for SDRO. VILLA (the current stateof-the-art for $\mathrm{NLVR}^2$ ) uses standard adversarial training. The percentage of SISP-transformed samples is fixed at $T = 20\%$ . Table 3 shows results on the $\mathrm{NLVR}^2$ test set, with consistent model-agnostic improvements in clean accuracy over each baseline model and improved robustness on average. Both variants of SDRO improve over $\mathrm{VILLA}_{BASE}$ by $0.84\%$ and $1.02\%$ , respectively. Test-time ensembling using Equation 9 leads to further gains, resulting in a new state-of-the-art accuracy of $82.22\%$ an improvement of $3.83\%$ over $\mathrm{VILLA}_{BASE}$ . GWSDRO results in the highest SI accuracy when used with each backbone model. + +
ModelClean Acc.SISP Acc.
SPSIAvg.
UNITERBASE83.4972.0438.9055.47
+ data-aug82.5377.0393.7085.36
+ SW-SDRO83.9275.8288.9281.48
+ GW-SDRO84.0576.9593.4185.18
+ Test-Time Ensembling84.22-”--”--”-
VILLABASE84.8274.1537.4055.77
+ data-aug83.5478.3394.5586.45
+ SW-SDRO84.5474.0288.3281.17
+ GW-SDRO85.1277.9293.4285.67
+ Test-Time Ensembling85.37-”--”--”-
+ +Table 5: Results on the VQA yes/no subset. $\ddagger$ Not to be compared with VQA-v2 leaderboard since we use a smaller training set of yes/no questions. + +VIOLIN: We consider $\mathrm{VIOLIN}_{BASE}$ (Liu et al., 2020) and HERO (Li et al., 2020), the current state of the art, as baselines. $\mathrm{VIOLIN}_{BASE}$ separately computes visual features using Faster-RCNN (Ren et al., 2015) and textual features using BERT (Devlin et al., 2019), and fuses them to be used as input to a classifier model. On the other hand, HERO is a large-scale transformer-based pre-trained model which uses various V&L pre-training tasks to compute cross-modal features. We set $T = 40\%$ . The results can be seen in Table 4. SW-SDRO model with the HERO backbone improves the state-of-the-art to $68.83\%$ , and test-time ensembling further improves it to $69.90\%$ . Interestingly, similar improvements in clean accuracy are not observed for $\mathrm{VIOLIN}_{BASE}$ , potentially because it does not use cross-modal pre-trained features. + +VQA Yes/No: We use UNITER and VILLA as the backbone models, with $T = 20\%$ . The motivation behind VQA experiments is to show that SISP transforms and SDRO can be extended to other V&L tasks. Table 5 shows that GW-SDRO is the best performing model in terms of clean accuracy, and is further improved by test-time ensembling. + +# 5 Analysis + +# 5.1 Visualization of Perturbations + +In order to quantify the diverse and larger semantic transformations compared to additive perturbations, we study the tSNE (Van der Maaten and Hinton, 2008) embeddings of (i) original samples from $\mathrm{NLVR}^2 (P)$ , (ii) their SISP-transformed versions $(P_{\text{SISP}})$ , and (iii) their adversarially perturbed versions $(P_{\text{adv}})$ . Input sentences are encoded using the UNITER text encoder for (i) and (ii), and the adversarial perturbation mechanism (Gan et al., + +![](images/0da70cf1f8b4b8751379169c582239cb4280c491ad48f0947e3f123f16ebdef2.jpg) +Figure 3: Comparison of original sentences (black) with (left) SISP-transformed sentences (blue) and (right) $\epsilon$ -bounded perturbations as a tSNE plot. + +![](images/364f757a5026038ab7e4154ad7a2d8452c1368fd86b4c205ec26a0f51fc85415.jpg) + +2020) for (iii). 3D tSNE embeddings are visualized in Figure 3; SISP transformed sentences (blue) are farther away than the perturbed versions. This shift is quantified by the KL-divergence (Kullback et al., 1951) between the distributions, with $D_{KL}(P_{SISP}||P) > D_{KL}(P_{adv}||P)$ implying that the diversity of SISP transformations is higher. + +# 5.2 Comparison of Model Calibration + +Figure 4 contains qualitative examples from $\mathrm{NLVR}^2$ to compare output probabilities. We observe that SDRO models have higher clean accuracy, but lower confidence in the predictions than baseline and data-aug methods. + +Reliability Diagrams. To validate this observation at scale, we use reliability diagrams to visualize model calibration (Niculescu-Mizil and Caruana, 2005), and plot model accuracy as a function of confidence (Guo et al., 2017). We use the softmax probability $\hat{p}$ of the predicted class as model confidence, split the range of probabilities into $M = 20$ equal-sized bins, and calculate bin accuracy $acc(B_m)$ and bin confidence $conf(B_m)$ . If $B_m$ is the set of all samples that fall in the $m^{th}$ bin, + +$$ +\operatorname {a c c} \left(B _ {m}\right) \triangleq \frac {1}{\left| B _ {m} \right|} \sum_ {X _ {i} \in B _ {m}} \mathbb {1} \left(\hat {y} _ {i} = y _ {i}\right), \tag {10} +$$ + +$$ +\operatorname {c o n f} \left(B _ {m}\right) \triangleq \frac {1}{\left| B _ {m} \right|} \sum_ {X _ {i} \in B _ {m}} \hat {p} _ {i}. \tag {11} +$$ + +A model with perfect calibration should have a reliability diagram such that $acc(B_m) = conf(B_m)$ . We also report Expected Calibration Error (Naeini et al., 2015) over all $n$ test samples: + +$$ +E C E = \sum_ {m = 1} ^ {M} \frac {\left| B _ {m} \right|}{n} \left| \operatorname {a c c} \left(B _ {m}\right) - \operatorname {c o n f} \left(B _ {m}\right) \right|. \tag {12} +$$ + +![](images/a8e80593b08b6985a0ae534377add4b81bc5a05d29863ebe7d3fd5aa6d146bd9.jpg) +An adult gorilla is opening its mouth wide, revealing a mouthful of teeth in one image. + +![](images/39bca1e4894670ab3bb6e394cbd215e7838f5cac5d470b39f385f52938c6d2ba.jpg) +An adult gorilla is opening its mouth wide, uncovering a mouthful of teeth in one image + +![](images/dd5bf91cfa6cd54561bce2fd8175855a774d96f35b1ea516ad9a001abf41b351.jpg) +An adult gorilla is not opening its mouth wide revealing a mouthful of teeth in one image. + +![](images/ed4674aaef4e6645748802918e2f292437176aea0c5598a45e1ca88227a62a37.jpg) +Something is next to a not caged area. + +![](images/7fe83544c84e8a199d56d212e49ecdd8d0fcc7ddfc76346976b9156ec8c5ceff.jpg) +At least one dog is next to a caged area. + +![](images/d97f1fb32c4c9fbe3e0b2c2c1df4d70f013301536621f833a356ce66317bffd4.jpg) +At least one dog is next to a cage. + +![](images/a3e71ffb2a5a59b84c236f5489fd29236a868272a652aa0f3d5f7c95731652cf.jpg) +Figure 4: Qualitative examples showing test inputs from the $\mathrm{NLVR}^2$ test set (left) with their respective SP (green) and SI (yellow) test samples. The predicted class (True/False) and the confidence of the predicted class is shown for baseline, data augmentation using SISP transforms, SW-SDRO and GW-SDRO. All models are built on the VILLA backbone. Wrong predictions are highlighted in red. + +![](images/449e75cec6682d4f276a3c7e1254c31815367fc1bef602915a291c4d30b2ffb5.jpg) + +![](images/b2ea4e39bc0e4a4cab4899983692886b13cfb6de90119d1636bf0149bb315a3b.jpg) +Figure 5: Comparison of reliability curves on the clean test set (left) and SISP test set (right). + +![](images/2e034f943d17301eb8c4c2d7846af43798dfc4cfeb601ccb4e5c49623a5c089d.jpg) + +Reliability diagrams and corresponding ECE values for the VILLA trained with naive data augmentation and SDRO methods for $\mathrm{NLVR}^2$ are shown in Figure 5. On both the clean test set and SISP test set, SDRO models have the lowest ECE. While the ECE for SDRO is marginally better than data augmentation for the clean test set, SDRO is better calibrated for the SISP test set, with SW-SDRO closest to ideal calibration among all evaluated models. + +# 5.3 Size of Training Dataset + +We evaluate models trained on small subsets of the original dataset, and compare their performance in Figure 6. SDRO models are significantly better at all sizes of training datasets as shown by accuracy and AUC (area under the curve). Notably, SDRO models trained with only $10\%$ ( $\sim 8.6K$ ) samples have performances similar to the baseline trained with $30\%$ samples; SDRO models with $20\%$ data are better than the baseline model with $40\%$ data. While models trained with naive augmentation saturate below SOTA, at $\sim 80\%$ data size, SDRO mod + +![](images/b763dd93eb0c569fd899a935e3183e62da32cb305d323bc1e6e84cc8fd1d999d.jpg) +Figure 6: Effect of size of training data (left) $\mathrm{NLVR}^2$ , (right) VIOLIN. SDRO models are consistently better than baselines, even in low-data settings. + +![](images/03d1147b182caae641e4014750d68229853a9b02b0081f9450c2b14fa77de64c.jpg) + +els cross the existing SOTA of $78.39\%$ . + +# 5.4 Proportion of Augmented Samples. + +The final dataset has the same size as the original training set, but with $\mathrm{T\%}$ transformed samples and $(100 - T)\%$ original samples. The effect of this hyperparameter $T$ is reported in Figure 7 as a percentage improvement of accuracy w.r.t. $\mathrm{VILLA}_{BASE}$ . An optimal value of $T = 20\%$ leads to improvements in clean accuracy, but a larger proportion of augmented samples degrades performance. Similarly, higher $T$ leads to higher robust accuracy, pointing to a trade-off between clean accuracy and robust accuracy at values of $T$ higher than the optimal. This conforms with similar findings from Tsipras et al. (2019). While models trained with naive data-augmentation have better SISP accuracy than SDRO models as in Ta + +
ModelSP onlySI OnlyBoth
CleanSPSICleanSPSICleanSPSI
Data-Aug76.0774.8935.7769.5153.6894.8978.3472.1184.44
SW-SDRO79.7976.9330.7279.2755.5388.7679.2369.2367.35
GW-SDRO79.4675.7233.0479.1354.3193.2579.4168.6784.54
+ +![](images/04c451416586f299c4ced3990bf0c1671e2549809773d64d5d6901221f3112d7.jpg) +Figure 7: Plots showing the effect of the percentage of augmented samples on Clean, SP, and SI accuracies on $\mathrm{NLVR}^2$ , when using data-augmentation, and SDRO. + +Table 6: Comparison of performance when only SP, only SI, or both types of transformations are performed. + +
ModelSISP (Pos)SISP (All)
CleanSPSICleanSPSI
Data-Aug78.2368.0257.4878.3472.1184.44
SW-SDRO78.8162.0666.0779.2369.2367.35
GW-SDRO79.1063.4762.2979.4168.6784.54
+ +ble 3, they do so by sacrificing clean accuracy, while SDRO models improve along both dimensions compared to the baselines. + +# 5.5 Ablation Studies + +Contributions of SI and SP independently: We analyze which of the two categories (semantics-inverting (SI) or semantics-preserving (SP)) is the most effective by performing SDRO with only SI transforms, or with only SP transforms, and when using both. Table 6 shows that SDRO models trained only with SI suffer in terms of SP robustness and vice versa. However, there is still an increase in clean accuracy in both cases. This indicates that both SI and SP contribute towards improvements in robustness and clean accuracy. + +Transformations of only True statements: Transforming False (negative) statements can lead to ambiguous and subjective meanings (Russell, 1905). We investigate if transforming only True (positive) statements is better than transforming + +Table 7: Comparison of performance if only positive samples are used as inputs for SISP transformations + +
ModelCRCSCLEDAEmbWNAvg.
NLVR2VILLA77.574.474.469.675.575.974.5
+ SDRO78.577.272.171.175.876.475.2
VIOLINHERO66.163.068.660.963.863.464.3
+ SDRO68.765.069.061.365.564.665.7
VQAVILLA80.575.784.974.678.676.478.5
Yes/No+ SDRO86.084.584.187.084.384.085.0
+ +Table 8: Performance evaluation on "text-attack" (Morris et al., 2020) versions of NLVR $^2$ , VIOLIN, and VQA-Yes/No test sets. + +both True and False statements. Table 7 shows that SISP transformations of both types of statements lead to higher clean accuracy and robustness. + +# 5.6 Robustness to Text-Attacks + +In this section, we test each model against text-based adversarial attacks – these attack samples are not seen by the models during training. Thus, this experiment seeks to verify if training with SDRO and SISP samples can also make VLI models robust against automated adversarial attack recipes. We utilize six common attack recipes implemented using the Text-Attack tool by Morris et al. (2020); these are – CLARE (CR) (Li et al., 2021a), character-swap (CS) (Pruthi et al., 2019), Checklist (CL) (Ribeiro et al., 2020), Easy Data Augmentation (Wei and Zou, 2019), counter-fitted embeddings (Emb.) (Alzantot et al., 2018), and WordNet-based swap (WN) (Ren et al., 2019). Table 8 shows results on each benchmark, using the best performing backbone for that benchmark and our SDRO model. On NLVR², VILLA+SDRO is better than VILLA for 4 out of 6 attack categories, and $0.7\%$ on average. On VIOLIN, HERO+SDRO outperforms the baseline on all attack categories, leading to an average gain of $1.4\%$ . On VQA-Yes/No, VILLA+SDRO outperforms the baseline on all attack categories, and $6.5\%$ on average. + +# 6 Related Work + +Adversarial Training (AT) has been studied under a game-theoretic (Dalvi et al., 2004) and min-max setup (Madry et al., 2018). Volpi et al. (2018) + +use AT to adversarially augment image classification datasets and show improved domain generalization for digit classification. Wong and Kolter (2020); Gokhale et al. (2021) modify AT for real-world adversaries beyond norm-bounded perturbations. AT has been used for text classification with LSTMs (Miyato et al., 2017) and for pretraining transformer-based models by adding label-preserving adversarial perturbations to embeddings of word tokens (Zhu et al., 2020; Jiang et al., 2020; Gan et al., 2020). Contrastive examples have been explored, collected from humans (Agrawal et al., 2018), negative mining (Shi et al., 2018), or synthetic generation (Agarwal et al., 2020; Chen et al., 2020a; Gokhale et al., 2020a; Teney et al., 2020). + +Robustness in V&L has been explored for VQA, such as performance under prior probability shift (Agrawal et al., 2018) and domain adaptation (Chao et al., 2018; Xu et al., 2020), along with robustness for implied questions (Ribeiro et al., 2019) and novel compositions (Johnson et al., 2017; Agrawal et al., 2017), and robustness to logical connectives (including negation) Gokhale et al. (2020b). Teney et al. (2020) have shown that many V&L, image classification, and sentiment analysis models are sensitive to image editing. There has been a recent effort of model-in-the-loop dataset collection to guide humans to create harder VQA samples (Li et al., 2021b; Sheng et al., 2021). + +Robustness in NLP: Generation of SP adversarial examples (Jia and Liang, 2017; Ribeiro et al., 2018; Iyyer et al., 2018; Alzantot et al., 2018), and approaches to defend against word substitution (Jia et al., 2019) have been explored in natural language processing tasks. Evaluation datasets have also been proposed for textual entailment that are manually crafted (Gardner et al., 2020) or template-based (McCoy et al., 2019; Glockner et al., 2018; Naik et al., 2018). Our method uses automated linguistically-informed SI and SP transforms for both training and inference. + +# 7 Discussion + +On Ensembling Coefficients. While designing our ensembling approach, we used $\alpha = 0.5$ , i.e., equal contribution from the original output and the average of all outputs for transformed samples. This choice is generic and does not rely on dataset- or model-specific characteristics of SISP accuracy. While treating $\alpha$ as a hyperparameter and tuning it on validation datasets could lead to further gains, + +our intuitive choice of $\alpha = 0.5$ is effective by itself. + +On SI Samples. Tables 3, 4, 5 show that existing models perform well on SP transforms, implying that equivalent semantics are captured in transformer-based models. However, these models fail on SI samples resulting in a close-to-random (50%) average SISP accuracy. While images perturbed with noise, blur, weather, or digital artifacts (Hendrycks and Dietterich, 2019) retain semantics (an image of a "cat" remains a cat after perturbation), minimal changes to text inputs, such as a single word changing from "sitting" to "standing" or "not sitting", inflict large changes in meaning. We hope that future work on design of V&L evaluation criterion along the SI axis, could benefit from our findings. While we generated SI and SP text for VLI tasks, the idea could be extended to design SISP transformations for images, by operating at object-level instead of pixel-level + +On combination of AT and SDRO. We show that combining AT with SDRO can improve VLI performance and incorporate domain knowledge into the training process, such as semantic knowledge that often exists in natural language or linguistic rules. This is explicitly observed with VILLA, which is pre-trained and fine-tuned using standard adversarial training (Gan et al., 2020). When fine-tuned with SDRO, VILLA+SDRO further improves compared to UNITER+SDRO. The combination of standard adversarial training, (which accounts for local adversaries inside a $\epsilon$ norm-ball) and SDRO, (which accounts for linguistic adversaries and contrastive examples, typically outside the norm-ball as shown in Figure 2) could lead to improved generalization in many other V&L tasks. + +On differentiability. Linguistic transformations are not differentiable and prohibit gradient-based solutions to the inner maximization in SDRO. However, most V&L tasks would benefit from the incorporation of semantic knowledge into the optimization framework. Through SDRO, we show that explicitly choosing the argmax over a pre-defined set of transformations leads to model-agnostic improvements for binary classification tasks in V&L. More sophisticated methods may emerge in the future to address non-differentiability by leveraging proximal point or trust-region methods (Eckstein, 1993; Conn et al., 2000) or Interval Bound Propagation (Dvijotham et al., 2018), to incorporate semantic knowledge into adversarial training. + +# Acknowledgements + +This work was funded in part by National Science Foundation grants 2132724, 1816039 and 1750082, DARPA SAIL-ON program (W911NF2020006), and DARPA CHESS program (FA875019C0003). The authors are grateful to the volunteers who worked on rating the fidelity of our proposed transformations. The views and opinions of the authors expressed herein do not necessarily state or reflect those of the funding agencies and employers. + +# References + +Vedika Agarwal, Rakshith Shetty, and Mario Fritz. 2020. Towards causal VQA: revealing and reducing spurious correlations by invariant and covariant semantic editing. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition, CVPR 2020, Seattle, WA, USA, June 13-19, 2020, pages 9687-9695. IEEE. +Aishwarya Agrawal, Dhruv Batra, Devi Parikh, and Aniruddha Kembhavi. 2018. Don't just assume; look and answer: Overcoming priors for visual question answering. In 2018 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2018, Salt Lake City, UT, USA, June 18-22, 2018, pages 4971-4980. IEEE Computer Society. +Aishwarya Agrawal, Aniruddha Kembhavi, Dhruv Batra, and Devi Parikh. 2017. C-vqa: A compositional split of the visual question answering (vqa) v1.0 dataset. arXiv preprint arXiv:1704.08243. +Moustafa Alzantot, Yash Sharma, Ahmed Elgohary, Bo-Jhang Ho, Mani Srivastava, and Kai-Wei Chang. 2018. Generating natural language adversarial examples. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 2890–2896, Brussels, Belgium. Association for Computational Linguistics. +Samuel R. Bowman, Gabor Angeli, Christopher Potts, and Christopher D. Manning. 2015. A large annotated corpus for learning natural language inference. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pages 632-642, Lisbon, Portugal. Association for Computational Linguistics. +Lucy Chai, Jun-Yan Zhu, Eli Shechtman, Phillip Isola, and Richard Zhang. 2021. Ensembling with deep generative views. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 14997-15007. +Wei-Lun Chao, Hexiang Hu, and Fei Sha. 2018. Cross-dataset adaptation for visual question answering. In 2018 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2018, Salt Lake City, UT, USA, June 18-22, 2018, pages 5716-5725. IEEE Computer Society. + +Long Chen, Xin Yan, Jun Xiao, Hanwang Zhang, Shiliang Pu, and Yueting Zhuang. 2020a. Counterfactual samples synthesizing for robust visual question answering. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition, CVPR 2020, Seattle, WA, USA, June 13-19, 2020, pages 10797-10806. IEEE. +Yen-Chun Chen, Linjie Li, Licheng Yu, Ahmed El Kholy, Faisal Ahmed, Zhe Gan, Yu Cheng, and Jingjing Liu. 2020b. Uniter: Universal image-text representation learning. In ECCV. +Andrew R Conn, Nicholas IM Gould, and Philippe L Toint. 2000. Trust region methods. SIAM. +Nilesh Dalvi, Pedro Domingos, Sumit Sanghai, and Deepak Verma. 2004. Adversarial classification. In Proceedings of the tenth ACM SIGKDD international conference on Knowledge discovery and data mining, pages 99-108. +Dorottya Demszky, Kelvin Guu, and Percy Liang. 2018. Transforming question answering datasets into natural language inference datasets. arXiv preprint arXiv:1809.02922. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171-4186, Minneapolis, Minnesota. Association for Computational Linguistics. +Krishnamurthy Dvijotham, Robert Stanforth, Sven Gowal, Timothy A. Mann, and Pushmeet Kohli. 2018. A dual approach to scalable verification of deep networks. In Proceedings of the Thirty-Fourth Conference on Uncertainty in Artificial Intelligence, UAI 2018, Monterey, California, USA, August 6-10, 2018, pages 550-559. AUAI Press. +Jonathan Eckstein. 1993. Nonlinear proximal point algorithms using bregman functions, with applications to convex programming. Mathematics of Operations Research, 18(1):202-226. +Kawin Ethayarajh. 2019. How contextual are contextualized word representations? comparing the geometry of BERT, ELMo, and GPT-2 embeddings. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 55–65, Hong Kong, China. Association for Computational Linguistics. +Allyson Ettinger. 2020. What BERT is not: Lessons from a new suite of psycholinguistic diagnostics for language models. Transactions of the Association for Computational Linguistics, 8:34-48. + +Zhe Gan, Yen-Chun Chen, Linjie Li, Chen Zhu, Yu Cheng, and Jingjing Liu. 2020. Large-scale adversarial training for vision-and-language representation learning. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual. +Matt Gardner, Yoav Artzi, Victoria Basmov, Jonathan Berant, Ben Bogin, Sihao Chen, Pradeep Dasigi, Dheeru Dua, Yanai Elazar, Ananth Gottumukkala, Nitish Gupta, Hannaneh Hajishirzi, Gabriel Ilharco, Daniel Khashabi, Kevin Lin, Jiangming Liu, Nelson F. Liu, Phoebe Mulcaire, Qiang Ning, Sameer Singh, Noah A. Smith, Sanjay Subramanian, Reut Tsarfaty, Eric Wallace, Ally Zhang, and Ben Zhou. 2020. Evaluating models' local decision boundaries via contrast sets. In Findings of the Association for Computational Linguistics: EMNLP 2020, pages 1307-1323, Online. Association for Computational Linguistics. +Max Glockner, Vered Shwartz, and Yoav Goldberg. 2018. Breaking NLI systems with sentences that require simple lexical inferences. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 650-655, Melbourne, Australia. Association for Computational Linguistics. +Tejas Gokhale, Rushil Anirudh, Bhavya Kailkhura, Jayaraman J Thiagarajan, Chitta Baral, and Yezhou Yang. 2021. Attribute-guided adversarial training for robustness to natural perturbations. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pages 7574-7582. +Tejas Gokhale, Pratyay Banerjee, Chitta Baral, and Yezhou Yang. 2020a. MUTANT: A training paradigm for out-of-distribution generalization in visual question answering. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 878-892, Online. Association for Computational Linguistics. +Tejas Gokhale, Pratyay Banerjee, Chitta Baral, and Yezhou Yang. 2020b. Vqa-lol: Visual question answering under the lens of logic. In European conference on computer vision. Springer. +Yash Goyal, Tejas Khot, Douglas Summers-Stay, Dhruv Batra, and Devi Parikh. 2017. Making the V in VQA matter: Elevating the role of image understanding in visual question answering. In 2017 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2017, Honolulu, HI, USA, July 21-26, 2017, pages 6325-6334. IEEE Computer Society. +Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q. Weinberger. 2017. On calibration of modern neural networks. In Proceedings of the 34th International Conference on Machine Learning, ICML 2017, Sydney, NSW, Australia, 6-11 August 2017, volume 70 of Proceedings of Machine Learning Research, pages 1321-1330. PMLR. + +Dan Hendrycks and Thomas G. Dietterich. 2019. Benchmarking neural network robustness to common corruptions and perturbations. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net. +Matthew Honnibal, Ines Montani, Sofie Van Landeghem, and Adriane Boyd. spaCy: Industrialstrength Natural Language Processing in Python. +Weihua Hu, Gang Niu, Issei Sato, and Masashi Sugiyama. 2018a. Does distributionally robust supervised learning give robust classifiers? In Proceedings of the 35th International Conference on Machine Learning, ICML 2018, Stockholm, Sweden, July 10-15, 2018, volume 80 of Proceedings of Machine Learning Research, pages 2034-2042. PMLR. +Weihua Hu, Gang Niu, Issei Sato, and Masashi Sugiyama. 2018b. Does distributionally robust supervised learning give robust classifiers? In Proceedings of the 35th International Conference on Machine Learning, ICML 2018, Stockholm, Sweden, July 10-15, 2018, volume 80 of Proceedings of Machine Learning Research, pages 2034-2042. PMLR. +Mohit Iyyer, John Wieting, Kevin Gimpel, and Luke Zettlemoyer. 2018. Adversarial example generation with syntactically controlled paraphrase networks. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 1875-1885, New Orleans, Louisiana. Association for Computational Linguistics. +Brad Jascob. v0.2.1 (February 22, 2020). Lemminflect. a python module for english word lemmatization and inflection. https://github.com/bjascob/LemmiNflect. +Robin Jia and Percy Liang. 2017. Adversarial examples for evaluating reading comprehension systems. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 2021-2031, Copenhagen, Denmark. Association for Computational Linguistics. +Robin Jia, Aditi Raghunathan, Kerem Goksel, and Percy Liang. 2019. Certified robustness to adversarial word substitutions. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 4129-4142, Hong Kong, China. Association for Computational Linguistics. +Haoming Jiang, Pengcheng He, Weizhu Chen, Xiaodong Liu, Jianfeng Gao, and Tuo Zhao. 2020. SMART: Robust and efficient fine-tuning for pretrained natural language models through principled regularized optimization. In Proceedings of the 58th + +Annual Meeting of the Association for Computational Linguistics, pages 2177-2190, Online. Association for Computational Linguistics. +Justin Johnson, Bharath Hariharan, Laurens van der Maaten, Li Fei-Fei, C. Lawrence Zitnick, and Ross B. Girshick. 2017. CLEVR: A diagnostic dataset for compositional language and elementary visual reasoning. In 2017 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2017, Honolulu, HI, USA, July 21-26, 2017, pages 1988-1997. IEEE Computer Society. +Nora Kassner and Hinrich Schütze. 2020. Negated and misprimed probes for pretrained language models: Birds can talk, but cannot fly. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 7811-7818, Online. Association for Computational Linguistics. +Tushar Khot, Ashish Sabharwal, and Peter Clark. 2018. Scitail: A textual entailment dataset from science question answering. In Proceedings of the Thirty-Second AAAI Conference on Artificial Intelligence, (AAAI-18), the 30th innovative Applications of Artificial Intelligence (IAAI-18), and the 8th AAAI Symposium on Educational Advances in Artificial Intelligence (EAAI-18), New Orleans, Louisiana, USA, February 2-7, 2018, pages 5189-5197. AAAI Press. +S Kullback, RA Leibler, et al. 1951. On information and sufficiency. Annals of Mathematical Statistics, 22(1):79-86. +Dianqi Li, Yizhe Zhang, Hao Peng, Liquin Chen, Chris Brockett, Ming-Ting Sun, and William B Dolan. 2021a. Contextualized perturbation for textual adversarial attack. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 5053-5069. +Linjie Li, Yen-Chun Chen, Yu Cheng, Zhe Gan, Licheng Yu, and Jingjing Liu. 2020. HERO: Hierarchical encoder for Video+Language omni-representation pre-training. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 2046-2065, Online. Association for Computational Linguistics. +Linjie Li, Jie Lei, Zhe Gan, and Jingjing Liu. 2021b. Adversarial vqa: A new benchmark for evaluating the robustness of vqa models. In International Conference on Computer Vision (ICCV). +Jingzhou Liu, Wenhu Chen, Yu Cheng, Zhe Gan, Licheng Yu, Yiming Yang, and Jingjing Liu. 2020. Violin: A large-scale dataset for video-and-language inference. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition, CVPR 2020, Seattle, WA, USA, June 13-19, 2020, pages 10897-10907. IEEE. +Jiasen Lu, Dhruv Batra, Devi Parikh, and Stefan Lee. 2019. Vilbert: Pretraining task-agnostic visi-olinguistic representations for vision-and-language + +tasks. In Advances in Neural Information Processing Systems 32: Annual Conference on Neural Information Processing Systems 2019, NeurIPS 2019, December 8-14, 2019, Vancouver, BC, Canada, pages 13-23. +Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. 2018. Towards deep learning models resistant to adversarial attacks. In 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings. OpenReview.net. +Tom McCoy, Ellie Pavlick, and Tal Linzen. 2019. Right for the wrong reasons: Diagnosing syntactic heuristics in natural language inference. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 3428-3448, Florence, Italy. Association for Computational Linguistics. +Takeru Miyato, Andrew M. Dai, and Ian J. Goodfellow. 2017. Adversarial training methods for semi-supervised text classification. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings. OpenReview.net. +John Morris, Eli Lifland, Jin Yong Yoo, Jake Grigsby, Di Jin, and Yanjun Qi. 2020. TextAttack: A framework for adversarial attacks, data augmentation, and adversarial training in NLP. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 119-126, Online. Association for Computational Linguistics. +Mahdi Pakdaman Naeini, Gregory F. Cooper, and Milos Hauskrecht. 2015. Obtaining well calibrated probabilities using bayesian binning. In Proceedings of the Twenty-Ninth AAAI Conference on Artificial Intelligence, January 25-30, 2015, Austin, Texas, USA, pages 2901-2907. AAAI Press. +Aakanksha Naik, Abhilasha Ravichander, Norman Sadeh, Carolyn Rose, and Graham Neubig. 2018. Stress test evaluation for natural language inference. In Proceedings of the 27th International Conference on Computational Linguistics, pages 2340-2353, Santa Fe, New Mexico, USA. Association for Computational Linguistics. +Alexandru Niculescu-Mizil and Rich Caruana. 2005. Predicting good probabilities with supervised learning. In Machine Learning, Proceedings of the Twenty-Second International Conference (ICML 2005), Bonn, Germany, August 7-11, 2005, volume 119 of ACM International Conference Proceeding Series, pages 625-632. ACM. +Myle Ott, Sergey Edunov, Alexei Baevski, Angela Fan, Sam Gross, Nathan Ng, David Grangier, and Michael Auli. 2019. fairseq: A fast, extensible toolkit for sequence modeling. In Proceedings of + +the 2019 Conference of the North American Chapter of the Association for Computational Linguistics (Demonstrations), pages 48-53, Minneapolis, Minnesota. Association for Computational Linguistics. +Jeffrey Pennington, Richard Socher, and Christopher Manning. 2014. GloVe: Global vectors for word representation. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 1532-1543, Doha, Qatar. Association for Computational Linguistics. +Danish Pruthi, Bhuwan Dhingra, and Zachary C. Lipton. 2019. Combating adversarial misspellings with robust word recognition. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 5582-5591, Florence, Italy. Association for Computational Linguistics. +Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. 2020. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research, 21:1-67. +Shaoqing Ren, Kaiming He, Ross B. Girshick, and Jian Sun. 2015. Faster R-CNN: towards real-time object detection with region proposal networks. In Advances in Neural Information Processing Systems 28: Annual Conference on Neural Information Processing Systems 2015, December 7-12, 2015, Montreal, Quebec, Canada, pages 91-99. +Shuhuai Ren, Yihe Deng, Kun He, and Wanxiang Che. 2019. Generating natural language adversarial examples through probability weighted word saliency. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 1085-1097, Florence, Italy. Association for Computational Linguistics. +Marco Tulio Ribeiro, Carlos Guestrin, and Sameer Singh. 2019. Are red roses red? evaluating consistency of question-answering models. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 6174-6184, Florence, Italy. Association for Computational Linguistics. +Marco Tulio Ribeiro, Sameer Singh, and Carlos Guestrin. 2018. Semantically equivalent adversarial rules for debugging NLP models. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 856-865, Melbourne, Australia. Association for Computational Linguistics. +Marco Tulio Ribeiro, Tongshuang Wu, Carlos Guestrin, and Sameer Singh. 2020. Beyond accuracy: Behavioral testing of NLP models with CheckList. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 4902-4912, Online. Association for Computational Linguistics. + +Bertrand Russell. 1905. On denoting. Mind, 14(56):479-493. +Shiori Sagawa, Pang Wei Koh, Tatsunori B Hashimoto, and Percy Liang. 2020. Distributionally robust neural networks for group shifts: On the importance of regularization for worst-case generalization. In International Conference on Learning Representations. +Sasha Sheng, Amanpreet Singh, Vedanuj Goswami, Jose Alberto Lopez Magana, Wojciech Galuba, Devi Parikh, and Douwe Kiela. 2021. Human-adversarial visual question answering. arXiv preprint arXiv:2106.02280. +Haoyue Shi, Jiayuan Mao, Tete Xiao, Yuning Jiang, and Jian Sun. 2018. Learning visually-grounded semantics from contrastive adversarial samples. In Proceedings of the 27th International Conference on Computational Linguistics, pages 3715-3727, Santa Fe, New Mexico, USA. Association for Computational Linguistics. +Aman Sinha, Hongseok Namkoong, and John C. Duchi. 2018. Certifying some distributional robustness with principled adversarial training. In 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings. OpenReview.net. +Alane Suhr, Stephanie Zhou, Ally Zhang, Iris Zhang, Huajun Bai, and Yoav Artzi. 2019. A corpus for reasoning about natural language grounded in photographs. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 6418-6428, Florence, Italy. Association for Computational Linguistics. +Chen Sun, Austin Myers, Carl Vondrick, Kevin Murphy, and Cordelia Schmid. 2019. Videobert: A joint model for video and language representation learning. In 2019 IEEE/CVF International Conference on Computer Vision, ICCV 2019, Seoul, Korea (South), October 27 - November 2, 2019, pages 7463-7472. IEEE. +Hao Tan and Mohit Bansal. 2019. LXMERT: Learning cross-modality encoder representations from transformers. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 5100-5111, Hong Kong, China. Association for Computational Linguistics. +Damien Teney, Ehsan Abbasnedjad, and Anton van den Hengel. 2020. Learning what makes a difference from counterfactual examples and gradient supervision. In European conference on computer vision. Springer. +Dimitris Tsipras, Shibani Santurkar, Logan Engstrom, Alexander Turner, and Aleksander Madry. 2019. Robustness may be at odds with accuracy. In 7th International Conference on Learning Representations, + +ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net. + +Laurens Van der Maaten and Geoffrey Hinton. 2008. Visualizing data using t-sne. Journal of machine learning research, 9(11). + +V Vapnik. 1991. Principles of risk minimization for learning theory. In Proceedings of the 4th International Conference on Neural Information Processing Systems, pages 831-838. + +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, December 4-9, 2017, Long Beach, CA, USA, pages 5998-6008. + +Riccardo Volpi, Hongseok Namkoong, Ozan Sener, John C. Duchi, Vittorio Murino, and Silvio Savarese. 2018. Generalizing to unseen domains via adversarial data augmentation. In Advances in Neural Information Processing Systems 31: Annual Conference on Neural Information Processing Systems 2018, NeurIPS 2018, December 3-8, 2018, Montreal, Canada, pages 5339-5349. + +Jason Wei and Kai Zou. 2019. EDA: Easy data augmentation techniques for boosting performance on text classification tasks. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 6382-6388, Hong Kong, China. Association for Computational Linguistics. + +Adina Williams, Nikita Nangia, and Samuel Bowman. 2018. A broad-coverage challenge corpus for sentence understanding through inference. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 1112-1122, New Orleans, Louisiana. Association for Computational Linguistics. + +Eric Wong and J Zico Kolter. 2020. Learning perturbation sets for robust machine learning. In International Conference on Learning Representations. + +PC Wren and H Martin. 2000. English grammar and composition. New Delhi: S Chand & Company Ltd. + +Yiming Xu, Lin Chen, Zhongwei Cheng, Lixin Duan, and Jiebo Luo. 2020. Open-ended visual question answering by multi-modal domain adaptation. In *Findings of the Association for Computational Linguistics: EMNLP* 2020, pages 367-376, Online. Association for Computational Linguistics. + +Chen Zhu, Yu Cheng, Zhe Gan, Siqi Sun, Tom Goldstein, and Jingjing Liu. 2020. Freelb: Enhanced adversarial training for natural language understanding. + +
CategoryLXMERTUNITERVILLA
Original74.3777.8578.39
SIComparative Antonym49.1940.1134.32
Negation35.1936.9235.39
Noun Antonym29.9435.3539.05
Number Substitution45.2639.5335.24
Pronoun Substitution47.7634.7929.78
Subject-Object Swap20.2627.6530.41
Verb Antonym27.8629.7234.89
SPComparative Synonym61.3565.5866.86
Paraphrasing71.3373.6273.46
Noun Synonym71.2475.3275.78
Number Substitution70.6874.3374.37
Pronoun Substitution69.3673.3673.16
Verb Synonym71.2674.1675.24
+ +Table 9: Evaluation of NLVR2 baselines on SISP test samples. + +In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net. + +# Appendix + +In this supplementary material, we provide fine-grained results of our experiments, along with detailed analysis for VIOLIN and VQA-Yes/No similar to Section 5 in the main paper. We also provide visualizations of the SISP data creation process, statistics for SISP-transformed samples, and details of our human evaluation study. + +# A Fine-Grained Results + +# A.1 Baseline Performance on SISP + +In Tables 9, 10, 11 we compare the performance of baseline models on all 13 categories of SISP transforms. All baseline models are below random performance on all three datasets for all SI categories, except for $\mathrm{VIOLIN}_{BASE}$ (Liu et al., 2020). This is an interesting finding since $\mathrm{VIOLIN}_{BASE}$ is the only model that is not a pretrained transformer-based model, but uses simple fusion of visual and textual modalities. In this paper, we've considered 3 benchmarks, and $3 + 2 + 3 = 8$ backbone models in total. Of these, only $\mathrm{VIOLIN}_{BASE}^{-}$ a non-transformer model, retains above-random performance on SISP samples. Performance on SP categories is the best for VILLA (Gan et al., 2020) for $\mathrm{NLVR}^2$ and VQA Yes/No, and HERO (Li et al., 2020) for VIOLIN. + +# A.2 SDRO Performance on SISP + +In Tables 12, 13, 14 we compare performance for the state-of-the-art model VILLA, as well as mod + +
CategoryVIOLINBASEHEROBASE
Original68.0768.55
SIComparative Antonym58.3331.66
Negation57.7534.73
Noun Antonym57.2137.06
Number Substitution54.2126.07
Pronoun Substitution57.6624.64
Subject-Object Swap57.5931.13
Verb Antonym57.6838.77
SPComparative Synonym57.9267.87
Paraphrasing57.3265.81
Noun Synonym57.6767.15
Number Substitution54.8758.88
Pronoun Substitution57.6866.74
Verb Synonym57.5367.09
+ +Table 10: Evaluation of VIOLIN baselines on SISP test samples. + +
CategoryLXMERTUNITERVILLA
SIOriginal83.1383.65584.82
Comparative Antonym36.739.0739.59
Negation29.5931.9329.59
Noun Antonym48.3653.2150.88
Number Substitution26.3242.1149.47
Pronoun Substitution21.2824.0524.36
Subject-Object Swap24.6831.3326.06
Verb Antonym35.8850.6341.86
SPComparative Synonym67.7271.2874.11
Paraphrasing79.6379.3780.74
Noun Synonym74.0973.3774.61
Number Substitution72.3257.8962.11
Pronoun Substitution74.8276.1177.48
Verb Synonym73.7674.2275.82
+ +els trained with naive data augmentation and our SDRO methods. + +# B Analysis for VIOLIN + +Proportion of Augmented Samples. We perform an analysis by varying $T$ (proportion of augmented samples) and report performance in Figure 8 as a percentage improvement of accuracy w.r.t. $\text{HERO}_{\text{BASE}}$ . It can be seen that there exists an optimal value of $T$ (40%), which leads to improvements in clean accuracy, but higher values of $T$ , i.e., a larger proportion of augmented samples degrades performance. Similarly, higher $T$ leads to higher robust accuracy, but lower clean accuracy. Models trained with naive data-augmentation may be more robust on SP and SI test samples than SDRO models, but they do so by sacrificing clean accuracy, while SDRO models improve along both + +Table 11: Evaluation of VQA Yes/No baselines on SISP test samples. + +
CategoryBASEData-AugSW-SDROGW-SDRO
SIOriginal78.3978.3479.2379.41
Noun Antonym39.0585.7963.1376.64
Negation35.3965.7572.7857.29
Subject-Object Swap30.4187.1360.1989.06
Verb Antonym34.8972.5855.1884.19
Number Substitution35.2495.7975.7993.07
Pronoun Substitution29.7898.4481.3198.35
Comparative Antonym34.3278.6263.1193.17
SPPronoun Substitution73.1672.8164.9169.68
Number Substitution74.3781.2777.6378.42
Comparative Synonym66.8864.6364.1666.32
Verb Synonym75.2469.8865.7859.83
Paraphrasing73.4674.8975.7476.13
Noun Synonym75.7869.1567.6761.64
+ +Table 12: Evaluation of SDRO models (with VILLA bacbone) on NLVR² SISP test samples. + +
CategoryBASEData-AugSW-SDROGW-SDRO
SIOriginal68.5565.2168.8368.19
Noun Antonym37.0686.3876.6195.19
Negation34.7353.1858.3161.14
Subject-Object Swap31.1394.2874.9895.08
Verb Antonym38.7781.9677.0594.95
Number Substitution26.0776.3280.0371.04
Pronoun Substitution24.6499.4192.8998.03
Comparative Antonym31.6681.1284.4465.04
SPPronoun Substitution66.7462.2960.7669.67
Number Substitution58.8856.6257.1451.22
Comparative Synonym67.8758.3157.6449.67
Verb Synonym67.0956.4256.4950.15
Paraphrasing65.8163.5965.2266.03
Noun Synonym67.1557.9956.6750.47
+ +Table 13: Evaluation of SDRO models (with HERO backbone) on VIOLIN SISP Data + +dimensions compared to the baselines. + +Contributions of SI and SP independently Table 15 shows that SDRO models trained only with SI suffer in terms of SP robustness and vice versa. However, there is still an increase in clean accuracy in both cases, thus indicating the efficacy of both SP and SI transformations. + +Transformations of only True statements Table 17 shows that training with transformations of both True and False helps both robustness and accuracy. + +# C Analysis for VQA-Yes/No + +Proportion of Augmented Samples. We perform an analysis by varying $T$ (proportion of augmented samples) and report performance in Figure 9 as a percentage improvement of accuracy w.r.t. $\mathrm{VILLA}_{\mathrm{BASE}}$ . Higher $T$ leads to higher robust accuracy, but lower clean accuracy. + +Contributions of SI and SP independently Table 16 shows that SDRO models trained only with + +
CategoryBASEDataaugSW-SDROGW-SDRO
SIOriginal84.8283.5484.8885.19
Noun Antonym50.8897.8592.0492.06
Negation29.5980.8182.3681.39
Subject-Object Swap26.0698.8396.1998.98
Verb Antonym41.8697.7188.1798.6
Number Substitution49.4794.7478.9592.63
Pronoun Substitution24.3695.3690.8694.24
Comparative Antonym39.5996.5889.6496.05
SPPronoun Substitution77.4877.4175.8876.98
Number Substitution62.1177.8956.8481.05
Comparative Synonym74.1180.7278.6380.25
Verb Synonym75.8276.8576.1375.51
Paraphrasing80.7480.5781.3181.49
Noun Synonym74.6176.5575.2772.23
+ +Table 14: Evaluation of SDRO models (with VILLA backbone) on VQA Yes/No SISP Data + +![](images/7197c2ff11d072aa131987e1c09ad4accadbe4d2bf330d4aa6f28b695269cfdc.jpg) +Figure 8: Plots showing the effect of the percentage of augmented samples on Clean, SP, and SI accuracies on VIOLIN, when using naive data-augmentation, SW-SDRO, and GW-SDRO. + +SI suffer in terms of SP robustness and vice versa. However, there is still an increase in clean accuracy in both cases, thus indicating the efficacy of both SP and SI transformations. The increase in clean accuracy is greater for models trained with both SP and SI transformations. + +Transformations of only True statements Table 18 shows that training with transformations of both True and False helps both robustness and accuracy. + +# D SISP Dataset + +# D.1 Statistics + +In Tables 19, 20, 21, we show the number of SISP-transformed samples generated for the test sets of $\mathrm{NLVR}^2$ , VIOLIN and VQA Yes/No respectively. While we generate samples exhaustively for each category of transformation, during training these are sampled according to the proportion of augmented samples $T$ , using three sampling strategies – naive data augmentation, SW-SDRO or GW-SDRO. On average, we obtain 5.69 SI samples and 5.65 SP + +![](images/9c8e14b66d172e3085d07980a1b525dc923eb645557c7f1bfb983160a813c06d.jpg) +Figure 9: Plots showing the effect of the percentage of augmented samples on Clean, SP, and SI accuracies on VQA Yes/No, when using naive data-augmentation, SW-SDRO, and GW-SDRO. + +samples per original sample for the NLVR $^2$ dataset, 11.14 SI samples and 10.83 SP samples for VIOLIN, and 2.75 SI samples and 3.5 SP sample for the VQA-Yes/No subset. + +# D.2 Data Generation + +Figures 10 and 11 show flowcharts for our SISP transformation process for Semantics Preserving (SP) and Semantics Inverting (SI) respectively. For each image-sentence pair, the sentence is parsed using Spacy (Honnibal et al.) into tokens, dependencies, POS-tags, and noun chunks. Using this, each SISP function (for instance "Noun Synonym") generates insertions, deletions, substitutions, or paraphrasing as shown. + +# D.3 Transformation Fidelity + +For each of the 13 SISP categories, we sampled 100 SISP-transformed examples from $\mathrm{NLVR}^2$ , thus giving us a total of 1300 samples. We employed 10 human subjects to evaluate the quality of SISP-transformed sentences. These human subjects were all proficient in English and at the time of the study were enrolled in graduate programs in an English-speaking country. The subjects were shown samples with the original images, sentences, and labels, as well as the new sentence and new label as shown in Figure 12. These subjects evaluated each sample with a binary (0/1) score, according to 4 metrics described below, along with an average "Transformation Fidelity": + +1. Label Correctness (LC) - Is the new label correct for the new sentence? +2. Grammatical Correctness (GC) - Does the sentence appear to be grammatically correct? +3. Visual Grounding (VG) - Does the sentence + +
ModelSP onlySI OnlyBoth
CleanSPSICleanSPSICleanSPSI
Data-Aug63.3360.3931.7166.1150.2887.2965.2159.2081.81
SW-SDRO67.1865.4931.4967.1150.6485.1668.8358.9777.83
GW-SDRO67.7365.9330.8067.4351.2187.7268.1956.2082.92
+ +Table 15: Comparison of performance on the VIOLIN dataset when only SP, only SI, or both types of transformations are performed. + +
ModelSP onlySI OnlyBoth
CleanSPSICleanSPSICleanSPSI
Data-Aug8278.7331.9184.254.8895.583.5478.3394.55
SW-SDRO84.0179.4633.2884.2352.5994.2884.8874.0288.32
GW-SDRO85.0379.3132.5785.0153.4695.6185.1977.9293.42
+ +Table 16: Comparison of performance on the VQA Yes/No dataset when only SP, only SI, or both transformations are performed. + +
ModelSISP(Pos)SISP(All)
CleanSPSICleanSPSI
Data-Aug66.2249.1682.6665.2159.2081.81
SW-SDRO67.9956.0879.0668.8358.9777.83
GW-SDRO67.3455.1982.9068.1956.2082.92
+ +Table 17: Comparison of performance on VIOLIN dataset if only positive samples, i.e. samples with True labels are used as inputs for SISP transformations. + +
ModelSISP(Pos)SISP(All)
CleanSPSICleanSPSI
Data-Aug84.264.4860.3683.5478.3394.55
SW-SDRO84.7361.1361.6484.8874.0288.32
GW-SDRO84.9962.6562.4485.1977.9293.42
+ +Table 18: Comparison of performance on VQA-Yes/No dataset if only positive samples, i.e. samples with True labels are used as inputs for SISP transformations, vs. transformations over both positive and negative samples. + +refer to at-least one visual entity from the image? + +4. Semantic Correctness (SC) - Is the sentence semantically sound and not absurd? + +The subjects were asked to view each sample and rate the new sentence and label on a binary scale for each of the four metrics. A snapshot of the interface used for the study as viewed by the human subjects is shown in Figure 12. Results are shown in Table 22 - split by the category of SISP transformation and in Table 23 - split by the ground-truth label of the original sample. Overall, + +
CategoryTrainingTest-PValidation
Original86,3736,9676,982
SIComparative Antonym14,1771,2441,172
Negation150,61012,83812,635
Noun Antonym148,95912,71912,635
Number Substitution83,0807,4687,113
Pronoun Substitution34,1453,2102,997
Subject-Object Swap30,5332,9442,787
Verb Antonym24,7112,2582,258
Total SI4862154268141714
SPComparative Synonym13,3021,0661,163
Paraphrasing86,3736,9676,982
Noun Synonym212,90418,57018,968
Number Substitution60,5825,1944,994
Pronoun Substitution32,5082,8692,852
Verb Synonym78,1037,3146,919
Total SP4837724198041878
+ +Table 19: Number of SISP-transformed samples generated per category for the NLVR2 dataset. + +our SISP transformed test set for $\mathrm{NLVR}^2$ was rated at an average fidelity of $75.10\%$ . It can be observed that on average, SP samples were rated to have higher average fidelity than SI samples, and False samples higher than True samples. + +We also split the ratings (2 SISP categories and 2 labels: $2 \times 2$ ) and show results in Table 24. Overall, $SP(\text{False})$ has the highest average fidelity, and $SI(\text{False})$ has the lowest. LC (label correctness) for SI transformations of False statements is only $50\%$ , probably because the inversion of a False statement using template-based methods may not always result in a True statement. On the other hand an SP transformation of a False statement remains False and got $100\%$ LC. It is surprising + +
CategoryTrainingTestingValidation
Original7612296009600
SIComparative Antonym66,3008,7548,893
Negation249,83631,63431,923
Noun Antonym193,96424,48424,251
Number Substitution9,5921,2121,130
Pronoun Substitution156,46619,78520,100
Subject-Object Swap122,51015,50015,337
Verb Antonym49,8026,3586,356
Total SI848470107727107990
SPComparative Synonym38,3124,9554,940
Paraphrasing76,1229,6009600
Noun Synonym418,28552,85752002
Number Substitution4,482574544
Pronoun Substitution91,12511,46411539
Verb Synonym196,82625,04425576
Total SP825152104494104201
+ +Table 20: Number of SISP-transformed samples generated per category for the VIOLIN dataset. + +
CategoryTrainTrainvalDevval
Original92,76138,3745,323
SIComparative Antonym18,8398,0441,139
Negation100,30241,6765,738
Noun Antonym82,88534,5434,835
Number Substitution1,50573095
Pronoun Substitution26,80411,4621,597
Subject-Object Swap11,7934,999683
Verb Antonym13,2625,707786
Total SI25539010716114873
SPComparative Synonym21,2599,0371,271
Paraphrasing92,76138,3745,323
Noun Synonym119,30149,9776,850
Number Substitution1,44367895
Pronoun Substitution44,43519,0252,620
Verb Synonym45,61219,3842,622
Total SP32481113647518781
+ +to observe that LC for SP transformations of True statements is low. $SP(\text{True})$ received the highest GC and VG ratings, but low SC and LC ratings. VG ratings for all categories were consistently high. + +Table 21: Number of SISP-transformed samples generated per category for the VQA Yes-No dataset. + +
CategoryFidelity Metrics
LCGCVGSCAvg.
SP73.3380.0096.6770.0080.00
SI71.1567.3196.1557.6973.08
All71.9571.9596.3462.2075.10
+ +Table 22: Human validation of our SISP transforms split according to the category of transformation. + +
GT LabelFidelity Metrics
LCGCVGSCAvg.
True70.6972.4198.2856.9074.59
False75.0070.8391.6775.0078.13
All71.9571.9596.3462.2075.10
+ +Table 23: Human validation of our SISP transforms split according to the GT label of the original sample. + +
GT LabelFidelity Metrics
LCGCVGSCAvg.
SP(True)55.5583.33100.066.6776.39
SI(True)77.5067.5097.5052.5073.75
SP(False)100.075.0091.6775.0085.42
SI(False)50.0066.6791.6775.0070.83
All71.9571.9596.3462.2075.10
+ +Table 24: Human validation of our SISP transforms split according to the GT label of the original sample. + +![](images/df834cb0c2657f890dc2cabbf72b5dae9051cbcac4ba0d15ac8f689cae1dec07.jpg) +A paved road passes near the house in the image on the right + +Spacy Parser + +![](images/2558c675e95e20fef11f6be6a1ae4cb5e8e2cd4ac23ade2cb6afb380538ec97b.jpg) +Figure 10: Illustration of the work-flow for generating SISP-transformed versions of input sentences. A Semantics-Preserving (SP) transformation is shown above. + +Tokens + +'a', 'paved', 'road', 'passes', 'near', 'the', 'house', 'in', 'the', 'image', 'on', 'the', 'right' + +Dependencies + +'det', 'amod', 'nsubj', 'ROOT', 'prep', 'det', 'pobj', 'prep', 'det', 'pobj', 'prep', 'det', 'pobj' + +Tags + +'DT', 'JJ', 'NN', 'VBZ', 'IN', 'DT', 'NN', 'IN', 'DT', 'NN', 'IN', 'DT', 'NN' + +Part Of Speech + +'DET', 'ADJ', 'NOUN', 'VERB', 'SCONJ', 'DET', 'NOUN', 'ADP', 'DET', 'NOUN', 'ADP', 'DET', 'NOUN' + +NounChunks + +a paved road, the house, the image, the right + +NOUN SYNONYM + +Generated Synonyms + +Road + +$\longrightarrow$ Route, Path + +House + +Housing, Dwelling + +Image + +Picture + +a paved route passes near the house in the image on the right + +a paved path passes near the house in the image on the right + +a paved road passes near the dwelling in the image on the right + +a paved road passes near the housing in the image on the right + +a paved road passes near the house in the picture on the right + +Generated Noun Synonym Transformations + +![](images/aca989d7c044a1d8ddb888263ca950b34ead7d12cc72d315fcd639665857d3eb.jpg) +Figure 11: Illustration of the work-flow for generating SISP-transformed versions of input sentences. A Semantics-Inverting (SI) transformation is shown above. + +![](images/24e7f7ed6ade5880bbe95c76ff9860e22af2efd650238e94e07331f702e756dc.jpg) +Figure 12: Snapshot of a SISP example being evaluated by human subjects. Columns from left to right: sample-ID, SISP-tag, Left Image, Right Image, Original Sentence, Original Label, New Sentence, New Label. \ No newline at end of file diff --git a/semanticallydistributedrobustoptimizationforvisionandlanguageinference/images.zip b/semanticallydistributedrobustoptimizationforvisionandlanguageinference/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..cc81d89734085324240d361e9d9320bfd832e494 --- /dev/null +++ b/semanticallydistributedrobustoptimizationforvisionandlanguageinference/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:51061f12661bec0231089a69893a501f5b5646669f9432c01df9adb2a1505c62 +size 1736275 diff --git a/semanticallydistributedrobustoptimizationforvisionandlanguageinference/layout.json b/semanticallydistributedrobustoptimizationforvisionandlanguageinference/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..f13c76ee16d1b30376a52d562701d70b0faedbbc --- /dev/null +++ b/semanticallydistributedrobustoptimizationforvisionandlanguageinference/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e0e0116abbe16263773a819746300a840ca34663feaff299c3e8dea240958526 +size 722054 diff --git a/sememepredictionforbabelnetsynsetsusingmultilingualandmultimodalinformation/0919e426-f565-45f8-bb41-2af1691c6d3b_content_list.json b/sememepredictionforbabelnetsynsetsusingmultilingualandmultimodalinformation/0919e426-f565-45f8-bb41-2af1691c6d3b_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..b61b2ac712a4504f71903c050f6311315484a6a1 --- /dev/null +++ b/sememepredictionforbabelnetsynsetsusingmultilingualandmultimodalinformation/0919e426-f565-45f8-bb41-2af1691c6d3b_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:03cd4c96462b5dab94af58efd6f613c4d0d9a9c09195d9501225218abc4a58bb +size 79247 diff --git a/sememepredictionforbabelnetsynsetsusingmultilingualandmultimodalinformation/0919e426-f565-45f8-bb41-2af1691c6d3b_model.json b/sememepredictionforbabelnetsynsetsusingmultilingualandmultimodalinformation/0919e426-f565-45f8-bb41-2af1691c6d3b_model.json new file mode 100644 index 0000000000000000000000000000000000000000..4f37e19b9b1ada57f7c1de8cb8c3eebdc9fb6cf9 --- /dev/null +++ b/sememepredictionforbabelnetsynsetsusingmultilingualandmultimodalinformation/0919e426-f565-45f8-bb41-2af1691c6d3b_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3017f094833e46477b2614ec90d628b6fb0da3fe84eb7fb98dda247e2e1c64e1 +size 97204 diff --git a/sememepredictionforbabelnetsynsetsusingmultilingualandmultimodalinformation/0919e426-f565-45f8-bb41-2af1691c6d3b_origin.pdf b/sememepredictionforbabelnetsynsetsusingmultilingualandmultimodalinformation/0919e426-f565-45f8-bb41-2af1691c6d3b_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b1a9774789bdb7fef41e387e4432093ebcc3055d --- /dev/null +++ b/sememepredictionforbabelnetsynsetsusingmultilingualandmultimodalinformation/0919e426-f565-45f8-bb41-2af1691c6d3b_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1955f9614e202fcc2be18456d4499df0de85f7f7f378ba050e7f580dcb5b5930 +size 1089542 diff --git a/sememepredictionforbabelnetsynsetsusingmultilingualandmultimodalinformation/full.md b/sememepredictionforbabelnetsynsetsusingmultilingualandmultimodalinformation/full.md new file mode 100644 index 0000000000000000000000000000000000000000..dda5184693da65b920446ecb93bcc57cef13b753 --- /dev/null +++ b/sememepredictionforbabelnetsynsetsusingmultilingualandmultimodalinformation/full.md @@ -0,0 +1,358 @@ +# Sememe Prediction for BabelNet Synsets using Multilingual and Multimodal Information + +Fanchao Qi $^{1*}$ , Chuancheng Lv $^{2,5*}$ , Zhiyuan Liu $^{1,3,4}$ , Xiaojun Meng $^{6}$ , Maosong Sun $^{1,3,4\dagger}$ , Hai-Tao Zheng $^{2,5}$ + +$^{1}$ Dept. of Comp. Sci. & Tech., Institute for AI, Tsinghua University, Beijing, China +Beijing National Research Center for Information Science and Technology + +$^{2}$ Shenzhen International Graduate School, Tsinghua University, China + $^{3}$ Institute Guo Qiang, Tsinghua University, Beijing, China + +$^{4}$ International Innovation Center of Tsinghua University, Shanghai, China + +$^{5}$ Peng Cheng Laboratory $^{6}$ Huawei Noah's Ark Lab + +{qfc17,lvcc21}@mails.tsinghua.edu.cn + +# Abstract + +In linguistics, a sememe is defined as the minimum semantic unit of languages. Sememe knowledge bases (KBs), which are built by manually annotating words with sememes, have been successfully applied to various NLP tasks. However, existing sememe KBs only cover a few languages, which hinders the wide utilization of sememes. To address this issue, the task of sememe prediction for BabelNet synsets (SPBS) is presented, aiming to build a multilingual sememe KB based on BabelNet, a multilingual encyclopedia dictionary. By automatically predicting sememes for a BabelNet synset, the words in many languages in the synset would obtain sememe annotations simultaneously. However, previous SPBS methods have not taken full advantage of the abundant information in BabelNet. In this paper, we utilize the multilingual synonyms, multilingual glosses and images in BabelNet for SPBS. We design a multimodal information fusion model to encode and combine this information for sememe prediction. Experimental results show the substantial outperformance of our model over previous methods (about 10 MAP and F1 scores). All the code and data of this paper can be obtained at https://github.com/thunlp/MSGI. + +# 1 Introduction + +A word is the smallest unit of language that can stand on its own (O'Grady et al., 1997), but its meaning can be further divided into smaller components. In linguistics, a sememe is defined as the minimum semantic unit (Bloomfield, 1926). It is believed by some linguists that the meanings of all the words in any language can be decomposed of a limited set of language-independent sememes, + +![](images/39163867050eaca27745b50a9d0747e6cad3d1218fc08708ad3a6ee87f64f8ee.jpg) +Figure 1: Sememe annotations of the English word "husband" in HowNet. For succinctness, we only show the English notations of sememes, although sememes have both English and Chinese notations in HowNet, e.g., family|家庭. + +which is equated with the idea of semantic primitives (Wierzbicka, 1996). + +Sememes are implicit in words and hence cannot be utilized in natural language processing (NLP) directly. To tackle this challenge, Dong and Dong (2006) manually defined about 2,000 sememes and used them to annotate over 100,000 English and Chinese words, whereupon a sememe knowledge base called HowNet was established. Figure 1 gives an example of sememe annotations in HowNet. + +HowNet is a special lexical knowledge base (KB). Different from other lexical KBs like WordNet (Miller, 1998), which explain meanings of words by relations between words, e.g., hyponym and meronym, HowNet provides intensional definitions of words using infra-word sememes. This distinctness gives HowNet unique advantages. First, sememes can be easily incorporated into neural networks as semantic labels (Qi et al., 2019; Qin et al., 2020), which displays the particular suitability of HowNet in knowledge integration into deep learning. Second, the nature that limited sememes can represent meanings of unlimited words endows HowNet with the ability to handle low-data regimes, e.g., sememes can improve the embeddings of rare words (Niu et al., 2017). Because of + +these advantages, HowNet has been successfully utilized in various NLP tasks (Qi et al., 2021b). + +HowNet is distinctive and useful, but it covers only two languages (English and Chinese). Plus there are no sememe KBs like HowNet in other languages, which hinders NLP of most languages from benefiting by sememes. Manually building a sememe KB for each language is an obvious solution. But it is not realistic at all because the building process would be extremely time-consuming and labor-intensive — it takes several linguistic experts more than two decades to build HowNet. + +To solve this problem, Qi et al. (2020) pioneeringly propose to build a multilingual sememe KB based on BabelNet (Navigli and Ponzetto, 2012a), a multilingual encyclopedic dictionary. The entries of BabelNet are synsets composed of synonyms in almost 500 languages, as illustrated in Figure 2. All the multilingual synonyms in a synset have the same meaning and thus should be annotated with the same sememes. Therefore, sememe annotations of words in many languages would be simultaneously obtained by annotating sememes for BabelNet synsets. For example, suppose we annotate four sememes human, family, spouse and male to the synset in Figure 2, all the multilingual synonyms in the synset ("husband", "époux", "丈夫", etc.) would be simultaneously annotated with these sememes.1 + +Further, Qi et al. (2020) build a seed dataset by manually annotating sememes for some synsets, and present the task of sememe prediction for BabelNet synsets (SPBS), which is aimed at automatically predicting sememes for the other unannotated synsets. In addition, they put forward two SPBS methods that utilize different information in BabelNet synsets, namely synset-related Wikipedia articles and relations between synsets. + +In this paper, we argue that some other information contained in BabelNet can be exploited for SPBS. As shown in Figure 2, in addition to the multilingual synonyms, each BabelNet synset comprises multilingual glosses that are extracted from different sources including WordNet and Wiktionary. Besides, many synsets contain images from Wikipedia and Wikidata (Vrandecic and Krötzsch, 2014). The multilingual synonyms, glosses and images of a synset convey the meaning of the synset, thus naturally helpful in predicting + +# Multilingual Synonyms and Glosses + +![](images/a1e2eeabed82d1e4864bca4361ad4ba3a1bbde652a2a24dfe5af66fea7b610c0.jpg) + +EN husband, hubby + +A woman's partner in marriage + +FR mari, époux, marié + +Partenaire masculin dans un mariage + +ZH丈夫,老公,先生,夫婿 + +男女婚姻中对男性的称谓,与妻子相对应 + +DE Ehemann, Gemahl, Gatte + +Männliche Partner in einer ehelichen Beziehung + +·· + +![](images/cdebe766f0cc05f72419e8ecacda7745495a0d58f23d5a65e95e3727f1fc8629.jpg) +Images + +![](images/78e25882a636dc701ea51035574380bfae4f2dd161e7bbefe6309b41f9447155.jpg) + +![](images/8b2e8c50ac0d8e42fccde26000dab0239e37faac791446bbb418a75342c10dbc.jpg) +Figure 2: A BabelNet synset that comprises multilingual synonyms and glosses as well as some images. + +![](images/dbd3e2aab7e574bad8cd823eb3b672b673e6c0ca01ec12cd064b5d6d479d7df7.jpg) + +·· + +sememes for the synset. Therefore, we propose to utilize all the information in BabelNet synsets for the task of SPBS. + +We design a multimodal information fusion model named MSGI (sememe prediction with Multilingual Synonyms and Glosses as well as Images), which comprises a multilingual text encoder, an image encoder and a multi-label classifier. The text encoder is based on a cross-lingual pre-trained language model that encodes the multilingual synonyms and glosses. To adapt the general pretrained language model for the task of SPBS, we introduce a new pre-training task named masked contextual sememe prediction to it. The image encoder learns the embeddings of the images, and we adopt the attention-based multi-instance learning mechanism to process multiple images. + +In experiments, we find that our MSGI model substantially outperforms previous SPBS methods (by about 10 MAP and F1 scores). We also conduct a series of quantitative and qualitative analyses of the sememe prediction results of MSGI, aiming to explain the effectiveness of MSGI. + +# 2 Related Work + +# 2.1 Sememe Knowledge Base + +HowNet is the most famous sememe KB and has attracted wide attention since it was published (Dong and Dong, 2006). So far it has displayed its effectiveness in various NLP tasks, such as word similarity computation (Liu and Li, 2002), sentiment analysis (Fu et al., 2013), word sense disambiguation (Hou et al., 2020), word representation learning (Niu et al., 2017), language modeling (Gu et al., 2018), relation extraction (Li et al., 2019), reverse dictionary (Zhang et al., 2020), textual adversarial and backdoor attacks (Zang et al., 2020; Qi et al., 2021c), text matching (Lyu et al., 2021b), quote recommendation (Qi et al., 2022), etc. + +Besides the application of sememe KBs, another line of research is the automatic expansion and construction of sememe KBs. Among these studies, most of them focus on automatic expansion of existing sememe KBs (Xie et al., 2017b; Jin et al., 2018; Lyu et al., 2021a). They propose different methods to automatically predict sememes for English/Chinese words that are not covered in HowNet, aiming to expand and update HowNet. + +Only a few studies try to automatically construct a sememe KB for a new language. Qi et al. (2018) present the task of cross-lingual lexical sememe prediction, aiming to predict sememes for words in a new language based on the sememe annotations of English/Chinese words in HowNet. However, it is not efficient because it can handle only one language at a time. Moreover, it cannot conduct sense-level sememe prediction and thus hardly processes polysemous words. Afterwards, Qi et al. (2020) pioneeringly propose the scheme of the BabelNet-based multilingual sememe KB, which is a more efficient and economical way to build sememe KBs for many languages. They take advantage of the multilingual nature of BabelNet and try to automatically predict sememes for all BabelNet synsets, so that all words in almost 500 languages in BabelNet would obtain sememe annotations. Further, they build a seed dataset by aligning the words in HowNet and BabelNet and propose two methods to automatically predict sememes for synsets. Building on this work, we utilize more information incorporated in BabelNet to predict sememes for BabelNet synsets, achieving much better results. + +Moreover, a recent work tries to construct a sememe KB on the basis of a dictionary (Qi et al., 2021a). It does not rely on the existing sememe + +annotations of HowNet or use the sememe set of HowNet. Instead, it views the words in the controlled defining vocabulary of a dictionary as “sememes”, and extracts them directly from dictionary definitions. + +# 2.2 BabelNet + +BabelNet (Navigli and Ponzetto, 2012a) is a multilingual encyclopedic dictionary that merges many heterogeneous resources, mainly including WordNet (Miller, 1998), Wikipedia and Wikidata (Vrandecic and Krötzsch, 2014). It has been utilized in multiple NLP tasks (Navigli et al., 2021), especially the cross-lingual or multilingual tasks, such as multilingual word sense disambiguation (Navigli and Ponzetto, 2012b), cross-lingual lexical entailment (Vyas and Carpuat, 2016) and cross-lingual AMR parsing (Blloshmi et al., 2020). Most of these studies regard BabelNet as a large multilingual sense inventory and utilize the multilingual synonyms and glosses in BabelNet synsets, and some studies also use images in it, e.g., Calabrese et al. (2020) learn multimodal sense embeddings with the concepts and images in BabelNet. + +Due to the multilingual mapping between different resources, BabelNet has become the hub to ground many linguistic resources, e.g., BabelNet is at the core of a dictionary matrix within the ELEXIS project3 that aims to interlink different lexicographic resources. + +# 3 Methodology + +In this section, we elaborate on our MSGI model. Before that, we first introduce the formalization of the SPBS task. Then we describe the details of MSGI, and finally we present the training strategy of MSGI. Figure 3 illustrates the framework and training strategy of MSGI. + +# 3.1 SPBS Task Formalization + +According to Qi et al. (2020), SPBS neglects the hierarchical structures of sememes and regards sememes as discrete semantic labels. Therefore, SPBS is essentially a multi-label classification problem that is aimed at attaching appropriate labels (sememes) to the target BabelNet synset. Formally, suppose $\mathbb{B}$ is the set of all BabelNet synsets and $\mathbb{S}$ is the set of all sememes. For a given target synset $b\in \mathbb{B}$ , SPBS is intended to predict its + +sememe set $\mathbb{S}_b = \{s_1,\dots ,s_{|\mathbb{S}_b|}\} \subset \mathbb{S},$ where $|\cdot |$ represents the cardinality of a set. + +To this end, a prediction score is computed for each sememe. Then the sememes whose prediction scores are higher than a threshold are selected as the prediction results. Formally, the predicted sememe set for the target synset $b$ is + +$$ +\hat {\mathbb {S}} _ {b} = \{s \in \mathbb {S} | P (s | b) > \delta \}, \tag {1} +$$ + +where $P(s|b)$ is the prediction score of a sememe $s$ and $\delta$ is the prediction score threshold. + +# 3.2 The MSGI Model + +MSGI is a multimodal information fusion model that is composed of a text encoder, an image encoder and a multi-label classifier. Next, we describe the three parts one by one. + +# Text Encoder + +The text encoder is aimed at encoding the semantic information of the multilingual synonyms and glosses of a BabelNet synset. We combine all the multilingual synonyms and glosses into a multilingual text sequence and utilize XLM-R (Connieu et al., 2020) to encode it. XLM-R is a large cross-lingual pre-trained language model, and is pre-trained on a large corpus in many languages using self-supervised training objectives including masked language model (Devlin et al., 2019). Because of the popularity and outstanding performance on multiple cross-lingual NLP tasks, we choose XLM-R as the base text encoder in this paper. But our method also works based on other cross-lingual pre-trained language models. + +We construct the multilingual text sequence of a synset in the following way. For a target synset, we first concatenate the synonyms and gloss in the same language. Inspired by Du et al. (2020), we put a special separator token, specifically a colon (:), between the synonyms and gloss to discriminate them. Besides, we use another separator token, namely vertical bar (|), to separate the synonyms. For example, the concatenation of the English synonyms and gloss of the example synset in Figure 2 is $\{[\mathrm{/s}]$ husband | hubby : A woman's partner in marriage $[\mathrm{/s}]\}$ , where $[\mathrm{/s}]$ is the language separator token in XLM-R. + +After obtaining the monolingual text sequences in many languages, we concatenate them into the final multilingual text sequence. For example, the concatenation of the English and French text sequences is $S_{\{\mathrm{en,fr}\}} = \{[\mathrm{/s}]$ husband | hubby : A + +woman's partner in marriage [/s] [/s] mari | époux | marié : Partenaire masculin dans un mariage [/s] \}, as shown in Figure 3. + +Next, we feed the multilingual text sequence into XLM-R and obtain a series of hidden states: + +$$ +\mathbf {h} _ {[ / \mathrm {s} ]}, \dots = \operatorname {X L M - R} (S). \tag {2} +$$ + +We use the first hidden state as the text-based semantic representation of the synset: $\mathbf{b}_t = \mathbf{h}_{[ / s]}$ + +# Image Encoder + +The image encoder is used to capture the semantic information contained in the images in a BabelNet synset. Previous studies have shown that images can help learn better semantic representations for concepts and entities (Xie et al., 2017a; Calabrese et al., 2020). We believe that images are also beneficial to SPBS. + +We use the popular image classification model ResNet (Deng et al., 2009) as the image encoder to learn image embeddings. Most BabelNet synsets have multiple images, and we need to combine the embeddings of multiple images into one aggregated image-based representation. Simply averaging all image embeddings may suffer from noises and cannot highlight important information. Inspired by Xie et al. (2017a), we utilize the attention-based multi-instance learning mechanism to construct the aggregated image-based representation. + +Suppose a BabelNet synset $b$ has $m$ images and the embedding of the $j$ -th image obtained from RestNet is $\mathbf{e}_j$ . Based on the text-based representation of the synset $\mathbf{b}_t$ , we calculate the attention of each image: + +$$ +\alpha_ {j} = \frac {\exp \left(\mathbf {b} _ {t} \cdot \mathbf {e} _ {j}\right)}{\sum_ {k = 1} ^ {m} \exp \left(\mathbf {b} _ {t} \cdot \mathbf {e} _ {k}\right)}. \tag {3} +$$ + +The aggregated image-based representation is the attention-weighted sum of the image embeddings: $\mathbf{b}_i = \sum_{j=1}^m \alpha_j \mathbf{e}_j$ . + +In experiments, however, we find that images in BabelNet are too diversified, and some are even not related to the corresponding synsets at all. For example, among the displayed four images in the example synset in Figure 2, they vary markedly in styles and semantic descriptive perspectives. Even with the attention mechanism, the model would still be confused if we consider all the images. + +![](images/b9d71f07d75d047f482dd477250e10663036e6de6306514fd53aafbee738dc8a.jpg) +Figure 3: The illustration of the MSGI model. For simplicity, we only show the synonyms and glosses in two languages (English and French) in the multilingual text sequence. + +To tackle this issue, we take the following two measures: (1) Removing Low-quality Images. We adopt an unsupervised outlier detection algorithm, more specifically One-Class-SVM (Schölkopf et al., 1999), to detect and filter out some low-quality images based on their image embeddings; (2) Adding High-quality Images. Since BabelNet synsets are connected with WordNet synsets, we can retrieve more images for some BabelNet synsets from ImageNet (Deng et al., 2009) that is also organized based on WordNet. Images in ImageNet are manually annotated and have much higher quality. After the two measures, we obtain a better image set, and then we adopt the attention-based multi-instance learning mechanism to obtain the final image-based representation $\mathbf{b}_i$ . + +# Multi-label Classifier + +We concatenate the text-based and image-based representations of a synset, and pass the concatenation vector into a single-layer perceptron for multi-label classification: + +$$ +\mathbf {p} = \sigma \left(\mathbf {W} \left[ \mathbf {b} _ {t}; \mathbf {b} _ {i} \right] + \boldsymbol {\mu}\right), \tag {4} +$$ + +where $\mathbf{W}$ is a weight matrix, $\pmb{\mu}$ is a bias vector, and $\sigma$ is the sigmoid function. The obtained $\mathbf{p} \in \mathbb{R}^{|\mathbb{S}|}$ is the sememe prediction score vector whose $i$ -th element is the prediction score of the $i$ -th sememe. + +# 3.3 Training Strategy of MSGI + +We can simply train MSGI using the cross-entropy loss, during which the text encoder (XLM-R) is fine-tuned, the multi-label classifier is trained, but the image encoder (ResNet) is frozen. The train + +ing loss of a training instance $b$ is + +$$ +\mathcal {L} _ {b} = - \frac {1}{\mathbb {S}} \left[ \sum_ {s \in \mathbb {S} _ {b}} \log p _ {s} + \sum_ {s \notin \mathbb {S} _ {b}} \log \left(1 - p _ {s}\right) \right], \tag {5} +$$ + +where $p_s$ is the sememe prediction score of $s$ . + +Here we directly use the raw XLM-R, which is general and independent on downstream tasks. We argue that it can be enhanced by integrating specific adaptation to the SPBS task. Inspired by the masked language model (Devlin et al., 2019) and sememe-incorporated language model (Gu et al., 2018), we propose the masked contextual sememe prediction (MCSP) pre-training task as the adaptation of XLM-R. + +# MCSP Pre-training + +MCSP is aimed at predicting sememes for a masked word in a sentence by utilizing the contextual information. It is viable for English and Chinese glosses thanks to HowNet that annotates sememes for English and Chinese words. We hope that MCSP pre-training can make the raw XLM-R more familiar with sememes and in turn, perform better in the subsequent training of SPBS. + +More specifically, for a multilingual text sequence of a synset, we randomly replace some words in its English and Chinese glosses with a special [MASK] token. Then we feed the corrupted text sequence into the raw XLM-R, and pass the hidden states of the [MASK] tokens to a multi-label classifier like Equation (4), which serves as the sememe predictor for words. Following previous studies on sememe prediction for words (Xie + +of the training set, which is consistent with the findings in previous studies (Xie et al., 2017a). + +et al., 2017a; Jin et al., 2018), we neglect the polysemy of the masked words and group sememes of all senses together to form the sememe set of a word. + +The training loss for MCSP is also multi-label cross-entropy loss. After the MCSP pre-training, we conduct the training of SPBS as in Equation (5). + +# 4 Experiments + +In this section, we evaluate the sememe prediction performance of our MSGI model. + +# 4.1 Experimental Settings + +Dataset The evaluation is conducted on BabelSe-meme, the seed dataset of the multilingual se-meme KB based on BabelNet that is built by Qi et al. (2020). Its training/validation/test sets have 12,369/1,546/1,546 synsets that are manually annotated by a total of 2,106 sememes. + +Baseline Methods We choose the two methods proposed by Qi et al. (2020) as main baselines: (1) SPBS-SR, which performs collaborative filtering-based sememe prediction (Xie et al., 2017b) using NASARI embeddings (Camacho-Collados et al., 2016), a set of synset embeddings trained with related Wikipedia articles; (2) SPBS-RR, which models SPBS as a relation prediction task in knowledge graph by considering relations between synsets; (3) the Ensemble of the above two methods. Besides, we have two naive baselines that are used for comparison in Qi et al. (2020); (4) Logistic regression (LR), which directly uses NASARI embeddings for multi-label classification; (5) TransE (Bordes et al., 2013), which is a classical relation prediction model and adapted for SPBS in a similar way to SPBS-RR. $^{6}$ + +Evaluation Metrics Following Qi et al. (2020), we use mean average precision (MAP) and F1 score as the evaluation metrics. + +Selection of Languages It is impractical to consider all the 500 languages in BabelNet together. In our experiments, we pick 3 representative languages, namely English, French and Chinese. English and Chinese are the two languages in HowNet and are required for MCSP pre-training. French is a high-resource language and most synsets have + +French glosses in BabelNet. Besides, these 3 languages have different linguistic distances: English is close to French while Chinese is far from the two. Some synsets have no glosses in French or Chinese, and we remove the whole corresponding monolingual part from the multilingual text sequences. + +Implementation Details For the text encoder, we use the pre-trained base version of XLM-R with the help of the Transformers library (Wolf et al., 2020), and the hidden size is 768. For the image encoder, we choose ResNet-152 that contains 152 layers and delivers 1000-dimensional image embeddings, and implement the model with PyTorch. We transform the image embeddings into 768 dimensions with a linear layer in order for attention calculate and concatenation with the text-based representation. For images from BabelNet, we resize them into $256 \times 256$ . For images from ImageNet, we use the processed version of ImageNet 21K (Ridnik et al., 2021) whose images are resized into $224 \times 224$ . In BabelSememe, 9,356 synsets have images, among which 2,538 synsets have images from both BabelNet and ImageNet. The average image number of a synset is 45. + +We use the Adam (Kingma and Ba, 2015) optimizer in both MCSP pre-training and the final training. The prediction score threshold $\delta$ in Equation (1) is continuously tuned on the validation set and set to 0.42 finally. The learning rates for XLM-R and the multi-label classifier are separately tuned in $\{1\mathrm{e} - 6,5\mathrm{e} - 6,\mathbf{1}\mathrm{e} - \mathbf{5},5\mathrm{e} - 5,1\mathrm{e} - 4\}$ and $\{1\mathrm{e} - 4,5\mathrm{e} - 4,$ $1\mathrm{e} - 3,5\mathrm{e} - 3,1\mathrm{e} - 2\}$ , where the boldfaced ones are final picks based on the validation set performance. + +# 4.2 Main Results + +Table 1 shows the SPBS results of different models on the test set. We have the following observations: + +(1) The MSGI model achieves consistent and substantial outperformance over previous methods (about 10 for both MAP and F1 score), which demonstrates the usefulness of the multilingual and multimodal information in BabelNet in the SPBS task and the effectiveness of the MSGI model. +(2) Among the four PoS types, MSGI performs best on nominal synsets, which is possibly because nominal synsets have the largest amount and the most abundant information in BabelNet (Navigli and Ponzetto, 2012a). + +
PoS (#synset)Noun (10,360)Verb (2,240)Adj. (2,419)Adv. (442)All (15,461)
ModelMAPF1MAPF1MAPF1MAPF1MAPF1
LR54.4239.81--------
TransE61.0546.7834.7526.7629.1122.9930.0520.6951.7339.73
SPBS-SR65.1649.75--------
SPBS-RR62.5047.9234.7625.2832.6824.5130.8620.0753.3140.53
Ensemble68.8555.3534.7625.2832.6824.5130.8620.0757.6445.61
MSGI (ours)71.8164.3659.7847.0155.6141.0268.5255.2067.2357.68
-Synonym67.4059.0735.3124.9936.3326.1848.3337.4557.2548.54
-Gloss66.9056.9954.2241.5453.1139.2068.7655.1462.6752.21
-Image71.4161.5859.7044.2955.8643.1563.8151.6367.1356.62
-MCSP70.5861.9957.5543.2752.5740.6168.4952.7965.7056.05
+ +(3) MSGI largely improves the performance on the non-nominal synsets compared with TransE and SPBS-RR. It is because the baselines rely on the relations between synsets, and non-nominal synsets have sparse relations (Qi et al., 2020). In contrast, MSGI utilizes the internal information of BabelNet synsets and is immune to the relation density. + +# Ablation Study + +We conduct a series of ablation studies to show the effectiveness of different parts of the MSGI model. (1) -Synonym. We eliminate all the synonyms and separator tokens in the multilingual text sequences, i.e., retain the glosses only. (2) -Gloss. We remove all the multilingual glosses and the colon separator tokens, and keep the synonyms together with the vertical bar separator tokens only. (3) -Image. We remove the image encoder and use the text encoder together with the multi-label classifier only. (4) -MCSP. We skip the MCSP pre-training and directly train the MSGI model on the raw XLM-R. + +The results are also shown in Table 1. We can see that the original MSGI model has better overall results than all the above four incomplete models, which proves the effectiveness of the four parts. + +# 4.3 Effectiveness of Image Encoding + +According to the ablation study, the benefit of the images seems to be marginal. We conjecture that it is because many synsets $(6,105, \sim 40\%)$ have no available images and the image encoder only plays a limited role. To better demonstrate the effectiveness of image encoding, we conduct experiments on the 9,356 synsets with images, which are ran + +Table 1: SPBS performance of different models on the test set of BabelSememe. The boldfaced results exhibit statistically significant improvement over the other results with $p < 0.1$ according to the paired $t$ -test, and the underlined results indicate no significant difference. + +
Used ImagesMAPF1
No Images69.4060.44
All BabelNet Images70.2560.99
Filtered BabelNet Images70.6361.21
Filtered BabelNet + ImageNet Images71.3362.10
+ +Table 2: SPBS performance of the MSGI model incorporated with different image information. + +domly split into the training, validation and test sets in the ratio of 8:1:1. In addition, we investigate the effectiveness of the two measures in image encoding, i.e., filtering BabelNet images and adding ImageNet images, on this subset. + +Table 2 shows the results. We can see that the improvement brought by image encoding is better exhibited (nearly 2 MAP and F1 scores). Further, both the two measures in image encoding are effective and improve the SPBS performance. + +# 4.4 Effectiveness of Multilinguality + +In this subsection, we investigate the effectiveness of the multilingual information in the MSGI model. We extract the 8,974 synsets that have synonyms and glosses in all the three languages (English, French and Chinese), and randomly split them into training/validation/test sets in the ratio of 8:1:1. Then we train MSGI with multilingual text sequences in different combinations of languages. + +The evaluation results on the test set are shown in Table 3. We observe that considering more languages can bring performance enhancement indeed, which demonstrates the usefulness of the multilin + +
LanguagesMAPF1
En67.2255.80
Fr59.8750.87
Zh70.8761.13
En+Fr68.0157.48
En+Zh71.9561.53
Fr+Zh71.6560.45
En+Fr+Zh72.9863.46
+ +Table 3: SPBS performance of the MSGI model with information in different language combinations. + +![](images/485549ea1014a391d10ffef9fff055dfb8a6be3ef5b4d97398e5cb08012c5658.jpg) +Figure 4: SPBS results of synsets with different numbers of sememes. The numbers of synsets in the six ranges are 422, 422, 287, 208, 119 and 88, respectively. + +gual information in the SPBS task. We conjecture the possible reason is that the text sequences in different languages provide semantic information from different perspectives, and combining them can obtain more semantic information to better predict sememes. Besides, $\mathrm{En + Zh}$ and $\mathrm{Fr + Zh}$ outperform $\mathrm{En + Fr}$ , which indicates that the combination of distant languages can produce more benefits, presumably because text sequences in distant languages have more different semantic information. + +# 5 Analysis + +In this section, we conduct some quantitative and qualitative analyses of the SPBS results of MSGI. All the experiments are conducted on the validation set of BabelSememe. + +# 5.1 Effect of Synset's Sememe Number + +We first investigate how the characteristics of a synset affect its sememe prediction results. The effect of PoS has been studied in §4.2. Here we focus on another quantitative characteristic, namely the number of a synset's annotated sememes. Figure 4 shows the average sememe prediction MAP and F1 + +![](images/ca0bcab468c21152f8c40a525ca03cf9a490f8786d4634b131da0cc853db8d12.jpg) +Figure 5: SPBS results of synsets having sememes with different frequencies. The numbers of synsets in the six ranges are 708, 164, 66, 35, 21 and 49, respectively. + +scores of the synsets that have different numbers of sememes. We find that the sememe prediction performance of a synset is basically not influenced by its sememe number. In contrast, according to Qi et al. (2020), the baseline methods (SPBS-SR, SPBS-RR and Ensemble) perform badly on the synsets with too few or too many sememes. These results show the higher robustness of our MSGI model to sememe number. + +# 5.2 Effect of Sememe Frequency + +In this subsection, we explore what sememes are easy or hard to predict. We study the characteristic of sememe frequency, i.e., the number of synsets having a target sememe in the training set, which is the only quantitative feature of sememes. Figure 5 shows the results, where the x-axis denotes the sememe frequency ranges while the y-axis denotes the average sememe prediction performance of the synsets having the sememes within a specific frequency range. We find that the frequent sememes are easier to predict broadly, which is consistent with the findings in previous work (Qi et al., 2020). + +# 5.3 Qualitative Analysis + +In this subsection, we conduct qualitative analysis and case studies into the SPBS results of the MSGI model. We randomly select fifty synsets from the validation set, and carry out error analysis one by one. According to their sememe prediction results, we can classify the synsets into four types, namely (1) Good: MSGI performs well on these synsets with MAP/F1 score higher than 85; (2) Fewer, MSGI predicts fewer sememes for these synsets than the ground truth; (3) More, MSGI predicts more sememes for these synsets than the ground + +
TypeExample SynsetPredicted SememesGround Truth
SynonymGloss
GoodEgyptA republic in northeastern Africapolitics, place, country, ProperName, Africapolitics, place, country, ProperName, Africa
FeweranorexiaA psychological disorder characterized by somatic delusions that you are too fat despite being emaciateddiseasedisease, disgust, eat
MoreboilerA pressurized system in which water is vaporized to steam by heat transferred from a source of higher temperatureStateChange, produce, industrial, burn, cook, WarmUp, toolburn, WarmUp, tool
SimilarsemanticOf or relating to meaning or the study of meaninglanguage, knowledgelanguage, information
+ +Table 4: Example synsets of four types classified according to sememe prediction results. We only show one English synonym and gloss for succinctness. The boldfaced sememes are the correctly predicted ones. + +truth; (4) Similar: MSGI predicts some sememes that are different from but similar to the ground-truth sememes. The number of synsets belonging to the four types are 23 (46%), 10 (20%), 3 (6%) and 14 (28%), respectively. + +We pick one example synset for each type and show their basic information and sememe prediction results in Table 4. For the synset of "anorexia", the gloss doesn't embody any information about "disgust at eating", thus the MSGI model doesn't predict the two sememes "disgust" and "eat". For the synset of "boiler", the gloss provides much information and the model predicts more sememes than the ground truth, which are basically reasonable. For the synset of "semantic", our model predicts "knowledge" rather than "information", while the two sememes are similar and related. + +# 6 Conclusion and Future Work + +In this paper, we propose to utilize the multilingual and multimodal information in BabelNet, i.e., multilingual synonyms, multilingual glosses and images, to predict sememes for BabelNet synsets. We design the MSGI model and it achieves absolute outperformance over previous methods. In the future, we will try to leverage more information in BabelNet, e.g., semantic relations, to better predict sememes. We will also consider expanding BabelSememe with the prediction results of our model after manual examination. + +# Acknowledgements + +This work is supported by the National Key R&D Program of China (No. 2020AAA0106502), Institute Guo Qiang at Tsinghua University, and International Innovation Center of Tsinghua University, Shanghai, China. Zheng and Lv are supported by National Natural Science Foundation of China (Grant No. 6201101015), Beijing Academy of Artificial Intelligence (BAAI), + +Natural Science Foundation of Guangdong Province (Grant No. 2021A1515012640), the Basic Research Fund of Shenzhen City (Grant No. JCYJ20210324120012033 and JCYJ20190813165003837), and Overseas Cooperation Research Fund of Tsinghua Shenzhen International Graduate School (Grant No. HW2021008). We also thank all the anonymous reviewers for their valuable comments and suggestions. + +# Ethical Statements + +In this paper, we use only one dataset, namely BabelSememe, which is completely free and publicly available. The task we tackle, namely SPBS, is only related to NLP research and not for practical application, thus cannot be misused by the ordinary people. To save energy, we use the base version of XLM-R rather than larger cross-lingual pre-trained models, although they may yield higher performance. No demographic or identity characteristics are used in the formation of this paper. + +# References + +Rexhina Blloshmi, Rocco Tripodi, and Roberto Navigli. 2020. Enabling cross-lingual amr parsing with transfer learning techniques. In Proceedings EMNLP, pages 2487-2500. +Leonard Bloomfield. 1926. A set of postulates for the science of language. Language, 2(3):153-164. +Antoine Bordes, Nicolas Usunier, Alberto Garcia-Duran, Jason Weston, and Oksana Yakhnenko. 2013. Translating embeddings for modeling multi-relational data. Proceedings of NIPS. +Agostina Calabrese, Michele Bevilacqua, and Roberto Navigli. 2020. Evilbert: Learning task-agnostic multimodal sense embeddings. In Proceedings of IJCAI. +Jose Camacho-Collados, Mohammad Taher Pilehvar, and Roberto Navigli. 2016. Nasari: Integrating explicit knowledge and corpus statistics for a multilin- + +gual representation of concepts and entities. Artificial Intelligence, 240:36-64. +Alexis Conneau, Kartikay Khandelwal, Naman Goyal, Vishrav Chaudhary, Guillaume Wenzek, Francisco Guzmán, Édouard Grave, Myle Ott, Luke Zettle-moyer, and Veselin Stoyanov. 2020. Unsupervised cross-lingual representation learning at scale. In Proceedings of ACL. +Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. 2009. Imagenet: A large-scale hierarchical image database. In Proceedings of CVPR. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of NAACL-HLT. +Zhendong Dong and Qiang Dong. 2006. HowNet and the Computation of Meaning (With CD-Rom). World Scientific. +Jiaju Du, Fanchao Qi, Maosong Sun, and Zhiyuan Liu. 2020. Lexical sememe prediction by dictionary definitions and local semantic correspondence. Journal of Chinese Information Processing, 34(5):1-9. +Xianghua Fu, Guo Liu, Yanyan Guo, and Zhiqiang Wang. 2013. Multi-aspect sentiment analysis for Chinese online social reviews based on topic modeling and HowNet lexicon. Knowledge-Based Systems, 37:186-195. +Yihong Gu, Jun Yan, Hao Zhu, Zhiyuan Liu, Ruobing Xie, Maosong Sun, Fen Lin, and Leyu Lin. 2018. Language modeling with sparse product of sememe experts. In Proceedings of EMNLP. +Bairu Hou, Fanchao Qi, Yuan Zang, Xurui Zhang, Zhiyuan Liu, and Maosong Sun. 2020. Try to substitute: An unsupervised Chinese word sense disambiguation method based on hownet. In Proceedings of COLING. +Huiming Jin, Hao Zhu, Zhiyuan Liu, Ruobing Xie, Maosong Sun, Fen Lin, and Leyu Lin. 2018. Incorporating Chinese characters of words for lexical sememe prediction. In Proceedings of ACL. +Diederik P Kingma and Jimmy Ba. 2015. Adam: A method for stochastic optimization. In Proceedings of ICLR. +Ziran Li, Ning Ding, Zhiyuan Liu, Haitao Zheng, and Ying Shen. 2019. Chinese relation extraction with multi-grained information and external linguistic knowledge. In Proceedings of ACL. +Qun Liu and Sujian Li. 2002. Word similarity computing based on HowNet. International Journal of Computational Linguistics & Chinese Language Processing, 7(2):59-76. + +Boer Lyu, Lu Chen, and Kai Yu. 2021a. Glyph enhanced Chinese character pre-training for lexical se-meme prediction. In Findings of the ACL: EMNLP 2021. +Boer Lyu, Lu Chen, Su Zhu, and Kai Yu. 2021b. Let: Linguistic knowledge enhanced graph transformer for chinese short text matching. In Proceedings of AAAI. +George Miller. 1998. WordNet: An electronic lexical database. MIT press. +Roberto Navigli, Michele Bevilacqua, Simone Conia, Dario Montagnini, and Francesco Ceconi. 2021. Ten years of babelnet: A survey. In Proceedings IJCAI. +Roberto Navigli and Simone Paolo Ponzetto. 2012a. Babelnet: The automatic construction, evaluation and application of a wide-coverage multilingual semantic network. Artificial Intelligence, 193:217-250. +Roberto Navigli and Simone Paolo Ponzetto. 2012b. Joining forces pays off: Multilingual joint word sense disambiguation. In Proceedings of EMNLP. +Yilin Niu, Ruobing Xie, Zhiyuan Liu, and Maosong Sun. 2017. Improved word representation learning with sememes. In Proceedings of ACL. +William O'Grady, Michael Dobrovolsky, and Francis Katamba. 1997. Contemporary Linguistics. +Fanchao Qi, Liang Chang, Maosong Sun, Sicong Ouyang, and Zhiyuan Liu. 2020. Towards building a multilingual sememe knowledge base: Predicting sememes for babelnet synsets. In Proceedings of AAAI. +Fanchao Qi, Yangyi Chen, Fengyu Wang, Zhiyuan Liu, Xiao Chen, and Maosong Sun. 2021a. Automatic construction of sememe knowledge bases via dictionaries. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021. +Fanchao Qi, Junjie Huang, Chenghao Yang, Zhiyuan Liu, Xiao Chen, Qun Liu, and Maosong Sun. 2019. Modeling semantic compositionality with sememe knowledge. In Proceedings of ACL. +Fanchao Qi, Yankai Lin, Maosong Sun, Hao Zhu, Ruobing Xie, and Zhiyuan Liu. 2018. Cross-lingual lexical sememe prediction. In Proceedings of EMNLP. +Fanchao Qi, Ruobing Xie, Yuan Zang, Zhiyuan Liu, and Maosong Sun. 2021b. Sememe knowledge computation: a review of recent advances in application and expansion of sememe knowledge bases. Frontiers of Computer Science, 15(5):1-11. +Fanchao Qi, Yanhui Yang, Jing Yi, Zhili Cheng, Zhiyuan Liu, and Maosong Sun. 2022. Quoter: A benchmark of quote recommendation for writing. In Proceedings of ACL. + +Fanchao Qi, Yuan Yao, Haoji Xu, Zhiyuan Liu, and Maosong Sun. 2021c. Turn the combination lock: Learnable textual backdoor attacks via word substitution. In Proceedings of ACL. +Yujia Qin, Fanchao Qi, Sicong Ouyang, Zhiyuan Liu, Cheng Yang, Yasheng Wang, Qun Liu, and Maosong Sun. 2020. Improving sequence modeling ability of recurrent neural networks via sememes. IEEE/ACM Transactions on Audio, Speech, and Language Processing. +Tal Ridnik, Emanuel Ben-Baruch, Asaf Noy, and Lihi Zelnik-Manor. 2021. Imagenet-21k pretraining for the masses. In Proceedings of NeurIPS. +Bernhard Schölkopf, Robert Williamson, Alex Smola, John Shawe-Taylor, and John Platt. 1999. Support vector method for novelty detection. In Proceedings of NIPS. +Denny Vrandecic and Markus Krötzsch. 2014. Wikidata: a free collaborative knowledgebase. Communications of the ACM, 57(10):78-85. +Yogarshi Vyas and Marine Carpuat. 2016. Sparse bililingual word representations for cross-lingual lexical entailment. In Proceedings of NAACL-HLT. +Anna Wierzbicka. 1996. Semantics: Primes and universals: Primes and universals. Oxford University Press, UK. +Thomas Wolf, Julien Chaumont, Lysandre Debut, Victor Sanh, Clement Delangue, Anthony Moi, Pierric Cistac, Morgan Funtowicz, Joe Davison, Sam Shleifer, et al. 2020. Transformers: State-of-the-art natural language processing. In Proceedings of EMNLP. +Ruobing Xie, Zhiyuan Liu, Huanbo Luan, and Maosong Sun. 2017a. Image-embodied knowledge representation learning. In Proceedings of IJCAI. +Ruobing Xie, Xingchi Yuan, Zhiyuan Liu, and Maosong Sun. 2017b. Lexical sememe prediction via word embeddings and matrix factorization. In Proceedings of IJCAI. +Yuan Zang, Fanchao Qi, Chenghao Yang, Zhiyuan Liu, Meng Zhang, Qun Liu, and Maosong Sun. 2020. Word-level textual adversarial attacking as combinatorial optimization. In Proceedings of ACL. +Lei Zhang, Fanchao Qi, Zhiyuan Liu, Yasheng Wang, Qun Liu, and Maosong Sun. 2020. Multi-channel reverse dictionary model. In Proceedings of AAAI. \ No newline at end of file diff --git a/sememepredictionforbabelnetsynsetsusingmultilingualandmultimodalinformation/images.zip b/sememepredictionforbabelnetsynsetsusingmultilingualandmultimodalinformation/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..5932fb23992e97c518332651fde1034523aef125 --- /dev/null +++ b/sememepredictionforbabelnetsynsetsusingmultilingualandmultimodalinformation/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a19fe2a21924ef324210913b5c39fe14e7e8a332e3ee27d99e7c107f27d881ed +size 377209 diff --git a/sememepredictionforbabelnetsynsetsusingmultilingualandmultimodalinformation/layout.json b/sememepredictionforbabelnetsynsetsusingmultilingualandmultimodalinformation/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..c29e480ddfe0dcafcc5a4a5529f320a36dc53c22 --- /dev/null +++ b/sememepredictionforbabelnetsynsetsusingmultilingualandmultimodalinformation/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a8d9f2d25a99b98c60339fa84d37a218aa3a86406bdfa200cd4692e3f2709d96 +size 367116 diff --git a/sentencet5scalablesentenceencodersfrompretrainedtexttotextmodels/3362ccd2-c319-483e-a712-9c99328145a3_content_list.json b/sentencet5scalablesentenceencodersfrompretrainedtexttotextmodels/3362ccd2-c319-483e-a712-9c99328145a3_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..f80364119715d414a95ab0a3da09fe11e1a99a31 --- /dev/null +++ b/sentencet5scalablesentenceencodersfrompretrainedtexttotextmodels/3362ccd2-c319-483e-a712-9c99328145a3_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fc7ae83e6e046021f8a7d273d31f1e77a6084a18f8e9eadc8ef42c1b53cdd843 +size 80747 diff --git a/sentencet5scalablesentenceencodersfrompretrainedtexttotextmodels/3362ccd2-c319-483e-a712-9c99328145a3_model.json b/sentencet5scalablesentenceencodersfrompretrainedtexttotextmodels/3362ccd2-c319-483e-a712-9c99328145a3_model.json new file mode 100644 index 0000000000000000000000000000000000000000..5784bae0ad402469a4b54558b33b7c1919eca818 --- /dev/null +++ b/sentencet5scalablesentenceencodersfrompretrainedtexttotextmodels/3362ccd2-c319-483e-a712-9c99328145a3_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d14ae9f0cce717f057fcce4d84fbcad71fdc8fd4bfdc0c72abdb23ea3cab748e +size 95114 diff --git a/sentencet5scalablesentenceencodersfrompretrainedtexttotextmodels/3362ccd2-c319-483e-a712-9c99328145a3_origin.pdf b/sentencet5scalablesentenceencodersfrompretrainedtexttotextmodels/3362ccd2-c319-483e-a712-9c99328145a3_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..0c49bff45ebed21cb4119d4a24a0ee6b74f2979f --- /dev/null +++ b/sentencet5scalablesentenceencodersfrompretrainedtexttotextmodels/3362ccd2-c319-483e-a712-9c99328145a3_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c93cc316030233f19d62a8f1ca236b9827435da9b9cdbeaef8e14e1b42f789d8 +size 3072599 diff --git a/sentencet5scalablesentenceencodersfrompretrainedtexttotextmodels/full.md b/sentencet5scalablesentenceencodersfrompretrainedtexttotextmodels/full.md new file mode 100644 index 0000000000000000000000000000000000000000..e7548762f424a2c511adc265a349853483e2a9e1 --- /dev/null +++ b/sentencet5scalablesentenceencodersfrompretrainedtexttotextmodels/full.md @@ -0,0 +1,320 @@ +# Sentence-T5 (ST5): Scalable Sentence Encoders from Pre-trained Text-to-Text Models + +Jianmo Ni, Gustavo Hernández Abrego, Noah Constant, Ji Ma, Keith B. Hall, Daniel Cer, Yinfei Yang + +Google Research + +Mountain View, CA + +# Abstract + +We provide the first exploration of sentence embeddings from text-to-text transformers (T5) including the effects of scaling up sentence encoders to 11B parameters. Sentence embeddings are broadly useful for language processing tasks. While T5 achieves impressive performance on language tasks, it is unclear how to produce sentence embeddings from encoder-decoder models. We investigate three methods to construct SentenceT5 (ST5) models: two utilize only the T5 encoder and one using the full T5 encoder-decoder. We establish a new sentence representation transfer benchmark, SentGLUE, which extends the SentEval toolkit to nine tasks from the GLUE benchmark (Wang et al., 2018). Our encoder-only models outperform the previous best models on both SentEval and SentGLUE transfer tasks, including semantic textual similarity (STS). Scaling up ST5 from millions to billions of parameters shown to consistently improve performance. Finally, our encoder-decoder method achieves a new state-of-the-art on STS when using sentence embeddings. + +# 1 Introduction + +Sentence embeddings providing compact meaning representations that are broadly useful for a variety of language processing tasks include classification, question-answering, semantic retrieval, bitext mining, and semantic similarity tasks. We explore sentence embeddings from a new family of pre-trained models: Text-to-Text Transfer Transformer (T5) (Raffel et al., 2020). Unlike encoder-only models, which use a transformer encoder to predict random masked tokens, T5 uses an encoder-decoder architecture and a generative span corruption pre-training task. T5 models can be scaled up to hundreds of billions of parameters + +![](images/08f4f84e140612bf8d641773d1649f676ea67a24e3427aa7e8f8912f2194ffdc.jpg) + +![](images/c6cbf5535767cb7f44b000acb0fd1efd7521dd50cf93966b1f7f5f92ea307be6.jpg) +Figure 1: Scaling up our ST5 model size improves performance on SentEval (left) and STS (right). + +![](images/cf1bf403c36f0d3e86d0fb5ea44e56bc7a80d13396865132b9d8b09f19c9193c.jpg) + +
TransferSTS
ST5-EncDec (11B params)90.4684.94
ST5-Enc (11B params)91.6384.96
SimCSE-RoBERTa (large) (Gao et al., 2021)290.2383.76
SBERT (large) (Reimers and Gurevych, 2019)87.6976.55
USE (Cer et al., 2018)85.1071.22
InferSent (Conneau et al., 2017)85.5965.01
+ +Table 1: ST5 versus notable sentence embedding models on SentEval tasks. The reported numbers are the average of transfer tasks (classification accuracy) and STS tasks (spearman correlation). + +(Fedus et al., 2021) and have achieved state-of-the-art performance on a broad range of NLP tasks including Generalized Language Understanding Evaluation (GLUE) (Wang et al., 2018) and SuperGLUE (Wang et al., 2019). However, it is difficult to efficiently apply T5 to some tasks such as retrieval or clustering. To score retrieval candidates, T5 would need to perform full inference with cross-attention on each query-candidate pair. In contrast, sentence embeddings allow for efficient retrieval and clustering (Gillick et al., 2018; Reimers and Gurevych, 2019; Yang et al., 2020). + +As shown in Figure 2, we explore three ways of turning a pre-trained T5 encoder-decoder model into a sentence embedding model: (i) using the + +![](images/12f2ad976ff680c8134a5f2946dfc19de07cd2cec9d5abff2f768b0914c003a8.jpg) +(a) T5 Encoder-Decoder + +![](images/f4ebee1bcdc121a351cfde035bfaaa444d7e7deea145cdf9ca0904260ca8692b.jpg) +(b) ST5 Encoder-only (ST5-Enc) first + +![](images/d52892c708c618f1cffe1cb94bc380351a11df0d26149d103985cbc2c6c597d1.jpg) +(c) ST5 Encoder-only (ST5-Enc) mean + +![](images/6d7fe4b4e400362acc34f77f83ba641b581fb666dd0e909ab7f2accd0665c101.jpg) +(d) ST5 Encoder-Decoder (ST5-EncDec) first +Figure 2: Architecture diagrams for T5 and three ST5 variants to extract sentence representations from T5. + +first token representation of the encoder; (ii) averaging all token representations from the encoder; (iii) using the first token representation from the decoder. We evaluate the quality of the resulting sentence embeddings on sentence transfer tasks using the SentEval (Conneau and Kiela, 2018) toolkit and on our extension of SentEval to GLUE benchmark tasks (SentGLUE) in addition to semantic textual similarity (STS) (Agirre et al., 2012, 2013, 2014, 2015, 2016; Cer et al., 2017). We contrast raw representations from pre-trained T5 models with those learned through fine-tuning T5 on natural language inference (NLI) using dual encoders and contrastive learning (Conneau et al., 2017; Cer et al., 2018; Gao et al., 2021). We introduce a multi-stage contrastive learning recipe involving fine-tuning first on semi-structured web-mined corpora and then on NLI. Finally, we investigate scaling our T5 sentence embedding model up to 11B parameters. Illustrated in Figure 1, performance on transfer tasks and semantic textual similarity (STS) both improve with increased model capacity. + +To our knowledge, we are the first to study using large-scale pre-trained text-to-text models for sentence representation learning and to scale sentence embedding models up to 11 billion parameters. We summarize our contributions as follows: (i) even without fine-tuning, encoder-only ST5 models perform well on sentence transfer tasks, outperforming state-of-the-art fine-tuned models such as SimCSE BERT and SimCSE RoBERTa (Gao et al., 2021); (ii) encoder-decoder sentence embedding models achieve strong performance on STS, establishing a new state-of-the-art on sentence embedding based STS; (iii) contrastive learning is effective for fine-tuning sentence encoders from T5-style pre-trained models, particularly using our proposed two-stage contrastive learning approach; + +(iv) training ST5 longer and with more data using a contrastive loss leads to consistent improvement on both sentence transfer and STS tasks; (v) creating a new sentence representation transfer benchmark, SentGLUE, which extends the SentEval sentence evaluation toolkit (Conneau and Kiela, 2018) to nine tasks from the GLUE benchmark (Wang et al., 2018). We contribute baselines on SentGLUE using influential sentence embedding models from prior work and contrast the performance with our proposed ST5 embedding models. + +# 2 Related work + +Sentence embedding models have been trained using a variety of methods including: supervised natural language inference pairs (NLI) (Conneau et al., 2017; Reimers and Gurevych, 2019, 2020; Gao et al., 2021); conversational input-response and question-answer pairs (Cer et al., 2018; Yang et al., 2020); translation pairs (Yang et al., 2020; Feng et al., 2020); paraphrasing pairs (Wieting et al., 2016) and adjacent sentence pairs (Kiros et al., 2015; Logeswaran and Lee, 2018). Gao et al. (2021) achieved the previous state-of-the-art on STS with BERT and RoBERTa models by combining contrastive learning that constructs positive and negative sentence pairs using NLI data. + +In parallel, Text-to-Text transfer transformers (T5) (Raffel et al., 2020), as shown in Figure 2a, are gaining popularity due to their competitive performance, effective scaling to larger model sizes, and ease of use in solving tasks as simple text-to-text mapping problems. However, extracting high quality text embeddings from T5 has not been previously explored. Moreover, while recent work has shown that scaling up models improves sentence embedding performance (Gao et al., 2021), the largest model sizes investigated only include + +355 million parameters rather than the 11 billion parameters available in the largest T5 model. + +# 3 Sentence-T5 (ST5) + +We explore producing sentence embeddings from T5 models, ranging in size from 220 million to 11 billion parameters, both as raw sentence embeddings extracted from pretrained T5 models and using fine-tuning to refine the representations. + +# 3.1 Model Architecture + +As shown in Figures 2b to 2d, we explore three strategies to extract T5 sentence representations: + +- Encoder-only first (ST5-Enc first): the encoder output of the first token. +- Encoder-only mean (ST5-Enc mean): the average encoder output across all input tokens. +Encoder-Decoder first (ST5-EncDec first): the first decoder output when the input text is fed into the encoder and the standard "start" symbol is fed as the only decoder input. + +The first two are pooling strategies widely used in encoder-only pre-trained models such as BERT. Unlike BERT models, T5 models do not have a 'CLS' token at the beginning of each sentence. For T5 encoder-decoder models, we assume the decoder is aware of the semantics of the entire input sentence when generating its first token prediction; and if so, the first decoder output embeddings (i.e. input to the softmax layer) might naturally capture the sentence semantics. + +For sentence encoder training, we adopt a dual encoder architecture (Gillick et al., 2018; Cer et al., 2018; Reimers and Gurevych, 2019). As shown in Figure 3, this architecture consists of two shared-weight transformer modules that encode the inputs. The transformer module can be either an encoder-only or encoder-decoder architecture. In our experiments, we initialize the transformer modules from a pre-trained T5 model. After each module computes a fixed-length representation for its input sentence, a projection layer and L2 normalization are applied to the resulting embeddings. The projection layer transforms the output to a configurable fixed dimension sentence embedding. The embeddings from paired encoding towers can be scored for similarity tasks using a dot-product3 or provided to additional layers layers for classification tasks (e.g., NLI). + +![](images/89c6e2cd564d828f8236ca3aa6d78517d20a1ae208ab7bb046f820c018fe0da2.jpg) +Figure 3: Architecture of the dual encoder model. + +# 3.2 Contrastive Learning + +Applying contrastive learning to sentence embeddings improves the uniformity of the embedding space, leading to better performance on downstream tasks such as STS (Gao et al., 2021). We apply contrastive learning to fine-tune the T5 sentence representations.4 + +# 3.2.1 Contrastive Loss + +Using a contrastive loss to train a sentence encoder requires paired examples $\mathcal{D} = \{(v_i, v_i^+)\}$ as a training set, where $v_i$ is an input sentence and $v_i^+$ is a related sentence (e.g., that is semantically nearby). During training, $v_i^+$ is considered as a positive example for $v_i$ and all other examples in a batch are considered as negatives. The model should learn to pull the positive pairs closer together while pushing away the in-batch negatives. We operationalize our contrastive loss using an in-batch sampled softmax (Henderson et al., 2017): + +$$ +\mathcal {L} = \frac {e ^ {\operatorname {s i m} \left(v _ {i} , v _ {i} ^ {+}\right) / \tau}}{\sum_ {j \in \mathcal {B}} e ^ {\operatorname {s i m} \left(v _ {i} , v _ {j} ^ {+}\right) / \tau}}, \tag {1} +$$ + +The similarity scoring function is sim. $\mathcal{B}$ is a minibatch of examples and $\tau$ is the softmax temperature. When additional negatives $v_{j}^{-}$ are provided for the input example $v$ , the loss can be computed as: + +$$ +\mathcal {L} = \frac {e ^ {\operatorname {s i m} \left(v _ {i} , v _ {i} ^ {+}\right) / \tau}}{\sum_ {j \in \mathcal {B}} e ^ {\operatorname {s i m} \left(v _ {i} , v _ {j} ^ {+}\right) / \tau} + e ^ {\operatorname {s i m} \left(v _ {i} , v _ {j} ^ {-}\right) / \tau}}. \tag {2} +$$ + +tower, the dot-product between the embeddings will produce their cosine similarity. + +4 In preliminary experiments, we also explored fine-tuning with the classification loss used in InferSent (Conneau et al., 2017) and Sentence-BERT (Reimers and Gurevych, 2019). However, as previously reported in (Gao et al., 2021), our results confirmed that fine-tuning for classification on an NLI dataset is inferior to contrastive learning. + +# 3.3 Two-stage Training + +We explore two-stage training to refine T5 sentence embeddings: (i) first training on web mined conversational input-response and question-answering pairs; (ii) then, contrastive training on NLI pairs. + +# 4 Experimental Setup + +# 4.1 Training Corpus + +For our fine-tuned sentence embeddings, we follow prior work showing good sentence embeddings can be obtained from supervised training on NLI (Conneau et al., 2017; Reimers and Gurevych, 2019, 2020; Gao et al., 2021) in combination with training to match conversational input-response and question-answer (CQA) pairs (Cer et al., 2018; Yang et al., 2020). We make use of two-stage training using two datasets: one is comprised of 2 Billion conversational input-response and QA (CQA) pairs drawn from web forums such as Reddit and StackExchange; the other consists of NLI pairs from the Stanford Natural Language Inference (SNLI) (Bowman et al., 2015) and Multi-Genre Natural Language Inference (MNLI) (Williams et al., 2017) datasets. For the first stage, we fine-tune using the CQA pairs under a dot-product retrieval loss with batch negatives (Cer et al., 2018; Yang et al., 2018, 2020). For the second stage, we use NLI pairs with a contrastive loss (Gao et al., 2021), where the positives are the 'entailment' pairs while the negatives are the 'contradict' pairs.5 + +# 4.2 Evaluation + +We evaluate using SentEval, which includes 7 transfer and 7 STS tasks (Conneau and Kiela, 2018) and using our extension of SentEval to the GLUEBenchmark tasks (SentGLUE). For the transfer tasks, sentence embeddings are evaluated by how well they perform as features for a linear classification model. For STS, embeddings are evaluated by how well their cosine similarities correlate with human annotated similarity scores. $^6$ + +# 4.3 Configurations + +Our models are implemented using JAX7 and trained on Cloud TPU-v3. We initialize the dual + +encoder modules from public T5 checkpoints. During training, we use Adafactor (Shazeer and Stern, 2018) as the optimizer and set the learning rate to 0.001. Linear decay is applied after $10\%$ of the total number of training steps, reducing the learning rate to 0 by the end of training. To fine-tune on NLI we use a batch size of 512, while for the Community QA (CQA) dataset the batch size is 2048. We use a softmax temperature $\tau$ of 0.01. + +# 5 Experimental Goals + +Our experiments aim to answer the following: + +- Q1: What is the best way to extract sentence representations from T5? +- Q2: How well do raw T5 sentence embeddings perform on downstream tasks? +- Q3: How much do contrastive sentence embedding tasks (e.g., NLI, QA) improve T5 sentence embeddings. +- Q4: Can we benefit from scaling up T5 model capacity for better sentence representations? + +With these goals, we study transfer and STS performance of T5 sentence embeddings using a variety of model and training configurations, comparing ST5 to state-of-the-art methods including SBERT/SRoBERTa (Reimers and Gurevych, 2019) and SimCSE (Gao et al., 2021). + +# 6 Results + +Table 2 and 3 provide performance on transfer and STS tasks, respectively. We compare ST5 models with two types of baselines: (ii) a model that extracts sentence embeddings from a pre-trained BERT model, listed in rows 1-2 of each table; (ii) the current state-of-the-art sentence embedding models fine-tuned from BERT or RoBERTa, listed in rows 6-8 of each table. + +# 6.1 Raw T5 Sentence Embeddings + +We evaluate T5 sentence embeddings without finetuning using the extraction strategies from section 3.1: (i) Encoder-only first token, (ii) Encoder-only mean, and (iii) Encoder-decoder start token. + +Transfer tasks Results for ST5 models using raw embeddings on transfer tasks are shown in rows 3-5 of Table 2. Unlike BERT, T5's first token is not reserved as a special placeholder (i.e., CLS) + +
ModelFine-tune dataMRCRSUBJMPQASSTTRECMRPCAvg
BERT (CLS-vector)N/A78.6884.8594.2188.2384.1391.471.1384.66
BERT (mean)♣N/A78.6686.2594.3788.6684.4092.8069.4584.94
ST5-Enc firstN/A76.9086.3890.9388.6880.0194.4066.3883.38
ST5-Enc meanN/A86.5691.3196.0190.5790.7794.6072.9388.96
ST5-EncDec firstN/A79.9677.9391.0284.6686.2784.0068.0081.69
SBERT-NLI♣NLI83.6489.4394.3989.8688.9689.6076.0087.41
SimCSE-BERT♣NLI82.6989.2594.8189.5987.3188.4073.5186.51
SimCSE-RoBERTa♣NLI84.9292.0094.1189.8291.2788.8075.6588.08
ST5-Enc meanNLI86.1791.7194.7090.9090.4490.0076.7088.66
ST5-EncDec firstNLI86.2291.6094.0590.9390.7292.6076.0688.88
ST5-Enc meanCQA+NLI85.7592.0894.5890.9591.7696.4075.1989.53
ST5-Enc-1.1 meanCQA+NLI86.1292.5094.7390.5992.1595.8076.5289.77
+ +Table 2: Performance on transfer tasks on the SentEval benchmark. All models are using the Base architecture. $\clubsuit$ results are from (Gao et al., 2021). For all tasks, a logistic regression classifier is trained using the sentence embeddings as features and the classification accuracy on test sets are reported. + +
ModelFine-tune dataSTS12STS13STS14STS15STS16STSbSICK-RAvg
BERT (CLS-vector)N/A20.1630.0120.0936.8838.0816.5042.6329.19
BERT (mean)N/A38.7857.9857.9863.1561.0646.3558.4054.81
ST5-Enc firstN/A17.506.35-20.702.2921.8716.7128.6010.37
ST5-Enc meanN/A37.7856.8349.3765.4864.6857.5160.1155.97
ST5-EncDec firstN/A10.9129.5914.9028.9130.619.4539.3123.38
SBERT-NLINLI70.9776.5373.1979.0974.3077.0372.9174.89
SimCSE-BERTNLI75.3084.6780.1985.4080.8284.2580.3981.57
SimCSE-RoBERTaNLI76.5385.2180.9586.0382.5785.8380.5082.52
ST5-Enc meanNLI77.3783.6580.4186.0481.7084.4979.7981.92
ST5-EncDec firstNLI77.9085.6282.2486.8182.1384.9879.9782.81
ST5-Enc meanCQA+NLI78.0585.8482.1987.4684.0386.0479.7583.34
ST5-Enc-1.1 meanCQA+NLI77.5885.1281.4687.1482.8985.8280.1882.88
+ +Table 3: Spearman's correlation coefficient $(\times 100)$ on STS tasks on the SentEval benchmark. All models are using the Base architecture. $\clubsuit$ results are from (Gao et al., 2021). + +and there are no specific pre-training tasks using the first token's embeddings. It is unlikely that without additional fine-tuning the first token's representation would capture the semantics of the whole sentence. Indeed, our experiments show the first token's representation from encoder or decoder are much worse on all SentEval tasks compared to the mean pooling of the encoder-only model. + +Mean pooled T5 encoder embeddings greatly outperform mean pooled BERT embeddings. Moreover, even without fine-tuning, mean pooled T5 encoder embeddings outperform the prior best model, SimCSE-RoBERTa (Gao et al., 2021), on transfer learning even though SimCSE-RoBERTa benefited from contrastive fine-tuning on NLI. + +The strong performance of ST5 may be due to the fact that T5 is trained on more data than BERT or RoBERTa. Additionally, the original T5 models also include downstream tasks (e.g., GLUE, SuperGLUE) during pre-training, and this multi-task setting may improve transfer performance. However, we note that there are only two SentEval tasks + +(SST and MRPC) included in GLUE while the other five tasks are not. As shown in Table 2, we observe significant improvements on the five tasks that are not included. + +STS tasks As shown in rows 3-5 of Table 3 and similar to prior work involving BERT and RoBERTA (Ethayarajh, 2019; Gao et al., 2021), mean pooling of T5 embeddings performs poorly on STS, achieving an average correlation of 55.97. While slightly better than BERT using mean pooling, this is still worse than sentence embedding models that have been fine-tuned on supervised tasks such as Sentence-BERT and SimCSE. + +# 6.2 Fine-Tuning T5 Sentence Embeddings + +We next evaluate ST5 models that are fine-tuned on CQA and NLI tasks using our contrastive loss. + +Fine-tuning on NLI Given that mean pooling performs much better than the first token output representation from encoder only T5, we opt to discard the first token T5 model for our fine-tuning + +experiments. The last three rows of Table 2 show that the transfer performance of ST5 models is very consistent across different embedding extracting strategies after fine-tuning. The best fine-tuned model is 0.57 better than the best raw T5 sentence embeddings. In Table 3, we see that fine-tuning on NLI data significantly improves the STS task performance of ST5. + +Fine-tuning on CQA + NLI To investigate the impact of additional training data on contrastive learning, we experiment with the ST5 models first trained on CQA and then fine-tuned on NLI. As shown in Tables 2 and 3, fine-tuning on an additional dataset brings a large performance boost for both transfer and STS tasks. This suggests that we may be able to improve sentence embedding quality further through the mining of additional semi-structured data for continued contrastive learning. + +To exclude the effect of mixing in downstream tasks, we also trained a ST5 variant based on the T5 1.1 model which was only pre-trained on the C4 dataset (Raffel et al., 2020). As shown on the last row of Table 2 and Table 3, it achieves comparable performance to the original T5 model, outperforming on most tasks but under-performing on STS. + +# 6.3 Encoder-only vs. Encoder-decoder + +In this section, we compare the performance of two architectures: encoder-only and encoder-decoder. + +Better generalizability for T5's encoder In Table 2, we saw that the encoder-only Base model performs on-par with the encoder-decoder model on transfer tasks. When we scale the ST5 model up from Base to Large, 3B and 11B, the encoder-only models' performance on transfer tasks consistently outperforms the encoder-decoder models as shown in Table 5. This shows that building ST5 on top of the T5's encoder gives strong transfer performance. + +Recently, Chung et al. (2021) have shown that larger output embeddings (i.e. larger embedding size) effectively prevent the encoder from overspecializing to the pre-training task, thus making the encoder's representations more general and more transferable. We hypothesize that the decoder in the encoder-decoder architecture can improve the generalizability of the encoder's representation in a similar fashion, as the decoder focuses on optimizing for specific tasks. + +Effectiveness of the decoder In the last two rows of Table 3, we observe that the encoder + +
# of params +ModelBaseLarge3B11B
ST5-Enc110M335M1.24B4.8B
ST5-EncDec220M770M3B11B
+ +Table 4: Number of parameters for different models. + +decoder architecture outperforms encoder-only models for all STS tasks. As we scale up the ST5 model, we also observe improvement on STS tasks. As shown in Table 5, the ST5 encoder-decoder Large model outperforms the state-of-the-art model SimCSE-RoBERTa Large, improving the Spearman's correlation score from 83.76 to 84.11. + +One explanation is that the additional parameters from the decoder are helpful for improving performance on textual similarity tasks. Another possibility is that the decoder architecture itself helps to improve the sentence embedding quality. As shown in Figure 2d, the decoder can be considered as an additional attention pooling layer on top of the encoder outputs. + +# 7 Scaling up T5 + +We leverage the existing checkpoints from large T5 models to study the effect of scaling sentence encoders. The parameters of the T5 models are listed in Table 4. Note however that ST5-EncDec doesn't fully leverage the model parameters; the decoder's learned self-attention is effectively ignored as only the start token is fed into the decoder. + +# 7.1 Effect on Directly Using T5 Embeddings + +As shown in Table 5, the performance on the transfer tasks of directly using T5 embeddings consistently improves as T5 scales up. This corroborates that large pre-trained models can improve transfer performance of sentence embeddings. + +On the other hand, increasing the model capacity alone is not enough to achieve good performance. Even the embeddings from the T5 11B model still do worse on STS tasks than the fine-tuned models. We believe that the pre-training corruption task of T5 does not require models to avoid anisotropy. This highlights the importance of choosing finetuning tasks for sentence embedding models that are aligned to the goal of similarity and/or retrieval performance. + +
ModelFine-tune dataMRCRSUBJMPQASSTTRECMRPCAvg
ST5-Enc mean (Large)N/A89.1392.6997.0690.7092.9293.6073.7489.98
ST5-Enc mean (3B)N/A90.3592.7797.4390.1593.8595.6072.7090.41
ST5-Enc mean (11B)N/A91.1593.3397.5590.2094.0794.4074.2690.71
SBERT-NLI Large♣NLI84.8890.0794.5290.3390.6687.4075.9487.69
SimCSE-RoBERTa Large♣NLI88.1292.3795.1190.4992.7591.8076.6489.61
ST5-Enc mean (Large)NLI88.8293.4395.7391.7593.0894.0076.3590.45
ST5-EncDec first (Large)NLI87.6392.8594.3291.3791.9893.0076.9989.73
ST5-Enc mean (3B)NLI89.9293.2796.1991.5494.1894.2076.8790.88
ST5-EncDec first (3B)NLI87.8392.8594.7591.0193.1493.6078.2690.21
ST5-Enc mean (11B)NLI90.1393.8596.0291.3993.9695.2076.9991.08
ST5-EncDec first (11B)NLI90.0093.9495.0191.5393.8592.2076.7090.46
ST5-Enc mean (Large)CQA+NLI88.8993.4695.3891.5094.2396.2077.1090.97
ST5-Enc mean (3B)CQA+NLI89.9494.0995.8591.5894.8496.2077.8691.48
ST5-Enc mean (11B)CQA+NLI90.8394.4496.3391.6894.8495.4077.9191.63
ModelFine-tune dataSTS12STS13STS14STS15STS16STSbSICK-RAvg
ST5-Enc mean (Large)N/A28.0152.6041.3561.2863.5856.3159.4851.80
ST5-Enc mean (3B)N/A24.8951.4941.0961.3764.5152.5759.9950.85
ST5-Enc mean (11B)N/A34.9760.1947.5966.4070.6262.8363.5758.02
SBERT-NLI Large♣NLI72.2778.4674.9080.9976.2579.2373.7576.55
SimCSE-RoBERTa Large♣NLI77.4687.2782.3686.6683.9386.7081.9583.76
ST5-Enc mean (Large)NLI76.5285.7581.0187.1383.2685.4579.8582.71
ST5-EncDec first (Large)NLI79.1587.4283.6187.6483.9286.3580.6484.11
ST5-Enc mean (3B)NLI77.1386.7382.5387.3684.5185.7181.3983.62
ST5-EncDec first (3B)NLI79.2487.8083.9587.7584.6086.6280.9184.41
ST5-Enc mean (11B)NLI77.4287.5082.5187.4784.8885.6180.7783.74
ST5-EncDec first (11B)NLI80.1188.7884.3388.3685.5586.8280.6084.94
ST5-Enc mean (Large)CQA+NLI79.1087.3283.1788.2784.3686.7379.8484.11
ST5-Enc mean (3B)CQA+NLI79.0288.8084.3388.8985.3186.2579.5184.59
ST5-Enc mean (11B)CQA+NLI80.1088.7584.7088.8685.1786.7780.3984.96
+ +Table 5: Comparison of model performance on the SentEval benchmark when scaling up model size. $\clubsuit$ results are from (Gao et al., 2021). The first set of results are for transfer tasks, while the second set are for the similarity task. + +# 7.2 Scaling Up Improves Fine-tuning + +As shown in Table 5, we find that scaling up model capacity leads to consistently better performance on all downstream tasks. For the ST5 11B model, the encoder-only model achieves an average score of 91.08 for transfer tasks which is better than 90.45 from the ST5 Large model; while the encoder-decoder model pushes the STS score to 84.94 and also outperforms the ST5 Large model. For STS tasks, we observe that the gain from increasing model size from 3B to 11B is smaller than that from Large to 3B. This might be due to the fact that the embedding sizes are fixed for all models in our experiments. One potential exploration is to increase the sentence embedding size for larger models to fully leverage the model capacity. + +# 7.2.1 Alignment and Uniformity + +We further investigate the quality of the sentence embeddings by measuring aggregate distance metrics in the learned geometric space. In particular, we compute the alignment loss and uniformity loss + +as defined in Wang and Isola (2020): + +$$ +\mathcal {L} _ {\text {a l i g n}} = - \underset {v, v ^ {+} \sim p _ {p o s}} {\mathbb {E}} \| f (v) - f \left(v ^ {+}\right) \| \tag {3} +$$ + +$$ +\mathcal {L} _ {\text {u n i f o r m}} = \log \underset {v, w \stackrel {\text {i . d .}} {\sim} p _ {\text {d a t a}}} {\mathbb {E}} e ^ {- 2 \| f (v) - f (w) \|}, \tag {4} +$$ + +Above, $p_{pos}$ is all positive data and $p_{data}$ is the data distribution. $\mathcal{L}_{\mathrm{align}}$ denotes the expected distance between embeddings of the positive pairs, while $\mathcal{L}_{\mathrm{uniform}}$ indicates how uniformly the embeddings are distributed. + +For both losses, lower numbers indicate better performance. Gao et al. (2021) has shown that models with lower numbers for these two aggregate metrics tend to have better performance on downstream tasks. As shown in Figure 4, when models scale up, both the encoder and encoder-decoder models decrease the uniformity loss by a large marge meanwhile only slightly increasing the alignment loss. This indicates that scaling up might help the sentence embeddings to spread out more uniformly in the space while keeping semantically similar pairs clustered together. We leave the further exploration of the connection between + +
ModelSent. Embed. Fine-tuningScoreCoLASST-2MRPCSTS-BQQPMNLI-mMNLI-mmQNLIRTE
InferSent (Wang et al., 2018)NLI66.718.6083.9076.5080.2081.7067.80-63.5071.50
SBERT (RoBERTa Base)NLI73.4021.2290.8373.3474.0880.7577.2178.1373.9257.76
SBERT (RoBERTa Large)NLI75.8120.6993.0073.3976.2682.2679.4680.1875.8060.65
SimCSE (RoBERTa Base)NLI77.0535.8790.7176.4783.9381.3970.7472.0576.3060.29
SimCSE (RoBERTa Large)NLI76.2340.1193.2370.2381.4584.4573.4473.5675.9560.65
ST5 Enc (Base)CQA+NLI76.8922.7391.4076.8886.5884.5569.7370.0079.5461.73
ST5 Enc (Large)CQA+NLI78.5229.4693.9277.2686.0785.3272.2072.4479.6466.43
ST5 Enc (3B)CQA+NLI79.0634.7894.9578.7185.8485.7872.3873.1079.7066.06
ST5 Enc (11B)CQA+NLI80.0743.9195.3078.4686.5486.2173.4674.4280.1266.06
ST5 Enc 1.1 (Base)CQA+NLI76.6321.5990.6076.6686.3484.5370.4070.7677.9261.01
T5 (Base) (Raffel et al., 2020)-83.4053.8492.6888.9288.0291.5684.2484.5790.4876.28
+ +Table 6: Performance on transfer tasks on the Dev set of the GLUE benchmark. $\clubsuit$ denotes that the models are released by HuggingFace. T5 (base) is a cross-attention model and other models are embedding based. + +![](images/88beed6321d6e91dd3c3b74505227a045044925d1cf03be828026e5851c1bf5b.jpg) +Figure 4: Alignment and uniformity losses for different model sizes. We consider the test split of the STS-B dataset. $\mathcal{L}_{\mathrm{align}}$ is calculated considering all pairs with score greater than 4. $\mathcal{L}_{\mathrm{uniform}}$ is computed using all sentences. The colormap denotes the models' Spearman's correlation score. + +model capacity and the geometry characteristics of resulting sentence embeddings to future work. + +# 8 SentGLUE Evaluation + +In this section, we introduce a new sentence representation transfer benchmark - SentGLUE - which extends the sentence evaluation toolkit, SentEval, to nine tasks from the GLUE benchmark including: CoLA, SST-2, MRPC, STS-B, QQP, MNLI-m, MNLI-mm, QNLI, RTE $^{10}$ . The GLUE benchmark has been widely adopted for assessing language understanding models. GLUE tasks are either single sentence or sentence pair classification (e.g. NLI) or similarity (STS) tasks. The best models on the GLUE leaderboard are fine-tuned cross-attention models like BERT or T5. Such models change all the parameters in the underlying model during fine-tuning and for pairwise tasks they allow for early fusion of input features from both sentences being + +compared. For SentGLUE, we introduce the constraint that each input needs to be independently encoded into a fixed embedding space representation that can then be feed to additional layers in order to make a prediction. We believe this best adapts the spirit of the original SentEval benchmark for sentence embeddings to the GLUE tasks. + +From Table 6, ST5-Enc Base outperforms both SBERT-RoBERTa Base and SimCSE-RoBERTa Base on all SentGLUE tasks except CoLA and MNLI. With the model's increased capacity, ST5 Enc 11B's sentence embeddings achieve the best overall performance. Notably, as model size is scaled up, aggregate performance using sentence embeddings approaches that of T5 base. This is remarkable given that T5 base makes use of full crossattention between sentence pairs and adjusts all of the parameters in the model during fine-tuning. + +# 9 Conclusion + +We obtaining sentence embeddings from T5, investigating three architectures and two-stage contrastive learning for fine-tuning our representations. We compare the difference between encoder-only and encoder-decoder methods and analyze their performance on downstream tasks. Through extensive experiments on STS, SentEval and GLUE tasks, we show that encoder-only models have strong transfer performance while encoder-decoder models perform better on STS tasks. We demonstrate the effectiveness of scaling up T5 models, greatly improving sentence embedding quality. These findings suggest that future improvements in the scale and quality of pre-trained T5 models may provide further sentence embeddings improvements. + +# Acknowledgments + +We thank the anonymous reviewers for their helpful comments. We thank Zora Tung, Daniel Andor, Adam Roberts, Hyung Won Chung, Anselm Levskaya and Livio Baldini Soares for help with the JAX implementation, and Alexis Conneau and Chris Tar for feedback and suggestions. + +# References + +Eneko Agirre, Carmen Banea, Claire Cardie, Daniel Cer, Mona Diab, Aitor Gonzalez-Agirre, Weiwei Guo, Inigo Lopez-Gazpio, Montse Maritxalar, Rada Mihalcea, German Rigau, Larritz Uria, and Janyce Wiebe. 2015. SemEval-2015 task 2: Semantic textual similarity, English, Spanish and pilot on interpretability. In SemEval 2015. +Eneko Agirre, Carmen Banea, Claire Cardie, Daniel Cer, Mona Diab, Aitor Gonzalez-Agirre, Weiwei Guo, Rada Mihalcea, German Rigau, and Janyce Wiebe. 2014. SemEval-2014 task 10: Multilingual semantic textual similarity. In SemEval 2014. +Eneko Agirre, Carmen Banea, Daniel Cer, Mona Diab, Aitor Gonzalez-Agirre, Rada Mihalcea, German Rigau, and Janyce Wiebe. 2016. SemEval-2016 task 1: Semantic textual similarity, monolingual and cross-lingual evaluation. In SemEval-2016. +Eneko Agirre, Daniel Cer, Mona Diab, and Aitor Gonzalez-Agirre. 2012. SemEval-2012 task 6: A pilot on semantic textual similarity. In *SEM 2012/Se-mEval 2012*. +Eneko Agirre, Daniel Cer, Mona Diab, Aitor Gonzalez-Agirre, and Weiwei Guo. 2013. *SEM 2013 shared task: Semantic textual similarity. In *SEM.* +Samuel R. Bowman, Gabor Angeli, Christopher Potts, and Christopher D. Manning. 2015. A large annotated corpus for learning natural language inference. In EMNLP. +Daniel Matthew Cer, Mona T. Diab, Eneko Agirre, I. Lopez-Gazpio, and Lucia Specia. 2017. Semeval-2017 task 1: Semantic textual similarity multilingual and crosslingual focused evaluation. In SemEval-2016. +Daniel Matthew Cer, Yinfei Yang, Sheng yi Kong, Nan Hua, Nicole Limtiaco, Rhomni St. John, Noah Constant, Mario Guajardo-Cespedes, Steve Yuan, C. Tar, Yun-Hsuan Sung, B. Strope, and R. Kurzweil. 2018. Universal sentence encoder. In EMNLP. +Hyung Won Chung, Thibault Fevry, Henry Tsai, Melvin Johnson, and Sebastian Ruder. 2021. Rethinking embedding coupling in pre-trained language models. In ICLR. + +Alexis Conneau and Douwe Kiela. 2018. Senteval: An evaluation toolkit for universal sentence representations. In LREC. +Alexis Conneau, Douwe Kiela, Holger Schwenk, Loic Barrault, and Antoine Bordes. 2017. Supervised learning of universal sentence representations from natural language inference data. In EMNLP. +Kawin Ethayarajh. 2019. How contextual are contextualized word representations? comparing the geometry of bert, elmo, and gpt-2 embeddings. In EMNLP. +W. Fedus, Barret Zoph, and Noam M. Shazeer. 2021. Switch transformers: Scaling to trillion parameter models with simple and efficient sparsity. *ArXiv*, abs/2101.03961. +Fangxiaoyu Feng, Yinfei Yang, Daniel Cer, Naveen Arivazhagan, and Wei Wang. 2020. Language-agnostic BERT sentence embedding. CoRR, abs/2007.01852. +Tianyu Gao, Xingcheng Yao, and Danqi Chen. 2021. Simcse: Simple contrastive learning of sentence embeddings. ArXiv, abs/2104.08821. +D. Gillick, A. Presta, and Gaurav Singh Tomar. 2018. End-to-end retrieval in continuous space. *ArXiv*, abs/1811.08008. +Matthew Henderson, Rami Al-Rfou, B. Strope, Yun-Hsuan Sung, Laszlo Lukacs, Ruiqi Guo, Sanjiv Kumar, Balint Miklos, and R. Kurzweil. 2017. Efficient natural language response suggestion for smart reply. ArXiv, abs/1705.00652. +Ryan Kiros, Yukun Zhu, R. Salakhutdinov, R. Zemel, R. Urtasun, A. Torralba, and S. Fidler. 2015. Skipl thought vectors. In NIPS. +Lajanugen Logeswaran and Honglak Lee. 2018. An efficient framework for learning sentence representations. In ICLR. +Colin Raffel, Noam M. Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, W. Li, and Peter J. Liu. 2020. Exploring the limits of transfer learning with a unified text-to-text transformer. JMLR, 21/140. +Nils Reimers and Iryna Gurevych. 2019. Sentence-bert: Sentence embeddings using siamese bert-networks. In EMNLP/IJCNLP. +Nils Reimers and Iryna Gurevych. 2020. Making monolingual sentence embeddings multilingual using knowledge distillation. In EMNLP. +Noam M. Shazeer and Mitchell Stern. 2018. Adafactor: Adaptive learning rates with sublinear memory cost. In ICML. +Alex Wang, Yada Pruksachatkun, Nikita Nangia, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. 2019. Superglue: A stickier benchmark for general-purpose language understanding systems. In NeurIPS. + +Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. 2018. Glue: A multi-task benchmark and analysis platform for natural language understanding. In Black-boxNLP@EMNLP. +Tongzhou Wang and Phillip Isola. 2020. Understanding contrastive representation learning through alignment and uniformity on the hypersphere. In ICML. +John Wieting, Mohit Bansal, Kevin Gimpel, and Karen Livescu. 2016. Towards universal paraphrastic sentence embeddings. CoRR, abs/1511.08198. +Adina Williams, Nikita Nangia, and Samuel R Bowman. 2017. A broad-coverage challenge corpus for sentence understanding through inference. arXiv preprint arXiv:1704.05426. +Yinfei Yang, Daniel Matthew Cer, Amin Ahmad, Mandy Guo, Jax Law, Noah Constant, G. Ábrego, Steve Yuan, C. Tar, Yun-Hsuan Sung, B. Strope, and R. Kurzweil. 2020. Multilingual universal sentence encoder for semantic retrieval. In ACL. +Yinfei Yang, Steve Yuan, Daniel Matthew Cer, Sheng yi Kong, Noah Constant, Petr Pilar, Heming Ge, Yun-Hsuan Sung, B. Strope, and R. Kurzweil. 2018. Learning semantic textual similarity from conversations. In Rep4NLP@ACL. + +# A Model Inference + +We run ST5 encoder-only on different platforms to investigate the computational cost of inference. Figure 5 summarizes the inference speed for different model sizes, sequence length, batch size and platforms. ST5 achieves the fastest inference speed on Cloud TPU-v3. As we increase the batch size, the inference speed can be further improved. For the 11B model, we are able to achieve a speed of 274 examples per second for sequence length 128 and batch size 1024. This shows the feasibility of deploying such large models on TPU hardware. + +We also report the speed on Nvidia Tesla V100 GPU and CPU. The ST5 11B model is able to run on 4 V100 GPUs with sequence length 128 and batch size 1024, achieving an inference speed of 27 examples per second. For CPU, with batch size 512, ST5 11B achieves 0.5 examples per second. + +Although the speed on GPU and CPU are considerably slower than on TPU, the sentence embedding models are much faster than cross-attention based models whose computation time increases quadratically with the number of examples (e.g., clustering 1,000 sentences requires inference over 1 million sentence pairs). + +![](images/cbe6fb7f37cf2b8f8b44943bea7795f8730a03b590a0dd00c3d246720f34f6a7.jpg) + +![](images/7feb7b375837c490a18a0fe9ee9e751aa37947ffa4c47c463321cbb72ef6ca74.jpg) + +![](images/485b70ee7d6591170b40874ccc1fb1b555e06be8496ea5f30500cf3eb8fd235e.jpg) + +![](images/84ae8445fba73ed21b2f110a1cf958fd3324ffe23d3f9f313d17b387e34ce3b2.jpg) + +![](images/6d159d21d682b35adadd4f3ddae3f43db779628aff44657486c54251f8e6c367.jpg) + +![](images/b1c6b039db5ec18a412cbe0cfc6d05f573aaf8ae38d060453959cd70050b81d5.jpg) +(a) TPU inference speed vs. sequence length. + +![](images/753edb3782fc5458a5dbf05396c020da94b8c394641f5d1cd764c2bd85acee3e.jpg) + +![](images/477b843dc8a5fe1bd7aea5f5cb124ec1dc94dcb0bc522fc3c1c025b8db8718a9.jpg) + +![](images/3922fd74c2728532e50cae974a72d6fd7204fdbe8acec579d344e0310ad30c23.jpg) +Figure 5: Comparison of inference speed for different model sizes on different platforms. + +![](images/5e00fbcf5174f4990d7d19ac4d23c35a7a503f57951afc5292d17ec0ed102211.jpg) +(b) GPU inference speed vs. sequence length. + +![](images/6a5ed971fcf95e98e7d60cb62b58dc4113f9a11008453b0e3d6f3d7eef06e37f.jpg) +(c) CPU inference speed vs. sequence length. + +![](images/d965d1c8895ffcc3c07c9ebfb819f0aa555ffae9a1ab8b1f9c0ece952da4dd35.jpg) \ No newline at end of file diff --git a/sentencet5scalablesentenceencodersfrompretrainedtexttotextmodels/images.zip b/sentencet5scalablesentenceencodersfrompretrainedtexttotextmodels/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..e163265c604c420d0a498bef986505fb98ab832a --- /dev/null +++ b/sentencet5scalablesentenceencodersfrompretrainedtexttotextmodels/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:383cdb9a46e45dc39330b5af8f0441186f5a1a8013d07cae0d4184e82dd42b9f +size 788105 diff --git a/sentencet5scalablesentenceencodersfrompretrainedtexttotextmodels/layout.json b/sentencet5scalablesentenceencodersfrompretrainedtexttotextmodels/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..42010ab7e49e8a4905ac3f04e4137c3ddb2e07d0 --- /dev/null +++ b/sentencet5scalablesentenceencodersfrompretrainedtexttotextmodels/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c1e2b190753dc7f2898bcee25f998b5e59b5429be6ced36e914605ad6473fe82 +size 333623 diff --git a/sentimentwordawaremultimodalrefinementformultimodalsentimentanalysiswithasrerrors/9b50b561-884c-4cfc-b6ec-ec2222408144_content_list.json b/sentimentwordawaremultimodalrefinementformultimodalsentimentanalysiswithasrerrors/9b50b561-884c-4cfc-b6ec-ec2222408144_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..823f33a9e62bf421ff8eb25dfa3bc8e753a20ab4 --- /dev/null +++ b/sentimentwordawaremultimodalrefinementformultimodalsentimentanalysiswithasrerrors/9b50b561-884c-4cfc-b6ec-ec2222408144_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:209522fd307abc6a588bf80a98405c2ef098db97c96b8e54105208b9c3a87a9a +size 73795 diff --git a/sentimentwordawaremultimodalrefinementformultimodalsentimentanalysiswithasrerrors/9b50b561-884c-4cfc-b6ec-ec2222408144_model.json b/sentimentwordawaremultimodalrefinementformultimodalsentimentanalysiswithasrerrors/9b50b561-884c-4cfc-b6ec-ec2222408144_model.json new file mode 100644 index 0000000000000000000000000000000000000000..f87a99a47e583a6e601cf1cd5f8d89c35289655d --- /dev/null +++ b/sentimentwordawaremultimodalrefinementformultimodalsentimentanalysiswithasrerrors/9b50b561-884c-4cfc-b6ec-ec2222408144_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f599be57e1fe4bb19af8ab7be841f32ebca4322070cc024f7857448d32f95865 +size 82682 diff --git a/sentimentwordawaremultimodalrefinementformultimodalsentimentanalysiswithasrerrors/9b50b561-884c-4cfc-b6ec-ec2222408144_origin.pdf b/sentimentwordawaremultimodalrefinementformultimodalsentimentanalysiswithasrerrors/9b50b561-884c-4cfc-b6ec-ec2222408144_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..8de695f13de381e8249f76b747a8ead35811a1a6 --- /dev/null +++ b/sentimentwordawaremultimodalrefinementformultimodalsentimentanalysiswithasrerrors/9b50b561-884c-4cfc-b6ec-ec2222408144_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:03aec2f36ed22ed6f8eced96984e037f7609e3a033ef938c161cabf9c30abbb5 +size 6725262 diff --git a/sentimentwordawaremultimodalrefinementformultimodalsentimentanalysiswithasrerrors/full.md b/sentimentwordawaremultimodalrefinementformultimodalsentimentanalysiswithasrerrors/full.md new file mode 100644 index 0000000000000000000000000000000000000000..9d15959dd808ebd14f607a63f709a4433ad2f9d7 --- /dev/null +++ b/sentimentwordawaremultimodalrefinementformultimodalsentimentanalysiswithasrerrors/full.md @@ -0,0 +1,300 @@ +# Sentiment Word Aware Multimodal Refinement for Multimodal Sentiment Analysis with ASR Errors + +Yang Wu $^{1}$ Yanyan Zhao $^{1*}$ Hao Yang $^{1}$ Song Chen $^{1}$ Bing Qin $^{1}$ Xiaohuan Cao $^{2}$ Wenting Zhao $^{2}$ + +$^{1}$ Harbin Institute of Technology $^{2}$ AI Lab of China Merchants Bank + +$^{1}\{ywu, yyzhao, hyang, songchen, qinb\} @ir.hit.edu.cn$ ${ }^{2}\{xhcao, wtzhao\} @cmbchina.com$ + +# Abstract + +Multimodal sentiment analysis has attracted increasing attention and lots of models have been proposed. However, the performance of the state-of-the-art models decreases sharply when they are deployed in the real world. We find that the main reason is that real-world applications can only access the text outputs by the automatic speech recognition (ASR) models, which may be with errors because of the limitation of model capacity. Through further analysis of the ASR outputs, we find that in some cases the sentiment words, the key sentiment elements in the textual modality, are recognized as other words, which makes the sentiment of the text change and hurts the performance of multimodal sentiment analysis models directly. To address this problem, we propose the sentiment word aware multimodal refinement model (SWRM), which can dynamically refine the erroneous sentiment words by leveraging multimodal sentiment clues. Specifically, we first use the sentiment word position detection module to obtain the most possible position of the sentiment word in the text and then utilize the multimodal sentiment word refinement module to dynamically refine the sentiment word embeddings. The refined embeddings are taken as the textual inputs of the multimodal feature fusion module to predict the sentiment labels. We conduct extensive experiments on the real-world datasets including MOSI-Speechbrain, MOSI-IBM, and MOSI-iFlytek and the results demonstrate the effectiveness of our model, which surpasses the current state-of-the-art models on three datasets. Furthermore, our approach can be adapted for other multimodal feature fusion models easily1. + +# 1 Introduction + +Multimodal sentiment analysis (MSA) has been an emerging research field for its potential applications in human-computer interaction. How to + +
DatasetsMAE ↓
MOSI-Gold72.49
MOSI-SpeechBrain90.95(↑18.46)
MOSI-IBM85.65(↑13.16)
MOSI-iFlytek78.79(↑6.30)
+ +(a) Results of the Self-MM model on the real-world datasets. SpeechBrain, IBM, and iFlytek are three ASR APIs we adopted. + +
Gold: +And I was really upset about it +ASR: +And I was really set about itDatasetsPercentages
MOSI-SpeechBrain26.5%
MOSI-IBM17.6%
MOSI-iFlytek10.6%
+ +(b) An example of the sentiment word substitution error and the percentages of it on the datasets. + +![](images/854f9fe03ffd9920589ba13d7fa02267459f31f20e69db7fd8461b930951bd42.jpg) +Figure 1: Illustration of our motivation. + +(c) Our approach to reduce the negative impact of the sentiment word substitution error on the MSA models. + +effectively fuse multimodal information including textual, acoustic, and visual to predict the sentiment is a very challenging problem and has been addressed by many previous studies. Some works focus on introducing additional information into the fusing model, such as the alignment information between different modal features (Wu et al., 2021) and unimodal sentiment labels (Yu et al., 2021). And other works consider the semantic gaps between multimodal data and adopt the adversarial learning (Mai et al., 2020) and multi-task learning (Hazarika et al., 2020) to map different modal features into a shared subspace. + +Despite the apparent success of the current state + +of-the-art models, their performance decreases sharply, when deployed in the real world. The reason is that the input texts are provided by the ASR models, which usually are with errors because of the limitation of model capacity. To further analyze this problem, we build three real-world multimodal sentiment analysis datasets based on the existing dataset, CMU-MOSI(Zadeh et al., 2016). Specifically, we adopt three widely used ASR APIs including SpeechBrain, IBM, and iFlytek to process the original audios and obtain the recognized texts. Then, we replace the gold texts in CMU-MOSI with the ASR results and get three real-world datasets, namely MOSI-SpeechBrain, MOSI-IBM, and MOSI-iFlytek. We evaluate the current state-of-the-art model, Self-MM(Yu et al., 2021), and report the mean absolute error (MAE) on the multimodal sentiment analysis task. As we can see in Figure 1(a), when the model is deployed in the real world, there is an obvious drop in model performance. + +The further in-depth analysis of ASR errors shows that the sentiment word substitution error can hurt the MSA model directly. The reason is that the sentiment words in the text are the most important clues in the textual modality for detecting sentiment and incorrectly recognizing them could change the sentiment conveyed by the text. To have an intuitive understanding of the sentiment word substitution error, we take an example in Figure 1(b). The gold text is "And I was really upset about it", but the ASR model (SpeechBrain) recognizes the sentiment word "upset" wrongly as "set", which results in the change of the sentiment semantics of the text and directly affects the MSA model performance. We list the percentages of the sentiment word substitution error on the MOSI dataset for three ASR APIs in Figure 1(b). The percentage of the sentiment word substitution error on the MOSI-IBM is $17.6\%$ , which means about 17 of 100 utterances have this type of error. To further demonstrate the negative effect of the substitution error on the MSA models, we split the test data of MOSI-IBM into two groups by whether there is a substitution error. We evaluate Self-MM on the test data and observe that the misclassification rate of the group in which the substitution error exists is higher than the other group (29.9% vs 15.8%). This result indicates that the sentiment word substitution error could hurt the state-of-the-art MSA model. + +To tackle this problem, we propose the sentiment + +word aware multimodal refinement model, which can detect the positions of the sentiment words in the text and dynamically refine the word embeddings in the detected positions by incorporating multimodal clues. The basic idea of our approach is shown in Figure 1(c). We consider leveraging the multimodal sentiment information, namely the negative sentiment conveyed by the low voice and sad face, and textual context information to help the model reconstruct the sentiment semantics for the input embeddings. Specifically, we first use the sentiment word location module to detect the positions of sentiment words and meanwhile utilize the strong language model, BERT, to generate the candidate sentiment words. Then we propose the multimodal sentiment word refinement module to refine the word embeddings based on the multimodal context information. The refinement process consists of two parts, filtering and adding. We apply the multimodal gating network to filter out useless information from the input word embeddings in the filtering process and use the multimodal sentiment word attention network to leverage the useful information from candidate sentiment words as the supplement to the filtered word embeddings in the adding process. Finally, the refined sentiment word embeddings are used for multimodal feature fusion. + +We conduct extensive experiments on the MOSI-SpeechBrain, MOSI-IBM, and MOSI-iFlytek datasets to demonstrate the effectiveness of our proposed model. The experimental results show that: (1) There is an obvious performance drop for the state-of-the-art MSA model, when the model is deployed in the real world taking the ASR outputs as the input of textual modality; (2) Our proposed model outperforms all baselines, which can dynamically refine the sentiment word embeddings by leveraging multimodal information. + +The main contributions of this work are as follows: (1) We propose a novel sentiment word aware multimodal refinement model for multimodal sentiment analysis, which can dynamically reconstruct the sentiment semantics of the ASR texts with errors by utilizing the multimodal sentiment information resulting in more robust sentiment prediction; (2) We validate the negative effect of the sentiment word substitution error on the state-of-the-art MSA model through the in-depth analysis; (3) We evaluate our model on three real-world datasets, and the experimental results demonstrate that our model outperforms all baselines. + +# 2 Related Work + +Multimodal sentiment analysis has gained increasing attention from the community recently and some process has been made. In general, there are three findings presented by previous work. + +Performing the cross-modal alignment is helpful for multimodal feature fusion. Chen et al. (2017) considered that the holistic features mainly contain global information, which may fail to capture local information. Therefore, they applied the force-alignment to align the visual and acoustic features with the words and further obtained the word-level features. To effectively fuse them, they proposed the GME-LSTM(A) model, which consists of two modules, the gated multimodal embedding and the LSTM with the temporal attention. However, obtaining the word-level features needs to perform the force-alignment, which is time-consuming. To address it, Tsai et al. (2019) proposed the MulT model, which uses the cross-modal attention to align different modal features implicitly. Instead of performing the alignment in the time dimension, some works focusing on semantic alignment. Hazarika et al. (2020) considered that the semantic gaps between heterogeneous data could hurt the model performance and proposed the MISA model, which maps the different modal data into a shared space before multimodal feature fusion. Wu et al. (2021) first utilized the cross-modal prediction task to distinguish the shared and private semantics of non-textual modalities compared to the textual modality and then fuse them. The above works show that performing the cross-modal alignment is helpful for multimodal feature fusion. + +Training the MSA models in an end-to-end manner is more effective. Most of the previous studies adopt a two-phase pipeline, first extracting unimodal features and then fusing them. Dai et al. (2021) considered that it may lead to suboptimal performance since the extracted unimodal features are fixed and cannot be further improved benefiting from the downstream supervisory signals. Therefore, they proposed the multimodal end-to-end sparse model, which can optimize the unimodal feature extraction and multimodal feature fusion jointly. The experimental results on the multimodal emotion detection task show that training the models in an end-to-end manner can obtain better results than the pipeline models. + +Leveraging the unimodal sentiment labels to + +learn more informative unimodal representations is useful for multimodal feature fusion. Yu et al. (2020) considered that introducing the unimodal sentiment labels can help the model capture the unimodal sentiment information and model the difference between modalities. Motivated by it, they built the CH-SIMS dataset, which contains not only the multimodal sentiment labels but also unimodal sentiment labels. And based on it, they proposed a multi-task learning framework to leverage two types of sentiment labels simultaneously. However, this method needs unimodal labels, which is absent for most of the existing datasets. To address it, Yu et al. (2021) proposed the Self-MM model, which first generates the unimodal labels by utilizing the relationship between the unimodal and multimodal labels and then uses the multi-task learning to train the model. These two works both address the usefulness of introducing unimodal labels. + +However, even though lots of models are proposed and obtain promising results on the benchmark datasets, there are few works considering the noisy inputs when the MSA models are deployed in the real world. Chen et al. (2017) presented the Gated Multimodal Embedding to filter out the noises from the acoustic and visual data. Pham et al. (2019) considered that visual and acoustic data may be absent and proposed the MCTN model to handle it. Liang et al. (2019) and Mittal et al. (2020) also mainly focused on dealing with the noises introduced by the visual and acoustic data, and their models are based on the word-level features, which are obtained by aligning the audiios with the gold texts. There is only one work (Dumpala et al., 2018) considering that the texts are output by the ASR models, which may be erroneous. But this work does not study how do the ASR errors affect the MSA models and does not evaluate the SOTA MSA models on the datasets. Besides, the proposed model needs the gold texts when training, which is time-consuming and labor-consuming. + +Comparing to the above works, we evaluate the SOTA MSA models on the real-world datasets and observe that the performance of models decreases sharply because of the erroneous ASR texts. Through in-depth analysis of the ASR outputs, we find the sentiment word substitution error in the ASR texts could hurt the MSA models directly. To address it, we propose the sentiment word aware multimodal refinement model, which only uses the + +ASR texts in the training and testing phrases. + +# 3 Approach + +In this section, we describe the sentiment word aware multimodal refinement model in detail. An illustration of our proposed model is given in Figure 2. Our model consists of three modules including the sentiment word location module, multimodal sentiment word refinement module, and multimodal feature fusion module. We first use the sentiment word location module to detect the possible positions of sentiment words and then utilize the multimodal sentiment word refinement module to dynamically refine the word embeddings in the detected positions. Finally, the refined word embeddings are fed into the multimodal feature fusion module to predict the final sentiment labels. + +# 3.1 Sentiment Word Position Detection + +The core idea of the sentiment word position detection module is to find out the possible positions of sentiment words in the ASR texts. Note that, it is different from locating sentiment words depending on the word semantics, since the ASR models may recognize a sentiment word as a neutral word, which makes it hard to locate correctly. For example, given a gold text "And I was really upset about it", the ASR model recognizes it as "And I was really set about it". It is easy for the model to label the word "set" as a neutral word. Therefore, we choose to detect the position of the sentiment words instead of locating them. + +To achieve it, we consider adopting a powerful language model, since the language model can model the context information of the sentiment words such as syntactic and grammatical information and predict the appropriate words for the target position. Specifically, we choose the BERT model (Devlin et al., 2019) as our language model since the masked language modeling pretraining objective meets our needs perfectly. Given the sentence $\{w_{1}, w_{2}, \ldots, w_{n_{l}}\}$ , we first mask each word $w_{i}$ in the sentence sequentially, and in practice, we replace the word with the special word [MASK]. For example, we mask the first word in the sentence and obtain $\{[\mathrm{MASK}], w_{2}, \ldots, w_{n_{l}}\}$ . And then we use the BERT model to predict the possible words in the position of the masked word. We sort the predicted candidate words by the prediction probabilities and get the Top-k candidate words $C_{i} = \{c_{1}^{i}, c_{2}^{i}, \ldots, c_{k}^{i}\}$ . + +Next, we distinguish the sentiment words from the candidates using the sentiment lexicons (Hu and Liu, 2004; Wilson et al., 2005) and $k_{i}$ is the number of selected sentiment words corresponding to the position $i$ . The larger the number is, the more possible the position is. And we obtain the most possible position of sentiment word, $s = \arg \max (\{k_1,k_2,\dots ,k_{n_l}\})$ . Considering that in some cases there is not a sentiment word in the sentence, we use a sentiment threshold to filter out the impossible ones. In practice, we use the gate mask $p$ to record it, and $p$ is 1 if $k_{s}$ is larger than $k / 2$ and 0 otherwise. + +# 3.2 Multimodal Sentiment Word Refinement + +In order to reduce the negative effects of the ASR errors, we propose the multimodal sentiment word refinement module, in which we refine the word embeddings of sentiment words from two aspects. One is that we uses the multimodal gating network to filter out the useless information from the input word embeddings. The other one is that we design the multimodal sentiment attention network to incorporate the useful information from candidate words generated by the BERT model. + +Given an utterance, which includes three modal unaligned features, word embeddings, acoustic features, and visual features, we denote them as $\mathbf{x}^i = \{x_t^i:1\leq t\leq n_i,x_t^i\in \mathbb{R}^{d_x^i}\}$ $i\in \{l,v,a\}$ . To obtain the multimodal information corresponding to each word, We utilize the pseudo-alignment method to align the features. We split the the acoustic and visual features into non-overlapping feature groups, of which lengths are $\left\lfloor \frac{n_a}{n_l}\right\rfloor$ and $\left\lfloor \frac{n_v}{n_l}\right\rfloor$ respectively, and average the features in each group and obtain the aligned features, $\mathbf{u}^i = \{u_t^i:1\leq t\leq n_l,u_t^i\in \mathbb{R}^{d_x^i}\}$ , $i\in \{v,a\}$ . + +To obtain the context-aware representations, we apply the BERT model and LSTM networks to encode the features, producing $\mathbf{h}^i = \{h_t^i:1\leq t\leq n_l,h_t^i\in \mathbb{R}^{d_h^i}\}$ $i\in \{v,a,l\}$ . Besides, we also use an LSTM network to fuse the acoustic and visual features for capturing high-level sentiment semantics and obtain $\mathbf{h}^{va} = \{h_t^{va}:1\leq t\leq n_l,h_t^{va}\in \mathbb{R}^{d_h^{va}}\}$ . + +$$ +\mathbf {h} ^ {l} = \operatorname {B E R T} (\mathbf {x} ^ {1}) +$$ + +$$ +\begin{array}{l} \mathbf {h} ^ {v} = \mathrm {L S T M} _ {\mathrm {v}} (\mathbf {u} ^ {\mathrm {v}}) \\ \mathbf {h} ^ {a} = \mathrm {L S T M} _ {\mathrm {a}} (\mathbf {u} ^ {\mathrm {a}}) \end{array} \tag {1} +$$ + +$$ +\mathbf {h} ^ {v a} = \operatorname {L S T M} _ {\mathrm {v a}} ([ \mathbf {u} ^ {\mathrm {v}}; \mathbf {u} ^ {\mathrm {a}} ]) +$$ + +Subsequently, We propose the multimodal gating + +![](images/9f8c9026a3d1ee0707113b77f426d0790f3f675cb4d8b5ce800963bf268449ee.jpg) +Figure 2: Illustration of our proposed model. + +network to filter the word embedding, which is implemented by a non-linear layer. The motivation is that the ASR model may recognize incorrectly the sentiment word resulting in the corrupted sentiment semantics of the text. Therefore, we leverage the multimodal sentiment information to decide how much information of the input word embedding to pass. Specifically, we concatenate the unimodal context-aware representations, $\mathbf{h}_s^l$ , $\mathbf{h}_s^v$ , $\mathbf{h}_s^a$ , and bimodal representation $\mathbf{h}_s^{va}$ in the detected position $s$ and feed them into a non-linear neural network, producing the gate value $g^v$ . And then the gate value is used to filter out the useless information from the word embedding. To make the model ignore the impossible one, we use the gate mask $p$ to achieve it. + +$$ +g ^ {v} = \operatorname {S i g m o i d} \left(W _ {1} \left(\left[ \mathbf {h} _ {s} ^ {l}; \mathbf {h} _ {s} ^ {v}; \mathbf {h} _ {s} ^ {a}; \mathbf {h} _ {s} ^ {v a} \right]\right) + b _ {1}\right) \tag {2} +$$ + +$$ +r ^ {v} = (1 - g ^ {v} p) \mathbf {x} _ {s} ^ {l} +$$ + +where $W_{1}\in \mathbb{R}^{1\times \sum_{i\in \{l,v,a,va\}}d_{h}^{i}}$ $b_{1}\in \mathbb{R}^{1}$ are the parameters of the multimodal gating network. + +Furthermore, we propose a novel multimodal sentiment word attention network to leverage the sentiment-related information from the candidate words, more than half of which are sentiment + +words, generated by the BERT model to complement the word embeddings. For example, the ASR model recognizes the "upset" as "set", we first want to remove the useless information of "set" and then incorporate the information of negative sentiment words to reconstruct the original sentiment semantics. We use a linear layer to implement the multimodal sentiment word attention network. We first concatenate the word embedding $x^{c_t^s}$ of the candidate word $c_t^s$ and multimodal representations, $\mathbf{h}_s^v$ , $\mathbf{h}_s^a$ , and $\mathbf{h}_s^{va}$ at the most possible time step $s$ . Then, we pass them to the linear layer and obtain the attention score $g_t^e$ . The attention scores are fed into a softmax function to obtain the attention weights. Finally, we apply the weights to the candidate word embeddings and get the sentiment embedding $r^e$ . + +$$ +g _ {t} ^ {e} = W _ {2} ([ x ^ {c _ {t} ^ {s}}; \mathbf {h} _ {s} ^ {v}; \mathbf {h} _ {s} ^ {a}; \mathbf {h} _ {s} ^ {v a} ]) + b _ {2} +$$ + +$$ +w _ {t} ^ {e} = \frac {e ^ {g _ {t} ^ {e}}}{\sum_ {t = 1} ^ {k} e ^ {g _ {t} ^ {e}}} \tag {3} +$$ + +$$ +r ^ {e} = \sum_ {t = 1} ^ {k} w _ {t} ^ {e} x ^ {c _ {t} ^ {s}} +$$ + +where $W_{2}\in \mathbb{R}^{1\times (d_{x}^{l} + \sum_{i\in \{v,a,va\}}d_{h}^{i})}$ $b_{2}\in \mathbb{R}^{1}$ are the parameters of the multimodal sentiment word attention network. + +In addition, there may not be suitable words in the candidate words. Hence, we incorporate the embedding of the special word [MASK], $x^{mask}$ , to let the BERT model handle this problem based on the context. We then design an aggregation network to balance the contributions of the special word embedding $x^{mask}$ and the sentiment embedding $r^e$ . Finally, we add the $r^{add}$ to the filtered word embedding $u_s^l$ and obtain the refined word embedding $r_l$ for the target word. + +$$ +\begin{array}{l} g ^ {m a s k} = \operatorname {S i g m o i d} \left(W _ {3} \left(\left[ r ^ {e}; x ^ {m a s k} \right]\right) + b _ {3}\right) \\ r ^ {a d d} = g ^ {\text {m a s k}} r ^ {e} + (1 - g ^ {\text {m a s k}}) x ^ {\text {m a s k}} \tag {4} \\ r ^ {l} = (g ^ {v} p) r ^ {a d d} + r ^ {v} \\ \end{array} +$$ + +where $W_{3}\in \mathbb{R}^{1\times 2d_{x}^{l}}$ , $b_{3}\in \mathbb{R}^{1}$ are the trainable parameters. + +# 3.3 Multimodal Feature Fusion + +We describe our multimodal feature fusion module in the section and it is noted that our proposed refinement approach only modifies the textual input token embeddings, which makes it easy to be adapted for other multimodal feature fusion models based on BERT, such as MISA (Hazarika et al., 2020). + +We first use the BERT model to encode the refined word embeddings $\mathbf{z}^1 = \{x_1^l, x_2^l, \dots, r^l, \dots, x_{n_l}^l\}$ and take the representation of [CLS] as the textual representation, which is denoted as $v^l$ . And then we use two LSTM networks to encode the visual and acoustic features and take the representations of the first words as the visual representation $v^v$ and acoustic representation $v^a$ . Finally, we fuse them using a non-linear layer to capture the interactions between them. + +$$ +v ^ {l} = \mathrm {B E R T} _ {\mathrm {t e x t u a l}} (\mathbf {z} ^ {1}) +$$ + +$$ +\begin{array}{l} v ^ {v} = \mathrm {L S T M} _ {\text {v i s u a l}} \left(\mathbf {x} ^ {\mathrm {v}}\right) \\ a = \text {L S T M} _ {\text {v i s u a l}} (\lambda^ {3}) \end{array} \tag {5} +$$ + +$$ +v ^ {a} = \mathrm {L S T M} _ {\mathrm {a c o u s t i c}} (\mathbf {x} ^ {\mathrm {a}}) +$$ + +$$ +v ^ {f} = R e l u (W _ {4} ([ v ^ {l}; v ^ {v}; v ^ {a} ]) + b _ {4}) +$$ + +where $W_{4}\in \mathbb{R}^{d_{v}^{f}\times (d_{v}^{l} + d_{v}^{a} + d_{v}^{v})}$ $b_{4}\in \mathbb{R}^{d_{v}^{f}}$ are the trainable parameters of the fusion network. + +We utilize a linear layer to predict the final sentiment regression labels. + +$$ +p _ {f} = W _ {5} v ^ {f} + b _ {5} \tag {6} +$$ + +where $W_{5}\in \mathbb{R}^{1\times d_{v}^{f}}$ , $b_{5}\in \mathbb{R}^{1}$ are the trainable parameters of the prediction network. + +Besides, to enhance the model to capture unimodal sentiment information, we use the Unimodal Label Generation Module (ULGM) (Yu et al., 2021) to generate pseudo unimodal sentiment labels and adopt them to train our model in a multi-task learning manner. For more details, we refer you to Yu et al. (2021). + +# 4 Experiment + +# 4.1 Datasets + +We build three real-world datasets including MOSI-SpeechBrain, MOSI-IBM, and MOSI-iFlytek, on CMU-MOSI(Zadeh et al., 2016). + +CMU-MOSI CMU multimodal opinion-level sentiment intensity (CMU-MOSI) consists of 93 videos collected from the YouTube website. The length of the videos varies from 2-5 mins. These videos are split into 2,199 short video clips and labeled with sentiment scores from -3 (strongly negative) to 3 (strongly positive). For multimodal features, we extract the visual features using Facet, which can extract the facial action units (Ekman et al., 1980) from each frame. The acoustic features are obtained by applying COVAREP (Degottex et al., 2014), which includes 12 Mel-frequency cepstral coefficients (MFCCs) and other low-level features. + +However, the provided texts of the utterances in the MOSI dataset are manually transcribed from the corresponding videos by the expert transcribers, which is unrealistic for the real-world applications to obtain the texts in such a way. To evaluate the models in the real world, we replace the manually gold texts in the dataset with the texts output by the ASR models. We adopt a strong ASR model and two widely used commercial APIs to produce the texts. The utilized ASR model released by Ravanelli et al. (2021) is built on the transformer encoder-decoder framework and trained on the Librispeech dataset(Panayotov et al., 2015). The commercial APIs used by us are $\mathbf{IBM}^2$ and iFlytek speech-to-text APIs, which are wildly used by researchers and software developers. Finally, we apply the three ASR models to transcribe the videos into texts and construct three new datasets, namely MOSI-SpeechBrain, MOSI-IBM, + +
DatasetsModelsEvaluation Metrics
Has0-Acc ↑Has0-F1 ↑Non0-Acc ↑Non0-F1 ↑MAE ↓Corr ↑
MOSI-SpeechBrainTFN(B)68.9868.9569.5169.57115.5548.54
LMF(B)68.8668.8869.3669.48117.4248.66
MulT(B)71.7871.7072.7472.75109.0054.69
MISA73.7973.8574.5174.6698.5265.37
Self-MM73.6773.7274.8574.9890.9567.23
Ours74.5874.6275.7075.8290.5667.47
MOSI-IBMTFN(B)71.8171.7872.1373.21109.4258.19
LMF(B)73.0673.0974.3074.41104.7059.07
MulT(B)75.5775.5476.7476.79100.3264.34
MISA76.9776.9978.0878.1791.2371.30
Self-MM77.3277.3778.6078.7285.6573.23
Ours78.4378.4779.7079.8082.9173.91
MOSI-iFlytekTFN(B)71.9572.0172.6272.76107.0156.52
LMF(B)71.9872.0372.3572.49106.6359.48
MulT(B)77.3277.0578.7578.5689.8468.14
MISA79.5979.6279.8279.9185.6374.53
Self-MM80.2680.2681.1681.2078.7975.83
Ours80.4780.4781.2881.3478.3975.97
MOSI-GoldSelf-MM82.5482.5184.0284.0572.4978.90
+ +Table 1: Results on the MOSI-SpeechBrain, MOSI-IBM, and MOSI-iFlytek datasets. (B) means the textual features are based on BERT. The best results are in bold. + +and MOSI-iFlytek. We report the WER results of the adopted ASR models on MOSI in Appendix A. Noted that, we do not adopt MOSEI (Bagher Zadeh et al., 2018), because it does not provide the original video clips for the extracted features and annotated sentiment labels, and we can not process the original audiios. + +# 4.2 Training Details + +We use Adam as the optimizer and the learning rate is 5e-5. The batch size is 64. The sentiment threshold is set to 0.5 while detecting the sentiment word position. The number of the candidate words $k$ is 50. The other hyper-parameters of the model are reported in Appendix B. All experiments are run on an Nvidia Tesla P100 GPU. We run five times and report the average performance. The random seeds we used are 1111,1112, 1113, 1114, and 1115. + +# 4.3 Evaluation Metrics + +For the MOSI-SpeechBrain, MOSI-IBM, and MOSI-iFlytek datasets, following previous work (Yu et al., 2021), we take 2-class accuracy(Acc-2), F1 score(F1), mean absolute error (MAE), and correlation(Corr) as our evaluation metrics. And for Acc-2 and F1-Score, we calculate them in two ways, negative/non-negative (Non0-Acc, Non0-F1) + +and negative/positive (Has0-Acc, Has0-F1). As the prediction results are real values, we obtain the sentiment classification labels by mapping the sentiment scores into labels. + +# 4.4 Baselines + +We compare our proposed model with the following baselines $^{4}$ . TFN (Zadeh et al., 2017) uses the three-fold Cartesian product to capture unimodal, bimodal, and trimodal interactions. LMF (Liu et al., 2018) uses the low-rank tensors to accelerate the multimodal feature fusion process. MulT (Tsai et al., 2019) uses the cross-modal transformers to fuse multimodal features. MISA (Hazarika et al., 2020) adopts multi-task learning to map different modal features into a shared subspace. Self-MM (Yu et al., 2021) first generates the pseudo unimodal sentiment labels and then adopts them to train the model in a multi-task learning manner. + +# 5 Results and Analysis + +# 5.1 Quantitative Results + +In Table 1, we show the results on the MOSI-SpeechBrain, MOSI-IBM, MOSI-iFlytek datasets. + +
ModelsHas0-Acc ↑Non0-Acc ↑MAE ↓
SWRM74.5875.7090.56
w/o Position73.5974.5793.67
w/o Attention74.1775.4291.53
w/o Multi-modal73.8275.0991.22
+ +Table 2: Ablation analysis of our proposed model evaluated on the MOSI-SpeechBrain dataset. The best results are in **bold**. + +And we also list the results of the SOTA model, Self-MM, on the original MOSI dataset in the last row of the table for the performance comparison between Self-MM in the ideal world and real world. As we can see from the results, Self-MM obtains the best results on the MOSI-Gold dataset than the other datasets, which demonstrates that the ASR errors hurt the MSA models. We also observe that the better ASR model can help the MSA models achieve better performance. But it should be noted that, according to the analysis in the previous section, current ASR models still can not produce satisfactory results for the MSA models in the real world. + +Comparison between the feature-based models including TFN, LMF, and MulT and finetuning-based baselines such as MISA and Self-MM, we can find that finetuning-based models obtain better results. We consider that the finetuning-based models can adapt the BERT encoder to the target task and learning more informative textual representations, which also makes them benefit more as the quality of texts increases. + +Comparing to the baselines especially Self-MM, our model achieves better performance in all evaluation metrics since our model can detect the substitution error of the sentiment words and then refine the word embeddings to reconstruct the sentiment semantics in the textual modality by filtering out useless information from the input words and incorporating useful information from the candidate words generated by the language model. We also observe that the improvement of our model compared with Self-MM on MOSI-iFlytek is smaller. We consider that the main reason is fewer sentiment word substitution errors on MOSI-iFlytek. + +# 5.2 Ablation Study + +We conduct the ablation experiments to distinguish the contribution of each part. There are several different variants of our model. SWRM is our proposed full model. SWRM w/o Position does not + +![](images/834bce933574d40e9c4545891d3e409cbe973b2df64d7408fbbb6af822ba3565.jpg) +Figure 3: Case study for the SWRM. + +use the sentiment word position location module and only uses the information of the special word [MASK] to dynamically refine all words. SWRM w/o Attention only incorporates the information of the special word [MASK] to refine the word in the multimodal sentiment word refinement module. SWRM w/o Multi-modal only performs the multimodal sentiment word attention and multimodal gating network based on the textual features without the acoustic and visual features. + +Table 2 shows the results of the variants of our model. After ablating the sentiment word position location module, SWRM w/o Position obtains worse results than SWRM, which indicates that finding the right word for refinement is very important. The comparison between SWRM w/o Attention and SWRM w/o Position further demonstrates this conclusion. SWRM w/o Attention first detects the right position and then incorporates the information of the special word [MASK], which achieves better performance than SWRM w/o Position. But SWRM w/o Attention is still worse than SWRM, which shows using the attention network to incorporating extra information from the candidate words is useful for refinement. Comparing the SWRM w/o Multi-modal between SWRM, we can find that the model benefits from the visual and acoustic features. It is in line with our expectations since the sentiment information provided by the multimodal features can help the model detect the sentiment word and incorporate the sentiment + +related information from the candidate words. + +# 5.3 Case Study + +To have an intuitive understanding of our proposed model, we show a case in Figure 3. We can see that our model first detects the most possible position based on the context and then finds that the input word in the position may be recognized incorrectly since there is a mismatch between the negative word "cruel" and either the smile or the excited tone. Hence our model decides to incorporate the related sentiment information from the candidate words to refine the word embedding. As shown in Figure 3, our model pays more attention to the candidate words "special", "cool", and "awesome". The word "cool" is exactly the gold word and the others have the same sentiment polarity as it. Beneficial from the attended candidate words, our model refines the input word and reconstructs its sentiment semantics. Finally, the refined word embeddings are fed into the multimodal feature fusion module to predict the sentiment label. + +# 6 Conclusion + +In this paper, we observe an obvious performance drop when the SOTA MSA model is deployed in the real world, and through in-depth analysis, we find that the sentiment word substitution error is a very important factor causing it. To address it, we propose the sentiment word aware multimodal refinement model, which can dynamically refine the word embeddings and reconstruct the corrupted sentiment semantics by incorporating the multimodal sentiment information. We evaluate our model on MOSI-SpeechBrain, MOSI-IBM, and MOSI-iFlytek and the results demonstrate the effectiveness of our approach. For future work, we will explore leveraging the multimodal information to detect the sentiment word positions. + +# Acknowledgments + +This work was supported by the following Grants: National Natural Science Foundation of China (No. 62176078), National Key R&D Program of China (No. 2018YFB1005103). + +# References + +AmirAli Bagher Zadeh, Paul Pu Liang, Soujanya Poria, Erik Cambria, and Louis-Philippe Morency. 2018. Multimodal language analysis in the wild: CMU-MOSEI dataset and interpretable dynamic fusion + +graph. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 2236-2246, Melbourne, Australia. Association for Computational Linguistics. +Minghai Chen, Sen Wang, Paul Pu Liang, Tadas Baltrusaitis, Amir Zadeh, and Louis-Philippe Morency. 2017. Multimodal sentiment analysis with word-level fusion and reinforcement learning. In Proceedings of the 19th ACM International Conference on Multimodal Interaction, ICMI '17, page 163-171, New York, NY, USA. Association for Computing Machinery. +Wenliang Dai, Samuel Cahyawijaya, Zihan Liu, and Pascale Fung. 2021. Multimodal end-to-end sparse model for emotion recognition. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 5305-5316, Online. Association for Computational Linguistics. +Gilles Degottex, John Kane, Thomas Drugman, Tuomo Raitio, and Stefan Scherer. 2014. Covarep—a collaborative voice analysis repository for speech technologies. In 2014 IEEE international conference on acoustics, speech and signal processing (icassp), pages 960-964. IEEE. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171-4186, Minneapolis, Minnesota. Association for Computational Linguistics. +Sri Harsha Dumpala, Imran Sheikh, Rupayan Chakraborty, and Sunil Kumar Kopparapu. 2018. Sentiment classification on erroneous asr transcripts: a multi view learning approach. In 2018 IEEE Spoken Language Technology Workshop (SLT), pages 807-814. IEEE. +Paul Ekman, Wallace V Freisen, and Sonia Ancoli. 1980. Facial signs of emotional experience. Journal of personality and social psychology, 39(6):1125. +Devamanyu Hazarika, Roger Zimmermann, and Soujanya Poria. 2020. Misa: Modality-invariant and -specific representations for multimodal sentiment analysis. In Proceedings of the 28th ACM International Conference on Multimedia, MM '20, page 1122-1131, New York, NY, USA. Association for Computing Machinery. +Minqing Hu and Bing Liu. 2004. Mining opinion features in customer reviews. In AAAI, volume 4, pages 755-760. +Paul Pu Liang, Zhun Liu, Yao-Hung Hubert Tsai, Qibin Zhao, Ruslan Salakhutdinov, and Louis-Philippe Morency. 2019. Learning representations from imperfect time series data via tensor rank regularization. + +In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 1569-1576, Florence, Italy. Association for Computational Linguistics. + +Zhun Liu, Ying Shen, Varun Bharadhwaj Lakshminarasimhan, Paul Pu Liang, AmirAli Bagher Zadeh, and Louis-Philippe Morency. 2018. Efficient low-rank multimodal fusion with modality-specific factors. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 2247–2256, Melbourne, Australia. Association for Computational Linguistics. + +Sijie Mai, Haifeng Hu, and Songlong Xing. 2020. Modality to modality translation: An adversarial representation learning and graph fusion network for multimodal fusion. Proceedings of the AAAI Conference on Artificial Intelligence, 34(01):164-172. + +Trisha Mittal, Uttaran Bhattacharya, Rohan Chandra, Aniket Bera, and Dinesh Manocha. 2020. M3er: Multiplicative multimodal emotion recognition using facial, textual, and speech cues. Proceedings of the AAAI Conference on Artificial Intelligence, 34(02):1359-1367. + +Vassil Panayotov, Guoguo Chen, Daniel Povey, and Sanjeev Khudanpur. 2015. Librispeech: an asr corpus based on public domain audio books. In 2015 IEEE international conference on acoustics, speech and signal processing (ICASSP), pages 5206-5210. IEEE. + +Hai Pham, Paul Pu Liang, Thomas Manzini, Louis-Philippe Morency, and Barnabás Póczos. 2019. Found in translation: Learning robust joint representations by cyclic translations between modalities. Proceedings of the AAAI Conference on Artificial Intelligence, 33(01):6892-6899. + +Mirco Ravanelli, Titouan Parcollet, Peter Plantinga, Aku Rouhe, Samuele Cornell, Loren Lugosch, Cem Subakan, Nauman Dawalatabad, Abdelwahab Heba, Jianyuan Zhong, Ju-Chieh Chou, Sung-Lin Yeh, Szu-Wei Fu, Chien-Feng Liao, Elena Rastorgueva, François Grondin, William Aris, Hwidong Na, Yan Gao, Renato De Mori, and Yoshua Bengio. 2021. SpeechBrain: A general-purpose speech toolkit. ArXiv:2106.04624. + +Yao-Hung Hubert Tsai, Shaojie Bai, Paul Pu Liang, J. Zico Kolter, Louis-Philippe Morency, and Ruslan Salakhutdinov. 2019. Multimodal transformer for unaligned multimodal language sequences. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 6558-6569, Florence, Italy. Association for Computational Linguistics. + +Theresa Wilson, Janyce Wiebe, and Paul Hoffmann. 2005. Recognizing contextual polarity in phrase-level sentiment analysis. In Proceedings of human language technology conference and conference on empirical methods in natural language processing, pages 347-354. + +Yang Wu, Zijie Lin, Yanyan Zhao, Bing Qin, and LiNan Zhu. 2021. A text-centered shared-private framework via cross-modal prediction for multimodal sentiment analysis. In *Findings of the Association for Computational Linguistics: ACL-IJCNLP* 2021, pages 4730-4738, Online. Association for Computational Linguistics. + +Wenmeng Yu, Hua Xu, Fanyang Meng, Yilin Zhu, Yixiao Ma, Jiele Wu, Jiyun Zou, and Kaicheng Yang. 2020. CH-SIMS: A Chinese multimodal sentiment analysis dataset with fine-grained annotation of modality. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 3718-3727, Online. Association for Computational Linguistics. + +Wenmeng Yu, Hua Xu, Ziqi Yuan, and Jiele Wu. 2021. Learning modality-specific representations with self-supervised multi-task learning for multimodal sentiment analysis. Proceedings of the AAAI Conference on Artificial Intelligence, 35(12):10790-10797. + +Amir Zadeh, Minghai Chen, Soujanya Poria, Erik Cambria, and Louis-Philippe Morency. 2017. Tensor fusion network for multimodal sentiment analysis. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 1103-1114, Copenhagen, Denmark. Association for Computational Linguistics. + +Amir Zadeh, Rowan Zellers, Eli Pincus, and Louis-Philippe Morency. 2016. MOSI: multimodal corpus of sentiment intensity and subjectivity analysis in online opinion videos. CoRR, abs/1606.06259. + +# A WER Results on MOSI + +
APISpeechBrainIBMiFlytek
WER37.5429.7023.91
+ +# B Hyper-parameter Settings + +Table 3:WER results on the MOSI dataset. + +
DatasetMOSI-SpeechBrainMOSI-IBMMOSI-iFlytek
Batch Size6412864
dx768768768
dv163216
ha323232
va486448
vl326432
da163216
dv321632
fv12864128
+ +Table 4: The hyper-parameters used in training for the three datasets. \ No newline at end of file diff --git a/sentimentwordawaremultimodalrefinementformultimodalsentimentanalysiswithasrerrors/images.zip b/sentimentwordawaremultimodalrefinementformultimodalsentimentanalysiswithasrerrors/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..cec8c9858e820e4c2dce3e2fddcdf9fd76871fde --- /dev/null +++ b/sentimentwordawaremultimodalrefinementformultimodalsentimentanalysiswithasrerrors/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:44ea5e27692119ca00fdb03cea2c5240e95ba014cddedb7a4ffbad94a5bdf48a +size 406887 diff --git a/sentimentwordawaremultimodalrefinementformultimodalsentimentanalysiswithasrerrors/layout.json b/sentimentwordawaremultimodalrefinementformultimodalsentimentanalysiswithasrerrors/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..af66efbf2ed98a2216c77c47d51b9b7d2ec5f8eb --- /dev/null +++ b/sentimentwordawaremultimodalrefinementformultimodalsentimentanalysiswithasrerrors/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cc11a4245ea4c7d00d335854076c1fac584a77aa793dacc8a654b9b7abc211d4 +size 296979 diff --git a/seq2pathgeneratingsentimenttuplesaspathsofatree/b0f1ae5e-7363-4d1f-ae35-e2c86e345fbf_content_list.json b/seq2pathgeneratingsentimenttuplesaspathsofatree/b0f1ae5e-7363-4d1f-ae35-e2c86e345fbf_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..a75bd8fd1f079b1a1f71ad4b8bcb445c6823a63a --- /dev/null +++ b/seq2pathgeneratingsentimenttuplesaspathsofatree/b0f1ae5e-7363-4d1f-ae35-e2c86e345fbf_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1103dbf3ca9a1c310bdafc83a09cca2d12fe114bc4a037b40a10c9a4d91ff508 +size 82435 diff --git a/seq2pathgeneratingsentimenttuplesaspathsofatree/b0f1ae5e-7363-4d1f-ae35-e2c86e345fbf_model.json b/seq2pathgeneratingsentimenttuplesaspathsofatree/b0f1ae5e-7363-4d1f-ae35-e2c86e345fbf_model.json new file mode 100644 index 0000000000000000000000000000000000000000..4a1302f13d5098469004e8a05f2536f571df3c8d --- /dev/null +++ b/seq2pathgeneratingsentimenttuplesaspathsofatree/b0f1ae5e-7363-4d1f-ae35-e2c86e345fbf_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:08a2bd80a2912c18031519ab365e7e7fce69d5e0b8934da254e004748c0762be +size 103171 diff --git a/seq2pathgeneratingsentimenttuplesaspathsofatree/b0f1ae5e-7363-4d1f-ae35-e2c86e345fbf_origin.pdf b/seq2pathgeneratingsentimenttuplesaspathsofatree/b0f1ae5e-7363-4d1f-ae35-e2c86e345fbf_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b984396dc46e7378cf26f25fbd175f5a385b5921 --- /dev/null +++ b/seq2pathgeneratingsentimenttuplesaspathsofatree/b0f1ae5e-7363-4d1f-ae35-e2c86e345fbf_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9705b2a38c4ce374d4861bd183b9e257905ec1b2f34304492c05dc74f1abade3 +size 606055 diff --git a/seq2pathgeneratingsentimenttuplesaspathsofatree/full.md b/seq2pathgeneratingsentimenttuplesaspathsofatree/full.md new file mode 100644 index 0000000000000000000000000000000000000000..85fb52638e733d4245f2b162f47fdf37307a7bb3 --- /dev/null +++ b/seq2pathgeneratingsentimenttuplesaspathsofatree/full.md @@ -0,0 +1,426 @@ +# Seq2Path: Generating Sentiment Tuples as Paths of a Tree + +Yue Mao, Yi Shen, Jingchao Yang, Xiaoying Zhu, Longjun Cai + +Alibaba Group + +{maoyue.my, sy133447, yangjingchao.yjc, + +candy.zxy, longjun.clj}@alibaba-inc.com + +# Abstract + +Aspect-based sentiment analysis (ABSA) tasks aim to extract sentiment tuples from a sentence. Recent generative methods such as Seq2Seq models have achieved good performance by formulating the output as a sequence of sentiment tuples. However, the orders between the sentiment tuples do not naturally exist and the generation of the current tuple should not condition on the previous ones. In this paper, we propose Seq2Path to generate sentiment tuples as paths of a tree. A tree can represent "1-to-n" relations (e.g., an aspect term may correspond to multiple opinion terms) and the paths of a tree are independent and do not have orders. For training, we treat each path as an independent target, and we calculate the average loss of the ordinary Seq2Seq model over paths. For inference, we apply beam search with constrained decoding. By introducing an additional discriminative token and applying a data augmentation technique, valid paths can be automatically selected. We conduct experiments on five tasks including AOPE, ASTE, TASD, UABSA, ACOS. We evaluate our method on four common benchmark datasets including Laptop14, Rest14, Rest15, Rest16. Our proposed method achieves state-of-the-art results in almost all cases. + +# 1 Introduction + +ABSA tasks. Aspect-based sentiment analysis (ABSA) is a classic research topic and has received continuous attention. The ABSA tasks aim to extract sentiment tuples of elements such as the aspect term $(a)$ , opinion term $(o)$ , aspect category $(c)$ , and sentiment polarity $(s)$ , respectively. Following the tasks definitions in (Zhang et al., 2021b), we consider various ABSA tasks including aspect opinion pair extraction (AOPE), aspect sentiment triplet extraction (ASTE), target aspect sentiment detection (TASD), unified aspect-based sentiment analysis (UABSA) and aspect category opinion sentiment + +(ACOS). The output formats are shown in Table 1. Throughout this paper, we assume the ASTE task is our default task to illustrate our ideas. + +
ABSA TaskAbbrOutput
Aspect Opinion Pair ExtractionAOPE(a, o)
Aspect Sentiment Triplet ExtractionASTE(a, o, s)
Target Aspect Sentiment DetectionTASD(c, a, s)
Unified Aspect-Based Sentiment AnalysisUABSA(a, s)
Aspect Category Opinion SentimentACOS(c, a, o, s)
+ +Table 1: The ABSA tasks with their output formats: AOPE (Zhao et al., 2020; Chen et al., 2020), ASTE (Peng et al., 2020), TASD (Wan et al., 2020), UABSA (Li et al., 2019; Chen et al., 2020), ACOS (Cai et al., 2021). Throughout this paper, the ASTE task is assumed to be our default task to illustrate our ideas. + +Seq2Seq for ABSA. Instead of using separate models for each ABSA task, the recent trend is to design a unified framework to handle multiple ABSA tasks at the same time. Recently, the Seq2Seq models have been applied to the ABSA tasks (Yan et al., 2021; Zhang et al., 2021a,b) by formulating them as a text-to-text problem + +Input text $\Rightarrow$ " $(a_{1},o_{1},s_{1})$ , $(a_{2},o_{2},s_{2}),\ldots$ + +where the output is a sequence of sentiment tuples. Despite their success on performance, they still have two main drawbacks: (1) Orders, the orders between the tuples does not naturally exist. (2) Dependence, the generation of $(a_{2},o_{2},s_{2})$ should not condition on $(a_{1},o_{1},s_{1})$ . + +As a result, the fine-tuned model may be "confused" to make decisions. For example: Why does $(a_{1},o_{1},s_{1})$ have to be the first tuple instead of $(a_{2},o_{2},s_{2})$ ? Why does $(a_{1},o_{1},s_{1})$ have to be followed by $(a_{2},o_{2},s_{2})$ instead of $(a_{3},o_{3},s_{3})$ or $<\mathrm{eos}>$ ? + +Seq2Path for ABSA. We claim that a tree is a better choice to represent the output. As we know, a + +![](images/1b298a34c13e8afb99cbee91db78d1892e1ba6408e01ad47e6105e082d44a021.jpg) +Input text: Those rolls were big, but not good and sashimi wasn't fresh. +Figure 1: The generation process for the ASTE task can be represented by a tree where “”, “ ^ {\prime \prime} \\ 0, & o. w. \end{array} \right. \tag {7} +$$ + +- If $y$ is a positive sample, i.e., the validation token of $y$ is "true", then the loss mask does not apply. In other words, we always have + +$$ +m \left(y _ {t}\right) = 1. \tag {8} +$$ + +The loss mask means the token is skipped in loss calculating, see an example in Table 3. All tokens except the discriminative token and the “” token are masked. Let $L^{m}(\cdot)$ be the loss with the loss mask where only tokens with $m(t) = 1$ are involved in loss calculating + +$$ +L ^ {m} (Y, \hat {Y} | x) = \frac {1}{k} \sum_ {y \in Y} \sum_ {m (t) = 1} l \left(y _ {t}, \hat {y} _ {t} \mid x, y _ {< t}\right) \tag {9} +$$ + +and the loss for the augmented dataset is + +$$ +L o s s (D) = \sum_ {(x, Y) \in D} L ^ {m} (Y, \hat {Y} | x). \tag {10} +$$ + +# 2.5 Algorithm + +The algorithm of Seq2Path are summarized as Algorithm 1 including training, inference and data augmentation. + +# Algorithm 1: Seq2Path. + +Input: A training dataset $D_{p}$ , beam size $k$ . Output: Valid sentiment tuples. + +1 Train ordinary Seq2Seq on $D_{p}$ with loss averaged over paths for 5 epochs. Generate negative samples $D_{1}$ from beam search; +2 Generate more negative samples $D_{2}$ by randomly replacing tuple elements; +3 Let $D_{n} = D_{1}\bigcup D_{2}$ be the negative samples. Construct the augmented dataset $D = D_{p}\bigcup D_{n}$ where each sample is appended with a discriminative token, either "true" or "false"; +4 Train ordinary Seq2Seq on $D$ with loss averaged over paths for full epochs where the loss is masked on negative samples; +5 Apply beam search with constrained decoding for inference. Generate top $k$ paths with decreasing probabilities $p_i$ and discriminative tokens $v_i$ ; +6 Apply pruning to select the valid paths based on $p_i$ and $v_i$ . Return valid paths as valid sentiment tuples. + +# 3 Why Seq2Path? + +Conditional transition probability. In this section, we give more analysis on the motivation for Seq2Path. We claim that Seq2Path is better in learning the precise conditional transition probabilities for the token generation process: + +$$ +P \left(y _ {t} = v _ {i} \mid x, y _ {< t}\right) \tag {11} +$$ + +where $x$ is the input sentence and $y_{","rolls", ";"), + +$$ +P _ {\text {m u l t i - h o t}} \left(y _ {4} \mid x, y _ {< 4}\right) = \left\{ \begin{array}{l l} 0. 5, & y _ {4} = \text {" b i g "} \\ 0. 5, & y _ {4} = \text {" n o t "} \\ 0, & o. w. \end{array} \right. \tag {13} +$$ + +![](images/c3171b0813f27d9088e3a7c5e05ed6d7b19d915965746489a5465774aa490699.jpg) +Figure 3: An example to show the loss mask. The loss mask means the token is skipped in loss calculating. The loss mask does not apply to a positive sample. For a negative sample, the loss is calculated only upon the “false” and the “” token, and skips the other tokens because they form an invalid generation. + +Why average loss over paths? Recall, during training, we treat each sentiment tuple as an independent target and calculate the average loss of ordinary Seq2Seq. Here we justify it. Formally, suppose the target contains $k$ paths with the previous tokens $x, y_{2. The structure of the $\mathrm{T}5^{3}$ encoder and decoder is similar to that of the Transformer (Vaswani et al., 2017). Since sentiment tuples are generated independently, the maximum output length = 32 can be very small comparing to the maximum sequence length = 128. It can reduce a lot of memory consumption. + +For all ABSA tasks, we use a fixed batch size 8 and a fixed learning rate $1e^{-4}$ to train the model with a single Nvidia 1080Ti GPU. We first train the model with 5 epochs for augmentation. Then the final model is trained for $n = 20$ epochs. The best model is determined based on the loss on the validation set. For inference, the number of beams depends on the task and dataset and can be $k = 4,6,8,10$ . Typically, $k = 6$ can be used for most cases. In addition, the separator “,” can be replaced with other separators4 and the experimental results + +may improve slightly. + +# 4.2 Main Results + +The main results for the AOPE, UABSA, ASTE, TASD, ACOS tasks are reported in Table 2, 3, 4, 5, 6, respectively. Most baseline results are directly copied from (Zhang et al., 2021b). Our proposed method achieves the new state-of-the-art results in almost all F1 scores. + +On the AOPE task, our proposed Seq2Path outperforms the previous best results by 4.74, 1.75, 3.91, 3.67 in percentage on Laptop14, Rest14, Rest15, Rest16 respectively. The main challenge for the AOPE task is to match the aspect $a$ and the opinion $o$ where there are many complex "1-to-n" relations. Our Seq2Path has a large performance gain because it can handle these complex relations very well. + +
L14R14R15R16
SpanMlt68.6675.6064.6871.78
SDRN66.1873.3065.7573.67
BMRC67.4576.2368.6076.52
GAS-T569.5575.1567.9375.42
Seq2Path(k=4)72.8476.7870.6378.51
Seq2Path(k=6)74.2976.9271.8479.03
Seq2Path(k=8)72.6277.3570.7279.09
Seq2Path(k=10)73.3576.9169.3878.05
+ +On the ASTE task, our proposed Seq2Path outperforms the previous best results by 4.14, 3.36, 3.32, 1.97 in percentage on Laptop14, Rest14, Rest15, Rest16 respectively. The ASTE task is similar to the AOPE task, but ASTE is even harder as the sentiment $s$ is also required. Again, our Seq2Path has a large performance gain. + +Table 2: Main results of the AOPE task with various beam sizes $k$ . The best results are in bold and the second-best results are underlined. + +
L14R14R15R16
Jet-BERT51.0462.4057.5363.83
Dual-MRC55.5870.3257.2167.40
BMRC59.2770.6961.0568.13
GAS-T560.7872.1662.1070.10
ParaPhrase-T561.1372.0362.5671.70
Seq2Path(k=4)64.0974.2965.4273.67
Seq2Path(k=6)65.2773.0065.8871.62
Seq2Path(k=8)64.2074.8864.8972.67
Seq2Path(k=10)64.8275.5265.8872.87
+ +Table 3: Main results of the ASTE task with various beam sizes $k$ . The best results are in bold and the second-best results are underlined. + +On the TASD task, our proposed Seq2Path outperforms the previous best results by 2.14, 0.13 + +in percentage on Rest15, Rest16 respectively. The challenge for the TASD task is that the aspect terms $a$ can be "NULL", and an aspect $a$ can have multiple categories $c$ . + +
R15R16
TAS58.0965.89
GAS-T561.4769.42
ParaPhrase-T563.0671.97
Seq2Path(k=4)63.1368.47
Seq2Path(k=6)65.2070.16
Seq2Path(k=8)63.3672.10
Seq2Path(k=10)63.8969.23
+ +On the UABSA task, our proposed Seq2Path outperforms the previous best results by 1.36, 1.67, 2.23 in percentage on Laptop14, Rest15, Rest16 respectively. The result on Rest14 is slightly lower (almost equal) than GAS-T5. The UABSA task is easier than other ABSA tasks since only two tuple elements $(a, s)$ are extracted. One challenge is that the output can be a null set if there is no aspect in the input text. For such cases, it is most likely that all beams of Seq2Path will have a discriminative token $v =$ "false". Thus, our method is consistent with such a setting. + +Table 4: Main results of the TASD task with various beam sizes $k$ . The best results are in bold and the second-best results are underlined. + +
L14R14R15R16
RACL63.4075.4266.05-
Dual-MRC65.9475.9565.08-
BMRC67.2776.3967.1673.18
GAS-T568.6477.1366.7873.64
Seq2Path(k=4)70.0077.0168.3575.87
Seq2Path(k=6)69.9476.0767.7175.18
Seq2Path(k=8)69.2777.1068.3374.96
Seq2Path(k=10)69.0876.0168.4573.73
+ +The ACOS task is newly published, and the original paper is the only baseline available. Our proposed Seq2Path outperforms the previous best results by 7.17, 13.80 in percentage on Laptop14, Rest16 respectively. This improvement is huge and should be partially from the power of T5. + +# 4.3 Analysis + +Analysis on the beam size. The main results in Table 2, 3, 4, 5, 6 use various beam sizes of 4, 6, 8, 10. The beam size $k$ is an important hyperparameter which affects both data augmentation and inference. The choice of the optimal $k$ depends on the task and + +Table 5: Main results of the UABSA task with various beam sizes $k$ . The best results are in bold and the second-best results are underlined. + +
L14R16
ACOS-Baseline35.8044.61
Seq2Path(k=4)42.6057.72
Seq2Path(k=6)41.4558.06
Seq2Path(k=8)41.9357.37
Seq2Path(k=10)42.9758.41
+ +the dataset. Roughly speaking, a smaller beam size will lead a worse recall while a larger beam size will lead a worse precision. Nevertheless, with our pruning process, our results are state-of-the-art regardless of the choice of $k$ . Although beam search for inference will require a larger GPU memory, the Seq2Path can use a much shorter max output sequence length. Then, the memory consumption will be reduced by a lot. + +Ablation study on data augmentation. The purpose of data augmentation is to generate negative samples for the discriminative token to automatically select the paths. The ablation results for data augmentation are shown in Table 7. + +Table 6: Main results of the ACOS task with various beam sizes $k$ . The best results are in bold and the second-best results are underlined. + +
TaskAugmentL14R14R15R16
AOPED159.4765.6859.0565.96
D273.0577.0369.9177.83
Dn74.2976.9271.8479.03
ASTED154.9865.6857.6964.90
D261.6273.2962.4671.07
Dn65.2773.0065.8871.62
TASDD1--40.1642.94
D2--62.9869.64
Dn--65.2070.16
UABSAD146.6564.0852.7455.91
D269.2676.7268.2872.79
Dn69.9476.0767.7175.18
ACOSD129.08--37.39
D241.05--57.69
Dn41.45--58.06
+ +Table 7: Ablation results for data augmentation. The beam size is fixed as $k = 6$ . The datasets $D_{1},D_{2},D_{n}$ are described in Section 2.2. All results are the F1 scores averaged over 5 runs with different random seeds. The best results are in bold. + +The dataset $D_{1}$ has minor effects on the F1 scores. For most cases, adding $D_{1}$ can improve the F1 scores by up to $3\%$ . It consists of negative samples by randomly replacing tuple elements and improves the model's ability to match tuple elements. The performance on Laptop14, Rest15 and Rest16 can benefit from $D_{1}$ . However, $D_{1}$ seems to lead a slight performance drop on Rest14. One possible reason is that Rest14 has the biggest + +sample size and $D_{1}$ may not be necessary. + +The dataset $D_{2}$ has major effects on the F1 scores. $D_{2}$ consists of negative samples generated by beam search from a fine-tuned model with small number of epochs. The F1 scores are significantly improved by adding $D_{2}$ because $D_{2}$ can guide the discriminative token to filter most of bad generations. For example, generating false repeated tokens is very common, and such bad cases can be handled here. + +Case study. Figure 4 shows an example of beam search generation for the ASTE task with the beam size $k = 6$ . The input sentence is "the staff was very nice and courteous and obviously chinese." The probabilities are the sequence probabilities from beam search in decreasing order. The top 3 paths with $v =$ "true" are valid where they are marked as bold. The other 3 paths with $v =$ "false" are filtered. The tuple "staff, chinese, positive" is a valid one because the probability for the token "true" is larger than "false" $0.7114 > 0.4425$ . The other paths such as "chinese stuff, nice, positive" are pruned for low probabilities. + +![](images/fe88487039bcac071b1b5352558b7fd0f329ae033694f14e4e796684bef667db.jpg) +Figure 4: An example of beam search generation for the ASTE task with the beam size $k = 6$ . The input sentence is "the staff was very nice and courteous and obviously chinese." The probabilities at the bottom are the sequence probabilities returned from beam search. The paths with $v =$ "true" are marked as bold. + +# 5 Related Work + +There has been much work addressing technical solutions for ABSA. The main sentiment elements involved in ABSA include aspect term, opinion term, aspect category and sentiment polarity. In order to extract these sentiment elements, the main research direction of ABSA is to extract aspect + +terms (Liu et al., 2015; Yin et al., 2016; Li et al., 2018; Ma et al., 2019) and categorize the sentiment of a given aspect (Wang et al., 2016; Chen et al., 2017; Jiang et al., 2019; Zhang and Qian, 2020), and to jointly predict multiple elements simultaneously at the same time (Li et al., 2019; Wan et al., 2020; Peng et al., 2020; Zhao et al., 2020). Early ABSA problems were mostly expressed as sequence labeling or multi-classification problems (Li et al., 2019), which were predicted by designing task-specific classification networks and using the class index as labels for training (Huang and Carley, 2019; Wan et al., 2020). However, this approach requires the design of different classification models and ignores the label semantics. Recent works achieve good performance by converting the ABSA problems as a text generation problem (Yan et al., 2021; Zhang et al., 2021a,b). + +The generative framework has been proven effective for some other natural language processing problems including dialogue state tracking (Feng et al., 2020), entity linking (De Cao et al., 2020), event extraction (Lu et al., 2021), information extraction (Sui et al., 2020), named entity recognition (Yan et al., 2021; Tan et al., 2021; Raffel et al., 2019; Athiwaratkun et al., 2020). In particular, (Paolini et al., 2021) solved various NLP tasks in a unified generative framework. + +# 6 Conclusions + +In this paper, we propose Seq2Path, a novel parallel generative framework for ABSA. The previous Seq2Seq based method formulates the output as a sequence that has two main drawbacks: the order and the dependence. Instead, our Seq2Path formulates the output as a tree and generates sentiment tuples as paths of the tree. Seq2Path can learn the precise conditional transition probability for token generation, by training with the loss of ordinary Seq2Seq averaged over paths. During inference, we apply beam search with constrained decoding. A discriminative token is also introduced to automatically select the valid paths. Experiments show that our model achieves state-of-the-art on AOPE, ASTE, TASD, UABSA, ACOS across common datasets including Laptop14, Rest14, Rest15, Rest16 in almost all cases. In the future, we plan to extend our method to other structure prediction tasks in NLP such as information extraction tasks, event extraction and nested named entity recognition. + +# References + +Ben Athiwaratkun, Cicero Nogueira dos Santos, Jason Krone, and Bing Xiang. 2020. Augmented natural language for generative sequence labeling. arXiv preprint arXiv:2009.13272. +Hongjie Cai, Rui Xia, and Jianfei Yu. 2021. Aspect-category-opinion-sentiment quadruple extraction with implicit aspects and opinions. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 340-350. +Peng Chen, Zhongqian Sun, Lidong Bing, and Wei Yang. 2017. Recurrent attention network on memory for aspect sentiment analysis. In Proceedings of the 2017 conference on empirical methods in natural language processing, pages 452-461. +Shaowei Chen, Jie Liu, Yu Wang, Wenzheng Zhang, and Ziming Chi. 2020. Synchronous double-channel recurrent network for aspect-opinion pair extraction. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 6515-6524. +Shaowei Chen, Yu Wang, Jie Liu, and Yuelin Wang. 2021. Bidirectional machine reading comprehension for aspect sentiment triplet extraction. arXiv preprint arXiv:2103.07665. +Zhuang Chen and Tieyun Qian. 2020. Relation-aware collaborative learning for unified aspect-based sentiment analysis. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 3685-3694. +Nicola De Cao, Gautier Izacard, Sebastian Riedel, and Fabio Petroni. 2020. Autoregressive entity retrieval. arXiv preprint arXiv:2010.00904. +Zhifang Fan, Zhen Wu, Xinyu Dai, Shujian Huang, and Jiajun Chen. 2019. Target-oriented opinion words extraction with target-fused neural sequence labeling. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 2509-2518. +Yue Feng, Yang Wang, and Hang Li. 2020. A sequence-to-sequence approach to dialogue state tracking. arXiv preprint arXiv:2011.09553. +Binxuan Huang and Kathleen M Carley. 2019. Parameterized convolutional neural networks for aspect level sentiment classification. arXiv preprint arXiv:1909.06276. +Qingnan Jiang, Lei Chen, Ruifeng Xu, Xiang Ao, and Min Yang. 2019. A challenge dataset and effective + +models for aspect-based sentiment analysis. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 6280-6285. +Xin Li, Lidong Bing, Piji Li, and Wai Lam. 2019. A unified model for opinion target extraction and target sentiment prediction. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 6714-6721. +Xin Li, Lidong Bing, Piji Li, Wai Lam, and Zhimou Yang. 2018. Aspect term extraction with history attention and selective transformation. arXiv preprint arXiv:1805.00760. +Pengfei Liu, Shafiq Joty, and Helen Meng. 2015. Finegrained opinion mining with recurrent neural networks and word embeddings. In Proceedings of the 2015 conference on empirical methods in natural language processing, pages 1433-1443. +Yaojie Lu, Hongyu Lin, Jin Xu, Xianpei Han, Jialong Tang, Annan Li, Le Sun, Meng Liao, and Shaoyi Chen. 2021. Text2event: Controllable sequence-to-structure generation for end-to-end event extraction. arXiv preprint arXiv:2106.09232. +Dehong Ma, Sujian Li, Fangzhao Wu, Xing Xie, and Houfeng Wang. 2019. Exploring sequence-to-sequence learning in aspect term extraction. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 3538-3547. +Yue Mao, Yi Shen, Chao Yu, and Longjun Cai. 2021. A joint training dual-mrc framework for aspect based sentiment analysis. arXiv preprint arXiv:2101.00816. +Giovanni Paolini, Ben Athiwaratkun, Jason Krone, Jie Ma, Alessandro Achille, Rishita Anubhai, Cicero Nogueira dos Santos, Bing Xiang, and Stefano Soatto. 2021. Structured prediction as translation between augmented natural languages. arXiv preprint arXiv:2101.05779. +Haiyun Peng, Lu Xu, Lidong Bing, Fei Huang, Wei Lu, and Luo Si. 2020. Knowing what, how and why: A near complete solution for aspect-based sentiment analysis. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 8600-8607. +M. Pontiki, D Galanis, J. Pavlopoulos, H. Papageorgiou, and S. Manandhar. 2014. Semeval-2014 task 4: Aspect based sentiment analysis. Proceedings of International Workshop on Semantic Evaluation at. +Maria Pontiki, Dimitrios Galanis, Haris Papageorgiou, Ion Androutsopoulos, Suresh Manandhar, Mohammad Al-Smadi, Mahmoud Al-Ayyoub, Yanyan Zhao, Bing Qin, Orphée De Clercq, et al. 2016. Semeval-2016 task 5: Aspect based sentiment analysis. In International workshop on semantic evaluation, pages 19-30. + +Maria Pontiki, Dimitrios Galanis, Harris Papageorgiou, Suresh Manandhar, and Ion Androutsopoulos. 2015. Semeval-2015 task 12: Aspect based sentiment analysis. In Proceedings of the 9th international workshop on semantic evaluation (SemEval 2015), pages 486-495. +Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. 2019. Exploring the limits of transfer learning with a unified text-to-text transformer. arXiv preprint arXiv:1910.10683. +Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. 2014. Dropout: a simple way to prevent neural networks from overfitting. The journal of machine learning research, 15(1):1929-1958. +Dianbo Sui, Yubo Chen, Kang Liu, Jun Zhao, Xiangrong Zeng, and Shengping Liu. 2020. Joint entity and relation extraction with set prediction networks. arXiv preprint arXiv:2011.01675. +Zeqi Tan, Yongliang Shen, Shuai Zhang, Weiming Lu, and Yueting Zhuang. 2021. A sequence-to-set network for nested named entity recognition. arXiv preprint arXiv:2105.08901. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In Advances in neural information processing systems, pages 5998-6008. +Hai Wan, Yufei Yang, Jianfeng Du, Yanan Liu, Kunxun Qi, and Jeff Z Pan. 2020. Target-aspect-sentiment joint detection for aspect-based sentiment analysis. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 9122-9129. +Yequan Wang, Minlie Huang, Xiaoyan Zhu, and Li Zhao. 2016. Attention-based LSTM for aspect-level sentiment classification. In Proceedings of the 2016 conference on empirical methods in natural language processing, pages 606-615. +Lu Xu, Hao Li, Wei Lu, and Lidong Bing. 2020. Position-aware tagging for aspect sentiment triplet extraction. arXiv preprint arXiv:2010.02609. +Hang Yan, Junqi Dai, Xipeng Qiu, Zheng Zhang, et al. 2021. A unified generative framework for aspect-based sentiment analysis. arXiv preprint arXiv:2106.04300. +Yichun Yin, Furu Wei, Li Dong, Kaimeng Xu, Ming Zhang, and Ming Zhou. 2016. Unsupervised word and dependency path embeddings for aspect term extraction. arXiv preprint arXiv:1605.07843. +Mi Zhang and Tieyun Qian. 2020. Convolution over hierarchical syntactic and lexical graphs for aspect level sentiment analysis. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 3540-3549. + +Wenxuan Zhang, Yang Deng, Xin Li, Yifei Yuan, Li-dong Bing, and Wai Lam. 2021a. Aspect sentiment quad prediction as paraphrase generation. arXiv preprint arXiv:2110.00796. +Wenxuan Zhang, Xin Li, Yang Deng, Lidong Bing, and Wai Lam. 2021b. Towards generative aspect-based sentiment analysis. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 2: Short Papers), pages 504-510. +He Zhao, Longtao Huang, Rong Zhang, Quan Lu, and Hui Xue. 2020. Spanplt: a span-based multi-task learning framework for pair-wise aspect and opinion terms extraction. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 3239-3248. + +# A Appendix + +# A.1 Constrained Decoding + +A probability distribution is calculated over the whole vocabulary at each step of decoding. The candidate tokens can be restricted to a smaller set. For the input sentence $x$ , the candidate tokens are the union of the original tokens in $x$ and some extra task-specific candidate tokens + +$$ +T (x, t a s k) = T (x) \bigcup T (t a s k) \tag {16} +$$ + +where $T(x)$ stands for the token set for the input $x$ and the task specific tokens $T(task)$ are defined in Table 8. + +
TaskT(task)
AOPEsep
ASTEsep, positive, negative, neutral
TASDsep, positive, negative, neutral, all categories
UABSAsep, positive, negative, neutral
ACOSsep, positive, negative, neutral, all categories
+ +Table 8: Task specific tokens for constrained decoding. The separator token is used to separate output tuples. The "positive", "negative" and "neutral" tokens are the sentiment polarities. For the TASD and ACOS tasks, categories should be included in the candidate tokens. + +# A.2 Pruning + +We define the condition when two predictions are "overlapping" for a specific task in Table 9. If two predictions are overlapping, then we prefer the one with a higher probability. + +
TaskPredictionOverlapping Condition
AOPE(a,o)ovl(ai,aj),oi = oj
ovl(oi,oj),ai = aj
ASTE(a,o,s)ovl(ai,aj),oi = oj
ovl(oi,oj),ai = aj
TASD(c,a,s)ovl(ai,aj),ci = cj
UABSA(a,s)ovl(ai,aj)
ACOS(c,a,o,s)ovl(ai,aj),oi = oj,ci = cj
ovl(oi,oj),ai = aj,ci = cj
+ +Table 9: The condition when two predictions are overlapping for various ABSA tasks. The letter $a, o, c, s$ denotes the aspect, opinion, category, sentiment, respectively. The boolean function $ovl(\cdot)$ represents if two elements are overlapping. + +# A.3 Proof of Lemma 1 + +Proof: First, we consider the loss for the multi-hot vector. The cross-entropy loss for the target + +probability distribution $p\in \mathbb{R}^{|V|}$ and the predicted probability distribution $\hat{y}_t\in \mathbb{R}^{|V|}$ is + +$$ +\begin{array}{l} l \left(p, \hat {y} _ {t}\right) = - \sum_ {i = 1} ^ {n} p [ i ] \log \hat {y} _ {t} [ i ] (17) \\ = - \sum_ {i = 1} ^ {k} \frac {1}{k} \log \hat {y} _ {t} [ j _ {i} ]. (18) \\ \end{array} +$$ + +The equation holds because $p \in \mathbb{R}^{|V|}$ is "multi-hot" and $p[i] = 1$ if $i = j_{i}$ for $i = 1,2,\dots,k$ . Now, we consider the loss average over paths. For $i$ -th path $p_i' \in \mathbb{R}^{|V|}$ , + +$$ +\begin{array}{l} l \left(p _ {i} ^ {\prime}, \hat {y} _ {t}\right) = - \sum_ {\ell = 1} ^ {n} p _ {i} ^ {\prime} [ \ell ] \log \hat {y} _ {t} [ \ell ] (19) \\ = - \log \hat {y} _ {t} [ j _ {i} ]. (20) \\ \end{array} +$$ + +The equation holds because $p_i' \in \mathbb{R}^{|V|}$ is "one-hot" and $p_i'[\ell] = 1$ if $\ell = j_i$ . Therefore, it follows that + +$$ +\frac {1}{k} \sum_ {i = 1} ^ {k} l \left(p _ {i} ^ {\prime}, \hat {y} _ {t}\right) = l \left(p, \hat {y} _ {t}\right) \tag {21} +$$ + +and the proof is done. + +![](images/60aa2586e7dce9e61573d25e59454d4b3f819dc01c0a06885bd6b201767320f2.jpg) \ No newline at end of file diff --git a/seq2pathgeneratingsentimenttuplesaspathsofatree/images.zip b/seq2pathgeneratingsentimenttuplesaspathsofatree/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..bddf54fb5bc9b1205abab9312854565520e31261 --- /dev/null +++ b/seq2pathgeneratingsentimenttuplesaspathsofatree/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2cb996fb28b390e727d47711e277145b8735058db0f004cd5af1ab94b3042bfc +size 519146 diff --git a/seq2pathgeneratingsentimenttuplesaspathsofatree/layout.json b/seq2pathgeneratingsentimenttuplesaspathsofatree/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..5dab7b1d045ea234b9048994fd3d6338c405a11d --- /dev/null +++ b/seq2pathgeneratingsentimenttuplesaspathsofatree/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:98522a31442423842565667f295793aa329b1d0f90b4ea521f808a30f4ae1561 +size 479102 diff --git a/shouldwetrustthissummarybayesianabstractivesummarizationtotherescue/fca15e03-48ea-496c-a5eb-c143db5241d5_content_list.json b/shouldwetrustthissummarybayesianabstractivesummarizationtotherescue/fca15e03-48ea-496c-a5eb-c143db5241d5_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..dd12ed57edab6412403d10fdd45dfe65a3149fc4 --- /dev/null +++ b/shouldwetrustthissummarybayesianabstractivesummarizationtotherescue/fca15e03-48ea-496c-a5eb-c143db5241d5_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9eadd4d45231b5eb65d1093e3e34e88cd43d91a8ddc3776da759b124c9ac7962 +size 76953 diff --git a/shouldwetrustthissummarybayesianabstractivesummarizationtotherescue/fca15e03-48ea-496c-a5eb-c143db5241d5_model.json b/shouldwetrustthissummarybayesianabstractivesummarizationtotherescue/fca15e03-48ea-496c-a5eb-c143db5241d5_model.json new file mode 100644 index 0000000000000000000000000000000000000000..d31a48c078c1497aae8ba03ff970b4607f4efc99 --- /dev/null +++ b/shouldwetrustthissummarybayesianabstractivesummarizationtotherescue/fca15e03-48ea-496c-a5eb-c143db5241d5_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d4cce698ec1ee1b16c7e8534b4cef4235fce976aa7f3f1b73cb07cc922525305 +size 92511 diff --git a/shouldwetrustthissummarybayesianabstractivesummarizationtotherescue/fca15e03-48ea-496c-a5eb-c143db5241d5_origin.pdf b/shouldwetrustthissummarybayesianabstractivesummarizationtotherescue/fca15e03-48ea-496c-a5eb-c143db5241d5_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..cc7d134c588e9f2d0b2191dd42cbdf3bdf80e363 --- /dev/null +++ b/shouldwetrustthissummarybayesianabstractivesummarizationtotherescue/fca15e03-48ea-496c-a5eb-c143db5241d5_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3260ebc6379234488273a2617bd28c69d34badfec2a407e9622f27b921627a45 +size 748580 diff --git a/shouldwetrustthissummarybayesianabstractivesummarizationtotherescue/full.md b/shouldwetrustthissummarybayesianabstractivesummarizationtotherescue/full.md new file mode 100644 index 0000000000000000000000000000000000000000..8dd5cf3509d01243e85e0803a3a6c69aee1d99e9 --- /dev/null +++ b/shouldwetrustthissummarybayesianabstractivesummarizationtotherescue/full.md @@ -0,0 +1,349 @@ +# Should We Trust This Summary? Bayesian Abstractive Summarization to The Rescue + +# Alexios Gidiotis + +Aristotle University of Thessaloniki + +gidiotis@csd.auth.gr + +# Grigorios Tsoumakas + +Aristotle University of Thessaloniki + +greg@csd.auth.gr + +# Abstract + +We explore the notion of uncertainty in the context of modern abstractive summarization models, using the tools of Bayesian Deep Learning. Our approach approximates Bayesian inference by first extending state-of-the-art summarization models with Monte Carlo dropout and then using them to perform multiple stochastic forward passes. Based on Bayesian inference we are able to effectively quantify uncertainty at prediction time. Having a reliable uncertainty measure, we can improve the experience of the end user by filtering out generated summaries of high uncertainty. Furthermore, uncertainty estimation could be used as a criterion for selecting samples for annotation, and can be paired nicely with active learning and human-in-the-loop approaches. Finally, Bayesian inference enables us to find a Bayesian summary which performs better than a deterministic one and is more robust to uncertainty. In practice, we show that our Variational Bayesian equivalents of BART and PEGASUS can outperform their deterministic counterparts on multiple benchmark datasets. + +# 1 Introduction + +State-of-the-art text summarization methods have achieved remarkable performance in various benchmarks (Song et al., 2019; Dong et al., 2019; Lewis et al., 2019; Zhang et al., 2020). The majority of these methods use very large Transformer models pre-trained on language generation tasks. + +Although such methods can generate high quality summaries for texts similar to their training set, they suffer from a couple of issues when the inputs lie far from the training data distribution. They are prone to generating particularly bad outputs (Xu et al., 2020; Krysciński et al., 2020) and are usually fairly confident about them (Gal and Ghahramani, 2016; Xiao et al., 2020). These shortcomings are bound to cause problems once a summarization model is deployed to solve a practical problem. + +Since the output of automatic summarization models is usually expected to be consumed by humans, it is very important to know when such an output is of good enough quality to be served to users. In most cases, it is very much preferable to not serve an output at all, instead of serving a bad output. This will in turn increase users' trust to automated summarization systems. + +Model uncertainty is one way of detecting when a model's output is likely to be poor on the grounds of predicting far away from it's training distribution. Recent summarization methods have focused heavily on improving the overall performance, but model uncertainty has been explored very little (Xu et al., 2020). + +In addition to improving user experience, the development of uncertainty measures for summarization can pave the way for active learning approaches (Gal et al., 2017; Houlsby et al., 2011; Liu et al., 2020; Lyu et al., 2020). The value of active learning stems from the fact that obtaining labeled samples for training is hard, but it is relatively easy to obtain large amounts of unlabeled samples. Summarization is no different in this perspective, since creating good quality target summaries for training can be very costly. + +This work explores uncertainty estimation for state-of-the-art text summarization models, from a Bayesian perspective. We extend the BART (Lewis et al., 2019) and PEGASUS (Zhang et al., 2020) summarization models with Monte Carlo dropout (Gal and Ghahramani, 2016), in order to create corresponding Variational Bayesian PEGASUS (VarPEGASUS) and BART (VarBART) models. Sampling multiple summaries from those models allows us to approximate Bayesian inference in a practical way, which in turn enables us to estimate summarization uncertainty. To the best of our knowledge this is the first attempt to apply Bayesian summary generation with large Transformer models. + +Based on Bayesian approximation, we adapt the Monte Carlo BLEU variance metric (Xiao et al., 2020) to the summarization task, and investigate its efficacy as a measure of summarization uncertainty. Our findings suggest that this uncertainty metric correlates well with the quality of the generated summaries and can be effective at identifying cases of questionable quality. + +Finally, we take the summarization uncertainty study one step further, and select the summary with the lowest disagreement out of multiple summaries sampled from our Variational models. Experiments across multiple benchmark datasets show that this method consistently improves summarization performance (see Table 5), and by using it our VarPEGASUS and VarBART models achieve better ROUGE F-scores compared to their original deterministic counterparts. + +The rest of this paper is structured as follows. Section 2 discusses related work on Bayesian deep learning and uncertainty estimation methods. Section 3 presents our approach. Section 4 describes our experimental setup, while Section 5 presents and discusses the results. Finally, Section 6 concludes our work and considers its broader impact. + +# 2 Related work + +Uncertainty estimation in deep learning is a topic that has been studied extensively. Bayesian deep learning includes a family of methods that attempt to capture the notion of uncertainty in deep neural networks. Such methods have gained increased popularity in the deep learning literature and there exist multiple applications in subfields such as Computer Vision (Kendall and Gal, 2017; Litjens et al., 2017; Gal et al., 2017) and Natural Language Processing (NLP) (Siddhant and Lipton, 2020; Liu et al., 2020; Lyu et al., 2020; Xiao et al., 2020). + +Despite their obvious advantage of modeling uncertainty, the main problem with Bayesian deep learning methods is the computational cost of full Bayesian inference. To tackle this problem, Gal and Ghahramani (2016) propose using standard dropout (Srivastava et al., 2014) as a practical approximation of Bayesian inference in deep neural networks and call this method Monte Carlo dropout. Gal et al. (2017) use a convolutional neural network with Monte Carlo dropout in order to obtain an uncertainty estimate for active learning in the task of image classification. Houlsby et al. (2011) sample many networks with Monte Carlo simulation + +and propose an objective function that takes into account the disagreement and confidence of the predictions coming from these networks. + +Similar methods have also been applied to NLP. In machine translation, Xiao et al. (2020) extend the Transformer architecture with MC dropout to get a Variational Transformer, and use it to sample multiple translations from the approximate posterior distribution. They also introduce BLEUVar, an uncertainty metric based on the BLEU score (Papineni et al., 2002) between pairs of the generated translations. Lyu et al. (2020) extend the work of Xiao et al. (2020) to question answering and propose an active learning approach based on a modified BLEUVar version. Similarly, Liu et al. (2020) use a conditional random field to obtain uncertainty estimates for active learning and apply their method to named entity recognition. + +Although summarization is a prominent NLP task, summarization uncertainty has not been widely studied. Xu et al. (2020) is the only work that focuses on uncertainty for summarization, but their work does not make use of Bayesian methods. They define a generated summary's uncertainty based on the entropy of each token generated by the model during the decoding phase. Their study includes experiments on CNN/DM and XSum using the PEGASUS and BART summarization models. Their main focus is on understanding different properties of uncertainty during the decoding phase, and their work is not directly comparable to ours. + +# 3 Methods + +We first introduce Bayesian inference, in the context of deep neural networks and show how it can be used to measure uncertainty. Subsequently, we show how Bayesian inference can be applied to summarization in order to estimate the uncertainty of a summary generated for a given input. Finally, we show how Bayesian inference can be employed for producing better summaries. + +# 3.1 Monte Carlo dropout + +Contrary to standard neural networks, Bayesian probabilistic models capture the uncertainty notion explicitly. The goal of such models is to derive the entire posterior distribution of model parameters $\theta$ given training data $X$ and $Y$ (Equation 1). + +$$ +P (\theta | X, Y) = \frac {P (Y | X , \theta) P (\theta)}{P (Y | X)} \tag {1} +$$ + +At test time, given some input $x$ , a prediction $\hat{y}$ can be made by integrating over all possible $\theta$ values (Equation 2). The predictive distribution's variance can then be used as a measure of the model's uncertainty. + +$$ +P (\hat {y} | x, X, Y) = \int P (\hat {y} | x, \theta) P (\theta | X, Y) d \theta \tag {2} +$$ + +In practice, integrating over all possible parameter values for a deep neural network is intractable, and therefore Variational methods are used to approximate Bayesian inference. A neural network trained with dropout can be interpreted as a Variational Bayesian neural network (Gal and Ghahramani, 2016), and as a result making stochastic forward passes with dropout turned on at test time is equivalent to drawing from the model's predictive distribution. This Monte Carlo (MC) dropout method can be easily applied to any neural network that has been trained with dropout. + +# 3.2 Summary uncertainty + +MC dropout is a simple yet effective method that requires no adjustment to the underlying model. It is possible to convert any state-of-the-art summarization model to a Variational Bayesian model, with the use of MC dropout. For Transformer based models in particular, the Transformer blocks that make up the encoder and decoder are usually trained with dropout, and therefore the conversion is trivial by simply turning dropout on at test time. + +In Variational models, the variance of the predictive distribution can be used to measure the model's uncertainty. For a text summarization model, we can approximate the variance of this distribution, by measuring the dissimilarity of $N$ stochastic summaries $y_{1},y_{2}\ldots y_{N}$ , generated with MC dropout. + +The BLEU metric (Papineni et al., 2002) is commonly used for measuring the similarity between a pair of texts. As in Xiao et al. (2020), we approximate the model's predictive variance with the BLEU Variance (BLEUVar) metric over the $N$ summaries generated with MC dropout as shown in Equation 3. BLEUVar is computed by summing the squared complement of BLEU among all pairs of summaries (twice as BLEU is asymmetric) generated for the same input with different dropout masks. + +$$ +\operatorname {B L E U V a r} = \sum_ {i = 1} ^ {N} \sum_ {j \neq i} ^ {N} (1 - \operatorname {B L E U} \left(y _ {i}, y _ {j}\right)) ^ {2} \tag {3} +$$ + +Because we sum over all pairs of $N$ samples twice, scores that are computed with different $N$ values are not directly comparable. To alleviate this issue we propose a normalized version of the metric, BLEUVarN, where we divide BLEUVar by $N(N - 1)$ (Equation 4). This allows for comparisons between scores computed with different $N$ values. + +$$ +\operatorname {B L E U V a r N} = \frac {\sum_ {i = 1} ^ {N} \sum_ {j \neq i} ^ {N} \left(1 - \operatorname {B L E U} \left(y _ {i} , y _ {j}\right)\right) ^ {2}}{N (N - 1)} \tag {4} +$$ + +By running multiple stochastic forward passes for the same input, we essentially create an ensemble of models with different parameters. Making predictions with this ensemble has the following effects. For inputs close to the learned distribution the summaries generated by all models in the ensemble will be similar to one another, and as a result BLEUVarN will be low. On the other hand, for inputs lying away from the learned distribution, the generated summaries will differ wildly and BLEUVarN will be high, indicating high uncertainty. + +# 3.3 Bayesian summary generation + +Inspired by the fact that making multiple predictions with MC dropout is equivalent to ensembling multiple stochastic models, we propose a novel Bayesian approach to summary generation. Instead of generating a single deterministic summary without dropout, as is commonly the case with modern summarization approaches, we consider using the predictive mean of multiple predictions made with MC dropout. Because the predictions in our case are summaries their predictive mean is not well defined, so instead we opt for selecting one of the $N$ summaries. + +We assume that the predictive mean of the $N$ summaries generated with MC dropout should be the one having the lowest disagreement with the rest of the $N - 1$ summaries. Since the pairwise complement of BLEU between all pairs of the sampled summaries has already been computed when estimating BLEUVarN uncertainty, it can be further used to help us find the lowest disagreement summary. In practice, we select the summary $\hat{\mu}$ that maximizes the sum of symmetric BLEU similarity with the rest of the summaries (Equation 5) (Xiao et al., 2020). This summary could be seen as the median of all the summaries generated with MC dropout, although this is not a mathematically + +correct expression. + +$$ +\hat {\mu} = \operatorname {a r g m a x} _ {y _ {i}} \sum_ {j \neq i} ^ {N} \left[ \mathrm {B L E U} \left(y _ {i}, y _ {j}\right) + \mathrm {B L E U} \left(y _ {j}, y _ {i}\right) \right] \tag {5} +$$ + +The intuition behind this approach is based on the following assumption. We expect the median summary to integrate the key concepts that all individual summaries agree on. Consequently, for inputs close to the model's learned distribution, the individual summaries will be similar to one another and as a result the median summary will be the best choice. On the other hand, for out-of-distribution inputs, the median out of a number of very different summaries will result in a more robust and overall better final summary. In practice, even for well trained models, we expect to have a fairly large number of inputs that are not close to the models' learned distribution, and therefore we expect to benefit from the positive effects of ensembling multiple outputs. + +# 4 Experimental Setup + +We first present the three datasets that are involved in our experiments, their main statistics and the reasons for including them in our empirical study. Then we present the two summarization models that we employed, along with their parameters and details on stochastic summary generation. + +# 4.1 Datasets + +In order to verify the effectiveness of our Bayesian abstractive summarization approach, we conducted a series of experiments on three well-known summarization benchmarks: + +- XSum (Narayan et al., 2018) is a dataset of 227k BBC articles on a wide variety of topics. Each article is accompanied by a human written, single-sentence summary. +- CNN/DailyMail (Hermann et al., 2015) is a dataset containing a total of 93k articles from the CNN, and 220k articles from the Daily Mail newspapers. All articles are paired with bullet point summaries. The version used is the non-anonymized variant similar to (See et al., 2017). +- AESLC (Zhang and Tetreault, 2020) is a dataset of 18k emails from the Enron corpus (Klimt and Yang, 2004). The body of each + +Table 1: Basic statistics for each one the datasets used in our experiments. The document and summary length are measured in words. + +
DatasetSizeLength
Val.TestDoc.Sum.
XSum11,33211,33443123
CNN/DM13,36811,49076046
AESLC1,9601,906754
+ +email is used as source text and the subject as summary. + +The main criteria for selecting these datasets are the availability of recent, open source models trained on them and their relatively short texts that would allow us to run a number of different experiments quickly. Since our methods do not involve training, we will only focus on the validation and test set of each dataset. All datasets are obtained from the Hugging Face datasets repository1. Table 1 presents some basic statistics for these datasets. + +# 4.2 Models + +BART (Lewis et al., 2019) and PEGASUS (Zhang et al., 2020) are Transformer based sequence-to-sequence models, pre-trained on massive corpora of unsupervised data (Web and news articles). Since our experiments do not involve training, we utilize open-source models fine-tuned on the training set of each dataset. These models can be found in the Hugging Face models repository2. + +Our BART models follow the $\mathrm{BART}_{\mathrm{LARGE}}$ architecture with 12 Transformer blocks for the encoder and the decoder. BART is pre-trained as a denoising autoencoder, where the text is corrupted and the model learns to reconstruct the original text. Open-source fine-tuned BART models are only available for XSum and CNN/DM. Our PEGASUS models follow the $\mathrm{PEGASUS}_{\mathrm{LARGE}}$ architecture and have 16 Transformer blocks for the encoder and the decoder. PEGASUS is pre-trained on the C4 and HugeNews datasets, on a sentence infilling task. Open-source fine-tuned PEGASUS models exist for all three datasets considered in our experiments. + +In order to convert BART and PEGASUS to Variational models, we enable dropout for all Transformer blocks of the encoder and decoder. For each sample, we generate $N$ summaries using beam + +search decoding with 8 beams. We experimented with $N$ equal to 10 (MC-10) and 20 (MC-20). The rest of the hyper-parameters used were identical to the original papers. + +# 5 Results + +Our main experiment evaluates BLEUVarN's effectiveness in quantifying uncertainty for summarization models. A second experiment investigates the potential of the Bayesian summarization method proposed in Section 3.3 as a way of improving summarization performance at test time. + +# 5.1 Evaluating Bayesian uncertainty + +We here evaluate the effectiveness of BLEUVarN in measuring the model's uncertainty. The performance versus data retention curve (Filos et al., 2019) measures how well a model would perform if we completely removed the $k\%$ most uncertain outputs from the test set. In the $x$ -axis we have the fraction of data from the test set that are removed, while in the $y$ -axis we have the performance metrics. An effective uncertainty measure should show a consistent improvement in performance as we discard more samples based on high uncertainty. In this experiment, we arrange samples by decreasing BLEUVarN score and gradually remove the samples with the highest score. + +Figure 1 shows, for each dataset, the performance of our Variational models in terms of ROUGE-1 F-score versus the fraction of data discarded based on BLEUVarN. ROUGE-2 and ROUGE-L F-scores follow similar patterns and can be found in the Appendix A. For reference, we are also plotting the performance of the deterministic models using all data as straight lines. Also, in Table 2 we quantify the percentage increase in ROUGE F-scores as we discard different fractions of the full test datasets based on BLEUVarN. + +All ROUGE F-scores improve as we gradually discard samples with high BLEUVarN, an observation that is consistent across all test datasets and models. More specifically, we notice that the increase is linear for the first $80\%$ of the data, but then becomes almost exponential. From these observations we can draw two conclusions. First, models indeed perform significantly worse on samples with high uncertainty. Second, BLEUVarN is effective at quantifying uncertainty and can be used to identify high uncertainty samples. + +Furthermore, we notice that the performance + +Table 2: Percentage increase in ROUGE F-scores when discarding $25\%$ , $50\%$ and $75\%$ of the data based on the highest BLEUVarN. + +
Model25% R-1/R-2/R-L50% R-1/R-2/R-L75% R-1/R-2/R-L
XSum
VarBart-106.4/13.8/8.312.2/25.2/15.422.1/41.9/26.1
VarBart-206.5/14.1/8.313.2/26.7/16.522.5/42.6/27.2
VarPegasus-107.5/15.8/9.614.9/29.4/18.625.2/4.9/29.9
VarPegasus-208.0/16.8/10.315.8/31.2/19.626.3/48.1/31.2
CNN/DM
VarBart-102.9/7.2/4.85.4/13.1/8.58.8/20.4/13.3
VarBart-203.2/7.8/5.15.3/12.8/8.58.3/19.4/12.6
VarPegasus-104.1/9.9/6.17.8/17.4/10.912.6/26.1/16.8
VarPegasus-204.6/10.7/6.88.5/19.0/11.914.7/29.6/18.7
AESLC
VarPegasus-1017.5/33.5/17.730.6/51.9/31.154.4/75.0/54.7
VarPegasus-2018.7/36.3/18.936.0/59.7/36.658.4/78.0/58.8
+ +increase is significantly higher in the XSum and AESLC datasets compared to CNN/DM. In particular, VarPEGASUS-20 shows a staggering 58 point increase in ROUGE-1 score. We think that this difference might be related to the more extractive nature of CNN/DM summaries as opposed to the other two datasets. Such a finding would mean that Bayesian uncertainty filtering is more beneficial in abstractive rather than extractive setups. + +To further illustrate how BLEUVarN behaves across different parts of the data, Figure 2 shows the decrease in the average BLEUVarN of all Variational models as we gradually discard samples with low ROUGE-1 scores from each dataset. We observe that for the samples with the highest ROUGE performance BLEUVarN becomes almost zero. This observation further supports our argument that model uncertainty has a significant impact on model performance. + +# 5.1.1 MC-10 vs MC-20 + +From Figure 1 we can see that MC dropout with 20 samples performs better than 10 samples, resulting in higher performance. In more detail, for highly uncertain data, both MC-10 and MC-20 converge to similar BLEUVarN values (Figure 2) as well as ROUGE scores (Figure 1). On the other side of the spectrum, for low uncertainty data, using 20 samples leads to bigger performance increase along with a little higher BLEUVarN scores. + +Based on these observations, we conclude that MC dropout with 20 samples is generally better in terms of performance. This comes at the cost of increased computational overhead because it requires running twice as many stochastic passes with + +![](images/503286bf0ed6c0d0eba1050ee29dee7178b810f9101464f895bc6082dac3582a.jpg) +Figure 1: ROUGE-1 scores vs fraction of data discarded due to high BLEUVarN. The straight dashed lines indicate the performance level of the deterministic PEGASUS and BART models. + +![](images/4d32d84cf912f1cdd05c2c4146322ae1607623ec4f1b6bfdd5f6f4521a7d3ab7.jpg) + +![](images/a4dad6aa0b6d8c9b45419580a7327361c786c0a2c9a0387b42187baaba41e724.jpg) + +![](images/843bab8087289610fce548a3a3794c336f991d8037b5be68fffde2b598044a1e.jpg) +Figure 2: BLEUVarN curves as a function of data discarded due to low ROUGE-1 scores. + +![](images/f0255106cec6f005dd53196343f919b6b9df355e5f4fb5e16677a99f1eb15c48.jpg) + +![](images/9f13e4eaa11ddded11b8deea8359392d2442d3ee68eebdb2e6ce225280a3c9cf.jpg) + +MC dropout. However, this computation is embarrassingly parallelizable in modern hardware, and can be easily optimized by batching MC dropout generations with different dropout masks for each sample within the batch. + +Although we have shown that MC dropout with 20 samples performs better than 10 samples, we observed that further increasing this number, for example to 30 or 50 samples, was beginning to bring diminishing returns. Furthermore, the performance increase we got by using 10 and 20 samples was substantial enough while the runtimes for MC dropout with more samples were becoming a lot longer. For these reasons we refrained from increasing it even further in order to keep computational capacity manageable. + +# 5.1.2 VarBART vs VarPEGASUS + +Out of the two models, VarPEGASUS is consistently showing the biggest increase in performance as more uncertain samples are dropped from the dataset. It should be noted here, that the decline in performance as data uncertainty increases, is much steeper for VarBART than it is for VarPEGASUS on both the XSum and the CNN/DM dataset. This coincides with the fact that VarPEGASUS also has much higher BLEUVarN uncertainty as shown in Figure 2, which hints us that the PEGASUS model is in general less confident about the outputs it generates. Anecdotally, we can say here that PE-GASUS is more aware of the things it does not know, and as a result it seems to benefit more from the uncertainty estimates. + +# 5.2 Bayesian vs deterministic summarization + +The next experiment focuses on the Bayesian summarization method proposed in Section 3.3. We compare the performance of Bayesian summarization using the VarBART and VarPEGASUS models against the standard summarization paradigm using the deterministic BART and PEGASUS models. Our goal is to verify the efficacy of Bayesian summarization as a post-hoc way of improving summarization performance. + +Table 3 reports the ROUGE-1, ROUGE-2 and ROUGE-L F-scores of our VarBART and VarPEGASUS models along with the deterministic BART and PEGASUS models on all benchmark datasets, re-evaluated for consistency. The results show that Bayesian summarization is effective, with both VarBART and VarPEGASUS outperforming their deterministic counterparts on all datasets. Furthermore, increasing the number, $N$ , of samples generated during the Bayesian inference, improves performance for all datasets except for AESLC, at the cost of increased computational complexity as discussed in Section 5.1. + +Note that our goal in this work was not to compete with other state-of-the-art models. What we want to show is that relying on the agreement between multiple Bayesian summaries for the same input, is an effective way to boost the summarization performance of deterministic models. Also, this is a post-hoc method and does not involve training new models, which makes it easily applicable to many different scenarios. + +Figure 3 plots the difference in ROUGE-1 of each Variational model with its deterministic counterpart versus the fraction of the data discarded due to high uncertainty. Similar plots for ROUGE-2 and ROUGE-L can be found in Appendix A. Positive values indicate that the Variational model achieves a higher score than the deterministic one. These plots give us a better view of how the Variational models fare against the deterministic ones for different levels of uncertainty. As far as we know, this is the first study to directly compare Variational and deterministic models on data with varying levels of uncertainty. + +Looking at the curves, we clearly see that the differences are positive for most uncertainty levels but start decreasing as more data with high uncertainty are discarded. For the top $10\% - 20\%$ most certain samples we start seeing a fluctuation between positive and negative values. This pattern is in line + +with the observations made in Figure 1, and leads us to believe that there is a significant gap between the deterministic model's performance on the $20\%$ most certain samples and the rest of the data. + +These observations lead us to the following conclusions. For samples of very low uncertainty, we can expect both Variational and deterministic models to converge to equally good outputs. In contrast, as uncertainty becomes higher, we observe a clear advantage of the Variational summaries over the deterministic ones. This pattern is consistent across all models and datasets, and underpins our case that Bayesian summarization is beneficial for the majority of inputs. + +# 5.3 Qualitative analysis + +In order to better illustrate our findings in this work, we present a couple of real examples from VarPEGASUS-10 on XSum. For each example, we show the 10 sample summaries generated with MC dropout for the same input, as well as the corresponding BLEUVarN score. We have highlighted the median summary in bold typeface and for the sake of comparison we also show the summary generated by the deterministic PEGASUS model. + +The first example (Table 4) is a case of high uncertainty from the XSum dataset. We can see that all 10 samples are considerably different from one another, which leads to a high BLEUVarN score. In contrast, the second example (Table 5) has much lower uncertainty. In this case all 10 samples seem to mostly agree on the main points and as a result BLEUVarN is fairly low. Here, the median summary is the one that represents better this agreement. + +Looking at the ROUGE-1 score for both examples we can see there's a rather drastic difference as well. For the sample in Table 4 we can see that neither the deterministic nor the Bayesian summary show a strong performance, yet even in that case the median Bayesian summary scores a bit higher. On the other hand, the sample in Table 5 showcases a solid performance from both the deterministic and the Bayesian summary. Here it is evident that the median Bayesian summary is close but slightly better than the deterministic summary in terms of ROUGE. + +# 6 Conclusions and future work + +This work explored Bayesian methods in the context of text summarization. We extended state-of + +Table 3: A comparison of our VarBART and VarPEGASUS models against the deterministic BART and PEGASUS. + +
ModelXSumCNN/DMAESLC
R-1R-2R-LR-1R-2R-LR-1R-2R-L
BART42.6920.6635.2942.3220.2836.21---
VarBART-1042.9720.8635.5642.6520.6436.56---
VarBART-2043.0720.9735.6842.7620.7636.69---
PEGASUS44.9023.3337.7441.6820.2436.1735.9720.2835.09
VarPEGASUS-1044.9323.5438.0142.0420.7536.7636.3621.4035.58
VarPEGASUS-2045.3223.8738.2942.2520.9836.9436.4121.0035.53
+ +![](images/b8cae8a4c5ac04f92d47d3d0d2a3f8cc63d444c6a86295b7681aaa777b849946.jpg) +Figure 3: Difference in ROUGE-1 between Variational models and their deterministic counterparts versus the fraction of data discarded. Positive values indicate that deterministic ROUGE-1 is lower than Variational. + +![](images/413c711fbb4eac66efa2c60c0ad0ea3a4cb788850ddae0018be4b302ea497ae7.jpg) + +![](images/28f147216ef038ab648b14962c7b45b2729bc514ea07c54762d515002d08bd90.jpg) + +the-art summarization models with MC dropout to approximate Bayesian inference, and demonstrated how BLEUVarN can be used to quantify model uncertainty. This allows us to effectively identify high uncertainty summaries at prediction time, which can be a significant advantage. + +Furthermore, we show that ensembling multiple stochastic summaries generated by Variational Bayesian models can lead to improved performance compared to similar deterministic models. This finding is verified by experiments for two different models and across 3 benchmark datasets. + +It should be noted here that the proposed methods are directly applicable to other abstractive summarization datasets as well. We acknowledge that some of the more interesting summarization problems involve much longer summaries, for example scientific abstracts. In this work we focused on datasets of short summaries in order to be more resource efficient and conduct more experiments. There's a lot of interesting work that focuses on the summarization of longer documents (Gidgetis + +and Tsoumakas, 2020; Zaheer et al., 2020) that could potentially be applied in combination with the methods we propose here. + +Our work can have a broader impact in several ways. To the research community, being the first work to study Bayesian uncertainty for abstractive summarization and paving the way for other similar methods. To the industry, because it improves automatic summarization systems and can be paired nicely with active learning and human-in-the-loop approaches. Finally, to the end users, improving their experience and building up confidence towards automatic summarization systems. + +# References + +Li Dong, Nan Yang, Wenhui Wang, Furu Wei, Xiaodong Liu, Yu Wang, Jianfeng Gao, Ming Zhou, and Hsiao-Wuen Hon. 2019. Unified language model pre-training for natural language understanding and generation. In Advances in Neural Information Processing Systems, pages 13042-13054. Curran Associates, Inc. + +Table 4: High uncertainty example from the XSum dataset. Sample summary (1), in bold typeface, is the median summary according to our approach. + +# Bayesian samples: + +1. When John Choe launched his first hotel in Singapore, he had no idea what he was getting himself into. (R1: 22.22) +2. When Singapore's Frasers Centre hired him as its first managing director, he was told it would take him five years to get off the ground. +3. In his early 20s, when he was working as a waiter in a luxury hotel in Hong Kong, David Choe always dreamed of running his own business. +4. "When I was a teenager, I used to say to myself 'I want to start my own company'." +5. When John Choe was appointed chief executive of a Singapore-based property firm in the early 1990s, he said he wanted to "make a difference to people's lives". +6. When David Choe was asked if he would ever run a hotel company, he thought it would be a good idea. +7. "I always wanted to be a hotelier," says Fraser Choe. +8. As a young entrepreneur with no experience in hospitality, John Choe had no idea what he was about to achieve. +9. ). +10. "When I started the company, I said 'let's see what we can do, let's see what we can achieve, let's see what we can achieve'." + +Deterministic summary: When Choe Swee Swee was appointed chief executive of one of Singapore's biggest property firms, he told the BBC he wanted to "make the world a better place". (R1: 21.81) + +Target summary: On the first day in his new job, Choe Peng Sum was given a fairly simple brief: "Just go make us a lot of money." + +BLEU variance: 0.96 + +Angelos Filos, Sebastian Farquhar, Aidan N. Gomez, Tim G.J. Rudner, Zachary Kenton, Lewis Smith, Milad Alizadeh, Arnoud De Kroon, and Yarin Gal. 2019. A systematic comparison of Bayesian deep learning robustness in diabetic retinopathy tasks. + +Yarin Gal and Zoubin Ghahramani. 2016. Dropout as a Bayesian approximation: Representing model uncertainty in deep learning. In 33rd International Conference on Machine Learning, ICML 2016, volume 3, pages 1050-1059. PMLR. + +Yarin Gal, Riashat Islam, and Zoubin Ghahramani. 2017. Deep Bayesian active learning with image data. In 34th International Conference on Machine Learning, ICML 2017, volume 3, pages 1183-1192. PMLR. + +Table 5: Low uncertainty example from XSum. Sample summary (7), in bold typeface, is the median summary selected according to our approach. In the parentheses we show the ROUGE-1 score for the median Bayesian summary and the deterministic summary. + +# Bayesian samples: + +1. Torquay United have signed Torquay United have signed Myles Keating. +2. Torquay United have signed defenders Myles Anderson and Ruairi Keating. +3. National League side Torquay United have signed defender Lewis Anderson and striker Ruairi Keating. +4. Torquay United have signed defender Liam Anderson on a deal until the end of the season, while winger Ruairi Keating has joined until the end of the season. +5. Torquay United have signed defender Matt Anderson on a two-and-a-half-year deal and brought in Republic of Ireland striker Myles Keating on a short-term deal. +6. Torquay United have signed defender James Anderson and striker Myles Keating. +7. Torquay United have signed defender Myles Anderson and striker Ruairi Keating. (R1: 62.5) +8. Torquay United have signed defender Lewis Anderson and striker Ruairi Keating. +9. Torquay United have loaned defender Myles Anderson. +10. National League challengers Torquay United have signed defender Lewis Anderson on a two-and-a-half-year deal and Irish striker Ruairi Keating until the end of the season. + +Deterministic summary: Torquay United have signed defender Myles Anderson and striker Ruairi Keating until the end of the season. (R1: 52.63) + +Target summary: Torquay United have signed Barrow defender Myles Anderson on a permanent deal, and Irish forward Ruairi Keating on non-contract terms. + +BLEU variance: 0.38 + +Alexios Gidiotis and Grigorios Tsoumakas. 2020. A Divide-and-Conquer Approach to the Summarization of Long Documents. IEEE/ACM Transactions on Audio Speech and Language Processing, 28. + +Karl Moritz Hermann, Tomas Kocisky, Edward Grefenstette, Lasse Espeholt, Will Kay, Mustafa Suleyman, and Phil Blunsom. 2015. Teaching machines to read and comprehend. In Advances in Neural Information Processing Systems, pages 1693-1701. Curran Associates, Inc. + +Neil Houlsby, Ferenc Huszar, Zoubin Ghahramani, and Mate Lengyel. 2011. Bayesian active learning for classification and preference learning. + +Alex Kendall and Yarin Gal. 2017. What uncertainties + +do we need in Bayesian deep learning for computer vision? In Advances in Neural Information Processing Systems, volume 2017-December, pages 5580-5590. Curran Associates, Inc. +Bryan Klimt and Yiming Yang. 2004. The enron corpus: A new dataset for email classification research. In Lecture Notes in Artificial Intelligence (Subseries of Lecture Notes in Computer Science), volume 3201, pages 217-226, Berlin, Heidelberg. Springer Berlin Heidelberg. +Wojciech Krysciński, Bryan McCann, Caiming Xiong, and Richard Socher. 2020. Evaluating the factual consistency of abstractive text summarization. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing, EMNLP 2020, pages 9332-9346. Association for Computational Linguistics. +Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov, and Luke Zettlemoyer. 2019. BART: Denoising sequence-to-sequence pretraining for natural language generation, translation, and comprehension. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 7871-7880. Association for Computational Linguistics. +Geert Litjens, Thijs Kooi, Babak Ehteshami Bejnordi, Arnaud Arindra Adiyoso Setio, Francesco Ciompi, Mohsen Ghafoorian, Jeroen A.W.M. van der Laak, Bram van Ginneken, and Clara I. Sánchez. 2017. A survey on deep learning in medical image analysis. +Mingyi Liu, Zhongjie Wang, Zhiying Tu, and Xiaofei Xu. 2020. LTP: a new active learning strategy for BERT-CRF based named entity recognition. +Zhihao Lyu, Danier Duolikun, Bowei Dai, Yuan Yao, Pasquale Minervini, Tim Z Xiao, and Yarin Gal. 2020. You Need Only Uncertain Answers: Data Efficient Multilingual Question Answering. In Workshop on Uncertainty and Robustness in Deep Learning. +Shashi Narayan, Shay B. Cohen, and Mirella Lapata. 2018. Don't give me the details, just the summary! Topic-aware convolutional neural networks for extreme summarization. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, EMNLP 2018, pages 1797-1807, Brussels, Belgium. Association for Computational Linguistics. +Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. 2002. BLEU: a method for automatic evaluation of machine translation. In Proceedings of the 40th annual meeting on association for computational linguistics, pages 311-318. Association for Computational Linguistics. +Abigail See, Peter J Liu, and Christopher D Manning. 2017. Get To The Point: Summarization with + +Pointer-Generator Networks. In Proceedings of the 2017 Annual Meeting of the Association for Computational Linguistics, pages 1073-1083. Association for Computational Linguistics. +Aditya Siddhant and Zachary C. Lipton. 2020. Deep Bayesian active learning for natural language processing: Results of a large-scale empirical study. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, EMNLP 2018, pages 2904-2909, Brussels, Belgium. Association for Computational Linguistics. +Kaitao Song, Xu Tan, Tao Qin, Jianfeng Lu, and Tie Yan Liu. 2019. MASS: Masked sequence to sequence pre-training for language generation. In Proceedings of the 2019 International Conference on Machine Learning, pages 5926-5936. PMLR. +Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. 2014. Dropout: A simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, 15:1929-1958. +Tim Z. Xiao, Aidan N. Gomez, and Yarin Gal. 2020. Wat zei je? Detecting out-of-distribution translations with variational transformers. +Jiacheng Xu, Shrey Desai, and Greg Durrett. 2020. Understanding Neural Abstractive Summarization Models via Uncertainty. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing, pages 6275-6281. Association for Computational Linguistics. +Manzil Zaheer, Guru Guruganesh, Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Ontonon, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, and Amr Ahmed. 2020. Big bird: Transformers for longer sequences. In Advances in Neural Information Processing Systems, volume 2020-December. +Jingqing Zhang, Yao Zhao, Mohammad Saleh, and Peter J Liu. 2020. PEGASUS: Pre-training with Extracted Gap-sentences for Abstractive Summarization. In 37th International Conference on Machine Learning, ICML 2020, pages 11328-11339. PMLR. +Rui Zhang and Joel Tetreault. 2020. This email could save your life: Introducing the task of email subject line generation. In ACL 2019 - 57th Annual Meeting of the Association for Computational Linguistics, Proceedings of the Conference, pages 446-456. Association for Computational Linguistics. + +# A Appendix + +Figures 4 and 5 show the performance versus data retention curves of our Variational models in terms of ROUGE-2 and ROUGE-L F-score respectively. The observations here are similar to Figure 1. + +Figures 6 and 7 show the differences in ROUGE-2 and ROUGE-L performance of the Variational + +![](images/462705b04dc38ebb6f8e5704166148094888402a8e06a5ae0fcd1b1595b0f967.jpg) +Figure 4: ROUGE-2 scores vs fraction of data discarded due to high BLEUVarN. The straight dashed lines indicate the performance level of the deterministic PEGASUS and BART models. + +![](images/4720042924920fe3e535c9bdeeecadc96952de18e334de7201f7328d895fada5.jpg) + +![](images/bbb038c93d03fef534c70416fe52b9418682de97bb15b473749cc6b886672a8d.jpg) + +![](images/08b021285bb5ffb65bd7115ee18d401cdbe982a4967ee78d75d829fa39488c1b.jpg) +Figure 5: ROUGE-L scores vs fraction of data discarded due to high BLEUVarN. The straight dashed lines indicate the performance level of the deterministic PEGASUS and BART models. + +![](images/5cfc120a1f85d38f76d64b49c5abed20677f5b7aac907d25c0cd2df7d3d5a93b.jpg) + +![](images/138915d871dc7b2a77bef959624ed26929069259e7a32fbc044c0901ce69d211.jpg) + +models versus the deterministic ones. What we see here is in aggreement with Figure 3. + +![](images/a6c16d911086fdf3d2bbcf5b59c0db7e21415514079df09e937c22dc6c5c34b0.jpg) +Figure 6: Difference in ROUGE-2 between Variational models and their deterministic counterparts versus the fraction of data discarded. Positive values indicate that deterministic ROUGE-2 is lower than Variational. + +![](images/51f3aee8e5d5341c8ba2b28f6cdd917182dcbb9173d67a1a3ebffc85e6aac2f6.jpg) + +![](images/78dbaa6a3c113c369f73c812f02ee0b8f8e66dfc1e0d9934b06c8211d64a4ad4.jpg) + +![](images/619aad1cf944d3ace4b766dc20624a91dfe1071271177f676950a1fe82e4dfa2.jpg) +Figure 7: Difference in ROUGE-L between Variational models and their deterministic counterparts versus the fraction of data discarded. Positive values indicate that deterministic ROUGE-L is lower than Variational. + +![](images/3bf5ea0c52c7b9b03a5c06207ef652af1733c43bb36450de94a08786f85fd1be.jpg) + +![](images/10d55cffa1254788ae7d97c4cafbb30efc9acb76c8fe850f94751c2a98aff993.jpg) \ No newline at end of file diff --git a/shouldwetrustthissummarybayesianabstractivesummarizationtotherescue/images.zip b/shouldwetrustthissummarybayesianabstractivesummarizationtotherescue/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..3df9a80e0d230d0af70b90d18fbe732ea3dccf92 --- /dev/null +++ b/shouldwetrustthissummarybayesianabstractivesummarizationtotherescue/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:97a5f8dba7e10a0525fde9d9eb30a2a643b31644cd8071ef387f698f3bc519eb +size 625874 diff --git a/shouldwetrustthissummarybayesianabstractivesummarizationtotherescue/layout.json b/shouldwetrustthissummarybayesianabstractivesummarizationtotherescue/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..ada9513592ee65e282652b318bbb27ceaf8368a8 --- /dev/null +++ b/shouldwetrustthissummarybayesianabstractivesummarizationtotherescue/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8156a06d4e63ff87e527beafaa28ce01158b058591f73ac482bb9b9611de4d45 +size 342374 diff --git a/sibylvarianttransformationsforrobusttextclassification/f1d06319-e97f-45ce-bfd2-121a19d45309_content_list.json b/sibylvarianttransformationsforrobusttextclassification/f1d06319-e97f-45ce-bfd2-121a19d45309_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..2aa71e05b7fc6416cf6d32b59c584fb3180111e5 --- /dev/null +++ b/sibylvarianttransformationsforrobusttextclassification/f1d06319-e97f-45ce-bfd2-121a19d45309_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b3a2af2b46c0eba3e1de57ba0f33122bdb596f145cc099a8165aa9b0226dd554 +size 111485 diff --git a/sibylvarianttransformationsforrobusttextclassification/f1d06319-e97f-45ce-bfd2-121a19d45309_model.json b/sibylvarianttransformationsforrobusttextclassification/f1d06319-e97f-45ce-bfd2-121a19d45309_model.json new file mode 100644 index 0000000000000000000000000000000000000000..39895c8b0a2288bee40085bed1f75835816ccc1e --- /dev/null +++ b/sibylvarianttransformationsforrobusttextclassification/f1d06319-e97f-45ce-bfd2-121a19d45309_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3349f85e286453ab804f28375cf797b537103892ac48723643074e557c0702a4 +size 133089 diff --git a/sibylvarianttransformationsforrobusttextclassification/f1d06319-e97f-45ce-bfd2-121a19d45309_origin.pdf b/sibylvarianttransformationsforrobusttextclassification/f1d06319-e97f-45ce-bfd2-121a19d45309_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b197f33da33759287660184cc85773434752fc4b --- /dev/null +++ b/sibylvarianttransformationsforrobusttextclassification/f1d06319-e97f-45ce-bfd2-121a19d45309_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6888f3e0d89dacc3090d8afaf833604693e3df76cc3781d805c0bc8913b0c6bd +size 2431636 diff --git a/sibylvarianttransformationsforrobusttextclassification/full.md b/sibylvarianttransformationsforrobusttextclassification/full.md new file mode 100644 index 0000000000000000000000000000000000000000..e9da42dacab14002a1703e6f128e87c511cd7947 --- /dev/null +++ b/sibylvarianttransformationsforrobusttextclassification/full.md @@ -0,0 +1,416 @@ +# Sibylvariant Transformations for Robust Text Classification + +Fabrice Harel-Canada $^{1}$ , Muhammad Ali Gulzar $^{2}$ , Nanyun Peng $^{1}$ , Miryung Kim $^{1}$ + +1Computer Science Department, University of California, Los Angeles + +2Computer Science Department, Virginia Tech + +{fabricehc, violetpeng, miryung}@cs.ucla.edu, gulzar@cs.vt.edu + +# Abstract + +The vast majority of text transformation techniques in NLP are inherently limited in their ability to expand input space coverage due to an implicit constraint to preserve the original class label. In this work, we propose the notion of sibylvariance (SIB) to describe the broader set of transforms that relax the label-preserving constraint, knowably vary the expected class, and lead to significantly more diverse input distributions. We offer a unified framework to organize all data transformations, including two types of SIB: (1) Transmutations convert one discrete kind into another, (2) Mixture Mutations blend two or more classes together. To explore the role of sibylvariance within NLP, we implemented 41 text transformations, including several novel techniques like Concept2Sentence and SentMix. Sibylvariance also enables a unique form of adaptive training that generates new input mixtures for the most confused class pairs, challenging the learner to differentiate with greater nuance. Our experiments on six benchmark datasets strongly support the efficacy of sibylvariance for generalization performance, defect detection, and adversarial robustness. + +# 1 Introduction + +Automatically generating new data is a critical component within modern machine learning pipelines. During training, data augmentation can expose models to a larger portion of potential input space, consistently leading to better generalization and performance (Simard et al., 1998; Krizhevsky et al., 2012; Perez and Wang, 2017). After training, creating effective test instances from existing data can expose specific model failure modes and provide actionable corrective feedback (Zhang et al., 2019; Ribeiro et al., 2020). + +While many techniques can artificially expand labeled training sets or test suites, nearly all of them + +are class-preserving. That is to say, the model outputs are invariant (INV) with respect to the transformations. This cautious constraint ensures the new data does not lie in an out-of-distribution null class which might impede the learning objective. However, it also requires more conservative transforms that inherently limit the degree of diversification. + +In this work, we propose and extensively investigate the potential of sibylvariant (SIB) transformations that knowably vary the expected class. From the Greek sibyls, or oracles, the term parallels the oracle construction problem in software testing (Barr et al., 2015). In a nutshell, sibylvariants either fully transmute a datum from one class $c_{i}$ to another $c_{j}$ , or mix data from multiple classes together to derive a new input with a soft label that reflects the mixed membership. In this way, SIB can more strongly perturb and diversify the underlying distribution. Moreover, SIB makes possible a new type of adaptive training by synthesizing data from frequently confused class pairs, challenging the model to differentiate with greater refinement. + +In the following sections, we position SIB within a broader conceptual framework for all data transforms (Section 2) and highlight several newly proposed techniques (Section 3). To support a comprehensive evaluation of how SIB may complement or even surpass its INV counterparts, we implemented 41 new and existing techniques into an open source tool called Sibyl. Equipped with the framework and tool, we evaluate 3 central research questions: + +- RQ1. Generalization Performance. Does training on SIB-augmented data improve model accuracy on the original test set? +- RQ2. Defect Detection. For models trained on the original dataset, how effective are SIB tests at inducing misclassifications? +- RQ3. Adversarial Robustness. Are models trained on SIB-augmented data more robust to existing adversarial attack algorithms? + +Our comprehensive evaluation encompasses 6 text classification datasets, 11 transformation pipelines, and 3 different levels of data availability. In total, we trained 216 models and generated over 30 million new training inputs, 480,000 testing inputs, and 3,300 adversarial inputs. In the generalization study, SIB attained the highest accuracies in $89\%$ (16 out of 18) of experimental configurations, with the adaptive mixture mutations being the most consistently effective. SIB also revealed the greatest number of model defects in $83\%$ (5 out of 6) of the testing configurations. Lastly, of all the experimental configurations where adversarial robustness was improved over the no-transform baseline, $92\%$ (11 out of 12) of them involved SIB. Overall, our findings strongly support the efficacy of sibylvariance for generalization performance, defect detection, and adversarial robustness. + +Lastly, we describe how SIB may operate theoretically and discuss potential threats to validity (Section 5) before contrasting it with related work (Section 6). The source code for Sibyl and our experiments is available at: https://github. com/UCLA-SEAL/Sibyl. + +# 2 Sibylvariance + +All data transformations in the classification setting can be categorized into one of two types: + +- Invariant (INV) preserves existing labels. + +$$ +\left\{T _ {I N V} \left(X _ {i}\right), y _ {i} \right\}\rightarrow \left\{X _ {j}, y _ {i} \right\} \tag {1} +$$ + +$$ +w h e r e X _ {i} \neq X _ {j} +$$ + +For example, contracting "What is the matter?" to "What's the matter?" should preserve a model behavior for sentiment analysis. + +- Sibylvariant (SIB) changes an existing label in a knowable manner. + +$$ +T _ {S I B} \left(\left\{X _ {i}, y _ {i} \right\}\right)\rightarrow \left\{X _ {j}, y _ {j} \right\} \tag {2} +$$ + +where $X_{i}\neq X_{j}$ and $y_{i}\neq y_{j}$ + +SIB transforms both the input $X_{i}$ to $X_{j}$ and the output label from $y_{i}$ to $y_{j}$ label, corresponding to the new $X_{j}$ ; such transformation is analogous to mutating an input and setting a corresponding oracle in metamorphic testing (Chen et al., 2020b). For example, performing a verb-targeted antonym substitution on "I love pizza." to generate "I hate pizza." has the effect of negating the original semantics and will knowably affect the outcome of binary sentiment analysis + +It is important to note that transformation functions are not inherently INV nor SIB. The same exact transformation may have a different effect on expected model behavior depending on the particular classification task. For example, random word insertions generally have an INV effect on topic classification tasks, but would be SIB with respect to grammaticality tasks (Warstadt et al., 2018). + +# 2.1 Sibylvariant Subtypes + +SIB can be further refined based on the types and degree of semantic shift in newly generated data: + +- Transmutation changes one discrete kind into another, excluding the existing label, $L \backslash \{y_i\}$ , + +$$ +T _ {S I B} \left(\left\{X _ {i}, y _ {i} \right\}\right)\rightarrow \left\{X _ {j}, y _ {j} \right\} \tag {3} +$$ + +where $X_{i}\neq X_{j}$ and $y_{j}\in L\backslash \{y_{i}\}$ + +Critically, the newly created data points retain stylistic and structural elements of the original that help boost diversity. + +- Mixture Mutation mixes inputs from multiple classes and interpolates the expected behavior into a mixed label distribution (i.e. soft label). Equivalently, we have: + +$$ +T _ {S I B} (\{X _ {i}, y _ {i} \}) \to \{X _ {j}, y _ {j} \} +$$ + +$$ +\text {w h e r e} X _ {i} \neq X _ {j} \text {a n d} y _ {j} \in \bigcap_ {l} ^ {| L |} \lambda_ {l} \tag {4} +$$ + +where the final term indicates a $\lambda$ -degree of membership in each label $l$ belonging to the expected input space and is normalized as a probability distribution (i.e. $\sum_{l}\lambda_{l} = 1$ ). For example, a document with topic 'surfing' can be combined with another document with topic 'machine learning' to yield a new label with probability mass placed on both topics. While mixture mutations may seem unnatural, the intuition is that humans can recognize mixed examples and adjust their predictions accordingly. Models ought to do the same. + +# 2.2 Adaptive Sibylvariant Training + +One unique and promising aspect of SIB is to target specific class pairings dynamically during training. In much the same way that a human teacher might periodically assess a students' understanding and alter their lesson plan accordingly, Sybil computes a confusion matrix and constructs more examples containing classes for which the model has the most difficulty differentiating. For example, + +if a topic model most frequently misclassifies 'science' articles as 'business,' adaptive SIB (denoted as $\alpha$ SIB) will generate new blended examples of those classes in every mini-batch until the next evaluation cycle. At that point, if the model confuses 'science' for "health," $\alpha$ SIB will construct new mixtures of those classes and so on. Sybil supports built-in runtime monitoring for $\alpha$ SIB training. + +# 3 Transformations + +In Sybil, we defined 18 new transforms and adapt 23 existing techniques from prior work (Ribeiro et al., 2020; Morris et al., 2020; Wei and Zou, 2019) to expand the coverage of SIB and INV text transformations. At a high level, Table 1 shows these 41 transforms organized into 8 categories: Mixture (i.e., blending text), Generative (i.e. concept-based text generation), Swap (e.g., substituting antonyms, synonyms, hypernyms, etc.), Negation (e.g., adding or removing negation), Punctuation (e.g., adding or removing punctuation), Text Insert (e.g., adding negative, neutral, or positive phrases), Typos (e.g. adding various typos), and Emojis (e.g. adding or removing positive or negative emoji). We highlight several signature transforms here and provide a more detailed listing in Appendix A. + +
CategoryTransformations
MixtureTextMix†, SentMix†, WordMix†
GenerativeConcept2Sentence†, ConceptMix†
SwapChangeNumber, ChangeSynonym, ChangeAntonym, ChangeHyponym, ChangeHypernym, ChangeLocation, ChangeName, RandomSwap
NegationAddNegation, RemoveNegation
PunctuationExpandContractions, ContractContractions
Text InsertRandomInsertion, AddPositiveLink†, AddNegativeLink†, ImportLinkText†, InsertPositivePhrase, InsertNega-tivePhrase
TyposRandomCharDel, RandomCharInsert, RandomCharSubst, RandomCharSwap, RandomSwapQwerty, WordDeletion, HomoglyphSwap
EmojisEmojify†, AddEmoji†, AddPositiveEmoji†, AddNegativeEmoji†, AddNeutralEmoji†, Demojify†, RemoveEmoji†, RemovePositiveEmoji†, RemoveNegativeEmoji†, RemoveNeutralEmoji†
+ +Table 1: Transformations currently available in Sybil. New transforms that we defined are marked with $\dagger$ + +![](images/03198a8ec591a11ae4f81a251245d512caa7020c93197c93796f4383747908dd.jpg) +Figure 1: C2S intakes a text and its label (red) to extract keywords, ['stupid, worse']. These words are used to generate a new INV sentence shown in red. Alternatively, antonym (left) and synonym (right) substitution can produce new concepts that further boost diversity. + +Concept2Sentence (C2S). C2s is a two step process: (1) extract a short list of key concepts from a document and (2) generate a new sentence that retains critical semantic content of the original while varying its surface form, style, and even subject matter. To accomplish this, we leveraged integrated gradients (Sundararajan et al., 2017; Pierse, 2021) to produce saliency attributions that identify the most relevant tokens for a given class label. We then generate a well-composed sentence from the extracted concepts using a pre-trained BART (Lewis et al., 2019) model fine-tuned on the CommonGen dataset (Lin et al., 2019). + +Prior to generation, it is possible to apply other transformations to the extracted concepts to encourage diversity or knowably alter the label. For example, on the left hand side of Figure 1 an antonym substitution produces a SIB effect by changing the extracted concepts from ['stupid', 'worse'] to ['intelligent', 'better']. The new sentence exhibits a change in subject and style, but is correctly transmuted to have positive sentiment. C2S is thus an extremely promising transformation for diversifying text along both INV and SIB directions. + +TextMix, SentMix, and WordMix. Mixture mutations, like mixup (Zhang et al., 2017) and cutmix (Yun et al., 2019) from the image domain, take a batch of inputs and blend them together to form new inputs with an interpolated loss and they have shown robustness to adversarial attacks. TextMix translates this idea to the text domain by merging two inputs and interpolating a soft label according to the proportion of tokens belonging to the constituent classes. While TextMix does + +a straightforward concatenation, SentMix shuffles the sentences and thus encourages long-range comprehension. WordMix concatenates and shuffles all words, encouraging keyword-to-topic understanding when sentence structure is compromised. + +# 4 Experiments + +# 4.1 Transformation Pipelines & Datasets + +To compare the potential of INV, SIB, and both (INVSIB) in aggregate, we construct a transformation pipeline $(TP)$ (Cubuk et al., 2019; Xie et al., 2019), where we uniformly sample $n$ transformations of the selected kind to generate new $\{X_i, y_i\}$ pairs. We also create $TPs$ that apply a single transform, $T_{\text{SINGLE}}$ , to highlight the efficacy of C2S, TextMix, SentMix, WordMix and their adaptive versions, prefixed with $\alpha$ . In total, we evaluate 11 $TPs$ per dataset, shown in Table 2. + +Due to space limitations, we report the top performing $TP$ of each kind using an asterisk (*) INV* represents the best from $T_{\mathrm{INV}}$ and $T_{\mathrm{C2S}}$ , while SIB* represents the best from $T_{\mathrm{SIB}}$ and the mixture mutations. For RQ1, we also compare against TMix (Chen et al., 2020a), EDA (Wei and Zou, 2019), and AEDA (Karimi et al., 2021). TMix is a recent hidden-space mixture mutation for text, as opposed to Sybil's direct mixture mutation on the input space with greater transparency and examinability. EDA and AEDA are examples of recent INV transformations. Full results are available in the appendices. + +
ShorthandDescription
TORIG0 transformations as baseline
TINVsample 2 INVs
TSIBsample 2 SIBs
TINVSIBsample 1 INV and 1 SIB
TSINGLEapply one from C2S, TextMix, SentMix, WordMix, αTextMix, αSentMix, αWordMix
+ +Table 2: $TP$ descriptions. $TPs$ with an $\alpha$ -prefix use targeted, adaptive training (Section 2.2). + +We study six benchmarks for two kinds of NLP tasks: topic classification and sentiment analysis. Table 3 summarizes their relevant details. To simulate different levels of resource availability, we create three data subsets with by varying number of examples per class — 10, 200, and 2500. These subsets were expanded $30 \times$ via augmentation for each $TP$ . In total, we generated 144 new datasets + +$(144 = 6$ benchmarks $*3$ levels of data availability $*8TPs$ which persist data. $\alpha SIB$ is runtime only.) + +# 4.2 Model Setting + +We used a bert-base-uncased model (Devlin et al., 2018) with average pooling of encoder output, followed by a dropout layer (Srivastava et al., 2014) with probability 0.1, and a single linear layer with hidden size 768 and GELU (Hendrycks and Gimpel, 2016) activation. Maximum sentence length was set to 250. We use a batch size 16, an Adam optimizer (Kingma and Ba, 2014) with a linear warmup, a 0.1 weight decay, and compute accuracy every 2,000 steps. All models were trained for 30 epochs on eight Nvidia RTX A6000 GPUs, with early stopping. In total, we constructed 198 different models. + +For all $TPs$ that produce a soft-label, we use a multi-class cross-entropy loss and computed performance via a weighted top-k accuracy, + +$$ +\sum_ {j} ^ {k} \lambda_ {l} \cdot \mathbb {1} (y _ {l} = \hat {y} _ {j}), \tag {5} +$$ + +where $\lambda_{j}$ is the degree of class membership, $\mathbb{1}(\cdot)$ is the indicator function, and $y_{j}$ and $\hat{y}_j$ are the indices of the $j$ -th largest predicted score for the ground truth label and predicted label, respectively. + +# 4.3 RQ1. Generalization Performance + +For RQ1, we explore how model accuracy on the original test set is influenced by training data augmented with INV and SIB transformations. Table 4 shows the results on six benchmarks with three levels of data availability. + +We observe the most significant performance gains when training 10 examples per class—accuracy is improved by $4.7\%$ on average across all datasets and by a maximum of up to $15\%$ for IMDB. Figure 2 shows that as the number of labeled training data increases, a dominant trend emerged $-T_{\mathrm{SIB}}$ always generalized better to unseen test data. In fact, the only kind of transformation to always outperform both $T_{\mathrm{ORG}}$ and TMix is SIB*. Figure 3 shows the performance delta between INV* and SIB* against the $T_{\mathrm{ORG}}$ baseline at 200 examples per class. For every dataset, either $\alpha$ SentMix or $\alpha$ TextMix is the best performing $TP$ , while INV* actually leads to performance decreases for DBPedia, Yahoo! Answers, and IMDB. + +One key reason that aided SIB in attaining strong performance is the use of adaptive training. On average, crafting new examples that target the + +
DatasetSourceTaskSubjectClassesTestAvg Len
AG News(Zhang et al., 2015)TopicNews Articles41,90038
DBpedia(Zhang et al., 2015)TopicWikipedia Articles145,00046
Yahoo! Answers(Zhang et al., 2015)TopicQA Posts106,00092
Amazon Polarity(Zhang et al., 2015)SentimentProduct Reviews2200,00074
Yelp Polarity(Zhang et al., 2015)SentimentBusiness Reviews210,000133
IMDB(Maas et al., 2011)SentimentMovies Reviews212,500234
+ +Table 3: Dataset details. Test represents the number of examples per class in the test set. + +![](images/79836351e94a17cd8c8af2bdd41e1d5b48f4ea2d5db1462200d5f4c2e53df985.jpg) +Figure 2: SIB* outperforms INV* most, when data availability is low, indicating the necessity of SIB to complement INV. + +![](images/636566da5976c5ed8f6e6b858f47245797da4d7190a6d7f62ba9aa28d82a47d2.jpg) +Figure 3: The best performing TP for each dataset trained on 200 examples per class. $\alpha$ SentMix or $\alpha$ TextMix leads to the highest performance gains. SIB* consistently outperforms INV*. + +model's primary confusions during training added approximately $1\%$ to accuracy relative to mixing classes uniformly at random. This shows another unique benefit of sibylvariance that is not transferable to its INV counterparts. + +While our full scale experiments show a clear trend that SIB generally outperforms INV, we primarily evaluated $TPs$ combining multiple transforms instead of assessing the efficacy of each in isolation. Initially, this was a logistical decision due to computational limitations. To investigate each transformation's effect individually, we conducted a small scale experiment training 756 models ((39 transformations + 3 $\alpha$ SIB) × 6 datasets × 3 runs) + +on 10 examples per class with a $3 \times$ augmentation multiplier. Based on this experiment, we then computed each transform's performance by averaging the accuracy change relative to a $T_{\mathrm{ORIG}}$ baseline across all datasets. Table 5 shows the top ten best performing transforms, six of which employ SIB techniques. These results expand support for the overall conclusion that sibylvariance represents an especially effective class of transformations for improving generalization performance. + +# Generalization Performance. + +Models trained upon SIB-augmented data attained the highest test set accuracy in $89\%$ (16 out of 18) of experimental configurations, with the adaptive mixture mutations being the most consistently effective. + +# 4.4 RQ2. Defect Detection + +For RQ2, we assess how generating new tests with INV and SIB can expose defective model behavior. A single test is simply an $\{X_{i},y_{i}\}$ pair and a test suite is a set of such tests. Defective behavior is misclassification, which is measured via a test suite's accuracy. For each dataset $D$ , we select a high-performing BERT model trained only on the original dataset without any augmentation. Then for each of eight $TPs$ (excluding $\alpha$ SIB relevant to training only), we create 100 test suites, each containing 100 randomly sampled tests. This yields a total of 480,000 tests. We then report an average accuracy for each $D$ and $TP$ pair. + +Figure 4 shows how defect detection is enabled by INV and SIB. With the exception of Yahoo! Answers, the models scored nearly perfect accuracy on $T_{\mathrm{ORIG}}$ ; however, when the same models are tested using data generated with INV and SIB, they struggle to generalize. Test data synthesized with SIB can reveal most defects in these models, indicating the value of sibylvariance in constructing test oracles for ML models in the absence of + +
DatasetTP# Examples / ClassDatasetTP# Examples / ClassDatasetTP# Examples / Class
102002500102002500102002500
AG NewsORIG75.0888.7091.65DBpediaORIG95.7198.8798.96Yahoo!AnswersORIG56.2469.7773.18
INV*84.2889.4691.95INV*97.2998.8199.00INV*61.3969.2172.53
SIB*83.5289.8092.42SIB*97.9698.9099.06SIB*62.4770.1073.37
INVSIB84.0989.0091.36INVSIB95.6498.7498.92INVSIB62.0167.7573.16
TMix ‡81.3888.6289.43TMix ‡97.5198.6698.89TMix ‡53.6869.0369.50
EDA ‡81.5088.9890.93EDA ‡97.4298.6398.89EDA ‡57.8868.0369.15
AEDA ‡81.0388.7492.09AEDA ‡97.3098.8898.89AEDA ‡59.5167.3769.91
Amazon PolarityORIG67.3089.2292.08Yelp PolarityORIG74.6291.6693.70IMDBORIG64.7086.9690.02
INV*73.6989.5392.21INV*83.9192.0094.29INV*76.2086.9489.69
SIB*74.9090.0392.26SIB*80.4692.6094.69SIB*79.7487.6590.90
INVSIB73.5089.0691.26INVSIB78.9091.8593.03INVSIB75.0487.0488.24
TMix ‡62.1487.9891.00TMix ‡61.8191.1992.80TMix ‡62.4586.9488.29
EDA ‡59.4087.6892.20EDA ‡71.9090.8894.11EDA ‡67.3786.4589.07
AEDA ‡64.7288.9291.83AEDA ‡79.3991.6094.06AEDA ‡72.6186.5688.63
+ +Table 4: RQ1 accuracy comparison for INV*, SIB*, and INVSIB against baselines ORIG, TMix (Chen et al., 2020a), EDA (Wei and Zou, 2019), AEDA (Karimi et al., 2021). An asterisk (*) indicates the best performance observed across underlying $TPs$ of each kind, while a $\ddagger$ indicates related works for comparison. + +
TransformTypeAvg Δ (%)
αSentMixSIB+4.26
αTextMixSIB+3.55
RandomCharInsertINV+3.55
TextMixSIB+3.22
Concept2SentenceINV+2.70
AddPositiveLinkINV / SIB+2.48
AddNegativeEmojiINV / SIB+2.45
SentMixSIB+2.33
ExpandContractionsINV+2.15
RandomCharSubstINV+2.06
+ +Table 5: Top ten individual transforms over a no-transform baseline averaged across all datasets. The INV / SIB types were SIB for the sentiment analysis datasets and INV for the topic classification datasets. See Table 11 in the Appendix for more details. + +expensive human labeling and judgements. + +Tests which lie outside the expected input distribution are not likely to be fair nor actionable. Since SIB transforms generally perturb data more aggressively than INV ones, they likewise possess more potential for creating unreasonable, out-of-domain tests of model quality. However, the positive results in RQ1 may justify the use of SIB transformations as reasonable for testing. Had the newly transformed data truly belonged to a different distribution, model performance on the in-domain test set should have decreased as a result of dataset shift (Quinonero-Candela et al., 2009; Hu et al., 2022). In fact, we observed the opposite as model performance was consistently improved. This suggests that SIB transforms yield data that is tenably indomain and therefore may complement INV transforms in exposing defective model behavior. + +We theorize that the effectiveness of SIB-generated tests comes from the expanded objectives it permits. For example, $T_{\mathrm{TextMix}}$ assess whether the + +![](images/345c2b0d781367f4cd78e01cc72dbf0343a6bf3dc5c1a2a309446c2b3322dcf3.jpg) +(a) AG News + +![](images/3f4401c0545879a0ab3608f1f421413a02e2319738c35921898d03fc52d37132.jpg) + +![](images/b352832535c06394876d6acb60ece292e90ae8f65efc785cd70923ef1409d0fb.jpg) +(c) Yahoo! Answers +(e) Amazon Polarity + +![](images/460ff5f32137d1caea94a2b1b40de4f5261f2b578aec4880678934edfc7cbbb7.jpg) + +![](images/eea875d2841c30921a098a7b98d9e77dd37d5c774705a2c2966b2bb7fcaf8e1e.jpg) +(b) DBpedia +(d) IMDB + +![](images/3c6d24244c84a7ee982be41131bb792cb26f7297ea685cd5dea5db29a6666b29.jpg) +(f) Yelp Polarity +Figure 4: RQ2 defect detection comparison. Percentages show change in accuracy relative to $T_{\mathrm{ORIG}}$ . Lower accuracy indicates greater efficacy at inducing error. + +model can recognize which classes are present and to what degree. $T_{\text{SentMix}}$ does the same but further scrutinizes long-range comprehension by broadly distributing related topic sentences. Datasets with lengthy inputs are particularly vulnerable to transformations of this kind. Lastly, $T_{\text{WordMix}}$ forces the model to forgo reliance on text structure and evaluates keyword comprehension amidst noisy contexts. In contrast, most INV transformations involve minor changes — e.g. expand contractions — and test the aspect of language already well modeled from extensive pre-training. The INV C2S transform is an exception that drastically alters input and thus reveals more defects than other $T_{\text{INV}}$ pipelines. + +Defect Detection. Models tested with SIB-transformed data exhibited the greatest number of defects in $83\%$ (5 out of 6) of experimental configurations. + +# 4.5 RQ3. Adversarial Robustness + +For RQ3, we assess whether models trained on INV or SIB are more resilient to adversarial attacks than models trained on an original data. An adversarial text input is typically obtained via semantic preserving (i.e. invariant) perturbations to legitimate examples in order to deteriorate the model performance. The changes are typically generated by ascending the gradient of the loss surface with respect to the original example and improving robustness to adversarial attacks is a necessary precondition for real-world NLP deployment. + +We select three attack algorithms based on their popularity and effectiveness: (1) TextFOoler (Jin et al., 2019), (2) DeepWordBug (Gao et al., 2018), and (3) TextBugger (Li et al., 2018), all as implemented in TextAttack (Morris et al., 2020). We focus on models trained with 10 examples per class because the largest changes in generalization performance are more likely to exhibit the clearest trend for adversarial robustness. For each of 11 models and 3 attacks, we randomly sample 100 inputs from the original data and perturb them to create a total of 3,300 adversarial examples. + +Table 6 shows that, of all the cases where adversarial robustness is improved over $T_{\text{ORIG}}$ , $92\%$ of them involve SIB. On average, SIB*-trained models improve robustness by $4\%$ , while INV*-trained models sustain a $1\%$ decrease. Topic classification is made more robust via training with augmented data. Consistently, $T_{\alpha-\text{SentMix}}$ produces the most resilient models. For sentiment analysis, improved generalization performance enabled by SIB does not necessarily lead to improved robustness to existing adversarial attacks. The underlying sentiment models trained with augmented data improves generalization over $T_{\text{ORIG}}$ by an average of $5\%$ . However, counter-intuitively, the models are not more robust to the three attacks than $T_{\text{ORIG}}$ and that Pearson correlation is -0.28 between accuracy and adversarial robustness. This finding motivates future work to investigate why there is a negative correlation and how to design SIB such that accuracy improvement also translates to corresponding adversarial robustness. + +Adversarial Robustness. Of all the experimental configurations where adversarial robustness was improved over the no-transform baseline, $92\%$ (11 out of 12) of them involved models trained on SIB-augmented data. + +# 5 Discussion + +How does sibylvariance help? The primary purpose of data transformations in ML is to diversify datasets in the neighborhood of existing points, a principle formalized as Vicinal Risk Minimization (VRM) (Chapelle et al., 2001). Synthetic examples can be drawn from a vicinal distribution to find similar but different points that enlarge the original data distribution. For instance, within image classification, it is common to define the vicinity of an image as the set of its random crops, axial reflections, and other label-preserving INV transforms. While VRM can expose ML models to more diverse input space and consequently reduce generalization errors, the neighborhoods created by INV are relatively restricted. This is due to the label-preserving constraint limiting the degree of perturbation freedom on the original data. + +![](images/5d284556c677a5d8a06a4681836b6b8fa94702a1c77ab26818f43405b60caf69.jpg) +(a) $T_{\mathrm{ORIG}}$ + +![](images/c0285ada7fda75cbdd767e1f1ba4dee208d6c7433f3be895d1d8007883fbfe2c.jpg) +(b) $T_{\mathrm{INV}}$ + +![](images/2bf3103fe036a142c542e66eccedd9ec5e632d82ecb33f716fcd94a394e0c763.jpg) +(c) $T_{\mathrm{SIB}}$ + +![](images/5ce616d951169919e13afc4a8c8389b308102326b421d79107c72faa5f9cf743.jpg) +(d) $T_{\text{TextMix}}$ +Figure 5: UMAP visualizations of BERT [CLS] tokens for SST-2. Blue, red, and green represent "Negative," "Positive," and "Mixed", respectively. + +SIB effectively expands the vicinity relation via transmutations and mixture mutations. Newly created data can claim full or mixed membership in target classes. To support our intuition, we vi + +
DatasetTPAttack Success RateDatasetTPAttack Success RateDatasetTPAttack Success Rate
TFDWBTBTFDWBTBTFDWBTB
AG NewsORIG0.690.560.54DBpediaORIG0.920.550.64Yahoo!AnswersORIG0.540.460.52
INV*0.660.560.48INV*0.760.470.48INV*0.570.490.49
SIB*0.600.430.45SIB*0.770.400.41SIB*0.480.410.49
INVSIB0.780.620.57INVSIB0.830.560.52INVSIB0.540.440.46
Amazon PolarityORIG0.480.400.42Yelp PolarityORIG0.480.200.28IMDBORIG0.860.250.71
INV*0.490.420.36INV0.640.410.52INV*0.700.500.68
SIB*0.550.390.46SIB0.610.390.53SIB*0.560.320.55
INVSIB0.650.580.60INVSIB0.750.510.61INVSIB0.890.790.88
+ +Table 6: RQ3 adversarial robustness comparison for INV*, SIB*, and INVSIB using TextFooler (TF), DeepWordBug (DWB), and TextBugger (TB). A lower attack success rate indicates a higher adversarial robustness. + +sualize the effects of various transformations on SST-2 (Socher et al., 2013). Figure 5 presents the UMAP-reduced (McInnes et al., 2020) [CLS] tokens produced by a BERT transformer for sentiment classification. Figure 5a shows that the classes are initially well separated and high performance can be obtained by selecting any separating surface between the two clusters. However, a more reasonable choice for the best boundary is one that exhibits the largest margin between classes — the very intuition behind Support Vector Machines (Cortes and Vapnik, 1995). Figure 5d suggests that a model trained on mixture mutations is likely to arrive at a boundary with the lowest loss. For example, in 5d, the augmented examples in green provide additional loss feedback from uncovered portions of the input space to encourage a decision boundary that maximizes the margin between class clusters. A similar expectation may hold for SIB in Figure 5c. However, the effects of INV transforms shown in Figure 5b do not appear to support such margin maximization. + +Threats to Validity. External threats to validity include the generalization of our results to model architectures dissimilar to BERT (i.e. bert-base-uncased). It is possible that larger autoencoder models like RoBERTa (Liu et al., 2019) and auto-regressive models like XLNet (Yang et al., 2019) may respond differently to SIB transformations. Secondly, while the framework of sibylvariance is applicable to all data types, we have only provided empirical results supporting their efficacy for text classification models. We leave the exploration of SIB applications to image, time series, and other domains to future work. + +Internal threats include how we derived mixed labels for generated text. We assumed that the critical semantics can be approximated via the ratio of words contributed by source text. This assumption may not account for other linguistic interaction and thus could lead to suboptimal labels. However, SIB did significantly improve upon the INV and the + +ORIG baselines in the RQ1 generalization study, suggesting that the constructed soft labels still reflected useful semantics. This indirectly supports the validity of SIB-transformed data for testing in RQ2, although we acknowledge that additional caution is required for using any aggressively modified, synthetic data as a substitute for real data for the purpose of exposing defective model behavior. + +# 6 Related Work + +In this section, we broadly cover data transformations within and outside of the text domain because our proposed framework for sibylvariance is applicable to all classification contexts. + +Data Augmentation. Effective data augmentation is a key factor enabling superior model performance on a wide range of tasks (Krizhevsky et al., 2012; Jiang et al., 2018; Xie et al., 2019). In many cases, practitioners leverage domain knowledge to reinforce critical invariances in the underlying data. In computer vision, for example, translation invariance is the idea that no matter where the objects of interest reside within an image, the model will still classify them correctly. Image translations and random crops encourage this more generalized conceptualization within the model (Simard et al., 1998) and all other transforms have a similar goal: reinforce a particular invariance that helps the learner perform well on future unseen data. + +Numerous techniques have been proposed to assist with this learning objective and thereby improve generalization. Random erasing (Zhong et al., 2017; Devries and Taylor, 2017) and noise injection (Wen et al., 2020; Xie et al., 2019) support invariance to occlusions and promote robust features. Interpolating (Bowyer et al., 2011) and extrapolating (DeVries and Taylor, 2017) nearest neighbors in the input / feature space reinforces a linear relationship between the newly created data and the supervision signal while reducing class imbalance. However, nearly all of these approaches, and many others (Shorten and Khoshgoftaar, 2019; + +Feng et al., 2021), are label-preserving and therefore limited in their capacity to induce deeper learning of invariant concepts. + +Sibylvariant transforms enjoy several desirable aspects of INV transformations while mitigating their drawbacks. Similar to feature space functions (DeVries and Taylor, 2017), mixture mutations do not require significant domain knowledge. Like approaches that reduce dataset imbalance (Bowyer et al., 2011), SIB transforms can increase class representation through mixed membership or targeted transmutations that inherit diverse characteristics of the source inputs. In all cases, relaxing the label-preserving constraint enables SIB functions to both complement and enhance the learning of critical invariances by further expanding the support of the dataset in new directions. + +Adversarial Attacks & Robustness. Adversarial attacks are a special class of INV transformations that simultaneously minimize perturbations to the input while maximizing the perception of change to a learner. This task is more difficult within the NLP domain due to the discrete nature of text, but several works (Alzantot et al., 2018; Zhang et al., 2020) have proven successful at inducing model errors. Real-world use of NLP requires resilience to such attacks and our work complements robust training (Parvez et al., 2018) and robust certification (Ye et al., 2020; Pruksachatkun et al., 2021) to produce more reliable models. + +Emerging Sibylvariant Transforms. Specific transformations designed to alter the expected class of an input have existed prior to this work (Zhang et al., 2017; Yun et al., 2019; Guo, 2020; Zhu et al., 2017), albeit primarily in the image domain and also in a more isolated, ad hoc fashion. Among our primary contributions is to propose a unifying name, framework, and taxonomy for this family of sibylvariant functions. Furthermore, most prior works introduce a single transformation and evaluate its efficacy on training alone. In contrast, we proposed several novel transformations, a new adaptive training routine, and evaluated the broader impacts of 41 INV and SIB transforms on training, defect detection, and robustness simultaneously. + +Recently published examples of SIB mixture mutations for text (Guo et al., 2019; Chen et al., 2020a) differ from ours in several important ways. Prior work operates exclusively within the hidden space inside specific models, which limits transferability between different algorithm types. All of our + +transformations operate in the input space, which is both more general and more challenging because we have to contend with rules of grammar and style. However, this also provides greater transparency. Furthermore, because our overall approach samples from 41 different transformations, we are able to exercise a broader range of model behaviors. For example, SentMix is designed to encourage long-range understanding, while other transforms evoke their own specific objectives. Any individual transformation is inherently more limited, e.g. TMix can only encourage the model to behave linearly for borderline cases. + +# 7 Conclusion + +Inspired by metamorphic testing, we proposed the notion of sibylvariance to jointly transform both input and output class $(X_{i},y_{i})$ pairs in a knowable way. To explore the potential of sibylvariance, we define 18 new text transformations and adapt 23 existing transformations into an open source tool called Sybil. In particular, we define several types of mixture mutations and design a novel concept-based text transformation technique utilizing salience attribution and neural sentence generation. Across six benchmarks from two different NLP classification tasks, we systematically assess the effectiveness of INV and SIB for generalization performance, defect detection, and adversarial robustness. Our extensive evaluation shows that many SIB transforms, and especially the adaptive mixture mutations, are extremely effective. SIB achieves the highest training accuracy in $89\%$ of the experimental configurations. When used for testing, SIB test suites reveal the greatest number of model defects in 5 out of 6 benchmarks. Finally, models trained on SIB-augmented data improve adversarial robustness $11\times$ more often than those trained on INV-augmented data. + +# Acknowledgements + +This work is supported in part by National Science Foundations via grants CCF-2106420, CCF-2106404, CNS-2106838, CCF-1764077, CHS-1956322, CCF-1723773, ONR grant N00014-18-1-2037, Intel CAPA grant, Samsung, and a CISCO research contract. We would also like to thank Atharv Sakhala for early contributions to the Sybil project as well as Jason Teoh, Sidi Lu, Aaron Hatrick, Sean Gildersleeve, Hannah Pierce, and all the anonymous reviewers for their many helpful suggestions. + +# References + +Moustafa Alzantot, Yash Sharma, Ahmed Elgohary, Bo-Jhang Ho, Mani B. Srivastava, and Kai-Wei Chang. 2018. Generating natural language adversarial examples. CoRR, abs/1804.07998. +E. Barr, M. Harman, P. McMinn, M. Shahbaz, and Shin Yoo. 2015. The oracle problem in software testing: A survey. IEEE Transactions on Software Engineering, 41:507-525. +Kevin W. Bowyer, Nitesh V. Chawla, Lawrence O. Hall, and W. Philip Kegelmeyer. 2011. SMOTE: synthetic minority over-sampling technique. CoRR, abs/1106.1813. +Olivier Chapelle, Jason Weston, Léon Bottou, and Vladimir Vapnik. 2001. Vicinal risk minimization. In Advances in Neural Information Processing Systems, volume 13. MIT Press. +Jiaao Chen, Zichao Yang, and Diyi Yang. 2020a. Mixtext: Linguistically-informed interpolation of hidden space for semi-supervised text classification. CoRR, abs/2004.12239. +T. Chen, S. Cheung, and S. Yiu. 2020b. Metamorphic testing: A new approach for generating next test cases. ArXiv, abs/2002.12543. +Corinna Cortes and Vladimir Vapnik. 1995. Support-vector networks. Machine learning, 20(3):273-297. +Ekin D. Cubuk, Barret Zoph, Jonathon Shlens, and Quoc V. Le. 2019. Randaugment: Practical data augmentation with no separate search. CoRR, abs/1909.13719. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2018. BERT: pre-training of deep bidirectional transformers for language understanding. CoRR, abs/1810.04805. +Terrance DeVries and Graham W. Taylor. 2017. Dataset augmentation in feature space. +Terrance Devries and Graham W. Taylor. 2017. Improved regularization of convolutional neural networks with cutout. CoRR, abs/1708.04552. +Steven Y. Feng, Varun Gangal, Jason Wei, Sarath Chandar, Soroush Vosoughi, Teruko Mitamura, and Edward Hovy. 2021. A survey of data augmentation approaches for nlp. +Ji Gao, Jack Lanchantin, Mary Lou Soffa, and Yanjun Qi. 2018. Black-box generation of adversarial text sequences to evade deep learning classifiers. CoRR, abs/1801.04354. +Hongyu Guo. 2020. Nonlinear mixup: Out-of-manifold data augmentation for text classification. In AAAI. +Hongyu Guo, Yongyi Mao, and Richong Zhang. 2019. Augmenting data with mixup for sentence classification: An empirical study. CoRR, abs/1905.08941. + +Dan Hendrycks and Kevin Gimpel. 2016. Bridging nonlinearities and stochastic regularizers with gaussian error linear units. CoRR, abs/1606.08415. +Qiang Hu, Yuejun Guo, Maxime Cordy, Xiaofei Xie, Lei Ma, Mike Papadakis, and Yves Le Traon. 2022. An empirical study on data distribution-aware test selection for deep learning enhancement. +Yu Jiang, Vivek Natarajan, Xinlei Chen, Marcus Rohrbach, Dhruv Batra, and Devi Parikh. 2018. Pythia v0.1: the winning entry to the VQA challenge 2018. CoRR, abs/1807.09956. +Di Jin, Zhijing Jin, Joey Tianyi Zhou, and Peter Szolovits. 2019. Is BERT really robust? natural language attack on text classification and entailment. CoRR, abs/1907.11932. +Akbar Karimi, Leonardo Rossi, and Andrea Prati. 2021. AEDA: an easier data augmentation technique for text classification. CoRR, abs/2108.13230. +Diederik P. Kingma and Jimmy Ba. 2014. Adam: A method for stochastic optimization. Cite arxiv:1412.6980Comment: Published as a conference paper at the 3rd International Conference for Learning Representations, San Diego, 2015. +Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. 2012. Imagenet classification with deep convolutional neural networks. In Advances in Neural Information Processing Systems, volume 25. Curran Associates, Inc. +Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. 2019. BART: denoising sequence-to-sequence pretraining for natural language generation, translation, and comprehension. CoRR, abs/1910.13461. +Jinfeng Li, Shouling Ji, Tianyu Du, Bo Li, and Ting Wang. 2018. Textbugger: Generating adversarial text against real-world applications. CoRR, abs/1812.05271. +Bill Yuchen Lin, Ming Shen, Yu Xing, Pei Zhou, and Xiang Ren. 2019. *Commongen: A constrained text generation dataset towards generative commonsense reasoning*. CoRR, abs/1911.03705. +Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019. Roberta: A robustly optimized BERT pretraining approach. CoRR, abs/1907.11692. +Andrew L. Maas, Raymond E. Daly, Peter T. Pham, Dan Huang, Andrew Y. Ng, and Christopher Potts. 2011. Learning word vectors for sentiment analysis. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, pages 142-150, Portland, Oregon, USA. Association for Computational Linguistics. + +Leland McInnes, John Healy, and James Melville. 2020. Umap: Uniform manifold approximation and projection for dimension reduction. +John X. Morris, Eli Lifland, Jin Yong Yoo, Jake Grigsby, Di Jin, and Yanjun Qi. 2020. Textattack: A framework for adversarial attacks, data augmentation, and adversarial training in nlp. +Md. Rizwan Parvez, Tolga Bolukbasi, Kai-Wei Chang, and Venkatesh Sarigrama. 2018. Building a robust text classifier on a test-time budget. CoRR, abs/1808.08270. +Luis Perez and Jason Wang. 2017. The effectiveness of data augmentation in image classification using deep learning. CoRR, abs/1712.04621. +CharlesPierse.2021.TransformersInterpret +Yada Pruksachatkun, Satyapriya Krishna, Jwala Dhamala, Rahul Gupta, and Kai-Wei Chang. 2021. Does robustness improve fairness? approaching fairness with word substitution robustness methods for text classification. CoRR, abs/2106.10826. +Joaquin Quinonero-Candela, Masashi Sugiyama, Anton Schwaighofer, and Neil D. Lawrence. 2009. When training and test sets are different: Characterizing learning transfer. +Marco Túlio Ribeiro, Tongshuang Wu, Carlos Guestrin, and Sameer Singh. 2020. Beyond accuracy: Behavioral testing of nlp models with checklist. In ACL. +Connor Shorten and T. Khoshgoftaar. 2019. A survey on image data augmentation for deep learning. Journal of Big Data, 6:1-48. +Patrice Simard, Yann LeCun, John S. Denker, and Bernard Victorri. 1998. Transformation invariance in pattern recognition-tangent distance and tangent propagation. In Neural Networks: Tricks of the Trade, This Book is an Outgrowth of a 1996 NIPS Workshop, page 239-27, Berlin, Heidelberg. Springer-Verlag. +Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D. Manning, Andrew Ng, and Christopher Potts. 2013. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pages 1631-1642, Seattle, Washington, USA. Association for Computational Linguistics. +Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. 2014. Dropout: A simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, 15(56):1929-1958. +Mukund Sundararajan, Ankur Taly, and Qiqi Yan. 2017. Axiomatic attribution for deep networks. *ArXiv*, abs/1703.01365. + +Alex Warstadt, Amanpreet Singh, and Samuel R Bowman. 2018. Neural network acceptability judgments. arXiv preprint arXiv:1805.12471. +Jason W. Wei and Kai Zou. 2019. EDA: easy data augmentation techniques for boosting performance on text classification tasks. CoRR, abs/1901.11196. +Qingsong Wen, Liang Sun, Xiaomin Song, Jingkun Gao, Xue Wang, and Huan Xu. 2020. Time series data augmentation for deep learning: A survey. CoRR, abs/2002.12478. +Qizhe Xie, Zihang Dai, Eduard H. Hovy, Minh-Thang Luong, and Quoc V. Le. 2019. Unsupervised data augmentation. CoRR, abs/1904.12848. +Zhilin Yang, Zihang Dai, Yiming Yang, Jaime G. Carbonell, Ruslan Salakhutdinov, and Quoc V. Le. 2019. Xlnet: Generalized autoregressive pretraining for language understanding. CoRR, abs/1906.08237. +Mao Ye, Chengyue Gong, and Qiang Liu. 2020. SAFER: A structure-free approach for certified robustness to adversarial word substitutions. CoRR, abs/2005.14424. +Sangdoo Yun, Dongyoon Han, Seong Joon Oh, Sanghyuk Chun, Junsuk Choe, and Youngjoon Yoo. 2019. Cutmix: Regularization strategy to train strong classifiers with localizable features. CoRR, abs/1905.04899. +Hongyi Zhang, Moustapha Cisse, Yann N. Dauphin, and David Lopez-Paz. 2017. mixup: Beyond empirical risk minimization. CoRR, abs/1710.09412. +Jie M. Zhang, Mark Harman, Lei Ma, and Yang Liu. 2019. Machine learning testing: Survey, landscapes and horizons. CoRR, abs/1906.10742. +Wei Emma Zhang, Quan Z. Sheng, Ahoud Alhazmi, and Chenliang Li. 2020. Adversarial attacks on deep-learning models in natural language processing: A survey. ACM Trans. Intell. Syst. Technol., 11(3). +Xiang Zhang, Junbo Jake Zhao, and Yann LeCun. 2015. Character-level convolutional networks for text classification. CoRR, abs/1509.01626. +Zhun Zhong, Liang Zheng, Guoliang Kang, Shaozi Li, and Yi Yang. 2017. Random erasing data augmentation. CoRR, abs/1708.04896. +Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A. Efros. 2017. Unpaired image-to-image translation using cycle-consistent adversarial networks. CoRR, abs/1703.10593. + +A Implemented Sybi1 Transformations + +
CategoryTransformationSentimentTopic
MixtureTextMixSIBSIB
MixtureSentMixSIBSIB
MixtureWordMixSIBSIB
GenerativeConcept2SentenceINVINV
GenerativeConceptMixSIBSIB
Word Swapreplace antonymSIBINV
Word Swapreplace cohyponymINVINV
Word Swapreplace hybernymINVINV
Word Swapreplace hyponymINVINV
Word Swapreplace synonym (wordnet)INVINV
Word Swapchange numbers (except 2 and 4)INV*INV
Word Swapchange locations based on dictionaryINVINV
Word Swapchange names based on dictionaryINVINV
Negationadd negationINV*INV
Negationremove negationINV*INV
Punctuationexpand contractionsINVINV
Punctuationreduce contractionsINVINV
Text Insertionadd URL to negative contentSIBINV
Text Insertionadd URL to positive contentSIBINV
Text Insertionadd negative phraseSIBINV
Text Insertionadd positive phraseSIBINV
Typoschar deletionINV*INV
Typoschar insertionINV*INV
Typoschar movement (n spaces)INV*INV
Typoschar replacement (homoglyph)INVINV
Typoschar replacementINV*INV
Typoschar swap (n spaces)INV*INV
Typoschar swap (QWERTY)INV*INV
Typosword deletionINV*INV
Typosword insertionINV*INV
Typosword replacementINV*INV
Typosword replacement (homophone)INVINV
Typosword swapINV*INV
Emojisreplace words with emojis (Emojify)INVINV
Emojisreplace emojis with words (Demojify)INVINV
Emojisadd negative emojiSIBINV
Emojisadd neutral emojiINVINV
Emojisadd positive emojiSIBINV
Emojisremove negative emojiSIBINV
Emojisremove neutral emojiINVINV
Emojisremove positive emojiSIBINV
+ +Table 7: Transform descriptions currently implemented in Sybil, sampled from according to task (sentiment analysis or topic) and $TP$ (INV, SIB, or INVSIB). Note that transformations are INV or SIB with respect to specific tasks. Asterisks (*) indicate that the variance type could be either INV or SIB, but the listed variance was judged to be more likely. + +B Other Possible Text Transformations + +
CategoryTransformationSentimentTopic
Word Swapreplace synonym (embedding)INVINV
Word Swapword swap (masked)INV*INV
Word Swapchange gendered pronounINVINV*
Word Swapchange protected classINVINV*
Word Swapchange "for" to 4INVINV
Word Swapchange "to" to 2INVINV
Word Swapswap phrase with acronymINVINV
Negationnegation of negative clauseSIBINV
Negationnegation of neutral clauseINVINV
Negationnegation of positive clauseSIBINV
ParaphrasebacktranslationINVINV
Punctuationadd exclamationINV*INV
Punctuationadd periodINVINV
Punctuationadd question markINVINV
Punctuationremove exclamationSIB*INV
Punctuationremove periodINVINV
Punctuationremove question markINVINV
Text Insertionadd random URL (404)INVINV
Text Insertionadd neutral phraseINVINV
Tense / Voicemake continuous future tenseINV*INV
Tense / Voicemake continuous past tenseINV*INV
Tense / Voicemake continuous present tenseINV*INV
Tense / Voicemake perfect continuous future tenseINV*INV
Tense / Voicemake perfect continuous past tenseINV*INV
Tense / Voicemake perfect continuous present tenseINV*INV
Tense / Voicemake perfect future tenseINV*INV
Tense / Voicemake perfect past tenseINV*INV
Tense / Voicemake perfect present tenseINV*INV
Tense / Voicemake simple future tenseINV*INV
Tense / Voicemake simple past tenseINV*INV
Tense / Voicemake simple present tenseINV*INV
Tense / Voicechange voice activeINVINV
Tense / Voicechange voice passiveINVINV
Emojisreplace emoji with word antonymSIBINV
Emojisreplace emoji with word synonymINVINV
Emojisreplace word with emoji antonymSIBINV
Emojisreplace word with emoji synonymINVINV
+ +Table 8: Transform NOT currently implemented in Sybil, but represent potentially interesting directions for future work. Asterisks (*) indicate that the variance type could be either INV or SIB, but the listed variance was judged to be more likely. + +# C Sibylvariant Subtype Examples + +
SIB SubtypeImage +(Classification)Text +(Sentiment Analysis)
Transmutation +A → B +(Hard Label)RotationAntonym Replacement +I love NY +↓ +I hate NY
69
Changes one class into another class, while retaining stylistic elements of the original.Digit 6 → Digit 9Clause Negation +You are a good person. +↓ +You are not a good person.
GAN-based Object TransfigurationStock Phrase Insertion +It was a clever movie. +↓ +It was a clever movie. +That said, I absolutely hated it.
Sandal → Sneaker
Mixture Mutation +A + B → AB +(Soft Label)Mixup (Zhang et al., 2017) +Cutmix (Yun et al., 2019)TextMix +virutally unwatchable... ++ +a vivid, thoughtful, +unapologetically raw +coming-of-age tale full of sex, +drugs and rock 'n' roll. +=
[1,0] + [0,1] → [0.35,0.65]
Mixes two or more class labels into a single data point and then interpolates the expected behavior.Tilevirutally unwatchable... a vivid, +thoughtful, unapologetically raw +coming-of-age tale full of sex, +drugs and rock 'n' roll. +[1,0] + [0,1] → [0.17,0.83]
[1,0,0,0] + [0,0,1,0] + +[0,1,0,0] + [0,0,0,1] → [0.25,0.25,0.25,0.25]WordMix +it is essentially empty ++ +this is a visually stunning +rumination on love +=
love visually is is essentially +rumination on it stunning this a +empty +[1,0] + [0,1] → [0.33,0.67]
+ +Table 9: Examples of SIB transformations for the image and text domains. For mixture mutations, we show a soft label proportional to the pixel and word counts of their constituent parts. + +D RQ1. Detailed Training Results + +
DatasetTP102002500DatasetTP102002500
AG NewsORIG75.0888.7091.65Amazon PolarityORIG67.3089.2292.08
INV84.2889.4691.95INV71.0989.5392.21
C2S82.8287.8491.43C2S73.6986.7690.20
SIB83.5289.2091.55SIB69.2387.0091.45
TextMix83.5389.1791.58TextMix68.2088.6391.46
SentMix83.5689.2891.49SentMix71.2288.8591.28
WordMix82.6188.5990.42WordMix60.2785.4087.68
αTextMix81.5389.5192.20αTextMix74.9090.0392.26
αSentMix77.2889.8092.42αSentMix64.1990.0192.16
αWordMix83.1389.4691.91αWordMix64.2189.0991.98
INVSIB84.0989.0091.36INVSIB73.5089.0691.26
TMix ‡81.3888.6289.43TMix ‡62.1487.9891.00
EDA ‡81.5088.9890.93EDA ‡59.4087.6892.20
AEDA ‡81.0388.7492.09AEDA ‡64.7288.9291.83
DBpediaORIG95.7198.8798.96Yelp PolarityORIG74.6291.6693.70
INV97.2998.8199.00INV77.9292.0094.29
C2S96.2398.3696.41C2S83.9189.5992.80
SIB95.2698.7397.60SIB78.6791.8993.69
TextMix97.9698.8897.86TextMix79.2791.0793.36
SentMix97.9598.8699.01SentMix80.4691.9693.62
WordMix97.0397.8998.59WordMix74.4788.3992.12
αTextMix97.7298.8799.04αTextMix77.7291.7394.50
αSentMix96.3898.9099.06αSentMix76.6392.6094.69
αWordMix97.0198.9098.90αWordMix78.3091.5093.67
INVSIB95.6498.7498.92INVSIB78.9091.8593.03
TMix ‡95.7698.5398.55TMix ‡61.8191.1992.80
EDA ‡97.4298.6398.89EDA ‡71.9090.8894.11
AEDA ‡97.3098.8898.89AEDA ‡79.3991.6094.06
Yahoo!AnswersORIG56.2469.7773.18IMDBORIG64.7086.9690.02
INV60.2469.2172.53INV76.2086.9489.69
C2S61.3967.3170.60C2S70.1885.6786.98
SIB61.3068.4573.18SIB73.5186.3888.71
TextMix62.4768.7272.08TextMix73.2385.2489.45
SentMix60.9568.7272.07SentMix76.7585.5589.10
WordMix59.9867.6672.96WordMix67.1584.1988.23
αTextMix60.2669.8973.15αTextMix74.0987.5290.60
αSentMix59.1070.1073.00αSentMix79.7487.6590.90
αWordMix60.7469.9973.37αWordMix73.0186.9287.85
INVSIB62.0167.7573.16INVSIB75.0487.0488.24
TMix ‡53.6869.0369.50TMix ‡62.4586.9488.29
EDA ‡57.8868.0369.15EDA ‡67.3786.4589.07
AEDA ‡59.5167.3769.91AEDA ‡72.6186.5688.63
+ +Table 10: Performance (test set accuracy $(\%)$ ) for all $TPs$ . The results are averaged across three runs. Models are trained with either 10, 200, or 2500 examples per class. $TPs$ are color coded by their variant type, where orange and light green are invariant and sibylvariant, respectively. White with a $\ddagger$ indicates related works for comparison. For TMix, EDA, and AEDA, we used the author's open source code with their default / recommended configurations to transform the training datasets. However, we maintained the same model training hyperparameters as our other $TPs$ to facilitate fair comparisons with our work. + +
TransformTypeAvg Δ (%)
αSentMixSIB+4.26
αTextMixSIB+3.55
RandomCharInsertINV+3.55
TextMixSIB+3.22
Concept2SentenceINV+2.70
AddPositiveLinkINV / SIB+2.48
AddNegativeEmojisINV / SIB+2.45
SentMixSIB+2.33
ExpandContractionsINV+2.15
RandomCharSubstINV+2.06
AddNeutralEmojisINV+1.90
RandomInsertionINV+1.72
AddNegativeLinkINV / SIB+1.64
αWordMixSIB+1.62
ChangeNumberINV+1.44
AddPositiveEmojisINV / SIB+1.25
InsertNegativePhraseINV / SIB+1.15
RemoveNegationINV+1.00
WordDeletionINV+0.86
RandomSwapQwertyINV+0.83
RandomCharSwapINV+0.77
ContractContractionsINV+0.69
EmojifyINV+0.59
ChangeLocationINV+0.37
DemojifyINV+0.34
AddNegationINV+0.13
WordMixSIB+0.08
ConceptMixSIB-0.11
RandomCharDelINV-0.16
RemovePositiveEmojisINV-0.24
RandomSwapINV-0.28
ImportLinkTextINV-0.56
ChangeHyponymINV-0.63
RemoveNeutralEmojisINV-0.72
RemoveNegativeEmojisINV / SIB-0.80
ChangeNameINV-0.84
InsertPositivePhraseINV / SIB-0.95
ChangeSynonymINV-1.26
ChangeHypernymINV-1.78
ChangeAntonymINV / SIB-2.82
HomoglyphSwapINV-3.78
+ +Table 11: Performance (test set accuracy $(\%)$ ) for individual transforms over a no-transform baseline averaged across all datasets. The INV / SIB types were SIB for the sentiment analysis datasets and INV for the topic classification datasets. + +E RQ2. Detailed Defect Detection Results + +
DatasetTPTest Suite AccuracyDatasetTPTest Suite Accuracy
AG NewsORIG96.22Amazon PolarityORIG94.68
INV89.77INV86.91
C2S66.67C2S75.78
SIB74.77SIB80.99
TextMix59.97TextMix79.83
SentMix60.48SentMix79.83
WordMix58.82WordMix70.08
INVSIB74.50INVSIB82.78
DBpediaORIG99.04Yelp PolarityORIG95.15
INV93.27INV89.76
C2S84.17C2S80.39
SIB71.67SIB82.76
TextMix54.42TextMix80.67
SentMix57.09SentMix81.09
WordMix57.48WordMix76.91
INVSIB77.79INVSIB84.32
Yahoo! AnswersORIG75.64IMDBORIG99.25
INV69.71INV90.01
C2S63.08C2S65.15
SIB58.87SIB84.48
TextMix48.77TextMix78.42
SentMix51.82SentMix79.45
WordMix53.58WordMix72.64
INVSIB62.17INVSIB86.42
+ +Table 12: Test suite accuracy (%) by dataset and ${TP}$ . Lower accuracy indicates higher defect detection potential. ${TP}\mathrm{{Ps}}$ are color coded by their variant type,where orange and light green are invariant and sibylvariant,respectively. + +F RQ3. Detailed Robustness Results + +
DatasetTPTFDWBTBDatasetTPTFDWBTB
AG NewsORIG0.690.560.54Amazon PolarityORIG0.480.400.42
INV0.730.590.48INV0.490.420.36
C2S0.660.560.48C2S0.510.490.50
SIB0.800.690.49SIB0.680.550.63
TextMix0.780.600.45TextMix0.560.410.46
SentMix0.700.570.61SentMix0.580.470.46
WordMix0.840.710.60WordMix0.740.690.73
αTextMix0.770.600.57αTextMix0.550.390.48
αSentMix0.600.430.46αSentMix0.560.490.53
αWordMix0.790.640.55αWordMix0.740.690.69
INVSIB0.780.620.57INVSIB0.650.580.60
DBpediaORIG0.920.550.64Yelp PolarityORIG0.480.200.28
INV0.760.470.48INV0.640.410.52
C2S0.850.590.56C2S0.760.580.66
SIB0.800.580.64SIB0.680.530.65
TextMix0.850.480.41TextMix0.760.610.67
SentMix0.960.690.69SentMix0.700.520.60
WordMix0.910.640.76WordMix0.780.720.76
αTextMix0.820.510.53αTextMix0.610.390.53
αSentMix0.870.400.51αSentMix0.940.770.87
αWordMix0.830.550.49αWordMix0.620.490.56
INVSIB0.830.560.52INVSIB0.750.510.61
Yahoo! AnswersORIG0.540.460.52IMDBORIG0.860.250.71
INV0.570.490.49INV0.700.500.68
C2S0.580.530.54C2S0.930.590.89
SIB0.560.500.53SIB0.710.470.71
TextMix0.580.470.50TextMix0.850.320.73
SentMix0.720.640.72SentMix0.800.460.78
WordMix0.650.520.63WordMix0.840.740.84
αTextMix0.540.470.49αTextMix0.560.320.55
αSentMix0.480.410.48αSentMix0.950.910.96
αWordMix0.660.590.61αWordMix0.730.520.68
INVSIB0.540.440.46INVSIB0.890.790.88
+ +Table 13: Attack success by dataset and $TP$ for three adversarial algorithms: TextFooer (TF), DeepWordBug (DWB), and TextBugger (TB). Lower attack success indicates higher adversarial robustness. $TPs$ are color coded by their variant type, where orange and light green are invariant and sibylvariant, respectively. \ No newline at end of file diff --git a/sibylvarianttransformationsforrobusttextclassification/images.zip b/sibylvarianttransformationsforrobusttextclassification/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..92485fc33a8e64468407e2e4bd7741bbf7f7caa7 --- /dev/null +++ b/sibylvarianttransformationsforrobusttextclassification/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:575f4ed07a6d4a6419d1ede4d6b1f270c350fb6a81e8f4bc8b6107af6691873b +size 2264629 diff --git a/sibylvarianttransformationsforrobusttextclassification/layout.json b/sibylvarianttransformationsforrobusttextclassification/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..67e086af393cfb4c2057902889850d4f246cb8b2 --- /dev/null +++ b/sibylvarianttransformationsforrobusttextclassification/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1bec244dc96e53df927a8c7744d4b21c75e467bc80917a4238d67fefafdbc009 +size 485262 diff --git a/singlemodelensembleforsubwordregularizedmodelsinlowresourcemachinetranslation/8aaa1fe8-c908-4f0d-b01b-14956fd418be_content_list.json b/singlemodelensembleforsubwordregularizedmodelsinlowresourcemachinetranslation/8aaa1fe8-c908-4f0d-b01b-14956fd418be_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..a8887cefeef281ba02e9207a083f2faa15164b3d --- /dev/null +++ b/singlemodelensembleforsubwordregularizedmodelsinlowresourcemachinetranslation/8aaa1fe8-c908-4f0d-b01b-14956fd418be_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2f58da6b56e0a850a5d6ed9e13ef1e3551c053846fcf342439b2be48f1ee44fc +size 41531 diff --git a/singlemodelensembleforsubwordregularizedmodelsinlowresourcemachinetranslation/8aaa1fe8-c908-4f0d-b01b-14956fd418be_model.json b/singlemodelensembleforsubwordregularizedmodelsinlowresourcemachinetranslation/8aaa1fe8-c908-4f0d-b01b-14956fd418be_model.json new file mode 100644 index 0000000000000000000000000000000000000000..65bdb3229a6843eaf0bf9642905afad101257ad7 --- /dev/null +++ b/singlemodelensembleforsubwordregularizedmodelsinlowresourcemachinetranslation/8aaa1fe8-c908-4f0d-b01b-14956fd418be_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:58242712772299d5e4c7ea39e011151420a35ae78b075a57b0c942db6373c347 +size 49405 diff --git a/singlemodelensembleforsubwordregularizedmodelsinlowresourcemachinetranslation/8aaa1fe8-c908-4f0d-b01b-14956fd418be_origin.pdf b/singlemodelensembleforsubwordregularizedmodelsinlowresourcemachinetranslation/8aaa1fe8-c908-4f0d-b01b-14956fd418be_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..5ca83147996848f69786b30ad63e9f0513dbe6ad --- /dev/null +++ b/singlemodelensembleforsubwordregularizedmodelsinlowresourcemachinetranslation/8aaa1fe8-c908-4f0d-b01b-14956fd418be_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6307e83146fbc61b57a842cfefbbac5437dddd61716e4e04f363c06d3d70da73 +size 297328 diff --git a/singlemodelensembleforsubwordregularizedmodelsinlowresourcemachinetranslation/full.md b/singlemodelensembleforsubwordregularizedmodelsinlowresourcemachinetranslation/full.md new file mode 100644 index 0000000000000000000000000000000000000000..276b64fbe4787114227b2102a01e775053a36bc1 --- /dev/null +++ b/singlemodelensembleforsubwordregularizedmodelsinlowresourcemachinetranslation/full.md @@ -0,0 +1,194 @@ +# Single Model Ensemble for Subword Regularized Models in Low-Resource Machine Translation + +Sho Takase and Tatsuya Hiraoka and Naoaki Okazaki + +Tokyo Institute of Technology + +{sho.takase@nlp.,tatsuya.hiraoka@nlp.,okazaki@}c.titech.ac.jp + +# Abstract + +Subword regularizations use multiple subword segmentations during training to improve the robustness of neural machine translation models. In previous subword regularizations, we use multiple segmentations in the training process but use only one segmentation in the inference. In this study, we propose an inference strategy to address this discrepancy. The proposed strategy approximates the marginalized likelihood by using multiple segmentations including the most plausible segmentation and several sampled segmentations. Because the proposed strategy aggregates predictions from several segmentations, we can regard it as a single model ensemble that does not require any additional cost for training. Experimental results show that the proposed strategy improves the performance of models trained with subword regularization in low-resource machine translation tasks. + +# 1 Introduction + +Subword regularizations are the technique to make a model robust to segmentation errors by using multiple subword segmentations instead of only the most plausible segmentation during the training process (Kudo, 2018; Provilkov et al., 2020). Previous studies demonstrated that subword regularizations improve the performance of LSTM-based encoder-decoders and Transformers in various machine translation datasets, especially in low-resource settings (Kudo, 2018). + +However, previous subword regularizations contain the discrepancy between the training and inference. In the training process, we stochastically re-segment a given sequence into subwords based on statistics such as the uni-gram language model (Kudo, 2018). Thus, we use multiple segmentations for each input sequence. In contrast, we use only the most plausible segmentation in the inference phase. We expect that we can improve the performance by solving this discrepancy. + +To solve this discrepancy, we propose an inference strategy that uses multiple subword segmentations. We construct multiple subword segmentations for an input in the same manner as that in the training process, and then aggregate the predictions from each segmentation. Therefore, our proposed inference strategy can be regarded as a single model ensemble using multiple segmentations. Figure 1 illustrates the overview of previous methods and our proposed inference strategy. + +We conduct experiments on several machine translation datasets. Experimental results show that the proposed strategy improves the performance of a subword regularized model without any additional costs in the training procedure when the subword regularization significantly contributes to the performance, i.e., in low-resource settings. Moreover, we indicate that our strategy can be combined with a widely used model ensemble technique. + +# 2 Subword Regularization + +Our proposed strategy is based on a model trained with subword regularization. Thus, we briefly describe subword regularization in this section. + +Kudo (2018) proposed subword regularization to improve the robustness of a neural machine translation model. Let $X$ and $Y$ be the source and target sentences, $\mathbf{x} = (x_{1},\dots,x_{S})$ and $\mathbf{y} = (y_{1},\dots,y_{T})$ be the most plausible subword segmentations corresponding to $X$ and $Y$ . In the vanilla training strategy, i.e., without subword regularization, we train the parameters of a neural machine translation model $\theta$ to maximize the following log-likelihood: + +$$ +\mathcal {L} (\boldsymbol {\theta}) = \sum_ {(X, Y) \in \mathcal {D}} \log P (\mathbf {y} | \mathbf {x}; \boldsymbol {\theta}), \tag {1} +$$ + +$$ +P (\mathbf {y} | \mathbf {x}; \boldsymbol {\theta}) = \prod_ {t = 1} ^ {T} P \left(y _ {t} | \mathbf {x}, \mathbf {y} _ {< t}; \boldsymbol {\theta}\right), \tag {2} +$$ + +where $\mathcal{D}$ is the training data and $\mathbf{y}_{< t} = (y_1, \dots, y_{t-1})$ . + +![](images/c5ea473cd591e079750408670df97c9468a02328d937540b83400b0acfaa63c0.jpg) +Figure 1: Overview of previous methods and the proposed inference strategy for an English-German pair "We see the ..." and "Wir sehen das ..." In the vanilla setting, we use the most plausible segmentation only in the training and inference. In the subword regularization, we use multiple segmentations during training but use only the most plausible segmentation in the inference phase. In the proposed inference strategy, we use multiple segmentations in both the training and inference phases. + +![](images/c840d3f7153cd25680506c11fc2dbd66aa5da4c1c4fe87de3724405d59788f20.jpg) + +![](images/66c9a85b015b0101b8569ff355d33b74b68c55d0b4222eae825cc359dfb0e1e0.jpg) + +In contrast, subword regularization uses multiple subword segmentations during training. Let $P(\mathbf{x}'|X)$ and $P(\mathbf{y}'|Y)$ be segmentation probabilities for sequences $X$ and $Y$ , respectively. We optimize the parameters $\theta$ with the following marginalized likelihood in subword regularization: + +$$ +\mathcal {L} ^ {\prime} (\boldsymbol {\theta}) = \sum_ {(X, Y) \in \mathcal {D}} \underset {\mathbf {y} ^ {\prime} \sim P \left(\mathbf {y} ^ {\prime} \mid Y\right)} {\mathbb {E}} [ \log P \left(\mathbf {y} ^ {\prime} \mid \mathbf {x} ^ {\prime}; \boldsymbol {\theta}\right) ]. \tag {3} +$$ + +Because the number of possible segmentations increases exponentially with respect to the sequence length, it is impractical to optimize Equation (3) exactly. Thus, Kudo (2018) approximated Equation (3) with sampled segmentations from $P(\mathbf{x}'|X)$ and $P(\mathbf{y}'|Y)$ , + +$$ +\mathcal {L} ^ {\prime} (\boldsymbol {\theta}) \cong \sum_ {(X, Y) \in \mathcal {D}} \log P \left(\mathbf {y} _ {j} \mid \mathbf {x} _ {i}; \boldsymbol {\theta}\right), \tag {4} +$$ + +$$ +\mathbf {x} _ {i} \sim P \left(\mathbf {x} ^ {\prime} \mid X\right), \tag {5} +$$ + +$$ +\mathbf {y} _ {j} \sim P (\mathbf {y} ^ {\prime} | Y). \tag {6} +$$ + +We sample $\mathbf{x}_i$ and $\mathbf{y}_j$ for every mini-batch during training to yield a good approximation. + +In the inference phase, we input the most plausible segmentation $\mathbf{x}$ and search a sequence $\mathbf{y}^*$ that maximizes the log-likelihood $\log P(\mathbf{y}|\mathbf{x};\boldsymbol {\theta})$ In other words, we input one segmentation to the model even though we use multiple segmentations during training. + +
LanguageVocabTrainDevTest
En-De6K160K72836750
En-Vi4K133K15531268
+ +Table 1: Details of each dataset. + +# 3 Proposed Method + +# 3.1 Proposed Inference Strategy + +As described, previous subword regularizations use multiple segmentations during training but only one segmentation in the inference. To solve this discrepancy, we propose an inference strategy that uses multiple segmentations as inputs. In the proposed strategy, we search a sequence $\mathbf{y}^*$ that maximizes the following approximated marginalized likelihood: + +$$ +\sum_ {k = 1} ^ {n} \log P (\mathbf {y} | \mathbf {x} _ {k}; \boldsymbol {\theta}), \tag {7} +$$ + +$$ +\mathbf {x} _ {k} = \left\{ \begin{array}{l l} \mathbf {x} & k = 1 \\ \mathbf {x} _ {i} \sim P \left(\mathbf {x} ^ {\prime} \mid X\right) & \text {O t h e r w i s e .} \end{array} \right. \tag {8} +$$ + +In short, we approximate the marginalized likelihood in Equation (3) with the most plausible segmentation and sampled $n - 1$ segmentations. + +# 3.2 Relation to Model Ensemble + +We often apply the model ensemble technique to achieve better performance (Barrault et al., 2019). In the model ensemble, we aggregate the predictions from $M$ models as follows: + +$$ +\sum_ {m = 1} ^ {M} \log P (\mathbf {y} | \mathbf {x}; \boldsymbol {\theta} _ {m}), \tag {9} +$$ + +
MethodEn-DeDe-EnEn-ViVi-En
Single Model
Vanilla28.8934.8731.0931.43
+ w/ subword regularization (1)29.5135.5331.8631.60
(1) + n-best decoding29.5935.5531.9431.44
(1) + Proposed strategy29.7235.6832.1631.60
Model Ensemble
Vanilla30.0336.0432.2232.46
+ w/ subword regularization (2)30.8336.8333.2232.83
(2) + n-best decoding30.8136.8333.2932.76
(2) + Proposed strategy30.8636.9533.4433.04
+ +Table 2: BLEU scores on English-German and English-Vietnamese datasets. + +where $\theta_{m}$ denotes parameters of the $m$ -th model. + +In comparison to this model ensemble, the proposed strategy does not use multiple models but aggregates predictions from multiple segmentations. Thus, our proposed strategy can be regarded as the single model ensemble with multiple inputs. In addition, we can combine the proposed strategy with the model ensemble. We investigate the effect of this combination through experiments. + +# 4 Experiments + +# 4.1 Datasets + +Kudo (2018) reported that subword regularization is especially effective in low-resource settings. Thus, we focus on low-resource machine translation tasks. We used IWSLT 2014 English-German (En-De) data in the same pre-processing manner as Ranzato et al. $(2016)^{2}$ because this dataset is widely-used as the low-resource setting (Sennrich and Zhang, 2019; Takase and Kiyono, 2021). In addition, we used IWSLT 2015 English-Vietnamese (En-Vi) data which were pre-processed by Luong and Manning $(2015)^{3}$ . + +We used SentencePiece (Kudo and Richardson, 2018) to construct a vocabulary set. We set the vocabulary sizes to 6k and 4k for En-De and En-Vi, respectively. Table 1 summarizes the dataset sizes. + +# 4.2 Methods + +We used Transformer (Vaswani et al., 2017) as our encoder-decoder architecture because Transformers are widely used as strong baselines in sequence-to-sequence problems including machine transla + +tion. We investigate the performance of the following configurations. + +Vanilla: We trained Transformer (Vaswani et al., 2017) without subword regularization. For hyperparameters, we adopted the IWSLT setting in fairseq $^4$ (Ott et al., 2019). + +Subword regularization: We trained Transformer, whose hyper-parameters are identical to Vanilla, with subword regularization. We set the hyperparameter $\alpha$ for sampling segmentations in subword regularization 0.2 in the same as Kudo (2018). $n$ -best decoding: Kudo (2018) proposed $n$ -best decoding that generates $n$ sequences corresponding to $n$ -best segmentations and then outputs the most plausible sequence. We used this strategy for the model trained with subword regularization in the inference phase. + +Proposed: We applied the proposed strategy to the model trained with subword regularization. To ensure fair comparison, we used the identical number, $n = 5$ , for the number of sampled segmentations and $n$ -best decoding. + +# 4.3 Results + +Table 2 shows BLEU scores of each configuration. For each configuration, we trained three models with different random seeds, and reported the averaged scores except for the proposed strategy. When we used the proposed strategy, we generated sequences three times with different random seeds for each model5, and averaged the 9 (3 models × + +![](images/7a8462bd68f2e11d9ccb4ed9bcbc53aa1e92130a22ebbfffbe77d667c0dea8b4.jpg) +Figure 2: BLEU scores on newstest2013 when we vary the training data size. + +3 sequences) scores. Table 2 also indicates BLEU scores with the ensemble of the above 3 models. + +For the single model setting, Table 2 shows that subword regularization improved BLEU scores in all language pairs. In particular, subword regularization gained more than 0.5 BLEU score from Vanilla except for Vi-En. In these language pairs, the proposed strategy provided further improvements. The proposed strategy achieved better performance than $n$ -best decoding when we used the same number of segmentations as inputs. Thus, our proposed method is more effective as the inference strategy. Moreover, our strategy maintained the score in Vi-En although $n$ -best decoding degraded the score slightly. Therefore, the proposed strategy had no negative effect on the inference. + +For the model ensemble setting, Table 2 indicates that subword regularization also improved BLEU scores in all language pairs. In this setting, the proposed strategy also provided further improvements in all language pairs. Thus, the proposed strategy is effective even if we conduct the model ensemble technique. + +# 5 Performance in Enough Training Data + +Section 4 shows the results in low-resource settings but previous studies reported that subword regularizations can improve the performance if we use sufficient training data. Thus, we investigate the performance of subword regularization and proposed strategy by varying the size of training data. + +We used the WMT 2016 English-to-German training dataset, which is widely used in previous studies (Vaswani et al., 2017; Provilkov et al., 2020; Ott et al., 2018). This dataset contains 4.5M sentence pairs, that are more than 25 times as many as + +IWSLT datasets. We conducted pre-processing in the same manner as that in Ott et al. (2018). We trained the Transformer (base) model in Vaswani et al. (2017). For subword regularization, we set $\alpha = 0.5$ in the same as Kudo (2018). We evaluated BLEU scores on newstest2013, which is widely used as a valid data. + +Figure 2 shows BLEU scores of each method for each training data size. This figure indicates that the model trained with subword regularization outperformed Vanilla in all training data sizes but the improvement decreased in accordance with the increase in the training data. The proposed strategy slightly improved the performance from subword regularization for the small training data but the improvement also decreased as the training data increased. When we used the entire training data (4.5M translation pairs), the BLEU score of the proposed strategy was identical to that of subword regularization. This result implies that the impact of the proposed strategy on the performance is small when the improvement by subword regularization is small. In other words, the proposed strategy is effective especially in low-resource settings because subword regularization probably provides much improvement in low-resource settings. However, we emphasize that the proposed strategy has no negative effect on the BLEU score for sufficient training data fortunately. + +# 6 Related Work + +In this study, we proposed the inference strategy to mitigate the discrepancy between the training and inference in subword regularizations. In experiments, we focused the subword regularization proposed by Kudo (2018) but we can apply the proposed inference strategy to variants of the subword regularization such as BPE dropout (Provilkov et al., 2020) and compositional word replacement (Hiraoka et al., 2022). Takase and Kiyono (2021) reported that simple perturbations such as word dropout are effective in a large amount of training data. Thus, we might improve the performance of the model trained with such simple perturbations if we use multiple inputs constructed by the same perturbation during the inference. + +We focused on an input of a neural encoder-decoder. In contrast, Gal and Ghahramani (2016) focused on internal layers. For neural network methods, we often apply the dropout during the training but do not use it in the inference. Gal + +and Ghahramani (2016) proposed the variational inference to mitigate this gap on the dropout. + +As described in Section 1, our proposed inference strategy can be regarded as a single model ensemble. Huang et al. (2017) and Kuwabara et al. (2020) also proposed single model ensemble methods. Huang et al. (2017) proposed the snapshot ensemble that uses multiple models in the middle of the training. Kuwabara et al. (2020) used pseudo-tags and predefined distinct vectors to obtain multiple models virtually during the training of a single model. Since these methods are orthogonal to ours, we can combine our proposed strategy. + +# 7 Conclusion + +We proposed an inference strategy to address the discrepancy between the training and inference in subword regularizations. Our proposed strategy uses multiple subword segmentations as inputs to approximate the marginalized likelihood used as the objective function during training. The proposed strategy improved the performance of the model trained with subword regularization in cases where subword regularization provided the significant improvement, i.e., in low-resource settings. Moreover, the proposed strategy outperformed the $n$ -best decoding strategy (Kudo, 2018). Experimental results show that our proposed strategy has no negative effect on the BLEU score even if the improvement by subword regularization is small. Because the proposed inference strategy does not require any additional training cost, we encourage using the strategy to highlight the potential of models trained with subword regularization. + +# Ethical Considerations + +Limitations: The proposed method improves the performance of encoder-decoders in the inference phase in the situation where subword regularizations are effective. Thus, if subword regularizations are ineffective, the proposed method also might be ineffective. Since subword regularizations are especially effective when the training data size is small (Hiraoka et al., 2021), the proposed method is effective in low-resource settings. In contrast, as in Section 5, the improvements of both methods are small when we have an enough training data. + +Risks: Since the proposed method uses the standard neural encoder-decoder architecture without any modification, the proposed method also contains the risks of neural encoder-decoders. For + +example, the under translation, that ignores some information in a source sentence during the translation, might happen. + +# Acknowledgements + +This work was supported by JSPS KAKENHI Grant Number JP21K17800 and JST ACT-X Grant Number JPMJAX200I. The first author is supported by Microsoft Research Asia (MSRA) Collaborative Research Program. + +# References + +Loic Barrault, Ondrej Bojar, Marta R. Costa-jussa, Christian Federmann, Mark Fishel, Yvette Graham, Barry Haddow, Matthias Huck, Philipp Koehn, Shervin Malmasi, Christof Monz, Mathias Muller, Santanu Pal, Matt Post, and Marcos Zampieri. 2019. Findings of the 2019 conference on machine translation (WMT19). In Proceedings of the Fourth Conference on Machine Translation (WMT), pages 1-61. +Yarin Gal and Zoubin Ghahramani. 2016. A theoretically grounded application of dropout in recurrent neural networks. In Advances in Neural Information Processing Systems, volume 29. Curran Associates, Inc. +Tatsuya Hiraoka, Sho Takase, Kei Uchiumi, Atsushi Keyaki, and Naoaki Okazaki. 2021. Joint optimization of tokenization and downstream model. In *Findings of the Association for Computational Linguistics: ACL-IJCNLP* 2021, pages 244-255. +Tatsuya Hiraoka, Sho Takase, Kei Uchiumi, Atsushi Keyaki, and Naoaki Okazaki. 2022. Word-level perturbation considering word length and compositional subwords. In *Findings of the Association for Computational Linguistics: ACL* 2022. +Gao Huang, Yixuan Li, Geoff Pleiss, Zhuang Liu, John E. Hopcroft, and Kilian Q. Weinberger. 2017. Snapshot ensembles: Train 1, get M for free. In Proceedings of the Fifth International Conference on Learning Representations (ICLR). +Taku Kudo. 2018. Subword regularization: Improving neural network translation models with multiple subword candidates. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (ACL), pages 66-75. +Taku Kudo and John Richardson. 2018. SentencePiece: A simple and language independent subword tokenizer and tokenizer for neural text processing. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 66-71. +Ryosuke Kuwabara, Jun Suzuki, and Hideki Nakayama. 2020. Single model ensemble using pseudo-tags and distinct vectors. In Proceedings of the 58th Annual + +Meeting of the Association for Computational Linguistics (ACL), pages 3006-3013. +Minh-Thang Luong and Christopher D. Manning. 2015. Stanford neural machine translation systems for spoken language domain. In International Workshop on Spoken Language Translation (IWSLT). +Myle Ott, Sergey Edunov, Alexei Baevski, Angela Fan, Sam Gross, Nathan Ng, David Grangier, and Michael Auli. 2019. *fairoseq: A fast, extensible toolkit for sequence modeling.* In *Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (NAACL-HLT)*, pages 48-53. +Myle Ott, Sergey Edunov, David Grangier, and Michael Auli. 2018. Scaling neural machine translation. In Proceedings of the Third Conference on Machine Translation (WMT), pages 1-9. +Ivan Provilkov, Dmitrii Emelianenko, and Elena Voita. 2020. BPE-dropout: Simple and effective subword regularization. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics (ACL), pages 1882-1892. +Marc'Aurelio Ranzato, Sumit Chopra, Michael Auli, and Wojciech Zaremba. 2016. Sequence level training with recurrent neural networks. In Proceedings of the Fourth International Conference on Learning Representations (ICLR). +Rico Sennrich and Biao Zhang. 2019. Revisiting low-resource neural machine translation: A case study. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics (ACL), pages 211-221. +Sho Takase and Shun Kiyono. 2021. Rethinking perturbations in encoder-decoders for fast training. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (NAACL-HLT), pages 5767-5780. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In Advances in Neural Information Processing Systems 30 (NIPS), pages 5998-6008. \ No newline at end of file diff --git a/singlemodelensembleforsubwordregularizedmodelsinlowresourcemachinetranslation/images.zip b/singlemodelensembleforsubwordregularizedmodelsinlowresourcemachinetranslation/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..3d15819b28fd5ddc1ee473dda6893cb00f1d0a53 --- /dev/null +++ b/singlemodelensembleforsubwordregularizedmodelsinlowresourcemachinetranslation/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea45c5e9675bb761882ced455259d1f2ea059e337407c3ba722f70d68081c845 +size 194475 diff --git a/singlemodelensembleforsubwordregularizedmodelsinlowresourcemachinetranslation/layout.json b/singlemodelensembleforsubwordregularizedmodelsinlowresourcemachinetranslation/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..35c1d2650825f62c8bbf29816d7e4fec53298075 --- /dev/null +++ b/singlemodelensembleforsubwordregularizedmodelsinlowresourcemachinetranslation/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4e14a71b8c11ac870805630f8515c3b061b85b42230a3a7eb16304f2dc7a1e08 +size 198516 diff --git a/squareonebiasinnlptowardsamultidimensionalexplorationoftheresearchmanifold/7cb3375b-8047-4252-ae8a-d0b75c332583_content_list.json b/squareonebiasinnlptowardsamultidimensionalexplorationoftheresearchmanifold/7cb3375b-8047-4252-ae8a-d0b75c332583_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..8fb65de4204520474c2246c43a8b6ec1c7f68b12 --- /dev/null +++ b/squareonebiasinnlptowardsamultidimensionalexplorationoftheresearchmanifold/7cb3375b-8047-4252-ae8a-d0b75c332583_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ad71a9057b06a5abf25a61ead0fa8d3d2f993081ee29c3833b6a8e820eecedd3 +size 92687 diff --git a/squareonebiasinnlptowardsamultidimensionalexplorationoftheresearchmanifold/7cb3375b-8047-4252-ae8a-d0b75c332583_model.json b/squareonebiasinnlptowardsamultidimensionalexplorationoftheresearchmanifold/7cb3375b-8047-4252-ae8a-d0b75c332583_model.json new file mode 100644 index 0000000000000000000000000000000000000000..2917c19d844d3a202f39a83ea35374f61004b450 --- /dev/null +++ b/squareonebiasinnlptowardsamultidimensionalexplorationoftheresearchmanifold/7cb3375b-8047-4252-ae8a-d0b75c332583_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5b6391d2c880d437bb305adbf509c87b283d31af4454abbd7c8091cf2fc3948b +size 121641 diff --git a/squareonebiasinnlptowardsamultidimensionalexplorationoftheresearchmanifold/7cb3375b-8047-4252-ae8a-d0b75c332583_origin.pdf b/squareonebiasinnlptowardsamultidimensionalexplorationoftheresearchmanifold/7cb3375b-8047-4252-ae8a-d0b75c332583_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..861232ec720f84ca478c9fa96b0c1ede73b6dd7d --- /dev/null +++ b/squareonebiasinnlptowardsamultidimensionalexplorationoftheresearchmanifold/7cb3375b-8047-4252-ae8a-d0b75c332583_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4f13ea8c61063f4feac179ca3047b0ccc70d264734e98e53d528f8c7dd7fed25 +size 387031 diff --git a/squareonebiasinnlptowardsamultidimensionalexplorationoftheresearchmanifold/full.md b/squareonebiasinnlptowardsamultidimensionalexplorationoftheresearchmanifold/full.md new file mode 100644 index 0000000000000000000000000000000000000000..4131e90615e41da82af0b5247f3266095f9c4a25 --- /dev/null +++ b/squareonebiasinnlptowardsamultidimensionalexplorationoftheresearchmanifold/full.md @@ -0,0 +1,307 @@ +# Square One Bias in NLP: Towards a Multi-Dimensional Exploration of the Research Manifold + +Sebastian Ruder* + +Google Research ruder@google.com + +Ivan Vulic* +University of Cambridge +iv250@cam.ac.uk + +Anders Søgaard* +University of Copenhagen +soegaard@di.ku.dk + +# Abstract + +The prototypical NLP experiment trains a standard architecture on labeled English data and optimizes for accuracy, without accounting for other dimensions such as fairness, interpretability, or computational efficiency. We show through a manual classification of recent NLP research papers that this is indeed the case and refers to it as the square one experimental setup. We observe that NLP research often goes beyond the square one setup, e.g., focusing not only on accuracy, but also on fairness or interpretability, but typically only along a single dimension. Most work targeting multilinguality, for example, considers only accuracy; most work on fairness or interpretability considers only English; and so on. Such one-dimensionality of most research means we are only exploring a fraction of the NLP research search space. We provide historical and recent examples of how the square one bias has led researchers to draw false conclusions or make unwise choices, point to promising yet unexplored directions on the research manifold, and make practical recommendations to enable more multi-dimensional research. We open-source the results of our annotations to enable further analysis. $^{1}$ + +# 1 Introduction + +Our categorization of objects, say screwdrivers or NLP experiments, is heavily biased by early prototypes (Sherman, 1985; Das-Smaal, 1990). If the first 10 screwdrivers we see are red and for hexagon socket screws, this will bias what features we learn to associate with screwdrivers. Likewise, if the first 10 NLP experiments we see or conduct are in sentiment analysis, this will likely also bias how we think of NLP experiments in the future. + +In this position paper, we postulate that we can meaningfully talk about the prototypical NLP ex + +![](images/c5490f49643514c81963cb8f8aff4a980fee8c14fd61168a505d71394dc61665.jpg) +Figure 1: Visualization of contributions of ACL 2021 oral papers along 4 dimensions: multilinguality, fairness and bias, efficiency, and interpretability (indicated by color). Most work is clustered around the SQUARE ONE or along a single dimension. + +periment, and that the existence of such an experimental prototype steers and biases the research dynamics in our community. We will refer to this prototype as NLP's SQUARE ONE—and to the bias that follows from it, as the SQUARE ONE BIAS. We argue this bias manifests in a particular way: Since research is a creative endeavor, and researchers aim to push the research horizon, most research papers in NLP go beyond this prototype, but only along a single dimension at a time. Such dimensions might include multilinguality, efficiency, fairness, and interpretability, among others. The effect of the SQUARE ONE BIAS is to baseline novel research contributions, rewarding work that differs from the prototype in a concise, one-dimensional way. + +We present several examples of this effect in practice. For instance, analyzing the contributions of ACL 2021 papers along 4 dimensions, we observe that most work is either clustered around the SQUARE ONE or makes a contribution along a single dimension (see Figure 1). Multilingual work typically disregards efficiency, fairness, and + +interpretability. Work on efficient NLP typically only performs evaluations on English datasets, and disregards fairness and interpretability. Fairness and interpretability work is also mostly limited to English, and tends to disregard efficiency concerns. + +We argue that the SQUARE ONE BIAS has several negative effects, most of which amount to the study of one of the above dimensions being biased by ignoring the others. Specifically, by focusing only on exploring the edges of the manifold, we are not able to identify the non-linear interactions between different research dimensions. We highlight several examples of such interactions in Section 3. Overall, we encourage a focus on combining multiple dimensions on the research manifold in future NLP research, and delve deeper into studying their (linear and non-linear) interactions. + +Contributions. We first establish that we can meaningfully talk about the prototypical NLP experiment, through a series of annotation experiments and surveys. This prototype amounts to applying a standard architecture to an English dataset and optimizing for accuracy or F1. We discuss the impact of this prototype on our research community, and the bias it introduces. We then discuss the negative effects of this bias. We also list work that has taken steps to overcome the bias. Finally, we highlight blind spots and unexplored research directions and make practical recommendations, aiming to inspire the community towards conducting more 'multi-dimensional' research (see Figure 1). + +# 2 Finding the Square One + +In order to determine the existence and nature of a SQUARE ONE, we assess contemporary research in NLP along a number of different dimensions. + +Dimensions. We identify potential themes in NLP research by reviewing the Call for Papers, publication statistics by area, and paper titles of recent NLP conferences. We focus on general dimensions that are not tied to a particular task and are applicable to any NLP application.2 We furthermore focus on dimensions that are represented in a reasonable fraction of NLP papers (at least $5\%$ of ACL 2021 oral papers).3 Our final selection focuses on 4 dimensions along which papers may make research contributions: multilinguality, fairness and bias, ef + +ficiency, and interpretability. Compared to prior work that annotates the values of ML research papers (Birhane et al., 2021), we are not concerned with a paper's motivation but whether its practical contributions constitute a meaningful departure from the SQUARE ONE. For each paper, we annotate whether it makes a contribution along each dimension as well as the languages and metrics it employs for evaluation. We provide the detailed annotation guidelines in Appendix A.1. + +ACL 2021 Oral Papers. We annotate the 461 papers that were presented orally at ACL 2021, a representative cross-section of the 779 papers accepted to the main conference. The general statistics from our classification of ACL 2021 papers are presented in Table 1. In addition, we highlight the statistics for the conference areas (tracks) corresponding to 3 of the 4 dimensions $^{4}$ , as well as for the top 5 areas with the most papers. We show statistics for the remaining areas in Appendix A.2. We additionally visualize their distribution in Figure 1. Overall, almost $70\%$ of papers evaluate only on English, clearly highlighting a lack of language diversity in NLP (Bender, 2011; Joshi et al., 2020). Almost $40\%$ of papers only evaluate using accuracy and/or F1, foregoing metrics that may shed light on other aspects of model behavior. $56.6\%$ of papers do not study any of the four major dimensions that we investigated. We refer to this standard experimental setup—evaluating only on English and optimizing for accuracy or another performance metric without considering other dimensions—as the SQUARE ONE. + +Regarding work that moves from the SQUARE ONE, most papers make a contribution in terms of efficiency, followed by multilinguality. However, most papers that evaluate on multiple languages are part of the corresponding MT and Multilinguality track. Despite being an area receiving increasing attention (Blodgett et al., 2020), only $6.3\%$ of papers evaluate the bias or fairness of a method. Overall, only $6.1\%$ of papers make a contribution along two or more of these dimensions. Among these, joint contributions on both multilinguality and efficiency are the most common (see Figure 1). In fact, 22 of the 26 two-or-more-dimensional papers focus on efficiency, and 17 of these on the combination + +
Area# papersEnglishAccuracy / F1MultilingualityFairness and biasEfficiencyInterpretability>1 dimension
ACL 2021 oral papers46169.4%38.8%13.9%6.3%17.8%11.7%6.1%
MT and Multilinguality580.0%15.5%56.9%5.2%19.0%6.9%13.8%
Interpretability and Analysis1888.9%27.8%5.6%0.0%5.6%66.7%5.6%
Ethics in NLP683.3%0.0%0.0%100.0%0.0%0.0%0.0%
Dialog and Interactive Systems4290.5%21.4%0.0%9.5%23.8%2.4%2.4%
Machine Learning for NLP4266.7%40.5%19.0%4.8%50.0%4.8%9.5%
Information Extraction3680.6%91.7%8.3%0.0%25.0%5.6%8.3%
Resources and Evaluation3577.1%42.9%5.7%8.6%5.7%14.3%5.7%
NLP Applications3073.3%43.3%0.0%10.0%20.0%10.0%0.0%
+ +of multilinguality and efficiency. This means less than $1\%$ of the ACL 2021 papers consider combinations of (two or more of) multilinguality, fairness and interpretability. We find this surprising, given these topics are considered among the most popular topics in the field. + +Some areas have particularly concerning statistics. A large majority of research work in dialog (90.5%), summarization (91.7%), sentiment analysis (100%), and language grounding (100%) is done only on English; however, ways of expressing sentiment (Volkova et al., 2013; Yang and Eisenstein, 2017; Vilares et al., 2018) and visually grounded reasoning (Liu et al., 2021a; Yin et al., 2021) do vary across languages and cultures. Systems in the top tracks tend to evaluate efficiency, but in general do not consider fairness or interpretability of the proposed methods. Even the creation of new resources and evaluation sets (cf., Resource and Evaluation in Table 1) seems to be directed towards rewarding and enabling SQUARE ONE experiments; favoring English (77.1%), and with modest efforts on other dimensions. Notably, we only identified a single paper that considers three dimensions (Renduchintala et al., 2021). This paper considers gender bias (Fairness) in relation to speed-quality (Efficiency) trade-offs in multilingual machine translation (Multilinguality). Finally, we observe that best-paper award winning papers are not more likely to consider more than one of the four dimensions. Only 1 in 8 papers did; the best paper (Xu et al., 2021), like most two-dimensional ACL 2021 papers, considered multilinguality and efficiency. + +Test-of-Time Award Recipients. Current papers provide us with a snapshot of actual current research practices, but the one-dimensionality of the best paper award winning papers at ACL 2021 suggest the SQUARE ONE BIAS also biases what we + +Table 1: The number of ACL 2021 oral papers (top row) and of papers in each area (bottom rows) as well as the fractions that only evaluate on English, only use accuracy / F1, make contributions along one of four dimensions, and make contributions along more than a single dimension (from left to right). + +
YearPaperLanguageMetric
1995Grosz et al. (1995)Englishn/a
1995Yarowsky (1995)Englishacc.
1996Berger et al. (1996)Englishacc.
1996Carletta (1996)n/an/a
2010Baroni and Lenci (2010)Englishacc.
2010Turian et al. (2010)EnglishF1
2011Taboada et al. (2011)Englishacc.
2011Ott et al. (2011)Englishacc./F1
+ +Table 2: Test-of-Time Award 2021-22 papers + +value in research, i.e., our perception of ideal research practices. This can also be seen in the papers that have received the ACL Test-of-Time Award in the last two years (Table 2). Seven in eight papers included empirical evaluations performed exclusively on English data. Six papers were exclusively concerned with optimizing for accuracy or $F_{1}$ . + +Blackbox NLP Papers. Finally, we check if more multi-dimensional papers were presented at a workshop devoted to one of the above dimensions. The rationale is that if everyone at a workshop already explores one of these dimensions, including another may be a way to have an edge over other submissions. Unfortunately, this does not seem to be the case. We manually annotated the first 10 papers in the Blackbox NLP 2021 program5 that were available as pre-prints at the time of submission. Of the 10 papers, only one included more than one dimension (Abdullah et al., 2021). This number aligns well with the overall statistics of ACL 2021 $(6.1\%)$ . All the other Blackbox NLP papers only considered interpretability for English. + +# 3 Square One Bias: Examples + +In the following, we highlight both historical and recent examples touching on different aspects of research in NLP that illustrate how the gravitational + +attraction of the SQUARE ONE has led researchers to draw false conclusions, unconsciously steer standard research practices, or make unwise choices. + +Architectural Biases. One pervasive bias in our models regards morphology. Many of our models were not designed with morphology in mind, arguably because of the poor/limited morphology of English. Traditional n-gram language models, for example, have been shown to perform much worse on languages with elaborate morphology due to data sparsity problems (Khudanpur, 2006; Bender, 2011; Gerz et al., 2018). Such models were nevertheless more commonly used than more linguistically informed alternatives such as factored language models (Bilmes and Kirchhoff, 2003) that represent words as sets of features. Word embeddings have been widely used, in part because pre-trained embeddings covered a large part of the English vocabulary. However, word embeddings are not useful for tasks that require access to morphemes, e.g., semantic tasks in morphologically rich languages (Avraham and Goldberg, 2017). + +While studies have demonstrated the ability of word embeddings to capture linguistic information in English, it remains unclear whether they capture the information needed for processing morphologically rich languages (Tsarfaty et al., 2020). A bias towards morphologically rich languages is also apparent in our tokenization algorithms. Subword tokenization performs poorly on languages with reduplication (Vania and Lopez, 2017), while byte pair encoding does not align well with morphology (Bostrom and Durrett, 2020). Consequently, languages with productive morphological systems also are disadvantaged when shared 'language-universal' tokenizers are used in current large-scale multilingual language models (Ács, 2019; Rust et al., 2021) without any further vocabulary adaptation (Wang et al., 2020; Pfeiffer et al., 2021). + +Another bias in our models relates to word order. In order for n-gram models to capture interword dependencies, words need to appear in the n-gram window. This will occur more frequently in languages with relatively fixed word order compared to languages with relatively free word order (Bender, 2011). Word embedding approaches such as skip-gram (Mikolov et al., 2013) adhere to the same window-based approach and thus have similar weaknesses for languages with relatively free word order. LSTMs are also sensitive to word order and perform worse on agreement prediction in + +Basque, which is both morphologically richer and has a relatively free word order (Ravfogel et al., 2018) compared to English (Linzen et al., 2016). They have also been shown to transfer worse to distant languages for dependency parsing compared to self-attention models (Ahmad et al., 2019). Such biases concerning word order are not only inherent in our models but also in our algorithms. A recent unsupervised parsing algorithm (Shen et al., 2018) has been shown to be biased towards right-branching structures and consequently performs better in right-branching languages like English (Dyer et al., 2019). While the recent generation of self-attention based architectures can be seen as inherently order-agnostic, recent methods focusing on making attention more efficient (Tay et al., 2020) introduce new biases into the models. Specifically, models that reduce the global attention to a local sliding window around the token (Liu et al., 2018; Child et al., 2019; Zaheer et al., 2020) may incur similar limitations as their n-gram and word embedding-based predecessors, performing worse on languages with relatively free word order. $^{6}$ + +The singular focus on maximizing a performance metric such as accuracy introduces a bias towards models that are expressive enough to fit a given distribution well. Such models are typically black-box and learn highly non-linear relations that are generally not interpretable. Interpretability is generally studied in papers focusing exclusively on this topic; a recent example is BERTology (Rogers et al., 2020). Studies proposing more interpretable methods typically build on state-of-the-art methods (Weiss et al., 2018) and much work focuses on leveraging components such as attention for interpretability, which have not been designed with that goal in mind (Serrano and Smith, 2019; Wegreiffe and Pinter, 2019). As a result, researchers eschew directions focusing on models that are intrinsically more interpretable such as generalized additive models (Hastie and Tibshirani, 2017) and their extensions (Chang et al., 2021; Agarwal et al., 2021) but which have so far not been shown to match the performance of state-of-the-art methods. + +As most datasets on which models are evaluated focus on sentences or short documents, state-of-the-art methods restrict their input size to around 512 tokens (Devlin et al., 2019) and leverage meth + +ods that are inefficient when scaling to longer documents. This has led to the emergence of a wide range of more efficient models (Tay et al., 2020), which, however, are rarely used as baseline methods in NLP. Similarly, the standard pretrain-fine-tune paradigm (Ruder et al., 2019) requires separate model copies to be stored for each task, and thus restricts work on multi-domain, multitask, multi-lingual, multi-subpopulation methods that is enabled by more efficient and less resource-intensive (Schwartz et al., 2020) fine-tuning methods (Houlsby et al., 2019; Pfeiffer et al., 2020) + +In sum, (what we typically consider as) standard baselines and state-of-the-art architectures favor languages with some characteristics over others and are optimized only for performance, which in turn propagates the SQUARE ONE BIAS: If researchers study aspects such as multilinguality, efficiency, fairness or interpretability, they are likely to do so with and for commonly used architectures (i.e., often termed 'standard architectures'), in order to reduce (too) many degrees of freedom in their empirical research. This is in many ways a sensible choice in order to maximize perceived relevance—and thereby, impact. However, as a result, multilinguality, efficiency, fairness, interpretability, and other research areas inherit the same biases, which typically slip under the radar. + +Annotation Biases. Many NLP tasks can be cast differently and formulated in multiple ways, and differences may result in different annotation styles. Sentiment, for example, can be annotated at the document, sentence or word level (Socher et al., 2013). In machine comprehension, answers are sometimes assumed to be continuous, but Zhu et al. (2020) annotate discontinuous spans. In dependency parsing, different annotation guidelines can lead to very different downstream performance (Elming et al., 2013). How we annotate for a task may interact in complex ways with dimensions such as multilinguality, efficiency, fairness, and interpretability. The Universal Dependencies project (Nivre et al., 2020) is motivated by the observation that not all dependency formalisms are easily applicable to all languages. Aligning guidelines across languages has enabled researchers to ask interesting questions, but such attempts may limit the analysis of outlier languages (Croft et al., 2017). + +Other examples of annotation guidelines interacting with the above dimensions exist: Slight nuances in how annotation guidelines are formulated can + +lead to severe model biases (Hansen and Søgaard, 2021a) and hurt model fairness. In interpretability, we can use feature attribution methods and word-level annotations to evaluate interpretability methods applied to sequence classifiers (Rei and Søgaard, 2018), but we cannot directly use feature attribution methods to obtain rationales for sequence labelers. Annotation biases can also stem from the characteristics of the annotators, including their domain experience (McAuley and Leskovec, 2013), demographics (Jorgensen and Søgaard, 2021), or educational level (Al Kuwatly et al., 2020). + +Annotation biases form an integral part of the SQUARE ONE BIAS: In NLP experiments, we commonly rely on the same pools of annotators, e.g., computer science students, professional linguists, or MTurk contributors. Sometimes these biases percolate through reuse of resources, e.g., through human or machine translation into new languages. Examples of such recycled resources include the ones introduced by Conneau et al. (2018) and Kassner et al. (2021), among others. Even when such translation-based resources resonate with syntax and semantics of the target language, and are fluent and natural, they still suffer from translation artefacts: they are often target-language surface realizations of source-language-based conceptual thinking (Majewska et al., 2022). As a consequence, evaluations of cross-lingual transfer models on such data typically overestimate their performance as properties such as word order and even the choice of lexical units are inherently biased by the source language (Vanmassenhove et al., 2021). Put simply, the choice of the data creation protocol, e.g., translation-based versus data collection directly in the target language (Clark et al., 2020) can yield profound differences in model performance for some groups, or may have serious impact on the interpretability or computational efficiency (e.g., sample efficiency) of our models. + +Selection Biases. For many years, the English Penn Treebank (Marcus et al., 1994) was an integral part of the SQUARE ONE of NLP. This corpus consists entirely of newswire, i.e., articles and editorials from the Wall Street Journal, and arguably amplified the (existing) bias toward news articles. Since news articles tend to reflect a particular set of linguistic conventions, have a certain length, and are written by certain demographics, the bias toward news articles had an impact on the linguistic phenomena studied in NLP (Judge et al., 2006), led + +to under-representation of challenges with handling longer documents (Beltagy et al., 2021), and had impact on early papers in fairness (Hovy and Søgaard, 2015). Note how such a bias may interact in non-linear ways with efficiency, i.e., efficient methods for shorter documents need not be efficient for longer ones, or fairness, i.e., what mitigates gender biases in news articles need not mitigate gender biases in product reviews. + +Protocol Biases. In the prototypical NLP experiment, the dataset is in the English language. As a consequence, it is also standard protocol in multilingual NLP to use English as a source language in zero-shot cross-lingual transfer (Hu et al., 2020). In practice, there are generally better source languages than English (Ponti et al., 2018; Lin et al., 2019; Turc et al., 2021), and results are heavily biased by the common choice of English. For instance, effectiveness and efficiency of few-shot learning can be impacted by the choice of the source language (Pfeiffer et al., 2021; Zhao et al., 2021). English also dominates language pairs in machine translation, leading to lower performance for non-English translation directions (Fan et al., 2020), which are particularly important in multilingual societies. Again, such biases may interact in non-trivial ways with dimensions explored in NLP research: It is not inconceivable that there is an algorithm $A$ that is more fair, interpretable or efficient than algorithm $B$ on, say, English-to-Czech transfer or translation, but not on German-to-Czech or French-to-Czech. + +Organizational Biases. The above architectural, annotation, selection and protocol biases follow from the SQUARE ONE BIAS, but they also conserve the SQUARE ONE. If our go-to architectures, resources, and experimental setups are tailored to some languages over others, some objectives over others, and some research paradigms over others, it is considerably more work to explore new sets of languages, new objectives, or new protocols. The organizational biases we discuss below may also reinforce the SQUARE ONE BIAS. + +The organization of our conferences and reviewing processes perpetuates certain biases. In particular, both during reviewing and for later presentation at conferences, papers are organized in areas. Upon submission, a paper is assigned to a single area. Reviewers are recruited for their expertise in a specific area, which they are associated with. Such a reviewing system incentivizes + +papers that make contributions to the chosen area, in order to appeal to the reviewers of this area and implicitly penalizes papers that make contributions along multiple dimensions, as reviewers unfamiliar with the related areas may not appreciate their inter-disciplinary or inter-areal magnitude or value. Even new initiatives that seek to improve reviewing such as ARR7 adhere to this area structure8 and thus further the SQUARE ONE BIAS. A reviewing system that allows papers to be associated with multiple dimensions of research and that assigns reviewers with complementary expertise—similar to TACL9—would ameliorate this situation. Once a paper is accepted, presentations at conferences are organized by areas, limiting audiences in most cases to members of said area and thereby reducing the cross-pollination of ideas.10 + +Unexplored Areas of the Research Manifold. The discussed biases, which seem to originate from the SQUARE ONE BIAS, leave areas of the research manifold unexplored. Character-based language models are often reported to perform well for morphologically rich languages or on non-canonical text (Ma et al., 2020), but little is known about their fairness properties, and attribution-based interpretability methods have not been developed for such models. Annotation biases that stem from annotator demographics have been studied for English POS tagging (Hovy and Søgaard, 2015) or English summarization (Jorgensen and Søgaard, 2021), for example, but there has been very little research on such biases for other languages. While linguistic differences among genders is shared among some languages, genders differ in very different ways between other languages, e.g., Spanish and Swedish (Johannsen et al., 2015). We discuss important unexplored areas of the research manifold in §5, but first we briefly survey existing, multi-dimensional work, i.e., the counter-examples + +7aclrollingreview.org/ + +$^{8}$ www.2022.aclweb.org/callpapers + +$9$ transacl.org/index.php/tacl + +Another previously pervasive organizational bias, which is now fortunately being institutionally mitigated within the *ACL community through dedicated mentoring programs and improved reviewing guidelines, concerned penalizing research papers for their non-native writing style, where it was frequently suggested to the authors whose native language is not English to 'have their paper proofread by a native speaker'. As one hidden consequence, this attitude might have set a higher bar for the native speakers of minor and endangered languages working on such languages to put their research problems in the spotlight, that way also implicitly hindering more work of the entire community on these languages. + +to our claim that NLP research is biased to one-dimensional extensions of the square one. + +# 4 Counter-Examples + +Most of the exceptions to our thesis about the 'one-dimensionality' of NLP research, in our classification of ACL 2021 Oral Papers, came from studies of efficiency in a multilingual context. Another example of this is Ahia et al. (2021), who show that for low-resource languages, weight pruning hurts performance on tail phenomena, but improves robustness to out-of-distribution shifts—this is not observed in the SQUARE ONE (high-resource) regime. There are also studies of fairness in a multilingual context. Huang et al. (2020), for example, show significant differences in social bias for multilingual hate speech systems across different languages. Zhao et al. (2020) study gender bias in multilingual word embeddings and cross-lingual transfer. González et al. (2020) also study gender bias, but by relying on reflexive pronominal constructions that do not exist in the English language; this is a good example of research that would not have been possible taking SQUARE ONE as our point of departure. Dayanik and Padó (2021) study adversarial debiasing in the context of a multilingual corpus and show some mitigation methods are more effective for some languages rather than others. Nozza (2021) studies multilingual toxicity classification and finds that models misinterpret non-hateful language-specific taboo interjections as hate speech in some languages. There has been much less work on other combinations of these dimensions, e.g., fairness and efficiency. Hansen and Søgaard (2021b) show that weight pruning has disparate effects on performance across demographics and that the min-max difference in group disparities is negatively correlated with model size. Renduch-intala et al. (2021) observe that techniques to make inference more efficient, e.g., greedy search, quantization, or shallow decoder models, have a small impact on performance, but dramatically amplify gender bias. In a rare study of fairness and interpretability, Vig et al. (2020) propose a methodology to interpret which parts of a model are causally implicated in its behavior. They apply this methodology to analyze gender bias in pre-trained Transformers, finding that gender bias effects are sparse and concentrated in small parts of the network. + +# 5 Blind Spots + +We identified several under-explored areas on the research manifold. The common theme is a lack of studies of how dimensions such as multilinguality, fairness, efficiency, and interpretability interact. We now summarize some open problems that we believe are particularly important to address: (i) While recent work has begun to study the trade-off between efficiency and fairness, this interaction remains largely unexplored, especially outside of the empirical risk minimization regime; (ii) fairness and interpretability interact in potentially many ways, i.e., interpretability techniques may affect the fairness of the underlying models (Agarwal, 2021), but rationales may also, for example, be biased toward certain demographics in how they are presented (Feng and Boyd-Graber, 2018; González et al., 2021); (iii) finally, multilinguality and interpretability seem heavily underexplored. While there exists resources for English for evaluating interpretability methods against gold-standard human annotations, there are, to the best of our knowledge, no such resources for other languages.[11] + +# 6 Contributing Factors + +We finally highlight possible factors that may contribute to the SQUARE ONE BIAS. + +Biases in NLP Education. We hypothesize that early exposure to predominantly English-centric experiment settings and tasks using a single performance metric may potentially propagate further to more advanced NLP research. To investigate to what extent this may be the case, we created a short questionnaire, which we sent to a geographically diverse set of teachers, including first authors from the last Teaching NLP workshop (Jurgens et al., 2021), asking about the first experiment that they presented in their NLP 101 course. We received 71 responses in total. Our first question was: The last time you taught an introductory NLP course, what was the first task you introduced the students to, or that they had to implement a model for? The relative majority of respondents $(31.9\%)$ said sentiment analysis, while $10.1\%$ indicated topic classification. $^{12}$ More importantly, we also asked them about the language of the data used in the + +
YearBookLanguageTask
1999Manning and Schütze (1999)English-FrenchAlignment
2009Jurafsky and Martin (2009)EnglishLM
2009Bird et al. (2009)EnglishName cl.
2013Søgaard (2013)EnglishDoc.cl.
2019Eisenstein (2019)EnglishDoc.cl.
+ +Table 3: First experiments in NLP textbooks. The objective across all books is optimizing for performance (AER, perplexity, or accuracy), rather than fairness, interpretability or efficiency. + +experiment, and what metric they optimized for. More than three quarters of respondents reported that they used English language training and evaluation data and more than three quarters of the respondents asked the students to optimize for accuracy or $F1$ . The choice of using English language datasets is particularly interesting in contrast to the native languages of the teachers and their students: In around two thirds of the classes, most students shared an L1 language that was not English; and less than a quarter of the teachers were L1 English speakers themselves. We extend this analysis to prototypical NLP experiments in undergraduate and graduate research based on five exemplary NLP textbooks, spanning 20 years (see Table 3). We observe that they, like the teachers in our survey, take the same point of departure: an English-language experiment where we use supervised learning techniques to optimize for a standard performance metric, e.g., perplexity or error. We note an important difference, however: While the first four books largely ignore issues relating to fairness, interpretability, and efficiency, the most recent NLP textbook in Table 3 (Eisenstein, 2019) discusses efficiency (briefly) and fairness (more thoroughly). Overall, we believe that teachers and educational materials should engage as early as possible with the multiple dimensions of NLP in order to sensitize researchers regarding these topics at the start of their careers. + +Commercial Factors. For commercially focused NLP, there is an incentive to focus on settings with many users, such as major languages with many speakers. Similarly, as long as users do not mind using highly accurate black-box systems, researchers working on real-world applications can often afford to ignore dimensions such as interpretability and fairness. + +Momentum of the Status Quo. The SQUARE ONE is well supported by existing infrastructure, resources, baselines, and experimental results. Any + +work that seeks to depart from the standard setting has to work harder, not only to build systems and resources in order to establish comparability with existing work but also needs to argue convincingly the importance of such work. We provide practical recommendations in the next section on how we can facilitate such research as a community. + +# 7 Discussion + +Is SQUARE ONE BIAS not the Flipside of Scientific Protocol? One potential argument for a community-wide SQUARE ONE BIAS is that when studying the impact of some technique $t$ , say a novel regularization term, we want to compare some system with and without $t$ , i.e., control for all other factors. To maximize impact and ease workload, it makes sense at first sight to stick to a system and experimental protocol that is familiar or well-studied. Always returning to the SQUARE ONE is a way to control for all other factors and relating new findings to known territory. The reason why this is only seemingly a good idea, however, is that the factors we study in NLP research, may be nonlinearly related. The fact that $t$ makes for a positive net contribution under one set of circumstances, does not imply that it would do so under different circumstances. This is illustrated most clearly by the research surveyed in §3. Ideally, we thus want to study the impact of $t$ under as many circumstances as possible, but in the absence of resources to do so, it is a better (collective) search strategy to apply $t$ to a random set of circumstances (within the space of relevant circumstances, of course). + +Comment on Meta-Research. This paper can be seen in the line of other meta-research (Davis, 1971; Lakatos, 1976; Weber, 2006; Bloom et al., 2020) that seeks to analyze research practices and whether a scientific field is heading in the right direction. Within the NLP community, much of such recent discussion has focused on the nature of leaderboards and the practice of benchmarking (Ethayarajh and Jurafsky, 2020; Ma et al., 2021). + +Should Each Paper Aim to Cover All Dimensions? We believe that a researcher should aspire to cover as many dimensions as possible with their research. Considering the dimensions of research encourages us to think more holistically about our research and its final impact. It may also accelerate progress as follow-up work will already be able to build on the insights of multi-dimensional analyses of new methods. It will also promote the + +cross-pollination of ideas, which will no longer be confined to their own sub-areas. While such multidimensional research may be cumbersome at the moment, we believe with the proper incentives and support, we can make it much more accessible. + +Practical Recommendations. What can we do to incentivize and facilitate multi-dimensional research? i) Currently, most NLP models are evaluated by one or two performance metrics, but we believe dimensions such as fairness, efficiency, and interpretability need to become integral criteria for model evaluation, in line with recent proposals of more user-centric leaderboards (Ethayarajh and Jurafsky, 2020; Ma et al., 2021). This requires new tools, e.g., to evaluate environmental impact (Henderson et al., 2020), as well as new benchmarks, e.g., to evaluate fairness (Koh et al., 2021) or efficiency (Liu et al., 2021b). ii) We believe separate conference tracks (areas) lead to unfortunate silo effects and inhibit multi-dimensional research. Rather, we imagine conference submissions could provide a checklist with dimensions along which they make contributions, similar to reproducibility checklist. Reviewers can be assigned based on their expertise corresponding to different dimensions. iii) Finally, we recommend awareness of research prototypes and encourage reviewers and chairs to prioritize research that departs from prototypes in multiple dimensions, in order to explore new areas of the research manifold. + +# 8 Conclusion + +We identified the prototypical NLP experiment through annotation experiments and surveys. We highlighted the associated SQUARE ONE BIAS, which encourages research to go beyond the prototype in a single dimension. We discussed the problems resulting from this bias, by studying the area statistics of a recent NLP conference as well as by discussing historic and recent examples. We finally pointed to under-explored research directions and made practical recommendations to inspire more multi-dimensional research in NLP. + +# Acknowledgments + +Ivan Vulić is funded by the ERC PoC Grant MultiConvAI (no. 957356) and a research donation from Huawei. Anders Søgaard is sponsored by the Innovation Fund Denmark and a Google Focused Research Award. We thank Jacob Eisenstein for + +valuable feedback on a draft of this paper and the suggestion of the term 'square one'. + +# References + +Badr Abdullah, Iuliia Zaitova, Tania Avgustinova, Bernd Möbius, and Dietrich Klakow. 2021. How familiar does that sound? Cross-lingual representational similarity analysis of acoustic word embeddings. In Proceedings of the Fourth BlackboxNLP Workshop on Analyzing and Interpreting Neural Networks for NLP, pages 407-419. +Judit Ács. 2019. Exploring BERT's Vocabulary. Blog Post. +Rishabh Agarwal, Levi Melnick, Nicholas Frosst, Xuezhou Zhang, Ben Lengerich, Rich Caruana, and Geoffrey Hinton. 2021. Neural additive models: Interpretable machine learning with neural nets. In Proceedings of NeurIPS 2021. +Sushant Agarwal. 2021. Trade-offs between fairness and interpretability in machine learning. In Proceedings of the IJCAI 2021 Workshop on AI for Social Good. +Orevaoghene Ahia, Julia Kreutzer, and Sara Hooker. 2021. The low-resource double bind: An empirical study of pruning for low-resource machine translation. In Findings of the Association for Computational Linguistics: EMNLP 2021, pages 3316-3333. +Wasi Ahmad, Zhisong Zhang, Xuezhe Ma, Eduard Hovy, Kai-Wei Chang, and Nanyun Peng. 2019. On difficulties of cross-lingual transfer with order differences: A case study on dependency parsing. In Proceedings of NAACL-HLT 2019, pages 2440-2452. +Hala Al Kuwatly, Maximilian Wich, and Georg Groh. 2020. Identifying and measuring annotator bias based on annotators' demographic characteristics. In Proceedings of the Fourth Workshop on Online Abuse and Harms, pages 184-190. +Oded Avraham and Yoav Goldberg. 2017. The interplay of semantics and morphology in word embeddings. In Proceedings of EACL 2017, pages 422-426. +Marco Baroni and Alessandro Lenci. 2010. Distributional memory: A general framework for corpus-based semantics. Computational Linguistics, 36(4):673-721. +Iz Beltagy, Arman Cohan, Hannaneh Hajishirzi, Sewon Min, and Matthew E. Peters. 2021. Beyond paragraphs: NLP for long sequences. In Proceedings of NAACL-HLT 2021: Tutorials, pages 20-24. +Emily M. Bender. 2011. On achieving and evaluating language-independence in NLP. Linguistic Issues in Language Technology, 6(3):1-26. + +Adam L. Berger, Stephen A. Della Pietra, and Vincent J. Della Pietra. 1996. A maximum entropy approach to natural language processing. Computational Linguistics, 22(1):39-71. +Jeff Bilmes and Katrin Kirchhoff. 2003. Factored language models and generalized parallel backoff. In Companion Volume of the Proceedings of HLT-NAACL 2003-Short Papers, pages 4-6. +Steven Bird, Ewan Klein, and Edward Loper. 2009. Natural Language Processing with Python: Analyzing Text with the Natural Language Toolkit. O'Reilly, Beijing. +Abeba Birhane, Pratyusha Kalluri, Dallas Card, William Agnew, Ravit Dotan, and Michelle Bao. 2021. The values encoded in machine learning research. CoRR, abs/2106.15590. +Su Lin Blodgett, Solon Barocas, Hal Daumé III, and Hanna M. Wallach. 2020. Language (technology) is power: A critical survey of "bias" in NLP. CoRR, abs/2005.14050. +Nicholas Bloom, Charles I Jones, John Van Reenen, and Michael Webb. 2020. Are ideas getting harder to find? American Economic Review, 110(4):1104-44. +Kaj Bostrom and Greg Durrett. 2020. Byte pair encoding is suboptimal for language model pretraining. In *Findings of the Association for Computational Linguistics: EMNLP* 2020, pages 4617-4624. +Jean Carletta. 1996. Assessing agreement on classification tasks: The kappa statistic. Computational Linguistics, 22(2):249-254. +Chun-Hao Chang, Sarah Tan, Ben Lengerich, Anna Goldenberg, and Rich Caruana. 2021. How interpretable and trustworthy are GAMs? In Proceedings of KDD 2021, pages 95-105. +Rewon Child, Scott Gray, Alec Radford, and Ilya Sutskever. 2019. Generating long sequences with sparse Transformers. CoRR, abs/1904.10509. +Jonathan H. Clark, Eunsol Choi, Michael Collins, Dan Garrette, Tom Kwiatkowski, Vitaly Nikolaev, and Jennimaria Palomaki. 2020. TyDi QA: A benchmark for information-seeking question answering in typologically diverse languages. Transactions of the Association for Computational Linguistics, 8:454-470. +Alexis Conneau, Rudy Rinott, Guillaume Lample, Adina Williams, Samuel Bowman, Holger Schwenk, and Veselin Stoyanov. 2018. XNLI: Evaluating cross-lingual sentence representations. In Proceedings of EMNLP 2018, pages 2475–2485. +William Croft, Dawn Nordquist, Katherine Looney, and Michael Regan. 2017. Linguistic typology meets universal dependencies. In Proceedings of the 15th International Workshop on Treebanks and Linguistic Theories (TLT15), pages 63-75. + +Edith A. Das-Smaal. 1990. Biases in categorization. volume 68 of Advances in Psychology, pages 349-386. North-Holland. +Murray S Davis. 1971. That's interesting! towards a phenomenology of sociology and a sociology of phenomenology. Philosophy of the social sciences, 1(2):309-344. +Erenay Dayanik and Sebastian Padó. 2021. Disentangling document topic and author gender in multiple languages: Lessons for adversarial debiasing. In Proceedings of the Eleventh Workshop on Computational Approaches to Subjectivity, Sentiment and Social Media Analysis, pages 50-61. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. In Proceedings of NAACL-HLT 2019. +Chris Dyer, Gábor Melis, and Phil Blunsom. 2019. A critical analysis of biased parsers in unsupervised parsing. CoRR, abs/1909.09428. +Jacob Eisenstein. 2019. Introduction to Natural Language Processing. Adaptive Computation and Machine Learning series. MIT Press. +Jakob Elming, Anders Johannsen, Sigrid Klerke, Emanuele Lapponi, Hector Martinez Alonso, and Anders Søgaard. 2013. Down-stream effects of tree-to-dependency conversions. In Proceedings of NAACL-HLT 2013, pages 617-626. +Kawin Ethayarajh and Dan Jurafsky. 2020. Utility is in the eye of the user: A critique of NLP leaderboards. In Proceedings of EMNLP 2020, pages 4846-4853. +Angela Fan, Shruti Bhosale, Holger Schwenk, Zhiyi Ma, Ahmed El-Kishky, Siddharth Goyal, Mandep Baines, Onur Celebi, Guillaume Wenzek, Vishrav Chaudhary, Naman Goyal, Tom Birch, Vitaliy Liptchinsky, Sergey Edunov, Edouard Grave, Michael Auli, and Armand Joulin. 2020. Beyond English-Centric Multilingual Machine Translation. arXiv preprint arXiv:2010.11125. +Shi Feng and Jordan L. Boyd-Graber. 2018. What can AI do for me: Evaluating machine learning interpretations in cooperative play. CoRR, abs/1810.09648. +Daniela Gerz, Ivan Vulić, Edoardo Maria Ponti, Roi Reichart, and Anna Korhonen. 2018. On the relation between linguistic typology and (limitations of) multilingual language modeling. In Proceedings of EMNLP 2018, pages 316-327. +Ana Valeria González, Maria Barrett, Rasmus Hvingelby, Kellie Webster, and Anders Søgaard. 2020. Type B reflexivization as an unambiguous testbed for multilingual multi-task gender bias. In Proceedings of EMNLP 2020, pages 2637-2648. + +Ana Valeria González, Anna Rogers, and Anders Søgaard. 2021. On the interaction of belief bias and explanations. In *Findings of the Association for Computational Linguistics: ACL-IJCNLP* 2021, pages 2930-2942. +Barbara J. Grosz, Aravind K. Joshi, and Scott Weinstein. 1995. Centering: A framework for modeling the local coherence of discourse. Computational Linguistics, 21(2):203-225. +Victor Petrén Bach Hansen and Anders Søgaard. 2021a. Guideline bias in Wizard-of-Oz dialogues. In Proceedings of the 1st Workshop on Benchmarking: Past, Present and Future, pages 8-14. +Victor Petrén Bach Hansen and Anders Søgaard. 2021b. Is the lottery fair? evaluating winning tickets across demographics. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, pages 3214-3224. +Trevor J. Hastie and Robert J. Tibshirani. 2017. Generalized additive models. Routledge. +Peter Henderson, Jieru Hu, Joshua Romoff, Emma Brunskill, Dan Jurafsky, and Joelle Pineau. 2020. Towards the systematic reporting of the energy and carbon footprints of machine learning. Journal of Machine Learning Research, 21(248):1-43. +Neil Houlsby, Andrei Giurgiu, Stanislaw Jastrzebski, Bruna Morrone, Quentin De Laroussilhe, Andrea Gesmundo, Mona Attariyan, and Sylvain Gelly. 2019. Parameter-efficient transfer learning for NLP. In Proceedings of ICML 2019, pages 2790-2799. +Dirk Hovy and Anders Søgaard. 2015. Tagging performance correlates with author age. In Proceedings of ACL-IJCNLP 2015, pages 483-488. +Junjie Hu, Sebastian Ruder, Aditya Siddhant, Graham Neubig, Orhan First, and Melvin Johnson. 2020. XTREME: A Massively Multilingual Multi-task Benchmark for Evaluating Cross-lingual Generalization. In Proceedings of ICML 2020. +Xiaolei Huang, Linzi Xing, Franck Dernoncourt, and Michael J. Paul. 2020. Multilingual Twitter corpus and baselines for evaluating demographic bias in hate speech recognition. In Proceedings of LREC 2020, pages 1440-1448. +Anders Johannsen, Dirk Hovy, and Anders Søgaard. 2015. Cross-lingual syntactic variation over age and gender. In Proceedings of CoNLL 2015, pages 103-112. +Anna Jørgensen and Anders Søgaard. 2021. Evaluation of summarization systems across gender, age, and race. In Proceedings of the Third Workshop on New Frontiers in Summarization, pages 51-56. +Pratik Joshi, Sebastin Santy, Amar Budhiraja, Kalika Bali, and Monjit Choudhury. 2020. The State and Fate of Linguistic Diversity and Inclusion in the NLP World. In Proceedings of ACL 2020. + +John Judge, Aoife Cahill, and Josef van Genabith. 2006. QuestionBank: Creating a corpus of parse-annotated questions. In Proceedings of the 21st International Conference on Computational Linguistics and 44th Annual Meeting of the Association for Computational Linguistics, pages 497-504. +Dan Jurafsky and James H. Martin. 2009. Speech and language processing: an introduction to natural language processing, computational linguistics, and speech recognition. Pearson Prentice Hall, Upper Saddle River, N.J. +David Jurgens, Varada Kolhatkar, Lucy Li, Margot Mieskes, and Ted Pedersen, editors. 2021. Proceedings of the Fifth Workshop on Teaching NLP. +Nora Kassner, Philipp Dufter, and Hinrich Schütze. 2021. Multilingual LAMA: Investigating knowledge in multilingual pretrained language models. In Proceedings of EACL 2021, pages 3250-3258. +Sanjeev P Khudanpur. 2006. Multilingual language modeling. Multilingual Speech Processing, page 169. +Pang Wei Koh, Shiori Sagawa, Henrik Marklund, Sang Michael Xie, Marvin Zhang, Akshay Balsubramani, Weihua Hu, Michihiro Yasunaga, Richard Lanas Phillips, Irena Gao, Tony Lee, Etienne David, Ian Stavness, Wei Guo, Berton A. Earnshaw, Imran S. Haque, Sara Beery, Jure Leskovec, Anshul Kundaje, Emma Pierson, Sergey Levine, Chelsea Finn, and Percy Liang. 2021. WILDS: A benchmark of in-the-wild distribution shifts. In Proceedings of ICML 2021. +Imre Lakatos. 1976. Falsification and the methodology of scientific research programmes. In Can theories be refuted?, pages 205-259. Springer. +Yu-Hsiang Lin, Chian-Yu Chen, Jean Lee, Zirui Li, Yuyan Zhang, Mengzhou Xia, Shruti Rijhwani, Junxian He, Zhisong Zhang, Xuezhe Ma, Antonios Anastasopoulos, Patrick Littell, and Graham Neubig. 2019. Choosing Transfer Languages for Cross-Lingual Learning. In Proceedings of ACL 2019. +Tal Linzen, Emmanuel Dupoux, and Yoav Goldberg. 2016. Assessing the ability of LSTMs to learn syntax-sensitive dependencies. Transactions of the Association for Computational Linguistics, 4:521-535. +Fangyu Liu, Emanuele Bugliarello, Edoardo Maria Ponti, Siva Reddy, Nigel Collier, and Desmond Eliott. 2021a. Visually Grounded Reasoning across Languages and Cultures. In Proceedings of EMNLP 2021. +Peter J. Liu, Mohammad Saleh, Etienne Pot, Ben Goodrich, Ryan Sepassi, Lukasz Kaiser, and Noam Shazeer. 2018. Generating Wikipedia by Summarizing Long Sequences. In Proceedings of ICLR 2018. + +Xiangyang Liu, Tianxiang Sun, Junliang He, Lingling Wu, Xinyu Zhang, Hao Jiang, Zhao Cao, Xuanjing Huang, and Xipeng Qiu. 2021b. Towards efficient nlp: A standard evaluation and a strong baseline. arXiv preprint arXiv:2110.07038. +Wentao Ma, Yiming Cui, Chenglei Si, Ting Liu, Shijin Wang, and Guoping Hu. 2020. CharBERT: Character-aware pre-trained language model. In Proceedings of the 28th International Conference on Computational Linguistics, pages 39-50, Barcelona, Spain (Online). International Committee on Computational Linguistics. +Zhiyi Ma, Kawin Ethayarajh, Tristan Thrush, Somya Jain, Ledell Wu, Robin Jia, Christopher Potts, Adina Williams, and Douwe Kiela. 2021. Dynaboard: An evaluation-as-a-service platform for holistic next-generation benchmarking. CoRR, abs/2106.06052. +Olga Majewska, Evgeniia Razumovskaia, Edoardo Maria Ponti, Ivan Vulic, and Anna Korhonen. 2022. Cross-lingual dialogue dataset creation via outline-based generation. CoRR, abs/2201.13405. +Christopher D. Manning and Hinrich Schütze. 1999. Foundations of Statistical Natural Language Processing. The MIT Press, Cambridge, Massachusetts. +Mitchell Marcus, Grace Kim, Mary Ann Marcinkiewicz, Robert MacIntyre, Ann Bies, Mark Ferguson, Karen Katz, and Britta Schasberger. 1994. The Penn Treebank: Annotating predicate argument structure. In Human Language Technology: Proceedings of a Workshop. +Julian John McAuley and Jure Leskovec. 2013. From amateurs to connoisseurs: Modeling the evolution of user expertise through online reviews. In Proceedings of WWW 2013, page 897-908. +Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. 2013. Distributed Representations of Words and Phrases and their Compositionality. In Proceedings of NeurIPS 2013. +Joakim Nivre, Marie-Catherine de Marneffe, Filip Ginter, Jan Hajic, Christopher D. Manning, Sampo Pyysalo, Sebastian Schuster, Francis Tyers, and Daniel Zeman. 2020. Universal Dependencies v2: An evergrowing multilingual treebank collection. In Proceedings of LREC 2020, pages 4034-4043. +Debora Nozza. 2021. Exposing the Limits of Zero-shot Cross-lingual Hate Speech Detection. In Proceedings of ACL 2021, pages 907-914. +Myle Ott, Yejin Choi, Claire Cardie, and Jeffrey T. Hancock. 2011. Finding deceptive opinion spam by any stretch of the imagination. In Proceedings of ACL 2011, pages 309-319. + +Jonas Pfeiffer, Ivan Vulic, Iryna Gurevych, and Sebastian Ruder. 2020. MAD-X: An Adapter-Based Framework for Multi-Task Cross-Linguual Transfer. In Proceedings of EMNLP 2020, pages 7654-7673. +Jonas Pfeiffer, Ivan Vulić, Iryna Gurevych, and Sebastian Ruder. 2021. UNKs everywhere: Adapting multilingual language models to new scripts. In Proceedings of EMNLP 2021. +Edoardo Maria Ponti, Roi Reichart, Anna Korhonen, and Ivan Vulic. 2018. Isomorphic transfer of syntactic structures in cross-lingual NLP. In Proceedings of ACL 2018, pages 1531-1542. +Shauli Ravfogel, Yoav Goldberg, and Francis Tyers. 2018. Can LSTM learn to capture agreement? the case of Basque. In Proceedings of the 2018 EMNLP Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pages 98-107. +Marek Rei and Anders Søgaard. 2018. Zero-shot sequence labeling: Transferring knowledge from sentences to tokens. In Proceedings of NAACL-HLT 2018, pages 293-302. +Adithya Renduchintala, Denise Diaz, Kenneth Heafield, Xian Li, and Mona Diab. 2021. Gender bias amplification during speed-quality optimization in neural machine translation. In Proceedings of ACL-IJCNLP 2021, pages 99-109. +Anna Rogers, Olga Kovaleva, and Anna Rumshisky. 2020. A primer in BERTology: What we know about how BERT works. Transactions of the Association for Computational Linguistics, 8:842-866. +Sebastian Ruder, Matthew E Peters, Swabha Swayamdipta, and Thomas Wolf. 2019. Transfer learning in natural language processing. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Tutorials, pages 15-18. +Phillip Rust, Jonas Pfeiffer, Ivan Vulic, Sebastian Ruder, and Iryna Gurevych. 2021. How Good is Your Tokenizer? On the Monolingual Performance of Multilingual Language Models. In Proceedings of ACL-IJCNLP 2021, pages 3118-3135. +Roy Schwartz, Jesse Dodge, Noah A. Smith, and Oren Etzioni. 2020. *Green AI: Communications of the ACM*, 63(12):54-63. +Sofia Serrano and Noah A. Smith. 2019. Is attention interpretable? In Proceedings of ACL 2019, pages 2931-2951. +Yikang Shen, Zhouhan Lin, Chin-wei Huang, and Aaron Courville. 2018. Neural Language Modeling by Jointly Learning Syntax and Lexicon. In Proceedings of ICLR 2018. +Tracy Sherman. 1985. Categorization skills in infants. Child Development, 56(6):1561-73. + +Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D. Manning, Andrew Ng, and Christopher Potts. 2013. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of EMNLP 2013, pages 1631-1642. +Anders Søgaard. 2013. Semi-supervised learning and domain adaptation for NLP. Synthesis Lectures on Human Language Technologies. Morgan & Claypool Publishers, United States. +Maite Taboada, Julian Brooke, Milan Tofiloski, Kimberly Voll, and Manfred Stede. 2011. Lexicon-based methods for sentiment analysis. Computational Linguistics, 37(2):267-307. +Yi Tay, Mostafa Dehghani, Dara Bahri, and Donald Metzler. 2020. Efficient transformers: A survey. CoRR, abs/2009.06732. +Reut Tsarfaty, Dan Bareket, Stav Klein, and Amit Seker. 2020. From SPMRL to NMRL: What did we learn (and unlearn) in a decade of parsing morphologically-rich languages (MRLs)? In Proceedings of ACL 2020, pages 7396-7408. +Iulia Turc, Kenton Lee, Jacob Eisenstein, Ming-Wei Chang, and Kristina Toutanova. 2021. Revisiting the Primacy of English in Zero-shot Cross-lingual Transfer. arXiv preprint arXiv:2106.16171. +Joseph Turian, Lev-Arie Ratinov, and Yoshua Bengio. 2010. Word representations: A simple and general method for semi-supervised learning. In Proceedings of ACL 2010, pages 384-394. +Clara Vania and Adam Lopez. 2017. From characters to words to in between: Do we capture morphology? In Proceedings of ACL 2017, pages 2016-2027. +Eva Vanmassenhove, Dimitar Shterionov, and Matthew Gwilliam. 2021. Machine translatione: Effects of algorithmic bias on linguistic complexity in machine translation. In Proceedings of the EACL 2021, pages 2203-2213. +Jesse Vig, Sebastian Gehrmann, Yonatan Belinkov, Sharon Qian, Daniel Nevo, Yaron Singer, and Stuart M Shieber. 2020. Investigating gender bias in language models using causal mediation analysis. In Proceedings of NeurIPS 2020. +David Vilares, Haiyun Peng, Ranjan Satapathy, and Erik Cambria. 2018. BabelSenticNet: A commonsense reasoning framework for multilingual sentiment analysis. In 2018 IEEE Symposium Series on Computational Intelligence (SSCI), pages 1292-1298. +Svitlana Volkova, Theresa Wilson, and David Yarowsky. 2013. Exploring demographic language variations to improve multilingual sentiment analysis in social media. In Proceedings of EMNLP 2013, pages 1815-1827. + +Zihan Wang, Karthikeyan K, Stephen Mayhew, and Dan Roth. 2020. Extending multilingual BERT to low-resource languages. In Findings of EMNLP 2020, pages 2649-2656. +Ron Weber. 2006. Reach and grasp in the debate over the is core: An empty hand? Journal of the Association for Information Systems, 7(10):28. +Gail Weiss, Yoav Goldberg, and Eran Yahav. 2018. Extracting Automata from Recurrent Neural Networks Using Queries and Counterexamples. In Proceedings of ICML 2018. +Sarah Wiegrefe and Yuval Pinter. 2019. Attention is not not explanation. In Proceedings of EMNLP-IJCNLP 2019, pages 11-20. +Jingjing Xu, Hao Zhou, Chun Gan, Zaixiang Zheng, and Lei Li. 2021. Vocabulary learning via optimal transport for neural machine translation. In Proceedings of ACL-IJCNLP 2021, pages 7361-7373. +Yi Yang and Jacob Eisenstein. 2017. Overcoming language variation in sentiment analysis with social attention. Transactions of the Association for Computational Linguistics, 5:295-307. +David Yarowsky. 1995. Unsupervised word sense disambiguation rivaling supervised methods. In Proceedings of ACL 1995, pages 189-196. +Da Yin, Liunian Harold Li, Ziniu Hu, Nanyun Peng, and Kai-Wei Chang. 2021. Broaden the vision: Geodiverse visual commonsense reasoning. In Proceedings of EMNLP 2021, pages 2115-2129. +Manzil Zaheer, Guru Guruganesh, Kumar Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Ontanon, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, et al. 2020. Big bird: Transformers for longer sequences. In Proceedings of NeurIPS 2020. +Jieyu Zhao, Subhabrata Mukherjee, Saghar Hosseini, Kai-Wei Chang, and Ahmed Hassan Awadallah. 2020. Gender bias in multilingual embeddings and cross-lingual transfer. In Proceedings of ACL 2020, pages 2896-2907. +Mengjie Zhao, Yi Zhu, Ehsan Shareghi, Ivan Vulic, Roi Reichart, Anna Korhonen, and Hinrich Schütze. 2021. A closer look at few-shot crosslingual transfer: The choice of shots matters. In Proceedings of ACL-IJNCLP 2021, pages 5751-5767. +Ming Zhu, Aman Ahuja, Da-Cheng Juan, Wei Wei, and Chandan K. Reddy. 2020. Question answering with long multiple-span answers. In *Findings of the Association for Computational Linguistics: EMNLP* 2020, pages 3840-3849, Online. Association for Computational Linguistics. + +# A Appendix + +# A.1 Annotation guidelines + +For multilinguality, we consider papers that evaluate on 3 languages, or 4 languages if they focus on MT (as the standard MT experiment includes two languages). For fairness and bias, we consider papers that improve fairness in a specific setting or analyze the bias of a method, e.g. regarding gender. For efficiency, we consider papers that analyze memory, speed, or computational complexity. For interpretability, we consider papers that interpret or explain a model's predictions. + +In every case, we consider papers that make a practical contribution to a dimension and provide quantifiable results along the dimension. For multilinguality, fairness and bias, and efficiency, a practical contribution constitutes the use of an evaluation metric that is appropriate for the specific setting. For interpretability, this may include a user study, an analysis of correlation results, or a qualitative analysis of interpretable features. + +# A.2 Analysis of remaining areas at ACL 2021 + +We provide statistics for the remaining areas at ACL 2021 in Table 4. + +# A.3 Analysis of Efficiency area at EMNLP 2021 + +We annotated the 20 papers presented orally at EMNLP 2021 in the "Efficient Models in NLP" area. Among the presented papers, 19/20 are monolingual and 17 focus only on English. Among the other two, one focuses on Indonesian and one on Chinese. The last paper focuses on MT with multiple languages. Papers mainly evaluate using accuracy and/or F1 and many papers evaluate on GLUE. There is a single two-dimensional paper according to our criteria (the paper focusing on MT, which makes contributions on multilinguality and efficiency) while two other papers can be considered two-dimensional but cover dimensions that we do not annotate, i.e. privacy and robustness respectively. This analysis corroborates our findings that research papers depart from SQUARE ONE in such dedicated conference areas/tracks, but largely only across a single dimension. + +
Area# papersEnglishAccuracy / F1MultilingualityFairness and biasEfficiencyInterpretability>1 dimension
Question Answering2495.8%41.7%4.2%4.2%8.3%4.2%0.0%
Sentence-level Semantics2387.0%56.5%8.7%0.0%4.3%17.4%4.3%
Computational Social Science1877.8%66.7%0.0%22.2%0.0%16.7%0.0%
Language Generation1883.3%0.0%11.1%5.6%11.1%11.1%5.6%
Sentiment Analysis18100.0%72.2%0.0%0.0%11.1%11.1%0.0%
Summarization1291.7%0.0%0.0%8.3%0.0%8.3%0.0%
Semantics: Lexical Semantics1258.3%41.7%25.0%0.0%16.7%0.0%8.3%
Information Retrieval1291.7%8.3%0.0%0.0%0.0%0.0%8.3%
Language Grounding to Vision11100.0%18.2%0.0%0.0%9.1%27.3%0.0%
Syntax1040.0%20.0%30.0%0.0%20.0%10.0%20.0%
Best Paper Session850.0%50.0%12.5%0.0%25.0%25.0%12.5%
Speech and Multimodality666.7%33.3%16.7%0.0%0.0%0.0%0.0%
Phonology and Morphology633.3%33.3%33.3%0.0%0.0%16.7%16.7%
Linguistic Theories6100.0%16.7%0.0%0.0%16.7%33.3%0.0%
Theme520.0%40.0%20.0%20.0%20.0%20.0%20.0%
+ +Table 4: The number of papers in the remaining areas as well as the fractions that only evaluate on English, only use accuracy / F1, make contributions along one of four dimensions, and make contributions along more than a single dimension (from left to right). \ No newline at end of file diff --git a/squareonebiasinnlptowardsamultidimensionalexplorationoftheresearchmanifold/images.zip b/squareonebiasinnlptowardsamultidimensionalexplorationoftheresearchmanifold/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..4056b0cdb8079577ccacdd6a6aac45cc8c9d2624 --- /dev/null +++ b/squareonebiasinnlptowardsamultidimensionalexplorationoftheresearchmanifold/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:452ff920e19dc86268df659a2f7776305762d8a25198d94437f7184f9d6df7c5 +size 208819 diff --git a/squareonebiasinnlptowardsamultidimensionalexplorationoftheresearchmanifold/layout.json b/squareonebiasinnlptowardsamultidimensionalexplorationoftheresearchmanifold/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..92b289b35b75a26aa1274d784fa193f0b4cd20d9 --- /dev/null +++ b/squareonebiasinnlptowardsamultidimensionalexplorationoftheresearchmanifold/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d0848fa7f48cd90feadc198eca446ff355afbe667a060ee11a70267b2d2f6356 +size 381570 diff --git a/strikingabalancealleviatinginconsistencyinpretrainedmodelsforsymmetricclassificationtasks/8e3f2e9c-fe43-409b-b231-0a5aff83a8df_content_list.json b/strikingabalancealleviatinginconsistencyinpretrainedmodelsforsymmetricclassificationtasks/8e3f2e9c-fe43-409b-b231-0a5aff83a8df_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..9d9985a820c90d041fb1f62b3b3ed85d8055629a --- /dev/null +++ b/strikingabalancealleviatinginconsistencyinpretrainedmodelsforsymmetricclassificationtasks/8e3f2e9c-fe43-409b-b231-0a5aff83a8df_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9089fbf074b66a996d85fc0771c9ce3580d91cd8aacbe5f69add23ebdb8a86f9 +size 62944 diff --git a/strikingabalancealleviatinginconsistencyinpretrainedmodelsforsymmetricclassificationtasks/8e3f2e9c-fe43-409b-b231-0a5aff83a8df_model.json b/strikingabalancealleviatinginconsistencyinpretrainedmodelsforsymmetricclassificationtasks/8e3f2e9c-fe43-409b-b231-0a5aff83a8df_model.json new file mode 100644 index 0000000000000000000000000000000000000000..bd46a3f1da4dcbe12753632c40df2c48a2691607 --- /dev/null +++ b/strikingabalancealleviatinginconsistencyinpretrainedmodelsforsymmetricclassificationtasks/8e3f2e9c-fe43-409b-b231-0a5aff83a8df_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b7ba9114c1b976ac79c536f2d25123638332cd86b325d229e692c4d8bac8ceaa +size 75696 diff --git a/strikingabalancealleviatinginconsistencyinpretrainedmodelsforsymmetricclassificationtasks/8e3f2e9c-fe43-409b-b231-0a5aff83a8df_origin.pdf b/strikingabalancealleviatinginconsistencyinpretrainedmodelsforsymmetricclassificationtasks/8e3f2e9c-fe43-409b-b231-0a5aff83a8df_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..be532991d41024aba19f3e76bdb4d28d2dd9143f --- /dev/null +++ b/strikingabalancealleviatinginconsistencyinpretrainedmodelsforsymmetricclassificationtasks/8e3f2e9c-fe43-409b-b231-0a5aff83a8df_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d5be487003f4a6664f4f0be26531ae61991d77166beb5da87297407449e3affc +size 1254963 diff --git a/strikingabalancealleviatinginconsistencyinpretrainedmodelsforsymmetricclassificationtasks/full.md b/strikingabalancealleviatinginconsistencyinpretrainedmodelsforsymmetricclassificationtasks/full.md new file mode 100644 index 0000000000000000000000000000000000000000..3907e868132fdd41bb41642b77e6ae503dcf03a3 --- /dev/null +++ b/strikingabalancealleviatinginconsistencyinpretrainedmodelsforsymmetricclassificationtasks/full.md @@ -0,0 +1,258 @@ +# Striking a Balance: Alleviating Inconsistency in Pre-trained Models for Symmetric Classification Tasks + +Ashutosh Kumar + +Indian Institute of Science, India + +ashutosh@iisc.ac.in + +Aditya Joshi + +SEEK, Australia + +aditya.m.joshi@gmail.com, + +ajoshi@seek.com.au + +# Abstract + +While fine-tuning pre-trained models for downstream classification is the conventional paradigm in NLP, often task-specific nuances may not get captured in the resultant models. Specifically, for tasks that take two inputs and require the output to be invariant of the order of the inputs, inconsistency is often observed in the predicted labels or confidence scores. We highlight this model shortcoming and apply a consistency loss function to alleviate inconsistency in symmetric classification. Our results show an improved consistency in predictions for three paraphrase detection datasets without a significant drop in the accuracy scores. We examine the classification performance of six datasets (both symmetric and non-symmetric) to showcase the strengths and limitations of our approach. + +# 1 Introduction + +Symmetric classification tasks involve two inputs and require that the model output should be independent of the order in which the two input texts are given. In other words, the output of the classifier should be the same and the confidence score must not be significantly different, if the inputs $X$ and $Y$ are instead supplied as $Y$ and $X$ . Paraphrase detection, multi-lingual semantic similarity are examples of symmetric classification tasks. Although attention-based (Bahdanau et al., 2015; Vaswani et al., 2017) pre-trained language models have led to significant performance gains in multiple text classification tasks, they demonstrate a peculiar erratic behaviour on symmetric classification: inconsistency. An example1 of inconsistency for paraphrase detection is shown in Figure 1. Additional examples can be found in the Appendix (Table 4). To alleviate such an inconsistency for symmetric classification tasks, we propose a simple additional + +
XA provisional government or a revolutionary government has been declared several times by insurgent groups in the Philippines.
YA revolutionary government or a provisional government has been declared several times in the Philippines by insurgent groups.
+ +
Model +Input +Sequence
X Y(98.6)(88.3)
Y X(92.2)(87.9)
+ +Figure 1: Impact of reordering an example input pair $(X$ and $Y)$ on standard fine-tuned BERT and BERTwith-consistency-loss. The pair are true paraphrases. and denote that the model predicted them to be paraphrases and not-paraphrases, respectively. Confidence scores are reported in brackets. Details in Section 1. + +drop-in fine-tuning objective, based on either the Kullback-Leibler (KL) or Jensen-Shannon (JS) divergence (or any $f$ -divergence (Rubenstein et al., 2019)), to the cross-entropy loss for symmetric tasks. We refer to this as the consistency loss. + +The main contributions of this paper are: + +(a) Highlight inconsistency issues in symmetric classification tasks, +(b) Describe a consistency loss function to alleviate inconsistency, and +(c) Demonstrate the applicability and limitations of the loss function via qualitative and quantitative analyses on tasks from the GLUE benchmark. + +Additionally, to drive future research, we have made the data and code public2. + +Note: The problem of inconsistency can be attributed in part to the positional embedding. However, it has been shown that eliminating positional + +embedding results in a poor performance of the model (Wang and Chen, 2020; Wang et al., 2021). + +# 2 Related Work + +Pre-trained Classification Models like BERT (Devlin et al., 2019), and RoBERTa (Liu et al., 2020) are typically fine-tuned for classification tasks using a low capacity neural network classifier connected to the pre-trained model on its first token (typically [CLS] token). We demonstrate the inconsistency in the case of symmetric classification tasks for pairs of inputs, depending on the order of inputs. To the best of our knowledge, this is the first work that incorporates task-specific nuances to ensure consistency in symmetric classification. + +Consistency Loss has been used in style transfer tasks to minimize the distance between roundtrip generation of candidates for image-to-image translation (Zhu et al., 2017) or text style transfer (Huang et al., 2020). In a similar vein, we apply consistency loss (formulated as either the Kullback-Leibler or the Jensen-Shannon divergence loss) to alleviate the inconsistency problem in symmetric tasks. + +Embedding-based Semantic Similarity Scores based on BERT-based models like SBERT (Reimers and Gurevych, 2019; Thakur et al., 2021) can map surface form realizations to embeddings. Their performance is worse than directly using BERT-style cross-encoder models for tasks such as semantic similarity (Thakur et al., 2021). However, the primary aim of such embedding-based scorers is orthogonal and, at best, complementary to the goal of our work since we want to ensure high-performing, consistent classifiers. Similarly, an alternative for symmetric classification is to separately obtain predictions for $(X,Y)$ and $(Y,X)$ , and then average the confidence scores during test time. But, this is a weakly grounded, heuristic-driven approach. In general, averaging does not rectify the mistakes made by the model, only masks it. + +# 3 Method + +# 3.1 Problem Description + +A. Given a pair of input sentences $(X,Y)$ , label $l_{(X,Y)}$ , and a pre-trained BERT-based model $\mathcal{M}_{\mathrm{PRE}}$ , the goal is to output a reliable model $\mathcal{M}_{\mathrm{REL}}$ to predict an output label for a new input pair $(X_{test},Y_{test})$ such that the inconsistency between its different ordering is minimized. While we only + +
CategoryDatasetsTrainVal.Test
Pairwise SymmetricQQP3274624043036384
PAWS4940180008000
MRPC3302408366
Single SentenceSST26061568726734
Pairwise Non-symmetricQNLI9950654635237
RTE2241277249
+ +Table 1: Datasets Statistics. Please refer to Section 4. + +experiment with semantic similarity (or paraphrasing), the description holds true for other symmetric relations too (such as predicting if two sentences have the same polarity). + +B. Given a model fine-tuned on the task above $\mathcal{M}_{\mathrm{REL}}$ , can it help in providing a better initialization for transfer learning an empirically superior model $\mathcal{M}'$ on other downstream tasks? + +# 3.2 Setup + +![](images/e8670056cbdfb8b1594d64e7efdded8fdd5fa1973e538e68fccfe2d28a99c5ff.jpg) +Figure 2: BERT-with-consistency-loss. We use an additional classification token: [CLSPara] for our input, upon which the consistency objective is applied. Please refer Section 3.2 for details. + +For problem A (Section 3.1), the input is a concatenation of tokenized strings $X = x_{1}, \ldots, x_{m}$ and $Y = y_{1}, \ldots, y_{n}$ separated using a special token ([SEP] in the case of BERT). The concatenated inputs with the special token are passed through multiple self-attention layers (Vaswani et al., 2017). In the traditional approach, the representation of the first token ( or [CLS]) is passed through a fully connected classifier layer (the same final representation is used irrespective of the arity of the task inputs). In our approach, we use the [CLSPara] representation for symmetric classification tasks whereas we use the standard first token ( or [CLS]) representation for single input and non-symmetric classification tasks (Section 4). Since we first fine-tune the model on [CLSPara] representation, our approach allows for pair-wise + +knowledge to be transferred to other downstream classification tasks (problem B (Section 3.1)). + +We call this method BERT-with-consistency-loss and is shown in Figure 2. Contrasting this with a traditional BERT-based approach, we see that, in the traditional BERT-based approach approach, the input is pre-pended with another special symbol ([CLS] in case of BERT and $$ in case of RoBERTa). In BERT-with-consistency-loss, we concatenate an extra symbol with the special symbol. We call the extra symbol [CLSPara]. This extra token is specifically used for symmetric classification tasks to ensure consistency of prediction. The standard objective used for fine-tuning BERT-based models is the cross-entropy loss, which maximizes the probability of predicting the correct output class for a given input, given as: + +$$ +\mathcal {L} _ {c e} (y, \hat {y}) = - \sum_ {i} y _ {i} \log \hat {y} _ {i}, \tag {1} +$$ + +where $y$ is the one-hot representation of the target class, $\hat{y}$ is the softmax output of the model, and $i$ is the associated co-ordinate. As described earlier, this objective may produce an inconsistent prediction based on the order of the two inputs. To overcome this weakness, we propose an additional consistency loss formulated in terms of either the KL or the JS Divergence. We pass the inputs $X$ and $Y$ through the same model twice, once as a pair $(X,Y)$ (called $L2R$ ) and then as the pair $(Y,X)$ (called $R2L$ ). Having obtained the outputs from the model for $L2R$ and $R2L$ , the final objective function for $\hat{\mathbf{\Phi}}$ is as follows: + +$$ +\begin{array}{l} \mathcal {L} = \mathcal {L} _ {c e} (y, \hat {y} _ {L 2 R}) + \mathcal {L} _ {c e} (y, \hat {y} _ {R 2 L}) \tag {2} \\ + \lambda * \mathcal {D} \left(p _ {L 2 R} \| p _ {R 2 L}\right), \\ \end{array} +$$ + +where $\lambda$ is the weight assigned to the consistency loss, $p_{L2R}$ and $p_{R2L}$ are the associated confidence/softmax vectors assigned by the model for $L2R$ and $R2L$ sentence pairs, and $\mathcal{D}$ is one of the following: + +1. $KL(p||q) = \sum_{x\in X}p(x)\log \frac{p(x)}{q(x)}$ +2. $JS(p||q) = \frac{1}{2} KL(p||m) + \frac{1}{2} KL(q||m)$ + +Here $p, q$ are probability distributions and $m = \frac{1}{2}(p + q)$ . Minimizing divergences between two distributions brings them closer to each other. + +# 4 Experimental Setup + +# 4.1 Datasets + +We experiment with 5 standard datasets from the GLUE benchmark (Wang et al., 2019) as well as the + +PAWS dataset (Zhang et al., 2019) $^3$ . We categorize them under the following headings: + +A. For Symmetric Tasks: (i) QQP: Quora Question Pairs (Iyer et al., 2017) data set contains pairs of questions marked with either 1 (paraphrases) or 0 (not paraphrases). + +(ii) PAWS: Paraphrase Adv. from Word Scrambling (Zhang et al., 2019), contains human labeled sentence pairs annotated in line with QQP. The uniqueness about this dataset is the creation procedure which involves back-translation and word swapping. (iii) MRPC: Microsoft Research Paraphrase Corpus (Dolan and Brockett, 2005) comprises human annotated sentence pairs collected from newswire articles. +B. For Single Input Task: (i) SST2: Stanford Sentiment Treebank (Socher et al., 2013). This is a collection of human-annotated movie reviews. We work with the standard two class setting where the annotations have opposite polarities (1 for positive sentiment and 0 otherwise). +C. For Non-symmetric tasks: (i) QNLI: Natural Language Inference dataset constructed from SQuAD (Rajpurkar et al., 2016) related to a two-class classification problem to determine if the premise entails a hypothesis or not. +(ii) RTE: Recognizing Textual Entailment (Dagan et al., 2005; Bar-Haim et al., 2006; Giampiccolo et al., 2007; Bentivogli et al., 2009) Corpus is a combination of multiple RTE datasets containing one of two labels (1 for entailment and 0 for non-entailment). + +# 4.2 Evaluation + +We analyse the results of the traditional objective as well as our approach on BERT-BASE and ROBERTA-BASE across four different seeds under the following categories: + +1. Prediction Consistency: This evaluation is done only for the symmetric task. Score $= \frac{\mathbb{1}_{(l_{L2R} = l_{R2L})}}{(\# \text{of } L2R \text{ Samples})} * 100$ , where $l_{L2R}, l_{R2L}$ denote labels for $L2R$ and $R2L$ , respectively. Note that this is not related to the ground truth labels. +2. Confidence Consistency: We perform these evaluations specifically for symmetric task. + +
(A) L2R and R2L Prediction Consistency +Mean ± stddev (Section 4.2: Evaluation [1])(B) L2R and R2L Confidence Consistency +Pearson Correlation [MSE * 1000] (Section 4.2: Evaluation [2])
ModelsQQPPAWSMRPCQQPPAWSMRPC
BERT-BASE96.6 ± 0.1596.0 ± 0.5491.1 ± 1.4198.2 [5.89]96.5 [14.2]92.7 [17.0]
BERT-BASE W/ KL99.3 ± 0.0298.1 ± 0.1297.7 ± 0.8299.9 [0.12]99.6 [0.5]99.5 [0.3]
BERT-BASE W/ JS98.9 ± 0.0598.1 ± 0.2296.9 ± 0.9399.8 [0.48]99.3 [1.9]99.0 [1.1]
ROBERTA-BASE97.0 ± 0.1496.7 ± 0.2591.5 ± 0.2298.3 [5.90]97.4 [10.8]94.1 [16.3]
ROBERTA-BASE W/ KL99.3 ± 0.0398.9 ± 0.1197.4 ± 0.7899.3 [0.10]99.7 [0.4]99.5 [0.3]
ROBERTA-BASE W/ JS99.1 ± 0.0598.7 ± 0.2396.7 ± 1.1199.8 [0.40]99.6 [1.5]99.0 [1.3]
+ +(C) Classification Performance Metrics (Section 4.2: Evaluation [3]) + +
ModelsQQP (Acc/F1)PAWS (Acc/F1)MRPC (Acc/F1)SST2 (Acc)QNLI (Acc)RTE (Acc)
BERT-BASE89.5 / 85.791.1 / 90.178.3 / 82.794.0 ± 0.1087.9 ± 0.1363.0 ± 1.33
BERT-BASE w/ KL87.1 / 82.388.0 / 86.873.0 / 80.794.1 ± 0.2071.2 ± 4.1551.6 ± 1.50
BERT-BASE w/ JS89.7 / 86.090.5 / 89.576.6 / 82.694.2 ± 0.4274.5 ± 0.8050.2 ± 16.90
ROBERTA-BASE90.2 / 87.292.6 / 91.782.4 / 86.094.4 ± 0.3989.9 ± 0.4770.6 ± 2.35
ROBERTA-BASE w/ KL87.2 / 82.791.5 / 90.574.7 / 81.094.5 ± 0.3685.3 ± 1.6258.7 ± 5.40
ROBERTA-BASE w/ JS90.0 / 86.692.3 / 91.679.2 / 84.995.1 ± 0.1286.8 ± 1.5161.4 ± 1.06
+ +Table 2: Parts (A) & (B): L2R and R2L Prediction and Confidence Consistency. Part (C) Classification Metrics. (*-BASE) indicate *, (*- W/ *) indicate Higher Accuracy, Higher Pearson Correlation and lower MSE are better. Numbers in bold are statistically significant. Underlined numbers are better on average than baselines. Please refer to Section 5.1 for a discussion. + +This is to analyze how aligned are the confidence (softmax output associated with label 1) predicted by the model for $L2R$ and $R2L$ setting. The metrics used are the pearson correlation (scaled by 100) and the mean squared error (MSE - scaled by 1000) between the two confidence scores of the test data. + +3. Standard Classification Metrics: These are task-specific metrics (accuracy/F1) used in the standard GLUE tasks (Wang et al., 2019) + +# 4.3 Implementation Details + +To fine-tune the model for symmetric classification tasks, we club together three paraphrase detection datasets: (a) QQP, (b) PAWS, and (c) MRPC. To make sure that all the models see the same data, we augment the dataset with its reverse samples during training. The model is then trained by passing the [CLSPara] (Section 3.2) representation through a low-capacity classifier, and optimized using Equation 1 for baseline models and Equation 2 for the consistency inducing models (Ours). We then use these models to conduct two sets of evaluations. We first evaluate the paraphrase detection results on QQP, PAWS, and MRPC individually. We then take the fine-tuned model obtained above and additionally fine-tune ([CLS] or $$ token) on the single input task (SST-2) and non-symmetric tasks (QNLI, RTE). + +We use the hugging-face library (Wolf et al., 2020) for tokenizing the input, and the pytorch-lightning framework (Falcon et al., 2019) for loading the pre + +trained models and fine-tuning them. We optimize the objective using the AdamW (Loshchilov and Hutter, 2019) optimizer with a learning rate of 2e-5 (obtained through hyperparameter tuning {2e-4, 2e-5, 4e-5, 2e-6}). Since the input contains an additional token [CLSPara], we extend the tokenizer vocabulary for each of the models. Each model was fine-tuned on a single Nvidia 1080Ti GPU (12 GB) for a maximum of 3 epochs ( $\approx$ 6hrs/experiment). In case of BERT (Devlin et al., 2019), we use the bert-base-cased model while for RoBERTa (Liu et al., 2020), we use the RoBERTa-base model. For training stability, we perform lambda annealing i.e., increase the $\lambda$ parameter from 0.0 to 100.0 as the training progresses. This ensures that the model has developed the capability to classify the sentence pairs with some degree of correctness before making it adhere to the appropriate symmetric confidence scores. We also experimented with fixed $\lambda$ , but the resultant models were slow to converge ( $\approx$ 15 epochs). + +# 5 Results + +Our experiments address three questions: + +Q1. What are the shortcomings of the current objective function for symmetric classification tasks? (Section 1, Section 5.2) +Q2. Does adding the consistency loss alleviate the inconsistency problem? (Section 5.1) +Q3. Can consistency-based fine-tuning improve other downstream tasks? (Section 5.1) + +# 5.1 Quantitative Analysis + +Table 2 presents our results. Parts (A) & (B) compare $L2R$ and $R2L$ models in terms of prediction consistency and confidence consistency. Models trained with the consistency loss (indicated by $W/ \ast$ ) assign more similar predictions (indicated by higher scores in (A)) and confidence scores (indicated by higher correlation in (B)) as compared to the base model (indicated by $-BASE$ ), for both the base models (BERT-BASE/ROBERTA-BASE) and all symmetric test data sets (QQP, PAWS, MRPC). Moreover, the MSE (indicated within square brackets in part (B)) with consistency training is an order-of-magnitude smaller than without it. The improvements in part (A) are statistically significant at significance level $(\alpha)$ of 0.01 according to McNemar's statistical test (Dror et al., 2018). + +Part (C) shows the results on downstream finetuning. Our models (indicated by $W / *$ ) do not compromise significantly (statistically evaluated) on the classification metrics for QQP, PAWS, and MRPC (F1/accuracy). The consistency loss does not change the accuracy scores of single sentence input tasks (SST-2), but affects the non-symmetric tasks (QNLI, RTE) negatively. This seems natural since the final objective of both the tasks is quite different and, in many cases, uncorrelated or negatively correlated. Incorporating consistency loss before fine-tuning on non-symmetric tasks (such as entailment) should, therefore, be avoided. + +Limitations: Our goal is to increase the reliability (measured in terms of confidence scores) of the model and not specifically target classification performance metrics like accuracy and F1. Cases where they increase, can only partially be attributed to a stricter consistency constraint. + +# 5.2 Qualitative Analysis + +We sample 30 instances that were assigned opposite labels for $L2R$ and $R2L$ by the BERT-BASE models (majority voting) for QQP, MRPC and PAWS. An evaluator with NLP expertise analysed these examples and grouped them into recall error types. We then check the predictions for the same set of instances from BERT + JS (recall). Counts for these error types (defined in Section 7.1) are shown in Table 3. Out of those 30 examples for QQP, MRPC and PAWS, 26, 26 and 23 respectively get corrected by $\clubsuit$ . In general, the numbers reduce for all error types. + +
Error typeQQP
Different expected answer40
Different answer type + Additional details81
Different answer type + Additional details + Pronoun change10
Additional details and/or pronoun change173
MRPC
Additional details missing132
Reordering of phrases30
Named entities and pronouns61
Focus of sentences is different60
Synonyms21
PAWS
Phrases are changed104
Nouns/adjectives are changed121
Nouns/adjectives and phrases are changed40
Named entities are changed31
Names entities and nouns/adjectives are changed11
+ +Table 3: Recall errors in QQP, MRPC & PAWS: BERT (♂) and BERT with JS (♀). Please refer to Section 5.2. + +# 6 Conclusion + +In this paper, we proposed an additional objective: consistency loss between $L2R$ and $R2L$ predictions so as to alleviate the problem of input order-sensitive inconsistency in the case of symmetric classification tasks. For three symmetric classification tasks, our proposed solution, BERT-with-consistency-loss, results in an improved consistency in terms of Pearson's correlation and MSE. As expected, consistency loss results in a drop in the performance of non-symmetric classification tasks such as QNLI and RTE. Surprisingly, using KL divergence results in marginally higher consistency than the JS counterpart. We leave this analysis for future work. Our qualitative analysis shows that all error types, including change in phrases or addition/deletion of details are reduced when the consistency loss is incorporated. + +While consistency loss ensures that the predicted labels are the same even if the order of inputs is swapped, it can be adapted in the future to ensure expected outputs for anti-symmetric classification tasks (where $\mathbb{P}(L2R) = 1 - \mathbb{P}(R2L)$ ) like next and previous sentence prediction, where reordering the inputs must result in an opposite predicted label. In addition, the proposed method can be applied to evaluate paraphrase generation models (Kumar et al., 2019, 2020) as well. In order to validate that paraphrasing models are indeed generating semantically similar outputs, BERT-with-consistency-loss can be used to either evaluate and filter out incorrect generations or be used as an objective to train learned metrics like BLEURT (Sellam et al., 2020). + +# Ethical Considerations + +The primary aim of this work is to highlight the inconsistency in labels and confidence scores of generated by standard pre-trained models for symmetric classification tasks. To mitigate the aforementioned inconsistency, we propose a loss function that incorporates divergence between outputs when the input order is swapped. We do not anticipate any additional ethical issues being introduced by our loss function as compared to the original standard pre-trained models, specifically BERT and RoBERTa. All the datasets used in our experiments are subset of the datasets from previously published papers, and to the best of our knowledge, do not have any attached privacy or ethical issues. That being said, further efforts should be made to study the inherent biases encoded in the pre-trained language models and the datasets. + +# References + +Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. 2015. Neural machine translation by jointly learning to align and translate. In International Conference on Learning Representations. +Roy Bar-Haim, Ido Dagan, Bill Dolan, Lisa Ferro, Danilo Giampiccolo, Bernardo Magnini, and Idan Szpektor. 2006. The second pascal recognising textual entailment challenge. In Proceedings of the second PASCAL challenges workshop on recognising textual entailment, volume 6, pages 6-4. Venice. +Luisa Bentivogli, Peter Clark, Ido Dagan, and Danilo Giampiccolo. 2009. The fifth pascal recognizing textual entailment challenge. In TAC. +Ido Dagan, Oren Glickman, and Bernardo Magnini. 2005. The pascal recognising textual entailment challenge. In *Machine Learning Challenges Workshop*, pages 177–190. Springer. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171-4186, Minneapolis, Minnesota. Association for Computational Linguistics. +William B Dolan and Chris Brockett. 2005. Automatically constructing a corpus of sentential paraphrases. In Proceedings of the Third International Workshop on Paraphrasing (IWP2005). +Rotem Dror, Gili Baumer, Segev Shlomov, and Roi Reichart. 2018. The hitchhiker's guide to testing statistical significance in natural language processing. In + +Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1383-1392, Melbourne, Australia. Association for Computational Linguistics. +William Falcon et al. 2019. Pytorch lightning. GitHub. Note: https://github.com/PyTorchLightning/pytorch-lightning, 3:6. +Danilo Giampiccolo, Bernardo Magnini, Ido Dagan, and Bill Dolan. 2007. The third pascal recognizing textual entailment challenge. In Proceedings of the ACL-PASCAL workshop on textual entailment and paraphrasing, pages 1-9. Association for Computational Linguistics. +Yufang Huang, Wentao Zhu, Deyi Xiong, Yiye Zhang, Changjian Hu, and Feiyu Xu. 2020. Cycle-consistent adversarial autoencoders for unsupervised text style transfer. In Proceedings of the 28th International Conference on Computational Linguistics, pages 2213-2223, Barcelona, Spain (Online). International Committee on Computational Linguistics. +Shankar Iyer, Nikhil Dandekar, and Kornel Csernai. 2017. First quora dataset release: Question pairs. +Ashutosh Kumar, Kabir Ahuja, Raghuram Vadapalli, and Partha Talukdar. 2020. Syntax-guided controlled generation of paraphrases. Transactions of the Association for Computational Linguistics, 8:330-345. +Ashutosh Kumar, Satwik Bhattachamishra, Manik Bhandari, and Partha Talukdar. 2019. Submodular optimization-based diverse paraphrasing and its effectiveness in data augmentation. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 3609-3619, Minneapolis, Minnesota. Association for Computational Linguistics. +Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2020. Ro{bert}a: A robustly optimized {bert} pretraining approach. +Ilya Loshchilov and Frank Hutter. 2019. Decoupled weight decay regularization. In International Conference on Learning Representations. +Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. 2016. SQuAD: 100,000+ questions for machine comprehension of text. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 2383-2392, Austin, Texas. Association for Computational Linguistics. +Nils Reimers and Iryna Gurevych. 2019. SentenceBERT: Sentence embeddings using Siamese BERT-networks. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing + +and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 3982-3992, Hong Kong, China. Association for Computational Linguistics. + +Paul Rubenstein, Olivier Bousquet, Josip Djolonga, Carlos Riquelme, and Ilya O Tolstikhin. 2019. Practical and consistent estimation of f-divergences. Advances in Neural Information Processing Systems, 32:4070-4080. + +Thibault Sellam, Dipanjan Das, and Ankur Parikh. 2020. BLEURT: Learning robust metrics for text generation. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 7881-7892, Online. Association for Computational Linguistics. + +Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D Manning, Andrew Ng, and Christopher Potts. 2013. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 conference on empirical methods in natural language processing, pages 1631-1642. + +Nandan Thakur, Nils Reimers, Johannes Daxenberger, and Iryna Gurevych. 2021. Augmented SBERT: Data augmentation method for improving bi-encoders for pairwise sentence scoring tasks. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 296-310, Online. Association for Computational Linguistics. + +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc. + +Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. 2019. GLUE: A multi-task benchmark and analysis platform for natural language understanding. In the Proceedings of ICLR. + +Benyou Wang, Lifeng Shang, Christina Lioma, Xin Jiang, Hao Yang, Qun Liu, and Jakob Grue Simonsen. 2021. On position embeddings in {bert}. In International Conference on Learning Representations. + +Yu-An Wang and Yun-Nung Chen. 2020. What do position embeddings learn? an empirical study of pre-trained language model positional encoding. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 6840-6849, Online. Association for Computational Linguistics. + +Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Remi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick von Platen, + +Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander Rush. 2020. Transformers: State-of-the-art natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 38-45, Online. Association for Computational Linguistics. + +Yuan Zhang, Jason Baldridge, and Luheng He. 2019. PAWS: Paraphrase adversaries from word scrambling. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 1298-1308, Minneapolis, Minnesota. Association for Computational Linguistics. + +Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. 2017. Unpaired image-to-image translation using cycle-consistent adversarial networkss. In Computer Vision (ICCV), 2017 IEEE International Conference on. + +# 7 Appendix + +# 7.1 Recall Error Types in Qualitative Analysis + +The qualitative analysis compares types of errors with and without consistency loss. The recall error types can be described as follows: + +# A. QQP: + +1. Different expected answer: This error is said to occur in the case of QQP when the two input questions have a different expected answer. An example of such a pair is: 'Is consciousness possible without self-awareness?' and 'Is self-awareness possible without consciousness?' The two questions are essentially complements of each other. + +2. Different answer type + Additional details: This error is said to occur when one of the inputs is structured in a way that the answer would solicit additional details. For example, the input pair 'How do I structure a big PHP project?' and 'How do I build a perfect PHP project?' are similar - but nuances between 'structuring' and 'building' a project may result in different answers. + +3. Additional details and/or pronoun change: The input pair 'What are the best ways to get thick and wavy hair?' and 'How can I get thick, wavy hair (as a guy)?' is similar - although the latter uses the first-person proverb. + +
DatasetExample pairTrue labelL2R LabelR2L Label
MRPC(1) Shares in Wal-Mart closed at $58.28, up 16 cents, in Tuesday trading on the New York Stock Exchange. (2) Wal-Mart shares rose 16 cents to close at $58.28 on the New York Stock Exchange.101
(1) Darren Dopp, a Spitzer spokesman, declined to comment late Thursday. (2) John Heine, a spokesman for the commission in Washington, declined to comment on Mr. Spitzer's criticism.001
QQP(1) How do I retrieve my deleted history from Google chrome? (2) Can history be retrieved after deleting Google chrome?101
(1) Is consciousness possible without self-awareness? (2) Is self-awareness possible without consciousness?010
PAWS(1) This iteration is larger and has a smaller storage capacity than its previous versions. (2) This iteration is smaller and has a greater storage capacity than its previous versions001
(1) To get there, take Marine Drive west from the Lions Gate Bridge past Horseshoe Bay to Lighthouse Park and then continue on to 7100 Block Marine Drive. (2) To get there, take the Marine Drive from the Lions Gate Bridge to the west, past the Horseshoe Bay, Lighthouse Park and continue on to the 7100 Marine Drive block.110
+ +Table 4: Sample pairs which are classified differently by the fine-tuned model based on their input order in the standard classification setting in each of the paraphrase dataset. Please refer Section 1, Section 3.2 for details. + +# B. MRPC: + +1. Additional details missing: One of the inputs contains information (i.e., details) that are not present in the other input. For example, 'The caretaker, identified by church officials as Jorge Manzon, was believed to be among the nine missing - some of them children' contains the number of missing persons that are not present in 'The caretaker, identified by church officials as Jorge Monzon, was believed to be among the missing, who are presumed dead'. +2. Reordering of phrases: The two inputs contain the same information although the information may be represented using different phrasal structures. For example, 'Shares in Wal-Mart closed at $58.28, up 16 cents, in Tuesday trading on the New York Stock Exchange.' conveys the same information as 'Wal-Mart shares rose 16 cents to close at$ 58.28 on the New York Stock Exchange.' The former uses passive voice while the latter uses 'shares' as the main verb. +3. Named entities and pronouns: One input replaces entities with pronouns, as in the case of 'The bonds traded to below 60 percent of face value earlier this year' and 'They traded down early this year to 60 percent of face + +value on fears Aquila may default. + +4. Focus of sentences is different: While information in one input is subsumed by the other, the latter might focus on a broader context. For example, 'A power cut in New York in 1977 left 9 million people without electricity for up to 25 hours' is implied in the sentence 'The outage resurrected memories of other massive power blackouts, including one in 1977 that left about 9 million people without electricity for 25 hours.' However, the latter describes a resurrection of memories of the event in 1977. +5. Synonyms: One or more words in an input may be replaced by its synonyms in the other input. For example, 'In 2001, the number of death row inmates nationally fell for the first time in a generation' can be converted to 'In 2001, the number of people on death row dropped for the first time in a decade.' by replacing the word 'fell' with 'dropped'. + +# C. PAWS + +1. Nouns/adjectives are changed: In the case of these errors, adjectives are replaced. An example pair is 'This iteration is larger and has a smaller storage capacity than its previous versions' and 'This iteration is smaller + +and has a greater storage capacity than its previous versions. + +2. Named entities are changed: This refers to pairs where named entities (locations/people) are different. An example is the pair 'When Mexico was within Los Angeles, Botello was chief of staff for Mexican General Ramirez y Sesma. His two brothers also married daughters of the general' and 'When Los Angeles was within Mexico, Botello was Chief of Staff of the Mexican General Ramirez y Sesma, his two brothers also married the general's daughters.' \ No newline at end of file diff --git a/strikingabalancealleviatinginconsistencyinpretrainedmodelsforsymmetricclassificationtasks/images.zip b/strikingabalancealleviatinginconsistencyinpretrainedmodelsforsymmetricclassificationtasks/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..d3f6d49c779fd6893162c6e8d0e0fcd894d3b993 --- /dev/null +++ b/strikingabalancealleviatinginconsistencyinpretrainedmodelsforsymmetricclassificationtasks/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d2edefc01bda3e33f86d490e6b90bfd0c874bfc1270660a4ae12a9bcefbb2395 +size 361499 diff --git a/strikingabalancealleviatinginconsistencyinpretrainedmodelsforsymmetricclassificationtasks/layout.json b/strikingabalancealleviatinginconsistencyinpretrainedmodelsforsymmetricclassificationtasks/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..1e2a9ea2b57c005bec8a18aa3290117fc6a2fcfb --- /dev/null +++ b/strikingabalancealleviatinginconsistencyinpretrainedmodelsforsymmetricclassificationtasks/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0567b7695e211e8d00828956316a2fa7d18ecac2053603745018341c16d8ef4b +size 292385 diff --git a/structuralsupervisionforwordalignmentandmachinetranslation/d7396400-3ed3-4a46-9f20-5ef65054bad0_content_list.json b/structuralsupervisionforwordalignmentandmachinetranslation/d7396400-3ed3-4a46-9f20-5ef65054bad0_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..6cd76e4286c050f63a5caf04b13262aaac9c717f --- /dev/null +++ b/structuralsupervisionforwordalignmentandmachinetranslation/d7396400-3ed3-4a46-9f20-5ef65054bad0_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d1fa5cdad6a6c3e760a1fa01e46fdcb4fc47bd3850564244f15350f0d5e3da75 +size 81340 diff --git a/structuralsupervisionforwordalignmentandmachinetranslation/d7396400-3ed3-4a46-9f20-5ef65054bad0_model.json b/structuralsupervisionforwordalignmentandmachinetranslation/d7396400-3ed3-4a46-9f20-5ef65054bad0_model.json new file mode 100644 index 0000000000000000000000000000000000000000..4bcba9b0d2a19891e46ca97504b78bdaf8dbeec6 --- /dev/null +++ b/structuralsupervisionforwordalignmentandmachinetranslation/d7396400-3ed3-4a46-9f20-5ef65054bad0_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9372592090c4eba2e3fe6dc00f4da50826287a1b58b341a9e68fe779b5425719 +size 95185 diff --git a/structuralsupervisionforwordalignmentandmachinetranslation/d7396400-3ed3-4a46-9f20-5ef65054bad0_origin.pdf b/structuralsupervisionforwordalignmentandmachinetranslation/d7396400-3ed3-4a46-9f20-5ef65054bad0_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..5c7fb97d4dbf75918eb165106186cc67551f697f --- /dev/null +++ b/structuralsupervisionforwordalignmentandmachinetranslation/d7396400-3ed3-4a46-9f20-5ef65054bad0_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0a46ad018c44f2de411ca4cd3826c4a602534d99954ff220a9fddb4904f06c91 +size 994583 diff --git a/structuralsupervisionforwordalignmentandmachinetranslation/full.md b/structuralsupervisionforwordalignmentandmachinetranslation/full.md new file mode 100644 index 0000000000000000000000000000000000000000..0f77e3bcd71a8bc03148cc17052d02f4b9893838 --- /dev/null +++ b/structuralsupervisionforwordalignmentandmachinetranslation/full.md @@ -0,0 +1,352 @@ +# Structural Supervision for Word Alignment and Machine Translation + +Lei Li $^{1,2,3}$ , Kai Fan $^{*2}$ , Hongjia Li $^{1,3}$ , Chun Yuan $^{3}$ + +$^{1}$ Department of Computer Science and Technology, Tsinghua University, Beijing, China + +2Alibaba DAMO Academy, Alibaba Group Inc. + +$^{3}$ Tsinghua Shenzhen International Graduate School, Peng Cheng Lab + +# Abstract + +Syntactic structure has long been argued to be potentially useful for enforcing accurate word alignment and improving generalization performance of machine translation. Unfortunately, existing wisdom demonstrates its significance by considering only the syntactic structure of source tokens, neglecting the rich structural information from target tokens and the structural similarity between the source and target sentences. In this work, we propose to incorporate the syntactic structure of both source and target tokens into the encoder-decoder framework, tightly correlating the internal logic of word alignment and machine translation for multitask learning. Particularly, we won't leverage any annotated syntactic graph of the target side during training, so we introduce Dynamic Graph Convolution Networks (DGCN) on observed target tokens to sequentially and simultaneously generate the target tokens and the corresponding syntactic graphs, and further guide the word alignment. On this basis, Hierarchical Graph Random Walks (HGRW) are performed on the syntactic graphs of both source and target sides, for incorporating structured constraints on machine translation outputs. Experiments on four publicly available language pairs verify that our method is highly effective in capturing syntactic structure in different languages, consistently outperforming baselines in alignment accuracy and demonstrating promising results in translation quality. + +# 1 Introduction + +Word alignment (Brown et al., 1993) aims to find the correspondence between tokens in a sentence pair. Neural machine translation (NMT) (Bahdanau et al., 2015; Vaswani et al., 2017) works by taking an end-to-end approach to incrementally predict the target translation from a source sentence, where no explicit word alignment is required during model training or decoding. Recently, there has been an + +Figure 1: Similar dependencies of different languages. +![](images/6aab2d40d00f1053008fe3aa0d82845c75045ed2540601094ccb51a6d5c25cd5.jpg) +Regardless of direction and type: (1) the dependencies between 'you' and 're' and between 're' and 'naive' in English match the dependencies between 'Du' and 'bist' and between 'bist' and 'naiv' in German. +(2) For English-French (Chinese) pairs, although there is no explicit dependency between $\mathbf{T}\mathbf{u}^{\prime}$ (你) and es' (很), we can capture the implicit dependency by tracing the dependencies between $\mathbf{T}\mathbf{u}^{\prime}$ (你) and 'naive'(天真) and between 'naive'(天真) and es' (很). + +increasing interest (Zenkel et al., 2020; Chen et al., 2020, 2021; Zhang and van Genabith, 2021) in combining the two tasks through inducing accurate word alignment in neural translation models for improving translation quality. + +Intuitively, word alignment is helpful to enforce the domain-specific terminology or improve the translations of low-frequency tokens (Song et al., 2019; Dinu et al., 2019). Also, word alignment provides supportive linguistic information on translation outputs, being useful in interactive translation with the human in the loop (Weng et al., 2019). Since the target-to-source attention in NMT models can infer rough word alignments but induce many errors with low accuracy, a number of recent works (Garg et al., 2019; Zenkel et al., 2019, 2020; Zhang and van Genabith, 2021) focus on NMT-based alignment methods which take alignments as a by-product of NMT systems. + +Although NMT-based aligners have proven to be effective and achieved the State-of-the-Art alignment accuracy, they suffer from two major limitations. First, due to the autoregressive property (Sutskever et al., 2014), they (Dyer et al., 2013; Bahdanau et al., 2015; Vaswani et al., 2017; Chen et al., 2020) only leverage partial target context. + +The latest works (Chen et al., 2021; Zhang and van Genabith, 2021) alleviate this deficiency to exploit both sides of the target content to compute better target-to-source attention (alignment), by abandoning autoregressive decoder and sacrificing the translation ability. In addition, there are also related works (Bastings et al., 2017; Marcheggiani et al., 2018) proposing syntax-aware NMT models without word alignment task. However, they simply utilize the syntactic structure of source tokens and ignore to capture the syntactic structure of target tokens. In summary, the syntactic structure of both source and target tokens has not been thoroughly explored to guide accurate alignments, while the similarity of dependencies across diverse languages has not been utilized for producing translation outputs with high-quality and favorable generalization capabilities. Second, they (Garg et al., 2019; Zenkel et al., 2020) typically use multi-task learning architecture to jointly learn the word alignment and translation with elaborately designed loss functions. However, this is computationally expensive for training and the internal logic between the two subtasks is not well correlated. + +To alleviate mentioned problems, we propose to simultaneously consider the syntactic structure of both source and target tokens. According to the similar dependencies across language pairs, the syntactic graphs of target tokens are first sequentially inferred through introduced Dynamic Graph Convolution Networks. Hierarchical Graph Random Walks are then performed based on the built syntactic graphs at both ends, as well as the initialized multi-scale and trainable "hidden graphs" (Nikolentzos and Vazirgiannis, 2020). We found that by correlating cross-linguistic dependencies without any additional guided loss, word alignment and translation can be more effectively integrated into a unified learning framework, efficiently correlating the internal logic between subtasks while improving the interpretability of the model. + +Our contributions are as follows: (1) We introduce Dynamic Graph Convolution Networks to sequentially infer the syntactic graphs of target tokens and further guide the word alignment learning. (2) Hierarchical Graph Random Walks are further performed to incorporate both local and global structural constraints for producing translation outputs. (3) Results on four language pairs demonstrate that our method is highly effective in such alignment- or translation-related NLP tasks, consistently out + +performing baselines in alignment accuracy and translation quality. + +# 2 Background + +# 2.1 Word Alignment + +A naive way to extract alignments from NMT models is to choose the source token with the maximum accumulated attention weight towards the current target token (Arthur et al., 2016; Hasler et al., 2018): $\gamma(t) = \operatorname*{arg\max}_{i \in \{1, \dots, M\}} \sum_{l=1}^{N} \alpha_{t,i}^l$ , where $i$ is the + +candidate aligned source-side position. For decoding step $t$ in layer $l$ , $\alpha_{t,i}^{l}$ is the attention weight of the $i$ -th position in the source, produced by an average of all the attention heads in Transformer (Vaswani et al., 2017). Although simple to implement, this method fails to obtain satisfactory alignment results (Li et al., 2019; Ding et al., 2019; Chen et al., 2020). In this work, we sufficiently exploit the similarity of dependencies between language pairs, training a novel multi-task learning framework to jointly learn translation and word alignment. + +# 2.2 Neural Machine Translation + +Let $\mathbf{x} = x_{1},\ldots ,x_{M}$ and $\mathbf{y} = y_{1},\ldots ,y_{N}$ be the source and target sentence respectively, neural machine translation models the probability of the target sentence conditioned on the source sentence: $P(\mathbf{y}|\mathbf{x};\theta) = \prod_{i = 1}^{N}P(y_{i}|\mathbf{y}_{< i},\mathbf{x})$ where $\mathbf{y}_{< i}$ is a partial translation from the first to (i-1)-th target tokens. Existing NMT models are generally equipped with the encoder-decoder structure. The encoder encodes the source sentence, while the decoder generates the target sentence through a target-to-source attention mechanism and performs left-to-right autoregressive decoding. In this work, we adopt Transformer (Vaswani et al., 2017) as the baseline to build our method, which is also an encoder-decoder framework while each decoder layer attends to the encoder output with multi-head attention. + +# 3 Approach + +Our work is inspired by the fact that tokens in different languages have similar dependencies under the same semantics. As shown in Figure 1, the dependencies between tokens with the same semantics in the English-German pair are highly similar, while the similarity of dependencies between English and French (Chinese) can also be implicitly captured. + +![](images/31e559c5c18c5e22a342fd3c4caebb0beffc00aff141a58ee8fab5abcb094317.jpg) +Figure 2: The architecture of proposed multi-task learning framework. Supervised learning tasks: word alignment and machine translation. Unsupervised learning task: generation of the target syntactic graph. + +We regard each token as a node, and build the edges according to the corresponding dependencies between each node to form the syntactic graphs of different languages. For instance, there is a dependency between 'you' and 're', and the node 'you' is the 1-hop neighbor of 're' in the built English (syntactic) graph. While there is no explicit dependency between 'Tu' and 'es' and we have to pass through 'naive' to reach 'es' from 'Tu', so the node 'Tu' is treated as the 2-hop neighbor of 'es' in the French (syntactic) graph. + +# 3.1 Multi-task Learning + +Figure 2 shows the overall architecture of proposed multi-task learning framework. We model the joint distribution of the target tokens and the target syntactic graphs by factorizing it into the product of a series conditional distributions. + +$$ +\begin{array}{l} P (\mathbf {y}, \mathbf {y} ^ {s} | \mathbf {x} ^ {s}, \mathbf {x}) = \prod_ {i = 1} ^ {N} P (y _ {i} | \mathbf {y} _ {\leq i} ^ {s}, \mathbf {x} ^ {s}, \mathbf {y} _ {< i}, \mathbf {x}) \\ \times P (y _ {i} ^ {s} | \mathbf {y} _ {< i} ^ {s}, \mathbf {x} ^ {s}, \mathbf {y} _ {< i}, \mathbf {x}), \\ \end{array} +$$ + +where $\mathbf{y}_{2, Romanian-English (ro-en) and French-English (fr-en)3, we followed the experimental setup in (Zenkel et al., 2020) and used the preprocessing scripts from (Zenkel et al., 2019). We also followed + +(Ding et al., 2019) to set the last 1K sentences of the training data before preprocessing as validation set. The Chinese-English training set is from the NIST corpora while the test set is from the v1-testset released by TsinghuaAligner (Liu and Sun, 2015). We learned a joint source and target Byte Pair Encoding (BPE) (Sennrich et al., 2016) with 10K merge operations. + +# 4.2 Settings + +We adopted parsing tools to construct syntactic graphs for the language of the encoder. Both the encoder and the decoder of Transformer have 4 layers of attentions with 4 attention heads each. The embedding size and hidden states are set to 512, while the feed-forward layer has 2,048 cells. The training token-level batch size is 36K. All models were trained in both translation directions and symmetrized with grow-diag (Koehn et al., 2005) using the script from (Zenkel et al., 2019). We aggregated the 1- and 2-hop neighbor of each target token in proposed dynamic graph convolutions for alignment, and performed $\mathcal{P} = \{0,1\}$ -steps random walk with beam size to 4 in the decoding process of translation. Alignment error rate (AER) (Och and Ney, 2000) and BLEU (Papineni et al., 2002) are used for measuring word alignment accuracy and translation quality, respectively. + +# 4.3 Baselines + +We compare our method with two statistical baselines FAST-ALIGN (Dyer et al., 2013) and GIZA++ (Brown et al., 1993). Besides, our proposal (structure-based) is compared to several neural baselines (content-based), and all the baselines induce alignments from attention weights of content-based representation: NAIVE-ATT (Garg et al., 2019), NAIVE-ATT-LA (Garg et al., 2019), NAIVE-ATT-LA (Garg et al., 2019), SD-SMOOTHGRAD (Ding et al., 2019), ADDSGD (Zenkel et al., 2019), SHIFT-ATT (Chen et al., 2020), SHIFT-AET (Chen et al., 2020), BTBA (Zhang and van Genabith, 2021) and MASK-ALIGN (Chen et al., 2021). + +NAIVE-ATT (Garg et al., 2019) induces alignments from cross-attention weights of the best penultimate layer in a vanilla Transformer. + +NAIVE-ATT-LA (Garg et al., 2019) without layer selection induces alignments from attention weights averaged across all layers. + +
MethodFullde-ende-enbidir.fr-enavg.bidir.ro-enavg.bidir.
de→enen→deavg.bidir.fr→enen→fravg.ro→enen→ro
Statistical Methods
FAST-ALIGN (Dyer et al., 2013)Yes28.530.429.525.716.317.116.712.133.636.835.231.8
GIZA++ (Brown et al., 1993)Yes18.819.619.217.87.17.27.26.127.428.728.126.0
Neural Methods (Content-based)
NAIVE-ATT (Garg et al., 2019)No33.336.534.928.127.523.625.616.033.635.134.430.9
NAIVE-ATT-LA (Garg et al., 2019)No40.950.845.939.832.429.831.121.237.535.536.532.7
SD-SMOOTHGRAD (Ding et al., 2019)No36.443.039.729.025.929.727.815.341.241.441.332.7
ADDSGD (Zenkel et al., 2019)No26.630.428.521.220.523.822.210.032.334.833.627.6
SHIFT-ATT (Chen et al., 2020)No20.925.723.317.917.116.116.66.627.426.026.723.9
SHIFT-AET (Chen et al., 2020)No15.819.217.515.49.910.510.24.722.723.623.221.2
BTBA (Zhang and van Genabith, 2021)Yes30.332.331.317.814.920.217.69.533.038.635.822.9
MASK-ALIGN (Chen et al., 2021)Yes---14.4---4.4---19.5
Our Neural Method (Structure-based)
OursNo16.318.117.213.79.29.79.54.121.923.822.918.8
+ +SD-SMOOTHGRAD (Ding et al., 2019) induces alignments from token saliency. + +ADDSGD (Zenkel et al., 2019) explicitly adds an extra attention layer on top of Transformer to predict the to-be-aligned target token. + +SHIFT-ATT (Chen et al., 2020) induces alignments when the to-be-aligned target token is the decoder input instead of the output. + +SHIFT-AET (Chen et al., 2020) extracts alignments from an additional module with supervision from symmetrized SHIFT-ATT alignments. + +BTBA (Zhang and van Genabith, 2021) predicts the current target token by paying attention to the source context and both left-side and right-side target context to produce target-to-source alignment. + +MASK-ALIGN (Chen et al., 2021) extracts alignments from introduced leaky attention and trains with the masked language model fashion. + +# 4.4 Alignment Results + +Comparison with Baselines Table 1 compares the alignment results of our method with all the baselines. Our approach significantly outperforms both statistical and neural baselines. Specifically, it improves over GIZA++ by 2.0-7.2 AER points across different language pairs, demonstrating that building a neural aligner is better than statistical aligners. When compared with neural baselines either using guided training or without guidance, we find our proposal still achieves substantial improvements over all methods. For instance, it improves over SHIFT-AET and MASK-ALIGN by 2.4 and 0.7 individually AER points on the Romanian-English pair, indicating that the incorporation of syntactic structure achieves superior alignment results + +Table 1: AER on the test set. The column Full denotes whether full target sentence is used to extract alignments at test time. avg. are the averaged AER scores of both language directions for each language pair, and bidir. are symmetrized alignment results. The lower AER, the better. We mark best results among all with boldface. + +
Methodzh→enen→zhbidir.
SHIFT-ATT28.127.320.2
SHIFT-AET20.122.017.2
MASK-ALIGN--13.8
Ours18.921.213.5
+ +Table 2: AER on the test set of zh-en. + +compared to these that rely only on the content of inputs. + +Besides, we also evaluate our proposal on Chinese-English pair and compare other methods in Table 2. The experimental results are highly consistent with the observations on other language pairs, demonstrating the effectiveness of alignment based on modeling dependencies and capturing structural similarities for distant language pairs. + +Ablation Study Table 3 shows the ablation results on two language pairs. Our approach achieves a gain of 23.8 and 14.6 AER points with fewer parameters compared to vanilla Transformer. When considering the introduced Dynamic Graph Convolution Networks, the aggregated 1-hop neighbor can only capture the local structure, and thus the alignment accuracy is limited. In contrast, aggregating all the 1-, 2-, and 3-hop neighbor for each target node, while better capturing the global dependency, brings with it an increase of parameters and the possible introduction of noisy nodes. We finally achieve the trade-off between performance and parameter size by aggregating both the 1- and 2-hop neighbor. Notably, the accuracy of alignment slightly decreases when we remove the translation task, showing the effectiveness of our multi-task learning framework. + +![](images/1c090cfa6064adcf53ae4a3aa9cffb96c7d1b03232a60b2cc1ee311ee0868e5a.jpg) +Figure 6: (a) Attention weights from different models, and visualizations of the local connection structure for important target tokens inferred by our method. Gold alignment is shown in Reference. $S$ : Source tokens, $T$ : Target tokens. (b) Attention weights for a symmetrized alignment example from ro-en test set. Besides, visualizations of syntactic graphs which built from the source sentence and inferred from the target sentence are given. + +![](images/a7b978a6be6a05646ff37a86d2941512f232e0e03ffd36235e583a15f82efb29.jpg) + +
Methodfr-enro-en# param.
Vanilla Transformer27.933.436.8M
Ours(1-hop)7.625.831.9M
Ours(1,2,3-hop)4.419.333.2M
Ours (w/o translation)4.319.528.5M
Ours(1,2-hop)4.118.832.7M
+ +Table 3: We report the symmetrized AER on the test set. We treat vanilla Transformer (Vaswani et al., 2017) as the baseline, and $\mathrm{Ours}_{(1,2,3 - hop)}$ indicate that the introduced graph convolutions aggregate representation from all the 1-, 2-, and 3-hop neighbor. Ours (w/o translation) denotes that we remove the translation branch and only perform the training and test of word alignment. + +Case Study Figure 6(a) shows the attention weights from three different models for a symmetrized alignment example from de-en test set. In this example, SHIFT-ATT puts high weights wrongly on "1968" when predicting the target token "tokyo", while MASK-ALIGN fails to resolve ambiguity when predicting the target token "in". In contrast, our approach produces the attention weights based on structural matching of source and target tokens, which are highly consistent with the gold alignment. Furthermore, we visualize the complete syntactic structure inferred by introduced DGCN in Figure 6(b), which could explicitly reflect the dependencies between each target token. + +# 4.5 Translation Results + +Comparison with Baselines Table 4 shows the comparison of translation quality and the corresponding decoding speed. Although this work has improved the performance of word alignment, our + +experiments show that the benefits from the representation of syntactic structure also extend to the translation task. Compared with (Marcheggiani et al., 2018) that only utilize syntactic structure at the encoder side, we substantially improve the performance by incorporating syntactic structure at the decoder side. + +Ablation Study To investigate the effectiveness of introduced Hierarchical Graph Random Walks, we further conducted ablation experiments from two perspectives: the number of steps for random walk and the beam size for decoding. Table 4 shows the comparison results. It can be inferred that increasing the step length (e.g., $p = 2$ ) can improve the capability of "hidden graphs" to better capture the global structure. However, continuing to increase the step (e.g., $p = 3$ ) length will not always improve the performance, since it not only introduces more parameters, but also is likely to confuse the model by the complicated closed-loop structure which is prevalent in the graph network. Moreover, increasing the beam size does not bring sustainable gains, but it inevitably decreases the speed of decoding. Notably, the quality of translation significantly decreases when we remove the alignment branch, suggesting that the internal logic of both tasks are tightly correlated by exploiting the dependencies between language pairs for multi-task learning. + +# 5 Related Works + +Our work is closely related to unsupervised neural word alignment. While early unsupervised neural aligners failed to outperform their statistical counterparts such as FAST-ALIGN (Dyer et al., + +
Methodde→enen→defr→enen→frro→enen→roavg.speed (tokens/sec)
vanilla Transformer (Vaswani et al., 2017)25.121.722.921.425.317.970.1
CNN + GCN (Marcheggiani et al., 2018)23.420.320.720.123.816.486.5
BiRNN + GCN (Marcheggiani et al., 2018)23.920.621.220.524.317.082.3
Ours(p=1,beam=4)25.722.724.222.326.218.968.2
Ours(p=2,beam=4)25.522.624.222.426.218.566.7
Ours(p=3,beam=4)25.922.723.622.025.818.866.3
Ours(p=1,beam=3)25.522.423.922.026.118.668.9
Ours(p=1,beam=5)25.722.524.022.226.318.366.5
Ours(p=1,beam=4) (w/o alignment)25.522.123.421.725.518.376.7
+ +Table 4: Comparison of BLEU scores and the averaged decoding speed tested on test sets of three language pairs. $p$ refers that a $p$ -step random walk is performed during the decoding process, while beam is the beam size. + +2013) and GIZA++ (Och and Ney, 2003), a lot of latest works (Li et al., 2019; Garg et al., 2019; Zenkel et al., 2019, 2020) have made significant progress by inducing unsupervised neural aligners from NMT to produce better word alignments. Significantly, BTBA (Zhang and van Genabith, 2021) and MASK-ALIGN (Chen et al., 2021) leverage the both side content information of the decoder, sacrificing the ability of translation. + +Our work is also related to syntax-based or Transformer based neural machine translation models which have shown large advantages on a myriad of datasets. (Bastings et al., 2017) incorporated syntactic structure into the encoder of NMT model and proposed syntactic GCNs. (Marcheggiani et al., 2018) refined the above work to inject a semantic bias into sentence encoders. Transformer based NMT models (Vaswani et al., 2017; Hasler et al., 2018) attribute their superior performance to the multi-layer and multi-head self-attention architecture. (Garg et al., 2019) trained the Transformer to jointly learn word alignment and translation through multi-task learning based on existing token aligners such as GIZA++ (Och and Ney, 2003). Our work differs from prior studies in that we simultaneously incorporate the syntactic structure into both encoder and decoder to tightly correlate the internal logic of word alignment and machine translation for multi-task learning. To the best of our knowledge, this is the first work that incorporates syntactic structure based constraints into the decoder of NMT models. + +# 6 Conclusion + +We propose a multi-task learning framework that tightly correlates the internal logic of word alignment and machine translation, by fully exploits the syntactic structure of both source and target tokens + +and the similarity of dependencies at both ends. Experiments show that our proposal achieves the new State-of-the-Art results among all neural methods in word alignment, while producing high-quality translations. We leave it for future work to extend our study to more downstream tasks and systems in natural language processing. + +# Acknowledgements + +This work was supported by NSFC project Grant No. U1833101, SZSTI Grant No. JCYJ20190809172201639, SZSTI Grant No. WDZC20200820200655001, and Alibaba DAMO Academy. + +# References + +Philip Arthur, Graham Neubig, and Satoshi Nakamura. 2016. Incorporating discrete translation lexicons into neural machine translation. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 1557-1567, Austin, Texas. Association for Computational Linguistics. +Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. 2015. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473. +Jasmijn Bastings, Ivan Titov, Wilker Aziz, Diego Marcheggiani, and Khalil Sima'an. 2017. Graph convolutional encoders for syntax-aware neural machine translation. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 1957-1967, Copenhagen, Denmark. Association for Computational Linguistics. +Peter F. Brown, Stephen A. Della Pietra, Vincent J. Della Pietra, and Robert L. Mercer. 1993. The mathematics of statistical machine translation: Parameter estimation. Computational Linguistics, 19(2):263-311. + +Chi Chen, Maosong Sun, and Yang Liu. 2021. Mask align: Self-supervised neural word alignment. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 4781-4791, Online. Association for Computational Linguistics. +Yun Chen, Yang Liu, Guanhua Chen, Xin Jiang, and Qun Liu. 2020. Accurate word alignment induction from neural machine translation. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 566-576, Online. Association for Computational Linguistics. +Shuoyang Ding, Hainan Xu, and Philipp Koehn. 2019. Saliency-driven word alignment interpretation for neural machine translation. In Proceedings of the Fourth Conference on Machine Translation (Volume 1: Research Papers), pages 1-12, Florence, Italy. Association for Computational Linguistics. +Georgiana Dinu, Prashant Mathur, Marcello Federico, and Yaser Al-Onaizan. 2019. Training neural machine translation to apply terminology constraints. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 3063-3068, Florence, Italy. Association for Computational Linguistics. +Chris Dyer, Victor Chahuneau, and Noah A. Smith. 2013. A simple, fast, and effective reparameterization of IBM model 2. In Proceedings of the 2013 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 644-648, Atlanta, Georgia. Association for Computational Linguistics. +Sarthak Garg, Stephan Peitz, Udhyakumar Nallasamy, and Matthias Paulik. 2019. Jointly learning to align and translate with transformer models. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 4453-4462, Hong Kong, China. Association for Computational Linguistics. +Eva Hasler, Adrià de Gispert, Gonzalo Iglesias, and Bill Byrne. 2018. Neural machine translation decoding with terminology constraints. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers), pages 506-512, New Orleans, Louisiana. Association for Computational Linguistics. +Thomas N Kipf and Max Welling. 2016. Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907. +Philipp Koehn, Amittai Axelrod, Alexandra Birch Mayne, Chris Callison-Burch, Miles Osborne, and David Talbot. 2005. Edinburgh + +system description for the 2005 IWSLT speech translation evaluation. In Proceedings of the Second International Workshop on Spoken Language Translation, Pittsburgh, Pennsylvania, USA. +Xintong Li, Guanlin Li, Lemao Liu, Max Meng, and Shuming Shi. 2019. On the word alignment from neural machine translation. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 1293-1303, Florence, Italy. Association for Computational Linguistics. +Yang Liu and Maosong Sun. 2015. Contrastive unsupervised word alignment with non-local features. In Twenty-Ninth AAAI Conference on Artificial Intelligence. +Diego Marcheggiani, Jasmijn Bastings, and Ivan Titov. 2018. Exploiting semantics in neural machine translation with graph convolutional networks. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers), pages 486-492, New Orleans, Louisiana. Association for Computational Linguistics. +Giannis Nikolentzos and Michalis Vazirgiannis. 2020. Random walk graph neural networks. Advances in Neural Information Processing Systems, 33:16211-16222. +Franz Josef Och and Hermann Ney. 2000. Improved statistical alignment models. In Proceedings of the 38th Annual Meeting of the Association for Computational Linguistics, pages 440-447, Hong Kong. Association for Computational Linguistics. +Franz Josef Och and Hermann Ney. 2003. A systematic comparison of various statistical alignment models. Computational Linguistics, 29(1):19-51. +Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. 2002. Bleu: a method for automatic evaluation of machine translation. In Proceedings of the 40th Annual Meeting of the Association for Computational Linguistics, pages 311-318, Philadelphia, Pennsylvania, USA. Association for Computational Linguistics. +Rico Sennrich, Barry Haddow, and Alexandra Birch. 2016. Neural machine translation of rare words with subword units. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1715-1725, Berlin, Germany. Association for Computational Linguistics. +Kai Song, Yue Zhang, Heng Yu, Weihua Luo, Kun Wang, and Min Zhang. 2019. Code-switching for enhancing NMT with pre-specified translation. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 449-459, + +Minneapolis, Minnesota. Association for Computational Linguistics. + +Ilya Sutskever, Oriol Vinyals, and Quoc V Le. 2014. Sequence to sequence learning with neural networks. In Advances in neural information processing systems, pages 3104-3112. + +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In Advances in neural information processing systems, pages 5998-6008. + +Petar Velicković, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua Bengio. 2017. Graph attention networks. arXiv preprint arXiv:1710.10903. + +Rongxiang Weng, Hao Zhou, Shujian Huang, Lei Li, Yifan Xia, and Jiajun Chen. 2019. Correct-and-memorize: Learning to translate from interactive revisions. arXiv preprint arXiv:1907.03468. + +Thomas Zenkel, Joern Wuebker, and John DeNero. 2019. Adding interpretable attention to neural translation models improves word alignment. arXiv preprint arXiv:1901.11359. + +Thomas Zenkel, Joern Wuebker, and John DeNero. 2020. End-to-end neural word alignment outperforms GIZA++. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 1605-1617, Online. Association for Computational Linguistics. + +Jingyi Zhang and Josef van Genabith. 2021. A bidirectional transformer based alignment model for unsupervised word alignment. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 283-292, Online. Association for Computational Linguistics. + +# A Detailed Network Architecture of $f_{M}$ + +For each observed token from the target side, we learn a soft mask $M$ to predict its dependency with other observed tokens by a light-weight network: + +$$ +\bar {h} _ {d} = M _ {e a n} P _ {o o l i n g} (\bar {H} _ {d} + A _ {s} \cdot H _ {e}), +$$ + +$$ +\hat {M} = (\bar {H} _ {d} \cdot W _ {d}) \otimes \bar {h} _ {d}, +$$ + +$$ +M = \operatorname {S i g m o i d} \left(M _ {\text {a x}} P _ {\text {o o l i n g}} (\hat {M})\right), +$$ + +where $\otimes$ denotes the element-wise multiplication, and $W_{d}$ is a trainable matrix. + +# B Translation Results + +Case Study We provide the translation results among different variants of our proposal in Figure 7. + +S Damit ist unsere Aussprache über den Stand der Europäischen Union geschlossen. +T (1) w/o random walk + +Our European Union state debate on the is concluded . +(2) random walk only in decoder + +This concludes our debate on the the European Union state. +(3) Ours (random walk in encoder + decoder) + +This concludes our debate on the state of the European Union. + +$R$ The debate on the state of the European Union is closed. + +Figure 7: Translation outputs generated by our methods. $S$ : Source sentence, $T$ : Translation output, $R$ : Ground-truth translation. (1) No graph-based random walk is performed for translation task. (2) Graph-based random walk is performed only on the inferred syntactic graphs of the decoder. (3) Graph-based random walks are performed on the syntactic graphs of both the encoder and the decoder. \ No newline at end of file diff --git a/structuralsupervisionforwordalignmentandmachinetranslation/images.zip b/structuralsupervisionforwordalignmentandmachinetranslation/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..c2cabbb906db0b785de8934e210b2c01ce4fd852 --- /dev/null +++ b/structuralsupervisionforwordalignmentandmachinetranslation/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:30702ec8ec34d473089225e0ed903850b481af6268788448b5c4beb751e6cf85 +size 624818 diff --git a/structuralsupervisionforwordalignmentandmachinetranslation/layout.json b/structuralsupervisionforwordalignmentandmachinetranslation/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..bfeed3f2420da0bc56744b9442909686a937b045 --- /dev/null +++ b/structuralsupervisionforwordalignmentandmachinetranslation/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cdc771aa3d11d2238c1ce06c10e0d6e83c89f6c74e911a66e3627080a373202d +size 392696 diff --git a/suumcuiquestudyingbiasintaboodetectionwithacommunityperspective/3fe8226b-6c00-446f-bb0c-5c0ca64b21c7_content_list.json b/suumcuiquestudyingbiasintaboodetectionwithacommunityperspective/3fe8226b-6c00-446f-bb0c-5c0ca64b21c7_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..932abc389ff0cd2eb49ed02a11ca1430da4de25d --- /dev/null +++ b/suumcuiquestudyingbiasintaboodetectionwithacommunityperspective/3fe8226b-6c00-446f-bb0c-5c0ca64b21c7_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b64a5b983ef8d7d5b144627e5903f553aa1d6445f42b91165829063bb61d1c11 +size 85574 diff --git a/suumcuiquestudyingbiasintaboodetectionwithacommunityperspective/3fe8226b-6c00-446f-bb0c-5c0ca64b21c7_model.json b/suumcuiquestudyingbiasintaboodetectionwithacommunityperspective/3fe8226b-6c00-446f-bb0c-5c0ca64b21c7_model.json new file mode 100644 index 0000000000000000000000000000000000000000..74756765bff2b2ee1aebf1f9a8e100cfd80b5a3e --- /dev/null +++ b/suumcuiquestudyingbiasintaboodetectionwithacommunityperspective/3fe8226b-6c00-446f-bb0c-5c0ca64b21c7_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3780ccb6a99e3c05398a0a365c8c5b1088b2057cc551b4c7e1dcdd42138d72a1 +size 104447 diff --git a/suumcuiquestudyingbiasintaboodetectionwithacommunityperspective/3fe8226b-6c00-446f-bb0c-5c0ca64b21c7_origin.pdf b/suumcuiquestudyingbiasintaboodetectionwithacommunityperspective/3fe8226b-6c00-446f-bb0c-5c0ca64b21c7_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..3d508d890852399361c4097e6839bad7c7dcdc05 --- /dev/null +++ b/suumcuiquestudyingbiasintaboodetectionwithacommunityperspective/3fe8226b-6c00-446f-bb0c-5c0ca64b21c7_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6ffda3d6335f4190a3217b55b723bb4a6b17d04535e91f88216dcf815484602e +size 605700 diff --git a/suumcuiquestudyingbiasintaboodetectionwithacommunityperspective/full.md b/suumcuiquestudyingbiasintaboodetectionwithacommunityperspective/full.md new file mode 100644 index 0000000000000000000000000000000000000000..887712a1a98a0aa825f7f93ca236b1c35e2f8556 --- /dev/null +++ b/suumcuiquestudyingbiasintaboodetectionwithacommunityperspective/full.md @@ -0,0 +1,307 @@ +# Suum Cuique: Studying Bias in Taboo Detection with a Community Perspective* + +Osama Khalid†, Jonathan Rusert†, Padmini Srinivasan + +University of Iowa + +{osama-khalid, jonathan-rusert, padmini-srinivasan}@uiowa.edu + +# Abstract + +Prior research has discussed and illustrated the need to consider linguistic norms at the community level when studying taboo (hateful/offensive/toxic etc.) language. However, a methodology for doing so, that is firmly founded on community language norms is still largely absent. This can lead both to biases in taboo text classification and limitations in our understanding of the causes of bias. We propose a method to study bias in taboo classification and annotation where a community perspective is front and center. This is accomplished by using special classifiers tuned for each community's language. In essence, these classifiers represent community level language norms. We use these to study bias and find, for example, biases are largest against African Americans (7/10 datasets and all 3 classifiers examined). In contrast to previous papers we also study other communities and find, for example, strong biases against South Asians. In a small scale user study we illustrate our key idea which is that common utterances, i.e., those with high alignment scores with a community (community classifier confidence scores) are unlikely to be regarded taboo. Annotators who are community members contradict taboo classification decisions and annotations in a majority of instances. This paper is a significant step toward reducing false positive taboo decisions that over time harm minority communities. + +$\star$ This paper examines taboo language as a case study. The reader is cautioned that the paper contains strong language. + +† Equal Contribution. + +# 1 Introduction + +Members of a community rely on a shared language for communication, one which evolves naturally, in situ, and is shaped by the norms and mores of the community (Gumperz, 1968). Norms promote Entitativity, the perception of group identity (Allan and Burridge, 2006). Norms may be explicit and codified into law or so subtle that while members + +may be unable to specify them they can still recognize violations (Chandrasekharan et al., 2018). Utterances violating these norms may be considered taboo from that community's perspective. $^{1}$ + +Communities often self-regulate by censuring norm violating taboo language (Allan and Burridge, 2006). This censuring may be subtle such as ignoring taboo utterances leaving the individual somewhat isolated and ineffective. Self-regulation could also be explicit and even severe such as expulsion from the community. + +Taboos are community-specific: Perceptions of taboos in language use are influenced by community (Allan and Burridge, 2006). Utterances that are benign in one community might be taboo in another $^{2}$ . E.g., 'autistic' is considered derogatory on most of reddit, its use usually leads to censure. However, on the subreddit /r/wallstreetbets, it is not and is instead used as a self-descriptor by members. The importance of considering the author's community when studying taboo is emphasized in a recent critical survey of bias in NLP papers (Blodgett et al., 2020); it urges us to understand how social hierarchy relates to language use. Our research is a step in this direction. + +Taboo utterance detection and biases: Several papers especially from OffensEval (Zampieri et al., 2019b, 2020) have led to the development of state of the art taboo classifiers for moderating online speech. Alongside, an active research stream studies the presence of bias in taboo detection. Biases, specifically having higher false positive rates for a minority community compared to the majority, have been detected particularly against African Americans and also to some extent women (Dixon et al., 2018; Zhou et al., 2021; Bolukbasi et al., 2016; Xia et al., 2020; Chuang et al., 2021). Bias + +is clearly harmful as penalties over false positives could over time discourage/constrain minority participation on social media platforms, and in turn reinforce the majority's norms and values. + +Limitations in bias assessment research: A limitation is that community language norms are rarely considered. While recent research on taboo detection discuss and illustrate the importance of community perspective (Davidson et al., 2017; Sap et al., 2019; Badjatiya et al., 2019) we do not yet have bias detection methods that are firmly founded on community language norms. This methodological gap underlies not only the design of state-of-the-art taboo detection tools but perhaps more crucially even in the methodologies for the study of bias in taboo detection. Not only are the taboo annotated datasets largely devoid of community, culture or social contexts (i.e., characterization) (Zampieri et al., 2019b, 2020), the study of bias itself needs strengthening with methods wherein a community perspective stays front and center, consistent with the urging in the survey (Blodgett et al., 2020). + +# Contributions: + +1. We propose a new method that is firmly grounded on community-specific language norms for studying bias in taboo detection. +2. We use our method to assess bias against five minority communities in three taboo text classifiers and ten taboo annotated datasets. In contrast, prior research has largely about bias against the African American community, possibly due to reliance on two race estimated/labelled datasets (Blodgett et al., 2016; Preotjiuc-Pietro and Ungar, 2018). +3. We find, for example, that all three taboo classifiers are biased against the African American community. Additionally, 2 classifiers are biased against the South Asian communities and one against Hispanics. Overall, only 3 of the 15 classifier - community combinations tested were somewhat unbiased. +4. Eight out of 10 taboo annotated test sets are strongly biased against African Americans, while at least 3 are biased against South Asians. We did not find any remarkable dataset biases against Hispanics but we found single instances of bias against Native American and Hawaiian communities. + +# 2 Community Centered Approach for Studying Bias + +We build community-specific classification models (CLCs) which capture the community's language. + +We use these to compute text alignment scores for assessing bias. A text alignment score is the classifier's confidence in deciding if the text has been generated by a member of the community or not. Higher confidence scores imply greater alignment with the language norm's of the community. + +Our intuition is as follows. Given moderation and self-regulation in communities we expect taboo utterances to be infrequent in a community's discourse. Such utterances will thus have low alignment scores when classified by a model trained on the community's language. However, since new topics of interest will also result in low-frequency utterances we view low alignment scores with a community model as necessary but insufficient for an utterance to be considered taboo from that community's perspective. Crucially, utterances with high alignment scores adhere to the norms and therefore should not be considered taboo. Reference classifier models allow us to estimate the extent of alignment with community language norms. + +Two points to note. We do not attempt to separate style from topic in the utterances since it is often in their interplay that taboo is decided. For example, "happy birthday to a bad bitch" and "Fuck off, you are a little bitch." have somewhat related styles but different topics. Our 'contextual' community-language classification models estimate scores for full utterances. Second, while we study race/ethnicity based communities, our approach can be applied to communities defined broadly, using other criteria such as professional communities and internet subcultures. Specific details for measuring bias are given next. + +Measuring bias in taboo classifiers: We assess the extent of taboo classifier bias against a community by computing Pearson correlation between the taboo classifier confidence scores and community classifier confidence scores. We do this with instances that the former classifier declares as taboo. Ideally, we expect a negative correlation - higher taboo classifier confidence mapping to lower community alignment scores and vice versa. The extent to which correlations deviate from this expectation reflects the extent to which the classifier does not consider the norms of the community. + +Measuring bias in taboo datasets: Given a dataset, we compute the proportion of taboo labelled texts that are highly aligned with each community classifier model. We expect these proportions to be tending towards zero since high align- + +
CommunityNo. of SubredditsTraining set sizeValidation set size
NA244k1.4k
HI495k6k
HA180k2k
SA1101k6k
AA1170k5k
+ +Table 1: Dataset details for each community. + +ment means common utterance and thus within the norms. A second point to note is that if these proportions are uneven across communities then the bias is more against those with larger proportions. This is consistent with the theory that all communities engage in similar norms of communication (Mills, 2009). Specifically, we measure the mean and standard deviations (SD) of proportion of aligned comments. In sum, if the proportions are not close to zero this indicates bias. Additionally, if the proportions are not even then bias is targeting some communities more than others. + +# 3 Community Language Classifiers + +# 3.1 Model Construction + +We build our community classification models using BERT (Devlin et al., 2019) $^3$ . Experiments using XLNet (Yang et al., 2019) gave comparable results. Thus, we only report BERT results. BERT is a transformer-based model which has shown to perform well in NLP based tasks (Devlin et al., 2019; Kaliyar, 2020). BERT leverages context (on top of words) $^4$ . We fine-tune BERT-base-uncased with a linear layer on top. A softmax function is used to make a binary classification as to whether or not the input text belongs to the community. Each community has its own classifier representing its language norms. + +We build our models with publicly available data from select subreddit comments obtained using Pushshift (Baumgartner et al., 2020) $^6$ . We group subreddits into communities based on shared cultural/ethnic heritage determined using subreddit + +descriptions (subreddits are listed in appendix A). While we acknowledge that subreddits are not inclusive of all members of communities of interest, they can still be considered as fairly representative in terms of language use. We do not have to be exact about the data used to represent a community as long as we are confident that the collection is mostly produced by its members7. + +We build models for: Native American (NA), Hispanic (HI), Hawaii (HA), South Asian $^{8}$ (SA), and African American (AA) communities. We obtained comments from 2018 using the first 11 months as training data for the models and the last as validation. As the data for NA was smaller than the rest, we added 2015, 2016, and 2017 data again with the first 11 months for each year as training and last 1 month for validation. Comments were lowercased and stripped of punctuations. + +Since subreddit sizes vary, the amount of data collected for each community varies as well. HI, HA, SA, and AA are the closest in size and NA the smallest. When training a community model we generate negative samples (texts not from the community) by sampling equally from the other communities till we reach a 1:1 ratio of positive to negative text samples. A summary of the datasets is in Table 1. Note that the training set size indicated includes both positive and negatives examples (at a 1:1 ratio) while the validation sets only contain positive (aligned) examples. + +# 3.2 Model Characteristics + +Figure 1 presents the complementary cumulative distribution function (CCDF) of alignment scores (classifier confidence scores) for the CLCs using validation data. For example, $62.9\%$ and $66.2\%$ of the HA and the HI texts have scores $\geq 0.7$ . All CCDFs follow a similar distributional pattern. We introduce a threshold on alignment scores to decide which texts are 'highly aligned' with a model. Higher thresholds imply fewer comments will be regarded as following the community's norms. We choose 0.85 as a threshold since at least $52\%$ of the comments for each community are then regarded as highly aligned (range: $52\% - 64\%$ ). When we reduce the threshold to 0.65, two-thirds of the comments are highly aligned. But this increases the + +![](images/45aa30db587e38e7b8e099bd4c0442c06fe314858816801a52bdf99ffbbf98ab.jpg) +Figure 1: Complementary cumulative distribution function of community-language alignment scores for the five community models using the community specific validation datasets. An alignment score indicates the proportion of the community's comments that the model classifies as belonging to that community within a given threshold. The dotted/dotted-dashed lines (0.7, 0.9) show the proportion of comments at those thresholds. The dashed line (0.85) indicates the chosen threshold for our experiments. + +risk of overlap across communities in their highly aligned comments. Taking the SA CLC model as an example in Figure 2, we can see that with 0.85 cutoff, $60.7\%$ of comments from the South Asian community are highly aligned, while including no more than $14\%$ (range: $2\% - 14\%$ ) of comments from the other communities. While not strictly comparable, our 0.85 threshold is more conservative than the 0.80 used in Blodgett et al. (2016). + +# 3.3 Model Validation + +Results with our validation datasets (shown in Table 1) are in Table 2 with cell values representing proportions. For example, $51.8\%$ of the NA validation set is highly aligned (alignment score $\geq 0.85$ ) with its own community model. Column values do not necessarily add up to $100\%$ as a text may be highly aligned to more than one community model or even to none. + +As expected, proportions at the diagonal representing homogenous model - dataset combinations are high, ranging from 52 to $64\%$ . Also as expected, the off-diagonal entries representing heterogeneous combinations, are low. Most are less than $10\%$ and more than half less than $6\%$ . The three noticeable exceptions are between AA and SA and also between NA texts and the HA model. The sociological literature observes linguistic exchanges between minority communities (Bucholtz, 1999; Coleman, 1998; Igoudin, 2011; Lee, 2011). For example, (Shrikant, 2015) discuss a tendency of South Asians to adopt the features of African + +![](images/4ff1a594fbaeacfe5dac8c08b274160534589a89e496f2ecbff872106ccc64b8.jpg) +Figure 2: Complementary cumulative distribution function of alignment scores for all five minority community validation sets as gauged against the South Asian community's CLC. + +American Vernacular English (AAVE). This is particularly relevant to the AA and SA overlaps. Next we use these validated models to estimate bias in classifiers and in datasets. + +
Reddit Validation Sets
CLCNAHIHASAAA
NA51.81.84.51.82.2
HI4.358.22.12.32.2
HA15.16.258.15.16.9
SA6.15.25.860.720.7
AA9.87.18.114.464.0
+ +Table 2: Proportion of each validation set that is highly aligned with each CLC. An alignment score threshold of 0.85 is used to determine high alignment. A text may be aligned with 0 or more models, so column numbers need not sum to 100. + +# 4 Experiments and Results + +# 4.1 Taboo Classifier Bias Assessment + +We test 3 SOTA offensive language classifiers: + +NULI (Liu et al., 2019): A BERT (Devlin et al., 2019) based system trained on offensive language (OLID (Zampieri et al., 2019a)). It was the top-ranked system in OffensEval (Zampieri et al., 2019b). + +- **MIDAS (Mahata et al., 2019):** An ensemble of three deep learning models: a BLSTM, a BLSTM fed into a BGRU, and a CNN all three trained on offensive language. This system was the top non-BERT based system at OffensEval. + +Perspective (Perspective): An API provided by Google, which when given text, returns a toxicity score. The current model in production uses a CNN trained with fine-tuned GloVe word embeddings. + +We trained MIDAS and NULI on the OLID training data which is consistent with their training for + +![](images/d8eaf3e04927ee49ce5c8c087ad5075c43a674df889beac75d1d14a16674cb94.jpg) +Figure 3: Correlations of taboo classifier scores with community-language classifier scores. Error bars: $95\%$ confidence intervals. + +OffensEval. Our implementations perform within $1\%$ of the published results. We then applied the classifiers to the validation datasets listed in Table 1. Correlations between classifier confidence (for Perspective we use its toxicity score) and language model alignment scores were analyzed. + +# 4.2 Taboo Classifier Bias Results + +Classifiers' correlations show bias. Figure 3 shows the correlations with community models for the five communities for different taboo classifiers with $95\%$ confidence intervals computed using 10,000 bootstrapped samples. Instead of strong negative correlations, which would indicate no bias, we see several instances of positive or near zero correlations across community models and classifiers. Zero correlations while better than positive are still not ideal, since they indicate that the taboo classifier is not taking community alignment into account. + +NULI is relatively less biased than Perspective or MIDAS. These correlations indicate that the taboo speech classifiers largely do not consider the language norms of the community. + +Taboo classifiers have highest bias against the African American community. All three taboo classifiers tested show higher positive correlations for AA compared with other communities. This disagreement with the AA community model reflects bias in the classifiers, an observation that is consistent with those made in prior literature (Davidson et al., 2019; Sap et al., 2019). + +Perspective shows highest bias. On average, Perspective, is the least in accordance - having the most positive correlations - with the CLC models. When compared with MIDAS and NULI, the only community model for which Perspective has + +
DatasetLabelsSizesPrior Work
Davidson (2017)Offense Hate20716 1537Sap (2019) Davidson (2019)
OLID (2019a)Offense4640None
SOLID (2020)Offense3002None
Gab (2018)Hate2337Jin (2020)
Founta (2018)Hate Abuse27150 4965Sap (2019)
Wiki Toxic9Toxic Hate15295 1405Vaidya (2020)
Waseem (2016)Sexist2673Davidson (2019)
+ +Table 3: Details of examined datasets. Samples of prior work which also examined these sets for bias are indicated in the final column. + +a lower bias is HA. This is particularly concerning as Perspective is publicly available and has already been deployed to monitor comment sections (Delgado, 2019; Etim, 2019). + +# 4.3 Dataset Bias Assessments and Results + +We generate ten test sets from seven text collections annotated for taboo. A test set consists of instances labeled with one taboo label (such as hateful, offensive, sexist etc.). A summary of the datasets can be found in Table 3. + +Table 4 presents bias assessment results. Each row identifies the CLC used to estimate alignment of taboo instances in the column datasets. For example, $14\%$ of the texts labelled as HATE in the Davidson dataset are highly aligned with the Native American model. We remind the reader that we use a community classifier score threshold of 0.85 (see section 3.2). Again column sums need not be 100 as an instance may be highly aligned with 0 or more models. The table also shows average and standard deviation. Cells in bold are more than one standard deviation from the mean. + +As a reminder, for any community we would like the proportion of taboo labeled instances that are highly aligned with that community's language to be close to 0. Additionally, if this is not possible, we check to see if these proportions are unequal across communities. Inequality would indicate that bias is particularly targeted at some communities - those with highest proportions. + +# 4.3.1 Taboo text and model alignments + +Many of the proportions are large indicating bias. When examining Table 4, we find that $64\%$ of the + +
DavidsonGabFountaWiki ToxicWaseem
CLCHATEOFFOLIDSOLIDHateHateAbuseToxicHateSexism
NA14.03.93.41.47.64.43.98.013.35.1
HI5.55.28.33.55.55.46.64.96.33.9
HA4.33.16.35.13.96.04.69.43.44.2
SA4.22.216.35.825.414.55.48.513.013.9
AA20.729.915.230.412.232.622.54.95.345.5
Average9.78.99.99.213.212.68.67.18.314.5
Std. Dev.7.411.85.611.98.711.97.82.14.617.8
+ +Table 4: Proportion of Taboo datasets with high alignment scores for each CLC. Note, a given text may have high alignment with 0 or more communities. Thus column proportions need not sum to 100. + +cells have proportions $>5\%$ . Even with a stronger threshold of $>10\%$ on the proportions, close to a third of the cells still exhibit bias. The least biased - closest proportion to 0, is 1.4 for SOLID gauged against the NA model. The highest is 45.5 for Waseem gauged against the AA model. Examining each dataset, we see that all have large proportions of taboo text that are highly aligned with at least one community; some datasets are biased against two communities. For example, Wiki Toxic - Hate has high proportions when gauged against both NA and SA. When examining averages across datasets Waseem is the most biased (average of 14.5), followed next by Gab. Wiki Toxic - Toxic is the least biased - with the lowest average. Overall, all datasets exhibit biases with proportions that are far from 0. + +# 4.3.2Uneveness of alignment proportions + +Datasets are heavily biased against African Americans. As seen in table 4, six out of the ten datasets have disproportionate high-alignment with the AA CLC model with a seventh (OLID) coming close to crossing the 1 SD mark. The two datasets with lower than average proportions are from the Wiki Toxic collection. The highest proportions are with the Waseem dataset followed by the Founta Hate dataset. Telling too is that the top six in bias have more than $20\%$ of their instances highly aligned with the AA model. This level and consistency of bias against the AA model is remarkable. + +Datasets also biased against South Asians. Next to the AA community, the largest bias is against the SA community. This community takes the top position with Gab Hate; over a fourth of the data is highly aligned with the community (25.4%). Looking down the column this proportion for SA stands out, with the next highest — AA, at 12.2%. In OLID and Wiki Toxic Hate, SA proportions are more than 1 SD from average. SA alignments are lower than average for 5 datasets such as Davidson + +and Founta Abuse. This analysis brings to light that bias is not limited to the AA community, but extends to other communities as well. This is noteworthy as previous works such as (Davidson et al., 2017; Sap et al., 2019) have solely focused on the bias against AA while ignoring others like SA. + +Low bias communities exist. The HI and HA communities face less bias in comparison with AA and SA. In fact, for HI the proportions are lower than average across all datasets. NA has proportions 1 SD higher than average for one dataset: Wiki Toxic - Hate. Otherwise, the alignment proportions are almost always lower than average. + +Results are largely comparable with previous bias results. Comparisons are limited as prior work largely focuses on bias towards AA. We make the following general observations. + +Our results are generally consistent with those of Davidson et al. (2019) and Sap et al. (2019) on the Davidson dataset. E.g., all three find high rates of AA tweets as labelled offensive (between $17\%$ and $46\%$ ). We observe similar agreements for the Founta and Waseem sets. There exists some disagreement, however, where we find the "hate" labeled portion of Davidson and Founta datasets to show bias against AA, while Sap et al. (2019) did not. The reasons for this difference are unclear. However, it is puzzling to note that Sap et al. (2019) found bias against a community for one taboo class (offense) but not another (hate). The authors do not provide an explanation for this. + +Huang et al. (2020) examining the Waseem and Founta datasets for bias against race find BERT to show the least bias compared to CNN and RNN based classifiers. Our results are consistent as the BERT based classifier, NULI, shows lower bias than MIDAS, which is an ensemble of a CNN, and BLSTM/BGRUs. + +Overall, our results indicate that the datasets are largely insensitive to the norms of African Americans (overwhelmingly so) and then to the South + +Asian communities. Subsequently, taboo classifiers built on these datasets are more likely to be biased against these two communities. + +# 4.4 Small scale user study + +We present a small scale user study intended only to illustrate our main hypothesis, that texts highly aligned with a CLC should be less likely to be considered taboo from the perspective of members of that community. A rigorous user study with intra and inter community judgements and many judges is left for future work. + +Classifier bias. Focusing on Figure 3, we selected a mixture of comments from OLID/SOLID and from reddit that had the highest model alignment scores ( $>0.85$ ) with their respective CLCs. We selected 80 comments for AA and 78 for SA, all of which had high taboo classifier confidence scores ( $>0.76$ ) with MIDAS and Perspective, i.e., they contributed the most to the positive correlation bars in the graphs. We asked two African Americans and two South Asians, who were active Reddit users, to judge their respective sets as offense/hate or not. The annotators were selected by word of mouth. Given high alignment we expect annotators to contradict the classifier and judge these as not taboo. + +As expected, both SA annotators disagreed with the classifier assigned taboo labels in 60/78 cases (76.9%) agreeing only in 3/78 comments (3.8%) and giving mixed judgements in the remaining 19% of comments. AA annotators disagreed with the classifiers for 27/80 (33.8%) comments. While non trivial, this percentage is noticeably less than 76.9% for SA. They agreed with the classifier's taboo decision 31/80 times (38.8%) and gave mixed judgements in 25% of cases (more than for AA). Overall, judges contradicted the classifiers 55% of the time. + +Analysis of classifier contradictions. In a majority of the contradictions the classifier did not recognize benign contexts of words such as 'fuck' and 'shit'. E.g., in SA are: "how the fuck are Indians minorities' and 'how is an accent shitty'. From AA: "... drop this fake ass bitch and move on". Annotators did not label these as offensive. + +A second reason for contradictions appears to be because culturally subtle contexts are challenging for classifiers. Both SA annotators marked the comment "this is exactly the reason i don't fuck with Biryani" as non-taboo. The classifier does not + +recognize this as a statement on the authenticity of a food item - 'Biryani', a rice-based South Asian dish. Similarly the AA annotators marked: "I'm so fucking tired of side chick culture" as not taboo. The classifier does not recognize this as a critique of extra-marital intimacy and not an attack on a 'culture'. Note that all these statements have model alignment scores that are very high $(>0.94)$ . + +Dataset Bias. Focusing on OLID (biased against South Asians) and SOLID (biased against African Americans), see table 1, we explore if community consistent judges will contradict dataset annotations. We selected 50 SOLID and 23 OLID tweets annotated in the datasets as taboo and with CLC model alignment score $\geq 0.85$ . + +Both AA annotators contradicted taboo annotations for $66\%$ (30/50) SOLID tweets and agreed with only 9/50 $(18\%)$ . They mutually disagreed on the remaining 11 tweets. Both SA annotators contradicted $83\%$ (19 of 23) of OLID taboo annotations. They mutually disagreed on the remaining 4. Overall $67\%$ of community-specific annotator decisions contradicted taboo annotations. These contradictions are also illustrative of our expectations of 'not taboo' decisions for high alignment posts. + +Analysis of annotation contradictions. AA annotators chose 'not taboo' in several SOLID cases based on context and their norms. E.g., "this bitch just cut her hair short by herself". Perhaps the presence of language likely considered offensive in a more general setting resulted in the taboo label. In another example, the AA annotators contradicted the SOLID taboo label for the tweet "Niggas be so depressed on this lil app ..." We see a similar phenomenon with the SA annotators. For example, they contradicted the taboo label for the tweet "All these sick ass ppl from school gave me something and now I have to chug down this nasty drink so it can go away". + +Additional examples of contradictions by AA and SA annotators are in the appendix (B and C). While a larger user-level study with suitable controls is planned for the future, these preliminary results illustrate our hypothesis that using a community perspective on taboo decisions is important and that this can be achieved using CLC model alignment scores. + +# 4.5 Bias mitigation - initial thoughts + +Our empirical results and case study illustrate a potential approach for bias mitigation. The idea is to include 'reset' strategies for taboo classifiers and for annotations. If an instance that is classified or annotated as taboo has high alignment score with a CLC then a reset strategy is invoked to examine the decision further. This can be manual analysis by a community member knowledgeable of its norms and contexts - a step that can be labour expensive. Alternatively, a downstream algorithm that is more community centric may be invoked - a step that may computationally more expensive. We plan to explore these in future. + +# 5 Related Work + +The study of bias in taboo classifiers is an active area of research (Wiegand et al., 2019; Huang et al., 2020; Blodgett et al., 2020; Park et al., 2018). Since our focus is on bias detection we do not cover areas such as bias mitigation (Tsvetkov, 2020; Chuang et al., 2021) and allied problems such as bias in embedding spaces (Park et al., 2018; Caliskan et al., 2017) and the source of bias (Binns et al., 2017; Waseem, 2016). Instead we focus on bias detection - particularly on their methodologies. Note as most papers combine methods our binning is not intended as mutually exclusive classes. + +Bias detection focused on individual words: Dixon et al. (2018) working with Wikipedia Talk Pages show that toxicity classifiers disproportionately misclassify text with identity terms such as 'gay' and 'muslim' when they appear in benign contexts. A reason for this bias is because of their dominant occurrence in hateful, toxic or otherwise taboo contexts, thereby skewing training datasets. They show this can be countered by augmenting data with benign examples using these identity words. Park et al. (2018), and Kennedy et al. (2018) also study similar biases in the data. Badjatiya et al., (2019) extend this analysis to words in general, finding strings like '@ABC' and 'dirty' stereotypical of hate. The general approach in these papers is to compare classifiers built from skewed and synthetically augmented/corrected non-skewed datasets. In contrast to focusing on specific words, we analyze texts contextually with CLCs. + +Bias detection using an external race/gender labeled dataset: Davidson et al. (2019) examine five datasets including the Davidson and Founta datasets we study. Their strategy is to build a + +classifier (regularized logistic regressor) on each dataset and test them on the Blodgett et al. (2016) black-white-race-aligned dataset. They observed that 'black-aligned' tweets were 1.8 to 2.6 times more likely to be classified as taboo. Using similar methodology, Sap et al. (2019) also found bias against AA in neural network classifiers trained on the Founta and Davidson datasets when tested against the same Blodgett et al. (2016) dataset. + +Using a slightly different approach Kim et al. (2020) trained a classifier on the Blodgett et al. (2016) dataset to identify AA-leaning tweets in the Founta dataset. They found that AA tweets were 3.7 times more likely to be labeled as taboo. Additionally, they also annotated the Founta dataset for gender. They found that AA male-aligned tweets were $77\%$ more likely to be labeled as taboo. In contrast to these works, our approach does not rely on access to race labeled datasets such as the Blodgett et al. (2016) dataset. + +Other approaches: As in Kim et al. (2020), Sap et al. (2019) used classifiers trained on Blodgett et al. (2016) to identify 'black-aligned' tweets in the Founta and Davidson datasets. The difference is that they then computed correlation of probabilities of 'black-aligned' tweets and the taboo language annotations and found these to be strong positive. We also compute Pearson correlations between classifier scores and community alignment scores. But we differ in that we are not relying on the Blodgett et al. (2016) dataset. Instead, we use alignment scores estimated using CLCs. + +While the above works highlight limitations in using a single standard English model they do not propose alternative methods founded on the language norms of specific communities. We address this gap with a community-specific method using CLCs which allows us to study bias for any community. Moreover, unlike the works reviewed, and more recent papers on debiasing strategies (Zhou et al. (2021); Xu et al. (2021)), where the emphasis is on bias against AA, we study bias against five different minority communities. + +# 6 Limitations and Conclusions + +We presented a new methodology for studying bias in taboo text identification. Its strength is that it is centred on community language norms - a strategy consistent with (Blodgett et al., 2020) to consider social hierarchy when studying bias and natural languages. Using it we assessed the extent + +to which biases against five minority communities are present - both in classifier taboo decisions and in dataset taboo annotations. We found many instances of bias with the community most targeted being African Americans. But we also found significant biases against others such as South Asians. Notably, Hispanics seems least affected though there was to some degree classifier bias. + +A small scale 'illustrative' user study provides initial support for our key idea which is that common utterances, i.e., those with high alignment with the community's language classifier, are unlikely to be viewed as taboo from that community's perspective. Annotators who are community members contradicted classifier and annotator decisions in a majority of instances. + +Our work is limited to analyzing communities defined by race and ethnicity, but is generalizable; we will explore bias against other communities in future research. We also plan to conduct a large-scale user study to better understand community perspective for taboo texts. We plan to investigate the bias mitigation strategies shown in section 4.5. + +# References + +Keith Allan and Kate Burridge. 2006. *Forbidden words: Taboo and the censoring of language*. Cambridge University Press. +Pinkesh Badjatiya, Manish Gupta, and Vasudeva Varma. 2019. Stereotypical bias removal for hate speech detection task using knowledge-based generalizations. In The World Wide Web Conference, pages 49-59. +Jason Baumgartner, Savvas Zannettou, Brian Keegan, Megan Squire, and Jeremy Blackburn. 2020. The pushshift reddit dataset. In Proceedings of the International AAAI Conference on Web and Social Media, volume 14, pages 830-839. +Reuben Binns, Michael Veale, Max Van Kleek, and Nigel Shadbolt. 2017. Like trainer, like bot? inheritance of bias in algorithmic content moderation. In International conference on social informatics, pages 405-415. Springer. +Su Lin Blodgett, Solon Barocas, Hal Daumé III, and Hanna Wallach. 2020. Language (technology) is power: A critical survey of "bias" in NLP. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 5454-5476, Online. Association for Computational Linguistics. +Su Lin Blodgett, Lisa Green, and Brendan O'Connor. 2016. Demographic dialectal variation in social media: A case study of African-American English. + +In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 1119-1130, Austin, Texas. Association for Computational Linguistics. +Tolga Bolukbasi, Kai-Wei Chang, James Y Zou, Venkatesh Saligram, and Adam T Kalai. 2016. Man is to computer programmer as woman is to homemaker? debiasing word embeddings. In Advances in neural information processing systems, pages 4349-4357. +Mary Helen Bucholtz. 1999. Borrowed blackness: African-american vernacular english and european-american youth identities. +Aylin Caliskan, Joanna J. Bryson, and Arvind Narayanan. 2017. Semantics derived automatically from language corpora contain human-like biases. Science, 356(6334):183-186. +Eshwar Chandrasekharan, Mattia Samory, Shagun Jhaver, Hunter Charvat, Amy Bruckman, Cliff Lampe, Jacob Eisenstein, and Eric Gilbert. 2018. The internet's hidden rules: An empirical study of reddit norm violations at micro, meso, and macro scales. Proceedings of the ACM on Human-Computer Interaction, 2(CSCW):1-25. +Yung-Sung Chuang, Mingye Gao, Hongyin Luo, James Glass, Hung-yi Lee, Yun-Nung Chen, and Shang-Wen Li. 2021. Mitigating biases in toxic language detection through invariant rationalization. arXiv preprint arXiv:2106.07240. +Jeffrey Alan Coleman. 1998. Language contact in the inner city: the acquisition of aave features by bilingual hispanic adolescents. Master's thesis, University of North Texas. +Thomas Davidson, Debasmita Bhattacharya, and Ingmar Weber. 2019. Racial bias in hate speech and abusive language detection datasets. In Proceedings of the Third Workshop on Abusive Language Online, pages 25-35, Florence, Italy. Association for Computational Linguistics. +Thomas Davidson, Dana Warmsley, Michael Macy, and Ingmar Weber. 2017. Automated hate speech detection and the problem of offensive language. ICWSM. +Pablo Delgado. 2019. How el País used perspective api to make their comments section less toxic. https://web.archive.org/web/20200307130901/https://blog.google/outreach-initiatives/google-news-initiative/how-el-pais-used-ai-make-their COMMENTS-section-less-toxic/. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for + +Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171-4186, Minneapolis, Minnesota. Association for Computational Linguistics. +Lucas Dixon, John Li, Jeffrey Sorensen, Nithum Thain, and Lucy Vasserman. 2018. Measuring and mitigating unintended bias in text classification. In Proceedings of the 2018 AAAI/ACM Conference on AI, Ethics, and Society, pages 67-73. +Bassey Etim. 2019. The times sharply increases articles open for comments, using google's technology. https:// web.archive.org/web/20190115023650/ https://www.nytimes.com/2017/06/13/ insider/have-a-comment-leave-a- comment.html/. +Paula Fortuna, Juan Soler, and Leo Wanner. 2020. Toxic, hateful, offensive or abusive? what are we really classifying? an empirical analysis of hate speech datasets. In Proceedings of the 12th Language Resources and Evaluation Conference, pages 6786-6794. +Antigoni Founta, Constantinos Djouvas, Despoina Chatzakou, Ilias Leontiadis, Jeremy Blackburn, Gianluca Stringhini, Athena Vakali, Michael Sirivianos, and Nicolas Kourtellis. 2018. Large scale crowdsourcing and characterization of twitter abusive behavior. In Proceedings of the International AAAI Conference on Web and Social Media, volume 12. +John Gumperz. 1968. The speech community. international encyclopedia of the social sciences, 381-386. +Xiaolei Huang, Linzi Xing, Franck Dernoncourt, and Michael J. Paul. 2020. Multilingual Twitter corpus and baselines for evaluating demographic bias in hate speech recognition. In Proceedings of the 12th Language Resources and Evaluation Conference, pages 1440-1448, Marseille, France. European Language Resources Association. +A Lane Igoudin. 2011. Asian american girls who speak african american english: A subcultural language identity. Multilingual Identities: New Global Perspectives. Berlin: Mouton de Gruyter. +Xisen Jin, Francesco Barbieri, Aida Mostafazadeh Davani, Brendan Kennedy, Leonardo Neves, and Xiang Ren. 2020. Efficiently mitigating classification bias via transfer learning. +R. K. Kaliyar. 2020. A multi-layer bidirectional transformer encoder for pre-trained word embedding: A survey of bert. In 2020 10th International Conference on Cloud Computing, Data Science Engineering (Confluence), pages 336-340. +Brendan Kennedy, Mohammad Atari, Aida M Davani, Leigh Yeh, Ali Omrani, Yehsong Kim, Kris Coombs Jr, Shreya Havaldar, Gwenyth Portillo-Wightman, Elaine Gonzalez, et al. 2018. The gab hate corpus: A collection of 27k posts annotated for hate speech. PsyArXiv. July, 18. + +Jae Yeon Kim, Carlos Ortiz, Sarah Nam, Sarah Santiago, and Vivek Datta. 2020. Intersectional bias in hate speech and abusive language datasets. arXiv preprint arXiv:2005.05921. +Jamie Shinhee Lee. 2011. Globalization of african american vernacular english in popular culture: Blinglish in korean hip hop. English World-Wide, 32(1):1-23. +Ping Liu, Wen Li, and Liang Zou. 2019. NULI at SemEval-2019 task 6: Transfer learning for offensive language detection using bidirectional transformers. In Proceedings of the 13th International Workshop on Semantic Evaluation, pages 87–91, Minneapolis, Minnesota, USA. Association for Computational Linguistics. +Debanjan Mahata, Haimin Zhang, Karan Uppal, Yaman Kumar, Rajiv Ratn Shah, Simra Shahid, Laiba Mehnaz, and Sarthak Anand. 2019. Midas at semeval-2019 task 6: Identifying offensive posts and targeted offense from twitter. In SemEval@NAACL-HLT. +Sara Mills. 2009. Impoliteness in a cultural context. Journal of Pragmatics, 41(5):1047-1060. Pragmatic Markers. +Ji Ho Park, Jamin Shin, and Pascale Fung. 2018. Reducing gender bias in abusive language detection. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 2799-2804, Brussels, Belgium. Association for Computational Linguistics. +Perspective. Perspective Comment Analyzer +API. https://web.archive.org/web/20200530202055/https://github.com/conversational/perspectiveapi/blob/master/2-api/model-cards/English/toxicity.md. +Daniel Preottiuc-Pietro and Lyle Ungar. 2018. User-level race and ethnicity predictors from Twitter text. In Proceedings of the 27th International Conference on Computational Linguistics, pages 1534-1545, Santa Fe, New Mexico, USA. Association for Computational Linguistics. +Sara Rosenthal, Pepa Atanasova, Georgi Karadzhov, Marcos Zampieri, and Preslav Nakov. 2020. A large-scale semi-supervised dataset for offensive language identification. arXiv preprint arXiv:2004.14454. +Maarten Sap, Dallas Card, Saadia Gabriel, Yejin Choi, and Noah A Smith. 2019. The risk of racial bias in hate speech detection. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 1668-1678. +Natasha Shrikant. 2015. 'yo, it's ist yo': The discursive construction of an indian american youth identity in a south asian student club. *discourse & society*, 26(4):480-501. + +Mengzhou Xia Anjalie Field Yulia Tsvetkov. 2020. Demoting racial bias in hate speech detection. SocialNLP 2020, page 7. +Ameya Vaidya, Feng Mai, and Yue Ning. 2020. Empirical analysis of multi-task learning for reducing identity bias in toxic comment detection. In Proceedings of the International AAAI Conference on Web and Social Media, volume 14, pages 683-693. +Zeerak Waseem. 2016. Are you a racist or am i seeing things? annotator influence on hate speech detection on twitter. In Proceedings of the first workshop on NLP and computational social science, pages 138-142. +Zeerak Waseem and Dirk Hovy. 2016. Hateful symbols or hateful people? predictive features for hate speech detection on Twitter. In Proceedings of the NAACL Student Research Workshop, pages 88-93, San Diego, California. Association for Computational Linguistics. +Michael Wiegand, Josef Ruppenhofer, and Thomas Kleinbauer. 2019. Detection of abusive language: the problem of biased datasets. In Proceedings of the 2019 conference of the North American Chapter of the Association for Computational Linguistics: human language technologies, volume 1 (long and short papers), pages 602-608. +Mengzhou Xia, Anjalie Field, and Yulia Tsvetkov. 2020. Demoting racial bias in hate speech detection. In Proceedings of the Eighth International Workshop on Natural Language Processing for Social Media, pages 7-14, Online. Association for Computational Linguistics. +Albert Xu, Eshaan Pathak, Eric Wallace, Suchin Gururangan, Maarten Sap, and Dan Klein. 2021. Detoxifying language models risks marginalizing minority voices. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 2390-2397, Online. Association for Computational Linguistics. +Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Russ R Salakhutdinov, and Quoc V Le. 2019. Xlnet: Generalized autoregressive pretraining for language understanding. In Advances in neural information processing systems, pages 5753-5763. +Marcos Zampieri, Shervin Malmasi, Preslav Nakov, Sara Rosenthal, Noura Farra, and Ritesh Kumar. 2019a. Predicting the Type and Target of Offensive Posts in Social Media. In Proceedings of NAACL. +Marcos Zampieri, Shervin Malmasi, Preslav Nakov, Sara Rosenthal, Noura Farra, and Ritesh Kumar. 2019b. SemEval-2019 task 6: Identifying and categorizing offensive language in social media (OffensEval). In Proceedings of the 13th International Workshop on Semantic Evaluation, pages 75-86, Minneapolis, Minnesota, USA. Association for Computational Linguistics. + +Marcos Zampieri, Preslav Nakov, Sara Rosenthal, Pepa Atanasova, Georgi Karadzhov, Hamdy Mubarak, Leon Derczynski, Zeses Pitenis, and Cagrini Koltekin. 2020. SemEval-2020 Task 12: Multilingual Offensive Language Identification in Social Media (OffenseEval 2020). In Proceedings of SemEval. +Xuhui Zhou, Maarten Sap, Swabha Swayamdipta, Yejin Choi, and Noah Smith. 2021. Challenges in automated debiasing for toxic language detection. pages 3143-3155. + +# A Community Subreddits + +
CommunitySubreddits
Native Americanr/IndianCountry, r/NativeAmerican
Hispanicr/LatinoPeopleTwitter, r/Chicano, r/cuba
Hawaiir/Hawaii
South Asianr/ABCDesis
African Americanr/AfricanAmerican, r/asklatinamerica, r/blackladies, r/blackfellas, r/blacklivesmatter, r/blackcreatives, r/blackhair, r/blackwomens, r/ebonyimagination, r/blackcontemporaryart, r/afrocentrism, r/afrofuturism
+ +Table 5: Communities studied and their corresponding subreddits. + +# B Guideline for user study + +WARNING: The following comments may contain offensive/hateful material. These might include instances of racism, sexism and misogyny. If at any point you feel you cannot judge any more then just send us what you complete. Thank you for your support of our research + +# TASK description: + +Based on the language norms used in your cultural/ethnic/racial background, do you find the following texts offensive or hateful? Indicate your decision with a 'Yes' in column A for texts you feel are offensive/hateful and 'No' otherwise. + +# C African American examples from the user study + +
TextCLC ScoreMIDAS ScorePersp. Score
aw damn im so sorry sis that is the worst0.990.960.78
im so fucking tired of side chick culture0.990.960.90
lol i caught so much shit with this so i cant even imagine if you brought out colorism0.990.950.86
i know who it might be but i wont say because i dont want to get banned for starting shit0.980.940.90
smh these niggas ain't shit lol my now ex boyfriend is almost 30 and all he do is play nintendo all day and DOESNT wanna seek a job smh0.990.930.95
i would have ghosted his ass so fast0.960.910.94
i need lasik eye surgery i'm blind as a bitch this shit can't be healthy0.99OFFOFF
The older you get the more you understand that vibez is more important than a cute face & a fat ass0.85OFFOFF
I never got to thank her for everything she has done for me as a Black woman & a writer. I am so fucking sad this hurts so fucking much0.99OFFOFF
My family is coming.. I need to put a bra on but damn I'm lazy0.99OFFOFF
i turn into the craziest bitch every leo season0.99OFFOFF
+ +Table 6: Examples of comments that the classifiers or annotators labeled taboo (offensive/toxic/hateful), but both African American annotators agreed were non-taboo. Note that MIDAS and Persp scores which indicate “OFF” are those labels of the respective original dataset. + +# D South Asian examples from the user study + +
TextCLC ScoreMIDAS ScorePersp. Score
it is not unreasonable to assume she was with a desi guy calm your fucking tits0.990.970.93
lol dil mil is crap anyway i get the same 10 girls on repeat and im like dafuq is wrong with this shit0.990.960.93
lol the idiot who thinks india has no discrimination is going to preach to me stop killing people for eating beef or even suspected of eating beef and come back to me you fucking hypocrite0.990.970.95
really darkskinned desi girls are fucking seeexxxy0.990.960.96
yeah no shit you dont even live in india0.990.960.93
exactly tribalism all ready divided and fucked up south asia why do we have to spill that shit over to the us too0.980.950.93
this is exactly the reason i dont fuck with biryani0.990.950.89
shitty parenting and cultural, religious customs will do that to you0.960.760.93
#ArunJaitleyStepDown He is most shameless #FM in history of India and audacity and shamelessness with which is lies in public is disgrace to post.0.99OFFOFF
#FailedDemFeinstein should have quit decades ago. She is a disgrace. Feinstein blames GOP after Kavanaugh accuser stays mum, admits ‘I can’t say everything’s truthful’ URL0.85OFFOFF
#JusticeForSoniasFather Mr Usman buzdar sb! please respond to Sonia Iqbal daughter of PTI coun-sellor from okara whose father was killed during elections by nawaz league killers. She is saying she will commit suicide in front of media. Where is jus-tice?0.99OFFOFF
+ +Table 7: Examples of comments that the classifiers or annotators labeled taboo (offensive/toxic/hateful), but both South Asian annotators agreed were non-taboo. Note that MIDAS and Persp scores which indicate "OFF" are those labels of the respective original dataset. \ No newline at end of file diff --git a/suumcuiquestudyingbiasintaboodetectionwithacommunityperspective/images.zip b/suumcuiquestudyingbiasintaboodetectionwithacommunityperspective/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..3ffe6083ffc17af69419d9fef778d7a26845b59d --- /dev/null +++ b/suumcuiquestudyingbiasintaboodetectionwithacommunityperspective/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3cabae2424a0b4f78b4bb381cc2fc8a7021404af9520da24a5e47e8d8363bbb6 +size 591337 diff --git a/suumcuiquestudyingbiasintaboodetectionwithacommunityperspective/layout.json b/suumcuiquestudyingbiasintaboodetectionwithacommunityperspective/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..6fc1e84d06721d7e7fbeff8cdc4c3a291b65a35c --- /dev/null +++ b/suumcuiquestudyingbiasintaboodetectionwithacommunityperspective/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:14824d2867412542fdd3d4edad017197e2003c40cebd6ff1ba4616f9e9aba0e2 +size 349622 diff --git a/symcomsyntacticmeasureofcodemixingastudyofenglishhindicodemixing/544a300d-1827-444f-8733-2d5ff1f3f08d_content_list.json b/symcomsyntacticmeasureofcodemixingastudyofenglishhindicodemixing/544a300d-1827-444f-8733-2d5ff1f3f08d_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..eb42faa0e3d2d523447475a71f2c8df673132d31 --- /dev/null +++ b/symcomsyntacticmeasureofcodemixingastudyofenglishhindicodemixing/544a300d-1827-444f-8733-2d5ff1f3f08d_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cccf42890376d080a1906c37969116c00deac0316dd59a3180b5951da12428c9 +size 45982 diff --git a/symcomsyntacticmeasureofcodemixingastudyofenglishhindicodemixing/544a300d-1827-444f-8733-2d5ff1f3f08d_model.json b/symcomsyntacticmeasureofcodemixingastudyofenglishhindicodemixing/544a300d-1827-444f-8733-2d5ff1f3f08d_model.json new file mode 100644 index 0000000000000000000000000000000000000000..819ec0f2b0d280476440f08d9f5065c202bf86fd --- /dev/null +++ b/symcomsyntacticmeasureofcodemixingastudyofenglishhindicodemixing/544a300d-1827-444f-8733-2d5ff1f3f08d_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:16506d012216daa52fbde4e5517ab32e2888cf5d9805df2b864ee74882f1eaee +size 57488 diff --git a/symcomsyntacticmeasureofcodemixingastudyofenglishhindicodemixing/544a300d-1827-444f-8733-2d5ff1f3f08d_origin.pdf b/symcomsyntacticmeasureofcodemixingastudyofenglishhindicodemixing/544a300d-1827-444f-8733-2d5ff1f3f08d_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..5d437a88617de75d23c87b69d170975e1dd59516 --- /dev/null +++ b/symcomsyntacticmeasureofcodemixingastudyofenglishhindicodemixing/544a300d-1827-444f-8733-2d5ff1f3f08d_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4c9f169ffddcb32895229e5ed0354c0b4b06423ace740b0cf30d6c8b154aaf9a +size 1589148 diff --git a/symcomsyntacticmeasureofcodemixingastudyofenglishhindicodemixing/full.md b/symcomsyntacticmeasureofcodemixingastudyofenglishhindicodemixing/full.md new file mode 100644 index 0000000000000000000000000000000000000000..b0affe03ce2113aa0a30b62989bf439eb9d48b9a --- /dev/null +++ b/symcomsyntacticmeasureofcodemixingastudyofenglishhindicodemixing/full.md @@ -0,0 +1,192 @@ +# SyMCoM - Syntactic Measure of Code Mixing +A Study Of English-Hindi Code-Mixing + +Prashant Kodali† Anmol Goel† Monojit Choudhury‡ +Manish Shrivastava† Ponnurangam Kumaraguru† +†International Institute of Information Technology Hyderabad +‡Microsoft Research, India + +{prashant.kodali, anmol.goel}@research.iit.ac.in monojitc@microsoft.com, {m.shrivastava, pk.guru}@iit.ac.in + +# Abstract + +Code mixing is the linguistic phenomenon where bilingual speakers tend to switch between two or more languages in conversations. Recent work on code-mixing in computational settings has leveraged social media code mixed texts to train NLP models. For capturing the variety of code mixing in, and across corpus, Language ID (LID) tags based measures (CMI) have been proposed. Syntactical variety/patterns of code-mixing and their relationship vis-a-vis computational model's performance is under explored. In this work, we investigate a collection of English(en)-Hindi(hi) code-mixed datasets from a syntactic lens to propose, SyMCoM, an indicator of syntactic variety in code-mixed text, with intuitive theoretical bounds. We train SoTA en-hi PoS tagger, accuracy of $93.4\%$ , to reliably compute PoS tags on a corpus, and demonstrate the utility of SyMCoM by applying it on various syntactical categories on a collection of datasets, and compare datasets using the measure. + +# 1 Introduction + +Code-mixing refers to mixing of linguistic units and structures from multiple languages in a single utterance and/or conversation (Myers-Scotton, 1997). The complexity of code-mixing can be intuitively understood as the degree of structural interleaving between the languages at the level of the lexicon and morpho-syntax (Myers-Scotton, 1997), and also at the level of pragmatic and sociolinguistic functions of code-mixing in a linguistic community (Begum et al., 2016; Annamalai, 2001; Malhotra, 1980). It is an important notion that is linguistically well-studied and provides insights into cognitive and cultural aspects of human language. Additionally, quantification of this complexity has recently attracted attention of computational linguists because studies have shown that the performance of the same model can widely vary on different code-mixed corpora. As a result, dif + +![](images/f37e3ac1409b720a3d2e684683324aaed7b56ce01747297ea6cb30f93876cdce.jpg) +Figure 1: Two sentences, having same language patterns, but the syntactic nature of the switched units are different - VERB is switched in Ex 1, NOUNS are switched in Ex 2. + +ferent metrics of complexity of code-mixing have been proposed such as CMI, Ratio-based measures time-course measures and memory-based measures (Guzman et al., 2017; Gambäck and Das, 2016). But as Srivastava and Singh (2021) points out, these metrics are limited, partly because they are primarily based on language switch patterns at the token level, being completely agnostic to structural features. + +For instance, Figure 1 shows $en - hi$ code-mixed sentences with the same language tag distribution, but in Example (1), verb is switched, while in (2) nouns are switched. The former seems much more complex and difficult to process cognitively and computationally, than the latter, where switching seems to be an extension of noun-borrowing (Bali et al., 2014). Motivated by such cases, in this paper, we ask the following research question: Can syntactic category information be deduced and used as a measure of structural complexity of a code-mixed sentence and corpus? We attempt to tackle this question by formulating: Syntactic Measure of Code Mixing SyMCoM, a simple metric that encodes the distributional difference of various syntactic categories across languages in a sentence. SyMCoM can be computed for any corpora, as long as there is a reasonably accurate POS tagger + +for the code-mixed language pair. + +Through empirical studies of several existing en-hi code-mixed corpora we provide, for the first time, a strong quantitative evidence in support of a widely held theoretical notion that Open class categories (e.g., noun, adjectives) are more likely to be switched than the closed class categories (e.g., pronouns, verbs) within a sentence. Further, we show that different corpora have significantly different distribution of SyMCoM values. + +# 2 SyMCoM: Syntactic Measure of Code Mixing + +A quantitative measure of syntactic variation in code mixing patterns should ideally encode: a) Category of Switch i.e whether or not a PoS tag or syntactic category is switched?; b) Degree / Contrast : If a syntactic unit is switched, what is the level of contrast between $L1$ and $L2$ for that unit? + +To encode the aforementioned properties, we propose a Syntactic Measure of Code Mixing $(SyMCoMSU)$ , which is defined as: + +$$ +S y M C o M _ {S U} = \frac {\left(C o u n t _ {S U _ {L 1}}\right) - \left(C o u n t _ {S U _ {L 2}}\right)}{\sum_ {i = 1} ^ {2} C o u n t _ {S U _ {L i}}} \tag {1} +$$ + +Here, $SU$ is a syntactic unit; for this study, we will assume that $SU$ represent word-level syntactic categories namely Parts-of-Speech (POS) tags such as Nouns and Verbs, or a class of PoS tags such as Open and Closed classes. $\text{Count}_{SU_{Li}}$ represents the count of the syntactic unit $SU$ for language $L_{i}$ ( $i \in \{1,2\}$ ) within a sequence of words code-mixed between languages $L_{1}$ and $L_{2}$ . Without loss of generality, we will consider this sequence to be a sentence, though it could be an utterance, paragraph or even a document. SyMCoMSU score is bounded between [-1,1] and defined only for $SU_{s}$ that occur at least once in the sentence. + +The polarity of $SyMCoMSU$ indicates the language, among $L1$ and $L2$ , that is contributing higher number of tokens for a particular $SU$ , and its absolute value captures the degree of skew towards a particular language. If $SyMCoMSU$ is closer to zero, it indicates that the contribution of $L1$ and $L2$ for $SU$ is balanced. + +We define the $SyMCoM_{sent}$ score for a sentence, as the weighted average of absolute $SyMCoMSU$ scores for all $SU$ , where the weights + +are the fraction of tokens in the sentence belonging to an $SU$ . + +$$ +S y M C o M _ {s e n t} = \sum_ {S U} \frac {\text {C o u n t} _ {S U}}{\text {l e n}} \times \left| S y M C o M _ {S U} \right| \tag {2} +$$ + +$SyMCom_{sent}$ is bounded between [0,1]. Values closer to zero indicate that $L_{1}$ and $L_{2}$ contribute nearly equally for most types of $SU_{s}$ in the sentence, whereas values close to 1 indicate that in the sentence each $SU$ is majorly contributed by a single language. Note that while a low $SyMCoM_{sent}$ implies that the tokens in a sentence are nearly equally contributed by the two languages, a high $SyMCoM_{sent}$ does not say anything about the language distribution of the tokens. + +$SyMCoM_{sent}$ can be averaged over the corpus to capture the syntactic variation at a corpus level: + +$$ +S y M C o M _ {c o r p u s} = \sum_ {s e n t} \frac {S y M C o M _ {s e n t}}{\# s e n t e n c e s i n c o r p u s} \tag {3} +$$ + +Equation 1 can be extended to any arbitrary subset of POS categories, of which the Open Class (content words - Noun, Adjectives, Verbs, etc.) and Closed Class (function words - Adpositions, Pronouns, Demonstratives, etc.) are of special interest; we will refer to these as $SyMCoM_{OPEN}$ and $SyMCoM_{CLOSED}$ respectively. + +In Figure 1, $SyMCoMSU$ scores are computed for two en-hi code-mixed sentences, whose CMI scores are equal. For each utterance, we calculate the number of nouns and verbs belonging to $L_{1} =$ en and $L_{2} =$ hi. In Example 1, $SyMCoMNOUN = -1$ , indicating that $L_{2}$ is contributing all the Nouns in this sentence. The opposite polarity of $SyMCoM_{VERB}$ indicates that all the verbs are contributed by $L_{1}$ . + +# 3 Experiments & Discussion + +To demonstrate the utility of the proposed $SyMCoM$ measure, we analyse a) en-hi code-mixed corpus; b) compare $SyMCoM_{sent}$ $SyMCoM_{corpus}$ score across different datasets. To compute $SyMCoM$ scores we need token wise LID and PoS tags. We use pre-trained character level BiLSTM Language ID tagger released by (Bhat et al., 2018) for obtaining token wise LIDs. We train our PoS tagger using the en-hi Universal Dependency dataset released by (Bhat et al., 2017, 2018), which used Universal Dependency tagset (de Marneffe et al., 2014). + +![](images/fcf14548ffcd2193ded5c7a047fba70571b14ba066adfaa911abff3879b34848.jpg) +a) SyMCoM for OPEN and CLOSED Categories + +![](images/c9e4157275f88a536aa181c5716f33087bf313fd9cd4e3a9292d891e2d591e7a.jpg) +b) Correlation of SyMCoM scores for PoS Tags +Figure 2: (a) The peak of the curves indicates that CLOSED class words are commonly used in a single language while OPEN class words are spread out, hence, are contributed by both languages. (b) $SyMCoMSU$ score of VERB (Open Class) is highly correlated with Closed class tags. + +# 3.1 en-hi Code Mix PoS tagger + +The GLUECoS (Khanuja et al., 2020) and LinCE (Aguilar et al., 2020) benchmarks indicate that multilingual transformer based encoder models - mBERT (Devlin et al., 2019) have matched or outperformed the SoTA on the specific PoS tagging tasks, while showing sub par performance on more complex semantic tasks such as Sentiment Analysis and Natural Language Inference. + +
ModelAccuracy
Bhat et al. (2018)91.9%
Mod. mBERT (Khanuja et al., 2020)88.06%
XLM-R92.75%
+ +Table 1: PoS Tagger Performance + +We fine-tune XLM-R (Conneau et al., 2020) to obtain best-performing PoS Tagger. In Table 1 we compare accuracy of our best-performing finetuned XLM-R model against previous results reported in GLUECoS benchmark, and Bhat et al. (2018). In addition to accuracy, we also analyse the class wise performance, and we note that ADV, INTJ, PROPN have f1 lower than 0.85. SyMCoM measure depends on the accuracy of the PoS tags and the potency of PoS tagger impacts the usability of the score. We recommend that for SyMCoM scores, the corresponding accuracy of detecting syntactic unit shall be taken into account, and SyMCoM scores be computed for syntactic units which can be detected with a higher accuracy. Further training details for the PoS tagger are listed in Appendix A. + +Using the LID and PoS tags, for each Syntactic Unit considered, the language specific counts are computed - $SU_{L_i}$ . $SyMCoMSU$ scores for particular syntactic unit are then calculated using the counts $SU_{L_i}$ as mentioned in Equation 1. + +# 3.2 Analysis of en-hi Code Mixed Corpus + +To demonstrate the utility of the proposed SyMCoM measure, we analyse en-hi code-mixed corpus. We collect publicly available codemixed en-hi datasets released for various tasks: shared tasks, code mixed benchmarks (GLUECoS, LINCE), text classification, Machine translation, among others- remove any monolingual sentences, and created a corpus of 55,474 sentences, details of the datasets used are in Appendix C. SyMCoM scores, along with CMI score (Gamback and Das, 2016), are computed for the collected corpus, and compared. + +Figure 2(a) shows the distribution of $SyMCOM_{SU}$ scores for Open and Closed class units. The skewed nature of $SyMCOM_{CLOSED}$ indicates that Closed class words are not mixed, and are provided by either $L1$ or $L2$ . $SyMCOM_{OPEN}$ , on the other hand, is more spread out indicating that in code-mixed sentences the Open class tokens are contributed by both $en$ and $hi$ . Figure 2(b) indicates correlations of $SyMCOM$ scores for all the PoS categories. Higher correlation scores indicate the tendency of the particular PoS tag pair to switch together. Similar to Figure 2(a), the correlations indicate that closed class tokens are from the same language. + +![](images/9fe1053597edaf4972eff7c37bddb7a88331cd1c61a8bf717dd6bd33de0a748b.jpg) +Figure 3: $SyMCoM_{sent}$ scores for various benchmark datasets. The plot represents the syntactic variation across benchmark datasets which encode the switching within PoS tag categories. + +Interestingly, verb is also highly correlated with closed class categories. The high correlation can be attributed to the fact that the finite verbs, along with closed class words, govern syntactical structure of a sentence, similar to the notion of matrix language. According to (Joshi, 1982), certain categories including pronouns, adpositions and finite verbs cannot be switched from the matrix language. + +Figure 3 shows the $SyMCoM_{sent}$ distribution over sentences for several code-mixed corpora taken from the GLUECoS (Khanuja et al., 2020) and LINCE (Aguilar et al., 2020) benchmarks. Clearly, the 7 corpora has distinct $SyMCoM$ signatures. While LINCE POS and NER has very similar normal-like distributions with mean 0.5, all the other datasets seem to be right skewed showing less syntactic complexity. Most GLUECoS datasets show a bimodal distribution with a major peak between 0.6 and 0.8, and a minor peak at 1, indicating that a significant fraction of the sentences have syntactically simple code-mixing patterns, and most being only moderately syntactically complex. GLUECoS POS dataset though have four peaks including one at 0 implying a more complex and diverse set of sentences. + +Table 2 reports the $SyMCoM_{corpus}$ and CMI score. Datasets with seemingly similar CMI scores (LINCE LID and LINCE NER), have different $SyMCoM_{corpus}$ scores, indicating that $SyMCoM$ is capturing syntactic property of datasets not captured in CMI scores. Figure 4 shows the $SyMCoM_{SU}$ scores for each PoS tag, and compared for the benchmark datasets. We average the $SyMCoM_{SU}$ scores for each PoS tag + +![](images/9f9309fe8d27a953971b30b3453804185d0690fe5564a463f73455bb9a7c1706.jpg) +Figure 4: $SyMCoM_{sent}$ scores for various benchmark datasets for individual PoS tags. The plot represents mixing specific to each PoS tag. Across benchmarks, NOUN is highly switched, followed by VERB. But other PoS tags are largely monolingual. + +over the dataset, by averaging the absolute value of $SyMCoMSU$ score. Nouns and verbs are mixed the most, across all datasets while other PoS tags remain largely monolingual. + +
DatasetSyMCoMcorpusCMI
LINCE LID0.6722.68
GLUECoS LID0.6478.26
LINCE POS0.5228.04
GLUECoS POS0.6468
LINCE NER0.4825.26
GLUECoS NER0.63133
GLUECoS Sentiment0.6972.8
+ +Table 2: $SyMCoM_{corpus}$ and CMI measures for benchmark En-Hi datasets. $SyMCoM_{corpus}$ is bounded between [0,1] while $\mathrm{CMI} > 0$ . For datasets with similar CMI scores, $SyMCoM_{corpus}$ is able to distinguish datasets. + +# 4 Conclusion & Limitations + +In this work, we have proposed SyMCoM, a syntax-aware measure of code-mixing, to analyze code-mixed corpora from a syntactic perspective. Our analysis confirms a few important tenets of the matrix language theory, including the fact that CLOSED class categories and (finite) verbs are less likely to be switched. Additionally, we have trained a English-Hindi (Hinglish) PoS Tagger using XLM-R which is able to achieve state-of-the-art-results. + +$SyMCoM$ relies on the strength of PoS tagger and LID tagger. The errors made by the tagger would propagate into the subsequent analysis thus adding noise to the $SyMCoM$ scores as well. Extending $SyMCoM$ to code-mixing between 3 or more languages and to deeper syntactic structures (nested phrases) are left as part of future work. + +# References + +Gustavo Aguilar, Sudipta Kar, and Thamar Solorio. 2020. LinCE: A centralized benchmark for linguistic code-switching evaluation. In Proceedings of the 12th Language Resources and Evaluation Conference, pages 1803-1813, Marseille, France. European Language Resources Association. +E. Annamalai. 2001. Managing multilingualism in india: Political and linguistic manifestations. +Kalika Bali, Jatin Sharma, Monjit Choudhury, and Yogarshi Vyas. 2014. "I am borrowing ya mixing ?" an analysis of English-Hindi code mixing in Facebook. In Proceedings of the First Workshop on Computational Approaches to Code Switching, pages 116-126, Doha, Qatar. Association for Computational Linguistics. +Somnath Banerjee, M. Choudhury, K. Chakma, S. Naskar, Amitava Das, Sivaji Bandyopadhyay, and P. Rosso. 2020. Msir@fire: A comprehensive report from 2013 to 2016. SN Comput. Sci., 1:55. +Suman Banerjee, Nikita Moghe, Siddhartha Arora, and Mitesh M. Khapra. 2018. A dataset for building code-mixed goal oriented conversation systems. +Rafiya Begum, Kalika Bali, Monojit Choudhury, Koustav Rudra, and Niloy Ganguly. 2016. Functions of code-switching in tweets: An annotation framework and some initial experiments. In Proceedings of the Tenth International Conference on Language Resources and Evaluation (LREC'16), pages 1644-1650, Porto Roz, Slovenia. European Language Resources Association (ELRA). +Irshad Bhat, Riyadh A. Bhat, Manish Shrivastava, and Dipti Sharma. 2017. Joining hands: Exploiting monolingual treebanks for parsing of code-mixing data. In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics: Volume 2, Short Papers, pages 324-330, Valencia, Spain. Association for Computational Linguistics. +Irshad Bhat, Riyadh A. Bhat, Manish Shrivastava, and Dipti Sharma. 2018. Universal Dependency parsing for Hindi-English code-switching. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 987-998, New Orleans, Louisiana. Association for Computational Linguistics. +Aditya Bohra, Deepanshu Vijay, Vinay Singh, Syed Sarfaraz Akhtar, and Manish Shrivastava. 2018. A dataset of Hindi-English code-mixed social media text for hate speech detection. In Proceedings of the Second Workshop on Computational Modeling of People's Opinions, Personality, and Emotions in Social Media, pages 36-41, New Orleans, Louisiana, USA. Association for Computational Linguistics. + +K. Chakma and Amitava Das. 2016. Cmir: A corpus for evaluation of code mixed information retrieval of Hindi-english tweets. Computación y Sistemas, 20:425-434. +Alexis Conneau, Kartikay Khandelwal, Naman Goyal, Vishrav Chaudhary, Guillaume Wenzek, Francisco Guzmán, Edouard Grave, Myle Ott, Luke Zettle-moyer, and Veselin Stoyanov. 2020. Unsupervised cross-lingual representation learning at scale. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, Online. Association for Computational Linguistics. +Amitava Das. Tool contest on pos tagging for code-mixed indian social media (facebook, twitter, and pinterest) text @ icon 2016. +Marie-Catherine de Marneffe, Timothy Dozat, Natalia Silveira, Katri Haverinen, Filip Ginter, Joakim Nivre, and Christopher D. Manning. 2014. Universal Stanford dependencies: A cross-linguistic typology. In Proceedings of the Ninth International Conference on Language Resources and Evaluation (LREC'14), pages 4585-4592, Reykjavik, Iceland. European Language Resources Association (ELRA). +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171-4186, Minneapolis, Minnesota. Association for Computational Linguistics. +Mrinal Dhar, Vaibhav Kumar, and Manish Shrivastava. 2018. Enabling code-mixed translation: Parallel corpus creation and MT augmentation approach. In Proceedings of the First Workshop on Linguistic Resources for Natural Language Processing, pages 131-140, Santa Fe, New Mexico, USA. Association for Computational Linguistics. +Björn Gambäck and Amitava Das. 2016. Comparing the level of code-switching in corpora. In Proceedings of the Tenth International Conference on Language Resources and Evaluation (LREC'16), Portož, Slovenia. +Gualberto Guzmán, Joseph Ricard, Jacqueline Serigos, Barbara E. Bullock, and Almeida Jacqueline Toribio. 2017. Metrics for Modeling Code-Switching Across Corpora. In Proc. Interspeech 2017, pages 67-71. +Aravind K. Joshi. 1982. Processing of sentences with intra-sentential code-switching. In *Coling* 1982: Proceedings of the Ninth International Conference on Computational Linguistics. +Divyanshu Kakwani, Anoop Kunchukuttan, Satish Golla, Gokul N.C., Avik Bhattacharyya, Mitesh M. Khapra, and Pratyush Kumar. 2020. IndicNLPSuite: Monolingual corpora, evaluation benchmarks and + +pre-trained multilingual language models for Indian languages. In Findings of the Association for Computational Linguistics: EMNLP 2020, pages 4948-4961, Online. Association for Computational Linguistics. +Ankush Khandelwal, Sahil Swami, Syed S. Akhtar, and Manish Shrivastava. 2018. Humor detection in english-hindi code-mixed social media content : Corpus and baseline system. +Simran Khanuja, Diksha Bansal, Sarvesh Mehtani, Savya Khosla, Atreyee Dey, Balaji Gopalan, Dilip Kumar Margam, Pooja Aggarwal, Rajiv Teja Nagipogu, Shachi Dave, Shruti Gupta, Subhash Chandra Bose Gali, Vish Subramanian, and Partha Talukdar. 2021. Muril: Multilingual representations for indian languages. +Simran Khanuja, Sandipan Dandapat, Anirudh Srinivasan, Sunayana Sitaram, and Monojit Choudhury. 2020. GLUECoS: An evaluation benchmark for code-switched NLP. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 3575-3585, Online. Association for Computational Linguistics. +Ritesh Kumar, Aishwarya N. Reganti, Akshit Bhatia, and Tushar Maheshwari. 2018. Aggression-annotated corpus of Hindi-English code-mixed data. In Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC 2018), Miyazaki, Japan. European Language Resources Association (ELRA). +Sunita Malhotra. 1980. Hindi-english, code switching and language choice in urban, uppermiddle-class indian families. +C. Myers-Scotton. 1997. Duelling Languages: Grammatical Structure in Codeswitching. Clarendon Press. +Braja Gopal Patra, Dipankar Das, and Amitava Das. 2018. Sentiment analysis of code-mixed indian languages: An overview of sail_code-mixed shared task @icon-2017. CoRR, abs/1803.06745. +Parth Patwa, Gustavo Aguilar, Sudipta Kar, Suraj Pandey, Srinivas PYKL, Björn Gambäck, Tanmoy Chakraborty, Thamar Solorio, and Amitava Das. 2020. SemEval-2020 task 9: Overview of sentiment analysis of code-mixed tweets. In Proceedings of the Fourteenth Workshop on Semantic Evaluation, pages 774–790, Barcelona (online). International Committee for Computational Linguistics. +Ameya Prabhu, Aditya Joshi, Manish Shrivastava, and Vasudeva Varma. 2016. Towards sub-word level compositions for sentiment analysis of Hindi-english code mixed text. +Sushmitha Reddy Sane, Suraj Tripathi, Koushik Reddy Sane, and Radhika Mamidi. 2019. Stance detection in code-mixed Hindi-English social media data using multi-task learning. In Proceedings of the Tenth + +Workshop on Computational Approaches to Subjectivity, Sentiment and Social Media Analysis, pages 1-5, Minneapolis, USA. Association for Computational Linguistics. +Vivek Srivastava and Mayank Singh. 2021. Challenges and limitations with the metrics measuring the complexity of code-mixed text. In Proceedings of the Fifth Workshop on Computational Approaches to Linguistic Code-Switching, pages 6-14, Online. Association for Computational Linguistics. +Sahil Swami, Ankush Khandelwal, Vinay Singh, Syed Sarfaraz Akhtar, and Manish Shrivastava. 2018a. A corpus of english-hindi code-mixed tweets for sarcasm detection. +Sahil Swami, Ankush Khandelwal, Vinay Singh, Syed Sarfaraz Akhtar, and Manish Shrivastava. 2018b. An english-hindi code-mixed corpus: Stance annotation and baseline system. + +# Appendix + +# A PoS Tagger Training and Performance Details + +We conducted preliminary experiment for PoS tagging using - XLM-R, mBERT, IndicBERT (Kakwani et al., 2020), MURiL (Khanuja et al., 2021), and results indicate that XLM-R with normalised inputs (romanised Hindi tokens are converted to their Devanagari counterpart), outperforms other models. We run further fine-tuning experiments on XLM-R to obtain optimal performing PoS Tagger. We tested three approaches: Method 1: Leverage Transfer from larger Monolingual UD datasets by fine tuning XLM-R on Hindi and English Monolingual UD datasets PoS tagging, followed by fine tuning on en-hi UD dataset; Method 2: Directly fine tune XLM-R on UD Code mix hi-en dataset, using the un-normalised tokens i.e romanised hinditokens are in roman script; Method 3: Directly fine tune XLM-R on UD Code mix hi-en dataset, using the normalised tokens i.e romanised hinditokens are in Devanagari script + +
SplitNum. of SamplesNum of Tokens
Train1,44820,203
Dev2253,411
Test2253,295
+ +Table 3: Statistics of en-hi UD Dataset + +Table 3 shows that the size of dataset used for training and validation isn't large, hence, for the best performing model, we try to assess the variation in results due to different seeds and data shuffling, show in Figure 5. Highest accuracy achieved by the model is $93.34\%$ with $\mu = 92.75\%$ and $\sigma = 0.35$ . + +![](images/325cc541c1e7407cfd041f479d7b98faee489171f844f473bc1f85ed125763c7.jpg) +Figure 5: Variation in PoS tagging performance for different values of random seeds and data shuffling. Best accuracy is $93.4\%$ , least being $92.4\%$ . + +All the results are reported on the normalised inputs. Fine-tuned XLM-R model outperforms the previous results reported on this dataset. Trained model checkpoint can be found at https://huggingface.co/prakod/en-hi-pos-tags-symcom. + +![](images/9863e53b6253ece0859dfaf391e31ddb84810698250df8bc45ce5955890bc9ca.jpg) +Figure 6: Class wise performance of PoS tagger. We can see that the certain classes like ADV, INTJ, PROPN have lower performance compared to other classes. + +# B Example Sentences from the collection of Datasets + +In Figure 7 examples are selected from the corpus on which the SyMCoM scores were computed using the LID and POS tagger outputs. We contrast the CMI score against SyMCoM scores using these examples. Example (1) and (2) have same CMI score, however syntactic signature of codemixing is quite distinct. In example (2), nouns and adjective are contributed by en, while in example (1) nouns are contributed by hi. Similarly in example (3) SyMCoM score for [NOUN,ADJ] is zero indicating that both en and hi contribute equal number of tokens belonging to the syntactical category of [NOUN,ADJ]. + +# C Dataset Sources + +In Table 4, we list all the sources used to construct our 55K sentence corpus of English-Hindi code-mixing. The data is representative of a wide variety of code-mixing including Hate Speech, Stance + +![](images/1c8cdee9b273c54c7ee9cc4c41bbd8a1b535f0a091bac22cfe6fdde434a2119a.jpg) +Figure 7: Example sentences demonstrate that the sentences having different SyMCoM scores, and SyMCoM scores sentences can distinguish between sentences with similar CMI. Color indicate LID tags, where in en , hi , ne + +Detection, Humor Detection and conversational systems. + +
LINCE Benchmark(Aguilar et al., 2020)
GLUECoS Benchmark(Khanuja et al., 2020)
Sentiment Analysis(Prabhu et al., 2016)
Semeval-2020 Sentiment Analysis(Patwa et al., 2020)
Machine Translation(Dhar et al., 2018)
Aggression Detection Shared Task(Kumar et al., 2018)
Hate Speech Detection(Bohra et al., 2018)
Stance Detection(Swami et al., 2018b)
Stance Detection(Sane et al., 2019)
Sarcasm Detection(Swami et al., 2018a)
Humor Detection(Khandelwal et al., 2018)
Code Mixed Goal Oriented Conversation Systems(Banerjee et al., 2018)
ICON 2015-2016 PoS LID Contest(Das)
FIRE 2013-16 Tasks(Banerjee et al., 2020)
Information Retrieval(Chakma and Das, 2016)
Sentiment Analysis(Patra et al., 2018)
+ +Table 4: English-Hindi Code mix datasets used to construct the 55K sentence corpus. SyMCoM scores are calculated on the collected sentences. LINCE and GLUECoS benchmark datasets are used to contrast syntactic variety of code mixing across datasets. \ No newline at end of file diff --git a/symcomsyntacticmeasureofcodemixingastudyofenglishhindicodemixing/images.zip b/symcomsyntacticmeasureofcodemixingastudyofenglishhindicodemixing/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..a2ba82f3c76dcdb1d77ed1c23b311f62aef00d24 --- /dev/null +++ b/symcomsyntacticmeasureofcodemixingastudyofenglishhindicodemixing/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd0a9d66300dc55a394a8dfb8f939496a05f2f1b9c9080dd1543aa5d251a0331 +size 446509 diff --git a/symcomsyntacticmeasureofcodemixingastudyofenglishhindicodemixing/layout.json b/symcomsyntacticmeasureofcodemixingastudyofenglishhindicodemixing/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..81f81c9f512c490f02f1f40e4c7cbc3bdeb31697 --- /dev/null +++ b/symcomsyntacticmeasureofcodemixingastudyofenglishhindicodemixing/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8e15da4b637a4d6c6bc4d08bc7474f86f4447ee81c05151d0ba000f82d28ba4f +size 258864 diff --git a/synchronousrefinementforneuralmachinetranslation/c1b24543-9d1b-4b90-a8d6-fc60576a362e_content_list.json b/synchronousrefinementforneuralmachinetranslation/c1b24543-9d1b-4b90-a8d6-fc60576a362e_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..fec021815b6b9b05d9502efb76dac4f4e103fc4b --- /dev/null +++ b/synchronousrefinementforneuralmachinetranslation/c1b24543-9d1b-4b90-a8d6-fc60576a362e_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7e58ad4e90078aa9bc9cae478c0dbc153b2f1225a0fb4c182928b40b41d67fa0 +size 72822 diff --git a/synchronousrefinementforneuralmachinetranslation/c1b24543-9d1b-4b90-a8d6-fc60576a362e_model.json b/synchronousrefinementforneuralmachinetranslation/c1b24543-9d1b-4b90-a8d6-fc60576a362e_model.json new file mode 100644 index 0000000000000000000000000000000000000000..b2d4d9d8cdcd7fee32c3af27da60354f25299bf5 --- /dev/null +++ b/synchronousrefinementforneuralmachinetranslation/c1b24543-9d1b-4b90-a8d6-fc60576a362e_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:579baaf0ee40f5608a0ced7cb67614447e8701da7775ee1c77ffd9cf398d2122 +size 87014 diff --git a/synchronousrefinementforneuralmachinetranslation/c1b24543-9d1b-4b90-a8d6-fc60576a362e_origin.pdf b/synchronousrefinementforneuralmachinetranslation/c1b24543-9d1b-4b90-a8d6-fc60576a362e_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..c4c1219cfe2e9802dfb68f8266fae5279c320f7b --- /dev/null +++ b/synchronousrefinementforneuralmachinetranslation/c1b24543-9d1b-4b90-a8d6-fc60576a362e_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:891d848cc3b719f8891535588550a04e1ae48a70cf4d0be6c2ac2d9228f13cfe +size 985252 diff --git a/synchronousrefinementforneuralmachinetranslation/full.md b/synchronousrefinementforneuralmachinetranslation/full.md new file mode 100644 index 0000000000000000000000000000000000000000..ecb5cef08185127f4c7b7d150568ec8b5f921749 --- /dev/null +++ b/synchronousrefinementforneuralmachinetranslation/full.md @@ -0,0 +1,297 @@ +# Synchronous Refinement for Neural Machine Translation + +Kehai Chen $^{1}$ , Masao Utiyama $^{2}$ , and Eiichiro Sumita $^{2}$ , Rui Wang $^{3}$ , and Min Zhang $^{1*}$ + +1Harbin Institute of Technology, Shenzhen, China + +$^{2}$ National Institute of Information and Communications Technology, Kyoto, Japan + +$^{3}$ Shanghai Jiao Tong University, Shanghai, China + +{chenkehai,zhangmin2021}@hit.edu.cn + +{mutiyama, eiichiro-sumita}@nict.go.jp + +wangrui12@sjtu.edu.cn + +# Abstract + +Machine translation typically adopts an encoder-to-decoder framework, in which the decoder generates the target sentence word-by-word in an auto-regressive manner. However, the auto-regressive decoder faces a deep-rooted one-pass issue whereby each generated word is considered as one element of the final output regardless of whether it is correct or not. These generated wrong words further constitute the target historical context to affect the generation of subsequent target words. This paper proposes a novel synchronous refinement method to revise potential errors in the generated words by considering part of the target future context. Particularly, the proposed approach allows the auto-regressive decoder to refine the previously generated target words and generate the next target word synchronously. The experimental results on three widely-used machine translation tasks demonstrated the effectiveness of the proposed approach. + +# 1 Introduction + +Recently, the encoder-decoder framework has obtained impressive results over various machine translation tasks (Barrault et al., 2020; Akhbardeh et al., 2021). Typically, decoder first represents those generated target words as a dependent-time target representation, and then uses an attention mechanism to summarize a dependent-time context from the source input for generating the next target word. Since this generated target word is conditioned on previously generated target words at each time step, the decoding process is often called auto-regressive decoding. Finally, decoder generates a target language sentence word-by-word in the auto-regressive decoding manner (Bahdanau et al., 2015; Vaswani et al., 2017). + +However, the auto-regressive decoder often encounters an inherent one-pass issue whereby + +each generated target word is one element of the final output of the machine translation model regardless of whether it is correct or not. These generated wrong target words are further added to the target historical context to affect the generation of subsequent target words, which hinders the performance of machine translation. Take a Chinese-to-English translation case in Figure 1 generated by a trained neural machine translation (NMT) model (Vaswani et al., 2017), we illustrate the once-generation issue. In the generated target translation "Tgt", there is first an inappropriate translation "clean up" compared with "monitor" in the reference "Ref". The "clean up" is regarded as the final translation to confuse the understanding of the meaning of the source sentence. When these inappropriate or incorrect target words constitute part of the target historical context, the once-generation issue further affects the generation of subsequent target words, for example, "drivers' mobile phone" is far away from the meaning of source sentence "the driver plays mobile phone while driving". To verify this issue, we artificially revised the inappropriate translation "clean up" as "monitor" during the decoding, and observed that the subsequent translation "driver plays mobile phone while driving" in "Revised" almost completely expresses the corresponding Chinese meaning. We believe that correcting the potential errors in generated translations will improve the quality of the translations. + +Many efforts have been initiated on revising potential errors in the generated target translation for machine translation, for example, automatic post-editing (Niehues et al., 2016; Zhou et al., 2017; Junczys Dowmunt and Grundkiewicz, 2017) and two-pass decoding (Xia et al., 2017; Geng et al., 2018; Nema et al., 2019; Ghazvininejad et al., 2019). Despite their success, most of these approaches asynchronously simulated the generation of the next target word and the revision + +Src: 上海市 松江区 交管部门 近期 使用 电子 警察 [Shanghai] [Songjiang District] [Traffic Control Department] [recently] [used] [electronic] [police] 整治 驾驶员 开车 玩 手机 ,一个星期 查获 30 多 起 [monitor] [driver] [driving] [plays] [mobile phone] [in a week] [detected] [30] [more than] [cases] + +Tgt: traffic control department of Songjiang District in Shanghai recently used electronic police to clean up drivers' mobile phone, and find more than 30 seizures a week + +Revised: traffic control department of Songjiang District in Shanghai recently used electronic police to monitor driver plays mobile phone during the driving, and find more than 30 cases a week + +Ref: Shanghai Songjiang District Traffic Control Department recently used electronic police to monitor whether the driver plays mobile phone while driving and detected more than 30 cases in a week + +Figure 1: Chinese-to-English translation cases generated by the standard decoder and the decoder with artificial revision. Note: English words in color are translations from the corresponding Chinese words with the same color. + +of the generated target words or required a complex modification of the existing models. In this paper, we propose a novel method to refine the potential errors in the generated target words and generate the next target word synchronously. To this end, during the decoding, we consider their target future context for a part of previously generated target words, to synchronously obtain the refinement probabilities of the previously generated words and the generation probability of the next target word at each time step. When the refinement probability is greater than the previous generation probability on the same position, we replace the original generated target word with the revised target word. These refined target words together with the currently generated target word further provide an accurate target historical context for the generation of subsequent target words. Additionally, the proposed approach is easily introduced into the auto-regressive decoder without complex modification. We extensively evaluated it on three widely-used machine translation benchmarks, including WMT14 English-to-German, WMT14 English-to-French, and WMT17 Chinese-to-English, and the experimental results demonstrated the effectiveness of the proposed approach. + +# 2 Background + +In this paper, we use the advanced encoder-decoder framework, Transformer (Vaswani et al., 2017), to introduce the language generation models. To simplify the process, we simply format the main self-attention network (SAN) module and do not involve other modules (e.g., positional encoding, multiple stacked layers, and so on). Encoder represents the source input $X = \{x_{1},\dots ,$ + +$x_{J}\}$ as the source representation $\mathbf{H} = \{\mathbf{h}_1,\dots ,$ $\mathbf{h}_{J}\}$ using SANs. Decoder then generates the target sentence word-by-word based on $\mathbf{H}$ with attention mechanism and the generated target fragment. Specifically, given a sequence of word vectors in the generated target fragment $\{\mathbf{E}[y_1],\dots ,$ $\mathbf{E}[y_{i - 1}]\}$ (E is the embedding matrix of the target language vocabulary), they are packed into keyvalue matrices $\mathbf{K}_{i - 1}$ and $\mathbf{V}_{i - 1}$ at the $i$ -th time-step: + +$$ +\mathbf {K} _ {i - 1} = \mathbf {V} _ {i - 1} = \mathbf {M} (\mathbf {E} [ y _ {1} ], \dots , \mathbf {E} [ y _ {i - 1} ]), \tag {1} +$$ + +where the function $\mathbf{M}(\cdot)$ packs a sequence of word vectors into a matrix. Another SelfATT $_s$ module is then used to learn the target representation $\mathbf{s}_i$ : + +$$ +\mathbf {s} _ {i} = \operatorname {S e l f A T T} _ {s} \left(\mathbf {c} _ {i - 1}, \mathbf {K} _ {i - 1}, \mathbf {V} _ {i - 1}\right), \tag {2} +$$ + +where $\mathbf{c}_{i - 1}\in \mathbb{R}^{d_{model}}$ is the previous context vector and $d_{model}$ is the dimension of language generation model. $\mathbf{s}_i$ is then fed into another SelfATT to compute the dependent-time context vector $\mathbf{c}_i$ : + +$$ +\mathbf {c} _ {i} = \operatorname {S e l f A T T} _ {c} \left(\mathbf {s} _ {i}, \mathbf {K} _ {e}, \mathbf {V} _ {e}\right), \tag {3} +$$ + +where $\mathbf{K}_e$ and $\mathbf{V}_e$ are key and value matrices, respectively, that are transformed from the source representation $\mathbf{H}$ according to Eq.(1). The probability distribution $P_{g}(y_{i}|y_{< i},X)$ is then computed using the MLP layer: + +$$ +P _ {g} \left(y _ {i} \mid y _ {< i}, X\right) \propto \operatorname {M L P} \left(\mathbf {c} _ {i}\right). \tag {4} +$$ + +$y_{i}$ with the maximum probability is selected as the output of decoder at the $i$ -th time-step. To obtain the language generation model $\theta$ , the training objective maximizes the conditional generation probability over the training dataset $\{[\mathbf{X},\mathbf{Y}]\}$ : + +$$ +\mathcal {J} (\theta) = P _ {g} (\mathbf {Y} | \mathbf {X}; \theta). \tag {5} +$$ + +![](images/89d3dba7c437db45ec37de4541c3342c2bd2d6ce78b4046b575adcfecfc0da55.jpg) +(a) Auto-regressive decoder. + +![](images/e19a169c54ab996def7a7e739bd237379314528c90f66ca839ae45453b3194d6.jpg) +(b) Auto-regressive decoder with synchronous refinement. +Figure 2: (a) The auto-regressive decoder; (b) The auto-regressive decoder with synchronous refinement where red and black arrows denote the refinement data flow and the generation data flow. + +# 3 Methodology + +Intuitively, when there is a target sentence with several incorrect target words, a native target language speaker often detects incorrect words according to the contextual information and tries to revise them. We infer that there are two key aspects in the artificial refinement process: i) How to identify those incorrect target words based on the context information; ii) How to revise the identified incorrect target words. To this end, we propose to simulate the above artificial refinement process, to refine the previously generated target words and generate the next target word synchronously. + +# 3.1 Synchronous Refinement + +Formally, at the $i$ -th time step, given a key-value matrix pair $\{\mathbf{K}_{i-1}, \mathbf{V}_{i-1}\}$ (see Eq.(1)) of the generated target language fragment $\{\mathbf{E}[y_1], \mathbf{E}[y_2], \dots, \mathbf{E}[y_{i-1}]\}$ , we first pack the context vectors $\{\mathbf{c}_1, \mathbf{c}_2, \dots, \mathbf{c}_{i-1}\}$ to generate the previous target words into a matrix $\mathbf{C}_{i-1}$ using Eq.(1): + +$$ +\mathbf {C} _ {i - 1} = \mathbf {M} \left(\mathbf {c} _ {1}, \mathbf {c} _ {2}, \dots , \mathbf {c} _ {i - 1}\right). \tag {6} +$$ + +We then use $\mathbf{C}_{i-1}$ instead of $\mathbf{c}_{i-1}$ in Eq. (2) to learn the target representation matrix $\mathbf{S}_i$ : + +$$ +\mathbf {S} _ {i} = \operatorname {S e l f A T T} _ {s} \left(\mathbf {C} _ {i - 1}, \mathbf {K} _ {i - 1}, \mathbf {V} _ {i - 1}\right), \tag {7} +$$ + +where $\mathbf{S}_i\in \mathbb{R}^{i\times d_{model}}$ is a matrix which includes the updated target representations of previously generated target words $\{\mathbf{s}_1',\mathbf{s}_2',\dots ,\mathbf{s}_{i - 1}'\}$ in addition to the current target representation $\mathbf{s}_i$ . Here, for each of the previously generated target words, SelfATT $s$ considers a subset of the future target context to update its target representation. For example, $\mathbf{s}_3'$ of $y_{3}$ encodes its future target words $\{y_3,\dots ,y_{i - 1}\}$ in addition to its previous + +target words $\{y_{1}, y_{2}\}$ . The target future context, which has been shown to be useful for generating the target language in machine translation (Zhang et al., 2018; Zheng et al., 2018; Zhou et al., 2019; Zheng et al., 2019), provides more evidence information for correcting one among all the generated target words in this paper. + +Then, $\mathbf{S}_i$ is fed into Eq. (3) to learn a sequence of the context vectors $\mathbf{C}_i$ : + +$$ +\mathbf {C} _ {i} = \operatorname {S e l f A T T} _ {c} \left(\mathbf {S} _ {i}, \mathbf {K} _ {e}, \mathbf {V} _ {e}\right), \tag {8} +$$ + +where $\mathbf{C}_i\in \mathbb{R}^{i\times d_{model}}$ is a matrix which includes the updated context vectors of previously generated target words $\{\mathbf{c}_1^{\prime},\dots ,\mathbf{c}_{i - 1}^{\prime}\}$ in addition to the current context vector $\mathbf{c}_i$ . We then use $\mathbf{C}_i$ as the input to Eq.4 to obtain the combined probabilities: + +$$ +P _ {r} \left(y _ {1} ^ {\prime}, \dots , y _ {i - 1} ^ {\prime}, y _ {i} \mid y _ {< i}, X\right) \propto \operatorname {M L P} \left(\mathbf {C} _ {i}\right), \tag {9} +$$ + +where $P_{r}(\cdot)$ includes $i - 1$ additional refinement probability distributions at each time step $i$ . That is, $\{y_1', \dots, y_{i-1}'\}$ provides a potential error set for revising the generated target words. Furthermore, we select target words with max probabilities from refinement probability distributions as the target candidate words to be refined. When each refinement probability of $\{y_1', \dots, y_{i-1}'\}$ is greater than its counterpart in the generation probability $\{y_1, \dots, y_{i-1}\}$ at previous time steps, the previously generated target word $y_k$ ( $0 < k < i$ ) will be replaced with the refined target word $y_k'$ . Finally, the revised target fragment $\{\hat{y}_1, \dots, \hat{y}_{i-1}, y_i\}$ are computed: + +$$ +\begin{array}{l} P \left(\hat {y} _ {1}, \dots , \hat {y} _ {i - 1}, y _ {i} \mid y _ {< i}, X\right) = \\ \max \left[ P _ {g} \left(y _ {1}, \dots , y _ {i - 1}, 0 \mid y _ {< i}, X\right), \right. \\ P _ {r} \left(y _ {1} ^ {\prime}, \dots , y _ {i - 1} ^ {\prime}, y _ {i} \mid y _ {< i}, X\right) ]. \tag {10} \\ \end{array} +$$ + +
i-th time-stepfull refinement mask
11111111
21111110
31111111
41111111
51111110
61111111
71111111
81111111
+ +(a) Full refinement mask. + +
i-th time-steprefinement mask
111110000
211100000
311111000
411111110
511111110
611111111
711111111
811111111
+ +(b) Refinement mask for local constraint. + +Figure 3: Full refinement mask and refinement mask with local constraint (i.e., $N = 3$ ) for learning the target representation during the training, and red number denotes the used future context in the proposed synchronous refinement. + +Note that during the inference, the greedy search was used to refine previously generated target words while beam search was only used to generate the next target word. This makes the search complexity of decoding with refinement as consistent as that of the original decoding with beam search, thereby efficiently performing the synchronous refinement in the existing autoregressive decoding. + +# 3.2 Local Constraint + +For the proposed synchronous refinement, most of the generated target words will be refined many times, that is, the number of refinement operations is proportional to the length of the final target sentence. However, the native target language speaker may only revise the previously generated target words a few times. Thus, there may be a potential risk of "over-refinement" in the synchronous refinement, that is, excessive refinement operations may lead to new errors. To reduce the risk of "over-refinement", we further design a local constraint (see Figure 2) that focuses on refining part of the previously generated target words closest to the target word to be omitted at each time step, inspired by the local attention (Luong et al., 2015) and the fixed iteration prediction (Ghazvininejad et al., 2019). Specifically, in the $i$ -th time step, we select $N$ previously generated target words $\{\mathbf{E}[y_{i-N}], \mathbf{E}[y_{i-N+1}], \dots, \mathbf{E}[y_{i-1}]\}$ closest to the target word to be omitted, and pack the context vectors $\{\mathbf{c}_{i-N}, \mathbf{c}_{i-N+1}, \dots, \mathbf{c}_{i-1}\}$ into $\mathcal{C}_{i-1}'$ : + +$$ +\mathcal {C} _ {i - 1} ^ {\prime} = \mathrm {M} \left(\mathbf {c} _ {i - N}, \mathbf {c} _ {i - N + 1}, \dots , \mathbf {c} _ {i - 1}\right). \tag {11} +$$ + +Then, we feed the local target representation matrix $\mathbf{C}_{i-1}^{\prime}$ into Eq. (7) instead of $\mathbf{C}_{i-1}^{\prime}$ , and thereby + +efficiently focus on the revision of part of generated target words according to Eqs.8, 9, and 10 in turn. + +# 3.3 Model Training + +When the local constraint of the synchronous refinement is set to $N$ , each generated target word will be refined at most $N$ times. This may be inefficient for the training of machine translation models. To efficiently inject this synchronous refinement capability into the training of machine translation models, we introduce an additional refinement mask to select the target future context words under the local constraint. Compared with the existing lower triangle mask, the local constraint contains additional target future context words closest to the target word to be omitted, as shown in Figure 3. After a target word is generated, it will be refined in the subsequent $N$ sequential steps, which indicates that the number of future target words is different. Therefore, the refinement mask with local constraint is to randomly select future target words not greater than $N$ to cover a variety of different future contexts as blue parts in Figure 3. + +Then, we use the proposed refinement mask to learn the generation and refinement context vectors at each time step. This allows the machine translation models to synchronously simulate the generation of generated target words and the refinement of the current target word during the training. Thus, the training objective maximizes the generation and the refinement probabilities over the training dataset $\{[\mathbf{X},\mathbf{Y}]\}$ : + +$$ +\mathcal {J} (\theta) = P _ {g} (\mathbf {Y} | \mathbf {X}; \theta) + P _ {r} (\mathbf {Y} | \mathbf {X}; \theta). \tag {12} +$$ + +Note that the proposed refinement mechanism retains the auto-regressive property of decoder + +
MethodsEn-DeZh-EnEn-Fr
BLEU#Speed1.#Speed2.#Param.BLEUBLEU
Trans.base27.6713.2k3.7k65.0M24.2838.42
+Deliberation (Xia et al., 2017)28.1111.1k3.1k77.8M24.6238.94
+Two-stream (Song et al., 2020)28.1711.8k3.4k79.3M24.7639.17
+SynRefinement28.37+12.6k3.5k65.0M24.98++39.46++
Trans/big28.5711.2k2.8k221.2M24.8441.21
+Deliberation (Xia et al., 2017)28.969.3k2.2k267.6M24.9741.59
+Two-stream (Song et al., 2020)29.119.7k2.3k272.4M25.0641.55
+SynRefinement29.22++10.1k2.5k221.2M25.18+41.97+
+ +Table 1: Main results of Trans.base/big, +SynRefinement, and comparison +Deliberation and +Two-stream models for standard machine translation tasks. “#Speed1.” and “#Speed2.” denote the training and decoding speeds (tokens/sec, k for thousand), and “#Param.” denotes the size of model parameters (M for million). “+/++” after BLEU scores indicate that our approach was significantly better than Trans.base/big models at significance levels p<0.05/0.01 (Collins et al., 2005). Results were reported on average by conducting 3 runs of training. + +to ensure the fluency of the target sentence. Meanwhile, the refinement of the generated target words is synchronized with the generation of the current target word at each time step. Particularly, the proposed approach can be easily introduced into the encoder-decoder machine translation models without complex modifications. + +# 4 Experiments + +# 4.1 Setting and Data set + +We evaluated the proposed SynRefinement on three widely-used standard machine translation tasks: WMT14 $\mathrm{En} \Rightarrow \mathrm{De}$ includes 4.43 million bilingual sentence pairs, and we used the newstest2013 and newstest2014 datasets as the dev set and test set, respectively; WMT14 $\mathrm{En} \Rightarrow \mathrm{Fr}$ includes 36 million bilingual sentence pairs, and we used the newstest2013 and newstest2014 datasets as the dev set and test set, respectively; and WMT17 $\mathrm{Zh} \Rightarrow \mathrm{En}$ includes 22 million bilingual sentence pairs, and we used the newsdev2017 and newstest2017 datasets as the dev set and the test set, respectively. The byte pair encoding algorithm (Sennrich et al., 2016) was adopted, and the vocabulary size was set to 40K. We set the dimension of all input and output layers to 512, the dimension of the inner feedforward neural network layer to 1024, and the total heads of all multi-head modules to 8 in both the encoder and decoder layers. Each training batch consisted of a set of sentence pairs that contained approximately $4000 \times 8$ source tokens and $4000 \times 8$ target tokens. To evaluate the test sets, following the training of 200,000 batches, we used a single model obtained by averaging the last five checkpoints, which validated the + +model with an interval of 2,000 batches on the dev set. We trained all models on eight V100 GPUs and evaluated them on a single V100 GPU. We chose the Transformer NMT model (Vaswani et al., 2017) as our baseline. For other configurations of Transformer (e.g., Trans.base/big) models, we followed the settings in (Vaswani et al., 2017). We used the multi-bleu.perl script as the evaluation metric for the three translation tasks. + +# 4.2 Translation Results + +Table 1 showed BLEU scores of the baseline Trans.base/big models, +SynRefinement, +Deliberation (Xia et al., 2017) and +Two-stream (Song et al., 2020) attention models for comparison. First, +SynRefinement performed better than the baseline Trans.base/big models for three language pairs. This indicates that the proposed refinement mechanism improved the performance of NMT. Second, +SynRefinement was superior to the comparison +Deliberation network model, which confirms our hypothesis that jointly simulating generation and refinement of target sentence was better than the isolated multi-pass decoding way. Additionally, +SynRefinement outperformed the comparison +Two-stream attention model. Also, +SynRefinement did not increase any additional model parameters but +Two-stream attention increased about $19.7\%$ model parameters compared to the baseline Trans.base model. Meanwhile, both training and decoding speeds of +SynRefinement were faster than those of +Deliberation and +Two-stream models. This means that the proposed refinement can more efficiently relieve the "one-pass" issue for the machine translation. + +![](images/457c50cc38eb6972a38379c34cf60087ee06a0c1695456c7573a3a33ad9ac92f.jpg) +Figure 4: BLEU scores for Trans.base and +SynRefinement models for various hyperparameters $N$ ( $x$ -axis) on three translation tasks. + +![](images/59efd22ac873c23f721ebe3dccfabe42273d368e35a1363a8d3ddad304ea8b80.jpg) + +![](images/6938b5ccf8ecbd8e2ea3ce2db8f7829521066167a28ee6627ff34e2d1f489f00.jpg) + +# 4.3 Hyperparameter $N$ of SynRefinement + +In Section 3.3, we designed a local constraint to reduce the "over-refinement" risk. Thus, the hyperparameter $N$ in Eq. (11) was used to control the range of refinement operations. Figure 4 shows BLEU scores for Trans.base and +SynRefinement models for various hyperparameter $N$ ( $x$ -axis) on the WMT14 En-De, WMT17 Zh-En, and WMT14 En-Fr dev sets. +SynRefinement achieved the highest BLEU scores with $N = 5$ for three dev sets. As a result, we set the hyperparameter $N$ as five to conduct the main experiments shown in Table 1. + +# 4.4 Ablation of Local Constraint and Refinement Mask + +
MethodsEn-DeZh-EnEn-Fr
Trans.base27.5724.2838.42
+Refinement Mask27.7324.3938.78
+Local Constraint27.8924.6238.95
+Both28.3724.9839.46
+ +We incrementally added Refinement Mask and Local Constraint into the training and decoding passes of Trans.base model to evaluate their effectiveness. Table 3 showed the ablation results of Trans.base, +Refinement Mask, +Local Constraint, and Both (+Refinement Mask+Local Constraint) models. First, when Refinement Mask and Local Constraint were introduced to the training and the decoding, respectively, BLEU scores were higher than those of the Trans.base model on three translation tasks. The proposed approach was beneficial to the + +performance improvement of NMT. Second, when both Refinement Mask and Local Constraint were introduced into the training and decoding of the Trans.base model simultaneously, performance improved further. This means that maintaining consistent refinement operations in training and decoding helped NMT generate faithful and fluent target translation. + +# 4.5 Investigation of SynRefinement Operation + +Table 2: Ablation results of local constraint and refinement mask. + +
Refinement timesEn-DeZh-EnEn-Fr
#11,8291,1392,187
#21,1216211,431
#3691403896
#4277189382
#5169107189
Total4,0872,4595,085
+ +Table 3: Statistical results for different refinement times on the same position for three translation tasks. + +The proposed SynRefinement aims to revise potential errors in the generated target words. To investigate the effectiveness of synchronous refinement operations, we counted the number of different refinement times (e.g., replacement and deletion operation) on the same position during the inference. For example, "#2" denotes the number of BPE tokens that have been replaced (or refined) twice during the decoding. Table 3 showed statistical results for translations (include 74,487, 57,497 and 92,207 BPE tokens, respectively) of three translation tasks generated by Trans.base+SynRefinement models in Table 1. We observed that among the translations generated + +Figure 5: BLEU scores of various target translation lengths for the three translation tasks. +Figure 6: Chinese-to-English translation cases generated by Trans.base and +SynRefinement models. Note: English words in color are translations from the corresponding Chinese words with the same color. +![](images/bc79934ebb0264f00187149ccda5075d0961f1257a99648353641595a6a73204.jpg) +Src: 上海市 松江区 交管部门 近期 使用 电子 警察 整治 驾驶员 [Shanghai] [Songjiang District] [Traffic Control Department] [recently] [used] [electronic] [police] [monitor] [driver] 开车 玩 手机,一个星期 查获 30 多 起 [driving] [plays] [mobile phone] [in a week] [detected] [30] [more than] [cases] +Trans.base: traffic control department of Songjiang District in Shanghai recently used electronic police to clean up drivers' mobile phone, more than 30 seizures a week ++SynRefinement: traffic control department of Songjiang District in Shanghai recently used electronic police to monitor that the driver plays mobile phone, and discovered more than 30 cases in a week +Ref: Shanghai Songjiang District Traffic Control Department recently used electronic police to monitor whether the driver plays mobile phone while driving and detected more than 30 cases in a week + +on the three tasks, total refinement operations of the same position occurred in 4,087, 2,459, and 5,058 positions, respectively. This indicates that the proposed SynRefinement worked during the decoding. When refinement times gradually increased from #1 to #5 on the same position, the number of such BPE tokens was greatly reduced. + +# 4.6 Effect of Different Target Lengths + +In the proposed SynRefinement, the number of refined words increased as the length of the generated target translation increased. To investigate the effect of SynRefinement on translations with different lengths, we divided each test set into six groups according to the length of the target translations. For example, "20" indicates that the length of target translations was between twenty and thirty. Figure 5 shows BLEU scores of the Trans.base and +SynRefinement models for the WMT14 En-De, WMT17 Zh-En, and WMT14 En-Fr test sets. + +First, when the length of target translations was between zero and ten, BLEU scores of +SynRefinement were almost the same as those + +of Trans.base model. This reason may be that the refinement operation was performed from the fifth time step for three translation tasks. Second, when the length of the target translations was more than ten, BLEU scores of $+\mathrm{SynRefinement}$ were higher than those of Trans.base models for three translation tasks. Particularly, the extent of the improvement gradually increased as the length of the target translations increased. This means that $+\mathrm{SynRefinement}$ improved the quality of the target translations, especially long target translations. + +# 4.7 Case Study + +Figure 6 showed Chinese-to-English translation cases generated by Trans.base and +SynRefinement models. Trans.base first generated an inappropriate translation "clean up" and missed two key verbs "plays" and "detected", and thereby generated a incorrect translation "seizures" compared to the "Ref". Thus, the meaning in the target fragment was extremely confusing after "clean up" in the translation generated by the Trans.base model. +SynRefinement considered the future context "that the driver mobile phone" together + +with the past context "traffic ... police to" to revise "clean up" as the correct "monitor". "monitor" constituted part of the target historical context which allowed +SynRefinement model to generate two missed key verbs "plays" and "discovered". +SynRefinement further generated the correct target word "cases" compared to the inappropriate "seizures". As a result, the translation generated by +SynRefinement was closer to the reference than that generated by the Trans.base model. + +# 5 Related Work + +# 5.1 Automatic Post-Editing + +For the refinement of target output in the classical machine translation (MT), a direct method is automatic post-editing (APE) (Simard et al., 2007). APE is the process of automatic correction of raw MT output, so that a closer resemblance to human post-edited MT output is achieved. Bechara et al. (2011) proposed to automatically create a new joined MT output and source token pairs to improve the automatic post-editing results (Bechara et al., 2012; Pal et al., 2017). Also, the MT output is refined by humans or another model (Niehues et al., 2016; Junczys Dowmunt and Grundkiewicz, 2017), which indicates that the generating and refining are two separate processes in APE. + +# 5.2 Two-Pass Auto-regressive Decoding + +As the encoder-decoder framework becomes the dominant machine translation method, the generated potential errors caused by the "one-pass" issue still is a challenge. Many studies proposed two-pass decoding to revise the fixed potential errors in the auto-regressive machine translation (Yang et al., 2016; Xia et al., 2017; Zhang et al., 2018; Geng et al., 2018; Zhou et al., 2019; Nema et al., 2019; Song et al., 2020). For example, review network (Yang et al., 2016) was proposed to refine the source representation for the caption generation model. Compared with reviewing the source information, a deliberation network (Xia et al., 2017) proposed two levels of decoders which generate a draft of the target sentence and polish the draft of the target sentence for MT, respectively. Additionally, most relevant to our work is that Song et al. (2020) leveraged the scheduled sampling to simulate the prediction errors during training and designed an additional content-stream attention network to correct the generated error information, which + +requires complex two-stream attention (Yang et al., 2019) or dual attention (Novak et al., 2016). The refinement network (Nema et al., 2019) for the QA task used a dual attention network to refine the question generated by the first decoder, thereby making the answer correct in the second decoder. + +# 5.3 Iterative Refinement for Non-autoregressive Decoding + +Non-autoregressive decoding (Gu et al., 2018) was introduced to generate all words at once, but its performance was far away from that of the auto-regressive decoding due to lack of sufficient dependency modeling among target words. Lee et al. (2018) designed an iterative inference strategy to minimize the generation latency. Then, Ghazvininejad et al. (2019) proposed to first predict all of the target words non-autoregressively, and then repeatedly masked out and regenerated the subset of words for iterative refining the target translation. Different from the refinement of discrete target words, the iterative inference (Lee et al., 2020) was proposed to iterative perform refinement in the continuous space for enhancing dependency between target words. + +Discussion: Inspired by iterative refinement for non-autoregressive decoding, we proposed a novel synchronous refinement for machine translation. The proposed approach differs from previous studies in two ways. First, our method allows the machine translation models to refine the previously generated target words and to generate the current target word synchronously instead of APE with separate refinement and asynchronous two-pass (or multi-pass) decoding. Second, the proposed SynRefinement can be introduced to the machine translation models efficiently without complex modification of the existing machine translation models. Additionally, the proposed SynRefinement can help the real-time machine translation scenarios to satisfy the practical application requirements. + +# 6 Conclusion + +This paper explored part of the target future context to revise fixed potential errors in the generated target fragment caused by the "one-pass" issue of the auto-regressive decoder. We proposed a novel SynRefinement approach to the machine translation, where the refinement of generated target words is synchronized with the + +generation of the next target word at each timestep. Meanwhile, the proposed SynRefinement can be easily introduced into the encoder-decoder framework without complex modifications. We evaluated the effectiveness of the proposed approach on three classical machine translation tasks. In the future, we will try to explore how to intelligently identify and correct generation errors. + +# Acknowledgments + +We are grateful to the anonymous reviewers, area chair, senior area chair, and program committee for their insightful comments and suggestions. Min Zhang was partially supported by the National Natural Science Foundation of China (No. 62036004). Rui Wang is with MT-Lab, Department of Computer Science and Engineering, School of Electronic Information and Electrical Engineering, and also with the MoE Key Lab of Artificial Intelligence, AI Institute, Shanghai Jiao Tong University, Shanghai 200204, China. + +# References + +Farhad Akhbardeh, Arkady Arkhangorodsky, Magdalena Biesialska, Ondrej Bojar, Rajen Chatterjee, Vishrav Chaudhary, Marta R. Costa-jussa, Cristina Espana-Bonet, Angela Fan, Christian Federmann, Markus Freitag, Yvette Graham, Roman Grundkiewicz, Barry Haddow, Leonie Harter, Kenneth Heafield, Christopher Homan, Matthias Huck, Kwabena Amponsah-Kaakyire, Jungo Kasai, Daniel Khashabi, Kevin Knight, Tom Kocmi, Philipp Koehn, Nicholas Lourie, Christof Monz, Makoto Morishita, Masaaki Nagata, Ajay Nagesh, Toshiaki Nakazawa, Matteo Negri, Santanu Pal, Allahsera Auguste Tapo, Marco Turchi, Valentin Vydrin, and Marcos Zampieri. 2021. Findings of the 2021 conference on machine translation (WMT21). In Proceedings of the Sixth Conference on Machine Translation, pages 1-88, Online. Association for Computational Linguistics. +Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. 2015. Neural machine translation by jointly learning to align and translate. In International Conference on Learning Representations, San Diego, CA. +Loic Barrault, Magdalena Biesialska, Ondrej Bojar, Marta R. Costa-jussa, Christian Federmann, Yvette Graham, Roman Grundkiewicz, Barry Haddow, Matthias Huck, Eric Joanis, Tom Kocmi, Philipp Koehn, Chi-kiu Lo, Nikola Ljubesic, Christof Monz, Makoto Morishita, Masaaki Nagata, Toshiaki Nakazawa, Santanu Pal, Matt Post, and Marcos Zampieri. 2020. Findings of the 2020 conference on machine translation (WMT20). In Proceedings + +of the Fifth Conference on Machine Translation, pages 1-55, Online. Association for Computational Linguistics. +Hanna Bechara, Raphaël Rubino, Yifan He, Yanjun Ma, and Josef van Genabith. 2012. An evaluation of statistical post-editing systems applied to RBMT and SMT systems. In Proceedings of COLING 2012, pages 215-230, Mumbai, India. The COLING 2012 Organizing Committee. +Hanna Bechara, Ma Yanjun, and Genabith Josef van. 2011. Statistical post-editing for a statistical mt system. In the 13th Machine Translation Summit, page 308-315, Xiamen, China. +Michael Collins, Philipp Koehn, and Ivona Kucerova. 2005. Clause restructuring for statistical machine translation. In Proceedings of the 43rd Annual Meeting of the Association for Computational Linguistics, pages 531-540, Ann Arbor, Michigan. Association for Computational Linguistics. +Xinwei Geng, Xiaocheng Feng, Bing Qin, and Ting Liu. 2018. Adaptive multi-pass decoder for neural machine translation. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 523-532, Brussels, Belgium. Association for Computational Linguistics. +Marjan Ghazvininejad, Omer Levy, Yinhan Liu, and Luke Zettlemoyer. 2019. Mask-predict: Parallel decoding of conditional masked language models. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 6112-6121, Hong Kong, China. Association for Computational Linguistics. +Jiatao Gu, James Bradbury, Caiming Xiong, Victor O.K. Li, and Richard Socher. 2018. Nonautoregressive neural machine translation. In International Conference on Learning Representations. +Marcin Junczys Dowmunt and Roman Grundkiewicz. 2017. An exploration of neural sequence-to-sequence architectures for automatic post-editing. In Proceedings of the Eighth International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 120-129, Taipei, Taiwan. Asian Federation of Natural Language Processing. +Jason Lee, Elman Mansimov, and Kyunghyun Cho. 2018. Deterministic non-autoregressive neural sequence modeling by iterative refinement. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 1173-1182, Brussels, Belgium. Association for Computational Linguistics. +Jason Lee, Raphael Shu, and Kyunghyun Cho. 2020. Iterative refinement in the continuous space for + +non-autoregressive neural machine translation. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 1006-1015, Online. Association for Computational Linguistics. +Thang Luong, Hieu Pham, and Christopher D. Manning. 2015. Effective approaches to attention-based neural machine translation. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pages 1412-1421, Lisbon, Portugal. Association for Computational Linguistics. +Preksha Nema, Akash Kumar Mohankumar, Mitesh M. Khapra, Balaji Vasan Srinivasan, and Balaraman Ravindran. 2019. Let's ask again: Refine network for automatic question generation. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 3314-3323, Hong Kong, China. Association for Computational Linguistics. +Jan Niehues, Eunah Cho, Thanh-Le Ha, and Alex Waibel. 2016. Pre-translation for neural machine translation. In Proceedings of COLING 2016, the 26th International Conference on Computational Linguistics: Technical Papers, pages 1828-1836, Osaka, Japan. The COLING 2016 Organizing Committee. +Roman Novak, Michael Auli, and David Grangier. 2016. Iterative refinement for machine translation. CoRR, abs/1610.06602. +Santanu Pal, Sudip Kumar Naskar, Mihaela Vela, Qun Liu, and Josef van Genabith. 2017. Neural automatic post-editing using prior alignment and reranking. In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics: Volume 2, Short Papers, pages 349-355, Valencia, Spain. Association for Computational Linguistics. +Rico Sennrich, Barry Haddow, and Alexandra Birch. 2016. Neural machine translation of rare words with subword units. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1715-1725, Berlin, Germany. Association for Computational Linguistics. +Michel Simard, Cyril Goutte, and Pierre Isabelle. 2007. Statistical phrase-based post-editing. In Human Language Technologies 2007: The Conference of the North American Chapter of the Association for Computational Linguistics; Proceedings of the Main Conference, pages 508-515, Rochester, New York. Association for Computational Linguistics. +Kaitao Song, Xu Tan, and Jianfeng Lu. 2020. Neural machine translation with error correction. In Proceedings of the Twenty-Ninth International Joint + +Conference on Artificial Intelligence, IJCAI-20, pages 3891-3897. International Joint Conferences on Artificial Intelligence Organization. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In Advances in Neural Information Processing Systems 30, pages 5998-6008. Curran Associates, Inc. +Yingce Xia, Fei Tian, Lijun Wu, Jianxin Lin, Tao Qin, Nenghai Yu, and Tie-Yan Liu. 2017. Deliberation networks: Sequence generation beyond one-pass decoding. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, editors, Advances in Neural Information Processing Systems 30, pages 1784-1794. Curran Associates, Inc. +Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Russ R Salakhutdinov, and Quoc V Le. 2019. Xlnet: Generalized autoregressive pretraining for language understanding. In Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc. +Zhilin Yang, Ye Yuan, Yuexin Wu, William W. Cohen, and Ruslan R. Salakhutdinov. 2016. Review networks for caption generation. In Proceedings of the 30th International Conference on Neural Information Processing Systems, page 2369-2377, Barcelona, Spain. Curran Associates Inc. +Xiangwen Zhang, Jinsong Su, Yue Qin, Yang Liu, Rongrong Ji, and Hongji Wang. 2018. Asynchronous bidirectional decoding for neural machine translation. In Proceedings of the Thirty-Second AAAI Conference on Artificial Intelligence, (AAAI-18), the 30th innovative Applications of Artificial Intelligence (IAAI-18), and the 8th AAAI Symposium on Educational Advances in Artificial Intelligence (EAAI-18), pages 5698-5705, New Orleans, Louisiana, USA. AAAI Press. +Zaixiang Zheng, Shujian Huang, Zhaopeng Tu, XinYu Dai, and Jiajun Chen. 2019. Dynamic past and future for neural machine translation. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 931-941, Hong Kong, China. Association for Computational Linguistics. +Zaixiang Zheng, Hao Zhou, Shujian Huang, Lili Mou, Xinyu Dai, Jiajun Chen, and Zhaopeng Tu. 2018. Modeling past and future for neural machine translation. Transactions of the Association for Computational Linguistics, 6:145-157. +Long Zhou, Wenpeng Hu, Jiajun Zhang, and Chengqing Zong. 2017. Neural system combination for machine translation. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), + +pages 378-384, Vancouver, Canada. Association for Computational Linguistics. +Long Zhou, Jiajun Zhang, and Chengqing Zong. 2019. Synchronous bidirectional neural machine translation. Transactions of the Association for Computational Linguistics, 7:91-105. \ No newline at end of file diff --git a/synchronousrefinementforneuralmachinetranslation/images.zip b/synchronousrefinementforneuralmachinetranslation/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..cfdf221895d26f953d3fac149b9297cf31836d77 --- /dev/null +++ b/synchronousrefinementforneuralmachinetranslation/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eb2656ec16fefdaab1bc7410c6d8ecb17436e040b3c43543702506da52969e8e +size 341621 diff --git a/synchronousrefinementforneuralmachinetranslation/layout.json b/synchronousrefinementforneuralmachinetranslation/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..c80daff28e9b1a4befc8f503b961f10add06bc5f --- /dev/null +++ b/synchronousrefinementforneuralmachinetranslation/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2dee5155bf4e14e0d68faef40304816a5628cf27b6b33f2e469f697da289fff5 +size 342392 diff --git a/syntaxguidedcontrastivelearningforpretrainedlanguagemodel/4d85acb3-35b7-4d15-9b8d-0de164069d0e_content_list.json b/syntaxguidedcontrastivelearningforpretrainedlanguagemodel/4d85acb3-35b7-4d15-9b8d-0de164069d0e_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..6a2ae223519e509a330bcd02d70210f58f12ca56 --- /dev/null +++ b/syntaxguidedcontrastivelearningforpretrainedlanguagemodel/4d85acb3-35b7-4d15-9b8d-0de164069d0e_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2114b5517806e856180f6a5a626023e452644ea48b72cbd32a1c26fe81c88d9a +size 75938 diff --git a/syntaxguidedcontrastivelearningforpretrainedlanguagemodel/4d85acb3-35b7-4d15-9b8d-0de164069d0e_model.json b/syntaxguidedcontrastivelearningforpretrainedlanguagemodel/4d85acb3-35b7-4d15-9b8d-0de164069d0e_model.json new file mode 100644 index 0000000000000000000000000000000000000000..3670301667bd55518e4e7653f96e1c7dc8bda83c --- /dev/null +++ b/syntaxguidedcontrastivelearningforpretrainedlanguagemodel/4d85acb3-35b7-4d15-9b8d-0de164069d0e_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:571a84e29cb44e84954cfa6a2781ef2f1b5f0c0894957f58ae9b1ab4b2851d33 +size 92327 diff --git a/syntaxguidedcontrastivelearningforpretrainedlanguagemodel/4d85acb3-35b7-4d15-9b8d-0de164069d0e_origin.pdf b/syntaxguidedcontrastivelearningforpretrainedlanguagemodel/4d85acb3-35b7-4d15-9b8d-0de164069d0e_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..23d5b763d866aec60aee1e07d0881df0832f5376 --- /dev/null +++ b/syntaxguidedcontrastivelearningforpretrainedlanguagemodel/4d85acb3-35b7-4d15-9b8d-0de164069d0e_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e248b5369c2b9fe98e5a49f476d2f471bb72abf60935104fa4310b194d24fa46 +size 1193209 diff --git a/syntaxguidedcontrastivelearningforpretrainedlanguagemodel/full.md b/syntaxguidedcontrastivelearningforpretrainedlanguagemodel/full.md new file mode 100644 index 0000000000000000000000000000000000000000..e658c09db30a34222b1900f9ed34ab5ac1148c10 --- /dev/null +++ b/syntaxguidedcontrastivelearningforpretrainedlanguagemodel/full.md @@ -0,0 +1,268 @@ +# Syntax-guided Contrastive Learning for Pre-trained Language Model + +Shuai Zhang, Lijie Wang, Xinyan Xiao, Hua Wu + +Baidu Inc, Beijing, China + +{zhangshuai28, wanglijie, xiaoxinyan, wu_hua} @baidu.com + +# Abstract + +Syntactic information has been proved to be useful for transformer-based pre-trained language models. Previous studies often rely on additional syntax-guided attention components to enhance the transformer, which require more parameters and additional syntactic parsing in downstream tasks. This increase in complexity severely limits the application of syntax-enhanced language model in a wide range of scenarios. In order to inject syntactic knowledge effectively and efficiently into pre-trained language models, we propose a novel syntax-guided contrastive learning method which does not change the transformer architecture. Based on constituency and dependency structures of syntax trees, we design phrase-guided and tree-guided contrastive objectives, and optimize them in the pre-training stage, so as to help the pre-trained language model to capture rich syntactic knowledge in its representations. Experimental results show that our contrastive method achieves consistent improvements in a variety of tasks, including grammatical error detection, entity tasks, structural probing and GLUE. Detailed analysis further verifies that the improvements come from the utilization of syntactic information, and the learned attention weights are more explainable in terms of linguistics. + +# 1 Introduction + +Pre-trained transformer-based neural language models (LMs), such as BERT (Devlin et al., 2019) and RoBERTa (Liu et al., 2019), have achieved remarkable results in a variety of NLP tasks (Wang et al., 2018). However, many studies have found that these LMs do not encode enough syntactic knowledge in their learned representations (Wang et al., 2019; Min et al., 2020; Wang et al., 2020). As it is widely acknowledged that structural information is very important for NLP (Strubell et al., 2018; Nguyen et al., 2019; Zhang et al., 2020), there is an increasing interest in improving pre-trained LMs by using syntactic information. + +Most of these works enhance pre-trained LMs by adding syntax-driven attention components to the transformer (Li et al., 2020b; Xu et al., 2020; Bai et al., 2021). They use the added components to produce a syntax-aware representation, and inject this additional representation into the original one from the vanilla transformer, so as to get a final syntax-enhanced representation. Although these works did bring improvements, the additional syntax-aware layers obviously increase application inconvenience and computation complexity, as they need to parse the input text during testing and require more neural parameters. Moreover, the performance of such explicit method depends on the parsing quality of test data (Sachan et al., 2020). There are also some efforts on incorporating syntax-related objectives into the pre-training stage, such as syntax head prediction (Wang et al., 2020) and dependency distance prediction (Xu et al., 2020). However, these predictive pre-training tasks often fail to improve performance alone and need to work together with the additional attention components (Xu et al., 2020). Overall, it is still an open challenge to effectively and efficiently incorporate syntactic information into pre-trained LMs. + +In order to address the above problems, we propose Syntax-guided Contrastive Language Model (SynCLM). Based on contrastive learning, SynCLM uses syntactic information to create contrastive positive and negative examples, and uses them to help the pre-trained LM to learn rich syntactic knowledge through contrastive learning method. SynCLM only adds contrastive objectives in the pre-training stage, ensuring an effective and efficient utilization of syntax. + +Specifically, based on constituent and dependency structures of syntax trees, we propose phrase-guided and tree-guided contrastive objectives for pre-training, as shown in Figure 1. The constituent structure represents the grouping of words into phrases within an input according to constituency + +![](images/b7a9e956077b74c8817759d4b4c0a88bfa18574dbc458bee895e10845b800411.jpg) +Figure 1: Overview of our pre-training framework. $P$ and $N_{i}$ represent the positive sample and the $i$ -th negative sample, respectively. The phrase-guided contrastive objective is based on the constituent structure of inputs, focusing on using local syntactic information to guide the learning of attention distributions. The tree-guided objective is based on the dependency structure, using global syntactic information to enhance the hidden representations. + +grammar (Ford and Fox, 2002). Inspired by recent studies (Mareček and Rosa, 2019; Kim et al., 2020) which prove that LM's attention heads exhibit syntactic structure akin to constituency grammar, in order to better recognize phrases from attentions, we propose the phrase-guided contrastive objective to enhance attention learning by maximizing the similarity of attention distributions between words in the same phrase. The dependency structure further encodes the binary head-dependent relations between words, and the root node aggregates the semantic information of the whole structure from all its descendant words. To make the root node attend to its descendant nodes, we propose the tree-guided contrastive objective to enhance word representations by maximizing the similarity between the representation obtained from all tokens and that obtained from syntactically related tokens. The two contrastive objectives are jointly optimized during pre-training, so as to inject syntactic knowledge into pre-trained LMs. In summary, our contributions are as following: + +- We are the first to leverage the contrastive learning method to incorporate syntactic information into the pre-training stage. Our models can be directly applied to downstream tasks without introducing additional parameters and syntax parsing of inputs. In addition, our method is applicable to any arbitrary transformer-based pre-trained LM. + +Our code will be released. + +- Based on the constituency and dependency structure, we design two novel syntax-guided learning objectives to enhance the learning of attention weight distributions and hidden representations in the transformer. +- Extensive experiments show that our SynCLM achieves consistent improvements on tasks that are often used in related works, including grammatical error detection, entity-related tasks, structural probing task, and general evaluation tasks (GLUE). Detailed analysis verifies that the performance improvements come from the use of syntactic information, and the learned attention weights are more explainable in terms of linguistics. + +# 2 Related Work + +We first review studies on analyzing the linguistic knowledge learned by pre-trained LMs, and then we will introduce recent researches on incorporating linguistic knowledge into pre-trained LMs. + +Linguistic Studies on Pre-trained LMs As pretrained LMs (Devlin et al., 2019; Liu et al., 2019) continue to provide gains on NLP benchmarks, understanding what they have learned is very important, which can help us understand the reason + +behind their success and their limitations. Many studies aim to unveil linguistic structures from the representations learned by pre-trained LMs (Jawahar et al., 2019; Wang et al., 2019). Some works demonstrate that pre-trained LMs have learned syntactic information. Hewitt and Manning (2019) indicate that syntax information is implicitly embedded in BERT by learning a linear transformation to predict the syntactic depth of each word based on its representation. Jawahar et al. (2019) and Tenney et al. (2019) show that BERT captures syntactic features at lower layers and loses some of learned syntactic information at higher layers. However, some works show that pre-trained LMs do not capture adequate syntactic knowledge. Wang et al. (2019) find that certain syntactic structures may not be embedded in BERT, as the dependency weights calculated by BERT seem to be inconsistent with human intuitions of hierarchical structures. Min et al. (2020) prove that BERT need to recruit syntactic representations from the generated syntactically informative examples to improve model performance on syntax-aware examples. + +Based on these studies, we can find that pretrained LMs often fail to encode enough syntactic information in their representations and get poor performance on syntax-aware data. + +Syntax Enhanced Pre-trained LMs On the other hand, many works try to use syntax information to further improve models (Strubell et al., 2018; Nguyen et al., 2019; Zhang et al., 2020; Li et al., 2020b; Xu et al., 2020). + +Task oriented works attempt to inject syntactic knowledge into the transformer (Strubell et al., 2018; Nguyen et al., 2019; Bugliarello and Okazaki, 2020; Zhang et al., 2020). In the semantic role labeling task, Strubell et al. (2018) restrict each token to attend to its syntactic parent in an attention head and improve the model performance. In the machine translation task, Nguyen et al. (2019) incorporate a tree-structured attention into the transformer for helping encode syntactic information. Bugliarello and Okazaki (2020) propose a syntax-aware self-attention mechanism to incorporate syntactic knowledge into the model. In the machine reading comprehension task, Zhang et al. (2020) use syntactic information to guide the self-attention to pay no attention to the dispensable words. These works mainly inject syntactic information into attention mechanisms, and obtain performance gains. However, they confine to a certain task. + +Pre-training oriented works try to integrate syntactic information in a general way that can be applied to various NLP tasks. Inspired by the above researches, some studies (Xu et al., 2020; Li et al., 2020b; Bai et al., 2021) design various syntax-aware attention mechanisms. Despite different in detail, all of them use syntactic dependency relations to restrict the attention to important local regions. The syntax-aware attention can capture the information of important local regions according to syntactic structures, so as to obtain more benefits. Meanwhile, some works inject syntactic knowledge into pre-trained LMs via introducing new learning objectives, such as syntax head prediction (Wang et al., 2020) and dependency distance prediction (Xu et al., 2020). However, they need to work with additional syntax-guided attention methods (Xu et al., 2020). + +Notably, most of these works incorporate an explicit syntax-guided component into models during testing. This increases the computational complexity and application difficulty of the model, which may limit the application of model in broader NLP tasks. In order to address these problems, we propose a novel contrastive pre-training framework to incorporate syntactic knowledge into pre-trained LMs, without introducing computational complexity in downstream tasks. + +# 3 Methodology + +In this section, we first describe the two new contrastive learning objectives in our SynCLM. Then we introduce our pre-training framework and implementation details. + +# 3.1 Syntax-guide Contrastive Learning + +In order to facilitate the learning of syntax-aware representations, we propose two learning tasks which use syntactic structures to guide the learning of attention distributions and hidden representations in the transformer. Here, we will first introduce the transformer architecture and the contrastive learning method as background. Then we will introduce our two contrastive learning objectives, and the construction of positive and negative samples, which is the main challenge of contrastive learning. + +Transformer A Transformer (Vaswani et al., 2017) is a stack of self-attention layers where each layer (consisting of $H$ heads) transforms the input unit into a continuous representation. Given + +the input sentence $S$ with $n$ tokens, denoted as $\{t_1,t_2,\dots,t_n\}$ , we use $\mathbf{a}_i^{(l,h)}$ to represent the attention distribution of the $i$ -th token by the $h$ -th attention head on the $l$ -th layer, where $1\leq h\leq H$ and $1\leq l\leq L$ . We take the average of all heads' attention distributions on the $l$ -th layer as the final distribution of the $l$ -th layer, denoted as $\mathbf{a}_i^{(l,\overline{h})}$ . Finally, we use $\mathbf{z}_i^l$ to represent the intermediate hidden representation of token $i$ on the $l$ -th layer. + +Contrastive Learning Method Contrastive self-supervised learning (CSSL) (Wu et al., 2018; He et al., 2020) is a learning paradigm which aims to capture the intrinsic patterns and properties of input data without using human-provided labels. The basic idea of CSSL is to construct auxiliary tasks solely based on the input data, which is the key to CSSL, and force the network to learn meaningful representations by performing the auxiliary tasks well. The auxiliary tasks are learned by the contrastive learning loss. In this paper, we use InfoNCE function which is a variant of Noise Contrastive Estimation (NCE) (Gutmann and Hyvarinen, 2010) function for contrastive learning, as shown in Equation 1. + +$$ +L _ {c l} = - \log \frac {\exp \left(\frac {\sin (q , q ^ {+})}{\tau}\right)}{\exp \left(\frac {\sin (q , q ^ {+})}{\tau}\right) + \sum_ {i = 0} ^ {K} \exp \left(\frac {\sin (q , q _ {i} ^ {-})}{\tau}\right)} \tag {1} +$$ + +where $q$ is the original sample; $q^{+}$ and $q_{i}^{-}$ are the positive and the $i$ -th negative samples, respectively; $K$ is the number of negative samples. The sim() function can be any similarity function, such as cosine, Jensen-Shannon Divergence (Endres and Schindelin, 2003) and Hellinger distance (Beran, 1977). $\tau$ called temperature coefficient is a hyperparameter used in recent methods (Khosla et al., 2020; Yu et al., 2021). + +Phrase-guided Contrastive Learning Objective Some phrases can be recognized by using the similarity of attention distributions over words (Mareček and Rosa, 2019; Kim et al., 2020). To further improve the recognition, we propose to use prior phrase structure information to further guide the learning of attention distributions by maximizing the similarity of attention distributions between words in the same phrase. + +Given a sampled token $t_i$ , we randomly select a token in the same phrase $^2$ as its positive example, + +and select $K$ tokens outside the phrase as the contrastive negative examples. As shown in the sampled phrases of Figure 1, for the token "build", the token marked as $P$ is the positive example, and tokens marked as $N$ are negative examples. Then we use the contrastive learning loss (defined in Equation 1) for this learning task, and the corresponding sim() function is defined as follows: + +$$ +\begin{array}{l} s i m _ {\mathrm {p h r a s e}} = - J S D (\mathbf {a} _ {i} ^ {(l, \bar {h})} \parallel \mathbf {a} _ {s} ^ {(l, \bar {h})}) \\ = - \left(D _ {K L} \left(\mathbf {a} _ {i} ^ {(l, \bar {h})} \| \mathbf {m}\right) + D _ {K L} \left(\mathbf {a} _ {s} ^ {(l, \bar {h})} \| \mathbf {m}\right)\right) / 2 \\ w h e r e \quad \mathbf {m} = \left(\mathbf {a} _ {i} ^ {(l, \bar {h})} + \mathbf {a} _ {s} ^ {(l, \bar {h})}\right) / 2 \tag {2} \\ \end{array} +$$ + +where $JSD$ is short for Jensen-Shannon Divergence (Endres and Schindelin, 2003), and $D_{KL}$ for Kullback-Leibler Divergence (KLD) (Kullback and Leibler, 1951). The index $s$ indicates a sampled example of token $t_i$ , which may be positive or negative. Please note that there are many calculation choices for the $sim()$ function, such as cosine, JSD and KLD. In our early-stage preliminary experiments, we have experimented with JSD and KLD, and the former performs slightly better and thus is adopted in our framework. + +Tree-guided Contrastive Learning Objective The idea that the root of a syntax tree should pay more attention to its descendant nodes has been proved to be effective in attention-based models by existing syntax-aware attention mechanisms (Xu et al., 2020; Li et al., 2020b; Bai et al., 2021). Therefore, we propose a tree-guided contrastive learning objective to maximize the similarity between the global representation based on all input tokens and the syntax-aware representation based on syntactically related tokens. + +Given a sampled token $t_i$ , we derive its subtree from the entire dependency tree. As described by the sampled subtrees in Figure 1, the subtree of token "build" consists of all tokens dominated by token "build", and "build" is the root of the subtree. We use it as the positive tree, denoted as $T^{+}$ . Then we randomly replace no more than three tokens in $T^{+}$ with adjacent tokens to get the negative tree $T^{-}$ , and ensure that there is at least one same token in $T^{+}$ and $T^{-}$ , as shown by the other two subtrees in Figure 1. According to the above conclusion, the representation based on the tokens in the positive subtree should be closer to the original representation given by the pre-trained LM. We also use the contrastive learning loss in Equation 1 to optimize this learning objective, and the sim() function is + +defined as follows: + +$$ +\begin{array}{l} s i m _ {\text {t r e e}} = \operatorname {c o s i n e} \left(\mathbf {z} _ {i} ^ {l}, \sum_ {t _ {j} \in T _ {s}} e _ {i j} \mathbf {z} _ {j} ^ {l}\right) \\ w h e r e \quad e _ {i j} = \frac {\exp \left(\mathbf {z} _ {i} ^ {l} \cdot \mathbf {z} _ {j} ^ {l}\right)}{\sum_ {t _ {k} \in T _ {s}} \exp \left(\mathbf {z} _ {i} ^ {l} \cdot \mathbf {z} _ {k} ^ {l}\right)} \tag {3} \\ \end{array} +$$ + +where $T_{s}$ represents a sampled subtree of token $t_i$ , which may be positive or negative. And $z_{i}^{l}$ represents the intermediate hidden representation of token $i$ on the $l$ -th layer. + +# 3.2 Syntax-guided Pre-training Framework + +We then add the two contrastive learning objectives into traditional pre-training, so as to enhance vanilla pre-trained LM. The final loss for the pretraining is the summation of the training loss for masked language model (MLM) (Devlin et al., 2019) and two new proposed tasks, as shown below. + +$$ +L = L _ {\text {M L M}} + L _ {\text {p h r a s e}} + L _ {\text {t r e e}} +$$ + +Data for Pre-training We use BERT's pretraining data (Devlin et al., 2019) as our model's pre-training data, including documents from English Wikipedia and BookCorpus (Zhu et al., 2015). Then we use the pre-processing and BPE (Byte-Pair Encoding) tokenization from RoBERTa (Liu et al., 2019) to process the training data. The maximum length of input sequence is set to 512. + +To obtain syntactic structures for each sentence, we adopt a well-trained parsing model - Stanza $^3$ to automatically generate a syntax tree for each sentence. Because the pre-trained LM takes subwords as the input unit, for the word $u$ , we take its first subword as the root, and add edges connecting non-first subwords to the first subword. Since syntactic information is pre-processed in advance, syntax parsing only needs to be performed once in the entire process. In our work, it takes about one day to parse the pre-training data with 20 P40 GPUs. Then, syntactic information is used as the additional input in the pre-training stage. + +Implementation Details To accelerate the training process, we initialize parameters from RoBERTa models4 released by Liu et al. (2019). We use RoBERTa-base and RoBERTa-large to initialize our base and large models respectively. RoBERTa-base contains 12 layers, each of which + +
DatasetTrainTestClassMetric
CoLA8,5511,0632MCC
BLiMP040,000*Acc
FCE28,7312,7202/*Acc/F0.5
CoNLL-200314,0413,453*F1
OpenEntity1,9881,9889F1
SST-263,7491,8212Acc
MRPC3,6681,7252Acc/F1
QQP363,871390,6952Acc/F1
STS-B5,7491,379*Pea./Spr.
MNLI392,7029,7963Acc
QNLI104,7435,4632Acc
RTE2,4903,0002Acc
+ +Table 1: Statistics of datasets used in our work. “*” represents for the non-classification tasks. “Acc” is short for “accuracy”. “Pea.” and “Spr.” are abbreviations for “Pearson” and “Spearman correlation” respectively. + +has 12 heads and 768 hidden states. And RoBERTa-large contains 24 layers, each of which has 16 heads and 1024 hidden states. We set $l$ as the last hidden layer in Equation 2 and Equation 3. And the number of negative examples is set to 3. As our pre-trained LMs do not introduce additional parameters, the parameter sizes of our base and large models are the same as those of RoBERTa models. + +We pre-train our models with 16 32G NVIDIA V100 GPUs. The base model takes about four days and the large model takes about seven days. During the training process, in order to choose a well pretrained model, we evaluate the intermediate model per 10K steps, and terminate the training when the performance alteration (i.e., Perplexity of LMs) is below a certain threshold for five sequential evaluations. In the base setting, the batch size is 512, and the total steps are 300,000, 24,000 of which is the warm up steps. For the large model, the batch size is 256, and the total steps are 350,000, 30,000 of which is for warming up. + +# 4 Experiments + +First, we verify the effectiveness of SynCLM on several syntax-aware tasks, including grammatical error detection task (Section 4.1) and entity tasks (Section 4.2), which are often used for testing syntax pre-training models. Then, we test the effectiveness of SynCLM on more general tasks by using GLUE benchmark (Section 4.3). At last, detailed analysis is conducted to show the impact of incorporating syntactic knowledge (Section 4.4). + +Please note that $\uparrow$ in our reported results means statistically significant improvement over the baseline with p-value $< 0.05$ . Besides, for fair comparison, we report continue training results + +
ModelsBLiMP 1P/2P AccCoLA MCCFCE Acc/F0.5
BERT-large (Devlin)-/-63.9*- /57.3*
BiLSTM-Joint (Rei)-/--80.1/52.1
SLA-large (Li20)-/-64.5- /58.0
GPT-2 large (Rad19)78.0/81.6--/-
RoBERTa-base (Liu)74.9/78.563.683.3/68.6
+ continuous75.0/79.663.883.5/68.6
+ PHRASE75.5/81.264.583.9/69.0
+ TREE76.4/80.664.984.2/68.9
SynCLM-base77.3†/81.0†65.3†84.3†/69.2†
RoBERTa-base + SLA-/-64.283.2/68.3
+ PHRASE-/-65.183.7/67.3
+ TREE-/-65.884.3/68.4
SynCLM-base + SLA-/-66.3†83.6/68.7
RoBERTa-large (Liu)77.3/79.468.085.3/72.2
SynCLMg79.5†/81.1†69.3†86.1†/72.4
+ +Table 2: Results on GED datasets. Results with “ $\star$ ” are taken from Li et al. (2020b). Reported results of CoLA are a median over 5 runs, and those of FCE are the average over 5 runs. For BLiMP, we report accuracies for “one prefix” (1P) (Linzen et al., 2016) and “two prefix” (2P) (Wilcox et al., 2019). + +# (continuous) of RoBERTa5. + +The statistics of datasets adopted in this paper are summarized in Table 1. For datasets of GLUE, we use metrics reported in Devlin et al. (2019). For other datasets, we use popular metrics provided by dataset authors and other researchers. + +# 4.1 Grammatical Error Detection (GED) + +GED task aims to evaluate the grammatical acceptability of a given sentence. We use three popular public datasets, i.e., CoLA (Warstadt et al., 2019), BLiMP (Warstadt et al., 2020), and FCE (Yannakoudakis et al., 2011), to evaluate our models. For CoLA, we use Matthews Correlation Coefficient (MCC) (Matthews, 1975) as the evaluation metric. For BLiMP, we evaluate models using the overall accuracy on all input pairs, namely the proportion of pairs whose acceptable sentence is assigned a higher probability. On FCE, following Rei and Søgaard (2019), we take it as a binary classification task and a sequence labeling task, and use accuracy and $\mathrm{F_{0.5}}$ to evaluate them respectively. + +Baselines Rei and Søgaard (2019) combine objectives at different granularities (i.e., sentence and token) to learn better representations. Li et al. (2020b) use dependency distance matrix to obtain a syntax-aware local attention (SLA) and achieve SOTA results on FCE. We also report the results of BERT, RoBERTa and GPT-2 (Radford et al.), + +where GPT-2 reports SOTA results on BLiMP. + +Main Results From Table 2, it can be seen that SynCLM achieves consistent gains over RoBERTa on all three datasets: $2.0\%$ higher average accuracy on BLiMP, $1.3\%$ higher MCC on CoLA, and $0.8\%$ higher accuracy on FCE. The results show that syntactic prior information helps SynCLM to perform much better on GED task. We believe this is because the grammatical acceptability of a sentence strongly relies on its syntactic structure. As illustrated by the first example in Figure 2, which checks the morphological number agreement of the sentence, the morphological number of the word "eat" should be consistent with that of its subject "John". And the dependency syntax illustrates the subject-verb relation between them. + +The tree-guided method performs better than the phrase-guided method on most metrics, as the tree structure gives the head-dependent relations between words more directly and more explicitly. Moreover, combining the two methods can achieve more gains. + +Merging SLA We also test whether SynCLM can be further improved with previous syntax-enhanced attention mechanisms for fine-tuning. We implement SLA (Li et al., 2020b) in the fine-tuning stage, and show the results in the third part of Table 2. It can be seen that merging SLA and SynCLM can achieve more gains on CoLA and FCE, which means that SynCLM can be further improved by using syntax information during fine-tuning. + +# 4.2 Entity Tasks + +We evaluate SynCLM on two entity related tasks: named entity recognition (NER) and entity typing (ENT), which aim to recognize entities and predict entity types respectively. We use CoNLL-2003 (Sang and De Meulder, 2003) for NER task and OpenEntity (Choi et al., 2018) for ENT task. + +Baselines BERT-MRC (Li et al., 2020a) formulates NER task as a machine reading comprehension task to handle both flat and nested NER tasks. KEPLER (Wang et al., 2021) infuses knowledge into pre-trained models and jointly learns knowledge embeddings and language representations. SEPREM (Xu et al., 2020) injects syntax information into pre-trained LMs by introducing two learning tasks and a syntax-aware attention layer. LUKE (Yamada et al., 2020) uses a large amount of entity-annotated corpus and an entity-aware self + +
ModelsQQPMRPCSTSSSTCoLARTEMNLI-mQNLI
BERT-large (Devlin et al., 2019)91.3/-88.0/-90.0/-93.260.670.486.692.3
XLNet-large (Yang et al., 2019)92.3/-90.8/-92.5/-97.069.085.990.894.9
SLA-large (Li et al., 2020b)-/--/--/-94.364.5---
RoBERTa-base (Liu et al., 2019)91.6/88.9*90.1/92.7*90.9/90.7*94.863.678.787.692.8
+ continuous91.6/88.890.2/92.890.2/90.194.963.879.187.292.8
+ PHRASE91.7/88.990.5/93.090.3/90.295.264.579.887.092.9
+ TREE91.7/88.991.2/93.690.6/90.495.164.980.187.493.0
SynCLM-base91.7/88.991.4↑/93.7↑90.8/90.695.1↑65.3↑80.1↑87.293.0
RoBERTa-large (Liu et al., 2019)92.1/89.5*90.7/93.2*92.2/92.1*96.468.086.3*90.294.7
SynCLM-large92.3/89.791.2↑/93.6↑92.0/91.896.7↑69.3↑87.4↑90.594.8
+ +Table 3: Performance on dev sets of GLUE tasks. The results of BERT and RoBERTa are from Liu et al. (2019). Results with $\star$ are from our re-implementations, as some metrics are not given by Liu et al. (2019). For each task, we run model for 5 times with different random initialization seeds, and report the median result. + +
TaskExampleSyntax TreeGoldPbasePsyntax
CoLAI demand that the more John eat, the more he pays.the more John eat the more he pays010
SSTthe words, 'frankly, my dear, I do not give a damn,' have never been more appropriatethe words give have never been more appropriate111
QQPQ1: How do you calculate the surface tension of a substance in physics?How calculate surface tension substance101
Q2: How to calculate surface tension?How calculate surface tension
+ +Figure 2: Case study. The third column shows the simplified syntax tree of each example. $P_{\mathrm{base}}$ represents the label predicted by RoBERTa-base model, and $P_{\mathrm{syntax}}$ represents the label predicted by SynCLM-base. + +
ModelsCoNLL-2003 +P / R / F1OpenEntity +P / R / F1
BERT-MRC (Li)92.3 / 94.6 / 93.0- / - / -
SLA-large (Li20)92.3 / 93.4 / 92.9- / - / -
KEPLER (Wang)- / - / -77.2 / 74.2 / 75.7
SEPREM (Xu20)- / - / -80.1 / 77.1 / 79.1
LUKE (Yamada)- / - / 94.379.9 / 76.6 / 78.2
SEPREM-base84.0 / 92.9 / 88.276.7 / 73.5 / 75.1
RoBERTa-base92.4 / 92.9 / 92.675.7 / 74.6 / 75.1
+ PHRASE92.9 / 93.0 / 93.075.9 / 74.9 / 75.4
+ TREE92.7 / 92.9 / 92.875.6 / 75.2 / 75.4
SynCLM-base93.0↑ / 93.0↑ / 93.0↑76.6 / 74.6 / 75.6↑
+ SLA92.1 / 94.1 / 93.1↑76.7 / 74.6 / 75.7↑
RoBERTa-large93.0 / 93.5 / 93.276.3 / 76.1 / 76.2
SynCLM-large93.4↑ / 93.8↑ / 93.6↑76.8 / 76.1 / 76.4
+ +Table 4: Results (average of 5 runs) on entity tasks. We report continue training results for RoBERTa-base. + +attention mechanism to learn pre-trained contextualized representations for words and entities, and obtains SOTA results on five entity-related datasets, including CoNLL-2003 and OpenEntity. + +Main Results Table 4 shows the performances of SOTA models and our models on CoNLL-2003 and OpenEntity. On the NER task, SynCLM-large improves F1 score by $0.4\%$ compared with RoBERTa-large. Meanwhile, phrase-guided method consistently outperforms tree-guided method both in the base and large model. We think this is because the goal of phrase-guided method matches pretty well + +with the goal of NER. On the ENT task, SynCLM obtains $0.9\%$ and $0.5\%$ precision improvements under the settings of base-size and large-size, respectively. + +Comparison with SEPREM and SLA Compared with SEPREM on ENT, SynCLM achieves a smaller improvement. We suspect the reason is two-fold. First, in SynCLM, syntactic information is incorporated only in the pre-training stage. Second, the pre-training data used in SEPREM is about ten times larger than ours. In order to verify the above hypotheses, based on RoBERTabase, we implement the two pre-training tasks of SEPREM, namely dependency head prediction and dependency distance prediction, and train them on the pre-training data used in our work, resulting in SEPREM-base in Table 4. We observe that SEPREM trained on small-scale data does not perform well. Meanwhile, we merge SLA in the fine-tuning stage, resulting in SynCLM-base + SLA. The result verifies that SynCLM can be further improved by using syntactic information during fine-tuning stage. + +# 4.3 GLUE Benchmark + +Besides, we evaluate SynCLM on the GLUE benchmark (Wang et al., 2018), a collection of diverse + +datasets for evaluating natural language understanding models. It contains single-sentence classification tasks (CoLA and SST-2), similarity and paraphrase tasks (MRPC, QQP, and STS-B), as well as pairwise inference tasks (MNLI, RTE, and QNLI). We use the default train/dev/test split. For each dataset, we fine-tune the pre-trained model separately, using only the corresponding single-task training data (i.e., without multi-task training). Our fine-tuning procedure follows the original RoBERTa paper. We consider a limited hyperparameter sweep for each task, with batch sizes $\in$ {16, 32} and learning rates $\in$ {1e - 5, 2e - 5, 3e - 5}, with a linear warm up for the first $6\%$ of steps followed by a linear decay to 0. We fine-tune for 10 epochs. The rest of the hyperparameters remain the same as during pre-training. + +Experimental Results As shown in Table 3, our models outperform baseline models in most tasks, and achieve more significant gains in tasks with small training datasets, such as CoLA, RTE, MRPC. The performance on CoLA is discussed in Section 4.1. On RTE, compared with baseline models, SynCLM obtains significant gains of $1.4\%$ and $1.1\%$ in base size and large size, respectively. Similarly, it brings accuracy improvement of $1.3\%$ for base model and $0.5\%$ for large model on MRPC. Moreover, incorporating syntactic knowledge into base models brings greater improvements in some datasets. From the results of all downstream tasks, it can be seen that syntactic information is more useful when task's training data is small or the computation power is limited. We think that more training data in the fine-tuning stage will lead to greater loss of syntactic knowledge encoded in the last layer's hidden representations, as last two layers encode task-specific features and undergo the largest changes (Kovaleva et al., 2019). + +Besides, SynCLM achieves larger improvements on single-sentence tasks, but does not always perform well on sentence-pair tasks. We think this is because the cross-sentence interactions are more important for sentence-pair tasks. How to use syntactic information effectively in the sentence-pair tasks is a problem we plan to explore in the future. + +Finally, we can conclude that SynCLM is still effective in general tasks, especially in tasks with small training data. + +
ModelsUUASSpr.
BERT-large (Devlin)82.50.86
Syntax-BERT-large (Bai21)83.40.90
Syntax-RoBERTa-large (Bai21)84.60.93
RoBERTa-base (Liu)81.20.85
SynCLM-base84.9↑0.87
+ +Table 5: The results of structural probing task. + +Figure 3: Visualization of attention weight scores. This case is from CoLA and has grammatical error. The red rectangle indicates higher scores in our model but lower scores in the baseline model. +![](images/6a942009e0a2f6702822dd09b53156df207f451ab0db369b85db2070143481ff.jpg) +Root Mary intended John to go abroad. + +![](images/239f3792113ed3140716ce4758368fbd02bc2225bce40ffae19d09bd6bb6885c.jpg) + +# 4.4 Analysis + +Structural Probing Tasks To check whether the representation learned by SynCLM captures syntactic knowledge effectively, following Hewitt and Manning (2019), we construct a syntax tree of a sentence with linear transformation learned for the embedding space. If the syntax tree is better constructed, the model is considered having learned more syntactic information. We use the pre-trained LM based on phrase-guided method to capture the Stanford Dependencies formalism (De Marneffe et al., 2006). Similarly, we use the undirected attachment score (UUAS) denoting the percentage of correctly placed undirected edges as the main metric. We also report spearman correlation (Spr.) between predicted and the actual distance between each token pair in a sentence. The results are shown in Table 5. It can be seen that our base model obtains SOTA results on UUAS, indicating that our method can enhance the model capability of capturing syntactic structures. + +Case Study Figure 2 gives three examples to illustrate the effectiveness of incorporating syntactic information. These examples show that SynCLM can capture syntactic information and make correct predictions based on the obtained information. To give further insight into how syntactic knowledge affects prediction, we highlight the main syntax structures that affect prediction. Here, we take the third case for detailed analysis. The core tokens in + +the syntax trees of the two sentences are the same, so the model predicts they have the same semantics. Through more data analysis, we find that SynCLM enhances the attention weight between syntactically related words, thus increasing the importance of non-leaf tokens in model prediction. Please note that this feature also leads to wrong predictions. In the future we will attend to the problem of how to integrate syntactic and semantic information in model prediction. + +Attention Visualization In order to verify the impact of syntactic information in the attention mechanisms of the pre-trained LM, we plot attention weights of baseline models and our models in Figure 3. We mainly focus on the interactions of tokens, except for [CLS] and [SEP]. Then the attention weights are averaged over all heads and layers. This visualization demonstrates the effectiveness of injecting syntactic information into self-attention. From Figure 3, we can see that higher attention weight between directly syntactically related tokens in our model. For example, our model assigns strong attentions from the token "John" to "go" and "abroad", while the baseline model assigns lower attentions for these correlated tokens. + +# 5 Conclusion + +To the best of our knowledge, this is the first work of leveraging contrasting learning to inject syntax knowledge into pre-trained LMs. Motivated by the properties of constituent and dependency structures of syntax, we design phrase-guided and tree-guided learning objectives to guide the learning of attention distributions and hidden representations in the transformer. Through extensive experiments, we show that SynCLM consistently improves a wide range of tasks, from GED, entity tasks to GLEU, which confirms the advantage of our syntax-guided contrastive learning. Detailed analysis also shows that SynCLM does incorporate rich syntax knowledge and learn explainable attention weights. + +# Acknowledgements + +We are very grateful to our anonymous reviewers for their helpful feedback on this work. We would like to thank Ying Chen for examination and revision in paper writing; Can Gao for the help on model training. This work was supported in part by the National Key R&D Program of China under Grant 2020YFB1406701. + +# References + +Jiangang Bai, Yujing Wang, Yiren Chen, Yaming Yang, Jing Bai, Jing Yu, and Yunhai Tong. 2021. Syntaxbert: Improving pre-trained transformers with syntax trees. arXiv preprint arXiv:2103.04350. +Rudolf Beran. 1977. Minimum hellinger distance estimates for parametric models. The annals of Statistics, pages 445-463. +Emanuele Bugliarello and Naoaki Okazaki. 2020. Enhancing machine translation with dependency-aware self-attention. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 1618-1627. +Eunsol Choi, Omer Levy, Yejin Choi, and Luke Zettlemoyer. 2018. Ultra-fine entity typing. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 87-96. +Marie-Catherine De Marneffe, Bill MacCartney, Christopher D Manning, et al. 2006. Generating typed dependency parses from phrase structure parses. In Lrec, volume 6, pages 449-454. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. Bert: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171-4186. +Dominik Maria Endres and Johannes E Schindelin. 2003. A new metric for probability distributions. IEEE Transactions on Information theory, 49(7):1858-1860. +Cecilia E Ford and Barbara A Fox. 2002. Constituency and the grammar. The language of turn and sequence, page 14. +Michael Gutmann and Aapo Hyvärinen. 2010. Noise-contrastive estimation: A new estimation principle for unnormalized statistical models. In Proceedings of the thirteenth international conference on artificial intelligence and statistics, pages 297-304. JMLR Workshop and Conference Proceedings. +Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. 2020. Momentum contrast for unsupervised visual representation learning. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 9726-9735. IEEE Computer Society. +John Hewitt and Christopher D Manning. 2019. A structural probe for finding syntax in word representations. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4129-4138. + +Ganesh Jawahar, Benoit Sagot, and Djamé Seddah. 2019. What does bert learn about the structure of language? In ACL 2019-57th Annual Meeting of the Association for Computational Linguistics. +Prannay Khosla, Piotr Teterwak, Chen Wang, Aaron Sarna, Yonglong Tian, Phillip Isola, Aaron Maschinot, Ce Liu, and Dilip Krishnan. 2020. Supervised contrastive learning. Advances in Neural Information Processing Systems, 33. +Taeuk Kim, Jihun Choi, Daniel Edmiston, and Sang-goo Lee. 2020. Are pre-trained language models aware of phrases? simple but strong baselines for grammar induction. arXiv preprint arXiv:2002.00737. +Olga Kovaleva, Alexey Romanov, Anna Rogers, and Anna Rumshisky. 2019. Revealing the dark secrets of bert. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 4365-4374. +Solomon Kullback and Richard A Leibler. 1951. On information and sufficiency. The annals of mathematical statistics, 22(1):79-86. +Xiaoya Li, Jingrong Feng, Yuxian Meng, Qinghong Han, Fei Wu, and Jiwei Li. 2020a. A unified mrc framework for named entity recognition. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 5849-5859. +Zhongli Li, Qingyu Zhou, Chao Li, Ke Xu, and Yunbo Cao. 2020b. Improving bert with syntax-aware local attention. arXiv preprint arXiv:2012.15150. +Tal Linzen, Emmanuel Dupoux, and Yoav Goldberg. 2016. Assessing the ability of lstms to learn syntax-sensitive dependencies. Transactions of the Association for Computational Linguistics, 4:521-535. +Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692. +David Mareček and Rudolf Rosa. 2019. From balustrades to pierre vinken: Looking for syntax in transformer self-attentions. In Proceedings of the 2019 ACL Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pages 263-275. +Brian W Matthews. 1975. Comparison of the predicted and observed secondary structure of t4 phage lysozyme. Biochimica et Biophysica Acta (BBA)-Protein Structure, 405(2):442-451. +Junghyun Min, R Thomas McCoy, Dipanjan Das, Emily Pitler, and Tal Linzen. 2020. Syntactic data augmentation increases robustness to inference heuristics. + +In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 2339-2352. +Xuan-Phi Nguyen, Shafiq Joty, Steven Hoi, and Richard Socher. 2019. Tree-structured attention with hierarchical accumulation. In International Conference on Learning Representations. +Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. Language models are unsupervised multitask learners. +Marek Rei and Anders Søgaard. 2019. Jointly learning to label sentences and tokens. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 6916-6923. +Devendra Singh Sachan, Yuhao Zhang, Peng Qi, and William Hamilton. 2020. Do syntax trees help pretrained transformers extract information? arXiv preprint arXiv:2008.09084. +Erik Tjong Kim Sang and Fien De Meulder. 2003. Introduction to the conll-2003 shared task: Language-independent named entity recognition. In Proceedings of the Seventh Conference on Natural Language Learning at HLT-NAACL 2003, pages 142-147. +Emma Strubell, Patrick Verga, Daniel Andor, David Weiss, and Andrew McCallum. 2018. Linguistically-informed self-attention for semantic role labeling. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 5027-5038. +Ian Tenney, Dipanjan Das, and Ellie Pavlick. 2019. Bert rediscovers the classical nlp pipeline. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 4593-4601. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In Advances in neural information processing systems, pages 5998-6008. +Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel Bowman. 2018. Glue: A multi-task benchmark and analysis platform for natural language understanding. In Proceedings of the 2018 EMNLP Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pages 353-355. +Ruize Wang, Duyu Tang, Nan Duan, Zhongyu Wei, Xuanjing Huang, Cuihong Cao, Daxin Jiang, Ming Zhou, et al. 2020. K-adapter: Infusing knowledge into pre-trained models with adapters. arXiv preprint arXiv:2002.01808. +Xiaozhi Wang, Tianyu Gao, Zhaocheng Zhu, Zhengyan Zhang, Zhiyuan Liu, Juanzi Li, and Jian Tang. 2021. Kepler: A unified model for knowledge embedding and pre-trained language representation. + +Transactions of the Association for Computational Linguistics, 9:176-194. +Yaushian Wang, Hung-Yi Lee, and Yun-Nung Chen. 2019. Tree transformer: Integrating tree structures into self-attention. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 1060-1070. +Alex Warstadt, Alicia Parrish, Haokun Liu, Anhad Mohananey, Wei Peng, Sheng-Fu Wang, and Samuel R Bowman. 2020. Blimp: The benchmark of linguistic minimal pairs for english. Transactions of the Association for Computational Linguistics, 8:377-392. +Alex Warstadt, Amanpreet Singh, and Samuel R Bowman. 2019. Neural network acceptability judgments. Transactions of the Association for Computational Linguistics, 7:625-641. +Ethan Wilcox, Peng Qian, Richard Futrell, Miguel Ballesteros, and Roger Levy. 2019. Structural supervision improves learning of non-local grammatical dependencies. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 3302-3312. +Zhirong Wu, Yuanjun Xiong, X Yu Stella, and Dahua Lin. 2018. Unsupervised feature learning via non-parametric instance discrimination. In 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 3733-3742. IEEE. +Zenan Xu, Daya Guo, Duyu Tang, Qinliang Su, Linjun Shou, Ming Gong, Wanjun Zhong, Xiaojun Quan, Nan Duan, and Daxin Jiang. 2020. Syntax-enhanced pre-trained model. arXiv preprint arXiv:2012.14116. +Ikuya Yamada, Akari Asai, Hiroyuki Shindo, Hideaki Takeda, and Yuji Matsumoto. 2020. Luke: Deep contextualized entity representations with entity-aware self-attention. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 6442-6454. +Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Russ R Salakhutdinov, and Quoc V Le. 2019. Xlnet: Generalized autoregressive pretraining for language understanding. Advances in neural information processing systems, 32. +Helen Yannakoudakis, Ted Briscoe, and Ben Medlock. 2011. A new dataset and method for automatically grading esol texts. In Proceedings of the 49th annual meeting of the association for computational linguistics: human language technologies, pages 180-189. + +Yue Yu, Simiao Zuo, Haoming Jiang, Wendi Ren, Tuo Zhao, and Chao Zhang. 2021. Fine-tuning pre-trained language model with weak supervision: A contrastive-regularized self-training approach. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 1063-1077. +Zhuosheng Zhang, Yuwei Wu, Junru Zhou, Sufeng Duan, Hai Zhao, and Rui Wang. 2020. Sg-net: Syntax-guided machine reading comprehension. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 9636-9643. +Yukun Zhu, Ryan Kiros, Rich Zemel, Ruslan Salakhutdinov, Raquel Urtasun, Antonio Torralba, and Sanja Fidler. 2015. Aligning books and movies: Towards story-like visual explanations by watching movies and reading books. In Proceedings of the IEEE international conference on computer vision, pages 19-27. \ No newline at end of file diff --git a/syntaxguidedcontrastivelearningforpretrainedlanguagemodel/images.zip b/syntaxguidedcontrastivelearningforpretrainedlanguagemodel/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..992adb05afc5ee085723f159078bca02685672bc --- /dev/null +++ b/syntaxguidedcontrastivelearningforpretrainedlanguagemodel/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c5eab7b47bd6d30ba4d019b1ec21996cafd37cb1938a1c7ae57b9682e26154d2 +size 446581 diff --git a/syntaxguidedcontrastivelearningforpretrainedlanguagemodel/layout.json b/syntaxguidedcontrastivelearningforpretrainedlanguagemodel/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..03e634ef55a46d7b89f3ae97d4976ce34048e083 --- /dev/null +++ b/syntaxguidedcontrastivelearningforpretrainedlanguagemodel/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2cbf7701181ef3722c377d728360032771ae305ce62460bffeaccb14cb4f52b5 +size 333151 diff --git a/systematicitycompositionalityandtransitivityofdeepnlpmodelsametamorphictestingperspective/29b0dd2f-0624-4403-a63e-626646f541b5_content_list.json b/systematicitycompositionalityandtransitivityofdeepnlpmodelsametamorphictestingperspective/29b0dd2f-0624-4403-a63e-626646f541b5_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..4ab661dbad8ee8f045e4bfcb46b114e3063397a7 --- /dev/null +++ b/systematicitycompositionalityandtransitivityofdeepnlpmodelsametamorphictestingperspective/29b0dd2f-0624-4403-a63e-626646f541b5_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:de38c6f9f291eba27968dba745051c9b9a2039b1e63ed8abbb2c76e3f659800a +size 84926 diff --git a/systematicitycompositionalityandtransitivityofdeepnlpmodelsametamorphictestingperspective/29b0dd2f-0624-4403-a63e-626646f541b5_model.json b/systematicitycompositionalityandtransitivityofdeepnlpmodelsametamorphictestingperspective/29b0dd2f-0624-4403-a63e-626646f541b5_model.json new file mode 100644 index 0000000000000000000000000000000000000000..ae361a220573bcec717cb44b6da1fcc7b3cd04fb --- /dev/null +++ b/systematicitycompositionalityandtransitivityofdeepnlpmodelsametamorphictestingperspective/29b0dd2f-0624-4403-a63e-626646f541b5_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e7b4525a6efde94745b02599440ab2b52cc42875d75c949080614c8013467e67 +size 102952 diff --git a/systematicitycompositionalityandtransitivityofdeepnlpmodelsametamorphictestingperspective/29b0dd2f-0624-4403-a63e-626646f541b5_origin.pdf b/systematicitycompositionalityandtransitivityofdeepnlpmodelsametamorphictestingperspective/29b0dd2f-0624-4403-a63e-626646f541b5_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..c9e7813462ec5d7a0d70bdb8ce094382bf977ced --- /dev/null +++ b/systematicitycompositionalityandtransitivityofdeepnlpmodelsametamorphictestingperspective/29b0dd2f-0624-4403-a63e-626646f541b5_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e3a192cbf67980cdf1df8162df66cfa0001164640dc67aeeae049b2589d1c302 +size 365425 diff --git a/systematicitycompositionalityandtransitivityofdeepnlpmodelsametamorphictestingperspective/full.md b/systematicitycompositionalityandtransitivityofdeepnlpmodelsametamorphictestingperspective/full.md new file mode 100644 index 0000000000000000000000000000000000000000..fd514396dc8e897c78eb203ae125fb005a7e9ec5 --- /dev/null +++ b/systematicitycompositionalityandtransitivityofdeepnlpmodelsametamorphictestingperspective/full.md @@ -0,0 +1,346 @@ +# Systematicity, Compositionality and Transitivity of Deep NLP Models: a Metamorphic Testing Perspective + +Edoardo Manino + +University of Manchester United Kingdom + +Julia Rozanova + +University of Manchester United Kingdom + +Danilo Carvalho + +University of Manchester United Kingdom + +Andre Freitas + +University of Manchester, United Kingdom +Idiap Research Institute, Switzerland + +Lucas Cordeiro + +University of Manchester United Kingdom + +# Abstract + +Metamorphic testing has recently been used to check the safety of neural NLP models. Its main advantage is that it does not rely on a ground truth to generate test cases. However, existing studies are mostly concerned with robustness-like metamorphic relations, limiting the scope of linguistic properties they can test. We propose three new classes of metamorphic relations, which address the properties of systematicity, compositionality and transitivity. Unlike robustness, our relations are defined over multiple source inputs, thus increasing the number of test cases that we can produce by a polynomial factor. With them, we test the internal consistency of state-of-the-art NLP models, and show that they do not always behave according to their expected linguistic properties. Lastly, we introduce a novel graphical notation that efficiently summarises the inner structure of metamorphic relations. + +# 1 Introduction + +Many recent advances in neural models for NLP have been driven by the ability to learn from unlabeled data (Devlin et al., 2019; Liu et al., 2019b). This approach allows for training the models on large-scale corpora without the costly process of annotating them. As a result, the accuracy and complexity of state-of-the-art neural models for NLP have increased (Brown et al., 2020). + +This trend towards unlabeled data does not have a counterpart in testing NLP models. Instead, both in-distribution testing and out-of-distribution testing (Yin et al., 2019; Teney et al., 2020) rely on comparing the model's predictions to the ground truth. Similarly, attempts at probing the internal computation of large NLP models use supervised classifiers as a diagnostic tool (Ettinger et al., 2016; Belinkov et al., 2017). + +In general, such extreme reliance on ground-truth data limits the quantity of test cases we can + +produce, which is a known problem in the software testing community (Barr et al., 2015). In this regard, a promising solution is metamorphic testing (Chen et al., 2018). Under this paradigm, we test the internal consistency of an NLP model by checking whether it satisfies a necessary relation of its inputs and outputs (Ribeiro et al., 2020). Consequently, metamorphic testing relies on our ability to formally express our expectations on the behaviour of an NLP model. + +Still, most of the metamorphic relations proposed in the literature target the same type of behaviour, as we show in this paper. Indeed, the majority of them are robustness relations, which require that the output of an NLP model remains stable in the face of small input perturbations (Aspillaga et al., 2020). These perturbations may involve simple typos (Belinkov and Bisk, 2018; Gao et al., 2018; Heigold et al., 2018), replacing individual words with a synonym (Li et al., 2017; Jia et al., 2019; La Malfa et al., 2020), or adding irrelevant information to the input (Tu et al., 2021). Due to their simple structure, robustness-like relations have been applied to the testing of several NLP tasks, including sentiment analysis (Ribeiro et al., 2020), machine translation (Sun and Zhou, 2018), and question answering (Chan et al., 2021). Even testing the fairness of NLP models falls in this category (Ma et al., 2020). + +At the same time, we expect state-of-the-art NLP models to exhibit a broader range of linguistic properties than just robustness. First and foremost, NLP models should generalise systematically, i.e. their ability to understand some inputs should be intrinsically connected to their ability to understand related ones (Fodor and Pylyshyn, 1988). While the exact definition of systematic behaviour varies in the literature (Hupkes et al., 2020), a common requirement is that the model's predictions are a result of a composition of syntactic and semantic constituents of the input (Baroni, 2020). Several supervised + +methods to test against such requirements exist (Ettinger et al., 2016; Goodwin et al., 2020), but they all rely on comparing the model's predictions to the ground truth. Likewise, Yanaka et al. (2021) interprets systematicity as the ability to generalise over transitive relations. Their supervised method shows that current models struggle to do so. + +In this paper, we propose three new classes of metamorphic relations, which are designed to test the systematicity, compositionality and transitivity of NLP models. In true metamorphic fashion, our relations do not rely on ground-truth data and scale up the generation of test cases by a polynomial factor. For each proposed relation, we provide an illustrative experiment where we test state-of-the-art models for the expected linguistic behaviours. More in detail, our main original contributions are: + +- Pairwise systematicity. First, we propose a general class of metamorphic relations to test the systematicity of NLP models (Section 4). The relations in this class are based on pairs of inputs, which yields a quadratic number of test cases from a single dataset. We test the pairwise systematicity of a sentiment analysis model in Section 4.1, with positive results. Then, in Section 4.2, we give a geometrical intuition of the constraints imposed by our relations on the model's embedding space. +- Pairwise compositionality. Second, we modify pairwise systematicity to test the presence of compositional constituents in the hidden layers of neural models (Section 5). Accordingly, we test the pairwise compositionality of a natural language inference (NLI) model in Section 5.1, and show that it does not behave in a compositional way. +- Three-way transitivity. Third, we introduce a class of relations to test the internal transitivity of an NLP model (Section 6). These relations are defined over triplets of source inputs. In Section 6.1, we test a state-of-the-art model that predicts the lexical relation of words (synonymy, hypernymy), and show that it does not behave in a transitive way. +- Graphical notation. Fourth, we propose a formal graphical notation for NLP metamorphic relations, that efficiently expresses their internal structure (Section 2). + +Taxonomy of existing work. Fifth, we review the existing literature on metamorphic testing for NLP, and show that the relations proposed therein share the same structure with a single source input (Section 3). + +Lastly, in Section 7 we conclude and outline possible future work. We discuss the ethical implications of our work in Appendix A. We provide a quick-reference guide to our contribution in Appendix B. The code of our experiments and reproducibility checklist are available at https://doi.org/10.5281/zenodo.5703459. + +# 2 A graphical notation for NLP metamorphic relations + +This section gives preliminary definitions and proposes a compact graphical notation for NLP metamorphic relations. + +Definition 2.1 (NLP model). Let $f: \mathcal{X} \to \mathcal{Y}$ be a machine learning model that maps a textual input $\mathbf{x} \in \mathcal{X}$ to a suitable output $\mathbf{Y} \in \mathcal{Y}$ . Here, we assume that $f$ is a neural network, and $\mathcal{Y} \equiv \mathbb{R}^k$ is either a $k$ -dimensional embedding space or the soft-max output of a $k$ -class classifier. + +In general, a metamorphic relation can be defined as (Chen et al., 2018): + +Definition 2.2 (Metamorphic relation). A metamorphic relation $R$ is a property of $f$ across multiple inputs and outputs $(\mathbf{x}_1, \ldots, \mathbf{x}_v, f(\mathbf{x}_1), \ldots, f(\mathbf{x}_v))$ , such that $R \subseteq \mathcal{X}_1 \times \dots \times \mathcal{X}_v \times \mathcal{Y}_1 \times \dots \times \mathcal{Y}_v$ . + +However, we are interested in the internal structure of such a relation. Thus, let us discriminate between two types of inputs (Chen et al., 2018): + +Definition 2.3 (Source inputs). Given a relation $R$ with $v$ inputs, let $(\mathbf{x}_1, \dots, \mathbf{x}_u)$ with $u \leq v$ be the sequence of source inputs. These can be chosen freely, e.g. by extracting them from a dataset $\mathcal{D}$ . + +Definition 2.4 (Follow-up inputs). Given a relation $R$ with $u$ source inputs, let $(\mathbf{x}_{u + 1},\ldots ,\mathbf{x}_v)$ with $u\leq v$ be the sequence of follow-up inputs. These are computed by a transformation of the source inputs $\mathbf{x}_i = T_i(\mathbf{x}_1,\dots ,\mathbf{x}_u)$ for $i\in [u + 1,v]$ + +Furthermore, all the relations in this paper prescribe specific conditions over the model's output: + +Definition 2.5 (Output property). Define $P \subseteq \mathcal{Y}_1, \ldots, \mathcal{Y}_v$ as a relation over the output. Here, we always write it in decidable first-order logic. + +Altogether, the structure of an NLP metamorphic relation can be easily described in graphical form. To do so, we introduce the following compact notation (see example in Figure 1). Textual variables are represented as circles, whereas numerical variables (e.g. embeddings, softmax outputs) are squares. Moreover, source inputs are shaded in grey, while all other nodes are in white. Arrows represent the neural function $f$ and the transformation $T_{i}$ . Lastly, the output property $P$ is linked to the relevant nodes with dashed lines. + +# 3 A taxonomy of existing NLP metamorphic relations + +Most of the existing literature on NLP metamorphic testing proposes relations that fit in the structure of Figure 1. Due to their reliance on just one source input, we refer to these metamorphic relations as single-input. The individual differences among them can be ascribed to the specific transformation $T$ and property $P$ . The present section derives a taxonomy of existing NLP relations by organising them along these two axes $T$ and $P$ . + +![](images/57c12304f7077016f2396904aab97af6e7d76c4e8b0b46bdd468b8f4d6d68be7.jpg) +Figure 1: Structure of a single-input metamorphic relation. Property $P$ expresses how the output of model $f$ should change when the source input $\mathbf{x}$ is modified via $T$ . Most relations in the literature follow this structure. + +The transformation $T$ is defined over the input text and thus allows for considerable creative freedom. A list of common options is presented here: + +- Character-level $T$ . Character-level transformations are typically used to introduce noise in the input. Examples include replacing individual characters with a neighbouring one on a computer keyboard (Belinkov and Bisk, 2018) or a random one (Heigold et al., 2018). More aggressive transformations may involve swapping neighbouring characters (Belinkov and Bisk, 2018; Gao et al., 2018; Heigold et al., 2018) and shuffling a subset of the characters in a word (Belinkov and Bisk, 2018). Alternatively, a collection of real-world typos can be + +retrieved from datasets with edit history (e.g. Wikipedia) (Belinkov and Bisk, 2018). + +- Word-level $T$ . A common word-level transformation involves replacing words with their synonym (Li et al., 2017). This operation has been shown to produce adversarial examples in (Jia et al., 2019; La Malfa et al., 2020). The use of antonyms has also been explored in Tu et al. (2021). In contrast, changing the gender of keywords in the input text can reveal the social biases of an NLP model (Ma et al., 2020). Similarly, swapping keywords in the context of a question-answer (QA) system can reveal inconsistent answers (Ribeiro et al., 2020). In the same vein, Fadaee and Monz (2020) and Dankers et al. (2021) show the volatility of neural translation models to minor word-level transformations of the input. + +- Sentence-level $T$ . Removal or concatenation of entire sentences from the input text has been tried too. Aspillaga et al. (2020) experiments with adding positive and negative tautologies at the end of the input. Similarly, Ribeiro et al. (2020) propose to concatenate both well-formed sentences and randomly-generated URLs. More generally, the whole input text can have its sentences shuffled (Tu et al., 2021) or paraphrased (Li et al., 2017). + +Regarding the output property $P$ , the current literature only offers three choices. We list them here, alongside their first-order logic formulation: + +- Equivalence $P$ . Robustness relations require that the output does not change in the face of small input perturbations. Thus, we need a notion of equivalence between the source output $\mathbf{y}$ and its follow-up $\mathbf{y}'$ (see Figure 1). For classification models, we can express it via the softmax output $\mathbf{y} = (y_1, \ldots, y_c)$ as: + +$$ +P _ {e q}: \quad \exists i \forall j \neq i (y _ {i} > y _ {j}) \wedge \left(y _ {i} ^ {\prime} > y _ {j} ^ {\prime}\right) \tag {1} +$$ + +where $i$ is the predicted class. In rarer cases, where the output is textual, verbatim comparison can be used (Sun and Zhou, 2018). + +- Similarity $P$ . For other applications, the equivalence property cannot be applied. For example, when testing QA systems, we want to detect similar but not identical answers. In such cases, we can define a similarity score + +$s(\mathbf{y},\mathbf{y}^{\prime})\in \mathbb{R}$ , e.g. cosine similarity between the embeddings of the two answers (Tu et al., 2021). With it, we can write similarity as: + +$$ +P _ {s i m}: \quad s (\mathbf {y}, \mathbf {y} ^ {\prime}) > \theta \tag {2} +$$ + +where $\theta$ is an arbitrary threshold chosen according to the user's domain knowledge. + +- Order $P$ . At the same time, we can establish an order relation between the two outputs $\mathbf{y}$ and $\mathbf{y}'$ . This order relation is useful in conjunction with transformations that have a monotonic effect on the output. For example, concatenating positive sentences to the input of a sentiment analysis system (Ribeiro et al., 2020). In such cases, let us define an order score $s(\mathbf{y}) \in \mathbb{R}$ , and write the output property as: + +$$ +P _ {o r d}: \quad s (\mathbf {y}) < s \left(\mathbf {y} ^ {\prime}\right) \tag {3} +$$ + +In Sections 4, 5 and 6 we employ some of the transformations $T$ and properties $P$ defined here as building blocks for new metamorphic relations. + +# 4 Pairwise NLP metamorphic relations for testing systematicity + +We introduce a new class of metamorphic relations to test the systematicity of NLP models. Here, we take the general definition of systematicity in Fodor and Pylyshyn (1988), which states that the predictions of an NLP model across related inputs should be intrinsically connected and express it as a metamorphic relation (see Figure 2). Since we do not want to rely on ground-truth data, we first establish a baseline for the model's behaviour by comparing its predictions across two different source inputs. Then, we perturb both source inputs via the same transformation and test whether the model's behaviour changes accordingly. + +![](images/3b40e5551ead256dfed04d97af594e4242389bdb21f0382b05cb37618aca919d.jpg) +Figure 2: Structure of pairwise-systematicity relations. The two source inputs allow us to establish a baseline for the behaviour of model $f$ , and test whether it changes according to expectations once $T$ is applied. + +More formally, we define pairwise-systematicity relations as follows. Let $\mathbf{x}_1,\mathbf{x}_2\in \mathcal{D}$ be a pair of source inputs, and $\mathbf{x}_1^{\prime},\mathbf{x}_2^{\prime}$ their corresponding follow-up inputs via transformation $T$ . Furthermore, denote with $\mathbf{y}_1,\mathbf{y}_2,\mathbf{y}_1^{\prime},\mathbf{y}_2^{\prime}$ the outputs produced by model $f$ . Finally, define the output property $P$ in the following form: + +$$ +P: \quad P _ {s r c} (\mathbf {y} _ {1}, \mathbf {y} _ {2}) \Longrightarrow P _ {f l w} \left(\mathbf {y} _ {1} ^ {\prime}, \mathbf {y} _ {2} ^ {\prime}\right) \tag {4} +$$ + +Note that this definition does not rely on ground-truth data. In fact, we trust the model's predictions $(\mathbf{y}_1,\mathbf{y}_2)$ over the source inputs to establish our premise $P_{src}$ . The actual test checks whether transforming the source inputs with $T$ produces outputs that satisfy the expected property $P_{fwl}$ . Any violation of this property, i.e. when $P_{src} \wedge \neg P_{fwl}$ , reveals an inconsistency in the model's predictions that breaks the user's expectation of systematic behaviour. In Section 4.2, we give an intuitive geometrical explanation of the type of constraints imposed by pairwise-systematicity relations on the embedding space of a neural NLP model. + +A hidden advantage of metamorphic relations with multiple source inputs (see also Sections 5 and 6) is that they naturally produce more test cases than single-input ones. In the case of pairwise systematicity, each input in the pair $(\mathbf{x}_1,\mathbf{x}_2)$ is extracted from the same dataset $\mathcal{D}$ . Thus, a dataset with $|\mathcal{D}| = k$ entries generates an $O(k^2)$ number of test cases, as opposed to $O(k)$ for single-input relations. We see an example of this in Section 4.1. + +# 4.1 Illustrative example: pairwise systematicity of sentiment analysis + +Now, let us apply the pairwise-systematicity relation structure shown in Figure 2 to a sentiment analysis task. To do so, we choose the following: + +- Transformation $T$ . For each source input $\mathbf{x}_i$ , we create a follow-up input $\mathbf{x}_i' = T(\mathbf{x}_i)$ by concatenating a short sentence to it. A list of all transformations we use is in Table 1. +- Output premise $P_{src}$ . Let $s_{pos}(\mathbf{y}_1)$ and $s_{pos}(\mathbf{y}_2)$ be the (positive) sentiment scores predicted by model $f$ . Define the baseline behaviour of $f$ as the order property $P_{src} = P_{ord}$ between these two scores (see Equation 3). +- Output hypothesis $P_{flow}$ . Let $s_{pos}(\mathbf{y}_1')$ and $s_{pos}(\mathbf{y}_2')$ be the sentiment scores of the follow-up inputs. We require that their order matches + +
Violat.Concatenated TextPosition
0.100My friends were happy, though.End
0.090Anyway, the sound of the rain outside was soothing.End
0.078As always: popcorn and coke make everything better!End
0.068Thank you.Start
0.057I watched this movie with my brother.Start
0.045Here is my review:Start
+ +the one of the source inputs. More formally: $P_{flw} = P_{ord}$ and $P_{src} \Longrightarrow P_{flw}$ . + +Our rationale is that the sentiment of any input shifts when we concatenate additional text. If we have ground-truth information on the sentiment of the text we are adding, we can test whether our predictions shift in the expected direction. For instance, concatenating "I am very happy" should make the score of any input more positive. This is an example of single-input relation (see Section 3 and Ribeiro et al., 2020). + +However, if we do not have such ground truth, we can still test our model. We do so by considering a pair of inputs $(\mathbf{x}_1,\mathbf{x}_2)$ , and concatenating the same text to both of them. Then, whenever $\mathbf{x}_1$ is predicted more positive than $\mathbf{x}_2$ , we require that its transformed version $\mathbf{x}_1'$ is also more positive than $\mathbf{x}_2'$ and vice versa. This is pairwise systematicity. + +Experiment description and results. We select a fine-tuned version of RoBERTa (Liu et al., 2019b) for sentiment analysis from the Hugging-Face library. We choose 10,605 movie reviews from Socher et al. (2013) as our dataset $\mathcal{D}$ . From it, we generate all $112\mathrm{M}+$ possible source input pairs. We repeat our experiment with different neutral transformations $T$ , and report their aggregated results in Table 1. Note how the proportion of violated relations varies across different transformations. Yet, the model's behaviour is fairly systematic, never exceeding $10\%$ violations. + +We get a different picture by counting the num + +Table 1: Input transformations sorted by decreasing proportion of violated test cases. + +
Violat.Source InputPred.
0.269This isn’t a “Friday” worth waiting for.Pos
0.259The audience when I saw this one was chuckling at all the wrong times, and that’s a bad sign when they’re supposed to be having a collective heart attack.Pos
.........
0.000As a director, Paxton is surprisingly brilliant, deftly sewing together what could have been a confusing and terrifying vision into an intense and engrossing head-trip.Neg
0.000Intended to be a comedy about relationships, this wretched work falls flat in just about every conceivable area.Pos
+ +Table 2: Source inputs and their predicted sentiment, sorted by the number violated pairs they appear in. + +ber of violations per each source input $x_{i} \in \mathcal{D}$ (see Table 2). There, we can see that some inputs are more likely to make the source order $P_{src}(\mathbf{y}_1, \mathbf{y}_2)$ unstable across all the transformations $T$ . Interestingly, a quick read through the reviews in Table 2 shows that they are all misclassified. Thus, we can conclude that pairwise-systematicity testing reveals a different issue in the model $f$ than classic non-metamorphic testing. For this reason, we encourage practitioners to perform both types of testing on their NLP models, as it will give a clearer picture of their strengths and weaknesses. + +# 4.2 Geometric interpretation of pairwise systematicity + +Metamorphic relations impose constraints between the inputs and outputs while treating the model $f$ as a black box (Chen et al., 2018). Still, in neural networks, it is possible to trace the effect of a relation $R$ on the hidden layers. Here, we give a geometric explanation of the type of constraints pairwise-systematicity relations put on the last embedding space of a neural NLP model. + +To this end, let us consider the relations in Section 4.1. Recall, that model $f$ outputs a sentiment + +![](images/0613122ff24105d31b4ef5425de7a3521ec47b9208b22b466af721cefb9fd64b.jpg) +Figure 3: Pairwise systematicity relates pairs of source outputs (left) to pairs of follow-up outputs (right) in the embedding space. For the pairwise systematicity relations in Section 4.1, the order of each pair along dimension $s$ must be preserved, as shown in this example. + +![](images/492a448f40781dc2b49f2aa82c1a60c0ed12c822608c30195a13434985eed802.jpg) + +score $s(\mathbf{y})$ , which is a one-dimensional projection of the hidden representations (see Figure 3). Accordingly, the premise $P_{src}$ and hypothesis $P_{flw}$ are only concerned with the position of each representation $\mathbf{y}$ along direction $s$ . However, since the source and follow-up inputs differ due to transformation $T$ , the two output properties $P_{src}$ and $P_{flw}$ act on different points in the embedding space. Once we require that $P_{src} \Rightarrow P_{flw}$ , we set the expectation that $f$ is exceptionally consistent at mapping pairs of inputs $(\mathbf{x}_1, \mathbf{x}_2)$ onto space $\mathcal{V}$ in the same order. + +Similar considerations apply if $P_{src}$ and $P_{flw}$ are based on equality or similarity rather than order. Indeed, equality (see Equation 1) is defined over the softmax outputs, which are affine combinations of the embeddings (Bishop, 2006). In such case, the condition $P_{src} \Rightarrow P_{flw}$ translates to a requirement that if the source inputs are both mapped to the same half-space, the follow-up inputs should be too. Conversely, similarity (Equation 2) defines a measure on the embedding space. Source inputs that are within a certain threshold $\theta$ should be matched by follow-up inputs that are also close. + +Let us stress here that such geometric constraints are a direct consequence of the metamorphic relation we choose. This is a fundamentally different mechanism to the one explored by Allen and Hesperales (2019), where the linear relationship between the representations of related words is explained as an emergent behaviour of the probability of words occurring in similar contexts. In the following Section 5, we introduce a class of pairwise relations where the output premise and hypothesis are defined over separate embedding spaces. + +# 5 Pairwise NLP metamorphic relations for testing compositionality + +Many probing works train simple supervised classifiers on top of the hidden representations of an NLP model (e.g. Hewitt and Manning, 2019). These classifiers, called probes, can reveal whether the neural model has learnt to recognise some fundamental constituents of the input language early on. The presence of such building blocks can be a sign that an NLP model exhibits compositional behaviour (Baroni, 2020). Here, we propose to test the presence of compositional constituents in the hidden layers via metamorphic testing. To this end, we turn towards a stricter definition of mathematical compositionality of the neural network behaviour, rather than global linguistic compositionality, which is harder to define (Dankers et al., 2021). + +![](images/2991668e0e75e80692f24c3cf87f4b5b9850ca4ceb3124b77526b1c4c878e61f.jpg) +Figure 4: Structure of pairwise-compositionality relations. Comparing the hidden representations $\mathbf{z}_1, \mathbf{z}_2$ of the source inputs reveals whether the model $f \circ g$ uses them to produce the output in a compositional fashion. + +Consider the graph in Figure 4. There, the neural model is split into the mathematical composition of two functions $f \circ g$ . More precisely, $\mathbf{z} = f(\mathbf{x})$ are the hidden representation of some hidden layer, and $\mathbf{y} = g(\mathbf{z})$ is the final output. Now, let us define + +the output property $P$ as follows: + +$$ +P: \quad P _ {h i d} (\mathbf {z} _ {1}, \mathbf {z} _ {2}) \Longrightarrow P _ {o u t} (\mathbf {y} _ {1}, \mathbf {y} _ {2}) \tag {5} +$$ + +A relation in this form allows us to express whether specific precursor signals in $\mathbf{z}$ are expected to have a direct effect on $\mathbf{y}$ . In a similar way to the relations in Section 4, both the premise $P_{hid}$ and hypothesis $P_{out}$ are established by comparing across pairs of inputs, rather than a ground-truth. In Section 5.1, we show how our technique can reveal the presence (or absence) of compositional building blocks in an NLP model. + +# 5.1 Illustrative example: pairwise compositionality of NLI + +Here, we apply the metamorphic relation in Figure 4 to test a natural language inference (NLI) model. In general, the input $\mathbf{x} = (\mathbf{x}_a,\mathbf{x}_b)$ of an NLI model is the concatenation of two pieces of text: the premise $\mathbf{x}_a$ and the hypothesis $\mathbf{x}_b$ . The model's goal is to predict whether $\mathbf{x}_b$ logically follows from $\mathbf{x}_a$ , i.e. their entailment. + +To test whether the model's predictions exhibit a compositional behaviour, we construct our test inputs according to Rozanova et al. (2021). Namely, we first choose a prototypical sentence template $C(\ell)$ , which we call a context. Each context includes a placeholder token $\ell$ that can be replaced with some insertion text. Second, we construct each input $\mathbf{x} = (C(\ell_a), C(\ell_b))$ by copying the same context twice with different insertions. + +Finally, we choose the contexts $C_i$ and insertion pairs $(\ell_a, \ell_b)_j$ in such a way that their composition $(C(\ell_a), C(\ell_b))_{ij}$ has a well-definite entailment relation. Namely, the insertion pairs (see Table 4) are either hypernyms $\supseteq$ , hyponyms $\subseteq$ , or unrelated (none). Similarly, the contexts (see Table 3) are either upward monotone if they preserve the insertion relation, or downward monotone if they invert it. As a result, only the compositions $\mathrm{Up}(\supseteq)$ and $\mathrm{Down}(\supseteq)$ are entailed, while the rest are not. + +Now, assume that both input pairs $\mathbf{x}_1 = (C(\ell_a), C(\ell_b))_{i1}$ and $\mathbf{x}_2 = (C(\ell_a), C(\ell_b))_{i2}$ in Figure 4 are based on the same context $C_i$ . We can test whether the NLI model builds its output by reasoning over the monotonicity of $C_i$ and the lexical relation of $(\ell_a, \ell_b)_j$ as follows: + +- Hidden premise $P_{hid}$ . Let $\mathbf{z}$ be the embeddings of the second to last layer, for the tokens corresponding to the insertions $\ell_{a}$ and $\ell_{b}$ . Train a linear probe $s_{hyp}$ on $\mathbf{z}$ (Liu et al., + +
Violat.ContextMon.
0.613So there is no dedicated ⟨x⟩ for every entity and no distinction between entity mentions and non-mention words.Down
.........
0.374There was no ⟨x⟩.Down
0.373We stood on the brink of a ⟨x⟩.Up
.........
0.254There are some old houses in this ⟨x⟩.Up
0.246Some ⟨x⟩ bloom in spring and others in autumn.Up
+ +Table 3: Contexts sorted by decreasing proportion of violated test cases. + +2019a) to predict whether $\ell_{a}$ is a hypernym of $\ell_{b}$ . Define $P_{hid} = P_{ord}$ as the order property (see Equation 3) over the hypernymy scores $s_{hyp}(\mathbf{z}_1)$ and $s_{hyp}(\mathbf{z}_2)$ of the two inputs. + +- Output hypothesis $P_{out}$ . Let $s_{ent}(\mathbf{y})$ be the entailment score produced by the full neural model $f \circ g$ . Moreover, define $P_{out} = P_{ord}$ as the order of the two output scores $s_{ent}(\mathbf{y}_1)$ and $s_{ent}(\mathbf{y}_2)$ . Then, consider the monotonicity of the input context. If $C_i$ is downward monotone, let $P_{hid} \Longleftrightarrow P_{out}$ , since more hypernymy means more entailment. If $C_i$ is upward monotone, let $P_{hid} \Longleftrightarrow \neg P_{out}$ , since more hypernymy means less entailment. + +If the NLI model $f \circ g$ had a compositional behaviour, the order $P_{hid}$ of the hypernymy scores in the hidden layer should be reflected in the order $P_{out}$ of the entailment scores in the output. Here, we show that this is not the case for a popular state-of-the-art NLI model. + +Experiment description and results. We build a dataset $\mathcal{D}$ of 292 insertions pairs and repeat our experiment with 211 contexts, for a total of about 9M test cases. We chose a fine-tuned version of RoBERTa for NLI as our model. The accuracy of the hypernymy probe is 0.9881. We report the aggregated result by context in Table 3. Note how downward monotone contexts lead to less compositional behaviour: overall, we have a 0.312 proportion of violated test cases with upward contexts and 0.519 with downward ones. This phenomenon is + +
Violat.Insertion PairLex. Rel.
0.583(gun,woman)none
0.525(woman,gun)none
0.492-tree,cherry tree)
0.410(fruit,apple)
0.409(pine,tree)
0.304(potatoes,animals)none
0.274(animals,potatoes)none
+ +Table 4: Insertions sorted by decreasing proportion of violated test cases. + +known in the literature (Yanaka et al., 2019), but we show that metamorphic testing can independently detect it. If we aggregate the results by insertion pair (see Table 4), the picture does not change. The overall proportion of violations is 0.406, which is barely below random chance. Any deviations from this baseline can be interpreted as noise. + +# 6 Three-way NLP metamorphic relations for testing transitivity + +An NLP model that generalises correctly should exhibit transitive behaviour under the right circumstances (Yanaka et al., 2021). That is, if the model predicts a transitive linguistic property over the input pairs $(\mathbf{x}_1,\mathbf{x}_2)$ and $(\mathbf{x}_2,\mathbf{x}_3)$ , then it should also predict it for the pair $(\mathbf{x}_1,\mathbf{x}_3)$ . Here, we propose to test this behaviour in a metamorphic way. + +![](images/dbb05dea3582040c7f2dd5fa5747f84c71c186cc9342797bd5abba63d9f59bde.jpg) +Figure 5: Structure of three-way transitivity relations. The three source inputs $\mathbf{x}_1, \mathbf{x}_2, \mathbf{x}_3$ are combined into all possible pairs. If two pairs are predicted as true by model $f$ , the third must be predicted true as well. + +More specifically, let us introduce the three-way transitivity relation in Figure 5. There, the three source inputs $\mathbf{x}_1, \mathbf{x}_2, \mathbf{x}_3$ are combined to form all possible input pairs $\mathbf{x}_{ij} = (\mathbf{x}_i, \mathbf{x}_j)$ . Then, we can test whether their corresponding outputs are transi + +tive with the following output property: + +$$ +P: \quad v \left(y _ {1 2}\right) \wedge v \left(y _ {2 3}\right) \Rightarrow v \left(y _ {1 3}\right) \tag {6} +$$ + +where $v(\cdot): \mathcal{Y} \to \{0,1\}$ is the Boolean prediction of model $f$ . Note that the output property $P$ , being defined over three outputs, has a different structure from those in Sections 3, 4 and 5. + +# 6.1 Illustrative example: three-way transitivity of lexical relations + +In this section, we apply the metamorphic structure from Figure 5 to test the transitivity of lexical semantic relations, e.g. synonymy and hypernymy (Santus et al., 2016). In general, learning these linguistic properties is crucial for solving several NLI tasks (Glockner et al., 2018). Thus, we can expect an NLP model to generalise over them in a transitive way. We can test whether this is true in the following way: + +- Transformation $T$ . The model $f$ we test already accepts a pair of words $\mathbf{x}_{ij} = (\mathbf{x}_i, \mathbf{x}_j)$ as input. Thus, $T$ is merely a formalism here. +- Output Property $P$ . Property $P$ in Equation 6 depends on the definition of $v(\cdot)$ . Here, we train two classification heads on top of a pretrained model $f$ . The first $v_{syn}(\cdot)$ predicts synonymy, the second $v_{hyp}(\cdot)$ hypernymy. + +Note that transitivity can be tested in a supervised fashion by comparing the model's predictions to a ground truth (Yanaka et al., 2021). In contrast, the three-way transitivity relations we propose test the internal transitivity of a model trained to predict lexical relations. + +Experiment description and results. We reproduce a state-of-the-art model for lexical relations (Wachowiak et al., 2020), which is a fine-tuned version of the multi-lingual transformer model xlmroberta (Conneau et al., 2020). We extract the multi-lingual test set from the CoGALex_VI shared task (Santus et al., 2016), and generate a random sample of source triplets from its corpus of words, keeping those that satisfy $v(y_{12}) \wedge v(y_{23})$ . We present our empirical results in Table 5, organised by the language of the source words and lexical relation $v$ predicted by the model. As the table shows, this state-of-the-art NLP model fails to predict $v(y_{13})$ in a transitive way across all languages. This is in contrast with the results of classic supervised testing in Wachowiak et al. + +
LanguageSyn. Violat.Hyp. Violat.
English0.8090.723
German0.7600.713
Chinese0.6100.606
Italian0.6590.741
+ +Table 5: Proportion of violated three-way transitivity tests for a state-of-the-art lexical relation model. + +(2020), which show that their model can predict the correct lexical relations (synonym, hypernym, antonym or random) with at least 0.5 of accuracy. + +# 7 Conclusions and future work + +In this paper, we presented three new classes on metamorphic relations. Thanks to them, we could test the systematicity, compositionality and transitivity of state-of-the-art NLP models. The advantage of our approach is that it does not rely on ground-truth annotations. It can generate a polynomially larger number of test cases than supervised testing, revealing whether the NLP model under test is internally consistent. + +Still, testing is only one side of the coin. Like in recent work about robustness (Aspillaga et al., 2020), the tested models have not been trained on a metamorphic objective (e.g. as an additional loss term). We believe that doing so could improve the safety and consistency of a model's predictions. + +# Acknowledgements + +The work is funded by the EPSRC grant EP/T026995/1 entitled "EnnCore: End-to-End Conceptual Guarding of Neural Architectures" under Security for all in an AI enabled society. + +# References + +Carl Allen and Timothy Hospedales. 2019. Analogies explained: Towards understanding word embeddings. In Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pages 223-231. PMLR. +Carlos Aspillaga, Andres Carvallo, and Vladimir Araujo. 2020. Stress test evaluation of transformer-based models in natural language understanding tasks. In Proceedings of the 12th Language Resources and Evaluation Conference, pages 1882-1894, Marseille, France. European Language Resources Association. + +Marco Baroni. 2020. Linguistic generalization and compositionality in modern artificial neural networks. Philosophical Transactions of the Royal Society B: Biological Sciences, 375(1791):20190307. +Earl T. Barr, Mark Harman, Phil McMinn, Muzammil Shahbaz, and Shin Yoo. 2015. The oracle problem in software testing: A survey. IEEE Transactions on Software Engineering, 41(5):507-525. +Yonatan Belinkov and Yonatan Bisk. 2018. Synthetic and natural noise both break neural machine translation. In International Conference on Learning Representations. +Yonatan Belinkov, Nadir Durrani, Fahim Dalvi, Hassan Sajjad, and James Glass. 2017. What do neural machine translation models learn about morphology? In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 861-872, Vancouver, Canada. Association for Computational Linguistics. +Christopher M. Bishop. 2006. Pattern Recognition and Machine Learning (Information Science and Statistics). Springer-Verlag, Berlin, Heidelberg. +Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler, Jeffrey Wu, Clemens Winter, Chris Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. 2020. Language models are few-shot learners. In Advances in Neural Information Processing Systems, volume 33, pages 1877-1901. Curran Associates, Inc. +Alvin Chan, Lei Ma, Felix Juefei-Xu, Yew-Soon Ong, Xiaofei Xie, Minhui Xue, and Yang Liu. 2021. Breaking neural reasoning architectures with metamorphic relation-based adversarial examples. IEEE Transactions on Neural Networks and Learning Systems, pages 1-7. +Tsong Yueh Chen, Fei-Ching Kuo, Huai Liu, Pak-Lok Poon, Dave Towey, T. H. Tse, and Zhi Quan Zhou. 2018. Metamorphic testing: A review of challenges and opportunities. ACM Comput. Surv., 51(1). +Alexis Conneau, Kartikay Khandelwal, Naman Goyal, Vishray Chaudhary, Guillaume Wenzek, Francisco Guzmán, Edouard Grave, Myle Ott, Luke Zettlemoyer, and Veselin Stoyanov. 2020. Unsupervised cross-lingual representation learning at scale. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 8440-8451, Online. Association for Computational Linguistics. + +Verna Dankers, Elia Bruni, and Dieuwke Hupkes. 2021. The paradox of the compositionality of natural language: a neural machine translation case study. arXiv, abs/2108.05885. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171-4186, Minneapolis, Minnesota. Association for Computational Linguistics. +Allyson Ettinger, Ahmed Elgohary, and Philip Resnik. 2016. Probing for semantic evidence of composition by means of simple classification tasks. In Proceedings of the 1st Workshop on Evaluating Vector-Space Representations for NLP, pages 134-139, Berlin, Germany. Association for Computational Linguistics. +Marzieh Fadaee and Christof Monz. 2020. The unreasonable volatility of neural machine translation models. In Proceedings of the Fourth Workshop on Neural Generation and Translation, pages 88-96, Online. Association for Computational Linguistics. +Jerry A. Fodor and Zenon W. Pylyshyn. 1988. Connectionism and cognitive architecture: A critical analysis. Cognition, 28(1):3-71. +Ji Gao, Jack Lanchantin, Mary Lou Soffa, and Yanjun Qi. 2018. Black-box generation of adversarial text sequences to evade deep learning classifiers. In 2018 IEEE Security and Privacy Workshops (SPW), pages 50-56. +Max Glockner, Vered Shwartz, and Yoav Goldberg. 2018. Breaking NLI systems with sentences that require simple lexical inferences. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 650-655, Melbourne, Australia. Association for Computational Linguistics. +Emily Goodwin, Koustuv Sinha, and Timothy J. O'Donnell. 2020. Probing linguistic systematicity. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 1958-1969, Online. Association for Computational Linguistics. +Georg Heigold, Stalin Varanasi, Günter Neumann, and Josef van Genabith. 2018. How robust are character-based word embeddings in tagging and MT against wrod scrambling or randm nouse? In Proceedings of the 13th Conference of the Association for Machine Translation in the Americas (Volume 1: Research Track), pages 68-80, Boston, MA. Association for Machine Translation in the Americas. +John Hewitt and Christopher D. Manning. 2019. A structural probe for finding syntax in word representations. In Proceedings of the 2019 Conference + +of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4129-4138, Minneapolis, Minnesota. Association for Computational Linguistics. +Dieuwke Hupkes, Verna Dankers, Mathijs Mul, and Elia Bruni. 2020. Compositionality decomposed: how do neural networks generalise? Journal of Artificial Intelligence Research, 67:757-795. +Robin Jia, Aditi Raghunathan, Kerem Goksel, and Percy Liang. 2019. Certified robustness to adversarial word substitutions. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 4129-4142, Hong Kong, China. Association for Computational Linguistics. +Emanuele La Malfa, Min Wu, Luca Laurenti, Benjie Wang, Anthony Hartshorn, and Marta Kwiatkowska. 2020. Assessing robustness of text classification through maximal safe radius computation. In *Findings of the Association for Computational Linguistics: EMNLP* 2020, pages 2949-2968, Online. Association for Computational Linguistics. +Yitong Li, Trevor Cohn, and Timothy Baldwin. 2017. Robust training under linguistic adversity. In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics: Volume 2, Short Papers, pages 21-27, Valencia, Spain. Association for Computational Linguistics. +Nelson F. Liu, Matt Gardner, Yonatan Belinkov, Matthew E. Peters, and Noah A. Smith. 2019a. Linguistic knowledge and transferability of contextual representations. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 1073-1094, Minneapolis, Minnesota. Association for Computational Linguistics. +Y. Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, M. Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019b. RoBERTa: A robustly optimized bert pretraining approach. arXiv, abs/1907.11692. +Pingchuan Ma, Shuai Wang, and Jin Liu. 2020. Metamorphic testing and certified mitigation of fairness violations in NLP models. In Proceedings of the Twenty-Ninth International Joint Conference on Artificial Intelligence, IJCAI 2020, pages 458-465. ijcai.org. +Marco Tulio Ribeiro, Tongshuang Wu, Carlos Guestrin, and Sameer Singh. 2020. Beyond accuracy: Behavioral testing of NLP models with CheckList. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 4902-4912, Online. Association for Computational Linguistics. + +Julia Rozanova, Deborah Ferreira, Mokanarangan Thayaparan, Marco Valentino, and Andre Freitas. 2021. Supporting context monotonicity abstractions in neural NLI models. arXiv, abs/2105.08008. +Enrico Santus, Anna Gladkova, Stefan Evert, and Alessandro Lenci. 2016. The CogALex-V shared task on the corpus-based identification of semantic relations. In Proceedings of the 5th Workshop on Cognitive Aspects of the Lexicon (CogALex - V), pages 69-79, Osaka, Japan. The COLING 2016 Organizing Committee. +Richard Socher, John Bauer, Christopher D. Manning, and Andrew Y. Ng. 2013. Parsing with compositional vector grammars. In Proceedings of the 51st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 455-465, Sofia, Bulgaria. Association for Computational Linguistics. +Liqun Sun and Zhi Quan Zhou. 2018. Metamorphic testing for machine translations: Mt4mt. In 2018 25th Australasian Software Engineering Conference (ASWEC), pages 96-100. +Damien Teney, Ehsan Abbasnejad, Kushal Kafle, Robik Shrestha, Christopher Kanan, and Anton van den Hengel. 2020. On the value of out-of-distribution testing: An example of goodhart's law. In Advances in Neural Information Processing Systems, volume 33, pages 407-417. Curran Associates, Inc. +Kaiyi Tu, Mingyue Jiang, and Zuohua Ding. 2021. A metamorphic testing approach for assessing question answering systems. Mathematics, 9(7). +Lennart Wachowiak, Christian Lang, Barbara Heinisch, and Dagmar Gromann. 2020. CogALex-VI shared task: Transrelation - a robust multilingual language model for multilingual relation identification. In Proceedings of the Workshop on the Cognitive Aspects of the Lexicon, pages 59-64, Online. Association for Computational Linguistics. +Hitomi Yanaka, Koji Mineshima, Daisuke Bekki, Kentaro Inui, Satoshi Sekine, Lasha Abzianidze, and Johan Bos. 2019. HELP: A dataset for identifying shortcomings of neural models in monotonicity reasoning. In Proceedings of the Eighth Joint Conference on Lexical and Computational Semantics (*SEM* 2019), pages 250-255, Minneapolis, Minnesota. Association for Computational Linguistics. +Hitomi Yanaka, Koji Mineshima, and Kentaro Inui. 2021. Exploring transitivity in neural NLI models through veridicality. In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume, pages 920-934, Online. Association for Computational Linguistics. +Wenpeng Yin, Jamaal Hay, and Dan Roth. 2019. Benchmarking zero-shot text classification: Datasets, evaluation and entailment approach. + +In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 3914-3923, Hong Kong, China. Association for Computational Linguistics. + +# Appendix A. Ethics statement + +Intelligent systems are becoming increasingly widespread, and NLP models are often used as important components in their architecture. However, once these systems are deployed in the real world, there is a risk of them exhibiting biased, erratic or dangerous behaviour. In order to prevent such events from happening, it is crucial to perform a thorough testing and validation process. Indeed, this is one of the tenets of the ACM Code of Ethics and Professional Conduct3. Namely, paragraph 2.5 therein recites "Extraordinary care should be taken to identify and mitigate potential risks in machine learning systems." The contributions we propose in the present paper are directed towards this goal. More specifically, we believe that metamorphic testing is a valuable tool in the model tester's arsenal, and our contributions widen its scope of application. As a result, more instances of unwanted behaviour can be identified and addressed before their impact is felt by the end user. + +# Appendix B. Quick-reference guide + +In this paper, we discuss and compare four classes of metamorphic relations. For ease of reference, we summarise them in Tables 6, 7, 8 and 9. These tables contain the formal definitions of the transformation $T$ and output property $P$ , a concrete example of possible inputs, and a reference to the corresponding sections in the present paper. + +
Single-input metamorphic relations
Input:x = The cat sat on the mat.
x' = The pet stood onto the mat.
T:replace any word of the input with a synonym.
P:y = f(x) ∧ ∃i ∀j ≠ i (yi > yj) ∧ (yi' > yj')
+ +Table 6: Example of robustness relations from the literature (Li et al., 2017). Robustness relations belong to the class of single-input relations (see Section 3). + +
Pairwise systematicity metamorphic relations
Input:x1=Light, cute and forgettable.
x2=A masterpiece four years in the making.
x'1=Thank you.Light, cute and forgettable.
x'2=Thank you.A masterpiece four years in the making.
T:concatenate the textThank you.at the beginning of the input.
P:spos(f(x1)) > spos(f(x2)) ⇌ spos(f(x1')) > spos(f(x2'))
+ +Table 7: Example of pairwise systematicity relations defined on a sentiment analysis task (see Section 4.1). + +
Pairwise compositionality metamorphic relations
Input:x1 = There was no tree.tree.There was nocherry tree.
x2 = There was no fruit.fruit.There was no apple.
Hidden:f(x1) = contextual embeddings of the tokens ( tree.tree.cherry tree. )
f(x2) = contextual embeddings of the tokens ( fruit.fruit.apple. )
P:s_hyp(f(x1)) > s_hyp(f(x2)) ⇔ s_ent(g(f(x1))) > s_ent(g(f(x2)))
+ +Table 8: Example of pairwise compositionality relations defined on a natural language inference task (see Section 5.1). Pairwise compositionality relations do not have a transformation $T$ . + +
Three-way transitivity metamorphic relations
x1, x2, x3 = arrangementsymmetricaltogether
Input:x12 = (arrangement symmetrical)
x23 = (symmetrical together)
x13 = (arrangement together)
T:choose two words from the source triplet x1, x2, x3
Psyn:vsyn(f(x12)) ∧ vsyn(f(x23)) ⇒ vsyn(f(x13))
Phyp:vhyp(f(x12)) ∧ vhyp(f(x23)) ⇒ vhyp(f(x13))
+ +Table 9: Example of three-way transitivity relations defined on the lexical relations of synonymy and hypernymy (see Section 6.1). \ No newline at end of file diff --git a/systematicitycompositionalityandtransitivityofdeepnlpmodelsametamorphictestingperspective/images.zip b/systematicitycompositionalityandtransitivityofdeepnlpmodelsametamorphictestingperspective/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..92f7f92d6c4234042bed7778abbe8259ce69ac84 --- /dev/null +++ b/systematicitycompositionalityandtransitivityofdeepnlpmodelsametamorphictestingperspective/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4bb6ba24305140e9f65764963557960d23574011dae0a2ba25229b6741deb5de +size 481870 diff --git a/systematicitycompositionalityandtransitivityofdeepnlpmodelsametamorphictestingperspective/layout.json b/systematicitycompositionalityandtransitivityofdeepnlpmodelsametamorphictestingperspective/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..71557eeeded7c7deb52b467966636eb922b25f20 --- /dev/null +++ b/systematicitycompositionalityandtransitivityofdeepnlpmodelsametamorphictestingperspective/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ecb9b3134226b4d036020610ff79949803a85abd44bdfc7ec93849e2ad05eb9 +size 498787 diff --git a/tabitypeawarebiencodersforopendomainentityretrieval/9e0d939b-98f8-4b31-8977-c0111929304c_content_list.json b/tabitypeawarebiencodersforopendomainentityretrieval/9e0d939b-98f8-4b31-8977-c0111929304c_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..6fd3c7a712182ba619a819789088664fd9366f49 --- /dev/null +++ b/tabitypeawarebiencodersforopendomainentityretrieval/9e0d939b-98f8-4b31-8977-c0111929304c_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6044ce80ece37f96f346619f33d159e3e45b84f2bbc20b0d94515046a97e4a1 +size 142494 diff --git a/tabitypeawarebiencodersforopendomainentityretrieval/9e0d939b-98f8-4b31-8977-c0111929304c_model.json b/tabitypeawarebiencodersforopendomainentityretrieval/9e0d939b-98f8-4b31-8977-c0111929304c_model.json new file mode 100644 index 0000000000000000000000000000000000000000..60a494d85c2cae2608026e6dea05ff577c59eb53 --- /dev/null +++ b/tabitypeawarebiencodersforopendomainentityretrieval/9e0d939b-98f8-4b31-8977-c0111929304c_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:73a6b9e36309957d1b600c8f35fc2da9f404d2235d346f5c461506a122c21e8d +size 166516 diff --git a/tabitypeawarebiencodersforopendomainentityretrieval/9e0d939b-98f8-4b31-8977-c0111929304c_origin.pdf b/tabitypeawarebiencodersforopendomainentityretrieval/9e0d939b-98f8-4b31-8977-c0111929304c_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..119ba0e791315766ed3acd2e13a10e3c61977b16 --- /dev/null +++ b/tabitypeawarebiencodersforopendomainentityretrieval/9e0d939b-98f8-4b31-8977-c0111929304c_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b56ef7d6c67fbafb3750e1d43306731d8e07b4503f5ae250e55463c6d1ce0262 +size 1028240 diff --git a/tabitypeawarebiencodersforopendomainentityretrieval/full.md b/tabitypeawarebiencodersforopendomainentityretrieval/full.md new file mode 100644 index 0000000000000000000000000000000000000000..fbfb5ca3d411d852a59a532b83ba20781310e737 --- /dev/null +++ b/tabitypeawarebiencodersforopendomainentityretrieval/full.md @@ -0,0 +1,473 @@ +# TABi: Type-Aware Bi-Encoders for Open-Domain Entity Retrieval + +Megan Leszczyński Daniel Y. Fu Mayee F. Chen Christopher Ré +Department of Computer Science, Stanford University +{mleszczy, danfu, mfchen, chrismre}@cs.stanford.edu + +# Abstract + +Entity retrieval—retrieving information about entity mentions in a query—is a key step in open-domain tasks, such as question answering or fact checking. However, state-of-the-art entity retrievers struggle to retrieve rare entities for ambiguous mentions due to biases towards popular entities. Incorporating knowledge graph types during training could help overcome popularity biases, but there are several challenges: (1) existing type-based retrieval methods require mention boundaries as input, but open-domain tasks run on unstructured text, (2) type-based methods should not compromise overall performance, and (3) type-based methods should be robust to noisy and missing types. In this work, we introduce TABi, a method to jointly train bi-encoders on knowledge graph types and unstructured text for entity retrieval for open-domain tasks. TABi leverages a type-enforced contrastive loss to encourage entities and queries of similar types to be close in the embedding space. TABi improves retrieval of rare entities on the Ambiguous Entity Retrieval (AmbER) sets, while maintaining strong overall retrieval performance on open-domain tasks in the KILT benchmark compared to state-of-the-art retrievers. TABi is also robust to incomplete type systems, improving rare entity retrieval over baselines with only $5\%$ type coverage of the training dataset. We make our code publicly available. $^{1}$ + +# 1 Introduction + +Entity retrieval (ER) is the process of finding the most relevant entities in a knowledge base for a natural language query.2 ER is crucial for open-domain NLP tasks, where systems are provided with a query without the information needed to answer the query (Karpukhin et al., 2020). For instance, to answer the query, "What team does + +George Washington play for?" an open-domain system can use an entity retriever to find information about George Washington in a knowledge base. Retrieving the correct George Washington in the query above—George Washington the baseball player, rather than George Washington the president—requires the retriever to recognize that keywords "team" and "play" imply George Washington is an athlete. However, recent work has shown that state-of-the-art retrievers exhibit popularity biases and struggle to resolve ambiguous mentions of rare "tail" entities (Chen et al., 2021). + +The goal of our work is to improve rare entity retrieval for open-domain NLP tasks. Rare entities are challenging to retrieve when they share a name with more popular entities. For instance, in a sample of Wikipedia, mentions of George Washington refer to the president $93\%$ of the time, so a retriever can do very well by learning a popularity bias and returning the president whenever it sees "George Washington." This strategy performs poorly on rare entities like George Washington the baseball player. To retrieve a rare entity instead of a popular entity for an ambiguous mention, the retriever needs to learn to leverage context cues to overcome the popularity bias. However, existing state-of-the-art retrievers for open-domain tasks (e.g., GENRE (Cao et al., 2021), DPR (Karpukhin et al., 2020)) are only trained on unstructured text, making it challenging for them to learn to associate context cues (e.g. "team" and "play") with groups of entities (e.g., athletes). + +A promising approach to overcome popularity biases is to incorporate types (e.g., athlete or politician) from a knowledge graph into the retriever. A key advantage of types is that contextual cues learned over popular entities can generalize to rare entities of the same types. However, there are several challenges with using types for open-domain retrieval. First, existing methods that use types assume mention boundaries are provided in the input (Gupta et al., 2017; Onoe and Durrett, 2020; Orr et al., + +![](images/6ba7b23e53cf9fb44fdf4c29677bea714c197cccb3e42602214845ef07bfb872.jpg) +Figure 1: TABi uses a query and entity encoder to embed queries and entities in the same space. To encourage embeddings of the same type (e.g. athlete) to be close, TABi introduces a type-enforced contrastive loss that pulls query embeddings of the same type together and pushes query embeddings of different types apart. + +2021), but open-domain tasks run over unstructured text. These methods can suffer significant quality degradation without mention boundaries. $^3$ Second, while it is important to do well on tail entities, the ideal retriever also needs to maintain strong performance over popular entities, balancing learning popularity biases with learning contextual cues. Finally, a retriever that incorporates types needs to be robust to incorrect and missing types, as type labels can be noisy and knowledge graphs can be incomplete. + +In this work, we introduce TABi, a method for training entity retrievers on knowledge graph types and unstructured text. TABi builds on the bi-encoder model for dense retrieval (e.g., Wu et al., 2020; Karpukhin et al., 2020) (Figure 1). Bi-encoders learn embeddings of queries and entities contrastively: query embeddings are pulled close to their ground truth entity embedding and pushed away from other entity embeddings. + +Our key insight is that type information should also be learned contrastively, as opposed to more straightforward approaches like adding the type as textual input. TABi adds a type-enforced contrastive loss term that pulls query embeddings of the same type together and pushes query embeddings of different types apart. As a result, TABi clusters embeddings by type more strongly than simply adding the type as input or not using types at all (Figure 2), and thus performs better on nearest neighbor type classification and entity similarity tasks. Finally, motivated by "universal" dense retrievers (Maillard et al., 2021), TABi trains over multiple open-domain tasks in addition to entity disambiguation to support retrieval without mention boundaries. + +Our experiments show that TABi addresses the challenges of using types for open-domain retrieval. First, we find that training a bi-encoder over multiple open-domain tasks significantly improves average top-1 tail retrieval by 29.1 points compared to existing state-of-the-art baselines. Our type-enforced loss further improves average top-1 tail retrieval by nearly 6 points. Second, TABi maintains strong overall retrieval performance on popular entities, nearly matching or outperforming the state-of-the-art multi-task model, GENRE, on the eight open-domain KILT tasks (Petroni et al., 2021). Third, TABi is robust to missing and incorrect types, obtaining $79\%$ of the lift from the type-enforced loss even when only $5\%$ of the training examples have type annotations. Finally, we also explore a hybrid model that combines TABi with a sparse retriever and popularity statistics. We find the hybrid model can lead to strong performance even when TABi is trained without hard negative sampling, a standard but computationally expensive training procedure. + +To summarize, our contributions are as follows: + +- We introduce TABi, a method to train bi-encoders on knowledge graph types and unstructured text through a new type-enforced contrastive loss for open-domain entity retrieval. +- We demonstrate that TABi improves rare entity retrieval performance, maintains strong overall retrieval performance, and is robust to noisy and missing types on AmbER and KILT. +- We validate that our approach can better capture types in query and entity embeddings than baseline dense entity retrievers through embedding visualization, nearest neighbor type classification, and an entity similarity task. + +# 2 Preliminaries + +We review the problem setup, task, and bi-encoders. + +Problem setup Let $q \in \mathcal{Q}$ be a query, $e \in \mathcal{E}$ be an entity description, $y \in \mathcal{V}$ be the entity label from the knowledge base, and $t \in \mathcal{T}$ be the type label. We assume as input a labeled dataset $D = \{(q_i, e_i, y_i, t_i)\}_{i=1}^n$ , where $n$ is the number of examples. + +Entity retrieval task Given a query $q$ as input, the entity retrieval task is to return the top- $K$ entity candidates relevant to the query from $\mathcal{V}$ . Since our primary motivation is open-domain NLP tasks, we focus on the page-level document retrieval setting, where we assume that each document corresponds to an entity (e.g., Wikipedia page) and that no mention boundaries are provided as input. + +Bi-encoders for entity retrieval The bi-encoder model consists of a query encoder $f: \mathcal{Q} \to \mathbb{R}^d$ and an entity encoder $g: \mathcal{E} \to \mathbb{R}^d$ . Most bi-encoders (e.g., Gillick et al., 2019; Wu et al., 2020) are trained with the InfoNCE loss (van den Oord et al., 2018), in which "positive" pairs of examples are pulled together and "negative" pairs of examples are pushed apart. For a particular query $q$ , let its positive example $e^+$ be the entity description for the respective gold entity and its negative examples $N_e(q)$ be the set of all other entity descriptions in the batch. For a batch with queries $Q$ and entity descriptions $E$ , the loss is defined as: + +$$ +L _ {N C E} (Q, E) = \frac {- 1}{| Q |} \sum_ {q \in Q} \log \frac {\psi (q , e ^ {+})}{\psi (q , e ^ {+}) + \sum_ {e ^ {-} \in N _ {e} (q)} \psi (q , e ^ {-})}, +$$ + +where $\psi (v,w) = \exp (f(v)^{\top}g(w) / \tau)$ is the similarity score between the embeddings $v$ and $w$ , and $\tau$ is a temperature hyperparameter. $L_{NCE}$ pulls each query embedding close to the entity embedding for its gold entity and pushes it away from all other entity embeddings in the batch. Batches are often constructed with hard negative samples to improve overall quality (e.g., Gillick et al., 2019). + +# 3 Approach + +TABi leverages knowledge graph types and unstructured text to train bi-encoders for open-domain entity retrieval. TABi takes as input queries + +and entity descriptions and uses a type-enforced contrastive loss. At inference time, TABi uses nearest neighbor search to retrieve entities. + +Input The query $q$ is represented as the WordPiece (Wu et al., 2016) tokens in the query, with special tokens $[\mathrm{M_s}]$ and $[\mathrm{M_e}]$ around the mention if the mention boundaries are known (matching the input of Wu et al. (2020) with mention boundaries and Karpukhin et al. (2020) without). The entity description $e$ is represented as the first 128 WordPiece tokens of the entity's title and a description (i.e., Wikipedia page), with each component separated by an $[\mathrm{E_s}]$ token, following Wu et al. (2020). We fine-tune the standard BERT-base pretrained model (Devlin et al., 2019) for both the query and entity encoders and take the final hidden layer representation corresponding to the [CLS] token as the query and entity embeddings. Similar to work in contrastive learning (Chen et al., 2020b), we then apply L2 normalization to the embeddings. + +Type-Enforced Contrastive Loss We propose a contrastive loss that incorporates knowledge graph types and builds on the supervised contrastive loss from Khosla et al. (2020). Our goal is to encode types in the embedding space, such that the embeddings of queries and entities of the same type are closer together than those of different types. Types are often not sufficient to distinguish an entity, so we also want to embed queries and entities with similar names close together. + +To achieve these two goals, our loss is a weighted sum of two supervised contrastive loss terms, $L_{type}$ and $L_{ent}$ . For a randomly-sampled batch from dataset $D$ with queries $Q$ and entity descriptions $E$ , TABi's loss $L_{TABi}$ is given by: + +$$ +\begin{array}{l} L _ {T A B i} (Q, E) = \\ \alpha L _ {t y p e} (Q) + (1 - \alpha) L _ {e n t} (Q, E), \tag {1} \\ \end{array} +$$ + +where $\alpha \in [0,1]$ (we use $\alpha = 0.1$ in our experiments). + +$L_{type}(Q)$ uses type labels to form positive and negative pairs over queries. Let $P_{type}(q)$ be the set of all queries in a batch that share the same type $t$ as a query $q$ and $N_{type}(q)$ be the other queries in the + +![](images/d893daa0c2e68ed07aa6ef276d070501410675daa40c5b833df6b948290fb85c.jpg) +Figure 2: t-SNE visualizations of entity embeddings. (a) BLINK trained with $L_{NCE}$ without types. (b) TABi trained with $L_{ent}$ with types only as text in the input. (c) TABi trained with the type-enforced loss $L_{TABi}$ . + +![](images/ccb41a7170ca6d5fec849479a4f3e5f0fb2c421945b63594b6b7bd4c3bd7d03d.jpg) + +![](images/2d3f64c52c6718f21db6c825b38070bd588d4afe4544ebb06accb465b8c27888.jpg) + +batch. Then $L_{type}(Q)$ is: + +$$ +L _ {t y p e} (Q) = \frac {- 1}{| Q |} \sum_ {q \in Q} \frac {1}{| P _ {t y p e} (q) |} +$$ + +$$ +\sum_ {q ^ {+} \in P _ {\text {t y p e}} (q)} \log \frac {\psi \left(q , q ^ {+}\right)}{\psi \left(q , q ^ {+}\right) + \sum_ {q ^ {-} \in N _ {\text {t y p e}} (q)} \psi \left(q , q ^ {-}\right)}. \tag {2} +$$ + +$L_{ent}(Q,E)$ uses entity labels to form positive and negative pairs over queries and entity descriptions.6 Let $x$ be a query or entity description, and $P_{ent}(x)$ be the set of all queries and entity descriptions in a batch that share the same gold entity $y$ as $x$ . Let $N_{ent}(x)$ be the set of all other queries and entity descriptions in the batch. Then $L_{ent}(Q,E)$ is: + +$$ +L _ {e n t} (Q, E) = \frac {- 1}{| Q \cup E |} \sum_ {x \in Q \cup E} \frac {1}{| P _ {e n t} (x) |} +$$ + +$$ +\sum_ {x ^ {+} \in P _ {e n t} (x)} \log \frac {\psi \left(x , x ^ {+}\right)}{\psi \left(x , x ^ {+}\right) + \sum_ {x ^ {-} \in N _ {e n t} (x)} \psi \left(x , x ^ {-}\right)}. \tag {3} +$$ + +We tie the weights of the query and entity encoders such that $f(\cdot) \equiv g(\cdot)$ so that $\psi$ is well-defined for all pairs of queries and entities. We also normalize embeddings before computing $\psi$ . Following recent work (Gillick et al., 2019; Karpukhin et al., 2020), we use hard negative sampling to add the top nearest incorrect entities for each query to the batch. We follow Botha et al. (2020) to balance the hard negatives by fixing the ratio of positive to negative examples allowed for each entity, reducing the proportion of hard negatives that are rare entities (see Appendix A.4). + +The key difference between $L_{type}$ and $L_{ent}$ is the set of positive and negative pairs. $L_{type}$ forms pairs by type, which clusters queries of the same type in the embedding space. $L_{ent}$ forms pairs by gold entity, which clusters queries and entities with similar names in the embedding space. Figure 2 shows that $L_{TABi}$ produces embeddings that cluster better by types than those produced by $LNCE$ (BLINK (Wu et al., 2020)) or $L_{ent}$ with types simply added as text to the entity encoder input. + +Inference We precompute entity embeddings and use nearest neighbor search to retrieve the top- $K$ most similar entity embeddings to a query embedding. While our standard configuration does not use a re-ranker, in Section 4.2 we also study the impact of adding an inexpensive re-ranker which linearly combines TABi's scores with sparse retriever scores and popularity statistics (see Appendix A.5). Prior work has shown that a hybrid model that combines sparse retrievers (e.g. TF-IDF) and dense retrievers can improve performance (Karpukhin et al., 2020; Luan et al., 2021) and that entity popularity can help disambiguation (Ganea and Hofmann, 2017). + +# 4 Retrieval Experiments + +Our experiments find that TABi can improve rare entity retrieval for open-domain NLP tasks while maintaining strong overall retrieval performance. + +# 4.1 Experimental setup + +We describe the baselines, evaluation datasets, knowledge base, and training data. We include additional setup details in Appendix A. + +Baselines We compare against text-only baselines, which do not use types, to evaluate to what extent using types can improve performance over existing methods. We also compare against type-aware baselines, which use types and text, to better + +understand the challenges with incorporating types. + +- Text-only baselines: Alias Table sorts candidates by their prior probabilities with the mention in the BLINK training dataset. TF-IDF uses sparse embeddings of normalized word frequencies. DPR (Karpukhin et al., 2020) is a dense passage retriever that does not use mention boundaries. BLINK (Bi-encoder) (Wu et al., 2020) is a state-of-the-art dense entity retriever which uses mention boundaries; we also compare against BLINK with a cross-encoder to re-rank the top 10 candidates from the bi-encoder. ELQ (Li et al., 2020) finetunes the BLINK bi-encoder jointly with mention detection and entity disambiguation tasks. GENRE (Cao et al., 2021) is an autoregressive retriever that generates the full entity name from the mention. We use pretrained models for all text-only baselines, with the exception of Alias Table and TF-IDF, which are non-learned. +- Type-aware baselines: Bootleg (Orr et al., 2021) is a Transformer-based model that re-ranks candidates from an alias table using types and knowledge graph relations. We also introduce two baselines for encoding types in open-domain retrievers: GENRE-type and TABi-type-text. GENRE-type includes the types as part of the entity name, and thus must generate the entity name along with its types. TABi-type-text adds the types as textual input to the entity encoder instead of the loss function and uses $L_{ent}$ for training. We use a pretrained model for Bootleg, fine-tune a pretrained model of GENRE to create GENRE-type, and fine-tune TABi-type-text from a BERT-base pretrained model (Devlin et al., 2019). + +Evaluation datasets We use 14 datasets from two benchmarks: Ambiguous Entity Retrieval (AmbER) (Chen et al., 2021) and Knowledge Intensive Language Tasks (KILT) (Petroni et al., 2021). AmbER evaluates retrieval of ambiguous rare entities, and KILT evaluates overall retrieval performance. + +AmbER. AmbER (Chen et al., 2021) spans three tasks in open-domain NLP—fact checking, slot filling, and question answering—and is divided into human and non-human subsets, for a total of 6 datasets. AmbER tests the ability to retrieve the correct entity when at least two entities share a name (i.e. are ambiguous). The queries are designed to be resolvable, such that each query should contain enough information to retrieve the correct entity. AmbER also comes with "head" (i.e. popular) and + +"tail" (i.e. rare) labels, using Wikipedia page views for popularity. We split AmbER into dev and test (5/95 split) and report on the test set.9 + +We create a variant of this dataset-AmbER (GOLD)-with gold mention boundaries. While we focus on open-domain tasks, where mention boundaries are often unknown, AmbER (GOLD) enables us to evaluate disambiguation in isolation. + +Following Chen et al. (2021), we report accuracy@1 (i.e. top-1 retrieval accuracy), which is the percentage of queries where the top-ranked entity is the gold entity. As multiple entities share a name with the query mention (by the dataset definition), this metric captures how well a model can use context to disambiguate. + +KILT. We consider 8 evaluation datasets across the four open-domain tasks in the KILT (Petroni et al., 2021) benchmark (fact checking (FC), question answering (QA), slot filling (SF), and dialogue). All examples have been annotated with the Wikipedia page(s) that help complete the task. + +Following Petroni et al. (2021), we report R-precision (Beitzel et al., 2009). Given $R$ gold entities, R-precision is equivalent to the proportion of relevant entities in the top-R ranked entities. With the exception of FEVER and HotPotQA, which may require multiple entities, R-precision is equivalent to accuracy@1. We compare against published and leaderboard numbers for KILT and refer the reader to Petroni et al. (2021) for baseline details. + +Knowledge base We create a filtered version of the KILT knowledge base (Petroni et al., 2021) with 5.45M entities that correspond to English Wikipedia pages. We remove Wikimedia internal items (e.g., disambiguation pages, list articles) from the KILT knowledge base, since they do not refer to real-world entities. We refer to our knowledge base as KILT-E (KILT-Entity) and use it for all models at inference time for fair comparison.[10] + +Training data We train two versions of TABi to understand the performance with and without mention boundaries in the input. For retrieval experiments with mention boundaries and embedding quality experiments, we train on the BLINK (Wu et al., 2020) training data, which consists of 8.9M + +
ModelFact CheckingSlot FillingQuestion Answering
HNHNHNAverage
HeadTailHeadTailHeadTailHeadTailHeadTailHeadTailHeadTail
TF-IDF27.829.323.021.826.723.517.313.724.222.618.213.922.920.8
DPR25.314.347.723.713.95.148.622.221.08.852.123.434.816.3
BLINK (Bi-encoder)56.452.024.810.576.855.730.713.578.355.767.333.855.736.9
BLINK55.845.87.43.974.730.332.116.183.843.871.344.554.230.7
ELQ43.537.45.32.274.444.159.527.177.547.262.030.753.731.4
GENRE59.930.732.619.967.152.672.959.562.928.461.132.459.437.2
Bootleg†48.737.03.72.565.148.047.526.774.848.060.544.250.034.4
GENRE-type32.250.655.734.934.968.075.469.641.655.872.147.652.054.4
TABi-type-text76.760.439.036.871.686.382.585.269.666.182.357.070.365.3
TABi83.573.340.741.775.189.485.688.078.074.383.066.174.372.1
TABi (α=0)77.661.941.439.170.987.183.285.972.566.382.257.771.366.3
TABi (Ltype+LNCE)80.564.742.042.269.187.783.987.372.267.781.361.871.568.6
+ +Table 1: Retrieval accuracy@1 on AmbER (H for human, N for non-human subsets). (Top) text-only methods, (middle) type-aware methods, and (bottom) ablations. †Models with an alias table. See Section 4.2 for training data details. Best score bolded, second best underlined (excluding ablations). + +
ModelFact CheckingSlot FillingQuestion AnsweringAverage
HNHNHN
HeadTailHeadTailHeadTailHeadTailHeadTailHeadTailHeadTail
Alias Table†45.96.645.87.945.96.545.77.845.76.545.37.945.77.2
TF-IDF27.829.323.021.826.723.517.313.724.222.618.213.922.920.8
BLINK (Bi-encoder)77.566.577.046.076.955.963.829.978.455.871.034.874.148.2
BLINK81.861.081.658.575.430.564.835.783.843.974.945.777.145.9
GENRE70.944.572.940.670.639.064.833.171.140.670.340.070.139.6
Bootleg†83.070.782.156.684.958.876.154.786.351.279.256.582.058.1
GENRE-type69.760.875.948.570.954.366.737.270.754.672.546.771.150.3
TABi-type-text81.575.078.958.178.562.163.138.680.061.568.242.075.056.2
TABi84.482.380.463.578.568.664.539.181.569.871.851.676.962.5
+ +Table 2: Retrieval accuracy@1 on AmbER (GOLD) (with mention boundaries). (Top) text-only, (bottom) type-aware methods. All models are trained on Wikipedia. †Models with an alias table. Best score bolded, second best underlined. + +Wikipedia sentences. $^{11}$ For retrieval experiments without mention boundaries, we follow Cao et al. (2021) and train on all KILT training data (which includes open-domain tasks) and contains 11.7M sentences (Petroni et al., 2021). For type labels, we use the 113 types from the FIGER (Ling and Weld, 2012) type set. To assign entity types, we use a direct mapping of Wikidata entities to Freebase entities to find the FIGER types associated with each entity in Freebase. To assign query types, we follow Ling and Weld (2012) and add the types of the gold entity for each query as the query type labels. While types can be incomplete and not present in the query, we find that the type labels are sufficient for improving the embedding quality ( $\S 5$ ). + +# 4.2 Results + +Rare entities TABi improves retrieval of rare entities for ambiguous mentions. On AmbER, + +TABi improves average tail accuracy@1 by 34.9 points compared to existing text-only baselines and 6.8 points compared to type-aware baselines (Table 1). Note that GENRE, GENRE-type, TABi-type-text, and TABi are trained on KILT data (which includes open-domain tasks), while BLINK, ELQ, and Bootleg are trained on Wikipedia entity disambiguation data, and DPR is trained on question answering data. See the ablations for a discussion of the training data impact. On AmbER (GOLD) where all models are trained on Wikipedia entity disambiguation data and mention boundaries are available (Table 2), TABi outperforms baselines on average tail accuracy@1 by 4.4 points. BLINK and Bootleg perform much better on AmbER (GOLD) than on AmbER, suggesting that mention detection introduces significant error. + +Overall performance TABi maintains strong performance overall. On AmbER, TABi outperforms all retrievers for average accuracy@1 over the head + +
Fact Check.Slot FillingQuestion AnsweringDial.
FEVT-RExzsRENQHoPoTQAELI5WoWAvg.
TF-IDF*50.944.760.828.134.146.413.749.041.0
DPR*55.313.328.954.325.044.510.725.532.2
Multi-task DPR*74.569.580.959.442.961.515.541.155.7
BLINK*63.759.678.824.546.165.69.338.248.2
GENRE†83.679.495.860.351.369.215.862.964.8
KGI**75.674.498.563.7-60.5-55.4-
Re2G**88.980.7-70.8-72.7-60.1-
TABi84.481.996.262.653.170.418.359.165.8
+ +Table 3: R-precision on KILT open-domain tasks (test data). *Numbers from Petroni et al. (2021). †Numbers from Cao et al. (2021). **Numbers from KILT leaderboard. Best score bolded and second best underlined. + +![](images/3d5d1516627e97c109f0d3861483e76429f7f8e52e7b69cdba8fb09509a17505.jpg) +Figure 3: Robustness of TABi to missing types (left) and incorrect types (middle) in the training dataset. Sensitivity of TABi to the type weight $\alpha$ (right). + +![](images/7ca9a6487bb8c1faa955626793265f578042d765270d928e1b0c21cf7a6f8ca4.jpg) + +![](images/f06a9c792b9dd2e178165ad6285e3713d5c8cfb91736058a6f2d4eed522b6d67.jpg) + +(Table 1). On AmbER (GOLD), TABi follows Bootleg, which leverages an alias table limiting the number of candidates, and BLINK, which uses an expensive cross-encoder for re-ranking. On KILT, we find that TABi outperforms GENRE, the best performing multi-task retriever $^{12}$ overall by 1 point and sets the state-of-the-art on three KILT tasks (Table 3). + +Ablations Table 1 reports ablations. First, to measure the impact of types, we remove the type-enforced loss $(L_{type})$ by setting $\alpha = 0$ . This is equivalent to training TABi with just $L_{ent}$ . Compared to full TABi, the average accuracy @1 drops by 5.8 and 3.0 points on the tail and head, demonstrating the importance of the type-enforced loss, particularly over the tail. Moreover, we observe that TABi $(\alpha = 0)$ still outperforms the BLINK bi-encoder by 29.4 points over the tail. As the BLINK bi-encoder is trained only on entity disambiguation, this suggests that additionally training over open-domain tasks leads to substantial improvements (see Appendix B.1). Second, we evaluate the impact of using $L_{ent}$ instead of the standard $L_{NCE}$ to compare pairs of queries and entity descriptions based on their gold entity (Section 3). Compared to full TABi (which uses $L_{type} + L_{ent}$ ), TABi $(L_{type} + L_{NCE})$ incurs an average accuracy @1 drop of 3.5 and 2.8 points over the tail and head, respectively. + +Robustness to noise We run two experiments to simulate incomplete and noisy type annotations. First, we randomly remove types from a proportion of the training set. Figure 3 (left) shows TABi achieves $79\%$ of the lift on AmbER tail with just $5\%$ type coverage. Second, we randomly flip the types of a proportion of the training set to a type that has no type overlap with the gold type. Figure 3 (middle) shows TABi can still achieve $>2$ points of lift over no types even when $50\%$ of the types are incorrect. Surprisingly, even $100\%$ incorrect types does not hurt performance over using no types. + +Type weight sensitivity Figure 3 (right) shows TABi's sensitivity to the type weight $\alpha$ on the AmbER tail and Natural Questions (NQ) (Kwiatkowski et al., 2019), a task in KILT. We find there can be a tradeoff on some datasets: too small of an $\alpha$ is not sufficient to learn the type from the query context, whereas too large of an $\alpha$ can start to reduce overall performance. To balance this tradeoff, we set $\alpha = 0.1$ in all experiments. + +Re-ranking We evaluate (1) whether an inexpensive re-ranker that combines TABi with sparse retrieval and popularity scores can further improve performance, and (2) whether hard negative sampling is necessary when we use a re-ranker. Table 4 shows that re-ranking can improve accuracy@1 over by 1.5 and 0.6 points over the head and tail in AmbER, respectively. Without hard negative sampling, the + +
ModelAvg. HeadAvg. Tail
TABi74.372.1
TABi (α=0)71.366.3
TABi + RR75.872.7
TABi + RR (no hard negatives)70.470.7
+ +Table 4: Average head/tail accuracy @ 1 on AmbER when TABi is combined with an inexpensive re-ranker (RR). + +
DatasetModelAcc.Micro F1Macro F1
FIGERBLINK15.840.525.1
TABi49.072.876.6
OntoNotesBLINK21.534.242.3
TABi38.657.363.3
+ +performance of TABi decreases, especially over the head. However, TABi with the re-ranker and no hard negative sampling can still nearly match TABi $(\alpha = 0)$ —the strong bi-encoder baseline without types—over the head and outperforms it over the tail, despite TABi $(\alpha = 0)$ using hard negative sampling. This suggests that there may be alternatives to hard negative sampling, such as incorporating structured data, for achieving strong performance on some tasks. + +# 5 Embedding Quality Analysis + +We evaluate how well TABi captures types through embedding visualization, nearest neighbor type classification, and an entity similarity task. + +Embedding visualization We use t-SNE to qualitatively evaluate how well bi-encoders cluster entity embeddings by type. Figure 2 shows that TABi forms tighter type clusters than BLINK for five FIGER types. $^{13}$ Types are not captured as well when the type is only present in the input and not the loss. This suggests that our type-based loss term helps encode types in the embedding space. + +Type classification To better understand how well embeddings are clustered by type, we evaluate query and entity embeddings using KNN classification with $K = 10$ . We use strict accuracy, loose micro F1, and loose macro F1 metrics for evaluation (Zhang et al., 2019). TABi outperforms BLINK on KNN classification over query embeddings on FIGER and OntoNotes, confirming that our loss encourages nearby query embeddings to share the + +Table 5: Mention type classification using a nearest neighbor classifier over query embeddings. + +
TransEComplExBLINKTABi
Spearman ρ62.463.459.468.6
+ +Table 6: Spearman rank correlation on our proposed entity similarity task over pairs of Wikidata entities. + +same type (Table 5). Appendix C.2 reports KNN experiments on entity embeddings, where we find TABi outperforms BLINK on KNN classification of both coarse and fine types, confirming our loss also helps the entity embeddings encode types. + +Entity similarity ranking To understand how well our method learns finer-grained type hierarchies, we create a novel entity similarity task inspired by word similarity tasks (Schnabel et al., 2015). The goal is to rate the similarity of entity pairs, where the pair has a high score if the two entities share a fine type and a lower score otherwise. We assign ground truth similarity scores to 500 entity pairs that share Wikidata types $^{15}$ of varying coarseness using a weighted Jaccard similarity metric from the KGTK Semantic Similarity toolkit (Ilievski et al., 2021) $^{16}$ (see Appendix C.3). + +Table 6 compares the Spearman rank correlation of the inner products of BLINK and TABi entity embeddings with the ground truth similarity scores, as well as two popular knowledge graph embeddings, TransE (Bordes et al., 2013) and ComplEx (Trouillon et al., 2016) (for which we use cosine similarities between entity pairs provided by KGTK). TABi outperforms BLINK and the knowledge graph embeddings. This is surprising, since the knowledge graph embeddings are trained on triples which include Wikidata types, whereas TABi is only trained with coarser-grained FIGER types. + +# 6 Discussion + +We discuss limitations of TABi. First, we assume a relatively coarse type system is available. To pull together query embeddings of the same type, the type system needs to be sufficiently coarse-grained and the batch size large enough such that multiple examples in a randomly sampled batch have the same type. Second, our method is designed for open-domain tasks, which tend to have short queries and strong type disambiguation signals. However, there are disambiguation signals that may be present in queries, + +such as the existence of a knowledge graph relation between two entities, that TABi does not optimize for learning. To address this, we are interested in incorporating other forms of structured data, including different modalities, into our model as future work. + +# 7 Related Work + +Entity disambiguation with types Our work is inspired by prior work that has used types for entity disambiguation (Ling et al., 2015; Gupta et al., 2017; Gillick et al., 2019; Onoe and Durrett, 2020; Chen et al., 2020a; Orr et al., 2021). Most closely related are Gillick et al. (2019) and Gupta et al. (2017). Gillick et al. (2019) train dense retrievers with Wikipedia categories as input, but do not include types in the loss function. On the other hand, Gupta et al. (2017) incorporate types through multi-task learning with type prediction, but rely on alias tables. Generally, prior works that use types assume mention boundaries are given as input. Similar to our work, Gupta et al. (2017), Onoe and Durrett (2020), and Orr et al. (2021) show that using types can improve disambiguation of rare entities. Finally, types have also been shown to improve performance on coreference resolution (Khosla and Rose, 2020) and natural language generation (Dong et al., 2021). + +Entity typing A task closely related to our work is entity typing, or predicting the set of types for a mention (e.g., Ling and Weld, 2012; Gillick et al., 2014; Onoe et al., 2021). A key difference is that entity typing methods often learn explicit type embeddings to perform type classification, whereas TABi only learns query and entity embeddings. Entity typing methods could be used to add type labels to the training data as an alternative to TABi's approach that uses a direct knowledge graph type mapping. + +Retrieval for open-domain NLP There has been extensive work on dense retrieval for open-domain NLP tasks (e.g. Lee et al., 2019; Karpukhin et al., 2020; Oğuz et al., 2020). However, most prior work has assumed unstructured text as the only input. As an exception, Oğuz et al. (2020) incorporate structured data, such as knowledge graph relations and tables, into dense retrieval by flattening the structured data into text and adding it to the retrieval index. This approach is complementary to TABi, which incorporates the structured data into the loss to learn better representations of the index. + +Alternatives to bi-encoders Several works have focused on improving the bi-encoder model + +by leveraging multiple embeddings for each query or candidate (Humeau et al., 2020; Khattab and Zaharia, 2020; Luan et al., 2021). These approaches are complementary to TABi—which maintains a single embedding for each query and candidate—and may lead to further quality improvements at some computational expense. + +# 8 Conclusion + +We introduce a method to train bi-encoders on unstructured text and knowledge graph types through a type-enforced contrastive loss. Our loss can improve retrieval of rare entities for ambiguous mentions, while maintaining strong overall performance on open-domain NLP tasks. We hope our work inspires future work on integrating structured data into pretrained models. + +# Acknowledgements + +We thank Simran Arora, Ines Chami, Neel Guha, Laurel Orr, Maya Varma, Sen Wu, and the anonymous reviewers for their helpful feedback. We gratefully acknowledge the support of NIH under No. U54EB020405 (Mobilize), NSF under Nos. CCF1763315 (Beyond Sparsity), CCF1563078 (Volume to Velocity), and 1937301 (RTML); ARL under No. W911NF-21-2-0251 (Interactive Human-AI Teaming); ONR under No. N000141712266 (Unifying Weak Supervision); ONR N00014-20-1-2480: Understanding and Applying Non-Euclidean Geometry in Machine Learning; N000142012275 (NEPTUNE); NXP, Xilinx, LETI-CEA, Intel, IBM, Microsoft, NEC, Toshiba, TSMC, ARM, Hitachi, BASF, Accenture, Ericsson, Qualcomm, Analog Devices, Google Cloud, Salesforce, Total, the HAI-GCP Cloud Credits for Research program, the Stanford Data Science Initiative (SDSI), the NSF Graduate Research Fellowship under No. DGE-1656518, the Department of Defense under the National Defense Science and Engineering Graduate Fellowship Program, and members of the Stanford DAWN project: Facebook, Google, and VMWare. The U.S. Government is authorized to reproduce and distribute reprints for Governmental purposes notwithstanding any copyright notation thereon. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views, policies, or endorsements, either expressed or implied, of NIH, ONR, or the U.S. Government. + +# Broader Impact + +We believe that our work has the potential to positively impact underrepresented populations. A key benefit of our method is improved retrieval of rare entities, which infrequently or never occur in the training dataset. Rare entities may not only consist of individuals from underrepresented populations, but may also be entities that are of interest to underrepresented populations (e.g., songs, locations). While we hope our work will have a positive impact, we also caution that our method is susceptible to biases present in standard pretrained language models and large Internet-based training datasets. We fine-tune our model from a BERT-base pretrained model using BLINK and KILT training datasets, which include content from Wikipedia, Reddit, trivia websites, and crowd-sourced questions and dialogue. + +# References + +Alan Akbik, Tanja Bergmann, Duncan Blythe, Kashif Rasul, Stefan Schweter, and Roland Vollgraf. 2019. FLAIR: An easy-to-use framework for state-of-the-art NLP. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics (Demonstrations), pages 54-59, Minneapolis, Minnesota. Association for Computational Linguistics. +Steven M. Beitzel, Eric C. Jensen, and Ophir Frieder. 2009. Average R-Precision, pages 195-195. Springer US, Boston, MA. +Antoine Bordes, Nicolas Usunier, Alberto García-Durán, Jason Weston, and Oksana Yakhnenko. 2013. Translating embeddings for modeling multi-relational data. In Advances in Neural Information Processing Systems 26: 27th Annual Conference on Neural Information Processing Systems 2013. Proceedings of a meeting held December 5-8, 2013, Lake Tahoe, Nevada, United States, pages 2787-2795. +Jan A. Botha, Zifei Shan, and Daniel Gillick. 2020. Entity Linking in 100 Languages. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 7833-7845, Online. Association for Computational Linguistics. +Nicola De Cao, Gautier Izacard, Sebastian Riedel, and Fabio Petroni. 2021. Autoregressive entity retrieval. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021. OpenReview.net. +Anthony Chen, Pallavi Gudipati, Shayne Longpre, Xiao Ling, and Sameer Singh. 2021. Evaluating entity disambiguation and the role of popularity in retrieval-based NLP. In Proceedings of the 59th Annual Meeting of the Association for Computational + +Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 4472-4485, Online. Association for Computational Linguistics. +Shuang Chen, Jinping Wang, Feng Jiang, and Chin-Yew Lin. 2020a. Improving entity linking by modeling latent entity type information. In The Thirty-Fourth AAAI Conference on Artificial Intelligence, AAAI 2020, The Thirty-Second Innovative Applications of Artificial Intelligence Conference, IAAI 2020, The Tenth AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI 2020, New York, NY, USA, February 7-12, 2020, pages 7529-7537. AAAI Press. +Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey E. Hinton. 2020b. A simple framework for contrastive learning of visual representations. In Proceedings of the 37th International Conference on Machine Learning, ICML 2020, 13-18 July 2020, Virtual Event, volume 119 of Proceedings of Machine Learning Research, pages 1597-1607. PMLR. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171-4186, Minneapolis, Minnesota. Association for Computational Linguistics. +Emily Dinan, Stephen Roller, Kurt Shuster, Angela Fan, Michael Auli, and Jason Weston. 2019. Wizard of wikipedia: Knowledge-powered conversational agents. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net. +Xiangyu Dong, Wenhao Yu, Chenguang Zhu, and Meng Jiang. 2021. Injecting entity types into entity-guided text generation. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 734-741, Online and Punta Cana, Dominican Republic. Association for Computational Linguistics. +Hady Elsahar, Pavlos Vougiouklis, Arslen Remaci, Christophe Gravier, Jonathon Hare, Frederique Laforest, and Elena Simperl. 2018. T-REx: A large scale alignment of natural language with knowledge base triples. In Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC 2018), Miyazaki, Japan. European Language Resources Association (ELRA). +Angela Fan, Yacine Jernite, Ethan Perez, David Grangier, Jason Weston, and Michael Auli. 2019. ELI5: Long form question answering. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 3558-3567, Florence, Italy. Association for Computational Linguistics. +Octavian-Eugen Ganea and Thomas Hofmann. 2017. Deep joint entity disambiguation with local neural + +attention. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 2619-2629, Copenhagen, Denmark. Association for Computational Linguistics. +Daniel Gillick, Sayali Kulkarni, Larry Lansing, Alessandro Presta, Jason Baldridge, Eugene Ie, and Diego Garcia-Olano. 2019. Learning dense representations for entity retrieval. In Proceedings of the 23rd Conference on Computational Natural Language Learning (CoNLL), pages 528-537, Hong Kong, China. Association for Computational Linguistics. +Daniel Gillick, Nevena Lazic, Kuzman Ganchev, Jesse Kirchner, and David Huynh. 2014. Context-dependent fine-grained entity type tagging. Computing Research Repository, arXiv:1412.1820. +Michael Glass, Gaetano Rossiello, Md Faisal Mahbub Chowdhury, and Alfio Gliozzo. 2021. Robust retrieval augmented generation for zero-shot slot filling. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 1939-1949, Online and Punta Cana, Dominican Republic. Association for Computational Linguistics. +Nitish Gupta, Sameer Singh, and Dan Roth. 2017. Entity linking via joint encoding of types, descriptions, and context. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 2681-2690, Copenhagen, Denmark. Association for Computational Linguistics. +Samuel Humeau, Kurt Shuster, Marie-Anne Lachaux, and Jason Weston. 2020. Poly-encoders: Architectures and pre-training strategies for fast and accurate multi-sentence scoring. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net. +Filip Ilievski, Pedro Szekely, Gleb Satyukov, and Amandeep Singh. 2021. User-friendly comparison of similarity algorithms on wikidata. ArXiv preprint, abs/2108.05410. +Mandar Joshi, Eunsol Choi, Daniel Weld, and Luke Zettlemoyer. 2017. TriviaQA: A large scale distantly supervised challenge dataset for reading comprehension. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1601-1611, Vancouver, Canada. Association for Computational Linguistics. +Vladimir Karpukhin, Barlas Oguz, Sewon Min, Patrick Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih. 2020. Dense passage retrieval for open-domain question answering. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 6769-6781, Online. Association for Computational Linguistics. +Omar Khattab and Matei Zaharia. 2020. *Colbert: Efficient and effective passage search via contextualized late interaction over BERT.* In *Proceedings of the 43rd International ACM SIGIR conference on + +research and development in Information Retrieval, SIGIR 2020, Virtual Event, China, July 25-30, 2020, pages 39-48. ACM. +Prannay Khosla, Piotr Teterwak, Chen Wang, Aaron Sarna, Yonglong Tian, Phillip Isola, Aaron Maschinot, Ce Liu, and Dilip Krishnan. 2020. Supervised contrastive learning. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual. +Sopan Khosla and Carolyn Rose. 2020. Using type information to improve entity coreference resolution. In Proceedings of the First Workshop on Computational Approaches to Discourse, pages 20-31, Online. Association for Computational Linguistics. +Tom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, Ankur Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Jacob Devlin, Kenton Lee, Kristina Toutanova, Llion Jones, Matthew Kelcey, Ming-Wei Chang, Andrew M. Dai, Jakob Uszkoreit, Quoc Le, and Slav Petrov. 2019. Natural questions: A benchmark for question answering research. Transactions of the Association for Computational Linguistics, 7:452-466. +Kenton Lee, Ming-Wei Chang, and Kristina Toutanova. 2019. Latent retrieval for weakly supervised open domain question answering. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 6086–6096, Florence, Italy. Association for Computational Linguistics. +Omer Levy, Minjoon Seo, Eunsol Choi, and Luke Zettlemoyer. 2017. Zero-shot relation extraction via reading comprehension. In Proceedings of the 21st Conference on Computational Natural Language Learning (CoNLL 2017), pages 333-342, Vancouver, Canada. Association for Computational Linguistics. +Belinda Z. Li, Sewon Min, Srinivasan Iyer, Yashar Mehdad, and Wen-tau Yih. 2020. Efficient one-pass end-to-end entity linking for questions. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 6433-6441, Online. Association for Computational Linguistics. +Xiao Ling, Sameer Singh, and Daniel S. Weld. 2015. Design challenges for entity linking. Transactions of the Association for Computational Linguistics, 3:315-328. +Xiao Ling and Daniel S. Weld. 2012. Fine-grained entity recognition. In Proceedings of the Twenty-Sixth AAAI Conference on Artificial Intelligence, July 22-26, 2012, Toronto, Ontario, Canada. AAAI Press. +Ilya Loshchilov and Frank Hutter. 2019. Decoupled weight decay regularization. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net. + +Yi Luan, Jacob Eisenstein, Kristina Toutanova, and Michael Collins. 2021. Sparse, dense, and attentional representations for text retrieval. Transactions of the Association for Computational Linguistics, 9:329-345. +Jean Maillard, Vladimir Karpukhin, Fabio Petroni, Wen-tau Yih, Barlas Oguz, Veselin Stoyanov, and Gargi Ghosh. 2021. Multi-task retrieval for knowledge-intensive tasks. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume I: Long Papers), pages 1098-1111, Online. Association for Computational Linguistics. +Yasumasa Onoe, Michael Boratko, Andrew McCallum, and Greg Durrett. 2021. Modeling fine-grained entity types with box embeddings. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 2051-2064, Online. Association for Computational Linguistics. +Yasumasasa Onoe and Greg Durrett. 2020. Fine-grained entity typing for domain independent entity linking. In The Thirty-Fourth AAAI Conference on Artificial Intelligence, AAAI 2020, The Thirty-Second Innovative Applications of Artificial Intelligence Conference, IAAI 2020, The Tenth AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI 2020, New York, NY, USA, February 7-12, 2020, pages 8576-8583. AAAI Press. +Laurel Orr, Megan Leszczynski, Neel Guha, Sen Wu, Simran Arora, Xiao Ling, and Christopher Ré. 2021. Bootleg: Chasing the tail with self-supervised named entity disambiguation. In Conference on Innovative Data Systems Research (CIDR). +Barlas Oğuz, Xilun Chen, Vladimir Karpukhin, Stanislav Peshterliev, Dmytro Okhonko, M. Schlichtkrull, Sonal Gupta, Yashar Mehdad, and Scott Yih. 2020. Unik-qa: Unified representations of structured and unstructured knowledge for open-domain question answering. ArXiv preprint, abs/2012.14610. +Fabio Petroni, Aleksandra Piktus, Angela Fan, Patrick Lewis, Majid Yazdani, Nicola De Cao, James Thorne, Yacine Jernite, Vladimir Karpukhin, Jean Maillard, Vassilis Plachouras, Tim Rocttäschel, and Sebastian Riedel. 2021. KILT: a benchmark for knowledge intensive language tasks. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 2523-2544, Online. Association for Computational Linguistics. +Tobias Schnabel, Igor Labutov, David Mimno, and Thorsten Joachims. 2015. Evaluation methods for unsupervised word embeddings. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pages 298-307, Lisbon, Portugal. Association for Computational Linguistics. + +Sonse Shimaoka, Pontus Stenetorp, Kentaro Inui, and Sebastian Riedel. 2017. Neural architectures for fine-grained entity type classification. In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics: Volume 1, Long Papers, pages 1271-1280, Valencia, Spain. Association for Computational Linguistics. +James Thorne, Andreas Vlachos, Christos Christodoulopoulos, and Arpit Mittal. 2018. FEVER: a large-scale dataset for fact extraction and VERIFICATION. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 809-819, New Orleans, Louisiana. Association for Computational Linguistics. +Théo Trouillon, Johannes Welbl, Sebastian Riedel, Éric Gaussier, and Guillaume Bouchard. 2016. Complex embeddings for simple link prediction. In Proceedings of the 33nd International Conference on Machine Learning, ICML 2016, New York City, NY, USA, June 19-24, 2016, volume 48 of JMLR Workshop and Conference Proceedings, pages 2071-2080. JMLR.org. +Aaron van den Oord, Yazhe Li, and Oriol Vinyals. 2018. Representation learning with contrastive predictive coding. ArXiv preprint, abs/1807.03748. +Ledell Wu, Fabio Petroni, Martin Josifoski, Sebastian Riedel, and Luke Zettlemoyer. 2020. Scalable zero-shot entity linking with dense entity retrieval. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 6397-6407, Online. Association for Computational Linguistics. +Yonghui Wu, Mike Schuster, Z. Chen, Quoc V. Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, Jeff Klingner, Apurva Shah, Melvin Johnson, Xiaobing Liu, Lukasz Kaiser, Stephan Gouws, Yoshikiyo Kato, Taku Kudo, Hideto Kazawa, Keith Stevens, George Kurian, Nishant Patil, Wei Wang, Cliff Young, Jason R. Smith, Jason Riesa, Alex Rudnick, Oriol Vinyals, Gregory S. Corrado, Macduff Hughes, and Jeffrey Dean. 2016. Google's neural machine translation system: Bridging the gap between human and machine translation. ArXiv preprint, abs/1609.08144. +Zhilin Yang, Peng Qi, Saizheng Zhang, Yoshua Bengio, William Cohen, Ruslan Salakhutdinov, and Christopher D. Manning. 2018. HotpotQA: A dataset for diverse, explainable multi-hop question answering. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 2369-2380, Brussels, Belgium. Association for Computational Linguistics. +Zhengyan Zhang, Xu Han, Zhiyuan Liu, Xin Jiang, Maosong Sun, and Qun Liu. 2019. ERNIE: Enhanced language representation with informative entities. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, + +pages 1441-1451, Florence, Italy. Association for Computational Linguistics. + +# Appendix + +# A Experimental Setup Details + +# A.1 Baselines + +We use pretrained models for all learned text-only baselines. For fair comparison, we use the KILT-E knowledge base at inference time for all models (see Section 4.1 for details on the knowledge base). We include model parameter counts in Table 7. Note that DPR, BLINK (Bi-encoder), BLINK, ELQ, TABi-type-text, and TABi require an index of embeddings to be stored in addition to the model parameters for fast inference. + +
Model# Parameters
Text-only methods
Alias Table0
TF-IDF0
DPR220M
BLINK (Bi-encoder)680M
BLINK1.0B
ELQ680M
GENRE406M
Type-aware methods
Bootleg1.3B
GENRE-type406M
TABi-type-text110M
TABi110M
+ +Table 7: Number of model parameters. + +For Alias Table, we compute the prior probability of a mention-entity pair over the BLINK training dataset. + +For TF-IDF, DPR, and BLINK, we use the code provided in the KILT repository. For the BLINK cross-encoder, we use $k = 10$ as the number of retrieved entities passed to the cross-encoder, following the recommended setting in Wu et al. (2020). BLINK uses Flair (Akbik et al., 2019) for mention detection when no mention boundaries are available. + +For ELQ, we use the code provided in the ELQ repository.18 We use the Wikipedia-trained ELQ model and the recommended settings for the Wikipedia model provided in the repository (threshold $= -2.9$ ). We find this outperforms the WebQSP-finetuned ELQ model on average on AmbER and KILT. + +For Bootleg, we use the code provided in the + +Bootleg repository. $^{19}$ We use the model version from July 2021. Bootleg uses a heuristic n-gram method for mention detection when no mention boundaries are available. + +For GENRE, we use the code provided in the GENRE repository.20 We use the BLINK-trained model for experiments on AmbER (GOLD) and the KILT-trained model for experiments on AmbER and KILT. We use the default settings (beam size=10, context length=384 tokens). + +For GENRE-type, we modify GENRE so that instead of just generating the entity name, the model must generate the entity name and type to predict an entity (e.g. "United States country"). First, we use the FIGER types from KILT-E to generate a new set of type-enhanced titles. We then train models for both the AmbER and AmbER (GOLD) settings. For AmbER experiments, we fine-tune from the GENRE KILT-pretrained model for 4 epochs on the KILT dataset. We set max tokens to 8,192 and train on 16 A100s. We sweep the learning rate in {1e-4, 3e-5, 1e-5, 1e-6} and select the best value on the KILT dev set using the macro-average R-precision across the eight open-domain tasks (best learning rate: 1e-6). For AmbER (GOLD) experiments, we fine-tune from the GENRE BLINK-pretrained model for 4 epochs on the BLINK dataset using the same learning rate (1e-6). For both models, we run inference using a trie created over the type-enhanced titles and a maximum output length of 20 tokens. + +For TABi-type-text, we use the type as textual input to the entity encoder and no types are used in the loss function. Specifically, we insert the types after the entity title and before the description, separated by a special separator token. We use $L_{ent}$ for training TABi-type-text and use the same training procedure as we use for TABi described in Appendix A.4. We fix the temperature to 0.05 and batch size to 4,096. We sweep the learning rate in {1e-4, 2e-4, 3e-4} for two epochs on the KILT training data and select the best value on the KILT dev set using the macro-average R-precision across the eight open-domain tasks (best learning rate: 2e-4). We use the same learning rate to train a model on the BLINK training data. + +For all models, we report a single run. + +# A.2 Evaluation datasets + +We include statistics on the evaluation datasets described in Section 4.1 in Table 8. We report the head/tail subsets for AmbER as defined in Chen et al. (2021). Note we split AmbER randomly into dev $(5\%)$ and test $(95\%)$ splits and report results on test. We consider the open-domain tasks in KILT (fact checking, question answering, slot filling, and dialogue) and define the "head" as having a gold entity that is in the top $1\%$ most popular entities by Wikipedia page views and the "tail" as being in the bottom $90\%$ of entities by Wikipedia page views. We evaluate retrieval on eight datasets: FEVER (Thorne et al., 2018), T-REx (Elsahar et al., 2018), Zero Shot RE (Levy et al., 2017), Natural Questions (Kwiatkowski et al., 2019), HotPotQA (Yang et al., 2018), TriviaQA (Joshi et al., 2017), ELI5 (Fan et al., 2019), and Wizard of Wikipedia (Dinan et al., 2019). + +# A.3 Training data + +We include additional details about the training data described in Section 4.1. + +Unstructured text In the BLINK training data, each sentence has a single mention labeled with mention boundaries and a gold entity from a Wikipedia anchor link. The KILT training data is a superset of the BLINK training data, that additionally contains sentences from standard fact checking, slot filling, open domain QA, dialogue, and entity disambiguation datasets. With the exception of the entity disambiguation examples, the additional examples have a gold entity label, but no gold mention boundaries. + +Knowledge graph types We describe (1) how we assign types to entities, and (2) how we assign types to queries. For both entities and queries, we use the FIGER type set Ling and Weld (2012) for types (i.e., each type label must be one of 113 types in the type set); however, our method is not specific to the FIGER type set and any type set with coarse types may lead to improvements. + +Entity type assignments We assign types to entities via a direct mapping of entities to knowledge graph types. First, the majority of the entities in KILT-E have a unique QID in Wikidata. For these entities, we use a mapping from Wikidata to Freebase using the "P646" property in Wikidata. After finding the corresponding Freebase entity, we derive the FIGER types from its Freebase types, using the map from Ling and Weld (2012). + +Query type assignments We follow Ling and Weld (2012) to assign types to queries through distant supervision. Specifically, we assign the types of the gold entity for the query as the types of the query. Thus we use a direct mapping of entity types from a knowledge graph, rather than use a probabilistic type classifier. Note that assigning query types through distant supervision (with the gold entity types) can be a noisy assumption. For instance, consider the query "What was the outcome of the election for Arnold Schwarzenegger?" with the gold entity Arnold Schwarzenegger. The query only implies that Schwarzenegger is a politician with the keyword "election". However, all types of the gold entity Arnold Schwarzenegger would be assigned to the query (e.g. "actor", "body builder", assuming the types were in the type set). As not all types associated with the gold entity may be implied by the query, this method can add noise to the query type labels. + +Type statistics We are able to assign types to $73\%$ of examples in the BLINK training data and $76\%$ of examples in the KILT training data. In the BLINK training data, the average example with types has 2.1 types with a max of 9 types. In KILT training data, the average example with types has 2.0 types with a max of 9 types. + +# A.4 Training procedure + +We describe the training procedure for TABi. We tie the query and entity encoders (i.e. use a single encoder) and initialize from a BERT-base pretrained model (Devlin et al., 2019). Following BLINK's protocol (Wu et al., 2020), we set the maximum context length to 32 tokens and the maximum entity description length to 128 tokens. We set the batch size to 4,096 and use the AdamW optimizer (Loshchilov and Hutter, 2019) and decay the learning rate by $50\%$ every epoch. + +We use balanced hard negative sampling, following Botha et al. (2020). Specifically, we only allow ten negative examples of an entity for each positive example in the training dataset. For all models of TABi, we train the first epoch using local in-batch negatives, and we mine for hard negatives at the end of every epoch. Starting at the second epoch, we train with both in-batch and hard negatives. + +From results on preliminary experiments, we fix the temperature $= 0.05$ and the type weight $\alpha = 0.1$ . We then conduct a grid search for the initial learning rate by training for two epochs on the KILT training + +
BenchmarkDatasetDevTestType of Queries
Total# Head# TailTotal# Head# Tail
AmbERHuman FC59428431011,2905,0546,236Templated claims
Non-human FC1,36972864126,01713,50012,517Templated claims
Human SF2971381595,6452,5313,114Subject-relation facts
Non-human SF68435532913,0096,7596,250Subject-relation facts
Human QA2971231745,6452,5463,099Templated questions
Non-human QA68434334113,0096,7716,238Templated questions
KILTFEVER10,4446,40661410,100--Mutated Wikipedia claims
T-REx5,000354,5535,000--Subject-relation facts
Zero Shot RE3,7241112,9744,966--Subject-relation facts
Natural Questions2,8371,4442041,444--Search engine questions
HotpotQA5,6002,1157975,569--Crowd-sourced questions
TriviaQA5,3593,7472236,586--Trivia questions from trivia sites
ELI51,507644168600--Reddit questions
Wizard of Wikipedia3,0541,9631422,944--Crowd-sourced dialogue
+ +Table 8: Evaluation dataset statistics. + +data and selecting the best value on the KILT dev set using the macro-average R-precision across the eight open-domain tasks. We sweep the initial learning rate in $\{1\mathrm{e} - 4,2\mathrm{e} - 4,3\mathrm{e} - 4\}$ (best learning rate $= 3\mathrm{e} - 4$ + +We use the same hyperparameter configuration for training on both the BLINK training data and the KILT training data. For models trained on BLINK data and KILT data, we train for 4 epochs using 16 A100 GPUs (approximately 2.2 hours/epoch for BLINK training data, 2.6 hours/epoch for KILT training data, including sampling for hard negatives). + +# A.5 Re-ranking details + +While our standard configuration of TABi does not use a re-ranker, we explore using an inexpensive re-ranker on top of TABi. The re-ranker consists of two steps: first, it linearly combines the top- $K$ entity scores from the bi-encoder with the top- $K$ entity scores of a sparse retriever using a tunable weight $\lambda$ . Second, it linearly combines these scores with their corresponding global entity popularity (e.g. Wikipedia page views) using a tunable weight $\kappa$ . We normalize scores before linearly combining at each step. + +More formally, let $E$ be a union of the set of retrieved entities from the bi-encoder and the sparse retriever. Then for an entity $e \in E$ , where $s_e$ indicates the score from the sparse retriever, $d_e$ indicates the score from the dense retriever, and $p_e$ indicates the popularity score, we compute the + +re-ranked score $f_{e}$ as follows: + +$$ +h _ {e} = \lambda s _ {e} + d _ {e} +$$ + +$$ +f _ {e} = \kappa p _ {e} + h _ {e} +$$ + +We use the baseline TF-IDF retriever for the sparse retriever (see Appendix A.1 for details). Like Chen et al. (2021), we use the monthly Wikipedia page views (from October 2019) as the measure of global entity popularity. Note that tuning these weights does not require re-training or re-running the bi-encoder evaluation. + +For the experiments with the re-ranker, we tune $\lambda$ and $\kappa$ on each of the 6 dev sets for AmbER by first selecting $\lambda$ that performs best on the linear combination of the bi-encoder and sparse retriever scores, and then fixing $\lambda$ and tuning $\kappa$ . For both $\lambda$ and $\kappa$ , we sweep in $\{0.0,0.25,0.5,0.75,1.0,1.25,1.5,1.75,2.0\}$ . + +# B Extended Retrieval Results + +# B.1 AmbER results + +We extend the results on AmbER included in Section 4. First, we perform experiments to better understand the strong performance of the baseline TABi $(\alpha = 0)$ , which removes the type-based loss term. We primarily attribute the strong performance of TABi $(\alpha = 0)$ relative to the BLINK (Bi-encoder) to the training data and perform baseline ablations in Table 9. We see that BLINK (Bi-encoder) and TABi $(\alpha = 0)$ perform similarly when both are trained on BLINK data, which consists of Wikipedia entity disambiguation data. Training on the KILT data, which additionally includes multiple open-domain tasks, leads to significant + +
ModelFact CheckingSlot FillingQuestion AnsweringAverage
HNHNHN
HeadTailHeadTailHeadTailHeadTailHeadTailHeadTailHeadTail
BLINK (Bi-encoder) + Flair56.452.024.810.576.855.730.713.578.355.767.333.855.736.9
TABi (α=0, BLINK data) + Flair45.649.74.62.977.458.148.430.478.058.063.439.952.939.8
TABi (α=0, KILT data) + Flair44.744.97.57.480.084.074.573.683.470.277.656.561.356.1
TABi (α=0, KILT data)77.661.941.439.170.987.183.285.972.566.382.257.771.366.3
+ +Table 9: Retrieval accuracy@1 on AmbER (H for human, N for non-human subsets). Impact of the training data on bi-encoder performance. + +
ModelFact CheckingSlot FillingQuestion AnsweringAverage
HNHNHN
HeadTailHeadTailHeadTailHeadTailHeadTailHeadTailHeadTail
TF-IDF76.476.160.960.680.482.952.650.078.182.358.954.267.967.7
DPR47.927.972.643.234.014.074.343.646.022.277.545.458.732.7
BLINK (Bi-encoder)89.590.181.571.694.595.948.941.294.995.890.986.383.480.1
BLINK91.185.883.976.394.195.249.341.594.995.891.286.684.180.2
ELQ78.461.166.837.274.544.159.727.177.547.262.130.769.841.2
GENRE78.067.982.877.486.992.590.790.883.783.787.482.784.982.5
Bootleg†98.397.669.965.796.593.666.856.297.196.774.876.383.981.0
GENRE-type71.280.076.477.773.692.791.092.283.090.591.391.481.187.4
TABi-type-text90.983.784.577.989.295.996.298.286.088.295.192.990.389.5
TABi95.093.879.980.391.396.896.498.391.693.895.895.791.793.1
+ +Table 10: Retrieval accuracy@10 on AmbER (H for human, N for non-human subsets). †Models with an alias table. + +
ModelFCSFQAAvg.
HNHNHN
TF-IDF1.00.62.52.52.52.51.9
DPR0.23.81.210.72.312.25.1
BLINK (Bi-enc)9.40.736.16.435.920.518.2
BLINK5.40.017.68.627.729.714.8
ELQ3.90.024.712.429.616.214.5
GENRE4.31.028.339.210.913.916.3
Bootleg3.00.026.715.531.627.817.4
GENRE-type3.37.417.250.915.828.620.5
TABi-type-text17.32.160.069.140.944.839.0
TABi40.04.265.674.353.652.648.4
+ +Table 11: Consistency results on AmbER for top-1. The consistency is the fraction of mentions where all queries for a mention are correct. + +lift. Removing the mention detector, Flair, leads to additional lift. Note that $\mathrm{TABi}(\alpha = 0)$ can retrieve entities without mention detection since the KILT training data includes open-domain tasks which do not have mention boundaries. + +Second, we include results for top-10 retrieval accuracy (accuracy@10) on AmbER to understand the retrieval performance at larger $K$ (Table 10). We find that TABi continues to outperform baselines on average. + +Finally, we report results for the consistency + +metric introduced in Chen et al. (2021) for top-1 retrieval in Table 11. This metric measures the proportion of mentions where all queries for the mention are correct. In particular, Chen et al. (2021) found that retrievers have a tendency to "collapse" all predictions for a mention to the most popular entity for the mention, which would result in a low consistency value. We find that TABi outperforms all models on this metric. + +# B.2 KILT results + +We include R-precision results on the KILT dev sets for the tasks and baselines in the main paper in Table 12. As with the AmbER experiments, we use the KILT-E knowledge base for inference for all models. We see that GENRE, TABi-type-text, and TABi outperform the other baselines across the tasks, and perform comparably overall to each other. Recall that GENRE, GENRE-type, TABi-type-text, and TABi were trained on KILT training data. BLINK, ELQ, and Bootleg were trained on Wikipedia training data and DPR was trained on question answering data. GENRE-type performs substantially worse than GENRE overall, suggesting that incorporating types in the entity name degrades overall retrieval performance. + +We also report results on the KILT test and + +
Fact Check.Slot FillingQuestion AnsweringDial.
FEVT-RExzsRENQHoPoTQAELI5WoWAvg
TF-IDF48.457.472.820.143.427.84.638.839.2
DPR57.014.944.354.525.546.216.126.935.7
BLINK (Bi-encoder)64.459.484.335.143.161.611.326.048.2
BLINK67.661.087.433.547.965.99.726.549.9
ELQ65.171.295.042.445.967.79.226.852.9
GENRE85.080.595.161.451.971.413.656.564.4
Bootleg†62.369.481.834.543.653.19.728.247.8
GENRE-type55.371.980.654.537.253.611.544.551.1
TABi-type-text87.382.295.162.551.270.816.951.064.6
TABi85.882.095.262.452.771.516.751.864.8
+ +Table 12: R-precision on KILT open-domain tasks (dev data). (Top) text-only methods and (bottom) type-aware methods. †Models with an alias table. + +
Fact Check.Slot FillingQuestion AnsweringDial.
FEVT-RExzsRENQHoPoTQAELI5WoWAvg.
TF-IDF---------
DPR74.317.039.265.510.457.026.951.242.7
Multi-task DPR87.583.993.168.228.468.327.567.165.5
BLINK---------
GENRE88.285.397.861.434.075.125.577.768.1
KGI85.083.199.270.2-63.5-78.5-
Re2G92.589.0-76.6-74.2-80.0-
TABi88.689.498.764.935.569.228.269.167.9
+ +Table 13: Recall@5 on KILT open-domain tasks (test data). We report numbers from Petroni et al. (2021) and the KILT leaderboard where available. + +
Fact Check.Slot FillingQuestion AnsweringDial.
FEVT-RExzsRENQHoPoTQAELI5WoWAvg.
TF-IDF71.873.088.632.629.241.09.756.550.3
DPR76.022.359.263.911.157.431.052.746.7
BLINK (Bi-encoder)80.068.188.440.824.363.519.440.953.2
BLINK82.969.689.643.727.466.922.344.655.9
ELQ79.569.995.236.123.762.49.547.753.0
GENRE89.085.397.358.534.775.720.575.067.0
Bootleg†81.074.385.637.226.369.414.049.354.6
GENRE-type66.980.189.754.423.458.418.562.456.7
TABi-type-text90.689.198.063.434.171.325.964.667.1
TABi89.388.898.363.134.270.025.664.866.8
+ +Table 14: Recall@5 on KILT open-domain tasks (dev data). (Top) text-only methods and (bottom) type-aware methods. †Models with an alias table. + +dev sets for recall@5. In addition to R-precision, recall@5 is reported on the KILT leaderboard and measures the proportion of gold entities for a query $^{21}$ that occur in the top-5 ranked entities. If there is a single gold entity, this is equivalent to accuracy@5. We find similar trends as seen with R-precision: TABi, TABi-type-text, and GENRE continue to have strong performance and outperform + +other baselines (Table 13 (test) and Table 14 (dev)). + +# B.3 Impact of batch size + +We study the impact of the batch size on TABi by training on a 1M random sample of KILT training data for two epochs for batch sizes in $\{256, 512, 1024, 2048, 4096\}$ . We hold all other hyperparameters constant. As we add $n$ hard negative samples to the batch in the second epoch, the batch size in terms of the number of queries is reduced by a factor of $n + 1$ . Concretely, if the base batch size is 4,096 exam + +![](images/538510c927d925693e1046a5d3bf16ef127bb5cb4a647ea7fc1a826ff735f0a9.jpg) +Figure 4: Accuracy@1 on AmbER for varying batch sizes. + +plies and we use three hard negatives per query, each batch in the first epoch has 4,096 queries, while each batch in the second epoch has 1,024 queries. We define the batch size in terms of the number of queries in the first epoch. In Figure 4, we see that generally increasing the batch size improves the average accuracy@1 on AmbER (averaged over head and tail examples). However, we caution that this study is performed with all other hyperparameters held constant and a more optimal hyperparameter configuration may exist at different batch sizes. We use a batch size of 4,096 for all experiments in the main paper. + +# B.4 Type equivalence + +We experiment with three type equivalence measures: (1) Any-types: two entities have equivalent types if any types overlap, (2) All-types: two entities have equivalent types if all types overlap, and (3) gt50-types: two entities have equivalent types if at least $50\%$ of the types overlap. If the entities have an unequal number of types, then we take $50\%$ of the greater number of types. An example of (3) is a query A with the types ["musician", "person"] would be considered as having equal types to query B with the types ["musician", "person", "author"], since more than $50\%$ of types of query B overlap with query A. + +Our main experiments currently use approach (3), which is intuitively a softer equivalence than (2). However, interestingly we find (2) and (3) can have very similar performance, and both greatly outperform (1). We report the average top-1 accuracy results of training the three methods for 2 epochs on a 1M random sample of KILT in Table 15. + +# C Extended Embedding Quality Analysis + +# C.1 Nearest neighbor mention type classification + +We include additional details on the datasets used for mention type classification (experiments in Sec- + +
Avg. HeadAvg. Tail
Any-types67.963.0
All-types71.069.8
gt50-types71.069.0
+ +Table 15: Top-1 accuracy on AmbER for different type equivalence measures. + +tion 5). The FIGER test set has 563 examples and uses the 113 FIGER type taxonomy (Ling and Weld, 2012). We use the subset of the OntoNotes test set from Shimaoka et al. (2017) that removes pronominal mentions. We further remove examples that map to the "other" type, resulting in a final OntoNotes test set with 3,066 examples. The classifier uses 50 types from the OntoNotes type taxonomy (Gillick et al., 2014) across the sampled training set and the final test set. While the training sets use distant supervision to label mentions with types over Wikipedia and news reports, respectively, both test sets consist of manually annotated mentions in news reports. + +# C.2 Nearest neighbor entity type classification + +We include the setup and results for the entity type classification task from Section 5. We create two datasets for entity type classification using the KILT-E knowledge base: Coarse-types and Fine-types. We use the seven coarse types in the FIGER type system as the coarse types and take the other types as fine types. We create the Coarse-types dataset by sampling without replacement 3,000 entities that correspond to the seven coarse FIGER types: "location", "person", "organization", "product", "art", "event", and "building". We divide the sampled entities into training and test sets for a total of 16,781 training examples and 4,195 test examples. Similarly, we create the Fine-types dataset by sampling without replacement 300 entities that correspond to the FIGER fine types. We discard fine types that do not have at least 300 entities, leaving 100 fine types. We then divide the sampled entities into training and test sets for a total of 23,884 training examples and 5,968 test examples. + +Table 16 reports the results for entity type classification. We find that TABi outperforms BLINK, suggesting that our loss helps cluster entities by type in the embedding space. + +# C.3 Entity similarity task + +We describe how we construct the dataset for the entity similarity task. We first find the closure of all Wikidata types assigned to each entity in the + +
DatasetModelAcc.Micro F1Macro F1
Coarse-typesBLINK81.189.084.1
TABi92.795.995.9
Fine-typesBLINK71.682.077.5
TABi76.686.884.0
+ +Table 16: Entity type classification using a nearest neighbor classifier over entity embeddings. + +KILT-E knowledge base. We then bucket Wikidata types by the frequency with which they occur in the KILT-E knowledge base (using five buckets). To include types of varying frequencies, we randomly sample 10 Wikidata types from each bucket (50 types total). Finally, we sample 10 pairs of entities for each type for a total of 500 entity pairs. + +To assign "ground-truth" similarity values to each entity pair, we submit the entity pairs to the KGTK Semantic Similarity toolkit web API.[22] We use the Jaccard similarity metric returned by the toolkit as the ground-truth similarity. This metric assigns larger values if the types shared by two entities are more specific (i.e. fine-grained). As ground truth values are assigned automatically, there is some noise in the dataset. However, we observe that the trends on the entity similarity task generally follow the trends on the other embedding quality analysis tasks. \ No newline at end of file diff --git a/tabitypeawarebiencodersforopendomainentityretrieval/images.zip b/tabitypeawarebiencodersforopendomainentityretrieval/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..bdb5b344ea2ce40a1330802a00dc616545ef1c2f --- /dev/null +++ b/tabitypeawarebiencodersforopendomainentityretrieval/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eb8abc841e6dafa5bffe8023418be0a21b2251ebad935b08c5616b26c02f7923 +size 982152 diff --git a/tabitypeawarebiencodersforopendomainentityretrieval/layout.json b/tabitypeawarebiencodersforopendomainentityretrieval/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..3d60f2b0192b7f74446fbe4299fddb1f5f4fcd06 --- /dev/null +++ b/tabitypeawarebiencodersforopendomainentityretrieval/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca968cb2d8f6b24cecc389031538e84b0ca03e5c13c2b7bb61161d772d331989 +size 603066 diff --git a/tablebasedfactverificationwithselfadaptivemixtureofexperts/51e54021-ea12-412c-a169-005be8cdefd9_content_list.json b/tablebasedfactverificationwithselfadaptivemixtureofexperts/51e54021-ea12-412c-a169-005be8cdefd9_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..2971070979752cfcfc0ea206b16819a4fe95f289 --- /dev/null +++ b/tablebasedfactverificationwithselfadaptivemixtureofexperts/51e54021-ea12-412c-a169-005be8cdefd9_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bf8c2fcc2169fcf30bef1742e3b410d924a435714549bbc171a4dc3943a5d791 +size 79963 diff --git a/tablebasedfactverificationwithselfadaptivemixtureofexperts/51e54021-ea12-412c-a169-005be8cdefd9_model.json b/tablebasedfactverificationwithselfadaptivemixtureofexperts/51e54021-ea12-412c-a169-005be8cdefd9_model.json new file mode 100644 index 0000000000000000000000000000000000000000..463bcf0ca7ce2e8674ead9597e926e2fdadee537 --- /dev/null +++ b/tablebasedfactverificationwithselfadaptivemixtureofexperts/51e54021-ea12-412c-a169-005be8cdefd9_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0329426b599ae17029985e404d92f5ddd92b3ca07a04bceed3cf3865b5653dc9 +size 95455 diff --git a/tablebasedfactverificationwithselfadaptivemixtureofexperts/51e54021-ea12-412c-a169-005be8cdefd9_origin.pdf b/tablebasedfactverificationwithselfadaptivemixtureofexperts/51e54021-ea12-412c-a169-005be8cdefd9_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..0c801d77707a8a0755daf91cb37f3f7effea0ee1 --- /dev/null +++ b/tablebasedfactverificationwithselfadaptivemixtureofexperts/51e54021-ea12-412c-a169-005be8cdefd9_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9cee796ad1f733384e93e35b4dd9b5a18f825d909ad63dc31045c28f33dea778 +size 569325 diff --git a/tablebasedfactverificationwithselfadaptivemixtureofexperts/full.md b/tablebasedfactverificationwithselfadaptivemixtureofexperts/full.md new file mode 100644 index 0000000000000000000000000000000000000000..b45c3d5f96b67f33cbfcb872d3da8b148dc6cab6 --- /dev/null +++ b/tablebasedfactverificationwithselfadaptivemixtureofexperts/full.md @@ -0,0 +1,349 @@ +# Table-based Fact Verification with Self-adaptive Mixture of Experts + +Yuxuan Zhou $^{1}$ , Xien Liu $^{1}$ , Kaiyin Zhou $^{2,3}$ , Ji Wu $^{1}$ + +$^{1}$ Department of Electronic Engineering, Tsinghua University, Beijing 100084, China + +$^{2}$ THiFLY Research, Tsinghua University, Beijing 100084, China + +$^{3}$ State Key Laboratory of Cognitive Intelligence, Hefei, Anhui 230088, China + +# Abstract + +The table-based fact verification task has recently gained widespread attention and yet remains to be a very challenging problem. It inherently requires informative reasoning over natural language together with different numerical and logical reasoning on tables (e.g., count, superlative, comparative). Considering that, we exploit mixture-of-experts and present in this paper a new method: Self-adaptive Mixture-of-Experts Network (SaMoE). Specifically, we have developed a mixture-of-experts neural network to recognize and execute different types of reasoning—the network is composed of multiple experts, each handling a specific part of the semantics for reasoning, whereas a management module is applied to decide the contribution of each expert network to the verification result. A self-adaptive method is developed to teach the management module combining results of different experts more efficiently without external knowledge. The experimental results illustrate that our framework achieves $85.1\%$ accuracy on the benchmark dataset TAB-FACT, comparable with the previous state-of-the-art models. We hope our framework can serve as a new baseline for table-based verification. Our code is available at https://github.com/THUMLP/SaMoE. + +# 1 Introduction + +Fact Verification, aiming to determine the consistency between a statement and given evidence, has become a crucial part of various applications such as fake news detection, rumor detection (Rashkin et al., 2017; Thorne et al., 2018; Goodrich et al., 2019; Vaibhav et al., 2019; Kryscinski et al., 2020). While most existing research focuses on verification based on unstructured text, a new trend is extending the scope to structured evidence (e.g., tables), which is informative and ubiquitous in our daily lives. Table-based verification faces different challenges than unstructured-text-based due to the + +complexity of the requirements, including sophisticated textual, numerical, and logical reasoning across evidence tables; even for some statements, multiple types of reasoning are indispensable to complete the verification. An example is presented in Figure 1. + +
rankplayercountryearningswins
1don januaryunited states133879121
2miller barberunited states116697018
3peter thomsonaustralia83853511
4gene littlerunited states7492165
5lee elderunited states7201647
+ +Statement The player with rank 5 have least earnings. + +Label ENTAILED + +Figure 1: An Example of table-based fact verification. + +To tackle the challenges above, previous work established two kinds of methods: (1) program-enhanced methods (Chen et al., 2020; Zhong et al., 2020; Shi et al., 2020; Yang et al., 2020) and (2) table-based pre-trained models (Eisenschlos et al., 2020; Liu et al., 2021). The program-enhanced methods mainly leverage programs generated by the semantic parser. Specifically, statements are parsed into executable programs to extract the logical/numerical semantics, which is further be leveraged together with contextual semantics learned by a language model (e.g., BERT) in inference. However, the semantic parsers that generate semantic-consistent programs must be trained in a weak supervision setting, which brings difficulties in training. Furthermore, generalizing this method to other datasets is almost impossible without the API set modification according to the reasoning requirements on the new datasets. + +The table-based pre-trained models leverage elaborate model structure (Herzig et al., 2020) and pre-training tasks (Eisenschlos et al., 2020; Liu et al., 2021) to enhance the reasoning skills on structured data. Nevertheless, two significant shortcomings remain. Firstly, the process is demanding due + +![](images/32e702ca154550bba4392363ffe7b72d193ab40f49ecd57a0dfc5c316e808bda.jpg) +Figure 2: An overview of Self-adaptive Mixture-of-Experts Network (SaMoE) for table-based fact verification. + +to the tremendous computing resources required by pre-training. Moreover, the effectiveness of pretraining to its downstream tasks mainly depends on the adaptability between these two tasks. Therefore, implementing pre-training tasks may fail to meet the requirements when facing the unseen reasoning types demanded by new datasets. + +In this paper, we introduce an innovative framework, Self-adaptive Mixture of Experts (SaMoE), to address the previously mentioned problems. The entire framework is illustrated in Figure 2. SaMoE consists of 3 components: feature extractor, experts, and management module, which is the combination of manager and supervisor networks. Each expert initially takes the same feature as input and then learns to deal with different parts of the reasoning types (e.g., contextual/logical/numerical) required by table-based verification. A management module is designed to guide the training of experts and combine experts' verification results effectively. The manager network in this module assigns each expert a unique attention score, allowing each individual to focus on different kinds of reasoning types and summarizes experts' entire outputs as the final verification result. However, managers failed to allocate the highest attention score to the expert who performs best on the current reasoning type in most circumstances. To alleviate this problem, we introduce a supervisor network to adjust the attention score given by the manager. The supervisor network is trained self-adaptively (i.e., it learns directly from experts' performance on the train set) without prior knowledge of the task or dataset. Extensive experiments are + +conducted to show that our proposed framework, implemented with a general pre-trained language model RoBERTa (Liu et al., 2019), outperforms previous state-of-the-art methods, including table-based pre-trained models. The main contributions of this work are as follows: + +- We innovatively implement mixture-of-experts for table-based verification, aiming to arrange each expert to different types of reasoning. This method can also be easily generalized to other datasets. +- We investigate a self-adaptive method to adjust suitable attention score to each expert according to its performance on different reasoning types, achieving more efficient cooperation across experts. +- Our framework achieves better performance on the TABFACT dataset without the assistance of table-based pre-trained models. + +# 2 Research Question + +The table-based verification task expects one to determine whether a statement $S$ is entailed or refuted by an evidence table $T$ . The process above can be regarded as a binary classification task and thus denoted as $f(S, T) = \hat{y}$ , where $f$ is the verification model and $\hat{y} \in \{0, 1\}$ its prediction. + +# 3 Methods + +We present the proposed framework (SaMoE), which leverages a set of experts to deal with differ + +ent parts of the reasoning types involved in table-based verification. This section is organized as follows. Sec.3.1 introduces the feature extractor that extracts the joint semantics of the table-statement pair. Sec.3.2 describes experts that verify the statements separately based on the same extracted semantics. Sec.3.3 describes the management module that guides the experts' training and combines their verification results effectively; two components of this module, the manager and the supervisor, are introduced in this section individually. + +# 3.1 Feature Extractor + +Feature extractor parses the statement-table pair and learns the joint table-statement semantics. Tables are initially pruned and serialized into a sequence. Subsequently, the serialized tables are transmitted into the language model together with the statements for joint representation learning. These two processes will be further interpreted in the following subsections. + +# 3.1.1 Table Pre-processing + +As for Tables, the pre-processing (pruning and serializing) before the joint representation learning provides convenience for subsequent processing of the existing language model. + +Table Pruning Table pruning discards some parts of the table that do not participate in the verification, according to the input size limit of the language model. We take advantage of the tablepruning algorithm proposed in Chen et al. (2020) and further enhance its performance. The original algorithm matches the entities in statements with cells in tables by a heuristic method and selects the columns that include matched cells to form the pruned table. Noticed that the algorithm always fails to select the critical columns of verification while there is still room left for the input sequence of the language model, we further add a greedy strategy on the algorithm that keeps adding columns that are not selected to the pruned table until reaching the maximum input size of the downstream model to make the best use of its capacity. + +Table Serializing Tables are further serialized to a 1-D sequence after pruning to be compatible with the input format of the language model. We follow the serializing method used in TABLE-BERT (Chen et al., 2020) that paraphrases tables with a natural language template. Specifically, a table with $m$ rows and $n$ columns is paraphrased as "row + +1 is: $h_1$ is $T_{11}$ ; ...; $h_n$ is $T_{1n}$ . row 2 is: ... row $m$ is: $h_1$ is $T_{m1}$ ; ...; $h_n$ is $T_{mn}$ .", where $h_i$ refers the $i^{th}$ header and $T_{ij}$ the value in the $(i,j) - th$ cell of table $T$ . We find that such template-serialized tables are more suitable for language models pre-trained on unstructured text to process. + +# 3.1.2 Joint Representation Learning + +After the table pre-processing, the serialized table and the statement are further passed to a language model to learn the joint contextual representation of each token. The learned representation vectors are then transmitted to the experts and the management module for inference and management. Specifically, the serialized table and the statement are initially tokenized into two token sequences $\tilde{\mathbf{T}}$ and $\mathbf{S}$ . Then the joint token sequence $\mathbf{X}$ is formed as $\mathbf{X} = [\langle s\rangle ,\mathbf{S},\langle /s\rangle ,\tilde{\mathbf{T}},\langle /s\rangle ]$ , where $\langle s\rangle$ and $\langle /s\rangle$ are the separators that identify the beginning and the end of each token sequence. The token sequence $\mathbf{X}$ will be padded or truncated to fit the maximum input length of the language model. Finally, a transformer model is applied to learn the contextual representation of $\mathbf{X}$ : + +$$ +\mathbf {H} = f _ {L M} (\mathbf {X}) \tag {1} +$$ + +where $\mathbf{H} \in \mathbb{R}^{n \times d}$ refers to the learned joint representation, $n$ is the maximum input length and $d$ the dimension of the representation vector. $f_{LM}$ denotes the contextual representation learning process of the language model. In this paper, we implement it with transformer (Vaswani et al., 2017), the most popular contextual representation model in recent years. + +# 3.2 Experts + +A group of experts is applied to verify the statements separately based on the same statement-table joint semantics extracted by the feature extractor module. Experts share the same model structure, while the parameter learning strategy of SaMoE gives expert differentiation. Specifically, each expert is implemented with a stack of transformer encoding layers. An MLP classifier that calculates the probability of the statement is entailed by the evidence table based on the encoded semantics. We implement experts with the same general structure rather than different structures specially designed for certain reasoning types since we anticipate that the proposed framework can be smoothly generalized to other datasets. The process above can be + +formulated as follows: + +$$ +\mathbf {h} _ {i} = f _ {E n c _ {i}} (\mathbf {H}) \tag {2} +$$ + +$$ +\mathbf {p} _ {i} = \operatorname {s o f t m a x} \left(\tanh \left(\mathbf {h} _ {i} \mathbf {W} _ {1} ^ {i}\right) \mathbf {W} _ {2} ^ {i}\right) \tag {3} +$$ + +where $\mathbf{h}_i\in \mathbb{R}^d$ is the token $\langle s\rangle$ 's final representation vector encoded by the $i^{th}$ expert's encoder Enci. It implies the $i^{th}$ expert's whole understanding to the statement-table pair. $\mathbf{W}_1^i\in \mathbb{R}^{d\times d}$ and $\mathbf{W}_2^i\in \mathbb{R}^{d\times 2}$ are the trainable parameters of $i^{th}$ expert's classifier, which projects $\mathbf{h}_i$ to the probabilities $\mathbf{p}_i\in \mathbb{R}^2$ that the statement is entailed/refuted by the table. tanh and softmax are activation functions. $n_e$ refers to the number of experts. + +# 3.3 Management Module + +Learning the joint semantics parsed in Sec.3.1, the management module intends to generate attention scores to bias experts' training and combine experts' results efficiently. The module consists of two components: manager and supervisor, both of them are implemented based on transformer model. The manager is mainly designed to guide experts' training, while the supervisor is applied to combine experts' results efficiently. + +Manager The manager guides the training of experts and forms a preliminary assumption to the expert combination. It encodes the joint representation matrix and generates attention scores $\mathbf{a}_M$ to guide the experts' training process: + +$$ +\mathbf {h} _ {M} = f _ {\text {E n c} _ {M}} (\mathbf {H}) \tag {4} +$$ + +$$ +\mathbf {e} _ {M} = \tanh \left(\mathbf {h} _ {M} \mathbf {W} _ {1} ^ {M}\right) \mathbf {W} _ {2} ^ {M} \tag {5} +$$ + +$$ +\mathbf {a} _ {M} = \operatorname {s o f t m a x} \left(\mathbf {e} _ {M}\right) \tag {6} +$$ + +where $Enc_{M}$ denotes the manager's encoder, $\mathbf{W}_1^M \in \mathbb{R}^{d \times d}$ and $\mathbf{W}_2^M \in \mathbb{R}^{d \times n_e}$ are trainable parameters. The network structures of the manager and experts are basically the same, only different in the layers of the encoder and the output dimension. + +After preceding calculation, the normalized attention scores $\mathbf{a}_M$ are used to guide the training of experts by a specially designed verification loss, which will be introduced in Sec.4.1.1. + +Supervisor The supervisor adjusts the attention scores submitted by the manager to improve the cooperative efficiency among experts (i.e. assigning higher weights to experts who perform better on the current input pair). The network predicts the deviation between the preliminary assumption (i.e., + +the attention) and the ideal combination weights based on the knowledge encoded in the joint representation matrix $\mathbf{H}$ : + +$$ +\mathbf {h} _ {S} = f _ {E n c _ {S}} (\mathbf {H}) \tag {7} +$$ + +$$ +\mathbf {e} _ {S} = \tanh \left(\mathbf {h} _ {S} \mathbf {W} _ {1} ^ {S}\right) \mathbf {W} _ {2} ^ {S} \tag {8} +$$ + +$$ +\mathbf {a} _ {S} = \operatorname {s o f t m a x} \left(\mathbf {e} _ {M} + \mathbf {e} _ {S}\right) \tag {9} +$$ + +where $\mathbf{W}_1^S\in \mathbb{R}^{d\times d}$ , $\mathbf{W}_2^S\in \mathbb{R}^{d\times n_e}$ are trainable parameters and $Enc_{S}$ refers to the encoder of the supervisor. Parameters of the supervisor are optimized self-adaptively based on experts' performance on the train set. More details of this learning strategy will be presented in Sec.4.2. + +# 4 Parameter Learning + +Parameters in SaMoE are learned in two consecutive stages: 1) Multi-expert training: parameters in the feature extractor, experts and the manager are end-to-end optimized under the supervision of labels; 2) Self-adaptive learning: parameters in the supervisor are self-optimized by observing experts' performance on the train set (other parameters are fixed simultaneously). A weighted sum of two losses is minimized in the first stage to achieve diverse and balanced training of experts. For the second stage, we minimize a self-adaptive loss calculated based on the experts' classification loss. Subsequent sections introduce these two learning stages in detail. + +# 4.1 Multi-expert Training + +Multi-expert training guides each expert on dealing with different reasoning types while maintaining balanced training across experts. To achieve the goals above, we develop two loss functions: 1) verification loss $\mathcal{L}_V$ that measures the weighted sum of each expert's classification loss, differentiating experts' learning with different attention scores assigned by the manager; 2) manager assumption loss $\mathcal{L}_M$ that is applied to prevent the occurrence of imbalanced training across experts. The overall loss of this state is calculated by a weighted sum of these two terms: $\mathcal{L}_1 = \mathcal{L}_V + \lambda \mathcal{L}_M$ , where $\lambda$ is a hyperparameter that controls the ratio of $\mathcal{L}_M$ . Subsequent sections provide detailed introduction to these two terms. + +# 4.1.1 Verification Loss + +The verification loss $\mathcal{L}_V$ is designed based on the loss function proposed in Jacobs et al. (1991). It + +is calculated by the weighted sum of each expert's cross-entropy: + +$$ +\mathcal {L} _ {V} = \sum_ {i = 1} ^ {n _ {e}} \left(\mathbf {a} _ {M}\right) _ {i} \cdot C E \left(\mathbf {p} _ {i}, l\right) \tag {10} +$$ + +where $(\mathbf{a}_M)_i$ is the $i^{th}$ element of the attention scores $\mathbf{a}_M, l \in \{0,1\}$ is the label of the statementtable pair and $CE(\cdot ,\cdot)$ the cross-entropy function. Note that it is necessary to calculate each expert's cross-entropy independently. We want each expert to behave like an independent expert (i.e., complete the verification without the help of other experts). The attention vector $\mathbf{a}_M$ acts as a "training scheduler" in this loss function: experts that are assigned with larger attention scores receive a larger gradient than other experts on the current input, resulting in diverse experts' performance. + +# 4.1.2 Manager Assumption Loss + +We have trained the MoE with only the verification loss $\mathcal{L}_V$ and observe a severe "imbalanced experts" phenomenon that only one expert is well-trained (i.e., the expert performance is improved by training) and the manager keeps assigning a close-to-1 attention score to this expert, which is also reported in previous research (Eigen et al., 2013; Shazeer et al., 2017). To avoid this problem, we develop another loss function that forces the manager to assign reasonable attention scores to experts: + +$$ +\mathcal {L} _ {M} = D \left(\mathbf {a} _ {P} \| \mathbf {a} _ {M}\right) \tag {11} +$$ + +where $D(\cdot ||\cdot)$ denotes the Kullback-Leibler divergence and $\mathbf{a}_P$ a prior assumption that is generated with a simple heuristic algorithm (to be introduced in the next paragraph) which requires limited prior knowledge of the reasoning types. By minimizing $\mathcal{L}_M$ , the manager learns to assign each expert with a reasonable attention score, resulting in a balanced training across experts. + +Prior Assumption Generation The prior assumption $\mathbf{a}_P$ is generated to represent the probabilities that the statement involves different reasoning types that we are interested in. Specifically, we develop a trigger-word-based heuristic algorithm to form the prior assumption for each statement automatically: + +1. Initialize the prior assumption with $\mathbf{e}_0\in \mathbb{R}^{n_e}$ which is empirically set as $(0.1,0.1,\dots,0.6)^T$ The $(\mathbf{e}_0)_{n_e}$ represents the probability that the + +statement does not involve any predefined reasoning types and thus is set higher than other values in advance. + +2. Traverse the trigger-word set $^1$ of each reasoning type ( $n_e - 1$ types in total). If a trigger word/pattern $w$ that belongs to $i^{th}$ reasoning type is detected in the statement, the trigger's weight $s_w$ (set empirically) is accumulated to the $i^{th}$ dimension of a zero-initialized bias vector $\delta \in \mathbb{R}^{n_e} \colon \delta_i \gets \delta_i + s_w$ . +3. Add the bias vector $\delta$ to the prior assumption $\mathbf{e}_0$ and normalize to get the prior assumption: $\mathbf{a}_P = \text{softmax}(\mathbf{e}_0 + \delta)$ . + +Figure 3 presents an example of this process. Learning to imitate the prior assumption, the manager guides each expert to focus on different reasoning types and thus achieves diverse experts. We implement a relatively small trigger-word pool in experiments and find the method works effectively, indicating that the method can be smoothly generalized to other datasets with little modification to the predefined reasoning types and trigger-word pool. + +![](images/6ddd04d44adb2cb89cbf12d365c2a9c17ef8d67a23c0393bb5808dbb32fda712.jpg) +Figure 3: An example of prior assumption generation with $n_e = 5$ and 4 predefined reasoning types. + +# 4.2 Self-adaptive Learning + +Self-adaptive learning aims to enhance further the expert combining efficiency with only the knowledge of the expert's performance on the train set. Specifically, an "expert ability" vector $\mathbf{a}_E \in \mathbb{R}^{n_e}$ is calculated based on the "expert loss" vector $\mathbf{m} \in \mathbb{R}^{n_e}$ , where $\mathbf{m}_i = CE(\mathbf{p}_i, l)$ is the cross-entropy loss of the $i^{th}$ expert. Note that the cross-entropy of the expert is negatively correlated with its performance. Then the expert ability vector $\mathbf{a}_E$ is calculated as follows: + +$$ +\mathbf {a} _ {E} = \operatorname {s o f t m a x} (- \alpha \cdot \mathbf {m}) \tag {12} +$$ + +where $\alpha = \sqrt{\beta / Var(\mathbf{m})}$ is a variance-normalizing coefficient and $\beta$ is a hyperparameter that decides the variance of the expert ability vector before the activation (i.e., $Var(-\alpha \cdot \mathbf{m}) = \beta$ ). Such normalization is designed based on the observation that $\mathbf{m}$ tends to have a extreme small variance and softmax $(- \mathbf{m})$ often generates a close-to-uniform distribution. Note that the generated $\mathbf{a}_E$ is positively correlated with the experts' performance (e.g., if the $i^{th}$ expert outperforms the $j^{th}$ expert on the input pair then we have $(\mathbf{a}_E)_i > (\mathbf{a}_E)_j$ . + +Based on $\mathbf{a}_E$ , we develop the loss function that has the same form with $\mathcal{L}_M$ in Sec 4.1.2: + +$$ +\mathcal {L} _ {S} = D \left(\mathbf {a} _ {E} \| \mathbf {a} _ {S}\right) \tag {13} +$$ + +By minimizing the loss above, the higher attention scores are assigned to the best-performed experts after the supervisor's adjustment, resulting in more efficient cooperation across experts. + +# 5 Experiment Setup + +# 5.1 Data and Metric + +We conduct the experiments on TABFACT, a large scale benchmark dataset of the table-based fact verification task $^2$ . TABFACT contains a total of 117k statements and 16k Wikipedia tables. The test set is further divided into a simple and complex subset based on verification difficulty, for verifying some statements on TABFACT requires more logical/numerical reasoning skills. We choose accuracy as the evaluation metric following the existing work to make our experiment results comparable. More details of TABFACT are presented in Appendix A. + +# 5.2 Implementation Details + +Training Details We set $n_e = 5$ expert networks in our implementation of SaMoE. The transformer layers are 12 for encoders in the feature extractor and experts and 2 for encoders in the manager and supervisor. The hidden states' dimension $d$ , the maximum input length $n$ , the $\lambda$ in Sec.4.1, and the $\beta$ in Sec.4.2 are set to 1024, 512, 0.1 and 0.1 respectively. We applied RoBERTa-Large (Liu et al., 2019) to initialize the feature extractor and experts in our framework. The details of parameter initialization can be found in Appendix B. + +We apply Adam optimizer (Kingma and Ba, 2015) in training with learning rate 2e-5, dropout rate 0.1, warmup step 17,304, and batch size 32. SaMoE is first trained in the Multi-expert training stage for 57,680 steps (20 epochs). Then the supervisor is trained in the self-adaptive learning stage for another 5,000 steps, while the best parameters of other parts in the framework are loaded and fixed. The model is evaluated every 1000 steps, and the model that achieves the highest performance on the development set is saved. All the codes are implemented with Pytorch (Paszke et al., 2019) and the transformers package (Wolf et al., 2020). We train all our models on a single GeForce RTX 3090. + +Settings of Prior Assumption We choose the top 4 types of reasoning types that appear most frequently in $\mathrm{TABFACT}^3$ (count, comparative, superlative, negation). We apply a small trigger-word pool containing only 26 trigger words, injecting limited prior knowledge of the dataset. More details of this part are presented in Appendix C. + +# 5.3 Baselines + +We compared our proposed framework with different kinds of baselines on TABFACT: (1) Program-enhanced methods: LPA (Chen et al., 2020), LogicalFactChecker (Zhong et al., 2020), HeterTFV (Shi et al., 2020), ProgVGAT (Yang et al., 2020) and Decomp (Yang and Zhu, 2021); (2) Table-based pre-trained models: TAPAS (Eisenschlos et al., 2020) and TAPEX (Liu et al., 2021); (3) Other methods: Table-BERT (Chen et al., 2020) and SAT (Zhang et al., 2020). + +# 6 Results + +# 6.1 Overall Performance + +We compare the proposed SaMoE with different kinds of baselines, and the results are listed in Table 1. Baselines are presented with the best performance reported in the corresponding papers. SaMoE obtains an accuracy of $85.1\%$ on the test set, achieving a new state-of-the-art on the dataset. Results show that our method consistently outperforms all the program-enhanced methods with a significant $2.4\%$ improvement compared with the Decomp method (the best performed program-enhanced method). Note that SaMoE performs similar with Decomp-LARGE on the simple subset + +
ModelValTestTestsimpleTestcomplexSmall Test
TABLE-BERT66.165.179.158.268.1
LPA65.165.378.758.568.9
LogicalFactChecker71.871.785.465.174.3
HeterTFV72.572.385.965.774.2
SAT73.373.285.567.2-
ProgVGAT74.974.488.367.676.2
Decomp-LARGE82.782.793.677.484.7
TAPAS-LARGE81.581.293.075.584.1
TAPEX84.684.293.979.685.9
SaMoE84.285.193.680.986.7
Human Performance----92.1
+ +of the test set (93.6% vs. 93.6%) while outperforms Decomp-LARGE with a remarkable $3.5\%$ on the complex subset (80.9% vs. 77.4%). Such analysis indicates that the performance improvement is mainly derived from successfully verifying complex statements, which required more sophisticated reasoning than statements in the simple set. SaMoE even shows comparable performance with the previous SOTA TAPEX that is pre-trained to execute SQL queries on tables. Our method outperforms TAPEX with a $0.9\%$ improvement on the test set and a further $1.3\%$ improvement on the complex subset, indicating that SaMoE, based on a text-based pre-trained model, performs even better than table-based pre-trained models on a variety of complex reasoning types demanded by the table-based verification. + +Table 1: Comparative performance (accuracy) on TABFACT. + +
ModelValTest
SaMoE84.285.1
SaMoE w/o Sa84.084.7
SaMoE w/o Sa (ne=1)83.684.0
+ +Table 2: Ablation results that shows the effectiveness of the proposed MoE and self-adaptive learning methods. SaMoE w/o Sa denotes that the framework without self-adaptive learning, and $n_e = 1$ denotes that the framework involves only one expert, where the management module does not work in this situation. + +# 6.2 Ablation Study + +We further investigate the effectiveness of the MoE structure and self-adaptive learning with an ablation study. We conduct two experiments: one reduces the number of experts to 1 to disable the contribution from the MoE structure (SaMoE w/o Sa $(n_e = 1)$ ); the other trains the proposed framework + +with only the Multi-expert training stage (SaMoE w/o Sa). Results are presented in Table 2. The MoE structure achieves a $0.7\%$ improvement on the test set $(84.7\%$ vs. $84.0\%)$ , and self-adaptive learning further improves the performance slightly $(85.1\%$ vs. $84.7\%)$ . Note that the slight improvement of self-adaptive learning is expected since the experts and the feature extractor are fixed in this stage. The results demonstrate the effectiveness of both the MoE structure and the self-adaptive learning. + +# 6.3 Effectiveness Analysis + +We show in this section that the effectiveness of the proposed framework is derived from two aspects: the differentiation of experts (each expert outperforms others on a specific part of reasoning types) and the effective attention assignment by the management module (the best-performed experts are assigned with higher attention scores). + +![](images/3dad45f916a873e733a4b0081d8d957fe9b3f16b54e4ddd8d2a2ba1ce0c15903.jpg) +(a) Trained with $\mathcal{L}_V$ + +![](images/151ee51b9352dd59a589d50f7df28b652fc747d321fcbf3ca5b4677be1cdfea9.jpg) +(b) Trained with $\mathcal{L}_V + \mathcal{L}_M$ +Figure 4: Comparison of models trained with/without the manager assumption loss $\mathcal{L}_M$ . + +# 6.3.1 Expert Differentiation + +We first investigate the proposed manager assumption loss $\mathcal{L}_M$ and find that it achieves balanced training across experts, which is the premise of expert differentiation. Figure 4 compares the two + +models trained with and without $\mathcal{L}_M$ , with the performance curves of different experts on the development set presented in each sub-figure. Once $\mathcal{L}_M$ is applied, four experts that fail to be trained (the performance stays around $50\%$ as training steps increase) achieve comparable performance with the rest expert (expert 5 in sub-figure (a)). The result indicates that the proposed $\mathcal{L}_M$ leads balanced training across experts. + +![](images/8b9e8bc37a45ef3d0301b7c26af5e9ba845156d75700ceb71647418f65dd6018.jpg) +Figure 5: The proportion of statements in the test set that at least $k$ experts verify them correctly ( $k \in [1, 5]$ ). + +We further show that the proposed framework achieves differentiation across experts. Figure 5 presents the proportion of statements in the test set that are verified correctly by at least $k$ experts ( $k$ varies from 1 to 5). Note that the proportion increases rapidly as $k$ decreases (76.2% to 90.7% for $k$ from 5 to 1), which illustrates that experts behave differently on a large proportion of statements. The results indicate that SaMoE successfully achieves expert differentiation, which expands the original performance upper bound considerably (90.7%). + +
ModelAccuracy
Top 1Top 2Top 3
SaMoE32.059.076.0
SaMoE w/o Sa25.444.867.6
+ +Table 3: The top-k accuracy of the management module that predicts the best-performed experts on the test set. + +# 6.3.2 Effective Attention Assignment + +We conduct a detailed analysis to investigate whether the management module assigns higher attention scores to experts with the best performance after self-adaptive learning. To achieve this goal, we regard the management module as a $n_e$ -class classifier and calculate the top-k accuracy of predicting the best-performed expert (the one with the + +smallest cross-entropy) on the test set where k is chosen in [1, 2, 3]. The results of the analysis are presented in Table 3. The top-k accuracy is improved significantly after self-adaptive learning $(+6.6\%, +14.2\%, +8.4\%$ respectively), indicating that the management module successfully assigns higher attention scores to the best-performed experts by self-adaptive learning. + +Based on the significant performance upper bound expanded by the expert differentiation, the effective attention assignment achieves more efficient cooperation across these diverse experts, thus improving the verification performance. + +# 7 Related Works + +Table-Based Fact Verification Most of the current models utilize programs to improve the model's ability to handle various types of numerical and logical reasoning (Chen et al., 2020; Zhong et al., 2020; Shi et al., 2020; Yang et al., 2020; Yang and Zhu, 2021), while Eisenschlos et al. (2020); Liu et al. (2021) leverage table-based pre-trained models to parse the structural and numerical semantics of tables better. Unlike previous works, we use a novel mixture-of-experts framework to handle different logical and numerical semantics without semantic parsing and table-based pre-training. + +Mixture of Experts Mixture of experts is a special model combining method. Jacobs et al. (1991) first introduces this method and proposes a loss that encourages competitive learning across expert models. Afterwards, it is applied in various fields, including dialog system (Le et al., 2016), content recommendation(Ma et al., 2018; Zhu et al., 2020), image classification(Wang et al., 2020; Riquelme et al., 2021), etc. In this paper, we develop a self-adapted mixture-of-experts framework that achieves a more effective combination of experts by learning from the experts' performance on the train set. + +# 8 Conclusion + +This paper proposes a new method that exploits the mixture of experts to recognize and execute different types of reasoning required for table-based fact verification. We propose an MoE model guided with limited prior knowledge to handle different parts of the reasoning types required by table-based verification with diverse experts. Moreover, we design a supervisor network to adjust the imprecise + +attention score and achieve a more efficient combination across experts. A self-adaptive learning strategy is further applied to train the proposed supervisor network without prior knowledge of the task or dataset. The experiments show that the proposed model achieves a new state-of-the-art performance of $85.1\%$ accuracy on the benchmark dataset TABFACT. The ablation studies and analysis further indicate the effectiveness of the proposed MoE structure and self-adaptive learning strategy. We hope our work is helpful for those who aim to further exploit the power of mixture-of-experts on table-based reasoning in the future. + +# Acknowledgments + +We thank the anonymous reviewers for their valuable comments. This work is supported by Scientific and Technological Innovation 2030-“New Generation Artificial Intelligence” Major Project (No.2021ZD0113400), National Key Research and Development Program of China (No.2021YFC250083), and the Beijing Municipal Natural Science Foundation (No.L192026). + +# References + +Wenhu Chen, Hongmin Wang, Jianshu Chen, Yunkai Zhang, Hong Wang, Shiyang Li, Xiyou Zhou, and William Yang Wang. 2020. Tabfact: A large-scale dataset for table-based fact verification. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net. +David Eigen, Marc'Aurelio Ranzato, and Ilya Sutskever. 2013. Learning factored representations in a deep mixture of experts. arXiv preprint arXiv:1312.4314. +Julian Eisenschlos, Syrine Krichene, and Thomas Müller. 2020. Understanding tables with intermediate pre-training. In *Findings of the Association for Computational Linguistics: EMNLP* 2020, pages 281-296, Online. Association for Computational Linguistics. +Ben Goodrich, Vinay Rao, Peter J Liu, and Mohammad Saleh. 2019. Assessing the factual accuracy of generated text. In Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 166-175. +Vivek Gupta, Maitrey Mehta, Pegah Nokhiz, and Vivek Srikumar. 2020. INFOTABS: Inference on tables as semi-structured data. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 2309–2324, Online. Association for Computational Linguistics. + +Jonathan Herzig, Pawel Krzysztof Nowak, Thomas Müller, Francesco Piccinno, and Julian Eisenschlos. 2020. TaPas: Weakly supervised table parsing via pre-training. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 4320-4333, Online. Association for Computational Linguistics. +Robert A Jacobs, Michael I Jordan, Steven J Nowlan, and Geoffrey E Hinton. 1991. Adaptive mixtures of local experts. Neural computation, 3(1):79-87. +Diederik P. Kingma and Jimmy Ba. 2015. Adam: A method for stochastic optimization. In 3rd International Conference on Learning Representations, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings. +Wojciech Kryscinski, Bryan McCann, Caiming Xiong, and Richard Socher. 2020. Evaluating the factual consistency of abstractive text summarization. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 9332-9346, Online. Association for Computational Linguistics. +Phong Le, Marc Dymetman, and Jean-Michel Rends. 2016. Lstm-based mixture-of-experts for knowledge-aware dialogues. In 1st Workshop on Representation Learning for NLP, pages 94-99. ACL Anthology. +Qian Liu, Bei Chen, Jiaqi Guo, Zeqi Lin, and Jianguang Lou. 2021. Tapex: Table pre-training via learning a neural sql executor. arXiv preprint arXiv:2107.07653. +Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692. +Jiaqi Ma, Zhe Zhao, Xinyang Yi, Jilin Chen, Lichan Hong, and Ed H Chi. 2018. Modeling task relationships in multi-task learning with multi-gate mixture-of-experts. In Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 1930-1939. +Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. 2019. Pytorch: An imperative style, high-performance deep learning library. In Advances in Neural Information Processing Systems 32: Annual Conference on Neural Information Processing Systems 2019, NeurIPS 2019, December 8-14, 2019, Vancouver, BC, Canada, pages 8024-8035. +Hannah Rashkin, Eunsol Choi, Jin Yea Jang, Svitlana Volkova, and Yejin Choi. 2017. Truth of varying + +shades: Analyzing language in fake news and political fact-checking. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 2931-2937, Copenhagen, Denmark. Association for Computational Linguistics. +Carlos Riquelme, Joan Puigcerver, Basil Mustafa, Maxim Neumann, Rodolphe Jenatton, André Susano Pinto, Daniel Keysers, and Neil Houlsby. 2021. Scaling vision with sparse mixture of experts. Advances in Neural Information Processing Systems, 34. +Noam Shazeer, Azalia Mirhoseini, Krzysztof Maziarz, Andy Davis, Quoc V. Le, Geoffrey E. Hinton, and Jeff Dean. 2017. Outrageously large neural networks: The sparsely-gated mixture-of-experts layer. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings. OpenReview.net. +Qi Shi, Yu Zhang, Qingyu Yin, and Ting Liu. 2020. Learn to combine linguistic and symbolic information for table-based fact verification. In Proceedings of the 28th International Conference on Computational Linguistics, pages 5335-5346, Barcelona, Spain (Online). International Committee on Computational Linguistics. +James Thorne, Andreas Vlachos, Christos Christodoulopoulos, and Arpit Mittal. 2018. FEVER: a large-scale dataset for fact extraction and VERIFICATION. In NAACL-HLT. +Vaibhav Vaibhav, Raghuram Mandyam, and Eduard Hovy. 2019. Do sentence interactions matter? leveraging sentence level representations for fake news classification. In Proceedings of the Thirteenth Workshop on Graph-Based Methods for Natural Language Processing (TextGraphs-13), pages 134–139, Hong Kong. Association for Computational Linguistics. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc. +Nancy X. R. Wang, Diwakar Mahajan, Marina Danilevsky, and Sara Rosenthal. 2021. SemEval-2021 task 9: Fact verification and evidence finding for tabular data in scientific documents (SEM-TABFACTS). In Proceedings of the 15th International Workshop on Semantic Evaluation (SemEval-2021), pages 317-326, Online. Association for Computational Linguistics. +Xin Wang, Fisher Yu, Lisa Dunlap, Yi-An Ma, Ruth Wang, Azalia Mirhoseini, Trevor Darrell, and Joseph E Gonzalez. 2020. Deep mixture of experts via shallow embedding. In Uncertainty in artificial intelligence, pages 552-562. PMLR. + +Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumont, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Remi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander Rush. 2020. Transformers: State-of-the-art natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 38-45, Online. Association for Computational Linguistics. +Xiaoyu Yang, Feng Nie, Yufei Feng, Quan Liu, Zhigang Chen, and Xiaodan Zhu. 2020. Program enhanced fact verification with verbalization and graph attention network. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 7810-7825, Online. Association for Computational Linguistics. +Xiaoyu Yang and Xiaodan Zhu. 2021. Exploring decomposition for table-based fact verification. arXiv preprint arXiv:2109.11020. +Hongzhi Zhang, Yingyao Wang, Sirui Wang, Xuezhi Cao, Fuzheng Zhang, and Zhongyuan Wang. 2020. Table fact verification with structure-aware transformer. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 1624-1629, Online. Association for Computational Linguistics. +Wanjun Zhong, Duyu Tang, Zhangyin Feng, Nan Duan, Ming Zhou, Ming Gong, Linjun Shou, Daxin Jiang, Jiahai Wang, and Jian Yin. 2020. Logical-FactChecker: Leveraging logical operations for fact checking with graph module network. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 6053-6065, Online. Association for Computational Linguistics. +Ziwei Zhu, Shahin Sefati, Parsa Saadatpanah, and James Caverlee. 2020. Recommendation for new users and new items via randomized training and mixture-of-experts transformation. In Proceedings of the 43rd International ACM SIGIR Conference on Research and Development in Information Retrieval, pages 1121-1130. + +# A Statistics of TABFACT + +Table 4 shows the basic statistics of TABFACT. As the table shows, the whole dataset is randomly divided into three subsets with the ratio be 8:1:1. The average numbers of rows and columns in tables keep approximately the same across three subsets, which reflects the consistency of data distribution. + +
Split#Sentence#TableAvg(rowAvg.col
Train92,28313,18214.15.5
Dev12,7921,69614.05.4
Test12,7791,69514.25.4
+ +# B Parameter Initialization + +For parameter initialization, We leverage RoBERTa-Large, a pre-trained language model that has 24 transformer encoding layers. We initial parameters of the feature extractor with the embedding layer and the bottom 12 encoding layers of RoBERTa-Large and each expert with the upper 12 encoding layers of RoBERTa-Large, respectively. We use PyTorch to initialize other parameters randomly. + +# C Specific Setting of Prior Assumption Generation + +We choose four reasoning types that appear most frequently in TABFACT: count, comparative, superlative, and negation. The detailed definitions of four reasoning types chosen in our implementation are listed below: + +1. Count: counting the number of specific rows in the table, such as "xxx be listed a total of 3 times", "xxx win only 1 time in ..., etc. +2. Comparative: comparing two values in the statement or cells, such as "xxx play in more than 1 game during ...", "xxx has a larger yyy than zzz", etc. +3. Superlative: finding the highest/lowest value of the specific column, such as "the longest xxx be yyyy", "the lowest score at xxx be yyyy", etc. +4. Negation: negating the original semantics of the statement, such as "xxx has never lost a game in ..., "xxx never score 0 points", etc. + +Table 4: Statistics of TABFACT, including the number of statements, tables, and the average number of rows and columns in tables. + +
TypeTriggerWeight
Countonly+[number]1.6
Count[number]+times2
Count[number]+of1.6
Countthere be+[number]1.6
Negationno1.5
Negationnot1.5
Negationnever1.5
Negationdidn't1.5
Comparative[JJS] or [RBS]1.5
Superlative[JJR] or [RBR]1.5
+ +Table 5: Some trigger words/patterns applied in the generation of the prior assumption on TABFACT. + +A small trigger-word pool that contains only 26 trigger words/patterns is applied for the prior assumption generation: 11 triggers for the "count" type, 15 for "negation"; and for the rest types (i.e., "comparative" and "superlative" types), the NLTK package is employed to recognize the comparative and superlative words automatically. Such a small trigger-word pool injects limit prior knowledge of the dataset, indicating that the proposed method can be generalized to other datasets by simply modifying the pool of trigger words. Table 5 presents some words/patterns in the trigger-word pool applied in our experiments. $\mathrm{x} +$ [number] denotes a combination of a word and a number that is served as a trigger (e.g., for the statement "xxx win 3 times in ..., we match the phrase "3 times" with the trigger "[number]+times"). \ No newline at end of file diff --git a/tablebasedfactverificationwithselfadaptivemixtureofexperts/images.zip b/tablebasedfactverificationwithselfadaptivemixtureofexperts/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..d20048146a021c002cfec846b20be9722b8bf26b --- /dev/null +++ b/tablebasedfactverificationwithselfadaptivemixtureofexperts/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:61236c4d0b1d350386dce7fdf7677c6ec6637a7670ee050eb2fc0ca7da482118 +size 304482 diff --git a/tablebasedfactverificationwithselfadaptivemixtureofexperts/layout.json b/tablebasedfactverificationwithselfadaptivemixtureofexperts/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..b64fd338cc86aebe590675458fce21b15753823f --- /dev/null +++ b/tablebasedfactverificationwithselfadaptivemixtureofexperts/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9abd5d1e67a00b7406e55d7f680b346b5bc5f1ef52fe63356aad61746c863ae5 +size 423493 diff --git a/taskguideddisentangledtuningforpretrainedlanguagemodels/9a6b9033-dc1d-4045-b95e-dfe5887910c5_content_list.json b/taskguideddisentangledtuningforpretrainedlanguagemodels/9a6b9033-dc1d-4045-b95e-dfe5887910c5_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..84755ef2f57f3fa0c0a0f7ce712ea52557f9dae1 --- /dev/null +++ b/taskguideddisentangledtuningforpretrainedlanguagemodels/9a6b9033-dc1d-4045-b95e-dfe5887910c5_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a5403064204b909acf30eb4e018cdda64b62787852d971606aaef70dfedd5ed4 +size 80623 diff --git a/taskguideddisentangledtuningforpretrainedlanguagemodels/9a6b9033-dc1d-4045-b95e-dfe5887910c5_model.json b/taskguideddisentangledtuningforpretrainedlanguagemodels/9a6b9033-dc1d-4045-b95e-dfe5887910c5_model.json new file mode 100644 index 0000000000000000000000000000000000000000..c5c9a1d6ac08ea8eec5b83b6f83efb65df9f161a --- /dev/null +++ b/taskguideddisentangledtuningforpretrainedlanguagemodels/9a6b9033-dc1d-4045-b95e-dfe5887910c5_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:89a0d0b4a36c647c703d5ba1431b62dc48b8e4211e94decc205cf3e920c5aa07 +size 95501 diff --git a/taskguideddisentangledtuningforpretrainedlanguagemodels/9a6b9033-dc1d-4045-b95e-dfe5887910c5_origin.pdf b/taskguideddisentangledtuningforpretrainedlanguagemodels/9a6b9033-dc1d-4045-b95e-dfe5887910c5_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..d6dcd65705e992e9a887ee9716b7e0ae212c7bbf --- /dev/null +++ b/taskguideddisentangledtuningforpretrainedlanguagemodels/9a6b9033-dc1d-4045-b95e-dfe5887910c5_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:908f9c11f352ca6f709312b046f94a0841620c10f3aad29051f8f882e1debdba +size 1258889 diff --git a/taskguideddisentangledtuningforpretrainedlanguagemodels/full.md b/taskguideddisentangledtuningforpretrainedlanguagemodels/full.md new file mode 100644 index 0000000000000000000000000000000000000000..f86d3074f767b98856354cdcdeadf59e73a3e512 --- /dev/null +++ b/taskguideddisentangledtuningforpretrainedlanguagemodels/full.md @@ -0,0 +1,321 @@ +# Task-guided Disentangled Tuning for Pretrained Language Models + +Jiali Zeng $^{1*}$ , Yufan Jiang $^{1}$ , Shuangzhi Wu $^{1}$ , Yongjing Yin $^{2}$ , Mu Li $^{1}$ + +Tencent Cloud Xiaowei, Beijing, China + +$^{2}$ Zhejiang University, Westlake University, Zhejiang, China + +{lemonzeng,garyyfjiang,frostwu,ethanlli}@tencent.com + +yinyongjing@westlake.edu.cn + +# Abstract + +Pretrained language models (PLMs) trained on large-scale unlabeled corpus are typically finetuned on task-specific downstream datasets, which have produced state-of-the-art results on various NLP tasks. However, the data discrepancy issue in domain and scale makes finetuning fail to efficiently capture task-specific patterns, especially in the low data regime. To address this issue, we propose Task-guided Disentangled Tuning (TDT) for PLMs, which enhances the generalization of representations by disentangling task-relevant signals from the entangled representations. For a given task, we introduce a learnable confidence model to detect indicative guidance from context, and further propose a disentangled regularization to mitigate the over-reliance problem. Experimental results on GLUE and CLUE benchmarks show that TDT gives consistently better results than fine-tuning with different PLMs, and extensive analysis demonstrates the effectiveness and robustness of our method. Code is available at https://github.com/lemon0830/TDT. + +# 1 Introduction + +In recent years, pretrained language models (PLMs) trained in a self-supervised manner like mask language modeling have achieved promising results on various natural language processing (NLP) tasks (Devlin et al., 2019; Yang et al., 2019; Liu et al., 2019b), which learn general linguistic and semantic knowledge from massive general corpus. To adapt PLMs to specific NLP tasks, a commonly-used approach is fine-tuning, where the whole or part of model parameters are tuned by task-specific objectives. Despite its success, the fine-tuned models have been proven ineffective to capture task-specific patterns due to the gap between task-agnostic pre-training and the weak fine-tuning with limited task-specific data (Gu et al., 2020; Gururan-gan et al., 2020; Kang et al., 2020). + +![](images/d7b262eaf9fac8152762ea749ff82f4d7f3a4d37985e9c5322f78a2826cceae7.jpg) + +![](images/bd3eda1962864d22283c2f3843141aa7c06e38d574f41e126a83c4821162c56f.jpg) +Figure 1: An over-reliance example of news classification task. The fine-tuned models tend to learn a simple rule that "Apple" (red) indicates "tech" class while ignore the real meaning of "apples" (green). A reliable model is expected to find out truly task-specific patterns (underlined words) instead of some high frequency but insignificant words ("apple"). + +To address this problem, most existing methods focus on adapting PLMs to downstream tasks by continual pre-training on in-domain unsupervised data (Gururangan et al., 2020; Gu et al., 2020; Wu et al., 2021; Kang et al., 2020; Ye et al., 2021). For example, Gu et al. (2020) propose intermediate continual pre-training with a selective masking strategy, and Gururangan et al. (2020) adapt PLMs to in-domain tasks by domain-adaptive pretraining. Although straightforward, these kinds of methods heavily rely on the selection of large-scale additional domain corpora and the design of appropriate intermediate training tasks (Wang et al., 2019; Aghajanyan et al., 2021a). + +In this paper, we propose a Task-guided Disentangled Tuning (TDT) for PLMs by automatically detecting task-specific informative inputs without the need of additional corpora and inter + +mediate training. The core component of TDT is a confidence model which assigns each token a confidence score, and we construct distilled samples by retaining informative tokens with high confidence scores while perturbing the rest. The confidence model performs a "deletion game" strategy, which encourages the model to perturb inputs as much as possible and to maintain the performance of downstream tasks to the greatest extent with the distilled samples. Although the informative tokens are important for downstream predictions, existing work shows that over-relying on part of these words may result in pool generalization, i.e., over-reliance problem (Moon et al., 2020; Geirhos et al., 2020; Sun et al., 2019). Take the sentences in Figure 1 as an example, when the context word "Apple" frequently co-occurs with the label "tech", fine-tuned models may learn a spurious association by binding "Apple" and "tech", leading to incorrect predictions of sentences which contain "apple" but belong to other categories. + +Based on the observation, we further enhance our method with a disentangled regularization, aiming to distinguish task-relevant and task-irrelevant features. First, we construct two variants of the original input in a complementary view: (1) positive variant, which maintains the high-confidence keywords, and (2) negative variant, derived by a "cut-out-keyword" operation on the original input. Next, we propose a "triplet-style loss", which makes predictions between the original input and the positive variant similar while the predictions between the negative variant and the other two different. To illustrate the mechanism of our disentangled regularization, we go back to Figure 1 and take the sentence "Jobs founded apple in 1976" as an example. Under the influence of the disentangled regularization, the positive variant tends to retain clue words for predictions (i.e., "founded apple"), while the negative variant, as the complement (i.e., "Jobs in 1976"), tends to be task-irrelevant. + +We evaluate our TDT on a wide range of neural language understanding benchmark datasets in English and Chinese, i.e., GLUE and CLUE, and our TDT affords strong predictive performance compared with standard fine-tuning. Moreover, we conduct extensive analysis with respect to robustness to perturbation, domain generalization, and low-resource settings, from which we conclude: + +- TDT learns reasonable confidence scores for input tokens. + +- TDT is robust to input perturbation and domain shift by encouraging the model to learn more generalized features. +- TDT effectively captures the high-confidence decisive cues for downstream tasks, thus alleviating over-fitting in low-resource scenarios. + +# 2 Method + +In this section, we begin with a brief introduction of the vanilla Fine-tuning, and then introduce Task-guided Disentangled Tuning (TDT) in detail. Figure 2 shows the overall framework. TDT is composed of two parts: (1) token-level confidence model, which discovers the essential parts of inputs for the model prediction; (2) task-guided regularization, which promotes the model to decouple task-relevant keywords from non-keyword context. + +# 2.1 Vanilla Fine-tuning + +Given an example of training data $< X, y >$ , where $X = \{x_1, \dots, x_i, \dots, x_n\}$ is the input sequence and $y$ is its corresponding label. We first map each token $x_i$ to a real-valued vector $e_i$ by an embedding layer. Then, the packed embedding output $E = \{e_i\}$ is fed into the PLM to get the contextualized sentence representations $H = \{h_{cls}, h_1, \dots, h_n\}$ , and the hidden state $h_{cls}$ is used to conduct classification with a MLP head. We fine-tune the parameters of the PLM with the cross entropy loss: + +$$ +\mathcal {L} _ {c l a} = - \log P (y | H). \tag {1} +$$ + +# 2.2 Token-level Confidence Model + +For each token $x_{i}$ , we generate a scalar $c_{i} \in [0,1]$ coined confidence score, by stacking a single-layer feed-forward network with sigmoid activation on the top of the embedding layer: + +$$ +c _ {i} = \sigma (W e _ {i} + b), \tag {2} +$$ + +where $W$ and $b$ are trainable parameters. Based on the confidence score, we obtain a distilled sample $\{e_i^+\}$ defined as + +$$ +e _ {i} ^ {+} = c _ {i} \odot e _ {i} + (1 - c _ {i}) \odot \mu_ {0}, \tag {3} +$$ + +where $\mu_0$ is a perturbation term and $\odot$ denotes element-wise multiplication. Specifically, the perturbation term $\mu_0$ can be a zero vector, a random Gaussian noise vector, or the average of the token + +![](images/3c320715339cc21671264e42371424ffd6382b06a234645b1970146460cf655f.jpg) +Figure 2: The overall framework of our proposed Task-guided Disentangled Tuning method. + +embedding, and we choose the last one in this paper. In this manner, for the distilled sample of each training instance, the higher the $c_{i}$ is, the more semantic information of the $i$ -th token retains, while the tokens with lower scores are perturbed. + +Then, the distilled sample $\{e_i^+\}$ is fed into the PLM to generate the sentence representations $H^{+} = \{h_{i}^{+}\}$ . Inspired by "deletion game" (Fong and Vedaldi, 2017; Voita et al., 2019), the objective function of the confidence model is + +$$ +\mathcal {L} _ {C} = - \log P (y | H ^ {+}) + \gamma | | C | | _ {2}, \tag {4} +$$ + +where $C = \{c_i\}$ is the set of confidence scores of $X$ . The first term is the cross entropy loss of classification on the distilled sample to encourage the confidence model to assign higher scores to the more decisive part of the input, and the second term serves as a penalty to prevent the model from mode collapsing (i.e., always choosing $c_i = 1$ ). + +# 2.3 Task-Guided Regularization + +It has been widely observed that the pretrained models tend to learn an easy-to-learn but not generalizable solution by vanilla fine-tuning on various NLP tasks (Sun et al., 2019; McCoy et al., 2019; Min et al., 2019; Niven and Kao, 2019). To alleviate this issue, we further propose a triplet-style loss on the model predictions. + +Specifically, for each input sequence, we derive two different variants: a positive variant and a negative variant. The positive variant is expected to maintain the most informative tokens to task prediction and vice versa. As aforementioned, our confidence model removes the meaningless tokens by setting the corresponding confidence scores to zero. Based on the confidence scores, we directly treat the distilled sample generated by Eq. 3 as the positive variant and generate the negative variant as + +$$ +e _ {i} ^ {-} = \left(1 - c _ {i}\right) \odot e _ {i}. \tag {5} +$$ + +Given the original input and the two derived variants, we feed them into the PLM with the classifier, and obtain three prediction distributions $P(y|H)$ , $P(y|H^{+})$ , and $P(y|H^{-})$ . Finally, we regularize these distributions by a triplet ranking loss + +$$ +\begin{array}{l} \mathcal {L} _ {R} = \max (m + d (P (y | H ^ {+}), P (y | H)) - \\ d (P (y | H ^ {-}), P (y | H)) - \\ d \left(P (y \mid H ^ {-}), P (y \mid H ^ {+})\right), 0) \tag {6} \\ \end{array} +$$ + +where $m$ is a hyperparameter indicating a margin for the loss and $d(\cdot)$ denotes the Kullback-Leibler (KL) divergence. By minimizing $\mathcal{L}_R$ , the positive variant will be closer to the original input while the negative variant will be farther from the other two. Thus, the model is encouraged to disentangle task-relevant signals from task-irrelevant factors, and generate more general representations. + +# 2.4 Overall Training Objective + +The final training objective is + +$$ +\mathcal {L} = \mathcal {L} _ {c l a} + \alpha \mathcal {L} _ {C} + \beta \mathcal {L} _ {\mathcal {R}}, \tag {7} +$$ + +where $\alpha$ and $\beta$ are non-negative hyper-parameters to balance the effect of each loss term. + +# 3 Experiments + +# 3.1 Datasets + +We evaluate our proposed method by fine-tuning the pretrained models on the General Language Understanding Evaluation (GLUE) (Wang et al., 2018) and the Chinese Language Understanding Evaluation (CLUE) (Xu et al., 2020). Concretely, the GLUE benchmark has 8 different text classification or regression tasks including MNLI, MRPC, QNLI, QQP, RTE, SST-2, SST-B, and CoLA. The CLUE benchmark includes 9 tasks spanning several single-sentence/sentence-pair classification tasks, and we choose 5 tasks, OCNLI, IFLYTEK, CSL, TNEWS, + +
ModelMNLIQQPQNLISST-2CoLASTS-BMRPCRTEAvg
BERT-base
FineTuning84.590.991.392.860.588.785.167.582.66
TDT85.391.291.993.762.489.387.571.884.14
BERT-large
FineTuning †86.691.392.393.260.690.088.070.484.05
FineTuning85.990.992.393.961.590.086.075.184.45
TDT86.491.492.694.366.289.988.575.885.64
RoBERTa-large
FineTuning †90.292.294.796.468.092.490.986.688.92
FineTuning90.592.394.496.667.492.291.987.789.13
TDT90.691.994.797.069.392.593.191.090.01
XLNet †90.892.394.997.069.092.590.885.989.15
ELECRTA †90.992.495.096.969.192.690.888.089.46
DeBERTa †91.192.495.396.870.592.691.988.389.86
ALBERT †90.892.295.396.971.493.090.989.289.96
+ +Table 1: Experimental results on GLUE language understanding benchmark. When take RoBERTA-large as the PLM, for RTE and STS, we follow Liu et al. (2019b) to finetune starting from the MNLI model instead of the baseline pretrained model. Methods with $\dagger$ denote that we directly report the scores from corresponding paper, and others are from our implementation. + +
TaskBERT-wwm-baseMacBERT-largeRoBERTa-wwm-large
FineTuningTDTFineTuningTDTFineTuningTDT
OCNLI74.675.378.379.878.179.5
IFLYTEK60.862.261.561.861.862.9
CSL84.785.586.887.086.187.2
TNEWS56.957.358.558.759.059.2
AFQMC74.075.076.276.876.076.2
Avg70.2071.0672.2672.8272.2073.00
+ +Table 2: Experimental results on CLUE language understanding benchmark. For TNEWS, we only use the raw "sentence" for classification without the "keywords" information. For CSL, we only mask the "abst" sequence and keep the "keywords" sequence unchanged in our proposed method. + +and AFQMC. The detailed data statistics and metrics are provided in Appendix A. + +# 3.2 Model & Training + +We use the pretrained models and codes provided by HuggingFace1. We take BERT-base (Devlin et al., 2019), BERT-large (Devlin et al., 2019) and RoBERTa-large (Liu et al., 2019b) as our backbones on GLUE, while BERT-wwm-base (Cui et al., 2019), MacBERT-large (Cui et al., 2020), and RoBERTa-wwm-large (Cui et al., 2019) on CLUE. We tune the task specific hyper-parameters $m \in \{0,2\}$ , $\alpha \in \{0.5,2,4\}$ and $\beta \in \{0.5,1\}$ . Detailed experimental setups are shown in Appendix B. Following previous work (Lee et al., 2020; Agha + +janyan et al., 2020), we report results of the development sets, since the performance on the test sets is only accessible on the leaderboard with a limitation of the number of submissions. + +# 3.3 Main Results + +Results on GLUE. We illustrate the experimental results on the GLUE benchmark in Table 1. We can observe that the PLMs enhanced by TDT outperforms FineTuning by a large margin across all the tasks. Specifically, TDTs achieve 1.48 points, 1.19 points and 0.88 points (on average) improvement over BERT-base, BERT-large, and RoBERTa-large, respectively. In particular, BERT-base+TDT achieves competitive performance compared with BERT-large+FineTuning, showing that our method + +![](images/2478fbac8e81bafd3984b3a1908e64cdce603100f13fab9aa2712cf3e1336f09.jpg) + +![](images/bc8ecd7faab450853e9f27273bae049bab1ec38f50caa6f6b3a992f0176ab783.jpg) +Figure 3: Visualization of representations of original input and two derived variants, where the triangle-shaped (pink), tri-up-shaped (purple), and tri-left-shaped (black) points denote the representations of original input, positive variants, and negative variants, respectively. + +is more efficient to find task-specific information for downstream tasks. This may be because our training strategy prompts the models to predict with as little information as possible, isolating the task-related signals from the whole representations. + +RoBERT-large trained with TDT surpasses XLNet-large (Yang et al., 2019) ALBERT-xxlarge (Lan et al., 2019), DeBERTa-large (He et al., 2020), and ELECTRA-large (Clark et al., 2020), which are specially designed with different architectures and pre-training objectives. + +Results on CLUE. Table 2 shows the overall results on the 5 tasks of CLUE benchmark. Concretely, TDT significantly outperforms FineTuning on CSL, IFLYTEK, AFQMC, and OCNLI, and shows competitive results on the short text classification task TNEWS, indicating the advantage of extracting important parts from long text or multiple input sequences. Note that TNEWS generally requires additional knowledge (e.g., keywords) as a supplement due to the short input, and thus cannot show the superiority of TDT. + +![](images/29a2f5be1530bd95edc13fadbe7dd358dcb13e65b58d6f652975035d282f97e0.jpg) + +![](images/2d6bddee734be1920cfcbee01a99d7311549b630bbbc7dbb15752bbe6575ad85.jpg) +Figure 4: Distribution of confidence scores on MRPC and CoLA dev sets. + +# 4 Analysis & Discussion + +# 4.1 Visualization of Representations + +In Figure 3, we plot t-SNE visualizations (van der Maaten and Hinton, 2008) of three kinds of representations generated by BERT-large trained with TDT on CoLA dev set. We can see that the representations of the original input are close to those of the positive variant in the same class. Although the negative variant representations are really similar to the original ones which derive the former, they are clearly separated from the other representations. The learned disentangled representations reveal that the model trained with TDT is able to distinguish task-specific keywords and nonkeyword context, which plays an important role in increasing models' robustness. + +# 4.2 Distribution of Confidence Scores + +We investigate the learned confidence score distributions in Figure 4. It shows that although the initial distribution is consistent, the model learns different task-specific patterns (confidence distributions) on different tasks. + +# 4.3 Does our Confidence Model make a meaningful estimation for input tokens? + +In section 2.2, we mention that TDT uses a scalar for evaluating the contribution of each input token. To analyze whether the strategy can successfully learn a meaningful importance estimation, we con + +![](images/0b1b9ca9d28255639d71b487a2c4f688c6eac1394ce13abb878ac82064d57711.jpg) +Figure 5: Robustness to Input Perturbation. The Y-axis is the accuracy on the development set. + +![](images/75dac8a7c0b47bb2b6dec1ad69fb6fd9fd22ebbaec53eff5635549b76a5e20a6.jpg) +Figure 6: Accuracy of BERT-large trained with different methods and evaluated on MPRC dev set with different drop rates. We denote vanilla fine-tuning as FineT. The solid lines indicate results on the datasets constructed by dropping tokens in descending order of confidence scores. The dotted lines denote results on the datasets constructed by dropping tokens in increasing order of confidence scores. + +struct two sets of datasets based on MRPC dev set and then evaluate the performance of BERT-large with TDT and standard fine-tuning. Specifically, we convert the confidence scores to probability distributions. We generate the first set of datasets by dropping input tokens in descending order of the distributions and generate the second set in ascending order. In order to ensure language fluency, we replace each dropped token with a “[MASK]” token. The results are shown in Figure 6 and we observe that: + +- TDT is more robust to incomplete input compared with Fine-tuning. Specifically, although the performance of both FineTuning and TDT drops with the increase of dropout rate, our TDT achieves significantly better per + +
TaskFineTuningTDTΔ
MNLI (BERT-large)
MNLI-m85.886.4+0.6
QQP73.174.2+1.1
OCNLI (MacBERT-large)
CMNLI70.671.8+1.2
BUSTM64.866.4+1.6
+ +Table 3: Performance of Domain Generalization. The models are trained on MNLI/OCNLI but tested on out-of-domain data. + +formance than FineTuning over all datasets. + +- Our learned confidence scores make reasonable assessments for each input token. Particularly, regardless of the dropout rates and the training methods, dropping input tokens by the descending order of the masking scores always leads to worse performance. + +# 4.4 Robustness to Input Perturbation + +Based on the observation in Section 4.3, we further investigate the robustness of TDT on perturbed data. To construct perturbed data, we use the dev set of MRPC and possibly replace the input at each position with a "[MASK]" token or a token sampled from the input sequence. For each dropout rate, we construct 10 datasets with different random seeds and draw violin plots of the performance of BERT-large trained with TDT and fine-tuning (Figure 5). We can see that Ours is consistently better than FineTuning in all groups, indicating the superior robustness to noisy data. + +
TaskFineTuningTDTΔ
CLUE (MacBERT-large)
OCNLI60.85 (±2.66)63.38 (±0.90)+2.53
IFLYTEK54.12 (±0.75)54.78 (±0.94)+0.66
CSL80.25 (±1.36)81.45 (±0.62)+1.20
TNEWS53.50 (±0.58)53.33 (±0.25)-0.17
AFQMC64.77 (±3.87)66.45 (±0.93)+1.68
Avg62.7063.88+1.18
+ +Table 4: Experimental results in low-resource scenarios. We run 4 times for each task with different random seeds and report the average accuracy and the standard deviation. + +# 4.5 Domain Generalization + +We evaluate how well the trained models generalize to out-of-domain data on MNLI and OCNLI, Natural Language Inference (NLI) tasks of GLUE and CLUE respectively. In detail, we fine-tune BERT-large on MNLI, and test the accuracy of the fine-tuned models on other NLI datasets in different domains including MNLI-mismatch² and QQP. Besides, we fine-tune MacBERT-large on OCNLI and conduct an evaluation on CMNLI³ and BUSTM⁴. Detailed of Label Mapping is provided in Appendix C. As Tabel 3 illustrates, TDT outperforms vanilla fine-tuning across different out-of-domain datasets. The results suggest that TDT encourages the model to learn more generalized features rather than some superficial contextual cues unique to training data. + +# 4.6 Results in Low-resource Scenarios + +Fine-tuning PLMs on very small amount of training data can be challenging and result in unstable performance due to the serious over-fitting issue. In this section, we explore the effectiveness of TDT in such scenarios. For each dataset in CLUE, we use MacBERT-large and sample 1k training examples as its training data. As Table 4 demonstrates, TDT improves the accuracy by 1.18 on average and reduces the standard deviation by up to 2.94. It suggests that our TDT is more stable and efficient than vanilla fine-tuning when training PLMs on limited data. + +# 4.7 Compared with Variants + +Ablation Studies. We first conduct ablation studies to explore the effectiveness of two additional loss functions introduced in this paper and show the results in Table 5. We find that removing any of them leads to a performance drop, which indicates their effectiveness on regularization for training. + +Soft Perturbation vs. Hard Perturbation. The confidence score in this paper is continuous value ranging from 0 to 1, and we perturb the input in a soft way. It is straightforward to investigate the discrete counterpart. To this end, we model the discrete confidence score with the Gumbel-Softmax trick (Jang et al., 2017). More detailed is introduced in Appendix D. We denote the model trained with the hard strategy as TDT-hard and show the comparison in Table 5. From the table, both TDT-hard and TDT yield better performance than vanilla fine-tuning. This observation supports our claim that different tokens or phrases contribute differently to the final results, which can be detected by task-guided signal and then used to model more reliable encoders by our proposed regularization. Moreover, the inferior performance of TDT-hard shows that naively removing tokens has an adverse effect on context modeling and thus it is better to regularize the over-reliance in a soft manner. + +# 4.8 Compared with Previous Methods + +TDT vs. Token Cutoff. Our method can also be viewed as a soft variant of token cutoff (Shen et al., 2020), which is a data augmentation strategy. Table 5 shows the results where we find that TDT performs better than TokenCutoff, which demonstrates that the improvement of our method is not entirely due to the effect of data augmentation but stems from the design of the training objectives. + +TDT vs. R-drop & R3F. Recently, Liang et al. (2021) proposed R-drop to regularize the consistency of sub-models obtained through dropout. Aghajanyan et al. (2021b) introduced R3F rooted in trust region theory, which adds noise into the input embedding and minimize the KL divergence between prediction distributions given original input and noisy input. Both of them are task-agnostic, while our proposed method constructs two derived variants with task signal, and concentrates on how to disentangle the task-relevant and task-irrelevant factors. The better performance of TDT compared with the strong R-drop and R3F baselines (Table 5) + +
ModelGLUE (RoBERTa-large)CLUE (RoBERTa-www-large)
SST-2CoLAMRPCRTEAvgOCNLIIFLYTEKCSLTNEWSAvg
FineTuning96.667.491.987.785.9078.161.886.159.071.25
TokenCutoff †96.970.090.990.687.1078.261.886.159.271.33
R-drop †96.970.091.488.486.6778.961.686.658.971.50
R3F †97.071.291.688.587.07-----
PostTraining95.064.791.284.183.7576.562.187.058.971.13
TDT w/o LC96.469.391.989.586.7778.661.986.959.071.60
TDT w/o LR96.466.791.490.686.2879.262.186.958.971.77
TDT-hard96.767.692.290.386.7079.162.587.059.171.93
TDT97.069.393.191.087.6079.562.987.259.272.20
+ +Table 5: Results of RoBERTa-large trained with TDT, variants or previous methods on 4 GLUE tasks and 4 CLUE tasks. For GLUE, results with $\dagger$ are taken from the corresponding paper. + +verify the advantage of task-driven regularization. + +TDT vs. Post-Training. Post-training is an effective approach to reduce the objective gap between pretrained model and downstream tasks (Gu et al., 2020), which continues to train PLMs on task (or in-domain) training data with mask language model (MLM) loss. The difference lies in that we focus on the fine-tuning stage. Here, we compare TDT with the model first post-trained via MLM on training set of each task and then fine-tuned. It is surprising that post-training does not always have a positive effect on downstream fine-tuning, while TDT shows effective performance without additional post-training time consumption. + +# 5 Related Work + +Fine-tuning large-scale PLMs tends to be a popular paradigm of various NLP tasks (Devlin et al., 2019; Liu et al., 2019a; Yang et al., 2019). However, the fine-tuned models fail to capture task-specific patterns due to the imbalanced nature between the large number of parameters and limited training data (Aghajanyan et al., 2020). To address this issue, two main research lines are proposed: (1) continual pretraining after general pre-training, (2) regularization techniques in fine-tuning. + +Continual pretraining of PLMs on unlabeled data of a given downstream domain or task has been proved effective for the end-task performance (Gururangan et al., 2020), and various continual pre-training objectives designed for different downstream tasks have been proposed (Tian et al., 2020; Wu et al., 2021). For example, Gu et al. (2020) propose a selective masking strategy to learn task + +specific patterns based on mid-scale in-domain data. However, such methods usually rely on extra in-domain data and manually designed training objectives. + +Due to the overfitting problems of fine-tuning, lots of regularization techniques have been proposed. Lee et al. (2019) and Chen et al. (2020) regularize fine-tuned weights with original pretrained weights while others design adversarial training objectives or introduce noise into the input (Zhu et al., 2020; Jiang et al., 2020; Aghajanyan et al., 2020; Shen et al., 2020; Yu et al., 2021; Hua et al., 2021; Qu et al., 2020). Liang et al. (2021) regularize the training by minimizing the KL-divergence between the output distributions of two sub-models sampled by dropout and Xu et al. (2021b) only updates a sub-set of the whole network during fine-tuning by selectively masking out the gradients in both task-free and task-driven ways. Moon et al. (2020) handle the over-reliance problem by reconstructing keywords based on other words and making low-confidence predictions without enough context. + +# 6 Conclusion + +In this paper, we propose task-guided disentangled tuning for enhancing the efficiency and robustness of PLMs in downstream NLP tasks. Our method is able to efficiently distinguish task-specific features and task-agnostic ones, and bridges the gap between pretraining and adaptation without the need of immediate continual training. Experiments on GLUE and CLUE benchmarks demonstrate the effectiveness of our method, and extensive analysis shows the advantage in domain generalization and low-resource setting over fine-tuning. + +# References + +Armen Aghajanyan, Anchit Gupta, Akshit Shrivastava, Xilun Chen, Luke Zettlemoyer, and Sonal Gupta. 2021a. Muppet: Massive multi-task representations with pre-finetuning. arXiv preprint arXiv:2101.11038. +Armen Aghajanyan, Akshit Shrivastava, Anchit Gupta, Naman Goyal, Luke Zettlemoyer, and Sonal Gupta. 2020. Better fine-tuning by reducing representational collapse. arXiv preprint arXiv:2008.03156. +Armen Aghajanyan, Akshit Shrivastava, Anchit Gupta, Naman Goyal, Luke Zettlemoyer, and Sonal Gupta. 2021b. Better fine-tuning by reducing representational collapse. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021. OpenReview.net. +Sanyuan Chen, Yutai Hou, Yiming Cui, Wanxiang Che, Ting Liu, and Xiangzhan Yu. 2020. Recall and learn: Fine-tuning deep pretrained language models with less forgetting. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 7870-7881, Online. Association for Computational Linguistics. +Kevin Clark, Minh-Thang Luong, Quoc V Le, and Christopher D Manning. 2020. Electra: Pre-training text encoders as discriminators rather than generators. arXiv preprint arXiv:2003.10555. +Yiming Cui, Wanxiang Che, Ting Liu, Bing Qin, Shijin Wang, and Guoping Hu. 2020. Revisiting pre-trained models for Chinese natural language processing. In *Findings of the Association for Computational Linguistics: EMNLP* 2020, pages 657-668, Online. Association for Computational Linguistics. +Yiming Cui, Wanxiang Che, Ting Liu, Bing Qin, Ziqing Yang, Shijin Wang, and Guoping Hu. 2019. Pretraining with whole word masking for chinese bert. arXiv preprint arXiv:1906.08101. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171-4186, Minneapolis, Minnesota. Association for Computational Linguistics. +Ruth C. Fong and Andrea Vedaldi. 2017. Interpretable explanations of black boxes by meaningful perturbation. In IEEE International Conference on Computer Vision, ICCV 2017, Venice, Italy, October 22-29, 2017, pages 3449-3457. IEEE Computer Society. +Robert Geirhos, Jorn-Henrik Jacobsen, Claudio Michaelis, Richard S. Zemel, Wieland Brendel, Matthias Bethge, and Felix A. Wichmann. 2020. Shortcut learning in deep neural networks. CoRR, abs/2004.07780. + +Yuxian Gu, Zhengyan Zhang, Xiaozhi Wang, Zhiyuan Liu, and Maosong Sun. 2020. Train no evil: Selective masking for task-guided pre-training. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 6966-6974, Online. Association for Computational Linguistics. +Suchin Gururangan, Ana Marasovic, Swabha Swayamdipta, Kyle Lo, Iz Beltagy, Doug Downey, and Noah A. Smith. 2020. Don't stop pretraining: Adapt language models to domains and tasks. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 8342-8360, Online. Association for Computational Linguistics. +Pengcheng He, Xiaodong Liu, Jianfeng Gao, and Weizhu Chen. 2020. Deberta: Decoding-enhanced bert with disentangled attention. arXiv preprint arXiv:2006.03654. +Hang Hua, Xingjian Li, Dejing Dou, Chengzhong Xu, and Jiebo Luo. 2021. Noise stability regularization for improving BERT fine-tuning. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 3229-3241, Online. Association for Computational Linguistics. +Eric Jang, Shixiang Gu, and Ben Poole. 2017. Categorical reparameterization with gumbel-softmax. In 5th International Conference on Learning Representations, ICLR 2017, Toulouse, France, April 24-26, 2017, Conference Track Proceedings. OpenReview.net. +Haoming Jiang, Pengcheng He, Weizhu Chen, Xiaodong Liu, Jianfeng Gao, and Tuo Zhao. 2020 SMART: Robust and efficient fine-tuning for pretrained natural language models through principled regularized optimization. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 2177-2190, Online. Association for Computational Linguistics. +Minki Kang, Moonsu Han, and Sung Ju Hwang. 2020. Neural mask generator: Learning to generate adaptive word maskings for language model adaptation. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 6102-6120, Online. Association for Computational Linguistics. +Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, and Radu Soricut 2019. Albert: A lite bert for self-supervised learning of language representations. arXiv preprint arXiv:1909.11942. +Cheolhyoung Lee, Kyunghyun Cho, and Wanmo Kang 2019. Mixout: Effective regularization to fine-tune large-scale pretrained language models. arXiv preprint arXiv:1909.11299. + +Cheolhyoung Lee, Kyunghyun Cho, and Wanmo Kang. 2020. Mixout: Effective regularization to finetune large-scale pretrained language models. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net. +Xiaobo Liang, Lijun Wu, Juntao Li, Yue Wang, Qi Meng, Tao Qin, Wei Chen, Min Zhang, and TieYan Liu. 2021. R-drop: Regularized dropout for neural networks. CoRR, abs/2106.14448. +Hairong Liu, Mingbo Ma, Liang Huang, Hao Xiong, and Zhongjun He. 2019a. Robust neural machine translation with joint textual and phonetic embedding. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 3044-3049, Florence, Italy. Association for Computational Linguistics. +Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019b. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692. +Tom McCoy, Ellie Pavlick, and Tal Linzen. 2019. Right for the wrong reasons: Diagnosing syntactic heuristics in natural language inference. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 3428-3448, Florence, Italy. Association for Computational Linguistics. +Sewon Min, Eric Wallace, Sameer Singh, Matt Gardner, Hannaneh Hajishirzi, and Luke Zettlemoyer. 2019. Compositional questions do not necessitate multi-hop reasoning. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 4249-4257, Florence, Italy. Association for Computational Linguistics. +Seung Jun Moon, Sangwoo Mo, Kimin Lee, Jaeho Lee, and Jinwoo Shin. 2020. Masker: Masked keyword regularization for reliable text classification. arXiv preprint arXiv:2012.09392. +Timothy Niven and Hung-Yu Kao. 2019. Probing neural network comprehension of natural language arguments. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 4658-4664, Florence, Italy. Association for Computational Linguistics. +Yanru Qu, Dinghan Shen, Yelong Shen, Sandra Sajeev, Jiawei Han, and Weizhu Chen. 2020. Coda: Contrast-enhanced and diversity-promoting data augmentation for natural language understanding. arXiv preprint arXiv:2010.08670. +Dinghan Shen, Mingzhi Zheng, Yelong Shen, Yanru Qu, and Weizhu Chen. 2020. A simple but tough-to-beat data augmentation approach for natural language understanding and generation. CoRR, abs/2009.13818. + +Chi Sun, Xipeng Qiu, Yige Xu, and Xuanjing Huang. 2019. How to fine-tune BERT for text classification? In Chinese Computational Linguistics - 18th China National Conference, CCL 2019, Kunming, China, October 18-20, 2019, Proceedings, volume 11856 of Lecture Notes in Computer Science, pages 194-206. Springer. +Hao Tian, Can Gao, Xinyan Xiao, Hao Liu, Bolei He, Hua Wu, Haifeng Wang, and Feng Wu. 2020. SKEP: Sentiment knowledge enhanced pre-training for sentiment analysis. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 4067-4076, Online. Association for Computational Linguistics. +Laurens van der Maaten and Geoffrey Hinton. 2008. Visualizing data using t-sne. Journal of Machine Learning Research, 9(86):2579-2605. +Elena Voita, David Talbot, Fedor Moiseev, Rico Senrich, and Ivan Titov. 2019. Analyzing multi-head self-attention: Specialized heads do the heavy lifting, the rest can be pruned. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 5797-5808, Florence, Italy. Association for Computational Linguistics. +Alex Wang, Jan Hula, Patrick Xia, Raghavendra Pappagari, R. Thomas McCoy, Roma Patel, Najoung Kim, Ian Tenney, Yinghui Huang, Katherin Yu, Shuning Jin, Berlin Chen, Benjamin Van Durme, Edouard Grave, Ellie Pavlick, and Samuel R. Bowman. 2019. Can you tell me how to get past sesame street? sentence-level pretraining beyond language modeling. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 4465-4476, Florence, Italy. Association for Computational Linguistics. +Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel Bowman. 2018. GLUE: A multi-task benchmark and analysis platform for natural language understanding. In Proceedings of the 2018 EMNLP Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pages 353-355, Brussels, Belgium. Association for Computational Linguistics. +Han Wu, Kun Xu, Linfeng Song, Lifeng Jin, Haisong Zhang, and Linqi Song. 2021. Domain-adaptive pretraining methods for dialogue understanding. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 2: Short Papers), pages 665-669, Online. Association for Computational Linguistics. +Liang Xu, Hai Hu, Xuanwei Zhang, Lu Li, Chenjie Cao, Yudong Li, Yechen Xu, Kai Sun, Dian Yu, Cong Yu, Yin Tian, Qianqian Dong, Weitang Liu, Bo Shi, Yiming Cui, Junyi Li, Jun Zeng, Rongzhao Wang, Weijian Xie, Yanting Li, Yina Patterson, Zuoyu Tian, Yiwen Zhang, He Zhou, Shaoweihua Liu, Zhe Zhao, Qipeng Zhao, Cong Yue, Xinrui Zhang, Zhengliang + +Yang, Kyle Richardson, and Zhenzhong Lan. 2020. CLUE: A Chinese language understanding evaluation benchmark. In Proceedings of the 28th International Conference on Computational Linguistics, COLING 2020, Barcelona, Spain (Online), December 8-13, 2020, pages 4762-4772. International Committee on Computational Linguistics. + +Liang Xu, Xiaojing Lu, Chenyang Yuan, Xuanwei Zhang, Hu Yuan, Huilin Xu, Guoao Wei, Xiang Pan, and Hai Hu. 2021a. Few clue: A chinese few-shot learning evaluation benchmark. CoRR, abs/2107.07498. + +Runxin Xu, Fuli Luo, Zhiyuan Zhang, Chuanqi Tan, Baobao Chang, Songfang Huang, and Fei Huang. 2021b. Raise a child in large language model: Towards effective and generalizable fine-tuning. arXiv preprint arXiv:2109.05687. + +Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Russ R Salakhutdinov, and Quoc V Le. 2019. Xlnet: Generalized autoregressive pretraining for language understanding. Advances in neural information processing systems, 32. + +Qinyuan Ye, Belinda Z Li, Sinong Wang, Benjamin Bolte, Hao Ma, Wen-tau Yih, Xiang Ren, and Madian Khabsa. 2021. On the influence of masking policies in intermediate pre-training. arXiv preprint arXiv:2104.08840. + +Yue Yu, Simiao Zuo, Haoming Jiang, Wendi Ren, Tuo Zhao, and Chao Zhang. 2021. Fine-tuning pretrained language model with weak supervision: A contrastive-regularized self-training approach. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 1063–1077, Online. Association for Computational Linguistics. + +Chen Zhu, Yu Cheng, Zhe Gan, Siqi Sun, Tom Goldstein, and Jingjing Liu. 2020. Freelb: Enhanced adversarial training for natural language understanding. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net. + +# A GLUE and CLUE Benchmark + +In this paper, we conduct experiments on 8 datasets in GLUE benchmark (Wang et al., 2018), and 5 datasets in CLUE (Xu et al., 2020), including the short text classification task TNEWS, the long text classification tasks IFLYTEK and CSL, and sentence-pair classification tasks AFQMC and OC-NLI. The data statistics and evaluate metrics are illustrated in Table 6. + +
Dataset# Train# DevMetrics
GLUE
MNLI393k9.8kAccuracy
QQP364k40kAccuracy
QNLI105k5.5kAccuracy
SST-267k872Accuracy
CoLA8.5k1.0kMatthews Corr
STS-B5.7k1.5kSpearman Corr
MRPC3.7k408Accuracy
RTE2.5k277Accuracy
CLUE
OCNLI50k3kAccuracy
IFLYTEK12.1k2.6kAccuracy
CSL20k3kAccuracy
TNEWS53.3k10kAccuracy
AFQMC34.3k4.3kAccuracy
CMNLI391k12kAccuracy
CLUEWSC1.2k304Accuracy
+ +Table 6: Data Statistics and Evaluate Metrics. + +
TaskBatch SizeStepsWarmuplr
GLUE
BERT-base
MNLI1281000010004e-5
QQP1281000010004e-5
QNLI6430003004e-5
SST-26430003004e-5
CoLA6420002002e-5
STS-B6430003004e-5
MRPC6420002001e-5
RTE6420002002e-5
BERT-large & RoBERT-large
MNLI641000010002e-5
QQP641000010002e-5
QNLI6430003002e-5
SST-26430003002e-5
CoLA3230003002e-5
STS-B6430003002e-5
MRPC6420002002e-5
RTE6420001002e-5
CLUE
BERT-wwm-base
OCNLI6430003004e-5
IFLYTEK1650003003e-5
CSL3230003003e-5
TNEWS6450003003e-5
AFQMC3230003003e-5
MacBERT-large & RoBERT-wwm-large
OCNLI3230003001e-5
IFLYTEK1650003001e-5
CSL3230003001e-5
TNEWS6450003001e-5
AFQMC3230003001e-5
+ +Table 7: Hyperparameters settings for different pretrained models on variant tasks. + +# B Settings for Different Pretrained Models + +In this paper, we fine-tuned different pretrained models with TDT, including BERT-base, BERT- + +large, RoBERTa-large for GLUE and BERT-wwmbase, MacBERT-large, RoBERTa-wwm-large for CLUE. The batch size, training steps, warmup steps, and learning rate are listed in Table 7. + +# C Label Mapping in Domain Generalization + +QQP has two labels, duplicate and not duplicate. We map entailment to duplicate and map both neutral and contradiction to not duplicate. BUSTM is a short text matching task of FewCLUE (Xu et al., 2021a). We use the public test set. BUSTM has two labels, $O$ and $I$ . We map entailment to label $I$ , and map both neutral and contradiction to label $O$ . + +# D Detailed of TDT-hard + +Gumbel-Softmax trick (Jang et al., 2017) is an approximation to sampling from the argmax. Formally, we replace Eq. 2 by: + +$$ +\begin{array}{l} c _ {i} = \operatorname {a r g m a x} \left(\sigma_ {\text {G u m b e l}} \left(z \left(e _ {i}\right)\right)\right), (8) \\ \sigma_ {\text {G u m b e l}} \left(z _ {i}\right) = \frac {\exp \left(\left(\log \left(z _ {i}\right) + g _ {i}\right) / \tau\right)}{\sum_ {j = 1} ^ {K} \exp \left(\left(\log \left(z _ {j}\right) + g _ {j}\right) / \tau\right)}, (9) \\ \end{array} +$$ + +where $g_{i}\sim \mathrm{Gumbel}(0,1),z(\cdot)$ returns the logits produced for a given input, and $\tau$ is the temperature. By this way, if $c_{i}$ is 0, the embedding of the $i$ -th token is set to the embedding of the "[MASK]" token, otherwise the embedding remains unchanged. \ No newline at end of file diff --git a/taskguideddisentangledtuningforpretrainedlanguagemodels/images.zip b/taskguideddisentangledtuningforpretrainedlanguagemodels/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..bd40e3fc5fb041e5e5cc38e43a3dd2cdf3b72c3a --- /dev/null +++ b/taskguideddisentangledtuningforpretrainedlanguagemodels/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a87b87d482ac9f4f7dc795821c5b8e3fe3dfc5b545fd308903264830a8891dab +size 712472 diff --git a/taskguideddisentangledtuningforpretrainedlanguagemodels/layout.json b/taskguideddisentangledtuningforpretrainedlanguagemodels/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..8c991f953ca6683fdf2e254facbaf837450b238e --- /dev/null +++ b/taskguideddisentangledtuningforpretrainedlanguagemodels/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b1f176abf24ef81ec96a8bac54c0904ecf84323a7048106c8f0bff3c7064a7d4 +size 340965 diff --git a/tegtokaugmentingtextgenerationviataskspecificandopenworldknowledge/a2d8be6a-8bdb-4c51-adf4-4c6882245816_content_list.json b/tegtokaugmentingtextgenerationviataskspecificandopenworldknowledge/a2d8be6a-8bdb-4c51-adf4-4c6882245816_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..011178d5648bc5ed612a8a8558c862161d6e03e4 --- /dev/null +++ b/tegtokaugmentingtextgenerationviataskspecificandopenworldknowledge/a2d8be6a-8bdb-4c51-adf4-4c6882245816_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6d2ee697a9f7e99f9e446d4177d5c26a82d4f93d0a7d727e69b34eecb613922 +size 87666 diff --git a/tegtokaugmentingtextgenerationviataskspecificandopenworldknowledge/a2d8be6a-8bdb-4c51-adf4-4c6882245816_model.json b/tegtokaugmentingtextgenerationviataskspecificandopenworldknowledge/a2d8be6a-8bdb-4c51-adf4-4c6882245816_model.json new file mode 100644 index 0000000000000000000000000000000000000000..a45913e72e94bae9ccb6f3ae22985565eb9cbea5 --- /dev/null +++ b/tegtokaugmentingtextgenerationviataskspecificandopenworldknowledge/a2d8be6a-8bdb-4c51-adf4-4c6882245816_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:618e3bef7cd48a8ef73ccffc2375ef2c342ab09c7dac4ec470f3f1d5f15a1be0 +size 107250 diff --git a/tegtokaugmentingtextgenerationviataskspecificandopenworldknowledge/a2d8be6a-8bdb-4c51-adf4-4c6882245816_origin.pdf b/tegtokaugmentingtextgenerationviataskspecificandopenworldknowledge/a2d8be6a-8bdb-4c51-adf4-4c6882245816_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..5e9129d13ac3ca85ca85b5919f136f9a26fa997f --- /dev/null +++ b/tegtokaugmentingtextgenerationviataskspecificandopenworldknowledge/a2d8be6a-8bdb-4c51-adf4-4c6882245816_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:74a436d6b671c9cf1fab62f27043574595f148db5c258162ba0eb53972d64c61 +size 549506 diff --git a/tegtokaugmentingtextgenerationviataskspecificandopenworldknowledge/full.md b/tegtokaugmentingtextgenerationviataskspecificandopenworldknowledge/full.md new file mode 100644 index 0000000000000000000000000000000000000000..2e8d5634b2e68c2b99455c19c73647719ca47e1d --- /dev/null +++ b/tegtokaugmentingtextgenerationviataskspecificandopenworldknowledge/full.md @@ -0,0 +1,340 @@ +# TEGtok: Augmenting Text Generation via Task-specific and Open-world Knowledge + +Chao-Hong Tan $^{1*}$ , Jia-Chen Gu $^{1*}$ , Chongyang Tao $^{2}$ , Zhen-Hua Ling $^{1\dagger}$ , Can Xu $^{2}$ , Huang Hu $^{2}$ , Xiubo Geng $^{2}$ , Daxin Jiang $^{2\dagger}$ + +$^{1}$ National Engineering Research Center for Speech and Language Information Processing, University of Science and Technology of China, Hefei, China + +2Microsoft, Beijing, China + +{chtan,gujc}@mail.ustc.edu.cn,zhling@ustc.edu.cn, + +{chotao, caxu, huahu, xigeng, djiang}@microsoft.com + +# Abstract + +Generating natural and informative texts has been a long-standing problem in NLP. Much effort has been dedicated into incorporating pretrained language models (PLMs) with various open-world knowledge, such as knowledge graphs or wiki pages. However, their ability to access and manipulate the task-specific knowledge is still limited on downstream tasks, as this type of knowledge is usually not well covered in PLMs and is hard to acquire. To address the problem, we propose augmenting TExt Generation via Task-specific and Open-world Knowledge (TEGtok) in a unified framework. Our model selects knowledge entries from two types of knowledge sources through dense retrieval and then injects them into the input encoding and output decoding stages respectively on the basis of PLMs. With the help of these two types of knowledge, our model can learn what and how to generate. Experiments on two text generation tasks of dialogue generation and question generation, and on two datasets show that our method achieves better performance than various baseline models. + +# 1 Introduction + +Enabling natural models to generate natural and informative sequences is a challenging yet intriguing problem of artificial intelligence and has attracted increasing attention due to its promising potentials and alluring commercial values (Bahdanau et al., 2015; Du et al., 2017; Kepuska and Bohouta, 2018; Berdasco et al., 2019; Zhou et al., 2020; Gehrmann et al., 2021). Thanks to the achievements on neural sequence modeling and pre-training technologies, current generative models are able to generate nature and fluency target sequences using either encoder-decoder architectures (Sutskever et al., 2014; Bahdanau et al., 2015; Vaswani et al., 2017) or language models (Radford et al., 2019; Brown + +et al., 2020; Lewis et al., 2020a) Despite these methods being the state-of-the-art frameworks for NLG, they are often provided limited knowledge to generate the desired output. Thus, the performance of text generation is still far from satisfaction in many real-world scenarios (Yu et al., 2020a). + +Recently, much effort has been dedicated into incorporating traditional generative models or pretrained language models (PLMs) with a variety of open-world knowledge, such as structural knowledge bases (e.g., ConceptNet) (Speer and Havasi, 2012; Speer et al., 2017) or unstructured documents (e.g., documents from Wikipedia) (Zhou et al., 2018c; Dinan et al., 2019). By providing the supplementary knowledge of an entity mentioned within or the background knowledge of a source text, it can help to better understand the input text and its surrounding context, and to ameliorate the informativeness of the generated text. + +Although the open-world knowledge brings improvement to the generation process in most cases, its effect is still limited to the cases involving fewer entities or abstract semantics. On the other hand, the process of generating text by humans is often grounded by more than one single type of knowledge perception. In addition to world knowledge, the task-specific knowledge also acts as an important information source, and is usually not well covered in PLMs and is hard to acquire through fine-tuning. For example, in dialogue systems, what people have said or responded before can be reused as an important knowledge source, where these utterances talked before can be retained as the task-related knowledge in the mind of an interlocutor; for question generation, what part of a document makes people curious most and then ask specific questions, can often get enlightened by the existing questions raised from their corresponding passages. Intuitively, these related task-specific examples can bring additional information associated with the given source mes + +sages and provide exemplary information for neural generative models, but this useful information source is neglected in previous studies. + +On account of the above issues, we propose augmenting TExt Generation via Task-specific and Open-world Knowledge (TEGTOK). Specifically, the world knowledge is assumed to be unstructured Wikipedia documents that provide supplementary information of an entity mentioned within or background knowledge of an input sequence. The task-specific knowledge is a pre-built index that is domain-relevant and acts as an exemplary information source for guiding text generation. It can be flexibly adjusted according to different tasks or domains, e.g., context-response pairs in dialogue generation or passage-question pairs in question generation. Inspired by the success of dense retrieval methods for the task of open-domain question answering (Lee et al., 2019; Guu et al., 2020; Karpukhin et al., 2020), we use pre-trained encoders to convert input texts and knowledge entries into dense representation vectors and employ fast maximum inner-product search (MIPS) (Shrivastava and Li, 2014) to complete the retrieval, so as to ensure effectiveness and efficiency of knowledge selection. Finally, these two types of knowledge are injected into source text encoding and target text decoding stages respectively. By this means, our model can learn how and what to generate in a unified framework with the help of two types of knowledge. + +To measure the effectiveness of our proposed framework, we evaluate it on the tasks of dialogue generation and question generation, which are both important research issues of text generation. Experimental results show that our proposed method outperforms the GPT-2 (Radford et al., 2019) and BART (Lewis et al., 2020a) baseline models, and can generate more informative texts including entities that do not appear in the input texts. + +In summary, our contributions in this paper are three-fold: (1) A proposal of a general and unified text generation framework named TEGTOK that incorporates both task-specific and world knowledge through dense retrieval. (2) The proposed framework is verified on two text generation tasks. + +# 2 Related Work + +Knowledge-enhanced Text Generation. As knowledge can help to understand the input text and its surrounding context, many previous + +studies explored the leverage of knowledge bases (Speer and Havasi, 2012; Speer et al., 2017; Koncel-Kedziorski et al., 2019; Liu et al., 2021) or unstructured texts (Zhang et al., 2018; Zhou et al., 2018c; Dinan et al., 2019; Lewis et al., 2020b) for the text generation task, and they have demonstrated promising performance on generating informative and coherent texts. To incorporate unstructured knowledge from the web, retrieval-augmented text generation (Lewis et al., 2020b) has been widely explored. Besides, researchers also introduced the paradigm of retrieve-and-edit (Hashimoto et al., 2018; Wu et al., 2019; Ren et al., 2020) or exemplar-based decoding (Peng et al., 2019; Gupta et al., 2020) to enhance the generation processes with similar input-output pairs come from the specific task. More related works about knowledge-enhanced text generation can be referred to Yu et al. (2020b). + +Dialogue Generation. The generation-based dialogue models synthesize a response with a NLG model by maximizing its generation probability given the previous conversation context. The pioneer researchers formulated the dialogue generation task as a sequence-to-sequence translation problem (Shang et al., 2015; Sordoni et al., 2015; Vinyals and Le, 2015; Serban et al., 2016, 2017) where encoder is designed for dialogue context modeling, and decoder is constructed to conduct the target response prediction. Expanded from the general dialogue generation problem, more interesting and challenging tasks relying on external knowledge have been explored to improve the anthropomorphic characteristic of dialogue systems. A line of work introduced personalized information into dialogue generation to help deliver better dialogue response such as emotion (Li and Sun, 2018; Zhou et al., 2018a; Song et al., 2019) and persona (Zhang et al., 2018; Zheng et al., 2020). In addition, to further enhance and enrich the response generation, researchers have studied grounding dialogue generation on knowledge graphs (Zhou et al., 2018b; Moon et al., 2019) or unstructured documents (Dinan et al., 2019; Zhang et al., 2018; Zhou et al., 2018c; Santhanam et al., 2020; Tan et al., 2021). + +Question Generation. This task aims at generating a question from a given passage (Du et al., 2017) in an answer-aware or answer-unaware manner. In this paper, we work on the answer-unaware setting, encouraging diversity of generated + +questions. Researchers have explored statistical keyword extraction techniques to select salient words from input documents, and then incorporated the extracted keywords into question generation (Cho et al., 2019; Wang et al., 2020). Recent work has applied reinforcement learning to natural question generation (Chen et al., 2020). + +Different from previous text generation models that either incorporate unstructured Wikipedia knowledge or enhance the generation with exemplar cases, to the best of our knowledge, this paper makes the first attempt to retrieve and exploit both the task-specific and world knowledge for text generation in a unified framework. Our knowledge retrieval process is conducted through dense representations which can help to capture deep and latent semantics. + +# 3 Method Formulation + +The task of text generation is to output an appropriate target text given a source text as input. Given a dataset $\mathcal{D}$ , an example is represented as $(s, t)$ . Specifically, $s$ represents a source text and $t$ represents a target text. A source text is used as a query to retrieve task-specific and world knowledge. Technically, the retrieved task-specific and world knowledge entries can be treated as two latent variables $z_{1}$ and $z_{2}$ respectively that are marginalized to get the Seq2Seq probability $p(t|s)$ via a top- $m$ approximation as + +$$ +\begin{array}{l} p (t | s) = \sum_ {z _ {1}, z _ {2}} p _ {1} (z _ {1} | s) p _ {2} (z _ {2} | s) p _ {\theta} (t | s, z _ {1}, z _ {2}) \\ = \sum_ {z _ {1}, z _ {2}} p _ {1} \left(z _ {1} | s\right) p _ {2} \left(z _ {2} | s\right) \prod_ {t = 1} ^ {| y |} p _ {\theta} \left(t _ {j} | s, z _ {1}, z _ {2}, t _ {< j}\right), \tag {1} \\ \end{array} +$$ + +where $z_{1}\in \mathrm{top - }m(p_{1}(\cdot |s))$ $z_{2}\in \mathrm{top - }m(p_{2}(\cdot |s))$ $t_j$ and $t_{< j}$ stand for the $j$ -th token and the first $(j - 1)$ tokens of a target text $t$ respectively, $|t|$ is the length of $t$ , and the target text tokens are generated in an auto-regressive way. $p_1(\cdot |s)$ and $p_2(\cdot |s)$ are modeled with the retrieval probability that will be introduced in Eq. (2). + +# 4 TEGTok Model + +Figure 1 shows the overview architecture of TEGTOK which consists of a retriever and a generator. The retriever uses the input source text as a query to retrieve the world knowledge and task-specific knowledge, the former of which is concatenated with the source text as additional + +background knowledge and the latter is fed into the decoder as exemplary information to guide the target text decoding. Details about each component are provided in the following subsections. + +# 4.1 Knowledge Retriever + +As shown in Figure 1(a), given a collection of a large number of knowledge entries $(k_{i}^{\alpha})$ , the goal of the retriever is to index all knowledge entries in a low-dimensional and continuous space, so that it can retrieve efficiently the top- $m$ knowledge entries relevant to the input source text. Here, $\alpha \in \{\text{world knowledge } (W), \text{ task-specific knowledge } (T)\}$ . Inspired by the dense passage retrieval (DPR) (Karpukhin et al., 2020), we adopt a bi-encoder architecture to derive the dense representations of the source text and each knowledge entry. Specifically, two independent pre-trained language models (i.e., BERT (Devlin et al., 2019)), $E_{S}^{\alpha}(\cdot)$ and $E_{K}^{\alpha}(\cdot)$ are employed as the encoders for the source text and the knowledge entry respectively. Furthermore, the representation of the [CLS] token is output as the dense representation. At retrieval-time, the retriever first maps the input source text to a vector, and then retrieves knowledge entries of which vectors are the closest to the source text vector. The similarity $s(s, k_{i}^{\alpha})$ between the source text $s$ and each knowledge entry $k_{i}^{\alpha}$ is defined using the dot product of their vectors as + +$$ +s (s, k _ {i} ^ {\alpha}) = E _ {S} ^ {\alpha} (s) ^ {\top} \cdot E _ {K} ^ {\alpha} \left(k _ {i} ^ {\alpha}\right), i \in \{1, 2, \dots \}. \tag {2} +$$ + +Due to the significant difference between the two types of knowledge, we employ two independent retrievers for these two knowledge indexes. + +World Knowledge Retriever World knowledge usually covers a wide variety of domains and has been proven effective in improving informativeness of the generated texts through providing the relevant background knowledge in open-domain text generation (Dinan et al., 2019; Zhao et al., 2020). Motivated by the success of open-domain question answering (QA) (Guu et al., 2020; Karpukhin et al., 2020; Lee et al., 2019), we assume the openworld knowledge as documents from the Wikipedia dump. Specifically, we adopt the Wikipedia dump provided in open-domain QA tasks as our open-world knowledge which is composed of over 21 millions of passages segmented from the Wikipedia pages. The goal of this retriever is to retrieve a small number of documents relevant + +![](images/d0ee542ea37a5bd900229083c49b5ffcfacaf2945d39b9f50ffeb3ec07b5246e.jpg) +Figure 1: The overview architecture of our proposed TEGTOK model which consists of (a) a retriever and (b) a generator. Here, $E_{\beta}^{\alpha}(\cdot)$ denotes the dense representation of an input sequence, where $\alpha \in \{ \text{world knowledge } (W), \text{ task-specific knowledge } (T) \}$ and $\beta \in \{ \text{source text } (S), \text{ knowledge } (K) \}$ . + +to the given source text. Meanwhile, we use the DPR model which is a pre-trained bi-encoder released by Karpukhin et al. (2020) as the world knowledge retriever in our paper, since it has achieved great performance on various knowledge-intensive tasks. $^{1}$ The retrieved top-1 Wikipedia document $(k^{W})$ is employed for augmenting source text which will be described in Section 4.2. + +Task-specific Knowledge Retriever In addition to the world knowledge, it would also be desirable to obtain the relevant task-specific knowledge to guide the text generation process, since open-domain texts are often grounded by more than one single type of knowledge perception. These related task-specific examples from a pre-built index can also bring additional information associated with the given source messages and provide exemplary information for guiding the target text decoding. + +Formally, given a training example represented as $(s,t^{+},t_{1}^{-},\dots,t_{n}^{-})$ , where each instance contains one source text $s$ and one matched (positive) target text $t^{+}$ , along with $n$ mismatched (negative) distractors $t_i^-$ that are randomly sampled from the whole corpus, we can define the training objective function of the task-specific knowledge retriever as + +$$ +\begin{array}{l} L (s, t ^ {+}, t _ {1} ^ {-}, \dots , t _ {n} ^ {-}) \\ = - \log \frac {e ^ {s (s , t ^ {+})}}{e ^ {s (s , t ^ {+})} + \sum_ {i = 1} ^ {n} e ^ {s (s , t _ {i} ^ {-})}}. \tag {3} \\ \end{array} +$$ + +At testing time, the model retrieves the top- $m$ knowledge entries $(k^T)$ with the highest similarities calculated by Eq. (2). + +# 4.2 Generator + +It is based on the pre-trained Transformer-based encoder-decoder architecture, BART (Vaswani et al., 2017). To incorporate both types of knowl + +edge during the source text encoding and the target text decoding stages respectively, we make several modifications as follows. + +Augmented Source Text Encoder In order to incorporate the world knowledge into the source text encoding stage, we concatenate the source text with the retrieved world knowledge entry. Formally, the input sequence is organized as $\{[\mathrm{BOS}],k_1^W,\dots,k_{l_kW}^W[\mathrm{EOS}],s_1,\dots,s_{l_s},[\mathrm{EOS}]\}$ , where [BOS] and [EOS] denote begin-of-sentence and end-of-sentence, $k_{1}^{W},\dots,k_{l_{k}W}^{W}$ and $s_1,\ldots ,s_{l_s}$ denote the knowledge and source text tokens, and $l_{kW}$ and $l_{s}$ denote the token numbers of knowledge and source text respectively. Then the input sequence is fed into the stacked attention layers (Vaswani et al., 2017; Lewis et al., 2020a) by employing itself as query, key and value as + +$$ +\mathbf {S} ^ {l + 1} = \operatorname {A T T E N L A Y E R} \left(\mathbf {S} ^ {l}\right), \tag {4} +$$ + +where $l \in \{0, \dots, L - 1\}$ and each ATTENLAYER includes operations of a self-attention layer and a feed forward layer, both of which are followed by a residual connection and a layer normalization. $\mathbf{S}^l \in \mathbb{R}^{(l_kW + l_s + 3) \times d}$ denotes the representation of the concatenated source text and world knowledge at the $l$ -th encoder layer, and $d$ denotes the dimension of the embedding vector. The outputs of each encoder layer are utilized as the inputs of the next encoder layer. In each layer of encoding, the world knowledge serves as additional background and fully interacts with the source text to incorporate the relevant information into their representations through multi-head attention operations. After stacked layers of encoding, it can help to better understand the source text and return the contextualized representations, which will be further used during the decoding stage. + +Task-specific Knowledge Encoder Different from the BERT-based encoding in Section 4.1 for retrieval, another encoder that is a component of the generator, is designed to encode the task-specific knowledge to derive its contextualized representations for generation. Formally, each of the retrieved top- $m$ task-specific knowledge entries is organized as $\{[\mathrm{BOS}], k_{i,1}^{T}, \ldots, k_{i,l_{i}^{T}}, [\mathrm{EOS}]\}$ , $i \in \{1, \ldots, m\}$ . Then the input sequence is fed into another encoder + +that does not share parameters with the augmented source text encoder. Finally, we denote $\mathbf{K}_i^{\tilde{T},l}$ as the representation of the $i$ -th task-specific knowledge at the $l$ -th encoder layer. + +Task-specific Knowledge Re-ranking Since the target text cannot be foreseen at testing time, a latent variable model (Zhao et al., 2017; Lian et al., 2019; Kim et al., 2020) is introduced to select the target text by treating it as the posterior information. However, it is inefficient to calculate the prior and posterior probabilities in a large-scale dataset. Therefore, a task-specific knowledge re-ranking is designed for the top- $m$ knowledge entries output by the knowledge retriever. In general, to further calculate the similarity between each task-specific knowledge and the target text at a fine granularity, the target text is used for re-ranking the set of retrieved task-specific knowledge entries. The target text is encoded to acquire its representation, and then combined with the representation of the augmented source text to get the posterior representation, followed by a linear transformation as + +$$ +\mathbf {c} (s, t) = \mathbf {W} _ {c} \left[ \mathbf {s} _ {[ B O S ]} ^ {L}; \mathbf {t} _ {[ B O S ]} ^ {L ^ {\prime}} \right] + \mathbf {b} _ {c}, \tag {5} +$$ + +where $\mathbf{s}_{[BOS]}^{L}$ and $\mathbf{t}_{[BOS]}^{L^{\prime}}$ denote the outputs of the augmented source encoder and the target encoder corresponding to the [BOS] token, $\mathbf{W}_c$ and $\mathbf{b}_c$ are parameters updated during training. The similarity between this representation and the representation of each task-specific knowledge entry is calculated to obtain the probability distribution of re-ranking, + +$$ +q _ {\phi} \left(k _ {i} ^ {T} | s, t\right) = \operatorname {s o f t m a x} \left(\mathbf {c} (s, t) \cdot \mathbf {k} _ {i, [ B O S ]} ^ {T, L}\right), \tag {6} +$$ + +for $i \in \{1, \dots, m\}$ . In order to accommodate the situation where the target text is not available when testing, the prior probability is calculated as + +$$ +p _ {\theta} \left(k _ {i} ^ {T} \mid s\right) = \operatorname {s o f t m a x} \left(\mathbf {s} _ {[ \mathrm {B O S} ]} ^ {L} \cdot \mathbf {k} _ {i, [ \mathrm {B O S} ]} ^ {T, L}\right), \tag {7} +$$ + +for $i\in \{1,\dots,m\}$ .Finally, two probability distributions of $q_{\phi}(\pmb{k}^{T}|s,t)$ and $p_{\theta}(\pmb{k}^{T}|s)$ are approximated in a way optimizing KL divergence as + +$$ +\mathcal {L} _ {k l} = \mathbb {E} _ {q _ {\phi} (\boldsymbol {k} ^ {T} | s, t)} \log \frac {q _ {\phi} (\boldsymbol {k} ^ {T} | s , t)}{p _ {\theta} (\boldsymbol {k} ^ {T} | s)}. \tag {8} +$$ + +The bag-of-words (BOW) loss (Zhao et al., 2017) is introduced to facilitate the training process as + +$$ +\mathcal {L} _ {b o w} = - \mathbb {E} _ {k ^ {T} \sim q _ {\phi} (\boldsymbol {k} ^ {T} | s, t)} \sum_ {j = 1} ^ {l _ {t}} \log p (t _ {j} | k ^ {T}), \tag {9} +$$ + +where $p(t_j|k^T)$ denotes the estimated probability of word $t_j$ calculated by + +$$ +p (\cdot | k ^ {T}) = \mathrm {s o f t m a x} (\mathbf {W} _ {\mathrm {b o w}} \mathbf {k} _ {[ \mathrm {B O S} ]} ^ {T, L} + \mathbf {b} _ {\mathrm {b o w}}), (1 0) +$$ + +where $\mathbf{k}_{[BOS]}^{T,L}$ denote the outputs of the knowledge encoder corresponding to the [BOS] token of the selected knowledge, $\mathbf{W}_{bow}$ and $\mathbf{b}_{bow}$ are parameters updated during training. + +Decoder In order to inject all the encoded information of the source text, the world knowledge and the task-specific knowledge to guide the target text decoding, two additional sub-layers are inserted into each decoder layer, which perform cross-attention over the output of the last layer of the two encoders. Particularly, after a sub-layer of masked self-attention where each token cannot attend to future tokens to avoid information leakage, the target text first attends to the output of the task-specific knowledge encoder and then attends to the output of the augmented source text encoder. Mathematically, we have + +$$ +\begin{array}{l} \bar {\mathbf {T}} ^ {l} = \operatorname {L N} \left(\mathbf {T} ^ {l} + \operatorname {S E L F A T T E N} (\mathbf {T} ^ {l})\right), \\ \tilde {\mathbf {T}} ^ {l} = \operatorname {L N} \left(\bar {\mathbf {T}} ^ {l} + \operatorname {C r o s s A T T E N} (\bar {\mathbf {T}} ^ {l}, \mathbf {K} ^ {T, L})\right), \\ \hat {\mathbf {T}} ^ {l} = \operatorname {L N} \left(\tilde {\mathbf {T}} ^ {l} + \operatorname {C R O S S A T T E N} \left(\tilde {\mathbf {T}} ^ {l}, \mathbf {S} ^ {L}\right)\right), \\ \mathbf {T} ^ {l + 1} = \operatorname {L N} \left(\hat {\mathbf {T}} ^ {l} + \text {F E E D F O R W A R D} \left(\hat {\mathbf {T}} ^ {l}\right)\right), \tag {11} \\ \end{array} +$$ + +where $l \in \{0, \dots, L - 1\}$ , LN denotes the operation of layer normalization, $\mathbf{T}^l$ denotes the representation of the target text at the $l$ -th decoder layer, $\bar{\mathbf{T}}^l$ , $\tilde{\mathbf{T}}^l$ and $\hat{\mathbf{T}}^l$ are intermediate representations after each operation. In this way, the model can first learn how to generate and consider the retrieved task-specific knowledge as exemplary information. The model can further learn what to say according to the retrieved world knowledge that is used to augment the source text and enrich the exemplary information. + +# 4.3 Learning + +Given the representation of each target text token at the last decoder layer $\mathbf{T}^L = \{\mathbf{t}_j\}_{j=1}^{l_t}$ where $\mathbf{t}_j \in \mathbb{R}^d$ , the probability distribution over the whole vocabulary of each target text token $\mathbf{p}_{t_j}$ can be calculated via a non-linear transformation. The learning objective of this task is to minimize the + +negative log-likelihood loss as + +$$ +\mathcal {L} _ {\text {g e n}} = - \mathbb {E} _ {k ^ {T} \sim q _ {\phi} (\boldsymbol {k} ^ {T} | s, t)} \sum_ {j = 1} ^ {l _ {t}} \log p (t _ {j} | s, t _ {< j}, k ^ {T}). \tag {12} +$$ + +Finally, the parameters of our model are optimized by performing multi-task learning by minimizing the sum of all loss functions as + +$$ +\mathcal {L} _ {\text {t o t a l}} = \mathcal {L} _ {\text {g e n}} + \mathcal {L} _ {\text {k l}} + \mathcal {L} _ {\text {b o w}}. \tag {13} +$$ + +# 5 Experiments + +We evaluated the proposed method on the tasks of dialogue generation and question generation. + +# 5.1 Knowledge and Datasets + +World Knowledge Index. For the world knowledge, all tasks and datasets shared the same English Wikipedia dump from Dec. 20, 2018 provided by Lee et al. (2019). Each Wikipedia article was split into disjoint 100-word chunks to make a total of 21M documents. Each passage was also prepended with its title, along with an [SEP] token. + +Reddit Dataset for Dialogue Generation. To construct the task-specific knowledge index for this dataset, the Reddit dialogue corpus collected by Zhou et al. (2018b) was used. 3 millions responses were randomly sampled from the training set of the Reddit dataset. After excluding the samples used for constructing the task-specific knowledge index, the remaining dataset composed of $38.4\mathrm{k} / 10\mathrm{k} / 20\mathrm{k}$ context-response pairs in the training/validation/testing sets respectively, was employed to train a generator and to evaluate the performance of our framework. Thus, there is no data overlap between that for the task-specific knowledge index and that for learning a generator. + +SQuAD Dataset for Question Generation. Similarly, 45k randomly selected sentence-question pairs from the training set of the SQuAD Dataset processed by Du et al. (2017) were used to construct the task-specific knowledge index for this dataset. Also, the remaining dataset composed of $25.5\mathrm{k} / 10.5\mathrm{k} / 11.9\mathrm{k}$ sentence-question pairs in the training/validation/testing sets respectively, was employed to train the generator. + +# 5.2 Baseline Models + +The following models were selected as the baseline models: (1) RNN (Sutskever et al., 2014) is a + +
Metrics +ModelsBLEU-1BLEU-2METEORROUGE_LAverageGreedyExtrema
RNN (Sutskever et al., 2014)7.362.947.2810.030.65912.05850.3331
CVAE (Zhao et al., 2017)7.452.857.349.680.66422.08530.3357
Transformer (Vaswani et al., 2017)7.973.147.9210.510.66932.07030.3334
GPT-2 (Radford et al., 2019)8.433.048.3310.650.64842.06010.3303
DialoGPT (Zhang et al., 2020)7.583.027.8510.820.59762.07740.3185
BART (Lewis et al., 2020a)9.243.389.0310.930.66112.09860.3355
TEGTOK9.713.639.5311.360.65222.16830.3362
TEGTOK w/o. WK9.523.589.4411.320.64902.16470.3361
TEGTOK w/o. TK9.353.399.0611.020.66442.09680.3371
+ +Table 1: Performance of our method and previous methods on the test set of Reddit dataset for dialogue generation (Zhou et al., 2018b) in terms of the automated evaluation metrics. Numbers in bold denote that the improvement over the best performing baseline is statistically significant (t-test with $p$ -value $< 0.05$ ). WK and TK denote world knowledge and task-specific knowledge respectively. + +
Metrics +ModelsBLEU-1BLEU-2BLEU-3BLEU-4METEORROUGE_L
Vanilla seq2seq (Sutskever et al., 2014)31.3413.797.364.269.8829.75
H&S (Du et al., 2017)38.5022.8015.5211.1815.9530.98
NQG (Du et al., 2017)43.0925.9617.5012.2816.6239.75
BART (Lewis et al., 2020a)45.1629.4521.3316.0919.7043.44
TEGTOK46.5730.6422.2816.7520.3743.63
TEGTOK w/o. WK46.2530.2921.9416.4920.1043.43
TEGTOK w/o. TK45.6330.0221.8816.5619.7943.61
+ +Table 2: Performance of our method and previous methods on the test set of SQuAD dataset for question generation (Du et al., 2017) in terms of the automated evaluation metrics. + +
Models\AspectsRel.Flu.Inform.Kappa
Human1.401.641.470.62
Transformer0.861.070.710.42
GPT-21.091.200.840.43
BART1.361.481.140.47
TEGtok1.441.511.230.46
+ +Table 3: Human evaluation results of TEGTOK on a randomly sampled test set of the Reddit dataset. Here, Rel., Flu., and Inform. indicates relevance, fluency, and informativeness respectively. + +LSTM-based sequence-to-sequence model with attention mechanism. (2) CVAE (Zhao et al., 2017) uses latent variables to learn a distribution over potential conversation contexts based on conditional variational autoencoders. (3) Transformer (Vaswani et al., 2017) uses the self-attention mechanism to build the encoder and the decoder, which has shown better performance than RNN-based Seq2Seq models in many natural language processing tasks. (4) GPT-2 (Radford et al., 2019) is a uni-directional pre-trained language model that + +has shown great performance on a lot of natural language generation tasks. Following its original concatenation operation, the context and the response were concatenated with a special [SEP] token as input for encoding. (5) DialoGPT (Zhang et al., 2020) has the same architecture with GPT-2 but is trained with Reddit discussions Datasets. (6) BART (Lewis et al., 2020a) is a denoising autoencoder using a standard Tranformer-based neural machine translation architecture for pretraining the sequence-to-sequence models. BART is trained by corrupting text with an arbitrary noising function to reconstruct the original text. + +# 5.3 Evaluation Metrics + +To ensure all experimental results were comparable, the automated and human evaluation metrics popular used in previous work were adopted in this paper. BLEU, METEOR, ROUGE $_L$ and three embedding-based metrics including Embedding Average, Greedy Matching and Extrema Score used in Forgues et al. (2014) which can cover the weaknesses of BLEU were employed as the automated metrics. Human evaluation was also + +conducted to measure the quality of the generated responses of models in terms of three independent aspects: 1) relevance (Rel.), 2) fluency (Flu.) and 3) informativeness (Inform.). Each judge was asked to give three scores for a response, each of which was ranged from 0 to 2. + +# 5.4 Training Details + +Model parameters were initialized with pre-trained weights of bart-base released by Wolf et al. (2020). The word embedding table was shared between the encoder and decoder. The AdamW method (Loshchilov and Hutter, 2019) was employed for optimization. The learning rate was initialized as $6.25e-5$ and was decayed linearly down to 0. The max gradient norm was clipped down to 1.0. The batch size was set to 64. The maximum length of the concatenation of open-domain knowledge and context was set to 128. The maximum length of the task-specific knowledge was set to 128. The number of task-specific knowledge entries was set to 3, achieving the best performance out of $\{1, 2, 3, 4, 5\}$ on the validation set. The strategy of greedy search was performed for decoding. The maximum length of response to generate was also set to 50. All experiments were run on a single A100 GPU. The maximum number of epochs was set to 15. The validation set was used to select the best model for testing. All code was implemented in the PyTorch framework3 and are published to help replicate our results.4 + +# 5.5 Evaluation Results + +Automated Evaluation Table 1 and Table 2 present the evaluation results of our method and previous methods on the test sets of the Reddit dataset for dialogue generation and the SQuAD dataset for question generation respectively. Each model ran four times with identical architectures and different random initializations, and the best out of them was reported. The results show that our method outperformed all baseline models in terms of all metrics. Specifically, TEGTOK outperformed GPT-2 by $1.28\%$ BLEU-1 and $1.20\%$ METEOR, outperformed DialoGPT by $2.13\%$ BLEU-1 and $1.68\%$ METEOR, and outperformed BART by $0.47\%$ BLEU-1 and $0.50\%$ METEOR on the Reddit dataset. Meanwhile, TEGTOK outperformed BART by $1.41\%$ BLEU-1 and $0.67\%$ METEOR on the + +SQuAD dataset, illustrating the effectiveness of incorporating both two types of knowledge. + +To further verify the effectiveness of each component in our proposed methods, ablation tests were conducted as shown in the last two rows of Table 1 and Table 2. First, the world knowledge was ablated and the results show that BLEU-1 and METEOR dropped down by $0.27\%$ and $0.26\%$ respectively on the Reddit dataset, along with $0.32\%$ and $0.27\%$ respectively on the SQuAD dataset, illustrating the effectiveness of retrieving world knowledge for text generation. On the other hand, the task-specific knowledge was ablated and only the world knowledge can be attended to during the decoding stage. The results show that BLEU-1 and METEOR dropped down by $0.24\%$ and $0.34\%$ respectively on the Reddit dataset, along with $0.94\%$ and $0.58\%$ respectively on the SQuAD dataset, illustrating the effectiveness of attending to task-specific knowledge during the decoding stage. + +Human Evaluation Table 3 presents the human evaluation results on a randomly sampled test set of the Reddit dataset. 100 samples were evaluated and the order of evaluation systems were shuffled. Three judges were asked to score from 0 to 2 (2 for the best) for each human evaluation aspect and the average scores were reported. The Fleiss's kappa value (Fleiss, 1971) for each model was also reported, indicating the inter-judge moderate agreement during evaluation. In general, the results show that our method outperformed all baseline models, showing that it can generate more natural responses. Particularly, compared with BART, our method achieves the greatest improvement in terms of informativeness, illustrating the effectiveness of incorporating the task-specific and world knowledge for improving informativeness of generated texts. + +# 5.6 Case Study + +Case studies were conducted by randomly sampling an instance from the Reddit dataset in dialogue generation and an instance from the SQuAD dataset in question generation as shown in Table 4. Given the conversation context (or the passage of a question), it was used as a query to retrieve the task-specific and world knowledge in the upper block of a single case in Table 4. For case 1, as we can see that, there was no text overlap between the second task-specific knowledge entry and the conversation context, but it can be retrieved + +# Case 1 + +Context: whatever happened to al Qaeda? + +WK: Al-Qaeda operates as a network of Islamic extremists and Salafist terrorists. The organization has been designated as a terrorist group by the United Nations Security Council, ... The Taliban provided a safe haven for Osama bin Laden and al-Qaeda officials, allowing them to plot major terrorist attacks such as the September 11 attacks (9/11). ... + +TK: isis first iteration was al - qaed in iraq. + +Transformer: i 'm not sure what you 're talking about , but i 'm not sure if you 're referring to what you 're talking about. + +GPT-2: i think he was a member of the al Qaeda branch. + +DiaGPT: they're still around. + +BART: i'm not sure. i'm sure the media is talking about the death of the leader of the country. + +TEGTOK: they're a terrorist organization in iraq plot major attacks. + +# Case 2 + +Passage: in late summer he was invited by jane stirling to visit scotland, where he stayed at calder house near edinburgh and at johnstone castle in renfrewshire, both owned by members of stirling's family. + +WK: ... After this, in 1860 Stirling returned to Edinburgh - his address there was 4 Laverock Bank Road, Trinity, Edinburgh - which then became his permanent residence until ... + +TK: where did victoria and her family retreat to safety during a conflict in 1848? + +BART: where was johnstone castle? + +TEGTOK: where did stirling stay in the summer of 1860? + +Table 4: Generation results of two cases from the Reddit and SQuAD datasets respectively. We kept original texts without manual corrections. WK and TK denote world knowledge and task-specific knowledge respectively. Words in the same color are related. + +through semantic relevance, which shows the effectiveness of using dense representations for knowledge retrieval. Since the given context is short and contains few informative words, it is difficult for models to generate informative responses without any external knowledge, such as the generic response generated by the Transformer model. Furthermore, our generated response can capture the relevant and important information from the retrieved knowledge, such as “terrorist” from the world knowledge and “in iraq” from the task-specific knowledge, making the generated response more informative and illustrating the effectiveness of incorporating these two types of knowledge for dialogue generation. For case 2, we can see that there was little text overlap between the world knowledge and the passage, but it could be retrieved through semantic relevance, showing the effectiveness of using dense representations for knowledge retrieval. Our generated text can capture the relevant and important information from the retrieved world knowledge, such as “1860” and “Stirling” from the world knowledge, making the generated text more informative. Furthermore, since the given passage mainly focuses on narrative descriptions, it is difficult for models to generate exemplar texts without any external knowledge, such as the “where did ... in” question template retrieved from the task-specific knowledge index. Again, these results illustrated the effectiveness of + +incorporating these two types of knowledge for question generation. + +# 6 Conclusion + +In this paper, we study retrieving relevant external knowledge for enhancing text generation. Two types of knowledge, i.e., task-specific and world knowledge, are retrieved using dense representations to ensure effectiveness and efficiency of knowledge selection, and are further incorporated into the input encoding and output decoding stages respectively, providing the supplementary information to guide text generation. Experimental results on two tasks of dialogue generation and question generation show that our method achieves better performance than baseline models and can generate more informative texts. In the future, we will explore applying this framework to more text generation tasks and other modalities such as image caption, to further verify its effectiveness and generalization. + +# Acknowledgements + +We thank anonymous reviewers for their valuable comments. + +# References + +Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. 2015. Neural machine translation by jointly + +learning to align and translate. In 3rd International Conference on Learning Representations, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings. +Ana Berdasco, Gustavo López, Ignacio Díaz-Oreiro, Luis Quesada, and Luis A. Guerrero. 2019. User experience comparison of intelligent personal assistants: Alexa, google assistant, siri and cortana. In 13th International Conference on Ubiquitous Computing and Ambient Intelligence, UCAmI 2019, Toledo, Spain, December 2-5, 2019, volume 31 of MDPI Proceedings, page 51. MDPI. +Tom B. Brown, Benjamin Mann, Nick Ryder, et al. 2020. Language models are few-shot learners. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual. +Yu Chen, Lingfei Wu, and Mohammed J. Zaki. 2020. Reinforcement learning based graph-to-sequence model for natural question generation. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net. +Jaemin Cho, Min Joon Seo, and Hannaneh Hajishirzi. 2019. Mixture content selection for diverse sequence generation. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing, EMNLP-IJCNLP 2019, Hong Kong, China, November 3-7, 2019, pages 3119-3129. Association for Computational Linguistics. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, NAACL-HLT 2019, Minneapolis, MN, USA, June 2-7, 2019, Volume 1 (Long and Short Papers), pages 4171-4186. +Emily Dinan, Stephen Roller, Kurt Shuster, Angela Fan, Michael Auli, and Jason Weston. 2019. Wizard of wikipedia: Knowledge-powered conversational agents. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net. +Xinya Du, Junru Shao, and Claire Cardie. 2017. Learning to ask: Neural question generation for reading comprehension. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, ACL 2017, Vancouver, Canada, July 30 - August 4, Volume 1: Long Papers, pages 1342-1352. Association for Computational Linguistics. +Joseph L Fleiss. 1971. Measuring nominal scale agreement among many raters. Psychological bulletin, 76(5):378-382. + +Gabriel Forgues, Joelle Pineau, Jean-Marie Larchevéque, and Réal Tremblay. 2014. Bootstrapping dialog systems with word embeddings. In Nips, modern machine learning and natural language processing workshop, volume 2, page 168. +Sebastian Gehrmann, Tosin P. Adewumi, Karmanya Aggarwal, Pawan Sasanka Ammanamanchi, et al. 2021. The GEM benchmark: Natural language generation, its evaluation and metrics. CoRR, abs/2102.01672. +Prakhar Gupta, Jeffrey P Bigham, Yulia Tsvetkov, and Amy Pavel. 2020. Controlling dialogue generation with semantic exemplars. arXiv preprint arXiv:2008.09075. +Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Ming-Wei Chang. 2020. Retrieval augmented language model pre-training. In Proceedings of the 37th International Conference on Machine Learning, ICML 2020, 13-18 July 2020, Virtual Event, volume 119 of Proceedings of Machine Learning Research, pages 3929-3938. PMLR. +Tatsunori B. Hashimoto, Kelvin Guu, Yonatan Oren, and Percy Liang. 2018. A retrieve-and-edit framework for predicting structured outputs. In Advances in Neural Information Processing Systems 31: Annual Conference on Neural Information Processing Systems 2018, NeurIPS 2018, December 3-8, 2018, Montreal, Canada, pages 10073-10083. +Vladimir Karpukhin, Barlas Oguz, Sewon Min, Patrick S. H. Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih. 2020. Dense passage retrieval for open-domain question answering. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing, EMNLP 2020, Online, November 16-20, 2020, pages 6769-6781. Association for Computational Linguistics. +Veton Kepuska and Gamal Bohouta. 2018. Next-generation of virtual personal assistants (microsoft cortana, apple siri, amazon alexa and google home). In IEEE 8th Annual Computing and Communication Workshop and Conference, CCWC 2018, Las Vegas, NV, USA, January 8-10, 2018, pages 99-103. IEEE. +Byeongchang Kim, Jaewoo Ahn, and Gunhee Kim. 2020. Sequential latent knowledge selection for knowledge-grounded dialogue. arXiv preprint arXiv:2002.07510. +Rik Koncel-Kedziorski, Dhanush Bekal, Yi Luan, Mirella Lapata, and Hannaneh Hajishirzi. 2019. Text Generation from Knowledge Graphs with Graph Transformers. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 2284-2293, Minneapolis, Minnesota. Association for Computational Linguistics. + +Kenton Lee, Ming-Wei Chang, and Kristina Toutanova. 2019. Latent retrieval for weakly supervised open domain question answering. In Proceedings of the 57th Conference of the Association for Computational Linguistics, ACL 2019, Florence, Italy, July 28-August 2, 2019, Volume 1: Long Papers, pages 6086-6096. Association for Computational Linguistics. +Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. 2020a. BART: denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, ACL 2020, Online, July 5-10, 2020, pages 7871-7880. Association for Computational Linguistics. +Patrick S. H. Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Küttler, Mike Lewis, Wen-tau Yih, Tim Rocktäschel, Sebastian Riedel, and Douwe Kiela. 2020b. Retrieval-augmented generation for knowledge-intensive NLP tasks. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual. +Jingyuan Li and Xiao Sun. 2018. A syntactically constrained bidirectional-asynchronous approach for emotional conversation generation. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, Brussels, Belgium, October 31 - November 4, 2018, pages 678-683. Association for Computational Linguistics. +Rongzhong Lian, Min Xie, Fan Wang, Jinhua Peng, and Hua Wu. 2019. Learning to select knowledge for response generation in dialog systems. In Proceedings of the Twenty-Eighth International Joint Conference on Artificial Intelligence, IJCAI 2019, Macao, China, August 10-16, 2019, pages 5081-5087. ijcai.org. +Ye Liu, Yao Wan, Lifang He, Hao Peng, and Philip S Yu. 2021. Kg-bart: Knowledge graph-augmented bart for generative commonsense reasoning. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pages 6418-6425. +Ilya Loshchilov and Frank Hutter. 2019. Decoupled weight decay regularization. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net. +Seungwhan Moon, Pararth Shah, Anuj Kumar, and Rajen Subba. 2019. Opendialkg: Explanable conversational reasoning with attention-based walks over knowledge graphs. In Proceedings of the 57th Conference of the Association for Computational Linguistics, ACL 2019, Florence, Italy, July 28-August 2, 2019, Volume 1: Long Papers, pages 845-854. Association for Computational Linguistics. + +Hao Peng, Ankur P. Parikh, Manaal Faruqui, Bhuwan Dhingra, and Dipanjan Das. 2019. Text generation with exemplar-based adaptive decoding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, NAACL-HLT 2019, Minneapolis, MN, USA, June 2-7, 2019, Volume 1 (Long and Short Papers), pages 2555-2565. Association for Computational Linguistics. +Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9. +Shuo Ren, Yu Wu, Shujie Liu, Ming Zhou, and Shuai Ma. 2020. A retrieve-and-rewrite initialization method for unsupervised machine translation. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 3498-3504. +Sashank Santhanam, Wei Ping, Raul Puri, Mohammad Shoeybi, Mostofa Patwary, and Bryan Catanzaro. 2020. Local knowledge powered conversational agents. CoRR, abs/2010.10150. +Iulian Vlad Serban, Alessandro Sordoni, Yoshua Bengio, Aaron C. Courville, and Joelle Pineau. 2016. Building end-to-end dialogue systems using generative hierarchical neural network models. In Proceedings of the Thirtieth AAAI Conference on Artificial Intelligence, February 12-17, 2016, Phoenix, Arizona, USA, pages 3776-3784. +Iulian Vlad Serban, Alessandro Sordoni, Ryan Lowe, Laurent Charlin, Joelle Pineau, Aaron C. Courville, and Yoshua Bengio. 2017. A hierarchical latent variable encoder-decoder model for generating dialogues. In Proceedings of the Thirty-First AAAI Conference on Artificial Intelligence, February 4-9, 2017, San Francisco, California, USA, pages 3295-3301. AAAI Press. +Lifeng Shang, Zhengdong Lu, and Hang Li. 2015. Neural responding machine for short-text conversation. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing of the Asian Federation of Natural Language Processing, ACL 2015, July 26-31, 2015, Beijing, China, Volume 1: Long Papers, pages 1577-1586. +Anshumali Shrivastava and Ping Li. 2014. Asymmetric LSH (ALSH) for sublinear time maximum inner product search (MIPS). In Advances in Neural Information Processing Systems 27: Annual Conference on Neural Information Processing Systems 2014, December 8-13 2014, Montreal, Quebec, Canada, pages 2321-2329. +Zhenqiao Song, Xiaoqing Zheng, Lu Liu, Mu Xu, and Xuanjing Huang. 2019. Generating responses with a specific emotion in dialog. In Proceedings of the 57th + +Conference of the Association for Computational Linguistics, ACL 2019, Florence, Italy, July 28-August 2, 2019, Volume 1: Long Papers, pages 3685-3695. Association for Computational Linguistics. +Alessandro Sordoni, Michel Galley, Michael Auli, Chris Brockett, Yangfeng Ji, Margaret Mitchell, Jian-Yun Nie, Jianfeng Gao, and Bill Dolan. 2015. A neural network approach to context-sensitive generation of conversational responses. In *NAACL HLT* 2015, The 2015 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Denver, Colorado, USA, May 31 - June 5, 2015, pages 196-205. The Association for Computational Linguistics. +Robyn Speer, Joshua Chin, and Catherine Havasi. 2017. Conceptnet 5.5: An open multilingual graph of general knowledge. In Proceedings of the Thirty-First AAAI Conference on Artificial Intelligence, February 4-9, 2017, San Francisco, California, USA, pages 4444-4451. AAAI Press. +Robyn Speer and Catherine Havasi. 2012. Representing general relational knowledge in conceptnet 5. In Proceedings of the Eighth International Conference on Language Resources and Evaluation, LREC 2012, Istanbul, Turkey, May 23-25, 2012, pages 3679-3686. European Language Resources Association (ELRA). +Ilya Sutskever, Oriol Vinyals, and Quoc V. Le. 2014. Sequence to sequence learning with neural networks. In Advances in Neural Information Processing Systems 27: Annual Conference on Neural Information Processing Systems 2014, December 8-13 2014, Montreal, Quebec, Canada, pages 3104-3112. +Chao-Hong Tan, Xiaoyu Yang, Zi'ou Zheng, Tianda Li, Yufei Feng, Jia-Chen Gu, Quan Liu, Dan Liu, Zhen-Hua Ling, and Xiaodan Zhu. 2021. Learning to retrieve entity-aware knowledge and generate responses with copy mechanism for task-oriented dialogue systems. In Thirty-Fifth AAAI Conference on Artificial Intelligence Workshop on the Ninth Dialog System Technology Challenges (DSTC 9), AAAI 2021, Virtual Event, February 2-9, 2021. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, December 4-9, 2017, Long Beach, CA, USA, pages 5998-6008. +Oriol Vinyals and Quoc V. Le. 2015. A neural conversational model. CoRR, abs/1506.05869. +Zhen Wang, Siwei Rao, Jie Zhang, Zhen Qin, Guangjian Tian, and Jun Wang. 2020. Diversify question generation with continuous content selectors and question type modeling. In Findings of the Association for Computational Linguistics: EMNLP 2020, Online Event, 16-20 November 2020, volume EMNLP 2020 of Findings of ACL, pages 2134-2143. Association for Computational Linguistics. + +Thomas Wolf, Lysandre Debut, Victor Sanh, et al. 2020. Transformers: State-of-the-art natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, EMNLP 2020 - Demos, Online, November 16-20, 2020, pages 38-45. Association for Computational Linguistics. +Yu Wu, Furu Wei, Shaohan Huang, Yunli Wang, Zhoujun Li, and Ming Zhou. 2019. Response generation by context-aware prototype editing. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 7281-7288. +Wenhao Yu, Chenguang Zhu, Zaitang Li, Zhiting Hu, Qingyun Wang, Heng Ji, and Meng Jiang. 2020a. A survey of knowledge-enhanced text generation. CoRR, abs/2010.04389. +Wenhao Yu, Chenguang Zhu, Zaitang Li, Zhiting Hu, Qingyun Wang, Heng Ji, and Meng Jiang. 2020b. A survey of knowledge-enhanced text generation. arXiv preprint arXiv:2010.04389. +Saizheng Zhang, Emily Dinan, Jack Urbanek, Arthur Szlam, Douwe Kiela, and Jason Weston. 2018. Personalizing dialogue agents: I have a dog, do you have pets too? In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics, ACL 2018, Melbourne, Australia, July 15-20, 2018, Volume 1: Long Papers, pages 2204-2213. Association for Computational Linguistics. +Yizhe Zhang, Siqi Sun, Michel Galley, Yen-Chun Chen, Chris Brockett, Xiang Gao, Jianfeng Gao, Jingjing Liu, and Bill Dolan. 2020. DIALOGPT: Large-scale generative pre-training for conversational response generation. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics: System Demonstrations, ACL 2020, Online, July 5-10, 2020, pages 270-278. Association for Computational Linguistics. +Tiancheng Zhao, Ran Zhao, and Maxine Eskenazi. 2017. Learning discourse-level diversity for neural dialog models using conditional variational autoencoders. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, ACL 2017, Vancouver, Canada, July 30 - August 4, Volume 1: Long Papers, pages 654-664. Association for Computational Linguistics. +Xueliang Zhao, Wei Wu, Chongyang Tao, Can Xu, Dongyan Zhao, and Rui Yan. 2020. Low-resource knowledge-grounded dialogue generation. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net. +Yinhe Zheng, Rongsheng Zhang, Minlie Huang, and Xiaoxi Mao. 2020. A pre-training based personalized dialogue generation model with persona-sparse data. In The Thirty-Fourth AAAI Conference on Artificial Intelligence, AAAI 2020, New York, NY, USA, February 7-12, 2020, pages 9693-9700. AAAI Press. + +Hao Zhou, Minlie Huang, Tianyang Zhang, Xiaoyan Zhu, and Bing Liu. 2018a. Emotional chatting machine: Emotional conversation generation with internal and external memory. In Proceedings of the Thirty-Second AAAI Conference on Artificial Intelligence, (AAAI-18), New Orleans, Louisiana, USA, February 2-7, 2018, pages 730-739. AAAI Press. +Hao Zhou, Tom Young, Minlie Huang, Haizhou Zhao, Jingfang Xu, and Xiaoyan Zhu. 2018b. Commonsense knowledge aware conversation generation with graph attention. In Proceedings of the Twenty-Seventh International Joint Conference on Artificial Intelligence, IJCAI 2018, July 13-19, 2018, Stockholm, Sweden, pages 4623-4629. ijcai.org. +Kangyan Zhou, Shrimai Prabhumoye, and Alan W. Black. 2018c. A dataset for document grounded conversations. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, Brussels, Belgium, October 31 - November 4, 2018, pages 708-713. Association for Computational Linguistics. +Li Zhou, Jianfeng Gao, Di Li, and Heung-Yeung Shum. 2020. The design and implementation of xiaoice, an empathetic social chatbot. Comput. Linguistics, 46(1):53-93. \ No newline at end of file diff --git a/tegtokaugmentingtextgenerationviataskspecificandopenworldknowledge/images.zip b/tegtokaugmentingtextgenerationviataskspecificandopenworldknowledge/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..0c5433d13287c1faaa9d13a20201fdde04f679d3 --- /dev/null +++ b/tegtokaugmentingtextgenerationviataskspecificandopenworldknowledge/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:91e97b6c747e78f17f429219a02fc1ed872c388caf8778b1ba22730b4f7732bf +size 378361 diff --git a/tegtokaugmentingtextgenerationviataskspecificandopenworldknowledge/layout.json b/tegtokaugmentingtextgenerationviataskspecificandopenworldknowledge/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..fd3e0f443df62a40371f859f7875d16b48b44eee --- /dev/null +++ b/tegtokaugmentingtextgenerationviataskspecificandopenworldknowledge/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0e70e39b2594021f545cb914ec55e80682e06a4e8f9815ada71f5ab14617b398 +size 409283 diff --git a/thainestednamedentityrecognitioncorpus/0d35b54c-e72a-43cb-9387-bfc10376c1ac_content_list.json b/thainestednamedentityrecognitioncorpus/0d35b54c-e72a-43cb-9387-bfc10376c1ac_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..69f5d58be57a96a9637ff6ff14c302df66baee0e --- /dev/null +++ b/thainestednamedentityrecognitioncorpus/0d35b54c-e72a-43cb-9387-bfc10376c1ac_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f85c556d4de88db08f1a9b4a37f72174bdcb55b00d2e1fc36a629e24e934daee +size 101265 diff --git a/thainestednamedentityrecognitioncorpus/0d35b54c-e72a-43cb-9387-bfc10376c1ac_model.json b/thainestednamedentityrecognitioncorpus/0d35b54c-e72a-43cb-9387-bfc10376c1ac_model.json new file mode 100644 index 0000000000000000000000000000000000000000..782f06a7e55ec58badc5d282e0200dee018171d1 --- /dev/null +++ b/thainestednamedentityrecognitioncorpus/0d35b54c-e72a-43cb-9387-bfc10376c1ac_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:65ecab7ee6b48f647921101c4697e35b9d3154cfbd90cae8b7200fbd5c0700d9 +size 117747 diff --git a/thainestednamedentityrecognitioncorpus/0d35b54c-e72a-43cb-9387-bfc10376c1ac_origin.pdf b/thainestednamedentityrecognitioncorpus/0d35b54c-e72a-43cb-9387-bfc10376c1ac_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..4c28694e66c56a6d02647494cbb08993758f8723 --- /dev/null +++ b/thainestednamedentityrecognitioncorpus/0d35b54c-e72a-43cb-9387-bfc10376c1ac_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:18b8496323442e5556d528198b7aea8b00ba7028c959e0edafe9cafb434d674a +size 1312907 diff --git a/thainestednamedentityrecognitioncorpus/full.md b/thainestednamedentityrecognitioncorpus/full.md new file mode 100644 index 0000000000000000000000000000000000000000..6a70cb4cbb27e58c586db3d3d477f7d08e077736 --- /dev/null +++ b/thainestednamedentityrecognitioncorpus/full.md @@ -0,0 +1,364 @@ +# Thai Nested Named Entity Recognition Corpus + +Weerayut Buaphet†, Can Udomcharoenchaikit*, Peerat Limkonchotiwat†, Attapol T. Rutherford‡, Sarana Nutanong† + +†School of Information Science and Technology, VISTEC, Thailand + +$^{\ddagger}$ Department of Linguistic, Chulalongkorn University, Thailand + +{Weerayut.b_s20, canu_pro, peerat.l_s19,snutanon}@vistec.ac.th, attapol.t@chula.ac.th + +# Abstract + +This paper presents the first Thai Nested Named Entity Recognition (N-NER) dataset. Thai N-NER consists of 264,798 mentions, 104 classes, and a maximum depth of 8 layers obtained from news articles and restaurant reviews, a total of 4894 documents. Our work, to the best of our knowledge, presents the largest non-English N-NER dataset and the first non-English one with fine-grained classes. To understand the new challenges our proposed dataset brings to the field, we conduct an experimental study on (i) cutting edge N-NER models with the state-of-the-art accuracy in English and (ii) baseline methods based on well-known language model architectures. From the experimental results, we obtain two key findings. First, all models produce poor F1 scores in the tail region of the class distribution. There is little or no performance improvement provided by these models with respect to the baseline methods with our Thai dataset. These findings suggest that further investigation is required to make a multilingual N-NER solution that works well across different languages. The dataset and code are available at: github.com/vistec-AI/Thai-NNER.git + +# 1 Introduction + +Named Entity Recognition (NER) is a task of extracting named entities from given text. It identifies the span of each entity and categorizes the identified span into an entity category. NER is essential in many downstream tasks, e.g., entity linking, question answering, and knowledge graph. In addition, Yamada et al. (2020) show that the contextualized representations that include entity information can improve many downstream tasks. + +The conventional NER paradigm can only label one entity type for each entity span. For example, the entity "Chiang Mai University" will be considered as a single span ignoring the nested structure of the term "Chiang Mai," which is the name + +![](images/ca659a28183b3914ca08720a01c8cb9704db6e06c86a4040a267e24463670b8d.jpg) +Figure 1: An overview of named-entity classes in Thai N-NER corpus. Our corpus contains 104 fine-grained classes which can be combined into 10 coarse-grained classes. Each box represents a coarse-grained class, and each row within a box represents a fine-grained class. + +of the city that the university is situated in. As a result, we may overlook critical information that may have an impact on the language understanding in a downstream task. To mitigate this drawback, one may introduce a nested structure into the NER problem. Let us again consider the "Chiang Mai University" example. In addition to annotating the entire span as an organization, $N$ -NER also identifies the sub-entity of "Chiang Mai" as a location. This feature can be useful in a downstream task that requires linking an entity to useful references, e.g., a university to its affiliated city. + +Considerable research attention has been dedicated to formulating a technique to solve the N-NER problem (Straková et al., 2019a,b; Lin et al., 2019; Wang et al., 2020a; Luo and Zhao, 2020; Shibuya and Hovy, 2020; Wang et al., 2020b). One can use an N-NER model to recursively decompose a complex entity into a tree structure of sub + +entities and have them annotated accordingly. + +While N-NER has many potential benefits to downstream tasks that require deep language understanding, there is still a lack of datasets for low-resource languages to help develop reliable N-NER models. In order to train N-NER models, we need a dataset with hierarchical information of each named entity. N-NER datasets are available in several languages. Especially, English, a high resource language, has a few N-NER datasets available for multiple domains (Doddington et al., 2004; Walker et al., 2006; Kim et al., 2003; Ringland et al., 2019) including news, social media, and molecular biology. + +The diversity of N-NER corpora is only available in English. N-NER datasets are not as widely available for other languages, let alone the diversity of corpora. In German, another high-resource language, there is only one N-NER dataset available (Benikova et al., 2014). For low-resource languages, such as Vietnamese, the two available datasets (Huyen and Luong, 2016; Nguyen et al., 2018) are still small compared to a large N-NER dataset in English (Ringland et al., 2019). + +In this paper, we address the scarcity of non-English N-NER resources by introducing a Thai N-NER dataset. Despite over 58 million internet users1, the Thai language suffers from the lack of annotated resources to build NLP systems. We propose a Thai N-NER dataset comprising 264,798 entity mentions obtained from 4,894 documents. In addition to the nested entity structure, we also have more than one hundred classes providing great fidelity in entity categorization as shown in Figure 1. The number of entity mentions and variety of entity classes are comparable to a large N-NER dataset in English (Ringland et al., 2019). Our dataset contains text samples, in both formal and colloquial settings, from news articles and restaurant reviews. Additionally, our corpus allows for the multilingual evaluation of "language-agnostic" deep learning models, which is the current NLP research trend. To facilitate future N-NER research, we make the dataset, the annotation guideline, and the model weights publicly available. + +To summarize, our contributions are as follows: + +- We create the first Thai N-NER dataset annotated with extensive tagsets that cover a wide range of use cases. +We evaluate three recent state-of-the-art + +(SOTA) N-NER models on our dataset and study the effect of long-tail classes. + +- We develop an N-NER benchmark comprising strong baselines for the Thai language that learn each annotation layer separately and achieve performance comparable with the three recent SOTA N-NER models. + +# 2 Related Work + +In this section, we discuss various attempts on N-NER corpora. As shown in Table 1, existing N-NER corpora are mostly high-resource languages, i.e., English and German, while Vietnamese is the only Asian language that has an N-NER dataset. In terms of the number of classes, it is also worth noting that three out of six corpora has less than ten classes and only NNE (Ringland et al., 2019) has more than 100 classes. The details of these corpora are given as follows. + +
DatasetDocsTokensEntitiesDepthMentions
English
NNE2,3121.1M1146279,795
GENIA2,0000.5M36492,681
ACE-20054640.3M7630,966
German
NoSta-D-0.6M4241,005
Vietnamese
VLSP-20181,282-3235,817
Danish
Dan+-0.1M426,425
Thai
Our4,8941.2M1048264,798
+ +Table 1: The statistical information comparison between our Thai N-NER corpus and N-NER corpora in other languages. Note that, we obtain the statistical information of NNE, GENIA, and ACE-2005 from Ringland et al. (2019) + +ACE-2004 (Doddington et al., 2004) and ACE-2005 (Walker et al., 2006) are early examples of N-NER datasets. ACE-2005 (Walker et al., 2006) dataset comprises 30,966 mentions from 12,548 sentences with 7 coarse-grained entity types. In addition to N-NER annotations, ACE-2005 also contains labels for other tasks such as recognition of relation and event extraction. + +GENIA (Kim et al., 2003) introduces an N-NER data for bioinformatics. This project provides a high-quality corpus annotated for biological entity names. The dataset is composed of 2,000 abstracts, 92,681 mentions from 9,533 sentences with 32 entity types. + +NNE (Ringland et al., 2019) is a recent large fine-grained N-NER dataset composed of 114 classes. Unlike previous N-NER corpora, the NNE dataset annotates entities with more details. For example, "6 September 2019", a date named entity mention, in the NNE dataset, each element in this mention is annotated with finer detail, "6" is annotated with day tag, "September" with month tag, and "2019" with year tag. + +NoSta-D (Benikova et al., 2014) is the first and only German N-NER dataset. NoSta-D is composed of 41,005 mentions, 12 entity types, and 31,300 sentences from the German Wikipedia and online news. The previous German NER dataset, CoNLL-2003 (Tjong Kim Sang and De Meulder, 2003), shows that the performance of German is lower than English's2. However, the German CoNLL-2003 dataset is known to be inconsistent because it was annotated by non-native speakers. Hence, NoSta-D aims to provide a high quality free public NER dataset by using native speakers as annotators. In contrast to previous N-NER corpora, NoSta-D has a less restrictive copyright license. + +VLSP-2018 (Nguyen et al., 2018) is a standard benchmark for Vietnamese N-NER. It was designed for the Vietnamese NER shared task to foster the development of high-quality open-source software. This dataset contains 35,817 mentions from 1,282 documents with 3 entity types. + +$\mathbf{DAN}+$ (Plank et al., 2020) presents the first N-NER dataset for Danish. This work investigates the possibility of transfer-learning between languages for the N-NER task. Moreover, $\mathrm{DAN}+$ is a multi-domain dataset; they also study the challenges of domain-shift in their dataset. The dataset contains 6,425 mentions, 130,095 tokens, 4 classes from 6,867 sentences, obtained from multiple domains such as news and social media (Reddit, Twitter, and Arto). + +NoSta-D, VLSP-2018, and DAN+ have a modest corpus size and a small number of entity types comparing to the NNE dataset. This shows that there is still a resource gap for non-English corpora. On the other hand, for Thai, there are only coarse-grained flatten-NER datasets which are publicly available (Tirasaroj and Aroonmanakun, 2009; Boonkwan et al., 2020). + +# 3 Thai N-NER corpus + +In this section, we introduce Thai N-NER—the first Thai-Nested Named Entity Recognition dataset. Our dataset is comparable to the NNE corpus (Ringland et al., 2019), which is the most elaborate English N-NER dataset in terms of the number of mentions, depth, and the number of classes. In particular, Thai N-NER comprises 264,798 mentions organized into 104 classes and has a maximum depth of 8 layers. + +# 3.1 Data Collection Procedure + +To create the dataset, we gather 4,894 documents from two different domains: news articles and restaurant reviews. In particular, we obtain 4,396 news articles from Prachathai3, a news website, and 498 restaurant reviews from Wongnai4, a crowd-sourced restaurant review platform. + +The Thai language poses a challenge to the annotation process. Previous work often conducts the annotation at the token level, which is quite convenient for more accurate annotation. However, the lack of clear word boundaries in the Thai writing system does not allow us to easily annotate at the word-level because the data must be word-segmented first, automatically or not. Automatic word segmentation often makes errors around out-of-vocabulary words, which are exactly what we need to annotate. Consequently, the annotation at the word level is not suitable for our purposes if the data are not manually segmented first, which incurs more cost of annotation. Annotating character-level data does not solve the problem either, because annotators are more prone to make an error. + +To ease and reduce annotation errors, we provide our annotators with syllable-segmented data instead. Aroonmanakun (2002) shows that syllable segmentation can resolve many word-level ambiguities in Thai. Plus, automatic syllable segmentation can be done at a near-perfect accuracy because the task is mostly solved by orthographic rules, assuming few typos exist in the data (Chormai et al., 2020). With syllable boundary indicators, we can avoid errors from word segmentation. In addition, syllable-segmented data reduces the number of indices drastically, which in turn reduces annotation errors. Appendix A.4 provides + +
WordLayer 1Layer 2Layer 3Layer 4Layer 5Layers 6-8
prüptah.a.n.pratah.a.n.president‘President’B-RoleOOOOO
k'háná.kammáka:nk'háná.kammáka:ncommittee‘Committee’I-RoleB-Org.po.OOOO
40si:sip40‘40’I-RoleI-Org.po.B-Event_oth.B-DurationS-Cardi.O
I-RoleI-Org.po.I-Event_oth.I-DurationS-UnitO
pi:---I-RoleI-Org.po.I-Event_oth.E-DurationOO
pi:years‘Year’I-RoleI-Org.po.I-Event_oth.OOO
14sipsi:14‘14’I-RoleI-Org.po.I-Event_oth.B-DateS-DayO
πιαλtúla:oct‘October’I-RoleI-Org.po.I-Event_oth.E-DateS-MonthO
πωτησεροδεντησεροδεντησεροδεντησεροδεντησεροδεντησεροδεντησεροδεντησεροδεντησεροδεντησεροδεντησεροδεντησεροδεν τόματεροδεντησεροδεντησεροδεντησεροδεντησεροδεντησεροδεντησεροδεντησεροδεντησεροδεντησεροδεντησεροδεντησκεντησεροδεντησκεντησεροδεντησκεντησκεντησκεντησκεντησκεντησκεντησκεντησκεντησκεντησκεντησκεντησκεντησκεντησκεντησκεντησκεντησκεντŋ
pratc h.a:t'ippàṭajdemocracy‘Democracy’I-RoleI-Org.po.I-Event_oth.OOOO
sǒmbu:ncomplete‘Complete’E-RoleE-Org.po.E-Event_oth.OOOO
+ +Table 2: Our corpus is available in CoNLL format. The first column contains words and other eight columns contain labels in each layer + +an example of how syllable-segmented data can help improve annotation experience. + +# 3.2 Annotation Guideline + +Inspired by the guideline from (Ringland et al., 2019), we design an N-NER annotation guideline for Thai. To cover a wide range of use cases, our N-NER tagsets comprises coarse-grained and fine-grained categories. While fine-grained categories create extra burden for the annotation and may result in more errors, the trade-off is worth it because finer-grained categories lend themselves to be nested within a coarser category. For example, as shown in Figure 2, w.n. an. tamruat. $\mathsf{?ek}$ prawhat mu:npramuk) 'Police Colonel Prawet Munpramuk' is tagged with PER-a coarse-grained class which encapsulates other fine-grained classes related to person name. Within a coarse-grained mention, we include nested fine-grained information to each nested named-entity element to give more detail. For example, we annotate w.n. (p'an.tamruat. $\mathsf{?ek}$ ) 'Police Colonel' with title name, w.n. (prawhat) 'Prawet' with first name, and w.n. w.n. (mu:npramuk) 'Munpramuk' with last name. + +![](images/0b714c1a52bccdb46b220203fa5bc0ae1d1b884454b0fee93c1f367a0accb4a6.jpg) +Figure 2: An example of a nested named-entity annotation. Entity mentions in a deeper layer must be within the span of the entity mention in the previous layer to give finer details for the coarse-grained. + +Apart from the description for each entity class, we provide annotators with case studies for common annotating complications. One frequent complication during the annotation process is ambiguous named entities that change their categories depending on the context. The same string annotated as one category in one context might be annotated as another in a different context. To illustrate this complication, we provide the following example: + +(1) wnu n nu u t'ah: n thaj do:n tcap military Thai is arrested 'Thai military is arrested +(2) nnu 1nnu 7nu 7nu 7nu 7nu t'aha:n thaj san ham o:k tc:a:k ba:n military Thai ordered prohibit leave from house 'Thai military prohibits going outside of the house' + +In the example above, the word $\text{N}\mathsf{w}\mathsf{r}\mathsf{I}\mathsf{L}\mathsf{N}\mathsf{u}$ (t'aha:n t'aj) 'Thai military' is not always a named entity depending on the context. In example sentence (1) $\text{N}\mathsf{w}\mathsf{r}\mathsf{I}\mathsf{L}\mathsf{N}\mathsf{u}\mathsf{I}\mathsf{u}\mathsf{u}$ (t'aha:n t'aj do:n tcap) 'Thai military is arrested', 'Thai military' is not a named entity because 'Thai military' refers to a Thai soldier. In contrast, the example sentence (2) $\text{N}\mathsf{w}\mathsf{r}\mathsf{I}\mathsf{L}\mathsf{N}\mathsf{u}\mathsf{u}\mathsf{u}\mathsf{u}\mathsf{u}\mathsf{n}\mathsf{u}$ (t'aha:n t'aj san ha:m o:k tc:a:k ba:n) 'Thai military prohibits going outside of the house', 'Thai military' is a named entity because it refers to the Thai military institution. + +A named entity mention that is composed of nested named entities can be regarded as a tree structure. Specifically, the first level of a mention is the outermost or the largest entity span of the mention. The nested entities within the mention in each level must not overlap and cannot span outside of the mention. We provide + +an example of an issue that arises from overlapping annotations in Appendix A.3. Each coarse-grained entity type can appear in any level of the nested structure. However, fine-grained entity type must be nested under its coarse-grained entity type. As shown in Table 2, $\text{prat}^{\text{h}}a:n.k^{\text{h}}\text{ana}.kammáka:n$ si:sip pi: sipsi: tula: $p^{\text{h}}\hat{u}a$ $\text{prat}^{\text{h}}a:\text{h}'\text{ippataj}\text{sombu:n}$ 'The 40-year 14 Oct for complete democracy committee president' is the first level of a named-entity mention which is annotated as a role type and the nested structure also contained other coarse-grained mentions such as date or duration. However, fine-grained entity mentions, such as day and month, can only be nested inside the date class. + +# 3.3 Annotation Quality Control Procedure + +To make our dataset reliable, we require that annotators have a background in linguistics and are properly trained to annotate under our guidelines. We also do quality control and evaluation to verify the quality of our dataset. + +# 3.3.1 Annotators + +The dataset is manually annotated by 47 linguistically trained annotators. The annotators have the necessary linguistic background and have passed the N-NER guideline understanding test. We provide a communication channel to discuss annotation issues among the annotators and the project manager. We use Datasaur.ai5 platform for the annotators to label the data according to our guideline, using syllable span highlighting to designate each span as a specific entity. + +# 3.4 Annotation Verification Process + +Firstly, we manually check the quality of annotated randomly data to find common mistakes. To find more annotation errors, we extract only the first layer to train a simple flatten CRF model. Then we use the CRF model to filter its prediction errors for further error analysis. Combining the errors found by both humans and the model, we conduct an error analysis to find the pattern of mistakes from annotators. Frequent annotation mistakes are inconsistency tagging, incorrect tagging, and failure to follow the guideline. Then we compile a list of annotation errors and send it back to the annotators to reassess. After the first update, we use a rule-based program to filter overlapping annotations, which + +violate our guideline, then list all the documents with overlapping annotations. Moreover, we employ a gazetteer to filter mislabeled entities. Later, we report the list of overlapping documents and the list of mislabeled entities to the annotators to correct all the annotation errors. + +After the second update, to inspect our dataset quality, we train an N-NER model from Shibuya and Hovy (2020) to see whether our data can be used to train the model and to filter out more annotation errors. The test score is $75.44\%$ F1 score. We then use the model's prediction errors to filter out more annotation mistakes and report them to the annotators for another correction session. + +Then, we split our dataset into $80\%$ for a training set and $20\%$ for a test set, then re-associate the test set with two annotators to validate. Finally, the third annotator correct the annotation mismatches between the first two annotators. + +We use the Cohen's Kappa agreement score to benchmark the reliability of our dataset. We compute the inter-annotator agreement using eight sampled documents composed of 2,922 tokens. We calculate the Cohen's Kappa agreement score using two labeling schemes: CoNLL and Pyramidal, see Appendix A.5 for further descriptions. The agreement scores are given as follows: + +CoNLL: 0.79; +Pyramidal: 0.85; + +These high agreement scores imply that our dataset is of good quality. + +# 3.5 Data Format + +To make our dataset convenient for research usage, we provide our dataset in CoNLL-format as shown in Table 2. We define the word boundaries in the dataset by using a maximal matching tokenizer from PyThaiNLP (Phatthiyaphaibun et al., 2016). In addition, we employ the BIOES tagging scheme to indicate the boundary of each named entity mention. Furthermore, we replace each empty space token with “_” in order to keep the integrity of the original text when we convert the CoNLL version back to the original text with no tokenization. + +# 4 Data Statistics + +This section discusses the dataset statistics and analyzes the distribution of classes in the dataset. Table 3 shows the dataset statistics of the Thai N-NER. The Thai N-NER corpus contains 1,272,381 + +tokens from 4,894 documents. The dataset has 264,798 named entity mentions, 104 entity types, and 8 maximum depth. + +
ItemsTrainDevTestTotal
Documents2,9359799804,894
Tokens763,421256,553252,4071,272,381
Entity types104101104104
Max. depth7868
Mentions155,35350,50158,944264,798
Layer 174,28124,37326,526125,180
Layer 270,96723,00026,942120,909
Layer 38,9872,7994,71416,500
Layer 49642846731,921
Layer 51294182252
Layer 6241732
Layer 71203
Layer 80101
+ +Table 3: The data statistics and distribution of entities in each layer. + +The Thai N-NER dataset contains a nested structure for each named-entity mention. The first three layers contain 125,180, 120,909, and 16,500 mentions accounted for $99.2\%$ and mentions all other levels contain 2,209 mentions combined accounted for only $0.8\%$ . The 125,180 first-layer mentions can be divided into 67,168 nested mentions and 58,012 non-nested mentions. We split our dataset into training set, development set, and test set with proportion of $60\%$ , $20\%$ , and $20\%$ respectively. The test set contains all the 104 classes appeared in the training set. + +We compare our dataset with other N-NER datasets in other languauges. Table 1 shows the statistics of N-NER datasets between NNE, GENIA, ACE-2005 (English), VLSP-2018 (Vietnamese), Dan+ (Danish), and our dataset (Thai). It should be noted that our dataset is comparable to the existing N-NER datasets in terms of the number of tokens and the number of entity types. + +One of the challenges in this dataset is class imbalance. Due to the number of classes, the scarcity of data for rare classes contribute to the severity of class imbalance. We visualize the distribution of classes in training set in Figure 3. The graph shows the distribution of mentions per class in training set sorted by frequency. To analyse the severity of class imbalance, we divided the classes into three groups follow Pareto principle: head, body and tail with samples per classes are $80\%$ , $15\%$ and $5\%$ respectively. More precisely, in body and tail parts, they contain only $20\%$ of samples in training set, but consist of 84 classes from 104 classes. + +In conclusion, we introduce a dataset for Thai + +![](images/a329dd6364cae4d5549a6bbde996ddb40baacb5dcc167d6d64ef838d985fb7be.jpg) +Training set statistics +Figure 3: The distribution of classes sorted by frequency shows that rarer classes consist of more than $20\%$ of all instances. + +N-NER that is comparable to the standard N-NER dataset in English. Additionally, we point out a challenging long-tail distribution problem in N-NER that allows researchers to explore. + +# 5 Experimental Settings and Results + +The objectives of the experimental studies are as follows: the first objective is to help researchers understand how existing techniques perform on our dataset and to help them choose the most appropriate baseline for future research. The second objective is concerned with the distribution of classes which follows the 80-20 Pareto principle. As shown in Figure 3, the top $20\%$ most frequent classes account for $80\%$ of the mentions. We also study how these techniques perform differently at the head, body, and tail parts of the distribution. The third objective is to compare how existing models perform on our Thai dataset with respect to results from existing studies conducted on English datasets. + +# 5.1 Comparative N-NER Models + +Since there is no existing Thai N-NER model, we formulate comparative solutions based on three approaches. The first approach is to build a baseline N-NER method from a classical machine learning technique. The second approach is applying a Thai language model to perform a span classification task. The third approach is to adapt existing N-NER methods to Thai by replacing their encoders with a Thai language model. For ease of comparison, we apply the best existing Thai language model called WangchanBERTa (Lowphansirikul et al., 2021) to second and third approaches. + +Classical ML baseline: CRF model (Minh, 2018) We train multiple CRF models, each model is dedicated to each layer. Then, we merge the pre + +diction results from all layers to form the final N-NER result. For this model, we use the IOB tagging scheme because our dataset has a large number of classes; hence the IOBES scheme will take longer to train. + +Deep learning baseline: WangchanBERTa and XLM-RoBERTa. We finetune language model (LM) encoders on our corpus with two architectural variants, LM-separate and LM-shared as shown in Figure 4a and 4b, respectively. For both model, we simply use a fully-connected linear layer as a decoder. For separate-weight (sp) version, we assign one encoder-decoder model for each layer. For shared-weight (sh) version, we use multiple decoders, one for each layer, while sharing the same encoder. We provide more information about parameter settings in Appendix A.1. + +![](images/b8ac5b71982620f28a6a24edb869d2343b22f0d8ab83dedbf514d1d93523a7b4.jpg) +(a) LM-separate (sp). + +![](images/1aa6ac3641775b589ba0678e7c12911c0c05c97cf03366998abcedbf9a998308.jpg) +(b) LM-shared (sh). +Figure 4: (a) LM-separate: each level in the nested structure has a full encoder-decoder model trained to predict tags in that specific level only. (b) LM-shared: each nested level has its own dedicated decoder, while sharing the same encoder. $\mathrm{L}_1$ to $\mathrm{L}_n$ denotes the depth level. + +To compare the performances between monolingual and multilingual BERT variants, we run experiments on both WangchanBERTa (Thai) and XLM-RoBERTa (multilingual). + +State-of-the-art Models: We select three recent SOTA N-NER models with open-source accesses and train them on our corpus. To get these models to work for Thai, we replace their encoders with the same Thai language model as the deep learning baselines (Lowphansirikul et al., 2021). For parameter configurations, we use GENIA's parameter configurations to make it possible to do sanity check by reproducing previous results on GENIA + +Second-best-learning (Shibuya and Hovy, 2020): This model learns to recursively decode the nested named entities from the outer to the inner nested entities. It is commonly used as a baseline in recent N-NER research. It has strong results for English N-NER. + +Pyramid (Wang et al., 2020a): This model learns hierarchical representation from multiple nested levels by using pyramid and inverse pyramid mechanisms. This model currently has the highest score on the NNE dataset. + +Locate and Label (Shen et al., 2021): This model divides entity detection into two stages: (i) it locates the entity spans; (ii) it assigns a label to each entity span. It is the most recent state-of-the-art model, it has top-performing scores on ACE-2004 and GENIA corpora. + +# 5.2 Evaluation Settings + +We follow the evaluation methodology from (Shibuya and Hovy, 2020), they consider a prediction as a true positive if both the predicted entity span and type are correct. In order to examine the long-tail issue as mentioned in Section 4, we evaluated the effect of long-tail distribution by dividing classes into three groups: head, body, and tail. + +# 5.3 Thai N-NER Results + +Table 4 shows the results on different parts of the long-tailed distribution, as well as the overall results on our dataset. Among the three existing SOTA models, the Second-best-learning model has the highest overall performance. It obtains higher F1 scores on the head and body parts of the long-tail distribution, while the Pyramid model obtains the highest F1 score on the tail part. + +Interestingly, the deep learning baseline models, WangchanBERTa and XLM-R, can perform on par with all the current SOTA models. As shown in Table 4, the performances of WangchanBERTa models on the body and tail parts, and XLM-R models on the tail part are superior to the best SOTA model. + +By having better performances on body and tail parts, while maintaining a high performance on the head part, both of the deep learning baseline models can obtain competitive results compared to all the SOTA models on our corpus. + +The performances of models based on the multilingual encoder (XLM-R) are superior to Pyramid and Locate and label models. However, compared to the monolingual encoder (WangchanBERTa), XLM-R models' performances are better than the monolingual models. This suggests the possibility of cross-lingual N-NER tasks. (e.g. transferring cultural-specific named-entity knowledge from English to Thai). + +
ModelsHeadBodyTailAll
PRF1PRF1PRF1PRF1
BaselineCRF model86.0666.4675.0078.3044.8857.0674.0729.4642.1584.6060.5970.61
WangchanBERTa-sp90.7077.6683.6781.5555.9066.3378.0226.0939.1089.0470.8978.94
WangchanBERTa-sh90.5179.2484.5081.3755.0965.7078.3330.7944.2088.8772.2579.70
XLM-R-sp90.2777.3983.3480.4552.7163.6975.4233.0445.9588.4270.5678.48
XLM-R-sh89.4579.7284.3177.2958.0666.3171.8039.7351.1686.9373.6679.75
SOTASecond-best-learning87.5781.7884.5880.1254.8565.1279.0519.4131.1686.4173.4979.43
Pyramid87.5980.3383.8176.0753.7262.9774.2023.9236.1885.6572.4578.50
Locate and label77.6080.3878.9764.4256.2160.0477.4318.8630.3375.5772.6174.06
+ +Table 4: Experimental results nested-NER models divided into head, body, tail, and overall in our dataset + +The long-tailed distribution of classes poses a challenge for the N-NER task. The performances across all models quickly deteriorate as we move from the head part of the long-tailed distribution, which represents common classes, to the tail part, which represents infrequent classes. Additionally, there are gaps between precision and recall for all models. These gaps imply that all models have a tendency to generate false negatives more than false positives. We can also see that the precision-recall gap has a tendency to increase as we move from the head to the tail part of the distribution. This result suggests that in order to improve the overall performance, we should pay attention to recall. + +In addition, comparing to the results on English N-NER corpora, there is a performance gap for the Thai language. For example, the F1 score of the Pyramid model on the NNE corpus is 94.68, while its performance on our corpus is only 78.50. For the full comparison, see Appendix A.6. + +# 6 Error Analysis + +To understand the limitation of current N-NER solutions, we investigate reoccurring mistake patterns from the WangchanBERTa-sp models used in the experimental studies. We categorize the common prediction mistakes into four groups as follows: (1) Incorrect span prediction: out of 5,334 prediction errors, 3,103 errors are from span length mismatch as shown in Figure 5. (2) Ambiguous entity mentions: mentions with higher class distribution entropy have more error rates. (3) Ambiguity between fine-grained classes: there are 1,160 fewer errors when evaluated with coarse-grained ground truths. (4) Scarcity of training samples: the model only made 1,380 prediction attempts for mentions in tail classes. While 1,081 of the predictions are correct, there are 3,511 ground truths. The previous section also reveals this issue via the poor recall scores in the tail part of the long-tail dis + +ribution. We provide the description of each error pattern along with examples in Appendix A.8. + +![](images/732babce73ec6b0f670b5560b5400b1685becdb69296224c5b5229673577f400.jpg) +Figure 5: Tree diagram of mention predictions: this tree diagram breaks down predictions from the WangchanBERTa-sh model. It illustrates that a large chunk of prediction errors is from incorrect span predictions. + +# 7 Summary + +We present the first Thai N-NER corpus with 104 classes. It has 1,272,381 words, and 264,798 mentions. The size of our corpus is comparable to one of the large N-NER corpora in English. Unlike other Thai NER corpora, in addition to nested structure information, our dataset is annotated with fine-grained entity types to provide more detail of the named entities. This corpus addresses the data scarcity issue for Thai NLP. In addition, it allows NLP researchers to benchmark their methods in a multilingual setting. Moreover, this dataset allows researchers to explore the effect of long-tail distribution. We hope that our dataset will encourage researchers to include Thai in their benchmark and reduce the disparity between Thai and high resource languages. + +# Ethical Consideration + +Our dataset consists of raw text data from two publicly available corpora: Prachatai-67k and Wongnai review. These corpora use public copyright licenses (LGPL and Creative Commons) that en + +able free distribution. The data has a minimal risk for privacy violation since all the data were published in a public space, such as a news site and a restaurant review site. All the news articles and restaurant reviews are meant to be shared publicly, not privately. Hence, the dataset does not contain any confidential information. Our preprocessing step, which includes cleaning data and tokenization, does not alter the original contents of the texts. On average, the annotators were compensated at least twice the local minimum wage. The annotators were paid by the number of entity-mentions annotated and the number of documents that they have read. We distributed the same amount of documents for each annotator for fair consideration. This dataset addresses the data scarcity issue for Thai, which can be considered as a lower-resource language. However, this dataset only includes the central Thai dialect, which most Thai understand. It is also the dialect for official usage and is often used as a written language by Thai internet users. It reduces the language technology disparity gap between Thai and high-resource languages. In addition, it can facilitate researchers and the NLP community to investigate the N-NER task in a multilingual setting. We will open-source the dataset and distribute it publicly under the CC by SA 3.0 license. We will also publish the source code and the models' weights from our experiments to assist the NLP community in N-NER research and reduce unnecessary energy usage from training the models. + +# Acknowledgments + +We would like to thank team members from VISTEC-depa Thailand Research Institute and Hope Data Annotation. The Thai N-NER corpus is supported in part by the Digital Economy Promotion Agency (depa) Digital Infrastructure Fund MP-62-003 and Siam Commercial Bank. This dataset is released as scb-nner-th-2022. + +We also thank reviewers for their thoughtful reviews and suggestions. + +# References + +Wirote Aroonmanakun. 2002. Collocation and thai word segmentation. Proc. SNLP and Oriental CO-COSDA Workshop, 2002, pages 68-75. +Darina Benikova, Chris Biemann, and Marc Reznicek. 2014. NoSta-D named entity annotation for German: Guidelines and dataset. In Proceedings of the Ninth + +International Conference on Language Resources and Evaluation (LREC'14), pages 2524-2531, Reykjavik, Iceland. European Language Resources Association (ELRA). +Prachya Boonkwan, Vorapon Luantangsrisuk, Sitthaa Phaholphinyo, Kanyanat Kriengket, Dhanon Leenoi, Charun Phrombut, Monthika Boriboon, Krit Kosawat, and Thepchai Supnithi. 2020. The annotation guideline of lst20 corpus. arXiv preprint arXiv:2008.05055. +Pattarawat Chormai, Ponrawee Prasertsom, Jin Cheevaprawatdomrong, and Attapol Rutherford. 2020. Syllable-based neural Thai word segmentation. In Proceedings of the 28th International Conference on Computational Linguistics, pages 4619-4637, Barcelona, Spain (Online). International Committee on Computational Linguistics. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171-4186, Minneapolis, Minnesota. Association for Computational Linguistics. +George Doddington, Alexis Mitchell, Mark Przybocki, Lance Ramshaw, Stephanie Strassel, and Ralph Weischedel. 2004. The automatic content extraction (ACE) program - tasks, data, and evaluation. In Proceedings of the Fourth International Conference on Language Resources and Evaluation (LREC'04), Lisbon, Portugal. European Language Resources Association (ELRA). +Nguyen Thi Minh Huyen and Vu Xuan Luong. 2016. VLSP 2016 shared task: Named entity recognition. Proceedings of Vietnamese Speech and Language Processing (VLSP). +J-D Kim, Tomoko Ohta, Yuka Tateisi, and Jun'ichi Tsujii. 2003. Genia corpus—a semantically annotated corpus for bio-textmining. Bioinformatics, 19(suppl_1):i180-i182. +Hongyu Lin, Yaojie Lu, Xianpei Han, and Le Sun. 2019. Sequence-to-nuggets: Nested entity mention detection via anchor-region networks. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 5182-5192, Florence, Italy. Association for Computational Linguistics. +Lalita Lowphansirikul, Charin Polpanumas, Nawat Jantrakulchai, and Sarana Nutanong. 2021. Wangchanberta: Pretraining transformer-based thai language models. arXiv e-prints, pages arXiv-2101. +Ying Luo and Hai Zhao. 2020. Bipartite flat-graph network for nested named entity recognition. In Proceedings of the 58th Annual Meeting of the Asso + +ciation for Computational Linguistics, pages 6408- 6418, Online. Association for Computational Linguistics. +Pham Quang Nhat Minh. 2018. A feature-based model for nested named-entity recognition at vlsp-2018 ner evaluation campaign. Journal of Computer Science and Cybernetics, 34. +Huyen TM Nguyen, Quyen T Ngo, Luong X Vu, Vu M Tran, and Hien TT Nguyen. 2018. Vlsp shared task: Named entity recognition. Journal of Computer Science and Cybernetics, 34(4):283-294. +Wannaphong Phatthiyaphaibun, Korakot Chaova-vanich, Charin Polpanumas, Suriyawongkul Arhit, Lalita Lowphansirikul, and Pattarawat Chormai. 2016. PyThaiNLP: Thai Natural Language Processing in Python. +Barbara Plank, Kristian Nørgaard Jensen, and Rob van der Goot. 2020. DaN+: Danish nested named entities and lexical normalization. In Proceedings of the 28th International Conference on Computational Linguistics, pages 6649-6662, Barcelona, Spain (Online). International Committee on Computational Linguistics. +Charin Polpanumas and Wannaphong Phatthiyaphaibun. 2021. thai2fit: Thai language implementation of ulmfit. +Nicky Ringland, Xiang Dai, Ben Hachey, Sarvnaz Karimi, Cecile Paris, and James R. Curran. 2019. NNE: A dataset for nested named entity recognition in English newswire. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 5176-5181, Florence, Italy. Association for Computational Linguistics. +Yongliang Shen, Xinyin Ma, Zeqi Tan, Shuai Zhang, Wen Wang, and Weiming Lu. 2021. Locate and label: A two-stage identifier for nested named entity recognition. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 2782-2794, Online. Association for Computational Linguistics. +Takashi Shibuya and Eduard Hovy. 2020. Nested named entity recognition via second-best sequence learning and decoding. Transactions of the Association for Computational Linguistics, 8:605-620. +Jana Straková, Milan Straka, and Jan Hajic. 2019a. Neural architectures for nested ner through linearization. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 5326-5331. +Jana Straková, Milan Straka, and Jan Hajic. 2019b. Neural architectures for nested NER through linearization. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 5326-5331, Florence, Italy. Association for Computational Linguistics. + +Nutcha Tirasaroj and Wirote Aroonmanakun. 2009. Thai named entity recognition based on conditional random fields. In 2009 Eighth International Symposium on Natural Language Processing, pages 216-220. +Erik F. Tjong Kim Sang and Fien De Meulder. 2003. Introduction to the CoNLL-2003 shared task: Language-independent named entity recognition. In Proceedings of the Seventh Conference on Natural Language Learning at HLT-NAACL 2003, pages 142-147. +Christopher Walker, Stephanie Strassel, Julie Medero, and Kazuaki Maeda. 2006. ACE 2005 Multilingual Training Corpus LDC2006T06. https://catalog.ldc.upenn.edu/LDC2006T06. Linguistic Data Consortium. +Jue Wang, Lidan Shou, Ke Chen, and Gang Chen. 2020a. Pyramid: A layered model for nested named entity recognition. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 5918-5928, Online. Association for Computational Linguistics. +Yu Wang, Yun Li, Hanghang Tong, and Ziye Zhu. 2020b. HIT: Nested named entity recognition via head-tail pair and token interaction. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 6027-6036, Online. Association for Computational Linguistics. +Ikuya Yamada, Akari Asai, Hiroyuki Shindo, Hideaki Takeda, and Yuji Matsumoto. 2020. LUKE: Deep contextualized entity representations with entity-aware self-attention. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 6442-6454, Online. Association for Computational Linguistics. + +# A Appendix + +# A.1 Parameter Settings + +For all the deep learning baselines, we use the following parameter configuration: We employ Adam optimizer with a learning rate of 1e-5. We utilize a learning rate decay scheduler that reduces the learning rate every 50 epochs by multiplying the decay factor of 0.1. The maximum training epoch is 500, and we early stop if there is no improvement for 16 epochs. We use the last checkpoint for WanchanBERTa-sh and XLM-R-sh to evaluate, but for the WanchanBERTa-sp and XLM-R-sp, we use the epoch that model does not further improve when training. + +For the Locate and Label model, we made further modifications to the model to use it for the Thai language. Unlike the original work, the sequence length limitation of WangchanBERTa is lower than BERT-large version (Devlin et al., 2019), we use only ten words from each neighboring sentence as the context words to keep the input sequence length within the limitation. In addition, apart from contextualized word embeddings, Locate and Labels also includes static word embeddings-GloVE. We replace the GloVE word embeddings with the static word embeddings layer of thai2fit (Polpanumas and Phatthiyaphaibun, 2021). thai2fit was trained on wisesight-sentiment $^{6}$ , prachathai-64k $^{7}$ , and TH-wikipedia $^{8}$ . + +# A.2 Coarse-grained vs Fine-grained Scores + +Table 5 compares the WangchanBERTa-sh model's performances between the coarse-grained and fine-grained ground truths. We converted fine-grained labels to their respective coarse-grained labels to examine the negative effect from the ambiguity between fine-grained classes. Table 5 shows that there is a small gap between coarse-grained and fine-grained evaluations. It suggests that adding fine-grained information to the dataset does not introduce a major challenge for N-NER models. Nevertheless, errors from ambiguity between fine-grained classes still constitute a considerable amount of models' prediction errors. + +
ClassesCoarse-grainedFine-grained
PRF1PRF1
PER93.1477.6584.6991.0675.9582.82
LOC90.8274.4581.8388.1772.2979.44
DATE96.1287.5091.6195.9887.3791.47
ORG84.0760.0370.0476.0454.2463.32
NORP77.8534.9848.2774.2633.3546.03
FACILI.64.6937.6447.5960.6235.2744.60
EVENT48.0320.3328.5745.5219.2727.08
WOA69.6219.6430.6459.4916.7926.18
MISC83.2441.6655.5381.9841.0354.69
NUM94.6689.5092.0193.6888.5791.05
TOTAL91.3074.2481.8988.8772.2579.70
+ +Table 5: Fine-grained and coarse-grained evaluations of the WangchanBERTa-sh model + +![](images/0b7b1a5704a1a49d64a3f25a5c9b87ed823c610222db8f6d00f9bc623085fdab.jpg) +Figure 6: The annotation scheme does not allow overlapping between entities in the same layer. + +# A.3 Issue with Overlapped Annotations + +Similar to a morphological parse tree, a nested entity annotation structure does not allow overlapping between entities in the same depth level. For example, in Figure 6, $\text{韋}$ $\text{韋}$ $\text{韋}$ $\text{韋}$ $\text{韋}$ $\text{韋}$ $\text{韋}$ $\text{韋}$ $\text{韋}$ $\text{韋}$ $\text{韋}$ $\text{韋}$ (ro:η kho:sok pratcam sāmnak na:jok.ratt'amontri:) 'Deputy Spokesperson of the Office of the Prime Minister' is the first level of the nested named entity mention. + +In the second layer, we do not allow an annotator to tag `rəwɪdʒuŋʌsɪvɪnɪnɪnɪvɪn (rɔːŋ kʰɔːsɒk prɑtcam šaɪnák. naːjʊk) 'Deputy Spokesperson of the Office of the PM' with a role tag and `aɪnɪnʌnɪnɪnɪnɪnɪn (sʌmnaɪk. naːjʊk. rænthəmɒntri:) 'Office of the Prime Minister' with a government tag, because it creates two chunks that share the word `aɪnɪnɪnɪnɪn (sʌmnaɪk. naːjʊk) which is a abbreviated form of 'Office of the Prime Minister'. This would violate the tree structure. In addition, annotating `rəwɪdʒuŋʌsɪvɪnɪnɪnɪnɪvɪn (rɔːŋ kʰɔːsɒk prɑtcam šaɪnák. naːjʊk) 'Deputy Spokesperson of the Office of the PM' as an instance of named entity suggests that 'Deputy Spokesperson of the Office of the PM' + +
ModelsACE-2004ACE-2005GENIANNE
PRF1PRF1PRF1PRF1
Second-best-learning85.2384.7284.9783.3084.6983.9977.4676.6577.05---
Pyramid87.7187.7887.7485.3087.4086.34---94.3095.0794.68
Locate and label87.4487.3887.4186.0987.1786.6780.1980.8980.54---
+ +Table 6: The performances of the recent SOTA N-NER models on English datasets, we include the performances from their original papers. + +is a noun phrase and $\tilde{\mathfrak{z}}\tilde{\mathfrak{u}}\tilde{\mathfrak{u}}\tilde{\mathfrak{v}}$ (ratt'amontri:) 'Minister' is a noun modifier, which is semantically incorrect. As far as compositional semantics is considered, the nested structure of named entities should not contain overlapping entities in the same level. + +# A.4 Annotation Experience Improvement with Syllable Segmentation + +Syllable segmentation enhances the annotation experience since there are fewer choices than selecting named-entity boundaries at character-level. In addition, Thai syllable segmentation also has a near-perfect accuracy which makes it more suitable word segmentation. + +For example, given an input text uuyuun (Mr.Makata Arvasa), the syllable-segmented output is u|u|u|u|u|u and the word-segmented output from a standard word tokenizer is u|u|u|u|u|u + +Since $\mathfrak{w}$ is a title word, we can find the NE's span from syllable tokens $\mathfrak{w} \rightarrow \mathfrak{w}$ . However, we cannot recover from a word segmentation error $\mathfrak{w} \rightarrow \mathfrak{w}$ . + +As for the dataset, we present the word-level version because it is a common preprocess technique. We combine the results from word segmentation with the NE boundaries from annotators to ensure that the boundaries for NEs are guaranteed to be correct. + +# A.5 Annotation Verification Process + +CoNLL: we format our dataset according to the CoNLL schema, then calculate the Cohen's Kappa by comparing agreements of annotated entities layer by layer. The CoNLL schema takes the mention's token length into account. For each disagreed mention, we count each disagreed token as one disagreement. Therefore, mentions with more token length may have more disagreement counts. In addition, if there is a mismatch within the same layer, we count it as a disagreement even though the annotations might agree if we were to compare them from different layers. + +Pyramidal: we format the labels in a pyramidal + +manner, where we generate all possible n-gram entity span candidates for each text sequence and assign them to layers according to their lengths in the same fashion as the Pyramid model (Wang et al., 2020a). Then we compare agreements of annotated candidates between the two annotated data. We calculated the score on both character level and token level, and found no difference. We report the score on the token level. Pyramidal scheme counts each disagreed mention as one disagreement despite its length. Since Thai has no word boundary, the pyramid scheme always provides a consistent score despite using it on a different word segmentation that varies the token length. + +# A.6 The Performances of the Recent SOTA N-NER Models on English Datasets + +This study compares the performances of the N-NER models between Thai and English N-NER datasets. Table 4 shows the results on the Thai N-NER dataset, and Table 6 shows the results on English N-NER datasets. We can see that, when compared to the English results, all N-NER models performed poorer on the Thai dataset. For example, the F1-score of Pyramid on the NNE dataset (the most similar dataset compared to our work) is $94.68\%$ , while the overall F1-score of Pyramid for Thai N-NER is only $78.50\%$ . Although both datasets are similar in size, design, and diversity of entity classes, the performance gap is $16.18\%$ . Experimental results verify that there is a performance gap between Thai and English N-NER. + +Furthermore, some model is based on the BERT-large model, but Thai has only one BERT-based pretrained model which is based on RoBERTa (WangchanBERTa). This may have a direct affect on the performance gap. For example, the Locate and Label is based on the BERT-large model; replacing BERT-large with WangchanBERTa can effect the performance directly. Despite having the best performances across multiple English N-NER datasets, Locate and Label has the lowest score on the Thai N-NER dataset when compared to other SOTA models. + +# A.7 Mention Distribution + +Table 7 shows the mention frequency of each fine-grained entity type in our corpus before the train-test split. For each nested structure, we count all annotated mentions, not just the outermost mention. This table reveals classes with extremely low frequency which contribute to poor performances on the tail part of the long-tailed distribution. + +# A.8 Error Analysis + +Incorrect span prediction: mismatches between the length of the predicted spans and the ground truths contribute to a large chunk of prediction errors. + +Figure 5 shows that out of 47,923 predicted mentions, 5,334 are incorrect. 3,103 out of 5,334 incorrect predicted mentions are due to the fact that the positions of the predicted spans are not correctly aligned with the positions of the ground truths. Often, we can find this error in the predictions for entity mentions that are very long. For example, consider the following text segment: + +(1) 6 +?a:ka:n. ratt'aprasa:tsanaphakdi: tch an hok building Ratthaprasatsanaphakdi floor 6 +nnu uu uu uu +t'anon. tce:eta.watt'ana kwe: +road chaengwatthana subdistrict +nuuovuovu uu uu +t'unsoohoi kht. lak.si: +thungsonghong district laksi +nuuwwuuvu +kru'te:p.maha..na.ko:n +Bangkok +10210 +nuu.su:n.sso.nuu.su:n +10210 +Ratthaprasasanabhkdi Building, 6th Floor, Chaeng Watthana Road, Thung Song Hong Subdistrict, Lak Si District, Bangkok 10210 + +This large text segment is just one entity span for the address class. If a N-NER model yields a predicted span that does not cover the whole text segment, even by just one word, then we consider the prediction as incorrect. + +Ambiguous entity mentions: models may fail to disambiguate entity mentions that can belong to different classes depending on the context. For example, "English" can be tagged with different classes such as Language, National, or Location depending on the context. + +We use normalized class distribution entropy to quantify the effect of ambiguous entity mentions. We investigate entity mentions that can appear as different classes in the training set and calculate their entropy according to their class distribution in the training set. Then we measure the error rates of these mentions in the test set. We split entity mentions into three bins according to their entropy values: [0, 0.33), [0.33, 0.66), [0.66, 1.0]. We found that the average error rates of the three bins are as follows: $23.43\%$ , $37.07\%$ , and $69.28\%$ , respectively. This confirms that ambiguity of entity mentions has a deleterious effect on the N-NER model. + +Ambiguity between fine-grained classes: there are fine-grained classes that have subtle differences in meaning between them and often appear in similar contexts. For example, the government tag refers to governmental organizations such as, government departments, while org:political refers to political organizations, such as political parties and advocacy groups. + +As mentioned in Appendix A.2, using coarse-grained ground truths to evaluate can reveal the detrimental effect of ambiguity between fine-grained classes. There are 1,160 mentions that would be predicted correctly, if we were to use coarse-grained ground truths instead. + +Scarcity of training samples: there are some classes that models do not give any prediction because the number of training samples is too low, for example, food:ingredient, vehicle, org:religious, periodic, and station. As a result, all models have a tendency to generate false negatives more than false positives. This is the issue we mentioned in Section 5.3. Moreover, the best Thai N-NER model, WangchanBERTa-sh, tends to produce more predictions for the head classes, accounting for $80\%$ of the mention distribution, than body and tail classes. + +
ClassesCounts%ClassesCounts%ClassesCounts%
cardinal3045711.502norp:others10570.399airport1660.063
person163586.178army10510.397song1460.055
firstname148965.625percent10260.387middlename1340.051
unit140695.313disease8260.312mountain1260.048
government137635.198product:food6780.256namemod1230.046
country119794.524religion6750.255station1150.043
title117664.443nickname6250.236award1110.042
role113664.292language6070.229film1060.040
last103153.895state5910.223weight1020.039
month96023.626book5390.204ocean890.034
province91413.452restaurant5030.190port780.029
day85853.242continent4800.181energy740.028
date80963.057fund4140.156space670.025
year75692.858river4130.156product:drug640.024
quantity70642.668address4050.153animate620.023
org:political57962.189pseudo name4020.152sports-event510.019
media55602.100weapon4020.152fold490.019
org:other44491.680hospital3910.148woa480.018
loc:others42001.586electronics3760.142stadium450.017
facility:others38521.455jargon3470.131sports-team440.017
district38001.435natural-disaster3460.131band420.016
org:edu36971.396distance3310.125season370.014
duration32301.220building3020.114war370.014
law31441.187island2980.113museum370.014
orgcorp29291.106animal-species2910.110stock-exchange360.014
rel29201.103sciname2900.110god310.012
nationality28761.086food:ingredient2810.106game240.009
norp:political26821.013tv-show2570.097postcode170.006
time26430.998vehicle2430.092temperature110.004
money20550.776hotel2100.079longitude80.003
city18670.705nicknametitle2090.079latitude70.003
event:others18530.700periodic2040.077index50.002
subdistrict17380.656org:religious2040.077speed50.002
mult15420.582soi2000.076concert20.001
roadname11950.451bridge1710.065Total264,798
+ +Table 7: The distribution of entity types in our corpus along with their frequency. \ No newline at end of file diff --git a/thainestednamedentityrecognitioncorpus/images.zip b/thainestednamedentityrecognitioncorpus/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..9f4e68c8f700cc57248907ceec545d5d5520a3a9 --- /dev/null +++ b/thainestednamedentityrecognitioncorpus/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:deb7a9dee4a76e1a67a692e0c8ed679fa1df6480d7ed4389b5b4d7141a9802ee +size 759075 diff --git a/thainestednamedentityrecognitioncorpus/layout.json b/thainestednamedentityrecognitioncorpus/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..ac58c27938e14a9d4975ceb0030f566c16de6509 --- /dev/null +++ b/thainestednamedentityrecognitioncorpus/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:58b8a49851eec7089ac432ac00d89c70f070629155689d383d4e7eb33e4822b5 +size 384866 diff --git a/thechangethatmattersindiscourseparsingestimatingtheimpactofdomainshiftonparsererror/d6cbedcb-5e44-4937-b2cd-b0bbad0f761f_content_list.json b/thechangethatmattersindiscourseparsingestimatingtheimpactofdomainshiftonparsererror/d6cbedcb-5e44-4937-b2cd-b0bbad0f761f_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..8608907deb5bbf26cc8d26ad67bfc48b403d9889 --- /dev/null +++ b/thechangethatmattersindiscourseparsingestimatingtheimpactofdomainshiftonparsererror/d6cbedcb-5e44-4937-b2cd-b0bbad0f761f_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c48586bc589ce1659516839172f0e829cfc00798c7c5fc8c3eb242978a2e832b +size 126967 diff --git a/thechangethatmattersindiscourseparsingestimatingtheimpactofdomainshiftonparsererror/d6cbedcb-5e44-4937-b2cd-b0bbad0f761f_model.json b/thechangethatmattersindiscourseparsingestimatingtheimpactofdomainshiftonparsererror/d6cbedcb-5e44-4937-b2cd-b0bbad0f761f_model.json new file mode 100644 index 0000000000000000000000000000000000000000..03bc8691b69c3d6fa822c4a5b4e8b9892ccf531d --- /dev/null +++ b/thechangethatmattersindiscourseparsingestimatingtheimpactofdomainshiftonparsererror/d6cbedcb-5e44-4937-b2cd-b0bbad0f761f_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:77b9dd7898e51fb7a8a835f3bc75d2c4ae4057301d162bae04b61b52178b2042 +size 153426 diff --git a/thechangethatmattersindiscourseparsingestimatingtheimpactofdomainshiftonparsererror/d6cbedcb-5e44-4937-b2cd-b0bbad0f761f_origin.pdf b/thechangethatmattersindiscourseparsingestimatingtheimpactofdomainshiftonparsererror/d6cbedcb-5e44-4937-b2cd-b0bbad0f761f_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..dd4ea36933ad0a562cb21f80487ef6b5ee86fce3 --- /dev/null +++ b/thechangethatmattersindiscourseparsingestimatingtheimpactofdomainshiftonparsererror/d6cbedcb-5e44-4937-b2cd-b0bbad0f761f_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:359264ab9d628a370f5ffb1dc4ce856609677414192f648dfe0c778a46f4118b +size 894082 diff --git a/thechangethatmattersindiscourseparsingestimatingtheimpactofdomainshiftonparsererror/full.md b/thechangethatmattersindiscourseparsingestimatingtheimpactofdomainshiftonparsererror/full.md new file mode 100644 index 0000000000000000000000000000000000000000..2a3a9671aaeaf5e150146797c3c52ee93206d3bc --- /dev/null +++ b/thechangethatmattersindiscourseparsingestimatingtheimpactofdomainshiftonparsererror/full.md @@ -0,0 +1,489 @@ +# The Change that Matters in Discourse Parsing: Estimating the Impact of Domain Shift on Parser Error + +Katherine Atwell†*, Anthony Sicilia‡*, Seong Jae Hwang§, Malihe Alikhani†‡ +†Department of Computer Science and ‡Intelligent Systems Program, University of Pittsburgh §Department of Artificial Intelligence, Yonsei University {kaa139, anthonysicilia}@pitt.edu, seongjae@yonsei.ac.kr, malihe@pitt.edu + +# Abstract + +Discourse analysis allows us to attain inferences of a text document that extend beyond the sentence-level. The current performance of discourse models is very low on texts outside of the training distribution's coverage, diminishing the practical utility of existing models. There is need for a measure that can inform us to what extent our model generalizes from the training to the test sample when these samples may be drawn from distinct distributions. While this can be estimated via distribution shift, we argue that this does not directly correlate with change in the observed error of a classifier (i.e. error-gap). Thus, we propose to use a statistic from the theoretical domain adaptation literature which can be directly tied to error-gap. We study the bias of this statistic as an estimator of error-gap both theoretically and through a large-scale empirical study of over 2400 experiments on 6 discourse datasets from domains including, but not limited to: news, biomedical texts, TED talks, Reddit posts, and fiction. Our results not only motivate our proposal and help us to understand its limitations, but also provide insight on the properties of discourse models and datasets which improve performance in domain adaptation. For instance, we find that non-news datasets are slightly easier to transfer to than news datasets when the training and test sets are very different. Our code and an associated Python package are available to allow practitioners to make more informed model and dataset choices.1 + +# 1 Introduction + +Coherence analysis of text is a key area of natural language processing. Discourse parsing models are trained on a dataset annotated according to a discourse framework, wherein the discourse structure and how the discourse units are connected + +![](images/80f3e1bd58048617e79ab2621abe237a4af2b0bdb46801336405a3848264195f.jpg) +Figure 1: Solid/hollow shapes indicate training/test set, while circles/squares indicate the correct labels. (A) Vertical shift is easily identified, but the classifier (dotted line) does well on both domains. (B) In the feature space, shift is imperceptible, but the classifier assigns the incorrect relation label to each point in the test set. In both, identifiable shift does not correlate with the classifier's ability to correctly predict the discourse relation + +![](images/ba69bb123b77feb02a3af13c97ac1a7fbe28f9fa04f94543d13061fccbd41c3c.jpg) + +are identified and labeled. Some discourse frameworks (Miltsakaki et al., 2004; Prasad et al., 2008; Webber et al., 2019) focus on shallow relations between two individual discourse units, while others (Carlson et al., 2001; Lascarides and Asher, 2008) focus on learning a more hierarchical structure. Discourse models have been shown to improve performance in several fundamental NLP tasks, such as summarization (Marcu, 1999, 2000; Cohen et al., 2018), sentiment analysis (Bhatia et al., 2015), machine comprehension (Narasimhan and Barzilay, 2015), and machine translation (Guzmán et al., 2014). However, in some cases, using discourse relations themselves has been found not to improve, or even to hurt, performance in other tasks when learning the coherence structure of text seems critical (Zhong et al., 2020; Feng, 2015). There are several possible reasons for this: due to the difficulty of the annotation task, datasets labeled with these discourse relations are typically small, and the most widely used datasets consist only of news texts. As a result, the performance of discourse models trained on these datasets is very low, and even slight domain shift has been shown to worsen + +the performance (Atwell et al., 2021). Thus, for the task of discourse parsing, it is especially important to be cognizant of the effects of domain shift, and choose models and training datasets that are likely to generalize well on the target domain. + +To estimate the extent of a model's generalizability on a particular train/test pair, common proposals suggest using two-sample statistics which capture distributional shift in the feature space (Rabanser et al., 2019). However, the working hypothesis of this paper is that changes in feature-distribution do not necessarily equate to changes in a classifier's error; i.e., from train to test sample. Figure 1 captures this idea by illustrating some examples in simple 2D-space where domain shift may occur without high error, and vice versa, in the context of discourse parsing. + +Motivated by this hypothesis, we look to existing theoretical domain adaptation literature. We propose to use a statistic which has not only been designed to incorporate information about the classifier we would like to transfer, but has also been shown (theoretically) to directly relate to model performance on the test set. Namely, we consider generalization of the source-guided discrepancy (Kuroki et al., 2019) which we call the $h$ -discrepancy defined for any classifier $h$ (we introduce and define this metric in Section 4). We provide novel theoretical analysis of the errors of this statistic in estimating adaptation performance and, based on this, hypothesize this statistic will correlate more substantially with the classifiers' generalization ability than the two-sample statistics previously mentioned. We support this hypothesis by illustrating these correlations across several different widely-used discourse datasets (described in Section 3). We also provide a detailed empirical analysis of the estimation error of this statistic in predicting adaptation performance using a regression model. In doing so, we provide insights on the effect of various properties of different discourse models and datasets on performance in domain adaptation, which we enumerate in Section 6. We expand on these contributions next. + +First, we contribute a new theoretical analysis to characterize the bias of the $h$ -discrepancy as an estimator of performance in domain adaptation. Although this discrepancy is typically biased, we provide upper and lower bounds on this bias and interpret them to provide insight on the use of this statistic in practice. In particular, we show that a + +small $h$ -discrepancy often means the practitioner can be confident in transferring the model from the train- to the test-set. Our theoretical analysis motivates our hypothesis that the $h$ -discrepancy should outperform common two-sample statistics. + +Next, we empirically study the aforementioned hypothesis. We compare correlation of the $h$ -discrepancy with performance in domain adaptation against correlation of various two-sample statistics across multiple discourse datasets. As we are aware, this large-scale comparison has never been done for discourse relation classification. As mentioned above, the results of this analysis provide support for our hypothesis that the $h$ -discrepancy is the best estimator of performance changes under domain shift. As such, we argue that computational discourse practitioners should use this statistic to determine the model/dataset likely to maximize performance under domain shift. + +We also perform a regression analysis of the estimation errors of the $h$ -discrepancy as an estimator for domain adaptation performance. This analysis allows us to understand the properties and pitfalls of our estimator. Further, it allows us to gain useful insights into how different types of datasets, genres, feature representations, and models influence the generalizability of discourse parsers. We enumerate these insights and discuss their implications for discourse researchers in Section 5. + +In the sections below, we further discuss and motivate the need for domain-adaptation bounds tied directly to the error gap for more informed insights into performance gaps under domain shift. We hope that discourse researchers use our results, and our code, as a starting point for model and dataset selection in their own studies. + +# 2 Related Work + +# 2.1 Discourse and Domain Shift + +Computational analysis of discourse has been the focus of several shared tasks (Xue et al., 2015, 2016; Zeldes et al., 2019, 2021), and there have been several discourse-annotated corpora for multiple languages (Zeyrek and Webber, 2008; Meyer et al., 2011; Danlos et al., 2012; Zhou and Xue, 2015; Zeyrek et al., 2020; da Cunha et al., 2011; Das and Stede, 2018; Afantenos et al., 2012). Despite their widespread use, implicit sense classification remains a challenging task (Liang et al., 2020), and discourse models have been shown not to perform well under even gradual domain shift + +(Atwell et al., 2021), which may be the result of the limited timeframe and distribution of the articles contained in the most commonly used English discourse datasets, the Penn Discourse Treebank (Miltsakaki et al., 2004; Prasad et al., 2008; Webber et al., 2019) and the RST Discourse Treebank (RST-DT) (Carlson et al., 2001). These datasets are both made up of Wall Street Journal articles spanning a three-year period, and thus do not contain much variation with respect to linguistic distribution. + +Several works have quantified domain shift in the context of natural language processing, mostly in the task of sentiment analysis. For instance, Plank and van Noord (2011) use word frequencies and topic models to measure domain similarity, while Wu and Huang (2016) use sentiment graphs. In contrast, ours is the first to consider quantifying domain shift in discourse analysis. With respect to our methodology, some works take a similar approach. Blitzer et al. (2007) and Elsahar and Galle (2019) also use a statistic from domain adaptation theory, employing the $\mathcal{H}$ -divergence to analyze a sentiment classification task on the Amazon Reviews dataset, while Ruder et al. (2017) use $\mathcal{H}$ -divergence to select the source datasets for transfer. However, none of these works have studied the $h$ -discrepancy we study here, which is dependent on the classifier used for inference. In comparison, the $\mathcal{H}$ -divergence ignores information about the model we would like to transfer, and therefore, will be less sensitive (e.g., in model-selection contexts). + +To the best of our knowledge, no works have yet studied the correlation of statistics from the theoretical domain adaptation literature with the adaptation performance of discourse parsers. This is especially true given the wide array of different datasets and distributional shifts we consider as well as the theoretical and empirical tools we propose to conduct our study. Both our novel theoretical result (Theorem 1) and our large-scale regression analysis (Section 5), provide new, practical insights on domain-shift in discourse parsing. + +# 2.2 Domain Adaptation Theory + +Statistics that relate to domain adaptation performance have long been studied in the theoretical literature. Kifer et al. (2004); Ben-David et al. (2007, 2010a) initiate this investigation with a modification of the total variation distance (the $\mathcal{H}$ -divergence) that depends on the set of classifiers $\mathcal{H}$ ; this statistic can be directly related to adaptation + +performance through a finite sample bound. Mansour et al. (2009) extend this discussion from classification error to general loss functions. Certain two-sample statistics can also be related to adaptation performance through finite sample bounds, but only under stringent assumptions on the space of classifiers and the computation of the two-sample statistic (Fukumizu et al., 2009; Gretton et al., 2012; Long et al., 2015; Redko et al., 2020). + +Assumptions, in general, play a large role in successful domain adaptation. In fact, common adaptation algorithms can actually worsen performance if important assumptions are not met (Zhao et al., 2019; Wu et al., 2019). Different assumptions have led to diverse theories disjoint from the $\mathcal{H}$ -divergence, including proposals of Lipton et al. (2018), Johansson et al. (2019), and Tachet des Combes et al. (2020). Under certain strict and untestable assumptions, it is even possible to derive unbiased estimators of adaptation performance (Sugiyama et al., 2007; You et al., 2019). We later discuss our own assumptions on the adaptability $\lambda$ which are typical when using the $\mathcal{H}$ -divergence and its descendants. We find these assumptions to be comparatively mild. In comparison to some others, they have also been theoretically argued to be of vital importance (Ben-David et al., 2010b). + +# 3 Methods + +Data Our English datasets are all based on either the RST Discourse Treebank or Penn Discourse Treebank frameworks, which we describe in Appendix A. Table 1 summarizes differences between the datasets we use in our experiments. + +Features For each discourse relation, we encode the argument pair as features. For the RST-DT and GUM corpus, we thus only use discourse relations between two EDUs. To encode argument pairs, we concatenate and tokenize them using the BERT (Devlin et al., 2019) tokenizer. We then feed these tokens through the pretrained base BERT model and experiment with two different ways of capturing the model output: using the pooled output, e.g. the output of the [CLS] token, and averaging the hidden states. We will refer to these encodings as P-BERT and A-BERT respectively. We also experiment with encoding our argument pairs using SentenceBERT (Reimers and Gurevych, 2019) which we will refer to as S-BERT. + +
DatasetGenreLabel schema
RST-DT (Carlson et al., 2001)NewsRST-DT
PDTB 2.0 (Prasad et al., 2008)NewsPDTB
PDTB 3.0 (Webber et al., 2019)NewsPDTB
BioDRB (Ramesh and Yu, 2010)BioPDTB
TED-MDB (Zeyrek et al., 2020)TED talksPDTB
GUM (Zeldes, 2017)MultipleRST-DT
+ +Table 1: Characteristics of each discourse dataset used in our study. The "multiple" domains in the GUM corpus are as follows: Academic, Biography, Fiction, Interview, News, Reddit,Travel,and How-to guides.The main distinction between the PDTB-2 and PDTB-3 is the presence of intra-sentential implicit discourse relations in the PDTB-3. + +Label Set For the datasets with the PDTB label schema, we use only the top-level sense labels (Expansion, Contingency, Comparison, and Temporal). We use the top-level RST-DT classes for the datasets with the RST-DT label schema, and map the GUM corpus classes to the RST-DT classes using Braud et al. (2017). We recognize this mapping will not be perfect, as mappings between frameworks rarely are, but we follow the mapping with empirical support from Demberg et al. (2017) and focus on the predicting top-level relations between two discourse units. As a consequence, we expect to observe distinct labeling functions (i.e., annotator decisions) across domains from separate discourse frameworks. + +Experiments Each data point in all of our results (e.g., when computing correlation or doing regression analysis) corresponds to a particular experiment done on a source (train) dataset $S$ and target (test) dataset $T$ using a classifier $h$ . The classifier $h$ is trained on the source $S$ and evaluated on target $T$ . This is meant to mimic a common domain adaptation scenario in which the NLP practitioner would like to transfer a pre-trained discourse classification model to a new unlabeled dataset (i.e., this is discussed again in Section 4). For each experiment, $h$ is trained using a standard optimization procedure to have low error on $S$ . We discuss this procedure and its competitiveness with respect to the state-of-the-art in Section 5. + +For each dataset, we randomly split the dataset in half based on 3 different seeds. For example, PDTB 2.0 (10K examples) is randomly split into to + +disjoint sets of about 5K examples. The pair $S$ and $T$ are taken from the set of these splits using each of the different BERT representations. We restrict the pair to have a common set of discourse labels. For example, we only transfer from $S$ using the PDTB label schema to $T$ using the same schema. + +For experiments involving PDTB label schema, we consider single-source domain adaptation, which simply pairs one data split $S$ with another $T$ . For instance, the first half of the TED-MDB and the second half of the BioDRB, or, the first half of BioDRB and the second half of BioDRB. + +For experiments involving RST-DT label schema, we use both single-source and multisource domain adaptation setups. We use the multisource setup for domains in the GUM corpus. Here, $T$ is derived from a single domain and $S$ from all of the other domains contained in the corpus (i.e., $S$ would contain 7 of the GUM domains and $T$ would contain the remaining one). Although we continue to split the domains in half, we only use one of the halves in this case to prevent samples from the target distribution from appearing in the source. We use the single-source setup for RST itself. Here, $S$ is one split of RST while $T$ is another. + +Importantly, experimenting with this variety of setups allows us to simulate variability arising from sampling as well as study different degrees of domain shift. Accounting for each pair and each random seed for model training, the number of $(S,T,h)$ triples we study totals more than 2400. + +# 4 Quantifying Meaningful Domain Shift + +Identifying and quantifying domain shift is a classical problem. Perhaps, the most widely used mechanism for this task is the two-sample test; i.e., a test designed to indicate difference of distribution between two samples. We begin this section by discussing a few of the statistics used in these tests. We observe a common problem in using these statistics to predict adaptation performance, and following this, discuss the aforementioned $h$ -discrepancy. + +# 4.1 Common Two-Sample Test Statistics + +We now informally discuss some common statistics used in two-sample tests. These statistics can be easily adapted to infer adaptation performance under the assumption that changes in distribution perfectly correlate with changes in error. As mentioned earlier, we do not agree with this hypothesis. Still, these types of statistics serve as a good point + +of comparison. In our experiments, we compute each of these statistics using the PyTorch library torch_two_sample (Cruceru et al., 2020). + +- FRS: (Friedman and Rafsky, 1979) counts edges from $S$ to $T$ in a graph representation. +- Energy: (Székely and Rizzo, 2013) compares dissimilarity of points within/across $S$ and $T$ . +- MMD: (Gretton et al., 2012) compares similarity of points within/across $S$ and $T$ . +- BBSD: (Lipton et al., 2018) applied MMD to softmax output (i.e., scores) of classifier $h$ . + +For more computational details, see Appendix C. + +A Common Problem The majority of these statistics share the common trait that they were originally designed to test differences in feature distribution – not differences in hypothesis error. As such, while we do expect them to be sensitive to changes in error – in so far as changes in feature distribution relate to changes in error – we have no theoretical reason to expect this should be the case. As we saw in Figure 1, these two changes can be very different: large changes to the distribution of features may not hurt performance in every case and imperceptible changes to the distribution of features can have large impact when the labeling function changes. In fact, most of these statistics do not even incorporate information about the classifier we use for inference. While BBSD does, we are not aware of any theoretical arguments linking it to adaptation performance in the same way as the $h$ -discrepancy (discussed next). + +# 4.2 Identifying the Change that Matters + +Contrary to those statistics described above, the statistic we give in this section is directly related to adaptation performance by theoretical means. Before beginning our description of this metric, we need to formalize our mathematical setup and a particular notion of adaptation performance. + +Mathematical Setup We measure adaptation performance through the error-gap which is defined: + +$$ +\Delta_ {h} (S, \mathbb {T}) = | \mathbf {R} _ {S} (h) - \mathbf {R} _ {\mathbb {T}} (h) | \tag {1} +$$ + +where $S$ is a sample and $\mathbb{T}$ is a distribution - both over a space $\mathcal{X} \times \mathcal{Y}$ . In this paper, $\mathcal{X}$ is usually the space of real-valued vectors (i.e., BERT representations for argument pairs) and $\mathcal{Y}$ corresponds to a set of possible discourse labels. $h$ is a classifier $h: \mathcal{X} \to \mathcal{Y}$ and the risk $\mathbf{R}_{\mathbb{D}}(h)$ is defined for distribution $\mathbb{T}$ as $\mathbf{R}_{\mathbb{T}}(h) = \mathbf{Pr}(h(\tilde{X}) \neq \tilde{Y}), (\tilde{X}, \tilde{Y}) \sim$ + +$\mathbb{T}$ . For sample $S = (X_{i},Y_{i})_{i = 1}^{n}$ , we instead write $\mathbf{R}_S(h) = n^{-1}\sum_i1[h(X_i)\neq Y_i]$ where $1[\cdot ]$ is the indicator function. To compute each statistic which we would like to use to infer the error-gap, we assume access to the mentioned sample $S$ drawn i.i.d from some distribution $\mathbb{S}$ . We also assume access to a new unlabeled sample $T_{X} = (\tilde{X}_{i})_{i = 1}^{m}$ drawn i.i.d from the $\mathcal{X}$ -marginal $\mathbb{T}_X$ of the distribution $\mathbb{T}$ . In general, we do not know whether $\mathbb{T}\neq \mathbb{S}$ or $\mathbb{T} = \mathbb{S}$ , but may have reason to suspect $\mathbb{T}\neq \mathbb{S}$ . + +Roadmap In the next part, we give the statistic we would like to use to predict adaptation performance. We then quantify its bias as an estimator for the error-gap with a theoretical result. We also propose a technique to study the relationship between this statistic and the error-gap empirically through a regression analysis. Finally, we show how this technique can be used to study the impact certain attributes of a model or dataset have on error-gap. + +Source-Guided Discrepancy The source-guided discrepancy was proposed by Kuroki et al. (2019) with a similar conceptualization given independently by Zhang et al. (2019). These statistics improve upon a long history of domain adaptation statistics (Kifer et al., 2004; Blitzer et al., 2007; Ben-David et al., 2007, 2010a), specifically, by incorporating information on the source-labels. We consider a generalization of the source-guided discrepancy which we call the $h$ -discrepancy, defined for any classifier $h$ . For samples $S$ and $T_X$ , a binary label space $\mathcal{V}$ , a space of classifiers $\mathcal{H}$ over $\mathcal{X} \times \mathcal{Y}$ , and any fixed classifier $h \in \mathcal{H}$ , it is defined as: + +$$ +\begin{array}{l} D = \max _ {g \in \mathcal {H}} | \mathbf {R} _ {U} (g) - \mathbf {R} _ {V} (g) | \quad \text {w h e r e} \\ U = \left(\left(X _ {i}, h \left(X _ {i}\right)\right) _ {i = 1} ^ {n}, \quad V = \left(\left(\tilde {X} _ {i}, h \left(\tilde {X} _ {i}\right)\right) _ {i = 1} ^ {m}, \right. \right. \tag {2} \\ \end{array} +$$ + +and recall, $S_{X} = (X_{i})_{i}$ and $T_{X} = (\tilde{X}_{i})_{i}$ . In the binary case, Kuroki et al. (2019) show that this may be approximated by learning a classifier (i.e., $g$ ) which agrees with $h$ on the source sample $S_{X}$ and disagrees with $h$ on the target sample $T_{X}$ . Their procedure extends naturally to the multi-class case as well, but we must disambiguate between the possible ways in which $g$ can disagree with $h$ . In our experiments, we do so by training $g$ to pick the next most likely label according to the scores of $h$ . For a better approximation, one should compute $D$ again, reversing the roles of $S / T$ and taking the larger of the values as the final result. With binary + +labels, the two values will often coincide, but this should not be assumed in multi-class settings. + +Theoretical Motivation Here, we provide our primary motivation for the $h$ -discrepancy as an estimator of error-gap. Our result makes use of the work of Crammer et al. (2007), Ben-David et al. (2010a), and Kuroki et al. (2019). It distinguishes itself from these finite sample bounds in that it explicitly concerns itself with the bias of $D$ as an estimator of error-gap. Proof is given in Appendix D. + +Theorem 1. Let $\mathcal{V}$ be a binary space and let $\mathcal{H}$ be a subset of classifiers in $\mathcal{V}^{\mathcal{X}}$ . Then, for any realization of $S$ , for all $h \in \mathcal{H}$ , + +$$ +- \mathbf {E} _ {T} [ \lambda ] \leq \mathbf {E} _ {T} [ D ] - \Delta_ {h} (S, \mathbb {T}) \leq \mathbf {E} _ {T} [ D ] \tag {3} +$$ + +where $\lambda = \min_{h' \in \mathcal{H}} \mathbf{R}_S(h') + \mathbf{R}_T(h')$ . + +Notice, when $\mathbf{E}[\lambda]$ is small and $\mathbf{E}[D]$ is also small we know the bias must be small because it is "sandwiched" between these two. In this situation, the practitioner can very confidently transfer $h$ from $S$ to $T$ . In practice we cannot compute $\lambda$ since it requires labels from $T$ , still we often expect $\mathbf{E}[\lambda]$ to be small. In particular, this term is often called the adaptability as it captures irreconcilable differences between the source and target labeling functions. In discourse, such differences are primarily determined by the discourse framework and annotator. As first observed by Ben-David et al. (2010a) (i.e., concerning a similar term), $\lambda$ is small whenever there is any classifier in $\mathcal{H}$ which does well on $S$ and $T$ simultaneously. If $S$ and $T$ come from the same discourse framework, this should not be difficult for sufficiently complex $\mathcal{H}$ . Even if $S$ and $T$ come from distinct discourse frameworks, this is still not an overly strong requirement because neural-networks, for example, have been shown to perfectly fit even random labeling (Zhang et al., 2016). Thus, in many cases, $^3$ we are primarily concerned with the positive bias of $D$ . When $\mathbf{E}[D]$ is larger, the positive bias of $D$ can also be larger. Intuitively, $D$ might have more "false positives" where it reports a high value but the error-gap is actually comparatively small. In this sense, it is a conservative statistic. It plays things on the "safe side." So, while $D$ will possibly have some bias, it is at least described by the above bounds. As we are aware, the two-sample statistics discussed previously do not have such a description. + +Regression Analysis of Errors of $D$ From Theorem 1, we do not expect the random estimation error $D - \Delta_h(S,\mathbb{T})$ to be zero. So, in our experimentation, we propose to study this quantity through a regression analysis. Namely, suppose $\mathbf{X}\in \mathbb{R}^{N\times p}$ is some fixed, non-singular design matrix whose rows each represent one of $N$ experiments and whose columns represent one of $p$ features for each experiment. An experiment corresponds to an $(S,T,h)$ triple as discussed in Section 3. The features are dependent on properties of the datasets and models used in each experiment as well as realizations of $h$ -discrepancy, adaptability, and training error. Then, we assume + +$$ +\mathbf {Y} = \mathbf {X} \boldsymbol {\beta} + \epsilon \tag {4} +$$ + +where the randomness in the outcome $\mathbf{Y}$ comes from $\epsilon_{i} \stackrel{\mathrm{i.i.d.}}{\sim} N(0, \sigma^{2})$ , $\sigma > 0$ . The response $\mathbf{Y} = (D_{i} - \Delta_{h}(S, \mathbb{T})_{i})_{i=1}^{N}$ are realizations of estimation error across $N$ experiments. We give model diagnostics and details of the design matrix $\mathbf{X}$ in Appendix E; it is selected manually using domain knowledge and to meet model assumptions. + +Regression analysis is particularly useful because standard techniques allow us to understand and isolate the impact of individual columns (i.e., features) in $\mathbf{X}$ on the estimation errors of $D$ . In particular, we can use this model to determine the expected change in estimation error as a function of a particular feature, while controlling (i.e., holding constant) all other features in $\mathbf{X}$ : + +$$ +\mathbf {E} \left[ \mathbf {Y} _ {i} \mid \mathbf {X} _ {i} = \mathbf {x} \right] - \mathbf {E} \left[ \mathbf {Y} _ {i} \mid \mathbf {X} _ {i} = \mathbf {x} ^ {\prime} \right] \tag {5} +$$ + +where $\mathbf{x}$ is any setting of the features and $\mathbf{x}'$ is identical to $\mathbf{x}$ except every component involving the feature of interest is modified (e.g., increased) systematically. For a specific example using Eq. (5), consider inspecting the change in estimation error as a function of increase in $h$ -discrepancy (controlling for all other features). In this case, Eq. (5) evaluates to a polynomial in the coefficients $\beta$ and components of $\mathbf{x}'$ , so we can estimate this result in an unbiased manner using the OLS estimate $\hat{\beta} = (\mathbf{X}^{\mathrm{T}}\mathbf{X})^{-1}\mathbf{X}^{\mathrm{T}}\mathbf{Y}$ . To empirically validate our theoretical analysis, we might check if this polynomial is an increasing, positive function; i.e., because our theory predicts increases in the expected $h$ -discrepancy allow for increases in bias. + +Regression Analysis of Error-Gap Given X and $\beta$ , rearranging Eq. (4) lets us also write + +$$ +\Delta_ {h} (S, \mathbb {T}) _ {i} = D _ {i} - \mathbf {X} _ {i} \boldsymbol {\beta} + \boldsymbol {\epsilon} _ {i} \tag {6} +$$ + +where $\mathbf{X}_i$ is the $i^{\mathrm{th}}$ row of $\mathbf{X}$ ; i.e., the features of the $i^{\mathrm{th}}$ experiment. Similar to before, this type of analysis lets us draw interesting insights. In particular, we can isolate the impact of features in $\mathbf{X}$ on the error-gap. Since our design matrix $\mathbf{X}$ controls for training error, the error-gap can be interpreted to act as a measure of performance in domain adaptation (DA). Those features which are positively associated with error-gap can be said to be worse for DA. Likewise, those with negative association are "better" for DA. As before, we isolate the impact of a feature by checking the change in error-gap as a function of change in this feature (i.e., similar to Eq. 5). Appendix F Example 2 uses this technique to isolate the impact of different BERT representations on error-gap. + +# 5 Results + +# 5.1 Analysis of Transfer Error + +Comparison to Other Work Our experimental setup produces results comparable to current discourse models. In Appendix B, Figure 3 shows the distribution of the error rates when transferring on within- and out-of-distribution datasets. To validate whether our setup is comparable to other discourse parsing models, we compare error rates to current implicit sense classifiers; e.g., Kishimoto et al. (2020) who achieve an error rate of $\approx 0.38$ under a comparable setup. Our PDTB within-distribution results often improve upon this. + +Error Analysis across Genres Fiction and How-To Guides are the most difficult to transfer to, while Academic Journals and Biographies are the easiest. Figure 4 in Appendix B shows the error rates for multi-source adaptation on the GUM corpus across S-BERT, P-BERT, and A-BERT. Although the error rates differ across these three representations, the relative order of the GUM corpus domains with respect to transfer error is fairly consistent across all of them. For all three, the highest mean error rate occurred in the How-to Guide and Fiction domains, and the lowest mean error rate occurred in the Academic and Biography domains. + +# 5.2 Analysis of Correlations + +In Table 2, we show linear and rank correlation of each statistic with the error-gap. This tests the + +ability of each statistic to discern scenarios where domain adaptation performance may be either good or bad. In practice, a statistic with good rank correlation can be used in model-selection or (source) dataset selection. A statistic with good linear correlation may also be used and will be easier to interpret since we expect changes in the statistic to be proportional to changes in the error-gap. + +Comparison of Statistics $h$ -discrepancy is consistently, most strongly correlated with error-gap. The overarching trend is that the $h$ -discrepancy is far better than every other statistic with regards to both types of correlation. In fact, the linear correlations are not much worse than the rank correlations (in some cases they are even better). This validates our opening hypothesis that domain-shift does not always correlate with domain adaptation performance (i.e., error-gap). It is important to also consider the classifier we use. Still, BBSD – another statistic that relies on the classifier – is also somewhat ineffective compared to the $h$ -discrepancy. Importantly, despite depending on the classifier, BBSD was still designed with identification of feature-distribution shift in mind. In some sense, this observation validates our theoretical motivations for the $h$ -discrepancy (i.e., Theorem 1) which directly relates it to error-gap. Our results indicate that, at least for the task of discourse parsing, $h$ -discrepancy is the most effective statistic to use with regards to predicting error-gap. + +Additional Trends Experiments using RST-DT label schemas and non-news targets show very low correlation between distributional shift and error-gap. If we look at particular experiment subsets, we also see some interesting trends. First, most statistics are better correlated with error-gap datasets that use the PDTB label schema than those that use the RST-DT label schema. The difference is less pronounced for the $h$ -discrepancy than for the other statistics, suggesting that it is especially important to use statistics tied directly to the error-gap when working with datasets that use the RST-DT schema. The same is true when the test dataset is comprised of news articles instead of other types of text. + +The $h$ -discrepancy has highest linear correlation on similar distributions. We observe much stronger linear correlation between the $h$ -discrepancy and error-gap on within-distribution adaptation scenarios (WD) as compared to out-of-distribution adaptation scenarios (OOD). We believe this is because + +
SplitSpearman (Rank) CorrelationPearson (Linear) Correlation
FRSEnergyMMDBBSDh-discFRSEnergyMMDBBSDh-disc
All0.53940.60590.50510.40540.82990.49860.43960.34130.40040.7628
PDTB0.54510.63590.54720.47460.82650.52950.47040.37090.42740.7642
RST-DT0.21660.3059-0.00110.20870.76250.28530.1660-0.16050.16770.7599
News0.52620.63560.55070.57590.85170.70790.63020.55580.53860.8890
Other0.37600.45170.27670.17370.83860.34200.27910.17600.20510.7072
WD0.08840.5735-0.03240.23680.78900.10750.5831-0.05150.48530.9519
OOD0.45970.52490.39170.28130.76660.43420.39090.27610.37450.6976
+ +Table 2: Correlations with error-gap for each statistic. Data splits indicate the subset of data used. $h$ -discrepancy consistently yields the largest correlation with error-gap; i.e., difference in Pearson correlations are all significant at level $\alpha = 0.001$ using test of Steiger (1980) implemented by Diedenhofen and Musch (2015). + +![](images/1a05d029d277b217d293c1ebb998b46f7b2c8e161d68431e5e3526f9abe99cde.jpg) +Figure 2: (Left, 1-4) Expected change in error-gap when changing properties of the dataset or model. Shown as a function of discrepancy and controls for all other features of the experiment. Reference category is indicated in title. (Right, 5-6) Expected change in estimation error of $h$ -discrepancy shown as a function of $\lambda$ (5th) and discrepancy (6th). Left assumes use of A-BERT and FCN on a GUM non-news target, but trends are consistent in other cases. + +the $h$ -discrepancy is typically small when $S$ and $T$ follow a similar distribution. As Theorem 1 notes, the bias of the $h$ -discrepancy as an estimator for error-gap can be near zero if both $\mathbf{E}[D]$ and $\mathbf{E}[\lambda]$ are small; i.e., we expect the linear correlation of a nearly unbiased estimator to be fairly high. + +# 5.3 Regression Analysis of Estimation Error + +Figure 2 shows expected change in estimation error of $h$ -discrepancy (used as an estimator for error-gap). Trend lines indicate expected change as a function of the adaptability $\lambda$ and the discrepancy $D$ compared to the case where each is 0. Trends are computed using a similar technique for regression analysis as described in Appendix F Example 1. The takeaway is that these empirical results are consistent with our theoretical discussion surrounding Theorem 1. As $\lambda$ increases, the estimation error decreases. Similarly, Theorem 1 predicts the possibility of negative bias when $\lambda$ is large. As $D$ increases, the estimation error does the same. Theorem 1 agrees here too, predicting the possibility of positive bias when $D$ is large. + +# 5.4 Regression Analysis of Error-Gap + +Figure 2 also shows expected change in error-gap when modifying categorical features of the experiment; e.g., use of S-BERT vs. A-BERT. Trend lines indicate expected change as a function of $h$ -discrepancy and are computed using a similar technique for regression analysis as described in Appendix F Example 2. Since we control for training set error, positive changes in error-gap indicate a setting is better for domain adaptation, while negative indicates the opposite. This regression analysis also controls for changes in discourse framework using explicit indicator variables as well as the term $\lambda$ (see discussion after Theorem 1). + +BERT features S-BERT is better for similar train and test sets, while A-BERT is better for more divergent sets. As a function of discrepancy, S-BERT is better for DA when the discrepancy is small. As the difference between the train and test set increases, the reference category (i.e., A-BERT) is better for DA. Comparing P-BERT to A-BERT we do not see large differences; marginally, A-BERT is better as discrepancy increases. These results are consistent with typical rules of thumb on model complexity. A more complex feature representation (i.e., S-BERT or P-BERT) is beneficial when training and test distributions align, but + +allows for overfitting when discrepancy increases. + +Classifier Linear classifiers perform marginally worse than neural-networks. In general, fully-connected networks (FCNs) appear to be slightly better for domain adaptation. Possibly, this is due to increased modelling capacity. This benefit wanes as the discrepancy between the training/test sample increases. As before, the cause may be overfitting since overfitting and class imbalance are known problems in discourse parsing (Atwell et al., 2021). + +News Test Set It is slightly harder to transfer to news datasets. We consider a "news" corpus to be any of PDTB, RST-DT, or the news domain of GUM. When the target (test) dataset consists of news texts, we see adaptation performance consistent with non-news targets for small discrepancy. As the discrepancy between training and test set grows, the non-news targets are actually better suited for domain adaptation; i.e., it is slightly easier to transfer to a non-news target. Possibly, this is related to the length and complexity of news texts. + +Dataset Increased variability in the target domain results in a more difficult task, even when adding variability during training. In general, we see that the GUM dataset presents a more challenging adaptation task than the other datasets. This is sensible due to the larger selection of target domains in GUM. In our results, increased variability at train-time does not appear to counteract this issue, because adaptation experiments in the GUM corpus are multi-source. For PDTB, as the discrepancy increases, performance is more similar to GUM. On the other hand, RST-DT presents the easiest adaptation task. This is expected as all test sets in the RST-DT experiments are drawn from the same news corpus. + +# 6 Conclusion + +This work provides a statistic for model and dataset selection, that we also use to conduct large-scale analysis of model transfer in discourse parsing. Our analysis provides useful insights for the practitioner. For one, the correlations indicate that, for datasets with the RST-DT annotation framework, the statistics that quantify distributional shift without being directly tied to error-gap (where error-gap refers to the performance gap between train and test splits) are very weakly correlated with error-gap. This also holds for non-news targets, and indicates that + +the $h$ -discrepancy is especially useful for predicting the effects of domain shift in these cases. + +Additionally, we find that: (1) increased variability in the target domain appears to make domain adaptation more difficult, even if the training set contains a similar level of variability; (2) S-BERT is better than A-BERT when domains are similar, but A-BERT outperforms S-BERT when the domains further diverge; (3) non-news texts (such as those in the BioDRB) are easier to adapt to than news texts (such as those in the PDTB). + +This is the first computational and empirical study that looks at distribution shifts across different discourse datasets and evaluates the performance of various models under these shifts. This is also the first work that examines the efficacy of different two-sample tests for predicting the error-gap when compared to a metric that is theoretically tied to error gap. Future work can extend these results by using the $h$ -discrepancy metric to predict the error-gap for other NLP tasks or for other components needed for discourse parsing, such as constructing the RST-DT dataset. + +# 7 Ethics + +Our experiments do not have any significant ethical concerns, as we do not work with any sensitive or personal data, nor do we work with human subjects; the datasets we use for our experiments are the PDTB 2.0 and 3.0, the RST Discourse Treebank, the GUM corpus, the TED-MDB, and the BioDRB. Our work depends on pretrained models such as word embeddings. These models are known to reproduce and even magnify societal bias present in training data. + +# Acknowledgements + +We would like to thank Amir Zeldes for his helpful feedback. Thanks to Pitt Cyber and DARPA grant prime OTA No. HR00112290024 (subcontract No. AWD00005100 and SRA00002145) for partly supporting this project. We also acknowledge the The Center for Research Computing at the University of Pittsburgh for providing the computational resources for many of the results within this paper. Any opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the position or policy of the U.S. Air Force Research Lab, DARPA, DoD and SRI International and no official endorsement should be inferred. + +# References + +Stergos Afantenos, Nicholas Asher, Farah Benamara, Myriam Bras, Cécile Fabre, Mai Ho-dac, Anne Le Draoulec, Philippe Muller, Marie-Paule Péry-Woodley, Laurent Prévot, Josette Rebeyrolles, Ludovic Tanguy, Marianne Vergez-Couret, and Laure Vieu. 2012. An empirical resource for discovering cognitive principles of discourse organisation: the ANNODIS corpus. In Proceedings of the Eighth International Conference on Language Resources and Evaluation (LREC'12), pages 2727-2734, Istanbul, Turkey. European Language Resources Association (ELRA). +Katherine Atwell, Junyi Jessy Li, and Malihe Alikhani. 2021. Where are we in discourse relation recognition? In Proceedings of the 22nd Annual Meeting of the Special Interest Group on Discourse and Dialogue, pages 314-325, Singapore and Online. Association for Computational Linguistics. +Shai Ben-David, John Blitzer, Koby Crammer, Alex Kulesza, Fernando Pereira, and Jennifer Wortman Vaughan. 2010a. A theory of learning from different domains. Machine learning, 79(1-2):151-175. +Shai Ben-David, John Blitzer, Koby Crammer, and Fernando Pereira. 2007. Analysis of representations for domain adaptation. In Advances in Neural Information Processing Systems, pages 137-144. +Shai Ben-David, Tyler Lu, Teresa Luu, and David Pal. 2010b. Impossibility theorems for domain adaptation. In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, volume 9 of Proceedings of Machine Learning Research, pages 129-136, Chia Laguna Resort, Sardinia, Italy. PMLR. +Parminder Bhatia, Yangfeng Ji, and Jacob Eisenstein. 2015. Better document-level sentiment analysis from RST discourse parsing. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pages 2212-2218, Lisbon, Portugal. Association for Computational Linguistics. +John Blitzer, Mark Dredze, and Fernando Pereira. 2007. Biographies, Bollywood, boom-boxes and blenders: Domain adaptation for sentiment classification. In Proceedings of the 45th Annual Meeting of the Association of Computational Linguistics, pages 440-447, Prague, Czech Republic. Association for Computational Linguistics. +Chloe Braud, Maximin Coavoux, and Anders Søgaard. 2017. Cross-lingual RST discourse parsing. In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics: Volume 1, Long Papers, pages 292–304, Valencia, Spain. Association for Computational Linguistics. +Lynn Carlson, Daniel Marcu, and Mary Ellen Okurovsky. 2001. Building a discourse-tagged corpus in the framework of Rhetorical Structure Theory. + +In Proceedings of the Second SIGdial Workshop on Discourse and Dialogue. +Arman Cohan, Franck Dernoncourt, Doo Soon Kim, Trung Bui, Seokhwan Kim, Walter Chang, and Nazli Goharian. 2018. A discourse-aware attention model for abstractive summarization of long documents. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers), pages 615-621, New Orleans, Louisiana. Association for Computational Linguistics. +Koby Crammer, Michael Kearns, and Jennifer Wortman. 2007. Learning from multiple sources. In Advances in Neural Information Processing Systems, pages 321-328. +Calin Cruceru, Brady Neal, and Github User josipd. 2020. Torch two sample package (commit 23aa002). Github. +Iria da Cunha, Juan-Manuel Torres-Moreno, and Gerardo Sierra. 2011. On the development of the RST Spanish treebank. In Proceedings of the 5th Linguistic Annotation Workshop, pages 1-10, Portland, Oregon, USA. Association for Computational Linguistics. +Laurence Danlos, Diego Antolinos-Basso, Chloe Braud, and Charlotte Roze. 2012. Vers le FDTB: French discourse tree bank (towards the FDTB: French discourse tree bank) [in French]. In Proceedings of the Joint Conference JEP-TALN-RECITAL 2012, volume 2: TALN, pages 471-478, Grenoble, France. ATALA/AFCP. +Debopam Das and Manfred Stede. 2018. Developing the bangla rst discourse treebank. In Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC 2018). +Vera Demberg, Fatemeh Torabi Asr, and Merel Scholman. 2017. How compatible are our discourse annotations? insights from mapping rst-dt and pdtb annotations. arXiv preprint arXiv:1704.08893. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171-4186, Minneapolis, Minnesota. Association for Computational Linguistics. +Birk Diedenhofen and Jochen Musch. 2015. cocor: A comprehensive solution for the statistical comparison of correlations. PLOS one, 10(4):1-12. +Hady Elsahar and Matthias Galle. 2019. To annotate or not? predicting performance drop under domain shift. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing + +and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 2163-2173, Hong Kong, China. Association for Computational Linguistics. +Wei Vanessa Feng. 2015. RST-style discourse parsing and its applications in discourse analysis. University of Toronto (Canada). +Jerome H Friedman and Lawrence C Rafsky. 1979. Multivariate generalizations of the Wald-Wolfowitz and Smirnov two-sample tests. The Annals of Statistics, pages 697-717. +Kenji Fukumizu, Arthur Gretton, Gert Lanckriet, Bernhard Schölkopf, and Bharath K. Sriperumbudur. 2009. Kernel choice and classifiability for RKHS embeddings of probability distributions. In Advances in Neural Information Processing Systems, volume 22. Curran Associates, Inc. +Arthur Gretton, Karsten M Borgwardt, Malte J Rasch, Bernhard Scholkopf, and Alexander Smola. 2012. A kernel two-sample test. The Journal of Machine Learning Research, 13(1):723-773. +Francisco Guzmán, Shafiq Joty, Lluis Márquez, and Preslav Nakov. 2014. Using discourse structure improves machine translation evaluation. In Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 687-698. +Fredrik D Johansson, David Sontag, and Rajesh Ranganath. 2019. Support and invertibility in domain-invariant representations. In The 22nd International Conference on Artificial Intelligence and Statistics, pages 527-536. PMLR. +Daniel Kifer, Shai Ben-David, and Johannes Gehrke. 2004. Detecting change in data streams. In VLDB, volume 4, pages 180-191. +Yudai Kishimoto, Yugo Murawaki, and Sadao Kurohashi. 2020. Adapting BERT to implicit discourse relation classification with a focus on discourse connectives. In Proceedings of the 12th Language Resources and Evaluation Conference, pages 1152-1158, Marseille, France. European Language Resources Association. +Seiichi Kuroki, Nontawat Charoenphakdee, Han Bao, Junya Honda, Issei Sato, and Masashi Sugiyama. 2019. Unsupervised domain adaptation based on source-guided discrepancy. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 4122-4129. +Alex Lascarides and Nicholas Asher. 2008. Segmented discourse representation theory: Dynamic semantics with discourse structure. In Computing meaning, pages 87-124. Springer. +Li Liang, Zheng Zhao, and Bonnie Webber. 2020. Extending implicit discourse relation recognition to the PDTB-3. In Proceedings of the First Workshop on + +Computational Approaches to Discourse, pages 135-147, Online. Association for Computational Linguistics. +Zachary Lipton, Yu-Xiang Wang, and Alexander Smola. 2018. Detecting and correcting for label shift with black box predictors. In International conference on machine learning, pages 3122-3130. PMLR. +Mingsheng Long, Yue Cao, Jianmin Wang, and Michael Jordan. 2015. Learning transferable features with deep adaptation networks. In International conference on machine learning, pages 97-105. PMLR. +Yishay Mansour, Mehryar Mohri, and Afshin Rostamizadeh. 2009. Domain adaptation with multiple sources. In Advances in neural information processing systems, pages 1041-1048. +Daniel Marcu. 1999. Discourse trees are good indicators of importance in text. Advances in automatic text summarization, 293:123-136. +Daniel Marcu. 2000. The Theory and Practice of Discourse Parsing and Summarization. MIT press. +Thomas Meyer, Andrei Popescu-Belis, Sandrine Zufferey, and Bruno Cartoni. 2011. Multilingual annotation and disambiguation of discourse connectives for machine translation. In Proceedings of the SIGDIAL 2011 Conference, pages 194-203, Portland, Oregon. Association for Computational Linguistics. +Eleni Miltsakaki, Rashmi Prasad, Aravind Joshi, and Bonnie Webber. 2004. The Penn Discourse Treebank. In Proceedings of the Fourth International Conference on Language Resources and Evaluation (LREC'04), Lisbon, Portugal. European Language Resources Association (ELRA). +Karthik Narasimhan and Regina Barzilay. 2015. Machine comprehension with discourse relations. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 1253-1262, Beijing, China. Association for Computational Linguistics. +Barbara Plank and Gertjan van Noord. 2011. *Effective measures of domain similarity for parsing*. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, pages 1566-1576, Portland, Oregon, USA. Association for Computational Linguistics. +Rashmi Prasad, Nikhil Dinesh, Alan Lee, Eleni Miltsakaki, Livio Robaldo, Aravind Joshi, and Bonnie Webber. 2008. The Penn Discourse TreeBank 2.0. In Proceedings of the Sixth International Conference on Language Resources and Evaluation (LREC'08), Marrakech, Morocco. European Language Resources Association (ELRA). + +Stephan Rabanser, Stephan Gunnemann, and Zachary Lipton. 2019. Failing loudly: An empirical study of methods for detecting dataset shift. Advances in Neural Information Processing Systems, 32:1396-1408. +Balaji Polepalli Ramesh and Hong Yu. 2010. Identifying discourse connectives in biomedical text. In AMIA Annual Symposium Proceedings, volume 2010, page 657. American Medical Informatics Association. +Ievgen Redko, Emilie Morvant, Amaury Habrard, Marc Sebban, and Younès Bennani. 2020. A survey on domain adaptation theory. *ArXiv*, abs/2004.11829. +Nils Reimers and Iryna Gurevych. 2019. Sentence-bert: Sentence embeddings using siamese bert-networks. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 3982-3992. +Sebastian Ruder, Parsa Ghaffari, and John G Breslin. 2017. Data selection strategies for multi-domain sentiment analysis. arXiv preprint arXiv:1702.02426. +James H Steiger. 1980. Tests for comparing elements of a correlation matrix. *Psychological bulletin*, 87(2):245. +Masashi Sugiyama, Matthias Krauledat, and Klaus-Robert Muller. 2007. Covariate shift adaptation by importance weighted cross validation. Journal of Machine Learning Research, 8(5). +Gábor J Székely and Maria L Rizzo. 2013. Energy statistics: A class of statistics based on distances. Journal of statistical planning and inference, 143(8):1249-1272. +Remi Tachet des Combes, Han Zhao, Yu-Xiang Wang, and Geoffrey J Gordon. 2020. Domain adaptation with conditional distribution matching and generalized label shift. In Advances in Neural Information Processing Systems, volume 33, pages 19276-19289. Curran Associates, Inc. +Bonnie Webber, Rashmi Prasad, Alan Lee, and Aravind Joshi. 2019. The Penn Discourse Treebank 3.0 annotation manual. +Fangzhao Wu and Yongfeng Huang. 2016. Sentiment domain adaptation with multiple sources. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 301-310, Berlin, Germany. Association for Computational Linguistics. +Yifan Wu, Ezra Winston, Divyansh Kaushik, and Zachary Lipton. 2019. Domain adaptation with asymmetrically-relaxed distribution alignment. In International Conference on Machine Learning, pages 6872-6881. PMLR. + +Nianwen Xue, Hwee Tou Ng, Sameer Pradhan, Rashmi Prasad, Christopher Bryant, and Attapol Rutherford. 2015. The CoNLL-2015 shared task on shallow discourse parsing. In Proceedings of the Nineteenth Conference on Computational Natural Language Learning - Shared Task, pages 1-16, Beijing, China. Association for Computational Linguistics. +Nianwen Xue, Hwee Tou Ng, Sameer Pradhan, Attapol Rutherford, Bonnie Webber, Chuan Wang, and Hong-min Wang. 2016. CoNLL 2016 shared task on multilingual shallow discourse parsing. In Proceedings of the CoNLL-16 shared task, pages 1-19, Berlin, Germany. Association for Computational Linguistics. +Kaichao You, Ximei Wang, Mingsheng Long, and Michael Jordan. 2019. Towards accurate model selection in deep unsupervised domain adaptation. In International Conference on Machine Learning, pages 7124-7133. PMLR. +Amir Zeldes. 2017. The GUM corpus: Creating multilayer resources in the classroom. Language Resources and Evaluation, 51(3):581-612. +Amir Zeldes, Debopam Das, Erick Galani Maziero, Juliano Antonio, and Mikel Iruskieta. 2019. The DISRPT 2019 shared task on elementary discourse unit segmentation and connective detection. In Proceedings of the Workshop on Discourse Relation Parsing and Treebanking 2019, pages 97-104, Minneapolis, MN. Association for Computational Linguistics. +Amir Zeldes, Yang Janet Liu, Mikel Iruskieta, Philippe Muller, Chloe Braud, and Sonia Badene, editors. 2021. Proceedings of the 2nd Shared Task on Discourse Relation Parsing and Treebanking (DISRPT 2021). Association for Computational Linguistics, Punta Cana, Dominican Republic. +Deniz Zeyrek, Amália Mendes, Yulia Grishina, Murathan Kurfali, Samuel Gibbon, and Maciej Ogrodniczuk. 2020. TED Multilingual Discourse Bank (TED-MDB): a parallel corpus annotated in the PDTB style. Language Resources and Evaluation, 54(2):587-613. +Deniz Zeyrek and Bonnie Webber. 2008. A discourse resource for Turkish: Annotating discourse connectives in the METU corpus. In Proceedings of the 6th Workshop on Asian Language Resources. +Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. 2016. Understanding deep learning requires rethinking generalization. arXiv:1611.03530v2. +Yuchen Zhang, Tianle Liu, Mingsheng Long, and Michael Jordan. 2019. Bridging theory and algorithm for domain adaptation. In International Conference on Machine Learning, pages 7404-7413. +Han Zhao, Remi Tachet Des Combes, Kun Zhang, and Geoffrey Gordon. 2019. On learning invariant representations for domain adaptation. In International Conference on Machine Learning, pages 7523-7532. PMLR. + +Yang Zhong, Chao Jiang, Wei Xu, and Junyi Jessy Li. 2020. Discourse level factors for sentence deletion in text simplification. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 9709-9716. +Yuping Zhou and Nianwen Xue. 2015. The Chinese discourse treebank: a Chinese corpus annotated with discourse relations. *Language Resources and Evaluation*, 49(2):397-431. + +# A Frameworks + +The Penn Discourse Treebank (Miltsakaki et al., 2004; Prasad et al., 2008; Webber et al., 2019) consists of Wall Street Journal articles labeled with both explicit and implicit shallow discourse relations (relations between only two text units). Explicit discourse relations are ones in which a connective between the arguments provides some indication of the correct discourse sense label. Implicit discourse relations, which we focus on in this paper, are ones in which a connective can be inserted that indicates the correct sense. + +The RST Discourse Treebank (Carlson et al., 2001) is a corpus containing Wall Street Journal articles annotated in the style of Rhetorical Structure Theory, where a document is split into elementary discourse units (EDUs) and relations made up of these EDUs form a tree structure. The RST Discourse Treebank does not differentiate between explicit and non-explicit discourse relations, nor does it label discourse connectives. + +# B Model Training and Transfer Results + +Optimization Parameters We use SGD on an NLL loss with momentum set to 0.9 to train all of our models. We use a batch size of 250. We start training with a learning of $1 \times 10^{-2}$ for 100 epochs and then train for another 50 epochs using a learning rate of $1 \times 10^{-3}$ . If a model achieves a training error lower than $5 \times 10^{-4}$ , we stop training. + +![](images/e3dd78e0b2a578eb80824b8173ad3bd765fbf6ff09d0c262d6dc12cd38ba9255.jpg) +Figure 3: Transfer error within and out of distribution for each dataset + +![](images/74065581a849f79b132ad76905ce73339c8abe5e5c8d74a2cec6874bd3b42aa5.jpg) +Figure 4: Transfer error for each topic within the GUM corpus + +# C Two-Sample Statistics + +Here, we describe in detail the common two-sample statistics listed in Section 4 and studied in Section 5 + +Friedman-Rafsky Test Statistic The Friedman-Rafsky Test Statistic $R$ (Friedman and Rafsky, 1979) is computed by forming a minimum-spanning tree (MST) using the pooled sample $P = (X_{i} \mid (X_{i}, Y_{i}) \in S) + _{\mathrm{c}} (\tilde{X}_{i} \mid \tilde{X}_{i} \in T_{X})$ of marginal features. Here, $+_{\mathrm{c}}$ is the concatenation operation. To form the tree, we form a weighted graph $G_{P}$ by treating each point $Z_{i} \in P$ as vertex and assigning an edge between each pair of vertices whose weight is the distance between the data-points. When $\mathcal{X} = \mathbb{R}^{d}$ for some $d$ , this is usually the Euclidean distance or L2 norm. The MST is then precisely the MST of $G_{P}$ . The statistic $R$ is computed as the number of edges whose endpoints originally belonged to the same sample. For example, $R$ increases by 1 for each edge whose endpoints both originally belong to $T_{X}$ . Likewise, $R$ increases by 1 for each edge whose endpoints are both the features of points in $S$ . When endpoints originally belonged to distinct samples, $R$ remains unmodified. We report modified statistic below which is normalized to account for sample size $R_{\mathrm{normed}} = R / (n + m - 2)$ . Since the size of the MST is $n + m - 1$ and there is always at least one edge between $S$ and $T_{X}$ , this statistic has a maximum value of 1. + +Energy Statistic Given samples $S$ and $T_{X}$ as before, the energy statistic may be computed as below + +$$ +\begin{array}{l} E = \frac {2}{n m} \sum_ {i, j} \left\| X _ {i} - \tilde {X} _ {j} \right\| - \frac {1}{n ^ {2}} \sum_ {i, j} \left\| X _ {i} - X _ {j} \right\| \tag {7} \\ - \frac {1}{m ^ {2}} \sum_ {i, j} | | \tilde {X} _ {i} - \tilde {X} _ {j} | | \\ \end{array} +$$ + +where $||\cdot ||$ gives the Euclidean norm (distance). Originally proposed by Székely and Rizzo (2013), the statistic is motivated by Newton's potential energy between heavenly bodies. Intuitively, it is fairly easy to understand as a comparison of dissimilarity within samples and across samples. If the dissimilarity across samples (i.e., the first term) is much higher than the dissimilarity within samples, then the two samples are likely drawn from different distributions. + +Maximum Mean Discrepancy (MMD) Given samples $S$ and $T_{X}$ as before, the MMD statistic + +(Gretton et al., 2012) may be computed as below + +$$ +\begin{array}{l} M = \frac {\sum_ {i \neq j} K \left(X _ {i} , X _ {j}\right)}{n (n - 1)} + \frac {\sum_ {i \neq j} K \left(\tilde {X} _ {i} , \tilde {X} _ {j}\right)}{m (m - 1)} \tag {8} \\ - \frac {2}{n m} \sum_ {i, j} K (X _ {i}, \tilde {X} _ {j}) \\ \end{array} +$$ + +where $K: \mathcal{X} \times \mathcal{X} \to \mathbb{R}_{\geq 0}$ is the kernel for some RKHS. In our experiments, we use an Gaussian RBF kernel and select $\sigma$ to be an approximate median distance of the pooled sample as done by Rabanser et al. (2019). Intuitively, $K$ behaves as a similarity metric between points in $\mathcal{X}$ and, in this sense, the MMD statistic compares samples in much the same way that the energy statistic does. Rather than dissimilarity, the MMD statistic looks at similarity of points within and across samples, modifying the order of the summands appropriately to retain direct proportionality with the difference in samples. + +# D Proof of Theorem 1 + +Proof. We use the triangle inequality of classification error (Crammer et al., 2007; Ben-David et al., 2007). For any realization of the sample $S$ and any distribution $\mathbb{T}$ over $\mathcal{X} \times \mathcal{Y}$ , for any classifiers $h, h' \in \mathcal{H}$ , the triangle inequality yields + +$$ +\begin{array}{l} \mathbf {R} _ {\mathbb {T}} (h) - \mathbf {R} _ {S} (h) \leq \mathbf {R} _ {S} \left(h ^ {\prime}\right) + \mathbf {R} _ {\mathbb {T}} \left(h ^ {\prime}\right) \\ + \left| \mathbf {R} _ {S} \left(h, h ^ {\prime}\right) - \mathbf {R} _ {\mathbb {T}} \left(h, h ^ {\prime}\right) \right| \\ \end{array} +$$ + +where for $\mathbb{T}$ over $\mathcal{X} \times \mathcal{Y}$ we have + +$$ +\mathbf {R} _ {\mathbb {T}} \left(h, h ^ {\prime}\right) = \underset {\tilde {X} \sim \mathbb {T} _ {X}} {\mathbf {P r}} \left(h \left(\tilde {X}\right) \neq h ^ {\prime} \left(\tilde {X}\right)\right) \tag {11} +$$ + +and for $S = (X_{i},Y_{i})_{i = 1}^{n}$ we have + +$$ +\mathbf {R} _ {S} \left(h, h ^ {\prime}\right) = n ^ {- 1} \sum_ {i = 1} ^ {n} 1 \left[ h \left(X _ {i}\right) \neq h ^ {\prime} \left(X _ {i}\right) \right]. \tag {12} +$$ + +Interchanging roles of $\mathbb{T}$ and $S$ in Eq. (10) and using the definition of the absolute value, we see + +$$ +\begin{array}{l} \Delta_ {h} (S, \mathbb {T}) \leq \mathbf {R} _ {S} \left(h ^ {\prime}\right) + \mathbf {R} _ {\mathbb {T}} \left(h ^ {\prime}\right) \\ + \left| \mathbf {R} _ {S} \left(h, h ^ {\prime}\right) - \mathbf {R} _ {\mathbb {T}} \left(h, h ^ {\prime}\right) \right|. \\ \end{array} +$$ + +$$ +\begin{array}{l} \mathbf {R} _ {\mathbb {T}} (h) \leq \mathbf {R} _ {\mathbb {T}} (h, h ^ {\prime}) + \mathbf {R} _ {\mathbb {T}} (h ^ {\prime}) \\ \leq \mathbf {R} _ {S} (h, h ^ {\prime}) + \mathbf {R} _ {\mathbb {T}} (h ^ {\prime}) + | \mathbf {R} _ {\mathbb {T}} (h, h ^ {\prime}) - \mathbf {R} _ {S} (h, h ^ {\prime}) | \\ \leq \mathbf {R} _ {S} (h) + \mathbf {R} _ {S} \left(h ^ {\prime}\right) + \mathbf {R} _ {\mathbb {T}} \left(h ^ {\prime}\right) + \left| \mathbf {R} _ {\mathbb {T}} \left(h, h ^ {\prime}\right) - \mathbf {R} _ {S} \left(h, h ^ {\prime}\right) \right| \tag {9} \\ \end{array} +$$ + +For brevity, for any distribution $\mathbb{D}$ , set + +$$ +\xi (\mathbb {D}) = \left| \mathbf {R} _ {S} \left(h, h ^ {\prime}\right) - \mathbf {R} _ {\mathbb {D}} \left(h, h ^ {\prime}\right) \right|. \tag {14} +$$ + +Then, using the common "addition of zero" trick, we arrive at + +$$ +\begin{array}{l} \Delta_ {h} (S, \mathbb {T}) \leq \mathbf {R} _ {S} (h ^ {\prime}) + \mathbf {R} _ {\mathbb {T}} (h ^ {\prime}) \\ - \mathbf {R} _ {T} \left(h ^ {\prime}\right) + \mathbf {R} _ {T} \left(h ^ {\prime}\right) + \xi (\mathbb {T}) \tag {15} \\ - \xi (T) + \xi (T). \\ \end{array} +$$ + +Then, by monotonicity and linearity of the expectation we have + +$$ +\begin{array}{l} \Delta_ {h} (S, \mathbb {T}) \leq \mathbf {E} _ {T} \left[ \mathbf {R} _ {S} \left(h ^ {\prime}\right) + \mathbf {R} _ {T} \left(h ^ {\prime}\right) \right] \\ + \mathbf {E} _ {T} [ \xi (T) ] \tag {16} \\ + \mathbf {R} _ {\mathbb {T}} (h ^ {\prime}) - \mathbf {E} _ {T} \Big [ \mathbf {R} _ {T} (h ^ {\prime}) \Big ] \\ + \xi (\mathbb {T}) - \mathbf {E} _ {T} [ \xi (T) ]. \\ \end{array} +$$ + +Let us consider some of these terms individually. Using linearity of expectation and the correspondence between probability and the expectation of an indicator function, we have + +$$ +\begin{array}{l} \mathbf {E} _ {T} \Big [ \mathbf {R} _ {T} (h ^ {\prime}) \Big ] = \mathbf {E} \Bigg [ m ^ {- 1} \sum_ {i = 1} ^ {m} 1 [ h (\tilde {X} _ {i}) \neq \tilde {Y} _ {i} ] \Bigg ] \\ = m ^ {- 1} \sum_ {i = 1} ^ {m} \mathbf {E} \left[ 1 \left[ h \left(\tilde {X} _ {i}\right) \neq \tilde {Y} _ {i} \right] \right] \\ = m ^ {- 1} \sum_ {i = 1} ^ {m} \underset {(\tilde {X} _ {i}, \tilde {Y} _ {i}) \sim \mathbb {T}} {\mathbf {P r}} \left(h (\tilde {X} _ {i}) \neq \tilde {Y} _ {i}\right) \\ = m ^ {- 1} \sum_ {i = 1} ^ {m} \mathbf {R} _ {\mathbb {T}} (h) \\ = \mathbf {R} _ {\mathbb {T}} (h). \tag {17} \\ \end{array} +$$ + +Additionally, we have + +$$ +\begin{array}{l} \mathbf {E} _ {T} [ \xi (T) ] = \mathbf {E} _ {T} \left[ | \mathbf {R} _ {S} (h, h ^ {\prime}) - \mathbf {R} _ {T} (h, h ^ {\prime}) | \right] \\ \geq \left| \mathbf {R} _ {S} (h, h ^ {\prime}) - \mathbf {E} \big [ \mathbf {R} _ {T} (h, h ^ {\prime}) \big ] \right| \\ = \xi (\mathbb {T}). \tag {18} \\ \end{array} +$$ + +Here, the second line follows by Jensen's Inequality and linearity of the expectation. The last line follows using a similar derivation as in Eq. (17). Then, + +$$ +\xi (\mathbb {T}) - \mathbf {E} _ {T} [ \xi (T) ] \leq 0 \tag {19} +$$ + +and + +$$ +\mathbf {R} _ {\mathbb {T}} \left(h ^ {\prime}\right) - \mathbf {E} _ {T} \left[ \mathbf {R} _ {T} \left(h ^ {\prime}\right) \right] = 0. \tag {20} +$$ + +![](images/ba4390eae8371e05ea2f048e907890c0cd007761e599af295e0104742687c357.jpg) +Figure 5: Quantile-Quantile plot. Red line shows ideal: sample quantiles should be the same as the theoretical quantiles of a normal distribution with same variance. + +Using these two facts in conjunction with Eq. (16) yields + +$$ +\begin{array}{l} \Delta_ {h} (S, \mathbb {T}) \leq \mathbf {E} _ {T} \left[ \mathbf {R} _ {S} \left(h ^ {\prime}\right) + \mathbf {R} _ {T} \left(h ^ {\prime}\right) \right] \tag {21} \\ + \mathbf {E} _ {T} [ \xi (T) ]. \\ \end{array} +$$ + +Using $h$ as in Eq. (2) to define the statistic $D$ , for any $h' \in \mathcal{H}$ , we know $\xi(T) \leq D$ (i.e., by definition of $\max$ ). So, monotonicity and linearity of expectation implies $\mathbf{E}_T[\xi(T)] \leq \mathbf{E}_T[D]$ . For an appropriate choice of $h'$ , we then have + +$$ +\Delta_ {h} (S, \mathbb {T}) \leq \mathbf {E} _ {T} [ \lambda ] + \mathbf {E} _ {T} [ D ]. \tag {22} +$$ + +Rearranging terms gives the lowerbound and the upperbound follows immediately from the fact that $\Delta_h(S,\mathbb{T})$ is non-negative. + +![](images/0b99030b6bf8bfdd0851f937424b316606288b4b785fe1e6bbb1ebe79cdf7126.jpg) + +# E Regression Diagnostics + +Normal Errors Assumption Here, we give diagnostics for the regression model used to analyze data in the main text. Primarily, we would like to check the assumptions that our error terms (i.e., $\epsilon$ ) are all identically and independently normally distributed. The Jarque-Bera (JB) test uses a statistic based on the skew and kurtosis of the observed errors to study this hypothesis. Assuming the residuals are i.i.d. normal, the probability of observing a JB statistic as extreme as observed is $\approx 0.25$ . So, we fail to reject the hypothesis that the residuals are i.i.d normal at significance level $\alpha = 0.05$ . The assumption that error terms are normal distributed may also be visually checked using the qq-plot, histogram of errors, and the residual plots contained in + +![](images/ee6f2f6132094030d282f00d76f590ce374cd56f240affe951f2a6ad6f99dd4c.jpg) +Figure 6: Histogram of realized error terms. Horizontal axis shows value of error term, while vertical axis shows count. + +Figures 5, 6, and 7, respectively. We do not see particularly strong evidence that the residuals are not i.i.d. normal. Albeit, some patterning in the residual plots and skew in the histogram of residuals may be of concern. + +Other Possible Assumptions In any case, even if the normality assumption does not hold, our analysis can still be interpreted using more loose assumptions. The most important assumption is that the error terms all have mean 0. Empirically, we find this to be the case with the average residual being $\approx 2.4 \times 10^{-15}$ . In fact, Figure 7 shows the line-of-best fit through the residuals (which is typically close to the zero line). As long as the assumption that the error terms have common mean 0 is true, the OLS estimates we use for the coefficients will be unbiased. The only possible short-coming of the OLS estimate is that it could have larger variance than some other estimate. In our analysis, we are most concerned with the unbiased property of our coefficient estimates, but a larger variance in our estimator decreases our confidence that this particular experiment produces estimates close to the truth. Either way, under our relaxed assumption of only a common mean 0 in the errors, we can expect our analysis in the main text to reveal the truth across repeated experiments. + +# F Regression Analysis Examples + +In this section, we give detailed examples (i.e., Example 1 and 2) to clarify how we compute estimates in Figure 2. As noted, we use the unbiased OLS estimate $\hat{\beta} = (\mathbf{X}^{\mathrm{T}}\mathbf{X})^{-1}\mathbf{X}^{\mathrm{T}}\mathbf{Y}$ in place of $\beta$ as is standard. + +Example 1. Let column $j$ of $\mathbf{X}$ contain the realizations of the $h$ -discrepancy for each experiment and let column $k$ contain the train error. Suppose column $\ell$ is the (element-wise) product of columns $k$ and $j$ , column $q$ is the square of column $j$ , and column $r$ is the product of columns $q$ and $k$ . Then, controlling for all other features in $\mathbf{X}$ , the expected change in estimation error per $\delta > 0$ increase in the $h$ -discrepancy is + +$$ +\begin{array}{l} \mathbf {E} \left[ \mathbf {Y} _ {i} \mid \mathbf {X} _ {i} = \mathbf {x} \right] - \mathbf {E} \left[ \mathbf {Y} _ {i} \mid \mathbf {X} _ {i} = \mathbf {x} ^ {\prime} \right] = \beta_ {j} \delta + \beta_ {\ell} \delta \mathbf {x} _ {k} ^ {\prime} \\ + \beta_ {q} \left(\delta^ {2} + 2 \delta \mathbf {x} _ {j} ^ {\prime}\right) + \beta_ {r} \left(\delta^ {2} \mathbf {x} _ {k} ^ {\prime} + 2 \delta \mathbf {x} _ {j} ^ {\prime} \mathbf {x} _ {k} ^ {\prime}\right) \tag {23} \\ \end{array} +$$ + +where $\mathbf{x}'$ is a fixed row-vector of features and $\mathbf{x}$ is defined by + +$$ +\mathbf {x} _ {p} = \left\{ \begin{array}{l l} \mathbf {x} _ {p} ^ {\prime} + \delta & i f p = j, \\ \mathbf {x} _ {k} ^ {\prime} \left(\mathbf {x} _ {j} ^ {\prime} + \delta\right) & i f p = \ell , \\ \left(\mathbf {x} _ {j} ^ {\prime} + \delta\right) ^ {2} & i f p = q, . \\ \mathbf {x} _ {k} ^ {\prime} \left(\mathbf {x} _ {j} ^ {\prime} + \delta\right) ^ {2} & i f p = r, \\ \mathbf {x} _ {p} ^ {\prime} & e l s e \end{array} \right. \tag {24} +$$ + +If this function of $\delta$ is positive, we know increasing the $h$ -discrepancy increases the bias as suggested by our theory. + +Example 2. Let column $j$ of $\mathbf{X}$ be 1 if we use S-BERT representations and 0 otherwise. Let column $k$ of $\mathbf{X}$ indicate use of $P$ -BERT in the same way and suppose the reference category for the BERT representations is A-BERT. Let column $\ell$ of $\mathbf{X}$ contain discrepancy $D_{i}$ for each experiment and let column $q$ be the element-wise product of columns $j$ and $\ell$ ; i.e., interaction terms. Then, controlling for all other features in $\mathbf{X}$ , the expected increase in error-gap using S-BERT instead of A-BERT is + +$$ +\begin{array}{l} \mathbf {E} \left[ D _ {i} - \mathbf {Y} _ {i} \mid \mathbf {X} _ {i} = \mathbf {x} \right] - \mathbf {E} \left[ D _ {i} - \mathbf {Y} _ {i} \mid \mathbf {X} _ {i} = \mathbf {x} ^ {\prime} \right] \tag {25} \\ = - \left(\beta_ {j} + \beta_ {q} D _ {i}\right) \\ \end{array} +$$ + +where $\mathbf{x}'$ is a fixed row-vector of features such that $\mathbf{x}_{\ell}^{\prime} = D_{i}$ and $\mathbf{x}_j^\prime = \mathbf{x}_k^\prime = 0$ . The row-vector $\mathbf{x}$ is defined by $\mathbf{x}_r = \{1$ if $r = j$ , $\mathbf{x}_{\ell}^{\prime}$ if $r = q$ , $\mathbf{x}_r^\prime$ else\}. When this function of $D_{i}$ is positive, we know using S-BERT is expected to increase the error-gap. + +
Dep. Variable:est. errorR-squared:0.944
Model:OLSAdj. R-squared:0.944
Method:Least SquaresF-statistic:1949.
Prob (F-statistic):0.00
Log-Likelihood:3347.1
No. Observations:2428AIC:-6650.
Df Residuals:2406BIC:-6523.
Df Model:21
coefstd errtP> |t|[0.025]0.975]
Intercept-0.02060.034-0.6060.545-0.0870.046
hspace[T.lin]-0.02390.006-3.8170.000-0.036-0.012
group[T.pdb]0.05360.0163.3400.0010.0220.085
group[T.rst]0.06000.0183.2560.0010.0240.096
bert[T.pooled]0.00340.0060.6010.548-0.0080.015
bert[T.sentence]0.02500.0092.8720.0040.0080.042
news[T.notnews]-0.00290.010-0.2890.773-0.0220.017
train_error0.32620.0804.0540.0000.1680.484
lamb-0.01500.048-0.3120.755-0.1090.079
hdisc0.15450.0811.9060.057-0.0040.313
bert[T.pooled]:hdisc-0.03130.009-3.6220.000-0.048-0.014
bert[T.sentence]:hdisc-0.13700.013-10.6000.000-0.162-0.112
hspace[T.lin]:hdisc0.01940.0092.1590.0310.0020.037
group[T.pdb]:hdisc-0.02100.021-1.0020.316-0.0620.020
group[T.rst]:hdisc0.06710.0282.4100.0160.0130.122
news[T.notnews]:hdisc0.03200.0132.5290.0120.0070.057
hdisc:train_error1.96650.19610.0520.0001.5832.350
np.power(hdisc, 2)0.48310.0529.3230.0000.3810.585
train_error:np.power(hdisc, 2)-1.68670.152-11.0740.000-1.985-1.388
lamb:train_error-0.58610.122-4.8030.000-0.825-0.347
np.power(lamb, 2)-0.13460.071-1.8920.059-0.2740.005
train_error:np.power(lamb, 2)0.40430.1004.0290.0000.2080.601
Omnibus:2.707Durbin-Watson:1.548
Prob(Omnibus):0.258Jarque-Bera (JB):2.718
Skew:-0.046Prob(JB):0.257
Kurtosis:3.136Cond. No.463.
+ +Warnings: +[1] Standard Errors assume that the covariance matrix of the errors is correctly specified. +Table 3: Full description of the regression model including all features, estimated coefficients, and relevant tests for diagnosis and inference. Tests involving standard errors (std err) are only valid if the model errors follow the assumed distribution. We believe most variables are self-explanatory, but we do provide some assistance to reader: lamb corresponds to $\lambda$ , hdisc corresponds to the $h$ -discrepancy, train_error corresponds to the error on the source sample, np.power(◇, 2) corresponds to the square of the feature ◇, presence of : indicates a multiplication of features (i.e., an interaction-term), and hspace corresponds to the type of classifier used (i.e., linear model or fully-connected network). + +![](images/79fc392f50e949c8c24276f6209ab8b2486a4de8accfdda45bf14671f39ab6a6.jpg) + +![](images/e8aeb0e1877caf8de4a4f87ab75277d974ada333fb00414eabb91085fec32678.jpg) + +![](images/4f9db0aea6e0f549c6641cf3474821196ef8e5f75bdbd24e195ca134be2de07a.jpg) + +![](images/399ad4f984f6fa18ff429f8547f8d1adc34afa963be9cd308b05a01b4d9a9a9b.jpg) +Figure 7: Residual plots. Vertical axes show realized error terms, while horizontal axes show value of some feature that may or may not be in our design matrix. Significant patterns may indicate a missing term in our model. While some patterning may exist, we choose not to include additional terms for reason of interpretability and to meet other (quantifiable) model assumptions. + +![](images/ff8943cb971f1cac62f6107b8da1b1da1f111407e85b96b79f93ee106d2ffd61.jpg) + +![](images/2e9f12853a550ada8031e62151a88b70af16a4a71ac10771f04b75c5aead8583.jpg) \ No newline at end of file diff --git a/thechangethatmattersindiscourseparsingestimatingtheimpactofdomainshiftonparsererror/images.zip b/thechangethatmattersindiscourseparsingestimatingtheimpactofdomainshiftonparsererror/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..7abccc0287f1a6741c70cadbaac3ced603ee2030 --- /dev/null +++ b/thechangethatmattersindiscourseparsingestimatingtheimpactofdomainshiftonparsererror/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f47585d4af9cb57ab966a6c3422448f76f686437d84c0f2d9755e25d2d72a2d7 +size 811836 diff --git a/thechangethatmattersindiscourseparsingestimatingtheimpactofdomainshiftonparsererror/layout.json b/thechangethatmattersindiscourseparsingestimatingtheimpactofdomainshiftonparsererror/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..ec1e84a7591d9f245c89972f21acb6bc9c5c5006 --- /dev/null +++ b/thechangethatmattersindiscourseparsingestimatingtheimpactofdomainshiftonparsererror/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e462b68962c3d48528828200c18001af39acb76c3d135480546b1f055428ec54 +size 708682 diff --git a/theimpactoflexicalandgrammaticalprocessingongeneratingcodefromnaturallanguage/1b4c8b69-a5ba-4ebc-87f7-de8bde9c6099_content_list.json b/theimpactoflexicalandgrammaticalprocessingongeneratingcodefromnaturallanguage/1b4c8b69-a5ba-4ebc-87f7-de8bde9c6099_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..18a1f2dbc80789e929fd6b01029895db32066461 --- /dev/null +++ b/theimpactoflexicalandgrammaticalprocessingongeneratingcodefromnaturallanguage/1b4c8b69-a5ba-4ebc-87f7-de8bde9c6099_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7b7f78e6b8c6f34ddff10ff20ffe448d8913ca1c7cd4ed83fe702053c6bd0e75 +size 74061 diff --git a/theimpactoflexicalandgrammaticalprocessingongeneratingcodefromnaturallanguage/1b4c8b69-a5ba-4ebc-87f7-de8bde9c6099_model.json b/theimpactoflexicalandgrammaticalprocessingongeneratingcodefromnaturallanguage/1b4c8b69-a5ba-4ebc-87f7-de8bde9c6099_model.json new file mode 100644 index 0000000000000000000000000000000000000000..45b3636daaab6a2503ff9f8113454c5125159ac3 --- /dev/null +++ b/theimpactoflexicalandgrammaticalprocessingongeneratingcodefromnaturallanguage/1b4c8b69-a5ba-4ebc-87f7-de8bde9c6099_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4164c59ba7f9a760b0876abf15edf1321030921976bfdd65d8edae18264489a4 +size 83991 diff --git a/theimpactoflexicalandgrammaticalprocessingongeneratingcodefromnaturallanguage/1b4c8b69-a5ba-4ebc-87f7-de8bde9c6099_origin.pdf b/theimpactoflexicalandgrammaticalprocessingongeneratingcodefromnaturallanguage/1b4c8b69-a5ba-4ebc-87f7-de8bde9c6099_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..14688d294b7c58b56490c59e566829d8b91e9944 --- /dev/null +++ b/theimpactoflexicalandgrammaticalprocessingongeneratingcodefromnaturallanguage/1b4c8b69-a5ba-4ebc-87f7-de8bde9c6099_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b4fc8e1fba5855e1b1e9fb54ac2fa07faa3f7e16e6fa6383fa98e6a04db1b769 +size 515713 diff --git a/theimpactoflexicalandgrammaticalprocessingongeneratingcodefromnaturallanguage/full.md b/theimpactoflexicalandgrammaticalprocessingongeneratingcodefromnaturallanguage/full.md new file mode 100644 index 0000000000000000000000000000000000000000..d2abef46b6fe4f4aeabcf7068da59ba3a28846b7 --- /dev/null +++ b/theimpactoflexicalandgrammaticalprocessingongeneratingcodefromnaturallanguage/full.md @@ -0,0 +1,318 @@ +# The impact of lexical and grammatical processing on generating code from natural language + +Nathanaël Beau1,2 and Benoit Crabbé1 + +1 Université de Paris, LLF, CNRS, 75013 Paris, France + +2 onepoint, 29 rue des Sablons, F-75116 Paris, France + +n.beau@groupeonepoint.com + +benoit.crabbe@u-paris.fr + +# Abstract + +Considering the seq2seq architecture of Yin and Neubig (2018) for natural language to code translation, we identify four key components of importance: grammatical constraints, lexical preprocessing, input representations, and copy mechanisms. To study the impact of these components, we use a state-of-the-art architecture that relies on BERT encoder and a grammar-based decoder for which a formalization is provided. The paper highlights the importance of the lexical substitution component in the current natural language to code systems. + +# 1 Introduction + +Translating natural language program descriptions to actual code is meant to help programmers to ease writing reliable code efficiently by means of a set of advanced code completion mechanisms. + +There are mainly two classes of methods for obtaining code corresponding to a query expressed in natural language. The first one is code retrieval, which consists of searching and retrieving an appropriate code snippet from a code database. The second one is code generation, where the goal is to generate code fragments from a natural language description, generating potentially previously unseen code. In this work, we are interested in Python code generation. Code generation features a mismatch between an ambiguous and noisy natural language input and the structured nature of the generated code. Although Python's vocabulary has a finite number of keywords, the set of values that can be assigned to a variable is infinite and constitutes one of the issues in predicting code corresponding to natural language. + +Like many other NLP tasks, current architectures for natural language to code generally take advantage of pre-trained language models such as BERT (Devlin et al., 2019) or GPT (Brown et al., 2020) based on the transformer architecture (Vaswani + +et al., 2017). In particular, these architectures are used for code generation where parallel data is limited due to the human expertise required for alignment. The best results on code generation are reached by pretraining seq2seq models on external sources, then by fine-tuning those models on smaller data sets. For instance, Orlanski and Gittens (2021) fine-tune BART (Lewis et al., 2020) on data pairs of natural language and code and by taking advantage of external informations. Similarly, Norouzi et al. (2021) used BERT and a transformer decoder in a semi-supervised way by taking advantage of a large amount of additional monolingual data. Another popular method is to train large language models on code (Austin et al., 2021; Hendrycks et al., 2021). Notably, GPT-3 has been finetuned on a large quantity of data from Github to obtain a powerful language model named Codex (Chen et al., 2021) that powers Github Copilot, a tool to help developers. + +Overall the above mentioned solutions aim to take advantage of large amounts of training data available nowadays, but few of them care about generating code that is guaranteed to be syntactically correct nor well typed. Let us mention some exceptions from semantic parsing like Dong and Lapata (2016); Rabinovich et al. (2017); Yin and Neubig (2017) that rely on grammatical constraints to ensure that the generated code can be executable. + +In this work, we study variations around the TranX seq2seq architecture (Yin and Neubig, 2018) for translating natural language to code. Rather than generating directly code tokens from natural language, the architecture generates an Abstract Syntax Tree (AST) constrained by the programming language grammar. + +The paper reports state of the art results on the task and specifically introduces: + +- A formalization of the grammar constrained code generator relying on the Earley (1970) parser transition system. + +- A study of the impact of key components of the architecture on the performance of the system: we study the impact of the grammatical component itself, the impact of the language model chosen, the impact of variable naming and typing and the impact of the input/output copy mechanisms. + +It is structured as follows. Section 2 formalizes the symbolic transition system used for generating the grammatically correct code, Section 3 describes a family of variants around the TranX architecture that will be used to study the impact of these variations in the experimental part of the paper (Section 4). + +# 2 A transition system for code generation + +Among the models tested in the paper, some are generating syntactically constrained code. In the context of our study, we propose a transition model that meets two objectives: the code generated is grammatically valid in terms of syntax and the whole translation process still reduces to a seq2seq transduction mechanism that allows us to leverage standard machine learning methods. + +To this end we introduce a transition system for code generation that generates an AST as a sequence of actions. The derivations can then be translated into ASTs and in actual Python code by means of deterministic functions. The set of valid ASTs is a set of trees that are generated by an ASDL grammar (Wang et al., 1997). An ASDL grammar is essentially a context free grammar abstracting away from low level syntactic details of the programming language and aims to ease the semantic interpretation of the parse trees. To this end ASDL grammar rules come with additional decorators called constructors and field names (Figure 1). + +Our transition system generates derivations, or sequences of actions, that can be translated to a syntactically correct Python code. We adapt to code generation the transition system of the Earley parser (Earley, 1970) as formalized in Figure 2. The generator state is a stack of dotted rules. A dotted rule is a rule of the form $A \rightarrow \alpha \bullet X\beta$ where $\alpha$ is a sequence of grammar symbols whose subtrees are already generated and $X\beta$ is a sequence of grammar symbols for which the subtrees are yet to be generated. The $\bullet X$ symbol is the dotted symbol or the next symbol for which the system has to generate the subtree. The Python ASDL grammar + +includes rules with star $(\ast)$ qualifiers allowing zero or more occurrences of the starred symbol. The transition system uses an additional set of starred actions and a CLOSE action to stop these iterations (Figure 2). + +Each PREDICT(C) action starts the generation of a new subtree from its parent. The GENERATE action adds a new leaf to a tree. The COMPLETE action finishes the generation of a subtree and continues the generation process with its parent. The set of PREDICT actions is parametrized by the ASDL rule constructor $(C)$ , thus there are as many predict actions as there are constructors in the ASDL grammar. Constructors are required in order to generate the actual ASTs from the derivations. + +GENERATE(V) actions are actions responsible for generating the terminal or primitive symbols. The Python ASDL grammar generates ASTs with primitive leaf types (identifier, int, string, constant) that have to be filled with actual values for the AST to be useful. To generate actual primitive values the set of generate actions is also parametrized by the actual values $V$ for the primitive types. The set of such values is infinite and consequently the set of generate actions is also infinite. + +Non-Determinism comes from the use of PREDICT(C), GENERATE(V) and CLOSE rules. By contrast the application of the COMPLETE action is entirely deterministic: once the generator has a completed dotted rule on the top of its stack, it has no other choice than applying the complete rule. + +The sequential generation process is illustrated in Figure 3. Given a start state, at each time step, the generator has to decide which action to perform according to the current state of the stack and updates the stack accordingly. Once the generator reaches the goal state, we collect the list of actions performed (the derivation) in order to build the AST that we finally translate into actual Python code1. + +# 3 Factors influencing code prediction + +All architectures analyzed in this study are variations around a seq2seq architecture. We describe the several variants of this architecture used in this paper both on the encoder and decoder side. We identify key factors that have an impact on the natural-language-to-code translation architecture + +```txt +expr = BinOp expr left, operator op, expr right +operator = Add +expr = Constant constant value +expr = List expr*elts +``` + +
ActionTransitionCondition
START(C)\(\langle A \rightarrow \bullet \alpha \rangle\)
GOAL\(\langle A \rightarrow \alpha \bullet \rangle\)
PREDICT(C)\(\langle \mathbf{S}|A \rightarrow \alpha \bullet B\beta \rangle\)\( \Rightarrow \)\(\langle \mathbf{S}|A \rightarrow \alpha \bullet B\beta |B \rightarrow \bullet \gamma \rangle\)\((B \rightarrow \gamma \in \text{rules})\)
GENERATE(V)\(\langle \mathbf{S}|A \rightarrow \alpha \bullet t\beta \rangle\)\( \Rightarrow \)\(\langle \mathbf{S}|A \rightarrow \alpha t \bullet \beta \rangle\)\((t \in \text{primitives})\)
COMPLETE\(\langle \mathbf{S}|A \rightarrow \alpha \bullet B\beta |B \rightarrow \gamma \bullet \rangle\)\( \Rightarrow \)\(\langle \mathbf{S}|A \rightarrow \alpha B \bullet \beta \rangle\)
PREDICT*(C)\(\langle \mathbf{S}|A \rightarrow \alpha \bullet B^{*}\beta \rangle\)\( \Rightarrow \)\(\langle \mathbf{S}|A \rightarrow \alpha \bullet B^{*}\beta |B \rightarrow \bullet \gamma \rangle\)\((B \rightarrow \gamma \in \text{rules})\)
GENERATE*(V)\(\langle \mathbf{S}|A \rightarrow \alpha \bullet t^{*}\beta \rangle\)\( \Rightarrow \)\(\langle \mathbf{S}|A \rightarrow \alpha t^{*}t^{*}\beta \rangle\)\((t \in \text{primitives})\)
COMPLETE*\(\langle \mathbf{S}|A \rightarrow \alpha \bullet B^{*}\beta |B \rightarrow \gamma \bullet \rangle\)\( \Rightarrow \)\(\langle \mathbf{S}|A \rightarrow \alpha B \bullet B^{*}\beta \rangle\)
CLOSE*\(\langle \mathbf{S}|A \rightarrow \alpha \bullet X^{*}\beta \rangle\)\( \Rightarrow \)\(\langle \mathbf{S}|A \rightarrow \alpha \bullet \beta \rangle\)
+ +```latex +Generator State (stack) Action + $\langle \text{expr} \rightarrow \bullet \text{expr}^* \rangle$ START(List) + $\langle \text{expr} \rightarrow \bullet \text{expr}^* | \text{expr} \rightarrow \bullet \text{expr operator expr} \rangle$ PREDICT*(BinOp) + $\langle \text{expr} \rightarrow \bullet \text{expr}^* | \text{expr} \rightarrow \bullet \text{expr operator expr} | \text{expr} \rightarrow \bullet \text{constant} \rangle$ PREDICT(Constant) + $\langle \text{expr} \rightarrow \bullet \text{expr}^* | \text{expr} \rightarrow \bullet \text{expr operator expr} | \text{expr} \rightarrow \text{constant} \rangle$ GENERATE(7) + $\langle \text{expr} \rightarrow \bullet \text{expr}^* | \text{expr} \rightarrow \text{expr • operator expr} \rangle$ COMPLETE + $\langle \text{expr} \rightarrow \bullet \text{expr}^* | \text{expr} \rightarrow \text{expr • operator expr} | \text{expr} \rightarrow \bullet \rangle$ PREDICT(Add) + $\langle \text{expr} \rightarrow \bullet \text{expr}^* | \text{expr} \rightarrow \text{expr operator • expr} \rangle$ COMPLETE + $\langle \text{expr} \rightarrow \bullet \text{expr}^* | \text{expr} \rightarrow \text{expr operator • expr} | \text{expr} \rightarrow \bullet \text{constant} \rangle$ PREDICT(Constant) + $\langle \text{expr} \rightarrow \bullet \text{expr}^* | \text{expr} \rightarrow \text{expr operator • expr} | \text{expr} \rightarrow \text{constant} \rangle$ GENERATE(5) + $\langle \text{expr} \rightarrow \bullet \text{expr}^* | \text{expr} \rightarrow \text{expr operator expr} \rangle$ COMPLETE + $\langle \text{expr} \rightarrow \text{expr • expr}^* \rangle$ COMPLETE* + $\langle \text{expr} \rightarrow \text{expr • expr}^* | \text{expr} \rightarrow \bullet \text{constant} \rangle$ PREDICT*(Constant) + $\langle \text{expr} \rightarrow \text{expr • expr}^* | \text{expr} \rightarrow \text{constant} \rangle$ GENERATE(4) + $\langle \text{expr} \rightarrow \text{expr expr • expr}^* \rangle$ COMPLETE* + $\langle \text{expr} \rightarrow \text{expr expr}^* |$ CLOSE* +``` + +![](images/3b8b9e7cfa9d48215bfaa06ca2c87661fe5eaeb42aaa0db7bb5d5bfc6ca441d9.jpg) +Figure 1: Example of ASDL rules for the Python language. Each rule is built from a set of grammatical symbols (in blue), is uniquely identified by a constructor name (in red) and provides names to its right hand side symbols, its fields (in green). Grammatical symbols are split in nonterminals (like expr) and terminals or primitives (like constant). Grammatical symbols can also be annotated with qualifiers $(\star)$ that allow for zero or more iterations of the symbol. +Figure 2: An Earley inspired transition system for generating Abstract Syntactic Trees. The state of the generator is a stack of dotted rules whose bottom is S. As in the the Earley parser, the PREDICT rule starts the generation of a new subtree by pushing a new dotted rule on the stack, the GENERATE rule adds a leaf to the tree by swapping the top of the stack and the COMPLETE rule attaches a generated subtree into its parent by popping the top two elements of the stack and pushing an updated dotted rule. To handle $\star$ qualifiers we add the starred inference rules where COMPLETE* and GENERATE* implement an iteration that stops with the CLOSE* rule. +Figure 3: Example derivation for the generation of the Python list expression $[7 + 5, 4]$ . The derivation starts with expr as axiom symbol and applies transitions until the goal is reached. The list of actions performed is called the generator derivation. Given a generated derivation we can design a straightforward deterministic procedure to translate it into an AST. The actual Python code is generated from the AST by the astor library. + +and we formalize a family of models that allow to test variations of these factors. + +We consider a family of models generating Python code $y$ from a natural language description $x$ , that have the generic form: + +$$ +p (y | x) = \prod_ {t} p \left(y _ {t} \mid y _ {< t}, x\right) \tag {1} +$$ + +$y$ is either a sequence of code tokens in case we do not use a grammar, or a sequence of actions from a derivation in case we use a grammar. The decoding objective aims to find the most-probable hypothesis among all candidate hypotheses by solving the following optimization problem: + +$$ +\hat {y} = \underset {y} {\operatorname {a r g m a x}} p (y | x) \tag {2} +$$ + +The family of models varies according to four key qualitative factors that we identify in the TranX architecture. First we describe a substitution procedure managing variables and lists names in section 3.1). Second, in section 3.2, we test the architectural variations for encoding the natural language sequence. Third, in section 3.3, we describe variations related to constraining the generated code with grammatical constraints and architectural variations that allow to copy symbols from the natural language input to the generated code. + +# 3.1 Substitution + +Programming languages come with a wide range of variable names and constant identifiers that make the set of lexical symbols infinite. Rather than learning statistics on a set of ad-hoc symbols, we rather normalize variable and constant names with a pre-processing method, reusing the method of Yin and Neubig (2018). + +Preprocessing amounts to substitute the actual names of the variables with a normalized set of predefined names known to the statistical model. The substitution step renames all variables both in the natural language and in the code with conventional names such as var_0, var_1, etc. for variables and lst_0, lst_1, etc. for lists. A post processing step substitutes back the predicted names with the original variable names in the system output. For example, given the natural language intent: + +create list `done` containing permutations of each element in list `[a, b, c, d]` with variable `x` as tuples + +is transformed into: + +create list var_0 containing permutations of each element in list 1st_0 with variable var_1 as tuples + +The predicted code such as var_0 = [(el, var_1) for el in [lst_0]] is transformed back into done = [(el, x) for el in [a, b, c, d]]. + +Models using variable replacement as illustrated above, are identified with the notation SUBSTITUTION = TRUE in section 4. Implementing this heuristic is made easy by the design of the CoNaLa data set where all such names are explicitly quoted in the data while for Django we had to detect variable names by comparing natural language with its corresponding code. + +# 3.2 Encoder + +We switched between a classic bi-LSTM and a pretrained $\mathrm{BERT}_{\mathrm{BASE}}$ to encode the input natural language $\{x_{i}, i \in [[1, n]]\}$ of $n$ words into a vectorial representations $\{h_{i}^{(\mathrm{enc})}, i \in [[1, n]]\}$ which are later used to compute the attention mechanism. + +We set the BERT factor to TRUE when using it and FALSE when using the bi-LSTM. + +# 3.3 Decoder + +At each time step $t$ , the LSTM decoder computes its internal hidden state $h_t^{(\mathrm{dec})}$ : + +$$ +h _ {t} ^ {(\mathrm {d e c})} = \operatorname {L S T M} \left([ e _ {t - 1}: \widetilde {a} _ {t - 1} ], h _ {t - 1} ^ {(\mathrm {d e c})}\right) \tag {3} +$$ + +where $e_{t - 1}$ is the embedding from the previous prediction, $\widetilde{a}_{t - 1}$ is the attentional vector. + +We compute the attentional vector $\widetilde{a}_t$ as in Luong et al. (2015) combining the weighted average over all the source hidden state $c_t$ and the decoder hidden state $h_t^{(\mathrm{dec})}$ : + +$$ +\widetilde {a} _ {t} = W _ {a} \left[ c _ {t}: h _ {t} ^ {(\mathrm {d e c})} \right] \tag {4} +$$ + +It is the attention vector $\widetilde{a}_t$ which is the key to determine the next prediction $y_{t}$ + +We use several variants of the code generator, that we describe by order of increasing complexity. The basic generator is a feed forward that uses the attention vector to generate a code token $v$ from a vocabulary $V$ : + +$$ +\begin{array}{l} p \left(y _ {t} = \text {G E N E R A T E} [ v ] \mid x, e _ {< t}\right) = \tag {5} \\ \operatorname {s o f t m a x} \left(e _ {v} ^ {\top} \cdot W _ {g} \cdot \widetilde {a} _ {t}\right) \\ \end{array} +$$ + +![](images/215d2032c48b889f54b0e247a6f9b1f0ecb60339a568853250ba2f297dc11829.jpg) +Figure 4: Illustration of the seq2seq model with the variables SUBSTITUTION, GRAMMAR, BERT, POINTERNET set to TRUE. We describe here the complete process where we predict a derivation sequence composed of grammar rules and CLOSE (PREDRULE) or Python variables/built-in (GENERATE). The astor library is used to transform the AST constructed with the derivation sequence into Pyton code. In the case where GRAMMAR = FALSE, we only have the GENERATE action which exclusively predicts unconstrained code tokens (as for a classical seq2seq). + +These models are not constrained by the Python grammar and we identify these models with GRAMMAR = FALSE. + +We also use a pointer network that may either copy symbols from input to output or generate symbols from $V$ . Then the probability of generating the symbol $v$ is given by the marginal probability: + +$$ +p \left(y _ {t} = \text {G E N E R A T E} [ v ] \mid x, e _ {< t}\right) = +$$ + +$$ +p (\text {g e n} | x, e _ {< t}) p (v | \text {g e n}, x, e _ {< t}) \tag {6} +$$ + +$$ ++ p (\operatorname {c o p y} | x, e _ {< t}) p (v | \operatorname {c o p y}, x, e _ {< t}) +$$ + +The probabilities $p(\mathrm{gen}|.)$ and $p(\mathrm{copy}|.)$ sum to 1 and are computed with $\mathrm{softmax}(W \cdot \widetilde{a}_t)$ . The probability of generating $v$ from the vocabulary $V$ , $p(v|\mathrm{gen},.)$ is defined in the same way as (5). We use the pointer net architecture (Vinyals et al., 2015) to compute the probability $p(v|\mathrm{copy},.)$ of copying an element from the natural language $x$ . Models that use a pointer network are identified with $\mathrm{PN} = \mathrm{TRUE}$ , otherwise with $\mathrm{PN} = \mathrm{FALSE}$ . + +Finally we use a set of models that are constrained by the Python grammar and that rely on the transition system from section 2. Rather than directly generating Python code, these models generate a derivation whose actions are predicted using two prediction tasks. + +When the generator is in a state where the dot of the + +item on the top of the stack points on a nonterminal symbol, the PREDRULE is used. This task either outputs a PREDICT(C) action or the CLOSE action: + +$$ +p \left(y _ {t} = \text {P R E D R U L E} [ c ] \mid x, e _ {< t}\right) = \tag {7} +$$ + +$$ +\operatorname {s o f t m a x} \left(e _ {r} ^ {\top} \cdot W _ {p} \cdot \tilde {a} _ {t}\right) +$$ + +When the generator is in a state where the dot of the item on the top of the stack points on a terminal symbol, the generate task is used. This amounts to reuse either equation (5) or equation (6) according to the model at hand. Models constrained by the grammar are labelled with GRAMMAR = TRUE. Recall that the COMPLETE action of the transition system is called deterministically (Section 2). + +# 4 Experiments + +In this section we describe the characteristics of the data sets on which we have tested our different setups and the underlying experimental parameters2. + +# 4.1 Data sets + +In this study we use two available data sets, Django and CoNaLa, to perform our code generation task. + +The Django data set provides line-by-line comments with code from the Django web framework. + +About $70\%$ of the 18805 examples are simple Python operation ranging from function declarations to package imports, and including exception handling. Those examples strongly share the natural language structure (e.g. call the function cache.close $\rightarrow$ cache.close(). More than $26\%$ of the words in the natural language are also present in the code, BLEU score between the natural language and code is equal to 19.4. + +CoNaLa is made up of 600k NL-code pairs from StackOverflow, among which 2879 examples have been been manually cleaned up by developers. All results are reported on the manually curated examples, unless stated otherwise. The natural language descriptions are actual developer queries (e.g. Delete an element 0 from a dictionary 'a') and the associated code is diverse and idiomatic (e.g. {i: a[i] for i in a if $(\mathrm{i} != 0)$ ). Compared to Django, the code is much more challenging to generate. Especially because the number of words shared between the NL and the code is much lower $(\mathrm{BLEU} = 0.32)$ . Also, the code is longer and more complex with an AST depth of 7.1 on average against 5.1 for Django. + +# 4.2 Vocabulary generation + +The vocabulary of natural language and code is essential. Usually, this vocabulary is created by adding all the words present in the training data set. There are however exceptions that are detailed in this section. + +The natural language vocabulary relies on a byte pair encoding tokenizer when BERT = TRUE. As explained in section 3.1, the variable names are replaced with special tokens var_i and lst_i. These new tokens are crucial to our problem, and added to the BERT vocabulary. We can then fine-tune BERT with this augmented vocabulary on our data sets. + +For the decoder part, when GRAMMAR = TRUE, the vocabulary of grammatical actions is fixed, while the vocabulary of AST leaves has to be built. This associated vocabulary can be composed of built-in Python functions, libraries with their associated functions or variable names. Its creation is consequently a major milestone in the generation process. + +To create this external vocabulary, we proceed as in $\mathsf{TranX}$ . From the code, we create the derivation sequence composed of the action of the grammar as well as the primitives. All primitives of the + +action sequences are incorporated into our external vocabulary. + +# 4.3 Setup + +When BERT = FALSE, the size of the representations is kept small to prevent overfitting. Encoder and decoder embedding size is set to 128. The hidden layer size of the encoder and decoder bi-LSTM is set to 256 and the resulting attention vector size is 300. We have two dropout layers: for embeddings and at the output of the attention. We use Adam optimizer with learning rate $\alpha = 5.10^{-3}$ . + +When BERT = TRUE, encoder embeddings have a natural size of 756 with BERT. We therefore apply a linear transformation to its output to get an embedding size equal to 512. The size of LSTM decoder hidden state and attention vector are set to 512. We regularize only the attentional vector in that case. We use Adam optimizer with learning rate $\alpha = 5.10^{-5}$ . In both cases, we use a beam search size of 15 for decoding. + +Evaluation To compare with previous work, we report the standard evaluation metrics for each data set: exact match accuracy and corpus-level BLEU. + +Python version As the grammar slightly changes between Python versions, let us mention that all our experiments have been carried out with Python 3.7. + +# 4.4 Ablation study + +![](images/79e9b5238db27d87b61ee7c86449bc0734673bcd8dc6e5f00a8c9958092beb96.jpg) +Figure 5: Difference between the marginal mean of each variable for the TRUE and FALSE conditions. + +To highlight the contribution of the different factors, SUBSTITUTION, BERT, GRAMMAR, PN on the Django and CoNaLa data sets we report a detailed study of their impact in Table 1. + +
SubstitutionBERTGrammarPNCoNaLa BLEUCoNaLa accuracyDjango BLEUDjango accuracy
FalseFalseFalseFalse21.05 ± 0.810.9 ± 0.4242.58 ± 1.5426.86 ± 1.15
True22.33 ± 0.781.7 ± 0.9064.79 ± 1.0062.85 ± 1.21
TrueFalse20.59 ± 0.742.87 ± 0.4843.23 ± 1.6230.12 ± 0.63
True22.16 ± 1.933.87 ± 1.6562.55 ± 1.6065.20 ± 0.03
TrueFalseFalse30.83 ± 4.082 ± 0.9453.18 ± 0.8730.28 ± 0.26
True30.98 ± 1.333.3 ± 1.4858.69 ± 1.2837.96 ± 0.27
TrueFalse25.88 ± 0.943.8 ± 1.9647.32 ± 0.5029.62 ± 0.33
True28.43 ± 0.644.4 ± 1.6752.55 ± 0.5137.38 ± 0.38
TrueFalseFalseFalse31.17 ± 0.883.1 ± 1.5270.4 ± 0.2570.40 ± 0.29
True32.10 ± 1.063.1 ± 1.2470.28 ± 0.3870.46 ± 0.37
TrueFalse33.36 ± 1.636.37 ± 0.6370.82 ± 0.2271.3 ± 0.19
True32.86 ± 1.755 ± 1.6770.62 ± 0.4971.47 ± 0.19
TrueFalseFalse36.43 ± 0.414.5 ± 1.8476.97 ± 0.1574.58 ± 0.27
True36.29 ± 2.275 ± 1.3276.62 ± 0.5076 ± 0.71
35.42 ± 1.75*5.2 ± 1.33*--
TrueFalse35.04 ± 1.037.3 ± 1.2576.20 ± 0.4674.88 ± 0.56
True37.99 ± 1.857.5 ± 1.1276.32 ± 0.5975.32 ± 1.54
39.01 ± 1.08*7.7 ± 1.92*--
+ +Table 1: Performances with different natural language encoders on the development sets with and without a grammatical component. The scores reported are the mean and standard deviation resulting from training with 5 different seeds. The * refers to the use of ${100}\mathrm{k}\mathrm{{CoNaLa}}$ mined data in addition to clean examples. + +The results are analyzed by distinguishing lexical and grammatical aspects and by identifying relations between the different factors. We start by a comparison of the marginal mean of the BLEU score for each of our variables in both conditions. Figure 5 highlights the mean difference between the conditions by contrasting the case where the value is TRUE with the case where the value is FALSE. + +Pointer network The pointer network can improve the results, especially when SUBSTITUTION = FALSE. This is because the only way to obtain the name of the variables is to copy them. Combined with substitution, the pointer network offers an additional possibility to predict the var_i, lst_i which allows to achieve the best results with a BLEU score of 39.01 on CoNaLa and an exact match accuracy of 76 on Django. + +Substitution and Typing The scores are stabilised and much higher with substitution. We gain more than 9 points of BLEU on CoNaLa (respectively 20 points on Django) thanks to substitution. The "weakest" configuration where all variables are FALSE except the substitution gives better results than all configurations where SUBSTITUTION = FALSE. + +The increase in BLEU with substitution can be explained in two ways. On the one hand, we remark that the model has difficulties to memorize the val + +ues to fill the lists with GENERATE. For example, four tokens of code must be generated to predict the list [a, b, c, d]. Using substitution, the model can just predict lst_0 which will be replaced by [a, b, c, d] during postprocessing. This avoids a potential error in the creation of the list and directly gives a valid 4-gram. This contributes to greatly increase the BLEU, which shows the importance of replacing lists. On CoNaLa, BLEU score on the development set drops from an average of 37.99 to an average of 30.66 without list replacement. Besides list replacement, the architecture has also a weakness with respect to variable typing. When using the grammar without substitution, the results are lower than without grammar. This effect is the result of a type checking failure. The model predicts ill-typed AST structures. For instance it predicts an AST whose corresponding code should be 1.append ([6, 7]). However the AST library we used prevents from generating such ill-typed code. The absence of code generation in such cases explain the decrease in BLEU score. + +The use of substitution partially corrects for these typing errors because the substituted symbols var_i, lst_i are generally more likely to be predicted and are likely to have the right type thanks to the mapping. + +Grammatical aspect The transition system doesn't improve the results on average because + +
SystemCoNaLa BLEUCoNaLa accuracyDjango BLEUDjango accuracy
(Yin and Neubig, 2018)27.2--73.7
(Yin and Neubig, 2018) + mined28.1---
(Orlanski and Gittens, 2021) + mined 100k30.55---
(Norouzi et al., 2021) + 600k mined32.57--81.03
Ours BERT + GRAMMAR31.64.579.8679.77
Ours BERT + GRAMMAR + 100k mined34.205.8--
Ours BERT (tokens)30.731.4079.8179.61
Ours BERT + 100k mined (tokens)32.393.4--
+ +Table 2: Comparisons of the systems trained without external data sources on CoNaLa and Django test sets. + +of the empty predictions when SUBSTITUTION = FALSE. The use of the transition system leads to better results when SUBSTITUTION = TRUE but not as drastically as one would have expected. However the real contribution of the grammar associated with substitution is the syntactic validity of the code in $100\%$ of the cases, as tested with our architecture obtaining the best results. In scenarios where we do not use the grammar, it is never the case to have an empty output. But then the proportion of code sequences that are actually syntactically valid in this setup is $92\%$ on average. + +BERT As expected when using BERT to encode the natural language input we get an improvement of about 6 marginal BLEU on CoNaLa (respectively +3 BLEU on Django). More interestingly, this effect is lower than the one of the substitution operation. + +We conclude that the use of a pre-trained model increases the results but less than substitution, despite what one might think and it suggests that improving the management of variable names and lists is one of the key elements for improving the system. The contribution of grammatical constraints in BLEU may seem detrimental but we could see that this is a side effect of typing constraints in adversarial scenarios. Overall the nonconstrained generated code is syntactically incorrect in $8\%$ of the cases. + +# 4.5 Test + +We compare in table 2 our results with other systems on CoNaLa and Django test sets. We report our best performing models on the development set with and without grammatical constraints. We also use models trained on the full CoNaLa including mined examples to get relevant comparisons. + +Among the other systems Yin and Neubig (2018) is the only one that uses grammatical constraints. + +Our architecture differs with the use of a BERT encoder whereas Yin and Neubig (2018) use an LSTM. The other systems do not use grammatical constraints but rather try to take advantage of additional data. Orlanski and Gittens (2021) and Norouzi et al. (2021) aim to take advantage of the CoNaLa mined examples. As these mined examples are noisy, Orlanski and Gittens (2021) takes advantage of BART (Lewis et al., 2020), a denoising encoder. They also enrich the natural language input with the results of queries from StackOverflow by adding the title of the post, its associated tags, etc. Norouzi et al. (2021) use BERT as encoder and a transformer decoder. They apply the Target Autoencoding method introduced by Currey et al. (2017). During training, the encoder parameters are frozen and the decoder is trained to reconstruct code examples. They use this method on the mined examples to take maximal advantage of the additional noisy data. + +We observe that our grammar based model with BERT encoder is state of the art on CoNaLa while the transformer encoder/decoder architecture of Norouzi et al. (2021) performs best on Django. Quite interestingly the exact match accuracy of these models remain weak on CoNaLa. + +# 5 Conclusion + +We formalized a transition system that allows us to guarantee the generation of syntactically correct code. A detailed study of the components of the seq2seq architecture reveals that the models have difficulties at managing accurately variable names and list encodings. The comparison with models trained on larger noisy data sets reveals that our grammatically constrained architecture without explicit denoising remains competitive. This further highlights the importance of grammatical constraints and of specific processes dedicated to manage variables, list naming and typing. + +Finally, we observe that BLEU and exact match, used in this paper, although commonly used in the literature, are not ideal metrics especially because high BLEU scores do not guarantee that the code will be executable. Even exact match is not satisfactory since a single natural language query can be solved by several python programs. In future work, we plan to build extensions to the datasets used here with additional test cases assessing the correction of the generated code. These tests are likely to support more relevant metrics for code generation evaluation. + +# References + +Jacob Austin, Augustus Odena, Maxwell Nye, Maarten Bosma, Henryk Michalewski, David Dohan, Ellen Jiang, Carrie J. Cai, Michael Terry, Quoc V. Le, and Charles Sutton. 2021. Program synthesis with large language models. CoRR, abs/2108.07732. +Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. 2020. Language models are few-shot learners. +Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, Harrison Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, Alex Ray, Raul Puri, Gretchen Krueger, Michael Petrov, Heidi Khlaaf, Girish Sastry, Pamela Mishkin, Brooke Chan, Scott Gray, Nick Ryder, Mikhail Pavlov, Alethea Power, Lukasz Kaiser, Mohammad Bavarian, Clemens Winter, Philippe Tillet, Felipe Petroski Such, Dave Cummings, Matthias Plappert, Fotios Chantzis, Elizabeth Barnes, Ariel Herbert-Voss, William Hebgen Guss, Alex Nichol, Alex Paino, Nikolas Tezak, Jie Tang, Igor Babuschkin, Suchir Balaji, Shantanu Jain, William Saunders, Christopher Hesse, Andrew N. Carr, Jan Leike, Joshua Achiam, Vedant Misra, Evan Morikawa, Alec Radford, Matthew Knight, Miles Brundage, Mira Murati, Katie Mayer, Peter Welinder, Bob McGrew, Dario Amodei, Sam McCandlish, Ilya Sutskever, and Wojciech Zaremba. 2021. Evaluating large language models trained on code. volume abs/2107.03374. +Anna Currey, Antonio Valerio Miceli Barone, and Kenneth Heafield. 2017. Copied monolingual data improves low-resource neural machine translation. In Proceedings of the Second Conference on Machine Translation, WMT 2017, Copenhagen, Denmark, + +September 7-8, 2017, pages 148-156. Association for Computational Linguistics. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: pre-training of deep bidirectional transformers for language understanding. pages 4171-4186. +Li Dong and Mirella Lapata. 2016. Language to logical form with neural attention. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics, ACL 2016, August 7-12, 2016, Berlin, Germany, Volume 1: Long Papers. The Association for Computer Linguistics. +Jay Earley. 1970. An efficient context-free parsing algorithm. Commun. ACM, 13(2):94-102. +Dan Hendrycks, Steven Basart, Saurav Kadavath, Mantas Mazeika, Akul Arora, Ethan Guo, Collin Burns, Samir Puranik, Horace He, Dawn Song, and Jacob Steinhardt. 2021. Measuring coding challenge competence with APPS. CoRR, abs/2105.09938. +Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. 2020. BART: denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, ACL 2020, Online, July 5-10, 2020, pages 7871-7880. Association for Computational Linguistics. +Thang Luong, Hieu Pham, and Christopher D. Manning. 2015. Effective approaches to attention-based neural machine translation. pages 1412-1421. +Sajad Norouzi, Keyi Tang, and Yanshuai Cao. 2021. Code generation from natural language with less prior knowledge and more monolingual data. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing, ACL/IJCNLP 2021, (Volume 2: Short Papers), Virtual Event, August 1-6, 2021, pages 776-785. Association for Computational Linguistics. +Gabriel Orlanski and Alex Gittens. 2021. Reading stackoverflow encourages cheating: Adding question text improves extractive code generation. CoRR, abs/2106.04447. +Maxim Rabinovich, Mitchell Stern, and Dan Klein. 2017. Abstract syntax networks for code generation and semantic parsing. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, ACL 2017, Vancouver, Canada, July 30 - August 4, Volume 1: Long Papers, pages 1139-1149. Association for Computational Linguistics. + +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. pages 5998-6008. +Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. 2015. Pointer networks. pages 2692-2700. +Daniel C. Wang, Andrew W. Appel, Jeffrey L. Korn, and Christopher S. Serra. 1997. The zephyr abstract syntax description language. In Proceedings of the Conference on Domain-Specific Languages, October 15-17, 1997, Santa Barbara, California, USA, pages 213-228. +Pengcheng Yin and Graham Neubig. 2017. A syntactic neural model for general-purpose code generation. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, ACL 2017, Vancouver, Canada, July 30 - August 4, Volume 1: Long Papers, pages 440-450. Association for Computational Linguistics. +Pengcheng Yin and Graham Neubig. 2018. TRANX: A transition-based neural abstract syntax parser for semantic parsing and code generation. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 7-12, Brussels, Belgium. Association for Computational Linguistics. + +# A Additional Qualitative Examples + +We present examples of code generated by our best models with and without grammar. + +
Sourcedeclare an array
Goldmy_list = []
Grammarx = [0] * 2
Without[(0) for _ in range (10000)]
RemarkSource is not precise enough.
+ +
Sourceincrement piece by first element of elt
Goldpiece += elt[0]
Grammarpiece += elt[1]
Withoutpiece += elt[1]
RemarkFirst element of a list is zero.
+ +
Sourceremove first element of text
Goldtext = text[1:]
Grammartext = text[1:]
Withouttext[1:]
RemarkSyntax mistake for the code without grammar.
+ +
Sourceget the position of item 1 in 'testlist'
Gold[i for i, x in enumerate(testlist) if x == 1]
Grammar[i for i, v in enumerate(testlist) if v == 1]
Withouttestlist = [i for i in testlist if i != 1]
RemarkGrammar output is not equal to Gold due to dummy variable.
+ +
Sourceappend a numpy array 'b' to a numpy array 'a'
Goldnp.vstack((a, b))
Grammara = numpy.array([[b, a])
Withoutz = np.array([b]).reshape((3, 3))
RemarkGold is not accurate with np unde-fined before. vstack function not in the external vocabulary.
+ +
Sourceactivate is a lambda function which returns None for any argument x.
Goldactivate = lambda x : None
Grammaractivate = lambda x = None : x
Withoutactivate = lambda x : None
RemarkGood BLEU for grammar output while the result is not adequate.
Sourceconvert tuple 't' to list
Goldlist(t)
Grammar[x for x in t for x in t]
Without[i for i in t]
RemarkProblem of CLOSE for the Grammar output. Without grammar the code is correct but with a low BLEU.
\ No newline at end of file diff --git a/theimpactoflexicalandgrammaticalprocessingongeneratingcodefromnaturallanguage/images.zip b/theimpactoflexicalandgrammaticalprocessingongeneratingcodefromnaturallanguage/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..a281c94b32011025222fda696569dafd487c3f50 --- /dev/null +++ b/theimpactoflexicalandgrammaticalprocessingongeneratingcodefromnaturallanguage/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce1fe17aaa6c38c67326535a2ae80af21bc88c1b96d7ec2603e8c3cd00c2e1c8 +size 558794 diff --git a/theimpactoflexicalandgrammaticalprocessingongeneratingcodefromnaturallanguage/layout.json b/theimpactoflexicalandgrammaticalprocessingongeneratingcodefromnaturallanguage/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..27cef0b0fe217d2031796bfb9c42f5b2365120aa --- /dev/null +++ b/theimpactoflexicalandgrammaticalprocessingongeneratingcodefromnaturallanguage/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0e67bf8900b0e9fb70b44b92d7710ebbc2b6a90f782988f903d5e3da5553df20 +size 313255 diff --git a/theinefficiencyoflanguagemodelsinscholarlyretrievalanexperimentalwalkthrough/631faef7-22ba-4a31-9b77-5ffec1399510_content_list.json b/theinefficiencyoflanguagemodelsinscholarlyretrievalanexperimentalwalkthrough/631faef7-22ba-4a31-9b77-5ffec1399510_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..06bc416a0f6220df0d8f01bf61a1b2dcb565cdaa --- /dev/null +++ b/theinefficiencyoflanguagemodelsinscholarlyretrievalanexperimentalwalkthrough/631faef7-22ba-4a31-9b77-5ffec1399510_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9c368976511a26de6ee59db32ccf550df880ceaf8a2dc0adff04c52a53a7e820 +size 124600 diff --git a/theinefficiencyoflanguagemodelsinscholarlyretrievalanexperimentalwalkthrough/631faef7-22ba-4a31-9b77-5ffec1399510_model.json b/theinefficiencyoflanguagemodelsinscholarlyretrievalanexperimentalwalkthrough/631faef7-22ba-4a31-9b77-5ffec1399510_model.json new file mode 100644 index 0000000000000000000000000000000000000000..869f877897c9ae739dca3e2392dc0a9d49a41fba --- /dev/null +++ b/theinefficiencyoflanguagemodelsinscholarlyretrievalanexperimentalwalkthrough/631faef7-22ba-4a31-9b77-5ffec1399510_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:804733ae8f1cf7b39cbec9ad8ca3426432bdde963b251cf56f56b32d4262cf07 +size 140564 diff --git a/theinefficiencyoflanguagemodelsinscholarlyretrievalanexperimentalwalkthrough/631faef7-22ba-4a31-9b77-5ffec1399510_origin.pdf b/theinefficiencyoflanguagemodelsinscholarlyretrievalanexperimentalwalkthrough/631faef7-22ba-4a31-9b77-5ffec1399510_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..8b38628e676268624a69a4013c2d66d076a368df --- /dev/null +++ b/theinefficiencyoflanguagemodelsinscholarlyretrievalanexperimentalwalkthrough/631faef7-22ba-4a31-9b77-5ffec1399510_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aab756c24e00403ccf95727e522141a63f056da43f03758c370cd92c8718e28e +size 7717409 diff --git a/theinefficiencyoflanguagemodelsinscholarlyretrievalanexperimentalwalkthrough/full.md b/theinefficiencyoflanguagemodelsinscholarlyretrievalanexperimentalwalkthrough/full.md new file mode 100644 index 0000000000000000000000000000000000000000..5bb0265cddc5d367cbe4b8e9320db681095c0843 --- /dev/null +++ b/theinefficiencyoflanguagemodelsinscholarlyretrievalanexperimentalwalkthrough/full.md @@ -0,0 +1,471 @@ +# The Inefficiency of Language Models in Scholarly Retrieval: An Experimental Walk-through + +Shruti Singh and Mayank Singh +Department of Computer Science and Engineering +Indian Institute of Technology Gandhinagar +Gujarat, India +{singh_shruti, singh.mayank}@iitgn.ac.in + +# Abstract + +Language models are increasingly becoming popular in AI-powered scientific IR systems. This paper evaluates popular scientific language models in handling (i) short-query texts and (ii) textual neighbors. Our experiments showcase the inability to retrieve relevant documents for a short-query text even under the most relaxed conditions. Additionally, we leverage textual neighbors, generated by small perturbations to the original text, to demonstrate that not all perturbations lead to close neighbors in the embedding space. Further, an exhaustive categorization yields several classes of orthographically and semantically related, partially related and completely unrelated neighbors. Retrieval performance turns out to be more influenced by the surface form rather than the semantics of the text. + +# 1 Introduction + +Representation learning methods have drastically evolved large scientific volume exploration strategies. The popular applications include summarization, construction of mentor-mentee network (Ke et al., 2021), recommendation (Ostendorff et al., 2020; Cohan et al., 2020; Das et al., 2020; Hope et al., 2021), QA over scientific documents (Su et al., 2020), and verification of scientific claims (Wadden et al., 2020). The growing community's interest has led to the development of several scientific document embedding models such as OAG-BERT (Liu et al., 2021), SPECTER (Cohan et al., 2020), SciBERT (Beltagy et al., 2019), and BioBERT (Lee et al., 2020) over the past five years. OAG-BERT has been deployed in the Aminer production system. Given similar possibilities of future deployments of scientific document embeddings models in the existing scholarly systems, it is crucial to evaluate and identify limitations robustly. However, we do not find any existing work that critically analyzes the scientific language models to the best of our knowledge. + +To motivate the reader, we present a simple experiment. Queries 'document vector' and 'document vectors' fetch no common candidates among first page results on Google Scholar and Semantic Scholar (candidates in Appendix A). This illustrates the extremely brittle nature of such systems to minor alterations in query text, leading to completely different search outcomes. To motivate further, we experiment with textual queries encoded by the popular SciBERT model. A perturbed text 'document vector' (relevant in AI) is closer to the Biomedical term 'Virus vector' in the embedding space. Similar observations were found for many other queries. As scholarly search and recommendation systems are complex systems and their detailed algorithms are not publicly available, we analyze the behavior of scientific language models, which are (or will be) presumably an integral component of each of these systems. Motivated by the usage of perturbed inputs to stress test ML systems in interpretability analysis, we propose to use 'textual neighbors' to analyze how they are represented in the embedding space of scientific LMs. Unlike previous works (Ribeiro et al., 2020; Rychalska et al., 2019), which analyze the effect of perturbations on downstream task-specific models, we focus on analyzing the embeddings which are originally inputs to such downstream models. With the explosion of perturbation techniques for various kinds of robustness and interpretability analysis, it is difficult to generalize the insights gathered from perturbation experiments. We propose a classification schema based on orthography and semantics, to organize the perturbation strategies. + +The distribution of various types of textual neighbors in a training corpus is non-uniform. Specifically, the low frequency of textual neighbors results in non-optimized representations, wherein semantically similar neighbors might end up distant in the space. These non-optimal representations have a cascading effect on the downstream task-specific + +models. In this work, we analyze whether all textual neighbors of input $X$ are also $X$ 's neighbors in the embedding space. Further, we also study if their presence in the embedding space can negatively impact downstream applications dependent on similarity-based document retrieval. Our main contributions are: + +1. We introduce (in Section 3) five textual neighbor categories based on orthography and semantics. We further construct a nonexhaustive list of thirty-two textual neighbor types and organize them into these five categories to analyze the behavior of scientific LMs on manipulated text. +2. We conduct (in Section 5) robust experiments to showcase the limitations of scientific LMs under a short-text query retrieval scheme. +3. We analyze (in Section 6) embeddings of textual neighbors and their placement in the embedding space of three scientific LMs, namely SciBERT, SPECTER, and OAG-BERT. Our experiments highlight the capability and limitations of different models in representing different categories of textual neighbors. + +# 2 Related Works + +Several works utilize Textual Neighbors to interpret decisions of classifiers (Ribeiro et al., 2016; Gardner et al., 2020), test linguistic capabilities of NLP models (Ribeiro et al., 2020), measure progress in language generation (Gehrmann et al., 2021), and generate semantically equivalent adversarial examples (Ribeiro et al., 2018). Similar to these works, we use textual neighbors of scientific papers to analyze the behavior of scientific LMs. MacAvaney et al. (2020) analyze the behavior of neural IR models by proposing test strategies: constructing test samples by controlling specific measures (e.g., term frequency, document length), and by manipulating text (e.g., removing stops, shuffling words). This is closest to our work, as we also employ text manipulation to analyze the behavior of scientific language models using a simple Alternative-Self Retrieval scheme (Section 4). However, our focus is not evaluation of retrieval-augmented models and we only use a relaxed document retrieval pipeline in our evaluation to analyze the behavior of scientific LMs trained on diverse domains, in encoding scientific documents. We organize the textual neighbors into categories which capture different capabilities of LMs. We also show that it is crucial to evaluate + +models on dissimilar texts rather than just semantically similar textual neighbors. Ours is a first work in analyzing the properties of scientific LMs for different inputs and can be utilized by future works to design and evaluate future scientific LMs. Due to space limitations, we present the detailed discussion on scientific LMs in Appendix C. + +# 3 Short Queries and Textual Neighbors + +In this paper, we experiment with short queries to fetch relevant scientific documents. The term 'short' signifies a query length comparable to the length of research titles. The candidates are constructed from either title (T) or title and abstract $(\mathrm{T} + \mathrm{A})$ text. We, further, make small alterations to the candidate text to construct 'textual neighbors'. The textual neighbors can be syntactically, semantically, or structurally similar to the candidate text. Unlike previous works that explore textual neighbors to analyze and stress test complex models (Q&A, Sentiment, NLI, NER (Rychalska et al., 2019)), we experiment directly with representation learning models and analyze the placement of textual neighbors in their embedding space. While semantically similar neighbors are frequently used in previous works (Ribeiro et al., 2018); we also explore semantically dissimilar textual neighbors to analyze scientific language models. While an LM is expected to represent semantically similar texts with high similarity, some orthographically similar but semantically dissimilar texts can have highly similar embeddings, which is undesirable behavior. Note that we restrict the current query set to titles for two main reasons: (i) most real-world search queries are shorter in length, and (ii) flat keyword-based search lacks intent and can lead to erroneous conclusions. + +Textual neighbors have a similar word form or similar meaning. We observe that Textual neighbors possess the following properties based on two aspects: (i) Orthography (surface-level information content of text in terms of characters, words, and sentences), and (ii) Semantics. These two aspects are integral for a pair of texts to be textual neighbors. The properties of these aspects are: + +1. Orthography: Orthographic-neighbors are generated by making small surface-level transformations to the input. Based on the textual content, neighbors can be generated by: + +(a) Lossy Perturbation (LO): 'Lossy' behavior indicates that the information + +
O-SNeighbor CodeForm
LL-PST_ARotTitle → PreserveAbs → Rotate
LL-PST_AShuffTitle → PreserveAbs → Shuffle
LL-PST_ASortAscTitle → PreserveAbs → Sort Ascending
LL-PST_ASortDescTitle → PreserveAbs → Sort Descending
LO-PST_ADelRandTitle → PreserveAbs → Random word deletion 30%
LO-PST_ADelADJTitle → PreserveAbs → Delete all ADJs
LO-DST_ADelNNTitle → PreserveAbs → Delete all NNs
LO-PST_ADelVBTitle → PreserveAbs → Delete all Verbs
LO-PST_ADelADVTitle → PreserveAbs → Delete all ADVs
LO-PST_ADelPRTitle → PreserveAbs → Delete all PRs
LO-HST_ADelDTTitle → PreserveAbs → Delete all DTs
LO-PST_ADelNumTitle → PreserveAbs → Delete all Numbers
LO-DST_ADelNNPHTitle → PreserveAbs → Delete all NN Phrases
LO-PST_ADelTopNNPHTitle → PreserveAbs → Delete top 50% NPs
LO-HSTDelADJ_ATitle → Delete all ADJsAbs → Preserve
LO-HSTDelNN_ATitle → Delete all NNsAbs → Preserve
LO-HSTDelVB_ATitle → Delete all VBsAbs → Preserve
LO-HSTDelDT_ATitle → Delete all DTsAbs → Preserve
LO-DSTDelNNTitle → Delete all NNsAbs → Delete
LO-PST_ADelQ1Title → PreserveAbs → Delete quantile 1
LO-PST_ADelQ2Title → PreserveAbs → Delete quantile 2
LO-PST_ADelQ3Title → PreserveAbs → Delete quantile 3
LL-HSTNNU_ATitle → Uppercase NNsAbs → Preserve
LL-HSTNonNNU_ATitle → Uppercase non NNsAbs → Preserve
LL-HST_ANNUTitle → PreserveAbs → Uppercase NNs
LL-HST_ANonNNUTitle → PreserveAbs → Uppercase non NNs
LO-PST_A_DelNNCharTitle → Delete chars from NNsAbs → Delete chars from NNs
LO-HSTRepNNT_ATitle → Add a NN from titleAbs → Preserve
LO-HSTRepNNA_ATitle → Add a NN from absAbs → Preserve
LO-DST_ADelNonNNsTitle → PreserveAbs → Delete all non NNs
LO-DST_ARepADJTitle → PreserveAbs → Replace ADJs with antonyms
LL-HST_A_WSRandomly replace 50% whitespacechars with 2-5 whitespace charsin the title & abstract
+ +Table 1: Neighbor code is in format Txx_Ayy_zz, where xx and yy denote the perturbation to the paper title (T) and the abstract (A) respectively. zz denotes perturbation to both T and A. Missing T or A denotes that the corresponding input field is deleted completely. + +from the original text is lost, either due to addition or deletion of textual content. E.g., random deletion of 2-3 characters + +from a word. + +(b) Lossless Perturbation (LL): 'Lossless' behavior indicates that the original information content is unaltered. E.g., shuffling sentences of a paragraph. + +2. Semantics: Textual neighbors can either be semantically similar or not. While semantic categories are subjective, we try to define them objectively: + +(a) Dissimilar (DS): Semantically dissimilar neighbors are generated by deletion of nouns (NNs) or noun phrases (NPs), or by changing the directionality of text such as replacing adjectives (ADJs) with antonyms. +(b) Partially Similar (PS): Partially similar neighbors are constructed by sentence level modifications such as sentences scrambling (while preserving the word order in each sentence), word deletion of non-NNs (or NPs), or character deletion in words (including NNs) such that the textual neighbor preserves at least $70\%$ of the words in the original text. +(c) Highly Similar (HS): Highly similar neighbors are constructed by (i) nonword-semantic changes such as changing the case of words or altering the whitespace characters, (ii) word deletions or additions such that the textual neighbor preserves at least $90\%$ of the words in the original text. Note that deletion of NNs only from the title while preserving the abstract will qualify to be the HS category. + +Since SPECTER and OAG-BERT utilize paper titles and abstracts to learn embeddings, we generate textual neighbors by altering texts of these two input fields. We present 32 textual neighbor types in Table 1. Each of these 32 neighbor types is categorized into one of the five categories: LO-HS, LO-PS, LO-DS, LL-HS, and LL-PS. We exclude the LL-DS category (e.g., scrambling all words in the text) as it is infrequent and less probable to occur in a real-world setting. Examples of the textual neighbors are presented in Appendix B (Table 7). + +# 4 Experiment Design + +The Alternative-Self Retrieval: We propose an embarrassingly simple binary retrieval scheme + +
DatasetDomainSubDomain#Papers
ACL-ANTHCSNLP35,482
ICLRCSDeep Learning5,032
Arxiv-CS-SYCSSystems and Control10,000
Arxiv-MATHMTAlgebraic Topology10,000
Arxiv-HEPHEPHEP Theory10,000
Arxiv-QBIOQBNeurons and Cognition6,903
Arxiv-ECONECOEconometrics, General & Theoretical Economics4,542
+ +Table 2: Dataset Statistics + +
TA1 = Title+Abstract(Paper1)T1 = Title(Paper1)F1 = TextManipulationFunction(Paper1)
QueryCandidate SetQueryCandidate SetQueryCandidate Set
T1T+AT1T+ATT+A
TA1TA1TA1
TA2TA2T2TA2
TA3TA3T3TA3
(a)TA4(b)TA4T4TA4
TA5TA5T5TA5
::::
::::
+ +Figure 1: Alternative-Self Retrieval schemes for (a) Sec. 5 Task I, (b) Sec. 5 Task II, and (c) Sec. 6.2. Green represents the relevant candidate document for the query. The query is a subset of the relevant candidate document in schemes (a) and (b), and a textual neighbor of the relevant candidate in scheme (c). + +which contains only one relevant document in the candidate set. Alternative-Self Retrieval refers to the characteristic that the query is an altered version of the relevant candidate document. E.g., the candidate documents are the embeddings of paper title and abstract (henceforth $\mathrm{T + A}$ ) and the query is embedding of title. We present a schematic of three Alternative-Self Retrieval schemes in Figure 1. The retrieval is simple and we measure performance with accommodating metrics discussed in this section further. Our purpose is to analyze scientific LM embeddings under the most relaxed conditions. + +The Datasets: We evaluate the scientific LMs on seven datasets (statistics in Table 2) to understand their effectiveness in encoding documents from diverse research fields. Each dataset contains the titles and abstracts of papers. We curate the ACL Anthology dataset1 and the ICLR dataset from OpenReview2. To control the size of the ACL Anthology dataset, we exclude papers from workshops and non-ACL venues. We also curate five datasets from arXiv for the domains Mathematics (MT), High Energy Physics (HEP), Quantitative Biology (QB), Economics (ECO), and Computer Science (CS). + +We make available our code and dataset for public access3. + +The Notations: $\mathcal{D}$ is the set of seven datasets described in Table 2. $\mathcal{X}$ is the set of original input texts to the scientific LMs consisting of the paper title (T) and the abstract (A). For $d \in \mathcal{D}$ , $\mathcal{X} = \{x_{j} : x_{j} = (T + A)(p)$ , where $(T + A)(p) =$ concat(title(p), abstract(p), $\forall$ paper $p \in d\}$ . $f$ represents the type of textual neighbor (represented by the neighbor code presented in Table 1). $\mathcal{Q}$ and $\mathcal{R}$ are the query and candidate set for the IR task. + +Evaluation Metrics: We report performance scores on the following retrieval metrics: + +Mean Reciprocal Rank (MRR): All our tasks use binary relevance of documents to compute MRR. + +T100: It represents the percentage of queries which retrieve the one and only relevant document among the top-100 documents. + +NNk_Ret: % of queries in textual neighbor category whose k nearest neighbors (k-NN) retrieve the original document. + +AOP-10: Average overlap percentage among 10-NN of x and y, where $\mathrm{x} = \mathrm{T} + \mathrm{A}\left( {x}_{j}\right)$ and $\mathrm{y} = f\left( {x}_{j}\right)$ . $f$ is a text manipulation function, represented by the textual neighbor codes presented in Table 1. + +# 5 Analysing Embeddings for Scientific Document Titles and Abstracts + +In this section, we experiment with the inputs to the scientific language models. Due to free availability and ease of parsing paper title and abstract, majority scientific LMs learn embeddings from the title and the abstract of the paper. However, multiple downstream applications such as document search involve short queries (often keywords). We present two Alternative-Self retrieval experiments to compare the embeddings of paper title (T) with the embeddings of paper titles and abstract $(\mathrm{T} + \mathrm{A})$ . In both experiments, $|\mathcal{Q}| = 1000$ queries for each dataset. + +Task I: Querying titles against original candidate documents In this Alternative-Self Retrieval setup, given a query q constructed only from the paper title, the system recommends relevant candidate document embeddings constructed from title and abstract both (T+A). This setting is similar to querying in a scientific literature search engine as the search queries are usually short. The + +
Task I: R = XTask II: R = X ∪ T(X)
SciBERTSPECTEROAG-BERTSciBERTSPECTEROAG-BERT
MRRT100MRRT100MRRT100MRRT100MRRT100MRRT100
Arxiv-MATH0.0075.70.59690.50.14325.1000.27664.20.13331.2
Arxiv-HEP0.0065.80.69392.40.18229.7000.35475.70.19339.0
Arxiv-QBIO0.0086.60.78997.50.18733.000.20.50790.60.19436.1
Arxiv-ECON0.00910.40.78396.20.17732.500.10.51987.50.17637.2
Arxiv-CS_SY0.0115.00.85999.20.18632.100.20.55392.90.16334.0
ICLR0.0045.50.58691.50.14029.8000.22166.50.12833.0
ACL-ANTH0.0022.30.73994.30.13826.5000.31577.00.10127.3
+ +Table 3: For both Task I and Task II, SPECTER consistently performs the best on all datasets. For Task II, drop in MRR and T100 scores for SPECTER is significant in comparison to Task I. + +![](images/afa630c0d6b6fdf755b2636eb7d94331dd258610e1c2e367b3b411aa7ef300b5.jpg) +(a) SciBERT + +![](images/2a10388360a8aa437276256fc652ce42f5beac5a9fb955adf070bc5d4e41ebdf.jpg) +(b) SPECTER + +![](images/42629da64aade4fec0d5d3f07f2749c0f1530fa886117607c2a96165b4412d2d.jpg) +(c) OAG-BERT + +![](images/ea9b1ba59dfea9f67feb88518f555c2238c6a0b95566f09a8f825152fcbc4d30.jpg) +Figure 2: t-SNE plots for T and $\mathrm{T + A}$ embeddings for the ICLR dataset. Completely non-overlapping embeddings for T and $\mathrm{T + A}$ by SciBERT model highlight differences in encoding texts of varying lengths. + +![](images/3e8e1b841aa31e6a3597e93c596f5280c4ccf5a925be1c9d71567d24afb509f1.jpg) +Figure 3: Percentage of pair of documents for each Textual Neighbor whose similarity is greater than the average similarity. OAG-BERT has high inter similarity $(>50\%)$ , i.e. more than $50\%$ document pairs have cosine similarity greater than average similarity. + +motivation behind this experiment is to analyse the similarity among the T and the $\mathrm{T + A}$ embedding of a paper (Figure 1(a)). The experiment details are: + +Query: $\mathcal{Q} = \{q_j\colon x_j\in \mathcal{X},f = \mathrm{T},q_j = f(x_j)\}$ + +Candidate Documents: $\mathcal{R} = \{x_{k}\colon x_{k}\in \mathcal{X}\}$ + +Task: For $q_{j}\in \mathcal{Q}$ , rank the candidates based on cosine similarity. + +Evaluation: MRR and T100. For each $q_{j}$ , there is only one relevant document in the candidate set which is the corresponding $\mathrm{T + A}$ embedding. + +We present the results for various models on different domains in Table 3. The results suggest that SciBERT performs poorly for all domains. OAG-BERT on an average ranks the original + +![](images/0b439f9cd830e5f510d51ea3656721f57a7e11326015420bf4b8bede4bfed45d.jpg) +Figure 4: Inter Similarity of Textual Neighbor Vectors. Bold lines represent the $\mu$ and the $\sigma$ of pairwise similarities. Arrow heads represent min and max values. Pairwise similarities are spread out in a broad range for OAG-BERT, suggesting vectors for textual neighbors are more spread out in the vector space. + +document in the range 5-7th position. However, we also observe that even in the best case, only $33\%$ queries retrieve the original document in the top-100 retrieved candidates. SPECTER, on the other hand performs consistently better than both SciBERT and OAG-BERT. The MRR score suggests that on average, the original document is ranked in the top-2 documents, also has a good T100 score across all domains. However, for around $10\%$ of the queries in the Arxiv-MATH, Arxiv-HEP, and ICLR datasets, SPECTER does + +not rank the original relevant document in the top-100 retrieved candidates. + +Task II: Introducing all Titles in the Candidate Set To increase the complexity of the previous task, we add all the title embeddings (T) in the candidate set (Figure 1(b)). We test if the T embeddings are more similar to other titles, or to their corresponding $\mathrm{T + A}$ embeddings. + +Query: $\mathcal{Q} = \{q_j\colon x_j\in \mathcal{X},f = \mathrm{T},q_j = f(x_j)\}$ + +Candidate Documents: For query $q_j$ , the candidate set $\mathcal{R}_j$ is defined as, + +$$ +\begin{array}{l} \mathcal {R} _ {j} = \{f (x _ {i}): x _ {i} \in \mathcal {X}, f = \mathrm {T}, i \neq j \} \bigcup \{x _ {k}: \\ x _ {k} \in \mathcal {X} \} \end{array} +$$ + +The task and evaluation metrics are same as Task I. Extremely poor values for SciBERT (Table 3) lead us to examine the vector space of embeddings presented in Figure 2 (t-SNE plots for T and $\mathrm{T + A}$ embeddings), revealing that T and $\mathrm{T + A}$ embeddings form two non overlapping clusters. Even though the title text is a subset of $\mathrm{T + A}$ , SciBERT embeddings are significantly different, suggesting that input length influences SciBERT. This highlights the issue in retrieval for varying length query and candidates. We present the t-SNE plots for other datasets in the Appendix D. + +SPECTER still performs the best, but a significant drop in MRR and T100 suggests that both T and $\mathrm{T + A}$ embeddings tightly cluster together in partially overlapping small groups (can be verified from Figure 2). However, comparable T100 for OAG-BERT to the previous experiment suggests that the model does not falter when the input text length is small. Ideally, we expect T and $\mathrm{T + A}$ embeddings to overlap, indicating that the embeddings of the same paper are closer. The pretraining of these models could be the reason for such distribution of T and $\mathrm{T + A}$ embeddings. SciBERT is trained on sentences from full text of research papers, leading to different representations for short (T) and longer $(\mathrm{T + A})$ texts. As SPECTER and OAG-BERT are trained on title and abstract fields both, such non-overlapping behavior is not observed. + +# 6 Analysing Scientific LMs with Textual Neighbors + +In the previous section, we experimented with different input fields (T vs T+A). In this section, we experiment with the 32 textual neighbors classes (which alter different input fields: T, A, or T+A). We present our results for the following experiments for the five broad categories: LL-HS, LL-PS, + +LL-DS, LO-HS, and LO-DS. Due to space constraints, we present plots for selective datasets for each of the experiment in the paper. The rest of the plots are presented in Appendix E. + +# 6.1 Distribution of Textual Neighbors in the Embedding Space + +We measure how textual neighbor embeddings are distributed in the embedding space in each dataset when encoded by the SciBERT, SPECTER, and OAG-BERT model. For each textual neighbor class listed in Table 1, we compute pairwise similarities among all input pairs. A plot of the similarity values for different textual neighbor categories is presented in Figure 4 (additional plots in Appendix E.2). It can be observed that the pairwise similarities among documents are spread out in a significantly broader range for OAG-BERT than SciBERT and SPECTER on all datasets. The average similarity for all datasets by all models is above 0.5. We do not observe any significant difference in the average similarity for different textual neighbor classes. Interestingly, for the SPECTER model, the minimum similarity is greater than zero for all datasets across all neighbor categories. Document pair similarity via OAG-BERT embeddings have a low average similarity for the LO-DS category. + +We present the percentage of pair of documents for each Textual Neighbor whose similarity is greater than the average similarity in Figure 3 (additional plots in Appendix E.2). OAG-BERT shows high inter similarity (greater than $50\%$ ) for majority of textual neighbors suggesting that more than $50\%$ document pairs have a cosine similarity greater than average similarity. For SPECTER vectors, all types of textual neighbors have around $50\%$ documents pairs having a similarity greater than mean similarity. However, extremely high values of percentage of document pairs having similarity greater than average similarity for the SciBERT model on the ACL dataset, and the OAG-BERT on almost all dataset suggests that majority of the documents in the embedding space are represented compactly for all textual neighbor categories. + +# 6.2 Similarity of Textual Neighbors with Original Documents + +Let $\mathcal{F} = \{f^1, f^2, \dots, f^n\}$ be the set of textual neighbor functions described in Table 1. We query different types of textual neighbor classes against the documents embeddings (T+A). We compute the + +![](images/c1bde53b5ad246032ac24a401388fec6377e565511eee0872a1152c0765ea31e.jpg) +Figure 5: The bottom and the stacked bars represent NN1_Ret and NN10_Ret respectively. Results suggest that SciBERT embeddings for textual neighbors of scientific text are the most optimal. + +![](images/430fe8156249168daa1d4f6506dc2c355c2e8d4b42a2c41fb44f5865c59305b2.jpg) + +![](images/aab0f01d121b6d67b857cf0e4a3df402184a2bf806ea7e0a2990d3854de4ed3f.jpg) +Figure 6: Distribution of NN1_Ret for each textual neighbor category. SciBERT embeddings preserve the hierarchy of NN1_Ret, i.e. PS categories (LO-PS and LL-PS) have lower values than HS categories (LO-HS and LL-HS). + +![](images/c469ebf6960bb92117ba86d0bd480ae2fa1e9cb48a2e783f77a9e168ed2418c2.jpg) + +percentage of queries that successfully rank the original document in the top-1 and top-10 ranked list. We expect $HS$ and $PS$ categories to rank the original document higher in the rank list, and $DS$ to rank it lower. If any of the textual neighbor classes or categories don't show the expected behavior, it can be asserted that the LM is brittle in representing the specific type of textual neighbor. + +$$ +\mathbf {Q u e r y}: \mathcal {Q} = \bigcup_ {f \in \mathcal {F}} \mathcal {Q} _ {f} = \bigcup_ {f \in \mathcal {F}} \left\{q _ {j}: x _ {j} \in \mathcal {X}, q _ {j} = f (x _ {j}) \right\} +$$ + +Candidate Documents: $\mathcal{R} = \{x_{k}\colon x_{k}\in \mathcal{X}\}$ + +Task: For $q_{j}\in \mathcal{Q}$ , retrieve the most similar documents based on cosine similarity. + +Evaluation: NN1_Ret and NN1_10. There is only one relevant document in the candidate set for each $q_{j}$ , which is the corresponding T+A embeddings. + +We present the results in Figure 5. SciBERT and OAG-BERT for the LO-DS category show less than $50\%$ NN10_Ret, which is desirable as LO-DS neighbors are semantically dissimilar, and hence should not be neighbors in the embedding space. SciBERT shows improvement via NN10_Ret over NN1_Ret for PS categories. High NN1_Ret for HS categories indicates SciBERT successfully encodes highly similar texts closer than partially similar texts. OAG-BERT performs poorly for both metrics, indicating that it doesn't encode textual + +![](images/91f8453751a66e575344f6b5e59d460c950fdbf31f5744588b00e0431b43cfb8.jpg) +Figure 7: AOP-10 distribution of all categories of textual neighbors. SciBERT performs poorly for LL-PS (consists of neighbors that scramble abstract sentences). If we ignore LO-DS category, SPECTER embeddings perform decently overall. + +![](images/3804ad7b2196af8f239460d7538ffbeadd7f2c5406c3cddee15f9ea861cfc374.jpg) + +neighbors optimally. SPECTER embeddings perform poorly on the LO-DS category. They however achieve the maximum values showing no difference between LO vs LL, or HS vs PS categories. + +To analyse the high values for SPECTER, we present the individual NN1_Ret for each of the 32 textual neighbor classes in Figure 6 and observe only two classes 'TDelNN' and 'T_A_DelNNChar' which lead to less than $90\%$ NN1_Ret. Unlike SPECTER and OAG-BERT, SciBERT preserve the hierarchy, with Highly Similar classes ranked higher than Partially Similar classes. An interesting case with SciBERT embeddings is that the T_A_WS neighbor class belonging to the LL-HS category, has a low NN1_Ret value across all datasets, suggesting that the SciBERT model is extremely brittle to white space character perturbations (because of the constraint on sequence length). Another breaking point for the SciBERT is the textual neighbor class T_ARepADJ (replacing adjectives with antonyms) of LO-DS category, which shows high values (around $80\%$ ) for NN1_Ret which is undesirable. We observe that among the three specific LO-PS categories 'T_ADelQ1', 'T_ADelQ2', and 'T_ADelQ3', SciBERT performs worst for the 'T_ADelQ3', indicating that the last quantile of the abstract contains relevant information encoded by SciBERT. OAG-BERT shows a reverse trend to SPECTER by achieving low values for all neighbors classes indicating brittleness to text manipulation. + +# 6.3 Overlap amongst Nearest Neighbors + +We compute the overlap amongst the nearest neighbors of each textual neighbor class and the original document embeddings. We randomly sample a query set of 2000 queries for each textual neighbor + +
TN CatLO-HSLO-PSLO-DSLL-HSLL-PS
ModelSBSPOBSBSPOBSBSPOBSBSPOBSBSPOB
ACL-ANTH51.868.94.420.561.84.312.035.62.273.081.25.113.472.05.2
ICLR52.274.64.718.661.84.710.933.22.371.282.25.510.875.06.0
Arxiv-CS_SY52.874.85.223.266.05.111.640.92.671.783.46.014.577.66.6
Arxiv-MATH52.267.45.323.062.15.314.534.53.271.180.56.131.375.46.6
Arxiv-ECON59.075.35.827.066.45.614.140.92.871.283.26.421.476.86.8
Arxiv-QBIO55.274.15.423.565.14.912.138.72.671.082.95.917.176.46.3
Arxiv-HEP53.166.25.922.961.05.913.534.23.671.080.06.825.473.47.2
+ +class (and their corresponding T+A embedding) and compute nearest neighbor (NN) overlap for these. In this task, we are interested in evaluating if NN-based retrieval retrieves the same documents for a textual neighbor class and T+A embedding. + +Query: $\mathcal{Q} = \mathcal{Q}_f\cup \mathcal{Q}_{T + A}$ + +$$ +\begin{array}{l} \mathcal {Q} _ {f} = \left\{q _ {j} \colon x _ {j} \in \mathcal {X} _ {2 0 0 0}, q _ {j} = f (x _ {j}) \right\} \\ \mathcal {Q} _ {T + A} = \left\{q _ {j}: x _ {j} \in \mathcal {X} _ {2 0 0 0}, q _ {j} = T + A (x _ {j}) \right\} \\ \end{array} +$$ + +Candidate Documents: $\mathcal{R} = \{q_j\colon x_j\in \mathcal{X},$ $q_{j} = f(x_{j})\} \cup \{q_{j}\colon x_{j}\in \mathcal{X},f = T + A,q_{j} = f(x_{j})\}$ + +Task: For each pair of $q_j, q_k \in \mathcal{Q}$ , such that $q_j \in \mathcal{Q}_f$ and $q_k \in \mathcal{Q}_{T_A}$ , compute the overlap among ten nearest neighbors (NN-10) of $q_j$ and $q_k$ . Evaluation: AOP-10. + +We present the results arranged by Textual Neighbor categories in Table 4. The individual AOP-10 distribution of all categories of textual neighbors is presented in Figure 7. While overall results look good for SPECTER, it should be noted that SPECTER performs poorly for embedding LO-DS textual neighbors indicating that it has a shallow understanding of semantics. AOP-10 values for SPECTER show a positive trend: LL-HS > LO-HS and LL-HS > LL-PS. SciBERT performs decently for the HS category, but its performance drops for the PS categories. OAG-BERT has the lowest AOP-10 for all textual neighbor categories. When put in perspective against the previous NN1_Ret and NN10_Ret, we believe that SciBERT performs decently in encoding the HS and PS neighbors closer to the original T+A embedding. However, low value of AOP-10 for SciBERT for PS neighbors reflects that while the PS neighbors are closer to the original document in comparison to others, the original document has other nearest neighbors than the PS neighbor. + +We present a matrix to summarize the capability of the models in Table 5 in encoding the five textual neighbor categories. The five categories + +Table 4: AOP-10 values for different categories. The best results for LO-DS category are from OAG-BERT (OB), however that is because the model performs poorly on all categories of textual neighbors. Similarly, best results for the rest four categories are from SPECTER (SP), following which it also has a high overlap percentage for the LO-DS category. SciBERT (SB) embeddings perform the best for HS and DS but falter on PS semantic categories. + +
LL-HSLO-HSLL-PSLO-PSLO-DS
Threshold>75>7050 < AOP-20 < 70<20
SciBERT75.0459.6222.626.2814.35
SPECTER86.7777.5580.9369.0341.32
OAG-BERT6.846.247.315.953.17
+ +Table 5: Capability of the models in encoding textual neighbor categories optimally in the embedding space. Gray cells represent optimal representations for each model based on AOP-20. + +arranged in increasing order of semantic similarity are: LL-HS $\geq$ LO-HS $>$ LL-PS $>$ LO-PS $>$ LO-DS. We use heuristic-based values to define optimality. For each of the five categories, we define AOP-20 thresholds to classify if the textual neighbor representations for the corresponding are optimal or not. It is expected that AOP-20 values for semantic categories should be in order: HS $>$ PS $>$ DS. AOP-20 values for orthographic categories should follow: LL $>$ LO. + +# 7 Conclusion + +We propose five categories of textual neighbors to organize the increasing number of textual neighbor types: LL-HS, LO-HS, LL-PS, LO-PS, and LO-DS. We evaluate SciBERT, SPECTER, and OAG-BERT models on thirty-two textual neighbor classes organized into the previous five categories. We show that evaluation of language models on 'Semantically Dissimilar' texts is also important rather than just evaluation on 'Semantically Similar' texts. We show that the SciBERT model is highly sensitive to the input length. SPECTER embeddings for all types of textual neighbors are highly similar irrespective of whether the textual neighbor is semantically dissimilar or not. SPECTER embeddings show sensitivity to the presence of specific keywords. Lastly, OAG-BERT embeddings of all categories of textual neighbors are highly dissimilar to the original title and abstract (T+A) embed + +dings. We believe that our insights could be used to develop better pretraining strategies for scientific document language models and also to evaluate other language models. One example for MLM (or replaced token identification) could be utilizing a weighted-penalty based loss, i.e. partially similar tokens if predicted should be penalized less in comparison to the prediction of unrelated (or dissimilar) tokens. Additionally, these insights could also be utilised by several systems that use these scientific document language models to incorporate informed strategies in downstream systems such as recommendation systems. + +# References + +Iz Beltagy, Kyle Lo, and Arman Cohan. 2019. SciBERT: A pretrained language model for scientific text. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 3615-3620, Hong Kong, China. Association for Computational Linguistics. +Arman Cohan, Sergey Feldman, Iz Beltagy, Doug Downey, and Daniel S. Weld. 2020. SPECTER: document-level representation learning using citation-informed transformers. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, ACL 2020, Online, July 5-10, 2020, pages 2270-2282. Association for Computational Linguistics. +Debasmita Das, Yatin Katyal, Janu Verma, Rajesh Kumar Ranjan, Shashank Dubey, Aakash Deep Singh, Sourojit Bhaduri, and Kushagra Agarwal. 2020. Information retrieval and extraction on COVID-19 clinical articles using graph community detection and bio-bert embeddings. +Soumyajit Ganguly and Vikram Pudi. 2017. Paper2vec: Combining graph and text information for scientific paper representation. In European conference on information retrieval, pages 383-395. Springer. +Matt Gardner, Yoav Artzi, Victoria Basmov, Jonathan Berant, Ben Bogin, Sihao Chen, Pradeep Dasigi, Dheeru Dua, Yanai Elazar, Ananth Gottumukkala, Nitish Gupta, Hannaneh Hajishirzi, Gabriel Ilharco, Daniel Khashabi, Kevin Lin, Jiangming Liu, Nelson F. Liu, Phoebe Mulcaire, Qiang Ning, Sameer Singh, Noah A. Smith, Sanjay Subramanian, Reut Tsarfaty, Eric Wallace, Ally Zhang, and Ben Zhou. 2020. Evaluating models' local decision boundaries via contrast sets. In Findings of the Association for Computational Linguistics: EMNLP 2020, pages 1307-1323, Online. Association for Computational Linguistics. + +Sebastian Gehrmann, Tosin Adewumi, Karmanya Aggarwal, Pawan Sasanka Ammanamanchi, Anuoluwapo Aremu, Antoine Bosselut, Khyathi Raghavi Chandu, Miruna-Adriana Clinciu, Dipanjan Das, Kaustubh Dhole, Wanyu Du, Esin Durmus, Ondrej Dusek, Chris Chinenye Emezue, Varun Gangal, Cristina Garbacea, Tatsunori Hashimoto, Yufang Hou, Yacine Jernite, Harsh Jhamtani, Yangfeng Ji, Shailza Jolly, Mihir Kale, Dhruv Kumar, Faisal Ladhak, Aman Madaan, Mounica Maddela, Khyati Mahajan, Saad Mahamood, Bodhisattwa Prasad Majumder, Pedro Henrique Martins, Angelina McMillan-Major, Simon Mille, Emiel van Miltenburg, Moin Nadeem, Shashi Narayan, Vitaly Nikolaev, Andre Niyongabo Rubungo, Salomey Osei, Ankur Parikh, Laura Perez-Beltrachini, Niranjan Ramesh Rao, Vikas Raunak, Juan Diego Rodriguez, Sashank Santhanam, João Sedoc, Thibault Sellam, Samira Shaikh, Anastasia Shimorina, Marco Antonio Sobrevilla Cabezudo, Hendrik Strobelt, Nishant Subramani, Wei Xu, Diyi Yang, Akhila Yerukola and Jiawei Zhou. 2021. The GEM benchmark: Natural language generation, its evaluation and metrics. In Proceedings of the 1st Workshop on Natural Language Generation, Evaluation, and Metrics (GEM 2021), pages 96–120, Online. Association for Computational Linguistics. +Yu Gu, Robert Tinn, Hao Cheng, Michael Lucas, Naoto Usuyama, Xiaodong Liu, Tristan Naumann, Jianfeng Gao, and Hoifung Poon. 2020. Domain-specific language model pretraining for biomedical natural language processing. arXiv preprint arXiv:2007.15779. +Tom Hope, Aida Amini, David Wadden, Madeleine van Zuylen, Sravanthi Parasa, Eric Horvitz, Daniel Weld, Roy Schwartz, and Hannaneh Hajishirzi. 2021. Extracting a knowledge base of mechanisms from COVID-19 papers. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 4489-4503, Online. Association for Computational Linguistics. +Kexin Huang, Jaan Altosaar, and Rajesh Ranganath. 2019. Clinicalbert: Modeling clinical notes and predicting hospital readmission. CoRR, abs/1904.05342. +Qing Ke, Lizhen Liang, Ying Ding, Stephen V David, and Daniel E Acuna. 2021. A dataset of mentorship in science with semantic and demographic estimations. arXiv preprint arXiv:2106.06487. +Xiangjie Kong, Mengyi Mao, W. Wang, Jiaying Liu, and Bo Xu. 2021. Voprec: Vector representation learning of papers with text information and structural identity for recommendation. IEEE Transactions on Emerging Topics in Computing, 9:226-237. +Quoc Le and Tomas Mikolov. 2014. Distributed representations of sentences and documents. In International conference on machine learning, pages 1188-1196. PMLR. + +Jinhyuk Lee, Wonjin Yoon, Sungdong Kim, Donghyeon Kim, Sunkyu Kim, Chan Ho So, and Jaewoo Kang. 2020. Biobert: a pre-trained biomedical language representation model for biomedical text mining. Bioinformatics, 36(4):1234-1240. +Xiao Liu, Da Yin, Xingjian Zhang, Kai Su, Kan Wu, Hongxia Yang, and Jie Tang. 2021. Oag-bert: Pretrain heterogeneous entity-augmented academic language models. arXiv preprint arXiv:2103.02410. +Sean MacAvaney, Sergey Feldman, Nazli Goharian, Doug Downey, and Arman Cohan. 2020. AB-NIRML: Analyzing the behavior of neural IR models. arXiv preprint arXiv:2011.00696. +Malte Ostendorff, Terry Ruas, Till Blume, Bela Gipp, and Georg Rehm. 2020. Aspect-based document similarity for research papers. In Proceedings of the 28th International Conference on Computational Linguistics, pages 6194-6206, Barcelona, Spain (Online). International Committee on Computational Linguistics. +Bryan Perozzi, Rami Al-Rfou, and S. Skiena. 2014. Deepwalk: online learning of social representations. Proceedings of the 20th ACM SIGKDD international conference on Knowledge discovery and data mining. +Leonardo F.R. Ribeiro, Pedro H.P. Saverese, and Daniel R. Figueiredo. 2017. struc2vec: Learning node representations from structural identity. In Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD '17, page 385-394, New York, NY, USA. Association for Computing Machinery. +Marco Tulio Ribeiro, Sameer Singh, and Carlos Guestrin. 2016. "why should I trust you?": Explaining the predictions of any classifier. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, San Francisco, CA, USA, August 13-17, 2016, pages 1135-1144. +Marco Tulio Ribeiro, Sameer Singh, and Carlos Guestrin. 2018. Semantically equivalent adversarial rules for debugging NLP models. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 856-865, Melbourne, Australia. Association for Computational Linguistics. +Marco Tulio Ribeiro, Tongshuang Wu, Carlos Guestrin, and Sameer Singh. 2020. Beyond accuracy: Behavioral testing of NLP models with CheckList. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 4902-4912, Online. Association for Computational Linguistics. +Barbara Rychalska, Dominika Basaj, Alicja Gosiewska, and Przemysław Biecek. 2019. Models in the wild: On corruption robustness of neural nlp + +systems. In International Conference on Neural Information Processing, pages 235-247. Springer. +Hoo-Chang Shin, Yang Zhang, Evelina Bakhturina, Raul Puri, Mostofa Patwary, Mohammad Shoeybi, and Raghav Mani. 2020. BioMegatron: Larger biomedical domain language model. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 4700-4706, Online. Association for Computational Linguistics. +Yuqi Si, Jingqi Wang, Hua Xu, and Kirk Roberts. 2019 Enhancing clinical concept extraction with contextual embeddings. Journal of the American Medical Informatics Association, 26(11):1297-1304. +Dan Su, Yan Xu, Tiezheng Yu, Farhad Bin Siddique, Elham J. Barezi, and Pascale Fung. 2020. Cairecovid: A question answering and query-focused multi-document summarization system for COVID-19 scholarly information management. In Proceedings of the 1st Workshop on NLP for COVID-19@ EMNLP 2020, Online, December 2020. Association for Computational Linguistics. +Han Tian and Hankz Hankui Zhuo. 2017. Paper2vec: Citation-context based document distributed representation for scholar recommendation. CoRR, abs/1703.06587. +William Timkey and Marten van Schijndel. 2021. All bark and no bite: Rogue dimensions in transformer language models obscure representational quality In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 4527-4546, Online and Punta Cana, Dominican Republic. Association for Computational Linguistics. +David Wadden, Shanchuan Lin, Kyle Lo, Lucy Lu Wang, Madeleine van Zuylen, Arman Cohan, and Hannaneh Hajishirzi. 2020. Fact or fiction: Verifying scientific claims. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 7534-7550, Online. Association for Computational Linguistics. +Danhao Zhu, Xinyu Dai, and Jiajun Chen. 2019. Representing anything from scholar papers. Journal of Web Semantics, 59. + +# Appendix + +# A Candidate Retrieval + +The candidates fetched for the queries 'document vector' and 'document vectors' on Google Scholar and Semantic Scholar in Table 6. It can be observed that both queries have no common candidates on either of the search engines. + +
Query = document vectorQuery = document vectors
Semantic ScholarSemantic Scholar
Corporate value evaluation using patent document vectorUsing Sparse Composite Document Vectors to Classify VBA Macros
Improving a tfidf weighted document vector embeddingSCDV: Sparse Composite Document Vectors using soft clustering over distributional representations
Legal Document Retrieval using Document Vector Embeddings and Deep LearningMusic genre classification with word and document vectors
Document vector embeddings for bibliographic records indexingConstructing Document Vectors Using Kernel Density Estimates
Document Vector Extension for Documents ClassificationText classification with sparse composite document vectors
Multi-document Summarization by Creating Synthetic Document Vector Based on Language ModelWords are not Equal: Graded Weighting Model for Building Composite Document Vectors
Document vector representations for feature extraction in multi-stage document rankingA Document Descriptor using Covariance of Word Vectors
An Adaptive Topic Tracking Model Based on 3-Dimension Document VectorDocument Embedding with Paragraph Vectors
A support vector machine mixed with TF-IDF algorithm to categorize Bengali documentDocument classification with distributions of word vectors
A framework for a feedback process to analyze and personalize a document vector space in a feature extraction modelText document clustering using global term context vectors
Google ScholarGoogle Scholar
Document vector representations for feature extraction in multi-stage document rankingDocument embedding with paragraph vectors
Document ranking and the vector-space modelSCDV: Sparse Composite Document Vectors using soft clustering over distributional representations
Legal document retrieval using document vector embeddings and deep learningText document clustering using global term context vectors
Improving a tfidf weighted document vector embeddingDocument classification with distributions of word vectors
Efficient vector representation for documents through corruptionUsing sparse composite document vectors to classify vba macros
Enhancing web service clustering using Length Feature Weight Method for service description document vector space representationWords are not equal: Graded weighting model for building composite document vectors
Document vector compression and its application in document clusteringImage-based document vectors for text retrieval
A vector space model for automatic indexingImproving Document Vectors Representation using Semantic Links and Attributes
Hierarchical document categorization with support vector machinesSelf organization of a massive document collection
Using an n-gram-based document representation with a vector processing retrieval modelMusic genre classification with word and document vectors
+ +Table 6: Candidate documents retrieved for queries 'document vector' and 'document vectors'. + +# B Textual Neighbors + +We present examples for textual neighbors in Table 7. We use NLTK for preprocessing text and constructing textual neighbors. + +# C Summary of Scientific LMs + +We discuss some popular scientific document language models which leverage the transformer architecture. + +SciBERT (Beltagy et al., 2019) is also a BERT model trained on large amounts of scientific data. It is trained on a random sample of 1.14M papers from the Semantic Scholar Corpus. The training corpus consists of $18\%$ papers from the computer science domain and $82\%$ from the broad biomedical domain. Full texts of the papers are used for training. + +SPECTER (Cohan et al., 2020) uses citation-informed Transformers to generate general-purpose vector representations of scientific documents. Unlike traditional models, they also leverage inter-document relatedness to learn general purpose embeddings that are effective across a variety of downstream tasks without task-specific finetuning. SPECTER leverages citations as a signal for document-relatedness and formulate this into a triplet-loss pre-training objective. SPECTER achieves state-of-the-art results on six out of seven document-level tasks for scientific literature in the SCIDOCS (Cohan et al., 2020) benchmark suite. + +OAG-BERT (Liu et al., 2021) jointly model texts (title and abstract of the paper) and heterogeneous academic entities (authors, research field, venues, and affiliations) to learn representations for a scientific document. The architecture is similar to BERT, however the authors employ multiple techniques to learn entity embeddings. To distinguish different textual and academic entities use entity type embeddings to indicate the entity type. They design an entity aware 2D-positional encoding to indicate the inter-entity and the intra-entity sequence order. It also proposes span-aware entity masking to preserve the sequential relationship between the entity's tokens. + +BioBERT (Lee et al., 2020) is a BERT model pre-trained on large-scale biomedical corpora. BioBERT model is initialized with BERT cite weights and then pre-trained on PubMed abstracts and PMC full-text articles. + +Succeeding the BioBERT model, several models have been trained exclusively for Biomedical + +texts such as ClinicalBERT (Huang et al., 2019), MIMIC-BERT (Si et al., 2019), PubMedBERT (Gu et al., 2020), and BioMegatron (Shin et al., 2020) to list a few. However, in this work, we focus on general purpose scientific language models that have been trained on scientific documents from diverse research fields. + +We summarize the details of the SciBERT, SPECTER, and the OAG-BERT model in Table 8. + +# C.1 Non Transformer-based Models + +Majority of Non Transformer based models utilise the Paragraph Vector (Le and Mikolov, 2014) technique to learn vectors for the textual content. Citation networks are utilised to learn similar embeddings for related papers. Paper2Vec (Ganguly and Pudi, 2017) learns embeddings by applying DeepWalk (Perozzi et al., 2014) on an augmented citation network of papers. Apart from connecting cited papers, the augmented network also connects $k$ nearest neighbors (from textual embeddings generated using Paragraph Vector (Le and Mikolov, 2014)). Paper2Vec (Tian and Zhuo, 2017) learns distributed vertex embeddings from matrix factorization on the weighted context definition of nodes. Following a similar technique as Paper2Vec (Ganguly and Pudi, 2017), VOPRec (Vector Representation Learning of Papers with Text Information and Structural Identity for Recommendation) (Kong et al., 2021) learns embeddings from the text using Paragraph Vector (Le and Mikolov, 2014) and the citation network using Struc2Vec (Ribeiro et al., 2017). + +Zhu et al. (2019) present a method to learn scholar paper embeddings (Represent Anything from Scholar Papers) from different scholar entities such as title, authors, publication venue, and citations. It trains the model by trying to maximize the likelihood of references of a paper. It uses an encoder-decoder framework to learn representations from title words, author names, publication venue, and publication year. The proposed method can generate representations for papers even if the references are missing as that information is already encoded in the entities during the training. + +As the pretrained models or code for none of the Non Transformer-based models is publicly available, we skip their evaluation in this work. + +
O-SNeighbor CodeFormExample
LL-PST_ARotT → Preserve A → RotateA: We introduce a representation for computer programs based on language models. We train deep robust embeddings using pytorch. Contextual embeddings are common in NLP.
LL-PST_AShuffT → Preserve A → ShuffleA: Contextual embeddings are common in NLP. We introduce a representation for computer programs based on language models. We train deep robust embeddings using pytorch.
LL-PST_ASortAscT → Preserve A → Sort AscendingA: Contextual embeddings are common in NLP. We train deep robust embeddings using pytorch. We introduce a representation for computer programs based on language models.
LL-PST_ASortDescT → Preserve A → Sort DescendingA: We introduce a representation for computer programs based on language models. We train deep robust embeddings using pytorch. Contextual embeddings are common in NLP.
LO-PST_ADelRandT → Preserve A → Random word deletion 30%A: Contextual are common in . introduce a representation computer programs based on language models. We train deep robust using .
LO-PST_ADelADJT → Preserve A → Delete all ADJsA: We introduce a representation for computer programs based on language models. We train embeddings using pytorch.
LO-DST_ADelNNT → Preserve A → Delete all NNsA: Contextual are common in . We introduce a for based on . We train deep robust using .
LO-PST_ADelVBT → Preserve A → Delete all VerbsA: Contextual embeddings common in NLP. We a representation for computer programs on language models. We deep robust embeddings pytorch.
LO-PST_ADelADVT → Preserve A → Delete all ADVsA: Contextual embeddings are common in NLP. We introduce a representation for computer programs based on language models. We train deep robust embeddings using pytorch.
LO-PST_ADelIPRT → Preserve A → Delete all PRsA: Contextual embeddings are common in NLP. introduce a representation for computer programs based on language models. train deep robust embeddings using pytorch.
LO-HST_ADelDTT → Preserve A → Delete all DTsA: Contextual embeddings are common in NLP. We introduce representation for computer programs based on language models. We train deep robust embeddings using pytorch.
LO-PST_ADelNumT → Preserve A → Delete all NumbersA: Contextual embeddings are common in NLP. We introduce a representation for computer programs based on language models. We train deep robust embeddings using pytorch.
LO-DST_ADelNNPHT → Preserve A → Delete all NN PhrasesA: Contextual embeddings are common in NLP. We introduce a representation for based on . We train deep using pytorch.
LO-PST_ADelTopNNPHT → Preserve A → Delete top 50% NPsA: Contextual embeddings are common in NLP. We introduce a representation for based on . We train deep robust embeddings using pytorch.
LO-HSTDelADJ_AT → Delete all ADJs A → PreserveT: Source Code Embeddings from Language Models
LO-HSTDelNN_AT → Delete all NNs A → PreserveT: from
LO-HSTDelVB_AT → Delete all VBs A → PreserveT: Source Code Embeddings from Language Models
LO-HSTDelDT_AT → Delete all DTs A → PreserveT: Source Code Embeddings from Language Models
LO-DSTDelNNT → Delete all NNs A → DeleteT: from
LO-PST_ADelQ1T → Preserve A → Delete quantile 1A: We introduce a representation for computer programs based on language models. We train deep robust embeddings using pytorch.
LO-PST_ADelQ2T → Preserve A → Delete quantile 2A: Contextual embeddings are common in NLP. We train deep robust embeddings using pytorch.
LO-PST_ADelQ3T → Preserve A → Delete quantile 3A: Contextual embeddings are common in NLP. We introduce a representation for computer programs based on language models.
LL-HSTNNU_AT → Uppercase NNs A → PreserveT: SOURCE CODE EMBEDDINGS from LANGUAGE MODEL
LL-HSTNonNNU_AT → Uppercase non NNs A → PreserveT: Source Code Embeddings FROM Language Models
LL-HST_ANNUT → Preserve A → Uppercase NNsA: Contextual EMBEDDINGS are common in NLP. We introduce a REPRESENTATION for COMPUTER PROGRAMS based on LANGUAGE MODELS. We train deep robust EMBEDDINGS using PYTORCH.
LL-HST_ANNonNNUT → PreserveA → Uppercase nonNNsA: CONTEXTUAL embeddings ARE COMMON IN NLP . WE INTRODUCE A representation FOR computer programs BASED ON language models . WE TRAIN DEEP ROBUST embeddings USING pytorch .
LO-PST_A_DelNNCharT → Delete chars from NNsA → Delete chars from NNsT: Soue Cod Emddings from Lguage delsA: Contextual mbedding are common in NLP . We introduce a representaio for cmuter pr-rays based on lngage modl . We train deep robust emeddings using ytorh .
LO-HSTRepNNT_AT → Add a NN from titleA → PreserveT: Source Source Code Embeddings from Language Models
LO-HSTRepNNA_AT → Add a NN from absA → PreserveT: Source Code Embeddings from Language Models embeddings NLP representation computer
LO-DST_ADelNonNNsT → PreserveA → Delete all non NNsA: NLP representation computer programs language models embeddings pytorch
LO-DST_ARepADJT → PreserveA → Replace ADjswith antonymsA: Contextual embeddings are individual in NLP . We introduce a representation for computer programs based on language models . We train shallow frail embeddings using pytorch .
LL-HST_A_WSRandomly replace 50%whitespace chars with 2-5 whitespace chars in T & ATA: Source_Code_Embeddings_from_Language_Models_.Contextual_embeddings_a_common_in_NLP .We_introduce_a Representation_for_computerprograms_based_on_language_models_.We_train_deep_brust_embeddings__using__pytorch. [WS represented using ]
+ +Table 7: Neighbor code is in format Txx_Ayy_zz, where xx and yy denote the perturbation to the paper title (T) and the abstract (A) respectively. zz denotes perturbation to both T and A. Missing T or A denotes that the corresponding input field is deleted completely. + +
OAG-BERTSPECTERSciBERT
Model ArchitectureEntity augmented BERT-baseBERT-baseBERT-base
Model Initialization-SciBERT-
Loss FunctionHybrid Cross EntropyTriplet Margin LossCross Entropy
Training corpusOpen Academic GraphSemantic Scholar CorpusSemantic Scholar Corpus
VocabularyOAG-BERT VocabSciVocabSciVocab
Vocabulary Size44,000 tokens30,000 tokens30,000 tokens
TokenizerWordPieceWordPieceWordPiece
Text FeaturesTitle, Abstract, Body, FoS, Authors, Venues, AffiliationsTitle, AbstractFull-text
+ +Table 8: Comparison of different transformer based language models for scientific literature + +# D Analysing Embeddings for Scientific Document Titles and Abstracts + +We present the t-SNE plots for the Task II in Figure 8. The embedding space contains vectors for titles and the $\mathrm{T + A}$ embeddings. + +# D.1 Normalized Embeddings + +Timkey and van Schijndel (2021) indicate that cosine similarity is dominated by few rouge dimensions in embeddings. We repeat Task I with: (i) L2-normalized embeddings, and (ii) standardization procedure by Timkey and van Schijndel (2021). While L2-normalization leads to an incremental improvement, standardization leads to improvement only for SciBERT and SPECTER models. We present the results of Task I (Section 5) with normalized embeddings in Table 9. + +# E Analysing Scientific LMs with Textual Neighbors + +We present the plots for each of the seven datasets for the experiments with textual neighbors in the following sections. + +# E.1 Distribution of Textual Neighbors in the Embedding Space + +We present the plot for inter similarity of textual neighbor vectors in Figure 9, which depicts the maximum, minimum, mean and standard deviation of all pairs of documents for the five neighbor categories. Next, we present the percentage of document pairs for each of the 32 textual neighbor classes, whose similarity is greater than the average similarity for that particular class in Figure 10. + +# E.2 Similarity of Textual Neighbors with Original Documents + +Figure 11 presents the NN1_Ret and NN10_Ret for each of the datasets for the five textual neighbor + +![](images/ec3417a30d2d4436f57b9d0b74442395a6c0ba0fa1fdae15a71795400bd8459b.jpg) +SciBERT Arxiv-QBIO + +![](images/4293a0314b2bc391cd7c1c020716eeffd28a81deabd68148906d4b6c6fb25ef5.jpg) +SPECTER Arxiv-QBIO + +![](images/51f2782ee68d059c71836097fc8df8955eed40298b73ebae48420810f1839d93.jpg) +OAG-BERT Arxiv-QBIO + +![](images/6ec92f3876228751e99d9aeae7876641d3bd8558f97dda1be421a28f6ff37edf.jpg) +Arxiv-ECON + +![](images/ad3e65c9091e97ac278e5ea1c26c471d2fe28bb0f9b251907ddd5f0455eafde3.jpg) +Arxiv-ECON + +![](images/a729a5822445a8d989281e5e3c91b480527b989731b236a0edd340ab78dfd9a6.jpg) +Arxiv-ECON + +![](images/969e042daea257472b34b542d7cabbe74d7354f49f097bca279035e6f5bb4349.jpg) +Arxiv-MATH + +![](images/35fa2ca9fee5cde7ea1f3ac822f9f8a00a1f84f5c512a4f122d5b4532f8e338b.jpg) +Arxiv-MATH + +![](images/43b25b9a09969dd5c91e2d62b4800d34a50500d0ac44acb582a801e673208505.jpg) +Arxiv-MATH + +![](images/056ebb20b4df6993e2b790a90261719296e814a84bf78cc34b59f10fea1a5b4b.jpg) +Arxiv-HEP + +![](images/21f875292a55e588b6b7b05e6dfc5e7ece16f1e1e3717269ad2ba3d4696d6196.jpg) +Arxiv-HEP + +![](images/02bf0093ce87cdd8aebac401b06d25a20399afc10c582cd7ad067389bde2a220.jpg) +Arxiv-HEP + +![](images/bf31edf61f7acb97e4d04ab7d12a124fc0363312a75ab017a327a02ed36f6dc4.jpg) +ACL-ANTH + +![](images/e11ace814f6cdc4cf236eda4ea4fcc3809e030bd3f17dd567b280804a516a1a5.jpg) +ACL-ANTH + +![](images/7f27b67f41e287e23df13918d315c0e4ed8303b6b3ec9b30875e44e5c6d78b7f.jpg) +ACL-ANTH +Figure 8: t-SNE plots for T and $\mathrm{T + A}$ embeddings for various dataset. Completely non-overlapping embeddings for T and $\mathrm{T + A}$ by SciBERT model highlight differences in encoding texts of varying lengths. + +categories in the stacked bar format (NN10_Ret stacked onto NN1_Ret values). It can be observed that for all datasets, SPECTER achieves extremely high $(>95\%)$ NN1_Ret values for four (LO-PS, + +LO-HS, LL-PS, and LL-HS) out of five classes, and hence NN10_Ret does not significantly improve the retrieval. SciBERT values though less in comparison to SPECTER, show a nice trend + +
L2-normalized embeddingsStandardization (Timkey and van Schijndel, 2021)
SciBERTSPECTEROAG-BERTSciBERTSPECTEROAG-BERT
MRRT100MRRT100MRRT100MRRT100MRRT100MRRT100
Arxiv-MATH0.0136.80.6290.40.14826.20.0625.111000.1120.8
Arxiv-HEP0.018.20.69393.80.18130.20.0729.511000.12623.7
Arxiv-QBIO0.0076.80.79598.00.18231.00.14454.511000.12724.1
Arxiv-ECON0.0111.40.77295.90.19634.80.14249.811000.14426.6
Arxiv-CS_SY0.0075.90.85699.40.18331.30.11647.911000.13223.9
ICLR0.0075.40.59291.80.14529.90.0941.011000.12425.1
ACL-ANTH0.0023.10.7495.10.12325.20.03418.20.991000.09618.2
+ +Table 9: L2 normalization leads to an incremental improvement in performance. Standardization leads to improvement for SciBERT and SPECTER models, but the same effect is not observed for OAG-BERT embeddings. + +where NN10_Ret does not improve the retrieval significantly for HS categories (LO-HS and LL-HS), however it does improve retrieval recall for PS categories (LO-PS and LL-PS). OAG-BERT performs poorly with all categories achieving NN10_Ret values less than $40\%$ . We present in Figure 12, the NN1_Ret for each of the 32 textual neighbor classes. A close inspection reveals an interesting case for SciBERT, which has extremely low NN1_Ret values $(< 10\%)$ for one of the LL-HS category, T_A_WS whih replaces $50\%$ whitespace characters randomly with 2-5 whitespace. + +# E.3 Overlap amongst Nearest Neighbors + +AOP-10 is the average overlap percentage among the 10-NN (10 nearest neighbors) of the original document embeddings $(\mathrm{T} + \mathrm{A})$ and the textual neighbor embeddings. AOP-10 distribution of the 32 textual neighbor classes is presented in Figure 13. Low overlap percentage for OAG-BERT suggests that the model falters when presented with textual neighbors and does not represent textual neighbors in the neighborhood of the original document embeddings in the embedding space. + +![](images/c2e36e7e37c83964968e8bf9f778fbe3189a5b14c8d23eb956c277b0f04884d6.jpg) + +![](images/80ee38b2a1a6417da403d2559bf12be0f80ff667f1e1a2e4d9bb015c2fad9ee4.jpg) + +![](images/25e1e483a8b09e04cfa2bc53160f9da3be59003b2e8c55d55e668e85eb0db101.jpg) + +![](images/ea64c337c20b32f800a723c9e54e3cba4822f3a120505c22f434c1b1f9ddab73.jpg) + +![](images/3e10333ef315e7144dd1a4e8fb066cdae2fed833d9c213dd10c5ae61daac5089.jpg) + +![](images/f1e57236009d356d13d03b1c336e97633e9286d31f8ee4a3960450647f5d0982.jpg) + +![](images/8ef2c803a9d5d1d4886086e9a79282230ec7901e0286d1b84e8f32b73ac32d5c.jpg) +Figure 9: Inter Similarity of Textual Neighbor Vectors. The pairwise similarities among documents are spread out in a significantly broader range for OAG-BERT than SciBERT and SPECTER, suggesting that OAG-BERT vectors for different textual neighbors are more spread out in the vector space. + +![](images/7060551522247a63feded04f2b1360bd31e16476d8749e36559d954b380a4d69.jpg) + +![](images/d6213fec9140813e5dd0082069776ab4de181b0f1c62ec7368d7b8df8e8523ed.jpg) + +![](images/edeb7415c39c23ee45d170bce6f5501ee7ac76dd020959df723536e5c4337952.jpg) + +![](images/444ee8adfddb3ca6de9a4466aa25b2a0e93cd4e01e5eced50a643485440c4cdf.jpg) + +![](images/0eb3fd6066e9a02ed6cd3b8c8d63ad91eb22dae41e731beea0d204f31395e188.jpg) + +![](images/5508c4a2c04b3d440200cabcca6d4139d47139b34d08e69c7d050ce82b7126d6.jpg) + +![](images/834dcef2a63dea22c6cc74994f3153a9922e00683b1e1864211dc1828e302cb9.jpg) +Figure 10: Percentage of pair of documents for each Textual Neighbor whose similarity is greater than the average similarity. OAG-BERT shows high inter similarity (greater than $50\%$ ) among all textual neighbors suggesting that more than $50\%$ document pairs have a cosine similarity greater than average similarity. + +![](images/687f15d750bb191393661be3dea13834a31fe1c2dc450bc41608c92b850b2a89.jpg) + +![](images/d422f1f97139decdef6d94f0f8bd6b43d1c7f46d3e54d2aecb3ede43d101f6a7.jpg) + +![](images/6640250b45d98896f5a71b22bae7cf44f0b0920380913aa87c379eeab55253d7.jpg) + +![](images/205a68e2e63b0f44de3b59a1ae334f36fa534263b020839173b3bd8a7c114cc5.jpg) + +![](images/7636ea094aaa8673953c311279188d66d5571f9c2ed74aae0b6c7eec786c468b.jpg) + +![](images/b467cca835f8b846fc982a9a48ee8d6587313ac59f77ba26917c3356543fe541.jpg) + +![](images/38fff8a762ef36247f4aab9105ef3599c68e4bb84725c5c5971af8c1a2c634c5.jpg) +Figure 11: Stacked bars representing the percentage of documents of each textual neighbor category which retrieve the original document in the top-1 nearest neighbor and the top-10 nearest neighbor respectively. Results suggest that SciBERT embeddings for textual neighbors of scientific text are the most optimal. + +![](images/2e78047457d40e15849451e83c7ee7b8ecb974d0ed611d88ba3e86437cedfb4c.jpg) + +![](images/8aebed29de7b065fac28748478023ecafe9ddfda3d3c5547cdf114db0d60be4e.jpg) + +![](images/2b5d6f15434f501f765a2f53e25303d0ccbb6764661ca60ee1f7afcad8c03d0f.jpg) + +![](images/17df995ff6857640e00e182084bb4f43a01c00f0100dd5e74e97612efc6aee86.jpg) + +![](images/54586fa6affe60265d18f80a1c8d7a3f44cf7bf26ad37fa2f0386ccd688fa105.jpg) + +![](images/02bae73134a1cd344b1e5a5d9aa990c679a8604ca3dfa96941ee49a508939aab.jpg) + +![](images/0fe1bbf8834f128e904d1d95cfa746d6490005386c31f36bb07d6657a868ad86.jpg) +Figure 12: Distribution of NN1_Ret for each textual neighbor category. It can be observed that SciBERT embeddings preserve the hierarchy of NN1_Ret, i.e. Partially Similar categories (LO-PS and LL-PS) have lower values than Highly Similar categories (LO-HS and LL-HS). + +![](images/5c0c3559ea0d45b5e8d494df2c457d69c3ec6e95aa8dee7888e97a72930c757d.jpg) + +![](images/165518b7f02cef0842693d43c1714eef610bb07c69186de03a4b4fe8dab53264.jpg) + +![](images/734c5a8deedeae2447b3b460de48f2ebc1b527a42dfc7a5a0707159ffae926e4.jpg) + +![](images/ca98ac74a4e7024487d6431f64836ae5f1f96852b387e4353cfd7d8d53a8e06e.jpg) + +![](images/c83ac398dd1610cba0ecf7b5ecbed881b5f02f0cd40f041a2e0f0e81059d73fc.jpg) + +![](images/084d50b92791777884dac2856f7912fb27c68697491d3dd7696345e344a45e52.jpg) + +![](images/26abe9179df31c076b7d3a9a54ca5756b4c59624962219951ccf4501cfdec8bf.jpg) +Figure 13: AOP-10 distribution of all categories of textual neighbors. It can be observed that SciBERT performs poorly for the LL-PS category (involves neighbors that scramble sentences such as arranging randomly, or arranging in increasing or decreasing order of sentence length). For the rest of the categories, SciBERT embeddings show desirable order of AOP-10 values, e.g. LL-HS > LO-HS. SPECTER values have high AOP-10, which is desirable, except for the LO-DS category. \ No newline at end of file diff --git a/theinefficiencyoflanguagemodelsinscholarlyretrievalanexperimentalwalkthrough/images.zip b/theinefficiencyoflanguagemodelsinscholarlyretrievalanexperimentalwalkthrough/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..bc9c872e8e3296f0ddbcba8f011c55a9b2b4065d --- /dev/null +++ b/theinefficiencyoflanguagemodelsinscholarlyretrievalanexperimentalwalkthrough/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9fd7d06dd7e402c1e29a2de1073242f487b5e386cb5b9b5a8366f7eb90662eeb +size 2370595 diff --git a/theinefficiencyoflanguagemodelsinscholarlyretrievalanexperimentalwalkthrough/layout.json b/theinefficiencyoflanguagemodelsinscholarlyretrievalanexperimentalwalkthrough/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..bb7f84798b6a020df9bf0efa4b2f667b5ceb0a9c --- /dev/null +++ b/theinefficiencyoflanguagemodelsinscholarlyretrievalanexperimentalwalkthrough/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a82b833aa86cf750d1715b71bba36691de7eb75e6caa9658a674be58c2aaeedd +size 546394 diff --git a/thepastmistakeisthefuturewisdomerrordrivencontrastiveprobabilityoptimizationforchinesespellchecking/0c03743f-b492-4767-a380-1a0ef0ecda8d_content_list.json b/thepastmistakeisthefuturewisdomerrordrivencontrastiveprobabilityoptimizationforchinesespellchecking/0c03743f-b492-4767-a380-1a0ef0ecda8d_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..663498300952c2b9d88e76c737631aa548cbc660 --- /dev/null +++ b/thepastmistakeisthefuturewisdomerrordrivencontrastiveprobabilityoptimizationforchinesespellchecking/0c03743f-b492-4767-a380-1a0ef0ecda8d_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3e4ea3455b1046892a7f54660caf095a465bf5713ef1edb85124093070d9157a +size 79836 diff --git a/thepastmistakeisthefuturewisdomerrordrivencontrastiveprobabilityoptimizationforchinesespellchecking/0c03743f-b492-4767-a380-1a0ef0ecda8d_model.json b/thepastmistakeisthefuturewisdomerrordrivencontrastiveprobabilityoptimizationforchinesespellchecking/0c03743f-b492-4767-a380-1a0ef0ecda8d_model.json new file mode 100644 index 0000000000000000000000000000000000000000..6be5ecb90fa83f4edae01fcf39174c9b543a671e --- /dev/null +++ b/thepastmistakeisthefuturewisdomerrordrivencontrastiveprobabilityoptimizationforchinesespellchecking/0c03743f-b492-4767-a380-1a0ef0ecda8d_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aee55f29c52dd637bb966bccc5b243e72b09c119f6ca98167c6a045a47a3e244 +size 94831 diff --git a/thepastmistakeisthefuturewisdomerrordrivencontrastiveprobabilityoptimizationforchinesespellchecking/0c03743f-b492-4767-a380-1a0ef0ecda8d_origin.pdf b/thepastmistakeisthefuturewisdomerrordrivencontrastiveprobabilityoptimizationforchinesespellchecking/0c03743f-b492-4767-a380-1a0ef0ecda8d_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..4cc2804bd64fc75b411cba66198b6949c86e72cf --- /dev/null +++ b/thepastmistakeisthefuturewisdomerrordrivencontrastiveprobabilityoptimizationforchinesespellchecking/0c03743f-b492-4767-a380-1a0ef0ecda8d_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9826bc37dc7637b515f8f2f95992e647ec49d548cf3e445295023e427ec1f385 +size 1650410 diff --git a/thepastmistakeisthefuturewisdomerrordrivencontrastiveprobabilityoptimizationforchinesespellchecking/full.md b/thepastmistakeisthefuturewisdomerrordrivencontrastiveprobabilityoptimizationforchinesespellchecking/full.md new file mode 100644 index 0000000000000000000000000000000000000000..b59953f48406f53a89f4457f896b250d2ac5aeb7 --- /dev/null +++ b/thepastmistakeisthefuturewisdomerrordrivencontrastiveprobabilityoptimizationforchinesespellchecking/full.md @@ -0,0 +1,304 @@ +# The Past Mistake is the Future Wisdom: Error-driven Contrastive Probability Optimization for Chinese Spell Checking + +Yinghui Li $^{1*}$ , Qingyu Zhou $^{2*}$ , Yangning Li $^{1}$ , Zhongli Li $^{2}$ , Ruiyang Liu $^{4}$ , Rongyi Sun $^{1}$ , Zizhen Wang $^{2}$ , Chao Li $^{2}$ , Yunbo Cao $^{2}$ and Hai-Tao Zheng $^{1,3\dagger}$ + +$^{1}$ Tsinghua Shenzhen International Graduate School, Tsinghua University + +$^{2}$ Tencent Cloud Xiaowei, $^{3}$ Peng Cheng Laboratory + +$^{4}$ Department of Computer Science and Technology, Tsinghua University + +liyinghu20@mails.tsinghua.edu.cn,qingyuzhou@tencent.com + +# Abstract + +Chinese Spell Checking (CSC) aims to detect and correct Chinese spelling errors, which are mainly caused by the phonological or visual similarity. Recently, pre-trained language models (PLMs) promote the progress of CSC task. However, there exists a gap between the learned knowledge of PLMs and the goal of CSC task. PLMs focus on the semantics in text and tend to correct the erroneous characters to semantically proper or commonly used ones, but these aren't the ground-truth corrections. To address this issue, we propose an Error-driven COntrastive Probability Optimization (ECOPO) framework for CSC task. ICOPO refines the knowledge representations of PLMs, and guides the model to avoid predicting these common characters through an error-driven way. Particularly, ICOPO is model-agnostic and it can be combined with existing CSC methods to achieve better performance. Extensive experiments and detailed analyses on SIGHAN datasets demonstrate that ICOPO is simple yet effective. + +# 1 Introduction + +Chinese Spell Checking (CSC) aims to detect and correct spelling errors in Chinese texts (Wu et al., 2013a). It is a crucial research field for various NLP downstream applications, such as Optical Character Recognition (Afli et al., 2016), search query correction (Gao et al., 2010) and essay scoring (Dong and Zhang, 2016). However, CSC is also very challenging because it mainly suffers from confusing characters, such as phonologically and visually similar characters (Liu et al., 2010; Zhang et al., 2020). As illustrated in Figure 1, “素(sù, plain)” and “诉(sù, sue)” are confusing characters for each other due to the shared pronunciation “sù”. + +
Phono- logical 83%Input希望您帮我素(plain)取公平。
Correct希望您帮我诉(sue)取公平。
Candidate 1希望您帮我争(fight)取公平。
Candidate 2希望您帮我谋(plan)取公平。
Candidate 3希望您帮我获(acquire)取公平。
TranslationHope you help me to sue and get justice.
Visual 48%Input我们为这个目标努力不解(understand)。
Correct我们为这个目标努力不懈(slack)。
Candidate 1我们为这个目标努力不休 (rest)。
Candidate 2我们为这个目标努力不断 (break)。
Candidate 3我们为这个目标努力不停(stop)。
TranslationWe fight for this goal without slack.
+ +Figure 1: Examples of Chinese spelling errors. Previous research (Liu et al., 2021) shows that $83\%$ of errors belong to phonological error and $48\%$ belong to visual error. We give the characters with their pronunciation and translation. We mark the input confusing/golden/common candidate characters in red/blue/orange. The characters in "Candidate" sentences are all predicted by fine-tuned BERT. + +Recently, pre-trained language models (PLMs) such as BERT (Devlin et al., 2019) have been utilized in the CSC task and became mainstream solutions (Zhang et al., 2020; Cheng et al., 2020). However, there exists a significant gap between the learned knowledge of PLMs and the goal of CSC task. PLMs provide informative representations from the perspective of semantics, but if only considering the semantics in CSC, there are multiple appropriate characters as the correction. Without the constraints of phonological and visual similarities, PLMs easily predict semantically proper or common characters due to the masking strategy in the pre-training procedure. + +Figure 1 presents two predictions of BERT to better understand the gap mentioned before. The first example is caused by the misuse of “素(sù, plain)” and “诉(sù, sue)”. An ideal CSC model should pay attention to the pronunciation information “sù” + +and output the golden character "诉(sue)" as a correction for the input confusing character. However, as pre-trained on general corpora, BERT tends to predict semantically proper characters, such as "争(zhēng, fight)", "谋(móu, plan)" and "获(huò, acquire)". These characters are also from more commonly used phrases. In the second example, BERT also overlooks the visual similarity between "解(jiě, understand)" and "懈(xiè, slack)", resulting in wrong correction. + +To alleviate this gap, we propose to empower the PLMs to avoid predicting the above-mentioned common characters by optimizing the knowledge representation of PLMs. Intuitively, if we guide the model to not make the same mistakes it would prone to make before, the model performance should be improved. Hence, the mistakes that the model has ever made can be utilized as constraints on the knowledge representation of the model. In other words, we exploit the past mistakes that the model may make to further enhance the model itself, this is the meaning of our title, "the past mistake is the future wisdom". + +Motivated by the above intuition, we propose the Error-driven COntrastive Probability Optimization (ECOPO), a simple yet effective training framework which aims to refine the knowledge representation of models for CSC. The ECOPO consists of two stages: (1) Negative samples selection. Based on the model's prediction probabilities for different characters, we select the common characters with high probability as negative samples. The golden character is directly regarded as the positive sample. (2) Contrastive probability optimization. After obtaining the positive and negative samples, we train the model by Contrastive Probability Optimization (CPO) objective which aims to optimize the prediction probabilities for different characters. Through this optimization process, we can finally narrow the gap between the pre-trained knowledge of PLMs and the goal of CSC. Additionally, ECOPO has no strict restrictions on the model to be optimized, so it can further improve the performance of various existing CSC models. + +In summary, our contributions are in three folds: (1) We firstly observe and focus on the negative impact of the gap between the knowledge of PLMs and the goal of CSC. (2) We propose model-agnostic EOPO framework, which can teach the models to grow and progress with their own past mistakes. (3) We conduct extensive experiments + +and detailed analyses on SIGHAN benchmarks and achieve state-of-the-art performance. + +# 2 Related Work + +# 2.1 Chinese Spell Checking + +Early works in CSC mainly focus on designing heuristic rules to detect different kinds of errors (Chang et al., 2015; Chu and Lin, 2015). Most of these methods rely on solid linguistic knowledge and manually designed features, and thus do not have the generalization performance required for large-scale application. Next, various traditional machine learning algorithms, such as Conditional Random Field (CRF) and Hidden Markov Model (HMM), are applied in CSC (Wang and Liao, 2015; Zhang et al., 2015). Then, deep learning-based models have gradually become the mainstream of CSC in recent years (Wang et al., 2021a; Guo et al., 2021; Zhang et al., 2021). + +Wang et al. (2018) utilize a BiLSTM trained on an automatically generated dataset to convert CSC to sequence labeling problem. Hong et al. (2019) propose to generate and curtail the candidate characters through a BERT-based denoising autoencoder. The Soft-Masked BERT model (Zhang et al., 2020) uses two separate networks for detection and correction. Then SpellGCN (Cheng et al., 2020) uses GCN (Kipf and Welling, 2017) to fuse character embedding with similar pronunciation and shape, explicitly modeling the relationship between characters. PLOME (Liu et al., 2021) is proposed to be a task-specific pre-trained language model for CSC, which designs a confusion set based masking strategy and introduces various external knowledge. Additionally, REALISE (Xu et al., 2021) verifies that the multimodal knowledge can be leveraged to improve CSC performance. + +# 2.2 Contrastive Learning + +The main motivation of contrastive learning is to attract the positive samples and repulse the negative samples in a certain space (Hadsell et al., 2006; Chen et al., 2020; Khosla et al., 2020). Existing contrastive learning models in NLP are mainly focusing on the language representation space (e.g, word/sentence/semantic representations) (Iter et al., 2020; Gao et al., 2021; Wang et al., 2021b). Different from them, our proposed method directly optimizes the model's probability space for different characters through selected positive/negative samples and their original predicted probability. + +![](images/b75af4ea5d02646d1c3e3402747e59afa036679f54d73caacbb88a169ddd4149.jpg) +Figure 2: Overview of ECOPO framework. We select negative samples according to the original prediction probability of PLMs (e.g, for the position of "拙", PLMs predicts the Top 5 characters as "强", "壮", "粗", "健", and "雄"). then optimize the PLMs with the contrastive optimization objective and traditional original objective. + +# 3 Methodology + +In this section, we introduce the proposed ECOPO in details, as illustrated in Figure 2. ECOPO aims to refine the knowledge representation of PLMs to narrow the gap between it and the essential of CSC task. As mentioned in Section 1, with the model before our optimization process, we select the mistakes generated by this model itself to be the negative samples. Then through the Contrastive Probability Optimization objective, we maximize the prediction probabilities of the model for correct answers and minimize the prediction probabilities of the model for negative samples. In this error-driven way, the original prediction probabilities of the model are refined, improving the performance of the model on the CSC task. Therefore, the model will grow and progress after making mistakes again and again, just as humans do. Note that the proposed ECOPO is a model-agnostic framework, we can choose different PLMs or CSC models to be optimized in practice for better performance. + +# 3.1 Observation and Intuition + +To present our approach more clearly, we first describe our observation, and then give our explanation of the observation and intuition. + +The key observation that ECOPO builds on is that PLMs such as BERT cannot focus well on the confusing characters that need to be paid more attention in the CSC task, as illustrated in Figure 1. + +We think that this gap comes mainly from the general corpora and the training paradigm used in the pre-training of language models. Taking the BERT as an example, its pre-training corpus is mainly from the text in Wikipedia, which has a very low proportion of contexts containing confusing characters, as verified in Section 4.6. Additionally, Devlin et al. (2019) randomly choose $15\%$ of tokens in the entire corpus to be masked by a fixed token "[MASK]" and then recover them. This masking-recovering strategy makes the knowledge acquired by PLMs in pre-training process discontinuous in the CSC task (Liu et al., 2021). Because the size of confusing characters will be lower in the $15\%$ of characters that are randomly selected. + +In fact, there also exists the same challenge when humans correct spelling errors. When only given the context of input sentence without seeing the misspelling, they tend to associate the common character rather than the confusing character with the context. Therefore, humans or models would wrongly predict common characters. Intuitively, if the model can be optimized with common characters through an error-driven way, then the model can certainly be further enhanced, just as humans get progress from the mistakes they have made. + +# 3.2 Stage 1: Negative Samples Selection + +We define the negative samples in CSC as those common characters that be incorrectly assigned high prediction probability by PLMs before our + +optimization process. According to our observation, negative samples that can form common collocations or phrases with the context tend to be assigned higher probability than the golden character, leading the model to make wrong corrections. Therefore, we use a simple strategy based on the prediction probability to select the negative samples which we utilize in the next stage. + +Specifically, we use PLMs such as BERT to predict the original character for each input token based on the output of the last transformer layer. The prediction probability of the i-th token $x_{i}$ in a sentence $X$ is defined as: + +$$ +p \left(y _ {i} = j \mid X\right) = \operatorname {s o f t m a x} \left(\boldsymbol {W} \boldsymbol {h} _ {i} + \boldsymbol {b}\right) [ j ], \quad (1) +$$ + +where $p(y_{i} = j\mid X)$ means the conditional probability that the i-th token $x_{i}$ is predicted as the j-th character in the vocabulary of PLMs, $\boldsymbol {W}\in$ $R^{vocab\times hidden}$ and $\pmb {b}\in R^{vocab}$ are learnable parameters,vocab is the size of vocabulary and the hidden is the size of hidden state, $h_i\in$ $R^{hidden}$ is hidden state output of PLMs for the i-th token $x_{i}$ + +Based on the original prediction probability, if the model makes wrong correction for the input character, we will select negative samples for the input character. The negative samples set $Neg$ is selected from the candidate set $T$ as: + +$$ +T = \left\{t \mid t \in V a n d t \neq t ^ {+} \right\}, \tag {2} +$$ + +$$ +N e g = \underset {T ^ {\prime} \subset T, | T ^ {\prime} | = K} {\arg \max } \sum_ {t ^ {-} \in T ^ {\prime}} p \left(y _ {i} = t ^ {-} \mid X\right), \tag {3} +$$ + +where $t^{-}$ and $t^{+}$ mean the negative and positive samples, respectively. The negative samples $t^{-}$ are selected from those tokens whose prediction probability is in the Top $K$ of the vocabulary $V$ , and the best value of $K$ is selected empirically. It is worth noting that the training process is supervised in the CSC task, so we can regard the golden character as the positive sample $t^{+}$ . + +# 3.3 Stage 2: Contrastive Probability Optimization + +After obtaining the positive/negative samples and their corresponding prediction probability, we train the model by Contrastive Probability Optimization (CPO) objective which is defined as: + +$$ +\begin{array}{l} \mathcal {L} _ {C P O} = - \frac {1}{N} \sum_ {i = 1} ^ {N} \frac {1}{K} \sum_ {k = 1} ^ {K} \left\{p \left(y _ {i} = t ^ {+} \mid X\right) \right. \tag {4} \\ - p \left(y _ {i} = t _ {k} ^ {-} \mid X\right) \}, \\ \end{array} +$$ + +where $N$ is the batch size, $K$ is the selected negative samples size, $t_k^-$ is the $k$ -th negative sample in Neg. The CPO objective aims to teach the model to increase the prediction probability for positive sample (i.e., confusing character) and decrease the prediction probabilities for negative samples (i.e., common characters) by the maximum likelihood of the difference between the original probabilities for positive and negative samples. + +To preserve the generalization performance of the model, we train both the existing original objective $\mathcal{L}_{ORI}$ and the CPO objective $\mathcal{L}_{CPO}$ . The overall objective is defined as: + +$$ +\mathcal {L} = \lambda_ {1} \mathcal {L} _ {O R I} + \lambda_ {2} \mathcal {L} _ {C P O}, \tag {5} +$$ + +where $\lambda_{1}$ and $\lambda_{2}$ are weighting factors for two objectives. We use cross-entropy loss function as the $\mathcal{L}_{ORI}$ for BERT in our experiments. The training pseudo-code of EOPO is shown in Appendix A.1. As described in Equation 5, we can replace the $\mathcal{L}_{ORI}$ with other models' training objectives, so EOPO is model-agnostic and it can be easily used in other PLMs or previous CSC methods to achieve further improvements. + +Most previous works use softmax and cross-entropy functions to train CSC models. But why just using softmax is not enough and using CPO is necessary? Theoretically: (1) Their motivations are different, softmax is to normalize the PLMs' logits into a probability distribution, but CPO aims to refine the knowledge representation of PLMs in the probability space. (2) Their scopes are different, softmax relies on all logits output by models for weighted calculation, this global weighting mechanism makes it not have good local attention. However, CPO can pay attention to a part of really difficult samples that models would often make mistakes through the negative samples selection stage. (3) Their results are different, through the softmax operation, we finally obtain a probability distribution that is softer than the original logits. But the CPO we proposed can eventually change the order of the original prediction probability, directing the model to assign higher probability to positive sample and lower probabilities to negative samples. Therefore, our work can be regarded as a great complement to the traditional softmax + cross-entropy training paradigm. Empirically, we conducted in-depth analyses in Sections 4.5.1- 4.5.3. + +# 4 Experiments + +In this section, we introduce the details of experiments and main results we obtained. Then we conduct detailed analyses and discussions to verify the effectiveness of our method. + +# 4.1 Datasets + +Training Data We use the same training data by following previous works (Zhang et al., 2020; Liu et al., 2021; Xu et al., 2021), including the training samples from SIGHAN13 (Wu et al., 2013b), SIGHAN14 (Yu et al., 2014), SIGHAN15 (Tseng et al., 2015) and the pseudo training samples (size of 271K, we denote this part of samples as Wang271K in our paper) automatically generated by OCR-based and ASR-based methods (Wang et al., 2018). + +Test Data To ensure the fairness, we use the exact same test data as the baseline methods, from the test datasets of SIGHAN13/14/15. Noted that the text of original SIGHAN datasets is in the Traditional Chinese, we pre-process these original datasets to the Simplified Chinese using the OpenCC1. This data conversion procedure has been widely used in previous works (Wang et al., 2019; Cheng et al., 2020; Zhang et al., 2020). The detailed statistic of the training/test data we use in our experiments is presented in Appendix A.2. + +# 4.2 Baseline Methods + +To evaluate the performance of ECOPO, we select several advanced strong baseline methods: BERT (Devlin et al., 2019) is directly fine-tuned on the training data. Hybrid (Wang et al., 2018) casts CSC into sequence labeling problem and implements BiLSTM model. FASpell (Hong et al., 2019) consists of a denoising autoencoder and a decoder. Soft-Masked BERT (Zhang et al., 2020) consists of a detection network and a correction network. SpellGCN (Cheng et al., 2020) integrates the confusion set to the correction model through GCNs. PLOME (Liu et al., 2021) is a task-specific PLM which jointly learns how to understand language and correct spelling errors. REALISE (Xu et al., 2021) is a multimodel model which captures and mixes the semantic, phonetic and graphic information to improve CSC performance. REALISE is the previous state-of-the-art method on SIGHAN13/14/15 datasets. + +# 4.3 Experimental Setup + +In terms of evaluation granularity, there are two levels of metrics, namely character/sentence-level. Obviously, the sentence-level metric is stricter than the character-level metric because there may be multiple wrong characters in a sentence. One sentence sample is considered to be correct only when all the wrong characters in it are detected and corrected successfully. Therefore, we report the sentence-level metrics for evaluation, which are widely used in previous works (Li et al., 2021; Huang et al., 2021; Xu et al., 2021). + +Specifically, the metrics we report include Accuracy, Precision, Recall and F1 score for detection and correction levels. At the detection level, all locations of wrong characters in a sentence should be identical successfully. At the correction level, the model must not only detect but also correct all the erroneous characters with the gold standard. + +Other implementation details and hyperparameters choices are presented in Appendix A.3. + +# 4.4 Experimental Results + +From Table 1, we can observe that: + +1. The ECOPO (BERT) performs better than BERT on all test sets and evaluation metrics. Specifically, ECOPO (BERT) achieves significant improvement on SIGHAN15, and outperforms the previous state-of-the-art models with a very thin model, while REALISE and PLOME are two complex models with some auxiliary modules. Note that ECOPO (BERT) only consists of a BERT encoder. +2. From the results on the SIGHAN14 test set, we can see that the performance improvement of ECOPO (BERT) based on BERT is not as large as on the other two test sets, but still effective. Additionally, due to the model-agnostic advantage of ECOPO, it can be simply combined with other previous state-of-the-art models such as REALISE and get further enhancement, which are presented in the rows of REALISE and ECOPO (REALISE). +3. Considering the impact of external knowledge, several previous works exploit various additional information to improve performance. For example, FASpell and SpellGCN introduce character similarity to CSC, REALISE and PLOME propose to leverage multimodal + +
DatasetMethodDetection LevelCorrection Level
AccPreRecF1AccPreRecF1
SIGHAN13Hybrid (Wang et al., 2018)-54.069.360.7---52.1
FASpell (Hong et al., 2019)63.176.263.269.160.573.160.566.2
SpellGCN (Cheng et al., 2020)-80.174.477.2-78.372.775.4
BERT (Xu et al., 2021)77.085.077.080.877.483.075.278.9
ECOPO (BERT)81.7↑87.2↑81.7↑84.4↑80.7↑86.1↑80.6↑83.3↑
REALISE (Xu et al., 2021)82.788.682.585.481.487.281.284.1
ECOPO (REALISE)83.3↑89.3↑83.2↑86.2↑82.1↑88.5↑82.0↑85.1↑
SIGHAN14Hybrid (Wang et al., 2018)-51.966.258.2---56.1
FASpell (Hong et al., 2019)70.061.053.557.069.359.452.055.4
SpellGCN (Cheng et al., 2020)-65.169.567.2-63.167.265.3
BERT (Xu et al., 2021)75.764.568.666.574.662.466.364.3
ECOPO (BERT)76.7↑65.8↑69.0↑67.4↑75.7↑63.7↑66.9↑65.3↑
REALISE (Xu et al., 2021)78.467.871.569.677.766.370.068.1
ECOPO (REALISE)79.0↑68.8↑72.1↑70.4↑78.5↑67.5↑71.0↑69.2↑
SIGHAN15Hybrid (Wang et al., 2018)-56.669.462.3---57.1
FASpell (Hong et al., 2019)74.267.660.063.573.766.659.162.6
SpellGCN (Cheng et al., 2020)-74.880.777.7-72.177.775.9
PLOME (Liu et al., 2021)-77.481.579.4-75.379.377.2
Soft-Masked BERT (Zhang et al., 2020)80.973.773.273.577.466.766.266.4
ECOPO (Soft-Masked BERT)81.2↑74.0↑76.6↑75.3↑79.1↑67.0↑72.3↑69.6↑
BERT (Xu et al., 2021)82.474.278.076.181.071.675.373.4
ECOPO (BERT)85.5↑78.2↑82.3↑80.2↑84.6↑76.6↑80.4↑78.4↑
REALISE (Xu et al., 2021)84.777.381.379.384.075.979.977.8
ECOPO (REALISE)85.0↑77.5↑82.6↑80.0↑84.2↑76.1↑81.2↑78.5↑
+ +Table 1: The performance of ECOPO and all baseline methods. Note that all baseline results are directly from other published paper. ECOPO (model-X) means that we perform ECOPO framework on model-X. We underline the previous state-of-the-art performance for convenient comparison. “↑” indicates that the corresponding baseline method receives a further performance improvement after optimization by ECOPO. + +knowledge such as phonetic and graphic information. Unlike the aforementioned models, ECOPO (BERT) achieves competitive performance without any additional knowledge and optimizing only based on the mistakes that the original BERT itself has made. + +4. To verify the model-agnostic characteristic of ECOPO, we choose two other models including Soft-Masked BERT and REALISE to be optimized. Practically, we train the combined model with the joint objective, as described in Equation 5. From the results of Table 1, we can see that ECOPO's improvement is stable and significant over the three models. + +# 4.5 Analysis and Discussion + +# 4.5.1 Statistics of Different Characters + +To further empirically explain why the method we proposed is effective, we conduct sufficient statistical experiments, as shown in Table 2. We apply different methods to the SIGHAN13/14/15 datasets, + +and carry out statistical analyses on their wrong correction samples. Note that if a character co-occurs with the character before or after the error position more than 1,000 times in wiki2019zh $^2$ , we regard it as a common character. + +From Table 2, we can see that when only softmax is used, most of the failures of the model are because it incorrectly assigns higher prediction probabilities to common characters, which reflects the gap between the pre-trained knowledge of PLMs and the goal of CSC. When we run ECOPO or only CPO, the model does pay more attention to the less common but more confusing characters. Our proposed CPO indeed effectively change the model's predictions for different types of characters. Thus, CPO refines the knowledge representation of PLMs for CSC and narrow the gap between PLMs and CSC, but softmax does not. + +![](images/336ba997bbe79be9c9f18c38e4b56fbecd8ba57d239a449f0c279283a5c4ccb0.jpg) +Figure 3: Heat map visualization of probability. The darker the blue, the higher the model's prediction probability for a particular character (vertical axis) given the input of samples containing misspelled characters (horizontal axis). The selected samples are from SIGHAN15, and the original BERT would make wrong corrections for them. + +![](images/043abd301b31c3672e9bb74cb4e7a368b3b52e6c039c77e7f2fc3659d1fca12e.jpg) + +
DatasetMethodCommonConfusing
SIGHAN13softmax172 (76%)54 (24%)
CPO108 (54%)92 (46%)
ECOPO100 (52%)93 (48%)
SIGHAN14softmax208 (77%)62 (23%)
CPO159 (61%)101 (39%)
ECOPO152 (59%)106 (41%)
SIGHAN15softmax171 (82%)38 (18%)
CPO72 (41%)103 (59%)
ECOPO68 (40%)101 (60%)
+ +Table 2: Statistical results on different types of characters. The statistical samples are the all wrong correction samples of different methods. + +# 4.5.2 Visualization of Common/Confusing Character Probability + +The key objective of EOPO is to optimize the prediction probability of the PLMs for two different kinds of characters, i.e., common characters which original PLMs would be more inclined and confusing characters which CSC task should pay more attention to. Therefore, we visualize the probability optimization effect of EOPO in this part of experiment. Specifically, we apply BERT and EOPO (BERT) to predict the character which should appear at the position of the misspelled character based on its context. We select the Top-5 characters co-occurring with the context of the misspelled character as the common characters, and 5 confusing characters from the widely used confusion set (Wu et al., 2013b). Note that we ensure that the common and confusing characters selected + +are not duplicated, and the golden character must be in the selected 5 confusing characters. Then we visualize the prediction probabilities of common/confusing characters as a heat map. + +Figure 3 shows the prediction probability distributions of BERT and ECOPO (BERT) for the common/confusing characters. By comparison, we can see that BERT assigns higher probability to common characters than confusing characters, and ECOPO (BERT) focuses more on confusing characters which are similar to the golden character. This difference in BERT before and after ECOPO's optimization is consistent with our study motivation and design objective. We can see that ECOPO does refine the knowledge representation and prediction probability of BERT for different characters. + +# 4.5.3 Effects of Weighting Factors $\lambda_{1},\lambda_{2}$ + +Firstly, from Figure 4, we can see that no matter how the values of $\lambda_{1},\lambda_{2}$ change, ECOPO (BERT) always has improvement compared to the baseline BERT, which reflects the general effectiveness of our proposed method. We also can find that whether only using $\mathcal{L}_{ORI}$ $(\lambda_1 = 1,\lambda_2 = 0)$ or $\mathcal{L}_{CPO}$ $(\lambda_{1} = 0,\lambda_{2} = 1)$ for training, there is an improvement compared to the baseline model. Besides, only using $\mathcal{L}_{CPO}$ has a greater improvement than only using $\mathcal{L}_{ORI}$ , which illustrates the advantage of our proposed CPO over softmax. Furthermore, when $\lambda_{2}$ is fixed to 1, as $\lambda_{1}$ increases, the model performance shows a trend of first decreasing and then increasing. From this phenomenon, we suspect that the widely used $\mathcal{L}_{ORI}$ in previous works has a certain regularization effect on the + +![](images/fdb345b767df67cdfa93ff3ac497de7143b3f37b18f006ba9f0a8639baebd2a5.jpg) +(a) Detection performance + +![](images/e71a781ca3886ed5cc2a91128e9932ddd6152f3b6558034640ed93f1460589d4.jpg) +(b) Correction performance + +![](images/3294474244c5773b452a9ea0180a43abef030727992e060c060ceed7e9a3aa6a.jpg) +Figure 4: The F1 results on SIGHAN15, using different combinations of $\lambda_{1},\lambda_{2}$ in Equation 5 in ECOPO (BERT). When $\lambda_1 = 0,\lambda_2 = 0$ , it is equivalent to the baseline BERT. +Figure 5: The F1 results on SIGHAN15, using different values of $K$ in Equation 3 in ECOPO (BERT). The dotted lines represent the baseline BERT's performance. + +probability space of the model. Also for this reason, only using $\mathcal{L}_{ORI}$ has improvements compared to the baseline. Additionally, the regularization effect of $\mathcal{L}_{ORI}$ is good for the process of $\mathcal{L}_{CPO}$ optimizing the probability representation, and can help model avoid over-fitting. Therefore, in practice, we chose the combination that perform best in SIGHAN13/14/15, namely $\lambda_{1} = 1$ , $\lambda_{2} = 1$ . + +# 4.5.4 Effects of Negative Samples Size $K$ + +As different amounts of negative samples can affect EOPO's performance, it is essential to study the impact of negative samples size $K$ in Equation 3. + +Figure 5 illustrates the performance change from the perspective of detection and correction. We find that when the value of $K$ reaches a certain value (e.g., $K > 5$ ), the overall performance of the model (F1 score) does not improve anymore. This is because ECOPO optimizes the model based on the probability representation, when the value of $K$ becomes very large, the predicted probabilities of samples become so small that they have almost no effect on the probability optimization of the positive sample. Therefore, choosing an appropriate $K$ value is critical to the performance improvement + +
Input:与其自暴自气(弃)不如往好处想。It's better to think for the good than to be angry (give up).
BERT:[己(own),大(big),利(benefit)]
ECOPO:[弃(give up),尊(respect),强(strong)]
Input:我努力打败数不进(尽)的风雨。I try to beat the enter (endless) storms.
BERT:[起 raisé),上(up),得(get)]
ECOPO:[尽(endless),得(get),完(end)]
+ +Table 3: Examples of spelling errors and corresponding output (Top 3 candidates) of original BERT and ECOPO (BERT). We mark the input confusing/golden/wrong correction characters in red/blue/orange. + +of ECOPO, although ECOPO has significant improvement based on BERT at all values of $K$ . + +# 4.6 Case Study for Probability Optimization + +Table 3 shows the comparisons between the correction results of BERT and ECOPO (BERT). In the first examples, the output of BERT such as “己”, “大” and “利” all can form a correct Chinese phrase with “自”, but they cause a semantic incoherence for the whole sentence. The statistics of the general pre-training corpus wiki2019zh show that “自己” co-occurs 136,318 times and “自弃” co-occurs 119 times, which verifies the intuition about common/confusing characters described in Section 3.1. In the second example as well, the output of BERT can be formed with “数不” as reasonable phrases. From the two examples, we can see that ECOPO does guide the BERT to accurately predict the ideal confusing characters by the highest probability and make the right corrections. Such experimental results are in line with our work's core motivation. + +# 5 Conclusion + +In this paper, we introduce to promote CSC by narrowing the gap between the knowledge of PLMs and the goal of CSC. We propose the ECOPO, a simple yet effective training framework that aims to perform an error-driven optimization for the PLMs based on their original probability representation. Extensive experiments and empirical results show the competitive performance of our method. In the future, we will study how to automatically measure the quality of negative samples to further enhance our method. Additionally, applying our core idea to other tasks will be an interesting direction. + +# 6 Acknowledgement + +This research is supported by National Natural Science Foundation of China (Grant No. 6201101015), Beijing Academy of Artificial Intelligence (BAAI), the Natural Science Foundation of Guangdong Province (Grant No. 2021A1515012640), Basic Research Fund of Shenzhen City (Grant No. JCYJ20210324120012033 and JCYJ20190813165003837), and Overseas Cooperation Research Fund of Tsinghua Shenzhen International Graduate School (Grant No. HW2021008). Finally, we would like to thank Luying Huang for valuable suggestions. + +# References + +Haithem Afli, Zhengwei Qiu, Andy Way, and Páraic Sheridan. 2016. Using SMT for OCR error correction of historical texts. In Proceedings of the Tenth International Conference on Language Resources and Evaluation (LREC'16), pages 962-966, Portož, Slovenia. European Language Resources Association (ELRA). +Tao-Hsing Chang, Hsueh-Chih Chen, and Cheng-Han Yang. 2015. Introduction to a proofreading tool for Chinese spelling check task of SIGHAN-8. In Proceedings of the Eighth SIGHAN Workshop on Chinese Language Processing, pages 50-55, Beijing, China. Association for Computational Linguistics. +Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. 2020. A simple framework for contrastive learning of visual representations. In International conference on machine learning, pages 1597-1607. PMLR. +Xingyi Cheng, Weidi Xu, Kunlong Chen, Shaohua Jiang, Feng Wang, Taifeng Wang, Wei Chu, and Yuan Qi. 2020. SpellGCN: Incorporating phonological and visual similarities into language models for Chinese spelling check. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 871-881, Online. Association for Computational Linguistics. +Wei-Cheng Chu and Chuan-Jie Lin. 2015. NTOU Chinese spelling check system in sighan-8 bake-off. In Proceedings of the Eighth SIGHAN Workshop on Chinese Language Processing, pages 137-143, Beijing, China. Association for Computational Linguistics. +Yiming Cui, Wanxiang Che, Ting Liu, Bing Qin, Shijin Wang, and Guoping Hu. 2020. Revisiting pretrained models for Chinese natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: Findings, pages 657-668, Online. Association for Computational Linguistics. + +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171-4186, Minneapolis, Minnesota. Association for Computational Linguistics. +Fei Dong and Yue Zhang. 2016. Automatic features for essay scoring – an empirical study. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 1072–1077, Austin, Texas. Association for Computational Linguistics. +Jianfeng Gao, Xiaolong Li, Daniel Micol, Chris Quirk, and Xu Sun. 2010. A large scale ranker-based system for search query spelling correction. In Proceedings of the 23rd International Conference on Computational Linguistics (Coling 2010), pages 358-366, Beijing, China. Coling 2010 Organizing Committee. +Tianyu Gao, Xingcheng Yao, and Danqi Chen. 2021. Simcse: Simple contrastive learning of sentence embeddings. arXiv preprint arXiv:2104.08821. +Zhao Guo, Yuan Ni, Keqiang Wang, Wei Zhu, and Guotong Xie. 2021. Global attention decoder for Chinese spelling error correction. In *Findings of the Association for Computational Linguistics: ACLIJCNLP* 2021, pages 1419-1428, Online. Association for Computational Linguistics. +R. Hadsell, S. Chopra, and Y. LeCun. 2006. Dimensionality reduction by learning an invariant mapping. In 2006 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR'06), volume 2, pages 1735-1742. +Yuzhong Hong, Xianguo Yu, Neng He, Nan Liu, and Junhui Liu. 2019. FASPell: A fast, adaptable, simple, powerful Chinese spell checker based on DAE-decoder paradigm. In Proceedings of the 5th Workshop on Noisy User-generated Text (W-NUT 2019), pages 160-169, Hong Kong, China. Association for Computational Linguistics. +Li Huang, Junjie Li, Weiwei Jiang, Zhiyu Zhang, Minchuan Chen, Shaojun Wang, and Jing Xiao. 2021. PHMOSpell: Phonological and morphological knowledge guided Chinese spelling check. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 5958-5967, Online. Association for Computational Linguistics. +Dan Iter, Kelvin Guu, Larry Lansing, and Dan Jurafsky. 2020. Pretraining with contrastive sentence objectives improves discourse performance of language models. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, + +pages 4859-4870, Online. Association for Computational Linguistics. +Prannay Khosla, Piotr Teterwak, Chen Wang, Aaron Sarna, Yonglong Tian, Phillip Isola, Aaron Maschinot, Ce Liu, and Dilip Krishnan. 2020. Supervised contrastive learning. arXiv preprint arXiv:2004.11362. +Thomas N. Kipf and Max Welling. 2017. Semi-supervised classification with graph convolutional networks. In International Conference on Learning Representations (ICLR). +Chong Li, Cenyuan Zhang, Xiaqing Zheng, and Xuanjing Huang. 2021. Exploration and exploitation: Two ways to improve Chinese spelling correction models. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 2: Short Papers), pages 441-446, Online. Association for Computational Linguistics. +Chao-Lin Liu, Min-Hua Lai, Yi-Hsuan Chuang, and Chia-Ying Lee. 2010. Visually and phonologically similar characters in incorrect simplified Chinese words. In *Coling* 2010: Posters, pages 739-747, Beijing, China. Coling 2010 Organizing Committee. +Shulin Liu, Tao Yang, Tianchi Yue, Feng Zhang, and Di Wang. 2021. PLOME: Pre-training with misspelled knowledge for Chinese spelling correction. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 2991-3000, Online. Association for Computational Linguistics. +Ilya Loshchilov and Frank Hutter. 2018. Fixing weight decay regularization in adam. +Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. 2019. Pytorch: An imperative style, high-performance deep learning library. Advances in neural information processing systems, 32:8026-8037. +Yuen-Hsien Tseng, Lung-Hao Lee, Li-Ping Chang, and Hsin-Hsi Chen. 2015. Introduction to SIGHAN 2015 bake-off for Chinese spelling check. In Proceedings of the Eighth SIGHAN Workshop on Chinese Language Processing, pages 32-37, Beijing, China. Association for Computational Linguistics. +Baoxin Wang, Wanxiang Che, Dayong Wu, Shijin Wang, Guoping Hu, and Ting Liu. 2021a. Dynamic connected networks for Chinese spelling check. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, pages 2437-2446, Online. Association for Computational Linguistics. + +Dingmin Wang, Yan Song, Jing Li, Jialong Han, and Haisong Zhang. 2018. A hybrid approach to automatic corpus generation for Chinese spelling check. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 2517-2527, Brussels, Belgium. Association for Computational Linguistics. +Dingmin Wang, Yi Tay, and Li Zhong. 2019. Confusionset-guided pointer networks for Chinese spelling check. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 5780-5785, Florence, Italy. Association for Computational Linguistics. +Dong Wang, Ning Ding, Piji Li, and Haitao Zheng. 2021b. CLINE: Contrastive learning with semantic negative examples for natural language understanding. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 2332-2342, Online. Association for Computational Linguistics. +Yih-Ru Wang and Yuan-Fu Liao. 2015. Word vector/conditional random field-based Chinese spelling error detection for SIGHAN-2015 evaluation. In Proceedings of the Eighth SIGHAN Workshop on Chinese Language Processing, pages 46-49, Beijing, China. Association for Computational Linguistics. +Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Remi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander Rush. 2020. Transformers: State-of-the-art natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 38-45, Online. Association for Computational Linguistics. +Jian-cheng Wu, Hsun-wen Chiu, and Jason S. Chang, 2013a. Integrating dictionary and web n-grams for Chinese spell checking. In International Journal of Computational Linguistics & Chinese Language Processing, Volume 18, Number 4, December 2013-Special Issue on Selected Papers from ROCLING XXV. +Shih-Hung Wu, Chao-Lin Liu, and Lung-Hao Lee. 2013b. Chinese spelling check evaluation at SIGHAN bake-off 2013. In Proceedings of the Seventh SIGHAN Workshop on Chinese Language Processing, pages 35-42, Nagoya, Japan. Asian Federation of Natural Language Processing. +Heng-Da Xu, Zhongli Li, Qingyu Zhou, Chao Li, Zizhen Wang, Yunbo Cao, Heyan Huang, and XianLing Mao. 2021. Read, listen, and see: Leveraging + +multimodal information helps Chinese spell checking. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, pages 716-728, Online. Association for Computational Linguistics. +Liang-Chih Yu, Lung-Hao Lee, Yuen-Hsien Tseng, and Hsin-Hsi Chen. 2014. Overview of SIGHAN 2014 bake-off for Chinese spelling check. In Proceedings of The Third CIPS-SIGHAN Joint Conference on Chinese Language Processing, pages 126-132, Wuhan, China. Association for Computational Linguistics. +Ruiqing Zhang, Chao Pang, Chuanqiang Zhang, Shuohuan Wang, Zhongjun He, Yu Sun, Hua Wu, and Haifeng Wang. 2021. Correcting Chinese spelling errors with phonetic pre-training. In *Findings of the Association for Computational Linguistics: ACLIJCNLP* 2021, pages 2250-2261, Online. Association for Computational Linguistics. +Shaohua Zhang, Haoran Huang, Jicong Liu, and Hang Li. 2020. Spelling error correction with soft-masked BERT. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 882-890, Online. Association for Computational Linguistics. +Shuiyuan Zhang, Jinhua Xiong, Jianpeng Hou, Qiao Zhang, and Xueqi Cheng. 2015. HANSpeller++: A unified framework for Chinese spelling correction. In Proceedings of the Eighth SIGHAN Workshop on Chinese Language Processing, pages 38-45, Beijing, China. Association for Computational Linguistics. + +# A Appendices + +# A.1 Pseudo-code of ECOPO + +Figure 6 shows the Pytorch-style pseudo-code for the ECOPO. As described in Section 3, our proposed ECOPO consists of two stages, namely Negative Samples Selection and Contrastive Probability Optimization. It is worthy noting that in the pseudocode, we only show the process of calculating the loss of one training sample. + +```python +1 # vocab_prob : the prediction probability for all characters in vocabulary +2 # pos_idx : the index of positive sample (golden character) in vocabulary +3 # K : the selected negative samples amount +4 +5 # Negative Samples Selection +6 pos_prob = vocab_prob[pos_idx] +7 neg_prob = torch.topk(vocab_prob, K)[0] +8 neg IDC = torch.topk(vocab_prob, K)[1].tolist() +9 +10 # Contrastive Probability Optimization Objective +11 loss_list = [] +12 for x in range(θ, K): +13 if neg IDC[x] != pos IDC: +14 loss_list.append(pos_prob - neg_prob[x]) +15 loss = -torch.stack(loss_list).mean() +``` + +Figure 6: Pseudo-code of our practical implementation. + +# A.2 Datasets Details + +Table 4 shows the detailed statistics of our used datasets. We report the number of sentences in the datasets (#Sent), the average sentence length of the datasets (Avg.Length), and the number of misspellings the datasets contains (#Errors). + +
Training Data#SentAvg. Length#Errors
SIGHAN1370041.8343
SIGHAN143,43749.65,122
SIGHAN152,33831.33,037
Wang271K271,32942.6381,962
Total277,80442.6390464
Test Data#SentAvg. Length#Errors
SIGHAN131,00074.31,224
SIGHAN141,06250.0771
SIGHAN151,10030.6703
Total3,16250.92,698
+ +Table 4: Statistics of the datasets that we use in experiments. All the training data are merged to train the models in our experiments. The test sets are used separately to evaluate performance. + +# A.3 Implementation Details + +All the source code of our experiments is implemented using Pytorch (Paszke et al., 2019) based on the Huggingface's implementation of Transformer library3 (Wolf et al., 2020). The architecture of + +the BERT encoder we use in the related models is same as the $BERT_{BASE}$ model, which has 12 transformers layers with 12 attention heads and its hidden state size is 768. We initialize the BERT encoder with the weights of Chinese BERT-wwm model (Cui et al., 2020). We train ECOPO with the AdamW (Loshchilov and Hutter, 2018) optimizer for 10 epochs. The training batch size $N$ is set to 64 and the evaluation batch size is set to 50. The negative samples size $K$ is set to 5 by default. The weighting factors $\lambda_1, \lambda_2$ are both set to 1. In all our experiments, when $\lambda_1$ is equal to 1, it means that we use a fine-tuned BERT on the training set as the initialization model to continue the corresponding training process under different loss functions. The initial learning rate is set to 5e-5. We set the maximum sentence length to 128. The model is trained with learning rate warming up and linear decay. + +It is worth noting that the annotation quality of SIGHAN13 test dataset is relatively poor. As we have observed and mentioned in (Cheng et al., 2020; Xu et al., 2021), quite lots of the mixed usage of auxiliary (such as “的”, “地”, and “得”) don’t have correct annotations. Therefore, the evaluation metrics we use may not accurately reflect the real model performance on SIGHAN13. To alleviate this problem, there are two main solutions in previous works. Cheng et al. (2020) propose to continue fine-tuning well-trained models on the SIGHAN13 training dataset before testing, which we think will suffer from the over-fitting problem. Therefore, we follow the post-processing method proposed in (Xu et al., 2021) and don’t consider all the detected and corrected mixed auxiliary. This approach does not compromise the fairness of the evaluation process and can better reflect the model performance. \ No newline at end of file diff --git a/thepastmistakeisthefuturewisdomerrordrivencontrastiveprobabilityoptimizationforchinesespellchecking/images.zip b/thepastmistakeisthefuturewisdomerrordrivencontrastiveprobabilityoptimizationforchinesespellchecking/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..b944bb2007f27f3bb9aa84693257f89e0e16ba2b --- /dev/null +++ b/thepastmistakeisthefuturewisdomerrordrivencontrastiveprobabilityoptimizationforchinesespellchecking/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:be9ff1314c137a5fa77817215b102d244388f418872d258305494142149a23ea +size 584050 diff --git a/thepastmistakeisthefuturewisdomerrordrivencontrastiveprobabilityoptimizationforchinesespellchecking/layout.json b/thepastmistakeisthefuturewisdomerrordrivencontrastiveprobabilityoptimizationforchinesespellchecking/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..83b5a94109cc3483895f319ad4e7b8959937af6d --- /dev/null +++ b/thepastmistakeisthefuturewisdomerrordrivencontrastiveprobabilityoptimizationforchinesespellchecking/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:57473a321dddb288f33abdf387cf321ae87b6395f85586df71b50db68d62aecd +size 345905 diff --git a/thexprivacypreservingtransformerinferencewithhomomorphicencryption/2dc88190-802a-4c76-8af2-778364e52acd_content_list.json b/thexprivacypreservingtransformerinferencewithhomomorphicencryption/2dc88190-802a-4c76-8af2-778364e52acd_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..6f648a131d0c8c2d925b52ac0306f95c7dd6b5a9 --- /dev/null +++ b/thexprivacypreservingtransformerinferencewithhomomorphicencryption/2dc88190-802a-4c76-8af2-778364e52acd_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8166954ef1c142660da44c6070e801c6c866dcedc10fdf04a940b07bf89be9a2 +size 76670 diff --git a/thexprivacypreservingtransformerinferencewithhomomorphicencryption/2dc88190-802a-4c76-8af2-778364e52acd_model.json b/thexprivacypreservingtransformerinferencewithhomomorphicencryption/2dc88190-802a-4c76-8af2-778364e52acd_model.json new file mode 100644 index 0000000000000000000000000000000000000000..5e94391a3d0c1433aa5dd94997a88944dcf5ab70 --- /dev/null +++ b/thexprivacypreservingtransformerinferencewithhomomorphicencryption/2dc88190-802a-4c76-8af2-778364e52acd_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8bf46c3621b264c851fbe2282afbdc86fe6f996f7f71a233fff654004f54e6f6 +size 98485 diff --git a/thexprivacypreservingtransformerinferencewithhomomorphicencryption/2dc88190-802a-4c76-8af2-778364e52acd_origin.pdf b/thexprivacypreservingtransformerinferencewithhomomorphicencryption/2dc88190-802a-4c76-8af2-778364e52acd_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..2fd69b506e187fdea14188d7a7cc3e1feea6d048 --- /dev/null +++ b/thexprivacypreservingtransformerinferencewithhomomorphicencryption/2dc88190-802a-4c76-8af2-778364e52acd_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:21664309ab0f860e9ed40ba6ed2c41c6c955bc42def421923297ff05b99c651e +size 1294429 diff --git a/thexprivacypreservingtransformerinferencewithhomomorphicencryption/full.md b/thexprivacypreservingtransformerinferencewithhomomorphicencryption/full.md new file mode 100644 index 0000000000000000000000000000000000000000..168c25f8497cb7a92907c94e2d5a011089c7204c --- /dev/null +++ b/thexprivacypreservingtransformerinferencewithhomomorphicencryption/full.md @@ -0,0 +1,363 @@ +# THE-X: Privacy-Preserving Transformer Inference with Homomorphic Encryption + +Tianyu Chen\*, Hangbo Bao, Shaohan Huang, Li Dong, Binxing Jiao, Daxin Jiang, Haoyi Zhou, Jianxin Li, Furu Wei + +BDBC, Beihang University, China + +SKLSDE, Beihang University, China + +Microsoft Research NLP Group, Microsoft STCA + +{tianyuc, zhouhy, lijx} @ buaa.edu.cn + +{t-habao,shaohanh, lidong1, binxjia, djiang, fuwei} @microsoft.com + +# Abstract + +As more and more pre-trained language models adopt on-cloud deployment, the privacy issues grow quickly, mainly for the exposure of plain-text user data (e.g., search history, medical record, bank account). Privacy-preserving inference of transformer models is on the demand of cloud service users. To protect privacy, it is an attractive choice to compute only with ciphertext in homomorphic encryption (HE). However, enabling pre-trained models inference on ciphertext data is difficult due to the complex computations in transformer blocks, which are not supported by current HE tools yet. In this work, we introduce THE-X, an approximation approach for transformers, which enables privacy-preserving inference of pre-trained models developed by popular frameworks. THE-X proposes a workflow to deal with complex computation in transformer networks, including all the non-polynomial functions like GELU, softmax, and LayerNorm. Experiments reveal our proposed THE-X can enable transformer inference on encrypted data for different downstream tasks, all with negligible performance drop but enjoying the theory-guaranteed privacy-preserving advantage. + +# 1 Introduction + +Accompanying the revolution of pre-trained models in many NLP applications, such as sentiment analysis (Xu et al., 2019a), question answering (Yang et al., 2019b), information retrieval (Yang et al., 2019c), and text generation (Raffel et al., 2020), many related technologies have been deployed on the cloud to process user data from personal customers, small businesses, and large enterprises by industrial service providers. However, the convenience of the on-cloud pretraining technology also comes with a series of + +![](images/2d8ec54f4555d010801195719335eb5b6463b250866f9d8cbc14c96fa63271f0.jpg) +Figure 1: An overview of our $THE-X$ . The transformer-based model could inference on encrypted data with our $THE-X$ , enabling theory-guaranteed privacy protection for users. + +privacy challenges due to the sensitive nature of user data. For example, the input text or even text vector representations in user requests can leak private information, which may cause the specific user to be identified (Schwartz and Solove, 2011; Zhu and Han, 2020). This lack of privacy guarantees may impede privacy-conscious users from releasing their data to service providers. Thus, service providers may suffer from the deficiency of evolving models with user data. Besides, unintended data disclosure and other privacy breaches may result in litigation, fines, and reputation damages for service providers. These concerns spark our proposal of THE-X, to enable privacy-preserving inference of transformer. + +Specifically, we identify two challenges for the privacy-preserving inference of pre-trained models. The first challenge is how to protect users' plain text data from access by third-party service providers. (e.g., the clinic record or shopping history). Prior work has applied Differential Privacy (DP) (Dwork et al., 2006) and its variants to address similar privatization issues - originally for statistical databases and more recently for DL (Abadi et al., 2016) and NLP (Qu et al., 2021; Basu et al., 2021b; Fernandes et al., 2019; Lyu et al., 2020; Basu et al., 2021a). However, this solution may suffer from eavesdropping attackers. A handful of research (Zhu and Han, 2020; Zhao et al., 2020) + +demonstrated it possible to recover raw data from gradient leakage. Also, privacy protection could never be theory-guaranteed. The second challenge is the performance concern, recent works like TextHide (Huang et al., 2020) and FedNLP (Lin et al., 2021) leverages the federated learning (Yang et al., 2019a) to train model on encrypted data, at cost of considerable performance dropping. Focusing on the privacy of training data, they have not fully explored privacy-preserving inference. + +To solve the concerns above, we depict one practice of privacy-preserving inference in Figure 1, where a fine-tuned language model could be converted into the cloud service mode with $\text{THE-X}$ , and process users' data with its eyes blind. During inference, the content of the user query is anonymous to the transformer model. The results of computation are also ciphertext, which only can be decrypted by the user's private key. + +In addition, we need a theory-guaranteed encryption solution like the homomorphic encryption (HE) (Gentry, 2009) to convince both service providers and users of the privacy security in production scenarios. The semantic security of HE is guaranteed by lattice-based cryptography, and the HE computation results on ciphertext could be decrypted to the same results in plaintext, preventing performance reduction cost. The basic idea of homomorphic encryption is to perform computations on encrypted data without first decrypting it, which could fully ensure privacy in cloud-serving scenarios. It allows user data to be encrypted and out-sourced to commercial cloud environments for processing. + +However, due to the complex operations (e.g., GELU activation) in transformer-based models, the popular partially homomorphic encryption solution, which only supports addition or multiplication, can not easily be adapted into scenarios of pre-trained models. Based on HE transformer backend (Boemer et al., 2019b,a, 2020), we designed a series of approximation components to fulfill the whole inference pipeline of the mainstream transformer backbone. We evaluate THE-X for BERTiny on the GLUE benchmark (Wang et al., 2019) and the CONLL2003 task (Tjong Kim Sang and De Meulder, 2003). Our results show that THE-X can achieve the privacy-preserving inference with the averaged performance reduction of only $1.49\%$ . + +Our contributions include: + +- We are the first work to explore the privacy + +preserving transformer inference with HE. + +- We design a practical and effective approximation workflow for converting transformer-based models into a function that consists of fully HE operations. +- A thorough set of experiments confirms the negligible performance reduction with our proposed THE-X approximation. + +# 2 Background + +# 2.1 Security and Privacy Concern of Pre-trained Models + +Pre-trained models like BERT (Devlin et al., 2019) and GPT-3 (Brown et al., 2020) rely heavily on the use of plain text data to get human-like performance. Despite the remarkable achievements of pre-trained models, these state-of-the-art models can not directly answer some sensitive use cases, including the medical record (Christoph et al., 2015), search history (Shen et al., 2007) and other personally identifiable information (PII). + +To avoid the direct computation on plain-text data, recent works like TextHide (Huang et al., 2020) and DP-finetuning (Kerrigan et al., 2020) introduce the classical federated learning and differential privacy (DP) to protect the sensitive data. However, TextHide (Huang et al., 2020) can only be applied to sentence-level tasks. Due to the mix-up operation, TextHide fails to model token-level tasks like named entity recognition or semantic role labelling. DP-finetuning would greatly sacrifice the performance of fine-tuned model by $20\%$ perplexity for a generation model like GPT-2. + +# 2.2 Practical Homomorphic Encryption + +The classic definition of homomorphic encryption is a form of encryption that permits users to perform computations on its encrypted data without first decrypting it. These computations results are retained in an encrypted form, which could be decrypted into identical output produced by the same computations on the unencrypted data. Let $F$ be a function or the entire pre-trained model, $E$ as an encryption function, $D$ as a decryption function. Then for any allowed plain text input $x$ , we have: + +$$ +F (x) = D (g (E (x)), \tag {1} +$$ + +where $g$ is a constructed function to play the same role of function $F$ , except on encrypted data. Figure 1 shows how a user performs inference using + +a cloud-deployed pre-trained model which is not trusted. First, the pre-trained model receives a ciphertext encrypted by the user private key and performs inference function $g$ on the ciphertext. Then, the server will send an encrypted result to the user, which can only be decrypted by the user key. At no point does the cloud service provider gain access to the plain text. + +The Intel HE transformer for nGraph (Boemer et al., 2019b,a) is a Homomorphic Encryption backend to the deep learning models. Currently, it supports the CKKS (Cheon et al., 2017) encryption scheme, implemented by the Simple Encrypted Arithmetic Library (SEAL) (SEAL) from Microsoft Research. It is a research tool to demonstrate the feasibility of HE on deep learning. + +# 2.3 Challenges of Transformer Inference with HE + +Some HE schemes only support a single algebraic operation, such as addition or multiplication. These are known as "partially homomorphic" schemes (PHE). Other schemes, called "fully homomorphic"(FHE), support two such as addition and multiplication. Note that composing addition and multiplication suffices to construct polynomial functions, and hence polynomial approximations to non-polynomial functions such as GELU (Hendrycks and Gimpel, 2016) or Layer-Norm (Xu et al., 2019b). Notably, this limitation prevents the exact computation of any comparison-based operations such as Max, Min, as well as common functions such as exponential or sigmoid. Finally, "levelled homomorphic" schemes (LHE) support addition and multiplication, only up to a fixed computational depth. + +# 3 THE-X: Formal Description + +There are two core ideas in $THE - X$ . The first one is to incorporate the user device into the HE inference, and the second is using "simplified computation" to approximate the non-polynomial functions. + +In the following, we will describe how to enable homomorphic encryption of transformer-based models with THE-X. + +# 3.1 Approximation Workflow + +First, we present the approximation workflow of THE-X, which consists of two stages: Standard Finetuning and LN Distill as depicted in Figure 2. Given a pre-trained model $\mathcal{M}$ and corresponding + +Algorithm 1: Approximation Workflow +Data: labeled task data $\mathcal{D}$ Input: pre-trained Transformer model $\mathcal{M}$ softmax estimation model $s$ +1 $\widehat{\mathcal{M}}\gets \mathcal{M}\odot (\mathcal{S},ReLU)$ // replace GELU and Softmax +2 while not done do +3 sample batches $(x_{i},y_{i})$ from $\mathcal{D}$ +4 let $(x_{i},y_{i})$ optimize $\widehat{\mathcal{M}}$ with $s$ frozen. +end +5 $\tilde{\mathcal{M}}\gets \widehat{\mathcal{M}}\oplus \tilde{\mathcal{N}}$ // add the layernorm approximation +6 while not done do +7 sample batches $(x_{i},y_{i})$ from $\mathcal{D}$ +8 freeze the parameters of $\tilde{\mathcal{M}}$ except $\tilde{\mathcal{N}}$ +9 compute $k$ -th layernorm output $O_k,\tilde{O}_k$ +0 compute loss $\ell_{k} = \mathrm{MSELoss}(O_{k},\tilde{O}_{k})$ +1 update $\tilde{\mathcal{N}}$ with loss $\mathcal{L} = \sum_{k}\ell_{k}$ +end +2 $\bar{\mathcal{M}}\gets \tilde{\mathcal{M}}\ominus \mathcal{N}$ // discard the origin layernorm return $\bar{\mathcal{M}}$ + +downstream data, we aim to produce a fully HE supported $\bar{\mathcal{M}}$ which is fine-tuned and ready for deployment. + +The two-stage optimization of algorithm 1 aims to find the best approximation checkpoint. For computation efficiency, pre-trained models can also be fine-tuned together with the layernorm approximation, and it needs only a single optimization loop. We will discuss the schedule of the different approximation workflow in Sec 4.6. There are three major non-polynomial functions in the transformer block, where we will study in detail. + +# 3.1.1 Gaussion Error Linear Units (GLEU) + +With a computation of Gaussian error, Gaussian Error Linear Units (GLEUs) (Hendrycks and Gimpel, 2016) is not suitable to serve as an active function in HE state. The Gaussian kernel includes unsupported functions like exponential. While in the implementation of the transformer, GELU is defined as a fast approximated version, where the tanh function is still non-polynomial, unsupported by HE. + +$$ +G (x) = 0. 5 x \left(1 + \tanh \left[ \sqrt {2 / \pi} \left(x + 0. 0 4 4 7 1 5 x ^ {3}\right) \right]\right). \tag {2} +$$ + +![](images/1699000f2c21ba2243169b49a01d455ce96f6d7e41229cede999717df3105a0b.jpg) +Figure 2: The Approximation Workflow of $THE-X$ . To replace the non-polynomial operations, we split the fine-tuning stage into several subphases. Given a pre-trained checkpoint, we drop the pooler of the pre-trained model and replace softmax and GeLU. Afterward, we follow the standard fine-tuning for classification or regression tasks. We add LayerNorm approximation into the fine-tuned model and distill knowledge from original LN layers. After dropping the original LN, we convert the model into fully HE-supported ops with the HE transformer. + +![](images/edd05c9b868873c14ca45bdfc78fe6dc9ba85c3a56ca1d432ac0a6f5926890bc.jpg) +Figure 3: The activation results of GELU compared with ReLU. With an input around zero, the activation results are very close. With a larger or smaller input value, the activation results tend to converge. + +We illustrate the numerical comparison between GELU and RELU in Figure 3, where the outputs of GELU are very close to RELU. Hence, we propose to replace the GELU layer in the model with a ReLU activation function. Despite the Max function in ReLU, other computations are well supported by HE. To enable the computation of Max, we implement the first key idea, incorporating the user device into the inference. The server will convey ciphertext input to the user for local Max computation. Once received the connection, a user device decrypts the ciphertext input and calls the local Max function to get the results and return re-encrypted results to the server. Despite the communication cost, no plaintext is leaked during the TLS connection and semantic security is guaranteed. + +# 3.1.2 Softmax + +The second non-polynomial function is softmax, which includes the exponential and division computation. + +$$ +\operatorname {S o f t m a x} \left(x _ {i}\right) = \frac {\exp \left(x _ {i}\right)}{\sum_ {j} \exp \left(x _ {j}\right)}. \tag {3} +$$ + +The first thought to approximate softmax is to find alternatives of softmax operation in transformer, which include Taylor series approximation (Vincent et al., 2015), softmax-free linear attention (Lu et al., 2021). However, both of them have some limitations. The Taylor series approximation can only approximate the exponential operation. Softmax-free linear attention utilizes newton-inverse to approximate division, but the approximation error is unbounded in full-scale attention settings. + +For these considerations, we have no choice but to design an estimation network with addition and multiplication. + +$$ +S \left(x _ {i}\right) = x _ {i} * T \left(\sum_ {j} R e L U \left(\left(\left(x _ {j}\right) / 2 + 1\right) ^ {3}\right)\right). \tag {4} +$$ + +Equation 4 is the formal description of our softmax estimation network. Same as the approximation of GELU, ReLU operation here is realized by communication with the client. Instead of a division operation, we approximate reciprocal operation with a three-layer linear neural network denoted as $T$ . + +To get a better estimation of softmax, we randomly generate input tensors whose values are between $[-3, 3]$ and use their softmax scores as MSE targets. Then we optimize the $T$ for $100k$ steps with a learning rate of $1e-3$ until the MSE loss drop down to $1e-6$ . + +An under-explored problem here is the Infinite value of Masked Attention, where the input of softmax is always the masked attention scores. To prevent the attention of masked tokens, the origin transformer model fills the masked attention scores with negative infinity before softmax. When fed with an infinite value, the softmax estimation model + +may face numerical disaster. We will discuss this phenomenon and the corresponding solution in Sec 4.5. + +# 3.1.3 LayerNorm + +Recall that the layer normalization (Ba et al., 2016) in transformer is implemented over a mini-batch of inputs, which could be formulated as: + +$$ +y = \frac {x - E [ x ]}{\sqrt {\operatorname {V a r} [ x ] + \epsilon}} * \gamma + \beta . \tag {5} +$$ + +The mean and standard deviation are calculated over division operations where the approximation is needed. $\gamma$ and $\beta$ are learnable affine transform parameters. To avoid the introduction of new parameters, we keep the learnable parameters while leaving the mean and standard deviation achieved by regression. + +$$ +\hat {y} = x \circ \gamma + \beta . \tag {6} +$$ + +The new parameter $\gamma$ predicts the value of standard deviation by regression from origin $\hat{\gamma}$ . We find the simple linear replacement is enough for values with a small scale of bias. Here $\gamma, \beta \in \mathbb{R}$ and $\circ$ denotes the Hadamard product. + +The layer normalization will be applied in each multi-head attention block and after the output dense layer. So the approximation error tends to accumulate when the transformer stacks with too many layers. + +We treat the layernorm approximation as an individual stage in Figure 1 as LN-Distill to learn from origin LN layers. A challenge here is the Attention Overflow, where the input attention score before normalization may have an unbounded scale, leading to numerical problems. We will discuss the detail of Attention Overflow in Sec 4.5. + +# 3.1.4 Other Practical Replacement + +After the approximation workflow, a fine-tuned model consists of only addition and multiplication operations, which is fully compatible with homomorphic encryption. We power the model by HE transformer backend. Since the HE transformer backend could only work for TensorFlow checkpoint, any pre-trained transformers inherited from PyTorch building version need to be converted into TensorFlow format first. There are some other details worth mentioning here. + +- For the softmax $\left(\frac{QK^T}{\sqrt{d_k}}\right)V$ operation in attention score computation, we absorb the value + +of $\frac{1}{\sqrt{d_k}}$ into the weights of query projection layer. + +- We use a fully kernel convolution layer instead of linear projection due to the lack of supported dense operation. +- All matrix multiplication will be converted into the element-wise style. +- We drop the pooled layer for the unsupported operation of tanh. + +# 3.2 Privacy-preserving Inference + +In this section, we describe the behavior of HE models during privacy-preserving inference. Note that inference is completed by the joint effort of the server and the user device. + +Algorithm 2: Inference with HE +```txt +Input: user plain text query $\mathcal{P}_q$ private key $\kappa$ generated under server protocol, encrypted server model $\mathcal{M}$ +``` + +1 client computes embeddings: $\mathcal{E}_q\gets \mathcal{P}_q$ +2 client encrypts query embeddings: + +$$ +\mathcal {C} _ {q} \leftarrow E n c r y p t (\mathcal {E} _ {q}, \mathcal {K}). +$$ + +3 server forwards the model: $\mathcal{C}_i = \mathcal{M}(\mathcal{C}_q)$ +4 client handles activation: $\mathcal{C}_a = ReLU(\mathcal{C}_i)$ +5 server continues forwarding: $\mathcal{C}_o = \mathcal{M}(\mathcal{C}_a)$ +6 client decrypts results: + +$$ +\mathcal {P} _ {o} = D e c r y p t (\mathcal {C} _ {o}, \mathcal {K}). +$$ + +In Algorithm 2, notably absent is the support of ReLU operations, where the server exchanges the activation results with the client. However, all the communication between client and server is in ciphertext, ensuring the privacy of user queries and may prevent eavesdropping attackers from recovering private text data. + +# 4 Experiments + +In this section, we design both sequence-level and token-level tasks to evaluate the approximation performance of our THE- $X$ solution. We also discuss several identified factors which greatly affect approximation workflow. + +# 4.1 Evaluation Tasks + +GLUE (Wang et al., 2019), the General Language Understanding Evaluation benchmark, is a collection of tools for evaluating the performance of models across a diverse set of existing NLU tasks. + +Table 1: Performance on the GLUE1 tasks for both baseline (standard finetuning) and $\text{THE-X}$ with BERT-tiny, measured on the development sets. We report the best results by hyper-parameter search. $|\mathcal{D}|$ denotes the number of training examples. $\text{THE-X}$ only suffers average utility performance loss: $< 1.5\%$ in most tasks. 'P/S corr.' is Pearson/Spearman correlation and 'm/mm' denotes the accuracy scores on matched/mismatched set. + +
Tasks|D|TypeMetricsBaselineReLUReLU-SReLU-S-LHEPerf ↓
SST-267kSentimentAcc.82.4582.4082.3482.1182.110.34
MRPC3.7kParaphraseF1/Acc.81.57/70.1081.69/70.3480.81/69.8579.93/68.8779.94/68.871.63/1.23
STS-B7kSimilarityP/S corr.72.83/73.6672.89/73.0374.19/74.2768.38/70.9668.39/70.974.44/2.69
QQP364kParaphraseF180.28/84.0379.55/82.8979.38/83.3678.28/83.7578.33/83.631.95/0.40
MNLI393kNLIm/mm69.75/70.7569.51/70.6068.61/69.1368.59/69.4168.47/69.081.28/1.67
QNLI108kNLIACC.78.3878.3578.3378.3378.200.18
RTE2.5kNLIACC.58.5658.3258.2758.1258.120.44
Average Perf ↓0.000.250.341.421.481.48
+ +Table 2: Performance on the CONLL2003 task for both baseline and $THE-X$ with BERT-tiny, measured on the development sets. We find that the replacement with ReLU has a slight effect on performance and even gets a better F1 score by 0.12 than original GELU activation. + +
MetricsPrecisionRecallF1Perf ↓
Raw82.3484.8583.570
ReLU82.2985.1383.69-0.12
ReLU-S82.0884.7383.380.19
ReLU-S-L79.6583.7981.671.90
HE79.6583.7981.671.90
+ +We choose a subset of GLUE1 tasks, which include: MRPC (Dolan and Brockett, 2005), SST-2 (Socher et al., 2013), QQP2, STS-B (Cer et al., 2017), MNLI (Williams et al., 2018), QNLI (Rajpurkar et al., 2016), and RTE (Dagan et al., 2005; Haim et al., 2006; Giampiccolo et al., 2007; Bentivogli et al., 2009). + +Following previous work (Devlin et al., 2019; Turc et al., 2019), we exclude the WNLI task from the GLUE benchmark. We also use the famous CoNLL-2003 (Tjong Kim Sang and De Meulder, 2003) named entity recognition task as our additional token-level evaluation. In conclusion, we include the most varieties of NLU tasks, covering both sequence-level and sentence-level tasks, in both regression and classification format. + +# 4.2 Experiment Settings + +For computation efficiency and energy-saving consideration, we use the released BERT-tiny (Turc + +et al., 2019) as our demo model, which is a standard transformer-based language model with only 2 layers and a hidden size of 128. We provide four settings to evaluate different parts of our approximation components. + +- **Baseline.** In this setting, we make no replacement or approximation. We use the raw pretrained checkpoint to fine-tune on downstream tasks. +- ReLU. We fine-tune the pre-trained model with all GELU activation replaced with ReLU. +- ReLU-S. In addition to ReLU, we fine-tune the model with the softmax operation replaced by the softmax estimation model. +- ReLU-S-L. We implement full approximation including a layer normalization replacement. +- HE. We convert the fine-tuned checkpoint with HE-transformer and power the inference with SEAL backend. + +Implementation. To reduce the variance of results under different settings, we choose hyperparameters from a fixed set during approximation fine-tuning and HE inference runtime. + +- For fine-tuning the approximation components, we choose a batch size from $\{4, 8, 16, 32, 128\}$ and a learning rate from $1\mathrm{e} - 4$ , $3\mathrm{e} - 4$ , $3\mathrm{e} - 5$ , $5\mathrm{e} - 5$ as mentioned in the initial bert code (Turc et al., 2019). We use an Adam optimizer with weight decay chosen from $\{0.05, 0.1, 0.2, 0.4, 0.5\}$ +- For HE evaluation, we use the HE-transformer backend, where two parameters are recommended searching by Intel, the poly modules + +and coeff-modules. We choose the poly modules degree from {1024, 2048, 4096, 8192, 16384} and choose the coeff-modules from {20, 30, 60}. + +# 4.3 Approximation Results + +Table 1 shows the results of the baseline and $THE-X$ on the GLUE benchmark. The averaged performance reduction of $THE-X$ is $1.48\%$ when compared to the baseline model. We observe the most performance reduction comes from the approximation of layernorm, which incurs a reduction of $1.08\%$ . The softmax estimation model contributes the least performance drop among the approximation components, for only $0.09\%$ on average, indicating the softmax function could be well imitated by neural networks. We also find the average performance reduction of HE is quite negligible, where the slight drop may be due to the sequence truncation. + +The results of $\text{THE-X}$ on token-level NER task are reported in Table 2. The replacement of GELU with ReLU even improves the performance of the F1 score. We assume the slight improvement may come from unexpected bias. However, the layer-norm approximation incurs the most performance reduction. We assume token-level tasks need a more detailed pattern in attention score. After all, $\text{THE-X}$ still works well in the token-level task with a merely F1 reduction of $1.9\%$ . + +Across different types of tasks, we find our THE-X yields the best performance on the classification tasks, including paraphrase, sentiment and NLI. Among the classification tasks, the performance of QNLI drops the least, for only $0.18\%$ . We also find the performance drops most on the regression tasks, such as the similarity task STS-B, for $4.44\%$ Pearson correlation and $2.69\%$ spearman correlation. We assume the regression task needs a higher numerical precision than the classification task. + +# 4.4 Negative Infinity + +Recall in Equation 4, we replace softmax with a neural estimation model. To prevent the attention of masked tokens, the origin transformer model fills the masked attention scores with negative infinity before softmax, where the numerical disaster occurs in our approximation method. In Figure 4, to solve this problem, we give an empirical study of how "negative" the masked attention scores should be. Despite the indistinguishable F1 score change of raw model fine-tune with different + +![](images/aecc9f842be0bed2bdbbaed2c2c8ac58e51b0f562312c5a59cf1b35c67c655fb.jpg) +Figure 4: Performance on CONLL2003 task with different mask values. We find the "Negative Infinity" value of the 0 mask greatly reduces approximation performance. In THE-X using a mask value in [-3, -5] might be a default choice. + +attention mask values, the approximation method is extremely sensitive to the numerical changes. We assume the softmax estimation model fails to deal with large input values and leads to a credible performance drop. However, when the value of the attention mask becomes too small, it serves as a bias to attention scores, which also leads to a certain performance drop. We recommend using a moderate mask value between -2 and -5. + +# 4.5 Attention Overflow + +Another challenge of $\text{THE-}X$ is the attention score input of layer normalization. In most cases, the scale of multi-head attention output is very dense around $[-1, 1]$ . However, before normalization, we also observe the attention scores are scarily sparse, with some extreme values reaching $1e4$ , which is difficult for our LN-distill stage. To prevent the overflow attention scores, we use the weight decay of Adam optimizer as regularization. + +In Figure 5, we present the attention overflow phenomenon across different tasks. Without any regularization, our approximation method yields uncontrolled attention scores, leading to poor performance. As the weight decay increases, the attention scores tend to converge and benefit better approximation results. We also observe that the larger weight decay may harm the performance on NLI tasks, where the regularization could be seen as trade-off between better approximation results and higher performance upper bound. For the NER task, larger weight decay may even benefit the performance and also boost our approximation method. + +![](images/18e7da68004a435d1db18a69f763e12a24389dfd3fb88524b15f127d1488939b.jpg) + +![](images/098a8ef7b0f20186bba1d4c6c1e2613e7882f09ea7de0ecbf1f749912d90b1ae.jpg) + +![](images/1592038a7de5e5a5abf4864a46fc51930549d0c07810abf7007d7ce6523a1281.jpg) + +![](images/fe6e13e91d94cb35f3d03b35ecc9060c373244e124c1d27342d0a165e476cdbd.jpg) + +![](images/73363a2271123f2a10243ac225b621ae0c65dd2bf08f6a5bdef440e3a6564fec.jpg) +Figure 5: Performance on all tasks with different weight decay values, measured on the development sets. Metrics are marked on the y-axis and weight decay values are marked on the x-axis. + +![](images/da6e81ae20453cf667497ca380efa967f0b1d73af28da989c9e11a624a8838d2.jpg) + +![](images/1ab4910669aba856618e48a07f17619040e20ded97becb5ca0fda901a5a77fe7.jpg) + +![](images/cbb755d08495ceff5d650fc09a562205caee35bda0ae52c3141f9dca5fd7fcb0.jpg) + +# 4.6 Schedule of Approximation workflow + +There are still doubts about how to organize the several optimization steps for the best approximation performance. We investigate four schedule plans: + +- Two Stages. Where we freeze the softmax estimation model during standard fine-tuning. We select the best checkpoint to implement the second stage - distill the layer normalization network. +- Joint FT S. We optimize the softmax estimation model during standard fine-tuning and apply the LN-distillation after. +- Joint FT LN. We apply one-pass optimization with the softmax estimation model frozen but update the other parameters including layer normalization network. No further LN-distill will be implemented. +- Joint FT S + LN. A total one-pass optimization with all approximation parameters updated with the model together. + +As illustrated in Figure 6, we observe that finetuning the different approximation components individually (aka. "Two stages") may be a good default to keep the best performance of approximation. For the regression task STS-B, jointly finetuning the softmax estimation model and approximated layernorm even fails to fulfill the approximation pipeline, pulling the performance down to $0.4\%$ . We assume fine-tuning different components may fall into a bi-level optimization problem and + +![](images/8765b71a3e82b39daa73d5f81a3c1afe41b06ab601989063cad1c7d82c4cdb9d.jpg) +Figure 6: Performance on all tasks with different organizations of approximation workflow. Jointly finetuning the softmax estimation model or approximated layernorm leads to a performance drop across all tasks. + +it is hard to achieve satisfying results. In conclusion, the softmax estimation model and the approximated layernorm are both critical components to the performance of THE-X, deserving individual optimization. + +# 5 Conclusions + +We present THE-X, a practical approach to enable pre-trained transformer models to infer under homomorphic encryption. It requires several approximation components to replace the original operations in the transformer model. It imposes a slight burden in terms of performance cost but enjoys the full advantage of homomorphic encryption - the theory-guaranteed user privacy. + +We see this as a first step in combing homomorphic encryption to address emerging privacy issues in pre-trained models. We hope our work motivates further research, including better approximation solutions on different NLP applications. + +# 6 Acknowledgments + +This paper is supported in part by the NSFC through grant No.U20B2053. We also thanks the support from Beijing Advanced Innovation Center for Future Blockchain and Privacy Computing. + +# References + +Martín Abadi, Andy Chu, Ian J. Goodfellow, H. Brendan McMahan, Ilya Mironov, Kunal Talwar, and Li Zhang. 2016. Deep learning with differential privacy. In Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security, Vienna, Austria, October 24-28, 2016, pages 308-318. ACM. +Lei Jimmy Ba, Jamie Ryan Kiros, and Geoffrey E. Hinton. 2016. Layer normalization. CoRR, abs/1607.06450. +Priyam Basu, Tiasa Singha Roy, Rakshit Naidu, and Zumrut Muftuoglu. 2021a. Privacy enabled financial text classification using differential privacy and federated learning. In Proceedings of the Third Workshop on Economics and Natural Language Processing, pages 50-55, Punta Cana, Dominican Republic. Association for Computational Linguistics. +Priyam Basu, Tiasa Singha Roy, Rakshit Naidu, Zümrüt Müftüoglu, Sahib Singh, and Fatemehsadat Mireshghallah. 2021b. Benchmarking differential privacy and federated learning for BERT models. CoRR, abs/2106.13973. +Luisa Bentivogli, Bernardo Magnini, Ido Dagan, Hoa Trang Dang, and Danilo Giampiccolo. 2009. The fifth PASCAL recognizing textual entailment challenge. In Proceedings of the Second Text Analysis Conference, TAC 2009, Gaithersburg, Maryland, USA, November 16-17, 2009. NIST. +Fabian Boemer, Rosario Cammarota, Daniel Demmler, Thomas Schneider, and Hossein Yalame. 2020. MP2ML: A mixed-protocol machine learning framework for private inference. In *PPMLP'20: Proceedings of the 2020 Workshop on Privacy-Preserving Machine Learning in Practice*, Virtual Event, USA, November, 2020, pages 43–45. ACM. +Fabian Boemer, Anamaria Costache, Rosario Cammarota, and Casimir Wierzynski. 2019a. ngraphhe2: A high-throughput framework for neural network inference on encrypted data. In Proceedings of the 7th ACM Workshop on Encrypted Computing & Applied Homomorphic Cryptography, WAHC@CCS 2019, London, UK, November 11-15, 2019, pages 45-56. ACM. +Fabian Boemer, Yixing Lao, Rosario Cammarota, and Casimir Wierzynski. 2019b. ngraph-he: a graph compiler for deep learning on homomorphically encrypted data. In Proceedings of the 16th ACM International Conference on Computing Frontiers, CF + +2019, Alghero, Italy, April 30 - May 2, 2019, pages 3-13. ACM. +Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. 2020. Language models are few-shot learners. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual. +Daniel Cer, Mona Diab, Eneko Agirre, Inigo Lopez-Gazpio, and Lucia Specia. 2017. SemEval-2017 task 1: Semantic textual similarity multilingual and crosslingual focused evaluation. In Proceedings of the 11th International Workshop on Semantic Evaluation (SemEval-2017), pages 1-14, Vancouver, Canada. Association for Computational Linguistics. +Jung Hee Cheon, Andrey Kim, Miran Kim, and Yong Soo Song. 2017. Homomorphic encryption for arithmetic of approximate numbers. In Advances in Cryptology - ASIACRyPT 2017 - 23rd International Conference on the Theory and Applications of Cryptology and Information Security, Hong Kong, China, December 3-7, 2017, Proceedings, Part I, volume 10624 of Lecture Notes in Computer Science, pages 409-437. Springer. +J Christoph, L Griebel, I Leb, I Engel, F Kopcke, D Toddenroth, H-U Prokosch, J Laufer, K Marquardt, and M Sedlmayr. 2015. Secure secondary use of clinical data with cloud-based nlp services. Methods of information in medicine, 54(03):276-282. +Ido Dagan, Oren Glickman, and Bernardo Magnini. 2005. The PASCAL recognising textual entailment challenge. In Machine Learning Challenges, Evaluating Predictive Uncertainty, Visual Object Classification and Recognizing Textual Entailment, First PASCAL Machine Learning Challenges Workshop, MLCW 2005, Southampton, UK, April 11-13, 2005, Revised Selected Papers, volume 3944 of Lecture Notes in Computer Science, pages 177-190. Springer. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171-4186, Minneapolis, Minnesota. Association for Computational Linguistics. + +William B. Dolan and Chris Brockett. 2005. Automatically constructing a corpus of sentential paraphrases. In Proceedings of the Third International Workshop on Paraphrasing, IWP@IJCNLP 2005, Jeju Island, Korea, October 2005, 2005. Asian Federation of Natural Language Processing. +Cynthia Dwork, Frank McSherry, Kobbi Nissim, and Adam D. Smith. 2006. Calibrating noise to sensitivity in private data analysis. In Theory of Cryptography, Third Theory of Cryptography Conference, TCC 2006, New York, NY, USA, March 4-7, 2006, Proceedings, volume 3876 of Lecture Notes in Computer Science, pages 265-284. Springer. +Natasha Fernandes, Mark Dras, and Annabelle McIver. 2019. Generalised differential privacy for text document processing. In *Principles of Security and Trust - 8th International Conference*, POST 2019, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2019, Prague, Czech Republic, April 6-11, 2019, Proceedings, volume 11426 of Lecture Notes in Computer Science, pages 123-148. Springer. +Craig Gentry. 2009. Fully homomorphic encryption using ideal lattices. In Proceedings of the 41st Annual ACM Symposium on Theory of Computing, STOC 2009, Bethesda, MD, USA, May 31 - June 2, 2009, pages 169-178. ACM. +Danilo Giampiccolo, Bernardo Magnini, Ido Dagan, and Bill Dolan. 2007. The third PASCAL recognizing textual entailment challenge. In Proceedings of the ACL-PASCAL@ACL 2007 Workshop on Textual Entailment and Paraphrasing, Prague, Czech Republic, June 28-29, 2007, pages 1-9. Association for Computational Linguistics. +R Bar Haim, Ido Dagan, Bill Dolan, Lisa Ferro, Danilo Giampiccolo, Bernardo Magnini, and Idan Szpektor. 2006. The second pascal recognising textual entailment challenge. In Proceedings of the Second PASCAL Challenges Workshop on Recognising Textual Entailment. +Dan Hendrycks and Kevin Gimpel. 2016. Bridging nonlinearities and stochastic regularizers with gaussian error linear units. CoRR, abs/1606.08415. +Yangsibo Huang, Zhao Song, Danqi Chen, Kai Li, and Sanjeev Arora. 2020. TextHide: Tackling data privacy in language understanding tasks. In *Findings of the Association for Computational Linguistics: EMNLP* 2020, pages 1368-1382, Online. Association for Computational Linguistics. +Gavin Kerrigan, Dylan Slack, and Jens Tuyls. 2020. Differentially private language models benefit from public pre-training. In Proceedings of the Second Workshop on Privacy in NLP, pages 39-45, Online. Association for Computational Linguistics. +Bill Yuchen Lin, Chaoyang He, Zihang Zeng, Hulin Wang, Yufen Huang, Mahdi Soltanolkotabi, Xiang + +Ren, and Salman Avestimehr. 2021. Fednlp: A research platform for federated learning in natural language processing. CoRR, abs/2104.08815. +Jiachen Lu, Jinghan Yao, Junge Zhang, Xiatian Zhu, Hang Xu, Weiguo Gao, Chunjing Xu, Tao Xiang, and Li Zhang. 2021. SOFT: softmax-free transformer with linear complexity. CoRR, abs/2110.11945. +Lingjuan Lyu, Xuanli He, and Yitong Li. 2020. Differentially private representation for NLP: formal guarantee and an empirical study on privacy and fairness. In Findings of the Association for Computational Linguistics: EMNLP 2020, Online Event, 16-20 November 2020, volume EMNLP 2020 of Findings of ACL, pages 2355-2365. Association for Computational Linguistics. +Chen Qu, Weize Kong, Liu Yang, Mingyang Zhang, Michael Bendersky, and Marc Najork. 2021. Natural language understanding with privacy-preserving bert. Proceedings of the 30th ACM International Conference on Information & Knowledge Management. +Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. 2020. Exploring the limits of transfer learning with a unified text-to-text transformer. J. Mach. Learn. Res., 21:140:1-140:67. +Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. 2016. Squad: 100, $000+$ questions for machine comprehension of text. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, EMNLP 2016, Austin, Texas, USA, November 1-4, 2016, pages 2383-2392. The Association for Computational Linguistics. +Paul M Schwartz and Daniel J Solove. 2011. The pii problem: Privacy and a new concept of personally identifiable information. NYUL rev., 86:1814. +SEAL. 2020. Microsoft SEAL (release 3.6). https://github.com/Microsoft/SEAL. Microsoft Research, Redmond, WA. +Xuehua Shen, Bin Tan, and ChengXiang Zhai. 2007. Privacy protection in personalized search. SIGIR Forum, 41(1):4-17. +Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D. Manning, Andrew Y. Ng, and Christopher Potts. 2013. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, EMNLP 2013, 18-21 October 2013, Grand Hyatt Seattle, Seattle, Washington, USA, A meeting of SIGDAT, a Special Interest Group of the ACL, pages 1631-1642. ACL. +Erik F. Tjong Kim Sang and Fien De Meulder. 2003. Introduction to the CoNLL-2003 shared task: Language-independent named entity recognition. In + +Proceedings of the Seventh Conference on Natural Language Learning at HLT-NAACL 2003, pages 142-147. +Iulia Turc, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. Well-read students learn better: On the importance of pre-training compact models. arXiv preprint arXiv:1908.08962. +Pascal Vincent, Alexandre de Brébisson, and Xavier Bouthillier. 2015. Efficient exact gradient update for training deep networks with very large sparse targets. In Advances in Neural Information Processing Systems 28: Annual Conference on Neural Information Processing Systems 2015, December 7-12, 2015, Montreal, Quebec, Canada, pages 1108-1116. +Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. 2019. GLUE: A multi-task benchmark and analysis platform for natural language understanding. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net. +Adina Williams, Nikita Nangia, and Samuel R. Bowman. 2018. A broad-coverage challenge corpus for sentence understanding through inference. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, NAACL-HLT 2018, New Orleans, Louisiana, USA, June 1-6, 2018, Volume 1 (Long Papers), pages 1112-1122. Association for Computational Linguistics. +Hu Xu, Bing Liu, Lei Shu, and Philip S. Yu. 2019a. BERT post-training for review reading comprehension and aspect-based sentiment analysis. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, NAACL-HLT 2019, Minneapolis, MN, USA, June 2-7, 2019, Volume 1 (Long and Short Papers), pages 2324-2335. Association for Computational Linguistics. +Jingjing Xu, Xu Sun, Zhiyuan Zhang, Guangxiang Zhao, and Junyang Lin. 2019b. Understanding and improving layer normalization. In Advances in Neural Information Processing Systems 32: Annual Conference on Neural Information Processing Systems 2019, NeurIPS 2019, December 8-14, 2019, Vancouver, BC, Canada, pages 4383-4393. +Qiang Yang, Yang Liu, Yong Cheng, Yan Kang, Tianjian Chen, and Han Yu. 2019a. Federated Learning. Synthesis Lectures on Artificial Intelligence and Machine Learning. Morgan & Claypool Publishers. +Wei Yang, Yuqing Xie, Aileen Lin, Xingyu Li, Luchen Tan, Kun Xiong, Ming Li, and Jimmy Lin. 2019b. End-to-end open-domain question answering with bertserini. In Proceedings of the 2019 Conference of the North American Chapter of the Association + +for Computational Linguistics: Human Language Technologies, NAACL-HLT 2019, Minneapolis, MN, USA, June 2-7, 2019, Demonstrations, pages 72-77. Association for Computational Linguistics. +Wei Yang, Haotian Zhang, and Jimmy Lin. 2019c. Simple applications of BERT for ad hoc document retrieval. CoRR, abs/1903.10972. +Bo Zhao, Konda Reddy Mopuri, and Hakan Bilen. 2020. idlg: Improved deep leakage from gradients. CoRR, abs/2001.02610. +Ligeng Zhu and Song Han. 2020. Deep leakage from gradients. In Qiang Yang, Lixin Fan, and Han Yu, editors, Federated Learning - Privacy and Incentive, volume 12500 of Lecture Notes in Computer Science, pages 17-31. Springer. \ No newline at end of file diff --git a/thexprivacypreservingtransformerinferencewithhomomorphicencryption/images.zip b/thexprivacypreservingtransformerinferencewithhomomorphicencryption/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..5ee7f8d28d9cf9af4ca71f113db1184a1963ffdb --- /dev/null +++ b/thexprivacypreservingtransformerinferencewithhomomorphicencryption/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f79b2bfe7b1dac306096c3dabd1062d758b4d93d8df66b10ad2985777e1bca6d +size 315967 diff --git a/thexprivacypreservingtransformerinferencewithhomomorphicencryption/layout.json b/thexprivacypreservingtransformerinferencewithhomomorphicencryption/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..312182d9539ce1b6c7376e4beffdf78838b57937 --- /dev/null +++ b/thexprivacypreservingtransformerinferencewithhomomorphicencryption/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a5319faef43fadbd485acea2c170af29abbabfbb735e21df7103d52877192c55 +size 410623 diff --git a/tobeornottobeanintegerencodingvariablesformathematicaltext/942d6902-86d2-4653-95db-5a42bf36d9ea_content_list.json b/tobeornottobeanintegerencodingvariablesformathematicaltext/942d6902-86d2-4653-95db-5a42bf36d9ea_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..62f39f0e7dd19a791d1de1e079443150298c098f --- /dev/null +++ b/tobeornottobeanintegerencodingvariablesformathematicaltext/942d6902-86d2-4653-95db-5a42bf36d9ea_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ae052073234a55523ddd199712161d1c236b1688a11f552b23b91f4985d569e9 +size 75921 diff --git a/tobeornottobeanintegerencodingvariablesformathematicaltext/942d6902-86d2-4653-95db-5a42bf36d9ea_model.json b/tobeornottobeanintegerencodingvariablesformathematicaltext/942d6902-86d2-4653-95db-5a42bf36d9ea_model.json new file mode 100644 index 0000000000000000000000000000000000000000..037995f479982e9c5559e2eb2010b75c13cc1caf --- /dev/null +++ b/tobeornottobeanintegerencodingvariablesformathematicaltext/942d6902-86d2-4653-95db-5a42bf36d9ea_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a1472bbf2e00975f568b3ce706d5ddc860fd7598a39e11ff1eeb61aa5db440d7 +size 91935 diff --git a/tobeornottobeanintegerencodingvariablesformathematicaltext/942d6902-86d2-4653-95db-5a42bf36d9ea_origin.pdf b/tobeornottobeanintegerencodingvariablesformathematicaltext/942d6902-86d2-4653-95db-5a42bf36d9ea_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b8d31b954fa26bd8d58f0655e3cc176fd4bf53f6 --- /dev/null +++ b/tobeornottobeanintegerencodingvariablesformathematicaltext/942d6902-86d2-4653-95db-5a42bf36d9ea_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1ddc90b0afafe8c35441bae20e69d76069c5399ec03f9025cb6f412a1b660b80 +size 512171 diff --git a/tobeornottobeanintegerencodingvariablesformathematicaltext/full.md b/tobeornottobeanintegerencodingvariablesformathematicaltext/full.md new file mode 100644 index 0000000000000000000000000000000000000000..2aa2d7cb1cba6674983bdf7d42bf085f8d17a099 --- /dev/null +++ b/tobeornottobeanintegerencodingvariablesformathematicaltext/full.md @@ -0,0 +1,352 @@ +# To be or not to be an Integer? Encoding Variables for Mathematical Text + +Deborah Ferreira1, Mokanarangan Thayaparan1,2, Marco Valentino1,2, Julia Rozanova1, Andre Freitas1,2 +Department of Computer Science, University of Manchester, United Kingdom1 +Idiap Research Institute, Switzerland2 +deborah.ferreira@manchester.ac.uk + +# Abstract + +The application of Natural Language Inference (NLI) methods over large textual corpora can facilitate scientific discovery, reducing the gap between current research and the available largescale scientific knowledge. However, contemporary NLI models are still limited in interpreting mathematical knowledge written in Natural Language, even though mathematics is an integral part of scientific argumentation for many disciplines. One of the fundamental requirements towards mathematical language understanding is the creation of models able to meaningfully represent variables. This problem is particularly challenging since the meaning of a variable should be assigned exclusively from its defining type, i.e., the representation of a variable should come from its context. Recent research has formalised the variable typing task, a benchmark for the understanding of abstract mathematical types and variables in a sentence. In this work, we propose VarSlot, a Variable Slot-based approach, which not only delivers state-of-the-art results in the task of variable typing, but is also able to create context-based representations for variables. + +# 1 Introduction + +The articulation of mathematical arguments is a fundamental part of scientific reasoning and communication. Across many scientific disciplines, expressing relations and inter-dependencies between quantities is at the centre of its argumentation. One of the particular linguistic elements used for such argumentation is variables: they are essential for expressing complex mathematical ideas, allowing scientists to refer to a set of values compactly and rigorously. Given the essential nature of variables, models that perform inference over scientific and mathematical text should be able to meaningfully represent and leverage such elements to understand mathematical language and improve downstream inference performance. + +While there is still debate on a universally accepted definition for variables, their functional aspects within mathematical text are well established. A variable is usually defined as a symbol standing as a referent for a set consisting of at least two elements (Philipp, 1992). Given their nature of abstract and dynamic referents, two aspects make the representation of variables particularly challenging in the field of NLP: (i) The meaning of a variable is exclusively determined by its context (Schoenfeld and Arcavi, 1988), a variable carries no meaning when considered in isolation, behaving unlike any word in English; (ii) The same variable symbol (e.g., the variable $x$ ) can be reused in an unlimited number of sentences and expressions, possibly assuming different meanings and referring to different sets of values while keeping the same name. While a similar problem can also be found for the representation of words (i.e., word sense disambiguation), the scale of ambiguity is more marked, due to the fact that variable names, unlike words, are not grounded a priori to any particular set of concepts. + +In order to understand mathematical text, the meaning of variables (i.e., their type) needs to be implicitly or explicitly inferred at some point from the text. Identifying and qualifying the binding between variables and their types, therefore, is crucial for reasoning with mathematical text, given that any form of inference on a variable is fundamentally constrained by the possible values it can take, and those values are uniquely determined by its type. For example, we can only correctly predict the entailment between two sentences containing variables if we infer their types beforehand. + +As a benchmark for variable comprehension in mathematical text, the variable typing task (Stathopoulos et al., 2018) requires finding the connections between variables and their respective types in a sentence. Despite its importance for scientific inference, the task is still widely unex + +plored. Most of the existing work focusing on the representation of mathematical elements, in fact, has been carried out in a non-textual setting, where the mathematical elements are represented independently from any textual content (Aizawa and Kohlhase, 2021). While some expressions and formulas are universal enough to be encoded without context (e.g., Pythagoras theorem), variables have no meaning in isolation and different symbols can be arbitrarily chosen to indicate variables with the same meaning. Therefore, an important principle for designing and evaluating a variable representation is that such a representation should be agnostic to the specific symbols adopted as referents in the text – i.e., the variable names. This is because the variable names contained in a generic passage can be opportunely renamed without altering the sentences' meaning. For instance, a robust variable representation should be able to encode the sentences "Let x be an integer" and "Let y be an integer" in exactly the same way, if they are inserted in the same context. + +However, while this characteristic seems to be intrinsic in the nature of variables, it has been largely ignored by current evaluation frameworks, where there is no agnostic way to verify the quality of the generated variable representation independently of their surface form. To move a step forward towards more robust and generalisable representations, this work proposes a new testing and modelling framework based on the property of generalisation to variable renaming. Specifically, we define a model to be generalisable to variable renaming if the model's performance does not decrease when renaming variables in the test set with variable names never seen during training. Through testing such a property, since the renaming of variables does not alter the context or meaning of the sentences, we are verifying whether the context is correctly moulding the variable encoding and, at the same time, whether the performance is not due to overfitting to the surface form of the text. + +To address and study generalisation to variable renaming, this work proposes VarSlot (Variable Slot), a model for variable typing that represents variables in a surface agnostic way. To achieve a generalisable representation, VarSlot initialises variables as blank slots and employs a multi-slot mechanism, extending from slot attention (Locatello et al., 2020), to iteratively specialise the representation. Specifically, VarSlot leverages self + +attention to conform the representation of each variable to its context (i.e., its surrounding words and other variables), where each surrounding element has a different influence on the final representation. Experiments adopting VarSlot to extend sentence embeddings based on Transformers (Devlin et al., 2019) demonstrate not only that the proposed framework is able to achieve state-of-the-art results on the variable typing task, but also, in contrast with previous work, that VarSlot allows for better generalisation to variable renaming. To the best of our knowledge, this is the first work that focuses on generalisation and robustness for variable representation in mathematical text, providing, at the same time, a critical analysis of large language models (LLMs) targeting the scientific domain. To summarise, the contributions of this paper are as follows: + +- We propose a new evaluation framework for testing the property of generalisation to variable renaming; +- We systematically analyse the understanding of variables in large language models, demonstrating their limitations when handling variable renaming; +- We propose a state-of-the-art model for the variable typing task, demonstrating, at the same time, that it significantly outperforms large language models when analysing the property of generalisation to variable renaming; + +# 2 Variable Typing problem + +This work follows the same definition of a variable used in (Stathopoulos et al., 2018), considering as variables simple expressions composed of a single, possibly scripted, base identifier. The variable typing task requires the assignment between variables in the sentence and its respective types. We use the same setting as (Stathopoulos et al., 2018) for this task: given a sentence $s$ with a pre-identified set of variables $V$ and types $T$ , the task is defined as a binary classification of all edges $V \times T$ , where a positive edge means that the variable is assigned that type and negative otherwise. Figure 1 introduces an example of a mathematical statement, containing one variable $b$ with type persistence length. The edge linking to this type is a positive one, while the one linking to type chains is a negative edge. + +While the task carries some similarity to two other well-known tasks in NLP, Coreference Res + +![](images/ead7258383cb936fb304d90b4b65e3139ebed3bffd52b1d3281f290134d12622.jpg) +Figure 1: Example of a mathematical statement containing one variable. This example shows two different edges (variable $\rightarrow$ type), with a positive and a negative binding. + +olution and Relation Extraction, there are some fundamental differences. Variables have a particular behaviour, where there is a disconnection between the variable name and its meaning. Also, the variable typing task mainly involves intra-sentence dependencies and does not rely on a predicate-argument relation. + +# 3 Our Approach: Variable Slots (VarSlot) + +Following the recent literature (Stathopoulos et al., 2018), this work frames the variable typing problem as binary classification, where each variable is tested against all possible types. Given a sentence $s$ from a mathematical text containing known variables $V = \{v_{1}, v_{2}, \ldots, v_{n_{v}}\}$ and types $T = \{t_{1}, t_{2}, \ldots, t_{n_{t}}\}$ , VarSlot aims at finding a function such that $f(v_{i}, t_{j}) = 1$ if $v_{i}$ has type $t_{j}$ and $f(v_{i}, t_{j}) = 0$ otherwise. In this section we detail our approach, VarSlot, illustrated in Figure 2. + +# 3.1 From types and expressions to hypotheses + +A novel framing for the variable typing problem is proposed in this work. Instead of treating sentences, types and variables as different features of the problem (Stathopoulos et al., 2018), each sentence $s_i$ is converted to a set of hypotheses $H_{s_i} = \{h_{(v_1,t_1)}, h_{(v_1,t_2)}, \ldots, h_{(v_{n_v},t_{nt})}\}$ of size $n_v \times n_t$ by adding to the end of the sentence, the following phrase: "Then [variable] is of type [type]" where variable and type are replaced by the ones being evaluated at that instance. For example, if one wants to test if the variable $x$ is of type integer in the sentence "Let $x$ be an integer and $y$ be a real", it can be converted to a hypothesis by adding "Then $x$ is of type integer" after the initial sentence. This modification will allow our approach to leverage pre-trained sentence encoders, obtaining enriched representations. + +# 3.2 Encoding the sentences + +Previous research has shown that LLMs struggle to understand concepts such as numeracy (Sp + +ithourakis and Riedel, 2018) and solving math word problems (Piékos et al., 2021), but there is still no research on the representation of variables inside the mathematical text for such models, despite their higher performance for different inference tasks (Rogers et al., 2020). + +We hypothesise that it is possible to leverage pre-trained sentence representations to obtain an initial encoding for each hypothesis. By using an encoder, each hypothesis $h$ of size $N$ is mapped to a representation $E \in \mathbb{R}^{N \times D}$ , where each token is assigned a vector of size $D$ , regardless of being a variable or a word. At this point, the representation is unable to distinguish between both modalities of elements. + +# 3.3 Representing Variables with Multi-Slots + +Variables represent a set of possible values, acting as a place-holder element for any possible value inside that set (Schoenfeld and Arcavi, 1988). This set of values is attached to the type corresponding to that variable; for example, if a variable is typed as an integer, we expect it to take values from that set only. A variable with the symbol $x$ can refer to completely different sets depending on its context. Therefore, when representing a variable, its surface form (or symbol) should not interfere with its representation; the semantics of the variable should be guided exclusively by the defined type. We aim to approximate this behaviour by representing each variable using slots (Locatello et al., 2020). Slots use a common representational format, where each slot can store any object from the input, rendering it a suitable candidate for obtaining a latent representation of variables since the same variable name can take many different contexts and possible types. We extend previous work by designing an approach that combines the representations obtained from different slots (multi-slot). + +Given a hypothesis $h_{(v_i, t_j)}$ containing the variables $V = \{v_1, \ldots, v_{n_v}\}$ , a pre-trained sentence embedding is used to obtain a representation $E$ for this hypothesis. In order to obtain a representation that can better distinguish from symbol and abstraction of the variables, we generate a new representation $E_{(v_i-)} \in \mathbb{R}^{N \times D}$ for each variable in the sentence, where the vectors representing the variables are all replaced by zeroes. For each variable, the representation obtained from the encoder is dropped, preserving only the other tokens. This step allows our model to learn the representation of + +![](images/0570b33d1644df730c790c2fb8e6ecc445af8db582b3fda27d4b99d07852b566.jpg) +Figure 2: Our model takes as input a statement containing words and variables. These tokens are encoded using a pre-trained language model. Then, the variables' representation is enriched using slot attention. The final representation is obtained as the mean of all tokens. In the end, we obtain the classification of the hypothesis. + +the variables based on their context and abstraction, diminishing the weight from its surface features. + +A representation $e_{(v_i)} \in \mathbb{R}^D$ is obtained for each variable through iterative Scaled Dot-Product Attention. First, in order to obtain an initial representation, we initialise $e_{(v_i)}$ by sampling from a Gaussian distribution $\mathcal{N}(\mu, \sigma)$ , with learnable parameters $\mu \in \mathbb{R}^D$ and $\sigma \in \mathbb{R}^D$ . This will generate an empty slot, which will be iteratively conformed into a representation for the variable $v_i$ . + +Previous work has shown that having a separated representation for mathematical elements and words can be beneficial for performing inference over mathematical text (Ferreira and Freitas, 2021). We hypothesise that allowing our model to learn a new representation for variables will naturally separate it from other elements. + +We apply the linear transformation $k$ and $v$ over $E_{(v_i - )}$ and $q$ over $e_{(v_i)}$ to compute the Scaled Dot-Product Attention (Vaswani et al., 2017): + +$$ +\operatorname {A t t} = \operatorname {s o f t m a x} \left(\frac {q \left(e _ {\left(v _ {i}\right)}\right) k \left(E _ {\left(v _ {i} -\right)}\right) ^ {T}}{\sqrt {D}}\right) v \left(E _ {\left(v _ {i} -\right)}\right) \tag {1} +$$ + +The obtained attention is applied to a Gated Recurrent Unit (Cho et al., 2014) with hidden size $D$ and transformed with a multi-layer perceptron (MLP) with ReLU activation in order to obtain the new value for $e_{(v_i)}$ . This process is repeated for $T$ iterations, for each variable in the sentence. + +After obtaining the representation for each variable $e_{(v_i)}$ , we need to match it again with the original representation. This is achieved by mapping the obtained variable representations to their original positions in $E_{(v_i - )}$ . The final matrix is encoded + +by a BiLSTM layer, obtaining a final enriched representation $\mathcal{E}$ for the sentence. The algorithm describing this process can be found in Appendix C. + +# 3.4 Classifying hypotheses + +Finally, we obtain a representation for the hypothesis as a single vector of dimension $D$ by computing the mean over the rows of $\mathcal{E}$ . In order to obtain the classification for each hypothesis, we use a final linear layer, with as training objective function the Binary Cross-Entropy Loss. + +# 4 Experiments + +This section presents the experiments performed to evaluate the performance of VarSlot for the variable typing task. The models and datasets used are made available in our repository1. As the encoder for the model, we use the Sentence Transformers (Reimers and Gurevych, 2019) version of SciBERT (Beltagy et al., 2019) pre-trained for NLI tasks (SciBERT-NLI)2. We compare our approach with previous research and standard pre-trained language models. The evaluation is conducted in two different settings: + +1. Classic Variable Typing: This setting represents the canonical evaluation of variable typing task, as it was initially described in (Stathopoulos et al., 2018). +2. Variable Typing with Renaming: In order to evaluate the model's ability to abstract from the surface form of the variables and generalise to variable renaming, we replace all the + +variables in the test set with new symbols, unseen in the Train and Dev set without modifying the sentence's meaning. + +# 4.1 Dataset + +The dataset used in this work to evaluate the performance of the proposed model is the Variable Typing Dataset (Stathopoulos et al., 2018). This dataset was manually curated and annotated from mathematical statements contained in scientific papers. + +For the Renaming setting, the Train and Dev set is the same as the previous setting, but the Test set contains only variable names in the format $x_{1}, x_{2}, x_{3}, \ldots, x_{n}$ . The Test set in both settings has the same hypotheses with identical semantic meaning but different variable names. For example, the fragment "Let $b$ be ..." becomes "Let $x_{1}$ be ..." in the Renaming setting. For reproducibility purposes, we make this expanded dataset available in our repository. + +# 4.2 Baselines + +We compare our approach to the following models: + +- (Stathopoulos et al., 2018): This architecture is based on a Bidirectional LSTM. The model uses one string feature, which is referred to as supertype. If the token is a type, then this feature is the string key of the embedding vector of its supertype or NONE otherwise. These features are mapped to a separate embedding space and then concatenated with the word embedding to form a single task-specific word representation. +- BERT (Devlin et al., 2019), RoBERTa (Liu et al., 2019), SciBERT (Beltagy et al., 2019) and MathBERT (Peng et al., 2021): To assess the understanding of variables in pretrained language models, we use the mentioned models as baselines for the Variable Typing task. For all models we use the base and uncased version. The models are finetuned as a classic NLI model, using a [SEP] token to separate the original sentence with our new typing sentence. All models are finetuned with batch size of 32, for 10 epochs. The full list of used hyper-parameters can be found in the Appendix A. + +# 4.3 Quantitative results + +We present the results for the Variable Typing task in both the classic setting (Table 1) and the renam + +ing setting (Table 2). We include here our approach with $T = 3$ and $T = 2$ . We will start our discussion with the results from the classic setting and then move to the renaming setting. + +# 4.3.1 Classic Setting + +Considering first the classic setting (Table 1), we can observe that both BERT and RoBERTa achieve good results, outperforming the approach proposed by (Stathopoulos et al., 2018), which was designed explicitly for variable typing and uses specific typing embedding. Such performance does not come as a surprise since, as discussed previously, variable typing carries some similarity to tasks that these models have excelled in the past. However, such performance does not imply that these models have a good understanding of the meaning of variables; most likely, they are leveraging the syntactic knowledge they possess to connect types and variables. + +
ModelTest (Classic)
PRF1
Stathopoulos et al. (2018)83.1074.7078.90
BERT77.882.9880.31
RoBERTa82.3280.1381.21
MathBERT81.8573.7677.59
SciBERT77.2687.5482.08
VarSlot (T=3)83.1881.3682.26
VarSlot (T=2)83.9579.0881.44
+ +Table 1: Comparison of our approach with different baselines for Variable Typing for classic setting. We present the values for precision (P), recall (R) and F1-score. + +MathBERT and SciBERT are models specialised in scientific and mathematical knowledge. While SciBERT is pre-trained using corpora from several scientific disciplines, MathBERT was exclusively trained on mathematical text. We initially expected both models to excel on this task since they have been previously exposed to mathematical notation. However, as seen from our results, MathBERT was the worst-performing model from our baselines, while SciBERT was the best performing one. While we cannot establish the reasons for MathBERT's lower performance, since this is outside the scope of this work, we hypothesise that training a model with a large amount of mathematical notation without explicitly designing an en + +coding which reflects its abstract semantics can be damaging to a model's performance. For example, many variable names are reused across different mathematical disciplines, and as we will see in the renaming setting, most models cannot abstract variable meaning from their surface form. SciBERT has been exposed to a smaller mathematical corpus, and usually inside non exclusively mathematical contexts (e.g., computer science papers). Therefore, it is able to achieve higher performance. Given the results obtained from SciBERT, we decided to use the Sentence-Transformers version of this model as our encoder. + +We can see that for $T = 3$ , VarSlot can outperform all of the models for the classic setting. Even though VarSlot uses SciBERT as part of its model, we can still see an improvement when combining it with multi-slots. For $T = 2$ we still obtain competitive results, being outperformed only by SciBERT. + +# 4.3.2 Renaming setting + +In this setting (Table 2), we have the same sentences as in the previous setting, but the variables in the Test split have now different names. Considering the semantic of variables, the previous results should not change, considering the sentence's meaning remains untouched; only the surface of the variables have been altered. However, the obtained results prove otherwise. For all the approaches, there is a decrease relative to the results obtained in the classic setting. Such results hint at the fact that the models still do not encode the expected variable behaviour. + +
ModelTest (Renaming)Average (C+R)
PRF1DecreaseF1
BERT54.0078.2363.8920.44%72.1
RoBERTa55.4368.3461.2124.62%71.21
MathBERT54.3744.2948.8237.07%63.21
SciBERT30.2593.1545.6744.35%63.88
VarSlot (T=3)60.8673.4766.5819.06%74.42
VarSlot (T=2)69.8079.0471.8611.76%76.65
+ +Table 2: Results for VarSlot and baselines for Variable Typing for renaming setting. We include here also the decrease in score relative to the classic setting and the average score for both classic and renaming setting. + +Looking at the obtained results, we can notice that the results obtained using SciBERT suffers from a more remarkable decrease, with a $44.35\%$ $(82.08\rightarrow 45.67)$ decrease in performance for this new setting, even though it was the best performing model for the previous setting. These results + +hint that SciBERT is overfitting to the names of the variables instead of abstracting from its symbols and adapting from context. A significant decrease can also be seen for MathBERT. The best performing baseline for this setting is BERT, which is likely, as previously mentioned, using syntactical cues to obtain the correct types. + +We can see that VarSlot with $T = 2$ is more robust to this transition, having a less prominent decrease when compared to the other results (81.44→71.86), while we see a slight larger decrease for $T = 3$ . The results suggest that our model better understands the difference in behaviour between variables and words and the surface agnostic aspect of variables, not over-fitting as much as the baselines for names of the variables. The results also hints that our model can correctly obtain the meaning of the variables from the context. + +# 4.4 Robustness to substitution + +In a more practical scenario, a model should harmonise a combination of the classic and renaming settings. During inference time, a mixture of seen and unseen variables is likely to be present. In this section, we evaluate the robustness of the model for the duplication of hypotheses with substituted variable names. + +We add $n$ repetitions of the same hypothesis in the test set for this experiment but with different variable names. For $n = 0$ , the Test set is the same as the classic setting. For $n > 0$ , we follow the same procedure as the renaming setting; however, we change the letter being used when adding more repetitions. For instance, for $n = 1$ the variables have format $x_{[variable\_index]}$ , while for $n = 2$ we use the format $y_{[variable\_index]}$ . For $n = 10$ , we will have the same hypothesis appear ten times, but all with different variable names. + +![](images/0320124dd92532835a5448766fcaf96f53c65b5559ebcac3a74fb585de70b167.jpg) +Figure 3: F1 score obtained for different models when adding the same hypotheses with different variable name substitutions. + +This test allows us to compare the robustness of each model to the addition of different variables names. Figure 3 presents the performance of the different models in this task, considering the F1 score and number of added substitutions $n$ . For $n = 0$ the results are the same as the ones present in Table 1. + +We can observe that all the models suffer degradation in the performance as we add more duplicated modified hypotheses. While the models start at a close point, we can notice that as we increase the value of $n$ , the gap between the proposed approach and the others models increases. Again, we note a big decrease in SciBERT's performance. The performance obtained for VarSlot shows how using multi-slots for representation of variables can increase the robustness of the model for variable name substitution through the test set. + +# 4.5 Ablation Studies + +In order to establish what components are impacting on VarSlot comprehension of variables, we perform different ablation studies. Table 3 presents the F1 score for different tests. The first row shows the results for considering only the encoder of our approach (SciBERT-NLI), removing the enriched variable representations and fine-tuning for the classification task. We can notice that our approach improves on top of the sentence representation, with significantly better results on the Renaming setting, showing that multi-slots plays a crucial role on that task. + +
AblationClassicRenaming
1. Encoder only (SciBERT-NLI)80.9258.88
2. Encoder only (BERT-NLI)80.6766.63
3. Using BERT-NLI as encoder81.2469.19
4. VarSlot (T=1)79.5268.03
5. VarSlot (T=2)81.4471.86
6. VarSlot (T=3)82.2666.58
7. VarSlot (T=4)80.4265.88
+ +Table 3: Comparison of our approach for the different settings. + +We also tested the generalisability of our approach to different encoders. Row 2 presents the results for the hypothesis classification only using BERT-NLI3, and Row 3 presents our approach combined with BERT-NLI. We found that by using BERT-NLI instead of SciBERT-NLI for encoding + +3Model obtained from Hugging Face: bert-base-nli-mean-token + +our hypothesis, we could still observe an increase in performance for both classic and renaming settings. The proposed model consistently increases the understanding of variables for different sentence representation models. + +The number of iterations $T$ can also have an impact on the generalisation abilities of VarSlot. Rows 4-7 presents how its performance changes as the number of iterations increases. We can notice that we can obtain best results for the renaming setting with $T = 2$ , while the best performance for the classic setting comes for $T = 3$ . Our model requires a few iterations to conform the variable representation into the correct shape. When adding more iterations, VarSlot is more likely to overfit, leading to a degradation in performance with increasing number of iterations. + +# 4.6 Qualitative Analysis + +Previous work (Ferreira and Freitas, 2021) has found that having separate embedding spaces for mathematical elements and natural language when representing mathematical text can be beneficial for performance in other mathematical language processing tasks. We initially hypothesised that by allowing our model to learn the representation of variables, such separation would naturally happen when starting from a Gaussian initialised slot. + +In order to verify if the model can discriminate between variables and natural language, we compare the embedding of words obtained from SciBERT-NLI (fine-tuned for the Variable Typing task) and our approach. We selected ten random sentences from the test set, obtained their embedding using both and reduced them to three dimensions using Principal component analysis4. The results are presented in Figure 4. + +![](images/1c17a2e878edd3b866acb6b2c3a7e1fbe98a9d62670ee7d25fc25d0f6edd8202.jpg) +(a) SciBERT-NLI + +![](images/97679141d14779351401593b4804b4fe604cf3dad184eb25ed172e1dab27a188.jpg) +(b) VarSlot +Figure 4: Embedding of the words and variables obtained from the test set for SciBERT-NLI and VarSlot. + +The embeddings for the variables are represented here using the yellow diamond. From the figure, + +we can immediately observe that our model easily distinguishes between words and variables, creating a clear separation. The same is not observed for SciBERT-NLI: there is no sharp separation between words and variables, suggesting that the model might not recognise the distinct semantic behaviour. + +We also designed a probing test to quantify which model generates a more separable representation for variables. We obtained the representations for every token present in the test set, generating a representation for each word and variable using VarSlot and SciBERT-NLI. Then, given each representation, we trained a Linear Model to classify these representations into variables or non-variables. For the Linear Model, we use the standard configurations from the Probe-Ably5 (Ferreira et al., 2021) probing framework. The results can be observed in Figure 5. In terms of accuracy, we can notice that the representation generated by our model allows for an easier disentanglement between variables and words, with a Linear model achieving maximum accuracy for linear models with different complexity (evaluated in terms of the norm). Following the classic probing protocol (Hewitt and Liang, 2019; Rozanova et al., 2021), we also provide the results for the Probing selectivity in Appendix B. + +![](images/439cb9ccb93ed538b73c226640c05043611865f3d631ca3a800d2289bb87087b.jpg) +Figure 5: Results for the probing task, where we compare the representations generated from SciBERT-NLI (yellow) and VarSlot (blue). + +Such finding reinforces the idea that variables requires a specialised representation. The slots for variables could have potentially relearned to replicate the original representations obtained from the encoder, however, a natural separation has been + +obtained between variables and words without explicitly being trained for that. This hints to the fact that such separation is beneficial for a better performance on tasks involving mathematical knowledge and models dealing with mathematical knowledge could benefit from explicitly defining such property. + +# 5 Related Work + +Even though mathematical text is often a crucial element of scientific discourse, the area of mathematical language processing is still widely unexplored (Ferreira and Freitas, 2020b,a). While initial efforts have focused on rule-based and bag of words-based approaches (Pagael and Schubotz, 2014; Schubotz et al., 2016; Alexeeva et al., 2020; Kristianto et al., 2012), recent work transitioned to supervised-learning methods. (Stathopoulos et al., 2018) presents three different models for addressing this problem, framing it as a binary classification between a variable and a type. The models proposed are an SVM model using features that are type and variable-centric, a ConvNet using pretrained embeddings to represent the input tokens and a Bidirectional LSTM model that takes as input the full sentence along with the pairs for classification. (Stathopoulos et al., 2018) shows that neural models vastly outperform models with manual feature engineering. The authors also introduce a dataset for the task. + +# 6 Conclusion + +In this paper, we introduced VarSlot, a model for solving the task of variable typing generating a more generalisable representation of variables. In order to evaluate the proposed encoding, with a particular emphasis on variable semantics, we propose a new setting for the variable typing task, where during inference type, the model is only exposed to new variable names. We observed that in this setting, there is a decrease in performance for all tested models; however, VarSlot was the most robust model. As future work, we leave the application of these specialised embeddings for different downstream tasks, similar to the work done in (Stathopoulos et al., 2018). We expect that generating better representations for variables will enable an increase in performance across different mathematical language inference tasks. + +# References + +Akiko Aizawa and Michael Kohlhase. 2021. Mathematical information retrieval. In *Evaluating Information Retrieval and Access Tasks*, pages 169-185. Springer, Singapore. +Maria Alexeeva, Rebecca Sharp, Marco A Valenzuela-Escárcega, Jennifer Kadowaki, Adarsh Pyarelal, and Clayton Morrison. 2020. Mathalign: Linking formula identifiers to their contextual natural language descriptions. In Proceedings of The 12th Language Resources and Evaluation Conference, pages 2204-2212. +Iz Beltagy, Kyle Lo, and Arman Cohan. 2019. Scibert: A pretrained language model for scientific text. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 3615-3620. +Kyunghyun Cho, Bart van Merrienboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Holger Schwenk, and Yoshua Bengio. 2014. Learning phrase representations using rnnc encoder-decoder for statistical machine translation. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 1724-1734. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. Bert: Pre-training of deep bidirectional transformers for language understanding. In *NAACL-HLT* (1). +Deborah Ferreira and André Freitas. 2020a. Natural language premise selection: Finding supporting statements for mathematical text. In Proceedings of the 12th Language Resources and Evaluation Conference, pages 2175-2182. +Deborah Ferreira and André Freitas. 2020b. Premise selection in natural language mathematical texts. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 7365-7374. +Deborah Ferreira and André Freitas. 2021. STAR: Cross-modal [STA]tement [R]presentation for selecting relevant mathematical premises. In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume, pages 3234-3243, Online. Association for Computational Linguistics. +Deborah Ferreira, Julia Rozanova, Mokanarangan Thayaparan, Marco Valentino, and André Freitas. 2021. Does my representation capture X? probe-ably. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing: System Demonstrations, pages 194–201, Online. Association for Computational Linguistics. +John Hewitt and Percy Liang. 2019. Designing and interpreting probes with control tasks. In Proceedings + +of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 2733-2743, Hong Kong, China. Association for Computational Linguistics. +Giovanni Yoko Kristianto, Minh-Quoc Nghiem, Yuichi-roh Matsubayashi, and Akiko Aizawa. 2012. Extracting definitions of mathematical expressions in scientific papers. In Proc. of the 26th Annual Conference of JSAI, pages 1-7. +Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692. +Francesco Locatello, Dirk Weissenborn, Thomas Unterthiner, Aravindh Mahendran, Georg Heigold, Jakob Uszkoreit, Alexey Dosovitskiy, and Thomas Kipf. 2020. Object-centric learning with slot attention. In Advances in Neural Information Processing Systems, volume 33, pages 11525-11538. Curran Associates, Inc. +Robert Pagael and Moritz Schubotz. 2014. Mathematical language processing project. arXiv preprint arXiv:1407.0167. +Shuai Peng, Ke Yuan, Liangcai Gao, and Zhi Tang. 2021. Mathbert: A pre-trained model for mathematical formula understanding. arXiv preprint arXiv:2105.00377. +Randolph A Philipp. 1992. The many uses of algebraic variables. The Mathematics Teacher, 85(7):557-561. +Piotr Piekos, Henryk Michalewski, and Mateusz Malinowski. 2021. Measuring and improving bert's mathematical abilities by predicting the order of reasoning. arXiv preprint arXiv:2106.03921. +Nils Reimers and Iryna Gurevych. 2019. Sentence-bert: Sentence embeddings using siamese bert-networks. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 3982-3992. +Anna Rogers, Olga Kovaleva, and Anna Rumshisky. 2020. A primer in bertology: What we know about how bert works. Transactions of the Association for Computational Linguistics, 8:842-866. +Julia Rozanova, Deborah Ferreira, Marco Valentino, Mokanrarangan Thayaparan, and Andre Freitas. 2021. Decomposing natural logic inferences in neural nli. arXiv preprint arXiv:2112.08289. +Alan H Schoenfeld and Abraham Arcavi. 1988. On the meaning of variable. The mathematics teacher, 81(6):420-427. + +Moritz Schubotz, Alexey Grigorev, Marcus Leich, Howard S Cohl, Norman Meuschke, Bela Gipp, Abdou S Youssef, and Volker Markl. 2016. Semantification of identifiers in mathematics for better math information retrieval. In Proceedings of the 39th International ACM SIGIR conference on Research and Development in Information Retrieval, pages 135-144. + +Georgios Spithourakis and Sebastian Riedel. 2018. Numeracy for language models: Evaluating and improving their ability to predict numbers. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 2104-2115. + +Yiannos Stathopoulos, Simon Baker, Marek Rei, and Simone Teufel. 2018. Variable typing: Assigning meaning to variables in mathematical text. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 303-312. + +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In NIPS. + +# A Hyperparameters + +The list of used hyper-parameters, which are shared across baselines and our approach are as follows: + +- Seed: 42 +- Batch size: 32 +- Train Epochs: 10 +- Learning Rate: 1e-5 (5e-5 for MathBERT) +Gradient Accumulation Steps: 1 +Weight Decay: 0.0 +Adam Epsilon: 1e-8 +Warmup Steps: 0 +Max Grad Norm: 1.0 + +For fine-tuning all the models, we used 4 Tesla 16GB V100 GPUs. + +# B Probing Selectivity + +The selectivity score, namely the difference in accuracy between the representational probe and a control probing task with randomised labels, serves as an indicator that the probe architectures used are not expressive enough to "memorise" unstructured labels. Ensuring that there is no drop-off in selectivity increases the confidence that we are not falsely attributing strong accuracy scores to the representational structure where they could have been explained by over-parameterized probes. + +![](images/414103545056f009b150798f083bdd5c29f6c02f9158baa79b53e17f9bfe78cc.jpg) +Figure 6: Results for the probing task, where we compare the representations generated from SciBERT-NLI (yellow) and VarSlot (blue), evaluating in terms of selectivity + +Figure 6 presents the selectivity results for our probing task. We can notice that the selectivity remains stable for more complex probes, indicating that these are in fact, probes that are more reliable. + +# C VarSlot approach algorithm + +This section presents Algorithm 1 used for obtaining the encoded representations of each hypothesis. + +Algorithm 1: Learning the representation of mathematical statements with variables. + +Input: Encoded representation of the hypothesis $E$ , variables in the hypothesis $v_{1}, v_{2}, \ldots, v_{n_{v}}$ , and positions of each variable in the hypothesis $P_{v_{1}}, P_{v_{2}}, \ldots, P_{v_{n_{v}}}$ . + +Output: New hypothesis representation $\mathcal{E}$ + +$E_{(v_i - )}\gets E$ + +for $j\gets P_{v_0}$ to $P_{v_n} / \star$ Discard variable representations $\star/$ + +do + +$$ +E _ {(v _ {i} -) _ {j}} \leftarrow [ 0 0 \dots 0 0 ] +$$ + +end + +for $i\gets 0$ to $n_v / \star$ For all variables $\star /$ do + +$e_{(v_i)}\sim \mathcal{N}(\mu ,\sigma); / \star$ Initialise new representation $\star /$ + +for $t\gets 0$ to $T / \star$ Iterate over + +representation $T$ times $\star /$ + +do + +$$ +e _ {(v _ {i}) _ {t - 1}} \gets e _ {(v _ {i})} +$$ + +$$ +e _ {(v _ {i})} \leftarrow \text {L a y e r N o r m} (e _ {(v _ {i})}) +$$ + +$$ +K \leftarrow k \left(E _ {\left(v _ {i -}\right)}\right) +$$ + +$$ +Q \leftarrow q \left(e _ {\left(v _ {i}\right)}\right) +$$ + +$$ +V \leftarrow v \left(E _ {\left(v _ {i} -\right)}\right) +$$ + +$$ +A \leftarrow \operatorname {A t t} (Q, K, V) +$$ + +$$ +e _ {(v _ {i})} \leftarrow \mathrm {G R U} (e _ {(v _ {i}) _ {t - 1}}, A) +$$ + +$$ +e _ {(v _ {i})} \leftarrow e _ {(v _ {i})} + \operatorname {M L P} (\text {L a y e r N o r m} (e _ {(v _ {i})) +$$ + +end + +for $j\gets P_{v_{i_0}}$ to $P_{v_{i_n}} / \star$ Replace with new representation $\star/$ + +do + +$$ +E _ {(v _ {i} -)} \gets e _ {(v _ {i})} +$$ + +end + +end + +$$ +\mathcal {E} \leftarrow \operatorname {B i L S T M} \left(E _ {\left(v _ {i -}\right)}\right) +$$ + +return $\mathcal{E}$ \ No newline at end of file diff --git a/tobeornottobeanintegerencodingvariablesformathematicaltext/images.zip b/tobeornottobeanintegerencodingvariablesformathematicaltext/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..0d52a6151df87266d1b98adcbfdbbd9c027fd7b1 --- /dev/null +++ b/tobeornottobeanintegerencodingvariablesformathematicaltext/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:475152a5288805137519b4e5e30e8d034a6f5fc75216f34ffe454a809a758130 +size 254830 diff --git a/tobeornottobeanintegerencodingvariablesformathematicaltext/layout.json b/tobeornottobeanintegerencodingvariablesformathematicaltext/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..16d1d63dde517f06272aca5622d3905ac921df3a --- /dev/null +++ b/tobeornottobeanintegerencodingvariablesformathematicaltext/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ae2ff31ae80a31373a11f49a14c072ef985c9ff0566e66c672e5921e0f41ff87 +size 373675 diff --git a/towardmoremeaningfulresourcesforlowerresourcedlanguages/182fb908-cd9e-47d9-8237-2fcd97f66812_content_list.json b/towardmoremeaningfulresourcesforlowerresourcedlanguages/182fb908-cd9e-47d9-8237-2fcd97f66812_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..874c5ea3fae41eef40b61f52f6d5dfafe2a51d00 --- /dev/null +++ b/towardmoremeaningfulresourcesforlowerresourcedlanguages/182fb908-cd9e-47d9-8237-2fcd97f66812_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:02cfad8378d81b9d9f966f36b1a5b8ffc802504616f89f93842cf368f3016f35 +size 71430 diff --git a/towardmoremeaningfulresourcesforlowerresourcedlanguages/182fb908-cd9e-47d9-8237-2fcd97f66812_model.json b/towardmoremeaningfulresourcesforlowerresourcedlanguages/182fb908-cd9e-47d9-8237-2fcd97f66812_model.json new file mode 100644 index 0000000000000000000000000000000000000000..f9144fd259cc32602ddb6303ac6650852165afea --- /dev/null +++ b/towardmoremeaningfulresourcesforlowerresourcedlanguages/182fb908-cd9e-47d9-8237-2fcd97f66812_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4ede3d3aaaec422a6966ed0daa49d2df5a3b4e736441d58482c317fac6f5588a +size 80062 diff --git a/towardmoremeaningfulresourcesforlowerresourcedlanguages/182fb908-cd9e-47d9-8237-2fcd97f66812_origin.pdf b/towardmoremeaningfulresourcesforlowerresourcedlanguages/182fb908-cd9e-47d9-8237-2fcd97f66812_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..76150876eb1a15a12a68dd646913ff51aa15f768 --- /dev/null +++ b/towardmoremeaningfulresourcesforlowerresourcedlanguages/182fb908-cd9e-47d9-8237-2fcd97f66812_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a02336d7d5198a5787a6f22db6795c0abd23df4675a651f496024909dba54f67 +size 292116 diff --git a/towardmoremeaningfulresourcesforlowerresourcedlanguages/full.md b/towardmoremeaningfulresourcesforlowerresourcedlanguages/full.md new file mode 100644 index 0000000000000000000000000000000000000000..e2ecf963a9fb30dfbd4d1ef3dfc5398c76e4a715 --- /dev/null +++ b/towardmoremeaningfulresourcesforlowerresourcedlanguages/full.md @@ -0,0 +1,241 @@ +# Toward More Meaningful Resources for Lower-resourced Languages + +Constantine Lignos and Nolan Holley* and Chester Palen-Michel* and Jonne Sälevä* + +Michtom School of Computer Science + +Brandeis University + +{lignos,cpalenmichel,jonnesaleva}@brandeis.edu + +nrh2@williams.edu + +# Abstract + +In this position paper, we describe our perspective on how meaningful resources for lower-resourced languages should be developed in connection with the speakers of those languages. Before advancing that position, we first examine two massively multilingual resources used in language technology development, identifying shortcomings that limit their usefulness. We explore the contents of the names stored in Wikidata for a few lower-resourced languages and find that many of them are not in fact in the languages they claim to be, requiring non-trivial effort to correct. We discuss quality issues present in WikiAnn and evaluate whether it is a useful supplement to hand-annotated data. We then discuss the importance of creating annotations for lower-resourced languages in a thoughtful and ethical way that includes the language speakers as part of the development process. We conclude with recommended guidelines for resource development. + +# 1 Introduction + +Recent years have seen increased interest from the natural language processing community in developing both models and datasets for what may be termed "lower-resourced" languages. Advances in transfer learning and the increased availability of data and benchmarks in these languages have made it straightforward to create what appear to be high-performing models for these languages with little or no annotated data. + +Yet despite the popularity and apparent effectiveness of these systems, the unique challenges and best practices for developing datasets and models for lower-resourced languages are rarely discussed alongside the system themselves. In this position paper, through commentary on our experiences working with existing datasets and a discussion of current trends, we explore what resources + +we believe will be most useful for the development of meaningful language technology for lower-resourced languages, advancing our perspective that open data and models and a participatory approach to research are the keys to progress. + +Before we can elaborate further, we must address a terminological issue which creates a stumbling block when attempting to discuss resources and language technology for the languages of interest to us. Throughout this paper, we will use the term lower-resourced language to refer to languages that have received fewer resources—as measured in any numbers of dimensions such as models, datasets, papers, funding, etc.—than the most popularly-studied languages in the field of natural language processing. We explicitly use the comparative lower rather than low to emphasize the continuum that exists across languages regarding the resources available for developing language technology. + +Whether a language is lower-resourced in a specific context may depend on what is available for the task at hand. Due to singular efforts, a language that may have otherwise been underserved by the research community may have a rich set of resources for a single task like machine translation (MT), but might not have annotation for other tasks. For example, consider the Inuktitut language, which has a substantial amount of government-domain parallel data (Joannis et al., 2020) that enabled an MT shared task (Barrault et al., 2020), but has few labeled datasets for other tasks and is not included in any large multilingual language models we are aware of. + +We take an open and intersectional perspective to what might be called a lower-resourced language, acknowledging that this designation is both imperfect and often the result of many contributing factors. For example, many languages referred to in this way may be less-widely spoken, underserved by the research community and funding agencies, or used by marginalized or minoritized populations. + +In summary, our use of the term lower-resourced is intended to reflect a continuous, not categorical, status and one that is multi-dimensional, depending on task and context. + +The goal of this paper is to argue for our perspective regarding what are the most effective ways to construct and use resources for building language technology for lower-resourced languages. This paper's contributions come at two levels. At the more concrete level, we discuss particular issues related to using Wikidata and WikiAnn as sources of information about names, and highlight how automatic processes to take advantage of this information can go wrong when no human expertise is involved. At a higher level, we discuss the problematic nature of developing language technology datasets and models with no or limited interaction with the population of speakers of the languages involved. + +The structure of the paper is as follows. We first review two popular resources used in NLP for lower-resourced languages and the impact that they have had on the field. While we will discuss shortcomings of these resources, sometimes demonstrating them with experiments, the goal of this section is not to publish a critique of these resources, but rather to make other researchers aware of their shortcomings and limitations. By acknowledging and understanding their limitations, we can better understand how to use them most appropriately and develop future resources that do not share the same limitations. + +We then turn to the importance of annotation and dataset creation processes that meaningfully involve speakers of the languages under study. We discuss open challenges for NLP for lower-resourced languages, and conclude with suggested guidelines for researchers performing research in this area. + +# 2 Wikidata: A source for name labels + +Wikidata1 is an open and collaboratively edited knowledge graph, hosted by the Wikimedia Foundation. The Wikidata graph consists of entity nodes connected by labeled edges that represent binary relations. Each entity and relation is identified by a unique Wikidata identifier, e.g. Q4346375 (Association for Computational Linguistics) and P361 (part-of relation). + +While English labels are typically used for the page titles on the Wikidata website, most entities + +have labels available in several languages, with the most well-edited entries having labels in hundreds of languages. This makes Wikidata an appealing source for constructing multilingual NLP resources related to entity names, as parallel names can in theory be trivially extracted from each entity. For example, Wikidata could be used to harvest name lists for a named entity recognition (NER) system, or as a source of parallel names for translation or transliteration models. In this section, we show Wikidata's promise for extracting names in lower-resourced languages as well as the data issues that arise in attempting to use it for this purpose. + +# 2.1 Name quality in lower-resourced languages + +Given the limited name-related annotation available for many lower-resourced languages, previous work has used Wikidata as a source of data for multilingual name transliteration (Benites et al., 2020; Irvine et al., 2010). Specifically for lower-resourced languages, many approaches to NER and linking for the LORELEI program (Strassel and Tracey, 2016) used Wikidata, Wikipedia, DBpedia, GeoNames, and similar resources to provide name lists relevant to the languages and regions for which systems were developed. + +However, there are many caveats hidden in the data present in Wikidata and using the contents without scrutiny can be problematic. One such caveat is the mixing of languages and scripts occurring within the entity labels of a single language, especially lower-resourced ones. + +Tigrinya, a Semitic language spoken in Africa by over 9 million speakers, is a particularly good example to explore, as it is written using the Ge'ez script and has only 539 entity labels in Wikidata. However, only 269 out of 539 labels are actually written in the Ge'ez script, with the rest being in Latin script. This problem is particularly pronounced among entities referring to persons, where only 36 entities are written in Ge'ez, and 245 in Latin script. Out of all Tigrinya entity labels, nearly $50\%$ are identical to the English label. + +While we have not done an exhaustive analysis, we believe that many other lower-resourced languages are affected by issues of this type. Another example is Inuktitut, an Indigenous and historically + +minoritized language spoken in the Canadian Arctic by approximately 35,000-40,000 people, contains 25,222 entity labels in Wikidata, yet only 429 are written in the official Inuktitut syllabics. Out of all Inuktitut labels, $97\%$ are identical to the corresponding English label. + +The way in which Latin script labels outnumber the ones written in Ge'ez script and Inuktitut syllabics suggests that labels are potentially being copied over from other languages, possibly as a result of bot activity. This script pollution may have adverse effects—particularly when the amount of data in the desired script is very small—not only on training models on the raw data but also on any heuristic filtering methods that try to, for example, filter out all entity labels not in the most common script for the language (which may end up being the incorrect script). In other words, approaches to processing multilingual resources that assume that correct data points outnumber incorrect data points within a given a language will fail. + +# 2.2 Name copying + +Another minority language heavily impacted by likely copying is Asturian, a language spoken by 100,000-450,000 speakers in Spain. Wikidata contains over 5 million entity labels for Asturian, with $97\%$ of them identical to the English label. For comparison, $93.5\%$ out of 5.8 million Spanish entity labels are identical to English. + +Overlap with English labels is not necessarily indicative of the labels being incorrect, as both Asturian and Spanish use the Latin alphabet and many named entities, particularly persons and organizations, can be written in the same way across languages. However, the vast number of labels relative to the number of Asturian speakers (and proportionately, active Wikidata editors), and the extra-high level of English-matching suggests that labels are being copied from other languages. This automated copying is widespread, so much so that Asturian ranks as the fourth largest language in Wikidata as measured by number of entity labels, following English, Dutch, and Spanish. + +All in all, these examples show that extra care must be taken when harvesting multilingual data for lower-resourced languages in cases where it is possible that data may have been copied from a higher-resourced language. This problem is most visible in cases where a language uses a non-Latin script, but is likely to exist for many other lan + +guages. Failing to exercise caution may result in creating low-quality derived datasets that may do more harm than good. For example, if a multilingual dataset contains a large number of incorrect copies of English in other languages, it may make tasks appear easier than they are because of trivial transfer from English. + +# 2.3 Summary + +In spite of the shortcomings in data quality, we still believe that Wikidata may be a valuable resource for language technology development, provided that enough effort is invested in data cleaning and validation. This process can take many forms depending on the application and could include, among other things, automated identification and filtering of languages and scripts, analysis of label copying from higher-resourced languages, and even analysis of who is making edits to Wikidata (for example, to identify automated edits). + +Instead of shunning Wikidata, we encourage researchers to contribute to making it better for the global research community, and especially for lower-resourced languages for which Wikidata may be one of the only resources available. We also encourage researchers to use Wikidata collaboratively with the speakers of lower-resourced languages who can provide guidance on the quality of resources derived from it and help with the process of removing incorrect information. + +# 3 WikiAnn + +We now turn our attention to a different Wikipedia-related resource, one derived from it. WikiAnn (Pan et al., 2017) is a dataset originally created for named entity tagging and linking of 282 languages present in Wikipedia. Pan et al. generate "silver-standard" named entity annotations "by transferring annotations from English to other languages through cross-lingual links and KB properties, refining annotations through self-training and topic selection, deriving language-specific morphology features from anchor links, and mining word translation pairs from cross-lingual links." + +# 3.1 A "silver" standard for multilingual NER + +Since the WikiAnn dataset was created it has been used as a multilingual NER benchmark and it is + +included as part of the XTREME (Hu et al., 2020) massively multilingual multi-task benchmark. It is not uncommon for WikiAnn to be mentioned as a multilingual NER benchmark with sometimes no mention of the fact that it is system output and not, in fact, annotation (despite the Ann in the name). + +We question the appropriateness of treating WikiAnn as a multilingual benchmark for NER. Even in a higher resourced language, the practice of evaluating a task on automatically derived data is sub-standard, hence the original authors referring to it as a "silver standard." This kind of evaluation can only show how close one model comes to replicating the automated data collection process and does not reflect human performance. + +Just examining the English data of WikiAnn reveals a number of entity names that would otherwise never be marked as names by a human. Strings of text such as Independently released, If I were a boy, and List of books written by teenagers are annotated as organizations. I was glad, the latter's studio, and were promoted are annotated as locations, and range has expanded, a twelve-year-old passenger was found alive, and Artavasdes II, who served as are tagged as person. While these examples are a small sample, we identified hundreds like these with either span issues, Wikipedia-specific entities like lists, incorrect entity types or entities that were simply not names. One might argue that this represents less than $1\%$ of the English WikiAnn data and is therefore noise. However, human annotation does not typically have mistakes of the types and also has the benefit of being able to report inter-annotator agreement so that researchers can better understand the difficulty of the task. + +# 3.2 Subsampled splits: Unnecessarily discarded data + +There can be some confusion as to which dataset is referred to by "WikiAnn." The original WikiAnn paper (Pan et al., 2017) contains data in 282 languages, but there is also another version derived from the original with only 176 languages (Rahimi et al., 2019) with fixed data splits. This derived version is the one that can be found in Hugging Face's Datasets.4 The original (unsplit) WikiAnn datasets can be found on Google Drive.5 + +![](images/a9df851afd9b56c913c7acd79dea9f63d389146d50f8c33c0568ce30d7247f5c.jpg) +Figure 1: Counts of mentions in the full WikiAnn datasets in seven African languages that will be of interest in experiments in Section 3.5. A logarithmic scale is used so that all languages can be visualized. + +We describe the differences between the two versions of the dataset in detail because many may use the currently popular Hugging Face Datasets library (Lhoest et al., 2021) and never realize they have access to less data than is in the original. Additionally, we highlight how the subsampled data no longer reflects a natural distribution of entity types and discards substantial amounts of data. + +The original WikiAnn datasets are much larger than what was kept in the splits used by Rahimi et al. (2019). As can be seen in Figure 1, in the original data the languages display an uneven distribution of mention types, with most languages having far more mentions of LOC than ORG or PER. $^{6}$ This likely reflects a mix of the true distribution of named entities in the data and the fact that recall is typically highest for LOC entities. + +Rahimi et al. (2019) used stratified sampling to select sentences for inclusion in their splits. The process is as follows: first, the sentences in the dataset are categorized into three groups (LOC, ORG, PER) based on the entity type of the last mention in the sentence. The size of the smallest of these groups is defined to be the minimum count, and this number of sentences is taken from each group and added to a new list of sentences. This list is shuffled, and if it is large enough, will be + +![](images/1523a79894d888ed5f148e5aef1b199b3813260b8a8b48e4ccda024dc93fd62e.jpg) +Figure 2: Counts of mentions in the stratified data selected by (Rahimi et al., 2019). A logarithmic scale is used so that all languages can be visualized. + +used to make 10,000/10,000/10,000 splits. If not, the splits will be 1,000/1,000/1,000, and if there are not enough sentences for that, then the next step is 100/100/100. If there is not enough data for 100/100/100 splits, then the language will be skipped. However, this was not the process used to create splits for the 41-language subset whose performance was examined by Rahimi et al. (2019), though the authors provide information on those splits in the appendix. + +As can be seen in Figure 2, stratified sampling was largely successful in balancing the mention types across the splits. However, a large amount of data is discarded by this process, and Hausa and Wolof are entirely thrown out because the entity type with the minimum count had too few mentions for this splitting method to be used. Furthermore, the distribution of entity types is artificial and does not match up with the natural distribution of entity types for this domain. For comparison see the distribution of entity types from the MasakhaNER data (Adelani et al., 2021), a human annotated NER dataset for 10 African languages, as shown in Figure 3. + +# 3.3 Is WikiAnn useful for languages with human annotation? + +For languages where there is no annotated NER data, WikiAnn is likely better than nothing. However, when annotated data is available for evaluation, can WikiAnn still be a useful resource? We + +![](images/ca6d131fd838515231145551d8813b013bd9ded8d325f86388595784c53ba108.jpg) +Figure 3: Counts of mentions in the MasakhaNER data for languages present in WikiAnn. The DATE tag was excluded for consistency with WikiAnn. + +conducted experiments by comparing models finetuned only on the MasakhaNER training data to those fine-tuned on the concatenation of WikiAnn with the MasakhaNER training data to see whether adding WikiAnn could improve performance by providing additional in-language training data. For comparison, we also experimented with finetuning using the concatenation of the training data across all languages in MasakhaNER. + +Qualitatively, the WikiAnn data differs greatly from any typical NER dataset annotated on news, such as MasakhaNER. As can be seen in Table 1, the WikiAnn data is generally very dense in mentions, contains many "sentences" not ending in periods (which are likely not actually sentences at all), has a high number of "sentences" that consist of only a single mention. + +For all experiments, training was done for 50 epochs. Training was done using the train_ner.py script from the MasakhaNER GitHub repository. Each experiment was run with 10 different random seeds and we report the mean + +
Lang.SentencesSentences ending in a periodSentences consisting of a single mentionMentionsTokensTokens inside mentions (%)Average tokens per mention
amh1,0321013811,1896,47738.742.11
hau4891762235173,65016.581.17
ibo9372845689686,38727.591.82
kin1,5171761,1631,6806,49642.901.66
swa7,5892,3533,1139,31543,08557.362.65
wol1,1963376241,37010,80017.051.34
yor3,4383962,2853,71618,31962.443.08
+ +Table 1: Token, sentence, and mention statistics for all data in seven African languages contained in WikiAnn. + +
Lang.MasakhaNER+WikiAnnΔp-value
amh70.63 ±1.1669.02 ±1.721.610.0191
hau90.54 ±0.5690.03 ±0.580.510.1041
ibo86.37 ±0.8385.44 ±0.580.930.0211
kin73.89 ±2.1272.14 ±1.791.750.0821
swa87.90 ±0.6488.16 ±0.850.260.4963
wol68.12 ±1.3868.18 ±1.220.060.8798
yor78.23 ±0.9979.25 ±0.981.020.0539
+ +and standard deviation.9 + +For evaluation, the SeqScore $^{10}$ toolkit (Palen-Michel et al., 2021) was used, with the conlleval method of repairing invalid label sequences unless otherwise specified. The Wilcoxon rank-sum test was used to evaluate statistical significance. + +# 3.4 Fine-tuning with WikiAnn and MasakhaNER + +We experimented with fine-tuning XLM-R on the concatenation of the MasakhaNER training data with all available WikiAnn data in the corresponding language. The results are shown in Table 2. On average, F1 decreased by 0.49 when adding WikiAnn to the training data. Three languages (Swahili, Wolof, and Yoruba) show increases in performance, and while none are statistically significant at the $p < 0.05$ level, the improvement in Yoruba is marginally significant ( $p = 0.0539$ ). + +Table 2: Comparison of F1 scores between XLM-R fine-tuned using only MasakhaNER data and fine-tuned using MasakhaNER data and all available WikiAnn data in each language. + +
Lang.Single lang.All langs.Δp-value
amh71.19 ±1.2071.70 ±1.010.510.3847
hau89.78 ±0.4190.85 ±0.481.070.0005
ibo84.18 ±0.9485.72 ±0.601.540.0024
kin73.29 ±1.4074.67 ±0.791.380.0283
lug80.02 ±0.9180.88 ±0.730.860.0413
luo74.43 ±1.6077.19 ±1.172.760.0015
pcm87.89 ±0.7289.14 ±0.491.250.0002
swa87.43 ±0.5687.19 ±0.420.240.1988
wol64.74 ±1.8265.33 ±1.420.590.4963
yor77.63 ±1.1780.75 ±0.523.120.0002
+ +Table 3: Comparison of F1 scores between XLM-R fine-tuned on MasakhaNER data and fine-tuned on the concatenation of the MasakhaNER train splits for all languages. + +# 3.5 Fine-tuning with all MasakhaNER languages + +The inclusion of WikiAnn data in the training data offers mixed results at best. Another option is to pool the training data across languages, creating a multilingual NER model trained on just the MasakhaNER data that is evaluated on each language's test set individually.[11] Adelani et al. (2021) previously performed this experiment, but we replicate it here using our methodology, which includes statistical significance testing, a larger number of random seeds, and includes Amharic in this experiment even though it uses a different script than the other languages. + +The results, shown in Table 3, are similar to those reported by Adelani et al. (2021), with all languages seeing improved performance except for Swahili. Many of the improvements are statistically significant, showing that simply using more higher quality in-domain human-annotated data improves performance, while WikiAnn does not appear to help. + +# 3.6 Summary + +Many languages have no annotated data of the type provided by WikiAnn, and for those languages WikiAnn may prove useful as long as users are aware of its shortcomings. Being an automatically created dataset, it contains noisy data, and it was constructed without input from speakers of almost all the languages contained in it. Given that the core types (LOC, ORG, and PER) are intended to have the same definition across both WikiAnn and the MasakhaNER datasets, we predicted that augmenting MasakhaNER data with WikiAnn would improve performance. + +But even when all available WikiAnn data is used, it does not improve the performance of models for the MasakhaNER data, and the simpler approach of simply pooling the MasakhaNER data across all languages produces better results. This suggests that the noise level of the WikiAnn "silver" standard is very high, raising into doubt the validity of benchmarks which treat it as gold standard data. + +# 4 Human annotation: Still essential + +We have spent much of our paper describing the complexities of working with large-scale, Wiki-derived datasets, demonstrating that while they have some utility, they must be used with caution. This caution stems from the fact that though the data contained in them originated from human contributions, in its final form in a resource, the data has been removed from its original quality checks. For example, in Wikidata, names may be copied from one language to another en masse, and in WikiAnn, the NER "annotation" is system output trained on relatively distant human supervision. + +We have spent so much of our paper describing these shortcomings to demonstrate that there is no "free lunch" when it comes to avoiding human annotation or quality checking of datasets. We believe that human annotation processes that are ultimately participatory—involving speakers of the languages as stakeholders and collaborators, not mere annotators for hire—like that of the MasakhaNER project which we have featured through the previous section and related projects (Nekoto et al., 2020; Orife et al., 2020) are the most important direction for developing language technology for lower-resourced languages. + +A discussion of efforts to annotate lower-resourced languages would not be complete without a discussion of the resources developed as + +part of the DARPA $^{12}$ LORELEI (Low Resource Languages for Emergent Incidents) program. The LORELEI program began in fall 2015, and a major thrust of the program was producing annotation for many lower-resourced languages (Strassel and Tracey, 2016). The Linguistic Data Consortium (LDC) is in the process of releasing the 31 language packs developed as a part of the program, which have been available to the primarily U.S.-based groups funded by the program for years. Tracey and Strassel (2020) stated that they planned to release 1-2 packs per month in 2020. However, as of November 2021, even though the research efforts of the program have largely concluded, only 7 language packs have been released to the general public: Akan, Amharic, Oromo, Somali, Tigrinya, Ukrainian, and Vietnamese. Each of these language packs is available for $200 USD to non-members of the LDC. While that is less expensive than typical LDC datasets, that cost can be prohibitively expensive for the speakers of the languages in the packs, who may live in countries with substantially lower wages and may not have the backing of a well-funded research lab. + +While it is unfortunate that so little data has been released to date and that the data is not freely available, the main contrast we would like to draw between LORELEI and efforts such as MasakhaNER is the involvement of the speakers of lower-resourced languages. Speakers of the languages included in the LORELEI datasets did not have any significant involvement in the construction of the datasets beyond their role as annotators. This is in no way unique to the LORELEI program; it is the status quo for annotation projects. + +Returning to the issues we raise in our introduction, we want to highlight that a confluence of factors come together to make a language lower-resourced, among them often a marginalization and/or minoritization of its speakers. We should consider whether it is ethical to have a paradigm in which the marginalized have no say in research that involves them, and in this case may not even be able to access the result of their work years after it is performed. Developing resources for languages that have had fewer resources created for them to date poses a unique set of ethical challenges that differs from higher-resourced language work, and + +engaging language speaker in a participatory fashion can help mitigate the risk of harm. + +# 5 Challenges + +Before we conclude, we wish to highlight challenges that we believe should be addressed as a part of continuing to develop resources and models for lower-resourced languages. + +Quality control for text resources. A popular way to gather multilingual data is through web crawling. These datasets include CCAligned, Multilingual C4 (mC4), OSCAR, ParaCrawl, WikiMatrix, and the aforementioned JW300. However, as detailed by (Kreutzer et al., 2022), there can be fairly serious quality issues when web-crawled data collection is not done carefully. Currently, when working with lower-resourced languages in large multilingual datasets, it is not a certainty (and sometimes, not even likely) that data is actually in the language that it claims to be. + +Reducing reliance on religious text. Due to the large amount of translation of religious texts into lower-resourced languages by religious organizations in attempts to spread their message, religious materials are a common place to look for parallel or monolingual data.[13] While religious texts can be a convenient source of data due to their broad coverage of languages, it is important to be aware of potential biases, especially when the religion of the text is not the predominant religion of the speakers of the language—and thus may not match their norms—or when the target task could be affected by bias from the religious data. + +JW300 (Agić and Vulić, 2019) is a source of parallel data for over 300 languages with roughly 100,000 parallel sentences per language pair on average. The data was scraped from jew.org, which is the website of the Jehovah's Witnesses. Despite being sourced from a religious organization, it contains articles on a variety of topics translated into many languages.[14] Inclusion of articles on a variety of topics does not fully prevent the potential for + +religious bias. As Azunre et al. (2021) demonstrate with a few masked sentence completion examples, a model trained on JW300 frequently produces completions with biblical names. Although these types of completions are not grammatically incorrect, they are suggestive of a low level of generalization beyond religious data. + +# 6 Conclusion + +In closing, we want to refer to the state of affairs highlighted by Bird (2020); some researchers are preoccupied with a data-centric view to the point of completely removing the need to involve speakers of the language in any part of the process. Through our discussion of the shortcomings of Wikidata and WikiAnn for the specific purposes that we have evaluated them, we demonstrated the gaps that are created when the dataset creation process is divorced from the speakers of the language. Our perspective on the process of dataset and model creation can be summarized through these guidelines we propose for future work on lower-resourced languages: + +1. Maximize interaction with and listening to the native speakers of languages included in resources you are developing. +2. When feasible, engage with speakers of included languages for quality control. +3. Consider the potential negative consequences of releasing datasets known to be of low-quality, as regardless of how you intend the resources to be used, they will likely be used for evaluation purposes. +4. Prefer human annotation by speakers of the language to automatic processes, and release all human annotator decisions (Davani et al., 2021; Prabhakaran et al., 2021). + +# References + +David Ifeoluwa Adelani, Jade Abbott, Graham Neubig, Daniel D'souza, Julia Kreutzer, Constantine Lignos, Chester Palen-Michel, Happy Buzaaba, Shruti Rijhwani, Sebastian Ruder, Stephen Mayhew, Israel Abebe Azime, Shamsuddeen H. Muhammad, Chris Chinenye Emezue, Joyce Nakatumba-Nabende, Perez Ogayo, Aremu Anuoluwapo, Catherine Gitau, Derguene Mbaye, Jesujoba Alabi, Seid Muhie Yimam, Tajuddeen Rabiu Gwadabe, Ignatius Ezeani, Rubungo Andre Niyongabo, Jonathan Mukiibi, Verrah Otiende, Iroro Orife, Davis David, Samba Ngom, Tosin Adewumi, Paul Rayson, Mofetoluwa Adeyemi, + +Gerald Muriuki, Emmanuel Anebi, Chiamaka Chukwuneke, Nkiruka Odu, Eric Peter Wairagala, Samuel Oyerinde, Clemencia Siro, Tobias Saul Bateesa, Temilola Oloyede, Yvonne Wambui, Victor Akinode, Deborah Nabagereka, Maurice Katusiime, Ayodele Awokoya, Mouhamadane MBOUP, Dibora Gebreyohannes, Henok Tilaye, Kelechi Nwaike, Degaga Wolde, Abdoulaye Faye, Blessing Sibanda, Orevaoghene Ahia, Bonaventure F. P. Dossou, Kelechi Ogueji, Thierno Ibrahima DIOP, Abdoulaye Diallo, Adewale Akinfaderin, Tendai Marengereke, and Salomey Osei. 2021. MasakhaNER: Named entity recognition for African languages. Transactions of the Association for Computational Linguistics, 9:1116-1131. + +Zeljko Agić and Ivan Vulić. 2019. JW300: A wide-coverage parallel corpus for low-resource languages. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 3204–3210, Florence, Italy. Association for Computational Linguistics. + +Paul Azunre, Salomey Osei, Salomey Addo, Lawrence Asamoah Adu-Gyamfi, Stephen Moore, Bernard Adabankah, Bernard Opoku, Clara Asare-Nyarko, Samuel Nyarko, Cynthia Amoaba, Esther Dansoa Appiah, Felix Akwerh, Richard Nii Lante Lawson, Joel Budu, Emmanuel Debrah, Nana Boateng, Wisdom Ofori, Edwin Buabeng-Munkoh, Franklin Adjei, Isaac Kojo Essel Ampomah, Joseph Otoo, Reindorf Borkor, Standylove Birago Mensah, Lucien Mensah, Mark Amoako Marcel, Anokye Acheampong Amponsah, and James Ben Hayfron-Acquah. 2021. Contextual text embeddings for Twi. arXiv preprint arXiv:2103.15963. + +Loic Barrault, Magdalena Biesialska, Ondrej Bojar, Marta R. Costa-jussa, Christian Federmann, Yvette Graham, Roman Grundkiewicz, Barry Haddow, Matthias Huck, Eric Joanis, Tom Kocmi, Philipp Koehn, Chi-kiu Lo, Nikola Ljubesic, Christof Monz, Makoto Morishita, Masaaki Nagata, Toshiaki Nakazawa, Santanu Pal, Matt Post, and Marcos Zampieri. 2020. Findings of the 2020 conference on machine translation (WMT20). In Proceedings of the Fifth Conference on Machine Translation, pages 1-55, Online. Association for Computational Linguistics. + +Fernando Benites, Gilbert François Duivesteijn, Pius von Däniken, and Mark Cieliebak. 2020. TRANSLIT: A large-scale name transliteration resource. In Proceedings of the 12th Language Resources and Evaluation Conference, pages 3265-3271, Marseille, France. European Language Resources Association. + +Steven Bird. 2020. Decolonising speech and language technology. In Proceedings of the 28th International Conference on Computational Linguistics, pages 3504-3519, Barcelona, Spain (Online). International Committee on Computational Linguistics. + +Aida Mostafazadeh Davani, Mark Díaz, and Vinodkumar Prabhakaran. 2021. Dealing with disagreements: Looking beyond the majority vote in subjective annotations. + +Junjie Hu, Sebastian Ruder, Aditya Siddhant, Graham Neubig, Orhan First, and Melvin Johnson. 2020. Xtreme: A massively multilingual multi-task benchmark for evaluating cross-lingual generalisation. In International Conference on Machine Learning, pages 4411-4421. PMLR. + +Ann Irvine, Chris Callison-Burch, and Alexandre Klementiev. 2010. Transliterating from all languages. In Proceedings of the 9th Conference of the Association for Machine Translation in the Americas: Research Papers, Denver, Colorado, USA. Association for Machine Translation in the Americas. + +Eric Joanis, Rebecca Knowles, Roland Kuhn, Samuel Larkin, Patrick Littell, Chi-kiu Lo, Darlene Stewart, and Jeffrey Mercher. 2020. The Nunavut Hansard Inuktitut-English parallel corpus 3.0 with preliminary machine translation results. In Proceedings of the 12th Language Resources and Evaluation Conference, pages 2562-2572, Marseille, France. European Language Resources Association. + +Julia Kreutzer, Isaac Caswell, Lisa Wang, Ahsan Wahab, Daan van Esch, Nasanbayar Ulzii-Orshikh, Allahsera Tapo, Nishant Subramani, Artem Sokolov, Claytone Sikasote, Monang Setyawan, Supheakmungkol Sarin, Sokhar Samb, Benoit Sagot, Clara Rivera, Annette Rios, Isabel Papadimitriou, Salomey Osei, Pedro Ortiz Suarez, Iroro Orife, Kelechi Ogueji, Andre Niyongabo Rubungo, Toan Q. Nguyen, Mathias Muller, Andre Muller, Shamsuddeen Hassan Muhammad, Nanda Muhammad, Ayanda Mnyakeni, Jamshidbek Mirzakhalov, Tapiwanashe Matangira, Colin Leong, Nze Lawson, Sneha Kudugunta, Yacine Jernite, Mathias Jenny, Orhan Firat, Bonaventure F. P. Dossou, Sakhile Dlamini, Nisansa de Silva, Sakine Cabuk Ballu, Stella Biderman, Alessia Battisti, Ahmed Baruwa, Ankur Bapna, Pallavi Baljekar, Israel Abebe Azime, Ayodele Awokoya, Duygu Ataman, Orevaoghene Ahia, Oghenefego Ahia, Sweta Agrawal, and Mofetoluwa Adeyemi. 2022. Quality at a Glance: An Audit of Web-Crawled Multilingual Datasets. Transactions of the Association for Computational Linguistics, 10:50-72. + +Quentin Lhoest, Albert Villanova del Moral, Yacine Jernite, Abhishek Thakur, Patrick von Platen, Suraj Patil, Julien Chaumond, Mariama Drame, Julien Plu, Lewis Tunstall, Joe Davison, Mario Šaško, Gunjan Chhablani, Bhavitvya Malik, Simon Brandeis, Teven Le Scao, Victor Sanh, Canwen Xu, Nicolas Patry, Angelina McMillan-Major, Philipp Schmid, Sylvain Gugger, Clément Delangue, Theo Matussière, Lysandre Debut, Stas Bekman, Pierric Cistac, Thibault Goehringer, Victor Mustar, François Lagunas, Alexander Rush, and Thomas Wolf. 2021. Datasets: A community library for natural language processing. In Proceedings of the 2021 Conference + +on Empirical Methods in Natural Language Processing: System Demonstrations, pages 175-184, Online and Punta Cana, Dominican Republic. Association for Computational Linguistics. + +Wilhelmina Nekoto, Vukosi Marivate, Tshinondiwa Matsila, Timi Fasubaa, Taiwo Fagbohungbe, Solomon Oluwole Akinola, Shamsuddeen Muhammad, Salomon Kabongo Kabenamualu, Salomey Osei, Freshia Sackey, Rubungo Andre Niyongabo, Ricky Macharm, Perez Ogayo, Orevaoghene Ahia, Musie Meressa Berhe, Mofetoluwa Adeyemi, Masabata Mokgesi-Selinga, Lawrence Okegbemi, Laura Martinus, Kolawole Tajudeen, Kevin Degila, Kelechi Ogueji, Kathleen Siminyu, Julia Kreutzer, Jason Webster, Jamiil Toure Ali, Jade Abbott, Iroro Orife, Ignatius Ezeani, Idris Abdulkadir Dangana, Herman Kamper, Hady Elsahar, Goodness Duru, Ghollah Kioko, Murhabazi Espoir, Elan van Biljon, Daniel Whitenack, Christopher Onyefuluchi, Chris Chinenye Emezue, Bonaventure F. P. Dossou, Blessing Sibanda, Blessing Bassey, Ayodele Olabiyi, Arshath Ramkilowan, Alp Oktem, Adewale Akinfaderin, and Abdallah Bashir. 2020. Participatory research for low-resourced machine translation: A case study in African languages. In Findings of the Association for Computational Linguistics: EMNLP 2020, pages 2144-2160, Online. Association for Computational Linguistics. + +Iroro Orife, Julia Kreutzer, Blessing Sibanda, Daniel Whitenack, Kathleen Siminyu, Laura Martinus, Jamiil Toure Ali, Jade Z. Abbott, Vukosi Marivate, Salomon Kabongo, Musie Meressa, Espoir Murhabazi, Orevaoghene Ahia, Elan Van Biljon, Arshath Ramkilowan, Adewale Akinfaderin, Alp Oktem, Wole Akin, Ghollah Kioko, Kevin Degila, Herman Kamper, Bonaventure Dossou, Chris Emezue, Kelechi Ogueji, and Abdallah Bashir. 2020. Masakhane - machine translation for africa. arXiv preprint arXiv:2003.11529. + +Chester Palen-Michel, Nolan Holley, and Constantine Lignos. 2021. SeqScore: Addressing barriers to reproducible named entity recognition evaluation. In Proceedings of the 2nd Workshop on Evaluation and Comparison of NLP Systems, pages 40-50, Punta Cana, Dominican Republic. Association for Computational Linguistics. + +Xiaoman Pan, Boliang Zhang, Jonathan May, Joel Nothman, Kevin Knight, and Heng Ji. 2017. Cross-lingual name tagging and linking for 282 languages. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1946–1958, Vancouver, Canada. Association for Computational Linguistics. + +Vinodkumar Prabhakaran, Aida Mostafazadeh Davani, and Mark Diaz. 2021. On releasing annotator-level labels and information in datasets. In Proceedings of The Joint 15th Linguistic Annotation Workshop (LAW) and 3rd Designing Meaning Representations + +(DMR) Workshop, pages 133-138, Punta Cana, Dominican Republic. Association for Computational Linguistics. + +Afshin Rahimi, Yuan Li, and Trevor Cohn. 2019. Massively multilingual transfer for NER. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 151-164, Florence, Italy. Association for Computational Linguistics. + +Jonne Sälevä and Constantine Lignos. 2022. Paranames: A massively multilingual entity name corpus. arXiv preprint arXiv:2202.14035. + +Stephanie Strassel and Jennifer Tracey. 2016. LORELEI language packs: Data, tools, and resources for technology development in low resource languages. In Proceedings of the Tenth International Conference on Language Resources and Evaluation (LREC'16), pages 3273-3280, Portož, Slovenia. European Language Resources Association (ELRA). + +Jennifer Tracey and Stephanie Strassel. 2020. Basic language resources for 31 languages (plus English): The LORELEI representative and incident language packs. In Proceedings of the 1st Joint Workshop on Spoken Language Technologies for Under-resourced languages (SLTU) and Collaboration and Computing for Under-Resourced Languages (CCURL), pages 277–284, Marseille, France. European Language Resources association. \ No newline at end of file diff --git a/towardmoremeaningfulresourcesforlowerresourcedlanguages/images.zip b/towardmoremeaningfulresourcesforlowerresourcedlanguages/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..7b7ffc5ee4865196ce3fd7239fe1e236ccc12d12 --- /dev/null +++ b/towardmoremeaningfulresourcesforlowerresourcedlanguages/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:33d7318fa0de1db63c207e4c1ae5ccebdf7b73ca830371a13d5a6b724f82b84f +size 191924 diff --git a/towardmoremeaningfulresourcesforlowerresourcedlanguages/layout.json b/towardmoremeaningfulresourcesforlowerresourcedlanguages/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..2693dd9f4b051e84f9774f7e3b6749d5feffaceb --- /dev/null +++ b/towardmoremeaningfulresourcesforlowerresourcedlanguages/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e3d59b0f34ca2e56c6c8ac01e6f67f929a2ac4046c4ea9a761a306a226af30da +size 231233 diff --git a/towardsadversariallyrobusttextclassifiersbylearningtoreweightcleanexamples/a5a72f04-44a6-40dd-8c5c-68fa656bb6fb_content_list.json b/towardsadversariallyrobusttextclassifiersbylearningtoreweightcleanexamples/a5a72f04-44a6-40dd-8c5c-68fa656bb6fb_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..3793bb488dc000b65cfb8da5efc960bc6deb4e9b --- /dev/null +++ b/towardsadversariallyrobusttextclassifiersbylearningtoreweightcleanexamples/a5a72f04-44a6-40dd-8c5c-68fa656bb6fb_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eee9a97f0d29e2bc579270e63bdccf60d3c5e4f0b9ec38319e968e67f9a6d7d3 +size 106189 diff --git a/towardsadversariallyrobusttextclassifiersbylearningtoreweightcleanexamples/a5a72f04-44a6-40dd-8c5c-68fa656bb6fb_model.json b/towardsadversariallyrobusttextclassifiersbylearningtoreweightcleanexamples/a5a72f04-44a6-40dd-8c5c-68fa656bb6fb_model.json new file mode 100644 index 0000000000000000000000000000000000000000..a33b12527c531c2da60d311db0a12798b20aa871 --- /dev/null +++ b/towardsadversariallyrobusttextclassifiersbylearningtoreweightcleanexamples/a5a72f04-44a6-40dd-8c5c-68fa656bb6fb_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:67315b9a2fcaca55ac9ba030396ad23921d1fe45ec6c104c371ada3f68572588 +size 132728 diff --git a/towardsadversariallyrobusttextclassifiersbylearningtoreweightcleanexamples/a5a72f04-44a6-40dd-8c5c-68fa656bb6fb_origin.pdf b/towardsadversariallyrobusttextclassifiersbylearningtoreweightcleanexamples/a5a72f04-44a6-40dd-8c5c-68fa656bb6fb_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..19c4d34021ad9fcf616c10499f79d47a0f832a0e --- /dev/null +++ b/towardsadversariallyrobusttextclassifiersbylearningtoreweightcleanexamples/a5a72f04-44a6-40dd-8c5c-68fa656bb6fb_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3ad2be5bb61129b07bff91ec378858b4390fb4c9a3affc81cbf8c4d699c7c412 +size 2303265 diff --git a/towardsadversariallyrobusttextclassifiersbylearningtoreweightcleanexamples/full.md b/towardsadversariallyrobusttextclassifiersbylearningtoreweightcleanexamples/full.md new file mode 100644 index 0000000000000000000000000000000000000000..079154226b7a1f8c68917621138f15b7ace046dd --- /dev/null +++ b/towardsadversariallyrobusttextclassifiersbylearningtoreweightcleanexamples/full.md @@ -0,0 +1,498 @@ +# Towards Adversarily Robust Text Classifiers by Learning to Reweight Clean Examples + +Jianhan Xu $^{1,2*}$ , Cenyuan Zhang $^{1,2*}$ , Xiaoqing Zheng $^{1,2}$ , Linyang Li $^{1,2}$ , Cho-Jui Hsieh $^{3}$ , Kai-Wei Chang $^{3}$ , Xuanjing Huang $^{1,2}$ + +$^{1}$ School of Computer Science, Fudan University, Shanghai, China + +$^{2}$ Shanghai Key Laboratory of Intelligent Information Processing + +$^{3}$ Department of Computer Science, University of California, Los Angeles, USA + +{jianhanxu20, cenyuanzhang17, zhengxq}@fudan.edu.cn + +{chohsieh, kwchang}@cs.ucla.edu + +# Abstract + +Most of the existing defense methods improve the adversarial robustness by making the models adapt to the training set augmented with some adversarial examples. However, the augmented adversarial examples may not be natural, which might distort the training distribution, resulting in inferior performance both in clean accuracy and adversarial robustness. In this study, we explore the feasibility of introducing a reweighting mechanism to calibrate the training distribution to obtain robust models. We propose to train text classifiers by a sample reweighting method in which the example weights are learned to minimize the loss of a validation set mixed with the clean examples and their adversarial ones in an online learning manner. Through extensive experiments, we show that there exists a reweighting mechanism to make the models more robust against adversarial attacks without the need to craft the adversarial examples for the entire training set. + +# 1 Introduction + +Even though deep neural networks have achieved impressive performance on many natural language processing (NLP) tasks, they are vulnerable to adversarial examples intentionally crafted under certain semantic and syntactic constraints (Jia and Liang, 2017; Ebrahimi et al., 2017; Gao et al., 2018a; Zhao et al., 2018; Cheng et al., 2019; Zheng et al., 2020). The existence and pervasiveness of adversarial examples raise serious concerns, especially when deploying such NLP models to security-sensitive applications. + +Recently, many methods have been proposed to defend against adversarial attacks for neural NLP models (Miyato et al., 2017a; Sato et al., 2018a; Jiang et al., 2020; Li and Qiu, 2020; Zhu et al., 2020; Zhou et al., 2021; Dong et al., 2021; Si et al., 2021). Existing defense methods usually augment + +the clean training examples with the adversarial ones in one way or another in the training stage and fit the models on the augmented training set. However, the introduced adversarial examples may not be natural, which may even hurt the distribution of original training examples, resulting in lower performance on both clean and adversarial test sets. Besides, these methods usually need to generate the adversarial examples for an entire training set, which is computationally intensive. We hypothesize that one of the reasons that NLP models are not robust is because they overfit to training data biases (Bras et al., 2020) — the training data is biased towards a certain distribution, so the resulting model can be broken under some perturbations. Despite augmenting training set by adversarial examples can partially mitigate this problem, are there better and more direct ways to calibrate the training distribution without introducing additional training samples? This motivates us to investigate whether there exists a reweighting mechanism to calibrate the training distribution and lead to robust models. + +We propose to train adversarially robust text classifiers by a sample reweighting method, named WETAR (Weighting Examples Towards Adversarial Robustness), in which the example weights are learned to minimize the loss of a validation set mixed with the clean examples and their corresponding adversarial ones. We explore two ways to add adversarial samples to a validation set. A static way is to generate the adversarial examples from the clean data in the validation set before the training begins, and the generated examples remain unchanged throughout the entire training process. The other way is to dynamically craft adversarial examples at every iteration to test the robustness of models against test-time attacks. + +Compared with exiting defense methods, our approach can achieve competitive performance without the need to perturb the training set. We show that there indeed exists a reweighting mechanism to + +make the models robust without enlarging the clean training set with any adversarial examples. We determine the example weights of the current batch at every training iteration by an online reweighting method that performs validation at an additional small size. This study is among the first ones to improve the adversarial robustness of NLP neural models by reweighing training examples under the guidance of a relatively small validation set. Through extensive experiments on three different text classification benchmark datasets, we show that our method can significantly increase the robustness to adversarial examples crafted by three representative adversarial attack algorithms. + +# 2 Related Work + +# 2.1 Text Adversarial Defense + +The goal of adversarial defenses is to learn a model capable of achieving high test accuracy on both clean and adversarial examples. Recently, many defense methods have been proposed to defend against text adversarial attacks which can roughly be divided into two categories: empirical (Miyato et al., 2017b; Sato et al., 2018b; Zhou et al., 2021; Dong et al., 2021) and certified (Jia et al., 2019; Huang et al., 2019; Ye et al., 2020) methods. + +Adversarial data augmentation is one of the most effective empirical defenses (Ren et al., 2019a; Jin et al., 2020; Li et al., 2020) for NLP models. During the training time, they replace a word with one of its synonyms to create adversarial examples. By augmenting these adversarial examples with the original training data, the model is robust to such perturbations. Zhou et al. (2021) and Dong et al. (2021) relax a set of discrete points (a word and its synonyms) to a convex hull spanned by the word embeddings of all these points, and use a convex hull formed by a word and its synonyms to capture word substitutions. Adversarial training (Miyato et al., 2017b; Zhu et al., 2020) is another one of the most successful empirical defense methods by adding norm-bounded adversarial perturbations to word embeddings and minimizes the resultant adversarial loss. The downside of existing empirical methods is that failure to discover an adversarial example does not mean that another more sophisticated attack could not find one. To address this problem, some certified defenses (Jia et al., 2019; Huang et al., 2019; Ye et al., 2020) have been introduced to guarantee the robustness to certain specific types of attacks. However, the existing certified de + +fense methods make an unrealistic assumption that the defenders can access the synonyms used by the adversaries. They would be broken by more sophisticated attacks by using synonym sets with large sizes (Jin et al., 2020) or generating synonyms dynamically with BERT (Li et al., 2020). + +Most of the existing defense methods improve the robustness by making the models adapt to the training set augmented with adversarial examples crafted by adding adversarial perturbations to discrete tokens or distributed embeddings. In contrast, our method does not need to generate adversarial examples for the entire training set and only requires a relatively small validation set to be augmented with the adversarial instances. Besides, we improve the adversarial robustness by learning to assign weights to training examples based on the loss estimated on a validation set instead of exposing the models to certain perturbations during the training process. + +# 2.2 Weighting Examples towards Robustness + +Various methods of weighting examples have been proposed to train robust models against training set bias including class imbalance (Lin et al., 2017; Cui et al., 2019) or noisy data (Shin et al., 2020; Wang et al., 2021) or both (Ren et al., 2018). In response to these problems, different weights are assigned to examples in order to match one distribution to another, and the models are trained to optimize the weighted training loss encouraging learning the examples with more weights. + +Recently, incorporating the weighting method to improve the robustness against adversaries also have been investigated in the image domain. However, they all use the weighting method to assign weights to the adversarial examples instead of the clean examples. Wang et al. (2020) weight training examples in order to reduce the KL-divergence between the predicted logits of each clean example and that of the adversarial one. Zhang et al. (2021) take into account the geometric distance from data points to the decision boundary and reweight training data based on the difficulty of attacking these data points. To better defend against targeted adversarial attacks, Kim et al. (2021) proposed to reweight training examples based on the entropies of their class softmax probabilities and suggested giving more weights to the examples with higher entropies whose labels could be easily flipped. + +Different from existing reweighting methods, we + +argue that in order to train a model that performs well in both clean accuracy and adversarial robustness, it only needs to construct a small validation set augmented with adversarial examples to guide training. In addition, we show that the adversarial examples can be added to the original validation set in a static or dynamic way. The constructed validation also can be used for the model selection. This study is among the first ones to improve the adversarial robustness of neural models by reweighing training examples in the language domain. + +# 3 Method + +We design a weighting method to improve the adversarial robustness of text classifiers by learning to reweight examples, partly inspired by the meta-learning algorithm proposed by Ren et al. (2018) from the image domain. In particular, we consider both clean accuracy and adversarial robustness by reweighting the training examples according to their similarity to the gradient descent of the validation loss, where the validation set is augmented with the adversarial examples. During the training, we ensure that a clean example and its corresponding adversary are present in the same mini-batch, which teaches the models how to balance the two training objectives. We also show how to make model selection based on the learned weight distribution over the training examples. + +For text classification, a neural network-based classifier $f(x)$ with a set of learnable parameters $\theta$ maps an input text $x \in \mathcal{X}$ to a label $y \in \mathcal{Y}$ . Given a training set $\mathcal{D} = \{(x_i, y_i)\}_{i=1}^N$ , we assume there is a validation set $\mathcal{D}^v = \{(x_i^v, y_i^v)\}_{i=1}^M$ that consists of two parts: a set of clean examples $\mathcal{D}^c$ , and a set of adversarial examples $\mathcal{D}^a$ generated by a certain attack algorithm from $\mathcal{D}^c$ . The adversarial validation set $\mathcal{D}^a$ can be generated for $\mathcal{D}^c$ statically or dynamically (see Subsection 3.2). We consider a loss function $L_{\theta}(x, y)$ , and the goal of regular training is to find a solution of $\theta$ that minimizes the expected loss $\frac{1}{N} \sum_{i=1}^{N} L_{\theta}(x_i, y_i)$ for the training set, where each instance is equally weighted. + +# 3.1 Learning to Reweight Examples + +In this study, we guide the training by a relatively small validation set $\mathcal{D}^v$ mixed with clean and adversarial examples through a weighted loss. Thus, each training example $x_{i}$ would be assigned with a weight $w_{i}$ , and we learn to reweight the examples + +by minimizing the following weighted loss: + +$$ +\boldsymbol {\theta} ^ {*} (\boldsymbol {w}) = \underset {\boldsymbol {\theta}} {\arg \min } \sum_ {i = 1} ^ {N} w _ {i} L _ {\boldsymbol {\theta}} \left(x _ {i}, y _ {i}\right), \tag {1} +$$ + +where $\boldsymbol{w} = \{w_{i}\}_{i=1}^{N}$ can be viewed as training hyperparameters whose values are unknown from the beginning and can be optimized based on the validation set $\mathcal{D}^v$ : + +$$ +\boldsymbol {w} ^ {*} = \underset {w _ {i} \geq 0} {\arg \min } \frac {1}{M} \sum_ {i = 1} ^ {M} L _ {\boldsymbol {\theta} ^ {*} (\boldsymbol {w})} \left(x _ {i} ^ {v}, y _ {i} ^ {v}\right), \tag {2} +$$ + +where we use superscript $v$ to denote validation set and subscript $i$ to denote the $i$ -th example. + +Determining the optimal $\boldsymbol{w}^*$ is a special case of the bilevel optimization problem where one problem is nested within another, and every single optimization can be very expensive. It could be worse when the adversarial validation set is created in a dynamic way, which is necessary to enhance the models in their ability to defend against test-time attacks. We use an online meta-learning algorithm (Ren et al., 2018) for reweighting training examples. At every training step, a mini-batch $\{x_i, y_i\}_{i=1}^n$ is sampled from the training set $\mathcal{D}$ , and $n$ is the minibatch size ( $n \ll N$ ). At the same time, another mini-batch $\{x_i^v, y_i^v\}_{i=1}^m$ is also sampled from the validation set $\mathcal{D}^v$ . We examine the gradient descent of $n$ sampled training examples on the loss surface and reweight them according to their similarity to the descent direction of $m$ validation data. + +We need to determine the importance of each training sample $(x_{i},y_{i})$ at every training step for a mini-batch sampled from $\mathcal{D}^v$ . Following (Koh and Liang, 2017), we assume the weight of each training sample $(x_{i},y_{i})$ is perturbed by $\epsilon_{i}$ , and correspondingly the parameters are updated to $\theta_t^\prime$ according to the descent direction of the loss on the mini-batch at step $t$ as follows: + +$$ +\boldsymbol {\theta} _ {t} ^ {\prime} = \boldsymbol {\theta} _ {t} - \tau \nabla_ {\boldsymbol {\theta} _ {t}} \sum_ {i = 1} ^ {n} \epsilon_ {i} L _ {\boldsymbol {\theta} _ {t}} \left(x _ {i}, y _ {i}\right), \tag {3} +$$ + +where $\tau$ is the learning rate. To get a cheap estimate of $w_{i}$ at step $t$ , we calculate the gradient $g_{\epsilon_i}$ of $\epsilon_{i}$ by taking a single gradient descent step on a minibatch of validation samples: + +$$ +g _ {\epsilon_ {i}} = \frac {\partial}{\partial \epsilon_ {i}} \frac {1}{m} \sum_ {i = j} ^ {m} L _ {\boldsymbol {\theta} _ {t} ^ {\prime}} \left(x _ {j} ^ {v}, y _ {j} ^ {v}\right) | _ {\epsilon_ {i} = 0}. \tag {4} +$$ + +We then estimate that the importance value $\tilde{w}_i$ of sample $(x_i, y_i)$ at step $t$ by comparing the opposite direction of gradient $g_{\epsilon_i}$ accumulated at $\epsilon_i$ when take adversarial validation mini-batch $\{x_i^v, y_i^v\}_{i=1}^m$ into account: + +$$ +\tilde {w} _ {i} = \max \left(- g _ {\epsilon_ {i}}, 0\right), +$$ + +$$ +w _ {i} = \frac {\tilde {w} _ {i}}{\sum_ {i} \tilde {w} _ {i} + \delta}. \tag {5} +$$ + +where $\delta = 1$ if $\sum_{i}\tilde{w}_{i} = 0$ , and $\delta = 0$ otherwise. We consider normalizing the weights of all training examples in a mini-batch so that they sum up to one unless all of them are 0. Once each training example is assigned with a weight under the guidance of the gradients calculated on the validation samples, we can update the parameters with the gradient accumulated through the reweighted loss at step $t$ as follows: + +$$ +\boldsymbol {\theta} _ {t + 1} = \boldsymbol {\theta} _ {t} - \tau \nabla_ {\boldsymbol {\theta} _ {t}} \sum_ {i = 1} ^ {n} w _ {i} L _ {\boldsymbol {\theta} _ {t}} \left(x _ {i}, y _ {i}\right). \tag {6} +$$ + +We refer to Algorithm 1 in Appendix A for details. + +# 3.2 Adversarial Validation Set Construction + +We here describe two ways to construct a validation set whose subset of adversarial examples can be generated in a static or dynamic manner. If a clean example $(x_{i}^{c},y_{i}^{c})$ is sampled to be included in a validation mini-batch, we would add into the same mini-batch its adversarial example $(x_{i}^{a},y_{i}^{a})$ , where $y_{i}^{c} = y_{i}^{a}$ , crafted by some attack algorithms. + +In the static construction method, for every clean example in the validation set, its corresponding adversarial one is generated before the training begins, and the generated adversarial examples remain unchanged throughout the training process. If a clean example is randomly selected to appear in a minibatch, its adversary generated in advance will be retrieved and included in the same mini-batch. + +Although generating the adversarial examples in a static way can speed up the training process, it is questionable whether the resulting models can still perform well under test-time attacks since they should be evaluated on the adversarial examples crafted on the fly against the robustly trained models rather than the original ones. Therefore, we propose to use another dynamic strategy to generate adversarial examples, in which we apply an attack algorithm to craft the adversarial examples for randomly selected clean ones against the current model at every iteration. In practice, we generate + +all required adversarial examples every one or two epochs to reduce the computational cost. + +Some previous studies show that the models tend to overfit the adversarial examples, and their performance on the clean data will drop if too many adversarial examples are used. Therefore, we use a similar training strategy. In a mini-batch, we randomly select $\rho$ percent (say $50\%$ ) of the clean data in the validation set and generate their adversarial examples from them using a certain attack algorithm. We then merge these adversarial examples with the clean ones to form a final validation set. + +If the static method is used to construct the validation set, the weight distribution of training examples will stabilize to some equilibrium distribution as the number of training epochs increases. Such a weight distribution is calculated for each epoch by accumulating the weights assigned to the sampled examples in every mini-batch and then normalizing the weights of all training examples to sum up to one. To compute the difference between two weight distributions before and after an epoch, we use the Wasserstein distance instead of the popular KL-divergence since the weights of many training examples will be assigned to zeros and the former is more suitable for this situation than the latter. As the training progresses, we can obtain a series of weight distributions and their differences. If such a difference does not reduce significantly for multiple epochs, we say that the distribution has stabilized. The first model obtained with its weight distribution stabilized is chosen as the final model. When the dynamic construction method is used, there will be a "spear-and-shield" battle between defender and attacker. Although the difference in weight distribution fluctuates more with the dynamic construction method than the static one, the trend of the overall decline in the distribution difference still can be used for model selection. + +# 4 Experiments + +In the following, we first evaluate the proposed method of WETAR by comparing it to four baseline methods both in clean accuracy and adversarial robustness on three text classification benchmarks. Then, we would like to study how the choice of an attack algorithm to construct the validation sets at the training stage impact the adversarial robustness of resulting models under different attacks. Finally, we investigate whether our method combined with adversarial data augmentation can further improve + +
DatasetsMethodsClean%TextFollowerBERT-AttackTextBugger
Aua%Suc%#QueryAua%Suc%#QueryAua%Suc%#Query
SST-2Base93.25.694.089.26.293.3111.727.969.847.5
FreeLB93.98.591.495.49.290.2118.632.065.949.5
FreeLB++92.914.284.8117.611.787.4139.636.760.551.9
ADA89.517.880.080.013.884.5141.430.765.553.6
WETAR-S92.926.271.7145.324.373.5183.951.744.156.6
WETAR-D93.429.668.2153.231.466.2207.255.340.657.1
AGNEWSBase94.319.679.3329.322.975.9432.341.456.3186.8
FreeLB94.928.070.4380.329.069.4479.847.949.4196.4
FreeLB++95.132.066.6412.929.968.8487.953.144.4193.2
ADA94.641.156.5424.432.665.5508.752.045.1220.8
WETAR-S94.147.749.4464.056.440.1602.368.527.2242.9
WETAR-D94.254.442.5472.057.539.2595.068.827.2235.7
MRBase87.28.390.5107.99.988.7141.729.965.753.6
FreeLB88.08.490.5111.09.289.6139.631.863.954.4
FreeLB++88.311.986.6122.411.087.6153.434.261.356.2
ADA85.114.383.1128.211.386.7148.334.060.057.8
WETAR-S86.630.464.9156.631.763.4206.948.144.663.7
WETAR-D86.224.971.2151.928.467.1203.448.743.662.9
+ +Table 1: The experimental results of our WETAR and baselines on SST-2, AGNEWS, and MR datasets. We use WETAR-S to denote the setting where the adversarial examples are constructed by the static method and WETAR-D to that by the dynamic method. The best results are highlighted in bold font. + +the robustness of text classifiers. + +We conducted experiments on two different tasks on three widely-used datasets: Stanford Sentiment Treebank (SST-2) (Socher et al., 2013), AG-News corpus (AGNEWS) (Zhang et al., 2015) and Movie Reviews (MR) (Pang and Lee, 2005). SST-2 consists about 67,000 training sentences for binary classification and MR contains about 9,000 movie reviews for training. AGNEWS has four categories pertaining about 30,000 new articles. For each dataset, we randomly select one-tenth examples from the training set to form a validation set from which the adversarial examples will be generated to guide the training and select the model. In Section 4, all experimental results are obtained over three runs with different initialization. We refer to Appendix B for more implementation details. + +# 4.1 Attack Algorithms + +The following three adversarial attack methods are used to evaluate the robustness of models, reimplemented by TextAttack toolkit (Morris et al., 2020). + +TextFollower (Jin et al., 2020) uses a greedy searching method, ranking the words in an input sequence based on the predicted changes before and after deleting them. Counter-fitted embeddings are used to find synonyms to replace the selected words. + +BERT-Attack (Li et al., 2020) uses a BERT-based model to estimate an importance score of each subword for the prediction, and generate the top-K candidate sub-words by the masked language model + +to replace the word with the highest score. + +TextBugger (Li et al., 2019) locates the vulnerable words by calculating the changes in predictions before and after removing them from a text. Different from TextFooer and BERT-Attack, both character-level perturbation and word-level perturbation will be applied to generate adversarial examples. + +When investigating how the choice of an attack algorithm to construct the validation set impact the performance of models, we also take two other attack methods of PWWS (Ren et al., 2019b) and DeepWordBug (Gao et al., 2018b) into consideration for comprehensive assessment. + +Following (Li et al., 2021), four different metrics are used to evaluate the generation and robustness of the models: (1) Clean accuracy, denoted as $\text{Clean\%}$ , is defined as the model's classification accuracy on a clean test set; (2) Accuracy under attacks, denoted as $Aua\%$ , is the model's accuracy under some adversarial attack; (3) Attack success rate, denoted as $Suc\%$ , is calculated as the number of texts successfully perturbed by an attack algorithm divided by the number of all texts attempted; (4) The number of queries, denoted as $Query\%$ , is the average number of times the attacker queries the model to form a successful attack. + +# 4.2 Baseline methods + +We evaluate the proposed method by comparing it with several representative methods. We primarily compare with the following recently proposed + +defense methods, + +Base fine-tunes a pre-trained BERT on a training set consisting of clean examples. + +FreeLB (Zhu et al., 2020) adds norm-bounded adversarial perturbations to the input's word embeddings using a gradient-based method, and enlarges the batch size with diversified adversarial samples under such norm constraints. + +FreeLB++ is a variant of FreeLB, which increases the number of ascent steps to further improve the adversarial robustness of models (Li et al., 2021). They demonstrated through extensive experiments that FreeLB and its variant of FreeLB++ outperforms other defense methods including TAVAT (Li and Qiu, 2020) and DNE (Zhou et al., 2021). Therefore, we only report the results produced by FreeLB and FreeLB++ for comparison. + +Adversarial Data Augmentation (ADA) is one of the widely used methods (Dong et al., 2021; Si et al., 2021; Zhou et al., 2021). During the training, they replace a word with one of its synonyms that maximizes the prediction loss. By augmenting these adversarial examples with the original training data, the model is robust to such perturbations. + +# 4.3 Results + +Table 1 shows the clean accuracy and adversarial robustness achieved by different defense methods under three attack algorithms. We use TextFoolor as the attack algorithm to generate the adversarial examples for validation set construction because it was reported that TextFoolor can generate high-quality, semantics-preserved adversarial examples (Hauser et al., 2021). For a fair comparison, ADA also use TextFoolor to craft the adversarial examples for data augmentation. Unless otherwise specified, we set to $50\%$ the percent of the clean data in the validation set from which the corresponding adversarial examples will be generated. We use WETAR-S to denote the setting where the adversarial examples are constructed by the static method and WETAR-D to that by the dynamic method. + +From these numbers, a handful of trends are readily apparent: (1) The proposed WETAR achieved the highest robustness across three text classification datasets under different adversarial attacks over all the baseline methods while suffering little to no performance drop on the clean input data; (2) The models trained with FreeLB++ achieved the better performance than others in clean accuracy. However, the improvement in adversarial ro + +bustness is relatively small compared to WETAR; (3) The models trained with ADA method outperformed those trained with other baseline methods in adversarial robustness, but they suffer a significant drop in clean accuracy, especially on SST-2 and MR $\text{datasets}^2$ . + +WETAR-D performed better than WETAR-S on SST-2 and AGNEWS datasets while the latter outperformed the former on MR dataset. One possible explanation is that the size of MR training set is much smaller than those of SST-2 and AGNEWS. For a given maximum number of training epochs, the number of mini-batches is relatively small when the models are trained on MR dataset. It would be hard for WETAR-D to tune the models sufficiently within a limited number of epochs since WETAR-D introduces the dynamics into the training process and requires more training epochs to converge. + +# 4.4 Impact of the Types of Augmented Adversarial Examples + +To better understand the impact of different attack algorithms used to construct the adversarial validation examples on the performance, we report in Table 2 accuracy achieved by WETAR and ADA methods under different attacks on the MR dataset. We found that both WETAR-D and WETAR-S perform better than ADA under almost all attack algorithms. Besides, WETAR is not sensitive to the choice of the attack algorithm used to construct validation set at the training stage, whereas ADA shows to be more sensitive to the type of attack algorithm applied to generate adversarial examples for data augmentation. Although the choice of attack algorithm has little impact on the adversarial robustness, the models trained by WETAR integrated with BERT-Attack achieved slightly better performance on MR dataset. + +# 4.5 Impact of the Proportion of Adversarial Examples in the Validation Set + +We conducted some experiments on SST-2 dataset to investigate the impact of different proportions of adversarial examples in the validation set. Figure 1 shows the clean accuracy and accuracy under attack of our WETAR where BERT-Attack was used to generate adversarial examples for validation set construction. We evaluated the adversarial robustness of the resulting models with TextFollower. + +
MethodCleanTFLBTATBGPWWSDWB
ADA-TFL85.114.311.334.034.123.9
ADA-BTA84.08.624.123.724.019.7
ADA-TBG87.08.710.929.426.314.5
Generating Adversarial Examples Statically
WETAR-S-TFL86.630.431.748.139.843.3
WETAR-S-BTA86.332.132.448.141.443.4
WETAR-S-TBG86.022.627.043.335.236.8
Generating Adversarial Examples Dynamically
WETAR-D-TFL86.224.928.448.738.939.2
WETAR-D-BTA86.626.028.045.638.238.6
WETAR-D-TBG86.529.832.148.340.841.2
+ +Table 2: Accuracy achieved with various training methods under different attacks on the MR dataset. Those listed in the rows are training methods, and those in the columns are attacking algorithms. "Clean" denotes the clean accuracy. "TFL", "BTA", "TBG", and "DWB" denotes TextFooler, BERT-Attack, TextBugger and DeepWordBug respectively. + +As shown in Figure 1, we found that WETAR in general can provide a great increase in robustness only with little sacrifice in clean accuracy. WETAR is also insensitive to the proportions of adversarial examples that are added into the validation set. However, adding too many adversarial examples to the validation set will hurt the performance of models in both clean accuracy and adversarial robustness. We do get surprised that our method using a validation set that only contains clean examples can make the models more robust against the word substitution-based attacks. We believe that our training method can prevent the models from overfitting to a pre-defined training set, which leads to more robust models. + +![](images/d4f9c50c6aa2241208f80c98fac47d618b4334e629acccb9075720632559e9d3.jpg) +Figure 1: The impact of the proportion of adversarial samples in the validation set on MR dataset. (a) clean accuracy versus various proportions of adversarial samples. (b) the accuracy under attack versus various proportions of adversarial samples. + +# 4.6 Combined Approach + +We carried out some experiments to study whether the robustness of models can be further improved by combining WETAR with the data augmentation + +method. In this combination approach, we add some adversarial examples to the training set as the adversarial data augmentation. During the training process, WETAR will assign the weights to both the clean and adversarial examples based on the gradient direction of a small validation set. + +![](images/3693e45cd5e2503b1f64192fe01f0d2e2e440d899e74c57d3a56d243cc359743.jpg) +Figure 2: The robustness results achieved by WETAR combined with adversarial data augmentation. (a) WETAR with the static construction method. (b) WETAR with the dynamic construction method. + +![](images/cbae989cf6c7482b4545b42c43887b3e3f1ebc83acb19267ace819b8a93450e8.jpg) + +We show in Figure 2 the experimental results achieved by WETAR with validation set generated statically and dynamically under TextFooer attack on three datasets. Augmenting the training set with adversarial examples can further improve the robustness of models no matter WETAR-S or WETAR-D is used for training. Like the results reported in Section 4.3, WETAR-D outperformed WETAR-S on SST-2 and AGNEWS while the latter performed better than the former on MR dataset. + +# 5 Analysis + +We in this section give some analyses on the interpretability of the proposed reweighting method. First, we experimentally analyze the changes in the weight distributions over the training samples produced by our reweighting method. Base on this analysis, we propose an empirical method for model selection. Second, we visualize the weights obtained by the proposed method. + +# 5.1 Weight Distribution + +To better understand the changes in the weight distributions over the training examples, we show in Figure 3 the weight distributions produced by WE-TAR at different epochs. Those weight distributions are obtained by normalizing the weights of all training samples at each epoch. To show whether and how those weight distributions will converge to some distribution, we use the Wasserstein distance to compute the difference between two weight distributions before and after each epoch. We remove all examples with zeros weights when visualizing the distributions. + +![](images/772e636bbdc6883223ffcebc0bfac4ffde5738bebf6762ed5740541827d62fca.jpg) + +![](images/0ca886857df19cdc0b3857d40e50210d1545747d52d0c85b96c66663e96e5853.jpg) + +![](images/38a4bfda20f9a0df2d62368151a52877bcc3a1711d8af6b627c5fdcabcf81c0f.jpg) + +![](images/64dc88cb0aed706b94f8f7d8a514f37a314f6acd6d1f6e8ca6d4218f758282c9.jpg) + +![](images/20a559300fe3639a04db710f6b62091e94fd87fb29a2a571ead761794f9e300e.jpg) +Figure 3: The weight distributions produced by WETAR-S and WETAR-D on MR datasets. Sub-figures (a), (b), and (c) show the weight distributions produced by WETAR-S at epoch 2, 5, and 8 respectively. Sub-figures (e), (f), and (g) give the same distributions produced by WETAR-D at epoch 2, 5, and 8. Sub-figures (d) and (h) plot the curves of accuracy under attack and the Wasserstein distance between two weight distributions at every two epochs yielded by WETAR-S and WETAR-D respectively. + +![](images/5e62a94a2d1ca76a27a9682234ce2852bfbffe950b2d99c1f60c9e95f4b3af82.jpg) + +![](images/83c4220cd4868cc02f5e9dbee683686e75aab5301f66e715cf6caa5f7489458e.jpg) + +![](images/719af9b6310f23c12e334215ae7c868fc0da68bf8be71d02cb364dbcc7d91809.jpg) + +As shown in Figure 3, we found that the performance of robustness generally increases when the differences in the weight distributions shrink as the number of epochs grows. For examples, the weight distribution starts to converge after 8 epochs when WETAR-S is used to train the model. Therefore, we select the model as the final one when the distance between two weight distributions is small (e.g., less than a given threshold). When WETAR-D is applied, there are some drops at the end of training process in adversarial robustness. One possible explanation is that after a long "spear-and-shield" battle, it is hard for any attack algorithm to generate good adversarial examples for a robust model, and the generated adversarial examples after that will go too far from the original ones, which hurts the decision boundary of the model and results in inferior performance in robustness. We give more experimental results about the weight distributions on AGNEWS and SST-2 in Appendix C. + +# 5.2 Visualization + +Learning to reweight scheme assigns different weights to examples in a mini-batch under the guidance of the adversarial validation set during the training phase. We illustrate the proposed reweighting process in Figure 4 to provide a better understanding of our method. + +In the Figure 4, we plot the representations using t-SNE visualization by analyzing the final hidden states corresponding to [CLS] token of the model in the last training epoch. Visualization of + +more epochs are provided in Appendix D. In the t-SNE analysis, we use the average weights of data points during training as a measure of its importance. We normalized the average weights by the maximum weight this weight distribution could achieve. In Figure 4, the darker the color, the more larger weight this sample point is calculated into the loss function during training, and the more important it is in the training process. + +![](images/612802e04e2a44e92851ca07c2eca451f1ac9cc9b95544e47963979b618159a2.jpg) +Figure 4: t-SNE visualization of the final hidden states corresponding to [CLS] token of SST-2 training examples produced by the model in trained via WETAR. + +We found that the samples distributed in one category, while close to the other one have greater nonzero weight values, which indicates they are relatively more important than the others, coinciding with the finding mentioned by Zhang et al. (2021); Kim et al. (2021). We can also observe that more weights will be given to some samples during the training process, making the whole weight distribution sparse. Through the analysis of visualization, we found the proposed mechanism can prevent the + +model from being overfitted to some training samples by assigning small weights to them. Guiding the training process via these sparse weight distributions leads to a significant increase in adversarial robustness with no or little drop in clean accuracy. + +# 6 Conclusion + +In this study, we propose a defense method against text adversarial attacks by reweighting examples automatically. The algorithm learns to weight training examples in proportion to their contributions to minimize the loss evaluated on a validation set augmented with adversarial examples. The proposed method can directly be applied to any deep learning architecture without any additional hyperparameter search. We showed through extensive experiments that there indeed exists a reweighting mechanism to make the model robust without generating adversarial examples for the entire training set, and our reweighting algorithm performs better than existing defense methods across three different text classification datasets. + +# Acknowledgements + +The authors would like to thank the anonymous reviewers for their valuable comments. This work was supported by National Science Foundation of China (No. 62076068), Shanghai Municipal Science and Technology Major Project (No. 2021SHZDZX0103), and Zhangjiang Lab. Chang is supported in part by Cisco and Sloan fellowship. Hsieh is supported in part by NSF IIS-2008173 and IIS-2048280. + +# References + +Ronan Le Bras, Swabha Swayamdipta, Chandra Bhagavatula, Rowan Zellers, Matthew Peters, Ashish Sabharwal, and Yejin Choi. 2020. Adversarial filters of dataset biases. In Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pages 1078-1088. PMLR. +Minhao Cheng, Wei Wei, and Cho-Jui Hsieh. 2019. Evaluating and enhancing the robustness of dialogue systems: A case study on a negotiation agent. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 3325-3335, Minneapolis, Minnesota. Association for Computational Linguistics. + +Yin Cui, Menglin Jia, Tsung-Yi Lin, Yang Song, and Serge Belongie. 2019. Class-balanced loss based on effective number of samples. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). +Xinshuai Dong, Anh Tuan Luu, Rongrong Ji, and Hong Liu. 2021. Towards robustness against natural language word substitutions. In International Conference on Learning Representations. +Javid Ebrahimi, Anyi Rao, Daniel Lowd, and Dejing Dou. 2017. Hotflip: White-box adversarial examples for text classification. Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics. +Ji Gao, Jack Lanchantin, Mary Lou Soffa, and Yanjun Qi. 2018a. Black-box generation of adversarial text sequences to evade deep learning classifiers. In 2018 IEEE Security and Privacy Workshops (SPW), pages 50-56. +Ji Gao, Jack Lanchantin, Mary Lou Soffa, and Yanjun Qi. 2018b. Black-box generation of adversarial text sequences to evade deep learning classifiers. In 2018 IEEE Security and Privacy Workshops (SPW), pages 50-56. IEEE. +Edward Grefenstette, Brandon Amos, Denis Yarats, Phu Mon Htut, Artem Molchanov, Franziska Meier, Douwe Kiela, Kyunghyun Cho, and Soumith Chintala. 2019. Generalized inner loop meta-learning. +Jens Hauser, Zhao Meng, Damián Pascual, and Roger Wattenhofer. 2021. Bert is robust! a case against synonym-based adversarial examples in text classification. +Po-Sen Huang, Robert Stanforth, Johannes Welbl, Chris Dyer, Dani Yogatama, Sven Gowal, Krishnamurthy Dvijotham, and Pushmeet Kohli. 2019. Achieving verified robustness to symbol substitutions via interval bound propagation. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 4083-4093, Hong Kong, China. Association for Computational Linguistics. +Robin Jia and Percy Liang. 2017. Adversarial examples for evaluating reading comprehension systems. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 2021-2031, Copenhagen, Denmark. Association for Computational Linguistics. +Robin Jia, Aditi Raghunathan, Kerem Goksel, and Percy Liang. 2019. Certified robustness to adversarial word substitutions. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 4129-4142, Hong Kong, China. Association for Computational Linguistics. + +Haoming Jiang, Pengcheng He, Weizhu Chen, Xiaodong Liu, Jianfeng Gao, and Tuo Zhao. 2020. SMART: Robust and efficient fine-tuning for pretrained natural language models through principled regularized optimization. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, Online. Association for Computational Linguistics. +Di Jin, Zhijing Jin, Joey Tianyi Zhou, and Peter Szolovits. 2020. Is BERT really robust? a strong baseline for natural language attack on text classification and entailment. Proceedings of the AAAI Conference on Artificial Intelligence, 34(05):8018-8025. +Minseon Kim, Jihoon Tack, Jinwoo Shin, and Sung Ju Hwang. 2021. Entropy weighted adversarial training. In ICML 2021 Workshop on Adversarial Machine Learning. +Pang Wei Koh and Percy Liang. 2017. Understanding black-box predictions via influence functions. In Proceedings of the 34th International Conference on Machine Learning, volume 70 of Proceedings of Machine Learning Research, pages 1885-1894. PMLR. +Jinfeng Li, Shouling Ji, Tianyu Du, Bo Li, and Ting Wang. 2019. Textbugger: Generating adversarial text against real-world applications. Proceedings 2019 Network and Distributed System Security Symposium. +Linyang Li, Ruotian Ma, Qipeng Guo, Xiangyang Xue, and Xipeng Qiu. 2020. BERT-ATTACK: Adversarial attack against BERT using BERT. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 6193–6202, Online. Association for Computational Linguistics. +Linyang Li and Xipeng Qiu. 2020. Tavat: Token-aware virtual adversarial training for language understanding. arXiv preprint arXiv:2004.14543. +Zongyi Li, Jianhan Xu, Jiehang Zeng, Linyang Li, Xiaoqing Zheng, Qi Zhang, Kai-Wei Chang, and Cho-Jui Hsieh. 2021. Searching for an effective defender: Benchmarking defense against adversarial word substitution. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 3137-3147, Online and Punta Cana, Dominican Republic. Association for Computational Linguistics. +Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dollar. 2017. Focal loss for dense object detection. In Proceedings of the IEEE International Conference on Computer Vision (ICCV). +Takeru Miyato, Andrew M. Dai, and Ian Goodfellow. 2017a. Adversarial training methods for semi-supervised text classification. + +Takeru Miyato, Andrew M. Dai, and Ian J. Goodfellow. 2017b. Adversarial training methods for semi-supervised text classification. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings. OpenReview.net. +John Morris, Eli Lifland, Jin Yong Yoo, Jake Grigsby, Di Jin, and Yanjun Qi. 2020. TextAttack: A framework for adversarial attacks, data augmentation, and adversarial training in NLP. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 119-126, Online. Association for Computational Linguistics. +Bo Pang and Lillian Lee. 2005. Seeing stars: Exploiting class relationships for sentiment categorization with respect to rating scales. In Proceedings of the 43rd Annual Meeting of the Association for Computational Linguistics (ACL'05), pages 115-124, Ann Arbor, Michigan. Association for Computational Linguistics. +Mengye Ren, Wenyuan Zeng, Bin Yang, and Raquel Urtasun. 2018. Learning to reweight examples for robust deep learning. In Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pages 4334-4343. PMLR. +Shuhuai Ren, Yihe Deng, Kun He, and Wanxiang Che. 2019a. Generating natural language adversarial examples through probability weighted word saliency. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 1085-1097, Florence, Italy. Association for Computational Linguistics. +Shuhuai Ren, Yihe Deng, Kun He, and Wanxiang Che. 2019b. Generating natural language adversarial examples through probability weighted word saliency. In Proceedings of the 57th annual meeting of the association for computational linguistics, pages 1085-1097. +Motoki Sato, Jun Suzuki, Hiroyuki Shindo, and Yuji Matsumoto. 2018a. Interpretable adversarial perturbation in input embedding space for text. In Proceedings of the Twenty-Seventh International Joint Conference on Artificial Intelligence, IJCAI-18, pages 4323-4330. International Joint Conferences on Artificial Intelligence Organization. +Motoki Sato, Jun Suzuki, Hiroyuki Shindo, and Yuji Matsumoto. 2018b. Interpretable adversarial perturbation in input embedding space for text. In Proceedings of the Twenty-Seventh International Joint Conference on Artificial Intelligence, IJCAI 2018, July 13-19, 2018, Stockholm, Sweden, pages 4323-4330. ijcai.org. +Wonyoung Shin, Jung-Woo Ha, Shengzhe Li, Yong-woo Cho, Hoyean Song, and Sunyoung Kwon. 2020. Which strategies matter for noisy label classification? insight into loss and uncertainty. + +Chenglei Si, Zhengyan Zhang, Fanchao Qi, Zhiyuan Liu, Yasheng Wang, Qun Liu, and Maosong Sun. 2021. Better robustness by more coverage: Adversarial and mixup data augmentation for robust finetuning. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, pages 1569-1576, Online. Association for Computational Linguistics. +Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D. Manning, Andrew Ng, and Christopher Potts. 2013. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pages 1631-1642, Seattle, Washington, USA. Association for Computational Linguistics. +Wenjie Wang, Fuli Feng, Xiangnan He, Liqiang Nie, and Tat-Seng Chua. 2021. Denoising implicit feedback for recommendation. Proceedings of the 14th ACM International Conference on Web Search and Data Mining. +Yisen Wang, Difan Zou, Jinfeng Yi, James Bailey, Xingjun Ma, and Ququan Gu. 2020. Improving adversarial robustness requires revisiting misclassified examples. In International Conference on Learning Representations. +Mao Ye, Chengyue Gong, and Qiang Liu. 2020. SAFER: A structure-free approach for certified robustness to adversarial word substitutions. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 3465-3475, Online. Association for Computational Linguistics. +Jingfeng Zhang, Jianing Zhu, Gang Niu, Bo Han, Masashi Sugiyama, and Mohan Kankanhalli. 2021. Geometry-aware instance-reweighted adversarial training. In International Conference on Learning Representations. +Xiang Zhang, Junbo Zhao, and Yann LeCun. 2015. Character-level convolutional networks for text classification. In Advances in Neural Information Processing Systems, volume 28. Curran Associates, Inc. +Zhengli Zhao, Dheeru Dua, and Sameer Singh. 2018. Generating natural adversarial examples. In International Conference on Learning Representations. +Xiaoqing Zheng, Jiehang Zeng, Yi Zhou, Cho-Jui Hsieh, Minhao Cheng, and Xuanjing Huang. 2020. Evaluating and enhancing the robustness of neural network-based dependency parsing models with adversarial examples. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 6600-6610, Online. Association for Computational Linguistics. +Yi Zhou, Xiaqing Zheng, Cho-Jui Hsieh, Kai-Wei Chang, and Xuanjing Huang. 2021. Defense against synonym substitution-based adversarial attacks via + +Dirichlet neighborhood ensemble. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume I: Long Papers), pages 5482-5492, Online. Association for Computational Linguistics. +Chen Zhu, Yu Cheng, Zhe Gan, Siqi Sun, Tom Goldstein, and Jingjing Liu. 2020. FreeLB: Enhanced adversarial training for natural language understanding. In International Conference on Learning Representations. + +# A Algorithm + +Algorithm 1 Weighting Examples Towards Adversarial Robustness Algorithm + +Input: $\mathcal{D}$ :training dataset $\{(x_i,y_i)\}_{i = 1}^N$ $\mathcal{D}^v$ : adversarial validation set $\{(x_i^v,y_i^v)\}_{i = 1}^M$ $\pmb{\theta}$ : model parameters, $\tau$ : learning rate, $\epsilon$ : weights for perturbation, $w$ : weights for updating + +Output: $\theta$ :model weights + +1: Initialize $\pmb{\theta}$ +2: for Iterative step $t = 1, \dots, T$ do +3: for minibatch $\{x_i, y_i\}_{i=1}^n \subset \mathcal{D}$ do +4: // Initialize $\epsilon$ and minibatch from $\mathcal{D}^v$ +5: Sample minibatch $\{x_i^v, y_i^v\}_{i=1}^m \subset \mathcal{D}^v$ +6: $\epsilon \gets 0$ +7: // Calculate $\nabla \theta_t^{\prime}$ and update meta model +8: $g_{\pmb{\theta}_t^{\prime}} \gets \nabla_{\pmb{\theta}_t} \sum_{i=1}^{n} \epsilon_i L_{\pmb{\theta}_t}(x_i, y_i)$ +9: $\pmb{\theta}_{t}^{\prime} = \pmb{\theta}_{t} - \tau g\pmb{\theta}_{t}^{\prime}$ +10: // Calculate $g_{\epsilon}$ and weights $w$ +11: $g_{\epsilon}\gets \nabla_{\epsilon}\frac{1}{m}\sum_{j = 1}^{m}L_{\pmb{\theta}_{t}^{\prime}}(\pmb{x}_{j}^{v},y_{j}^{v})$ +12: $\tilde{\pmb{w}}\gets \max (-g_{\pmb{\epsilon}},\mathbf{0})$ +13: $\pmb{w} \gets \frac{\pmb{w}_j}{\sum_j \pmb{w}_j + \delta(\pmb{w}_j)}$ +14: // Update model with reweighted examples +15: $\nabla \pmb{\theta}_t \gets \nabla_{\pmb{\theta}_t} \sum_{i=1}^n w_i L_{\pmb{\theta}_t}(x_i, y_i)$ +16: $\pmb{\theta}_{t + 1}\gets \pmb{\theta}_t - \tau \nabla \pmb{\theta}_t$ +17: end for +18: end for +19: return $\theta$ + +In this section, we provide the algorithm for training process of METAR and describe the whole algorithm process in detail. We would construct an adversarial validation set first and then proceed to the next step of training. In case of METAR-D method, we reconstruct our adversarial validation set after every 1-2 epochs. + +As shown in Algorithm 1, we sample a minibatch from the adversarial validation set and initialize weight perturbation $\epsilon$ in line 5-6. In line 8-9, we calculate $\theta_t^\prime$ in order to obtain the gradient $g_{\epsilon}$ of $\epsilon$ by meta-learning algorithm in line 11. We obtain the relative importance $\tilde{w}$ of samples by comparing the magnitude of $-g_{\epsilon}$ . Note that we use the opposite direction of $g_{\epsilon}$ to evaluate the relative importance because we do a gradient descent operation in line 9. We then normalize this importance weight $\tilde{w}$ to $w$ and use $w$ to weight training samples in the regular training. In general, the theoretical computational complexity of our algorithm is about three times greater than the + +regular training method. + +# B Implementation Details + +Table B shows the implementation details about the hyper-parameters we used to train models. "Adversarial Learning Rate" is the parameter setting for standard adversarial training methods. "Proportion $\rho$ for WETAR" means that there are $50\%$ of samples are clean samples in validation batch in each training iteration. In order to make the guidance function of adversarial validation set more obvious, we use relatively larger adversarial validation batch. + +
Hyper-parametersSST-2AGNEWSMR
Learning Rate\( 2 \times 10^{-5} \)\( 2 \times 10^{-5} \)\( 2 \times 10^{-5} \)
Weight Decay\( 1 \times 10^{-6} \)\( 1 \times 10^{-6} \)\( 1 \times 10^{-6} \)
Batch Size32328
Epochs101010
Adversarial Learning Rate0.030.060.03
FreeLB Ascent Step233
FreeLB++ Ascent Step101010
Proportion ρ for WETAR50%50%50%
Validation Batch Size25625664
+ +Table 3: The training hyperparameters we selected to train models across three datasets in Table 1. + +# C Weight Distribution + +In the section, we first provide the experimental basis for our empirical model selection method with respect to the Wasserstein distance of weight distribution at every two epochs. We also provide detailed weight distributions in this section. + +Figure 5 shows the weight distribution of WETAR-D on AGNEWS and SST-2 datasets. We can draw the similar conclusion that our empirical model selection method based on Wasserstein distance could select a relatively robust model. + +We provide more weight distributions in this section in addition to the above distributions. Figure 6 and 7 show the weight distribution provided by WETAR-D on AGNEWS dataset and SST-2 dataset respectively. Figure 10 and 9 show the weight distribution on MR dataset provided by WETAR-D and WETAR-S respectively. + +# D Visualization + +Figure 8 shows t-SNE results of training examples in the SST-2 dataset. For each sub-figure, the dots are outputs of the last layer of the model for the corresponding epoch, and the relative importance of dots is calculated by the average weights. + +![](images/4202e1cd8291291990b6d03c2829bfa86efc497f97c3ce20847810447700ce8b.jpg) +(a) Epoch 2 + +![](images/66c39aa4016c72ac9fea69bc3b519ca70161ffd6039df34a5cba86b3d3ba8080.jpg) +(b) Epoch 5 + +![](images/da12b6f1b53ebc03daa271d5c78e9f556a2a7279190e630ef0e9590c504e9d02.jpg) +(c) Epoch 8 + +![](images/7f2f70049690833db16b0d2c56db48aef9364e22b9b1751d51a8b710af2287d0.jpg) +(d) WETAR-D + +![](images/c6b1a4c85d967a99503cda999806409b98197382053bcc0e247be2986e5127c8.jpg) +(e) Epoch 2 + +![](images/8105df762b5565feea56a28838612fd947badcb3493cbcf4c9b091d9257348a4.jpg) +(f) Epoch 5 + +![](images/3ab6e273b439721b479cde6ac21cc2bda53ee89ec5527806c68119cb033a6740.jpg) +(g) Epoch 8 + +![](images/1fe047e78d85e2cb869de01acfdbc32396aeac0b77a2bce8e14ad7fe5f318eb7.jpg) +(h) WETAR-D +Figure 5: The weight distributions produced by WETAR-D on AGNEWS and SST-2 datasets. Sub-figures (a), (b), and (c) show the weight distributions produced by WETAR-D at epoch 2, 5, and 8 on AGNEWS respectively. Sub-figures (e), (f), and (g) give the same distributions produced by WETAR-D at epoch 2, 5, and 8 on SST-2. Sub-figures (d) and (h) plot the curves of accuracy under attack and the Wasserstein distance between two weight distributions at every two epochs respectively. + +![](images/3f9cef0715a41f5e95569e0f44bbdd5cb26c09d4a988da1650c42087e0086ab2.jpg) +(a) Epoch 3 + +![](images/12d68c2fbd2eba38102fe4b5f75f669b881a843d310feaee870ebc31d0b0e32a.jpg) +(b) Epoch 4 + +![](images/5b36f77d4b5152d56f06816f8a4057f9df461023fb18d03b0b3559326bcf2990.jpg) +(a) Epoch 3 + +![](images/4ab203b0c8b21b45f51ffd4b3bd2a51c39ebd15937520ee9bd667b29a4c76950.jpg) +(b) Epoch 4 + +![](images/1f4c2352857385f1feba772a954e54162dc95600f2f541e80713e934f843ba92.jpg) +(c) Epoch 5 + +![](images/41b3b7631d1eecc514276c6f795df86c2e8ed85dd554509ab686c8c8a39c410b.jpg) +(d) Epoch 6 + +![](images/57c5ef349ce1e093ea933382d5517a1b1873777b4dcba2b850c3bc66db185c1d.jpg) +(c) Epoch 5 + +![](images/b8a0ee474534359ea57e52d6c97f8e89da7642e3e53391182594647289019e72.jpg) +(d) Epoch 6 + +![](images/322d3cc87441e6d174a8e6ef82a5dc63026aad2face1eec4d4494124329a6bc7.jpg) +(e) Epoch 7 + +![](images/715192a8149eeff08b4e3dac9d942c61f0a2d14ca037aad3661b237a0033e9fd.jpg) +(f) Epoch 8 + +![](images/51f4e9676db1bd4d5198b0debb4ed9c00b4566eb5fb3b0b558dd24a3b04d05e2.jpg) +(e) Epoch 7 + +![](images/730ad4e73954b2e5c7b11636ef6b29f886cba2840657bb9872aff23bc02314b6.jpg) +(f) Epoch 8 + +![](images/4dc70192ecf8d2a318f0977bf56c8bc494ca030dd950b8b95749e975f88fdc40.jpg) +(g) Epoch 9 +Figure 6: Weight distribution provided by WETAR-D on AGNEWS dataset. + +![](images/9b7f093f173b52469fef1e64d0dfc2423f331e1b80393c4a52d83db3fdf3d58a.jpg) +(h) Epoch 10 + +![](images/cc2274c00b2cbcf8f26517766dde543b79ed7a7740e88f16f43fa84a4c546981.jpg) +(g) Epoch 9 +Figure 7: Weight distribution provided by WETAR-D on SST-2 dataset. + +![](images/7c85706aa19afbaac0ba49baf74415ddd0467200c3439af2867840f2b1e32ce4.jpg) +(h) Epoch 10 + +![](images/3cd32cc10f09ff22b5d0c9464a69ea56ad75cbfd440a46b8a4e7819094621dbb.jpg) +(a) Epoch 7 + +![](images/42c523c824f358b99632a62a52527b8d264fbd8c9bd6ab33dceddb7b3b222e1f.jpg) +(b) Epoch 8 +Figure 8: t-SNE visualization of the representations of SST-2 training examples produced by the model trained via WETAR. + +![](images/3f512722151f7d0df0c525ba1074fb9ba60b60a03e2bbf584c705a2f07772526.jpg) +(c) Epoch 9 + +![](images/7068c2143a7c8af51fd3032fb67f991919efa6d69365cf5e2734549bfa8ebe8f.jpg) +(d) Epoch 10 + +![](images/02d668ea62919b6e836bee7bb89b51c4204ad8630f9d57f6878c597a165a48b7.jpg) +(a) Epoch 3 + +![](images/6f7aa4e9d21aee9a68d14ea1654f99bbd9ba03779b5b5d9964279779654aaa88.jpg) +(b) Epoch 4 + +![](images/7b425ed143a85c474fc2b2e93e8a0095f9b74e8f93161ead8fb9009717f3060a.jpg) +(a) Epoch 3 + +![](images/bf91adf2d3adc9f739861875dd622273a35910c9e345fa355e2131395e16f656.jpg) +(b) Epoch 4 + +![](images/d232d92235e6ebf1c30118967603ab8180aec121d4db63a71bd567d6ddca8cfe.jpg) +(c) Epoch 5 + +![](images/4182c6b93283a1fbf9c4509e62554706d882605cb3e2c2c11c9ede31257eaf56.jpg) +(d) Epoch 6 + +![](images/44334f16f3ff793a44b5354d974754568892d1ce920dc5f0367a601cd4a987e6.jpg) +(c) Epoch 5 + +![](images/55101d924f46c33eb96b414b3128e4732c6e4ed837f4ef407c406d2e1f9ad120.jpg) +(d) Epoch 6 + +![](images/683a2d96913556d08fad01672614134aa4ec9423004b4e1ce4ada773ee68c877.jpg) +(e) Epoch 7 + +![](images/ab2bc19202295940a3c958c6b032cf772601a8800aacba64c4e6e4cbf17ecc6e.jpg) +(f) Epoch 8 + +![](images/ea7444292bd114e869ea9f002fc137553d4d39deee57431554325b55c49ce8fd.jpg) +(e) Epoch 7 + +![](images/d15c6b4fb74cecef86e70217e4d9cd45838dfb8906cf15afaeae44041d920ae5.jpg) +(f) Epoch 8 + +![](images/2cdacb0adb8a82822f561e3e6d89fef5bd908bc849878c94842cf96f2bbac111.jpg) +(g) Epoch 9 +Figure 9: Weight distribution provided by WETAR-S on MR dataset. + +![](images/ab9effd926eb7477cabdca7352acb0512121af3fdc66752e3d36ae6eed0cc5ca.jpg) +(h) Epoch 10 + +![](images/2d1071e9cab1911bdb0cf5261c251e80cf27c859ad33996af7392554d1829391.jpg) +(g) Epoch 9 +Figure 10: Weight distribution provided by WETAR-D on MR dataset. + +![](images/bd5c31977946b17764648ee67085148f3eaa5e847ef73336665972ee952ce209.jpg) +(h) Epoch 10 \ No newline at end of file diff --git a/towardsadversariallyrobusttextclassifiersbylearningtoreweightcleanexamples/images.zip b/towardsadversariallyrobusttextclassifiersbylearningtoreweightcleanexamples/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..b13952878cbdb1a8a197b0d522a57512e82b9707 --- /dev/null +++ b/towardsadversariallyrobusttextclassifiersbylearningtoreweightcleanexamples/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a3a413d33a7e9c7b97cc0e438aa251c9bcb574a987094bf3fefeb2200fdeb049 +size 675544 diff --git a/towardsadversariallyrobusttextclassifiersbylearningtoreweightcleanexamples/layout.json b/towardsadversariallyrobusttextclassifiersbylearningtoreweightcleanexamples/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..304e15d6a89916b52430acd5df67305d66b4ebb3 --- /dev/null +++ b/towardsadversariallyrobusttextclassifiersbylearningtoreweightcleanexamples/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:107ea9e77a46dc97bb6fd89d94ec3c53c0065569aa45201b0aaa9e4c58238386 +size 585027 diff --git a/towardscollaborativeneuralsymbolicgraphsemanticparsingviauncertainty/35fc8e92-6e79-48fc-a1a1-a971061904ec_content_list.json b/towardscollaborativeneuralsymbolicgraphsemanticparsingviauncertainty/35fc8e92-6e79-48fc-a1a1-a971061904ec_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..d048e82f9162c3ec09ac58b36836a7d87d4a7cbf --- /dev/null +++ b/towardscollaborativeneuralsymbolicgraphsemanticparsingviauncertainty/35fc8e92-6e79-48fc-a1a1-a971061904ec_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5d186b06e06881442ea7ad959e5dc6d024b204c3563e2d3fe48406df36bc1fc2 +size 96153 diff --git a/towardscollaborativeneuralsymbolicgraphsemanticparsingviauncertainty/35fc8e92-6e79-48fc-a1a1-a971061904ec_model.json b/towardscollaborativeneuralsymbolicgraphsemanticparsingviauncertainty/35fc8e92-6e79-48fc-a1a1-a971061904ec_model.json new file mode 100644 index 0000000000000000000000000000000000000000..e3b2d3599c566781feb262db4f479debed38cdd5 --- /dev/null +++ b/towardscollaborativeneuralsymbolicgraphsemanticparsingviauncertainty/35fc8e92-6e79-48fc-a1a1-a971061904ec_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eda5af27c94e9b02128e63c749c2b46667277dcb681a013836521ea74ea4e7a5 +size 116569 diff --git a/towardscollaborativeneuralsymbolicgraphsemanticparsingviauncertainty/35fc8e92-6e79-48fc-a1a1-a971061904ec_origin.pdf b/towardscollaborativeneuralsymbolicgraphsemanticparsingviauncertainty/35fc8e92-6e79-48fc-a1a1-a971061904ec_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..9f53526397dd3cf4cf6b83a779673039c8d37a14 --- /dev/null +++ b/towardscollaborativeneuralsymbolicgraphsemanticparsingviauncertainty/35fc8e92-6e79-48fc-a1a1-a971061904ec_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e5c8d0e577f9a5050b84b41704751f00a2399c228824b9f1fec5c71024b073e6 +size 515655 diff --git a/towardscollaborativeneuralsymbolicgraphsemanticparsingviauncertainty/full.md b/towardscollaborativeneuralsymbolicgraphsemanticparsingviauncertainty/full.md new file mode 100644 index 0000000000000000000000000000000000000000..5f3be005850a50839fefc1d50cfb303e73912298 --- /dev/null +++ b/towardscollaborativeneuralsymbolicgraphsemanticparsingviauncertainty/full.md @@ -0,0 +1,396 @@ +# Towards Collaborative Neural-Symbolic Graph Semantic Parsing via Uncertainty + +Zi Lin + +UC San Diego + +lzi@ucsd.edu + +Jeremiah Liu + +Google Research & Harvard University + +jereliu@google.com + +Jingbo Shang + +UC San Diego + +jshang@ucsd.edu + +# Abstract + +Recent work in task-independent graph semantic parsing has shifted from grammar-based symbolic approaches to neural models, showing strong performance on different types of meaning representations. However, it is still unclear that what are the limitations of these neural parsers, and whether these limitations can be compensated by incorporating symbolic knowledge into model inference. In this paper, we address these questions by taking English Resource Grammar (ERG) parsing as a case study. Specifically, we first develop a state-of-the-art, T5-based neural ERG parser, and conduct detail analyses of parser performance within fine-grained linguistic categories. The neural parser attains superior performance on in-distribution test set, but degrades significantly on long-tail situations, while the symbolic parser performs more robustly. To address this, we further propose a simple yet principled collaborative framework for neural-symbolic semantic parsing, by designing a decision criterion for beam search that incorporates the prior knowledge from a symbolic parser and accounts for model uncertainty. Experimental results show that the proposed framework yields comprehensive improvement over neural baseline across long-tail categories, yielding the best known SMATCH score (97.01) on the well-studied DeepBank benchmark. + +# 1 Introduction + +Semantic parsing is the task of mapping natural language to machine interpretable meaning representations, and graph-structured semantic representations, which encode rich semantic information in the form of semantic graphs, have played an important role in natural language processing (Oepen et al., 2019). + +Parsing natural language sentences into the semantic-graph representation (e.g., Figure 1) has + +been extensively studied in the recent decade. Work in this area has shifted from the symbolic (grammar-based) approach to the neural approach. Thanks to the flourishing of deep learning technologies, sequence-to-sequence (seq2seq) models have shown great performance on data sampled from the training distribution. These neural semantic parsers reduce the need for domain-specific grammar and feature engineering, but comes at a cost of lacking interpretability, as the model directly outputs a (linearized) graph without revealing the underlying meaning-composition process. Moreover, these neural models often generalize poorly to tail and out-of-distribution (OOD) examples, and previous work has shown that combining high-precision symbolic approaches with neural models can address this issue for task-oriented semantic parsing (Shaw et al., 2021; Kim, 2021; Cheng et al., 2019). However, this type of approach requires complex architecture engineering to incorporate the grammar formalism. The grammar formalism being utilized is usually primitive, and was not tested beyond simple datasets such as SCAN (Lake and Baroni, 2018) or GEOQUERY (Zelle and Mooney, 1996). Therefore they are likely not sufficient for handling complex graph-based meaning representations derived from realistic corpora. + +In this work, we aim to develop a simple yet principled neural-symbolic approach for graph semantic parsing to address long-tail generalization, which leverages the information from an a priori grammar parser while maintaining the convenience of neural seq2seq training built on top of massively pre-trained embeddings (Raffel et al., 2020). We take graph semantic parsing for English Resource Grammar (ERG) as our case study (Adolphs et al., 2008). ERG is a compositional semantic representation explicitly coupled with the syntactic structure. Compared to other graph-based meaning representations, ERG has high coverage of English text and strong transferability across do + +mains (Flickinger et al., 2010, 2012; Copestake and Flickinger, 2000; Ivanova et al., 2013), rendering itself has an attractive target formalism for automated semantic parsing. The classic ERG literature has focused on developing grammar-based ERG parser. However, they can suffer from issues such as incomplete categorization of lexical items and multi-word expression, and yields low coverage for realistic corpus such as Wikipedia (Baldwin et al., 2004). On the other hand, multiple neural ERG parsers have also been proposed (Buys and Blunsom, 2017; Chen et al., 2018, 2019; Cao et al., 2021). However, they are commonly structured as a pipelined system and often rely on external tools (e.g., aligners, part-of-speech taggers, and named entity recognizers), with the performance of the upstream component significantly impacting the final performance. This motivates us to build a pure end-to-end neural parser for ERG parsing that directly maps the input sentences to target graphs. + +First, we present an end-to-end seq2seq model based on T5 (Raffel et al., 2020) that achieves the state-of-the-art results for ERG parsing. This model goes beyond the conventional multi-step predictions for node and edge in previous work, and does not require specialized architecture that explicitly incorporate the ERG rules or the synaptic structure as part of inductive bias. Despite the complicated syntax and semantic structures encoded in semantic graphs, we have shown that by devising proper linearization and tokenization, we can successfully transfer ERG parsing problem to translation problem (Section 3.1). + +Second, we conduct a comprehensive study of the generalization behavior of the neural parser, interrogating its performance within fine-grained linguistic categories. Comparing with a state-of-the-art symbolic parser ACE, the neural parser exhibits complementary strengths. Particularly, the neural model yields much higher coverage than the symbolic parser, generating valid parses for a wider range of examples. However, the quality of the top-1 parse degrades severely in the long-tail situation. Perhaps remarkably, we also observed that the neural model's top-k parses in fact often contain candidate that generalizes well on long-tail, but the vanilla MLE-based inference fell short in selecting them (Section 4 and 5). + +The above observation motivates our third contribution: to develop a practical framework for collaborative neural-symbolic parsing. The key lies in + +designing a principled decision making strategy for this neural-symbolic collaboration that performs optimally during inference time. To this end, we design a new decision criterion for neural model inference (e.g., beam search) that incorporates both model uncertainty and the prior knowledge from a symbolic parser, leveraging the theoretical framework of optimal decision-making under the incomplete knowledge of the world (Ulansky and Raza, 2021; Giang, 2015; Hurwicz, 1951). The basic idea is to utilize uncertainty estimates of the neural parser as a switch between the optimistic, MLE-based inference and the conservative, prior-based inference, such that the neural parser seeks the guidance from a symbolic parser during its decoding stage when encountering low-confident examples. This proposed approach achieves comprehensive improvement compared to the original neural parser, across almost all linguistic categories. Our result suggests that sometimes the limitation of the neural approach lies not necessarily in the model architecture or the training method, but in a suboptimal inference procedure that naively maximize the a posteriori likelihood (e.g., the beam search) without questioning the reliability of the prediction (Section 3.2). + +In summary, our contribution are three-fold: + +- We propose the first end-to-end model that achieves the state-of-the-art results for ERG parsing on the DeepBank WSJ benchmark. Specifically, we get $30.1\%$ error rate reduction in SMATCH score over the existing state-of-the-art. +- We conduct a thorough analysis of the neural parser in terms of generalization. Specifically, we compared the predictive performance of neural parser with the state-of-the-art symbolic parser in various important linguistic categories, showing that both parsers exhibit complementary strengths, validating the potential to build a neural-symbolic parsing framework. +- We propose a simple, yet principled framework for neural-symbolic parsing utilizing model uncertainty. The resulting framework not only comprehensively improved the model performance in tail linguistic categories, but further boosted the performance of the neural model on the standard in-domain test set (an extra $9.5\%$ error rate reduction), establishing a new state-of-the-art SMATCH 97.01. + +Figure 1: An example of semantic graph for English Resource Grammar (ERG). Some nodes are surface concepts, meaning that they are related to a single lexical unit, e.g. _introduce_v_to (the number in the angle brackets indicates their token alignments in the sentence), while others are abstract concepts representing grammatical meanings, e.g. compound (multiword expression), $\text{parg\_d}$ (passive) and loc_nonsp (temporal). Color red indicates the root of this semantic graph. It also supports light-weight named entity recognition (e.g., "West Germany" is labeled as two named in the graph). +![](images/fde9893a0562b0f1cab77c1e91e107c2c336fd7d9c6f2ff7233e131720a16674.jpg) +The $<0>$ drug $<1>$ was $<2>$ introduced $<3>$ in $<4>$ West $<5>$ Germany $<6>$ this $<7>$ year $<8>$ . + +# 2 Background and Related Work + +# 2.1 Graph-based Meaning Representation + +Considerable NLP research has been devoted to the transformation of natural language utterances into a desired linguistically motivated semantic representation. Such a representation can be understood as a class of discrete structures that describe lexical, syntactic, semantic, pragmatic, as well as many other aspects of the phenomenon of human language. In this domain, graph-based representations provide a light-weight yet effective way to encode rich semantic information of natural language sentences and have been receiving heightened attention in recent years. Popular frameworks under this umbrella include Bi-lexical Semantic Dependency Graphs (SDG; Bos et al., 2004; Ivanova et al., 2012; Oepen et al., 2015), Abstract Meaning Representation (AMR; Banarescu et al., 2013), Graph-based Representations for English Resource Grammar (ERG; Oepen and Lönning, 2006; Copestake, 2009), and Universal Conceptual Cognitive Annotation (UCCA; Abend and Rappoport, 2013). + +# 2.2 English Resource Grammar (ERG) + +In this paper, we take the representations from English Resource Grammar (ERG; Flickinger et al., 2014) as our target meaning representations. ERG is an open-source, domain-independent, linguistically precise, and broad-coverage grammar of English, which is rooted in the general linguistic theory of Head-driven Phrase Structure Grammar (HPSG; Pollard and Sag, 1994). ERG can be pre + +sented into different types of annotation formalism (Copestake et al., 2005). In this work, we consider the Elementary Dependency Structure (EDS; Oepen and Lönning, 2006) which converts ERG into variable-free dependency graphs, and is more compact and interpretable when compared to other types of annotation schemes, e.g., DMRS (Buys and Blunsom, 2017; Chen et al., 2018). + +Figure 1 shows an example graph. The semantic structure is a directed graph $G = \langle N, E \rangle$ , where $N$ denotes nodes labeled with semantic predicates/relations (e.g., _drug_n_1, compound), and $E$ denotes edges labeled with semantic argument roles (e.g., ARG1, ARG2). + +There are different parsing technologies for graph-based meaning representations, which can be roughly divided into grammar- and neural-based approaches. + +# 2.3 Parsing to Semantic Graphs + +In this section, we present a summary of different parsing technologies for graph-based meaning representations, with a focus on English Resource Grammar (ERG). + +Grammar-based approach In this type of approach, a semantic graph is derived according to a set of lexical and syntactico-semantic rules. For ERG parsing, sentences are parsed to HPSG derivations consistent with ERG. The nodes in the derivation trees are feature structures, from which MRS is extracted through unification. However, this approach fails to parse sentences for which no valid derivation is found. It is implemented in the PET + +Callmeier, 2000) and $\mathrm{ACE^2}$ parser. Chen et al. (2018) also proposed a Synchronous Hyperedge Replace Grammar (SHRG) based parser by relating synchronous production rules to the syntactose semantic composition process. + +Factorization-based approach This type of approach is inspired by graph-based dependency tree parsing (McDonald, 2006). A factorization-based parser explicitly models the target semantic structures by defining a score function that can evaluate the probability of any candidate graph. For ERG parsing, Cao et al. (2021) implemented a two-step pipeline architecture that identifies the concept nodes and dependencies by solving two optimization problems, where prediction of the first step is utilized as the input for the second step. Chen et al. (2019) presented a four-stage pipeline to incrementally construct an ERG graph, whose core idea is similar to previous work. + +Transition-based approach In these parsing systems, the meaning representations graph is generated via a series of actions, in a process that is very similar to dependency tree parsing (Yamada and Matsumoto, 2003; Nivre, 2008), with the difference being that the actions for graph parsing need to allow reentrancies. For ERG parsing, Buys and Blunsom (2017) proposed a neural encoder-decoder transition-based parser, which uses stack-based embedding features to predict graphs jointly with unlexicalized predicates and their token alignments. + +Composition-based approach Following a principle of compositionality, a semantic graph can be viewed as the result of a derivation process, in which a set of lexical and syntactico-semantic rules are iteratively applied and evaluated. For ERG parsing, based on Chen et al. (2018), Chen et al. (2019) proposed a composition-based parser whose core engine is a graph rewriting system that explicitly explores the syntactico-semantic recursive derivations that are governed by a synchronous SHRG. + +Translation-based approach This type of approach is inspired by the success of seq2seq models which are the heart of modern Neural Machine Translation. A translation-based parser encodes and views a target semantic graph as a string from another language. In a broader context of graph semantic parsing, simply applying seq2seq models + +is not successful, in part because effective linearization (encoding graphs as linear sequences) and data sparsity were thought to pose significant challenges (Konstas et al., 2017). Alternatively, some specifically designed preprocessing procedures for vocabulary and entities can help to address these issues (Konstas et al., 2017; Peng et al., 2017). These preprocessing procedures are very specific to a certain type of meaning representation and are difficult to transfer to others. However, we show that by devising proper linearization and tokenization (Section 3.1), we can successfully transfer the ERG parsing problem into a translation problem, which can be solved by a state-of-the-art seq2seq model T5 (Raffel et al., 2020). This linearization and tokenization can be applied to any meaning representations. + +# 2.4 Neural-Symbolic Semantic Parsing + +While seq2seq models excel at handling natural language variation, they have been shown to struggle with out-of-distribution compositional generalization (Lake and Baroni, 2018; Shaw et al., 2021). This has motivated new specialized architectures with stronger inductive biases for the compositional generalization, especially for task-oriented semantic parsing like SCAN (Lake and Baroni, 2018) and GEOQUERY. Some examples include NQGT5 (Shaw et al., 2021), a hybrid model combining a high-precision grammar-based approach with a pretrained seq2seq model; seq2seq learning with latent neural grammars (Kim, 2021); a neural semantic parser combining a generic tree-generation algorithm with domain-general grammar defined by the logical language (Cheng et al., 2019). + +However, there are not so much progress regarding neural-symbolic parsing for graph meaning representations. Previous work has shown that the utility of context-free grammar for graph semantic parsing was somewhat disappointing (Peng et al., 2015; Peng and Gildea, 2016). This is mainly because the syntax-semantics interface encoded in those graph meaning representations is much more complicated than pure syntactic rules or logical formalism, and is difficult to be exploited in data-driven parsing architecture. + +# 3 A Collaborative Neural-Symbolic Parsing Framework + +In this section, we design and implement a new collaborative neural-symbolic parsing framework for ERG parsing. The framework takes the neural + +parser's uncertainty as a trigger to the collaborative process with the symbolic parser. This requires the neural parser to model uncertainty based on the optimization problem given observed sentence $s$ : + +$$ +\underset {N, E} {\arg \max } p (G = \langle N, E \rangle | s) +$$ + +Previous data-driven work on ERG parsing either requires pipeline settings (predict nodes $N$ and edges $E$ separately) or external tools such as aligners, part-of-speech taggers and named entity recognizers. In contrast, we aim to build an end-to-end seq2seq parser that directly maps the input sentences to the target strings of (linearized) ERG graphs. However, due to the complexity of the semantic graph representation, care needs to be taken to parametrize the output space of the graph strings, so that the seq2seq model can learn efficiently in finite data. Specifically, we show that by devising proper linearization and tokenization (Section 3.1), we can successfully transfer the ERG parsing problem into a translation problem that can be solved by a state-of-the-art seq2seq model T5 (Raffel et al., 2020). The proposed linearization and tokenization are essential to model performance, and can be applied to any meaning representations. The experimental results show that our model improves significantly in comparison with the previously reported results (Table 1). + +# 3.1 Linearization and Tokenization + +Variable-free top-down linearization A popular linearization approach is to linearize a directed graph as the pre-order traversal of its spanning tree. Variants of this approach have been proposed for neural constituency parsing (Vinyals et al., 2015) and AMR parsing (Barzdins and Gosko, 2016; Peng et al., 2017). AMR (Banarescu et al., 2013) uses the PENMAN notation (Kasper, 1989), which is a serialization format for the directed, rooted graphs used to encode semantic dependencies. It uses parentheses to indicate nested structures. Since nodes in the graph get identifiers (initialized randomly) in PENMAN notation that can be referred to later to establish a reentrancy, e.g., _drug_n_1 in Figure 1, and will confuse the model to learn the real meaningful mappings, we remove the identifiers and use star markers instead to indicate reentrancies. For example, our variable-free linearization for graphs in Figure 1 can be written as: + +```txt +(introduced_v_to +``` + +```txt +:ARG2 (_drug_n_1 * :BV-of (_the_q) ) +:ARG1-of ( parg_d :ARG2 (_drug_n_1 * ) ) +:ARG1-of ( loc_nonsp :ARG2 (_year_n_1 :BV-of (_this_d-dem) ) ) +:ARG1-of (_in_p :ARG2 (named :BV-of (proper_q) :ARG1-of (compound :ARG2 (named :BV-of (proper_q) ) ) ) ) +``` + +The rewriting process can be done by Algorithm 1. It is noted that there can be more than one reentrancy in the graph, and we use different numbers of star marks to indicate this (line 10 in Algorithm 1). More details about the implementation of linearization can be found in Appendix A. + +Algorithm 1 Variable-free PENMAN rewriting +Input: $G = \langle N,E\rangle$ is the EDS graph +Output: Variable-free PENMAN notations of $G$ +1: $R\gets \emptyset$ ▷ reenrancy set +2: $n_R\gets 0$ ▷ number of reenrancies +3: for $n\in N$ do +4: if child(n)cap child(parent(n)) $\neq \emptyset$ then +5: $R^{\prime}\gets \mathrm{child}(n)\cap \mathrm{child}(\mathrm{parent}(n))$ +6: $R\gets R\cup R^{\prime}$ +7: end if +8: end for +9: for $r\in R$ do +10: $G\gets \mathrm{rewrite}(\mathrm{G},\mathrm{r},\mathrm{r} + {}^{\prime}*^{\prime}\times (\mathrm{n}_{\mathrm{R}} + 1))$ +11: $n_R\gets n_R + 1$ +12: end for +13: return PENMAN(G) + +Compositionality-aware tokenization Tokenization has always been seen as a non-trivial problem in Natural Language Processing (Liu et al., 2019). In the case of graph semantic parsing, it is still a controversial issue which unit is the most basic one that triggers conceptual meaning and semantic construction (Chen et al., 2019). While previous work can customize some off-the-shelf tokenizers to correspond closely to the ERG tokenization, there are still some discrepancies between the tokenization used by the system and ERG (Buys and Blunsom, 2017). Moreover, using customized tokenization means we need to pretrain our model from scratch, and this will cost lots of time and computation. + +We address this issue by replacing the noncompositional part of ERG graphs with some non + +tokenizable units in the T5 vocabulary. This will let the model learn the compositionality of ERG units by giving the signal of which type of units are tokenizable. More details can be found in Appendix B. This process is crucial since it not only reflects the original design of ERG vocabulary, but also dramatically reduces the sequence length of the output (around $16\%$ ). Additionally, it can be applied to any meaning representations by simply identifying the set of non-compositional, atomic units in the semantic graphs. + +# 3.2 A Decision-theoretic Framework for Collaborative Neural-Symbolic Parsing + +It is known that the performance of a neural model tends to suffer on examples that are underrepresented in the training data, e.g., tail categories or OOD examples. Indeed, when analyzing our neural parser, we find the naive T5 parser's performance degrades significantly in the tail linguistic categories, while the symbolic parser performs more robustly (Section 5). This motivates us to explore principled strategies to exploit the complementary strengths of both parsers. Specifically, we cast neural model inference (e.g., beam search) as a decision-making problem under partial uncertainty of the world (Ulansky and Raza, 2021; Jiang, 2015; Hurwicz, 1951), and design a new decision criterion incorporates both the model uncertainty about the testing data distribution and the prior information from a symbolic parser, thereby concretely improving the model performance beyond the i.i.d. regime. + +Formally, consider a sequence prediction problem where the input and target sequences $(\pmb{x},\pmb{y})\in \mathcal{X}\times \mathcal{Y}$ are generated from an underlying distribution $\mathcal{D} = p^{*}(\pmb {y}|\pmb {x})p^{*}(\pmb {x})$ .We denote $p(\pmb {y}|\pmb {x})$ the neural parser trained on the in-domain examples $\pmb {x}\in \mathcal{X}_{ind}$ , and $p_0(\pmb {y}|\pmb {x})$ a symbolic prior that encodes a priori linguistic knowledge from a grammar parser (e.g., ACE). Under a decision-theoretic formulation, the model inference can be understood as a decision-making game under uncertainty (Hurwicz, 1951). Specifically, given a world state (i.e., input utterance) $\pmb{x}$ , the goal of the model is to select the optimal parse $\pmb{y}$ among the beam candidates $\{\pmb {y}_b\}_{b = 1}^B$ according to the decision criteria $\mathcal{R}(\pmb {y}|\pmb {x})$ Crucially, due to the imperfect distribution of the training data $\mathcal{X}_{ind}\subset \mathcal{X}$ , the neural model does not have full familiarity of all the possible utterances $\pmb {x}\in \mathcal{X}$ , and the decision criteria based on + +neural likelihood alone may be a poor guide for the optimal decision $y|\mathbf{x}$ + +To this end, the goal of neural-symbolic inference is to identify a improved criteria $\mathcal{R}(\boldsymbol{y}|\boldsymbol{x})$ that leverages knowledge from a symbolic prior $p_0$ and accounts for model uncertainty. Specifically, we find a solution in the well-known Hurwicz pessimism-optimism criteria from game theory (Hurwicz, 1951), which suggests an optimal criteria of the form + +$$ +\mathcal {R} (\boldsymbol {y} | \boldsymbol {x}) = \alpha * \mathcal {R} _ {p} (\boldsymbol {y} | \boldsymbol {x}) + (1 - \alpha) * \mathcal {R} _ {0} (\boldsymbol {y} | \boldsymbol {x}), +$$ + +where $\mathcal{R}_p(\boldsymbol {y}|\boldsymbol {x})$ is an optimistic policy for the familiar states $\boldsymbol {x}\in \mathcal{X}_{ind}$ $\mathcal{R}_0(\boldsymbol {y}|\boldsymbol {x})$ a conservative policy in case of high uncertainty, and $\alpha \in [0,1]$ a trade-off parameter. + +In the context of beam search, the optimistic criteria $\mathcal{R}_p(\boldsymbol{y}|\boldsymbol{x}) = -\log p(\boldsymbol{y}|\boldsymbol{x})$ is the MLE-based strategy induced by the neural likelihood, which is known to generalize well for the in-domain situations $\boldsymbol{x} \in \mathcal{X}_{ind}$ . On the other hand, the pessimistic criteria $\mathcal{R}_0(\boldsymbol{y}|\boldsymbol{x}) = -\log p_0(\boldsymbol{y}|\boldsymbol{x})$ is the log likelihood of tge symbolic prior $-\log p_0$ . In this work, we define $p_0(\boldsymbol{y}|\boldsymbol{x}) \propto \exp\left(-\frac{d(\boldsymbol{y}, \boldsymbol{y}_0)}{\lambda}\right)$ to be the generalized Boltzmann distribution centered around the output of the symbolic parser $\boldsymbol{y}_0$ . Here $\lambda$ is the temperature parameter, and $d(y, y')$ is a suitable divergence metric for the space of ERG graphs, which we choose to be the SMATCH metric (Cai and Knight, 2013). This leads to the below criteria: + +$$ +\mathcal {R} _ {p} (\boldsymbol {y} \mid \boldsymbol {x}) = \alpha * - \log p (\boldsymbol {y} \mid \boldsymbol {x}) + \tag {1} +$$ + +$$ +(1 - \alpha) * \frac {\operatorname {S M A T C H} (\boldsymbol {y} , \boldsymbol {y} _ {0})}{\lambda}, +$$ + +where we have omitted the normalizing constant of $p_0$ since it does not impact optimization. + +A caveat of (1) is $\alpha$ is fixed regardless of whether $\pmb{x}$ is in-domain $(\mathcal{X}_{ind})$ or out-of-domain $(\mathcal{X} / \mathcal{X}_{ind})$ . As a result, when $\pmb{x}$ is in-domain, a fixed $\alpha$ can be too conservative since minimizing the beam score $-\log p(\pmb{y}|\pmb{x})$ alone is known to generalize well. When $\pmb{x}$ is OOD, however, (1) can be overly optimistic since the neural model $p(\pmb{y}|\pmb{x})$ may generalize poorly in the under-represented regions, and a more prudent strategy is to revert to the prior by focusing on minimizing $p_0(\pmb{y}|\pmb{x})$ . To handle this challenge, we consider an improved criteria that accounts for model uncertainty: + +$$ +\begin{array}{l} \mathcal {R} (\boldsymbol {y} | \boldsymbol {x}) = \alpha (\boldsymbol {x}) * - \log p (\boldsymbol {y} | \boldsymbol {x}) + \\ \left(1 - \alpha (\boldsymbol {x})\right) * \frac {\operatorname {S M A T C H} \left(\boldsymbol {y} , \boldsymbol {y} _ {0}\right)}{\lambda} \tag {2} \\ \end{array} +$$ + +where $\alpha (\pmb {x}) = \mathrm{sigmoid}(-\frac{1}{T} *\left(\mathcal{H}(\pmb {x}) - b\right))$ is a monotonic transformation of model uncertainty $\mathcal{H}(\pmb {x})$ which is known as the Platt calibration (Platt et al., 1999), whose parameters $(T,b)$ can be estimated using a small amount of validation data. As shown, depending on the value of $\mathcal{H}(x)$ ,the proposed criteria (2) approaches the original beam score $-\log p(\pmb {y}|\pmb {x})$ when the model is confident, and reverts to the prior likelihood $-\log p_{0}(\pmb {y}|\pmb {x})$ when the model is uncertain and $\mathcal{H}$ is high. + +For the proposed criteria (2) to perform robustly in practice, the uncertainty estimator $\mathcal{H}(\boldsymbol{x})$ should be well calibrated, i.e., the magnitude of $\mathcal{H}$ is indicative of the model's predictive error. In this work, we choose $\mathcal{H}$ to be the margin probability, i.e., the difference in probability of the top 1 prediction minus the likelihood of the top 2 prediction based on the beam score: + +$$ +\mathcal {H} _ {\mathrm {m a r g i n}} (p (\boldsymbol {y} | \boldsymbol {x}, \mathcal {D})) = p (\boldsymbol {y} ^ {(1)} | \boldsymbol {x}, \mathcal {D}) - p (\boldsymbol {y} ^ {(2)} | \boldsymbol {x}, \mathcal {D}), +$$ + +due to its strong calibration performance on the graph semantic parsing tasks. Appendix D discusses alternative choices of $\mathcal{H}$ and investigates their respective efficacy in improving the collaborative parsing system's predictive performance. + +# 4 Experiments + +Dataset We conduct model training on DeepBank v1.1 that correspond to ERG version 1214, and adopt the standard data split. The Pydelphin3 library is leveraged to extract EDS graphs and transfer them into PENMAN format. + +Implementation Details T5 (Raffel et al., 2020) is a pre-trained sequence-to-sequence Transformer model that has been widely used in many NLP applications. We use the open-sourced $\mathrm{T5X}^4$ , which is a new and improved implementation of T5 codebase in JAX and Flax. Specifically, we use the official pretrained T5-Large (770 million parameters) and finetuned it on DeepBank in-domain training set. Despite the general fact that larger model size will lead to better performance on finetuning for some tasks, our empirical results show that adopting model sizes larger than T5-Large will not lead to further gain for ERG parsing. + +For the collaborative neural-symbolic parsing, we set the beam size to 5, i.e., our combined predictions will be selected from the top 5 predictions + +produced by the model. For the monotonic transformation $\alpha (\pmb {x})$ in (2), we set We set $\lambda = 0.1$ and $T = 0.1$ + +Evaluation Metrics For evaluation, following previous work, we adopt the SMATCH metric (Cai and Knight, 2013), which was originally proposed for evaluating AMR graphs. It measures graph overlap, but does not rely on sentence alignments to determine the correspondences between graph nodes. Specifically, SMATCH is computed by performing inference over graph alignments to estimate the maximum F1-score obtainable from a one-to-one matching between the predicted and gold graph nodes. This is also ideal for measuring the divergence between predicted and prior graphs in our collaborative framework. + +
NodeEdgeGraph
PRFPRFSMATCH
w/o preprocess96.2991.7293.9593.8688.6691.1992.57
w/ preprocess97.6796.9397.3097.7196.8595.8196.54
+ +Impact of Tokenization To validate the effectiveness of our proposed tokenization process, we report the performance of node and edge prediction and the SMATCH scores with and without the process on the test set in Table 1, which indicates that after this process, the SMATCH score is improved by $4.29\%$ on the test set. We can find that the recall score for node prediction has significant improvement, and this is because that the sequence without tokenization preprocessing will lead to longer sequence length, and many output graphs have reached the max decoding sequence length and thus are incomplete. + +Table 1: Comparison of precision, recall, and F1-score for node and edge prediction and SMATCH scores on the test set under the settings of with/without tokenization preprocessing. + +
ModelNodeEdgeSMATCH
\(ACE^5\)93.1888.7690.94
Transition-based (Buys and Blunsom, 2017)89.0684.9687.00
SHRG-based (Chen et al., 2018)94.5187.2990.86
Composition-based (Chen et al., 2019)95.6391.4393.56
Factorization-based (Chen et al., 2019)97.2894.0395.67
Factorization-based (Cao et al., 2021)96.4293.7395.05
ACE-T5 (following Shaw et al. (2021))93.4689.1991.30
Translation-based (Ours)97.3095.8196.54
+ Uncertainty-based Collaboration97.6496.4197.01
+ +Table 2: F1 score for node and edge predictions and the SMATCH scores on the test set. + +Comparison with Existing Parsers We compared our parser with the grammar-based ACE parser and other data-driven parsers in Table 2. The baseline models also include a similar practice with Shaw et al. (2021), which takes T5 as a backup for grammar-based parser. Our model outperforms all previous work, and achieves a SMATCH score of 96.54 (a $30.1\%$ error reduction), which is a significant improvement over existing parsers on this well-studies benchmark. After applying the collaborative parsing framework, we further improve the parser's performance to 97.01 (a $39.6\%$ error reduction). + +We notice that using the simple margin probability as the uncertainty estimator performs better than weighted entropy. We then conduct an investigation on the calibration quality of model uncertainty using different estimators. Specifically, we find predictive margin exhibits a surprisingly strong correlation with the model's test SMATCH score, while some more well-known uncertainty metrics (e.g., predictive entropy) are poorly calibrated. More details can be found in Appendix D. + +# 5 Fine-grained Linguistic Evaluation + +Though performs better than symbolic parser, we find that actually neural and symbolic parsers yield different distributions on the test set (see Appendix C for details). This has motivated us to dive deeply into more fine-grained evaluation for our models. + +ERG provides different levels of linguistic information that is beneficial to many NLP tasks, e.g., named entity recognition, semantic role labeling, and coreference. This rich linguistic annotation can help us quantify different types of errors the model makes. We reported the detailed evaluation results in Table 3. Specifically, we consider: + +Lexical construction ERG uses the abstract node compound to denote compound words. The edge labeled with ARG1 refers to the root of the compound word, and thus can help to further distinguish the type of the compound into (1) nominal with normalization, e.g., "flag burning"; (2) nominal with noun, e.g., "pilot union"; (3) verbal, e.g., + +“state-owned”; (4) named entities, e.g., “West Germany”. + +Argument structure In ERG, there are different types of core predicates in argument structures, specifically, verbs, nouns and adjectives. We also categorize verb in to basic verb (e.g., _look_v_1) and verb particle constructions (e.g., _look_v_up). The verb particle construction is handled semantically by having the verb contribute a relation particular to the combination. + +Coreference ERG resolves sentence-level coreference, i.e., if the sentence referring to the same entity, the entity will be an argument for all the nodes that it is an argument of, e.g., in the sentence, "What we want to do is take a more aggressive stance", the predicates "want" (_want_v_1) and "take" (_take_v_1) share the same agent "we" (pron). As discussed before, this can be presented as reentrancies in the ERG graph, we notice that one important type of reentrancies is the passive construction (e.g., $\text{parg\_d}$ in Figure 1), so we also report evaluation on passive construction in Table 3. + +
Type#ACET5Collab.
Compound2,26680.5890.4690.36
Nominal w/nominalization2285.7189.6682.76
Nominal w/noun1,04485.2890.9691.42
Verbal2375.0077.2781.82
Named entity1,15382.9291.3690.40
Argument structure7,10886.9890.6891.66
Total verb4,17685.3489.7590.50
Basic verb2,35685.7989.9790.90
ARG11,68390.2593.4093.94
ARG21,99590.4892.9593.79
ARG319585.6383.0884.62
Verb-particle1,76184.6989.4790.00
ARG11,54589.5793.5094.05
ARG292386.2791.1091.26
ARG312287.8886.7588.08
Total noun39492.4191.8492.63
Total adjective2,53889.0592.0993.25
Reentrancy2,34377.2987.8888.43
passive52284.8991.5492.72
+ +Table 3: Comparing ACE, T5 parsers and collaborative parsing (Collab.) on fine-grained linguistic categories. All scores are reported in accuracy. The underlined denotes the best in ACE and T5, and the bold denotes the best in ACE, T5 and Collab. + +As shown, the T5 parser performs much better than ACE, especially for compound recognition. + +This indicates that local semantic information such as compound constructions or named entities can be easily captured by those pretrained embedding-based models. For argument structure, though performs better than ACE in most cases, the T5 parser still has relatively low accuracy for ARG3 and noun structure recognition. This is mainly due to their relatively low frequency in the training set (1.94% for ARG3 and 5.54% for noun argument structures). + +Our analysis in this section is consistent with previous work: the T5 parser, similar to many other neural parsers, is fragile to tail instances that do not have sufficient representation in the training data. We also further report the evaluation results for our collaborative neural-semantic parsing framework (Collab.), where we can see that it brings improvement for the issues above, which validates the effectiveness of the collaborative framework. + +# 6 Conclusions and Future Work + +In this paper, we present a simple, uncertainty-based approach to collaborative neural-symbolic parsing for graph-based meaning representations. In contrary to the prior neural-symbolic approaches, we maintain the simplicity of the seq2seq training, and design a decision-theoretic inference criteria for beam candidate selection, incorporating model uncertainty and prior knowledge from an existing symbolic parser. + +Remarkably, despite the simplicity of the method, our approach strongly outperforms all the previously-known approach on the DeepBank benchmark (Table 2), and attains strong performance even in the tail linguistic categories (Table 3). Our study revealed that the commonly observed weakness of the neural model may root from a sub-optimal inference procedure. Therefore, developing a more calibrated neural semantic parser and developing principled inference procedure may be a fruitful avenue for addressing the generalization issues of neural parsers. + +In the future, we plan to apply this approach to a broader range of graph meaning representations, e.g., AMR (Banarescu et al., 2013) and UCCA (Abend and Rappoport, 2013), and build a more advanced uncertainty estimation approach to quantify model uncertainty about sub-components of the graph, thereby allowing more fine-grained integration between neural prediction and symbolic derivations. + +# Acknowledgement + +Our work is sponsored in part by National Science Foundation Convergence Accelerator under award OIA-2040727 as well as generous gifts from Google, Adobe, and Teradata. Any opinions, findings, and conclusions or recommendations expressed herein are those of the authors and should not be interpreted as necessarily representing the views, either expressed or implied, of the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints for government purposes notwithstanding any copyright annotation hereon. Jingbo Shang is the corresponding author. We thank Du Phan for engineering support, and Deepak Ramachandran, Balaji Lakshminarayanan and Jie Ren for helpful discussion. + +# Ethical Consideration + +This paper focused on collaborative neural-symbolic semantic parsing for the English Resource Grammar (ERG). Our architecture are built based on open-source models and datasets (all available online). We do not anticipate any major ethical concerns. + +# References + +Omri Abend and Ari Rappoport. 2013. Universal Conceptual Cognitive Annotation (UCCA). In Proceedings of the 51st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 228-238, Sofia, Bulgaria. Association for Computational Linguistics. +Peter Adolphs, Stephan Oepen, Ulrich Callmeier, Berthold Crysmann, Dan Flickinger, and Bernd Kiefer. 2008. Some fine points of hybrid natural language parsing. In Proceedings of the Sixth International Conference on Language Resources and Evaluation (LREC'08), Marrakech, Morocco. European Language Resources Association (ELRA). +Timothy Baldwin, Emily M. Bender, Dan Flickinger, Ara Kim, and Stephan Oepen. 2004. Road-testing the English Resource Grammar over the British National Corpus. In Proceedings of the Fourth International Conference on Language Resources and Evaluation (LREC'04), Lisbon, Portugal. European Language Resources Association (ELRA). +Laura Banarescu, Claire Bonial, Shu Cai, Madalina Georgescu, Kira Griffith, Ulf Hermjakob, Kevin Knight, Philipp Koehn, Martha Palmer, and Nathan Schneider. 2013. Abstract Meaning Representation for sembanking. In Proceedings of the 7th Linguistic + +Annotation Workshop and Interoperability with Discourse, pages 178-186, Sofia, Bulgaria. Association for Computational Linguistics. +Guntis Barzdins and Didzis Gosko. 2016. RIGA at SemEval-2016 task 8: Impact of Smatch extensions and character-level neural translation on AMR parsing accuracy. In Proceedings of the 10th International Workshop on Semantic Evaluation (SemEval-2016), pages 1143–1147, San Diego, California. Association for Computational Linguistics. +Johan Bos, Stephen Clark, Mark Steedman, James R Curran, and Julia Hockenmaier. 2004. Widecoverage semantic representations from a ccg parser. In COLING 2004: Proceedings of the 20th International Conference on Computational Linguistics, pages 1240-1246. +Jan Buys and Phil Blunsom. 2017. Robust incremental neural semantic graph parsing. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1215-1226, Vancouver, Canada. Association for Computational Linguistics. +Shu Cai and Kevin Knight. 2013. Smatch: an evaluation metric for semantic feature structures. In Proceedings of the 51st Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 748-752, Sofia, Bulgaria. Association for Computational Linguistics. +Ulrich Callmeier. 2000. Pet-a platform for experimentation with efficient hpsg processing techniques. *Natural Language Engineering*, 6(1):99-107. +Junjie Cao, Zi Lin, Weiwei Sun, and Xiaojun Wan. 2021. Comparing knowledge-intensive and data-intensive models for english resource semantic parsing. Computational Linguistics, 47(1):43-68. +Yufei Chen, Weiwei Sun, and Xiaojun Wan. 2018. Accurate SHRG-based semantic parsing. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 408-418, Melbourne, Australia. Association for Computational Linguistics. +Yufei Chen, Yajie Ye, and Weiwei Sun. 2019. Peking at MRP 2019: Factorization- and composition-based parsing for elementary dependency structures. In Proceedings of the Shared Task on Cross-Framework Meaning Representation Parsing at the 2019 Conference on Natural Language Learning, pages 166–176, Hong Kong. Association for Computational Linguistics. +Jianpeng Cheng, Siva Reddy, Vijay Saraswat, and Mirella Lapata. 2019. Learning an executable neural semantic parser. Computational Linguistics, 45(1):59-94. +Ann Copestake. 2009. Invited Talk: slacker semantics: Why superficiality, dependency and avoidance + +of commitment can be the right way to go. In Proceedings of the 12th Conference of the European Chapter of the ACL (EACL 2009), pages 1-9, Athens, Greece. Association for Computational Linguistics. +Ann Copestake and Dan Flickinger. 2000. An open source grammar development environment and broad-coverage English grammar using HPSG. In Proceedings of the Second International Conference on Language Resources and Evaluation (LREC'00), Athens, Greece. European Language Resources Association (ELRA). +Ann Copestake, Dan Flickinger, Carl Pollard, and Ivan A Sag. 2005. Minimal recursion semantics: An introduction. Research on language and computation, 3(2):281-332. +Li Dong, Chris Quirk, and Mirella Lapata. 2018. Confidence modeling for neural semantic parsing. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 743-753, Melbourne, Australia. Association for Computational Linguistics. +Dan Flickinger, Emily M. Bender, and Stephan Oepen. 2014. Towards an encyclopedia of compositional semantics: Documenting the interface of the English Resource Grammar. In Proceedings of the Ninth International Conference on Language Resources and Evaluation (LREC'14), pages 875-881, Reykjavik, Iceland. European Language Resources Association (ELRA). +Dan Flickinger, Stephan Oepen, and Gisle Ytrestøl. 2010. WikiWoods: Syntacto-semantic annotation for English Wikipedia. In Proceedings of the Seventh International Conference on Language Resources and Evaluation (LREC'10), Valletta, Malta. European Language Resources Association (ELRA). +Dan Flickinger, Yi Zhang, and Valia Kordoni. 2012. Deepbank: a dynamically annotated treebank of the wall street journal. In Proceedings of the 11th International Workshop on Treebanks and Linguistic Theories, pages 85-96. +Phan H. Giang. 2015. Decision making under uncertainty comprising complete ignorance and probability. International Journal of Approximate Reasoning, 62:27-45. +Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q Weinberger. 2017. On calibration of modern neural networks. In International Conference on Machine Learning, pages 1321-1330. PMLR. +Leonid Hurwicz. 1951. The generalized bayes minimax principle: a criterion for decision making under uncertainty. *Cowles Comm. Discuss. Paper Stat*, 335:1950. +Angelina Ivanova, Stephan Oepen, Rebecca Dridan, Dan Flickinger, and Lilja Øvrelid. 2013. On different + +approaches to syntactic analysis into bi-lexical dependencies. an empirical comparison of direct, PCFG-based, and HPSG-based parsers. In Proceedings of the 13th International Conference on Parsing Technologies (IWPT 2013), pages 63-72, Nara, Japan. Association for Computational Linguistics. +Angelina Ivanova, Stephan Oepen, Lilja Øvrelid, and Dan Flickinger. 2012. Who did what to whom? a contrastive study of syntacto-semantic dependencies. In Proceedings of the Sixth Linguistic Annotation Workshop, pages 2-11, Jeju, Republic of Korea. Association for Computational Linguistics. +Amita Kamath, Robin Jia, and Percy Liang. 2020. Selective question answering under domain shift. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 5684-5696, Online. Association for Computational Linguistics. +Robert T Kasper. 1989. A flexible interface for linking applications to penman's sentence generator. In Speech and Natural Language: Proceedings of a Workshop Held at Philadelphia, Pennsylvania, February 21-23, 1989. +Yoon Kim. 2021. Sequence-to-sequence learning with latent neural grammars. arXiv preprint arXiv:2109.01135. +Ian Kivlichan, Zi Lin, Jeremiah Liu, and Lucy Vasserman. 2021. Measuring and improving modelmoderator collaboration using uncertainty estimation. In Proceedings of the 5th Workshop on Online Abuse and Harms (WOAH 2021), pages 36-53, Online. Association for Computational Linguistics. +Ioannis Konstas, Srinivasan Iyer, Mark Yatskar, Yejin Choi, and Luke Zettlemoyer. 2017. Neural AMR: Sequence-to-sequence models for parsing and generation. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 146-157, Vancouver, Canada. Association for Computational Linguistics. +Brenden Lake and Marco Baroni. 2018. Generalization without systematicity: On the compositional skills of sequence-to-sequence recurrent networks. In International conference on machine learning, pages 2873-2882. PMLR. +Liyuan Liu, Zihan Wang, Jingbo Shang, Dandong Yin, Heng Ji, Xiang Ren, Shaowen Wang, and Jiawei Han. 2019. Raw-to-end name entity recognition in social media. arXiv preprint arXiv:1908.05344. +Andrey Malinin and Mark Gales. 2020. Uncertainty estimation in autoregressive structured prediction. In International Conference on Learning Representations. +Ryan McDonald. 2006. Discriminative learning and spanning tree algorithms for dependency parsing. University of Pennsylvania Philadelphia. + +Joakim Nivre. 2008. Algorithms for deterministic incremental dependency parsing. Computational Linguistics, 34(4):513-553. +Stephan Oepen, Omri Abend, Jan Hajic, Daniel Hershcovich, Marco Kuhlmann, Tim O'Gorman, Nianwen Xue, Jayeol Chun, Milan Straka, and Zdenka Uresova. 2019. MRP 2019: Cross-framework meaning representation parsing. In Proceedings of the Shared Task on Cross-Framework Meaning Representation Parsing at the 2019 Conference on Natural Language Learning, pages 1-27, Hong Kong. Association for Computational Linguistics. +Stephan Oepen, Marco Kuhlmann, Yusuke Miyao, Daniel Zeman, Silvie Cinkova, Dan Flickinger, Jan Hajic, and Zdenka Urešová. 2015. SemEval 2015 task 18: Broad-coverage semantic dependency parsing. In Proceedings of the 9th International Workshop on Semantic Evaluation (SemEval 2015), pages 915–926, Denver, Colorado. Association for Computational Linguistics. +Stephan Oepen and Jan Tore Lønning. 2006. Discriminant-based MRS banking. In Proceedings of the Fifth International Conference on Language Resources and Evaluation (LREC'06), Genoa, Italy. European Language Resources Association (ELRA). +Xiaochang Peng and Daniel Gildea. 2016. UofR at SemEval-2016 task 8: Learning synchronous hyperedge replacement grammar for AMR parsing. In Proceedings of the 10th International Workshop on Semantic Evaluation (SemEval-2016), pages 1185–1189, San Diego, California. Association for Computational Linguistics. +Xiaochang Peng, Linfeng Song, and Daniel Gildea. 2015. A synchronous hyperedge replacement grammar based approach for AMR parsing. In Proceedings of the Nineteenth Conference on Computational Natural Language Learning, pages 32-41, Beijing, China. Association for Computational Linguistics. +Xiaochang Peng, Chuan Wang, Daniel Gildea, and Ni-anwen Xue. 2017. Addressing the data sparsity issue in neural AMR parsing. In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics: Volume 1, Long Papers, pages 366-375, Valencia, Spain. Association for Computational Linguistics. +John Platt et al. 1999. Probabilistic outputs for support vector machines and comparisons to regularized likelihood methods. Advances in large margin classifiers, 10(3):61-74. +Carl Pollard and Ivan A Sag. 1994. Head-driven phrase structure grammar. University of Chicago Press. +Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. 2020. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research, 21:1-67. + +Peter Shaw, Ming-Wei Chang, Panupong Pasupat, and Kristina Toutanova. 2021. Compositional generalization and natural language variation: Can a semantic parsing approach handle both? In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 922–938, Online. Association for Computational Linguistics. +V. Ulansky and A. Raza. 2021. Generalization of minimax and maximin criteria in a game against nature for the case of a partial a priori uncertainty. *Heliyon*, 7(7):e07498. +Oriol Vinyals, Lukasz Kaiser, Terry Koo, Slav Petrov, Ilya Sutskever, and Geoffrey Hinton. 2015. Grammar as a foreign language. Advances in neural information processing systems, 28:2773-2781. +Hiroyasu Yamada and Yuji Matsumoto. 2003. Statistical dependency analysis with support vector machines. In Proceedings of the Eighth International Conference on Parsing Technologies, pages 195-206, Nancy, France. +Yilin Yang, Liang Huang, and Mingbo Ma. 2018. Breaking the beam search curse: A study of (re-)scoring methods and stopping criteria for neural machine translation. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 3054-3059, Brussels, Belgium. Association for Computational Linguistics. +John M Zelle and Raymond J Mooney. 1996. Learning to parse database queries using inductive logic programming. In Proceedings of the national conference on artificial intelligence, pages 1050-1055. + +# Appendix + +# A Detailed Implementation of Linearization + +The original PENMAN styled linearization for graph in Figure 1 can be written as: + +```lisp +(x0 / __introduced_v_to +:ARG2 (x1 / _drug_n_1 +:BV-of (x2 / _the_q)) +:ARG1-of (e0 / barg_d +:ARG2 x1) +:ARG1-of (e1 / loc_nonsp +:ARG2 (x3 / _year_n_1 +:BV-of (x4 / _this_d-dem))) +:ARG1-of (x5 / _in_p +:ARG2 (e2 / named +:BV-of (e3 / proper_q) +:ARG1-of (e4 / compound +:ARG2 (e5 / named +:BV-of (e6 / proper_q)))) +``` + +The term -of is used for reversing the edge direction for graph traversing. Nodes in the graph get identifiers (e.g., $x_0$ , $e_0$ ), which can be referred to later to establish a reentrancy, e.g., the node _drug_n_1 serves as ARG2 of _introduced_v_to and ARG2 of _parg_d at the same time, so the identifier x_1 appears twice in the notation. However, in our settings, these identifiers can be randomly set to any unique symbols, which will confuse the model to learn the real meaningful mappings. To tackle this issue and create a variable-free version of the PENMAN notation, we replace these identifiers with star markers to indicate reentrancy, e.g., replacing $x_1$ with _drug_n_1 *. + +To illustrate more about reentrancies, we consider two different types of cases: + +(1) For cases where the second reentrancy still points back to the first _drug_n_1, e.g., in the sentence "the drug was introduced and used this year", the node will still be marked as _drug_n_1*. +(2) For cases where the second reentrancy refers to another token span in the sentences, e.g., in the sentence "The drug was introduced this year, and another drug will be introduced next year", the second node reentrancy will be marked as _drug_n_1 $\star \star$ . + +In other words, the max number of star markers $\star$ indicates the total number of different reentrancies in the sentences. This will not confuse the model to do the reentrancy prediction as it can always refer to how many reentrancies have been predicted in the previous sequences. + +# B Details about Tokenization + +ERG makes an explicit distinction between nodes with surface relations (prefix by an underscore), and with grammatical meanings. The former, called the surface node, consists of a lemma followed by a coarse part-of-speech tag and an optional sense label. For example, for the node _drug_n_1 in Figure 1, the surface lemma is drug (_drug), the part-of-speech is noun (_n), and _1 here specifies that it is the first sense under the noun "drug". The later, called the abstract node, is used to represent the semantic contribution of grammatical constructions or more specialized lexical entries, e.g., $\text{parg\_d}$ (for passive), proper_q (for quantification of proper words), compound (for compound words), and named (for named entities). + +It is noted that the set of abstract concepts and edges are fixed and relatively small (88 for abstract nodes and 11 for edges in the training set), while the surface nodes have high productivity, i.e., many different lemmas can fit into some fixed patterns such as _n_1 and _v_to. Therefore, we rewrite those fixed abstract, concepts surface patterns and edges into some non-tokenizable tokens in the T5 vocabulary to inform the model that these units are non-compositional in ERG graphs. + +# C Distributions of the T5 and ACE Parsers + +![](images/9fa315bd949ca2d61445684cb38b022ddf78ca08a3da52a359f17b0b5cd735eb.jpg) +Figure 2: SMATCH scores of the T5 and ACE parsers across test examples + +# D Uncertainty Estimates and Calibration Performance + +There has been some work exploring the model uncertainty for seq2seq parser or some other non seq2seq models (Dong et al., 2018; Kamath et al., 2020). In this section, we are also interested in investigating the calibration quality of model uncertainty of a seq2seq neural parser. For the proposed criteria (2) to perform robustly in practice, + +the uncertainty estimator $\mathcal{H}(\pmb{x})$ should be well calibrated, i.e., the magnitude of $\mathcal{H}$ is indicative of the model's predictive error. To this end, we notice that a reliable uncertainty measure for sequence prediction tasks is still an open research challenge (Malinin and Gales, 2020). In this work, we experiment with several well-known estimators of model uncertainty: + +Margin probability. The simplest estimator for model uncertainty is the predictive margin, i.e., the difference in probability of the top 1 prediction minus the likelihood of the top 2 prediction based on the beam score: + +$$ +\mathcal {H} _ {\text {m a r g i n}} (p (\boldsymbol {y} | \boldsymbol {x}, \mathcal {D})) = p (\boldsymbol {y} ^ {(1)} | \boldsymbol {x}, \mathcal {D}) - p (\boldsymbol {y} ^ {(2)} | \boldsymbol {x}, \mathcal {D}) +$$ + +Weighted entropy. Considering that our model uses beam-search for inference, and with regards to the Monte-Carlo estimators, beam-search can be interpreted as a form of importance-sampling which yields hypotheses from high-probability regions of the hypothesis space. We can estimate uncertainty which is importance-weighted in proportion to $p(\pmb{y}^{(b)}|\pmb{x},\mathcal{D})$ such that + +$$ +\mathcal {H} _ {\mathrm {e n t r o p y}} (p (\boldsymbol {y} | \boldsymbol {x}, \mathcal {D})) = - \sum_ {b = 1} ^ {B} \frac {\pi_ {b}}{L ^ {(b)}} \ln p (\boldsymbol {y} ^ {(b)} | \boldsymbol {x}, \mathcal {D}), +$$ + +where $\pi_b = \frac{p(\boldsymbol{y}^{(b)}|\boldsymbol{x},\mathcal{D})}{\sum_k^B p(\boldsymbol{y}^{(k)}|\boldsymbol{x},\mathcal{D})}$ is the estimated importance weight for each beam candidate (Malinin and Gales, 2020). + +In our experiment, we investigate the calibration of the above uncertainty estimations (see below), and experiment with their respective efficacy in improving the collaborative parsing system's predictive performance (Table 4). + +![](images/9d6527e2477ba9740f004602ece2ac6b28718d88323cb5fa767720ffde40ed43.jpg) +(a) Margin Probability + +![](images/a8dd56fc9b4a7406469daa0f5774c27e1f7ad72e7c991768db7686a5b80416e1.jpg) +(b) Weighted Entropy +Figure 3: Diagrams for the model's confidence verses SMATCH scores on the test set. Each bin contains 50 examples. + +A common approach to evaluate a model's uncertainty quality is to measure its calibration performance, i.e., whether the model's predictive uncertainty is indicative of the predictive error (Guo + +et al., 2017). To understand how well the T5 parser's neural uncertainty correlates with its prediction reliability, we plot the diagrams for the model's confidence verses SMATCH scores on the test set in Figure 3. As shown, comparing to the weighted entropy, margin probability is qualitatively much better calibrated. ${}^{6}$ Correspondingly, Table 4 shows that the collaborative result using margin probability yields much strongly performance, confirming the connection between a uncertainty model's calibration quality and its effectiveness is collaborative prediction (Kivlichan et al., 2021). + +
ModelNodeEdgeSMATCH
ACE93.1888.7690.94
Transition-based (Buys and Blunsom, 2017)89.0684.9687.00
SHRG-based (Chen et al., 2018)94.5187.2990.86
Composition-based (Chen et al., 2019)95.6391.4393.56
Factorization-based (Chen et al., 2019)97.2894.0395.67
Factorization-based (Cao et al., 2021)96.4293.7395.05
ACE-T5 (following Shaw et al. (2021))93.4689.1991.30
T5 (Ours)97.3095.8196.54
Collaborative w/ margin probability97.6496.4197.01
Collaborative w/ weighted entropy97.2796.1496.70
+ +Table 4: F1 score for node and edge predictions and the SMATCH scores on the test set. \ No newline at end of file diff --git a/towardscollaborativeneuralsymbolicgraphsemanticparsingviauncertainty/images.zip b/towardscollaborativeneuralsymbolicgraphsemanticparsingviauncertainty/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..f686d6ce65abccb5dff9bb532b12e1c746fcc63d --- /dev/null +++ b/towardscollaborativeneuralsymbolicgraphsemanticparsingviauncertainty/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:583a1d050625c479106ff52a8969341b3f8387d712d74c41f5f44f5c5d63200d +size 281527 diff --git a/towardscollaborativeneuralsymbolicgraphsemanticparsingviauncertainty/layout.json b/towardscollaborativeneuralsymbolicgraphsemanticparsingviauncertainty/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..0f531dd937b6c3eb7bd0046916d59d42cdb8f2f2 --- /dev/null +++ b/towardscollaborativeneuralsymbolicgraphsemanticparsingviauncertainty/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a60eed642677950fcf8c0928780a54aea34cfa3ac16d5b6b2770d3503b6a0232 +size 439801 diff --git a/towardsfewshotentityrecognitionindocumentimagesalabelawaresequencetosequenceframework/41cc8be2-bc68-4a82-89dd-6a3e7fb36ef8_content_list.json b/towardsfewshotentityrecognitionindocumentimagesalabelawaresequencetosequenceframework/41cc8be2-bc68-4a82-89dd-6a3e7fb36ef8_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..24af14aa0a1d93e4243c6b6b44b32f1239f8cf9a --- /dev/null +++ b/towardsfewshotentityrecognitionindocumentimagesalabelawaresequencetosequenceframework/41cc8be2-bc68-4a82-89dd-6a3e7fb36ef8_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:297f7e8677bc09c3b7c34306dc69c48804e55c0dd6b886ab7557f1859793a4d5 +size 87703 diff --git a/towardsfewshotentityrecognitionindocumentimagesalabelawaresequencetosequenceframework/41cc8be2-bc68-4a82-89dd-6a3e7fb36ef8_model.json b/towardsfewshotentityrecognitionindocumentimagesalabelawaresequencetosequenceframework/41cc8be2-bc68-4a82-89dd-6a3e7fb36ef8_model.json new file mode 100644 index 0000000000000000000000000000000000000000..67fcda5c810952a1b0a7313a275b06136b0e694a --- /dev/null +++ b/towardsfewshotentityrecognitionindocumentimagesalabelawaresequencetosequenceframework/41cc8be2-bc68-4a82-89dd-6a3e7fb36ef8_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e49be068cfb1b8f78bd3124c200cb855d72cd393ed29f05f83b8874536dd98dd +size 104329 diff --git a/towardsfewshotentityrecognitionindocumentimagesalabelawaresequencetosequenceframework/41cc8be2-bc68-4a82-89dd-6a3e7fb36ef8_origin.pdf b/towardsfewshotentityrecognitionindocumentimagesalabelawaresequencetosequenceframework/41cc8be2-bc68-4a82-89dd-6a3e7fb36ef8_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b4329c731cc3152127a31551460ce3513651ad1a --- /dev/null +++ b/towardsfewshotentityrecognitionindocumentimagesalabelawaresequencetosequenceframework/41cc8be2-bc68-4a82-89dd-6a3e7fb36ef8_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d9130b4801a37a222ef18007096b04740936734c8236fa0992b8f03f60875c24 +size 4002515 diff --git a/towardsfewshotentityrecognitionindocumentimagesalabelawaresequencetosequenceframework/full.md b/towardsfewshotentityrecognitionindocumentimagesalabelawaresequencetosequenceframework/full.md new file mode 100644 index 0000000000000000000000000000000000000000..7cff2c1f8b2afdd234443c62019fc4b4175ca9a9 --- /dev/null +++ b/towardsfewshotentityrecognitionindocumentimagesalabelawaresequencetosequenceframework/full.md @@ -0,0 +1,348 @@ +# Towards Few-shot Entity Recognition in Document Images: A Label-aware Sequence-to-Sequence Framework + +Zilong Wang + +University of California, San Diego + +zlwang@ucsd.edu + +Jingbo Shang* + +University of California, San Diego + +jshang@ucsd.edu + +# Abstract + +Entity recognition is a fundamental task in understanding document images. Traditional sequence labeling frameworks treat the entity types as class IDs and rely on extensive data and high-quality annotations to learn semantics which are typically expensive in practice. In this paper, we aim to build an entity recognition model requiring only a few shots of annotated document images. To overcome the data limitation, we propose to leverage the label surface names to better inform the model of the target entity type semantics and also embed the labels into the spatial embedding space to capture the spatial correspondence between regions and labels. Specifically, we go beyond sequence labeling and develop a novel label-aware seq2seq framework, LASER. The proposed model follows a new labeling scheme that generates the label surface names word-by-word explicitly after generating the entities. During training, LASER refines the label semantics by updating the label surface name representations and also strengthens the label-region correlation. In this way, LASER recognizes the entities from document images through both semantic and layout correspondence. Extensive experiments on two benchmark datasets demonstrate the superiority of LASER under the few-shot setting. + +# 1 Introduction + +Entity recognition lies in the foundation of document image understandings, which aims at extracting word spans that perform certain roles from the document images, such as header, question. Distinct from the text-only named entity recognition task, the document images, such as forms, tables, receipts, and multi-columns, provide a perfect scenario to apply multi-modal techniques into practice where the rich layout formats in such document images serve as the new, complementary signals for entity recognition performance in addition to the existing textual data. + +Recent methods (Xu et al., 2020; Hong et al., 2020; Garncarek et al., 2021) follow the traditional sequence labeling framework to extract the word spans using the standard IOBES tagging schemes (Marquez et al., 2005; Ratinov and Roth, 2009) in named entity recognition tasks. Entity types are treated as class IDs and the semantics of the label surface names are ignored. These methods also largely extend the label space by including combinations of the boundary identifiers (B, I, E, S) and entity types. For instance, when there are 3 target entity types, the extended label space would have 13 (i.e., $4 \times 3 + 1$ ) dimensions. As a result, they fail to learn from the data efficiently and require extensive datasets and high-quality annotations to create the connection between entities and their entity types. Meanwhile, document images typically include various formats and have a high diversity of entities within each page. It is expensive or almost impossible to enumerate all required entity types and obtain enough annotated data for them. Moreover, ethical concerns would arise when it comes to the receipts or consent forms, which makes it even harder to collect enough data. + +Due to the inefficiency of traditional methods and the data limitation in real application scenarios, it is necessary to resort to few-shot learning for entity recognition in document images. We aim at exploiting the potential of a limited number of training pages and try to generalize our model on the much larger number of new pages for testing. In our method, we go beyond the sequence labeling framework and reformulate the entity recognition as a sequence-to-sequence task. Specifically, we propose a new generative labeling scheme for entity recognition — the label surface name is explicitly generated right after each entity as a part of the target sequence. In this way, different entity types are no longer independent dimensions in the label space and models can leverage the semantic connect between the entities and entity types. + +To this end, we propose a label-aware sequence-to-sequence framework for entity recognition, LASER. Our implementation is based on pretrained language model LayoutReader (Wang et al., 2021), which is a layout-aware pre-trained sequence-to-sequence model. + +As shown in Figure 1, LASER extends the architecture of LayoutReader for our proposed generative labeling scheme to better solve the few-shot entity recognition task for document images. Specifically, after generating certain word spans, the model can choose to generate either the following words in the source sequence or label surface names. The entity labels are explicitly inserted in the generated sequence so that the probability of the entity types conditioned on the entity, $P(\text{type|entity})$ , can be maximized not only by the signals from the training data but also by the knowledge from the pre-training of the language models. We also embed the label surface names into the spatial embedding space, so the generation of labels is also aware of the correlation between labels and the regions in the page. + +Benefit from the novel generative labeling scheme and the semantics of labels, LASER is able to effectively recognize entities in document images with only a limited number of training samples. In contrast, the sequence labeling models use less efficient tagging scheme, thus requiring more data and failing in the few-shot settings. + +We validate LASER using two benchmarks, FUNSD (Guillaume Jaume, 2019) and CORD-Lv1 (Park et al., 2019). Both datasets are from real scenarios and fully-annotated with textual contents and bounding boxes. We compare our model with strong baselines and study the label-entity semantic and spatial correlations. We summarize our contribution as follows. + +- We reformulate the entity recognition task and propose a new generative labeling scheme that embeds the label surface names into the target sequence to explicitly inform the model of the label semantics. +- We propose a novel label-aware sequence-to-sequence framework LASER to better handle few-shot entity recognition tasks for document images than the traditional sequence labeling framework using both label semantics and layout format learning. +- Extensive experiments on two benchmark + +datasets demonstrate the effectiveness of LASER under few-shot settings. + +Reproducibility. We will release the code and datasets on Github2. + +# 2 Problem Formulation + +The few-shot entity recognition in the document images is to take the text and layout inputs from a limited number of training samples to predict the boundary of each entity and classify the entity into categories. Given a document image page $\mathcal{P}$ , the words within the page are annotated with their textual contents $w$ and the bounding boxes $B = (x_0, y_0, x_1, y_1)$ (top-left and bottom-right corners) by human annotators or the OCR engines, and all the words and bounding boxes are listed in a sequence serving as the inputs from textual and layout modalities. In this way, the entities are spans of these words referring to precise concepts, which makes it possible to conduct entity recognition using sequence labeling or generative labeling scheme. We randomly select a small subset of training samples and evaluate the performance under the $k$ -shot training, where $k$ denotes the number of the training samples. + +# 3 Our Generative Labeling Scheme + +We propose our labeling scheme of entity recognition in the generative manner which generates the entity boundaries and the label surface names explicitly. Specifically, given an entity $e = [w_i, w_{i+1}, \dots, w_j]$ , we use the [B] and [E] to denote the boundary of the entity and append the label surface name afterwards. Overall, the generative formulation is to generate: + +$$ +w _ {i - 1}, [ \mathbf {B} ], w _ {i}, \dots , w _ {j}, [ \mathbf {E} ], \tau_ {\mathbf {1}}, \dots , \tau_ {\mathbf {k}}, [ \mathbf {T} ], w _ {j + 1} +$$ + +where $[\mathsf{B}]$ and $[\mathsf{E}]$ denote the start and end of the entity; $\tau_{1}\dots \tau_{k}$ are the words in the label surface name; [T] denotes the end of the label surface name. For example, "Sender" and "Charles Duggan" are a pair of question and answer from a document image. According to the generative labeling scheme, the corresponding generated sequence is that: [B] Sender [E] question [T] [B] Charles Duggan [E] answer [T]. + +# 4 Our LASER Framework + +In this section, we introduce our label-aware sequence-to-sequence framework for entity recog- + +![](images/8aab9552925a7a64470b2f924497364ba24d6460b3bfcf3dea30fda70fcae472.jpg) +Figure 1: The Framework of LASER: [B], [E], [T] denote the boundaries; $\tau$ , $\tau'$ , $\tau''$ are the label surface names; (a) is the process of generative labeling scheme; (b) shows the alignment of the spatial identifiers and embeddings. + +nition in document images. First, we introduce our method in a bird's eye view. Then we dive into the details of each part including the multi-modal prefix language model, the label-aware generation. + +# 4.1 Overview + +Our proposed LASER is a label-aware sequence-to-sequence model for entity recognition in document images. The framework is shown in Figure 1. The model follows the prefix language model paradigm (Raffel et al., 2019; Dong et al., 2019a; Bao et al., 2020) and is built upon the pre-trained language model, LayoutReader (Wang et al., 2021). With extensive knowledge learned in pre-training stage, the model leverages the semantic meaning of label surface names during generation. + +Since the functional tokens (e.g. [B], [E]) and the label surface names are foreign words in the given page, their layout features are nonexistent. We use trainable vectors as special layout identifiers for these extra tokens and these vectors are well aligned into the spatial embedding space. In this way, the spatial correspondence between layout formats and labels can be learned. + +To reinforce the model to distinguish the functional tokens (e.g. [B], [E]) and ordinary words, an extra binary classification module is added, and the probability is used in the next token prediction. + +Equipped with all the components, our proposed model is able to conduct entity recognition effi + +ciently and effectively under the few-shot setting. + +# 4.2 Multi-modal Prefix LM + +LASER is built on the layout-aware prefix language model, LayoutReader (Wang et al., 2021). Prefix language model refers to a multi-layered Transformer where the source sequence and target sequence are packed together and a "partially-triangle" mask is used to control the attention between tokens in the two sequences. In LASER, the source sequence has full self-attention and the target sequence only attends to the previous tokens so the conditional generative probability is learned. + +Input Embedding The input embedding layer of LASER includes the word embedding, spatial embedding, and positional embedding. We normalize and round the bounding box coordinates to integers ranging from 0 to 1000, and embed them as trainable vectors as spatial embeddings (Xu et al., 2020, 2021a,b; Wang et al., 2021). So the input embeddings of the ordinary words are as follows: + +$$ +e _ {w _ {i}} = \operatorname {W o r d E m b} (w _ {i}) + \operatorname {S p a t i a l E m b} (B _ {i}) + \operatorname {P o s E m b} (i) +$$ + +where WordEmb, SpatialEmb, PosEmb are the word embedding, the spatial embedding, and the positional embedding lookup tables, respectively; $i$ is the index of the word in the packed sequence. + +The functional tokens and label surface names are new tokens in the given page. We cannot extract the layout features from the bounding boxes of + +them because their bounding boxes are nonexistent. Instead of the actual bounding boxes, we design unique embedding vectors for each new tokens as their layout identifiers. These identifiers can perform in the same way as real bounding boxes during training to embed the functional tokens and label surface names into the spatial embedding space. The input embedding replaces the spatial embedding with the spatial identifiers: + +$$ +e _ {\lambda} = \operatorname {W o r d E m b} (\lambda) + \operatorname {S p a t i a l I D} (\lambda) + \operatorname {P o s E m b} (i) +$$ + +where SpatialID is the spatial identifier lookup table; $i$ is the index of the word in the packed sequence; $\lambda \in \{[\mathsf{B}], [\mathsf{E}], [\mathsf{T}], \tau_1, \dots, \tau_t\}$ . + +Within the input embedding layer, the pretrained model learns the semantic and layout formats from word embeddings or spatial features. The spatial embeddings are already pre-trained and further fine-tuned in the downstream tasks, and the spatial identifiers are new to the model and completely trained in the downstream tasks. + +Attention Mask As mentioned, LASER depends on a "partially-triangle" mask to realize sequence-to-sequence training within one encoder. To be more specific, the "partially-triangle" attention mask has two parts, the source part and the target part. In the source part, the tokens can attend to each other, which enables the model to be aware of the entire sequence. In the target part, to predict the next token in a sequence-to-sequence way, we design the "triangle" mask which prevents the tokens from attending to the tokens after them. Therefore, the generative probability conditioned on the previous tokens can be computed. + +Output Hidden States To learn the conditional generative probability of the next token, we take the output hidden states corresponding to the target sequence which is denoted as $\mathbf{h}_{n + 1},\mathbf{h}_{n + 2},\dots,\mathbf{h}_{n + m}$ where $n + 1$ is the beginning of the target sequence in the packed sequence. According to the "partially-triangle" attention mask, $\mathbf{h}_{n + k}$ is produced with the attention to the source tokens and the previous target tokens, i.e., the input embeddings whose index ranges from 1 to $n + k$ . Therefore, $\mathbf{h}_{n + k}$ is used to predict the $(k + 1)$ -th token in the target sequence. + +# 4.3 Label-aware Generation + +In the sequence-to-sequence setting, LASER estimates the probability of next token conditioned on the previous context, i.e. $P(x_{k}|x_{< k})$ and + +$x_{k}\in \mathcal{C}$ , where $\mathcal{C} = \{w_1\dots w_n\} \cup \{\tau_1\dots \tau_t\} \cup$ $\{[\mathtt{B}],[\mathtt{E}],[\mathtt{T}]\}$ is the set of all candidate words. Following LayoutReader, we restrain the candidates within the source words instead of the whole dictionary, and we go beyond it and extend the candidate set to include the functional tokens and label surface names. Moreover, to distinguish whether the next word belongs to the source or not, we design an extra binary classification module. + +Specifically, we take the hidden states $h_k$ to predict whether the next token is from the source or not. We denote the probability $P(x_{k+1} \in \mathrm{src}) = p_{k+1}$ . Then we use $p_{k+1}$ to weight the next token prediction. The probability that the next token is the $i$ -th word in the source is computed as follows: + +$$ +P (x _ {k + 1} = w _ {i} | x _ {\le k}) = \frac {p _ {k + 1} \exp \left(\mathbf {e} _ {w _ {i}} ^ {T} \mathbf {h} _ {k} + b _ {k}\right)}{\sum_ {j} \exp \left(\mathbf {e} _ {w _ {j}} ^ {T} \mathbf {h} _ {k} + b _ {k}\right)} +$$ + +where $w_{i}$ is the $i$ -th word in the source; $\mathbf{e}_{w_i}$ is the input embedding of $w_{i}$ ; $\mathbf{b}_k$ is the bias. + +Similarly, the probability that the next token is one of the functional tokens or label surface names is computed as follows: + +$$ +P (x _ {k + 1} = \lambda | x _ {\leq k}) = \frac {(1 - p _ {k + 1}) \exp \left(\mathbf {e} _ {\lambda} ^ {T} \mathbf {h} _ {k} + b _ {k} ^ {\prime}\right)}{\sum_ {\lambda^ {\prime}} \exp \left(\mathbf {e} _ {\lambda^ {\prime}} ^ {T} \mathbf {h} _ {k} + b _ {k} ^ {\prime}\right)} +$$ + +where $\lambda$ is a functional token or label surface name, i.e. $\lambda \in \{[\mathsf{B}], [\mathsf{E}], [\mathsf{T}], \tau_1, \dots, \tau_t\}$ ; $1 - p_{k+1}$ is the probability that $(k + 1)$ -th token is a functional token or label surface name; $\mathbf{b}_k'$ is the bias. + +Label Semantics Learning With the log likelihood loss of generative language modeling, the model maximize the dot production between the hidden states $\mathbf{h}$ and the input embeddings $e$ . The semantic correlation is learned considering that the input embeddings of the labels surface names are encoded in the word embeddings. + +Spatial Identifier Learning From the layout format perspective, the input embedding of the label surface names also includes the spatial identifiers. When predicting the next token, the log likelihood also strengthens the relation between the spatial identifiers and the layout context. In this way, LASER inserts the spatial identifiers into the hyperspace of the spatial embeddings. In other words, LASER predicts where a certain label is more likely to be. Similar to the joint probability of language modeling, LASER maximizes the joint probability of a mixture of spatial identifiers and + +spatial embeddings: $P(\dots, B_{k-1}, B_k, \tau, B_{k+1}, \dots)$ where $B_k$ is the bounding boxes of the words in the page and the $\tau$ is the label to predict. Further visualization is conducted in Section 5.7. + +# 4.4 Sequential Decoding + +After training, LASER follows the prefix language modeling paradigm and generates the target sequence sequentially. We input the source sequence into the model and take the last hidden states to predict the first token in the target. Then we append the result to the end of input and repeatedly run the generation. We cache the states of the model and achieve generation in linear time. + +# 5 Experiments + +In this section, we conduct experiments and ablation study on FUNSD (Guillaume Jaume, 2019) and CORD-Lv1 (Park et al., 2019) under few-shot settings. We replace the original label surface names with other tokens to study the importance of semantic meaning. We also plot the heatmaps of the similarity between the spatial identifiers and the spatial embeddings to interpret the spatial correspondence. Case studies are also conducted. + +# 5.1 Experimental Setups + +All the experiments are under few-shot settings using 1, 2, 3, 4, 5, 6, 7 shots. We use 6 different random seeds to select the few-shot training samples and the data augmentation is conducted to solve the data sparsity. We train all the models using the same data and compute the average performance and the standard deviation. We only report the result of 1, 3, 5, 7 shots for space limitation. To evaluate our model, we first convert our results into IOBES tagging style and compute the word-level precision, recall, and F-1 score using the APIs from Nakayama (2018) so that all comparisons with sequence labeling methods are under the same metrics. We believe such experiment settings guarantee the results are representative. + +# 5.2 Datasets + +Our experiments are conducted on two real-world data collections: FUNSD and CORD-Lv1. Both datasets provide rich annotations for the document image understandings including the words and the word-level bounding boxes. The details and statistics of these two datasets are as follows. + +- FUNSD: FUNSD consists of 199 fully-annotated, noisy-scanned forms with various + +Table 1: Dataset Statistics. + +
Dataset# Train Pages# Test Pages# Entities / Page
FUNSD1495042.86
CORD-Lv180010013.82
+ +appearance and format which makes the form understanding task more challenging. The word spans in this datasets are annotated with three different labels: header, question and answer, and the rest words are annotated as other. We use the original label names. + +- CORD-Lv1: CORD consists of about 1000 receipts with annotations of bounding boxes and textual contents. The entities have multi-level labels. We select the first level and denote the dataset as CORD-Lv1. The first level includes menu, void-menu, subtotal and total. We simplify subtotal as sub and void-menu as void. + +# 5.3 Compared Methods + +We evaluate LASER against several strong sequence labeling methods as follows. + +- BERT (Devlin et al., 2018) is a text-only autoencoding pre-trained language model using the large-scale mask language modeling. We fine-tune the pre-trained BERT-base model with the few-shot training samples on each datasets. +- RoBERTa (Liu et al., 2019) extends the capacity of BERT and achieves better performance in multiple natural language understanding tasks. We also conduct the fine-tuning with few-shot training samples. +- **LayoutLM** (Xu et al., 2020) is a multi-modal language model which includes the layout and text information. It is built upon BERT and adds the extra spatial embeddings into the BERT embedding layer. Following LayoutLM, LayoutLMv2 (Xu et al., 2021a) leverages extra computer vision features and improves the performance, which are strong signals but absent in our settings. For a fair comparison, we do not include LayoutLMv2 in our comparative experiments. +- LayoutReader (Wang et al., 2021) is a layout-aware sequence-to-sequence model for reading order detection. We append a linear layer upon the hidden states to conduct sequence labeling. + +These compared methods are in their base version and follow the IOBES tagging scheme. + +Table 2: Evaluation Results with Different Sizes of Few-shot Training Samples: Bold denotes the best model; Underline denotes the second-best model. + +
|P|ModelFUNSDCORD-Lv1
PrecisionRecallF-1PrecisionRecallF-1
1BERT9.62±2.2424.14±3.4613.55±2.0930.64±2.8045.60±3.4536.64±3.10
RoBERTa9.29±1.5722.06±5.6412.76±1.9130.66±4.2544.39±6.7236.25±5.18
LayoutLM11.39±1.1224.73±7.3815.18±2.1733.27±7.3249.49±10.2639.77±8.47
LayoutReader11.32±0.6222.53±4.8014.84±1.2532.17±4.6445.61±6.5437.70±5.31
LASER30.40±4.8935.20±7.2032.36±5.1447.63±3.9045.52±5.8446.24±3.01
3BERT16.42±4.3034.74±5.3622.19±5.0539.62±3.9956.65±4.0346.58±3.94
RoBERTa16.71±3.6331.28±3.5521.66±3.8444.51±4.6960.18±4.6951.15±4.70
LayoutLM28.67±6.5647.22±8.3135.42±7.0047.68±7.4963.93±7.0454.57±7.46
LayoutReader22.37±2.0335.19±4.9727.19±2.5643.85±4.7256.90±2.4749.47±3.95
LASER43.66±1.9747.08±5.7245.21±3.7461.16±3.1160.33±5.6560.63±4.00
5BERT20.57±2.5939.25±1.1026.93±2.4645.73±4.3163.29±3.6853.06±4.14
RoBERTa19.47±2.3235.04±1.8924.94±1.9352.21±4.5566.63±5.5258.54±4.92
LayoutLM39.24±4.3358.20±2.4546.72±3.1256.13±7.3971.66±6.1362.91±7.04
LayoutReader27.52±3.4441.17±4.0132.89±3.2851.97±8.4263.82±7.8757.24±8.32
LASER47.25±1.9352.85±1.2249.87±1.2965.62±3.7964.90±5.7865.23±4.70
7BERT21.44±2.0740.87±3.7928.09±2.4850.13±4.3566.67±3.6757.20±4.07
RoBERTa23.68±3.0638.74±3.5429.32±3.0855.14±4.4969.35±4.1661.43±4.42
LayoutLM43.23±5.2761.73±5.9750.76±5.3062.87±3.9876.38±2.7268.96±3.49
LayoutReader31.22±3.1445.08±3.8336.85±3.2654.43±5.8965.48±5.3459.42±5.68
LASER50.62±3.2653.63±2.8951.98±2.0068.02±3.1666.87±4.8267.40±3.76
+ +![](images/2eaf35d0284c48f9dce583b8c8398538ac509a244acd9b8e09d3546943a857e5.jpg) +(a) FUNSD + +![](images/33ba577cbeee416d7a8b8f103eda0362a2e334d3828b3b0cce71ab6169125dcb.jpg) +(b) CORD-Lv1 +Figure 2: F-1 Curves with Different Sizes of Few-shot Training Samples. + +# 5.4 Implementation Details + +We build LASER on the base of LayoutReader. We use the Transformers (Wolf et al., 2019) and the s2s-ft toolkits from the repository of Dong et al. (2019a). We use one NVIDIA A6000 to finetune with batch size of 8. We optimize the model with AdamW optimizer and the learning rate is $5 \times 10^{-5}$ . + +# 5.5 Experimental Results + +From Table 2 and Figure 2, the results show that, under few-shot settings, our proposed model, LASER, achieves the SOTA overall performance compared with sequence labeling models. We conclude that the gain of performance comes mostly from the generative labeling scheme since LASER largely outperforms LayoutReader although both of them share the same backbone. + +Specifically, compared with the second-best + +baseline, LASER improves the F-1 scores by $8.59\%$ on FUNSD and by $3.32\%$ on CORD-Lv1 on average across the different shots and LASER (IRLVT) also surpasses the baselines under most settings. + +Moreover, the improvement on precision is remarkable. LASER improves the precision by $12.35\%$ on FUNSD and by $10.62\%$ on CORD-Lv1 on average across the different shots. Especially, under 1-shot setting, it surpasses the best sequence labeling model on FUNSD by $19.01\%$ on precision, $10.47\%$ on recall and $17.18\%$ on F-1 score. + +We can also observe a drop in the improvement with the increasing number of training samples. We conclude that, with enough training samples, the sequence labeling learns the meaning of each label and the semantics of each label surface names no longer provides extra useful information. + +Based on these comparison, we safely come to the conclusion that our proposed generative labeling scheme is superior to the traditional sequence labeling scheme in few shot settings. + +# 5.6 Ablation Study + +In the ablation study, we aim at study the role of the label surface names. We introduce an ablation version, LASER (IRLVT), by replacing the label surface names with irrelevant tokens. We also design more different sets of words as substitutes denoted Sub1 and Sub2. The detailed substitutes + +Table 3: Ablation Study of Different Label Surface Names in LASER. IRLVT uses the irrelevant tokens as labels; ORIG uses the original label surface names; Sub1 and Sub2 use some reasonable alternative label surface names. as substitutes. Bold denotes the best model; Underline denotes the second-best model. + +
|P|FUNSDCORD-Lv1
Label Surface NamesPrecisionRecallF-1Label Surface NamesPrecisionRecallF-1
1IRLVT [x, y, z]30.64±5.8933.45±9.1431.62±6.61IRLVT [w, x, y, z]48.57±4.9344.12±6.3645.84±3.57
ORIG [header, question, answer]30.40±4.8935.20±7.2032.36±5.14ORIG [menu, void, sub, total]47.63±3.9045.52±5.8446.24±3.01
Sub1 [title, key, value]31.78±4.7534.21±7.4432.66±5.10Sub1 [info, etc, small, number]48.12±4.1548.47±6.6048.04±4.06
Sub2 [page, topic, value]30.90±5.2035.97±8.5733.03±6.31Sub2 [page, non, part, price]45.59±5.6844.09±7.8744.38±5.39
3IRLVT [x, y, z]43.51±1.4647.92±5.9345.44±3.36IRLVT [w, x, y, z]61.50±2.5259.17±4.1160.27±2.99
ORIG [header, question, answer]43.66±1.9747.08±5.7245.21±3.74ORIG [menu, void, sub, total]61.16±3.1160.33±5.6560.63±4.00
Sub1 [title, key, value]43.87±1.3347.11±6.0745.26±3.44Sub1 [info, etc, small, number]61.54±2.7658.79±6.7660.00±4.57
Sub2 [page, topic, value]43.88±1.3448.01±6.8645.65±3.93Sub2 [page, non, part, price]61.85±2.1660.29±2.8561.03±2.10
5IRLVT [x, y, z]46.94±1.8752.96±2.0349.74±1.63IRLVT [w, x, y, z]63.67±3.8261.10±5.2162.33±4.48
ORIG [header, question, answer]47.25±1.9352.85±1.2249.87±1.29ORIG [menu, void, sub, total]65.62±3.7964.90±5.7865.23±4.70
Sub1 [title, key, value]47.43±2.2952.19±2.0949.68±1.98Sub1 [info, etc, small, number]65.05±5.5963.64±7.1664.31±6.34
Sub2 [page, topic, value]47.46±2.1853.50±1.0150.26±1.16Sub2 [page, non, part, price]65.57±3.0464.71±3.9765.12±3.38
7IRLVT [x, y, z]50.30±2.2654.14±3.4852.08±2.26IRLVT [w, x, y, z]66.08±3.2664.73±5.0865.32±3.74
ORIG [header, question, answer]50.62±3.2653.63±2.8951.98±2.00ORIG [menu, void, sub, total]68.02±3.1666.87±4.8267.40±3.76
Sub1 [title, key, value]50.22±3.2053.79±3.1351.88±2.56Sub1 [info, etc, small, number]67.61±4.1966.64±5.7267.08±4.72
Sub2 [page, topic, value]50.43±2.8854.03±2.7152.10±2.09Sub2 [page, non, part, price]66.64±3.9763.59±7.0065.02±5.47
+ +are introduced in Table 3. + +To implement the ablation study, we simply replace the word embedding of label surface names. For example, in LASER (Sub1) on FUNSD, we use the wording embedding of title instead of the original header. + +From Table 3, we compare the performance of all the ablation models. We observe that LASER performs differently with distinct label semantics. In most cases, the human-designed labels can provide stronger semantic correlation with the entities than the irrelevant labels so they can further improve the performance. However, there are also drops due to improper labels. Overall, we conclude that the semantic meanings of the label surface names are useful to bridge the gap between the labels and entities. + +# 5.7 Spatial Correspondence Interpretation + +In this section, we study the ability of LASER to capture the spatial correspondence between certain areas and the labels. The experiment is based on the results of LASER on FUNSD with 7 shots. As mentioned in Section 4.2, we design unique spatial identifiers for the label surface names. The identifiers are in the same form as the spatial embeddings and LASER inserts the identifiers into the original spatial embedding space during sequence-to-sequence training. Ideally, the model can learn where a certain label is more likely to appear. To visualize such patterns, we compute the cosine similarity matrix $M$ of identifiers and the spatial embeddings as $M_{ij} = \cos(\text{SpatialID}(\tau), \text{SpatialEmb}((i, j)))$ + +![](images/a1755c64958dd5f8fd97ded8f8894cf17736c38e9d0d6cc08e78e3b9b1b1d061.jpg) +(a) Header + +![](images/bdf90bd2b404de09d9b0880a441850deb5e8a8506ca8ab78dd0e98f03665af11.jpg) +(b) Question + +![](images/81c193a7e7a39d8926b1a3e0fc49d7590ba30075b0c17e9db7feaac501607df1.jpg) +(c) Answer +Figure 3: Spatial correspondence visualization on FUNSD for different entity types. + +where $(i,j)$ is the normalized coordinate pair; $\tau \in \{\tau_1,\dots,\tau_t\}$ . Then we plot the heatmap of the similarity matrix, where the highlight areas mean the higher similarities. + +From Figure 3, we observe that the label header is more likely to be in the middle column of the page and may appear in the bottom part as well when there are multiple paragraphs. Intuitively, the label question and answer should appear in pairs and it is observed in Figure 3 that their heatmaps are almost complementary to each other. Several examples from FUNSD are selected to demonstrate the visualization results in 4. Comparing the examples and the visualization results, we conclude that the spatial identifiers of labels capture the formats of pages and LASER leverages these features to better extract the entities under few shot settings. + +# 5.8 Case Study + +We visualize cases from the 5-shot setting. From Figure 5, we observe LASER can extract the enti + +![](images/fbd8d1056481f72c041e9b89bc848bdb20aeda06d41950eac9175acddc146c89.jpg) +(a) Original Image + +![](images/424162bac74420121c38b6744709f8925b5dd122d91d97ce0c6e2f1fa8a252f7.jpg) +(b) Labeled Entities + +![](images/6ab270dfc7fb7f78a2ac2062e9c140b4b981574b7430779ae6b962f51826677d.jpg) +(c) Original Image + +![](images/be89d4673bf763dcb68b9b46b70dca749acb5a4a3d93fe9db5e2685bfebce561.jpg) +(d) Labeled Entities + +![](images/1d435f105d05f6791f83484b0537b819c6650b32cabf918f9408536fb5204acb.jpg) +Figure 4: Layout Format Examples from FUNSD: , , , denotes question, answer, header. + +![](images/20cc42a4a4b153bb61c61faf14c5f7070df20ce3247d3eeac3674cd0962c64f9.jpg) +(b) LASER Results + +![](images/3458a7a6f80f62a9659e2d981c7efdf8e5e289261148faa40a68af411bd23cbd.jpg) +(c) LayoutLM Results + +![](images/9355b77ed8deb7602a6f2695a5f3703c856134eae1592b27ea1bf1d71847444e.jpg) +(a) Test Image and Expected Labels +(d) Test Image and Expected Labels +Figure 5: Case Studies. (a), (b), (c) from FUNSD; (d), (e), (f) from CORD-Lv1; , , , , denote menu, question, answer, other; , denote menu, total; , / / denote the right, wrong predictions. + +![](images/549dbd383f1e34a016a8ad52b5012ec9a846971e619a97416197da7dd37c6a2b.jpg) +(e) LASER Results + +![](images/2441441f7527d7450188919b3d446dd8720a51ff5bbd615e364e111218760f8f.jpg) +(f) LayoutLM Results + +Table 4: Text-only Dataset Statistics + +
Dataset# Train# Test# Entity Type
OntoNotes60.0k8.3k18
Mit Movie7.8k2.0k12
+ +ties correctly, and the errors of LayoutLM comes from the failure to extract the entities or wrong entity type predictions. Since the sequence labeling groups the words into spans through IOBES tagging, which creates great uncertainty. Meanwhile, LASER also learns questions and answers appear in pairs (see Figure 5(b)). It also properly predicts a numerical string as menu even if numbers are likely to be total (see Figure 5(e)). + +# 5.9 Text-only Entity Recognition + +LASER is designed for the entity recognition task in document images where both text and layout + +Table 5: Results of 10-way-5-shot Experiments + +
ModelOntoNotesMIT Movie
F-1F-1
BERT60.79±0.9747.88±0.97
RoBERTa (Huang et al., 2020)57.7051.30
UniLM60.82±1.2651.09±1.40
LASER61.11±1.0851.88±1.27
+ +can be leveraged to acquire essential information. However, the generative labeling scheme is not constrained in the scenario of document images. We briefly explore the potential of the generative labeling scheme in text-only scenario. We initialize LASER with a text-only language model, UniLM (Dong et al., 2019b), based on the experiments in Wang et al. (2021), and apply it onto text-only entity recognition task. Following Huang et al. (2020), we conduct 10-way-5-shot experiments on two datasets, OntoNotes (Weischedel et al., 2013) + +and MIT Movie (Liu et al., 2013), which cover general domains and review domains, respectively. The dataset statistics are shown in Table 4 and the results are as shown in Table 5. We observe that our method can also surpass the sequence labeling methods in these two datasets, showing the great potential of the generative labeling scheme in the entity recognition tasks. + +# 6 Related Work + +Layout-aware LMs. Since the post-OCR processing has great application prospects, existing works propose to adapt the language pre-training to the layout formats learning. LayoutLM (Xu et al., 2020) is the pioneer in this area, which successfully uses the coordinates to represent the layout information in the embedding layer of BERT (Devlin et al., 2018). Following LayoutLM, the upgraded version, LayoutLMv2 (Xu et al., 2021a), is further proposed to leverage the visual features and benefits from the alignment between words and the regions in the page. LAMBERT (Garncarek et al., 2021) and BROS (Hong et al., 2020) continue studying the layout representation which uses the sinusoidal function or apply the relative positional biases from T5 (Raffel et al., 2019). LayoutReader (Wang et al., 2021) aims to predict the reading order of words from the OCR results. ReadingBank (Wang et al., 2021) is proposed to facilitate the pre-training of reading order detection, which annotates the reading order of millions of pages. + +Generalized Seq2Seq. Sequence-to-sequence architecture is basic in natural language processing and is originally designed for machine translation. With the rise of large pre-trained models, sequence-to-sequence models are increasingly used with new problem formulation. Existing works exploit the potential latent knowledge and stronger representation ability of sequence-to-sequence modeling. GENRE (De Cao et al., 2020) creatively reformulates the entity retrieval task into the sequence-to-sequence settings. It inferences the lined entities using the generation of BART. Recent works on prompt learning also leverage the pre-trained sequence-to-sequence language models to conduct few shot learning (Liu et al., 2021; Puri and Catanzaro, 2019; Hambardzumyan et al., 2021). + +# 7 Conclusions and Future Work + +In this paper, we present LASER, a label-aware sequence-to-sequence framework for entity recog- + +nition in document images under few-shot settings. It benefits from the generative labeling scheme which reformulates the entity recognition task into the sequence-to-sequence setting. The label surface names are embedded into the generated sequence. Compared with the sequence labeling methods, LASER leverages the rich semantics of the label surface names and overcome the limitation of training data. Moreover, we design spatial identifiers for each label and well insert them into the spatial embedding hyperspace. In this way, LASER can inference the entity labels from the layout formats perspective and empirical experiments demonstrate our method can learn the layout formats though limited number of training samples. + +For further research, we will investigate the selection of label surface names and how to better leverage the semantics from the pre-trained sequence-to-sequence models. We also notice that such labeling scheme can cope with unknown categories. We will focus on the generalization of our method. + +# Acknowledgments + +We want to thank the anonymous reviewers for their insightful comments. Zilong would also like to thank the Powell Fellowship for the support during the challenging years at the beginning of his Ph.D. program. + +The research was sponsored in part by National Science Foundation Convergence Accelerator under award OIA-2040727 as well as generous gifts from Google, Adobe, and Teradata. Any opinions, findings, conclusions, or recommendations expressed herein are those of the authors and should not be interpreted as necessarily representing the views, either expressed or implied, of the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints for government purposes notwithstanding any copyright annotation hereon. + +# Ethical Consideration + +This paper focuses on the entity recognition in document images under few-shot setting. Our architecture is built upon open-source models and all the datasets are available online. We will release the code and datasets on https://github.com/zlwang-cs/LASER-release. Therefore, we do not anticipate any major ethical concerns. + +# References + +Hangbo Bao, Li Dong, Furu Wei, Wenhui Wang, Nan Yang, Xiaodong Liu, Yu Wang, Jianfeng Gao, Songhao Piao, Ming Zhou, et al. 2020. Unilmv2: Pseudomasked language models for unified language model pre-training. In International Conference on Machine Learning, pages 642-652. PMLR. +Nicola De Cao, Gautier Izacard, Sebastian Riedel, and Fabio Petroni. 2020. Autoregressive entity retrieval. arXiv preprint arXiv:2010.00904. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2018. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805. +Li Dong, Nan Yang, Wenhui Wang, Furu Wei, Xiaodong Liu, Yu Wang, Jianfeng Gao, Ming Zhou, and Hsiao-Wuen Hon. 2019a. Unified language model pre-training for natural language understanding and generation. arXiv preprint arXiv:1905.03197. +Li Dong, Nan Yang, Wenhui Wang, Furu Wei, Xiaodong Liu, Yu Wang, Jianfeng Gao, Ming Zhou, and Hsiao-Wuen Hon. 2019b. Unified language model pretraining for natural language understanding and generation. Advances in Neural Information Processing Systems, 32. +Łukasz Garncarek, Rafał Powalski, Tomasz Stanisławek, Bartosz Topolski, Piotr Halama, Michal Turski, and Filip Graliński. 2021. Lambert: Layout-aware language modeling for information extraction. In International Conference on Document Analysis and Recognition, pages 532-547. Springer. +Jean-Philippe Thiran Guillaume Jaume, Hazim KemaIkal Ekenel. 2019. Funsd: A dataset for form understanding in noisy scanned documents. In Accepted to ICDAR-OST. +Karen Hambardzumyan, Hrant Khachatrian, and Jonathan May. 2021. Warp: Word-level adversarial reprogramming. arXiv preprint arXiv:2101.00121. +Teakgyu Hong, DongHyun Kim, Mingi Ji, Wonseok Hwang, Daehyun Nam, and Sungrae Park. 2020. Bros: A pre-trained language model for understanding texts in document. +Jiaxin Huang, Chunyuan Li, Krishan Subudhi, Damien Jose, Shobana Balakrishnan, Weizhu Chen, Baolin Peng, Jianfeng Gao, and Jiawei Han. 2020. Few-shot named entity recognition: A comprehensive study. arXiv preprint arXiv:2012.14978. +Jingjing Liu, Panupong Pasupat, Yining Wang, Scott Cyphers, and Jim Glass. 2013. Query understanding enhanced by hierarchical parsing structures. In 2013 IEEE Workshop on Automatic Speech Recognition and Understanding, pages 72-77. IEEE. + +Pengfei Liu, Weizhe Yuan, Jinlan Fu, Zhengbao Jiang, Hiroaki Hayashi, and Graham Neubig. 2021. Pretrain, prompt, and predict: A systematic survey of prompting methods in natural language processing. arXiv preprint arXiv:2107.13586. +Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692. +Lluis Marquez, Pere Comas, Jesús Giménez, and Neus Catala. 2005. Semantic role labeling as sequential tagging. In Proceedings of the Ninth Conference on Computational Natural Language Learning (CoNLL-2005), pages 193-196. +Hiroki Nakayama. 2018. seqeval: A python framework for sequence labeling evaluation. Software available from https://github.com/chakki-works/seqeval. +Seunghyun Park, Seung Shin, Bado Lee, Junyeop Lee, Jaeheung Surh, Minjoon Seo, and Hwalsuk Lee. 2019. Cord: A consolidated receipt dataset for post-ocr parsing. +Raul Puri and Bryan Catanzaro. 2019. Zero-shot text classification with generative language models. arXiv preprint arXiv:1912.10165. +Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. 2019. Exploring the limits of transfer learning with a unified text-to-text transformer. arXiv preprint arXiv:1910.10683. +Lev Ratinov and Dan Roth. 2009. Design challenges and misconceptions in named entity recognition. In Proceedings of the Thirteenth Conference on Computational Natural Language Learning (CoNLL-2009), pages 147-155. +Zilong Wang, Yiheng Xu, Lei Cui, Jingbo Shang, and Furu Wei. 2021. Layoutreader: Pre-training of text and layout for reading order detection. +Ralph Weischedel, Martha Palmer, Mitchell Marcus, Edward Hovy, Sameer Pradhan, Lance Ramshaw, Nianwen Xue, Ann Taylor, Jeff Kaufman, Michelle Franchini, et al. 2013. Ontonotes release 5.0 ldc2013t19. Linguistic Data Consortium, Philadelphia, PA, 23. +Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumont, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, et al. 2019. Huggingface's transformers: State-of-the-art natural language processing. arXiv preprint arXiv:1910.03771. +Yang Xu, Yiheng Xu, Tengchao Lv, Lei Cui, Furu Wei, Guoxin Wang, Yijuan Lu, Dinei Florencio, Cha Zhang, Wanxiang Che, Min Zhang, and Lidong Zhou. 2021a. Layoutlmv2: Multi-modal pre-training for visually-rich document understanding. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics (ACL) 2021. + +Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei, and Ming Zhou. 2020. Layoutm: Pre-training of text and layout for document image understanding. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 1192-1200. +Yiheng Xu, Tengchao Lv, Lei Cui, Guoxin Wang, Yijuan Lu, Dinei Florencio, Cha Zhang, and Furu Wei. 2021b. Layoutxlm: Multimodal pre-training for multilingual visually-rich document understanding. + +# Appendix + +# A All Results + +All results are listed in Table 6. + +Table 6: Evaluation Results with Different Sizes of Few-shot Training Samples + +
|P|ModelFUNSDCORD-Lv1
PrecisionRecallF-1PrecisionRecallF-1
1BERT9.62±2.2424.14±3.4613.55±2.0930.64±2.8045.60±3.4536.64±3.10
RoBERTa9.29±1.5722.06±5.6412.76±1.9130.66±4.2544.39±6.7236.25±5.18
LayoutLM11.39±1.1224.73±7.3815.18±2.1733.27±7.3249.49±10.2639.77±8.47
LayoutReader11.32±0.6222.53±4.8014.84±1.2532.17±4.6445.61±6.5437.70±5.31
LASER30.40±4.8935.20±7.2032.36±5.1447.63±3.9045.52±5.8446.24±3.01
(IRLVT)30.64±5.8933.45±9.1431.62±6.6148.57±4.9344.12±6.3645.84±3.57
(Sub1)31.78±4.7534.21±7.4432.66±5.1048.12±4.1548.47±6.6048.04±4.06
(Sub2)30.90±5.2035.97±8.5733.03±6.3145.59±5.6844.09±7.8744.38±5.39
2BERT12.49±3.2430.01±4.5517.53±3.8937.66±3.7955.43±3.4144.82±3.78
RoBERTa13.12±3.0827.63±5.1617.56±3.5940.66±3.6056.60±4.8747.30±4.05
LayoutLM19.73±5.4337.32±9.5825.41±6.2542.92±8.2760.47±8.1550.15±8.44
LayoutReader16.66±2.5829.26±5.3420.96±3.0144.14±7.7758.50±8.3250.26±8.04
LASER39.23±3.0942.43±6.2340.38±2.7159.31±2.3154.85±6.1956.80±3.46
(IRLVT)38.75±3.7440.37±8.1739.19±4.8457.05±2.8753.49±7.0155.01±4.19
(Sub1)38.47±2.9541.11±7.0339.43±3.8357.46±4.2254.72±5.8755.98±4.68
(Sub2)37.52±2.2243.23±6.4839.90±3.1257.03±2.8055.75±5.4856.28±3.48
3BERT16.42±4.3034.74±5.3622.19±5.0539.62±3.9956.65±4.0346.58±3.94
RoBERTa16.71±3.6331.28±3.5521.66±3.8444.51±4.6960.18±4.6951.15±4.70
LayoutLM28.67±6.5647.22±8.3135.42±7.0047.68±7.4963.93±7.0454.57±7.46
LayoutReader22.37±2.0335.19±4.9727.19±2.5643.85±4.7256.90±2.4749.47±3.95
LASER43.66±1.9747.08±5.7245.21±3.7461.16±3.1160.33±5.6560.63±4.00
(IRLVT)43.51±1.4647.92±5.9345.44±3.3661.50±2.5259.17±4.1160.27±2.99
(Sub1)43.87±1.3347.11±6.0745.26±3.4461.54±2.7658.79±6.7660.00±4.57
(Sub2)43.88±1.3448.01±6.8645.65±3.9361.85±2.1660.29±2.8561.03±2.10
4BERT18.25±3.3037.90±2.9324.55±3.5943.94±4.1461.13±4.1851.09±4.12
RoBERTa17.99±2.8434.38±4.0923.52±3.0749.56±4.8965.19±4.8556.29±4.86
LayoutLM33.38±3.6253.71±3.2441.00±2.7152.15±7.9068.06±6.8658.99±7.66
LayoutReader24.61±2.5838.28±3.0529.89±2.5148.27±9.1461.29±8.4953.96±9.06
LASER44.91±2.4250.25±3.2647.36±2.1863.90±3.1960.99±5.8662.38±4.60
(IRLVT)46.31±1.9151.74±2.5548.83±1.6763.68±3.7260.39±7.1161.93±5.50
(Sub1)45.58±1.6351.47±2.9748.29±1.6563.22±3.3160.39±8.2361.65±5.93
(Sub2)45.43±2.0851.74±2.6448.33±1.7962.85±3.8360.07±8.0061.31±5.97
5BERT20.57±2.5939.25±1.1026.93±2.4645.73±4.3163.29±3.6853.06±4.14
RoBERTa19.47±2.3235.04±1.8924.94±1.9352.21±4.5566.63±5.5258.54±4.92
LayoutLM39.24±4.3358.20±2.4546.72±3.1256.13±7.3971.66±6.1362.91±7.04
LayoutReader27.52±3.4441.17±4.0132.89±3.2851.97±8.4263.82±7.8757.24±8.32
LASER47.25±1.9352.85±1.2249.87±1.2965.62±3.7964.90±5.7865.23±4.70
(IRLVT)46.94±1.8752.96±2.0349.74±1.6363.67±3.8261.10±5.2162.33±4.48
(Sub1)47.43±2.2952.19±2.0949.68±1.9865.05±5.5963.64±7.1664.31±6.34
(Sub2)47.46±2.1853.50±1.0150.26±1.1665.57±3.0464.71±3.9765.12±3.38
6BERT20.37±2.0839.58±2.9026.85±2.2746.39±4.5663.61±4.8153.62±4.65
RoBERTa21.70±2.3737.14±1.3427.32±1.9651.80±5.6066.54±5.8758.25±5.77
LayoutLM41.75±3.8360.47±3.2349.28±3.0259.31±4.2374.48±3.1666.02±3.86
LayoutReader29.19±2.1043.21±2.3234.82±2.0952.76±4.4565.62±3.4758.45±3.99
LASER48.64±2.1453.54±2.1050.96±1.9566.85±3.8865.97±5.1966.38±4.38
(IRLVT)48.33±2.1552.68±1.5650.36±1.0866.01±4.0763.85±5.5964.87±4.63
(Sub1)48.49±1.9652.85±1.6750.53±0.9965.19±4.2263.37±7.1064.21±5.68
(Sub2)49.14±1.9753.42±1.2051.16±1.2266.44±3.1164.05±4.3165.21±3.67
7BERT21.44±2.0740.87±3.7928.09±2.4850.13±4.3566.67±3.6757.20±4.07
RoBERTa23.68±3.0638.74±3.5429.32±3.0855.14±4.4969.35±4.1661.43±4.42
LayoutLM43.23±5.2761.73±5.9750.76±5.3062.87±3.9876.38±2.7268.96±3.49
LayoutReader31.22±3.1445.08±3.8336.85±3.2654.43±5.8965.48±5.3459.42±5.68
LASER50.62±3.2653.63±2.8951.98±2.0068.02±3.1666.87±4.8267.40±3.76
(IRLVT)50.30±2.2654.14±3.4852.08±2.2666.08±3.2664.73±5.0865.32±3.74
(Sub1)50.22±3.2053.79±3.1351.88±2.5667.61±4.1966.64±5.7267.08±4.72
(Sub2)50.43±2.8854.03±2.7152.10±2.0966.64±3.9763.59±7.0065.02±5.47
\ No newline at end of file diff --git a/towardsfewshotentityrecognitionindocumentimagesalabelawaresequencetosequenceframework/images.zip b/towardsfewshotentityrecognitionindocumentimagesalabelawaresequencetosequenceframework/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..f053c24270f796b5f02b3df6ac0c788f6b4784e5 --- /dev/null +++ b/towardsfewshotentityrecognitionindocumentimagesalabelawaresequencetosequenceframework/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:70c0c01b002381e67e2d20e4ede049261dcf32e2b49b778131f165adb3cf9235 +size 1157173 diff --git a/towardsfewshotentityrecognitionindocumentimagesalabelawaresequencetosequenceframework/layout.json b/towardsfewshotentityrecognitionindocumentimagesalabelawaresequencetosequenceframework/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..e8b1360da1bbeb59ac6019cf33bddc0704b18172 --- /dev/null +++ b/towardsfewshotentityrecognitionindocumentimagesalabelawaresequencetosequenceframework/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c12c90fe2754e801ccf600068a54bb137d61a61e2ad2b8982125144ba0dd07f4 +size 379000 diff --git a/towardslargescaleinterpretableknowledgegraphreasoningfordialoguesystems/ca22a448-65de-4b51-9859-1b4579d2e187_content_list.json b/towardslargescaleinterpretableknowledgegraphreasoningfordialoguesystems/ca22a448-65de-4b51-9859-1b4579d2e187_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..53b169f2aea10fd31acff5735a702e8275c552e4 --- /dev/null +++ b/towardslargescaleinterpretableknowledgegraphreasoningfordialoguesystems/ca22a448-65de-4b51-9859-1b4579d2e187_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6215a488e1e140de0be46aeffbc182050410e361c33551dd6d4af31e3b760e3d +size 87000 diff --git a/towardslargescaleinterpretableknowledgegraphreasoningfordialoguesystems/ca22a448-65de-4b51-9859-1b4579d2e187_model.json b/towardslargescaleinterpretableknowledgegraphreasoningfordialoguesystems/ca22a448-65de-4b51-9859-1b4579d2e187_model.json new file mode 100644 index 0000000000000000000000000000000000000000..5325646e14dd998233c16549d62246fc2bbb081b --- /dev/null +++ b/towardslargescaleinterpretableknowledgegraphreasoningfordialoguesystems/ca22a448-65de-4b51-9859-1b4579d2e187_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b9fa06ded3d4a47943a52f64476963963f98413de63ef40e309494dc80b539c3 +size 103858 diff --git a/towardslargescaleinterpretableknowledgegraphreasoningfordialoguesystems/ca22a448-65de-4b51-9859-1b4579d2e187_origin.pdf b/towardslargescaleinterpretableknowledgegraphreasoningfordialoguesystems/ca22a448-65de-4b51-9859-1b4579d2e187_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..0e6c4c29bb8136efc5167a4ac22c590e5956ad42 --- /dev/null +++ b/towardslargescaleinterpretableknowledgegraphreasoningfordialoguesystems/ca22a448-65de-4b51-9859-1b4579d2e187_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:69ad0cb5d9c3f42fa4ca6a561d32cd47042fb94cfc4a611d00f7b49515d4a30f +size 622910 diff --git a/towardslargescaleinterpretableknowledgegraphreasoningfordialoguesystems/full.md b/towardslargescaleinterpretableknowledgegraphreasoningfordialoguesystems/full.md new file mode 100644 index 0000000000000000000000000000000000000000..3e18f5955e432b58dd9e5b0158227650d136c639 --- /dev/null +++ b/towardslargescaleinterpretableknowledgegraphreasoningfordialoguesystems/full.md @@ -0,0 +1,362 @@ +# Towards Large-Scale Interpretable Knowledge Graph Reasoning for Dialogue Systems + +Yi-Lin Tuan $^{1}$ , Sajjad Beygi $^{2}$ , Maryam Fazel-Zarandi $^{2}$ , Qiaozi Gao $^{2}$ , Alessandra Cervone $^{2}$ , William Yang Wang $^{1}$ + +1 University of California, Santa Barbara 2 Amazon Alexa AI + +{ytuan, william}@cs.ucsb.edu + +{beygi, fazelzar, qzgao, cervon}@amazon.com + +# Abstract + +Users interacting with voice assistants today need to phrase their requests in a very specific manner to elicit an appropriate response. This limits the user experience, and is partly due to the lack of reasoning capabilities of dialogue platforms and the hand-crafted rules that require extensive labor. One possible way to improve user experience and relieve the manual efforts of designers is to build an end-to-end dialogue system that can do reasoning itself while perceiving user's utterances. In this work, we propose a novel method to incorporate the knowledge reasoning capability into dialogue systems in a more scalable and generalizable manner. Our proposed method allows a single transformer model to directly walk on a large-scale knowledge graph to generate responses. To the best of our knowledge, this is the first work to have transformer models generate responses by reasoning over differentiable knowledge graphs. We investigate the reasoning abilities of the proposed method on both task-oriented and domain-specific chitchat dialogues. Empirical results show that this method can effectively and efficiently incorporate a knowledge graph into a dialogue system with fully-interpretable reasoning paths. + +# 1 Introduction + +Nowadays, dialogue systems are ubiquitous in customer service and voice-based assistants. One of the main uses of this technology is supporting humans in accomplishing tasks that might require accessing and navigating large knowledge bases (e.g., movies search). A dialogue system architecture is typically composed of a natural language understanding (NLU) module, a dialogue management (DM) module, and a natural language generation (NLG) module (Jurafsky and Martin, 2009; Williams et al., 2016). First, the NLU component extracts a meaning representation from the user utterance based on which the DM generates the next system action by reasoning over the meaning + +representation and communicating with external applications if necessary. For example, the DM may retrieve information from external knowledge graphs (KG) to answer the user's query based on the dialogue history. This process requires the DM to convert the output of NLU to a query to be issued to the backend. Given the difficulty of this step, which is often domain-dependent, the DM component might require the design of hand-crafted rules. However, such rules are usually not scalable to different applications. They could require considerable effort to cover all possible cases/dialogue flows, leading to expensive costs to design new applications. Moreover, in several cases, users interacting with such assistants are forced to formulate specific queries in order to accomplish their objective, which might break user engagement. + +To alleviate the problem of having to design expensive hand-crafted rules and breaking user experience, recent works have explored the possibility of building end-to-end dialogue systems (Wen et al., 2017) and all-in-one response generation models (Serban et al., 2016). Among them, since graph is one of the main structure to store knowledge, recent research (Ghazvininejad et al., 2018; Zhou et al., 2018; Moon et al., 2019; Tuan et al., 2019; Yang et al., 2020) has proposed methods to generate natural language responses according to both the dialogue history and external knowledge graph. Despite these innovative and inspiring methods, there are some shortcomings. For instance, these methods are either not fully-interpretable or limited to small-scale knowledge graphs. + +In this paper, we propose a novel dialogue differentiable knowledge graph model (DiffKG). The DiffKG is a single transformer model that directly (1) generates a sequence of relations to perform multi-hop reasoning on a reified KG representation proposed by (Cohen et al., 2019), and then (2) generates responses using the retrieved entities. To the best of our knowledge, this is the first dialogue + +model that can directly walk on a large-scale KG with flexibility and interpretability. DiffKG allows having flexible entity values in the KG and handling novel entity values with an arbitrarily defined number of tokens. The reasoning path of DiffKG consists of the predicted relations, thus allowing for transparency. + +We run extensive experiments to test DiffKG performance on KG-grounded dialogues. We select Stanford Multi-domain Dialogues (SMD) (Eric et al., 2017) and propose a new dataset, SMD-Reasoning, to simulate scenarios requiring multiple reasoning types and select the OpenDialKG (Moon et al., 2019) to simulate scenarios requiring large-scale KG reasoning without preprocessing. We then compare DiffKG with state-of-the-art models on SMD and OpenDialKG and an additional baseline that flattens KGs into a textual form from which transformers can learn. Empirically, our experiments show that DiffKG can effectively be trained on large-scale KGs and demonstrate its robustness with modified triplets in a KG. From the perspective of computation, DiffKG leads to relatively low extra time and memory usage compared to transformer models not using any KG information. + +In summary, our contributions are: 1) We propose DiffKG, a novel method that can effectively and flexibly incorporate large-scale KG; 2) We demonstrate that DiffKG is a model-agnostic method and can be applied to different model architectures; 3) We show that DiffKG is an interpretable method with low add-on latency at inference time. Our code and processed datasets are released in https://github.com/Pascalson/DiffKG-Dialog. + +# 2 Related Work + +Recent years have seen a surge of new methods proposing end-to-end models that try to both understand natural language input text and search information. Two of the widely explored tasks are question-answering (QA) and dialogue generation. + +QA. Multiple QA methods (Weston et al., 2015; Yin et al., 2016; Hao et al., 2017; Rajpurkar et al., 2018; Verga et al., 2020; Eisenschlos et al., 2021) have been proposed to tackle tasks that go beyond what is explicitly stated in the linguistic context (Storks et al., 2019). For example, the benchmarks (Mihaylov et al., 2018; Reddy et al., 2019; Khot et al., 2020; Lin et al., 2021) are particu + +larly useful for the model to extract information from external knowledge bases to answer questions. Nonetheless, these studies mostly take the retrieved information from KG as the answer to a single question, while in dialogue we have to formulate an informative response to multi-turn dialogue history. + +Dialogue Generation. Recent works have investigated the grounded dialogue generation. These methods can be divided into three main categories. First, Dinan et al. (2018); Zhao et al. (2019); Tuan et al. (2020); Kim et al. (2020) extract useful knowledge from unstructured data to generate responses, such as information contained in passages and speaker's profiles. Second, Sordoni et al. (2015); Long et al. (2017); Zhu et al. (2017); Ghazvininejad et al. (2018); Zhou et al. (2018); Velicković et al. (2018); Joshi et al. (2020); Hosseini-Asl et al. (2020); Wang et al. (2021) utilize information from knowledge bases (either graphs or tables) to enhance the dialogue system. They usually train the entities and relations embeddings of the knowledge bases and incorporate these embeddings into the input representation to predict the response. Third, Moon et al. (2019); Tuan et al. (2019); Jung et al. (2020) formulate the reasoning process more explicitly, as a path traversal over knowledge graphs. These methods further improve the transparency and explainability of the conversational agent and share the most similar idea with us. However, they either only predict the reasoning path without generating responses or need subgraph sampling to reduce the scale of KG. In this work, our approach uses a transformer model to jointly predict explicit reasoning paths over a large-scale knowledge graph and generate dialogue responses based on the reasoning results. + +# 3 Background + +# 3.1 Knowledge Graph for Dialogue System + +We assume that the knowledge of the system can be represented by a knowledge graph (KG) $\mathcal{G} = \{\mathcal{E},\mathcal{R}\}$ , where $\mathcal{E}$ denotes the entities and $\mathcal{R}$ denotes the relations. The knowledge graph $\mathcal{G}$ contains multiple triples describing the connections among entities and relations. We denote the $k$ -th triple of this graph as $(e_k^h,r_k,e_k^t)$ , where $e_k^h,r_k,e_k^t$ are respectively the head entity, relation, and tail entity. The total numbers of triples, entities, and relations + +
Reasoning TypeExampleRelated Info. in KG
Semantic FormKG reasoningU: I need unleaded gas. +R: inform Valero, 4 milesIsTypeOf HasDistance Gas Station Valero 4 miles
Logical ReasoningTrue/FalseU: Is it going to snow this week at Corona? +R: YesIsLocationOf HasWeather Thursday ReportID1 snow
SelectionU: give me the direction to the nearest shopping mall. +R: inform Stanford Shopping Center, 3 milesIsTypeOf HasDistance Stanford SC 3 miles Midtown SC 5 miles
ExtractionU: What gas stations are here? +R: include poi_type gas stationNo gas station in the available KG
NL FormKG reasoningU: Have you listen to any of the singer Kesha's song? +R: I do enjoy in her music, especially “Your Love Is My Drug”Composer Kesha Your Love Is My Drug
+ +Table 1: Example of different reasoning types and output formats (semantic and natural language forms) in a dialogue system with the related information in the accessible KGs. + +are denoted as $N_{\mathcal{T}}$ $N_{\mathcal{E}}$ $N_{\mathcal{R}}$ , respectively.1 + +# 3.2 Response Generation in Dialogue System + +If we define the dialogue history as a sequence of tokens that occurred during the user and system interactions, then a flattened dialogue history can be written as: + +$$ +\mathbf {x} = \left(x _ {1}, x _ {2}, \dots , x _ {m}, \dots , x _ {M}\right) \tag {1} +$$ + +where $x_{m}$ is the $m$ -th token in the dialogue history with $M$ tokens. In an end-to-end dialogue system, we assume a dialogue system parameterized by $\theta$ exists that can predict a probability distribution of responses $P_{\theta}(\cdot|\mathbf{x},\mathcal{G})$ . The generated responses are sampled from this probability distribution. + +# 4 Problem Statement + +We focus on understanding the ability of language models in performing reasoning during a conversation. We consider two tasks that are usually required in dialogue scenarios and call them semantic form and natural language (NL) form in Table 1. First, given a dialogue history and a user's query, the task of semantic form is to predict the next system action, corresponding to the output of the DM module, based on the available knowledge. In this case, we assume the expected output is the essential knowledge for an NLG module. We argue that this task could help better evaluate if the response is correct or not and which type of reasoning can be more successfully handled. Second, given a dialogue history and a user's query, the task of the NL form could be to directly output the response given + +by the system. This setting with annotated reasoning path can shed light on understanding if the model can learn to support chit-chat and reasoning at the same time. + +Moreover, we aim to understand models' reasoning capability both in the form of logical reasoning and over the provided knowledge. As illustrated in Table 1, by KG reasoning, we refer to the ability of the model to retrieve information from an arbitrary scaled KG in multiple hops. Meanwhile, we refer to logical reasoning as the ability of the model to conduct operations such as evaluating whether a statement is true or false, selecting min/max from a list of alternatives, and extracting constraints. + +We formulate the task that we focus on as follows: given the dialogue history $\mathbf{x}$ and currently accessible KG $\mathcal{G}$ , can we extend a transformer model to predict a correct response $y$ in either semantic or NL form? As illustrated in Table 1, this task not only requires the model to accurately retrieve information from the KG, but also needs to do further logical operations on the information. To solve this task, a model should also be able to effectively integrate the dialogue history $\mathbf{x}$ with the KG $\mathcal{G}$ . + +# 5 Proposed Approach + +Figure 1 illustrates our proposed architecture which contains four main parts: a dialogue history encoder, a differentiable KG reasoning module, a learnable logical operations module, and a response decoder (the transformer model). Note that we experiment with two types of transformers: a causal language model GPT2 (Radford et al., 2019) and an encoder-decoder model T5 (Raffel et al., 2020). For GPT2, we reuse the same encoder that is used at the beginning of the process, i.e., $f_{enc}$ in Figure 1, as the final transformer that generates the response + +![](images/ac58907cfec333549611ce1c1b9c0d8bda1b2ad31c196fcff7285b9ed9387074.jpg) +Figure 1: The illustration of proposed DiffKG, which leverages a pretrained transformer model (T5 or GPT2) and the Reified KG. The model generates the response depending on the predicted relation sequence $[r_1; \dots; r_H]$ , thus being fully interpretable in terms of the used reasoning path. + +token by token. For T5, we reuse the same encoder as the encoder of the final transformer with a separate decoder that generates the response. Therefore, this method contains a single transformer model. In following sections we present each module in detail. + +# 5.1 Dialogue History Encoder + +We use encoder model to project $\mathbf{x}$ and obtain the dialogue history embedding through $\tilde{\mathbf{x}} = f_{enc}(\mathbf{x})\in \mathbb{R}^d$ , where $d$ is the hidden size of the encoder. The embedding $\tilde{\mathbf{x}}$ is first fed into an operation layer with parameters $\mathbf{W}_o\in \mathbb{R}^{d\times d}$ The operation layer predicts the operation vector $\mathbf{a} = \mathbf{W}_o^T\tilde{\mathbf{x}}\in \mathbb{R}^d$ . At the same time, the embedding $\tilde{\mathbf{x}}$ is also fed into a relation layer with parameters $\mathbf{W}_r\in \mathbb{R}^{d\times N_{\mathcal{R}}H}$ . The relation layer predicts the concatenation of a sequence of relations $\mathbf{r} = \{\mathbf{r}_h|1\leq h\leq H\}$ , where $\mathbf{r}_h\in \mathbb{R}^{N_{\mathcal{R}}}$ is the relation to be used at the $h$ -th hop in the programmed walking block and $H$ is the maximum number of hops. The embedding $\tilde{\mathbf{x}}$ is also fed into a checkpoints layer with parameters $\mathbf{W}_c\in \mathbb{R}^{d\times 2H}$ . This layer produces the concatenation of a sequence of walk-or-check vectors $\mathbf{c} = \{c_h|1\leq h\leq H\}$ where $c_{h}\in \mathbb{R}^{2}$ is the walk-or-check vector at the $h$ th hop to determine the weights of the programmed walking module and the operation vector. + +$$ +\tilde {\mathbf {x}} = f _ {e n c} (\mathbf {x}), +$$ + +$$ +\mathbf {a} = \mathbf {W} _ {o} ^ {T} \tilde {\mathbf {x}}, +$$ + +$$ +\mathbf {r} = \mathbf {W} _ {r} ^ {T} \tilde {\mathbf {x}}, \tag {2} +$$ + +$$ +\mathbf {c} = \operatorname {s o f t m a x} \left(\mathbf {W} _ {c} ^ {T} \tilde {\mathbf {x}}\right). +$$ + +# 5.2 Differential Knowledge Graph Reasoning + +To ensure that our model can scale to larger KGs, we adopt the reified KG representation proposed by (Cohen et al., 2019). The reified KG represents the graph $\mathcal{G}$ using three sparse matrices: head matrix $\mathbf{M}_h\in \mathbb{R}^{N_{\mathcal{T}}\times N_{\mathcal{E}}}$ , relation matrix $\mathbf{M}_r\in \mathbb{R}^{N_{\mathcal{T}}\times N_{\mathcal{R}}}$ , and tail matrix $\mathbf{M}_t\in \mathbb{R}^{N_{\mathcal{T}}\times N_{\mathcal{E}}}$ . An entry $(i,e)$ in $\mathbf{M}_h$ or $\mathbf{M}_t$ with value 1 indicates that the $i$ -th triple in the KG has entity $e$ as the head or the tail; an entry $(i,r)$ in $\mathbf{M}_r$ with value 1 indicates that the $i$ -th triple in the knowledge graph has the relation $r$ . Since often in practical settings most entries in the three matrices are zero, saving them into sparse matrices can significantly reduce memory consumption (Cohen et al., 2019). + +After predicting the relation sequence $\mathbf{r}$ , we start the graph traversal from a given set of initial entities $\mathcal{E}_0 \subseteq \mathcal{E}$ . We first map the initial entities into a vector $\mathbf{e}_1 = [\mathbb{1}(e \in \mathcal{E}_0), \forall e \in \mathcal{E}]$ . That is, each entry of $\mathbf{e}_1 \in \mathbb{R}^{N_{\mathcal{E}}}$ has value 1 if that entity is in the initial entities list $\mathcal{E}_0$ , otherwise, the entry is zero. We then predict the next (temporary) entity vector $\mathbf{e}_2$ by conducting a Next module: + +$$ +\mathbf {e} _ {h + 1} ^ {r} = \operatorname {N e x t} \left(\mathbf {e} _ {h}, \mathbf {r} _ {h}\right), \tag {3} +$$ + +where + +$$ +\operatorname {N e x t} \left(\mathbf {e} _ {h}, \mathbf {r} _ {h}\right) = \frac {\mathbf {M} _ {t} ^ {T} \left(\mathbf {M} _ {h} \mathbf {e} _ {h} \odot \mathbf {M} _ {r} \mathbf {r} _ {h}\right)}{\left| \left| \mathbf {M} _ {t} ^ {T} \left(\mathbf {M} _ {h} \mathbf {e} _ {h} \odot \mathbf {M} _ {r} \mathbf {r} _ {h}\right) \right| \right| _ {2} + \epsilon}, \tag {4} +$$ + +Here $\epsilon$ is an arbitrary small number to offset the denominator and prevent division by zero. We introduce the normalized Next to solve the issue with the method proposed by (Cohen et al., + +2019) for knowledge graph completion defined as $\mathsf{F o l l o w}(\mathbf{e}_h,\mathbf{r}_h) = \mathbf{M}_t^T (\mathbf{M}_h\mathbf{e}_h\odot \mathbf{M}_r\mathbf{r}_h)$ ; since in a dialogue model, we can seldom predict the relation vectors that perfectly match the entity vectors. That is, if directly using the Follow module in (Cohen et al., 2019), the $||\mathbf{e}_h||_2$ will not be one and will vanish as the hop number $h$ increases. Specifically, note that in our proposed module, the predicted relations $\mathbf{r}_h$ are independent of the traversed entities $\mathbf{e}_h$ . For instance, finding the "distance" of "the nearby gas station" is independent of whether the nearby gas station is "Chevron" or "Shell". + +To allow the model to dynamically select the number of reasoning hops, we add a relation type "ToSelf" into $\mathcal{R}$ and connect each entity to itself by "ToSelf". More specifically, the KG will contain triples $(e_k^h,r_k,e_k^t)$ for all $e_k^h = e_k^t\in \mathcal{E}$ and $r_k =$ ToSelf. + +# 5.3 Entity Embeddings + +At each hop, we further conduct the operation vectors $\mathbf{a}$ on the entities weighted by the entity vector $\mathbf{e}_h$ . First, we tokenize each entity and represent it by the concatenation of its token embeddings. This step allows (1) representing entities with longer texts such as phrases and sentences, and (2) eliminating the effort to retrain entity embeddings whenever new entity values are added. The entity embeddings can then be represented as a tensor $\mathbf{E} \in \mathbb{R}^{N_{\mathcal{E}} \times d \times m}$ , where $m$ is the maximum number of tokens of entities2. + +# 5.4 Learnable Logical Operation and Checkpoints + +We compute the transformed entity embeddings by element-wise multiplication of the entity embeddings $\mathbf{E}$ with the entity vector $\mathbf{e}_h$ at the $h$ -th hop. Next, the dot product of the operation vectors and the transformed entity embeddings is passed to a softmax layer as the entity vector at the next hop: + +$$ +\mathbf {e} _ {h + 1} ^ {a} = \operatorname {s o f t m a x} \left(\mathbf {a} \left(\mathbf {E} \odot \mathbf {e} _ {h}\right)\right), \tag {5} +$$ + +Further, at the $h$ -th hop we use the walk-or-check vector $\mathbf{c}_h$ to combine the Next and operation modules above. The combined entity vector is given by: + +$$ +\begin{array}{l} \mathbf {e} _ {h + 1} = \mathbf {c} _ {h} ^ {T} \left[ \begin{array}{l} \mathbf {e} _ {h + 1} ^ {r} \\ \mathbf {e} _ {h + 1} ^ {a} \end{array} \right] \tag {6} \\ = \mathbf {c} _ {h} ^ {T} \left[ \begin{array}{c} \mathrm {N e x t} (\mathbf {e} _ {h}, \mathbf {r} _ {h}) \\ \mathrm {s o f t m a x} (\mathbf {a} (\mathbf {E} \odot \mathbf {e} _ {h})) \end{array} \right], \\ \end{array} +$$ + +# 5.5 Response Decoder + +After $H$ hops reasoning is done, the entities with top- $k$ values in the entity vector $\mathbf{e}_H$ are selected, indicating that they have the highest probability to be retrieved from the graph. These entities are converted into their embeddings in $E$ and multiplied by their values in $\mathbf{e}_H$ . These entity embeddings are then concatenated with the dialogue history $\mathbf{x}$ . The concatenated vectors are fed as the input into the transformer model to predict the response token by token. The predicted probability distribution over the output space can be written as $P(|\mathbf{x}, \mathbf{M}_h, \mathbf{M}_r, \mathbf{M}_t)$ . Since all components are differentiable, all modules can be trained end-to-end with the dialogue history $\mathbf{x}$ and the reified KG representation $\{\mathbf{M}_h, \mathbf{M}_r, \mathbf{M}_t\}$ using the cross-entropy loss with the ground-truth output $y$ as the labels. + +$$ +L = \sum_ {(\mathbf {x}, y)} - \log P (y | \mathbf {x}, \mathbf {M} _ {h}, \mathbf {M} _ {r}, \mathbf {M} _ {t}). \tag {7} +$$ + +During the inference time, the reasoning modules (relation layer, operation layer, and checkpoints layer) work exactly the same as the training stage, the only difference is that the response decoder is fed with predicted tokens in previous time steps (inference stage) instead of the ground-truth output (training stage). + +# 6 Experiments + +# 6.1 Datasets + +We evaluate our proposed approach on three datasets. Among them, we use Stanford Multidomain Dialogues (SMD) (Eric et al., 2017) and OpenDialKG (Moon et al., 2019) to test the methods generalizability on different dialogue types (task-oriented / chit-chat) and scales of structured knowledge (pairwise database / universal KG). To further analyze the reasoning ability, we propose a new dataset, SMD-Reasoning, by modifying the output of SMD dataset from natural language responses to actions paired with their reasoning types. + +Stanford Multi-domain Dialogues (SMD) The SMD dataset (Eric et al., 2017) is composed of two-speaker conversations, where a driver talks with the car assistant to tackle tasks in three domains: scheduling, navigation, and weather forecasting. Each dialogue focuses on one domain and is paired with a database having the related information. We convert the original database into two formats: (1) the natural language descriptions (NLD) and (2) the KG. The NLD form allows us to investigate the ability of the model to interpret unstructured knowledge, while the KG form could be a more extensible structured knowledge compared to tables. + +OpenDialKG OpenDialKG dataset (Moon et al., 2019) is composed of two-speakers recommendation and chit-chat style conversations. Each turn in a dialogue is annotated with the reasoning path on the provided KG, which is filtered from Freebase (Bollacker et al., 2008). The resulting KG has 1,190,658 triples, 100,813 entities and 1,358 relations. We randomly split $70 / 15 / 15\%$ for train-valid/test sets as described in (Moon et al., 2019; Jung et al., 2020) since they do not release their splits. + +SMD-Reasoning To make SMD dataset suitable for more precise evaluation of reasoning abilities, we manually label and convert it to the SMD-Reasoning dataset. We first remove the natural language part from the original responses and only leave the action word (e.g., inform) along with the information being conveyed. We divide the dataset into three main reasoning types: informing items, selecting min/max, and evaluating true/false. To validate if the models can identify whether the needed knowledge is in the database, we add a new reasoning type for extracting constraints, by removing the needed knowledge from the database and changing the output to "include [knowledge description]" as shown in Table 1. See Appendix A,B for statistics of these datasets. + +# 6.2 Evaluation Metrics + +We use different evaluation methods for the three datasets. For SMD, we follow prior work (Yang et al., 2020) and use BLEU (Papineni et al., 2002), and Entity F1 scores on each domain. For OpenDialKG, we follow the descriptions in prior works (Moon et al., 2019; Jung et al., 2020) to evaluate the path@k scores, i.e., if the ground-truth path is ranked top-k in the predicted paths probabilities. Moreover, since our method not only can + +predict the reasoning path as prior works but also can predict the response, we also use the BLEU score to get the approximated evaluation of the response quality compared to ground-truth. Note that prior work has discussed that BLEU scores may not match human intuition (Liu et al., 2016), but we use them here as an approximated evaluation for reference. + +For SMD-Reasoning, the output is more deterministic and does not include diverse sentence structures. Therefore, we compute the F1 score and the exact match (EM) score of prediction and the ground-truth. The EM score is calculated by removing the order of the prediction since the labels of SMD-Reasoning dataset follow the order of knowledge description appearing in the original ground-truth responses and may not have the same order as generated outputs. The EM score can be written as: + +$$ +\mathrm {E M} = \frac {1}{T} \sum \mathbb {1} (\operatorname {s o r t} (\hat {y}) = \operatorname {s o r t} (y)). \tag {8} +$$ + +where $\hat{y}$ is inferred from the model using argmax sampling and $T$ is total number of examples. + +# 6.3 Implementation Details + +Since the proposed method is model-agnostic, we implement it on GPT2 (Radford et al., 2019) and T5 (Raffel et al., 2020). Specifically for the T5 model, we use the unifiedQA-T5 model (Khashabi et al., 2020) which is pretrained on question answering tasks that also need to do reasoning. However, we empirically find that T5 generally has better performance than GPT2, thus using T5 model in most experiments. For OpenDialKG, since the groundtruth relations exist, we take them as an additional supervision signal as (Moon et al., 2019). Also, since we observe that there is only KG reasoning type in OpenDialKG, we do not use operation layer and checkpoints layer for the dataset. The hyperparameter settings are in Appendix C. + +# 6.4Baselines + +We compare our proposed DiffKG model with the state-of-the-art models on OpenDialKG reported in (Moon et al., 2019; Jung et al., 2020) and the state-of-the-art graph-based model on SMD (Yang et al., 2020; Gou et al., 2021) with their reported baselines including sequence-to-sequence models with and without attention (S2S and S2S+Attn) (Luong et al., 2015), pointer to unknown (Ptr-Unk) (Gulcehre et al., 2016), + +
ModelBLEUEntity F1
AllSche.Wea.Nav.
S2S8.410.39.714.17.0
S2S+Attn9.319.923.425.610.8
Ptr-Unk8.322.726.926.714.9
GraphLSTM10.350.869.946.643.2
BERT9.1349.657.447.546.8
Mem2Seq12.633.449.332.820.0
GLMP12.255.167.354.148.4
GraphDialog13.757.471.959.748.6
COMET-graph14.456.771.648.750.4
T5-DiffKG16.0456.267.261.546.7
+ +Table 2: The results on SMD dataset. S2S, S2S+Attn, Ptr-Unk, GraphLSTM, BERT, Mem2Seq, GLMP, GraphDialog are reported from (Yang et al., 2020) and COMET-graph from (Gou et al., 2021). Our DiffKG achieves the highest BLEU and comparable F1 scores with baselines. + +
Modelpath@1path@5path@10BLEU
Seq2Seq3.129.744.1-
Tri-LSTM3.222.636.3-
EXT-ED1.99.013.3-
DialKG13.235.347.9-
Seq2Path14.9231.138.68-
AttnFlow17.3730.6839.48-
AttnIO-AS23.7243.5752.17-
T5-NoInfo---14.51
T5-DiffKG26.8054.3361.7515.37
+ +GraphLSTM (Peng et al., 2017), BERT (Devlin et al., 2019), Mem2Seq (Madotto et al., 2018) and GLMP (Wu et al., 2019). We follow their metrics and train our model on their preprocessed data for fair comparisons. To further analyze the reasoning ability, we propose two more baselines based on different ways of leveraging pretrained language models. (1) NoInfo model does not take any format of knowledge as the input, aiming to test the performance of a fine-tuned vanilla transformer model on each dataset. (2) FlatInfo model constructs the input by concatenating the dialogue history with the NLD form of knowledge as (Beygi et al., 2022), allowing us to investigate the ability of the model to interpret unstructured knowledge. + +Table 3: The results on OpenDialKG dataset. The four baselines from Seq2Seq to DialKG Walker are reported from (Moon et al., 2019) and the other three baselines from Seq2Path to AttnIO-AS are reported from (Jung et al., 2020). Our DiffKG achieves the highest path@k scores and is the only one that can simultaneously generate responses. + +
Test KGMethodEMF1
FixedGPT2-NoInfo10.7143.78
GPT2-FlatInfo14.0847.57
GPT2-DiffKG16.3951.06
T5-NoInfo10.5044.27
T5-FlatInfo28.9966.15
T5-DiffKG27.5263.93
ShuffledT5-FlatInfo17.0254.51
T5-DiffKG27.5264.00
+ +Table 4: The results on SMD-Reasoning dataset. + +# 6.5 Results + +The results on SMD and OpenDialKG are shown in Table 2 and Table 3. On SMD dataset, we observe that DiffKG outperforms the baselines on BLEU by $11.4\%$ (relative change of 16.04 and 14.4) and achieves comparable entity F1 scores with GLMP, GraphDialog and COMET-graph. DiffKG might not improve the entity F1 scores because that prior works group the text inside an entity together (e.g., "road block nearby" becomes a single word "road_block_nearby" in vocabularies). In contrast, we use a universal tokenizer so as to prevent heavy preprocessing and specialized vocabularies. This means that DiffKG can perform similarly with state-of-the-art to retrieve knowledge without a tokenizer specified for each dataset. On OpenDialKG dataset, we observe that DiffKG outperforms the baselines in terms of path@k scores and can simultaneously outperform T5 in terms of Entity F1 and BLEU. These demonstrate that DiffKG can retrieve accurate paths for reasoning and effectively incorporate reasoning into response generation. + +We also investigate the results of SMD-Reasoning dataset as shown in Table 4. We find that DiffKG improves NoInfo by $16.6\%$ and $44.4\%$ F1 scores respectively on GPT2 and T5 models. This demonstrates that DiffKG can utilize knowledge effectively to improve the generation without access to information. In contrast, although FlatInfo gives similar performances as DiffKG on the SMD-Reasoning dataset, it cannot be run on OpenDialKG due to computational costs. More specifically, FlatInfo requires the knowledge graph to be transformed into sentences, which will result in at least a million tokens as the model inputs for OpenDialKG (since the number of triples is a million without designed subgraph sampling), which is not a practical number. + +
MethodDomainsReasoning Types
ScheduleNavigationWeatherInformSelectionExtractionTrue/False
EMF1EMF1EMF1EMF1EMF1EMF1EMF1
GPT2-NoInfo3.4945.74.6341.627.546.85.0345.21.4547.43.0624.068.668.6
GPT2-DiffKG9.3053.09.6547.634.456.58.0450.80.0048.531.653.556.956.9
T5-NoInfo0.0044.64.6340.929.050.73.0244.98.7049.11.0225.270.670.6
T5-DiffKG20.963.819.361.948.168.118.161.711.662.450.073.570.670.6
+ +Table 5: Detailed Evaluation Results of SMD-Reasoning dataset + +
SMD-ReasoningUser: check the date and time of my doctor's appointment +(Reasoning Path: Doctor Appointment HasDate, HasTime, ToSelf Tuesday, 11am, doctor appointment) +DiffKG: inform 11 am tuesday doctor appointment
User: Car I need to get to a gas station, please show me the nearest one +Assistant: There is Valero 7 miles away with moderate traffic on our way +User: Alright, where is it located? +(Reasoning Path: Gas Station IsTypeOf Valero HasAddress, ToSelf 200 Alester Ave, Valero) +DiffKG: inform 200 Alester Ave Valero
OpenDialKGSpeaker A: Do you have any info on Toni Kroos? +(Reasoning Path: Toni Kroos ~Player Statistics Germany national football team) +DiffKG: Toni Kroos is German footballer who plays for the Germany national football team.
+ +Table 6: Generated examples and the reasoning path. + +# 6.6 Quantitative Analysis + +To test the robustness of the methods towards accurately locating information, we shuffle the information order. This evaluation is to simulate the cases that extra information is arbitrarily added when deploying a dialogue system. Specifically, the order of the knowledge context for FlatInfo and the order of knowledge triples are changed during inference time. As shown in the last two rows in Table 4, the performance of FlatInfo drops while DiffKG remains about the same. This indicates that the slight superior performance of FlatInfo with the original order can come from the blackbox tricks to group the nearby knowledge in the inputs. When this implicit trick is broken down, the DiffKG shows much better robustness and performance. + +To investigate the difficulty of each domain and reasoning type, we divide the results accordingly in Table 5. As presented in the domains part, the models achieve the highest EM and F1 on the weather domain. We conjecture the reason is that the weather domain includes more reasoning types (weather:4, navigate:3, schedule:2 as in Appendix A Table 9), thus reflecting more balanced reasoning ability. In the reasoning types part, we observe that true/false is less well coped by DiffKG; however, DiffKG improves the extraction. This shows that DiffKG can effectively check the + +existence of required knowledge and then query the database. + +Regarding to the computational costs (on SMD-Reasoning dataset using T5 model), we found that DiffKG requires about 5.85GB memory during training and has 30ms inference latency. This could be an acceptable add-on memory usage and inference time compared to a model without knowledge reasoning (3.13GB; 30ms). Especially when a baseline like FlatInfo consumes much more (18.56GB; 50ms). + +# 6.7 Qualitative Analysis + +We visualize the generated examples and the symbolic reasoning path by DiffKG on SMD-Reasoning and OpenDialKG datasets in Table 6. The examples show that DiffKG can capture some naturally occurring phenomena in this dataset: (1) the KG reasoning path can be 1 to multiple hops; (2) the reasoning will diffuse to multiple paths (e.g., DiffKG simultaneously applies "HasDate", "HasTime", "ToSelf" to "Doctor Appointment"). Along with analyses in previous subsections, we observe that DiffKG can extract interpretable reasoning paths and generate corresponding outputs using reasonable computational costs. + +However, even though DiffKG can maintain or improve performance while doing interpretable reasoning on any scaled KG, errors might happen in + +
Error TypeExample
Unclear Information RequirementUser: What gas stations are here? +Ground-truth: inform Chevron +DiffKG: inform 5 miles, Chevron +(Our comment: Although this prediction is considered wrong for the EM metric, the “5 miles” of DiffKG output is the correct distance from “Chevron” and might be needed in a good response.)
Incomplete Reasoning but Faithful ResponseUser: Where is the closest grocery store? +Ground-truth: Inform 4 miles, Whole Foods, Safeway. +DiffKG: inform 4 miles, grocery store, 819 Alma St, Whole Foods +(Our comment: The 4 miles, grocery store, 819 Alma St are all correct entities about Whole Foods. Nonetheless, this reasoning process neglects another grocery store Safeway which is also 4 miles away.)
Correct Reasoning but Wrong ResponseSpeaker A: Do you know Don Hall? +Ground-truth: Don Hall wrote the Princess and the Frog a romance story starring Jenifer Lewis. Do you like Romance? +Reasoning Path: Don Hall ~written by The Princess and the Frog +DiffKG: Yes, he wrote The Little Dolls. +(Our comment: The reasoning path is correct to find out the script written by Don Hall. However, the generation process fails to properly utilize the retrieved entity.)
+ +Table 7: The error analysis with three major error types across datasets. + +some cases. As listed in Table 7, we found that across the datasets, the three main error types of DiffKG are: (1) unclear information requirement in the dataset, (2) incomplete reasoning ability but faithful response generation, and (3) correct reasoning but hallucinated response prediction. We argue that the first error type mainly comes from the mismatch among data points in the dataset and may not be able to be dealt with by models. The second error type indicates that the KG reasoning module sometimes cannot retrieve all the needed information. The third error type indicates that the module producing final output may not fully utilize the retrieved information. These three points might provide a direction for further improvement. + +# 7 Conclusion and Future Work + +For a dialogue system, an effective reasoning method over structured databases is important. In this work, we proposed DiffKG, an end-to-end model-agnostic method that does symbolic reasoning on any scale of KGs to enhance response generation. Experiments demonstrated that using DiffKG, models are able to generate responses with interpretable KG reasoning paths at a modest extra cost. + +This work can be extended in various ways. While we solely consider efficient large-scale KG reasoning in dialogue generation, future work can incorporate domain fusion methods to consider the generalizability over domains or simultaneously use relation information. Moreover, since Dif + +fKG is a simple large-scale structured knowledge-empowered transformer with flexible entity values, future work can extend it to dialogue generation that needs to do table and text mixed reasoning and that needs to do both KG reasoning and other goals such as personalized dialogues, storytelling, etc. + +# References + +Sajjad Beygi, Maryam Fazel-Zarandi, Alessandra Cervone, Prakash Krishnan, and Siddhartha Reddy Jonnalagadda. 2022. Logical reasoning for task oriented dialogue systems. arXiv preprint arXiv:2202.04161. +Kurt Bollacker, Colin Evans, Praveen Paritosh, Tim Sturge, and Jamie Taylor. 2008. Freebase: a collaboratively created graph database for structuring human knowledge. In Proceedings of the 2008 ACM SIGMOD international conference on Management of data. +William W Cohen, Haitian Sun, R Alex Hofer, and Matthew Siegler. 2019. Scalable neural methods for reasoning with a symbolic knowledge base. In International Conference on Learning Representations. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. Bert: Pre-training of deep bidirectional transformers for language understanding. In *NAACL-HLT* (1). +Emily Dinan, Stephen Roller, Kurt Shuster, Angela Fan, Michael Auli, and Jason Weston. 2018. Wizard of wikipedia: Knowledge-powered conversational agents. In International Conference on Learning Representations. +Julian Martin Eisenschlos, Maharshi Gor, Thomas Muller, and William W Cohen. 2021. Mate: Multi- + +view attention for table transformer efficiency. arXiv preprint arXiv:2109.04312. +Mihail Eric, Lakshmi Krishnan, Francois Charette, and Christopher D Manning. 2017. Key-value retrieval networks for task-oriented dialogue. In Proceedings of the 18th Annual SIGdial Meeting on Discourse and Dialogue. +Marjan Ghazvininejad, Chris Brockett, Ming-Wei Chang, Bill Dolan, Jianfeng Gao, Wen-tau Yih, and Michel Galley. 2018. A knowledge-grounded neural conversation model. In Thirty-Second AAAI Conference on Artificial Intelligence. +Yanjie Gou, Yinjie Lei, Lingqiao Liu, Yong Dai, and Chunxu Shen. 2021. Contextualize knowledge bases with transformer for end-to-end task-oriented dialogue systems. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, EMNLP 2021, Virtual Event / Punta Cana, Dominican Republic, 7-11 November, 2021. Association for Computational Linguistics. +Caglar Gulcehre, Sungjin Ahn, Ramesh Nallapati, Bowen Zhou, and Yoshua Bengio. 2016. Pointing the unknown words. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers). +Yanchao Hao, Yanzhe Zhang, Kang Liu, Shizhu He, Zhanyi Liu, Hua Wu, and Jun Zhao. 2017. An end-to-end model for question answering over knowledge base with cross-attention combining global knowledge. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), volume 1. +Ehsan Hosseini-Asl, Bryan McCann, Chien-Sheng Wu, Semih Yavuz, and Richard Socher. 2020. A simple language model for task-oriented dialogue. In Advances in Neural Information Processing Systems, volume 33, pages 20179-20191. Curran Associates, Inc. +Rishabh Joshi, Vidhisha Balachandran, Shikhar Vashisht, Alan Black, and Yulia Tsvetkov. 2020. Dialograph: Incorporating interpretable strategy-graph networks into negotiation dialogues. In International Conference on Learning Representations. +Jaehun Jung, Bokyung Son, and Sungwon Lyu. 2020. Attnio: Knowledge graph exploration with in-and-out attention flow for knowledge-grounded dialogue. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP). +Dan Jurafsky and James H. Martin. 2009. Speech and language processing: an introduction to natural language processing, computational linguistics, and speech recognition, 2nd Edition. Prentice Hall series in artificial intelligence. Prentice Hall, Pearson Education International. + +Daniel Khashabi, Sewon Min, Tushar Khot, Ashish Sabharwal, Oyvind Tafjord, Peter Clark, and Hannaneh Hajishirzi. 2020. Unifiedqa: Crossing format boundaries with a single qa system. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: Findings. +Tushar Khot, Peter Clark, Michal Guerquin, Peter Jansen, and Ashish Sabharwal. 2020. Qasc: A dataset for question answering via sentence composition. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 8082-8090. +Seokhwan Kim, Mihail Eric, Karthik Gopalakrishnan, Behnam Hedayatnia, Yang Liu, and Dilek Hakkani-Tur. 2020. Beyond domain apis: Task-oriented conversational modeling with unstructured knowledge access. In Proceedings of the 21th Annual Meeting of the Special Interest Group on Discourse and Dialogue. +Bill Yuchen Lin, Haitian Sun, Bhuwan Dhingra, Manzil Zaheer, Xiang Ren, and William Cohen. 2021. Differentiable open-ended commonsense reasoning. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies. +Chia-Wei Liu, Ryan Lowe, Iulian Serban, Mike Noseworthy, Laurent Charlin, and Joelle Pineau. 2016. How not to evaluate your dialogue system: An empirical study of unsupervised evaluation metrics for dialogue response generation. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing. +Yinong Long, Jianan Wang, Zhen Xu, Zongsheng Wang, Baoxun Wang, and Zhuoran Wang. 2017. A knowledge enhanced generative conversational service agent. In Proceedings of the 6th Dialog System Technology Challenges (DSTC6) Workshop. +Thang Luong, Hieu Pham, and Christopher D Manning. 2015. Effective approaches to attention-based neural machine translation. In EMNLP. +Andrea Madotto, Chien-Sheng Wu, and Pascale Fung. 2018. Mem2seq: Effectively incorporating knowledge bases into end-to-end task-oriented dialog systems. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers). +Todor Mihaylov, Peter Clark, Tushar Khot, and Ashish Sabharwal. 2018. Can a suit of armor conduct electricity? a new dataset for open book question answering. arXiv preprint arXiv:1809.02789. +Seungwhan Moon, Pararth Shah, Anuj Kumar, and Rajen Subba. 2019. Opendialkg: Explanable conversational reasoning with attention-based walks over knowledge graphs. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics. + +Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. 2002. Bleu: a method for automatic evaluation of machine translation. In Proceedings of the 40th annual meeting of the Association for Computational Linguistics. +Nanyun Peng, Hoifung Poon, Chris Quirk, Kristina Toutanova, and Wen-tau Yih. 2017. Cross-sentence nary relation extraction with graph lstms. Transactions of the Association for Computational Linguistics, 5. +Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. 2019. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9. +Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. 2020. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research, 21(140):1-67. +Pranav Rajpurkar, Robin Jia, and Percy Liang. 2018. Know what you don't know: Unanswerable questions for squad. arXiv preprint arXiv:1806.03822. +Siva Reddy, Danqi Chen, and Christopher D Manning. 2019. Coqa: A conversational question answering challenge. Transactions of the Association for Computational Linguistics, 7:249-266. +Iulian V Serban, Alessandro Sordoni, Yoshua Bengio, Aaron Courville, and Joelle Pineau. 2016. Building End-to-End Dialogue Systems Using Generative Hierarchical Neural Network Models. In Proceedings of the 30th AAAI Conference on Artificial Intelligence (AAAI-16). +Alessandro Sordoni, Michel Galley, Michael Auli, Chris Brockett, Yangfeng Ji, Margaret Mitchell, Jian-Yun Nie, Jianfeng Gao, and Bill Dolan. 2015. A neural network approach to context-sensitive generation of conversational responses. In Proceedings of the 2015 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies. +Shane Storks, Qiaozi Gao, and Joyce Y Chai. 2019. Recent advances in natural language inference: A survey of benchmarks, resources, and approaches. arXiv preprint arXiv:1904.01172. +Yi-Lin Tuan, Yun-Nung Chen, and Hung-Yi Lee. 2019. Dykgchat: Benchmarking dialogue generation grounding on dynamic knowledge graphs. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP). +Yi-Lin Tuan, Wei Wei, and William Yang Wang. 2020. Knowledge injection into dialogue generation via language models. arXiv preprint arXiv:2004.14614. + +Petar Velicković, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua Bengio. 2018. Graph attention networks. International Conference on Learning Representation. +Pat Verga, Haitian Sun, Livio Baldini Soares, and William W Cohen. 2020. Facts as experts: Adaptable and interpretable neural memory over symbolic knowledge. arXiv preprint arXiv:2007.00849. +Qingyue Wang, Yanan Cao, Junyan Jiang, Yafang Wang, Lingling Tong, and Li Guo. 2021. Incorporating specific knowledge into end-to-end task-oriented dialogue systems. In 2021 International Joint Conference on Neural Networks (IJCNN), pages 1-8. IEEE. +Tsung-Hsien Wen, Milica Gasic, Nikola Mrksic, Lina M Rojas-Barahona, Pei-Hao Su, Stefan Ultes, David Vandyke, and Steve Young. 2017. A network-based end-to-end trainable task-oriented dialogue system. In European Association for Computational Linguistics (EACL), pages 438-449. +Jason Weston, Antoine Bordes, Sumit Chopra, Alexander M Rush, Bart van Merrienboer, Armand Joulin, and Tomas Mikolov. 2015. Towards ai-complete question answering: A set of prerequisite toy tasks. arXiv preprint arXiv:1502.05698. +Jason Williams, Antoine Raux, and Matthew Henderson. 2016. The dialog state tracking challenge series: A review. Dialogue & Discourse, 7(3):4-33. +Chien-Sheng Wu, Richard Socher, and Caiming Xiong. 2019. Global-to-local memory pointer networks for task-oriented dialogue. In International Conference on Learning Representations. +Shiquan Yang, Rui Zhang, and Sarah Erfani. 2020. Graphdialog: Integrating graph knowledge into end-to-end task-oriented dialogue systems. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP). +Jun Yin, Xin Jiang, Zhengdong Lu, Lifeng Shang, Hang Li, and Xiaoming Li. 2016. Neural generative question answering. In Proceedings of the Workshop on Human-Computer Question Answering. +Xueliang Zhao, Wei Wu, Chongyang Tao, Can Xu, Dongyan Zhao, and Rui Yan. 2019. Low-resource knowledge-grounded dialogue generation. In International Conference on Learning Representations. +Hao Zhou, Tom Young, Minlie Huang, Haizhou Zhao, Jingfang Xu, and Xiaoyan Zhu. 2018. Commonsense knowledge aware conversation generation with graph attention. In *IJCAI*. +Wenya Zhu, Kaixiang Mo, Yu Zhang, Zhangbin Zhu, Xuezheng Peng, and Qiang Yang. 2017. Flexible end-to-end dialogue system for knowledge grounded conversation. arXiv preprint arXiv:1709.04264. + +# A Dataset Details + +The statistics of datasets are in Table 8 and Table 9. The OpenDialKG dataset is under CC-BY-NC-4.0 license. These datasets can be used for research purposes. + +
DataTrainValidationTest
SMD2425302304
OpenDialKG1097123512351
+ +Table 8: The number of dialogues in each data split. + +
ScheduleNavigationWeather
Inform3641133236
Selection-68639
True/False--543
Extraction173474214
+ +# B SMD KG Construction + +We write a simple, automatic program to construct KGs for SMD dataset mapped from the original annotated tables. + +For the schedule and navigation domains in SMD, we directly map their table attributes to the relations $\mathcal{R}$ in our constructed KG. For the weather domain, we split each weather report into low temperature, high temperature, and weather. The resulting number of relations is 29, and the relations are listed in Table 10. + +In the schedule and navigation domain, each item in the original database with multiple attributes are transformed to KG triples as (event/point-of-interest, attribute, attribute value), e.g., (tennis activity, HasTime, 7pm) in schedule domain or (Chevron, HasType, gas station) in navigation domain. + +In the weather domain, we add additional entities named "ReportID\(digits\)", where \)digits$ will be replaced with an ID number. Each item in the original database is in the format: (item, location, $location), (item, $date, $weather_report), where the $weather_report contains multiple information not simultaneously needed. To make the KG of weather consistent with the KGs of schedule + +Table 9: The statistics of SMD Reasoning dataset with respect to domains and reasoning types. Note that since reasoning types are classified on turn-level, the total number in this table is larger than in Table 8 that counted on dialogue-level. + +
DomainRelations
ScheduleHasTime, HasDate, HasParty, HasRoom, HasAgenda, Is-TimeOf, IsDateOf, IsPartyOf, IsRoomOf, IsAgendaOf
NavigationHasAddress, HasType, HasTraffic, HasDistance, IsAddressOf, IsTypeOf, IsTrafficOf, IsDistanceFrom
WeatherIsEqualTo, HasLocation, HasWeather, HasLowTemp, HasHighTemp, HasDate, IsWeatherOf, IsLowTempOf, IsHighTempOf, IsLocationOf, IsDateOf
+ +Table 10: The relations used in each domain in SMD dataset. + +![](images/f29a825d7524ca17f8ef4f3159fa2ede5bd493f850642c02a71a27cf02f461aa.jpg) +Figure 2: The comparison of the consumed training memory and inference latency. + +and navigation, we transform each item into (ReportID, location, $location), (ReportID, HasDate, $date), (ReportID, HasWeather, $weather), (ReportID, HasLowTemp, $low_tempature), (ReportID, HasHighTemp, $high_tempature). + +# C Experiment Details + +The hyperparameters we set for DiffKG are $d$ = the hidden size of the used pretrainedTransformer (T5-small: $d = 512$ ; GPT2: $d = 768$ ), $H = 5$ , max norm $= 1.0$ , batch size $= 16$ , and gradient accumulation steps $= 2$ for at most 50 epochs and train the model learning rate $\in \{5 \times 10^{-5}, 6.25 \times 10^{-5}\}$ (found that $6.25 \times 10^{-5}$ is better) without learning rate decay. Our experiments were single runs with random initialization and were not further fine-tuned. + +# D Computational Cost Analysis + +As plotted in Figure 2, on SMD-Reasoning dataset, the consumed memory of FlatInfo is thrice the memory needed for DiffKG at training time, and its + +latency is about twice at inference time. The difference in inference latency is even larger with GPT2 as the backbone model. The reason is that the computational cost of a causal language model such as GPT2 largely depends on the input sequence length, which is one of the main issues of FlatInfo. \ No newline at end of file diff --git a/towardslargescaleinterpretableknowledgegraphreasoningfordialoguesystems/images.zip b/towardslargescaleinterpretableknowledgegraphreasoningfordialoguesystems/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..501a4ef0ba72ad9b66699e44dd8bcfadea584941 --- /dev/null +++ b/towardslargescaleinterpretableknowledgegraphreasoningfordialoguesystems/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fbe0bd023694aedd6f62f3018c16cfeb02f5d438048bd23e9692b12bafc5228a +size 626756 diff --git a/towardslargescaleinterpretableknowledgegraphreasoningfordialoguesystems/layout.json b/towardslargescaleinterpretableknowledgegraphreasoningfordialoguesystems/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..3c49d6b60e5a0446af98d9b7a0127accbedfe36f --- /dev/null +++ b/towardslargescaleinterpretableknowledgegraphreasoningfordialoguesystems/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2c7f7fb89c2ee700d460301e4656c2f6a8394d175c5d451e35a9072256af5a50 +size 409215 diff --git a/towardsresponsiblenaturallanguageannotationforthevarietiesofarabic/69d1061a-24c0-41fc-9fb8-67e6b46830a2_content_list.json b/towardsresponsiblenaturallanguageannotationforthevarietiesofarabic/69d1061a-24c0-41fc-9fb8-67e6b46830a2_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..b1eb70e21c075bbaedb26f04ae610f2f92759987 --- /dev/null +++ b/towardsresponsiblenaturallanguageannotationforthevarietiesofarabic/69d1061a-24c0-41fc-9fb8-67e6b46830a2_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8aa627d4078686d5cfca908b9009e27056a6e2421a6a5345ab23685f33db7453 +size 55056 diff --git a/towardsresponsiblenaturallanguageannotationforthevarietiesofarabic/69d1061a-24c0-41fc-9fb8-67e6b46830a2_model.json b/towardsresponsiblenaturallanguageannotationforthevarietiesofarabic/69d1061a-24c0-41fc-9fb8-67e6b46830a2_model.json new file mode 100644 index 0000000000000000000000000000000000000000..90bbcb98dc978f6026d9409d609affa0e6443cec --- /dev/null +++ b/towardsresponsiblenaturallanguageannotationforthevarietiesofarabic/69d1061a-24c0-41fc-9fb8-67e6b46830a2_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2253da7d68e73d0ef0952e8bd7029e602908508e98a1e985a192c6e17ce605cc +size 70092 diff --git a/towardsresponsiblenaturallanguageannotationforthevarietiesofarabic/69d1061a-24c0-41fc-9fb8-67e6b46830a2_origin.pdf b/towardsresponsiblenaturallanguageannotationforthevarietiesofarabic/69d1061a-24c0-41fc-9fb8-67e6b46830a2_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..fb48a710dad318c413456baa03bc2f319cadd9cd --- /dev/null +++ b/towardsresponsiblenaturallanguageannotationforthevarietiesofarabic/69d1061a-24c0-41fc-9fb8-67e6b46830a2_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e039d22c8dca4f610beb398aa7cce3805539378b8fbc71bd9ff4b39be539d02f +size 276548 diff --git a/towardsresponsiblenaturallanguageannotationforthevarietiesofarabic/full.md b/towardsresponsiblenaturallanguageannotationforthevarietiesofarabic/full.md new file mode 100644 index 0000000000000000000000000000000000000000..a673692a49606ffa0af014351f3cce2bdaa5d648 --- /dev/null +++ b/towardsresponsiblenaturallanguageannotationforthevarietiesofarabic/full.md @@ -0,0 +1,194 @@ +# Towards Responsible Natural Language Annotation for the Varieties of Arabic + +A. Stevie Bergman + +Responsible AI, Meta / New York, NY + +asbergman@fb.com + +Mona T. Diab + +Responsible AI, Meta / Seattle, WA + +mdiab@fb.com + +# Abstract + +When building NLP models, there is a tendency to aim for broader coverage, often overlooking cultural and (socio)linguistic nuance. In this position paper, we make the case for care and attention to such nuances, particularly in dataset annotation, as well as the inclusion of cultural and linguistic expertise in the process. We present a playbook for responsible dataset creation for polyglossic, multidialectal languages. This work is informed by a study on Arabic annotation of social media content. + +# 1 Introduction + +Natural language processing (NLP) is the foundation of numerous automated decision-making systems in a growing number of scenarios and languages, including content moderation on platforms with global reach and consequence (Gillespie, 2020). Thus it is highly pertinent to address how practitioners can build responsible NLP systems, models, and workflows for languages beyond English (Bender, 2019; Mielke, 2016; Husain and Uzuner, 2021). In doing so, it is essential that these systems are designed with the inclusion of domain experts and stakeholder groups with native fluency and local/regional knowledge (Bender, 2009; Ovadya and Whittlestone, 2019). This will not only ensure the presence of the deep problem understanding necessary to create accurate systems and anticipate potential harms, but foster earned trust and legitimacy in the system (Martin Jr et al., 2020). + +Many performant machine learning/NLP algorithms to date are supervised, relying on large scale annotated training data, thus the veracity and curation of the data labels can have significant impact on model performance (Bender et al., 2021; Northcutt et al., 2021). And further, even unsupervised and semi-supervised systems require labeled data for evaluation as a bare minimum to allow visibility into any blindspots in the system performance. + +In this position paper, we focus on NLP datasets, highlighting the potential for compounding harms to at-risk populations and calling for greater care and attention to annotation and annotator support (Denton et al., 2021). This is demonstrated via the varieties of Arabic. + +# 2 Arabic Varieties and NLP + +Arabic is a Semitic language, spoken by over 420M people globally with the highest concentration in the Middle East and North Africa (MENA) where it is the dominant or official language of over twenty nations. Arabic is better described as a family of languages as the so-called "dialects" are highly variable and often have low inter-dialect comprehensibility (Al-Wer and Horesh, 2018). e.g. Moroccan and Egyptian varieties are about as mutually intelligible as Spanish and Romanian. Importantly, Arabic should not be considered as an analog to English, i.e. one language with closely related dialects (e.g. British, American, and Australian English). This comparison buries the polyglossic (when languages co-exist in a community) and heterogeneous characteristics of Arabic that are crucial to take into account when building effective Arabic NLP systems. We describe several relevant features of Arabic in this section. + +First, while these varieties share the same root in Classical Arabic, varying historical and cultural experiences across the Arab world have led to the divergence in spoken practice, leading to frequent cases of "faux amis," a.k.a. false cognates. This phenomenon refers to words or phrases that appear or sound the same between the varieties but have different meanings. For example, the word + +zahry2 means my luck in Tunisian Arabic, however the same word refers to the color pink in Levantine. Faux amis have implications for detecting objectionable speech, e.g. a common slur in Moroccan Arabic is zamel, however in Yemeni it is a type of singing that has become popular in recent years with the war in Yemen. Notably, this phenomenon is not only on the lexical level but also on the phrasal level, e.g. yETyk AlEfyap in Levantine dialects means "may you have good health," however in Moroccan it translates to "go to hell." + +Second, Arabic exemplifies one of the best known cases of diglossia, $^{3}$ where the formal Modern Standard Arabic (MSA) or $f u S H Y$ , and the regional spoken vernaculars co-exist in virtually every speech community. Today, MSA is used in practice primarily for international news and legal contracts. It is generally the language of education, and thus only fully accessible to those with a certain level of literacy and training. In fact, MSA is a formal language akin to Shakespearean English and is not spoken colloquially. Despite that, MSA is considered a relatively high-resource language (Bender, 2019) due to its status as the shared language in the Arab world, as such it is often the variety used in Arabic language technologies. Moreover, it is the prevalent Arabic variety of language-learning courses across the world. Notably, L2 language learners of MSA often have trouble communicating with native Arabic speakers due to considerable divergences between MSA and spoken varieties. Due to these factors, when NLP systems are built for MSA a large portion of Arabic speakers cannot benefit fully from the technology, creating an access disparity between those with and without a more advanced education. $^{4}$ + +The third feature to highlight is the fact that the colloquial varieties of Arabic greatly differ from one another along a geographic and social continuum, however general consensus splits Arabic into six broad groupings. Following Habash (2010) these are: Iraqi (Iraq), Levantine (Syria, Jordan, Lebanon, Palestine), Maghrebi (Morocco, Tunisia, Algeria, Libya, Western Sahara, Mauritania), Peninsular/Gulf (Oman, Qatar, Saudi Arabia, + +Bahrain, United Arab Emirates, Kuwait $^{6}$ ), Yemeni (Yemen), Egyptian (Egypt & Sudan $^{7}$ ). + +These broad dialect groupings of course do not fully account for the heterogeneous political and cultural aspects of MENA or the Arabic speaking diaspora. This can be a pitfall in annotation given that contextual knowledge is often necessary for full semantic and pragmatic understanding. As an example, the Maghrebiet dialect may be more appropriately broken down further, as Algerian is often unintelligible to Moroccan and Tunisian variety speakers due to the infusion of novel, contextually-based vocabulary that correspond to the country's particular political context. This is a common phenomenon across MENA, and of course for other languages. The unique country-level situations for Arabic dialects – not to mention contexts and groupings that are sub-national or transcend country borders – are important to take into account as NLP practitioners strive to produce systems that capture how humans naturally use language. + +A final element to mention is the fact that there are no standard orthographies for Arabic dialectal text and the written variants exhibit pervasive code switching. This property is of course particularly important in the context of text annotation. Such a language profile pushes the boundaries of NLP, and perceptions away from Arabic as a monolith.[8] + +# 3 Motivational Case Study: Arabic on Social Media + +To highlight the necessity for a more nuanced treatment of polyglossic, multidialectal languages, we study annotation of Arabic content on the Facebook platform. The text-based samples in the study are in native Arabic script (i.e. non-romanized), created by users in ten Arabic nations: Algeria, Morocco, Libya, Syria, Iraq, Lebanon, Egypt, Saudi Arabia, Sudan, and Yemen. We select these nations to cover all broad dialect groups in the region ( $\S 2$ ), with some inter-dialect comparisons, e.g. Syria and Lebanon. Country-level groupings are employed in the study, rather than the broad dialects, to capture the contextual nature of content in each nation. + +![](images/2bf1688f2ad617c16b15bea69e11b904d8b8fd1798e37cc028b5dd0b9c14fa7e.jpg) +Figure 1: Aggregate implied threshold per country of the AiM using Signal Detection Theory (reduced by the overall aggregate implied threshold for all countries combined). Note that a relatively higher threshold indicates greater leniency, or alternatively that a lower relative threshold indicates greater strictness. + +Approximately 3000 pieces of content are sampled per country from a source dataset created for the purpose of hate speech classification evaluation. For content from each country, we compare data labeled by annotators residing in Morocco (AiM) to reviews by annotators with native fluency and expertise for each country in the study, a.k.a. country experts (CE). For example, for Syrian content, annotation by AiM is compared to that by CE who are verified Syrian annotators. It is worth noting that the CE annotation consistency as measured by intra CE agreement – inter-annotator agreement or IAA – is quite high ranging from $64\%$ for Egyptian to $92\%$ for Moroccan Arabic.[9] The overlap sample sizes for the CE IAA measurement ranged in size from 91 unique items corresponding to $26\%$ of the total Saudi Arabic dataset to 975 unique items corresponding to $41\%$ of the total Iraqi dataset. + +To achieve this, the content is first sampled and sorted primarily by IP into per-country queues. CE then choose the dominant language variety and country of the sample. From there, the data is filtered to only Arabic content from the country. After filtering, the CE label the content (previously labeled by AiM) with one of two classes: "delete" (i.e. the content is deemed hateful) or "ignore" (i.e. the content is deemed benign) per a predefined set of content guidelines. + +The main findings of this study are as follows: (1) For every country dataset, the majority of the content is found to be in the Arabic dialect of that nation, rather than MSA. This tracks with the understanding that users communicate informally on + +social media (Habash, 2010; McCulloch, 2019), (2) The Saudi and Algerian datasets show a significantly higher presence of MSA content (31% and 27%, respectively) than other country datasets. Additionally, 74% of the Arabic samples in the Saudi dataset are identified by CE as non-Saudi content, a property of that could be explained by inward migration.[10] Thus after filtering the Saudi dataset is significantly smaller than that of any other country dataset. (3) Signal Detection Theory (SDT) models decision-making as a mixture of Gaussians (one for benign content and another for violating content) and determines the implied threshold of the reviewers in aggregate (Bakalar et al., 2021). Employing SDT, we find the AiM reviewers are labeling Moroccan content more leniently with statistical significance (Figure 1) as compared to all other country datasets, with the notable exception of the Saudi dataset. + +Of further note, considering the CE labeling for each dataset as ground truth, the Morocco dataset had the most accurate labeling by the AiM cohort at $87\%$ . This is an intuitive result that was verified in this study. This finding, coupled with the SDT results shown in Figure 1, point to two potential interpretations: When reviewers understand the linguistic and contextual content of the samples, they + +1. Are more likely to understand the nuances of the content that make it benign (e.g. sarcastic or idiomatic speech); +2. May feel comfortable giving a certain benefit-of-the-doubt (a.k.a. leniency) to the content creator, whereas they may not for groups in which they are not a member. + +This observed leniency, alone, could imply that reviewers should not review content within their own variety, however when coupled with the sociolinguistic knowledge presented in Section 2 on the distance between the varieties and the finding that, for the Morocco dataset, the the AiM cohort and CE had the highest agreement, these findings instead point to the fact that reviewers could be misunderstanding other-variety content or are relatively more strict on out-group member content. + +This study highlights the impact of Arabic variety differences on annotation. Accordingly we gather observations and formalize the process rendering it applicable across similar scenarios, + +namely, dataset creation for polyglossic, multidialectal languages such as Indo/Malay, varieties of German, etc. + +# 4 A Playbook for Dataset Creation + +For accurate annotation of natural language content, it is important for NLP practitioners to consider the entire flow of content to the training or evaluation datasets.11 Here, we propose general recommended practices for annotation, with further information for Arabic NLP dataset creation, informed by the case study in Section 3. The guidelines aim to: (1) ensure there is sufficient expertise to – at minimum – understand the variety and context of the annotation samples; (2) route samples to experts who are best equipped to field and process them; and, (3) provide expert support and inclusion in the process of NLP design and implementation. These recommendations could seem obvious to some, however they are worth crisply laying out to set expectations of expert inclusion and support in NLP development. They are as follows: + +(1) Data sample collection and curation that is representative of the speech/orthographies of the user cohort for the developers' intended systems, and refreshed periodically to capture changing relevant events ensuring concurrent and temporal sensitivity (DeVries et al., 2019; Rancic et al., 2021). Such measures can reduce the potential for harms due to group under-representation in datasets (Barocas et al., 2019; Buolamwini and Gebru, 2018). + +For the case study, we employed a stratified sampling technique to endeavor to capture the linguistic landscape of Arabic variety-speakers, and relevant context coverage for Arabic content from the countries and communities in focus. + +(2) Training materials and interface design to support the annotators in understanding their task. For the case study (§3), this included prototyping and iterations on the training materials and interface, with multi-stage feedback from a subset of annotators. Additionally, there was select translation of training materials and the annotation interface into the Arabic varieties to assist understanding (localization).12 + +(3) Annotator representation: Reviewers are adequately representative of the users whose content they are labeling, and have necessary fluency in the language and context of the samples they are vetting. Ideally, proficiency is validated with testing and responsible hiring practices.[13] + +(4) Annotator proficiency assessment to verify both language proficiency and an understanding of context and culture to the relevant level for the task at hand. This has the added benefit of demonstrating legitimacy and trustworthiness of the dataset. Evaluations should be designed carefully as many speakers of one variety have passive knowledge (vs. deep/native understanding) of other varieties. Arabic speakers may consider themselves fluent enough in the passive variety however it is important that their proficiency level is carefully assessed.[14] + +Furthermore, evaluations per-variety in many of these polyglossic multidialectal language families should include contextual elements relevant to the country or region. At present, many out-of-the-box Arabic proficiency tests are specific to MSA, which is not recommended unless employed as a supplement. + +For the case study (§3), a major difference between the Morocco-based annotators and country experts is their verified relevant expertise. The country experts are proficient in the Arabic variety and regional contexts relevant to the labeling tasks, with sufficient cultural understanding to accurately interpret content from the community. Broad groupings (§2) could be employed, depending on the granularity of contextual content and goals of the model. Setting aside the vast in-homogeneity of cultures and complex contexts across the Arabic-speaking world, there can be a misconception that if an individual can speak one Arabic dialect/variety they can accurately label content for any or adjacent varieties. This should not generally be assumed (Al-Wer and Horesh, 2018; Habash, 2010). + +(5) Sample routing and queues are recommended such that annotators are reviewing content within + +the term "MSA" in annotation questions to the Arabic term "fuSHY." +13If other languages are needed for labeling, e.g. to understand the training materials, examples, or prompts, proficiency standards are recommended for those languages as well (if the instructions are in English while the actual text to be annotated is Swahili, for instance). +14 Arabic speakers often have passive knowledge of Egyptian Arabic, the dominant variety in Arabic language media. However passive learning from media can lead to missing Egyptian specific vernacular/cultural nuance. + +their expertise. For systems aiming to cover multiple dialects or language groupings (e.g. multiple Arabic varieties), content could be divided by a manual or automated language identification system and routed to designated annotator queues. + +For Arabic varieties, queues and routing at least at the granularity level of each broad grouping (§2) is generally essential, due to the low inter-variety comprehension. If country context is deemed relevant for the type of samples and application, e.g. political contexts/social value content, further subdivisions (e.g. country, age, gender identity, etc.) are likely to be important for accuracy and consistency in labeling. For systems with automated routing, language and geographic identification could be employed to detect and separate dialects and contexts. A possible starting point is the groupings as described in §2, enhanced with guiding per-variety word lists. + +These elements bring up the difficult question of granularity: Not just how, but how deeply should practitioners divide datasets and annotation, in order to ensure sufficient coverage and understanding of the content? This is a deceptively challenging question as languages most commonly exist on a continuum and practitioners can often divide the natural language groups further with no clear ideal stopping point. This question of granularity presents the need for a careful deliberation of trade-offs, often around resource expenditure vs. annotator expertise and data coverage. Data availability or the cost of obtaining high-quality labeling will frequently become a limiting factor. The overarching recommendation in this work is to prioritize high quality annotation over breadth of coverage, indicating that in the cases where researchers do not have the resources for high quality annotation and annotator support they instead reduce coverage by tightening the goals of their NLP technology/application. + +(6) Sample re-routing capabilities are relevant to capture routing errors, especially as errors in language identification can be surprising. It's important to build flexibility into the annotation system to allow annotators to route/skip samples outside their expertise, as well as a mechanism to surface such routing failures to improve the system. For the case study, we provided a mechanism to filter or surface routing errors. + +(7) Data evaluation for faithful and accurately-labeled evaluation and training (if applicable), such + +that a resulting model can report real patterns (Northcutt et al., 2021). This includes label evaluation and auditing systems to measure accuracy, sensitivity, and any potential bias (e.g. sampling biases, statistical biases, or stereotypes) encoded in the datasets (Bakalar et al., 2021; Barocas and Selbst, 2016). A multi-evaluation system for the stability of the labels, or uncovering ambiguity, could be significant (Caliskan et al., 2017). + +For multidialectal, polyglossic languages such as Arabic, it is important that data evaluations account for the language variety and contextual differences, particularly with tricky faux amis. For the case study, we employed a multistage process with adjudication using multiple expert reviewers of content to check annotation quality. + +(8) Reviewer well-being support systems, including but not limited to rest periods and psychological support, are important for any type of annotation, and especially-so when the dataset is composed of disturbing or traumatic content. These means of support are even more essential for the well-being of Arabic annotators, given the high rate of PTSD in the Arab world (Suto, 2016; Syria Relief, 2021). + +Care is needed when constructing Arabic natural language datasets, due to the prevalence of faux amis, Modern Standard Arabic and pervasive linguistic code switching, as well as the complex cultural and political contexts of Arabic-dominant countries. This is not to mention the potentially dire consequences of errors for economically disadvantaged and vulnerable groups in MENA (Amnesty International, 2020; Human Rights Watch, 2017; Shea and al-Hassani, 2021; Johnsen, 2021). The guidelines in this section serve the additional purpose of surfacing failure modes in labeling that could scale when training classifiers, or obfuscate issues with model outcomes for evaluation datasets. + +# 5 Conclusion + +Polyglossic and multidialectal languages present both challenges and opportunities to the NLP community, chief among them are the trade-offs inherent in dataset creation. From developing best practices with Arabic, we can apply the guidelines to other polyglossic, dialectal languages – such as Chinese, Indonesian/Malay, and German – with the understanding that with each language comes new challenges. + +# 6 Ethical Considerations + +This paper fits in to the body of responsible and fair AI research by offering best practices towards ensuring the annotation ecosystem for dataset creation is responsive to the relevant groups in the Arabic-speaking world, and by extension local communities. The general goals of this work are to limit representational and potential downstream allocative harms (Barocas et al., 2019). Moreover, the work strives to advise on building NLP systems that allow annotators to be a voice for their local communities, where they are appreciated for their skill and ability to provide deep problem understanding. + +Expert Inclusion: Regional/country experts with Arabic variety proficiency are included in all stages of the guideline formulation, research design and implementation, and producing the comparative annotation results in Section 3. Their expertise is critical to the entire research process.[15] + +Audience: This work is targeted for the NLP community. The guidelines are formulated with an understanding that practitioners may not have the resources to implement them all to the fullest extent. They are north stars to aim for, however if language/content understanding and reviewer support are not achievable with the resources at-hand, the practitioner can reduce the dialect/variety coverage of the annotation accordingly. We advocate for a nuanced approach in dataset creation over comprehensive coverage. + +Scope: This work is limited to Arabic varieties, with the hope that researchers can gain insight into handling other polyglossic, multidialectal global languages as well as a sense for the complexities of dataset creation for NLP. There are certainly nuances to Arabic annotation that are not covered in this work that affect annotation such as code switching and orthographic considerations. + +Furthermore, we focus on the broad Arabic dialects when discussing representation in the guidelines (§4). We recognize that there are other, deeply important areas of diversity and representation including gender, political stance, religion, etc., however we considered these outside the scope of this particular paper. What we describe here are recommended minimal representation requirements considering language at as high of a level as pos + +sible. Of course other groupings have particular manners of language use that could be required for fully accurate annotation. + +Broader Impacts: NLP systems are embedded in our multifaceted, ever-changing societies, and it is therefore necessary to consider the model's potential or realized impacts, as well as the productive and adversarial manners in which the world can feedback to the model (Sambasivan et al., 2020; Hagerty and Rubinov, 2019). The primary scope of this paper is data, however in what follows we discuss elements of model support that can provide constructive feedback to the system. + +First, this paper calls for soliciting stakeholder input, particularly through working with annotators who are of the community the model aims to capture. But further consultation with groups such as regional user-advocacy groups can be important to garner a higher-level view and broader problem understanding to prevent potential issues and low performance for underserved groups (Martin Jr et al., 2020; Caliskan et al., 2017; Bruckman, 2020; Ovadya and Whittlestone, 2019; Abid et al., 2021). + +Other practices to aid the practitioner in envisioning the possible impacts of their work include: staged system roll-out or prototyping to get ahead of any unforeseen issues before full launch, and performing an impact investigation. Impact investigations are worthwhile, though they are neither simple nor straightforward and there are no clear norms (Prunkl et al., 2021; Partnership on AI, 2021). + +The nature of statistical prediction means careful error handling is of the highest importance, as these systems will never be mistake-free, and in fact NLP systems can have surprising or unanticipated errors. In creating NLP systems, practitioners can ask what can be done to minimize potential negative impacts of errors (Hellman, 2019). At the massive scales at which AI can operate, even a small error rate could affect many people (Sullivan, 2016). + +And, to garner constructive feedback, meaningful transparency measures are important (Diakopoulos, 2016; Mitchell et al., 2019), as are mechanisms for external feedback for model improvement in order to allow the model to be responsive to external events. + +These practices are generally important, but especially-so for the Arab world, as much of MENA is in-conflict, afflicted by ongoing tensions and political violence (Amnesty International, 2020; Johnsen, 2021) that can be amplified by tech- + +nology (Shea and al-Hassani, 2021) or harnessed by violent and/or authoritarian state actors (Human Rights Watch, 2017). + +# Acknowledgements + +This research would not have been possible without the invaluable expert guidance and contributions from colleagues from across the Arabic-speaking world, including Amine Dehimi, Hasan Ali, Hamoud Agha, Fajr Sabouni, Raed Jamil, Anthony Akoury, Sarah Nasr, and Mohammad Zaher. The authors are sincerely grateful for their support. + +The authors would like to further thank Amine Dehimi, Miranda Bogen, Molly FitzMorris, Khalid El-Arini, Edmund Tong, Renata Barreto, Jenny Hong, Jonathan Tannen, and Kate Vredenburg for the insightful conversations and feedback on the paper. Moreover, we would like to acknowledge valuable feedback from several anonymous ARR and ACL reviewers. + +# References + +Abubakar Abid, Maheen Farooqi, and James Zou. 2021. Persistent Anti-Muslim Bias in Large Language Models. In Proceedings of the 2021 AAAI/ACM Conference on AI, Ethics, and Society, AIES '21, page 298-306, New York, NY, USA. Association for Computing Machinery. +Enam Al-Wer and Uri Horesh. 2018. The Routledge Handbook of Arabic Sociolinguistics. Routledge. +Amnesty International. 2020. Human Rights in Middle East and North Africa - Review in 2020. +Chloe Bakalar, Renata Barreto, Stevie Bergman, Miranda Bogen, Bobbie Chern, Sam Corbett-Davies, Melissa Hall, Isabel Kloumann, Michelle Lam, Joaquin Quinonero Candela, Manish Raghavan, Joshua Simons, Jonathan Tannen, Edmund Tong, Kate Vredenburgh, and Jiejing Zhao. 2021. Fairness On The Ground: Applying Algorithmic Fairness Approaches to Production Systems. CoRR, abs/2103.06172. +Solon Barocas, Moritz Hardt, and Arvind Narayanan. 2019. *Fairness and Machine Learning*. fairmlbook.org. http://www.fairmlbook.org. +Solon Barocas and Andrew D. Selfst. 2016. *Big Data's Disparate Impact*. California Law Review, 104(3):671-732. +Emily Bender. 2019. The #BenderRule: On naming the languages we study and why it matters. *The Gradient*. + +Emily M. Bender. 2009. Linguistically Naive != Language Independent: Why NLP Needs Linguistic Typology. In Proceedings of the EACL 2009 Workshop on the Interaction between Linguistics and Computational Linguistics: Virtuous, Vicious or Vacuous?, pages 26-32, Athens, Greece. Association for Computational Linguistics. +Emily M Bender, Timnit Gebru, Angelina McMillan-Major, and Shmargaret Shmitchell. 2021. On the dangers of stochastic parrots: Can language models be too big? Proceedings of FAccT. +Amy Bruckman. 2020. 'Have You Thought About...': Talking About Ethical Implications of Research. Communications of the ACM, 63(9):38-40. +Joy Buolamwini and Timnit Gebru. 2018. Gender shades: Intersectional accuracy disparities in commercial gender classification. In Conference on fairness, accountability and transparency, pages 77-91. +Aylin Caliskan, Joanna J. Bryson, and Arvind Narayanan. 2017. Semantics derived automatically from language corpora contain human-like biases. Science, 356(6334):183-186. +Emily Denton, Alex Hanna, Razvan Amironesei, Andrew Smart, and Hilary Nicole. 2021. On the Genealogy of Machine Learning Datasets: A Critical History of ImageNet. *Big Data & Society*, 8(2):20539517211035955. +Terrance DeVries, Ishan Misra, Changhan Wang, and Laurens van der Maaten. 2019. Does Object Recognition Work for Everyone? CoRR, abs/1906.02659. +Nicholas Diakopoulos. 2016. Accountability in algorithmic decision making. Communications of the ACM, 59(2). +Facebook. 2020. How We Review Content. +Tarleton Gillespie. 2020. Content moderation, AI, and the question of scale. *Big Data & Society*, 7(2):2053951720943234. +Nizar Habash. 2010. Introduction to Arabic Natural Language Processing. In Synthesis Lectures on Human Language Technologies. Morgan and Claypool Publishers. +Alexa Hagerty and Igor Rubinov. 2019. Global AI Ethics: A Review of the Social Impacts and Ethical Implications of Artificial Intelligence. CoRR, abs/1907.07892. +Deborah Hellman. 2019. Measuring Algorithmic Fairness. Criminal Procedure eJournal. +Human Rights Watch. 2017. Arab Gulf States: Assault on Online Activists: Leading Bahraini Rights Activist Sentenced to Two Years in Prison. +Fatemah Husain and Ozlem Uzuner. 2021. A Survey of Offensive Language Detection for the Arabic Language. ACM Trans. Asian Low-Resour. Lang. Inf. Process., 20(1). + +Gregory Johnsen. 2021. The end of Yemen. Brookings. +Donald Martin Jr, Vinodkumar Prabhakaran, Jill Kuhlberg, Andrew Smart, and William Isaac. 2020. Participatory Problem Formulation for Fairer Machine Learning Through Community Based System Dynamics. CoRR, abs/2005.07572. +Gretchen McCulloch. 2019. Because Internet: Understanding the New Rules of Language. Riverhead Books. +Sarah J. Mielke. 2016. Language diversity in ACL 2004 - 2016. +Margaret Mitchell, Simone Wu, Andrew Zaldivar, Parker Barnes, Lucy Vasserman, Ben Hutchinson, Elena Spitzer, Inioluwa Deborah Raji, and Timnit Gebru. 2019. Model cards for model reporting. In Proceedings of the Conference on Fairness, Accountability, and Transparency, FAT* 2019, Atlanta, GA, USA, January 29-31, 2019, pages 220-229. ACM. +Curtis G. Northcutt, Anish Athalye, and Jonas Mueller. 2021. Pervasive Label Errors in Test Sets Destabilize Machine Learning Benchmarks. CoRR, abs/2103.14749. +Aviv Ovadya and Jess Whittlestone. 2019. Reducing malicious use of synthetic media research: Considerations and potential release practices for machine learning. arXiv preprint arXiv:1907.11274. +Partnership on AI. 2021. Managing the risks of ai research: Six recommendations for responsible publication. +Carina Prunkl, Carolyn Ashurst, Markus Anderljung, Helena Webb, Jan Leike, and Allan Dafoe. 2021. Institutionalizing ethics in AI through broader impact requirements. Nature Machine Intelligence. +Sanja Rancic, Sandro Radovanovic, and Boris Delibasic. 2021. Investigating Oversampling Techniques for Fair Machine Learning Models. In Decision Support Systems XI: Decision Support Systems, Analytics and Technologies in Response to Global Crisis Management - 7th International Conference on Decision Support System Technology, ICDSST 2021, Loughborough, UK, May 26-28, 2021, Proceedings, volume 414 of Lecture Notes in Business Information Processing, pages 110-123. Springer. +Nithya Sambasivan, Erin Arnesen, Ben Hutchinson, and Vinodkumar Prabhakaran. 2020. Non-portability of Algorithmic Fairness to India. +Joey Shea and Ruba al-Hassani. 2021. Hate Speech, Social Media and Political Violence in Iraq: Virtual Civil Society and Uphaval. +Clare Sullivan. 2016. Digital citizenship and the right to digital identity under international law. Comput. Law Secur. Rev., 32(3):474-481. +Ryan Suto. 2016. Foreign Policy in Focus. + +Syria Relief. 2021. The Destruction You Can't See: A report into the prevalence of Post Traumatic Stress Disorder (PTSD) symptoms amongst IDPs and refugees from the Syrian conflict. +Eve M. Troutt Powell. 2003. A Different Shade of Colonialism: Egypt, Great Britain, and the Mastery of the Sudan. University of California Press. +James Vincent. 2020. Facebook is now using AI to sort content for quicker moderation. The Verge. \ No newline at end of file diff --git a/towardsresponsiblenaturallanguageannotationforthevarietiesofarabic/images.zip b/towardsresponsiblenaturallanguageannotationforthevarietiesofarabic/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..892ed30ea822ad40115cdf902e37c0088dc8187a --- /dev/null +++ b/towardsresponsiblenaturallanguageannotationforthevarietiesofarabic/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fbff290b90803929a5049c8cd43052b4430d99f67227ef4a17e35c0f10629dad +size 9144 diff --git a/towardsresponsiblenaturallanguageannotationforthevarietiesofarabic/layout.json b/towardsresponsiblenaturallanguageannotationforthevarietiesofarabic/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..5e73e386245d79b084417aad79dc4ba93fcb0dbc --- /dev/null +++ b/towardsresponsiblenaturallanguageannotationforthevarietiesofarabic/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c7afa171c7635acdbc5823875a6d0a6aced8cab16ba46d233283afbcbfaaaf92 +size 223556 diff --git a/towardstransparentinteractivesemanticparsingviastepbystepcorrection/8eb5b0ca-bc45-4c1e-8a7a-769ddc404e7b_content_list.json b/towardstransparentinteractivesemanticparsingviastepbystepcorrection/8eb5b0ca-bc45-4c1e-8a7a-769ddc404e7b_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..4044afe95154c495856907de743ea69f97d57621 --- /dev/null +++ b/towardstransparentinteractivesemanticparsingviastepbystepcorrection/8eb5b0ca-bc45-4c1e-8a7a-769ddc404e7b_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d8c091a0e9ca204d77cabba3fbd1bd02c9acc20235b66c5d6252bd260b948d6a +size 151219 diff --git a/towardstransparentinteractivesemanticparsingviastepbystepcorrection/8eb5b0ca-bc45-4c1e-8a7a-769ddc404e7b_model.json b/towardstransparentinteractivesemanticparsingviastepbystepcorrection/8eb5b0ca-bc45-4c1e-8a7a-769ddc404e7b_model.json new file mode 100644 index 0000000000000000000000000000000000000000..16755e0a6d09a1b8a58b03979f18dde6dd4426e6 --- /dev/null +++ b/towardstransparentinteractivesemanticparsingviastepbystepcorrection/8eb5b0ca-bc45-4c1e-8a7a-769ddc404e7b_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:957a708fa2c9473541b65c6d88e47ab15941fed87a2d4e76654bd02c99b8fdd5 +size 177652 diff --git a/towardstransparentinteractivesemanticparsingviastepbystepcorrection/8eb5b0ca-bc45-4c1e-8a7a-769ddc404e7b_origin.pdf b/towardstransparentinteractivesemanticparsingviastepbystepcorrection/8eb5b0ca-bc45-4c1e-8a7a-769ddc404e7b_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..eca669dcb8e2cfa65feec5d8bf572d377c9d932f --- /dev/null +++ b/towardstransparentinteractivesemanticparsingviastepbystepcorrection/8eb5b0ca-bc45-4c1e-8a7a-769ddc404e7b_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:26b363b4538aefbfe4d3623aec178d590f3f9c926579017b8e57bd8dbecb432e +size 1428091 diff --git a/towardstransparentinteractivesemanticparsingviastepbystepcorrection/full.md b/towardstransparentinteractivesemanticparsingviastepbystepcorrection/full.md new file mode 100644 index 0000000000000000000000000000000000000000..16db12188ed35653d5807fb7898bd1cb0730dbe6 --- /dev/null +++ b/towardstransparentinteractivesemanticparsingviastepbystepcorrection/full.md @@ -0,0 +1,607 @@ +# Towards Transparent Interactive Semantic Parsing via Step-by-Step Correction + +Lingbo Mo, Ashley Lewis, Huan Sun, Michael White + +The Ohio State University + +{mo.169, lewis.2799, sun.397, white.1240}@osu.edu + +# Abstract + +Existing studies on semantic parsing focus on mapping a natural-language utterance to a logical form (LF) in one turn. However, because natural language may contain ambiguity and variability, this is a difficult challenge. In this work, we investigate an interactive semantic parsing framework that explains the predicted LF step by step in natural language and enables the user to make corrections through natural-language feedback for individual steps. We focus on question answering over knowledge bases (KBQA) as an instantiation of our framework, aiming to increase the transparency of the parsing process and help the user trust the final answer. We construct INSPIRED, a crowdsourced dialogue dataset derived from the COMPLEXWEBQUESTIONS dataset. Our experiments show that this framework has the potential to greatly improve overall parse accuracy. Furthermore, we develop a pipeline for dialogue simulation to evaluate our framework w.r.t. a variety of state-of-the-art KBQA models without further crowdsourcing effort. The results demonstrate that our framework promises to be effective across such models.1 + +# 1 Introduction + +Semantic parsing aims to map natural language to formal meaning representations, such as $\lambda$ -DCS, API calls, SQL and SPARQL queries. As seen in previous work (Liang et al., 2013; Yih et al., 2014, 2015; Talmor and Berant, 2018b; Chen et al., 2019; Lan and Jiang, 2020a; Gu et al., 2021), parsers still face major challenges: (1) the accuracy of state-of-the-art parsers is not high enough for real use, given that natural language questions can be ambiguous or highly variable with many possible paraphrases, and (2) it is hard for users to understand the parsing process and validate the results. + +In response to the challenges above, recent work (Li and Jagadish, 2014; He et al., 2016; + +1Our INSPIRED dataset and code are available at https://github.com/molingbo/INSPIRED. + +![](images/bf02aa98ac2cee7b4951564bd47c86d37a7d442c4e5c9fac6c895cee2468a409.jpg) +Figure 1: Example dialogue from our dataset (dubbed INSPIRED). The agent turns (A_i's) illustrate our emphasis on transparency by explaining the predicted logical form step by step in natural language, along with intermediate answers, to the user for feedback. + +Chaurasia and Mooney, 2017; Su et al., 2018; Gur et al., 2018; Yao et al., 2019a; Elgohary et al., 2020) explores interactive semantic parsing, involving human users to give feedback and boost system accuracy. For example, Su et al. (2018) show that fine-grained user interaction greatly improves the usability of natural language interfaces to Web APIs. Yao et al. (2019a) allow their semantic parser to ask users clarification questions when generating an If-Then program. And recently, Elgohary et al. (2020) crowdsources the SPLASH dataset for correcting SQL queries using natural language feedback. + +Compared with these approaches, we aim to enhance the transparency of the parsing process and increase user confidence in the final answer. Figure 1 shows a desired dialogue between user and agent. We design an interactive framework for semantic parse correction that can explain the predicted complex logical form (LF) in a step-by-step manner and enable the user to make corrections to individual steps in natural language. To demonstrate the advantages of our interactive framework, we propose + +![](images/aae1790334ad1122c867bc11a82c83852401f662aa01498c17b5be32620ae1c1.jpg) +Figure 2: Illustration of our interactive semantic parsing framework for KBQA. The box on the top lists a running example. The prefix of a SPARQL query (i.e., LF used for KBQA in this paper) in this example is omitted for brevity. The figure on the bottom shows the entire workflow of our framework using the example above. + +to instantiate it for complex question answering over knowledge bases (KBQA), where interactive semantic parsing has remained largely unexplored. + +Figure 2 illustrates our framework with a concrete example: A base parser predicts an initial parse, which we decompose into sub-LFs and translate to natural-language questions (i.e., Sub-Question Generation). This shows the steps of answering the question, allowing the user to see exactly how a final answer is found and be confident that it is correct or give feedback in natural language to correct the steps. If any user feedback is given, our framework uses it to correct errors in the current parse (i.e., Parse Correction). + +To build models for Sub-Question Generation and Parse Correction, we construct a dataset via crowdsourcing, based on the COMPLEXWEBQUESTIONS (CWQ) dataset (Talmor and Berant, 2018b), which is widely used for complex QA. To make LFs understandable to crowdworkers, we translate each sub-LF into a templated sub-question using a rule-based method. During crowdsourcing, workers paraphrase the templated question into a natural one. We create a dialogue for each complex question, an example of which is shown in Figure 1. Our dataset, dubbed INSPIRED (INteractive Semantic Parsing for CorREction + +with Decomposition), will facilitate further exploration of interactive semantic parsing for KBQA. + +Our main contributions are as follows: (1) We design a more transparent interactive semantic parsing framework that explains to a user how a complex question is answered step by step and enables them to make corrections in natural language and trust the final answer. (2) To support research on interactive semantic parsing for KBQA, we release a high-quality dialogue dataset using our framework. (3) We establish baseline models for two core subtasks in this framework: Sub-Question Generation and Parse Correction. (4) Although INSPIRED is constructed using a selected base parser, we are able to train models to simulate user feedback, allowing us to study the promise of our framework to correct errors made by other semantic parsers without more annotation effort. With these contributions, we hope to inspire many directions of future work, which we discuss in the end. + +# 2 Dataset Construction + +In this section, we describe the workflow for dataset construction following the design of our framework (Figure 2). We prepare pairs of complex questions and SPARQL parses predicted by a base semantic parser (Section 2.1.1). Then, we decompose the + +gold and predicted parses and determine correction operations (Section 2.1.2). The sub-LFs are translated to questions using templates (Section 2.1.3) and we employ crowdworkers to paraphrase these questions using natural language (Section 2.2). + +# 2.1 Dialogue Preparation for Crowdsourcing + +# 2.1.1 Preparing Questions and SPARQL + +We start with the COMPLEXWEBQUESTIONS 1.1 (CWQ) dataset (Talmor and Berant, 2018a,b), which contains complex questions paired with gold SPARQL queries for Freebase (Bollacker et al., 2008). We adopt a transformer-based seq2seq model (Vaswani et al., 2017) as the base semantic parser to prepare a predicted SPARQL query for each complex question (see the second and third paragraphs in Section 4 for our rationale). + +As a simplifying assumption, we take gold named entities mentioned in a question as given. Specifically, we replace named entities in a SPARQL query with special tokens such as #entityX#, where X is a number corresponding to the order in which the entity appears. After parsing, we replace these tokens with the gold entities. The challenge of addressing errors caused by named entity recognition and linking in a real KBQA system is left as an important piece of future work. + +In order to reduce data collection cost, we select a subset of questions in the training data of CWQ to create dialogues in INSPIRED's training set. We conduct an analysis of repeated predicates and question types, and ensure that each predicate occurs at least three times in INSPIRED's training set when possible. We include every question where the base parser makes an error and ensure coverage of the four multi-hop reasoning types (Talmor and Berant, 2018b). Different reasoning types require different translation strategies in order to represent their logical forms in English (see Section 2.1.3 and Appendix A.3). We create 10,374 dialogues in total, based on 3,492 questions from the training set, 3,441 from the validation set, and 3,441 from the test set of CWQ. We omit a small set of questions from the original validation and test sets that are consistently confusing to crowdworkers. Table 1 shows a breakdown of the CWQ question types in the INSPIRED dataset, along with the average number of corrections and sub-questions. + +# 2.1.2 Logical Form Decomposition + +An important goal of creating INSPIRED is to make the process of question answering transparent + +
Number ofTrainDevTestOverall
Complex Questions3,4923,4413,44110,374
- Composition1,1961,5321,4904,218
- Conjunction1,7961,5031,5534,852
- Comparative253217207677
- Superlative247189191627
Predicted Sub-Questions1.72.01.91.9
Gold Sub-Questions2.22.12.12.1
Range of the number of predicted sub-questions0 - 5
Range of the number of gold sub-questions2 - 4
Average number of edits1.4
Dialogues with 0 edits5,016
+ +Table 1: Statistics for our INSPIRED dataset: the number of complex questions for each reasoning type, the average number of sub-questions and edit operations in a dialogue (excluding those that do not have edits). + +to the user. Each dialogue features a decomposition process by which our framework transforms the complex question into an initial parse, breaks it into sub-LFs, retrieves answers, and presents this whole process to the user for correction. The overarching strategy of the decomposition process is to identify the predicates that express distinct components in the LF of the complex question, which correspond to individual sub-questions. Typically, these components appear as a triple in the logical form such as $Sub - LF_{1}$ in Figure 2, which is comprised of a head entity, a predicate, and a tail entity. Logical forms in CWQ typically contain two or three of these components. There can be multiple predicates that group together to express one component, for example those connected by a $CVT^{2}$ (Compound Value Type) node, in which case the two predicates and their two entities will form one component. Within these, there can be filters and/or restrictions, which provide additional information about entities of the main predicate and are typically merged to the corresponding component. Details about how we deal with these logical form components are in Appendix A.3.1 and more concrete examples about decomposition are shown in Table 12. + +Using this strategy, we decompose both the parser's predicted SPARQL query and the gold one into sub-LFs, and compare those sub-LFs to determine the sequence of operations needed to transform the predicted parse into the gold parse, including inserting, deleting, or replacing a sub-LF, which is to be paraphrased by crowdworkers (Section 2.2) based on our templated sub-question. These operations determine the "correction" steps in each + +dialogue, where the agent asks the user if any corrections are needed (Figure 1, turn A1), and the user either confirms that the initial parse is correct or provides corrections (turn U2). Though any new sub-questions that are introduced use natural and varied language, the correction operations are given using templates (i.e., replace question #X with Y, delete question #X, insert question Y). More details about how dialogues are formed around complex questions can be found in Appendix A.1. + +# 2.1.3 Explaining SPARQL + +We develop a strategy for how to represent the sub-SPARQL queries in a form that crowdworkers can understand after decomposition, for which we create a template corpus and a rule-based translation method to do so. The corpus consists of 772 different predicates that appear in the CWQ dataset and translations of each into a basic template that conveys the content. More details about the translation of LFs with different reasoning types into sub-questions are found in Appendix A.2 and A.3. + +# 2.2 Crowdsourcing + +To make queries understandable for an average user, as in Figure 1, we translate the decomposed LFs into English questions using templates as mentioned in Section 2.1.3. To obtain natural sounding questions, we conduct crowdsourcing on Amazon Mechanical Turk (AMT), in which crowdworkers are employed to rephrase sub-questions from the clunky, templated form into more concise and natural English in the context of a dialogue. The task is conducted using ParlAI (Miller et al., 2017), which allows us to set up a versatile dialogue interface. + +In each dialogue, every turn of the interlocutors has prescribed content. A total of 14 crowdworkers are employed to express the content in natural language and complete a maximum of 1,800 dialogues. Because the crowdsourcing task for this dataset requires extensive, detailed instructions, we design the task quite carefully with multiple stages of checkpoints to ensure quality of data collection. An overview of these phases can be seen in Table 2 and other details are presented in Appendix A.4. We recruit and retain a small set of exemplary workers for this task (see item 4 in General Principles in Table 2). This phased strategy, while requiring more effort, proves to be effective in ensuring overall data quality which will be shown in Section 3. + +# Phased Crowdsourcing Protocol + +# Phase 1: Tutorial + +1. Worker reads examples and explanations of the task. + +2. Worker receives specific instructions for how to rephrase questions of different types. + +# Phase II: Qualification Quiz + +1. Worker completes an 8-question multiple choice quiz. Quiz questions are based on the tutorial content. + +2. Worker must achieve at least 7 out of 8 to pass. They may take the quiz more than once, but there is a ten minute wait period between attempts. + +# Phase III: Trial Period + +1. Worker completes 10 predetermined tasks which were chosen as representative examples for all the tasks. + +2. Tasks are manually graded. If the work is overall good, the worker receives specific feedback on anything that was done incorrectly. + +3. If quality is not good, worker is eliminated. + +4. Workers get paid the regular rate for each task and upon completing the 10 tasks, receive a bonus for the time spent on the tutorial and qualification quiz. + +# Phase IV: Batches of Tasks + +1. Worker is given access to a batch of 100 tasks, which are spot-checked for quality. A bonus is given as the worker passes each set of 100 tasks. + +2. If quality is good, workers are given a second batch of 100 questions, also spot checked. + +3. Batch size increases based on worker quality and speed. + +4. Worker completes up to 1800 tasks. + +# General Principles + +1. Prompt feedback, payment, and release of new batches +2. Provide a link to the tutorial so that it can be accessed at any time. +3. Higher than average payment. +4. Keep pool of workers small for better communication and quality control. +5. Verify that workers are native English speakers. + +Table 2: The phased crowdsourcing protocol for our Amazon Mechanical Turk task. + +# 3 Dataset Analysis + +In this section, we conduct a thorough quality analysis of INSPIRED dataset and highlight aspects that contribute to overall quality, including paraphrasing characteristics and contextual awareness. + +Overall Data Quality. In each dialogue, the crowdworker is required to rephrase the original complex question and each templated sub-question. Overall, we believe the quality of the data to be high for a few reasons. In the collection process, our crowdworkers read a detailed tutorial, pass two qualification tasks, and have their work spotted checked at each stage of collection. Because we keep our pool of workers small, we are able to maintain frequent communication with them throughout the process, giving feedback in an ongoing fashion. + +Furthermore, we use a semi-automatic data cleaning method to identify inaccurate paraphrases for manual repair, resulting in edits to 325 sub-questions in total. Based on our observation on a held-out subset of the data, we estimate that only $3.1\%$ of all sub-questions still have inaccuracies, after cleaning. More details are in Appendix B.1. + +Paraphrasing Characteristics. Table 3 shows the difference between the vocabularies (unique words) of all the templates in INSPIRED and the rephrased versions of sub-questions, which are calculated using GEM evaluation scripts (Gehrmann et al., 2021). Further, the mean length of the tem-. plated questions is 17.3 words, while the mean + +
Template CorpusRephrased Corpus
Avg Length17.310.7
Unigrams8,4659,864
Bigrams21,07244,085
Trigrams31,83881,479
+ +length of the rephrased questions is 10.7 words. These comparisons demonstrate that the rephrased questions show much more diversity in phrasings and lexical choices, but are also more concise. More GEM metrics can be seen in Appendix B.2. + +In order to better understand how crowdworkers rephrased templates, 100 randomly selected subquestions are studied in terms of lexical relationships between the template and rephrased versions. We find that they are using synonymy, hyphenmy and hyponymy in rephrasings of the templates, in addition to changing word order. This analysis can be found in Appendix B.3. + +Contextual Awareness. Additionally, crowd-workers are encouraged to incorporate contextual information of a given sub-question into their rephrasings, thus improving the contextual richness of the dataset. In order to demonstrate contextual awareness, Table 4 shows the average ROUGE-1 and ROUGE-2 scores of all sub-questions in their actual contexts (the complex question and any preceding sub-questions), in comparison to the same sub-questions in a randomly assigned context that utilizes the same sub-logical form. Entities are masked with #entity# tokens to prevent the actual context from being advantaged by overlap in entity names. The higher scores for the actual context indicate that the wording of sub-questions reflect the context from which they are derived. + +In general, it is natural for human users to consider the context when making utterances in a dialogue. From the perspective of model development, providing contextual information enriches the input by providing relevant information that may not be present in a given sub-question or sub-LF. We provide concrete examples and analysis to show the effect of context dependency in Table 16 in Appendix B.4. Moreover, experiments considering different contexts in Section 4 further validate the impact of context dependence on parse correction and sub-question generation performance. + +Table 3: Comparison of average length (in words) of. +templated and rephrased questions as well as the size of +vocabulary for 1-, 2-, and 3-grams across all templates +and rephrased questions, demonstrating the increased +diversity of rephrased questions. + +
ROUGE-1ROUGE-2
Random Context22.83.4
Actual Context27.76.2
+ +Table 4: Comparison of the n-gram overlap between the paraphrase and the context for a sub-LF vs. other randomly chosen context for the same sub-LF. + +
ModelsEMF1
*Transformer (Vaswani et al., 2017)52.358.6
BART-large (Lewis et al., 2020)60.965.8
QGG (Lan and Jiang, 2020b)-49.0
+ +Table 5: Performance of different semantic parsers on CWQ test set. The asterisk (*) denotes the initial semantic parser we choose for constructing INSPIRED. + +# 4 Experiments + +In this section, we explore several base semantic parsers and show how we choose one as the initial parser to construct INSPIRED. Then, we conduct extensive experiments on those two core sub-tasks (i.e., sub-question generation and parse correction) in our framework. Finally, in order to study the promise of our framework for other parsers (beyond the one used to construct INSPIRED) without introducing extra crowdsourcing effort, we simulate dialogues based on our trained models for sub-question generation and parse correction. We train all models on 4 GTX 1080 Ti 11 GB GPUs. + +Firstly, we explore Transformer (Vaswani et al., 2017), BART-large (Lewis et al., 2020) and QGG (Lan and Jiang, 2020b) as base parsers. In the official leaderboard3 of CWQ, QGG is the best-performing method in the line of query graph generation approaches. Models like $\mathrm{NSM + h}$ (He et al., 2021) and PullNet (Sun et al., 2019) directly output final answers without LFs, which cannot be made more transparent or interactive with our framework. CBR-KBQA (Das et al., 2021) is the SOTA model on this dataset as of the submission time, but as its code is not available, we choose Transformer and BART-large as the two candidate parsers. We input the complex question to these two seq2seq models and output the LF. Since entities are masked in the LFs for these models, we provide QGG with gold entities for fair comparison. We report their LF exact match (EM) and F1 scores in Table 5. + +We finally select Transformer as the initial parser + +because it is neither state-of-the-art nor has overly poor performance. As the intention is to create a dataset that represents a wide range of parsing errors and correction strategies, a "middle-of-the-road" parser is best for achieving good coverage but also being of decent quality. We report the characteristics of errors made by Transformer in Appendix B.5. We will explore the other two models in Table 5 through simulation (Section 4.3). + +In the following two sections, we explore two sub-tasks under our framework. We treat both of them as seq2seq tasks, then present and evaluate several baseline models including Seq2Seq (Sutskever et al., 2014), Transformer (Vaswani et al., 2017), BART-base and BART-large (Lewis et al., 2020) for each task, in which we use INSPIRED for training and testing. After that, we conduct error analysis for both sub-tasks by examining 100 examples respectively. Details of the analysis are in Appendix C. + +# 4.1 Parse Correction with NL Feedback + +Given a sub-question $q$ , the parse correction task is to convert it into a new sub-LF $p$ . By parsing the templates used by correction operations as mentioned in Section 2.1.2, we extract the operation (i.e., replace, delete, or insert a sub-question) and apply it to the appropriate step. Then, sub-LFs are compiled accordingly to form a correction parse $P$ for the entire question. We predict the sub-LF based on $q$ without considering contexts, and present the results of several baselines in Table 6. We report both the turn-level accuracy—the accuracy of sub-LFs in correction turns—and the dialog-level accuracy—the end-to-end accuracy of the entire LFs after correction—on our test set. + +Since models like BART adopt a subword tokenization scheme, the validity of predicates generated by concatenating subwords can not always be guaranteed. We use beam search of size 10 to generate LFs as candidates, filtering those with invalid predicates and excluding erroneous predictions previously made by the parser. We additionally compare with a baseline named 2nd-Beam, which applies beam search on the base parser to obtain two initial parses and uses the second for parse correction. It has some performance gains over the setting without correction, but is much lower than those settings with human feedback. Results in Table 6 further suggest: (1) incorporating human feedback can substantially improve the parse ac + +
Correction ModelsTurn-level EMDialog-level EM
w/o Correction-52.3
2nd-Beam-55.8
Seq2Seq(LSTM)78.965.0
Transformer81.268.0
BART-base82.370.3
BART-large82.971.3
+ +Table 6: Turn-level and Dialogue-level accuracy of different models after incorporating feedback (where applicable). + +
ContextDialog-level EMTurn-1 (3441)Turn-2 (3441)Turn-3 (345)Turn-4 (56)
w/o Correction52.3----
BART-large
w/o Context71.384.681.585.553.6
+ hq72.284.782.289.3100.0
+ hf72.084.382.189.3100.0
+ hq & hf73.586.483.291.0100.0
+ +Table 7: Parse correction performance when considering different contexts. $h_{lf}$ and $h_q$ denote the dialogue history of sub-LFs and sub-questions respectively. + +curacy and (2) using BART-large with pretraining as the correction model achieves the best performance, achieving 19.0 points higher than the initial parser in terms of the dialog-level EM score. + +Then, using BART-large as the correction model, we further study the correction process by concatenating different contexts to the input, including the history of sub-questions $h_q$ and sub-LFs $h_{lf}$ . We report both the accuracy for each turn of correction and the end-to-end accuracy. As shown in Table 7, we find that: (1) Adding contexts into the input can further improve the correction accuracy. (2) As the number of turns goes up, context contributes more to the correction process, which indicates that including the full dialogue history in the input leads to the best results. (3) The BART-large model with inputs that leverage $h_q$ and $h_{lf}$ achieves the best performance, with a 21.2 increase under dialog-level EM compared to the initial parser. + +# 4.2 Sub-Question Generation + +Sub-question generation aims to translate a sub-LF $p$ into a natural sub-question $q$ . Table 8 lists generation performance from five baselines without considering contexts. We explore an off-the-shelf paraphrasing model, which takes corresponding templated sub-question $q^t$ as the input and outputs $q$ . It is fine-tuned on BART-large using three paraphrasing datasets including Quora, PAWS (Zhang et al., 2019) and MSR paraphrase corpus (Dolan + +
Generation ModelsBLEU-2BLEU-4BERTScore
BART-paraphrase10.62.788.0
Seq2Seq(LSTM)17.86.490.8
Seq2Seq(LSTM)t18.76.791.3
Transformer21.18.491.7
\( Transformer^t \)23.49.192.6
BART-base30.715.093.8
BART-base \( ^t \)32.015.994.1
BART-large31.515.494.0
BART-large \( ^t \)32.416.294.2
+ +Table 8: Question generation performance of different models. $t$ denotes that the input incorporates templated sub-question, as well as the current sub-logical form. + +
ContextBLEU-2BLEU-4BERTScore
BART-larget
w/o Context32.416.294.2
+ hqt33.316.594.6
+ Q33.416.694.6
+ Q & hqt34.117.194.8
+ +and Brockett, 2005). The low scores demonstrate that sub-question generation is more challenging than a simple paraphrasing task. For the other models, we explore two scenarios with different inputs: (1) sub-LF $p$ only and (2) a concatenation of $p$ and $q^t$ . We report BLEU scores based on n-grams overlap and BERTScores measuring semantic similarity. The results in Table 8 suggest that: (1) Using BART-large as the generation model achieves the best performance and (2) incorporating the tem-. plated sub-questions into the model input can improve performance on all baselines, which makes sense because some tokens in $q^{t}$ can be directly copied into the output question. + +Furthermore, we use the best-performing model (i.e. BART-large with both $p$ and $q^t$ as the input) in Table 8 as the basic setting to explore the modeling of different contexts including the complex question $Q$ and the history of templated sub-questions $h_{q^t}$ . As shown in Table 9, we find that (1) adding context into the model's input can obtain higher metric scores, which suggests that context can help in a dialogue. (2) Those settings that incorporate the original complex question $Q$ generally perform better than the others, since the complex question contains the semantics of the sub-question to be generated. (3) BART-large with the input containing both $Q$ and the history of templated sub-questions achieves the best performance. We also tried incorporating the history of sub-LFs $h_{lf}$ , but it does not help further improve the performance. + +Table 9: Comparison of question generation performance when considering different contexts in the input. + +
BART-largeQGG
EM60.9-
EM*75.1-
F165.849.0
F1*75.756.5
+ +
AttemptEMF1
BART-large
175.175.7
278.779.9
379.080.1
+ +Table 10: The left table shows the performance of two types of semantic parsers after correction through simulation process, BART-large and QGG. * denotes results after correction. The right table shows BART-large's performance after multiple attempts of correction. + +Because automatic metrics like BLEU scores do not necessarily paint a full picture of the model performance, we manually check 100 generated questions. They are indeed of high quality and semantically similar to the human-written ones; see details in the second part of Appendix C. + +# 4.3 Simulation + +In this section, we demonstrate that our framework can pair with other KBQA parsers and use simulated user feedback to correct their errors. To simulate a dialogue, we develop a pipeline: (1) Automatically translate a parser's predicted LFs into natural questions using the sub-question generation model equipped with the best-performing setting in Table 9. (2) Use oracle error detection and train a generator to simulate a human user's corrections for these dialogues. This generator is a BART-large model that leverages the complex question and templated sub-questions as input to generate human feedback. (3) Correct erroneous parses using the previously trained parse correction model under the best-performing setting in Table 7. + +We conduct simulation experiments on BART-large (Lewis et al., 2020) and QGG (Lan and Jiang, 2020b) respectively from two mainstream methodologies for KBQA as mentioned. We report both F1 and EM for BART-large before and after the correction process using the simulation pipeline. For QGG, since its generated query graphs do not take exactly the same format as SPARQL queries, we report F1 score only. As shown in the left part of Table 10, BART-large achieves a 14.2 EM and 9.9 F1 score gain after correction. Meanwhile, the correction process brings 7.5 F1 score improvement for QGG. The results show that INSPIRED can help train effective sub-question generation and parse correction models, which makes our framework applicable to KBQA parsers beyond the one used for constructing INSPIRED. Simulating user feedback makes it easy and far less costly to understand the potential of any base parser (as long as it + +outputs LFs) under our framework. + +Moreover, we expand the simulation experiment to include multiple attempts of correction to simulate situations in which the model does not repair the parse correctly on the first attempt. We use the same human feedback generator to decode several of the highest scoring sequences as candidates for different attempts at correction. We evaluate this strategy after a maximum of three attempts. + +Given that sequences decoded by plain beam search (Sutskever et al., 2014) often differ only slightly from each other, we adopt diverse beam search (Vijayakumar et al., 2018) instead to decode more diverse feedback. As shown in the right part of Table 10, F1 scores are up to 80.1 after three attempts of correction. We expect CBR-KBQA (the SOTA model mentioned earlier) to do even better given the advantages it has over plain seq2seq models. For example, their retrieval module can alleviate errors caused by sparse predicates. We envision the combination of our framework and theirs as interesting future work. + +# 5 Related Work + +Conversational Semantic Parsing. Conversational semantic parsing (CSP) is the task of converting a sequence of natural language utterances into LFs through conversational interactions. It has been studied in task-oriented dialogues, question answering and text-to-SQL. In task-oriented systems, datasets like MWoZ (Budzianowski et al., 2018; Eric et al., 2020) and SMCalFlow (Andreas et al., 2020) help users with a specific task (e.g., booking a hotel). CSQA (Saha et al., 2018) and CoQA (Reddy et al., 2019) are built for conversational systems to answer inter-related, simple questions. Meanwhile, ATIS (Hemphill et al., 1990; Dahl et al., 1994), SPARC (Yu et al., 2019) and CoSQL (Yu et al., 2020) are constructed for conversational text-to-SQL tasks. Our work shares a similar objective, i.e., how to represent natural language utterances while considering the multi-turn dynamics of the dialogue. We differ from them in that our task aims at soliciting and applying human feedback to correct generated initial parses. + +Interactive Semantic Parsing. Multiple works have studied involving human feedback in the parsing process. Gur et al. (2018) ask multiple choice questions about a limited set of predefined errors. Yao et al. (2019b) ask yes/no questions about the presence of SQL components when generating one + +component at a time. Elgohary et al. (2020) introduce SPLASH, a dataset for correcting parses in text-to-SQL with free-form natural language feedback. They observe that most mistakes made by neural text-to-SQL parsers are minor, which correspond to editing a schema item (table or column name), a SQL keyword, etc. They can thus be resolved by simply editing a single token or two. Corrections in SPLASH are given in one turn and applied to the entire initial parse. Elgohary et al. (2021) convert feedback in SPLASH into a canonical form of edits that are deterministically applied. + +In contrast, we find that parse errors in KBQA are more challenging to resolve. KB relations like 'location.country.capital' need to be correctly identified among thousands of candidates, while the table schema in Elgohary et al. (2020) usually contains only a few table/column names. To make error correction easier in this setting, we break down the parse into a sequence of sub-components and enable the user to provide step-by-step feedback, thereby simplifying the task of parse correction and increasing the likelihood of an accurate parse. + +Question Decomposition. Question decomposition has been successfully used in complex QA. Iyyer et al. (2016) propose to answer questions based on tables by decomposing them into interrelated simple questions. Talmor and Berant (2018b) and Min et al. (2019) train a model directly to produce sub-questions using question spans. Recent works (Wang et al., 2020b; Wolfson et al., 2020) introduce explicit annotation for the decomposition of multi-hop questions into a series of atomic operations. Wolfson et al. (2020) construct the BREAK dataset and propose QDMR, where questions are decomposed into a series of simpler atomic textual steps. QDMR is an intermediate representation of natural language and LFs, and is not executable on knowledge bases. In our work, we decompose the LF of the complex question into sub-components, which can be directly executed on the KB to retrieve answers. Moreover, we use decomposition to correct the initial parse at a finer-grained level. + +# 6 Discussion and Future Work + +We are planning to conduct a user study to validate our framework's viability for real use. In this study, human users will utilize the framework to correct parsing errors and query a knowledge base for answers in real time. As shown in Figure 3, users + +# Agent: + +Here's how I understood your question: + +1. In what nation can you find the Al Sharqia Governorate? +2. What is the capital of the above-named nation? + +Are the above sub-questions accurate in relation to the Target Question? + +![](images/6bcc08d88481da8a44865f59f7311a0953520a04d1d126171aea7a9b2e76f803.jpg) +Figure 3: User study interface. In addition to inserting/deleting/replacing sub-questions, we provide a new operation 'edit' to support minor changes, where the original sub-question is auto-filled into the response box after the user makes the selection. In this example, the user only needs to change capital into official language. + +Yes + +![](images/7f7ca4b442d549b5fc4e46fda615c5f616cd24e00c70bd32f5ced26a4196b45e.jpg) + +Would you like to insert, delete, replace, or edit a sub-question? + +![](images/8d53a9f2773a7ff0dfe43a6fde944e34695f6b6f2b27021e1c9163e37e5d3e53.jpg) + +Insert + +![](images/41a6318285edd5832226f9e8139b5a2f7e8c509718261021127a3fc43c0ed1de.jpg) + +elete + +![](images/cb27927d8c3a4f016f915b216154554b6706e1b42829bcc568d46eeb20169850.jpg) + +lace + +![](images/9d9d4fdcdbdae26bc954aedbb8026fe2ba26a4da22963362df452fb799d01159.jpg) + +![](images/e911b898cd82ff90f96e04422089c680f7d9a094de45100bcb1c7ba44f4e45a7.jpg) + +1. In what nation can you find the Al Sharqia Governorate? +2. What is the capital of the above-named nation? + +What is the official language of the above-named nation? + +Send + +can specify edit operations in a couple clicks, then type in the response box to insert, replace or edit a sub-question. Note that we add a new 'edit' operation to make it easier for users to enter replacement sub-questions that require only small edits. + +While we acknowledge that in a spoken dialogue system, pure natural language feedback may be the most natural, such a system may also suffer from errors caused by automatic speech recognition (ASR) (Wang et al., 2020a; Chang et al., 2021). By contrast, our interface design allows the user to partially specify feedback operations through mouse clicks, which can help mitigate this issue. To evaluate the system, we will use parse accuracy after correction to verify the usefulness of human feedback. We will also use survey questions to measure the subjective quality of the generated explanations, intermediate and final answers, accessibility of the system, etc. + +In this work, the INSPIRED dataset and experiments provide a foundation for many directions of future work. For example, this could take the shape of gains in parse accuracy as well as improvements to the correction strategy through decomposition. The simulation pipeline provided can also be used for further experimentation. Other complementary work could include handling errors introduced by named entity recognition and linking. Lastly, ap + +plying our framework to other query languages like SQL could be an exciting direction. + +# 7 Conclusion + +We have proposed an interactive semantic parsing framework and instantiated it with KBQA in this work. Using this framework, we crowdsourced a novel dataset, dubbed INSPIRED, and experimentally showed that it can greatly increase the parse accuracy of an initial parser. Moreover, we designed a simulation pipeline to explore the potential of our framework for a variety of semantic parsers, without further annotation effort. The performance improvement shows interactive semantic parsing is promising for further improving KBQA in general. + +# 8 Ethical Considerations + +IRB Approval. Prior to collection of the INSPIRED dataset, we obtain IRB (Institutional Review Board) approval at our institution. This data collection is considered Exempt Research, meaning that our human subjects are presented with no greater than minimal risk by their participation. Participants' personal information is not collected, aside from minimal demographic information including their native language, which is used to ensure native-speaker level proficiency in the dataset. + +No identifying information is included. Further, all participants are required to read and agree to an informed consent form before proceeding with the task. AMT automatically anonymizes crowdworkers' identities as well. + +Compensation to Crowdworkers. In order to ensure both quality data collection and fair treatment of our coworkers, we carefully review our payment plan for the AMT task. After a pilot study we gauge the average amount of time we expect a task to require and adjust the payment amount per task according to the minimum wage amount in our state, resulting in a 70 cent payment per task. Further, we ensure compensation for the time spent on the tutorial and qualification task by awarding $10 bonuses after completion of their first 10 tasks. They also receive $10 bonuses upon every 100 tasks they complete. In total, the cost of creating the INSPIRED dataset is approximately $13,300. + +# Acknowledgments + +We thank the Clippers and Pragmatics groups at OSU for helpful discussion. We also thank Yu Su, Xiang Deng, Luke Song and Vardaan Pahuja for their valuable feedback. This research was partially supported by a collaborative open science research agreement between Facebook and The Ohio State University. MW has been a paid consultant for Facebook during the period of research. HS was partly supported by NSF IIS-1815674 and NSF CAREER #1942980. + +# References + +Jacob Andreas, John Bufe, David Burkett, Charles Chen, Josh Clausman, Jean Crawford, Kate Crim, Jordan DeLoach, Leah Dorner, Jason Eisner, et al. 2020. Task-oriented dialogue as dataflow synthesis. Transactions of the Association for Computational Linguistics, 8:556-571. +Gabor Angeli, Percy Liang, and Dan Klein. 2010. A simple domain-independent probabilistic approach to generation. In Proceedings of the 2010 Conference on Empirical Methods in Natural Language Processing, pages 502-512. +Kurt Bollacker, Colin Evans, Praveen Paritosh, Tim Sturge, and Jamie Taylor. 2008. Freebase: a collaboratively created graph database for structuring human knowledge. In Proceedings of the 2008 ACM SIGMOD international conference on Management of data, pages 1247-1250. +Paweł Budzianowski, Tsung-Hsien Wen, Bo-Hsiang Tseng, Iñigo Casanueva, Stefan Ultes, Osman Ra + +madan, and Milica Gasic. 2018. Multiwoz-a large-scale multi-domain wizard-of-oz dataset for task-oriented dialogue modelling. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 5016-5026. +Feng-Ju Chang, Martin Radfar, Athanasios Mouchtaris, and Maurizio Omologo. 2021. Multi-Channel Transformer Transducer for Speech Recognition. In Proc. Interspeech 2021, pages 296-300. +Shobhit Chaurasia and Raymond Mooney. 2017. Dialog for language to code. In Proceedings of the Eighth International Joint Conference on Natural Language Processing (Volume 2: Short Papers), pages 175-180. +Zi-Yuan Chen, Chih-Hung Chang, Yi-Pei Chen, Jijnasa Nayak, and Lun-Wei Ku. 2019. Uhop: An unrestricted-hop relation extraction framework for knowledge-based question answering. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 345-356. +Deborah A. Dahl, Madeleine Bates, Michael Brown, William Fisher, Kate Hunicke-Smith, David Pallett, Christine Pao, Alexander Rudnicky, and Elizabeth Shriberg. 1994. Expanding the scope of the ATIS task: The ATIS-3 corpus. In Human Language Technology: Proceedings of a Workshop held at Plainsboro, New Jersey, March 8-11, 1994. +Rajarshi Das, Manzil Zaheer, Dung Thai, Ameya Godbole, Ethan Perez, Jay Yoon Lee, Lizhen Tan, Lazaros Polymenakos, and Andrew McCallum. 2021. Case-based reasoning for natural language queries over knowledge bases. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 9594-9611, Online and Punta Cana, Dominican Republic. Association for Computational Linguistics. +William B Dolan and Chris Brockett. 2005. Automatically constructing a corpus of sentential paraphrases. In Proceedings of the Third International Workshop on Paraphrasing (IWP2005). +Ahmed Elgohary, Ahmed Hassan Awadallah, et al. 2020. Speak to your parser: Interactive text-to-sql with natural language feedback. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 2065-2077. +Ahmed Elgohary, Christopher Meek, Matthew Richardson, Adam Fourney, Gonzalo Ramos, and Ahmed Hassan Awadallah. 2021. NL-EDIT: Correcting semantic parse errors through natural language interaction. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 5599–5610, Online. Association for Computational Linguistics. + +Mihail Eric, Rahul Goel, Shachi Paul, Abhishek Sethi, Sanchit Agarwal, Shuyang Gao, Adarsh Kumar, Anuj Goyal, Peter Ku, and Dilek Hakkani-Tur. 2020. Multiwoz 2.1: A consolidated multi-domain dialogue dataset with state corrections and state tracking baselines. In Proceedings of the 12th Language Resources and Evaluation Conference, pages 422-428. +Sebastian Gehrmann, Tosin P Adewumi, Karmanya Aggarwal, Pawan Sasanka Ammanamanchi, Aremu Anuoluwapo, Antoine Bosselut, Khyathi Raghavi Chandu, Miruna-Adriana Clinciu, Dipanjan Das, Kaustubh D Dhole, et al. 2021. The gem benchmark: Natural language generation, its evaluation and metrics. +Yu Gu, Sue Kase, Michelle Vanni, Brian Sadler, Percy Liang, Xifeng Yan, and Yu Su. 2021. Beyond iid: three levels of generalization for question answering on knowledge bases. In Proceedings of the Web Conference 2021, pages 3477-3488. +Izzeddin Gur, Semih Yavuz, Yu Su, and Xifeng Yan. 2018. Dialsql: Dialogue based structured query generation. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1339-1349. +Gaole He, Yunshi Lan, Jing Jiang, Wayne Xin Zhao, and Ji-Rong Wen. 2021. Improving multi-hop knowledge base question answering by learning intermediate supervision signals. In Proceedings of the 14th ACM International Conference on Web Search and Data Mining, pages 553-561. +Luheng He, Julian Michael, Mike Lewis, and Luke Zettlemoyer. 2016. Human-in-the-loop parsing. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 2337-2342. +Charles T Hemphill, John J Godfrey, and George R Doddington. 1990. The atis spoken language systems pilot corpus. In Speech and Natural Language: Proceedings of a Workshop Held at Hidden Valley, Pennsylvania, June 24-27, 1990. +Mohit Iyyer, Wen-tau Yih, and Ming-Wei Chang. 2016. Answering complicated question intents expressed in decomposed question sequences. arXiv preprint arXiv:1611.01242. +Ravikumar Kondadadi, Blake Howald, and Frank Schilder. 2013. A statistical nlg framework for aggregated planning and realization. In Proceedings of the 51st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1406-1415. +K. Kukich. 1983. Design of a knowledge-based report generator. In ACL. +Yunshi Lan and Jing Jiang. 2020a. Query graph generation for answering multi-hop complex questions from knowledge bases. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 969-974. + +Yunshi Lan and Jing Jiang. 2020b. Query graph generation for answering multi-hop complex questions from knowledge bases. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics (ACL). +Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. 2020. Bart: Denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 7871-7880. +Fei Li and HV Jagadish. 2014. Constructing an interactive natural language interface for relational databases. Proceedings of the VLDB Endowment, 8(1):73-84. +Percy Liang, Michael I Jordan, and Dan Klein. 2013. Learning dependency-based compositional semantics. Computational Linguistics, 39(2):389-446. +Kathleen R McKeown. 1985. Discourse strategies for generating natural-language text. Artificial intelligence, 27(1):1-41. +Susan W McRoy, Songsak Channarukul, and Syed S Ali. 2000. Yag: A template-based generator for real-time systems. In INLG'2000 Proceedings of the First International Conference on Natural Language Generation, pages 264-267. +Alexander Miller, Will Feng, Dhruv Batra, Antoine Bordes, Adam Fisch, Jiasen Lu, Devi Parikh, and Jason Weston. 2017. Parlai: A dialog research software platform. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 79-84. +Sewon Min, Victor Zhong, Luke Zettlemoyer, and Hannaneh Hajishirzi. 2019. Multi-hop reading comprehension through question decomposition and rescoring. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 6097-6109. +Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. 2020. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research, 21:1-67. +Siva Reddy, Danqi Chen, and Christopher D Manning. 2019. Coqa: A conversational question answering challenge. Transactions of the Association for Computational Linguistics, 7:249-266. +Amrita Saha, Vardaan Pahuja, Mitesh M Khapra, Karthik Sankaranarayanan, and Sarath Chandar. 2018. Complex sequential question answering: Towards learning to converse over linked question answer pairs with a knowledge graph. In Thirty-Second AAAI Conference on Artificial Intelligence. + +Yu Su, Ahmed Hassan Awadallah, Miaosen Wang, and Ryen W White. 2018. Natural language interfaces with fine-grained user interaction: A case study on web apis. In The 41st International ACM SIGIR Conference on Research & Development in Information Retrieval, pages 855-864. +Haitian Sun, Tania Bedrax-Weiss, and William Cohen. 2019. Pullnet: Open domain question answering with iterative retrieval on knowledge bases and text. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 2380-2390. +Ilya Sutskever, Oriol Vinyals, and Quoc V Le. 2014. Sequence to sequence learning with neural networks. In Advances in neural information processing systems, pages 3104-3112. +Alon Talmor and Jonathan Berant. 2018a. Repartitioning of the complexwebquestions dataset. arXiv preprint arXiv:1807.09623. +Alon Talmor and Jonathan Berant. 2018b. The web as a knowledge-base for answering complex questions. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 641-651. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In Advances in neural information processing systems, pages 5998-6008. +Ashwin K Vijayakumar, Michael Cogswell, Ramprasath R Selvaraju, Qing Sun, Stefan Lee, David Crandall, and Dhruv Batra. 2018. Diverse beam search: Decoding diverse solutions from neural sequence models. +Haoyu Wang, Shuyan Dong, Yue Liu, James Logan, Ashish Kumar Agrawal, and Yang Liu. 2020a. Asr error correction with augmented transformer for entity retrieval. +Ran Wang, Kun Tao, Dingjie Song, Zhilong Zhang, Xiao Ma, Xi'ao Su, and Xinyu Dai. 2020b. R3: A reading comprehension benchmark requiring reasoning processes. arXiv preprint arXiv:2004.01251. +Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumont, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander M. Rush. 2020. Transformers: State-of-the-art natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 38-45, Online. Association for Computational Linguistics. + +Tomer Wolfson, Mor Geva, Ankit Gupta, Matt Gardner, Yoav Goldberg, Daniel Deutch, and Jonathan Berant. 2020. Break it down: A question understanding benchmark. Transactions of the Association for Computational Linguistics, 8:183-198. +Ziyu Yao, Xiujun Li, Jianfeng Gao, Brian Sadler, and Huan Sun. 2019a. Interactive semantic parsing for if-then recipes via hierarchical reinforcement learning. In Proceedings of the AAAI Conference on Artificial Intelligence. +Ziyu Yao, Yu Su, Huan Sun, and Wen-tau Yih. 2019b. Model-based interactive semantic parsing: A unified framework and a text-to-sql case study. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 5447-5458. +Wen-tau Yih, Ming-Wei Chang, Xiaodong He, and Jianfeng Gao. 2015. Semantic parsing via staged query graph generation: Question answering with knowledge base. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 1321-1331. +Wen-tau Yih, Xiaodong He, and Christopher Meek. 2014. Semantic parsing for single-relation question answering. In Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 643-648. +Wen-tau Yih, Matthew Richardson, Christopher Meek, Ming-Wei Chang, and Jina Suh. 2016. The value of semantic parse labeling for knowledge base question answering. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 201-206. +Tao Yu, Rui Zhang, He Yang Er, Suyi Li, Eric Xue, Bo Pang, Xi Victoria Lin, Yi Chern Tan, Tianze Shi, Zihan Li, et al. 2020. Cosql: A conversational text-to-sql challenge towards cross-domain natural language interfaces to databases. In 2019 Conference on Empirical Methods in Natural Language Processing and 9th International Joint Conference on Natural Language Processing, EMNLP-IJCNLP 2019, pages 1962-1979. Association for Computational Linguistics. +Tao Yu, Rui Zhang, Michihiro Yasunaga, Yi Chern Tan, Xi Victoria Lin, Suyi Li, Heyang Er, Irene Li, Bo Pang, Tao Chen, et al. 2019. Sparc: Cross-domain semantic parsing in context. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 4511-4523. +Yuan Zhang, Jason Baldridge, and Luheng He. 2019. Paws: Paraphrase adversaries from word scrambling. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 1298-1308. + +
Question +What is the official language of the country that contains Al Sharqia Governorate?
SPARQL Query +<sparql-header-1> ?c ns:location country. +administrative_divisions #entity1#. ?c +ns:location countryofficial_language ?x .
Answer +Modern Standard Arabic
+ +Table 11: Example question from the CWQ dataset. The entity "Al Sharqia Governorate" is replaced with "#entity1#". Entities are delexicalized in order to increase generalizability across questions in training. + +Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A. Efros. 2017. Unpaired image-to-image translation using cycle-consistent adversarial networks. In Proceedings of the IEEE International Conference on Computer Vision (ICCV). + +# A Dataset Creation Details + +The creation of the INSPIRED dataset requires careful selection of questions, design of a decompositional approach, and a translation strategy between logical forms and human-readable language. Further, we carefully design a crowdsourcing task to gather more natural-sounding questions to enhance the quality and versatility of our framework. + +# A.1 Forming Dialogues from CWQ + +We utilize the COMPLEXWEBQUESTIONS 1.1 (CWQ) dataset (Talmor and Berant, 2018a,b), as this is a common dataset used for complex question-answering over knowledge bases. This dataset is formed by combining questions from the WEBQUESTIONSsP dataset (Yih et al., 2016) to form multi-hop complex questions, meaning that they require more than one step to answer. Each question has an associated SPARQL query that functions as a meaning representation of the question. Table 11 shows an example of a complex question, its associated SPARQL query, and its answer. + +We envision that a human user will ask a complex question, the system will predict a SPARQL query for that question, decompose it into pieces, translate those pieces into English to show to the user to solicit feedback. The system will then use that feedback to correct the initial parse, if necessary. Figure 1 shows illustrations of this process. + +In order to model this type of dialogue, we utilize a transformer-based seq2seq model (Vaswani + +et al., 2017) to predict a SPARQL query for each complex question and decompose the predicted and gold query into pieces, then use these pieces as editable chunks which can be deleted, replaced, or inserted to transform the predicted query into the gold. This process is the framework around which each dialogue is constructed. We translate each step from SPARQL into English to be comprehensible to a human user, thus resulting in dialogues like the one shown in Figure 1, all stemming from questions that occur in the CWQ dataset. Note that the parser used for this purpose is not state-of-the-art, as part of the goal is to have a broad coverage of error types for correction. + +# A.2 Translation of SPARQL Using Templates + +As this dataset leverages SPARQL queries, we then develop a strategy for how to represent these queries in a more comprehensible form that humans can understand. Thus we create a template corpus and develop a rule-based translation method to do so. The corpus consists of 772 different predicates that appear in the CWQ dataset and translations of each into a basic template that conveys the content. The strategy of using templates to make content more human-friendly has a long history, both utilizing handcrafted templates (Kukich, 1983; McKeown, 1985; McRoy et al., 2000) and rule-based template formation (Angeli et al., 2010; Kondadadi et al., 2013). We use a blend of both approaches to create templates to represent logical forms in a way that is understandable to our coworkers. As can be seen in Table 11, SPARQL queries contain predicates that appear in the form of triples with each component separated by periods, such as location.country administative_divisions and location(countryofficial_language). These triples consist of a domain (location), a type (country) that represents a class within the domain, and a property (administrative_divisions and official_language) that specify more granular information. These predicates represent content information about the question and can appear in multiple, different questions. For example, the location(country-administative_divisions predicate maps to the template the country/countries that contain(s) $<\text{PH}>$ , where $<\text{PH}>$ ("placeholder") gets replaced with a specific entity. + +In the parsing process, we delexicalize these specific entities in order to make questions more generalizable and reduce noise during training. For + +
Composition
QuestionWhat is the mascot of the team that has Nicholas S. Zeppos as its leader?
SPARQL<sparql-header-1> ?c ns:organization. organization.leadership ?k . ?k ns:organization.leadership.person #entity1# . ?c ns:education.educational _institution.mascot ?x .
Templates1. the organization whose leadership includes a person named <PH>2. the educational institution with the mascot <PH>
Translation1. What is/are the organization whose leadership includes a person named Nicholas S. Zeppos?2. That entity is/are the educational institution with the mascot what?
Conjunction
QuestionWhat country with the capital of Hagåtña is where Sam Shepard lives?
SPARQL<sparql-header-2> #entity1#ns:people.personplaces_lived ?y . ?yns:people.place_lived.location ?x . ?xsn:location.cOUNTRY.capital #entity2#.
Templates1. the person(s) who lived in <PH>2. the location with the capital city named <PH>
Translation1. Sam Shepard is/are the person(s) who lived in what?2.Of which, what is/are the location with the capital city named Hagåtña?
Comparative
QuestionWhat country is in the Caribbean with a country calling code higher than 590?
SPARQL<sparql-header-2> #entity1#ns:location.location.contains ?x . ?xns:common.topnic.notable_types #entity2#. ?x ns:location.cOUNTRY.calling_code?num . filter ( xsd:integer ( ?num ) > 590 ) .
Templates1. the location(s) containing <PH> (<RSTR>)2. the country/countries whose calling code is/are <PH>
Translation1. Caribbean is/are the location(s) containing what (country)?2. Of which, what is/are the country/ countries whose calling code is/are greater than 590?
Superlative
QuestionWhich pro athlete started his career earliest and was drafted by the Cleveland Browns?
SPARQL<sparql-header-2> #entity1#ns:sports.professional_sports_team.draft_picksy . ?y ns:sports.sports_league_draft_pick-player ?x . ?x ns:sports.pro_athlete.career_start ?num . } order by ?num limit 1
Templates1. the team(s) that drafted the athlete(s) <PH>2. the pro athlete(s) who started their career(s) in <NUM>
Translation1. Cleveland Browns is/are the team(s) that drafted the athlete(s) what?2. These entities are the pro athlete(s) who started their career(s) in what?3. Of these, which is the entity associated with the earliest date?
+ +Table 12: Question types from the CWQ dataset and the translation process to templated sub-questions. + +example, in the SPARQL query in Table 11, the replacement token #entity1# appears, which we replace with Al Sharqia Governorate when the template is invoked. + +The remaining components of the SPARQL query specify the question type and any additional components, which we leverage to transform the template into a full sentence. The components will be discussed more fully in A.3. Thus, this particular SPARQL query translates to the following sub-questions: + +1. What is/are the country/countries that contain(s) [Al Sharqia Governorate]? + +ANSWER: Egypt + +2. That entity is/are the country/countries whose official language is what? + +ANSWER: Modern Standard Arabic + +# A.3 Question Types + +Each of the questions in CWQ can be categorized into one of four major reasoning types: composition, conjunction, comparative, and superlative (Talmor and Berant, 2018b). Each type can be identified by the SPARQL query and translated accordingly. Table 12 shows the translation process of the four types with examples of each. The general strategy is to append content to the beginning of the template and replace the token to form a complete question and express the appropriate question type. As seen in Table 12, this is quite straightforward for composition- and conjunction-type questions. + +Composition questions are composed of two simple questions, where the answer to the first is used to form the second question. As an example, in order to answer the question What is the mascot of the team that has Nicholas S. Zeppos as its leader?, one must first answer In which organization is Nicholas S. Zeppos a leader? to have all the content necessary to answer What is the mascot of that organization?. To translate these question types to templated sub-questions, we simply append What is/are before the first template and insert the named entity where the token appears in the template. Then, That entity is/are is appended to the beginning of the second template and what replaces the placeholder. Note that these positions can be reversed depending on what content is provided in the question. For example, + +a question could be either of the two options, depending on the goal of the target question: + +1. What is/are the organization whose leadership includes a person named Nicholas S. Zeppos? +2. Vanderbilt University is/are the organization whose leadership includes a person named what? + +Conjunction questions follow a very similar process, though because their goal is to find the intersection of two categories, the first question returns a list of answers. To account for this, we simply append $\text{Of which}$ to the second question before following the same set of rules as the composition questions. + +Comparative questions generally have a comparative operator $(<, >)$ and a number contained in their SPARQL query, which we translate simply to less than $X$ or greater than $X$ , as appropriate. Note that the comparative example in Table 12 contains a "restriction predicate", marked by the token. This will be discussed in Section A.3.1. + +Superlative questions require a slightly more complicated strategy. The first sub-question of a superlative type question always generates a list of answer options, while the second sub-question must pair those answer options with numerical information, such as dates or integers. Then, these numbers are ordered, either from smallest-to-largest or vice versa, and the first is returned as the final answer. To account for this, we append These entities are to front of the second template, to make it clear that multiple entities are involved, and return a paired list of entities and their corresponding values as an answer. Then we append a third sub-question that specifies how the questions are sorted and returns a single answer. + +# A.3.1 Logical Form Features + +Within the four main types of questions (composition, conjunction, comparative, and superlative), there are a variety of features that appear. These features include filters, restriction predicates, and union predicates. + +Filters act to restrict a list of entities in some fashion by assigning numerical boundaries. An example of this can be seen in Table 12 in the comparative question's SPARQL query, starting with the word filter. This sequence limits the list + +of entities by ones whose calling codes are larger than 590. + +Restriction predicates can appear as auxiliary pieces to regular predicates and typically provide categorical information about an entity. For example, in Table 12, the comparative-type question What country is in the Caribbean with a country calling code higher than 590? has two entities in its SPARQL query, though Caribbean is the only entity that seems to appear in the original question. The two main predicates are location.location.contains and location countrycalling_code, but a third predicate, common.topic.notable_types appears in between them. This predicate acts as a restriction upon the first main predicate; in this case #entity2# corresponds to country and restricts the locations that can appear as answers to the category of countries. + +Because restriction predicates are not standalone pieces that could be translated into their own sub-questions, we develop a strategy for incorporating them into the templates of the predicates they restrict. First, we create a corpus of "mini-templates" that correspond to all the restriction predicates that could appear. Much of the time, these mini-templates simply place the entity (like country in the previous example) into parentheses, though in some cases they situate the entity into a prepositional phrase. + +Meanwhile, the main template corpus has tokens in place to define where the mini-template should be placed in the main template. One can see in the comparative example of Table 12 that there is an token in the template of the first sub-question. Every main template that can appear with a restriction predicate has this token in its template; though it needs not always appear with one. Consequently, if the restriction token does not get replaced, it simply gets deleted. If the location.location.contains predicate appeared without a restriction predicate, it would simply read Caribbean is/are the location(s) containing what? + +Union predicates are a bit of a misnomer, as they are actually a group of predicates that function as though they are a single predicate, and thus correspond to a single template. In Table 13, one can see that the SPARQL query is quite long, with all of the content in bold corresponding to the first subquestion and the remainder corresponding to the second. Within this first sub-LF, there are several predicates that are joined together by \}union{. Col + +
Composition
QuestionWho is both a member of the Kennedy family and the Order of the British Empire?
SPARQLfilter ( ?x != #entity1# ) { # parents #entity2# ns: people.person.parents ?x . } union { # children #entity3# ns:people.person的孩子 ?x . } union { # siblings #entity4# ns:people.person.sibling_s ?y . ?y ns:people.sibling關係Sibling ?x . } union { #spouse #entity5# ns: people.person.spouse_s ?y . ?y ns:people.marriage.spouse ?x . ?y ns:people.marriage.type_of_union #entity6# . filter ( not exists { ?y ns:people.marriage.to []}) } ?x ns:royalty.chivalric_order_member BELongs_to_order ?c . ?c ns:royalty.chivalric_order_membership.order #entity7# .
Templates1. the family of <PH>2. the member(s) of the order of <PH>
Translation1. Who is/was the family of John F. Kennedy?2. Of which, what is/are the member(s) of the order of Order of the British Empire?
+ +Table 13: Example of a question whose SPARQL query includes a union predicate. + +lectively, these templates encompass the concept of family by defining all the various relationship roles that are involved in that concept. Theoretically, we could enumerate all of these in template form, separated by or (the brother of John F. Kennedy or the mother of John F. Kennedy or the child of John F. Kennedy...) but this seems to be an unnecessarily complicated and inconcise way of representing these. Instead, we enumerate the various types of union predicates that could appear and create a small corpus of templates that express the overall concept represented by each collection of predicates, thus crowdworkers will see questions with this feature in the same format as a regular question. + +# A.4 Crowdsourced Data Collection + +As mentioned in Section 2.2, the crowdsourcing task for this dataset is primarily a paraphrasing task in which crowdworkers work through a structured dialogue, rephrasing templated sub-questions at each step. + +Each task takes the form of a dialogue involving three entities: the "user", which is an automated dialogue partner, an automated "director" that guides the dialogue and provides detailed instructions, and the "agent", which is the role performed by the crowdworker. Upon entering a task, the worker is shown the "target question", or the original question from CWQ, and asked if the question was sensible to them. If so, they are asked to rephrase it using different language. If not, they proceed + +with the dialogue in the hopes that the decomposition process will make the meaning of the question clear. In these cases, the crowdworker is asked to rephrase the target question at the end of the dialogue. This process is included to encourage better understanding of the target question and to help us recognize confusing questions in the original dataset and replace them with higher-quality questions when appropriate. + +Next, the target question is automatically decomposed into templated sub-questions which are displayed to the worker, who rephrases them into English. These rephrased questions are sent to the automated user, who provides corrections as necessary. The worker rephrases any new questions and the edits are automatically made. At the end of the dialogue, the worker is asked for any feedback regarding the dialogue. This feedback is later used to make corrections and flag any problems that might have arisen. Screenshots of the dialogue interface can be seen in Figure 4. + +# B Dataset Analysis + +# B.1 Cleaning the Dataset + +As mentioned in Section 3, we employ a semi-automatic data cleaning method to reduce the error rate in the INSPIRED dataset. Because data cleaning can be an expensive and time-consuming process, the goal is to develop a method that would reduce the number of items in the dataset that need to be manually reviewed. Thus we use an automatic method to identify a small subset of the entire dataset that contain as many errors as possible to then manually review. To this end, we utilize a pretrained sequence-to-sequence model that employs the idea of cycle consistency (Zhu et al., 2017), to identify poor paraphrases by retrieving meaning representations (MRs) from questions rephrased by the workers. Then these MRs are used to compare against the original MRs and evaluated for similarity. + +In order to evaluate the effectiveness of the strategy, a random $5\%$ subset of the entire dataset is selected for annotation, using a binary classification of whether or not the rephrased question was an accurate paraphrase of the original templated question (and by extension, its original logical form). This annotation effort revealed that $4.4\%$ of the rephrased questions contain errors, which we expect is representative of the entire dataset. + +We then fine-tune Hugging Face's implementation + +![](images/8b03aef269ce2e8e111a60f563d54966f0ee619855f2d8088c4687475c9c26ed.jpg) +Figure 4: Data collection interface on AMT, using the ParlAI framework (Miller et al., 2017). + +tion of T5 in a seq2seq model to generate MRs, in this case templated sub-questions, to compare to the original MRs (Wolf et al., 2020; Raffel et al., 2020). These pairs of MRs then need to be sorted in a ranked list that filters paraphrases that are more likely to contain errors to the top of the list. This allows us to use a precision at $K$ measure, which, given a rank $K$ , the precision is calculated over the set of retrieved items with a rank of $K$ or less. For the annotated test set, $K$ equals 75, the number of observed errors. After ranking the list, we can evaluate the quality of the method by checking the top $K$ data points and checking to find how many errors appear in that set, compared to a random baseline of $4.4\%$ (the observed error rate), or about 3 errors. + +We employ two ranking methods to sort the pairs. First, we calculate the negative log-likelihood of the target MRs relative to the model and then do the same for the generated MRs. + +$$ +\mathcal {S} (y) = - \sum_ {y _ {i} \in Y} \log p \left(y _ {i} \mid y _ {< i}, x; \theta\right) \tag {1} +$$ + +$$ +y = \langle y _ {1}, \dots , y _ {| y |} \rangle +$$ + +$$ +y _ {< i} = \left\langle y _ {1}, \dots , y _ {i - 1} \right\rangle +$$ + +$S(y)$ refers to the score of a given output sequence $y$ , which is the sum of the negative log-likelihood of each $y_{i}$ given the sequence of $y$ tokens that come before. $\theta$ refers to the model parameters. + +Once the negative log-likelihoods are determined for each candidate $y$ , the best candidate is determined based on the lowest score. + +$$ +y * = \operatorname {a r g m i n} (S (y | x)) \tag {2} +$$ + +Here, $y*$ refers to the best generated output sequence, and $x$ is a given input sequence. A score for output sequence $y*$ is determined, as well as a score for the target sequence $t$ . + +$$ +D = | S (y *) - S (t) | \tag {3} +$$ + +While these two scores are comparable to each other, they are not comparable across other item pairs. In order to assign a ranking for every item in the dataset, we calculate the difference $D$ between the negative log-likelihoods of the target MR and generated MR for each question in the dataset and sort them based on the largest difference score, as shown in Equation 3. + +Second, we calculate an edit distance score between the target MR and generated MR and sort based on the largest score. If the model has predicted an MR that is substantially far from the target MR in its phrasing, it likely has a different meaning. + +Using the first ranking method, $17.3\%$ of the errors are recovered, while the second recovers $32\%$ of the errors. However, because the two ranking methods appear to be identifying different errors with little overlap, both are used to identify the final set of questions for manual review, drawing from the methods equally. + +Then the method is applied to the entire IN-SPIRED dataset, using cross-validation with a series of $90\%$ training, $10\%$ testing splits to generate MRs for every rephrased question. Then, because the annotated dataset has a $4.4\%$ error rate which we expect to be representative of all the data, the top-ranked $4.4\%$ of data is selected for manual review. This review results in $17.7\%$ of items being revised, meaning that authors change the rephrasing to more accurately reflect the original meaning. + +B.2 GEM Metrics + +
Template CorpusRephrased Corpus
Unigrams
Vocab Size8,4659,864
Distinct0.0120.022
Unique1,0031,258
Entropy6.5328.090
Bigrams
Vocab Size21,07244,085
Distinct0.0310.109
Unique2,9498,723
Entropy8.97612.484
Cond Entropy2.2953.918
Trigrams
Vocab Size31,83881,479
Distinct0.0500.224
Unique5,33220,971
Entropy10.29114.529
Cond Entropy1.2501.986
+ +Table 14: GEM n-gram metrics for the template corpus and rephrased question corpus. + +
Lexical RelationshipPercentage(%)
Lexical Match58
Synonymy31
Hypernymy5
Hyponymy20
+ +Table 15: Lexical analysis of 100 randomly sampled subquestions and their templates. Note that Lexical Match refers to the percentage of words in all sub-questions that appear in their corresponding templated question. + +Table 14 shows the N-gram statistics of all the templates in the dataset (template corpus) and all the rephrased questions (rephrased corpus). These metrics are calculated using the GEM evaluation scripts (Gehrmann et al., 2021). In this table, VOCab Size refers to the total number of distinct N-grams, while Distinct refers to the ratio of distinct N-grams divided by the total number of N-grams in the dataset. Unique specifies the number of N-grams that occur only once in the dataset, Entropy is the Shannon entropy over N-grams, and Conditional Entropy is the entropy conditioned on $\mathrm{N}_{-1}$ -grams. + +# B.3 Lexical Analysis + +In order to better understand the methods by which crowdworkers rephrased templates, 100 randomly selected sub-questions are studied in terms of the lexical relationships between the template and rephrased versions. Table 15 shows the results of this analysis. "Lexical match" refers to the average proportion of words in the rephrased version that also appear in the template, relative to the total number of words in the rephrased version. Synonymy, hyphenymy, and hyponymy refer to the number of questions in the 100 selected items that contain an instance of one of these lexical relations. It is clear, therefore, that crowdworkers are using these strategies in their rephrasings of the templates, in addition to simply changing word order. On average, a bit less than half the words in a rephrased question are newly introduced by the crowdworker, and $56\%$ of the time they are using synonymy, hyphenymy, hyponymy, or some combination of these to rephrase the templated question. + +# B.4 Contextual Awareness + +In a given dialogue, we provide answers to the sub-questions when possible, making the dialogue context-rich and providing the user with as much + +
Sub-question predicateActual ContextRandom Context
film.filmsubject.filmsComplex Question: Who was the wife of the subject of the film #entity#?Complex Question: Where did the topic of the film #entity# pass away at?
Sub-Questions: *1. Who was the subject of the movie #entity#? 2. Who was that person married to?Sub-Questions: *1. Who was the main focus in the movie called #entity#? 2. Where did this individual die?
influence.influence_node. influenced_byComplex Question: Which peer of #entity# inspired the work of #entity#?Complex Question: What person who influenced #entity# ’s work was born on #entity#?
Sub-Questions: *1. Who inspired the work of #entity#? 2. Of the above named people, which had a peer relationship with #entity#?Sub-Questions: *1. #entity# inspired which people’s work? 2. Which of these people were born on #entity#?
+ +Table 16: Examples of sub-questions in their actual context vs. a random context that utilizes the same predicate in its logical form. The sub-question was substituted for the one that used the same logical form (marked with *) in the random context when calculating ROUGE scores. Lexical overlap of the sub-question with each context is represented by bold text. Entities have been replaced with #entity# tokens in order to avoid disavantaging the random context due to overlap in named entities. + +information as possible to help them understand the decomposition process of their original query. + +This context-awareness can also be seen in the sub-question paraphrases. Our crowdworkers are encouraged to paraphrase questions in a manner that accounts for the overall context of the question, particularly with regard to named entities. For example, when a second sub-question references the answer of the first sub-question, we ask the Turkers to reference that entity without naming it explicitly, but also using a more specific phrase than entity. An example of this can be seen in Figure 1, where instead of directly incorporating the answer of the first question (Egypt) into the second question, they reference it using the phrase the above-named nation. The goal of this strategy is to create a dataset of dialogues that are context-aware and grounded, on which generation models can be trained to mirror this behavior. By using less specific phrases than entity names, our model is better able to generalize across examples during training. + +However, one can envision that in a real-use situation, it might be more natural for a user to simply use Egypt instead of the above-named nation when correcting sub-question 2. While our current framework is not able to accommodate this behavior, a simple data augmentation procedure in which referring expressions are replaced with the named entities should allow our system to accommodate this. We leave this data augmentation for future work, but plan to implement it upon conducting a study with real users. + +In order to demonstrate contextual awareness, Table 4 in Section 3 shows the average ROUGE-1 and ROUGE-2 scores of all sub-questions in their actual contexts compared with the same sub + +
ConjunctionCompositionComparativeSuperlativeTotal
Delete499493155
Insert18357652082083016
Replace220717573413934698
No Action217222403013105023
+ +Table 17: Distribution of error types within the subquestions of the four main question types. + +questions in a randomly assigned context that utilizes the same sub-logical form. The higher scores for the actual context indicate that the wording of sub-questions reflects the context from which they are derived. Moreover, Table 16 shows examples of sub-question with these context comparisons. + +# B.5 Error Characteristics of Initial Parser + +It is important to note that our initial parser is purposefully not state-of-the-art, as we want to have a wide distribution of errors around which we could create dialogues. (See Section 4 for details about the initial parser.) Similar to other interactive semantic parsing work, we envision that the user will provide corrections to the sub-questions, though we at this stage require the user to use the three operations of deleting, replacing, or inserting a whole sub-question. Table 17 shows the distribution of sub-questions whose original complex question is of each of the four main types. Within these types, the distribution of edit operations per sub-question is shown. Though many of sub-questions do not need any edits, the replace operation is most frequent of edit operations, appearing in roughly $36.5\%$ of each type, while insert is roughly $23.3\%$ and delete is around $1.2\%$ , with no action making up the remaining $39\%$ . These distributions indicate the parser is more likely to predict something incorrect or leave out a sub-question, rather than predict + +# Sub-Q: + +What tourist attractions are by the grand canyon? + +# Gold Sub-LF: + +```bash +#entity1# ns:travel.tourist_attraction.neartraveldestination ?x . + +# Generated Sub-LF: + +```javascript +#entity1# ns:traveltraveldestination.tourist attracted ?x . + +# Sub-Q: + +What is that country's national anthem? + +# Gold Sub-LF: + +?c ns:location country.national_anthem ?y . ?y + +ns: government.national_ anthem_of_a_country.anthem ?x . + +# Generated Sub-LF: + +?c ns:location country.national_anthem ?x . + +Table 18: Two error cases about wrongly generated predicates in an analysis of 100 generated sub logical forms. ?y in the logical form is an example of CVT node which connects two predicates that operate as a single, compound predicate. + +
Human-WrittenWhich of the above named people did the voice of toki?
Machine-GeneratedWhich of these people played the role of toki?
Error ExplanationGenerated question does not specify that the role was a voice acting one.
Human-WrittenWhat famous person has addison's disease?
Machine-Generatedwho has suffer from addison's disease?
Error ExplanationGrammatical error
Human-WrittenWhat district does that politician represent?
Machine-GeneratedWhat district does that person represent?
Error ExplanationGenerated question is slightly less specific
+ +Table 19: Three instances of errors in an analysis of 100 generated sub-questions compared to human-written versions. + +a sub-question that is not present in the gold. + +# C Sub-Task Error Analyses + +Parse Correction. We sample 100 erroneous predictions of BART-large under the best-performing setting in Table 7. In this analysis, it becomes clear that longer, more complicated logical forms are more likely to be mispredicted. Only 21 of the errors involve single predicates, while 54 erroneous parses occur with CVT (Compound Value Type) predicates, which are essentially two predicates combined together via CVT nodes (for example ?y in Table 18) that function as a single predicate. 13 errors occur on restriction predicates, which co-occur with single or CVT predicates to further limit the entity type. For example, predicates of the location domain might occur with a restriction that limits that predicate to locations of the type country. The remaining 12 errors all occur due to only partially generating a long logical form that contains filters. Details regarding restriction predicates and filters can be found in A.3.1. + +Sub-Question Generation. We conduct an anal + +
Better ModelNeitherModel 1Model 2
Number74206
EXAMPLES
Human-Writtenwho were walt disney's kids?kevin hart went to what schools?what is the name of the currency used in that country?
Model 1 (w/context)who are the children of walt disney?what schools did kevin hart go to?what kind of currency do they use?
Model 2 (w/o context)what are the names of walt disney's children?what did kevin hart go to?what is the currency used in that country?
+ +Table 20: Comparison of 100 generated sub-questions from models with and without context in their inputs. The bolded text in columns 2 and 3 highlight what enhanced the quality of the generation in comparison to its counterpart. Model 1 refers to the model that used the complex question and previous templated questions as context (row 4 in Table 9) and Model 2 refers to the model that did not use context at all (row 1 in Table 9). + +ysis on 100 randomly selected pairs of human-written question and machine-generated question that correspond to the same logical form. We first examine questions from the best-performing model in Table 9 according to BLEU scores and BERTScores, which use the current sub-logical form, the current templated sub-question, the complex question and the history of templated sub-questions from previous steps as context. Questions in which the machine-generated and human-written versions exactly match each other were excluded. This analysis reveals that only three generated questions $(3\%)$ are of perceptibly worse quality than the human-written questions, as can be seen in Table 19. Further, there are four cases in which the human-written questions contain grammatical errors, whereas the machine-generated ones do not. An analysis of all generated questions which do not exactly match their human-written counterpart reveals that $64\%$ of the generated questions are shorter in terms of number of words. + +Because BLEU scores do not necessarily paint a full picture of the model performance, we then examine the generated responses from the model that produced the lowest BLEU scores, which is the model with no context. By examining the same 100 samples as in the previous analysis, we note twenty cases in which the best-performing model that leverages context better reflects that context in its rephrasing than the model that does not leverage context. There are, however, 6 cases in which the model without context does this better and in the remaining cases there is no discernible difference between the quality of the generations from the two models. Table 20 shows examples of each of these cases, for illustration. + +While these results are based on our observations and certainly require further future investigation and human annotation by people other than the authors, these preliminary results show that the generated questions can be more concise and of comparable quality. \ No newline at end of file diff --git a/towardstransparentinteractivesemanticparsingviastepbystepcorrection/images.zip b/towardstransparentinteractivesemanticparsingviastepbystepcorrection/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..ebf07d8b0f043ebdac153400f402262c8a352252 --- /dev/null +++ b/towardstransparentinteractivesemanticparsingviastepbystepcorrection/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:484572c2efc3446cc68a01b820efebc239b33999c806c85d1eea35fe439b94c6 +size 977279 diff --git a/towardstransparentinteractivesemanticparsingviastepbystepcorrection/layout.json b/towardstransparentinteractivesemanticparsingviastepbystepcorrection/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..f5937c3add97bfd2eee77d3236ea3734f3ea684a --- /dev/null +++ b/towardstransparentinteractivesemanticparsingviastepbystepcorrection/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2c12dfdaa751289d2a9c89f03ee5f5a891ef262d9d6e662980c67c4e86bb6c1e +size 604847 diff --git a/towardsunifyingthelabelspaceforaspectandsentencebasedsentimentanalysis/0ac9d1c1-f200-4e57-9d52-b780887ec7c5_content_list.json b/towardsunifyingthelabelspaceforaspectandsentencebasedsentimentanalysis/0ac9d1c1-f200-4e57-9d52-b780887ec7c5_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..2d5257a3536d08cf4d172d5b7d4cbd5b05275200 --- /dev/null +++ b/towardsunifyingthelabelspaceforaspectandsentencebasedsentimentanalysis/0ac9d1c1-f200-4e57-9d52-b780887ec7c5_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5b315c435026cdc133a7dcb083968d74ea6f4f3ee288a1a8ff16bb9cf943d2ca +size 83792 diff --git a/towardsunifyingthelabelspaceforaspectandsentencebasedsentimentanalysis/0ac9d1c1-f200-4e57-9d52-b780887ec7c5_model.json b/towardsunifyingthelabelspaceforaspectandsentencebasedsentimentanalysis/0ac9d1c1-f200-4e57-9d52-b780887ec7c5_model.json new file mode 100644 index 0000000000000000000000000000000000000000..652717ec81e9106dfdf05aef32c42115b50ba231 --- /dev/null +++ b/towardsunifyingthelabelspaceforaspectandsentencebasedsentimentanalysis/0ac9d1c1-f200-4e57-9d52-b780887ec7c5_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ba92faa7714cf123823bec3bb7930dc2bc03ab3685c86aeeeb3d8d3032fdae60 +size 104093 diff --git a/towardsunifyingthelabelspaceforaspectandsentencebasedsentimentanalysis/0ac9d1c1-f200-4e57-9d52-b780887ec7c5_origin.pdf b/towardsunifyingthelabelspaceforaspectandsentencebasedsentimentanalysis/0ac9d1c1-f200-4e57-9d52-b780887ec7c5_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..80049d6b3988ec6c68cd10f465297b8c0d404c30 --- /dev/null +++ b/towardsunifyingthelabelspaceforaspectandsentencebasedsentimentanalysis/0ac9d1c1-f200-4e57-9d52-b780887ec7c5_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:18544e376407b3ae53b5dad261dd1e44c622dba7ceed20f164654c5ec63b88f9 +size 621578 diff --git a/towardsunifyingthelabelspaceforaspectandsentencebasedsentimentanalysis/full.md b/towardsunifyingthelabelspaceforaspectandsentencebasedsentimentanalysis/full.md new file mode 100644 index 0000000000000000000000000000000000000000..7c2026303a02f6305b5a0c7f9feebbb184bdc63b --- /dev/null +++ b/towardsunifyingthelabelspaceforaspectandsentencebasedsentimentanalysis/full.md @@ -0,0 +1,391 @@ +# Towards Unifying the Label Space for Aspect- and Sentence-based Sentiment Analysis + +Yiming Zhang + +Zhejiang University + +yimingz@zju.edu.cn + +Sai Wu + +Zhejiang University + +wusai@zju.edu.cn + +Min Zhang + +Zhejiang University + +min_zhang@zju.edu.cn + +Junbo Zhao (Jake) + +Zhejiang University + +j.zhao@zju.edu.cn + +# Abstract + +The aspect-based sentiment analysis (ABSA) is a fine-grained task that aims to determine the sentiment polarity towards targeted aspect terms occurring in the sentence. The development of the ABSA task is very much hindered by the lack of annotated data. To tackle this, the prior works have studied the possibility of utilizing the sentiment analysis (SA) datasets to assist in training the ABSA model, primarily via pretraining or multi-task learning. In this article, we follow this line, and for the first time, we manage to apply the Pseudo-Label (PL) method to merge the two homogeneous tasks. While it seems straightforward to use generated pseudo labels to handle this case of label granularity unification for two highly related tasks, we identify its major challenge in this paper and propose a novel framework, dubbed as Dualgranularity Pseudo Labeling (DPL). Further, similar to PL, we regard the DPL as a general framework capable of combining other prior methods in the literature (Rietzler et al., 2019; Bai et al., 2020). Through extensive experiments, DPL has achieved state-of-the-art performance on standard benchmarks surpassing the prior work significantly (Liu et al., 2021). + +# 1 Introduction + +# 1.1 Aspect-based Sentiment Analysis + +The aspect-based sentiment analysis (ABSA) task aims to recognize the sentiment polarities centered on the considered aspect terms occurring in the sentence. The establishment of the ABSA task echoes the long-standing literature of conventional sentence-level sentiment analysis (SA). For instance, as shown in Figure 1, a normal ABSA data annotation tags sentiment score on specific aspect terms in the sentence, like "surroundings" as positive and "food" as negative. Meanwhile, in the conventional sentence-based sentiment analysis, the whole sentence is labeled as negative at a coarser granularity. + +The surroundings were nice, but the food was too terrible. + +positive + +negative + +The surroundings were nice, but the food was too terrible. + +negative + +Figure 1: Sentiment Analysis (SA) and Aspect-based Sentiment Analysis (ABSA). The sample on the above is the ABSA task, while the sample on the bottom is the SA task. Both tasks aim at analyzing the sentiments carried by the objects in the box. + +Due to its much finer granularity, the annotation cost is significantly higher than its conventional counterpart. Essentially, many of the existing SA datasets (He et al., 2018) can be crawled and curated straightforwardly from the review websites such as Amazon1 or Yelp2. The five-star rating system comes in handy to accomplish the annotation. Thus, the SA datasets are often presented at a large scale. By contrast, the ABSA annotation has no such "free lunch". It has to require human annotators to participate. Coupling with its higher complexity on labeling, the ABSA datasets are ubiquitously at considerably smaller scales (Pontiki et al.; He et al., 2018; Yu et al., 2021b). To this date, the available datasets for conventional sentiment analysis are generally larger to several orders of magnitude than the ABSA. + +For instance, the commonly used ABSA benchmark SemEval 2014 task 4 has less than 5000 samples (Pontiki et al.), while there are 4,000,000 sentences in the Amazon Review dataset for SA. Due to the similarity between the SA task and the ABSA task, it is natural to use SA datasets as auxiliary datasets for the ABSA task (He et al., 2018). Most, if not all, previous work has focused on pretraining and multi-task learning methods (He et al., 2018, + +![](images/4e956dbe3a74af15ffc61f5b0e7bf739e37cd42db8823c931357f70117d24f00.jpg) +Figure 2: Dataset Generation in the Pseudo-Label (PL) Method. This figure shows a pipeline of the traditional Pseudo-Label method. $\mathbf{x}$ is the input data, a sentence in the SA dataset, while $y$ is the sentiment carried by a sentence. $\mathbf{t}_i$ indicates the position of an aspect term in a sentence, and $y_i$ is the label for that aspect term. $\mathbf{t}_i'$ and $y_i'$ are pseudo labels generated by the ABSA model. As we can see, in the PL method, the sentence sentiment labels are dropped, and the SA dataset is regarded as an unlabeled dataset. + +2019b). In this paper, we first take the Pseudo-Label method to utilize the SA datasets to solve the challenge faced by the ABSA task. + +# 1.2 Pseudo-Label + +The family of Pseudo-Label methods has had wide success in multiple fields (Pham et al., 2020; Ge et al., 2020; Mallis et al., 2020; Zoph et al., 2020; He et al., 2019a). The core of this family is to "trust" the generated fake labels by running the unlabeled samples through a teacher network that is trained by using the limited number of labeled samples. The generated labeled samples are then combined with the original set of supervised datasets and fed to the final model training. + +In this article, our core mission is to incorporate the large-scale datasets into the sentiment analysis with the targeted ABSA task. While there have been works on this line, such as He et al. (2018) and He et al. (2019b), exploring the Pseudo-Label methods has been very much untapped. Indeed, a very straightforward technological solution is depicted in Figure 2. One can apply the traditional Pseudo-Label method to generate a bunch of pseudo-aspect-based sentiment labels from the SA or even the unlabeled datasets. However, a consequence of this is the total abandonment and waste of the provided coarse-grained labels. While seemingly acceptable, we argue that due to the homogeneous root for the ABSA and SA tasks, the under-exploiting of the sentence-level coarse-grained sentiment labels is sub-optimal. It will be unnecessary if the traditional framework throws away the coarser-grained labels containing finer + +grained task-relevant information. We argue that the Pseudo-Label family of approaches is limited to fit a uniform granularity situation. They ought to evolve and further adapt to the discrepancy of granularity in the label space. + +# 1.3 Dual-granularity Pseudo Labels + +To solve the aforementioned problem, we propose the Dual-granularity Pseudo Labeling framework (DPL). In essence, the DPL augments the original PL framework and is capable of leveraging the labels drawn from both granularities. Briefly, the DPL relies on two teacher models obtained from datasets from both granularities, respectively, then generates pseudo labels for both sides. As a result, datasets from both granularity levels can be merged into a whole, with every sentence sample being tagged by both finer- and coarser-set of labels. To facilitate the employment of both sets of labels, we set a few standard conditions as the design principle of DPL. Slightly more concretely, DPL establishes two separate pathways leading to prediction for both granularities. Together, the two pathways interact in the representation space and ideally may possess controlled information flow that respectively corresponds and only correspond to the considered granularity. We incorporate an adversarial module to accomplish this functionality. + +On the widely used benchmarks, SemEval 2014 task 4 subtask 2 (Pontiki et al.), the DPL method significantly surpasses the current state-of-the-art method. We deem our simple but effective framework DPL pioneering a bi-granularity level dataset + +merging. In what follows, we empirically validate that DPL is a framework that can be seamlessly combined with the previous pre-training or multitask learning methods in terms of ABSA and SA dataset merging. + +To sum up, we make the following contributions in this paper: + +1. Among those works to solve the lack of labeled data in the ABSA task, we pioneer to adopt and enhance a pseudo-label framework to leverage the coarser-grained SA labels. +2. We propose a novel general framework called Dual-granularity Pseudo Labels (DPL). Just like the vanilla PL method, the DPL is established as a general framework. We validate that DPL is also compatible with previous work on this line, such as pre-training or multitask learning (MTL). DPL has achieved excellent performances on the standardized ABSA benchmarks such as SemEval 2014, which significantly outperforms the prior works. + +# 2 Related Works + +# 2.1 Aspect-based Sentiment Analysis (ABSA) + +ABSA is a finer-grained task of Sentiment Analysis (SA). It is a pipeline task, including aspect term extraction and aspect term sentiment classification. Aspect term sentiment classification is the true target task in this paper. For convenience, we use ABSA to refer to this task in the remaining parts. + +Like other application tracks in NLP, the family of neural network models has wide successes in this task (Jiang et al., 2011; Vo and Zhang, 2015; Zhang et al., 2016; Ma et al., 2017; Li et al., 2018; Wang et al., 2018; Huang et al., 2018; Song et al., 2019). Wang et al. (2016) introduce attention mechanism into an LSTM to model the inter-dependence between sentence and aspect term. Tang et al. (2016) apply Memory Networks in this task. + +Syntax-based models have also been explored widely in this domain (Dong et al., 2014; Tai et al., 2015; Nguyen and Shirai, 2015; Liu et al., 2020; Li et al., 2021; Pang et al., 2021). Sun et al. (2019) and Zhang et al. (2019) introduced graph convolution networks (GCN) to leverage the structured information from the dependency tree. Huang and Carley (2019) used graph attention networks (GAT) to improve the performance. Bai et al. (2020) and Wang et al. (2020) took the syntax relations as edge + +features and introduced them into the Relational Graph Attention Network (RGAT). + +In addition, pretrained language models like BERT (Devlin et al., 2018) have greatly promoted the development of ABSA (Li et al., 2018; Gao et al., 2019; Song et al., 2019; Rietzler et al., 2019; Yang et al., 2019). + +# 2.2 Using Extra Dataset for ABSA + +Due to the dataset scale challenge of the ABSA task, there have been some methods exploring how to utilize the auxiliary dataset. + +Some of them (Xu et al., 2019; Rietzler et al., 2019; Yu et al., 2021b) achieve decent ABSA performance by post-processing or fine-tuning BERT (Devlin et al., 2018) with an additional unlabeled dataset. For these methods, we argue that the cost of computation is too high. Moreover, DPL does not conflict with it and can accommodate the results of these works. We take Rietzler et al. (2019)'s work as an example for comparison in experiments. + +The others (He et al., 2018, 2019b; Chen and Qian, 2019; Liang et al., 2020; Yang et al., 2019; Oh et al., 2021; Yu et al., 2021a; Yan et al., 2021) utilize some labeled datasets and propose (later extend) a framework applying multitask learning methods. These auxiliary labeled datasets mainly include the sentiment analysis (SA) task and other subtasks of ABSA, such as Aspect Term Extraction, Opinion Term Extraction, and so on (Yan et al., 2021). DPL is more similar to these methods, using labeled datasets. However, we argue that the datasets of other subtasks can't solve the problem of the high annotation cost. Thus, DPL utilizes the SA task as auxiliary datasets and is the first to apply the PL method to this problem. + +# 2.3 Pseudo-Label + +Pseudo-label (PL), often associated with self-training, is a semi-supervised learning method. PL has been utilized and further developed by many studies (Ge et al., 2020; Mallis et al., 2020; Zoph et al., 2020; He et al., 2019a). It has been successfully applied in many tasks, such as image classification (Pham et al., 2020; Xie et al., 2020), object detection (Ge et al., 2020), text classification (Mukherjee and Awadallah, 2020), Etc. + +However, these PL methods are inapplicable under a non-uniform granularity situation; that is, there are massive available coarse-grained datasets for fine-grained tasks. These existing methods can only discard the coarse-grained labels and treat + +them as unlabeled datasets. Thus, we argue that these PL methods cause loss of information and are definitely unreasonable. + +# 3 Preliminary + +# 3.1 Pseudo-Labels + +The traditional PL method generally involves a labeled set denoted by $D$ and an unlabeled set $D_{u}$ . A teacher model is trained on $D$ by cross-entropy loss: + +$$ +\mathcal {L} (\Theta_ {T}) = \sum_ {(x, y) \in D} [ - \log P _ {\Theta_ {T}} (y | x) ] \tag {1} +$$ + +where $\Theta_T$ denotes the parameters of the teacher model. The cross-entropy loss function is adopted for general classification problems, including image classification, detection, and semantic segmentation (Ge et al., 2020; Pham et al., 2020; Xie et al., 2020; Zoph et al., 2020). + +In what follows, on the unlabeled dataset $D_{u}$ , one can obtain the corresponding labels via running the unlabeled input through an inference procedure of the teacher model. The yielded label set for $D_{u}$ forms a pseudo-labeled dataset that can later be combined with the original dataset with gold annotations. A student model $M_{S}$ is trained by the newly merged dataset: + +$$ +\begin{array}{l} \mathcal {L} (\Theta_ {S}) = \sum_ {(x, y) \in D} [ - \log P _ {\Theta_ {S}} (y | x) ] + \\ \lambda \sum_ {\left(x _ {u}, y ^ {\prime}\right) \in D _ {u} ^ {\prime}} \left[ - \log P _ {\Theta_ {S}} \left(y ^ {\prime} \mid x _ {u}\right) \right] \tag {2} \\ \end{array} +$$ + +where $y^\prime$ indicates the pseudo label corresponding to the sample $x_{u}$ generated by the teacher model. $D_u^{\prime}$ are the pseudo-label augmented version of $D_{u}$ $\lambda$ is a weighing term. + +# 4 Dual-granularity Pseudo Labeling + +In short, our work focuses on expanding the traditional PL method to utilize coarse-grained datasets. To achieve this goal, we draw inspiration from the multi-task learning community and augment the PL method with a different modeling pathway. Consequently, we obtain a framework where two separate pathways are trained synergistically targeted at labels of both granularities. + +# 4.1 Setup + +Our work is based on two datasets, the fine-grained and the coarse-grained datasets in the same domain. + +Let us use $D_{\mathrm{fine}}$ and $D_{\mathrm{coarse}}$ to denote two datasets respectively. For the coarse-grained dataset $D_{\mathrm{coarse}}$ , the task is to learn a mapping: + +$$ +f _ {\text {c o a r s e}} (\mathbf {x}) \rightarrow y, \tag {3} +$$ + +For the fine-grained dataset $D_{\mathrm{finer}}$ , the target mapping is: + +$$ +f _ {\text {f i n e}} \left(\mathbf {x}, \mathbf {t} _ {i}\right)\rightarrow y _ {i}, i \in \{1, \dots , m \} \tag {4} +$$ + +where $(\mathbf{x},y)\in D_{\mathrm{coarse}}$ and $(\mathbf{x},\mathbf{t}_i,y_i)\in D_{\mathrm{fine}}$ . $\mathbf{x}$ is the input data, and $y$ is the corresponding label for $\mathbf{x}$ . $\mathbf{t}_i\subseteq \mathbf{x}$ . $m$ means that $\mathbf{x}$ has m sub-parts totally, and $y_{i}$ is the corresponding label for $\mathbf{t}_i$ . + +The traditional PL method is limited to fit a uniform granularity situation. The first step to resolve this limitation is to merge the coarse-grained dataset with the fine-grained dataset. Like the traditional PL method, we train a teacher model on one dataset and generate pseudo labels for the other dataset. We repeat this process at two granularities. Here, we suppose that $\mathbf{x}_i$ for each $\mathbf{x}$ in the $D_{\mathrm{coarse}}$ have been extracted. After pseudo labels generation, two new datasets are generated, donates as $D_{\mathrm{fine}}'$ and $D_{\mathrm{coarse}}'$ , and a new dataset $D'$ are merged by these two datasets. Specifically, + +$$ +D ^ {\prime} = D _ {\text {f i n e}} ^ {\prime} \cup D _ {\text {c o a r s e}} ^ {\prime}, \tag {5} +$$ + +where $(\mathbf{x},\mathbf{t}_i,y,y_i')\in D_{\mathrm{coarse}}'$ and $(\mathbf{x},\mathbf{t}_i,y',y_i)\in$ $D_{\mathrm{fine}}^{\prime}$ $y^\prime$ and $y_{i}^{\prime}$ are the generated pseudo labels. + +Up to now, we get a new dataset with a much larger scale. Our goal translates into obtaining a model trained by the new dataset $D'$ with high performance on the fine-grained task. In other words, compared with the traditional PL method, the key problem is: how to utilize the coarse-grained labels to improve the model's performance on the fine-grained task. + +# 4.2 DPL Skeleton + +As we mentioned, the core challenge for adapting the vanilla PL method is to utilize coarse-grained labels. As displayed in Figure 3, we set dual pathways corresponding to each granularity. Both pathways are finished by setting a proper softmax-based classifier. Using $\mathbf{z}$ and $\mathbf{h}$ to denote the internal representation vectors for both pathways, we decompose the design philosophy of DPL by the following three conditions: + +![](images/1bc9fac735ae342b44ff3957c3dc863742f4f61048972ef04fe4dc7f85384cdb.jpg) +Figure 3: The Model for the DPL Framework. $(\mathbf{x},\mathbf{t}_i)$ is the input data. $\mathbf{t}_i$ indicates the aspect terms, which are painted by the dark green. We first generate $(\mathbf{x},\mathbf{t}_i)$ and $(\mathbf{x},\mathbf{1} - \mathbf{t}_i)$ as the input of the upper and lower pathways, respectively. In this case, $\mathbf{t}_i = (0,1,1,0,0,0)$ and $\mathbf{1} - \mathbf{t}_i = (1,0,0,1,1,1)$ . “ $\Theta_{\mathrm{enc}}$ ” is an encoder that outputs $\mathbf{z}$ and $\mathbf{h}$ . “ $\Theta_{\mathrm{p}}^{+}$ ” is a predictor for the fine-grained task, and “ $\Theta_{\mathrm{p}}^{*}$ ” is a predictor for the coarse-grained task. Correspondingly, $y_i$ is the prediction for the fine-grained task, and $y$ is the prediction for the coarse-grained task. “mutual-exclusive” means the information carried by $\mathbf{z}$ and $\mathbf{h}$ has little overlap. + +- $\mathbf{z}$ carries adequate information to determine the label at the fine-grained level. More formally, there exists a function $f_{\Theta_{\mathrm{p}}^{+}}$ in the overall functional space that is able to map the $\mathbf{z}$ to $y_{i}$ . +- The union set of $\mathbf{h}$ and $\mathbf{z}$ is capable of determining the label at the coarse level. There exists another function $f_{\Theta_{\mathrm{p}}^{*}}$ in the overall functional space that is sufficient to map the $[\mathbf{z} \circ \mathbf{h}]$ to $y$ . +- $\mathbf{h}$ and $\mathbf{z}$ are mutually exclusive in terms of the carried information. That means we cannot train a function $f_{\Theta_{\mathrm{p}}^{*}}$ to map $\mathbf{h}$ to $y_{i}$ , due to the lack of information contributed from $\mathbf{z}$ . + +The main rationale behind these three conditions may include but is not limited to: (i)-the information passing through the pathway with $\mathbf{z}$ is only required in the fine-grained task; (ii)-the other information needed by the coarse-grained task passes through the pathway with $\mathbf{h}$ ; (iii)-the prediction at coarse-grained level is based on the concatenation of $\mathbf{h}$ and $\mathbf{z}$ , while either of them is insufficient to accomplish the prediction of coarse-grained labels. + +In order to satisfy the model to these three conditions, our loss function consists of three terms. Among them, the two terms are the classification loss terms for the fine- and coarse-grained tasks, respectively, fulfilling conditions 1&2. For condition 3, we draw inspiration from adversarial training (Lample et al., 2017) to reduce the fine-grained task-relevant information carried by $\mathbf{h}$ . + +# 4.2.1 Fine- and Coarse-grained Tasks + +As shown in Figure 3, the model consists of an encoder, $\Theta_{\mathrm{enc}}$ , together with two predictors, $\Theta_{\mathrm{p}}^{*}$ and $\Theta_{\mathrm{p}}^{+}$ . In particular, $\Theta_{\mathrm{enc}}$ encodes each input data $(\mathbf{x},\mathbf{t}_i)$ into two intermediate results, $\mathbf{z}$ and $\mathbf{h}$ . In the figure, the top line with $\mathbf{z}$ is the pathway for the fine-grained task-relevant information flow, while the bottom line with $\mathbf{h}$ is the pathway for the fine-grained task-irrelevant information flow. + +The fine-grained predictor $\Theta_{\mathrm{p}}^{+}$ spits out prediction based on $\mathbf{z}$ , with a cross-entropy loss: + +$$ +\begin{array}{l} \mathcal {L} _ {\text {f i n e}} \left(\Theta_ {\text {e n c}}, \Theta_ {\mathrm {p}} ^ {+}\right) \\ = \sum_ {\left(\mathbf {x}, \mathbf {t} _ {i}, y, y _ {i}\right) \in D ^ {\prime}} \left[ - \log P _ {\Theta_ {\mathrm {p}} ^ {+}} \left(y _ {i} \mid \mathbf {z}\right) \right], \tag {6} \\ \end{array} +$$ + +Another crucial design in the DPL is that the concatenation of $\mathbf{h}$ and $\mathbf{z}$ , $[\mathbf{h} \circ \mathbf{z}]$ , is fed to decide the prediction of the sequence-level prediction: + +$$ +\begin{array}{l} \mathcal {L} _ {\text {c o a r s e}} \left(\Theta_ {\text {e n c}}, \Theta_ {\mathrm {p}} ^ {*}\right) \\ = \sum_ {\left(\mathbf {x}, \mathbf {t} _ {i}, y, y _ {i}\right) \in D ^ {\prime}} \left[ - \log P _ {\Theta_ {\mathrm {p}} ^ {*}} (y | \mathbf {h} \circ \mathbf {z}) \right]. \tag {7} \\ \end{array} +$$ + +The gradient of this loss will update the model parameters on both pathways. To prevent the degenerated case where the two pathways act completely separately, we introduce another crucial part to DPL in the next subsection. + +# 4.2.2 Adversarial Training + +The current version of DPL could still work as two separate systems, which is deemed a degenerated case. Therefore, to guarantee the mutual exclusiveness between the $\mathbf{h}$ and the $\mathbf{z}$ , we introduce an + +adversarial training loss term to maximally reduce the fine-grained task-relevant information carried by $\mathbf{h}$ : + +$$ +\mathcal {L} _ {\mathrm {e n c}} \left(\Theta_ {\mathrm {e n c}}\right) = \sum_ {\left(\mathbf {x}, \mathbf {t} _ {i}, y, y _ {i}\right) \in D ^ {\prime}} \left[ - \log P _ {\Theta_ {\mathrm {p}} ^ {+}} \left(1 - y _ {i} \mid \mathbf {h}\right) \right], \tag {8} +$$ + +$$ +\mathcal {L} _ {\mathrm {d i s}} \left(\Theta_ {\mathrm {p}} ^ {+}\right) = \sum_ {\left(\mathbf {x}, \mathbf {t} _ {i}, y, y _ {i}\right) \in D ^ {\prime}} \left[ - \log P _ {\Theta_ {\mathrm {p}} ^ {+}} \left(y _ {i} | \mathbf {h}\right) \right], \tag {9} +$$ + +$$ +\mathcal {L} _ {\mathrm {a d v}} \left(\Theta_ {\mathrm {e n c}}, \Theta_ {\mathrm {p}} ^ {+}\right) = \mathcal {L} _ {\mathrm {d i s}} \left(\Theta_ {\mathrm {p}} ^ {+}\right) + \lambda \mathcal {L} _ {\mathrm {e n c}} \left(\Theta_ {\mathrm {e n c}}\right), \tag {10} +$$ + +where $\lambda$ weighs the trade-off between $\Theta_{\mathrm{enc}}$ and $\Theta_{\mathrm{p}}^{+}$ . The adversarial training was first introduced in Lample et al. (2017) and has been widely used (Zhao et al., 2018; Fu et al., 2018; Shen et al., 2017; Melnyk et al., 2017). The loss term trains $\Theta_{\mathrm{enc}}$ to fool $\Theta_{\mathrm{p}}^{+}$ by removing fine-grained task relevant information from $\mathbf{h}$ . Considering that $\mathbf{z}$ is only required by the fine-grained task, the less fine-grained task-relevant information the $\mathbf{h}$ has, the less overlap there is between the $\mathbf{h}$ and $\mathbf{z}$ . As a result, the adversarial training makes $\mathbf{h}$ and $\mathbf{z}$ more mutually exclusive in terms of the carried information. + +# 4.2.3 Loss Function + +The overall loss function to optimzie DPL combines as below: + +$$ +\begin{array}{l} \mathcal {L} \left(\Theta_ {\text {e n c}}, \Theta_ {\mathrm {p}} ^ {*}, \Theta_ {\mathrm {p}} ^ {+}\right) = \mathcal {L} _ {\text {f i n e}} \left(\Theta_ {\text {e n c}}, \Theta_ {\mathrm {p}} ^ {+}\right) \\ + \alpha \mathcal {L} _ {\text {c o a r s e}} \left(\Theta_ {\text {e n c}}, \Theta_ {\mathrm {p}} ^ {*}\right) \tag {11} \\ + \beta \mathcal {L} _ {\mathrm {a d v}} \left(\Theta_ {\mathrm {e n c}}, \Theta_ {\mathrm {p}} ^ {+}\right) \\ \end{array} +$$ + +where $\alpha$ and $\beta$ are weighing terms. With this design of the loss functions, we posit that all three philosophies should be satisfied. The ideal result for it is that (i)- $\mathbf{z}$ only carries information dedicated at the fine-level; (ii)- $\mathbf{h}$ carries the information of the entire coarse level (i.e., the whole sequence) excluding the information of $\mathbf{z}$ ; (iii)-neither $\mathbf{h}$ nor $\mathbf{z}$ is sufficient on deciding the whole-sequence coarse-level prediction, but with the concatenation of them, $\mathbf{h} \circ \mathbf{z}$ , the information is just adequate. + +# 4.3 Grounding DPL to ABSA + +# 4.3.1 Document-level Sentiment Analysis. + +The task aims to analyze the sentiments reflected by sentences. Given an ordinary labeled document-level dataset + +
Datasetpositivesneutralnegative
TrainTestTrainTestTrainTest
Rest2164727637196807196
Laptop976337455128851167
+ +Table 1: Statistics of SemEval 2014 task 4 subtask 2. + +$D = \{(\mathbf{x}^0,y^0),(\mathbf{x}^1,y^1)\dots (\mathbf{x}^N,y^N)\}$ , where $\mathbf{x}^i$ donates a sentence and $y^{i}$ donates the sentiment polarity of the sentence. The goal of the task is to learn a mapping function: $f_{\mathrm{sent}}(\mathbf{x}^i)\to y^i$ + +# 4.3.2 Aspect-based Sentiment Analysis. + +The ABSA task is to derive the sentiment polarity attached to specific aspect terms in the given sentence. Formally, one can draw a data point $(\mathbf{x}^i,\mathbf{y}^i)$ from the dataset $D$ . We assign a separate variable indicating the aspect terms annotation, $\{\mathbf{t}^{i,1},\ldots ,\mathbf{t}^{i,N_i}\}$ , where $N_{i}$ denotes the number of total aspect terms in $\pmb{\tau}^{i}$ . In addition, the label $\mathbf{y}$ is a combination of polarities corresponding to aspect terms, $\mathbf{y}^i = \{y^{i,1},\dots,y^{i,N_i}\}$ . The goal for the ABSA is to learn the mapping $f_{\mathrm{aspect}}(\mathbf{x}^i,\mathbf{t}^{i,k})\to y^{i,k}$ , where $k\in \{1,\dots ,N_i\}$ . + +# 4.3.3 Implementation + +Before implementing a specific DPL model, we first map the task objectives of the SA and ABSA tasks to the coarse- and fine-grained tasks in the DPL framework. The coarse-grained task is the SA task, while the fine-grained task is the ABSA task. In another word, the mapping $f_{\mathrm{sent}}(\mathbf{x}^i) \to y^i$ , is considered as the coarse-grained mapping $f_{\mathrm{coarse}}(\mathbf{x}) \to y$ , and the mapping $f_{\mathrm{aspect}}(\mathbf{x}^i, \mathbf{t}^{i,k}) \to y^{i,k}$ is considered as $f_{\mathrm{fine}}(\mathbf{x}, \mathbf{t}_i) \to y_i$ . + +Then we choose the model for $\Theta_{\mathrm{enc}}$ , $\Theta_{\mathrm{p}}^{+}$ and $\Theta_{\mathrm{p}}^{*}$ . $\Theta_{\mathrm{p}}^{+}$ and $\Theta_{\mathrm{p}}^{*}$ are simple multilayer perceptron (MLP). It is worth noting that $\Theta_{\mathrm{enc}}$ can be a prior ABSA model. Thus, we argue that the DPL framework can be applied to most ABSA methods. Typically, we choose Bai et al. (2020)'s and Rietzler et al. (2019)'s works and a multi-task learning baseline as examples to verify. The results are shown in Table 3. + +# 5 Experiments + +# 5.1 Experimental Setup + +# 5.1.1 Dataset + +The experiments of the DPL framework require at least two datasets at different granularities. For the + +ABSA task, we select the SemEval dataset (Pontiki et al.) as the fine-grained sentiment task dataset and the Amazon reviews dataset from Kaggle4 as the coarse-grained sentiment task dataset. The SemEval datasets are used as our core task dataset, and the Amazon reviews dataset is used as an auxiliary dataset. + +Dataset SemEval. This dataset is SemEval 2014 task 4 subtask2 (Pontiki et al.). It has two subdatasets, the reviews in the restaurant and laptop domains. We show more details in Table 1. + +Dataset Amazon Reviews. The dataset contains 3.6 million sentences in the training set and 0.4 million sentences in the test set. Considering the huge data volume gap, we only chose the test set as the auxiliary dataset for this experiment. + +# 5.1.2 Generation of Pseudo Labels + +Here we provide some details of the pseudo labels generation process. + +As a result of the PL generation, the ABSA dataset has true aspect-level sentimental labels and pseudo-sentence-level sentimental labels, while the SA dataset has true sentence-level sentimental labels and pseudo-aspect-level sentimental labels. + +To get aspect terms from the sentence in the SA dataset, we first performed aspect extraction using the model proposed by Li et al. (2019) and discarded sentences without aspect terms. + +We train the model proposed by (Bai et al., 2020) as the teacher models on the aspect-level dataset with the accuracy scores of $86.05\%$ and $79.53\%$ respectively on the domain of Restaurant and Laptop. + +We train a BERT+Linear as the teacher model on the document-level dataset, with a $94.45\%$ accuracy score in the restaurant Domain and a $93.35\%$ accuracy score in the laptop domain. + +# 5.1.3 Implementation Details + +In addition to the above introduction, some more important details of our experiments need to be clarified for ease of understanding. + +# Evaluate Matrix + +The model for ABSA is tested on SemEval's test set. Like those who have performed this work before, we use the model classification accuracy (ACC) and macro-F1 (F1) scores as the evaluation criterion. + +# Batch Loader + +4www.kaggle.com/bittlingmayer/ amazonreviews + +
ModelRestaurantLaptop
AccF1AccF1
AuxiliaryHe et al. (2018)78.7368.6371.9168.79
Chen and Qian (2019)79.5571.4173.8770.10
He et al. (2019b)83.8975.6675.3672.02
Liang et al. (2020)84.9376.6677.5173.42
BERTBai et al. (2020)*86.0480.2779.5374.54
Pang et al. (2021)87.6682.9780.2277.28
Li et al. (2021)87.1381.1681.8078.10
Rietzler et al. (2019)87.8981.0580.2375.77
OursDPL89.5484.8681.9678.58
+ +Table 2: Results of different methods. "BERT" represents the works that are also based on the BERT (Devlin et al., 2018), "Auxiliary" represents the methods that also utilize auxiliary datasets to help the ABSA task. \*\* means our replication results. The results show that our method achieves state-of-the-art in this benchmark. + +Since the size of the current auxiliary dataset is much larger than the existing dataset. To avoid the large auxiliary dataset changing the original dataset distribution, we adopt two asynchronous loaders and define the step ratio $k$ , i.e., whenever the model is trained on the original dataset by 1 step, it is trained on the auxiliary dataset by $k$ steps. In general, we set $k = 1$ . + +# Model Implementation + +The encoder has three main structures for the ABSA task: BERT (Devlin et al., 2018), Relational Graph Attention Networks (RGAT) (Wang et al., 2020), and masking embedding module. The BERT and RGAT have been proved to have a good effect on this task. The mask embedding module is used to generate $\mathbf{z}$ and $\mathbf{h}$ . It is similar to the implementation of "segment_id" in the code of BERT. + +# 5.2 Main Results + +Table 2 shows that the DPL has achieved a state-of-the-art (SOTA) performance in terms of the average accuracy and F1-scores on the SemEval 2014 task 4 subtask 2 dataset. The group denoted as "Auxiliary Dataset is multi-task learning methods based on labeled datasets. Compared with them, our work shows the advantage of the PL method. "BERT-based" are some recently published works with good results. Obviously, our method achieves significant improvements over them. + +It should be noted that our design is based on the BERT. Thus the comparison is not made with the methods based on a more powerful pre-trained model, such as Roberta (Liu et al., 2019), DeBERTa (Silva and Marcacini), and GPT-3 (Floridi and Chiriatti, 2020). + +
ModelRestaurantLaptop
AccF1AccF1
RGAT (Bai et al., 2020)86.0480.2779.5374.54
RGAT+DPL87.2281.4781.0177.52
Improvement+1.18+1.20+1.48+2.98
Adapter(Rietzler et al., 2019)87.8981.0580.2375.77
Adapter+DPL89.5484.8681.9678.58
Improvement+1.65+3.71+1.73+2.81
MultiBERT84.5478.5278.3273.87
MultiBERT+DPL85.5279.6179.7575.80
Improvement+0.98+1.09+1.43+1.93
+ +Table 3: Results of Combining DPL with Other Methods. Restaurant and Laptop are two benchmarks same as those in Table 2. RGAT (Bai et al., 2020), Adapter (Rietzler et al., 2019) are typical ABSA methods. MultiBERT is a multi-task baseline implemented by us. It predicts the SA label based on the “[cls]” and predicts the ABSA task based on the specific word vector. We add the DPL framework to them, denoted as “+DPL”, and achieve significant improvements. + +# 5.3 DPL as a General Framework + +As we mentioned, we promote DPL as a general framework capable of combining other methods on the ABSA task. Table 3 shows the performances of some typical methods before and after they combine the DPL framework. On the one hand, RGAT (Bai et al., 2020) is a model architecture based on GAT and BERT. Thus the improvement shows that the DPL framework fits other architectural designs, even without auxiliary datasets. On the other hand, for those methods involving auxiliary datasets, we take Adapter (Rietzler et al., 2019) and MultiBERT for demonstration. Previous works are mainly divided into two categories, pretraining and multitask learning. Adapter (Rietzler et al., 2019) can be categorized into the pretraining class while MultiBERT is a multi-task learning baseline inspired by He et al. (2018). Since the previous works using the multi-task method to combine the SA and the ABSA datasets were LSTM based, we implemented a better model based on the BERT. All the improvements verify that the DPL framework does not conflict with these methods and exhibits full compatibility for further performance gains. + +# 5.4 Ablation Study + +We set up several sets of ablation experiments and present the results in Table 4 to explore the role of adversarial training and pseudo labels in the DPL framework. + +The above experiments contain two types of BERT on the SemEval Restaurant dataset. To ensure the fairness of the ablation experiments, we + +
ModelRestaurant+PreRestaurant
AccF1AccF1
DPL89.5484.8686.6880.44
Traditional Pseudo-Label-1.43-2.09-1.60-2.73
- adversarial training-1.96-3.31-1.96-3.60
- coarse-grained pseudo labels-1.60-2.74-1.34-1.35
- fine-grained pseudo labels-1.96-2.84-0.79-1.79
+ +Table 4: Results of ablation study. "Restaurant" takes plain BERT as the initial model while "Restaurant+Pre" takes Rietzler et al. (2019)'s BERT as the initial model. "DPL" denotes our method. "Traditional Pseudo-Label" represents we take the PL method for fine-grained tasks dropped out the coarse-grained labels. The last three cases named in the form of "- X" means that we deleted the "X" from the original DPL to evaluate the effect of "X". + +use the same parameters when training the same group, and the parameter configurations are shown in Appendix. + +The comparison with "Traditional Pseudo-Label" shows the advantages of our method. From the item "adversarial training", the significant decline on F1 reflects that adversarial training plays an important role in the DPL framework. The items, "coarse-grained pseudo labels" and "fine-grained pseudo labels", show that only adding adversarial training at one granularity has less effect than adding it both ways. + +Furthermore, we also take Chamfer Distance (CD) between the set of $\mathbf{h}$ and the set of $\mathbf{z}$ to provide an insight into the effect of the mutual exclusiveness. And the CD of the model with the adversarial training process is $30\%$ larger than that of the model without this process. That means the adversarial training process increases the distance between the variable $\mathbf{h}$ and $\mathbf{z}$ . + +# 6 Conclusion + +In this paper, we propose Dual-granularity Pseudo Labeling (DPL). DPL extends from the vanilla Pseudo-Label method and augments it to a dual-pathway system. It additionally enforces strong control of information flow directing to the data at different granularities of annotation. The results demonstrate the state-of-the-art performance of DPL on the data-scarce ABSA task. As a pioneering framework design, we also show that the DPL is compatible with pre-training and multi-task learning methods as published before. In the future, we hope to explore the possibility of DPL in other domains, such as computer vision problems where + +the discrepancy of granularities possesses. + +# Acknowledgements + +Yiming Zhang, Sai Wu and Junbo Zhao are supported by the Key R&D Program of Zhejiang Province (Grant No. 2020C01024). Sai Wu is also supported by Zhejiang Provincial Natural Science Foundation (grant number LZ21F020007) and NSFC (grant number 61872315). Yiming Zhang and Junbo Zhao would also like to thank the Fundamental Research Funds for the Central Universities. The authors would like to thank AI + High Performance Computing Center of ZJU-ICI. The authors also thank Bolun Wu, Guoyao Li, and anonymous reviewers for helpful feedback. + +# References + +Xuefeng Bai, Pengbo Liu, and Yue Zhang. 2020. Investigating typed syntactic dependencies for targeted sentiment classification using graph attention neural network. IEEE/ACM Transactions on Audio, Speech, and Language Processing. +Zhuang Chen and Tieyun Qian. 2019. Transfer capsule network for aspect level sentiment classification. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 547-556. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2018. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805. +Li Dong, Furu Wei, Chuanqi Tan, Duyu Tang, Ming Zhou, and Ke Xu. 2014. Adaptive recursive neural network for target-dependent twitter sentiment classification. In Proceedings of the 52nd annual meeting of the association for computational linguistics (volume 2: Short papers), pages 49-54. +Luciano Floridi and Massimo Chiriatti. 2020. Gpt-3: Its nature, scope, limits, and consequences. *Minds and Machines*, 30(4):681–694. +Zhenxin Fu, Xiaoye Tan, Nanyun Peng, Dongyan Zhao, and Rui Yan. 2018. Style transfer in text: Exploration and evaluation. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 32. +Zhengjie Gao, Ao Feng, Xinyu Song, and Xi Wu. 2019. Target-dependent sentiment classification with bert. IEEE Access, 7:154290-154299. +Yixiao Ge, Dapeng Chen, and Hongsheng Li. 2020. Mutual mean-teaching: Pseudo label refinery for unsupervised domain adaptation on person re-identification. arXiv preprint arXiv:2001.01526. + +Junxian He, Jiatao Gu, Jiajun Shen, and Marc'Aurelio Ranzato. 2019a. Revisiting self-training for neural sequence generation. arXiv preprint arXiv:1909.13788. +Ruidan He, Wee Sun Lee, Hwee Tou Ng, and Daniel Dahlmeier. 2018. Exploiting document knowledge for aspect-level sentiment classification. arXiv preprint arXiv:1806.04346. +Ruidan He, Wee Sun Lee, Hwee Tou Ng, and Daniel Dahlmeier. 2019b. An interactive multi-task learning network for end-to-end aspect-based sentiment analysis. arXiv preprint arXiv:1906.06906. +Binxuan Huang and Kathleen M Carley. 2019. Syntax-aware aspect level sentiment classification with graph attention networks. arXiv preprint arXiv:1909.02606. +Binxuan Huang, Yanglan Ou, and Kathleen M Carley. 2018. Aspect level sentiment classification with attention-over-attention neural networks. In International Conference on Social Computing, Behavioral-Cultural Modeling and Prediction and Behavior Representation in Modeling and Simulation, pages 197-206. Springer. +Long Jiang, Mo Yu, Ming Zhou, Xiaohua Liu, and Tiejun Zhao. 2011. Target-dependent twitter sentiment classification. In Proceedings of the 49th annual meeting of the association for computational linguistics: human language technologies, pages 151-160. +Guillaume Lample, Neil Zeghidour, Nicolas Usunier, Antoine Bordes, Ludovic Denoyer, and Marc'Aurelio Ranzato. 2017. Fader networks: Manipulating images by sliding attributes. arXiv preprint arXiv:1706.00409. +Lishuang Li, Yang Liu, and AnQiao Zhou. 2018. Hierarchical attention based position-aware network for aspect-level sentiment analysis. In Proceedings of the 22nd conference on computational natural language learning, pages 181-189. +Ruifan Li, Hao Chen, Fangxiang Feng, Zhanyu Ma, Xiaojie Wang, and Eduard Hovy. 2021. Dual graph convolutional networks for aspect-based sentiment analysis. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 6319-6329. +Xin Li, Lidong Bing, Wenxuan Zhang, and Wai Lam. 2019. Exploiting BERT for end-to-end aspect-based sentiment analysis. In Proceedings of the 5th Workshop on Noisy User-generated Text (W-NUT 2019), pages 34-41. +Yunlong Liang, Fandong Meng, Jinchao Zhang, Ji-nan Xu, Yufeng Chen, and Jie Zhou. 2020. An iterative knowledge transfer network with routing for aspect-based sentiment analysis. arXiv preprint arXiv:2004.01935. + +Pengfei Liu, Weizhe Yuan, Jinlan Fu, Zhengbao Jiang, Hiroaki Hayashi, and Graham Neubig. 2021. Pretrain, prompt, and predict: A systematic survey of prompting methods in natural language processing. arXiv preprint arXiv:2107.13586. +Shu Liu, Wei Li, Yunfang Wu, Qi Su, and Xu Sun. 2020. Jointly modeling aspect and sentiment with dynamic heterogeneous graph neural networks. arXiv preprint arXiv:2004.06427. +Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692. +Dehong Ma, Sujian Li, Xiaodong Zhang, and Houfeng Wang. 2017. Interactive attention networks for aspect-level sentiment classification. arXiv preprint arXiv:1709.00893. +Dimitrios Mallis, Enrique Sanchez, Matthew Bell, and Georgios Tzimiropoulos. 2020. Unsupervised learning of object landmarks via self-training correspondence. Advances in Neural Information Processing Systems, 33. +Igor Melnyk, Cicero Nogueira dos Santos, Kahini Wadhawan, Inkit Padhi, and Abhishek Kumar. 2017. Improved neural text attribute transfer with non-parallel data. arXiv preprint arXiv:1711.09395. +Subhabrata Mukherjee and Ahmed Awadallah. 2020. Uncertainty-aware self-training for few-shot text classification. Advances in Neural Information Processing Systems, 33. +Thien Hai Nguyen and Kiyoaki Shirai. 2015. Phrasernn: Phrase recursive neural network for aspect-based sentiment analysis. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pages 2509-2514. +Shinhyeok Oh, Dongyub Lee, Taesun Whang, IlNam Park, Gaeun Seo, EungGyun Kim, and Harksoo Kim. 2021. Deep context-and relation-aware learning for aspect-based sentiment analysis. arXiv preprint arXiv:2106.03806. +Shiguan Pang, Yun Xue, Zehao Yan, Weihao Huang, and Jinhui Feng. 2021. Dynamic and multi-channel graph convolutional networks for aspect-based sentiment analysis. In *Findings of the Association for Computational Linguistics: ACL-IJCNLP* 2021, pages 2627-2636. +Hieu Pham, Zihang Dai, Qizhe Xie, Minh-Thang Luong, and Quoc V Le. 2020. Meta pseudo labels. arXiv preprint arXiv:2003.10580. +Maria Pontiki, Haris Papageorgiou, Dimitrios Galanis, Ion Androutsopoulos, John Pavlopoulos, and Suresh Manandhar. Semeval-2014 task 4: Aspect based sentiment analysis. + +Alexander Rietzler, Sebastian Stabinger, Paul Opitz, and Stefan Engl. 2019. Adapt or get left behind: Domain adaptation through bert language model finetuning for aspect-target sentiment classification. arXiv preprint arXiv:1908.11860. +Tianxiao Shen, Tao Lei, Regina Barzilay, and Tommi Jaakkola. 2017. Style transfer from non-parallel text by cross-alignment. arXiv preprint arXiv:1705.09655. +Emanuel H Silva and Ricardo M Marcacini. Aspect-based sentiment analysis using bert with disentangled attention. +Youwei Song, Jiahai Wang, Tao Jiang, Zhiyue Liu, and Yanghui Rao. 2019. Attentional encoder network for targeted sentiment classification. arXiv preprint arXiv:1902.09314. +Kai Sun, Richong Zhang, Samuel Mensah, Yongyi Mao, and Xudong Liu. 2019. Aspect-level sentiment analysis via convolution over dependency tree. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 5683-5692. +Kai Sheng Tai, Richard Socher, and Christopher D Manning. 2015. Improved semantic representations from tree-structured long short-term memory networks. arXiv preprint arXiv:1503.00075. +Duyu Tang, Bing Qin, and Ting Liu. 2016. Aspect level sentiment classification with deep memory network. arXiv preprint arXiv:1605.08900. +Duy-Tin Vo and Yue Zhang. 2015. Target-dependent twitter sentiment classification with rich automatic features. In Twenty-fourth international joint conference on artificial intelligence. +Kai Wang, Weizhou Shen, Yunyi Yang, Xiaojun Quan, and Rui Wang. 2020. Relational graph attention network for aspect-based sentiment analysis. arXiv preprint arXiv:2004.12362. +Shuai Wang, Sahisnu Mazumder, Bing Liu, Mianwei Zhou, and Yi Chang. 2018. Target-sensitive memory networks for aspect sentiment classification. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 957-967. +Yequan Wang, Minlie Huang, Xiaoyan Zhu, and Li Zhao. 2016. Attention-based LSTM for aspect-level sentiment classification. In Proceedings of the 2016 conference on empirical methods in natural language processing, pages 606-615. +Qizhe Xie, Minh-Thang Luong, Eduard Hovy, and Quoc V Le. 2020. Self-training with noisy student improves imagenet classification. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10687-10698. + +Hu Xu, Bing Liu, Lei Shu, and Philip S Yu. 2019. Bert post-training for review reading comprehension and aspect-based sentiment analysis. arXiv preprint arXiv:1904.02232. +Hang Yan, Junqi Dai, Xipeng Qiu, Zheng Zhang, et al. 2021. A unified generative framework for aspect-based sentiment analysis. arXiv preprint arXiv:2106.04300. +Heng Yang, Biqing Zeng, JianHao Yang, Youwei Song, and Ruyang Xu. 2019. A multi-task learning model for chinese-oriented aspect polarity classification and aspect term extraction. Neurocomputing, 419:344-356. +Guoxin Yu, Xiang Ao, Ling Luo, Min Yang, Xiaofei Sun, Jiwei Li, and Qing He. 2021a. Making flexible use of subtasks: A multiplex interaction network for unified aspect-based sentiment analysis. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, pages 2695-2705. +Jianfei Yu, Chenggong Gong, and Rui Xia. 2021b. Cross-domain review generation for aspect-based sentiment analysis. In *Findings of the Association for Computational Linguistics: ACL-IJCNLP* 2021, pages 4767-4777. +Chen Zhang, Qiuchi Li, and Dawei Song. 2019. Aspect-based sentiment classification with aspect-specific graph convolutional networks. arXiv preprint arXiv:1909.03477. +Meishan Zhang, Yue Zhang, and Duy-Tin Vo. 2016. Gated neural networks for targeted sentiment analysis. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 30. +Junbo Zhao, Yoon Kim, Kelly Zhang, Alexander Rush, and Yann LeCun. 2018. Adversarially regularized autoencoders. In International conference on machine learning, pages 5902-5911. PMLR. +Barret Zoph, Golnaz Ghiasi, Tsung-Yi Lin, Yin Cui, Hanxiao Liu, Ekin D Cubuk, and Quoc V Le. 2020. Rethinking pre-training and self-training. arXiv preprint arXiv:2006.06882. \ No newline at end of file diff --git a/towardsunifyingthelabelspaceforaspectandsentencebasedsentimentanalysis/images.zip b/towardsunifyingthelabelspaceforaspectandsentencebasedsentimentanalysis/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..e6fee0086091f87d4e54c7829d9410550e14f4de --- /dev/null +++ b/towardsunifyingthelabelspaceforaspectandsentencebasedsentimentanalysis/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2f6af3dd9474ad792fd76900692f728fbbaffccb90e6b3c24d967da5efb70ba0 +size 232333 diff --git a/towardsunifyingthelabelspaceforaspectandsentencebasedsentimentanalysis/layout.json b/towardsunifyingthelabelspaceforaspectandsentencebasedsentimentanalysis/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..d7e3ae8a323d377cf1a718e67dbc9595a26a3968 --- /dev/null +++ b/towardsunifyingthelabelspaceforaspectandsentencebasedsentimentanalysis/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ac2edbb4669911080710b37c279bf18ceeb37b14bd0c95fe9062b3340b65da0d +size 473255 diff --git a/trainingdynamicsfortextsummarizationmodels/cc6405f0-a0bf-40f5-88ea-06cc30cbfe7a_content_list.json b/trainingdynamicsfortextsummarizationmodels/cc6405f0-a0bf-40f5-88ea-06cc30cbfe7a_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..8074dfaa3c671f2173ef42bad80043548e6a9fd1 --- /dev/null +++ b/trainingdynamicsfortextsummarizationmodels/cc6405f0-a0bf-40f5-88ea-06cc30cbfe7a_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:42c49c324af3899b0057ad98d74f0c83cf4ed080177cfaf5bcf7d852f8f900c5 +size 83422 diff --git a/trainingdynamicsfortextsummarizationmodels/cc6405f0-a0bf-40f5-88ea-06cc30cbfe7a_model.json b/trainingdynamicsfortextsummarizationmodels/cc6405f0-a0bf-40f5-88ea-06cc30cbfe7a_model.json new file mode 100644 index 0000000000000000000000000000000000000000..57497b89894a143ce70531b0e3ddecc833d5ba32 --- /dev/null +++ b/trainingdynamicsfortextsummarizationmodels/cc6405f0-a0bf-40f5-88ea-06cc30cbfe7a_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:53e562d2267e231be47e760bfb56dce5e68a82da51583e51323a508bddb745d2 +size 96704 diff --git a/trainingdynamicsfortextsummarizationmodels/cc6405f0-a0bf-40f5-88ea-06cc30cbfe7a_origin.pdf b/trainingdynamicsfortextsummarizationmodels/cc6405f0-a0bf-40f5-88ea-06cc30cbfe7a_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..3405c4680a71325d2b6f74531809ffccf9f921cc --- /dev/null +++ b/trainingdynamicsfortextsummarizationmodels/cc6405f0-a0bf-40f5-88ea-06cc30cbfe7a_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b037b6e3936cdf459278ae9c998218670d8fc59fb7081b41120488c6dea4e1f5 +size 1500496 diff --git a/trainingdynamicsfortextsummarizationmodels/full.md b/trainingdynamicsfortextsummarizationmodels/full.md new file mode 100644 index 0000000000000000000000000000000000000000..356897f54ac863a514dfc803bf955a5f878245a8 --- /dev/null +++ b/trainingdynamicsfortextsummarizationmodels/full.md @@ -0,0 +1,300 @@ +# Training Dynamics for Text Summarization Models + +Tanya Goyal + +Jiacheng Xu1 Junyi Jessy Li2 + +$^{1}$ Department of Computer Science + +$^{2}$ Department of Linguistics + +The University of Texas at Austin + +tanyagoyal@utexas.edu + +Greg Durrett1 + +# Abstract + +Pre-trained language models (e.g. BART) have shown impressive results when fine-tuned on large summarization datasets. However, little is understood about this fine-tuning process, including what knowledge is retained from pre-training time or how content selection and generation strategies are learnt across iterations. In this work, we analyze the training dynamics for generation models, focusing on summarization. Across different datasets (CNNDM, XSUM, MEDIASUM) and summary properties, such as abstractiveness and hallucination, we study what the model learns at different stages of its fine-tuning process. We find that a propensity to copy the input is learned early in the training process consistently across all datasets studied. On the other hand, factual errors, such as hallucination of unsupported facts, are learnt in the later stages, though this behavior is more varied across domains. Based on these observations, we explore complementary approaches for modifying training: first, disregarding high-loss tokens that are challenging to learn and second, disregarding low-loss tokens that are learnt very quickly in the latter stages of the training process. We show that these simple training modifications allow us to configure our model to achieve different goals, such as improving factuality or improving abstractiveness. $^{1}$ + +# 1 Introduction + +Transformer-based pre-training (Lewis et al., 2020; Zhang et al., 2020) has led to substantial improvements in the performance of abstractive summarization models. This pre-training and fine-tuning paradigm has been widely studied with respect to what training datasets, model sizes and other hyperparameters are needed to optimize task-specific evaluation metrics, such as perplexity or ROUGE + +for text generation. However, abstractive summarization is a complex task involving several components such as content selection and rewriting that are performed implicitly by end-to-end models such as BART (Lewis et al., 2020) or PEGASUS (Zhang et al., 2020). Currently, we have little insight into this aspect of the fine-tuning process, namely what "skill" or behavior is learnt at which stage of the training process. + +Recent work (Schuster et al., 2019; Utama et al., 2020a) has studied training dynamics for sequence classification tasks such as NLI and fact verification, demonstrating how these can be leveraged to mitigate dataset biases. However, text generation is a substantially different task from classification, due to the sequential nature of predictions and the mismatch between teacher-forced training and inference time. The nature of the training process and potential interventions to modify what gets learned are poorly understood. + +In this paper, we make the first attempt at understanding the fine-tuning process of large pre-trained language models for summarization. We study two essential components of abstractive summarization models, abstractiveness and factual consistency, and investigate when each of these is learned during fine-tuning. Experiments are conducted on three different summarization datasets: XSUM (Narayan et al., 2018), CNNDM (Hermann et al., 2015; Nallapati et al., 2016) and MEDIASUM (Zhu et al., 2021) to study these properties across a range of datasets. + +Our findings are threefold: First, we find that easy-to-learn skills such as copy behavior are acquired very early in the fine-tuning process. In fact, for datasets that have a high fraction of extractive summaries, the summarization models tend to overfit to these easier examples, effectively ignoring harder examples in the dataset. Next, we investigate how factual correctness of summaries evolves with the fine-tuning process, juxtaposing it against other factors such as abstractiveness and + +dataset quality. In particular, we find that while non-factuality and abstractiveness are roughly proportional to each other, longer training on noisy datasets can significantly hurt factuality. + +Finally, we show that insights from these training dynamics can be leveraged to optimize along target summarization goals like factuality or abstractiveness. We extend prior work on loss truncation (Kang and Hashimoto, 2020), using token sub-sampling to dynamically modify the loss computation during training to alter the learnt behavior of summarization models. In particular, we show that we can substantially improve the factuality of summarization models trained on noisy datasets (e.g. XSUM) by downweighting high-loss tokens while preserving the high level of abstractiveness. Conversely, downweighting low-loss tokens under the same framework allows us to significantly improve the abstractiveness of generated summaries compared to the baseline models for relatively extractive datasets (e.g. CNNDM and MEDIASUM). + +# 2 Learning Dynamics + +# 2.1 Datasets and Setup + +We study learning dynamics for summarization models trained on three English-language news datasets: (1) XSUM: an "extreme" summarization dataset with single-sentence and highly abstractive summaries (2) CNN/DAILYMAIL, a multisentence summary dataset with a considerably lower degree of abstraction. (3) MEDIASUM, a media interview summarization dataset with a degree of abstraction closer to CNNDM than XSUM. We focus on the NPR-specific subset of this dataset which contains multi-sentence summaries. These datasets were selected because of the diversity of their respective reference summaries along properties such as lexical overlap, length, and lead-bias within the news summarization domain. This allows us to study learning dynamics across a range of summarization dataset types. + +Experiments are performed using BART-LARGE and PEGASUS-LARGE as the base models. For each dataset, the model checkpoints are saved periodically (every 2k steps for XSUM and MEDIASUM, every 1k steps for CNNDM) and analyzed at 10 different stages of the fine-tuning process (9 intermediate checkpoints + final model). Training details are in Appendix A. We probe the model behavior at each checkpoint via two types of signals: + +1. Model-generated summaries: For each + +dataset, we randomly sample 800 (article, reference summary) pairs from the development set. At each checkpoint, we generate summaries on this set of articles to study the inference-time behavior of the summarization models at different stages of their training trajectories. + +2. Token-level output probabilities for reference summaries: Summarization models place a probability distribution over the entire output space and generated summaries are samples from the high probability regions. But looking only at these summaries does not tell us what doesn't get learned during training. To understand this aspect, we additionally analyze the models' output probabilities for reference summaries. Comparing reference summaries from low probability and high probability regions can provide further insight into the model behavior. + +# 2.2 Case Study 1: Abstractiveness + +Hypothesis Reference summaries from the three summarization datasets: XSUM, MEDIASUM and CNNDM exhibit varying degrees of abstraction. In this section, we aim to study the how to the learning trajectory of this property during fine-tuning differs between the three datasets. We measure the degree of abstraction of the generated or reference summaries by the fraction of copied n-grams from the source article, for $n \in \{1, 2, 3, 4\}$ , which we call n-gram overlap. We hypothesize that a pre-trained model trained on some dataset should emulate its n-gram overlap statistics when evaluated on held-out instances from that dataset. + +Results Figure 1 shows the n-gram overlap of generated summaries (800 examples from the dev set) at different stages of the training process. The dotted lines in the graph represent the n-gram overlap of the reference summaries with the source article; this is the target degree of abstractiveness for the summarization models. The graphs show that for both BART- and PEGASUS-based models, the generated summaries exhibit high overlap at the start of the training process, probably because the model parameters are initialized with BART-LARGE or PEGASUS-LARGE which include high amount of copying. This overlap steadily decreases with more training steps. + +However, the summarization models show varying degrees of success at achieving the target level of abstractiveness in each dataset. For the XSUM + +![](images/6288cde04f8a7e5a269491547a2d94818596f766d816635d9f6190ebec85b5a4.jpg) +Figure 1: N-gram overlap of the generated summaries with the source article at different time steps. For CNNDM and MEDIASUM, the summaries fail to achieve the target degree of abstractiveness (denoted by the dotted lines). + +![](images/688d302ca1fca719eba28d9bb87b8b92cfe25c8e1e3f69b950299e57212b5d7f.jpg) +Figure 2: ROUGE scores of the generated summaries of all datasets at different training stages. + +dataset, the model behavior approaches the target abstractiveness quite early in the training process (after only $10\%$ of the training for BART and approximately $30\%$ of the training for PEGASUS), after which it plateaus. However, Figure 2 shows that the quality of the generated summaries continues to improve with more training: for BART, it increases from 41.9 ROUGE-1 at $10\%$ of the training, to 44.7 at the end of the training process. On the other hand, for both CNNDM and MEDIASUM, the model generated summaries never achieve the target level of abstractiveness. This is especially true for CNNDM; the n-gram overlap stabilizes after $30\%$ of the training for BART and + +$60\%$ for PEGASUS, differing substantially from the gold. For MEDIASUM, the the BART model shows a steadily decreasing trend, although it is not accompanied by a corresponding increase in quality (see Figure 2). + +Interestingly, XSUM models show greater success at achieving the target degree of abstraction compared to the others, even though their target abstractiveness is lower and involves a greater change in the model behavior from the initial stage. + +Analysis Why do some models fail to achieve the target n-gram overlap? Our hypothesis is that summarization models overfit on the easier examples in the training dataset, i.e. those that have high word level overlap with the source article. This is exacerbated in CNNDM and MEDIASUM datasets which include a large fraction of such high overlap examples, compared to XSUM which has a negligible fraction of these. Prior work has reported similar observations about overfitting for sequence classification tasks (Utama et al., 2020b). + +To test this hypothesis, we randomly sample 1000 examples from the training data and compare the token-level output probabilities of high overlap (easier-to-learn) and low overlap (harder-to-learn) examples at different stages of the training process. These are chosen as the top and bottom $25\%$ of the samples in terms of bigram overlap respectively. We conduct this analysis only for the BART-based models, shown in Figure 3. For the XSUM dataset, we observe that although the mean output probability of the high overlap summaries is generally higher, the model also assigns similarly high proba + +![](images/9fc6e0ecf863b359df1e3e74dc4a4b07593ee5e84d02712ce48d4633dcf18ff2.jpg) +Figure 3: Comparison of summary-level output probabilities between high-overlap and low-overlap subsets for the BART models. For both CNNDM and MEDIASUM, high-overlap summaries are predicted with substantially higher confidence compared to low-overlap examples. + +![](images/69d24c540f9a34b5129f5ea68fb82dac07edad0f32d844d25a656cd1b3e4a373.jpg) + +![](images/4151232e5f112e8a50c35766260c997b354aed2ff0c0acf8dc18c1576cea1947.jpg) + +bilities to the low overlap examples. $^2$ On the other hand, for both CNNDM and MEDIASUM, there exists a substantial difference between the probabilities from these two sets of examples, resulting in the generation of more extractive summaries for these datasets. + +Conclusions For both CNNDM and MEDIASUM, models do not achieve their target level of n-gram overlap. Although Figure 3 shows that the model performance on the low overlap, i.e. harder examples, steadily improves as training progresses, this does not translate into higher inference-time abstractiveness of generated summaries. During inference, generated summaries are constructed by sampling the highest probability token at each time step (assume greedy decoding). Therefore, even though the probability of sampling abstractive tokens increases (blue boxes in Figure 3), it is still substantially lower than that of sampling extractive summaries (red boxes in Figure 3) and the model prefers to generate more extractive summaries. In this respect, generation models differ from sequence classification models such as BERT-based models in how such graphs must be interpreted. For the latter, improvement in performance on harder examples indicate that the model would similarly perform better when it encounters these in the test data. + +These dynamics indicate that training longer is insufficient to get better performance. Deeper modifications to the training procedure are needed to result in better test-time behavior. + +# 2.3 Case Study 2: Factuality + +Hypothesis Next, we evaluate the factual correctness of the generated summaries. Prior work (Maynez et al., 2020; Goyal and Durrett, 2021) has shown that BART-based summarization models, despite their impressive ROUGE scores, tend to produce non-factual summaries. In this section, we study how the factuality of generated summaries evolves during training. We hypothesize that models make more factual errors in the initial stages. Longer training, however, should gradually lead to better factuality as they learn from the data, albeit never becoming perfect. + +Results To measure factuality, we use factuality models provided by Goyal and Durrett (2021). Given an input article $A$ , and a generated summary $S'$ , the model predicts a factuality label $y \in \{\text{non - factual}, \text{factual}\}$ , denoting whether the summary $S'$ contains factual errors or not. We directly use their pre-trained factuality models for XSUM and CNNDM. For the MEDIASUM dataset, we use the CNNDM model as its generated summaries are closer to the ones from MEDIASUM in terms of abstractiveness and length. We report the sentence error rate (SER) for 800 (article, generated summary) pairs from the development set at each training checkpoint. SER is computed as the fraction of generated sentences that are non-factual with respect to the article $A$ . + +Figure 4 shows the SER at different training steps for all BART- and PEGASUS-based models. First, we see that the sentence-level error rate is roughly proportional to the abstractiveness of the generated summaries for the three datasets: the generated summaries in XSUM have high error rates compared to the other datasets. Moreover, + +![](images/b0be0e6a771e2d020075d1354121b4bee325534a787028bb1949f8409d473cd6.jpg) +Figure 4: Factuality Sentence Error Rate of the generated summaries at different time steps during training. The graph shows that factual error rate is roughly proportional to abstractiveness (compare plot trends with Figure 1) for CNNDM and MEDIASUM. + +we see that the sentence-level error rate trajectories of both MEDIASUM and CNNDM mirrors the corresponding changes in abstractiveness in Figure 1. For instance, for the BART-based CNNDM model, the sudden drop in n-gram overlap at $30\%$ is accompanied by a corresponding increase in the sentence-level error rates. Similarly, the error rate steadily increases for the PEGASUS-based CNNDM model, following the steady decrease in overlap. + +Apart from abstractiveness, recent work (Maynez et al., 2020; Goyal and Durrett, 2021) has identified the inherent noise in XSUM's reference summaries as a major reason for factuality errors. They show that around $70\%$ of XSUM's training data consists of hallucinated content in gold summaries, which encourages the models to similarly learn to hallucinate facts. Figure 5 shows an illustrative example comparing the learning process of factual and hallucinated content in gold summaries during training. The graph plots the change in predicted probabilities for tokens in the reference summary. It shows that the model learns to predict correct information (package) with high confidence early in the training process. On the other hand, hallucinated information (Party) is learnt later in training. Moreover, throughout the training process, we notice that hallucinated tokens from the reference summaries are generally predicted with lower confidence than factual tokens. We use this observation to distinguish between factual and non-factual reference summaries in Section 3.3. + +Conclusions For XSUM, as a model trains for longer, it learns idiosyncrasies and hallucinations in + +Input Article: Army explosives experts were called out to deal with a suspect package at the offices on the Newtownards Road on Friday night. [...] The premises, used by East Belfast MP Naomi Long, have been targeted a number of times. [...] Condemning the latest hoax, Alliance MLA Chris Lyttle said [...] + +![](images/ea916efcd39e0f9aa0e057239b76d431efec67268e0a4584cf3f93e9927375fc.jpg) +Figure 5: Example showing the token-level output probabilities at different training stages for hallucinated and factual words in an XSUM gold summary. The graph shows that factual content is predicted with higher confidence. + +the training data. These do not systematically result in higher amounts of abstractiveness as training progresses, but instead yield a gradual increase in factual errors. Once again, training for longer is not the answer. + +# 3 Improving Training + +In Section 2.2, we saw evidence that summarization models tend to overfit on easier examples, i.e., the more extractive examples that are learnt earlier in the training process. On the other hand, Section 2.3 showed that for noisy datasets such as XSUM, correct information is assigned high probability scores earlier in the training process whereas hallucinated tokens are learnt with lower confidence. In this section, we operationalize these observations to improve the abstractiveness of generated summaries for CNNDM and MEDIASUM, and factuality of generated summaries for XSUM. + +# 3.1 Loss Truncation + +The core idea behind our approach is to modify the loss computation during the later stages of the training process, either disregarding high loss tokens to encourage factuality or low loss tokens to encourage abstractiveness. + +Algorithm 1 outlines our proposed approach. For the first $K$ steps, standard training procedure is followed to train model $M$ . After $K$ steps, the loss function is modified to only incorporate the loss from a subset of tokens based on the summary prop + +# Algorithm 1 LOSSTRUNCATION + +Input: Model $M$ , percentile $p$ , standard training steps $K$ , target $\in$ {abstractiveness, factuality} + +for $t$ in 0 to $T$ $l_{0\dots n}\gets loss_M(x,s)$ $q\gets$ UpdateThresholdEstimate $(l,p)$ +if $t > K$ +if abstractiveness + $m_j = \mathbb{1}[l_j > q]$ // truncate low loss tokens +else if factuality + $m_j = \mathbb{1}[l_j < q]$ // truncate high loss tokens + $l_j\gets m_jl_j$ $M\gets$ GradientUpdate(l) +return $M$ + +![](images/5f74837d75aac87965888f586bc5eef0e3f0ca0b11ad503177a4f02667078074.jpg) +Figure 6: Modified training under loss truncation. After $K$ steps of standard training, loss is computed on a subset of the tokens. To encourage factuality, high-loss tokens (↑) are excluded from the final loss computation whereas tokens with low loss (↓) are excluded to encourage abstractiveness. + +erty being targeted. To improve abstractiveness, tokens that have low loss $(l_{j} < q)$ are excluded from the final loss computations; the assumption is that these are extractive tokens learnt with high confidence early in the training. Models trained using this strategy are denoted by +Abstractive. On the other hand, tokens that have high loss $(l_{j} > q)$ during the later stages of the training are excluded to encourage factuality. These models are denoted by a +Factuality suffix. For both these different models, the threshold $q$ between high and low loss is controlled through the percentile hyperparameter $p$ . Throughout training, we dynamically update this threshold $q$ , based on the loss statistics for the last 10k tokens. + +The overall loss truncation procedure is illustrated in Figure 6. For $+\text{abstractive}$ , the losses associated with predicting the tokens left and an are low, and hence removed from the final loss computation. For $+\text{factuality}$ , the loss associated with token outside is high under the current model, and + +is excluded from the loss calculation. + +Note that the loss truncation strategy to improve factuality is designed specifically to target the inherent noise in datasets like XSUM. Concretely, the approach attempts to identify and remove hallucinated content within gold summaries, enabling the model to only learn from factual content in the reference summaries. Therefore, datasets such as CNNDM and MEDIASUM are not the appropriate test bed for our factuality analysis as they do not suffer from similar noise in their training data. + +# 3.2 Encouraging abstractiveness + +First, we investigate the performance of the loss truncation approach at encouraging the abstractiveness of CNNDM or MEDIASUM models. We omit XSUM from our analysis of abstractiveness as the baseline BART model in Section 2 already achieves the target degree of abstraction for this dataset. Since both BART- and PEGASUS-based models have shown similar learning dynamics, we conduct experiments in this section only on the BART-based models. + +Setup For both MEDIASUM and CNNDM, we train models for 8k steps. We set $K = 3\mathrm{k}$ : standard training is followed for the first 3k steps, followed by loss truncation for the remaining 5k steps. We set $p = 20$ for our experiments. For comparison, we include two baselines: (1) A model with parameters initialized with BART-LARGE (same as Section 2.2) and trained for 8k steps. (2) A model with parameters initialized with BART-LARGE-XSUM: its zero shot usage produces highly abstractive summaries. Here, we test if fine-tuning from this point helps with respect to abstractiveness. + +Results Figure 7 shows the abstractiveness patterns for the different models for both CNNDM and MEDIASUM. For both datasets, while the models initialized with BART-LARGE-XSUM generate highly abstractive summaries in the beginning, finetuning for even a small number of steps results in overfitting to the extractive examples. In fact, the patterns for both the baselines look quite similar indicating that we do not derive any transfer learning benefits from the summarization skills encoded in BART-LARGE-XSUM. On the other hand, we see that the model trained with loss truncation leads to substantially more abstractive summaries, across both datasets. As expected, the level of abstractiveness drops sharply after $3\mathrm{k}$ + +![](images/fada05149c118b0a802f0090a9e1464c4b0e0aa1e1558c8f4fdea8d021d34558.jpg) +Figure 7: N-gram overlap of the generated summaries in CNNDM and MEDIASUM. Initializing from BART-XSUM offers no benefits over the baseline. On the other hand, loss truncation is successful at enforcing abstractiveness; generated summaries for both datasets are closer to the target abstractiveness of reference summaries. + +Input Article: Milan goalkeeper Dida has been cleared to play in next month's Champions League match at Shakhtar Donetsk after partially winning his appeal to UEFA against a two-match ban. Dida has had one game of his two-match ban suspended for a year following an appeal to UEFA. [...] Dida sits out the home tie against Shakhtar on Wednesday after an inquiry ... +Gold: Milan goalkeeper D ##ida is partially successful against a two-matchUEFA ban ... + +
0 - 3k steps>3k steps>5k steps>7k steps
Milan
goalkeeper
D
##ida
partially
successful
against
+ +Figure 8: Example showing loss modification to improve abstractiveness. The table shows which tokens are retained (green checkmark) or dropped (red cross) from the loss computation at different training stages. During later stages of the training, when loss truncation is applied, copied tokens are excluded from the loss. + +steps, i.e., when loss truncation is applied, and continues to decrease steadily. Moreover, the graphs show that the models trained with loss truncation are able to come close to the target level of abstractiveness for the respective datasets, which both the baselines models struggled with. + +In Section 2.3, we discussed the trade-off between abstractiveness and factuality for summarization models. Our approach exposes a controllable lever, through the percentile hyperparameter $p$ , that can be set by users to balance between these two properties based on their requirements. + +Qualitative Analysis Figure 8 shows the loss modification for a training example at different stages using our +Abstractive strategy. The input article (truncated) and tokenized reference summary are stated at the top. Abstractive n-grams in the reference summary, i.e. those not exactly copied from the input article are highlighted in blue. The bottom half of the figure shows which tokens' prediction loss is included in the loss computation at different training stages. For the first 3k steps, all tokens' loss is aggregated. To encourage the model to learn abstractive strategies, we want to target the loss corresponding to the highlighted tokens. These represent an abstractive, somewhat subjective description of the events, and requires synthesizing information in a complex way. We observe that +Abstractive achieves this goal: the abstractive tokens (partially, successful, against) are high loss tokens after the initial training. Therefore, only these are included in the loss to train the model in subsequent time steps. On the other hand, tokens continuing a copied phrase (goalkeeper) usually have lower loss after the initial training and do not contribute to the gradient update in later stages. + +# 3.3 Improving Factuality + +Next, we study if similar down-weighting of knowledge learnt later in the training (+Factuality) can improve factual consistency of BART models. As mentioned previously, this strategy to improve factuality is designed for noisy datasets. Therefore, we only consider XSUM for our analysis. + +![](images/c11da13cad41d162214d11082b958c959919e947ba6fbbfd8c9fdb8771364976.jpg) +Figure 9: Factuality of output summaries for the baseline and loss truncation variants. The plot shows that compared to the standard BART baseline, token-level loss truncation improves factuality, with comparable results on abstractiveness and ROUGE. +Figure 10: Example illustrating +factuality loss modification. The table shows which tokens are retained or dropped from the loss computation at each training stage. We can see that high-loss generally corresponds with hallucinated content. + +Setup Apart from our token-level loss truncation outlined above, we also compare with a summary-level baseline from prior work (Kang and Hashimoto, 2020): summary-level loss is obtained during training (average of token-level losses) and those with loss greater than the $p$ percentile mark are excluded from the loss computation. We call this +Factuality sentence-level. We set $p = 50$ for both our token- and sentence-level experiments. All models (including the baseline) are trained for a total of 10k steps: standard training for the first 5k steps, followed by loss truncation. + +Results Figure 9 shows the factuality trajectory for the different models. We see that the factual consistency of the generated summaries improves when token-level loss truncation is enforced, dropping after 5k steps when the +Factuality token-level loss modification is applied. On the other hand, the summary-level approach from prior work does not lead to better factuality compared to the baseline. We hypothesize that this is because factual errors occur locally within the summary; 3-4 erroneous words within a 20 word summary. Therefore, averaging over all tokens makes it harder to distinguish between factual and non-factual summaries. Moreover, we also observe that the token-level approach leads to better factuality without compromising on abstractiveness. Recent work (Ladhak et al., 2021) has shown that most prior work enforces factuality by sacrificing on the abstractiveness of generated summaries. Our analysis in Section 2.3 demonstrated a similar tradeoff between factuality and abstractiveness. How + +Input Article: Lam, 28, joined the club in 2014, [...] has ignored interest elsewhere to re-sign. [...] "I feel I've got unfinished business here. [...] I'm not getting any younger, two more years takes me up to 30 and then I'll have to start thinking about what I do after rugby. There are not too many years left in me and I'd like to see my years out at Bristol." + +Gold: Bristol flank #er Jack Lam has signed a new two-year contract with the Championship club until 2018. + +
0 - 5k steps>5k steps>7k steps>9k steps
Bristol
flank
##er
Jack
Lam
two
year
Champion- +ionship
club
until
2018
+ +ever, we see that our proposed loss truncation approach improves factuality without sacrificing the abstractiveness of generated summaries. Examples of generated summaries sampled from the baseline BART model and our +Abstractive approach are included in Appendix B. + +Qualitative Analysis Figure 10 shows an article-summary pair from XSUM training data. The hallucinated information in the reference summary, i.e. unsupported by the article, is highlighted in red. Claims that are similarly unsupported but stated in the article in other contexts are in blue. The correct parts of the gold summary are in black. The table at the bottom outlines which tokens' loss is included in the loss computation during training at different stages of the training, with high-loss (top- $p$ percentile) tokens being excluded. + +For the first 5k steps, losses corresponding to all tokens are aggregated. Thereafter, we see that the high-losses generally correspond with non-supported tokens and are removed. For e.g., the input article does not mention the first name Jack of player Jack Lam, and the loss corresponding to predicting Jack is removed from the overall loss. Similarly, other hallucinated tokens are successfully identified and removed, such as 'until 2018' and 'Championship'. However, some hallucinated to + +kens have low loss (and get retained in loss computation) if the probability of predicting them is high due to their prefix. For example, although flank is correctly identified as unsupported, the probability of predicting the ensuing subword ##er is high (i.e. low loss). Similarly, although two is correctly identified as unsupported, the model predicts year with high confidence. Examples of inference-time generated summaries using the baseline BART model and our loss truncation approach are included in Appendix B. + +# 4 Related Work + +Abstractive Summarization Prior work in abstractive summarization has evaluated summaries along various parameters such as grammaticality and informativeness (Woodsend and Lapata, 2012), agreement with reference (Lin, 2004; Zhao et al., 2019) and content selection (Nenkova and Passonneau, 2004; Deutsch et al., 2021). Recently, approaches to evaluate the factual correctness of abstractive summarization have been proposed (Falke et al., 2019; Kryscinski et al., 2020; Goyal and Durrett, 2020). However, all these have focused on only evaluating the final generated summary. Finally, both improving abstractiveness (Song et al., 2020) and factuality (Goyal and Durrett, 2021) have been explored in recent work; in this paper, we explore if simpler techniques inspired by the training dynamics can achieve similar goals. + +Evaluating across learning time steps Recent work has studied learning dynamics of LSTM models (Saphra and Lopez, 2019) and pre-trained transformer models (Liu et al., 2021) across aspects such as linguistic knowledge, topicalization, reasoning, etc. Another line of work has explored this in the context of mitigating known dataset biases (Gururangan et al., 2018) for tasks such as paraphrase identification, entailment, etc. (He et al., 2019; Utama et al., 2020a). Broadly, these have proposed techniques such as example reweighting (Schuster et al., 2019), ensembling (Clark et al., 2019) or loss truncation (Kang and Hashimoto, 2020) to modify the model's learnt behavior. + +# 5 Conclusion + +In this paper, we study when different summarization skills are learnt during training. We show that copy behavior is learnt early while hallucination is learnt in the later stages. Based on these observations, we propose a simple token-level loss + +truncation strategy that can be used to achieve notable improvements in abstractiveness for CNNDM and MEDIASUM, and factuality in XSUM. + +# Acknowledgments + +This work was partially supported by NSF Grants IIS-1814522, IIS-1850153, IIS-2107524, a gift from Salesforce Research, a gift from Amazon, and the Good Systems program from the Office of the Vice President of Research at UT Austin. Thanks as well to the anonymous reviewers for their helpful comments. + +# References + +Christopher Clark, Mark Yatskar, and Luke Zettle-moyer. 2019. Don't take the easy way out: Ensemble based methods for avoiding known dataset biases. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 4060-4073. +Daniel Deutsch, Tania Bedrax-Weiss, and Dan Roth. 2021. Towards question-answering as an automatic metric for evaluating the content quality of a summary. Transactions of the Association for Computational Linguistics, 9:774-789. +Tobias Falke, Leonardo FR Ribeiro, Prasetya Ajie Utama, Ido Dagan, and Iryna Gurevych. 2019. Ranking generated summaries by correctness: An interesting but challenging application for natural language inference. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 2214-2220. +Tanya Goyal and Greg Durrett. 2020. Evaluating factuality in generation with dependency-level entailment. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: Findings, pages 3592-3603. +Tanya Goyal and Greg Durrett. 2021. Annotating and modeling fine-grained factuality in summarization. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 1449-1462. +Tanya Goyal, Nazneen Fatema Rajani, Wenhao Liu, and Wojciech Krysciński. 2021. Hydrasum: Disentangling stylistic features in text summarization using multi-decoder models. arXiv preprint arXiv:2110.04400. +Suchin Gururangan, Swabha Swayamdipta, Omer Levy, Roy Schwartz, Samuel Bowman, and Noah A Smith. 2018. Annotation artifacts in natural language inference data. In Proceedings of the 2018 + +Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers), pages 107-112. +He He, Sheng Zha, and Haohan Wang. 2019. Unlearn dataset bias in natural language inference by fitting the residual. In Proceedings of the 2nd Workshop on Deep Learning Approaches for Low-Resource NLP (DeepLo 2019), pages 132-142. +Karl Moritz Hermann, Tomas Kocisky, Edward Grefenstette, Lasse Espeholt, Will Kay, Mustafa Suleyman, and Phil Blunsom. 2015. Teaching machines to read and comprehend. In Advances in neural information processing systems, pages 1693-1701. +Daniel Kang and Tatsunori Hashimoto. 2020. Improved natural language generation via loss truncation. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 718-731. +Wojciech Kryscinski, Bryan McCann, Caiming Xiong, and Richard Socher. 2020. Evaluating the factual consistency of abstractive text summarization. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 9332-9346. +Faisal Ladhak, Esin Durmus, He He, Claire Cardie, and Kathleen McKeown. 2021. Faithful or extractive? on mitigating the faithfulness-abstractiveness trade-off in abstractive summarization. arXiv preprint arXiv:2108.13684. +Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. 2020. BART: Denoising sequence-to-sequence pretraining for natural language generation, translation, and comprehension. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, Online. Association for Computational Linguistics. +Chin-Yew Lin. 2004. ROUGE: A Package for Automatic Evaluation of Summaries. In Text Summarization Branches Out, pages 74-81. +Leo Z Liu, Yizhong Wang, Jungo Kasai, Hannaneh Hajishirzi, and Noah A Smith. 2021. Probing Across Time: What Does RoBERTa Know and When? arXiv preprint arXiv:2104.07885. +Joshua Maynez, Shashi Narayan, Bernd Bohnet, and Ryan McDonald. 2020. On faithfulness and factuality in abstractive summarization. In Proceedings of The 58th Annual Meeting of the Association for Computational Linguistics (ACL). +Ramesh Nallapati, Bowen Zhou, Cicero dos Santos, Caglar Gulcehre, and Bing Xiang. 2016. Abstractive Text Summarization using Sequence-to-sequence RNNs and Beyond. In Proceedings of The 20th SIGNLL Conference on Computational Natural Language Learning, pages 280-290. + +Shashi Narayan, Shay B Cohen, and Mirella Lapata. 2018. Don't give me the details, just the summary! topic-aware convolutional neural networks for extreme summarization. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 1797-1807. +Ani Nenkova and Rebecca Passonneau. 2004. Evaluating content selection in summarization: The pyramid method. In Proceedings of the Human Language Technology Conference of the North American Chapter of the Association for Computational Linguistics: HLT-NAACL 2004, pages 145-152, Boston, Massachusetts, USA. Association for Computational Linguistics. +Naomi Saphra and Adam Lopez. 2019. Understanding learning dynamics of language models with svcca. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 3257-3267. +Tal Schuster, Darsh Shah, Yun Jie Serene Yeo, Daniel Roberto Filizzola Ortiz, Enrico Santus, and Regina Barzilay. 2019. Towards debiasing fact verification models. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 3410-3416. +Kaiqiang Song, Bingqing Wang, Zhe Feng, Ren Liu, and Fei Liu. 2020. Controlling the amount of verbatim copying in abstractive summarization. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 8902-8909. +Prasetya Ajie Utama, Nafise Sadat Moosavi, and Iryna Gurevych. 2020a. Mind the Trade-off: Debiasing NLU Models without Degrading the In-distribution Performance. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 8717-8729. +Prasetya Ajie Utama, Nafise Sadat Moosavi, and Iryna Gurevych. 2020b. Towards Debiasing NLU Models from Unknown Biases. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 7597-7610. +Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumont, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander M. Rush. 2020. Transformers: State-of-the-art natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 38-45, Online. Association for Computational Linguistics. + +Kristian Woodsend and Mirella Lapata. 2012. Multiple aspect summarization using integer linear programming. In Proceedings of the 2012 Joint Conference on Empirical Methods in Natural Language Processing and Computational Natural Language Learning, pages 233-243. + +Jingqing Zhang, Yao Zhao, Mohammad Saleh, and Peter Liu. 2020. PEGASUS: Pre-training with extracted gap-sentences for abstractive summarization. In International Conference on Machine Learning, pages 11328-11339. PMLR. + +Wei Zhao, Maxime Peyrard, Fei Liu, Yang Gao, Christian M Meyer, and Steffen Eger. 2019. MoverScore: Text Generation Evaluating with Contextualized Embeddings and Earth Mover Distance. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 563-578. + +Chenguang Zhu, Yang Liu, Jie Mei, and Michael Zeng. 2021. MediaSum: A Large-scale Media Interview Dataset for Dialogue Summarization. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 5927-5934. + +# A Implementation Details + +
For training
Computing Infrastructure32GB NVIDIA V100 GPU
Max Input Seq Length1024
Max Output Seq Length128
OptimizerAdam
Optimizer Paramsβ = (0.9; 0.999); ε = 10-8
Learning Rate DecayLinear
Learning rate2e-5
Weight Decay0
Warmup Steps0
Max Gradient Norm1
Batch size16
For inference: XSUM
Num beams6
Length Penalty2
No repetition size3-grams
Min-Length10
Max Length60
For inference: CNNDM & MEDIASUM
Num beams5
Length Penalty1
No repetition size3-grams
Min-Length20
Max Length200
+ +Table 1: Hyperparameters used for both the BART- and PEGASUS-based summarization models. + +For experiments in Section 2, we train summarization models on the entire training data for + +XSUM, the NPR subset for MEDIASUM, and 50k randomly sampled examples from CNNDM. We found that this was enough to replicate the results of state of the art models. All our experiments are conducted using the Huggingface Library (Wolf et al., 2020). Table 1 lists the hyperparameters used for fine-tuning the models and during inference. + +# B Example Summaries + +Table 2 provides examples of generated summaries obtained from the standard BART and BART +Abstractive models. The examples show that the latter lead to more abstractive summaries compared to the baseline. Table 3 compares generated summaries using the standard and +Factuality model aimed at improving factuality. + +Input Article: Naypyidaw, Myanmar (CNN) Twenty-one people are dead and 21 missing after a ferry capsized in the Southeast Asia nation of Myanmar. Myanmar's Ministry of Information said in a statement that the ship capsized Friday night as it sailed, in bad weather conditions, around the city of Sittwe. That's when a large wave crashed into the ferry, causing it capsize near Myaybone and Myaukkyine islands. Authorities have managed to rescue at least 167 people, according to the information ministry for Myanmar, which is also known as Burma. Pictures from the government showed rescue workers helping people off a boat onto the land. Sittwe is the capital of Rakhine state and sits on the Bay of Bengal, about 55 miles (90 kilometers) from the Bangladesh border. This weekend's weather forecast for the city calls for some clouds giving way to clear skies, with high daytime temperatures expected to be in the 30s Celsius (80s to 90s Fahrenheit). Fatal ferry disasters are nothing new to the region. Last month, at least 68 people died when a packed double-decker ferry sank while on the Padma River north of neighboring Bangladesh's capital, Dhaka, officials said. A cargo vessel hit the ferry, causing it to overturn and trapping passengers on its lower deck. Forty-five people died in an accident on the same river in August. In May 2013, several boats carrying as many as 150 people were thought to have capsized near Myanmar's western coast ahead of a storm approaching the area. Those boats were carrying Rohingya, members of Myanmar's long-suffering Muslim minority, Thailand-based U.N. official Kirsten Mildren said at the time. Journalist Manny Muang reported from Myanmar, and CNN's Greg Botelho wrote this story from Atlanta. + +Reference: 167 people have been rescued, Myanmar's government says. The ferry capsized after being hit by a large wave in bad weather conditions. + +Baseline BART: The ship capsized Friday night as it sailed in bad weather conditions. Authorities have managed to rescue at least 167 people, according to the information ministry. Fatal ferry disasters are nothing new to the region. + +BART +Abstractive: At least 21 dead after ferry capsizes near Sittwe. At least 167 people have been rescued from boat. Fatal ferry accidents are nothing new to region. + +Input Article: (CNN) NATO jets scrambled to intercept Russian military aircraft as they neared Latvian airspace, officials said on Wednesday. Estonian radar detected the aircraft over the Baltic Sea on Tuesday night, NATO said. Other than the lead aircraft, NATO said, none of the other Russian military aircraft was on a flight plan. NATO sent jets to identify the planes and later reported that the military aircraft flew on into Russian airspace. NATO didn't say how many Russian aircraft were involved. The flights come as Russia's Northern Fleet has been placed on full combat alert for military exercises involving nearly 40,000 troops and 50 warships. The exercises have rattled nerves in nearby NATO states, including Latvia, where U.S. troops and equipment recently arrived for NATO training, and where fears are growing about Russian President Vladimir Putin's next move. At the same time on Wednesday, Putin joined a celebration in Moscow's Red Square, where Russians celebrated the one-year anniversary of the annexation of Crimea. NATO has condemned the annexation as an illegal territory grab and is boosting its troop presence in the region in what officials say is an effort to discourage Putin from encroaching into other countries. Putin describes the annexation as a "reunification," saying that Crimea's residents overwhelmingly voted to be part of Russia. CNN's Don Melvin and Catherine E. Shoichet contributed to this report. + +Reference: Russian military aircraft are intercepted by NATO jets. NATO says the military aircraft weren't on a flight plan. Russia is conducting military exercises. + +Baseline BART: NATO jets scrambled to intercept Russian military aircraft as they neared Latvian airspace. Russian Northern Fleet has been placed on full combat alert for military exercises. + +BART +Abstractive: Russian military planes flew into Latvian airspace, according to NATO. Flights are part of Russia's preparations for major military exercises involving 40,000 troops, 50 warships. + +Table 2: Generated summaries from CNNDM dataset using the baseline BART model and the BART +Abstractive model proposed in this work. Longer copies phrases/sentences are underlined. Examples show that the generated summaries of the +Abstractive model are much more abstractive compared to the baseline. + +Input Article: Visitors will be shown updates from authorities, news articles, emergency telephone numbers and other useful information in a single place. The SOS Alerts facility can also be set to trigger mobile notifications to those nearby to affected locations. However, Google is still seeking partners to improve the service. The initiative builds on earlier emergency response efforts from the US firm, including its Person Finder and Crisis Map tools. But this time, rather than requiring users to go to special sections of its site, SOS Alerts attempts to bring key information about incidents directly into two of Google's most used services. When activated, the Maps tool reveals, among other things, areas that should be avoided, which roads have been closed and places users can seek refuge. Data gathered from the firm's crowdsourced Waze mapping platform also makes it possible to see where traffic jams, accidents and other problems have been reported by the public. The level of detail shown within the Search tool depends on whether the person carrying out the query is close to the incident. If nearby, they are presented with links to official alerts, tweets from first responders, and useful short phrases in the local language. Those searching from afar are shown less detail unless they click for more information, but they may also be told how to make donations to charities involved in clean-up operations, if Google believes it to be appropriate. "In situations of crisis, the need for information is crucial," Yossi Matias, the firm's vice-president of engineering, told the BBC. "People need to know what's going on - anything that may be related to their safety, or any action they should be taking." He added that Google had set up a dedicated team to decide which events warranted an SOS Alert, but declined to reveal how many people had been assigned to it. Facebook - which offers a parallel service to let members in the vicinity of a disaster tell friends they are safe - has at times been criticised for activating it under "inappropriate" circumstances. Google has joined forces with government bodies, the Red Cross and various weather-forecasting organisations to help provide SOS Alerts in 12 countries. They include local organisations in the US, Japan, the Philippines, Australia and Canada. But it has yet to secure partners in the UK and other European nations. SOS Alerts will still cover events there, but will contain less information as a consequence until information-sharing arrangements are struck. "In times of crisis, more and more people are turning to online sources of information to find out what to do," Omar Abou-Samra from the International Federation of Red Cross told the BBC. "Designed to be shared in tandem with public alerts, the service provides localised lifesaving information that people can immediately act on to protect themselves and their families." + +Reference: Google has begun rounding up information about unfolding natural disasters, terrorism and other crises within its Search and Maps tools. + +Baseline BART: Google is to expand its SOS Alerts service to include information about natural disasters and other major events on its home page. + +BART + Factuality Google has launched a new service to help users nearby by bringing key information about disasters to its Maps and Search tools. + +Input Article: The country's consumer watchdog has taken Apple to court for false advertising because the tablet computer does not work on Australia's 4G network. Apple's lawyers said they were willing to publish a clarification. However the company does not accept that it misled customers. The Australian Competition and Consumer Commission (ACCC) said on Tuesday: "Apple's recent promotion of the new 'iPad with wi-fi + 4G' is misleading because it represents Australian consumers that the product can, with a sim card, connect to a 4G mobile data network in Australia, when this is not the case." The watchdog then lodged a complaint at the Federal Court in Melbourne. At a preliminary hearing, Apple lawyer Paul Anastassiou said Apple had never claimed the device would work fully on the current 4G network operated by Telstra. Apple says the new iPad works on what is globally accepted to be a 4G network. The matter will go to a full trial on 2 May. The Apple iPad's third version went on sale earlier this month, with Australia the first country where it was available. Shoppers lined up by the hundreds at Apple stores on opening day and the company said it had been its strongest iPad launch to date. The ACCC said it was seeking an injunction on sales as well as a financial penalty against Apple, corrective advertising and refunds to consumers. On its website, Apple does state that 4G LTE is only supported on selected networks in the US and Canada. + +Reference: US technology firm Apple has offered to refund Australian customers who felt misled about the 4G capabilities of the new iPad. + +Baseline BART: Australia is the first country where the new iPad does not work on a 4G network. + +BART + Factuality: Apple has been accused of misleading Australians about the new iPad. + +Table 3: Comparison of summaries generated by the standard BART model and a BART + Factuality model trained using our proposed loss truncation strategy. The errors made by the models are highlighted in red and underlined \ No newline at end of file diff --git a/trainingdynamicsfortextsummarizationmodels/images.zip b/trainingdynamicsfortextsummarizationmodels/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..a33a4b6555520cdef4dc88df561252ee94914f55 --- /dev/null +++ b/trainingdynamicsfortextsummarizationmodels/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:974fa7768f0d7324dfb324dab4a97ab670977d9ac4e4bd513045c6f31918cdef +size 442946 diff --git a/trainingdynamicsfortextsummarizationmodels/layout.json b/trainingdynamicsfortextsummarizationmodels/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..553d2445059b149cc819c864139f57878ee41df6 --- /dev/null +++ b/trainingdynamicsfortextsummarizationmodels/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:70a158015a2ba5c72b6206cb50e02158861fc65b5b6d100b73148a7b676953e7 +size 325323 diff --git a/trainingtexttotexttransformerswithprivacyguarantees/737bbf02-523c-4e64-ac88-a3aff54bfe06_content_list.json b/trainingtexttotexttransformerswithprivacyguarantees/737bbf02-523c-4e64-ac88-a3aff54bfe06_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..f4c1d76fabb069ebbac1ade146e8d3124bcfbd60 --- /dev/null +++ b/trainingtexttotexttransformerswithprivacyguarantees/737bbf02-523c-4e64-ac88-a3aff54bfe06_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9e1f81458b080d2706ae86f172fcd3234f177e82c5a062f1aa933f2bb165b26b +size 81631 diff --git a/trainingtexttotexttransformerswithprivacyguarantees/737bbf02-523c-4e64-ac88-a3aff54bfe06_model.json b/trainingtexttotexttransformerswithprivacyguarantees/737bbf02-523c-4e64-ac88-a3aff54bfe06_model.json new file mode 100644 index 0000000000000000000000000000000000000000..c1eb0336a3f481cc6b88ef2c3ce528d278081c09 --- /dev/null +++ b/trainingtexttotexttransformerswithprivacyguarantees/737bbf02-523c-4e64-ac88-a3aff54bfe06_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:722c4790d47cda9bb035b226b8d09091661f8708fe40c221bb2725cbade5f47c +size 96576 diff --git a/trainingtexttotexttransformerswithprivacyguarantees/737bbf02-523c-4e64-ac88-a3aff54bfe06_origin.pdf b/trainingtexttotexttransformerswithprivacyguarantees/737bbf02-523c-4e64-ac88-a3aff54bfe06_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..2ffe87154be803afeecae0360b2bd11d9f3a855d --- /dev/null +++ b/trainingtexttotexttransformerswithprivacyguarantees/737bbf02-523c-4e64-ac88-a3aff54bfe06_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e02c27c654545beaf938c3adb04cc6d22ba62aa98a9b8018055acb050bd27aca +size 347553 diff --git a/trainingtexttotexttransformerswithprivacyguarantees/full.md b/trainingtexttotexttransformerswithprivacyguarantees/full.md new file mode 100644 index 0000000000000000000000000000000000000000..e5a4be31bcf582564fbd3da8a31e50d3ff0c362e --- /dev/null +++ b/trainingtexttotexttransformerswithprivacyguarantees/full.md @@ -0,0 +1,257 @@ +# Training Text-to-Text Transformers with Privacy Guarantees + +Natalia Ponomareva Jasmijn Bastings Sergei Vassilvitskii Google Research + +{nponomareva,bastings,sergeiv}@google.com + +# Abstract + +Recent advances in NLP often stem from large transformer-based pre-trained models, which rapidly grow in size and use more and more training data. Such models are often released to the public so that end users can fine-tune them on a task dataset. While it is common to treat pre-training data as public, it may still contain personally identifiable information (PII), such as names, phone numbers, and copyrighted material. Recent findings show that the capacity of these models allows them to memorize parts of the training data, and suggest differentially private (DP) training as a potential mitigation. While there is recent work on DP fine-tuning of NLP models, the effects of DP pre-training are less well understood: it is not clear how downstream performance is affected by DP pre-training, and whether DP pre-training mitigates some of the memorization concerns. We focus on T5 and show that by using recent advances in JAX and XLA we can train models with DP that do not suffer a large drop in pre-training utility, nor in training speed, and can still be fine-tuned to high accuracy on downstream tasks (e.g. GLUE). Moreover, we show that T5's span corruption is a good defense against data memorization. + +# 1 Introduction + +Recent advances in natural language processing tasks are largely due to introduction of large Transformer-based models trained on large amounts of data. Models such as GPT-2 (Radford et al., 2019) and T5 (Raffel et al., 2020) have billions of parameters and are trained on hundreds of gigabytes of mostly uncurated public crawl data. These models are often released as modifiable checkpoints, and the end users have the ability to fine-tune these models to their final tasks using an often more limited amount of data and compute. + +While pre-training datasets are typically treated as public, their sheer size makes them difficult to curate or scrutinize (Bender et al., 2021; Rogers, + +2021). Moreover, such public datasets (e.g., web crawls) likely contain private information (Dodge et al., 2021), e.g., data erroneously released to the web or copyrighted text. The capacity of recent models makes it possible for them to memorize parts of the training data (Carlini et al., 2020), even after subsequent fine-tuning, and poses risks to the owners of pre-trained language models. In this work, we focus on a potential mitigation: making the model fully private using differential privacy (DP). We focus on T5 (Raffel et al., 2020) and explore how well DP mitigates privacy risks and how it affects pre-training and downstream performance. + +Our contributions are as follows: + +1. We describe how to achieve fully private T5 models by (a) introducing private SentencePiece (DP-SP) and (b) combining it with private training (DP-Training). +2. To the best of our knowledge, we are the first to look into private pre-training (as opposed to private fine-tuning) of T5, while also showing how it affects downstream tasks. More concretely, we demonstrate that fully private models are able to achieve good pre-training and fine-tuning utility. Part of the drop in utility introduced by DP-Training is mitigated by DP-SP (unigram) tokenizer. +3. We show that all private pre-training components of T5 (DP-SP and DP-Training) help reduce memorization of T5 models. The biggest reduction comes from DP-Training, while DP-SP memorization protection is much smaller. +4. We demonstrate that the pre-training objective (i.e., span corruption, next token prediction) has a significant impact on the ability to memorize training instances. In particular, if memorization is the main concern, models trained with span corruption, even without any additional privacy changes, exhibit excellent resilience to training data extraction. + +![](images/623c7521b3af5d0abc843f965ba4bea9573b092d58b049b0fd062b9d6308c47b.jpg) +Figure 1: Differentially private training. Unlike conventional batched training, the gradient is computed and clipped for each example in the batch separately, then accumulated and noised before updating the parameters. + +# 2 Related work + +In this section, we discuss what privacy in ML means (§2.1), followed by overview of private training (§2.2) and privacy in language models (§2.3). + +# 2.1 Privacy in ML + +Privacy guarantees can come in many forms. On the one hand, for a trained ML model, one can provide theoretical Differential Privacy (DP) guarantees in the form of $(\epsilon, \delta)$ (Dwork and Roth, 2014), that (roughly) say that with probability $1 - \delta$ , no attacker can increase their prior on whether a specific example is part of the training data by more than a factor of $\exp(\epsilon)$ . These can be further categorized into guarantees on all of the weights of the model (usually achieved via DP-training) or guarantees on the outputs of the model only (private prediction), which translates into training data label protection. The latter is usually achieved via adding noise to the output. Full model guarantees provide also the weaker guarantees, i.e., private training also ensures private prediction but not vice versa. + +On the other hand, the term 'private' is sometimes applied to ML models to describe empirical characteristics of the model. For example, a model can be described as private if it is robust to membership attacks, training data extraction attacks, or to attacks that attempt to infer some private attribute (e.g., the race of a speaker) from the data. It is worth noting that DP methods like DPtraining can mitigate some (membership attack, training data extraction attacks) but not all attacks in this category. And heuristic methods to make models robust to these attacks, such as adversarial heads or adversarial training data augmentation, don't provide any theoretical privacy guarantees. + +In this paper, we will focus on theoretical privacy (full model protection) achieved via DP-Training. + +In §5.2 we verify how our models fare with respect to an empirical "privacy" definition, namely robustness to training data extraction attacks. + +# 2.2 Differentially Private (DP) Training + +DP training is a modification of the training process of ML models that guarantees that the resulting models (and all of the post processing on them) are also differentially private. DP training is usually achieved via gradient noise or perturbing the loss. + +Gradient noise, which is by far the most common method, involves adding noise to the gradients like DP-SGD and its variants (Abadi et al., 2016; Pichapati et al., 2019). This is shown in Figure 1 with a batch of examples of various lengths. An alternative is to perturb the loss function and then optimize as usual (Chaudhuri et al., 2011; Phan et al., 2016). Here DP guarantees hold only when the algorithm is fully converged, e.g. a global optimum is reached, which is not guaranteed for non-convex problems, and large LMs require many steps to get there. Iyengar et al. (2019) suggested an alternative perturbation that does provide guarantees even if the model reaches only the vicinity of a global optimum, but convexity remains a requirement. + +All of these methods inject noise into the training process and are known to result in a drop of utility (Appendix D discusses ways to mitigate the utility drop in DP-Train). Since Transformer-based NLP models are non convex, and are usually not trained to full convergence, we employ one of the most popular methods that work by noising the gradients (Abadi et al., 2016). + +# 2.3 NLP models and Privacy + +In NLP it is common to pre-train on large amounts of unlabeled data and then fine-tune on the final task. A lot of related work assumes that pretraining data is essentially public, and makes mod + +els private with respect to the limited fine-tuning data. For example, Kerrigan et al. (2020) pretrained GPT-2 on public data and DP fine-tuned it on private data. They demonstrated that such pre-training on public data helps reduce perplexity. Li et al. (2021) performed a similar analysis and showed that private fine tuning can maintain accuracy given a good pretrained model. Hoory et al. (2021a) looked into DP fine-tuning of a (publicly) pre-trained BERT model (Devlin et al., 2019) in the medical domain and explored how DP fine tuning affects the performance and privacy of the models. They point out that multiple components for language models may need to be adjusted to incorporate privacy. For BERT-like models, the tokenization algorithm (WordPiece) can be trained on the private data (to improve the utility), and thus needs to be adjusted to preserve the privacy. Secret sharer (Carlini et al., 2018) was used for evaluation, and the authors demonstrate that with adjustments (e.g., larger batch size) for private models, utility is hurt only marginally while being more robust to leaking "secrets", even those with high frequency. + +At the same time, several works show that publicly (e.g. not using DP-Training methods) pretrained NLP models are vulnerable to privacy attacks (even after subsequent fine tuning). (Thomas et al., 2020) looked into whether pre-trained BERT, Glove and ELMO embeddings contained private data. The authors inserted secret information into the embeddings' training data, and then explored LSTM models subsequently fine-tuned on these embeddings. They showed that higher dimensional embeddings leak more information than lower dimensional ones, and DP training reduced this leakage. Additionally, for all but Glove embeddings, the presence of multiple secret values with the same pattern (e.g. multiple sentences of "John is sick with flu" and "Mary is sick with cold") reduced the leakage. Leakage is also correlated with the number of epochs used to pre-train the embeddings. DP training (the authors used $(\epsilon, \delta)$ of (10, 0.00002) with a noise level of 0.44) did reduce the "exposure", sometimes up to 7 fold. However, it is worth noticing that the exposure metric is calculated by looking at what log perplexity the model assigns to the secret word that was present during training in comparison to the scores that the model assigns to other secret words (from a limited secret word vocabulary). This also means that a sequence-to-sequence model is not guaranteed to never output + +a secret word, even if it was trained privately. Instead, it means that the probability of outputting such words is greatly reduced (and the scores with which they are output are also lower). Additionally, for sequence generation, it is common to use Beam search, which takes not just the top prediction but top k predictions into consideration, so it is still possible to leak secret pre-training data. + +Taking this further, Carlini et al. (2020) demonstrated that it is possible to extract some training data instances by prompting the pre-trained GPT-2 (Radford et al., 2019) with enough context: first the model was used to generate text sequences by sampling from the model repeatedly word by word, and then perplexity scores for generated sequences were used to decide whether the generated data was actually present in the training data. Finally, the authors hypothesized (but didn't verify empirically) that DP-training might help mitigate this training data attack, but highlight that it usually does hurt the utility. They also mention that curating the training data could be helpful but is hard to do, especially for large pre-training datasets. Additionally, fine-tuning on the downstream task could potentially remove some of memorized information. + +Finally, Lee et al. (2021) demonstrated that due to non-uniqueness of training data, language models may output training data instances verbatim, which obviously is a privacy concern. They proposed to mitigate this by deduplicating the pretraining data and showed that it resulted in substantial decrease in verbatim training data generation. + +# 2.4 Summary + +To summarize, prior work showed that publicly pre-training LLMs results in privacy vulnerabilities (e.g., memorization of the training data) that is exacerbated for larger models, and it was hypothesized that DP training can mitigate these risks. However, most of the works treat pre-training data as public and do DP fine-tuning only. Further, it is not known whether DP pre-trained models can perform well on downstream tasks after (public) fine tuning. In subsequent sections, we look to privately (DP) pretrain LLMs and investigate how their pretraining and subsequent fine-tuning performance is affected, as well as verify whether DP pretraining can mitigate some privacy risks outlined above. + +# 3 Implementing a Fully Private T5 + +We focus on T5 (Raffel et al., 2020), a popular encoder-decoder. It uses a slightly modified Transformer architecture (Vaswani et al., 2017) and both the input and output is a sequence of tokens, as tokenized by SentencePiece (Kudo and Richardson, 2018). T5 is a good model to focus on, since it can be used for many input-output tasks, is trained on a large public crawl data set, is publicly available, and has been shown to have excellent performance on subsequent fine-tuning tasks. + +What we are protecting. We use the DP definition, so we provide protection at the level of a training instance. For encoder-decoders like T5, that means a pair of input and output sequences. Importantly, if the same training example is repeated multiple times in the training data, the level of protection for such an example will be smaller. + +Modifications. There are two parts to training T5 that need to be modified to achieve a fully private model. The first part is the tokenizer, which is trained on the training data. This part is often overlooked by papers claiming to train private NLP models. It is also unique to NLP models (e.g., in comparison to image models). In §5.1 we show that making the tokenizer private is very important and allows us to reduce the utility drop introduced by DP-training. The second part is the modification of the optimization algorithm (DP-Training). + +# 3.1 Private tokenizer (DP-SentencePiece) + +SentencePiece (Kudo and Richardson, 2018) is a tokenizer commonly used for pre-processing text data. It comes with a number of algorithms that can be used (e.g., unigram, char, BPE). One of the first papers that looked into making tokenizers private is Hoory et al. (2021a), who devised an algorithm that adds Laplacian noise to the histogram of the word counts and applied it to the WordPiece algorithm used by BERT. Hoory et al. (2021a) improved on these bounds by using Gaussian noise. + +Algorithm 1 is a slight modification of their algorithm. For each sentence in the data, compute the histogram of words and counts. Then, compute the histogram of the overall dataset by adding the word counts across all histograms. Contrary to Hoory et al. (2021a), we do not limit the count of a word in a sentence to 1, to give per-example (as opposed to per word) DP guarantees. The words in the original histogram are not modified or normalized; it may + +Algorithm 1: DP-SentencePiece histogram + +
Input :A histogram h = {wi : ci} with wi a word type and ci the total count of wi in the data. σ, C - noise and clipping threshold
Output :Private histogram
1for i← 0 to size(h) do
2counti' = h[wi] + N(0, σ2)
3if counti' >= C then
4| h'[wi] = counti';
5end for
6return h'
+ +contain words such as "Chrysler's". The rest of SentencePiece algorithm is unmodified. + +To calculate the bounds, we use Theorem 1 from Hoory et al. (2021b): Given $N$ the number of words in a sentence, $k$ the maximum L2 norm of a sentence-level histogram, $m$ the maximum infinity norm of sentence-level histogram, and $\sigma$ the noise level added to the counts, we would obtain $(\epsilon, \delta)$ DP guarantees with $\epsilon = \frac{k}{\sigma} \sqrt{2 \log(2.5 / \delta)}$ when the clipping threshold of $C = m + \sigma \operatorname{erf}^{-1}(1 - \delta / 2N)$ is used. Note that in reality there are two reasons that our $\epsilon$ guarantees will be even better. Please refer to the discussion in Appendix B. + +Finally, it is worth mentioning that there are alternatives to using DP SentencePiece algorithm. Firstly one can use SentencePiece trained on a related public dataset. We explore the performance of such models in §5.1. Alternatively, one can consider using models that don't require a pre-trained tokenizer, such as ByT5 (Xue et al., 2021). The character-level SentencePiece algorithm is sometimes seen as more "private" than the unigram one, however that is not a precise definition of privacy. + +# 3.2 DP-Training + +For DP-Training, we protect individual example privacy and implement the algorithm outlined in (Abadi et al., 2016). Specifically, we use the AdaFactor optimizer that was used for training T5 with the following adjustments (See Figure 1): + +1. We take the individual examples' gradients and clip each to some fixed norm (determined by privacy parameters). +2. When taking the parameter update step, noise (determined by privacy parameters) is added to the accumulated gradients. + +# 3.2.1 Fast per-example gradients with JAX + +We use a reimplementation1 of T5 in JAX (Bradbury et al., 2018) and Flax (Heek et al., 2020). By doing so, we can follow Subramani et al. (2020) in leveraging JAX's vectorization supported by the XLA compiler. JAX lets us vectorize ('vmap') the computation of the gradient of the loss on a single example, so that we obtain a batch of per-example gradients efficiently. This way, we still get most of the speedup of batched neural network training, while having a correct implementation of DP. For each example, we average the loss incurred over all target tokens in the target sequence, compute the gradient, and then clip the gradient norm. An update for a batch of examples computes the gradient for each example in parallel (using vectorization), accumulates the gradients and adds noise, before updating the parameters of the model. + +# 4 Experiments + +Hyperparameters. Our experiments in the main text use T5 small, which has 6 encoder layers, 6 decoder layers, 8 64-dimensional heads, embedding dimension of 512, MLP dimension of 2048. We chose T5 small since it is relatively fast to train and produces results comparable with that of larger models (see Appendix A for a discussion of the effect of the model size on pre-train and fine-tuning performance). We use AdaFactor (Shazeer and Stern, 2018) with learning rate 0.5, decay rate 0.8, warm-up 1000, and rsqrt learning rate decay. + +Datasets. We use The Colossal Clean Crawled Corpus (C4; Raffel et al., 2020) as a pre-training task and look into the original "prefix" unsupervised training objective, that predicts next tokens given the context and the span corruption training objective (Raffel et al., 2020, §3.3.4), where randomly removed spans of the input are predicted. We use 512 tokens as input/context and attempt to predict 114 target tokens. To evaluate fine-tuning performance, we utilize GLUE datasets (Wang et al., 2018) that allows to evaluate model performance across a range of NLU tasks. + +Ablations. We look separately into the effect of DP-SentencePiece and DP-Train on Memorization and pretraining and subsequent fine-tuning perfor + +mance. For DP-SP we use the unigram Sentence-Piece algorithm (Kudo and Richardson, 2018). + +Pre-training and fine-tuning performance. It is known that DP-training hurts the utility (e.g., accuracy) of models. However, the common scenario in NLP is that models are pre-trained on some data and then subsequently fine-tuned for the end task. We look into private pre-training (contrary to the majority of the papers which look into private fine-tuning of a publicly pre-trained model), and we hope that (public) fine-tuning such privately pretrained models on public data provides the same utility as publicly pre-trained models. For these experiments, we train T5 models with the span corruption objective with a batch size of 8192 for 100K steps, and fine-tune on GLUE for 150K additional steps with a (standard) 128 batch size. The batch size of 8192 was chosen for pre-training since it provides good performance for DP-Train. T5 without DP-training trains with approximately the same performance using a batch size of 128, however for DP-Training it is known that the batch size should be increased significantly in order to get reasonable performance (see Appendix D). For a fair comparison we use the same batch size for the baseline and DP-T5 variants. Another alternative is to tune hyper-parameters (for both baseline and DP variants) and compare the best possible models, however since tuning parameters for DP will change the $\epsilon$ guarantees, we don't go this route. We use an initial learning rate of 0.5 (both baseline and DP-T5 variants pre-training) and weight decay, and train with 64 cores. For DP-training, please refer to Appendix 5 for details on noise, clipping norm and $\epsilon$ . For the Full DP T5 model, we use a DP-SP unigram model trained on C4 with $\epsilon = 0.17$ (see Table 1) and combine it with DP-Training with various noise levels. + +Additionally, Appendix D discusses additional modifications that can be further explored to minimize the utility drop due to DP-Train. + +Testing for memorization. It is expected that DP (both DP-training and DP-SP) should reduce data memorization of the models. To verify that, we conduct an evaluation similar to Carlini et al. (2020) and Lee et al. (2021). In particular, we train models on C4 and attempt to "extract" the training data by providing an input prefix and allowing model to generate the rest of the sequence. + +We use 512 tokens prefix length, similar to the input length that was used for training. When the model generates the output, we calculate the exact match on a per-instance basis and report the average across all instances in the dataset. Exact match is different from per-token accuracy: it is either 0 or 1 for each prefix, depending on whether the model generated the exact target sequence or not, whereas token accuracy would report how many predicted tokens match the target tokens for each instance. Exact match allows us to gauge what fraction of instances was output verbatim by the model, serving as a useful metric for memorization. Token-level accuracy serves as an additional metric; while getting some tokens right does not guarantee that memorization occurred, high values of token-level accuracy would indicate that some tokens generated by the model words might have matched those from the target exactly. Finally, we also report median edit distance between predicted and target tokens, averaged across all instances in the data. This metric also serves as indirect way of measuring memorization. + +The difference between our setup and that of Carlini et al. (2020) and Lee et al. (2021) is that our model is an encoder-decoder, as opposed to GPT-2 which is a decoder only. Additionally, on top of using just next word prediction as a training objective (referred to as prefix training), we get to experiment with the span corruption objective. + +We test for memorization on the same four C4-based datasets as Lee et al. (2021): + +- Train dup and Train unique: contains examples from the training set that had near-duplicates and which had no near-duplicates, respectively, in the training set. +- Valid in train and Valid unique: examples from the validation set (not used for training directly) which are very similar to the examples from the training data and data that contains examples from the validation set which had no near-duplicates, respectively. + +We would expect the most memorization to be exhibited on Train dup, and the least memorization to be present on Valid unique data. + +# 5 Results & Discussion + +# 5.1 Pre-training & Fine-tuning performance + +Table 1 presents an ablation study of DP-SentencePiece's effect on pre-training and fine + +tuning performance. Additionally, we explore how tokens pre-selected via SentencePiece trained on other public (for example Wikipedia) datasets affect the performance of both pre-training and fine tuning tasks. First, we see that the best pre-training accuracy does not necessarily translate into the best fine tuning accuracy. Second, we see that DP-SP (unigram) serves as a regularizer on the pre-training task, significantly improving pre-training performance (approx. $13\%$ improvement for the best $\epsilon$ ). This might be due to the fact that the C4 pretraining data is not clean; without DP-SP, misspelling and non-words like "rein-forced;" were passed to the SentencePiece algorithm and resulted in suboptimal tokens being selected. For example, for $\epsilon = 0.17$ , $88.6\%$ of C4 words were dropped at the histogram creation stage, resulting in only the most common $11.4\%$ of the words being used for token selection. Next, we can see that SP trained on Wikipedia, a different dataset that we may consider public, performs just as well (if not better on the pre-training task). The choice of (public) data is important here, and if the data on which the tokenizer is trained is not similar to the training data, the performance might be compromised. Additionally, character SentencePiece, while without any privacy guarantees, provides excellent pre-train and fine-tuning performance. Finally, other SentencePiece models (like BPE) might be more robust to the noisy data than the unigram and char models we trained, so it is possible that the regularization effect of DP will not be as pronounced for those. We chose unigram because it is the SP algorithm used for the majority of T5 models. + +Table 2 demonstrates pretraining and fine-tuning performance of DP-Train (only) models and Fully Private (Full-DP) models that combine DP-SP and DP-Train. We observe that again better pre-training utility does not directly translate into better downstream fine-tuning performance. Even for the most stringent guarantees of DP-Train ( $\epsilon$ of 6.06) which result in approx $20\%$ of pretrain accuracy drop, on average GLUE fine-tuned performance is not significantly different from the baseline. Full-DP is able to recover or improve pre-train accuracy. On average, we also see that full-DP is not significantly better on subsequent fine-tuning tasks (e.g. mnli_m, mnli_msm, qnli etc), however for some tasks (e.g. cola) fine-tuning performance is significantly better than that of a (non-private) baseline. On average, even DP-train models have approximately the same + +
Model nameεPretrainGLUE fine-tuning
colamnli_mmnli_msmmrpcqnliqqprtesst2stsbAvg
SPT5, unigram C4-SP56.484.687.788.591.795.896.490.492.366.288.2
90% signif (+/-)0.10.02.52.01.40.80.82.10.90.81.1
T5, unigram wiki-SP71.991.482.682.991.195.395.490.485.350.084.9
T5, char C4-SP76.597.394.694.492.696.697.394.895.165.992.0
DP-SPT5, unigram C4-DP-SP0.1769.191.590.891.591.196.696.492.994.156.689.1
3.3763.790.590.290.888.896.495.390.691.462.688.5
33.7065.584.687.187.694.996.997.792.691.758.387.9
336.0066.084.686.287.395.196.997.592.591.858.887.9
+ +Table 1: Accuracy on C4 span corruption pre-training and GLUE fine-tuning. SP is standard SentencePiece, DP-SP is private SentencePiece, and Avg is the average across GLUE tasks. + +
ModelεPretraincolamnli_mmnli_msmGLUE fine-tuning
mrpcqnliqqprtesst2stsbAvg
Baseline59.885.390.791.495.096.498.191.494.861.389.4
90% signif (+/-)0.40.03.13.22.10.60.50.512.50.82.4
DP-train6.0639.582.787.487.292.694.897.690.7291.460.487.2
8.6941.382.687.287.093.694.897.690.7591.862.987.6
13.4642.881.987.087.293.494.697.690.891.662.287.4
319.1948.182.588.188.193.194.597.791.3992.662.187.8
Full DP6.2351.290.691.691.592.196.397.893.593.357.189.3
8.8652.490.192.091.892.596.597.993.394.057.589.5
13.6355.490.091.991.893.296.497.993.893.957.789.6
319.3662.890.692.292.293.196.698.094.694.267.791.0
+ +Table 2: Accuracy on C4 span corruption pretrain and GLUE fine tuning tasks. DP-Train are T5 models trained with public SentencePiece but DP-Adafactor training, and Full-DP combines DP-SP and DP-Train. + +GLUE performance (difference insignificant). + +# 5.2 Memorization discussion + +Table 3 presents the result of memorization experiments for various fully-private (Full-DP) T5 models, along with ablation studies that look into effect of DP-SentencePiece and DP-Training only. + +Firstly, we highlight that span corruption training is extremely robust to memorization. Even baseline non-private models do not output any training data verbatim when prompted with input from the Train Dup dataset (exact match of $0\%$ ). While some tokens generated by the model do match target tokens (the TA column for Train dup), it is only $0.29\%$ of all (114) generated tokens on average, which indicates that almost no words were output verbatim from the training data. At the same time, the pretrain accuracy of a baseline model indicates that its performance is reasonably good ( $59.8\%$ teacher-forced accuracy). The take-away message here is that if memorization is of a concern, one way to address it is to use span corruption training objective. Zero memorization (EM of $0\%$ ) is preserved after publicly fine-tuning these models on GLUE and retesting for pre-training data memorization. + +One important caveat here is that the span corruption training objective was splitting a piece of text + +into input/target randomly, so it is possible a different definition of memorization would be more suitable. For example, instead of using prompts from Train dup and targets that immediately follow these prompts, it would be more suitable to test span corruption models to see if they can output a randomly selected set of words given other words in a sentence. This would mimic the training objective of span corruption better. At the same time, since Lee et al. (2021) showed that it is duplicate sentences that are major source of memorization, and for such duplicate sentences, span corruption inputs and targets (randomly selected) during training will be different for each duplicate, it is still our belief that even with such alternative memorization definition span corruption models will be extremely robust. We leave this for future work. + +Prefix training however does exhibit a lot of memorization, confirming the results from Carlini et al. (2020) and Lee et al. (2021). The baseline model outputs approx. $2\%$ of the training data verbatim, when prompted with 512 tokens from the Train dup dataset. This number falls to $0.03\%$ of the data for instances that were not repeated many times in the training data (Train unique). Full DP-T5 models are able to not only improve the pre-train performance, but also mitigate the effect of memorization: for an $\epsilon$ of 6.23, Full DP-T5 + +
ModelEpsPretrainTrain dupTrain uniqueValid in trainValid unique
EMTAMEDEMTAMEDEMTAMEDEMTAMED
Baseline59.80.000.291330.000.142200.000.291260.000.14228
Span CorruptionDP-Train6.0639.50.000.021370.000.012290.000.021190.000.01228
8.6941.30.000.061400.000.042260.000.071250.000.04224
13.4642.80.000.051360.000.032280.000.051180.000.03226
319.1948.10.000.251430.000.251430.000.261330.000.14215
DP-SP0.1772.90.001.121410.000.582110.001.181340.000.58209
3.3770.70.001.251440.000.712030.001.341380.000.71201
33.6868.60.000.301290.000.162190.000.311120.000.16217
336.0068.70.000.131330.000.072260.000.141160.000.07224
Full DP6.2351.20.000.511580.000.282070.000.511530.000.29206
8.8652.40.001.181320.000.782160.001.331160.000.79214
13.6355.40.000.341370.000.212130.000.361270.000.21212
319.3662.70.001.441300.000.812040.001.521250.000.82202
Prefix TrainingBaseline39.62.203.331120.030.482081.172.491040.020.48206
DP-Train6.0623.00.000.211360.000.152260.000.251180.000.15225
8.6923.50.050.251350.000.162270.010.271170.000.16225
13.4624.20.060.251350.000.162260.050.281180.000.16225
319.1931.40.150.641270.000.272180.070.651110.000.27217
DP-SP0.1755.71.443.411200.011.222160.733.112160.011.23105
3.3753.11.483.351180.021.162150.752.992150.011.17103
33.6849.91.903.041170.020.762140.992.462140.010.76103
336.0049.81.953.101170.010.752150.992.472150.010.75103
Full DP6.2342.80.012.021350.001.172250.002.161170.001.18224
8.8643.20.012.121340.001.272230.002.301170.001.28222
13.6343.70.011.671360.000.972250.001.831180.000.98223
319.3649.20.151.571310.000.852220.081.661130.000.86221
+ +Table 3: Effect of DP on Memorization. EM is Exact match, TA is Token-level accuracy, MED is Median Edit Distance. DP-SP are T5 models trained only with Differentially Private SentencePiece. DP-Train are T5 models trained with public SentencePiece but DP-Adafactor training, and Full-DP combines DP-SP and DP-Train. + +models output verbatim only $0.006\%$ of training instances that were repeated multiple times in the training data (366x less memorization) and even very large values of $\epsilon$ like 320 provide 15x improvement in memorization as measured by exact match. For instances that occurred in training only a few times (Train unique), pretty much any level of DP-protection provides almost full elimination of memorization (0.002% EM even for an $\epsilon$ of 320.) + +With respect to ablation studies, the DP-Training has the most (positive) effect on memorization, accounting for the majority of improvement of Full DP models. DP-SentencePiece does affect memorization of T5 models, albeit much less than DP-Train. For example, for prompts that look like training data duplicates, DP-SP ( $\epsilon$ of 0.17) is able to reduce the exact match from approx. $2\%$ to $1.4\%$ . For a large $\epsilon$ this protective effect is almost non-existent. + +Finally, it is important to mention that while DP T5 does significantly reduce memorization (on the prefix objective), it does not completely eliminate it, especially for sentences that were repeated multiple times (Train dup). As mentioned previously, it might be because such sentences will have a lower level of protection guarantees and thus can still be output verbatim. Combining DP (DP-SP and DP-Training) with dedduplication techniques from Lee et al. (2021) should thus be beneficial. + +# 6 Conclusion + +While the majority of recent work looks into private fine-tuning of pre-trained NLP models, we investigated how private pre-training of a model on a large corpus of data affects its pre-training and subsequent fine-tuning performance, as well as how much memorization such privately pre-trained models exhibit. We worked with T5, a transformer-based encoder-decoder, and demonstrated how to achieve a fully private T5 version by introducing DP-SentencePiece to train a differentially private subword tokenizer, and implementing DP-Training for the actual pre-training. We leveraged recent advances in JAX to do so without incurring a large performance hit in terms of training speed. Our results show that both DP-SentencePiece and DP-Training contribute to reducing memorization, but that the latter has the largest effect. Moreover, we demonstrated that the span corruption task from Raffel et al. (2020) also effectively mitigates memorization, which isn't the case for the next token prediction objective. We also show that fully private T5 models exhibit reasonable pre-training performance and don't hurt subsequent fine-tuning, and that private SentencePiece serves as a regularizer on noisy datasets and is able to improve pre-training and fine-tuning performance of models such as T5. + +# References + +Martin Abadi, Andy Chu, Ian Goodfellow, H. Brendan McMahan, Ilya Mironov, Kunal Talwar, and Li Zhang. 2016. Deep learning with differential privacy. Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security. +Raef Bassily, Adam D. Smith, and Abhradeep Thakurta. 2014. Private empirical risk minimization, revisited. CoRR, abs/1405.7085. +Emily M. Bender, Timnit Gebru, Angelina McMillan-Major, and Shmargaret Shmitchell. 2021. On the dangers of stochastic parrots: Can language models be too big? In Proceedings of the 2021 ACM Conference on Fairness, Accountability, and Transparency, FAccT '21, page 610-623, New York, NY, USA. Association for Computing Machinery. +James Bradbury, Roy Frostig, Peter Hawkins, Matthew James Johnson, Chris Leary, Dougal Maclaurin, George Necula, Adam Paszke, Jake VanderPlas, Skye Wanderman-Milne, and Qiao Zhang. 2018. JAX: composable transformations of Python+NumPy programs. +Nicholas Carlini, Chang Liu, Jernej Kos, Ülfar Erlingsson, and Dawn Song. 2018. The secret sharer: Measuring unintended neural network memorization & extracting secrets. CoRR, abs/1802.08232. +Nicholas Carlini, Florian Tramér, Eric Wallace, Matthew Jagielski, Ariel Herbert-Voss, Katherine Lee, Adam Roberts, Tom B. Brown, Dawn Song, Ülfar Erlingsson, Alina Oprea, and Colin Raffel. 2020. Extracting training data from large language models. CoRR, abs/2012.07805. +Kamalika Chaudhuri, Claire Monteleoni, and Anand D. Sarwate. 2011. Differentially private empirical risk minimization. Journal of Machine Learning Research, 12(29):1069-1109. +Ali Davody, David Ifeoluwa Adelani, Thomas Kleinbauer, and Dietrich Klakow. 2020. Robust differentially private training of deep neural networks. CoRR, abs/2006.10919. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171-4186, Minneapolis, Minnesota. Association for Computational Linguistics. +Jesse Dodge, Maarten Sap, Ana Marasovic, William Agnew, Gabriel Ilharco, Dirk Groeneveld, Margaret Mitchell, and Matt Gardner. 2021. Documenting large webtext corpora: A case study on the colossal clean crawled corpus. + +Cynthia Dwork and Aaron Roth. 2014. The algorithmic foundations of differential privacy. Foundations and Trends in Theoretical Computer Science, 9(3-4):211-407. +Jonathan Heek, Anselm Levskaya, Avital Oliver, Marvin Ritter, Bertrand Rondepierre, Andreas Steiner, and Marc van Zee. 2020. Flax: A neural network library and ecosystem for JAX. +Shlomo Hoory, Amir Feder, Avichai Tendler, Alon Cohen, Sofia Erell, Itay Laish, Hootan Nakhost, Uri Stemmer, Ayelet Benjamini, Avinatan Hassidim, and Yossi Matias. 2021a. Learning and evaluating a differentially private pre-trained language model. In Proceedings of the Third Workshop on Privacy in Natural Language Processing, pages 21-29, Online. Association for Computational Linguistics. +Shlomo Hoory, Amir Feder, Avichai Tendler, Sofia Errell, Alon Peled-Cohen, Itay Laish, Hootan Nakhost, Uri Stemmer, Ayelet Benjamini, Avinatan Hassidim, and Yossi Matias. 2021b. Learning and evaluating a differentially private pre-trained language model. In Findings of the Association for Computational Linguistics: EMNLP 2021, pages 1178-1189, Punta Cana, Dominican Republic. Association for Computational Linguistics. +Roger Iyengar, Joseph P. Near, Dawn Song, Om Thakkar, Abhradeep Thakurta, and Lun Wang. 2019. Towards practical differentially private convex optimization. In 2019 IEEE Symposium on Security and Privacy (SP), pages 299-316. +Gavin Kerrigan, Dylan Slack, and Jens Tuyls. 2020. Differentially private language models benefit from public pre-training. +Taku Kudo and John Richardson. 2018. SentencePiece: A simple and language independent subword tokenizer and tokenizer for neural text processing. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 66-71, Brussels, Belgium. Association for Computational Linguistics. +Katherine Lee, Daphne Ippolito, Andrew Nystrom, Chiyuan Zhang, Douglas Eck, Chris Callison-Burch, and Nicholas Carlini. 2021. Deduplicating training data makes language models better. CoRR, abs/2107.06499. +Xuechen Li, Florian Tramér, Percy Liang, and Tatsunori Hashimoto. 2021. Large language models can be strong differentially private learners. +Ilya Mironov. 2017. Renyi differential privacy. CoRR, abs/1702.07476. +Ilya Mironov, Kunal Talwar, and Li Zhang. 2019. Rényi differential privacy of the sampled gaussian mechanism. CoRR, abs/1908.10530. + +Nicolas Papernot, Abhradeep Thakurta, Shuang Song, Steve Chien, and Ulfar Erlingsson. 2020. Tempered sigmoid activations for deep learning with differential privacy. +NhatHai Phan, Yue Wang, Xintao Wu, and Dejing Dou. 2016. Differential privacy preservation for deep auto-encoders: An application of human behavior prediction. In Proceedings of the Thirtieth AAAI Conference on Artificial Intelligence, AAAI'16, page 1309-1316. AAAI Press. +Venkatadheeraj Pichapati, Ananda Theertha Suresh, Felix X. Yu, Sashank J. Reddi, and Sanjiv Kumar. 2019. Adaclip: Adaptive clipping for private SGD. CoRR, abs/1908.07643. +Francesco Pittaluga, Sanjeev J. Koppal, and Ayan Chakrabarti. 2018. Learning privacy preserving encodings through adversarial training. CoRR, abs/1802.05214. +Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019. Language models are unsupervised multitask learners. +Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. 2020. Exploring the limits of transfer learning with a unified text-to-text transformer. J. Mach. Learn. Res., 21:140:1-140:67. +Anna Rogers. 2021. Changing the world by changing the data. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 2182-2194, Online. Association for Computational Linguistics. +Noam Shazeer and Mitchell Stern. 2018. Adafactor: Adaptive learning rates with sublinear memory cost. +Pranav Subramani, Nicholas Vadivelu, and Gautam Kamath. 2020. Enabling fast differentially private sgd via just-in-time compilation and vectorization. ArXiv, abs/2010.09063. +Aleena Thomas, David Ifeoluwa Adelani, Ali Davody, Aditya Mogadala, and Dietrich Klakow. 2020. Investigating the impact of pre-trained word embeddings on memorization in neural networks. In Text, Speech, and Dialogue: 23rd International Conference, TSD 2020, Brno, Czech Republic, September 8-11, 2020, Proceedings, page 273-281, Berlin, Heidelberg. Springer-Verlag. +Florian Tramer and Dan Boneh. 2021. Differentially private learning needs better features (or much more data). In International Conference on Learning Representations. +Laurens van der Maaten and Awni Y. Hannun. 2020. The trade-offs of private prediction. CoRR, abs/2007.05089. + +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc. +Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. 2018. GLUE: A multi-task benchmark and analysis platform for natural language understanding. CoRR, abs/1804.07461. +Linting Xue, Aditya Barua, Noah Constant, Rami Al-Rfou, Sharan Narang, Mihir Kale, Adam Roberts, and Colin Raffel. 2021. Byt5: Towards a token-free future with pre-trained byte-to-byte models. CoRR, abs/2105.13626. + +# A Small vs Base vs Large T5 model performance + +Table 4 outlines the performance difference between the "small", "base" and "large" T5 architectures on Pretraining span corruption task on the C4 dataset and subsequent fine tuning performance on GLUE datasets. Since the performance differences are not very large, we chose to run all of our experiments with the T5 small architecture. + +# B DP-SentencePiece $\epsilon$ guarantees discussion + +Theorem 1 (Hoory et al., 2021b) uses the notion of $k$ and $m$ (maximum L2 and infinity norms) of sentence-level (1-D vector) histogram. If $N$ is the length of the sentence, for a histogram where we exactly count the number of times each word appears in the sentence, we have $k = m = N$ . However the definition of a sentence is loose. Note that ideally a "sentence" would mimic how the subsequent training of T5 model will happen, since we aim to obtain example-level DP protection. T5 however is not trained on words—it is trained on tokens—and tokens are chosen by the SentencePiece algorithm. The length of tokens chosen varies: they can be as short as 1 character or long tokens of 3-4 characters or more. Our T5 experiments use 512 input tokens as features and 114 tokens as target, so the whole "example" or "sentence" is 626 tokens. Just as in (Hoory et al., 2021b), we assume that sentence length is 256 words, which is a very pessimistic estimate—this translates into approximately 2.45 tokens per word. Note that if in reality 626 tokens represent fewer words, the SentencePiece $\epsilon \sim N$ will be better. + +Additionally, (Hoory et al., 2021b) authors provide a Corollary that allows to obtain slightly better $\epsilon$ bounds while using approximately the same clipping norm and the same level of noise. + +# C DP-Training $\epsilon$ discussion + +In order to come up with $\epsilon$ guarantees for DP-Training, we consider that C4 dataset has approximately 133,897,2430,182 words. Assuming, just as in DP-SentencePiece discussion, that each word consists of approx. 2.45 tokens, and each training example is $512 + 114$ tokens, our total number of examples is approximately 5,240,387,307 (and the $\delta$ used is 1/5,240,387,307). + +Table 5 presents the noise and clip norm that we used for our experiments, along with $\epsilon$ guarantees. + +We use differential privacy accountant (Abadi et al., 2016) and Renyi Differential Privacy outlined in (Mironov, 2017), (Mironov et al., 2019) which has been implemented in https://github.com/tensorflow/privacy. + +When combining DP-SP and DP-Training, we use simple composition and sum the respective $\epsilon$ and $\delta$ . + +# D Related work: Mitigating Utility Drop in DP-Training + +To preface the below discussion, we would like to highlight that the goal of our paper was not to obtain the smallest pre-training utility drop possible. We thus did limited hyperparameter tuning and didn't explore methods outlined below. + +Some works attempts to mitigate the performance drop by considering architectural or hyperparameter changes. For example, (Tramer and Boneh, 2021) argues that the drop can be mitigated by the large amount of training data, whereas (Bassily et al., 2014) shows that DP risk minimization bounds, compared to non DP bounds, have a polynomial dependency on the number of features and $\epsilon$ . (Papernot et al., 2020) demonstrated the need to adjust the parameters for DP training and argued for use of different activation functions when using DP. Additionally, various other architecture adjustments like increasing the batch size, or using batch/layer normalization were proposed, for example in (Davody et al., 2020). It is also important to point out that hyper-parameter tuning (which includes changing batch size, learning rate, architecture etc) can't be used "for free" with DP-training as it has to be accounted for in the privacy budget. Thus for DP training experiments, it is common not to tune the hyperparameters and choose some predefined values before the experiments begin. + +Another direction explored in literature is the modification to DP-SGD algorithm itself. For example, (Davody et al., 2020) introduce scale-invariant DP-SGD and use normalization techniques to dampen the effect of additional noise during training. In this modification, the final network weights are sampled from the normal distribution whose mean and variance were updated to account for the privacy budget. + +Finally, instead of going for differentially private training, the utility drop can be mitigated by relaxation of privacy guarantees. For example, private-inference, which works by adding noise to the final + +
Model# paramsPretraincolamnli_mmnli_msmGLUE
mrpcqnliqqprtesst2stsbAvg
T5 Small60M60.788.294.394.496.198.297.995.395.471.792.4
T5 Base220M64.692.095.595.796.298.998.296.397.071.593.5
T5 Large770M66.792.196.496.597.399.098.298.098.171.994.2
+ +Table 4: Performance of various T5 architectures on pretrain C4 task and their fine tuning performance on GLUE. + +
ClipNoise
0.0010.406.0573157
0.0010.358.6898032
0.0010.3013.4586238
0.0010.2047.2630501
0.0010.10319.1941523
+ +Table 5: DP-Train clipping norm and noise hyper-parameters and $\epsilon$ achieved for a batch size of 8192, 100K steps. + +prediction of the models trained conventionally, is known to protect just the labels of the data and does not provide full DP guarantees with respect to all the model weights and data features (van der Maaten and Hannun, 2020). Additionally, heuristic methods like in (Pittaluga et al., 2018) that prevent discovery of some predefined "private attributes" from the data (.e.g like inferring the race of the speaker) can be used without any DP guarantees. \ No newline at end of file diff --git a/trainingtexttotexttransformerswithprivacyguarantees/images.zip b/trainingtexttotexttransformerswithprivacyguarantees/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..4a0413bf7ee2147a74477df576d1e4d764016a72 --- /dev/null +++ b/trainingtexttotexttransformerswithprivacyguarantees/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:031488b2bff1c927039d0fc4adb0022181e8c38d2c2a7a954f91694531d42221 +size 368937 diff --git a/trainingtexttotexttransformerswithprivacyguarantees/layout.json b/trainingtexttotexttransformerswithprivacyguarantees/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..93919f69cfc9bd6e50667cfa5f0870ae53aedc67 --- /dev/null +++ b/trainingtexttotexttransformerswithprivacyguarantees/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e13069a69061545109a3dd356cae05a668c536650e69c9a354eec195e6d8310f +size 312011 diff --git a/transferlearningandpredictionconsistencyfordetectingoffensivespansoftext/6823b359-673b-422f-bc18-435923b26162_content_list.json b/transferlearningandpredictionconsistencyfordetectingoffensivespansoftext/6823b359-673b-422f-bc18-435923b26162_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..2441b620aae7b00b1fb3983de31239c440024bc0 --- /dev/null +++ b/transferlearningandpredictionconsistencyfordetectingoffensivespansoftext/6823b359-673b-422f-bc18-435923b26162_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ce0cb0664c0290e7caa9597ef4d4a2ebb3931b3aa9fac2353431c6812effd6e +size 46362 diff --git a/transferlearningandpredictionconsistencyfordetectingoffensivespansoftext/6823b359-673b-422f-bc18-435923b26162_model.json b/transferlearningandpredictionconsistencyfordetectingoffensivespansoftext/6823b359-673b-422f-bc18-435923b26162_model.json new file mode 100644 index 0000000000000000000000000000000000000000..4947b508e2af57e55f871cb21a7f6face72e2440 --- /dev/null +++ b/transferlearningandpredictionconsistencyfordetectingoffensivespansoftext/6823b359-673b-422f-bc18-435923b26162_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1ebed8fbe75e1c3eeaa27d6bb848d68b0383a1e36dffd1d0bc1af4c2f27f8c95 +size 54754 diff --git a/transferlearningandpredictionconsistencyfordetectingoffensivespansoftext/6823b359-673b-422f-bc18-435923b26162_origin.pdf b/transferlearningandpredictionconsistencyfordetectingoffensivespansoftext/6823b359-673b-422f-bc18-435923b26162_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..1fdc8714ab07205098fba8e0e31dbf711678a9a5 --- /dev/null +++ b/transferlearningandpredictionconsistencyfordetectingoffensivespansoftext/6823b359-673b-422f-bc18-435923b26162_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd665d58ecad24547bb0098a96b6ded991adebac21873ea4318331742a5fb4c6 +size 294021 diff --git a/transferlearningandpredictionconsistencyfordetectingoffensivespansoftext/full.md b/transferlearningandpredictionconsistencyfordetectingoffensivespansoftext/full.md new file mode 100644 index 0000000000000000000000000000000000000000..60d6051b312486552bf640bbb3b6c45d1d288ee7 --- /dev/null +++ b/transferlearningandpredictionconsistencyfordetectingoffensivespansoftext/full.md @@ -0,0 +1,148 @@ +# Transfer Learning and Prediction Consistency for Detecting Offensive Spans of Text + +Amir Pouran Ben Veyseh1, Ning Xu2, Quan Hung Tran2, Varun Manjunatha2, Franck Dernoncourt2, Thien Huu Nguyen1 + +1Department of Computer and Information Science, + +University of Oregon, Eugene, OR, USA + +2Adobe Research, San Jose, CA, USA + +{apouranb, thien}@cs.uoregon.edu + +{nxu, qtran, vmanjuna, franck.dernoncourt}@adobe.com + +# Abstract + +Toxic span detection is the task of recognizing offensive spans in a text snippet. Although there has been prior work on classifying text snippets as offensive or not, the task of recognizing spans responsible for the toxicity of a text is not explored yet. In this work, we introduce a novel multi-task framework for toxic span detection in which the model seeks to simultaneously predict offensive words and opinion phrases to leverage their inter-dependencies and improve the performance. Moreover, we introduce a novel regularization mechanism to encourage the consistency of the model predictions across similar inputs for toxic span detection. Our extensive experiments demonstrate the effectiveness of the proposed model compared to strong baselines. + +# 1 Introduction + +With the proliferation of social networks, the amount of textual data posted online is also ever-increasing. This growth comes with some challenges too. One of the issues associated with social networks is the level of toxicity expressed in posts or comments shared online. The toxic/offensive languages in social networks can be realized in different forms such as insults, mockeries, threats, discrimination, or swearing. Due to their detrimental effect on users of social networks, it is desirable to identify and remove offensive text from these networks. + +Since this is an important requirement, the task of offensive language detection has been extensively studied in NLP community (Schmidt and Wiegand, 2017; Feng et al., 2018; Borkan et al., 2019; Sivanaiah et al., 2020; Yasaswini et al., 2021). However, most of the existing works are limited to classifying a text snippet as offensive or not. In other words, these models fail to provide further information about what specific phrases in the + +text snippet contribute the most to the offensive tone of the text. This information is necessary for the moderators to decide further actions for the posts/comments flagged as offensive, especially if the text snippet is long. As such, in this work, we fill this gap by proposing a novel model for the task of offensive span detection (OSD). As an example, in the given text "This livestreamer clearly has no brain; he is such a tool!", the phrase "has no brain" and the slang word "tool" are two offensive spans responsible for the toxicity of the text. One of the barriers for this task is data scarcity. To address this limitation, we propose a novel model trained in multi-task setting in which the model is trained on two tasks: (1) Offensive phrase detection whose goal is to detect word(s) contributing to the toxicity of the text, (2) Opinion word extraction which is supposed to assist the main model to pinpoint word(s) conveying subjectivity. Note that the second task could help the model restrict its prediction to more likely words. As the available resources for offensive span detection do not provide any annotation for opinion words in the text, in this work, we propose to employ transfer learning to fulfill the training on the second task (i.e., opinion word extraction). In particular, a separate model is pre-trained on sentiment polarity prediction on a sentiment analysis corpus. Afterward, the pretrained model is exerted to provide supervision for the task of opinion word extraction. In addition to the proposed multi-task setting, we also introduce a novel regularization loss in which the model is encouraged to make consistent predictions on similar inputs. Concretely, in this work, we propose to compute the similarity between samples in a mini-batch with respect to two criteria: (i) word representations (ii) prediction of offensive words. During training, the samples that have the highest similarity are encouraged to have less discrepancy with each other. In order to fulfill this goal, for the first time, we propose to employ Optimal Transport + +to compute the consistency loss between samples. We evaluate the proposed model on a recently released dataset for offensive span detection. Our extensive experiments show the effectiveness of the proposed model by outperforming the strong baselines. + +# 2 Model + +Formal Task Description: The input to the model is the document $D = [w_{1}, w_{2}, \ldots, w_{n}]$ consisting of $n$ words. The label provided for the document is also the sequence $Y = [y_{1}, y_{2}, \ldots, y_{n}]$ in which $y_{i}$ is the label for the word $w_{i}$ in BIO format. This problem is modeled as a sequence labeling task in which the model predicts the label of every word $w_{i}$ in the document $D$ . Our proposed method is based on multi-task training with opinion word prediction as the auxiliary task. We also propose a novel regularization using Optimal Transport. The rest of this section provides details of our approach. + +# 2.1 Main Task + +For the main task of offensive span detection (OSD), we employ the BERTbase model with fixed parameters to encode the input text. Formally, the input to the BERT model is $[CLS]w_1w_2\ldots w_n[SEP]$ and the representation of the token at the final layer of the BERT model are used to represent them, i.e., $X = [x_{1},x_{2},\dots ,x_{n}]$ . Since the parameters of the BERT model are fixed, to update the representations of the tokens for the offensive span detection task, we feed the representations $X$ to a Bi-directional Long Short-Term Memory (BiLSTM) network. The hidden states of the BiLSTM network is used as the final representations of the words, i.e., $H = [h_{1},h_{2},\dots ,h_{n}]$ . Finally, a two-layer feed-forward network is employed to obtain the label distribution $P(\cdot |D,w_i)$ for word $w_{i}$ : $P(\cdot |D,w_i) = \mathrm{softmax}(W_1*(W_2*h_i + b_1) + b_2)$ , where $W_{1}$ and $W_{2}$ are the weight matrices, $b_{1}$ and $b_{2}$ are biases, softmax is the softmax function, and the $P(\cdot |D,w_i)$ represent the probability distribution over different labels predicted by the feed-forward layer for the word $w_{i}$ . To train this model, we use cross-entropy loss in word-level (i.e., negative log-likelihood). More specifically, the following loss function is used: $\mathcal{L}_{main} = -\sum_{i}^{n}\log (P(y_{i}|D,w_{i}))$ , where $y_{i}$ is the gold label for the word $w_{i}$ in the document $D$ in training data. + +# 2.2 Auxiliary Task + +One of the limitations of the existing training data for OSD is their small size which could hurt the generalization ability of the model. To alleviate this issue, we propose to train the model in a multitask setting, thus benefiting from the interaction between the main and the auxiliary task. Specifically, we choose opinion work extraction (OWE) as the auxiliary task. In this task, the goal is to find the words conveying sentiment in text. Note that opinion words are the super-set of the toxic words, as such training on OWE could help the model to restrict its predictions to more likely words. Unfortunately, the existing OSD datasets do not annotate the opinion words. Therefore, to train the model on OWE, we resort to transfer-learning, in which a pre-trained model on another related task, i.e., Sentiment Analysis (SA), is employed to guide the OSD model on the auxiliary task OWE. + +Specifically, for the pre-training of the $SA$ model, we employ the available sentiment analysis dataset, i.e., $\mathcal{D}_{SA}$ . In this dataset, every sentence $S' \in \mathcal{D}_{SA}$ is labeled as "Positive", "Neutral" or "Negative". To train the model $SA$ , the sentence $S'$ , represented by the GloVe embedding of its words, is encoded by a BiLSTM network, i.e., $H' = [h_1', h_2', \ldots, h_m']$ . Finally, a feed-forward network consumes the max-pooled representation of the sentence $S'$ to produce the label probability distribution, i.e., $P'(\cdot | S') = F F(MAX\_POOL(H'))$ . To train the model, the negative log-likelihood is employed: $\mathcal{L}_{pre} = -\log(P(l | S'))$ , where $l$ is the label of the sentence $S'$ . + +In order to employ the per-trained $SA$ model to guide the OSD model for OWE, we posit that if the OSD model masks the opinion words of the input document $D$ then the pre-trained model $SA$ will predict Neutral label for the masked document. Note that without masking, the sentiment of the document $D$ is always negative. To fulfill this idea, in our model, we first feed the representation of the document $D$ , i.e., the vectors $H$ obtained from BiLSTM of OSD model, to a feed-forward network to obtain the scores $A = [a_{1}, a_{2}, \ldots, a_{n}]$ , where $a_{i} = \sigma(FF(h_{i}))$ and $\sigma$ is the sigmoid activation function. The scores $a_{i}$ represent the extent to which the OSD model predicts $w_{i}$ as opinion word. Next, to mask out the opinion words, the weighted vectors $X'$ is computed: $X' = [x_{1}', x_{2}', \ldots, x_{n}]$ , where $x_{i}' = a_{i} * x_{i}$ and $x_{i}$ is the GloVe embedding of the word $w_{i} \in D$ . The masked document + +representation $X^{\prime}$ is fed into the pre-trained model SA to obtain the label distribution $P^{\prime}(\cdot |D)$ . Note that, during training of the main model, the parameters of the pre-trained SA model are fixed. To train the main model, we use the following loss function: $\mathcal{L}_{aux} = -\log (P'(l_n|D))$ , where $l_{n}$ is the Neutral label. As the training could collapse by predicting all-zero vector for $A$ , we use the following regularization for the auxiliary task: $\mathcal{L}_{reg} = |n - \mathrm{SUM}(A)|$ , where $n$ is the length of the document and $SUM(X)$ is the sum of all elements of the vector $X$ . + +# 2.3 Prediction Consistency + +In order to address the data scarcity for OSD, we also propose a novel regularization in which the model is encouraged to make consistent predictions for similar input documents. Hence, the model behavior on one sample can guide it on the other samples too. To this end, we propose to compute the consistency between model's predictions on two documents $D_{i}$ and $D_{j}$ by the cost of converting $(D_{i}, Y_{i}')$ to $(D_{j}, Y_{j}')$ where $Y_{i}'$ and $Y_{j}'$ are predictions of the model for documents $D_{i}$ and $D_{j}$ , respectively. This problem can be efficiently solved by Optimal Transport (OT). OT is a method to compute the lowest cost of converting a probability distribution to another one. Formally, given the probability distributions $p(x)$ and $q(y)$ over the domains $\mathcal{X}$ and $\mathcal{Y}$ , and the cost function $C(x, y): \mathcal{X} \times \mathcal{Y} \to \mathbb{R}_{+}$ for mapping $\mathcal{X}$ to $\mathcal{Y}$ , OT finds the optimal joint distribution $\pi^{*}(x, y)$ (over $\mathcal{X} \times \mathcal{Y}$ ) with marginals $p(x)$ and $q(y)$ , i.e., the cheapest transportation from $p(x)$ to $q(y)$ , by solving the following problem: + +$$ +\begin{array}{l} \pi^ {*} (x, y) = \min _ {\pi \in \Pi (x, y)} \int_ {\mathcal {Y}} \int_ {\mathcal {X}} \pi (x, y) C (x, y) d x d y \tag {1} \\ \begin{array}{l} \text {s . t .} x \sim p (x) \text {a n d} y \sim q (y), \end{array} \\ \end{array} +$$ + +where $\Pi (x,y)$ is the set of all joint distributions with marginals $p(x)$ and $q(y)$ . Note that if the distributions $p(x)$ and $q(y)$ are discrete, the integrals in Equation 1 are replaced with a sum and the joint distribution $\pi^* (x,y)$ is represented by a matrix whose entry $(x,y)$ represents the probability of transforming the data point $x\in \mathcal{X}$ to $y\in \mathcal{V}$ to convert the distribution $p(x)$ to $q(y)$ . By solving the problem in Equation $1^{1}$ , the cost of transforming the discrete distribution $p(x)$ to $q(y)$ + +(i.e., Wasserstein distance $Dist_W$ ) is defined as: $Dist_W = \Sigma_{x \in \mathcal{X}} \Sigma_{y \in \mathcal{Y}} \pi^*(x, y) C(x, y)$ . + +In our model, we use the Wasserstein distance $Dist_W$ between two documents to compute their consistency. In particular, for every pair of $(D_k, D_l)$ where $D_k$ and $D_l$ are two documents in the same mini-batch, the domain $\mathcal{X}$ is defined over the word representations of the document $D_k$ , i.e., $H_k$ , and the domain $\mathcal{Y}$ is defined over the word representations of the document $D_l$ , i.e., $H_l$ . Moreover, in order to define the distributions $p(x)$ and $q(y)$ , we take the probability of the label $O$ for each word of the document $D_k$ and $D_l$ predicted by the main task model and feed that into a softmax function. + +Finally, to define the cost function $C(x_{i},y_{j})$ , we use the Euclidean distance between the two vector representation $h_i$ and $h_j$ for the word $w_i$ of $D_k$ and the word $w_j$ of $D_l$ : $C(x_i,y_j) = \| h_i - h_j\|$ . Using these definitions, we can use OT to compute the Wasserstein distance $Dist_W^{k,l}$ between the document $D_k$ and $D_l$ in the same mini-batch. Finally, we select the document $D_{k'}$ as the most similar document to $D_k$ where: $k' = \mathrm{argmin}_lDist_W^{k,l}$ + +Hence, we define the consistency loss for document $D_{k}$ as its Wasserstein distance to the similar document $D_{k'}$ : $\mathcal{L}_{\text{cons}} = \text{Dist}_W^{k,k'}$ . + +Finally, we use the following loss function with trade-off parameters $\alpha, \beta$ , and $\gamma$ to train the entire model: $\mathcal{L} = \mathcal{L}_{main} + \alpha * \mathcal{L}_{aux} + \beta * \mathcal{L}_{reg} + \gamma * \mathcal{L}_{cons}$ + +# 3 Experiments + +In order to evaluate the effectiveness of the proposed model, called TPOSD (Transfer learning and Prediction consistency for Offensive Span Detection), in our experiments, we use the dataset of SemEval 2021 Task 5 (John Pavlopoulos and Laugier, 2021). We use the official splits with 7939/690/2000 documents in train/development/test sets. Also, to pre-train the SA model for the sentiment analysis task to be used for auxiliary training, we employ the Amazon-2 dataset Zhang et al. (2015). In our model we use the (fixed) BERTbase to encode data; 250 dimensions for the hidden states of LSTM and 2 layers for feed-forward neural networks with 250 hidden dimensions. The trade-off parameters $\alpha$ , $\beta$ and $\gamma$ are set to 0.1, 0.1, and 0.05, respectively. The learning rate is set to 0.3 for the Adam optimizer and the batch size of 64 is employed during training. + +we compare the performance of TPOSD with + +
ModelPrecisionRecallF1
BiLSTM-CRF55.3162.5758.72
BERT-CRF61.4565.0363.19
DUAL-MRC60.1369.0264.27
SANER62.9671.0766.77
IITK--68.20
TPOSD (Ours)67.7871.9269.79
+ +the following baselines: (1) BiLSTM+CRF: The GloVe embedded document is encoded by BiLSTM and the labels are predicted by a CRF layer; (2) BERT+CRF: BERTbase parameters are finetuned on OSD task and the task-specific head, i.e., CRF, is employed for label prediction; (3) IITK (Bansal et al., 2021): This baseline is the existing SOTA model on SemEval 2021 Task 5 dataset; (4) SANER (Nie et al., 2020): This baseline is the SOTA model for sequence labeling on user-generated text; (5) DUAL-MRC (Mao et al., 2021): This is the SOTA model for opinion and aspect term extraction. Note that since there are not target annotations in SemEval dataset, we skip the aspect term extraction task in the training of this baseline. + +Results: Table 1 shows the performance of the models on the test set. There are several observations from this table. First, the BiLSTM-CRF model significantly underperforms the other baselines that employ BERT embedding. It clearly shows that the background knowledge encoded in the BERT model is necessary for the task of offensive span detection. Second, both DUAL-MRC and SANER baseline outperform the BERT-CRF model. This higher performance could be attributed to their capability to augment the representation of the words obtained from the BERT model. Third, among all baselines, our proposed model achieves the highest performance. Our hypothesis for the achieved improvement is that the proposed model is able to restrict its predictions to the more probable candidate spans, i.e., opinion words, due to the training of the auxiliary task. Moreover, it performs more consistently across different documents thanks to the consistency regularization employed during the training of the model. + +Analysis: To study the contribution of the proposed techniques, we conduct an ablation study on the development set of the SemEval 2021 Task 5 dataset. Specifically, we ablate the auxiliary task $(\mathbf{OWE}^{-})$ , the regularization in the auxiliary + +Table 1: Performance of the models on the test set of the SemEval 2021 Task 5 dataset. + +
ModelPrecisionRecallF1
TPOSD66.8870.8568.81
OWE-65.6062.7264.13
AuxReg-65.1166.9966.04
Cons-67.1965.4766.32
Cons-sem65.4466.8366.13
Cons-pred65.2470.5967.81
+ +Table 2: Ablation study on the development set of the SemEval 2021 Task 5 dataset. + +task $(\mathbf{AuxReg}^{-})$ , i.e., $\mathcal{L}_{reg}$ , the consistency loss $(\mathbf{Cons}^{-})$ , i.e., $\mathcal{L}_{cons}$ . Also, we study the performance of the model when the Wasserstein distance is computed regardless of the document representations $(\mathbf{Cons}^{-sem})$ or model predictions $(\mathbf{Cons}^{-pred})$ . The results are shown in Table 2. This table shows that all components are necessary, as removing each will hurt the performance. Specifically, the auxiliary task has the largest effect on the final performance, indicating the importance of the proposed method. For the case study analysis, see appendices. + +In the proposed approach, to simultaneously train the model on OSD and OWE, as the existing training data for OSD does not provide gold labels for OWE, we resort to transfer-learning, in which a pre-trained sentiment-analysis model is employed to supervise the main model on OWE task. However, one natural question is that why transfer-learning is the optimal approach to train the model on OWE? To answer this question, in this section, we propose a baseline, in which a model pre-trained on OWE is employed to automatically annotate the existing OSD training data with opinion words for OWE task. In particular, we first train a sequence-tags consisting of a BiLSTM encoder followed by a feed-forward layer on the available OWE dataset. Specifically, in our experiments, we use the combinations of the four benchmark datasets presented by Fan et al. (2019) as the training data to pre-train the OWE model. Note that the original datasets by Fan et al. (2019) provide opinion words with respect to a given target mention. However, in the pre-training of the OWE model, we aim to train the model to detect all opinion words in the input text. As such, in our experiments, we combine opinion words of all samples of the same sentence in the dataset. Finally, the pre-trained OWE model is employed to annotate the opinion words in the OSD dataset, i.e., SemEval 2021 Task 5 (John Pavlopoulos and Laugier, 2021). The au + +
ModelPrecisionRecallF1
Pre-Train OWE64.1168.8366.39
TPOSD (Ours)67.7871.9269.79
+ +Table 3: Performance of the models on the test set of the SemEval 2021 Task 5 dataset. + +tomatically annotated OSD dataset with opinion words is next employed to jointly train the main model on OSD and OWE. Concretely, the representations of the words obtained from the main model BiLSTM, i.e., $H = [h_1, h_2, \dots, h_n]$ , are fed into two different feed-forward layers $FF_{OSD}$ and $FF_{OWE}$ to obtain the label probability distribution $P_{OSD}(\cdot | D, w_i)$ and $P_{OWE}(\cdot | D, w_i)$ , respectively: $P_{OSD}(\cdot | D, w_i) = \text{softmax}(FF_{OSD}(h_i))$ , and $P_{OWE}(\cdot | D, w_i) = \text{softmax}(FF_{OWE}(h_i))$ . + +Finally, the following loss functions are employed for each task: $\mathcal{L}_{OSD} = -\sum_{i}^{n}\log (P_{OSD}(y_{i}^{OSD}|D,w_{i}))$ and $\mathcal{L}_{OWE} = -\sum_{i}^{n}\log (P_{OWE}(y_{i}^{OWE}|D,w_{i}))$ where $y_{i}^{OSD}$ and $y_{j}^{OWE}$ are the gold labels for offensive span detection (OSD), provided in the SemEval dataset, and opinion word extraction (OWE) tasks, provided by the pre-trained OWE model, for $i$ -th word. The overall loss to train the model jointly on both tasks is then defined by: $\mathcal{L}_{total} = \mathcal{L}_{OSD} + \alpha *\mathcal{L}_{OWE}$ . + +We call this baseline Pre-Train OWE and its performance on the test set of the SemEval dataset is reported in Table 3. This table shows that this baseline under-performs our transfer-learning approach. Our hypothesis for this inferior performance is that compared to our transfer-learning approach that utilizes soft filtering of the input text to identify the opinion words, the pre-trained model employs the discrete labels for OWE generated by the pre-trained model. As the pre-trained OWE model could be erroneous, thus the errors can more easily deflect the training of the main model. Unlike this baseline, in our proposed model, the opinion words are denoted by the scores $A$ discussed in section 2.2. As such, the soft opinion word extraction mechanism in our proposed model has more potential to overcome errors in the OWE task. + +# 4 Related Work + +Prior works related to this task can be categorized into two groups: (i) Toxicity Detection: These works aim to classify a piece of text as toxic or nontoxic (Wulczyn et al., 2017; Borkan et al., 2019; Schmidt and Wiegand, 2017; Pavlopoulos et al., + +2017a,b, 2019; Zampieri et al., 2019). The main limitation of these works is that they cannot recognize the spans in the text that are responsible for the toxicity of the text. (ii) Opinion Word Extraction: In this group, models perform a sequence labeling task to identify the spans in the text that convey the sentiment (Liu et al., 2015; Xu et al., 2018; Yin et al., 2016; Wang et al., 2016, 2017; Li and Lam, 2017; Mao et al., 2021). The major limitation of all these models is that they require the existence of the target opinion (i.e., the word or phrase that the text has a sentiment polarity toward it). + +# 5 Conclusion + +In this work, we proposed a novel model for offensive span detection. To train the model, in a novel framework, we propose to exploit the interaction with the related task of opinion word extraction. Specifically, in a multi-task learning setting, we train the model for offensive and opinion word extraction. Also, we introduce a novel regularization loss based on optimal transport which encourages the consistency of the model prediction on similar documents. Our experiments on the available benchmark dataset show the effectiveness of the proposed model and outperform strong baselines. + +# Acknowledgments + +This research has been supported by the Army Research Office (ARO) grant W911NF-21-1-0112 and the NSF grant CNS-1747798 to the IUCRC Center for Big Learning. This research is also based upon work supported by the Office of the Director of National Intelligence (ODNI), Intelligence Advanced Research Projects Activity (IARPA), via IARPA Contract No. 2019-19051600006 under the Better Extraction from Text Towards Enhanced Retrieval (BETTER) Program. The views and conclusions contained herein are those of the authors and should not be interpreted as necessarily representing the official policies, either expressed or implied, of ARO, ODNI, IARPA, the Department of Defense, or the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints for governmental purposes notwithstanding any copyright annotation therein. This document does not contain technology or technical data controlled under either the U.S. International Traffic in Arms Regulations or the U.S. Export Administration Regulations. + +# References + +Archit Bansal, Abhay Kaushik, and Ashutosh Modi. 2021. Iitk@ detox at semeval-2021 task 5: Semi-supervised learning and dice loss for toxic spans detection. arXiv preprint arXiv:2104.01566. +Daniel Borkan, Lucas Dixon, Jeffrey Sorensen, Nithum Thain, and Lucy Vasserman. 2019. Nuanced metrics for measuring unintended bias with real data for text classification. In *Companion proceedings of the 2019 world wide web conference*, pages 491-500. +Zhifang Fan, Zhen Wu, Xin-Yu Dai, Shujian Huang, and Jiajun Chen. 2019. Target-oriented opinion words extraction with target-fused neural sequence labeling. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 2509-2518, Minneapolis, Minnesota. Association for Computational Linguistics. +Shi Feng, Eric Wallace, Alvin Grissom II, Mohit Iyyer, Pedro Rodriguez, and Jordan Boyd-Graber. 2018. Pathologies of neural models make interpretations difficult. arXiv preprint arXiv:1804.07781. +Jeffrey Sorensen John Pavlopoulos, Ion Androutsopoulos and Léo Laugier. 2021. Toxic span detection at semeval 2021. In SemEval 2021 (To Appear). +Xin Li and Wai Lam. 2017. Deep multi-task learning for aspect term extraction with memory interaction. In Proceedings of the 2017 conference on empirical methods in natural language processing, pages 2886-2892. +Pengfei Liu, Shafiq Joty, and Helen Meng. 2015. Fine-grained opinion mining with recurrent neural networks and word embeddings. In Proceedings of the 2015 conference on empirical methods in natural language processing, pages 1433-1443. +Yue Mao, Yi Shen, Chao Yu, and Longjun Cai. 2021. A joint training dual-mrc framework for aspect based sentiment analysis. arXiv preprint arXiv:2101.00816. +Yuyang Nie, Yuanhe Tian, Xiang Wan, Yan Song, and Bo Dai. 2020. Named entity recognition for social media texts with semantic augmentation. In EMNLP. +John Pavlopoulos, Prodromos Malakasiotis, and Ion Androutsopoulos. 2017a. Deep learning for user comment moderation. arXiv preprint arXiv:1705.09993. +John Pavlopoulos, Prodromos Malakasiotis, and Ion Androutsopoulos. 2017b. Deeper attention to abusive user content moderation. In Proceedings of the 2017 conference on empirical methods in natural language processing, pages 1125-1135. + +John Pavlopoulos, Nithum Thain, Lucas Dixon, and Ion Androutsopoulos. 2019. Convai at semeval-2019 task 6: Offensive language identification and categorization with perspective and bert. In Proceedings of the 13th international Workshop on Semantic Evaluation, pages 571-576. +Gabriel Peyre and Marco Cuturi. 2019. Computational optimal transport: With applications to data science. In Foundations and Trends in Machine Learning. +Anna Schmidt and Michael Wiegand. 2017. A survey on hate speech detection using natural language processing. In Proceedings of the fifth international workshop on natural language processing for social media, pages 1-10. +Rajalakshmi Sivanaiah, Angel Suseelan, S Milton Rajendram, and Mirnalinee Tt. 2020. Techssn at semeval-2020 task 12: Offensive language detection using bert embeddings. In Proceedings of the Fourteenth Workshop on Semantic Evaluation, pages 2190-2196. +Wenya Wang, Sinno Jialin Pan, Daniel Dahlmeier, and Xiaokui Xiao. 2016. Recursive neural conditional random fields for aspect-based sentiment analysis. arXiv preprint arXiv:1603.06679. +Wenya Wang, Sinno Jialin Pan, Daniel Dahlmeier, and Xiaokui Xiao. 2017. Coupled multi-layer tensor network for co-extraction of aspect and opinion terms. In Proceedings of AAAI, pages 3316-3322. +Ellery Wulczyn, Nithum Thain, and Lucas Dixon. 2017. Ex machina: Personal attacks seen at scale. In Proceedings of the 26th international conference on world wide web, pages 1391-1399. +Hu Xu, Bing Liu, Lei Shu, and Philip S Yu. 2018. Double embeddings and cnn-based sequence labeling for aspect extraction. arXiv preprint arXiv:1805.04601. +Konthala Yasaswini, Karthik Puranik, Adeep Hande, Ruba Priyadharshini, Sajeetha Thavareesan, and Bharathi Raja Chakravarthi. 2021. Iiitt@ dravidianlangtech-eacl2021: Transfer learning for offensive language detection in dravidian languages. In Proceedings of the First Workshop on Speech and Language Technologies for Dravidian Languages, pages 187-194. +Yichun Yin, Furu Wei, Li Dong, Kaimeng Xu, Ming Zhang, and Ming Zhou. 2016. Unsupervised word and dependency path embeddings for aspect term extraction. arXiv preprint arXiv:1605.07843. +Marcos Zampieri, Shervin Malmasi, Preslav Nakov, Sara Rosenthal, Noura Farra, and Ritesh Kumar. 2019. Semeval-2019 task 6: Identifying and categorizing offensive language in social media (offenseval). arXiv preprint arXiv:1903.08983. +Xiang Zhang, Junbo Zhao, and Yann LeCun. 2015. Character-level convolutional networks for text classification. In NIPS. + +# A Case Study + +To qualitatively study the improvement achieved by the proposed model, in Table 4, we present some cases that the proposed model could successfully identify the offensive spans while the other baselines fail. Specifically, cases 1 and 2 show that the baseline BERT-CRF incorrectly predict non-opinion words/phrase "gross reliance" and "joke" as the offensive spans. On the other hand, TPOSD successfully predicts the offensive spans. This improvement could be attributed to the training of the main model on opinion word extraction which could restrict model decisions to more likely words. Moreover, in case 3, the baseline BERT-CRF incorrectly predicts the word "strange" as the offensive word. However, the proposed TPOSD model successfully identifies the word "idiot" as the only offensive word in the text. Among other reasons, the better performance of the proposed model for this case could be due to the regularization enforced during training which helps the model learns from other samples that "strange" is less likely to be used as the offensive word. + +
IDDocumentBERT-CRFTPOSDGold
1Sorry. Damn spell checker and my gross reliance on it! My humblest apologies :-)gross relianceDamnDamn
2Yeah, what a joke. They can’t confirm the gunshot wounds were inflicted by the police? Ridiculous.jokeRidiculousRidiculous
3Hard to believe this strange comment! He is such an idiot.strange, idiotidiotidiot
+ +Table 4: Case study in SemEval 2021 Task 5 dataset. Predicted offensive words by the BERT-CRF and the proposed model, TPOSD, along with gold labels are provided. \ No newline at end of file diff --git a/transferlearningandpredictionconsistencyfordetectingoffensivespansoftext/images.zip b/transferlearningandpredictionconsistencyfordetectingoffensivespansoftext/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..ef1a67d407c710f9a22690a7b5f5a1ce86d8dfa0 --- /dev/null +++ b/transferlearningandpredictionconsistencyfordetectingoffensivespansoftext/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6b1b8f7276774b665578c93c5e157e300c72403a0f2fd08de2bd5c601f063b44 +size 102633 diff --git a/transferlearningandpredictionconsistencyfordetectingoffensivespansoftext/layout.json b/transferlearningandpredictionconsistencyfordetectingoffensivespansoftext/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..b7a00d41592a93b4753b252ce3bec88a0717fec4 --- /dev/null +++ b/transferlearningandpredictionconsistencyfordetectingoffensivespansoftext/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d28ffc1b554ac6a38be8640f49868fc173fd970dead48c7591b13fd9bb4b10cf +size 286612